@uibit/number-increment 0.1.0 → 0.2.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.
@@ -1,33 +1,176 @@
1
- import { defineComponent, h } from 'vue';
1
+ import { defineComponent, h, ref, watch } from 'vue';
2
2
  import type { NumberIncrement as HTMLElementClass } from '@uibit/number-increment';
3
3
  import '@uibit/number-increment';
4
-
5
4
  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
- }
5
+ name: 'NumberIncrement',
6
+ props: {
7
+ value: {
8
+ type: [
9
+ String,
10
+ Number,
11
+ Boolean,
12
+ Array,
13
+ Object
14
+ ] as any
15
+ },
16
+ from: {
17
+ type: [
18
+ String,
19
+ Number,
20
+ Boolean,
21
+ Array,
22
+ Object
23
+ ] as any
24
+ },
25
+ duration: {
26
+ type: [
27
+ String,
28
+ Number,
29
+ Boolean,
30
+ Array,
31
+ Object
32
+ ] as any
33
+ },
34
+ decimals: {
35
+ type: [
36
+ String,
37
+ Number,
38
+ Boolean,
39
+ Array,
40
+ Object
41
+ ] as any
42
+ },
43
+ options: {
44
+ type: [
45
+ String,
46
+ Number,
47
+ Boolean,
48
+ Array,
49
+ Object
50
+ ] as any
51
+ },
52
+ formatter: {
53
+ type: [
54
+ String,
55
+ Number,
56
+ Boolean,
57
+ Array,
58
+ Object
59
+ ] as any
60
+ },
61
+ easing: {
62
+ type: [
63
+ String,
64
+ Number,
65
+ Boolean,
66
+ Array,
67
+ Object
68
+ ] as any
69
+ },
70
+ threshold: {
71
+ type: [
72
+ String,
73
+ Number,
74
+ Boolean,
75
+ Array,
76
+ Object
77
+ ] as any
78
+ },
79
+ repeat: {
80
+ type: [
81
+ String,
82
+ Number,
83
+ Boolean,
84
+ Array,
85
+ Object
86
+ ] as any
87
+ },
88
+ locale: {
89
+ type: [
90
+ String,
91
+ Number,
92
+ Boolean,
93
+ Array,
94
+ Object
95
+ ] as any
96
+ }
97
+ },
98
+ emits: [
99
+ 'void'
100
+ ],
101
+ setup (props, { slots, emit }) {
102
+ const elementRef = ref<HTMLElementClass | null>(null);
103
+ if (false) {
104
+ watch(()=>props.modelValue, (newVal)=>{
105
+ if (elementRef.value && newVal !== undefined && elementRef.value.value !== newVal) {
106
+ elementRef.value.value = newVal;
107
+ }
108
+ });
109
+ watch(()=>props.value, (newVal)=>{
110
+ if (elementRef.value && newVal !== undefined && elementRef.value.value !== newVal) {
111
+ elementRef.value.value = newVal;
112
+ }
113
+ });
114
+ }
115
+ watch(()=>props.from, (newVal)=>{
116
+ if (elementRef.value && newVal !== undefined) {
117
+ (elementRef.value as any).from = newVal;
118
+ }
119
+ });
120
+ watch(()=>props.duration, (newVal)=>{
121
+ if (elementRef.value && newVal !== undefined) {
122
+ (elementRef.value as any).duration = newVal;
123
+ }
124
+ });
125
+ watch(()=>props.decimals, (newVal)=>{
126
+ if (elementRef.value && newVal !== undefined) {
127
+ (elementRef.value as any).decimals = newVal;
128
+ }
129
+ });
130
+ watch(()=>props.options, (newVal)=>{
131
+ if (elementRef.value && newVal !== undefined) {
132
+ (elementRef.value as any).options = newVal;
133
+ }
134
+ });
135
+ watch(()=>props.formatter, (newVal)=>{
136
+ if (elementRef.value && newVal !== undefined) {
137
+ (elementRef.value as any).formatter = newVal;
138
+ }
139
+ });
140
+ watch(()=>props.easing, (newVal)=>{
141
+ if (elementRef.value && newVal !== undefined) {
142
+ (elementRef.value as any).easing = newVal;
143
+ }
144
+ });
145
+ watch(()=>props.threshold, (newVal)=>{
146
+ if (elementRef.value && newVal !== undefined) {
147
+ (elementRef.value as any).threshold = newVal;
148
+ }
149
+ });
150
+ watch(()=>props.repeat, (newVal)=>{
151
+ if (elementRef.value && newVal !== undefined) {
152
+ (elementRef.value as any).repeat = newVal;
153
+ }
154
+ });
155
+ watch(()=>props.locale, (newVal)=>{
156
+ if (elementRef.value && newVal !== undefined) {
157
+ (elementRef.value as any).locale = newVal;
158
+ }
159
+ });
160
+ return ()=>{
161
+ const eventListeners: Record<string, any> = {};
162
+ eventListeners['onVoid'] = (event: Event)=>{
163
+ emit('void', event);
164
+ };
165
+ const mergedProps = {
166
+ ...props,
167
+ ...eventListeners,
168
+ ref: elementRef
169
+ };
170
+ if (false && props.modelValue !== undefined) {
171
+ (mergedProps as any).value = props.modelValue;
172
+ }
173
+ return h('uibit-number-increment', mergedProps, slots.default?.());
174
+ };
175
+ }
33
176
  });
