@floegence/floe-webapp-core 0.11.5 → 0.11.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/index102.js CHANGED
@@ -1,19 +1,25 @@
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
1
+ import { createSignal as h, createEffect as g, onCleanup as s } from "solid-js";
2
+ function w(c) {
3
+ const [d, n] = h(null);
4
+ return g(() => {
5
+ const e = c();
6
+ if (!e) return;
7
+ const r = e.getBoundingClientRect();
8
+ if (n({ width: r.width, height: r.height }), typeof ResizeObserver > "u") {
9
+ const t = () => n({ width: e.getBoundingClientRect().width, height: e.getBoundingClientRect().height });
10
+ typeof window < "u" && (window.addEventListener("resize", t), s(() => window.removeEventListener("resize", t)));
11
+ return;
12
+ }
13
+ const o = new ResizeObserver((t) => {
14
+ const i = t[0];
15
+ i && n({
16
+ width: i.contentRect.width,
17
+ height: i.contentRect.height
12
18
  });
13
19
  });
14
- n.observe(t), h(() => n.disconnect());
15
- }), r;
20
+ o.observe(e), s(() => o.disconnect());
21
+ }), d;
16
22
  }
17
23
  export {
18
- b as useResizeObserver
24
+ w as useResizeObserver
19
25
  };
