camox 0.71.0 → 0.74.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/createApp.d.ts +4 -103
- package/dist/core/createApp.js +3 -24
- package/dist/core/createBlock.d.ts +2 -2
- package/dist/core/createBlock.js +41 -185
- package/dist/core/createLayout.d.ts +6 -77
- package/dist/core/createLayout.js +12 -50
- package/dist/core/editing/createEditableBlock.d.ts +9 -75
- package/dist/core/editing/createEditableBlock.js +258 -640
- package/dist/core/hooks/useIsEditable.js +2 -2
- package/dist/core/lib/artifactData.js +8 -3
- package/dist/core/lib/contentType.d.ts +23 -38
- package/dist/core/lib/contentType.js +34 -62
- package/dist/core/lib/iconTypes.d.ts +0 -3
- package/dist/core/lib/icons.js +63 -51
- package/dist/core/lib/recordScope.js +1 -1
- package/dist/features/canvas/CanvasOverlays.js +94 -176
- package/dist/features/canvas/CanvasPageFrame.js +62 -68
- package/dist/features/canvas/CanvasPreviewPageSlot.js +1 -3
- package/dist/features/canvas/canvasOverlayGeometry.js +1 -7
- package/dist/features/canvas/sidebar/CuratedPageInspector.js +3 -21
- package/dist/features/canvas/sidebar/LayoutPageBlocks.js +1 -2
- package/dist/features/canvas/useCanvasCamera.js +1 -1
- package/dist/features/canvas/useCanvasFrame.js +1 -1
- package/dist/features/content/ContentCollection.js +2 -2
- package/dist/features/content/collection-form.js +6 -7
- package/dist/features/page/CuratedPageContent.js +15 -24
- package/dist/features/page/UnplacedBlockContent.js +1 -6
- package/dist/features/preview/CamoxPreview.js +30 -33
- package/dist/features/preview/EditablePageContent.js +131 -151
- package/dist/features/preview/components/BlockActionsPopover.js +43 -152
- package/dist/features/preview/components/CanvasPreview.js +2 -2
- package/dist/features/preview/components/Frame.js +3 -3
- package/dist/features/preview/components/IconFieldEditor.js +1 -1
- package/dist/features/preview/components/ItemFieldsEditor.js +1 -3
- package/dist/features/preview/components/Overlays.js +18 -84
- package/dist/features/preview/components/PageInfo.js +121 -98
- package/dist/features/preview/components/PageTree.js +57 -103
- package/dist/features/preview/components/PreviewPanel.js +8 -11
- package/dist/features/preview/components/RecordCombobox.js +65 -78
- package/dist/features/preview/components/ReferenceFieldEditor.js +1 -19
- package/dist/features/preview/components/ReferenceListFieldEditor.js +1 -19
- package/dist/features/preview/components/RemovedBlockPlaceholder.js +2 -2
- package/dist/features/preview/components/SelectionEditor.js +6 -5
- package/dist/features/preview/components/useRepeatableItemActions.js +18 -24
- package/dist/features/preview/components/useUpdateBlockPosition.js +1 -1
- package/dist/features/preview/overlayMessages.js +1 -4
- package/dist/features/preview/previewStore.js +3 -23
- package/dist/features/renderer/RendererApp.js +17 -141
- package/dist/features/renderer/definitionAnswers.js +1 -8
- package/dist/features/renderer/rendererHost.js +1 -31
- package/dist/features/renderer/studioConnection.js +1 -25
- package/dist/features/routes/pageRuntime.js +15 -4
- package/dist/features/runtime/ClaimCard.js +192 -0
- package/dist/features/runtime/pageApp.js +5 -4
- package/dist/features/runtime/runtime.js +29 -8
- package/dist/features/runtime/worker.js +2 -2
- package/dist/features/runtime/workerRequest.d.ts +6 -0
- package/dist/features/runtime/workerRequest.js +13 -1
- package/dist/features/runtime/workerRuntime.d.ts +2 -2
- package/dist/features/runtime/workerRuntime.js +2 -2
- package/dist/features/studio/components/AgentSidebar.js +7 -7
- package/dist/features/studio/components/ChatWidget.js +142 -106
- package/dist/features/studio/components/ContentFindings.js +127 -230
- package/dist/features/studio/components/DeleteDraftDialog.js +112 -0
- package/dist/features/studio/components/DraftBar.js +98 -53
- package/dist/features/studio/components/DraftsControl.js +203 -190
- package/dist/features/studio/components/ReviewDraftDialog.js +670 -0
- package/dist/features/studio/components/{Patrol.js → Specialists.js} +291 -330
- package/dist/features/studio/components/Squareling.js +5 -5
- package/dist/features/studio/components/ThreadComposer.js +106 -127
- package/dist/features/studio/components/ThreadMessages.js +137 -45
- package/dist/features/studio/findingSentence.js +14 -12
- package/dist/features/studio/fixMessage.js +23 -0
- package/dist/features/studio/reportSentence.js +1 -1
- package/dist/features/studio/{patrollerBio.js → specialistBio.js} +8 -5
- package/dist/features/studio/studioStore.js +29 -15
- package/dist/features/studio/workingSentence.js +1 -1
- package/dist/features/vite/blockBoilerplate.js +1 -1
- package/dist/features/vite/definitionsSync.js +1 -8
- package/dist/lib/api-client.js +5 -1
- package/dist/lib/queries.js +5 -6
- package/dist/lib/studio-definitions.js +0 -2
- package/dist/lib/studio-reads.d.ts +1 -1
- package/dist/lib/studio-reads.js +5 -10
- package/dist/lib/use-thread.js +196 -138
- package/dist/package.js +1 -1
- package/dist/studio-overlays.css +0 -29
- package/dist/studio.css +1 -1
- package/package.json +4 -4
- package/skills/camox/SKILL.md +1 -1
- package/skills/camox/references/artifacts.md +4 -4
- package/skills/camox/references/block-definitions.md +21 -25
- package/skills/camox/references/dom-integrations.md +1 -1
- package/skills/camox/references/layout-definitions.md +3 -12
- package/skills/camox/references/routed-layouts.md +2 -2
- package/skills/camox-expand/SKILL.md +5 -5
- package/skills/camoxify/SKILL.md +4 -4
- package/dist/features/canvas/canvasInsertionSeams.js +0 -44
- package/dist/features/preview/components/AddBlockSheet.js +0 -314
- package/dist/features/preview/components/BlockPeek.js +0 -66
- package/dist/features/preview/components/BlockThumbnail.js +0 -281
- package/dist/features/preview/components/blockGridNavigation.js +0 -15
- package/dist/features/preview/referencePickerFocus.js +0 -29
- package/dist/features/studio/components/ReviewDraftSheet.js +0 -1587
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { previewStore, selectIsCanvasShown } from "../preview/previewStore.js";
|
|
2
2
|
import { useEditingFrame } from "../preview/editingFrame.js";
|
|
3
|
-
import { postOverlayMessage } from "../preview/overlayMessages.js";
|
|
4
3
|
import { FieldToolbar } from "../preview/components/FieldToolbar.js";
|
|
5
|
-
import { canvasInsertionSeams } from "./canvasInsertionSeams.js";
|
|
6
4
|
import { observeCanvasOverlays } from "./canvasOverlayGeometry.js";
|
|
7
5
|
import { c } from "react/compiler-runtime";
|
|
8
6
|
import * as React from "react";
|
|
9
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
8
|
import { useSelector } from "@xstate/store-react";
|
|
11
|
-
import { Button } from "@camox/ui/button";
|
|
12
|
-
import { PlusIcon } from "lucide-react";
|
|
13
9
|
|
|
14
10
|
//#region src/features/canvas/CanvasOverlays.tsx
|
|
15
11
|
/** Geometry stays in page coordinates. CSS projects it through the camera without
|
|
@@ -29,26 +25,25 @@ function canvasOverlayStyle(rect) {
|
|
|
29
25
|
*/
|
|
30
26
|
const CanvasOverlaysShownContext = React.createContext(true);
|
|
31
27
|
function CanvasOverlays(t0) {
|
|
32
|
-
const $ = c(
|
|
33
|
-
const { document,
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
let t3;
|
|
28
|
+
const $ = c(26);
|
|
29
|
+
const { document, pageHovered: t1, children } = t0;
|
|
30
|
+
const pageHovered = t1 === void 0 ? false : t1;
|
|
31
|
+
let t2;
|
|
37
32
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
38
|
-
|
|
39
|
-
$[0] =
|
|
40
|
-
} else
|
|
41
|
-
const [targets, setTargets] = React.useState(
|
|
33
|
+
t2 = [];
|
|
34
|
+
$[0] = t2;
|
|
35
|
+
} else t2 = $[0];
|
|
36
|
+
const [targets, setTargets] = React.useState(t2);
|
|
42
37
|
const isCanvasShown = useSelector(previewStore, selectIsCanvasShown);
|
|
43
38
|
const shown = React.use(CanvasOverlaysShownContext);
|
|
44
39
|
const { document: editingDocument } = useEditingFrame();
|
|
45
40
|
const [breadcrumbHoveredDocument, setBreadcrumbHoveredDocument] = React.useState(null);
|
|
46
41
|
const isEditingFrame = !!document && editingDocument === document;
|
|
47
42
|
const pageHover = pageHovered || isEditingFrame && breadcrumbHoveredDocument === document;
|
|
43
|
+
let t3;
|
|
48
44
|
let t4;
|
|
49
|
-
let t5;
|
|
50
45
|
if ($[1] !== document) {
|
|
51
|
-
|
|
46
|
+
t3 = () => {
|
|
52
47
|
const frameWindow = document?.defaultView;
|
|
53
48
|
if (!frameWindow) return;
|
|
54
49
|
const onMessage = (event) => {
|
|
@@ -58,187 +53,110 @@ function CanvasOverlays(t0) {
|
|
|
58
53
|
frameWindow.addEventListener("message", onMessage);
|
|
59
54
|
return () => frameWindow.removeEventListener("message", onMessage);
|
|
60
55
|
};
|
|
61
|
-
|
|
56
|
+
t4 = [document];
|
|
62
57
|
$[1] = document;
|
|
63
|
-
$[2] =
|
|
64
|
-
$[3] =
|
|
58
|
+
$[2] = t3;
|
|
59
|
+
$[3] = t4;
|
|
65
60
|
} else {
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
t3 = $[2];
|
|
62
|
+
t4 = $[3];
|
|
68
63
|
}
|
|
69
|
-
React.useEffect(
|
|
64
|
+
React.useEffect(t3, t4);
|
|
65
|
+
let t5;
|
|
70
66
|
let t6;
|
|
71
|
-
let t7;
|
|
72
67
|
if ($[4] !== document) {
|
|
73
|
-
|
|
68
|
+
t5 = () => {
|
|
74
69
|
if (!document) return;
|
|
75
70
|
return observeCanvasOverlays(document, setTargets);
|
|
76
71
|
};
|
|
77
|
-
|
|
72
|
+
t6 = [document];
|
|
78
73
|
$[4] = document;
|
|
79
|
-
$[5] =
|
|
80
|
-
$[6] =
|
|
74
|
+
$[5] = t5;
|
|
75
|
+
$[6] = t6;
|
|
81
76
|
} else {
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
t5 = $[5];
|
|
78
|
+
t6 = $[6];
|
|
84
79
|
}
|
|
85
|
-
React.useEffect(
|
|
80
|
+
React.useEffect(t5, t6);
|
|
81
|
+
let t7;
|
|
82
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
83
|
+
t7 = { position: "relative" };
|
|
84
|
+
$[7] = t7;
|
|
85
|
+
} else t7 = $[7];
|
|
86
|
+
const t8 = isCanvasShown && shown ? "block" : "none";
|
|
87
|
+
let t9;
|
|
88
|
+
if ($[8] !== t8) {
|
|
89
|
+
t9 = {
|
|
90
|
+
position: "absolute",
|
|
91
|
+
left: 0,
|
|
92
|
+
top: 0,
|
|
93
|
+
width: "calc(100% * var(--canvas-zoom, 1))",
|
|
94
|
+
height: "calc(100% * var(--canvas-zoom, 1))",
|
|
95
|
+
zIndex: 10,
|
|
96
|
+
pointerEvents: "none",
|
|
97
|
+
display: t8,
|
|
98
|
+
transform: "scale(calc(1 / var(--canvas-zoom, 1)))",
|
|
99
|
+
transformOrigin: "0 0"
|
|
100
|
+
};
|
|
101
|
+
$[8] = t8;
|
|
102
|
+
$[9] = t9;
|
|
103
|
+
} else t9 = $[9];
|
|
86
104
|
let t10;
|
|
105
|
+
if ($[10] !== pageHover) {
|
|
106
|
+
t10 = pageHover && /* @__PURE__ */ jsx("div", {
|
|
107
|
+
className: "camox-canvas-outline",
|
|
108
|
+
"data-canvas-page-outline": true,
|
|
109
|
+
style: {
|
|
110
|
+
position: "absolute",
|
|
111
|
+
inset: 0
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
$[10] = pageHover;
|
|
115
|
+
$[11] = t10;
|
|
116
|
+
} else t10 = $[11];
|
|
87
117
|
let t11;
|
|
118
|
+
if ($[12] !== document || $[13] !== isCanvasShown || $[14] !== isEditingFrame) {
|
|
119
|
+
t11 = isCanvasShown && isEditingFrame && /* @__PURE__ */ jsx(FieldToolbar, { document });
|
|
120
|
+
$[12] = document;
|
|
121
|
+
$[13] = isCanvasShown;
|
|
122
|
+
$[14] = isEditingFrame;
|
|
123
|
+
$[15] = t11;
|
|
124
|
+
} else t11 = $[15];
|
|
88
125
|
let t12;
|
|
126
|
+
if ($[16] !== targets) {
|
|
127
|
+
t12 = targets.flatMap(_temp);
|
|
128
|
+
$[16] = targets;
|
|
129
|
+
$[17] = t12;
|
|
130
|
+
} else t12 = $[17];
|
|
89
131
|
let t13;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if ($[7] !== activate || $[8] !== canAddBlocks || $[9] !== children || $[10] !== document || $[11] !== isCanvasShown || $[12] !== isEditingFrame || $[13] !== pageHover || $[14] !== shown || $[15] !== targets) {
|
|
96
|
-
const seams = canAddBlocks ? canvasInsertionSeams(targets) : [];
|
|
97
|
-
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
98
|
-
t15 = { position: "relative" };
|
|
99
|
-
$[25] = t15;
|
|
100
|
-
} else t15 = $[25];
|
|
101
|
-
t16 = children;
|
|
102
|
-
t8 = "camox-canvas-overlays";
|
|
103
|
-
t9 = true;
|
|
104
|
-
const t17 = isCanvasShown && shown ? "block" : "none";
|
|
105
|
-
if ($[26] !== t17) {
|
|
106
|
-
t10 = {
|
|
107
|
-
position: "absolute",
|
|
108
|
-
left: 0,
|
|
109
|
-
top: 0,
|
|
110
|
-
width: "calc(100% * var(--canvas-zoom, 1))",
|
|
111
|
-
height: "calc(100% * var(--canvas-zoom, 1))",
|
|
112
|
-
zIndex: 10,
|
|
113
|
-
pointerEvents: "none",
|
|
114
|
-
display: t17,
|
|
115
|
-
transform: "scale(calc(1 / var(--canvas-zoom, 1)))",
|
|
116
|
-
transformOrigin: "0 0"
|
|
117
|
-
};
|
|
118
|
-
$[26] = t17;
|
|
119
|
-
$[27] = t10;
|
|
120
|
-
} else t10 = $[27];
|
|
121
|
-
if ($[28] !== pageHover) {
|
|
122
|
-
t11 = pageHover && /* @__PURE__ */ jsx("div", {
|
|
123
|
-
className: "camox-canvas-outline",
|
|
124
|
-
"data-canvas-page-outline": true,
|
|
125
|
-
style: {
|
|
126
|
-
position: "absolute",
|
|
127
|
-
inset: 0
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
$[28] = pageHover;
|
|
131
|
-
$[29] = t11;
|
|
132
|
-
} else t11 = $[29];
|
|
133
|
-
if ($[30] !== document || $[31] !== isCanvasShown || $[32] !== isEditingFrame) {
|
|
134
|
-
t12 = isCanvasShown && isEditingFrame && /* @__PURE__ */ jsx(FieldToolbar, { document });
|
|
135
|
-
$[30] = document;
|
|
136
|
-
$[31] = isCanvasShown;
|
|
137
|
-
$[32] = isEditingFrame;
|
|
138
|
-
$[33] = t12;
|
|
139
|
-
} else t12 = $[33];
|
|
140
|
-
if ($[34] !== targets) {
|
|
141
|
-
t13 = targets.flatMap(_temp);
|
|
142
|
-
$[34] = targets;
|
|
143
|
-
$[35] = t13;
|
|
144
|
-
} else t13 = $[35];
|
|
145
|
-
t14 = isCanvasShown && seams.map((seam) => /* @__PURE__ */ jsxs("div", {
|
|
146
|
-
"data-canvas-overlay-control": true,
|
|
147
|
-
"data-canvas-insertion-seam": seam.key,
|
|
148
|
-
className: "group/seam flex items-center justify-center",
|
|
149
|
-
style: {
|
|
150
|
-
position: "absolute",
|
|
151
|
-
left: 0,
|
|
152
|
-
top: `calc(${seam.y}px * var(--canvas-zoom, 1))`,
|
|
153
|
-
width: "100%",
|
|
154
|
-
height: 40,
|
|
155
|
-
transform: "translateY(-50%)",
|
|
156
|
-
pointerEvents: "auto",
|
|
157
|
-
cursor: "default"
|
|
158
|
-
},
|
|
159
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
160
|
-
"aria-hidden": true,
|
|
161
|
-
"data-canvas-insertion-line": true,
|
|
162
|
-
className: "pointer-events-none absolute inset-x-0 top-1/2 -translate-y-1/2 opacity-0 group-focus-within/seam:opacity-100 group-hover/seam:opacity-100",
|
|
163
|
-
style: {
|
|
164
|
-
height: "var(--camox-overlay-width-hover)",
|
|
165
|
-
backgroundColor: "var(--camox-overlay-color-hover)"
|
|
166
|
-
}
|
|
167
|
-
}), /* @__PURE__ */ jsxs(Button, {
|
|
168
|
-
size: "xs",
|
|
169
|
-
className: "relative z-10 text-white opacity-0 shadow-sm group-focus-within/seam:opacity-100 group-hover/seam:opacity-100",
|
|
170
|
-
style: { backgroundColor: "var(--camox-overlay-color-selected)" },
|
|
171
|
-
onClick: (event_0) => {
|
|
172
|
-
event_0.stopPropagation();
|
|
173
|
-
activate();
|
|
174
|
-
postOverlayMessage(seam.request);
|
|
175
|
-
},
|
|
176
|
-
children: [/* @__PURE__ */ jsx(PlusIcon, {}), "Add block"]
|
|
177
|
-
})]
|
|
178
|
-
}, seam.key));
|
|
179
|
-
$[7] = activate;
|
|
180
|
-
$[8] = canAddBlocks;
|
|
181
|
-
$[9] = children;
|
|
182
|
-
$[10] = document;
|
|
183
|
-
$[11] = isCanvasShown;
|
|
184
|
-
$[12] = isEditingFrame;
|
|
185
|
-
$[13] = pageHover;
|
|
186
|
-
$[14] = shown;
|
|
187
|
-
$[15] = targets;
|
|
188
|
-
$[16] = t10;
|
|
189
|
-
$[17] = t11;
|
|
190
|
-
$[18] = t12;
|
|
191
|
-
$[19] = t13;
|
|
192
|
-
$[20] = t14;
|
|
193
|
-
$[21] = t15;
|
|
194
|
-
$[22] = t16;
|
|
195
|
-
$[23] = t8;
|
|
196
|
-
$[24] = t9;
|
|
197
|
-
} else {
|
|
198
|
-
t10 = $[16];
|
|
199
|
-
t11 = $[17];
|
|
200
|
-
t12 = $[18];
|
|
201
|
-
t13 = $[19];
|
|
202
|
-
t14 = $[20];
|
|
203
|
-
t15 = $[21];
|
|
204
|
-
t16 = $[22];
|
|
205
|
-
t8 = $[23];
|
|
206
|
-
t9 = $[24];
|
|
207
|
-
}
|
|
208
|
-
let t17;
|
|
209
|
-
if ($[36] !== t10 || $[37] !== t11 || $[38] !== t12 || $[39] !== t13 || $[40] !== t14 || $[41] !== t8 || $[42] !== t9) {
|
|
210
|
-
t17 = /* @__PURE__ */ jsxs("div", {
|
|
211
|
-
className: t8,
|
|
212
|
-
"data-canvas-overlays": t9,
|
|
213
|
-
style: t10,
|
|
132
|
+
if ($[18] !== t10 || $[19] !== t11 || $[20] !== t12 || $[21] !== t9) {
|
|
133
|
+
t13 = /* @__PURE__ */ jsxs("div", {
|
|
134
|
+
className: "camox-canvas-overlays",
|
|
135
|
+
"data-canvas-overlays": true,
|
|
136
|
+
style: t9,
|
|
214
137
|
children: [
|
|
138
|
+
t10,
|
|
215
139
|
t11,
|
|
216
|
-
t12
|
|
217
|
-
t13,
|
|
218
|
-
t14
|
|
140
|
+
t12
|
|
219
141
|
]
|
|
220
142
|
});
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
t18 = /* @__PURE__ */ jsxs("div", {
|
|
233
|
-
style: t15,
|
|
234
|
-
children: [t16, t17]
|
|
143
|
+
$[18] = t10;
|
|
144
|
+
$[19] = t11;
|
|
145
|
+
$[20] = t12;
|
|
146
|
+
$[21] = t9;
|
|
147
|
+
$[22] = t13;
|
|
148
|
+
} else t13 = $[22];
|
|
149
|
+
let t14;
|
|
150
|
+
if ($[23] !== children || $[24] !== t13) {
|
|
151
|
+
t14 = /* @__PURE__ */ jsxs("div", {
|
|
152
|
+
style: t7,
|
|
153
|
+
children: [children, t13]
|
|
235
154
|
});
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
return t18;
|
|
155
|
+
$[23] = children;
|
|
156
|
+
$[24] = t13;
|
|
157
|
+
$[25] = t14;
|
|
158
|
+
} else t14 = $[25];
|
|
159
|
+
return t14;
|
|
242
160
|
}
|
|
243
161
|
function _temp(target, index) {
|
|
244
162
|
return target.hovered || target.focused ? target.rects.map((rect, fragment) => /* @__PURE__ */ jsx("div", {
|
|
@@ -3,9 +3,9 @@ import { useEditingFrameClaim, useEditingOwner } from "../preview/editingFrame.j
|
|
|
3
3
|
import { EditableSurfaceContext } from "../../core/hooks/useIsEditable.js";
|
|
4
4
|
import { PreviewEditingOwnerContext } from "../preview/previewSelection.js";
|
|
5
5
|
import { RendererSlot, useRendererHost } from "../renderer/RendererFrames.js";
|
|
6
|
-
import { PreviewDocumentContext } from "../runtime/PreviewDocumentContext.js";
|
|
7
6
|
import { PreviewPreparationContext } from "../preview/previewPreparation.js";
|
|
8
7
|
import { canvasPageHref, measureCanvasDocument } from "./canvasFrameDocument.js";
|
|
8
|
+
import { PreviewDocumentContext } from "../runtime/PreviewDocumentContext.js";
|
|
9
9
|
import { Overlays } from "../preview/components/Overlays.js";
|
|
10
10
|
import { PreviewFrameEffects } from "../preview/components/PreviewPanel.js";
|
|
11
11
|
import { CanvasOverlays } from "./CanvasOverlays.js";
|
|
@@ -80,7 +80,7 @@ function CanvasPageFrame(props) {
|
|
|
80
80
|
return t0;
|
|
81
81
|
}
|
|
82
82
|
function PageFrame(t0) {
|
|
83
|
-
const $ = c(
|
|
83
|
+
const $ = c(67);
|
|
84
84
|
const { input, width, viewportHeight, pageId, selected: t1, hovered: t2, mode: t3, onActivate, onSettled } = t0;
|
|
85
85
|
const selected = t1 === void 0 ? false : t1;
|
|
86
86
|
const hovered = t2 === void 0 ? false : t2;
|
|
@@ -179,15 +179,14 @@ function PageFrame(t0) {
|
|
|
179
179
|
React.useEffect(t11, t12);
|
|
180
180
|
const t13 = input.dehydratedState;
|
|
181
181
|
const t14 = mount?.ownerDocument ?? null;
|
|
182
|
-
|
|
183
|
-
let t16;
|
|
182
|
+
let t15;
|
|
184
183
|
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
185
|
-
|
|
186
|
-
$[28] =
|
|
187
|
-
} else
|
|
188
|
-
let
|
|
184
|
+
t15 = /* @__PURE__ */ jsx("style", { children: overlayStyles });
|
|
185
|
+
$[28] = t15;
|
|
186
|
+
} else t15 = $[28];
|
|
187
|
+
let t16;
|
|
189
188
|
if ($[29] !== iframeProps || $[30] !== input.pathname || $[31] !== viewportHeight || $[32] !== width) {
|
|
190
|
-
|
|
189
|
+
t16 = iframeProps.srcDoc && /* @__PURE__ */ jsx("iframe", {
|
|
191
190
|
...iframeProps,
|
|
192
191
|
title: `Page preview: ${input.pathname}`,
|
|
193
192
|
style: {
|
|
@@ -201,11 +200,11 @@ function PageFrame(t0) {
|
|
|
201
200
|
$[30] = input.pathname;
|
|
202
201
|
$[31] = viewportHeight;
|
|
203
202
|
$[32] = width;
|
|
204
|
-
$[33] =
|
|
205
|
-
} else
|
|
206
|
-
let
|
|
203
|
+
$[33] = t16;
|
|
204
|
+
} else t16 = $[33];
|
|
205
|
+
let t17;
|
|
207
206
|
if ($[34] !== activate || $[35] !== iframe || $[36] !== iframeRef || $[37] !== input.derived?.layoutId || $[38] !== input.pathname || $[39] !== mode || $[40] !== mount || $[41] !== owner || $[42] !== rendered || $[43] !== renderer || $[44] !== selected || $[45] !== viewportHeight) {
|
|
208
|
-
|
|
207
|
+
t17 = mount && renderer && createPortal(/* @__PURE__ */ jsx(ArtifactsRunContext, {
|
|
209
208
|
value: selected,
|
|
210
209
|
children: /* @__PURE__ */ jsx(EditableSurfaceContext, {
|
|
211
210
|
value: selected,
|
|
@@ -226,8 +225,7 @@ function PageFrame(t0) {
|
|
|
226
225
|
/* @__PURE__ */ jsx(PreviewFrameEffects, {}),
|
|
227
226
|
/* @__PURE__ */ jsx(Overlays, {
|
|
228
227
|
frame: iframe,
|
|
229
|
-
owner
|
|
230
|
-
canAddBlocks: owner?.kind === "page"
|
|
228
|
+
owner
|
|
231
229
|
}),
|
|
232
230
|
rendered && /* @__PURE__ */ jsx(PageContentCommitted, {
|
|
233
231
|
selected,
|
|
@@ -251,76 +249,72 @@ function PageFrame(t0) {
|
|
|
251
249
|
$[43] = renderer;
|
|
252
250
|
$[44] = selected;
|
|
253
251
|
$[45] = viewportHeight;
|
|
254
|
-
$[46] =
|
|
255
|
-
} else
|
|
256
|
-
let
|
|
257
|
-
if ($[47] !==
|
|
258
|
-
|
|
252
|
+
$[46] = t17;
|
|
253
|
+
} else t17 = $[46];
|
|
254
|
+
let t18;
|
|
255
|
+
if ($[47] !== hovered || $[48] !== t14 || $[49] !== t16 || $[50] !== t17) {
|
|
256
|
+
t18 = /* @__PURE__ */ jsxs(CanvasOverlays, {
|
|
259
257
|
document: t14,
|
|
260
|
-
activate,
|
|
261
258
|
pageHovered: hovered,
|
|
262
|
-
canAddBlocks: t15,
|
|
263
259
|
children: [
|
|
260
|
+
t15,
|
|
264
261
|
t16,
|
|
265
|
-
t17
|
|
266
|
-
t18
|
|
262
|
+
t17
|
|
267
263
|
]
|
|
268
264
|
});
|
|
269
|
-
$[47] =
|
|
270
|
-
$[48] =
|
|
271
|
-
$[49] =
|
|
272
|
-
$[50] =
|
|
273
|
-
$[51] =
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
if ($[54] !== input.previewDocument || $[55] !== t19) {
|
|
279
|
-
t20 = /* @__PURE__ */ jsx(PreviewDocumentContext.Provider, {
|
|
265
|
+
$[47] = hovered;
|
|
266
|
+
$[48] = t14;
|
|
267
|
+
$[49] = t16;
|
|
268
|
+
$[50] = t17;
|
|
269
|
+
$[51] = t18;
|
|
270
|
+
} else t18 = $[51];
|
|
271
|
+
let t19;
|
|
272
|
+
if ($[52] !== input.previewDocument || $[53] !== t18) {
|
|
273
|
+
t19 = /* @__PURE__ */ jsx(PreviewDocumentContext.Provider, {
|
|
280
274
|
value: input.previewDocument,
|
|
281
|
-
children:
|
|
275
|
+
children: t18
|
|
282
276
|
});
|
|
283
|
-
$[
|
|
284
|
-
$[
|
|
285
|
-
$[
|
|
286
|
-
} else
|
|
287
|
-
let
|
|
288
|
-
if ($[
|
|
289
|
-
|
|
277
|
+
$[52] = input.previewDocument;
|
|
278
|
+
$[53] = t18;
|
|
279
|
+
$[54] = t19;
|
|
280
|
+
} else t19 = $[54];
|
|
281
|
+
let t20;
|
|
282
|
+
if ($[55] !== href || $[56] !== iframe || $[57] !== input.pathname || $[58] !== mount || $[59] !== t19) {
|
|
283
|
+
t20 = /* @__PURE__ */ jsx(CanvasFrameProviders, {
|
|
290
284
|
pathname: input.pathname,
|
|
291
285
|
href,
|
|
292
286
|
mount,
|
|
293
287
|
iframe,
|
|
294
|
-
children:
|
|
288
|
+
children: t19
|
|
295
289
|
});
|
|
296
|
-
$[
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
$[
|
|
302
|
-
} else
|
|
303
|
-
let
|
|
304
|
-
if ($[
|
|
305
|
-
|
|
290
|
+
$[55] = href;
|
|
291
|
+
$[56] = iframe;
|
|
292
|
+
$[57] = input.pathname;
|
|
293
|
+
$[58] = mount;
|
|
294
|
+
$[59] = t19;
|
|
295
|
+
$[60] = t20;
|
|
296
|
+
} else t20 = $[60];
|
|
297
|
+
let t21;
|
|
298
|
+
if ($[61] !== t13 || $[62] !== t20) {
|
|
299
|
+
t21 = /* @__PURE__ */ jsx(HydrationBoundary, {
|
|
306
300
|
state: t13,
|
|
307
|
-
children:
|
|
301
|
+
children: t20
|
|
308
302
|
});
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
311
|
-
$[
|
|
312
|
-
} else
|
|
313
|
-
let
|
|
314
|
-
if ($[
|
|
315
|
-
|
|
303
|
+
$[61] = t13;
|
|
304
|
+
$[62] = t20;
|
|
305
|
+
$[63] = t21;
|
|
306
|
+
} else t21 = $[63];
|
|
307
|
+
let t22;
|
|
308
|
+
if ($[64] !== owner || $[65] !== t21) {
|
|
309
|
+
t22 = /* @__PURE__ */ jsx(PreviewEditingOwnerContext, {
|
|
316
310
|
value: owner,
|
|
317
|
-
children:
|
|
311
|
+
children: t21
|
|
318
312
|
});
|
|
319
|
-
$[
|
|
320
|
-
$[
|
|
321
|
-
$[
|
|
322
|
-
} else
|
|
323
|
-
return
|
|
313
|
+
$[64] = owner;
|
|
314
|
+
$[65] = t21;
|
|
315
|
+
$[66] = t22;
|
|
316
|
+
} else t22 = $[66];
|
|
317
|
+
return t22;
|
|
324
318
|
}
|
|
325
319
|
|
|
326
320
|
//#endregion
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useEditingFrameClaim, useEditingOwner } from "../preview/editingFrame.js";
|
|
2
2
|
import { CanvasWorkspaceContext } from "./canvasZoom.js";
|
|
3
|
-
import { ViewportContinuityContext } from "../preview/viewportContinuity.js";
|
|
4
3
|
import { usePreviewPageFrame } from "../preview/previewPageFrame.js";
|
|
5
4
|
import { PreviewPreparationContext } from "../preview/previewPreparation.js";
|
|
5
|
+
import { ViewportContinuityContext } from "../preview/viewportContinuity.js";
|
|
6
6
|
import { useCanvasFrameMode } from "./canvasFrameMode.js";
|
|
7
7
|
import { CanvasOverlays } from "./CanvasOverlays.js";
|
|
8
8
|
import { CanvasPageEdge } from "./CanvasPageEdge.js";
|
|
@@ -108,9 +108,7 @@ function CanvasPreviewPageSlot({ pageId, layoutId, width, viewportHeight, select
|
|
|
108
108
|
},
|
|
109
109
|
children: [overlays && document && createPortal(/* @__PURE__ */ jsxs(CanvasOverlays, {
|
|
110
110
|
document,
|
|
111
|
-
activate: onInteract,
|
|
112
111
|
pageHovered: hovered,
|
|
113
|
-
canAddBlocks: owner?.kind === "page",
|
|
114
112
|
children: [/* @__PURE__ */ jsx("style", { children: overlayStyles }), /* @__PURE__ */ jsx("div", { style: {
|
|
115
113
|
width,
|
|
116
114
|
height
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { PREVIEW_PAUSED_ATTRIBUTE } from "../../core/lib/previewPaused.js";
|
|
2
2
|
import { repeatableItemElements, subscribeRepeatableItems } from "../preview/repeatableItemTargets.js";
|
|
3
|
-
import { readBlockInsertion } from "./canvasInsertionSeams.js";
|
|
4
3
|
import { resolveOverlayHighlights } from "../preview/overlayHighlights.js";
|
|
5
4
|
|
|
6
5
|
//#region src/features/canvas/canvasOverlayGeometry.ts
|
|
@@ -75,7 +74,6 @@ function measureElement(element) {
|
|
|
75
74
|
rects: rects.filter(hasArea),
|
|
76
75
|
visible: isVisible(element),
|
|
77
76
|
inline,
|
|
78
|
-
insertion: readBlockInsertion(element),
|
|
79
77
|
hovered: false,
|
|
80
78
|
focused: false,
|
|
81
79
|
synced: false
|
|
@@ -106,16 +104,12 @@ function measureItem(item, elements) {
|
|
|
106
104
|
function sameRect(a, b) {
|
|
107
105
|
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
108
106
|
}
|
|
109
|
-
function sameInsertion(a, b) {
|
|
110
|
-
if (!a || !b) return a === b;
|
|
111
|
-
return a.position === b.position && a.before === b.before && a.after === b.after && (a.afterPosition ?? null) === (b.afterPosition ?? null);
|
|
112
|
-
}
|
|
113
107
|
/** Whether a measurement found every target where it already was. */
|
|
114
108
|
function sameGeometry(previous, next) {
|
|
115
109
|
if (previous.length !== next.length) return false;
|
|
116
110
|
return next.every(({ target, depth, item }, index) => {
|
|
117
111
|
const before = previous[index];
|
|
118
|
-
return before.target.element === target.element && before.item === item && before.depth === depth && before.target.visible === target.visible && before.target.inline === target.inline && sameRect(before.target.bounds, target.bounds) && before.target.rects.length === target.rects.length && before.target.rects.every((rect, rectIndex) => sameRect(rect, target.rects[rectIndex]))
|
|
112
|
+
return before.target.element === target.element && before.item === item && before.depth === depth && before.target.visible === target.visible && before.target.inline === target.inline && sameRect(before.target.bounds, target.bounds) && before.target.rects.length === target.rects.length && before.target.rects.every((rect, rectIndex) => sameRect(rect, target.rects[rectIndex]));
|
|
119
113
|
});
|
|
120
114
|
}
|
|
121
115
|
const isInlineStyleChange = (mutation) => mutation.type === "attributes" && mutation.attributeName === "style";
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import { useProjectUuid } from "../../../lib/auth.js";
|
|
2
2
|
import { reads, useRead } from "../../../lib/studio-reads.js";
|
|
3
3
|
import { useLocalePath } from "../../../lib/view-locale.js";
|
|
4
|
-
import { PreviewEditingOwnerContext } from "../../preview/previewSelection.js";
|
|
5
|
-
import { AddBlockSheet } from "../../preview/components/AddBlockSheet.js";
|
|
6
4
|
import { PageInfo } from "../../preview/components/PageInfo.js";
|
|
7
5
|
import { PageTree } from "../../preview/components/PageTree.js";
|
|
8
6
|
import { PageOverview } from "./PageOverview.js";
|
|
9
7
|
import { c } from "react/compiler-runtime";
|
|
10
|
-
import
|
|
11
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
9
|
|
|
13
10
|
//#region src/features/canvas/sidebar/CuratedPageInspector.tsx
|
|
14
11
|
/** A curated page: its blocks, which editors arrange, then what's about the page. */
|
|
15
12
|
function CuratedPageInspector() {
|
|
16
|
-
const $ = c(
|
|
13
|
+
const $ = c(6);
|
|
17
14
|
const pathname = useLocalePath();
|
|
18
15
|
const projectUuid = useProjectUuid();
|
|
19
|
-
const owner = React.useContext(PreviewEditingOwnerContext);
|
|
20
16
|
let t0;
|
|
21
17
|
if ($[0] !== pathname || $[1] !== projectUuid) {
|
|
22
18
|
t0 = reads.pageStructure({
|
|
@@ -48,21 +44,7 @@ function CuratedPageInspector() {
|
|
|
48
44
|
$[4] = pageId;
|
|
49
45
|
$[5] = t2;
|
|
50
46
|
} else t2 = $[5];
|
|
51
|
-
|
|
52
|
-
let t4;
|
|
53
|
-
if ($[6] !== t3) {
|
|
54
|
-
t4 = /* @__PURE__ */ jsx(AddBlockSheet, { focusCreatedBlock: t3 });
|
|
55
|
-
$[6] = t3;
|
|
56
|
-
$[7] = t4;
|
|
57
|
-
} else t4 = $[7];
|
|
58
|
-
let t5;
|
|
59
|
-
if ($[8] !== t2 || $[9] !== t4) {
|
|
60
|
-
t5 = /* @__PURE__ */ jsxs(Fragment, { children: [t2, t4] });
|
|
61
|
-
$[8] = t2;
|
|
62
|
-
$[9] = t4;
|
|
63
|
-
$[10] = t5;
|
|
64
|
-
} else t5 = $[10];
|
|
65
|
-
return t5;
|
|
47
|
+
return t2;
|
|
66
48
|
}
|
|
67
49
|
|
|
68
50
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { canvasStore } from "./canvasStore.js";
|
|
2
|
-
import { ViewportContinuityContext, captureViewportAnchor, resolveViewportAnchor } from "../preview/viewportContinuity.js";
|
|
3
2
|
import { canvasPageIframe } from "../preview/previewPageFrame.js";
|
|
3
|
+
import { ViewportContinuityContext, captureViewportAnchor, resolveViewportAnchor } from "../preview/viewportContinuity.js";
|
|
4
4
|
import { canvasSeamCover } from "./canvasFrameDocument.js";
|
|
5
5
|
import { revealScrollDelta } from "../preview/selectionReveal.js";
|
|
6
6
|
import { CANVAS_WHEEL_ZOOM_RATE, ZOOM_STRETCH, canvasMaximumScale, canvasMinimumScale, canvasOverview, canvasVerticalRail, canvasWheelDelta, constrainCanvasCamera, findCanvasSnapTarget, fitCanvasPage, isCanvasCameraSnapped, isCanvasPageScale, isInCanvasSnapWindow, placeCanvasPageAnchor, snapCanvasZoom, stretchCanvasZoom, unstretchCanvasZoom, zoomCanvasAt } from "./canvasCamera.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NavigationProvider } from "../navigation/navigation.js";
|
|
2
|
-
import { FrameContext } from "../preview/components/Frame.js";
|
|
3
2
|
import { createCanvasDocument, observeCanvasDocument, pauseCanvasDocument, refreshCanvasDocument } from "./canvasFrameDocument.js";
|
|
4
3
|
import { useCanvasFrameInput } from "./useCanvasFrameInput.js";
|
|
4
|
+
import { FrameContext } from "../preview/components/Frame.js";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -6,7 +6,7 @@ import { MultipleAssetFieldEditor } from "../preview/components/MultipleAssetFie
|
|
|
6
6
|
import { ReferenceFieldEditor } from "../preview/components/ReferenceFieldEditor.js";
|
|
7
7
|
import { ReferenceListFieldEditor } from "../preview/components/ReferenceListFieldEditor.js";
|
|
8
8
|
import { invalidateCollectionRecordViews } from "../../lib/collection-cache.js";
|
|
9
|
-
import { collectionFormContent,
|
|
9
|
+
import { collectionFormContent, collectionFormFields, collectionFormValues } from "./collection-form.js";
|
|
10
10
|
import { DeleteCollectionItemButton } from "./components/DeleteCollectionItemButton.js";
|
|
11
11
|
import { c } from "react/compiler-runtime";
|
|
12
12
|
import { useState } from "react";
|
|
@@ -259,7 +259,7 @@ function CollectionItemForm({ contentSchema, toTitle, projectUuid, collectionId,
|
|
|
259
259
|
const edit = useMutation(collectionMutations.edit());
|
|
260
260
|
const [submitting, setSubmitting] = useState(false);
|
|
261
261
|
const saving = submitting || create.isPending || edit.isPending;
|
|
262
|
-
const [defaultValues] = useState(() =>
|
|
262
|
+
const [defaultValues] = useState(() => collectionFormValues(fields, savedRecord?.content ?? initialContent));
|
|
263
263
|
const form = useForm({
|
|
264
264
|
defaultValues,
|
|
265
265
|
onSubmit: async ({ value }) => {
|