@septkit/ui 0.0.85 → 0.0.87

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,9 +1,11 @@
1
- import e from "../explorer/explorer.js";
2
- import "../explorer/index.js";
3
- import { buildTree as t, pruneForSearch as n } from "./build-tree.js";
4
- import { computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createSlots as c, defineComponent as l, normalizeClass as u, openBlock as d, ref as f, renderSlot as p, toDisplayString as m, unref as h, vModelText as g, withCtx as _, withDirectives as v } 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 { collectExpandableNodeIds as t } from "../tree/collect-expandable-node-ids.js";
3
+ import n from "../tree/tree.js";
4
+ import "../tree/index.js";
5
+ import { buildTree as r, pruneForSearch as i } from "./build-tree.js";
6
+ import { computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createSlots as ee, defineComponent as u, normalizeClass as d, openBlock as f, ref as p, renderSlot as m, toDisplayString as h, unref as g, vModelText as te, withCtx as _, withDirectives as v, withModifiers as y } from "vue";
5
7
  //#region lib/library-browser/library-browser.vue?vue&type=script&setup=true&lang.ts
6
- var y = { class: "library-browser" }, b = { class: "library-browser__tree" }, x = {
8
+ var b = { class: "library-browser" }, x = { class: "library-browser__tree" }, ne = {
7
9
  key: 0,
8
10
  class: "library-browser__source-actions",
9
11
  "data-testid": "library-browser-source-actions"
@@ -20,7 +22,7 @@ var y = { class: "library-browser" }, b = { class: "library-browser__tree" }, x
20
22
  }, O = {
21
23
  key: 3,
22
24
  class: "library-browser__offline-hint"
23
- }, k = "::", A = 9, j = /*@__PURE__*/ l({
25
+ }, k = "::", A = 9, j = /*@__PURE__*/ u({
24
26
  __name: "library-browser",
25
27
  props: {
26
28
  sources: {},
@@ -30,17 +32,17 @@ var y = { class: "library-browser" }, b = { class: "library-browser__tree" }, x
30
32
  activeFile: {}
31
33
  },
32
34
  emits: ["select", "select-folder"],
33
- setup(l, { emit: j }) {
34
- let M = l, N = j, P = f(), F = f(""), I = r(() => M.extensions.map((e) => e.toLowerCase())), L = r(() => {
35
+ setup(u, { emit: j }) {
36
+ let M = u, N = j, P = p(), F = p(""), I = a(() => M.extensions.map((e) => e.toLowerCase())), L = a(() => {
35
37
  let e = F.value.trim().toLowerCase();
36
- return M.sources.map((r) => {
37
- let i = r.status === "online" ? t(r.entries, I.value) : [];
38
+ return M.sources.map((t) => {
39
+ let n = t.status === "online" ? r(t.entries, I.value) : [];
38
40
  return {
39
- source: r,
40
- nodes: e ? n(i, e) : i
41
+ source: t,
42
+ nodes: e ? i(n, e) : n
41
43
  };
42
44
  });
43
- }), R = r(() => {
45
+ }), R = a(() => {
44
46
  let e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), r = M.selectableFolders === !0;
45
47
  return {
46
48
  items: L.value.map(({ source: i, nodes: a }) => (i.status === "offline" ? t.add(i.id) : a.some((e) => e.matchesExtension) || e.add(i.id), {
@@ -48,7 +50,7 @@ var y = { class: "library-browser" }, b = { class: "library-browser__tree" }, x
48
50
  name: i.label,
49
51
  tag: "",
50
52
  selectable: r && i.status === "online",
51
- children: i.status === "online" ? a.map((t) => Z(t, i.id, {
53
+ children: i.status === "online" ? a.map((t) => $(t, i.id, {
52
54
  emptyHints: e,
53
55
  fileIds: n,
54
56
  folderSelectable: r
@@ -71,14 +73,23 @@ var y = { class: "library-browser" }, b = { class: "library-browser__tree" }, x
71
73
  function B(e) {
72
74
  return !e.includes(k);
73
75
  }
74
- let V = r(() => F.value.trim().length > 0), H = f(G()), U = r(() => V.value ? {
76
+ let V = a(() => F.value.trim().length > 0), H = p(J()), U = a(() => V.value ? {
75
77
  scoped: [],
76
78
  all: !0
77
- } : H.value);
78
- function W(e) {
79
+ } : H.value), W = a(() => U.value.all ? t(R.value.items) : U.value.scoped);
80
+ function G(e) {
79
81
  V.value || (H.value = e, M.storageKey && localStorage.setItem(M.storageKey, JSON.stringify(e)));
80
82
  }
81
- function G() {
83
+ function K(e) {
84
+ G({
85
+ scoped: W.value.includes(e) ? W.value.filter((t) => t !== e) : [...W.value, e],
86
+ all: !1
87
+ });
88
+ }
89
+ function q(e) {
90
+ e.selectable === !1 && e.children?.length && K(e.id);
91
+ }
92
+ function J() {
82
93
  if (!M.storageKey) return {
83
94
  scoped: [],
84
95
  all: !1
@@ -95,7 +106,7 @@ var y = { class: "library-browser" }, b = { class: "library-browser__tree" }, x
95
106
  all: !1
96
107
  };
97
108
  }
98
- function K(e) {
109
+ function Y(e) {
99
110
  let t = e.indexOf(k);
100
111
  return t === -1 ? {
101
112
  sourceId: e,
@@ -105,38 +116,38 @@ var y = { class: "library-browser" }, b = { class: "library-browser__tree" }, x
105
116
  path: e.slice(t + 2)
106
117
  };
107
118
  }
108
- function q(e) {
109
- let t = J(e);
119
+ function X(e) {
120
+ let t = Z(e);
110
121
  return t !== void 0 && t.sourceId === M.activeFile?.sourceId && t.path === M.activeFile.path;
111
122
  }
112
- function J(e) {
113
- return R.value.fileIds.has(e.id) ? K(e.id) : void 0;
123
+ function Z(e) {
124
+ return R.value.fileIds.has(e.id) ? Y(e.id) : void 0;
114
125
  }
115
- function Y(e) {
126
+ function Q(e) {
116
127
  if (!P.value) return;
117
- let { sourceId: t, path: n } = K(P.value);
128
+ let { sourceId: t, path: n } = Y(P.value);
118
129
  if (t !== e) return;
119
130
  if (!R.value.fileIds.has(P.value)) return n;
120
131
  let r = n.lastIndexOf("/");
121
132
  return r === -1 ? "" : n.slice(0, r);
122
133
  }
123
- function X(e) {
134
+ function re(e) {
124
135
  if (e.selectable !== !1) {
125
136
  if (P.value = e.id, R.value.fileIds.has(e.id)) {
126
- N("select", K(e.id));
137
+ N("select", Y(e.id));
127
138
  return;
128
139
  }
129
- N("select-folder", K(e.id));
140
+ N("select-folder", Y(e.id));
130
141
  }
131
142
  }
132
- function Z(e, t, n) {
143
+ function $(e, t, n) {
133
144
  let r = `${t}${k}${e.path}`;
134
145
  return e.kind === "directory" ? (e.matchesExtension || n.emptyHints.add(r), {
135
146
  id: r,
136
147
  name: e.name,
137
148
  tag: "",
138
149
  selectable: n.folderSelectable,
139
- children: e.children.map((e) => Z(e, t, n))
150
+ children: e.children.map((e) => $(e, t, n))
140
151
  }) : (n.fileIds.add(r), {
141
152
  id: r,
142
153
  name: e.name,
@@ -144,51 +155,64 @@ var y = { class: "library-browser" }, b = { class: "library-browser__tree" }, x
144
155
  selectable: !0
145
156
  });
146
157
  }
147
- return (t, n) => (d(), o("div", y, [v(s("input", {
148
- "onUpdate:modelValue": n[0] ||= (e) => F.value = e,
158
+ return (t, r) => (f(), c("div", b, [v(l("input", {
159
+ "onUpdate:modelValue": r[0] ||= (e) => F.value = e,
149
160
  type: "search",
150
161
  class: "input input-sm library-browser__search",
151
162
  placeholder: "Search...",
152
163
  "data-testid": "library-browser-search"
153
- }, null, 512), [[g, F.value]]), s("div", b, [R.value.items.length ? (d(), i(h(e), {
164
+ }, null, 512), [[te, F.value]]), l("div", x, [R.value.items.length ? (f(), o(g(n), {
154
165
  key: 0,
155
166
  items: R.value.items,
156
167
  expanded: U.value,
157
168
  "aria-label": "Template Library Browser",
158
- "onUpdate:expanded": W,
159
- onSelect: X
160
- }, c({
169
+ "onUpdate:expanded": G,
170
+ onSelect: re,
171
+ onRowClick: q
172
+ }, ee({
173
+ "node-toggle": _(({ node: t, hasChildren: n, expanded: r }) => [n ? (f(), o(g(e), {
174
+ key: 0,
175
+ "aria-hidden": "true",
176
+ class: d(["explorer-tree__chevron shrink-0", { "explorer-tree__chevron--open": r }]),
177
+ size: 16,
178
+ onClick: y((e) => K(t.id), ["stop"])
179
+ }, null, 8, ["class", "onClick"])) : (f(), o(g(e), {
180
+ key: 1,
181
+ "aria-hidden": "true",
182
+ class: "shrink-0 invisible",
183
+ size: 16
184
+ }))]),
161
185
  "node-label": _(({ node: e }) => [
162
- t.$slots["file-icon"] && J(e) ? (d(), o("span", S, [p(t.$slots, "file-icon", {
163
- sourceId: J(e).sourceId,
164
- path: J(e).path
165
- }, void 0, !0)])) : a("", !0),
166
- s("span", {
167
- class: u(["library-browser__label", {
186
+ t.$slots["file-icon"] && Z(e) ? (f(), c("span", S, [m(t.$slots, "file-icon", {
187
+ sourceId: Z(e).sourceId,
188
+ path: Z(e).path
189
+ }, void 0, !0)])) : s("", !0),
190
+ l("span", {
191
+ class: d(["library-browser__label", {
168
192
  offline: R.value.offline.has(e.id),
169
193
  "library-browser__label--root": B(e.id),
170
- "library-browser__label--active": q(e)
194
+ "library-browser__label--active": X(e)
171
195
  }]),
172
- "aria-current": q(e) ? "true" : void 0,
196
+ "aria-current": X(e) ? "true" : void 0,
173
197
  "data-testid": "library-browser-node-label",
174
198
  title: e.name
175
- }, [s("span", w, m(z(e.name).head), 1), s("span", T, m(z(e.name).tail), 1)], 10, C),
176
- t.$slots["file-status"] && J(e) ? (d(), o("span", E, [p(t.$slots, "file-status", {
177
- sourceId: J(e).sourceId,
178
- path: J(e).path
179
- }, void 0, !0)])) : a("", !0),
180
- R.value.emptyHints.has(e.id) ? (d(), o("span", D, " No matching files ")) : a("", !0),
181
- R.value.offline.has(e.id) ? (d(), o("span", O, " Offline ")) : a("", !0)
199
+ }, [l("span", w, h(z(e.name).head), 1), l("span", T, h(z(e.name).tail), 1)], 10, C),
200
+ t.$slots["file-status"] && Z(e) ? (f(), c("span", E, [m(t.$slots, "file-status", {
201
+ sourceId: Z(e).sourceId,
202
+ path: Z(e).path
203
+ }, void 0, !0)])) : s("", !0),
204
+ R.value.emptyHints.has(e.id) ? (f(), c("span", D, " No matching files ")) : s("", !0),
205
+ R.value.offline.has(e.id) ? (f(), c("span", O, " Offline ")) : s("", !0)
182
206
  ]),
183
207
  _: 2
184
208
  }, [t.$slots["source-actions"] ? {
185
209
  name: "node-suffix",
186
- fn: _(({ node: e }) => [B(e.id) && Y(e.id) !== void 0 ? (d(), o("span", x, [p(t.$slots, "source-actions", {
210
+ fn: _(({ node: e }) => [B(e.id) && Q(e.id) !== void 0 ? (f(), c("span", ne, [m(t.$slots, "source-actions", {
187
211
  sourceId: e.id,
188
- folder: Y(e.id)
189
- }, void 0, !0)])) : a("", !0)]),
212
+ folder: Q(e.id)
213
+ }, void 0, !0)])) : s("", !0)]),
190
214
  key: "0"
191
- } : void 0]), 1032, ["items", "expanded"])) : a("", !0)])]));
215
+ } : void 0]), 1032, ["items", "expanded"])) : s("", !0)])]));
192
216
  }
193
217
  });
194
218
  //#endregion
@@ -1,4 +1,4 @@
1
- //#region lib/explorer/collect-expandable-node-ids.ts
1
+ //#region lib/tree/collect-expandable-node-ids.ts
2
2
  function e(t) {
3
3
  let n = [];
4
4
  for (let r of t) r.children?.length && n.push(r.id, ...e(r.children));
@@ -0,0 +1,3 @@
1
+ import { collectExpandableNodeIds as e } from "./collect-expandable-node-ids.js";
2
+ import t from "./tree.js";
3
+ export { t as SclTree, e as collectExpandableNodeIds };
@@ -0,0 +1,7 @@
1
+ import e from "./tree.vue_vue_type_script_setup_true_lang.js";
2
+ /* empty css */
3
+ import t from "../_virtual/_plugin-vue_export-helper.js";
4
+ //#region lib/tree/tree.vue
5
+ var n = /*#__PURE__*/ t(e, [["__scopeId", "data-v-1a76ef46"]]);
6
+ //#endregion
7
+ export { n as default };
@@ -0,0 +1,105 @@
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, createVNode as d, defineComponent as f, mergeProps as p, normalizeClass as m, normalizeStyle as h, openBlock as g, renderList as _, renderSlot as v, toDisplayString as y, unref as b, withCtx as x, withModifiers as S } from "vue";
8
+ //#region lib/tree/tree.vue?vue&type=script&setup=true&lang.ts
9
+ var C = ["onClick", "onContextmenu"], w = { class: "flex flex-1 items-center min-w-0" }, T = { class: "pl-2 truncate" }, E = { class: "shrink-0 ml-auto pl-2" }, D = /*@__PURE__*/ f({
10
+ __name: "tree",
11
+ props: {
12
+ items: {},
13
+ expanded: { default: () => ({
14
+ scoped: [],
15
+ all: !1
16
+ }) },
17
+ ariaLabel: { default: "SCL Tree" },
18
+ selected: {},
19
+ rowLabel: {}
20
+ },
21
+ emits: [
22
+ "select",
23
+ "contextmenu",
24
+ "row-click",
25
+ "update:expanded"
26
+ ],
27
+ setup(f, { emit: D }) {
28
+ let O = f, k = D, A = o(() => i(O.items)), j = o(() => O.expanded.all ? A.value : O.expanded.scoped), M = o(() => O.selected === void 0 ? void 0 : N(O.items, O.selected));
29
+ function N(e, t) {
30
+ for (let n of e) {
31
+ if (n.id === t) return n;
32
+ let e = n.children ? N(n.children, t) : void 0;
33
+ if (e) return e;
34
+ }
35
+ }
36
+ return (i, o) => (g(), s(b(e), {
37
+ class: "explorer-tree list-none select-none w-full text-stone-700 text-sm font-medium",
38
+ items: O.items,
39
+ "get-key": (e) => e.id,
40
+ expanded: j.value,
41
+ "model-value": M.value,
42
+ "aria-label": O.ariaLabel,
43
+ "onUpdate:expanded": o[1] ||= (e) => k("update:expanded", {
44
+ scoped: e,
45
+ all: !1
46
+ })
47
+ }, {
48
+ default: x(({ flattenItems: e }) => [(g(!0), l(a, null, _(e, (e) => (g(), s(b(t), p({ key: e.value.id }, { ref_for: !0 }, e.bind, {
49
+ "aria-label": O.rowLabel?.(e.value),
50
+ class: ["explorer-tree__item px-2 py-1 my-0.5 rounded outline-none", e.value.selectable === !1 ? "" : "explorer-tree__item--selectable"],
51
+ onSelect: (t) => {
52
+ t.detail.originalEvent.type === "click" || e.value.selectable === !1 ? t.preventDefault() : k("select", e.value);
53
+ },
54
+ onToggle: o[0] ||= (e) => {
55
+ e.detail.originalEvent.type === "click" && e.preventDefault();
56
+ }
57
+ }), {
58
+ default: x(({ handleSelect: t, isExpanded: a }) => [u("div", {
59
+ class: m(["flex items-center", e.value.selectable === !1 ? "cursor-default" : "cursor-pointer"]),
60
+ style: h({ "padding-left": e.level === 1 ? "0rem" : `${e.level - 1.5}rem` }),
61
+ onClick: () => {
62
+ e.value.selectable !== !1 && (t(), k("select", e.value)), k("row-click", e.value);
63
+ },
64
+ onContextmenu: S((t) => k("contextmenu", {
65
+ node: e.value,
66
+ event: t
67
+ }), ["prevent"])
68
+ }, [
69
+ v(i.$slots, "node-toggle", {
70
+ node: e.value,
71
+ hasChildren: e.hasChildren,
72
+ expanded: a
73
+ }, () => [d(b(n), {
74
+ "aria-hidden": "true",
75
+ class: "shrink-0 invisible",
76
+ size: 16
77
+ })], !0),
78
+ u("div", w, [
79
+ v(i.$slots, "node-prefix", { node: e.value }, void 0, !0),
80
+ e.value.tag ? (g(), s(b(r), {
81
+ key: 0,
82
+ "tag-name": e.value.tag
83
+ }, null, 8, ["tag-name"])) : c("", !0),
84
+ v(i.$slots, "node-label", { node: e.value }, () => [u("span", T, y(e.value.name), 1)], !0)
85
+ ]),
86
+ u("div", E, [v(i.$slots, "node-suffix", { node: e.value }, void 0, !0)])
87
+ ], 46, C)]),
88
+ _: 2
89
+ }, 1040, [
90
+ "aria-label",
91
+ "class",
92
+ "onSelect"
93
+ ]))), 128))]),
94
+ _: 3
95
+ }, 8, [
96
+ "items",
97
+ "get-key",
98
+ "expanded",
99
+ "model-value",
100
+ "aria-label"
101
+ ]));
102
+ }
103
+ });
104
+ //#endregion
105
+ export { D as default };