@number-flow/vue 0.1.1 → 0.2.1
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 +7 -7
- package/dist/index.js +1 -1
- package/dist/index.mjs +14 -13
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ComputedRef } from 'vue';
|
|
|
4
4
|
import { DefineComponent } from 'vue';
|
|
5
5
|
import { Format } from 'number-flow';
|
|
6
6
|
import { MaybeRefOrGetter } from 'vue';
|
|
7
|
-
import { NumberFlowLite } from 'number-flow';
|
|
7
|
+
import { NumberFlowLite as NumberFlowElement } from 'number-flow';
|
|
8
8
|
import { Props as Props_2 } from 'number-flow';
|
|
9
9
|
import { PublicProps } from 'vue';
|
|
10
10
|
import { Ref } from 'vue';
|
|
@@ -12,19 +12,19 @@ import { Trend } from 'number-flow';
|
|
|
12
12
|
import { Value } from 'number-flow';
|
|
13
13
|
|
|
14
14
|
declare const _default: DefineComponent<Props, {
|
|
15
|
-
el: Ref<
|
|
15
|
+
el: Ref<NumberFlowElement | undefined, NumberFlowElement | undefined>;
|
|
16
16
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
animationsstart: () => any;
|
|
18
|
+
animationsfinish: () => any;
|
|
19
19
|
}, string, PublicProps, Readonly<Props> & Readonly<{
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
onAnimationsstart?: (() => any) | undefined;
|
|
21
|
+
onAnimationsfinish?: (() => any) | undefined;
|
|
22
22
|
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
23
23
|
export default _default;
|
|
24
24
|
|
|
25
25
|
export { Format }
|
|
26
26
|
|
|
27
|
-
export {
|
|
27
|
+
export { NumberFlowElement }
|
|
28
28
|
|
|
29
29
|
declare type Props = Partial<Props_2> & {
|
|
30
30
|
locales?: Intl.LocalesArgument;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),e=require("number-flow"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),e=require("number-flow"),d=["trend","continuous","animated","transformTiming","spinTiming","opacityTiming","respectMotionPreference","data-will-change","innerHTML","parts"],c=n.defineComponent({inheritAttrs:!1,__name:"index",props:{transformTiming:{default:()=>e.NumberFlowLite.defaultProps.transformTiming},spinTiming:{default:()=>e.NumberFlowLite.defaultProps.spinTiming},opacityTiming:{default:()=>e.NumberFlowLite.defaultProps.opacityTiming},animated:{type:Boolean,default:()=>e.NumberFlowLite.defaultProps.animated},respectMotionPreference:{type:Boolean,default:()=>e.NumberFlowLite.defaultProps.respectMotionPreference},trend:{type:[Boolean,String],default:()=>e.NumberFlowLite.defaultProps.trend},continuous:{type:Boolean,default:()=>e.NumberFlowLite.defaultProps.continuous},locales:{},format:{},value:{},willChange:{type:Boolean,default:!1}},emits:["animationsstart","animationsfinish"],setup(a,{expose:l,emit:r}){const i=n.ref();l({el:i});const u=r,s=n.computed(()=>new Intl.NumberFormat(a.locales,a.format)),o=n.computed(()=>e.partitionParts(a.value,s.value));return(t,m)=>(n.openBlock(),n.createElementBlock("number-flow-vue",n.mergeProps({ref_key:"el",ref:i},t.$attrs,{trend:t.trend,continuous:t.continuous,animated:t.animated,transformTiming:t.transformTiming,spinTiming:t.spinTiming,opacityTiming:t.opacityTiming,respectMotionPreference:t.respectMotionPreference,"data-will-change":t.willChange?"":void 0,innerHTML:n.unref(e.render)({formatted:o.value.formatted,willChange:t.willChange}),onAnimationsstart:m[0]||(m[0]=f=>u("animationsstart")),onAnimationsfinish:m[1]||(m[1]=f=>u("animationsfinish")),parts:o.value}),null,16,d))}});e.define("number-flow-vue",e.NumberFlowLite);function p({respectMotionPreference:a=!0}={}){const l=n.ref(e.canAnimate),r=n.ref(!1);return n.onMounted(()=>{var i;l.value=e.canAnimate,r.value=((i=e.prefersReducedMotion)==null?void 0:i.matches)??!1}),n.watchEffect(i=>{var s;if(!n.toValue(a))return;const u=({matches:o})=>{r.value=o};(s=e.prefersReducedMotion)==null||s.addEventListener("change",u),i(()=>{var o;(o=e.prefersReducedMotion)==null||o.removeEventListener("change",u)})}),n.computed(()=>l.value&&(!n.toValue(a)||!r.value))}Object.defineProperty(exports,"NumberFlowElement",{enumerable:!0,get:()=>e.NumberFlowLite});exports.default=c;exports.useCanAnimate=p;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { NumberFlowLite as n, partitionParts as B, render as C, canAnimate as c, prefersReducedMotion as u } from "number-flow";
|
|
3
|
-
|
|
1
|
+
import { defineComponent as v, ref as f, computed as d, openBlock as T, createElementBlock as h, mergeProps as w, unref as P, onMounted as y, watchEffect as M, toValue as p } from "vue";
|
|
2
|
+
import { NumberFlowLite as n, partitionParts as B, render as C, define as b, canAnimate as c, prefersReducedMotion as u } from "number-flow";
|
|
3
|
+
import { NumberFlowLite as H } from "number-flow";
|
|
4
|
+
const A = ["trend", "continuous", "animated", "transformTiming", "spinTiming", "opacityTiming", "respectMotionPreference", "data-will-change", "innerHTML", "parts"], F = /* @__PURE__ */ v({
|
|
4
5
|
inheritAttrs: !1,
|
|
5
6
|
__name: "index",
|
|
6
7
|
props: {
|
|
@@ -8,7 +9,6 @@ const A = ["trend", "continuous", "animated", "transformTiming", "spinTiming", "
|
|
|
8
9
|
spinTiming: { default: () => n.defaultProps.spinTiming },
|
|
9
10
|
opacityTiming: { default: () => n.defaultProps.opacityTiming },
|
|
10
11
|
animated: { type: Boolean, default: () => n.defaultProps.animated },
|
|
11
|
-
manual: { type: Boolean },
|
|
12
12
|
respectMotionPreference: { type: Boolean, default: () => n.defaultProps.respectMotionPreference },
|
|
13
13
|
trend: { type: [Boolean, String], default: () => n.defaultProps.trend },
|
|
14
14
|
continuous: { type: Boolean, default: () => n.defaultProps.continuous },
|
|
@@ -17,12 +17,12 @@ const A = ["trend", "continuous", "animated", "transformTiming", "spinTiming", "
|
|
|
17
17
|
value: {},
|
|
18
18
|
willChange: { type: Boolean, default: !1 }
|
|
19
19
|
},
|
|
20
|
-
emits: ["
|
|
20
|
+
emits: ["animationsstart", "animationsfinish"],
|
|
21
21
|
setup(i, { expose: s, emit: o }) {
|
|
22
22
|
const t = f();
|
|
23
23
|
s({ el: t });
|
|
24
24
|
const r = o, l = d(() => new Intl.NumberFormat(i.locales, i.format)), a = d(() => B(i.value, l.value));
|
|
25
|
-
return (e, m) => (
|
|
25
|
+
return (e, m) => (T(), h("number-flow-vue", w({
|
|
26
26
|
ref_key: "el",
|
|
27
27
|
ref: t
|
|
28
28
|
}, e.$attrs, {
|
|
@@ -34,19 +34,19 @@ const A = ["trend", "continuous", "animated", "transformTiming", "spinTiming", "
|
|
|
34
34
|
opacityTiming: e.opacityTiming,
|
|
35
35
|
respectMotionPreference: e.respectMotionPreference,
|
|
36
36
|
"data-will-change": e.willChange ? "" : void 0,
|
|
37
|
-
innerHTML:
|
|
38
|
-
onAnimationsstart: m[0] || (m[0] = (g) => r("
|
|
39
|
-
onAnimationsfinish: m[1] || (m[1] = (g) => r("
|
|
37
|
+
innerHTML: P(C)({ formatted: a.value.formatted, willChange: e.willChange }),
|
|
38
|
+
onAnimationsstart: m[0] || (m[0] = (g) => r("animationsstart")),
|
|
39
|
+
onAnimationsfinish: m[1] || (m[1] = (g) => r("animationsfinish")),
|
|
40
40
|
parts: a.value
|
|
41
41
|
}), null, 16, A));
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
-
n
|
|
45
|
-
function
|
|
44
|
+
b("number-flow-vue", n);
|
|
45
|
+
function N({
|
|
46
46
|
respectMotionPreference: i = !0
|
|
47
47
|
} = {}) {
|
|
48
48
|
const s = f(c), o = f(!1);
|
|
49
|
-
return
|
|
49
|
+
return y(() => {
|
|
50
50
|
var t;
|
|
51
51
|
s.value = c, o.value = ((t = u) == null ? void 0 : t.matches) ?? !1;
|
|
52
52
|
}), M((t) => {
|
|
@@ -64,6 +64,7 @@ function $({
|
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
66
|
export {
|
|
67
|
+
H as NumberFlowElement,
|
|
67
68
|
F as default,
|
|
68
|
-
|
|
69
|
+
N as useCanAnimate
|
|
69
70
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.2.1",
|
|
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.6"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@playwright/test": "^1.48.0",
|