geekin-devtoys 0.1.7 → 0.1.9

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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),I=require("../_plugin-vue_export-helper-BHFhmbuH.js"),p=new WeakMap,V=(...e)=>{var t;const i=e[0],n=(t=o.getCurrentInstance())===null||t===void 0?void 0:t.proxy,u=n??o.getCurrentScope();if(u==null&&!o.hasInjectionContext())throw new Error("injectLocal must be called in setup");return u&&p.has(u)&&i in p.get(u)?p.get(u)[i]:o.inject(...e)},W=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const M=Object.prototype.toString,T=e=>M.call(e)==="[object Object]",y=()=>{};function x(e,t){function i(...n){return new Promise((u,r)=>{Promise.resolve(e(()=>t.apply(this,n),{fn:t,thisArg:this,args:n})).then(u).catch(r)})}return i}function E(e,t={}){let i,n,u=y;const r=a=>{clearTimeout(a),u(),u=y};let l;return a=>{const c=o.toValue(e),f=o.toValue(t.maxWait);return i&&r(i),c<=0||f!==void 0&&f<=0?(n&&(r(n),n=void 0),Promise.resolve(a())):new Promise((d,m)=>{u=t.rejectOnCancel?m:d,l=a,f&&!n&&(n=setTimeout(()=>{i&&r(i),n=void 0,d(l())},f)),i=setTimeout(()=>{n&&r(n),n=void 0,d(a())},c)})}}function S(e){return e.endsWith("rem")?Number.parseFloat(e)*16:Number.parseFloat(e)}function w(e){return Array.isArray(e)?e:[e]}function j(e){return o.getCurrentInstance()}function C(e,t=200,i={}){return x(E(t,i),e)}function N(e,t=!0,i){j()?o.onMounted(e,i):t?e():o.nextTick(e)}function _(e,t,i){return o.watch(e,t,{...i,immediate:!0})}const g=W?window:void 0;function O(e){var t;const i=o.toValue(e);return(t=i?.$el)!==null&&t!==void 0?t:i}function b(...e){const t=(n,u,r,l)=>(n.addEventListener(u,r,l),()=>n.removeEventListener(u,r,l)),i=o.computed(()=>{const n=w(o.toValue(e[0])).filter(u=>u!=null);return n.every(u=>typeof u!="string")?n:void 0});return _(()=>{var n,u;return[(n=(u=i.value)===null||u===void 0?void 0:u.map(r=>O(r)))!==null&&n!==void 0?n:[g].filter(r=>r!=null),w(o.toValue(i.value?e[1]:e[0])),w(o.unref(i.value?e[2]:e[1])),o.toValue(i.value?e[3]:e[2])]},([n,u,r,l],s,a)=>{if(!n?.length||!u?.length||!r?.length)return;const c=T(l)?{...l}:l,f=n.flatMap(d=>u.flatMap(m=>r.map(h=>t(d,m,h,c))));a(()=>{f.forEach(d=>d())})},{flush:"post"})}function P(){const e=o.shallowRef(!1),t=o.getCurrentInstance();return t&&o.onMounted(()=>{e.value=!0},t),e}function R(e){const t=P();return o.computed(()=>(t.value,!!e()))}const $=Symbol("vueuse-ssr-width");function F(){const e=o.hasInjectionContext()?V($,null):null;return typeof e=="number"?e:void 0}function k(e,t={}){const{window:i=g,ssrWidth:n=F()}=t,u=R(()=>i&&"matchMedia"in i&&typeof i.matchMedia=="function"),r=o.shallowRef(typeof n=="number"),l=o.shallowRef(),s=o.shallowRef(!1),a=c=>{s.value=c.matches};return o.watchEffect(()=>{if(r.value){r.value=!u.value,s.value=o.toValue(e).split(",").some(c=>{const f=c.includes("not all"),d=c.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/),m=c.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);let h=!!(d||m);return d&&h&&(h=n>=S(d[1])),m&&h&&(h=n<=S(m[1])),f?!h:h});return}u.value&&(l.value=i.matchMedia(o.toValue(e)),s.value=l.value.matches)}),b(l,"change",a,{passive:!0}),o.computed(()=>s.value)}function z(e={}){const{window:t=g,initialWidth:i=Number.POSITIVE_INFINITY,initialHeight:n=Number.POSITIVE_INFINITY,listenOrientation:u=!0,includeScrollbar:r=!0,type:l="inner"}=e,s=o.shallowRef(i),a=o.shallowRef(n),c=()=>{if(t)if(l==="outer")s.value=t.outerWidth,a.value=t.outerHeight;else if(l==="visual"&&t.visualViewport){const{width:d,height:m,scale:h}=t.visualViewport;s.value=Math.round(d*h),a.value=Math.round(m*h)}else r?(s.value=t.innerWidth,a.value=t.innerHeight):(s.value=t.document.documentElement.clientWidth,a.value=t.document.documentElement.clientHeight)};c(),N(c);const f={passive:!0};return b("resize",c,f),t&&l==="visual"&&t.visualViewport&&b(t.visualViewport,"resize",c,f),u&&o.watch(k("(orientation: portrait)"),()=>c()),{width:s,height:a}}const H={class:"g-screen-container"},L=o.defineComponent({name:"GScreen",inheritAttrs:!1,__name:"index",props:{width:{default:()=>"1920"},height:{default:()=>"1080"},debounceDelay:{default:()=>"166"}},setup(e){const t=e,{width:i,height:n}=z(),u=()=>({x:i.value/Number(t.width),y:n.value/Number(t.height)}),r=o.computed(u),l=o.computed(()=>({width:`${t.width}px`,height:`${100/r.value.x}vh`,transform:`scale(${r.value.x})`,transformOrigin:"0 0"})),s=C(()=>{},Number(t.debounceDelay));return o.watch([i,n],s,{deep:!0}),(a,c)=>(o.openBlock(),o.createElementBlock("div",H,[o.createElementVNode("div",{style:o.normalizeStyle(l.value)},[o.renderSlot(a.$slots,"default",{},void 0,!0)],4)]))}}),v=I._export_sfc(L,[["__scopeId","data-v-01f611a2"]]);v.install=e=>{e.component(v.name,v)};exports.GScreen=v;exports.default=v;
@@ -0,0 +1,176 @@
1
+ import { onMounted as x, nextTick as N, getCurrentInstance as g, watch as W, getCurrentScope as V, hasInjectionContext as E, inject as j, toValue as h, shallowRef as v, computed as p, watchEffect as O, unref as P, defineComponent as C, createElementBlock as _, openBlock as $, createElementVNode as F, normalizeStyle as k, renderSlot as z } from "vue";
2
+ import { _ as L } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
3
+ const w = /* @__PURE__ */ new WeakMap(), A = /* @__NO_SIDE_EFFECTS__ */ (...e) => {
4
+ var t;
5
+ const i = e[0], n = (t = g()) === null || t === void 0 ? void 0 : t.proxy, o = n ?? V();
6
+ if (o == null && !E()) throw new Error("injectLocal must be called in setup");
7
+ return o && w.has(o) && i in w.get(o) ? w.get(o)[i] : j(...e);
8
+ }, H = typeof window < "u" && typeof document < "u";
9
+ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
10
+ const B = Object.prototype.toString, D = (e) => B.call(e) === "[object Object]", M = () => {
11
+ };
12
+ function G(e, t) {
13
+ function i(...n) {
14
+ return new Promise((o, r) => {
15
+ Promise.resolve(e(() => t.apply(this, n), {
16
+ fn: t,
17
+ thisArg: this,
18
+ args: n
19
+ })).then(o).catch(r);
20
+ });
21
+ }
22
+ return i;
23
+ }
24
+ function R(e, t = {}) {
25
+ let i, n, o = M;
26
+ const r = (l) => {
27
+ clearTimeout(l), o(), o = M;
28
+ };
29
+ let u;
30
+ return (l) => {
31
+ const a = h(e), d = h(t.maxWait);
32
+ return i && r(i), a <= 0 || d !== void 0 && d <= 0 ? (n && (r(n), n = void 0), Promise.resolve(l())) : new Promise((s, m) => {
33
+ o = t.rejectOnCancel ? m : s, u = l, d && !n && (n = setTimeout(() => {
34
+ i && r(i), n = void 0, s(u());
35
+ }, d)), i = setTimeout(() => {
36
+ n && r(n), n = void 0, s(l());
37
+ }, a);
38
+ });
39
+ };
40
+ }
41
+ function T(e) {
42
+ return e.endsWith("rem") ? Number.parseFloat(e) * 16 : Number.parseFloat(e);
43
+ }
44
+ function b(e) {
45
+ return Array.isArray(e) ? e : [e];
46
+ }
47
+ function Q(e) {
48
+ return g();
49
+ }
50
+ // @__NO_SIDE_EFFECTS__
51
+ function Y(e, t = 200, i = {}) {
52
+ return G(R(t, i), e);
53
+ }
54
+ function U(e, t = !0, i) {
55
+ Q() ? x(e, i) : t ? e() : N(e);
56
+ }
57
+ function J(e, t, i) {
58
+ return W(e, t, {
59
+ ...i,
60
+ immediate: !0
61
+ });
62
+ }
63
+ const I = H ? window : void 0;
64
+ function K(e) {
65
+ var t;
66
+ const i = h(e);
67
+ return (t = i?.$el) !== null && t !== void 0 ? t : i;
68
+ }
69
+ function S(...e) {
70
+ const t = (n, o, r, u) => (n.addEventListener(o, r, u), () => n.removeEventListener(o, r, u)), i = p(() => {
71
+ const n = b(h(e[0])).filter((o) => o != null);
72
+ return n.every((o) => typeof o != "string") ? n : void 0;
73
+ });
74
+ return J(() => {
75
+ var n, o;
76
+ return [
77
+ (n = (o = i.value) === null || o === void 0 ? void 0 : o.map((r) => K(r))) !== null && n !== void 0 ? n : [I].filter((r) => r != null),
78
+ b(h(i.value ? e[1] : e[0])),
79
+ b(P(i.value ? e[2] : e[1])),
80
+ h(i.value ? e[3] : e[2])
81
+ ];
82
+ }, ([n, o, r, u], c, l) => {
83
+ if (!n?.length || !o?.length || !r?.length) return;
84
+ const a = D(u) ? { ...u } : u, d = n.flatMap((s) => o.flatMap((m) => r.map((f) => t(s, m, f, a))));
85
+ l(() => {
86
+ d.forEach((s) => s());
87
+ });
88
+ }, { flush: "post" });
89
+ }
90
+ // @__NO_SIDE_EFFECTS__
91
+ function X() {
92
+ const e = v(!1), t = g();
93
+ return t && x(() => {
94
+ e.value = !0;
95
+ }, t), e;
96
+ }
97
+ // @__NO_SIDE_EFFECTS__
98
+ function Z(e) {
99
+ const t = /* @__PURE__ */ X();
100
+ return p(() => (t.value, !!e()));
101
+ }
102
+ const q = /* @__PURE__ */ Symbol("vueuse-ssr-width");
103
+ // @__NO_SIDE_EFFECTS__
104
+ function ee() {
105
+ const e = E() ? /* @__PURE__ */ A(q, null) : null;
106
+ return typeof e == "number" ? e : void 0;
107
+ }
108
+ function te(e, t = {}) {
109
+ const { window: i = I, ssrWidth: n = /* @__PURE__ */ ee() } = t, o = /* @__PURE__ */ Z(() => i && "matchMedia" in i && typeof i.matchMedia == "function"), r = v(typeof n == "number"), u = v(), c = v(!1), l = (a) => {
110
+ c.value = a.matches;
111
+ };
112
+ return O(() => {
113
+ if (r.value) {
114
+ r.value = !o.value, c.value = h(e).split(",").some((a) => {
115
+ const d = a.includes("not all"), s = a.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), m = a.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
116
+ let f = !!(s || m);
117
+ return s && f && (f = n >= T(s[1])), m && f && (f = n <= T(m[1])), d ? !f : f;
118
+ });
119
+ return;
120
+ }
121
+ o.value && (u.value = i.matchMedia(h(e)), c.value = u.value.matches);
122
+ }), S(u, "change", l, { passive: !0 }), p(() => c.value);
123
+ }
124
+ // @__NO_SIDE_EFFECTS__
125
+ function ne(e = {}) {
126
+ const { window: t = I, initialWidth: i = Number.POSITIVE_INFINITY, initialHeight: n = Number.POSITIVE_INFINITY, listenOrientation: o = !0, includeScrollbar: r = !0, type: u = "inner" } = e, c = v(i), l = v(n), a = () => {
127
+ if (t) if (u === "outer")
128
+ c.value = t.outerWidth, l.value = t.outerHeight;
129
+ else if (u === "visual" && t.visualViewport) {
130
+ const { width: s, height: m, scale: f } = t.visualViewport;
131
+ c.value = Math.round(s * f), l.value = Math.round(m * f);
132
+ } else r ? (c.value = t.innerWidth, l.value = t.innerHeight) : (c.value = t.document.documentElement.clientWidth, l.value = t.document.documentElement.clientHeight);
133
+ };
134
+ a(), U(a);
135
+ const d = { passive: !0 };
136
+ return S("resize", a, d), t && u === "visual" && t.visualViewport && S(t.visualViewport, "resize", a, d), o && W(te("(orientation: portrait)"), () => a()), {
137
+ width: c,
138
+ height: l
139
+ };
140
+ }
141
+ const ie = { class: "g-screen-container" }, oe = /* @__PURE__ */ C({
142
+ name: "GScreen",
143
+ inheritAttrs: !1,
144
+ __name: "index",
145
+ props: {
146
+ width: { default: () => "1920" },
147
+ height: { default: () => "1080" },
148
+ debounceDelay: { default: () => "166" }
149
+ },
150
+ setup(e) {
151
+ const t = e, { width: i, height: n } = /* @__PURE__ */ ne(), r = p(() => ({
152
+ x: i.value / Number(t.width),
153
+ y: n.value / Number(t.height)
154
+ })), u = p(() => ({
155
+ width: `${t.width}px`,
156
+ height: `${100 / r.value.x}vh`,
157
+ transform: `scale(${r.value.x})`,
158
+ transformOrigin: "0 0"
159
+ })), c = /* @__PURE__ */ Y(() => {
160
+ }, Number(t.debounceDelay));
161
+ return W([i, n], c, { deep: !0 }), (l, a) => ($(), _("div", ie, [
162
+ F("div", {
163
+ style: k(u.value)
164
+ }, [
165
+ z(l.$slots, "default", {}, void 0, !0)
166
+ ], 4)
167
+ ]));
168
+ }
169
+ }), y = /* @__PURE__ */ L(oe, [["__scopeId", "data-v-01f611a2"]]);
170
+ y.install = (e) => {
171
+ e.component(y.name, y);
172
+ };
173
+ export {
174
+ y as GScreen,
175
+ y as default
176
+ };
@@ -0,0 +1 @@
1
+ .g-screen-container[data-v-01f611a2]{width:100%;height:100%;position:relative}
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../GCount/index.js"),u=require("../GPercent/index.js"),l=require("../GDialog/index.js"),r=require("../GTable/index.js"),n=require("../GVideo/index.js"),a=require("../GBubble/index.js"),s=require("../GProgress/index.js"),t={GCount:o.default,GPercent:u.default,GDialog:l.default,GTable:r.default,GVideo:n.default,GBubble:a.default,GProgress:s.default},G=d=>{Object.keys(t).forEach(c=>{const e=t[c];d.component(e.name,e)})},i={install:G};exports.GCount=o.default;exports.GPercent=u.default;exports.GDialog=l.default;exports.GTable=r.default;exports.GVideo=n.default;exports.GBubble=a.default;exports.GProgress=s.default;exports.default=i;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../GCount/index.js"),o=require("../GPercent/index.js"),l=require("../GDialog/index.js"),n=require("../GTable/index.js"),r=require("../GVideo/index.js"),a=require("../GBubble/index.js"),d=require("../GProgress/index.js"),i=require("../GScreen/index.js"),G=require("../GPluginVideo/index.js"),t={GCount:u.default,GPercent:o.default,GDialog:l.default,GTable:n.default,GVideo:r.default,GBubble:a.default,GProgress:d.default,GScreen:i.default,GPluginVideo:G.default},f=c=>{Object.keys(t).forEach(s=>{const e=t[s];c.component(e.name,e)})},b={install:f};exports.GCount=u.default;exports.GPercent=o.default;exports.GDialog=l.default;exports.GTable=n.default;exports.GVideo=r.default;exports.GBubble=a.default;exports.GProgress=d.default;exports.GScreen=i.default;exports.GPluginVideo=G.default;exports.default=b;
@@ -1,23 +1,37 @@
1
1
  import n from "../GCount/index.mjs";
