@floegence/floe-webapp-core 0.2.3 → 0.3.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.
package/dist/index44.js
CHANGED
|
@@ -1,69 +1,154 @@
|
|
|
1
|
-
import { delegateEvents as
|
|
2
|
-
import { createMemo as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { useFileBrowser as
|
|
5
|
-
import { ChevronRight as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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);
|
|
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 === "")
|
|
11
29
|
return [{
|
|
12
30
|
name: "Root",
|
|
13
31
|
path: "/"
|
|
14
32
|
}];
|
|
15
|
-
const
|
|
33
|
+
const o = e.split("/").filter(Boolean), i = [{
|
|
16
34
|
name: "Root",
|
|
17
35
|
path: "/"
|
|
18
36
|
}];
|
|
19
|
-
let
|
|
20
|
-
for (const
|
|
21
|
-
|
|
22
|
-
name:
|
|
23
|
-
path:
|
|
37
|
+
let l = "";
|
|
38
|
+
for (const f of o)
|
|
39
|
+
l += "/" + f, i.push({
|
|
40
|
+
name: f,
|
|
41
|
+
path: l
|
|
24
42
|
});
|
|
25
|
-
return
|
|
26
|
-
}),
|
|
27
|
-
e
|
|
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);
|
|
28
77
|
};
|
|
29
78
|
return (() => {
|
|
30
|
-
var
|
|
31
|
-
return
|
|
79
|
+
var e = X(), o = s;
|
|
80
|
+
return typeof o == "function" ? y(o, e) : s = e, E(e, a(O, {
|
|
32
81
|
get each() {
|
|
33
|
-
return
|
|
82
|
+
return m().visible;
|
|
34
83
|
},
|
|
35
|
-
children: (
|
|
84
|
+
children: (i, l) => [a(M, {
|
|
36
85
|
get when() {
|
|
37
|
-
return
|
|
86
|
+
return l() > 0;
|
|
38
87
|
},
|
|
39
88
|
get children() {
|
|
40
|
-
return
|
|
89
|
+
return a(T, {
|
|
41
90
|
class: "w-3 h-3 text-muted-foreground/50 flex-shrink-0"
|
|
42
91
|
});
|
|
43
92
|
}
|
|
44
|
-
}),
|
|
45
|
-
|
|
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,
|
|
46
109
|
get isLast() {
|
|
47
|
-
return
|
|
110
|
+
return l() === m().visible.length - 1;
|
|
48
111
|
},
|
|
49
|
-
onClick: () =>
|
|
112
|
+
onClick: () => C(i)
|
|
50
113
|
})]
|
|
51
|
-
})),
|
|
114
|
+
})), b(() => x(e, W("flex items-center gap-1 min-w-0 overflow-hidden", n.class))), e;
|
|
52
115
|
})();
|
|
53
116
|
}
|
|
54
|
-
function
|
|
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) {
|
|
55
140
|
return (() => {
|
|
56
|
-
var
|
|
57
|
-
return
|
|
58
|
-
var
|
|
59
|
-
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;
|
|
60
145
|
}, {
|
|
61
146
|
e: void 0,
|
|
62
147
|
t: void 0
|
|
63
|
-
}),
|
|
148
|
+
}), r;
|
|
64
149
|
})();
|
|
65
150
|
}
|
|
66
|
-
|
|
151
|
+
H(["click"]);
|
|
67
152
|
export {
|
|
68
|
-
|
|
153
|
+
ce as Breadcrumb
|
|
69
154
|
};
|