@loafacto/ui 0.20.0 → 0.22.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-BjlkJm2I.js";
5
- import { e as e2, f as f2 } from "./LfSegmented-BjlkJm2I.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-fd060854"]]);
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
  }
@@ -2621,7 +2695,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
2621
2695
  };
2622
2696
  }
2623
2697
  });
2624
- const LfNavRail = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-dfb20796"]]);
2698
+ const LfNavRail = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-61385110"]]);
2625
2699
  const _sfc_main$p = /* @__PURE__ */ defineComponent({
2626
2700
  __name: "LfTransitionList",
2627
2701
  props: {
@@ -5686,8 +5760,9 @@ export {
5686
5760
  LfRankBars,
5687
5761
  LfScanInput,
5688
5762
  LfScoreRing,
5689
- e2 as LfSegmented,
5690
- f2 as LfSelect,
5763
+ e as LfSegmented,
5764
+ f as LfSelect,
5765
+ LfShellButton,
5691
5766
  LfSkeleton,
5692
5767
  LfSpinner,
5693
5768
  LfSplitPane,
@@ -5701,6 +5776,7 @@ export {
5701
5776
  LfTagInput,
5702
5777
  LfTextField,
5703
5778
  LfTextarea,
5779
+ LfThemeToggle,
5704
5780
  LfToolbar,
5705
5781
  LfTooltip,
5706
5782
  _sfc_main$p as LfTransitionList,
@@ -5708,9 +5784,9 @@ export {
5708
5784
  c as applySemanticPalette,
5709
5785
  applyTheme,
5710
5786
  d as colorToRgb,
5711
- e as contrastRatio,
5787
+ e2 as contrastRatio,
5712
5788
  createApiClient,
5713
- f as deriveSemanticPalette,
5789
+ f2 as deriveSemanticPalette,
5714
5790
  h as hexToRgb,
5715
5791
  initTheme,
5716
5792
  installConventions,