@floegence/floe-webapp-core 0.36.8 → 0.36.10
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 +3 -6
- package/dist/components/deck/DeckCell.js +35 -44
- package/dist/components/deck/DeckGrid.d.ts +2 -16
- package/dist/components/deck/DeckGrid.js +122 -122
- package/dist/components/deck/DropZonePreview.js +15 -15
- package/dist/components/deck/WidgetResizeHandle.d.ts +3 -1
- package/dist/components/deck/WidgetResizeHandle.js +46 -80
- package/dist/components/deck/deckGridMetrics.d.ts +41 -0
- package/dist/components/deck/deckGridMetrics.js +52 -0
- package/dist/components/deck/deckPointerSession.d.ts +52 -0
- package/dist/components/deck/deckPointerSession.js +113 -0
- package/dist/context/DeckContext.d.ts +13 -8
- package/dist/context/DeckContext.js +250 -242
- package/dist/deck.js +22 -21
- package/dist/floe.css +2 -0
- package/dist/full.js +384 -382
- package/dist/hooks/useDeckDrag.d.ts +4 -3
- package/dist/hooks/useDeckDrag.js +42 -72
- package/dist/index.js +54 -53
- package/dist/styles.css +1 -1
- package/dist/utils/gridCollision.d.ts +1 -0
- package/dist/utils/gridCollision.js +21 -17
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type JSX } from 'solid-js';
|
|
1
2
|
import { type DeckWidget } from '../../context/DeckContext';
|
|
2
3
|
import type { GridPosition } from '../../utils/gridCollision';
|
|
3
4
|
export interface DeckCellProps {
|
|
@@ -5,13 +6,9 @@ export interface DeckCellProps {
|
|
|
5
6
|
position: GridPosition;
|
|
6
7
|
isDragging?: boolean;
|
|
7
8
|
isResizing?: boolean;
|
|
8
|
-
|
|
9
|
-
pixelOffset?: {
|
|
10
|
-
x: number;
|
|
11
|
-
y: number;
|
|
12
|
-
};
|
|
9
|
+
dragOverlayStyle?: JSX.CSSProperties;
|
|
13
10
|
}
|
|
14
11
|
/**
|
|
15
12
|
* Widget cell wrapper positioned via CSS grid-area
|
|
16
13
|
*/
|
|
17
|
-
export declare function DeckCell(props: DeckCellProps):
|
|
14
|
+
export declare function DeckCell(props: DeckCellProps): JSX.Element;
|
|
@@ -1,28 +1,19 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import { createMemo as
|
|
3
|
-
import { cn as
|
|
1
|
+
import { insert as s, createComponent as g, Dynamic as D, effect as W, setAttribute as b, className as S, style as k, template as m } from "solid-js/web";
|
|
2
|
+
import { createMemo as l, Show as C } 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 I } from "./WidgetFrame.js";
|
|
9
|
+
var P = /* @__PURE__ */ m("<div data-floe-dialog-surface-host=true data-floe-geometry-surface=deck-widget>"), T = /* @__PURE__ */ m('<div class="h-full flex items-center justify-center text-muted-foreground text-xs"><span>Widget: ');
|
|
10
|
+
function B(e) {
|
|
11
|
+
const r = z(), n = R(), f = () => r.editMode(), d = () => e.widget.type, a = l(() => n.getWidget(d())), w = l(() => A(e.position)), h = () => r.getWidgetState(e.widget.id), v = (i, t) => {
|
|
12
|
+
r.updateWidgetState(e.widget.id, i, t);
|
|
13
|
+
}, o = () => a()?.component;
|
|
23
14
|
return (() => {
|
|
24
|
-
var
|
|
25
|
-
return
|
|
15
|
+
var i = P();
|
|
16
|
+
return s(i, g(I, {
|
|
26
17
|
get widget() {
|
|
27
18
|
return e.widget;
|
|
28
19
|
},
|
|
@@ -36,28 +27,28 @@ function q(e) {
|
|
|
36
27
|
return e.isResizing;
|
|
37
28
|
},
|
|
38
29
|
get children() {
|
|
39
|
-
return
|
|
30
|
+
return g(C, {
|
|
40
31
|
get when() {
|
|
41
|
-
return
|
|
32
|
+
return o();
|
|
42
33
|
},
|
|
43
34
|
get fallback() {
|
|
44
|
-
return
|
|
35
|
+
return g(_, {
|
|
45
36
|
get type() {
|
|
46
|
-
return
|
|
37
|
+
return d();
|
|
47
38
|
}
|
|
48
39
|
});
|
|
49
40
|
},
|
|
50
41
|
get children() {
|
|
51
|
-
return
|
|
42
|
+
return g(M, {
|
|
52
43
|
get widgetId() {
|
|
53
44
|
return e.widget.id;
|
|
54
45
|
},
|
|
55
|
-
state:
|
|
56
|
-
onStateChange:
|
|
46
|
+
state: h,
|
|
47
|
+
onStateChange: v,
|
|
57
48
|
get children() {
|
|
58
|
-
return
|
|
49
|
+
return g(D, {
|
|
59
50
|
get component() {
|
|
60
|
-
return
|
|
51
|
+
return o();
|
|
61
52
|
},
|
|
62
53
|
get widgetId() {
|
|
63
54
|
return e.widget.id;
|
|
@@ -74,34 +65,34 @@ function q(e) {
|
|
|
74
65
|
}
|
|
75
66
|
});
|
|
76
67
|
}
|
|
77
|
-
})),
|
|
78
|
-
var c =
|
|
68
|
+
})), W((t) => {
|
|
69
|
+
var c = e.widget.id, u = 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)
|
|
82
73
|
!e.isDragging && "transition-transform duration-200 ease-out",
|
|
83
|
-
e.isDragging && "shadow-
|
|
74
|
+
e.isDragging && "shadow-2xl z-50 ring-2 ring-primary/70",
|
|
84
75
|
e.isResizing && "shadow-lg z-50 ring-2 ring-primary",
|
|
85
76
|
!e.isDragging && !e.isResizing && "hover:ring-1 hover:ring-primary/50",
|
|
86
77
|
"select-none",
|
|
87
78
|
e.isDragging && "cursor-grabbing"
|
|
88
|
-
), y = {
|
|
89
|
-
"grid-area":
|
|
90
|
-
...v()
|
|
79
|
+
), y = e.dragOverlayStyle ?? {
|
|
80
|
+
"grid-area": w()
|
|
91
81
|
};
|
|
92
|
-
return c !==
|
|
82
|
+
return c !== t.e && b(i, "data-floe-deck-widget-id", t.e = c), u !== t.t && S(i, t.t = u), t.a = k(i, y, t.a), t;
|
|
93
83
|
}, {
|
|
94
84
|
e: void 0,
|
|
95
|
-
t: void 0
|
|
96
|
-
|
|
85
|
+
t: void 0,
|
|
86
|
+
a: void 0
|
|
87
|
+
}), i;
|
|
97
88
|
})();
|
|
98
89
|
}
|
|
99
|
-
function
|
|
90
|
+
function _(e) {
|
|
100
91
|
return (() => {
|
|
101
|
-
var
|
|
102
|
-
return
|
|
92
|
+
var r = T(), n = r.firstChild;
|
|
93
|
+
return n.firstChild, s(n, () => e.type, null), r;
|
|
103
94
|
})();
|
|
104
95
|
}
|
|
105
96
|
export {
|
|
106
|
-
|
|
97
|
+
B as DeckCell
|
|
107
98
|
};
|
|
@@ -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,102 +1,105 @@
|
|
|
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
|
-
|
|
19
|
-
|
|
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) => ({
|
|
1
|
+
import { setStyleProperty as u, setAttribute as D, insert as b, createComponent as h, effect as E, className as ot, template as W, use as it, delegateEvents as at } from "solid-js/web";
|
|
2
|
+
import { createSignal as G, createMemo as d, onMount as st, Show as L, For as ct, onCleanup as lt } from "solid-js";
|
|
3
|
+
import { cn as dt } from "../../utils/cn.js";
|
|
4
|
+
import { useDeck as ut } from "../../context/DeckContext.js";
|
|
5
|
+
import { useLayout as gt } from "../../context/LayoutContext.js";
|
|
6
|
+
import { useResolvedFloeConfig as mt } from "../../context/FloeConfigContext.js";
|
|
7
|
+
import { useWidgetRegistry as pt } from "../../context/WidgetRegistry.js";
|
|
8
|
+
import { hasCollision as ft } from "../../utils/gridCollision.js";
|
|
9
|
+
import { DeckCell as vt } from "./DeckCell.js";
|
|
10
|
+
import { DeckContextMenu as ht } from "./DeckContextMenu.js";
|
|
11
|
+
import { DropZonePreview as xt } from "./DropZonePreview.js";
|
|
12
|
+
import { DECK_DEFAULT_ROWS as g, DECK_MIN_ROW_HEIGHT as F, DECK_GAP as p, DECK_PADDING as O, DECK_GRID_COLS as M, positionToDeckPixelRect as wt, getGridConfigFromElement as bt, measureDeckGridSurface as T } from "./deckGridMetrics.js";
|
|
13
|
+
import { DECK_GRID_CONFIG as Tt } from "./deckGridMetrics.js";
|
|
14
|
+
var yt = /* @__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">'), kt = /* @__PURE__ */ W('<div style=scrollbar-gutter:stable><div class=pointer-events-none aria-hidden=true style="grid-column:1 / -1">');
|
|
15
|
+
const Dt = (M - 1) * p;
|
|
16
|
+
function Lt($) {
|
|
17
|
+
const m = ut(), H = gt(), A = pt(), K = mt();
|
|
18
|
+
let n;
|
|
19
|
+
const [S, I] = G(0), [N, X] = G(null), [y, C] = G(null), z = () => m.activeLayout()?.widgets ?? [], x = () => m.dragState(), Y = () => m.dragMotion(), R = () => m.resizeState(), B = () => N() ?? (n ? T(n) : null), _ = () => !H.isMobile(), j = () => (K.config.deck.presetsMode ?? "mutable") === "immutable" && !!m.activeLayout()?.isPreset, V = d(() => Array.from(A.widgets().values()).map((t) => ({
|
|
21
20
|
type: t.type,
|
|
22
21
|
name: t.name,
|
|
23
22
|
icon: t.icon
|
|
24
|
-
}))),
|
|
25
|
-
if (
|
|
23
|
+
}))), U = (t) => {
|
|
24
|
+
if (H.isMobile() || j() || t.target?.closest(".deck-cell") || !n) return;
|
|
26
25
|
t.preventDefault();
|
|
27
|
-
const
|
|
26
|
+
const o = n.getBoundingClientRect(), {
|
|
28
27
|
cols: e,
|
|
29
|
-
rowHeight:
|
|
28
|
+
rowHeight: i,
|
|
30
29
|
gap: s
|
|
31
|
-
} =
|
|
32
|
-
if (!Number.isFinite(
|
|
33
|
-
const
|
|
34
|
-
|
|
30
|
+
} = bt(n), c = window.getComputedStyle(n), l = parseFloat(c.paddingLeft) || 0, a = parseFloat(c.paddingTop) || 0, f = (n.clientWidth - l - (parseFloat(c.paddingRight) || 0) - s * (e - 1)) / e, v = i + s;
|
|
31
|
+
if (!Number.isFinite(f) || f <= 0) return;
|
|
32
|
+
const tt = t.clientX - o.left + n.scrollLeft - l, et = t.clientY - o.top + n.scrollTop - a, rt = Math.max(0, Math.min(e - 1, Math.floor(tt / (f + s)))), nt = Math.max(0, Math.floor(et / v));
|
|
33
|
+
C({
|
|
35
34
|
x: t.clientX,
|
|
36
35
|
y: t.clientY,
|
|
37
|
-
col:
|
|
38
|
-
row:
|
|
36
|
+
col: rt,
|
|
37
|
+
row: nt
|
|
39
38
|
});
|
|
40
|
-
},
|
|
41
|
-
const r =
|
|
42
|
-
|
|
39
|
+
}, Z = (t) => {
|
|
40
|
+
const r = y();
|
|
41
|
+
C(null), r && m.addWidget(t, {
|
|
43
42
|
col: r.col,
|
|
44
43
|
row: r.row
|
|
45
44
|
});
|
|
46
|
-
},
|
|
47
|
-
const t =
|
|
45
|
+
}, q = d(() => {
|
|
46
|
+
const t = x();
|
|
48
47
|
if (!t) return !0;
|
|
49
|
-
const r =
|
|
50
|
-
return r ? !
|
|
51
|
-
}),
|
|
52
|
-
const t =
|
|
53
|
-
if (t.length === 0) return
|
|
54
|
-
let r =
|
|
55
|
-
for (const
|
|
56
|
-
const e =
|
|
48
|
+
const r = m.activeLayout();
|
|
49
|
+
return r ? !ft(t.currentPosition, r.widgets, t.widgetId) : !0;
|
|
50
|
+
}), J = d(() => {
|
|
51
|
+
const t = z();
|
|
52
|
+
if (t.length === 0) return g;
|
|
53
|
+
let r = g;
|
|
54
|
+
for (const o of t) {
|
|
55
|
+
const e = o.position.row + o.position.rowSpan;
|
|
57
56
|
e > r && (r = e);
|
|
58
57
|
}
|
|
59
58
|
return r;
|
|
60
|
-
}),
|
|
61
|
-
let t =
|
|
62
|
-
const r =
|
|
59
|
+
}), P = d(() => {
|
|
60
|
+
let t = J();
|
|
61
|
+
const r = x();
|
|
63
62
|
if (r) {
|
|
64
63
|
const e = r.currentPosition.row + r.currentPosition.rowSpan;
|
|
65
64
|
e > t && (t = e);
|
|
66
65
|
}
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
69
|
-
const e =
|
|
66
|
+
const o = R();
|
|
67
|
+
if (o) {
|
|
68
|
+
const e = o.currentPosition.row + o.currentPosition.rowSpan;
|
|
70
69
|
e > t && (t = e);
|
|
71
70
|
}
|
|
72
|
-
return Math.max(
|
|
73
|
-
}),
|
|
71
|
+
return Math.max(g, t);
|
|
72
|
+
}), k = d(() => {
|
|
74
73
|
const t = S();
|
|
75
|
-
if (t <= 0) return
|
|
76
|
-
const
|
|
77
|
-
return Math.max(
|
|
74
|
+
if (t <= 0) return F;
|
|
75
|
+
const o = (t - O * 2 - (g - 1) * p) / g;
|
|
76
|
+
return Math.max(F, o);
|
|
78
77
|
});
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
st(() => {
|
|
79
|
+
const t = () => {
|
|
80
|
+
n && (I(n.clientHeight), X(T(n)));
|
|
81
|
+
};
|
|
82
|
+
if (t(), !n || typeof ResizeObserver > "u") return;
|
|
83
|
+
const r = new ResizeObserver((o) => {
|
|
84
|
+
for (const e of o)
|
|
85
|
+
I(e.contentRect.height);
|
|
86
|
+
t();
|
|
84
87
|
});
|
|
85
|
-
|
|
88
|
+
r.observe(n), lt(() => r.disconnect());
|
|
86
89
|
});
|
|
87
|
-
const
|
|
90
|
+
const Q = d(() => P() > g ? !0 : S() <= 0 ? !1 : g * k() + (g - 1) * p + O * 2 > S() + 1);
|
|
88
91
|
return (() => {
|
|
89
|
-
var t =
|
|
90
|
-
t.$$contextmenu =
|
|
91
|
-
var
|
|
92
|
-
return typeof
|
|
92
|
+
var t = kt(), r = t.firstChild;
|
|
93
|
+
t.$$contextmenu = U;
|
|
94
|
+
var o = n;
|
|
95
|
+
return typeof o == "function" ? it(o, t) : n = t, u(t, "grid-template-columns", `repeat(${M}, 1fr)`), u(t, "gap", `${p}px`), D(t, "data-grid-cols", M), D(t, "data-gap", p), D(t, "data-default-rows", g), b(t, h(L, {
|
|
93
96
|
get when() {
|
|
94
|
-
return
|
|
97
|
+
return _();
|
|
95
98
|
},
|
|
96
99
|
get children() {
|
|
97
|
-
var e =
|
|
98
|
-
return
|
|
99
|
-
var s = `1 / ${
|
|
100
|
+
var e = yt();
|
|
101
|
+
return u(e, "--deck-grid-unit-x", `calc((100% - ${Dt}px) / ${M} + ${p}px)`), E((i) => {
|
|
102
|
+
var s = `1 / ${P() + 1}`, c = `${k() + p}px`, l = [
|
|
100
103
|
// Fine
|
|
101
104
|
"linear-gradient(to right, color-mix(in srgb, var(--border) 35%, transparent) 1px, transparent 1px)",
|
|
102
105
|
"linear-gradient(to bottom, color-mix(in srgb, var(--border) 35%, transparent) 1px, transparent 1px)",
|
|
@@ -106,7 +109,7 @@ function Dt(g) {
|
|
|
106
109
|
// Major (12)
|
|
107
110
|
"linear-gradient(to right, color-mix(in srgb, var(--border) 75%, transparent) 2px, transparent 2px)",
|
|
108
111
|
"linear-gradient(to bottom, color-mix(in srgb, var(--border) 75%, transparent) 2px, transparent 2px)"
|
|
109
|
-
].join(", "),
|
|
112
|
+
].join(", "), a = [
|
|
110
113
|
// Fine
|
|
111
114
|
"var(--deck-grid-unit-x) var(--deck-grid-unit-y)",
|
|
112
115
|
"var(--deck-grid-unit-x) var(--deck-grid-unit-y)",
|
|
@@ -117,7 +120,7 @@ function Dt(g) {
|
|
|
117
120
|
"calc(var(--deck-grid-unit-x) * 12) calc(var(--deck-grid-unit-y) * 12)",
|
|
118
121
|
"calc(var(--deck-grid-unit-x) * 12) calc(var(--deck-grid-unit-y) * 12)"
|
|
119
122
|
].join(", ");
|
|
120
|
-
return s !==
|
|
123
|
+
return s !== i.e && u(e, "grid-row", i.e = s), c !== i.t && u(e, "--deck-grid-unit-y", i.t = c), l !== i.a && u(e, "background-image", i.a = l), a !== i.o && u(e, "background-size", i.o = a), i;
|
|
121
124
|
}, {
|
|
122
125
|
e: void 0,
|
|
123
126
|
t: void 0,
|
|
@@ -125,37 +128,49 @@ function Dt(g) {
|
|
|
125
128
|
o: void 0
|
|
126
129
|
}), e;
|
|
127
130
|
}
|
|
128
|
-
}), null),
|
|
131
|
+
}), null), b(t, h(L, {
|
|
129
132
|
get when() {
|
|
130
|
-
return
|
|
133
|
+
return x();
|
|
131
134
|
},
|
|
132
|
-
children: (e) =>
|
|
135
|
+
children: (e) => h(xt, {
|
|
133
136
|
get position() {
|
|
134
137
|
return e().currentPosition;
|
|
135
138
|
},
|
|
136
139
|
get isValid() {
|
|
137
|
-
return
|
|
140
|
+
return q();
|
|
138
141
|
}
|
|
139
142
|
})
|
|
140
|
-
}), null),
|
|
143
|
+
}), null), b(t, h(ct, {
|
|
141
144
|
get each() {
|
|
142
|
-
return
|
|
145
|
+
return z();
|
|
143
146
|
},
|
|
144
147
|
children: (e) => {
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
const i = d(() => {
|
|
149
|
+
const a = R();
|
|
150
|
+
return a && a.widgetId === e.id ? a.currentPosition : e.position;
|
|
151
|
+
}), s = d(() => x()?.widgetId === e.id), c = d(() => R()?.widgetId === e.id), l = d(() => {
|
|
152
|
+
const a = x();
|
|
153
|
+
if (!a || a.widgetId !== e.id) return;
|
|
154
|
+
const w = Y();
|
|
155
|
+
if (!w || w.widgetId !== e.id) return;
|
|
156
|
+
const f = B();
|
|
157
|
+
if (!f) return;
|
|
158
|
+
const v = wt(a.originalPosition, f);
|
|
159
|
+
return {
|
|
160
|
+
position: "absolute",
|
|
161
|
+
left: `${v.left}px`,
|
|
162
|
+
top: `${v.top}px`,
|
|
163
|
+
width: `${v.width}px`,
|
|
164
|
+
height: `${v.height}px`,
|
|
165
|
+
transform: `translate3d(${w.deltaX}px, ${w.deltaY}px, 0) scale(0.992)`,
|
|
166
|
+
"transform-origin": "center center",
|
|
167
|
+
"will-change": "transform"
|
|
168
|
+
};
|
|
154
169
|
});
|
|
155
|
-
return
|
|
170
|
+
return h(vt, {
|
|
156
171
|
widget: e,
|
|
157
172
|
get position() {
|
|
158
|
-
return
|
|
173
|
+
return i();
|
|
159
174
|
},
|
|
160
175
|
get isDragging() {
|
|
161
176
|
return s();
|
|
@@ -163,36 +178,36 @@ function Dt(g) {
|
|
|
163
178
|
get isResizing() {
|
|
164
179
|
return c();
|
|
165
180
|
},
|
|
166
|
-
get
|
|
181
|
+
get dragOverlayStyle() {
|
|
167
182
|
return l();
|
|
168
183
|
}
|
|
169
184
|
});
|
|
170
185
|
}
|
|
171
|
-
}), null),
|
|
186
|
+
}), null), b(t, () => $.children, null), b(t, h(ht, {
|
|
172
187
|
get open() {
|
|
173
|
-
return
|
|
188
|
+
return y() !== null;
|
|
174
189
|
},
|
|
175
190
|
get x() {
|
|
176
|
-
return
|
|
191
|
+
return y()?.x ?? 0;
|
|
177
192
|
},
|
|
178
193
|
get y() {
|
|
179
|
-
return
|
|
194
|
+
return y()?.y ?? 0;
|
|
180
195
|
},
|
|
181
196
|
get items() {
|
|
182
|
-
return
|
|
197
|
+
return V();
|
|
183
198
|
},
|
|
184
|
-
onSelect:
|
|
185
|
-
onDismiss: () =>
|
|
186
|
-
}), null),
|
|
187
|
-
var
|
|
199
|
+
onSelect: Z,
|
|
200
|
+
onDismiss: () => C(null)
|
|
201
|
+
}), null), E((e) => {
|
|
202
|
+
var i = dt(
|
|
188
203
|
"deck-grid relative w-full h-full overflow-x-hidden",
|
|
189
204
|
// Only enable vertical scroll when content exceeds 24 rows
|
|
190
|
-
|
|
205
|
+
Q() ? "overflow-y-scroll" : "overflow-y-hidden",
|
|
191
206
|
"grid p-1",
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
), s = `${
|
|
195
|
-
return
|
|
207
|
+
_() && "bg-muted/20",
|
|
208
|
+
$.class
|
|
209
|
+
), s = `${k()}px`, c = k(), l = `1 / ${P() + 1}`;
|
|
210
|
+
return i !== e.e && ot(t, e.e = i), s !== e.t && u(t, "grid-auto-rows", e.t = s), c !== e.a && D(t, "data-row-height", e.a = c), l !== e.o && u(r, "grid-row", e.o = l), e;
|
|
196
211
|
}, {
|
|
197
212
|
e: void 0,
|
|
198
213
|
t: void 0,
|
|
@@ -201,24 +216,9 @@ function Dt(g) {
|
|
|
201
216
|
}), t;
|
|
202
217
|
})();
|
|
203
218
|
}
|
|
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"]);
|
|
219
|
+
at(["contextmenu"]);
|
|
220
220
|
export {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
Tt as DECK_GRID_CONFIG,
|
|
222
|
+
Lt as DeckGrid,
|
|
223
|
+
bt as getGridConfigFromElement
|
|
224
224
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { effect as
|
|
2
|
-
import { cn as
|
|
3
|
-
import { positionToGridArea as
|
|
4
|
-
var u = /* @__PURE__ */
|
|
5
|
-
function
|
|
6
|
-
const v = () =>
|
|
1
|
+
import { effect as g, className as c, setStyleProperty as n, template as f } from "solid-js/web";
|
|
2
|
+
import { cn as m } from "../../utils/cn.js";
|
|
3
|
+
import { positionToGridArea as b } from "../../utils/gridLayout.js";
|
|
4
|
+
var u = /* @__PURE__ */ f('<div data-floe-deck-drop-preview=true><div class="absolute inset-0 rounded-md">');
|
|
5
|
+
function w(i) {
|
|
6
|
+
const v = () => b(i.position), o = () => i.isValid !== !1 ? "--info" : "--error";
|
|
7
7
|
return (() => {
|
|
8
8
|
var e = u(), l = e.firstChild;
|
|
9
|
-
return
|
|
10
|
-
var
|
|
11
|
-
"pointer-events-none rounded-md relative",
|
|
9
|
+
return g((r) => {
|
|
10
|
+
var a = m(
|
|
11
|
+
"pointer-events-none rounded-md relative z-20",
|
|
12
12
|
"border-2 border-dashed",
|
|
13
|
-
|
|
13
|
+
i.isValid !== !1 ? "border-info/60 bg-info/10 ring-1 ring-inset ring-info/25" : "border-error/60 bg-error/10 ring-1 ring-inset ring-error/25",
|
|
14
14
|
// Subtle animation
|
|
15
15
|
"animate-in fade-in duration-150"
|
|
16
|
-
), t = v(), d = `0 4px 16px color-mix(in srgb, var(${
|
|
16
|
+
), t = v(), d = `0 4px 16px color-mix(in srgb, var(${o()}) 18%, transparent)`, s = `linear-gradient(
|
|
17
17
|
135deg,
|
|
18
|
-
color-mix(in srgb, var(${
|
|
18
|
+
color-mix(in srgb, var(${o()}) 18%, transparent) 0%,
|
|
19
19
|
transparent 55%,
|
|
20
|
-
color-mix(in srgb, var(${
|
|
20
|
+
color-mix(in srgb, var(${o()}) 10%, var(--card)) 100%
|
|
21
21
|
)`;
|
|
22
|
-
return
|
|
22
|
+
return a !== r.e && c(e, r.e = a), t !== r.t && n(e, "grid-area", r.t = t), d !== r.a && n(e, "box-shadow", r.a = d), s !== r.o && n(l, "background", r.o = s), r;
|
|
23
23
|
}, {
|
|
24
24
|
e: void 0,
|
|
25
25
|
t: void 0,
|
|
@@ -29,5 +29,5 @@ function V(o) {
|
|
|
29
29
|
})();
|
|
30
30
|
}
|
|
31
31
|
export {
|
|
32
|
-
|
|
32
|
+
w as DropZonePreview
|
|
33
33
|
};
|
|
@@ -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;
|