@septkit/ui 0.0.17 → 0.0.19

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 (20) hide show
  1. package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
  2. package/dist/dropdown/combobox.vue_vue_type_script_setup_true_lang.js +67 -63
  3. package/dist/explorer/explorer.js +7 -0
  4. package/dist/explorer/explorer.vue_vue_type_script_setup_true_lang.js +73 -0
  5. package/dist/explorer/index.js +1 -0
  6. package/dist/external/.pnpm/@vueuse_core@14.2.1_vue@3.5.32_typescript@5.8.3_/node_modules/@vueuse/core/dist/index.js +32 -26
  7. package/dist/external/.pnpm/lucide-vue-next@1.0.0_vue@3.5.32_typescript@5.8.3_/node_modules/lucide-vue-next/dist/esm/icons/chevron-right.js +8 -0
  8. package/dist/external/.pnpm/reka-ui@2.9.6_vue@3.5.32_typescript@5.8.3_/node_modules/reka-ui/dist/Combobox/ComboboxPortal.js +33 -0
  9. package/dist/external/.pnpm/reka-ui@2.9.6_vue@3.5.32_typescript@5.8.3_/node_modules/reka-ui/dist/RovingFocus/RovingFocusGroup.js +119 -0
  10. package/dist/external/.pnpm/reka-ui@2.9.6_vue@3.5.32_typescript@5.8.3_/node_modules/reka-ui/dist/RovingFocus/RovingFocusItem.js +94 -0
  11. package/dist/external/.pnpm/reka-ui@2.9.6_vue@3.5.32_typescript@5.8.3_/node_modules/reka-ui/dist/RovingFocus/utils.js +17 -6
  12. package/dist/external/.pnpm/reka-ui@2.9.6_vue@3.5.32_typescript@5.8.3_/node_modules/reka-ui/dist/Teleport/Teleport.js +40 -0
  13. package/dist/external/.pnpm/reka-ui@2.9.6_vue@3.5.32_typescript@5.8.3_/node_modules/reka-ui/dist/Tree/TreeItem.js +136 -0
  14. package/dist/external/.pnpm/reka-ui@2.9.6_vue@3.5.32_typescript@5.8.3_/node_modules/reka-ui/dist/Tree/TreeRoot.js +199 -0
  15. package/dist/external/.pnpm/reka-ui@2.9.6_vue@3.5.32_typescript@5.8.3_/node_modules/reka-ui/dist/Tree/utils.js +6 -0
  16. package/dist/external/.pnpm/reka-ui@2.9.6_vue@3.5.32_typescript@5.8.3_/node_modules/reka-ui/dist/shared/useSelectionBehavior.js +40 -0
  17. package/dist/index.d.ts +23 -0
  18. package/dist/index.js +3 -1
  19. package/dist/ui.css +1 -1
  20. package/package.json +1 -1
