@loafacto/ui 0.16.2 → 0.16.4

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
@@ -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"
@@ -469,7 +469,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
469
469
  ], 8, _hoisted_7$a),
470
470
  createVNode(Transition, { name: "lf-shell-menu" }, {
471
471
  default: withCtx(() => [
472
- switcherOpen.value ? (openBlock(), createElementBlock("div", _hoisted_8$5, [
472
+ switcherOpen.value ? (openBlock(), createElementBlock("div", _hoisted_8$4, [
473
473
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.services, (svc) => {
474
474
  return openBlock(), createElementBlock("a", {
475
475
  key: svc.id,
@@ -675,7 +675,7 @@ const _hoisted_7$9 = {
675
675
  viewBox: "0 0 24 24",
676
676
  "aria-hidden": "true"
677
677
  };
678
- const _hoisted_8$4 = ["d"];
678
+ const _hoisted_8$3 = ["d"];
679
679
  const _sfc_main$x = /* @__PURE__ */ defineComponent({
680
680
  __name: "AppToast",
681
681
  setup(__props) {
@@ -735,7 +735,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
735
735
  createElementVNode("path", {
736
736
  d: ICON_PATHS.close,
737
737
  fill: "currentColor"
738
- }, null, 8, _hoisted_8$4)
738
+ }, null, 8, _hoisted_8$3)
739
739
  ]))
740
740
  ], 8, _hoisted_6$a)
741
741
  ], 10, _hoisted_2$q);
@@ -861,7 +861,7 @@ const _hoisted_7$8 = {
861
861
  key: 0,
862
862
  class: "app-confirm__require"
863
863
  };
864
- const _hoisted_8$3 = { class: "app-confirm__require-label" };
864
+ const _hoisted_8$2 = { class: "app-confirm__require-label" };
865
865
  const _hoisted_9$1 = { class: "app-confirm__actions" };
866
866
  const _hoisted_10$1 = ["disabled"];
867
867
  const _sfc_main$v = /* @__PURE__ */ defineComponent({
@@ -897,7 +897,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
897
897
  createElementVNode("div", _hoisted_5$d, [
898
898
  createElementVNode("p", _hoisted_6$9, toDisplayString(unref(store).message), 1),
899
899
  unref(store).requireText ? (openBlock(), createElementBlock("label", _hoisted_7$8, [
900
- createElementVNode("span", _hoisted_8$3, [
900
+ createElementVNode("span", _hoisted_8$2, [
901
901
  createTextVNode(toDisplayString(unref(store).requireLabel || "확인을 위해 입력") + ": ", 1),
902
902
  createElementVNode("code", null, toDisplayString(unref(store).requireText), 1)
903
903
  ]),
@@ -1630,7 +1630,7 @@ const _hoisted_7$7 = {
1630
1630
  class: "lf-radio-group__error",
1631
1631
  role: "alert"
1632
1632
  };
1633
- const _hoisted_8$2 = {
1633
+ const _hoisted_8$1 = {
1634
1634
  key: 2,
1635
1635
  class: "lf-radio-group__hint"
1636
1636
  };
@@ -1689,7 +1689,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
1689
1689
  ])
1690
1690
  ], 2);
1691
1691
  }), 128)),
1692
- __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)
1693
1693
  ], 2);
1694
1694
  };
1695
1695
  }
@@ -2722,21 +2722,20 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2722
2722
  }
2723
2723
  });
2724
2724
  const LfMenu = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-0318782c"]]);
2725
- const _hoisted_1$4 = { class: "lf-rail__list" };
2726
- const _hoisted_2$4 = {
2725
+ const _hoisted_1$4 = {
2727
2726
  key: 0,
2728
2727
  class: "lf-rail__group",
2729
2728
  role: "presentation"
2730
2729
  };
2731
- const _hoisted_3$3 = { class: "lf-rail__group-name" };
2732
- const _hoisted_4$2 = { class: "lf-rail__icon" };
2733
- 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 = {
2734
2733
  key: 2,
2735
2734
  class: "lf-rail__badge"
2736
2735
  };
2737
- const _hoisted_6$1 = { class: "lf-rail__name" };
2738
- const _hoisted_7$1 = { class: "lf-rail__short" };
2739
- 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" };
2740
2739
  const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2741
2740
  __name: "LfNavRail",
2742
2741
  props: {
@@ -2751,19 +2750,64 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2751
2750
  function linkAttrs(item) {
2752
2751
  return props.link === "a" ? { href: item.to } : { to: item.to };
2753
2752
  }
2753
+ const list = useTemplateRef("list");
2754
+ const thumb = ref(null);
2755
+ const instant = ref(true);
2756
+ let lastEl = null;
2757
+ function measure() {
2758
+ var _a;
2759
+ const el = ((_a = list.value) == null ? void 0 : _a.querySelector(".lf-rail__link--active, .lf-rail__link.router-link-active")) ?? null;
2760
+ const next = el && el.offsetWidth ? { x: el.offsetLeft, y: el.offsetTop, w: el.offsetWidth, h: el.offsetHeight } : null;
2761
+ const cur = thumb.value;
2762
+ if (cur && next && cur.x === next.x && cur.y === next.y && cur.w === next.w && cur.h === next.h) return;
2763
+ instant.value = !lastEl || el === lastEl || !cur;
2764
+ if (next) lastEl = el;
2765
+ thumb.value = next;
2766
+ }
2767
+ let mo = null;
2768
+ let ro = null;
2769
+ onMounted(() => {
2770
+ measure();
2771
+ if (!list.value) return;
2772
+ if (typeof MutationObserver !== "undefined") {
2773
+ mo = new MutationObserver(() => measure());
2774
+ mo.observe(list.value, { subtree: true, attributes: true, attributeFilter: ["class"] });
2775
+ }
2776
+ if (typeof ResizeObserver !== "undefined") {
2777
+ ro = new ResizeObserver(() => measure());
2778
+ ro.observe(list.value);
2779
+ }
2780
+ });
2781
+ onBeforeUnmount(() => {
2782
+ mo == null ? void 0 : mo.disconnect();
2783
+ ro == null ? void 0 : ro.disconnect();
2784
+ });
2785
+ watch(() => [props.current, props.items.length], () => {
2786
+ void nextTick(measure);
2787
+ });
2754
2788
  function isActive(item) {
2755
2789
  if (props.current === void 0) return false;
2756
2790
  return props.current === item.to || props.current.startsWith(`${item.to}/`);
2757
2791
  }
2758
2792
  return (_ctx, _cache) => {
2759
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
2793
+ return openBlock(), createElementBlock("div", {
2794
+ ref_key: "list",
2795
+ ref: list,
2796
+ class: normalizeClass(["lf-rail__list", { "lf-rail__list--thumb": thumb.value }])
2797
+ }, [
2798
+ thumb.value ? (openBlock(), createElementBlock("span", {
2799
+ key: 0,
2800
+ class: normalizeClass(["lf-rail__thumb", { "lf-rail__thumb--instant": instant.value }]),
2801
+ style: normalizeStyle({ transform: `translate(${thumb.value.x}px, ${thumb.value.y}px)`, width: `${thumb.value.w}px`, height: `${thumb.value.h}px` }),
2802
+ "aria-hidden": "true"
2803
+ }, null, 6)) : createCommentVNode("", true),
2760
2804
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, index) => {
2761
2805
  var _a;
2762
2806
  return openBlock(), createElementBlock(Fragment, {
2763
2807
  key: item.to
2764
2808
  }, [
2765
- item.group && item.group !== ((_a = __props.items[index - 1]) == null ? void 0 : _a.group) ? (openBlock(), createElementBlock("div", _hoisted_2$4, [
2766
- createElementVNode("span", _hoisted_3$3, toDisplayString(item.group), 1)
2809
+ item.group && item.group !== ((_a = __props.items[index - 1]) == null ? void 0 : _a.group) ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
2810
+ createElementVNode("span", _hoisted_2$4, toDisplayString(item.group), 1)
2767
2811
  ])) : createCommentVNode("", true),
2768
2812
  (openBlock(), createBlock(resolveDynamicComponent(__props.link), mergeProps({ ref_for: true }, linkAttrs(item), {
2769
2813
  class: ["lf-rail__link", { "lf-rail__link--active": isActive(item), "lf-rail__link--bottom": item.bottom }],
@@ -2772,7 +2816,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2772
2816
  onClick: ($event) => emit("navigate", item)
2773
2817
  }), {
2774
2818
  default: withCtx(() => [
2775
- createElementVNode("span", _hoisted_4$2, [
2819
+ createElementVNode("span", _hoisted_3$3, [
2776
2820
  item.iconPath ? (openBlock(), createBlock(LfIcon, {
2777
2821
  key: 0,
2778
2822
  path: item.iconPath,
@@ -2782,22 +2826,22 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2782
2826
  name: item.icon,
2783
2827
  size: "1.15rem"
2784
2828
  }, null, 8, ["name"])) : createCommentVNode("", true),
2785
- item.badge ? (openBlock(), createElementBlock("span", _hoisted_5$1, toDisplayString(item.badge), 1)) : createCommentVNode("", true)
2829
+ item.badge ? (openBlock(), createElementBlock("span", _hoisted_4$2, toDisplayString(item.badge), 1)) : createCommentVNode("", true)
2786
2830
  ]),
2787
- createElementVNode("span", _hoisted_6$1, [
2788
- createElementVNode("span", _hoisted_7$1, toDisplayString(item.short ?? item.label), 1),
2789
- createElementVNode("span", _hoisted_8$1, toDisplayString(item.label), 1)
2831
+ createElementVNode("span", _hoisted_5$1, [
2832
+ createElementVNode("span", _hoisted_6$1, toDisplayString(item.short ?? item.label), 1),
2833
+ createElementVNode("span", _hoisted_7$1, toDisplayString(item.label), 1)
2790
2834
  ])
2791
2835
  ]),
2792
2836
  _: 2
2793
2837
  }, 1040, ["class", "title", "aria-label", "onClick"]))
2794
2838
  ], 64);
2795
2839
  }), 128))
2796
- ]);
2840
+ ], 2);
2797
2841
  };
2798
2842
  }
