vlite3 1.4.32 → 1.4.33

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.
Files changed (43) hide show
  1. package/components/CategoryManager/CategoryManager.vue2.js +1 -1
  2. package/components/CategoryManager/CategoryNode.vue.js +30 -30
  3. package/components/CategoryMenu/CategoryMenu.vue.js +9 -11
  4. package/components/Chart/GanttChart.vue.d.ts +5 -1
  5. package/components/Chart/GanttChart.vue.js +2 -2
  6. package/components/Chart/GanttChart.vue2.js +977 -812
  7. package/components/Chart/GanttChartConnectorRouting.d.ts +83 -0
  8. package/components/Chart/GanttChartConnectorRouting.js +405 -0
  9. package/components/Chart/GanttChartDependencyUtils.js +43 -47
  10. package/components/Chart/types.d.ts +16 -1
  11. package/components/ColorPicker/ColorIro.vue2.js +78 -64
  12. package/components/ColorPicker/ColorPicker.vue.d.ts +5 -0
  13. package/components/ColorPicker/ColorPicker.vue.js +110 -64
  14. package/components/ColorPicker/constants.d.ts +2 -0
  15. package/components/ColorPicker/constants.js +4 -0
  16. package/components/ColorPicker/index.d.ts +1 -0
  17. package/components/CommandPalette/CommandPaletteContent.vue2.js +1 -1
  18. package/components/CommandPalette/{CommandPaletteItem.vue.js → CommandPaletteItem.vue2.js} +1 -1
  19. package/components/Dropdown/Dropdown.vue.js +100 -97
  20. package/components/Dropdown/DropdownMenu.vue.js +1 -1
  21. package/components/Form/{AccordionView.vue2.js → AccordionView.vue.js} +1 -1
  22. package/components/Form/FormField.vue.js +9 -8
  23. package/components/Form/index.vue2.js +1 -1
  24. package/components/Kanban/Kanban.vue.d.ts +16 -2
  25. package/components/Kanban/Kanban.vue.js +2 -2
  26. package/components/Kanban/Kanban.vue2.js +150 -86
  27. package/components/Kanban/types.d.ts +37 -0
  28. package/components/NavbarCommandPalette.vue.js +1 -1
  29. package/components/Screen/ScreenFilter.vue.js +1 -1
  30. package/components/ToastNotification.vue.js +1 -1
  31. package/components/ToastNotification.vue2.js +3 -3
  32. package/components/index.d.ts +1 -1
  33. package/composables/useKeyStroke.d.ts +18 -0
  34. package/composables/useKeyStroke.js +103 -77
  35. package/composables/useTheme.js +1 -1
  36. package/index.d.ts +1 -0
  37. package/index.js +235 -233
  38. package/package.json +10 -3
  39. package/style.css +1 -1
  40. package/utils/environment.d.ts +29 -0
  41. package/utils/environment.js +4 -0
  42. package/utils/functions.js +14 -13
  43. /package/components/Dropdown/{DropdownMenu.vue2.js → DropdownMenu.vue3.js} +0 -0
