geekin-devtoys 0.2.8 → 0.2.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.
@@ -3981,9 +3981,7 @@ Wn.version = "1.2.7";
3981
3981
  const xr = {
3982
3982
  id: "playWnd",
3983
3983
  class: "playWnd"
3984
- }, hn = 3, cn = 3e3, ve = "插件未启动,正在尝试启动,请稍候...", jt = "插件启动失败,请检查插件是否安装!", ye = /* @__PURE__ */ Object.assign({
3985
- name: "GPluginVideo"
3986
- }, {
3984
+ }, hn = 3, cn = 3e3, ve = "插件未启动,正在尝试启动,请稍候...", jt = "插件启动失败,请检查插件是否安装!", ye = {
3987
3985
  __name: "index",
3988
3986
  props: {
3989
3987
  // 是否播放
@@ -4040,6 +4038,11 @@ const xr = {
4040
4038
  happenedTime: {
4041
4039
  type: String,
4042
4040
  default: ""
4041
+ },
4042
+ // 是否双击关闭视频
4043
+ isDoubleClickClose: {
4044
+ type: Boolean,
4045
+ default: !1
4043
4046
  }
4044
4047
  },
4045
4048
  emits: ["closeVideoEmit"],
@@ -4076,8 +4079,8 @@ const xr = {
4076
4079
  const v = new ki();
4077
4080
  return v.setPublicKey(o.value), v.encrypt(w);
4078
4081
  }
4079
- function E() {
4080
- r("closeVideoEmit"), s.value !== null && (s.value.JS_RequestInterface({ funcName: "stopAllPreview" }), s.value.JS_HideWnd(), s.value.JS_Disconnect().then(() => {
4082
+ function E(w) {
4083
+ r("closeVideoEmit", w), s.value !== null && (s.value.JS_RequestInterface({ funcName: "stopAllPreview" }), s.value.JS_HideWnd(), s.value.JS_Disconnect().then(() => {
4081
4084
  }, () => {
4082
4085
  }));
4083
4086
  }
@@ -4187,7 +4190,7 @@ const xr = {
4187
4190
  v.type === 6 && (h.value = i.multipPointsArr.length, p.value = 1, d.value = i.multipPointsArr, u.value = v.msg.layout, y.value = v.msg.wndNum, d.value = T(d.value, v.msg.wndNum), f.value = [...d.value[p.value - 1]], s.value.JS_Disconnect().then(() => {
4188
4191
  N();
4189
4192
  }, () => {
4190
- })), v.type === 7 && E();
4193
+ })), v.type === 7 && i.isDoubleClickClose && E("doubleClick");
4191
4194
  }
4192
4195
  function N() {
4193
4196
  s.value = new window.WebControl({
@@ -4267,7 +4270,7 @@ const xr = {
4267
4270
  [Kn, !t.isFullScreen]
4268
4271
  ]);
4269
4272
  }
4270
- });
4273
+ };
4271
4274
  ye.install = (t) => {
4272
4275
  t.component(ye.name, ye);
4273
4276
  };
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),p=new WeakMap,M=(...e)=>{var n;const i=e[0],o=(n=t.getCurrentInstance())===null||n===void 0?void 0:n.proxy,r=o??t.getCurrentScope();if(r==null&&!t.hasInjectionContext())throw new Error("injectLocal must be called in setup");return r&&p.has(r)&&i in p.get(r)?p.get(r)[i]:t.inject(...e)},V=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const W=Object.prototype.toString,I=e=>W.call(e)==="[object Object]",S=()=>{};function T(e,n){function i(...o){return new Promise((r,u)=>{Promise.resolve(e(()=>n.apply(this,o),{fn:n,thisArg:this,args:o})).then(r).catch(u)})}return i}function x(e,n={}){let i,o,r=S;const u=c=>{clearTimeout(c),r(),r=S};let a;return c=>{const s=t.toValue(e),l=t.toValue(n.maxWait);return i&&u(i),s<=0||l!==void 0&&l<=0?(o&&(u(o),o=void 0),Promise.resolve(c())):new Promise((d,f)=>{r=n.rejectOnCancel?f:d,a=c,l&&!o&&(o=setTimeout(()=>{i&&u(i),o=void 0,d(a())},l)),i=setTimeout(()=>{o&&u(o),o=void 0,d(c())},s)})}}function b(e){return e.endsWith("rem")?Number.parseFloat(e)*16:Number.parseFloat(e)}function w(e){return Array.isArray(e)?e:[e]}function C(e){return t.getCurrentInstance()}function E(e,n=200,i={}){return T(x(n,i),e)}function R(e,n=!0,i){C()?t.onMounted(e,i):n?e():t.nextTick(e)}function j(e,n,i){return t.watch(e,n,{...i,immediate:!0})}const g=V?window:void 0;function O(e){var n;const i=t.toValue(e);return(n=i?.$el)!==null&&n!==void 0?n:i}function y(...e){const n=(o,r,u,a)=>(o.addEventListener(r,u,a),()=>o.removeEventListener(r,u,a)),i=t.computed(()=>{const o=w(t.toValue(e[0])).filter(r=>r!=null);return o.every(r=>typeof r!="string")?o:void 0});return j(()=>{var o,r;return[(o=(r=i.value)===null||r===void 0?void 0:r.map(u=>O(u)))!==null&&o!==void 0?o:[g].filter(u=>u!=null),w(t.toValue(i.value?e[1]:e[0])),w(t.unref(i.value?e[2]:e[1])),t.toValue(i.value?e[3]:e[2])]},([o,r,u,a],h,c)=>{if(!o?.length||!r?.length||!u?.length)return;const s=I(a)?{...a}:a,l=o.flatMap(d=>r.flatMap(f=>u.map(v=>n(d,f,v,s))));c(()=>{l.forEach(d=>d())})},{flush:"post"})}function P(){const e=t.shallowRef(!1),n=t.getCurrentInstance();return n&&t.onMounted(()=>{e.value=!0},n),e}function F(e){const n=P();return t.computed(()=>(n.value,!!e()))}const N=Symbol("vueuse-ssr-width");function _(){const e=t.hasInjectionContext()?M(N,null):null;return typeof e=="number"?e:void 0}function $(e,n={}){const{window:i=g,ssrWidth:o=_()}=n,r=F(()=>i&&"matchMedia"in i&&typeof i.matchMedia=="function"),u=t.shallowRef(typeof o=="number"),a=t.shallowRef(),h=t.shallowRef(!1),c=s=>{h.value=s.matches};return t.watchEffect(()=>{if(u.value){u.value=!r.value,h.value=t.toValue(e).split(",").some(s=>{const l=s.includes("not all"),d=s.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/),f=s.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);let v=!!(d||f);return d&&v&&(v=o>=b(d[1])),f&&v&&(v=o<=b(f[1])),l?!v:v});return}r.value&&(a.value=i.matchMedia(t.toValue(e)),h.value=a.value.matches)}),y(a,"change",c,{passive:!0}),t.computed(()=>h.value)}function G(e={}){const{window:n=g,initialWidth:i=Number.POSITIVE_INFINITY,initialHeight:o=Number.POSITIVE_INFINITY,listenOrientation:r=!0,includeScrollbar:u=!0,type:a="inner"}=e,h=t.shallowRef(i),c=t.shallowRef(o),s=()=>{if(n)if(a==="outer")h.value=n.outerWidth,c.value=n.outerHeight;else if(a==="visual"&&n.visualViewport){const{width:d,height:f,scale:v}=n.visualViewport;h.value=Math.round(d*v),c.value=Math.round(f*v)}else u?(h.value=n.innerWidth,c.value=n.innerHeight):(h.value=n.document.documentElement.clientWidth,c.value=n.document.documentElement.clientHeight)};s(),R(s);const l={passive:!0};return y("resize",s,l),n&&a==="visual"&&n.visualViewport&&y(n.visualViewport,"resize",s,l),r&&t.watch($("(orientation: portrait)"),()=>s()),{width:h,height:c}}const k={style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},m=t.defineComponent({name:"GScreen",inheritAttrs:!1,__name:"index",props:{width:{default:1920},height:{default:1080},debounceDelay:{default:166}},setup(e,{expose:n}){const i=e,{width:o,height:r}=G(),u=()=>({x:o.value/i.width,y:r.value/i.height}),a=t.ref(u()),h=t.computed(()=>{const l=a.value.x||1;return Math.max(.1,Math.min(l,10))}),c=t.computed(()=>{const l=i.width/i.height,f=o.value/r.value/l;return isFinite(f)?f:1}),s=t.computed(()=>{const l=h.value,d=isFinite(100/l)?100/l:100;return{width:`${i.width}px`,height:`${d}vh`,transform:`scale(${l})`,transformOrigin:"0 0",willChange:"transform"}});if(t.provide("GScreen_scaleX",h),t.provide("GScreen_yScaleRatio",c),i.debounceDelay>0){const l=E(()=>{a.value=u()},i.debounceDelay);t.watch([o,r],l)}else t.watch([o,r],()=>{a.value=u()});return n({scale:a,safeScaleX:h,yScaleRatio:c}),(l,d)=>(t.openBlock(),t.createElementBlock("div",k,[t.createElementVNode("div",{style:t.normalizeStyle(s.value)},[t.renderSlot(l.$slots,"default")],4)]))}});m.install=e=>{e.component("GScreen",m)};exports.GScreen=m;exports.default=m;
@@ -1,14 +1,14 @@
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";
2
- const w = /* @__PURE__ */ new WeakMap(), A = /* @__NO_SIDE_EFFECTS__ */ (...e) => {
1
+ import { onMounted as E, nextTick as j, getCurrentInstance as b, watch as w, getCurrentScope as C, hasInjectionContext as V, inject as O, toValue as v, shallowRef as m, computed as p, watchEffect as P, unref as F, defineComponent as N, ref as R, provide as M, createElementBlock as $, openBlock as G, createElementVNode as k, normalizeStyle as z, renderSlot as L } from "vue";
2
+ const y = /* @__PURE__ */ new WeakMap(), _ = /* @__NO_SIDE_EFFECTS__ */ (...e) => {
3
3
  var t;
4
- const i = e[0], n = (t = g()) === null || t === void 0 ? void 0 : t.proxy, o = n ?? V();
5
- if (o == null && !x()) throw new Error("injectLocal must be called in setup");
6
- return o && w.has(o) && i in w.get(o) ? w.get(o)[i] : j(...e);
7
- }, H = typeof window < "u" && typeof document < "u";
4
+ const i = e[0], n = (t = b()) === null || t === void 0 ? void 0 : t.proxy, o = n ?? C();
5
+ if (o == null && !V()) throw new Error("injectLocal must be called in setup");
6
+ return o && y.has(o) && i in y.get(o) ? y.get(o)[i] : O(...e);
7
+ }, A = typeof window < "u" && typeof document < "u";
8
8
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
9
- const B = Object.prototype.toString, D = (e) => B.call(e) === "[object Object]", M = () => {
9
+ const D = Object.prototype.toString, H = (e) => D.call(e) === "[object Object]", I = () => {
10
10
  };
11
- function G(e, t) {
11
+ function B(e, t) {
12
12
  function i(...n) {
13
13
  return new Promise((o, r) => {
14
14
  Promise.resolve(e(() => t.apply(this, n), {
@@ -20,159 +20,178 @@ function G(e, t) {
20
20
  }
21
21
  return i;
22
22
  }
23
- function _(e, t = {}) {
24
- let i, n, o = M;
25
- const r = (u) => {
26
- clearTimeout(u), o(), o = M;
23
+ function X(e, t = {}) {
24
+ let i, n, o = I;
25
+ const r = (a) => {
26
+ clearTimeout(a), o(), o = I;
27
27
  };
28
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());
34
- }, d)), i = setTimeout(() => {
35
- n && r(n), n = void 0, s(u());
36
- }, a);
29
+ return (a) => {
30
+ const s = v(e), u = v(t.maxWait);
31
+ return i && r(i), s <= 0 || u !== void 0 && u <= 0 ? (n && (r(n), n = void 0), Promise.resolve(a())) : new Promise((c, h) => {
32
+ o = t.rejectOnCancel ? h : c, l = a, u && !n && (n = setTimeout(() => {
33
+ i && r(i), n = void 0, c(l());
34
+ }, u)), i = setTimeout(() => {
35
+ n && r(n), n = void 0, c(a());
36
+ }, s);
37
37
  });
38
38
  };
39
39
  }
40
40
  function T(e) {
41
41
  return e.endsWith("rem") ? Number.parseFloat(e) * 16 : Number.parseFloat(e);
42
42
  }
43
- function y(e) {
43
+ function S(e) {
44
44
  return Array.isArray(e) ? e : [e];
45
45
  }
46
- function R(e) {
47
- return g();
46
+ function Q(e) {
47
+ return b();
48
48
  }
49
49
  // @__NO_SIDE_EFFECTS__
50
- function Q(e, t = 200, i = {}) {
51
- return G(_(t, i), e);
50
+ function Y(e, t = 200, i = {}) {
51
+ return B(X(t, i), e);
52
52
  }
53
- function Y(e, t = !0, i) {
54
- R() ? E(e, i) : t ? e() : N(e);
53
+ function U(e, t = !0, i) {
54
+ Q() ? E(e, i) : t ? e() : j(e);
55
55
  }
56
- function U(e, t, i) {
57
- return W(e, t, {
56
+ function J(e, t, i) {
57
+ return w(e, t, {
58
58
  ...i,
59
59
  immediate: !0
60
60
  });
61
61
  }
62
- const I = H ? window : void 0;
63
- function X(e) {
62
+ const W = A ? window : void 0;
63
+ function K(e) {
64
64
  var t;
65
- const i = m(e);
65
+ const i = v(e);
66
66
  return (t = i?.$el) !== null && t !== void 0 ? t : i;
67
67
  }
68
- function S(...e) {
68
+ function g(...e) {
69
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);
70
+ const n = S(v(e[0])).filter((o) => o != null);
71
71
  return n.every((o) => typeof o != "string") ? n : void 0;
72
72
  });
73
- return U(() => {
73
+ return J(() => {
74
74
  var n, o;
75
75
  return [
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])
76
+ (n = (o = i.value) === null || o === void 0 ? void 0 : o.map((r) => K(r))) !== null && n !== void 0 ? n : [W].filter((r) => r != null),
77
+ S(v(i.value ? e[1] : e[0])),
78
+ S(F(i.value ? e[2] : e[1])),
79
+ v(i.value ? e[3] : e[2])
80
80
  ];
81
- }, ([n, o, r, l], c, u) => {
81
+ }, ([n, o, r, l], d, a) => {
82
82
  if (!n?.length || !o?.length || !r?.length) return;
83
- const a = D(l) ? { ...l } : l, d = n.flatMap((s) => o.flatMap((h) => r.map((f) => t(s, h, f, a))));
84
- u(() => {
85
- d.forEach((s) => s());
83
+ const s = H(l) ? { ...l } : l, u = n.flatMap((c) => o.flatMap((h) => r.map((f) => t(c, h, f, s))));
84
+ a(() => {
85
+ u.forEach((c) => c());
86
86
  });
87
87
  }, { flush: "post" });
88
88
  }
89
89
  // @__NO_SIDE_EFFECTS__
90
- function J() {
91
- const e = v(!1), t = g();
90
+ function Z() {
91
+ const e = m(!1), t = b();
92
92
  return t && E(() => {
93
93
  e.value = !0;
94
94
  }, t), e;
95
95
  }
96
96
  // @__NO_SIDE_EFFECTS__
97
- function K(e) {
98
- const t = /* @__PURE__ */ J();
97
+ function q(e) {
98
+ const t = /* @__PURE__ */ Z();
99
99
  return p(() => (t.value, !!e()));
100
100
  }
101
- const Z = /* @__PURE__ */ Symbol("vueuse-ssr-width");
101
+ const ee = /* @__PURE__ */ Symbol("vueuse-ssr-width");
102
102
  // @__NO_SIDE_EFFECTS__
103
- function q() {
104
- const e = x() ? /* @__PURE__ */ A(Z, null) : null;
103
+ function te() {
104
+ const e = V() ? /* @__PURE__ */ _(ee, null) : null;
105
105
  return typeof e == "number" ? e : void 0;
106
106
  }
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) => {
109
- c.value = a.matches;
107
+ function ne(e, t = {}) {
108
+ const { window: i = W, ssrWidth: n = /* @__PURE__ */ te() } = t, o = /* @__PURE__ */ q(() => i && "matchMedia" in i && typeof i.matchMedia == "function"), r = m(typeof n == "number"), l = m(), d = m(!1), a = (s) => {
109
+ d.value = s.matches;
110
110
  };
111
- return O(() => {
111
+ return P(() => {
112
112
  if (r.value) {
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;
113
+ r.value = !o.value, d.value = v(e).split(",").some((s) => {
114
+ const u = s.includes("not all"), c = s.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), h = s.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
115
+ let f = !!(c || h);
116
+ return c && f && (f = n >= T(c[1])), h && f && (f = n <= T(h[1])), u ? !f : f;
117
117
  });
118
118
  return;
119
119
  }
120
- o.value && (l.value = i.matchMedia(m(e)), c.value = l.value.matches);
121
- }), S(l, "change", u, { passive: !0 }), p(() => c.value);
120
+ o.value && (l.value = i.matchMedia(v(e)), d.value = l.value.matches);
121
+ }), g(l, "change", a, { passive: !0 }), p(() => d.value);
122
122
  }
123
123
  // @__NO_SIDE_EFFECTS__
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 = () => {
124
+ function ie(e = {}) {
125
+ const { window: t = W, initialWidth: i = Number.POSITIVE_INFINITY, initialHeight: n = Number.POSITIVE_INFINITY, listenOrientation: o = !0, includeScrollbar: r = !0, type: l = "inner" } = e, d = m(i), a = m(n), s = () => {
126
126
  if (t) if (l === "outer")
127
- c.value = t.outerWidth, u.value = t.outerHeight;
127
+ d.value = t.outerWidth, a.value = t.outerHeight;
128
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);
129
+ const { width: c, height: h, scale: f } = t.visualViewport;
130
+ d.value = Math.round(c * f), a.value = Math.round(h * f);
131
+ } else r ? (d.value = t.innerWidth, a.value = t.innerHeight) : (d.value = t.document.documentElement.clientWidth, a.value = t.document.documentElement.clientHeight);
132
132
  };
133
- a(), Y(a);
134
- const d = { passive: !0 };
135
- return S("resize", a, d), t && l === "visual" && t.visualViewport && S(t.visualViewport, "resize", a, d), o && W(ee("(orientation: portrait)"), () => a()), {
136
- width: c,
137
- height: u
133
+ s(), U(s);
134
+ const u = { passive: !0 };
135
+ return g("resize", s, u), t && l === "visual" && t.visualViewport && g(t.visualViewport, "resize", s, u), o && w(ne("(orientation: portrait)"), () => s()), {
136
+ width: d,
137
+ height: a
138
138
  };
139
139
  }
140
- const ne = { style: { position: "relative", width: "100%", height: "100%" } }, b = /* @__PURE__ */ C({
140
+ const oe = { style: { position: "relative", width: "100%", height: "100%", overflow: "hidden" } }, x = /* @__PURE__ */ N({
141
141
  name: "GScreen",
142
142
  inheritAttrs: !1,
143
143
  __name: "index",
144
144
  props: {
145
- width: { default: () => "1920" },
146
- height: { default: () => "1080" },
147
- debounceDelay: { default: () => "166" }
145
+ width: { default: 1920 },
146
+ height: { default: 1080 },
147
+ debounceDelay: { default: 166 }
148
148
  },
149
- setup(e) {
150
- const t = e, { width: i, height: n } = /* @__PURE__ */ te(), r = p(() => ({
151
- x: i.value / Number(t.width),
152
- y: n.value / Number(t.height)
153
- })), l = p(() => {
154
- const u = r.value.x || 1;
149
+ setup(e, { expose: t }) {
150
+ const i = e, { width: n, height: o } = /* @__PURE__ */ ie(), r = () => ({
151
+ x: n.value / i.width,
152
+ y: o.value / i.height
153
+ }), l = R(r()), d = p(() => {
154
+ const u = l.value.x || 1;
155
+ return Math.max(0.1, Math.min(u, 10));
156
+ }), a = p(() => {
157
+ const u = i.width / i.height, h = n.value / o.value / u;
158
+ return isFinite(h) ? h : 1;
159
+ }), s = p(() => {
160
+ const u = d.value, c = isFinite(100 / u) ? 100 / u : 100;
155
161
  return {
156
- width: `${t.width}px`,
157
- height: `${100 / u}vh`,
162
+ width: `${i.width}px`,
163
+ height: `${c}vh`,
158
164
  transform: `scale(${u})`,
159
- transformOrigin: "0 0"
165
+ transformOrigin: "0 0",
166
+ willChange: "transform"
160
167
  };
161
- }), c = /* @__PURE__ */ Q(() => {
162
- }, Number(t.debounceDelay));
163
- return W([i, n], c, { deep: !0 }), (u, a) => (F(), $("div", ne, [
168
+ });
169
+ if (M("GScreen_scaleX", d), M("GScreen_yScaleRatio", a), i.debounceDelay > 0) {
170
+ const u = /* @__PURE__ */ Y(() => {
171
+ l.value = r();
172
+ }, i.debounceDelay);
173
+ w([n, o], u);
174
+ } else
175
+ w([n, o], () => {
176
+ l.value = r();
177
+ });
178
+ return t({
179
+ scale: l,
180
+ safeScaleX: d,
181
+ yScaleRatio: a
182
+ }), (u, c) => (G(), $("div", oe, [
164
183
  k("div", {
165
- style: z(l.value)
184
+ style: z(s.value)
166
185
  }, [
167
186
  L(u.$slots, "default")
168
187
  ], 4)
169
188
  ]));
170
189
  }
171
190
  });
172
- b.install = (e) => {
173
- e.component(b.name, b);
191
+ x.install = (e) => {
192
+ e.component("GScreen", x);
174
193
  };
175
194
  export {
176
- b as GScreen,
177
- b as default
195
+ x as GScreen,
196
+ x as default
178
197
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geekin-devtoys",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "author": "leon",
5
5
  "license": "MIT",
6
6
  "description": "geekin-devtoys组件库",