@filipgutica/ui 1.11.1 → 1.11.2

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.
@@ -1,7 +1,7 @@
1
1
  type __VLS_Props = {
2
2
  html: string;
3
3
  label: string;
4
- /** Scales the capture down to the available width instead of scrolling it. */
4
+ /** Fits the capture to the available width when it remains readable. */
5
5
  fit: boolean;
6
6
  };
7
7
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
package/dist/site.js CHANGED
@@ -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
- ], re = { class: "fg-site-header" }, V = { class: "fg-site-header__inner" }, H = ["aria-label"], U = {
76
+ ], re = { class: "fg-site-header" }, ie = { class: "fg-site-header__inner" }, V = ["aria-label"], H = {
77
77
  class: "fg-site-projects__menu fg-site-nav",
78
78
  "aria-label": "Projects"
79
- }, W = ["href", "aria-current"], G = { class: "fg-site-header__end" }, K = {
79
+ }, U = ["href", "aria-current"], W = { class: "fg-site-header__end" }, G = {
80
80
  key: 0,
81
81
  class: "fg-site-header__links",
82
82
  "aria-label": "Site links"
83
- }, q = ["href"], J = {
83
+ }, K = ["href"], q = {
84
84
  key: 0,
85
85
  class: "fg-site-appearance",
86
86
  role: "group",
87
87
  "aria-label": "Color theme"
88
- }, Y = [
88
+ }, J = [
89
89
  "aria-label",
90
90
  "title",
91
91
  "aria-pressed",
92
92
  "onClick"
93
- ], X = {
93
+ ], Y = {
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
- }, ie = {
101
+ }, ae = {
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
- }, ae = /* @__PURE__ */ m({
104
+ }, oe = /* @__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", re, [d("div", V, [d("details", {
135
+ }), y(() => document.removeEventListener("pointerdown", h)), (s, f) => (S(), u("header", re, [d("div", ie, [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, H), d("nav", U, [(S(!0), u(o, null, w(O(B), (t) => (S(), u("a", {
155
+ }, [d("path", { d: "m4 6 4 4 4-4" })], -1)], 8, V), d("nav", H, [(S(!0), u(o, null, w(O(B), (t) => (S(), u("a", {
156
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, W))), 128))])], 544), d("div", G, [e.links.length > 0 ? (S(), u("nav", K, [(S(!0), u(o, null, w(e.links, (e) => (S(), u("a", {
159
+ }, 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", {
160
160
  key: e.href,
161
161
  href: e.href
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", {
162
+ }, D(e.label), 9, K))), 128))])) : l("", !0), T(s.$slots, "default", {}, () => [i.value && O(r) ? (S(), u("div", q, [(S(), u(o, null, w(t, (e) => d("button", {
163
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", X, [e.value === "system" ? (S(), u(o, { key: 0 }, [f[1] ||= d("rect", {
170
+ }, [(S(), u("svg", Y, [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", ie))]))], 8, Y)), 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", ae))]))], 8, J)), 64))])) : l("", !0)])])])]));
181
181
  }
182
- }), oe = ["id"], se = ["role", "aria-labelledby"], ce = ["id"], le = [
182
+ }), se = ["id"], ce = ["role", "aria-labelledby"], le = ["id"], ue = [
183
183
  "href",
184
184
  "aria-current",
185
185
  "onClick"
186
- ], ue = { key: 0 }, Z = /* @__PURE__ */ m({
186
+ ], de = { key: 0 }, X = /* @__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, ce)) : l("", !0), (S(!0), u(o, null, w(e.items, (e) => (S(), u("a", {
215
+ }, D(e.label), 9, le)) : 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", ue, D(e.label), 1)) : (S(), u(o, { key: 1 }, [f(D(e.label), 1)], 64))], 8, le))), 128))], 8, se))), 128))])], 8, oe));
220
+ }, [e.code ? (S(), u("code", de, D(e.label), 1)) : (S(), u(o, { key: 1 }, [f(D(e.label), 1)], 64))], 8, ue))), 128))], 8, ce))), 128))])], 8, se));
221
221
  }
222
- }), de = ["data-enhanced"], fe = ["open"], pe = ["aria-controls"], me = "(max-width: 800px)", he = /* @__PURE__ */ m({
222
+ }), fe = ["data-enhanced"], pe = ["open"], me = ["aria-controls"], he = "(max-width: 800px)", ge = /* @__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(me), w(), o.value = !0, h.addEventListener("change", w);
240
+ h = matchMedia(he), 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
- }, D(e.label), 9, pe), p(Z, {
253
+ }, D(e.label), 9, me), p(X, {
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, fe)) : (S(), c(i, {
263
+ ])], 8, pe)) : (S(), c(i, {
264
264
  key: 1,
265
265
  open: l.value,
266
266
  "onUpdate:open": h[0] ||= (e) => l.value = e,
@@ -275,7 +275,7 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
275
275
  default: M(() => [f(D(e.label), 1)]),
276
276
  _: 1
277
277
  })]),
278
- default: M(() => [p(Z, {
278
+ default: M(() => [p(X, {
279
279
  "content-id": O(t),
280
280
  label: e.label,
281
281
  groups: e.groups,
@@ -288,14 +288,14 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
288
288
  "active-id"
289
289
  ])]),
290
290
  _: 1
291
- }, 8, ["open", "title"]))], 8, de));
291
+ }, 8, ["open", "title"]))], 8, fe));
292
292
  }
293
- }), ge = [
293
+ }), _e = [
294
294
  "aria-label",
295
295
  "tabindex",
296
296
  "data-fit",
297
297
  "innerHTML"
298
- ], Q = /* @__PURE__ */ m({
298
+ ], Z = .7, Q = /* @__PURE__ */ m({
299
299
  __name: "CaptureScreen",
300
300
  props: {
301
301
  html: {},
@@ -303,35 +303,37 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
303
303
  fit: { type: Boolean }
304
304
  },
305
305
  setup(e) {
306
- let t = C(), n = C(1), r = C(), i, a = () => {
306
+ let t = C(), n = C(1), r = C(), i = s(() => r.value !== void 0), a, o = () => {
307
307
  if (!e.fit) {
308
308
  r.value = void 0, n.value = 1;
309
309
  return;
310
310
  }
311
311
  let i = t.value, a = i?.firstElementChild;
312
- !i?.clientWidth || !(a instanceof HTMLElement) || !a.offsetWidth || (n.value = Math.min(1, i.clientWidth / a.offsetWidth), r.value = Math.ceil(a.offsetHeight * n.value) + i.offsetHeight - i.clientHeight);
312
+ if (!i?.clientWidth || !(a instanceof HTMLElement) || !a.offsetWidth) return;
313
+ let o = Math.min(1, i.clientWidth / a.offsetWidth);
314
+ 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;
313
315
  };
314
- return j(() => [e.fit, e.html], a, { flush: "post" }), b(() => {
315
- typeof ResizeObserver < "u" && (i = new ResizeObserver(a), t.value && i.observe(t.value)), a();
316
- }), x(() => i?.disconnect()), (i, a) => (S(), u("div", {
316
+ return j(() => [e.fit, e.html], o, { flush: "post" }), b(() => {
317
+ typeof ResizeObserver < "u" && (a = new ResizeObserver(o), t.value && a.observe(t.value)), o();
318
+ }), x(() => a?.disconnect()), (a, o) => (S(), u("div", {
317
319
  ref_key: "container",
318
320
  ref: t,
319
321
  class: "fg-capture__screen",
320
322
  role: "region",
321
323
  "aria-label": e.label,
322
- tabindex: e.fit ? void 0 : 0,
323
- "data-fit": e.fit || void 0,
324
+ tabindex: i.value ? void 0 : 0,
325
+ "data-fit": i.value || void 0,
324
326
  style: v({
325
327
  height: r.value === void 0 ? void 0 : `${r.value}px`,
326
328
  "--capture-scale": n.value
327
329
  }),
328
330
  innerHTML: e.html
329
- }, null, 12, ge));
331
+ }, null, 12, _e));
330
332
  }
331
- }), _e = ["data-enhanced"], ve = ["aria-label"], ye = ["id"], be = { class: "fg-capture__preview" }, xe = ["title", "onClick"], Se = {
333
+ }), ve = ["data-enhanced"], ye = ["aria-label"], be = ["id"], xe = { class: "fg-capture__preview" }, Se = ["title", "onClick"], Ce = {
332
334
  key: 0,
333
335
  class: "fg-capture__caption"
334
- }, Ce = { key: 0 }, we = /* @__PURE__ */ m({
336
+ }, we = { key: 0 }, Te = /* @__PURE__ */ m({
335
337
  __name: "UiCapture",
336
338
  props: /*@__PURE__*/ h({
337
339
  items: {},
@@ -394,7 +396,7 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
394
396
  stroke: "currentColor",
395
397
  "stroke-width": "1.5",
396
398
  "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),
399
+ }, [d("path", { d: "M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7" })], -1), d("span", { class: "fg-capture__full-label" }, "Full size", -1)]], 8, ye)) : l("", !0),
398
400
  p(n, {
399
401
  "model-value": h.value,
400
402
  items: m.value,
@@ -405,7 +407,7 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
405
407
  key: 0,
406
408
  id: `${e.idPrefix}${n.id}`,
407
409
  class: "fg-capture__figure"
408
- }, [d("div", be, [p(Q, {
410
+ }, [d("div", xe, [p(Q, {
409
411
  html: n.html,
410
412
  label: `Terminal capture: ${n.label}`,
411
413
  fit: a.value
@@ -421,7 +423,7 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
421
423
  "aria-hidden": "true",
422
424
  title: `Open ${n.label} capture at full size`,
423
425
  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))]),
426
+ }, 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))]),
425
427
  _: 3
426
428
  }, 8, [
427
429
  "model-value",
@@ -452,26 +454,26 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
452
454
  }, null, 8, ["html", "label"])) : l("", !0)]),
