@septkit/ui 0.0.86 → 0.0.88

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.
@@ -0,0 +1,43 @@
1
+ //#region lib/explorer/explorer-search.ts
2
+ function e(e) {
3
+ return e.trim().toLowerCase();
4
+ }
5
+ function t(t, r) {
6
+ let i = e(r);
7
+ return i ? n(t, i) : t;
8
+ }
9
+ function n(e, t) {
10
+ return e.flatMap((e) => {
11
+ let r = e.children ? n(e.children, t) : [];
12
+ return r.length ? [{
13
+ ...e,
14
+ children: r
15
+ }] : e.name.toLowerCase().includes(t) ? [{
16
+ ...e,
17
+ children: void 0
18
+ }] : [];
19
+ });
20
+ }
21
+ function r(e, t) {
22
+ for (let n of e) {
23
+ if (n.id === t) return [];
24
+ let e = n.children ? r(n.children, t) : void 0;
25
+ if (e) return [n.id, ...e];
26
+ }
27
+ }
28
+ function i(t, n) {
29
+ let r = e(n), i = t.toLowerCase(), a = [], o = 0, s = r ? i.indexOf(r) : -1;
30
+ for (; s !== -1;) s > o && a.push({
31
+ text: t.slice(o, s),
32
+ match: !1
33
+ }), o = s + r.length, a.push({
34
+ text: t.slice(s, o),
35
+ match: !0
36
+ }), s = i.indexOf(r, o);
37
+ return o < t.length && a.push({
38
+ text: t.slice(o),
39
+ match: !1
40
+ }), a;
41
+ }
42
+ //#endregion
43
+ export { t as filterExplorerTree, r as findAncestorIds, i as splitByMatch };
@@ -1,7 +1,7 @@
1
- import e from "./explorer.vue_vue_type_script_setup_true_lang.js";
1
+ import e from "../_virtual/_plugin-vue_export-helper.js";
2
+ import t from "./explorer.vue_vue_type_script_setup_true_lang.js";
2
3
  /* empty css */
3
- import t from "../_virtual/_plugin-vue_export-helper.js";
4
4
  //#region lib/explorer/explorer.vue
5
- var n = /*#__PURE__*/ t(e, [["__scopeId", "data-v-9c9e7075"]]);
5
+ var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-ab2f0eec"]]);
6
6
  //#endregion
7
7
  export { n as default };
@@ -1,12 +1,22 @@
1
- import { TreeRoot_default as e } from "../external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Tree/TreeRoot.js";
2
- import { TreeItem_default as t } from "../external/.pnpm/reka-ui@2.10.1_vue@3.5.39_typescript@5.8.3_/node_modules/reka-ui/dist/Tree/TreeItem.js";
3
- import n from "../external/.pnpm/@lucide_vue@1.23.0_vue@3.5.39_typescript@5.8.3_/node_modules/@lucide/vue/dist/esm/icons/chevron-right.js";
4
- import r from "../icons/element-badge.js";
5
- import "../icons/index.js";
6
- import { collectExpandableNodeIds as i } from "./collect-expandable-node-ids.js";
7
- import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, defineComponent as d, mergeProps as f, normalizeClass as p, normalizeStyle as m, openBlock as h, renderList as g, renderSlot as _, toDisplayString as v, unref as y, withCtx as b, withModifiers as x } from "vue";
1
+ import e from "../external/.pnpm/@lucide_vue@1.23.0_vue@3.5.39_typescript@5.8.3_/node_modules/@lucide/vue/dist/esm/icons/chevron-right.js";
2
+ import t from "../external/.pnpm/@lucide_vue@1.23.0_vue@3.5.39_typescript@5.8.3_/node_modules/@lucide/vue/dist/esm/icons/chevrons-down-up.js";
3
+ import n from "../external/.pnpm/@lucide_vue@1.23.0_vue@3.5.39_typescript@5.8.3_/node_modules/@lucide/vue/dist/esm/icons/chevrons-up-down.js";
4
+ import r from "../external/.pnpm/@lucide_vue@1.23.0_vue@3.5.39_typescript@5.8.3_/node_modules/@lucide/vue/dist/esm/icons/search.js";
5
+ import i from "../external/.pnpm/@lucide_vue@1.23.0_vue@3.5.39_typescript@5.8.3_/node_modules/@lucide/vue/dist/esm/icons/x.js";
6
+ import { collectExpandableNodeIds as a } from "../tree/collect-expandable-node-ids.js";
7
+ import o from "../tree/tree.js";
8
+ import "../tree/index.js";
9
+ import { filterExplorerTree as s, findAncestorIds as c, splitByMatch as l } from "./explorer-search.js";
10
+ import { Fragment as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createSlots as g, createTextVNode as _, createVNode as v, defineComponent as y, normalizeClass as b, openBlock as x, ref as S, renderList as C, renderSlot as w, toDisplayString as T, unref as E, vModelText as D, watch as O, withCtx as k, withDirectives as A, withKeys as j, withModifiers as M } from "vue";
8
11
  //#region lib/explorer/explorer.vue?vue&type=script&setup=true&lang.ts
