@wow-two-beta/fe 0.0.21 → 0.0.22

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 { defineComponent, useAttrs, computed, useTemplateRef, openBlock, createElementBlock, mergeProps, unref, normalizeClass, createElementVNode, createVNode, ref, createCommentVNode, nextTick, useSlots, createBlock, withCtx, renderSlot, createTextVNode, toDisplayString, createSlots, inject, watch, provide, shallowRef, Fragment, renderList, onBeforeUnmount, onMounted, normalizeStyle, withModifiers, useId as useId$1, toHandlers, resolveComponent, resolveDynamicComponent, toValue, withKeys, onUpdated } from "vue";
1
+ import { defineComponent, useAttrs, computed, useTemplateRef, openBlock, createElementBlock, mergeProps, unref, normalizeClass, createElementVNode, createVNode, ref, createCommentVNode, nextTick, useSlots, createBlock, withCtx, renderSlot, createTextVNode, toDisplayString, createSlots, inject, watch, provide, shallowRef, Fragment, renderList, onBeforeUnmount, onMounted, normalizeStyle, onErrorCaptured, h, Teleport, withModifiers, useId as useId$1, toHandlers, resolveComponent, resolveDynamicComponent, toValue, withKeys, onUpdated } from "vue";
2
2
  import { x as useNativeFormReset, e as _sfc_main$21, c as _sfc_main$23, _ as _sfc_main$24, f as _sfc_main$26, y as buildMonthGrid, s as addDays, A as sundayIndex, B as addMonths, D as isSameDay, v as isToday, E as startOfMonth, p as today, F as isDateDisabled, G as formatISODate, H as parseISODate, I as normalizeMinuteStep, J as isTimeInBounds, K as clampTime, L as formatISODateTime, M as clampDate, N as parseISODateTime, O as clampDateTime, P as isDateTimeInBounds, Q as formatISOTime, R as isInRange, S as SwatchShape, a as _sfc_main$2e, b as ColorSwatchPreviewSize, g as _sfc_main$2g, U as daysInMonth, d as _sfc_main$2h, i as _sfc_main$2k, j as _sfc_main$2l, h as _sfc_main$2m } from "./FieldHelperText.vue_vue_type_script_setup_true_lang-eqG5AyoV.js";
3
3
  import { c as cn } from "./Cn-C7De6POU.js";
4
4
  import { u as useControlled } from "./UseControlled-BQneb7BW.js";
@@ -3065,7 +3065,7 @@ const _sfc_main$1x = /* @__PURE__ */ defineComponent({
3065
3065
  default: () => props.defaultValue ?? null,
3066
3066
  onChange: (value) => emit("update:modelValue", value)
3067
3067
  });
3068
- const items = shallowRef([]);
3068
+ const registrations = shallowRef([]);
3069
3069
  const labelCache = /* @__PURE__ */ new Map();
