camox 0.51.0 → 0.52.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 +1 -0
- package/dist/core/createApp.js +1 -0
- package/dist/core/editing/contentEdits.js +78 -0
- package/dist/core/editing/createEditableBlock.js +277 -311
- package/dist/core/lib/contentType.js +2 -2
- package/dist/core/recordItem.js +3 -3
- package/dist/features/canvas/CamoxCanvas.js +15 -15
- package/dist/features/canvas/CanvasLoadingScreen.js +15 -11
- package/dist/features/canvas/CanvasPageFrame.js +81 -87
- package/dist/features/canvas/CanvasPreviewPageSlot.js +1 -1
- package/dist/features/canvas/DerivedPagePathInput.js +12 -12
- package/dist/features/canvas/canvasOverlayGeometry.js +1 -1
- package/dist/features/canvas/canvasStore.js +2 -2
- package/dist/features/canvas/sidebar/CuratedPageInspector.js +1 -1
- package/dist/features/canvas/sidebar/LayoutPageBlocks.js +23 -31
- package/dist/features/canvas/useCanvasCamera.js +1 -1
- package/dist/features/canvas/useDiscoveredPreviewPaths.js +16 -9
- package/dist/features/page/CuratedPageContent.js +1 -1
- package/dist/features/preview/CamoxPreview.d.ts +8 -4
- package/dist/features/preview/CamoxPreview.js +257 -442
- package/dist/features/preview/EditablePageContent.js +244 -2
- package/dist/features/preview/EditablePageExperience.js +2 -4
- package/dist/features/preview/components/AddBlockSheet.js +55 -15
- package/dist/features/preview/components/BlockActionsPopover.js +12 -16
- package/dist/features/preview/components/BlockPeek.js +66 -0
- package/dist/features/preview/components/BlockThumbnail.js +134 -119
- package/dist/features/preview/components/CanvasPreview.js +1 -1
- package/dist/features/preview/components/CreatePageModal.js +150 -156
- package/dist/features/preview/components/Frame.js +27 -4
- package/dist/features/preview/components/MobilePreviewDrawer.js +1 -1
- package/dist/features/preview/components/PageInfo.js +161 -126
- package/dist/features/preview/components/PagePicker.js +2 -2
- package/dist/features/preview/components/PageTree.js +174 -190
- package/dist/features/preview/components/PreviewPanel.js +3 -3
- package/dist/features/preview/components/ReferenceFieldEditor.js +4 -4
- package/dist/features/preview/components/ReferenceListFieldEditor.js +4 -4
- package/dist/features/preview/components/RemovedBlockPlaceholder.js +37 -70
- package/dist/features/preview/components/RepeatableItemsList.js +1 -1
- package/dist/features/preview/components/SelectionEditor.js +248 -256
- package/dist/features/preview/components/StudioEditingFallback.js +22 -26
- package/dist/features/preview/components/useFieldWriter.js +19 -19
- package/dist/features/preview/components/useRecordView.js +105 -147
- package/dist/features/preview/components/useRepeatableItemActions.js +0 -2
- package/dist/features/preview/pageRecord.js +30 -24
- package/dist/features/preview/previewStore.js +2 -0
- package/dist/features/preview/studioNotice.js +20 -0
- package/dist/features/provider/AuthenticatedCamoxProvider.js +46 -30
- package/dist/features/renderer/RendererApp.js +542 -0
- package/dist/features/renderer/RendererFrames.js +450 -0
- package/dist/features/renderer/definitionAnswers.js +26 -0
- package/dist/features/renderer/protocol.js +35 -0
- package/dist/features/renderer/rendererHost.js +249 -0
- package/dist/features/renderer/studioConnection.js +186 -0
- package/dist/features/routes/pageRuntime.js +7 -2
- package/dist/features/runtime/RuntimeChrome.js +2 -5
- package/dist/features/runtime/assetPrefix.js +14 -0
- package/dist/features/runtime/breadcrumbs.js +1 -1
- package/dist/features/runtime/editingFallback.js +4 -8
- package/dist/features/runtime/livePages.js +1 -1
- package/dist/features/runtime/pageApp.js +57 -83
- package/dist/features/runtime/pageClient.js +1 -1
- package/dist/features/runtime/pageNavigation.js +3 -2
- package/dist/features/runtime/publicCache.js +15 -3
- package/dist/features/runtime/publishingDraft.js +23 -0
- package/dist/features/runtime/rendererClient.d.ts +8 -0
- package/dist/features/runtime/rendererClient.js +77 -0
- package/dist/features/runtime/runtime.d.ts +9 -0
- package/dist/features/runtime/runtime.js +36 -17
- package/dist/features/runtime/runtimeRoutes.d.ts +2 -0
- package/dist/features/runtime/runtimeRoutes.js +2 -0
- package/dist/features/runtime/worker.d.ts +10 -1
- package/dist/features/runtime/worker.js +20 -7
- package/dist/features/studio/FollowAgentProvider.js +10 -10
- package/dist/features/studio/components/ProjectMenu.js +1 -1
- package/dist/features/studio/components/ReviewDraftSheet.js +242 -138
- package/dist/features/studio/components/ThreadMessages.js +100 -65
- package/dist/features/studio/components/UserButton.js +1 -1
- package/dist/features/vite/definitionsSync.js +1 -1
- package/dist/features/vite/hostedChecks.js +127 -0
- package/dist/features/vite/runtimeDev.js +26 -0
- package/dist/features/vite/vite.js +33 -5
- package/dist/hooks/use-page-destinations.js +10 -10
- package/dist/lib/revisions.js +20 -0
- package/dist/lib/studio-definitions.js +160 -0
- package/dist/lib/studio-reads.js +65 -21
- package/dist/lib/use-project-room.js +16 -10
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +8 -4
- package/skills/camox/SKILL.md +4 -0
- package/skills/camox/references/artifacts.md +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useProjectUuid } from "../../../lib/auth.js";
|
|
2
2
|
import { useNavigate } from "../../navigation/navigation.js";
|
|
3
|
-
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
4
3
|
import { reads, useReadQuery } from "../../../lib/studio-reads.js";
|
|
5
4
|
import { pageMutations } from "../../../lib/queries.js";
|
|
5
|
+
import { useLayoutDefinitions } from "../../../lib/studio-definitions.js";
|
|
6
6
|
import { useLocalizedPath } from "../../../lib/view-locale.js";
|
|
7
7
|
import { PageNicknameField } from "./PageNicknameField.js";
|
|
8
8
|
import { previewStore } from "../previewStore.js";
|
|
@@ -27,7 +27,7 @@ const slugifyPathSegment = (nickname) => {
|
|
|
27
27
|
return trimmedNickname.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
28
28
|
};
|
|
29
29
|
const CreatePageModal = () => {
|
|
30
|
-
const $ = c(
|
|
30
|
+
const $ = c(51);
|
|
31
31
|
const projectUuid = useProjectUuid();
|
|
32
32
|
const open = useSelector(previewStore, _temp);
|
|
33
33
|
let t0;
|
|
@@ -57,43 +57,28 @@ const CreatePageModal = () => {
|
|
|
57
57
|
$[6] = t4;
|
|
58
58
|
} else t4 = $[6];
|
|
59
59
|
const { data: pages } = useReadQuery(t2, t4);
|
|
60
|
+
const allLayouts = useLayoutDefinitions();
|
|
60
61
|
let t5;
|
|
61
|
-
if ($[7] !==
|
|
62
|
-
t5 =
|
|
63
|
-
$[7] =
|
|
62
|
+
if ($[7] !== allLayouts) {
|
|
63
|
+
t5 = allLayouts.filter(_temp2);
|
|
64
|
+
$[7] = allLayouts;
|
|
64
65
|
$[8] = t5;
|
|
65
66
|
} else t5 = $[8];
|
|
66
|
-
const
|
|
67
|
-
let t7;
|
|
68
|
-
if ($[9] !== t6) {
|
|
69
|
-
t7 = { enabled: t6 };
|
|
70
|
-
$[9] = t6;
|
|
71
|
-
$[10] = t7;
|
|
72
|
-
} else t7 = $[10];
|
|
73
|
-
const { data: allLayouts } = useReadQuery(t5, t7);
|
|
74
|
-
const camoxApp = useCamoxApp();
|
|
75
|
-
let t8;
|
|
76
|
-
if ($[11] !== allLayouts || $[12] !== camoxApp) {
|
|
77
|
-
t8 = allLayouts?.filter((layout) => camoxApp.getLayoutById(layout.layoutId)?._internal.kind === "curated");
|
|
78
|
-
$[11] = allLayouts;
|
|
79
|
-
$[12] = camoxApp;
|
|
80
|
-
$[13] = t8;
|
|
81
|
-
} else t8 = $[13];
|
|
82
|
-
const layouts = t8;
|
|
67
|
+
const layouts = t5;
|
|
83
68
|
const navigate = useNavigate();
|
|
84
69
|
const localized = useLocalizedPath();
|
|
85
|
-
let
|
|
86
|
-
if ($[
|
|
87
|
-
|
|
70
|
+
let t6;
|
|
71
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
72
|
+
t6 = {
|
|
88
73
|
nickname: "",
|
|
89
74
|
parentPageId: void 0,
|
|
90
75
|
pathSegment: "",
|
|
91
76
|
layoutId: ""
|
|
92
77
|
};
|
|
93
|
-
$[
|
|
94
|
-
} else
|
|
78
|
+
$[9] = t6;
|
|
79
|
+
} else t6 = $[9];
|
|
95
80
|
const form = useForm({
|
|
96
|
-
defaultValues:
|
|
81
|
+
defaultValues: t6,
|
|
97
82
|
onSubmit: async (values) => {
|
|
98
83
|
try {
|
|
99
84
|
if (!project) {
|
|
@@ -120,49 +105,50 @@ const CreatePageModal = () => {
|
|
|
120
105
|
const { fullPath } = await createPagePromise;
|
|
121
106
|
previewStore.send({ type: "closeCreatePageModal" });
|
|
122
107
|
form.reset();
|
|
123
|
-
await new Promise(
|
|
108
|
+
await new Promise(_temp3);
|
|
124
109
|
await navigate({ to: localized(fullPath) });
|
|
125
|
-
} catch (
|
|
126
|
-
console.error("Failed to create page:",
|
|
110
|
+
} catch (t7) {
|
|
111
|
+
console.error("Failed to create page:", t7);
|
|
127
112
|
toast.error("Could not create page");
|
|
128
113
|
}
|
|
129
114
|
}
|
|
130
115
|
});
|
|
131
|
-
let
|
|
132
|
-
if ($[
|
|
133
|
-
|
|
134
|
-
if (layouts
|
|
116
|
+
let t8;
|
|
117
|
+
if ($[10] !== form || $[11] !== layouts[0] || $[12] !== layouts.length) {
|
|
118
|
+
t8 = () => {
|
|
119
|
+
if (layouts.length > 0 && !form.getFieldValue("layoutId")) form.setFieldValue("layoutId", layouts[0].id);
|
|
135
120
|
};
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
121
|
+
$[10] = form;
|
|
122
|
+
$[11] = layouts[0];
|
|
123
|
+
$[12] = layouts.length;
|
|
124
|
+
$[13] = t8;
|
|
125
|
+
} else t8 = $[13];
|
|
126
|
+
let t9;
|
|
127
|
+
if ($[14] !== form || $[15] !== layouts) {
|
|
128
|
+
t9 = [layouts, form];
|
|
129
|
+
$[14] = form;
|
|
130
|
+
$[15] = layouts;
|
|
131
|
+
$[16] = t9;
|
|
132
|
+
} else t9 = $[16];
|
|
133
|
+
useEffect(t8, t9);
|
|
134
|
+
let t10;
|
|
135
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
136
|
+
t10 = /* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Create page" }), /* @__PURE__ */ jsx(DialogDescription, { children: "Fill in the details to create a new page. It will be created as a draft." })] });
|
|
137
|
+
$[17] = t10;
|
|
138
|
+
} else t10 = $[17];
|
|
139
|
+
let t11;
|
|
140
|
+
if ($[18] !== form) {
|
|
141
|
+
t11 = (e) => {
|
|
156
142
|
e.preventDefault();
|
|
157
143
|
e.stopPropagation();
|
|
158
144
|
form.handleSubmit();
|
|
159
145
|
};
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
} else
|
|
163
|
-
let
|
|
164
|
-
if ($[
|
|
165
|
-
|
|
146
|
+
$[18] = form;
|
|
147
|
+
$[19] = t11;
|
|
148
|
+
} else t11 = $[19];
|
|
149
|
+
let t12;
|
|
150
|
+
if ($[20] !== form) {
|
|
151
|
+
t12 = (field) => /* @__PURE__ */ jsx(PageNicknameField, {
|
|
166
152
|
value: field.state.value,
|
|
167
153
|
onChange: (value_0) => {
|
|
168
154
|
field.handleChange(value_0);
|
|
@@ -171,22 +157,22 @@ const CreatePageModal = () => {
|
|
|
171
157
|
},
|
|
172
158
|
autoFocus: true
|
|
173
159
|
});
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
} else
|
|
177
|
-
let
|
|
178
|
-
if ($[
|
|
179
|
-
|
|
160
|
+
$[20] = form;
|
|
161
|
+
$[21] = t12;
|
|
162
|
+
} else t12 = $[21];
|
|
163
|
+
let t13;
|
|
164
|
+
if ($[22] !== form.Field || $[23] !== t12) {
|
|
165
|
+
t13 = /* @__PURE__ */ jsx(form.Field, {
|
|
180
166
|
name: "nickname",
|
|
181
|
-
children:
|
|
167
|
+
children: t12
|
|
182
168
|
});
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
186
|
-
} else
|
|
187
|
-
let
|
|
188
|
-
if ($[
|
|
189
|
-
|
|
169
|
+
$[22] = form.Field;
|
|
170
|
+
$[23] = t12;
|
|
171
|
+
$[24] = t13;
|
|
172
|
+
} else t13 = $[24];
|
|
173
|
+
let t14;
|
|
174
|
+
if ($[25] !== form.Field || $[26] !== pages) {
|
|
175
|
+
t14 = (parentField) => /* @__PURE__ */ jsx(form.Field, {
|
|
190
176
|
name: "pathSegment",
|
|
191
177
|
children: (pathField) => /* @__PURE__ */ jsx(PageLocationFieldset, {
|
|
192
178
|
parentPageId: parentField.state.value,
|
|
@@ -196,23 +182,23 @@ const CreatePageModal = () => {
|
|
|
196
182
|
pages
|
|
197
183
|
})
|
|
198
184
|
});
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
$[
|
|
202
|
-
} else
|
|
203
|
-
let
|
|
204
|
-
if ($[
|
|
205
|
-
|
|
185
|
+
$[25] = form.Field;
|
|
186
|
+
$[26] = pages;
|
|
187
|
+
$[27] = t14;
|
|
188
|
+
} else t14 = $[27];
|
|
189
|
+
let t15;
|
|
190
|
+
if ($[28] !== form.Field || $[29] !== t14) {
|
|
191
|
+
t15 = /* @__PURE__ */ jsx(form.Field, {
|
|
206
192
|
name: "parentPageId",
|
|
207
|
-
children:
|
|
193
|
+
children: t14
|
|
208
194
|
});
|
|
209
|
-
$[
|
|
210
|
-
$[
|
|
211
|
-
$[
|
|
212
|
-
} else
|
|
213
|
-
let
|
|
214
|
-
if ($[
|
|
215
|
-
|
|
195
|
+
$[28] = form.Field;
|
|
196
|
+
$[29] = t14;
|
|
197
|
+
$[30] = t15;
|
|
198
|
+
} else t15 = $[30];
|
|
199
|
+
let t16;
|
|
200
|
+
if ($[31] !== layouts) {
|
|
201
|
+
t16 = (field_0) => /* @__PURE__ */ jsxs("div", {
|
|
216
202
|
className: "space-y-2",
|
|
217
203
|
children: [/* @__PURE__ */ jsx(Label, {
|
|
218
204
|
htmlFor: "layoutId",
|
|
@@ -222,98 +208,106 @@ const CreatePageModal = () => {
|
|
|
222
208
|
onValueChange: (value_1) => {
|
|
223
209
|
if (value_1 != null) field_0.handleChange(value_1);
|
|
224
210
|
},
|
|
225
|
-
disabled: layouts
|
|
226
|
-
items: layouts
|
|
227
|
-
|
|
228
|
-
label: camoxApp.getLayoutById(t.layoutId)?._internal.title ?? t.layoutId
|
|
229
|
-
})),
|
|
230
|
-
children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select a layout" }) }), /* @__PURE__ */ jsx(SelectContent, { children: layouts?.map((t_0) => /* @__PURE__ */ jsx(SelectItem, {
|
|
231
|
-
value: t_0.layoutId,
|
|
232
|
-
children: camoxApp.getLayoutById(t_0.layoutId)?._internal.title ?? t_0.layoutId
|
|
233
|
-
}, t_0.layoutId)) })]
|
|
211
|
+
disabled: layouts.length <= 1,
|
|
212
|
+
items: layouts.map(_temp5),
|
|
213
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select a layout" }) }), /* @__PURE__ */ jsx(SelectContent, { children: layouts.map(_temp6) })]
|
|
234
214
|
})]
|
|
235
215
|
});
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
t20 = /* @__PURE__ */ jsx(form.Field, {
|
|
216
|
+
$[31] = layouts;
|
|
217
|
+
$[32] = t16;
|
|
218
|
+
} else t16 = $[32];
|
|
219
|
+
let t17;
|
|
220
|
+
if ($[33] !== form.Field || $[34] !== t16) {
|
|
221
|
+
t17 = /* @__PURE__ */ jsx(form.Field, {
|
|
243
222
|
name: "layoutId",
|
|
244
|
-
children:
|
|
223
|
+
children: t16
|
|
245
224
|
});
|
|
246
|
-
$[
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
} else
|
|
250
|
-
let
|
|
251
|
-
if ($[
|
|
252
|
-
|
|
253
|
-
$[
|
|
254
|
-
$[
|
|
255
|
-
} else
|
|
256
|
-
const
|
|
257
|
-
let
|
|
258
|
-
if ($[
|
|
259
|
-
|
|
225
|
+
$[33] = form.Field;
|
|
226
|
+
$[34] = t16;
|
|
227
|
+
$[35] = t17;
|
|
228
|
+
} else t17 = $[35];
|
|
229
|
+
let t18;
|
|
230
|
+
if ($[36] !== form.state.isSubmitting) {
|
|
231
|
+
t18 = form.state.isSubmitting && /* @__PURE__ */ jsx(Spinner, {});
|
|
232
|
+
$[36] = form.state.isSubmitting;
|
|
233
|
+
$[37] = t18;
|
|
234
|
+
} else t18 = $[37];
|
|
235
|
+
const t19 = form.state.isSubmitting && "...";
|
|
236
|
+
let t20;
|
|
237
|
+
if ($[38] !== form.state.isSubmitting || $[39] !== t18 || $[40] !== t19) {
|
|
238
|
+
t20 = /* @__PURE__ */ jsxs(Button, {
|
|
260
239
|
type: "submit",
|
|
261
240
|
disabled: form.state.isSubmitting,
|
|
262
241
|
children: [
|
|
263
|
-
|
|
242
|
+
t18,
|
|
264
243
|
"Create page",
|
|
265
|
-
|
|
244
|
+
t19
|
|
266
245
|
]
|
|
267
246
|
});
|
|
268
|
-
$[
|
|
269
|
-
$[
|
|
270
|
-
$[
|
|
271
|
-
$[
|
|
272
|
-
} else
|
|
273
|
-
let
|
|
274
|
-
if ($[
|
|
275
|
-
|
|
247
|
+
$[38] = form.state.isSubmitting;
|
|
248
|
+
$[39] = t18;
|
|
249
|
+
$[40] = t19;
|
|
250
|
+
$[41] = t20;
|
|
251
|
+
} else t20 = $[41];
|
|
252
|
+
let t21;
|
|
253
|
+
if ($[42] !== t11 || $[43] !== t13 || $[44] !== t15 || $[45] !== t17 || $[46] !== t20) {
|
|
254
|
+
t21 = /* @__PURE__ */ jsxs(DialogContent, {
|
|
276
255
|
className: "flex max-h-[90vh] flex-col sm:max-w-lg",
|
|
277
|
-
children: [
|
|
278
|
-
onSubmit:
|
|
256
|
+
children: [t10, /* @__PURE__ */ jsxs("form", {
|
|
257
|
+
onSubmit: t11,
|
|
279
258
|
className: "-mx-1 space-y-4 overflow-y-auto px-1 py-2",
|
|
280
259
|
children: [
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
260
|
+
t13,
|
|
261
|
+
t15,
|
|
262
|
+
t17,
|
|
263
|
+
t20
|
|
285
264
|
]
|
|
286
265
|
})]
|
|
287
266
|
});
|
|
288
|
-
$[
|
|
289
|
-
$[
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
292
|
-
$[
|
|
293
|
-
$[
|
|
294
|
-
} else
|
|
295
|
-
let
|
|
296
|
-
if ($[
|
|
297
|
-
|
|
267
|
+
$[42] = t11;
|
|
268
|
+
$[43] = t13;
|
|
269
|
+
$[44] = t15;
|
|
270
|
+
$[45] = t17;
|
|
271
|
+
$[46] = t20;
|
|
272
|
+
$[47] = t21;
|
|
273
|
+
} else t21 = $[47];
|
|
274
|
+
let t22;
|
|
275
|
+
if ($[48] !== open || $[49] !== t21) {
|
|
276
|
+
t22 = /* @__PURE__ */ jsx(Dialog, {
|
|
298
277
|
open,
|
|
299
|
-
onOpenChange:
|
|
300
|
-
children:
|
|
278
|
+
onOpenChange: _temp4,
|
|
279
|
+
children: t21
|
|
301
280
|
});
|
|
302
|
-
$[
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
305
|
-
} else
|
|
306
|
-
return
|
|
281
|
+
$[48] = open;
|
|
282
|
+
$[49] = t21;
|
|
283
|
+
$[50] = t22;
|
|
284
|
+
} else t22 = $[50];
|
|
285
|
+
return t22;
|
|
307
286
|
};
|
|
308
287
|
function _temp(state) {
|
|
309
288
|
return state.context.isCreatePageModalOpen;
|
|
310
289
|
}
|
|
311
|
-
function _temp2(
|
|
290
|
+
function _temp2(layout) {
|
|
291
|
+
return layout.kind === "curated";
|
|
292
|
+
}
|
|
293
|
+
function _temp3(resolve) {
|
|
312
294
|
return setTimeout(resolve, 50);
|
|
313
295
|
}
|
|
314
|
-
function
|
|
296
|
+
function _temp4(value) {
|
|
315
297
|
if (!value) previewStore.send({ type: "closeCreatePageModal" });
|
|
316
298
|
}
|
|
299
|
+
function _temp5(layout_0) {
|
|
300
|
+
return {
|
|
301
|
+
value: layout_0.id,
|
|
302
|
+
label: layout_0.title
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
function _temp6(layout_1) {
|
|
306
|
+
return /* @__PURE__ */ jsx(SelectItem, {
|
|
307
|
+
value: layout_1.id,
|
|
308
|
+
children: layout_1.title
|
|
309
|
+
}, layout_1.id);
|
|
310
|
+
}
|
|
317
311
|
|
|
318
312
|
//#endregion
|
|
319
313
|
export { CreatePageModal };
|
|
@@ -21,6 +21,23 @@ function useFrame() {
|
|
|
21
21
|
if (!context) throw new Error("useFrame must be used within a Frame");
|
|
22
22
|
return context;
|
|
23
23
|
}
|
|
24
|
+
/** The stylesheets of a document's head that are the site's: not the studio's. */
|
|
25
|
+
const SITE_STYLESHEETS = "link[rel~=\"stylesheet\"], style";
|
|
26
|
+
const siteStylesheetsOf = (head) => Array.from(head.querySelectorAll(SITE_STYLESHEETS)).filter((element) => element.parentElement === head && isSiteStyle(element));
|
|
27
|
+
/**
|
|
28
|
+
* Gives the frame's document the site stylesheets of `html`, a site document: the ones it no
|
|
29
|
+
* longer has go, and its new ones are added, the rest of the frame left as it is.
|
|
30
|
+
*/
|
|
31
|
+
function restyle(frame, html) {
|
|
32
|
+
const doc = frame.document;
|
|
33
|
+
const { DOMParser } = frame;
|
|
34
|
+
const wanted = siteStylesheetsOf(new DOMParser().parseFromString(html, "text/html").head);
|
|
35
|
+
const held = siteStylesheetsOf(doc.head);
|
|
36
|
+
const wantedMarkup = new Set(wanted.map((element) => element.outerHTML));
|
|
37
|
+
const heldMarkup = new Set(held.map((element) => element.outerHTML));
|
|
38
|
+
for (const element of held) if (!wantedMarkup.has(element.outerHTML)) element.remove();
|
|
39
|
+
for (const element of wanted) if (!heldMarkup.has(element.outerHTML)) doc.head.appendChild(doc.importNode(element, true));
|
|
40
|
+
}
|
|
24
41
|
function ClearServerMarkup(t0) {
|
|
25
42
|
const $ = c(4);
|
|
26
43
|
const { nodes } = t0;
|
|
@@ -47,7 +64,7 @@ function ClearServerMarkup(t0) {
|
|
|
47
64
|
function _temp(node) {
|
|
48
65
|
return node.remove();
|
|
49
66
|
}
|
|
50
|
-
const Frame = ({ children, className, style, copyStyles = true,
|
|
67
|
+
const Frame = ({ children, className, style, copyStyles = true, onIframeReady, iframeProps, inCanvas = false }) => {
|
|
51
68
|
const inCanvasRef = React.useRef(inCanvas);
|
|
52
69
|
const navigate = useNavigate();
|
|
53
70
|
const { pathname, hash, href } = useLocation();
|
|
@@ -92,7 +109,6 @@ const Frame = ({ children, className, style, copyStyles = true, serverOnly = fal
|
|
|
92
109
|
const clonedStyle = style.cloneNode(true);
|
|
93
110
|
iframeDoc.head.appendChild(clonedStyle);
|
|
94
111
|
});
|
|
95
|
-
if (serverOnly) return;
|
|
96
112
|
setServerNodes(Array.from(root.childNodes));
|
|
97
113
|
setMountNode(root);
|
|
98
114
|
setIframeWindow(iframeWin);
|
|
@@ -107,8 +123,15 @@ const Frame = ({ children, className, style, copyStyles = true, serverOnly = fal
|
|
|
107
123
|
}, [
|
|
108
124
|
copyStyles,
|
|
109
125
|
onIframeReady,
|
|
110
|
-
srcDoc
|
|
111
|
-
|
|
126
|
+
srcDoc
|
|
127
|
+
]);
|
|
128
|
+
React.useLayoutEffect(() => {
|
|
129
|
+
if (!iframeWindow || !previewDocument || srcDoc === "<!doctype html><html><head></head><body><div id=\"root\" data-camox-preview-root></div></body></html>") return;
|
|
130
|
+
restyle(iframeWindow, previewDocument);
|
|
131
|
+
}, [
|
|
132
|
+
iframeWindow,
|
|
133
|
+
previewDocument,
|
|
134
|
+
srcDoc
|
|
112
135
|
]);
|
|
113
136
|
React.useLayoutEffect(() => {
|
|
114
137
|
if (!iframeWindow || !mountNode) return;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useNavigate } from "../../navigation/navigation.js";
|
|
2
2
|
import { cn } from "../../../lib/utils.js";
|
|
3
3
|
import { useLocalizedPath } from "../../../lib/view-locale.js";
|
|
4
|
-
import { STUDIO_SETTINGS_PATH } from "../../studio/routes.js";
|
|
5
4
|
import { previewStore, selectionBlockId, selectionForPage } from "../previewStore.js";
|
|
5
|
+
import { STUDIO_SETTINGS_PATH } from "../../studio/routes.js";
|
|
6
6
|
import { UserButton } from "../../studio/components/UserButton.js";
|
|
7
7
|
import { PageInfo, PageMarkdownContent, PageSeoContent } from "./PageInfo.js";
|
|
8
8
|
import { PageNavigatorHeader } from "./PageNavigatorHeader.js";
|