geekin-devtoys 0.0.2 → 0.0.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/lib/Demo/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),a=(e,s)=>{const o=e.__vccOpts||e;for(const[c,r]of s)o[c]=r;return o},_={class:"demo"},i=Object.assign({name:"Demo"},{__name:"index",props:{msg:String},setup(e){return(s,o)=>(n.openBlock(),n.createElementBlock("div",_,n.toDisplayString(e.msg),1))}}),t=a(i,[["__scopeId","data-v-bd7af65f"]]);t.install=e=>{e.component(t.name,t)};exports.Demo=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),a=(e,s)=>{const o=e.__vccOpts||e;for(const[c,r]of s)o[c]=r;return o},_={class:"demo"},i=Object.assign({name:"Demo"},{__name:"index",props:{msg:String},setup(e){return(s,o)=>(n.openBlock(),n.createElementBlock("div",_,n.toDisplayString(e.msg),1))}}),t=a(i,[["__scopeId","data-v-bd7af65f"]]);t.install=e=>{e.component(t.name,t)};exports.Demo=t;exports.default=t;
@@ -1,4 +1,4 @@
1
- import { createElementBlock as r, openBlock as a, toDisplayString as _ } from "vue";
1
+ import { createElementBlock as a, openBlock as r, toDisplayString as _ } from "vue";
2
2
  const m = (t, n) => {
3
3
  const e = t.__vccOpts || t;
4
4
  for (const [s, c] of n)
@@ -12,12 +12,13 @@ const m = (t, n) => {
12
12
  msg: String
13
13
  },
14
14
  setup(t) {
15
- return (n, e) => (a(), r("div", p, _(t.msg), 1));
15
+ return (n, e) => (r(), a("div", p, _(t.msg), 1));
16
16
  }
17
17
  }), o = /* @__PURE__ */ m(i, [["__scopeId", "data-v-bd7af65f"]]);
18
18
  o.install = (t) => {
19
19
  t.component(o.name, o);
20
20
  };