@@ -1,6 +1,8 @@
1
1
  import { UIBitElement } from '@uibit/core';
2
2
  /**
3
3
  * Animates a numeric value from zero (or a custom start) up to the `value`
4
+
5
+ * @summary A scroll-triggered animated numeric counter component.
4
6
  * attribute once the element scrolls into the viewport. Supports easing,
5
7
  * decimal places, and custom formatting functions.
6
8
  *
@@ -15,7 +17,8 @@ import { UIBitElement } from '@uibit/core';
15
17
  * @cssprop [--uibit-number-increment-color=inherit] - Text color
16
18
  * @cssprop [--uibit-number-increment-font-family=inherit] - Font family
17
19
  * @cssprop [--uibit-number-increment-line-height=inherit] - Line height
18
- */
20
+
21
+ * @cssstate animating - Active when the count animation is running.*/
19
22
  export declare class NumberIncrement extends UIBitElement {
20
23
  static styles: import("lit").CSSResult;
21
24
  /** Target numeric value to count up to. */
@@ -26,8 +29,6 @@ export declare class NumberIncrement extends UIBitElement {
26
29
  duration: number;
27
30
  /** Number of decimal places to display. Used only if no custom formatter is provided. */
28
31
  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
32
  /** Options for Intl.NumberFormat. */
32
33
  options?: Intl.NumberFormatOptions;
33
34
  /** Custom formatter function to format the number for display. Overrides locale and options. */
@@ -1 +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,OAA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;IAOb,OAAO,CAAC,OAAO;IAcf,OAAO,CAAC,MAAM;IAUd,OAAO,CAAC,KAAK;IAcb,MAAM,oCAEL;CACF;eAEc,eAAe"}
@@ -10,6 +10,8 @@ import { property, state } from 'lit/decorators.js';
10
10
  import { styles } from './styles';
11
11
  /**
12
12
  * Animates a numeric value from zero (or a custom start) up to the `value`
13
+
14
+ * @summary A scroll-triggered animated numeric counter component.
13
15
  * attribute once the element scrolls into the viewport. Supports easing,
14
16
  * decimal places, and custom formatting functions.
15
17
  *
@@ -24,7 +26,8 @@ import { styles } from './styles';
24
26
  * @cssprop [--uibit-number-increment-color=inherit] - Text color
25
27
  * @cssprop [--uibit-number-increment-font-family=inherit] - Font family
26
28
  * @cssprop [--uibit-number-increment-line-height=inherit] - Line height
27
- */
29
+
30
+ * @cssstate animating - Active when the count animation is running.*/
28
31
  let NumberIncrement = class NumberIncrement extends UIBitElement {
29
32
  constructor() {
30
33
  super(...arguments);
@@ -36,8 +39,6 @@ let NumberIncrement = class NumberIncrement extends UIBitElement {
36
39
  this.duration = 1800;
37
40
  /** Number of decimal places to display. Used only if no custom formatter is provided. */
38
41
  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
42
  /** Easing curve: "ease-out" | "ease-in-out" | "linear". */
42
43
  this.easing = 'ease-out';
43
44
  /** Intersection threshold (0–1) at which the animation triggers. */
@@ -86,10 +87,14 @@ let NumberIncrement = class NumberIncrement extends UIBitElement {
86
87
  if (this.formatter) {
87
88
  return this.formatter(n);
88
89
  }
90
+ const locale = this.resolvedLocale;
89
91
  if (this.options || this.locale) {
90
- return new Intl.NumberFormat(this.locale || undefined, this.options).format(n);
92
+ return new Intl.NumberFormat(locale, this.options || undefined).format(n);
91
93
  }
92
- return n.toFixed(this.decimals);
94
+ return new Intl.NumberFormat(locale, {
95
+ minimumFractionDigits: this.decimals,
96
+ maximumFractionDigits: this.decimals,
97
+ }).format(n);
93
98
  }
94
99
  _start() {
95
100
  this._started = true;
@@ -128,9 +133,6 @@ __decorate([
128
133
  __decorate([
129
134
  property({ type: Number })
130
135
  ], NumberIncrement.prototype, "decimals", void 0);
131
- __decorate([
132
- property({ type: String })
133
- ], NumberIncrement.prototype, "locale", void 0);
134
136
  __decorate([
135
137
  property({ type: Object })
136
138
  ], NumberIncrement.prototype, "options", void 0);
@@ -1 +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,CAAC;QAGvB,UAAK,GAAG,IAAI,cAAc,CAAC,IAAI,EAAE;YACvC,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;SACjC,CA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1,6 @@
1
1
  {
2
2
  "name": "@uibit/number-increment",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
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
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -11,7 +11,7 @@
11
11
  "import": "./dist/index.js"
12
12
  },
13
13
  "./custom-elements.json": "./custom-elements.json",
14
- "./react": "./dist/frameworks/react/index.d.ts",
14
+ "./react": "./dist/frameworks/react/index.ts",
15
15
  "./vue": "./dist/frameworks/vue/index.ts",
16
16
  "./svelte": "./dist/frameworks/svelte/index.svelte",
17
17
  "./angular": "./dist/frameworks/angular/index.ts",
@@ -46,13 +46,13 @@
46
46
  "directory": "packages/components/number-increment"
47
47
  },
48
48
  "dependencies": {
49
- "@uibit/core": "0.1.0"
49
+ "@uibit/core": "0.2.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/node": "^20.19.43",
53
53
  "lit": "^3.3.3",
54
54
  "typescript": "7.0.2",
55
- "@uibit/codegen": "0.1.0"
55
+ "@uibit/codegen": "0.2.0"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "lit": "^3.0.0",
@@ -83,9 +83,9 @@
83
83
  "tagName": "uibit-number-increment"
84
84
  },
85
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",
86
+ "build": "cem analyze --config ../custom-elements-manifest.config.js && uibit-codegen --package . && tsc",
87
+ "dev": "concurrently \"cem analyze --config ../custom-elements-manifest.config.js --watch\" \"tsc --watch\"",
88
+ "analyze": "cem analyze --config ../custom-elements-manifest.config.js",
89
89
  "typecheck": "tsc --noEmit",
90
90
  "test": "vitest run -c ../../../vitest.config.ts --passWithNoTests"
91
91
  }
@@ -1,27 +0,0 @@
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
- }