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