@floegence/floe-webapp-core 0.35.59 → 0.36.1
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.js +47 -50
- package/dist/components/deck/DeckContextMenu.d.ts +22 -0
- package/dist/components/deck/DeckContextMenu.js +73 -0
- package/dist/components/deck/DeckGrid.js +147 -104
- package/dist/components/deck/DeckTopBar.js +74 -96
- package/dist/components/deck/WidgetFrame.d.ts +7 -1
- package/dist/components/deck/WidgetFrame.js +60 -52
- package/dist/components/deck/index.d.ts +1 -0
- package/dist/components/layout/DisplayModePageShell.d.ts +8 -0
- package/dist/components/layout/DisplayModePageShell.js +22 -0
- package/dist/components/layout/DisplayModeSwitcher.d.ts +7 -0
- package/dist/components/layout/DisplayModeSwitcher.js +52 -0
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/components/ui/InfiniteCanvas.d.ts +2 -0
- package/dist/components/ui/InfiniteCanvas.js +43 -37
- package/dist/components/workbench/WorkbenchCanvas.d.ts +29 -0
- package/dist/components/workbench/WorkbenchCanvas.js +83 -0
- package/dist/components/workbench/WorkbenchContextMenu.d.ts +24 -0
- package/dist/components/workbench/WorkbenchContextMenu.js +44 -0
- package/dist/components/workbench/WorkbenchFilterBar.d.ts +17 -0
- package/dist/components/workbench/WorkbenchFilterBar.js +267 -0
- package/dist/components/workbench/WorkbenchHud.d.ts +6 -0
- package/dist/components/workbench/WorkbenchHud.js +17 -0
- package/dist/components/workbench/WorkbenchLockButton.d.ts +6 -0
- package/dist/components/workbench/WorkbenchLockButton.js +49 -0
- package/dist/components/workbench/WorkbenchOverlay.d.ts +18 -0
- package/dist/components/workbench/WorkbenchOverlay.js +107 -0
- package/dist/components/workbench/WorkbenchSurface.d.ts +34 -0
- package/dist/components/workbench/WorkbenchSurface.js +200 -0
- package/dist/components/workbench/WorkbenchWidget.d.ts +26 -0
- package/dist/components/workbench/WorkbenchWidget.js +192 -0
- package/dist/components/workbench/index.d.ts +7 -0
- package/dist/components/workbench/types.d.ts +56 -0
- package/dist/components/workbench/types.js +11 -0
- package/dist/components/workbench/useWorkbenchModel.d.ts +83 -0
- package/dist/components/workbench/useWorkbenchModel.js +284 -0
- package/dist/components/workbench/widgets/CodeEditorWidget.d.ts +1 -0
- package/dist/components/workbench/widgets/CodeEditorWidget.js +144 -0
- package/dist/components/workbench/widgets/FileBrowserWidget.d.ts +1 -0
- package/dist/components/workbench/widgets/FileBrowserWidget.js +142 -0
- package/dist/components/workbench/widgets/LogViewerWidget.d.ts +1 -0
- package/dist/components/workbench/widgets/LogViewerWidget.js +86 -0
- package/dist/components/workbench/widgets/SystemMonitorWidget.d.ts +1 -0
- package/dist/components/workbench/widgets/SystemMonitorWidget.js +122 -0
- package/dist/components/workbench/widgets/TerminalWidget.d.ts +1 -0
- package/dist/components/workbench/widgets/TerminalWidget.js +70 -0
- package/dist/components/workbench/widgets/widgetRegistry.d.ts +14 -0
- package/dist/components/workbench/widgets/widgetRegistry.js +71 -0
- package/dist/components/workbench/workbenchHelpers.d.ts +26 -0
- package/dist/components/workbench/workbenchHelpers.js +139 -0
- package/dist/deck.js +14 -12
- package/dist/display-mode.css +70 -0
- package/dist/full.js +475 -468
- package/dist/hooks/useDeckDrag.js +15 -15
- package/dist/layout.js +32 -27
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +2 -0
- package/dist/ui.css +4 -0
- package/dist/workbench.css +1220 -0
- package/dist/workbench.d.ts +1 -0
- package/dist/workbench.js +23 -0
- package/package.json +5 -1
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import { createMemo as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { useDeck as
|
|
5
|
-
import { useWidgetRegistry as
|
|
6
|
-
import { WidgetStateProvider as
|
|
7
|
-
import { positionToGridArea as
|
|
8
|
-
import { WidgetFrame as
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
const i =
|
|
12
|
-
i.updateWidgetState(e.widget.id,
|
|
13
|
-
},
|
|
1
|
+
import { insert as u, createComponent as n, Dynamic as D, effect as x, className as W, style as S, template as l } from "solid-js/web";
|
|
2
|
+
import { createMemo as d, Show as b } from "solid-js";
|
|
3
|
+
import { cn as C } from "../../utils/cn.js";
|
|
4
|
+
import { useDeck as z } from "../../context/DeckContext.js";
|
|
5
|
+
import { useWidgetRegistry as R } from "../../context/WidgetRegistry.js";
|
|
6
|
+
import { WidgetStateProvider as k } from "../../context/WidgetStateContext.js";
|
|
7
|
+
import { positionToGridArea as $ } from "../../utils/gridLayout.js";
|
|
8
|
+
import { WidgetFrame as M } from "./WidgetFrame.js";
|
|
9
|
+
var _ = /* @__PURE__ */ l("<div>"), A = /* @__PURE__ */ l('<div class="h-full flex items-center justify-center text-muted-foreground text-xs"><span>Widget: ');
|
|
10
|
+
function q(e) {
|
|
11
|
+
const i = z(), g = R(), m = () => i.editMode(), o = () => e.widget.type, a = d(() => g.getWidget(o())), f = d(() => $(e.position)), w = () => i.getWidgetState(e.widget.id), h = (t, r) => {
|
|
12
|
+
i.updateWidgetState(e.widget.id, t, r);
|
|
13
|
+
}, s = () => a()?.component, v = d(() => {
|
|
14
14
|
if (!e.isDragging || !e.pixelOffset) return {};
|
|
15
15
|
const {
|
|
16
|
-
x:
|
|
17
|
-
y:
|
|
16
|
+
x: t,
|
|
17
|
+
y: r
|
|
18
18
|
} = e.pixelOffset;
|
|
19
|
-
return
|
|
20
|
-
transform: `translate(${
|
|
19
|
+
return t === 0 && r === 0 ? {} : {
|
|
20
|
+
transform: `translate(${t}px, ${r}px)`
|
|
21
21
|
};
|
|
22
22
|
});
|
|
23
23
|
return (() => {
|
|
24
|
-
var
|
|
25
|
-
return
|
|
24
|
+
var t = _();
|
|
25
|
+
return u(t, n(M, {
|
|
26
26
|
get widget() {
|
|
27
27
|
return e.widget;
|
|
28
28
|
},
|
|
29
29
|
get widgetDef() {
|
|
30
|
-
return
|
|
30
|
+
return a();
|
|
31
31
|
},
|
|
32
32
|
get isDragging() {
|
|
33
33
|
return e.isDragging;
|
|
@@ -36,29 +36,28 @@ function H(e) {
|
|
|
36
36
|
return e.isResizing;
|
|
37
37
|
},
|
|
38
38
|
get children() {
|
|
39
|
-
|
|
40
|
-
return o(t, g(k, {
|
|
39
|
+
return n(b, {
|
|
41
40
|
get when() {
|
|
42
|
-
return
|
|
41
|
+
return s();
|
|
43
42
|
},
|
|
44
43
|
get fallback() {
|
|
45
|
-
return
|
|
44
|
+
return n(I, {
|
|
46
45
|
get type() {
|
|
47
|
-
return
|
|
46
|
+
return o();
|
|
48
47
|
}
|
|
49
48
|
});
|
|
50
49
|
},
|
|
51
50
|
get children() {
|
|
52
|
-
return
|
|
51
|
+
return n(k, {
|
|
53
52
|
get widgetId() {
|
|
54
53
|
return e.widget.id;
|
|
55
54
|
},
|
|
56
|
-
state:
|
|
57
|
-
onStateChange:
|
|
55
|
+
state: w,
|
|
56
|
+
onStateChange: h,
|
|
58
57
|
get children() {
|
|
59
|
-
return
|
|
58
|
+
return n(D, {
|
|
60
59
|
get component() {
|
|
61
|
-
return
|
|
60
|
+
return s();
|
|
62
61
|
},
|
|
63
62
|
get widgetId() {
|
|
64
63
|
return e.widget.id;
|
|
@@ -67,44 +66,42 @@ function H(e) {
|
|
|
67
66
|
return e.widget.config;
|
|
68
67
|
},
|
|
69
68
|
get isEditMode() {
|
|
70
|
-
return
|
|
69
|
+
return m();
|
|
71
70
|
}
|
|
72
71
|
});
|
|
73
72
|
}
|
|
74
73
|
});
|
|
75
74
|
}
|
|
76
|
-
})
|
|
75
|
+
});
|
|
77
76
|
}
|
|
78
|
-
})),
|
|
79
|
-
var
|
|
80
|
-
"deck-cell relative rounded-md overflow-hidden",
|
|
77
|
+
})), x((r) => {
|
|
78
|
+
var c = C(
|
|
79
|
+
"deck-cell relative rounded-md overflow-hidden group",
|
|
81
80
|
"bg-card border border-border",
|
|
82
81
|
// Smooth transition when not dragging (for snap-back animation)
|
|
83
82
|
!e.isDragging && "transition-transform duration-200 ease-out",
|
|
84
83
|
e.isDragging && "shadow-xl z-50 ring-2 ring-primary scale-[1.02]",
|
|
85
84
|
e.isResizing && "shadow-lg z-50 ring-2 ring-primary",
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
n() && "select-none cursor-grab",
|
|
85
|
+
!e.isDragging && !e.isResizing && "hover:ring-1 hover:ring-primary/50",
|
|
86
|
+
"select-none",
|
|
89
87
|
e.isDragging && "cursor-grabbing"
|
|
90
|
-
),
|
|
91
|
-
"grid-area":
|
|
92
|
-
...
|
|
93
|
-
}
|
|
94
|
-
return
|
|
88
|
+
), y = {
|
|
89
|
+
"grid-area": f(),
|
|
90
|
+
...v()
|
|
91
|
+
};
|
|
92
|
+
return c !== r.e && W(t, r.e = c), r.t = S(t, y, r.t), r;
|
|
95
93
|
}, {
|
|
96
94
|
e: void 0,
|
|
97
|
-
t: void 0
|
|
98
|
-
|
|
99
|
-
}), r;
|
|
95
|
+
t: void 0
|
|
96
|
+
}), t;
|
|
100
97
|
})();
|
|
101
98
|
}
|
|
102
|
-
function
|
|
99
|
+
function I(e) {
|
|
103
100
|
return (() => {
|
|
104
|
-
var i =
|
|
105
|
-
return
|
|
101
|
+
var i = A(), g = i.firstChild;
|
|
102
|
+
return g.firstChild, u(g, () => e.type, null), i;
|
|
106
103
|
})();
|
|
107
104
|
}
|
|
108
105
|
export {
|
|
109
|
-
|
|
106
|
+
q as DeckCell
|
|
110
107
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Component } from 'solid-js';
|
|
2
|
+
export interface DeckContextMenuItem {
|
|
3
|
+
type: string;
|
|
4
|
+
name: string;
|
|
5
|
+
icon?: Component<{
|
|
6
|
+
class?: string;
|
|
7
|
+
}>;
|
|
8
|
+
}
|
|
9
|
+
export interface DeckContextMenuProps {
|
|
10
|
+
open: boolean;
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
items: readonly DeckContextMenuItem[];
|
|
14
|
+
onSelect: (type: string) => void;
|
|
15
|
+
onDismiss: () => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Right-click context menu for the Deck grid.
|
|
19
|
+
* Shows when the user right-clicks empty grid space, offering to create
|
|
20
|
+
* a widget of any registered type at the clicked cell.
|
|
21
|
+
*/
|
|
22
|
+
export declare function DeckContextMenu(props: DeckContextMenuProps): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createComponent as l, Portal as f, insert as a, effect as g, className as h, setStyleProperty as u, template as i, delegateEvents as v } from "solid-js/web";
|
|
2
|
+
import { Show as c, For as p } from "solid-js";
|
|
3
|
+
import { cn as $ } from "../../utils/cn.js";
|
|
4
|
+
import { Plus as w } from "../icons/index.js";
|
|
5
|
+
var b = /* @__PURE__ */ i('<div class="fixed inset-0 z-[9998]">'), k = /* @__PURE__ */ i('<div role=menu><div class="px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/80 flex items-center gap-1.5">Add widget here'), y = /* @__PURE__ */ i('<div class="px-3 py-3 text-xs text-muted-foreground text-center">No widgets registered'), _ = /* @__PURE__ */ i('<button type=button role=menuitem class="w-full flex items-center gap-2 px-2.5 py-1.5 rounded hover:bg-muted transition-colors text-left cursor-pointer"><span class="text-xs text-foreground">'), C = /* @__PURE__ */ i('<div class="w-4 h-4 flex-shrink-0">');
|
|
6
|
+
function N(r) {
|
|
7
|
+
return l(c, {
|
|
8
|
+
get when() {
|
|
9
|
+
return r.open;
|
|
10
|
+
},
|
|
11
|
+
get children() {
|
|
12
|
+
return l(f, {
|
|
13
|
+
get children() {
|
|
14
|
+
return [(() => {
|
|
15
|
+
var t = b();
|
|
16
|
+
return t.$$contextmenu = (d) => {
|
|
17
|
+
d.preventDefault(), r.onDismiss();
|
|
18
|
+
}, t.$$click = () => r.onDismiss(), t;
|
|
19
|
+
})(), (() => {
|
|
20
|
+
var t = k(), d = t.firstChild, m = d.firstChild;
|
|
21
|
+
return a(d, l(w, {
|
|
22
|
+
class: "w-2.5 h-2.5"
|
|
23
|
+
}), m), a(t, l(c, {
|
|
24
|
+
get when() {
|
|
25
|
+
return r.items.length > 0;
|
|
26
|
+
},
|
|
27
|
+
get fallback() {
|
|
28
|
+
return y();
|
|
29
|
+
},
|
|
30
|
+
get children() {
|
|
31
|
+
return l(p, {
|
|
32
|
+
get each() {
|
|
33
|
+
return r.items;
|
|
34
|
+
},
|
|
35
|
+
children: (e) => (() => {
|
|
36
|
+
var n = _(), o = n.firstChild;
|
|
37
|
+
return n.$$click = () => {
|
|
38
|
+
r.onSelect(e.type);
|
|
39
|
+
}, a(n, l(c, {
|
|
40
|
+
get when() {
|
|
41
|
+
return e.icon;
|
|
42
|
+
},
|
|
43
|
+
get fallback() {
|
|
44
|
+
return C();
|
|
45
|
+
},
|
|
46
|
+
children: (s) => {
|
|
47
|
+
const x = s();
|
|
48
|
+
return l(x, {
|
|
49
|
+
class: "w-4 h-4 text-muted-foreground flex-shrink-0"
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}), o), a(o, () => e.name), n;
|
|
53
|
+
})()
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}), null), g((e) => {
|
|
57
|
+
var n = $("fixed z-[9999] min-w-[180px] max-h-[320px] overflow-y-auto", "bg-popover border border-border rounded-md shadow-xl", "animate-in fade-in slide-in-from-top-1 duration-150", "p-1"), o = `${r.y}px`, s = `${r.x}px`;
|
|
58
|
+
return n !== e.e && h(t, e.e = n), o !== e.t && u(t, "top", e.t = o), s !== e.a && u(t, "left", e.a = s), e;
|
|
59
|
+
}, {
|
|
60
|
+
e: void 0,
|
|
61
|
+
t: void 0,
|
|
62
|
+
a: void 0
|
|
63
|
+
}), t;
|
|
64
|
+
})()];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
v(["click", "contextmenu"]);
|
|
71
|
+
export {
|
|
72
|
+
N as DeckContextMenu
|
|
73
|
+
};
|
|
@@ -1,75 +1,102 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { useDeck as
|
|
5
|
-
import { useLayout as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { insert as h, createComponent as m, effect as F, setStyleProperty as v, className as J, setAttribute as Q, template as W, use as tt, delegateEvents as et } from "solid-js/web";
|
|
2
|
+
import { createSignal as O, createMemo as d, onMount as rt, Show as G, For as nt, onCleanup as ot } from "solid-js";
|
|
3
|
+
import { cn as it } from "../../utils/cn.js";
|
|
4
|
+
import { useDeck as at } from "../../context/DeckContext.js";
|
|
5
|
+
import { useLayout as st } from "../../context/LayoutContext.js";
|
|
6
|
+
import { useResolvedFloeConfig as ct } from "../../context/FloeConfigContext.js";
|
|
7
|
+
import { useWidgetRegistry as lt } from "../../context/WidgetRegistry.js";
|
|
8
|
+
import { hasCollision as dt } from "../../utils/gridCollision.js";
|
|
9
|
+
import { DeckCell as ut } from "./DeckCell.js";
|
|
10
|
+
import { DeckContextMenu as gt } from "./DeckContextMenu.js";
|
|
11
|
+
import { DropZonePreview as pt } from "./DropZonePreview.js";
|
|
12
|
+
var ft = /* @__PURE__ */ W('<div class="pointer-events-none z-0"style="grid-column:1 / -1;--deck-grid-unit-x:calc((100% - 92px) / 24 + 4px);background-position:0 0, 0 0, 0 0, 0 0, 0 0, 0 0">'), mt = /* @__PURE__ */ W('<div data-grid-cols=24 data-gap=4 data-default-rows=24 style="scrollbar-gutter:stable;grid-template-columns:repeat(24, 1fr);gap:4px"><div class=pointer-events-none aria-hidden=true style="grid-column:1 / -1">');
|
|
13
|
+
const T = 24, u = 24, x = 4, k = 20, L = 4, vt = {
|
|
11
14
|
x: 0,
|
|
12
15
|
y: 0
|
|
13
16
|
};
|
|
14
|
-
function
|
|
15
|
-
const
|
|
16
|
-
let
|
|
17
|
-
const [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
function Dt(g) {
|
|
18
|
+
const p = at(), I = st(), A = lt(), N = ct();
|
|
19
|
+
let a;
|
|
20
|
+
const [S, D] = O(0), [w, R] = O(null), P = () => p.activeLayout()?.widgets ?? [], f = () => p.dragState(), M = () => p.resizeState(), z = () => !I.isMobile(), _ = () => (N.config.deck.presetsMode ?? "mutable") === "immutable" && !!p.activeLayout()?.isPreset, E = d(() => Array.from(A.widgets().values()).map((t) => ({
|
|
21
|
+
type: t.type,
|
|
22
|
+
name: t.name,
|
|
23
|
+
icon: t.icon
|
|
24
|
+
}))), $ = (t) => {
|
|
25
|
+
if (I.isMobile() || _() || t.target?.closest(".deck-cell") || !a) return;
|
|
26
|
+
t.preventDefault();
|
|
27
|
+
const n = a.getBoundingClientRect(), {
|
|
28
|
+
cols: e,
|
|
29
|
+
rowHeight: o,
|
|
30
|
+
gap: s
|
|
31
|
+
} = ht(a), c = window.getComputedStyle(a), l = parseFloat(c.paddingLeft) || 0, i = parseFloat(c.paddingTop) || 0, H = (a.clientWidth - l - (parseFloat(c.paddingRight) || 0) - s * (e - 1)) / e, V = o + s;
|
|
32
|
+
if (!Number.isFinite(H) || H <= 0) return;
|
|
33
|
+
const Z = t.clientX - n.left + a.scrollLeft - l, K = t.clientY - n.top + a.scrollTop - i, U = Math.max(0, Math.min(e - 1, Math.floor(Z / (H + s)))), q = Math.max(0, Math.floor(K / V));
|
|
34
|
+
R({
|
|
35
|
+
x: t.clientX,
|
|
36
|
+
y: t.clientY,
|
|
37
|
+
col: U,
|
|
38
|
+
row: q
|
|
39
|
+
});
|
|
40
|
+
}, B = (t) => {
|
|
41
|
+
const r = w();
|
|
42
|
+
R(null), r && p.addWidget(t, {
|
|
43
|
+
col: r.col,
|
|
44
|
+
row: r.row
|
|
45
|
+
});
|
|
46
|
+
}, X = d(() => {
|
|
47
|
+
const t = f();
|
|
48
|
+
if (!t) return !0;
|
|
49
|
+
const r = p.activeLayout();
|
|
50
|
+
return r ? !dt(t.currentPosition, r.widgets, t.widgetId) : !0;
|
|
51
|
+
}), Y = d(() => {
|
|
52
|
+
const t = P();
|
|
53
|
+
if (t.length === 0) return u;
|
|
54
|
+
let r = u;
|
|
55
|
+
for (const n of t) {
|
|
56
|
+
const e = n.position.row + n.position.rowSpan;
|
|
57
|
+
e > r && (r = e);
|
|
33
58
|
}
|
|
34
|
-
return
|
|
35
|
-
}),
|
|
36
|
-
let
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
39
|
-
const
|
|
40
|
-
|
|
59
|
+
return r;
|
|
60
|
+
}), C = d(() => {
|
|
61
|
+
let t = Y();
|
|
62
|
+
const r = f();
|
|
63
|
+
if (r) {
|
|
64
|
+
const e = r.currentPosition.row + r.currentPosition.rowSpan;
|
|
65
|
+
e > t && (t = e);
|
|
41
66
|
}
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
const
|
|
45
|
-
|
|
67
|
+
const n = M();
|
|
68
|
+
if (n) {
|
|
69
|
+
const e = n.currentPosition.row + n.currentPosition.rowSpan;
|
|
70
|
+
e > t && (t = e);
|
|
46
71
|
}
|
|
47
|
-
return Math.max(
|
|
48
|
-
}),
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
const
|
|
52
|
-
return Math.max(
|
|
72
|
+
return Math.max(u, t);
|
|
73
|
+
}), b = d(() => {
|
|
74
|
+
const t = S();
|
|
75
|
+
if (t <= 0) return k;
|
|
76
|
+
const n = (t - L * 2 - (u - 1) * x) / u;
|
|
77
|
+
return Math.max(k, n);
|
|
53
78
|
});
|
|
54
|
-
|
|
55
|
-
if (!
|
|
56
|
-
const
|
|
57
|
-
for (const
|
|
58
|
-
|
|
79
|
+
rt(() => {
|
|
80
|
+
if (!a || typeof ResizeObserver > "u") return;
|
|
81
|
+
const t = new ResizeObserver((r) => {
|
|
82
|
+
for (const n of r)
|
|
83
|
+
D(n.contentRect.height);
|
|
59
84
|
});
|
|
60
|
-
|
|
85
|
+
t.observe(a), D(a.clientHeight), ot(() => t.disconnect());
|
|
61
86
|
});
|
|
62
|
-
const
|
|
87
|
+
const j = d(() => C() > u ? !0 : S() <= 0 ? !1 : u * b() + (u - 1) * x + L * 2 > S() + 1);
|
|
63
88
|
return (() => {
|
|
64
|
-
var
|
|
65
|
-
|
|
89
|
+
var t = mt(), r = t.firstChild;
|
|
90
|
+
t.$$contextmenu = $;
|
|
91
|
+
var n = a;
|
|
92
|
+
return typeof n == "function" ? tt(n, t) : a = t, h(t, m(G, {
|
|
66
93
|
get when() {
|
|
67
|
-
return
|
|
94
|
+
return z();
|
|
68
95
|
},
|
|
69
96
|
get children() {
|
|
70
|
-
var
|
|
71
|
-
return
|
|
72
|
-
var
|
|
97
|
+
var e = ft();
|
|
98
|
+
return F((o) => {
|
|
99
|
+
var s = `1 / ${C() + 1}`, c = `${b() + x}px`, l = [
|
|
73
100
|
// Fine
|
|
74
101
|
"linear-gradient(to right, color-mix(in srgb, var(--border) 35%, transparent) 1px, transparent 1px)",
|
|
75
102
|
"linear-gradient(to bottom, color-mix(in srgb, var(--border) 35%, transparent) 1px, transparent 1px)",
|
|
@@ -79,7 +106,7 @@ function st(d) {
|
|
|
79
106
|
// Major (12)
|
|
80
107
|
"linear-gradient(to right, color-mix(in srgb, var(--border) 75%, transparent) 2px, transparent 2px)",
|
|
81
108
|
"linear-gradient(to bottom, color-mix(in srgb, var(--border) 75%, transparent) 2px, transparent 2px)"
|
|
82
|
-
].join(", "),
|
|
109
|
+
].join(", "), i = [
|
|
83
110
|
// Fine
|
|
84
111
|
"var(--deck-grid-unit-x) var(--deck-grid-unit-y)",
|
|
85
112
|
"var(--deck-grid-unit-x) var(--deck-grid-unit-y)",
|
|
@@ -90,92 +117,108 @@ function st(d) {
|
|
|
90
117
|
"calc(var(--deck-grid-unit-x) * 12) calc(var(--deck-grid-unit-y) * 12)",
|
|
91
118
|
"calc(var(--deck-grid-unit-x) * 12) calc(var(--deck-grid-unit-y) * 12)"
|
|
92
119
|
].join(", ");
|
|
93
|
-
return
|
|
120
|
+
return s !== o.e && v(e, "grid-row", o.e = s), c !== o.t && v(e, "--deck-grid-unit-y", o.t = c), l !== o.a && v(e, "background-image", o.a = l), i !== o.o && v(e, "background-size", o.o = i), o;
|
|
94
121
|
}, {
|
|
95
122
|
e: void 0,
|
|
96
123
|
t: void 0,
|
|
97
124
|
a: void 0,
|
|
98
125
|
o: void 0
|
|
99
|
-
}),
|
|
126
|
+
}), e;
|
|
100
127
|
}
|
|
101
|
-
}), null),
|
|
128
|
+
}), null), h(t, m(G, {
|
|
102
129
|
get when() {
|
|
103
130
|
return f();
|
|
104
131
|
},
|
|
105
|
-
children: (
|
|
132
|
+
children: (e) => m(pt, {
|
|
106
133
|
get position() {
|
|
107
|
-
return
|
|
134
|
+
return e().currentPosition;
|
|
108
135
|
},
|
|
109
136
|
get isValid() {
|
|
110
|
-
return
|
|
137
|
+
return X();
|
|
111
138
|
}
|
|
112
139
|
})
|
|
113
|
-
}), null),
|
|
140
|
+
}), null), h(t, m(nt, {
|
|
114
141
|
get each() {
|
|
115
|
-
return
|
|
142
|
+
return P();
|
|
116
143
|
},
|
|
117
|
-
children: (
|
|
118
|
-
const
|
|
119
|
-
const
|
|
120
|
-
if (
|
|
121
|
-
return
|
|
122
|
-
const
|
|
123
|
-
return
|
|
124
|
-
}),
|
|
125
|
-
const
|
|
126
|
-
return
|
|
144
|
+
children: (e) => {
|
|
145
|
+
const o = d(() => {
|
|
146
|
+
const i = f();
|
|
147
|
+
if (i && i.widgetId === e.id)
|
|
148
|
+
return e.position;
|
|
149
|
+
const y = M();
|
|
150
|
+
return y && y.widgetId === e.id ? y.currentPosition : e.position;
|
|
151
|
+
}), s = d(() => f()?.widgetId === e.id), c = d(() => M()?.widgetId === e.id), l = d(() => {
|
|
152
|
+
const i = f();
|
|
153
|
+
return i && i.widgetId === e.id ? i.pixelOffset : vt;
|
|
127
154
|
});
|
|
128
|
-
return m(
|
|
129
|
-
widget:
|
|
155
|
+
return m(ut, {
|
|
156
|
+
widget: e,
|
|
130
157
|
get position() {
|
|
131
|
-
return
|
|
158
|
+
return o();
|
|
132
159
|
},
|
|
133
160
|
get isDragging() {
|
|
134
|
-
return
|
|
161
|
+
return s();
|
|
135
162
|
},
|
|
136
163
|
get isResizing() {
|
|
137
|
-
return
|
|
164
|
+
return c();
|
|
138
165
|
},
|
|
139
166
|
get pixelOffset() {
|
|
140
|
-
return
|
|
167
|
+
return l();
|
|
141
168
|
}
|
|
142
169
|
});
|
|
143
170
|
}
|
|
144
|
-
}), null),
|
|
145
|
-
|
|
171
|
+
}), null), h(t, () => g.children, null), h(t, m(gt, {
|
|
172
|
+
get open() {
|
|
173
|
+
return w() !== null;
|
|
174
|
+
},
|
|
175
|
+
get x() {
|
|
176
|
+
return w()?.x ?? 0;
|
|
177
|
+
},
|
|
178
|
+
get y() {
|
|
179
|
+
return w()?.y ?? 0;
|
|
180
|
+
},
|
|
181
|
+
get items() {
|
|
182
|
+
return E();
|
|
183
|
+
},
|
|
184
|
+
onSelect: B,
|
|
185
|
+
onDismiss: () => R(null)
|
|
186
|
+
}), null), F((e) => {
|
|
187
|
+
var o = it(
|
|
146
188
|
"deck-grid relative w-full h-full overflow-x-hidden",
|
|
147
189
|
// Only enable vertical scroll when content exceeds 24 rows
|
|
148
|
-
|
|
190
|
+
j() ? "overflow-y-scroll" : "overflow-y-hidden",
|
|
149
191
|
"grid p-1",
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
),
|
|
153
|
-
return
|
|
192
|
+
z() && "bg-muted/20",
|
|
193
|
+
g.class
|
|
194
|
+
), s = `${b()}px`, c = b(), l = `1 / ${C() + 1}`;
|
|
195
|
+
return o !== e.e && J(t, e.e = o), s !== e.t && v(t, "grid-auto-rows", e.t = s), c !== e.a && Q(t, "data-row-height", e.a = c), l !== e.o && v(r, "grid-row", e.o = l), e;
|
|
154
196
|
}, {
|
|
155
197
|
e: void 0,
|
|
156
198
|
t: void 0,
|
|
157
199
|
a: void 0,
|
|
158
200
|
o: void 0
|
|
159
|
-
}),
|
|
201
|
+
}), t;
|
|
160
202
|
})();
|
|
161
203
|
}
|
|
162
|
-
const
|
|
163
|
-
cols:
|
|
164
|
-
defaultRows:
|
|
204
|
+
const Pt = {
|
|
205
|
+
cols: T,
|
|
206
|
+
defaultRows: u,
|
|
165
207
|
gap: x,
|
|
166
208
|
// Deprecated: use getGridConfig() or read from data-row-height attribute instead
|
|
167
|
-
rowHeight:
|
|
209
|
+
rowHeight: k
|
|
168
210
|
};
|
|
169
|
-
function
|
|
211
|
+
function ht(g) {
|
|
170
212
|
return {
|
|
171
|
-
cols: parseInt(
|
|
172
|
-
rowHeight: parseFloat(
|
|
173
|
-
gap: parseInt(
|
|
174
|
-
defaultRows: parseInt(
|
|
213
|
+
cols: parseInt(g.dataset.gridCols || String(T), 10),
|
|
214
|
+
rowHeight: parseFloat(g.dataset.rowHeight || String(k)),
|
|
215
|
+
gap: parseInt(g.dataset.gap || String(x), 10),
|
|
216
|
+
defaultRows: parseInt(g.dataset.defaultRows || String(u), 10)
|
|
175
217
|
};
|
|
176
218
|
}
|
|
219
|
+
et(["contextmenu"]);
|
|
177
220
|
export {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
221
|
+
Pt as DECK_GRID_CONFIG,
|
|
222
|
+
Dt as DeckGrid,
|
|
223
|
+
ht as getGridConfigFromElement
|
|
181
224
|
};
|