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