@loafacto/ui 0.19.0 → 0.21.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/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { readonly, ref, openBlock, createElementBlock, createStaticVNode, createElementVNode, defineComponent, computed, watch, onBeforeUnmount, normalizeClass, normalizeStyle, createCommentVNode, Fragment, toDisplayString, createVNode, Transition, withCtx, renderList, renderSlot, unref, nextTick, onUnmounted, createBlock, Teleport, TransitionGroup, withModifiers, useTemplateRef, onMounted, createTextVNode, withDirectives, withKeys, vModelText, resolveDynamicComponent, useModel, useId, mergeProps, isRef, vModelDynamic, mergeModels, vModelCheckbox, vModelRadio, useSlots, vShow } from "vue";
1
+ import { defineComponent, openBlock, createElementBlock, normalizeClass, renderSlot, createBlock, createElementVNode, createCommentVNode, readonly, ref, computed, withCtx, nextTick, createStaticVNode, watch, onBeforeUnmount, normalizeStyle, Fragment, toDisplayString, createVNode, Transition, renderList, onUnmounted, Teleport, TransitionGroup, unref, withModifiers, useTemplateRef, onMounted, createTextVNode, withDirectives, withKeys, vModelText, resolveDynamicComponent, useModel, useId, mergeProps, isRef, vModelDynamic, mergeModels, vModelCheckbox, vModelRadio, useSlots, vShow } from "vue";
2
+ import { L as LfIcon, _ as _export_sfc, a as LfSpinner, u as useSplitAttrs, b as LfField, c as LfIconButton, d as LF_ICONS } from "./LfSegmented-CvGl-0vv.js";
3
+ import { e, f } from "./LfSegmented-CvGl-0vv.js";
2
4
  import { a as applyTheme, D as DARK_THEME, L as LIGHT_THEME } from "./applyTheme-8AxcQbPB.js";
3
- import { b, c, d, e, f, h, i, l } from "./applyTheme-8AxcQbPB.js";
4
- import { _ as _export_sfc, L as LfSpinner, a as LfIcon, u as useSplitAttrs, b as LfField, c as LfIconButton, d as LF_ICONS } from "./LfSegmented-Dvpie4c_.js";
5
- import { e as e2, f as f2 } from "./LfSegmented-Dvpie4c_.js";
5
+ import { b, c, d, e as e2, f as f2, h, i, l } from "./applyTheme-8AxcQbPB.js";
6
6
  import { defineStore } from "pinia";
