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
package/dist/core/createApp.d.ts
CHANGED
package/dist/core/createApp.js
CHANGED
|
@@ -132,6 +132,7 @@ function createApp({ blocks, lazyBlocks = {}, layouts = [], collections = [], do
|
|
|
132
132
|
const layoutDefinitions = Array.from(layoutsMap.values()).map((layout) => ({
|
|
133
133
|
layoutId: layout._internal.id,
|
|
134
134
|
kind: layout._internal.kind,
|
|
135
|
+
title: layout._internal.title,
|
|
135
136
|
description: layout._internal.description,
|
|
136
137
|
blocks: layout._internal.blockDefinitions,
|
|
137
138
|
...layout._internal.recordPages && { recordPages: {
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { reads, useStudioCache } from "../../lib/studio-reads.js";
|
|
2
|
+
import { blockMutations, collectionMutations, repeatableItemMutations } from "../../lib/queries.js";
|
|
3
|
+
import { invalidateCollectionRecordViews } from "../../lib/collection-cache.js";
|
|
4
|
+
import { referenceWritesFor } from "./referenceWrites.js";
|
|
5
|
+
import { c } from "react/compiler-runtime";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
8
|
+
|
|
9
|
+
//#region src/core/editing/contentEdits.ts
|
|
10
|
+
/**
|
|
11
|
+
* The studio's way of writing edits: its draft-scoped mutations, so a write on Live starts a
|
|
12
|
+
* draft, and its cache's updates, which every frame and sidebar shows.
|
|
13
|
+
*/
|
|
14
|
+
function createContentEditor({ queryClient, studioCache }) {
|
|
15
|
+
const run = (options, variables) => queryClient.getMutationCache().build(queryClient, options).execute(variables);
|
|
16
|
+
return async (edit) => {
|
|
17
|
+
switch (edit.type) {
|
|
18
|
+
case "blockContent":
|
|
19
|
+
await run(blockMutations.updateContent(), {
|
|
20
|
+
id: edit.blockId,
|
|
21
|
+
content: edit.content
|
|
22
|
+
});
|
|
23
|
+
return;
|
|
24
|
+
case "itemContent":
|
|
25
|
+
await run(repeatableItemMutations.updateContent(), {
|
|
26
|
+
id: edit.itemId,
|
|
27
|
+
content: edit.content
|
|
28
|
+
});
|
|
29
|
+
return;
|
|
30
|
+
case "deleteBlock":
|
|
31
|
+
await run(blockMutations.delete(), { id: edit.blockId });
|
|
32
|
+
return;
|
|
33
|
+
case "recordField": {
|
|
34
|
+
const { projectUuid, record, field, value } = edit;
|
|
35
|
+
await referenceWritesFor(queryClient).save(record, field, value, async (input) => {
|
|
36
|
+
const saved = await run(collectionMutations.edit(), {
|
|
37
|
+
...input,
|
|
38
|
+
projectUuid
|
|
39
|
+
});
|
|
40
|
+
studioCache.set(reads.record({
|
|
41
|
+
projectUuid,
|
|
42
|
+
collectionId: record.collectionId,
|
|
43
|
+
id: record.id
|
|
44
|
+
}), saved);
|
|
45
|
+
invalidateCollectionRecordViews(studioCache, projectUuid, record.collectionId);
|
|
46
|
+
return saved;
|
|
47
|
+
});
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Where edits made in this document go, when not to the studio's own writer: the renderer frame
|
|
55
|
+
* sends them to the studio.
|
|
56
|
+
*/
|
|
57
|
+
const ContentEditsContext = React.createContext(null);
|
|
58
|
+
/** How the block components of this document write their edits. */
|
|
59
|
+
function useApplyContentEdit() {
|
|
60
|
+
const $ = c(3);
|
|
61
|
+
const sent = React.use(ContentEditsContext);
|
|
62
|
+
const queryClient = useQueryClient();
|
|
63
|
+
const studioCache = useStudioCache();
|
|
64
|
+
let t0;
|
|
65
|
+
if ($[0] !== queryClient || $[1] !== studioCache) {
|
|
66
|
+
t0 = createContentEditor({
|
|
67
|
+
queryClient,
|
|
68
|
+
studioCache
|
|
69
|
+
});
|
|
70
|
+
$[0] = queryClient;
|
|
71
|
+
$[1] = studioCache;
|
|
72
|
+
$[2] = t0;
|
|
73
|
+
} else t0 = $[2];
|
|
74
|
+
return sent ?? t0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
export { ContentEditsContext, createContentEditor, useApplyContentEdit };
|