@editora/ui-core 0.1.18 → 0.1.20
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/dist/{ElementBase-1b301e7f.js → ElementBase-EV6mVBUV.js} +1 -1
- package/dist/{ElementBase-909688f3.mjs → ElementBase-YlTLMsGk.mjs} +3 -3
- package/dist/accordion.cjs.js +3 -3
- package/dist/accordion.esm.js +39 -62
- package/dist/alert-dialog.cjs.js +19 -19
- package/dist/alert-dialog.esm.js +69 -87
- package/dist/alert.cjs.js +1 -1
- package/dist/alert.esm.js +4 -7
- package/dist/anchor.cjs.js +2 -2
- package/dist/anchor.esm.js +3 -3
- package/dist/animated-beam.cjs.js +83 -83
- package/dist/animated-beam.esm.js +250 -277
- package/dist/animated-list.cjs.js +4 -4
- package/dist/animated-list.esm.js +47 -61
- package/dist/animated-text.cjs.js +2 -2
- package/dist/animated-text.esm.js +13 -24
- package/dist/app-header.cjs.js +3 -3
- package/dist/app-header.esm.js +11 -13
- package/dist/aspect-ratio.cjs.js +1 -1
- package/dist/aspect-ratio.esm.js +4 -7
- package/dist/avatar.cjs.js +1 -1
- package/dist/avatar.esm.js +7 -13
- package/dist/badge.cjs.js +1 -1
- package/dist/badge.esm.js +4 -7
- package/dist/block-controls.cjs.js +2 -2
- package/dist/block-controls.esm.js +19 -35
- package/dist/box.cjs.js +1 -1
- package/dist/box.esm.js +8 -15
- package/dist/breadcrumb.cjs.js +2 -2
- package/dist/breadcrumb.esm.js +20 -37
- package/dist/button.cjs.js +1 -521
- package/dist/button.esm.js +2 -669
- package/dist/{calendar-2c11b824.mjs → calendar-DLY4acgn.mjs} +293 -342
- package/dist/{calendar-a8735e40.js → calendar-Dkof-FTK.js} +25 -25
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +8 -9
- package/dist/card.cjs.js +4 -4
- package/dist/card.esm.js +13 -19
- package/dist/chart.cjs.js +64 -64
- package/dist/chart.esm.js +223 -254
- package/dist/checkbox.cjs.js +1 -1
- package/dist/checkbox.esm.js +2 -3
- package/dist/collapsible.cjs.js +1 -1
- package/dist/collapsible.esm.js +5 -9
- package/dist/{collection-a1aac0c6.mjs → collection-C7URGjEI.mjs} +8 -14
- package/dist/collection.cjs.js +1 -1
- package/dist/collection.esm.js +4 -7
- package/dist/color-picker.cjs.js +9 -9
- package/dist/color-picker.esm.js +189 -252
- package/dist/combobox.cjs.js +13 -13
- package/dist/combobox.esm.js +93 -126
- package/dist/command-palette.cjs.js +3 -3
- package/dist/command-palette.esm.js +19 -30
- package/dist/command.cjs.js +4 -4
- package/dist/command.esm.js +41 -53
- package/dist/components/ui-button.d.ts +1 -0
- package/dist/components/ui-button.d.ts.map +1 -1
- package/dist/components/ui-date-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-time-picker.d.ts +1 -0
- package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts +1 -0
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- package/dist/components/ui-orbiter.d.ts.map +1 -1
- package/dist/components/ui-skeleton.d.ts.map +1 -1
- package/dist/components/ui-split-button.d.ts +1 -0
- package/dist/components/ui-split-button.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/container.cjs.js +2 -2
- package/dist/container.esm.js +2 -3
- package/dist/context-menu.cjs.js +8 -8
- package/dist/context-menu.esm.js +157 -219
- package/dist/control-group.cjs.js +1 -1
- package/dist/control-group.esm.js +2 -3
- package/dist/data-table.cjs.js +4 -4
- package/dist/data-table.esm.js +299 -381
- package/dist/date-field.cjs.js +3 -3
- package/dist/date-field.esm.js +68 -80
- package/dist/date-picker.cjs.js +30 -9
- package/dist/date-picker.esm.js +90 -97
- package/dist/date-range-picker.cjs.js +22 -3
- package/dist/date-range-picker.esm.js +103 -108
- package/dist/date-range-time-picker.cjs.js +28 -12
- package/dist/date-range-time-picker.esm.js +137 -150
- package/dist/date-time-picker.cjs.js +25 -9
- package/dist/date-time-picker.esm.js +139 -155
- package/dist/date-time-utils-Dmost5Ee.js +1 -0
- package/dist/date-time-utils-y1N2gvG2.mjs +268 -0
- package/dist/description.cjs.js +1 -1
- package/dist/description.esm.js +3 -5
- package/dist/dialog.cjs.js +12 -12
- package/dist/dialog.esm.js +44 -63
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +2 -3
- package/dist/{dismissable-layer-9c7e6b58.mjs → dismissable-layer-BmPIoK80.mjs} +29 -33
- package/dist/dismissable-layer-DNfrKA20.js +1 -0
- package/dist/dismissable-layer.cjs.js +2 -2
- package/dist/dismissable-layer.esm.js +4 -6
- package/dist/dock.cjs.js +5 -5
- package/dist/dock.esm.js +134 -155
- package/dist/drawer.cjs.js +2 -2
- package/dist/drawer.esm.js +18 -35
- package/dist/dropdown.cjs.js +2 -2
- package/dist/dropdown.esm.js +119 -149
- package/dist/dropzone.cjs.js +1 -1
- package/dist/dropzone.esm.js +0 -1
- package/dist/empty-state.cjs.js +1 -1
- package/dist/empty-state.esm.js +1 -1
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +3 -5
- package/dist/field.cjs.js +5 -5
- package/dist/field.esm.js +27 -34
- package/dist/fieldset.cjs.js +4 -4
- package/dist/fieldset.esm.js +19 -24
- package/dist/file-upload.cjs.js +4 -4
- package/dist/file-upload.esm.js +69 -93
- package/dist/flex.cjs.js +1 -1
- package/dist/flex.esm.js +5 -9
- package/dist/floating-toolbar.cjs.js +4 -4
- package/dist/floating-toolbar.esm.js +60 -85
- package/dist/focus-scope-Bwug2gDv.js +1 -0
- package/dist/{focus-scope-103833ee.mjs → focus-scope-CmEsG5UZ.mjs} +39 -48
- package/dist/focus-scope.cjs.js +2 -2
- package/dist/focus-scope.esm.js +15 -20
- package/dist/form.cjs.js +2 -2
- package/dist/form.esm.js +26 -53
- package/dist/gantt.cjs.js +43 -43
- package/dist/gantt.esm.js +295 -322
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +5 -9
- package/dist/hover-card.cjs.js +4 -4
- package/dist/hover-card.esm.js +22 -28
- package/dist/icon-cloud.cjs.js +7 -7
- package/dist/icon-cloud.esm.js +48 -62
- package/dist/icon.cjs.js +1 -1
- package/dist/icon.esm.js +2 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +378 -390
- package/dist/inline-edit.cjs.js +11 -11
- package/dist/inline-edit.esm.js +32 -36
- package/dist/input.cjs.js +17 -17
- package/dist/input.esm.js +50 -63
- package/dist/label.cjs.js +2 -2
- package/dist/label.esm.js +8 -17
- package/dist/layout.cjs.js +2 -2
- package/dist/layout.esm.js +20 -26
- package/dist/listbox-B6QgECax.js +46 -0
- package/dist/listbox-DJamVeFj.mjs +200 -0
- package/dist/listbox.cjs.js +1 -1
- package/dist/listbox.esm.js +2 -4
- package/dist/marquee.cjs.js +5 -5
- package/dist/marquee.esm.js +33 -50
- package/dist/masonry-grid.cjs.js +1 -1
- package/dist/masonry-grid.esm.js +5 -9
- package/dist/menu.cjs.js +3 -3
- package/dist/menu.esm.js +106 -126
- package/dist/menubar.cjs.js +5 -5
- package/dist/menubar.esm.js +118 -164
- package/dist/meter.cjs.js +2 -2
- package/dist/meter.esm.js +4 -4
- package/dist/multi-select.cjs.js +4 -4
- package/dist/multi-select.esm.js +120 -140
- package/dist/navigation-menu.cjs.js +4 -4
- package/dist/navigation-menu.esm.js +44 -55
- package/dist/number-field.cjs.js +2 -2
- package/dist/number-field.esm.js +73 -98
- package/dist/number-ticker.cjs.js +3 -3
- package/dist/number-ticker.esm.js +22 -43
- package/dist/odometer.cjs.js +1 -1
- package/dist/odometer.esm.js +5 -9
- package/dist/orbiter.cjs.js +13 -13
- package/dist/orbiter.esm.js +79 -90
- package/dist/{overlayManager-5bbd4dc3.mjs → overlayManager-BJjU1VA8.mjs} +4 -5
- package/dist/{overlayManager-0eda4e08.js → overlayManager-CSy3fJmJ.js} +1 -1
- package/dist/pagination.cjs.js +2 -2
- package/dist/pagination.esm.js +14 -18
- package/dist/{panel-group-a376cc5e.mjs → panel-group-8sVNnGxg.mjs} +24 -46
- package/dist/panel-group-CaD0_KQf.js +36 -0
- package/dist/panel-group.cjs.js +1 -1
- package/dist/panel-group.esm.js +2 -5
- package/dist/panel.cjs.js +4 -4
- package/dist/panel.esm.js +8 -10
- package/dist/password-field.cjs.js +9 -9
- package/dist/password-field.esm.js +62 -82
- package/dist/pin-input.cjs.js +3 -3
- package/dist/pin-input.esm.js +33 -39
- package/dist/placement-grid.cjs.js +4 -4
- package/dist/placement-grid.esm.js +108 -131
- package/dist/plugin-panel.cjs.js +7 -7
- package/dist/plugin-panel.esm.js +13 -15
- package/dist/popover.cjs.js +2 -2
- package/dist/popover.esm.js +21 -31
- package/dist/portal-DgpQ3Jo1.js +1 -0
- package/dist/{portal-fe73e5cc.mjs → portal-bR42gHvG.mjs} +43 -48
- package/dist/portal.cjs.js +2 -2
- package/dist/portal.esm.js +10 -19
- package/dist/{positioner-e9770c66.mjs → positioner-D0VGxtYU.mjs} +189 -209
- package/dist/positioner-D_fqyx_j.js +1 -0
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +11 -18
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +7 -13
- package/dist/progress.cjs.js +1 -1
- package/dist/progress.esm.js +5 -9
- package/dist/quick-actions.cjs.js +6 -6
- package/dist/quick-actions.esm.js +52 -62
- package/dist/radio-group.cjs.js +13 -13
- package/dist/radio-group.esm.js +39 -51
- package/dist/radio.cjs.js +1 -1
- package/dist/radio.esm.js +5 -9
- package/dist/rating.cjs.js +1 -1
- package/dist/rating.esm.js +12 -23
- package/dist/{roving-focus-group-4350c9a7.mjs → roving-focus-group-Dbm1Jko_.mjs} +3 -6
- package/dist/roving-focus-group.cjs.js +1 -1
- package/dist/roving-focus-group.esm.js +3 -5
- package/dist/runtime-CTaOSmBj.js +1 -0
- package/dist/{runtime-161f68a2.mjs → runtime-D1gFh1fS.mjs} +338 -366
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.esm.js +6 -6
- package/dist/scroll-area.cjs.js +3 -3
- package/dist/scroll-area.esm.js +38 -46
- package/dist/{scroll-lock-31da444f.mjs → scroll-lock-LfqXXqsu.mjs} +5 -9
- package/dist/section.cjs.js +1 -1
- package/dist/section.esm.js +1 -1
- package/dist/select.cjs.js +7 -7
- package/dist/select.esm.js +67 -97
- package/dist/selection-popup.cjs.js +1 -1
- package/dist/selection-popup.esm.js +8 -15
- package/dist/separator.cjs.js +1 -1
- package/dist/separator.esm.js +1 -1
- package/dist/sidebar.cjs.js +18 -18
- package/dist/sidebar.esm.js +117 -139
- package/dist/skeleton.cjs.js +11 -11
- package/dist/skeleton.esm.js +27 -24
- package/dist/slider.cjs.js +1 -1
- package/dist/slider.esm.js +6 -11
- package/dist/slot.cjs.js +4 -4
- package/dist/slot.esm.js +16 -19
- package/dist/sortable.cjs.js +45 -45
- package/dist/sortable.esm.js +421 -524
- package/dist/spinning-text.cjs.js +12 -12
- package/dist/spinning-text.esm.js +80 -92
- package/dist/split-button.cjs.js +4 -4
- package/dist/split-button.esm.js +77 -62
- package/dist/splitter.cjs.js +1 -1
- package/dist/splitter.esm.js +1 -1
- package/dist/stepper.cjs.js +8 -8
- package/dist/stepper.esm.js +32 -52
- package/dist/switch.cjs.js +7 -7
- package/dist/switch.esm.js +23 -31
- package/dist/table.cjs.js +2 -2
- package/dist/table.esm.js +46 -56
- package/dist/tabs.cjs.js +3 -3
- package/dist/tabs.esm.js +35 -55
- package/dist/tags-input.cjs.js +4 -4
- package/dist/tags-input.esm.js +45 -62
- package/dist/textarea.cjs.js +6 -6
- package/dist/textarea.esm.js +32 -41
- package/dist/time-field.cjs.js +4 -4
- package/dist/time-field.esm.js +70 -84
- package/dist/time-picker.cjs.js +29 -21
- package/dist/time-picker.esm.js +96 -110
- package/dist/timeline.cjs.js +1 -1
- package/dist/timeline.esm.js +3 -5
- package/dist/toast.cjs.js +2 -2
- package/dist/toast.esm.js +33 -47
- package/dist/toggle-group.cjs.js +6 -6
- package/dist/toggle-group.esm.js +85 -105
- package/dist/toggle.cjs.js +1 -1
- package/dist/toggle.esm.js +3 -5
- package/dist/toolbar.cjs.js +1 -1
- package/dist/toolbar.esm.js +13 -24
- package/dist/tooltip.cjs.js +2 -2
- package/dist/tooltip.esm.js +31 -42
- package/dist/transfer-list.cjs.js +19 -19
- package/dist/transfer-list.esm.js +98 -111
- package/dist/{tree-dcd74a4a.mjs → tree-B3kE8ESs.mjs} +55 -62
- package/dist/tree-Dx_kv_ih.js +39 -0
- package/dist/tree-item.cjs.js +2 -2
- package/dist/tree-item.esm.js +2 -3
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +2 -5
- package/dist/ui-button-Q0GNNWKC.mjs +665 -0
- package/dist/ui-button-rXQOS9QJ.js +521 -0
- package/dist/{icon-9e9da03b.js → ui-icon-BzVNC_lr.js} +4 -4
- package/dist/{icon-e2a85cc1.mjs → ui-icon-YI6lyuqU.mjs} +58 -65
- package/dist/visually-hidden.cjs.js +1 -1
- package/dist/visually-hidden.esm.js +1 -1
- package/dist/wizard.cjs.js +14 -14
- package/dist/wizard.esm.js +85 -105
- package/package.json +3 -3
- package/dist/date-time-utils-66480de4.js +0 -1
- package/dist/date-time-utils-a2c7af25.mjs +0 -307
- package/dist/dismissable-layer-193e3bed.js +0 -1
- package/dist/focus-scope-2b12b4e7.js +0 -1
- package/dist/listbox-308789a0.mjs +0 -210
- package/dist/listbox-ef2f708e.js +0 -46
- package/dist/panel-group-40254cdd.js +0 -36
- package/dist/portal-c69756c0.js +0 -1
- package/dist/positioner-33529bb8.js +0 -1
- package/dist/runtime-3f13807b.js +0 -1
- package/dist/tree-0a7a8d05.js +0 -39
- /package/dist/{collection-a2969ad2.js → collection-qv8A8rq4.js} +0 -0
- /package/dist/{menu-item-styles-27fdbac4.mjs → menu-item-styles-CZiPwPwl.mjs} +0 -0
- /package/dist/{menu-item-styles-83ad1e22.js → menu-item-styles-CbNUEwP2.js} +0 -0
- /package/dist/{roving-focus-group-5c059bf9.js → roving-focus-group-BdJ_4Njm.js} +0 -0
- /package/dist/{scroll-lock-d7b0df21.js → scroll-lock-BX6e3Ced.js} +0 -0
package/dist/number-field.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as I } from "./ElementBase-
|
|
1
|
+
import { E as I } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
2
|
const D = `
|
|
3
3
|
:host {
|
|
4
4
|
--ui-number-field-padding: var(--ui-padding, 10px 12px);
|
|
@@ -313,77 +313,65 @@ const D = `
|
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
`;
|
|
316
|
-
function f(
|
|
317
|
-
return
|
|
316
|
+
function f(r) {
|
|
317
|
+
return r.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
318
318
|
}
|
|
319
|
-
function d(
|
|
320
|
-
if (!
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
return e.length ? e.some((t) => {
|
|
324
|
-
var i;
|
|
325
|
-
return t.nodeType === Node.TEXT_NODE ? !!((i = t.textContent) != null && i.trim()) : t.nodeType === Node.ELEMENT_NODE;
|
|
326
|
-
}) : !1;
|
|
319
|
+
function d(r) {
|
|
320
|
+
if (!r) return !1;
|
|
321
|
+
const e = r.assignedNodes({ flatten: !0 });
|
|
322
|
+
return e.length ? e.some((t) => t.nodeType === Node.TEXT_NODE ? !!t.textContent?.trim() : t.nodeType === Node.ELEMENT_NODE) : !1;
|
|
327
323
|
}
|
|
328
|
-
function p(
|
|
329
|
-
const t =
|
|
330
|
-
if (t == null)
|
|
331
|
-
return !1;
|
|
324
|
+
function p(r, e) {
|
|
325
|
+
const t = r.getAttribute(e);
|
|
326
|
+
if (t == null) return !1;
|
|
332
327
|
const i = String(t).trim().toLowerCase();
|
|
333
328
|
return i !== "false" && i !== "0";
|
|
334
329
|
}
|
|
335
|
-
function g(
|
|
336
|
-
if (
|
|
337
|
-
|
|
338
|
-
const e = Number(s);
|
|
330
|
+
function g(r) {
|
|
331
|
+
if (r == null || r.trim() === "") return null;
|
|
332
|
+
const e = Number(r);
|
|
339
333
|
return Number.isFinite(e) ? e : null;
|
|
340
334
|
}
|
|
341
|
-
function z(
|
|
342
|
-
const e = String(
|
|
343
|
-
if (t)
|
|
344
|
-
return Number(t[1]);
|
|
335
|
+
function z(r) {
|
|
336
|
+
const e = String(r), t = e.match(/e-(\d+)$/i);
|
|
337
|
+
if (t) return Number(t[1]);
|
|
345
338
|
const i = e.split(".")[1];
|
|
346
339
|
return i ? i.length : 0;
|
|
347
340
|
}
|
|
348
|
-
function m(
|
|
349
|
-
if (e == null || e < 0)
|
|
350
|
-
return s;
|
|
341
|
+
function m(r, e) {
|
|
342
|
+
if (e == null || e < 0) return r;
|
|
351
343
|
const t = 10 ** e;
|
|
352
|
-
return Math.round((
|
|
344
|
+
return Math.round((r + Number.EPSILON) * t) / t;
|
|
353
345
|
}
|
|
354
|
-
function A(
|
|
355
|
-
return e != null &&
|
|
346
|
+
function A(r, e, t) {
|
|
347
|
+
return e != null && r < e ? e : t != null && r > t ? t : r;
|
|
356
348
|
}
|
|
357
|
-
function N(
|
|
358
|
-
return
|
|
349
|
+
function N(r) {
|
|
350
|
+
return r ?? 0;
|
|
359
351
|
}
|
|
360
|
-
function B(
|
|
361
|
-
if (e == null || e <= 0)
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
return Math.abs(r - Math.round(r)) < 1e-7;
|
|
352
|
+
function B(r, e, t, i) {
|
|
353
|
+
if (e == null || e <= 0) return !0;
|
|
354
|
+
const s = m((r - t) / e, i != null ? i + 2 : 8);
|
|
355
|
+
return Math.abs(s - Math.round(s)) < 1e-7;
|
|
365
356
|
}
|
|
366
|
-
function C(
|
|
367
|
-
|
|
368
|
-
const e = new Intl.NumberFormat(s).formatToParts(12345.6);
|
|
357
|
+
function C(r) {
|
|
358
|
+
const e = new Intl.NumberFormat(r).formatToParts(12345.6);
|
|
369
359
|
return {
|
|
370
|
-
group:
|
|
371
|
-
decimal:
|
|
360
|
+
group: e.find((t) => t.type === "group")?.value || ",",
|
|
361
|
+
decimal: e.find((t) => t.type === "decimal")?.value || "."
|
|
372
362
|
};
|
|
373
363
|
}
|
|
374
|
-
function _(
|
|
375
|
-
const t =
|
|
376
|
-
if (!t)
|
|
377
|
-
|
|
378
|
-
const { group: i, decimal: r } = C(e);
|
|
364
|
+
function _(r, e) {
|
|
365
|
+
const t = r.trim();
|
|
366
|
+
if (!t) return null;
|
|
367
|
+
const { group: i, decimal: s } = C(e);
|
|
379
368
|
let n = t.replace(/[\s\u00a0\u202f]/g, "");
|
|
380
|
-
if (
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
return Number.isFinite(a) ? a : null;
|
|
369
|
+
if (n = n.split(i).join(""), s !== "." && (n = n.split(s).join(".")), n = n.replace(/[−–]/g, "-"), !/^[+-]?(?:\d+\.?\d*|\.\d+)$/.test(n)) return null;
|
|
370
|
+
const l = Number(n);
|
|
371
|
+
return Number.isFinite(l) ? l : null;
|
|
384
372
|
}
|
|
385
|
-
function F(
|
|
386
|
-
return e != null && e >= 0 ?
|
|
373
|
+
function F(r, e) {
|
|
374
|
+
return e != null && e >= 0 ? r.toFixed(e) : String(r);
|
|
387
375
|
}
|
|
388
376
|
class L extends I {
|
|
389
377
|
constructor() {
|
|
@@ -461,12 +449,10 @@ class L extends I {
|
|
|
461
449
|
super.focus(e);
|
|
462
450
|
}
|
|
463
451
|
blur() {
|
|
464
|
-
|
|
465
|
-
(e = this._input) == null || e.blur();
|
|
452
|
+
this._input?.blur();
|
|
466
453
|
}
|
|
467
454
|
select() {
|
|
468
|
-
|
|
469
|
-
(e = this._input) == null || e.select();
|
|
455
|
+
this._input?.select();
|
|
470
456
|
}
|
|
471
457
|
stepUp(e = 1) {
|
|
472
458
|
this._stepBy(Math.max(1, Number(e) || 1), "step");
|
|
@@ -479,22 +465,19 @@ class L extends I {
|
|
|
479
465
|
}
|
|
480
466
|
_precision() {
|
|
481
467
|
const e = this.getAttribute("precision");
|
|
482
|
-
if (e == null || e.trim() === "")
|
|
483
|
-
return null;
|
|
468
|
+
if (e == null || e.trim() === "") return null;
|
|
484
469
|
const t = Number(e);
|
|
485
470
|
return Number.isInteger(t) && t >= 0 ? t : null;
|
|
486
471
|
}
|
|
487
472
|
_step() {
|
|
488
473
|
const e = this.getAttribute("step");
|
|
489
|
-
if (e == null || e === "" || e === "any")
|
|
490
|
-
return null;
|
|
474
|
+
if (e == null || e === "" || e === "any") return null;
|
|
491
475
|
const t = Number(e);
|
|
492
476
|
return Number.isFinite(t) && t > 0 ? t : null;
|
|
493
477
|
}
|
|
494
478
|
_effectivePrecision() {
|
|
495
479
|
const e = this._precision();
|
|
496
|
-
if (e != null)
|
|
497
|
-
return e;
|
|
480
|
+
if (e != null) return e;
|
|
498
481
|
const t = this._step();
|
|
499
482
|
return t != null ? z(t) : null;
|
|
500
483
|
}
|
|
@@ -513,51 +496,47 @@ class L extends I {
|
|
|
513
496
|
}).format(e);
|
|
514
497
|
}
|
|
515
498
|
_displayStringForValue() {
|
|
516
|
-
if (this._isEditing)
|
|
517
|
-
return this._rawValue;
|
|
499
|
+
if (this._isEditing) return this._rawValue;
|
|
518
500
|
const e = this.valueAsNumber;
|
|
519
501
|
return e == null ? this._rawValue : this._formatNumber(e);
|
|
520
502
|
}
|
|
521
503
|
_syncDisplayValue() {
|
|
522
|
-
if (!this._input)
|
|
523
|
-
return;
|
|
504
|
+
if (!this._input) return;
|
|
524
505
|
const e = this._displayStringForValue();
|
|
525
506
|
this._input.value !== e && (this._input.value = e);
|
|
526
507
|
const t = this.root.querySelector(".shell");
|
|
527
508
|
t && t.setAttribute("data-has-value", e ? "true" : "false");
|
|
528
509
|
}
|
|
529
510
|
_syncControlAttrs() {
|
|
530
|
-
if (!this._input)
|
|
531
|
-
return;
|
|
511
|
+
if (!this._input) return;
|
|
532
512
|
this._input.placeholder = this.getAttribute("placeholder") || "", this._input.disabled = p(this, "disabled"), this._input.readOnly = this.hasAttribute("readonly"), this._input.required = this.hasAttribute("required"), this._input.name = this.getAttribute("name") || "", this._input.setAttribute("inputmode", this.getAttribute("inputmode") || "decimal");
|
|
533
513
|
const e = this.getAttribute("autocomplete");
|
|
534
514
|
e ? this._input.setAttribute("autocomplete", e) : this._input.removeAttribute("autocomplete");
|
|
535
515
|
}
|
|
536
516
|
_syncAria() {
|
|
537
|
-
if (!this._input)
|
|
538
|
-
return;
|
|
517
|
+
if (!this._input) return;
|
|
539
518
|
const e = this.valueAsNumber;
|
|
540
519
|
this._input.setAttribute("role", "spinbutton"), this._input.setAttribute("aria-valuetext", this._input.value || "");
|
|
541
520
|
const t = this._min(), i = this._max();
|
|
542
521
|
t != null ? this._input.setAttribute("aria-valuemin", String(t)) : this._input.removeAttribute("aria-valuemin"), i != null ? this._input.setAttribute("aria-valuemax", String(i)) : this._input.removeAttribute("aria-valuemax"), e != null ? this._input.setAttribute("aria-valuenow", String(e)) : this._input.removeAttribute("aria-valuenow");
|
|
543
|
-
const
|
|
544
|
-
|
|
522
|
+
const s = this.root.querySelector('slot[name="label"]'), n = this.root.querySelector('slot[name="description"]'), l = this.root.querySelector('slot[name="error"]'), u = !!(this.getAttribute("label") || "").trim() || d(s), a = !!(this.getAttribute("description") || "").trim() || d(n), o = !!(this.getAttribute("data-error") || "").trim() || d(l);
|
|
523
|
+
u ? this._input.setAttribute("aria-labelledby", `${this._uid}-label`) : this._input.removeAttribute("aria-labelledby");
|
|
545
524
|
const c = [];
|
|
546
|
-
|
|
525
|
+
a && c.push(`${this._uid}-description`), o && c.push(`${this._uid}-error`), c.length ? this._input.setAttribute("aria-describedby", c.join(" ")) : this._input.removeAttribute("aria-describedby"), this.hasAttribute("required") ? this._input.setAttribute("aria-required", "true") : this._input.removeAttribute("aria-required"), this.hasAttribute("invalid") || this._internalInvalidReason != null || o ? this._input.setAttribute("aria-invalid", "true") : this._input.removeAttribute("aria-invalid");
|
|
547
526
|
}
|
|
548
527
|
_syncDerivedState() {
|
|
549
|
-
const e = this.root.querySelector('slot[name="label"]'), t = this.root.querySelector('slot[name="description"]'), i = this.root.querySelector('slot[name="error"]'),
|
|
528
|
+
const e = this.root.querySelector('slot[name="label"]'), t = this.root.querySelector('slot[name="description"]'), i = this.root.querySelector('slot[name="error"]'), s = this.root.querySelector('slot[name="prefix"]'), n = this.root.querySelector('slot[name="suffix"]'), l = this.root.querySelector('slot[name="increment-trigger"]'), u = this.root.querySelector('slot[name="decrement-trigger"]'), a = !!(this.getAttribute("label") || "").trim() || d(e), o = !!(this.getAttribute("description") || "").trim() || d(t), c = !!(this.getAttribute("data-error") || "").trim() || d(i), v = d(s), w = d(n), S = d(l), V = d(u), y = p(this, "show-steppers") || S || V, h = (k, E) => {
|
|
550
529
|
const b = this.root.querySelector(k);
|
|
551
530
|
b && (E ? b.removeAttribute("hidden") : b.setAttribute("hidden", ""));
|
|
552
531
|
};
|
|
553
|
-
h(".meta",
|
|
532
|
+
h(".meta", a || o), h(".label", a), h(".description", o), h(".prefix", v), h(".suffix", w), h(".footer", c), h(".error", c), h(".steppers", y);
|
|
554
533
|
const x = this.root.querySelector(".shell");
|
|
555
534
|
x && x.setAttribute("data-show-steppers", y ? "true" : "false");
|
|
556
535
|
}
|
|
557
|
-
_emitValueEvent(e, t, i,
|
|
536
|
+
_emitValueEvent(e, t, i, s) {
|
|
558
537
|
this.dispatchEvent(
|
|
559
538
|
new CustomEvent(e, {
|
|
560
|
-
detail: { value: t, previousValue: i, source:
|
|
539
|
+
detail: { value: t, previousValue: i, source: s },
|
|
561
540
|
bubbles: !0,
|
|
562
541
|
composed: !0
|
|
563
542
|
})
|
|
@@ -585,12 +564,12 @@ class L extends I {
|
|
|
585
564
|
this._emitValueEvent("before-value-change", null, i, t), this.removeAttribute("value"), this._rawValue = "", this._clearInternalInvalid(), this._syncDisplayValue(), this._syncAria(), this._emitValueEvent("value-change", null, i, t);
|
|
586
565
|
return;
|
|
587
566
|
}
|
|
588
|
-
const
|
|
589
|
-
if (i != null &&
|
|
567
|
+
const s = this._effectivePrecision(), n = F(m(e, s), s), l = Number(n);
|
|
568
|
+
if (i != null && l === i && this.value === n) {
|
|
590
569
|
this._rawValue = n, this._clearInternalInvalid(), this._syncDisplayValue();
|
|
591
570
|
return;
|
|
592
571
|
}
|
|
593
|
-
this._emitValueEvent("before-value-change",
|
|
572
|
+
this._emitValueEvent("before-value-change", l, i, t), this.setAttribute("value", n), this._rawValue = n, this._clearInternalInvalid(), this._syncDisplayValue(), this._syncAria(), this._emitValueEvent("value-change", l, i, t);
|
|
594
573
|
}
|
|
595
574
|
_commitRaw(e) {
|
|
596
575
|
const t = this._rawValue.trim();
|
|
@@ -603,42 +582,40 @@ class L extends I {
|
|
|
603
582
|
this._emitInvalid("parse"), this._syncDisplayValue();
|
|
604
583
|
return;
|
|
605
584
|
}
|
|
606
|
-
const
|
|
607
|
-
if (!
|
|
585
|
+
const s = this._min(), n = this._max(), l = this._effectivePrecision(), u = m(i, l), a = p(this, "clamp-on-blur"), o = a ? A(u, s, n) : u;
|
|
586
|
+
if (!a && s != null && o < s) {
|
|
608
587
|
this._emitInvalid("min"), this._syncDisplayValue();
|
|
609
588
|
return;
|
|
610
589
|
}
|
|
611
|
-
if (!
|
|
590
|
+
if (!a && n != null && o > n) {
|
|
612
591
|
this._emitInvalid("max"), this._syncDisplayValue();
|
|
613
592
|
return;
|
|
614
593
|
}
|
|
615
594
|
const c = this._step();
|
|
616
|
-
if (!B(o, c, N(
|
|
595
|
+
if (!B(o, c, N(s), l)) {
|
|
617
596
|
this._emitInvalid("step"), this._syncDisplayValue();
|
|
618
597
|
return;
|
|
619
598
|
}
|
|
620
599
|
this._commitValue(o, e);
|
|
621
600
|
}
|
|
622
601
|
_stepBy(e, t) {
|
|
623
|
-
if (p(this, "disabled") || this.hasAttribute("readonly"))
|
|
624
|
-
|
|
625
|
-
const i = this._step() ?? 1, r = this._effectivePrecision(), n = this._min(), a = this._max(), u = (this._isEditing ? _(this._rawValue, this._locale()) : this.valueAsNumber) ?? n ?? 0, o = A(m(u + i * e, r), n, a);
|
|
602
|
+
if (p(this, "disabled") || this.hasAttribute("readonly")) return;
|
|
603
|
+
const i = this._step() ?? 1, s = this._effectivePrecision(), n = this._min(), l = this._max(), a = (this._isEditing ? _(this._rawValue, this._locale()) : this.valueAsNumber) ?? n ?? 0, o = A(m(a + i * e, s), n, l);
|
|
626
604
|
this._commitValue(o, t), this._isEditing && this._input && (this._input.value = this._rawValue);
|
|
627
605
|
}
|
|
628
606
|
_registerWithForm() {
|
|
629
|
-
var e;
|
|
630
607
|
this._formUnregister && (this._formUnregister(), this._formUnregister = null);
|
|
631
608
|
try {
|
|
632
|
-
const
|
|
633
|
-
|
|
634
|
-
name:
|
|
609
|
+
const s = this.getRootNode().host?.closest?.("ui-form") || null || this.closest("ui-form"), n = this.getAttribute("name");
|
|
610
|
+
s && typeof s.registerField == "function" && n && (this._formUnregister = s.registerField(n, {
|
|
611
|
+
name: n,
|
|
635
612
|
getValue: () => this.value,
|
|
636
613
|
setValue: (l) => {
|
|
637
614
|
l == null || l === "" ? this.removeAttribute("value") : this.setAttribute("value", String(l));
|
|
638
615
|
},
|
|
639
616
|
validate: async () => {
|
|
640
|
-
const l = this.valueAsNumber, u = this._min(),
|
|
641
|
-
return this.hasAttribute("required") && l == null ? { valid: !1, message: "A value is required." } : l != null && u != null && l < u ? { valid: !1, message: `Value must be at least ${u}.` } : l != null &&
|
|
617
|
+
const l = this.valueAsNumber, u = this._min(), a = this._max();
|
|
618
|
+
return this.hasAttribute("required") && l == null ? { valid: !1, message: "A value is required." } : l != null && u != null && l < u ? { valid: !1, message: `Value must be at least ${u}.` } : l != null && a != null && l > a ? { valid: !1, message: `Value must be at most ${a}.` } : { valid: this._internalInvalidReason == null, message: void 0 };
|
|
642
619
|
},
|
|
643
620
|
setError: (l) => {
|
|
644
621
|
l ? (this.setAttribute("data-error", l), this.toggleAttribute("invalid", !0)) : (this.removeAttribute("data-error"), this._internalInvalidReason == null && this.removeAttribute("invalid")), this._syncDerivedState(), this._syncAria();
|
|
@@ -689,15 +666,13 @@ class L extends I {
|
|
|
689
666
|
}
|
|
690
667
|
if (e.key === "Home") {
|
|
691
668
|
const t = this._min();
|
|
692
|
-
if (t == null)
|
|
693
|
-
return;
|
|
669
|
+
if (t == null) return;
|
|
694
670
|
e.preventDefault(), this._commitValue(t, "keyboard");
|
|
695
671
|
return;
|
|
696
672
|
}
|
|
697
673
|
if (e.key === "End") {
|
|
698
674
|
const t = this._max();
|
|
699
|
-
if (t == null)
|
|
700
|
-
return;
|
|
675
|
+
if (t == null) return;
|
|
701
676
|
e.preventDefault(), this._commitValue(t, "keyboard");
|
|
702
677
|
return;
|
|
703
678
|
}
|
|
@@ -711,7 +686,7 @@ class L extends I {
|
|
|
711
686
|
p(this, "allow-wheel") && (!this._input || this.root.activeElement !== this._input || (e.preventDefault(), this._stepBy(e.deltaY < 0 ? 1 : -1, "wheel")));
|
|
712
687
|
}
|
|
713
688
|
_onClick(e) {
|
|
714
|
-
const i = e.composedPath().find((
|
|
689
|
+
const i = e.composedPath().find((s) => s instanceof HTMLElement ? s.dataset.stepAction === "up" || s.dataset.stepAction === "down" || s.getAttribute("slot") === "increment-trigger" || s.getAttribute("slot") === "decrement-trigger" : !1);
|
|
715
690
|
if (i) {
|
|
716
691
|
if (i.dataset.stepAction === "up" || i.getAttribute("slot") === "increment-trigger") {
|
|
717
692
|
e.preventDefault(), this._stepBy(1, "step");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("./ElementBase-EV6mVBUV.js"),y=1200,v=0,O="ease-out",L="decimal",A=0,S=.4,F=6,N=new Set(["linear","ease-in","ease-out","ease-in-out","spring","bounce","overshoot"]),$=new Set(["decimal","currency"]),R=new Set(["symbol","narrowSymbol","code","name"]),G=new Set(["standard","compact"]),U=new Set(["short","long"]),H=new Set(["auto","always","exceptZero","never"]),Q=new Set(["interpolate","odometer"]),q=new Set(["immediate","visible"]),B=new Set(["start","end","center"]),a={sm:{fontSize:"14px",letterSpacing:"-0.02em",lineHeight:"1"},md:{fontSize:"22px",letterSpacing:"-0.04em",lineHeight:"0.98"},lg:{fontSize:"36px",letterSpacing:"-0.05em",lineHeight:"0.94"},xl:{fontSize:"56px",letterSpacing:"-0.06em",lineHeight:"0.9"}},Y=["0","1","2","3","4","5","6","7","8","9"],j=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-number-ticker-color: var(--ui-color-text, var(--ui-text, #0f172a));
|
|
4
4
|
--ui-number-ticker-accent: var(--ui-color-primary, var(--ui-primary, #2563eb));
|
|
@@ -201,9 +201,9 @@
|
|
|
201
201
|
text-shadow: none;
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
`;class M extends I.ElementBase{constructor(){super(),this._valueEl=null,this._frame=null,this._currentValue=0,this._animationFrom=0,this._animationTo=0,this._animationDuration=y,this._animationDelay=
|
|
204
|
+
`;class M extends I.ElementBase{constructor(){super(),this._valueEl=null,this._frame=null,this._currentValue=0,this._animationFrom=0,this._animationTo=0,this._animationDuration=y,this._animationDelay=v,this._animationStartTime=0,this._pausedElapsed=0,this._animationPrepared=!1,this._initialized=!1,this._hovering=!1,this._focusWithin=!1,this._formatter=new Intl.NumberFormat,this._mediaQuery=null,this._customFormatter=null,this._intersectionObserver=null,this._observerThreshold=S,this._isVisible=!0,this._visibilityGatePending=!1,this._tick=this._tick.bind(this),this._onPointerEnter=this._onPointerEnter.bind(this),this._onPointerLeave=this._onPointerLeave.bind(this),this._onFocusIn=this._onFocusIn.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onReducedMotionChange=this._onReducedMotionChange.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this)}static get observedAttributes(){return["value","from","duration","delay","easing","animation","locale","format-style","currency","currency-display","notation","compact-display","fraction-digits","use-grouping","sign-display","prefix","suffix","size","tone","align","font-size","font-weight","letter-spacing","color","tabular","monospace","paused","pause-on-hover","pause-on-focus","trigger","visibility-threshold","stagger","stagger-from"]}get formatter(){return this._customFormatter}set formatter(t){this._customFormatter=typeof t=="function"?t:null,this._valueEl&&this._renderValue(this._currentValue)}shouldRenderOnAttributeChange(){return!1}connectedCallback(){this._bindReducedMotion(),super.connectedCallback(),this.hasAttribute("aria-live")||this.setAttribute("aria-live","off"),this.addEventListener("pointerenter",this._onPointerEnter),this.addEventListener("pointerleave",this._onPointerLeave),this.addEventListener("focusin",this._onFocusIn),this.addEventListener("focusout",this._onFocusOut),this._syncVisibilityObserver(),this._syncFromAttributes(!1)}disconnectedCallback(){if(this.removeEventListener("pointerenter",this._onPointerEnter),this.removeEventListener("pointerleave",this._onPointerLeave),this.removeEventListener("focusin",this._onFocusIn),this.removeEventListener("focusout",this._onFocusOut),this._mediaQuery){try{this._mediaQuery.removeEventListener("change",this._onReducedMotionChange)}catch{this._mediaQuery.removeListener(this._onReducedMotionChange)}this._mediaQuery=null}this._disconnectVisibilityObserver(),this._stopAnimation(),super.disconnectedCallback()}play(){this.removeAttribute("paused"),this._syncFromAttributes(!1)}pause(){this.setAttribute("paused",""),this._syncFromAttributes(!1)}refresh(){m(this.getAttribute("trigger"))==="visible"&&(this._visibilityGatePending=!0),this._syncFromAttributes(!0)}finish(){const t=this._resolvedTargetValue();this._stopAnimation(),this._animationPrepared=!1,this._visibilityGatePending=!1,this._currentValue=t,this._renderValue(t),this._setDirection(this._resolvedBaseValue(),t),this._setState("completed")}attributeChangedCallback(t,i,n){super.attributeChangedCallback(t,i,n),!(!t||i===n||!this.isConnected||!this._valueEl)&&((t==="trigger"||t==="visibility-threshold")&&(t==="trigger"&&m(n??null)==="visible"&&!this._initialized&&(this._visibilityGatePending=!0),this._syncVisibilityObserver()),this._syncFromAttributes(t==="from"))}render(){this.setContent(`
|
|
205
205
|
<style>${j}</style>
|
|
206
206
|
<span class="ticker" part="root">
|
|
207
207
|
<span class="value" part="value"></span>
|
|
208
208
|
</span>
|
|
209
|
-
`),this._valueEl=this.root.querySelector(".value"),this._syncFromAttributes(!this._initialized)}_syncFromAttributes(t){if(!this._valueEl)return;this._syncStyleOverrides(),this._syncVisibilityObserver(),this._formatter=this._createFormatter(),this._syncMotionPresentation();const i=this._resolvedTargetValue(),n=this._resolvedBaseValue();!this._initialized||t?(this._currentValue=n,this._renderValue(n),m(this.getAttribute("trigger"))==="visible"&&(this._visibilityGatePending=!0)):this._renderValue(this._currentValue),this._setDirection(t?n:this._currentValue,i),this._syncPlayback(i,n,t),this._initialized=!0}_syncPlayback(t,i,n){const r=this._prefersReducedMotion(),s=this._effectivePaused();if(this._visibilityGatePending){if(!this._isVisible){this._stopAnimation(),this._animationPrepared=!1,this._currentValue=i,this._renderValue(i),this._setState(s?"paused":"waiting");return}this._visibilityGatePending=!1}if(r){this._stopAnimation(),this._animationPrepared=!1,this._currentValue=t,this._renderValue(t),this._setState(s?"paused":"completed");return}if(s){(n||!this._animationPrepared)&&!o(i,t)&&this._prepareAnimation(i,t),this._pauseAnimation(),this._setState("paused");return}if(o(this._currentValue,t)){this._stopAnimation(),this._animationPrepared=!1,this._currentValue=t,this._renderValue(t),this._setState("completed");return}if(n||!this._animationPrepared||!o(t,this._animationTo)){const d=n?i:this._currentValue;this._prepareAnimation(d,t)}this._resumeAnimation()}_prepareAnimation(t,i){if(this._stopAnimation(),this._animationFrom=t,this._animationTo=i,this._animationDuration=Math.max(0,p(this.getAttribute("duration"),y)),this._animationDelay=Math.max(0,p(this.getAttribute("delay"),A)),this._animationStartTime=0,this._pausedElapsed=0,this._animationPrepared=!o(t,i),this._setDirection(t,i),this._syncMotionPresentation(),!this._animationPrepared||this._animationDuration===0){this._currentValue=i,this._renderValue(i),this._setState("completed");return}this._renderValue(t)}_resumeAnimation(){!this._animationPrepared||this._frame!=null||!this.isConnected||(this._setState("running"),this._frame=this._requestFrame(this._tick))}_pauseAnimation(){this._frame!=null&&(this._cancelFrame(this._frame),this._frame=null),this._animationPrepared&&this._animationStartTime>0&&(this._pausedElapsed=performance.now()-this._animationStartTime)}_stopAnimation(){this._frame!=null&&(this._cancelFrame(this._frame),this._frame=null),this._animationStartTime=0,this._pausedElapsed=0}_tick(t){if(this._frame=null,this._effectivePaused()){this._pauseAnimation(),this._setState("paused");return}if(!this._animationPrepared){this._setState("completed");return}this._animationStartTime===0&&(this._animationStartTime=t-this._pausedElapsed);const i=Math.max(0,t-this._animationStartTime);if(i<this._animationDelay){this._renderValue(this._animationFrom),this._setState("running"),this._frame=this._requestFrame(this._tick);return}const n=c((i-this._animationDelay)/Math.max(this._animationDuration,1),0,1),r=nt(x(this.getAttribute("easing")),n),s=this._animationFrom+(this._animationTo-this._animationFrom)*r;if(this._currentValue=s,this._renderValue(s),n>=1){this._animationPrepared=!1,this._animationStartTime=0,this._pausedElapsed=0,this._currentValue=this._animationTo,this._renderValue(this._animationTo),this._setState("completed");return}this._setState("running"),this._frame=this._requestFrame(this._tick)}_renderValue(t){if(!this._valueEl)return;const i=this._formatValue(t),n=W(this.getAttribute("animation"));this.setAttribute("data-animation",n),this._valueEl.setAttribute("data-mode",n),n==="odometer"?this._renderOdometer(i):this._valueEl.textContent=i,this.setAttribute("data-value",t.toFixed(6)),this.setAttribute("data-rendered",i),this.hasAttribute("aria-label")||this.setAttribute("aria-label",i)}_renderOdometer(t){if(!this._valueEl)return;const i=document.createDocumentFragment(),n=Array.from(t).filter(V).length;let r=0;const s=Math.max(0,p(this.getAttribute("stagger"),0)),d=Z(this.getAttribute("stagger-from"));for(const f of Array.from(t)){if(V(f)){const u=document.createElement("span");u.className="char digit",u.setAttribute("part","digit"),u.style.setProperty("--ui-number-ticker-digit-delay",`${ot(r,n,s,d)}ms`);const _=document.createElement("span");_.className="digit-window";const h=document.createElement("span");h.className="digit-track",h.style.setProperty("--ui-number-ticker-digit-value",String(Number(f)));for(const C of Y){const g=document.createElement("span");g.textContent=C,h.appendChild(g)}_.appendChild(h),u.appendChild(_),i.appendChild(u),r+=1;continue}const l=document.createElement("span");l.className="char symbol",l.setAttribute("part","symbol"),l.textContent=f,i.appendChild(l)}this._valueEl.replaceChildren(i)}_formatValue(t){const i=this.getAttribute("prefix")||"",n=this.getAttribute("suffix")||"",r=this._formatter.format(t),s=`${i}${r}${n}`;if(this._customFormatter)try{return String(this._customFormatter(t,{formatted:s,intl:r,value:t,prefix:i,suffix:n,locale:this.getAttribute("locale")||void 0,formatStyle:k(this.getAttribute("format-style")),currency:this.getAttribute("currency")||void 0,notation:w(this.getAttribute("notation")),signDisplay:z(this.getAttribute("sign-display")),fractionDigits:D(this.getAttribute("fraction-digits"),this.getAttribute("value"),this.getAttribute("from"))}))}catch{return s}return s}_createFormatter(){const t=k(this.getAttribute("format-style")),i=this.getAttribute("locale")||void 0,n=D(this.getAttribute("fraction-digits"),this.getAttribute("value"),this.getAttribute("from")),r={style:t,useGrouping:et(this.getAttribute("use-grouping"),!0),signDisplay:z(this.getAttribute("sign-display")),notation:w(this.getAttribute("notation"))};n!=null?(r.minimumFractionDigits=n,r.maximumFractionDigits=n):t==="decimal"&&(r.minimumFractionDigits=v,r.maximumFractionDigits=v),r.notation==="compact"&&(r.compactDisplay=X(this.getAttribute("compact-display"))),t==="currency"&&(r.currency=J(this.getAttribute("currency")),r.currencyDisplay=K(this.getAttribute("currency-display")));try{return new Intl.NumberFormat(i,r)}catch{const s={style:t==="currency"&&r.currency?"currency":"decimal",useGrouping:r.useGrouping,signDisplay:r.signDisplay,notation:r.notation,minimumFractionDigits:r.minimumFractionDigits,maximumFractionDigits:r.maximumFractionDigits};return s.notation==="compact"&&(s.compactDisplay=r.compactDisplay),s.style==="currency"&&r.currency&&(s.currency=r.currency,s.currencyDisplay=r.currencyDisplay),new Intl.NumberFormat(void 0,s)}}_syncStyleOverrides(){E(this.style,"--ui-number-ticker-font-size",this.getAttribute("font-size")),T(this.style,"--ui-number-ticker-font-weight",this.getAttribute("font-weight")),E(this.style,"--ui-number-ticker-letter-spacing",this.getAttribute("letter-spacing")),T(this.style,"--ui-number-ticker-color",this.getAttribute("color"))}_syncMotionPresentation(){this.style.setProperty("--ui-number-ticker-roll-duration",`${Math.round(c(this._animationDuration*.55,180,900))}ms`),this.style.setProperty("--ui-number-ticker-roll-ease",at(x(this.getAttribute("easing"))))}_resolvedTargetValue(){return b(this.getAttribute("value"),0)}_resolvedBaseValue(){return b(this.getAttribute("from"),0)}_effectivePaused(){return!!(this.hasAttribute("paused")||this.hasAttribute("pause-on-hover")&&this._hovering||this.hasAttribute("pause-on-focus")&&this._focusWithin)}_setState(t){this.setAttribute("data-state",t)}_setDirection(t,i){const n=o(t,i)?"flat":i>t?"up":"down";this.setAttribute("data-direction",n)}_onPointerEnter(){this._hovering=!0,this.hasAttribute("pause-on-hover")&&this._syncFromAttributes(!1)}_onPointerLeave(){this._hovering=!1,this.hasAttribute("pause-on-hover")&&this._syncFromAttributes(!1)}_onFocusIn(){this._focusWithin=!0,this.hasAttribute("pause-on-focus")&&this._syncFromAttributes(!1)}_onFocusOut(t){const i=t.relatedTarget;this._focusWithin=!!(i&&this.contains(i)),this.hasAttribute("pause-on-focus")&&this._syncFromAttributes(!1)}_bindReducedMotion(){if(!(this._mediaQuery||typeof window>"u"||typeof window.matchMedia!="function")){this._mediaQuery=window.matchMedia("(prefers-reduced-motion: reduce)");try{this._mediaQuery.addEventListener("change",this._onReducedMotionChange)}catch{this._mediaQuery.addListener(this._onReducedMotionChange)}}}_onReducedMotionChange(){this._syncFromAttributes(!1)}_syncVisibilityObserver(){const t=m(this.getAttribute("trigger")),i=c(b(this.getAttribute("visibility-threshold"),S),0,1);if(t!=="visible"||typeof IntersectionObserver!="function"){this._disconnectVisibilityObserver(),this._isVisible=!0,this._observerThreshold=i;return}this._intersectionObserver&&o(this._observerThreshold,i)||(this._disconnectVisibilityObserver(),this._observerThreshold=i,this._isVisible=!1,this._intersectionObserver=new IntersectionObserver(this._onVisibilityChange,{threshold:ut(i)}),this._intersectionObserver.observe(this))}_disconnectVisibilityObserver(){this._intersectionObserver&&(this._intersectionObserver.disconnect(),this._intersectionObserver=null)}_onVisibilityChange(t){const i=t[t.length-1];if(!i)return;const n=i.isIntersecting&&i.intersectionRatio>=this._observerThreshold,r=n&&!this._isVisible;this._isVisible=n,r&&this._visibilityGatePending&&this._syncFromAttributes(!1)}_prefersReducedMotion(){var t;return!!((t=this._mediaQuery)!=null&&t.matches)}_requestFrame(t){return typeof requestAnimationFrame=="function"?requestAnimationFrame(t):window.setTimeout(()=>t(performance.now()),16)}_cancelFrame(t){if(typeof cancelAnimationFrame=="function"){cancelAnimationFrame(t);return}window.clearTimeout(t)}}function k(e){return e!=null&&$.has(e)?e:L}function W(e){return e!=null&&Q.has(e)?e:"interpolate"}function m(e){return e!=null&&q.has(e)?e:"immediate"}function Z(e){return e!=null&&B.has(e)?e:"start"}function x(e){return e!=null&&N.has(e)?e:O}function K(e){return e!=null&&R.has(e)?e:"symbol"}function w(e){return e!=null&&G.has(e)?e:"standard"}function X(e){return e!=null&&U.has(e)?e:"short"}function z(e){return e!=null&&H.has(e)?e:"auto"}function J(e){const t=e==null?void 0:e.trim().toUpperCase();return t&&/^[A-Z]{3}$/.test(t)?t:"USD"}function b(e,t){if(e==null||e.trim()==="")return t;const i=Number.parseFloat(e);return Number.isFinite(i)?i:t}function p(e,t){if(e==null||e.trim()==="")return t;const i=e.trim().toLowerCase();return/^-?\d+(\.\d+)?$/.test(i)||/^-?\d+(\.\d+)?ms$/.test(i)?Number.parseFloat(i):/^-?\d+(\.\d+)?s$/.test(i)?Number.parseFloat(i)*1e3:t}function tt(e,t){if(e==null||e.trim()==="")return t;const i=Number.parseInt(e,10);return Number.isFinite(i)?i:t}function et(e,t){if(e==null)return t;const i=e.trim().toLowerCase();return i?i==="false"||i==="0"||i==="off"||i==="no"?!1:i==="true"||i==="1"||i==="on"||i==="yes"?!0:t:!0}function it(e){if(e==null||e.trim()==="")return null;const t=e.trim().split(/\s+/).filter(Boolean);return t.length?t.map(i=>/^-?\d+(\.\d+)?$/.test(i)?`${i}px`:i).join(" "):null}function E(e,t,i){const n=it(i);if(n==null){e.removeProperty(t);return}e.setProperty(t,n)}function T(e,t,i){const n=i==null?void 0:i.trim();if(!n){e.removeProperty(t);return}e.setProperty(t,n)}function P(e){var n;if(e==null)return 0;const t=e.trim();if(!t)return 0;const i=t.match(/^-?\d+(?:\.(\d+))?$/);return((n=i==null?void 0:i[1])==null?void 0:n.length)||0}function D(e,t,i){const n=c(tt(e,-1),-1,F);if(n>=0)return n;const r=c(Math.max(P(t),P(i)),0,F);return r>0?r:null}function nt(e,t){switch(e){case"linear":return t;case"ease-in":return t*t*t;case"ease-in-out":return t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;case"spring":return 1-Math.cos(t*Math.PI*4.5)*Math.exp(-t*6);case"bounce":return rt(t);case"overshoot":return st(t);case"ease-out":default:return 1-Math.pow(1-t,3)}}function rt(e){if(e<1/2.75)return 7.5625*e*e;if(e<2/2.75){const r=e-.5454545454545454;return 7.5625*r*r+.75}if(e<2.5/2.75){const r=e-.8181818181818182;return 7.5625*r*r+.9375}const n=e-2.625/2.75;return 7.5625*n*n+.984375}function st(e){return 1+2.70158*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2)}function at(e){switch(e){case"linear":return"linear";case"ease-in":return"cubic-bezier(0.55, 0.085, 0.68, 0.53)";case"ease-in-out":return"cubic-bezier(0.65, 0, 0.35, 1)";case"spring":return"cubic-bezier(0.34, 1.56, 0.64, 1)";case"bounce":return"cubic-bezier(0.35, 1.4, 0.35, 1)";case"overshoot":return"cubic-bezier(0.2, 1.24, 0.3, 1)";case"ease-out":default:return"cubic-bezier(0.22, 1, 0.36, 1)"}}function ot(e,t,i,n){if(i<=0||t<=1)return 0;switch(n){case"end":return(t-e-1)*i;case"center":{const r=(t-1)/2;return Math.abs(e-r)*i}case"start":default:return e*i}}function ut(e){return e<=0?[0]:[0,e,1]}function V(e){return/^[0-9]$/.test(e)}function c(e,t,i){return Math.min(i,Math.max(t,e))}function o(e,t){return Math.abs(e-t)<1e-5}typeof customElements<"u"&&!customElements.get("ui-number-ticker")&&customElements.define("ui-number-ticker",M);exports.UINumberTicker=M;
|
|
209
|
+
`),this._valueEl=this.root.querySelector(".value"),this._syncFromAttributes(!this._initialized)}_syncFromAttributes(t){if(!this._valueEl)return;this._syncStyleOverrides(),this._syncVisibilityObserver(),this._formatter=this._createFormatter(),this._syncMotionPresentation();const i=this._resolvedTargetValue(),n=this._resolvedBaseValue();!this._initialized||t?(this._currentValue=n,this._renderValue(n),m(this.getAttribute("trigger"))==="visible"&&(this._visibilityGatePending=!0)):this._renderValue(this._currentValue),this._setDirection(t?n:this._currentValue,i),this._syncPlayback(i,n,t),this._initialized=!0}_syncPlayback(t,i,n){const r=this._prefersReducedMotion(),s=this._effectivePaused();if(this._visibilityGatePending){if(!this._isVisible){this._stopAnimation(),this._animationPrepared=!1,this._currentValue=i,this._renderValue(i),this._setState(s?"paused":"waiting");return}this._visibilityGatePending=!1}if(r){this._stopAnimation(),this._animationPrepared=!1,this._currentValue=t,this._renderValue(t),this._setState(s?"paused":"completed");return}if(s){(n||!this._animationPrepared)&&!o(i,t)&&this._prepareAnimation(i,t),this._pauseAnimation(),this._setState("paused");return}if(o(this._currentValue,t)){this._stopAnimation(),this._animationPrepared=!1,this._currentValue=t,this._renderValue(t),this._setState("completed");return}if(n||!this._animationPrepared||!o(t,this._animationTo)){const d=n?i:this._currentValue;this._prepareAnimation(d,t)}this._resumeAnimation()}_prepareAnimation(t,i){if(this._stopAnimation(),this._animationFrom=t,this._animationTo=i,this._animationDuration=Math.max(0,p(this.getAttribute("duration"),y)),this._animationDelay=Math.max(0,p(this.getAttribute("delay"),v)),this._animationStartTime=0,this._pausedElapsed=0,this._animationPrepared=!o(t,i),this._setDirection(t,i),this._syncMotionPresentation(),!this._animationPrepared||this._animationDuration===0){this._currentValue=i,this._renderValue(i),this._setState("completed");return}this._renderValue(t)}_resumeAnimation(){!this._animationPrepared||this._frame!=null||!this.isConnected||(this._setState("running"),this._frame=this._requestFrame(this._tick))}_pauseAnimation(){this._frame!=null&&(this._cancelFrame(this._frame),this._frame=null),this._animationPrepared&&this._animationStartTime>0&&(this._pausedElapsed=performance.now()-this._animationStartTime)}_stopAnimation(){this._frame!=null&&(this._cancelFrame(this._frame),this._frame=null),this._animationStartTime=0,this._pausedElapsed=0}_tick(t){if(this._frame=null,this._effectivePaused()){this._pauseAnimation(),this._setState("paused");return}if(!this._animationPrepared){this._setState("completed");return}this._animationStartTime===0&&(this._animationStartTime=t-this._pausedElapsed);const i=Math.max(0,t-this._animationStartTime);if(i<this._animationDelay){this._renderValue(this._animationFrom),this._setState("running"),this._frame=this._requestFrame(this._tick);return}const n=c((i-this._animationDelay)/Math.max(this._animationDuration,1),0,1),r=nt(x(this.getAttribute("easing")),n),s=this._animationFrom+(this._animationTo-this._animationFrom)*r;if(this._currentValue=s,this._renderValue(s),n>=1){this._animationPrepared=!1,this._animationStartTime=0,this._pausedElapsed=0,this._currentValue=this._animationTo,this._renderValue(this._animationTo),this._setState("completed");return}this._setState("running"),this._frame=this._requestFrame(this._tick)}_renderValue(t){if(!this._valueEl)return;const i=this._formatValue(t),n=W(this.getAttribute("animation"));this.setAttribute("data-animation",n),this._valueEl.setAttribute("data-mode",n),n==="odometer"?this._renderOdometer(i):this._valueEl.textContent=i,this.setAttribute("data-value",t.toFixed(6)),this.setAttribute("data-rendered",i),this.hasAttribute("aria-label")||this.setAttribute("aria-label",i)}_renderOdometer(t){if(!this._valueEl)return;const i=document.createDocumentFragment(),n=Array.from(t).filter(V).length;let r=0;const s=Math.max(0,p(this.getAttribute("stagger"),0)),d=Z(this.getAttribute("stagger-from"));for(const f of Array.from(t)){if(V(f)){const u=document.createElement("span");u.className="char digit",u.setAttribute("part","digit"),u.style.setProperty("--ui-number-ticker-digit-delay",`${ot(r,n,s,d)}ms`);const _=document.createElement("span");_.className="digit-window";const h=document.createElement("span");h.className="digit-track",h.style.setProperty("--ui-number-ticker-digit-value",String(Number(f)));for(const C of Y){const g=document.createElement("span");g.textContent=C,h.appendChild(g)}_.appendChild(h),u.appendChild(_),i.appendChild(u),r+=1;continue}const l=document.createElement("span");l.className="char symbol",l.setAttribute("part","symbol"),l.textContent=f,i.appendChild(l)}this._valueEl.replaceChildren(i)}_formatValue(t){const i=this.getAttribute("prefix")||"",n=this.getAttribute("suffix")||"",r=this._formatter.format(t),s=`${i}${r}${n}`;if(this._customFormatter)try{return String(this._customFormatter(t,{formatted:s,intl:r,value:t,prefix:i,suffix:n,locale:this.getAttribute("locale")||void 0,formatStyle:k(this.getAttribute("format-style")),currency:this.getAttribute("currency")||void 0,notation:w(this.getAttribute("notation")),signDisplay:z(this.getAttribute("sign-display")),fractionDigits:D(this.getAttribute("fraction-digits"),this.getAttribute("value"),this.getAttribute("from"))}))}catch{return s}return s}_createFormatter(){const t=k(this.getAttribute("format-style")),i=this.getAttribute("locale")||void 0,n=D(this.getAttribute("fraction-digits"),this.getAttribute("value"),this.getAttribute("from")),r={style:t,useGrouping:et(this.getAttribute("use-grouping"),!0),signDisplay:z(this.getAttribute("sign-display")),notation:w(this.getAttribute("notation"))};n!=null?(r.minimumFractionDigits=n,r.maximumFractionDigits=n):t==="decimal"&&(r.minimumFractionDigits=A,r.maximumFractionDigits=A),r.notation==="compact"&&(r.compactDisplay=X(this.getAttribute("compact-display"))),t==="currency"&&(r.currency=J(this.getAttribute("currency")),r.currencyDisplay=K(this.getAttribute("currency-display")));try{return new Intl.NumberFormat(i,r)}catch{const s={style:t==="currency"&&r.currency?"currency":"decimal",useGrouping:r.useGrouping,signDisplay:r.signDisplay,notation:r.notation,minimumFractionDigits:r.minimumFractionDigits,maximumFractionDigits:r.maximumFractionDigits};return s.notation==="compact"&&(s.compactDisplay=r.compactDisplay),s.style==="currency"&&r.currency&&(s.currency=r.currency,s.currencyDisplay=r.currencyDisplay),new Intl.NumberFormat(void 0,s)}}_syncStyleOverrides(){E(this.style,"--ui-number-ticker-font-size",this.getAttribute("font-size")),T(this.style,"--ui-number-ticker-font-weight",this.getAttribute("font-weight")),E(this.style,"--ui-number-ticker-letter-spacing",this.getAttribute("letter-spacing")),T(this.style,"--ui-number-ticker-color",this.getAttribute("color"))}_syncMotionPresentation(){this.style.setProperty("--ui-number-ticker-roll-duration",`${Math.round(c(this._animationDuration*.55,180,900))}ms`),this.style.setProperty("--ui-number-ticker-roll-ease",at(x(this.getAttribute("easing"))))}_resolvedTargetValue(){return b(this.getAttribute("value"),0)}_resolvedBaseValue(){return b(this.getAttribute("from"),0)}_effectivePaused(){return!!(this.hasAttribute("paused")||this.hasAttribute("pause-on-hover")&&this._hovering||this.hasAttribute("pause-on-focus")&&this._focusWithin)}_setState(t){this.setAttribute("data-state",t)}_setDirection(t,i){const n=o(t,i)?"flat":i>t?"up":"down";this.setAttribute("data-direction",n)}_onPointerEnter(){this._hovering=!0,this.hasAttribute("pause-on-hover")&&this._syncFromAttributes(!1)}_onPointerLeave(){this._hovering=!1,this.hasAttribute("pause-on-hover")&&this._syncFromAttributes(!1)}_onFocusIn(){this._focusWithin=!0,this.hasAttribute("pause-on-focus")&&this._syncFromAttributes(!1)}_onFocusOut(t){const i=t.relatedTarget;this._focusWithin=!!(i&&this.contains(i)),this.hasAttribute("pause-on-focus")&&this._syncFromAttributes(!1)}_bindReducedMotion(){if(!(this._mediaQuery||typeof window>"u"||typeof window.matchMedia!="function")){this._mediaQuery=window.matchMedia("(prefers-reduced-motion: reduce)");try{this._mediaQuery.addEventListener("change",this._onReducedMotionChange)}catch{this._mediaQuery.addListener(this._onReducedMotionChange)}}}_onReducedMotionChange(){this._syncFromAttributes(!1)}_syncVisibilityObserver(){const t=m(this.getAttribute("trigger")),i=c(b(this.getAttribute("visibility-threshold"),S),0,1);if(t!=="visible"||typeof IntersectionObserver!="function"){this._disconnectVisibilityObserver(),this._isVisible=!0,this._observerThreshold=i;return}this._intersectionObserver&&o(this._observerThreshold,i)||(this._disconnectVisibilityObserver(),this._observerThreshold=i,this._isVisible=!1,this._intersectionObserver=new IntersectionObserver(this._onVisibilityChange,{threshold:ut(i)}),this._intersectionObserver.observe(this))}_disconnectVisibilityObserver(){this._intersectionObserver&&(this._intersectionObserver.disconnect(),this._intersectionObserver=null)}_onVisibilityChange(t){const i=t[t.length-1];if(!i)return;const n=i.isIntersecting&&i.intersectionRatio>=this._observerThreshold,r=n&&!this._isVisible;this._isVisible=n,r&&this._visibilityGatePending&&this._syncFromAttributes(!1)}_prefersReducedMotion(){return!!this._mediaQuery?.matches}_requestFrame(t){return typeof requestAnimationFrame=="function"?requestAnimationFrame(t):window.setTimeout(()=>t(performance.now()),16)}_cancelFrame(t){if(typeof cancelAnimationFrame=="function"){cancelAnimationFrame(t);return}window.clearTimeout(t)}}function k(e){return e!=null&&$.has(e)?e:L}function W(e){return e!=null&&Q.has(e)?e:"interpolate"}function m(e){return e!=null&&q.has(e)?e:"immediate"}function Z(e){return e!=null&&B.has(e)?e:"start"}function x(e){return e!=null&&N.has(e)?e:O}function K(e){return e!=null&&R.has(e)?e:"symbol"}function w(e){return e!=null&&G.has(e)?e:"standard"}function X(e){return e!=null&&U.has(e)?e:"short"}function z(e){return e!=null&&H.has(e)?e:"auto"}function J(e){const t=e?.trim().toUpperCase();return t&&/^[A-Z]{3}$/.test(t)?t:"USD"}function b(e,t){if(e==null||e.trim()==="")return t;const i=Number.parseFloat(e);return Number.isFinite(i)?i:t}function p(e,t){if(e==null||e.trim()==="")return t;const i=e.trim().toLowerCase();return/^-?\d+(\.\d+)?$/.test(i)||/^-?\d+(\.\d+)?ms$/.test(i)?Number.parseFloat(i):/^-?\d+(\.\d+)?s$/.test(i)?Number.parseFloat(i)*1e3:t}function tt(e,t){if(e==null||e.trim()==="")return t;const i=Number.parseInt(e,10);return Number.isFinite(i)?i:t}function et(e,t){if(e==null)return t;const i=e.trim().toLowerCase();return i?i==="false"||i==="0"||i==="off"||i==="no"?!1:i==="true"||i==="1"||i==="on"||i==="yes"?!0:t:!0}function it(e){if(e==null||e.trim()==="")return null;const t=e.trim().split(/\s+/).filter(Boolean);return t.length?t.map(i=>/^-?\d+(\.\d+)?$/.test(i)?`${i}px`:i).join(" "):null}function E(e,t,i){const n=it(i);if(n==null){e.removeProperty(t);return}e.setProperty(t,n)}function T(e,t,i){const n=i?.trim();if(!n){e.removeProperty(t);return}e.setProperty(t,n)}function P(e){if(e==null)return 0;const t=e.trim();return t&&t.match(/^-?\d+(?:\.(\d+))?$/)?.[1]?.length||0}function D(e,t,i){const n=c(tt(e,-1),-1,F);if(n>=0)return n;const r=c(Math.max(P(t),P(i)),0,F);return r>0?r:null}function nt(e,t){switch(e){case"linear":return t;case"ease-in":return t*t*t;case"ease-in-out":return t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;case"spring":return 1-Math.cos(t*Math.PI*4.5)*Math.exp(-t*6);case"bounce":return rt(t);case"overshoot":return st(t);default:return 1-Math.pow(1-t,3)}}function rt(e){if(e<1/2.75)return 7.5625*e*e;if(e<2/2.75){const r=e-.5454545454545454;return 7.5625*r*r+.75}if(e<2.5/2.75){const r=e-.8181818181818182;return 7.5625*r*r+.9375}const n=e-2.625/2.75;return 7.5625*n*n+.984375}function st(e){return 1+2.70158*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2)}function at(e){switch(e){case"linear":return"linear";case"ease-in":return"cubic-bezier(0.55, 0.085, 0.68, 0.53)";case"ease-in-out":return"cubic-bezier(0.65, 0, 0.35, 1)";case"spring":return"cubic-bezier(0.34, 1.56, 0.64, 1)";case"bounce":return"cubic-bezier(0.35, 1.4, 0.35, 1)";case"overshoot":return"cubic-bezier(0.2, 1.24, 0.3, 1)";default:return"cubic-bezier(0.22, 1, 0.36, 1)"}}function ot(e,t,i,n){if(i<=0||t<=1)return 0;switch(n){case"end":return(t-e-1)*i;case"center":{const r=(t-1)/2;return Math.abs(e-r)*i}default:return e*i}}function ut(e){return e<=0?[0]:[0,e,1]}function V(e){return/^[0-9]$/.test(e)}function c(e,t,i){return Math.min(i,Math.max(t,e))}function o(e,t){return Math.abs(e-t)<1e-5}typeof customElements<"u"&&!customElements.get("ui-number-ticker")&&customElements.define("ui-number-ticker",M);exports.UINumberTicker=M;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as M } from "./ElementBase-
|
|
2
|
-
const y = 1200,
|
|
1
|
+
import { E as M } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
|
+
const y = 1200, v = 0, I = "ease-out", O = "decimal", A = 0, S = 0.4, F = 6, L = /* @__PURE__ */ new Set([
|
|
3
3
|
"linear",
|
|
4
4
|
"ease-in",
|
|
5
5
|
"ease-out",
|
|
@@ -234,7 +234,7 @@ const y = 1200, A = 0, I = "ease-out", O = "decimal", v = 0, S = 0.4, F = 6, L =
|
|
|
234
234
|
`;
|
|
235
235
|
class W extends M {
|
|
236
236
|
constructor() {
|
|
237
|
-
super(), this._valueEl = null, this._frame = null, this._currentValue = 0, this._animationFrom = 0, this._animationTo = 0, this._animationDuration = y, this._animationDelay =
|
|
237
|
+
super(), this._valueEl = null, this._frame = null, this._currentValue = 0, this._animationFrom = 0, this._animationTo = 0, this._animationDuration = y, this._animationDelay = v, this._animationStartTime = 0, this._pausedElapsed = 0, this._animationPrepared = !1, this._initialized = !1, this._hovering = !1, this._focusWithin = !1, this._formatter = new Intl.NumberFormat(), this._mediaQuery = null, this._customFormatter = null, this._intersectionObserver = null, this._observerThreshold = S, this._isVisible = !0, this._visibilityGatePending = !1, this._tick = this._tick.bind(this), this._onPointerEnter = this._onPointerEnter.bind(this), this._onPointerLeave = this._onPointerLeave.bind(this), this._onFocusIn = this._onFocusIn.bind(this), this._onFocusOut = this._onFocusOut.bind(this), this._onReducedMotionChange = this._onReducedMotionChange.bind(this), this._onVisibilityChange = this._onVisibilityChange.bind(this);
|
|
238
238
|
}
|
|
239
239
|
static get observedAttributes() {
|
|
240
240
|
return [
|
|
@@ -321,8 +321,7 @@ class W extends M {
|
|
|
321
321
|
`), this._valueEl = this.root.querySelector(".value"), this._syncFromAttributes(!this._initialized);
|
|
322
322
|
}
|
|
323
323
|
_syncFromAttributes(t) {
|
|
324
|
-
if (!this._valueEl)
|
|
325
|
-
return;
|
|
324
|
+
if (!this._valueEl) return;
|
|
326
325
|
this._syncStyleOverrides(), this._syncVisibilityObserver(), this._formatter = this._createFormatter(), this._syncMotionPresentation();
|
|
327
326
|
const i = this._resolvedTargetValue(), n = this._resolvedBaseValue();
|
|
328
327
|
!this._initialized || t ? (this._currentValue = n, this._renderValue(n), m(this.getAttribute("trigger")) === "visible" && (this._visibilityGatePending = !0)) : this._renderValue(this._currentValue), this._setDirection(t ? n : this._currentValue, i), this._syncPlayback(i, n, t), this._initialized = !0;
|
|
@@ -355,7 +354,7 @@ class W extends M {
|
|
|
355
354
|
this._resumeAnimation();
|
|
356
355
|
}
|
|
357
356
|
_prepareAnimation(t, i) {
|
|
358
|
-
if (this._stopAnimation(), this._animationFrom = t, this._animationTo = i, this._animationDuration = Math.max(0, p(this.getAttribute("duration"), y)), this._animationDelay = Math.max(0, p(this.getAttribute("delay"),
|
|
357
|
+
if (this._stopAnimation(), this._animationFrom = t, this._animationTo = i, this._animationDuration = Math.max(0, p(this.getAttribute("duration"), y)), this._animationDelay = Math.max(0, p(this.getAttribute("delay"), v)), this._animationStartTime = 0, this._pausedElapsed = 0, this._animationPrepared = !o(t, i), this._setDirection(t, i), this._syncMotionPresentation(), !this._animationPrepared || this._animationDuration === 0) {
|
|
359
358
|
this._currentValue = i, this._renderValue(i), this._setState("completed");
|
|
360
359
|
return;
|
|
361
360
|
}
|
|
@@ -393,14 +392,12 @@ class W extends M {
|
|
|
393
392
|
this._setState("running"), this._frame = this._requestFrame(this._tick);
|
|
394
393
|
}
|
|
395
394
|
_renderValue(t) {
|
|
396
|
-
if (!this._valueEl)
|
|
397
|
-
return;
|
|
395
|
+
if (!this._valueEl) return;
|
|
398
396
|
const i = this._formatValue(t), n = j(this.getAttribute("animation"));
|
|
399
397
|
this.setAttribute("data-animation", n), this._valueEl.setAttribute("data-mode", n), n === "odometer" ? this._renderOdometer(i) : this._valueEl.textContent = i, this.setAttribute("data-value", t.toFixed(6)), this.setAttribute("data-rendered", i), this.hasAttribute("aria-label") || this.setAttribute("aria-label", i);
|
|
400
398
|
}
|
|
401
399
|
_renderOdometer(t) {
|
|
402
|
-
if (!this._valueEl)
|
|
403
|
-
return;
|
|
400
|
+
if (!this._valueEl) return;
|
|
404
401
|
const i = document.createDocumentFragment(), n = Array.from(t).filter(V).length;
|
|
405
402
|
let r = 0;
|
|
406
403
|
const s = Math.max(0, p(this.getAttribute("stagger"), 0)), d = Z(this.getAttribute("stagger-from"));
|
|
@@ -466,7 +463,7 @@ class W extends M {
|
|
|
466
463
|
signDisplay: z(this.getAttribute("sign-display")),
|
|
467
464
|
notation: w(this.getAttribute("notation"))
|
|
468
465
|
};
|
|
469
|
-
n != null ? (r.minimumFractionDigits = n, r.maximumFractionDigits = n) : t === "decimal" && (r.minimumFractionDigits =
|
|
466
|
+
n != null ? (r.minimumFractionDigits = n, r.maximumFractionDigits = n) : t === "decimal" && (r.minimumFractionDigits = A, r.maximumFractionDigits = A), r.notation === "compact" && (r.compactDisplay = X(this.getAttribute("compact-display"))), t === "currency" && (r.currency = J(this.getAttribute("currency")), r.currencyDisplay = K(this.getAttribute("currency-display")));
|
|
470
467
|
try {
|
|
471
468
|
return new Intl.NumberFormat(i, r);
|
|
472
469
|
} catch {
|
|
@@ -547,14 +544,12 @@ class W extends M {
|
|
|
547
544
|
}
|
|
548
545
|
_onVisibilityChange(t) {
|
|
549
546
|
const i = t[t.length - 1];
|
|
550
|
-
if (!i)
|
|
551
|
-
return;
|
|
547
|
+
if (!i) return;
|
|
552
548
|
const n = i.isIntersecting && i.intersectionRatio >= this._observerThreshold, r = n && !this._isVisible;
|
|
553
549
|
this._isVisible = n, r && this._visibilityGatePending && this._syncFromAttributes(!1);
|
|
554
550
|
}
|
|
555
551
|
_prefersReducedMotion() {
|
|
556
|
-
|
|
557
|
-
return !!((t = this._mediaQuery) != null && t.matches);
|
|
552
|
+
return !!this._mediaQuery?.matches;
|
|
558
553
|
}
|
|
559
554
|
_requestFrame(t) {
|
|
560
555
|
return typeof requestAnimationFrame == "function" ? requestAnimationFrame(t) : window.setTimeout(() => t(performance.now()), 16);
|
|
@@ -595,36 +590,31 @@ function z(e) {
|
|
|
595
590
|
return e != null && U.has(e) ? e : "auto";
|
|
596
591
|
}
|
|
597
592
|
function J(e) {
|
|
598
|
-
const t = e
|
|
593
|
+
const t = e?.trim().toUpperCase();
|
|
599
594
|
return t && /^[A-Z]{3}$/.test(t) ? t : "USD";
|
|
600
595
|
}
|
|
601
596
|
function b(e, t) {
|
|
602
|
-
if (e == null || e.trim() === "")
|
|
603
|
-
return t;
|
|
597
|
+
if (e == null || e.trim() === "") return t;
|
|
604
598
|
const i = Number.parseFloat(e);
|
|
605
599
|
return Number.isFinite(i) ? i : t;
|
|
606
600
|
}
|
|
607
601
|
function p(e, t) {
|
|
608
|
-
if (e == null || e.trim() === "")
|
|
609
|
-
return t;
|
|
602
|
+
if (e == null || e.trim() === "") return t;
|
|
610
603
|
const i = e.trim().toLowerCase();
|
|
611
604
|
return /^-?\d+(\.\d+)?$/.test(i) || /^-?\d+(\.\d+)?ms$/.test(i) ? Number.parseFloat(i) : /^-?\d+(\.\d+)?s$/.test(i) ? Number.parseFloat(i) * 1e3 : t;
|
|
612
605
|
}
|
|
613
606
|
function tt(e, t) {
|
|
614
|
-
if (e == null || e.trim() === "")
|
|
615
|
-
return t;
|
|
607
|
+
if (e == null || e.trim() === "") return t;
|
|
616
608
|
const i = Number.parseInt(e, 10);
|
|
617
609
|
return Number.isFinite(i) ? i : t;
|
|
618
610
|
}
|
|
619
611
|
function et(e, t) {
|
|
620
|
-
if (e == null)
|
|
621
|
-
return t;
|
|
612
|
+
if (e == null) return t;
|
|
622
613
|
const i = e.trim().toLowerCase();
|
|
623
614
|
return i ? i === "false" || i === "0" || i === "off" || i === "no" ? !1 : i === "true" || i === "1" || i === "on" || i === "yes" ? !0 : t : !0;
|
|
624
615
|
}
|
|
625
616
|
function it(e) {
|
|
626
|
-
if (e == null || e.trim() === "")
|
|
627
|
-
return null;
|
|
617
|
+
if (e == null || e.trim() === "") return null;
|
|
628
618
|
const t = e.trim().split(/\s+/).filter(Boolean);
|
|
629
619
|
return t.length ? t.map((i) => /^-?\d+(\.\d+)?$/.test(i) ? `${i}px` : i).join(" ") : null;
|
|
630
620
|
}
|
|
@@ -637,7 +627,7 @@ function E(e, t, i) {
|
|
|
637
627
|
e.setProperty(t, n);
|
|
638
628
|
}
|
|
639
629
|
function P(e, t, i) {
|
|
640
|
-
const n = i
|
|
630
|
+
const n = i?.trim();
|
|
641
631
|
if (!n) {
|
|
642
632
|
e.removeProperty(t);
|
|
643
633
|
return;
|
|
@@ -645,19 +635,13 @@ function P(e, t, i) {
|
|
|
645
635
|
e.setProperty(t, n);
|
|
646
636
|
}
|
|
647
637
|
function T(e) {
|
|
648
|
-
|
|
649
|
-
if (e == null)
|
|
650
|
-
return 0;
|
|
638
|
+
if (e == null) return 0;
|
|
651
639
|
const t = e.trim();
|
|
652
|
-
|
|
653
|
-
return 0;
|
|
654
|
-
const i = t.match(/^-?\d+(?:\.(\d+))?$/);
|
|
655
|
-
return ((n = i == null ? void 0 : i[1]) == null ? void 0 : n.length) || 0;
|
|
640
|
+
return t && t.match(/^-?\d+(?:\.(\d+))?$/)?.[1]?.length || 0;
|
|
656
641
|
}
|
|
657
642
|
function D(e, t, i) {
|
|
658
643
|
const n = c(tt(e, -1), -1, F);
|
|
659
|
-
if (n >= 0)
|
|
660
|
-
return n;
|
|
644
|
+
if (n >= 0) return n;
|
|
661
645
|
const r = c(Math.max(T(t), T(i)), 0, F);
|
|
662
646
|
return r > 0 ? r : null;
|
|
663
647
|
}
|
|
@@ -675,14 +659,12 @@ function nt(e, t) {
|
|
|
675
659
|
return rt(t);
|
|
676
660
|
case "overshoot":
|
|
677
661
|
return st(t);
|
|
678
|
-
case "ease-out":
|
|
679
662
|
default:
|
|
680
663
|
return 1 - Math.pow(1 - t, 3);
|
|
681
664
|
}
|
|
682
665
|
}
|
|
683
666
|
function rt(e) {
|
|
684
|
-
if (e < 1 / 2.75)
|
|
685
|
-
return 7.5625 * e * e;
|
|
667
|
+
if (e < 1 / 2.75) return 7.5625 * e * e;
|
|
686
668
|
if (e < 2 / 2.75) {
|
|
687
669
|
const r = e - 0.5454545454545454;
|
|
688
670
|
return 7.5625 * r * r + 0.75;
|
|
@@ -711,14 +693,12 @@ function at(e) {
|
|
|
711
693
|
return "cubic-bezier(0.35, 1.4, 0.35, 1)";
|
|
712
694
|
case "overshoot":
|
|
713
695
|
return "cubic-bezier(0.2, 1.24, 0.3, 1)";
|
|
714
|
-
case "ease-out":
|
|
715
696
|
default:
|
|
716
697
|
return "cubic-bezier(0.22, 1, 0.36, 1)";
|
|
717
698
|
}
|
|
718
699
|
}
|
|
719
700
|
function ot(e, t, i, n) {
|
|
720
|
-
if (i <= 0 || t <= 1)
|
|
721
|
-
return 0;
|
|
701
|
+
if (i <= 0 || t <= 1) return 0;
|
|
722
702
|
switch (n) {
|
|
723
703
|
case "end":
|
|
724
704
|
return (t - e - 1) * i;
|
|
@@ -726,7 +706,6 @@ function ot(e, t, i, n) {
|
|
|
726
706
|
const r = (t - 1) / 2;
|
|
727
707
|
return Math.abs(e - r) * i;
|
|
728
708
|
}
|
|
729
|
-
case "start":
|
|
730
709
|
default:
|
|
731
710
|
return e * i;
|
|
732
711
|
}
|
package/dist/odometer.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const M=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const M=require("./ElementBase-EV6mVBUV.js"),D=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-odometer-font-family: var(--ui-font-family-mono, var(--font-mono, ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, monospace));
|
|
4
4
|
--ui-odometer-font-size: var(--font-size-4, 1.25rem);
|