@floegence/floe-webapp-core 0.1.2 → 0.1.7

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 (88) hide show
  1. package/dist/components/file-browser/Breadcrumb.d.ts +7 -0
  2. package/dist/components/file-browser/DirectoryTree.d.ts +7 -0
  3. package/dist/components/file-browser/FileBrowser.d.ts +35 -0
  4. package/dist/components/file-browser/FileBrowserContext.d.ts +18 -0
  5. package/dist/components/file-browser/FileBrowserToolbar.d.ts +8 -0
  6. package/dist/components/file-browser/FileContextMenu.d.ts +15 -0
  7. package/dist/components/file-browser/FileGridView.d.ts +7 -0
  8. package/dist/components/file-browser/FileIcons.d.ts +14 -0
  9. package/dist/components/file-browser/FileListView.d.ts +7 -0
  10. package/dist/components/file-browser/index.d.ts +10 -0
  11. package/dist/components/file-browser/types.d.ts +104 -0
  12. package/dist/components/index.d.ts +1 -0
  13. package/dist/components/layout/Sidebar.d.ts +18 -0
  14. package/dist/components/layout/index.d.ts +1 -1
  15. package/dist/components/layout/mobileTabs.d.ts +30 -0
  16. package/dist/context/ComponentRegistry.d.ts +3 -2
  17. package/dist/index.js +249 -220
  18. package/dist/index10.js +2 -2
  19. package/dist/index11.js +4 -4
  20. package/dist/index12.js +2 -2
  21. package/dist/index13.js +4 -4
  22. package/dist/index14.js +4 -4
  23. package/dist/index15.js +4 -4
  24. package/dist/index16.js +3 -3
  25. package/dist/index17.js +5 -5
  26. package/dist/index18.js +2 -2
  27. package/dist/index19.js +1 -1
  28. package/dist/index2.js +89 -70
  29. package/dist/index20.js +1 -1
  30. package/dist/index21.js +3 -3
  31. package/dist/index22.js +2 -2
  32. package/dist/index23.js +2 -2
  33. package/dist/index24.js +1 -1
  34. package/dist/index25.js +4 -4
  35. package/dist/index26.js +1 -1
  36. package/dist/index27.js +1 -1
  37. package/dist/index28.js +1 -1
  38. package/dist/index29.js +1 -1
  39. package/dist/index3.js +1 -1
  40. package/dist/index36.js +138 -42
  41. package/dist/index37.js +102 -32
  42. package/dist/index38.js +90 -23
  43. package/dist/index39.js +107 -170
  44. package/dist/index4.js +48 -34
  45. package/dist/index40.js +86 -40
  46. package/dist/index41.js +176 -64
  47. package/dist/index42.js +64 -94
  48. package/dist/index43.js +64 -110
  49. package/dist/index44.js +39 -138
  50. package/dist/index45.js +44 -35
  51. package/dist/index46.js +34 -379
  52. package/dist/index47.js +25 -13
  53. package/dist/index48.js +173 -10
  54. package/dist/index49.js +40 -16
  55. package/dist/index5.js +3 -3
  56. package/dist/index50.js +65 -9
  57. package/dist/index51.js +96 -8
  58. package/dist/index52.js +113 -52
  59. package/dist/index53.js +138 -5
  60. package/dist/index54.js +39 -3
  61. package/dist/index55.js +382 -44
  62. package/dist/index56.js +13 -26
  63. package/dist/index57.js +10 -32
  64. package/dist/index58.js +17 -92
  65. package/dist/index59.js +10 -22
  66. package/dist/index6.js +2 -2
  67. package/dist/index60.js +8 -46
  68. package/dist/index61.js +56 -14
  69. package/dist/index62.js +5 -35
  70. package/dist/index63.js +3 -64
  71. package/dist/index64.js +45 -84
  72. package/dist/index65.js +25 -13
  73. package/dist/index66.js +27 -2258
  74. package/dist/index67.js +94 -0
  75. package/dist/index68.js +25 -0
  76. package/dist/index69.js +49 -0
  77. package/dist/index7.js +1 -1
  78. package/dist/index70.js +17 -0
  79. package/dist/index71.js +38 -0
  80. package/dist/index72.js +67 -0
  81. package/dist/index73.js +87 -0
  82. package/dist/index74.js +17 -0
  83. package/dist/index75.js +2266 -0
  84. package/dist/index76.js +10 -0
  85. package/dist/index8.js +2 -2
  86. package/dist/index9.js +1 -1
  87. package/dist/styles.css +1 -1
  88. package/package.json +1 -1
