@chainvibe/components 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/_virtual/config.js +4 -0
- package/dist/_virtual/core.js +4 -0
- package/dist/_virtual/debug.js +4 -0
- package/dist/_virtual/encode.js +4 -0
- package/dist/_virtual/helpers.js +4 -0
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index2.js +4 -0
- package/dist/_virtual/memory.js +4 -0
- package/dist/_virtual/number.js +4 -0
- package/dist/components/NotificationBox/NotificationBox.d.ts +41 -0
- package/dist/components/NotificationBox/NotificationBox.d.ts.map +1 -0
- package/dist/components/NotificationBox/NotificationBox.js +86 -0
- package/dist/components/NotificationBox/NotificationBox.module.css +1 -0
- package/dist/components/NotificationBox/NotificationBox.module.css.js +29 -0
- package/dist/components/NotificationBox/index.d.ts +3 -0
- package/dist/components/NotificationBox/index.d.ts.map +1 -0
- package/dist/components/NotificationBoxAmount/NotificationBoxAmount.d.ts +13 -0
- package/dist/components/NotificationBoxAmount/NotificationBoxAmount.d.ts.map +1 -0
- package/dist/components/NotificationBoxAmount/NotificationBoxAmount.js +45 -0
- package/dist/components/NotificationBoxAmount/NotificationBoxAmount.module.css +1 -0
- package/dist/components/NotificationBoxAmount/NotificationBoxAmount.module.css.js +11 -0
- package/dist/components/NotificationBoxAmount/index.d.ts +2 -0
- package/dist/components/NotificationBoxAmount/index.d.ts.map +1 -0
- package/dist/components/NotificationBoxStack/NotificationBoxStack.d.ts +14 -0
- package/dist/components/NotificationBoxStack/NotificationBoxStack.d.ts.map +1 -0
- package/dist/components/NotificationBoxStack/NotificationBoxStack.js +47 -0
- package/dist/components/NotificationBoxStack/index.d.ts +3 -0
- package/dist/components/NotificationBoxStack/index.d.ts.map +1 -0
- package/dist/components/utils/cn.d.ts +2 -0
- package/dist/components/utils/cn.d.ts.map +1 -0
- package/dist/components/utils/cn.js +4 -0
- package/dist/dev/utils.js +55 -0
- package/dist/hooks/useChainVibeStream.js +60 -0
- package/dist/index.js +10 -0
- package/dist/node_modules/@number-flow/react/dist/NumberFlow-client-48rw3j0J.js +111 -0
- package/dist/node_modules/compress-json/dist/config.js +16 -0
- package/dist/node_modules/compress-json/dist/core.js +92 -0
- package/dist/node_modules/compress-json/dist/debug.js +19 -0
- package/dist/node_modules/compress-json/dist/encode.js +58 -0
- package/dist/node_modules/compress-json/dist/helpers.js +27 -0
- package/dist/node_modules/compress-json/dist/index.js +38 -0
- package/dist/node_modules/compress-json/dist/memory.js +128 -0
- package/dist/node_modules/compress-json/dist/number.js +119 -0
- package/dist/node_modules/number-flow/dist/lite-BtgQ9jUv.js +435 -0
- package/dist/node_modules/sonner/dist/index.js +744 -0
- package/dist/types/events.d.ts +22 -0
- package/dist/types/events.d.ts.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
const m = (n, t, e) => {
|
|
2
|
+
const i = document.createElement(n), [s, a] = Array.isArray(t) ? [void 0, t] : [t, e];
|
|
3
|
+
return s && Object.assign(i, s), a?.forEach((r) => i.appendChild(r)), i;
|
|
4
|
+
}, B = (n, t) => {
|
|
5
|
+
var e;
|
|
6
|
+
return t === "left" ? n.offsetLeft : (((e = n.offsetParent instanceof HTMLElement ? n.offsetParent : null) == null ? void 0 : e.offsetWidth) ?? 0) - n.offsetWidth - n.offsetLeft;
|
|
7
|
+
}, D = (n) => n.offsetWidth > 0 && n.offsetHeight > 0, it = (n, t) => {
|
|
8
|
+
!customElements.get(n) && customElements.define(n, t);
|
|
9
|
+
};
|
|
10
|
+
function F(n, t, { reverse: e = !1 } = {}) {
|
|
11
|
+
const i = n.length;
|
|
12
|
+
for (let s = e ? i - 1 : 0; e ? s >= 0 : s < i; e ? s-- : s++)
|
|
13
|
+
t(n[s], s);
|
|
14
|
+
}
|
|
15
|
+
function st(n, t, e, i) {
|
|
16
|
+
const s = t.formatToParts(n);
|
|
17
|
+
e && s.unshift({ type: "prefix", value: e }), i && s.push({ type: "suffix", value: i });
|
|
18
|
+
const a = [], r = [], o = [], c = [], d = {}, p = (h) => `${h}:${d[h] = (d[h] ?? -1) + 1}`;
|
|
19
|
+
let x = "", g = !1, y = !1;
|
|
20
|
+
for (const h of s) {
|
|
21
|
+
x += h.value;
|
|
22
|
+
const l = h.type === "minusSign" || h.type === "plusSign" ? "sign" : h.type;
|
|
23
|
+
l === "integer" ? (g = !0, r.push(...h.value.split("").map((S) => ({ type: l, value: parseInt(S) })))) : l === "group" ? r.push({ type: l, value: h.value }) : l === "decimal" ? (y = !0, o.push({ type: l, value: h.value, key: p(l) })) : l === "fraction" ? o.push(...h.value.split("").map((S) => ({
|
|
24
|
+
type: l,
|
|
25
|
+
value: parseInt(S),
|
|
26
|
+
key: p(l),
|
|
27
|
+
pos: -1 - d[l]
|
|
28
|
+
}))) : (g || y ? c : a).push({
|
|
29
|
+
type: l,
|
|
30
|
+
value: h.value,
|
|
31
|
+
key: p(l)
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const P = [];
|
|
35
|
+
for (let h = r.length - 1; h >= 0; h--) {
|
|
36
|
+
const l = r[h];
|
|
37
|
+
P.unshift(l.type === "integer" ? {
|
|
38
|
+
...l,
|
|
39
|
+
key: p(l.type),
|
|
40
|
+
pos: d[l.type]
|
|
41
|
+
} : {
|
|
42
|
+
...l,
|
|
43
|
+
key: p(l.type)
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
pre: a,
|
|
48
|
+
integer: P,
|
|
49
|
+
fraction: o,
|
|
50
|
+
post: c,
|
|
51
|
+
valueAsString: x,
|
|
52
|
+
value: typeof n == "string" ? parseFloat(n) : n
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const L = String.raw, X = (() => {
|
|
56
|
+
try {
|
|
57
|
+
document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
|
|
58
|
+
} catch {
|
|
59
|
+
return !1;
|
|
60
|
+
}
|
|
61
|
+
return !0;
|
|
62
|
+
})(), I = typeof CSS < "u" && CSS.supports && CSS.supports("line-height", "mod(1,1)"), A = typeof matchMedia < "u" ? matchMedia("(prefers-reduced-motion: reduce)") : null, b = "--_number-flow-d-opacity", U = "--_number-flow-d-width", $ = "--_number-flow-dx", R = "--_number-flow-d", O = (() => {
|
|
63
|
+
try {
|
|
64
|
+
return CSS.registerProperty({
|
|
65
|
+
name: b,
|
|
66
|
+
syntax: "<number>",
|
|
67
|
+
inherits: !1,
|
|
68
|
+
initialValue: "0"
|
|
69
|
+
}), CSS.registerProperty({
|
|
70
|
+
name: $,
|
|
71
|
+
syntax: "<length>",
|
|
72
|
+
inherits: !0,
|
|
73
|
+
initialValue: "0px"
|
|
74
|
+
}), CSS.registerProperty({
|
|
75
|
+
name: U,
|
|
76
|
+
syntax: "<number>",
|
|
77
|
+
inherits: !1,
|
|
78
|
+
initialValue: "0"
|
|
79
|
+
}), CSS.registerProperty({
|
|
80
|
+
name: R,
|
|
81
|
+
syntax: "<number>",
|
|
82
|
+
inherits: !0,
|
|
83
|
+
initialValue: "0"
|
|
84
|
+
}), !0;
|
|
85
|
+
} catch {
|
|
86
|
+
return !1;
|
|
87
|
+
}
|
|
88
|
+
})(), j = "var(--number-flow-char-height, 1em)", f = "var(--number-flow-mask-height, 0.25em)", C = `calc(${f} / 2)`, k = "var(--number-flow-mask-width, 0.5em)", u = `calc(${k} / var(--scale-x))`, v = "#000 0, transparent 71%", z = L`:host{display:inline-block;direction:ltr;white-space:nowrap;isolation:isolate;line-height:${j} !important}.number,.number__inner{display:inline-block;transform-origin:left top}:host([data-will-change]) :is(.number,.number__inner,.section,.digit,.digit__num,.symbol){will-change:transform}.number{--scale-x:calc(1 + var(${U}) / var(--width));transform:translateX(var(${$})) scaleX(var(--scale-x));margin:0 calc(-1 * ${k});position:relative;-webkit-mask-image:linear-gradient(to right,transparent 0,#000 ${u},#000 calc(100% - ${u}),transparent ),linear-gradient(to bottom,transparent 0,#000 ${f},#000 calc(100% - ${f}),transparent 100% ),radial-gradient(at bottom right,${v}),radial-gradient(at bottom left,${v}),radial-gradient(at top left,${v}),radial-gradient(at top right,${v});-webkit-mask-size:100% calc(100% - ${f} * 2),calc(100% - ${u} * 2) 100%,${u} ${f},${u} ${f},${u} ${f},${u} ${f};-webkit-mask-position:center,center,top left,top right,bottom right,bottom left;-webkit-mask-repeat:no-repeat}.number__inner{padding:${C} ${k};transform:scaleX(calc(1 / var(--scale-x))) translateX(calc(-1 * var(${$})))}:host > :not(.number){z-index:5}.section,.symbol{display:inline-block;position:relative;isolation:isolate}.section::after{content:'\200b';display:inline-block}.section--justify-left{transform-origin:center left}.section--justify-right{transform-origin:center right}.section > [inert],.symbol > [inert]{margin:0 !important;position:absolute !important;z-index:-1}.digit{display:inline-block;position:relative;--c:var(--current) + var(${R})}.digit__num,.number .section::after{padding:${C} 0}.digit__num{display:inline-block;--offset-raw:mod(var(--length) + var(--n) - mod(var(--c),var(--length)),var(--length));--offset:calc( var(--offset-raw) - var(--length) * round(down,var(--offset-raw) / (var(--length) / 2),1) );--y:clamp(-100%,var(--offset) * 100%,100%);transform:translateY(var(--y))}.digit__num[inert]{position:absolute;top:0;left:50%;transform:translateX(-50%) translateY(var(--y))}.digit:not(.is-spinning) .digit__num[inert]{display:none}.symbol__value{display:inline-block;mix-blend-mode:plus-lighter;white-space:pre}.section--justify-left .symbol > [inert]{left:0}.section--justify-right .symbol > [inert]{right:0}.animate-presence{opacity:calc(1 + var(${b}))}`, Y = HTMLElement, Z = I && X && O;
|
|
89
|
+
class q extends Y {
|
|
90
|
+
constructor() {
|
|
91
|
+
super(), this.created = !1, this.batched = !1;
|
|
92
|
+
const { animated: t, ...e } = this.constructor.defaultProps;
|
|
93
|
+
this._animated = this.computedAnimated = t, Object.assign(this, e);
|
|
94
|
+
}
|
|
95
|
+
get animated() {
|
|
96
|
+
return this._animated;
|
|
97
|
+
}
|
|
98
|
+
set animated(t) {
|
|
99
|
+
var e;
|
|
100
|
+
this.animated !== t && (this._animated = t, (e = this.shadowRoot) == null || e.getAnimations().forEach((i) => i.finish()));
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* @internal
|
|
104
|
+
*/
|
|
105
|
+
set data(t) {
|
|
106
|
+
var o;
|
|
107
|
+
if (t == null)
|
|
108
|
+
return;
|
|
109
|
+
const { pre: e, integer: i, fraction: s, post: a, value: r } = t;
|
|
110
|
+
if (this.created) {
|
|
111
|
+
const c = this._data;
|
|
112
|
+
this._data = t, this.computedTrend = typeof this.trend == "function" ? this.trend(c.value, r) : this.trend, this.computedAnimated = Z && this._animated && (!this.respectMotionPreference || !(A != null && A.matches)) && // https://github.com/barvian/number-flow/issues/9
|
|
113
|
+
D(this), (o = this.plugins) == null || o.forEach((d) => {
|
|
114
|
+
var p;
|
|
115
|
+
return (p = d.onUpdate) == null ? void 0 : p.call(d, t, c, this);
|
|
116
|
+
}), this.batched || this.willUpdate(), this._pre.update(e), this._num.update({ integer: i, fraction: s }), this._post.update(a), this.batched || this.didUpdate();
|
|
117
|
+
} else {
|
|
118
|
+
this._data = t, this.attachShadow({ mode: "open" });
|
|
119
|
+
try {
|
|
120
|
+
this._internals ?? (this._internals = this.attachInternals()), this._internals.role = "img";
|
|
121
|
+
} catch {
|
|
122
|
+
}
|
|
123
|
+
const c = document.createElement("style");
|
|
124
|
+
c.textContent = z, this.shadowRoot.appendChild(c), this._pre = new M(this, e, {
|
|
125
|
+
justify: "right",
|
|
126
|
+
part: "left"
|
|
127
|
+
}), this.shadowRoot.appendChild(this._pre.el), this._num = new J(this, i, s), this.shadowRoot.appendChild(this._num.el), this._post = new M(this, a, {
|
|
128
|
+
justify: "left",
|
|
129
|
+
part: "right"
|
|
130
|
+
}), this.shadowRoot.appendChild(this._post.el), this.created = !0;
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
this._internals.ariaLabel = t.valueAsString;
|
|
134
|
+
} catch {
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* @internal
|
|
139
|
+
*/
|
|
140
|
+
willUpdate() {
|
|
141
|
+
this._pre.willUpdate(), this._num.willUpdate(), this._post.willUpdate();
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @internal
|
|
145
|
+
*/
|
|
146
|
+
didUpdate() {
|
|
147
|
+
if (!this.computedAnimated)
|
|
148
|
+
return;
|
|
149
|
+
this._abortAnimationsFinish ? this._abortAnimationsFinish.abort() : this.dispatchEvent(new Event("animationsstart")), this._pre.didUpdate(), this._num.didUpdate(), this._post.didUpdate();
|
|
150
|
+
const t = new AbortController();
|
|
151
|
+
Promise.all(this.shadowRoot.getAnimations().map((e) => e.finished)).then(() => {
|
|
152
|
+
t.signal.aborted || (this.dispatchEvent(new Event("animationsfinish")), this._abortAnimationsFinish = void 0);
|
|
153
|
+
}), this._abortAnimationsFinish = t;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
q.defaultProps = {
|
|
157
|
+
transformTiming: {
|
|
158
|
+
duration: 900,
|
|
159
|
+
// Make sure to keep this minified:
|
|
160
|
+
easing: "linear(0,.005,.019,.039,.066,.096,.129,.165,.202,.24,.278,.316,.354,.39,.426,.461,.494,.526,.557,.586,.614,.64,.665,.689,.711,.731,.751,.769,.786,.802,.817,.831,.844,.856,.867,.877,.887,.896,.904,.912,.919,.925,.931,.937,.942,.947,.951,.955,.959,.962,.965,.968,.971,.973,.976,.978,.98,.981,.983,.984,.986,.987,.988,.989,.99,.991,.992,.992,.993,.994,.994,.995,.995,.996,.996,.9963,.9967,.9969,.9972,.9975,.9977,.9979,.9981,.9982,.9984,.9985,.9987,.9988,.9989,1)"
|
|
161
|
+
},
|
|
162
|
+
spinTiming: void 0,
|
|
163
|
+
opacityTiming: { duration: 450, easing: "ease-out" },
|
|
164
|
+
animated: !0,
|
|
165
|
+
trend: (n, t) => Math.sign(t - n),
|
|
166
|
+
respectMotionPreference: !0,
|
|
167
|
+
plugins: void 0,
|
|
168
|
+
digits: void 0
|
|
169
|
+
};
|
|
170
|
+
class J {
|
|
171
|
+
constructor(t, e, i, { className: s, ...a } = {}) {
|
|
172
|
+
this.flow = t, this._integer = new T(t, e, {
|
|
173
|
+
justify: "right",
|
|
174
|
+
part: "integer"
|
|
175
|
+
}), this._fraction = new T(t, i, {
|
|
176
|
+
justify: "left",
|
|
177
|
+
part: "fraction"
|
|
178
|
+
}), this._inner = m("span", {
|
|
179
|
+
className: "number__inner"
|
|
180
|
+
}, [this._integer.el, this._fraction.el]), this.el = m("span", {
|
|
181
|
+
...a,
|
|
182
|
+
part: "number",
|
|
183
|
+
className: `number ${s ?? ""}`
|
|
184
|
+
}, [this._inner]);
|
|
185
|
+
}
|
|
186
|
+
willUpdate() {
|
|
187
|
+
this._prevWidth = this.el.offsetWidth, this._prevLeft = this.el.getBoundingClientRect().left, this._integer.willUpdate(), this._fraction.willUpdate();
|
|
188
|
+
}
|
|
189
|
+
update({ integer: t, fraction: e }) {
|
|
190
|
+
this._integer.update(t), this._fraction.update(e);
|
|
191
|
+
}
|
|
192
|
+
didUpdate() {
|
|
193
|
+
const t = this.el.getBoundingClientRect();
|
|
194
|
+
this._integer.didUpdate(), this._fraction.didUpdate();
|
|
195
|
+
const e = this._prevLeft - t.left, i = this.el.offsetWidth, s = this._prevWidth - i;
|
|
196
|
+
this.el.style.setProperty("--width", String(i)), this.el.animate({
|
|
197
|
+
[$]: [`${e}px`, "0px"],
|
|
198
|
+
[U]: [s, 0]
|
|
199
|
+
}, {
|
|
200
|
+
...this.flow.transformTiming,
|
|
201
|
+
composite: "accumulate"
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
class N {
|
|
206
|
+
constructor(t, e, { justify: i, className: s, ...a }, r) {
|
|
207
|
+
this.flow = t, this.children = /* @__PURE__ */ new Map(), this.onCharRemove = (c) => () => {
|
|
208
|
+
this.children.delete(c);
|
|
209
|
+
}, this.justify = i;
|
|
210
|
+
const o = e.map((c) => this.addChar(c).el);
|
|
211
|
+
this.el = m("span", {
|
|
212
|
+
...a,
|
|
213
|
+
className: `section section--justify-${i} ${s ?? ""}`
|
|
214
|
+
}, r ? r(o) : o);
|
|
215
|
+
}
|
|
216
|
+
addChar(t, { startDigitsAtZero: e = !1, ...i } = {}) {
|
|
217
|
+
const s = t.type === "integer" || t.type === "fraction" ? new W(this, t.type, e ? 0 : t.value, t.pos, {
|
|
218
|
+
...i,
|
|
219
|
+
onRemove: this.onCharRemove(t.key)
|
|
220
|
+
}) : new Q(this, t.type, t.value, {
|
|
221
|
+
...i,
|
|
222
|
+
onRemove: this.onCharRemove(t.key)
|
|
223
|
+
});
|
|
224
|
+
return this.children.set(t.key, s), s;
|
|
225
|
+
}
|
|
226
|
+
unpop(t) {
|
|
227
|
+
t.el.removeAttribute("inert"), t.el.style.top = "", t.el.style[this.justify] = "";
|
|
228
|
+
}
|
|
229
|
+
pop(t) {
|
|
230
|
+
t.forEach((e) => {
|
|
231
|
+
e.el.style.top = `${e.el.offsetTop}px`, e.el.style[this.justify] = `${B(e.el, this.justify)}px`;
|
|
232
|
+
}), t.forEach((e) => {
|
|
233
|
+
e.el.setAttribute("inert", ""), e.present = !1;
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
addNewAndUpdateExisting(t) {
|
|
237
|
+
const e = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = this.justify === "left", a = s ? "prepend" : "append";
|
|
238
|
+
if (F(t, (r) => {
|
|
239
|
+
let o;
|
|
240
|
+
this.children.has(r.key) ? (o = this.children.get(r.key), i.set(r, o), this.unpop(o), o.present = !0) : (o = this.addChar(r, { startDigitsAtZero: !0, animateIn: !0 }), e.set(r, o)), this.el[a](o.el);
|
|
241
|
+
}, { reverse: s }), this.flow.computedAnimated) {
|
|
242
|
+
const r = this.el.getBoundingClientRect();
|
|
243
|
+
e.forEach((o) => {
|
|
244
|
+
o.willUpdate(r);
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
e.forEach((r, o) => {
|
|
248
|
+
r.update(o.value);
|
|
249
|
+
}), i.forEach((r, o) => {
|
|
250
|
+
r.update(o.value);
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
willUpdate() {
|
|
254
|
+
const t = this.el.getBoundingClientRect();
|
|
255
|
+
this._prevOffset = t[this.justify], this.children.forEach((e) => e.willUpdate(t));
|
|
256
|
+
}
|
|
257
|
+
didUpdate() {
|
|
258
|
+
const t = this.el.getBoundingClientRect();
|
|
259
|
+
this.children.forEach((s) => s.didUpdate(t));
|
|
260
|
+
const e = t[this.justify], i = this._prevOffset - e;
|
|
261
|
+
i && this.children.size && this.el.animate({
|
|
262
|
+
transform: [`translateX(${i}px)`, "none"]
|
|
263
|
+
}, {
|
|
264
|
+
...this.flow.transformTiming,
|
|
265
|
+
composite: "accumulate"
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
class T extends N {
|
|
270
|
+
update(t) {
|
|
271
|
+
const e = /* @__PURE__ */ new Map();
|
|
272
|
+
this.children.forEach((i, s) => {
|
|
273
|
+
t.find((a) => a.key === s) || e.set(s, i), this.unpop(i);
|
|
274
|
+
}), this.addNewAndUpdateExisting(t), e.forEach((i) => {
|
|
275
|
+
i instanceof W && i.update(0);
|
|
276
|
+
}), this.pop(e);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
class M extends N {
|
|
280
|
+
update(t) {
|
|
281
|
+
const e = /* @__PURE__ */ new Map();
|
|
282
|
+
this.children.forEach((i, s) => {
|
|
283
|
+
t.find((a) => a.key === s) || e.set(s, i);
|
|
284
|
+
}), this.pop(e), this.addNewAndUpdateExisting(t);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
class E {
|
|
288
|
+
constructor(t, e, { onRemove: i, animateIn: s = !1 } = {}) {
|
|
289
|
+
this.flow = t, this.el = e, this._present = !0, this._remove = () => {
|
|
290
|
+
var a;
|
|
291
|
+
this.el.remove(), (a = this._onRemove) == null || a.call(this);
|
|
292
|
+
}, this.el.classList.add("animate-presence"), this.flow.computedAnimated && s && this.el.animate({
|
|
293
|
+
[b]: [-0.9999, 0]
|
|
294
|
+
}, {
|
|
295
|
+
...this.flow.opacityTiming,
|
|
296
|
+
composite: "accumulate"
|
|
297
|
+
}), this._onRemove = i;
|
|
298
|
+
}
|
|
299
|
+
get present() {
|
|
300
|
+
return this._present;
|
|
301
|
+
}
|
|
302
|
+
set present(t) {
|
|
303
|
+
if (this._present !== t) {
|
|
304
|
+
if (this._present = t, t ? this.el.removeAttribute("inert") : this.el.setAttribute("inert", ""), !this.flow.computedAnimated) {
|
|
305
|
+
t || this._remove();
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
this.el.style.setProperty("--_number-flow-d-opacity", t ? "0" : "-.999"), this.el.animate({
|
|
309
|
+
[b]: t ? [-0.9999, 0] : [0.999, 0]
|
|
310
|
+
}, {
|
|
311
|
+
...this.flow.opacityTiming,
|
|
312
|
+
composite: "accumulate"
|
|
313
|
+
}), t ? this.flow.removeEventListener("animationsfinish", this._remove) : this.flow.addEventListener("animationsfinish", this._remove, {
|
|
314
|
+
once: !0
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
class V extends E {
|
|
320
|
+
constructor(t, e, i, s) {
|
|
321
|
+
super(t.flow, i, s), this.section = t, this.value = e, this.el = i;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
class W extends V {
|
|
325
|
+
constructor(t, e, i, s, a) {
|
|
326
|
+
var d, p;
|
|
327
|
+
const r = (((p = (d = t.flow.digits) == null ? void 0 : d[s]) == null ? void 0 : p.max) ?? 9) + 1, o = Array.from({ length: r }).map((x, g) => {
|
|
328
|
+
const y = m("span", { className: "digit__num" }, [
|
|
329
|
+
document.createTextNode(String(g))
|
|
330
|
+
]);
|
|
331
|
+
return g !== i && y.setAttribute("inert", ""), y.style.setProperty("--n", String(g)), y;
|
|
332
|
+
}), c = m("span", {
|
|
333
|
+
part: `digit ${e}-digit`,
|
|
334
|
+
className: "digit"
|
|
335
|
+
}, o);
|
|
336
|
+
c.style.setProperty("--current", String(i)), c.style.setProperty("--length", String(r)), super(t, i, c, a), this.pos = s, this._onAnimationsFinish = () => {
|
|
337
|
+
this.el.classList.remove("is-spinning");
|
|
338
|
+
}, this._numbers = o, this.length = r;
|
|
339
|
+
}
|
|
340
|
+
willUpdate(t) {
|
|
341
|
+
const e = this.el.getBoundingClientRect();
|
|
342
|
+
this._prevValue = this.value;
|
|
343
|
+
const i = e[this.section.justify] - t[this.section.justify], s = e.width / 2;
|
|
344
|
+
this._prevCenter = this.section.justify === "left" ? i + s : i - s;
|
|
345
|
+
}
|
|
346
|
+
update(t) {
|
|
347
|
+
this.el.style.setProperty("--current", String(t)), this._numbers.forEach((e, i) => i === t ? e.removeAttribute("inert") : e.setAttribute("inert", "")), this.value = t;
|
|
348
|
+
}
|
|
349
|
+
didUpdate(t) {
|
|
350
|
+
const e = this.el.getBoundingClientRect(), i = e[this.section.justify] - t[this.section.justify], s = e.width / 2, a = this.section.justify === "left" ? i + s : i - s, r = this._prevCenter - a;
|
|
351
|
+
r && this.el.animate({
|
|
352
|
+
transform: [`translateX(${r}px)`, "none"]
|
|
353
|
+
}, {
|
|
354
|
+
...this.flow.transformTiming,
|
|
355
|
+
composite: "accumulate"
|
|
356
|
+
});
|
|
357
|
+
const o = this.getDelta();
|
|
358
|
+
o && (this.el.classList.add("is-spinning"), this.el.animate({
|
|
359
|
+
[R]: [-o, 0]
|
|
360
|
+
}, {
|
|
361
|
+
...this.flow.spinTiming ?? this.flow.transformTiming,
|
|
362
|
+
composite: "accumulate"
|
|
363
|
+
}), this.flow.addEventListener("animationsfinish", this._onAnimationsFinish, { once: !0 }));
|
|
364
|
+
}
|
|
365
|
+
getDelta() {
|
|
366
|
+
var i;
|
|
367
|
+
if (this.flow.plugins)
|
|
368
|
+
for (const s of this.flow.plugins) {
|
|
369
|
+
const a = (i = s.getDelta) == null ? void 0 : i.call(s, this.value, this._prevValue, this);
|
|
370
|
+
if (a != null)
|
|
371
|
+
return a;
|
|
372
|
+
}
|
|
373
|
+
const t = this.value - this._prevValue, e = this.flow.computedTrend || Math.sign(t);
|
|
374
|
+
return e < 0 && this.value > this._prevValue ? this.value - this.length - this._prevValue : e > 0 && this.value < this._prevValue ? this.length - this._prevValue + this.value : t;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
class Q extends V {
|
|
378
|
+
constructor(t, e, i, s) {
|
|
379
|
+
const a = m("span", {
|
|
380
|
+
className: "symbol__value",
|
|
381
|
+
textContent: i
|
|
382
|
+
});
|
|
383
|
+
super(t, i, m("span", {
|
|
384
|
+
part: `symbol ${e}`,
|
|
385
|
+
className: "symbol"
|
|
386
|
+
}, [a]), s), this.type = e, this._children = /* @__PURE__ */ new Map(), this._onChildRemove = (r) => () => {
|
|
387
|
+
this._children.delete(r);
|
|
388
|
+
}, this._children.set(i, new E(this.flow, a, {
|
|
389
|
+
onRemove: this._onChildRemove(i)
|
|
390
|
+
}));
|
|
391
|
+
}
|
|
392
|
+
willUpdate(t) {
|
|
393
|
+
if (this.type === "decimal")
|
|
394
|
+
return;
|
|
395
|
+
const e = this.el.getBoundingClientRect();
|
|
396
|
+
this._prevOffset = e[this.section.justify] - t[this.section.justify];
|
|
397
|
+
}
|
|
398
|
+
update(t) {
|
|
399
|
+
if (this.value !== t) {
|
|
400
|
+
const e = this._children.get(this.value);
|
|
401
|
+
e && (e.present = !1);
|
|
402
|
+
const i = this._children.get(t);
|
|
403
|
+
if (i)
|
|
404
|
+
i.present = !0;
|
|
405
|
+
else {
|
|
406
|
+
const s = m("span", {
|
|
407
|
+
className: "symbol__value",
|
|
408
|
+
textContent: t
|
|
409
|
+
});
|
|
410
|
+
this.el.appendChild(s), this._children.set(t, new E(this.flow, s, {
|
|
411
|
+
animateIn: !0,
|
|
412
|
+
onRemove: this._onChildRemove(t)
|
|
413
|
+
}));
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
this.value = t;
|
|
417
|
+
}
|
|
418
|
+
didUpdate(t) {
|
|
419
|
+
if (this.type === "decimal")
|
|
420
|
+
return;
|
|
421
|
+
const i = this.el.getBoundingClientRect()[this.section.justify] - t[this.section.justify], s = this._prevOffset - i;
|
|
422
|
+
s && this.el.animate({
|
|
423
|
+
transform: [`translateX(${s}px)`, "none"]
|
|
424
|
+
}, { ...this.flow.transformTiming, composite: "accumulate" });
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
export {
|
|
428
|
+
W as D,
|
|
429
|
+
q as N,
|
|
430
|
+
Y as S,
|
|
431
|
+
Z as c,
|
|
432
|
+
it as d,
|
|
433
|
+
st as f,
|
|
434
|
+
A as p
|
|
435
|
+
};
|