@@ -0,0 +1,40 @@
1
+ import { useMounted as e } from "../../../../../@vueuse_core@14.2.1_vue@3.5.32_typescript@5.8.3_/node_modules/@vueuse/core/dist/index.js";
2
+ import { Teleport as t, createBlock as n, createCommentVNode as r, defineComponent as i, openBlock as a, renderSlot as o, unref as s } from "vue";
3
+ //#region node_modules/.pnpm/reka-ui@2.9.6_vue@3.5.32_typescript@5.8.3_/node_modules/reka-ui/dist/Teleport/Teleport.js
4
+ var c = /* @__PURE__ */ i({
5
+ __name: "Teleport",
6
+ props: {
7
+ to: {
8
+ type: null,
9
+ required: !1,
10
+ default: "body"
11
+ },
12
+ disabled: {
13
+ type: Boolean,
14
+ required: !1
15
+ },
16
+ defer: {
17
+ type: Boolean,
18
+ required: !1
19
+ },
20
+ forceMount: {
21
+ type: Boolean,
22
+ required: !1
23
+ }
24
+ },
25
+ setup(i) {
26
+ let c = e();
27
+ return (e, i) => s(c) || e.forceMount ? (a(), n(t, {
28
+ key: 0,
29
+ to: e.to,
30
+ disabled: e.disabled,
31
+ defer: e.defer
32
+ }, [o(e.$slots, "default")], 8, [
33
+ "to",
34
+ "disabled",
35
+ "defer"
36
+ ])) : r("v-if", !0);
37
+ }
38
+ });
39
+ //#endregion
40
+ export { c as Teleport_default };
@@ -0,0 +1,136 @@
1
+ import { getActiveElement as e } from "../shared/getActiveElement.js";
2
+ import { handleAndDispatchCustomEvent as t } from "../shared/handleAndDispatchCustomEvent.js";
3
+ import { Primitive as n } from "../Primitive/Primitive.js";
4
+ import { useCollection as r } from "../Collection/Collection.js";
5
+ import { RovingFocusItem_default as i } from "../RovingFocus/RovingFocusItem.js";
6
+ import { flatten as a } from "./utils.js";
7
+ import { injectTreeRootContext as o } from "./TreeRoot.js";
8
+ import { computed as s, createBlock as c, createVNode as l, defineComponent as u, mergeProps as d, openBlock as f, renderSlot as p, unref as m, withCtx as h, withKeys as g, withModifiers as _ } from "vue";
9
+ //#region node_modules/.pnpm/reka-ui@2.9.6_vue@3.5.32_typescript@5.8.3_/node_modules/reka-ui/dist/Tree/TreeItem.js
10
+ var v = "tree.select", y = "tree.toggle", b = /* @__PURE__ */ u({
11
+ inheritAttrs: !1,
12
+ __name: "TreeItem",
13
+ props: {
14
+ value: {
15
+ type: null,
16
+ required: !0
17
+ },
18
+ level: {
19
+ type: Number,
20
+ required: !0
21
+ },
22
+ asChild: {
23
+ type: Boolean,
24
+ required: !1
25
+ },
26
+ as: {
27
+ type: null,
28
+ required: !1,
29
+ default: "li"
30
+ }
31
+ },
32
+ emits: ["select", "toggle"],
33
+ setup(u, { expose: b, emit: x }) {
34
+ let S = u, C = x, w = o(), { getItems: T } = r(), E = s(() => !!w.getChildren(S.value)), D = s(() => {
35
+ let e = w.getKey(S.value);
36
+ return w.expanded.value.includes(e);
37
+ }), O = s(() => {
38
+ let e = w.getKey(S.value);
39
+ return w.selectedKeys.value.includes(e);
40
+ }), k = s(() => {
41
+ if (w.bubbleSelect.value && E.value && Array.isArray(w.modelValue.value)) {
42
+ let e = a(w.getChildren(S.value) || []);
43
+ return e.some((e) => w.modelValue.value.find((t) => w.getKey(t) === w.getKey(e))) && !e.every((e) => w.modelValue.value.find((t) => w.getKey(t) === w.getKey(e)));
44
+ } else if (w.propagateSelect.value && O.value && E.value && Array.isArray(w.modelValue.value)) return !a(w.getChildren(S.value) || []).every((e) => w.modelValue.value.find((t) => w.getKey(t) === w.getKey(e)));
45
+ else return;
46
+ });
47
+ function A(t) {
48
+ if (E.value) if (D.value) {
49
+ let t = T().map((e) => e.ref), n = e(), r = t.indexOf(n), i = [...t].slice(r).find((e) => Number(e.getAttribute("data-indent")) === S.level + 1);
50
+ i && i.focus();
51
+ } else F(t);
52
+ }
53
+ function j(t) {
54
+ if (D.value) F(t);
55
+ else {
56
+ let t = T().map((e) => e.ref), n = e(), r = t.indexOf(n), i = [...t].slice(0, r).reverse().find((e) => Number(e.getAttribute("data-indent")) === S.level - 1);
57
+ i && i.focus();
58
+ }
59
+ }
60
+ async function M(e) {
61
+ C("select", e), !e?.defaultPrevented && w.onSelect(S.value);
62
+ }
63
+ async function N(e) {
64
+ C("toggle", e), !e?.defaultPrevented && w.onToggle(S.value);
65
+ }
66
+ async function P(e) {
67
+ e && t(v, M, {
68
+ originalEvent: e,
69
+ value: S.value,
70
+ isExpanded: D.value,
71
+ isSelected: O.value
72
+ });
73
+ }
74
+ async function F(e) {
75
+ e && t(y, N, {
76
+ originalEvent: e,
77
+ value: S.value,
78
+ isExpanded: D.value,
79
+ isSelected: O.value
80
+ });
81
+ }
82
+ return b({
83
+ isExpanded: D,
84
+ isSelected: O,
85
+ isIndeterminate: k,
86
+ handleToggle: () => w.onToggle(S.value),
87
+ handleSelect: () => w.onSelect(S.value)
88
+ }), (e, t) => (f(), c(m(i), {
89
+ "as-child": "",
90
+ value: e.value,
91
+ "allow-shift-key": ""
92
+ }, {
93
+ default: h(() => [l(m(n), d(e.$attrs, {
94
+ role: "treeitem",
95
+ as: e.as,
96
+ "as-child": e.asChild,
97
+ "aria-selected": O.value,
98
+ "aria-expanded": E.value ? D.value : void 0,
99
+ "aria-level": e.level,
100
+ "data-indent": e.level,
101
+ "data-selected": O.value ? "" : void 0,
102
+ "data-expanded": D.value ? "" : void 0,
103
+ onKeydown: [
104
+ g(_(P, ["self", "prevent"]), ["enter", "space"]),
105
+ t[0] ||= g(_((e) => m(w).dir.value === "ltr" ? A(e) : j(e), ["prevent"]), ["right"]),
106
+ t[1] ||= g(_((e) => m(w).dir.value === "ltr" ? j(e) : A(e), ["prevent"]), ["left"])
107
+ ],
108
+ onClick: t[2] ||= _((e) => {
109
+ P(e), F(e);
110
+ }, ["stop"])
111
+ }), {
112
+ default: h(() => [p(e.$slots, "default", {
113
+ isExpanded: D.value,
114
+ isSelected: O.value,
115
+ isIndeterminate: k.value,
116
+ handleSelect: () => m(w).onSelect(e.value),
117
+ handleToggle: () => m(w).onToggle(e.value)
118
+ })]),
119
+ _: 3
120
+ }, 16, [
121
+ "as",
122
+ "as-child",
123
+ "aria-selected",
124
+ "aria-expanded",
125
+ "aria-level",
126
+ "data-indent",
127
+ "data-selected",
128
+ "data-expanded",
129
+ "onKeydown"
130
+ ])]),
131
+ _: 3
132
+ }, 8, ["value"]));
133
+ }
134
+ });
135
+ //#endregion
136
+ export { b as TreeItem_default };
@@ -0,0 +1,199 @@
1
+ import { createContext as e } from "../shared/createContext.js";
2
+ import { getActiveElement as t } from "../shared/getActiveElement.js";
3
+ import { createEventHook as n } from "../../../../../@vueuse_shared@14.2.1_vue@3.5.32_typescript@5.8.3_/node_modules/@vueuse/shared/dist/index.js";
4
+ import { useVModel as r } from "../../../../../@vueuse_core@14.2.1_vue@3.5.32_typescript@5.8.3_/node_modules/@vueuse/core/dist/index.js";
5
+ import { useDirection as i } from "../shared/useDirection.js";
6
+ import { useSelectionBehavior as a } from "../shared/useSelectionBehavior.js";
7
+ import { useTypeahead as o } from "../shared/useTypeahead.js";
8
+ import { Primitive as s } from "../Primitive/Primitive.js";
9
+ import { MAP_KEY_TO_FOCUS_INTENT as c } from "../RovingFocus/utils.js";
10
+ import { RovingFocusGroup_default as l } from "../RovingFocus/RovingFocusGroup.js";
11
+ import { flatten as u } from "./utils.js";
12
+ import { computed as d, createBlock as f, createVNode as p, defineComponent as m, nextTick as h, openBlock as g, ref as _, renderSlot as v, toRefs as y, unref as b, withCtx as x, withKeys as S, withModifiers as C } from "vue";
13
+ //#region node_modules/.pnpm/reka-ui@2.9.6_vue@3.5.32_typescript@5.8.3_/node_modules/reka-ui/dist/Tree/TreeRoot.js
14
+ var [w, T] = /* @__PURE__ */ e("TreeRoot"), E = /* @__PURE__ */ m({
15
+ __name: "TreeRoot",
16
+ props: {
17
+ modelValue: {
18
+ type: null,
19
+ required: !1
20
+ },
21
+ defaultValue: {
22
+ type: null,
23
+ required: !1
24
+ },
25
+ items: {
26
+ type: Array,
27
+ required: !1
28
+ },
29
+ expanded: {
30
+ type: Array,
31
+ required: !1
32
+ },
33
+ defaultExpanded: {
34
+ type: Array,
35
+ required: !1
36
+ },
37
+ getKey: {
38
+ type: Function,
39
+ required: !0
40
+ },
41
+ getChildren: {
42
+ type: Function,
43
+ required: !1,
44
+ default: (e) => e.children
45
+ },
46
+ selectionBehavior: {
47
+ type: String,
48
+ required: !1,
49
+ default: "toggle"
50
+ },
51
+ multiple: {
52
+ type: Boolean,
53
+ required: !1,
54
+ skipCheck: !0
55
+ },
56
+ dir: {
57
+ type: String,
58
+ required: !1
59
+ },
60
+ disabled: {
61
+ type: Boolean,
62
+ required: !1
63
+ },
64
+ propagateSelect: {
65
+ type: Boolean,
66
+ required: !1
67
+ },
68
+ bubbleSelect: {
69
+ type: Boolean,
70
+ required: !1
71
+ },
72
+ asChild: {
73
+ type: Boolean,
74
+ required: !1
75
+ },
76
+ as: {
77
+ type: null,
78
+ required: !1,
79
+ default: "ul"
80
+ }
81
+ },
82
+ emits: ["update:modelValue", "update:expanded"],
83
+ setup(e, { emit: m }) {
84
+ let w = e, E = m, { items: D, multiple: O, disabled: k, propagateSelect: A, dir: j, bubbleSelect: M } = y(w), { handleTypeaheadSearch: N } = o(), P = i(j), F = _(), I = _(!1), L = n(), R = r(w, "modelValue", E, {
85
+ defaultValue: w.defaultValue ?? (O.value ? [] : void 0),
86
+ passive: !0,
87
+ deep: !0
88
+ }), z = r(w, "expanded", E, {
89
+ defaultValue: w.defaultExpanded ?? [],
90
+ passive: w.expanded === void 0,
91
+ deep: !0
92
+ }), { onSelectItem: B, handleMultipleReplace: V } = a(R, w), H = d(() => O.value && Array.isArray(R.value) ? R.value.map((e) => w.getKey(e)) : [w.getKey(R.value ?? {})]);
93
+ function U(e, t = 1, n) {
94
+ return e.reduce((r, i, a) => {
95
+ let o = w.getKey(i), s = w.getChildren(i), c = z.value.includes(o), l = {
96
+ _id: o,
97
+ value: i,
98
+ index: a,
99
+ level: t,
100
+ parentItem: n,
101
+ hasChildren: !!s,
102
+ bind: {
103
+ value: i,
104
+ level: t,
105
+ "aria-setsize": e.length,
106
+ "aria-posinset": a + 1
107
+ }
108
+ };
109
+ return r.push(l), s && c && r.push(...U(s, t + 1, i)), r;
110
+ }, []);
111
+ }
112
+ let W = d(() => {
113
+ let e = w.items;
114
+ return z.value.map((e) => e), U(e ?? []);
115
+ });
116
+ function G(e) {
117
+ if (I.value) L.trigger(e);
118
+ else {
119
+ let t = F.value?.getItems() ?? [];
120
+ N(e.key, t);
121
+ }
122
+ }
123
+ function K(e) {
124
+ if (I.value) return;
125
+ let n = c[e.key];
126
+ h(() => {
127
+ V(n, t(), F.value?.getItems, W.value.map((e) => e.value));
128
+ });
129
+ }
130
+ function q(e) {
131
+ if (e.parentItem != null && Array.isArray(R.value) && w.multiple) {
132
+ let t = W.value.find((t) => e.parentItem != null && w.getKey(t.value) === w.getKey(e.parentItem));
133
+ t != null && (w.getChildren(t.value)?.every((e) => R.value.find((t) => w.getKey(t) === w.getKey(e))) ? R.value = [...R.value, t.value] : R.value = R.value.filter((e) => w.getKey(e) !== w.getKey(t.value)), q(t));
134
+ }
135
+ }
136
+ return T({
137
+ modelValue: R,
138
+ selectedKeys: H,
139
+ onSelect: (e) => {
140
+ let t = (t) => w.getKey(t ?? {}) === w.getKey(e), n = w.multiple && Array.isArray(R.value) ? R.value?.findIndex(t) !== -1 : void 0;
141
+ if (B(e, t), w.bubbleSelect && w.multiple && Array.isArray(R.value)) {
142
+ let t = W.value.find((t) => w.getKey(t.value) === w.getKey(e));
143
+ t != null && q(t);
144
+ }
145
+ if (w.propagateSelect && w.multiple && Array.isArray(R.value)) {
146
+ let t = u(w.getChildren(e) ?? []);
147
+ n ? R.value = [...R.value].filter((e) => !t.some((t) => w.getKey(e ?? {}) === w.getKey(t))) : R.value = [...R.value, ...t];
148
+ }
149
+ },
150
+ expanded: z,
151
+ onToggle(e) {
152
+ if (!(e && w.getChildren(e))) return;
153
+ let t = w.getKey(e) ?? e;
154
+ z.value.includes(t) ? z.value = z.value.filter((e) => e !== t) : z.value = [...z.value, t];
155
+ },
156
+ getKey: w.getKey,
157
+ getChildren: w.getChildren,
158
+ items: D,
159
+ expandedItems: W,
160
+ disabled: k,
161
+ multiple: O,
162
+ dir: P,
163
+ propagateSelect: A,
164
+ bubbleSelect: M,
165
+ isVirtual: I,
166
+ virtualKeydownHook: L,
167
+ handleMultipleReplace: V
168
+ }), (e, t) => (g(), f(b(l), {
169
+ ref_key: "rovingFocusGroupRef",
170
+ ref: F,
171
+ "as-child": "",
172
+ orientation: "vertical",
173
+ dir: b(P)
174
+ }, {
175
+ default: x(() => [p(b(s), {
176
+ role: "tree",
177
+ as: e.as,
178
+ "as-child": e.asChild,
179
+ "aria-multiselectable": b(O) ? !0 : void 0,
180
+ onKeydown: [G, S(C(K, ["shift"]), ["up", "down"])]
181
+ }, {
182
+ default: x(() => [v(e.$slots, "default", {
183
+ flattenItems: W.value,
184
+ modelValue: b(R),
185
+ expanded: b(z)
186
+ })]),
187
+ _: 3
188
+ }, 8, [
189
+ "as",
190
+ "as-child",
191
+ "aria-multiselectable",
192
+ "onKeydown"
193
+ ])]),
194
+ _: 3
195
+ }, 8, ["dir"]));
196
+ }
197
+ });
198
+ //#endregion
199
+ export { E as TreeRoot_default, w as injectTreeRootContext };
@@ -0,0 +1,6 @@
1
+ //#region node_modules/.pnpm/reka-ui@2.9.6_vue@3.5.32_typescript@5.8.3_/node_modules/reka-ui/dist/Tree/utils.js
2
+ function e(t) {
3
+ return t.reduce((t, n) => (t.push(n), n.children && t.push(...e(n.children)), t), []);
4
+ }
5
+ //#endregion
6
+ export { e as flatten };
@@ -0,0 +1,40 @@
1
+ import { findValuesBetween as e } from "./arrays.js";
2
+ import { ref as t } from "vue";
3
+ //#region node_modules/.pnpm/reka-ui@2.9.6_vue@3.5.32_typescript@5.8.3_/node_modules/reka-ui/dist/shared/useSelectionBehavior.js
4
+ function n(n, r) {
5
+ let i = t(), a = (e, t) => {
6
+ if (r.multiple && Array.isArray(n.value)) if (r.selectionBehavior === "replace") n.value = [e], i.value = e;
7
+ else {
8
+ let r = n.value.findIndex((e) => t(e));
9
+ r === -1 ? n.value = [...n.value, e] : n.value = n.value.filter((e, t) => t !== r);
10
+ }
11
+ else r.selectionBehavior === "replace" ? n.value = { ...e } : !Array.isArray(n.value) && t(n.value) ? n.value = void 0 : n.value = { ...e };
12
+ return n.value;
13
+ };
14
+ function o(t, a, o, s) {
15
+ if (!i?.value || !r.multiple || !Array.isArray(n.value)) return;
16
+ let c = o().filter((e) => e.ref.dataset.disabled !== "").find((e) => e.ref === a)?.value;
17
+ if (!c) return;
18
+ let l = null;
19
+ switch (t) {
20
+ case "prev":
21
+ case "next":
22
+ l = e(s, i.value, c);
23
+ break;
24
+ case "first":
25
+ l = e(s, i.value, s?.[0]);
26
+ break;
27
+ case "last":
28
+ l = e(s, i.value, s.at(-1));
29
+ break;
30
+ }
31
+ n.value = l;
32
+ }
33
+ return {
34
+ firstValue: i,
35
+ onSelectItem: a,
36
+ handleMultipleReplace: o
37
+ };
38
+ }
39
+ //#endregion
40
+ export { n as useSelectionBehavior };
package/dist/index.d.ts CHANGED
@@ -76,6 +76,12 @@ declare type __VLS_Props_3 = {
76
76
  disabled?: boolean;
77
77
  };
