@floegence/floe-webapp-core 0.1.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.
Files changed (145) hide show
  1. package/dist/app/FloeApp.d.ts +37 -0
  2. package/dist/app/FloeProvider.d.ts +17 -0
  3. package/dist/app/index.d.ts +2 -0
  4. package/dist/components/deck/DeckCell.d.ts +17 -0
  5. package/dist/components/deck/DeckGrid.d.ts +14 -0
  6. package/dist/components/deck/DeckTopBar.d.ts +9 -0
  7. package/dist/components/deck/DropZonePreview.d.ts +10 -0
  8. package/dist/components/deck/LayoutSelector.d.ts +7 -0
  9. package/dist/components/deck/WidgetFrame.d.ts +14 -0
  10. package/dist/components/deck/WidgetPalette.d.ts +7 -0
  11. package/dist/components/deck/WidgetResizeHandle.d.ts +9 -0
  12. package/dist/components/deck/WidgetTypeSwitcher.d.ts +9 -0
  13. package/dist/components/deck/index.d.ts +9 -0
  14. package/dist/components/icons/index.d.ts +29 -0
  15. package/dist/components/index.d.ts +5 -0
  16. package/dist/components/launchpad/Launchpad.d.ts +15 -0
  17. package/dist/components/launchpad/LaunchpadGrid.d.ts +8 -0
  18. package/dist/components/launchpad/LaunchpadItem.d.ts +18 -0
  19. package/dist/components/launchpad/LaunchpadPagination.d.ts +6 -0
  20. package/dist/components/launchpad/LaunchpadSearch.d.ts +6 -0
  21. package/dist/components/launchpad/index.d.ts +10 -0
  22. package/dist/components/layout/ActivityBar.d.ts +24 -0
  23. package/dist/components/layout/BottomBar.d.ts +27 -0
  24. package/dist/components/layout/MobileTabBar.d.ts +19 -0
  25. package/dist/components/layout/Panel.d.ts +27 -0
  26. package/dist/components/layout/ResizeHandle.d.ts +9 -0
  27. package/dist/components/layout/Shell.d.ts +23 -0
  28. package/dist/components/layout/Sidebar.d.ts +33 -0
  29. package/dist/components/layout/TopBar.d.ts +11 -0
  30. package/dist/components/layout/index.d.ts +9 -0
  31. package/dist/components/loading/LoadingOverlay.d.ts +10 -0
  32. package/dist/components/loading/Skeleton.d.ts +21 -0
  33. package/dist/components/loading/SnakeLoader.d.ts +9 -0
  34. package/dist/components/loading/index.d.ts +3 -0
  35. package/dist/components/ui/Button.d.ts +12 -0
  36. package/dist/components/ui/Card.d.ts +79 -0
  37. package/dist/components/ui/CommandPalette.d.ts +4 -0
  38. package/dist/components/ui/Dialog.d.ts +29 -0
  39. package/dist/components/ui/Dropdown.d.ts +35 -0
  40. package/dist/components/ui/FloatingWindow.d.ts +45 -0
  41. package/dist/components/ui/Input.d.ts +16 -0
  42. package/dist/components/ui/Tooltip.d.ts +12 -0
  43. package/dist/components/ui/index.d.ts +8 -0
  44. package/dist/context/CommandContext.d.ts +30 -0
  45. package/dist/context/ComponentRegistry.d.ts +90 -0
  46. package/dist/context/DeckContext.d.ts +88 -0
  47. package/dist/context/FloeConfigContext.d.ts +133 -0
  48. package/dist/context/LayoutContext.d.ts +20 -0
  49. package/dist/context/NotificationContext.d.ts +32 -0
  50. package/dist/context/ThemeContext.d.ts +12 -0
  51. package/dist/context/WidgetRegistry.d.ts +37 -0
  52. package/dist/context/createSimpleContext.d.ts +15 -0
  53. package/dist/context/index.d.ts +9 -0
  54. package/dist/hooks/index.d.ts +6 -0
  55. package/dist/hooks/useDebounce.d.ts +5 -0
  56. package/dist/hooks/useDeckDrag.d.ts +6 -0
  57. package/dist/hooks/useKeybind.d.ts +4 -0
  58. package/dist/hooks/useMediaQuery.d.ts +5 -0
  59. package/dist/hooks/usePersisted.d.ts +5 -0
  60. package/dist/hooks/useResizeObserver.d.ts +9 -0
  61. package/dist/index.d.ts +7 -0
  62. package/dist/index.js +226 -0
  63. package/dist/index10.js +92 -0
  64. package/dist/index11.js +101 -0
  65. package/dist/index12.js +113 -0
  66. package/dist/index13.js +82 -0
  67. package/dist/index14.js +123 -0
  68. package/dist/index15.js +106 -0
  69. package/dist/index16.js +131 -0
  70. package/dist/index17.js +152 -0
  71. package/dist/index18.js +41 -0
  72. package/dist/index19.js +61 -0
  73. package/dist/index2.js +215 -0
  74. package/dist/index20.js +79 -0
  75. package/dist/index21.js +162 -0
  76. package/dist/index22.js +293 -0
  77. package/dist/index23.js +136 -0
  78. package/dist/index24.js +45 -0
  79. package/dist/index25.js +146 -0
  80. package/dist/index26.js +258 -0
  81. package/dist/index27.js +92 -0
  82. package/dist/index28.js +42 -0
  83. package/dist/index29.js +71 -0
  84. package/dist/index3.js +94 -0
  85. package/dist/index30.js +280 -0
  86. package/dist/index31.js +154 -0
  87. package/dist/index32.js +31 -0
  88. package/dist/index33.js +50 -0
  89. package/dist/index34.js +15 -0
  90. package/dist/index35.js +32 -0
  91. package/dist/index36.js +51 -0
  92. package/dist/index37.js +41 -0
  93. package/dist/index38.js +28 -0
  94. package/dist/index39.js +176 -0
  95. package/dist/index4.js +55 -0
  96. package/dist/index40.js +43 -0
  97. package/dist/index41.js +69 -0
  98. package/dist/index42.js +99 -0
  99. package/dist/index43.js +120 -0
  100. package/dist/index44.js +141 -0
  101. package/dist/index45.js +42 -0
  102. package/dist/index46.js +386 -0
  103. package/dist/index47.js +16 -0
  104. package/dist/index48.js +13 -0
  105. package/dist/index49.js +19 -0
  106. package/dist/index5.js +48 -0
  107. package/dist/index50.js +13 -0
  108. package/dist/index51.js +11 -0
  109. package/dist/index52.js +59 -0
  110. package/dist/index53.js +8 -0
  111. package/dist/index54.js +6 -0
  112. package/dist/index55.js +48 -0
  113. package/dist/index56.js +29 -0
  114. package/dist/index57.js +35 -0
  115. package/dist/index58.js +94 -0
  116. package/dist/index59.js +25 -0
  117. package/dist/index6.js +73 -0
  118. package/dist/index60.js +49 -0
  119. package/dist/index61.js +17 -0
  120. package/dist/index62.js +38 -0
  121. package/dist/index63.js +67 -0
  122. package/dist/index64.js +87 -0
  123. package/dist/index65.js +17 -0
  124. package/dist/index66.js +2266 -0
  125. package/dist/index7.js +112 -0
  126. package/dist/index8.js +66 -0
  127. package/dist/index9.js +33 -0
  128. package/dist/styles/build.d.ts +1 -0
  129. package/dist/styles/themes/index.d.ts +9 -0
  130. package/dist/styles.css +1 -0
  131. package/dist/styles.js +1 -0
  132. package/dist/utils/animations.d.ts +222 -0
  133. package/dist/utils/bodyStyleLock.d.ts +9 -0
  134. package/dist/utils/cn.d.ts +5 -0
  135. package/dist/utils/defer.d.ts +5 -0
  136. package/dist/utils/gridCollision.d.ts +31 -0
  137. package/dist/utils/gridLayout.d.ts +38 -0
  138. package/dist/utils/index.d.ts +8 -0
  139. package/dist/utils/keybind.d.ts +22 -0
  140. package/dist/utils/persist.d.ts +17 -0
  141. package/dist/widgets/MetricsWidget.d.ts +5 -0
  142. package/dist/widgets/SidebarWidget.d.ts +11 -0
  143. package/dist/widgets/TerminalWidget.d.ts +5 -0
  144. package/dist/widgets/index.d.ts +3 -0
  145. package/package.json +40 -0
