@filipgutica/ui 1.4.1 → 1.6.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 -1
- 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 +26 -0
- package/dist/site/UiSiteNav.vue.d.ts +21 -0
- package/dist/site/index.d.ts +6 -0
- package/dist/site/projects.d.ts +5 -0
- package/dist/site.js +390 -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 +284 -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, 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", te = `(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",
|
|
@@ -60,30 +61,36 @@ var y = "tool-site-theme", b = (e) => e === "system" || e === "light" || e === "
|
|
|
60
61
|
href: "https://filipgutica.github.io/t3code/",
|
|
61
62
|
repository: "https://github.com/filipgutica/t3code"
|
|
62
63
|
},
|
|
64
|
+
{
|
|
65
|
+
id: "filip-stack",
|
|
66
|
+
label: "Filip Stack",
|
|
67
|
+
href: "https://filipgutica.github.io/filip-stack/",
|
|
68
|
+
repository: "https://github.com/filipgutica/filip-stack"
|
|
69
|
+
},
|
|
63
70
|
{
|
|
64
71
|
id: "ui",
|
|
65
72
|
label: "UI",
|
|
66
73
|
href: "https://filipgutica.github.io/ui/",
|
|
67
74
|
repository: "https://github.com/filipgutica/ui"
|
|
68
75
|
}
|
|
69
|
-
],
|
|
76
|
+
], ne = { class: "fg-site-header" }, re = { class: "fg-site-header__inner" }, V = ["aria-label"], H = {
|
|
70
77
|
class: "fg-site-projects__menu fg-site-nav",
|
|
71
78
|
"aria-label": "Projects"
|
|
72
|
-
},
|
|
79
|
+
}, U = ["href", "aria-current"], W = { class: "fg-site-header__end" }, G = {
|
|
73
80
|
key: 0,
|
|
74
81
|
class: "fg-site-header__links",
|
|
75
82
|
"aria-label": "Site links"
|
|
76
|
-
},
|
|
83
|
+
}, K = ["href"], q = {
|
|
77
84
|
key: 0,
|
|
78
85
|
class: "fg-site-appearance",
|
|
79
86
|
role: "group",
|
|
80
87
|
"aria-label": "Color theme"
|
|
81
|
-
},
|
|
88
|
+
}, J = [
|
|
82
89
|
"aria-label",
|
|
83
90
|
"title",
|
|
84
91
|
"aria-pressed",
|
|
85
92
|
"onClick"
|
|
86
|
-
],
|
|
93
|
+
], Y = {
|
|
87
94
|
viewBox: "0 0 24 24",
|
|
88
95
|
width: "18",
|
|
89
96
|
height: "18",
|
|
@@ -91,17 +98,17 @@ var y = "tool-site-theme", b = (e) => e === "system" || e === "light" || e === "
|
|
|
91
98
|
stroke: "currentColor",
|
|
92
99
|
"stroke-width": "1.5",
|
|
93
100
|
"aria-hidden": "true"
|
|
94
|
-
},
|
|
101
|
+
}, X = {
|
|
95
102
|
key: 2,
|
|
96
103
|
d: "M20.5 13.5A9 9 0 0 1 10.5 3a9 9 0 1 0 10 10.5Z"
|
|
97
|
-
},
|
|
104
|
+
}, ie = /* @__PURE__ */ m({
|
|
98
105
|
__name: "UiSiteHeader",
|
|
99
106
|
props: {
|
|
100
107
|
project: {},
|
|
101
108
|
links: { default: () => [] }
|
|
102
109
|
},
|
|
103
|
-
setup(
|
|
104
|
-
let
|
|
110
|
+
setup(e) {
|
|
111
|
+
let t = [
|
|
105
112
|
{
|
|
106
113
|
value: "system",
|
|
107
114
|
label: "System"
|
|
@@ -114,29 +121,29 @@ var y = "tool-site-theme", b = (e) => e === "system" || e === "light" || e === "
|
|
|
114
121
|
value: "dark",
|
|
115
122
|
label: "Dark"
|
|
116
123
|
}
|
|
117
|
-
],
|
|
118
|
-
|
|
119
|
-
},
|
|
120
|
-
e.key !== "Escape" || !
|
|
121
|
-
},
|
|
122
|
-
e.relatedTarget instanceof Node && !
|
|
123
|
-
},
|
|
124
|
-
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();
|
|
125
132
|
};
|
|
126
|
-
return
|
|
127
|
-
|
|
128
|
-
}),
|
|
133
|
+
return b(() => {
|
|
134
|
+
i.value = !0, document.addEventListener("pointerdown", h);
|
|
135
|
+
}), y(() => document.removeEventListener("pointerdown", h)), (s, f) => (S(), u("header", ne, [d("div", re, [d("details", {
|
|
129
136
|
ref_key: "menu",
|
|
130
|
-
ref:
|
|
137
|
+
ref: a,
|
|
131
138
|
class: "fg-site-projects",
|
|
132
|
-
onKeydown:
|
|
133
|
-
onFocusout:
|
|
134
|
-
}, [
|
|
139
|
+
onKeydown: p,
|
|
140
|
+
onFocusout: m
|
|
141
|
+
}, [d("summary", {
|
|
135
142
|
ref_key: "trigger",
|
|
136
|
-
ref:
|
|
143
|
+
ref: c,
|
|
137
144
|
class: "fg-site-projects__trigger",
|
|
138
|
-
"aria-label": `Project: ${
|
|
139
|
-
}, [
|
|
145
|
+
"aria-label": `Project: ${n.value}`
|
|
146
|
+
}, [d("span", null, D(n.value), 1), f[0] ||= d("svg", {
|
|
140
147
|
class: "fg-site-projects__chevron",
|
|
141
148
|
viewBox: "0 0 16 16",
|
|
142
149
|
width: "16",
|
|
@@ -145,33 +152,357 @@ var y = "tool-site-theme", b = (e) => e === "system" || e === "light" || e === "
|
|
|
145
152
|
stroke: "currentColor",
|
|
146
153
|
"stroke-width": "1.5",
|
|
147
154
|
"aria-hidden": "true"
|
|
148
|
-
}, [
|
|
149
|
-
key:
|
|
150
|
-
href:
|
|
151
|
-
"aria-current":
|
|
152
|
-
},
|
|
155
|
+
}, [d("path", { d: "m4 6 4 4 4-4" })], -1)], 8, V), d("nav", H, [(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, U))), 128))])], 544), d("div", W, [e.links.length > 0 ? (S(), u("nav", G, [(S(!0), u(o, null, w(e.links, (e) => (S(), u("a", {
|
|
153
160
|
key: e.href,
|
|
154
161
|
href: e.href
|
|
155
|
-
},
|
|
156
|
-
key:
|
|
162
|
+
}, D(e.label), 9, K))), 128))])) : l("", !0), T(s.$slots, "default", {}, () => [i.value && O(r) ? (S(), u("div", q, [(S(), u(o, null, w(t, (e) => d("button", {
|
|
163
|
+
key: e.value,
|
|
157
164
|
type: "button",
|
|
158
165
|
class: "fg-site-appearance__choice",
|
|
159
|
-
"aria-label": `${
|
|
160
|
-
title: `${
|
|
161
|
-
"aria-pressed":
|
|
162
|
-
onClick: (
|
|
163
|
-
}, [(
|
|
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", Y, [e.value === "system" ? (S(), u(o, { key: 0 }, [f[1] ||= d("rect", {
|
|
164
171
|
x: "3",
|
|
165
172
|
y: "4",
|
|
166
173
|
width: "18",
|
|
167
174
|
height: "13",
|
|
168
175
|
rx: "2"
|
|
169
|
-
}, 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", {
|
|
170
177
|
cx: "12",
|
|
171
178
|
cy: "12",
|
|
172
179
|
r: "4"
|
|
173
|
-
}, 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", X))]))], 8, J)), 64))])) : l("", !0)])])])]));
|
|
181
|
+
}
|
|
182
|
+
}), ae = ["id"], oe = ["role", "aria-labelledby"], se = ["id"], ce = [
|
|
183
|
+
"href",
|
|
184
|
+
"aria-current",
|
|
185
|
+
"onClick"
|
|
186
|
+
], le = { 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, se)) : 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", le, D(e.label), 1)) : (S(), u(o, { key: 1 }, [f(D(e.label), 1)], 64))], 8, ce))), 128))], 8, oe))), 128))])], 8, ae));
|
|
221
|
+
}
|
|
222
|
+
}), ue = ["data-enhanced"], de = ["open"], fe = ["aria-controls"], pe = "(max-width: 800px)", me = /* @__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(pe), 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, fe), 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, de)) : (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, ue));
|
|
292
|
+
}
|
|
293
|
+
}), he = [
|
|
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, he));
|
|
330
|
+
}
|
|
331
|
+
}), ge = ["data-enhanced"], _e = ["id"], ve = { class: "fg-capture__preview" }, ye = [
|
|
332
|
+
"aria-label",
|
|
333
|
+
"title",
|
|
334
|
+
"onClick"
|
|
335
|
+
], be = {
|
|
336
|
+
key: 0,
|
|
337
|
+
class: "fg-capture__caption"
|
|
338
|
+
}, xe = { key: 0 }, Se = /* @__PURE__ */ m({
|
|
339
|
+
__name: "UiCapture",
|
|
340
|
+
props: /*@__PURE__*/ h({
|
|
341
|
+
items: {},
|
|
342
|
+
label: {},
|
|
343
|
+
idPrefix: { default: "frame-" }
|
|
344
|
+
}, {
|
|
345
|
+
modelValue: {},
|
|
346
|
+
modelModifiers: {}
|
|
347
|
+
}),
|
|
348
|
+
emits: ["update:modelValue"],
|
|
349
|
+
setup(e) {
|
|
350
|
+
let i = ee(e, "modelValue"), a = C(!1), m = s(() => e.items.map(({ id: e, label: t }) => ({
|
|
351
|
+
value: e,
|
|
352
|
+
label: t
|
|
353
|
+
}))), h = s(() => i.value ?? e.items[0]?.id ?? ""), _ = C(!1), v = E(), y, O = 0, k = 0, A = (e, t) => {
|
|
354
|
+
t.currentTarget instanceof HTMLElement && (y = t.currentTarget), v.value = e, _.value = !0;
|
|
355
|
+
}, j = (e) => {
|
|
356
|
+
y?.isConnected && (e.preventDefault(), y.focus({ preventScroll: !0 }));
|
|
357
|
+
}, N = () => {
|
|
358
|
+
try {
|
|
359
|
+
return document.getElementById(decodeURIComponent(location.hash.slice(1)));
|
|
360
|
+
} catch {
|
|
361
|
+
return null;
|
|
362
|
+
}
|
|
363
|
+
}, P = async () => {
|
|
364
|
+
await g(), cancelAnimationFrame(O), cancelAnimationFrame(k), O = requestAnimationFrame(() => {
|
|
365
|
+
k = requestAnimationFrame(() => N()?.scrollIntoView({
|
|
366
|
+
behavior: "instant",
|
|
367
|
+
block: "start"
|
|
368
|
+
}));
|
|
369
|
+
});
|
|
370
|
+
}, F = () => {
|
|
371
|
+
let t = N();
|
|
372
|
+
if (!t) return !1;
|
|
373
|
+
let n = e.items.find(({ id: n }) => document.getElementById(`${e.idPrefix}${n}`)?.contains(t));
|
|
374
|
+
return !n || h.value === n.id ? !1 : (i.value = n.id, !0);
|
|
375
|
+
}, I = () => {
|
|
376
|
+
F() && P();
|
|
377
|
+
};
|
|
378
|
+
return b(() => {
|
|
379
|
+
a.value = !0, F(), location.hash && P(), window.addEventListener("hashchange", I), window.addEventListener("popstate", I);
|
|
380
|
+
}), x(() => {
|
|
381
|
+
cancelAnimationFrame(O), cancelAnimationFrame(k), window.removeEventListener("hashchange", I), window.removeEventListener("popstate", I);
|
|
382
|
+
}), (s, g) => (S(), u("div", {
|
|
383
|
+
class: "fg-capture",
|
|
384
|
+
"data-enhanced": a.value
|
|
385
|
+
}, [p(n, {
|
|
386
|
+
"model-value": h.value,
|
|
387
|
+
items: m.value,
|
|
388
|
+
label: e.label,
|
|
389
|
+
"onUpdate:modelValue": g[0] ||= (e) => i.value = e
|
|
390
|
+
}, {
|
|
391
|
+
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", {
|
|
392
|
+
key: 0,
|
|
393
|
+
id: `${e.idPrefix}${n.id}`,
|
|
394
|
+
class: "fg-capture__figure"
|
|
395
|
+
}, [d("div", ve, [p(Q, {
|
|
396
|
+
html: n.html,
|
|
397
|
+
label: `Terminal capture: ${n.label}`,
|
|
398
|
+
fit: a.value
|
|
399
|
+
}, null, 8, [
|
|
400
|
+
"html",
|
|
401
|
+
"label",
|
|
402
|
+
"fit"
|
|
403
|
+
]), a.value ? (S(), u("button", {
|
|
404
|
+
key: 0,
|
|
405
|
+
type: "button",
|
|
406
|
+
class: "fg-capture__expand",
|
|
407
|
+
"aria-label": `Expand ${n.label} capture`,
|
|
408
|
+
"aria-haspopup": "dialog",
|
|
409
|
+
title: `Open ${n.label} capture at full size`,
|
|
410
|
+
onClick: (e) => A(n, e)
|
|
411
|
+
}, null, 8, ye)) : l("", !0)]), n.command || s.$slots.caption ? (S(), u("figcaption", be, [n.command ? (S(), u("code", xe, D(n.command), 1)) : l("", !0), T(s.$slots, "caption", { item: n })])) : l("", !0)], 8, _e)) : l("", !0)], 64))), 128))]),
|
|
412
|
+
_: 3
|
|
413
|
+
}, 8, [
|
|
414
|
+
"model-value",
|
|
415
|
+
"items",
|
|
416
|
+
"label"
|
|
417
|
+
]), p(t, {
|
|
418
|
+
open: _.value,
|
|
419
|
+
"onUpdate:open": g[2] ||= (e) => _.value = e,
|
|
420
|
+
title: `${v.value?.label ?? ""} capture`,
|
|
421
|
+
description: "Scroll to read the full capture.",
|
|
422
|
+
class: "fg-capture-viewer",
|
|
423
|
+
onCloseAutoFocus: j
|
|
424
|
+
}, {
|
|
425
|
+
footer: M(() => [p(r, {
|
|
426
|
+
variant: "secondary",
|
|
427
|
+
size: "lg",
|
|
428
|
+
onClick: g[1] ||= (e) => _.value = !1
|
|
429
|
+
}, {
|
|
430
|
+
default: M(() => [...g[3] ||= [f(" Close capture ", -1)]]),
|
|
431
|
+
_: 1
|
|
432
|
+
})]),
|
|
433
|
+
default: M(() => [v.value ? (S(), c(Q, {
|
|
434
|
+
key: 0,
|
|
435
|
+
html: v.value.html,
|
|
436
|
+
label: `${v.value.label} capture at full size`,
|
|
437
|
+
fit: !1
|
|
438
|
+
}, null, 8, ["html", "label"])) : l("", !0)]),
|
|
439
|
+
_: 1
|
|
440
|
+
}, 8, ["open", "title"])], 8, ge));
|
|
441
|
+
}
|
|
442
|
+
}), Ce = { class: "fg-command-list" }, we = { class: "fg-command-list__table" }, Te = { scope: "col" }, Ee = { scope: "col" }, De = { key: 0 }, $ = { class: "fg-command-list__command" }, Oe = { class: "fg-command-list__description" }, ke = {
|
|
443
|
+
key: 0,
|
|
444
|
+
class: "fg-command-list__action"
|
|
445
|
+
}, Ae = [
|
|
446
|
+
"disabled",
|
|
447
|
+
"aria-label",
|
|
448
|
+
"title",
|
|
449
|
+
"onClick"
|
|
450
|
+
], je = {
|
|
451
|
+
viewBox: "0 0 24 24",
|
|
452
|
+
fill: "none",
|
|
453
|
+
stroke: "currentColor",
|
|
454
|
+
"stroke-width": "1.5",
|
|
455
|
+
"aria-hidden": "true"
|
|
456
|
+
}, Me = {
|
|
457
|
+
key: 0,
|
|
458
|
+
d: "m5 12 4 4L19 6"
|
|
459
|
+
}, Ne = /* @__PURE__ */ m({
|
|
460
|
+
__name: "UiCommandList",
|
|
461
|
+
props: {
|
|
462
|
+
items: {},
|
|
463
|
+
copyable: {
|
|
464
|
+
type: Boolean,
|
|
465
|
+
default: !0
|
|
466
|
+
},
|
|
467
|
+
commandHeader: { default: "Command" },
|
|
468
|
+
descriptionHeader: { default: "What it does" }
|
|
469
|
+
},
|
|
470
|
+
setup(t) {
|
|
471
|
+
let n = C(!1);
|
|
472
|
+
b(() => {
|
|
473
|
+
n.value = !0;
|
|
474
|
+
});
|
|
475
|
+
let { copied: r, pending: i, error: a, copy: c } = e({
|
|
476
|
+
unavailableMessage: "Clipboard unavailable. Select the command to copy it.",
|
|
477
|
+
failureMessage: "Could not copy. Select the command to copy it."
|
|
478
|
+
}), p = C(""), m = s(() => a.value || (r.value ? `${p.value} copied to clipboard.` : "")), h = (e) => (p.value = e, c(e));
|
|
479
|
+
return (e, s) => (S(), u("div", Ce, [d("table", we, [d("thead", null, [d("tr", null, [
|
|
480
|
+
d("th", Te, D(t.commandHeader), 1),
|
|
481
|
+
d("th", Ee, D(t.descriptionHeader), 1),
|
|
482
|
+
t.copyable ? (S(), u("td", De)) : l("", !0)
|
|
483
|
+
])]), d("tbody", null, [(S(!0), u(o, null, w(t.items, (c) => (S(), u("tr", { key: c.command }, [
|
|
484
|
+
d("td", $, [d("code", null, D(c.command), 1)]),
|
|
485
|
+
d("td", Oe, [T(e.$slots, "description", { item: c }, () => [f(D(c.description), 1)])]),
|
|
486
|
+
t.copyable ? (S(), u("td", ke, [n.value ? (S(), u("button", {
|
|
487
|
+
key: 0,
|
|
488
|
+
type: "button",
|
|
489
|
+
class: "fg-command-list__copy",
|
|
490
|
+
disabled: O(i),
|
|
491
|
+
"aria-label": `Copy ${c.command}`,
|
|
492
|
+
title: `Copy ${c.command}`,
|
|
493
|
+
onClick: (e) => h(c.command)
|
|
494
|
+
}, [(S(), u("svg", je, [O(r) && !O(a) && p.value === c.command ? (S(), u("path", Me)) : (S(), u(o, { key: 1 }, [s[0] ||= d("rect", {
|
|
495
|
+
x: "8",
|
|
496
|
+
y: "8",
|
|
497
|
+
width: "12",
|
|
498
|
+
height: "13",
|
|
499
|
+
rx: "2"
|
|
500
|
+
}, 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, Ae)) : l("", !0)])) : l("", !0)
|
|
501
|
+
]))), 128))])]), d("span", {
|
|
502
|
+
class: _(["fg-command-list__status", { "fg-site-sr-only": !O(a) }]),
|
|
503
|
+
role: "status"
|
|
504
|
+
}, D(m.value), 3)]));
|
|
174
505
|
}
|
|
175
506
|
});
|
|
176
507
|
//#endregion
|
|
177
|
-
export {
|
|
508
|
+
export { I as SITE_APPEARANCE_KEY, B as SITE_PROJECTS, Se as UiCapture, Ne as UiCommandList, ie as UiSiteHeader, me as UiSiteNav, R as applySiteAppearance, te as siteThemeBootScript, z as useSiteAppearance };
|