geekin-devtoys 0.3.1 → 0.3.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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),U=require("../_plugin-vue_export-helper-BHFhmbuH.js"),H={class:"g-card__content"},W=t.defineComponent({__name:"index",props:{className:{default:""},edgeSensitivity:{default:30},glowColor:{default:"40 80 80"},backgroundColor:{},borderRadius:{default:28},glowRadius:{default:40},glowIntensity:{default:1},coneSpread:{default:25},animated:{type:Boolean,default:!1},colors:{default:()=>["#c084fc","#f472b6","#38bdf8"]},fillOpacity:{default:.5}},setup(v){function O(e){const a=e.match(/([\d.]+)\s*([\d.]+)%?\s*([\d.]+)%?/);return a?{h:parseFloat(a[1]),s:parseFloat(a[2]),l:parseFloat(a[3])}:{h:40,s:80,l:80}}function P(e,a){const{h:n,s:o,l}=O(e),c=`${n}deg ${o}% ${l}%`;return[[0,0,0,1,100,!0],[0,0,1,0,60,!0],[0,0,3,0,50,!0],[0,0,6,0,40,!0],[0,0,15,0,30,!0],[0,0,25,2,20,!0],[0,0,50,2,10,!0],[0,0,1,0,60,!1],[0,0,3,0,50,!1],[0,0,6,0,40,!1],[0,0,15,0,30,!1],[0,0,25,2,20,!1],[0,0,50,2,10,!1]].map(([d,s,h,k,T,q])=>{const D=Math.min(T*a,100);return`${q?"inset ":""}${d}px ${s}px ${h}px ${k}px hsl(${c} / ${D}%)`}).join(", ")}function C(e){return 1-Math.pow(1-e,3)}function S(e){return e*e*e}function b({start:e=0,end:a=100,duration:n=1e3,delay:o=0,ease:l=C,onUpdate:c,onEnd:i}){const d=performance.now()+o;function s(){const h=performance.now()-d,k=Math.min(h/n,1);c(e+(a-e)*l(k)),k<1?requestAnimationFrame(s):i&&i()}setTimeout(()=>requestAnimationFrame(s),o)}const E=["80% 55%","69% 34%","8% 6%","41% 38%","86% 85%","82% 18%","51% 4%"],N=[0,1,2,0,1,2,1];function z(e){const a=[];for(let n=0;n<7;n++){const o=e[Math.min(N[n],e.length-1)];a.push(`radial-gradient(at ${E[n]}, ${o} 0px, transparent 50%)`)}return a.push(`linear-gradient(${e[0]} 0 100%)`),a}const r=v,x=t.computed(()=>r.backgroundColor??"transparent"),w=t.useTemplateRef("cardRef"),y=t.ref(!1),f=t.ref(45),p=t.ref(0),$=t.ref(!1),_=e=>{const{width:a,height:n}=e.getBoundingClientRect();return[a/2,n/2]},B=(e,a,n)=>{const[o,l]=_(e),c=a-o,i=n-l;let d=1/0,s=1/0;return c!==0&&(d=o/Math.abs(c)),i!==0&&(s=l/Math.abs(i)),Math.min(Math.max(1/Math.min(d,s),0),1)},V=(e,a,n)=>{const[o,l]=_(e),c=a-o,i=n-l;if(c===0&&i===0)return 0;let s=Math.atan2(i,c)*(180/Math.PI)+90;return s<0&&(s+=360),s},A=e=>{const a=w.value;if(!a)return;const n=a.getBoundingClientRect(),o=e.clientX-n.left,l=e.clientY-n.top;p.value=B(a,o,l),f.value=V(a,o,l)};t.watch(()=>r.animated,()=>{if(!r.animated)return;const e=110,a=465;$.value=!0,f.value=e,b({duration:500,onUpdate:n=>p.value=n/100}),b({ease:S,duration:1500,end:50,onUpdate:n=>{f.value=(a-e)*(n/100)+e}}),b({ease:C,delay:1500,duration:2250,start:50,end:100,onUpdate:n=>{f.value=(a-e)*(n/100)+e}}),b({ease:S,delay:2500,duration:1500,start:100,end:0,onUpdate:n=>p.value=n/100,onEnd:()=>$.value=!1})},{immediate:!0});const M=t.computed(()=>r.edgeSensitivity+20),g=t.computed(()=>y.value||$.value),I=t.computed(()=>g.value?Math.max(0,(p.value*100-M.value)/(100-M.value)):0),j=t.computed(()=>g.value?Math.max(0,(p.value*100-r.edgeSensitivity)/(100-r.edgeSensitivity)):0),R=t.computed(()=>z(r.colors)),F=t.computed(()=>R.value.map(e=>`${e} border-box`)),G=t.computed(()=>R.value.map(e=>`${e} padding-box`)),u=t.computed(()=>`${f.value.toFixed(3)}deg`);return(e,a)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"cardRef",ref:w,onPointermove:A,onPointerenter:a[0]||(a[0]=n=>y.value=!0),onPointerleave:a[1]||(a[1]=n=>y.value=!1),class:t.normalizeClass(["g-card",r.className]),style:t.normalizeStyle({background:x.value,borderRadius:r.borderRadius+"px"})},[t.createElementVNode("div",{class:"g-card__border",style:t.normalizeStyle({background:[`linear-gradient(${x.value} 0 100%) padding-box`,"linear-gradient(rgb(255 255 255 / 0%) 0% 100%) border-box",...F.value].join(", "),opacity:I.value,maskImage:`conic-gradient(from ${u.value} at center, black ${r.coneSpread}%, transparent ${r.coneSpread+15}%, transparent ${100-r.coneSpread-15}%, black ${100-r.coneSpread}%)`,WebkitMaskImage:`conic-gradient(from ${u.value} at center, black ${r.coneSpread}%, transparent ${r.coneSpread+15}%, transparent ${100-r.coneSpread-15}%, black ${100-r.coneSpread}%)`,transition:g.value?"opacity 0.25s ease-out":"opacity 0.75s ease-in-out"})},null,4),t.createElementVNode("div",{class:"g-card__fill",style:t.normalizeStyle({background:G.value.join(", "),maskImage:["linear-gradient(to bottom, black, black)","radial-gradient(ellipse at 50% 50%, black 40%, transparent 65%)","radial-gradient(ellipse at 66% 66%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 66% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 66%, black 5%, transparent 40%)",`conic-gradient(from ${u.value} at center, transparent 5%, black 15%, black 85%, transparent 95%)`].join(", "),WebkitMaskImage:["linear-gradient(to bottom, black, black)","radial-gradient(ellipse at 50% 50%, black 40%, transparent 65%)","radial-gradient(ellipse at 66% 66%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 66% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 66%, black 5%, transparent 40%)",`conic-gradient(from ${u.value} at center, transparent 5%, black 15%, black 85%, transparent 95%)`].join(", "),opacity:I.value*r.fillOpacity,transition:g.value?"opacity 0.25s ease-out":"opacity 0.75s ease-in-out"})},null,4),t.createElementVNode("span",{class:"g-card__glow",style:t.normalizeStyle({inset:`-${r.glowRadius}px`,maskImage:`conic-gradient(from ${u.value} at center, black 2.5%, transparent 10%, transparent 90%, black 97.5%)`,WebkitMaskImage:`conic-gradient(from ${u.value} at center, black 2.5%, transparent 10%, transparent 90%, black 97.5%)`,opacity:j.value,transition:g.value?"opacity 0.25s ease-out":"opacity 0.75s ease-in-out"})},[t.createElementVNode("span",{class:"g-card__glow-inner",style:t.normalizeStyle({inset:`${r.glowRadius}px`,boxShadow:P(r.glowColor,r.glowIntensity)})},null,4)],4),t.createElementVNode("div",H,[t.renderSlot(e.$slots,"default",{},void 0,!0)])],38))}}),m=U._export_sfc(W,[["__scopeId","data-v-d2f696d6"]]),L=[{name:"Daylight",colors:["#5464f6ff","#c084fc","#38bdf8"],glowColor:"220 80 60",backgroundColor:"#f8fafc",dark:!1},{name:"Quartz",colors:["#f472b6","#fb7185","#f9a8d4"],glowColor:"340 80 65",backgroundColor:"#f8fafc",dark:!1},{name:"Matcha",colors:["#34d399","#86efac","#fbbf24"],glowColor:"150 60 50",backgroundColor:"#f8fafc",dark:!1},{name:"Ocean",colors:["#0ea5e9","#22d3ee","#6366f1"],glowColor:"200 90 65",backgroundColor:"#f8fafc",dark:!1},{name:"Daylight",colors:["#c084fc","#f472b6","#38bdf8"],glowColor:"280 80 75",backgroundColor:"#1d1e1f",dark:!0},{name:"Quartz",colors:["#f97316","#f43f5e","#facc15"],glowColor:"20 90 65",backgroundColor:"#1d1e1f",dark:!0},{name:"Matcha",colors:["#34d399","#10b981","#a7f3d0"],glowColor:"150 70 65",backgroundColor:"#1d1e1f",dark:!0},{name:"Ocean",colors:["#0ea5e9","#22d3ee","#6366f1"],glowColor:"200 90 65",backgroundColor:"#1d1e1f",dark:!0}];m.install=v=>{v.component(m.name,m)};exports.GCard=m;exports.cardPresets=L;exports.default=m;
@@ -0,0 +1,287 @@
1
+ import { defineComponent as L, computed as c, useTemplateRef as Q, ref as y, watch as X, createElementBlock as Y, openBlock as J, normalizeStyle as b, normalizeClass as K, createElementVNode as m, renderSlot as Z } from "vue";
2
+ import { _ as ee } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
3
+ const ae = { class: "g-card__content" }, te = /* @__PURE__ */ L({
4
+ __name: "index",
5
+ props: {
6
+ className: { default: "" },
7
+ edgeSensitivity: { default: 30 },
8
+ glowColor: { default: "40 80 80" },
9
+ backgroundColor: {},
10
+ borderRadius: { default: 28 },
11
+ glowRadius: { default: 40 },
12
+ glowIntensity: { default: 1 },
13
+ coneSpread: { default: 25 },
14
+ animated: { type: Boolean, default: !1 },
15
+ colors: { default: () => ["#c084fc", "#f472b6", "#38bdf8"] },
16
+ fillOpacity: { default: 0.5 }
17
+ },
18
+ setup($) {
19
+ function A(e) {
20
+ const a = e.match(/([\d.]+)\s*([\d.]+)%?\s*([\d.]+)%?/);
21
+ return a ? { h: parseFloat(a[1]), s: parseFloat(a[2]), l: parseFloat(a[3]) } : { h: 40, s: 80, l: 80 };
22
+ }
23
+ function E(e, a) {
24
+ const { h: t, s: r, l: o } = A(e), s = `${t}deg ${r}% ${o}%`;
25
+ return [
26
+ [0, 0, 0, 1, 100, !0],
27
+ [0, 0, 1, 0, 60, !0],
28
+ [0, 0, 3, 0, 50, !0],
29
+ [0, 0, 6, 0, 40, !0],
30
+ [0, 0, 15, 0, 30, !0],
31
+ [0, 0, 25, 2, 20, !0],
32
+ [0, 0, 50, 2, 10, !0],
33
+ [0, 0, 1, 0, 60, !1],
34
+ [0, 0, 3, 0, 50, !1],
35
+ [0, 0, 6, 0, 40, !1],
36
+ [0, 0, 15, 0, 30, !1],
37
+ [0, 0, 25, 2, 20, !1],
38
+ [0, 0, 50, 2, 10, !1]
39
+ ].map(([d, l, x, v, W, q]) => {
40
+ const H = Math.min(W * a, 100);
41
+ return `${q ? "inset " : ""}${d}px ${l}px ${x}px ${v}px hsl(${s} / ${H}%)`;
42
+ }).join(", ");
43
+ }
44
+ function S(e) {
45
+ return 1 - Math.pow(1 - e, 3);
46
+ }
47
+ function M(e) {
48
+ return e * e * e;
49
+ }
50
+ function k({
51
+ start: e = 0,
52
+ end: a = 100,
53
+ duration: t = 1e3,
54
+ delay: r = 0,
55
+ ease: o = S,
56
+ onUpdate: s,
57
+ onEnd: i
58
+ }) {
59
+ const d = performance.now() + r;
60
+ function l() {
61
+ const x = performance.now() - d, v = Math.min(x / t, 1);
62
+ s(e + (a - e) * o(v)), v < 1 ? requestAnimationFrame(l) : i && i();
63
+ }
64
+ setTimeout(() => requestAnimationFrame(l), r);
65
+ }
66
+ const F = [
67
+ "80% 55%",
68
+ "69% 34%",
69
+ "8% 6%",
70
+ "41% 38%",
71
+ "86% 85%",
72
+ "82% 18%",
73
+ "51% 4%"
74
+ ], j = [0, 1, 2, 0, 1, 2, 1];
75
+ function N(e) {
76
+ const a = [];
77
+ for (let t = 0; t < 7; t++) {
78
+ const r = e[Math.min(j[t], e.length - 1)];
79
+ a.push(`radial-gradient(at ${F[t]}, ${r} 0px, transparent 50%)`);
80
+ }
81
+ return a.push(`linear-gradient(${e[0]} 0 100%)`), a;
82
+ }
83
+ const n = $, _ = c(() => n.backgroundColor ?? "transparent"), I = Q("cardRef"), h = y(!1), f = y(45), p = y(0), C = y(!1), R = (e) => {
84
+ const { width: a, height: t } = e.getBoundingClientRect();
85
+ return [a / 2, t / 2];
86
+ }, z = (e, a, t) => {
87
+ const [r, o] = R(e), s = a - r, i = t - o;
88
+ let d = 1 / 0, l = 1 / 0;
89
+ return s !== 0 && (d = r / Math.abs(s)), i !== 0 && (l = o / Math.abs(i)), Math.min(Math.max(1 / Math.min(d, l), 0), 1);
90
+ }, D = (e, a, t) => {
91
+ const [r, o] = R(e), s = a - r, i = t - o;
92
+ if (s === 0 && i === 0) return 0;
93
+ let l = Math.atan2(i, s) * (180 / Math.PI) + 90;
94
+ return l < 0 && (l += 360), l;
95
+ }, G = (e) => {
96
+ const a = I.value;
97
+ if (!a) return;
98
+ const t = a.getBoundingClientRect(), r = e.clientX - t.left, o = e.clientY - t.top;
99
+ p.value = z(a, r, o), f.value = D(a, r, o);
100
+ };
101
+ X(
102
+ () => n.animated,
103
+ () => {
104
+ if (!n.animated) return;
105
+ const e = 110, a = 465;
106
+ C.value = !0, f.value = e, k({ duration: 500, onUpdate: (t) => p.value = t / 100 }), k({
107
+ ease: M,
108
+ duration: 1500,
109
+ end: 50,
110
+ onUpdate: (t) => {
111
+ f.value = (a - e) * (t / 100) + e;
112
+ }
113
+ }), k({
114
+ ease: S,
115
+ delay: 1500,
116
+ duration: 2250,
117
+ start: 50,
118
+ end: 100,
119
+ onUpdate: (t) => {
120
+ f.value = (a - e) * (t / 100) + e;
121
+ }
122
+ }), k({
123
+ ease: M,
124
+ delay: 2500,
125
+ duration: 1500,
126
+ start: 100,
127
+ end: 0,
128
+ onUpdate: (t) => p.value = t / 100,
129
+ onEnd: () => C.value = !1
130
+ });
131
+ },
132
+ { immediate: !0 }
133
+ );
134
+ const O = c(() => n.edgeSensitivity + 20), g = c(() => h.value || C.value), P = c(
135
+ () => g.value ? Math.max(
136
+ 0,
137
+ (p.value * 100 - O.value) / (100 - O.value)
138
+ ) : 0
139
+ ), T = c(
140
+ () => g.value ? Math.max(
141
+ 0,
142
+ (p.value * 100 - n.edgeSensitivity) / (100 - n.edgeSensitivity)
143
+ ) : 0
144
+ ), B = c(() => N(n.colors)), U = c(() => B.value.map((e) => `${e} border-box`)), V = c(() => B.value.map((e) => `${e} padding-box`)), u = c(() => `${f.value.toFixed(3)}deg`);
145
+ return (e, a) => (J(), Y("div", {
146
+ ref_key: "cardRef",
147
+ ref: I,
148
+ onPointermove: G,
149
+ onPointerenter: a[0] || (a[0] = (t) => h.value = !0),
150
+ onPointerleave: a[1] || (a[1] = (t) => h.value = !1),
151
+ class: K(["g-card", n.className]),
152
+ style: b({
153
+ background: _.value,
154
+ borderRadius: n.borderRadius + "px"
155
+ })
156
+ }, [
157
+ m("div", {
158
+ class: "g-card__border",
159
+ style: b({
160
+ background: [
161
+ `linear-gradient(${_.value} 0 100%) padding-box`,
162
+ "linear-gradient(rgb(255 255 255 / 0%) 0% 100%) border-box",
163
+ ...U.value
164
+ ].join(", "),
165
+ opacity: P.value,
166
+ maskImage: `conic-gradient(from ${u.value} at center, black ${n.coneSpread}%, transparent ${n.coneSpread + 15}%, transparent ${100 - n.coneSpread - 15}%, black ${100 - n.coneSpread}%)`,
167
+ WebkitMaskImage: `conic-gradient(from ${u.value} at center, black ${n.coneSpread}%, transparent ${n.coneSpread + 15}%, transparent ${100 - n.coneSpread - 15}%, black ${100 - n.coneSpread}%)`,
168
+ transition: g.value ? "opacity 0.25s ease-out" : "opacity 0.75s ease-in-out"
169
+ })
170
+ }, null, 4),
171
+ m("div", {
172
+ class: "g-card__fill",
173
+ style: b({
174
+ background: V.value.join(", "),
175
+ maskImage: [
176
+ "linear-gradient(to bottom, black, black)",
177
+ "radial-gradient(ellipse at 50% 50%, black 40%, transparent 65%)",
178
+ "radial-gradient(ellipse at 66% 66%, black 5%, transparent 40%)",
179
+ "radial-gradient(ellipse at 33% 33%, black 5%, transparent 40%)",
180
+ "radial-gradient(ellipse at 66% 33%, black 5%, transparent 40%)",
181
+ "radial-gradient(ellipse at 33% 66%, black 5%, transparent 40%)",
182
+ `conic-gradient(from ${u.value} at center, transparent 5%, black 15%, black 85%, transparent 95%)`
183
+ ].join(", "),
184
+ WebkitMaskImage: [
185
+ "linear-gradient(to bottom, black, black)",
186
+ "radial-gradient(ellipse at 50% 50%, black 40%, transparent 65%)",
187
+ "radial-gradient(ellipse at 66% 66%, black 5%, transparent 40%)",
188
+ "radial-gradient(ellipse at 33% 33%, black 5%, transparent 40%)",
189
+ "radial-gradient(ellipse at 66% 33%, black 5%, transparent 40%)",
190
+ "radial-gradient(ellipse at 33% 66%, black 5%, transparent 40%)",
191
+ `conic-gradient(from ${u.value} at center, transparent 5%, black 15%, black 85%, transparent 95%)`
192
+ ].join(", "),
193
+ opacity: P.value * n.fillOpacity,
194
+ transition: g.value ? "opacity 0.25s ease-out" : "opacity 0.75s ease-in-out"
195
+ })
196
+ }, null, 4),
197
+ m("span", {
198
+ class: "g-card__glow",
199
+ style: b({
200
+ inset: `-${n.glowRadius}px`,
201
+ maskImage: `conic-gradient(from ${u.value} at center, black 2.5%, transparent 10%, transparent 90%, black 97.5%)`,
202
+ WebkitMaskImage: `conic-gradient(from ${u.value} at center, black 2.5%, transparent 10%, transparent 90%, black 97.5%)`,
203
+ opacity: T.value,
204
+ transition: g.value ? "opacity 0.25s ease-out" : "opacity 0.75s ease-in-out"
205
+ })
206
+ }, [
207
+ m("span", {
208
+ class: "g-card__glow-inner",
209
+ style: b({
210
+ inset: `${n.glowRadius}px`,
211
+ boxShadow: E(n.glowColor, n.glowIntensity)
212
+ })
213
+ }, null, 4)
214
+ ], 4),
215
+ m("div", ae, [
216
+ Z(e.$slots, "default", {}, void 0, !0)
217
+ ])
218
+ ], 38));
219
+ }
220
+ }), w = /* @__PURE__ */ ee(te, [["__scopeId", "data-v-d2f696d6"]]), oe = [
221
+ // ===== 浅色方案 =====
222
+ {
223
+ name: "Daylight",
224
+ colors: ["#5464f6ff", "#c084fc", "#38bdf8"],
225
+ glowColor: "220 80 60",
226
+ backgroundColor: "#f8fafc",
227
+ dark: !1
228
+ },
229
+ {
230
+ name: "Quartz",
231
+ colors: ["#f472b6", "#fb7185", "#f9a8d4"],
232
+ glowColor: "340 80 65",
233
+ backgroundColor: "#f8fafc",
234
+ dark: !1
235
+ },
236
+ {
237
+ name: "Matcha",
238
+ colors: ["#34d399", "#86efac", "#fbbf24"],
239
+ glowColor: "150 60 50",
240
+ backgroundColor: "#f8fafc",
241
+ dark: !1
242
+ },
243
+ {
244
+ name: "Ocean",
245
+ colors: ["#0ea5e9", "#22d3ee", "#6366f1"],
246
+ glowColor: "200 90 65",
247
+ backgroundColor: "#f8fafc",
248
+ dark: !1
249
+ },
250
+ // ===== 深色方案 =====
251
+ {
252
+ name: "Daylight",
253
+ colors: ["#c084fc", "#f472b6", "#38bdf8"],
254
+ glowColor: "280 80 75",
255
+ backgroundColor: "#1d1e1f",
256
+ dark: !0
257
+ },
258
+ {
259
+ name: "Quartz",
260
+ colors: ["#f97316", "#f43f5e", "#facc15"],
261
+ glowColor: "20 90 65",
262
+ backgroundColor: "#1d1e1f",
263
+ dark: !0
264
+ },
265
+ {
266
+ name: "Matcha",
267
+ colors: ["#34d399", "#10b981", "#a7f3d0"],
268
+ glowColor: "150 70 65",
269
+ backgroundColor: "#1d1e1f",
270
+ dark: !0
271
+ },
272
+ {
273
+ name: "Ocean",
274
+ colors: ["#0ea5e9", "#22d3ee", "#6366f1"],
275
+ glowColor: "200 90 65",
276
+ backgroundColor: "#1d1e1f",
277
+ dark: !0
278
+ }
279
+ ];
280
+ w.install = ($) => {
281
+ $.component(w.name, w);
282
+ };
283
+ export {
284
+ w as GCard,
285
+ oe as cardPresets,
286
+ w as default
287
+ };
@@ -0,0 +1 @@
1
+ .g-card[data-v-d2f696d6]{position:relative;display:grid;isolation:isolate;border:1px solid rgba(255,255,255,.15);transform:translateZ(.01px);box-shadow:#0000001a 0 1px 2px,#0000001a 0 2px 4px,#0000001a 0 4px 8px,#0000001a 0 8px 16px,#0000001a 0 16px 32px,#0000001a 0 32px 64px}.g-card__border[data-v-d2f696d6],.g-card__fill[data-v-d2f696d6]{position:absolute;inset:0;z-index:-1;border:1px solid transparent;border-radius:inherit}.g-card__fill[data-v-d2f696d6]{mask-composite:subtract,add,add,add,add,add;-webkit-mask-composite:source-out,source-over,source-over,source-over,source-over,source-over;mix-blend-mode:soft-light}.g-card__glow[data-v-d2f696d6]{position:absolute;z-index:1;border-radius:inherit;pointer-events:none;mix-blend-mode:plus-lighter}.g-card__glow-inner[data-v-d2f696d6]{position:absolute;border-radius:inherit}.g-card__content[data-v-d2f696d6]{position:relative;z-index:1;display:flex;flex-direction:column;overflow:auto}
package/lib/GCard.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),S=a.defineComponent({__name:"index",props:{fontSize:{default:"clamp(2rem, 8vw, 8rem)"},fontWeight:{default:900},fontFamily:{default:"inherit"},color:{default:"#fff"},enableHover:{type:Boolean,default:!0},baseIntensity:{default:.18},hoverIntensity:{default:.5},fuzzRange:{default:30},fps:{default:60},direction:{default:"horizontal"},transitionDuration:{default:0},clickEffect:{type:Boolean,default:!1},glitchMode:{type:Boolean,default:!1},glitchInterval:{default:2e3},glitchDuration:{default:200},gradient:{default:null},letterSpacing:{default:0},className:{default:""}},setup(I){const e=I,_=a.useTemplateRef("canvasRef"),Q=a.useSlots(),H=a.computed(()=>{const d=Q.default?.()??[],c=h=>h.map(s=>typeof s.children=="string"?s.children:Array.isArray(s.children)?c(s.children):"").join("");return c(d)});let F=0,x=null;const q=async()=>{const d=++F;let c=0,h=null,s=null,T=null;const G=[],M=()=>d!==F,l=_.value;if(!l)return;const R=l.getContext("2d");if(!R)return;const V=e.fontFamily==="inherit"?window.getComputedStyle(l).fontFamily||"sans-serif":e.fontFamily,Z=typeof e.fontSize=="number"?`${e.fontSize}px`:e.fontSize,C=`${e.fontWeight} ${Z} ${V}`;try{await document.fonts.load(C)}catch{await document.fonts.ready}if(M())return;let B;if(typeof e.fontSize=="number")B=e.fontSize;else{const t=document.createElement("span");t.style.fontSize=e.fontSize,document.body.appendChild(t),B=parseFloat(getComputedStyle(t).fontSize),document.body.removeChild(t)}const g=H.value,b=document.createElement("canvas"),o=b.getContext("2d");if(!o)return;o.font=C,o.textBaseline="alphabetic";let m=0;if(e.letterSpacing!==0){for(const t of g)m+=o.measureText(t).width+e.letterSpacing;m-=e.letterSpacing}else m=o.measureText(g).width;const p=o.measureText(g),$=p.actualBoundingBoxLeft??0,ee=e.letterSpacing!==0?m:p.actualBoundingBoxRight??p.width,w=p.actualBoundingBoxAscent??B,te=p.actualBoundingBoxDescent??B*.2,j=Math.ceil(e.letterSpacing!==0?m:$+ee),z=Math.ceil(w+te),N=10,f=j+N;b.width=f,b.height=z;const A=N/2;if(o.font=C,o.textBaseline="alphabetic",e.gradient&&Array.isArray(e.gradient)&&e.gradient.length>=2){const t=o.createLinearGradient(0,0,f,0);e.gradient.forEach((n,i)=>t.addColorStop(i/(e.gradient.length-1),n)),o.fillStyle=t}else o.fillStyle=e.color;if(e.letterSpacing!==0){let t=A;for(const n of g)o.fillText(n,t,w),t+=o.measureText(n).width+e.letterSpacing}else o.fillText(g,A-$,w);const E=e.fuzzRange+20,k=e.direction==="vertical"||e.direction==="both"?e.fuzzRange+10:0;l.width=f+E*2,l.height=z+k*2,R.translate(E,k);const O=E+A,P=k,ne=O+j,ie=P+z;let v=!1,D=!1,L=!1,r=e.baseIntensity,u=e.baseIntensity,X=0;const Y=()=>{!e.glitchMode||M()||(h=setTimeout(()=>{M()||(L=!0,s=setTimeout(()=>{L=!1,Y()},e.glitchDuration))},e.glitchInterval))};e.glitchMode&&Y();const W=t=>{if(M())return;const n=1e3/e.fps;if(t-X<n){c=requestAnimationFrame(W);return}if(X=t,R.clearRect(-(e.fuzzRange+20),-(e.fuzzRange+10),f+2*(e.fuzzRange+20),z+2*(e.fuzzRange+10)),D||L?u=1:v?u=e.hoverIntensity:u=e.baseIntensity,e.transitionDuration>0){const i=1/(e.transitionDuration/n);r<u?r=Math.min(r+i,u):r>u&&(r=Math.max(r-i,u))}else r=u;for(let i=0;i<z;i++){let J=0,K=0;(e.direction==="horizontal"||e.direction==="both")&&(J=Math.floor(r*(Math.random()-.5)*e.fuzzRange)),(e.direction==="vertical"||e.direction==="both")&&(K=Math.floor(r*(Math.random()-.5)*e.fuzzRange*.5)),R.drawImage(b,0,i,f,1,J,i+K,f,1)}c=requestAnimationFrame(W)};c=requestAnimationFrame(W);const U=(t,n)=>t>=O&&t<=ne&&n>=P&&n<=ie,oe=t=>{if(!e.enableHover)return;const n=l.getBoundingClientRect();v=U(t.clientX-n.left,t.clientY-n.top)},ae=()=>{v=!1},le=()=>{e.clickEffect&&(D=!0,clearTimeout(T??void 0),T=setTimeout(()=>{D=!1},150))},re=t=>{if(!e.enableHover)return;t.preventDefault();const n=l.getBoundingClientRect(),i=t.touches[0];v=U(i.clientX-n.left,i.clientY-n.top)},ce=()=>{v=!1},y=(t,n,i)=>{l.addEventListener(t,n,i),G.push(()=>l.removeEventListener(t,n,i))};y("mousemove",oe),y("mouseleave",ae),y("touchmove",re,{passive:!1}),y("touchend",ce),y("click",le),x=()=>{cancelAnimationFrame(c),h!==null&&clearTimeout(h),s!==null&&clearTimeout(s),T!==null&&clearTimeout(T),G.forEach(t=>t())}};return a.onMounted(()=>{q()}),a.onBeforeUnmount(()=>{F++,x?.()}),a.watch(()=>({text:H.value,fontSize:e.fontSize,fontWeight:e.fontWeight,fontFamily:e.fontFamily,color:e.color,gradient:e.gradient,letterSpacing:e.letterSpacing,direction:e.direction,fuzzRange:e.fuzzRange,glitchMode:e.glitchMode}),()=>{x?.(),x=null,q()},{deep:!0}),(d,c)=>(a.openBlock(),a.createElementBlock("canvas",{ref_key:"canvasRef",ref:_,class:a.normalizeClass(d.className)},null,2))}});S.install=I=>{I.component(S.name,S)};exports.GFuzzyText=S;exports.default=S;
@@ -0,0 +1,171 @@
1
+ import { defineComponent as ct, useTemplateRef as st, useSlots as ft, computed as ut, onMounted as dt, onBeforeUnmount as ht, watch as mt, createElementBlock as gt, openBlock as pt, normalizeClass as zt } from "vue";
2
+ const L = /* @__PURE__ */ ct({
3
+ __name: "index",
4
+ props: {
5
+ fontSize: { default: "clamp(2rem, 8vw, 8rem)" },
6
+ fontWeight: { default: 900 },
7
+ fontFamily: { default: "inherit" },
8
+ color: { default: "#fff" },
9
+ enableHover: { type: Boolean, default: !0 },
10
+ baseIntensity: { default: 0.18 },
11
+ hoverIntensity: { default: 0.5 },
12
+ fuzzRange: { default: 30 },
13
+ fps: { default: 60 },
14
+ direction: { default: "horizontal" },
15
+ transitionDuration: { default: 0 },
16
+ clickEffect: { type: Boolean, default: !1 },
17
+ glitchMode: { type: Boolean, default: !1 },
18
+ glitchInterval: { default: 2e3 },
19
+ glitchDuration: { default: 200 },
20
+ gradient: { default: null },
21
+ letterSpacing: { default: 0 },
22
+ className: { default: "" }
23
+ },
24
+ setup(M) {
25
+ const t = M, W = st("canvasRef"), K = ft(), _ = ut(() => {
26
+ const u = K.default?.() ?? [], r = (d) => d.map((c) => typeof c.children == "string" ? c.children : Array.isArray(c.children) ? r(c.children) : "").join("");
27
+ return r(u);
28
+ });
29
+ let b = 0, v = null;
30
+ const H = async () => {
31
+ const u = ++b;
32
+ let r = 0, d = null, c = null, S = null;
33
+ const G = [], x = () => u !== b, a = W.value;
34
+ if (!a) return;
35
+ const T = a.getContext("2d");
36
+ if (!T) return;
37
+ const Q = t.fontFamily === "inherit" ? window.getComputedStyle(a).fontFamily || "sans-serif" : t.fontFamily, V = typeof t.fontSize == "number" ? `${t.fontSize}px` : t.fontSize, I = `${t.fontWeight} ${V} ${Q}`;
38
+ try {
39
+ await document.fonts.load(I);
40
+ } catch {
41
+ await document.fonts.ready;
42
+ }
43
+ if (x()) return;
44
+ let R;
45
+ if (typeof t.fontSize == "number")
46
+ R = t.fontSize;
47
+ else {
48
+ const e = document.createElement("span");
49
+ e.style.fontSize = t.fontSize, document.body.appendChild(e), R = parseFloat(getComputedStyle(e).fontSize), document.body.removeChild(e);
50
+ }
51
+ const h = _.value, B = document.createElement("canvas"), o = B.getContext("2d");
52
+ if (!o) return;
53
+ o.font = I, o.textBaseline = "alphabetic";
54
+ let m = 0;
55
+ if (t.letterSpacing !== 0) {
56
+ for (const e of h)
57
+ m += o.measureText(e).width + t.letterSpacing;
58
+ m -= t.letterSpacing;
59
+ } else
60
+ m = o.measureText(h).width;
61
+ const g = o.measureText(h), $ = g.actualBoundingBoxLeft ?? 0, Z = t.letterSpacing !== 0 ? m : g.actualBoundingBoxRight ?? g.width, F = g.actualBoundingBoxAscent ?? R, tt = g.actualBoundingBoxDescent ?? R * 0.2, q = Math.ceil(
62
+ t.letterSpacing !== 0 ? m : $ + Z
63
+ ), p = Math.ceil(F + tt), j = 10, f = q + j;
64
+ B.width = f, B.height = p;
65
+ const C = j / 2;
66
+ if (o.font = I, o.textBaseline = "alphabetic", t.gradient && Array.isArray(t.gradient) && t.gradient.length >= 2) {
67
+ const e = o.createLinearGradient(0, 0, f, 0);
68
+ t.gradient.forEach((n, i) => e.addColorStop(i / (t.gradient.length - 1), n)), o.fillStyle = e;
69
+ } else
70
+ o.fillStyle = t.color;
71
+ if (t.letterSpacing !== 0) {
72
+ let e = C;
73
+ for (const n of h)
74
+ o.fillText(n, e, F), e += o.measureText(n).width + t.letterSpacing;
75
+ } else
76
+ o.fillText(h, C - $, F);
77
+ const w = t.fuzzRange + 20, A = t.direction === "vertical" || t.direction === "both" ? t.fuzzRange + 10 : 0;
78
+ a.width = f + w * 2, a.height = p + A * 2, T.translate(w, A);
79
+ const N = w + C, X = A, et = N + q, nt = X + p;
80
+ let z = !1, E = !1, k = !1, l = t.baseIntensity, s = t.baseIntensity, Y = 0;
81
+ const O = () => {
82
+ !t.glitchMode || x() || (d = setTimeout(() => {
83
+ x() || (k = !0, c = setTimeout(() => {
84
+ k = !1, O();
85
+ }, t.glitchDuration));
86
+ }, t.glitchInterval));
87
+ };
88
+ t.glitchMode && O();
89
+ const D = (e) => {
90
+ if (x()) return;
91
+ const n = 1e3 / t.fps;
92
+ if (e - Y < n) {
93
+ r = requestAnimationFrame(D);
94
+ return;
95
+ }
96
+ if (Y = e, T.clearRect(
97
+ -(t.fuzzRange + 20),
98
+ -(t.fuzzRange + 10),
99
+ f + 2 * (t.fuzzRange + 20),
100
+ p + 2 * (t.fuzzRange + 10)
101
+ ), E || k ? s = 1 : z ? s = t.hoverIntensity : s = t.baseIntensity, t.transitionDuration > 0) {
102
+ const i = 1 / (t.transitionDuration / n);
103
+ l < s ? l = Math.min(l + i, s) : l > s && (l = Math.max(l - i, s));
104
+ } else
105
+ l = s;
106
+ for (let i = 0; i < p; i++) {
107
+ let U = 0, J = 0;
108
+ (t.direction === "horizontal" || t.direction === "both") && (U = Math.floor(l * (Math.random() - 0.5) * t.fuzzRange)), (t.direction === "vertical" || t.direction === "both") && (J = Math.floor(l * (Math.random() - 0.5) * t.fuzzRange * 0.5)), T.drawImage(B, 0, i, f, 1, U, i + J, f, 1);
109
+ }
110
+ r = requestAnimationFrame(D);
111
+ };
112
+ r = requestAnimationFrame(D);
113
+ const P = (e, n) => e >= N && e <= et && n >= X && n <= nt, it = (e) => {
114
+ if (!t.enableHover) return;
115
+ const n = a.getBoundingClientRect();
116
+ z = P(e.clientX - n.left, e.clientY - n.top);
117
+ }, ot = () => {
118
+ z = !1;
119
+ }, at = () => {
120
+ t.clickEffect && (E = !0, clearTimeout(S ?? void 0), S = setTimeout(() => {
121
+ E = !1;
122
+ }, 150));
123
+ }, lt = (e) => {
124
+ if (!t.enableHover) return;
125
+ e.preventDefault();
126
+ const n = a.getBoundingClientRect(), i = e.touches[0];
127
+ z = P(i.clientX - n.left, i.clientY - n.top);
128
+ }, rt = () => {
129
+ z = !1;
130
+ }, y = (e, n, i) => {
131
+ a.addEventListener(e, n, i), G.push(() => a.removeEventListener(e, n, i));
132
+ };
133
+ y("mousemove", it), y("mouseleave", ot), y("touchmove", lt, { passive: !1 }), y("touchend", rt), y("click", at), v = () => {
134
+ cancelAnimationFrame(r), d !== null && clearTimeout(d), c !== null && clearTimeout(c), S !== null && clearTimeout(S), G.forEach((e) => e());
135
+ };
136
+ };
137
+ return dt(() => {
138
+ H();
139
+ }), ht(() => {
140
+ b++, v?.();
141
+ }), mt(
142
+ () => ({
143
+ text: _.value,
144
+ fontSize: t.fontSize,
145
+ fontWeight: t.fontWeight,
146
+ fontFamily: t.fontFamily,
147
+ color: t.color,
148
+ gradient: t.gradient,
149
+ letterSpacing: t.letterSpacing,
150
+ direction: t.direction,
151
+ fuzzRange: t.fuzzRange,
152
+ glitchMode: t.glitchMode
153
+ }),
154
+ () => {
155
+ v?.(), v = null, H();
156
+ },
157
+ { deep: !0 }
158
+ ), (u, r) => (pt(), gt("canvas", {
159
+ ref_key: "canvasRef",
160
+ ref: W,
161
+ class: zt(u.className)
162
+ }, null, 2));
163
+ }
164
+ });
165
+ L.install = (M) => {
166
+ M.component(L.name, L);
167
+ };
168
+ export {
169
+ L as GFuzzyText,
170
+ L as default
171
+ };
@@ -0,0 +1 @@
1
+ export {}
@@ -1 +1,9 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),b=require("element-plus"),P=require("../_plugin-vue_export-helper-BHFhmbuH.js"),ee={key:0,class:"g-input-tree-tag__tags"},te=t.defineComponent({__name:"index",props:{modelValue:{default:()=>[]},data:{default:()=>[]},props:{default:()=>({})},nodeKey:{default:"id"},placeholder:{default:"请输入关键字搜索"},width:{default:320},popperMaxHeight:{default:320},popperZIndex:{default:2e3},popperOffset:{default:4},defaultExpandAll:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},closable:{type:Boolean,default:!0},tagType:{default:"info"},tagEffect:{default:"light"},clearInputAfterSelect:{type:Boolean,default:!0},enterToAdd:{type:Boolean,default:!0},valueFormat:{default:"value"},selectable:{},filterMethod:{},duplicateMessage:{default:"该项已添加"},notFoundMessage:{default:"未找到匹配项"}},emits:["update:modelValue","change","add","remove","node-click","duplicate","not-found"],setup(V,{expose:H,emit:$}){const n=V,r=$,O=t.computed(()=>({label:n.props.label||"label",children:n.props.children||"children",disabled:n.props.disabled})),q=t.computed(()=>n.props.value||n.nodeKey||"id"),K=t.computed(()=>n.props.label||"label"),j=t.computed(()=>n.props.children||"children"),B=t.computed(()=>n.props.isLeaf),f=e=>e?e[q.value]:void 0,i=e=>e?e[K.value]:"",_=e=>e?e[j.value]:void 0,c=e=>{if(!e)return!1;if(typeof n.selectable=="function")return n.selectable(e);if(B.value&&e[B.value]!==void 0)return!!e[B.value];const l=_(e);return!l||!l.length},S=t.computed(()=>{const e=new Map,l=(a=[])=>{a.forEach(o=>{c(o)&&e.set(f(o),o);const d=_(o);d?.length&&l(d)})};return l(n.data||[]),e}),s=t.computed(()=>(n.modelValue||[]).map(l=>{const a=n.valueFormat==="object"?l?.value:l,o=S.value.get(a),d=n.valueFormat==="object"?l?.label:void 0;return{value:a,label:o?i(o):d??String(a??""),raw:o}})),w=e=>s.value.some(l=>l.value===e),y=t.ref(""),u=t.ref(!1),C=t.ref(null),F=t.ref(null),T=t.ref(null),v=t.ref(null),I=t.ref({}),N=t.ref("bottom"),D=t.computed(()=>typeof n.width=="number"?`${n.width}px`:n.width),M=()=>{n.disabled||(u.value=!0)},k=()=>{if(!u.value)return;const e=T.value,l=v.value;if(!e||!l)return;const a=e.getBoundingClientRect(),o=l.offsetHeight||n.popperMaxHeight,E=window.innerHeight-a.bottom-n.popperOffset,X=a.top,A=E>=o||E>=X?"bottom":"top";N.value=A;const Y=A==="bottom"?a.bottom+n.popperOffset:a.top-o;I.value={position:"fixed",top:`${Y}px`,left:`${a.left}px`,width:`${a.width}px`,zIndex:String(n.popperZIndex)}};let p=null;const m=()=>{u.value&&(p&&cancelAnimationFrame(p),p=requestAnimationFrame(()=>{p=null,k()}))};let g=null;const U=()=>{typeof ResizeObserver>"u"||!v.value||(g?.disconnect(),g=new ResizeObserver(()=>m()),g.observe(v.value))},z=()=>{g?.disconnect(),g=null};t.watch(u,async e=>{if(!e){z();return}await t.nextTick(),k(),requestAnimationFrame(k),U()});const L=e=>{if(!u.value)return;const l=e.target;F.value?.contains(l)||v.value?.contains(l)||(u.value=!1)};t.onMounted(()=>{document.addEventListener("mousedown",L,!0),window.addEventListener("scroll",m,!0),window.addEventListener("resize",m)}),t.onBeforeUnmount(()=>{document.removeEventListener("mousedown",L,!0),window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m),p&&cancelAnimationFrame(p),z()});const G=e=>{u.value=!0,C.value?.filter(e),t.nextTick(k)},Z=(e,l)=>e?typeof n.filterMethod=="function"?n.filterMethod(e,l):String(i(l)??"").toLowerCase().includes(String(e).toLowerCase()):!0,W=(e,l)=>{if(r("node-click",e),!c(e)){l&&(l.expanded=!l.expanded);return}x(e),u.value=!1},J=e=>n.valueFormat==="object"?{value:e.value,label:e.label,raw:e.raw}:e.value,x=e=>{const l=f(e);if(l==null||l==="")return;if(w(l)){const d={value:l,label:i(e),raw:e};r("duplicate",d),n.duplicateMessage&&b.ElMessage.warning(n.duplicateMessage);return}const a={value:l,label:i(e),raw:e},o=[...n.modelValue||[],J(a)];r("update:modelValue",o),r("add",a),r("change",o,[...s.value,a]),n.clearInputAfterSelect&&(y.value="")},Q=()=>{if(!n.enterToAdd)return;const e=(y.value||"").trim();if(!e)return;let l=null;for(const a of S.value.values())if(i(a)===e){l=a;break}if(!l){r("not-found",e),n.notFoundMessage&&b.ElMessage.warning(n.notFoundMessage);return}x(l)},R=e=>{const l=s.value[e],a=[...n.modelValue||[]];a.splice(e,1),r("update:modelValue",a),l&&r("remove",l,e);const o=s.value.filter((d,E)=>E!==e);r("change",a,o)};return H({open:M,close:()=>u.value=!1,clear:()=>{r("update:modelValue",[]),r("change",[],[])},addByValue:e=>{const l=S.value.get(e);l&&x(l)}}),(e,l)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["g-input-tree-tag",{"is-disabled":e.disabled}])},[t.createElementVNode("div",{class:"g-input-tree-tag__wrap",ref_key:"wrapRef",ref:F},[t.createElementVNode("div",{class:"g-input-tree-tag__input-box",ref_key:"inputBoxRef",ref:T,style:t.normalizeStyle({width:D.value})},[t.createVNode(t.unref(b.ElInput),{modelValue:y.value,"onUpdate:modelValue":l[0]||(l[0]=a=>y.value=a),placeholder:e.placeholder,clearable:e.clearable,disabled:e.disabled,class:"g-input-tree-tag__input",onFocus:M,onClick:M,onInput:G,onKeyup:t.withKeys(Q,["enter"])},null,8,["modelValue","placeholder","clearable","disabled"])],4),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.withDirectives(t.createElementVNode("div",{ref_key:"popperRef",ref:v,class:t.normalizeClass(["g-input-tree-tag__popover",`is-${N.value}`]),style:t.normalizeStyle(I.value),onMousedown:l[1]||(l[1]=t.withModifiers(()=>{},["prevent"]))},[t.createElementVNode("div",{class:"g-input-tree-tag__tree-wrap",style:t.normalizeStyle({maxHeight:e.popperMaxHeight+"px"})},[t.createVNode(t.unref(b.ElTree),{ref_key:"treeRef",ref:C,data:e.data,props:O.value,"node-key":e.nodeKey,"filter-node-method":Z,"expand-on-click-node":!1,"default-expand-all":e.defaultExpandAll,onNodeClick:W},{default:t.withCtx(a=>[t.renderSlot(e.$slots,"tree-node",{data:a?.data,node:a?.node,selectable:c(a?.data),selected:w(f(a?.data))},()=>[a?.data?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(["g-input-tree-tag__node",{"is-selectable":c(a.data),"is-selected":c(a.data)&&w(f(a.data))}])},[t.renderSlot(e.$slots,"leaf-icon",{data:a.data,selectable:c(a.data),selected:w(f(a.data))},void 0,!0),t.createTextVNode(" "+t.toDisplayString(i(a.data)),1)],2)):t.createCommentVNode("",!0)],!0)]),_:3},8,["data","props","node-key","default-expand-all"])],4)],38),[[t.vShow,u.value]])])),s.value.length?(t.openBlock(),t.createElementBlock("div",ee,[t.renderSlot(e.$slots,"tags",{items:s.value,remove:R},()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,(a,o)=>(t.openBlock(),t.createBlock(t.unref(b.ElTag),{key:a.value,class:"g-input-tree-tag__tag",type:e.tagType,effect:e.tagEffect,closable:e.closable&&!e.disabled,onClose:d=>R(o)},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"tag",{item:a,index:o},()=>[t.createTextVNode(t.toDisplayString(a.label),1)],!0)]),_:2},1032,["type","effect","closable","onClose"]))),128))],!0)])):t.createCommentVNode("",!0)],512)],2))}}),h=P._export_sfc(te,[["__scopeId","data-v-274fd860"]]);h.install=V=>{V.component(h.name,h)};exports.GInputTreeTag=h;exports.default=h;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),T=require("element-plus"),x=require("../index-xqOURU1q.js"),ve=require("../_plugin-vue_export-helper-BHFhmbuH.js");var ge=0;function he(d){const p=new WeakMap,f=x.useMotionConfig();function n(u){if(d.mode!=="popLayout")return;const v=u.offsetParent,E=v instanceof HTMLElement&&v.offsetWidth||0,m={height:u.offsetHeight||0,width:u.offsetWidth||0,top:u.offsetTop,left:u.offsetLeft,right:0};m.right=E-m.width-m.left;const S=d.anchorX==="left"?`left: ${m.left}px`:`right: ${m.right}px`,k=`pop-${ge++}`;u.dataset.motionPopId=k;const l=document.createElement("style");f.value.nonce&&(l.nonce=f.value.nonce),p.set(u,l),document.head.appendChild(l),l.sheet&&l.sheet.insertRule(`
2
+ [data-motion-pop-id="${k}"] {
3
+ position: absolute !important;
4
+ width: ${m.width}px !important;
5
+ height: ${m.height}px !important;
6
+ top: ${m.top}px !important;
7
+ ${S} !important;
8
+ }
9
+ `)}function c(u){const v=p.get(u);v&&(p.delete(u),x.frame.render(()=>{document.head.removeChild(v)}))}return{addPopStyle:n,removePopStyle:c}}var be=0;function ye(d){const p=String(be++),f=new Map,{addPopStyle:n,removePopStyle:c}=he(d);function u(l){const i=[],r=x.mountedStates.get(l);r&&l.getAttribute(x.motionGlobalConfig.motionAttribute)===p&&i.push(r);const g=Array.from(l.querySelectorAll(`[${x.motionGlobalConfig.motionAttribute}="${p}"]`));for(const V of g){const y=x.mountedStates.get(V);y&&i.push(y)}return i}function v(l,i){const r=f.get(l);r&&(r.remaining.delete(i),r.remaining.size===0&&m(r))}const E={initial:d.initial,custom:d.custom,presenceId:p,onMotionExitComplete:v};x.provideAnimatePresence(E),e.onMounted(()=>{E.initial=void 0});function m(l){c(l.el),l.states.forEach(i=>{i.getSnapshot(i.options,!1)}),l.done(),f.delete(l.el),l.el?.isConnected?l.states[0]?.didUpdate():l.states.forEach(i=>{i.unmount()}),d.onExitComplete?.()}function S(l,i){u(l).forEach(r=>{r.setActive("exit",!1),r.getSnapshot(r.options,!0)}),i()}function k(l,i){E.custom=d.custom;const r=l,g=u(r);if(g.length===0){i(),d.onExitComplete?.();return}const V={remaining:new Set(g),states:g,done:i,el:r};f.set(r,V),n(r),g.forEach(y=>{y.presenceContainer=r,y.setActive("exit",!0),y.getSnapshot(y.options,!1)}),g[0]?.didUpdate()}return e.onUnmounted(()=>{f.forEach(l=>{l.states.forEach(i=>{i.unmount()})}),f.clear()}),{enter:S,exit:k}}var we=e.defineComponent({name:"AnimatePresence",inheritAttrs:!0,__name:"AnimatePresence",props:{mode:{default:"sync"},initial:{type:Boolean,default:!0},as:{},custom:{},onExitComplete:{},anchorX:{default:"left"}},setup(d){const p=d,{enter:f,exit:n}=ye(p),c=e.computed(()=>p.mode!=="wait"?{tag:p.as}:{mode:p.mode==="wait"?"out-in":void 0});return(u,v)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.mode==="wait"?e.Transition:e.TransitionGroup),e.mergeProps(c.value,{appear:"",css:!1,onLeave:e.unref(n),onEnter:e.unref(f)}),{default:e.withCtx(()=>[e.renderSlot(u.$slots,"default")]),_:3},16,["onLeave","onEnter"]))}}),X=we;const xe={key:0,class:"g-input-tree-tag__tags"},Ee=e.defineComponent({__name:"index",props:{modelValue:{default:()=>[]},data:{default:()=>[]},props:{default:()=>({})},echoProps:{},nodeKey:{default:"id"},placeholder:{default:"请输入关键字搜索"},width:{default:320},popperMaxHeight:{default:320},popperZIndex:{default:2e3},popperOffset:{default:4},defaultExpandAll:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},closable:{type:Boolean,default:!0},tagType:{default:"info"},tagEffect:{default:"light"},clearInputAfterSelect:{type:Boolean,default:!0},enterToAdd:{type:Boolean,default:!0},valueFormat:{default:"value"},selectable:{},filterMethod:{},duplicateMessage:{default:"该项已添加"},notFoundMessage:{default:"未找到匹配项"}},emits:["update:modelValue","change","add","remove","node-click","duplicate","not-found"],setup(d,{expose:p,emit:f}){const n=d,c=f,u=e.computed(()=>({label:n.props.label||"label",children:n.props.children||"children",disabled:n.props.disabled})),v=e.computed(()=>n.props.value||n.nodeKey||"id"),E=e.computed(()=>n.props.label||"label"),m=e.computed(()=>n.props.children||"children"),S=e.computed(()=>n.props.isLeaf),k=e.computed(()=>n.echoProps?.value||"value"),l=e.computed(()=>n.echoProps?.label||"label"),i=t=>t?t[v.value]:void 0,r=t=>t?t[E.value]:"",g=t=>t?t[m.value]:void 0,V=t=>t?.[k.value]??t?.value,y=t=>t?.[l.value]??t?.label,C=t=>{if(!t)return!1;if(typeof n.selectable=="function")return n.selectable(t);if(S.value&&t[S.value]!==void 0)return!!t[S.value];const o=g(t);return!o||!o.length},H=e.computed(()=>{const t=new Map,o=(a=[])=>{a.forEach(s=>{C(s)&&t.set(i(s),s);const w=g(s);w?.length&&o(w)})};return o(n.data||[]),t}),h=e.computed(()=>(n.modelValue||[]).map(o=>{const a=n.valueFormat==="object"?V(o):o,s=H.value.get(a),w=n.valueFormat==="object"?y(o):void 0;return{value:a,label:s?r(s):w??String(a??""),raw:s??(n.valueFormat==="object"?o:void 0)}})),$=t=>h.value.some(o=>o.value===t),F=e.ref(""),b=e.ref(!1),q=e.ref(null),U=e.ref(null),j=e.ref(null),_=e.ref(null),Z=t=>{if(!t){_.value=null;return}_.value=t.$el??(t instanceof HTMLElement?t:null)},G=e.ref({}),M=e.ref("bottom"),J=e.computed(()=>({opacity:0,scale:.95,y:M.value==="bottom"?-8:8})),Q={opacity:1,scale:1,y:0},Y=e.computed(()=>({opacity:0,scale:.95,y:M.value==="bottom"?-8:8})),ee={duration:.2,ease:"easeOut"},te=e.computed(()=>({...G.value,transformOrigin:M.value==="bottom"?"top center":"bottom center"})),oe={opacity:0,scale:.8},ne={opacity:1,scale:1},ae={opacity:0,scale:.8},le={duration:.2,ease:"easeOut"},re=e.computed(()=>typeof n.width=="number"?`${n.width}px`:n.width),O=()=>{n.disabled||(b.value=!0)},P=()=>{if(!b.value)return;const t=j.value,o=_.value;if(!t||!o)return;const a=t.getBoundingClientRect(),s=o.offsetHeight||n.popperMaxHeight,z=window.innerHeight-a.bottom-n.popperOffset,fe=a.top-n.popperOffset,D=z>=s||z>=fe?"bottom":"top";M.value=D;const me=D==="bottom"?a.bottom+n.popperOffset:a.top-s-n.popperOffset;G.value={position:"fixed",top:`${me}px`,left:`${a.left}px`,width:`${a.width}px`,zIndex:String(n.popperZIndex)}};let B=null;const A=()=>{b.value&&(B&&cancelAnimationFrame(B),B=requestAnimationFrame(()=>{B=null,P()}))};let I=null;const ie=()=>{typeof ResizeObserver>"u"||!_.value||(I?.disconnect(),I=new ResizeObserver(()=>A()),I.observe(_.value))},K=()=>{I?.disconnect(),I=null};e.watch(b,async t=>{if(!t){K();return}await e.nextTick(),P(),requestAnimationFrame(P),ie()});const W=t=>{if(!b.value)return;const o=t.target;U.value?.contains(o)||_.value?.contains(o)||(b.value=!1)};e.onMounted(()=>{document.addEventListener("mousedown",W,!0),window.addEventListener("scroll",A,!0),window.addEventListener("resize",A)}),e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",W,!0),window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A),B&&cancelAnimationFrame(B),K()});const se=t=>{b.value=!0,q.value?.filter(t),e.nextTick(P)},ue=(t,o)=>t?typeof n.filterMethod=="function"?n.filterMethod(t,o):String(r(o)??"").toLowerCase().includes(String(t).toLowerCase()):!0,ce=(t,o)=>{if(c("node-click",t),!C(t)){o&&(o.expanded=!o.expanded);return}R(t),b.value=!1},de=t=>n.valueFormat==="object"?{value:t.value,label:t.label,raw:t.raw}:t.value,R=t=>{const o=i(t);if(o==null||o==="")return;if($(o)){const w={value:o,label:r(t),raw:t};c("duplicate",w),n.duplicateMessage&&T.ElMessage.warning(n.duplicateMessage);return}const a={value:o,label:r(t),raw:t},s=[...n.modelValue||[],de(a)];c("update:modelValue",s),c("add",a),c("change",s,[...h.value,a]),n.clearInputAfterSelect&&(F.value="")},pe=()=>{if(!n.enterToAdd)return;const t=(F.value||"").trim();if(!t)return;let o=null;for(const a of H.value.values())if(r(a)===t){o=a;break}if(!o){c("not-found",t),n.notFoundMessage&&T.ElMessage.warning(n.notFoundMessage);return}R(o)},N=t=>{if(t<0||t>=h.value.length)return;const o=h.value[t],a=[...n.modelValue||[]];a.splice(t,1),c("update:modelValue",a),o&&c("remove",o,t);const s=h.value.filter((w,z)=>z!==t);c("change",a,s)};return p({open:O,close:()=>b.value=!1,clear:()=>{c("update:modelValue",[]),c("change",[],[])},addByValue:t=>{const o=H.value.get(t);o&&R(o)},removeByIndex:t=>{N(t)},removeByValue:t=>{const o=h.value.findIndex(a=>a.value===t);o>-1&&N(o)},getSelectedItems:()=>h.value}),(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["g-input-tree-tag",{"is-disabled":t.disabled}])},[e.createElementVNode("div",{class:"g-input-tree-tag__wrap",ref_key:"wrapRef",ref:U},[e.createElementVNode("div",{class:"g-input-tree-tag__input-box",ref_key:"inputBoxRef",ref:j,style:e.normalizeStyle({width:re.value})},[e.createVNode(e.unref(T.ElInput),{modelValue:F.value,"onUpdate:modelValue":o[0]||(o[0]=a=>F.value=a),placeholder:t.placeholder,clearable:t.clearable,disabled:t.disabled,class:"g-input-tree-tag__input",onFocus:O,onClick:O,onInput:se,onKeyup:e.withKeys(pe,["enter"])},null,8,["modelValue","placeholder","clearable","disabled"])],4),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.unref(X),null,{default:e.withCtx(()=>[b.value?(e.openBlock(),e.createBlock(e.unref(x.motion).div,{key:0,ref:Z,class:e.normalizeClass(["g-input-tree-tag__popover",`is-${M.value}`]),style:e.normalizeStyle(te.value),initial:J.value,animate:Q,exit:Y.value,transition:ee,onMousedown:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"g-input-tree-tag__tree-wrap",style:e.normalizeStyle({maxHeight:t.popperMaxHeight+"px"})},[e.createVNode(e.unref(T.ElTree),{ref_key:"treeRef",ref:q,data:t.data,props:u.value,"node-key":t.nodeKey,"filter-node-method":ue,"expand-on-click-node":!1,"default-expand-all":t.defaultExpandAll,onNodeClick:ce},{default:e.withCtx(a=>[e.renderSlot(t.$slots,"tree-node",{data:a?.data,node:a?.node,selectable:C(a?.data),selected:$(i(a?.data))},()=>[a?.data?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["g-input-tree-tag__node",{"is-selectable":C(a.data),"is-selected":C(a.data)&&$(i(a.data))}])},[e.renderSlot(t.$slots,"leaf-icon",{data:a.data,selectable:C(a.data),selected:$(i(a.data))},void 0,!0),e.createTextVNode(" "+e.toDisplayString(r(a.data)),1)],2)):e.createCommentVNode("",!0)],!0)]),_:3},8,["data","props","node-key","default-expand-all"])],4)]),_:3},8,["class","style","initial","exit"])):e.createCommentVNode("",!0)]),_:3})])),h.value.length?(e.openBlock(),e.createElementBlock("div",xe,[e.renderSlot(t.$slots,"tags",{items:h.value,remove:N},()=>[e.createVNode(e.unref(X),{mode:"popLayout"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(a,s)=>(e.openBlock(),e.createBlock(e.unref(x.motion).div,{key:a.value,layout:!0,class:"g-input-tree-tag__tag-motion",initial:oe,animate:ne,exit:ae,transition:le},{default:e.withCtx(()=>[e.createVNode(e.unref(T.ElTag),{class:"g-input-tree-tag__tag",type:t.tagType,effect:t.tagEffect,closable:t.closable&&!t.disabled,onClose:w=>N(s)},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"tag",{item:a,index:s},()=>[e.createTextVNode(e.toDisplayString(a.label),1)],!0)]),_:2},1032,["type","effect","closable","onClose"])]),_:2},1024))),128))]),_:3})],!0)])):e.createCommentVNode("",!0)],512)],2))}}),L=ve._export_sfc(Ee,[["__scopeId","data-v-b74dd5d2"]]);L.install=d=>{d.component(L.name,L)};exports.GInputTreeTag=L;exports.default=L;