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