geekin-devtoys 0.3.11 → 0.4.2
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/{GBubble → GBranched}/index.js +1 -1
- package/lib/GBranched/index.mjs +5 -0
- package/lib/GBranched/style.css +1 -0
- package/lib/GBranched-BtF7heMk.js +1 -0
- package/lib/GBranched-vnLlYOl9.mjs +197 -0
- package/lib/GButton/index.js +1 -1
- package/lib/GButton/index.mjs +10 -10
- package/lib/GButton/style.css +1 -1
- package/lib/GCard/index.js +1 -1
- package/lib/GCard/index.mjs +1 -1
- package/lib/GDialog/index.js +1 -1
- package/lib/GDialog/index.mjs +29 -29
- package/lib/GDialog/style.css +1 -1
- package/lib/GDropdown/index.js +1 -0
- package/lib/GDropdown/index.mjs +278 -0
- package/lib/GDropdown/style.css +1 -0
- package/lib/GInput/index.js +1 -1
- package/lib/GInput/index.mjs +2 -2
- package/lib/GInput/style.css +1 -1
- package/lib/GPicker/index.js +1 -0
- package/lib/{GInputTreeTag → GPicker}/index.mjs +111 -111
- package/lib/GPicker/style.css +1 -0
- package/lib/GPicker.d.ts +1 -0
- package/lib/GPie3D/index.js +1 -1
- package/lib/GPie3D/index.mjs +1 -1
- package/lib/GPluginVideo/index.js +1 -1
- package/lib/GPluginVideo/index.mjs +59 -58
- package/lib/GProgress/index.js +1 -1
- package/lib/GProgress/index.mjs +1 -1
- package/lib/GRadio/index.js +1 -0
- package/lib/GRadio/index.mjs +198 -0
- package/lib/GRadio/style.css +1 -0
- package/lib/GRadio.d.ts +1 -0
- package/lib/GRing/index.js +1 -1
- package/lib/GRing/index.mjs +1 -1
- package/lib/GScroller/index.js +1 -1
- package/lib/GScroller/index.mjs +1 -1
- package/lib/GSegment/index.js +1 -0
- package/lib/GSegment/index.mjs +364 -0
- package/lib/GSegment/style.css +1 -0
- package/lib/GSegment.d.ts +1 -0
- package/lib/GSlider/index.js +1 -0
- package/lib/GSlider/index.mjs +184 -0
- package/lib/GSlider/style.css +1 -0
- package/lib/GSlider.d.ts +1 -0
- package/lib/GSteps/index.js +1 -1
- package/lib/GSteps/index.mjs +1 -1
- package/lib/GTable/index.js +1 -1
- package/lib/GTable/index.mjs +1 -1
- package/lib/GTag/index.js +1 -1
- package/lib/GTag/index.mjs +7 -5
- package/lib/GTag/style.css +1 -0
- package/lib/GToast/index.js +1 -0
- package/lib/GToast/index.mjs +292 -0
- package/lib/GToast/style.css +1 -0
- package/lib/GToast.d.ts +1 -0
- package/lib/GTree/index.js +1 -1
- package/lib/GTree/index.mjs +1 -1
- package/lib/GVideo/index.js +2 -2
- package/lib/GVideo/index.mjs +1 -1
- package/lib/components/GBranched/index.d.ts +29 -0
- package/lib/components/GBranched/types.d.ts +139 -0
- package/lib/components/GDialog/index.d.ts +3 -90
- package/lib/components/GDialog/types.d.ts +89 -0
- package/lib/components/GDropdown/index.d.ts +59 -0
- package/lib/components/GRadio/index.d.ts +45 -0
- package/lib/components/GRadio/types.d.ts +94 -0
- package/lib/components/GScroller/index.d.ts +1 -1
- package/lib/components/GSegment/index.d.ts +30 -0
- package/lib/components/GSegment/types.d.ts +125 -0
- package/lib/components/GShinyText/index.d.ts +1 -1
- package/lib/components/GSlider/index.d.ts +27 -0
- package/lib/components/GSlider/types.d.ts +88 -0
- package/lib/components/GTag/index.d.ts +3 -0
- package/lib/components/GToast/ToastCard.d.ts +9 -0
- package/lib/components/GToast/index.d.ts +7 -0
- package/lib/components/GToast/store.d.ts +46 -0
- package/lib/components/GToast/types.d.ts +121 -0
- package/lib/index/index.js +1 -1
- package/lib/index/index.mjs +70 -53
- package/lib/index/style.css +17 -5
- package/lib/index.d.ts +16 -5
- package/package.json +58 -13
- package/lib/GBubble/index.mjs +0 -5
- package/lib/GBubble/style.css +0 -1
- package/lib/GBubble-C3cM9Put.mjs +0 -216
- package/lib/GBubble-Dph0YDkU.js +0 -2
- package/lib/GInputTreeTag/index.js +0 -1
- package/lib/GInputTreeTag/style.css +0 -1
- package/lib/assets/GTag.css +0 -1
- package/lib/components/GBubble/index.d.ts +0 -61
- /package/lib/{GBubble.d.ts → GBranched.d.ts} +0 -0
- /package/lib/{GInputTreeTag.d.ts → GDropdown.d.ts} +0 -0
- /package/lib/components/{GInputTreeTag → GPicker}/index.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../GBranched-BtF7heMk.js");exports.GBranched=e.GBranched;exports.default=e.GBranched;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.g-branched[data-v-cd651c8b]{--bm-ink: #18181b;--bm-accent: #18181b;--bm-line: #d4d4d8;--bm-muted: color-mix(in srgb, var(--bm-ink) 55%, transparent);position:relative;display:flex;flex-direction:column;width:fit-content;max-width:min(var(--bm-w),100%);padding-left:14px;color:var(--bm-ink);font-family:inherit;font-size:var(--bm-font);line-height:1.2}.g-branched[data-v-cd651c8b]:before{content:"";position:absolute;top:8px;bottom:0;left:0;width:2px;border-radius:1px;background:linear-gradient(to bottom,var(--bm-line) 0%,var(--bm-line) 55%,transparent 100%)}html.dark .g-branched[data-v-cd651c8b]{--bm-ink: #fafafa;--bm-accent: #fafafa;--bm-line: #52525b}.g-branched__marker[data-v-cd651c8b]{position:absolute;top:-1px;left:0;z-index:1;width:2px;height:16px;border-radius:1px;background:var(--bm-accent);opacity:0;transition:top .22s cubic-bezier(.23,1,.32,1),opacity .15s ease}.g-branched__marker[data-on][data-v-cd651c8b]{opacity:1}.g-branched__section[data-v-cd651c8b]{display:flex;flex-direction:column}.g-branched__head[data-v-cd651c8b]{display:block;margin:0;padding:9px 0;border:0;background:transparent;outline:none;color:var(--bm-muted);font-family:inherit;font-size:calc(var(--bm-font) + 1px);font-weight:500;text-align:left;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:color .2s ease}.g-branched__section[data-open] .g-branched__head[data-v-cd651c8b],.g-branched__head[data-active][data-v-cd651c8b],.g-branched__head[data-v-cd651c8b]:hover{color:var(--bm-ink)}.g-branched__fold[data-v-cd651c8b]{display:grid;grid-template-rows:0fr;transition:grid-template-rows var(--bm-fold) cubic-bezier(.23,1,.32,1)}.g-branched__section[data-open] .g-branched__fold[data-v-cd651c8b]{grid-template-rows:1fr}.g-branched__clip[data-v-cd651c8b]{min-height:0;overflow:hidden}.g-branched__body[data-v-cd651c8b]{position:relative;box-sizing:border-box;padding:var(--bm-pad) 0}.g-branched__lines[data-v-cd651c8b]{position:absolute;top:0;left:0;overflow:visible;pointer-events:none;opacity:0;transition:opacity .2s ease}.g-branched__section[data-open] .g-branched__lines[data-v-cd651c8b]{opacity:1;transition:opacity .25s ease .1s}.g-branched__path[data-v-cd651c8b]{fill:none;stroke:var(--bm-line);stroke-width:var(--bm-line-w);stroke-linecap:round;stroke-linejoin:round}.g-branched__path--accent[data-v-cd651c8b]{stroke:var(--bm-accent);transition:stroke-dashoffset var(--bm-draw) cubic-bezier(.23,1,.32,1)}.g-branched__item[data-v-cd651c8b]{box-sizing:border-box;display:flex;align-items:center;gap:8px;width:100%;height:var(--bm-row);margin:0;padding:0;padding-left:var(--bm-indent);border:0;background:transparent;outline:none;color:var(--bm-muted);font-family:inherit;text-align:left;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:color .2s ease}.g-branched__item[data-v-cd651c8b]:hover{color:var(--bm-ink)}.g-branched__item[data-active][data-v-cd651c8b]{color:var(--bm-accent);font-weight:500}.g-branched__icon[data-v-cd651c8b]{display:inline-flex;flex:none}.g-branched__label[data-v-cd651c8b]{white-space:nowrap}.g-branched__head[data-v-cd651c8b]:focus-visible,.g-branched__item[data-v-cd651c8b]:focus-visible{outline:2px solid var(--bm-accent);outline-offset:-2px;border-radius:6px}@media(prefers-reduced-motion:reduce){.g-branched__marker[data-v-cd651c8b]{transition:opacity .15s ease}.g-branched__fold[data-v-cd651c8b],.g-branched__path--accent[data-v-cd651c8b]{transition:none}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),I=["data-open"],R=["aria-expanded","aria-current","data-active","onClick"],T={key:0,class:"g-branched__fold"},F={class:"g-branched__clip"},L=["width","height"],G=["d"],P=["d"],q=["d"],U=["aria-current","data-active","tabindex","onClick"],W={key:0,class:"g-branched__icon","aria-hidden":"true"},K={class:"g-branched__label"},m=6,Q=16,X=e.defineComponent({name:"GBranched",__name:"index",props:{items:{default:void 0},defaultOpen:{default:0},defaultActive:{default:""},color:{default:void 0},accentColor:{default:void 0},lineColor:{default:void 0},width:{default:240},rowHeight:{default:36},indent:{default:40},trunk:{default:14},radius:{default:10},lineWidth:{default:1.5},fontSize:{default:14},drawDuration:{default:400},foldDuration:{default:300},className:{default:""}},emits:["select","toggle"],setup(d,{emit:k}){const v=[{label:"Getting started",children:[{value:"install",label:"Installation"},{value:"quick",label:"Quick start"},{value:"config",label:"Configuration"},{value:"theming",label:"Theming"}]},{label:"Components",children:[{value:"buttons",label:"Buttons"},{value:"typography",label:"Typography"},{value:"overlays",label:"Overlays"},{value:"toasts",label:"Toasts"}]}],f=t=>new Set(Array.isArray(t)?t:t>=0?[t]:[]),a=d,$=k,p=e.computed(()=>a.items??v),u=e.ref(f(a.defaultOpen)),s=e.ref(a.defaultActive||(p.value.find((t,n)=>t.children&&f(a.defaultOpen).has(n))?.children?.[0]?.value??"")),y=e.ref(null),w=e.ref(null),E=[];let _=null;const b=e.computed(()=>p.value.findIndex(t=>t.children?.some(n=>n.value===s.value))),C=e.computed(()=>b.value>=0&&u.value.has(b.value)),S=t=>{const n=w.value,l=E[b.value];if(!n)return;const c=C.value&&l;t||(n.style.transition="none"),c&&(n.style.top=`${l.offsetTop+(l.offsetHeight-Q)/2}px`),n.toggleAttribute("data-on",!!c),t||(n.offsetHeight,n.style.transition="")},x=()=>{_?.disconnect(),S(!0);let t=!0;_=new ResizeObserver(()=>{if(t){t=!1;return}S(!1)}),y.value&&_.observe(y.value)};e.onMounted(x),e.onUnmounted(()=>_?.disconnect()),e.watch(()=>[b.value,C.value,p.value,a.fontSize,a.rowHeight],x,{flush:"post"});const H=(t,n)=>{s.value=t,$("select",t,n)},N=t=>{const n=new Set(u.value),l=!n.has(t);l?n.add(t):n.delete(t),u.value=n,$("toggle",t,l)},r=e.computed(()=>Math.min(a.radius,a.rowHeight/2-2)),B=e.computed(()=>a.indent-8),i=t=>m+t*a.rowHeight+a.rowHeight/2,V=t=>`M ${a.trunk} ${i(t)-r.value} A ${r.value} ${r.value} 0 0 0 ${a.trunk+r.value} ${i(t)} H ${B.value}`,z=t=>`M ${a.trunk} 0 V ${i(t)-r.value} A ${r.value} ${r.value} 0 0 0 ${a.trunk+r.value} ${i(t)} H ${B.value}`,D=t=>i(t)-r.value+Math.PI*r.value/2+(B.value-a.trunk-r.value),M=t=>`M ${a.trunk} 0 V ${i(t-1)-r.value}`,O=e.computed(()=>({"--bm-w":`${a.width}px`,...a.color!==void 0&&{"--bm-ink":a.color},...a.accentColor!==void 0&&{"--bm-accent":a.accentColor},...a.lineColor!==void 0&&{"--bm-line":a.lineColor},"--bm-font":`${a.fontSize}px`,"--bm-row":`${a.rowHeight}px`,"--bm-indent":`${a.indent}px`,"--bm-line-w":a.lineWidth,"--bm-pad":`${m}px`,"--bm-draw":`${a.drawDuration}ms`,"--bm-fold":`${a.foldDuration}ms`}));return(t,n)=>(e.openBlock(),e.createElementBlock("nav",{ref_key:"navRef",ref:y,class:e.normalizeClass(["g-branched",t.className]),style:e.normalizeStyle(O.value)},[e.createElementVNode("span",{ref_key:"markerRef",ref:w,class:"g-branched__marker","aria-hidden":"true"},null,512),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(l,c)=>(e.openBlock(),e.createElementBlock("div",{key:l.value??l.label,class:"g-branched__section","data-open":l.children&&u.value.has(c)?"":void 0},[e.createElementVNode("button",{ref_for:!0,ref:o=>E[c]=o,type:"button",class:"g-branched__head","aria-expanded":l.children?u.value.has(c):void 0,"aria-current":!l.children&&(l.value??l.label)===s.value?"true":void 0,"data-active":!l.children&&(l.value??l.label)===s.value?"":void 0,onClick:o=>l.children?N(c):H(l.value??l.label,l)},e.toDisplayString(l.label),9,R),l.children?(e.openBlock(),e.createElementBlock("div",T,[e.createElementVNode("div",F,[e.createElementVNode("div",{class:"g-branched__body",style:e.normalizeStyle({height:`${m*2+l.children.length*t.rowHeight}px`})},[(e.openBlock(),e.createElementBlock("svg",{class:"g-branched__lines",width:t.indent,height:m*2+l.children.length*t.rowHeight,"aria-hidden":"true"},[e.createElementVNode("path",{class:"g-branched__path",d:M(l.children.length)},null,8,G),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.children,(o,h)=>(e.openBlock(),e.createElementBlock("path",{key:`line-${o.value}`,class:"g-branched__path",d:V(h)},null,8,P))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.children,(o,h)=>(e.openBlock(),e.createElementBlock("path",{key:`reach-${o.value}`,class:"g-branched__path g-branched__path--accent",d:z(h),style:e.normalizeStyle({strokeDasharray:D(h),strokeDashoffset:o.value===s.value?0:D(h)})},null,12,q))),128))],8,L)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.children,o=>(e.openBlock(),e.createElementBlock("button",{key:o.value,type:"button",class:"g-branched__item","aria-current":o.value===s.value?"true":void 0,"data-active":o.value===s.value?"":void 0,tabindex:u.value.has(c)?0:-1,onClick:h=>H(o.value,o)},[o.icon?(e.openBlock(),e.createElementBlock("span",W,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.icon)))])):e.createCommentVNode("",!0),e.createElementVNode("span",K,e.toDisplayString(o.label),1)],8,U))),128))],4)])])):e.createCommentVNode("",!0)],8,I))),128))],6))}}),A=(d,k)=>{const v=d.__vccOpts||d;for(const[f,a]of k)v[f]=a;return v},g=A(X,[["__scopeId","data-v-cd651c8b"]]);g.install=d=>{d.component(g.name,g)};exports.GBranched=g;exports._export_sfc=A;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { defineComponent as W, computed as f, ref as $, onMounted as q, onUnmounted as K, watch as Q, createElementBlock as s, openBlock as o, normalizeStyle as A, normalizeClass as X, createElementVNode as _, Fragment as w, renderList as k, createCommentVNode as G, toDisplayString as N, createBlock as Y, resolveDynamicComponent as j } from "vue";
|
|
2
|
+
const J = ["data-open"], Z = ["aria-expanded", "aria-current", "data-active", "onClick"], ee = {
|
|
3
|
+
key: 0,
|
|
4
|
+
class: "g-branched__fold"
|
|
5
|
+
}, ae = { class: "g-branched__clip" }, te = ["width", "height"], ne = ["d"], le = ["d"], oe = ["d"], re = ["aria-current", "data-active", "tabindex", "onClick"], se = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "g-branched__icon",
|
|
8
|
+
"aria-hidden": "true"
|
|
9
|
+
}, ce = { class: "g-branched__label" }, C = 6, ue = 16, de = /* @__PURE__ */ W({
|
|
10
|
+
name: "GBranched",
|
|
11
|
+
__name: "index",
|
|
12
|
+
props: {
|
|
13
|
+
items: { default: void 0 },
|
|
14
|
+
defaultOpen: { default: 0 },
|
|
15
|
+
defaultActive: { default: "" },
|
|
16
|
+
color: { default: void 0 },
|
|
17
|
+
accentColor: { default: void 0 },
|
|
18
|
+
lineColor: { default: void 0 },
|
|
19
|
+
width: { default: 240 },
|
|
20
|
+
rowHeight: { default: 36 },
|
|
21
|
+
indent: { default: 40 },
|
|
22
|
+
trunk: { default: 14 },
|
|
23
|
+
radius: { default: 10 },
|
|
24
|
+
lineWidth: { default: 1.5 },
|
|
25
|
+
fontSize: { default: 14 },
|
|
26
|
+
drawDuration: { default: 400 },
|
|
27
|
+
foldDuration: { default: 300 },
|
|
28
|
+
className: { default: "" }
|
|
29
|
+
},
|
|
30
|
+
emits: ["select", "toggle"],
|
|
31
|
+
setup(d, { emit: x }) {
|
|
32
|
+
const b = [
|
|
33
|
+
{
|
|
34
|
+
label: "Getting started",
|
|
35
|
+
children: [
|
|
36
|
+
{ value: "install", label: "Installation" },
|
|
37
|
+
{ value: "quick", label: "Quick start" },
|
|
38
|
+
{ value: "config", label: "Configuration" },
|
|
39
|
+
{ value: "theming", label: "Theming" }
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: "Components",
|
|
44
|
+
children: [
|
|
45
|
+
{ value: "buttons", label: "Buttons" },
|
|
46
|
+
{ value: "typography", label: "Typography" },
|
|
47
|
+
{ value: "overlays", label: "Overlays" },
|
|
48
|
+
{ value: "toasts", label: "Toasts" }
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
], p = (e) => new Set(Array.isArray(e) ? e : e >= 0 ? [e] : []), a = d, M = x, g = f(() => a.items ?? b), i = $(p(a.defaultOpen)), u = $(
|
|
52
|
+
a.defaultActive || (g.value.find((e, n) => e.children && p(a.defaultOpen).has(n))?.children?.[0]?.value ?? "")
|
|
53
|
+
), H = $(null), O = $(null), z = [];
|
|
54
|
+
let m = null;
|
|
55
|
+
const y = f(
|
|
56
|
+
() => g.value.findIndex((e) => e.children?.some((n) => n.value === u.value))
|
|
57
|
+
), B = f(() => y.value >= 0 && i.value.has(y.value)), I = (e) => {
|
|
58
|
+
const n = O.value, t = z[y.value];
|
|
59
|
+
if (!n) return;
|
|
60
|
+
const c = B.value && t;
|
|
61
|
+
e || (n.style.transition = "none"), c && (n.style.top = `${t.offsetTop + (t.offsetHeight - ue) / 2}px`), n.toggleAttribute("data-on", !!c), e || (n.offsetHeight, n.style.transition = "");
|
|
62
|
+
}, R = () => {
|
|
63
|
+
m?.disconnect(), I(!0);
|
|
64
|
+
let e = !0;
|
|
65
|
+
m = new ResizeObserver(() => {
|
|
66
|
+
if (e) {
|
|
67
|
+
e = !1;
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
I(!1);
|
|
71
|
+
}), H.value && m.observe(H.value);
|
|
72
|
+
};
|
|
73
|
+
q(R), K(() => m?.disconnect()), Q(
|
|
74
|
+
() => [
|
|
75
|
+
y.value,
|
|
76
|
+
B.value,
|
|
77
|
+
g.value,
|
|
78
|
+
a.fontSize,
|
|
79
|
+
a.rowHeight
|
|
80
|
+
],
|
|
81
|
+
R,
|
|
82
|
+
{
|
|
83
|
+
flush: "post"
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
const T = (e, n) => {
|
|
87
|
+
u.value = e, M("select", e, n);
|
|
88
|
+
}, V = (e) => {
|
|
89
|
+
const n = new Set(i.value), t = !n.has(e);
|
|
90
|
+
t ? n.add(e) : n.delete(e), i.value = n, M("toggle", e, t);
|
|
91
|
+
}, r = f(() => Math.min(a.radius, a.rowHeight / 2 - 2)), S = f(() => a.indent - 8), h = (e) => C + e * a.rowHeight + a.rowHeight / 2, P = (e) => `M ${a.trunk} ${h(e) - r.value} A ${r.value} ${r.value} 0 0 0 ${a.trunk + r.value} ${h(e)} H ${S.value}`, F = (e) => `M ${a.trunk} 0 V ${h(e) - r.value} A ${r.value} ${r.value} 0 0 0 ${a.trunk + r.value} ${h(e)} H ${S.value}`, E = (e) => h(e) - r.value + Math.PI * r.value / 2 + (S.value - a.trunk - r.value), L = (e) => `M ${a.trunk} 0 V ${h(e - 1) - r.value}`, U = f(
|
|
92
|
+
() => ({
|
|
93
|
+
"--bm-w": `${a.width}px`,
|
|
94
|
+
// 颜色未传入时不内联变量,走 scoped 样式里的明暗自适应默认值
|
|
95
|
+
...a.color !== void 0 && { "--bm-ink": a.color },
|
|
96
|
+
...a.accentColor !== void 0 && { "--bm-accent": a.accentColor },
|
|
97
|
+
...a.lineColor !== void 0 && { "--bm-line": a.lineColor },
|
|
98
|
+
"--bm-font": `${a.fontSize}px`,
|
|
99
|
+
"--bm-row": `${a.rowHeight}px`,
|
|
100
|
+
"--bm-indent": `${a.indent}px`,
|
|
101
|
+
"--bm-line-w": a.lineWidth,
|
|
102
|
+
"--bm-pad": `${C}px`,
|
|
103
|
+
"--bm-draw": `${a.drawDuration}ms`,
|
|
104
|
+
"--bm-fold": `${a.foldDuration}ms`
|
|
105
|
+
})
|
|
106
|
+
);
|
|
107
|
+
return (e, n) => (o(), s("nav", {
|
|
108
|
+
ref_key: "navRef",
|
|
109
|
+
ref: H,
|
|
110
|
+
class: X(["g-branched", e.className]),
|
|
111
|
+
style: A(U.value)
|
|
112
|
+
}, [
|
|
113
|
+
_("span", {
|
|
114
|
+
ref_key: "markerRef",
|
|
115
|
+
ref: O,
|
|
116
|
+
class: "g-branched__marker",
|
|
117
|
+
"aria-hidden": "true"
|
|
118
|
+
}, null, 512),
|
|
119
|
+
(o(!0), s(w, null, k(g.value, (t, c) => (o(), s("div", {
|
|
120
|
+
key: t.value ?? t.label,
|
|
121
|
+
class: "g-branched__section",
|
|
122
|
+
"data-open": t.children && i.value.has(c) ? "" : void 0
|
|
123
|
+
}, [
|
|
124
|
+
_("button", {
|
|
125
|
+
ref_for: !0,
|
|
126
|
+
ref: (l) => z[c] = l,
|
|
127
|
+
type: "button",
|
|
128
|
+
class: "g-branched__head",
|
|
129
|
+
"aria-expanded": t.children ? i.value.has(c) : void 0,
|
|
130
|
+
"aria-current": !t.children && (t.value ?? t.label) === u.value ? "true" : void 0,
|
|
131
|
+
"data-active": !t.children && (t.value ?? t.label) === u.value ? "" : void 0,
|
|
132
|
+
onClick: (l) => t.children ? V(c) : T(t.value ?? t.label, t)
|
|
133
|
+
}, N(t.label), 9, Z),
|
|
134
|
+
t.children ? (o(), s("div", ee, [
|
|
135
|
+
_("div", ae, [
|
|
136
|
+
_("div", {
|
|
137
|
+
class: "g-branched__body",
|
|
138
|
+
style: A({ height: `${C * 2 + t.children.length * e.rowHeight}px` })
|
|
139
|
+
}, [
|
|
140
|
+
(o(), s("svg", {
|
|
141
|
+
class: "g-branched__lines",
|
|
142
|
+
width: e.indent,
|
|
143
|
+
height: C * 2 + t.children.length * e.rowHeight,
|
|
144
|
+
"aria-hidden": "true"
|
|
145
|
+
}, [
|
|
146
|
+
_("path", {
|
|
147
|
+
class: "g-branched__path",
|
|
148
|
+
d: L(t.children.length)
|
|
149
|
+
}, null, 8, ne),
|
|
150
|
+
(o(!0), s(w, null, k(t.children, (l, v) => (o(), s("path", {
|
|
151
|
+
key: `line-${l.value}`,
|
|
152
|
+
class: "g-branched__path",
|
|
153
|
+
d: P(v)
|
|
154
|
+
}, null, 8, le))), 128)),
|
|
155
|
+
(o(!0), s(w, null, k(t.children, (l, v) => (o(), s("path", {
|
|
156
|
+
key: `reach-${l.value}`,
|
|
157
|
+
class: "g-branched__path g-branched__path--accent",
|
|
158
|
+
d: F(v),
|
|
159
|
+
style: A({
|
|
160
|
+
strokeDasharray: E(v),
|
|
161
|
+
strokeDashoffset: l.value === u.value ? 0 : E(v)
|
|
162
|
+
})
|
|
163
|
+
}, null, 12, oe))), 128))
|
|
164
|
+
], 8, te)),
|
|
165
|
+
(o(!0), s(w, null, k(t.children, (l) => (o(), s("button", {
|
|
166
|
+
key: l.value,
|
|
167
|
+
type: "button",
|
|
168
|
+
class: "g-branched__item",
|
|
169
|
+
"aria-current": l.value === u.value ? "true" : void 0,
|
|
170
|
+
"data-active": l.value === u.value ? "" : void 0,
|
|
171
|
+
tabindex: i.value.has(c) ? 0 : -1,
|
|
172
|
+
onClick: (v) => T(l.value, l)
|
|
173
|
+
}, [
|
|
174
|
+
l.icon ? (o(), s("span", se, [
|
|
175
|
+
(o(), Y(j(l.icon)))
|
|
176
|
+
])) : G("", !0),
|
|
177
|
+
_("span", ce, N(l.label), 1)
|
|
178
|
+
], 8, re))), 128))
|
|
179
|
+
], 4)
|
|
180
|
+
])
|
|
181
|
+
])) : G("", !0)
|
|
182
|
+
], 8, J))), 128))
|
|
183
|
+
], 6));
|
|
184
|
+
}
|
|
185
|
+
}), ie = (d, x) => {
|
|
186
|
+
const b = d.__vccOpts || d;
|
|
187
|
+
for (const [p, a] of x)
|
|
188
|
+
b[p] = a;
|
|
189
|
+
return b;
|
|
190
|
+
}, D = /* @__PURE__ */ ie(de, [["__scopeId", "data-v-cd651c8b"]]);
|
|
191
|
+
D.install = (d) => {
|
|
192
|
+
d.component(D.name, D);
|
|
193
|
+
};
|
|
194
|
+
export {
|
|
195
|
+
D as G,
|
|
196
|
+
ie as _
|
|
197
|
+
};
|
package/lib/GButton/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),d=require("motion-v"),b=require("../GBranched-BtF7heMk.js"),B=["type","disabled"],h={key:0,class:"g-button__loading"},f={key:1,class:"g-button__icon"},_={key:2,class:"g-button__text"},v=e.defineComponent({name:"GButton",__name:"index",props:{type:{},size:{},loading:{type:Boolean},disabled:{type:Boolean},block:{type:Boolean},nativeType:{}},emits:["click"],setup(i,{emit:r}){const s=i,u=r,p=t=>{if(!(s.disabled||s.loading)){if(s.type!=="link"&&!g.value){const o=t.currentTarget.getBoundingClientRect(),c=t.clientX!==0||t.clientY!==0,k={id:++m,x:c?t.clientX-o.left:o.width/2,y:c?t.clientY-o.top:o.height/2,size:Math.hypot(o.width,o.height)*2};l.value.push(k)}u("click",t)}},l=e.ref([]);let m=0;const y=t=>{l.value=l.value.filter(a=>a.id!==t)},g=d.useReducedMotion();return(t,a)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["g-button",["g-button--"+t.type,"g-button--"+t.size,{"is-block":t.block,"is-loading":t.loading,"is-disabled":t.disabled}]]),type:t.nativeType,disabled:t.disabled||t.loading,onClick:p},[t.loading?(e.openBlock(),e.createElementBlock("span",h)):e.createCommentVNode("",!0),t.$slots.icon?(e.openBlock(),e.createElementBlock("span",f,[e.renderSlot(t.$slots,"icon",{},void 0,!0)])):e.createCommentVNode("",!0),t.$slots.default?(e.openBlock(),e.createElementBlock("span",_,[e.renderSlot(t.$slots,"default",{},void 0,!0)])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,o=>(e.openBlock(),e.createBlock(e.unref(d.motion).span,{key:o.id,class:"g-button__wave",initial:{x:"-50%",y:"-50%",scale:0,opacity:.2},animate:{x:"-50%",y:"-50%",scale:1,opacity:0},transition:{duration:.6,ease:"easeOut"},style:e.normalizeStyle({left:o.x+"px",top:o.y+"px",width:o.size+"px",height:o.size+"px"}),onAnimationComplete:c=>y(o.id)},null,8,["style","onAnimationComplete"]))),128))],10,B))}}),n=b._export_sfc(v,[["__scopeId","data-v-7de4f689"]]);n.install=i=>{i.component(n.name,n)};exports.GButton=n;exports.default=n;
|
package/lib/GButton/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as k, ref as _, createElementBlock as n, openBlock as o, normalizeClass as B, createCommentVNode as
|
|
1
|
+
import { defineComponent as k, ref as _, createElementBlock as n, openBlock as o, normalizeClass as B, createCommentVNode as r, renderSlot as p, Fragment as v, renderList as z, createBlock as C, unref as $, normalizeStyle as M } from "vue";
|
|
2
2
|
import { useReducedMotion as T, motion as w } from "motion-v";
|
|
3
|
-
import { _ as A } from "../
|
|
3
|
+
import { _ as A } from "../GBranched-vnLlYOl9.mjs";
|
|
4
4
|
const G = ["type", "disabled"], I = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "g-button__loading"
|
|
@@ -56,13 +56,13 @@ const G = ["type", "disabled"], I = {
|
|
|
56
56
|
disabled: e.disabled || e.loading,
|
|
57
57
|
onClick: y
|
|
58
58
|
}, [
|
|
59
|
-
e.loading ? (o(), n("span", I)) :
|
|
59
|
+
e.loading ? (o(), n("span", I)) : r("", !0),
|
|
60
60
|
e.$slots.icon ? (o(), n("span", R, [
|
|
61
61
|
p(e.$slots, "icon", {}, void 0, !0)
|
|
62
|
-
])) :
|
|
62
|
+
])) : r("", !0),
|
|
63
63
|
e.$slots.default ? (o(), n("span", S, [
|
|
64
64
|
p(e.$slots, "default", {}, void 0, !0)
|
|
65
|
-
])) :
|
|
65
|
+
])) : r("", !0),
|
|
66
66
|
(o(!0), n(v, null, z(i.value, (t) => (o(), C($(w).span, {
|
|
67
67
|
key: t.id,
|
|
68
68
|
class: "g-button__wave",
|
|
@@ -74,11 +74,11 @@ const G = ["type", "disabled"], I = {
|
|
|
74
74
|
}, null, 8, ["style", "onAnimationComplete"]))), 128))
|
|
75
75
|
], 10, G));
|
|
76
76
|
}
|
|
77
|
-
}),
|
|
78
|
-
|
|
79
|
-
s.component(
|
|
77
|
+
}), c = /* @__PURE__ */ A(X, [["__scopeId", "data-v-7de4f689"]]);
|
|
78
|
+
c.install = (s) => {
|
|
79
|
+
s.component(c.name, c);
|
|
80
80
|
};
|
|
81
81
|
export {
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
c as GButton,
|
|
83
|
+
c as default
|
|
84
84
|
};
|
package/lib/GButton/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.g-button[data-v-
|
|
1
|
+
@charset "UTF-8";.g-button[data-v-7de4f689]{--g-button-wave-color: currentcolor;position:relative;display:inline-flex;align-items:center;justify-content:center;gap:6px;height:var(--g-size-middle-height, 32px);padding:0 15px;font-size:var(--g-button-font-size, 14px);line-height:1;white-space:nowrap;cursor:pointer;-webkit-user-select:none;user-select:none;overflow:hidden;color:var(--g-text-color, rgba(0, 0, 0, .88));background:var(--g-button-bg-color, var(--g-button-default-color, #e8e8eb));border:none;border-radius:var(--g-button-radius, 6px);outline:none;transition:all .2s cubic-bezier(.645,.045,.355,1)}.g-button[data-v-7de4f689]:not(.is-disabled):hover,.g-button[data-v-7de4f689]:not(.is-disabled):focus-visible{border-color:var(--g-primary-color, #039be5);color:var(--g-primary-color, #039be5)}.g-button[data-v-7de4f689]:not(.is-disabled):active{border-color:color-mix(in srgb,var(--g-primary-color, #039be5) 70%,#000);color:color-mix(in srgb,var(--g-primary-color, #039be5) 70%,#000)}.g-button.is-block[data-v-7de4f689]{display:flex;width:100%}.g-button.is-disabled[data-v-7de4f689]{cursor:not-allowed;opacity:.5}.g-button--large[data-v-7de4f689]{height:var(--g-size-large-height, 40px);padding:0 20px;font-size:var(--g-size-large-font-size, 16px);border-radius:calc(var(--g-button-radius, 6px) + 2px)}.g-button--small[data-v-7de4f689]{height:var(--g-size-small-height, 24px);padding:0 7px;font-size:var(--g-size-small-font-size, 12px);border-radius:calc(var(--g-button-radius, 6px) - 2px)}.g-button--primary[data-v-7de4f689]{--g-button-wave-color: #fff;color:#fff;background:var(--g-primary-color, #039be5);border-color:var(--g-primary-color, #039be5)}.g-button--primary[data-v-7de4f689]:not(.is-disabled):hover,.g-button--primary[data-v-7de4f689]:not(.is-disabled):focus-visible{color:#fff;background:color-mix(in srgb,var(--g-primary-color, #039be5) 85%,#fff)}.g-button--primary[data-v-7de4f689]:not(.is-disabled):active{color:#fff;background:color-mix(in srgb,var(--g-primary-color, #039be5) 70%,#000)}.g-button--success[data-v-7de4f689],.g-button--warning[data-v-7de4f689],.g-button--danger[data-v-7de4f689]{--g-button-wave-color: #fff;color:#fff}.g-button--success[data-v-7de4f689]:not(.is-disabled):hover,.g-button--success[data-v-7de4f689]:not(.is-disabled):focus-visible,.g-button--warning[data-v-7de4f689]:not(.is-disabled):hover,.g-button--warning[data-v-7de4f689]:not(.is-disabled):focus-visible,.g-button--danger[data-v-7de4f689]:not(.is-disabled):hover,.g-button--danger[data-v-7de4f689]:not(.is-disabled):focus-visible{color:#fff;background:color-mix(in srgb,var(--g-button-type-color) 85%,#fff)}.g-button--success[data-v-7de4f689]:not(.is-disabled):active,.g-button--warning[data-v-7de4f689]:not(.is-disabled):active,.g-button--danger[data-v-7de4f689]:not(.is-disabled):active{color:#fff;background:color-mix(in srgb,var(--g-button-type-color) 70%,#000)}.g-button--success[data-v-7de4f689]{--g-button-type-color: var(--g-success-color, #50c189);background:var(--g-button-type-color);border-color:var(--g-button-type-color)}.g-button--warning[data-v-7de4f689]{--g-button-type-color: var(--g-warning-color, #f78716);background:var(--g-button-type-color);border-color:var(--g-button-type-color)}.g-button--danger[data-v-7de4f689]{--g-button-type-color: var(--g-danger-color, #e1594d);background:var(--g-button-type-color);border-color:var(--g-button-type-color)}.g-button--emphasis[data-v-7de4f689]{--g-button-wave-color: var(--g-emphasis-text-color, #fff);color:var(--g-emphasis-text-color, #fff);background:var(--g-emphasis-color, #000)}.g-button--emphasis[data-v-7de4f689]:not(.is-disabled):hover,.g-button--emphasis[data-v-7de4f689]:not(.is-disabled):focus-visible{color:var(--g-emphasis-text-color, #fff);background:color-mix(in srgb,var(--g-emphasis-color, #000) 85%,var(--g-emphasis-text-color, #fff))}.g-button--emphasis[data-v-7de4f689]:not(.is-disabled):active{color:var(--g-emphasis-text-color, #fff);background:color-mix(in srgb,var(--g-emphasis-color, #000) 70%,var(--g-emphasis-text-color, #fff))}.g-button--link[data-v-7de4f689]{height:auto;padding:2px 5px;background:transparent;border-color:transparent}.g-button--link[data-v-7de4f689]:not(.is-disabled):hover,.g-button--link[data-v-7de4f689]:not(.is-disabled):focus-visible{color:color-mix(in srgb,var(--g-primary-color, #039be5) 85%,#fff);background:transparent}.g-button__loading[data-v-7de4f689]{width:1em;height:1em;border:2px solid currentcolor;border-top-color:transparent;border-radius:50%;animation:g-button-spin-7de4f689 .6s linear infinite}.g-button__icon[data-v-7de4f689]{display:inline-flex;align-items:center}.g-button__icon[data-v-7de4f689] svg{width:1em;height:1em;display:block}.g-button__wave[data-v-7de4f689]{position:absolute;border-radius:50%;background:var(--g-button-wave-color);opacity:.2;pointer-events:none}@keyframes g-button-spin-7de4f689{to{transform:rotate(360deg)}}
|
package/lib/GCard/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),U=require("../
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),U=require("../GBranched-BtF7heMk.js"),W={class:"g-card__content"},H=a.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},shadow:{type:Boolean,default:!0},glow:{type:Boolean,default:!0}},setup(v){function B(e){const t=e.match(/([\d.]+)\s*([\d.]+)%?\s*([\d.]+)%?/);return t?{h:parseFloat(t[1]),s:parseFloat(t[2]),l:parseFloat(t[3])}:{h:40,s:80,l:80}}function O(e,t){const{h:n,s:o,l}=B(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,$,k,T,q])=>{const D=Math.min(T*t,100);return`${q?"inset ":""}${d}px ${s}px ${$}px ${k}px hsl(${c} / ${D}%)`}).join(", ")}function C(e){return 1-Math.pow(1-e,3)}function w(e){return e*e*e}function b({start:e=0,end:t=100,duration:n=1e3,delay:o=0,ease:l=C,onUpdate:c,onEnd:i}){const d=performance.now()+o;function s(){const $=performance.now()-d,k=Math.min($/n,1);c(e+(t-e)*l(k)),k<1?requestAnimationFrame(s):i&&i()}setTimeout(()=>requestAnimationFrame(s),o)}const P=["80% 55%","69% 34%","8% 6%","41% 38%","86% 85%","82% 18%","51% 4%"],E=[0,1,2,0,1,2,1];function N(e){const t=[];for(let n=0;n<7;n++){const o=e[Math.min(E[n],e.length-1)];t.push(`radial-gradient(at ${P[n]}, ${o} 0px, transparent 50%)`)}return t.push(`linear-gradient(${e[0]} 0 100%)`),t}const r=v,S=a.computed(()=>r.backgroundColor??"transparent"),x=a.useTemplateRef("cardRef"),y=a.ref(!1),f=a.ref(45),p=a.ref(0),h=a.ref(!1),M=e=>{const{width:t,height:n}=e.getBoundingClientRect();return[t/2,n/2]},z=(e,t,n)=>{const[o,l]=M(e),c=t-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,t,n)=>{const[o,l]=M(e),c=t-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 t=x.value;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left,l=e.clientY-n.top;p.value=z(t,o,l),f.value=V(t,o,l)};a.watch(()=>r.animated,()=>{if(!r.animated)return;const e=110,t=465;h.value=!0,f.value=e,b({duration:500,onUpdate:n=>p.value=n/100}),b({ease:w,duration:1500,end:50,onUpdate:n=>{f.value=(t-e)*(n/100)+e}}),b({ease:C,delay:1500,duration:2250,start:50,end:100,onUpdate:n=>{f.value=(t-e)*(n/100)+e}}),b({ease:w,delay:2500,duration:1500,start:100,end:0,onUpdate:n=>p.value=n/100,onEnd:()=>h.value=!1})},{immediate:!0});const _=a.computed(()=>r.edgeSensitivity+20),g=a.computed(()=>y.value||h.value),I=a.computed(()=>g.value?Math.max(0,(p.value*100-_.value)/(100-_.value)):0),F=a.computed(()=>g.value?Math.max(0,(p.value*100-r.edgeSensitivity)/(100-r.edgeSensitivity)):0),R=a.computed(()=>N(r.colors)),j=a.computed(()=>R.value.map(e=>`${e} border-box`)),G=a.computed(()=>R.value.map(e=>`${e} padding-box`)),u=a.computed(()=>`${f.value.toFixed(3)}deg`);return(e,t)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"cardRef",ref:x,onPointermove:A,onPointerenter:t[0]||(t[0]=n=>y.value=!0),onPointerleave:t[1]||(t[1]=n=>y.value=!1),class:a.normalizeClass(["g-card",{"g-card--shadow":r.shadow},r.className]),style:a.normalizeStyle({background:S.value,borderRadius:r.borderRadius+"px"})},[r.glow?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createElementVNode("div",{class:"g-card__border",style:a.normalizeStyle({background:[`linear-gradient(${S.value} 0 100%) padding-box`,"linear-gradient(rgb(255 255 255 / 0%) 0% 100%) border-box",...j.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),a.createElementVNode("div",{class:"g-card__fill",style:a.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),a.createElementVNode("span",{class:"g-card__glow",style:a.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:F.value,transition:g.value?"opacity 0.25s ease-out":"opacity 0.75s ease-in-out"})},[a.createElementVNode("span",{class:"g-card__glow-inner",style:a.normalizeStyle({inset:`${r.glowRadius}px`,boxShadow:O(r.glowColor,r.glowIntensity)})},null,4)],4)],64)):a.createCommentVNode("",!0),a.createElementVNode("div",W,[a.renderSlot(e.$slots,"default",{},void 0,!0)])],38))}}),m=U._export_sfc(H,[["__scopeId","data-v-c2ad9d99"]]),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;
|
package/lib/GCard/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as X, computed as i, useTemplateRef as Y, ref as y, watch as J, createElementBlock as A, openBlock as F, normalizeStyle as b, normalizeClass as K, createCommentVNode as Z, createElementVNode as m, Fragment as ee, renderSlot as ae } from "vue";
|
|
2
|
-
import { _ as te } from "../
|
|
2
|
+
import { _ as te } from "../GBranched-vnLlYOl9.mjs";
|
|
3
3
|
const ne = { class: "g-card__content" }, re = /* @__PURE__ */ X({
|
|
4
4
|
__name: "index",
|
|
5
5
|
props: {
|
package/lib/GDialog/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),x=require("motion-v"),L=require("../GBubble-Dph0YDkU.js"),E=require("../GButton/index.js"),F=Symbol("GDialogManager"),I={small:"380px",medium:"480px",large:"580px"},V={ICON_WIDTH:92,ICON_HEIGHT:34,GAP:8,BOTTOM_OFFSET:18,RIGHT_OFFSET:18,MAX_PER_ROW:8};function ee(s){const f=new Map,{ICON_WIDTH:l,ICON_HEIGHT:r,GAP:p,BOTTOM_OFFSET:n,RIGHT_OFFSET:o,MAX_PER_ROW:c}=V;return s.forEach((d,u)=>{const i=Math.floor(u/c),a=u%c;f.set(d,{right:o+a*(l+p),bottom:n+i*(r+p)})}),f}function te(){const s=e.reactive(new Map),f=e.computed(()=>{const i=[];return s.forEach(a=>{a.isMinimized&&i.push(a.id)}),i}),l=e.computed(()=>ee(f.value));function r(i){s.set(i.id,{attentionTick:0,...i})}function p(i){s.delete(i)}function n(i){const a=s.get(i);if(a){if(a.isMinimized){a.attentionTick=(a.attentionTick??0)+1;return}a.isMinimized=!0}}function o(i){const a=s.get(i);a?.isMinimized&&(a.attentionTick=(a.attentionTick??0)+1)}function c(i){const a=s.get(i);a&&(a.isMinimized=!1)}function d(i){return e.computed(()=>l.value.get(i)??{right:V.RIGHT_OFFSET,bottom:V.BOTTOM_OFFSET})}const u=e.computed(()=>f.value.map(i=>s.get(i)).filter(Boolean));return{dialogs:s,register:r,unregister:p,minimize:n,remindMinimized:o,restore:c,getPosition:d,minimizedList:u}}function H(){return e.inject(F,null)}const B={viewBox:"0 0 1024 1024",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em"},P=()=>e.h("svg",B,[e.h("path",{d:"M874.666667 512a362.666667 362.666667 0 1 0-362.666667 362.666667V938.666667C276.352 938.666667 85.333333 747.648 85.333333 512S276.352 85.333333 512 85.333333s426.666667 191.018667 426.666667 426.666667-191.018667 426.666667-426.666667 426.666667v-64a362.666667 362.666667 0 0 0 362.666667-362.666667z"}),e.h("path",{d:"M318.72 318.72a32 32 0 0 1 45.226667 0l341.333333 341.333333a32 32 0 1 1-45.226667 45.226667l-341.333333-341.333333a32 32 0 0 1 0-45.226667z"}),e.h("path",{d:"M705.28 318.72a32 32 0 0 0-45.226667 0l-341.333333 341.333333a32 32 0 1 0 45.226667 45.226667l341.333333-341.333333a32 32 0 0 0 0-45.226667z"})]),$=()=>e.h("svg",B,[e.h("path",{d:"M661.333333 309.333333a266.666667 266.666667 0 1 1 0 533.333334H170.666667a32 32 0 0 1 0-64h490.666666a202.666667 202.666667 0 1 0 0-405.333334H170.666667a32 32 0 0 1 0-64h490.666666z"}),e.h("path",{d:"M98.133333 348.714667a8.533333 8.533333 0 0 1 0-14.762667l166.4-96.085333a8.533333 8.533333 0 0 1 12.8 7.381333v192.170667a8.533333 8.533333 0 0 1-12.8 7.381333L98.133333 348.714667z"})]),W=()=>e.h("svg",B,[e.h("path",{d:"M874.666667 512a362.666667 362.666667 0 1 0-362.666667 362.666667V938.666667C276.352 938.666667 85.333333 747.648 85.333333 512S276.352 85.333333 512 85.333333s426.666667 191.018667 426.666667 426.666667-191.018667 426.666667-426.666667 426.666667v-64a362.666667 362.666667 0 0 0 362.666667-362.666667z"}),e.h("path",{d:"M685.653333 361.386667a32 32 0 1 1 45.226667 45.226666l-249.472 249.514667a40.533333 40.533333 0 0 1-59.434667-2.304l-122.026666-142.336a32 32 0 0 1 48.64-41.642667l105.472 123.050667L685.653333 361.386667z"})]),q=()=>e.h("svg",B,[e.h("path",{d:"M130.133333 746.666667v-469.333334A138.666667 138.666667 0 0 1 268.8 138.666667h362.666667a32 32 0 0 1 0 64H268.8A74.666667 74.666667 0 0 0 194.133333 277.333333v469.333334c0 41.216 33.450667 74.666667 74.666667 74.666666h362.666667a32 32 0 0 1 0 64H268.8a138.666667 138.666667 0 0 1-138.666667-138.666666z"}),e.h("path",{d:"M635.562667 738.304a32.042667 32.042667 0 0 0 45.312 0l203.605333-203.690667a32 32 0 0 0 0-45.226666l-203.605333-203.690667a32.042667 32.042667 0 0 0-45.312 45.312l149.077333 148.992H477.866667a32 32 0 0 0 0 64h306.773333l-149.077333 148.992a32.042667 32.042667 0 0 0 0 45.312z"})]),oe={class:"g-dialog-pro-minimized-icon__icon","aria-hidden":"true"},ie={class:"g-dialog-pro-minimized-icon__title"},ae=e.defineComponent({name:"GDialogMinimizedIcon",__name:"GDialogMinimizedIcon",props:{title:{},position:{},attentionTick:{default:0}},emits:["restore"],setup(s,{emit:f}){const l=s,r=f,p=e.computed(()=>l.title||"弹窗"),n=e.computed(()=>`恢复 ${p.value}`),o={opacity:0,scale:.8,x:-24,y:12},c={opacity:1,scale:1,x:0,y:0},d={opacity:0,scale:.8,x:-24,y:12},u={duration:.28,ease:[.2,.8,.2,1]},i={scale:1.04,y:-2},a={scale:.98},y=e.computed(()=>({position:"fixed",right:`${l.position.right}px`,bottom:`${l.position.bottom}px`})),v=e.ref(!1);let k;e.watch(()=>l.attentionTick,(M,g)=>{g===void 0||M===g||(v.value=!1,window.clearTimeout(k),window.requestAnimationFrame(()=>{v.value=!0,k=window.setTimeout(()=>{v.value=!1},580)}))}),e.onUnmounted(()=>{window.clearTimeout(k)});function w(){r("restore")}return(M,g)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.unref(x.motion).div,{class:e.normalizeClass(["g-dialog-pro-minimized-icon",{"is-attention":v.value}]),type:"button",style:e.normalizeStyle(y.value),title:n.value,"aria-label":n.value,initial:o,animate:c,exit:d,transition:u,"while-hover":i,"while-press":a,onClick:w},{default:e.withCtx(()=>[g[0]||(g[0]=e.createElementVNode("span",{class:"g-dialog-pro-minimized-icon__glow","aria-hidden":"true"},null,-1)),g[1]||(g[1]=e.createElementVNode("span",{class:"g-dialog-pro-minimized-icon__wave","aria-hidden":"true"},null,-1)),e.createElementVNode("span",oe,[e.createVNode(e.unref(q))]),e.createElementVNode("span",ie,e.toDisplayString(p.value),1)]),_:1,__:[0,1]},8,["class","style","title","aria-label"])]))}}),b=L._export_sfc(ae,[["__scopeId","data-v-e7d8c859"]]),ne={class:"g-dialog-pro-header"},le={class:"g-dialog-pro-title"},se={class:"g-dialog-pro-operation-container","aria-label":"弹窗操作"},re=["aria-label","title"],ce={class:"g-dialog-pro-body"},de={key:0,class:"g-dialog-pro-footer"},ue={class:"g-dialog-pro-actions"},R="关闭",me=e.defineComponent({name:"GDialog",inheritAttrs:!1,__name:"index",props:{title:{default:""},size:{default:"medium"},modelValue:{type:Boolean},hideFooter:{type:Boolean,default:!1},actions:{},showCancel:{type:Boolean,default:!0},showReset:{type:Boolean,default:!0},showSave:{type:Boolean,default:!0},cancelText:{default:"取消"},resetText:{default:"重置"},saveText:{default:"保存"},saveLoading:{type:Boolean,default:!1},saveDisabled:{type:Boolean,default:!1},beforeClose:{}},emits:["cancel","reset","save","minimize","action","update:modelValue"],setup(s,{emit:f}){const l=s,r=f,p=e.computed(()=>l.modelValue),n=e.useId?e.useId():`g-dialog-pro-${Date.now()}-${Math.random().toString(36).slice(2)}`,o=H(),c=e.ref(!1),d=e.ref(!0),u=e.ref(0),i=e.ref(!1),a=e.ref(!1),y=e.ref(!1),v=e.computed(()=>o?o.dialogs.get(n)?.isMinimized??!1:c.value),k=e.computed(()=>o?o.dialogs.get(n)?.attentionTick??0:u.value),w=e.computed(()=>o?!a.value:d.value),M=e.computed(()=>o?o.getPosition(n).value:{right:20,bottom:20});e.onMounted(()=>{o?.register({id:n,title:l.title,isMinimized:!1}),document.addEventListener("keydown",S)}),e.onUnmounted(()=>{o?.unregister(n),document.removeEventListener("keydown",S)}),e.watch(()=>l.title,t=>{if(o){const h=o.dialogs.get(n);h&&(h.title=t)}}),e.watch(()=>l.modelValue,t=>{if(t===!1){if(i.value)return;o?(o.restore(n),a.value=!1):(d.value=!0,c.value=!1)}t===!0&&(o?.dialogs.get(n)?.isMinimized?o.remindMinimized(n):c.value&&(u.value+=1))});const g=e.computed(()=>Object.prototype.hasOwnProperty.call(I,l.size)?I[l.size]:l.size),U=e.computed(()=>C.value?{}:{width:g.value});async function z(t){if(!l.beforeClose)return!0;try{return await l.beforeClose(t)!==!1}catch{return!1}}async function T(){await z("close")&&r("update:modelValue",!1)}function Y(){T()}function S(t){t.key==="Escape"&&(!l.modelValue||!w.value||v.value||(t.stopPropagation(),T()))}async function D(){await z("cancel")&&r("cancel")}function O(){r("reset")}async function A(){await z("save")&&r("save")}const N=e.reactive({});async function Z(t){if(await z("action")&&(r("action",t.key),!!t.onClick))try{const h=t.onClick();h instanceof Promise&&(N[t.key]=!0,await h)}finally{N[t.key]=!1}}const C=e.ref(!1),j=()=>{C.value=!C.value},G=e.computed(()=>C.value?"退出全屏":"全屏"),K=async()=>{if(!await z("minimize"))return;if(o?o.dialogs.get(n)?.isMinimized??!1:c.value){o?o.minimize(n):u.value+=1,r("minimize",{id:n});return}i.value=!0,o?o.minimize(n):c.value=!0,r("update:modelValue",!1),r("minimize",{id:n})},X=()=>{y.value=!0,i.value=!1,o?(a.value=!1,o.restore(n)):(d.value=!0,c.value=!1),r("update:modelValue",!0)},J=()=>{i.value&&(o?a.value=!0:d.value=!1,i.value=!1)},Q=()=>{y.value=!1};return(t,h)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"g-dialog-pro-fade",onAfterEnter:Q,onAfterLeave:J},{default:e.withCtx(()=>[w.value&&p.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"g-dialog-pro-overlay",onClick:e.withModifiers(Y,["self"])},[e.createElementVNode("div",e.mergeProps(t.$attrs,{class:["g-dialog-pro",{"is-fullscreen":C.value,"is-leave-to-minimize":i.value,"is-enter-from-minimize":y.value}],style:U.value,role:"dialog","aria-modal":"true"}),[e.createElementVNode("header",ne,[e.createElementVNode("p",le,e.toDisplayString(t.title),1),e.createElementVNode("div",se,[e.createElementVNode("button",{type:"button",class:"g-dialog-pro-control g-dialog-pro-control--minimize","aria-label":"最小化",title:"最小化",onClick:K}),e.createElementVNode("button",{type:"button",class:"g-dialog-pro-control g-dialog-pro-control--fullscreen","aria-label":G.value,title:G.value,onClick:j},null,8,re),e.createElementVNode("button",{type:"button",class:"g-dialog-pro-control g-dialog-pro-control--close","aria-label":R,title:R,onClick:T})])]),e.createElementVNode("div",ce,[e.renderSlot(t.$slots,"default",{},void 0,!0)]),t.hideFooter?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("footer",de,[e.renderSlot(t.$slots,"footer",{cancel:D,reset:O,save:A,close:T,loading:t.saveLoading},()=>[e.createElementVNode("div",ue,[t.actions&&t.actions.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.actions,m=>(e.openBlock(),e.createBlock(E.default,{key:m.key,type:m.type,danger:m.danger,loading:m.loading||N[m.key],disabled:m.disabled,size:"small",onClick:fe=>Z(m)},e.createSlots({default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(m.label),1)]),_:2},[m.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.icon)))]),key:"0"}:void 0]),1032,["type","danger","loading","disabled","onClick"]))),128)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.showCancel?(e.openBlock(),e.createBlock(E.default,{key:0,size:"small",onClick:D},{icon:e.withCtx(()=>[e.createVNode(e.unref(P))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.cancelText),1)]),_:1})):e.createCommentVNode("",!0),t.showReset?(e.openBlock(),e.createBlock(E.default,{key:1,size:"small",onClick:O},{icon:e.withCtx(()=>[e.createVNode(e.unref($))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.resetText),1)]),_:1})):e.createCommentVNode("",!0),t.showSave?(e.openBlock(),e.createBlock(E.default,{key:2,type:"primary",loading:t.saveLoading,disabled:t.saveDisabled,size:"small",onClick:A},{icon:e.withCtx(()=>[e.createVNode(e.unref(W))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.saveText),1)]),_:1},8,["loading","disabled"])):e.createCommentVNode("",!0)],64)),e.renderSlot(t.$slots,"moreOperations",{},void 0,!0)])],!0)]))],16)])):e.createCommentVNode("",!0)]),_:3}),e.createVNode(e.unref(x.AnimatePresence),null,{default:e.withCtx(()=>[v.value?(e.openBlock(),e.createBlock(b,{key:0,title:t.title,position:M.value,"attention-tick":k.value,onRestore:X},null,8,["title","position","attention-tick"])):e.createCommentVNode("",!0)]),_:1})]))}}),_=L._export_sfc(me,[["__scopeId","data-v-5e0eed3b"]]);_.install=s=>{s.component(_.name,_),s.component(b.name,b)};exports.ChatDotRound=q;exports.CircleCheck=W;exports.DIALOG_MANAGER_KEY=F;exports.DIALOG_SIZES=I;exports.GDialog=_;exports.GDialogMinimizedIcon=b;exports.MINIMIZED_LAYOUT=V;exports.Refresh=$;exports.Remove=P;exports.createDialogManager=te;exports.default=_;exports.useDialogManager=H;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),x=require("motion-v"),L=require("../GBranched-BtF7heMk.js"),E=require("../GButton/index.js"),F=Symbol("GDialogManager"),I={small:"380px",medium:"480px",large:"580px"},V={ICON_WIDTH:92,ICON_HEIGHT:34,GAP:8,BOTTOM_OFFSET:18,RIGHT_OFFSET:18,MAX_PER_ROW:8};function ee(s){const f=new Map,{ICON_WIDTH:l,ICON_HEIGHT:r,GAP:p,BOTTOM_OFFSET:n,RIGHT_OFFSET:o,MAX_PER_ROW:c}=V;return s.forEach((d,u)=>{const i=Math.floor(u/c),a=u%c;f.set(d,{right:o+a*(l+p),bottom:n+i*(r+p)})}),f}function te(){const s=e.reactive(new Map),f=e.computed(()=>{const i=[];return s.forEach(a=>{a.isMinimized&&i.push(a.id)}),i}),l=e.computed(()=>ee(f.value));function r(i){s.set(i.id,{attentionTick:0,...i})}function p(i){s.delete(i)}function n(i){const a=s.get(i);if(a){if(a.isMinimized){a.attentionTick=(a.attentionTick??0)+1;return}a.isMinimized=!0}}function o(i){const a=s.get(i);a?.isMinimized&&(a.attentionTick=(a.attentionTick??0)+1)}function c(i){const a=s.get(i);a&&(a.isMinimized=!1)}function d(i){return e.computed(()=>l.value.get(i)??{right:V.RIGHT_OFFSET,bottom:V.BOTTOM_OFFSET})}const u=e.computed(()=>f.value.map(i=>s.get(i)).filter(Boolean));return{dialogs:s,register:r,unregister:p,minimize:n,remindMinimized:o,restore:c,getPosition:d,minimizedList:u}}function H(){return e.inject(F,null)}const b={viewBox:"0 0 1024 1024",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em"},P=()=>e.h("svg",b,[e.h("path",{d:"M874.666667 512a362.666667 362.666667 0 1 0-362.666667 362.666667V938.666667C276.352 938.666667 85.333333 747.648 85.333333 512S276.352 85.333333 512 85.333333s426.666667 191.018667 426.666667 426.666667-191.018667 426.666667-426.666667 426.666667v-64a362.666667 362.666667 0 0 0 362.666667-362.666667z"}),e.h("path",{d:"M318.72 318.72a32 32 0 0 1 45.226667 0l341.333333 341.333333a32 32 0 1 1-45.226667 45.226667l-341.333333-341.333333a32 32 0 0 1 0-45.226667z"}),e.h("path",{d:"M705.28 318.72a32 32 0 0 0-45.226667 0l-341.333333 341.333333a32 32 0 1 0 45.226667 45.226667l341.333333-341.333333a32 32 0 0 0 0-45.226667z"})]),$=()=>e.h("svg",b,[e.h("path",{d:"M661.333333 309.333333a266.666667 266.666667 0 1 1 0 533.333334H170.666667a32 32 0 0 1 0-64h490.666666a202.666667 202.666667 0 1 0 0-405.333334H170.666667a32 32 0 0 1 0-64h490.666666z"}),e.h("path",{d:"M98.133333 348.714667a8.533333 8.533333 0 0 1 0-14.762667l166.4-96.085333a8.533333 8.533333 0 0 1 12.8 7.381333v192.170667a8.533333 8.533333 0 0 1-12.8 7.381333L98.133333 348.714667z"})]),W=()=>e.h("svg",b,[e.h("path",{d:"M874.666667 512a362.666667 362.666667 0 1 0-362.666667 362.666667V938.666667C276.352 938.666667 85.333333 747.648 85.333333 512S276.352 85.333333 512 85.333333s426.666667 191.018667 426.666667 426.666667-191.018667 426.666667-426.666667 426.666667v-64a362.666667 362.666667 0 0 0 362.666667-362.666667z"}),e.h("path",{d:"M685.653333 361.386667a32 32 0 1 1 45.226667 45.226666l-249.472 249.514667a40.533333 40.533333 0 0 1-59.434667-2.304l-122.026666-142.336a32 32 0 0 1 48.64-41.642667l105.472 123.050667L685.653333 361.386667z"})]),q=()=>e.h("svg",b,[e.h("path",{d:"M130.133333 746.666667v-469.333334A138.666667 138.666667 0 0 1 268.8 138.666667h362.666667a32 32 0 0 1 0 64H268.8A74.666667 74.666667 0 0 0 194.133333 277.333333v469.333334c0 41.216 33.450667 74.666667 74.666667 74.666666h362.666667a32 32 0 0 1 0 64H268.8a138.666667 138.666667 0 0 1-138.666667-138.666666z"}),e.h("path",{d:"M635.562667 738.304a32.042667 32.042667 0 0 0 45.312 0l203.605333-203.690667a32 32 0 0 0 0-45.226666l-203.605333-203.690667a32.042667 32.042667 0 0 0-45.312 45.312l149.077333 148.992H477.866667a32 32 0 0 0 0 64h306.773333l-149.077333 148.992a32.042667 32.042667 0 0 0 0 45.312z"})]),oe={class:"g-dialog-pro-minimized-icon__icon","aria-hidden":"true"},ie={class:"g-dialog-pro-minimized-icon__title"},ae=e.defineComponent({name:"GDialogMinimizedIcon",__name:"GDialogMinimizedIcon",props:{title:{},position:{},attentionTick:{default:0}},emits:["restore"],setup(s,{emit:f}){const l=s,r=f,p=e.computed(()=>l.title||"弹窗"),n=e.computed(()=>`恢复 ${p.value}`),o={opacity:0,scale:.8,x:-24,y:12},c={opacity:1,scale:1,x:0,y:0},d={opacity:0,scale:.8,x:-24,y:12},u={duration:.28,ease:[.2,.8,.2,1]},i={scale:1.04,y:-2},a={scale:.98},y=e.computed(()=>({position:"fixed",right:`${l.position.right}px`,bottom:`${l.position.bottom}px`})),v=e.ref(!1);let k;e.watch(()=>l.attentionTick,(M,g)=>{g===void 0||M===g||(v.value=!1,window.clearTimeout(k),window.requestAnimationFrame(()=>{v.value=!0,k=window.setTimeout(()=>{v.value=!1},580)}))}),e.onUnmounted(()=>{window.clearTimeout(k)});function w(){r("restore")}return(M,g)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.unref(x.motion).div,{class:e.normalizeClass(["g-dialog-pro-minimized-icon",{"is-attention":v.value}]),type:"button",style:e.normalizeStyle(y.value),title:n.value,"aria-label":n.value,initial:o,animate:c,exit:d,transition:u,"while-hover":i,"while-press":a,onClick:w},{default:e.withCtx(()=>[g[0]||(g[0]=e.createElementVNode("span",{class:"g-dialog-pro-minimized-icon__glow","aria-hidden":"true"},null,-1)),g[1]||(g[1]=e.createElementVNode("span",{class:"g-dialog-pro-minimized-icon__wave","aria-hidden":"true"},null,-1)),e.createElementVNode("span",oe,[e.createVNode(e.unref(q))]),e.createElementVNode("span",ie,e.toDisplayString(p.value),1)]),_:1,__:[0,1]},8,["class","style","title","aria-label"])]))}}),B=L._export_sfc(ae,[["__scopeId","data-v-e7d8c859"]]),ne={class:"g-dialog-pro-header"},le={class:"g-dialog-pro-title"},se={class:"g-dialog-pro-operation-container","aria-label":"弹窗操作"},re=["aria-label","title"],ce={class:"g-dialog-pro-body"},de={key:0,class:"g-dialog-pro-footer"},ue={class:"g-dialog-pro-actions"},R="关闭",me=e.defineComponent({name:"GDialog",inheritAttrs:!1,__name:"index",props:{title:{default:""},size:{default:"medium"},modelValue:{type:Boolean},hideFooter:{type:Boolean,default:!1},actions:{},showCancel:{type:Boolean,default:!0},showReset:{type:Boolean,default:!0},showSave:{type:Boolean,default:!0},cancelText:{default:"取消"},resetText:{default:"重置"},saveText:{default:"保存"},saveLoading:{type:Boolean,default:!1},saveDisabled:{type:Boolean,default:!1},beforeClose:{}},emits:["cancel","reset","save","minimize","action","update:modelValue"],setup(s,{emit:f}){const l=s,r=f,p=e.computed(()=>l.modelValue),n=e.useId?e.useId():`g-dialog-pro-${Date.now()}-${Math.random().toString(36).slice(2)}`,o=H(),c=e.ref(!1),d=e.ref(!0),u=e.ref(0),i=e.ref(!1),a=e.ref(!1),y=e.ref(!1),v=e.computed(()=>o?o.dialogs.get(n)?.isMinimized??!1:c.value),k=e.computed(()=>o?o.dialogs.get(n)?.attentionTick??0:u.value),w=e.computed(()=>o?!a.value:d.value),M=e.computed(()=>o?o.getPosition(n).value:{right:20,bottom:20});e.onMounted(()=>{o?.register({id:n,title:l.title,isMinimized:!1}),document.addEventListener("keydown",S)}),e.onUnmounted(()=>{o?.unregister(n),document.removeEventListener("keydown",S)}),e.watch(()=>l.title,t=>{if(o){const h=o.dialogs.get(n);h&&(h.title=t)}}),e.watch(()=>l.modelValue,t=>{if(t===!1){if(i.value)return;o?(o.restore(n),a.value=!1):(d.value=!0,c.value=!1)}t===!0&&(o?.dialogs.get(n)?.isMinimized?o.remindMinimized(n):c.value&&(u.value+=1))});const g=e.computed(()=>Object.prototype.hasOwnProperty.call(I,l.size)?I[l.size]:l.size),U=e.computed(()=>C.value?{}:{width:g.value});async function z(t){if(!l.beforeClose)return!0;try{return await l.beforeClose(t)!==!1}catch{return!1}}async function T(){await z("close")&&r("update:modelValue",!1)}function Y(){T()}function S(t){t.key==="Escape"&&(!l.modelValue||!w.value||v.value||(t.stopPropagation(),T()))}async function D(){await z("cancel")&&r("cancel")}function O(){r("reset")}async function A(){await z("save")&&r("save")}const N=e.reactive({});async function Z(t){if(await z("action")&&(r("action",t.key),!!t.onClick))try{const h=t.onClick();h instanceof Promise&&(N[t.key]=!0,await h)}finally{N[t.key]=!1}}const C=e.ref(!1),j=()=>{C.value=!C.value},G=e.computed(()=>C.value?"退出全屏":"全屏"),K=async()=>{if(!await z("minimize"))return;if(o?o.dialogs.get(n)?.isMinimized??!1:c.value){o?o.minimize(n):u.value+=1,r("minimize",{id:n});return}i.value=!0,o?o.minimize(n):c.value=!0,r("update:modelValue",!1),r("minimize",{id:n})},X=()=>{y.value=!0,i.value=!1,o?(a.value=!1,o.restore(n)):(d.value=!0,c.value=!1),r("update:modelValue",!0)},J=()=>{i.value&&(o?a.value=!0:d.value=!1,i.value=!1)},Q=()=>{y.value=!1};return(t,h)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"g-dialog-pro-fade",onAfterEnter:Q,onAfterLeave:J},{default:e.withCtx(()=>[w.value&&p.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"g-dialog-pro-overlay",onClick:e.withModifiers(Y,["self"])},[e.createElementVNode("div",e.mergeProps(t.$attrs,{class:["g-dialog-pro",{"is-fullscreen":C.value,"is-leave-to-minimize":i.value,"is-enter-from-minimize":y.value}],style:U.value,role:"dialog","aria-modal":"true"}),[e.createElementVNode("header",ne,[e.createElementVNode("p",le,e.toDisplayString(t.title),1),e.createElementVNode("div",se,[e.createElementVNode("button",{type:"button",class:"g-dialog-pro-control g-dialog-pro-control--minimize","aria-label":"最小化",title:"最小化",onClick:K}),e.createElementVNode("button",{type:"button",class:"g-dialog-pro-control g-dialog-pro-control--fullscreen","aria-label":G.value,title:G.value,onClick:j},null,8,re),e.createElementVNode("button",{type:"button",class:"g-dialog-pro-control g-dialog-pro-control--close","aria-label":R,title:R,onClick:T})])]),e.createElementVNode("div",ce,[e.renderSlot(t.$slots,"default",{},void 0,!0)]),t.hideFooter?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("footer",de,[e.renderSlot(t.$slots,"footer",{cancel:D,reset:O,save:A,close:T,loading:t.saveLoading},()=>[e.createElementVNode("div",ue,[t.actions&&t.actions.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.actions,m=>(e.openBlock(),e.createBlock(E.default,{key:m.key,type:m.type,danger:m.danger,loading:m.loading||N[m.key],disabled:m.disabled,size:"small",onClick:fe=>Z(m)},e.createSlots({default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(m.label),1)]),_:2},[m.icon?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.icon)))]),key:"0"}:void 0]),1032,["type","danger","loading","disabled","onClick"]))),128)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.showCancel?(e.openBlock(),e.createBlock(E.default,{key:0,size:"small",onClick:D},{icon:e.withCtx(()=>[e.createVNode(e.unref(P))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.cancelText),1)]),_:1})):e.createCommentVNode("",!0),t.showReset?(e.openBlock(),e.createBlock(E.default,{key:1,size:"small",onClick:O},{icon:e.withCtx(()=>[e.createVNode(e.unref($))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.resetText),1)]),_:1})):e.createCommentVNode("",!0),t.showSave?(e.openBlock(),e.createBlock(E.default,{key:2,type:"emphasis",loading:t.saveLoading,disabled:t.saveDisabled,size:"small",onClick:A},{icon:e.withCtx(()=>[e.createVNode(e.unref(W))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.saveText),1)]),_:1},8,["loading","disabled"])):e.createCommentVNode("",!0)],64)),e.renderSlot(t.$slots,"moreOperations",{},void 0,!0)])],!0)]))],16)])):e.createCommentVNode("",!0)]),_:3}),e.createVNode(e.unref(x.AnimatePresence),null,{default:e.withCtx(()=>[v.value?(e.openBlock(),e.createBlock(B,{key:0,title:t.title,position:M.value,"attention-tick":k.value,onRestore:X},null,8,["title","position","attention-tick"])):e.createCommentVNode("",!0)]),_:1})]))}}),_=L._export_sfc(me,[["__scopeId","data-v-7b74a42f"]]);_.install=s=>{s.component(_.name,_),s.component(B.name,B)};exports.ChatDotRound=q;exports.CircleCheck=W;exports.DIALOG_MANAGER_KEY=F;exports.DIALOG_SIZES=I;exports.GDialog=_;exports.GDialogMinimizedIcon=B;exports.MINIMIZED_LAYOUT=V;exports.Refresh=$;exports.Remove=P;exports.createDialogManager=te;exports.default=_;exports.useDialogManager=H;
|
package/lib/GDialog/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { inject as
|
|
1
|
+
import { inject as me, reactive as ee, computed as r, h as u, defineComponent as te, ref as _, watch as N, onUnmounted as ie, createBlock as k, openBlock as f, Teleport as oe, createVNode as w, unref as O, normalizeStyle as ge, normalizeClass as pe, withCtx as m, createElementVNode as d, toDisplayString as b, useId as Z, onMounted as ve, Transition as he, createElementBlock as G, createCommentVNode as C, withModifiers as ye, mergeProps as ze, renderSlot as P, Fragment as q, renderList as _e, createSlots as ke, createTextVNode as H, resolveDynamicComponent as Me } from "vue";
|
|
2
2
|
import { motion as Te, AnimatePresence as we } from "motion-v";
|
|
3
|
-
import { _ as ae } from "../
|
|
3
|
+
import { _ as ae } from "../GBranched-vnLlYOl9.mjs";
|
|
4
4
|
import L from "../GButton/index.mjs";
|
|
5
5
|
const Ce = /* @__PURE__ */ Symbol("GDialogManager"), J = {
|
|
6
6
|
small: "380px",
|
|
@@ -76,7 +76,7 @@ function Xe() {
|
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
function Oe() {
|
|
79
|
-
return
|
|
79
|
+
return me(Ce, null);
|
|
80
80
|
}
|
|
81
81
|
const R = {
|
|
82
82
|
viewBox: "0 0 1024 1024",
|
|
@@ -148,7 +148,7 @@ const R = {
|
|
|
148
148
|
function A() {
|
|
149
149
|
s("restore");
|
|
150
150
|
}
|
|
151
|
-
return (B, z) => (
|
|
151
|
+
return (B, z) => (f(), k(oe, { to: "body" }, [
|
|
152
152
|
w(O(Te).div, {
|
|
153
153
|
class: pe(["g-dialog-pro-minimized-icon", { "is-attention": M.value }]),
|
|
154
154
|
type: "button",
|
|
@@ -163,7 +163,7 @@ const R = {
|
|
|
163
163
|
"while-press": o,
|
|
164
164
|
onClick: A
|
|
165
165
|
}, {
|
|
166
|
-
default:
|
|
166
|
+
default: m(() => [
|
|
167
167
|
z[0] || (z[0] = d("span", {
|
|
168
168
|
class: "g-dialog-pro-minimized-icon__glow",
|
|
169
169
|
"aria-hidden": "true"
|
|
@@ -287,17 +287,17 @@ const R = {
|
|
|
287
287
|
I.value = !0, i.value = !1, t ? (o.value = !1, t.restore(a)) : (g.value = !0, c.value = !1), s("update:modelValue", !0);
|
|
288
288
|
}, ue = () => {
|
|
289
289
|
i.value && (t ? o.value = !0 : g.value = !1, i.value = !1);
|
|
290
|
-
},
|
|
290
|
+
}, fe = () => {
|
|
291
291
|
I.value = !1;
|
|
292
292
|
};
|
|
293
|
-
return (e, T) => (
|
|
293
|
+
return (e, T) => (f(), k(oe, { to: "body" }, [
|
|
294
294
|
w(he, {
|
|
295
295
|
name: "g-dialog-pro-fade",
|
|
296
|
-
onAfterEnter:
|
|
296
|
+
onAfterEnter: fe,
|
|
297
297
|
onAfterLeave: ue
|
|
298
298
|
}, {
|
|
299
|
-
default:
|
|
300
|
-
A.value && y.value ? (
|
|
299
|
+
default: m(() => [
|
|
300
|
+
A.value && y.value ? (f(), G("div", {
|
|
301
301
|
key: 0,
|
|
302
302
|
class: "g-dialog-pro-overlay",
|
|
303
303
|
onClick: ye(le, ["self"])
|
|
@@ -341,7 +341,7 @@ const R = {
|
|
|
341
341
|
d("div", Ve, [
|
|
342
342
|
P(e.$slots, "default", {}, void 0, !0)
|
|
343
343
|
]),
|
|
344
|
-
e.hideFooter ? C("", !0) : (
|
|
344
|
+
e.hideFooter ? C("", !0) : (f(), G("footer", Pe, [
|
|
345
345
|
P(e.$slots, "footer", {
|
|
346
346
|
cancel: K,
|
|
347
347
|
reset: U,
|
|
@@ -350,7 +350,7 @@ const R = {
|
|
|
350
350
|
loading: e.saveLoading
|
|
351
351
|
}, () => [
|
|
352
352
|
d("div", $e, [
|
|
353
|
-
e.actions && e.actions.length ? (
|
|
353
|
+
e.actions && e.actions.length ? (f(!0), G(q, { key: 0 }, _e(e.actions, (v) => (f(), k(L, {
|
|
354
354
|
key: v.key,
|
|
355
355
|
type: v.type,
|
|
356
356
|
danger: v.danger,
|
|
@@ -359,57 +359,57 @@ const R = {
|
|
|
359
359
|
size: "small",
|
|
360
360
|
onClick: (xe) => se(v)
|
|
361
361
|
}, ke({
|
|
362
|
-
default:
|
|
362
|
+
default: m(() => [
|
|
363
363
|
H(" " + b(v.label), 1)
|
|
364
364
|
]),
|
|
365
365
|
_: 2
|
|
366
366
|
}, [
|
|
367
367
|
v.icon ? {
|
|
368
368
|
name: "icon",
|
|
369
|
-
fn:
|
|
370
|
-
(
|
|
369
|
+
fn: m(() => [
|
|
370
|
+
(f(), k(Me(v.icon)))
|
|
371
371
|
]),
|
|
372
372
|
key: "0"
|
|
373
373
|
} : void 0
|
|
374
|
-
]), 1032, ["type", "danger", "loading", "disabled", "onClick"]))), 128)) : (
|
|
375
|
-
e.showCancel ? (
|
|
374
|
+
]), 1032, ["type", "danger", "loading", "disabled", "onClick"]))), 128)) : (f(), G(q, { key: 1 }, [
|
|
375
|
+
e.showCancel ? (f(), k(L, {
|
|
376
376
|
key: 0,
|
|
377
377
|
size: "small",
|
|
378
378
|
onClick: K
|
|
379
379
|
}, {
|
|
380
|
-
icon:
|
|
380
|
+
icon: m(() => [
|
|
381
381
|
w(O(Ie))
|
|
382
382
|
]),
|
|
383
|
-
default:
|
|
383
|
+
default: m(() => [
|
|
384
384
|
H(" " + b(e.cancelText), 1)
|
|
385
385
|
]),
|
|
386
386
|
_: 1
|
|
387
387
|
})) : C("", !0),
|
|
388
|
-
e.showReset ? (
|
|
388
|
+
e.showReset ? (f(), k(L, {
|
|
389
389
|
key: 1,
|
|
390
390
|
size: "small",
|
|
391
391
|
onClick: U
|
|
392
392
|
}, {
|
|
393
|
-
icon:
|
|
393
|
+
icon: m(() => [
|
|
394
394
|
w(O(Se))
|
|
395
395
|
]),
|
|
396
|
-
default:
|
|
396
|
+
default: m(() => [
|
|
397
397
|
H(" " + b(e.resetText), 1)
|
|
398
398
|
]),
|
|
399
399
|
_: 1
|
|
400
400
|
})) : C("", !0),
|
|
401
|
-
e.showSave ? (
|
|
401
|
+
e.showSave ? (f(), k(L, {
|
|
402
402
|
key: 2,
|
|
403
|
-
type: "
|
|
403
|
+
type: "emphasis",
|
|
404
404
|
loading: e.saveLoading,
|
|
405
405
|
disabled: e.saveDisabled,
|
|
406
406
|
size: "small",
|
|
407
407
|
onClick: X
|
|
408
408
|
}, {
|
|
409
|
-
icon:
|
|
409
|
+
icon: m(() => [
|
|
410
410
|
w(O(Ee))
|
|
411
411
|
]),
|
|
412
|
-
default:
|
|
412
|
+
default: m(() => [
|
|
413
413
|
H(" " + b(e.saveText), 1)
|
|
414
414
|
]),
|
|
415
415
|
_: 1
|
|
@@ -425,8 +425,8 @@ const R = {
|
|
|
425
425
|
_: 3
|
|
426
426
|
}),
|
|
427
427
|
w(O(we), null, {
|
|
428
|
-
default:
|
|
429
|
-
M.value ? (
|
|
428
|
+
default: m(() => [
|
|
429
|
+
M.value ? (f(), k(W, {
|
|
430
430
|
key: 0,
|
|
431
431
|
title: e.title,
|
|
432
432
|
position: B.value,
|
|
@@ -438,7 +438,7 @@ const R = {
|
|
|
438
438
|
})
|
|
439
439
|
]));
|
|
440
440
|
}
|
|
441
|
-
}), $ = /* @__PURE__ */ ae(Ne, [["__scopeId", "data-v-
|
|
441
|
+
}), $ = /* @__PURE__ */ ae(Ne, [["__scopeId", "data-v-7b74a42f"]]);
|
|
442
442
|
$.install = (l) => {
|
|
443
443
|
l.component($.name, $), l.component(W.name, W);
|
|
444
444
|
};
|