package/dist/index5.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { delegateEvents as $, template as i, insert as t, createComponent as a, effect as k, className as g } from "solid-js/web";
2
2
  import { Show as h } from "solid-js";
3
- import { cn as x } from "./index53.js";
4
- import { useCommand as y } from "./index42.js";
3
+ import { cn as x } from "./index62.js";
4
+ import { useCommand as y } from "./index51.js";
5
5
  import { Search as _ } from "./index30.js";
6
- import { useResolvedFloeConfig as w } from "./index39.js";
6
+ import { useResolvedFloeConfig as w } from "./index48.js";
7
7
  var C = /* @__PURE__ */ i('<span class="font-medium text-xs hidden sm:inline">'), S = /* @__PURE__ */ i('<kbd class="hidden md:inline text-[10px] px-1 py-0.5 rounded bg-background/80 border border-border/50 font-mono shrink-0">'), B = /* @__PURE__ */ i('<header><div class="h-10 flex items-center gap-3 px-3"><div class="flex items-center gap-2 flex-shrink-0"></div><button type=button><span class="flex-1 text-left hidden sm:inline truncate"></span></button><div class="flex items-center gap-1">'), E = /* @__PURE__ */ i('<div class="w-6 h-6 rounded bg-primary flex items-center justify-center text-primary-foreground text-xs font-bold">F');