@@ -1,6 +1,6 @@
1
- import { defineComponent as D, ref as b, watch as k, openBlock as v, createElementBlock as h, normalizeClass as B, Fragment as w, renderList as P, createBlock as E, withCtx as i, renderSlot as m, mergeProps as c } from "vue";
2
- import $ from "./KanbanBoard.vue.js";
3
- const U = /* @__PURE__ */ D({
1
+ import { defineComponent as G, ref as K, watch as U, openBlock as C, createElementBlock as P, normalizeClass as j, Fragment as q, renderList as w, createBlock as z, withCtx as v, renderSlot as g, mergeProps as h } from "vue";
2
+ import F from "./KanbanBoard.vue.js";
3
+ const T = /* @__PURE__ */ G({
4
4
  __name: "Kanban",
5
5
  props: {
6
6
  columns: {},
@@ -17,109 +17,173 @@ const U = /* @__PURE__ */ D({
17
17
  draggableClass: {},
18
18
  ghostClass: {},
19
19
  class: { default: "h-full w-full" },
20
- isItemDisabled: {}
20
+ isItemDisabled: {},
21
+ onItemMoved: {}
21
22
  },
22
- emits: ["change", "move", "update:data", "item-moved"],
23
- setup(s, { emit: I }) {
24
- const o = s, d = I, r = b({}), u = b({});
25
- k(
26
- [() => o.data, () => o.rawData],
27
- ([e, n]) => {
28
- if (n && Array.isArray(n)) {
29
- const t = {};
30
- o.columns.forEach((a) => t[a.id] = []), n.forEach((a) => {
31
- const l = a[o.groupKey];
32
- t[l] ? t[l].push({ ...a }) : t[l] = [{ ...a }];
33
- }), Object.keys(t).forEach((a) => {
34
- t[a].sort((l, x) => (l[o.positionKey] || 0) - (x[o.positionKey] || 0));
35
- }), u.value = t;
36
- } else e && (u.value = { ...e });
23
+ emits: ["change", "move", "update:data", "item-move-failed"],
24
+ setup(l, { emit: B }) {
25
+ const s = l, c = B, u = K({}), d = K({}), p = K(!1);
26
+ U(
27
+ [() => s.data, () => s.rawData],
28
+ ([e, a]) => {
29
+ if (!p.value)
30
+ if (a && Array.isArray(a)) {
31
+ const o = {};
32
+ s.columns.forEach((t) => o[t.id] = []), a.forEach((t) => {
33
+ const i = t[s.groupKey];
34
+ o[i] ? o[i].push({ ...t }) : o[i] = [{ ...t }];
35
+ }), Object.keys(o).forEach((t) => {
36
+ o[t].sort((i, r) => (i[s.positionKey] || 0) - (r[s.positionKey] || 0));
37
+ }), d.value = o;
38
+ } else e && (d.value = { ...e });
37
39
  },
38
40
  { immediate: !0, deep: !0 }
39
41
  );
40
- const C = (e, n) => {
41
- let t = 0, a = 0;
42
- return n > 0 && (t = Number(e[n - 1]?.[o.positionKey]) || 0), n < e.length - 1 && (a = Number(e[n + 1]?.[o.positionKey]) || 0), t === 0 && a === 0 ? 1024 : t === 0 ? a / 2 : a === 0 ? t + 1024 : (t + a) / 2;
43
- }, g = (e, n) => {
44
- const t = u.value[e];
45
- if (!t) return;
46
- const a = t[n];
47
- if (!a) return;
48
- const l = C(t, n);
49
- a[o.positionKey] = l, a[o.groupKey] = e, d("item-moved", a[o.itemKey], e, l, a);
50
- }, f = (e) => o.columns.find((n) => n.id === e)?.disabled === !0, K = (e) => {
51
- if (d("change", e), e.type === "remove")
52
- r.value.remove = { columnId: e.columnId, event: e.event };
42
+ const A = (e, a) => {
43
+ let o = 0, t = 0;
44
+ return a > 0 && (o = Number(e[a - 1]?.[s.positionKey]) || 0), a < e.length - 1 && (t = Number(e[a + 1]?.[s.positionKey]) || 0), o === 0 && t === 0 ? 1024 : o === 0 ? t / 2 : t === 0 ? o + 1024 : (o + t) / 2;
45
+ }, E = (e) => {
46
+ p.value = !0;
47
+ try {
48
+ const a = s.itemKey, o = { ...d.value }, t = [...o[e.toColumnId] || []];
49
+ let i = t.find((n) => n?.[a] === e.itemId) || e.item;
50
+ const r = t.findIndex((n) => n?.[a] === e.itemId);
51
+ if (r >= 0)
52
+ i = t.splice(r, 1)[0];
53
+ else if (e.fromColumnId === e.toColumnId) {
54
+ const n = t.findIndex((m) => m?.[a] === e.itemId);
55
+ n >= 0 && (i = t.splice(n, 1)[0]);
56
+ }
57
+ if (!i) return;
58
+ if (i[s.positionKey] = e.previousPosition, i[s.groupKey] = e.previousGroupValue, e.fromColumnId === e.toColumnId) {
59
+ const n = Math.min(Math.max(e.oldIndex, 0), t.length);
60
+ t.splice(n, 0, i), o[e.toColumnId] = t;
61
+ } else {
62
+ o[e.toColumnId] = t;
63
+ const n = [...o[e.fromColumnId] || []], m = n.findIndex((f) => f?.[a] === e.itemId);
64
+ m >= 0 && n.splice(m, 1);
65
+ const I = Math.min(Math.max(e.oldIndex, 0), n.length);
66
+ n.splice(I, 0, i), o[e.fromColumnId] = n;
67
+ }
68
+ d.value = o, s.data && c("update:data", { ...o });
69
+ } finally {
70
+ queueMicrotask(() => {
71
+ p.value = !1;
72
+ });
73
+ }
74
+ }, k = async (e, a, o, t) => {
75
+ const i = d.value[e];
76
+ if (!i) return;
77
+ const r = i[a];
78
+ if (!r) return;
79
+ const n = r[s.itemKey], m = r[s.positionKey], I = r[s.groupKey], f = A(i, a);
80
+ r[s.positionKey] = f, r[s.groupKey] = e;
81
+ const y = () => E({
82
+ itemId: n,
83
+ item: r,
84
+ fromColumnId: o,
85
+ toColumnId: e,
86
+ oldIndex: t,
87
+ previousPosition: m,
88
+ previousGroupValue: I
89
+ }), V = {
90
+ fromColumnId: o,
91
+ oldIndex: t,
92
+ newIndex: a,
93
+ previousPosition: m,
94
+ revert: y
95
+ };
96
+ c("move", {
97
+ itemId: n,
98
+ item: r,
99
+ fromColumnId: o,
100
+ toColumnId: e,
101
+ oldIndex: t,
102
+ newIndex: a
103
+ });
104
+ const D = s.onItemMoved;
105
+ if (D)
106
+ try {
107
+ await D(n, e, f, r, V) === !1 && y();
108
+ } catch (M) {
109
+ y(), c("item-move-failed", {
110
+ itemId: n,
111
+ toColumnId: e,
112
+ fromColumnId: o,
113
+ newPosition: f,
114
+ item: r,
115
+ error: M
116
+ });
117
+ }
118
+ }, b = (e) => s.columns.find((a) => a.id === e)?.disabled === !0, $ = (e) => {
119
+ if (c("change", e), e.type === "remove")
120
+ u.value.remove = { columnId: e.columnId, event: e.event };
53
121
  else if (e.type === "add")
54
- r.value.add = { columnId: e.columnId, event: e.event };
122
+ u.value.add = { columnId: e.columnId, event: e.event };
55
123
  else if (e.type === "update") {
56
- if (f(e.columnId)) {
57
- r.value = {};
124
+ if (b(e.columnId)) {
125
+ u.value = {};
58
126
  return;
59
127
  }
60
- g(e.columnId, e.event.newIndex), d("move", {
61
- itemId: e.event.data?.[o.itemKey] || e.event.item?._underlying_vm_?.[o.itemKey],
62
- item: e.event.data,
63
- fromColumnId: e.columnId,
64
- toColumnId: e.columnId,
65
- oldIndex: e.event.oldIndex,
66
- newIndex: e.event.newIndex
67
- });
128
+ k(
129
+ e.columnId,
130
+ e.event.newIndex,
131
+ e.columnId,
132
+ e.event.oldIndex
133
+ );
68
134
  }
69
- if (r.value.remove && r.value.add) {
70
- const { remove: n, add: t } = r.value;
71
- if (f(n.columnId) || f(t.columnId)) {
72
- r.value = {};
135
+ if (u.value.remove && u.value.add) {
136
+ const { remove: a, add: o } = u.value;
137
+ if (b(a.columnId) || b(o.columnId)) {
138
+ u.value = {};
73
139
  return;
74
140
  }
75
- g(t.columnId, t.event.newIndex), d("move", {
76
- itemId: t.event.data?.[o.itemKey],
77
- item: t.event.data,
78
- fromColumnId: n.columnId,
79
- toColumnId: t.columnId,
80
- oldIndex: n.event.oldIndex,
81
- newIndex: t.event.newIndex
82
- }), r.value = {};
141
+ k(
142
+ o.columnId,
143
+ o.event.newIndex,
144
+ a.columnId,
145
+ a.event.oldIndex
146
+ ), u.value = {};
83
147
  }
84
148
  setTimeout(() => {
85
- r.value = {};
149
+ u.value = {};
86
150
  }, 100);
87
- }, p = (e, n) => {
88
- u.value[e] = n, o.data && d("update:data", { ...o.data, [e]: n });
89
- }, y = (e) => u.value[e] || [];
90
- return (e, n) => (v(), h("div", {
91
- class: B([
151
+ }, L = (e, a) => {
152
+ d.value[e] = a, s.data && c("update:data", { ...s.data, [e]: a });
153
+ }, N = (e) => d.value[e] || [];
154
+ return (e, a) => (C(), P("div", {
155
+ class: j([
92
156
  "flex gap-4 scrollbar-thin overflow-x-auto p-1 scrollbar-thin-x scrollable-container",
93
- o.class
157
+ s.class
94
158
  ])
95
159
  }, [
96
- (v(!0), h(w, null, P(s.columns, (t) => (v(), E($, {
97
- key: t.id,
98
- column: t,
99
- group: s.group,
100
- "item-key": s.itemKey,
101
- "load-data": s.loadData,
102
- "column-data": y(t.id),
103
- "board-class": s.boardClass,
104
- "header-class": s.headerClass,
105
- "body-class": s.bodyClass,
106
- "draggable-class": s.draggableClass,
107
- "ghost-class": s.ghostClass,
108
- "is-item-disabled": s.isItemDisabled,
109
- onChange: K,
110
- "onUpdate:columnData": (a) => p(t.id, a)
160
+ (C(!0), P(q, null, w(l.columns, (o) => (C(), z(F, {
161
+ key: o.id,
162
+ column: o,
163
+ group: l.group,
164
+ "item-key": l.itemKey,
165
+ "load-data": l.loadData,
166
+ "column-data": N(o.id),
167
+ "board-class": l.boardClass,
168
+ "header-class": l.headerClass,
169
+ "body-class": l.bodyClass,
170
+ "draggable-class": l.draggableClass,
171
+ "ghost-class": l.ghostClass,
172
+ "is-item-disabled": l.isItemDisabled,
173
+ onChange: $,
174
+ "onUpdate:columnData": (t) => L(o.id, t)
111
175
  }, {
112
- header: i((a) => [
113
- m(e.$slots, "column-header", c({ ref_for: !0 }, a), void 0, !0)
176
+ header: v((t) => [
177
+ g(e.$slots, "column-header", h({ ref_for: !0 }, t), void 0, !0)
114
178
  ]),
115
- "prepend-item": i((a) => [
116
- m(e.$slots, "prepend-item", c({ ref_for: !0 }, a), void 0, !0)
179
+ "prepend-item": v((t) => [
180
+ g(e.$slots, "prepend-item", h({ ref_for: !0 }, t), void 0, !0)
117
181
  ]),
118
- item: i((a) => [
119
- m(e.$slots, "item", c({ ref_for: !0 }, a), void 0, !0)
182
+ item: v((t) => [
183
+ g(e.$slots, "item", h({ ref_for: !0 }, t), void 0, !0)
120
184
  ]),
121
- "append-item": i((a) => [
122
- m(e.$slots, "append-item", c({ ref_for: !0 }, a), void 0, !0)
185
+ "append-item": v((t) => [
186
+ g(e.$slots, "append-item", h({ ref_for: !0 }, t), void 0, !0)
123
187
  ]),
124
188
  _: 3
125
189
  }, 8, ["column", "group", "item-key", "load-data", "column-data", "board-class", "header-class", "body-class", "draggable-class", "ghost-class", "is-item-disabled", "onUpdate:columnData"]))), 128))
@@ -127,5 +191,5 @@ const U = /* @__PURE__ */ D({
127
191
  }
128
192
  });
129
193
  export {
130
- U as default
194
+ T as default
131
195
  };
@@ -38,6 +38,36 @@ export interface KanbanMoveEvent {
38
38
  oldIndex: number;
39
39
  newIndex: number;
40
40
  }
41
+ /**
42
+ * Extra context passed as the 5th argument to `onItemMoved` / `@item-moved`.
43
+ * `revert()` restores the card to its pre-drop column and index immediately.
44
+ */
45
+ export interface KanbanItemMovedMeta {
46
+ fromColumnId: string | number;
47
+ oldIndex: number;
48
+ newIndex: number;
49
+ previousPosition: any;
50
+ /** Imperative escape hatch — usually unnecessary; the board auto-reverts on reject/false. */
51
+ revert: () => void;
52
+ }
53
+ /**
54
+ * Async move handler. Return a Promise that settles when the server confirms.
55
+ *
56
+ * - resolve / return `void` | `true` → keep the optimistic placement
57
+ * - return `false` → auto-revert the card to its previous column/index
58
+ * - reject / throw → auto-revert (same as `false`)
59
+ *
60
+ * Bound via `:on-item-moved` or `@item-moved` (both map to this prop).
61
+ */
62
+ export type KanbanItemMovedHandler = (itemId: string | number, toColumnId: string | number, newPosition: number, item: any, meta: KanbanItemMovedMeta) => void | boolean | Promise<void | boolean>;
63
+ export interface KanbanItemMoveFailedPayload {
64
+ itemId: string | number;
65
+ toColumnId: string | number;
66
+ fromColumnId: string | number;
67
+ newPosition: number;
68
+ item: any;
69
+ error: unknown;
70
+ }
41
71
  export interface KanbanProps {
42
72
  columns: KanbanColumn[];
43
73
  group?: string;
@@ -61,4 +91,11 @@ export interface KanbanProps {
61
91
  * Example: :is-item-disabled="(item) => item.locked === true"
62
92
  */
63
93
  isItemDisabled?: (item: any) => boolean;
94
+ /**
95
+ * Called after an optimistic drop. Await a mutation here — if it rejects
96
+ * (or returns `false`), the board automatically moves the card back.
97
+ *
98
+ * Use `@item-moved` or `:on-item-moved` — both bind this prop.
99
+ */
100
+ onItemMoved?: KanbanItemMovedHandler;
64
101
  }
@@ -3,7 +3,7 @@ import L from "./Icon.vue.js";
3
3
  import v from "./Modal.vue.js";
4
4
  import N from "./CommandPalette/CommandPaletteContent.vue.js";
5
5
  import { $t as U } from "../utils/i18n.js";
6
- /* empty css */
6
+ /* empty css */
7
7
  const V = { class: "block truncate -text-fs-1.5" }, S = { class: "ml-auto inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] font-mono font-medium border border-border/80 bg-background text-muted-foreground ml-1" }, A = /* @__PURE__ */ x({
8
8
  __name: "NavbarCommandPalette",
9
9
  props: {
@@ -20,7 +20,7 @@ import "@vueuse/core";
20
20
  import "iconify-icon-picker";
21
21
  import "iconify-icon-picker/style.css";
22
22
  /* empty css */
23
- /* empty css */
23
+ /* empty css */
24
24
  /* empty css */
25
25
  /* empty css */
26
26
  /* empty css */
@@ -1,7 +1,7 @@
1
1
  import o from "./ToastNotification.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../_virtual/_plugin-vue_export-helper.js";
4
- const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-9c775c23"]]);
4
+ const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-b3a7f1a6"]]);
5
5
  export {
6
6
  r as default
7
7
  };
@@ -87,7 +87,7 @@ const Z = {
87
87
  (o(), y(U, { to: "body" }, [
88
88
  (o(), i(v, null, _(V, (t) => m("div", {
89
89
  key: t,
90
- class: g(["fixed z-[9999999999]! px-4 flex flex-col gap-2 transition-all duration-300 max-w-full sm:max-w-120", [
90
+ class: g(["fixed z-[9999999999]! pointer-events-none px-4 flex flex-col gap-2 transition-all duration-300 max-w-full sm:max-w-120", [
91
91
  N[t],
92
92
  t.includes("center") ? "items-center" : t.includes("right") ? "items-end" : "items-start"
93
93
  ]]),
@@ -95,7 +95,7 @@ const Z = {
95
95
  onMouseleave: j
96
96
  }, [
97
97
  m("div", {
98
- class: g(["relative w-full transition-all pointer-events-auto", [{ "flex-col-reverse": t.includes("top") }]])
98
+ class: g(["relative w-full transition-all", [{ "flex-col-reverse": t.includes("top") }]])
99
99
  }, [
100
100
  w(q, {
101
101
  name: d(t).length <= 1 ? "first-toast" : "stack-toast",
@@ -117,7 +117,7 @@ const Z = {
117
117
  if (a && a.key === r.id && J(a, u)) return a;
118
118
  const f = (o(), i("div", {
119
119
  key: r.id,
120
- class: g(["toast-item col-start-1 h-max row-start-1 mb-1 w-auto border pl-4 pr-6 py-2.5 flex gap-2.5 items-start transition-all duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] transform-gpu", [
120
+ class: g(["toast-item pointer-events-auto col-start-1 h-max row-start-1 mb-1 w-auto border pl-4 pr-6 py-2.5 flex gap-2.5 items-start transition-all duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] transform-gpu", [
121
121
  D(r.type),
122
122
  r.description || r.action ? "rounded-xl" : "rounded-full"
123
123
  ]]),
@@ -15,7 +15,7 @@ export * from './Cart';
15
15
  export { default as CheckBox } from './CheckBox.vue';
16
16
  export { Chip } from './Chip';
17
17
  export { ChoiceBox } from './ChoiceBox';
18
- export { ColorPicker } from './ColorPicker';
18
+ export { ColorPicker, COLOR_PICKER_RESET_VALUE } from './ColorPicker';
19
19
  export { default as ConfirmationModal } from './ConfirmationModal.vue';
20
20
  export { CustomFields } from './Form';
21
21
  export { DataList } from './DataList';
@@ -12,7 +12,25 @@ interface KeyStrokeComposable {
12
12
  offKeyStroke: (key: string | string[], handler?: KeyStrokeHandler) => void;
13
13
  destroy: () => void;
14
14
  }
15
+ /**
16
+ * SSR-safe keyboard composable.
17
+ *
18
+ * Components may call `useKeyStroke()` and register handlers unconditionally
19
+ * during `setup()` — including on the server. Registrations are stored in
20
+ * plain per-composable state; actual DOM listeners are attached only in the
21
+ * browser, after the owning component has mounted (or immediately when used
22
+ * outside a component in a browser context). Default event targets are
23
+ * resolved lazily at attach time, never during registration.
24
+ */
15
25
  export declare const useKeyStroke: () => KeyStrokeComposable;
26
+ /**
27
+ * SSR-safe advanced keyboard-shortcut composable.
28
+ *
29
+ * Combination parsing, meta⇄ctrl alternatives, and matching order are
30
+ * unchanged. Global `window`/`document` listeners are attached only in the
31
+ * browser after mount (or immediately when used outside a component in a
32
+ * browser context) and are always detached on unmount.
33
+ */
16
34
  export declare const useAdvancedKeyStroke: () => {
17
35
  onKeyStroke: (keys: string, handler: KeyStrokeHandler) => void;
18
36
  offKeyStroke: (keys: string, handler?: KeyStrokeHandler) => void;
@@ -1,94 +1,120 @@
1
- import { onUnmounted as k } from "vue";
2
- const S = () => {
3
- const o = /* @__PURE__ */ new Map(), r = (n) => {
4
- const f = s(n.key), c = o.get(f);
5
- c && c.forEach(({ handler: y, options: u }) => {
6
- u?.preventDefault && n.preventDefault(), u?.stopPropagation && n.stopPropagation(), y(n);
1
+ import { getCurrentInstance as A, onMounted as T, onUnmounted as D, unref as x } from "vue";
2
+ import { isBrowser as S } from "../utils/environment.js";
3
+ const U = () => {
4
+ const o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), u = [], m = A();
5
+ let p = S && !m;
6
+ const g = (n) => n ? n.toLowerCase() : "", v = (n) => {
7
+ const s = g(n.key), r = o.get(s);
8
+ r && r.forEach(({ handler: f, options: d }) => {
9
+ d?.preventDefault && n.preventDefault(), d?.stopPropagation && n.stopPropagation(), f(n);
7
10
  });
8
- }, s = (n) => n ? n.toLowerCase() : "", p = (n) => n ? "value" in n ? n.value || document : n || document : document, w = (n, f, c = {}) => {
9
- const y = Array.isArray(n) ? n : [n], u = p(c.target);
10
- y.forEach((d) => {
11
- const m = s(d);
12
- o.has(m) || (o.set(m, /* @__PURE__ */ new Set()), u.addEventListener("keydown", r, {
13
- passive: c.passive ?? !0,
14
- capture: c.capture ?? !1
15
- })), o.get(m).add({ handler: f, options: c });
16
- });
17
- }, v = (n, f) => {
18
- (Array.isArray(n) ? n : [n]).forEach((y) => {
19
- const u = s(y), d = o.get(u);
20
- d && (f ? d.forEach((m) => {
21
- m.handler === f && d.delete(m);
22
- }) : d.clear(), d.size === 0 && (o.delete(u), document.removeEventListener("keydown", r)));
23
- });
24
- }, K = () => {
25
- document.removeEventListener("keydown", r), o.clear();
11
+ }, k = (n) => S ? x(n) ?? document : null, E = (n) => {
12
+ const s = k(n.target);
13
+ if (!s) return;
14
+ const r = n.capture ?? !1, f = i.get(s);
15
+ f?.has(r) || (s.addEventListener("keydown", v, {
16
+ passive: n.passive ?? !0,
17
+ capture: r
18
+ }), i.set(s, (f ?? /* @__PURE__ */ new Set()).add(r)));
19
+ }, C = (n) => {
20
+ p ? E(n) : u.push(n);
21
+ }, M = () => {
22
+ i.forEach((n, s) => {
23
+ n.forEach((r) => {
24
+ s.removeEventListener("keydown", v, { capture: r });
25
+ });
26
+ }), i.clear(), u.length = 0;
27
+ }, z = (n, s, r = {}) => {
28
+ (Array.isArray(n) ? n : [n]).forEach((d) => {
29
+ const l = g(d);
30
+ o.has(l) || o.set(l, /* @__PURE__ */ new Set());
31
+ const K = o.get(l);
32
+ let b = !1;
33
+ K.forEach((t) => {
34
+ t.handler === s && (b = !0);
35
+ }), b || K.add({ handler: s, options: r });
36
+ }), C(r);
37
+ }, w = (n, s) => {
38
+ (Array.isArray(n) ? n : [n]).forEach((f) => {
39
+ const d = g(f), l = o.get(d);
40
+ l && (s ? l.forEach((K) => {
41
+ K.handler === s && l.delete(K);
42
+ }) : l.clear(), l.size === 0 && o.delete(d));
43
+ }), o.size === 0 && M();
44
+ }, L = () => {
45
+ M(), o.clear();
26
46
  };
27
- return k(() => {
28
- K();
29
- }), {
30
- onKeyStroke: w,
31
- offKeyStroke: v,
32
- destroy: K
47
+ return m && (T(() => {
48
+ p = !0, u.splice(0).forEach(E);
49
+ }), D(L)), {
50
+ onKeyStroke: z,
51
+ offKeyStroke: w,
52
+ destroy: L
33
53
  };
34
- }, M = () => {
35
- const o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map();
36
- let s = null;
37
- const p = (t) => {
54
+ }, q = () => {
55
+ const o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map();
56
+ let u = null, m = !1, p = !1;
57
+ const g = A();
58
+ let v = S && !g;
59
+ const k = (t) => {
38
60
  if (!t) return "";
39
61
  const e = t.toLowerCase();
40
62
  return e === "cmd" || e === "meta" || e === "metakey" ? "meta" : e === "ctrl" || e === "control" || e === "controlkey" ? "ctrl" : e === "alt" || e === "option" || e === "altkey" ? "alt" : e === "shift" || e === "shiftkey" ? "shift" : e;
41
- }, w = (t) => t.toLowerCase().split("+").map((e) => e.trim()).map(p).sort(), v = (t) => {
42
- const e = [t.join("+")], h = t.includes("meta"), l = t.includes("ctrl");
63
+ }, E = (t) => t.toLowerCase().split("+").map((e) => e.trim()).map(k).sort(), C = (t) => {
64
+ const e = [t.join("+")], h = t.includes("meta"), y = t.includes("ctrl");
43
65
  if (h) {
44
- const i = t.map((a) => a === "meta" ? "ctrl" : a);
45
- e.push(i.join("+"));
46
- } else if (l) {
47
- const i = t.map((a) => a === "ctrl" ? "meta" : a);
48
- e.push(i.join("+"));
66
+ const a = t.map((c) => c === "meta" ? "ctrl" : c);
67
+ e.push(a.join("+"));
68
+ } else if (y) {
69
+ const a = t.map((c) => c === "ctrl" ? "meta" : c);
70
+ e.push(a.join("+"));
49
71
  }
50
72
  return e;
51
- }, K = (t) => {
73
+ }, M = (t) => {
52
74
  const e = [];
53
75
  return t.metaKey && e.push("meta"), t.ctrlKey && e.push("ctrl"), t.altKey && e.push("alt"), t.shiftKey && e.push("shift"), e.sort();
54
- }, n = (t, e) => t.length !== e.length ? !1 : t.every((h, l) => h === e[l]), f = (t) => {
55
- const e = p(t.key);
56
- s && (clearTimeout(s), s = null);
57
- const l = [...K(t)];
58
- ["meta", "ctrl", "alt", "shift"].includes(e) || l.push(e), l.sort(), r.forEach((i, a) => {
59
- const b = w(a);
60
- n(b, l) && i.forEach((C) => C(t));
61
- }), s = window.setTimeout(() => {
62
- o.clear(), s = null;
76
+ }, z = (t, e) => t.length !== e.length ? !1 : t.every((h, y) => h === e[y]), w = () => {
77
+ u && (clearTimeout(u), u = null);
78
+ }, L = (t) => {
79
+ const e = k(t.key);
80
+ w();
81
+ const y = [...M(t)];
82
+ ["meta", "ctrl", "alt", "shift"].includes(e) || y.push(e), y.sort(), i.forEach((a, c) => {
83
+ const j = E(c);
84
+ z(j, y) && a.forEach((R) => R(t));
85
+ }), u = setTimeout(() => {
86
+ o.clear(), u = null;
63
87
  }, 100);
64
- }, c = (t) => {
65
- const e = p(t.key);
66
- o.delete(e), s && (clearTimeout(s), s = null);
67
- }, y = () => {
68
- o.clear(), s && (clearTimeout(s), s = null);
69
- }, u = () => {
70
- document.hidden && (o.clear(), s && (clearTimeout(s), s = null));
88
+ }, n = (t) => {
89
+ const e = k(t.key);
90
+ o.delete(e), w();
91
+ }, s = () => {
92
+ o.clear(), w();
93
+ }, r = () => {
94
+ document.hidden && (o.clear(), w());
95
+ }, f = () => {
96
+ !S || m || (m = !0, window.addEventListener("keydown", L, { passive: !1 }), window.addEventListener("keyup", n, { passive: !1 }), window.addEventListener("blur", s, { passive: !0 }), document.addEventListener("visibilitychange", r, { passive: !0 }));
71
97
  }, d = () => {
72
- window.addEventListener("keydown", f, { passive: !1 }), window.addEventListener("keyup", c, { passive: !1 }), window.addEventListener("blur", y, { passive: !0 }), document.addEventListener("visibilitychange", u, { passive: !0 });
73
- }, m = () => {
74
- window.removeEventListener("keydown", f), window.removeEventListener("keyup", c), window.removeEventListener("blur", y), document.removeEventListener("visibilitychange", u), s && (clearTimeout(s), s = null);
75
- }, L = (t, e) => {
76
- const h = w(t), l = v(h);
77
- l.forEach((i) => {
78
- r.has(i) || r.set(i, /* @__PURE__ */ new Set()), r.get(i).add(e);
79
- }), r.size === l.length && d();
80
- }, g = (t, e) => {
81
- const h = w(t);
82
- v(h).forEach((i) => {
83
- const a = r.get(i);
84
- a && (e ? a.delete(e) : a.clear(), a.size === 0 && r.delete(i));
85
- }), r.size === 0 && m();
86
- }, E = () => {
87
- m(), r.clear(), o.clear();
98
+ m && (m = !1, window.removeEventListener("keydown", L), window.removeEventListener("keyup", n), window.removeEventListener("blur", s), document.removeEventListener("visibilitychange", r)), w();
99
+ }, l = (t, e) => {
100
+ const h = E(t);
101
+ C(h).forEach((a) => {
102
+ i.has(a) || i.set(a, /* @__PURE__ */ new Set()), i.get(a).add(e);
103
+ }), p = !0, v && f();
104
+ }, K = (t, e) => {
105
+ const h = E(t);
106
+ C(h).forEach((a) => {
107
+ const c = i.get(a);
108
+ c && (e ? c.delete(e) : c.clear(), c.size === 0 && i.delete(a));
109
+ }), i.size === 0 && (p = !1, d());
110
+ }, b = () => {
111
+ d(), i.clear(), o.clear(), p = !1;
88
112
  };
89
- return k(E), { onKeyStroke: L, offKeyStroke: g, destroy: E };
113
+ return g && (T(() => {
114
+ v = !0, p && f();
115
+ }), D(b)), { onKeyStroke: l, offKeyStroke: K, destroy: b };
90
116
  };
91
117
  export {
92
- M as useAdvancedKeyStroke,
93
- S as useKeyStroke
118
+ q as useAdvancedKeyStroke,
119
+ U as useKeyStroke
94
120
  };
@@ -20,7 +20,7 @@ function c() {
20
20
  d(
21
21
  t,
22
22
  (i) => {
23
- localStorage.setItem("builto-theme", i), n(i);
23
+ typeof window > "u" || (localStorage.setItem("builto-theme", i), n(i));
24
24
  },
25
25
  { immediate: !0 }
26
26
  ), r(() => {
package/index.d.ts CHANGED
@@ -97,6 +97,7 @@ export { default as ThemeToggle } from './components/ThemeToggle.vue';
97
97
  export { default as GoogleLogin } from './components/GoogleLogin.vue';
98
98
  export { default as GoogleMap } from './components/GoogleMap.vue';
99
99
  export { default as ColorPicker } from './components/ColorPicker/ColorPicker.vue';
100
+ export { COLOR_PICKER_RESET_VALUE } from './components/ColorPicker/constants';
100
101
  export { default as ConfirmationModal } from './components/ConfirmationModal.vue';
101
102
  export { default as ToastNotification } from './components/ToastNotification.vue';
102
103
  export { default as CommandPaletteContent } from './components/CommandPalette/CommandPaletteContent.vue';