2
2
  import e from "../GPercent/index.mjs";
3
3
  import i from "../GDialog/index.mjs";
4
- import s from "../GTable/index.mjs";
4
+ import p from "../GTable/index.mjs";
5
5
  import c from "../GVideo/index.mjs";
6
- import p from "../GBubble/index.mjs";
7
- import f from "../GProgress/index.mjs";
8
- const t = { GCount: n, GPercent: e, GDialog: i, GTable: s, GVideo: c, GBubble: p, GProgress: f }, a = (m) => {
9
- Object.keys(t).forEach((r) => {
10
- const o = t[r];
6
+ import f from "../GBubble/index.mjs";
7
+ import s from "../GProgress/index.mjs";
8
+ import G from "../GScreen/index.mjs";
9
+ import a from "../GPluginVideo/index.mjs";
10
+ const r = {
11
+ GCount: n,
12
+ GPercent: e,
13
+ GDialog: i,
14
+ GTable: p,
15
+ GVideo: c,
16
+ GBubble: f,
17
+ GProgress: s,
18
+ GScreen: G,
19
+ GPluginVideo: a
20
+ }, l = (m) => {
21
+ Object.keys(r).forEach((t) => {
22
+ const o = r[t];
11
23
  m.component(o.name, o);
12
24
  });
13
- }, C = { install: a };
25
+ }, h = { install: l };
14
26
  export {
15
- p as GBubble,
27
+ f as GBubble,
16
28
  n as GCount,
17
29
  i as GDialog,
18
30
  e as GPercent,
19
- f as GProgress,
20
- s as GTable,
31
+ a as GPluginVideo,
32
+ s as GProgress,
33
+ G as GScreen,
34
+ p as GTable,
21
35
  c as GVideo,
22
- C as default
36
+ h as default
23
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geekin-devtoys",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "author": "leon",
5
5
  "license": "MIT",
6
6
  "description": "geekin-devtoys组件库",
@@ -12,16 +12,19 @@
12
12
  "scripts": {
13
13
  "lib": "vite build && node update-exports.js"
14
14
  },
15
+ "dependencies": {
16
+ "sortablejs": "^1.15.6",
17
+ "@vueuse/core": "^14.2.1"
18
+ },
15
19
  "devDependencies": {
16
20
  "@babel/core": "^7.12.16",
17
21
  "core-js": "^3.8.3",
18
22
  "file-loader": "^6.2.0",
19
23
  "rollup-plugin-visualizer": "^6.0.1",
20
24
  "tsx": "^4.19.1",
25
+ "vite": "^7.3.0",
21
26
  "vite-plugin-dts": "^4.5.4",
22
- "vite-plugin-libcss": "^1.1.1",
23
- "sortablejs": "^1.15.6",
24
- "vite": "^7.3.0"
27
+ "vite-plugin-libcss": "^1.1.1"
25
28
  },
26
29
  "browserslist": [
27
30
  "> 1%",
@@ -85,6 +88,14 @@
85
88
  "import": "./lib/GProgress/style.css",
86
89
  "require": "./lib/GProgress/style.css"
87
90
  },
91
+ "./GScreen": {
92
+ "import": "./lib/GScreen/index.mjs",
93
+ "require": "./lib/GScreen/index.js"
94
+ },
95
+ "./GScreen/style": {
96
+ "import": "./lib/GScreen/style.css",
97
+ "require": "./lib/GScreen/style.css"
98
+ },
88
99
  "./GTable": {
89
100
  "import": "./lib/GTable/index.mjs",
90
101
  "require": "./lib/GTable/index.js"