@arbidocs/blocks 0.5.151 → 0.5.152
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/{ConnectedNativeDocxComparison-JLT3VHYQ.cjs → ConnectedNativeDocxComparison-244UIHSM.cjs} +9 -9
- package/dist/{ConnectedStreamedWordArtifact-KWK6HLCZ.cjs.map → ConnectedNativeDocxComparison-244UIHSM.cjs.map} +1 -1
- package/dist/{ConnectedPresentation-SY42ADRU.cjs → ConnectedPresentation-JUXIXKYN.cjs} +9 -8
- package/dist/ConnectedPresentation-JUXIXKYN.cjs.map +1 -0
- package/dist/{ConnectedSlidesTab-JATNBI22.cjs → ConnectedSlidesTab-JA3VB66W.cjs} +8 -7
- package/dist/ConnectedSlidesTab-JA3VB66W.cjs.map +1 -0
- package/dist/{ConnectedStreamedWordArtifact-KWK6HLCZ.cjs → ConnectedStreamedWordArtifact-V6BRZMEQ.cjs} +9 -9
- package/dist/{ConnectedNativeDocxComparison-JLT3VHYQ.cjs.map → ConnectedStreamedWordArtifact-V6BRZMEQ.cjs.map} +1 -1
- package/dist/{DocumentReviewCard-USFBTVEL.cjs → DocumentReviewCard-5W2QQWKA.cjs} +14 -14
- package/dist/{DocumentReviewCard-USFBTVEL.cjs.map → DocumentReviewCard-5W2QQWKA.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-O4CY7GM3.cjs → FilesViewerDialog-63QUTG4L.cjs} +12 -12
- package/dist/{FilesViewerDialog-O4CY7GM3.cjs.map → FilesViewerDialog-63QUTG4L.cjs.map} +1 -1
- package/dist/{RechartsRenderer-NRLQZSSY.cjs → RechartsRenderer-NU6WUZJS.cjs} +21 -20
- package/dist/RechartsRenderer-NU6WUZJS.cjs.map +1 -0
- package/dist/{SpotlightStrip-QQ2WUI32.cjs → SpotlightStrip-HXQFPAAL.cjs} +6 -5
- package/dist/SpotlightStrip-HXQFPAAL.cjs.map +1 -0
- package/dist/agents/index.cjs +179 -179
- package/dist/{chunk-3XCYPWC5.cjs → chunk-2P7VH2SK.cjs} +3 -3
- package/dist/chunk-2P7VH2SK.cjs.map +1 -0
- package/dist/{chunk-7Q46YAX4.cjs → chunk-3CJTO6RV.cjs} +152 -199
- package/dist/chunk-3CJTO6RV.cjs.map +1 -0
- package/dist/{chunk-PJTKXKDS.cjs → chunk-4I2PCP7O.cjs} +28 -28
- package/dist/{chunk-PJTKXKDS.cjs.map → chunk-4I2PCP7O.cjs.map} +1 -1
- package/dist/{chunk-OGJCEWME.cjs → chunk-4XNP27N4.cjs} +36 -36
- package/dist/{chunk-OGJCEWME.cjs.map → chunk-4XNP27N4.cjs.map} +1 -1
- package/dist/{chunk-2SILSQNF.cjs → chunk-4ZR4O5SP.cjs} +26 -8
- package/dist/chunk-4ZR4O5SP.cjs.map +1 -0
- package/dist/{chunk-ILATBO5Z.cjs → chunk-6ZZWQ3OL.cjs} +4 -4
- package/dist/{chunk-ILATBO5Z.cjs.map → chunk-6ZZWQ3OL.cjs.map} +1 -1
- package/dist/{chunk-VH4QXK5W.cjs → chunk-AG6KAGAX.cjs} +4 -4
- package/dist/{chunk-VH4QXK5W.cjs.map → chunk-AG6KAGAX.cjs.map} +1 -1
- package/dist/{chunk-MFZW4FEW.cjs → chunk-B5BGVPQ5.cjs} +4 -4
- package/dist/{chunk-MFZW4FEW.cjs.map → chunk-B5BGVPQ5.cjs.map} +1 -1
- package/dist/{chunk-PJ6J4EMZ.cjs → chunk-CULUTYOD.cjs} +4 -4
- package/dist/{chunk-PJ6J4EMZ.cjs.map → chunk-CULUTYOD.cjs.map} +1 -1
- package/dist/{chunk-H7AI54V2.cjs → chunk-CVVQHFLR.cjs} +3 -3
- package/dist/{chunk-H7AI54V2.cjs.map → chunk-CVVQHFLR.cjs.map} +1 -1
- package/dist/{chunk-R3C3S6EH.cjs → chunk-D5DOK2AE.cjs} +58 -58
- package/dist/{chunk-R3C3S6EH.cjs.map → chunk-D5DOK2AE.cjs.map} +1 -1
- package/dist/{chunk-MH7P5FEK.cjs → chunk-FCT62ZPE.cjs} +4 -4
- package/dist/{chunk-MH7P5FEK.cjs.map → chunk-FCT62ZPE.cjs.map} +1 -1
- package/dist/{chunk-QX2LAMVE.cjs → chunk-IXTDOPSB.cjs} +4 -4
- package/dist/{chunk-QX2LAMVE.cjs.map → chunk-IXTDOPSB.cjs.map} +1 -1
- package/dist/{chunk-AKR4JN6I.cjs → chunk-JCFXS336.cjs} +3 -3
- package/dist/{chunk-AKR4JN6I.cjs.map → chunk-JCFXS336.cjs.map} +1 -1
- package/dist/{chunk-N4TOSY7B.cjs → chunk-JLNKD56X.cjs} +4 -4
- package/dist/{chunk-N4TOSY7B.cjs.map → chunk-JLNKD56X.cjs.map} +1 -1
- package/dist/{chunk-DNTSR7UV.cjs → chunk-LYKT336H.cjs} +5 -5
- package/dist/{chunk-DNTSR7UV.cjs.map → chunk-LYKT336H.cjs.map} +1 -1
- package/dist/{chunk-MGGDT6JK.cjs → chunk-MAKCWF45.cjs} +4 -4
- package/dist/{chunk-MGGDT6JK.cjs.map → chunk-MAKCWF45.cjs.map} +1 -1
- package/dist/{chunk-DGUQK5GA.cjs → chunk-TFRCNIUY.cjs} +6 -6
- package/dist/{chunk-DGUQK5GA.cjs.map → chunk-TFRCNIUY.cjs.map} +1 -1
- package/dist/chunk-UM3EWCDE.cjs +105 -0
- package/dist/chunk-UM3EWCDE.cjs.map +1 -0
- package/dist/{chunk-WPUEGDBE.cjs → chunk-WUM76MJU.cjs} +6 -6
- package/dist/{chunk-WPUEGDBE.cjs.map → chunk-WUM76MJU.cjs.map} +1 -1
- package/dist/{chunk-6WWYH66F.cjs → chunk-Z3N32LL4.cjs} +8 -8
- package/dist/{chunk-6WWYH66F.cjs.map → chunk-Z3N32LL4.cjs.map} +1 -1
- package/dist/{chunk-JMBAUHI7.cjs → chunk-ZCQXQIBA.cjs} +28 -28
- package/dist/{chunk-JMBAUHI7.cjs.map → chunk-ZCQXQIBA.cjs.map} +1 -1
- package/dist/components/MetricCard.js +1 -1
- package/dist/components/MetricCard.js.map +2 -2
- package/dist/components/gestures/GestureHandle.d.ts +21 -0
- package/dist/components/gestures/GestureHandle.js +44 -0
- package/dist/components/gestures/GestureHandle.js.map +7 -0
- package/dist/components/gestures/handles.d.ts +43 -0
- package/dist/components/gestures/handles.js +18 -0
- package/dist/components/gestures/handles.js.map +7 -0
- package/dist/components/gestures/index.d.ts +3 -0
- package/dist/components/gestures/index.js +5 -0
- package/dist/components/gestures/index.js.map +7 -0
- package/dist/components/gestures/usePointerGesture.d.ts +51 -0
- package/dist/components/gestures/usePointerGesture.js +61 -0
- package/dist/components/gestures/usePointerGesture.js.map +7 -0
- package/dist/connect/docx.cjs +12 -12
- package/dist/connect/index.cjs +613 -613
- package/dist/connect/viewer.cjs +10 -10
- package/dist/connection/dashboards/DashboardPanel.js +6 -1
- package/dist/connection/dashboards/DashboardPanel.js.map +2 -2
- package/dist/connection/pages/BlockEditor.d.ts +0 -5
- package/dist/connection/pages/BlockEditor.js +3 -65
- package/dist/connection/pages/BlockEditor.js.map +2 -2
- package/dist/connection/pages/ConnectedPagesPage.d.ts +4 -1
- package/dist/connection/pages/ConnectedPagesPage.js +52 -71
- package/dist/connection/pages/ConnectedPagesPage.js.map +2 -2
- package/dist/connection/pages/DocumentBlocks.js +3 -3
- package/dist/connection/pages/DocumentBlocks.js.map +2 -2
- package/dist/connection/pages/DocumentsPicker.js +1 -1
- package/dist/connection/pages/DocumentsPicker.js.map +2 -2
- package/dist/connection/pages/EditablePageGrid.d.ts +31 -0
- package/dist/connection/pages/EditablePageGrid.js +200 -0
- package/dist/connection/pages/EditablePageGrid.js.map +7 -0
- package/dist/connection/pages/PageGrid.d.ts +7 -4
- package/dist/connection/pages/PageGrid.js +9 -3
- package/dist/connection/pages/PageGrid.js.map +2 -2
- package/dist/connection/pages/TableViewBlock.js +1 -1
- package/dist/connection/pages/TableViewBlock.js.map +2 -2
- package/dist/connection/pages/grid-layout.d.ts +38 -0
- package/dist/connection/pages/grid-layout.js +98 -0
- package/dist/connection/pages/grid-layout.js.map +7 -0
- package/dist/connection/pages/index.d.ts +2 -0
- package/dist/connection/pages/index.js +19 -1
- package/dist/connection/pages/index.js.map +2 -2
- package/dist/connection/pages/labels.d.ts +0 -2
- package/dist/connection/pages/labels.js +0 -2
- package/dist/connection/pages/labels.js.map +2 -2
- package/dist/connection/shell/experimentalNav.d.ts +8 -0
- package/dist/connection/shell/experimentalNav.js +23 -0
- package/dist/connection/shell/experimentalNav.js.map +7 -0
- package/dist/dashboards/ChartRenderer.d.ts +6 -0
- package/dist/dashboards/ChartRenderer.js +7 -2
- package/dist/dashboards/ChartRenderer.js.map +2 -2
- package/dist/dashboards/PanelView.d.ts +2 -0
- package/dist/dashboards/PanelView.js +12 -2
- package/dist/dashboards/PanelView.js.map +2 -2
- package/dist/dashboards/RechartsRenderer.js +19 -18
- package/dist/dashboards/RechartsRenderer.js.map +2 -2
- package/dist/dashboards/index.cjs +16 -16
- package/dist/embed/index.cjs +13 -13
- package/dist/facts/index.cjs +1 -1
- package/dist/files/index.cjs +226 -226
- package/dist/index.cjs +338 -320
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +2 -2
- package/dist/pages/index.cjs +389 -181
- package/dist/pages/index.cjs.map +1 -1
- package/dist/presentation/StageBox.js +63 -86
- package/dist/presentation/StageBox.js.map +2 -2
- package/dist/presentation/StageItem.js +86 -117
- package/dist/presentation/StageItem.js.map +2 -2
- package/dist/site/index.cjs +5 -5
- package/dist/studio/index.cjs +13 -13
- package/dist/styles.css +1 -1
- package/dist/workflow-canvas/index.cjs +25 -25
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/dist/ConnectedPresentation-SY42ADRU.cjs.map +0 -1
- package/dist/ConnectedSlidesTab-JATNBI22.cjs.map +0 -1
- package/dist/RechartsRenderer-NRLQZSSY.cjs.map +0 -1
- package/dist/SpotlightStrip-QQ2WUI32.cjs.map +0 -1
- package/dist/chunk-2SILSQNF.cjs.map +0 -1
- package/dist/chunk-3XCYPWC5.cjs.map +0 -1
- package/dist/chunk-7Q46YAX4.cjs.map +0 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
memo,
|
|
5
|
-
useRef,
|
|
6
|
-
useState
|
|
7
|
-
} from "react";
|
|
3
|
+
import { memo, useRef, useState } from "react";
|
|
8
4
|
import { cn } from "@arbidocs/react/ui";
|
|
5
|
+
import {
|
|
6
|
+
CORNER_HANDLES,
|
|
7
|
+
GestureHandle,
|
|
8
|
+
SIDE_HANDLES,
|
|
9
|
+
usePointerGesture
|
|
10
|
+
} from "../components/gestures/index.js";
|
|
9
11
|
import {
|
|
10
12
|
DEFAULT_INSET,
|
|
11
13
|
DEFAULT_TEXT_SIZE,
|
|
@@ -18,14 +20,14 @@ import { STAGE_ASPECT } from "./model.js";
|
|
|
18
20
|
import { TEXT_COLORS } from "./theme.js";
|
|
19
21
|
import { cqw, runStyle } from "./box-style.js";
|
|
20
22
|
const HANDLES = [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
CORNER_HANDLES[0],
|
|
24
|
+
SIDE_HANDLES[0],
|
|
25
|
+
CORNER_HANDLES[1],
|
|
26
|
+
SIDE_HANDLES[1],
|
|
27
|
+
CORNER_HANDLES[3],
|
|
28
|
+
SIDE_HANDLES[2],
|
|
29
|
+
CORNER_HANDLES[2],
|
|
30
|
+
SIDE_HANDLES[3]
|
|
29
31
|
];
|
|
30
32
|
const withAlpha = (hex, alpha = 1) => {
|
|
31
33
|
if (alpha >= 1) return hex;
|
|
@@ -91,73 +93,49 @@ const StageBox = memo(function StageBox2({
|
|
|
91
93
|
host
|
|
92
94
|
}) {
|
|
93
95
|
const element = useRef(null);
|
|
94
|
-
const gesture = useRef(null);
|
|
95
96
|
const [typing, setTyping] = useState(false);
|
|
96
97
|
const [dragging, setDragging] = useState(false);
|
|
97
98
|
const { frame } = box;
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
el
|
|
111
|
-
el
|
|
99
|
+
const gesture = usePointerGesture({
|
|
100
|
+
element,
|
|
101
|
+
begin: () => {
|
|
102
|
+
if (!editable || typing) return null;
|
|
103
|
+
const stage = host.stageBox();
|
|
104
|
+
if (!stage) return null;
|
|
105
|
+
host.select(box.id);
|
|
106
|
+
return { frame, stage, wasSelected: selected };
|
|
107
|
+
},
|
|
108
|
+
dragStart: () => setDragging(true),
|
|
109
|
+
update: (g, handle, { dx, dy }) => handle === "move" ? moveBox(g.frame, dx / g.stage.width, dy / g.stage.height) : stretchBox(g.frame, handle, dx / g.stage.width, dy / g.stage.height),
|
|
110
|
+
apply: (g, next, handle) => {
|
|
111
|
+
const el = element.current;
|
|
112
|
+
if (!el) return;
|
|
113
|
+
if (handle === "move") {
|
|
114
|
+
el.style.translate = `${(next.x - g.frame.x) * g.stage.width}px ${(next.y - g.frame.y) * g.stage.height}px`;
|
|
115
|
+
} else {
|
|
116
|
+
el.style.left = `${next.x * 100}%`;
|
|
117
|
+
el.style.top = `${next.y * 100}%`;
|
|
118
|
+
el.style.width = `${next.w * 100}%`;
|
|
119
|
+
el.style.height = `${next.h * 100}%`;
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
end: (g, next, handle) => {
|
|
123
|
+
if (!next) {
|
|
124
|
+
if (g.wasSelected && handle === "move" && hasText) setTyping(true);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const el = element.current;
|
|
128
|
+
if (el) {
|
|
129
|
+
el.style.translate = "";
|
|
130
|
+
el.style.left = `${g.frame.x * 100}%`;
|
|
131
|
+
el.style.top = `${g.frame.y * 100}%`;
|
|
132
|
+
el.style.width = `${g.frame.w * 100}%`;
|
|
133
|
+
el.style.height = `${g.frame.h * 100}%`;
|
|
134
|
+
}
|
|
135
|
+
setDragging(false);
|
|
136
|
+
host.commit(box.id, next);
|
|
112
137
|
}
|
|
113
|
-
};
|
|
114
|
-
const start = (event, handle) => {
|
|
115
|
-
if (!editable || typing || event.button !== 0) return;
|
|
116
|
-
const stage = host.stageBox();
|
|
117
|
-
if (!stage) return;
|
|
118
|
-
event.preventDefault();
|
|
119
|
-
event.stopPropagation();
|
|
120
|
-
host.select(box.id);
|
|
121
|
-
event.currentTarget.setPointerCapture(event.pointerId);
|
|
122
|
-
gesture.current = {
|
|
123
|
-
handle,
|
|
124
|
-
pointer: { x: event.clientX, y: event.clientY },
|
|
125
|
-
frame,
|
|
126
|
-
stage,
|
|
127
|
-
next: null,
|
|
128
|
-
request: null,
|
|
129
|
-
wasSelected: selected
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
const move = (event) => {
|
|
133
|
-
const g = gesture.current;
|
|
134
|
-
if (!g) return;
|
|
135
|
-
const dx = (event.clientX - g.pointer.x) / g.stage.width;
|
|
136
|
-
const dy = (event.clientY - g.pointer.y) / g.stage.height;
|
|
137
|
-
if (!g.next) setDragging(true);
|
|
138
|
-
g.next = g.handle === "move" ? moveBox(g.frame, dx, dy) : stretchBox(g.frame, g.handle, dx, dy);
|
|
139
|
-
g.request ??= view().requestAnimationFrame(apply);
|
|
140
|
-
};
|
|
141
|
-
const end = () => {
|
|
142
|
-
const g = gesture.current;
|
|
143
|
-
gesture.current = null;
|
|
144
|
-
if (!g) return;
|
|
145
|
-
if (g.request !== null) view().cancelAnimationFrame(g.request);
|
|
146
|
-
if (!g.next) {
|
|
147
|
-
if (g.wasSelected && g.handle === "move" && hasText) setTyping(true);
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
const el = element.current;
|
|
151
|
-
if (el) {
|
|
152
|
-
el.style.translate = "";
|
|
153
|
-
el.style.left = `${g.frame.x * 100}%`;
|
|
154
|
-
el.style.top = `${g.frame.y * 100}%`;
|
|
155
|
-
el.style.width = `${g.frame.w * 100}%`;
|
|
156
|
-
el.style.height = `${g.frame.h * 100}%`;
|
|
157
|
-
}
|
|
158
|
-
setDragging(false);
|
|
159
|
-
host.commit(box.id, g.next);
|
|
160
|
-
};
|
|
138
|
+
});
|
|
161
139
|
const hasText = box.shape !== "line";
|
|
162
140
|
const inset = cqw(box.inset ?? DEFAULT_INSET);
|
|
163
141
|
const run = firstRun(box);
|
|
@@ -181,10 +159,8 @@ const StageBox = memo(function StageBox2({
|
|
|
181
159
|
transform,
|
|
182
160
|
willChange: dragging ? "translate" : void 0
|
|
183
161
|
},
|
|
184
|
-
onPointerDown: (event) => start(event, "move"),
|
|
185
|
-
|
|
186
|
-
onPointerUp: end,
|
|
187
|
-
onPointerCancel: end,
|
|
162
|
+
onPointerDown: (event) => gesture.start(event, "move"),
|
|
163
|
+
...gesture.handlers,
|
|
188
164
|
onDoubleClick: () => editable && hasText && setTyping(true),
|
|
189
165
|
onKeyDown: (event) => {
|
|
190
166
|
if (selected && !typing && event.key === "Enter" && hasText) {
|
|
@@ -259,14 +235,15 @@ const StageBox = memo(function StageBox2({
|
|
|
259
235
|
selected && !typing && !dragging && HANDLES.filter(
|
|
260
236
|
({ handle }) => box.shape !== "line" || handle === "e" || handle === "w" || handle === "n" || handle === "s"
|
|
261
237
|
).map(({ handle, left, top, cursor }) => /* @__PURE__ */ jsx(
|
|
262
|
-
|
|
238
|
+
GestureHandle,
|
|
263
239
|
{
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
240
|
+
left,
|
|
241
|
+
top,
|
|
242
|
+
cursor,
|
|
243
|
+
size: "sm",
|
|
244
|
+
onPointerDown: (event) => gesture.start(event, handle),
|
|
267
245
|
"aria-label": `Resize from ${handle}`,
|
|
268
|
-
|
|
269
|
-
children: /* @__PURE__ */ jsx("span", { className: "pointer-events-none size-2.5 rounded-full border-2 border-primary bg-background" })
|
|
246
|
+
testId: `stage-box-resize-${handle}`
|
|
270
247
|
},
|
|
271
248
|
handle
|
|
272
249
|
))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/presentation/StageBox.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * A text box or shape on the stage (`boxes`), drawn in CSS sized in container units so it scales\n * with the stage. In the editor it is selected with a click, moved by dragging it, resized from\n * its eight handles (its shape free), and typed in after a second click (a double click, or\n * Enter): the text is edited in place, in its own type.\n *\n * Like a clip, it moves on the GPU while dragged: a transform (or, resizing, its box) is set once\n * per animation frame and the new frame reaches the presentation when the drag ends.\n */\n\nimport {\n memo,\n useRef,\n useState,\n type CSSProperties,\n type PointerEvent as ReactPointerEvent,\n} from 'react'\nimport { cn } from '@arbidocs/react/ui'\nimport {\n DEFAULT_INSET,\n DEFAULT_TEXT_SIZE,\n boxText,\n firstRun,\n moveBox,\n stretchBox,\n type BoxFrame,\n type BoxHandle,\n type Paragraph,\n type SlideBox,\n} from './boxes'\nimport { STAGE_ASPECT } from './model'\nimport { TEXT_COLORS } from './theme'\nimport { cqw, runStyle } from './box-style'\n\nconst HANDLES: { handle: BoxHandle; left: string; top: string; cursor: string }[] = [\n { handle: 'nw', left: '0%', top: '0%', cursor: 'nwse-resize' },\n { handle: 'n', left: '50%', top: '0%', cursor: 'ns-resize' },\n { handle: 'ne', left: '100%', top: '0%', cursor: 'nesw-resize' },\n { handle: 'e', left: '100%', top: '50%', cursor: 'ew-resize' },\n { handle: 'se', left: '100%', top: '100%', cursor: 'nwse-resize' },\n { handle: 's', left: '50%', top: '100%', cursor: 'ns-resize' },\n { handle: 'sw', left: '0%', top: '100%', cursor: 'nesw-resize' },\n { handle: 'w', left: '0%', top: '50%', cursor: 'ew-resize' },\n]\n\nconst withAlpha = (hex: string, alpha = 1) => {\n if (alpha >= 1) return hex\n const n = parseInt(hex.slice(1), 16)\n return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`\n}\n\n/** A box's shape and outline, as CSS. */\nfunction shapeStyle(box: SlideBox): CSSProperties {\n const { frame } = box\n const line = box.line\n // A rounded rectangle's corners: a sixth of its shorter side, as PowerPoint's default.\n const shorter = Math.min(frame.w, (frame.h * 1) / STAGE_ASPECT)\n return {\n background: box.fill && box.shape !== 'line' ? withAlpha(box.fill, box.fillAlpha) : undefined,\n border:\n line && box.shape !== 'line'\n ? `${cqw(line.width)} ${line.dash ? 'dashed' : 'solid'} ${line.color}`\n : undefined,\n borderRadius:\n box.shape === 'ellipse'\n ? '50%'\n : box.shape === 'roundRect'\n ? `${shorter * 16.67}cqw`\n : undefined,\n }\n}\n\nexport function Paragraphs({\n paragraphs,\n font,\n}: {\n paragraphs: readonly Paragraph[]\n font: string\n}) {\n return (\n <>\n {paragraphs.map((paragraph, index) => {\n const first = paragraph.runs[0]\n const size = first?.size ?? DEFAULT_TEXT_SIZE\n const indent = (paragraph.level ?? 0) * 0.5 * size\n const empty = !paragraph.runs.some((run) => run.text)\n return (\n <div\n key={index}\n className=\"whitespace-pre-wrap break-words\"\n style={{\n textAlign: paragraph.align ?? 'left',\n lineHeight: 1.2,\n paddingLeft: cqw(indent + (paragraph.bullet ? size * 0.9 : 0)),\n textIndent: paragraph.bullet ? cqw(-size * 0.9) : undefined,\n // An empty line keeps its height.\n fontSize: cqw(size),\n }}\n >\n {paragraph.bullet && (\n <span\n style={{\n ...runStyle(first ?? { text: '' }, font),\n display: 'inline-block',\n width: cqw(size * 0.9),\n textIndent: 0,\n }}\n >\n \u2022\n </span>\n )}\n {empty\n ? '\u200B'\n : paragraph.runs.map((run, i) => (\n <span key={i} style={runStyle(run, font)}>\n {run.text}\n </span>\n ))}\n </div>\n )\n })}\n </>\n )\n}\n\n/** What a stage gives its boxes (stable: the boxes are memoised). */\nexport interface StageBoxHost {\n stageBox(): DOMRect | null\n select(boxId: string): void\n commit(boxId: string, frame: BoxFrame): void\n setText(boxId: string, text: string): void\n}\n\nexport interface StageBoxProps {\n box: SlideBox\n /** The theme's typeface (CSS), for runs without one of their own. */\n font: string\n editable: boolean\n selected: boolean\n host: StageBoxHost\n}\n\ninterface Gesture {\n handle: BoxHandle | 'move'\n pointer: { x: number; y: number }\n frame: BoxFrame\n stage: DOMRect\n next: BoxFrame | null\n request: number | null\n /** The box was already selected: a click on it (no move) starts typing. */\n wasSelected: boolean\n}\n\nexport const StageBox = memo(function StageBox({\n box,\n font,\n editable,\n selected,\n host,\n}: StageBoxProps) {\n const element = useRef<HTMLDivElement>(null)\n const gesture = useRef<Gesture | null>(null)\n const [typing, setTyping] = useState(false)\n const [dragging, setDragging] = useState(false)\n const { frame } = box\n const view = () => element.current?.ownerDocument.defaultView ?? window\n\n const apply = () => {\n const g = gesture.current\n const el = element.current\n if (!g || !el) return\n g.request = null\n if (!g.next) return\n if (g.handle === 'move') {\n el.style.translate = `${(g.next.x - g.frame.x) * g.stage.width}px ${(g.next.y - g.frame.y) * g.stage.height}px`\n } else {\n el.style.left = `${g.next.x * 100}%`\n el.style.top = `${g.next.y * 100}%`\n el.style.width = `${g.next.w * 100}%`\n el.style.height = `${g.next.h * 100}%`\n }\n }\n\n const start = (event: ReactPointerEvent, handle: Gesture['handle']) => {\n if (!editable || typing || event.button !== 0) return\n const stage = host.stageBox()\n if (!stage) return\n event.preventDefault()\n event.stopPropagation()\n host.select(box.id)\n event.currentTarget.setPointerCapture(event.pointerId)\n gesture.current = {\n handle,\n pointer: { x: event.clientX, y: event.clientY },\n frame,\n stage,\n next: null,\n request: null,\n wasSelected: selected,\n }\n }\n\n const move = (event: ReactPointerEvent) => {\n const g = gesture.current\n if (!g) return\n const dx = (event.clientX - g.pointer.x) / g.stage.width\n const dy = (event.clientY - g.pointer.y) / g.stage.height\n if (!g.next) setDragging(true)\n g.next = g.handle === 'move' ? moveBox(g.frame, dx, dy) : stretchBox(g.frame, g.handle, dx, dy)\n g.request ??= view().requestAnimationFrame(apply)\n }\n\n const end = () => {\n const g = gesture.current\n gesture.current = null\n if (!g) return\n if (g.request !== null) view().cancelAnimationFrame(g.request)\n if (!g.next) {\n // A click: selected; on a box already selected, typing starts (as in PowerPoint).\n if (g.wasSelected && g.handle === 'move' && hasText) setTyping(true)\n return\n }\n const el = element.current\n if (el) {\n // Back to the frame React set (the committed one replaces it on the next render).\n el.style.translate = ''\n el.style.left = `${g.frame.x * 100}%`\n el.style.top = `${g.frame.y * 100}%`\n el.style.width = `${g.frame.w * 100}%`\n el.style.height = `${g.frame.h * 100}%`\n }\n setDragging(false)\n host.commit(box.id, g.next)\n }\n\n const hasText = box.shape !== 'line'\n const inset = cqw(box.inset ?? DEFAULT_INSET)\n const run = firstRun(box)\n const transform = box.rotation ? `rotate(${box.rotation}deg)` : undefined\n\n return (\n <div\n ref={element}\n className={cn(\n 'absolute',\n editable ? 'pointer-events-auto' : 'pointer-events-none',\n editable && !typing && 'cursor-move touch-none',\n editable && !selected && 'hover:outline hover:outline-1 hover:outline-white/30',\n selected && 'outline outline-2 outline-offset-1 outline-primary'\n )}\n style={{\n left: `${frame.x * 100}%`,\n top: `${frame.y * 100}%`,\n width: `${frame.w * 100}%`,\n height: `${frame.h * 100}%`,\n transform,\n willChange: dragging ? 'translate' : undefined,\n }}\n onPointerDown={(event) => start(event, 'move')}\n onPointerMove={move}\n onPointerUp={end}\n onPointerCancel={end}\n onDoubleClick={() => editable && hasText && setTyping(true)}\n onKeyDown={(event) => {\n if (selected && !typing && event.key === 'Enter' && hasText) {\n event.preventDefault()\n setTyping(true)\n }\n }}\n tabIndex={editable ? 0 : undefined}\n data-testid={`stage-box-${box.id}`}\n >\n {box.shape === 'line' ? (\n <svg\n className=\"absolute inset-0 size-full overflow-visible\"\n preserveAspectRatio=\"none\"\n aria-hidden\n >\n <line\n x1=\"0%\"\n y1={box.flipV ? '100%' : '0%'}\n x2=\"100%\"\n y2={box.flipV ? '0%' : '100%'}\n stroke={box.line?.color ?? TEXT_COLORS.body}\n style={{ strokeWidth: cqw(box.line?.width ?? 1) }}\n strokeDasharray={box.line?.dash ? '6 4' : undefined}\n />\n </svg>\n ) : (\n <div\n className={cn(\n 'absolute inset-0 box-border flex flex-col overflow-hidden',\n box.anchor === 'middle' && 'justify-center',\n box.anchor === 'bottom' && 'justify-end'\n )}\n style={{ ...shapeStyle(box), padding: inset }}\n >\n {typing ? (\n <textarea\n autoFocus\n defaultValue={boxText(box)}\n className=\"pointer-events-auto w-full flex-1 resize-none bg-transparent p-0 outline-none\"\n style={{\n ...runStyle(run ?? { text: '' }, font),\n lineHeight: 1.2,\n textAlign: box.paragraphs[0]?.align ?? 'left',\n }}\n onPointerDown={(event) => event.stopPropagation()}\n onBlur={(event) => {\n host.setText(box.id, event.currentTarget.value)\n setTyping(false)\n }}\n onKeyDown={(event) => {\n event.stopPropagation()\n if (event.key === 'Escape') event.currentTarget.blur()\n }}\n aria-label=\"Text\"\n data-testid=\"stage-box-text-input\"\n />\n ) : boxText(box) || !editable ? (\n <Paragraphs paragraphs={box.paragraphs} font={font} />\n ) : (\n box.shape === 'text' && (\n <span\n className=\"text-white/40\"\n style={{ fontSize: cqw(run?.size ?? DEFAULT_TEXT_SIZE) }}\n >\n Double-click to type\n </span>\n )\n )}\n </div>\n )}\n {selected &&\n !typing &&\n !dragging &&\n HANDLES.filter(\n ({ handle }) =>\n box.shape !== 'line' ||\n handle === 'e' ||\n handle === 'w' ||\n handle === 'n' ||\n handle === 's'\n ).map(({ handle, left, top, cursor }) => (\n <div\n key={handle}\n className=\"absolute flex size-5 -translate-x-1/2 -translate-y-1/2 items-center justify-center pointer-coarse:size-11\"\n style={{ left, top, cursor, touchAction: 'none' }}\n onPointerDown={(event) => start(event, handle)}\n aria-label={`Resize from ${handle}`}\n data-testid={`stage-box-resize-${handle}`}\n >\n <span className=\"pointer-events-none size-2.5 rounded-full border-2 border-primary bg-background\" />\n </div>\n ))}\n </div>\n )\n})\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * A text box or shape on the stage (`boxes`), drawn in CSS sized in container units so it scales\n * with the stage. In the editor it is selected with a click, moved by dragging it, resized from\n * its eight handles (its shape free), and typed in after a second click (a double click, or\n * Enter): the text is edited in place, in its own type.\n *\n * Like a clip, it moves on the GPU while dragged: a transform (or, resizing, its box) is set once\n * per animation frame and the new frame reaches the presentation when the drag ends.\n */\n\nimport { memo, useRef, useState, type CSSProperties } from 'react'\nimport { cn } from '@arbidocs/react/ui'\nimport {\n CORNER_HANDLES,\n GestureHandle,\n SIDE_HANDLES,\n usePointerGesture,\n} from '../components/gestures'\nimport {\n DEFAULT_INSET,\n DEFAULT_TEXT_SIZE,\n boxText,\n firstRun,\n moveBox,\n stretchBox,\n type BoxFrame,\n type BoxHandle,\n type Paragraph,\n type SlideBox,\n} from './boxes'\nimport { STAGE_ASPECT } from './model'\nimport { TEXT_COLORS } from './theme'\nimport { cqw, runStyle } from './box-style'\n\n/** The eight handles, clockwise from the top left corner. */\nconst HANDLES: { handle: BoxHandle; left: string; top: string; cursor: string }[] = [\n CORNER_HANDLES[0],\n SIDE_HANDLES[0],\n CORNER_HANDLES[1],\n SIDE_HANDLES[1],\n CORNER_HANDLES[3],\n SIDE_HANDLES[2],\n CORNER_HANDLES[2],\n SIDE_HANDLES[3],\n]\n\nconst withAlpha = (hex: string, alpha = 1) => {\n if (alpha >= 1) return hex\n const n = parseInt(hex.slice(1), 16)\n return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`\n}\n\n/** A box's shape and outline, as CSS. */\nfunction shapeStyle(box: SlideBox): CSSProperties {\n const { frame } = box\n const line = box.line\n // A rounded rectangle's corners: a sixth of its shorter side, as PowerPoint's default.\n const shorter = Math.min(frame.w, (frame.h * 1) / STAGE_ASPECT)\n return {\n background: box.fill && box.shape !== 'line' ? withAlpha(box.fill, box.fillAlpha) : undefined,\n border:\n line && box.shape !== 'line'\n ? `${cqw(line.width)} ${line.dash ? 'dashed' : 'solid'} ${line.color}`\n : undefined,\n borderRadius:\n box.shape === 'ellipse'\n ? '50%'\n : box.shape === 'roundRect'\n ? `${shorter * 16.67}cqw`\n : undefined,\n }\n}\n\nexport function Paragraphs({\n paragraphs,\n font,\n}: {\n paragraphs: readonly Paragraph[]\n font: string\n}) {\n return (\n <>\n {paragraphs.map((paragraph, index) => {\n const first = paragraph.runs[0]\n const size = first?.size ?? DEFAULT_TEXT_SIZE\n const indent = (paragraph.level ?? 0) * 0.5 * size\n const empty = !paragraph.runs.some((run) => run.text)\n return (\n <div\n key={index}\n className=\"whitespace-pre-wrap break-words\"\n style={{\n textAlign: paragraph.align ?? 'left',\n lineHeight: 1.2,\n paddingLeft: cqw(indent + (paragraph.bullet ? size * 0.9 : 0)),\n textIndent: paragraph.bullet ? cqw(-size * 0.9) : undefined,\n // An empty line keeps its height.\n fontSize: cqw(size),\n }}\n >\n {paragraph.bullet && (\n <span\n style={{\n ...runStyle(first ?? { text: '' }, font),\n display: 'inline-block',\n width: cqw(size * 0.9),\n textIndent: 0,\n }}\n >\n \u2022\n </span>\n )}\n {empty\n ? '\u200B'\n : paragraph.runs.map((run, i) => (\n <span key={i} style={runStyle(run, font)}>\n {run.text}\n </span>\n ))}\n </div>\n )\n })}\n </>\n )\n}\n\n/** What a stage gives its boxes (stable: the boxes are memoised). */\nexport interface StageBoxHost {\n stageBox(): DOMRect | null\n select(boxId: string): void\n commit(boxId: string, frame: BoxFrame): void\n setText(boxId: string, text: string): void\n}\n\nexport interface StageBoxProps {\n box: SlideBox\n /** The theme's typeface (CSS), for runs without one of their own. */\n font: string\n editable: boolean\n selected: boolean\n host: StageBoxHost\n}\n\ntype Kind = BoxHandle | 'move'\n\ninterface Gesture {\n frame: BoxFrame\n stage: DOMRect\n /** The box was already selected: a click on it (no move) starts typing. */\n wasSelected: boolean\n}\n\nexport const StageBox = memo(function StageBox({\n box,\n font,\n editable,\n selected,\n host,\n}: StageBoxProps) {\n const element = useRef<HTMLDivElement>(null)\n const [typing, setTyping] = useState(false)\n const [dragging, setDragging] = useState(false)\n const { frame } = box\n\n const gesture = usePointerGesture<Kind, Gesture, BoxFrame>({\n element,\n begin: () => {\n if (!editable || typing) return null\n const stage = host.stageBox()\n if (!stage) return null\n host.select(box.id)\n return { frame, stage, wasSelected: selected }\n },\n dragStart: () => setDragging(true),\n update: (g, handle, { dx, dy }) =>\n handle === 'move'\n ? moveBox(g.frame, dx / g.stage.width, dy / g.stage.height)\n : stretchBox(g.frame, handle, dx / g.stage.width, dy / g.stage.height),\n apply: (g, next, handle) => {\n const el = element.current\n if (!el) return\n if (handle === 'move') {\n el.style.translate = `${(next.x - g.frame.x) * g.stage.width}px ${(next.y - g.frame.y) * g.stage.height}px`\n } else {\n el.style.left = `${next.x * 100}%`\n el.style.top = `${next.y * 100}%`\n el.style.width = `${next.w * 100}%`\n el.style.height = `${next.h * 100}%`\n }\n },\n end: (g, next, handle) => {\n if (!next) {\n // A click: selected; on a box already selected, typing starts (as in PowerPoint).\n if (g.wasSelected && handle === 'move' && hasText) setTyping(true)\n return\n }\n const el = element.current\n if (el) {\n // Back to the frame React set (the committed one replaces it on the next render).\n el.style.translate = ''\n el.style.left = `${g.frame.x * 100}%`\n el.style.top = `${g.frame.y * 100}%`\n el.style.width = `${g.frame.w * 100}%`\n el.style.height = `${g.frame.h * 100}%`\n }\n setDragging(false)\n host.commit(box.id, next)\n },\n })\n\n const hasText = box.shape !== 'line'\n const inset = cqw(box.inset ?? DEFAULT_INSET)\n const run = firstRun(box)\n const transform = box.rotation ? `rotate(${box.rotation}deg)` : undefined\n\n return (\n <div\n ref={element}\n className={cn(\n 'absolute',\n editable ? 'pointer-events-auto' : 'pointer-events-none',\n editable && !typing && 'cursor-move touch-none',\n editable && !selected && 'hover:outline hover:outline-1 hover:outline-white/30',\n selected && 'outline outline-2 outline-offset-1 outline-primary'\n )}\n style={{\n left: `${frame.x * 100}%`,\n top: `${frame.y * 100}%`,\n width: `${frame.w * 100}%`,\n height: `${frame.h * 100}%`,\n transform,\n willChange: dragging ? 'translate' : undefined,\n }}\n onPointerDown={(event) => gesture.start(event, 'move')}\n {...gesture.handlers}\n onDoubleClick={() => editable && hasText && setTyping(true)}\n onKeyDown={(event) => {\n if (selected && !typing && event.key === 'Enter' && hasText) {\n event.preventDefault()\n setTyping(true)\n }\n }}\n tabIndex={editable ? 0 : undefined}\n data-testid={`stage-box-${box.id}`}\n >\n {box.shape === 'line' ? (\n <svg\n className=\"absolute inset-0 size-full overflow-visible\"\n preserveAspectRatio=\"none\"\n aria-hidden\n >\n <line\n x1=\"0%\"\n y1={box.flipV ? '100%' : '0%'}\n x2=\"100%\"\n y2={box.flipV ? '0%' : '100%'}\n stroke={box.line?.color ?? TEXT_COLORS.body}\n style={{ strokeWidth: cqw(box.line?.width ?? 1) }}\n strokeDasharray={box.line?.dash ? '6 4' : undefined}\n />\n </svg>\n ) : (\n <div\n className={cn(\n 'absolute inset-0 box-border flex flex-col overflow-hidden',\n box.anchor === 'middle' && 'justify-center',\n box.anchor === 'bottom' && 'justify-end'\n )}\n style={{ ...shapeStyle(box), padding: inset }}\n >\n {typing ? (\n <textarea\n autoFocus\n defaultValue={boxText(box)}\n className=\"pointer-events-auto w-full flex-1 resize-none bg-transparent p-0 outline-none\"\n style={{\n ...runStyle(run ?? { text: '' }, font),\n lineHeight: 1.2,\n textAlign: box.paragraphs[0]?.align ?? 'left',\n }}\n onPointerDown={(event) => event.stopPropagation()}\n onBlur={(event) => {\n host.setText(box.id, event.currentTarget.value)\n setTyping(false)\n }}\n onKeyDown={(event) => {\n event.stopPropagation()\n if (event.key === 'Escape') event.currentTarget.blur()\n }}\n aria-label=\"Text\"\n data-testid=\"stage-box-text-input\"\n />\n ) : boxText(box) || !editable ? (\n <Paragraphs paragraphs={box.paragraphs} font={font} />\n ) : (\n box.shape === 'text' && (\n <span\n className=\"text-white/40\"\n style={{ fontSize: cqw(run?.size ?? DEFAULT_TEXT_SIZE) }}\n >\n Double-click to type\n </span>\n )\n )}\n </div>\n )}\n {selected &&\n !typing &&\n !dragging &&\n HANDLES.filter(\n ({ handle }) =>\n box.shape !== 'line' ||\n handle === 'e' ||\n handle === 'w' ||\n handle === 'n' ||\n handle === 's'\n ).map(({ handle, left, top, cursor }) => (\n <GestureHandle\n key={handle}\n left={left}\n top={top}\n cursor={cursor}\n size=\"sm\"\n onPointerDown={(event) => gesture.start(event, handle)}\n aria-label={`Resize from ${handle}`}\n testId={`stage-box-resize-${handle}`}\n />\n ))}\n </div>\n )\n})\n"],
|
|
5
|
+
"mappings": ";AAiFI,mBAoBU,KAbJ,YAPN;AAvEJ,SAAS,MAAM,QAAQ,gBAAoC;AAC3D,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AACP,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,KAAK,gBAAgB;AAG9B,MAAM,UAA8E;AAAA,EAClF,eAAe,CAAC;AAAA,EAChB,aAAa,CAAC;AAAA,EACd,eAAe,CAAC;AAAA,EAChB,aAAa,CAAC;AAAA,EACd,eAAe,CAAC;AAAA,EAChB,aAAa,CAAC;AAAA,EACd,eAAe,CAAC;AAAA,EAChB,aAAa,CAAC;AAChB;AAEA,MAAM,YAAY,CAAC,KAAa,QAAQ,MAAM;AAC5C,MAAI,SAAS,EAAG,QAAO;AACvB,QAAM,IAAI,SAAS,IAAI,MAAM,CAAC,GAAG,EAAE;AACnC,SAAO,QAAS,KAAK,KAAM,GAAG,KAAM,KAAK,IAAK,GAAG,KAAK,IAAI,GAAG,KAAK,KAAK;AACzE;AAGA,SAAS,WAAW,KAA8B;AAChD,QAAM,EAAE,MAAM,IAAI;AAClB,QAAM,OAAO,IAAI;AAEjB,QAAM,UAAU,KAA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G,SAAS;AAAA,gBACzC;AAAA,gBACA,eAAe,CAAC,UAAU,MAAM,gBAAgB;AAAA,gBAChD,QAAQ,CAAC,UAAU;AACjB,uBAAK,QAAQ,IAAI,IAAI,MAAM,cAAc,KAAK;AAC9C,4BAAU,KAAK;AAAA,gBACjB;AAAA,gBACA,WAAW,CAAC,UAAU;AACpB,wBAAM,gBAAgB;AACtB,sBAAI,MAAM,QAAQ,SAAU,OAAM,cAAc,KAAK;AAAA,gBACvD;AAAA,gBACA,cAAW;AAAA,gBACX,eAAY;AAAA;AAAA,YACd,IACE,QAAQ,GAAG,KAAK,CAAC,WACnB,oBAAC,cAAW,YAAY,IAAI,YAAY,MAAY,IAEpD,IAAI,UAAU,UACZ;AAAA,cAAC;AAAA;AAAA,gBACC,WAAU;AAAA,gBACV,OAAO,EAAE,UAAU,IAAI,KAAK,QAAQ,iBAAiB,EAAE;AAAA,gBACxD;AAAA;AAAA,YAED;AAAA;AAAA,QAGN;AAAA,QAED,YACC,CAAC,UACD,CAAC,YACD,QAAQ;AAAA,UACN,CAAC,EAAE,OAAO,MACR,IAAI,UAAU,UACd,WAAW,OACX,WAAW,OACX,WAAW,OACX,WAAW;AAAA,QACf,EAAE,IAAI,CAAC,EAAE,QAAQ,MAAM,KAAK,OAAO,MACjC;AAAA,UAAC;AAAA;AAAA,YAEC;AAAA,YACA;AAAA,YACA;AAAA,YACA,MAAK;AAAA,YACL,eAAe,CAAC,UAAU,QAAQ,MAAM,OAAO,MAAM;AAAA,YACrD,cAAY,eAAe,MAAM;AAAA,YACjC,QAAQ,oBAAoB,MAAM;AAAA;AAAA,UAP7B;AAAA,QAQP,CACD;AAAA;AAAA;AAAA,EACL;AAEJ,CAAC;",
|
|
6
6
|
"names": ["StageBox"]
|
|
7
7
|
}
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { memo, useRef, useState } from "react";
|
|
4
4
|
import { cn } from "@arbidocs/react/ui";
|
|
5
|
+
import {
|
|
6
|
+
CORNER_HANDLES,
|
|
7
|
+
GestureHandle,
|
|
8
|
+
SIDE_HANDLES,
|
|
9
|
+
usePointerGesture
|
|
10
|
+
} from "../components/gestures/index.js";
|
|
5
11
|
import { ClipImage } from "./ClipImage.js";
|
|
6
12
|
import {
|
|
7
13
|
frameHeight,
|
|
@@ -11,18 +17,7 @@ import {
|
|
|
11
17
|
} from "./model.js";
|
|
12
18
|
import { TEXT_COLORS, clipEdgeCss } from "./theme.js";
|
|
13
19
|
const isEdge = (kind) => kind === "n" || kind === "e" || kind === "s" || kind === "w";
|
|
14
|
-
const
|
|
15
|
-
{ edge: "n", left: "50%", top: "0%", cursor: "ns-resize", label: "top" },
|
|
16
|
-
{ edge: "e", left: "100%", top: "50%", cursor: "ew-resize", label: "right" },
|
|
17
|
-
{ edge: "s", left: "50%", top: "100%", cursor: "ns-resize", label: "bottom" },
|
|
18
|
-
{ edge: "w", left: "0%", top: "50%", cursor: "ew-resize", label: "left" }
|
|
19
|
-
];
|
|
20
|
-
const CORNERS = [
|
|
21
|
-
{ corner: "nw", left: "0%", top: "0%", cursor: "nwse-resize" },
|
|
22
|
-
{ corner: "ne", left: "100%", top: "0%", cursor: "nesw-resize" },
|
|
23
|
-
{ corner: "sw", left: "0%", top: "100%", cursor: "nesw-resize" },
|
|
24
|
-
{ corner: "se", left: "100%", top: "100%", cursor: "nwse-resize" }
|
|
25
|
-
];
|
|
20
|
+
const SIDE_NAMES = { n: "top", e: "right", s: "bottom", w: "left" };
|
|
26
21
|
const EDGE_CSS = clipEdgeCss();
|
|
27
22
|
const StageItem = memo(function StageItem2({
|
|
28
23
|
clip,
|
|
@@ -34,90 +29,73 @@ const StageItem = memo(function StageItem2({
|
|
|
34
29
|
host
|
|
35
30
|
}) {
|
|
36
31
|
const element = useRef(null);
|
|
37
|
-
const gesture = useRef(null);
|
|
38
32
|
const [reshape, setReshape] = useState(null);
|
|
39
33
|
const shown = reshape ? { ...clip, ...reshape.shape } : clip;
|
|
40
34
|
const box = reshape?.frame ?? frame;
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (key !== g.guidesKey) {
|
|
59
|
-
g.guidesKey = key;
|
|
60
|
-
host.guides(next.guides);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
const start = (event, kind) => {
|
|
64
|
-
if (!editable || event.button !== 0) return;
|
|
65
|
-
const stage = host.stageBox();
|
|
66
|
-
if (!stage) return;
|
|
67
|
-
event.preventDefault();
|
|
68
|
-
event.stopPropagation();
|
|
69
|
-
host.select(clip.id);
|
|
70
|
-
event.currentTarget.setPointerCapture(event.pointerId);
|
|
71
|
-
gesture.current = {
|
|
72
|
-
kind,
|
|
73
|
-
pointer: { x: event.clientX, y: event.clientY },
|
|
74
|
-
frame,
|
|
75
|
-
shape: { rect: clip.rect, aspect: clip.aspect },
|
|
76
|
-
stage,
|
|
77
|
-
others: host.others(clip.id),
|
|
78
|
-
next: null,
|
|
79
|
-
request: null,
|
|
80
|
-
guidesKey: ""
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
const move = (event) => {
|
|
84
|
-
const g = gesture.current;
|
|
85
|
-
if (!g) return;
|
|
86
|
-
if (!g.next) {
|
|
35
|
+
const gesture = usePointerGesture({
|
|
36
|
+
element,
|
|
37
|
+
begin: () => {
|
|
38
|
+
if (!editable) return null;
|
|
39
|
+
const stage = host.stageBox();
|
|
40
|
+
if (!stage) return null;
|
|
41
|
+
host.select(clip.id);
|
|
42
|
+
return {
|
|
43
|
+
frame,
|
|
44
|
+
shape: { rect: clip.rect, aspect: clip.aspect },
|
|
45
|
+
stage,
|
|
46
|
+
others: host.others(clip.id),
|
|
47
|
+
guidesKey: ""
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
// The first move: the drag is on (handles and actions hide; the layer is promoted).
|
|
51
|
+
dragStart: () => {
|
|
87
52
|
host.dragging(true);
|
|
88
53
|
if (element.current) element.current.style.willChange = "transform";
|
|
54
|
+
},
|
|
55
|
+
update: (g, kind, { dx: px, dy: py, event }) => {
|
|
56
|
+
const dx = px / g.stage.width;
|
|
57
|
+
const dy = py / g.stage.height;
|
|
58
|
+
const free = event.altKey;
|
|
59
|
+
if (isEdge(kind)) {
|
|
60
|
+
const result = reshapeFrame(g.frame, g.shape, kind, dx, dy, g.others, free);
|
|
61
|
+
return {
|
|
62
|
+
frame: result.frame,
|
|
63
|
+
shape: { rect: result.rect, aspect: result.aspect },
|
|
64
|
+
guides: result.guides
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return kind === "move" ? moveFrame(g.frame, g.shape.aspect, dx, dy, g.others, free) : resizeFrame(g.frame, g.shape.aspect, kind, dx, dy, g.others, free);
|
|
68
|
+
},
|
|
69
|
+
apply: (g, next) => {
|
|
70
|
+
const el = element.current;
|
|
71
|
+
if (!el) return;
|
|
72
|
+
if (next.shape) {
|
|
73
|
+
setReshape({ frame: next.frame, shape: next.shape });
|
|
74
|
+
} else {
|
|
75
|
+
const dx = (next.frame.x - g.frame.x) * g.stage.width;
|
|
76
|
+
const dy = (next.frame.y - g.frame.y) * g.stage.height;
|
|
77
|
+
const scale = next.frame.w / g.frame.w;
|
|
78
|
+
el.style.transform = `translate3d(${dx}px, ${dy}px, 0) scale(${scale})`;
|
|
79
|
+
}
|
|
80
|
+
const key = next.guides.map((guide) => `${guide.axis}${guide.at}`).join();
|
|
81
|
+
if (key !== g.guidesKey) {
|
|
82
|
+
g.guidesKey = key;
|
|
83
|
+
host.guides(next.guides);
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
end: (_g, next) => {
|
|
87
|
+
const el = element.current;
|
|
88
|
+
if (el) {
|
|
89
|
+
el.style.transform = "";
|
|
90
|
+
el.style.willChange = "";
|
|
91
|
+
}
|
|
92
|
+
if (!next) return;
|
|
93
|
+
setReshape(null);
|
|
94
|
+
host.dragging(false);
|
|
95
|
+
host.guides([]);
|
|
96
|
+
host.commit(clip.id, next.frame, next.shape);
|
|
89
97
|
}
|
|
90
|
-
|
|
91
|
-
const dy = (event.clientY - g.pointer.y) / g.stage.height;
|
|
92
|
-
const free = event.altKey;
|
|
93
|
-
if (isEdge(g.kind)) {
|
|
94
|
-
const result = reshapeFrame(g.frame, g.shape, g.kind, dx, dy, g.others, free);
|
|
95
|
-
g.next = {
|
|
96
|
-
frame: result.frame,
|
|
97
|
-
shape: { rect: result.rect, aspect: result.aspect },
|
|
98
|
-
guides: result.guides
|
|
99
|
-
};
|
|
100
|
-
} else {
|
|
101
|
-
g.next = g.kind === "move" ? moveFrame(g.frame, g.shape.aspect, dx, dy, g.others, free) : resizeFrame(g.frame, g.shape.aspect, g.kind, dx, dy, g.others, free);
|
|
102
|
-
}
|
|
103
|
-
g.request ??= view().requestAnimationFrame(apply);
|
|
104
|
-
};
|
|
105
|
-
const end = () => {
|
|
106
|
-
const g = gesture.current;
|
|
107
|
-
gesture.current = null;
|
|
108
|
-
if (!g) return;
|
|
109
|
-
if (g.request !== null) view().cancelAnimationFrame(g.request);
|
|
110
|
-
const el = element.current;
|
|
111
|
-
if (el) {
|
|
112
|
-
el.style.transform = "";
|
|
113
|
-
el.style.willChange = "";
|
|
114
|
-
}
|
|
115
|
-
if (!g.next) return;
|
|
116
|
-
setReshape(null);
|
|
117
|
-
host.dragging(false);
|
|
118
|
-
host.guides([]);
|
|
119
|
-
host.commit(clip.id, g.next.frame, g.next.shape);
|
|
120
|
-
};
|
|
98
|
+
});
|
|
121
99
|
return /* @__PURE__ */ jsxs(
|
|
122
100
|
"div",
|
|
123
101
|
{
|
|
@@ -136,10 +114,8 @@ const StageItem = memo(function StageItem2({
|
|
|
136
114
|
width: `${box.w * 100}%`,
|
|
137
115
|
height: `${frameHeight(box, shown.aspect) * 100}%`
|
|
138
116
|
},
|
|
139
|
-
onPointerDown: (event) => start(event, "move"),
|
|
140
|
-
|
|
141
|
-
onPointerUp: end,
|
|
142
|
-
onPointerCancel: end,
|
|
117
|
+
onPointerDown: (event) => gesture.start(event, "move"),
|
|
118
|
+
...gesture.handlers,
|
|
143
119
|
"data-testid": `stage-item-${clip.id}`,
|
|
144
120
|
children: [
|
|
145
121
|
/* @__PURE__ */ jsxs("div", { className: cn("absolute inset-0 overflow-hidden", !clip.plain && "rounded-[0.6cqw]"), children: [
|
|
@@ -163,36 +139,29 @@ const StageItem = memo(function StageItem2({
|
|
|
163
139
|
children: label
|
|
164
140
|
}
|
|
165
141
|
),
|
|
166
|
-
selected &&
|
|
167
|
-
|
|
142
|
+
selected && CORNER_HANDLES.map(({ handle: corner, left, top, cursor }) => /* @__PURE__ */ jsx(
|
|
143
|
+
GestureHandle,
|
|
168
144
|
{
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
145
|
+
left,
|
|
146
|
+
top,
|
|
147
|
+
cursor,
|
|
148
|
+
onPointerDown: (event) => gesture.start(event, corner),
|
|
172
149
|
"aria-label": `Resize from the ${corner} corner`,
|
|
173
|
-
|
|
174
|
-
children: /* @__PURE__ */ jsx("span", { className: "pointer-events-none size-3 rounded-full border-2 border-primary bg-background" })
|
|
150
|
+
testId: `stage-item-resize-${corner}`
|
|
175
151
|
},
|
|
176
152
|
corner
|
|
177
153
|
)),
|
|
178
|
-
selected &&
|
|
179
|
-
|
|
154
|
+
selected && SIDE_HANDLES.map(({ handle: edge, left, top, cursor }) => /* @__PURE__ */ jsx(
|
|
155
|
+
GestureHandle,
|
|
180
156
|
{
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
"
|
|
157
|
+
left,
|
|
158
|
+
top,
|
|
159
|
+
cursor,
|
|
160
|
+
bar: edge === "n" || edge === "s" ? "h" : "v",
|
|
161
|
+
onPointerDown: (event) => gesture.start(event, edge),
|
|
162
|
+
"aria-label": `Show more or less at the ${SIDE_NAMES[edge]}`,
|
|
185
163
|
title: "Drag to show more or less of the page",
|
|
186
|
-
|
|
187
|
-
children: /* @__PURE__ */ jsx(
|
|
188
|
-
"span",
|
|
189
|
-
{
|
|
190
|
-
className: cn(
|
|
191
|
-
"pointer-events-none rounded-full border-2 border-primary bg-background",
|
|
192
|
-
edge === "n" || edge === "s" ? "h-2 w-4" : "h-4 w-2"
|
|
193
|
-
)
|
|
194
|
-
}
|
|
195
|
-
)
|
|
164
|
+
testId: `stage-item-reshape-${edge}`
|
|
196
165
|
},
|
|
197
166
|
edge
|
|
198
167
|
))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/presentation/StageItem.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * One clip on the stage, and its own gestures: moved by dragging it, resized from a corner (its\n * shape kept), reshaped from a side's middle (more or less of the page that way), snapping to the\n * stage and to the other clips.\n *\n * Built for smooth dragging: while a clip is moved or resized nothing re-renders and nothing is\n * laid out again. Its element is moved by a GPU transform (translate, scale) once per animation\n * frame, and the new frame reaches the presentation once, when the drag ends. Only reshaping, which\n * changes what the clip shows, re-renders the clip itself (and nothing else). The component is\n * memoised: other clips, the slide's text and the other slides are untouched by its drags.\n */\n\nimport { memo, useRef, useState, type PointerEvent as ReactPointerEvent } from 'react'\nimport { cn } from '@arbidocs/react/ui'\nimport { ClipImage } from './ClipImage'\nimport {\n frameHeight,\n moveFrame,\n reshapeFrame,\n resizeFrame,\n type Clip,\n type Corner,\n type Edge,\n type Frame,\n type Guide,\n type Placed,\n} from './model'\nimport { TEXT_COLORS, clipEdgeCss } from './theme'\n\ntype Kind = 'move' | Corner | Edge\n\nconst isEdge = (kind: Kind): kind is Edge =>\n kind === 'n' || kind === 'e' || kind === 's' || kind === 'w'\n\n/** The handle on each side's middle: drag it to show more (or less) of the page that way. */\nconst EDGES: { edge: Edge; left: string; top: string; cursor: string; label: string }[] = [\n { edge: 'n', left: '50%', top: '0%', cursor: 'ns-resize', label: 'top' },\n { edge: 'e', left: '100%', top: '50%', cursor: 'ew-resize', label: 'right' },\n { edge: 's', left: '50%', top: '100%', cursor: 'ns-resize', label: 'bottom' },\n { edge: 'w', left: '0%', top: '50%', cursor: 'ew-resize', label: 'left' },\n]\n\nconst CORNERS: { corner: Corner; left: string; top: string; cursor: string }[] = [\n { corner: 'nw', left: '0%', top: '0%', cursor: 'nwse-resize' },\n { corner: 'ne', left: '100%', top: '0%', cursor: 'nesw-resize' },\n { corner: 'sw', left: '0%', top: '100%', cursor: 'nesw-resize' },\n { corner: 'se', left: '100%', top: '100%', cursor: 'nwse-resize' },\n]\n\nconst EDGE_CSS = clipEdgeCss()\n\n/** What a stage gives its clips (stable across renders: the clips are memoised). */\nexport interface StageItemHost {\n /** The stage's box on screen, as a gesture begins. */\n stageBox(): DOMRect | null\n /** The other clips of the slide, as a gesture begins: what this one snaps to. */\n others(clipId: string): Placed[]\n select(clipId: string): void\n /** The snap lines to draw while a clip is dragged (empty: none). */\n guides(guides: Guide[]): void\n /** A drag is on (the stage hides the selected clip's floating actions meanwhile). */\n dragging(on: boolean): void\n /** The drag's result, once it ends. */\n commit(clipId: string, frame: Frame, shape?: Pick<Clip, 'rect' | 'aspect'>): void\n}\n\nexport interface StageItemProps {\n clip: Clip\n frame: Frame\n editable: boolean\n selected: boolean\n dim: boolean\n /** Its source label, under it (empty: none). */\n label: string\n host: StageItemHost\n}\n\ninterface Gesture {\n kind: Kind\n pointer: { x: number; y: number }\n frame: Frame\n shape: Pick<Clip, 'rect' | 'aspect'>\n stage: DOMRect\n others: Placed[]\n /** The latest result, applied at the next animation frame and committed at the end. */\n next: { frame: Frame; shape?: Pick<Clip, 'rect' | 'aspect'>; guides: Guide[] } | null\n request: number | null\n guidesKey: string\n}\n\nexport const StageItem = memo(function StageItem({\n clip,\n frame,\n editable,\n selected,\n dim,\n label,\n host,\n}: StageItemProps) {\n const element = useRef<HTMLDivElement>(null)\n const gesture = useRef<Gesture | null>(null)\n // Being reshaped: drawn as it will be (the one case that re-renders while dragging).\n const [reshape, setReshape] = useState<{\n frame: Frame\n shape: Pick<Clip, 'rect' | 'aspect'>\n } | null>(null)\n\n const shown = reshape ? { ...clip, ...reshape.shape } : clip\n const box = reshape?.frame ?? frame\n\n const view = () => element.current?.ownerDocument.defaultView ?? window\n\n const apply = () => {\n const g = gesture.current\n const el = element.current\n if (!g) return\n g.request = null\n const next = g.next\n if (!next || !el) return\n if (next.shape) {\n setReshape({ frame: next.frame, shape: next.shape })\n } else {\n // Moved or resized: a transform from where the drag began (top left fixed as the origin).\n const dx = (next.frame.x - g.frame.x) * g.stage.width\n const dy = (next.frame.y - g.frame.y) * g.stage.height\n const scale = next.frame.w / g.frame.w\n el.style.transform = `translate3d(${dx}px, ${dy}px, 0) scale(${scale})`\n }\n const key = next.guides.map((guide) => `${guide.axis}${guide.at}`).join()\n if (key !== g.guidesKey) {\n g.guidesKey = key\n host.guides(next.guides)\n }\n }\n\n const start = (event: ReactPointerEvent, kind: Kind) => {\n if (!editable || event.button !== 0) return\n const stage = host.stageBox()\n if (!stage) return\n event.preventDefault()\n event.stopPropagation()\n host.select(clip.id)\n event.currentTarget.setPointerCapture(event.pointerId)\n gesture.current = {\n kind,\n pointer: { x: event.clientX, y: event.clientY },\n frame,\n shape: { rect: clip.rect, aspect: clip.aspect },\n stage,\n others: host.others(clip.id),\n next: null,\n request: null,\n guidesKey: '',\n }\n }\n\n const move = (event: ReactPointerEvent) => {\n const g = gesture.current\n if (!g) return\n if (!g.next) {\n // The first move: the drag is on (handles and actions hide; the layer is promoted).\n host.dragging(true)\n if (element.current) element.current.style.willChange = 'transform'\n }\n const dx = (event.clientX - g.pointer.x) / g.stage.width\n const dy = (event.clientY - g.pointer.y) / g.stage.height\n // Alt (Option) places freely, without snapping.\n const free = event.altKey\n if (isEdge(g.kind)) {\n const result = reshapeFrame(g.frame, g.shape, g.kind, dx, dy, g.others, free)\n g.next = {\n frame: result.frame,\n shape: { rect: result.rect, aspect: result.aspect },\n guides: result.guides,\n }\n } else {\n g.next =\n g.kind === 'move'\n ? moveFrame(g.frame, g.shape.aspect, dx, dy, g.others, free)\n : resizeFrame(g.frame, g.shape.aspect, g.kind, dx, dy, g.others, free)\n }\n g.request ??= view().requestAnimationFrame(apply)\n }\n\n const end = () => {\n const g = gesture.current\n gesture.current = null\n if (!g) return\n if (g.request !== null) view().cancelAnimationFrame(g.request)\n const el = element.current\n if (el) {\n el.style.transform = ''\n el.style.willChange = ''\n }\n if (!g.next) return // a click: the clip is selected, nothing moved\n setReshape(null)\n host.dragging(false)\n host.guides([])\n host.commit(clip.id, g.next.frame, g.next.shape)\n }\n\n return (\n <div\n ref={element}\n className={cn(\n 'absolute origin-top-left',\n // Lifted off the background (a picture that is part of the slide's design is not).\n !clip.plain && 'rounded-[0.6cqw] shadow-[0_0.5cqw_1.6cqw_rgba(0,0,0,0.5)]',\n editable && 'cursor-move touch-none',\n selected && 'outline outline-2 outline-offset-2 outline-primary',\n dim && 'opacity-30'\n )}\n style={{\n left: `${box.x * 100}%`,\n top: `${box.y * 100}%`,\n width: `${box.w * 100}%`,\n height: `${frameHeight(box, shown.aspect) * 100}%`,\n }}\n onPointerDown={(event) => start(event, 'move')}\n onPointerMove={move}\n onPointerUp={end}\n onPointerCancel={end}\n data-testid={`stage-item-${clip.id}`}\n >\n {/* Softly rounded, with a faint light edge: crisp on any background. */}\n <div className={cn('absolute inset-0 overflow-hidden', !clip.plain && 'rounded-[0.6cqw]')}>\n <ClipImage clip={shown} live={!editable} />\n {/* A page's text fades out at the clip's edge rather than being sliced. */}\n {clip.kind === 'pdf' && !clip.plain && (\n <div\n className=\"pointer-events-none absolute inset-0\"\n style={{ background: EDGE_CSS }}\n data-testid=\"stage-clip-edge\"\n />\n )}\n {!clip.plain && (\n <div className=\"pointer-events-none absolute inset-0 rounded-[0.6cqw] ring-1 ring-inset ring-white/15\" />\n )}\n </div>\n {label && !clip.plain && (\n // Under the clip, in the room the layout keeps (CAPTION_SPACE): never over it.\n <div\n className=\"pointer-events-none absolute left-0 top-full mt-[0.5cqw] max-w-full truncate text-[1.7cqw] leading-tight\"\n style={{ color: TEXT_COLORS.muted }}\n >\n {label}\n </div>\n )}\n {/* A handle on each corner (a small dot in a finger-sized target), and a bar on each side's\n middle; their moves bubble to the clip's handlers while the gesture lasts. */}\n {selected &&\n CORNERS.map(({ corner, left, top, cursor }) => (\n <div\n key={corner}\n className=\"absolute flex size-6 -translate-x-1/2 -translate-y-1/2 items-center justify-center pointer-coarse:size-11\"\n style={{ left, top, cursor, touchAction: 'none' }}\n onPointerDown={(event) => start(event, corner)}\n aria-label={`Resize from the ${corner} corner`}\n data-testid={`stage-item-resize-${corner}`}\n >\n <span className=\"pointer-events-none size-3 rounded-full border-2 border-primary bg-background\" />\n </div>\n ))}\n {selected &&\n EDGES.map(({ edge, left, top, cursor, label: side }) => (\n <div\n key={edge}\n className=\"absolute flex size-6 -translate-x-1/2 -translate-y-1/2 items-center justify-center pointer-coarse:size-11\"\n style={{ left, top, cursor, touchAction: 'none' }}\n onPointerDown={(event) => start(event, edge)}\n aria-label={`Show more or less at the ${side}`}\n title=\"Drag to show more or less of the page\"\n data-testid={`stage-item-reshape-${edge}`}\n >\n <span\n className={cn(\n 'pointer-events-none rounded-full border-2 border-primary bg-background',\n edge === 'n' || edge === 's' ? 'h-2 w-4' : 'h-4 w-2'\n )}\n />\n </div>\n ))}\n </div>\n )\n})\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * One clip on the stage, and its own gestures: moved by dragging it, resized from a corner (its\n * shape kept), reshaped from a side's middle (more or less of the page that way), snapping to the\n * stage and to the other clips.\n *\n * Built for smooth dragging: while a clip is moved or resized nothing re-renders and nothing is\n * laid out again. Its element is moved by a GPU transform (translate, scale) once per animation\n * frame, and the new frame reaches the presentation once, when the drag ends. Only reshaping, which\n * changes what the clip shows, re-renders the clip itself (and nothing else). The component is\n * memoised: other clips, the slide's text and the other slides are untouched by its drags.\n */\n\nimport { memo, useRef, useState } from 'react'\nimport { cn } from '@arbidocs/react/ui'\nimport {\n CORNER_HANDLES,\n GestureHandle,\n SIDE_HANDLES,\n usePointerGesture,\n} from '../components/gestures'\nimport { ClipImage } from './ClipImage'\nimport {\n frameHeight,\n moveFrame,\n reshapeFrame,\n resizeFrame,\n type Clip,\n type Corner,\n type Edge,\n type Frame,\n type Guide,\n type Placed,\n} from './model'\nimport { TEXT_COLORS, clipEdgeCss } from './theme'\n\ntype Kind = 'move' | Corner | Edge\n\nconst isEdge = (kind: Kind): kind is Edge =>\n kind === 'n' || kind === 'e' || kind === 's' || kind === 'w'\n\n/** What each side's middle handle is for: drag it to show more (or less) of the page that way. */\nconst SIDE_NAMES: Record<Edge, string> = { n: 'top', e: 'right', s: 'bottom', w: 'left' }\n\nconst EDGE_CSS = clipEdgeCss()\n\n/** What a stage gives its clips (stable across renders: the clips are memoised). */\nexport interface StageItemHost {\n /** The stage's box on screen, as a gesture begins. */\n stageBox(): DOMRect | null\n /** The other clips of the slide, as a gesture begins: what this one snaps to. */\n others(clipId: string): Placed[]\n select(clipId: string): void\n /** The snap lines to draw while a clip is dragged (empty: none). */\n guides(guides: Guide[]): void\n /** A drag is on (the stage hides the selected clip's floating actions meanwhile). */\n dragging(on: boolean): void\n /** The drag's result, once it ends. */\n commit(clipId: string, frame: Frame, shape?: Pick<Clip, 'rect' | 'aspect'>): void\n}\n\nexport interface StageItemProps {\n clip: Clip\n frame: Frame\n editable: boolean\n selected: boolean\n dim: boolean\n /** Its source label, under it (empty: none). */\n label: string\n host: StageItemHost\n}\n\ninterface Gesture {\n frame: Frame\n shape: Pick<Clip, 'rect' | 'aspect'>\n stage: DOMRect\n others: Placed[]\n guidesKey: string\n}\n\ntype Next = { frame: Frame; shape?: Pick<Clip, 'rect' | 'aspect'>; guides: Guide[] }\n\nexport const StageItem = memo(function StageItem({\n clip,\n frame,\n editable,\n selected,\n dim,\n label,\n host,\n}: StageItemProps) {\n const element = useRef<HTMLDivElement>(null)\n // Being reshaped: drawn as it will be (the one case that re-renders while dragging).\n const [reshape, setReshape] = useState<{\n frame: Frame\n shape: Pick<Clip, 'rect' | 'aspect'>\n } | null>(null)\n\n const shown = reshape ? { ...clip, ...reshape.shape } : clip\n const box = reshape?.frame ?? frame\n\n const gesture = usePointerGesture<Kind, Gesture, Next>({\n element,\n begin: () => {\n if (!editable) return null\n const stage = host.stageBox()\n if (!stage) return null\n host.select(clip.id)\n return {\n frame,\n shape: { rect: clip.rect, aspect: clip.aspect },\n stage,\n others: host.others(clip.id),\n guidesKey: '',\n }\n },\n // The first move: the drag is on (handles and actions hide; the layer is promoted).\n dragStart: () => {\n host.dragging(true)\n if (element.current) element.current.style.willChange = 'transform'\n },\n update: (g, kind, { dx: px, dy: py, event }) => {\n const dx = px / g.stage.width\n const dy = py / g.stage.height\n // Alt (Option) places freely, without snapping.\n const free = event.altKey\n if (isEdge(kind)) {\n const result = reshapeFrame(g.frame, g.shape, kind, dx, dy, g.others, free)\n return {\n frame: result.frame,\n shape: { rect: result.rect, aspect: result.aspect },\n guides: result.guides,\n }\n }\n return kind === 'move'\n ? moveFrame(g.frame, g.shape.aspect, dx, dy, g.others, free)\n : resizeFrame(g.frame, g.shape.aspect, kind, dx, dy, g.others, free)\n },\n apply: (g, next) => {\n const el = element.current\n if (!el) return\n if (next.shape) {\n setReshape({ frame: next.frame, shape: next.shape })\n } else {\n // Moved or resized: a transform from where the drag began (top left fixed as the origin).\n const dx = (next.frame.x - g.frame.x) * g.stage.width\n const dy = (next.frame.y - g.frame.y) * g.stage.height\n const scale = next.frame.w / g.frame.w\n el.style.transform = `translate3d(${dx}px, ${dy}px, 0) scale(${scale})`\n }\n const key = next.guides.map((guide) => `${guide.axis}${guide.at}`).join()\n if (key !== g.guidesKey) {\n g.guidesKey = key\n host.guides(next.guides)\n }\n },\n end: (_g, next) => {\n const el = element.current\n if (el) {\n el.style.transform = ''\n el.style.willChange = ''\n }\n if (!next) return // a click: the clip is selected, nothing moved\n setReshape(null)\n host.dragging(false)\n host.guides([])\n host.commit(clip.id, next.frame, next.shape)\n },\n })\n\n return (\n <div\n ref={element}\n className={cn(\n 'absolute origin-top-left',\n // Lifted off the background (a picture that is part of the slide's design is not).\n !clip.plain && 'rounded-[0.6cqw] shadow-[0_0.5cqw_1.6cqw_rgba(0,0,0,0.5)]',\n editable && 'cursor-move touch-none',\n selected && 'outline outline-2 outline-offset-2 outline-primary',\n dim && 'opacity-30'\n )}\n style={{\n left: `${box.x * 100}%`,\n top: `${box.y * 100}%`,\n width: `${box.w * 100}%`,\n height: `${frameHeight(box, shown.aspect) * 100}%`,\n }}\n onPointerDown={(event) => gesture.start(event, 'move')}\n {...gesture.handlers}\n data-testid={`stage-item-${clip.id}`}\n >\n {/* Softly rounded, with a faint light edge: crisp on any background. */}\n <div className={cn('absolute inset-0 overflow-hidden', !clip.plain && 'rounded-[0.6cqw]')}>\n <ClipImage clip={shown} live={!editable} />\n {/* A page's text fades out at the clip's edge rather than being sliced. */}\n {clip.kind === 'pdf' && !clip.plain && (\n <div\n className=\"pointer-events-none absolute inset-0\"\n style={{ background: EDGE_CSS }}\n data-testid=\"stage-clip-edge\"\n />\n )}\n {!clip.plain && (\n <div className=\"pointer-events-none absolute inset-0 rounded-[0.6cqw] ring-1 ring-inset ring-white/15\" />\n )}\n </div>\n {label && !clip.plain && (\n // Under the clip, in the room the layout keeps (CAPTION_SPACE): never over it.\n <div\n className=\"pointer-events-none absolute left-0 top-full mt-[0.5cqw] max-w-full truncate text-[1.7cqw] leading-tight\"\n style={{ color: TEXT_COLORS.muted }}\n >\n {label}\n </div>\n )}\n {/* A handle on each corner (a small dot in a finger-sized target), and a bar on each side's\n middle; their moves bubble to the clip's handlers while the gesture lasts. */}\n {selected &&\n CORNER_HANDLES.map(({ handle: corner, left, top, cursor }) => (\n <GestureHandle\n key={corner}\n left={left}\n top={top}\n cursor={cursor}\n onPointerDown={(event) => gesture.start(event, corner)}\n aria-label={`Resize from the ${corner} corner`}\n testId={`stage-item-resize-${corner}`}\n />\n ))}\n {selected &&\n SIDE_HANDLES.map(({ handle: edge, left, top, cursor }) => (\n <GestureHandle\n key={edge}\n left={left}\n top={top}\n cursor={cursor}\n bar={edge === 'n' || edge === 's' ? 'h' : 'v'}\n onPointerDown={(event) => gesture.start(event, edge)}\n aria-label={`Show more or less at the ${SIDE_NAMES[edge]}`}\n title=\"Drag to show more or less of the page\"\n testId={`stage-item-reshape-${edge}`}\n />\n ))}\n </div>\n )\n})\n"],
|
|
5
|
+
"mappings": ";AA+LM,SACE,KADF;AAnLN,SAAS,MAAM,QAAQ,gBAAgB;AACvC,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAOK;AACP,SAAS,aAAa,mBAAmB;AAIzC,MAAM,SAAS,CAAC,SACd,SAAS,OAAO,SAAS,OAAO,SAAS,OAAO,SAAS;AAG3D,MAAM,aAAmC,EAAE,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO;AAExF,MAAM,WAAW,YAAY;AAsCtB,MAAM,YAAY,KAAK,SAASA,WAAU;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAmB;AACjB,QAAM,UAAU,OAAuB,IAAI;AAE3C,QAAM,CAAC,SAAS,UAAU,IAAI,SAGpB,IAAI;AAEd,QAAM,QAAQ,UAAU,EAAE,GAAG,MAAM,GAAG,QAAQ,MAAM,IAAI;AACxD,QAAM,MAAM,SAAS,SAAS;AAE9B,QAAM,UAAU,kBAAuC;AAAA,IACrD;AAAA,IACA,OAAO,MAAM;AACX,UAAI,CAAC,SAAU,QAAO;AACtB,YAAM,QAAQ,KAAK,SAAS;AA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