@filipgutica/ui 1.6.0 → 1.8.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.
@@ -10,6 +10,10 @@ export interface UiCommandListProps {
10
10
  descriptionHeader?: string;
11
11
  }
12
12
  type __VLS_Slots = {
13
+ /** Replaces the code-styled command, for a key shown as `<kbd>`. Copying still uses `item.command`. */
14
+ command?(props: {
15
+ item: UiCommandItem;
16
+ }): unknown;
13
17
  /** Replaces the plain description, for text with `<kbd>` or `<code>`. */
14
18
  description?(props: {
15
19
  item: UiCommandItem;
package/dist/site.js CHANGED
@@ -1,8 +1,8 @@
1
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";
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
3
  import { tryOnMounted as N, usePreferredDark as P, useStorage as F } from "@vueuse/core";
4
4
  //#region src/site/appearance.ts
5
- var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "dark", te = `(function () {
5
+ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "dark", ne = `(function () {
6
6
  var root = document.documentElement, choice;
7
7
  try { choice = localStorage.getItem('${I}'); } catch (error) {}
8
8
  var dark = choice === 'dark';
@@ -73,24 +73,24 @@ 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
- ], ne = { class: "fg-site-header" }, re = { class: "fg-site-header__inner" }, V = ["aria-label"], H = {
76
+ ], re = { class: "fg-site-header" }, V = { class: "fg-site-header__inner" }, H = ["aria-label"], U = {
77
77
  class: "fg-site-projects__menu fg-site-nav",
78
78
  "aria-label": "Projects"
79
- }, U = ["href", "aria-current"], W = { class: "fg-site-header__end" }, G = {
79
+ }, W = ["href", "aria-current"], G = { class: "fg-site-header__end" }, K = {
80
80
  key: 0,
81
81
  class: "fg-site-header__links",
82
82
  "aria-label": "Site links"
83
- }, K = ["href"], q = {
83
+ }, q = ["href"], J = {
84
84
  key: 0,
85
85
  class: "fg-site-appearance",
86
86
  role: "group",
87
87
  "aria-label": "Color theme"
88
- }, J = [
88
+ }, Y = [
89
89
  "aria-label",
90
90
  "title",
91
91
  "aria-pressed",
92
92
  "onClick"
93
- ], Y = {
93
+ ], X = {
94
94
  viewBox: "0 0 24 24",
95
95
  width: "18",
96
96
  height: "18",
@@ -98,10 +98,10 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
98
98
  stroke: "currentColor",
99
99
  "stroke-width": "1.5",
100
100
  "aria-hidden": "true"
101
- }, X = {
101
+ }, ie = {
102
102
  key: 2,
103
103
  d: "M20.5 13.5A9 9 0 0 1 10.5 3a9 9 0 1 0 10 10.5Z"
104
- }, ie = /* @__PURE__ */ m({
104
+ }, ae = /* @__PURE__ */ m({
105
105
  __name: "UiSiteHeader",
106
106
  props: {
107
107
  project: {},
@@ -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", ne, [d("div", re, [d("details", {
135
+ }), y(() => document.removeEventListener("pointerdown", h)), (s, f) => (S(), u("header", re, [d("div", V, [d("details", {
136
136
  ref_key: "menu",
137
137
  ref: a,
138
138
  class: "fg-site-projects",
@@ -152,14 +152,14 @@ 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, V), d("nav", H, [(S(!0), u(o, null, w(O(B), (t) => (S(), u("a", {
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
156
  key: t.id,
157
157
  href: t.href,
158
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", {
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", {
160
160
  key: e.href,
161
161
  href: e.href
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", {
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
163
  key: e.value,
164
164
  type: "button",
165
165
  class: "fg-site-appearance__choice",
@@ -167,7 +167,7 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
167
167
  title: `${e.label} theme`,
168
168
  "aria-pressed": O(r).choice.value === e.value,
169
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", {
170
+ }, [(S(), u("svg", X, [e.value === "system" ? (S(), u(o, { key: 0 }, [f[1] ||= d("rect", {
171
171
  x: "3",
172
172
  y: "4",
173
173
  width: "18",
@@ -177,13 +177,13 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
177
177
  cx: "12",
178
178
  cy: "12",
179
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", X))]))], 8, J)), 64))])) : l("", !0)])])])]));
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
181
  }
182
- }), ae = ["id"], oe = ["role", "aria-labelledby"], se = ["id"], ce = [
182
+ }), oe = ["id"], se = ["role", "aria-labelledby"], ce = ["id"], le = [
183
183
  "href",
184
184
  "aria-current",
185
185
  "onClick"
186
- ], le = { key: 0 }, Z = /* @__PURE__ */ m({
186
+ ], ue = { key: 0 }, Z = /* @__PURE__ */ m({
187
187
  __name: "SiteNavLinks",
188
188
  props: {
189
189
  contentId: {},
@@ -212,14 +212,14 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
212
212
  key: 0,
213
213
  id: i(t),
214
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", {
215
+ }, D(e.label), 9, ce)) : l("", !0), (S(!0), u(o, null, w(e.items, (e) => (S(), u("a", {
216
216
  key: e.href,
217
217
  href: e.href,
218
218
  "aria-current": a(e),
219
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));
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
221
  }
222
- }), ue = ["data-enhanced"], de = ["open"], fe = ["aria-controls"], pe = "(max-width: 800px)", me = /* @__PURE__ */ m({
222
+ }), de = ["data-enhanced"], fe = ["open"], pe = ["aria-controls"], me = "(max-width: 800px)", he = /* @__PURE__ */ m({
223
223
  __name: "UiSiteNav",
224
224
  props: {
225
225
  label: {},
@@ -237,7 +237,7 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
237
237
  _ ? (e.preventDefault(), _.tabIndex = -1, _.focus({ preventScroll: !0 }), _ = null) : s.value || (e.preventDefault(), y());
238
238
  };
239
239
  return b(() => {
240
- h = matchMedia(pe), w(), o.value = !0, h.addEventListener("change", w);
240
+ h = matchMedia(me), w(), o.value = !0, h.addEventListener("change", w);
241
241
  }), x(() => h?.removeEventListener("change", w)), (a, h) => (S(), u("div", {
242
242
  ref_key: "root",
243
243
  ref: n,
@@ -250,7 +250,7 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
250
250
  }, [d("summary", {
251
251
  class: "fg-site-rail__summary",
252
252
  "aria-controls": O(t)
253
- }, " Menu ", 8, fe), p(Z, {
253
+ }, " Menu ", 8, pe), p(Z, {
254
254
  "content-id": O(t),
255
255
  label: e.label,
256
256
  groups: e.groups,
@@ -260,7 +260,7 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
260
260
  "label",
261
261
  "groups",
262
262
  "active-id"
263
- ])], 8, de)) : (S(), c(i, {
263
+ ])], 8, fe)) : (S(), c(i, {
264
264
  key: 1,
265
265
  open: l.value,
266
266
  "onUpdate:open": h[0] ||= (e) => l.value = e,
@@ -288,9 +288,9 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
288
288
  "active-id"
289
289
  ])]),
290
290
  _: 1
291
- }, 8, ["open"]))], 8, ue));
291
+ }, 8, ["open"]))], 8, de));
292
292
  }
293
- }), he = [
293
+ }), ge = [
294
294
  "aria-label",
295
295
  "tabindex",
296
296
  "data-fit",
@@ -326,16 +326,12 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
326
326
  "--capture-scale": n.value
327
327
  }),
328
328
  innerHTML: e.html
329
- }, null, 12, he));
329
+ }, null, 12, ge));
330
330
  }
331
- }), ge = ["data-enhanced"], _e = ["id"], ve = { class: "fg-capture__preview" }, ye = [
332
- "aria-label",
333
- "title",
334
- "onClick"
335
- ], be = {
331
+ }), _e = ["data-enhanced"], ve = ["aria-label"], ye = ["id"], be = { class: "fg-capture__preview" }, xe = ["title", "onClick"], Se = {
336
332
  key: 0,
337
333
  class: "fg-capture__caption"
338
- }, xe = { key: 0 }, Se = /* @__PURE__ */ m({
334
+ }, Ce = { key: 0 }, we = /* @__PURE__ */ m({
339
335
  __name: "UiCapture",
340
336
  props: /*@__PURE__*/ h({
341
337
  items: {},
@@ -350,113 +346,132 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
350
346
  let i = ee(e, "modelValue"), a = C(!1), m = s(() => e.items.map(({ id: e, label: t }) => ({
351
347
  value: e,
352
348
  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 = () => {
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 = () => {
358
354
  try {
359
355
  return document.getElementById(decodeURIComponent(location.hash.slice(1)));
360
356
  } catch {
361
357
  return null;
362
358
  }
363
- }, P = async () => {
359
+ }, F = async () => {
364
360
  await g(), cancelAnimationFrame(O), cancelAnimationFrame(k), O = requestAnimationFrame(() => {
365
- k = requestAnimationFrame(() => N()?.scrollIntoView({
361
+ k = requestAnimationFrame(() => P()?.scrollIntoView({
366
362
  behavior: "instant",
367
363
  block: "start"
368
364
  }));
369
365
  });
370
- }, F = () => {
371
- let t = N();
366
+ }, I = () => {
367
+ let t = P();
372
368
  if (!t) return !1;
373
369
  let n = e.items.find(({ id: n }) => document.getElementById(`${e.idPrefix}${n}`)?.contains(t));
374
370
  return !n || h.value === n.id ? !1 : (i.value = n.id, !0);
375
- }, I = () => {
376
- F() && P();
371
+ }, L = () => {
372
+ I() && F();
377
373
  };
378
374
  return b(() => {
379
- a.value = !0, F(), location.hash && P(), window.addEventListener("hashchange", I), window.addEventListener("popstate", I);
375
+ a.value = !0, I(), location.hash && F(), window.addEventListener("hashchange", L), window.addEventListener("popstate", L);
380
376
  }), x(() => {
381
- cancelAnimationFrame(O), cancelAnimationFrame(k), window.removeEventListener("hashchange", I), window.removeEventListener("popstate", I);
377
+ cancelAnimationFrame(O), cancelAnimationFrame(k), window.removeEventListener("hashchange", L), window.removeEventListener("popstate", L);
382
378
  }), (s, g) => (S(), u("div", {
383
379
  class: "fg-capture",
384
380
  "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", {
381
+ }, [
382
+ a.value && _.value ? (S(), u("button", {
404
383
  key: 0,
384
+ ref_key: "fullSizeButton",
385
+ ref: A,
405
386
  type: "button",
406
- class: "fg-capture__expand",
407
- "aria-label": `Expand ${n.label} capture`,
387
+ class: "fg-capture__full",
388
+ "aria-label": `Expand ${_.value.label} capture at full size`,
408
389
  "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
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
429
403
  }, {
430
- default: M(() => [...g[3] ||= [f(" Close capture ", -1)]]),
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)]),
431
453
  _: 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));
454
+ }, 8, ["open", "title"])
455
+ ], 8, _e));
441
456
  }
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 = {
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 = {
443
458
  key: 0,
444
459
  class: "fg-command-list__action"
445
- }, Ae = [
460
+ }, Me = [
446
461
  "disabled",
447
462
  "aria-label",
448
463
  "title",
449
464
  "onClick"
450
- ], je = {
465
+ ], Ne = {
451
466
  viewBox: "0 0 24 24",
452
467
  fill: "none",
453
468
  stroke: "currentColor",
454
469
  "stroke-width": "1.5",
455
470
  "aria-hidden": "true"
456
- }, Me = {
471
+ }, Pe = {
457
472
  key: 0,
458
473
  d: "m5 12 4 4L19 6"
459
- }, Ne = /* @__PURE__ */ m({
474
+ }, Fe = /* @__PURE__ */ m({
460
475
  __name: "UiCommandList",
461
476
  props: {
462
477
  items: {},
@@ -476,14 +491,14 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
476
491
  unavailableMessage: "Clipboard unavailable. Select the command to copy it.",
477
492
  failureMessage: "Could not copy. Select the command to copy it."
478
493
  }), 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)
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)
483
498
  ])]), 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", {
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", {
487
502
  key: 0,
488
503
  type: "button",
489
504
  class: "fg-command-list__copy",
@@ -491,13 +506,13 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
491
506
  "aria-label": `Copy ${c.command}`,
492
507
  title: `Copy ${c.command}`,
493
508
  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", {
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", {
495
510
  x: "8",
496
511
  y: "8",
497
512
  width: "12",
498
513
  height: "13",
499
514
  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)
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)
501
516
  ]))), 128))])]), d("span", {
502
517
  class: _(["fg-command-list__status", { "fg-site-sr-only": !O(a) }]),
503
518
  role: "status"
@@ -505,4 +520,4 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
505
520
  }
506
521
  });