453
455
  _: 1
454
456
  }, 8, ["open", "title"])
455
- ], 8, _e));
457
+ ], 8, ve));
456
458
  }
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 = {
459
+ }), Ee = { class: "fg-command-list" }, De = { class: "fg-command-list__table" }, $ = { scope: "col" }, Oe = { scope: "col" }, ke = { key: 0 }, Ae = { class: "fg-command-list__command" }, je = { class: "fg-command-list__description" }, Me = {
458
460
  key: 0,
459
461
  class: "fg-command-list__action"
460
- }, Me = [
462
+ }, Ne = [
461
463
  "disabled",
462
464
  "aria-label",
463
465
  "title",
464
466
  "onClick"
465
- ], Ne = {
467
+ ], Pe = {
466
468
  viewBox: "0 0 24 24",
467
469
  fill: "none",
468
470
  stroke: "currentColor",
469
471
  "stroke-width": "1.5",
470
472
  "aria-hidden": "true"
471
- }, Pe = {
473
+ }, Fe = {
472
474
  key: 0,
473
475
  d: "m5 12 4 4L19 6"
474
- }, Fe = /* @__PURE__ */ m({
476
+ }, Ie = /* @__PURE__ */ m({
475
477
  __name: "UiCommandList",
476
478
  props: {
477
479
  items: {},
@@ -491,14 +493,14 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
491
493
  unavailableMessage: "Clipboard unavailable. Select the command to copy it.",
492
494
  failureMessage: "Could not copy. Select the command to copy it."
493
495
  }), p = C(""), m = s(() => a.value || (r.value ? `${p.value} copied to clipboard.` : "")), h = (e) => (p.value = e, c(e));
494
- return (e, s) => (S(), u("div", Te, [d("table", Ee, [d("thead", null, [d("tr", null, [
495
- d("th", De, D(t.commandHeader), 1),
496
- d("th", $, D(t.descriptionHeader), 1),
497
- t.copyable ? (S(), u("td", Oe)) : l("", !0)
496
+ return (e, s) => (S(), u("div", Ee, [d("table", De, [d("thead", null, [d("tr", null, [
497
+ d("th", $, D(t.commandHeader), 1),
498
+ d("th", Oe, D(t.descriptionHeader), 1),
499
+ t.copyable ? (S(), u("td", ke)) : l("", !0)
498
500
  ])]), d("tbody", null, [(S(!0), u(o, null, w(t.items, (c) => (S(), u("tr", { key: c.command }, [
499
- d("td", ke, [T(e.$slots, "command", { item: c }, () => [d("code", null, D(c.command), 1)])]),
500
- d("td", Ae, [T(e.$slots, "description", { item: c }, () => [f(D(c.description), 1)])]),
501
- t.copyable ? (S(), u("td", je, [n.value ? (S(), u("button", {
501
+ d("td", Ae, [T(e.$slots, "command", { item: c }, () => [d("code", null, D(c.command), 1)])]),
502
+ d("td", je, [T(e.$slots, "description", { item: c }, () => [f(D(c.description), 1)])]),
503
+ t.copyable ? (S(), u("td", Me, [n.value ? (S(), u("button", {
502
504
  key: 0,
503
505
  type: "button",
504
506
  class: "fg-command-list__copy",
@@ -506,13 +508,13 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
506
508
  "aria-label": `Copy ${c.command}`,
507
509
  title: `Copy ${c.command}`,
508
510
  onClick: (e) => h(c.command)
509
- }, [(S(), u("svg", Ne, [O(r) && !O(a) && p.value === c.command ? (S(), u("path", Pe)) : (S(), u(o, { key: 1 }, [s[0] ||= d("rect", {
511
+ }, [(S(), u("svg", Pe, [O(r) && !O(a) && p.value === c.command ? (S(), u("path", Fe)) : (S(), u(o, { key: 1 }, [s[0] ||= d("rect", {
510
512
  x: "8",
511
513
  y: "8",
512
514
  width: "12",
513
515
  height: "13",
514
516
  rx: "2"
515
- }, null, -1), s[1] ||= d("path", { d: "M16 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h3" }, null, -1)], 64))]))], 8, Me)) : l("", !0)])) : l("", !0)
517
+ }, 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, Ne)) : l("", !0)])) : l("", !0)
516
518
  ]))), 128))])]), d("span", {
517
519
  class: _(["fg-command-list__status", { "fg-site-sr-only": !O(a) }]),
518
520
  role: "status"
@@ -520,4 +522,4 @@ var I = "tool-site-theme", L = (e) => e === "system" || e === "light" || e === "
520
522
  }
521
523
  });
522
524
  //#endregion
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 };
525
+ export { I as SITE_APPEARANCE_KEY, B as SITE_PROJECTS, Te as UiCapture, Ie as UiCommandList, oe as UiSiteHeader, ge 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.11.1",
3
+ "version": "1.11.2",
4
4
  "description": "A compact Vue design system with Tailwind CSS and VS Code theme support",
5
5
  "type": "module",
6
6
  "sideEffects": [
package/src/site.css CHANGED
@@ -411,6 +411,8 @@
411
411
  background: transparent;
412
412
  cursor: zoom-in;
413
413
  }
414
+ /* Leave pointer gestures to the screen when the capture needs to scroll. */
415
+ .fg-capture__screen:not([data-fit]) + .fg-capture__expand { pointer-events: none; }
414
416
  .fg-capture__caption {
415
417
  display: grid;
416
418
  justify-items: start;