@loafacto/ui 0.16.1 → 0.16.3

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,4 +1,4 @@
1
- import type { Component } from 'vue';
1
+ import { type Component } from 'vue';
2
2
  import type { RailItem } from '../types';
3
3
  type __VLS_Props = {
4
4
  items: RailItem[];
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { readonly, ref, openBlock, createElementBlock, createStaticVNode, createElementVNode, defineComponent, computed, watch, onBeforeUnmount, normalizeClass, normalizeStyle, createCommentVNode, Fragment, toDisplayString, createVNode, Transition, withCtx, renderList, renderSlot, unref, onUnmounted, createBlock, Teleport, TransitionGroup, withModifiers, useTemplateRef, onMounted, nextTick, createTextVNode, withDirectives, withKeys, vModelText, resolveDynamicComponent, useAttrs, useModel, useId, mergeProps, isRef, vModelDynamic, mergeModels, vModelSelect, vModelCheckbox, vModelRadio, useSlots } from "vue";
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, useAttrs, useModel, useId, mergeProps, isRef, vModelDynamic, mergeModels, vModelSelect, vModelCheckbox, vModelRadio, useSlots } from "vue";
2
2
  import { a as applyTheme, D as DARK_THEME, L as LIGHT_THEME } from "./applyTheme-8AxcQbPB.js";
3
3
  import { b, c, d, e, f, h, i, l } from "./applyTheme-8AxcQbPB.js";
4
4
  import { defineStore } from "pinia";
@@ -206,7 +206,7 @@ const _hoisted_4$j = ["href", "aria-label"];
206
206
  const _hoisted_5$f = ["src"];
207
207
  const _hoisted_6$b = { class: "lf-brand__name" };
208
208
  const _hoisted_7$a = ["aria-expanded"];