7
7
  const LOAFACTO_SERVICES = [
8
8
  {
@@ -71,6 +71,55 @@ function serviceIdForPath(pathname, services = LOAFACTO_SERVICES) {
71
71
  function isServicePath(pathname, services = LOAFACTO_SERVICES) {
72
72
  return services.some((s) => isUnder(pathname, s.path));
73
73
  }
74
+ const _hoisted_1$P = ["title", "aria-label", "aria-expanded"];
75
+ const _hoisted_2$I = {
76
+ key: 1,
77
+ viewBox: "0 0 24 24",
78
+ "aria-hidden": "true"
79
+ };
80
+ const _hoisted_3$B = ["d"];
81
+ const _sfc_main$R = /* @__PURE__ */ defineComponent({
82
+ __name: "LfShellButton",
83
+ props: {
84
+ label: {},
85
+ icon: { default: void 0 },
86
+ iconPath: { default: void 0 },
87
+ dot: { type: Boolean, default: false },
88
+ dotKey: { default: 0 },
89
+ active: { type: Boolean, default: false },
90
+ expanded: { type: Boolean, default: void 0 }
91
+ },
92
+ setup(__props) {
93
+ return (_ctx, _cache) => {
94
+ return openBlock(), createElementBlock("button", {
95
+ type: "button",
96
+ class: normalizeClass(["lf-shell-btn", { "lf-shell-btn--on": __props.active }]),
97
+ title: __props.label,
98
+ "aria-label": __props.label,
99
+ "aria-expanded": __props.expanded
100
+ }, [
101
+ renderSlot(_ctx.$slots, "default", {}, () => [
102
+ __props.icon ? (openBlock(), createBlock(LfIcon, {
103
+ key: 0,
104
+ name: __props.icon,
105
+ size: "1.125rem"
106
+ }, null, 8, ["name"])) : __props.iconPath ? (openBlock(), createElementBlock("svg", _hoisted_2$I, [
107
+ createElementVNode("path", {
108
+ d: __props.iconPath,
109
+ fill: "currentColor"
110
+ }, null, 8, _hoisted_3$B)
111
+ ])) : createCommentVNode("", true)
112
+ ], true),
113
+ __props.dot ? (openBlock(), createElementBlock("span", {
114
+ key: __props.dotKey,
115
+ class: "lf-shell-btn__dot",
116
+ "aria-hidden": "true"
117
+ })) : createCommentVNode("", true)
118
+ ], 10, _hoisted_1$P);
119
+ };
120
+ }
121
+ });
122
+ const LfShellButton = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__scopeId", "data-v-55d5666c"]]);
74
123
  const STORAGE_KEY = "lf-theme";
75
124
  const OS_QUERY = "(prefers-color-scheme: light)";
76
125
  function readStored() {
@@ -151,6 +200,73 @@ function useTheme() {
151
200
  }
152
201
  };
153
202
  }
203
+ const _hoisted_1$O = ["d"];
204
+ const ICON_SUN = "M12 7a5 5 0 1 0 0 10 5 5 0 0 0 0-10zm0-5v3h0V2zm0 17v3h0v-3zM2 11h3v2H2v-2zm17 0h3v2h-3v-2zM4.2 4.2l2.1 2.1L4.9 7.7 2.8 5.6l1.4-1.4zm13.5 13.5 2.1 2.1-1.4 1.4-2.1-2.1 1.4-1.4zM19.8 4.2l1.4 1.4-2.1 2.1-1.4-1.4 2.1-2.1zM6.3 17.7l1.4 1.4-2.1 2.1-1.4-1.4 2.1-2.1z";
205
+ const ICON_MOON = "M12.3 3a7 7 0 1 0 8.7 8.7A9 9 0 1 1 12.3 3z";
206
+ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
207
+ __name: "LfThemeToggle",
208
+ props: {
209
+ mode: { default: void 0 },
210
+ labelToLight: { default: "밝은 테마로 전환" },
211
+ labelToDark: { default: "어두운 테마로 전환" }
212
+ },
213
+ emits: ["update:mode"],
214
+ setup(__props, { emit: __emit }) {
215
+ const props = __props;
216
+ const emit = __emit;
217
+ const lib = useTheme();
218
+ const current = computed(() => props.mode ?? lib.mode.value);
219
+ function flip() {
220
+ const next = current.value === "dark" ? "light" : "dark";
221
+ if (props.mode === void 0) lib.setMode(next);
222
+ emit("update:mode", next);
223
+ }
224
+ const spun = ref(false);
225
+ function onClick() {
226
+ var _a;
227
+ spun.value = true;
228
+ const doc = document;
229
+ const reduce = typeof window !== "undefined" && ((_a = window.matchMedia) == null ? void 0 : _a.call(window, "(prefers-reduced-motion: reduce)").matches);
230
+ if (!doc.startViewTransition || reduce) {
231
+ flip();
232
+ return;
233
+ }
234
+ const root = document.documentElement;
235
+ root.classList.add("lf-theme-switching");
236
+ try {
237
+ doc.startViewTransition(async () => {
238
+ flip();
239
+ await nextTick();
240
+ }).finished.finally(() => root.classList.remove("lf-theme-switching"));
241
+ } catch {
242
+ root.classList.remove("lf-theme-switching");
243
+ flip();
244
+ }
245
+ }
246
+ return (_ctx, _cache) => {
247
+ return openBlock(), createBlock(LfShellButton, {
248
+ label: current.value === "dark" ? __props.labelToLight : __props.labelToDark,
249
+ onClick
250
+ }, {
251
+ default: withCtx(() => [
252
+ (openBlock(), createElementBlock("svg", {
253
+ key: current.value,
254
+ viewBox: "0 0 24 24",
255
+ "aria-hidden": "true",
256
+ class: normalizeClass({ "lf-theme-icon--spin": spun.value })
257
+ }, [
258
+ createElementVNode("path", {
259
+ d: current.value === "dark" ? ICON_MOON : ICON_SUN,
260
+ fill: "currentColor"
261
+ }, null, 8, _hoisted_1$O)
262
+ ], 2))
263
+ ]),
264
+ _: 1
265
+ }, 8, ["label"]);
266
+ };
267
+ }
268
+ });
269
+ const LfThemeToggle = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__scopeId", "data-v-ea1dae0b"]]);
154
270
  const _sfc_main$P = {};
