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