UNPKG

timered-counter

Version:

Make the value change more vivid and natural

1,516 lines 278 kB
{ "schemaVersion": "1.0.0", "readme": "", "modules": [ { "kind": "javascript-module", "path": "src/index.ts", "declarations": [], "exports": [ { "kind": "js", "name": "TimeredCounter", "declaration": { "name": "TimeredCounter", "module": "src/index.ts" } }, { "kind": "js", "name": "TimeredCounterDatetimeDuration", "declaration": { "name": "TimeredCounterDatetimeDuration", "module": "src/index.ts" } }, { "kind": "js", "name": "TimeredCounterNumber", "declaration": { "name": "TimeredCounterNumber", "module": "src/index.ts" } }, { "kind": "js", "name": "TimeredCounterString", "declaration": { "name": "TimeredCounterString", "module": "src/index.ts" } }, { "kind": "js", "name": "*", "declaration": { "name": "*", "package": "./easing/index.js" } }, { "kind": "js", "name": "*", "declaration": { "name": "*", "package": "./types/index.js" } }, { "kind": "js", "name": "*", "declaration": { "name": "*", "package": "./timered-counter-adapter.js" } } ] }, { "kind": "javascript-module", "path": "src/timered-counter-adapter.ts", "declarations": [ { "kind": "class", "description": "", "name": "TimeredCounterAdapter", "members": [ { "kind": "field", "name": "AVAILABLE_NUMBER_ADAPTERS", "type": { "text": "Map<string[], () => NumberAdapter>" }, "static": true, "default": "new Map([ [['number'], BuildInNumberAdapter], // [['decimal.js', 'decimaljs'], DecimalJsAdapter()], ])" }, { "kind": "field", "name": "AVAILABLE_STRING_ADAPTERS", "type": { "text": "Map<string[], () => StringAdapter>" }, "static": true, "default": "new Map([ [['string'], BuildInStringAdapter], [['intl-segmenter'], BuildInIntlSegmenterAdapter], // [['grapheme-splitter'], GraphemeSplitterAdapter()], ])" }, { "kind": "field", "name": "NUMBER_ADAPTER", "type": { "text": "NumberAdapter" }, "static": true, "description": "数字适配器, 有以下两种:\n1. BuildInNumberAdapter(默认): 使用内置 number 进行计算.\n2. DecimalJsAdapter: 使用 Decimal.js 进行计算.\n\n详细信息请查看[字符长度限制](/guide/optional-dependencies#字符长度限制)章节.", "default": "BuildInNumberAdapter" }, { "kind": "field", "name": "STRING_ADAPTER", "type": { "text": "StringAdapter" }, "static": true, "description": "字符串适配器, 有以下两种:\n1. BuildInStringAdapter(默认): 使用内置 string 进行字符串处理.\n2. BuildInIntlSegmenterAdapter: 使用 Intl.Segmenter 进行字符串处理. 能够支持 emoji, 字符集.\n3. GraphemeSplitterAdapter: 使用 grapheme-splitter 进行字符串处理. 能够支持 emoji, 字符集.\n\n详细信息请查看[支持 emoji 分词](/guide/optional-dependencies#支持-emoji-分词)章节.", "default": "BuildInStringAdapter" }, { "kind": "field", "name": "VALUE_CONVERTER", "type": { "text": "object" }, "static": true, "default": "{ fromAttribute(value: string | null) { return value; }, toAttribute(value: unknown) { return isNullish(value) ? value : TimeredCounterAdapter.NUMBER_ADAPTER.toString(value); }, }", "description": "将 value 及其相关的属性, 在 attribute 和 property 上的互相转换.", "privacy": "protected" }, { "kind": "method", "name": "setNumberAdapter", "static": true, "parameters": [ { "name": "adapterOrType", "type": { "text": "NumberAdapter | 'number' | string" } } ], "description": "设置要使用的数字适配器. 仅对设置完之后的 TimeredCounter 实例生效.\n\n接受的关键字除了内置的 `number` 以外, 还可以通过 registerNumberAdapter 注册的 `keyword`." }, { "kind": "method", "name": "setStringAdapter", "static": true, "parameters": [ { "name": "adapterOrType", "type": { "text": "StringAdapter | 'string' | 'intl-segmenter' | string" } } ], "description": "与 setNumberAdapter 类似, 用于设置字符串适配器." }, { "kind": "method", "name": "registerNumberAdapter", "static": true, "parameters": [ { "name": "keyword", "type": { "text": "string[]" } }, { "name": "adapter", "type": { "text": "() => NumberAdapter" } } ] }, { "kind": "method", "name": "registerStringAdapter", "static": true, "parameters": [ { "name": "keyword", "type": { "text": "string[]" } }, { "name": "adapter", "type": { "text": "() => StringAdapter" } } ] }, { "kind": "method", "name": "registryAdapter", "static": true, "parameters": [ { "name": "adapter", "type": { "text": "{\n register: (counterAdapter: typeof TimeredCounterAdapter) => void;\n }" } } ], "description": "可以直接使用 adapter 文件的导出进行注册.\n\nadapter 文件需要导出一个名为 register 的函数, 该函数接受一个 TimeredCounterAdapter 类型的参数.\n\n具体示例请查看 GraphemeSplitterAdapter or DecimalJsAdapter." } ] }, { "kind": "function", "name": "setNumberAdapter", "parameters": [ { "name": "args", "type": { "text": "Parameters<(typeof TimeredCounterAdapter)['setNumberAdapter']>" } } ] }, { "kind": "function", "name": "setStringAdapter", "parameters": [ { "name": "args", "type": { "text": "Parameters<(typeof TimeredCounterAdapter)['setStringAdapter']>" } } ] }, { "kind": "function", "name": "registerNumberAdapter", "parameters": [ { "name": "args", "type": { "text": "Parameters<(typeof TimeredCounterAdapter)['registerNumberAdapter']>" } } ] }, { "kind": "function", "name": "registerStringAdapter", "parameters": [ { "name": "args", "type": { "text": "Parameters<(typeof TimeredCounterAdapter)['registerStringAdapter']>" } } ] } ], "exports": [ { "kind": "js", "name": "TimeredCounterAdapter", "declaration": { "name": "TimeredCounterAdapter", "module": "src/timered-counter-adapter.ts" } }, { "kind": "js", "name": "setNumberAdapter", "declaration": { "name": "setNumberAdapter", "module": "src/timered-counter-adapter.ts" } }, { "kind": "js", "name": "setStringAdapter", "declaration": { "name": "setStringAdapter", "module": "src/timered-counter-adapter.ts" } }, { "kind": "js", "name": "registerNumberAdapter", "declaration": { "name": "registerNumberAdapter", "module": "src/timered-counter-adapter.ts" } }, { "kind": "js", "name": "registerStringAdapter", "declaration": { "name": "registerStringAdapter", "module": "src/timered-counter-adapter.ts" } } ] }, { "kind": "javascript-module", "path": "src/timered-counter-datetime-duration.ts", "declarations": [ { "kind": "class", "description": "", "name": "TimeredCounterDatetimeDuration", "members": [ { "kind": "field", "name": "__precision", "type": { "text": "DurationPartType | [DurationPartType, DurationPartType]" }, "privacy": "private", "default": "[DurationPartType.Second, DurationPartType.Day]" }, { "kind": "field", "name": "precision", "description": "计数器显示的精度.\n1. 当为单个值时, 表示最小精度.\n2. 当为数组时, 第一个值表示最小精度, 第二个值表示最大精度.", "default": "[DurationPartType.Second, DurationPartType.Day]", "attribute": "precision", "reflects": true }, { "kind": "field", "name": "value", "attribute": "value", "reflects": true, "description": "通过 property 设置 value 时, 支持 Date 类型.", "inheritedFrom": { "name": "CounterBaseMixin", "module": "src/mixins/counter-base.ts" } }, { "kind": "field", "name": "__initialValuePlain", "type": { "text": "any" }, "privacy": "private", "default": "null" }, { "kind": "field", "name": "initialValue", "description": "同 value", "attribute": "initial-value", "reflects": true, "inheritedFrom": { "name": "CounterBaseMixin", "module": "src/mixins/counter-base.ts" } }, { "kind": "field", "name": "__partsOptions", "type": { "text": "Partial<PartsOptions> | null" }, "privacy": "private", "default": "null" }, { "kind": "field", "name": "partsOptions", "type": { "text": "InnerPartsOptions" }, "description": "这是 `usePartData` 的配置项. `usePartData` 被用于从数值的变化中生成用于滚动的数据.\n这里不会有太多解释, 因为它是一个底层的配置项. 你可以查看 `CounterPartsMixinClass` 的源码了解更多信息.", "attribute": "parts-options", "inheritedFrom": { "name": "CounterPartsMixin", "module": "src/mixins/counter-parts.ts" } }, { "kind": "field", "name": "__from", "type": { "text": "Date" }, "privacy": "private", "default": "new Date()" }, { "kind": "field", "name": "__to", "type": { "text": "Date" }, "privacy": "private", "default": "new Date()" }, { "kind": "field", "name": "__minPrecision", "type": { "text": "DurationPartType" }, "privacy": "private" }, { "kind": "field", "name": "__maxPrecision", "type": { "text": "DurationPartType" }, "privacy": "private" }, { "kind": "field", "name": "__availableDurationParts", "privacy": "private", "default": "[]" }, { "kind": "field", "name": "__dateTimeFieldLabels", "privacy": "private", "default": "{}" }, { "kind": "method", "name": "sampleSplit", "parameters": [ { "name": "samples", "type": { "text": "AvailableNumberAdapterValueType[]" } } ], "return": { "type": { "text": "AvailableNumberAdapterValueType[][]" } }, "inheritedFrom": { "name": "CounterPartsMixin", "module": "src/mixins/counter-parts.ts" } }, { "kind": "method", "name": "generateAriaLabel", "return": { "type": { "text": "string" } }, "description": "生成 aria-label 属性值. 在每次更新完成后调用.", "inheritedFrom": { "name": "CounterAiraMixin", "module": "src/mixins/counter-aira.ts" } }, { "kind": "field", "name": "ariaLabel", "type": { "text": "string" }, "default": "''", "attribute": "aria-label", "reflects": true, "inheritedFrom": { "name": "CounterAiraMixin", "module": "src/mixins/counter-aira.ts" } }, { "kind": "field", "name": "ariaLive", "type": { "text": "'off' | 'polite' | 'assertive'" }, "default": "'polite'", "attribute": "aira-live", "reflects": true, "inheritedFrom": { "name": "CounterAiraMixin", "module": "src/mixins/counter-aira.ts" } }, { "kind": "field", "name": "animationOptions", "type": { "text": "PartDigitValueOrGetter<KeyframeAnimationOptions>" }, "default": "{}", "description": "传递给 Web Animations API 的选项.", "attribute": "animation-options", "reflects": true, "inheritedFrom": { "name": "CounterAnimationMixin", "module": "src/mixins/counter-animation.ts" } }, { "kind": "field", "name": "animationOptionsDynamic", "type": { "text": "PartDigitGetter<KeyframeAnimationOptions> | undefined" }, "inheritedFrom": { "name": "CounterAnimationMixin", "module": "src/mixins/counter-animation.ts" } }, { "kind": "field", "name": "cachedAnimationOptions", "type": { "text": "(KeyframeAnimationOptions | undefined)[][]" }, "privacy": "private", "default": "[]", "inheritedFrom": { "name": "CounterAnimationMixin", "module": "src/mixins/counter-animation.ts" } }, { "kind": "method", "name": "extractAnimationOptions", "inheritedFrom": { "name": "CounterAnimationMixin", "module": "src/mixins/counter-animation.ts" } }, { "kind": "field", "name": "keyframes", "type": { "text": "PartDigitValueOrGetter<PropertyIndexedKeyframes>" }, "default": "{}", "description": "传递给 Web Animations API 的关键帧配置.", "attribute": "keyframes", "reflects": true, "inheritedFrom": { "name": "CounterAnimationMixin", "module": "src/mixins/counter-animation.ts" } }, { "kind": "field", "name": "keyframesDynamic", "type": { "text": "PartDigitGetter<PropertyIndexedKeyframes> | undefined" }, "inheritedFrom": { "name": "CounterAnimationMixin", "module": "src/mixins/counter-animation.ts" } }, { "kind": "field", "name": "cachedKeyframes", "type": { "text": "(PropertyIndexedKeyframes | undefined)[][]" }, "privacy": "private", "default": "[]", "inheritedFrom": { "name": "CounterAnimationMixin", "module": "src/mixins/counter-animation.ts" } }, { "kind": "method", "name": "extractKeyframes", "inheritedFrom": { "name": "CounterAnimationMixin", "module": "src/mixins/counter-animation.ts" } }, { "kind": "field", "name": "cellStyles", "type": { "text": "PartDigitCellValueOrGetter<Partial<CSSStyleDeclaration>>" }, "default": "{}", "description": "对 `cell` 部分的样式进行设置. 传入的对象将被直接应用到 `cell` 的 `style` 上.\n你还可以使用 `cellStylesDynamic` 来动态设置样式.", "attribute": "cell-styles", "reflects": true, "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "field", "name": "cellStylesDynamic", "type": { "text": "PartDigitCellGetter<Partial<CSSStyleDeclaration>> | undefined" }, "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "field", "name": "cachedCellStyles", "type": { "text": "Partial<CSSStyleDeclaration | undefined>[][][]" }, "privacy": "private", "default": "[]", "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "method", "name": "extractCellStyles", "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "field", "name": "digitStyles", "type": { "text": "PartDigitValueOrGetter<Partial<CSSStyleDeclaration>>" }, "default": "{}", "description": "与 `cell` 类似, 但是是对 `digit` 部分的样式进行设置.\n你还可以使用 `digitStylesDynamic` 来动态设置样式.", "attribute": "digit-styles", "reflects": true, "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "field", "name": "digitStylesDynamic", "type": { "text": "PartDigitGetter<Partial<CSSStyleDeclaration>> | undefined" }, "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "field", "name": "cachedDigitStyles", "type": { "text": "Partial<CSSStyleDeclaration | undefined>[][]" }, "privacy": "private", "default": "[]", "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "method", "name": "extractDigitStyles", "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "field", "name": "partStyles", "type": { "text": "PartValueOrGetter<Partial<CSSStyleDeclaration>>" }, "default": "{}", "description": "与 `cell` 类似, 但是是对 `part` 部分的样式进行设置.\n你还可以使用 `partStylesDynamic` 来动态设置样式.", "attribute": "part-styles", "reflects": true, "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "field", "name": "partStylesDynamic", "type": { "text": "PartGetter<Partial<CSSStyleDeclaration>> | undefined" }, "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "field", "name": "cachedPartStyles", "type": { "text": "Partial<CSSStyleDeclaration | undefined>[]" }, "privacy": "private", "default": "[]", "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "method", "name": "extractPartStyles", "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "field", "name": "color", "type": { "text": "string" }, "default": "'inherit'", "description": "文本颜色, 可使用 CSS 属性 `color` 和 `background-image` 的值.", "attribute": "color", "reflects": true, "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "field", "name": "DEFAULT_PARTS_OPTIONS", "type": { "text": "InnerPartsOptions" }, "privacy": "private", "static": true, "default": "{ sampleCount: 16, decimalSeparator: '.', fillChar: '0', minPlaces: [1, 0], digitToChar: {}, type: 'number', }", "inheritedFrom": { "name": "CounterPartsMixin", "module": "src/mixins/counter-parts.ts" } }, { "kind": "field", "name": "#__partsOptions", "privacy": "private", "type": { "text": "InnerPartsOptions" }, "default": "{ ...CounterPartsMixinClass.DEFAULT_PARTS_OPTIONS, }", "inheritedFrom": { "name": "CounterPartsMixin", "module": "src/mixins/counter-parts.ts" } }, { "kind": "field", "name": "parts", "type": { "text": "PartData[]" }, "default": "[]", "inheritedFrom": { "name": "CounterPartsMixin", "module": "src/mixins/counter-parts.ts" } }, { "kind": "field", "name": "oldParts", "type": { "text": "PartData[]" }, "default": "[]", "inheritedFrom": { "name": "CounterPartsMixin", "module": "src/mixins/counter-parts.ts" } }, { "kind": "field", "name": "partPreprocessDataList", "type": { "text": "PartPreprocessedData[][]" }, "default": "[]", "inheritedFrom": { "name": "CounterPartsMixin", "module": "src/mixins/counter-parts.ts" } }, { "kind": "method", "name": "sampling", "parameters": [ { "name": "from", "type": { "text": "V" } }, { "name": "to", "type": { "text": "V" } } ], "inheritedFrom": { "name": "CounterPartsMixin", "module": "src/mixins/counter-parts.ts" } }, { "kind": "method", "name": "sampleToString", "parameters": [ { "name": "value", "type": { "text": "V" } } ], "inheritedFrom": { "name": "CounterPartsMixin", "module": "src/mixins/counter-parts.ts" } }, { "kind": "method", "name": "processPartData", "privacy": "private", "description": "process:\n1. 采样\n2. 转换\n3. 构造", "inheritedFrom": { "name": "CounterPartsMixin", "module": "src/mixins/counter-parts.ts" } }, { "kind": "field", "name": "__value", "type": { "text": "V" }, "privacy": "private", "inheritedFrom": { "name": "CounterBaseMixin", "module": "src/mixins/counter-base.ts" } }, { "kind": "field", "name": "__oldValue", "type": { "text": "V" }, "privacy": "private", "inheritedFrom": { "name": "CounterBaseMixin", "module": "src/mixins/counter-base.ts" } }, { "kind": "field", "name": "oldValue", "description": "用于记录上一次的值.\n\n初始化时(connectedCallback), oldValue 将被设置为 `initialValue` 或 `value` 的值.", "attribute": "old-value", "reflects": true, "inheritedFrom": { "name": "CounterBaseMixin", "module": "src/mixins/counter-base.ts" } }, { "kind": "field", "name": "__initialValue", "type": { "text": "V | null" }, "privacy": "private", "default": "null", "inheritedFrom": { "name": "CounterBaseMixin", "module": "src/mixins/counter-base.ts" } }, { "kind": "field", "name": "__locale", "type": { "text": "| Intl.UnicodeBCP47LocaleIdentifier\n | [Intl.UnicodeBCP47LocaleIdentifier, Intl.LocaleOptions]" }, "privacy": "private", "default": "'en-US'", "inheritedFrom": { "name": "CounterBaseMixin", "module": "src/mixins/counter-base.ts" } }, { "kind": "field", "name": "locale", "description": "自定义本地化配置, 否则从浏览器环境中获取.", "default": "\"en-US\"", "attribute": "locale", "reflects": true, "inheritedFrom": { "name": "CounterBaseMixin", "module": "src/mixins/counter-base.ts" } }, { "kind": "field", "name": "localeInstance", "type": { "text": "Intl.Locale" }, "inheritedFrom": { "name": "CounterBaseMixin", "module": "src/mixins/counter-base.ts" } }, { "kind": "field", "name": "direction", "type": { "text": "'up' | 'down'" }, "default": "'up'", "inheritedFrom": { "name": "CounterBaseMixin", "module": "src/mixins/counter-base.ts" } }, { "kind": "field", "name": "oldDirection", "type": { "text": "'up' | 'down'" }, "inheritedFrom": { "name": "CounterBaseMixin", "module": "src/mixins/counter-base.ts" } }, { "kind": "field", "name": "numberAdapter", "type": { "text": "NumberAdapter" }, "inheritedFrom": { "name": "CounterBaseMixin", "module": "src/mixins/counter-base.ts" } }, { "kind": "field", "name": "stringAdapter", "type": { "text": "StringAdapter" }, "inheritedFrom": { "name": "CounterBaseMixin", "module": "src/mixins/counter-base.ts" } }, { "kind": "field", "name": "resizeObserver", "type": { "text": "ResizeObserver" }, "default": "new ResizeObserver(() => { this.partsContainerRect = this.partsContainer ? this.partsContainer.getBoundingClientRect() : new DOMRect(); })", "inheritedFrom": { "name": "TimeredCounter", "module": "src/timered-counter.ts" } }, { "kind": "field", "name": "partsContainerRect", "type": { "text": "DOMRect | undefined" }, "inheritedFrom": { "name": "TimeredCounter", "module": "src/timered-counter.ts" } }, { "kind": "field", "name": "partsContainer", "type": { "text": "HTMLElement | undefined" }, "inheritedFrom": { "name": "TimeredCounter", "module": "src/timered-counter.ts" } }, { "kind": "method", "name": "dispatchTimeredCounterAnimationStart", "inheritedFrom": { "name": "TimeredCounter", "module": "src/timered-counter.ts" } }, { "kind": "method", "name": "dispatchTimeredCounterAnimationEnd", "inheritedFrom": { "name": "TimeredCounter", "module": "src/timered-counter.ts" } } ], "attributes": [ { "name": "precision", "description": "计数器显示的精度.\n1. 当为单个值时, 表示最小精度.\n2. 当为数组时, 第一个值表示最小精度, 第二个值表示最大精度.", "default": "[DurationPartType.Second, DurationPartType.Day]", "fieldName": "precision" }, { "name": "aria-label", "type": { "text": "string" }, "default": "''", "fieldName": "ariaLabel", "inheritedFrom": { "name": "CounterAiraMixin", "module": "src/mixins/counter-aira.ts" } }, { "name": "aira-live", "type": { "text": "'off' | 'polite' | 'assertive'" }, "default": "'polite'", "fieldName": "ariaLive", "inheritedFrom": { "name": "CounterAiraMixin", "module": "src/mixins/counter-aira.ts" } }, { "name": "animation-options", "type": { "text": "PartDigitValueOrGetter<KeyframeAnimationOptions>" }, "default": "{}", "description": "传递给 Web Animations API 的选项.", "fieldName": "animationOptions", "inheritedFrom": { "name": "CounterAnimationMixin", "module": "src/mixins/counter-animation.ts" } }, { "name": "keyframes", "type": { "text": "PartDigitValueOrGetter<PropertyIndexedKeyframes>" }, "default": "{}", "description": "传递给 Web Animations API 的关键帧配置.", "fieldName": "keyframes", "inheritedFrom": { "name": "CounterAnimationMixin", "module": "src/mixins/counter-animation.ts" } }, { "name": "cell-styles", "type": { "text": "PartDigitCellValueOrGetter<Partial<CSSStyleDeclaration>>" }, "default": "{}", "description": "对 `cell` 部分的样式进行设置. 传入的对象将被直接应用到 `cell` 的 `style` 上.\n你还可以使用 `cellStylesDynamic` 来动态设置样式.", "fieldName": "cellStyles", "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "name": "digit-styles", "type": { "text": "PartDigitValueOrGetter<Partial<CSSStyleDeclaration>>" }, "default": "{}", "description": "与 `cell` 类似, 但是是对 `digit` 部分的样式进行设置.\n你还可以使用 `digitStylesDynamic` 来动态设置样式.", "fieldName": "digitStyles", "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "name": "part-styles", "type": { "text": "PartValueOrGetter<Partial<CSSStyleDeclaration>>" }, "default": "{}", "description": "与 `cell` 类似, 但是是对 `part` 部分的样式进行设置.\n你还可以使用 `partStylesDynamic` 来动态设置样式.", "fieldName": "partStyles", "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "name": "color", "type": { "text": "string" }, "default": "'inherit'", "description": "文本颜色, 可使用 CSS 属性 `color` 和 `background-image` 的值.", "fieldName": "color", "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "name": "parts-options", "type": { "text": "InnerPartsOptions" }, "description": "这是 `usePartData` 的配置项. `usePartData` 被用于从数值的变化中生成用于滚动的数据.\n这里不会有太多解释, 因为它是一个底层的配置项. 你可以查看 `CounterPartsMixinClass` 的源码了解更多信息.", "fieldName": "partsOptions", "inheritedFrom": { "name": "CounterPartsMixin", "module": "src/mixins/counter-parts.ts" } }, { "name": "value", "fieldName": "value", "inheritedFrom": { "name": "CounterBaseMixin", "module": "src/mixins/counter-base.ts" } }, { "name": "old-value", "description": "用于记录上一次的值.\n\n初始化时(connectedCallback), oldValue 将被设置为 `initialValue` 或 `value` 的值.", "fieldName": "oldValue", "inheritedFrom": { "name": "CounterBaseMixin", "module": "src/mixins/counter-base.ts" } }, { "name": "initial-value", "description": "如果初始值被设置, oldValue 的初始值, 会使用该值而不是 `value`.\n\n这对于初始化完成后启动动画效果非常有用.", "fieldName": "initialValue", "inheritedFrom": { "name": "CounterBaseMixin", "module": "src/mixins/counter-base.ts" } }, { "name": "locale", "description": "自定义本地化配置, 否则从浏览器环境中获取.", "default": "\"en-US\"", "fieldName": "locale", "inheritedFrom": { "name": "CounterBaseMixin", "module": "src/mixins/counter-base.ts" } } ], "superclass": { "name": "TimeredCounter", "module": "/src/timered-counter.js" }, "tagName": "timered-counter-datetime-duration", "customElement": true, "events": [ { "name": "timered-counter-animation-start", "type": { "text": "TimeredCounterAnimationEvent" }, "inheritedFrom": { "name": "TimeredCounter", "module": "src/timered-counter.ts" } }, { "name": "timered-counter-animation-end", "type": { "text": "TimeredCounterAnimationEvent" }, "inheritedFrom": { "name": "TimeredCounter", "module": "src/timered-counter.ts" } } ] } ], "exports": [ { "kind": "js", "name": "TimeredCounterDatetimeDuration", "declaration": { "name": "TimeredCounterDatetimeDuration", "module": "src/timered-counter-datetime-duration.ts" } }, { "kind": "custom-element-definition", "name": "timered-counter-datetime-duration", "declaration": { "name": "TimeredCounterDatetimeDuration", "module": "src/timered-counter-datetime-duration.ts" } } ] }, { "kind": "javascript-module", "path": "src/timered-counter-number.ts", "declarations": [ { "kind": "class", "description": "", "name": "TimeredCounterNumber", "members": [ { "kind": "field", "name": "localeNumber", "type": { "text": "Intl.NumberFormatOptions | boolean" }, "default": "false", "description": "本地化数字格式化配置. 传入 `true` 时使用浏览器的默认配置.\n\n详细配置参数请参考 [Intl.NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat)", "attribute": "locale-number", "reflects": true }, { "kind": "field", "name": "localeNumberInstance", "type": { "text": "Intl.NumberFormat" }, "default": "new Intl.NumberFormat( this.localeInstance, isBoolean(this.localeNumber) ? {} : this.localeNumber, )" }, { "kind": "field", "name": "localDecimalSeparator", "type": { "text": "string" }, "default": "''", "description": "本地化数字格式化配置中的小数点分隔符. 根据不同的地区可能是 `.` 或 `,`." }, { "kind": "field", "name": "localeGroupingSeparator", "type": { "text": "string" }, "default": "''", "description": "本地化数字格式化配置中的分组分隔符." }, { "kind": "method", "name": "sampleToString", "parameters": [ { "name": "value", "type": { "text": "AvailableNumberAdapterValueType" } } ], "return": { "type": { "text": "string" } }, "inheritedFrom": { "name": "CounterPartsMixin", "module": "src/mixins/counter-parts.ts" } }, { "kind": "field", "name": "ariaLabel", "type": { "text": "string" }, "default": "''", "attribute": "aria-label", "reflects": true, "inheritedFrom": { "name": "CounterAiraMixin", "module": "src/mixins/counter-aira.ts" } }, { "kind": "field", "name": "ariaLive", "type": { "text": "'off' | 'polite' | 'assertive'" }, "default": "'polite'", "attribute": "aira-live", "reflects": true, "inheritedFrom": { "name": "CounterAiraMixin", "module": "src/mixins/counter-aira.ts" } }, { "kind": "method", "name": "generateAriaLabel", "return": { "type": { "text": "string" } }, "description": "生成 aria-label 属性值. 在每次更新完成后调用.", "inheritedFrom": { "name": "CounterAiraMixin", "module": "src/mixins/counter-aira.ts" } }, { "kind": "field", "name": "animationOptions", "type": { "text": "PartDigitValueOrGetter<KeyframeAnimationOptions>" }, "default": "{}", "description": "传递给 Web Animations API 的选项.", "attribute": "animation-options", "reflects": true, "inheritedFrom": { "name": "CounterAnimationMixin", "module": "src/mixins/counter-animation.ts" } }, { "kind": "field", "name": "animationOptionsDynamic", "type": { "text": "PartDigitGetter<KeyframeAnimationOptions> | undefined" }, "inheritedFrom": { "name": "CounterAnimationMixin", "module": "src/mixins/counter-animation.ts" } }, { "kind": "field", "name": "cachedAnimationOptions", "type": { "text": "(KeyframeAnimationOptions | undefined)[][]" }, "privacy": "private", "default": "[]", "inheritedFrom": { "name": "CounterAnimationMixin", "module": "src/mixins/counter-animation.ts" } }, { "kind": "method", "name": "extractAnimationOptions", "inheritedFrom": { "name": "CounterAnimationMixin", "module": "src/mixins/counter-animation.ts" } }, { "kind": "field", "name": "keyframes", "type": { "text": "PartDigitValueOrGetter<PropertyIndexedKeyframes>" }, "default": "{}", "description": "传递给 Web Animations API 的关键帧配置.", "attribute": "keyframes", "reflects": true, "inheritedFrom": { "name": "CounterAnimationMixin", "module": "src/mixins/counter-animation.ts" } }, { "kind": "field", "name": "keyframesDynamic", "type": { "text": "PartDigitGetter<PropertyIndexedKeyframes> | undefined" }, "inheritedFrom": { "name": "CounterAnimationMixin", "module": "src/mixins/counter-animation.ts" } }, { "kind": "field", "name": "cachedKeyframes", "type": { "text": "(PropertyIndexedKeyframes | undefined)[][]" }, "privacy": "private", "default": "[]", "inheritedFrom": { "name": "CounterAnimationMixin", "module": "src/mixins/counter-animation.ts" } }, { "kind": "method", "name": "extractKeyframes", "inheritedFrom": { "name": "CounterAnimationMixin", "module": "src/mixins/counter-animation.ts" } }, { "kind": "field", "name": "cellStyles", "type": { "text": "PartDigitCellValueOrGetter<Partial<CSSStyleDeclaration>>" }, "default": "{}", "description": "对 `cell` 部分的样式进行设置. 传入的对象将被直接应用到 `cell` 的 `style` 上.\n你还可以使用 `cellStylesDynamic` 来动态设置样式.", "attribute": "cell-styles", "reflects": true, "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "field", "name": "cellStylesDynamic", "type": { "text": "PartDigitCellGetter<Partial<CSSStyleDeclaration>> | undefined" }, "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "field", "name": "cachedCellStyles", "type": { "text": "Partial<CSSStyleDeclaration | undefined>[][][]" }, "privacy": "private", "default": "[]", "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "method", "name": "extractCellStyles", "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "field", "name": "digitStyles", "type": { "text": "PartDigitValueOrGetter<Partial<CSSStyleDeclaration>>" }, "default": "{}", "description": "与 `cell` 类似, 但是是对 `digit` 部分的样式进行设置.\n你还可以使用 `digitStylesDynamic` 来动态设置样式.", "attribute": "digit-styles", "reflects": true, "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "field", "name": "digitStylesDynamic", "type": { "text": "PartDigitGetter<Partial<CSSStyleDeclaration>> | undefined" }, "inheritedFrom": { "name": "CounterStylesMixin", "module": "src/mixins/counter-styles.ts" } }, { "kind": "field", "name": "cachedDigitStyles", "type": { "text": "Partial<CSSS