vlite3 0.7.8 → 0.7.10

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,5 +1,5 @@
1
- import o from "./ColorIro.vue.js";
2
- /* empty css */
1
+ import o from "./ColorIro.vue2.js";
2
+ /* empty css */
3
3
  export {
4
4
  o as default
5
5
  };
@@ -5,8 +5,8 @@ import O from "../Input.vue.js";
5
5
  /* empty css */
6
6
  import "../../core/config.js";
7
7
  import y from "../Button.vue.js";
8
- import E from "./ColorIro.vue.js";
9
- /* empty css */
8
+ import E from "./ColorIro.vue2.js";
9
+ /* empty css */
10
10
  import { useEyeDropper as P } from "@vueuse/core";
11
11
  const I = {
12
12
  key: 0,
@@ -1,12 +1,13 @@
1
- import { defineComponent as J, ref as s, computed as y, watch as $, provide as K, reactive as Q, toRefs as W, openBlock as A, createElementBlock as X, normalizeStyle as Y, createVNode as T, unref as O, withCtx as u, renderSlot as d, createBlock as Z, normalizeClass as _, createSlots as ee, normalizeProps as M, guardReactiveProps as H, createCommentVNode as te } from "vue";
2
- import le from "v-tooltip-lite";
1
+ import { defineComponent as K, ref as i, computed as m, watch as T, provide as Q, reactive as W, toRefs as X, openBlock as H, createElementBlock as Y, normalizeStyle as Z, createVNode as B, unref as v, withCtx as c, renderSlot as d, createBlock as _, normalizeClass as ee, createSlots as te, normalizeProps as M, guardReactiveProps as L, createCommentVNode as le } from "vue";
2
+ import oe from "v-tooltip-lite";
3
3
  import "v-tooltip-lite/style.css";
4
4
  import ne from "./DropdownMenu.vue.js";
5
- import oe from "./DropdownTrigger.vue.js";
6
- import ae from "../ConfirmationModal.vue.js";
7
- import { useDropdownIds as ie } from "./composables/useDropdownIds.js";
8
- import { useDropdownSelection as se } from "./composables/useDropdownSelection.js";
9
- const pe = /* @__PURE__ */ J({
5
+ import ae from "./DropdownTrigger.vue.js";
6
+ import ie from "../ConfirmationModal.vue.js";
7
+ import { useDropdownIds as se } from "./composables/useDropdownIds.js";
8
+ import { useDropdownSelection as re } from "./composables/useDropdownSelection.js";
9
+ import { useDropdownHydration as ue } from "./composables/useDropdownHydration.js";
10
+ const be = /* @__PURE__ */ K({
10
11
  __name: "Dropdown",
11
12
  props: {
12
13
  selected: {},
@@ -45,228 +46,216 @@ const pe = /* @__PURE__ */ J({
45
46
  isNested: { type: Boolean, default: !1 }
46
47
  },
47
48
  emits: ["onSelect", "update:modelValue", "onOpen", "onClose", "update:isOpen", "load-more", "search"],
48
- setup(n, { emit: V }) {
49
- const o = n, p = V, g = s(!1), f = s(null), r = s({
49
+ setup(l, { emit: V }) {
50
+ const n = l, p = V, h = i(!1), f = i(null), s = i({
50
51
  title: "Confirm Selection",
51
52
  description: "Are you sure you want to select this option?",
52
53
  confirmText: "Confirm",
53
54
  cancelText: "Cancel",
54
55
  variant: "primary"
55
- }), E = y(() => o.position ? o.position : o.direction === "rtl" ? "bottom-end" : "bottom-start"), L = y(() => o.nestedPosition ? o.nestedPosition : o.direction === "rtl" ? "left-start" : "right-start"), S = s(o.isOpen || !1), b = s(0);
56
- $(
57
- () => o.isOpen,
56
+ }), R = m(() => n.position ? n.position : n.direction === "rtl" ? "bottom-end" : "bottom-start"), z = m(() => n.nestedPosition ? n.nestedPosition : n.direction === "rtl" ? "left-start" : "right-start"), O = i(n.isOpen || !1), y = i(0);
57
+ T(
58
+ () => n.isOpen,
58
59
  (e) => {
59
- e !== void 0 && (S.value = e);
60
+ e !== void 0 && (O.value = e);
60
61
  }
61
62
  );
62
- const B = (e) => {
63
- S.value = e, p("update:isOpen", e), p(e ? "onOpen" : "onClose");
64
- }, C = () => {
65
- B(!1);
63
+ const P = (e) => {
64
+ O.value = e, p("update:isOpen", e), p(e ? "onOpen" : "onClose");
65
+ }, g = () => {
66
+ P(!1);
66
67
  };
67
- K("dropdown-context", {
68
- close: C,
68
+ Q("dropdown-context", {
69
+ close: g,
69
70
  onChildToggle: (e) => {
70
- e ? b.value++ : b.value = Math.max(0, b.value - 1);
71
+ e ? y.value++ : y.value = Math.max(0, y.value - 1);
71
72
  }
72
73
  });
73
- const w = y(() => o.options ? o.options.map((e) => typeof e == "string" || typeof e == "number" ? { label: String(e), value: String(e) } : e) : []), m = s([]);
74
- $(
75
- w,
74
+ const b = m(() => n.options ? n.options.map((e) => typeof e == "string" || typeof e == "number" ? { label: String(e), value: String(e) } : e) : []), C = i([]), I = i(!1), S = i(!1);
75
+ T(
76
+ b,
76
77
  (e) => {
77
- if (e)
78
- if (o.remote) {
79
- const l = [...m.value];
78
+ if (e) {
79
+ if (n.remote) {
80
+ const o = [...C.value];
80
81
  e.forEach((t) => {
81
- l.some((a) => a.value !== void 0 && t.value !== void 0 ? typeof a.value == "object" && a.key && t.key ? a.key === t.key && a.value[a.key] === t.value[t.key] : a.value === t.value : a.label === t.label) || l.push(t);
82
- }), m.value = l;
82
+ o.some((a) => a.value !== void 0 && t.value !== void 0 ? typeof a.value == "object" && a.key && t.key ? a.key === t.key && a.value[a.key] === t.value[t.key] : a.value === t.value : a.label === t.label) || o.push(t);
83
+ }), C.value = o;
83
84
  } else
84
- m.value = e;
85
+ C.value = e;
86
+ !I.value && e.length > 0 && (I.value = !0, setTimeout(() => {
87
+ S.value = !0, N($.value);
88
+ }, 10));
89
+ }
85
90
  },
86
91
  { immediate: !0 }
87
92
  // Performance fix: Removed deep: true to prevent heavy recursion mapping
88
93
  );
89
- const v = s(/* @__PURE__ */ new Map()), k = s(!1), j = async (e) => {
90
- if (!o.fetchSelected || e === void 0 || e === null) return;
91
- let l = [];
92
- Array.isArray(e) ? l = e : typeof e == "object" ? l = Object.values(e) : l = [e];
93
- const t = l.filter((i) => {
94
- const a = v.value.has(i), x = m.value.some((c) => (c.value ?? c.label) === i);
95
- return !a && !x;
96
- });
97
- if (t.length) {
98
- k.value = !0;
99
- try {
100
- (await o.fetchSelected(t)).forEach((a) => {
101
- v.value.set(a.value ?? a.label, a);
102
- });
103
- } catch (i) {
104
- console.error("[Dropdown] Hydration failed:", i);
105
- } finally {
106
- k.value = !1;
107
- }
108
- }
109
- }, h = y(() => {
110
- const e = [...m.value], l = new Set(e.map((t) => t.value ?? t.label));
111
- return v.value.forEach((t, i) => {
112
- l.has(i) || (e.unshift(t), l.add(i));
94
+ const u = m(() => {
95
+ const e = [...C.value], o = new Set(e.map((t) => t.value ?? t.label));
96
+ return k.value.forEach((t, r) => {
97
+ o.has(r) || (e.unshift(t), o.add(r));
113
98
  }), e;
114
- }), { getAllRecursiveIds: z } = ie(), D = Q({
115
- ...W(o),
116
- options: h
117
- }), { currentValue: P, selectedLabel: I, selectOption: R } = se(
118
- D,
99
+ }), { selectedBuffer: k, isHydrating: D, hydrateSelected: N } = ue({
100
+ fetchSelected: n.fetchSelected,
101
+ getAvailableOptions: () => u.value,
102
+ isReady: () => S.value
103
+ }), { getAllRecursiveIds: E } = se(), j = W({
104
+ ...X(n),
105
+ options: u
106
+ }), { currentValue: $, selectedLabel: x, selectOption: U } = re(
107
+ j,
119
108
  p
120
- ), F = y(() => {
121
- const e = o.ignoreClickOutside || [], l = z(h.value);
122
- return [.../* @__PURE__ */ new Set([...e, ...l])];
109
+ ), q = m(() => {
110
+ const e = n.ignoreClickOutside || [], o = E(u.value);
111
+ return [.../* @__PURE__ */ new Set([...e, ...o, ".tooltip-container"])];
123
112
  });
124
- $(
125
- () => P.value,
113
+ T(
114
+ () => $.value,
126
115
  (e) => {
127
- j(e);
116
+ S.value && N(e);
128
117
  },
129
- { immediate: !0, deep: !0 }
118
+ { deep: !0 }
130
119
  );
131
- const U = (e) => {
132
- o.doubleConfirmation || !!e.confirmation ? (f.value = e, typeof e.confirmation == "object" ? r.value = {
120
+ const F = (e) => {
121
+ n.doubleConfirmation || !!e.confirmation ? (f.value = e, typeof e.confirmation == "object" ? s.value = {
133
122
  title: e.confirmation.title || "Confirm Selection",
134
123
  description: e.confirmation.description || "Are you sure you want to select this option?",
135
124
  confirmText: e.confirmation.confirmText || "Confirm",
136
125
  cancelText: e.confirmation.cancelText || "Cancel",
137
126
  variant: e.confirmation.variant || "primary"
138
- } : r.value = {
127
+ } : s.value = {
139
128
  title: "Confirm Selection",
140
129
  description: `Are you sure you want to select "${e.label}"?`,
141
130
  confirmText: "Confirm",
142
131
  cancelText: "Cancel",
143
132
  variant: "primary"
144
- }, g.value = !0, C()) : (N(e), o.closeOnSelect && C());
145
- }, N = (e) => {
146
- const l = e.value ?? e.label;
147
- v.value.has(l) || v.value.set(l, e);
148
- const t = R(e);
149
- if (!o.isNested) {
150
- const i = e._originalOption || e, a = i.value ?? i.label;
151
- (e._path || [i]).forEach((c) => {
152
- typeof c.onSelect == "function" && c.onSelect({
133
+ }, h.value = !0, g()) : (A(e), n.closeOnSelect && g());
134
+ }, A = (e) => {
135
+ const o = e.value ?? e.label;
136
+ k.value.has(o) || k.value.set(o, e);
137
+ const t = U(e);
138
+ if (!n.isNested) {
139
+ const r = e._originalOption || e, a = r.value ?? r.label;
140
+ (e._path || [r]).forEach((w) => {
141
+ typeof w.onSelect == "function" && w.onSelect({
153
142
  value: a,
154
- option: c,
155
- data: h.value || [],
143
+ option: w,
144
+ data: u.value || [],
156
145
  values: t
157
146
  });
158
147
  });
159
148
  }
160
- }, q = () => {
161
- f.value && (N(f.value), f.value = null, g.value = !1);
162
149
  }, G = () => {
163
- f.value = null, g.value = !1;
150
+ f.value && (A(f.value), f.value = null, h.value = !1);
151
+ }, J = () => {
152
+ f.value = null, h.value = !1;
164
153
  };
165
- return (e, l) => (A(), X("div", {
154
+ return (e, o) => (H(), Y("div", {
166
155
  class: "relative inline-block text-left",
167
- style: Y({ direction: n.direction })
156
+ style: Z({ direction: l.direction })
168
157
  }, [
169
- T(O(le), {
158
+ B(v(oe), {
170
159
  content: "",
171
160
  trigger: "click",
172
161
  arrow: !1,
173
- teleport: n.teleport,
174
- offset: n.offset,
175
- placement: E.value,
176
- isOpen: S.value,
177
- keepAlive: b.value > 0,
178
- menuId: n.menuId,
179
- ignoreClickOutside: F.value,
162
+ teleport: l.teleport,
163
+ offset: l.offset,
164
+ placement: R.value,
165
+ isOpen: O.value,
166
+ keepAlive: y.value > 0,
167
+ menuId: l.menuId,
168
+ ignoreClickOutside: q.value,
180
169
  class: "w-full",
181
- className: "dropdown " + (n.className || ""),
182
- onOnShow: l[2] || (l[2] = (t) => e.$emit("onOpen")),
183
- onOnHide: l[3] || (l[3] = (t) => e.$emit("onClose")),
184
- "onUpdate:isOpen": B,
170
+ className: "dropdown " + (l.className || ""),
171
+ onOnShow: o[2] || (o[2] = (t) => e.$emit("onOpen")),
172
+ onOnHide: o[3] || (o[3] = (t) => e.$emit("onClose")),
173
+ "onUpdate:isOpen": P,
185
174
  triggerClass: "w-full",
186
175
  styles: { padding: "0" }
187
176
  }, {
188
- trigger: u(({ isOpen: t }) => [
189
- d(e.$slots, "trigger", M(H({ selectedLabel: O(I), isOpen: t })), () => [
190
- T(oe, {
191
- "selected-label": O(I),
177
+ trigger: c(({ isOpen: t }) => [
178
+ d(e.$slots, "trigger", M(L({ selectedLabel: v(x), isOpen: t })), () => [
179
+ B(ae, {
180
+ "selected-label": v(x),
192
181
  "is-open": t,
193
- direction: n.direction,
194
- triggerProps: n.triggerProps,
182
+ direction: l.direction,
183
+ triggerProps: l.triggerProps,
195
184
  class: "w-full"
196
185
  }, null, 8, ["selected-label", "is-open", "direction", "triggerProps"])
197
186
  ])
198
187
  ]),
199
- default: u(() => [
188
+ default: c(() => [
200
189
  d(e.$slots, "default"),
201
- w.value.length || h.value.length || e.$slots.menu || e.$slots.item || n.remote || n.searchable ? (A(), Z(ne, {
190
+ b.value.length || u.value.length || e.$slots.menu || e.$slots.item || l.remote || l.searchable ? (H(), _(ne, {
202
191
  key: 0,
203
- options: w.value,
204
- cachedOptions: h.value,
205
- class: _(n.className),
206
- selected: O(P),
207
- selectedIndex: n.selectedIndex,
208
- maxHeight: n.maxHeight,
209
- nestedPosition: L.value,
210
- nestedOffset: n.nestedOffset,
211
- selectable: n.selectable,
212
- direction: n.direction,
213
- layout: n.layout,
214
- columns: n.columns,
215
- loading: n.loading || k.value,
216
- hasMore: n.hasMore,
217
- searchable: n.searchable,
218
- remote: n.remote,
219
- debounceTime: n.debounceTime,
220
- onSelect: U,
221
- onClose: C,
222
- onLoadMore: l[0] || (l[0] = (t) => e.$emit("load-more")),
223
- onSearch: l[1] || (l[1] = (t) => e.$emit("search", t))
224
- }, ee({ _: 2 }, [
192
+ options: b.value,
193
+ cachedOptions: u.value,
194
+ class: ee(l.className),
195
+ selected: v($),
196
+ selectedIndex: l.selectedIndex,
197
+ maxHeight: l.maxHeight,
198
+ nestedPosition: z.value,
199
+ nestedOffset: l.nestedOffset,
200
+ selectable: l.selectable,
201
+ direction: l.direction,
202
+ layout: l.layout,
203
+ columns: l.columns,
204
+ loading: l.loading || v(D),
205
+ hasMore: l.hasMore,
206
+ searchable: l.searchable,
207
+ remote: l.remote,
208
+ debounceTime: l.debounceTime,
209
+ onSelect: F,
210
+ onClose: g,
211
+ onLoadMore: o[0] || (o[0] = (t) => e.$emit("load-more")),
212
+ onSearch: o[1] || (o[1] = (t) => e.$emit("search", t))
213
+ }, te({ _: 2 }, [
225
214
  e.$slots.menu ? {
226
215
  name: "menu",
227
- fn: u(() => [
216
+ fn: c(() => [
228
217
  d(e.$slots, "menu")
229
218
  ]),
230
219
  key: "0"
231
220
  } : void 0,
232
221
  e.$slots.item ? {
233
222
  name: "item",
234
- fn: u((t) => [
235
- d(e.$slots, "item", M(H(t)))
223
+ fn: c((t) => [
224
+ d(e.$slots, "item", M(L(t)))
236
225
  ]),
237
226
  key: "1"
238
227
  } : void 0,
239
228
  e.$slots.header ? {
240
229
  name: "header",
241
- fn: u(() => [
230
+ fn: c(() => [
242
231
  d(e.$slots, "header")
243
232
  ]),
244
233
  key: "2"
245
234
  } : void 0,
246
235
  e.$slots.footer ? {
247
236
  name: "footer",
248
- fn: u(() => [
237
+ fn: c(() => [
249
238
  d(e.$slots, "footer")
250
239
  ]),
251
240
  key: "3"
252
241
  } : void 0
253
- ]), 1032, ["options", "cachedOptions", "class", "selected", "selectedIndex", "maxHeight", "nestedPosition", "nestedOffset", "selectable", "direction", "layout", "columns", "loading", "hasMore", "searchable", "remote", "debounceTime"])) : te("", !0)
242
+ ]), 1032, ["options", "cachedOptions", "class", "selected", "selectedIndex", "maxHeight", "nestedPosition", "nestedOffset", "selectable", "direction", "layout", "columns", "loading", "hasMore", "searchable", "remote", "debounceTime"])) : le("", !0)
254
243
  ]),
255
244
  _: 3
256
245
  }, 8, ["teleport", "offset", "placement", "isOpen", "keepAlive", "menuId", "ignoreClickOutside", "className"]),
257
- T(ae, {
258
- show: g.value,
259
- title: r.value.title,
260
- description: r.value.description,
261
- "confirm-text": r.value.confirmText,
262
- "cancel-text": r.value.cancelText,
263
- variant: r.value.variant,
264
- onConfirm: q,
265
- onCancel: G
246
+ B(ie, {
247
+ show: h.value,
248
+ title: s.value.title,
249
+ description: s.value.description,
250
+ "confirm-text": s.value.confirmText,
251
+ "cancel-text": s.value.cancelText,
252
+ variant: s.value.variant,
253
+ onConfirm: G,
254
+ onCancel: J
266
255
  }, null, 8, ["show", "title", "description", "confirm-text", "cancel-text", "variant"])
267
256
  ], 4));
268
257
  }
269
258
  });
270
259
  export {
271
- pe as default
260
+ be as default
272
261
  };
@@ -0,0 +1,105 @@
1
+ import { IDropdownOption } from '../../../types';
2
+ interface UseDropdownHydrationOptions {
3
+ fetchSelected?: (ids: any[]) => Promise<IDropdownOption[]>;
4
+ /**
5
+ * Returns the current set of options that are already available.
6
+ * Hydration will skip IDs found here.
7
+ */
8
+ getAvailableOptions: () => IDropdownOption[];
9
+ /**
10
+ * Must return true before hydration is allowed to run.
11
+ * Use this to gate hydration until the initial options fetch + delay is done.
12
+ */
13
+ isReady: () => boolean;
14
+ }
15
+ /**
16
+ * Manages hydration of selected values whose labels are not yet in the option list.
17
+ * Defers fetching until isReady() returns true, so it never fires for IDs already
18
+ * present in the initial options batch.
19
+ */
20
+ export declare function useDropdownHydration(opts: UseDropdownHydrationOptions): {
21
+ selectedBuffer: import('vue').Ref<Map<any, {
22
+ label: string;
23
+ labelI18n?: string;
24
+ value?: any;
25
+ subtitle?: string;
26
+ subtitleI18n?: string;
27
+ description?: string;
28
+ descriptionI18n?: string;
29
+ icon?: string;
30
+ emoji?: string;
31
+ disabled?: {
32
+ valueOf: () => boolean;
33
+ };
34
+ iconClass?: string;
35
+ iconStyle?: any;
36
+ length?: number;
37
+ values?: any;
38
+ data?: any;
39
+ class?: string;
40
+ triggerClass?: string;
41
+ children?: /*elided*/ any[];
42
+ key?: string;
43
+ position?: any;
44
+ offset?: [number, number];
45
+ showChevron?: boolean;
46
+ confirmation?: boolean | {
47
+ title?: string;
48
+ description?: string;
49
+ confirmText?: string;
50
+ cancelText?: string;
51
+ variant?: "danger" | "primary" | "warning" | "success" | "info";
52
+ };
53
+ onSelect?: (payload: {
54
+ value: any;
55
+ option: IDropdownOption;
56
+ data: IDropdownOption[];
57
+ values?: any;
58
+ }) => void;
59
+ _originalOption?: /*elided*/ any;
60
+ _path?: /*elided*/ any[];
61
+ }> & Omit<Map<any, IDropdownOption>, keyof Map<any, any>>, Map<any, IDropdownOption> | (Map<any, {
62
+ label: string;
63
+ labelI18n?: string;
64
+ value?: any;
65
+ subtitle?: string;
66
+ subtitleI18n?: string;
67
+ description?: string;
68
+ descriptionI18n?: string;
69
+ icon?: string;
70
+ emoji?: string;
71
+ disabled?: {
72
+ valueOf: () => boolean;
73
+ };
74
+ iconClass?: string;
75
+ iconStyle?: any;
76
+ length?: number;
77
+ values?: any;
78
+ data?: any;
79
+ class?: string;
80
+ triggerClass?: string;
81
+ children?: /*elided*/ any[];
82
+ key?: string;
83
+ position?: any;
84
+ offset?: [number, number];
85
+ showChevron?: boolean;
86
+ confirmation?: boolean | {
87
+ title?: string;
88
+ description?: string;
89
+ confirmText?: string;
90
+ cancelText?: string;
91
+ variant?: "danger" | "primary" | "warning" | "success" | "info";
92
+ };
93
+ onSelect?: (payload: {
94
+ value: any;
95
+ option: IDropdownOption;
96
+ data: IDropdownOption[];
97
+ values?: any;
98
+ }) => void;
99
+ _originalOption?: /*elided*/ any;
100
+ _path?: /*elided*/ any[];
101
+ }> & Omit<Map<any, IDropdownOption>, keyof Map<any, any>>)>;
102
+ isHydrating: import('vue').Ref<boolean, boolean>;
103
+ hydrateSelected: (val: any) => Promise<void>;
104
+ };
105
+ export {};
@@ -0,0 +1,32 @@
1
+ import { ref as f } from "vue";
2
+ function h(n) {
3
+ const l = f(/* @__PURE__ */ new Map()), c = f(!1);
4
+ return {
5
+ selectedBuffer: l,
6
+ isHydrating: c,
7
+ hydrateSelected: async (e) => {
8
+ if (!n.fetchSelected || e === void 0 || e === null || !n.isReady()) return;
9
+ let a = [];
10
+ Array.isArray(e) ? a = e : typeof e == "object" ? a = Object.values(e) : a = [e];
11
+ const o = n.getAvailableOptions(), i = a.filter((t) => {
12
+ const r = l.value.has(t), d = o.some((s) => (s.value ?? s.label) === t);
13
+ return !r && !d;
14
+ });
15
+ if (i.length) {
16
+ c.value = !0;
17
+ try {
18
+ (await n.fetchSelected(i)).forEach((r) => {
19
+ l.value.set(r.value ?? r.label, r);
20
+ });
21
+ } catch (t) {
22
+ console.error("[Dropdown] Hydration failed:", t);
23
+ } finally {
24
+ c.value = !1;
25
+ }
26
+ }
27
+ }
28
+ };
29
+ }
30
+ export {
31
+ h as useDropdownHydration
32
+ };