@floegence/floe-webapp-core 0.60.0 → 0.60.2

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,154 +1,171 @@
1
- import { insert as V, createComponent as g, effect as C, className as P, setStyleProperty as B, template as R } from "solid-js/web";
2
- import { createMemo as m, createSignal as I, untrack as k, createEffect as b, For as F, createRenderEffect as N, onCleanup as j } from "solid-js";
3
- import { ViewActivationProvider as D } from "../../context/ViewActivationContext.js";
4
- import { cn as q } from "../../utils/cn.js";
5
- import { deferAfterPaint as G } from "../../utils/defer.js";
6
- var E = /* @__PURE__ */ R("<div>");
1
+ import { insert as P, createComponent as g, effect as B, className as E, setStyleProperty as K, template as R, memo as N, setAttribute as z } from "solid-js/web";
2
+ import { createMemo as S, createSignal as k, untrack as F, createEffect as x, For as j, createRenderEffect as D, onCleanup as G, Suspense as H } from "solid-js";
3
+ import { ViewActivationProvider as J } from "../../context/ViewActivationContext.js";
4
+ import { cn as V } from "../../utils/cn.js";
5
+ import { deferAfterPaint as L } from "../../utils/defer.js";
6
+ var O = /* @__PURE__ */ R("<div>");
7
7
  function M(e) {
8
8
  return String(e ?? "").trim();
9
9
  }
