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
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { defineComponent as be, computed as h, createElementBlock as b, openBlock as c, mergeProps as ie, Fragment as N, renderList as Q, createBlock as R, resolveDynamicComponent as ee, ref as ue, onMounted as Pe, watch as ce, onUnmounted as Ne, normalizeStyle as de, normalizeClass as Re, createVNode as Be, createCommentVNode as fe, createTextVNode as he, unref as V, toDisplayString as ve, withCtx as Ee } from "vue";
|
|
2
|
+
import { useReducedMotion as Le, motionValue as Y, useTransform as De, motion as Oe, animate as M } from "motion-v";
|
|
3
|
+
import { _ as je } from "../GBranched-vnLlYOl9.mjs";
|
|
4
|
+
var qe = be({
|
|
5
|
+
name: "HugeiconsIcon",
|
|
6
|
+
inheritAttrs: !1,
|
|
7
|
+
props: {
|
|
8
|
+
icon: {
|
|
9
|
+
type: Array,
|
|
10
|
+
required: !0
|
|
11
|
+
},
|
|
12
|
+
size: {
|
|
13
|
+
type: [Number, String],
|
|
14
|
+
default: 24,
|
|
15
|
+
validator(s) {
|
|
16
|
+
const d = typeof s == "string" ? parseInt(s, 10) : s;
|
|
17
|
+
return !isNaN(d) && d > 0;
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
strokeWidth: {
|
|
21
|
+
type: Number,
|
|
22
|
+
default: void 0
|
|
23
|
+
},
|
|
24
|
+
absoluteStrokeWidth: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: !1
|
|
27
|
+
},
|
|
28
|
+
altIcon: {
|
|
29
|
+
type: Array,
|
|
30
|
+
default: void 0
|
|
31
|
+
},
|
|
32
|
+
showAlt: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: !1
|
|
35
|
+
},
|
|
36
|
+
color: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: "currentColor"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
setup(s) {
|
|
42
|
+
const d = h(() => {
|
|
43
|
+
const k = typeof s.size == "string" ? parseInt(s.size, 10) : s.size;
|
|
44
|
+
return !isNaN(k) && k > 0 ? k : 24;
|
|
45
|
+
}), S = h(() => {
|
|
46
|
+
if (s.strokeWidth !== void 0)
|
|
47
|
+
return s.absoluteStrokeWidth ? s.strokeWidth * 24 / d.value : s.strokeWidth;
|
|
48
|
+
}), y = h(() => s.altIcon && s.showAlt ? s.altIcon : s.icon);
|
|
49
|
+
return {
|
|
50
|
+
computedSize: d,
|
|
51
|
+
calculatedStrokeWidth: S,
|
|
52
|
+
transformAttrs: (k, w) => {
|
|
53
|
+
const f = {};
|
|
54
|
+
for (const [B, U] of Object.entries(k)) {
|
|
55
|
+
const W = B.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
56
|
+
f[W] = U;
|
|
57
|
+
}
|
|
58
|
+
return w !== void 0 && (f["stroke-width"] = w, f.stroke = "currentColor"), f;
|
|
59
|
+
},
|
|
60
|
+
currentIcon: y
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}), Ve = (s, d) => {
|
|
64
|
+
const S = s.__vccOpts || s;
|
|
65
|
+
for (const [y, z] of d)
|
|
66
|
+
S[y] = z;
|
|
67
|
+
return S;
|
|
68
|
+
};
|
|
69
|
+
const Ue = ["width", "height", "color"];
|
|
70
|
+
function We(s, d, S, y, z, k) {
|
|
71
|
+
return c(), b("svg", ie({
|
|
72
|
+
width: s.computedSize,
|
|
73
|
+
height: s.computedSize,
|
|
74
|
+
viewBox: "0 0 24 24",
|
|
75
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
76
|
+
fill: "none",
|
|
77
|
+
color: s.color
|
|
78
|
+
}, s.$attrs), [
|
|
79
|
+
(c(!0), b(
|
|
80
|
+
N,
|
|
81
|
+
null,
|
|
82
|
+
Q(s.currentIcon, (w, f) => (c(), R(
|
|
83
|
+
ee(w[0]),
|
|
84
|
+
ie({
|
|
85
|
+
key: f,
|
|
86
|
+
ref_for: !0
|
|
87
|
+
}, s.transformAttrs(w[1], s.calculatedStrokeWidth)),
|
|
88
|
+
null,
|
|
89
|
+
16
|
|
90
|
+
/* FULL_PROPS */
|
|
91
|
+
))),
|
|
92
|
+
128
|
|
93
|
+
/* KEYED_FRAGMENT */
|
|
94
|
+
))
|
|
95
|
+
], 16, Ue);
|
|
96
|
+
}
|
|
97
|
+
var me = /* @__PURE__ */ Ve(qe, [["render", We], ["__file", "/Users/mahmudulhasan/Desktop/Projects/Hugeicons/hugeicons-monorepo/packages/vue/src/components/HugeiconsIcon.vue"]]);
|
|
98
|
+
const He = ["aria-label", "aria-disabled", "data-equal", "data-draggable"], Fe = ["aria-checked", "tabindex", "disabled", "onPointerdown"], Ge = 0.19, Ke = 0.15, Xe = 110, pe = 2e3, Ze = 4, Ye = 10, ge = 0.55, Je = /* @__PURE__ */ be({
|
|
99
|
+
name: "GSegment",
|
|
100
|
+
__name: "index",
|
|
101
|
+
props: {
|
|
102
|
+
items: {},
|
|
103
|
+
value: { default: void 0 },
|
|
104
|
+
defaultValue: { default: void 0 },
|
|
105
|
+
trackColor: { default: void 0 },
|
|
106
|
+
thumbColor: { default: void 0 },
|
|
107
|
+
textColor: { default: void 0 },
|
|
108
|
+
activeTextColor: { default: void 0 },
|
|
109
|
+
size: { default: "middle" },
|
|
110
|
+
radius: { default: 10 },
|
|
111
|
+
inset: { default: 3 },
|
|
112
|
+
equalSlots: { type: Boolean, default: !0 },
|
|
113
|
+
stretch: { default: 100 },
|
|
114
|
+
squash: { default: 3 },
|
|
115
|
+
speed: { default: 1 },
|
|
116
|
+
glide: { default: 75 },
|
|
117
|
+
draggable: { type: Boolean, default: !0 },
|
|
118
|
+
disabled: { type: Boolean, default: !1 },
|
|
119
|
+
className: { default: "" },
|
|
120
|
+
ariaLabel: { default: "Segmented control" }
|
|
121
|
+
},
|
|
122
|
+
emits: ["update:value", "change"],
|
|
123
|
+
setup(s, { emit: d }) {
|
|
124
|
+
const S = [0.23, 1, 0.32, 1], y = { type: "spring", duration: 0.3, bounce: 0 }, z = { type: "spring", duration: 0.4, bounce: 0.2 }, k = { type: "spring", duration: 0.16, bounce: 0 }, w = {
|
|
125
|
+
small: { height: 24, font: 12, pad: 8, min: 40 },
|
|
126
|
+
middle: { height: 32, font: 14, pad: 12, min: 44 },
|
|
127
|
+
large: { height: 40, font: 16, pad: 16, min: 48 }
|
|
128
|
+
}, f = (e, t, n) => Math.min(n, Math.max(t, e)), B = (e, t) => e * t * ge / (t + ge * Math.abs(e)), U = (e, t) => {
|
|
129
|
+
const n = 1 - 0.1 * Math.pow(0.05, t / 100);
|
|
130
|
+
return e / 1e3 * n / (1 - n);
|
|
131
|
+
}, W = (e, t) => {
|
|
132
|
+
const n = e.filter(([j]) => t - j <= 100);
|
|
133
|
+
if (n.length < 2) return 0;
|
|
134
|
+
const [o, r] = n[0], [l, g] = n[n.length - 1];
|
|
135
|
+
return l - o >= 8 ? (g - r) / (l - o) * 1e3 : 0;
|
|
136
|
+
}, ye = (e, t) => {
|
|
137
|
+
let n = 0;
|
|
138
|
+
for (let o = 1; o < e.length; o++)
|
|
139
|
+
Math.abs((e[o].l + e[o].r) / 2 - t) < Math.abs((e[n].l + e[n].r) / 2 - t) && (n = o);
|
|
140
|
+
return n;
|
|
141
|
+
}, te = (e) => Array.isArray(e), a = s, ne = d, v = h(
|
|
142
|
+
() => a.items.map(
|
|
143
|
+
(e) => typeof e == "string" ? { value: e, label: e, icon: void 0 } : e
|
|
144
|
+
)
|
|
145
|
+
), oe = ue(a.defaultValue ?? v.value[0]?.value), ke = h(() => a.value !== void 0 ? a.value : oe.value), _ = h(
|
|
146
|
+
() => Math.max(
|
|
147
|
+
0,
|
|
148
|
+
v.value.findIndex((e) => e.value === ke.value)
|
|
149
|
+
)
|
|
150
|
+
), A = Le(), m = ue(null), E = [];
|
|
151
|
+
let C = [], L = null, p = _.value, $, x = null, T = 0, H = null;
|
|
152
|
+
const i = Y(0), u = Y(0), F = Y(0), we = De(
|
|
153
|
+
[i, u, F],
|
|
154
|
+
([e, t, n]) => `inset(0 ${Math.max(0, n - t)}px 0 ${Math.max(0, e)}px round var(--rs-thumb-radius))`
|
|
155
|
+
), I = (e) => e / a.speed, P = (e) => {
|
|
156
|
+
const t = C[e];
|
|
157
|
+
t && (clearTimeout($), T += 1, i.jump(t.l), u.jump(t.r));
|
|
158
|
+
}, D = () => {
|
|
159
|
+
const e = m.value;
|
|
160
|
+
if (!e) return;
|
|
161
|
+
const t = e.getBoundingClientRect();
|
|
162
|
+
L = t, C = v.value.map((n, o) => {
|
|
163
|
+
const r = E[o];
|
|
164
|
+
if (!r) return { l: 0, r: 0 };
|
|
165
|
+
const l = r.getBoundingClientRect();
|
|
166
|
+
return { l: l.left - t.left - a.inset, r: l.right - t.left - a.inset };
|
|
167
|
+
}), F.set(t.width - a.inset * 2), P(p);
|
|
168
|
+
}, _e = h(() => v.value.map((e) => e.value).join("|"));
|
|
169
|
+
Pe(() => {
|
|
170
|
+
D(), H = new ResizeObserver(D), m.value && H.observe(m.value), typeof document < "u" && document.fonts && document.fonts.ready.then(D);
|
|
171
|
+
}), ce([_e, () => a.size, () => a.inset, () => a.equalSlots], D, {
|
|
172
|
+
flush: "post"
|
|
173
|
+
}), ce(
|
|
174
|
+
_,
|
|
175
|
+
(e) => {
|
|
176
|
+
!x && p !== e && (p = e, P(e));
|
|
177
|
+
},
|
|
178
|
+
{ flush: "post" }
|
|
179
|
+
), Ne(() => {
|
|
180
|
+
H?.disconnect(), clearTimeout($), i.stop(), u.stop();
|
|
181
|
+
});
|
|
182
|
+
const G = (e) => {
|
|
183
|
+
if (p = e, e === _.value) return;
|
|
184
|
+
const t = v.value[e].value;
|
|
185
|
+
a.value === void 0 && (oe.value = t), ne("update:value", t), ne("change", t, e);
|
|
186
|
+
}, K = (e, t, n, o) => {
|
|
187
|
+
const r = C[e];
|
|
188
|
+
if (!r) return;
|
|
189
|
+
const l = ++T, g = Math.sign((r.l + r.r) / 2 - (i.get() + u.get()) / 2) || 1, [j, $e, q, Z] = g > 0 ? [u, r.r, i, r.l] : [i, r.l, u, r.r], se = (Te) => f(t === null ? Te.getVelocity() : t, -pe, pe);
|
|
190
|
+
M(j, $e, {
|
|
191
|
+
...n ? z : y,
|
|
192
|
+
duration: I(n ? 0.4 : 0.3),
|
|
193
|
+
velocity: se(j)
|
|
194
|
+
});
|
|
195
|
+
const le = se(q);
|
|
196
|
+
if (!o || a.squash <= 0) {
|
|
197
|
+
M(q, Z, { ...y, duration: I(0.3), velocity: le });
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
M(q, Z + g * a.squash, {
|
|
201
|
+
...y,
|
|
202
|
+
duration: I(0.3),
|
|
203
|
+
velocity: le
|
|
204
|
+
}).then(() => {
|
|
205
|
+
T === l && M(q, Z, { ...k, duration: I(0.16) });
|
|
206
|
+
});
|
|
207
|
+
}, xe = (e, t) => {
|
|
208
|
+
const n = C[e], o = C[t];
|
|
209
|
+
if (!n || !o) return;
|
|
210
|
+
if (clearTimeout($), T += 1, A.value) {
|
|
211
|
+
i.jump(o.l), u.jump(o.r);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const r = a.stretch / 100, l = { duration: I(Ge), ease: S };
|
|
215
|
+
M(i, o.l + (Math.min(n.l, o.l) - o.l) * r, l), M(u, o.r + (Math.max(n.r, o.r) - o.r) * r, l), $ = setTimeout(() => K(t, null, !1, !0), I(Ke) * 1e3);
|
|
216
|
+
}, X = (e) => e.clientX - (L ? L.left : 0) - a.inset, Se = (e, t) => {
|
|
217
|
+
if (a.disabled || x || e.button !== 0) return;
|
|
218
|
+
L = m.value?.getBoundingClientRect() ?? null;
|
|
219
|
+
const n = e.currentTarget;
|
|
220
|
+
try {
|
|
221
|
+
n.setPointerCapture(e.pointerId);
|
|
222
|
+
} catch {
|
|
223
|
+
}
|
|
224
|
+
const o = X(e), r = a.draggable && o >= i.get() && o <= u.get();
|
|
225
|
+
x = {
|
|
226
|
+
id: e.pointerId,
|
|
227
|
+
x0: o,
|
|
228
|
+
slot: t,
|
|
229
|
+
onThumb: r,
|
|
230
|
+
live: !1,
|
|
231
|
+
offset: 0,
|
|
232
|
+
w: 0,
|
|
233
|
+
hist: [[e.timeStamp, o]]
|
|
234
|
+
}, r ? (clearTimeout($), T += 1, i.stop(), u.stop()) : A.value || (n.dataset.pressed = "");
|
|
235
|
+
}, Ce = (e) => {
|
|
236
|
+
const t = x;
|
|
237
|
+
if (!t || e.pointerId !== t.id || !t.onThumb) return;
|
|
238
|
+
const n = X(e);
|
|
239
|
+
if (t.hist.push([e.timeStamp, n]), t.hist.length > 8 && t.hist.shift(), !t.live) {
|
|
240
|
+
if (Math.abs(n - t.x0) < Ze) return;
|
|
241
|
+
t.live = !0, t.offset = n - i.get(), t.w = u.get() - i.get(), m.value && (m.value.dataset.held = "");
|
|
242
|
+
}
|
|
243
|
+
const o = F.get(), r = n - t.offset, l = o - t.w;
|
|
244
|
+
if (A.value) {
|
|
245
|
+
const g = f(r, 0, l);
|
|
246
|
+
i.set(g), u.set(g + t.w);
|
|
247
|
+
} else r < 0 ? (i.set(0), u.set(t.w - B(-r, t.w))) : r > l ? (u.set(o), i.set(l + B(r - l, t.w))) : (i.set(r), u.set(r + t.w));
|
|
248
|
+
}, ae = () => {
|
|
249
|
+
const e = x;
|
|
250
|
+
x = null, m.value && delete m.value.dataset.held;
|
|
251
|
+
const t = E[e.slot];
|
|
252
|
+
return t && delete t.dataset.pressed, e;
|
|
253
|
+
}, Ie = (e) => {
|
|
254
|
+
const t = x;
|
|
255
|
+
if (!t || e.pointerId !== t.id) return;
|
|
256
|
+
ae();
|
|
257
|
+
const n = X(e);
|
|
258
|
+
if (!t.live) {
|
|
259
|
+
if (Math.abs(n - t.x0) <= Ye && t.slot !== p) {
|
|
260
|
+
const g = p;
|
|
261
|
+
G(t.slot), xe(g, t.slot);
|
|
262
|
+
}
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const o = W(t.hist, e.timeStamp), r = Math.abs(o) > Xe;
|
|
266
|
+
let l = ye(C, (i.get() + u.get()) / 2 + U(o, a.glide));
|
|
267
|
+
r && l === p && (l = f(l + Math.sign(o), 0, v.value.length - 1)), G(l), A.value ? P(l) : K(l, o, r, r);
|
|
268
|
+
}, re = (e) => {
|
|
269
|
+
const t = x;
|
|
270
|
+
!t || e.pointerId !== t.id || (ae(), t.live && (A.value ? P(p) : K(p, null, !1, !1)));
|
|
271
|
+
}, Me = (e) => {
|
|
272
|
+
if (a.disabled) return;
|
|
273
|
+
const t = v.value.length - 1;
|
|
274
|
+
let n = null;
|
|
275
|
+
e.key === "ArrowRight" || e.key === "ArrowDown" ? n = Math.min(t, _.value + 1) : e.key === "ArrowLeft" || e.key === "ArrowUp" ? n = Math.max(0, _.value - 1) : e.key === "Home" ? n = 0 : e.key === "End" && (n = t), n !== null && (e.preventDefault(), n !== _.value && (G(n), P(n), E[n]?.focus()));
|
|
276
|
+
}, O = h(() => w[a.size] || w.middle), ze = h(() => Math.max(0, a.radius - a.inset)), Ae = h(
|
|
277
|
+
() => ({
|
|
278
|
+
// 颜色未传入时不内联变量,走 scoped 样式里的明暗自适应默认值
|
|
279
|
+
...a.trackColor !== void 0 && { "--rs-track": a.trackColor },
|
|
280
|
+
...a.thumbColor !== void 0 && { "--rs-thumb": a.thumbColor },
|
|
281
|
+
...a.textColor !== void 0 && { "--rs-ink": a.textColor },
|
|
282
|
+
...a.activeTextColor !== void 0 && { "--rs-ink-active": a.activeTextColor },
|
|
283
|
+
"--rs-radius": `${a.radius}px`,
|
|
284
|
+
"--rs-inset": `${a.inset}px`,
|
|
285
|
+
"--rs-thumb-radius": `${ze.value}px`,
|
|
286
|
+
// 高度 / 字号消费全库尺寸变量,未引入 size.css 时回退到组件内常量
|
|
287
|
+
"--rs-h": `var(--g-size-${a.size}-height, ${O.value.height}px)`,
|
|
288
|
+
"--rs-font": `var(--g-size-${a.size}-font-size, ${O.value.font}px)`,
|
|
289
|
+
"--rs-pad": `${O.value.pad}px`,
|
|
290
|
+
"--rs-min": `${O.value.min}px`,
|
|
291
|
+
"--rs-ease-out": "cubic-bezier(0.23, 1, 0.32, 1)"
|
|
292
|
+
})
|
|
293
|
+
);
|
|
294
|
+
return (e, t) => (c(), b("div", {
|
|
295
|
+
ref_key: "trackRef",
|
|
296
|
+
ref: m,
|
|
297
|
+
role: "radiogroup",
|
|
298
|
+
"aria-label": e.ariaLabel,
|
|
299
|
+
"aria-disabled": e.disabled || void 0,
|
|
300
|
+
"data-equal": e.equalSlots ? "" : void 0,
|
|
301
|
+
"data-draggable": e.draggable && !e.disabled ? "" : void 0,
|
|
302
|
+
class: Re(["g-segment", e.className]),
|
|
303
|
+
style: de(Ae.value),
|
|
304
|
+
onPointermove: Ce,
|
|
305
|
+
onPointerup: Ie,
|
|
306
|
+
onPointercancel: re,
|
|
307
|
+
onLostpointercapture: re
|
|
308
|
+
}, [
|
|
309
|
+
(c(!0), b(N, null, Q(v.value, (n, o) => (c(), b("button", {
|
|
310
|
+
key: n.value,
|
|
311
|
+
ref_for: !0,
|
|
312
|
+
ref: (r) => E[o] = r,
|
|
313
|
+
type: "button",
|
|
314
|
+
role: "radio",
|
|
315
|
+
"aria-checked": o === _.value,
|
|
316
|
+
tabindex: o === _.value ? 0 : -1,
|
|
317
|
+
disabled: e.disabled,
|
|
318
|
+
class: "g-segment__cell g-segment__btn",
|
|
319
|
+
onPointerdown: (r) => Se(r, o),
|
|
320
|
+
onKeydown: Me
|
|
321
|
+
}, [
|
|
322
|
+
n.icon ? (c(), b(N, { key: 0 }, [
|
|
323
|
+
te(n.icon) ? (c(), R(V(me), {
|
|
324
|
+
key: 0,
|
|
325
|
+
icon: n.icon,
|
|
326
|
+
size: 16,
|
|
327
|
+
"stroke-width": 2
|
|
328
|
+
}, null, 8, ["icon"])) : (c(), R(ee(n.icon), { key: 1 }))
|
|
329
|
+
], 64)) : fe("", !0),
|
|
330
|
+
he(" " + ve(n.label), 1)
|
|
331
|
+
], 40, Fe))), 128)),
|
|
332
|
+
Be(V(Oe).div, {
|
|
333
|
+
class: "g-segment__layer",
|
|
334
|
+
"aria-hidden": "true",
|
|
335
|
+
style: de({ clipPath: V(we) })
|
|
336
|
+
}, {
|
|
337
|
+
default: Ee(() => [
|
|
338
|
+
(c(!0), b(N, null, Q(v.value, (n) => (c(), b("span", {
|
|
339
|
+
key: n.value,
|
|
340
|
+
class: "g-segment__cell g-segment__ghost"
|
|
341
|
+
}, [
|
|
342
|
+
n.icon ? (c(), b(N, { key: 0 }, [
|
|
343
|
+
te(n.icon) ? (c(), R(V(me), {
|
|
344
|
+
key: 0,
|
|
345
|
+
icon: n.icon,
|
|
346
|
+
size: 16,
|
|
347
|
+
"stroke-width": 2
|
|
348
|
+
}, null, 8, ["icon"])) : (c(), R(ee(n.icon), { key: 1 }))
|
|
349
|
+
], 64)) : fe("", !0),
|
|
350
|
+
he(" " + ve(n.label), 1)
|
|
351
|
+
]))), 128))
|
|
352
|
+
]),
|
|
353
|
+
_: 1
|
|
354
|
+
}, 8, ["style"])
|
|
355
|
+
], 46, He));
|
|
356
|
+
}
|
|
357
|
+
}), J = /* @__PURE__ */ je(Je, [["__scopeId", "data-v-c6eabec2"]]);
|
|
358
|
+
J.install = (s) => {
|
|
359
|
+
s.component(J.name, J);
|
|
360
|
+
};
|
|
361
|
+
export {
|
|
362
|
+
J as GSegment,
|
|
363
|
+
J as default
|
|
364
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.g-segment[data-v-c6eabec2]{--rs-track: #f4f4f5;--rs-thumb: #ffffff;--rs-ink: #71717a;--rs-ink-active: #18181b;display:inline-grid;position:relative;grid-auto-flow:column;grid-auto-columns:auto;vertical-align:middle;padding:var(--rs-inset);border-radius:var(--rs-radius);background:var(--rs-track);font-family:inherit;-webkit-touch-callout:none;touch-action:pan-y;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.g-segment[data-equal][data-v-c6eabec2]{grid-auto-columns:minmax(0,1fr)}.g-segment[aria-disabled=true][data-v-c6eabec2]{opacity:.5;pointer-events:none}.g-segment[data-held][data-v-c6eabec2]{cursor:grabbing}html.dark .g-segment[data-v-c6eabec2]{--rs-track: #27272a;--rs-thumb: #fafafa;--rs-ink: #fafafa;--rs-ink-active: #18181b}.g-segment__cell[data-v-c6eabec2]{box-sizing:border-box;display:inline-flex;height:calc(var(--rs-h) - var(--rs-inset) * 2);min-width:var(--rs-min);align-items:center;justify-content:center;text-align:center;gap:6px;margin:0;border:0;background:transparent;padding:0 var(--rs-pad);border-radius:var(--rs-thumb-radius);font:inherit;font-size:var(--rs-font);font-weight:500;line-height:1;white-space:nowrap;outline:none;transition:opacity .16s ease,transform .16s var(--rs-ease-out)}.g-segment__layer[data-v-c6eabec2]{position:absolute;inset:var(--rs-inset);display:grid;grid-auto-flow:column;grid-auto-columns:auto;pointer-events:none;background:var(--rs-thumb);color:var(--rs-ink-active)}.g-segment[data-equal] .g-segment__layer[data-v-c6eabec2]{grid-auto-columns:minmax(0,1fr)}.g-segment__btn[data-v-c6eabec2]{cursor:pointer;color:var(--rs-ink);opacity:.7}.g-segment__btn[aria-checked=true][data-v-c6eabec2]{cursor:default}.g-segment[data-draggable] .g-segment__btn[aria-checked=true][data-v-c6eabec2]{cursor:grab}.g-segment[data-held] .g-segment__btn[data-v-c6eabec2]{cursor:grabbing}.g-segment__btn[data-pressed][data-v-c6eabec2]{transform:scale(.96)}.g-segment__btn[data-v-c6eabec2]:focus-visible{outline:2px solid var(--rs-thumb);outline-offset:3px}@media(hover:hover)and (pointer:fine){.g-segment__btn[aria-checked=false][data-v-c6eabec2]:hover{opacity:.9}}.g-segment__ghost[data-v-c6eabec2]{cursor:default;color:inherit}@media(prefers-reduced-motion:reduce){.g-segment__cell[data-v-c6eabec2]{transition:opacity .16s ease}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),d=require("motion-v"),we=require("../GBranched-BtF7heMk.js"),_e=["aria-disabled"],ke=["tabindex","aria-label","aria-valuemin","aria-valuemax","aria-valuenow","aria-valuetext","aria-disabled"],Me={key:0,class:"g-slider__value","aria-hidden":"true"},Se=9.23,Ee=320,ne=1.5,re=.002,S=3,Ce=12,Ie=1,Be=6,se=.6,Pe=.3,Ve=100,Re=o.defineComponent({name:"GSlider",inheritAttrs:!1,__name:"index",props:{value:{default:void 0},defaultValue:{default:50},min:{default:0},max:{default:100},step:{default:1},density:{default:"normal"},height:{default:56},fillColor:{default:void 0},trackColor:{default:void 0},crestColor:{default:""},showValue:{type:Boolean,default:!1},formatValue:{type:Function,default:void 0},disabled:{type:Boolean,default:!1},ariaLabel:{default:"Value"}},emits:["update:value","change"],setup(E,{emit:le}){const C={sparse:8,normal:4,dense:2},f=(e,t,a)=>Math.min(a,Math.max(t,e)),ce=e=>e*e*(3-2*e),T=(e,t,a)=>a>t?(e-t)/(a-t)*100:0,L=(e,t,a,r)=>{if(!(a>t))return t;if(!(r>0))return f(e,t,a);const s=t+Math.floor(+((a-t)/r).toFixed(6))*r,l=f(Math.round((e-t)/r)*r+t,t,s);return+(s<a&&Math.abs(e-a)<=Math.abs(e-l)?a:l).toFixed(6)},n=E,F=le,G=o.ref(n.defaultValue),i=o.computed(()=>f(n.value??G.value,n.min,n.max)),N=o.computed(()=>T(i.value,n.min,n.max)),I=d.useReducedMotion(),H=e=>n.formatValue?n.formatValue(e):String(e),j=o.computed(()=>C[n.density]),B=o.computed(()=>Math.min(Ce,n.height-1)/n.height),U=o.ref(null),b=o.ref(null),W=o.ref(null),z=[],O=[],p=o.ref(1),$=o.ref(S),q=o.ref(S+C.normal);let y=null,m=null,K=0,P=i.value;const v=d.motionValue(N.value),V=Se/Pe,h=d.useSpring(v,{stiffness:V*V,damping:2*V,mass:1}),ie=d.useVelocity(h),R=2e3/Ve,w=d.useSpring(ie,{stiffness:R*R,damping:2.5*R,mass:1}),ue=(e,t)=>{z[e]=t},de=(e,t)=>{O[e]=t},x=()=>{const e=b.value;if(!e)return;const t=e.clientWidth;if(!t)return;const a=window.devicePixelRatio||1,r=j.value??C.normal,s=Math.max(1,Math.round(S*a)),l=Math.max(s+1,Math.round((S+r)*a)),c=Math.max(1,Math.floor((t*a+l-s)/l));Number.isFinite(c)&&c!==p.value&&(p.value=c),$.value=s/a,q.value=l/a},_=(e=!1)=>{const t=p.value,a=(I.value?v.get():h.get())/100*(t-1),r=I.value?0:w.get(),s=ce(f(Math.abs(r)*Ie/Ee,0,1)),l=Math.sign(r)||1,c=ne+(Be-ne)*s,k=c*(1+se),ge=c*(1-.5*se),be=Math.round(a),ye=!e&&s<re&&K<re,Z=B.value;for(let u=0;u<t;u++){const M=z[u];if(!M)continue;const ee=u<=be?"true":"false";if(M.dataset.on!==ee&&(M.dataset.on=ee),ye)continue;const D=u-a,te=D*l<0?k:ge,oe=Math.abs(D)<te?s*Math.cos(Math.PI*D/(2*te))**2:0;M.style.transform=`scaleY(${Z+oe*(1-Z)})`;const ae=O[u];ae&&(ae.style.opacity=String(oe))}K=s},fe=()=>_(),X=()=>d.frame.render(fe,!1,!0),Y=[];o.onMounted(()=>{Y.push(h.on("change",X),w.on("change",X)),x(),y=new ResizeObserver(x),y.observe(b.value),_(!0)}),o.onUpdated(()=>_(!0)),o.watch(N,e=>v.set(e)),o.watch([p,B,I],()=>_(!0),{flush:"post"}),o.watch(j,()=>x(),{flush:"post"}),o.onUnmounted(()=>{y?.disconnect(),y=null,Y.forEach(e=>e()),h.stop(),w.stop(),v.stop()});const J=e=>{const t=L(e,n.min,n.max,n.step);t!==P&&(P=t,n.value===void 0&&(G.value=t),F("update:value",t),F("change",t))};o.watch(i,e=>P=e);const Q=e=>{const t=b.value;if(!t)return;const a=t.getBoundingClientRect();if(!a.width)return;let r=f((e-a.left)/a.width,0,1);getComputedStyle(t).direction==="rtl"&&(r=1-r),J(n.min+r*(n.max-n.min))},pe=e=>{if(!(n.disabled||m!==null)){m=e.pointerId;try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}U.value?.removeAttribute("data-instant"),W.value?.focus({preventScroll:!0}),Q(e.clientX)}},me=e=>{e.pointerId===m&&Q(e.clientX)},A=e=>{if(e.pointerId===m){try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}m=null}},ve=e=>{if(n.disabled)return;const{step:t,min:a,max:r}=n,s=i.value,l={ArrowRight:s+t,ArrowUp:s+t,ArrowLeft:s-t,ArrowDown:s-t,PageUp:s+t*10,PageDown:s-t*10,Home:a,End:r};if(!(e.key in l))return;e.preventDefault();const c=L(l[e.key],a,r,t),k=T(c,a,r);U.value?.setAttribute("data-instant","true"),h.jump(k),w.jump(0),v.jump(k),J(c)},he=o.computed(()=>({...n.fillColor&&{"--g-slider-fill":n.fillColor},...n.trackColor&&{"--g-slider-track":n.trackColor},"--g-slider-crest":n.crestColor||"var(--g-slider-fill)","--g-slider-height":`${n.height}px`,"--g-slider-bar-w":`${$.value}px`,"--g-slider-rest":B.value}));return(e,t)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["g-slider",{"is-disabled":e.disabled}]),"aria-disabled":e.disabled||void 0,style:o.normalizeStyle(he.value)},[o.createElementVNode("div",{ref_key:"trackRef",ref:b,class:"g-slider__track",onPointerdown:pe,onPointermove:me,onPointerup:A,onPointercancel:A,onLostpointercapture:A},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(p.value,a=>(o.openBlock(),o.createElementBlock("span",{key:a,ref_for:!0,ref:r=>ue(a-1,r),class:"g-slider__bar",style:o.normalizeStyle({left:`${((a-1)*q.value).toFixed(3)}px`})},[e.crestColor?(o.openBlock(),o.createElementBlock("span",{key:0,ref_for:!0,ref:r=>de(a-1,r),class:"g-slider__crest"},null,512)):o.createCommentVNode("",!0)],4))),128)),o.createElementVNode("button",{ref_key:"handleRef",ref:W,type:"button",role:"slider",class:"g-slider__handle",tabindex:e.disabled?-1:0,"aria-label":e.ariaLabel,"aria-valuemin":e.min,"aria-valuemax":e.max,"aria-valuenow":i.value,"aria-valuetext":H(i.value),"aria-disabled":e.disabled||void 0,onKeydown:ve},null,40,ke)],544),e.showValue?(o.openBlock(),o.createElementBlock("span",Me,o.toDisplayString(H(i.value)),1)):o.createCommentVNode("",!0)],14,_e))}}),g=we._export_sfc(Re,[["__scopeId","data-v-449781d0"]]);g.install=E=>{E.component(g.name,g)};exports.GSlider=g;exports.default=g;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { defineComponent as Ie, ref as c, computed as h, onMounted as Pe, onUpdated as Re, watch as k, onUnmounted as xe, createElementBlock as g, openBlock as b, normalizeStyle as le, normalizeClass as Ae, createElementVNode as ie, createCommentVNode as ce, Fragment as De, renderList as Ve, toDisplayString as Te } from "vue";
|
|
2
|
+
import { useReducedMotion as Le, motionValue as Fe, useSpring as ue, useVelocity as Be, frame as Ge } from "motion-v";
|
|
3
|
+
import { _ as He } from "../GBranched-vnLlYOl9.mjs";
|
|
4
|
+
const Ne = ["aria-disabled"], Ue = ["tabindex", "aria-label", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-disabled"], We = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "g-slider__value",
|
|
7
|
+
"aria-hidden": "true"
|
|
8
|
+
}, je = 9.23, $e = 320, de = 1.5, fe = 2e-3, E = 3, ze = 12, Ke = 1, Oe = 6, pe = 0.6, Xe = 0.3, Ye = 100, qe = /* @__PURE__ */ Ie({
|
|
9
|
+
name: "GSlider",
|
|
10
|
+
inheritAttrs: !1,
|
|
11
|
+
__name: "index",
|
|
12
|
+
props: {
|
|
13
|
+
value: { default: void 0 },
|
|
14
|
+
defaultValue: { default: 50 },
|
|
15
|
+
min: { default: 0 },
|
|
16
|
+
max: { default: 100 },
|
|
17
|
+
step: { default: 1 },
|
|
18
|
+
density: { default: "normal" },
|
|
19
|
+
height: { default: 56 },
|
|
20
|
+
fillColor: { default: void 0 },
|
|
21
|
+
trackColor: { default: void 0 },
|
|
22
|
+
crestColor: { default: "" },
|
|
23
|
+
showValue: { type: Boolean, default: !1 },
|
|
24
|
+
formatValue: { type: Function, default: void 0 },
|
|
25
|
+
disabled: { type: Boolean, default: !1 },
|
|
26
|
+
ariaLabel: { default: "Value" }
|
|
27
|
+
},
|
|
28
|
+
emits: ["update:value", "change"],
|
|
29
|
+
setup(I, { emit: me }) {
|
|
30
|
+
const P = {
|
|
31
|
+
sparse: 8,
|
|
32
|
+
normal: 4,
|
|
33
|
+
dense: 2
|
|
34
|
+
}, d = (e, t, a) => Math.min(a, Math.max(t, e)), ve = (e) => e * e * (3 - 2 * e), G = (e, t, a) => a > t ? (e - t) / (a - t) * 100 : 0, H = (e, t, a, n) => {
|
|
35
|
+
if (!(a > t)) return t;
|
|
36
|
+
if (!(n > 0)) return d(e, t, a);
|
|
37
|
+
const s = t + Math.floor(+((a - t) / n).toFixed(6)) * n, r = d(Math.round((e - t) / n) * n + t, t, s);
|
|
38
|
+
return +(s < a && Math.abs(e - a) <= Math.abs(e - r) ? a : r).toFixed(6);
|
|
39
|
+
}, o = I, N = me, U = c(o.defaultValue), i = h(() => d(o.value ?? U.value, o.min, o.max)), W = h(() => G(i.value, o.min, o.max)), R = Le(), j = (e) => o.formatValue ? o.formatValue(e) : String(e), $ = h(() => P[o.density]), x = h(() => Math.min(ze, o.height - 1) / o.height), z = c(null), y = c(null), K = c(null), O = [], X = [], f = c(1), Y = c(E), q = c(E + P.normal);
|
|
40
|
+
let _ = null, p = null, J = 0, A = i.value;
|
|
41
|
+
const m = Fe(W.value), D = je / Xe, v = ue(m, { stiffness: D * D, damping: 2 * D, mass: 1 }), he = Be(v), V = 2e3 / Ye, w = ue(he, { stiffness: V * V, damping: 2.5 * V, mass: 1 }), ge = (e, t) => {
|
|
42
|
+
O[e] = t;
|
|
43
|
+
}, be = (e, t) => {
|
|
44
|
+
X[e] = t;
|
|
45
|
+
}, T = () => {
|
|
46
|
+
const e = y.value;
|
|
47
|
+
if (!e) return;
|
|
48
|
+
const t = e.clientWidth;
|
|
49
|
+
if (!t) return;
|
|
50
|
+
const a = window.devicePixelRatio || 1, n = $.value ?? P.normal, s = Math.max(1, Math.round(E * a)), r = Math.max(s + 1, Math.round((E + n) * a)), l = Math.max(1, Math.floor((t * a + r - s) / r));
|
|
51
|
+
Number.isFinite(l) && l !== f.value && (f.value = l), Y.value = s / a, q.value = r / a;
|
|
52
|
+
}, M = (e = !1) => {
|
|
53
|
+
const t = f.value, a = (R.value ? m.get() : v.get()) / 100 * (t - 1), n = R.value ? 0 : w.get(), s = ve(d(Math.abs(n) * Ke / $e, 0, 1)), r = Math.sign(n) || 1, l = de + (Oe - de) * s, C = l * (1 + pe), Se = l * (1 - 0.5 * pe), ke = Math.round(a), Ee = !e && s < fe && J < fe, ae = x.value;
|
|
54
|
+
for (let u = 0; u < t; u++) {
|
|
55
|
+
const S = O[u];
|
|
56
|
+
if (!S) continue;
|
|
57
|
+
const oe = u <= ke ? "true" : "false";
|
|
58
|
+
if (S.dataset.on !== oe && (S.dataset.on = oe), Ee) continue;
|
|
59
|
+
const F = u - a, ne = F * r < 0 ? C : Se, se = Math.abs(F) < ne ? s * Math.cos(Math.PI * F / (2 * ne)) ** 2 : 0;
|
|
60
|
+
S.style.transform = `scaleY(${ae + se * (1 - ae)})`;
|
|
61
|
+
const re = X[u];
|
|
62
|
+
re && (re.style.opacity = String(se));
|
|
63
|
+
}
|
|
64
|
+
J = s;
|
|
65
|
+
}, ye = () => M(), Q = () => Ge.render(ye, !1, !0), Z = [];
|
|
66
|
+
Pe(() => {
|
|
67
|
+
Z.push(v.on("change", Q), w.on("change", Q)), T(), _ = new ResizeObserver(T), _.observe(y.value), M(!0);
|
|
68
|
+
}), Re(() => M(!0)), k(W, (e) => m.set(e)), k([f, x, R], () => M(!0), { flush: "post" }), k($, () => T(), { flush: "post" }), xe(() => {
|
|
69
|
+
_?.disconnect(), _ = null, Z.forEach((e) => e()), v.stop(), w.stop(), m.stop();
|
|
70
|
+
});
|
|
71
|
+
const ee = (e) => {
|
|
72
|
+
const t = H(e, o.min, o.max, o.step);
|
|
73
|
+
t !== A && (A = t, o.value === void 0 && (U.value = t), N("update:value", t), N("change", t));
|
|
74
|
+
};
|
|
75
|
+
k(i, (e) => A = e);
|
|
76
|
+
const te = (e) => {
|
|
77
|
+
const t = y.value;
|
|
78
|
+
if (!t) return;
|
|
79
|
+
const a = t.getBoundingClientRect();
|
|
80
|
+
if (!a.width) return;
|
|
81
|
+
let n = d((e - a.left) / a.width, 0, 1);
|
|
82
|
+
getComputedStyle(t).direction === "rtl" && (n = 1 - n), ee(o.min + n * (o.max - o.min));
|
|
83
|
+
}, _e = (e) => {
|
|
84
|
+
if (!(o.disabled || p !== null)) {
|
|
85
|
+
p = e.pointerId;
|
|
86
|
+
try {
|
|
87
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
88
|
+
} catch {
|
|
89
|
+
}
|
|
90
|
+
z.value?.removeAttribute("data-instant"), K.value?.focus({ preventScroll: !0 }), te(e.clientX);
|
|
91
|
+
}
|
|
92
|
+
}, we = (e) => {
|
|
93
|
+
e.pointerId === p && te(e.clientX);
|
|
94
|
+
}, L = (e) => {
|
|
95
|
+
if (e.pointerId === p) {
|
|
96
|
+
try {
|
|
97
|
+
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
98
|
+
} catch {
|
|
99
|
+
}
|
|
100
|
+
p = null;
|
|
101
|
+
}
|
|
102
|
+
}, Me = (e) => {
|
|
103
|
+
if (o.disabled) return;
|
|
104
|
+
const { step: t, min: a, max: n } = o, s = i.value, r = {
|
|
105
|
+
ArrowRight: s + t,
|
|
106
|
+
ArrowUp: s + t,
|
|
107
|
+
ArrowLeft: s - t,
|
|
108
|
+
ArrowDown: s - t,
|
|
109
|
+
PageUp: s + t * 10,
|
|
110
|
+
PageDown: s - t * 10,
|
|
111
|
+
Home: a,
|
|
112
|
+
End: n
|
|
113
|
+
};
|
|
114
|
+
if (!(e.key in r)) return;
|
|
115
|
+
e.preventDefault();
|
|
116
|
+
const l = H(r[e.key], a, n, t), C = G(l, a, n);
|
|
117
|
+
z.value?.setAttribute("data-instant", "true"), v.jump(C), w.jump(0), m.jump(C), ee(l);
|
|
118
|
+
}, Ce = h(
|
|
119
|
+
() => ({
|
|
120
|
+
...o.fillColor && { "--g-slider-fill": o.fillColor },
|
|
121
|
+
...o.trackColor && { "--g-slider-track": o.trackColor },
|
|
122
|
+
// 波峰默认跟随填充色(含自适应默认值),显式传入时优先
|
|
123
|
+
"--g-slider-crest": o.crestColor || "var(--g-slider-fill)",
|
|
124
|
+
"--g-slider-height": `${o.height}px`,
|
|
125
|
+
"--g-slider-bar-w": `${Y.value}px`,
|
|
126
|
+
"--g-slider-rest": x.value
|
|
127
|
+
})
|
|
128
|
+
);
|
|
129
|
+
return (e, t) => (b(), g("div", {
|
|
130
|
+
class: Ae(["g-slider", { "is-disabled": e.disabled }]),
|
|
131
|
+
"aria-disabled": e.disabled || void 0,
|
|
132
|
+
style: le(Ce.value)
|
|
133
|
+
}, [
|
|
134
|
+
ie("div", {
|
|
135
|
+
ref_key: "trackRef",
|
|
136
|
+
ref: y,
|
|
137
|
+
class: "g-slider__track",
|
|
138
|
+
onPointerdown: _e,
|
|
139
|
+
onPointermove: we,
|
|
140
|
+
onPointerup: L,
|
|
141
|
+
onPointercancel: L,
|
|
142
|
+
onLostpointercapture: L
|
|
143
|
+
}, [
|
|
144
|
+
(b(!0), g(De, null, Ve(f.value, (a) => (b(), g("span", {
|
|
145
|
+
key: a,
|
|
146
|
+
ref_for: !0,
|
|
147
|
+
ref: (n) => ge(a - 1, n),
|
|
148
|
+
class: "g-slider__bar",
|
|
149
|
+
style: le({ left: `${((a - 1) * q.value).toFixed(3)}px` })
|
|
150
|
+
}, [
|
|
151
|
+
e.crestColor ? (b(), g("span", {
|
|
152
|
+
key: 0,
|
|
153
|
+
ref_for: !0,
|
|
154
|
+
ref: (n) => be(a - 1, n),
|
|
155
|
+
class: "g-slider__crest"
|
|
156
|
+
}, null, 512)) : ce("", !0)
|
|
157
|
+
], 4))), 128)),
|
|
158
|
+
ie("button", {
|
|
159
|
+
ref_key: "handleRef",
|
|
160
|
+
ref: K,
|
|
161
|
+
type: "button",
|
|
162
|
+
role: "slider",
|
|
163
|
+
class: "g-slider__handle",
|
|
164
|
+
tabindex: e.disabled ? -1 : 0,
|
|
165
|
+
"aria-label": e.ariaLabel,
|
|
166
|
+
"aria-valuemin": e.min,
|
|
167
|
+
"aria-valuemax": e.max,
|
|
168
|
+
"aria-valuenow": i.value,
|
|
169
|
+
"aria-valuetext": j(i.value),
|
|
170
|
+
"aria-disabled": e.disabled || void 0,
|
|
171
|
+
onKeydown: Me
|
|
172
|
+
}, null, 40, Ue)
|
|
173
|
+
], 544),
|
|
174
|
+
e.showValue ? (b(), g("span", We, Te(j(i.value)), 1)) : ce("", !0)
|
|
175
|
+
], 14, Ne));
|
|
176
|
+
}
|
|
177
|
+
}), B = /* @__PURE__ */ He(qe, [["__scopeId", "data-v-449781d0"]]);
|
|
178
|
+
B.install = (I) => {
|
|
179
|
+
I.component(B.name, B);
|
|
180
|
+
};
|
|
181
|
+
export {
|
|
182
|
+
B as GSlider,
|
|
183
|
+
B as default
|
|
184
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.g-slider[data-v-449781d0]{display:inline-flex;align-items:center;gap:12px;width:100%;min-width:0;color:inherit;--g-slider-fill: #27272a;--g-slider-track: rgba(0, 0, 0, .12)}.g-slider.is-disabled[data-v-449781d0]{opacity:.5;pointer-events:none}.g-slider .g-slider__track[data-v-449781d0]{position:relative;flex:1;min-width:0;height:var(--g-slider-height);min-height:44px;touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;cursor:grab}@media(hover:hover)and (pointer:fine){.g-slider .g-slider__track[data-v-449781d0]:active{cursor:grabbing}}.g-slider .g-slider__bar[data-v-449781d0]{position:absolute;top:0;bottom:0;margin-block:auto;width:var(--g-slider-bar-w, 3px);height:var(--g-slider-height);background:var(--g-slider-track);border-radius:999px;transform-origin:center;transform:scaleY(var(--g-slider-rest));transition:background-color .12s ease}.g-slider .g-slider__bar[data-on=true][data-v-449781d0]{background:var(--g-slider-fill)}@media(prefers-reduced-motion:reduce){.g-slider .g-slider__bar[data-v-449781d0]{transform:scaleY(var(--g-slider-rest))!important}}.g-slider[data-instant=true] .g-slider__bar[data-v-449781d0]{transition-duration:0ms}.g-slider .g-slider__crest[data-v-449781d0]{position:absolute;inset:0;background:var(--g-slider-crest);opacity:0;border-radius:inherit}.g-slider .g-slider__handle[data-v-449781d0]{position:absolute;inset:0;margin:0;padding:0;background:transparent;border:0;border-radius:12px;outline:none;touch-action:none;-webkit-tap-highlight-color:transparent;cursor:inherit}.g-slider .g-slider__value[data-v-449781d0]{opacity:.6;min-width:3ch;font-size:13px;text-align:right;font-variant-numeric:tabular-nums}html.dark .g-slider[data-v-449781d0]{--g-slider-fill: #f5f5f5;--g-slider-track: rgba(255, 255, 255, .14)}
|
package/lib/GSlider.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/lib/GSteps/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"),i=require("motion-v"),y=require("../GBranched-BtF7heMk.js"),S={class:"step-bar"},C=["onClick"],V={class:"step-icon"},N={class:"step-main"},E={class:"step-title"},g={key:0,class:"step-description"},b=e.defineComponent({name:"GSteps",__name:"index",props:{active:{},steps:{},errorAt:{},clickable:{type:Boolean},processStatus:{},finishStatus:{}},emits:["step-click"],setup(r,{emit:f}){const o=r,v=f,k=e.computed(()=>o.steps.map(t=>typeof t=="string"?{title:t}:t)),a=e.computed(()=>k.value.map((t,n)=>n===o.errorAt?"error":n<o.active?o.finishStatus??"success":n===o.active?o.processStatus??"process":"wait")),_=t=>t==="finish"||t==="success",h=t=>{o.clickable&&t!==o.active&&v("step-click",t)},u={scale:.4,opacity:0},p={scale:1,opacity:1},m={scale:.4,opacity:0},d={duration:.15,ease:"easeOut"},B={duration:.3,ease:"easeInOut"};return(t,n)=>(e.openBlock(),e.createElementBlock("div",S,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,(l,s)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:l.title},[e.createElementVNode("div",{class:e.normalizeClass(["step-node",["is-"+a.value[s],{"is-clickable":t.clickable}]]),onClick:T=>h(s)},[e.createElementVNode("div",V,[e.renderSlot(t.$slots,"icon",{index:s,status:a.value[s]},()=>[e.createVNode(e.unref(i.AnimatePresence),{initial:!1,mode:"popLayout"},{default:e.withCtx(()=>[a.value[s]==="success"||a.value[s]==="finish"?(e.openBlock(),e.createBlock(e.unref(i.motion).span,{key:"check",class:"step-check",initial:u,animate:p,exit:m,transition:d},{default:e.withCtx(()=>n[0]||(n[0]=[e.createTextVNode("✓")])),_:1,__:[0]})):a.value[s]==="error"?(e.openBlock(),e.createBlock(e.unref(i.motion).span,{key:"error",class:"step-check",initial:u,animate:p,exit:m,transition:d},{default:e.withCtx(()=>n[1]||(n[1]=[e.createTextVNode("✕")])),_:1,__:[1]})):(e.openBlock(),e.createBlock(e.unref(i.motion).span,{key:s,class:"step-num",initial:u,animate:p,exit:m,transition:d},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s+1),1)]),_:2},1024))]),_:2},1024)],!0)]),e.createElementVNode("div",N,[e.createElementVNode("div",E,e.toDisplayString(l.title),1),l.description?(e.openBlock(),e.createElementBlock("div",g,e.toDisplayString(l.description),1)):e.createCommentVNode("",!0)])],10,C),s<t.steps.length-1?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["step-line",["is-"+a.value[s]]])},[e.createVNode(e.unref(i.motion).div,{class:"step-line-fill",initial:!1,animate:{scaleX:_(a.value[s])?1:0},transition:B},null,8,["animate"])],2)):e.createCommentVNode("",!0)],64))),128))]))}}),c=y._export_sfc(b,[["__scopeId","data-v-d59243d9"]]);c.install=r=>{r.component(c.name,c)};exports.GSteps=c;exports.default=c;
|
package/lib/GSteps/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as z, computed as b, createElementBlock as o, openBlock as a, Fragment as g, renderList as F, createElementVNode as r, createCommentVNode as A, normalizeClass as B, renderSlot as G, createVNode as N, unref as c, withCtx as p, createBlock as v, createTextVNode as h, toDisplayString as y } from "vue";
|
|
2
2
|
import { AnimatePresence as L, motion as u } from "motion-v";
|
|
3
|
-
import { _ as O } from "../
|
|
3
|
+
import { _ as O } from "../GBranched-vnLlYOl9.mjs";
|
|
4
4
|
const $ = { class: "step-bar" }, D = ["onClick"], P = { class: "step-icon" }, X = { class: "step-main" }, j = { class: "step-title" }, q = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "step-description"
|