@number-flow/vue 0.2.2 → 0.2.3
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/index.js +1 -1
- package/dist/index.mjs +50 -53
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),n=require("number-flow"),f=Symbol(),p=e.defineComponent({__name:"NumberFlowGroup",setup(
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),n=require("number-flow"),f=Symbol(),p=e.defineComponent({__name:"NumberFlowGroup",setup(l){const u=new Set;let r=!1;const a=(o,s)=>{u.add(o),e.watch(s,async()=>{r||(r=!0,u.forEach(async t=>{var m;!t.value||!t.value.created||(t.value.willUpdate(),await e.nextTick(),(m=t.value)==null||m.didUpdate())}),await e.nextTick(),r=!1)}),e.onUnmounted(()=>{u.delete(o)})};return e.provide(f,a),(o,s)=>e.renderSlot(o.$slots,"default")}}),g=["manual","trend","continuous","animated","transformTiming","spinTiming","opacityTiming","respectMotionPreference","data-will-change","innerHTML","parts"],v=e.defineComponent({inheritAttrs:!1,__name:"index",props:{transformTiming:{default:()=>n.NumberFlowLite.defaultProps.transformTiming},spinTiming:{default:()=>n.NumberFlowLite.defaultProps.spinTiming},opacityTiming:{default:()=>n.NumberFlowLite.defaultProps.opacityTiming},animated:{type:Boolean,default:()=>n.NumberFlowLite.defaultProps.animated},respectMotionPreference:{type:Boolean,default:()=>n.NumberFlowLite.defaultProps.respectMotionPreference},trend:{type:[Boolean,String],default:()=>n.NumberFlowLite.defaultProps.trend},continuous:{type:Boolean,default:()=>n.NumberFlowLite.defaultProps.continuous},locales:{},format:{},value:{},willChange:{type:Boolean,default:!1}},emits:["animationsstart","animationsfinish"],setup(l,{expose:u,emit:r}){const a=e.ref();u({el:a});const o=r,s=e.computed(()=>new Intl.NumberFormat(l.locales,l.format)),t=e.computed(()=>n.partitionParts(l.value,s.value)),m=e.inject(f,void 0);return m==null||m(a,t),(i,d)=>(e.openBlock(),e.createElementBlock("number-flow-vue",e.mergeProps({ref_key:"el",ref:a},i.$attrs,{manual:!!e.unref(m),trend:i.trend,continuous:i.continuous,animated:i.animated,transformTiming:i.transformTiming,spinTiming:i.spinTiming,opacityTiming:i.opacityTiming,respectMotionPreference:i.respectMotionPreference,"data-will-change":i.willChange?"":void 0,innerHTML:e.unref(n.render)({formatted:t.value.formatted,willChange:i.willChange}),onAnimationsstart:d[0]||(d[0]=c=>o("animationsstart")),onAnimationsfinish:d[1]||(d[1]=c=>o("animationsfinish")),parts:t.value}),null,16,g))}});n.define("number-flow-vue",n.NumberFlowLite);function w({respectMotionPreference:l=!0}={}){const u=e.ref(n.canAnimate),r=e.ref(!1);return e.onMounted(()=>{var a;u.value=n.canAnimate,r.value=((a=n.prefersReducedMotion)==null?void 0:a.matches)??!1}),e.watchEffect(a=>{var s;if(!e.toValue(l))return;const o=({matches:t})=>{r.value=t};(s=n.prefersReducedMotion)==null||s.addEventListener("change",o),a(()=>{var t;(t=n.prefersReducedMotion)==null||t.removeEventListener("change",o)})}),e.computed(()=>u.value&&(!e.toValue(l)||!r.value))}Object.defineProperty(exports,"NumberFlowElement",{enumerable:!0,get:()=>n.NumberFlowLite});exports.NumberFlowGroup=p;exports.default=v;exports.useCanAnimate=w;
|
package/dist/index.mjs
CHANGED
|
@@ -1,90 +1,87 @@
|
|
|
1
|
-
import { defineComponent as w, provide as
|
|
2
|
-
import { NumberFlowLite as
|
|
1
|
+
import { defineComponent as w, provide as P, renderSlot as b, watch as M, nextTick as c, onUnmounted as B, ref as d, computed as p, inject as C, openBlock as A, createElementBlock as E, mergeProps as F, unref as g, onMounted as L, watchEffect as N, toValue as v } from "vue";
|
|
2
|
+
import { NumberFlowLite as r, partitionParts as $, render as k, define as G, canAnimate as h, prefersReducedMotion as f } from "number-flow";
|
|
3
3
|
import { NumberFlowLite as q } from "number-flow";
|
|
4
|
-
const
|
|
4
|
+
const T = Symbol(), W = /* @__PURE__ */ w({
|
|
5
5
|
__name: "NumberFlowGroup",
|
|
6
|
-
setup(
|
|
6
|
+
setup(s) {
|
|
7
7
|
const o = /* @__PURE__ */ new Set();
|
|
8
|
-
let
|
|
9
|
-
return
|
|
10
|
-
o.add(n),
|
|
11
|
-
|
|
8
|
+
let a = !1;
|
|
9
|
+
return P(T, (n, l) => {
|
|
10
|
+
o.add(n), M(
|
|
11
|
+
l,
|
|
12
12
|
async () => {
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
(
|
|
16
|
-
}), await
|
|
17
|
-
var t;
|
|
18
|
-
(t = e.value) == null || t.didUpdate();
|
|
19
|
-
}), i = !1);
|
|
13
|
+
a || (a = !0, o.forEach(async (e) => {
|
|
14
|
+
var u;
|
|
15
|
+
!e.value || !e.value.created || (e.value.willUpdate(), await c(), (u = e.value) == null || u.didUpdate());
|
|
16
|
+
}), await c(), a = !1);
|
|
20
17
|
}
|
|
21
18
|
// { flush: 'pre' } // default
|
|
22
19
|
), B(() => {
|
|
23
20
|
o.delete(n);
|
|
24
21
|
});
|
|
25
|
-
}), (n,
|
|
22
|
+
}), (n, l) => b(n.$slots, "default");
|
|
26
23
|
}
|
|
27
24
|
}), S = ["manual", "trend", "continuous", "animated", "transformTiming", "spinTiming", "opacityTiming", "respectMotionPreference", "data-will-change", "innerHTML", "parts"], j = /* @__PURE__ */ w({
|
|
28
25
|
inheritAttrs: !1,
|
|
29
26
|
__name: "index",
|
|
30
27
|
props: {
|
|
31
|
-
transformTiming: { default: () =>
|
|
32
|
-
spinTiming: { default: () =>
|
|
33
|
-
opacityTiming: { default: () =>
|
|
34
|
-
animated: { type: Boolean, default: () =>
|
|
35
|
-
respectMotionPreference: { type: Boolean, default: () =>
|
|
36
|
-
trend: { type: [Boolean, String], default: () =>
|
|
37
|
-
continuous: { type: Boolean, default: () =>
|
|
28
|
+
transformTiming: { default: () => r.defaultProps.transformTiming },
|
|
29
|
+
spinTiming: { default: () => r.defaultProps.spinTiming },
|
|
30
|
+
opacityTiming: { default: () => r.defaultProps.opacityTiming },
|
|
31
|
+
animated: { type: Boolean, default: () => r.defaultProps.animated },
|
|
32
|
+
respectMotionPreference: { type: Boolean, default: () => r.defaultProps.respectMotionPreference },
|
|
33
|
+
trend: { type: [Boolean, String], default: () => r.defaultProps.trend },
|
|
34
|
+
continuous: { type: Boolean, default: () => r.defaultProps.continuous },
|
|
38
35
|
locales: {},
|
|
39
36
|
format: {},
|
|
40
37
|
value: {},
|
|
41
38
|
willChange: { type: Boolean, default: !1 }
|
|
42
39
|
},
|
|
43
40
|
emits: ["animationsstart", "animationsfinish"],
|
|
44
|
-
setup(
|
|
45
|
-
const
|
|
46
|
-
o({ el:
|
|
47
|
-
const n =
|
|
48
|
-
return
|
|
41
|
+
setup(s, { expose: o, emit: a }) {
|
|
42
|
+
const i = d();
|
|
43
|
+
o({ el: i });
|
|
44
|
+
const n = a, l = p(() => new Intl.NumberFormat(s.locales, s.format)), e = p(() => $(s.value, l.value)), u = C(T, void 0);
|
|
45
|
+
return u == null || u(i, e), (t, m) => (A(), E("number-flow-vue", F({
|
|
49
46
|
ref_key: "el",
|
|
50
|
-
ref:
|
|
51
|
-
},
|
|
52
|
-
manual: !!
|
|
53
|
-
trend:
|
|
54
|
-
continuous:
|
|
55
|
-
animated:
|
|
56
|
-
transformTiming:
|
|
57
|
-
spinTiming:
|
|
58
|
-
opacityTiming:
|
|
59
|
-
respectMotionPreference:
|
|
60
|
-
"data-will-change":
|
|
61
|
-
innerHTML:
|
|
62
|
-
onAnimationsstart: m[0] || (m[0] = (
|
|
63
|
-
onAnimationsfinish: m[1] || (m[1] = (
|
|
47
|
+
ref: i
|
|
48
|
+
}, t.$attrs, {
|
|
49
|
+
manual: !!g(u),
|
|
50
|
+
trend: t.trend,
|
|
51
|
+
continuous: t.continuous,
|
|
52
|
+
animated: t.animated,
|
|
53
|
+
transformTiming: t.transformTiming,
|
|
54
|
+
spinTiming: t.spinTiming,
|
|
55
|
+
opacityTiming: t.opacityTiming,
|
|
56
|
+
respectMotionPreference: t.respectMotionPreference,
|
|
57
|
+
"data-will-change": t.willChange ? "" : void 0,
|
|
58
|
+
innerHTML: g(k)({ formatted: e.value.formatted, willChange: t.willChange }),
|
|
59
|
+
onAnimationsstart: m[0] || (m[0] = (y) => n("animationsstart")),
|
|
60
|
+
onAnimationsfinish: m[1] || (m[1] = (y) => n("animationsfinish")),
|
|
64
61
|
parts: e.value
|
|
65
62
|
}), null, 16, S));
|
|
66
63
|
}
|
|
67
64
|
});
|
|
68
|
-
G("number-flow-vue",
|
|
65
|
+
G("number-flow-vue", r);
|
|
69
66
|
function I({
|
|
70
|
-
respectMotionPreference:
|
|
67
|
+
respectMotionPreference: s = !0
|
|
71
68
|
} = {}) {
|
|
72
|
-
const o = d(
|
|
69
|
+
const o = d(h), a = d(!1);
|
|
73
70
|
return L(() => {
|
|
74
|
-
var
|
|
75
|
-
o.value =
|
|
76
|
-
}), N((
|
|
77
|
-
var
|
|
78
|
-
if (!
|
|
71
|
+
var i;
|
|
72
|
+
o.value = h, a.value = ((i = f) == null ? void 0 : i.matches) ?? !1;
|
|
73
|
+
}), N((i) => {
|
|
74
|
+
var l;
|
|
75
|
+
if (!v(s)) return;
|
|
79
76
|
const n = ({ matches: e }) => {
|
|
80
|
-
|
|
77
|
+
a.value = e;
|
|
81
78
|
};
|
|
82
|
-
(
|
|
79
|
+
(l = f) == null || l.addEventListener("change", n), i(() => {
|
|
83
80
|
var e;
|
|
84
81
|
(e = f) == null || e.removeEventListener("change", n);
|
|
85
82
|
});
|
|
86
83
|
}), p(
|
|
87
|
-
() => o.value && (!
|
|
84
|
+
() => o.value && (!v(s) || !a.value)
|
|
88
85
|
);
|
|
89
86
|
}
|
|
90
87
|
export {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.2.
|
|
6
|
+
"version": "0.2.3",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Maxwell Barvian",
|
|
9
9
|
"email": "max@barvian.me",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"number-flow": "0.3.
|
|
46
|
+
"number-flow": "0.3.7"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@playwright/test": "^1.48.0",
|