507
522
  //#endregion
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 };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@filipgutica/ui",
3
- "version": "1.6.0",
3
+ "version": "1.8.0",
4
4
  "description": "A compact Vue design system with Tailwind CSS and VS Code theme support",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -5,7 +5,7 @@
5
5
  /* Package-owned typography keeps controls consistent across consuming apps. */
6
6
  .fg-button, .fg-input, .fg-select, .fg-checkbox, .fg-field,
7
7
  .fg-radio-card, .fg-badge, .fg-alert, .fg-surface, .fg-card,
8
- .fg-dialog__content, .fg-code-block {
8
+ .fg-dialog__content, .fg-code-block, .fg-toggle-button {
9
9
  font-family: var(--font-ui);
10
10
  font-size: var(--text-md);
11
11
  font-weight: var(--weight-regular);
@@ -51,7 +51,7 @@
51
51
  }
52
52
  .fg-code-block__copy:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
53
53
  .fg-code-block__copy svg { width: 1rem; height: 1rem; }
54
- .fg-code-block__copy:focus-visible, .fg-code-block__pre:focus-visible { outline: 2px solid var(--color-focus); outline-offset: -2px; }
54
+ .fg-code-block__copy:focus-visible, .fg-code-block__pre:focus-visible, .fg-figure__plate:focus-visible { outline: 2px solid var(--color-focus); outline-offset: -2px; }
55
55
  .fg-code-block__pre { margin: 0; padding: 1rem; overflow: auto; max-height: 32rem; tab-size: 2; }
56
56
  .fg-code-block__pre, .fg-code-block__pre code { font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.65; }
57
57
  .fg-code-block__pre code { display: block; color: inherit; }
@@ -141,7 +141,8 @@
141
141
  .fg-button:disabled,
142
142
  .fg-input:disabled,
143
143
  .fg-select:disabled,
144
- .fg-checkbox[data-disabled="true"] {
144
+ .fg-checkbox[data-disabled="true"],
145
+ .fg-toggle-button:disabled {
145
146
  cursor: not-allowed;
146
147
  opacity: 0.58;
147
148
  }
@@ -602,6 +603,128 @@
602
603
  font-size: var(--text-sm);
603
604
  }
604
605
 
606
+ .fg-figure {
607
+ display: grid;
608
+ grid-template-columns: minmax(0, 1fr);
609
+ gap: var(--space-3);
610
+ min-width: 0;
611
+ margin: 0;
612
+ }
613
+
614
+ /* Wide content scrolls inside the plate so the page never overflows. */
615
+ .fg-figure__plate {
616
+ min-width: 0;
617
+ overflow-x: auto;
618
+ padding: var(--space-5);
619
+ border: 1px solid var(--color-border-subtle);
620
+ border-radius: var(--radius-panel);
621
+ background: var(--color-surface);
622
+ }
623
+
624
+ .fg-figure__caption {
625
+ max-width: var(--measure);
626
+ color: var(--color-muted);
627
+ font-family: var(--font-ui);
628
+ font-size: var(--text-sm);
629
+ line-height: var(--leading);
630
+ }
631
+
632
+ .fg-figure__number {
633
+ color: var(--color-text);
634
+ font-weight: var(--weight-medium);
635
+ }
636
+
637
+ @media (max-width: 680px) {
638
+ .fg-figure__plate { padding: var(--space-4); }
639
+ }
640
+
641
+ .fg-score {
642
+ display: inline-flex;
643
+ align-items: center;
644
+ gap: var(--space-2);
645
+ font-variant-numeric: tabular-nums;
646
+ white-space: nowrap;
647
+ }
648
+
649
+ .fg-score__pips { display: inline-flex; gap: 0.1875rem; }
650
+
651
+ .fg-score__pip {
652
+ width: 0.5rem;
653
+ height: 0.5rem;
654
+ border: 1px solid var(--color-border);
655
+ border-radius: var(--radius-pill);
656
+ }
657
+
658
+ .fg-score__pip[data-filled="true"] {
659
+ border-color: var(--color-accent);
660
+ background: var(--color-accent);
661
+ }
662
+
663
+ .fg-score__value { font-weight: var(--weight-medium); }
664
+ .fg-score__max { color: var(--color-muted); font-weight: var(--weight-regular); }
665
+
666
+ .fg-toggle-button {
667
+ display: flex;
668
+ align-items: center;
669
+ gap: var(--space-3);
670
+ padding: var(--space-2) var(--space-3);
671
+ border: 1px solid var(--color-border-subtle);
672
+ border-radius: var(--radius-control);
673
+ color: var(--color-text);
674
+ background: var(--color-surface-raised);
675
+ line-height: var(--leading-tight);
676
+ text-align: left;
677
+ cursor: pointer;
678
+ }
679
+
680
+ .fg-toggle-button[data-size="sm"] { min-height: var(--control-sm); font-size: var(--text-sm); }
681
+ .fg-toggle-button[data-size="md"] { min-height: var(--control-md); font-size: var(--text-md); }
682
+ .fg-toggle-button[data-size="lg"] { min-height: var(--control-lg); font-size: var(--text-lg); }
683
+
684
+ .fg-toggle-button:hover:not(:disabled, [aria-pressed="true"]) { border-color: var(--color-border); }
685
+ .fg-toggle-button[aria-pressed="true"] { border-color: var(--color-accent); }
686
+
687
+ /* The thumb's position, not only its color, shows the state. */
688
+ .fg-toggle-button__switch {
689
+ position: relative;
690
+ flex: none;
691
+ width: 1.75rem;
692
+ height: 1rem;
693
+ border: 1px solid var(--color-border);
694
+ border-radius: var(--radius-pill);
695
+ background: var(--color-surface-muted);
696
+ transition: background-color var(--duration) var(--ease-out), border-color var(--duration) var(--ease-out);
697
+ }
698
+
699
+ .fg-toggle-button__switch::after {
700
+ position: absolute;
701
+ top: 0.125rem;
702
+ left: 0.125rem;
703
+ width: 0.625rem;
704
+ height: 0.625rem;
705
+ border-radius: var(--radius-pill);
706
+ background: var(--color-border);
707
+ content: "";
708
+ transition: transform var(--duration) var(--ease-out), background-color var(--duration) var(--ease-out);
709
+ }
710
+
711
+ .fg-toggle-button[aria-pressed="true"] .fg-toggle-button__switch {
712
+ border-color: var(--color-accent);
713
+ background: var(--color-accent);
714
+ }
715
+
716
+ .fg-toggle-button[aria-pressed="true"] .fg-toggle-button__switch::after {
717
+ background: var(--color-button-text);
718
+ transform: translateX(0.75rem);
719
+ }
720
+
721
+ .fg-toggle-button__text { display: grid; min-width: 0; }
722
+
723
+ .fg-toggle-button__description {
724
+ color: var(--color-muted);
725
+ font-size: var(--text-xs);
726
+ }
727
+
605
728
  .fg-progress {
606
729
  position: relative;
607
730
  height: 0.55rem;
@@ -745,7 +868,8 @@
745
868
  .fg-radio-card:focus-visible,
746
869
  .fg-slider__thumb:focus-visible,
747
870
  .fg-dialog__close:focus-visible,
748
- .fg-dialog__content:focus-visible {
871
+ .fg-dialog__content:focus-visible,
872
+ .fg-toggle-button:focus-visible {
749
873
  outline: 2px solid var(--color-focus);
750
874
  outline-offset: 2px;
751
875
  }
@@ -759,7 +883,8 @@
759
883
  :root.high-contrast .fg-surface,
760
884
  :root.high-contrast .fg-card,
761
885
  :root.high-contrast .fg-code-block,
762
- :root.high-contrast .fg-dialog__content {
886
+ :root.high-contrast .fg-dialog__content,
887
+ :root.high-contrast .fg-toggle-button {
763
888
  border-width: 2px;
764
889
  border-color: var(--color-border);
765
890
  }
@@ -783,7 +908,9 @@
783
908
  .fg-radio-card,
784
909
  .fg-slider__range,
785
910
  .fg-dialog__close,
786
- .fg-progress__indicator { transition: none; }
911
+ .fg-progress__indicator,
912
+ .fg-toggle-button__switch,
913
+ .fg-toggle-button__switch::after { transition: none; }
787
914
 
788
915
  .fg-button[aria-busy="true"]::before { animation-duration: 1.4s; }
789
916
  }