10
- function z(e) {
11
- const u = [], d = /* @__PURE__ */ new Set();
10
+ function C(e) {
11
+ const u = [], s = /* @__PURE__ */ new Set();
12
12
  for (const f of e) {
13
- const o = M(f?.id);
14
- o && (d.has(o) || (d.add(o), u.push(o)));
13
+ const a = M(f?.id);
14
+ a && (s.has(a) || (s.add(a), u.push(a)));
15
15
  }
16
16
  return u;
17
17
  }
18
- function H(e, u) {
19
- const d = new Set(e), f = /* @__PURE__ */ new Map();
20
- for (const o of u) {
21
- const a = M(o?.id);
22
- a && d.has(a) && (f.has(a) || f.set(a, o));
18
+ function Q(e, u) {
19
+ const s = new Set(e), f = /* @__PURE__ */ new Map();
20
+ for (const a of u) {
21
+ const d = M(a?.id);
22
+ d && s.has(d) && (f.has(d) || f.set(d, a));
23
23
  }
24
24
  return f;
25
25
  }
26
- function J(e) {
27
- const [u, d] = I(0), [f, o] = I(!1);
28
- let a = 0;
29
- N(() => {
30
- const s = e.active(), r = e.activationMode();
31
- a += 1;
32
- const w = a;
33
- if (!s) {
34
- o(!1);
26
+ function T(e) {
27
+ const [u, s] = k(0), [f, a] = k(!1);
28
+ let d = 0;
29
+ D(() => {
30
+ const c = e.active(), t = e.activationMode();
31
+ d += 1;
32
+ const h = d;
33
+ if (!c) {
34
+ a(!1);
35
35
  return;
36
36
  }
37
37
  const v = () => {
38
- w !== a || !e.active() || k(f) || (o(!0), d((S) => S + 1));
38
+ h !== d || !e.active() || F(f) || (a(!0), s((w) => w + 1));
39
39
  };
40
- r === "after-paint" ? G(v) : v();
41
- }), j(() => {
42
- a += 1;
40
+ t === "after-paint" ? L(v) : v();
41
+ }), G(() => {
42
+ d += 1;
43
43
  });
44
- const A = k(() => ({
44
+ const A = F(() => ({
45
45
  id: e.id,
46
+ visible: e.active,
46
47
  active: f,
47
48
  activationSeq: u
48
49
  }));
49
- return g(D, {
50
+ return g(J, {
50
51
  value: A,
51
52
  get children() {
52
- var s = E();
53
- return V(s, () => e.children), C((r) => {
54
- var w = e.class, v = e.active() ? "block" : "none";
55
- return w !== r.e && P(s, r.e = w), v !== r.t && B(s, "display", r.t = v), r;
53
+ var c = O();
54
+ return P(c, (() => {
55
+ var t = N(() => !!e.renderFallback);
56
+ return () => t() ? g(H, {
57
+ get fallback() {
58
+ return e.renderFallback(e.id);
59
+ },
60
+ get children() {
61
+ return e.children;
62
+ }
63
+ }) : e.children;
64
+ })()), B((t) => {
65
+ var h = e.class, v = e.id, w = e.active() ? void 0 : "true", b = !e.active(), y = e.active() ? "block" : "none";
66
+ return h !== t.e && E(c, t.e = h), v !== t.t && z(c, "data-floe-keep-alive-view", t.t = v), w !== t.a && z(c, "aria-hidden", t.a = w), b !== t.o && (c.inert = t.o = b), y !== t.i && K(c, "display", t.i = y), t;
56
67
  }, {
57
68
  e: void 0,
58
- t: void 0
59
- }), s;
69
+ t: void 0,
70
+ a: void 0,
71
+ o: void 0,
72
+ i: void 0
73
+ }), c;
60
74
  }
61
75
  });
62
76
  }
63
- function X(e) {
64
- const u = () => e.lazyMount !== !1, d = () => e.keepMounted !== !1, f = () => e.activationMode ?? "sync", o = m(() => z(e.views)), [a, A] = I(k(() => H(z(e.views), e.views))), s = m(() => M(e.activeId));
65
- b(() => {
66
- const t = o(), n = e.views;
67
- A((i) => {
68
- let c = !1;
69
- const l = new Map(i), x = new Set(t);
70
- for (const h of l.keys())
71
- x.has(h) || (l.delete(h), c = !0);
72
- for (const h of n) {
73
- const y = M(h?.id);
74
- y && x.has(y) && (l.has(y) || (l.set(y, h), c = !0));
77
+ function _(e) {
78
+ const u = () => e.lazyMount !== !1, s = () => e.keepMounted !== !1, f = () => e.activationMode ?? "sync", a = S(() => C(e.views)), [d, A] = k(F(() => Q(C(e.views), e.views))), c = S(() => M(e.activeId));
79
+ x(() => {
80
+ const n = a(), i = e.views;
81
+ A((r) => {
82
+ let o = !1;
83
+ const l = new Map(r), q = new Set(n);
84
+ for (const m of l.keys())
85
+ q.has(m) || (l.delete(m), o = !0);
86
+ for (const m of i) {
87
+ const I = M(m?.id);
88
+ I && q.has(I) && (l.has(I) || (l.set(I, m), o = !0));
75
89
  }
76
- return c ? l : i;
90
+ return o ? l : r;
77
91
  });
78
92
  });
79
- const r = m(() => ({
80
- order: o(),
81
- byId: a()
82
- })), w = () => {
83
- if (!d()) return /* @__PURE__ */ new Set();
84
- if (!u()) return new Set(r().order);
85
- const t = s();
86
- return t ? r().byId.has(t) ? /* @__PURE__ */ new Set([t]) : /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set();
87
- }, [v, S] = I(w());
88
- b(() => {
89
- if (!d()) return;
90
- const t = new Set(r().order);
91
- S((n) => {
92
- let i = !1;
93
- const c = /* @__PURE__ */ new Set();
94
- for (const l of n) {
95
- if (!t.has(l)) {
96
- i = !0;
93
+ const t = S(() => ({
94
+ order: a(),
95
+ byId: d()
96
+ })), h = () => {
97
+ if (!s()) return /* @__PURE__ */ new Set();
98
+ if (!u()) return new Set(t().order);
99
+ const n = c();
100
+ return n ? t().byId.has(n) ? /* @__PURE__ */ new Set([n]) : /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set();
101
+ }, [v, w] = k(h());
102
+ x(() => {
103
+ if (!s()) return;
104
+ const n = new Set(t().order);
105
+ w((i) => {
106
+ let r = !1;
107
+ const o = /* @__PURE__ */ new Set();
108
+ for (const l of i) {
109
+ if (!n.has(l)) {
110
+ r = !0;
97
111
  continue;
98
112
  }
99
- c.add(l);
113
+ o.add(l);
100
114
  }
101
- return i ? c : n;
115
+ return r ? o : i;
102
116
  });
103
- }), b(() => {
104
- if (!d() || !u()) return;
105
- const t = s();
106
- t && r().byId.has(t) && S((n) => {
107
- if (n.has(t)) return n;
108
- const i = new Set(n);
109
- return i.add(t), i;
117
+ }), x(() => {
118
+ if (!s() || !u()) return;
119
+ const n = c();
120
+ n && t().byId.has(n) && w((i) => {
121
+ if (i.has(n)) return i;
122
+ const r = new Set(i);
123
+ return r.add(n), r;
110
124
  });
111
125
  });
112
- const K = m(() => {
113
- const t = r().order, n = s();
114
- if (!d())
115
- return n ? r().byId.has(n) ? [n] : [] : [];
116
- if (!u()) return t;
117
- const i = v();
118
- return t.filter((c) => i.has(c) || c === n);
119
- }), O = m(() => {
120
- const t = s();
121
- return t ? r().byId.has(t) : !1;
126
+ const b = S(() => {
127
+ const n = t().order, i = c();
128
+ if (!s())
129
+ return i ? t().byId.has(i) ? [i] : [] : [];
130
+ if (!u()) return n;
131
+ const r = v();
132
+ return n.filter((o) => r.has(o) || o === i);
133
+ }), y = S(() => {
134
+ const n = c();
135
+ return n ? t().byId.has(n) : !1;
122
136
  });
123
137
  return (() => {
124
- var t = E();
125
- return V(t, g(F, {
138
+ var n = O();
139
+ return P(n, g(j, {
126
140
  get each() {
127
- return K();
141
+ return b();
128
142
  },
129
- children: (n) => {
130
- const i = () => a().get(n);
131
- return g(J, {
132
- id: n,
133
- active: () => s() === n,
143
+ children: (i) => {
144
+ const r = () => d().get(i);
145
+ return g(T, {
146
+ id: i,
147
+ active: () => c() === i,
134
148
  activationMode: f,
149
+ get renderFallback() {
150
+ return e.renderFallback;
151
+ },
135
152
  get class() {
136
- return q("absolute inset-0", i()?.class);
153
+ return V("absolute inset-0", r()?.class);
137
154
  },
138
155
  get children() {
139
- return i()?.render();
156
+ return r()?.render();
140
157
  }
141
158
  });
142
159
  }
143
- })), C((n) => {
144
- var i = q("relative h-full min-h-0 w-full", e.class), c = O() ? "block" : "none";
145
- return i !== n.e && P(t, n.e = i), c !== n.t && B(t, "display", n.t = c), n;
160
+ })), B((i) => {
161
+ var r = V("relative h-full min-h-0 w-full", e.class), o = y() ? "block" : "none";
162
+ return r !== i.e && E(n, i.e = r), o !== i.t && K(n, "display", i.t = o), i;
146
163
  }, {
147
164
  e: void 0,
148
165
  t: void 0
149
- }), t;
166
+ }), n;
150
167
  })();
151
168
  }
152
169
  export {
153
- X as KeepAliveStack
170
+ _ as KeepAliveStack
154
171
  };
@@ -2,7 +2,7 @@ import { type BasePickerProps } from './picker/PickerBase';
2
2
  export interface DirectoryPickerProps extends BasePickerProps {
3
3
  /** Ordered absolute navigation suggestions. They never grant filesystem access or auto-confirm. */
4
4
  suggestedPaths?: readonly string[];
5
- /** Localized heading for host-provided suggestions. */
5
+ /** Localized tab label for host-provided suggestions. */
6
6
  suggestedPathsLabel?: string;
7
7
  /** Receives the validated absolute directory path. */
8
8
  onSelect: (path: string) => void;
@@ -1,19 +1,18 @@
1
- import { createComponent as a, insert as i, setAttribute as o, effect as u, mergeProps as C, template as d, delegateEvents as w } from "solid-js/web";
2
- import { createMemo as $, Show as _, For as S } from "solid-js";
3
- import { cn as y } from "../../utils/cn.js";
4
- import { FolderOpen as p } from "../icons/index.js";
5
- import { Button as v } from "./Button.js";
6
- import { Dialog as O } from "./Dialog.js";
7
- import { usePickerNavigation as B, pickerCopy as b, PickerPanel as D } from "./picker/PickerBase.js";
8
- import { parsePickerPath as z } from "./picker/PickerNavigation.js";
9
- var F = /* @__PURE__ */ d('<section data-picker-suggestions class="mb-3 min-w-0"><p class="mb-1 px-2 text-[11px] font-medium text-muted-foreground">'), L = /* @__PURE__ */ d('<div class="flex w-full items-center gap-2"><span class="min-w-0 flex-1 truncate text-[11px] text-muted-foreground">'), T = /* @__PURE__ */ d('<button type=button class="flex min-h-10 w-full cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent/60 focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"><span class="flex min-w-0 flex-1 flex-col"><span class="truncate text-xs font-medium"></span><span class="truncate text-[11px] text-muted-foreground">');
10
- function I(e) {
11
- const r = B(e, () => e.open), g = $(() => [...new Set((e.suggestedPaths ?? []).map((t) => z(t)).filter(Boolean))]), P = () => {
12
- if (!r.valid()) return;
13
- const t = r.currentPath();
1
+ import { createComponent as r, mergeProps as m, insert as a, effect as f, setAttribute as d, template as h } from "solid-js/web";
2
+ import { createMemo as P, createSignal as b } from "solid-js";
3
+ import { cn as v } from "../../utils/cn.js";
4
+ import { Button as o } from "./Button.js";
5
+ import { Dialog as C } from "./Dialog.js";
6
+ import { usePickerNavigation as x, PickerPanel as S, pickerCopy as k } from "./picker/PickerBase.js";
7
+ import { parsePickerPath as w } from "./picker/PickerNavigation.js";
8
+ var y = /* @__PURE__ */ h('<div class="flex w-full items-center gap-2"><span class="min-w-0 flex-1 truncate text-[11px] text-muted-foreground">');
9
+ function T(e) {
10
+ const l = P(() => [...new Set((e.suggestedPaths ?? []).map((t) => w(t)).filter(Boolean))]), [g, s] = b(!0), i = () => l().length > 0 && g(), n = x(e, () => e.open, void 0, () => s(!0)), u = () => {
11
+ if (e.disabled || i() || !n.valid()) return;
12
+ const t = n.currentPath();
14
13
  e.onSelect(t), e.onOpenChange(!1);
15
14
  };
16
- return a(O, {
15
+ return r(C, {
17
16
  get open() {
18
17
  return e.open;
19
18
  },
@@ -24,65 +23,50 @@ function I(e) {
24
23
  return e.title ?? "Select Directory";
25
24
  },
26
25
  get class() {
27
- return y("max-w-lg", e.class);
26
+ return v("max-w-lg", e.class);
28
27
  },
29
28
  get footer() {
30
29
  return (() => {
31
- var t = L(), s = t.firstChild;
32
- return i(s, () => r.currentPath()), i(t, a(v, {
30
+ var t = y(), c = t.firstChild;
31
+ return a(c, () => n.currentPath()), a(t, r(o, {
33
32
  variant: "ghost",
34
33
  size: "sm",
35
34
  onClick: () => e.onOpenChange(!1),
36
35
  get children() {
37
- return e.cancelText ?? b(e).cancel;
36
+ return e.cancelText ?? k(e).cancel;
38
37
  }
39
- }), null), i(t, a(v, {
38
+ }), null), a(t, r(o, {
40
39
  variant: "primary",
41
40
  size: "sm",
42
- onClick: P,
41
+ onClick: u,
43
42
  get disabled() {
44
- return !r.valid();
43
+ return e.disabled || i() || !n.valid();
45
44
  },
46
45
  get children() {
47
46
  return e.confirmText ?? "Select";
48
47
  }
49
- }), null), u(() => o(s, "title", r.currentPath())), t;
48
+ }), null), f(() => d(c, "title", n.currentPath())), t;
50
49
  })();
51
50
  },
52
51
  get children() {
53
- return [a(_, {
54
- get when() {
55
- return g().length > 0;
56
- },
57
- get children() {
58
- var t = F(), s = t.firstChild;
59
- return i(s, () => e.suggestedPathsLabel ?? "Suggested directories"), i(t, a(S, {
60
- get each() {
61
- return g();
62
- },
63
- children: (l) => (() => {
64
- var n = T(), m = n.firstChild, f = m.firstChild, k = f.nextSibling;
65
- return n.$$click = () => {
66
- r.navigate(l);
67
- }, o(n, "data-picker-suggested-path", l), o(n, "title", l), o(n, "aria-label", l), i(n, a(p, {
68
- class: "h-4 w-4 shrink-0 text-muted-foreground"
69
- }), m), i(f, () => l.split("/").filter(Boolean).at(-1) ?? b(e).root), i(k, l), u((c) => {
70
- var h = r.currentPath() === l ? "location" : void 0, x = e.disabled || !r.context();
71
- return h !== c.e && o(n, "aria-current", c.e = h), x !== c.t && (n.disabled = c.t = x), c;
72
- }, {
73
- e: void 0,
74
- t: void 0
75
- }), n;
76
- })()
77
- }), null), u(() => o(t, "aria-label", e.suggestedPathsLabel ?? "Suggested directories")), t;
52
+ return r(S, m(e, {
53
+ source: n,
54
+ suggestions: {
55
+ get paths() {
56
+ return l();
57
+ },
58
+ get label() {
59
+ return e.suggestedPathsLabel ?? "Suggested directories";
60
+ },
61
+ get visible() {
62
+ return i();
63
+ },
64
+ onVisibilityChange: s
78
65
  }
79
- }), a(D, C(e, {
80
- source: r
81
- }))];
66
+ }));
82
67
  }
83
68
  });
84
69
  }
85
- w(["click"]);
86
70
  export {
87
- I as DirectoryPicker
71
+ T as DirectoryPicker
88
72
  };
@@ -62,6 +62,12 @@ export declare function usePickerNavigation(props: PickerDataProps, open: Access
62
62
  /** Absolute directory navigation shared by all picker presentations. */
63
63
  export declare function PickerPanel(props: PickerPanelProps & {
64
64
  source: FilesystemPickerDataSource;
65
+ suggestions?: {
66
+ paths: readonly string[];
67
+ label: string;
68
+ visible: boolean;
69
+ onVisibilityChange: (visible: boolean) => void;
70
+ };
65
71
  }): JSX.Element;
66
72
  export declare const normalizePath: typeof parsePickerPath;
67
73
  export { pickerParentPath as getParentPath } from './PickerNavigation';