camox 0.48.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/layoutContext.d.ts +1 -0
- 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/CanvasInspector.js +1 -1
- 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/content/ContentAssets.js +84 -88
- package/dist/features/page/CuratedPageContent.js +1 -1
- package/dist/features/preview/CamoxPreview.d.ts +8 -4
- package/dist/features/preview/CamoxPreview.js +258 -443
- package/dist/features/preview/EditablePageContent.js +244 -2
- package/dist/features/preview/EditablePageExperience.js +19 -13
- package/dist/features/preview/components/AddBlockSheet.js +55 -15
- package/dist/features/preview/components/BlockActionsPopover.js +23 -51
- 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/FieldToolbar.js +1 -1
- package/dist/features/preview/components/Frame.js +27 -4
- package/dist/features/preview/components/MobilePreviewDrawer.js +6 -9
- 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 +13 -67
- package/dist/features/preview/components/PreviewToolbar.js +1 -1
- 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/previewConstants.js +2 -8
- package/dist/features/preview/previewStore.js +2 -0
- package/dist/features/preview/studioNotice.js +20 -0
- package/dist/features/preview/usePreviewViewportActions.js +1 -1
- package/dist/features/provider/AuthenticatedCamoxProvider.js +47 -31
- package/dist/features/provider/components/CommandPalette.js +2 -5
- package/dist/features/provider/signInShortcut.js +1 -2
- package/dist/features/provider/useAdminShortcuts.js +47 -53
- 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.d.ts +2 -1
- package/dist/features/routes/pageRuntime.js +34 -22
- 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 +95 -0
- 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 +22 -3
- package/dist/features/runtime/runtime.js +209 -96
- package/dist/features/runtime/runtimeRoutes.d.ts +2 -0
- package/dist/features/runtime/runtimeRoutes.js +2 -0
- package/dist/features/runtime/worker.d.ts +14 -1
- package/dist/features/runtime/worker.js +34 -4
- package/dist/features/settings/AnalyticsSettings.js +622 -0
- package/dist/features/settings/CamoxSettings.js +95 -0
- package/dist/features/settings/FaviconSettings.js +254 -0
- package/dist/features/settings/ProjectNameSettings.js +145 -0
- package/dist/features/settings/SettingsPart.js +73 -0
- package/dist/features/settings/SocialProfilesSettings.js +245 -0
- package/dist/features/settings/useProjectMutation.js +61 -0
- package/dist/features/studio/FollowAgentProvider.js +10 -10
- package/dist/features/studio/components/DraftsControl.js +136 -131
- package/dist/features/studio/components/LocalePicker.js +178 -174
- package/dist/features/studio/components/Navbar.js +107 -66
- package/dist/features/studio/components/ProjectMenu.js +119 -171
- package/dist/features/studio/components/ReviewDraftSheet.js +1151 -991
- package/dist/features/studio/components/ThreadMessages.js +100 -65
- package/dist/features/studio/components/UserButton.js +2 -2
- package/dist/features/studio/routes.js +3 -1
- package/dist/features/studio/showInCanvas.js +129 -0
- package/dist/features/vite/definitionsSync.js +5 -6
- package/dist/features/vite/hostedChecks.js +127 -0
- package/dist/features/vite/runtimeDev.js +58 -17
- package/dist/features/vite/staticAssetHeaders.js +52 -0
- package/dist/features/vite/vite.d.ts +1 -1
- package/dist/features/vite/vite.js +49 -9
- package/dist/hooks/use-page-destinations.js +10 -10
- package/dist/lib/api-client-server.d.ts +1 -1
- package/dist/lib/api-client.d.ts +2 -1
- package/dist/lib/draft-scope.d.ts +1 -0
- package/dist/lib/locale-path.d.ts +3 -11
- package/dist/lib/locale-path.js +3 -27
- package/dist/lib/queries.js +7 -1
- package/dist/lib/revisions.js +20 -0
- package/dist/lib/shortcuts.js +29 -0
- package/dist/lib/studio-definitions.js +160 -0
- package/dist/lib/studio-reads.d.ts +1 -0
- package/dist/lib/studio-reads.js +65 -21
- package/dist/lib/use-project-room.js +16 -10
- package/dist/lib/utils.js +1 -104
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +9 -4
- package/skills/camox/SKILL.md +4 -0
- package/skills/camox/references/artifacts.md +1 -1
- package/dist/features/studio/components/FaviconDialog.js +0 -318
- package/dist/features/studio/components/SocialProfilesDialog.js +0 -342
|
@@ -1,20 +1,20 @@
|
|
|
1
|
+
import { CanvasLoadingScreen } from "../../canvas/CanvasLoadingScreen.js";
|
|
1
2
|
import { CanvasSidebarSkeleton } from "../../canvas/sidebar/CanvasSidebarSkeleton.js";
|
|
2
3
|
import { previewStore, selectIsCanvasShown } from "../previewStore.js";
|
|
3
|
-
import { CanvasLoadingScreen } from "../../canvas/CanvasLoadingScreen.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
5
|
import { useSelector } from "@xstate/store-react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
|
|
8
8
|
//#region src/features/preview/components/StudioEditingFallback.tsx
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* What holds the page's place while the editor loads. The studio never renders the site's code:
|
|
11
|
+
* a loading screen shows where the page will, in the Canvas's background, until the renderer
|
|
12
|
+
* frame shows it. Showing the Canvas before the editor is ready also shows the Canvas sidebar's
|
|
13
|
+
* placeholder, as the editor does while the Canvas prepares.
|
|
14
14
|
*/
|
|
15
15
|
function StudioEditingFallback(t0) {
|
|
16
|
-
const $ = c(
|
|
17
|
-
const { layoutPage
|
|
16
|
+
const $ = c(8);
|
|
17
|
+
const { layoutPage } = t0;
|
|
18
18
|
const isCanvasShown = useSelector(previewStore, selectIsCanvasShown);
|
|
19
19
|
let t1;
|
|
20
20
|
if ($[0] !== isCanvasShown || $[1] !== layoutPage) {
|
|
@@ -23,34 +23,30 @@ function StudioEditingFallback(t0) {
|
|
|
23
23
|
$[1] = layoutPage;
|
|
24
24
|
$[2] = t1;
|
|
25
25
|
} else t1 = $[2];
|
|
26
|
-
|
|
27
|
-
if ($[3] !== isCanvasShown) {
|
|
28
|
-
t2 = isCanvasShown && /* @__PURE__ */ jsx(CanvasLoadingScreen, {});
|
|
29
|
-
$[3] = isCanvasShown;
|
|
30
|
-
$[4] = t2;
|
|
31
|
-
} else t2 = $[4];
|
|
26
|
+
const t2 = isCanvasShown ? void 0 : PAGE_LOADING_LABEL;
|
|
32
27
|
let t3;
|
|
33
|
-
if ($[
|
|
34
|
-
t3 = /* @__PURE__ */
|
|
28
|
+
if ($[3] !== t2) {
|
|
29
|
+
t3 = /* @__PURE__ */ jsx("div", {
|
|
35
30
|
className: "relative min-h-0 min-w-0 flex-1",
|
|
36
|
-
children:
|
|
31
|
+
children: /* @__PURE__ */ jsx(CanvasLoadingScreen, { label: t2 })
|
|
37
32
|
});
|
|
38
|
-
$[
|
|
39
|
-
$[
|
|
40
|
-
|
|
41
|
-
} else t3 = $[7];
|
|
33
|
+
$[3] = t2;
|
|
34
|
+
$[4] = t3;
|
|
35
|
+
} else t3 = $[4];
|
|
42
36
|
let t4;
|
|
43
|
-
if ($[
|
|
37
|
+
if ($[5] !== t1 || $[6] !== t3) {
|
|
44
38
|
t4 = /* @__PURE__ */ jsxs("div", {
|
|
45
39
|
className: "flex h-full min-h-0 flex-1",
|
|
46
40
|
children: [t1, t3]
|
|
47
41
|
});
|
|
48
|
-
$[
|
|
49
|
-
$[
|
|
50
|
-
$[
|
|
51
|
-
} else t4 = $[
|
|
42
|
+
$[5] = t1;
|
|
43
|
+
$[6] = t3;
|
|
44
|
+
$[7] = t4;
|
|
45
|
+
} else t4 = $[7];
|
|
52
46
|
return t4;
|
|
53
47
|
}
|
|
48
|
+
/** What the loading screen says while the page it holds the place of loads. */
|
|
49
|
+
const PAGE_LOADING_LABEL = "Loading the page";
|
|
54
50
|
|
|
55
51
|
//#endregion
|
|
56
|
-
export { StudioEditingFallback };
|
|
52
|
+
export { PAGE_LOADING_LABEL, StudioEditingFallback };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useProjectUuid } from "../../../lib/auth.js";
|
|
2
|
-
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
3
2
|
import { referenceList } from "../../../lib/normalized-data.js";
|
|
4
3
|
import { reads, useStudioCache } from "../../../lib/studio-reads.js";
|
|
5
4
|
import { referenceListIds } from "../../../core/lib/reference.js";
|
|
@@ -7,8 +6,8 @@ import { recordText } from "../../../core/recordItem.js";
|
|
|
7
6
|
import { blockMutations, collectionMutations, repeatableItemMutations } from "../../../lib/queries.js";
|
|
8
7
|
import { invalidateCollectionRecordViews } from "../../../lib/collection-cache.js";
|
|
9
8
|
import { serializeAssetField } from "../../content/collection-form.js";
|
|
10
|
-
import { contentFieldSchema } from "./contentFieldSchema.js";
|
|
11
9
|
import { referenceWritesFor } from "../../../core/editing/referenceWrites.js";
|
|
10
|
+
import { contentFieldSchema } from "./contentFieldSchema.js";
|
|
12
11
|
import { c } from "react/compiler-runtime";
|
|
13
12
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
14
13
|
import { toast } from "@camox/ui/toaster";
|
|
@@ -74,10 +73,9 @@ function applyReferenceListOptimistically(studioCache, blockId, owner, fieldName
|
|
|
74
73
|
* collection asset snapshots rather than block file markers.
|
|
75
74
|
*/
|
|
76
75
|
function useFieldWriter(target, schema) {
|
|
77
|
-
const $ = c(
|
|
76
|
+
const $ = c(12);
|
|
78
77
|
const queryClient = useQueryClient();
|
|
79
78
|
const projectUuid = useProjectUuid();
|
|
80
|
-
const camoxApp = useCamoxApp();
|
|
81
79
|
let t0;
|
|
82
80
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
83
81
|
t0 = blockMutations.updateContent();
|
|
@@ -98,7 +96,7 @@ function useFieldWriter(target, schema) {
|
|
|
98
96
|
const editRecord = useMutation(t2);
|
|
99
97
|
const studioCache = useStudioCache();
|
|
100
98
|
let t3;
|
|
101
|
-
if ($[3] !==
|
|
99
|
+
if ($[3] !== editRecord || $[4] !== projectUuid || $[5] !== queryClient || $[6] !== schema || $[7] !== studioCache || $[8] !== target || $[9] !== updateBlockContent || $[10] !== updateItemContent) {
|
|
102
100
|
t3 = (fieldName, value) => {
|
|
103
101
|
if (target?.kind === "record") {
|
|
104
102
|
const fieldType = fieldTypeOf(schema, fieldName);
|
|
@@ -129,16 +127,19 @@ function useFieldWriter(target, schema) {
|
|
|
129
127
|
const { collectionId: t4 } = field;
|
|
130
128
|
const collectionId = t4 === void 0 ? "" : t4;
|
|
131
129
|
const linkRecord = async (recordId) => {
|
|
132
|
-
const record_0 = await studioCache.ensure(reads.record({
|
|
130
|
+
const [record_0, collection] = await Promise.all([studioCache.ensure(reads.record({
|
|
133
131
|
projectUuid,
|
|
134
132
|
collectionId,
|
|
135
133
|
id: recordId
|
|
136
|
-
}))
|
|
134
|
+
})), studioCache.ensure(reads.collection({
|
|
135
|
+
projectUuid,
|
|
136
|
+
collectionId
|
|
137
|
+
}))]);
|
|
137
138
|
return {
|
|
138
139
|
id: record_0.id,
|
|
139
140
|
collectionId,
|
|
140
141
|
content: record_0.content,
|
|
141
|
-
...recordText(
|
|
142
|
+
...recordText(collection, record_0.content)
|
|
142
143
|
};
|
|
143
144
|
};
|
|
144
145
|
return (async () => {
|
|
@@ -176,17 +177,16 @@ function useFieldWriter(target, schema) {
|
|
|
176
177
|
content
|
|
177
178
|
});
|
|
178
179
|
};
|
|
179
|
-
$[3] =
|
|
180
|
-
$[4] =
|
|
181
|
-
$[5] =
|
|
182
|
-
$[6] =
|
|
183
|
-
$[7] =
|
|
184
|
-
$[8] =
|
|
185
|
-
$[9] =
|
|
186
|
-
$[10] =
|
|
187
|
-
$[11] =
|
|
188
|
-
|
|
189
|
-
} else t3 = $[12];
|
|
180
|
+
$[3] = editRecord;
|
|
181
|
+
$[4] = projectUuid;
|
|
182
|
+
$[5] = queryClient;
|
|
183
|
+
$[6] = schema;
|
|
184
|
+
$[7] = studioCache;
|
|
185
|
+
$[8] = target;
|
|
186
|
+
$[9] = updateBlockContent;
|
|
187
|
+
$[10] = updateItemContent;
|
|
188
|
+
$[11] = t3;
|
|
189
|
+
} else t3 = $[11];
|
|
190
190
|
return t3;
|
|
191
191
|
}
|
|
192
192
|
function _temp2(cause) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
2
1
|
import { placedRecords, referenceList } from "../../../lib/normalized-data.js";
|
|
3
2
|
import { referenceListIds } from "../../../core/lib/reference.js";
|
|
3
|
+
import { useCollectionDefinition } from "../../../lib/studio-definitions.js";
|
|
4
4
|
import { isBlockPlacement, previewStore, recordPlacement } from "../previewStore.js";
|
|
5
5
|
import { contentFieldSchema } from "./contentFieldSchema.js";
|
|
6
6
|
import { formatFieldName } from "./ItemFieldsEditor.js";
|
|
@@ -31,9 +31,8 @@ function isLayoutPlacer(placer) {
|
|
|
31
31
|
* view instead.
|
|
32
32
|
*/
|
|
33
33
|
function useRecordView(t0) {
|
|
34
|
-
const $ = c(
|
|
34
|
+
const $ = c(60);
|
|
35
35
|
const { owner, selection, placer } = t0;
|
|
36
|
-
const camoxApp = useCamoxApp();
|
|
37
36
|
const recordSelection = selection?.type === "record" || selection?.type === "record-field" ? selection : null;
|
|
38
37
|
const nested = recordSelection?.nested;
|
|
39
38
|
const blockSelection = recordSelection && isBlockPlacement(recordSelection) ? recordSelection : null;
|
|
@@ -41,73 +40,32 @@ function useRecordView(t0) {
|
|
|
41
40
|
const blockPlacer = placer && !isLayoutPlacer(placer) ? placer : null;
|
|
42
41
|
const layoutPlacer = isLayoutPlacer(placer) ? placer : null;
|
|
43
42
|
const referenceFieldName = blockSelection?.fieldName;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
let outerCollection;
|
|
49
|
-
let outerRecord;
|
|
50
|
-
let outerStale;
|
|
51
|
-
let referenceField;
|
|
52
|
-
let referenceFieldType;
|
|
43
|
+
const referenceField = referenceFieldName ? contentFieldSchema(blockPlacer?.contentSchema, referenceFieldName) : void 0;
|
|
44
|
+
const outerCollectionId = layoutSelection ? layoutPlacer?.collectionId : referenceField?.collectionId;
|
|
45
|
+
const outerCollection = useCollectionDefinition(outerCollectionId);
|
|
46
|
+
const outerStale = blockSelection ? blockPlacer != null && !linksRecord(referenceField, blockPlacer, blockSelection.fieldName, blockSelection.recordId) : layoutSelection != null && layoutPlacer != null && layoutPlacer.record.id !== layoutSelection.recordId;
|
|
53
47
|
let t1;
|
|
54
|
-
if ($[0] !== blockPlacer || $[1] !== blockSelection || $[2] !==
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
t2 = () => {
|
|
62
|
-
if (outerStale) return;
|
|
63
|
-
if (blockSelection) return placedRecords(blockPlacer?.references, blockSelection.fieldName).find((record) => record.id === blockSelection.recordId);
|
|
64
|
-
if (layoutSelection) return layoutPlacer?.record;
|
|
65
|
-
};
|
|
66
|
-
$[17] = blockPlacer?.references;
|
|
67
|
-
$[18] = blockSelection;
|
|
68
|
-
$[19] = layoutPlacer?.record;
|
|
69
|
-
$[20] = layoutSelection;
|
|
70
|
-
$[21] = outerStale;
|
|
71
|
-
$[22] = t2;
|
|
72
|
-
} else t2 = $[22];
|
|
73
|
-
outerRecord = t2();
|
|
74
|
-
nestedField = nested ? contentFieldSchema(outerCollection?._internal.contentSchema, nested.fieldName) : void 0;
|
|
75
|
-
nestedCollection = nestedField?.collectionId ? camoxApp.getCollectionById(nestedField.collectionId) : void 0;
|
|
76
|
-
nestedStale = nested != null && outerRecord != null && !linksRecord(nestedField, outerRecord, nested.fieldName, nested.recordId);
|
|
77
|
-
nestedRecord = nested && outerRecord && !nestedStale ? placedRecords(outerRecord.references, nested.fieldName).find((record_0) => record_0.id === nested.recordId) : void 0;
|
|
78
|
-
const fieldTypeOf = _temp;
|
|
79
|
-
referenceFieldType = fieldTypeOf(referenceField);
|
|
80
|
-
t1 = fieldTypeOf(nestedField);
|
|
81
|
-
$[0] = blockPlacer;
|
|
48
|
+
if ($[0] !== blockPlacer?.references || $[1] !== blockSelection || $[2] !== layoutPlacer?.record || $[3] !== layoutSelection || $[4] !== outerStale) {
|
|
49
|
+
t1 = () => {
|
|
50
|
+
if (outerStale) return;
|
|
51
|
+
if (blockSelection) return placedRecords(blockPlacer?.references, blockSelection.fieldName).find((record) => record.id === blockSelection.recordId);
|
|
52
|
+
if (layoutSelection) return layoutPlacer?.record;
|
|
53
|
+
};
|
|
54
|
+
$[0] = blockPlacer?.references;
|
|
82
55
|
$[1] = blockSelection;
|
|
83
|
-
$[2] =
|
|
84
|
-
$[3] =
|
|
85
|
-
$[4] =
|
|
86
|
-
$[5] =
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
$[15] = referenceFieldType;
|
|
97
|
-
$[16] = t1;
|
|
98
|
-
} else {
|
|
99
|
-
nestedCollection = $[7];
|
|
100
|
-
nestedField = $[8];
|
|
101
|
-
nestedRecord = $[9];
|
|
102
|
-
nestedStale = $[10];
|
|
103
|
-
outerCollection = $[11];
|
|
104
|
-
outerRecord = $[12];
|
|
105
|
-
outerStale = $[13];
|
|
106
|
-
referenceField = $[14];
|
|
107
|
-
referenceFieldType = $[15];
|
|
108
|
-
t1 = $[16];
|
|
109
|
-
}
|
|
110
|
-
const nestedFieldType = t1;
|
|
56
|
+
$[2] = layoutPlacer?.record;
|
|
57
|
+
$[3] = layoutSelection;
|
|
58
|
+
$[4] = outerStale;
|
|
59
|
+
$[5] = t1;
|
|
60
|
+
} else t1 = $[5];
|
|
61
|
+
const outerRecord = t1();
|
|
62
|
+
const nestedField = nested ? contentFieldSchema(outerCollection?.contentSchema, nested.fieldName) : void 0;
|
|
63
|
+
const nestedCollection = useCollectionDefinition(nestedField?.collectionId);
|
|
64
|
+
const nestedStale = nested != null && outerRecord != null && !linksRecord(nestedField, outerRecord, nested.fieldName, nested.recordId);
|
|
65
|
+
const nestedRecord = nested && outerRecord && !nestedStale ? placedRecords(outerRecord.references, nested.fieldName).find((record_0) => record_0.id === nested.recordId) : void 0;
|
|
66
|
+
const fieldTypeOf = _temp;
|
|
67
|
+
const referenceFieldType = fieldTypeOf(referenceField);
|
|
68
|
+
const nestedFieldType = fieldTypeOf(nestedField);
|
|
111
69
|
const recordBlockId = blockSelection?.blockId;
|
|
112
70
|
const recordItemId = blockSelection?.itemId;
|
|
113
71
|
const recordLayoutId = layoutSelection?.layoutId;
|
|
@@ -118,53 +76,53 @@ function useRecordView(t0) {
|
|
|
118
76
|
break bb0;
|
|
119
77
|
}
|
|
120
78
|
let t3;
|
|
121
|
-
if ($[
|
|
79
|
+
if ($[6] !== referenceFieldName || $[7] !== referenceFieldType) {
|
|
122
80
|
t3 = {
|
|
123
81
|
fieldName: referenceFieldName,
|
|
124
82
|
fieldType: referenceFieldType
|
|
125
83
|
};
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
} else t3 = $[
|
|
84
|
+
$[6] = referenceFieldName;
|
|
85
|
+
$[7] = referenceFieldType;
|
|
86
|
+
$[8] = t3;
|
|
87
|
+
} else t3 = $[8];
|
|
130
88
|
const field_0 = t3;
|
|
131
89
|
if (recordItemId == null) {
|
|
132
90
|
let t4;
|
|
133
|
-
if ($[
|
|
91
|
+
if ($[9] !== field_0 || $[10] !== recordBlockId) {
|
|
134
92
|
t4 = {
|
|
135
93
|
type: "block-field",
|
|
136
94
|
blockId: recordBlockId,
|
|
137
95
|
...field_0
|
|
138
96
|
};
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
} else t4 = $[
|
|
97
|
+
$[9] = field_0;
|
|
98
|
+
$[10] = recordBlockId;
|
|
99
|
+
$[11] = t4;
|
|
100
|
+
} else t4 = $[11];
|
|
143
101
|
t2 = t4;
|
|
144
102
|
break bb0;
|
|
145
103
|
}
|
|
146
104
|
let t4;
|
|
147
|
-
if ($[
|
|
105
|
+
if ($[12] !== field_0 || $[13] !== recordBlockId || $[14] !== recordItemId) {
|
|
148
106
|
t4 = {
|
|
149
107
|
type: "item-field",
|
|
150
108
|
blockId: recordBlockId,
|
|
151
109
|
itemId: recordItemId,
|
|
152
110
|
...field_0
|
|
153
111
|
};
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
} else t4 = $[
|
|
112
|
+
$[12] = field_0;
|
|
113
|
+
$[13] = recordBlockId;
|
|
114
|
+
$[14] = recordItemId;
|
|
115
|
+
$[15] = t4;
|
|
116
|
+
} else t4 = $[15];
|
|
159
117
|
t2 = t4;
|
|
160
118
|
}
|
|
161
119
|
const referenceFieldSelection = t2;
|
|
162
120
|
let t3;
|
|
163
|
-
if ($[
|
|
121
|
+
if ($[16] !== recordSelection) {
|
|
164
122
|
t3 = recordSelection ? _temp2(recordPlacement(recordSelection)) : null;
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
} else t3 = $[
|
|
123
|
+
$[16] = recordSelection;
|
|
124
|
+
$[17] = t3;
|
|
125
|
+
} else t3 = $[17];
|
|
168
126
|
const outerPlacement = t3;
|
|
169
127
|
const recordId = recordSelection?.recordId;
|
|
170
128
|
const nestedFieldName = nested?.fieldName;
|
|
@@ -175,30 +133,30 @@ function useRecordView(t0) {
|
|
|
175
133
|
break bb1;
|
|
176
134
|
}
|
|
177
135
|
let t5;
|
|
178
|
-
if ($[
|
|
136
|
+
if ($[18] !== nestedFieldName || $[19] !== nestedFieldType) {
|
|
179
137
|
t5 = {
|
|
180
138
|
recordFieldName: nestedFieldName,
|
|
181
139
|
recordFieldType: nestedFieldType
|
|
182
140
|
};
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
186
|
-
} else t5 = $[
|
|
141
|
+
$[18] = nestedFieldName;
|
|
142
|
+
$[19] = nestedFieldType;
|
|
143
|
+
$[20] = t5;
|
|
144
|
+
} else t5 = $[20];
|
|
187
145
|
const field_1 = t5;
|
|
188
146
|
if (recordLayoutId != null) {
|
|
189
147
|
let t6;
|
|
190
|
-
if ($[
|
|
148
|
+
if ($[21] !== field_1 || $[22] !== recordId || $[23] !== recordLayoutId) {
|
|
191
149
|
t6 = {
|
|
192
150
|
type: "record-field",
|
|
193
151
|
layoutId: recordLayoutId,
|
|
194
152
|
recordId,
|
|
195
153
|
...field_1
|
|
196
154
|
};
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
} else t6 = $[
|
|
155
|
+
$[21] = field_1;
|
|
156
|
+
$[22] = recordId;
|
|
157
|
+
$[23] = recordLayoutId;
|
|
158
|
+
$[24] = t6;
|
|
159
|
+
} else t6 = $[24];
|
|
202
160
|
t4 = t6;
|
|
203
161
|
break bb1;
|
|
204
162
|
}
|
|
@@ -207,13 +165,13 @@ function useRecordView(t0) {
|
|
|
207
165
|
break bb1;
|
|
208
166
|
}
|
|
209
167
|
let t6;
|
|
210
|
-
if ($[
|
|
168
|
+
if ($[25] !== recordItemId) {
|
|
211
169
|
t6 = recordItemId == null ? {} : { itemId: recordItemId };
|
|
212
|
-
$[
|
|
213
|
-
$[
|
|
214
|
-
} else t6 = $[
|
|
170
|
+
$[25] = recordItemId;
|
|
171
|
+
$[26] = t6;
|
|
172
|
+
} else t6 = $[26];
|
|
215
173
|
let t7;
|
|
216
|
-
if ($[
|
|
174
|
+
if ($[27] !== field_1 || $[28] !== recordBlockId || $[29] !== recordId || $[30] !== referenceFieldName || $[31] !== t6) {
|
|
217
175
|
t7 = {
|
|
218
176
|
type: "record-field",
|
|
219
177
|
blockId: recordBlockId,
|
|
@@ -222,13 +180,13 @@ function useRecordView(t0) {
|
|
|
222
180
|
recordId,
|
|
223
181
|
...field_1
|
|
224
182
|
};
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
} else t7 = $[
|
|
183
|
+
$[27] = field_1;
|
|
184
|
+
$[28] = recordBlockId;
|
|
185
|
+
$[29] = recordId;
|
|
186
|
+
$[30] = referenceFieldName;
|
|
187
|
+
$[31] = t6;
|
|
188
|
+
$[32] = t7;
|
|
189
|
+
} else t7 = $[32];
|
|
232
190
|
t4 = t7;
|
|
233
191
|
}
|
|
234
192
|
const nestedFieldSelection = t4;
|
|
@@ -236,7 +194,7 @@ function useRecordView(t0) {
|
|
|
236
194
|
const fallbackSelection = outerStale ? referenceFieldSelection : nestedFieldSelection;
|
|
237
195
|
let t5;
|
|
238
196
|
let t6;
|
|
239
|
-
if ($[
|
|
197
|
+
if ($[33] !== fallbackSelection || $[34] !== isStale || $[35] !== owner) {
|
|
240
198
|
t5 = () => {
|
|
241
199
|
if (!isStale || !fallbackSelection) return;
|
|
242
200
|
previewStore.send({
|
|
@@ -250,21 +208,21 @@ function useRecordView(t0) {
|
|
|
250
208
|
fallbackSelection,
|
|
251
209
|
owner
|
|
252
210
|
];
|
|
253
|
-
$[
|
|
254
|
-
$[
|
|
255
|
-
$[
|
|
256
|
-
$[
|
|
257
|
-
$[
|
|
211
|
+
$[33] = fallbackSelection;
|
|
212
|
+
$[34] = isStale;
|
|
213
|
+
$[35] = owner;
|
|
214
|
+
$[36] = t5;
|
|
215
|
+
$[37] = t6;
|
|
258
216
|
} else {
|
|
259
|
-
t5 = $[
|
|
260
|
-
t6 = $[
|
|
217
|
+
t5 = $[36];
|
|
218
|
+
t6 = $[37];
|
|
261
219
|
}
|
|
262
220
|
React.useEffect(t5, t6);
|
|
263
221
|
const placedRecord = nested ? nestedRecord : outerRecord;
|
|
264
222
|
const collection = nested ? nestedCollection : outerCollection;
|
|
265
223
|
const shown = recordSelection && !isStale && placedRecord && collection;
|
|
266
224
|
let t7;
|
|
267
|
-
if ($[
|
|
225
|
+
if ($[38] !== collection || $[39] !== nested || $[40] !== nestedFieldType || $[41] !== placedRecord || $[42] !== recordSelection || $[43] !== referenceFieldType || $[44] !== shown) {
|
|
268
226
|
t7 = shown ? {
|
|
269
227
|
selection: recordSelection,
|
|
270
228
|
record: placedRecord,
|
|
@@ -272,18 +230,18 @@ function useRecordView(t0) {
|
|
|
272
230
|
inList: (nested ? nestedFieldType : referenceFieldType) === "ReferenceList",
|
|
273
231
|
linksRecords: !nested
|
|
274
232
|
} : null;
|
|
275
|
-
$[
|
|
276
|
-
$[
|
|
277
|
-
$[
|
|
278
|
-
$[
|
|
279
|
-
$[
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
283
|
-
} else t7 = $[
|
|
233
|
+
$[38] = collection;
|
|
234
|
+
$[39] = nested;
|
|
235
|
+
$[40] = nestedFieldType;
|
|
236
|
+
$[41] = placedRecord;
|
|
237
|
+
$[42] = recordSelection;
|
|
238
|
+
$[43] = referenceFieldType;
|
|
239
|
+
$[44] = shown;
|
|
240
|
+
$[45] = t7;
|
|
241
|
+
} else t7 = $[45];
|
|
284
242
|
const recordView = t7;
|
|
285
243
|
let t8;
|
|
286
|
-
if ($[
|
|
244
|
+
if ($[46] !== nested || $[47] !== nestedField?.title || $[48] !== nestedFieldSelection || $[49] !== outerPlacement || $[50] !== outerRecord || $[51] !== owner || $[52] !== recordView || $[53] !== referenceField?.title || $[54] !== referenceFieldSelection) {
|
|
287
245
|
t8 = (fieldHasOwnView) => {
|
|
288
246
|
if (!recordView || !outerRecord || !outerPlacement) return [];
|
|
289
247
|
const outerTarget = {
|
|
@@ -344,31 +302,31 @@ function useRecordView(t0) {
|
|
|
344
302
|
}
|
|
345
303
|
];
|
|
346
304
|
};
|
|
347
|
-
$[
|
|
348
|
-
$[
|
|
349
|
-
$[
|
|
350
|
-
$[
|
|
351
|
-
$[
|
|
352
|
-
$[
|
|
353
|
-
$[
|
|
354
|
-
$[
|
|
355
|
-
$[
|
|
356
|
-
$[
|
|
357
|
-
} else t8 = $[
|
|
305
|
+
$[46] = nested;
|
|
306
|
+
$[47] = nestedField?.title;
|
|
307
|
+
$[48] = nestedFieldSelection;
|
|
308
|
+
$[49] = outerPlacement;
|
|
309
|
+
$[50] = outerRecord;
|
|
310
|
+
$[51] = owner;
|
|
311
|
+
$[52] = recordView;
|
|
312
|
+
$[53] = referenceField?.title;
|
|
313
|
+
$[54] = referenceFieldSelection;
|
|
314
|
+
$[55] = t8;
|
|
315
|
+
} else t8 = $[55];
|
|
358
316
|
const recordCrumbs = t8;
|
|
359
317
|
const t9 = isStale ? fallbackSelection : selection;
|
|
360
318
|
let t10;
|
|
361
|
-
if ($[
|
|
319
|
+
if ($[56] !== recordCrumbs || $[57] !== recordView || $[58] !== t9) {
|
|
362
320
|
t10 = {
|
|
363
321
|
recordView,
|
|
364
322
|
viewSelection: t9,
|
|
365
323
|
recordCrumbs
|
|
366
324
|
};
|
|
367
|
-
$[
|
|
368
|
-
$[
|
|
369
|
-
$[
|
|
370
|
-
$[
|
|
371
|
-
} else t10 = $[
|
|
325
|
+
$[56] = recordCrumbs;
|
|
326
|
+
$[57] = recordView;
|
|
327
|
+
$[58] = t9;
|
|
328
|
+
$[59] = t10;
|
|
329
|
+
} else t10 = $[59];
|
|
372
330
|
return t10;
|
|
373
331
|
}
|
|
374
332
|
function _temp2(t0) {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import "../../provider/components/CamoxAppContext.js";
|
|
2
|
-
import "../../../lib/studio-reads.js";
|
|
3
1
|
import { repeatableItemMutations } from "../../../lib/queries.js";
|
|
4
2
|
import { previewStore, sameEditingOwner } from "../previewStore.js";
|
|
5
3
|
import { PreviewEditingOwnerContext } from "../previewSelection.js";
|
|
@@ -2,10 +2,10 @@ import { localizedPath } from "../../lib/locale-path.js";
|
|
|
2
2
|
import { useDraftScope } from "../../lib/draft-scope.js";
|
|
3
3
|
import { useViewLocale } from "../../lib/view-locale-context.js";
|
|
4
4
|
import { useLocation, useNavigate } from "../navigation/navigation.js";
|
|
5
|
-
import { useCamoxApp } from "../provider/components/CamoxAppContext.js";
|
|
6
5
|
import { fetchRuntimeJson } from "../runtime/navigationTarget.js";
|
|
7
6
|
import { reads, useReadQuery } from "../../lib/studio-reads.js";
|
|
8
7
|
import { asCollectionItem } from "../../core/recordItem.js";
|
|
8
|
+
import { useCollectionDefinition } from "../../lib/studio-definitions.js";
|
|
9
9
|
import { useLatestRecord } from "../../core/editing/useLatestRecord.js";
|
|
10
10
|
import { c } from "react/compiler-runtime";
|
|
11
11
|
import * as React from "react";
|
|
@@ -152,36 +152,42 @@ const PageRecordContext = React.createContext(void 0);
|
|
|
152
152
|
* it, or as a later save stored it. Null on pages that render no record.
|
|
153
153
|
*/
|
|
154
154
|
function usePageRecordPlacer() {
|
|
155
|
-
const $ = c(
|
|
156
|
-
const
|
|
157
|
-
const app = useCamoxApp();
|
|
158
|
-
const collection = loaded ? app.getCollectionById(loaded.collectionId) : void 0;
|
|
159
|
-
const collectionId = loaded?.collectionId ?? "";
|
|
160
|
-
const t0 = collection ? loaded?.data : void 0;
|
|
155
|
+
const $ = c(9);
|
|
156
|
+
const t0 = React.use(PageRecordContext);
|
|
161
157
|
let t1;
|
|
162
|
-
if ($[0] !==
|
|
163
|
-
t1 =
|
|
158
|
+
if ($[0] !== t0) {
|
|
159
|
+
t1 = asCollectionItem(t0);
|
|
160
|
+
$[0] = t0;
|
|
161
|
+
$[1] = t1;
|
|
162
|
+
} else t1 = $[1];
|
|
163
|
+
const loaded = t1;
|
|
164
|
+
const collection = useCollectionDefinition(loaded?.collectionId);
|
|
165
|
+
const collectionId = loaded?.collectionId ?? "";
|
|
166
|
+
const t2 = collection ? loaded?.data : void 0;
|
|
167
|
+
let t3;
|
|
168
|
+
if ($[2] !== collection || $[3] !== collectionId || $[4] !== t2) {
|
|
169
|
+
t3 = {
|
|
164
170
|
collectionId,
|
|
165
171
|
collection,
|
|
166
|
-
loaded:
|
|
172
|
+
loaded: t2
|
|
167
173
|
};
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
172
|
-
} else
|
|
173
|
-
const record = useLatestRecord(
|
|
174
|
-
let
|
|
175
|
-
if ($[
|
|
176
|
-
|
|
174
|
+
$[2] = collection;
|
|
175
|
+
$[3] = collectionId;
|
|
176
|
+
$[4] = t2;
|
|
177
|
+
$[5] = t3;
|
|
178
|
+
} else t3 = $[5];
|
|
179
|
+
const record = useLatestRecord(t3);
|
|
180
|
+
let t4;
|
|
181
|
+
if ($[6] !== collectionId || $[7] !== record) {
|
|
182
|
+
t4 = record ? {
|
|
177
183
|
collectionId,
|
|
178
184
|
record
|
|
179
185
|
} : null;
|
|
180
|
-
$[
|
|
181
|
-
$[
|
|
182
|
-
$[
|
|
183
|
-
} else
|
|
184
|
-
return
|
|
186
|
+
$[6] = collectionId;
|
|
187
|
+
$[7] = record;
|
|
188
|
+
$[8] = t4;
|
|
189
|
+
} else t4 = $[8];
|
|
190
|
+
return t4;
|
|
185
191
|
}
|
|
186
192
|
|
|
187
193
|
//#endregion
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
//#region src/features/preview/previewConstants.ts
|
|
2
|
-
const TOGGLE_CANVAS_SHORTCUT =
|
|
3
|
-
|
|
4
|
-
withMeta: true
|
|
5
|
-
};
|
|
6
|
-
const SHOW_WHOLE_CANVAS_SHORTCUT = {
|
|
7
|
-
key: "Escape",
|
|
8
|
-
withMeta: true
|
|
9
|
-
};
|
|
2
|
+
const TOGGLE_CANVAS_SHORTCUT = "Mod+Enter";
|
|
3
|
+
const SHOW_WHOLE_CANVAS_SHORTCUT = "Mod+Escape";
|
|
10
4
|
|
|
11
5
|
//#endregion
|
|
12
6
|
export { SHOW_WHOLE_CANVAS_SHORTCUT, TOGGLE_CANVAS_SHORTCUT };
|
|
@@ -108,6 +108,8 @@ const previewStore = createStore({
|
|
|
108
108
|
on: {
|
|
109
109
|
/** Starts over, as a new Studio session does. */
|
|
110
110
|
reset: () => initialPreviewContext,
|
|
111
|
+
/** Takes the studio's state, in the renderer frame's document: only its connection sends it. */
|
|
112
|
+
mirror: (_, event) => event.context,
|
|
111
113
|
hideCanvas: (context) => {
|
|
112
114
|
if (!selectIsCanvasShown({ context })) return context;
|
|
113
115
|
return {
|