3070
3070
  function cachedKey(key) {
3071
3071
  if (!props.keyEquals || labelCache.has(key)) return key;
@@ -3090,29 +3090,35 @@ const _sfc_main$1x = /* @__PURE__ */ defineComponent({
3090
3090
  const fn = props.getOptionLabel;
3091
3091
  return fn ? fn(key) : null;
3092
3092
  }
3093
- function registerItem(entry) {
3093
+ function registerItem(owner, entry) {
3094
3094
  cacheLabel(entry.itemKey, entry.label);
3095
- const list = items.value;
3096
- const idx = list.findIndex((i) => Object.is(i.itemKey, entry.itemKey));
3097
- if (idx >= 0) {
3098
- const existing = list[idx];
3099
- if (existing && existing.label === entry.label && existing.text === entry.text && existing.isDisabled === entry.isDisabled && Object.is(existing.value, entry.value)) {
3100
- return;
3101
- }
3102
- const next = list.slice();
3103
- next[idx] = entry;
3104
- items.value = next;
3095
+ const list = registrations.value;
3096
+ const idx = list.findIndex((r) => r.owner === owner);
3097
+ if (idx === -1) {
3098
+ registrations.value = [...list, { owner, entry }];
3105
3099
  return;
3106
3100
  }
3107
- items.value = [...list, entry];
3101
+ const existing = list[idx]?.entry;
3102
+ if (existing && Object.is(existing.itemKey, entry.itemKey) && existing.label === entry.label && existing.text === entry.text && existing.isDisabled === entry.isDisabled && Object.is(existing.value, entry.value)) {
3103
+ return;
3104
+ }
3105
+ const next = list.slice();
3106
+ next[idx] = { owner, entry };
3107
+ registrations.value = next;
3108
3108
  }
3109
- function unregisterItem(itemKey) {
3110
- const idx = items.value.findIndex((i) => Object.is(i.itemKey, itemKey));
3111
- if (idx === -1) return;
3112
- const next = items.value.slice();
3113
- next.splice(idx, 1);
3114
- items.value = next;
3109
+ function unregisterItem(owner) {
3110
+ const list = registrations.value;
3111
+ if (!list.some((r) => r.owner === owner)) return;
3112
+ registrations.value = list.filter((r) => r.owner !== owner);
3115
3113
  }
3114
+ const items = computed(() => {
3115
+ const equals = keyEqualsFn.value;
3116
+ const unique = [];
3117
+ for (const { entry } of registrations.value) {
3118
+ if (!unique.some((i) => equals(i.itemKey, entry.itemKey))) unique.push(entry);
3119
+ }
3120
+ return unique;
3121
+ });
3116
3122
  function getCachedLabel(key) {
3117
3123
  return labelCache.get(cachedKey(key));
3118
3124
  }
@@ -3147,6 +3153,12 @@ const _sfc_main$1x = /* @__PURE__ */ defineComponent({
3147
3153
  { immediate: true }
3148
3154
  );
3149
3155
  const hasSelection = computed(() => keyCtl.value.value !== null && keyCtl.value.value !== void 0);
3156
+ const needsOptionCollection = computed(() => {
3157
+ const seeds = seedItems.value;
3158
+ if (seeds.length === 0) return true;
3159
+ if (!hasSelection.value) return false;
3160
+ return !seeds.some((seed) => keyEqualsFn.value(seed.itemKey, keyCtl.value.value));
3161
+ });
3150
3162
  const selectedLabel = computed(() => {
3151
3163
  const captured = selectedEntry.value;
3152
3164
  if (!captured || !hasSelection.value) return null;
@@ -3196,6 +3208,9 @@ const _sfc_main$1x = /* @__PURE__ */ defineComponent({
3196
3208
  },
3197
3209
  registerItem,
3198
3210
  unregisterItem,
3211
+ get needsOptionCollection() {
3212
+ return needsOptionCollection.value;
3213
+ },
3199
3214
  getCachedLabel,
3200
3215
  get query() {
3201
3216
  return query.value;
@@ -3535,6 +3550,30 @@ const _sfc_main$1v = /* @__PURE__ */ defineComponent({
3535
3550
  };
3536
3551
  }
3537
3552
  });
3553
+ const OptionCollectionKey = Symbol("presentation.optionCollection");
3554
+ function useOptionCollection() {
3555
+ return inject(OptionCollectionKey, false);
3556
+ }
3557
+ const OptionCollection = defineComponent({
3558
+ name: "OptionCollection",
3559
+ props: {
3560
+ /** Renders the slot into the detached element while true; the picker passes its closed state. */
3561
+ isActive: { type: Boolean, required: true }
3562
+ },
3563
+ setup(props, { slots }) {
3564
+ provide(OptionCollectionKey, true);
3565
+ const host = shallowRef(null);
3566
+ const hasFailed = shallowRef(false);
3567
+ onMounted(() => {
3568
+ host.value = document.createElement("div");
3569
+ });
3570
+ onErrorCaptured(() => {
3571
+ hasFailed.value = true;
3572
+ return false;
3573
+ });
3574
+ return () => host.value && props.isActive && !hasFailed.value ? h(Teleport, { to: host.value }, slots.default?.() ?? []) : null;
3575
+ }
3576
+ });
3538
3577
  const _hoisted_1$1d = {
3539
3578
  key: 0,
3540
3579
  class: "border-b border-border p-1"
@@ -3607,65 +3646,75 @@ const _sfc_main$1u = /* @__PURE__ */ defineComponent({
3607
3646
  );
3608
3647
  const selectedForListbox = computed(() => ctx.selectedKey ?? void 0);
3609
3648
  return (_ctx, _cache) => {
3610
- return openBlock(), createBlock(unref(_sfc_main$2a), mergeProps({
3611
- variant: __props.variant,
3612
- tone: __props.tone,
3613
- radius: __props.radius,
3614
- padding: __props.padding ?? "none",
3615
- elevation: __props.elevation
3616
- }, _ctx.$attrs, {
3617
- class: [contentClass.value, _ctx.$attrs.class]
3618
- }), {
3619
- default: withCtx(() => [
3620
- __props.isSearchable ? (openBlock(), createElementBlock("div", _hoisted_1$1d, [
3621
- createVNode(_sfc_main$1U, {
3622
- size: "sm",
3623
- autofocus: "",
3624
- role: "combobox",
3625
- "aria-expanded": "true",
3626
- "aria-controls": unref(ctx).listboxId,
3627
- "aria-activedescendant": unref(ctx).activeDescendant ?? void 0,
3628
- "aria-autocomplete": "list",
3629
- "model-value": unref(ctx).query,
3630
- placeholder: unref(props).searchPlaceholder,
3631
- "is-clearable": "",
3632
- class: "rounded-sm",
3633
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(ctx).setQuery($event)),
3634
- onKeydown: handleSearchKeyDown,
3635
- onClear: _cache[1] || (_cache[1] = ($event) => unref(ctx).setQuery(""))
3636
- }, null, 8, ["aria-controls", "aria-activedescendant", "model-value", "placeholder"])
3637
- ])) : createCommentVNode("", true),
3638
- createVNode(_sfc_main$1C, {
3639
- ref_key: "listbox",
3640
- ref: listbox,
3641
- id: unref(ctx).listboxId,
3642
- "model-value": selectedForListbox.value,
3643
- "is-equal": unref(ctx).keyEquals,
3644
- "is-disabled": unref(ctx).isDisabled || unref(ctx).isLoading,
3645
- variant: "flat",
3646
- radius: "none",
3647
- tabindex: __props.isSearchable ? -1 : 0,
3648
- "onUpdate:modelValue": onListboxValueChange,
3649
- onActiveChange: _cache[2] || (_cache[2] = ($event) => unref(ctx).setActiveDescendant($event))
3650
- }, {
3651
- default: withCtx(() => [
3652
- unref(ctx).isLoading ? (openBlock(), createElementBlock("div", _hoisted_2$W, [
3653
- createVNode(unref(LoaderIcon), { class: "h-4 w-4 animate-spin" }),
3654
- createElementVNode("span", null, toDisplayString(unref(ctx).loadingLabel), 1)
3655
- ])) : createCommentVNode("", true),
3656
- renderSlot(_ctx.$slots, "default"),
3657
- !unref(ctx).isLoading && showEmpty.value ? (openBlock(), createBlock(_sfc_main$1y, { key: 1 }, {
3658
- default: withCtx(() => [
3659
- createTextVNode(toDisplayString(unref(props).noResultsLabel), 1)
3660
- ]),
3661
- _: 1
3662
- })) : createCommentVNode("", true)
3663
- ]),
3664
- _: 3
3665
- }, 8, ["id", "model-value", "is-equal", "is-disabled", "tabindex"])
3666
- ]),
3667
- _: 3
3668
- }, 16, ["variant", "tone", "radius", "padding", "elevation", "class"]);
3649
+ return openBlock(), createElementBlock(Fragment, null, [
3650
+ createVNode(unref(_sfc_main$2a), mergeProps({
3651
+ variant: __props.variant,
3652
+ tone: __props.tone,
3653
+ radius: __props.radius,
3654
+ padding: __props.padding ?? "none",
3655
+ elevation: __props.elevation
3656
+ }, _ctx.$attrs, {
3657
+ class: [contentClass.value, _ctx.$attrs.class]
3658
+ }), {
3659
+ default: withCtx(() => [
3660
+ __props.isSearchable ? (openBlock(), createElementBlock("div", _hoisted_1$1d, [
3661
+ createVNode(_sfc_main$1U, {
3662
+ size: "sm",
3663
+ autofocus: "",
3664
+ role: "combobox",
3665
+ "aria-expanded": "true",
3666
+ "aria-controls": unref(ctx).listboxId,
3667
+ "aria-activedescendant": unref(ctx).activeDescendant ?? void 0,
3668
+ "aria-autocomplete": "list",
3669
+ "model-value": unref(ctx).query,
3670
+ placeholder: unref(props).searchPlaceholder,
3671
+ "is-clearable": "",
3672
+ class: "rounded-sm",
3673
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(ctx).setQuery($event)),
3674
+ onKeydown: handleSearchKeyDown,
3675
+ onClear: _cache[1] || (_cache[1] = ($event) => unref(ctx).setQuery(""))
3676
+ }, null, 8, ["aria-controls", "aria-activedescendant", "model-value", "placeholder"])
3677
+ ])) : createCommentVNode("", true),
3678
+ createVNode(_sfc_main$1C, {
3679
+ ref_key: "listbox",
3680
+ ref: listbox,
3681
+ id: unref(ctx).listboxId,
3682
+ "model-value": selectedForListbox.value,
3683
+ "is-equal": unref(ctx).keyEquals,
3684
+ "is-disabled": unref(ctx).isDisabled || unref(ctx).isLoading,
3685
+ variant: "flat",
3686
+ radius: "none",
3687
+ tabindex: __props.isSearchable ? -1 : 0,
3688
+ "onUpdate:modelValue": onListboxValueChange,
3689
+ onActiveChange: _cache[2] || (_cache[2] = ($event) => unref(ctx).setActiveDescendant($event))
3690
+ }, {
3691
+ default: withCtx(() => [
3692
+ unref(ctx).isLoading ? (openBlock(), createElementBlock("div", _hoisted_2$W, [
3693
+ createVNode(unref(LoaderIcon), { class: "h-4 w-4 animate-spin" }),
3694
+ createElementVNode("span", null, toDisplayString(unref(ctx).loadingLabel), 1)
3695
+ ])) : createCommentVNode("", true),
3696
+ renderSlot(_ctx.$slots, "default"),
3697
+ !unref(ctx).isLoading && showEmpty.value ? (openBlock(), createBlock(_sfc_main$1y, { key: 1 }, {
3698
+ default: withCtx(() => [
3699
+ createTextVNode(toDisplayString(unref(props).noResultsLabel), 1)
3700
+ ]),
3701
+ _: 1
3702
+ })) : createCommentVNode("", true)
3703
+ ]),
3704
+ _: 3
3705
+ }, 8, ["id", "model-value", "is-equal", "is-disabled", "tabindex"])
3706
+ ]),
3707
+ _: 3
3708
+ }, 16, ["variant", "tone", "radius", "padding", "elevation", "class"]),
3709
+ createVNode(unref(OptionCollection), {
3710
+ "is-active": !unref(ctx).open && unref(ctx).needsOptionCollection
3711
+ }, {
3712
+ default: withCtx(() => [
3713
+ renderSlot(_ctx.$slots, "default")
3714
+ ]),
3715
+ _: 3
3716
+ }, 8, ["is-active"])
3717
+ ], 64);
3669
3718
  };
3670
3719
  }
3671
3720
  });
@@ -3682,6 +3731,8 @@ const _sfc_main$1t = /* @__PURE__ */ defineComponent({
3682
3731
  setup(__props) {
3683
3732
  const props = __props;
3684
3733
  const ctx = useSelectContext();
3734
+ const isCollected = useOptionCollection();
3735
+ const owner = Symbol("SelectPickerItem");
3685
3736
  const resolvedValue = computed(() => props.value === void 0 ? props.itemKey : props.value);
3686
3737
  const itemText = computed(() => props.text !== void 0 ? props.text : extractText(props.label));
3687
3738
  watch(
@@ -3692,16 +3743,13 @@ const _sfc_main$1t = /* @__PURE__ */ defineComponent({
3692
3743
  text: itemText.value,
3693
3744
  isDisabled: props.isDisabled
3694
3745
  }),
3695
- (entry, previous) => {
3696
- if (previous && !Object.is(previous.itemKey, entry.itemKey)) ctx.unregisterItem(previous.itemKey);
3697
- ctx.registerItem(entry);
3698
- },
3746
+ (entry) => ctx.registerItem(owner, entry),
3699
3747
  { immediate: true }
3700
3748
  );
3701
- onBeforeUnmount(() => ctx.unregisterItem(props.itemKey));
3749
+ onBeforeUnmount(() => ctx.unregisterItem(owner));
3702
3750
  const matchesQuery = computed(() => !ctx.query || itemText.value.toLowerCase().includes(ctx.query.toLowerCase()));
3703
3751
  return (_ctx, _cache) => {
3704
- return matchesQuery.value ? (openBlock(), createBlock(_sfc_main$1B, mergeProps({ key: 0 }, _ctx.$attrs, {
3752
+ return !unref(isCollected) && matchesQuery.value ? (openBlock(), createBlock(_sfc_main$1B, mergeProps({ key: 0 }, _ctx.$attrs, {
3705
3753
  value: __props.itemKey,
3706
3754
  "is-disabled": __props.isDisabled
3707
3755
  }), {
@@ -4022,31 +4070,41 @@ const _sfc_main$1p = /* @__PURE__ */ defineComponent({
4022
4070
  ctx.setValues(next);
4023
4071
  }
4024
4072
  return (_ctx, _cache) => {
4025
- return openBlock(), createBlock(unref(_sfc_main$2a), {
4026
- variant: __props.variant,
4027
- tone: __props.tone,
4028
- radius: __props.radius,
4029
- padding: resolvedPadding.value,
4030
- elevation: __props.elevation,
4031
- class: normalizeClass(panelClass.value)
4032
- }, {
4033
- default: withCtx(() => [
4034
- createVNode(unref(_sfc_main$1C), {
4035
- "is-disabled": unref(ctx).isDisabled,
4036
- "is-multiple": "",
4037
- "model-value": selected.value,
4038
- variant: "flat",
4039
- radius: "none",
4040
- "onUpdate:modelValue": onValueChange
4041
- }, {
4042
- default: withCtx(() => [
4043
- renderSlot(_ctx.$slots, "default")
4044
- ]),
4045
- _: 3
4046
- }, 8, ["is-disabled", "model-value"])
4047
- ]),
4048
- _: 3
4049
- }, 8, ["variant", "tone", "radius", "padding", "elevation", "class"]);
4073
+ return openBlock(), createElementBlock(Fragment, null, [
4074
+ createVNode(unref(_sfc_main$2a), {
4075
+ variant: __props.variant,
4076
+ tone: __props.tone,
4077
+ radius: __props.radius,
4078
+ padding: resolvedPadding.value,
4079
+ elevation: __props.elevation,
4080
+ class: normalizeClass(panelClass.value)
4081
+ }, {
4082
+ default: withCtx(() => [
4083
+ createVNode(unref(_sfc_main$1C), {
4084
+ "is-disabled": unref(ctx).isDisabled,
4085
+ "is-multiple": "",
4086
+ "model-value": selected.value,
4087
+ variant: "flat",
4088
+ radius: "none",
4089
+ "onUpdate:modelValue": onValueChange
4090
+ }, {
4091
+ default: withCtx(() => [
4092
+ renderSlot(_ctx.$slots, "default")
4093
+ ]),
4094
+ _: 3
4095
+ }, 8, ["is-disabled", "model-value"])
4096
+ ]),
4097
+ _: 3
4098
+ }, 8, ["variant", "tone", "radius", "padding", "elevation", "class"]),
4099
+ createVNode(unref(OptionCollection), {
4100
+ "is-active": !unref(ctx).open
4101
+ }, {
4102
+ default: withCtx(() => [
4103
+ renderSlot(_ctx.$slots, "default")
4104
+ ]),
4105
+ _: 3
4106
+ }, 8, ["is-active"])
4107
+ ], 64);
4050
4108
  };
4051
4109
  }
4052
4110
  });
@@ -4062,10 +4120,12 @@ const _sfc_main$1o = /* @__PURE__ */ defineComponent({
4062
4120
  const props = __props;
4063
4121
  const el = useTemplateRef("el");
4064
4122
  const ctx = useMultiSelectContext();
4123
+ const isCollected = useOptionCollection();
4065
4124
  const registeredLabel = computed(() => props.label ?? props.value);
4066
4125
  watch([() => props.value, registeredLabel], ([value, label]) => ctx.registerLabel(value, label), { immediate: true });
4067
4126
  return (_ctx, _cache) => {
4068
- return openBlock(), createBlock(unref(_sfc_main$1B), {
4127
+ return !unref(isCollected) ? (openBlock(), createBlock(unref(_sfc_main$1B), {
4128
+ key: 0,
4069
4129
  ref_key: "el",
4070
4130
  ref: el,
4071
4131
  value: __props.value,
@@ -4075,7 +4135,7 @@ const _sfc_main$1o = /* @__PURE__ */ defineComponent({
4075
4135
  renderSlot(_ctx.$slots, "default")
4076
4136
  ]),
4077
4137
  _: 3
4078
- }, 8, ["value", "is-disabled"]);
4138
+ }, 8, ["value", "is-disabled"])) : createCommentVNode("", true);
4079
4139
  };
4080
4140
  }
4081
4141
  });
@@ -6429,8 +6489,8 @@ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
6429
6489
  function clamp01(n) {
6430
6490
  return Math.max(0, Math.min(1, n));
6431
6491
  }
6432
- function clampHue(h) {
6433
- let v = h % 360;
6492
+ function clampHue(h2) {
6493
+ let v = h2 % 360;
6434
6494
  if (v < 0) v += 360;
6435
6495
  return v;
6436
6496
  }
@@ -6474,21 +6534,21 @@ function rgbToHsv({ r, g, b, a = 1 }) {
6474
6534
  const max = Math.max(rn, gn, bn);
6475
6535
  const min = Math.min(rn, gn, bn);
6476
6536
  const d = max - min;
6477
- let h = 0;
6537
+ let h2 = 0;
6478
6538
  if (d !== 0) {
6479
- if (max === rn) h = (gn - bn) / d % 6;
6480
- else if (max === gn) h = (bn - rn) / d + 2;
6481
- else h = (rn - gn) / d + 4;
6482
- h *= 60;
6483
- if (h < 0) h += 360;
6539
+ if (max === rn) h2 = (gn - bn) / d % 6;
6540
+ else if (max === gn) h2 = (bn - rn) / d + 2;
6541
+ else h2 = (rn - gn) / d + 4;
6542
+ h2 *= 60;
6543
+ if (h2 < 0) h2 += 360;
6484
6544
  }
6485
6545
  const s = max === 0 ? 0 : d / max;
6486
6546
  const v = max;
6487
- return { h, s, v, a };
6547
+ return { h: h2, s, v, a };
6488
6548
  }
6489
- function hsvToRgb({ h, s, v, a = 1 }) {
6549
+ function hsvToRgb({ h: h2, s, v, a = 1 }) {
6490
6550
  const c = v * s;
6491
- const hh = clampHue(h) / 60;
6551
+ const hh = clampHue(h2) / 60;
6492
6552
  const x = c * (1 - Math.abs(hh % 2 - 1));
6493
6553
  let r1 = 0;
6494
6554
  let g1 = 0;
@@ -7450,8 +7510,8 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
7450
7510
  hsv.value = next;
7451
7511
  controlled.setValue(hsvToHex(next, { withAlpha: props.hasAlpha }));
7452
7512
  }
7453
- function onHueChange(h) {
7454
- updateHsv({ ...hsv.value, h });
7513
+ function onHueChange(h2) {
7514
+ updateHsv({ ...hsv.value, h: h2 });
7455
7515
  }
7456
7516
  function onAlphaChange(a) {
7457
7517
  updateHsv({ ...hsv.value, a });
@@ -18730,4 +18790,4 @@ export {
18730
18790
  _sfc_main$1m as y,
18731
18791
  _sfc_main$1k as z
18732
18792
  };
18733
- //# sourceMappingURL=MentionInput.vue_vue_type_script_setup_true_lang-vfxAeyB7.js.map
18793
+ //# sourceMappingURL=MentionInput.vue_vue_type_script_setup_true_lang-C7X9NYpR.js.map