light-odometer 0.0.1 → 0.0.2
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/README.md +2 -0
- package/dist/main.d.ts +25 -70
- package/dist/main.js +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -3,3 +3,5 @@
|
|
|
3
3
|
This project is made only for personal use, as a small and lightweight build of [tm-odometer](https://github.com/mtmarco87/tm-odometer), which is itself a fork of [HubSpot's odometer](https://github.com/HubSpot/odometer).
|
|
4
4
|
Do not use this, use [@mtmarco87](https://github.com/mtmarco87)'s package instead.
|
|
5
5
|
Huge props to him for this TypeScript refactor !
|
|
6
|
+
|
|
7
|
+
No theme is shipped here, no docs either.
|
package/dist/main.d.ts
CHANGED
|
@@ -1,49 +1,32 @@
|
|
|
1
1
|
//#region src/shared/interfaces.d.ts
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* @interface OdometerOptions
|
|
3
|
+
* LightOdometer global options interface
|
|
5
4
|
* @property {string} [selector] - The selector for the odometer elements.
|
|
6
5
|
* @property {boolean} [auto] - Whether to automatically initialize odometers.
|
|
7
|
-
* @property {any} [key] - Additional options.
|
|
8
6
|
*/
|
|
9
|
-
interface
|
|
7
|
+
interface LightOdometerOptions {
|
|
10
8
|
selector?: string;
|
|
11
9
|
auto?: boolean;
|
|
12
|
-
[key: string]: any;
|
|
13
10
|
}
|
|
14
11
|
/**
|
|
15
|
-
*
|
|
16
|
-
* Extends the base configuration options (`TmOdometerConfig`) with additional required properties.
|
|
17
|
-
* @interface TmOdometerOptions
|
|
18
|
-
* @extends TmOdometerConfig
|
|
12
|
+
* LightOdometer config interface
|
|
19
13
|
* @property {HTMLElement} el - The HTML element to attach the odometer to.
|
|
20
|
-
*/
|
|
21
|
-
interface TmOdometerOptions extends TmOdometerConfig {
|
|
22
|
-
el: HTMLElement;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* TmOdometer config interface
|
|
26
|
-
* @interface TmOdometerConfig
|
|
27
14
|
* @property {string | number | null} [value] - The initial value of the odometer.
|
|
28
15
|
* @property {string} [format] - The format string for the odometer.
|
|
29
|
-
* @property {string} [theme] - The theme for the odometer.
|
|
30
16
|
* @property {number} [duration] - The duration of the animation in milliseconds.
|
|
31
17
|
* @property {'count' | 'slide'} [animation] - The animation type ('count' or 'slide').
|
|
32
18
|
* @property {(value: number) => string} [formatFunction] - A custom format function.
|
|
33
|
-
* @property {any} [key] - Additional options.
|
|
34
19
|
*/
|
|
35
|
-
interface
|
|
20
|
+
interface LightOdometerOptions {
|
|
21
|
+
el: HTMLElement;
|
|
36
22
|
value?: string | number | null;
|
|
37
23
|
format?: string;
|
|
38
|
-
theme?: string;
|
|
39
24
|
duration?: number;
|
|
40
25
|
animation?: "count" | "slide";
|
|
41
26
|
formatFunction?: (value: number) => string;
|
|
42
|
-
[key: string]: any;
|
|
43
27
|
}
|
|
44
28
|
/**
|
|
45
29
|
* FormatObject interface
|
|
46
|
-
* @interface FormatObject
|
|
47
30
|
* @property {string} repeating - The repeating part of the format. (i.e. '(,ddd)')
|
|
48
31
|
* @property {string} [radix] - The radix separator. (i.e. '.')
|
|
49
32
|
* @property {number} precision - The number of decimal places. (i.e. 'dd')
|
|
@@ -55,35 +38,17 @@ interface FormatObject {
|
|
|
55
38
|
}
|
|
56
39
|
declare global {
|
|
57
40
|
interface Window extends WindowOrWorkerGlobalScope {
|
|
58
|
-
odometerOptions?:
|
|
59
|
-
jQuery?: any;
|
|
60
|
-
mozRequestAnimationFrame?: (callback: FrameRequestCallback) => number;
|
|
61
|
-
webkitRequestAnimationFrame?: (callback: FrameRequestCallback) => number;
|
|
62
|
-
msRequestAnimationFrame?: (callback: FrameRequestCallback) => number;
|
|
63
|
-
WebKitMutationObserver?: any;
|
|
64
|
-
MozMutationObserver?: any;
|
|
41
|
+
odometerOptions?: Omit<LightOdometerOptions, "el">;
|
|
65
42
|
}
|
|
66
43
|
interface HTMLElement {
|
|
67
|
-
odometer?:
|
|
68
|
-
doScroll?: any;
|
|
69
|
-
}
|
|
70
|
-
interface CSSStyleDeclaration {
|
|
71
|
-
webkitTransition: string;
|
|
72
|
-
mozTransition?: any;
|
|
73
|
-
oTransition?: any;
|
|
74
|
-
}
|
|
75
|
-
interface Document {
|
|
76
|
-
createEventObject?: any;
|
|
44
|
+
odometer?: LightOdometer;
|
|
77
45
|
}
|
|
78
46
|
}
|
|
79
47
|
//#endregion
|
|
80
|
-
//#region src/utils/compatibility.d.ts
|
|
81
|
-
declare const MutationObserver: typeof window.MutationObserver;
|
|
82
|
-
//#endregion
|
|
83
48
|
//#region src/core/odometer.d.ts
|
|
84
|
-
declare class
|
|
85
|
-
static options:
|
|
86
|
-
options:
|
|
49
|
+
declare class LightOdometer {
|
|
50
|
+
static options: Omit<LightOdometerOptions, "el">;
|
|
51
|
+
options: LightOdometerOptions;
|
|
87
52
|
el: HTMLElement;
|
|
88
53
|
value: number;
|
|
89
54
|
inside: HTMLElement;
|
|
@@ -95,16 +60,15 @@ declare class TmOdometer {
|
|
|
95
60
|
digits: HTMLElement[];
|
|
96
61
|
ribbons: Record<number, HTMLElement>;
|
|
97
62
|
/**
|
|
98
|
-
* Initializes a new instance of the
|
|
63
|
+
* Initializes a new instance of the LightOdometer class.
|
|
99
64
|
* Sets up the odometer's options, formats, and DOM structure.
|
|
100
65
|
* If an odometer instance already exists on the element, it returns the existing instance.
|
|
101
|
-
* @param {
|
|
66
|
+
* @param {LightOdometerOptions} options - Configuration options for the odometer.
|
|
102
67
|
*/
|
|
103
|
-
constructor(options:
|
|
68
|
+
constructor(options: LightOdometerOptions);
|
|
104
69
|
/**
|
|
105
70
|
* Renders the inner container of the odometer.
|
|
106
|
-
* Clears the root element (`this.el`) and appends a new child element
|
|
107
|
-
* with the class `odometer-inside`.
|
|
71
|
+
* Clears the root element (`this.el`) and appends a new child element with the class `odometer-inside`.
|
|
108
72
|
* @returns {void}
|
|
109
73
|
*/
|
|
110
74
|
renderInside(): void;
|
|
@@ -129,17 +93,14 @@ declare class TmOdometer {
|
|
|
129
93
|
stopWatchingMutations(): void;
|
|
130
94
|
/**
|
|
131
95
|
* Cleans and normalizes a value to ensure it can be processed as a number.
|
|
132
|
-
* Converts formatted strings into numeric values by handling radix symbols
|
|
133
|
-
* and removing unnecessary characters.
|
|
96
|
+
* Converts formatted strings into numeric values by handling radix symbols and removing unnecessary characters.
|
|
134
97
|
* @param {string | number} val - The value to clean and normalize.
|
|
135
98
|
* @returns {number} The cleaned and rounded numeric value.
|
|
136
99
|
*/
|
|
137
100
|
cleanValue(val: string | number): number;
|
|
138
101
|
/**
|
|
139
102
|
* Binds transition end events to the root element (`this.el`).
|
|
140
|
-
* Ensures that the odometer re-renders only once per transition, even if multiple
|
|
141
|
-
* transition end events are triggered. After rendering, it dispatches the
|
|
142
|
-
* `odometerdone` custom event.
|
|
103
|
+
* Ensures that the odometer re-renders only once per transition, even if multiple transition end events are triggered. After rendering, it dispatches the `odometerdone` custom event.
|
|
143
104
|
* @returns {void}
|
|
144
105
|
*/
|
|
145
106
|
bindTransitionEnd(): void;
|
|
@@ -152,8 +113,7 @@ declare class TmOdometer {
|
|
|
152
113
|
resetFormat(): void;
|
|
153
114
|
/**
|
|
154
115
|
* Renders the odometer with the specified value.
|
|
155
|
-
* Updates the DOM structure, applies the appropriate
|
|
156
|
-
* and formats the digits for display.
|
|
116
|
+
* Updates the DOM structure, applies the appropriate classes, and formats the digits for display.
|
|
157
117
|
* @param {number} [value] - The value to render. Defaults to the current value (`this.value`).
|
|
158
118
|
* @returns {void}
|
|
159
119
|
*/
|
|
@@ -175,8 +135,7 @@ declare class TmOdometer {
|
|
|
175
135
|
preservePrecision(value: number): string;
|
|
176
136
|
/**
|
|
177
137
|
* Updates the odometer to display a new value.
|
|
178
|
-
* Cleans and normalizes the input value, determines the difference from the current value,
|
|
179
|
-
* and triggers the appropriate animations and DOM updates.
|
|
138
|
+
* Cleans and normalizes the input value, determines the difference from the current value, and triggers the appropriate animations and DOM updates.
|
|
180
139
|
* @param {string | number} newValue - The new value to update the odometer to.
|
|
181
140
|
* @returns {number} The updated value of the odometer.
|
|
182
141
|
*/
|
|
@@ -207,8 +166,7 @@ declare class TmOdometer {
|
|
|
207
166
|
addSpacer(chr: string, before?: HTMLElement | null, extraClasses?: string): HTMLElement;
|
|
208
167
|
/**
|
|
209
168
|
* Adds a digit or spacer element to the odometer's inner container.
|
|
210
|
-
* Handles special cases for negation (`-`) and radix (`.`) characters,
|
|
211
|
-
* and ensures the format's repeating pattern is respected.
|
|
169
|
+
* Handles special cases for negation (`-`) and radix (`.`) characters, and ensures the format's repeating pattern is respected.
|
|
212
170
|
* @param {string} value - The digit or character to add.
|
|
213
171
|
* @param {boolean} [repeating=true] - Whether to use the repeating format pattern. Defaults to `true`.
|
|
214
172
|
* @returns {HTMLElement} The inserted digit or spacer element.
|
|
@@ -244,8 +202,7 @@ declare class TmOdometer {
|
|
|
244
202
|
getFractionalDigitCount(...values: number[]): number;
|
|
245
203
|
/**
|
|
246
204
|
* Resets the odometer's digits and ribbons.
|
|
247
|
-
* Clears the inner container, resets the format configuration,
|
|
248
|
-
* and prepares the odometer for re-rendering.
|
|
205
|
+
* Clears the inner container, resets the format configuration, and prepares the odometer for re-rendering.
|
|
249
206
|
* @returns {void}
|
|
250
207
|
*/
|
|
251
208
|
resetDigits(): void;
|
|
@@ -259,19 +216,17 @@ declare class TmOdometer {
|
|
|
259
216
|
createRange(start: number, end: number, inclusive: boolean): number[];
|
|
260
217
|
/**
|
|
261
218
|
* Animates the odometer to transition to a new value using a sliding animation.
|
|
262
|
-
* Breaks the value into individual digits, calculates the frames for each digit's animation,
|
|
263
|
-
* and updates the DOM to reflect the sliding effect.
|
|
219
|
+
* Breaks the value into individual digits, calculates the frames for each digit's animation, and updates the DOM to reflect the sliding effect.
|
|
264
220
|
* @param {number} newValue - The new value to animate the odometer to.
|
|
265
221
|
* @returns {void}
|
|
266
222
|
*/
|
|
267
223
|
animateSlide(newValue: number): void;
|
|
268
224
|
/**
|
|
269
225
|
* Initializes all odometer elements on the page.
|
|
270
|
-
* Selects elements matching the configured selector or the default `.odometer` class,
|
|
271
|
-
*
|
|
272
|
-
* @returns {TmOdometer[]} An array of initialized `TmOdometer` instances.
|
|
226
|
+
* Selects elements matching the configured selector or the default `.odometer` class, and creates a `LightOdometer` instance for each element.
|
|
227
|
+
* @returns {LightOdometer[]} An array of initialized `LightOdometer` instances.
|
|
273
228
|
*/
|
|
274
|
-
static init():
|
|
229
|
+
static init(): LightOdometer[];
|
|
275
230
|
}
|
|
276
231
|
//#endregion
|
|
277
|
-
export {
|
|
232
|
+
export { LightOdometer };
|
package/dist/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=/^\(?([^)]*)\)?(?:(.)(d+))
|
|
1
|
+
const e=/^\(?([^)]*)\)?(?:(.)(d+))?$/;function t(e){"@babel/helpers - typeof";return t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t(e)}function n(e,n){if(t(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(t(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}function r(e){var r=n(e,`string`);return t(r)==`symbol`?r:r+``}function i(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?a(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function s(e){let t=document.createElement(`div`);if(t.innerHTML=e,!(t.firstElementChild instanceof HTMLElement))throw Error(`Invalid HTML: No valid root element found.`);return t.firstElementChild}function c(e,t){return e.className=e.className.replace(RegExp(`(^| )${t.split(` `).join(`|`)}( |$)`,`gi`),` `),e.className}function l(e,t){return c(e,t),e.className+=` ${t}`}function u(e,t){let n=new CustomEvent(t,{bubbles:!0,cancelable:!0});e.dispatchEvent(n)}function d(){var e,t;let n=(e=window.performance)==null||(t=e.now)==null?void 0:t.call(e);return n==null?+new Date:n}function f(e,t){return t!=null||(t=0),t?(e*=10**t,e+=.5,e=Math.floor(e),e/=10**t):Math.round(e)}function p(e){return e<0?Math.ceil(e):Math.floor(e)}function m(e){setTimeout(()=>{window.odometerOptions&&(e.options=o(o({},e.options),window.odometerOptions))},0)}function h(e){document.addEventListener(`DOMContentLoaded`,function(){e.options.auto!==!1&&e.init()},!1)}var g,_=class t{constructor(e){var n,r;if(i(this,`options`,void 0),i(this,`el`,void 0),i(this,`value`,0),i(this,`inside`,void 0),i(this,`observer`,void 0),i(this,`watchMutations`,!1),i(this,`transitionEndBound`,!1),i(this,`format`,{repeating:``,precision:0}),i(this,`MAX_VALUES`,void 0),i(this,`digits`,[]),i(this,`ribbons`,{}),this.options=e,this.el=this.options.el,this.el.odometer)return this.el.odometer;this.el.odometer=this,this.options=o(o({},t.options),this.options),this.options.value==null&&t.options.value!=null&&(this.options.value=t.options.value),(n=this.options).duration!=null||(n.duration=2e3),this.MAX_VALUES=this.options.duration/33.333333333333336/2|0,this.resetFormat(),this.value=this.cleanValue((r=this.options.value)==null?``:r),this.renderInside(),this.render();try{for(let e of[`innerHTML`,`innerText`,`textContent`])this.el[e]&&Object.defineProperty(this.el,e,{get:()=>{if(e===`innerHTML`)return this.inside.outerHTML;var t,n;return(t=(n=this.inside.innerText)==null?this.inside.textContent:n)==null?``:t},set:e=>this.update(e)})}catch(e){this.watchForMutations()}}renderInside(){this.inside=document.createElement(`div`),this.inside.className=`odometer-inside`,this.el.innerHTML=``,this.el.appendChild(this.inside)}watchForMutations(){try{this.observer!=null||(this.observer=new MutationObserver(e=>{let t=this.el.innerText||``;this.renderInside(),this.render(this.value),this.update(t)})),this.watchMutations=!0,this.startWatchingMutations()}catch(e){}}startWatchingMutations(){if(this.watchMutations){var e;(e=this.observer)==null||e.observe(this.el,{childList:!0})}}stopWatchingMutations(){var e;(e=this.observer)==null||e.disconnect()}cleanValue(e){if(typeof e==`string`){var t;e=e.replace((t=this.format.radix)==null?`.`:t,`<radix>`),e=e.replace(/[.,]/g,``),e=e.replace(`<radix>`,`.`),e=parseFloat(e)||0}return f(e,this.format.precision)}bindTransitionEnd(){if(this.transitionEndBound)return;this.transitionEndBound=!0;let e=!1;this.el.addEventListener(`transitionend`,()=>e?!0:(e=!0,setTimeout(()=>{this.render(),e=!1,u(this.el,`odometerdone`)},0),!0),!1)}resetFormat(){var t;let n=(t=this.options.format)==null?`(,ddd).dd`:t;n=n||`d`;let r=e.exec(n);if(!r)throw Error(`LightOdometer: Unparsable digit format`);let[i,a,o,s]=r,c=(s==null?void 0:s.length)||0;this.format={repeating:a,radix:o,precision:c}}render(e){e!=null||(e=this.value),this.stopWatchingMutations(),this.resetFormat(),this.inside.innerHTML=``;let t=this.el.className.split(` `),n=[];for(let e of t)if(e.length){if(/^odometer(-|$)/.test(e))continue;n.push(e)}n.push(`odometer`,`odometer-auto-theme`),this.el.className=n.join(` `),this.ribbons={},this.formatDigits(e),this.startWatchingMutations()}formatDigits(e){if(this.digits=[],this.options.formatFunction){let t=this.options.formatFunction(e);for(let e of t.split(``).toReversed())if(e.match(/0-9/)){let t=this.renderDigit();t.querySelector(`.odometer-value`).innerHTML=e,this.digits.push(t),this.insertDigit(t)}else this.addSpacer(e)}else{let t=this.preservePrecision(e),n=!this.format.precision;for(let e of t.split(``).toReversed())e===`.`&&(n=!0),this.addDigit(e,n)}}preservePrecision(e){let t=e.toString();if(this.format.precision){let e=t.split(`.`);e.length===1&&(t+=`.`,e[1]=``);for(let n=0;n<this.format.precision;n++)e[1][n]||(t+=`0`)}return t}update(e){e=this.cleanValue(e);let t=e-this.value;return t?(c(this.el,`odometer-animating-up odometer-animating-down odometer-animating`),t>0?l(this.el,`odometer-animating-up`):l(this.el,`odometer-animating-down`),this.stopWatchingMutations(),this.animate(e),this.startWatchingMutations(),setTimeout(()=>{this.el.offsetHeight,l(this.el,`odometer-animating`)},0),this.value=e,this.value):this.value}renderDigit(){return s(`<span class="odometer-digit"><span class="odometer-digit-spacer">8</span><span class="odometer-digit-inner"><span class="odometer-ribbon"><span class="odometer-ribbon-inner"><span class="odometer-value"></span></span></span></span></span>`)}insertDigit(e,t){return t?this.inside.insertBefore(e,t):this.inside.children.length?this.inside.insertBefore(e,this.inside.children[0]):this.inside.appendChild(e)}addSpacer(e,t,n){let r=s(`<span class="odometer-formatting-mark"></span>`);return r.innerHTML=e,n&&l(r,n),this.insertDigit(r,t)}addDigit(e,t){if(t!=null||(t=!0),e===`-`)return this.addSpacer(e,null,`odometer-negation-mark`);if(e===`.`){var n;return this.addSpacer((n=this.format.radix)==null?`.`:n,null,`odometer-radix-mark`)}if(t){let e=!1;for(;;){if(!this.format.repeating.length){if(e)throw Error(`Bad odometer format without digits`);this.resetFormat(),e=!0}let t=this.format.repeating[this.format.repeating.length-1];if(this.format.repeating=this.format.repeating.substring(0,this.format.repeating.length-1),t===`d`)break;this.addSpacer(t)}}let r=this.renderDigit();return r.querySelector(`.odometer-value`).innerHTML=e,this.digits.push(r),this.insertDigit(r)}animate(e){this.options.animation===`count`?this.animateCount(e):this.animateSlide(e)}animateCount(e){let t=e-this.value;if(!t)return;let n=d(),r=n,i=this.value,a=()=>{if(d()-n>(this.options.duration||0)){this.value=e,this.render(),u(this.el,`odometerdone`);return}let o=d()-r;if(o>50){r=d();let e=o/(this.options.duration||0),n=t*e;i+=n,this.render(Math.round(i))}requestAnimationFrame(a)};a()}getDigitCount(...e){for(let t=0;t<e.length;t++)e[t]=Math.abs(e[t]);let t=Math.max(...e);return Math.ceil(Math.log(t+1)/Math.log(10))}getFractionalDigitCount(...e){let t=/^-?\d*\.(\d*?)0*$/;for(let n=0;n<e.length;n++){let r=e[n].toString(),i=t.exec(r);e[n]=i?i[1].length:0}return Math.max(...e)}resetDigits(){this.digits=[],this.ribbons={},this.inside.innerHTML=``,this.resetFormat()}createRange(e,t,n){let r=e<t,i=Math.abs(t-e)+(n?1:0);return Array.from({length:i},(t,n)=>r?e+n:e-n)}animateSlide(e){let t=this.value,n=this.format.precision;n&&(e*=10**n,t*=10**n);let r=e-t;if(!r)return;this.bindTransitionEnd();let i=[],a=this.getDigitCount(t,e),o=0,s=t;for(let n=0;n<a;n++){s=p(t/10**(a-n-1));let r=p(e/10**(a-n-1)),c=r-s,l;if(Math.abs(c)>this.MAX_VALUES){l=[];let e=this.MAX_VALUES*(1+o*.5),t=c/e,n=s;for(;c>0&&n<r||c<0&&n>r;)l.push(Math.round(n)),n+=t;l[l.length-1]!==r&&l.push(r),o++}else l=this.createRange(s,r,!0);for(let e=0;e<l.length;e++)l[e]=Math.abs(l[e]%10);i.push(l)}this.resetDigits();let c=i.toReversed();for(let e=0;e<c.length;e++){let t=c[e];if(this.digits[e]||this.addDigit(` `,e>=n),this.ribbons[e]===void 0){let t=this.digits[e].querySelector(`.odometer-ribbon-inner`);t&&(this.ribbons[e]=t)}this.ribbons[e].innerHTML=``,r<0&&(t=t.toReversed());for(let n=0;n<t.length;n++){let r=t[n],i=document.createElement(`div`);i.className=`odometer-value`,i.innerHTML=r.toString(),this.ribbons[e].appendChild(i),n===t.length-1&&l(i,`odometer-last-value`),n===0&&l(i,`odometer-first-value`)}}s<0&&this.addDigit(`-`);let u=this.inside.querySelector(`.odometer-radix-mark`);if(u&&u.parentNode.removeChild(u),n){var d;this.addSpacer((d=this.format.radix)==null?`.`:d,this.digits[n-1],`odometer-radix-mark`)}}static init(){let e=document.querySelectorAll(t.options.selector||`.odometer`);return Array.from(e,e=>{var n;return e.odometer=new t({el:e,value:(n=e.innerText)==null?e.textContent:n})})}};i(_,`options`,(g=window.odometerOptions)==null?{}:g),m(_),h(_);export{_ as LightOdometer};
|
package/package.json
CHANGED
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"typescript": "~5.9.2",
|
|
22
22
|
"unplugin-unused": "~0.5.3"
|
|
23
23
|
},
|
|
24
|
+
"exports": {
|
|
25
|
+
".": "./dist/main.js",
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
24
28
|
"files": [
|
|
25
29
|
"dist"
|
|
26
30
|
],
|
|
@@ -44,6 +48,8 @@
|
|
|
44
48
|
],
|
|
45
49
|
"homepage": "https://github.com/EDM115/light-odometer#readme",
|
|
46
50
|
"license": "MIT",
|
|
51
|
+
"main": "./dist/main.js",
|
|
52
|
+
"module": "./dist/main.js",
|
|
47
53
|
"name": "light-odometer",
|
|
48
54
|
"publishConfig": {
|
|
49
55
|
"access": "public"
|
|
@@ -53,19 +59,13 @@
|
|
|
53
59
|
"url": "git+https://github.com/EDM115/light-odometer.git"
|
|
54
60
|
},
|
|
55
61
|
"type": "module",
|
|
56
|
-
"version": "0.0.1",
|
|
57
|
-
"main": "./dist/main.js",
|
|
58
|
-
"module": "./dist/main.js",
|
|
59
62
|
"types": "./dist/main.d.ts",
|
|
60
|
-
"
|
|
61
|
-
".": "./dist/main.js",
|
|
62
|
-
"./package.json": "./package.json"
|
|
63
|
-
},
|
|
63
|
+
"version": "0.0.2",
|
|
64
64
|
"scripts": {
|
|
65
65
|
"build": "tsdown",
|
|
66
|
+
"format": "eslint -c eslint.stylistic.config.ts --concurrency=auto --fix .",
|
|
66
67
|
"lint": "oxlint --type-aware .",
|
|
67
68
|
"lint:fix": "oxlint --fix --type-aware .",
|
|
68
|
-
"format": "eslint -c eslint.stylistic.config.ts --concurrency=auto --fix .",
|
|
69
69
|
"release": "pnpm publish",
|
|
70
70
|
"typecheck": "tsc --noEmit"
|
|
71
71
|
}
|