2799
2843
  });
2800
- const LfNavRail = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-1af1c379"]]);
2844
+ const LfNavRail = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-a29be44a"]]);
2801
2845
  const _hoisted_1$3 = ["aria-label"];
2802
2846
  const _hoisted_2$3 = ["aria-checked", "aria-label", "title", "disabled", "onClick"];
2803
2847
  const _hoisted_3$2 = {
@@ -2830,10 +2874,17 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2830
2874
  );
2831
2875
  const root = useTemplateRef("root");
2832
2876
  const thumb = ref(null);
2877
+ const instant = ref(true);
2878
+ let lastEl = null;
2833
2879
  function measure() {
2834
2880
  var _a;
2835
- const el = (_a = root.value) == null ? void 0 : _a.querySelector(".lf-seg__btn--on");
2836
- thumb.value = el ? { x: el.offsetLeft, w: el.offsetWidth } : null;
2881
+ const el = ((_a = root.value) == null ? void 0 : _a.querySelector(".lf-seg__btn--on")) ?? null;
2882
+ const next = el && el.offsetWidth ? { x: el.offsetLeft, w: el.offsetWidth } : null;
2883
+ const cur = thumb.value;
2884
+ if (cur && next && cur.x === next.x && cur.w === next.w) return;
2885
+ instant.value = !lastEl || el === lastEl || !cur;
2886
+ if (next) lastEl = el;
2887
+ thumb.value = next;
2837
2888
  }
