@filipgutica/ui 1.11.2 → 1.12.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 +44 -6
- package/dist/index.js +54 -45
- package/dist/site.js +65 -62
- package/package.json +7 -3
- package/src/components.css +54 -26
- package/src/fonts/OFL-IBM-Plex-Mono.txt +93 -0
- package/src/fonts/OFL-IBM-Plex-Sans.txt +93 -0
- package/src/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
- package/src/fonts/ibm-plex-mono-latin-500-normal.woff2 +0 -0
- package/src/fonts/ibm-plex-mono-latin-600-normal.woff2 +0 -0
- package/src/fonts/ibm-plex-sans-latin-400-normal.woff2 +0 -0
- package/src/fonts/ibm-plex-sans-latin-500-normal.woff2 +0 -0
- package/src/fonts/ibm-plex-sans-latin-600-normal.woff2 +0 -0
- package/src/fonts.css +55 -0
- package/src/site.css +132 -50
- package/src/theme.css +118 -89
- package/src/themes/graphite-indigo.css +62 -44
package/README.md
CHANGED
|
@@ -32,8 +32,16 @@ Import the styles from your application stylesheet:
|
|
|
32
32
|
@import "@filipgutica/ui/components.css";
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
The third import adds Graphite Indigo
|
|
36
|
-
|
|
35
|
+
The third import adds Graphite Indigo's site typography and layout roles. Both
|
|
36
|
+
the base theme and Graphite Indigo use neutral surfaces, ink primary buttons,
|
|
37
|
+
and the ui project hue for checked and selected states.
|
|
38
|
+
|
|
39
|
+
`theme.css` loads the package's own IBM Plex Sans and IBM Plex Mono latin woff2
|
|
40
|
+
files (400, 500, 600), with `font-display: swap` and system fallbacks. It makes
|
|
41
|
+
no remote font requests. The files come from Fontsource 5.3.0 and ship under
|
|
42
|
+
their included [Sans OFL](src/fonts/OFL-IBM-Plex-Sans.txt) and
|
|
43
|
+
[Mono OFL](src/fonts/OFL-IBM-Plex-Mono.txt) licences. `fonts.css` and `fonts/*`
|
|
44
|
+
are also exported for applications that import assets separately.
|
|
37
45
|
|
|
38
46
|
## Use
|
|
39
47
|
|
|
@@ -176,15 +184,44 @@ import read from './captures/read.html?raw'
|
|
|
176
184
|
|
|
177
185
|
`UiSiteNav` renders a labelled list of route rows in optional `groups`. Links to
|
|
178
186
|
`#id` sections track the reader's position with `useActiveSection` and get
|
|
179
|
-
`aria-current="location"`, a
|
|
187
|
+
`aria-current="location"`, an accent bar without a fill. An item with
|
|
188
|
+
`current: true` gets
|
|
180
189
|
`aria-current="page"`, the selected fill and accent bar; `code: true` shows the
|
|
181
190
|
label in the monospace font. The page grid places the rail, which stays in view
|
|
182
191
|
on desktop. At 800px and below it is a native disclosure until the page is
|
|
183
192
|
interactive, then a drawer. The disclosure, the drawer button, and the drawer
|
|
184
|
-
title all show `label`.
|
|
185
|
-
|
|
193
|
+
title all show `label`. When an item has `current: true`, the phone control
|
|
194
|
+
also shows that page's name. Otherwise it shows the current section's name.
|
|
195
|
+
The control's accessible name is its visible text, so it changes with the
|
|
196
|
+
current page or section. The drawer closes on
|
|
197
|
+
navigation and focuses the destination section, and focus follows the visible control across the
|
|
186
198
|
breakpoint.
|
|
187
199
|
|
|
200
|
+
Project sites set `--color-project` on `:root` and `:root.dark` for their hue.
|
|
201
|
+
Set `--color-project-dark` to the dark variant in both appearances, so prompts
|
|
202
|
+
and capture tab underlines stay readable on terminal plates. The default hue
|
|
203
|
+
belongs to ui. Primary buttons stay ink on paper in both appearances.
|
|
204
|
+
|
|
205
|
+
Compact shell or plain-text `UiCodeBlock` rows and untitled shell blocks are
|
|
206
|
+
terminal commands. Their CSS prompt stays out of copied and accessible text.
|
|
207
|
+
Typed source samples, including compact samples, use theme-matched syntax wells.
|
|
208
|
+
Default blocks with a title are source samples, including shell scripts.
|
|
209
|
+
|
|
210
|
+
Use `.fg-site-hero` on a tool-home intro section. Its direct `h1` uses the
|
|
211
|
+
56px display size (34px on phones). Wrap the lede paragraphs in
|
|
212
|
+
`.fg-site-hero__lede`. Wrap the install block, metadata, and facts in
|
|
213
|
+
`.fg-site-hero__aside`; use `.fg-site-meta` for the install label above the code.
|
|
214
|
+
|
|
215
|
+
At 1024px and above, the hero uses `minmax(0, 1.1fr) minmax(0, 1fr)` columns,
|
|
216
|
+
`var(--space-8)` between columns, and top alignment. The `h1` spans both columns
|
|
217
|
+
in row 1. The lede and aside occupy columns 1 and 2 in row 2. All other children,
|
|
218
|
+
including captures and legends, span both columns afterward in source order.
|
|
219
|
+
Below 1024px all children stack in source order. Explicit grid lines and
|
|
220
|
+
`grid-auto-columns: minmax(0, 1fr)` preserve the split if an unlayered site rule
|
|
221
|
+
overrides the column template. Remove that override to retain the 1.1:1 ratio.
|
|
222
|
+
This is the wide exception to the phone/tablet breakpoints; the separate
|
|
223
|
+
design-language update records it in `DESIGN.md`.
|
|
224
|
+
|
|
188
225
|
`UiCapture` shows one panel: tabs in the header, the capture scaled to the panel
|
|
189
226
|
width, and the `command` and `caption` slot below. `html` is trusted, checked-in
|
|
190
227
|
terminal markup with a single root element. The Full size button at the end of
|
|
@@ -208,7 +245,8 @@ the clipboard is unavailable. At 640px and below each command stacks above its
|
|
|
208
245
|
description and wraps.
|
|
209
246
|
|
|
210
247
|
`site.css` also includes page helpers: `.fg-site-steps` for an ordered list with
|
|
211
|
-
numbered
|
|
248
|
+
numbered markers (each `li` holds an `h3` title and short paragraphs; mark the last
|
|
249
|
+
step's outcome with `.fg-site-steps__result`), `.fg-site-facts` for an inline `dl` of short label and value
|
|
212
250
|
pairs whose links get a `--control-lg` hit area at 640px and below,
|
|
213
251
|
`.fg-site-definitions` for a two-column `dl` of `dt` and `dd` that stacks on
|
|
214
252
|
phones and keeps `code` such as `--all` on one line, `.fg-site-sr-only` for
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as e, i as t, n, o as r, r as i, t as a } from "./use-active-section-DCS_wyYq.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, inject as h, mergeModels as g, mergeProps as _, normalizeStyle as v, openBlock as y, provide as b, ref as ee, renderList as x, renderSlot as S, resolveDynamicComponent as C, shallowRef as te, toDisplayString as w, unref as T, useId as E, useModel as
|
|
3
|
-
import { CheckboxIndicator as
|
|
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, inject as h, mergeModels as g, mergeProps as _, normalizeStyle as v, openBlock as y, provide as b, ref as ee, renderList as x, renderSlot as S, resolveDynamicComponent as C, shallowRef as te, toDisplayString as w, unref as T, useId as E, useModel as D, useSlots as O, watch as ne, withCtx as k } from "vue";
|
|
3
|
+
import { CheckboxIndicator as re, CheckboxRoot as A, Primitive as j, ProgressIndicator as M, ProgressRoot as N, RadioGroupItem as P, RadioGroupRoot as F, SliderRange as I, SliderRoot as L, SliderThumb as R, SliderTrack as z, Toggle as B } from "reka-ui";
|
|
4
4
|
//#region src/components/UiCard.vue?vue&type=script&setup=true&lang.ts
|
|
5
5
|
var V = { class: "fg-card" }, H = {
|
|
6
6
|
key: 0,
|
|
@@ -21,13 +21,13 @@ var V = { class: "fg-card" }, H = {
|
|
|
21
21
|
titleTag: { default: "h3" }
|
|
22
22
|
},
|
|
23
23
|
setup(e) {
|
|
24
|
-
let t =
|
|
24
|
+
let t = O();
|
|
25
25
|
return (n, r) => (y(), u("div", V, [
|
|
26
26
|
e.title || t.title || t.actions ? (y(), u("header", H, [e.title || t.title ? (y(), c(C(e.titleTag), {
|
|
27
27
|
key: 0,
|
|
28
28
|
class: "fg-card__title"
|
|
29
29
|
}, {
|
|
30
|
-
default:
|
|
30
|
+
default: k(() => [S(n.$slots, "title", {}, () => [f(w(e.title), 1)])]),
|
|
31
31
|
_: 3
|
|
32
32
|
})) : l("", !0), t.actions ? (y(), u("div", U, [S(n.$slots, "actions")])) : l("", !0)])) : l("", !0),
|
|
33
33
|
t.default ? (y(), u("div", W, [S(n.$slots, "default")])) : l("", !0),
|
|
@@ -35,6 +35,7 @@ var V = { class: "fg-card" }, H = {
|
|
|
35
35
|
]));
|
|
36
36
|
}
|
|
37
37
|
}), q = [
|
|
38
|
+
"data-command",
|
|
38
39
|
"data-wrap",
|
|
39
40
|
"data-line-numbers",
|
|
40
41
|
"data-variant"
|
|
@@ -81,7 +82,14 @@ var V = { class: "fg-card" }, H = {
|
|
|
81
82
|
variant: { default: "default" }
|
|
82
83
|
},
|
|
83
84
|
setup(t) {
|
|
84
|
-
let n =
|
|
85
|
+
let n = s(() => {
|
|
86
|
+
let e = t.language.trim().toLowerCase(), n = [
|
|
87
|
+
"bash",
|
|
88
|
+
"sh",
|
|
89
|
+
"shell"
|
|
90
|
+
].includes(e);
|
|
91
|
+
return t.variant === "compact" ? n || e === "text" : n && !t.title;
|
|
92
|
+
}), r = te(), i = ee(""), a = s(() => r.value ?? t.code.split("\n").map((e) => [{ content: e }])), c = {
|
|
85
93
|
vue: "vue",
|
|
86
94
|
ts: "typescript",
|
|
87
95
|
typescript: "typescript",
|
|
@@ -94,35 +102,36 @@ var V = { class: "fg-card" }, H = {
|
|
|
94
102
|
sh: "bash",
|
|
95
103
|
shell: "bash"
|
|
96
104
|
};
|
|
97
|
-
|
|
98
|
-
let
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}),
|
|
102
|
-
let
|
|
105
|
+
ne(() => [t.code, t.language], async ([e, t], n, a) => {
|
|
106
|
+
let o = !1;
|
|
107
|
+
a(() => {
|
|
108
|
+
o = !0;
|
|
109
|
+
}), r.value = void 0, i.value = "";
|
|
110
|
+
let s = t.trim().toLowerCase(), l = Object.hasOwn(c, s) ? c[s] : void 0;
|
|
103
111
|
if (l) try {
|
|
104
112
|
let { highlightCode: t } = await import("./code-highlight-BuTmXL3w.js");
|
|
105
|
-
if (
|
|
106
|
-
let
|
|
113
|
+
if (o) return;
|
|
114
|
+
let n = await t({
|
|
107
115
|
code: e,
|
|
108
116
|
language: l
|
|
109
117
|
});
|
|
110
|
-
if (
|
|
118
|
+
if (o) return;
|
|
111
119
|
let i = e.split("\n");
|
|
112
|
-
|
|
113
|
-
let
|
|
114
|
-
return e.endsWith("\r") ? [...
|
|
120
|
+
r.value = i.map((e, t) => {
|
|
121
|
+
let r = n[t] ?? [];
|
|
122
|
+
return e.endsWith("\r") ? [...r, { content: "\r" }] : r;
|
|
115
123
|
});
|
|
116
124
|
} catch {
|
|
117
|
-
|
|
125
|
+
o || (i.value = "Syntax highlighting unavailable. Showing plain text.");
|
|
118
126
|
}
|
|
119
127
|
}, { immediate: !0 });
|
|
120
|
-
let { copied:
|
|
128
|
+
let { copied: p, pending: m, error: h, copy: g } = e({
|
|
121
129
|
unavailableMessage: "Clipboard unavailable. Select the code to copy it.",
|
|
122
130
|
failureMessage: "Could not copy. Select the code to copy it."
|
|
123
|
-
}),
|
|
124
|
-
return (e,
|
|
131
|
+
}), _ = s(() => p.value && !h.value), b = s(() => t.variant === "compact" && _.value && !i.value), C = s(() => h.value ? h.value : t.variant === "compact" && i.value ? p.value ? `Code copied to clipboard. ${i.value}` : i.value : p.value ? "Code copied to clipboard." : i.value), E = () => g(t.code);
|
|
132
|
+
return (e, r) => (y(), u("div", {
|
|
125
133
|
class: "fg-code-block",
|
|
134
|
+
"data-command": n.value || void 0,
|
|
126
135
|
"data-wrap": t.wrap,
|
|
127
136
|
"data-line-numbers": t.lineNumbers,
|
|
128
137
|
"data-variant": t.variant
|
|
@@ -134,34 +143,34 @@ var V = { class: "fg-card" }, H = {
|
|
|
134
143
|
key: 0,
|
|
135
144
|
type: "button",
|
|
136
145
|
class: "fg-code-block__copy",
|
|
137
|
-
disabled: T(
|
|
146
|
+
disabled: T(m),
|
|
138
147
|
"aria-label": "Copy code",
|
|
139
|
-
title: t.variant === "compact" ?
|
|
140
|
-
onClick:
|
|
141
|
-
}, [(y(), u("svg", oe, [t.variant === "compact" &&
|
|
148
|
+
title: t.variant === "compact" ? _.value ? "Copied" : "Copy code" : void 0,
|
|
149
|
+
onClick: E
|
|
150
|
+
}, [(y(), u("svg", oe, [t.variant === "compact" && _.value ? (y(), u("path", se)) : (y(), u(o, { key: 1 }, [r[0] ||= d("rect", {
|
|
142
151
|
x: "8",
|
|
143
152
|
y: "8",
|
|
144
153
|
width: "12",
|
|
145
154
|
height: "13",
|
|
146
155
|
rx: "2"
|
|
147
|
-
}, null, -1),
|
|
156
|
+
}, null, -1), r[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))])), t.variant === "default" ? (y(), u("span", ce, w(_.value ? "Copied" : "Copy"), 1)) : l("", !0)], 8, ae)) : l("", !0)])
|
|
148
157
|
])) : l("", !0),
|
|
149
158
|
d("pre", {
|
|
150
159
|
class: "fg-code-block__pre",
|
|
151
160
|
tabindex: "0",
|
|
152
161
|
"aria-label": t.title || `${t.language} code`
|
|
153
|
-
}, [d("code", null, [(y(!0), u(o, null, x(
|
|
162
|
+
}, [d("code", null, [(y(!0), u(o, null, x(a.value, (e, n) => (y(), u("span", {
|
|
154
163
|
key: n,
|
|
155
164
|
class: "fg-code-block__line"
|
|
156
165
|
}, [t.lineNumbers ? (y(), u("span", ue, w(n + 1), 1)) : l("", !0), d("span", de, [(y(!0), u(o, null, x(e, (e, t) => (y(), u("span", {
|
|
157
166
|
key: t,
|
|
158
167
|
style: v({ color: e.color })
|
|
159
|
-
}, w(e.content), 5))), 128)), f(w(n <
|
|
168
|
+
}, w(e.content), 5))), 128)), f(w(n < a.value.length - 1 ? "\n" : ""), 1)])]))), 128))])], 8, le),
|
|
160
169
|
d("span", {
|
|
161
170
|
class: "fg-code-block__status",
|
|
162
171
|
role: "status",
|
|
163
|
-
"data-state":
|
|
164
|
-
}, w(
|
|
172
|
+
"data-state": b.value ? "success" : void 0
|
|
173
|
+
}, w(C.value), 9, fe)
|
|
165
174
|
], 8, q));
|
|
166
175
|
}
|
|
167
176
|
}), me = /* @__PURE__ */ m({
|
|
@@ -174,7 +183,7 @@ var V = { class: "fg-card" }, H = {
|
|
|
174
183
|
"data-tone": e.tone,
|
|
175
184
|
role: e.tone === "danger" || e.tone === "error" ? "alert" : "status"
|
|
176
185
|
}, {
|
|
177
|
-
default:
|
|
186
|
+
default: k(() => [S(t.$slots, "default")]),
|
|
178
187
|
_: 3
|
|
179
188
|
}, 8, ["data-tone", "role"]));
|
|
180
189
|
}
|
|
@@ -187,7 +196,7 @@ var V = { class: "fg-card" }, H = {
|
|
|
187
196
|
class: "fg-badge",
|
|
188
197
|
"data-tone": e.tone
|
|
189
198
|
}, {
|
|
190
|
-
default:
|
|
199
|
+
default: k(() => [S(t.$slots, "default")]),
|
|
191
200
|
_: 3
|
|
192
201
|
}, 8, ["data-tone"]));
|
|
193
202
|
}
|
|
@@ -219,8 +228,8 @@ var V = { class: "fg-card" }, H = {
|
|
|
219
228
|
"model-value": e.modelValue,
|
|
220
229
|
"onUpdate:modelValue": r
|
|
221
230
|
}, {
|
|
222
|
-
default:
|
|
223
|
-
default:
|
|
231
|
+
default: k(() => [p(T(re), { class: "fg-checkbox__indicator" }, {
|
|
232
|
+
default: k(() => [...n[0] ||= [f("✓", -1)]]),
|
|
224
233
|
_: 1
|
|
225
234
|
})]),
|
|
226
235
|
_: 1
|
|
@@ -274,7 +283,7 @@ var V = { class: "fg-card" }, H = {
|
|
|
274
283
|
__name: "UiFigure",
|
|
275
284
|
props: { number: { default: () => void 0 } },
|
|
276
285
|
setup(e) {
|
|
277
|
-
let t =
|
|
286
|
+
let t = O(), n = E(), r = () => e.number !== void 0 || !!t.caption;
|
|
278
287
|
return (t, i) => (y(), u("figure", we, [d("div", {
|
|
279
288
|
class: "fg-figure__plate",
|
|
280
289
|
role: "region",
|
|
@@ -356,7 +365,7 @@ var V = { class: "fg-card" }, H = {
|
|
|
356
365
|
max: t.value.max,
|
|
357
366
|
"model-value": t.value.value
|
|
358
367
|
}, {
|
|
359
|
-
default:
|
|
368
|
+
default: k(() => [p(T(M), {
|
|
360
369
|
class: "fg-progress__indicator",
|
|
361
370
|
style: v({ transform: `translateX(-${100 - n.value}%)` })
|
|
362
371
|
}, null, 8, ["style"])]),
|
|
@@ -382,7 +391,7 @@ var V = { class: "fg-card" }, H = {
|
|
|
382
391
|
disabled: e.disabled,
|
|
383
392
|
value: e.value
|
|
384
393
|
}, {
|
|
385
|
-
default:
|
|
394
|
+
default: k(() => [n[0] ||= d("span", {
|
|
386
395
|
class: "fg-radio-card__indicator",
|
|
387
396
|
"aria-hidden": "true"
|
|
388
397
|
}, null, -1), d("span", Me, [S(t.$slots, "default")])]),
|
|
@@ -407,7 +416,7 @@ var V = { class: "fg-card" }, H = {
|
|
|
407
416
|
}),
|
|
408
417
|
emits: ["update:modelValue"],
|
|
409
418
|
setup(e) {
|
|
410
|
-
let t =
|
|
419
|
+
let t = D(e, "modelValue"), n = (t) => {
|
|
411
420
|
if (t.altKey || t.ctrlKey || t.metaKey || t.shiftKey) return;
|
|
412
421
|
let n = t.currentTarget, r = t.target;
|
|
413
422
|
if (!(n instanceof HTMLElement) || !(r instanceof HTMLElement)) return;
|
|
@@ -430,7 +439,7 @@ var V = { class: "fg-card" }, H = {
|
|
|
430
439
|
disabled: e.disabled,
|
|
431
440
|
loop: e.loop
|
|
432
441
|
}, e.orientation === void 0 ? {} : { orientation: e.orientation }, { onKeydown: n }), {
|
|
433
|
-
default:
|
|
442
|
+
default: k(() => [S(r.$slots, "default")]),
|
|
434
443
|
_: 3
|
|
435
444
|
}, 16, [
|
|
436
445
|
"modelValue",
|
|
@@ -493,7 +502,7 @@ var V = { class: "fg-card" }, H = {
|
|
|
493
502
|
value: e.modelValue,
|
|
494
503
|
onChange: i
|
|
495
504
|
}, {
|
|
496
|
-
default:
|
|
505
|
+
default: k(() => [S(t.$slots, "default")]),
|
|
497
506
|
_: 3
|
|
498
507
|
}, 8, [
|
|
499
508
|
"id",
|
|
@@ -548,8 +557,8 @@ var V = { class: "fg-card" }, H = {
|
|
|
548
557
|
min: r.value.min,
|
|
549
558
|
step: r.value.step
|
|
550
559
|
}, {
|
|
551
|
-
default:
|
|
552
|
-
default:
|
|
560
|
+
default: k(() => [p(T(z), { class: "fg-slider__track" }, {
|
|
561
|
+
default: k(() => [p(T(I), { class: "fg-slider__range" })]),
|
|
553
562
|
_: 1
|
|
554
563
|
}), p(T(R), {
|
|
555
564
|
id: T(n)?.controlId.value ?? e.id,
|
|
@@ -593,7 +602,7 @@ var V = { class: "fg-card" }, H = {
|
|
|
593
602
|
},
|
|
594
603
|
emits: ["update:pressed"],
|
|
595
604
|
setup(e, { emit: t }) {
|
|
596
|
-
let n = t, r =
|
|
605
|
+
let n = t, r = O(), i = (e) => {
|
|
597
606
|
n("update:pressed", e);
|
|
598
607
|
};
|
|
599
608
|
return (t, n) => (y(), c(T(B), {
|
|
@@ -603,7 +612,7 @@ var V = { class: "fg-card" }, H = {
|
|
|
603
612
|
"model-value": e.pressed,
|
|
604
613
|
"onUpdate:modelValue": i
|
|
605
614
|
}, {
|
|
606
|
-
default:
|
|
615
|
+
default: k(() => [n[0] ||= d("span", {
|
|
607
616
|
class: "fg-toggle-button__switch",
|
|
608
617
|
"aria-hidden": "true"
|
|
609
618
|
}, null, -1), d("span", He, [d("span", Ue, [S(t.$slots, "default")]), r.description ? (y(), u("span", We, [S(t.$slots, "description")])) : l("", !0)])]),
|
|
@@ -626,7 +635,7 @@ var V = { class: "fg-card" }, H = {
|
|
|
626
635
|
class: "fg-surface",
|
|
627
636
|
"data-padding": e.padding
|
|
628
637
|
}, {
|
|
629
|
-
default:
|
|
638
|
+
default: k(() => [S(t.$slots, "default")]),
|
|
630
639
|
_: 3
|
|
631
640
|
}, 8, ["as", "data-padding"]));
|
|
632
641
|
}
|
package/dist/site.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { a as e, i as t, n, o as r, r as i, t as a } from "./use-active-section-DCS_wyYq.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
|
|
3
|
-
import { tryOnMounted as
|
|
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 A, useSlots as j, useTemplateRef as M, watch as N, withCtx as P } from "vue";
|
|
3
|
+
import { tryOnMounted as F, usePreferredDark as I, useStorage as L } from "@vueuse/core";
|
|
4
4
|
//#region src/site/appearance.ts
|
|
5
|
-
var
|
|
5
|
+
var R = "tool-site-theme", z = (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('${R}'); } 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
|
+
})();`, B = ({ 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
|
+
}, V = ({ applyToRoot: e = !0 } = {}) => {
|
|
17
|
+
let t = L(R, "system", void 0, {
|
|
18
18
|
initOnMounted: !0,
|
|
19
19
|
writeDefaults: !1,
|
|
20
20
|
onError: () => {},
|
|
21
21
|
serializer: {
|
|
22
|
-
read: (e) =>
|
|
22
|
+
read: (e) => z(e) ? e : "system",
|
|
23
23
|
write: (e) => e
|
|
24
24
|
}
|
|
25
|
-
}), n =
|
|
26
|
-
return e &&
|
|
27
|
-
|
|
25
|
+
}), n = I(), r = s(() => t.value), i = s(() => t.value === "system" ? n.value ? "dark" : "light" : t.value);
|
|
26
|
+
return e && F(() => {
|
|
27
|
+
N([r, i], () => B({
|
|
28
28
|
root: document.documentElement,
|
|
29
29
|
choice: r.value,
|
|
30
30
|
appearance: i.value
|
|
@@ -33,10 +33,10 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
|
|
|
33
33
|
choice: r,
|
|
34
34
|
appearance: i,
|
|
35
35
|
chooseAppearance: (e) => {
|
|
36
|
-
|
|
36
|
+
z(e) && (t.value = e);
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
},
|
|
39
|
+
}, H = [
|
|
40
40
|
{
|
|
41
41
|
id: "annoterm",
|
|
42
42
|
label: "annoterm",
|
|
@@ -73,7 +73,7 @@ var I = "tool-site-theme", L = (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
|
-
],
|
|
76
|
+
], te = { class: "fg-site-header" }, ne = { class: "fg-site-header__inner" }, re = ["aria-label"], ie = {
|
|
77
77
|
class: "fg-site-projects__menu fg-site-nav",
|
|
78
78
|
"aria-label": "Projects"
|
|
79
79
|
}, U = ["href", "aria-current"], W = { class: "fg-site-header__end" }, G = {
|
|
@@ -121,7 +121,7 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
|
|
|
121
121
|
value: "dark",
|
|
122
122
|
label: "Dark"
|
|
123
123
|
}
|
|
124
|
-
], n = s(() =>
|
|
124
|
+
], n = s(() => H.find(({ id: t }) => t === e.project)?.label ?? e.project), r = j().default ? void 0 : V(), i = C(!1), a = C(), c = C(), f = () => {
|
|
125
125
|
a.value && (a.value.open = !1);
|
|
126
126
|
}, p = (e) => {
|
|
127
127
|
e.key !== "Escape" || !a.value?.open || (f(), c.value?.focus());
|
|
@@ -132,7 +132,7 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
|
|
|
132
132
|
};
|
|
133
133
|
return b(() => {
|
|
134
134
|
i.value = !0, document.addEventListener("pointerdown", h);
|
|
135
|
-
}), y(() => document.removeEventListener("pointerdown", h)), (s, f) => (S(), u("header",
|
|
135
|
+
}), y(() => document.removeEventListener("pointerdown", h)), (s, f) => (S(), u("header", te, [d("div", ne, [d("details", {
|
|
136
136
|
ref_key: "menu",
|
|
137
137
|
ref: a,
|
|
138
138
|
class: "fg-site-projects",
|
|
@@ -152,7 +152,7 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
|
|
|
152
152
|
stroke: "currentColor",
|
|
153
153
|
"stroke-width": "1.5",
|
|
154
154
|
"aria-hidden": "true"
|
|
155
|
-
}, [d("path", { d: "m4 6 4 4 4-4" })], -1)], 8,
|
|
155
|
+
}, [d("path", { d: "m4 6 4 4 4-4" })], -1)], 8, re), d("nav", ie, [(S(!0), u(o, null, w(O(H), (t) => (S(), u("a", {
|
|
156
156
|
key: t.id,
|
|
157
157
|
href: t.href,
|
|
158
158
|
"aria-current": t.id === e.project ? "page" : void 0
|
|
@@ -226,35 +226,38 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
|
|
|
226
226
|
groups: {}
|
|
227
227
|
},
|
|
228
228
|
setup(e) {
|
|
229
|
-
let t = k(), n = C(), o = C(!1),
|
|
229
|
+
let t = k(), n = C(), o = C(!1), l = C(!1), m = C(!1), h = a({ targetIds: e.groups.flatMap((e) => e.items).flatMap(({ href: e }) => e.startsWith("#") && e.length > 1 ? [e.slice(1)] : []) }), _ = s(() => e.groups.flatMap((e) => e.items).find((e) => e.current)?.label), v = s(() => e.groups.flatMap((e) => e.items).find((e) => e.href === `#${h.value}`)?.label), y = s(() => {
|
|
230
|
+
let t = _.value ?? v.value;
|
|
231
|
+
return t ? `${e.label}: ${t}` : e.label;
|
|
232
|
+
}), w, T = null, E = () => n.value?.querySelector("button.fg-site-rail__toggle"), A = () => {
|
|
230
233
|
g(() => n.value?.querySelector(".fg-site-nav a")?.focus({ preventScroll: !0 }));
|
|
231
|
-
},
|
|
232
|
-
let e =
|
|
233
|
-
|
|
234
|
-
},
|
|
235
|
-
!
|
|
236
|
-
},
|
|
237
|
-
|
|
234
|
+
}, j = () => {
|
|
235
|
+
let e = w?.matches && !l.value && n.value?.contains(document.activeElement), t = w?.matches === !1 && l.value && !m.value && E() === document.activeElement;
|
|
236
|
+
l.value = w?.matches === !0, l.value || (m.value = !1), e ? g(() => E()?.focus({ preventScroll: !0 })) : t && A();
|
|
237
|
+
}, M = (e, t) => {
|
|
238
|
+
!m.value || t.button !== 0 || t.metaKey || t.ctrlKey || t.altKey || t.shiftKey || (T = e.startsWith("#") ? document.getElementById(e.slice(1)) : null, m.value = !1);
|
|
239
|
+
}, N = (e) => {
|
|
240
|
+
T ? (e.preventDefault(), T.tabIndex = -1, T.focus({ preventScroll: !0 }), T = null) : l.value || (e.preventDefault(), A());
|
|
238
241
|
};
|
|
239
242
|
return b(() => {
|
|
240
|
-
|
|
241
|
-
}), x(() =>
|
|
243
|
+
w = matchMedia(he), j(), o.value = !0, w.addEventListener("change", j);
|
|
244
|
+
}), x(() => w?.removeEventListener("change", j)), (a, s) => (S(), u("div", {
|
|
242
245
|
ref_key: "root",
|
|
243
246
|
ref: n,
|
|
244
247
|
class: "fg-site-rail",
|
|
245
248
|
"data-enhanced": o.value
|
|
246
|
-
}, [!o.value || !
|
|
249
|
+
}, [!o.value || !l.value ? (S(), u("details", {
|
|
247
250
|
key: 0,
|
|
248
251
|
class: "fg-site-rail__menu",
|
|
249
|
-
open: o.value && !
|
|
252
|
+
open: o.value && !l.value
|
|
250
253
|
}, [d("summary", {
|
|
251
254
|
class: "fg-site-rail__summary",
|
|
252
255
|
"aria-controls": O(t)
|
|
253
|
-
}, D(
|
|
256
|
+
}, D(y.value), 9, me), p(X, {
|
|
254
257
|
"content-id": O(t),
|
|
255
258
|
label: e.label,
|
|
256
259
|
groups: e.groups,
|
|
257
|
-
"active-id": O(
|
|
260
|
+
"active-id": O(h)
|
|
258
261
|
}, null, 8, [
|
|
259
262
|
"content-id",
|
|
260
263
|
"label",
|
|
@@ -262,25 +265,25 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
|
|
|
262
265
|
"active-id"
|
|
263
266
|
])], 8, pe)) : (S(), c(i, {
|
|
264
267
|
key: 1,
|
|
265
|
-
open:
|
|
266
|
-
"onUpdate:open":
|
|
268
|
+
open: m.value,
|
|
269
|
+
"onUpdate:open": s[0] ||= (e) => m.value = e,
|
|
267
270
|
title: e.label,
|
|
268
|
-
onCloseAutoFocus:
|
|
271
|
+
onCloseAutoFocus: N
|
|
269
272
|
}, {
|
|
270
|
-
trigger:
|
|
273
|
+
trigger: P(() => [p(r, {
|
|
271
274
|
variant: "ghost",
|
|
272
275
|
size: "lg",
|
|
273
276
|
class: "fg-site-rail__toggle"
|
|
274
277
|
}, {
|
|
275
|
-
default:
|
|
278
|
+
default: P(() => [f(D(y.value), 1)]),
|
|
276
279
|
_: 1
|
|
277
280
|
})]),
|
|
278
|
-
default:
|
|
281
|
+
default: P(() => [p(X, {
|
|
279
282
|
"content-id": O(t),
|
|
280
283
|
label: e.label,
|
|
281
284
|
groups: e.groups,
|
|
282
|
-
"active-id": O(
|
|
283
|
-
onNavigate:
|
|
285
|
+
"active-id": O(h),
|
|
286
|
+
onNavigate: M
|
|
284
287
|
}, null, 8, [
|
|
285
288
|
"content-id",
|
|
286
289
|
"label",
|
|
@@ -313,7 +316,7 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
|
|
|
313
316
|
let o = Math.min(1, i.clientWidth / a.offsetWidth);
|
|
314
317
|
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;
|
|
315
318
|
};
|
|
316
|
-
return
|
|
319
|
+
return N(() => [e.fit, e.html], o, { flush: "post" }), b(() => {
|
|
317
320
|
typeof ResizeObserver < "u" && (a = new ResizeObserver(o), t.value && a.observe(t.value)), o();
|
|
318
321
|
}), x(() => a?.disconnect()), (a, o) => (S(), u("div", {
|
|
319
322
|
ref_key: "container",
|
|
@@ -345,38 +348,38 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
|
|
|
345
348
|
}),
|
|
346
349
|
emits: ["update:modelValue"],
|
|
347
350
|
setup(e) {
|
|
348
|
-
let i =
|
|
351
|
+
let i = A(e, "modelValue"), a = C(!1), m = s(() => e.items.map(({ id: e, label: t }) => ({
|
|
349
352
|
value: e,
|
|
350
353
|
label: t
|
|
351
|
-
}))), 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,
|
|
354
|
+
}))), 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, j = M("fullSizeButton"), N = (e) => {
|
|
352
355
|
y.value = e, v.value = !0;
|
|
353
|
-
},
|
|
354
|
-
|
|
355
|
-
},
|
|
356
|
+
}, F = (e) => {
|
|
357
|
+
j.value?.isConnected && (e.preventDefault(), j.value.focus({ preventScroll: !0 }));
|
|
358
|
+
}, I = () => {
|
|
356
359
|
try {
|
|
357
360
|
return document.getElementById(decodeURIComponent(location.hash.slice(1)));
|
|
358
361
|
} catch {
|
|
359
362
|
return null;
|
|
360
363
|
}
|
|
361
|
-
},
|
|
364
|
+
}, L = async () => {
|
|
362
365
|
await g(), cancelAnimationFrame(O), cancelAnimationFrame(k), O = requestAnimationFrame(() => {
|
|
363
|
-
k = requestAnimationFrame(() =>
|
|
366
|
+
k = requestAnimationFrame(() => I()?.scrollIntoView({
|
|
364
367
|
behavior: "instant",
|
|
365
368
|
block: "start"
|
|
366
369
|
}));
|
|
367
370
|
});
|
|
368
|
-
},
|
|
369
|
-
let t =
|
|
371
|
+
}, R = () => {
|
|
372
|
+
let t = I();
|
|
370
373
|
if (!t) return !1;
|
|
371
374
|
let n = e.items.find(({ id: n }) => document.getElementById(`${e.idPrefix}${n}`)?.contains(t));
|
|
372
375
|
return !n || h.value === n.id ? !1 : (i.value = n.id, !0);
|
|
373
|
-
},
|
|
374
|
-
|
|
376
|
+
}, z = () => {
|
|
377
|
+
R() && L();
|
|
375
378
|
};
|
|
376
379
|
return b(() => {
|
|
377
|
-
a.value = !0,
|
|
380
|
+
a.value = !0, R(), location.hash && L(), window.addEventListener("hashchange", z), window.addEventListener("popstate", z);
|
|
378
381
|
}), x(() => {
|
|
379
|
-
cancelAnimationFrame(O), cancelAnimationFrame(k), window.removeEventListener("hashchange",
|
|
382
|
+
cancelAnimationFrame(O), cancelAnimationFrame(k), window.removeEventListener("hashchange", z), window.removeEventListener("popstate", z);
|
|
380
383
|
}), (s, g) => (S(), u("div", {
|
|
381
384
|
class: "fg-capture",
|
|
382
385
|
"data-enhanced": a.value
|
|
@@ -384,12 +387,12 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
|
|
|
384
387
|
a.value && _.value ? (S(), u("button", {
|
|
385
388
|
key: 0,
|
|
386
389
|
ref_key: "fullSizeButton",
|
|
387
|
-
ref:
|
|
390
|
+
ref: j,
|
|
388
391
|
type: "button",
|
|
389
392
|
class: "fg-capture__full",
|
|
390
393
|
"aria-label": `Expand ${_.value.label} capture at full size`,
|
|
391
394
|
"aria-haspopup": "dialog",
|
|
392
|
-
onClick: g[0] ||= (e) =>
|
|
395
|
+
onClick: g[0] ||= (e) => N(_.value)
|
|
393
396
|
}, [...g[4] ||= [d("svg", {
|
|
394
397
|
viewBox: "0 0 24 24",
|
|
395
398
|
fill: "none",
|
|
@@ -403,7 +406,7 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
|
|
|
403
406
|
label: e.label,
|
|
404
407
|
"onUpdate:modelValue": g[1] ||= (e) => i.value = e
|
|
405
408
|
}, {
|
|
406
|
-
panel:
|
|
409
|
+
panel: P(({ value: t }) => [(S(!0), u(o, null, w(e.items, (n) => (S(), u(o, { key: n.id }, [n.id === t ? (S(), u("figure", {
|
|
407
410
|
key: 0,
|
|
408
411
|
id: `${e.idPrefix}${n.id}`,
|
|
409
412
|
class: "fg-capture__figure"
|
|
@@ -422,7 +425,7 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
|
|
|
422
425
|
tabindex: "-1",
|
|
423
426
|
"aria-hidden": "true",
|
|
424
427
|
title: `Open ${n.label} capture at full size`,
|
|
425
|
-
onClick: (e) =>
|
|
428
|
+
onClick: (e) => N(n)
|
|
426
429
|
}, null, 8, Se)) : l("", !0)]), n.command || s.$slots.caption ? (S(), u("figcaption", Ce, [n.command ? (S(), u("code", we, D(n.command), 1)) : l("", !0), T(s.$slots, "caption", { item: n })])) : l("", !0)], 8, be)) : l("", !0)], 64))), 128))]),
|
|
427
430
|
_: 3
|
|
428
431
|
}, 8, [
|
|
@@ -436,17 +439,17 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
|
|
|
436
439
|
title: `${y.value?.label ?? ""} capture`,
|
|
437
440
|
description: "Scroll to read the full capture.",
|
|
438
441
|
class: "fg-capture-viewer",
|
|
439
|
-
onCloseAutoFocus:
|
|
442
|
+
onCloseAutoFocus: F
|
|
440
443
|
}, {
|
|
441
|
-
footer:
|
|
444
|
+
footer: P(() => [p(r, {
|
|
442
445
|
variant: "secondary",
|
|
443
446
|
size: "lg",
|
|
444
447
|
onClick: g[2] ||= (e) => v.value = !1
|
|
445
448
|
}, {
|
|
446
|
-
default:
|
|
449
|
+
default: P(() => [...g[5] ||= [f(" Close capture ", -1)]]),
|
|
447
450
|
_: 1
|
|
448
451
|
})]),
|
|
449
|
-
default:
|
|
452
|
+
default: P(() => [y.value ? (S(), c(Q, {
|
|
450
453
|
key: 0,
|
|
451
454
|
html: y.value.html,
|
|
452
455
|
label: `${y.value.label} capture at full size`,
|
|
@@ -522,4 +525,4 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
|
|
|
522
525
|
}
|
|
523
526
|
});
|
|
524
527
|
//#endregion
|
|
525
|
-
export {
|
|
528
|
+
export { R as SITE_APPEARANCE_KEY, H as SITE_PROJECTS, Te as UiCapture, Ie as UiCommandList, oe as UiSiteHeader, ge as UiSiteNav, B as applySiteAppearance, ee as siteThemeBootScript, V as useSiteAppearance };
|