package/dist/index97.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { createSignal as z, createEffect as G } from "solid-js";
2
- import { createStore as H, produce as l } from "solid-js/store";
3
- import { createSimpleContext as J } from "./index89.js";
4
- import { useResolvedFloeConfig as N } from "./index90.js";
5
- import { useWidgetRegistry as Q } from "./index96.js";
6
- import { hasCollision as D, constrainPosition as U, findFreePosition as V } from "./index111.js";
7
- function X() {
2
+ import { createStore as H, produce as l, unwrap as J } from "solid-js/store";
3
+ import { createSimpleContext as N } from "./index89.js";
4
+ import { useResolvedFloeConfig as Q } from "./index90.js";
5
+ import { useWidgetRegistry as U } from "./index96.js";
6
+ import { hasCollision as M, constrainPosition as V, findFreePosition as X } from "./index111.js";
7
+ function Y() {
8
8
  const d = Date.now();
9
9
  return [{
10
10
  id: "preset-default",
@@ -135,377 +135,390 @@ function X() {
135
135
  updatedAt: d
136
136
  }];
137
137
  }
138
- function Y(d) {
139
- if (!d || d.length === 0) return X();
140
- const g = Date.now();
141
- return d.map((p) => ({
142
- id: p.id,
143
- name: p.name,
144
- isPreset: p.isPreset ?? !0,
145
- widgets: p.widgets.map((y) => ({
146
- id: y.id,
147
- type: y.type,
148
- position: y.position,
149
- config: y.config,
150
- title: y.title
138
+ function Z(d) {
139
+ if (!d || d.length === 0) return Y();
140
+ const m = Date.now();
141
+ return d.map((y) => ({
142
+ id: y.id,
143
+ name: y.name,
144
+ isPreset: y.isPreset ?? !0,
145
+ widgets: y.widgets.map((w) => ({
146
+ id: w.id,
147
+ type: w.type,
148
+ position: w.position,
149
+ config: w.config,
150
+ title: w.title
151
151
  })),
152
- createdAt: g,
153
- updatedAt: g
152
+ createdAt: m,
153
+ updatedAt: m
154
154
  }));
155
155
  }
156
156
  const {
157
- Provider: st,
158
- use: at
159
- } = J({
157
+ Provider: at,
158
+ use: dt
159
+ } = N({
160
160
  name: "Deck",
161
- init: Z
161
+ init: _
162
162
  });
163
- function Z() {
164
- const d = N(), g = Q(), p = () => d.config.deck.storageKey, u = (d.config.deck.presetsMode ?? "mutable") === "immutable", S = (t) => {
165
- if (t === null || typeof t != "object") return t;
166
- if (t instanceof Date) return new Date(t.getTime());
167
- if (typeof structuredClone == "function")
168
- try {
169
- return structuredClone(t);
170
- } catch {
171
- }
172
- const o = /* @__PURE__ */ new WeakMap(), s = (e) => {
163
+ function _() {
164
+ const d = Q(), m = U(), y = () => d.config.deck.storageKey, u = (d.config.deck.presetsMode ?? "mutable") === "immutable", L = (e) => {
165
+ try {
173
166
  if (e === null || typeof e != "object") return e;
174
167
  if (e instanceof Date) return new Date(e.getTime());
175
- if (Array.isArray(e)) return e.map((i) => s(i));
176
- if (e instanceof Map) {
177
- const i = /* @__PURE__ */ new Map();
178
- for (const [a, v] of e.entries())
179
- i.set(s(a), s(v));
180
- return i;
181
- }
182
- if (e instanceof Set) {
183
- const i = /* @__PURE__ */ new Set();
184
- for (const a of e.values())
185
- i.add(s(a));
186
- return i;
187
- }
188
- if (o.has(e)) return o.get(e);
189
- const n = {};
190
- o.set(e, n);
191
- for (const [i, a] of Object.entries(e))
192
- n[i] = s(a);
193
- return n;
194
- };
195
- return s(t);
196
- }, B = (t) => {
197
- const o = {};
198
- for (const s of t.widgets ?? [])
199
- !s?.id || !s.state || (o[s.id] = s.state);
200
- return o;
201
- }, M = Y(d.config.deck.presets), F = new Set(M.map((t) => t.id)), w = d.persist.load(p(), {}), W = Array.isArray(w.layouts) ? w.layouts : [], T = new Map(W.map((t) => [t.id, t])), j = M.map((t) => {
202
- const o = T.get(t.id);
168
+ const i = J(e);
169
+ if (typeof structuredClone == "function")
170
+ try {
171
+ return structuredClone(i);
172
+ } catch {
173
+ }
174
+ const s = /* @__PURE__ */ new WeakMap(), n = (t) => {
175
+ if (t === null || typeof t != "object") return t;
176
+ if (t instanceof Date) return new Date(t.getTime());
177
+ if (Array.isArray(t)) {
178
+ const a = new Array(t.length);
179
+ for (let p = 0; p < t.length; p += 1)
180
+ a[p] = n(t[p]);
181
+ return a;
182
+ }
183
+ if (t instanceof Map) {
184
+ const a = /* @__PURE__ */ new Map();
185
+ for (const [p, P] of t.entries())
186
+ a.set(n(p), n(P));
187
+ return a;
188
+ }
189
+ if (t instanceof Set) {
190
+ const a = /* @__PURE__ */ new Set();
191
+ for (const p of t.values())
192
+ a.add(n(p));
193
+ return a;
194
+ }
195
+ if (s.has(t)) return s.get(t);
196
+ const o = {};
197
+ s.set(t, o);
198
+ for (const a of Object.keys(t))
199
+ try {
200
+ o[a] = n(t[a]);
201
+ } catch {
202
+ }
203
+ return o;
204
+ };
205
+ return n(i);
206
+ } catch {
207
+ return e;
208
+ }
209
+ }, B = (e) => {
210
+ const i = {};
211
+ for (const s of e.widgets ?? [])
212
+ !s?.id || !s.state || (i[s.id] = s.state);
213
+ return i;
214
+ }, h = Z(d.config.deck.presets), F = new Set(h.map((e) => e.id)), g = d.persist.load(y(), {}), W = Array.isArray(g.layouts) ? g.layouts : [], T = new Map(W.map((e) => [e.id, e])), j = h.map((e) => {
215
+ const i = T.get(e.id);
203
216
  if (!u)
204
- return o ? {
205
- ...o,
206
- isPreset: t.isPreset
207
- } : t;
208
- if (!t.isPreset)
209
- return o ? {
210
- ...o,
217
+ return i ? {
218
+ ...i,
219
+ isPreset: e.isPreset
220
+ } : e;
221
+ if (!e.isPreset)
222
+ return i ? {
223
+ ...i,
211
224
  isPreset: !1
212
- } : t;
213
- const s = (w.presetWidgetStateByLayoutId ?? {})[t.id] ?? {}, n = {
214
- ...o ? B(o) : {},
225
+ } : e;
226
+ const s = (g.presetWidgetStateByLayoutId ?? {})[e.id] ?? {}, t = {
227
+ ...i ? B(i) : {},
215
228
  ...s
216
229
  };
217
230
  return {
218
- ...t,
219
- widgets: t.widgets.map((i) => ({
220
- ...i,
221
- state: n[i.id] ? S(n[i.id]) : void 0
231
+ ...e,
232
+ widgets: e.widgets.map((o) => ({
233
+ ...o,
234
+ state: t[o.id] ? L(t[o.id]) : void 0
222
235
  }))
223
236
  };
224
- }), E = W.filter((t) => !t.isPreset && !F.has(t.id)), P = [...j, ...E], h = new Set(P.map((t) => t.id)), K = w.activeLayoutId && h.has(w.activeLayoutId) ? w.activeLayoutId : d.config.deck.defaultActiveLayoutId && h.has(d.config.deck.defaultActiveLayoutId) ? d.config.deck.defaultActiveLayoutId : P[0]?.id ?? "", O = {
225
- layouts: P,
237
+ }), E = W.filter((e) => !e.isPreset && !F.has(e.id)), I = [...j, ...E], k = new Set(I.map((e) => e.id)), K = g.activeLayoutId && k.has(g.activeLayoutId) ? g.activeLayoutId : d.config.deck.defaultActiveLayoutId && k.has(d.config.deck.defaultActiveLayoutId) ? d.config.deck.defaultActiveLayoutId : I[0]?.id ?? "", O = {
238
+ layouts: I,
226
239
  activeLayoutId: K,
227
240
  editMode: !1
228
- }, [r, c] = H(O), [k, L] = z(null), [x, I] = z(null), C = (t) => t;
241
+ }, [r, c] = H(O), [x, A] = z(null), [C, D] = z(null), R = (e) => e;
229
242
  G(() => {
230
- C(r.layouts.length);
231
- for (const e of r.layouts) C(e.updatedAt);
243
+ R(r.layouts.length);
244
+ for (const n of r.layouts) R(n.updatedAt);
232
245
  if (!u) {
233
- const e = {
246
+ const n = {
234
247
  layouts: r.layouts,
235
248
  activeLayoutId: r.activeLayoutId
236
249
  };
237
- d.persist.debouncedSave(p(), e);
250
+ d.persist.debouncedSave(y(), n);
238
251
  return;
239
252
  }
240
- const t = {}, o = [];
241
- for (const e of r.layouts) {
242
- if (e.isPreset) {
243
- const n = {};
244
- for (const i of e.widgets ?? [])
245
- !i?.id || !i.state || (n[i.id] = i.state);
246
- t[e.id] = n;
253
+ const e = {}, i = [];
254
+ for (const n of r.layouts) {
255
+ if (n.isPreset) {
256
+ const t = {};
257
+ for (const o of n.widgets ?? [])
258
+ !o?.id || !o.state || (t[o.id] = o.state);
259
+ e[n.id] = t;
247
260
  continue;
248
261
  }
249
- o.push(e);
262
+ i.push(n);
250
263
  }
251
264
  const s = {
252
- layouts: o,
265
+ layouts: i,
253
266
  activeLayoutId: r.activeLayoutId,
254
- presetWidgetStateByLayoutId: t
267
+ presetWidgetStateByLayoutId: e
255
268
  };
256
- d.persist.debouncedSave(p(), s);
269
+ d.persist.debouncedSave(y(), s);
257
270
  });
258
- const f = () => r.layouts.find((t) => t.id === r.activeLayoutId), m = () => `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
271
+ const f = () => r.layouts.find((e) => e.id === r.activeLayoutId), S = () => `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
259
272
  return {
260
273
  // Layout management
261
274
  layouts: () => r.layouts,
262
275
  activeLayoutId: () => r.activeLayoutId,
263
276
  activeLayout: f,
264
- setActiveLayout: (t) => {
265
- r.layouts.some((o) => o.id === t) && (c("activeLayoutId", t), u && r.layouts.find((s) => s.id === t)?.isPreset && c("editMode", !1));
277
+ setActiveLayout: (e) => {
278
+ r.layouts.some((i) => i.id === e) && (c("activeLayoutId", e), u && r.layouts.find((s) => s.id === e)?.isPreset && c("editMode", !1));
266
279
  },
267
- createLayout: (t, o) => {
280
+ createLayout: (e, i) => {
268
281
  const s = {
269
- id: m(),
270
- name: t,
271
- widgets: o ?? [],
282
+ id: S(),
283
+ name: e,
284
+ widgets: i ?? [],
272
285
  createdAt: Date.now(),
273
286
  updatedAt: Date.now()
274
287
  };
275
- return c(l((e) => {
276
- e.layouts.push(s), e.activeLayoutId = s.id;
288
+ return c(l((n) => {
289
+ n.layouts.push(s), n.activeLayoutId = s.id;
277
290
  })), s;
278
291
  },
279
- duplicateLayout: (t, o) => {
280
- const s = r.layouts.find((n) => n.id === t);
292
+ duplicateLayout: (e, i) => {
293
+ const s = r.layouts.find((t) => t.id === e);
281
294
  if (!s) return;
282
- const e = {
283
- id: m(),
284
- name: o,
285
- widgets: s.widgets.map((n) => ({
286
- ...n,
287
- id: m(),
295
+ const n = {
296
+ id: S(),
297
+ name: i,
298
+ widgets: s.widgets.map((t) => ({
299
+ ...t,
300
+ id: S(),
288
301
  position: {
289
- ...n.position
302
+ ...t.position
290
303
  },
291
- config: n.config ? S(n.config) : void 0,
292
- state: n.state ? S(n.state) : void 0
304
+ config: t.config ? L(t.config) : void 0,
305
+ state: t.state ? L(t.state) : void 0
293
306
  })),
294
307
  createdAt: Date.now(),
295
308
  updatedAt: Date.now()
296
309
  };
297
- return c(l((n) => {
298
- n.layouts.push(e), n.activeLayoutId = e.id;
299
- })), e;
310
+ return c(l((t) => {
311
+ t.layouts.push(n), t.activeLayoutId = n.id;
312
+ })), n;
300
313
  },
301
- deleteLayout: (t) => {
302
- const o = r.layouts.find((s) => s.id === t);
303
- !o || o.isPreset || c(l((s) => {
304
- const e = s.layouts.findIndex((n) => n.id === t);
305
- e !== -1 && (s.layouts.splice(e, 1), s.activeLayoutId === t && (s.activeLayoutId = s.layouts[0]?.id ?? ""));
314
+ deleteLayout: (e) => {
315
+ const i = r.layouts.find((s) => s.id === e);
316
+ !i || i.isPreset || c(l((s) => {
317
+ const n = s.layouts.findIndex((t) => t.id === e);
318
+ n !== -1 && (s.layouts.splice(n, 1), s.activeLayoutId === e && (s.activeLayoutId = s.layouts[0]?.id ?? ""));
306
319
  }));
307
320
  },
308
- renameLayout: (t, o) => {
309
- const s = r.layouts.find((e) => e.id === t);
310
- !s || s.isPreset || c(l((e) => {
311
- const n = e.layouts.find((i) => i.id === t);
312
- n && (n.name = o, n.updatedAt = Date.now());
321
+ renameLayout: (e, i) => {
322
+ const s = r.layouts.find((n) => n.id === e);
323
+ !s || s.isPreset || c(l((n) => {
324
+ const t = n.layouts.find((o) => o.id === e);
325
+ t && (t.name = i, t.updatedAt = Date.now());
313
326
  }));
314
327
  },
315
328
  // Edit mode
316
329
  editMode: () => r.editMode,
317
- setEditMode: (t) => {
318
- t && u && f()?.isPreset || c("editMode", t);
330
+ setEditMode: (e) => {
331
+ e && u && f()?.isPreset || c("editMode", e);
319
332
  },
320
333
  toggleEditMode: () => {
321
334
  !r.editMode && u && f()?.isPreset || c("editMode", !r.editMode);
322
335
  },
323
336
  // Widget management
324
- addWidget: (t, o, s) => {
325
- const e = f();
326
- if (!e || u && e.isPreset) return;
327
- const n = g.getWidget(t), i = {
328
- minColSpan: n?.minColSpan ?? 2,
329
- minRowSpan: n?.minRowSpan ?? 2
337
+ addWidget: (e, i, s) => {
338
+ const n = f();
339
+ if (!n || u && n.isPreset) return;
340
+ const t = m.getWidget(e), o = {
341
+ minColSpan: t?.minColSpan ?? 2,
342
+ minRowSpan: t?.minRowSpan ?? 2
330
343
  }, a = {
331
- colSpan: o?.colSpan ?? n?.defaultColSpan ?? Math.max(i.minColSpan, 4),
332
- rowSpan: o?.rowSpan ?? n?.defaultRowSpan ?? Math.max(i.minRowSpan, 3)
333
- }, v = o?.col !== void 0 && o?.row !== void 0 ? U({
344
+ colSpan: i?.colSpan ?? t?.defaultColSpan ?? Math.max(o.minColSpan, 4),
345
+ rowSpan: i?.rowSpan ?? t?.defaultRowSpan ?? Math.max(o.minRowSpan, 3)
346
+ }, p = i?.col !== void 0 && i?.row !== void 0 ? V({
334
347
  ...a,
335
- col: o.col,
336
- row: o.row
337
- }, i.minColSpan, i.minRowSpan) : V(e.widgets, a.colSpan, a.rowSpan), R = m(), $ = {
338
- id: R,
339
- type: t,
340
- position: v,
348
+ col: i.col,
349
+ row: i.row
350
+ }, o.minColSpan, o.minRowSpan) : X(n.widgets, a.colSpan, a.rowSpan), P = S(), $ = {
351
+ id: P,
352
+ type: e,
353
+ position: p,
341
354
  config: s
342
355
  };
343
356
  return c(l((b) => {
344
- const A = b.layouts.find((q) => q.id === b.activeLayoutId);
345
- A && (A.widgets.push($), A.updatedAt = Date.now());
346
- })), R;
357
+ const v = b.layouts.find((q) => q.id === b.activeLayoutId);
358
+ v && (v.widgets.push($), v.updatedAt = Date.now());
359
+ })), P;
347
360
  },
348
- removeWidget: (t) => {
349
- const o = f();
350
- u && o?.isPreset || c(l((s) => {
351
- const e = s.layouts.find((n) => n.id === s.activeLayoutId);
352
- if (e) {
353
- const n = e.widgets.findIndex((i) => i.id === t);
354
- n !== -1 && (e.widgets.splice(n, 1), e.updatedAt = Date.now());
361
+ removeWidget: (e) => {
362
+ const i = f();
363
+ u && i?.isPreset || c(l((s) => {
364
+ const n = s.layouts.find((t) => t.id === s.activeLayoutId);
365
+ if (n) {
366
+ const t = n.widgets.findIndex((o) => o.id === e);
367
+ t !== -1 && (n.widgets.splice(t, 1), n.updatedAt = Date.now());
355
368
  }
356
369
  }));
357
370
  },
358
- updateWidgetPosition: (t, o) => {
371
+ updateWidgetPosition: (e, i) => {
359
372
  const s = f();
360
- u && s?.isPreset || c(l((e) => {
361
- const n = e.layouts.find((i) => i.id === e.activeLayoutId);
362
- if (n) {
363
- const i = n.widgets.find((a) => a.id === t);
364
- i && (D(o, n.widgets, t) || (i.position = o, n.updatedAt = Date.now()));
373
+ u && s?.isPreset || c(l((n) => {
374
+ const t = n.layouts.find((o) => o.id === n.activeLayoutId);
375
+ if (t) {
376
+ const o = t.widgets.find((a) => a.id === e);
377
+ o && (M(i, t.widgets, e) || (o.position = i, t.updatedAt = Date.now()));
365
378
  }
366
379
  }));
367
380
  },
368
- updateWidgetConfig: (t, o) => {
381
+ updateWidgetConfig: (e, i) => {
369
382
  const s = f();
370
- u && s?.isPreset || c(l((e) => {
371
- const n = e.layouts.find((i) => i.id === e.activeLayoutId);
372
- if (n) {
373
- const i = n.widgets.find((a) => a.id === t);
374
- i && (i.config = {
375
- ...i.config,
376
- ...o
377
- }, n.updatedAt = Date.now());
383
+ u && s?.isPreset || c(l((n) => {
384
+ const t = n.layouts.find((o) => o.id === n.activeLayoutId);
385
+ if (t) {
386
+ const o = t.widgets.find((a) => a.id === e);
387
+ o && (o.config = {
388
+ ...o.config,
389
+ ...i
390
+ }, t.updatedAt = Date.now());
378
391
  }
379
392
  }));
380
393
  },
381
- updateWidgetTitle: (t, o) => {
394
+ updateWidgetTitle: (e, i) => {
382
395
  const s = f();
383
- u && s?.isPreset || c(l((e) => {
384
- const n = e.layouts.find((i) => i.id === e.activeLayoutId);
385
- if (n) {
386
- const i = n.widgets.find((a) => a.id === t);
387
- i && (i.title = o, n.updatedAt = Date.now());
396
+ u && s?.isPreset || c(l((n) => {
397
+ const t = n.layouts.find((o) => o.id === n.activeLayoutId);
398
+ if (t) {
399
+ const o = t.widgets.find((a) => a.id === e);
400
+ o && (o.title = i, t.updatedAt = Date.now());
388
401
  }
389
402
  }));
390
403
  },
391
- changeWidgetType: (t, o) => {
404
+ changeWidgetType: (e, i) => {
392
405
  const s = f();
393
- u && s?.isPreset || c(l((e) => {
394
- const n = e.layouts.find((i) => i.id === e.activeLayoutId);
395
- if (n) {
396
- const i = n.widgets.find((a) => a.id === t);
397
- i && (i.type = o, i.config = void 0, i.title = void 0, i.state = void 0, n.updatedAt = Date.now());
406
+ u && s?.isPreset || c(l((n) => {
407
+ const t = n.layouts.find((o) => o.id === n.activeLayoutId);
408
+ if (t) {
409
+ const o = t.widgets.find((a) => a.id === e);
410
+ o && (o.type = i, o.config = void 0, o.title = void 0, o.state = void 0, t.updatedAt = Date.now());
398
411
  }
399
412
  }));
400
413
  },
401
- updateWidgetState: (t, o, s) => {
402
- c(l((e) => {
403
- const n = e.layouts.find((i) => i.id === e.activeLayoutId);
404
- if (n) {
405
- const i = n.widgets.find((a) => a.id === t);
406
- i && (i.state || (i.state = {}), i.state[o] = s, n.updatedAt = Date.now());
414
+ updateWidgetState: (e, i, s) => {
415
+ c(l((n) => {
416
+ const t = n.layouts.find((o) => o.id === n.activeLayoutId);
417
+ if (t) {
418
+ const o = t.widgets.find((a) => a.id === e);
419
+ o && (o.state || (o.state = {}), o.state[i] = s, t.updatedAt = Date.now());
407
420
  }
408
421
  }));
409
422
  },
410
- getWidgetState: (t) => f()?.widgets.find((e) => e.id === t)?.state ?? {},
423
+ getWidgetState: (e) => f()?.widgets.find((n) => n.id === e)?.state ?? {},
411
424
  // Drag state
412
- dragState: k,
413
- startDrag: (t, o, s) => {
414
- const e = f();
415
- if (u && e?.isPreset) return;
416
- const n = e?.widgets.find((i) => i.id === t);
417
- n && L({
418
- widgetId: t,
425
+ dragState: x,
426
+ startDrag: (e, i, s) => {
427
+ const n = f();
428
+ if (u && n?.isPreset) return;
429
+ const t = n?.widgets.find((o) => o.id === e);
430
+ t && A({
431
+ widgetId: e,
419
432
  originalPosition: {
420
- ...n.position
433
+ ...t.position
421
434
  },
422
435
  currentPosition: {
423
- ...n.position
436
+ ...t.position
424
437
  },
425
438
  pixelOffset: {
426
439
  x: 0,
427
440
  y: 0
428
441
  },
429
- startX: o,
442
+ startX: i,
430
443
  startY: s
431
444
  });
432
445
  },
433
- updateDrag: (t, o) => {
434
- L((s) => s ? {
446
+ updateDrag: (e, i) => {
447
+ A((s) => s ? {
435
448
  ...s,
436
- currentPosition: t,
437
- pixelOffset: o
449
+ currentPosition: e,
450
+ pixelOffset: i
438
451
  } : null);
439
452
  },
440
- endDrag: (t) => {
441
- const o = k();
442
- if (o) {
443
- if (t) {
453
+ endDrag: (e) => {
454
+ const i = x();
455
+ if (i) {
456
+ if (e) {
444
457
  const s = f();
445
- s && !(u && s.isPreset) && !D(o.currentPosition, s.widgets, o.widgetId) && c(l((e) => {
446
- const n = e.layouts.find((i) => i.id === e.activeLayoutId);
447
- if (n) {
448
- const i = n.widgets.find((a) => a.id === o.widgetId);
449
- i && (i.position = o.currentPosition, n.updatedAt = Date.now());
458
+ s && !(u && s.isPreset) && !M(i.currentPosition, s.widgets, i.widgetId) && c(l((n) => {
459
+ const t = n.layouts.find((o) => o.id === n.activeLayoutId);
460
+ if (t) {
461
+ const o = t.widgets.find((a) => a.id === i.widgetId);
462
+ o && (o.position = i.currentPosition, t.updatedAt = Date.now());
450
463
  }
451
464
  }));
452
465
  }
453
- L(null);
466
+ A(null);
454
467
  }
455
468
  },
456
469
  // Resize state
457
- resizeState: x,
458
- startResize: (t, o, s, e) => {
459
- const n = f();
460
- if (u && n?.isPreset) return;
461
- const i = n?.widgets.find((a) => a.id === t);
462
- i && I({
463
- widgetId: t,
464
- edge: o,
470
+ resizeState: C,
471
+ startResize: (e, i, s, n) => {
472
+ const t = f();
473
+ if (u && t?.isPreset) return;
474
+ const o = t?.widgets.find((a) => a.id === e);
475
+ o && D({
476
+ widgetId: e,
477
+ edge: i,
465
478
  originalPosition: {
466
- ...i.position
479
+ ...o.position
467
480
  },
468
481
  currentPosition: {
469
- ...i.position
482
+ ...o.position
470
483
  },
471
484
  startX: s,
472
- startY: e
485
+ startY: n
473
486
  });
474
487
  },
475
- updateResize: (t) => {
476
- I((o) => o ? {
477
- ...o,
478
- currentPosition: t
488
+ updateResize: (e) => {
489
+ D((i) => i ? {
490
+ ...i,
491
+ currentPosition: e
479
492
  } : null);
480
493
  },
481
- endResize: (t) => {
482
- const o = x();
483
- if (o) {
484
- if (t) {
494
+ endResize: (e) => {
495
+ const i = C();
496
+ if (i) {
497
+ if (e) {
485
498
  const s = f();
486
- s && !(u && s.isPreset) && !D(o.currentPosition, s.widgets, o.widgetId) && c(l((e) => {
487
- const n = e.layouts.find((i) => i.id === e.activeLayoutId);
488
- if (n) {
489
- const i = n.widgets.find((a) => a.id === o.widgetId);
490
- i && (i.position = o.currentPosition, n.updatedAt = Date.now());
499
+ s && !(u && s.isPreset) && !M(i.currentPosition, s.widgets, i.widgetId) && c(l((n) => {
500
+ const t = n.layouts.find((o) => o.id === n.activeLayoutId);
501
+ if (t) {
502
+ const o = t.widgets.find((a) => a.id === i.widgetId);
503
+ o && (o.position = i.currentPosition, t.updatedAt = Date.now());
491
504
  }
492
505
  }));
493
506
  }
494
- I(null);
507
+ D(null);
495
508
  }
496
509
  },
497
510
  // Utilities
498
- getWidgetMinConstraints: (t) => {
499
- const o = g.getWidget(t);
511
+ getWidgetMinConstraints: (e) => {
512
+ const i = m.getWidget(e);
500
513
  return {
501
- minColSpan: o?.minColSpan ?? 2,
502
- minRowSpan: o?.minRowSpan ?? 2
514
+ minColSpan: i?.minColSpan ?? 2,
515
+ minRowSpan: i?.minRowSpan ?? 2
503
516
  };
504
517
  }
505
518
  };
506
519
  }
507
520
  export {
508
- st as DeckProvider,
509
- Z as createDeckService,
510
- at as useDeck
521
+ at as DeckProvider,
522
+ _ as createDeckService,
523
+ dt as useDeck
511
524
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.11.5",
3
+ "version": "0.11.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",