@filipgutica/ui 1.5.0 → 1.7.0
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/README.md +65 -0
- package/dist/index.js +167 -404
- package/dist/site/CaptureScreen.vue.d.ts +9 -0
- package/dist/site/SiteNavLinks.vue.d.ts +14 -0
- package/dist/site/UiCapture.vue.d.ts +40 -0
- package/dist/site/UiCommandList.vue.d.ts +30 -0
- package/dist/site/UiSiteNav.vue.d.ts +21 -0
- package/dist/site/index.d.ts +6 -0
- package/dist/site.js +399 -59
- package/dist/use-active-section-CiflgGBI.js +255 -0
- package/dist/use-clipboard-copy.d.ts +17 -0
- package/package.json +1 -1
- package/src/site.css +310 -2
package/dist/site.js
CHANGED
|
@@ -1,41 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "./use-active-section-CiflgGBI.js";
|
|
2
|
+
import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, mergeModels as h, nextTick as g, normalizeClass as _, normalizeStyle as v, onBeforeUnmount as y, onMounted as b, onUnmounted as x, openBlock as S, ref as C, renderList as w, renderSlot as T, shallowRef as E, toDisplayString as D, unref as O, useId as k, useModel as ee, useSlots as A, useTemplateRef as te, watch as j, withCtx as M } from "vue";
|
|
3
|
+
import { tryOnMounted as N, usePreferredDark as P, useStorage as F } from "@vueuse/core";
|
|
3
4
|
//#region src/site/appearance.ts
|
|
4
|
-
var
|
|
5
|
+
var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "dark", ne = `(function () {
|
|
5
6
|
var root = document.documentElement, choice;
|
|
6
|
-
try { choice = localStorage.getItem('${
|
|
7
|
+
try { choice = localStorage.getItem('${I}'); } catch (error) {}
|
|
7
8
|
var dark = choice === 'dark';
|
|
8
9
|
if (choice !== 'light' && choice !== 'dark') {
|
|
9
10
|
try { dark = matchMedia('(prefers-color-scheme: dark)').matches; } catch (error) {}
|
|
10
11
|
}
|
|
11
12
|
root.classList.toggle('dark', dark);
|
|
12
13
|
if (choice === 'light' || choice === 'dark') root.dataset.theme = choice;
|
|
13
|
-
})();`,
|
|
14
|
+
})();`, R = ({ root: e, choice: t, appearance: n }) => {
|
|
14
15
|
e.classList.toggle("dark", n === "dark"), t === "system" ? delete e.dataset.theme : e.dataset.theme = t;
|
|
15
|
-
},
|
|
16
|
-
let
|
|
16
|
+
}, z = ({ applyToRoot: e = !0 } = {}) => {
|
|
17
|
+
let t = F(I, "system", void 0, {
|
|
17
18
|
initOnMounted: !0,
|
|
18
19
|
writeDefaults: !1,
|
|
19
20
|
onError: () => {},
|
|
20
21
|
serializer: {
|
|
21
|
-
read: (e) =>
|
|
22
|
+
read: (e) => L(e) ? e : "system",
|
|
22
23
|
write: (e) => e
|
|
23
24
|
}
|
|
24
|
-
}),
|
|
25
|
-
return e &&
|
|
26
|
-
|
|
25
|
+
}), n = P(), r = s(() => t.value), i = s(() => t.value === "system" ? n.value ? "dark" : "light" : t.value);
|
|
26
|
+
return e && N(() => {
|
|
27
|
+
j([r, i], () => R({
|
|
27
28
|
root: document.documentElement,
|
|
28
|
-
choice:
|
|
29
|
-
appearance:
|
|
29
|
+
choice: r.value,
|
|
30
|
+
appearance: i.value
|
|
30
31
|
}), { immediate: !0 });
|
|
31
32
|
}), {
|
|
32
|
-
choice:
|
|
33
|
-
appearance:
|
|
33
|
+
choice: r,
|
|
34
|
+
appearance: i,
|
|
34
35
|
chooseAppearance: (e) => {
|
|
35
|
-
|
|
36
|
+
L(e) && (t.value = e);
|
|
36
37
|
}
|
|
37
38
|
};
|
|
38
|
-
},
|
|
39
|
+
}, B = [
|
|
39
40
|
{
|
|
40
41
|
id: "annoterm",
|
|
41
42
|
label: "annoterm",
|
|
@@ -72,24 +73,24 @@ var y = "tool-site-theme", b = (e) => e === "system" || e === "light" || e === "
|
|
|
72
73
|
href: "https://filipgutica.github.io/ui/",
|
|
73
74
|
repository: "https://github.com/filipgutica/ui"
|
|
74
75
|
}
|
|
75
|
-
],
|
|
76
|
+
], re = { class: "fg-site-header" }, V = { class: "fg-site-header__inner" }, H = ["aria-label"], U = {
|
|
76
77
|
class: "fg-site-projects__menu fg-site-nav",
|
|
77
78
|
"aria-label": "Projects"
|
|
78
|
-
},
|
|
79
|
+
}, W = ["href", "aria-current"], G = { class: "fg-site-header__end" }, K = {
|
|
79
80
|
key: 0,
|
|
80
81
|
class: "fg-site-header__links",
|
|
81
82
|
"aria-label": "Site links"
|
|
82
|
-
},
|
|
83
|
+
}, q = ["href"], J = {
|
|
83
84
|
key: 0,
|
|
84
85
|
class: "fg-site-appearance",
|
|
85
86
|
role: "group",
|
|
86
87
|
"aria-label": "Color theme"
|
|
87
|
-
},
|
|
88
|
+
}, Y = [
|
|
88
89
|
"aria-label",
|
|
89
90
|
"title",
|
|
90
91
|
"aria-pressed",
|
|
91
92
|
"onClick"
|
|
92
|
-
],
|
|
93
|
+
], X = {
|
|
93
94
|
viewBox: "0 0 24 24",
|
|
94
95
|
width: "18",
|
|
95
96
|
height: "18",
|
|
@@ -97,17 +98,17 @@ var y = "tool-site-theme", b = (e) => e === "system" || e === "light" || e === "
|
|
|
97
98
|
stroke: "currentColor",
|
|
98
99
|
"stroke-width": "1.5",
|
|
99
100
|
"aria-hidden": "true"
|
|
100
|
-
},
|
|
101
|
+
}, ie = {
|
|
101
102
|
key: 2,
|
|
102
103
|
d: "M20.5 13.5A9 9 0 0 1 10.5 3a9 9 0 1 0 10 10.5Z"
|
|
103
|
-
},
|
|
104
|
+
}, ae = /* @__PURE__ */ m({
|
|
104
105
|
__name: "UiSiteHeader",
|
|
105
106
|
props: {
|
|
106
107
|
project: {},
|
|
107
108
|
links: { default: () => [] }
|
|
108
109
|
},
|
|
109
|
-
setup(
|
|
110
|
-
let
|
|
110
|
+
setup(e) {
|
|
111
|
+
let t = [
|
|
111
112
|
{
|
|
112
113
|
value: "system",
|
|
113
114
|
label: "System"
|
|
@@ -120,29 +121,29 @@ var y = "tool-site-theme", b = (e) => e === "system" || e === "light" || e === "
|
|
|
120
121
|
value: "dark",
|
|
121
122
|
label: "Dark"
|
|
122
123
|
}
|
|
123
|
-
],
|
|
124
|
-
|
|
125
|
-
},
|
|
126
|
-
e.key !== "Escape" || !
|
|
127
|
-
},
|
|
128
|
-
e.relatedTarget instanceof Node && !
|
|
129
|
-
},
|
|
130
|
-
e.target instanceof Node && !
|
|
124
|
+
], n = s(() => B.find(({ id: t }) => t === e.project)?.label ?? e.project), r = A().default ? void 0 : z(), i = C(!1), a = C(), c = C(), f = () => {
|
|
125
|
+
a.value && (a.value.open = !1);
|
|
126
|
+
}, p = (e) => {
|
|
127
|
+
e.key !== "Escape" || !a.value?.open || (f(), c.value?.focus());
|
|
128
|
+
}, m = (e) => {
|
|
129
|
+
e.relatedTarget instanceof Node && !a.value?.contains(e.relatedTarget) && f();
|
|
130
|
+
}, h = (e) => {
|
|
131
|
+
e.target instanceof Node && !a.value?.contains(e.target) && f();
|
|
131
132
|
};
|
|
132
|
-
return
|
|
133
|
-
|
|
134
|
-
}),
|
|
133
|
+
return b(() => {
|
|
134
|
+
i.value = !0, document.addEventListener("pointerdown", h);
|
|
135
|
+
}), y(() => document.removeEventListener("pointerdown", h)), (s, f) => (S(), u("header", re, [d("div", V, [d("details", {
|
|
135
136
|
ref_key: "menu",
|
|
136
|
-
ref:
|
|
137
|
+
ref: a,
|
|
137
138
|
class: "fg-site-projects",
|
|
138
|
-
onKeydown:
|
|
139
|
-
onFocusout:
|
|
140
|
-
}, [
|
|
139
|
+
onKeydown: p,
|
|
140
|
+
onFocusout: m
|
|
141
|
+
}, [d("summary", {
|
|
141
142
|
ref_key: "trigger",
|
|
142
|
-
ref:
|
|
143
|
+
ref: c,
|
|
143
144
|
class: "fg-site-projects__trigger",
|
|
144
|
-
"aria-label": `Project: ${
|
|
145
|
-
}, [
|
|
145
|
+
"aria-label": `Project: ${n.value}`
|
|
146
|
+
}, [d("span", null, D(n.value), 1), f[0] ||= d("svg", {
|
|
146
147
|
class: "fg-site-projects__chevron",
|
|
147
148
|
viewBox: "0 0 16 16",
|
|
148
149
|
width: "16",
|
|
@@ -151,33 +152,372 @@ var y = "tool-site-theme", b = (e) => e === "system" || e === "light" || e === "
|
|
|
151
152
|
stroke: "currentColor",
|
|
152
153
|
"stroke-width": "1.5",
|
|
153
154
|
"aria-hidden": "true"
|
|
154
|
-
}, [
|
|
155
|
-
key:
|
|
156
|
-
href:
|
|
157
|
-
"aria-current":
|
|
158
|
-
},
|
|
155
|
+
}, [d("path", { d: "m4 6 4 4 4-4" })], -1)], 8, H), d("nav", U, [(S(!0), u(o, null, w(O(B), (t) => (S(), u("a", {
|
|
156
|
+
key: t.id,
|
|
157
|
+
href: t.href,
|
|
158
|
+
"aria-current": t.id === e.project ? "page" : void 0
|
|
159
|
+
}, D(t.label), 9, W))), 128))])], 544), d("div", G, [e.links.length > 0 ? (S(), u("nav", K, [(S(!0), u(o, null, w(e.links, (e) => (S(), u("a", {
|
|
159
160
|
key: e.href,
|
|
160
161
|
href: e.href
|
|
161
|
-
},
|
|
162
|
-
key:
|
|
162
|
+
}, D(e.label), 9, q))), 128))])) : l("", !0), T(s.$slots, "default", {}, () => [i.value && O(r) ? (S(), u("div", J, [(S(), u(o, null, w(t, (e) => d("button", {
|
|
163
|
+
key: e.value,
|
|
163
164
|
type: "button",
|
|
164
165
|
class: "fg-site-appearance__choice",
|
|
165
|
-
"aria-label": `${
|
|
166
|
-
title: `${
|
|
167
|
-
"aria-pressed":
|
|
168
|
-
onClick: (
|
|
169
|
-
}, [(
|
|
166
|
+
"aria-label": `${e.label} theme`,
|
|
167
|
+
title: `${e.label} theme`,
|
|
168
|
+
"aria-pressed": O(r).choice.value === e.value,
|
|
169
|
+
onClick: (t) => O(r).chooseAppearance(e.value)
|
|
170
|
+
}, [(S(), u("svg", X, [e.value === "system" ? (S(), u(o, { key: 0 }, [f[1] ||= d("rect", {
|
|
170
171
|
x: "3",
|
|
171
172
|
y: "4",
|
|
172
173
|
width: "18",
|
|
173
174
|
height: "13",
|
|
174
175
|
rx: "2"
|
|
175
|
-
}, null, -1),
|
|
176
|
+
}, null, -1), f[2] ||= d("path", { d: "M8 21h8m-4-4v4" }, null, -1)], 64)) : e.value === "light" ? (S(), u(o, { key: 1 }, [f[3] ||= d("circle", {
|
|
176
177
|
cx: "12",
|
|
177
178
|
cy: "12",
|
|
178
179
|
r: "4"
|
|
179
|
-
}, null, -1),
|
|
180
|
+
}, null, -1), f[4] ||= d("path", { d: "M12 2v2m0 16v2M2 12h2m16 0h2M5 5l1.5 1.5m11 11L19 19M5 19l1.5-1.5m11-11L19 5" }, null, -1)], 64)) : (S(), u("path", ie))]))], 8, Y)), 64))])) : l("", !0)])])])]));
|
|
181
|
+
}
|
|
182
|
+
}), oe = ["id"], se = ["role", "aria-labelledby"], ce = ["id"], le = [
|
|
183
|
+
"href",
|
|
184
|
+
"aria-current",
|
|
185
|
+
"onClick"
|
|
186
|
+
], ue = { key: 0 }, Z = /* @__PURE__ */ m({
|
|
187
|
+
__name: "SiteNavLinks",
|
|
188
|
+
props: {
|
|
189
|
+
contentId: {},
|
|
190
|
+
label: {},
|
|
191
|
+
groups: {},
|
|
192
|
+
activeId: {}
|
|
193
|
+
},
|
|
194
|
+
emits: ["navigate"],
|
|
195
|
+
setup(e, { emit: t }) {
|
|
196
|
+
let n = t, r = `${e.contentId}-label`, i = (t) => `${e.contentId}-group-${t}`, a = (t) => t.current ? "page" : e.activeId !== void 0 && t.href === `#${e.activeId}` ? "location" : void 0;
|
|
197
|
+
return (t, s) => (S(), u("div", {
|
|
198
|
+
id: e.contentId,
|
|
199
|
+
class: "fg-site-rail__content"
|
|
200
|
+
}, [d("nav", {
|
|
201
|
+
class: "fg-site-rail__nav fg-site-nav",
|
|
202
|
+
"aria-labelledby": r
|
|
203
|
+
}, [d("h2", {
|
|
204
|
+
id: r,
|
|
205
|
+
class: "fg-site-rail__label"
|
|
206
|
+
}, D(e.label), 1), (S(!0), u(o, null, w(e.groups, (e, t) => (S(), u("div", {
|
|
207
|
+
key: e.label ?? t,
|
|
208
|
+
class: "fg-site-rail__group",
|
|
209
|
+
role: e.label ? "group" : void 0,
|
|
210
|
+
"aria-labelledby": e.label ? i(t) : void 0
|
|
211
|
+
}, [e.label ? (S(), u("span", {
|
|
212
|
+
key: 0,
|
|
213
|
+
id: i(t),
|
|
214
|
+
class: "fg-site-rail__group-label"
|
|
215
|
+
}, D(e.label), 9, ce)) : l("", !0), (S(!0), u(o, null, w(e.items, (e) => (S(), u("a", {
|
|
216
|
+
key: e.href,
|
|
217
|
+
href: e.href,
|
|
218
|
+
"aria-current": a(e),
|
|
219
|
+
onClick: (t) => n("navigate", e.href, t)
|
|
220
|
+
}, [e.code ? (S(), u("code", ue, D(e.label), 1)) : (S(), u(o, { key: 1 }, [f(D(e.label), 1)], 64))], 8, le))), 128))], 8, se))), 128))])], 8, oe));
|
|
221
|
+
}
|
|
222
|
+
}), de = ["data-enhanced"], fe = ["open"], pe = ["aria-controls"], me = "(max-width: 800px)", he = /* @__PURE__ */ m({
|
|
223
|
+
__name: "UiSiteNav",
|
|
224
|
+
props: {
|
|
225
|
+
label: {},
|
|
226
|
+
groups: {}
|
|
227
|
+
},
|
|
228
|
+
setup(e) {
|
|
229
|
+
let t = k(), n = C(), o = C(!1), s = C(!1), l = C(!1), m = a({ targetIds: e.groups.flatMap((e) => e.items).flatMap(({ href: e }) => e.startsWith("#") && e.length > 1 ? [e.slice(1)] : []) }), h, _ = null, v = () => n.value?.querySelector("button.fg-site-rail__toggle"), y = () => {
|
|
230
|
+
g(() => n.value?.querySelector(".fg-site-nav a")?.focus({ preventScroll: !0 }));
|
|
231
|
+
}, w = () => {
|
|
232
|
+
let e = h?.matches && !s.value && n.value?.contains(document.activeElement), t = h?.matches === !1 && s.value && !l.value && v() === document.activeElement;
|
|
233
|
+
s.value = h?.matches === !0, s.value || (l.value = !1), e ? g(() => v()?.focus({ preventScroll: !0 })) : t && y();
|
|
234
|
+
}, T = (e, t) => {
|
|
235
|
+
!l.value || t.button !== 0 || t.metaKey || t.ctrlKey || t.altKey || t.shiftKey || (_ = e.startsWith("#") ? document.getElementById(e.slice(1)) : null, l.value = !1);
|
|
236
|
+
}, E = (e) => {
|
|
237
|
+
_ ? (e.preventDefault(), _.tabIndex = -1, _.focus({ preventScroll: !0 }), _ = null) : s.value || (e.preventDefault(), y());
|
|
238
|
+
};
|
|
239
|
+
return b(() => {
|
|
240
|
+
h = matchMedia(me), w(), o.value = !0, h.addEventListener("change", w);
|
|
241
|
+
}), x(() => h?.removeEventListener("change", w)), (a, h) => (S(), u("div", {
|
|
242
|
+
ref_key: "root",
|
|
243
|
+
ref: n,
|
|
244
|
+
class: "fg-site-rail",
|
|
245
|
+
"data-enhanced": o.value
|
|
246
|
+
}, [!o.value || !s.value ? (S(), u("details", {
|
|
247
|
+
key: 0,
|
|
248
|
+
class: "fg-site-rail__menu",
|
|
249
|
+
open: o.value && !s.value
|
|
250
|
+
}, [d("summary", {
|
|
251
|
+
class: "fg-site-rail__summary",
|
|
252
|
+
"aria-controls": O(t)
|
|
253
|
+
}, " Menu ", 8, pe), p(Z, {
|
|
254
|
+
"content-id": O(t),
|
|
255
|
+
label: e.label,
|
|
256
|
+
groups: e.groups,
|
|
257
|
+
"active-id": O(m)
|
|
258
|
+
}, null, 8, [
|
|
259
|
+
"content-id",
|
|
260
|
+
"label",
|
|
261
|
+
"groups",
|
|
262
|
+
"active-id"
|
|
263
|
+
])], 8, fe)) : (S(), c(i, {
|
|
264
|
+
key: 1,
|
|
265
|
+
open: l.value,
|
|
266
|
+
"onUpdate:open": h[0] ||= (e) => l.value = e,
|
|
267
|
+
title: "Navigation",
|
|
268
|
+
onCloseAutoFocus: E
|
|
269
|
+
}, {
|
|
270
|
+
trigger: M(() => [p(r, {
|
|
271
|
+
variant: "ghost",
|
|
272
|
+
size: "lg",
|
|
273
|
+
class: "fg-site-rail__toggle"
|
|
274
|
+
}, {
|
|
275
|
+
default: M(() => [...h[1] ||= [f(" Menu ", -1)]]),
|
|
276
|
+
_: 1
|
|
277
|
+
})]),
|
|
278
|
+
default: M(() => [p(Z, {
|
|
279
|
+
"content-id": O(t),
|
|
280
|
+
label: e.label,
|
|
281
|
+
groups: e.groups,
|
|
282
|
+
"active-id": O(m),
|
|
283
|
+
onNavigate: T
|
|
284
|
+
}, null, 8, [
|
|
285
|
+
"content-id",
|
|
286
|
+
"label",
|
|
287
|
+
"groups",
|
|
288
|
+
"active-id"
|
|
289
|
+
])]),
|
|
290
|
+
_: 1
|
|
291
|
+
}, 8, ["open"]))], 8, de));
|
|
292
|
+
}
|
|
293
|
+
}), ge = [
|
|
294
|
+
"aria-label",
|
|
295
|
+
"tabindex",
|
|
296
|
+
"data-fit",
|
|
297
|
+
"innerHTML"
|
|
298
|
+
], Q = /* @__PURE__ */ m({
|
|
299
|
+
__name: "CaptureScreen",
|
|
300
|
+
props: {
|
|
301
|
+
html: {},
|
|
302
|
+
label: {},
|
|
303
|
+
fit: { type: Boolean }
|
|
304
|
+
},
|
|
305
|
+
setup(e) {
|
|
306
|
+
let t = C(), n = C(1), r = C(), i, a = () => {
|
|
307
|
+
if (!e.fit) {
|
|
308
|
+
r.value = void 0, n.value = 1;
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
let i = t.value, a = i?.firstElementChild;
|
|
312
|
+
!i?.clientWidth || !(a instanceof HTMLElement) || !a.offsetWidth || (n.value = Math.min(1, i.clientWidth / a.offsetWidth), r.value = Math.ceil(a.offsetHeight * n.value) + i.offsetHeight - i.clientHeight);
|
|
313
|
+
};
|
|
314
|
+
return j(() => [e.fit, e.html], a, { flush: "post" }), b(() => {
|
|
315
|
+
typeof ResizeObserver < "u" && (i = new ResizeObserver(a), t.value && i.observe(t.value)), a();
|
|
316
|
+
}), x(() => i?.disconnect()), (i, a) => (S(), u("div", {
|
|
317
|
+
ref_key: "container",
|
|
318
|
+
ref: t,
|
|
319
|
+
class: "fg-capture__screen",
|
|
320
|
+
role: "region",
|
|
321
|
+
"aria-label": e.label,
|
|
322
|
+
tabindex: e.fit ? void 0 : 0,
|
|
323
|
+
"data-fit": e.fit || void 0,
|
|
324
|
+
style: v({
|
|
325
|
+
height: r.value === void 0 ? void 0 : `${r.value}px`,
|
|
326
|
+
"--capture-scale": n.value
|
|
327
|
+
}),
|
|
328
|
+
innerHTML: e.html
|
|
329
|
+
}, null, 12, ge));
|
|
330
|
+
}
|
|
331
|
+
}), _e = ["data-enhanced"], ve = ["aria-label"], ye = ["id"], be = { class: "fg-capture__preview" }, xe = ["title", "onClick"], Se = {
|
|
332
|
+
key: 0,
|
|
333
|
+
class: "fg-capture__caption"
|
|
334
|
+
}, Ce = { key: 0 }, we = /* @__PURE__ */ m({
|
|
335
|
+
__name: "UiCapture",
|
|
336
|
+
props: /*@__PURE__*/ h({
|
|
337
|
+
items: {},
|
|
338
|
+
label: {},
|
|
339
|
+
idPrefix: { default: "frame-" }
|
|
340
|
+
}, {
|
|
341
|
+
modelValue: {},
|
|
342
|
+
modelModifiers: {}
|
|
343
|
+
}),
|
|
344
|
+
emits: ["update:modelValue"],
|
|
345
|
+
setup(e) {
|
|
346
|
+
let i = ee(e, "modelValue"), a = C(!1), m = s(() => e.items.map(({ id: e, label: t }) => ({
|
|
347
|
+
value: e,
|
|
348
|
+
label: t
|
|
349
|
+
}))), h = s(() => i.value ?? e.items[0]?.id ?? ""), _ = s(() => e.items.find(({ id: e }) => e === h.value)), v = C(!1), y = E(), O = 0, k = 0, A = te("fullSizeButton"), j = (e) => {
|
|
350
|
+
y.value = e, v.value = !0;
|
|
351
|
+
}, N = (e) => {
|
|
352
|
+
A.value?.isConnected && (e.preventDefault(), A.value.focus({ preventScroll: !0 }));
|
|
353
|
+
}, P = () => {
|
|
354
|
+
try {
|
|
355
|
+
return document.getElementById(decodeURIComponent(location.hash.slice(1)));
|
|
356
|
+
} catch {
|
|
357
|
+
return null;
|
|
358
|
+
}
|
|
359
|
+
}, F = async () => {
|
|
360
|
+
await g(), cancelAnimationFrame(O), cancelAnimationFrame(k), O = requestAnimationFrame(() => {
|
|
361
|
+
k = requestAnimationFrame(() => P()?.scrollIntoView({
|
|
362
|
+
behavior: "instant",
|
|
363
|
+
block: "start"
|
|
364
|
+
}));
|
|
365
|
+
});
|
|
366
|
+
}, I = () => {
|
|
367
|
+
let t = P();
|
|
368
|
+
if (!t) return !1;
|
|
369
|
+
let n = e.items.find(({ id: n }) => document.getElementById(`${e.idPrefix}${n}`)?.contains(t));
|
|
370
|
+
return !n || h.value === n.id ? !1 : (i.value = n.id, !0);
|
|
371
|
+
}, L = () => {
|
|
372
|
+
I() && F();
|
|
373
|
+
};
|
|
374
|
+
return b(() => {
|
|
375
|
+
a.value = !0, I(), location.hash && F(), window.addEventListener("hashchange", L), window.addEventListener("popstate", L);
|
|
376
|
+
}), x(() => {
|
|
377
|
+
cancelAnimationFrame(O), cancelAnimationFrame(k), window.removeEventListener("hashchange", L), window.removeEventListener("popstate", L);
|
|
378
|
+
}), (s, g) => (S(), u("div", {
|
|
379
|
+
class: "fg-capture",
|
|
380
|
+
"data-enhanced": a.value
|
|
381
|
+
}, [
|
|
382
|
+
a.value && _.value ? (S(), u("button", {
|
|
383
|
+
key: 0,
|
|
384
|
+
ref_key: "fullSizeButton",
|
|
385
|
+
ref: A,
|
|
386
|
+
type: "button",
|
|
387
|
+
class: "fg-capture__full",
|
|
388
|
+
"aria-label": `Expand ${_.value.label} capture at full size`,
|
|
389
|
+
"aria-haspopup": "dialog",
|
|
390
|
+
onClick: g[0] ||= (e) => j(_.value)
|
|
391
|
+
}, [...g[4] ||= [d("svg", {
|
|
392
|
+
viewBox: "0 0 24 24",
|
|
393
|
+
fill: "none",
|
|
394
|
+
stroke: "currentColor",
|
|
395
|
+
"stroke-width": "1.5",
|
|
396
|
+
"aria-hidden": "true"
|
|
397
|
+
}, [d("path", { d: "M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7" })], -1), d("span", { class: "fg-capture__full-label" }, "Full size", -1)]], 8, ve)) : l("", !0),
|
|
398
|
+
p(n, {
|
|
399
|
+
"model-value": h.value,
|
|
400
|
+
items: m.value,
|
|
401
|
+
label: e.label,
|
|
402
|
+
"onUpdate:modelValue": g[1] ||= (e) => i.value = e
|
|
403
|
+
}, {
|
|
404
|
+
panel: M(({ value: t }) => [(S(!0), u(o, null, w(e.items, (n) => (S(), u(o, { key: n.id }, [n.id === t ? (S(), u("figure", {
|
|
405
|
+
key: 0,
|
|
406
|
+
id: `${e.idPrefix}${n.id}`,
|
|
407
|
+
class: "fg-capture__figure"
|
|
408
|
+
}, [d("div", be, [p(Q, {
|
|
409
|
+
html: n.html,
|
|
410
|
+
label: `Terminal capture: ${n.label}`,
|
|
411
|
+
fit: a.value
|
|
412
|
+
}, null, 8, [
|
|
413
|
+
"html",
|
|
414
|
+
"label",
|
|
415
|
+
"fit"
|
|
416
|
+
]), a.value ? (S(), u("button", {
|
|
417
|
+
key: 0,
|
|
418
|
+
type: "button",
|
|
419
|
+
class: "fg-capture__expand",
|
|
420
|
+
tabindex: "-1",
|
|
421
|
+
"aria-hidden": "true",
|
|
422
|
+
title: `Open ${n.label} capture at full size`,
|
|
423
|
+
onClick: (e) => j(n)
|
|
424
|
+
}, null, 8, xe)) : l("", !0)]), n.command || s.$slots.caption ? (S(), u("figcaption", Se, [n.command ? (S(), u("code", Ce, D(n.command), 1)) : l("", !0), T(s.$slots, "caption", { item: n })])) : l("", !0)], 8, ye)) : l("", !0)], 64))), 128))]),
|
|
425
|
+
_: 3
|
|
426
|
+
}, 8, [
|
|
427
|
+
"model-value",
|
|
428
|
+
"items",
|
|
429
|
+
"label"
|
|
430
|
+
]),
|
|
431
|
+
p(t, {
|
|
432
|
+
open: v.value,
|
|
433
|
+
"onUpdate:open": g[3] ||= (e) => v.value = e,
|
|
434
|
+
title: `${y.value?.label ?? ""} capture`,
|
|
435
|
+
description: "Scroll to read the full capture.",
|
|
436
|
+
class: "fg-capture-viewer",
|
|
437
|
+
onCloseAutoFocus: N
|
|
438
|
+
}, {
|
|
439
|
+
footer: M(() => [p(r, {
|
|
440
|
+
variant: "secondary",
|
|
441
|
+
size: "lg",
|
|
442
|
+
onClick: g[2] ||= (e) => v.value = !1
|
|
443
|
+
}, {
|
|
444
|
+
default: M(() => [...g[5] ||= [f(" Close capture ", -1)]]),
|
|
445
|
+
_: 1
|
|
446
|
+
})]),
|
|
447
|
+
default: M(() => [y.value ? (S(), c(Q, {
|
|
448
|
+
key: 0,
|
|
449
|
+
html: y.value.html,
|
|
450
|
+
label: `${y.value.label} capture at full size`,
|
|
451
|
+
fit: !1
|
|
452
|
+
}, null, 8, ["html", "label"])) : l("", !0)]),
|
|
453
|
+
_: 1
|
|
454
|
+
}, 8, ["open", "title"])
|
|
455
|
+
], 8, _e));
|
|
456
|
+
}
|
|
457
|
+
}), Te = { class: "fg-command-list" }, Ee = { class: "fg-command-list__table" }, De = { scope: "col" }, $ = { scope: "col" }, Oe = { key: 0 }, ke = { class: "fg-command-list__command" }, Ae = { class: "fg-command-list__description" }, je = {
|
|
458
|
+
key: 0,
|
|
459
|
+
class: "fg-command-list__action"
|
|
460
|
+
}, Me = [
|
|
461
|
+
"disabled",
|
|
462
|
+
"aria-label",
|
|
463
|
+
"title",
|
|
464
|
+
"onClick"
|
|
465
|
+
], Ne = {
|
|
466
|
+
viewBox: "0 0 24 24",
|
|
467
|
+
fill: "none",
|
|
468
|
+
stroke: "currentColor",
|
|
469
|
+
"stroke-width": "1.5",
|
|
470
|
+
"aria-hidden": "true"
|
|
471
|
+
}, Pe = {
|
|
472
|
+
key: 0,
|
|
473
|
+
d: "m5 12 4 4L19 6"
|
|
474
|
+
}, Fe = /* @__PURE__ */ m({
|
|
475
|
+
__name: "UiCommandList",
|
|
476
|
+
props: {
|
|
477
|
+
items: {},
|
|
478
|
+
copyable: {
|
|
479
|
+
type: Boolean,
|
|
480
|
+
default: !0
|
|
481
|
+
},
|
|
482
|
+
commandHeader: { default: "Command" },
|
|
483
|
+
descriptionHeader: { default: "What it does" }
|
|
484
|
+
},
|
|
485
|
+
setup(t) {
|
|
486
|
+
let n = C(!1);
|
|
487
|
+
b(() => {
|
|
488
|
+
n.value = !0;
|
|
489
|
+
});
|
|
490
|
+
let { copied: r, pending: i, error: a, copy: c } = e({
|
|
491
|
+
unavailableMessage: "Clipboard unavailable. Select the command to copy it.",
|
|
492
|
+
failureMessage: "Could not copy. Select the command to copy it."
|
|
493
|
+
}), p = C(""), m = s(() => a.value || (r.value ? `${p.value} copied to clipboard.` : "")), h = (e) => (p.value = e, c(e));
|
|
494
|
+
return (e, s) => (S(), u("div", Te, [d("table", Ee, [d("thead", null, [d("tr", null, [
|
|
495
|
+
d("th", De, D(t.commandHeader), 1),
|
|
496
|
+
d("th", $, D(t.descriptionHeader), 1),
|
|
497
|
+
t.copyable ? (S(), u("td", Oe)) : l("", !0)
|
|
498
|
+
])]), d("tbody", null, [(S(!0), u(o, null, w(t.items, (c) => (S(), u("tr", { key: c.command }, [
|
|
499
|
+
d("td", ke, [T(e.$slots, "command", { item: c }, () => [d("code", null, D(c.command), 1)])]),
|
|
500
|
+
d("td", Ae, [T(e.$slots, "description", { item: c }, () => [f(D(c.description), 1)])]),
|
|
501
|
+
t.copyable ? (S(), u("td", je, [n.value ? (S(), u("button", {
|
|
502
|
+
key: 0,
|
|
503
|
+
type: "button",
|
|
504
|
+
class: "fg-command-list__copy",
|
|
505
|
+
disabled: O(i),
|
|
506
|
+
"aria-label": `Copy ${c.command}`,
|
|
507
|
+
title: `Copy ${c.command}`,
|
|
508
|
+
onClick: (e) => h(c.command)
|
|
509
|
+
}, [(S(), u("svg", Ne, [O(r) && !O(a) && p.value === c.command ? (S(), u("path", Pe)) : (S(), u(o, { key: 1 }, [s[0] ||= d("rect", {
|
|
510
|
+
x: "8",
|
|
511
|
+
y: "8",
|
|
512
|
+
width: "12",
|
|
513
|
+
height: "13",
|
|
514
|
+
rx: "2"
|
|
515
|
+
}, null, -1), s[1] ||= d("path", { d: "M16 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h3" }, null, -1)], 64))]))], 8, Me)) : l("", !0)])) : l("", !0)
|
|
516
|
+
]))), 128))])]), d("span", {
|
|
517
|
+
class: _(["fg-command-list__status", { "fg-site-sr-only": !O(a) }]),
|
|
518
|
+
role: "status"
|
|
519
|
+
}, D(m.value), 3)]));
|
|
180
520
|
}
|
|
181
521
|
});
|
|
182
522
|
//#endregion
|
|
183
|
-
export {
|
|
523
|
+
export { I as SITE_APPEARANCE_KEY, B as SITE_PROJECTS, we as UiCapture, Fe as UiCommandList, ae as UiSiteHeader, he as UiSiteNav, R as applySiteAppearance, ne as siteThemeBootScript, z as useSiteAppearance };
|