8
8
  function R(n) {
9
9
  const c = y(), l = w(), o = () => l.config.commands.palette.enabled;
package/dist/index50.js CHANGED
@@ -1,13 +1,69 @@
1
- import { onMount as d, onCleanup as i } from "solid-js";
2
- import { matchKeybind as r } from "./index56.js";
3
- function a(o, t) {
4
- d(() => {
5
- const n = (e) => {
6
- r(e, o) && (e.preventDefault(), t());
1
+ import { createEffect as f } from "solid-js";
2
+ import { createStore as u, produce as d } from "solid-js/store";
3
+ import { createSimpleContext as g } from "./index47.js";
4
+ import { useResolvedFloeConfig as v } from "./index48.js";
5
+ const {
6
+ Provider: x,
7
+ use: C
8
+ } = g({
9
+ name: "Layout",
10
+ init: M
11
+ });
12
+ function M() {
13
+ var s, n, m, b, c;
14
+ const o = v(), a = () => o.config.layout, p = () => typeof window > "u" ? !1 : window.matchMedia(a().mobileQuery).matches, l = o.persist.load(a().storageKey, {}), h = {
15
+ sidebar: {
16
+ width: ((s = l.sidebar) == null ? void 0 : s.width) ?? a().sidebar.defaultWidth,
17
+ activeTab: ((n = l.sidebar) == null ? void 0 : n.activeTab) ?? a().sidebar.defaultActiveTab,
18
+ collapsed: ((m = l.sidebar) == null ? void 0 : m.collapsed) ?? a().sidebar.defaultCollapsed
19
+ },
20
+ terminal: {
21
+ opened: ((b = l.terminal) == null ? void 0 : b.opened) ?? a().terminal.defaultOpened,
22
+ height: ((c = l.terminal) == null ? void 0 : c.height) ?? a().terminal.defaultHeight
23
+ },
24
+ isMobile: p()
25
+ }, [i, r] = u(h);
26
+ return f(() => {
27
+ const e = {
28
+ sidebar: i.sidebar,
29
+ terminal: i.terminal
7
30
  };
8
- window.addEventListener("keydown", n), i(() => window.removeEventListener("keydown", n));
9
- });
31
+ o.persist.debouncedSave(a().storageKey, e);
32
+ }), {
33
+ // Sidebar accessors
34
+ sidebarWidth: () => i.sidebar.width,
35
+ sidebarActiveTab: () => i.sidebar.activeTab,
36
+ sidebarCollapsed: () => i.sidebar.collapsed,
37
+ // Sidebar actions
38
+ setSidebarWidth: (e) => r(d((t) => {
39
+ t.sidebar.width = Math.max(a().sidebar.clamp.min, Math.min(a().sidebar.clamp.max, e));
40
+ })),
41
+ setSidebarActiveTab: (e) => r(d((t) => {
42
+ t.sidebar.activeTab = e, t.sidebar.collapsed = !1;
43
+ })),
44
+ setSidebarCollapsed: (e) => r(d((t) => {
45
+ t.sidebar.collapsed = e;
46
+ })),
47
+ toggleSidebarCollapse: () => r(d((e) => {
48
+ e.sidebar.collapsed = !e.sidebar.collapsed;
49
+ })),
50
+ // Terminal accessors
51
+ terminalOpened: () => i.terminal.opened,
52
+ terminalHeight: () => i.terminal.height,
53
+ // Terminal actions
54
+ toggleTerminal: () => r(d((e) => {
55
+ e.terminal.opened = !e.terminal.opened;
56
+ })),
57
+ setTerminalHeight: (e) => r(d((t) => {
58
+ t.terminal.height = Math.max(a().terminal.clamp.min, Math.min(a().terminal.clamp.max, e));
59
+ })),
60
+ // Mobile
61
+ isMobile: () => i.isMobile,
62
+ setIsMobile: (e) => r("isMobile", e)
63
+ };
10
64
  }
11
65
  export {
12
- a as useKeybind
66
+ x as LayoutProvider,
67
+ M as createLayoutService,
68
+ C as useLayout
13
69
  };
package/dist/index51.js CHANGED
@@ -1,11 +1,99 @@
1
- import { createSignal as n, createEffect as a } from "solid-js";
2
- import { useResolvedFloeConfig as c } from "./index39.js";
3
- function u(e, s) {
4
- const t = c(), r = t.persist.load(e, s), [o, i] = n(r);
5
- return a(() => {
6
- t.persist.debouncedSave(e, o());
7
- }), [o, i];
1
+ import { createSignal as p, onCleanup as K } from "solid-js";
2
+ import { createSimpleContext as D } from "./index47.js";
3
+ import { useResolvedFloeConfig as W } from "./index48.js";
4
+ import { formatKeybind as P, parseKeybind as k, matchKeybind as y } from "./index65.js";
5
+ import { deferNonBlocking as v } from "./index63.js";
6
+ function S() {
7
+ const x = W(), u = () => x.config.commands, i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), [g, l] = p(!1), [b, m] = p(""), [C, E] = p([]), d = () => {
8
+ E(Array.from(i.values()));
9
+ };
10
+ if (typeof window < "u" && u().enableGlobalKeybinds) {
11
+ const e = (n) => {
12
+ if (!n || !(n instanceof HTMLElement)) return !1;
13
+ const r = n.tagName.toLowerCase();
14
+ return !!(r === "input" || r === "textarea" || r === "select" || n.isContentEditable || n.getAttribute("role") === "textbox");
15
+ }, t = (n) => {
16
+ const r = u();
17
+ if (!r.ignoreWhenTyping) return !1;
18
+ const o = n.target ?? (typeof document < "u" ? document.activeElement : null);
19
+ return !(!e(o) || r.allowWhenTypingWithin && o instanceof Element && o.closest(r.allowWhenTypingWithin));
20
+ }, s = (n) => {
21
+ const r = u();
22
+ if (r.save.enabled && y(n, r.save.keybind)) {
23
+ const o = i.get(r.save.commandId);
24
+ o ? (n.preventDefault(), v(() => {
25
+ Promise.resolve(o.execute()).catch((c) => console.error(c));
26
+ })) : r.save.preventDefaultWhenNoHandler && n.preventDefault();
27
+ return;
28
+ }
29
+ if (!t(n)) {
30
+ if (r.palette.enabled && y(n, r.palette.keybind)) {
31
+ n.preventDefault(), l((o) => !o);
32
+ return;
33
+ }
34
+ if (!g())
35
+ for (const o of i.values()) {
36
+ if (!o.keybind) continue;
37
+ const c = a.get(o.id);
38
+ if (c && y(n, c)) {
39
+ n.preventDefault(), v(() => {
40
+ Promise.resolve(o.execute()).catch((L) => console.error(L));
41
+ });
42
+ return;
43
+ }
44
+ }
45
+ }
46
+ };
47
+ window.addEventListener("keydown", s), K(() => window.removeEventListener("keydown", s));
48
+ }
49
+ let w = "", h = null, f = [];
50
+ return {
51
+ // State
52
+ isOpen: g,
53
+ search: b,
54
+ commands: C,
55
+ filteredCommands: () => {
56
+ const e = C(), t = b().toLowerCase().trim();
57
+ return e === h && t === w ? f : (h = e, w = t, t ? (f = e.filter((s) => {
58
+ var n, r;
59
+ return s.title.toLowerCase().includes(t) || ((n = s.description) == null ? void 0 : n.toLowerCase().includes(t)) || ((r = s.category) == null ? void 0 : r.toLowerCase().includes(t));
60
+ }), f) : (f = e, e));
61
+ },
62
+ // Actions
63
+ open: () => l(!0),
64
+ close: () => {
65
+ l(!1), m("");
66
+ },
67
+ toggle: () => l((e) => !e),
68
+ setSearch: (e) => m(e),
69
+ register: (e) => (i.set(e.id, e), e.keybind && a.set(e.id, k(e.keybind)), d(), () => {
70
+ i.delete(e.id), a.delete(e.id), d();
71
+ }),
72
+ registerAll: (e) => (e.forEach((t) => {
73
+ i.set(t.id, t), t.keybind && a.set(t.id, k(t.keybind));
74
+ }), d(), () => {
75
+ e.forEach((t) => {
76
+ i.delete(t.id), a.delete(t.id);
77
+ }), d();
78
+ }),
79
+ execute: (e) => {
80
+ const t = i.get(e);
81
+ t && (l(!1), m(""), v(() => {
82
+ Promise.resolve(t.execute()).catch((s) => console.error(s));
83
+ }));
84
+ },
85
+ getKeybindDisplay: P
86
+ };
8
87
  }
88
+ const {
89
+ Provider: N,
90
+ use: O
91
+ } = D({
92
+ name: "Command",
93
+ init: S
94
+ });
9
95
  export {
10
- u as usePersisted
96
+ N as CommandProvider,
97
+ S as createCommandService,
98
+ O as useCommand
11
99
  };
package/dist/index52.js CHANGED
@@ -1,59 +1,120 @@
1
- import { createEffect as M, onCleanup as q } from "solid-js";
2
- import { useDeck as x } from "./index46.js";
3
- import { applyDragDelta as H } from "./index60.js";
4
- import { DECK_GRID_CONFIG as R } from "./index10.js";
5
- import { lockBodyStyle as S } from "./index57.js";
1
+ import { delegateEvents as g, template as m, insert as l, createComponent as f, effect as h, className as b } from "solid-js/web";
2
+ import { For as p, Show as u } from "solid-js";
3
+ import { createStore as v, produce as d } from "solid-js/store";
4
+ import { createSimpleContext as x } from "./index47.js";
5
+ import { cn as $ } from "./index62.js";
6
+ var w = /* @__PURE__ */ m('<div class="fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-sm">'), _ = /* @__PURE__ */ m('<p class="mt-1 text-sm text-muted-foreground">'), y = /* @__PURE__ */ m('<button type=button class="mt-2 text-sm font-medium text-primary hover:underline">'), k = /* @__PURE__ */ m('<div role=alert><div class="flex items-start gap-3"><div class="flex-1 min-w-0"><p class="font-medium text-sm"></p></div><button type=button class="text-muted-foreground hover:text-foreground transition-colors"aria-label=Dismiss><svg class="w-4 h-4"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12">');
7
+ const C = 5e3;
6
8
  function N() {
7
- const l = x();
8
- let r = null, d = 0, s = 0, m = 0, f = 0, o = null, u = null, a = null, e = null;
9
- const h = (t) => {
10
- if (!t) {
11
- e == null || e(), e = null;
12
- return;
13
- }
14
- e == null || e(), e = S({ cursor: "grabbing", "user-select": "none" });
15
- }, E = () => {
16
- r !== null && (o !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(o), o = null), r = null, u = null, a = null, h(!1), l.endDrag(!0));
17
- }, w = (t) => {
18
- const c = t.target;
19
- if (c.closest('button, input, select, textarea, [role="button"], a')) return;
20
- const i = c.closest("[data-widget-drag-handle]");
21
- if (!i || t.pointerType === "mouse" && t.button !== 0) return;
22
- const n = i.dataset.widgetDragHandle;
23
- n && (t.preventDefault(), t.stopPropagation(), r = t.pointerId, d = t.clientX, s = t.clientY, m = d, f = s, u = n, a = i, h(!0), l.startDrag(n, d, s), i.setPointerCapture(t.pointerId));
24
- }, I = (t) => {
25
- if (!(r !== t.pointerId || !u) && (m = t.clientX, f = t.clientY, o === null)) {
26
- if (typeof requestAnimationFrame > "u") {
27
- P();
28
- return;
29
- }
30
- o = requestAnimationFrame(() => {
31
- o = null, r !== null && P();
9
+ const [e, c] = v({
10
+ notifications: []
11
+ }), o = /* @__PURE__ */ new Map(), a = (t) => {
12
+ const i = o.get(t);
13
+ i && (clearTimeout(i), o.delete(t)), c(d((n) => {
14
+ n.notifications = n.notifications.filter((s) => s.id !== t);
15
+ }));
16
+ }, r = (t) => {
17
+ const i = `notification-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, n = t.duration ?? C;
18
+ if (c(d((s) => {
19
+ s.notifications.push({
20
+ ...t,
21
+ id: i
32
22
  });
23
+ })), n > 0) {
24
+ const s = setTimeout(() => a(i), n);
25
+ o.set(i, s);
33
26
  }
34
- }, P = () => {
35
- if (!u) return;
36
- const t = m - d, c = f - s, g = document.querySelector(".deck-grid");
37
- if (!g) return;
38
- const i = g.getBoundingClientRect(), { cols: n, rowHeight: L, gap: v } = R, C = v * (n - 1), b = (i.width - C - v * 2) / n, F = L + v, X = Math.round(t / b), Y = Math.round(c / F), D = l.activeLayout(), y = D == null ? void 0 : D.widgets.find((G) => G.id === u);
39
- if (!y) return;
40
- const A = H(y.position, X, Y, n);
41
- l.updateDrag(A, { x: t, y: c });
42
- }, p = (t) => {
43
- if (r === t.pointerId) {
44
- try {
45
- a == null || a.releasePointerCapture(t.pointerId);
46
- } catch {
47
- }
48
- E();
49
- }
27
+ return i;
28
+ };
29
+ return {
30
+ notifications: () => e.notifications,
31
+ show: r,
32
+ dismiss: a,
33
+ dismissAll: () => {
34
+ o.forEach((t) => clearTimeout(t)), o.clear(), c("notifications", []);
35
+ },
36
+ info: (t, i) => r({
37
+ type: "info",
38
+ title: t,
39
+ message: i
40
+ }),
41
+ success: (t, i) => r({
42
+ type: "success",
43
+ title: t,
44
+ message: i
45
+ }),
46
+ warning: (t, i) => r({
47
+ type: "warning",
48
+ title: t,
49
+ message: i
50
+ }),
51
+ error: (t, i) => r({
52
+ type: "error",
53
+ title: t,
54
+ message: i
55
+ })
50
56
  };
51
- M(() => {
52
- l.editMode() && (typeof document > "u" || (document.addEventListener("pointerdown", w, !0), document.addEventListener("pointermove", I, !0), document.addEventListener("pointerup", p, !0), document.addEventListener("pointercancel", p, !0), q(() => {
53
- E(), document.removeEventListener("pointerdown", w, !0), document.removeEventListener("pointermove", I, !0), document.removeEventListener("pointerup", p, !0), document.removeEventListener("pointercancel", p, !0);
54
- })));
55
- });
56
57
  }
58
+ const {
59
+ Provider: L,
60
+ use: S
61
+ } = x({
62
+ name: "Notification",
63
+ init: N
64
+ });
65
+ function P() {
66
+ const {
67
+ notifications: e,
68
+ dismiss: c
69
+ } = S();
70
+ return (() => {
71
+ var o = w();
72
+ return l(o, f(p, {
73
+ get each() {
74
+ return e();
75
+ },
76
+ children: (a) => f(D, {
77
+ notification: a,
78
+ onDismiss: () => c(a.id)
79
+ })
80
+ })), o;
81
+ })();
82
+ }
83
+ function D(e) {
84
+ const c = {
85
+ info: "border-info/50 bg-info/10",
86
+ success: "border-success/50 bg-success/10",
87
+ warning: "border-warning/50 bg-warning/10",
88
+ error: "border-error/50 bg-error/10"
89
+ };
90
+ return (() => {
91
+ var o = k(), a = o.firstChild, r = a.firstChild, t = r.firstChild, i = r.nextSibling;
92
+ return l(t, () => e.notification.title), l(r, f(u, {
93
+ get when() {
94
+ return e.notification.message;
95
+ },
96
+ get children() {
97
+ var n = _();
98
+ return l(n, () => e.notification.message), n;
99
+ }
100
+ }), null), l(r, f(u, {
101
+ get when() {
102
+ return e.notification.action;
103
+ },
104
+ get children() {
105
+ var n = y();
106
+ return n.$$click = () => {
107
+ var s;
108
+ return (s = e.notification.action) == null ? void 0 : s.onClick();
109
+ }, l(n, () => e.notification.action.label), n;
110
+ }
111
+ }), null), i.$$click = () => e.onDismiss(), h(() => b(o, $("animate-in slide-in-from-right fade-in", "rounded-lg border p-4 shadow-lg backdrop-blur-sm", "bg-card text-card-foreground", c[e.notification.type]))), o;
112
+ })();
113
+ }
114
+ g(["click"]);
57
115
  export {
58
- N as useDeckDrag
116
+ P as NotificationContainer,
117
+ L as NotificationProvider,
118
+ N as createNotificationService,
119
+ S as useNotification
59
120
  };
package/dist/index53.js CHANGED
@@ -1,8 +1,141 @@
1
- import { clsx as o } from "./index65.js";
2
- import { twMerge as t } from "./index66.js";
3
- function n(...r) {
4
- return t(o(r));
1
+ import { createSignal as C } from "solid-js";
2
+ import { createSimpleContext as w } from "./index47.js";
3
+ import { useResolvedFloeConfig as b } from "./index48.js";
4
+ import { useTheme as v } from "./index49.js";
5
+ import { useLayout as M } from "./index50.js";
6
+ import { useCommand as S } from "./index51.js";
7
+ import { useNotification as x } from "./index52.js";
8
+ import { deferNonBlocking as A } from "./index63.js";
9
+ function R(s) {
10
+ const r = `[${s}]`;
11
+ return {
12
+ debug: (...o) => console.debug(r, ...o),
13
+ info: (...o) => console.info(r, ...o),
14
+ warn: (...o) => console.warn(r, ...o),
15
+ error: (...o) => console.error(r, ...o)
16
+ };
17
+ }
18
+ function B(s, r) {
19
+ const o = `component:${r}:`;
20
+ return {
21
+ get: (a, u) => s.load(o + a, u),
22
+ set: (a, u) => s.debouncedSave(o + a, u),
23
+ remove: (a) => A(() => s.remove(o + a))
24
+ };
25
+ }
26
+ function J() {
27
+ const s = v(), r = M(), o = S(), a = x(), u = b();
28
+ return (g, f) => ({
29
+ protocol: f == null ? void 0 : f.protocol,
30
+ theme: s,
31
+ layout: r,
32
+ commands: o,
33
+ notifications: a,
34
+ storage: B(u.persist, g),
35
+ logger: R(g)
36
+ });
37
+ }
38
+ const h = w({
39
+ name: "ComponentRegistry",
40
+ init: k
41
+ }), K = h.Provider;
42
+ function O() {
43
+ return h.use();
44
+ }
45
+ function k() {
46
+ const [s, r] = C(/* @__PURE__ */ new Map()), [o, a] = C(/* @__PURE__ */ new Set()), u = /* @__PURE__ */ new Map(), g = (t) => {
47
+ r((e) => new Map(e).set(t.id, t));
48
+ }, f = (t) => {
49
+ r((e) => {
50
+ const n = new Map(e);
51
+ return t.forEach((c) => n.set(c.id, c)), n;
52
+ });
53
+ }, y = async (t, e) => {
54
+ var p, l;
55
+ const n = s().get(t);
56
+ if (!n || o().has(t)) return;
57
+ const c = [];
58
+ try {
59
+ if ((p = n.commands) != null && p.length) {
60
+ const m = n.commands.map((i) => ({
61
+ id: i.id,
62
+ title: i.title,
63
+ description: i.description,
64
+ icon: i.icon,
65
+ keybind: i.keybind,
66
+ category: i.category,
67
+ execute: () => i.execute(e)
68
+ }));
69
+ c.push(e.commands.registerAll(m));
70
+ }
71
+ await ((l = n.onMount) == null ? void 0 : l.call(n, e)), c.length && u.set(t, () => c.forEach((m) => m())), a((m) => {
72
+ const i = new Set(m);
73
+ return i.add(t), i;
74
+ });
75
+ } catch (m) {
76
+ throw c.forEach((i) => i()), m;
77
+ }
78
+ }, d = async (t) => {
79
+ var n, c;
80
+ const e = s().get(t);
81
+ if (e && o().has(t))
82
+ try {
83
+ await ((n = e.onUnmount) == null ? void 0 : n.call(e));
84
+ } finally {
85
+ (c = u.get(t)) == null || c(), u.delete(t), a((p) => {
86
+ const l = new Set(p);
87
+ return l.delete(t), l;
88
+ });
89
+ }
90
+ };
91
+ return {
92
+ register: g,
93
+ registerAll: f,
94
+ unregister: async (t) => {
95
+ await d(t), r((e) => {
96
+ const n = new Map(e);
97
+ return n.delete(t), n;
98
+ });
99
+ },
100
+ mount: y,
101
+ unmount: d,
102
+ mountAll: async (t) => {
103
+ for (const e of s().keys())
104
+ await y(e, t(e));
105
+ },
106
+ unmountAll: async () => {
107
+ for (const t of o())
108
+ await d(t);
109
+ },
110
+ components: s,
111
+ mountedComponents: o,
112
+ sidebarItems: () => {
113
+ const t = [];
114
+ for (const e of s().values())
115
+ e.sidebar && t.push({
116
+ ...e,
117
+ order: e.sidebar.order ?? 100
118
+ });
119
+ return t.sort((e, n) => e.order - n.order);
120
+ },
121
+ allCommands: () => {
122
+ const t = [];
123
+ for (const e of s().values())
124
+ e.commands && t.push(...e.commands);
125
+ return t;
126
+ },
127
+ statusBarItems: () => {
128
+ const t = [];
129
+ for (const e of s().values())
130
+ e.statusBar && t.push(...e.statusBar);
131
+ return t;
132
+ },
133
+ getComponent: (t) => s().get(t)
134
+ };
5
135
  }
6
136
  export {
7
- n as cn
137
+ K as ComponentRegistryProvider,
138
+ k as createComponentRegistry,
139
+ J as useComponentContextFactory,
140
+ O as useComponentRegistry
8
141
  };
package/dist/index54.js CHANGED
@@ -1,6 +1,42 @@
1
- function n(e, o = 0) {
2
- setTimeout(e, o);
1
+ import { createSignal as n } from "solid-js";
2
+ import { createSimpleContext as o } from "./index47.js";
3
+ const {
4
+ Provider: f,
5
+ use: m
6
+ } = o({
7
+ name: "WidgetRegistry",
8
+ init: c
9
+ });
10
+ function c() {
11
+ const [s, i] = n(/* @__PURE__ */ new Map());
12
+ return {
13
+ register: (e) => {
14
+ i((t) => new Map(t).set(e.type, e));
15
+ },
16
+ registerAll: (e) => {
17
+ i((t) => {
18
+ const r = new Map(t);
19
+ return e.forEach((g) => r.set(g.type, g)), r;
20
+ });
21
+ },
22
+ unregister: (e) => {
23
+ i((t) => {
24
+ const r = new Map(t);
25
+ return r.delete(e), r;
26
+ });
27
+ },
28
+ widgets: s,
29
+ getWidget: (e) => s().get(e),
30
+ getWidgetsByCategory: (e) => {
31
+ const t = [];
32
+ for (const r of s().values())
33
+ r.category === e && t.push(r);
34
+ return t;
35
+ }
36
+ };
3
37
  }
4
38
  export {
5
- n as deferNonBlocking
39
+ f as WidgetRegistryProvider,
40
+ c as createWidgetRegistry,
41
+ m as useWidgetRegistry
6
42
  };