@floegence/floe-webapp-core 0.4.0 → 0.6.0

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 (87) hide show
  1. package/dist/components/ui/Dialog.d.ts +3 -0
  2. package/dist/components/ui/DirectoryPicker.d.ts +31 -0
  3. package/dist/components/ui/index.d.ts +1 -0
  4. package/dist/index.js +193 -191
  5. package/dist/index10.js +2 -2
  6. package/dist/index11.js +4 -4
  7. package/dist/index12.js +5 -5
  8. package/dist/index13.js +3 -3
  9. package/dist/index14.js +4 -4
  10. package/dist/index15.js +5 -5
  11. package/dist/index16.js +5 -5
  12. package/dist/index17.js +4 -4
  13. package/dist/index18.js +6 -6
  14. package/dist/index19.js +2 -2
  15. package/dist/index2.js +6 -6
  16. package/dist/index20.js +2 -2
  17. package/dist/index21.js +1 -1
  18. package/dist/index22.js +8 -5
  19. package/dist/index23.js +3 -3
  20. package/dist/index24.js +3 -3
  21. package/dist/index25.js +1 -1
  22. package/dist/index26.js +5 -5
  23. package/dist/index27.js +1 -1
  24. package/dist/index28.js +3 -3
  25. package/dist/index29.js +362 -81
  26. package/dist/index3.js +2 -2
  27. package/dist/index30.js +87 -37
  28. package/dist/index31.js +37 -66
  29. package/dist/index32.js +69 -278
  30. package/dist/index33.js +278 -152
  31. package/dist/index34.js +147 -24
  32. package/dist/index35.js +26 -45
  33. package/dist/index36.js +45 -10
  34. package/dist/index37.js +10 -27
  35. package/dist/index38.js +27 -159
  36. package/dist/index39.js +156 -228
  37. package/dist/index4.js +1 -1
  38. package/dist/index40.js +228 -125
  39. package/dist/index41.js +110 -176
  40. package/dist/index42.js +149 -122
  41. package/dist/index43.js +161 -183
  42. package/dist/index44.js +185 -145
  43. package/dist/index45.js +143 -114
  44. package/dist/index46.js +119 -47
  45. package/dist/index47.js +50 -48
  46. package/dist/index48.js +40 -30
  47. package/dist/index49.js +33 -44
  48. package/dist/index5.js +4 -4
  49. package/dist/index50.js +49 -25
  50. package/dist/index51.js +21 -169
  51. package/dist/index52.js +169 -36
  52. package/dist/index53.js +38 -64
  53. package/dist/index54.js +63 -93
  54. package/dist/index55.js +86 -111
  55. package/dist/index56.js +114 -131
  56. package/dist/index57.js +131 -32
  57. package/dist/index58.js +29 -425
  58. package/dist/index59.js +433 -36
  59. package/dist/index6.js +2 -2
  60. package/dist/index60.js +31 -12
  61. package/dist/index61.js +19 -13
  62. package/dist/index62.js +13 -10
  63. package/dist/index63.js +10 -16
  64. package/dist/index64.js +16 -10
  65. package/dist/index65.js +10 -8
  66. package/dist/index66.js +8 -61
  67. package/dist/index67.js +61 -5
  68. package/dist/index68.js +5 -11
  69. package/dist/index69.js +10 -25
  70. package/dist/index7.js +2 -2
  71. package/dist/index70.js +24 -30
  72. package/dist/index71.js +31 -90
  73. package/dist/index72.js +90 -26
  74. package/dist/index73.js +24 -43
  75. package/dist/index74.js +45 -13
  76. package/dist/index75.js +14 -35
  77. package/dist/index76.js +33 -62
  78. package/dist/index77.js +61 -81
  79. package/dist/index78.js +84 -14
  80. package/dist/index79.js +12 -2261
  81. package/dist/index8.js +2 -2
  82. package/dist/index80.js +2262 -6
  83. package/dist/index81.js +7 -39
  84. package/dist/index82.js +42 -0
  85. package/dist/index9.js +1 -1
  86. package/dist/styles.css +1 -1
  87. package/package.json +1 -1
