@uibit/number-increment 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 UIBit Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # Number Ticker
2
+
3
+ [Interactive Demonstration](https://rawlings.github.io/uibit/number-ticker)
4
+
5
+ Number Ticker is a visual performance indicator component that animates numerical statistics, percentages, and currencies when they enter the user's viewport. By displaying numbers with a smooth counting motion rather than as static values, it highlights milestones and growth metrics.
6
+
7
+ ## Value Delivery
8
+
9
+ - **Dynamic Visual Momentum** – Draws attention to critical business metrics, giving stats a sense of growth and scale.
10
+ - **Scroll-Triggered Activation** – Automatically starts the counting animation only when the component enters the visible viewport.
11
+ - **Global Localization Support** – Formats currencies, decimals, and custom separators according to user locale preferences.
12
+ - **Fluid Easing Curves** – Uses hardware-accelerated rendering methods to ensure smooth visual ticks without causing layout recalculations.
13
+
14
+ ## Ideal Applications
15
+
16
+ - **Key Performance Indicators** – Showcasing revenue figures, conversion rates, and corporate achievements.
17
+ - **User Milestones** – Animating active user counts, community sizes, or transaction histories.
18
+ - **Impact Dashboards** – Highlighting carbon offsets, project progress, or resource savings.
19
+
20
+ ## Further Information
21
+
22
+ Detailed design guidelines, customizable attributes, and integration examples are available on our documentation site.
@@ -0,0 +1,434 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/index.ts",
8
+ "declarations": [],
9
+ "exports": [
10
+ {
11
+ "kind": "js",
12
+ "name": "default",
13
+ "declaration": {
14
+ "name": "default",
15
+ "module": "./number-increment"
16
+ }
17
+ },
18
+ {
19
+ "kind": "js",
20
+ "name": "NumberIncrement",
21
+ "declaration": {
22
+ "name": "NumberIncrement",
23
+ "module": "./number-increment"
24
+ }
25
+ },
26
+ {
27
+ "kind": "js",
28
+ "name": "*",
29
+ "declaration": {
30
+ "name": "*",
31
+ "module": "src/types"
32
+ }
33
+ }
34
+ ]
35
+ },
36
+ {
37
+ "kind": "javascript-module",
38
+ "path": "src/number-increment.ts",
39
+ "declarations": [
40
+ {
41
+ "kind": "class",
42
+ "description": "Animates a numeric value from zero (or a custom start) up to the `value`\nattribute once the element scrolls into the viewport. Supports easing,\ndecimal places, and custom formatting functions.\n\nThe animation runs entirely in the shadow DOM on a rAF loop so it never\nblocks the main thread via layout thrashing.",
43
+ "name": "NumberIncrement",
44
+ "cssProperties": [
45
+ {
46
+ "description": "Font size",
47
+ "name": "--uibit-number-increment-font-size",
48
+ "default": "inherit"
49
+ },
50
+ {
51
+ "description": "Font weight",
52
+ "name": "--uibit-number-increment-font-weight",
53
+ "default": "inherit"
54
+ },
55
+ {
56
+ "description": "Text color",
57
+ "name": "--uibit-number-increment-color",
58
+ "default": "inherit"
59
+ },
60
+ {
61
+ "description": "Font family",
62
+ "name": "--uibit-number-increment-font-family",
63
+ "default": "inherit"
64
+ },
65
+ {
66
+ "description": "Line height",
67
+ "name": "--uibit-number-increment-line-height",
68
+ "default": "inherit"
69
+ }
70
+ ],
71
+ "members": [
72
+ {
73
+ "kind": "field",
74
+ "name": "value",
75
+ "type": {
76
+ "text": "number"
77
+ },
78
+ "default": "0",
79
+ "description": "Target numeric value to count up to.",
80
+ "attribute": "value"
81
+ },
82
+ {
83
+ "kind": "field",
84
+ "name": "from",
85
+ "type": {
86
+ "text": "number"
87
+ },
88
+ "default": "0",
89
+ "description": "Starting value for the animation.",
90
+ "attribute": "from"
91
+ },
92
+ {
93
+ "kind": "field",
94
+ "name": "duration",
95
+ "type": {
96
+ "text": "number"
97
+ },
98
+ "default": "1800",
99
+ "description": "Duration of the count animation in milliseconds.",
100
+ "attribute": "duration"
101
+ },
102
+ {
103
+ "kind": "field",
104
+ "name": "decimals",
105
+ "type": {
106
+ "text": "number"
107
+ },
108
+ "default": "0",
109
+ "description": "Number of decimal places to display. Used only if no custom formatter is provided.",
110
+ "attribute": "decimals"
111
+ },
112
+ {
113
+ "kind": "field",
114
+ "name": "locale",
115
+ "type": {
116
+ "text": "string"
117
+ },
118
+ "default": "''",
119
+ "description": "BCP 47 locale string for number formatting (e.g. \"en-US\"). Defaults to browser locale if options is set.",
120
+ "attribute": "locale"
121
+ },
122
+ {
123
+ "kind": "field",
124
+ "name": "options",
125
+ "type": {
126
+ "text": "Intl.NumberFormatOptions | undefined"
127
+ },
128
+ "description": "Options for Intl.NumberFormat.",
129
+ "attribute": "options"
130
+ },
131
+ {
132
+ "kind": "field",
133
+ "name": "formatter",
134
+ "type": {
135
+ "text": "(value: number) => string | undefined"
136
+ },
137
+ "description": "Custom formatter function to format the number for display. Overrides locale and options."
138
+ },
139
+ {
140
+ "kind": "field",
141
+ "name": "easing",
142
+ "type": {
143
+ "text": "'ease-out' | 'ease-in-out' | 'linear'"
144
+ },
145
+ "default": "'ease-out'",
146
+ "description": "Easing curve: \"ease-out\" | \"ease-in-out\" | \"linear\".",
147
+ "attribute": "easing"
148
+ },
149
+ {
150
+ "kind": "field",
151
+ "name": "threshold",
152
+ "type": {
153
+ "text": "number"
154
+ },
155
+ "default": "0.2",
156
+ "description": "Intersection threshold (0–1) at which the animation triggers.",
157
+ "attribute": "threshold"
158
+ },
159
+ {
160
+ "kind": "field",
161
+ "name": "repeat",
162
+ "type": {
163
+ "text": "boolean"
164
+ },
165
+ "default": "false",
166
+ "description": "Re-animate each time the element re-enters the viewport.",
167
+ "attribute": "repeat"
168
+ },
169
+ {
170
+ "kind": "field",
171
+ "name": "_display",
172
+ "type": {
173
+ "text": "string"
174
+ },
175
+ "privacy": "private",
176
+ "default": "''"
177
+ },
178
+ {
179
+ "kind": "field",
180
+ "name": "_viewport",
181
+ "type": {
182
+ "text": "ViewportController | undefined"
183
+ },
184
+ "privacy": "private"
185
+ },
186
+ {
187
+ "kind": "field",
188
+ "name": "_loop",
189
+ "privacy": "private",
190
+ "default": "new LoopController(this, { autoStart: false, callback: (ts) => this._tick(ts), })"
191
+ },
192
+ {
193
+ "kind": "field",
194
+ "name": "_started",
195
+ "type": {
196
+ "text": "boolean"
197
+ },
198
+ "privacy": "private",
199
+ "default": "false"
200
+ },
201
+ {
202
+ "kind": "field",
203
+ "name": "_startTime",
204
+ "type": {
205
+ "text": "number | null"
206
+ },
207
+ "privacy": "private",
208
+ "default": "null"
209
+ },
210
+ {
211
+ "kind": "field",
212
+ "name": "_startVal",
213
+ "type": {
214
+ "text": "number"
215
+ },
216
+ "privacy": "private",
217
+ "default": "0"
218
+ },
219
+ {
220
+ "kind": "field",
221
+ "name": "_endVal",
222
+ "type": {
223
+ "text": "number"
224
+ },
225
+ "privacy": "private",
226
+ "default": "0"
227
+ },
228
+ {
229
+ "kind": "method",
230
+ "name": "_ease",
231
+ "privacy": "private",
232
+ "return": {
233
+ "type": {
234
+ "text": "number"
235
+ }
236
+ },
237
+ "parameters": [
238
+ {
239
+ "name": "t",
240
+ "type": {
241
+ "text": "number"
242
+ }
243
+ }
244
+ ]
245
+ },
246
+ {
247
+ "kind": "method",
248
+ "name": "_format",
249
+ "privacy": "private",
250
+ "return": {
251
+ "type": {
252
+ "text": "string"
253
+ }
254
+ },
255
+ "parameters": [
256
+ {
257
+ "name": "n",
258
+ "type": {
259
+ "text": "number"
260
+ }
261
+ }
262
+ ]
263
+ },
264
+ {
265
+ "kind": "method",
266
+ "name": "_start",
267
+ "privacy": "private"
268
+ },
269
+ {
270
+ "kind": "method",
271
+ "name": "_tick",
272
+ "privacy": "private",
273
+ "parameters": [
274
+ {
275
+ "name": "ts",
276
+ "type": {
277
+ "text": "number"
278
+ }
279
+ }
280
+ ]
281
+ }
282
+ ],
283
+ "events": [
284
+ {
285
+ "description": "ticker-end - Fired when the count animation completes",
286
+ "name": "void"
287
+ }
288
+ ],
289
+ "attributes": [
290
+ {
291
+ "name": "value",
292
+ "type": {
293
+ "text": "number"
294
+ },
295
+ "default": "0",
296
+ "description": "Target numeric value to count up to.",
297
+ "fieldName": "value"
298
+ },
299
+ {
300
+ "name": "from",
301
+ "type": {
302
+ "text": "number"
303
+ },
304
+ "default": "0",
305
+ "description": "Starting value for the animation.",
306
+ "fieldName": "from"
307
+ },
308
+ {
309
+ "name": "duration",
310
+ "type": {
311
+ "text": "number"
312
+ },
313
+ "default": "1800",
314
+ "description": "Duration of the count animation in milliseconds.",
315
+ "fieldName": "duration"
316
+ },
317
+ {
318
+ "name": "decimals",
319
+ "type": {
320
+ "text": "number"
321
+ },
322
+ "default": "0",
323
+ "description": "Number of decimal places to display. Used only if no custom formatter is provided.",
324
+ "fieldName": "decimals"
325
+ },
326
+ {
327
+ "name": "locale",
328
+ "type": {
329
+ "text": "string"
330
+ },
331
+ "default": "''",
332
+ "description": "BCP 47 locale string for number formatting (e.g. \"en-US\"). Defaults to browser locale if options is set.",
333
+ "fieldName": "locale"
334
+ },
335
+ {
336
+ "name": "options",
337
+ "type": {
338
+ "text": "Intl.NumberFormatOptions | undefined"
339
+ },
340
+ "description": "Options for Intl.NumberFormat.",
341
+ "fieldName": "options"
342
+ },
343
+ {
344
+ "name": "easing",
345
+ "type": {
346
+ "text": "'ease-out' | 'ease-in-out' | 'linear'"
347
+ },
348
+ "default": "'ease-out'",
349
+ "description": "Easing curve: \"ease-out\" | \"ease-in-out\" | \"linear\".",
350
+ "fieldName": "easing"
351
+ },
352
+ {
353
+ "name": "threshold",
354
+ "type": {
355
+ "text": "number"
356
+ },
357
+ "default": "0.2",
358
+ "description": "Intersection threshold (0–1) at which the animation triggers.",
359
+ "fieldName": "threshold"
360
+ },
361
+ {
362
+ "name": "repeat",
363
+ "type": {
364
+ "text": "boolean"
365
+ },
366
+ "default": "false",
367
+ "description": "Re-animate each time the element re-enters the viewport.",
368
+ "fieldName": "repeat"
369
+ }
370
+ ],
371
+ "superclass": {
372
+ "name": "UIBitElement",
373
+ "package": "@uibit/core"
374
+ },
375
+ "tagName": "uibit-number-increment",
376
+ "customElement": true
377
+ }
378
+ ],
379
+ "exports": [
380
+ {
381
+ "kind": "js",
382
+ "name": "NumberIncrement",
383
+ "declaration": {
384
+ "name": "NumberIncrement",
385
+ "module": "src/number-increment.ts"
386
+ }
387
+ },
388
+ {
389
+ "kind": "custom-element-definition",
390
+ "name": "uibit-number-increment",
391
+ "declaration": {
392
+ "name": "NumberIncrement",
393
+ "module": "src/number-increment.ts"
394
+ }
395
+ },
396
+ {
397
+ "kind": "js",
398
+ "name": "default",
399
+ "declaration": {
400
+ "name": "NumberIncrement",
401
+ "module": "src/number-increment.ts"
402
+ }
403
+ }
404
+ ]
405
+ },
406
+ {
407
+ "kind": "javascript-module",
408
+ "path": "src/styles.ts",
409
+ "declarations": [
410
+ {
411
+ "kind": "variable",
412
+ "name": "styles",
413
+ "default": "css` :host { display: inline-block; font-variant-numeric: tabular-nums; font-size: var(--uibit-number-increment-font-size, inherit); font-weight: var(--uibit-number-increment-font-weight, inherit); color: var(--uibit-number-increment-color, inherit); font-family: var(--uibit-number-increment-font-family, inherit); line-height: var(--uibit-number-increment-line-height, inherit); } .value { display: inline; } `"
414
+ }
415
+ ],
416
+ "exports": [
417
+ {
418
+ "kind": "js",
419
+ "name": "styles",
420
+ "declaration": {
421
+ "name": "styles",
422
+ "module": "src/styles.ts"
423
+ }
424
+ }
425
+ ]
426
+ },
427
+ {
428
+ "kind": "javascript-module",
429
+ "path": "src/types.ts",
430
+ "declarations": [],
431
+ "exports": []
432
+ }
433
+ ]
434
+ }
@@ -0,0 +1,80 @@
1
+ import { Component, ChangeDetectionStrategy, ElementRef, input, effect, output, booleanAttribute, numberAttribute } from '@angular/core';
2
+ import '@uibit/number-increment';
3
+ import type { NumberIncrement as HTMLElementClass } from '@uibit/number-increment';
4
+
5
+ @Component({
6
+ selector: 'uibit-number-increment',
7
+ template: '<ng-content></ng-content>',
8
+ changeDetection: ChangeDetectionStrategy.OnPush,
9
+ standalone: true,
10
+ host: {
11
+ '(void)': 'void.emit($event)'
12
+ }
13
+ })
14
+ export class NgxNumberIncrement {
15
+ constructor(private el: ElementRef<HTMLElementClass>) {
16
+ effect(() => {
17
+ if (this.el.nativeElement) {
18
+ this.el.nativeElement.value = this.value();
19
+ }
20
+ });
21
+ effect(() => {
22
+ if (this.el.nativeElement) {
23
+ this.el.nativeElement.from = this.from();
24
+ }
25
+ });
26
+ effect(() => {
27
+ if (this.el.nativeElement) {
28
+ this.el.nativeElement.duration = this.duration();
29
+ }
30
+ });
31
+ effect(() => {
32
+ if (this.el.nativeElement) {
33
+ this.el.nativeElement.decimals = this.decimals();
34
+ }
35
+ });
36
+ effect(() => {
37
+ if (this.el.nativeElement) {
38
+ this.el.nativeElement.locale = this.locale();
39
+ }
40
+ });
41
+ effect(() => {
42
+ if (this.el.nativeElement) {
43
+ this.el.nativeElement.options = this.options();
44
+ }
45
+ });
46
+ effect(() => {
47
+ if (this.el.nativeElement) {
48
+ this.el.nativeElement.formatter = this.formatter();
49
+ }
50
+ });
51
+ effect(() => {
52
+ if (this.el.nativeElement) {
53
+ this.el.nativeElement.easing = this.easing();
54
+ }
55
+ });
56
+ effect(() => {
57
+ if (this.el.nativeElement) {
58
+ this.el.nativeElement.threshold = this.threshold();
59
+ }
60
+ });
61
+ effect(() => {
62
+ if (this.el.nativeElement) {
63
+ this.el.nativeElement.repeat = this.repeat();
64
+ }
65
+ });
66
+ }
67
+
68
+ readonly value = input<number, any>(0, { transform: numberAttribute });
69
+ readonly from = input<number, any>(0, { transform: numberAttribute });
70
+ readonly duration = input<number, any>(1800, { transform: numberAttribute });
71
+ readonly decimals = input<number, any>(0, { transform: numberAttribute });
72
+ readonly locale = input<string, any>('');
73
+ readonly options = input<Intl.NumberFormatOptions | undefined, any>(undefined);
74
+ readonly formatter = input<(value: number) => string | undefined, any>(0, { transform: numberAttribute });
75
+ readonly easing = input<'ease-out' | 'ease-in-out' | 'linear', any>('ease-out');
76
+ readonly threshold = input<number, any>(0.2, { transform: numberAttribute });
77
+ readonly repeat = input<boolean, any>(false, { transform: booleanAttribute });
78
+
79
+ readonly void = output<CustomEvent<any>>();
80
+ }
@@ -0,0 +1,10 @@
1
+ import type { NumberIncrement as HTMLElementClass } from '@uibit/number-increment';
2
+ import '@uibit/number-increment';
3
+
4
+ declare global {
5
+ namespace astroHTML.JSX {
6
+ interface IntrinsicElements {
7
+ 'uibit-number-increment': Partial<HTMLElementClass> & astroHTML.JSX.HTMLAttributes;
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,7 @@
1
+ import { defineNuxtPlugin } from '#app';
2
+
3
+ export default defineNuxtPlugin(() => {
4
+ if (process.client) {
5
+ import('@uibit/number-increment');
6
+ }
7
+ });
@@ -0,0 +1,22 @@
1
+ import type { JSX } from 'preact';
2
+ import type { NumberIncrement as HTMLElementClass } from '@uibit/number-increment';
3
+ import '@uibit/number-increment';
4
+
5
+ declare module 'preact' {
6
+ namespace JSX {
7
+ interface IntrinsicElements {
8
+ 'uibit-number-increment': JSX.HTMLAttributes<HTMLElementClass> & {
9
+ value?: number;
10
+ from?: number;
11
+ duration?: number;
12
+ decimals?: number;
13
+ locale?: string;
14
+ options?: Intl.NumberFormatOptions | undefined;
15
+ formatter?: (value: number) => string | undefined;
16
+ easing?: 'ease-out' | 'ease-in-out' | 'linear';
17
+ threshold?: number;
18
+ repeat?: boolean;
19
+ };
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,10 @@
1
+ import { component$, Slot } from '@builder.io/qwik';
2
+ import '@uibit/number-increment';
3
+
4
+ export const NumberIncrement = component$<any>((props) => {
5
+ return (
6
+ <uibit-number-increment {...props}>
7
+ <Slot />
8
+ </uibit-number-increment>
9
+ );
10
+ });
@@ -0,0 +1,27 @@
1
+ import type { HTMLAttributes, ClassAttributes } from 'react';
2
+ import type { NumberIncrement as HTMLElementClass } from '@uibit/number-increment';
3
+ import '@uibit/number-increment';
4
+
5
+ declare global {
6
+ namespace React {
7
+ namespace JSX {
8
+ interface IntrinsicElements {
9
+ 'uibit-number-increment': ClassAttributes<HTMLElementClass> & HTMLAttributes<HTMLElementClass> & {
10
+ children?: React.ReactNode;
11
+ class?: string;
12
+ value?: number;
13
+ from?: number;
14
+ duration?: number;
15
+ decimals?: number;
16
+ locale?: string;
17
+ options?: Intl.NumberFormatOptions | undefined;
18
+ formatter?: (value: number) => string | undefined;
19
+ easing?: 'ease-out' | 'ease-in-out' | 'linear';
20
+ threshold?: number;
21
+ repeat?: boolean;
22
+ onVoid?: (event: any) => void;
23
+ };
24
+ }
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,23 @@
1
+ import type { JSX } from 'solid-js';
2
+ import type { NumberIncrement as HTMLElementClass } from '@uibit/number-increment';
3
+ import '@uibit/number-increment';
4
+
5
+ declare module 'solid-js' {
6
+ namespace JSX {
7
+ interface IntrinsicElements {
8
+ 'uibit-number-increment': Partial<HTMLElementClass> & JSX.HTMLAttributes<HTMLElementClass> & {
9
+ value?: number;
10
+ from?: number;
11
+ duration?: number;
12
+ decimals?: number;
13
+ locale?: string;
14
+ options?: Intl.NumberFormatOptions | undefined;
15
+ formatter?: (value: number) => string | undefined;
16
+ easing?: 'ease-out' | 'ease-in-out' | 'linear';
17
+ threshold?: number;
18
+ repeat?: boolean;
19
+ "on:void"?: (event: CustomEvent) => void;
20
+ };
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,21 @@
1
+ import type { NumberIncrement as HTMLElementClass } from '@uibit/number-increment';
2
+ import '@uibit/number-increment';
3
+
4
+ declare module '@stencil/core' {
5
+ export namespace JSX {
6
+ interface IntrinsicElements {
7
+ 'uibit-number-increment': HTMLElementClass & {
8
+ value?: number;
9
+ from?: number;
10
+ duration?: number;
11
+ decimals?: number;
12
+ locale?: string;
13
+ options?: Intl.NumberFormatOptions | undefined;
14
+ formatter?: (value: number) => string | undefined;
15
+ easing?: 'ease-out' | 'ease-in-out' | 'linear';
16
+ threshold?: number;
17
+ repeat?: boolean;
18
+ };
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,76 @@
1
+ <script lang="ts">
2
+ import '@uibit/number-increment';
3
+ import type { NumberIncrement as HTMLElementClass } from '@uibit/number-increment';
4
+
5
+ let {
6
+ value = undefined,
7
+ from = undefined,
8
+ duration = undefined,
9
+ decimals = undefined,
10
+ locale = undefined,
11
+ options = undefined,
12
+ formatter = undefined,
13
+ easing = undefined,
14
+ threshold = undefined,
15
+ repeat = undefined,
16
+ children
17
+ } = $props<{
18
+ children?: any;
19
+ value?: number;
20
+ from?: number;
21
+ duration?: number;
22
+ decimals?: number;
23
+ locale?: string;
24
+ options?: Intl.NumberFormatOptions | undefined;
25
+ formatter?: (value: number) => string | undefined;
26
+ easing?: 'ease-out' | 'ease-in-out' | 'linear';
27
+ threshold?: number;
28
+ repeat?: boolean;
29
+
30
+ }>();
31
+
32
+ let elementRef: HTMLElementClass | null = $state(null);
33
+
34
+ $effect(() => {
35
+ if (elementRef && value !== undefined) {
36
+ elementRef.value = value;
37
+ }
38
+ if (elementRef && from !== undefined) {
39
+ elementRef.from = from;
40
+ }
41
+ if (elementRef && duration !== undefined) {
42
+ elementRef.duration = duration;
43
+ }
44
+ if (elementRef && decimals !== undefined) {
45
+ elementRef.decimals = decimals;
46
+ }
47
+ if (elementRef && locale !== undefined) {
48
+ elementRef.locale = locale;
49
+ }
50
+ if (elementRef && options !== undefined) {
51
+ elementRef.options = options;
52
+ }
53
+ if (elementRef && formatter !== undefined) {
54
+ elementRef.formatter = formatter;
55
+ }
56
+ if (elementRef && easing !== undefined) {
57
+ elementRef.easing = easing;
58
+ }
59
+ if (elementRef && threshold !== undefined) {
60
+ elementRef.threshold = threshold;
61
+ }
62
+ if (elementRef && repeat !== undefined) {
63
+ elementRef.repeat = repeat;
64
+ }
65
+ });
66
+
67
+ </script>
68
+
69
+ <uibit-number-increment bind:this={elementRef} {...$$restProps}>
70
+
71
+ {#if children}
72
+ {@render children()}
73
+ {:else}
74
+ <slot />
75
+ {/if}
76
+ </uibit-number-increment>
@@ -0,0 +1,33 @@
1
+ import { defineComponent, h } from 'vue';
2
+ import type { NumberIncrement as HTMLElementClass } from '@uibit/number-increment';
3
+ import '@uibit/number-increment';
4
+
5
+ export const NumberIncrement = defineComponent({
6
+ name: 'NumberIncrement',
7
+ props: {
8
+ value: { type: [String, Number, Boolean, Array, Object] as any },
9
+ from: { type: [String, Number, Boolean, Array, Object] as any },
10
+ duration: { type: [String, Number, Boolean, Array, Object] as any },
11
+ decimals: { type: [String, Number, Boolean, Array, Object] as any },
12
+ locale: { type: [String, Number, Boolean, Array, Object] as any },
13
+ options: { type: [String, Number, Boolean, Array, Object] as any },
14
+ formatter: { type: [String, Number, Boolean, Array, Object] as any },
15
+ easing: { type: [String, Number, Boolean, Array, Object] as any },
16
+ threshold: { type: [String, Number, Boolean, Array, Object] as any },
17
+ repeat: { type: [String, Number, Boolean, Array, Object] as any }
18
+ },
19
+ emits: ['void'],
20
+ setup(props, { slots, emit }) {
21
+ return () => {
22
+ const eventListeners: Record<string, any> = {};
23
+ eventListeners['onVoid'] = (event: Event) => {
24
+ emit('void', event);
25
+ };
26
+
27
+ return h('uibit-number-increment', {
28
+ ...props,
29
+ ...eventListeners
30
+ }, slots.default?.());
31
+ };
32
+ }
33
+ });
@@ -0,0 +1,3 @@
1
+ export { default, NumberIncrement } from './number-increment';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC9D,cAAc,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { default, NumberIncrement } from './number-increment';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC9D,cAAc,SAAS,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { UIBitElement } from '@uibit/core';
2
+ /**
3
+ * Animates a numeric value from zero (or a custom start) up to the `value`
4
+ * attribute once the element scrolls into the viewport. Supports easing,
5
+ * decimal places, and custom formatting functions.
6
+ *
7
+ * The animation runs entirely in the shadow DOM on a rAF loop so it never
8
+ * blocks the main thread via layout thrashing.
9
+ *
10
+ * @fires void ticker-start - Fired when the count animation begins
11
+ * @fires void ticker-end - Fired when the count animation completes
12
+ *
13
+ * @cssprop [--uibit-number-increment-font-size=inherit] - Font size
14
+ * @cssprop [--uibit-number-increment-font-weight=inherit] - Font weight
15
+ * @cssprop [--uibit-number-increment-color=inherit] - Text color
16
+ * @cssprop [--uibit-number-increment-font-family=inherit] - Font family
17
+ * @cssprop [--uibit-number-increment-line-height=inherit] - Line height
18
+ */
19
+ export declare class NumberIncrement extends UIBitElement {
20
+ static styles: import("lit").CSSResult;
21
+ /** Target numeric value to count up to. */
22
+ value: number;
23
+ /** Starting value for the animation. */
24
+ from: number;
25
+ /** Duration of the count animation in milliseconds. */
26
+ duration: number;
27
+ /** Number of decimal places to display. Used only if no custom formatter is provided. */
28
+ decimals: number;
29
+ /** BCP 47 locale string for number formatting (e.g. "en-US"). Defaults to browser locale if options is set. */
30
+ locale: string;
31
+ /** Options for Intl.NumberFormat. */
32
+ options?: Intl.NumberFormatOptions;
33
+ /** Custom formatter function to format the number for display. Overrides locale and options. */
34
+ formatter?: (value: number) => string;
35
+ /** Easing curve: "ease-out" | "ease-in-out" | "linear". */
36
+ easing: 'ease-out' | 'ease-in-out' | 'linear';
37
+ /** Intersection threshold (0–1) at which the animation triggers. */
38
+ threshold: number;
39
+ /** Re-animate each time the element re-enters the viewport. */
40
+ repeat: boolean;
41
+ private _display;
42
+ private _viewport?;
43
+ private _loop;
44
+ private _started;
45
+ private _startTime;
46
+ private _startVal;
47
+ private _endVal;
48
+ connectedCallback(): void;
49
+ updated(changed: Map<string, unknown>): void;
50
+ private _ease;
51
+ private _format;
52
+ private _start;
53
+ private _tick;
54
+ render(): import("lit").TemplateResult<1>;
55
+ }
56
+ export default NumberIncrement;
57
+ //# sourceMappingURL=number-increment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number-increment.d.ts","sourceRoot":"","sources":["../src/number-increment.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,YAAY,EAAsC,MAAM,aAAa,CAAC;AAI9F;;;;;;;;;;;;;;;;GAgBG;AACH,qBACa,eAAgB,SAAQ,YAAY;IAC/C,MAAM,CAAC,MAAM,0BAAU;IAEvB,2CAA2C;IACf,KAAK,SAAK;IACtC,wCAAwC;IACO,IAAI,SAAK;IACxD,uDAAuD;IAC3B,QAAQ,SAAQ;IAC5C,yFAAyF;IAC7D,QAAQ,SAAK;IACzC,+GAA+G;IACnF,MAAM,SAAM;IACxC,qCAAqC;IACT,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC;IAC/D,gGAAgG;IAChE,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACtE,2DAA2D;IAC/B,MAAM,EAAE,UAAU,GAAG,aAAa,GAAG,QAAQ,CAAc;IACvF,oEAAoE;IACxC,SAAS,SAAO;IAC5C,+DAA+D;IAClC,MAAM,UAAS;IAEnC,OAAO,CAAC,QAAQ,CAAM;IAE/B,OAAO,CAAC,SAAS,CAAC,CAAqB;IACvC,OAAO,CAAC,KAAK,CAGV;IAEH,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,OAAO,CAAK;IAEpB,iBAAiB,SAahB;IAED,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,QAIpC;IAED,OAAO,CAAC,KAAK;IAOb,OAAO,CAAC,OAAO;IAUf,OAAO,CAAC,MAAM;IAUd,OAAO,CAAC,KAAK;IAcb,MAAM,oCAEL;CACF;eAEc,eAAe"}
@@ -0,0 +1,157 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { html } from 'lit';
8
+ import { customElement, UIBitElement, ViewportController, LoopController } from '@uibit/core';
9
+ import { property, state } from 'lit/decorators.js';
10
+ import { styles } from './styles';
11
+ /**
12
+ * Animates a numeric value from zero (or a custom start) up to the `value`
13
+ * attribute once the element scrolls into the viewport. Supports easing,
14
+ * decimal places, and custom formatting functions.
15
+ *
16
+ * The animation runs entirely in the shadow DOM on a rAF loop so it never
17
+ * blocks the main thread via layout thrashing.
18
+ *
19
+ * @fires void ticker-start - Fired when the count animation begins
20
+ * @fires void ticker-end - Fired when the count animation completes
21
+ *
22
+ * @cssprop [--uibit-number-increment-font-size=inherit] - Font size
23
+ * @cssprop [--uibit-number-increment-font-weight=inherit] - Font weight
24
+ * @cssprop [--uibit-number-increment-color=inherit] - Text color
25
+ * @cssprop [--uibit-number-increment-font-family=inherit] - Font family
26
+ * @cssprop [--uibit-number-increment-line-height=inherit] - Line height
27
+ */
28
+ let NumberIncrement = class NumberIncrement extends UIBitElement {
29
+ constructor() {
30
+ super(...arguments);
31
+ /** Target numeric value to count up to. */
32
+ this.value = 0;
33
+ /** Starting value for the animation. */
34
+ this.from = 0;
35
+ /** Duration of the count animation in milliseconds. */
36
+ this.duration = 1800;
37
+ /** Number of decimal places to display. Used only if no custom formatter is provided. */
38
+ this.decimals = 0;
39
+ /** BCP 47 locale string for number formatting (e.g. "en-US"). Defaults to browser locale if options is set. */
40
+ this.locale = '';
41
+ /** Easing curve: "ease-out" | "ease-in-out" | "linear". */
42
+ this.easing = 'ease-out';
43
+ /** Intersection threshold (0–1) at which the animation triggers. */
44
+ this.threshold = 0.2;
45
+ /** Re-animate each time the element re-enters the viewport. */
46
+ this.repeat = false;
47
+ this._display = '';
48
+ this._loop = new LoopController(this, {
49
+ autoStart: false,
50
+ callback: (ts) => this._tick(ts),
51
+ });
52
+ this._started = false;
53
+ this._startTime = null;
54
+ this._startVal = 0;
55
+ this._endVal = 0;
56
+ }
57
+ static { this.styles = styles; }
58
+ connectedCallback() {
59
+ super.connectedCallback();
60
+ this._display = this._format(this.from);
61
+ if (!this._viewport) {
62
+ this._viewport = new ViewportController(this, {
63
+ threshold: this.threshold,
64
+ callback: (entry) => {
65
+ if (entry.isIntersecting && (!this._started || this.repeat)) {
66
+ this._start();
67
+ }
68
+ },
69
+ });
70
+ }
71
+ }
72
+ updated(changed) {
73
+ if (changed.has('value') && this._started) {
74
+ this._start();
75
+ }
76
+ }
77
+ _ease(t) {
78
+ if (this.easing === 'linear')
79
+ return t;
80
+ if (this.easing === 'ease-in-out')
81
+ return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
82
+ // ease-out cubic
83
+ return 1 - Math.pow(1 - t, 3);
84
+ }
85
+ _format(n) {
86
+ if (this.formatter) {
87
+ return this.formatter(n);
88
+ }
89
+ if (this.options || this.locale) {
90
+ return new Intl.NumberFormat(this.locale || undefined, this.options).format(n);
91
+ }
92
+ return n.toFixed(this.decimals);
93
+ }
94
+ _start() {
95
+ this._started = true;
96
+ this._startVal = this.from;
97
+ this._endVal = this.value;
98
+ this._startTime = null;
99
+ this.dispatchCustomEvent('ticker-start');
100
+ this._loop.start();
101
+ }
102
+ _tick(ts) {
103
+ if (this._startTime === null)
104
+ this._startTime = ts;
105
+ const elapsed = ts - this._startTime;
106
+ const progress = Math.min(elapsed / this.duration, 1);
107
+ const current = this._startVal + (this._endVal - this._startVal) * this._ease(progress);
108
+ this._display = this._format(current);
109
+ if (progress >= 1) {
110
+ this._display = this._format(this._endVal);
111
+ this._loop.stop();
112
+ this.dispatchCustomEvent('ticker-end');
113
+ }
114
+ }
115
+ render() {
116
+ return html `<span class="value" part="value" aria-live="polite">${this._display}</span>`;
117
+ }
118
+ };
119
+ __decorate([
120
+ property({ type: Number })
121
+ ], NumberIncrement.prototype, "value", void 0);
122
+ __decorate([
123
+ property({ type: Number, attribute: 'from' })
124
+ ], NumberIncrement.prototype, "from", void 0);
125
+ __decorate([
126
+ property({ type: Number })
127
+ ], NumberIncrement.prototype, "duration", void 0);
128
+ __decorate([
129
+ property({ type: Number })
130
+ ], NumberIncrement.prototype, "decimals", void 0);
131
+ __decorate([
132
+ property({ type: String })
133
+ ], NumberIncrement.prototype, "locale", void 0);
134
+ __decorate([
135
+ property({ type: Object })
136
+ ], NumberIncrement.prototype, "options", void 0);
137
+ __decorate([
138
+ property({ attribute: false })
139
+ ], NumberIncrement.prototype, "formatter", void 0);
140
+ __decorate([
141
+ property({ type: String })
142
+ ], NumberIncrement.prototype, "easing", void 0);
143
+ __decorate([
144
+ property({ type: Number })
145
+ ], NumberIncrement.prototype, "threshold", void 0);
146
+ __decorate([
147
+ property({ type: Boolean })
148
+ ], NumberIncrement.prototype, "repeat", void 0);
149
+ __decorate([
150
+ state()
151
+ ], NumberIncrement.prototype, "_display", void 0);
152
+ NumberIncrement = __decorate([
153
+ customElement('uibit-number-increment')
154
+ ], NumberIncrement);
155
+ export { NumberIncrement };
156
+ export default NumberIncrement;
157
+ //# sourceMappingURL=number-increment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number-increment.js","sourceRoot":"","sources":["../src/number-increment.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC9F,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;;;;;;;;;;;GAgBG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,YAAY;IAA1C;;QAGL,2CAA2C;QACf,UAAK,GAAG,CAAC,CAAC;QACtC,wCAAwC;QACO,SAAI,GAAG,CAAC,CAAC;QACxD,uDAAuD;QAC3B,aAAQ,GAAG,IAAI,CAAC;QAC5C,yFAAyF;QAC7D,aAAQ,GAAG,CAAC,CAAC;QACzC,+GAA+G;QACnF,WAAM,GAAG,EAAE,CAAC;QAKxC,2DAA2D;QAC/B,WAAM,GAA0C,UAAU,CAAC;QACvF,oEAAoE;QACxC,cAAS,GAAG,GAAG,CAAC;QAC5C,+DAA+D;QAClC,WAAM,GAAG,KAAK,CAAC;QAE3B,aAAQ,GAAG,EAAE,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IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAiB;AAEf;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CAAgB;AAE3B;IAAhB,KAAK,EAAE;iDAAuB;AAxBpB,eAAe;IAD3B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,eAAe,CAsG3B;;AAED,eAAe,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const styles: import("lit").CSSResult;
2
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAclB,CAAC"}
package/dist/styles.js ADDED
@@ -0,0 +1,17 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ :host {
4
+ display: inline-block;
5
+ font-variant-numeric: tabular-nums;
6
+ font-size: var(--uibit-number-increment-font-size, inherit);
7
+ font-weight: var(--uibit-number-increment-font-weight, inherit);
8
+ color: var(--uibit-number-increment-color, inherit);
9
+ font-family: var(--uibit-number-increment-font-family, inherit);
10
+ line-height: var(--uibit-number-increment-line-height, inherit);
11
+ }
12
+
13
+ .value {
14
+ display: inline;
15
+ }
16
+ `;
17
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;CAcxB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type NumberIncrement from './number-increment';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'uibit-number-increment': NumberIncrement;
5
+ }
6
+ }
7
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,oBAAoB,CAAC;AAEtD,OAAO,CAAC,MAAM,CAAC;IACf,UAAU,qBAAqB;QAC3B,wBAAwB,EAAE,eAAe,CAAC;KAC7C;CACA"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,92 @@
1
+ {
2
+ "name": "@uibit/number-increment",
3
+ "version": "0.1.0",
4
+ "description": "Intersection-aware numeric counter that animates to a target value with easing curves, locale-aware formatting, and custom formatter function overrides. Triggers once the element scrolls into the viewport.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./custom-elements.json": "./custom-elements.json",
14
+ "./react": "./dist/frameworks/react/index.d.ts",
15
+ "./vue": "./dist/frameworks/vue/index.ts",
16
+ "./svelte": "./dist/frameworks/svelte/index.svelte",
17
+ "./angular": "./dist/frameworks/angular/index.ts",
18
+ "./solid": "./dist/frameworks/solid/index.d.ts",
19
+ "./astro": "./dist/frameworks/astro/index.astro",
20
+ "./qwik": "./dist/frameworks/qwik/index.tsx",
21
+ "./nuxt": "./dist/frameworks/nuxt/index.ts",
22
+ "./preact": "./dist/frameworks/preact/index.d.ts",
23
+ "./stencil": "./dist/frameworks/stencil/index.d.ts"
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "package.json",
28
+ "README.md",
29
+ "LICENSE",
30
+ "custom-elements.json"
31
+ ],
32
+ "keywords": [
33
+ "counter",
34
+ "ticker",
35
+ "number",
36
+ "animation",
37
+ "intersection",
38
+ "web-component",
39
+ "lit"
40
+ ],
41
+ "author": "Jonathan Rawlings",
42
+ "license": "MIT",
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "https://github.com/Rawlings/uibit",
46
+ "directory": "packages/components/number-increment"
47
+ },
48
+ "dependencies": {
49
+ "@uibit/core": "0.1.0"
50
+ },
51
+ "devDependencies": {
52
+ "@types/node": "^20.19.43",
53
+ "lit": "^3.3.3",
54
+ "typescript": "7.0.2",
55
+ "@uibit/codegen": "0.1.0"
56
+ },
57
+ "peerDependencies": {
58
+ "lit": "^3.0.0",
59
+ "react": ">=18",
60
+ "vue": ">=3",
61
+ "svelte": ">=4 || ^5",
62
+ "@angular/core": ">=14"
63
+ },
64
+ "customElements": "custom-elements.json",
65
+ "peerDependenciesMeta": {
66
+ "react": {
67
+ "optional": true
68
+ },
69
+ "vue": {
70
+ "optional": true
71
+ },
72
+ "svelte": {
73
+ "optional": true
74
+ },
75
+ "@angular/core": {
76
+ "optional": true
77
+ }
78
+ },
79
+ "uibit": {
80
+ "id": "number-increment",
81
+ "title": "Number Increment",
82
+ "category": "Data",
83
+ "tagName": "uibit-number-increment"
84
+ },
85
+ "scripts": {
86
+ "build": "cem analyze --globs 'src/**/*.ts' --litelement && uibit-codegen --package . && tsc",
87
+ "dev": "concurrently \"cem analyze --globs 'src/**/*.ts' --litelement --watch\" \"tsc --watch\"",
88
+ "analyze": "cem analyze --globs 'src/**/*.ts' --litelement",
89
+ "typecheck": "tsc --noEmit",
90
+ "test": "vitest run -c ../../../vitest.config.ts --passWithNoTests"
91
+ }
92
+ }