@@ -0,0 +1,28 @@
1
+ import { createComponent as i } from "solid-js/web";
2
+ import { createContext as u, useContext as m } from "solid-js";
3
+ function x(t) {
4
+ const r = u();
5
+ function n(e) {
6
+ const c = t.init();
7
+ return i(r.Provider, {
8
+ value: c,
9
+ get children() {
10
+ return e.children;
11
+ }
12
+ });
13
+ }
14
+ function o() {
15
+ const e = m(r);
16
+ if (!e)
17
+ throw new Error(`${t.name}Context not found. Make sure to wrap your component with ${t.name}Provider.`);
18
+ return e;
19
+ }
20
+ return {
21
+ Provider: n,
22
+ use: o,
23
+ Context: r
24
+ };
25
+ }
26
+ export {
27
+ x as createSimpleContext
28
+ };
@@ -0,0 +1,176 @@
1
+ import { createComponent as v } from "solid-js/web";
2
+ import { createContext as C, useContext as g, createMemo as m } from "solid-js";
3
+ const d = {
4
+ storage: {
5
+ namespace: "floe",
6
+ enabled: !0,
7
+ adapter: void 0
8
+ },
9
+ commands: {
10
+ enableGlobalKeybinds: !0,
11
+ ignoreWhenTyping: !0,
12
+ allowWhenTypingWithin: '[data-floe-hotkeys="allow"]',
13
+ palette: {
14
+ enabled: !0,
15
+ keybind: "mod+k"
16
+ },
17
+ save: {
18
+ enabled: !0,
19
+ keybind: "mod+s",
20
+ commandId: "file.save",
21
+ preventDefaultWhenNoHandler: !0
22
+ }
23
+ },
24
+ layout: {
25
+ storageKey: "layout",
26
+ mobileQuery: "(max-width: 767px)",
27
+ sidebar: {
28
+ defaultWidth: 350,
29
+ clamp: {
30
+ min: 220,
31
+ max: 480
32
+ },
33
+ defaultActiveTab: "",
34
+ defaultCollapsed: !1
35
+ },
36
+ terminal: {
37
+ defaultOpened: !1,
38
+ defaultHeight: 280,
39
+ clamp: {
40
+ min: 150,
41
+ max: 600
42
+ }
43
+ }
44
+ },
45
+ theme: {
46
+ storageKey: "theme",
47
+ defaultTheme: "system"
48
+ },
49
+ deck: {
50
+ storageKey: "deck"
51
+ },
52
+ strings: {
53
+ topBar: {
54
+ searchPlaceholder: "Search commands..."
55
+ },
56
+ commandPalette: {
57
+ placeholder: "Type a command or search...",
58
+ empty: "No commands found",
59
+ esc: "esc"
60
+ },
61
+ confirmDialog: {
62
+ cancel: "Cancel",
63
+ confirm: "Confirm"
64
+ },
65
+ statusIndicator: {
66
+ connected: "Connected",
67
+ disconnected: "Disconnected",
68
+ connecting: "Connecting",
69
+ error: "Error"
70
+ }
71
+ }
72
+ };
73
+ function I() {
74
+ if (!(typeof window > "u"))
75
+ return {
76
+ getItem: (e) => localStorage.getItem(e),
77
+ setItem: (e, t) => localStorage.setItem(e, t),
78
+ removeItem: (e) => localStorage.removeItem(e),
79
+ keys: () => Object.keys(localStorage)
80
+ };
81
+ }
82
+ function y(e) {
83
+ const t = e.adapter ?? I(), i = e.namespace ? `${e.namespace}-` : "", o = (r) => `${i}${r}`, n = () => e.enabled && !!t, s = /* @__PURE__ */ new Map();
84
+ return {
85
+ key: o,
86
+ load: (r, c) => {
87
+ if (!n()) return c;
88
+ try {
89
+ const a = t.getItem(o(r));
90
+ return a === null ? c : JSON.parse(a);
91
+ } catch {
92
+ return c;
93
+ }
94
+ },
95
+ save: (r, c) => {
96
+ if (n())
97
+ try {
98
+ t.setItem(o(r), JSON.stringify(c));
99
+ } catch (a) {
100
+ console.warn(`Failed to save ${o(r)}:`, a);
101
+ }
102
+ },
103
+ debouncedSave: (r, c, a = 300) => {
104
+ if (!n()) return;
105
+ const l = o(r), u = s.get(l);
106
+ u && clearTimeout(u), s.set(l, setTimeout(() => {
107
+ try {
108
+ t.setItem(l, JSON.stringify(c)), s.delete(l);
109
+ } catch (h) {
110
+ console.warn(`Failed to save ${l}:`, h);
111
+ }
112
+ }, a));
113
+ },
114
+ remove: (r) => {
115
+ if (n())
116
+ try {
117
+ t.removeItem(o(r));
118
+ } catch {
119
+ }
120
+ },
121
+ clearAll: () => {
122
+ var c;
123
+ if (!n()) return;
124
+ const r = ((c = t.keys) == null ? void 0 : c.call(t)) ?? [];
125
+ for (const a of r)
126
+ a.startsWith(i) && t.removeItem(a);
127
+ }
128
+ };
129
+ }
130
+ function p(e, t) {
131
+ if (!t) return e;
132
+ if (typeof e != "object" || e === null || Array.isArray(e)) return t ?? e;
133
+ const i = {
134
+ ...e
135
+ };
136
+ for (const [o, n] of Object.entries(t)) {
137
+ if (n === void 0) continue;
138
+ const s = e[o];
139
+ typeof s == "object" && s !== null && typeof n == "object" && n !== null && !Array.isArray(n) ? i[o] = p(s, n) : i[o] = n;
140
+ }
141
+ return i;
142
+ }
143
+ const f = C();
144
+ function x(e) {
145
+ const t = m(() => p(d, e.config)), i = m(() => y(t().storage)), o = m(() => ({
146
+ config: t(),
147
+ persist: i()
148
+ }));
149
+ return v(f.Provider, {
150
+ get value() {
151
+ return o();
152
+ },
153
+ get children() {
154
+ return e.children;
155
+ }
156
+ });
157
+ }
158
+ function S() {
159
+ const e = g(f);
160
+ if (!e)
161
+ throw new Error("FloeConfigContext not found. Make sure to wrap your app with FloeConfigProvider (or FloeProvider).");
162
+ return e;
163
+ }
164
+ const F = y(d.storage), k = {
165
+ config: d,
166
+ persist: F
167
+ };
168
+ function T() {
169
+ return g(f) ?? k;
170
+ }
171
+ export {
172
+ d as DEFAULT_FLOE_CONFIG,
173
+ x as FloeConfigProvider,
174
+ S as useFloeConfig,
175
+ T as useResolvedFloeConfig
176
+ };
package/dist/index4.js ADDED
@@ -0,0 +1,55 @@
1
+ import { delegateEvents as v, template as c, insert as n, effect as d, className as o, setStyleProperty as f, memo as u } from "solid-js/web";
2
+ import "solid-js";
3
+ import { cn as s } from "./index53.js";
4
+ var b = /* @__PURE__ */ c('<aside><div class="flex-1 overflow-auto overscroll-contain">'), x = /* @__PURE__ */ c("<section><div class=flex-1>"), m = /* @__PURE__ */ c('<div class="flex items-center justify-between px-2.5 py-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60"><span>'), h = /* @__PURE__ */ c('<button type=button><span class="flex-1 truncate text-left">'), $ = /* @__PURE__ */ c('<span class="flex-shrink-0 w-4 h-4 opacity-60">');
5
+ function y(e) {
6
+ return (() => {
7
+ var i = b(), l = i.firstChild;
8
+ return n(l, () => e.children), n(i, () => e.resizer, null), d((t) => {
9
+ var r = s("relative h-full flex flex-col shrink-0 min-h-0", "bg-sidebar text-sidebar-foreground", "border-r border-sidebar-border", "overflow-hidden", e.class), a = `${e.width ?? 350}px`;
10
+ return r !== t.e && o(i, t.e = r), a !== t.t && f(i, "width", t.t = a), t;
11
+ }, {
12
+ e: void 0,
13
+ t: void 0
14
+ }), i;
15
+ })();
16
+ }
17
+ function k(e) {
18
+ return (() => {
19
+ var i = x(), l = i.firstChild;
20
+ return n(i, (() => {
21
+ var t = u(() => !!e.title);
22
+ return () => t() && (() => {
23
+ var r = m(), a = r.firstChild;
24
+ return n(a, () => e.title), n(r, () => e.actions, null), r;
25
+ })();
26
+ })(), l), n(l, () => e.children), d(() => o(i, s("flex flex-col", e.class))), i;
27
+ })();
28
+ }
29
+ function C(e) {
30
+ return (() => {
31
+ var i = h(), l = i.firstChild;
32
+ return i.$$click = () => {
33
+ var t;
34
+ return (t = e.onClick) == null ? void 0 : t.call(e);
35
+ }, n(i, (() => {
36
+ var t = u(() => !!e.icon);
37
+ return () => t() && (() => {
38
+ var r = $();
39
+ return n(r, () => e.icon), r;
40
+ })();
41
+ })(), l), n(l, () => e.children), d((t) => {
42
+ var r = s("w-full flex items-center gap-2 px-2.5 py-1.5 text-xs cursor-pointer", "transition-colors duration-75", "hover:bg-sidebar-accent/80 hover:text-sidebar-accent-foreground", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-sidebar-ring", e.active && "bg-sidebar-accent text-sidebar-accent-foreground font-medium", e.class), a = e.indent ? `${10 + e.indent * 10}px` : void 0;
43
+ return r !== t.e && o(i, t.e = r), a !== t.t && f(i, "padding-left", t.t = a), t;
44
+ }, {
45
+ e: void 0,
46
+ t: void 0
47
+ }), i;
48
+ })();
49
+ }
50
+ v(["click"]);
51
+ export {
52
+ y as Sidebar,
53
+ C as SidebarItem,
54
+ k as SidebarSection
55
+ };
@@ -0,0 +1,43 @@
1
+ import { createSignal as c, onCleanup as g, createEffect as u } from "solid-js";
2
+ import { createSimpleContext as T } from "./index38.js";
3
+ import { useResolvedFloeConfig as p } from "./index39.js";
4
+ import { getSystemTheme as v, applyTheme as y } from "./index61.js";
5
+ function S() {
6
+ const t = p(), r = () => t.config.theme.storageKey, i = () => t.config.theme.defaultTheme, h = t.persist.load(r(), i()), [o, a] = c(h), [d, l] = c(v()), n = () => {
7
+ const e = o();
8
+ return e === "system" ? d() : e;
9
+ };
10
+ if (typeof window < "u") {
11
+ const e = window.matchMedia("(prefers-color-scheme: dark)"), m = (f) => {
12
+ l(f.matches ? "dark" : "light");
13
+ };
14
+ e.addEventListener("change", m), g(() => e.removeEventListener("change", m));
15
+ }
16
+ u(() => {
17
+ y(o());
18
+ });
19
+ const s = (e) => {
20
+ a(e), t.persist.debouncedSave(r(), e);
21
+ };
22
+ return {
23
+ theme: o,
24
+ resolvedTheme: n,
25
+ setTheme: s,
26
+ toggleTheme: () => {
27
+ const e = n();
28
+ s(e === "light" ? "dark" : "light");
29
+ }
30
+ };
31
+ }
32
+ const {
33
+ Provider: K,
34
+ use: L
35
+ } = T({
36
+ name: "Theme",
37
+ init: S
38
+ });
39
+ export {
40
+ K as ThemeProvider,
41
+ S as createThemeService,
42
+ L as useTheme
43
+ };
@@ -0,0 +1,69 @@
1
+ import { createEffect as h } from "solid-js";
2
+ import { createStore as f, produce as l } from "solid-js/store";
3
+ import { createSimpleContext as u } from "./index38.js";
4
+ import { useResolvedFloeConfig as g } from "./index39.js";
5
+ const {
6
+ Provider: x,
7
+ use: C
8
+ } = u({
9
+ name: "Layout",
10
+ init: v
11
+ });
12
+ function v() {
13
+ var o, n, b, m, c;
14
+ const d = g(), a = () => d.config.layout, s = d.persist.load(a().storageKey, {}), p = {
15
+ sidebar: {
16
+ width: ((o = s.sidebar) == null ? void 0 : o.width) ?? a().sidebar.defaultWidth,
17
+ activeTab: ((n = s.sidebar) == null ? void 0 : n.activeTab) ?? a().sidebar.defaultActiveTab,
18
+ collapsed: ((b = s.sidebar) == null ? void 0 : b.collapsed) ?? a().sidebar.defaultCollapsed
19
+ },
20
+ terminal: {
21
+ opened: ((m = s.terminal) == null ? void 0 : m.opened) ?? a().terminal.defaultOpened,
22
+ height: ((c = s.terminal) == null ? void 0 : c.height) ?? a().terminal.defaultHeight
23
+ },
24
+ isMobile: !1
25
+ }, [i, r] = f(p);
26
+ return h(() => {
27
+ const e = {
28
+ sidebar: i.sidebar,
29
+ terminal: i.terminal
30
+ };
31
+ d.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(l((t) => {
39
+ t.sidebar.width = Math.max(a().sidebar.clamp.min, Math.min(a().sidebar.clamp.max, e));
40
+ })),
41
+ setSidebarActiveTab: (e) => r(l((t) => {
42
+ t.sidebar.activeTab = e, t.sidebar.collapsed = !1;
43
+ })),
44
+ setSidebarCollapsed: (e) => r(l((t) => {
45
+ t.sidebar.collapsed = e;
46
+ })),
47
+ toggleSidebarCollapse: () => r(l((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(l((e) => {
55
+ e.terminal.opened = !e.terminal.opened;
56
+ })),
57
+ setTerminalHeight: (e) => r(l((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
+ };
64
+ }
65
+ export {
66
+ x as LayoutProvider,
67
+ v as createLayoutService,
68
+ C as useLayout
69
+ };
@@ -0,0 +1,99 @@
1
+ import { createSignal as p, onCleanup as K } from "solid-js";
2
+ import { createSimpleContext as D } from "./index38.js";
3
+ import { useResolvedFloeConfig as W } from "./index39.js";
4
+ import { formatKeybind as P, parseKeybind as k, matchKeybind as y } from "./index56.js";
5
+ import { deferNonBlocking as v } from "./index54.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
+ };
87
+ }
88
+ const {
89
+ Provider: N,
90
+ use: O
91
+ } = D({
92
+ name: "Command",
93
+ init: S
94
+ });
95
+ export {
96
+ N as CommandProvider,
97
+ S as createCommandService,
98
+ O as useCommand
99
+ };
@@ -0,0 +1,120 @@
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 "./index38.js";
5
+ import { cn as $ } from "./index53.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;
8
+ function N() {
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
22
+ });
23
+ })), n > 0) {
24
+ const s = setTimeout(() => a(i), n);
25
+ o.set(i, s);
26
+ }
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
+ })
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"]);
115
+ export {
116
+ P as NotificationContainer,
117
+ L as NotificationProvider,
118
+ N as createNotificationService,
119
+ S as useNotification
120
+ };