9
- var S = ["onClick", "onContextmenu"], C = { class: "flex flex-1 items-center min-w-0" }, w = { class: "pl-2 truncate" }, T = { class: "shrink-0 ml-auto pl-2" }, E = /*@__PURE__*/ d({
12
+ var ee = { class: "explorer flex flex-col gap-2" }, N = { class: "flex items-center gap-1 bg-base-100" }, P = { class: "input input-sm flex-1" }, F = ["disabled", "aria-label"], I = {
13
+ key: 0,
14
+ class: "label",
15
+ role: "status"
16
+ }, L = { class: "pl-2 truncate" }, R = {
17
+ key: 0,
18
+ class: "rounded-sm bg-warning/40 text-inherit"
19
+ }, z = /*@__PURE__*/ y({
10
20
  __name: "explorer",
11
21
  props: {
12
22
  items: {},
@@ -23,87 +33,134 @@ var S = ["onClick", "onContextmenu"], C = { class: "flex flex-1 items-center min
23
33
  "contextmenu",
24
34
  "update:expanded"
25
35
  ],
26
- setup(d, { emit: E }) {
27
- let D = d, O = E, k = o(() => D.expanded.all ? i(D.items) : D.expanded.scoped), A = o(() => D.selected === void 0 ? void 0 : j(D.items, D.selected));
28
- function j(e, t) {
29
- for (let n of e) {
30
- if (n.id === t) return n;
31
- let e = n.children ? j(n.children, t) : void 0;
32
- if (e) return e;
33
- }
36
+ setup(y, { emit: z }) {
37
+ let B = y, V = z, H = S(""), U = S(), W = d(() => H.value.trim().length > 0), G = d(() => s(B.items, H.value)), K = d(() => W.value ? {
38
+ scoped: [],
39
+ all: !0
40
+ } : B.expanded), q = d(() => a(B.items)), J = d(() => B.expanded.all ? q.value : B.expanded.scoped), Y = d(() => {
41
+ if (B.expanded.all) return q.value.length > 0;
42
+ if (!q.value.length) return !1;
43
+ let e = new Set(B.expanded.scoped);
44
+ return q.value.every((t) => e.has(t));
45
+ });
46
+ O(() => B.selected, (e) => {
47
+ e === void 0 || !W.value || c(B.items, e) !== void 0 && c(G.value, e) === void 0 && (H.value = "");
48
+ }), O(H, (e, t) => {
49
+ if (!t.trim() || e.trim()) return;
50
+ let n = B.selected ?? U.value;
51
+ if (n === void 0 || B.expanded.all) return;
52
+ let r = c(B.items, n);
53
+ r !== void 0 && V("update:expanded", {
54
+ scoped: [.../* @__PURE__ */ new Set([...B.expanded.scoped, ...r])],
55
+ all: !1
56
+ });
57
+ });
58
+ function X() {
59
+ V("update:expanded", {
60
+ scoped: [],
61
+ all: !Y.value
62
+ });
34
63
  }
35
- return (i, o) => (h(), s(y(e), {
36
- class: "explorer-tree list-none select-none w-full text-stone-700 text-sm font-medium",
37
- items: D.items,
38
- "get-key": (e) => e.id,
39
- expanded: k.value,
40
- "model-value": A.value,
41
- "aria-label": D.ariaLabel,
42
- "onUpdate:expanded": o[1] ||= (e) => O("update:expanded", {
43
- scoped: e,
64
+ function Z(e) {
65
+ let t = J.value.includes(e) ? J.value.filter((t) => t !== e) : [...J.value, e];
66
+ V("update:expanded", {
67
+ scoped: t,
44
68
  all: !1
45
- })
46
- }, {
47
- default: b(({ flattenItems: e }) => [(h(!0), l(a, null, g(e, (e) => (h(), s(y(t), f({ key: e.value.id }, { ref_for: !0 }, e.bind, {
48
- "aria-label": D.rowLabel?.(e.value),
49
- class: ["explorer-tree__item px-2 py-1 my-0.5 rounded outline-none", e.value.selectable === !1 ? "" : "explorer-tree__item--selectable"],
50
- onSelect: (t) => {
51
- t.detail.originalEvent.type === "click" || e.value.selectable === !1 ? t.preventDefault() : O("select", e.value);
52
- },
53
- onToggle: o[0] ||= (e) => {
54
- e.detail.originalEvent.type === "click" && e.preventDefault();
55
- }
56
- }), {
57
- default: b(({ handleSelect: t, handleToggle: a }) => [u("div", {
58
- class: p(["flex items-center", e.value.selectable !== !1 || e.hasChildren ? "cursor-pointer" : "cursor-default"]),
59
- style: m({ "padding-left": e.level === 1 ? "0rem" : `${e.level - 1.5}rem` }),
60
- onClick: () => {
61
- e.value.selectable === !1 ? e.hasChildren && a() : (t(), O("select", e.value));
62
- },
63
- onContextmenu: x((t) => O("contextmenu", {
64
- node: e.value,
65
- event: t
66
- }), ["prevent"])
67
- }, [
68
- e.hasChildren ? (h(), s(y(n), {
69
- key: 0,
70
- "aria-hidden": "true",
71
- class: "explorer-tree__chevron shrink-0",
72
- size: 16,
73
- onClick: x(() => {
74
- a();
75
- }, ["stop"])
76
- }, null, 8, ["onClick"])) : (h(), s(y(n), {
77
- key: 1,
78
- "aria-hidden": "true",
79
- class: "shrink-0 invisible",
80
- size: 16
81
- })),
82
- u("div", C, [
83
- _(i.$slots, "node-prefix", { node: e.value }, void 0, !0),
84
- e.value.tag ? (h(), s(y(r), {
85
- key: 0,
86
- "tag-name": e.value.tag
87
- }, null, 8, ["tag-name"])) : c("", !0),
88
- _(i.$slots, "node-label", { node: e.value }, () => [u("span", w, v(e.value.name), 1)], !0)
89
- ]),
90
- u("div", T, [_(i.$slots, "node-suffix", { node: e.value }, void 0, !0)])
91
- ], 46, S)]),
92
- _: 2
93
- }, 1040, [
94
- "aria-label",
95
- "class",
96
- "onSelect"
97
- ]))), 128))]),
98
- _: 3
99
- }, 8, [
69
+ });
70
+ }
71
+ function Q(e) {
72
+ e.selectable === !1 && e.children?.length && Z(e.id);
73
+ }
74
+ function te(e) {
75
+ U.value = e.id, V("select", e);
76
+ }
77
+ function ne(e) {
78
+ W.value || V("update:expanded", e);
79
+ }
80
+ function $() {
81
+ H.value = "";
82
+ }
83
+ return (a, s) => (x(), m("div", ee, [h("div", N, [h("label", P, [
84
+ v(E(r), {
85
+ "aria-hidden": "true",
86
+ size: 14,
87
+ class: "opacity-50"
88
+ }),
89
+ A(h("input", {
90
+ "onUpdate:modelValue": s[0] ||= (e) => H.value = e,
91
+ type: "text",
92
+ class: "grow",
93
+ placeholder: "Search by name",
94
+ "aria-label": "Search by name",
95
+ "data-testid": "explorer-search",
96
+ onKeydown: j($, ["esc"])
97
+ }, null, 544), [[D, H.value]]),
98
+ H.value ? (x(), m("button", {
99
+ key: 0,
100
+ type: "button",
101
+ class: "btn btn-ghost btn-circle btn-xs",
102
+ "aria-label": "Clear search",
103
+ onClick: $
104
+ }, [v(E(i), {
105
+ "aria-hidden": "true",
106
+ size: 14
107
+ })])) : p("", !0)
108
+ ]), h("button", {
109
+ type: "button",
110
+ class: "btn btn-ghost btn-square btn-sm",
111
+ disabled: W.value || !q.value.length,
112
+ "aria-label": Y.value ? "Collapse all" : "Expand all",
113
+ onClick: X
114
+ }, [Y.value ? (x(), f(E(n), {
115
+ key: 0,
116
+ "aria-hidden": "true",
117
+ size: 16
118
+ })) : (x(), f(E(t), {
119
+ key: 1,
120
+ "aria-hidden": "true",
121
+ size: 16
122
+ }))], 8, F)]), W.value && !G.value.length ? (x(), m("p", I, "No results")) : (x(), f(E(o), {
123
+ key: 1,
124
+ items: G.value,
125
+ expanded: K.value,
126
+ selected: B.selected ?? U.value,
127
+ "aria-label": B.ariaLabel,
128
+ "row-label": B.rowLabel,
129
+ onSelect: te,
130
+ onRowClick: Q,
131
+ onContextmenu: s[1] ||= (e) => V("contextmenu", e),
132
+ "onUpdate:expanded": ne
133
+ }, g({
134
+ "node-toggle": k(({ node: t, hasChildren: n, expanded: r }) => [v(E(e), {
135
+ "aria-hidden": "true",
136
+ size: 16,
137
+ class: b(["explorer__chevron shrink-0", {
138
+ invisible: !n || W.value,
139
+ "explorer__chevron--open": r
140
+ }]),
141
+ onClick: M((e) => Z(t.id), ["stop"])
142
+ }, null, 8, ["class", "onClick"])]),
143
+ "node-label": k(({ node: e }) => [w(a.$slots, "node-label", {
144
+ node: e,
145
+ term: H.value
146
+ }, () => [h("span", L, [(x(!0), m(u, null, C(E(l)(e.name, H.value), (e, t) => (x(), m(u, { key: t }, [e.match ? (x(), m("mark", R, T(e.text), 1)) : (x(), m(u, { key: 1 }, [_(T(e.text), 1)], 64))], 64))), 128))])], !0)]),
147
+ _: 2
148
+ }, [a.$slots["node-prefix"] ? {
149
+ name: "node-prefix",
150
+ fn: k(({ node: e }) => [w(a.$slots, "node-prefix", { node: e }, void 0, !0)]),
151
+ key: "0"
152
+ } : void 0, a.$slots["node-suffix"] ? {
153
+ name: "node-suffix",
154
+ fn: k(({ node: e }) => [w(a.$slots, "node-suffix", { node: e }, void 0, !0)]),
155
+ key: "1"
156
+ } : void 0]), 1032, [
100
157
  "items",
101
- "get-key",
102
158
  "expanded",
103
- "model-value",
104
- "aria-label"
105
- ]));
159
+ "selected",
160
+ "aria-label",
161
+ "row-label"
162
+ ]))]));
106
163
  }
107
164
  });
108
165
  //#endregion
109
- export { E as default };
166
+ export { z as default };
@@ -1,3 +1,2 @@
1
- import { collectExpandableNodeIds as e } from "./collect-expandable-node-ids.js";
2
- import t from "./explorer.js";
3
- export { t as SclExplorer, e as collectExpandableNodeIds };
1
+ import e from "./explorer.js";
2
+ export { e as SclExplorer };
@@ -0,0 +1,11 @@
1
+ import e from "../createLucideIcon.js";
2
+ //#region node_modules/.pnpm/@lucide+vue@1.23.0_vue@3.5.39_typescript@5.8.3_/node_modules/@lucide/vue/dist/esm/icons/chevrons-down-up.mjs
3
+ var t = [["path", {
4
+ d: "m7 20 5-5 5 5",
5
+ key: "13a0gw"
6
+ }], ["path", {
7
+ d: "m7 4 5 5 5-5",
8
+ key: "1kwcof"
9
+ }]], n = e("chevrons-down-up", t);
10
+ //#endregion
11
+ export { t as __iconNode, n as default };
@@ -0,0 +1,11 @@
1
+ import e from "../createLucideIcon.js";
2
+ //#region node_modules/.pnpm/@lucide+vue@1.23.0_vue@3.5.39_typescript@5.8.3_/node_modules/@lucide/vue/dist/esm/icons/chevrons-up-down.mjs
3
+ var t = [["path", {
4
+ d: "m7 15 5 5 5-5",
5
+ key: "1hf1tw"
6
+ }], ["path", {
7
+ d: "m7 9 5-5 5 5",
8
+ key: "sgt6xg"
9
+ }]], n = e("chevrons-up-down", t);
10
+ //#endregion
11
+ export { t as __iconNode, n as default };
@@ -0,0 +1,13 @@
1
+ import e from "../createLucideIcon.js";
2
+ //#region node_modules/.pnpm/@lucide+vue@1.23.0_vue@3.5.39_typescript@5.8.3_/node_modules/@lucide/vue/dist/esm/icons/search.mjs
3
+ var t = [["path", {
4
+ d: "m21 21-4.34-4.34",
5
+ key: "14j7rj"
6
+ }], ["circle", {
7
+ cx: "11",
8
+ cy: "11",
9
+ r: "8",
10
+ key: "4ej97u"
11
+ }]], n = e("search", t);
12
+ //#endregion
13
+ export { t as __iconNode, n as default };