@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/index46.js CHANGED
@@ -1,386 +1,41 @@
1
- import { createSignal as I, createEffect as T } from "solid-js";
2
- import { createStore as E, produce as r } from "solid-js/store";
3
- import { createSimpleContext as h } from "./index38.js";
4
- import { useResolvedFloeConfig as W } from "./index39.js";
5
- import { hasCollision as g, constrainPosition as F, findFreePosition as k } from "./index59.js";
6
- const z = [{
7
- id: "preset-default",
8
- name: "Default",
9
- isPreset: !0,
10
- widgets: [{
11
- id: "w1",
12
- type: "metrics",
13
- position: {
14
- col: 0,
15
- row: 0,
16
- colSpan: 12,
17
- rowSpan: 6
18
- }
19
- }, {
20
- id: "w2",
21
- type: "terminal",
22
- position: {
23
- col: 12,
24
- row: 0,
25
- colSpan: 12,
26
- rowSpan: 6
27
- }
28
- }, {
29
- id: "w3",
30
- type: "metrics",
31
- position: {
32
- col: 0,
33
- row: 6,
34
- colSpan: 24,
35
- rowSpan: 6
36
- }
37
- }],
38
- createdAt: Date.now(),
39
- updatedAt: Date.now()
40
- }, {
41
- id: "preset-focus",
42
- name: "Focus",
43
- isPreset: !0,
44
- widgets: [{
45
- id: "w1",
46
- type: "terminal",
47
- position: {
48
- col: 0,
49
- row: 0,
50
- colSpan: 24,
51
- rowSpan: 12
52
- }
53
- }],
54
- createdAt: Date.now(),
55
- updatedAt: Date.now()
56
- }, {
57
- id: "preset-monitoring",
58
- name: "Monitoring",
59
- isPreset: !0,
60
- widgets: [{
61
- id: "w1",
62
- type: "metrics",
63
- position: {
64
- col: 0,
65
- row: 0,
66
- colSpan: 12,
67
- rowSpan: 6
68
- }
69
- }, {
70
- id: "w2",
71
- type: "metrics",
72
- position: {
73
- col: 12,
74
- row: 0,
75
- colSpan: 12,
76
- rowSpan: 6
77
- }
78
- }, {
79
- id: "w3",
80
- type: "metrics",
81
- position: {
82
- col: 0,
83
- row: 6,
84
- colSpan: 12,
85
- rowSpan: 6
86
- }
87
- }, {
88
- id: "w4",
89
- type: "metrics",
90
- position: {
91
- col: 12,
92
- row: 6,
93
- colSpan: 12,
94
- rowSpan: 6
95
- }
96
- }],
97
- createdAt: Date.now(),
98
- updatedAt: Date.now()
99
- }, {
100
- id: "preset-development",
101
- name: "Development",
102
- isPreset: !0,
103
- widgets: [{
104
- id: "w1",
105
- type: "terminal",
106
- position: {
107
- col: 0,
108
- row: 0,
109
- colSpan: 12,
110
- rowSpan: 6
111
- }
112
- }, {
113
- id: "w2",
114
- type: "terminal",
115
- position: {
116
- col: 12,
117
- row: 0,
118
- colSpan: 12,
119
- rowSpan: 6
120
- }
121
- }, {
122
- id: "w3",
123
- type: "metrics",
124
- position: {
125
- col: 0,
126
- row: 6,
127
- colSpan: 24,
128
- rowSpan: 6
129
- }
130
- }],
131
- createdAt: Date.now(),
132
- updatedAt: Date.now()
133
- }], U = {
134
- activeLayoutId: "preset-default"
135
- }, P = {
136
- metrics: {
137
- minColSpan: 6,
138
- minRowSpan: 4
139
- },
140
- terminal: {
141
- minColSpan: 8,
142
- minRowSpan: 4
143
- }
144
- }, {
145
- Provider: q,
146
- use: B
147
- } = h({
148
- name: "Deck",
149
- init: _
150
- });
151
- function _() {
152
- const w = W(), S = () => w.config.deck.storageKey, m = w.persist.load(S(), {}), M = (m.layouts ?? []).filter((o) => !o.isPreset), R = {
153
- layouts: [...z, ...M],
154
- activeLayoutId: m.activeLayoutId ?? U.activeLayoutId,
155
- editMode: !1
156
- }, [s, d] = E(R), [v, p] = I(null), [D, f] = I(null);
157
- T(() => {
158
- const o = {
159
- layouts: s.layouts,
160
- activeLayoutId: s.activeLayoutId
161
- };
162
- w.persist.debouncedSave(S(), o);
163
- });
164
- const u = () => s.layouts.find((o) => o.id === s.activeLayoutId), l = () => `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
165
- return {
166
- // Layout management
167
- layouts: () => s.layouts,
168
- activeLayoutId: () => s.activeLayoutId,
169
- activeLayout: u,
170
- setActiveLayout: (o) => {
171
- s.layouts.some((t) => t.id === o) && d("activeLayoutId", o);
172
- },
173
- createLayout: (o, t) => {
174
- const a = {
175
- id: l(),
176
- name: o,
177
- widgets: t ?? [],
178
- createdAt: Date.now(),
179
- updatedAt: Date.now()
180
- };
181
- return d(r((i) => {
182
- i.layouts.push(a), i.activeLayoutId = a.id;
183
- })), a;
184
- },
185
- duplicateLayout: (o, t) => {
186
- const a = s.layouts.find((e) => e.id === o);
187
- if (!a) return;
188
- const i = {
189
- id: l(),
190
- name: t,
191
- widgets: a.widgets.map((e) => ({
192
- ...e,
193
- id: l()
194
- })),
195
- createdAt: Date.now(),
196
- updatedAt: Date.now()
197
- };
198
- return d(r((e) => {
199
- e.layouts.push(i), e.activeLayoutId = i.id;
200
- })), i;
201
- },
202
- deleteLayout: (o) => {
203
- const t = s.layouts.find((a) => a.id === o);
204
- !t || t.isPreset || d(r((a) => {
205
- const i = a.layouts.findIndex((e) => e.id === o);
206
- i !== -1 && (a.layouts.splice(i, 1), a.activeLayoutId === o && (a.activeLayoutId = "preset-default"));
207
- }));
208
- },
209
- renameLayout: (o, t) => {
210
- const a = s.layouts.find((i) => i.id === o);
211
- !a || a.isPreset || d(r((i) => {
212
- const e = i.layouts.find((n) => n.id === o);
213
- e && (e.name = t, e.updatedAt = Date.now());
214
- }));
215
- },
216
- // Edit mode
217
- editMode: () => s.editMode,
218
- setEditMode: (o) => d("editMode", o),
219
- toggleEditMode: () => d("editMode", !s.editMode),
220
- // Widget management
221
- addWidget: (o, t, a) => {
222
- const i = u();
223
- if (!i) return;
224
- const e = P[o] ?? {
225
- minColSpan: 2,
226
- minRowSpan: 2
227
- }, n = {
228
- colSpan: (t == null ? void 0 : t.colSpan) ?? Math.max(e.minColSpan, 4),
229
- rowSpan: (t == null ? void 0 : t.rowSpan) ?? Math.max(e.minRowSpan, 3)
230
- }, c = (t == null ? void 0 : t.col) !== void 0 && (t == null ? void 0 : t.row) !== void 0 ? F({
231
- ...n,
232
- col: t.col,
233
- row: t.row
234
- }, e.minColSpan, e.minRowSpan) : k(i.widgets, n.colSpan, n.rowSpan), L = l(), C = {
235
- id: L,
236
- type: o,
237
- position: c,
238
- config: a
239
- };
240
- return d(r((A) => {
241
- const y = A.layouts.find((x) => x.id === A.activeLayoutId);
242
- y && (y.widgets.push(C), y.updatedAt = Date.now());
243
- })), L;
244
- },
245
- removeWidget: (o) => {
246
- d(r((t) => {
247
- const a = t.layouts.find((i) => i.id === t.activeLayoutId);
248
- if (a) {
249
- const i = a.widgets.findIndex((e) => e.id === o);
250
- i !== -1 && (a.widgets.splice(i, 1), a.updatedAt = Date.now());
251
- }
252
- }));
253
- },
254
- updateWidgetPosition: (o, t) => {
255
- d(r((a) => {
256
- const i = a.layouts.find((e) => e.id === a.activeLayoutId);
257
- if (i) {
258
- const e = i.widgets.find((n) => n.id === o);
259
- e && (g(t, i.widgets, o) || (e.position = t, i.updatedAt = Date.now()));
260
- }
261
- }));
262
- },
263
- updateWidgetConfig: (o, t) => {
264
- d(r((a) => {
265
- const i = a.layouts.find((e) => e.id === a.activeLayoutId);
266
- if (i) {
267
- const e = i.widgets.find((n) => n.id === o);
268
- e && (e.config = {
269
- ...e.config,
270
- ...t
271
- }, i.updatedAt = Date.now());
272
- }
273
- }));
274
- },
275
- updateWidgetTitle: (o, t) => {
276
- d(r((a) => {
277
- const i = a.layouts.find((e) => e.id === a.activeLayoutId);
278
- if (i) {
279
- const e = i.widgets.find((n) => n.id === o);
280
- e && (e.title = t, i.updatedAt = Date.now());
281
- }
282
- }));
283
- },
284
- changeWidgetType: (o, t) => {
285
- d(r((a) => {
286
- const i = a.layouts.find((e) => e.id === a.activeLayoutId);
287
- if (i) {
288
- const e = i.widgets.find((n) => n.id === o);
289
- e && (e.type = t, e.config = void 0, e.title = void 0, i.updatedAt = Date.now());
290
- }
291
- }));
292
- },
293
- // Drag state
294
- dragState: v,
295
- startDrag: (o, t, a) => {
296
- const i = u(), e = i == null ? void 0 : i.widgets.find((n) => n.id === o);
297
- e && p({
298
- widgetId: o,
299
- originalPosition: {
300
- ...e.position
301
- },
302
- currentPosition: {
303
- ...e.position
304
- },
305
- pixelOffset: {
306
- x: 0,
307
- y: 0
308
- },
309
- startX: t,
310
- startY: a
1
+ import { createComponent as t, memo as n, mergeProps as f } from "solid-js/web";
2
+ import { onMount as u, onCleanup as C } from "solid-js";
3
+ import { useComponentRegistry as g, useComponentContextFactory as h } from "./index53.js";
4
+ import { NotificationContainer as d } from "./index52.js";
5
+ import { Shell as A } from "./index2.js";
6
+ import { CommandPalette as x } from "./index25.js";
7
+ import { FloeProvider as P } from "./index45.js";
8
+ function F(e) {
9
+ var r, m;
10
+ const o = g(), c = h(), a = (r = e.getProtocol) == null ? void 0 : r.call(e);
11
+ return (m = e.components) != null && m.length && o.registerAll(e.components), u(() => {
12
+ o.mountAll((i) => {
13
+ const l = c(i, {
14
+ protocol: a
311
15
  });
16
+ return e.createComponentContext ? e.createComponentContext(i, l) : l;
17
+ });
18
+ }), C(() => {
19
+ o.unmountAll();
20
+ }), [t(A, f(() => e.shell, {
21
+ get children() {
22
+ return e.children;
23
+ }
24
+ })), n(() => n(() => e.enableCommandPalette !== !1)() && t(x, {})), n(() => n(() => e.enableNotifications !== !1)() && t(d, {}))];
25
+ }
26
+ function I(e) {
27
+ return t(P, {
28
+ get config() {
29
+ return e.config;
312
30
  },
313
- updateDrag: (o, t) => {
314
- p((a) => a ? {
315
- ...a,
316
- currentPosition: o,
317
- pixelOffset: t
318
- } : null);
319
- },
320
- endDrag: (o) => {
321
- const t = v();
322
- if (t) {
323
- if (o) {
324
- const a = u();
325
- a && !g(t.currentPosition, a.widgets, t.widgetId) && d(r((i) => {
326
- const e = i.layouts.find((n) => n.id === i.activeLayoutId);
327
- if (e) {
328
- const n = e.widgets.find((c) => c.id === t.widgetId);
329
- n && (n.position = t.currentPosition, e.updatedAt = Date.now());
330
- }
331
- }));
332
- }
333
- p(null);
334
- }
335
- },
336
- // Resize state
337
- resizeState: D,
338
- startResize: (o, t, a, i) => {
339
- const e = u(), n = e == null ? void 0 : e.widgets.find((c) => c.id === o);
340
- n && f({
341
- widgetId: o,
342
- edge: t,
343
- originalPosition: {
344
- ...n.position
345
- },
346
- currentPosition: {
347
- ...n.position
348
- },
349
- startX: a,
350
- startY: i
351
- });
352
- },
353
- updateResize: (o) => {
354
- f((t) => t ? {
355
- ...t,
356
- currentPosition: o
357
- } : null);
358
- },
359
- endResize: (o) => {
360
- const t = D();
361
- if (t) {
362
- if (o) {
363
- const a = u();
364
- a && !g(t.currentPosition, a.widgets, t.widgetId) && d(r((i) => {
365
- const e = i.layouts.find((n) => n.id === i.activeLayoutId);
366
- if (e) {
367
- const n = e.widgets.find((c) => c.id === t.widgetId);
368
- n && (n.position = t.currentPosition, e.updatedAt = Date.now());
369
- }
370
- }));
371
- }
372
- f(null);
373
- }
31
+ get wrapAfterTheme() {
32
+ return e.wrapAfterTheme;
374
33
  },
375
- // Utilities
376
- getWidgetMinConstraints: (o) => P[o] ?? {
377
- minColSpan: 2,
378
- minRowSpan: 2
34
+ get children() {
35
+ return t(F, e);
379
36
  }
380
- };
37
+ });
381
38
  }
382
39
  export {
383
- q as DeckProvider,
384
- _ as createDeckService,
385
- B as useDeck
40
+ I as FloeApp
386
41
  };
package/dist/index47.js CHANGED
@@ -1,16 +1,28 @@
1
- import { createSignal as c, onMount as i, onCleanup as s } from "solid-js";
2
- function h(a) {
3
- const [o, n] = c(!1);
4
- return i(() => {
5
- if (typeof window > "u") return;
6
- const e = window.matchMedia(a);
7
- n(e.matches);
8
- const t = (r) => {
9
- n(r.matches);
10
- };
11
- e.addEventListener("change", t), s(() => e.removeEventListener("change", t));
12
- }), o;
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
+ };
13
25
  }
14
26
  export {
15
- h as useMediaQuery
27
+ x as createSimpleContext
16
28
  };
package/dist/index48.js CHANGED
@@ -1,13 +1,176 @@
1
- import { createSignal as r, createEffect as i, on as a } from "solid-js";
2
- function s(e, t) {
3
- const [o, n] = r(e());
4
- return i(
5
- a(e, (u) => {
6
- const c = setTimeout(() => n(() => u), t);
7
- return () => clearTimeout(c);
8
- })
9
- ), o;
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;
10
170
  }
11
171
  export {
12
- s as useDebounce
172
+ d as DEFAULT_FLOE_CONFIG,
173
+ x as FloeConfigProvider,
174
+ S as useFloeConfig,
175
+ T as useResolvedFloeConfig
13
176
  };
package/dist/index49.js CHANGED
@@ -1,19 +1,43 @@
1
- import { createSignal as c, onMount as u, onCleanup as h } from "solid-js";
2
- function b(o) {
3
- const [r, i] = c(null);
4
- return u(() => {
5
- const t = o();
6
- if (!t) return;
7
- const n = new ResizeObserver((s) => {
8
- const e = s[0];
9
- e && i({
10
- width: e.contentRect.width,
11
- height: e.contentRect.height
12
- });
13
- });
14
- n.observe(t), h(() => n.disconnect());
15
- }), r;
1
+ import { createSignal as c, onCleanup as g, createEffect as u } from "solid-js";
2
+ import { createSimpleContext as T } from "./index47.js";
3
+ import { useResolvedFloeConfig as p } from "./index48.js";
4
+ import { getSystemTheme as v, applyTheme as y } from "./index70.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
+ };
16
31
  }
32
+ const {
33
+ Provider: K,
34
+ use: L
35
+ } = T({
36
+ name: "Theme",
37
+ init: S
38
+ });
17
39
  export {
18
- b as useResizeObserver
40
+ K as ThemeProvider,
41
+ S as createThemeService,
42
+ L as useTheme
19
43
  };