camox 0.52.3 → 0.54.0
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/editing/createEditableBlock.js +1 -1
- package/dist/features/canvas/CamoxCanvas.js +103 -83
- package/dist/features/canvas/CanvasPageFrame.js +1 -1
- package/dist/features/canvas/CanvasPreviewPageSlot.js +1 -1
- package/dist/features/canvas/canvasCamera.js +3 -3
- package/dist/features/canvas/sidebar/CanvasInspector.js +4 -159
- package/dist/features/canvas/sidebar/CanvasNavigator.js +41 -85
- package/dist/features/canvas/sidebar/CanvasSidebar.js +54 -32
- package/dist/features/canvas/sidebar/CanvasSidebarFrame.js +4 -3
- package/dist/features/canvas/sidebar/CanvasSidebarSkeleton.js +14 -6
- package/dist/features/canvas/sidebar/CanvasViewHeader.js +50 -0
- package/dist/features/canvas/sidebar/DerivedPageInspector.js +30 -18
- package/dist/features/canvas/sidebar/LayoutPageOverview.js +28 -11
- package/dist/features/canvas/sidebar/LayoutPageSeo.js +356 -0
- package/dist/features/canvas/sidebar/PageInspector.js +118 -80
- package/dist/features/canvas/sidebar/PageOverview.js +6 -1
- package/dist/features/canvas/sidebar/SingletonPageInspector.js +22 -14
- package/dist/features/canvas/useCanvasCamera.js +36 -39
- package/dist/features/og/documentFonts.js +49 -0
- package/dist/features/og/imageResponse.d.ts +14 -5
- package/dist/features/og/imageResponse.js +20 -21
- package/dist/features/og/pageImage.js +7 -4
- package/dist/features/preview/CamoxPreview.js +1 -1
- package/dist/features/preview/components/BlockActionsPopover.js +2 -2
- package/dist/features/preview/components/BlockThumbnail.js +1 -1
- package/dist/features/preview/components/CanvasPreview.js +1 -1
- package/dist/features/preview/components/CreatePageModal.js +1 -1
- package/dist/features/preview/components/IconFieldEditor.js +1 -1
- package/dist/features/preview/components/ItemFieldsEditor.js +1 -1
- package/dist/features/preview/components/LinkFieldEditor.js +1 -1
- package/dist/features/preview/components/OverlayTracker.js +1 -1
- package/dist/features/preview/components/PageInfo.js +345 -228
- package/dist/features/preview/components/PagePicker.js +1 -1
- package/dist/features/preview/components/PageTree.js +1 -1
- package/dist/features/preview/components/PreviewPanel.js +1 -1
- package/dist/features/preview/components/PreviewToolbar.js +2 -2
- package/dist/features/preview/components/RepeatableItemsList.js +1 -1
- package/dist/features/preview/components/SelectionEditor.js +668 -652
- package/dist/features/preview/components/SidebarStack.js +582 -0
- package/dist/features/preview/components/StudioEditingFallback.js +2 -2
- package/dist/features/renderer/RendererFrames.js +34 -27
- package/dist/features/runtime/RuntimeChrome.js +1 -1
- package/dist/features/runtime/runtime.d.ts +5 -0
- package/dist/features/runtime/runtime.js +99 -30
- package/dist/features/studio/components/ChatSidebar.js +76 -86
- package/dist/features/studio/components/Navbar.js +1 -1
- package/dist/features/studio/components/Squareling.js +114 -0
- package/dist/features/studio/components/ThreadMessages.js +128 -126
- package/dist/features/studio/components/UserButton.js +1 -1
- package/dist/features/vite/bundlerLogs.js +1 -0
- package/dist/features/vite/runtimeDev.js +11 -0
- package/dist/features/vite/vite.js +3 -1
- package/dist/lib/studio-reads.js +18 -0
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +5 -5
- package/skills/camox/references/layout-definitions.md +11 -16
- package/dist/features/og/defaultFonts.js +0 -31
- package/dist/features/og/geist-variable-ttf-base64.js +0 -21
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { useProjectUuid } from "../../../lib/auth.js";
|
|
2
|
+
import { useOptionalDraftScope } from "../../../lib/draft-scope.js";
|
|
3
|
+
import { useLocation } from "../../navigation/navigation.js";
|
|
4
|
+
import { reads, useReadQuery } from "../../../lib/studio-reads.js";
|
|
5
|
+
import { pageImageUrl } from "../../og/pageImage.js";
|
|
6
|
+
import { ShikiMarkdown } from "../../preview/components/ShikiMarkdown.js";
|
|
7
|
+
import { PageDiscoverabilityButtons, PageMarkdownSheetFrame, PageSeoSheetFrame, SearchEnginePreview, SocialPreviewCard, SocialPreviewImage } from "../../preview/components/PageInfo.js";
|
|
8
|
+
import { c } from "react/compiler-runtime";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Input } from "@camox/ui/input";
|
|
12
|
+
import { Label } from "@camox/ui/label";
|
|
13
|
+
import { Textarea } from "@camox/ui/textarea";
|
|
14
|
+
import { Spinner } from "@camox/ui/spinner";
|
|
15
|
+
import { Alert, AlertDescription, AlertTitle } from "@camox/ui/alert";
|
|
16
|
+
|
|
17
|
+
//#region src/features/canvas/sidebar/LayoutPageSeo.tsx
|
|
18
|
+
/**
|
|
19
|
+
* A layout page's SEO metadata and Markdown. Its layout's code builds both, so editors read them
|
|
20
|
+
* here rather than edit them.
|
|
21
|
+
*/
|
|
22
|
+
function LayoutPageSeo(t0) {
|
|
23
|
+
const $ = c(14);
|
|
24
|
+
const { target } = t0;
|
|
25
|
+
const [isSeoSheetOpen, setIsSeoSheetOpen] = React.useState(false);
|
|
26
|
+
const [isMarkdownSheetOpen, setIsMarkdownSheetOpen] = React.useState(false);
|
|
27
|
+
let t1;
|
|
28
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
29
|
+
t1 = /* @__PURE__ */ jsx(PageDiscoverabilityButtons, {
|
|
30
|
+
metadataLabel: "View page metadata",
|
|
31
|
+
onOpenMetadata: () => setIsSeoSheetOpen(true),
|
|
32
|
+
onOpenMarkdown: () => setIsMarkdownSheetOpen(true)
|
|
33
|
+
});
|
|
34
|
+
$[0] = t1;
|
|
35
|
+
} else t1 = $[0];
|
|
36
|
+
let t2;
|
|
37
|
+
if ($[1] !== target) {
|
|
38
|
+
t2 = /* @__PURE__ */ jsx(LayoutPageSeoContent, { target });
|
|
39
|
+
$[1] = target;
|
|
40
|
+
$[2] = t2;
|
|
41
|
+
} else t2 = $[2];
|
|
42
|
+
let t3;
|
|
43
|
+
if ($[3] !== isSeoSheetOpen || $[4] !== t2) {
|
|
44
|
+
t3 = /* @__PURE__ */ jsx(PageSeoSheetFrame, {
|
|
45
|
+
open: isSeoSheetOpen,
|
|
46
|
+
onOpenChange: setIsSeoSheetOpen,
|
|
47
|
+
children: t2
|
|
48
|
+
});
|
|
49
|
+
$[3] = isSeoSheetOpen;
|
|
50
|
+
$[4] = t2;
|
|
51
|
+
$[5] = t3;
|
|
52
|
+
} else t3 = $[5];
|
|
53
|
+
let t4;
|
|
54
|
+
if ($[6] !== target) {
|
|
55
|
+
t4 = /* @__PURE__ */ jsx(LayoutPageMarkdown, { target });
|
|
56
|
+
$[6] = target;
|
|
57
|
+
$[7] = t4;
|
|
58
|
+
} else t4 = $[7];
|
|
59
|
+
let t5;
|
|
60
|
+
if ($[8] !== isMarkdownSheetOpen || $[9] !== t4) {
|
|
61
|
+
t5 = /* @__PURE__ */ jsx(PageMarkdownSheetFrame, {
|
|
62
|
+
open: isMarkdownSheetOpen,
|
|
63
|
+
onOpenChange: setIsMarkdownSheetOpen,
|
|
64
|
+
children: t4
|
|
65
|
+
});
|
|
66
|
+
$[8] = isMarkdownSheetOpen;
|
|
67
|
+
$[9] = t4;
|
|
68
|
+
$[10] = t5;
|
|
69
|
+
} else t5 = $[10];
|
|
70
|
+
let t6;
|
|
71
|
+
if ($[11] !== t3 || $[12] !== t5) {
|
|
72
|
+
t6 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
73
|
+
t1,
|
|
74
|
+
t3,
|
|
75
|
+
t5
|
|
76
|
+
] });
|
|
77
|
+
$[11] = t3;
|
|
78
|
+
$[12] = t5;
|
|
79
|
+
$[13] = t6;
|
|
80
|
+
} else t6 = $[13];
|
|
81
|
+
return t6;
|
|
82
|
+
}
|
|
83
|
+
/** The title and description a page's head names. */
|
|
84
|
+
function headMetadata(head) {
|
|
85
|
+
const meta = head?.meta ?? [];
|
|
86
|
+
return {
|
|
87
|
+
title: meta.find((entry) => entry.title !== void 0)?.title ?? "",
|
|
88
|
+
description: meta.find((entry) => entry.name === "description")?.content ?? ""
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function Loading() {
|
|
92
|
+
const $ = c(1);
|
|
93
|
+
let t0;
|
|
94
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
95
|
+
t0 = /* @__PURE__ */ jsxs("div", {
|
|
96
|
+
className: "text-muted-foreground flex items-center gap-2 py-2 text-sm",
|
|
97
|
+
children: [/* @__PURE__ */ jsx(Spinner, { className: "size-3.5" }), "Loading..."]
|
|
98
|
+
});
|
|
99
|
+
$[0] = t0;
|
|
100
|
+
} else t0 = $[0];
|
|
101
|
+
return t0;
|
|
102
|
+
}
|
|
103
|
+
function LayoutPageSeoContent(t0) {
|
|
104
|
+
const $ = c(43);
|
|
105
|
+
const { target } = t0;
|
|
106
|
+
const projectUuid = useProjectUuid();
|
|
107
|
+
const { pathname } = useLocation();
|
|
108
|
+
const { scope } = useOptionalDraftScope();
|
|
109
|
+
let t1;
|
|
110
|
+
if ($[0] !== pathname || $[1] !== projectUuid || $[2] !== target) {
|
|
111
|
+
t1 = reads.canvasFrame({
|
|
112
|
+
projectUuid,
|
|
113
|
+
pathname,
|
|
114
|
+
...target
|
|
115
|
+
});
|
|
116
|
+
$[0] = pathname;
|
|
117
|
+
$[1] = projectUuid;
|
|
118
|
+
$[2] = target;
|
|
119
|
+
$[3] = t1;
|
|
120
|
+
} else t1 = $[3];
|
|
121
|
+
const { data: render, error } = useReadQuery(t1);
|
|
122
|
+
if (error) {
|
|
123
|
+
let t2;
|
|
124
|
+
if ($[4] !== error.message) {
|
|
125
|
+
t2 = /* @__PURE__ */ jsx("p", {
|
|
126
|
+
role: "alert",
|
|
127
|
+
children: error.message
|
|
128
|
+
});
|
|
129
|
+
$[4] = error.message;
|
|
130
|
+
$[5] = t2;
|
|
131
|
+
} else t2 = $[5];
|
|
132
|
+
return t2;
|
|
133
|
+
}
|
|
134
|
+
if (!render) {
|
|
135
|
+
let t2;
|
|
136
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
137
|
+
t2 = /* @__PURE__ */ jsx(Loading, {});
|
|
138
|
+
$[6] = t2;
|
|
139
|
+
} else t2 = $[6];
|
|
140
|
+
return t2;
|
|
141
|
+
}
|
|
142
|
+
let t2;
|
|
143
|
+
if ($[7] !== render.head) {
|
|
144
|
+
t2 = headMetadata(render.head);
|
|
145
|
+
$[7] = render.head;
|
|
146
|
+
$[8] = t2;
|
|
147
|
+
} else t2 = $[8];
|
|
148
|
+
const { title, description } = t2;
|
|
149
|
+
let t3;
|
|
150
|
+
let t4;
|
|
151
|
+
if ($[9] !== description || $[10] !== pathname || $[11] !== title) {
|
|
152
|
+
const version = new URLSearchParams({ v: `${title}|${description}` });
|
|
153
|
+
if ($[14] !== pathname) {
|
|
154
|
+
t3 = pageImageUrl({
|
|
155
|
+
origin: "",
|
|
156
|
+
path: pathname
|
|
157
|
+
});
|
|
158
|
+
$[14] = pathname;
|
|
159
|
+
$[15] = t3;
|
|
160
|
+
} else t3 = $[15];
|
|
161
|
+
t4 = version.toString();
|
|
162
|
+
$[9] = description;
|
|
163
|
+
$[10] = pathname;
|
|
164
|
+
$[11] = title;
|
|
165
|
+
$[12] = t3;
|
|
166
|
+
$[13] = t4;
|
|
167
|
+
} else {
|
|
168
|
+
t3 = $[12];
|
|
169
|
+
t4 = $[13];
|
|
170
|
+
}
|
|
171
|
+
const image = `${t3}&${t4}`;
|
|
172
|
+
const origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
173
|
+
let t5;
|
|
174
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
175
|
+
t5 = /* @__PURE__ */ jsxs(Alert, { children: [/* @__PURE__ */ jsx(AlertTitle, { children: "Set in code" }), /* @__PURE__ */ jsx(AlertDescription, { children: "This page’s title and description come from its layout’s code, built from the content it shows." })] });
|
|
176
|
+
$[16] = t5;
|
|
177
|
+
} else t5 = $[16];
|
|
178
|
+
let t6;
|
|
179
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
180
|
+
t6 = /* @__PURE__ */ jsx(Label, {
|
|
181
|
+
htmlFor: "layout-page-title",
|
|
182
|
+
children: "Page title"
|
|
183
|
+
});
|
|
184
|
+
$[17] = t6;
|
|
185
|
+
} else t6 = $[17];
|
|
186
|
+
let t7;
|
|
187
|
+
if ($[18] !== title) {
|
|
188
|
+
t7 = /* @__PURE__ */ jsxs("div", {
|
|
189
|
+
className: "space-y-2",
|
|
190
|
+
children: [t6, /* @__PURE__ */ jsx(Input, {
|
|
191
|
+
id: "layout-page-title",
|
|
192
|
+
value: title,
|
|
193
|
+
readOnly: true
|
|
194
|
+
})]
|
|
195
|
+
});
|
|
196
|
+
$[18] = title;
|
|
197
|
+
$[19] = t7;
|
|
198
|
+
} else t7 = $[19];
|
|
199
|
+
let t8;
|
|
200
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
201
|
+
t8 = /* @__PURE__ */ jsx(Label, {
|
|
202
|
+
htmlFor: "layout-page-description",
|
|
203
|
+
children: "Page description"
|
|
204
|
+
});
|
|
205
|
+
$[20] = t8;
|
|
206
|
+
} else t8 = $[20];
|
|
207
|
+
let t9;
|
|
208
|
+
if ($[21] !== description) {
|
|
209
|
+
t9 = /* @__PURE__ */ jsxs("div", {
|
|
210
|
+
className: "space-y-2",
|
|
211
|
+
children: [t8, /* @__PURE__ */ jsx(Textarea, {
|
|
212
|
+
id: "layout-page-description",
|
|
213
|
+
value: description,
|
|
214
|
+
placeholder: "No description",
|
|
215
|
+
rows: 2,
|
|
216
|
+
readOnly: true
|
|
217
|
+
})]
|
|
218
|
+
});
|
|
219
|
+
$[21] = description;
|
|
220
|
+
$[22] = t9;
|
|
221
|
+
} else t9 = $[22];
|
|
222
|
+
let t10;
|
|
223
|
+
if ($[23] !== description || $[24] !== pathname || $[25] !== title) {
|
|
224
|
+
t10 = /* @__PURE__ */ jsx(SearchEnginePreview, {
|
|
225
|
+
path: pathname,
|
|
226
|
+
metaTitle: title,
|
|
227
|
+
metaDescription: description
|
|
228
|
+
});
|
|
229
|
+
$[23] = description;
|
|
230
|
+
$[24] = pathname;
|
|
231
|
+
$[25] = title;
|
|
232
|
+
$[26] = t10;
|
|
233
|
+
} else t10 = $[26];
|
|
234
|
+
let t11;
|
|
235
|
+
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
|
236
|
+
t11 = /* @__PURE__ */ jsx(Label, { children: "Social preview" });
|
|
237
|
+
$[27] = t11;
|
|
238
|
+
} else t11 = $[27];
|
|
239
|
+
let t12;
|
|
240
|
+
if ($[28] !== image || $[29] !== scope) {
|
|
241
|
+
t12 = scope?.hrefFor(image) ?? image;
|
|
242
|
+
$[28] = image;
|
|
243
|
+
$[29] = scope;
|
|
244
|
+
$[30] = t12;
|
|
245
|
+
} else t12 = $[30];
|
|
246
|
+
let t13;
|
|
247
|
+
if ($[31] !== t12) {
|
|
248
|
+
t13 = /* @__PURE__ */ jsx(SocialPreviewImage, { src: t12 });
|
|
249
|
+
$[31] = t12;
|
|
250
|
+
$[32] = t13;
|
|
251
|
+
} else t13 = $[32];
|
|
252
|
+
const t14 = `${origin}${pathname}`;
|
|
253
|
+
let t15;
|
|
254
|
+
if ($[33] !== description || $[34] !== t13 || $[35] !== t14 || $[36] !== title) {
|
|
255
|
+
t15 = /* @__PURE__ */ jsxs("div", {
|
|
256
|
+
className: "space-y-2 pt-2",
|
|
257
|
+
children: [t11, /* @__PURE__ */ jsx(SocialPreviewCard, {
|
|
258
|
+
image: t13,
|
|
259
|
+
metaTitle: title,
|
|
260
|
+
metaDescription: description,
|
|
261
|
+
url: t14
|
|
262
|
+
})]
|
|
263
|
+
});
|
|
264
|
+
$[33] = description;
|
|
265
|
+
$[34] = t13;
|
|
266
|
+
$[35] = t14;
|
|
267
|
+
$[36] = title;
|
|
268
|
+
$[37] = t15;
|
|
269
|
+
} else t15 = $[37];
|
|
270
|
+
let t16;
|
|
271
|
+
if ($[38] !== t10 || $[39] !== t15 || $[40] !== t7 || $[41] !== t9) {
|
|
272
|
+
t16 = /* @__PURE__ */ jsxs("div", {
|
|
273
|
+
className: "space-y-4",
|
|
274
|
+
children: [
|
|
275
|
+
t5,
|
|
276
|
+
t7,
|
|
277
|
+
t9,
|
|
278
|
+
t10,
|
|
279
|
+
t15
|
|
280
|
+
]
|
|
281
|
+
});
|
|
282
|
+
$[38] = t10;
|
|
283
|
+
$[39] = t15;
|
|
284
|
+
$[40] = t7;
|
|
285
|
+
$[41] = t9;
|
|
286
|
+
$[42] = t16;
|
|
287
|
+
} else t16 = $[42];
|
|
288
|
+
return t16;
|
|
289
|
+
}
|
|
290
|
+
function LayoutPageMarkdown(t0) {
|
|
291
|
+
const $ = c(11);
|
|
292
|
+
const { target } = t0;
|
|
293
|
+
const projectUuid = useProjectUuid();
|
|
294
|
+
const { pathname } = useLocation();
|
|
295
|
+
let t1;
|
|
296
|
+
if ($[0] !== pathname || $[1] !== projectUuid || $[2] !== target.runtimeBasePath) {
|
|
297
|
+
t1 = reads.layoutPageMarkdown({
|
|
298
|
+
projectUuid,
|
|
299
|
+
runtimeBasePath: target.runtimeBasePath,
|
|
300
|
+
pathname
|
|
301
|
+
});
|
|
302
|
+
$[0] = pathname;
|
|
303
|
+
$[1] = projectUuid;
|
|
304
|
+
$[2] = target.runtimeBasePath;
|
|
305
|
+
$[3] = t1;
|
|
306
|
+
} else t1 = $[3];
|
|
307
|
+
const { data: markdown, error } = useReadQuery(t1);
|
|
308
|
+
if (error) {
|
|
309
|
+
let t2;
|
|
310
|
+
if ($[4] !== error.message) {
|
|
311
|
+
t2 = /* @__PURE__ */ jsx("p", {
|
|
312
|
+
role: "alert",
|
|
313
|
+
children: error.message
|
|
314
|
+
});
|
|
315
|
+
$[4] = error.message;
|
|
316
|
+
$[5] = t2;
|
|
317
|
+
} else t2 = $[5];
|
|
318
|
+
return t2;
|
|
319
|
+
}
|
|
320
|
+
if (markdown === void 0) {
|
|
321
|
+
let t2;
|
|
322
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
323
|
+
t2 = /* @__PURE__ */ jsx(Loading, {});
|
|
324
|
+
$[6] = t2;
|
|
325
|
+
} else t2 = $[6];
|
|
326
|
+
return t2;
|
|
327
|
+
}
|
|
328
|
+
if (markdown === null) {
|
|
329
|
+
let t2;
|
|
330
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
331
|
+
t2 = /* @__PURE__ */ jsx(AlertTitle, { children: "No Markdown for this page" });
|
|
332
|
+
$[7] = t2;
|
|
333
|
+
} else t2 = $[7];
|
|
334
|
+
let t3;
|
|
335
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
336
|
+
t3 = /* @__PURE__ */ jsxs(Alert, { children: [t2, /* @__PURE__ */ jsxs(AlertDescription, { children: [
|
|
337
|
+
"AI agents read this page’s HTML. Its layout can serve them Markdown by declaring",
|
|
338
|
+
" ",
|
|
339
|
+
/* @__PURE__ */ jsx("code", { children: "toMarkdown" }),
|
|
340
|
+
" in code."
|
|
341
|
+
] })] });
|
|
342
|
+
$[8] = t3;
|
|
343
|
+
} else t3 = $[8];
|
|
344
|
+
return t3;
|
|
345
|
+
}
|
|
346
|
+
let t2;
|
|
347
|
+
if ($[9] !== markdown) {
|
|
348
|
+
t2 = /* @__PURE__ */ jsx(ShikiMarkdown, { code: markdown });
|
|
349
|
+
$[9] = markdown;
|
|
350
|
+
$[10] = t2;
|
|
351
|
+
} else t2 = $[10];
|
|
352
|
+
return t2;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
//#endregion
|
|
356
|
+
export { LayoutPageSeo, headMetadata };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { useLocation } from "../../navigation/navigation.js";
|
|
2
|
-
import {
|
|
2
|
+
import { previewStore, selectionForOwner } from "../../preview/previewStore.js";
|
|
3
|
+
import { SidebarStackHeader, SidebarStackView, useSelectionViewCount } from "../../preview/components/SidebarStack.js";
|
|
4
|
+
import { CanvasInspectorBody, CanvasInspectorTitle } from "./CanvasInspector.js";
|
|
3
5
|
import { PageInspectorSkeleton } from "./PageInspectorSkeleton.js";
|
|
4
6
|
import { PreviewEditingOwnerContext } from "../../preview/previewSelection.js";
|
|
5
7
|
import { CuratedPageInspector } from "./CuratedPageInspector.js";
|
|
@@ -7,7 +9,9 @@ import { DerivedPageInspector } from "./DerivedPageInspector.js";
|
|
|
7
9
|
import { SingletonPageInspector } from "./SingletonPageInspector.js";
|
|
8
10
|
import { c } from "react/compiler-runtime";
|
|
9
11
|
import * as React from "react";
|
|
12
|
+
import { useSelector } from "@xstate/store-react";
|
|
10
13
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { File } from "lucide-react";
|
|
11
15
|
|
|
12
16
|
//#region src/features/canvas/sidebar/PageInspector.tsx
|
|
13
17
|
function PageInspectorError() {
|
|
@@ -34,8 +38,8 @@ var PageInspectorBoundary = class extends React.Component {
|
|
|
34
38
|
}
|
|
35
39
|
};
|
|
36
40
|
function PageInspectorContent(t0) {
|
|
37
|
-
const $ = c(
|
|
38
|
-
const { page, pageRecord } = t0;
|
|
41
|
+
const $ = c(8);
|
|
42
|
+
const { page, pageRecord, runtimeBasePath } = t0;
|
|
39
43
|
switch (page.kind) {
|
|
40
44
|
case "curated": {
|
|
41
45
|
let t1;
|
|
@@ -47,110 +51,144 @@ function PageInspectorContent(t0) {
|
|
|
47
51
|
}
|
|
48
52
|
case "singleton": {
|
|
49
53
|
let t1;
|
|
50
|
-
if ($[1] !== page.layoutId) {
|
|
51
|
-
t1 = /* @__PURE__ */ jsx(SingletonPageInspector, {
|
|
54
|
+
if ($[1] !== page.layoutId || $[2] !== runtimeBasePath) {
|
|
55
|
+
t1 = /* @__PURE__ */ jsx(SingletonPageInspector, {
|
|
56
|
+
layoutId: page.layoutId,
|
|
57
|
+
runtimeBasePath
|
|
58
|
+
});
|
|
52
59
|
$[1] = page.layoutId;
|
|
53
|
-
$[2] =
|
|
54
|
-
|
|
60
|
+
$[2] = runtimeBasePath;
|
|
61
|
+
$[3] = t1;
|
|
62
|
+
} else t1 = $[3];
|
|
55
63
|
return t1;
|
|
56
64
|
}
|
|
57
65
|
case "derived": {
|
|
58
66
|
let t1;
|
|
59
|
-
if ($[
|
|
67
|
+
if ($[4] !== page.layoutId || $[5] !== pageRecord || $[6] !== runtimeBasePath) {
|
|
60
68
|
t1 = /* @__PURE__ */ jsx(DerivedPageInspector, {
|
|
61
69
|
layoutId: page.layoutId,
|
|
62
|
-
pageRecord
|
|
70
|
+
pageRecord,
|
|
71
|
+
runtimeBasePath
|
|
63
72
|
});
|
|
64
|
-
$[
|
|
65
|
-
$[
|
|
66
|
-
$[
|
|
67
|
-
|
|
73
|
+
$[4] = page.layoutId;
|
|
74
|
+
$[5] = pageRecord;
|
|
75
|
+
$[6] = runtimeBasePath;
|
|
76
|
+
$[7] = t1;
|
|
77
|
+
} else t1 = $[7];
|
|
68
78
|
return t1;
|
|
69
79
|
}
|
|
70
80
|
}
|
|
71
81
|
}
|
|
72
82
|
/**
|
|
73
|
-
* A selected Page's inspector: its name, which
|
|
74
|
-
*
|
|
83
|
+
* A selected Page's inspector: its name, then its overview for its kind of Page, which loads at the Page's URL and edits for `owner`.
|
|
84
|
+
* While something on the Page is selected, the selection's views are laid over the
|
|
85
|
+
* overview, and the name's header goes back to it.
|
|
75
86
|
*/
|
|
76
87
|
function PageInspector(t0) {
|
|
77
|
-
const $ = c(
|
|
78
|
-
const { page, owner, pageRecord,
|
|
88
|
+
const $ = c(27);
|
|
89
|
+
const { page, owner, pageRecord, runtimeBasePath } = t0;
|
|
79
90
|
const { pathname } = useLocation();
|
|
80
91
|
let t1;
|
|
81
|
-
if ($[0] !==
|
|
82
|
-
t1 =
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
$[3] = page.title;
|
|
90
|
-
$[4] = t1;
|
|
91
|
-
} else t1 = $[4];
|
|
92
|
+
if ($[0] !== owner) {
|
|
93
|
+
t1 = (state) => selectionForOwner(state.context, owner);
|
|
94
|
+
$[0] = owner;
|
|
95
|
+
$[1] = t1;
|
|
96
|
+
} else t1 = $[1];
|
|
97
|
+
const covered = useSelector(previewStore, t1) != null;
|
|
98
|
+
const selectionViews = useSelectionViewCount();
|
|
99
|
+
const distance = covered ? Math.max(1, selectionViews) : 0;
|
|
92
100
|
let t2;
|
|
93
|
-
if ($[
|
|
94
|
-
t2 = /* @__PURE__ */ jsx(
|
|
95
|
-
|
|
96
|
-
|
|
101
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
102
|
+
t2 = /* @__PURE__ */ jsx(File, { className: "size-3.5 shrink-0" });
|
|
103
|
+
$[2] = t2;
|
|
104
|
+
} else t2 = $[2];
|
|
105
|
+
let t3;
|
|
106
|
+
if ($[3] !== covered || $[4] !== page.title) {
|
|
107
|
+
t3 = /* @__PURE__ */ jsxs("span", {
|
|
108
|
+
className: "flex min-w-0 items-center gap-1.5",
|
|
109
|
+
children: [t2, covered ? /* @__PURE__ */ jsx("span", {
|
|
110
|
+
className: "truncate",
|
|
111
|
+
children: page.title
|
|
112
|
+
}) : /* @__PURE__ */ jsx(CanvasInspectorTitle, { children: page.title })]
|
|
97
113
|
});
|
|
98
|
-
$[
|
|
99
|
-
$[
|
|
100
|
-
$[
|
|
101
|
-
} else
|
|
102
|
-
const t3 = `${page.key}:${pathname}`;
|
|
114
|
+
$[3] = covered;
|
|
115
|
+
$[4] = page.title;
|
|
116
|
+
$[5] = t3;
|
|
117
|
+
} else t3 = $[5];
|
|
103
118
|
let t4;
|
|
104
|
-
if ($[
|
|
105
|
-
t4 = /* @__PURE__ */ jsx(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
t5 = /* @__PURE__ */ jsx(PageInspectorContent, {
|
|
112
|
-
page,
|
|
113
|
-
pageRecord
|
|
119
|
+
if ($[6] !== distance || $[7] !== t3) {
|
|
120
|
+
t4 = /* @__PURE__ */ jsx(SidebarStackHeader, {
|
|
121
|
+
depth: 1,
|
|
122
|
+
distance,
|
|
123
|
+
onSelect: _temp,
|
|
124
|
+
hoverTarget: null,
|
|
125
|
+
children: t3
|
|
114
126
|
});
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
118
|
-
} else
|
|
127
|
+
$[6] = distance;
|
|
128
|
+
$[7] = t3;
|
|
129
|
+
$[8] = t4;
|
|
130
|
+
} else t4 = $[8];
|
|
131
|
+
const t5 = `${page.key}:${pathname}`;
|
|
119
132
|
let t6;
|
|
120
|
-
if ($[
|
|
121
|
-
t6 = /* @__PURE__ */ jsx(
|
|
122
|
-
|
|
123
|
-
|
|
133
|
+
if ($[9] !== page.kind) {
|
|
134
|
+
t6 = /* @__PURE__ */ jsx(SidebarStackView, {
|
|
135
|
+
depth: 1,
|
|
136
|
+
className: "flex flex-col",
|
|
137
|
+
children: /* @__PURE__ */ jsx(PageInspectorSkeleton, { kind: page.kind })
|
|
124
138
|
});
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
|
|
128
|
-
} else t6 = $[15];
|
|
139
|
+
$[9] = page.kind;
|
|
140
|
+
$[10] = t6;
|
|
141
|
+
} else t6 = $[10];
|
|
129
142
|
let t7;
|
|
130
|
-
if ($[
|
|
131
|
-
t7 = /* @__PURE__ */ jsx(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
143
|
+
if ($[11] !== page || $[12] !== pageRecord || $[13] !== runtimeBasePath) {
|
|
144
|
+
t7 = /* @__PURE__ */ jsx(PageInspectorContent, {
|
|
145
|
+
page,
|
|
146
|
+
pageRecord,
|
|
147
|
+
runtimeBasePath
|
|
148
|
+
});
|
|
149
|
+
$[11] = page;
|
|
150
|
+
$[12] = pageRecord;
|
|
151
|
+
$[13] = runtimeBasePath;
|
|
152
|
+
$[14] = t7;
|
|
153
|
+
} else t7 = $[14];
|
|
136
154
|
let t8;
|
|
137
|
-
if ($[
|
|
138
|
-
t8 = /* @__PURE__ */ jsx(
|
|
139
|
-
|
|
155
|
+
if ($[15] !== t6 || $[16] !== t7) {
|
|
156
|
+
t8 = /* @__PURE__ */ jsx(React.Suspense, {
|
|
157
|
+
fallback: t6,
|
|
140
158
|
children: t7
|
|
141
|
-
})
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
} else t8 = $[
|
|
159
|
+
});
|
|
160
|
+
$[15] = t6;
|
|
161
|
+
$[16] = t7;
|
|
162
|
+
$[17] = t8;
|
|
163
|
+
} else t8 = $[17];
|
|
146
164
|
let t9;
|
|
147
|
-
if ($[
|
|
148
|
-
t9 = /* @__PURE__ */
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
} else t9 = $[
|
|
153
|
-
|
|
165
|
+
if ($[18] !== t5 || $[19] !== t8) {
|
|
166
|
+
t9 = /* @__PURE__ */ jsx(PageInspectorBoundary, { children: t8 }, t5);
|
|
167
|
+
$[18] = t5;
|
|
168
|
+
$[19] = t8;
|
|
169
|
+
$[20] = t9;
|
|
170
|
+
} else t9 = $[20];
|
|
171
|
+
let t10;
|
|
172
|
+
if ($[21] !== owner || $[22] !== t9) {
|
|
173
|
+
t10 = /* @__PURE__ */ jsx(CanvasInspectorBody, { children: /* @__PURE__ */ jsx(PreviewEditingOwnerContext, {
|
|
174
|
+
value: owner,
|
|
175
|
+
children: t9
|
|
176
|
+
}) });
|
|
177
|
+
$[21] = owner;
|
|
178
|
+
$[22] = t9;
|
|
179
|
+
$[23] = t10;
|
|
180
|
+
} else t10 = $[23];
|
|
181
|
+
let t11;
|
|
182
|
+
if ($[24] !== t10 || $[25] !== t4) {
|
|
183
|
+
t11 = /* @__PURE__ */ jsxs(Fragment, { children: [t4, t10] });
|
|
184
|
+
$[24] = t10;
|
|
185
|
+
$[25] = t4;
|
|
186
|
+
$[26] = t11;
|
|
187
|
+
} else t11 = $[26];
|
|
188
|
+
return t11;
|
|
189
|
+
}
|
|
190
|
+
function _temp() {
|
|
191
|
+
return previewStore.send({ type: "clearSelection" });
|
|
154
192
|
}
|
|
155
193
|
|
|
156
194
|
//#endregion
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SidebarStackView } from "../../preview/components/SidebarStack.js";
|
|
1
2
|
import { usePreviewTargetSelection } from "../../preview/previewSelection.js";
|
|
2
3
|
import { SelectionEditor } from "../../preview/components/SelectionEditor.js";
|
|
3
4
|
import { c } from "react/compiler-runtime";
|
|
@@ -15,7 +16,11 @@ function PageOverview(t0) {
|
|
|
15
16
|
const selection = usePreviewTargetSelection();
|
|
16
17
|
let t1;
|
|
17
18
|
if ($[0] !== children || $[1] !== selection) {
|
|
18
|
-
t1 = selection != null ? /* @__PURE__ */ jsx(SelectionEditor, {}) :
|
|
19
|
+
t1 = selection != null ? /* @__PURE__ */ jsx(SelectionEditor, { pageCrumb: false }) : /* @__PURE__ */ jsx(SidebarStackView, {
|
|
20
|
+
depth: 1,
|
|
21
|
+
className: "flex flex-col",
|
|
22
|
+
children
|
|
23
|
+
});
|
|
19
24
|
$[0] = children;
|
|
20
25
|
$[1] = selection;
|
|
21
26
|
$[2] = t1;
|
|
@@ -5,26 +5,34 @@ import { jsx } from "react/jsx-runtime";
|
|
|
5
5
|
//#region src/features/canvas/sidebar/SingletonPageInspector.tsx
|
|
6
6
|
/** A singleton page: its layout's blocks are all its blocks, edited here, at a fixed URL. */
|
|
7
7
|
function SingletonPageInspector(t0) {
|
|
8
|
-
const $ = c(
|
|
9
|
-
const { layoutId } = t0;
|
|
8
|
+
const $ = c(6);
|
|
9
|
+
const { layoutId, runtimeBasePath } = t0;
|
|
10
10
|
let t1;
|
|
11
|
-
if ($[0]
|
|
12
|
-
t1 = {
|
|
11
|
+
if ($[0] !== runtimeBasePath) {
|
|
12
|
+
t1 = { runtimeBasePath };
|
|
13
|
+
$[0] = runtimeBasePath;
|
|
14
|
+
$[1] = t1;
|
|
15
|
+
} else t1 = $[1];
|
|
16
|
+
let t2;
|
|
17
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
18
|
+
t2 = {
|
|
13
19
|
title: "Fixed page structure",
|
|
14
20
|
description: "Edit this page’s blocks here. Its URL and structure are defined in code. Synced blocks share content with their other placements."
|
|
15
21
|
};
|
|
16
|
-
$[0] = t1;
|
|
17
|
-
} else t1 = $[0];
|
|
18
|
-
let t2;
|
|
19
|
-
if ($[1] !== layoutId) {
|
|
20
|
-
t2 = /* @__PURE__ */ jsx(LayoutPageOverview, {
|
|
21
|
-
layoutId,
|
|
22
|
-
notice: t1
|
|
23
|
-
});
|
|
24
|
-
$[1] = layoutId;
|
|
25
22
|
$[2] = t2;
|
|
26
23
|
} else t2 = $[2];
|
|
27
|
-
|
|
24
|
+
let t3;
|
|
25
|
+
if ($[3] !== layoutId || $[4] !== t1) {
|
|
26
|
+
t3 = /* @__PURE__ */ jsx(LayoutPageOverview, {
|
|
27
|
+
layoutId,
|
|
28
|
+
target: t1,
|
|
29
|
+
notice: t2
|
|
30
|
+
});
|
|
31
|
+
$[3] = layoutId;
|
|
32
|
+
$[4] = t1;
|
|
33
|
+
$[5] = t3;
|
|
34
|
+
} else t3 = $[5];
|
|
35
|
+
return t3;
|
|
28
36
|
}
|
|
29
37
|
|
|
30
38
|
//#endregion
|