2838
2889
  watch(() => [model.value, normalized.value.length], () => {
2839
2890
  void nextTick(measure);
@@ -2861,10 +2912,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2861
2912
  }, [
2862
2913
  thumb.value ? (openBlock(), createElementBlock("span", {
2863
2914
  key: 0,
2864
- class: "lf-seg__thumb",
2915
+ class: normalizeClass(["lf-seg__thumb", { "lf-seg__thumb--instant": instant.value }]),
2865
2916
  style: normalizeStyle({ transform: `translateX(${thumb.value.x}px)`, width: `${thumb.value.w}px` }),
2866
2917
  "aria-hidden": "true"
2867
- }, null, 4)) : createCommentVNode("", true),
2918
+ }, null, 6)) : createCommentVNode("", true),
2868
2919
  (openBlock(true), createElementBlock(Fragment, null, renderList(normalized.value, (opt) => {
2869
2920
  return openBlock(), createElementBlock("button", {
2870
2921
  key: String(opt.value),
@@ -2889,7 +2940,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2889
2940
  };
2890
2941
  }
2891
2942
  });
2892
- const LfSegmented = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-474f0f2f"]]);
2943
+ const LfSegmented = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-10fad8e3"]]);
2893
2944
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2894
2945
  __name: "LfTransitionList",
2895
2946
  props: {