@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
|
@@ -5,11 +5,6 @@ export interface DeckCellProps {
|
|
|
5
5
|
position: GridPosition;
|
|
6
6
|
isDragging?: boolean;
|
|
7
7
|
isResizing?: boolean;
|
|
8
|
-
/** Pixel offset for smooth drag following */
|
|
9
|
-
pixelOffset?: {
|
|
10
|
-
x: number;
|
|
11
|
-
y: number;
|
|
12
|
-
};
|
|
13
8
|
}
|
|
14
9
|
/**
|
|
15
10
|
* Widget cell wrapper positioned via CSS grid-area
|
|
@@ -1,33 +1,24 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import { createMemo as
|
|
3
|
-
import { cn as
|
|
1
|
+
import { insert as m, createComponent as n, Dynamic as D, effect as W, setAttribute as b, className as S, setStyleProperty as C, template as f } from "solid-js/web";
|
|
2
|
+
import { createMemo as l, Show as k } from "solid-js";
|
|
3
|
+
import { cn as x } from "../../utils/cn.js";
|
|
4
4
|
import { useDeck as z } from "../../context/DeckContext.js";
|
|
5
5
|
import { useWidgetRegistry as R } from "../../context/WidgetRegistry.js";
|
|
6
|
-
import { WidgetStateProvider as
|
|
7
|
-
import { positionToGridArea as
|
|
8
|
-
import { WidgetFrame as
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
if (!e.isDragging || !e.pixelOffset) return {};
|
|
15
|
-
const {
|
|
16
|
-
x: t,
|
|
17
|
-
y: r
|
|
18
|
-
} = e.pixelOffset;
|
|
19
|
-
return t === 0 && r === 0 ? {} : {
|
|
20
|
-
transform: `translate(${t}px, ${r}px)`
|
|
21
|
-
};
|
|
22
|
-
});
|
|
6
|
+
import { WidgetStateProvider as M } from "../../context/WidgetStateContext.js";
|
|
7
|
+
import { positionToGridArea as A } from "../../utils/gridLayout.js";
|
|
8
|
+
import { WidgetFrame as P } from "./WidgetFrame.js";
|
|
9
|
+
var I = /* @__PURE__ */ f("<div data-floe-dialog-surface-host=true>"), T = /* @__PURE__ */ f('<div class="h-full flex items-center justify-center text-muted-foreground text-xs"><span>Widget: ');
|
|
10
|
+
function H(e) {
|
|
11
|
+
const r = z(), g = R(), w = () => r.editMode(), d = () => e.widget.type, o = l(() => g.getWidget(d())), h = l(() => A(e.position)), v = () => r.getWidgetState(e.widget.id), y = (i, t) => {
|
|
12
|
+
r.updateWidgetState(e.widget.id, i, t);
|
|
13
|
+
}, a = () => o()?.component;
|
|
23
14
|
return (() => {
|
|
24
|
-
var
|
|
25
|
-
return
|
|
15
|
+
var i = I();
|
|
16
|
+
return m(i, n(P, {
|
|
26
17
|
get widget() {
|
|
27
18
|
return e.widget;
|
|
28
19
|
},
|
|
29
20
|
get widgetDef() {
|
|
30
|
-
return
|
|
21
|
+
return o();
|
|
31
22
|
},
|
|
32
23
|
get isDragging() {
|
|
33
24
|
return e.isDragging;
|
|
@@ -36,28 +27,28 @@ function q(e) {
|
|
|
36
27
|
return e.isResizing;
|
|
37
28
|
},
|
|
38
29
|
get children() {
|
|
39
|
-
return n(
|
|
30
|
+
return n(k, {
|
|
40
31
|
get when() {
|
|
41
|
-
return
|
|
32
|
+
return a();
|
|
42
33
|
},
|
|
43
34
|
get fallback() {
|
|
44
|
-
return n(
|
|
35
|
+
return n(_, {
|
|
45
36
|
get type() {
|
|
46
|
-
return
|
|
37
|
+
return d();
|
|
47
38
|
}
|
|
48
39
|
});
|
|
49
40
|
},
|
|
50
41
|
get children() {
|
|
51
|
-
return n(
|
|
42
|
+
return n(M, {
|
|
52
43
|
get widgetId() {
|
|
53
44
|
return e.widget.id;
|
|
54
45
|
},
|
|
55
|
-
state:
|
|
56
|
-
onStateChange:
|
|
46
|
+
state: v,
|
|
47
|
+
onStateChange: y,
|
|
57
48
|
get children() {
|
|
58
49
|
return n(D, {
|
|
59
50
|
get component() {
|
|
60
|
-
return
|
|
51
|
+
return a();
|
|
61
52
|
},
|
|
62
53
|
get widgetId() {
|
|
63
54
|
return e.widget.id;
|
|
@@ -66,7 +57,7 @@ function q(e) {
|
|
|
66
57
|
return e.widget.config;
|
|
67
58
|
},
|
|
68
59
|
get isEditMode() {
|
|
69
|
-
return
|
|
60
|
+
return w();
|
|
70
61
|
}
|
|
71
62
|
});
|
|
72
63
|
}
|
|
@@ -74,8 +65,8 @@ function q(e) {
|
|
|
74
65
|
}
|
|
75
66
|
});
|
|
76
67
|
}
|
|
77
|
-
})),
|
|
78
|
-
var c =
|
|
68
|
+
})), W((t) => {
|
|
69
|
+
var c = e.widget.id, s = x(
|
|
79
70
|
"deck-cell relative rounded-md overflow-hidden group",
|
|
80
71
|
"bg-card border border-border",
|
|
81
72
|
// Smooth transition when not dragging (for snap-back animation)
|
|
@@ -85,23 +76,21 @@ function q(e) {
|
|
|
85
76
|
!e.isDragging && !e.isResizing && "hover:ring-1 hover:ring-primary/50",
|
|
86
77
|
"select-none",
|
|
87
78
|
e.isDragging && "cursor-grabbing"
|
|
88
|
-
),
|
|
89
|
-
|
|
90
|
-
...v()
|
|
91
|
-
};
|
|
92
|
-
return c !== r.e && W(t, r.e = c), r.t = S(t, y, r.t), r;
|
|
79
|
+
), u = h();
|
|
80
|
+
return c !== t.e && b(i, "data-floe-deck-widget-id", t.e = c), s !== t.t && S(i, t.t = s), u !== t.a && C(i, "grid-area", t.a = u), t;
|
|
93
81
|
}, {
|
|
94
82
|
e: void 0,
|
|
95
|
-
t: void 0
|
|
96
|
-
|
|
83
|
+
t: void 0,
|
|
84
|
+
a: void 0
|
|
85
|
+
}), i;
|
|
97
86
|
})();
|
|
98
87
|
}
|
|
99
|
-
function
|
|
88
|
+
function _(e) {
|
|
100
89
|
return (() => {
|
|
101
|
-
var
|
|
102
|
-
return g.firstChild,
|
|
90
|
+
var r = T(), g = r.firstChild;
|
|
91
|
+
return g.firstChild, m(g, () => e.type, null), r;
|
|
103
92
|
})();
|
|
104
93
|
}
|
|
105
94
|
export {
|
|
106
|
-
|
|
95
|
+
H as DeckCell
|
|
107
96
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type JSX } from 'solid-js';
|
|
2
|
+
import { DECK_GRID_CONFIG, getGridConfigFromElement } from './deckGridMetrics';
|
|
2
3
|
export interface DeckGridProps {
|
|
3
4
|
class?: string;
|
|
4
5
|
children?: JSX.Element;
|
|
@@ -12,19 +13,4 @@ export interface DeckGridProps {
|
|
|
12
13
|
* 3. Row height is calculated dynamically based on container height
|
|
13
14
|
*/
|
|
14
15
|
export declare function DeckGrid(props: DeckGridProps): JSX.Element;
|
|
15
|
-
export
|
|
16
|
-
cols: number;
|
|
17
|
-
defaultRows: number;
|
|
18
|
-
gap: number;
|
|
19
|
-
rowHeight: number;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Get grid configuration from the DOM element
|
|
23
|
-
* Use this for accurate row height during drag/resize operations
|
|
24
|
-
*/
|
|
25
|
-
export declare function getGridConfigFromElement(gridEl: HTMLElement): {
|
|
26
|
-
cols: number;
|
|
27
|
-
rowHeight: number;
|
|
28
|
-
gap: number;
|
|
29
|
-
defaultRows: number;
|
|
30
|
-
};
|
|
16
|
+
export { DECK_GRID_CONFIG, getGridConfigFromElement };
|
|
@@ -1,55 +1,54 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { useDeck as
|
|
5
|
-
import { useLayout as
|
|
6
|
-
import { useResolvedFloeConfig as
|
|
7
|
-
import { useWidgetRegistry as
|
|
8
|
-
import { hasCollision as
|
|
9
|
-
import { DeckCell as
|
|
10
|
-
import { DeckContextMenu as
|
|
11
|
-
import { DropZonePreview as
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const p = at(), I = st(), A = lt(), N = ct();
|
|
1
|
+
import { setStyleProperty as l, setAttribute as b, insert as h, createComponent as f, effect as G, className as J, template as W, use as Q, delegateEvents as tt } from "solid-js/web";
|
|
2
|
+
import { createSignal as _, createMemo as d, onMount as et, Show as E, For as rt, onCleanup as nt } from "solid-js";
|
|
3
|
+
import { cn as ot } from "../../utils/cn.js";
|
|
4
|
+
import { useDeck as it } from "../../context/DeckContext.js";
|
|
5
|
+
import { useLayout as at } from "../../context/LayoutContext.js";
|
|
6
|
+
import { useResolvedFloeConfig as st } from "../../context/FloeConfigContext.js";
|
|
7
|
+
import { useWidgetRegistry as ct } from "../../context/WidgetRegistry.js";
|
|
8
|
+
import { hasCollision as lt } from "../../utils/gridCollision.js";
|
|
9
|
+
import { DeckCell as dt } from "./DeckCell.js";
|
|
10
|
+
import { DeckContextMenu as ut } from "./DeckContextMenu.js";
|
|
11
|
+
import { DropZonePreview as gt } from "./DropZonePreview.js";
|
|
12
|
+
import { DECK_DEFAULT_ROWS as u, DECK_MIN_ROW_HEIGHT as L, DECK_GAP as m, DECK_PADDING as F, DECK_GRID_COLS as y, getGridConfigFromElement as mt } from "./deckGridMetrics.js";
|
|
13
|
+
import { DECK_GRID_CONFIG as _t } from "./deckGridMetrics.js";
|
|
14
|
+
var pt = /* @__PURE__ */ W('<div class="pointer-events-none z-0"style="grid-column:1 / -1;background-position:0 0, 0 0, 0 0, 0 0, 0 0, 0 0">'), ft = /* @__PURE__ */ W('<div style=scrollbar-gutter:stable><div class=pointer-events-none aria-hidden=true style="grid-column:1 / -1">');
|
|
15
|
+
const vt = (y - 1) * m;
|
|
16
|
+
function It(R) {
|
|
17
|
+
const p = it(), P = at(), $ = ct(), T = st();
|
|
19
18
|
let a;
|
|
20
|
-
const [
|
|
19
|
+
const [k, H] = _(0), [x, D] = _(null), I = () => p.activeLayout()?.widgets ?? [], v = () => p.dragState(), C = () => p.resizeState(), z = () => !P.isMobile(), A = () => (T.config.deck.presetsMode ?? "mutable") === "immutable" && !!p.activeLayout()?.isPreset, O = d(() => Array.from($.widgets().values()).map((t) => ({
|
|
21
20
|
type: t.type,
|
|
22
21
|
name: t.name,
|
|
23
22
|
icon: t.icon
|
|
24
|
-
}))),
|
|
25
|
-
if (
|
|
23
|
+
}))), K = (t) => {
|
|
24
|
+
if (P.isMobile() || A() || t.target?.closest(".deck-cell") || !a) return;
|
|
26
25
|
t.preventDefault();
|
|
27
26
|
const n = a.getBoundingClientRect(), {
|
|
28
27
|
cols: e,
|
|
29
28
|
rowHeight: o,
|
|
30
29
|
gap: s
|
|
31
|
-
} =
|
|
32
|
-
if (!Number.isFinite(
|
|
33
|
-
const
|
|
34
|
-
|
|
30
|
+
} = mt(a), c = window.getComputedStyle(a), i = parseFloat(c.paddingLeft) || 0, g = parseFloat(c.paddingTop) || 0, M = (a.clientWidth - i - (parseFloat(c.paddingRight) || 0) - s * (e - 1)) / e, j = o + s;
|
|
31
|
+
if (!Number.isFinite(M) || M <= 0) return;
|
|
32
|
+
const V = t.clientX - n.left + a.scrollLeft - i, U = t.clientY - n.top + a.scrollTop - g, Z = Math.max(0, Math.min(e - 1, Math.floor(V / (M + s)))), q = Math.max(0, Math.floor(U / j));
|
|
33
|
+
D({
|
|
35
34
|
x: t.clientX,
|
|
36
35
|
y: t.clientY,
|
|
37
|
-
col:
|
|
36
|
+
col: Z,
|
|
38
37
|
row: q
|
|
39
38
|
});
|
|
40
|
-
},
|
|
41
|
-
const r =
|
|
42
|
-
|
|
39
|
+
}, N = (t) => {
|
|
40
|
+
const r = x();
|
|
41
|
+
D(null), r && p.addWidget(t, {
|
|
43
42
|
col: r.col,
|
|
44
43
|
row: r.row
|
|
45
44
|
});
|
|
46
|
-
},
|
|
47
|
-
const t =
|
|
45
|
+
}, B = d(() => {
|
|
46
|
+
const t = v();
|
|
48
47
|
if (!t) return !0;
|
|
49
48
|
const r = p.activeLayout();
|
|
50
|
-
return r ? !
|
|
51
|
-
}),
|
|
52
|
-
const t =
|
|
49
|
+
return r ? !lt(t.currentPosition, r.widgets, t.widgetId) : !0;
|
|
50
|
+
}), X = d(() => {
|
|
51
|
+
const t = I();
|
|
53
52
|
if (t.length === 0) return u;
|
|
54
53
|
let r = u;
|
|
55
54
|
for (const n of t) {
|
|
@@ -57,46 +56,46 @@ function Dt(g) {
|
|
|
57
56
|
e > r && (r = e);
|
|
58
57
|
}
|
|
59
58
|
return r;
|
|
60
|
-
}),
|
|
61
|
-
let t =
|
|
62
|
-
const r =
|
|
59
|
+
}), S = d(() => {
|
|
60
|
+
let t = X();
|
|
61
|
+
const r = v();
|
|
63
62
|
if (r) {
|
|
64
63
|
const e = r.currentPosition.row + r.currentPosition.rowSpan;
|
|
65
64
|
e > t && (t = e);
|
|
66
65
|
}
|
|
67
|
-
const n =
|
|
66
|
+
const n = C();
|
|
68
67
|
if (n) {
|
|
69
68
|
const e = n.currentPosition.row + n.currentPosition.rowSpan;
|
|
70
69
|
e > t && (t = e);
|
|
71
70
|
}
|
|
72
71
|
return Math.max(u, t);
|
|
73
|
-
}),
|
|
74
|
-
const t =
|
|
75
|
-
if (t <= 0) return
|
|
76
|
-
const n = (t -
|
|
77
|
-
return Math.max(
|
|
72
|
+
}), w = d(() => {
|
|
73
|
+
const t = k();
|
|
74
|
+
if (t <= 0) return L;
|
|
75
|
+
const n = (t - F * 2 - (u - 1) * m) / u;
|
|
76
|
+
return Math.max(L, n);
|
|
78
77
|
});
|
|
79
|
-
|
|
78
|
+
et(() => {
|
|
80
79
|
if (!a || typeof ResizeObserver > "u") return;
|
|
81
80
|
const t = new ResizeObserver((r) => {
|
|
82
81
|
for (const n of r)
|
|
83
|
-
|
|
82
|
+
H(n.contentRect.height);
|
|
84
83
|
});
|
|
85
|
-
t.observe(a),
|
|
84
|
+
t.observe(a), H(a.clientHeight), nt(() => t.disconnect());
|
|
86
85
|
});
|
|
87
|
-
const
|
|
86
|
+
const Y = d(() => S() > u ? !0 : k() <= 0 ? !1 : u * w() + (u - 1) * m + F * 2 > k() + 1);
|
|
88
87
|
return (() => {
|
|
89
|
-
var t =
|
|
90
|
-
t.$$contextmenu =
|
|
88
|
+
var t = ft(), r = t.firstChild;
|
|
89
|
+
t.$$contextmenu = K;
|
|
91
90
|
var n = a;
|
|
92
|
-
return typeof n == "function" ?
|
|
91
|
+
return typeof n == "function" ? Q(n, t) : a = t, l(t, "grid-template-columns", `repeat(${y}, 1fr)`), l(t, "gap", `${m}px`), b(t, "data-grid-cols", y), b(t, "data-gap", m), b(t, "data-default-rows", u), h(t, f(E, {
|
|
93
92
|
get when() {
|
|
94
93
|
return z();
|
|
95
94
|
},
|
|
96
95
|
get children() {
|
|
97
|
-
var e =
|
|
98
|
-
return
|
|
99
|
-
var s = `1 / ${
|
|
96
|
+
var e = pt();
|
|
97
|
+
return l(e, "--deck-grid-unit-x", `calc((100% - ${vt}px) / ${y} + ${m}px)`), G((o) => {
|
|
98
|
+
var s = `1 / ${S() + 1}`, c = `${w() + m}px`, i = [
|
|
100
99
|
// Fine
|
|
101
100
|
"linear-gradient(to right, color-mix(in srgb, var(--border) 35%, transparent) 1px, transparent 1px)",
|
|
102
101
|
"linear-gradient(to bottom, color-mix(in srgb, var(--border) 35%, transparent) 1px, transparent 1px)",
|
|
@@ -106,7 +105,7 @@ function Dt(g) {
|
|
|
106
105
|
// Major (12)
|
|
107
106
|
"linear-gradient(to right, color-mix(in srgb, var(--border) 75%, transparent) 2px, transparent 2px)",
|
|
108
107
|
"linear-gradient(to bottom, color-mix(in srgb, var(--border) 75%, transparent) 2px, transparent 2px)"
|
|
109
|
-
].join(", "),
|
|
108
|
+
].join(", "), g = [
|
|
110
109
|
// Fine
|
|
111
110
|
"var(--deck-grid-unit-x) var(--deck-grid-unit-y)",
|
|
112
111
|
"var(--deck-grid-unit-x) var(--deck-grid-unit-y)",
|
|
@@ -117,7 +116,7 @@ function Dt(g) {
|
|
|
117
116
|
"calc(var(--deck-grid-unit-x) * 12) calc(var(--deck-grid-unit-y) * 12)",
|
|
118
117
|
"calc(var(--deck-grid-unit-x) * 12) calc(var(--deck-grid-unit-y) * 12)"
|
|
119
118
|
].join(", ");
|
|
120
|
-
return s !== o.e &&
|
|
119
|
+
return s !== o.e && l(e, "grid-row", o.e = s), c !== o.t && l(e, "--deck-grid-unit-y", o.t = c), i !== o.a && l(e, "background-image", o.a = i), g !== o.o && l(e, "background-size", o.o = g), o;
|
|
121
120
|
}, {
|
|
122
121
|
e: void 0,
|
|
123
122
|
t: void 0,
|
|
@@ -125,34 +124,31 @@ function Dt(g) {
|
|
|
125
124
|
o: void 0
|
|
126
125
|
}), e;
|
|
127
126
|
}
|
|
128
|
-
}), null), h(t,
|
|
127
|
+
}), null), h(t, f(E, {
|
|
129
128
|
get when() {
|
|
130
|
-
return
|
|
129
|
+
return v();
|
|
131
130
|
},
|
|
132
|
-
children: (e) =>
|
|
131
|
+
children: (e) => f(gt, {
|
|
133
132
|
get position() {
|
|
134
133
|
return e().currentPosition;
|
|
135
134
|
},
|
|
136
135
|
get isValid() {
|
|
137
|
-
return
|
|
136
|
+
return B();
|
|
138
137
|
}
|
|
139
138
|
})
|
|
140
|
-
}), null), h(t,
|
|
139
|
+
}), null), h(t, f(rt, {
|
|
141
140
|
get each() {
|
|
142
|
-
return
|
|
141
|
+
return I();
|
|
143
142
|
},
|
|
144
143
|
children: (e) => {
|
|
145
144
|
const o = d(() => {
|
|
146
|
-
const i =
|
|
145
|
+
const i = v();
|
|
147
146
|
if (i && i.widgetId === e.id)
|
|
148
|
-
return
|
|
149
|
-
const
|
|
150
|
-
return
|
|
151
|
-
}), s = d(() =>
|
|
152
|
-
|
|
153
|
-
return i && i.widgetId === e.id ? i.pixelOffset : vt;
|
|
154
|
-
});
|
|
155
|
-
return m(ut, {
|
|
147
|
+
return i.currentPosition;
|
|
148
|
+
const g = C();
|
|
149
|
+
return g && g.widgetId === e.id ? g.currentPosition : e.position;
|
|
150
|
+
}), s = d(() => v()?.widgetId === e.id), c = d(() => C()?.widgetId === e.id);
|
|
151
|
+
return f(dt, {
|
|
156
152
|
widget: e,
|
|
157
153
|
get position() {
|
|
158
154
|
return o();
|
|
@@ -162,37 +158,34 @@ function Dt(g) {
|
|
|
162
158
|
},
|
|
163
159
|
get isResizing() {
|
|
164
160
|
return c();
|
|
165
|
-
},
|
|
166
|
-
get pixelOffset() {
|
|
167
|
-
return l();
|
|
168
161
|
}
|
|
169
162
|
});
|
|
170
163
|
}
|
|
171
|
-
}), null), h(t, () =>
|
|
164
|
+
}), null), h(t, () => R.children, null), h(t, f(ut, {
|
|
172
165
|
get open() {
|
|
173
|
-
return
|
|
166
|
+
return x() !== null;
|
|
174
167
|
},
|
|
175
168
|
get x() {
|
|
176
|
-
return
|
|
169
|
+
return x()?.x ?? 0;
|
|
177
170
|
},
|
|
178
171
|
get y() {
|
|
179
|
-
return
|
|
172
|
+
return x()?.y ?? 0;
|
|
180
173
|
},
|
|
181
174
|
get items() {
|
|
182
|
-
return
|
|
175
|
+
return O();
|
|
183
176
|
},
|
|
184
|
-
onSelect:
|
|
185
|
-
onDismiss: () =>
|
|
186
|
-
}), null),
|
|
187
|
-
var o =
|
|
177
|
+
onSelect: N,
|
|
178
|
+
onDismiss: () => D(null)
|
|
179
|
+
}), null), G((e) => {
|
|
180
|
+
var o = ot(
|
|
188
181
|
"deck-grid relative w-full h-full overflow-x-hidden",
|
|
189
182
|
// Only enable vertical scroll when content exceeds 24 rows
|
|
190
|
-
|
|
183
|
+
Y() ? "overflow-y-scroll" : "overflow-y-hidden",
|
|
191
184
|
"grid p-1",
|
|
192
185
|
z() && "bg-muted/20",
|
|
193
|
-
|
|
194
|
-
), s = `${
|
|
195
|
-
return o !== e.e && J(t, e.e = o), s !== e.t &&
|
|
186
|
+
R.class
|
|
187
|
+
), s = `${w()}px`, c = w(), i = `1 / ${S() + 1}`;
|
|
188
|
+
return o !== e.e && J(t, e.e = o), s !== e.t && l(t, "grid-auto-rows", e.t = s), c !== e.a && b(t, "data-row-height", e.a = c), i !== e.o && l(r, "grid-row", e.o = i), e;
|
|
196
189
|
}, {
|
|
197
190
|
e: void 0,
|
|
198
191
|
t: void 0,
|
|
@@ -201,24 +194,9 @@ function Dt(g) {
|
|
|
201
194
|
}), t;
|
|
202
195
|
})();
|
|
203
196
|
}
|
|
204
|
-
|
|
205
|
-
cols: T,
|
|
206
|
-
defaultRows: u,
|
|
207
|
-
gap: x,
|
|
208
|
-
// Deprecated: use getGridConfig() or read from data-row-height attribute instead
|
|
209
|
-
rowHeight: k
|
|
210
|
-
};
|
|
211
|
-
function ht(g) {
|
|
212
|
-
return {
|
|
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)
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
et(["contextmenu"]);
|
|
197
|
+
tt(["contextmenu"]);
|
|
220
198
|
export {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
199
|
+
_t as DECK_GRID_CONFIG,
|
|
200
|
+
It as DeckGrid,
|
|
201
|
+
mt as getGridConfigFromElement
|
|
224
202
|
};
|
|
@@ -4,6 +4,8 @@ export interface WidgetResizeHandleProps {
|
|
|
4
4
|
edge: ResizeState['edge'];
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
* Resize handle for a specific edge of a widget
|
|
7
|
+
* Resize handle for a specific edge of a widget.
|
|
8
|
+
* The active pointer session is owned by the shared Deck pointer-session helper,
|
|
9
|
+
* so pointer release remains reliable even when the cursor crosses other widgets.
|
|
8
10
|
*/
|
|
9
11
|
export declare function WidgetResizeHandle(props: WidgetResizeHandleProps): import("solid-js").JSX.Element;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { effect as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { useDeck as
|
|
5
|
-
import { applyResizeDelta as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const ne = {
|
|
1
|
+
import { effect as m, className as h, setAttribute as p, template as b, use as v, delegateEvents as E } from "solid-js/web";
|
|
2
|
+
import { createSignal as R, onCleanup as S } from "solid-js";
|
|
3
|
+
import { cn as D } from "../../utils/cn.js";
|
|
4
|
+
import { useDeck as y } from "../../context/DeckContext.js";
|
|
5
|
+
import { applyResizeDelta as k } from "../../utils/gridLayout.js";
|
|
6
|
+
import { startDeckPointerSession as C } from "./deckPointerSession.js";
|
|
7
|
+
var M = /* @__PURE__ */ b("<div style=touch-action:none>");
|
|
8
|
+
const P = {
|
|
10
9
|
n: "top-0 left-2 right-2 h-2 cursor-ns-resize",
|
|
11
10
|
s: "bottom-0 left-2 right-2 h-2 cursor-ns-resize",
|
|
12
11
|
e: "right-0 top-2 bottom-2 w-2 cursor-ew-resize",
|
|
@@ -15,7 +14,7 @@ const ne = {
|
|
|
15
14
|
nw: "top-0 left-0 w-4 h-4 cursor-nwse-resize",
|
|
16
15
|
se: "bottom-0 right-0 w-4 h-4 cursor-nwse-resize",
|
|
17
16
|
sw: "bottom-0 left-0 w-4 h-4 cursor-nesw-resize"
|
|
18
|
-
},
|
|
17
|
+
}, A = {
|
|
19
18
|
n: "ns-resize",
|
|
20
19
|
s: "ns-resize",
|
|
21
20
|
e: "ew-resize",
|
|
@@ -25,85 +24,52 @@ const ne = {
|
|
|
25
24
|
se: "nwse-resize",
|
|
26
25
|
sw: "nesw-resize"
|
|
27
26
|
};
|
|
28
|
-
function
|
|
29
|
-
const
|
|
30
|
-
let
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
w?.(), w = ee({
|
|
37
|
-
kind: "resize",
|
|
38
|
-
cursor: re[i.edge],
|
|
39
|
-
lockUserSelect: !0
|
|
40
|
-
});
|
|
41
|
-
}, E = () => {
|
|
42
|
-
m() && (l !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(l), l = null), C(!1), h = null, r = null, A = null, I(!1), f.endResize(!0));
|
|
43
|
-
}, H = () => {
|
|
44
|
-
if (!r) return;
|
|
45
|
-
const e = A ?? r.getBoundingClientRect(), t = 48, n = 24, o = s - e.top, a = e.bottom - s;
|
|
46
|
-
let c = 0;
|
|
47
|
-
if (o < t ? c = -Math.ceil((t - o) / t * n) : a < t && (c = Math.ceil((t - a) / t * n)), c === 0) return;
|
|
48
|
-
const z = r.scrollTop, v = Math.max(0, Math.min(z + c, r.scrollHeight - r.clientHeight));
|
|
49
|
-
v !== z && (r.scrollTop = v);
|
|
50
|
-
}, Y = () => {
|
|
51
|
-
if (l !== null || typeof requestAnimationFrame > "u") return;
|
|
52
|
-
const e = () => {
|
|
53
|
-
if (!m()) {
|
|
54
|
-
l = null;
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
D(), l = requestAnimationFrame(e);
|
|
58
|
-
};
|
|
59
|
-
l = requestAnimationFrame(e);
|
|
60
|
-
}, $ = (e) => {
|
|
27
|
+
function G(t) {
|
|
28
|
+
const s = y(), [u, d] = R(!1);
|
|
29
|
+
let c, o = null;
|
|
30
|
+
const a = (e) => {
|
|
31
|
+
o?.stop({
|
|
32
|
+
commit: e
|
|
33
|
+
}), o = null;
|
|
34
|
+
}, g = (e) => {
|
|
61
35
|
if (e.pointerType === "mouse" && e.button !== 0) return;
|
|
62
36
|
e.preventDefault(), e.stopPropagation();
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const W = a + c, X = Math.round(t / T), q = Math.round(n / W), k = f.getWidgetMinConstraints(i.widget.type), x = V(i.widget.position, i.edge, X, q, k.minColSpan, k.minRowSpan, o);
|
|
83
|
-
f.updateResize(x);
|
|
84
|
-
}, M = (e) => {
|
|
85
|
-
if (h === e.pointerId) {
|
|
86
|
-
try {
|
|
87
|
-
g?.releasePointerCapture(e.pointerId);
|
|
88
|
-
} catch {
|
|
37
|
+
const n = e.currentTarget?.closest(".deck-grid");
|
|
38
|
+
if (!n) return;
|
|
39
|
+
a(!1), s.startResize(t.widget.id, t.edge, e.clientX, e.clientY);
|
|
40
|
+
const r = s.resizeState();
|
|
41
|
+
!r || r.widgetId !== t.widget.id || r.edge !== t.edge || (d(!0), o = C({
|
|
42
|
+
kind: "resize",
|
|
43
|
+
widgetId: t.widget.id,
|
|
44
|
+
gridEl: n,
|
|
45
|
+
captureEl: c,
|
|
46
|
+
pointerEvent: e,
|
|
47
|
+
cursor: A[t.edge],
|
|
48
|
+
onMove: (i) => {
|
|
49
|
+
const l = Math.round(i.deltaX / i.cellWidth), z = Math.round(i.deltaY / i.cellHeight), w = s.getWidgetMinConstraints(t.widget.type), f = k(t.widget.position, t.edge, l, z, w.minColSpan, w.minRowSpan, i.cols);
|
|
50
|
+
s.updateResize(f);
|
|
51
|
+
},
|
|
52
|
+
onEnd: ({
|
|
53
|
+
commit: i
|
|
54
|
+
}) => {
|
|
55
|
+
o = null, d(!1), s.endResize(i);
|
|
89
56
|
}
|
|
90
|
-
|
|
91
|
-
}
|
|
57
|
+
}));
|
|
92
58
|
};
|
|
93
|
-
return
|
|
94
|
-
var e =
|
|
95
|
-
e
|
|
96
|
-
var
|
|
97
|
-
return typeof
|
|
98
|
-
var
|
|
99
|
-
return
|
|
59
|
+
return S(() => a(!1)), (() => {
|
|
60
|
+
var e = M();
|
|
61
|
+
e.$$pointerdown = g;
|
|
62
|
+
var n = c;
|
|
63
|
+
return typeof n == "function" ? v(n, e) : c = e, m((r) => {
|
|
64
|
+
var i = D("absolute z-30", P[t.edge], "hover:bg-primary/30 transition-colors", u() && "bg-primary/50"), l = t.edge;
|
|
65
|
+
return i !== r.e && h(e, r.e = i), l !== r.t && p(e, "data-widget-resize-handle", r.t = l), r;
|
|
100
66
|
}, {
|
|
101
67
|
e: void 0,
|
|
102
68
|
t: void 0
|
|
103
69
|
}), e;
|
|
104
70
|
})();
|
|
105
71
|
}
|
|
106
|
-
|
|
72
|
+
E(["pointerdown"]);
|
|
107
73
|
export {
|
|
108
|
-
|
|
74
|
+
G as WidgetResizeHandle
|
|
109
75
|
};
|