155
271
  const _hoisted_1$N = {
156
272
  xmlns: "http://www.w3.org/2000/svg",
@@ -243,18 +359,14 @@ const _hoisted_24 = {
243
359
  "aria-hidden": "true"
244
360
  };
245
361
  const _hoisted_25 = ["d"];
246
- const _hoisted_26 = ["title", "aria-label"];
247
- const _hoisted_27 = ["d"];
248
- const _hoisted_28 = ["aria-label"];
249
- const _hoisted_29 = { class: "lf-content lf-content--rail" };
250
- const _hoisted_30 = {
362
+ const _hoisted_26 = ["aria-label"];
363
+ const _hoisted_27 = { class: "lf-content lf-content--rail" };
364
+ const _hoisted_28 = {
251
365
  key: 2,
252
366
  class: "lf-content"
253
367
  };
254
- const _hoisted_31 = { class: "site-footer" };
255
- const _hoisted_32 = { class: "site-footer-inner" };
256
- const ICON_SUN = "M12 7a5 5 0 1 0 0 10 5 5 0 0 0 0-10zm0-5v3h0V2zm0 17v3h0v-3zM2 11h3v2H2v-2zm17 0h3v2h-3v-2zM4.2 4.2l2.1 2.1L4.9 7.7 2.8 5.6l1.4-1.4zm13.5 13.5 2.1 2.1-1.4 1.4-2.1-2.1 1.4-1.4zM19.8 4.2l1.4 1.4-2.1 2.1-1.4-1.4 2.1-2.1zM6.3 17.7l1.4 1.4-2.1 2.1-1.4-1.4 2.1-2.1z";
257
- const ICON_MOON = "M12.3 3a7 7 0 1 0 8.7 8.7A9 9 0 1 1 12.3 3z";
368
+ const _hoisted_29 = { class: "site-footer" };
369
+ const _hoisted_30 = { class: "site-footer-inner" };
258
370
  const RAIL_KEY = "lf-rail-hidden";
259
371
  const _sfc_main$N = /* @__PURE__ */ defineComponent({
260
372
  __name: "AppShell",
@@ -275,29 +387,6 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
275
387
  },
276
388
  emits: ["navigate"],
277
389
  setup(__props, { emit: __emit }) {
278
- const { mode: mode2, toggle } = useTheme();
279
- const spun = ref(false);
280
- function onThemeClick() {
281
- var _a;
282
- spun.value = true;
283
- const doc = document;
284
- const reduce = typeof window !== "undefined" && ((_a = window.matchMedia) == null ? void 0 : _a.call(window, "(prefers-reduced-motion: reduce)").matches);
285
- if (!doc.startViewTransition || reduce) {
286
- toggle();
287
- return;
288
- }
289
- const root = document.documentElement;
290
- root.classList.add("lf-theme-switching");
291
- try {
292
- doc.startViewTransition(async () => {
293
- toggle();
294
- await nextTick();
295
- }).finished.finally(() => root.classList.remove("lf-theme-switching"));
296
- } catch {
297
- root.classList.remove("lf-theme-switching");
298
- toggle();
299
- }
300
- }
301
390
  const props = __props;
302
391
  const emit = __emit;
303
392
  const DEFAULT_LABELS = {
@@ -585,26 +674,11 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
585
674
  ], 8, _hoisted_23);
586
675
  }), 128))