78
78
 
79
+ declare type __VLS_Props_4 = {
80
+ items: ExplorerNode[];
81
+ defaultExpandedItems?: string[];
82
+ ariaLabel?: string;
83
+ };
84
+
79
85
  declare type __VLS_PublicProps = {
80
86
  modelValue?: AcceptableValue;
81
87
  } & __VLS_Props_3;
@@ -158,4 +164,21 @@ export declare interface ElementColor {
158
164
  background: string;
159
165
  }
160
166
 
167
+ export declare type ExplorerNode = {
168
+ tag: string;
169
+ id: string;
170
+ name: string;
171
+ selectable?: boolean;
172
+ children?: ExplorerNode[];
173
+ };
174
+
175
+ export declare const SclExplorer: DefineComponent<__VLS_Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
176
+ select: (node: ExplorerNode) => any;
177
+ }, string, PublicProps, Readonly<__VLS_Props_4> & Readonly<{
178
+ onSelect?: ((node: ExplorerNode) => any) | undefined;
179
+ }>, {
180
+ defaultExpandedItems: string[];
181
+ ariaLabel: string;
182
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
183
+
161
184
  export { }
package/dist/index.js CHANGED
@@ -4,4 +4,6 @@ import n from "./dropdown/combobox.js";
4
4
  import "./dropdown/index.js";
5
5
  import { CATEGORY_ELEMENTS as r, ELEMENT_TO_COLOR as i, ELEMENT_TO_ICON as a } from "./icons/element-icon-mapper.js";
6
6
  import "./icons/index.js";
7
- export { e as Button, r as CATEGORY_ELEMENTS, n as Combobox, t as Dropdown, i as ELEMENT_TO_COLOR, a as ELEMENT_TO_ICON };
7
+ import o from "./explorer/explorer.js";
8
+ import "./explorer/index.js";
9
+ export { e as Button, r as CATEGORY_ELEMENTS, n as Combobox, t as Dropdown, i as ELEMENT_TO_COLOR, a as ELEMENT_TO_ICON, o as SclExplorer };