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