@floegence/floe-webapp-core 0.36.9 → 0.36.11

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