@floegence/floe-webapp-core 0.26.4 → 0.26.6
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/app/ActivityAppsMain.js +13 -19
- package/dist/components/ui/Tabs.js +156 -116
- package/dist/context/ComponentRegistry.d.ts +2 -0
- package/dist/context/ComponentRegistry.js +41 -33
- package/dist/context/FloeConfigContext.d.ts +9 -0
- package/dist/context/FloeConfigContext.js +103 -65
- package/dist/context/createSimpleContext.d.ts +2 -0
- package/dist/context/createSimpleContext.js +25 -17
- package/dist/context/index.d.ts +1 -1
- package/dist/full.js +364 -362
- package/dist/index.js +100 -98
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,36 +1,30 @@
|
|
|
1
|
-
import { createComponent as
|
|
1
|
+
import { createComponent as i, Dynamic as u } from "solid-js/web";
|
|
2
2
|
import { untrack as d, createMemo as m } from "solid-js";
|
|
3
3
|
import { useLayout as l } from "../context/LayoutContext.js";
|
|
4
|
-
import {
|
|
4
|
+
import { useOptionalComponentRegistry as v } from "../context/ComponentRegistry.js";
|
|
5
5
|
import { KeepAliveStack as f } from "../components/layout/KeepAliveStack.js";
|
|
6
|
-
function
|
|
6
|
+
function w(e) {
|
|
7
7
|
return e.sidebar?.fullScreen === !0 || e.sidebar?.renderIn === "main";
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
const
|
|
11
|
-
try {
|
|
12
|
-
return v();
|
|
13
|
-
} catch {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
})();
|
|
9
|
+
function b(e) {
|
|
10
|
+
const n = l(), r = v();
|
|
17
11
|
if (!d(() => !!e.views) && !r)
|
|
18
12
|
throw new Error("ActivityAppsMain requires ComponentRegistryProvider when `views` is not provided.");
|
|
19
|
-
const o = () => e.activeId ? e.activeId() :
|
|
13
|
+
const o = () => e.activeId ? e.activeId() : n.sidebarActiveTab(), s = m(() => {
|
|
20
14
|
if (!r) return [];
|
|
21
|
-
const
|
|
22
|
-
return r.sidebarItems().filter((t) =>
|
|
15
|
+
const c = e.include ?? w;
|
|
16
|
+
return r.sidebarItems().filter((t) => c(t)).map((t) => ({
|
|
23
17
|
id: t.id,
|
|
24
|
-
render: () =>
|
|
18
|
+
render: () => i(u, {
|
|
25
19
|
get component() {
|
|
26
20
|
return t.component;
|
|
27
21
|
}
|
|
28
22
|
})
|
|
29
23
|
}));
|
|
30
|
-
}),
|
|
31
|
-
return
|
|
24
|
+
}), a = () => e.views ?? s();
|
|
25
|
+
return i(f, {
|
|
32
26
|
get views() {
|
|
33
|
-
return
|
|
27
|
+
return a();
|
|
34
28
|
},
|
|
35
29
|
get activeId() {
|
|
36
30
|
return o();
|
|
@@ -47,5 +41,5 @@ function A(e) {
|
|
|
47
41
|
});
|
|
48
42
|
}
|
|
49
43
|
export {
|
|
50
|
-
|
|
44
|
+
b as ActivityAppsMain
|
|
51
45
|
};
|
|
@@ -1,219 +1,259 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { splitProps as
|
|
1
|
+
import { createComponent as u, spread as Z, mergeProps as ee, insert as c, effect as g, className as p, setStyleProperty as G, memo as J, use as K, setAttribute as C, template as h, delegateEvents as we } from "solid-js/web";
|
|
2
|
+
import { splitProps as te, Show as m, createSignal as b, untrack as Q, createEffect as z, For as xe, onCleanup as Y } from "solid-js";
|
|
3
3
|
import { cn as v } from "../../utils/cn.js";
|
|
4
|
-
import { deferAfterPaint as
|
|
5
|
-
import { useViewActivation as
|
|
6
|
-
import { X as
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
var t =
|
|
10
|
-
return
|
|
4
|
+
import { deferAfterPaint as $ } from "../../utils/defer.js";
|
|
5
|
+
import { useViewActivation as ye } from "../../context/ViewActivationContext.js";
|
|
6
|
+
import { X as ke, Plus as $e, ChevronRight as Ce } from "../icons/index.js";
|
|
7
|
+
var Se = /* @__PURE__ */ h('<svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="m15 18-6-6 6-6">'), Ae = /* @__PURE__ */ h('<button type=button aria-label="Scroll left">'), Ie = /* @__PURE__ */ h('<div class="pointer-events-none absolute bottom-0 left-0 z-10 h-0.5 bg-primary transition-[transform,width] duration-200 ease-out will-change-transform motion-reduce:transition-none">'), ze = /* @__PURE__ */ h('<button type=button aria-label="Add new tab">'), Re = /* @__PURE__ */ h('<button type=button aria-label="Scroll right">'), Le = /* @__PURE__ */ h("<div><div>"), _e = /* @__PURE__ */ h("<span class=flex-shrink-0>"), Ue = /* @__PURE__ */ h("<button type=button>"), Ee = /* @__PURE__ */ h('<div role=tab><span class="truncate max-w-32">'), Pe = /* @__PURE__ */ h("<div role=tabpanel>");
|
|
8
|
+
const Oe = (w) => (() => {
|
|
9
|
+
var t = Se();
|
|
10
|
+
return g(() => C(t, "class", w.class)), t;
|
|
11
11
|
})();
|
|
12
|
-
function
|
|
13
|
-
const [t,
|
|
14
|
-
let
|
|
15
|
-
const
|
|
12
|
+
function Xe(w) {
|
|
13
|
+
const [t, R] = te(w, ["items", "activeId", "defaultActiveId", "onChange", "onActiveIdChange", "onClose", "onAdd", "showAdd", "closable", "size", "variant", "class"]);
|
|
14
|
+
let d;
|
|
15
|
+
const j = (() => {
|
|
16
16
|
try {
|
|
17
|
-
return
|
|
17
|
+
return ye();
|
|
18
18
|
} catch {
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
|
-
})(),
|
|
22
|
-
let
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
})(), x = () => j ? j.active() : !0;
|
|
22
|
+
let L = !1;
|
|
23
|
+
const [re, ne] = b(0), [oe, le] = b(0), [B, _] = b(!1), U = /* @__PURE__ */ new Map();
|
|
24
|
+
let E = !1;
|
|
25
|
+
const S = () => (t.variant ?? "default") === "underline", M = (r) => {
|
|
26
|
+
if (!d || !S()) return !1;
|
|
27
|
+
const o = U.get(r);
|
|
28
|
+
if (!o) return !1;
|
|
29
|
+
const s = d.getBoundingClientRect(), e = o.getBoundingClientRect(), n = e.left - s.left + d.scrollLeft, a = e.width;
|
|
30
|
+
return ne(n), le(a), _(a > 0), a > 0;
|
|
31
|
+
}, se = () => {
|
|
32
|
+
if (!S()) {
|
|
33
|
+
_(!1);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
M(P()) || _(!1);
|
|
37
|
+
}, A = () => {
|
|
38
|
+
E || (E = !0, $(() => {
|
|
39
|
+
E = !1, Q(() => {
|
|
40
|
+
x() && se();
|
|
41
|
+
});
|
|
42
|
+
}));
|
|
43
|
+
}, T = () => t.activeId !== void 0, ie = () => t.onChange ?? t.onActiveIdChange, [de, ae] = b(Q(() => t.defaultActiveId ?? t.items[0]?.id ?? "")), V = () => T() ? t.activeId : de(), [P, W] = b(V());
|
|
44
|
+
z(() => {
|
|
45
|
+
W(V());
|
|
46
|
+
}), z(() => {
|
|
47
|
+
x() && (t.variant, P(), A());
|
|
26
48
|
});
|
|
27
|
-
const [
|
|
28
|
-
if (!
|
|
49
|
+
const [X, ce] = b(!1), [F, ue] = b(!1), [H, fe] = b(!1), ve = () => {
|
|
50
|
+
if (!d) return;
|
|
29
51
|
const {
|
|
30
52
|
scrollLeft: r,
|
|
31
|
-
scrollWidth:
|
|
32
|
-
clientWidth:
|
|
33
|
-
} =
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
53
|
+
scrollWidth: o,
|
|
54
|
+
clientWidth: s
|
|
55
|
+
} = d, e = o > s;
|
|
56
|
+
fe(e), ce(r > 0), ue(r + s < o - 1);
|
|
57
|
+
}, I = () => {
|
|
58
|
+
L || (L = !0, $(() => {
|
|
59
|
+
L = !1, x() && ve();
|
|
38
60
|
}));
|
|
39
|
-
},
|
|
40
|
-
|
|
61
|
+
}, he = () => {
|
|
62
|
+
d && d.scrollBy({
|
|
41
63
|
left: -150,
|
|
42
64
|
behavior: "smooth"
|
|
43
65
|
});
|
|
44
|
-
},
|
|
45
|
-
|
|
66
|
+
}, be = () => {
|
|
67
|
+
d && d.scrollBy({
|
|
46
68
|
left: 150,
|
|
47
69
|
behavior: "smooth"
|
|
48
70
|
});
|
|
49
71
|
};
|
|
50
|
-
|
|
51
|
-
if (!
|
|
52
|
-
|
|
53
|
-
const r = () =>
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
72
|
+
z(() => {
|
|
73
|
+
if (!d || !x()) return;
|
|
74
|
+
I(), A();
|
|
75
|
+
const r = () => I();
|
|
76
|
+
d.addEventListener("scroll", r);
|
|
77
|
+
const o = () => {
|
|
78
|
+
I(), A();
|
|
79
|
+
};
|
|
80
|
+
let s;
|
|
81
|
+
typeof ResizeObserver < "u" ? (s = new ResizeObserver(o), s.observe(d)) : typeof window < "u" && window.addEventListener("resize", o), Y(() => {
|
|
82
|
+
d?.removeEventListener("scroll", r), s?.disconnect(), typeof window < "u" && window.removeEventListener("resize", o);
|
|
59
83
|
});
|
|
60
|
-
}),
|
|
61
|
-
|
|
84
|
+
}), z(() => {
|
|
85
|
+
x() && (t.items.length, I(), A());
|
|
62
86
|
});
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
87
|
+
const D = (r, o) => {
|
|
88
|
+
if (o) return;
|
|
89
|
+
const s = ie();
|
|
90
|
+
if (W(r), S() && M(r), T() || ae(r), s) {
|
|
67
91
|
const e = r;
|
|
68
|
-
|
|
92
|
+
$(() => s(e));
|
|
69
93
|
}
|
|
70
|
-
},
|
|
94
|
+
}, ge = (r, o) => {
|
|
71
95
|
r.stopPropagation();
|
|
72
|
-
const
|
|
73
|
-
if (!
|
|
74
|
-
const e =
|
|
75
|
-
|
|
76
|
-
},
|
|
96
|
+
const s = t.onClose;
|
|
97
|
+
if (!s) return;
|
|
98
|
+
const e = o;
|
|
99
|
+
$(() => s(e));
|
|
100
|
+
}, O = {
|
|
77
101
|
sm: "h-7 px-2 text-[11px]",
|
|
78
102
|
md: "h-8 px-3 text-xs"
|
|
79
|
-
},
|
|
80
|
-
const
|
|
103
|
+
}, me = (r, o) => {
|
|
104
|
+
const s = "inline-flex items-center gap-1.5 font-medium transition-colors duration-150 whitespace-nowrap", e = o ? "cursor-not-allowed opacity-50" : "cursor-pointer";
|
|
81
105
|
return {
|
|
82
|
-
default: v(
|
|
83
|
-
card: v(
|
|
84
|
-
underline: v(
|
|
106
|
+
default: v(s, e, O[t.size ?? "md"], "rounded-t border-b-2", r ? "border-primary text-foreground bg-background" : "border-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50", o && "hover:bg-transparent hover:text-muted-foreground"),
|
|
107
|
+
card: v(s, e, O[t.size ?? "md"], "rounded-t border border-b-0", r ? "border-border bg-background text-foreground -mb-px z-10" : "border-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50", o && "hover:bg-transparent hover:text-muted-foreground"),
|
|
108
|
+
underline: v(s, e, O[t.size ?? "md"], "border-b-2 -mb-px", r ? B() ? "border-transparent text-foreground" : "border-primary text-foreground" : "border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground/50", o && "hover:border-transparent hover:text-muted-foreground")
|
|
85
109
|
}[t.variant ?? "default"];
|
|
86
|
-
},
|
|
110
|
+
}, pe = {
|
|
87
111
|
default: "border-b border-border",
|
|
88
112
|
card: "border-b border-border",
|
|
89
113
|
underline: "border-b border-border"
|
|
90
114
|
};
|
|
91
115
|
return (() => {
|
|
92
|
-
var r =
|
|
93
|
-
|
|
116
|
+
var r = Le(), o = r.firstChild;
|
|
117
|
+
Z(r, ee({
|
|
94
118
|
get class() {
|
|
95
|
-
return v("relative flex items-center gap-0.5",
|
|
119
|
+
return v("relative flex items-center gap-0.5", pe[t.variant ?? "default"], t.class);
|
|
96
120
|
}
|
|
97
|
-
},
|
|
121
|
+
}, R), !1, !0), c(r, u(m, {
|
|
98
122
|
get when() {
|
|
99
|
-
return
|
|
123
|
+
return H();
|
|
100
124
|
},
|
|
101
125
|
get children() {
|
|
102
|
-
var e =
|
|
103
|
-
return e.$$click =
|
|
126
|
+
var e = Ae();
|
|
127
|
+
return e.$$click = he, c(e, u(Oe, {
|
|
104
128
|
class: "w-4 h-4"
|
|
105
|
-
})),
|
|
106
|
-
var
|
|
107
|
-
return
|
|
129
|
+
})), g((n) => {
|
|
130
|
+
var a = !X(), i = v("flex-shrink-0 flex items-center justify-center", "w-6 h-6 rounded cursor-pointer", "transition-all duration-150", X() ? "text-muted-foreground hover:text-foreground hover:bg-muted/80 opacity-100" : "opacity-0 pointer-events-none");
|
|
131
|
+
return a !== n.e && (e.disabled = n.e = a), i !== n.t && p(e, n.t = i), n;
|
|
132
|
+
}, {
|
|
133
|
+
e: void 0,
|
|
134
|
+
t: void 0
|
|
135
|
+
}), e;
|
|
136
|
+
}
|
|
137
|
+
}), o);
|
|
138
|
+
var s = d;
|
|
139
|
+
return typeof s == "function" ? K(s, o) : d = o, c(o, u(m, {
|
|
140
|
+
get when() {
|
|
141
|
+
return J(() => !!S())() && B();
|
|
142
|
+
},
|
|
143
|
+
get children() {
|
|
144
|
+
var e = Ie();
|
|
145
|
+
return g((n) => {
|
|
146
|
+
var a = `translate3d(${re()}px, 0, 0)`, i = `${oe()}px`;
|
|
147
|
+
return a !== n.e && G(e, "transform", n.e = a), i !== n.t && G(e, "width", n.t = i), n;
|
|
108
148
|
}, {
|
|
109
149
|
e: void 0,
|
|
110
150
|
t: void 0
|
|
111
151
|
}), e;
|
|
112
152
|
}
|
|
113
|
-
}),
|
|
114
|
-
var l = i;
|
|
115
|
-
return typeof l == "function" ? oe(l, n) : i = n, a(n, c(se, {
|
|
153
|
+
}), null), c(o, u(xe, {
|
|
116
154
|
get each() {
|
|
117
155
|
return t.items;
|
|
118
156
|
},
|
|
119
157
|
children: (e) => {
|
|
120
|
-
const
|
|
158
|
+
const n = () => e.id === P(), a = () => e.closable ?? t.closable ?? !1;
|
|
121
159
|
return (() => {
|
|
122
|
-
var
|
|
123
|
-
return
|
|
124
|
-
(
|
|
125
|
-
},
|
|
160
|
+
var i = Ee(), N = i.firstChild;
|
|
161
|
+
return i.$$keydown = (l) => {
|
|
162
|
+
(l.key === "Enter" || l.key === " ") && (l.preventDefault(), D(e.id, e.disabled));
|
|
163
|
+
}, i.$$click = () => D(e.id, e.disabled), K((l) => {
|
|
164
|
+
U.set(e.id, l), Y(() => U.delete(e.id));
|
|
165
|
+
}, i), c(i, u(m, {
|
|
126
166
|
get when() {
|
|
127
167
|
return e.icon;
|
|
128
168
|
},
|
|
129
169
|
get children() {
|
|
130
|
-
var
|
|
131
|
-
return
|
|
170
|
+
var l = _e();
|
|
171
|
+
return c(l, () => e.icon), l;
|
|
132
172
|
}
|
|
133
|
-
}),
|
|
173
|
+
}), N), c(N, () => e.label), c(i, u(m, {
|
|
134
174
|
get when() {
|
|
135
|
-
return
|
|
175
|
+
return J(() => !!a())() && !e.disabled;
|
|
136
176
|
},
|
|
137
177
|
get children() {
|
|
138
|
-
var
|
|
139
|
-
return
|
|
178
|
+
var l = Ue();
|
|
179
|
+
return l.$$click = (f) => ge(f, e.id), c(l, u(ke, {
|
|
140
180
|
class: "w-3 h-3"
|
|
141
|
-
})),
|
|
142
|
-
var
|
|
143
|
-
return
|
|
181
|
+
})), g((f) => {
|
|
182
|
+
var y = v("flex-shrink-0 flex items-center justify-center", "w-5 h-5 rounded cursor-pointer", "bg-transparent text-muted-foreground", "hover:bg-red-500 hover:text-white", "transition-colors duration-150", "ml-1.5"), k = `Close ${e.label}`;
|
|
183
|
+
return y !== f.e && p(l, f.e = y), k !== f.t && C(l, "aria-label", f.t = k), f;
|
|
144
184
|
}, {
|
|
145
185
|
e: void 0,
|
|
146
186
|
t: void 0
|
|
147
|
-
}),
|
|
187
|
+
}), l;
|
|
148
188
|
}
|
|
149
|
-
}), null),
|
|
150
|
-
var
|
|
151
|
-
return
|
|
189
|
+
}), null), g((l) => {
|
|
190
|
+
var f = me(n(), e.disabled), y = n(), k = e.disabled, q = e.disabled ? -1 : 0;
|
|
191
|
+
return f !== l.e && p(i, l.e = f), y !== l.t && C(i, "aria-selected", l.t = y), k !== l.a && C(i, "aria-disabled", l.a = k), q !== l.o && C(i, "tabindex", l.o = q), l;
|
|
152
192
|
}, {
|
|
153
193
|
e: void 0,
|
|
154
194
|
t: void 0,
|
|
155
195
|
a: void 0,
|
|
156
196
|
o: void 0
|
|
157
|
-
}),
|
|
197
|
+
}), i;
|
|
158
198
|
})();
|
|
159
199
|
}
|
|
160
|
-
})),
|
|
200
|
+
}), null), c(r, u(m, {
|
|
161
201
|
get when() {
|
|
162
202
|
return t.showAdd;
|
|
163
203
|
},
|
|
164
204
|
get children() {
|
|
165
|
-
var e =
|
|
205
|
+
var e = ze();
|
|
166
206
|
return e.$$click = () => {
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
},
|
|
207
|
+
const n = t.onAdd;
|
|
208
|
+
n && $(() => n());
|
|
209
|
+
}, c(e, u($e, {
|
|
170
210
|
get class() {
|
|
171
211
|
return t.size === "sm" ? "w-3.5 h-3.5" : "w-4 h-4";
|
|
172
212
|
}
|
|
173
|
-
})),
|
|
213
|
+
})), g(() => p(e, v("flex-shrink-0 flex items-center justify-center", "rounded hover:bg-muted/80 cursor-pointer", "text-muted-foreground hover:text-foreground", "transition-colors duration-150", t.size === "sm" ? "w-6 h-6" : "w-7 h-7"))), e;
|
|
174
214
|
}
|
|
175
|
-
}), null),
|
|
215
|
+
}), null), c(r, u(m, {
|
|
176
216
|
get when() {
|
|
177
|
-
return
|
|
217
|
+
return H();
|
|
178
218
|
},
|
|
179
219
|
get children() {
|
|
180
|
-
var e =
|
|
181
|
-
return e.$$click =
|
|
220
|
+
var e = Re();
|
|
221
|
+
return e.$$click = be, c(e, u(Ce, {
|
|
182
222
|
class: "w-4 h-4"
|
|
183
|
-
})),
|
|
184
|
-
var
|
|
185
|
-
return
|
|
223
|
+
})), g((n) => {
|
|
224
|
+
var a = !F(), i = v("flex-shrink-0 flex items-center justify-center", "w-6 h-6 rounded cursor-pointer", "transition-all duration-150", F() ? "text-muted-foreground hover:text-foreground hover:bg-muted/80 opacity-100" : "opacity-0 pointer-events-none");
|
|
225
|
+
return a !== n.e && (e.disabled = n.e = a), i !== n.t && p(e, n.t = i), n;
|
|
186
226
|
}, {
|
|
187
227
|
e: void 0,
|
|
188
228
|
t: void 0
|
|
189
229
|
}), e;
|
|
190
230
|
}
|
|
191
|
-
}), null),
|
|
192
|
-
"flex-1 flex items-end gap-0.5 overflow-x-auto",
|
|
231
|
+
}), null), g(() => p(o, v(
|
|
232
|
+
"relative flex-1 flex items-end gap-0.5 overflow-x-auto",
|
|
193
233
|
"scrollbar-none",
|
|
194
234
|
// Hide scrollbar for all browsers
|
|
195
235
|
"[&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]"
|
|
196
236
|
))), r;
|
|
197
237
|
})();
|
|
198
238
|
}
|
|
199
|
-
function
|
|
200
|
-
const [t,
|
|
201
|
-
return
|
|
239
|
+
function Fe(w) {
|
|
240
|
+
const [t, R] = te(w, ["active", "keepMounted", "class", "children"]);
|
|
241
|
+
return u(m, {
|
|
202
242
|
get when() {
|
|
203
243
|
return t.keepMounted || t.active;
|
|
204
244
|
},
|
|
205
245
|
get children() {
|
|
206
|
-
var
|
|
207
|
-
return
|
|
246
|
+
var d = Pe();
|
|
247
|
+
return Z(d, ee({
|
|
208
248
|
get class() {
|
|
209
249
|
return v(!t.active && t.keepMounted && "hidden", t.class);
|
|
210
250
|
}
|
|
211
|
-
},
|
|
251
|
+
}, R), !1, !0), c(d, () => t.children), d;
|
|
212
252
|
}
|
|
213
253
|
});
|
|
214
254
|
}
|
|
215
|
-
|
|
255
|
+
we(["click", "keydown"]);
|
|
216
256
|
export {
|
|
217
|
-
|
|
218
|
-
|
|
257
|
+
Fe as TabPanel,
|
|
258
|
+
Xe as Tabs
|
|
219
259
|
};
|
|
@@ -98,4 +98,6 @@ export declare const ComponentRegistryProvider: (props: {
|
|
|
98
98
|
children: import("solid-js").JSX.Element;
|
|
99
99
|
}) => import("solid-js").JSX.Element;
|
|
100
100
|
export declare function useComponentRegistry<TProtocol = unknown>(): ComponentRegistryValue<TProtocol>;
|
|
101
|
+
export declare function useOptionalComponentRegistry<TProtocol = unknown>(): ComponentRegistryValue<TProtocol> | undefined;
|
|
102
|
+
export declare function hasComponentRegistryContext(): boolean;
|
|
101
103
|
export declare function createComponentRegistry(): ComponentRegistryValue<unknown>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { createSignal as
|
|
1
|
+
import { createSignal as C } from "solid-js";
|
|
2
2
|
import { createSimpleContext as h } from "./createSimpleContext.js";
|
|
3
3
|
import { useResolvedFloeConfig as w } from "./FloeConfigContext.js";
|
|
4
|
-
import { useTheme as
|
|
5
|
-
import { useLayout as
|
|
4
|
+
import { useTheme as x } from "./ThemeContext.js";
|
|
5
|
+
import { useLayout as v } from "./LayoutContext.js";
|
|
6
6
|
import { useCommand as b } from "./CommandContext.js";
|
|
7
|
-
import { useNotification as
|
|
8
|
-
import { deferNonBlocking as
|
|
9
|
-
function
|
|
7
|
+
import { useNotification as R } from "./NotificationContext.js";
|
|
8
|
+
import { deferNonBlocking as M } from "../utils/defer.js";
|
|
9
|
+
function S(r) {
|
|
10
10
|
const s = `[${r}]`;
|
|
11
11
|
return {
|
|
12
12
|
debug: (...n) => console.debug(s, ...n),
|
|
@@ -15,47 +15,53 @@ function A(r) {
|
|
|
15
15
|
error: (...n) => console.error(s, ...n)
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function A(r, s) {
|
|
19
19
|
const n = `component:${s}:`;
|
|
20
20
|
return {
|
|
21
21
|
get: (a, m) => r.load(n + a, m),
|
|
22
22
|
set: (a, m) => r.debouncedSave(n + a, m),
|
|
23
|
-
remove: (a) =>
|
|
23
|
+
remove: (a) => M(() => r.remove(n + a))
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
const r =
|
|
28
|
-
return (f,
|
|
29
|
-
protocol:
|
|
26
|
+
function D() {
|
|
27
|
+
const r = x(), s = v(), n = b(), a = R(), m = w();
|
|
28
|
+
return (f, p) => ({
|
|
29
|
+
protocol: p?.protocol,
|
|
30
30
|
theme: r,
|
|
31
31
|
layout: s,
|
|
32
32
|
commands: n,
|
|
33
33
|
notifications: a,
|
|
34
|
-
storage:
|
|
35
|
-
logger:
|
|
34
|
+
storage: A(m.persist, f),
|
|
35
|
+
logger: S(f)
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
const
|
|
38
|
+
const l = h({
|
|
39
39
|
name: "ComponentRegistry",
|
|
40
40
|
init: B
|
|
41
|
-
}),
|
|
41
|
+
}), G = l.Provider;
|
|
42
|
+
function H() {
|
|
43
|
+
return l.use();
|
|
44
|
+
}
|
|
42
45
|
function J() {
|
|
43
|
-
return
|
|
46
|
+
return l.useOptional();
|
|
47
|
+
}
|
|
48
|
+
function K() {
|
|
49
|
+
return l.has();
|
|
44
50
|
}
|
|
45
51
|
function B() {
|
|
46
|
-
const [r, s] =
|
|
52
|
+
const [r, s] = C(/* @__PURE__ */ new Map()), [n, a] = C(/* @__PURE__ */ new Set()), m = /* @__PURE__ */ new Map(), f = (t) => {
|
|
47
53
|
s((e) => new Map(e).set(t.id, t));
|
|
48
|
-
},
|
|
54
|
+
}, p = (t) => {
|
|
49
55
|
const e = t.map((o) => o.id).filter((o) => !!o);
|
|
50
56
|
return s((o) => {
|
|
51
57
|
const c = new Map(o);
|
|
52
58
|
return t.forEach((u) => c.set(u.id, u)), c;
|
|
53
59
|
}), () => {
|
|
54
60
|
e.forEach((o) => {
|
|
55
|
-
|
|
61
|
+
y(o);
|
|
56
62
|
});
|
|
57
63
|
};
|
|
58
|
-
},
|
|
64
|
+
}, g = async (t, e) => {
|
|
59
65
|
const o = r().get(t);
|
|
60
66
|
if (!o || n().has(t)) return;
|
|
61
67
|
const c = [];
|
|
@@ -79,7 +85,7 @@ function B() {
|
|
|
79
85
|
} catch (u) {
|
|
80
86
|
throw c.forEach((i) => i()), u;
|
|
81
87
|
}
|
|
82
|
-
},
|
|
88
|
+
}, d = async (t) => {
|
|
83
89
|
const e = r().get(t);
|
|
84
90
|
if (e && n().has(t))
|
|
85
91
|
try {
|
|
@@ -90,25 +96,25 @@ function B() {
|
|
|
90
96
|
return c.delete(t), c;
|
|
91
97
|
});
|
|
92
98
|
}
|
|
93
|
-
},
|
|
94
|
-
await
|
|
99
|
+
}, y = async (t) => {
|
|
100
|
+
await d(t), s((e) => {
|
|
95
101
|
const o = new Map(e);
|
|
96
102
|
return o.delete(t), o;
|
|
97
103
|
});
|
|
98
104
|
};
|
|
99
105
|
return {
|
|
100
106
|
register: f,
|
|
101
|
-
registerAll:
|
|
102
|
-
unregister:
|
|
103
|
-
mount:
|
|
104
|
-
unmount:
|
|
107
|
+
registerAll: p,
|
|
108
|
+
unregister: y,
|
|
109
|
+
mount: g,
|
|
110
|
+
unmount: d,
|
|
105
111
|
mountAll: async (t) => {
|
|
106
112
|
for (const e of r().keys())
|
|
107
|
-
await
|
|
113
|
+
await g(e, t(e));
|
|
108
114
|
},
|
|
109
115
|
unmountAll: async () => {
|
|
110
116
|
for (const t of n())
|
|
111
|
-
await
|
|
117
|
+
await d(t);
|
|
112
118
|
},
|
|
113
119
|
components: r,
|
|
114
120
|
mountedComponents: n,
|
|
@@ -137,8 +143,10 @@ function B() {
|
|
|
137
143
|
};
|
|
138
144
|
}
|
|
139
145
|
export {
|
|
140
|
-
|
|
146
|
+
G as ComponentRegistryProvider,
|
|
141
147
|
B as createComponentRegistry,
|
|
142
|
-
|
|
143
|
-
|
|
148
|
+
K as hasComponentRegistryContext,
|
|
149
|
+
D as useComponentContextFactory,
|
|
150
|
+
H as useComponentRegistry,
|
|
151
|
+
J as useOptionalComponentRegistry
|
|
144
152
|
};
|
|
@@ -156,6 +156,8 @@ export interface PersistApi {
|
|
|
156
156
|
* while keeping debounced persistence in the hot interaction path.
|
|
157
157
|
*/
|
|
158
158
|
flush?: () => void;
|
|
159
|
+
/** Cleanup pending timers (best-effort). */
|
|
160
|
+
dispose?: () => void;
|
|
159
161
|
}
|
|
160
162
|
export interface FloeConfigValue {
|
|
161
163
|
config: FloeConfig;
|
|
@@ -165,6 +167,13 @@ export type DeepPartial<T> = T extends (...args: never[]) => unknown ? T : T ext
|
|
|
165
167
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
166
168
|
} : T;
|
|
167
169
|
export declare const DEFAULT_FLOE_CONFIG: FloeConfig;
|
|
170
|
+
/**
|
|
171
|
+
* Install page lifecycle listeners that flush pending debounced saves.
|
|
172
|
+
*
|
|
173
|
+
* Keep this side-effect separate from createPersist() so importing the module does not
|
|
174
|
+
* register global listeners (important for testability and predictable composition).
|
|
175
|
+
*/
|
|
176
|
+
export declare function installPersistFlushListeners(persist: Pick<PersistApi, 'flush'>): () => void;
|
|
168
177
|
export interface FloeConfigProviderProps {
|
|
169
178
|
config?: DeepPartial<FloeConfig>;
|
|
170
179
|
children: JSX.Element;
|