209
- const _hoisted_8$5 = {
209
+ const _hoisted_8$4 = {
210
210
  key: 0,
211
211
  class: "lf-switcher__menu",
212
212
  role: "menu"
@@ -253,18 +253,14 @@ const _hoisted_24 = {
253
253
  };
254
254
  const _hoisted_25 = ["d"];
255
255
  const _hoisted_26 = ["title", "aria-label"];
256
- const _hoisted_27 = {
257
- viewBox: "0 0 24 24",
258
- "aria-hidden": "true"
259
- };
260
- const _hoisted_28 = ["d"];
261
- const _hoisted_29 = { class: "lf-content lf-content--rail" };
262
- const _hoisted_30 = {
256
+ const _hoisted_27 = ["d"];
257
+ const _hoisted_28 = { class: "lf-content lf-content--rail" };
258
+ const _hoisted_29 = {
263
259
  key: 2,
264
260
  class: "lf-content"
265
261
  };
266
- const _hoisted_31 = { class: "site-footer" };
267
- const _hoisted_32 = { class: "site-footer-inner" };
262
+ const _hoisted_30 = { class: "site-footer" };
263
+ const _hoisted_31 = { class: "site-footer-inner" };
268
264
  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";
269
265
  const ICON_MOON = "M12.3 3a7 7 0 1 0 8.7 8.7A9 9 0 1 1 12.3 3z";
270
266
  const RAIL_KEY = "lf-rail-hidden";
@@ -287,6 +283,28 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
287
283
  emits: ["navigate"],
288
284
  setup(__props, { emit: __emit }) {
289
285
  const { mode: mode2, toggle } = useTheme();
286
+ const spun = ref(false);
287
+ function onThemeClick() {
288
+ var _a;
289
+ spun.value = true;
290
+ const doc = document;
291
+ const reduce = typeof window !== "undefined" && ((_a = window.matchMedia) == null ? void 0 : _a.call(window, "(prefers-reduced-motion: reduce)").matches);
292
+ if (!doc.startViewTransition || reduce) {
293
+ toggle();
294
+ return;
295
+ }
296
+ const root = document.documentElement;
297
+ root.classList.add("lf-theme-switching");
298
+ try {
299
+ doc.startViewTransition(async () => {
300
+ toggle();
301
+ await nextTick();
302
+ }).finished.finally(() => root.classList.remove("lf-theme-switching"));
303
+ } catch {
304
+ root.classList.remove("lf-theme-switching");
305
+ toggle();
306
+ }
307
+ }
290
308
  const props = __props;
291
309
  const emit = __emit;
292
310
  const switcherOpen = ref(false);
@@ -395,7 +413,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
395
413
  title: railHidden.value ? "메뉴 열기" : "메뉴 닫기",
396
414
  "aria-expanded": !railHidden.value,
397
415
  onClick: toggleRail
398
- }, [..._cache[6] || (_cache[6] = [
416
+ }, [..._cache[5] || (_cache[5] = [
399
417
  createElementVNode("svg", {
400
418
  viewBox: "0 0 24 24",
401
419
  "aria-hidden": "true"
@@ -438,7 +456,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
438
456
  onClick: _cache[1] || (_cache[1] = ($event) => switcherOpen.value = !switcherOpen.value)
439
457
  }, [
440
458
  createElementVNode("span", null, toDisplayString(((_a = currentService.value) == null ? void 0 : _a.name) ?? "서비스"), 1),
441
- _cache[7] || (_cache[7] = createElementVNode("svg", {
459
+ _cache[6] || (_cache[6] = createElementVNode("svg", {
442
460
  class: "lf-switcher__caret",
443
461
  viewBox: "0 0 24 24",
444
462
  "aria-hidden": "true"
@@ -451,7 +469,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
451
469
  ], 8, _hoisted_7$a),
452
470
  createVNode(Transition, { name: "lf-shell-menu" }, {
453
471
  default: withCtx(() => [
454
- switcherOpen.value ? (openBlock(), createElementBlock("div", _hoisted_8$5, [
472
+ switcherOpen.value ? (openBlock(), createElementBlock("div", _hoisted_8$4, [
455
473
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.services, (svc) => {
456
474
  return openBlock(), createElementBlock("a", {
457
475
  key: svc.id,
@@ -478,7 +496,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
478
496
  _: 1
479
497
  })
480
498
  ], 512)) : createCommentVNode("", true),
481
- _cache[9] || (_cache[9] = createElementVNode("div", { class: "lf-topbar__spacer" }, null, -1)),
499
+ _cache[8] || (_cache[8] = createElementVNode("div", { class: "lf-topbar__spacer" }, null, -1)),
482
500
  __props.user ? (openBlock(), createElementBlock("div", {
483
501
  key: 2,
484
502
  ref_key: "userEl",
@@ -499,7 +517,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
499
517
  class: "lf-user__avatar"
500
518
  }, null, 8, _hoisted_16)) : (openBlock(), createElementBlock("span", _hoisted_17, toDisplayString(userInitial.value), 1)),
501
519
  createElementVNode("span", _hoisted_18, toDisplayString(__props.user.displayName), 1),
502
- _cache[8] || (_cache[8] = createElementVNode("svg", {
520
+ _cache[7] || (_cache[7] = createElementVNode("svg", {
503
521
  class: "lf-user__caret",
504
522
  viewBox: "0 0 24 24",
505
523
  "aria-hidden": "true"
@@ -560,15 +578,19 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
560
578
  class: "lf-glass lf-icon-btn",
561
579
  title: unref(mode2) === "dark" ? "밝은 테마로" : "어두운 테마로",
562
580
  "aria-label": unref(mode2) === "dark" ? "밝은 테마로 전환" : "어두운 테마로 전환",
563
- onClick: _cache[4] || (_cache[4] = //@ts-ignore
564
- (...args) => unref(toggle) && unref(toggle)(...args))
581
+ onClick: onThemeClick
565
582
  }, [
566
- (openBlock(), createElementBlock("svg", _hoisted_27, [
583
+ (openBlock(), createElementBlock("svg", {
584
+ key: unref(mode2),
585
+ viewBox: "0 0 24 24",
586
+ "aria-hidden": "true",
587
+ class: normalizeClass({ "lf-theme-icon--spin": spun.value })
588
+ }, [
567
589
  createElementVNode("path", {
568
590
  d: unref(mode2) === "dark" ? ICON_MOON : ICON_SUN,
569
591
  fill: "currentColor"
570
- }, null, 8, _hoisted_28)
571
- ]))
592
+ }, null, 8, _hoisted_27)
593
+ ], 2))
572
594
  ], 8, _hoisted_26)) : createCommentVNode("", true),
573
595
  renderSlot(_ctx.$slots, "actions", {}, void 0, true)
574
596
  ])
@@ -580,20 +602,20 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
580
602
  createElementVNode("nav", {
581
603
  class: normalizeClass(["lf-rail", { "lf-rail--open": railOpen.value, "lf-rail--hidden": railHidden.value, "lf-rail--overlay": railOverlay.value }]),
582
604
  "aria-label": "메뉴",
583
- onClick: _cache[5] || (_cache[5] = ($event) => railOpen.value = false)
605
+ onClick: _cache[4] || (_cache[4] = ($event) => railOpen.value = false)
584
606
  }, [
585
607
  renderSlot(_ctx.$slots, "rail", {}, void 0, true)
586
608
  ], 2),
587
- createElementVNode("main", _hoisted_29, [
609
+ createElementVNode("main", _hoisted_28, [
588
610
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
589
611
  ])
590
- ], 2)) : (openBlock(), createElementBlock("main", _hoisted_30, [
612
+ ], 2)) : (openBlock(), createElementBlock("main", _hoisted_29, [
591
613
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
592
614
  ])),
593
- createElementVNode("footer", _hoisted_31, [
594
- createElementVNode("div", _hoisted_32, [
615
+ createElementVNode("footer", _hoisted_30, [
616
+ createElementVNode("div", _hoisted_31, [
595
617
  renderSlot(_ctx.$slots, "footer", {}, () => [
596
- _cache[10] || (_cache[10] = createElementVNode("p", { class: "site-footer-copy" }, "© Loafacto. All rights reserved.", -1))
618
+ _cache[9] || (_cache[9] = createElementVNode("p", { class: "site-footer-copy" }, "© Loafacto. All rights reserved.", -1))
597
619
  ], true)
598
620
  ])
599
621
  ])
@@ -601,7 +623,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
601
623
  };
602
624
  }
603
625
  });
604
- const AppShell = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-0e48f886"]]);
626
+ const AppShell = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-ff76069c"]]);
605
627
  function generateId() {
606
628
  return `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
607
629
  }
@@ -653,7 +675,7 @@ const _hoisted_7$9 = {
653
675
  viewBox: "0 0 24 24",
654
676
  "aria-hidden": "true"
655
677
  };
656
- const _hoisted_8$4 = ["d"];
678
+ const _hoisted_8$3 = ["d"];
657
679
  const _sfc_main$x = /* @__PURE__ */ defineComponent({
658
680
  __name: "AppToast",
659
681
  setup(__props) {
@@ -713,7 +735,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
713
735
  createElementVNode("path", {
714
736
  d: ICON_PATHS.close,
715
737
  fill: "currentColor"
716
- }, null, 8, _hoisted_8$4)
738
+ }, null, 8, _hoisted_8$3)
717
739
  ]))
718
740
  ], 8, _hoisted_6$a)
719
741
  ], 10, _hoisted_2$q);
@@ -839,7 +861,7 @@ const _hoisted_7$8 = {
839
861
  key: 0,
840
862
  class: "app-confirm__require"
841
863
  };
842
- const _hoisted_8$3 = { class: "app-confirm__require-label" };
864
+ const _hoisted_8$2 = { class: "app-confirm__require-label" };
843
865
  const _hoisted_9$1 = { class: "app-confirm__actions" };
844
866
  const _hoisted_10$1 = ["disabled"];
845
867
  const _sfc_main$v = /* @__PURE__ */ defineComponent({
@@ -875,7 +897,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
875
897
  createElementVNode("div", _hoisted_5$d, [
876
898
  createElementVNode("p", _hoisted_6$9, toDisplayString(unref(store).message), 1),
877
899
  unref(store).requireText ? (openBlock(), createElementBlock("label", _hoisted_7$8, [
878
- createElementVNode("span", _hoisted_8$3, [
900
+ createElementVNode("span", _hoisted_8$2, [
879
901
  createTextVNode(toDisplayString(unref(store).requireLabel || "확인을 위해 입력") + ": ", 1),
880
902
  createElementVNode("code", null, toDisplayString(unref(store).requireText), 1)
881
903
  ]),
@@ -1608,7 +1630,7 @@ const _hoisted_7$7 = {
1608
1630
  class: "lf-radio-group__error",
1609
1631
  role: "alert"
1610
1632
  };
1611
- const _hoisted_8$2 = {
1633
+ const _hoisted_8$1 = {
1612
1634
  key: 2,
1613
1635
  class: "lf-radio-group__hint"
1614
1636
  };
@@ -1667,7 +1689,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
1667
1689
  ])
1668
1690
  ], 2);
1669
1691
  }), 128)),
1670
- __props.error ? (openBlock(), createElementBlock("p", _hoisted_7$7, toDisplayString(__props.error), 1)) : __props.hint ? (openBlock(), createElementBlock("p", _hoisted_8$2, toDisplayString(__props.hint), 1)) : createCommentVNode("", true)
1692
+ __props.error ? (openBlock(), createElementBlock("p", _hoisted_7$7, toDisplayString(__props.error), 1)) : __props.hint ? (openBlock(), createElementBlock("p", _hoisted_8$1, toDisplayString(__props.hint), 1)) : createCommentVNode("", true)
1671
1693
  ], 2);
1672
1694
  };
1673
1695
  }
@@ -2700,21 +2722,20 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2700
2722
  }
2701
2723
  });
2702
2724
  const LfMenu = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-0318782c"]]);
2703
- const _hoisted_1$4 = { class: "lf-rail__list" };
2704
- const _hoisted_2$4 = {
2725
+ const _hoisted_1$4 = {
2705
2726
  key: 0,
2706
2727
  class: "lf-rail__group",
2707
2728
  role: "presentation"
2708
2729
  };
2709
- const _hoisted_3$3 = { class: "lf-rail__group-name" };
2710
- const _hoisted_4$2 = { class: "lf-rail__icon" };
2711
- const _hoisted_5$1 = {
2730
+ const _hoisted_2$4 = { class: "lf-rail__group-name" };
2731
+ const _hoisted_3$3 = { class: "lf-rail__icon" };
2732
+ const _hoisted_4$2 = {
2712
2733
  key: 2,
2713
2734
  class: "lf-rail__badge"
2714
2735
  };
2715
- const _hoisted_6$1 = { class: "lf-rail__name" };
2716
- const _hoisted_7$1 = { class: "lf-rail__short" };
2717
- const _hoisted_8$1 = { class: "lf-rail__long" };
2736
+ const _hoisted_5$1 = { class: "lf-rail__name" };
2737
+ const _hoisted_6$1 = { class: "lf-rail__short" };
2738
+ const _hoisted_7$1 = { class: "lf-rail__long" };
2718
2739
  const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2719
2740
  __name: "LfNavRail",
2720
2741
  props: {
@@ -2729,19 +2750,60 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2729
2750
  function linkAttrs(item) {
2730
2751
  return props.link === "a" ? { href: item.to } : { to: item.to };
2731
2752
  }
2753
+ const list = useTemplateRef("list");
2754
+ const thumb = ref(null);
2755
+ function measure() {
2756
+ var _a;
2757
+ const el = (_a = list.value) == null ? void 0 : _a.querySelector(".lf-rail__link--active, .lf-rail__link.router-link-active");
2758
+ const next = el ? { x: el.offsetLeft, y: el.offsetTop, w: el.offsetWidth, h: el.offsetHeight } : null;
2759
+ const cur = thumb.value;
2760
+ if (cur && next && cur.x === next.x && cur.y === next.y && cur.w === next.w && cur.h === next.h) return;
2761
+ thumb.value = next;
2762
+ }
2763
+ let mo = null;
2764
+ let ro = null;
2765
+ onMounted(() => {
2766
+ measure();
2767
+ if (!list.value) return;
2768
+ if (typeof MutationObserver !== "undefined") {
2769
+ mo = new MutationObserver(() => measure());
2770
+ mo.observe(list.value, { subtree: true, attributes: true, attributeFilter: ["class"] });
2771
+ }
2772
+ if (typeof ResizeObserver !== "undefined") {
2773
+ ro = new ResizeObserver(() => measure());
2774
+ ro.observe(list.value);
2775
+ }
2776
+ });
2777
+ onBeforeUnmount(() => {
2778
+ mo == null ? void 0 : mo.disconnect();
2779
+ ro == null ? void 0 : ro.disconnect();
2780
+ });
2781
+ watch(() => [props.current, props.items.length], () => {
2782
+ void nextTick(measure);
2783
+ });
2732
2784
  function isActive(item) {
2733
2785
  if (props.current === void 0) return false;
2734
2786
  return props.current === item.to || props.current.startsWith(`${item.to}/`);
2735
2787
  }
2736
2788
  return (_ctx, _cache) => {
2737
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
2789
+ return openBlock(), createElementBlock("div", {
2790
+ ref_key: "list",
2791
+ ref: list,
2792
+ class: normalizeClass(["lf-rail__list", { "lf-rail__list--thumb": thumb.value }])
2793
+ }, [
2794
+ thumb.value ? (openBlock(), createElementBlock("span", {
2795
+ key: 0,
2796
+ class: "lf-rail__thumb",
2797
+ style: normalizeStyle({ transform: `translate(${thumb.value.x}px, ${thumb.value.y}px)`, width: `${thumb.value.w}px`, height: `${thumb.value.h}px` }),
2798
+ "aria-hidden": "true"
2799
+ }, null, 4)) : createCommentVNode("", true),
2738
2800
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, index) => {
2739
2801
  var _a;
2740
2802
  return openBlock(), createElementBlock(Fragment, {
2741
2803
  key: item.to
2742
2804
  }, [
2743
- item.group && item.group !== ((_a = __props.items[index - 1]) == null ? void 0 : _a.group) ? (openBlock(), createElementBlock("div", _hoisted_2$4, [
2744
- createElementVNode("span", _hoisted_3$3, toDisplayString(item.group), 1)
2805
+ item.group && item.group !== ((_a = __props.items[index - 1]) == null ? void 0 : _a.group) ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
2806
+ createElementVNode("span", _hoisted_2$4, toDisplayString(item.group), 1)
2745
2807
  ])) : createCommentVNode("", true),
2746
2808
  (openBlock(), createBlock(resolveDynamicComponent(__props.link), mergeProps({ ref_for: true }, linkAttrs(item), {
2747
2809
  class: ["lf-rail__link", { "lf-rail__link--active": isActive(item), "lf-rail__link--bottom": item.bottom }],
@@ -2750,7 +2812,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2750
2812
  onClick: ($event) => emit("navigate", item)
2751
2813
  }), {
2752
2814
  default: withCtx(() => [
2753
- createElementVNode("span", _hoisted_4$2, [
2815
+ createElementVNode("span", _hoisted_3$3, [
2754
2816
  item.iconPath ? (openBlock(), createBlock(LfIcon, {
2755
2817
  key: 0,
2756
2818
  path: item.iconPath,
@@ -2760,22 +2822,22 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2760
2822
  name: item.icon,
2761
2823
  size: "1.15rem"
2762
2824
  }, null, 8, ["name"])) : createCommentVNode("", true),
2763
- item.badge ? (openBlock(), createElementBlock("span", _hoisted_5$1, toDisplayString(item.badge), 1)) : createCommentVNode("", true)
2825
+ item.badge ? (openBlock(), createElementBlock("span", _hoisted_4$2, toDisplayString(item.badge), 1)) : createCommentVNode("", true)
2764
2826
  ]),
2765
- createElementVNode("span", _hoisted_6$1, [
2766
- createElementVNode("span", _hoisted_7$1, toDisplayString(item.short ?? item.label), 1),
2767
- createElementVNode("span", _hoisted_8$1, toDisplayString(item.label), 1)
2827
+ createElementVNode("span", _hoisted_5$1, [
2828
+ createElementVNode("span", _hoisted_6$1, toDisplayString(item.short ?? item.label), 1),
2829
+ createElementVNode("span", _hoisted_7$1, toDisplayString(item.label), 1)
2768
2830
  ])
2769
2831
  ]),
2770
2832
  _: 2
2771
2833
  }, 1040, ["class", "title", "aria-label", "onClick"]))
2772
2834
  ], 64);
2773
2835
  }), 128))
2774
- ]);
2836
+ ], 2);
2775
2837
  };
2776
2838
  }
2777
2839
  });
2778
- const LfNavRail = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-1af1c379"]]);
2840
+ const LfNavRail = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-690fde3f"]]);
2779
2841
  const _hoisted_1$3 = ["aria-label"];
2780
2842
  const _hoisted_2$3 = ["aria-checked", "aria-label", "title", "disabled", "onClick"];
2781
2843
  const _hoisted_3$2 = {