@floegence/floe-webapp-core 0.35.21 → 0.35.22
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/chat.css +33 -7
- package/dist/components/chat/blocks/FileBlock.js +42 -27
- package/dist/components/chat/blocks/ToolCallBlock.js +150 -149
- package/dist/components/file-browser/Breadcrumb.js +73 -72
- package/dist/components/layout/ActivityBar.d.ts +1 -0
- package/dist/components/layout/ActivityBar.js +51 -45
- package/dist/components/layout/MobileTabBar.d.ts +1 -0
- package/dist/components/layout/MobileTabBar.js +109 -65
- package/dist/components/layout/Shell.js +190 -158
- package/dist/components/layout/Sidebar.d.ts +1 -0
- package/dist/components/layout/Sidebar.js +33 -31
- package/dist/components/layout/SidebarPane.d.ts +1 -0
- package/dist/components/layout/SidebarPane.js +40 -37
- package/dist/components/layout/TopBar.d.ts +1 -0
- package/dist/components/layout/TopBar.js +23 -22
- package/dist/components/ui/Dropdown.d.ts +13 -0
- package/dist/components/ui/Dropdown.js +263 -145
- package/dist/components/ui/Tabs.d.ts +4 -0
- package/dist/components/ui/Tabs.js +207 -149
- package/dist/context/FloeConfigContext.d.ts +17 -0
- package/dist/context/FloeConfigContext.js +34 -25
- package/dist/context/NotificationContext.js +76 -69
- package/dist/styles/tokens.d.ts +4 -4
- package/dist/styles/tokens.js +55 -14
- package/dist/styles.css +1 -1
- package/dist/themes/light.css +2 -2
- package/package.json +1 -1
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { cn as
|
|
1
|
+
import { insert as E, createComponent as a, memo as $, effect as D, className as L, template as b, use as H, delegateEvents as P } from "solid-js/web";
|
|
2
|
+
import { createSignal as B, onMount as y, createMemo as I, For as O, Show as k, onCleanup as F } from "solid-js";
|
|
3
|
+
import { cn as x } from "../../utils/cn.js";
|
|
4
4
|
import { useFileBrowser as G } from "./FileBrowserContext.js";
|
|
5
|
-
import { ChevronRight as
|
|
5
|
+
import { ChevronRight as M } from "../icons/index.js";
|
|
6
6
|
import { Dropdown as z } from "../ui/Dropdown.js";
|
|
7
|
-
var X = /* @__PURE__ */
|
|
8
|
-
const p = 16, J = 28,
|
|
9
|
-
function V(
|
|
10
|
-
const
|
|
11
|
-
return Math.min(
|
|
7
|
+
var X = /* @__PURE__ */ b("<nav aria-label=Breadcrumb>"), j = /* @__PURE__ */ b("<span>…"), q = /* @__PURE__ */ b('<button type=button><span class="truncate max-w-[120px] block">');
|
|
8
|
+
const p = 16, J = 28, T = 12, K = 7, Q = 120, U = 100;
|
|
9
|
+
function V(n) {
|
|
10
|
+
const t = n.length * K;
|
|
11
|
+
return Math.min(t + T, Q + T);
|
|
12
12
|
}
|
|
13
|
-
function ce(
|
|
14
|
-
const
|
|
15
|
-
let
|
|
16
|
-
const [
|
|
17
|
-
|
|
18
|
-
if (!
|
|
13
|
+
function ce(n) {
|
|
14
|
+
const t = G();
|
|
15
|
+
let o;
|
|
16
|
+
const [r, c] = B(0);
|
|
17
|
+
y(() => {
|
|
18
|
+
if (!o) return;
|
|
19
19
|
const e = () => {
|
|
20
|
-
|
|
20
|
+
o && c(o.offsetWidth);
|
|
21
21
|
};
|
|
22
22
|
e();
|
|
23
|
-
const
|
|
24
|
-
|
|
23
|
+
const s = new ResizeObserver(e);
|
|
24
|
+
s.observe(o), F(() => s.disconnect());
|
|
25
25
|
});
|
|
26
|
-
const
|
|
27
|
-
const e =
|
|
26
|
+
const h = I(() => {
|
|
27
|
+
const e = t.currentPath(), s = t.homeLabel();
|
|
28
28
|
if (e === "/" || e === "")
|
|
29
29
|
return [{
|
|
30
|
-
name:
|
|
30
|
+
name: s,
|
|
31
31
|
path: "/"
|
|
32
32
|
}];
|
|
33
33
|
const l = e.split("/").filter(Boolean), i = [{
|
|
34
|
-
name:
|
|
34
|
+
name: s,
|
|
35
35
|
path: "/"
|
|
36
36
|
}];
|
|
37
|
-
let
|
|
38
|
-
for (const
|
|
39
|
-
|
|
40
|
-
name:
|
|
41
|
-
path:
|
|
37
|
+
let g = "";
|
|
38
|
+
for (const f of l)
|
|
39
|
+
g += "/" + f, i.push({
|
|
40
|
+
name: f,
|
|
41
|
+
path: g
|
|
42
42
|
});
|
|
43
43
|
return i;
|
|
44
|
-
}), m =
|
|
45
|
-
const e =
|
|
46
|
-
if (
|
|
44
|
+
}), m = I(() => {
|
|
45
|
+
const e = h(), s = r();
|
|
46
|
+
if (s < U || e.length <= 2)
|
|
47
47
|
return {
|
|
48
48
|
collapsed: [],
|
|
49
49
|
visible: e,
|
|
50
50
|
shouldCollapse: !1
|
|
51
51
|
};
|
|
52
|
-
const l = e.map((
|
|
53
|
-
if (
|
|
52
|
+
const l = e.map((d) => V(d.name)), i = l[0], g = l[e.length - 1], f = p, R = e.length > 1 ? p : 0, C = i + g + f + R;
|
|
53
|
+
if (C > s && e.length > 2)
|
|
54
54
|
return {
|
|
55
55
|
collapsed: e.slice(1, -1),
|
|
56
56
|
visible: [e[0], e[e.length - 1]],
|
|
57
57
|
shouldCollapse: !0
|
|
58
58
|
};
|
|
59
|
-
const
|
|
60
|
-
let
|
|
61
|
-
const
|
|
62
|
-
for (let
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
65
|
-
v.unshift(
|
|
59
|
+
const u = e.slice(1, -1), v = [];
|
|
60
|
+
let S = s - C;
|
|
61
|
+
const A = u.length > 0 ? J + p : 0;
|
|
62
|
+
for (let d = u.length - 1; d >= 0; d--) {
|
|
63
|
+
const _ = l[d + 1] + p, N = d > 0 ? A : 0;
|
|
64
|
+
if (S - N >= _)
|
|
65
|
+
v.unshift(u[d]), S -= _;
|
|
66
66
|
else
|
|
67
67
|
break;
|
|
68
68
|
}
|
|
69
|
-
const
|
|
69
|
+
const w = u.slice(0, u.length - v.length);
|
|
70
70
|
return {
|
|
71
|
-
collapsed:
|
|
71
|
+
collapsed: w,
|
|
72
72
|
visible: [e[0], ...v, e[e.length - 1]],
|
|
73
|
-
shouldCollapse:
|
|
73
|
+
shouldCollapse: w.length > 0
|
|
74
74
|
};
|
|
75
|
-
}),
|
|
76
|
-
|
|
75
|
+
}), W = (e) => {
|
|
76
|
+
t.setCurrentPath(e.path);
|
|
77
77
|
};
|
|
78
78
|
return (() => {
|
|
79
|
-
var e = X(),
|
|
80
|
-
return typeof
|
|
79
|
+
var e = X(), s = o;
|
|
80
|
+
return typeof s == "function" ? H(s, e) : o = e, E(e, a(O, {
|
|
81
81
|
get each() {
|
|
82
82
|
return m().visible;
|
|
83
83
|
},
|
|
84
|
-
children: (l, i) => [a(
|
|
84
|
+
children: (l, i) => [a(k, {
|
|
85
85
|
get when() {
|
|
86
86
|
return i() > 0;
|
|
87
87
|
},
|
|
88
88
|
get children() {
|
|
89
|
-
return a(
|
|
89
|
+
return a(M, {
|
|
90
90
|
class: "w-3 h-3 text-muted-foreground/50 flex-shrink-0"
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
|
-
}), a(
|
|
93
|
+
}), a(k, {
|
|
94
94
|
get when() {
|
|
95
|
-
return
|
|
95
|
+
return $(() => !!m().shouldCollapse)() && i() === 1;
|
|
96
96
|
},
|
|
97
97
|
get children() {
|
|
98
98
|
return [a(Y, {
|
|
99
99
|
get segments() {
|
|
100
100
|
return m().collapsed;
|
|
101
101
|
},
|
|
102
|
-
onSelect:
|
|
103
|
-
}), a(
|
|
102
|
+
onSelect: W
|
|
103
|
+
}), a(M, {
|
|
104
104
|
class: "w-3 h-3 text-muted-foreground/50 flex-shrink-0"
|
|
105
105
|
})];
|
|
106
106
|
}
|
|
@@ -109,43 +109,44 @@ function ce(r) {
|
|
|
109
109
|
get isLast() {
|
|
110
110
|
return i() === m().visible.length - 1;
|
|
111
111
|
},
|
|
112
|
-
onClick: () =>
|
|
112
|
+
onClick: () => W(l)
|
|
113
113
|
})]
|
|
114
|
-
})),
|
|
114
|
+
})), D(() => L(e, x("flex items-center gap-1 min-w-0 overflow-hidden", n.class))), e;
|
|
115
115
|
})();
|
|
116
116
|
}
|
|
117
|
-
function Y(
|
|
118
|
-
const
|
|
119
|
-
id:
|
|
120
|
-
label:
|
|
117
|
+
function Y(n) {
|
|
118
|
+
const t = () => n.segments.map((r) => ({
|
|
119
|
+
id: r.path,
|
|
120
|
+
label: r.name
|
|
121
121
|
}));
|
|
122
122
|
return a(z, {
|
|
123
123
|
get trigger() {
|
|
124
|
-
return (
|
|
125
|
-
var t = j();
|
|
126
|
-
return b(() => x(t, C("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
|
-
})();
|
|
124
|
+
return j();
|
|
128
125
|
},
|
|
126
|
+
get triggerClass() {
|
|
127
|
+
return x("inline-flex items-center text-xs px-1.5 py-0.5 rounded flex-shrink-0", "transition-all duration-100", "text-muted-foreground hover:text-foreground hover:bg-muted/50");
|
|
128
|
+
},
|
|
129
|
+
triggerAriaLabel: "Show hidden path segments",
|
|
129
130
|
get items() {
|
|
130
|
-
return
|
|
131
|
+
return t();
|
|
131
132
|
},
|
|
132
|
-
onSelect: (
|
|
133
|
-
const c =
|
|
134
|
-
c &&
|
|
133
|
+
onSelect: (r) => {
|
|
134
|
+
const c = n.segments.find((h) => h.path === r);
|
|
135
|
+
c && n.onSelect(c);
|
|
135
136
|
},
|
|
136
137
|
align: "start"
|
|
137
138
|
});
|
|
138
139
|
}
|
|
139
|
-
function Z(
|
|
140
|
+
function Z(n) {
|
|
140
141
|
return (() => {
|
|
141
|
-
var
|
|
142
|
-
return
|
|
143
|
-
var c =
|
|
144
|
-
return c !==
|
|
142
|
+
var t = q(), o = t.firstChild;
|
|
143
|
+
return t.$$click = () => n.onClick(), E(o, () => n.segment.name), D((r) => {
|
|
144
|
+
var c = n.isLast, h = x("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");
|
|
145
|
+
return c !== r.e && (t.disabled = r.e = c), h !== r.t && L(t, r.t = h), r;
|
|
145
146
|
}, {
|
|
146
147
|
e: void 0,
|
|
147
148
|
t: void 0
|
|
148
|
-
}),
|
|
149
|
+
}), t;
|
|
149
150
|
})();
|
|
150
151
|
}
|
|
151
152
|
P(["click"]);
|
|
@@ -1,104 +1,110 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import { createMemo as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { deferNonBlocking as
|
|
5
|
-
import { Tooltip as
|
|
1
|
+
import { insert as c, createComponent as a, effect as f, className as g, setAttribute as m, template as s, Dynamic as k, memo as w, delegateEvents as I } from "solid-js/web";
|
|
2
|
+
import { createMemo as b, For as C, Show as h } from "solid-js";
|
|
3
|
+
import { cn as y } from "../../utils/cn.js";
|
|
4
|
+
import { deferNonBlocking as $ } from "../../utils/defer.js";
|
|
5
|
+
import { Tooltip as B } from "../ui/Tooltip.js";
|
|
6
6
|
import { resolveActivityBarClick as _ } from "./activityBarBehavior.js";
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
const o =
|
|
7
|
+
var S = /* @__PURE__ */ s('<div class="flex flex-col">'), j = /* @__PURE__ */ s('<nav data-floe-shell-slot=activity-bar style=border-right-color:var(--activity-bar-border)><div class="flex flex-col">'), N = /* @__PURE__ */ s('<div class="absolute left-0 top-0 w-1 h-full bg-primary rounded-r">'), q = /* @__PURE__ */ s("<span>"), D = /* @__PURE__ */ s("<button type=button>");
|
|
8
|
+
function z(e) {
|
|
9
|
+
const o = b(() => e.activeId), n = b(() => e.collapsed ?? !1), t = b(() => e.onActiveChange), d = b(() => e.onCollapsedChange), v = (i) => {
|
|
10
10
|
if (i.onClick) {
|
|
11
|
-
|
|
11
|
+
$(() => i.onClick());
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
|
-
const
|
|
14
|
+
const l = _({
|
|
15
15
|
clickedId: i.id,
|
|
16
16
|
activeId: o(),
|
|
17
|
-
collapsed:
|
|
17
|
+
collapsed: n(),
|
|
18
18
|
behavior: i.collapseBehavior
|
|
19
19
|
});
|
|
20
|
-
|
|
21
|
-
openSidebar:
|
|
22
|
-
}) : t()(
|
|
20
|
+
l.nextActiveId !== o() && (typeof l.openSidebar == "boolean" ? t()(l.nextActiveId, {
|
|
21
|
+
openSidebar: l.openSidebar
|
|
22
|
+
}) : t()(l.nextActiveId)), typeof l.nextCollapsed == "boolean" && d()?.(l.nextCollapsed);
|
|
23
23
|
};
|
|
24
24
|
return (() => {
|
|
25
|
-
var i =
|
|
26
|
-
return
|
|
25
|
+
var i = j(), l = i.firstChild;
|
|
26
|
+
return c(l, a(C, {
|
|
27
27
|
get each() {
|
|
28
28
|
return e.items;
|
|
29
29
|
},
|
|
30
|
-
children: (
|
|
31
|
-
item:
|
|
30
|
+
children: (r) => a(A, {
|
|
31
|
+
item: r,
|
|
32
32
|
get isActive() {
|
|
33
|
-
return o() ===
|
|
33
|
+
return o() === r.id;
|
|
34
34
|
},
|
|
35
|
-
onClick: () =>
|
|
35
|
+
onClick: () => v(r)
|
|
36
36
|
})
|
|
37
|
-
})),
|
|
37
|
+
})), c(i, a(h, {
|
|
38
38
|
get when() {
|
|
39
39
|
return e.bottomItems?.length;
|
|
40
40
|
},
|
|
41
41
|
get children() {
|
|
42
|
-
var
|
|
43
|
-
return
|
|
42
|
+
var r = S();
|
|
43
|
+
return c(r, a(C, {
|
|
44
44
|
get each() {
|
|
45
45
|
return e.bottomItems;
|
|
46
46
|
},
|
|
47
|
-
children: (
|
|
48
|
-
item:
|
|
47
|
+
children: (u) => a(A, {
|
|
48
|
+
item: u,
|
|
49
49
|
isActive: !1,
|
|
50
|
-
onClick: () => u
|
|
50
|
+
onClick: () => v(u)
|
|
51
51
|
})
|
|
52
|
-
})),
|
|
52
|
+
})), r;
|
|
53
53
|
}
|
|
54
|
-
}), null), f(() =>
|
|
54
|
+
}), null), f((r) => {
|
|
55
|
+
var u = y("w-10 md:w-12 flex flex-col justify-between shrink-0 min-h-0", "bg-activity-bar border-r border-border", e.class), x = e.ariaLabel;
|
|
56
|
+
return u !== r.e && g(i, r.e = u), x !== r.t && m(i, "aria-label", r.t = x), r;
|
|
57
|
+
}, {
|
|
58
|
+
e: void 0,
|
|
59
|
+
t: void 0
|
|
60
|
+
}), i;
|
|
55
61
|
})();
|
|
56
62
|
}
|
|
57
|
-
function
|
|
63
|
+
function A(e) {
|
|
58
64
|
const o = () => typeof e.item.badge == "function" ? e.item.badge() : e.item.badge;
|
|
59
|
-
return
|
|
65
|
+
return a(B, {
|
|
60
66
|
get content() {
|
|
61
67
|
return e.item.label;
|
|
62
68
|
},
|
|
63
69
|
placement: "right",
|
|
64
70
|
delay: 0,
|
|
65
71
|
get children() {
|
|
66
|
-
var
|
|
67
|
-
return
|
|
72
|
+
var n = D();
|
|
73
|
+
return n.$$click = () => e.onClick(), c(n, a(h, {
|
|
68
74
|
get when() {
|
|
69
75
|
return e.isActive;
|
|
70
76
|
},
|
|
71
77
|
get children() {
|
|
72
|
-
return
|
|
78
|
+
return N();
|
|
73
79
|
}
|
|
74
|
-
}), null),
|
|
80
|
+
}), null), c(n, a(k, {
|
|
75
81
|
get component() {
|
|
76
82
|
return e.item.icon;
|
|
77
83
|
},
|
|
78
84
|
class: "w-5 h-5"
|
|
79
|
-
}), null),
|
|
85
|
+
}), null), c(n, a(h, {
|
|
80
86
|
get when() {
|
|
81
87
|
return o();
|
|
82
88
|
},
|
|
83
89
|
get children() {
|
|
84
|
-
var t =
|
|
85
|
-
return
|
|
86
|
-
var
|
|
87
|
-
return () =>
|
|
88
|
-
})()), f(() =>
|
|
90
|
+
var t = q();
|
|
91
|
+
return c(t, (() => {
|
|
92
|
+
var d = w(() => typeof o() == "number" && o() > 99);
|
|
93
|
+
return () => d() ? "99+" : o();
|
|
94
|
+
})()), f(() => g(t, y("absolute top-0.5 right-0.5 min-w-3.5 h-3.5 px-1", "flex items-center justify-center", "text-[9px] font-medium rounded-full", "bg-activity-bar-badge text-activity-bar-badge-foreground"))), t;
|
|
89
95
|
}
|
|
90
96
|
}), null), f((t) => {
|
|
91
|
-
var
|
|
92
|
-
return
|
|
97
|
+
var d = y("relative w-full aspect-square flex items-center justify-center cursor-pointer", "transition-[color,background-color] duration-100", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset", e.isActive ? "text-activity-bar-foreground-active bg-accent/80" : "text-activity-bar-foreground hover:text-activity-bar-foreground-active hover:bg-accent/40"), v = e.item.label, i = e.isActive;
|
|
98
|
+
return d !== t.e && g(n, t.e = d), v !== t.t && m(n, "aria-label", t.t = v), i !== t.a && m(n, "aria-pressed", t.a = i), t;
|
|
93
99
|
}, {
|
|
94
100
|
e: void 0,
|
|
95
101
|
t: void 0,
|
|
96
102
|
a: void 0
|
|
97
|
-
}),
|
|
103
|
+
}), n;
|
|
98
104
|
}
|
|
99
105
|
});
|
|
100
106
|
}
|
|
101
|
-
|
|
107
|
+
I(["click"]);
|
|
102
108
|
export {
|
|
103
|
-
|
|
109
|
+
z as ActivityBar
|
|
104
110
|
};
|
|
@@ -1,115 +1,159 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { deferNonBlocking as
|
|
5
|
-
var q = /* @__PURE__ */
|
|
6
|
-
function
|
|
7
|
-
let
|
|
8
|
-
const [
|
|
9
|
-
let
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
if (
|
|
1
|
+
import { insert as c, createComponent as d, effect as S, className as v, setAttribute as C, template as b, Dynamic as W, memo as M, use as R, delegateEvents as z } from "solid-js/web";
|
|
2
|
+
import { createSignal as I, onMount as D, onCleanup as E, Show as A, For as j } from "solid-js";
|
|
3
|
+
import { cn as g } from "../../utils/cn.js";
|
|
4
|
+
import { deferNonBlocking as L } from "../../utils/defer.js";
|
|
5
|
+
var q = /* @__PURE__ */ b('<div class="absolute left-0 top-0 bottom-0 w-8 bg-gradient-to-r from-background to-transparent z-10 pointer-events-none">'), B = /* @__PURE__ */ b('<div class="absolute right-0 top-0 bottom-0 w-8 bg-gradient-to-l from-background to-transparent z-10 pointer-events-none">'), K = /* @__PURE__ */ b('<nav data-floe-shell-slot=mobile-tab-bar style=border-top-color:var(--bottom-bar-border)><div class="relative h-14"><div class="h-full flex items-center overflow-x-auto scrollbar-hide snap-x snap-mandatory"role=tablist aria-orientation=horizontal style=-webkit-overflow-scrolling:touch>'), N = /* @__PURE__ */ b("<span>"), T = /* @__PURE__ */ b('<div class="absolute bottom-0 left-1/2 -translate-x-1/2 w-8 h-0.5 bg-primary rounded-t">'), H = /* @__PURE__ */ b("<button type=button role=tab><div></div><span>");
|
|
6
|
+
function P(e) {
|
|
7
|
+
let i;
|
|
8
|
+
const [o, u] = I(!1), [h, t] = I(!1);
|
|
9
|
+
let n = null;
|
|
10
|
+
const s = () => {
|
|
11
|
+
i && (u(i.scrollLeft > 0), t(i.scrollLeft < i.scrollWidth - i.clientWidth - 1));
|
|
12
|
+
}, x = () => {
|
|
13
|
+
if (n === null) {
|
|
14
14
|
if (typeof requestAnimationFrame > "u") {
|
|
15
|
-
|
|
15
|
+
s();
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
n = requestAnimationFrame(() => {
|
|
19
|
+
n = null, s();
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
+
}, k = () => e.items, w = (l) => {
|
|
23
|
+
const r = k()[l];
|
|
24
|
+
if (r) {
|
|
25
|
+
if (r.onClick) {
|
|
26
|
+
L(() => r.onClick());
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
e.onSelect(r.id);
|
|
30
|
+
}
|
|
22
31
|
};
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
const
|
|
28
|
-
|
|
32
|
+
return D(() => {
|
|
33
|
+
s();
|
|
34
|
+
const l = e.items.findIndex((r) => r.id === e.activeId);
|
|
35
|
+
if (l > 0 && i) {
|
|
36
|
+
const r = i.scrollWidth / e.items.length;
|
|
37
|
+
i.scrollLeft = Math.max(0, r * l - i.clientWidth / 2 + r / 2);
|
|
29
38
|
}
|
|
30
|
-
}),
|
|
31
|
-
|
|
39
|
+
}), E(() => {
|
|
40
|
+
n !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(n), n = null);
|
|
32
41
|
}), (() => {
|
|
33
|
-
var
|
|
34
|
-
|
|
42
|
+
var l = K(), r = l.firstChild, m = r.firstChild;
|
|
43
|
+
c(r, d(A, {
|
|
35
44
|
get when() {
|
|
36
|
-
return
|
|
45
|
+
return o();
|
|
37
46
|
},
|
|
38
47
|
get children() {
|
|
39
48
|
return q();
|
|
40
49
|
}
|
|
41
|
-
}),
|
|
50
|
+
}), m), c(r, d(A, {
|
|
42
51
|
get when() {
|
|
43
|
-
return
|
|
52
|
+
return h();
|
|
44
53
|
},
|
|
45
54
|
get children() {
|
|
46
|
-
return
|
|
55
|
+
return B();
|
|
47
56
|
}
|
|
48
|
-
}),
|
|
49
|
-
var
|
|
50
|
-
return typeof
|
|
57
|
+
}), m), m.addEventListener("scroll", x);
|
|
58
|
+
var $ = i;
|
|
59
|
+
return typeof $ == "function" ? R($, m) : i = m, c(m, d(j, {
|
|
51
60
|
get each() {
|
|
52
61
|
return e.items;
|
|
53
62
|
},
|
|
54
|
-
children: (
|
|
55
|
-
item:
|
|
63
|
+
children: (a, y) => d(U, {
|
|
64
|
+
item: a,
|
|
56
65
|
get isActive() {
|
|
57
|
-
return e.activeId ===
|
|
66
|
+
return e.activeId === a.id;
|
|
67
|
+
},
|
|
68
|
+
get index() {
|
|
69
|
+
return y();
|
|
70
|
+
},
|
|
71
|
+
get itemCount() {
|
|
72
|
+
return e.items.length;
|
|
58
73
|
},
|
|
59
74
|
onClick: () => {
|
|
60
75
|
"vibrate" in navigator && navigator.vibrate(10);
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
}
|
|
76
|
+
const f = a.onClick, _ = e.onSelect, F = a.id;
|
|
77
|
+
a.onClick ? L(() => f()) : _(F);
|
|
78
|
+
},
|
|
79
|
+
onKeyboardSelect: (f) => w(f)
|
|
64
80
|
})
|
|
65
|
-
})),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
81
|
+
})), S((a) => {
|
|
82
|
+
var y = g(
|
|
83
|
+
// Same safe-area rule as TopBar: keep the visual bar height stable, and
|
|
84
|
+
// add safe-area padding on an outer wrapper (avoid squeezing content).
|
|
85
|
+
"relative shrink-0 bg-background border-t border-border safe-bottom safe-left safe-right",
|
|
86
|
+
e.class
|
|
87
|
+
), f = e.ariaLabel;
|
|
88
|
+
return y !== a.e && v(l, a.e = y), f !== a.t && C(l, "aria-label", a.t = f), a;
|
|
89
|
+
}, {
|
|
90
|
+
e: void 0,
|
|
91
|
+
t: void 0
|
|
92
|
+
}), l;
|
|
71
93
|
})();
|
|
72
94
|
}
|
|
73
|
-
function
|
|
74
|
-
const
|
|
95
|
+
function U(e) {
|
|
96
|
+
const i = () => typeof e.item.badge == "function" ? e.item.badge() : e.item.badge;
|
|
75
97
|
return (() => {
|
|
76
|
-
var
|
|
77
|
-
return
|
|
98
|
+
var o = H(), u = o.firstChild, h = u.nextSibling;
|
|
99
|
+
return o.$$keydown = (t) => {
|
|
100
|
+
let n = null;
|
|
101
|
+
switch (t.key) {
|
|
102
|
+
case "ArrowRight":
|
|
103
|
+
case "ArrowDown":
|
|
104
|
+
n = (e.index + 1) % e.itemCount;
|
|
105
|
+
break;
|
|
106
|
+
case "ArrowLeft":
|
|
107
|
+
case "ArrowUp":
|
|
108
|
+
n = (e.index - 1 + e.itemCount) % e.itemCount;
|
|
109
|
+
break;
|
|
110
|
+
case "Home":
|
|
111
|
+
n = 0;
|
|
112
|
+
break;
|
|
113
|
+
case "End":
|
|
114
|
+
n = e.itemCount - 1;
|
|
115
|
+
break;
|
|
116
|
+
default:
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
t.preventDefault(), e.onKeyboardSelect(n);
|
|
120
|
+
}, o.$$click = () => e.onClick(), c(u, d(W, {
|
|
78
121
|
get component() {
|
|
79
122
|
return e.item.icon;
|
|
80
123
|
},
|
|
81
124
|
class: "w-6 h-6"
|
|
82
|
-
}), null),
|
|
125
|
+
}), null), c(u, d(A, {
|
|
83
126
|
get when() {
|
|
84
|
-
return
|
|
127
|
+
return i();
|
|
85
128
|
},
|
|
86
129
|
get children() {
|
|
87
|
-
var t =
|
|
88
|
-
return
|
|
89
|
-
var
|
|
90
|
-
return () =>
|
|
91
|
-
})()),
|
|
130
|
+
var t = N();
|
|
131
|
+
return c(t, (() => {
|
|
132
|
+
var n = M(() => typeof i() == "number" && i() > 99);
|
|
133
|
+
return () => n() ? "99+" : i();
|
|
134
|
+
})()), S(() => v(t, g("absolute -top-1 -right-2 min-w-4 h-4 px-1", "flex items-center justify-center", "text-[10px] font-medium rounded-full", "bg-primary text-primary-foreground"))), t;
|
|
92
135
|
}
|
|
93
|
-
}), null),
|
|
136
|
+
}), null), c(h, () => e.item.label), c(o, d(A, {
|
|
94
137
|
get when() {
|
|
95
138
|
return e.isActive;
|
|
96
139
|
},
|
|
97
140
|
get children() {
|
|
98
|
-
return
|
|
141
|
+
return T();
|
|
99
142
|
}
|
|
100
|
-
}), null),
|
|
101
|
-
var
|
|
102
|
-
return
|
|
143
|
+
}), null), S((t) => {
|
|
144
|
+
var n = g("relative flex-shrink-0 flex flex-col items-center justify-center", "min-w-16 h-full px-4 snap-center", "transition-[color] duration-150", "focus:outline-none focus-visible:bg-muted", e.isActive ? "text-primary" : "text-muted-foreground active:text-foreground"), s = e.item.label, x = e.isActive, k = e.isActive ? 0 : -1, w = g("relative transition-transform duration-150", e.isActive && "scale-110"), l = g("mt-1 text-[10px] font-medium truncate max-w-full", e.isActive && "font-semibold");
|
|
145
|
+
return n !== t.e && v(o, t.e = n), s !== t.t && C(o, "aria-label", t.t = s), x !== t.a && C(o, "aria-selected", t.a = x), k !== t.o && C(o, "tabindex", t.o = k), w !== t.i && v(u, t.i = w), l !== t.n && v(h, t.n = l), t;
|
|
103
146
|
}, {
|
|
104
147
|
e: void 0,
|
|
105
148
|
t: void 0,
|
|
106
149
|
a: void 0,
|
|
107
150
|
o: void 0,
|
|
108
|
-
i: void 0
|
|
109
|
-
|
|
151
|
+
i: void 0,
|
|
152
|
+
n: void 0
|
|
153
|
+
}), o;
|
|
110
154
|
})();
|
|
111
155
|
}
|
|
112
|
-
|
|
156
|
+
z(["click", "keydown"]);
|
|
113
157
|
export {
|
|
114
|
-
|
|
158
|
+
P as MobileTabBar
|
|
115
159
|
};
|