camox 0.76.0 → 0.77.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 +1077 -1681
- package/dist/core/editing/fieldSlot.js +251 -0
- package/dist/core/editing/useFieldSlot.js +159 -0
- package/dist/core/layoutContext.d.ts +2 -0
- package/dist/core/layoutContext.js +27 -1
- package/dist/core/lib/artifactTheme.js +43 -6
- package/dist/features/canvas/CanvasPageFrame.js +2 -2
- package/dist/features/canvas/CanvasPreviewPageSlot.js +1 -1
- package/dist/features/canvas/canvasCameraController.js +595 -0
- package/dist/features/canvas/useCanvasCamera.js +141 -587
- package/dist/features/canvas/useCanvasFrame.js +1 -1
- package/dist/features/page/DerivedPageContent.js +4 -8
- package/dist/features/preview/components/AssetLightbox.js +6 -65
- package/dist/features/preview/components/CanvasPreview.js +2 -2
- package/dist/features/preview/components/Frame.js +3 -3
- package/dist/features/preview/components/ItemFieldsEditor.js +376 -460
- package/dist/features/preview/components/Overlays.js +4 -9
- package/dist/features/preview/components/PreviewPanel.js +3 -3
- package/dist/features/preview/components/RemovedBlockPlaceholder.js +2 -2
- package/dist/features/preview/components/SelectionEditor.js +285 -339
- package/dist/features/preview/components/ZoomableImage.js +105 -0
- package/dist/features/preview/components/contentFieldSchema.js +3 -1
- package/dist/features/preview/components/useFieldWriter.js +30 -51
- package/dist/features/preview/components/useRecordView.js +3 -3
- package/dist/features/preview/overlayMessages.js +20 -58
- package/dist/features/preview/previewStore.js +6 -123
- package/dist/features/preview/repeatableItemPath.js +47 -0
- package/dist/features/renderer/RendererApp.js +6 -6
- package/dist/features/renderer/RendererFrames.js +2 -2
- package/dist/features/renderer/rendererHost.js +1 -1
- package/dist/features/routes/pageRuntime.d.ts +2 -8
- package/dist/features/routes/pageRuntime.js +21 -105
- package/dist/features/runtime/pageApp.js +1 -1
- package/dist/features/runtime/pageRead.js +105 -0
- package/dist/features/runtime/reader.d.ts +25 -0
- package/dist/features/runtime/reader.js +142 -0
- package/dist/features/runtime/runtime.d.ts +9 -3
- package/dist/features/runtime/runtime.js +608 -776
- package/dist/features/sdkBundle/buildSdkBundle.d.ts +5 -0
- package/dist/features/sdkBundle/buildSdkBundle.js +9 -3
- package/dist/features/studio/components/DraftsSheet.js +124 -65
- package/dist/features/studio/components/LocalePicker.js +518 -134
- package/dist/features/studio/components/ThreadMessages.js +5 -9
- package/dist/features/studio/showInCanvas.js +9 -19
- package/dist/features/studio/useEditorSelection.js +8 -19
- package/dist/lib/locale-path.js +2 -2
- package/dist/lib/queries.js +5 -1
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +4 -4
- package/skills/camox/references/artifacts.md +7 -0
- package/dist/core/hooks/useFieldSelection.js +0 -67
- package/dist/core/hooks/useIsEditable.js +0 -21
- package/dist/core/hooks/useOverlayMessage.js +0 -70
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cn } from "../../../lib/utils.js";
|
|
2
|
+
import { ZoomableImage } from "../../preview/components/ZoomableImage.js";
|
|
2
3
|
import { Squareling } from "./Squareling.js";
|
|
3
4
|
import { ThreadMarkdown } from "./ThreadMarkdown.js";
|
|
4
5
|
import { c } from "react/compiler-runtime";
|
|
@@ -706,15 +707,10 @@ function AttachmentThumbnails(t0) {
|
|
|
706
707
|
} else t7 = $[8];
|
|
707
708
|
let t8;
|
|
708
709
|
if ($[9] !== opened) {
|
|
709
|
-
t8 = opened && /* @__PURE__ */ jsx(
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
alt: opened.filename,
|
|
714
|
-
className: "max-h-full max-w-full object-contain shadow-lg",
|
|
715
|
-
draggable: false
|
|
716
|
-
})
|
|
717
|
-
});
|
|
710
|
+
t8 = opened && /* @__PURE__ */ jsx(ZoomableImage, {
|
|
711
|
+
src: opened.url,
|
|
712
|
+
alt: opened.filename
|
|
713
|
+
}, opened.url);
|
|
718
714
|
$[9] = opened;
|
|
719
715
|
$[10] = t8;
|
|
720
716
|
} else t8 = $[10];
|
|
@@ -3,6 +3,7 @@ import { useViewLocale } from "../../lib/view-locale-context.js";
|
|
|
3
3
|
import { useLocation, useNavigate } from "../navigation/navigation.js";
|
|
4
4
|
import { useProjectUuid } from "../../lib/auth.js";
|
|
5
5
|
import { reads, useStudioCache } from "../../lib/studio-reads.js";
|
|
6
|
+
import { fieldOwner, ownerSelection, slotSelection } from "../../core/editing/fieldSlot.js";
|
|
6
7
|
import { previewStore, sameEditingOwner } from "../preview/previewStore.js";
|
|
7
8
|
import { fieldTypesDictionary } from "../../core/lib/fieldTypes.js";
|
|
8
9
|
import { c } from "react/compiler-runtime";
|
|
@@ -18,27 +19,16 @@ const isFieldType = (kind) => !!kind && Object.hasOwn(fieldTypesDictionary, kind
|
|
|
18
19
|
/** What to select on the target's page: its field, else its item or block, else nothing. */
|
|
19
20
|
function selectionOf({ blockId, itemId, field }) {
|
|
20
21
|
if (!blockId) return null;
|
|
21
|
-
const
|
|
22
|
-
if (itemId) return field && fieldType ? {
|
|
23
|
-
type: "item-field",
|
|
24
|
-
blockId,
|
|
25
|
-
itemId,
|
|
26
|
-
fieldName: field.name,
|
|
27
|
-
fieldType
|
|
28
|
-
} : {
|
|
29
|
-
type: "item",
|
|
22
|
+
const owner = fieldOwner({
|
|
30
23
|
blockId,
|
|
31
24
|
itemId
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
type: "block",
|
|
40
|
-
blockId
|
|
41
|
-
};
|
|
25
|
+
});
|
|
26
|
+
if (!field || !isFieldType(field.kind)) return ownerSelection(owner);
|
|
27
|
+
return slotSelection({
|
|
28
|
+
owner,
|
|
29
|
+
name: field.name,
|
|
30
|
+
type: field.kind
|
|
31
|
+
});
|
|
42
32
|
}
|
|
43
33
|
/** Stops selecting what was last shown in the Canvas. */
|
|
44
34
|
let stopSelecting = null;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { placedRecords } from "../../lib/normalized-data.js";
|
|
2
2
|
import { reads, useReadQuery } from "../../lib/studio-reads.js";
|
|
3
3
|
import { useBlockDefinition, useCollectionDefinition } from "../../lib/studio-definitions.js";
|
|
4
|
-
import { isBlockPlacement,
|
|
4
|
+
import { isBlockPlacement, slotOf } from "../../core/editing/fieldSlot.js";
|
|
5
|
+
import { previewStore, selectionBlockId, selectionForOwner, selectionItemId } from "../preview/previewStore.js";
|
|
5
6
|
import { entityName } from "../preview/entityName.js";
|
|
6
|
-
import {
|
|
7
|
-
import { formatFieldName } from "../preview/components/
|
|
8
|
-
import { getSchemaForItem } from "../preview/components/SelectionEditor.js";
|
|
7
|
+
import { itemContentSchema, itemPath } from "../preview/repeatableItemPath.js";
|
|
8
|
+
import { contentFieldSchema, formatFieldName } from "../preview/components/contentFieldSchema.js";
|
|
9
9
|
import { c } from "react/compiler-runtime";
|
|
10
10
|
import { useSelector } from "@xstate/store-react";
|
|
11
11
|
|
|
@@ -32,14 +32,8 @@ function editorSelectionOf({ selection, block, items, schema, records, recordSch
|
|
|
32
32
|
for (const item of items) path.push(entityName(item, "Item"));
|
|
33
33
|
const recordSelected = selection.type === "record" || selection.type === "record-field";
|
|
34
34
|
if (recordSelected) path.push(...records.length > 0 ? records.map((record) => record.title || "Record") : ["Record"]);
|
|
35
|
-
|
|
36
|
-
if (
|
|
37
|
-
fieldName = selection.fieldName;
|
|
38
|
-
path.push(fieldLabel(schema, fieldName));
|
|
39
|
-
} else if (selection.type === "record-field") {
|
|
40
|
-
fieldName = selection.recordFieldName;
|
|
41
|
-
path.push(fieldLabel(recordSchema, fieldName));
|
|
42
|
-
}
|
|
35
|
+
const fieldName = slotOf(selection)?.name;
|
|
36
|
+
if (fieldName) path.push(fieldLabel(recordSelected ? recordSchema : schema, fieldName));
|
|
43
37
|
const itemId = selectionItemId(selection) ?? void 0;
|
|
44
38
|
const recordId = recordSelected ? selection.nested?.recordId ?? selection.recordId : void 0;
|
|
45
39
|
return {
|
|
@@ -94,13 +88,8 @@ function useEditorSelection(where) {
|
|
|
94
88
|
$[8] = t4;
|
|
95
89
|
$[9] = t5;
|
|
96
90
|
} else t5 = $[9];
|
|
97
|
-
const
|
|
98
|
-
const
|
|
99
|
-
for (let item_0 = itemId ? itemsMap.get(itemId) : void 0; item_0;) {
|
|
100
|
-
items.unshift(item_0);
|
|
101
|
-
item_0 = item_0.parentItemId ? itemsMap.get(item_0.parentItemId) : void 0;
|
|
102
|
-
}
|
|
103
|
-
const schema = blockDef && itemId ? getSchemaForItem(blockDef.contentSchema, itemId, itemsMap) : blockDef?.contentSchema;
|
|
91
|
+
const items = itemPath(itemId, t5);
|
|
92
|
+
const schema = blockDef && itemContentSchema(blockDef.contentSchema, items);
|
|
104
93
|
const records = [];
|
|
105
94
|
if ((selection?.type === "record" || selection?.type === "record-field") && isBlockPlacement(selection)) {
|
|
106
95
|
const placer = itemId ? items.at(-1) : bundle?.block;
|
package/dist/lib/locale-path.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LOCALE_HEADER } from "@camox/api-contract/drafts";
|
|
2
|
-
import { localizedPath, parseLocalePath } from "@camox/api-contract/locales";
|
|
2
|
+
import { localePrefix, localizedPath, parseLocalePath } from "@camox/api-contract/locales";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/locale-path.ts
|
|
5
5
|
/**
|
|
@@ -24,4 +24,4 @@ function localeHeaders(locale) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
//#endregion
|
|
27
|
-
export { UNNAMED_DEFAULT_LOCALE, localeHeaders, localizedPath, parseLocalePath };
|
|
27
|
+
export { UNNAMED_DEFAULT_LOCALE, localeHeaders, localePrefix, localizedPath, parseLocalePath };
|
package/dist/lib/queries.js
CHANGED
|
@@ -69,10 +69,14 @@ const specialistMutations = {
|
|
|
69
69
|
applyFix: () => getOrpc().specialists.applyFix.mutationOptions(),
|
|
70
70
|
dismissFinding: () => getOrpc().specialists.dismissFinding.mutationOptions()
|
|
71
71
|
};
|
|
72
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Adding and removing locales, and making one the default: content writes, so on Live they start
|
|
74
|
+
* a draft (ADR 0015).
|
|
75
|
+
*/
|
|
73
76
|
const localeMutations = {
|
|
74
77
|
add: () => getOrpc().locales.add.mutationOptions(),
|
|
75
78
|
remove: () => getOrpc().locales.remove.mutationOptions(),
|
|
79
|
+
setDefault: () => getOrpc().locales.setDefault.mutationOptions(),
|
|
76
80
|
/** Adds a page or record deleted from the locale viewed back to it. */
|
|
77
81
|
addBack: () => getOrpc().locales.addBack.mutationOptions()
|
|
78
82
|
};
|
package/dist/package.js
CHANGED