587
676
  ], 8, _hoisted_22)) : createCommentVNode("", true),
588
- __props.themeToggle ? (openBlock(), createElementBlock("button", {
677
+ __props.themeToggle ? (openBlock(), createBlock(LfThemeToggle, {
589
678
  key: 5,
590
- type: "button",
591
- class: "lf-glass lf-icon-btn",
592
- title: unref(mode2) === "dark" ? t.value.toLight : t.value.toDark,
593
- "aria-label": unref(mode2) === "dark" ? t.value.toLightLong : t.value.toDarkLong,
594
- onClick: onThemeClick
595
- }, [
596
- (openBlock(), createElementBlock("svg", {
597
- key: unref(mode2),
598
- viewBox: "0 0 24 24",
599
- "aria-hidden": "true",
600
- class: normalizeClass({ "lf-theme-icon--spin": spun.value })
601
- }, [
602
- createElementVNode("path", {
603
- d: unref(mode2) === "dark" ? ICON_MOON : ICON_SUN,
604
- fill: "currentColor"
605
- }, null, 8, _hoisted_27)
606
- ], 2))
607
- ], 8, _hoisted_26)) : createCommentVNode("", true),
679
+ "label-to-light": t.value.toLightLong,
680
+ "label-to-dark": t.value.toDarkLong
681
+ }, null, 8, ["label-to-light", "label-to-dark"])) : createCommentVNode("", true),
608
682
  renderSlot(_ctx.$slots, "actions", {}, void 0, true)
609
683
  ])
610
684
  ]),
@@ -618,15 +692,15 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
618
692
  onClick: _cache[4] || (_cache[4] = ($event) => railOpen.value = false)
619
693
  }, [
620
694
  renderSlot(_ctx.$slots, "rail", {}, void 0, true)
621
- ], 10, _hoisted_28),
622
- createElementVNode("main", _hoisted_29, [
695
+ ], 10, _hoisted_26),
696
+ createElementVNode("main", _hoisted_27, [
623
697
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
624
698
  ])
625
- ], 2)) : (openBlock(), createElementBlock("main", _hoisted_30, [
699
+ ], 2)) : (openBlock(), createElementBlock("main", _hoisted_28, [
626
700
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
627
701
  ])),