package/dist/index44.js CHANGED
@@ -1,154 +1,194 @@
1
- import { delegateEvents as H, template as v, insert as E, createComponent as a, memo as P, effect as b, className as x, use as y } from "solid-js/web";
2
- import { createSignal as B, onMount as L, createMemo as k, For as O, Show as M, onCleanup as F } from "solid-js";
3
- import { cn as W } from "./index67.js";
4
- import { useFileBrowser as G } from "./index39.js";
5
- import { ChevronRight as T } from "./index32.js";
6
- import { Dropdown as z } from "./index24.js";
7
- var X = /* @__PURE__ */ v("<nav aria-label=Breadcrumb>"), j = /* @__PURE__ */ v('<button type=button title="Show hidden path segments">…'), q = /* @__PURE__ */ v('<button type=button><span class="truncate max-w-[120px] block">');
8
- const g = 16, J = 28, R = 12, K = 7, Q = 120, U = 100;
9
- function V(n) {
10
- const r = n.length * K;
11
- return Math.min(r + R, Q + R);
12
- }
13
- function ce(n) {
14
- const r = G();
15
- let s;
16
- const [t, c] = B(0);
17
- L(() => {
18
- if (!s) return;
19
- const e = () => {
20
- s && c(s.offsetWidth);
1
+ import { delegateEvents as D, createComponent as u, Portal as E, template as l, insert as w, Dynamic as L, effect as c, className as $, setStyleProperty as I, setAttribute as p, use as j } from "solid-js/web";
2
+ import { createEffect as H, onCleanup as P, Show as g, For as F } from "solid-js";
3
+ import { cn as _ } from "./index68.js";
4
+ import { deferAfterPaint as R } from "./index69.js";
5
+ import { useFileBrowser as T } from "./index40.js";
6
+ var V = /* @__PURE__ */ l('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><rect width=14 height=14 x=8 y=8 rx=2 ry=2></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2">'), S = /* @__PURE__ */ l('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3Z">'), Z = /* @__PURE__ */ l('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"></path><path d="M8 10v4"></path><path d="M12 10v2"></path><path d="M16 10v6">'), z = /* @__PURE__ */ l('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M12 3v18"></path><path d="m8 7-4 4 4 4"></path><path d="m16 7 4 4-4 4">'), W = /* @__PURE__ */ l('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2">'), K = /* @__PURE__ */ l('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"></path><path d="m15 5 4 4">'), N = /* @__PURE__ */ l("<div role=menu aria-orientation=vertical>"), O = /* @__PURE__ */ l('<span class="text-[10px] text-muted-foreground opacity-60">'), q = /* @__PURE__ */ l('<button type=button role=menuitem><span class="flex-1 text-left">'), G = /* @__PURE__ */ l('<div class="my-1 h-px bg-border">');
7
+ const J = (r) => (() => {
8
+ var o = V();
9
+ return c(() => p(o, "class", r.class)), o;
10
+ })(), Q = (r) => (() => {
11
+ var o = S();
12
+ return c(() => p(o, "class", r.class)), o;
13
+ })(), U = (r) => (() => {
14
+ var o = Z();
15
+ return c(() => p(o, "class", r.class)), o;
16
+ })(), X = (r) => (() => {
17
+ var o = z();
18
+ return c(() => p(o, "class", r.class)), o;
19
+ })(), Y = (r) => (() => {
20
+ var o = W();
21
+ return c(() => p(o, "class", r.class)), o;
22
+ })(), ee = (r) => (() => {
23
+ var o = K();
24
+ return c(() => p(o, "class", r.class)), o;
25
+ })();
26
+ function se(r) {
27
+ const o = T();
28
+ let h;
29
+ const b = [{
30
+ id: "duplicate",
31
+ label: "Duplicate",
32
+ type: "duplicate",
33
+ icon: J,
34
+ shortcut: "Cmd+D"
35
+ }, {
36
+ id: "ask-agent",
37
+ label: "Ask Agent",
38
+ type: "ask-agent",
39
+ icon: Q,
40
+ separator: !0
41
+ }, {
42
+ id: "copy-to",
43
+ label: "Copy to...",
44
+ type: "copy-to",
45
+ icon: U
46
+ }, {
47
+ id: "move-to",
48
+ label: "Move to...",
49
+ type: "move-to",
50
+ icon: X,
51
+ separator: !0
52
+ }, {
53
+ id: "rename",
54
+ label: "Rename",
55
+ type: "rename",
56
+ icon: ee,
57
+ shortcut: "Enter"
58
+ }, {
59
+ id: "delete",
60
+ label: "Delete",
61
+ type: "delete",
62
+ icon: Y,
63
+ shortcut: "Del"
64
+ }], A = () => {
65
+ var t;
66
+ if (r.overrideItems)
67
+ return r.overrideItems;
68
+ const a = () => {
69
+ var s;
70
+ const e = r.hideItems;
71
+ if (!e) return [];
72
+ if (typeof e == "function") {
73
+ const i = ((s = o.contextMenu()) == null ? void 0 : s.items) ?? [];
74
+ return e(i);
75
+ }
76
+ return e;
21
77
  };
22
- e();
23
- const o = new ResizeObserver(e);
24
- o.observe(s), F(() => o.disconnect());
78
+ let n = b;
79
+ const d = a();
80
+ return d.length > 0 && (n = n.filter((e) => !d.includes(e.type))), (t = r.customItems) != null && t.length && (n = [...n, ...r.customItems]), n;
81
+ }, B = (a, n) => {
82
+ o.hideContextMenu();
83
+ const d = a.type, t = [...n], e = r.callbacks, s = a.onAction;
84
+ R(() => {
85
+ var i, v, m, k, M, C;
86
+ switch (d) {
87
+ case "duplicate":
88
+ (i = e == null ? void 0 : e.onDuplicate) == null || i.call(e, t);
89
+ break;
90
+ case "ask-agent":
91
+ (v = e == null ? void 0 : e.onAskAgent) == null || v.call(e, t);
92
+ break;
93
+ case "copy-to":
94
+ (m = e == null ? void 0 : e.onCopyTo) == null || m.call(e, t);
95
+ break;
96
+ case "move-to":
97
+ (k = e == null ? void 0 : e.onMoveTo) == null || k.call(e, t);
98
+ break;
99
+ case "delete":
100
+ (M = e == null ? void 0 : e.onDelete) == null || M.call(e, t);
101
+ break;
102
+ case "rename":
103
+ t.length === 1 && ((C = e == null ? void 0 : e.onRename) == null || C.call(e, t[0]));
104
+ break;
105
+ case "custom":
106
+ s == null || s(t);
107
+ break;
108
+ }
109
+ });
110
+ }, f = (a) => {
111
+ h && !h.contains(a.target) && o.hideContextMenu();
112
+ }, x = (a) => {
113
+ a.key === "Escape" && o.hideContextMenu();
114
+ };
115
+ H(() => {
116
+ o.contextMenu() && (document.addEventListener("click", f), document.addEventListener("keydown", x), P(() => {
117
+ document.removeEventListener("click", f), document.removeEventListener("keydown", x);
118
+ }));
25
119
  });
26
- const d = k(() => {
27
- const e = r.currentPath();
28
- if (e === "/" || e === "")
29
- return [{
30
- name: "Root",
31
- path: "/"
32
- }];
33
- const o = e.split("/").filter(Boolean), i = [{
34
- name: "Root",
35
- path: "/"
36
- }];
37
- let l = "";
38
- for (const f of o)
39
- l += "/" + f, i.push({
40
- name: f,
41
- path: l
42
- });
43
- return i;
44
- }), m = k(() => {
45
- const e = d(), o = t();
46
- if (o < U || e.length <= 2)
47
- return {
48
- collapsed: [],
49
- visible: e,
50
- shouldCollapse: !1
51
- };
52
- const i = e.map((u) => V(u.name)), l = i[0], f = i[e.length - 1], D = g, $ = e.length > 1 ? g : 0, S = l + f + D + $;
53
- if (S > o && e.length > 2)
54
- return {
55
- collapsed: e.slice(1, -1),
56
- visible: [e[0], e[e.length - 1]],
57
- shouldCollapse: !0
58
- };
59
- const h = e.slice(1, -1), p = [];
60
- let _ = o - S;
61
- const N = h.length > 0 ? J + g : 0;
62
- for (let u = h.length - 1; u >= 0; u--) {
63
- const I = i[u + 1] + g, A = u > 0 ? N : 0;
64
- if (_ - A >= I)
65
- p.unshift(h[u]), _ -= I;
66
- else
67
- break;
68
- }
69
- const w = h.slice(0, h.length - p.length);
70
- return {
71
- collapsed: w,
72
- visible: [e[0], ...p, e[e.length - 1]],
73
- shouldCollapse: w.length > 0
120
+ const y = () => {
121
+ const a = o.contextMenu();
122
+ if (!a || !h) return {
123
+ x: 0,
124
+ y: 0
125
+ };
126
+ const n = h.getBoundingClientRect(), d = window.innerWidth, t = window.innerHeight;
127
+ let e = a.x, s = a.y;
128
+ return e + n.width > d && (e = d - n.width - 8), s + n.height > t && (s = t - n.height - 8), {
129
+ x: Math.max(8, e),
130
+ y: Math.max(8, s)
74
131
  };
75
- }), C = (e) => {
76
- r.setCurrentPath(e.path);
77
132
  };
78
- return (() => {
79
- var e = X(), o = s;
80
- return typeof o == "function" ? y(o, e) : s = e, E(e, a(O, {
81
- get each() {
82
- return m().visible;
83
- },
84
- children: (i, l) => [a(M, {
85
- get when() {
86
- return l() > 0;
87
- },
88
- get children() {
89
- return a(T, {
90
- class: "w-3 h-3 text-muted-foreground/50 flex-shrink-0"
91
- });
92
- }
93
- }), a(M, {
94
- get when() {
95
- return P(() => !!m().shouldCollapse)() && l() === 1;
96
- },
97
- get children() {
98
- return [a(Y, {
99
- get segments() {
100
- return m().collapsed;
101
- },
102
- onSelect: C
103
- }), a(T, {
104
- class: "w-3 h-3 text-muted-foreground/50 flex-shrink-0"
105
- })];
106
- }
107
- }), a(Z, {
108
- segment: i,
109
- get isLast() {
110
- return l() === m().visible.length - 1;
111
- },
112
- onClick: () => C(i)
113
- })]
114
- })), b(() => x(e, W("flex items-center gap-1 min-w-0 overflow-hidden", n.class))), e;
115
- })();
116
- }
117
- function Y(n) {
118
- const r = () => n.segments.map((t) => ({
119
- id: t.path,
120
- label: t.name
121
- }));
122
- return a(z, {
123
- get trigger() {
124
- return (() => {
125
- var t = j();
126
- return b(() => x(t, W("text-xs px-1.5 py-0.5 rounded cursor-pointer flex-shrink-0", "transition-all duration-100", "text-muted-foreground hover:text-foreground hover:bg-muted/50", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"))), t;
127
- })();
133
+ return u(g, {
134
+ get when() {
135
+ return o.contextMenu();
128
136
  },
129
- get items() {
130
- return r();
131
- },
132
- onSelect: (t) => {
133
- const c = n.segments.find((d) => d.path === t);
134
- c && n.onSelect(c);
135
- },
136
- align: "start"
137
+ children: (a) => u(E, {
138
+ get children() {
139
+ var n = N(), d = h;
140
+ return typeof d == "function" ? j(d, n) : h = n, w(n, u(F, {
141
+ get each() {
142
+ return A();
143
+ },
144
+ children: (t) => [(() => {
145
+ var e = q(), s = e.firstChild;
146
+ return e.$$click = () => B(t, a().items), w(e, u(g, {
147
+ get when() {
148
+ return t.icon;
149
+ },
150
+ children: (i) => u(L, {
151
+ get component() {
152
+ return i();
153
+ },
154
+ class: "w-3.5 h-3.5 opacity-60"
155
+ })
156
+ }), s), w(s, () => t.label), w(e, u(g, {
157
+ get when() {
158
+ return t.shortcut;
159
+ },
160
+ get children() {
161
+ var i = O();
162
+ return w(i, () => t.shortcut), i;
163
+ }
164
+ }), null), c((i) => {
165
+ var v = t.disabled || t.type === "rename" && a().items.length > 1, m = _("w-full flex items-center gap-2 px-3 py-1.5 text-xs cursor-pointer", "transition-colors duration-75", "hover:bg-accent hover:text-accent-foreground", "focus:outline-none focus-visible:bg-accent focus-visible:text-accent-foreground", "disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent", t.type === "delete" && "text-error hover:bg-error/10 hover:text-error");
166
+ return v !== i.e && (e.disabled = i.e = v), m !== i.t && $(e, i.t = m), i;
167
+ }, {
168
+ e: void 0,
169
+ t: void 0
170
+ }), e;
171
+ })(), u(g, {
172
+ get when() {
173
+ return t.separator;
174
+ },
175
+ get children() {
176
+ return G();
177
+ }
178
+ })]
179
+ })), c((t) => {
180
+ var e = _("fixed z-50 min-w-[180px] py-1", "bg-popover border border-border rounded-lg shadow-lg", "animate-in fade-in zoom-in-95 duration-100"), s = `${y().x}px`, i = `${y().y}px`;
181
+ return e !== t.e && $(n, t.e = e), s !== t.t && I(n, "left", t.t = s), i !== t.a && I(n, "top", t.a = i), t;
182
+ }, {
183
+ e: void 0,
184
+ t: void 0,
185
+ a: void 0
186
+ }), n;
187
+ }
188
+ })
137
189
  });
138
190
  }
139
- function Z(n) {
140
- return (() => {
141
- var r = q(), s = r.firstChild;
142
- return r.$$click = () => n.onClick(), E(s, () => n.segment.name), b((t) => {
143
- var c = n.isLast, d = W("text-xs px-1.5 py-0.5 rounded cursor-pointer flex-shrink-0", "transition-all duration-100", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring", n.isLast ? "font-medium text-foreground cursor-default" : "text-muted-foreground hover:text-foreground hover:bg-muted/50");
144
- return c !== t.e && (r.disabled = t.e = c), d !== t.t && x(r, t.t = d), t;
145
- }, {
146
- e: void 0,
147
- t: void 0
148
- }), r;
149
- })();
150
- }
151
- H(["click"]);
191
+ D(["click"]);
152
192
  export {
153
- ce as Breadcrumb
193
+ se as FileContextMenu
154
194
  };
package/dist/index45.js CHANGED
@@ -1,125 +1,154 @@
1
- import { delegateEvents as S, template as u, addEventListener as M, insert as o, createComponent as l, use as Q, effect as s, className as d, setAttribute as g } from "solid-js/web";
2
- import { onMount as T, Show as A } from "solid-js";
3
- import { cn as v } from "./index67.js";
4
- import { useFileBrowser as E } from "./index39.js";
5
- import { Breadcrumb as L } from "./index44.js";
6
- import { Grid as V } from "./index32.js";
7
- var N = /* @__PURE__ */ u('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><line x1=8 y1=6 x2=21 y2=6></line><line x1=8 y1=12 x2=21 y2=12></line><line x1=8 y1=18 x2=21 y2=18></line><line x1=3 y1=6 x2=3.01 y2=6></line><line x1=3 y1=12 x2=3.01 y2=12></line><line x1=3 y1=18 x2=3.01 y2=18>'), U = /* @__PURE__ */ u('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"></path><path d="M12 10v6"></path><path d="m9 13 3-3 3 3">'), G = /* @__PURE__ */ u('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><rect width=18 height=18 x=3 y=3 rx=2 ry=2></rect><line x1=9 y1=3 x2=9 y2=21>'), D = /* @__PURE__ */ u('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><circle cx=11 cy=11 r=8></circle><path d="m21 21-4.3-4.3">'), H = /* @__PURE__ */ u('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M18 6 6 18"></path><path d="m6 6 12 12">'), K = /* @__PURE__ */ u('<button type=button aria-label="Clear filter">'), P = /* @__PURE__ */ u('<div class="flex items-center flex-1 gap-1 px-2 py-1 bg-muted/50 rounded-md border border-border/50 focus-within:border-ring focus-within:ring-1 focus-within:ring-ring"><input type=text placeholder=Filter... aria-label="Filter files by name">'), R = /* @__PURE__ */ u('<div><button type=button aria-label="Toggle sidebar"></button><button type=button aria-label="Navigate to parent folder"></button><div></div><div></div><div class="flex items-center gap-0.5 p-0.5 bg-muted/50 rounded-md">'), X = /* @__PURE__ */ u('<button type=button aria-label="Filter files">'), Z = /* @__PURE__ */ u("<button type=button>");
8
- const q = (r) => (() => {
9
- var e = N();
10
- return s(() => g(e, "class", r.class)), e;
11
- })(), z = (r) => (() => {
12
- var e = U();
13
- return s(() => g(e, "class", r.class)), e;
14
- })(), J = (r) => (() => {
15
- var e = G();
16
- return s(() => g(e, "class", r.class)), e;
17
- })(), j = (r) => (() => {
18
- var e = D();
19
- return s(() => g(e, "class", r.class)), e;
20
- })(), O = (r) => (() => {
21
- var e = H();
22
- return s(() => g(e, "class", r.class)), e;
23
- })();
24
- function ie(r) {
25
- const e = E();
26
- let n;
27
- const c = () => {
28
- const f = e.currentPath();
29
- return f !== "/" && f !== "";
30
- }, m = () => {
31
- e.isFilterActive() ? (e.setFilterQuery(""), e.setFilterActive(!1)) : (e.setFilterActive(!0), setTimeout(() => n == null ? void 0 : n.focus(), 50));
32
- }, w = () => {
33
- e.setFilterQuery(""), n == null || n.focus();
34
- }, h = (f) => {
35
- f.key === "Escape" && (e.setFilterQuery(""), e.setFilterActive(!1));
36
- }, I = () => {
37
- e.filterQuery().trim() || e.setFilterActive(!1);
1
+ import { delegateEvents as H, template as v, insert as E, createComponent as a, memo as P, effect as b, className as x, use as y } from "solid-js/web";
2
+ import { createSignal as B, onMount as L, createMemo as k, For as O, Show as M, onCleanup as F } from "solid-js";
3
+ import { cn as W } from "./index68.js";
4
+ import { useFileBrowser as G } from "./index40.js";
5
+ import { ChevronRight as T } from "./index33.js";
6
+ import { Dropdown as z } from "./index24.js";
7
+ var X = /* @__PURE__ */ v("<nav aria-label=Breadcrumb>"), j = /* @__PURE__ */ v('<button type=button title="Show hidden path segments">…'), q = /* @__PURE__ */ v('<button type=button><span class="truncate max-w-[120px] block">');
8
+ const g = 16, J = 28, R = 12, K = 7, Q = 120, U = 100;
9
+ function V(n) {
10
+ const r = n.length * K;
11
+ return Math.min(r + R, Q + R);
12
+ }
13
+ function ce(n) {
14
+ const r = G();
15
+ let s;
16
+ const [t, c] = B(0);
17
+ L(() => {
18
+ if (!s) return;
19
+ const e = () => {
20
+ s && c(s.offsetWidth);
21
+ };
22
+ e();
23
+ const o = new ResizeObserver(e);
24
+ o.observe(s), F(() => o.disconnect());
25
+ });
26
+ const d = k(() => {
27
+ const e = r.currentPath();
28
+ if (e === "/" || e === "")
29
+ return [{
30
+ name: "Root",
31
+ path: "/"
32
+ }];
33
+ const o = e.split("/").filter(Boolean), i = [{
34
+ name: "Root",
35
+ path: "/"
36
+ }];
37
+ let l = "";
38
+ for (const f of o)
39
+ l += "/" + f, i.push({
40
+ name: f,
41
+ path: l
42
+ });
43
+ return i;
44
+ }), m = k(() => {
45
+ const e = d(), o = t();
46
+ if (o < U || e.length <= 2)
47
+ return {
48
+ collapsed: [],
49
+ visible: e,
50
+ shouldCollapse: !1
51
+ };
52
+ const i = e.map((u) => V(u.name)), l = i[0], f = i[e.length - 1], D = g, $ = e.length > 1 ? g : 0, S = l + f + D + $;
53
+ if (S > o && e.length > 2)
54
+ return {
55
+ collapsed: e.slice(1, -1),
56
+ visible: [e[0], e[e.length - 1]],
57
+ shouldCollapse: !0
58
+ };
59
+ const h = e.slice(1, -1), p = [];
60
+ let _ = o - S;
61
+ const N = h.length > 0 ? J + g : 0;
62
+ for (let u = h.length - 1; u >= 0; u--) {
63
+ const I = i[u + 1] + g, A = u > 0 ? N : 0;
64
+ if (_ - A >= I)
65
+ p.unshift(h[u]), _ -= I;
66
+ else
67
+ break;
68
+ }
69
+ const w = h.slice(0, h.length - p.length);
70
+ return {
71
+ collapsed: w,
72
+ visible: [e[0], ...p, e[e.length - 1]],
73
+ shouldCollapse: w.length > 0
74
+ };
75
+ }), C = (e) => {
76
+ r.setCurrentPath(e.path);
38
77
  };
39
- return T(() => {
40
- r.filterInputRef && n && r.filterInputRef(n);
41
- }), (() => {
42
- var f = R(), x = f.firstChild, b = x.nextSibling, p = b.nextSibling, y = p.nextSibling, k = y.nextSibling;
43
- return M(x, "click", e.toggleSidebar, !0), o(x, l(J, {
44
- class: "w-4 h-4"
45
- })), M(b, "click", e.navigateUp, !0), o(b, l(z, {
46
- class: "w-4 h-4"
47
- })), o(p, l(L, {})), o(y, l(A, {
48
- get when() {
49
- return e.isFilterActive();
50
- },
51
- get fallback() {
52
- return (() => {
53
- var t = X();
54
- return t.$$click = m, o(t, l(j, {
55
- class: "w-4 h-4"
56
- })), s(() => d(t, v("flex items-center justify-center w-7 h-7 rounded cursor-pointer", "transition-colors duration-100", "hover:bg-muted/70", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"))), t;
57
- })();
58
- },
59
- get children() {
60
- var t = P(), a = t.firstChild;
61
- return o(t, l(j, {
62
- class: "w-3.5 h-3.5 text-muted-foreground flex-shrink-0"
63
- }), a), a.addEventListener("blur", I), a.$$keydown = h, a.$$input = (i) => e.setFilterQuery(i.currentTarget.value), Q((i) => {
64
- n = i, r.filterInputRef && r.filterInputRef(i);
65
- }, a), o(t, l(A, {
66
- get when() {
67
- return e.filterQuery();
68
- },
69
- get children() {
70
- var i = K();
71
- return i.$$click = w, o(i, l(O, {
72
- class: "w-3 h-3"
73
- })), s(() => d(i, v("flex items-center justify-center w-4 h-4 rounded-sm cursor-pointer", "text-muted-foreground hover:text-foreground", "transition-colors duration-100"))), i;
74
- }
75
- }), null), s(() => d(a, v("flex-1 min-w-0 bg-transparent text-xs", "outline-none border-0 ring-0 shadow-none appearance-none", "focus:outline-none focus:border-0 focus:ring-0", "placeholder:text-muted-foreground/60"))), s(() => a.value = e.filterQuery()), t;
76
- }
77
- })), o(k, l(B, {
78
- mode: "list",
79
- get currentMode() {
80
- return e.viewMode();
81
- },
82
- onClick: () => e.setViewMode("list"),
83
- icon: q,
84
- label: "List view"
85
- }), null), o(k, l(B, {
86
- mode: "grid",
87
- get currentMode() {
88
- return e.viewMode();
78
+ return (() => {
79
+ var e = X(), o = s;
80
+ return typeof o == "function" ? y(o, e) : s = e, E(e, a(O, {
81
+ get each() {
82
+ return m().visible;
89
83
  },
90
- onClick: () => e.setViewMode("grid"),
91
- icon: V,
92
- label: "Grid view"
93
- }), null), s((t) => {
94
- var a = v("flex items-center gap-2 px-2 py-1.5 border-b border-border", "bg-background/50 backdrop-blur-sm", r.class), i = v("md:hidden flex items-center justify-center w-7 h-7 rounded cursor-pointer", "transition-colors duration-100", "hover:bg-muted/70", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring", !e.sidebarCollapsed() && "bg-muted/50"), $ = !c(), F = v("flex items-center justify-center w-7 h-7 rounded cursor-pointer", "transition-colors duration-100", "hover:bg-muted/70", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring", "disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent"), _ = v("flex-1 min-w-0 overflow-hidden transition-all duration-200", e.isFilterActive() && "hidden sm:block sm:flex-1"), C = v("flex items-center gap-1 transition-all duration-200 ease-out", e.isFilterActive() ? "flex-1 sm:flex-none sm:w-48" : "w-7");
95
- return a !== t.e && d(f, t.e = a), i !== t.t && d(x, t.t = i), $ !== t.a && (b.disabled = t.a = $), F !== t.o && d(b, t.o = F), _ !== t.i && d(p, t.i = _), C !== t.n && d(y, t.n = C), t;
96
- }, {
97
- e: void 0,
98
- t: void 0,
99
- a: void 0,
100
- o: void 0,
101
- i: void 0,
102
- n: void 0
103
- }), f;
84
+ children: (i, l) => [a(M, {
85
+ get when() {
86
+ return l() > 0;
87
+ },
88
+ get children() {
89
+ return a(T, {
90
+ class: "w-3 h-3 text-muted-foreground/50 flex-shrink-0"
91
+ });
92
+ }
93
+ }), a(M, {
94
+ get when() {
95
+ return P(() => !!m().shouldCollapse)() && l() === 1;
96
+ },
97
+ get children() {
98
+ return [a(Y, {
99
+ get segments() {
100
+ return m().collapsed;
101
+ },
102
+ onSelect: C
103
+ }), a(T, {
104
+ class: "w-3 h-3 text-muted-foreground/50 flex-shrink-0"
105
+ })];
106
+ }
107
+ }), a(Z, {
108
+ segment: i,
109
+ get isLast() {
110
+ return l() === m().visible.length - 1;
111
+ },
112
+ onClick: () => C(i)
113
+ })]
114
+ })), b(() => x(e, W("flex items-center gap-1 min-w-0 overflow-hidden", n.class))), e;
104
115
  })();
105
116
  }
106
- function B(r) {
107
- const e = () => r.currentMode === r.mode;
117
+ function Y(n) {
118
+ const r = () => n.segments.map((t) => ({
119
+ id: t.path,
120
+ label: t.name
121
+ }));
122
+ return a(z, {
123
+ get trigger() {
124
+ return (() => {
125
+ var t = j();
126
+ return b(() => x(t, W("text-xs px-1.5 py-0.5 rounded cursor-pointer flex-shrink-0", "transition-all duration-100", "text-muted-foreground hover:text-foreground hover:bg-muted/50", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"))), t;
127
+ })();
128
+ },
129
+ get items() {
130
+ return r();
131
+ },
132
+ onSelect: (t) => {
133
+ const c = n.segments.find((d) => d.path === t);
134
+ c && n.onSelect(c);
135
+ },
136
+ align: "start"
137
+ });
138
+ }
139
+ function Z(n) {
108
140
  return (() => {
109
- var n = Z();
110
- return n.$$click = () => r.onClick(), o(n, l(r.icon, {
111
- class: "w-3.5 h-3.5"
112
- })), s((c) => {
113
- var m = v("flex items-center justify-center w-6 h-6 rounded cursor-pointer", "transition-all duration-150", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring", e() ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"), w = r.label, h = e();
114
- return m !== c.e && d(n, c.e = m), w !== c.t && g(n, "aria-label", c.t = w), h !== c.a && g(n, "aria-pressed", c.a = h), c;
141
+ var r = q(), s = r.firstChild;
142
+ return r.$$click = () => n.onClick(), E(s, () => n.segment.name), b((t) => {
143
+ var c = n.isLast, d = W("text-xs px-1.5 py-0.5 rounded cursor-pointer flex-shrink-0", "transition-all duration-100", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring", n.isLast ? "font-medium text-foreground cursor-default" : "text-muted-foreground hover:text-foreground hover:bg-muted/50");
144
+ return c !== t.e && (r.disabled = t.e = c), d !== t.t && x(r, t.t = d), t;
115
145
  }, {
116
146
  e: void 0,
117
- t: void 0,
118
- a: void 0
119
- }), n;
147
+ t: void 0
148
+ }), r;
120
149
  })();
121
150
  }
122
- S(["click", "input", "keydown"]);
151
+ H(["click"]);
123
152
  export {
124
- ie as FileBrowserToolbar
153
+ ce as Breadcrumb
125
154
  };