21
21
  export {
22
- o as Demo
22
+ o as Demo,
23
+ o as default
23
24
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),i=t.defineComponent({name:"GCount",__name:"index",props:{to:{},from:{default:0},direction:{default:"up"},delay:{default:0},duration:{default:2},className:{default:""},startWhen:{type:Boolean,default:!0},separator:{default:""},onStart:{},onEnd:{}},setup(p){const e=p,o=t.useTemplateRef("elementRef"),r=t.ref(e.direction==="down"?e.to:e.from),c=t.ref(!1),n=t.ref(null),m=t.ref(!1);let s=null;const h=t.computed(()=>20+40*(1/e.duration)),F=t.computed(()=>100*(1/e.duration));let u=0;const _=a=>{const l={useGrouping:!!e.separator,minimumFractionDigits:0,maximumFractionDigits:0},f=Intl.NumberFormat("en-US",l).format(Number(a.toFixed(0)));return e.separator?f.replace(/,/g,e.separator):f},d=()=>{o.value&&(o.value.textContent=_(r.value))},v=a=>{const l=e.direction==="down"?e.from:e.to,f=r.value,b=l-f,S=b*F.value,I=u*h.value,M=S-I;u+=M*.016,r.value+=u*.016,d(),Math.abs(b)>.01||Math.abs(u)>.01?n.value=requestAnimationFrame(v):(r.value=l,d(),n.value=null,e.onEnd&&e.onEnd())},g=()=>{m.value||!c.value||!e.startWhen||(m.value=!0,e.onStart&&e.onStart(),setTimeout(()=>{u=0,n.value=requestAnimationFrame(v)},e.delay*1e3))},w=()=>{o.value&&(s=new IntersectionObserver(([a])=>{a.isIntersecting&&!c.value&&(c.value=!0,g())},{threshold:0,rootMargin:"0px"}),s.observe(o.value))},y=()=>{n.value&&(cancelAnimationFrame(n.value),n.value=null),s&&(s.disconnect(),s=null)};return t.watch([()=>e.from,()=>e.to,()=>e.direction],()=>{r.value=e.direction==="down"?e.to:e.from,d(),m.value=!1},{immediate:!0}),t.watch(()=>e.startWhen,()=>{e.startWhen&&c.value&&!m.value&&g()}),t.onMounted(()=>{d(),w()}),t.onUnmounted(()=>{y()}),(a,l)=>(t.openBlock(),t.createElementBlock("span",{ref_key:"elementRef",ref:o,class:t.normalizeClass(a.className)},null,2))}});i.install=p=>{p.component(i.name,i)};exports.GCount=i;exports.default=i;
@@ -1,6 +1,6 @@
1
- import { defineComponent as S, useTemplateRef as E, ref as f, computed as b, watch as F, onMounted as M, onUnmounted as R, createElementBlock as U, openBlock as W, normalizeClass as k } from "vue";
1
+ import { defineComponent as S, useTemplateRef as E, ref as f, computed as b, watch as F, onMounted as M, onUnmounted as R, createElementBlock as W, openBlock as k, normalizeClass as B } from "vue";
2
2
  const p = /* @__PURE__ */ S({
3
- name: "GCountUp",
3
+ name: "GCount",
4
4
  __name: "index",
5
5
  props: {
6
6
  to: {},
@@ -63,10 +63,10 @@ const p = /* @__PURE__ */ S({
63
63
  c(), I();
64
64
  }), R(() => {
65
65
  N();
66
- }), (n, l) => (W(), U("span", {
66
+ }), (n, l) => (k(), W("span", {
67
67
  ref_key: "elementRef",
68
68
  ref: a,
69
- class: k(n.className)
69
+ class: B(n.className)
70
70
  }, null, 2));
71
71
  }
72
72
  });
@@ -74,5 +74,6 @@ p.install = (d) => {
74
74
  d.component(p.name, p);
75
75
  };
76
76
  export {
77
- p as CountUp
77
+ p as GCount,
78
+ p as default
78
79
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../Demo/index.js"),n=require("../CountUp/index.js"),o={Demo:t.Demo,CountUp:n.CountUp},s=u=>{Object.keys(o).forEach(c=>{const e=o[c];u.component(e.name,e)})},m={install:s};exports.Demo=t.Demo;exports.CountUp=n.CountUp;exports.default=m;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../Demo/index.js"),n=require("../GCount/index.js"),t={Demo:o.default,GCount:n.default},s=u=>{Object.keys(t).forEach(c=>{const e=t[c];u.component(e.name,e)})},l={install:s};exports.Demo=o.default;exports.GCount=n.default;exports.default=l;
@@ -1,13 +1,13 @@
1
- import { Demo as c } from "../Demo/index.mjs";
2
- import { CountUp as e } from "../CountUp/index.mjs";
3
- const n = { Demo: c, CountUp: e }, m = (t) => {
4
- Object.keys(n).forEach((s) => {
5
- const o = n[s];
1
+ import e from "../Demo/index.mjs";
2
+ import m from "../GCount/index.mjs";
3
+ const n = { Demo: e, GCount: m }, s = (t) => {
4
+ Object.keys(n).forEach((c) => {
5
+ const o = n[c];
6
6
  t.component(o.name, o);
7
7
  });
8
- }, r = { install: m };
8
+ }, r = { install: s };
9
9
  export {
10
- e as CountUp,
11
- c as Demo,
10
+ e as Demo,
11
+ m as GCount,
12
12
  r as default
13
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geekin-devtoys",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "author": "leon",
5
5
  "license": "MIT",
6
6
  "description": "geekin-devtoys组件库",
@@ -13,13 +13,13 @@
13
13
  "lib": "vite build && node update-exports.js"
14
14
  },
15
15
  "devDependencies": {
16
- "vite-plugin-dts": "^4.5.4",
17
16
  "@babel/core": "^7.12.16",
18
17
  "core-js": "^3.8.3",
19
18
  "file-loader": "^6.2.0",
20
19
  "rollup-plugin-visualizer": "^6.0.1",
21
- "vite-plugin-libcss": "^1.1.1",
22
- "tsx": "^4.19.1"
20
+ "tsx": "^4.19.1",
21
+ "vite-plugin-dts": "^4.5.4",
22
+ "vite-plugin-libcss": "^1.1.1"
23
23
  },
24
24
  "browserslist": [
25
25
  "> 1%",
@@ -35,14 +35,6 @@
35
35
  "import": "./lib/index/style.css",
36
36
  "require": "./lib/index/style.css"
37
37
  },
38
- "./CountUp": {
39
- "import": "./lib/CountUp/index.mjs",
40
- "require": "./lib/CountUp/index.js"
41
- },
42
- "./CountUp/style": {
43
- "import": "./lib/CountUp/style.css",
44
- "require": "./lib/CountUp/style.css"
45
- },
46
38
  "./Demo": {
47
39
  "import": "./lib/Demo/index.mjs",
48
40
  "require": "./lib/Demo/index.js"
@@ -50,6 +42,14 @@
50
42
  "./Demo/style": {
51
43
  "import": "./lib/Demo/style.css",
52
44
  "require": "./lib/Demo/style.css"
45
+ },
46
+ "./GCount": {
47
+ "import": "./lib/GCount/index.mjs",
48
+ "require": "./lib/GCount/index.js"
49
+ },
50
+ "./GCount/style": {
51
+ "import": "./lib/GCount/style.css",
52
+ "require": "./lib/GCount/style.css"
53
53
  }
54
54
  }
55
55
  }
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),d=t.defineComponent({name:"GCountUp",__name:"index",props:{to:{},from:{default:0},direction:{default:"up"},delay:{default:0},duration:{default:2},className:{default:""},startWhen:{type:Boolean,default:!0},separator:{default:""},onStart:{},onEnd:{}},setup(p){const e=p,o=t.useTemplateRef("elementRef"),r=t.ref(e.direction==="down"?e.to:e.from),i=t.ref(!1),n=t.ref(null),c=t.ref(!1);let s=null;const h=t.computed(()=>20+40*(1/e.duration)),F=t.computed(()=>100*(1/e.duration));let u=0;const y=a=>{const l={useGrouping:!!e.separator,minimumFractionDigits:0,maximumFractionDigits:0},f=Intl.NumberFormat("en-US",l).format(Number(a.toFixed(0)));return e.separator?f.replace(/,/g,e.separator):f},m=()=>{o.value&&(o.value.textContent=y(r.value))},v=a=>{const l=e.direction==="down"?e.from:e.to,f=r.value,b=l-f,I=b*F.value,N=u*h.value,_=I-N;u+=_*.016,r.value+=u*.016,m(),Math.abs(b)>.01||Math.abs(u)>.01?n.value=requestAnimationFrame(v):(r.value=l,m(),n.value=null,e.onEnd&&e.onEnd())},g=()=>{c.value||!i.value||!e.startWhen||(c.value=!0,e.onStart&&e.onStart(),setTimeout(()=>{u=0,n.value=requestAnimationFrame(v)},e.delay*1e3))},w=()=>{o.value&&(s=new IntersectionObserver(([a])=>{a.isIntersecting&&!i.value&&(i.value=!0,g())},{threshold:0,rootMargin:"0px"}),s.observe(o.value))},S=()=>{n.value&&(cancelAnimationFrame(n.value),n.value=null),s&&(s.disconnect(),s=null)};return t.watch([()=>e.from,()=>e.to,()=>e.direction],()=>{r.value=e.direction==="down"?e.to:e.from,m(),c.value=!1},{immediate:!0}),t.watch(()=>e.startWhen,()=>{e.startWhen&&i.value&&!c.value&&g()}),t.onMounted(()=>{m(),w()}),t.onUnmounted(()=>{S()}),(a,l)=>(t.openBlock(),t.createElementBlock("span",{ref_key:"elementRef",ref:o,class:t.normalizeClass(a.className)},null,2))}});d.install=p=>{p.component(d.name,d)};exports.CountUp=d;
File without changes