628
- createElementVNode("footer", _hoisted_31, [
629
- createElementVNode("div", _hoisted_32, [
702
+ createElementVNode("footer", _hoisted_29, [
703
+ createElementVNode("div", _hoisted_30, [
630
704
  renderSlot(_ctx.$slots, "footer", {}, () => [
631
705
  _cache[9] || (_cache[9] = createElementVNode("p", { class: "site-footer-copy" }, "© Loafacto. All rights reserved.", -1))
632
706
  ], true)
@@ -636,7 +710,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
636
710
  };
637
711
  }
638
712
  });
639
- const AppShell = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["__scopeId", "data-v-b8a57f75"]]);
713
+ const AppShell = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["__scopeId", "data-v-a695debc"]]);
640
714
  function generateId() {
641
715
  return `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
642
716
  }
@@ -1005,7 +1079,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
1005
1079
  };
1006
1080
  }
1007
1081
  });
1008
- const LfButton = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-0d2e2b97"]]);
1082
+ const LfButton = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-fbe98cd7"]]);
1009
1083
  const _hoisted_1$G = { class: "lf-control-wrap" };
1010
1084
  const _hoisted_2$E = {
1011
1085
  key: 0,
@@ -1639,7 +1713,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
1639
1713
  };
1640
1714
  }
1641
1715
  });
1642
- const LfCard = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-3ffcb11e"]]);
1716
+ const LfCard = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-61964a83"]]);
1643
1717
  const _hoisted_1$z = { class: "lf-page-header" };
1644
1718
  const _hoisted_2$x = { class: "lf-page-header__title-box" };
1645
1719
  const _hoisted_3$r = { class: "lf-page-header__title" };
@@ -1669,8 +1743,6 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
1669
1743
  count: {}
1670
1744
  },
1671
1745
  setup(__props) {
1672
- const slots = useSlots();
1673
- const hasTools = computed(() => !!slots.filters || !!slots.actions);
1674
1746
  return (_ctx, _cache) => {
1675
1747
  return openBlock(), createElementBlock("div", _hoisted_1$z, [
1676
1748
  createElementVNode("div", _hoisted_2$x, [
@@ -1690,7 +1762,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
1690
1762
  ]),
1691
1763
  __props.count !== void 0 ? (openBlock(), createElementBlock("span", _hoisted_5$k, toDisplayString(__props.count), 1)) : createCommentVNode("", true)
1692
1764
  ]),
1693
- hasTools.value ? (openBlock(), createElementBlock("div", _hoisted_6$e, [
1765
+ _ctx.$slots.filters || _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_6$e, [
1694
1766
  renderSlot(_ctx.$slots, "filters", {}, void 0, true),
1695
1767
  _cache[0] || (_cache[0] = createElementVNode("span", { class: "lf-page-header__spacer" }, null, -1)),
1696
1768
  renderSlot(_ctx.$slots, "actions", {}, void 0, true)
@@ -1704,7 +1776,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
1704
1776
  };
1705
1777
  }
1706
1778
  });
1707
- const LfPageHeader = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-a7ef2659"]]);
1779
+ const LfPageHeader = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-503c1630"]]);
1708
1780
  const _hoisted_1$y = {
1709
1781
  key: 0,
1710
1782
  class: "lf-badge__dot",
@@ -2071,7 +2143,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
2071
2143
  };
2072
2144
  }
2073
2145
  });
2074
- const LfTable = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-2eb52796"]]);
2146
+ const LfTable = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-240462cb"]]);
2075
2147
  const _hoisted_1$u = ["aria-label"];
2076
2148
  const _hoisted_2$s = {
2077
2149
  key: 0,
@@ -2356,7 +2428,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
2356
2428
  };
2357
2429
  }
2358
2430
  });
2359
- const LfStatCard = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-ddc6565d"]]);
2431
+ const LfStatCard = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-c84e9955"]]);
2360
2432
  const _hoisted_1$q = ["aria-describedby"];
2361
2433
  const _hoisted_2$p = ["id"];
2362
2434
  const _sfc_main$s = /* @__PURE__ */ defineComponent({
@@ -2529,7 +2601,8 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
2529
2601
  const props = __props;
2530
2602
  const emit = __emit;
2531
2603
  function linkAttrs(item) {
2532
- return props.link === "a" ? { href: item.to } : { to: item.to };
2604
+ if (props.link === "a") return { href: item.to };
2605
+ return props.current === void 0 ? { to: item.to } : { to: item.to, activeClass: "", exactActiveClass: "" };
2533
2606
  }
2534
2607
  const list = useTemplateRef("list");
2535
2608
  const thumb = ref(null);
@@ -2622,7 +2695,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
2622
2695
  };
2623
2696
  }
2624
2697
  });
2625
- const LfNavRail = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-a29be44a"]]);
2698
+ const LfNavRail = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-61385110"]]);
2626
2699
  const _sfc_main$p = /* @__PURE__ */ defineComponent({
2627
2700
  __name: "LfTransitionList",
2628
2701
  props: {
@@ -3140,7 +3213,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
3140
3213
  };
3141
3214
  }
3142
3215
  });
3143
- const LfListItem = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-e05ac56f"]]);
3216
+ const LfListItem = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-57a82ab1"]]);
3144
3217
  const _hoisted_1$l = {
3145
3218
  key: 0,
3146
3219
  class: "lf-divider lf-divider--labeled",
@@ -3307,7 +3380,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
3307
3380
  };
3308
3381
  }
3309
3382
  });
3310
- const LfTabs = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-ad8ded73"]]);
3383
+ const LfTabs = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-4439195d"]]);
3311
3384
  const _hoisted_1$j = ["aria-modal", "aria-labelledby", "aria-label"];
3312
3385
  const _hoisted_2$i = {
3313
3386
  key: 0,
@@ -5095,7 +5168,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
5095
5168
  };
5096
5169
  }
5097
5170
  });
5098
- const LfCodeBlock = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-c26782cf"]]);
5171
+ const LfCodeBlock = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-edbc475d"]]);
5099
5172
  const _hoisted_1 = { class: "lf-gridedit__table" };
5100
5173
  const _hoisted_2 = {
5101
5174
  class: "lf-gridedit__corner",
@@ -5434,6 +5507,201 @@ function createApiClient(options) {
5434
5507
  }
5435
5508
  return { api, request, install };
5436
5509
  }
5510
+ let lastBtn = null;
5511
+ let lastAt = 0;
5512
+ let installed = false;
5513
+ function markDone(el) {
5514
+ if (!el || !el.isConnected) return;
5515
+ el.classList.remove("lf-done");
5516
+ void el.offsetWidth;
5517
+ el.classList.add("lf-done");
5518
+ window.setTimeout(() => el.classList.remove("lf-done"), 1200);
5519
+ }
5520
+ function installDoneFeedback(store) {
5521
+ if (installed || typeof document === "undefined") return;
5522
+ installed = true;
5523
+ document.addEventListener("click", (e3) => {
5524
+ var _a, _b;
5525
+ const b2 = (_b = (_a = e3.target) == null ? void 0 : _a.closest) == null ? void 0 : _b.call(_a, "button");
5526
+ if (b2) {
5527
+ lastBtn = b2;
5528
+ lastAt = Date.now();
5529
+ }
5530
+ }, true);
5531
+ store.$onAction(({ name }) => {
5532
+ if (name !== "success") return;
5533
+ if (lastBtn && Date.now() - lastAt < 3e3) markDone(lastBtn);
5534
+ lastBtn = null;
5535
+ });
5536
+ }
5537
+ function useThumb(el, sel, src) {
5538
+ const style = ref({ opacity: "0" });
5539
+ const ready = ref(false);
5540
+ function measure() {
5541
+ const box = el.value;
5542
+ const on = box == null ? void 0 : box.querySelector(sel);
5543
+ if (!box || !on) {
5544
+ style.value = { opacity: "0" };
5545
+ return;
5546
+ }
5547
+ style.value = {
5548
+ transform: `translate(${on.offsetLeft}px, ${on.offsetTop}px)`,
5549
+ width: `${on.offsetWidth}px`,
5550
+ height: `${on.offsetHeight}px`,
5551
+ opacity: "1"
5552
+ };
5553
+ }
5554
+ let ro = null;
5555
+ watch(src, () => {
5556
+ void nextTick(measure);
5557
+ });
5558
+ watch(el, (box) => {
5559
+ ro == null ? void 0 : ro.disconnect();
5560
+ ready.value = false;
5561
+ if (!box) return;
5562
+ ro = new ResizeObserver(() => measure());
5563
+ ro.observe(box);
5564
+ void nextTick(() => {
5565
+ measure();
5566
+ window.setTimeout(() => {
5567
+ ready.value = true;
5568
+ }, 60);
5569
+ });
5570
+ }, { immediate: true });
5571
+ onUnmounted(() => ro == null ? void 0 : ro.disconnect());
5572
+ return { style, ready };
5573
+ }
5574
+ const thumbs = /* @__PURE__ */ new WeakMap();
5575
+ function placeThumb(el, st) {
5576
+ const on = el.querySelector(st.opt.on);
5577
+ const s = st.thumb.style;
5578
+ if (!on || on.offsetWidth === 0) {
5579
+ s.opacity = "0";
5580
+ return;
5581
+ }
5582
+ const bar = st.opt.kind === "bar";
5583
+ const y = bar ? on.offsetTop + on.offsetHeight - 2 : on.offsetTop;
5584
+ s.transform = `translate(${on.offsetLeft}px, ${y}px)`;
5585
+ s.width = `${on.offsetWidth}px`;
5586
+ s.height = bar ? "2px" : `${on.offsetHeight}px`;
5587
+ s.opacity = "1";
5588
+ }
5589
+ const vThumb = {
5590
+ mounted(el, b2) {
5591
+ if (getComputedStyle(el).position === "static") el.style.position = "relative";
5592
+ const thumb = document.createElement("span");
5593
+ thumb.className = `lf-thumb lf-thumb--${b2.value.kind ?? "fill"}`;
5594
+ thumb.setAttribute("aria-hidden", "true");
5595
+ el.prepend(thumb);
5596
+ const watchKids = () => {
5597
+ for (const c2 of Array.from(el.children)) if (c2 !== thumb) st.ro.observe(c2);
5598
+ };
5599
+ const st = { thumb, opt: b2.value, mo: new MutationObserver(() => {
5600
+ watchKids();
5601
+ placeThumb(el, st);
5602
+ }), ro: new ResizeObserver(() => placeThumb(el, st)), t: 0 };
5603
+ st.mo.observe(el, { subtree: true, attributes: true, attributeFilter: ["class"], childList: true, characterData: true });
5604
+ st.ro.observe(el);
5605
+ watchKids();
5606
+ placeThumb(el, st);
5607
+ st.t = window.setTimeout(() => thumb.classList.add("lf-thumb--ready"), 60);
5608
+ thumbs.set(el, st);
5609
+ },
5610
+ updated(el, b2) {
5611
+ const st = thumbs.get(el);
5612
+ if (!st) return;
5613
+ st.opt = b2.value;
5614
+ placeThumb(el, st);
5615
+ },
5616
+ unmounted(el) {
5617
+ const st = thumbs.get(el);
5618
+ if (!st) return;
5619
+ st.mo.disconnect();
5620
+ st.ro.disconnect();
5621
+ window.clearTimeout(st.t);
5622
+ thumbs.delete(el);
5623
+ }
5624
+ };
5625
+ const SHOW_MS = 350;
5626
+ function installTooltips() {
5627
+ if (typeof document === "undefined" || window.__lfTip) return;
5628
+ window.__lfTip = true;
5629
+ const tip = document.createElement("div");
5630
+ tip.className = "lf-tip";
5631
+ tip.setAttribute("role", "tooltip");
5632
+ document.body.appendChild(tip);
5633
+ let cur = null;
5634
+ let timer = 0;
5635
+ const obs = new MutationObserver(() => {
5636
+ if (!cur) return;
5637
+ const t = cur.getAttribute("title");
5638
+ if (t == null) return;
5639
+ cur.setAttribute("data-lf-title", t);
5640
+ cur.removeAttribute("title");
5641
+ if (t) {
5642
+ tip.textContent = t;
5643
+ if (tip.classList.contains("lf-tip--on")) place();
5644
+ } else hide();
5645
+ });
5646
+ function place() {
5647
+ if (!cur) return;
5648
+ const r = cur.getBoundingClientRect();
5649
+ const b2 = tip.getBoundingClientRect();
5650
+ const gap = 6;
5651
+ let top = r.top - b2.height - gap;
5652
+ if (top < 4) top = r.bottom + gap;
5653
+ let left = r.left + r.width / 2 - b2.width / 2;
5654
+ left = Math.max(4, Math.min(window.innerWidth - b2.width - 4, left));
5655
+ tip.style.transform = `translate(${Math.round(left)}px, ${Math.round(top)}px)`;
5656
+ }
5657
+ function hide() {
5658
+ clearTimeout(timer);
5659
+ tip.classList.remove("lf-tip--on");
5660
+ }
5661
+ function release() {
5662
+ hide();
5663
+ obs.disconnect();
5664
+ if (cur && cur.hasAttribute("data-lf-title")) {
5665
+ if (!cur.hasAttribute("title")) cur.setAttribute("title", cur.getAttribute("data-lf-title") || "");
5666
+ cur.removeAttribute("data-lf-title");
5667
+ }
5668
+ cur = null;
5669
+ }
5670
+ document.addEventListener("pointerover", (e3) => {
5671
+ var _a, _b;
5672
+ if (e3.pointerType === "touch") return;
5673
+ const el = (_b = (_a = e3.target) == null ? void 0 : _a.closest) == null ? void 0 : _b.call(_a, "[title]");
5674
+ if (!el || el === cur) return;
5675
+ const text = el.getAttribute("title") || "";
5676
+ release();
5677
+ if (!text.trim()) return;
5678
+ if (el.tagName === "IFRAME") return;
5679
+ cur = el;
5680
+ el.setAttribute("data-lf-title", text);
5681
+ el.removeAttribute("title");
5682
+ obs.observe(el, { attributes: true, attributeFilter: ["title"] });
5683
+ tip.textContent = text;
5684
+ timer = window.setTimeout(() => {
5685
+ if (cur !== el) return;
5686
+ tip.classList.add("lf-tip--on");
5687
+ place();
5688
+ }, SHOW_MS);
5689
+ }, true);
5690
+ document.addEventListener("pointerout", (e3) => {
5691
+ if (!cur) return;
5692
+ const to = e3.relatedTarget;
5693
+ if (to && cur.contains(to)) return;
5694
+ release();
5695
+ }, true);
5696
+ for (const ev of ["pointerdown", "wheel", "keydown"]) document.addEventListener(ev, () => hide(), true);
5697
+ window.addEventListener("blur", () => release());
5698
+ }
5699
+ function installConventions(app, opts = {}) {
5700
+ app.directive("thumb", vThumb);
5701
+ if (typeof document === "undefined") return;
5702
+ if (opts.tooltips !== false) installTooltips();
5703
+ if (opts.doneFeedback !== false) installDoneFeedback(useToastStore());
5704
+ }
5437
5705
  function useToast() {
5438
5706
  const store = useToastStore();
5439
5707
  return {
@@ -5492,8 +5760,9 @@ export {
5492
5760
  LfRankBars,
5493
5761
  LfScanInput,
5494
5762
  LfScoreRing,
5495
- e2 as LfSegmented,
5496
- f2 as LfSelect,
5763
+ e as LfSegmented,
5764
+ f as LfSelect,
5765
+ LfShellButton,
5497
5766
  LfSkeleton,
5498
5767
  LfSpinner,
5499
5768
  LfSplitPane,
@@ -5507,6 +5776,7 @@ export {
5507
5776
  LfTagInput,
5508
5777
  LfTextField,
5509
5778
  LfTextarea,
5779
+ LfThemeToggle,
5510
5780
  LfToolbar,
5511
5781
  LfTooltip,
5512
5782
  _sfc_main$p as LfTransitionList,
@@ -5514,20 +5784,26 @@ export {
5514
5784
  c as applySemanticPalette,
5515
5785
  applyTheme,
5516
5786
  d as colorToRgb,
5517
- e as contrastRatio,
5787
+ e2 as contrastRatio,
5518
5788
  createApiClient,
5519
- f as deriveSemanticPalette,
5789
+ f2 as deriveSemanticPalette,
5520
5790
  h as hexToRgb,
5521
5791
  initTheme,
5792
+ installConventions,
5793
+ installDoneFeedback,
5794
+ installTooltips,
5522
5795
  i as isLightBackground,
5523
5796
  isServicePath,
5524
5797
  l as luminance,
5798
+ markDone,
5525
5799
  serviceIdForPath,
5526
5800
  useConfirm,
5527
5801
  useConfirmStore,
5528
5802
  useLoadingStore,
5529
5803
  useTheme,
5804
+ useThumb,
5530
5805
  useToast,
5531
- useToastStore
5806
+ useToastStore,
5807
+ vThumb
5532
5808
  };
5533
5809
  //# sourceMappingURL=index.js.map