UNPKG

timered-counter

Version:

Make the value change more vivid and natural

36 lines 1.5 kB
import { setCustomElementsManifest, } from '@storybook/web-components'; import customElementsManifest from '../../custom-elements.json' with { type: 'json' }; import { TimeredCounterAdapter } from '../../src/index.js'; import DecimalJsNumberAdapter from '../../src/number-adapter/decimal-js.js'; import { bigNumber } from '../story-parts/big-number.js'; import { setByAttr, setByProp } from '../utils/index.js'; setCustomElementsManifest(customElementsManifest); const meta = { title: 'TimeredCounter/with decimal.js', component: 'timered-counter', tags: ['autodocs', 'timered-counter'], parameters: { controls: { expanded: true }, }, beforeEach: () => { TimeredCounterAdapter.registerAdapter(DecimalJsNumberAdapter); TimeredCounterAdapter.setNumberAdapter('decimal.js'); }, }; export default meta; export { Basic, Events, AnimationOptions, Slots, Styles, } from './index.stories.js'; export const BigNumber = { args: { className: 'test-target', animationOptions: { duration: 100, }, }, async play(context) { const { canvasElement, step } = context; const counter = canvasElement.querySelector('.test-target'); await step('Testing with attribute', async () => bigNumber(context, { counter, setBy: setByAttr })); await step('Testing with property', async () => bigNumber(context, { counter, setBy: setByProp })); }, }; //# sourceMappingURL=decimaljs.stories.js.map