camox 0.76.1 → 0.78.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/lib/artifactTheme.js +43 -6
- package/dist/features/canvas/CamoxCanvas.js +187 -197
- package/dist/features/canvas/canvasCameraController.js +1 -1
- package/dist/features/canvas/canvasItems.js +40 -9
- package/dist/features/canvas/sidebar/ContentSidebarFrame.js +15 -11
- package/dist/features/canvas/useCanvasLayout.js +34 -0
- package/dist/features/memory/CamoxMemory.js +747 -0
- package/dist/features/preview/EditablePageExperience.js +2 -0
- package/dist/features/runtime/publicCache.d.ts +2 -0
- package/dist/features/runtime/publicCache.js +27 -4
- package/dist/features/runtime/runtime.d.ts +1 -1
- package/dist/features/runtime/runtime.js +34 -15
- package/dist/features/studio/FollowAgentProvider.js +1 -1
- package/dist/features/studio/components/AgentSidebar.js +22 -16
- package/dist/features/studio/components/DraftBar.js +167 -103
- package/dist/features/studio/components/{ReviewDraftDialog.js → DraftReview.js} +191 -218
- package/dist/features/studio/components/DraftsControl.js +174 -202
- package/dist/features/studio/components/DraftsSheet.js +102 -94
- package/dist/features/studio/components/LocalePicker.js +518 -134
- package/dist/features/studio/components/Navbar.js +121 -84
- package/dist/features/studio/components/PublishedTab.js +21 -20
- package/dist/features/studio/routes.js +3 -1
- package/dist/features/studio/studioStore.js +12 -9
- package/dist/features/studio/usePublishDraft.js +116 -0
- package/dist/features/studio/viewSwitch.js +10 -7
- package/dist/lib/locale-path.js +2 -2
- package/dist/lib/queries.js +12 -2
- package/dist/lib/studio-reads.js +6 -0
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +5 -5
- package/skills/camox/references/artifacts.md +7 -0
- package/LICENSE.md +0 -21
|
@@ -2,7 +2,38 @@ import { fitCanvasPage } from "./canvasCamera.js";
|
|
|
2
2
|
import { CANVAS_DEVICES } from "./canvasPages.js";
|
|
3
3
|
|
|
4
4
|
//#region src/features/canvas/canvasItems.ts
|
|
5
|
-
|
|
5
|
+
/** The narrowest a Page's area gets: the desktop its frame emulates. */
|
|
6
|
+
const MIN_CANVAS_SLOT_WIDTH = CANVAS_DEVICES.desktop.width;
|
|
7
|
+
/**
|
|
8
|
+
* The width of a Page's area in the Canvas row, which a desktop frame fills. Device selection
|
|
9
|
+
* resizes frames, not their area. A working area wider than the desktop widens it, so a snapped
|
|
10
|
+
* Page shows at its true size, never enlarged; a narrower one keeps the desktop, zoomed out.
|
|
11
|
+
*/
|
|
12
|
+
function canvasSlotWidth(workingAreaWidth) {
|
|
13
|
+
return Math.max(MIN_CANVAS_SLOT_WIDTH, workingAreaWidth - 16 * 2);
|
|
14
|
+
}
|
|
15
|
+
/** How much wider than CMS_SIDEBAR_WIDTH each sidebar beside the Canvas gets, at most. */
|
|
16
|
+
const MAX_CMS_SIDEBAR_GROWTH = 100;
|
|
17
|
+
/**
|
|
18
|
+
* How the window splits between the sidebars and the Canvas row. Once a snapped desktop Page
|
|
19
|
+
* shows at its true size, extra width first widens both sidebars, by up to
|
|
20
|
+
* MAX_CMS_SIDEBAR_GROWTH each, then widens the Pages' areas.
|
|
21
|
+
*/
|
|
22
|
+
function canvasLayout(windowWidth) {
|
|
23
|
+
const snappedDesktop = MIN_CANVAS_SLOT_WIDTH + 16 * 2;
|
|
24
|
+
const spare = (windowWidth - 265 * 2 - snappedDesktop) / 2;
|
|
25
|
+
const sidebarWidth = 265 + Math.floor(Math.min(100, Math.max(0, spare)));
|
|
26
|
+
const width = Math.max(0, windowWidth - sidebarWidth * 2);
|
|
27
|
+
const slotWidth = canvasSlotWidth(width);
|
|
28
|
+
return {
|
|
29
|
+
sidebarWidth,
|
|
30
|
+
slotWidth,
|
|
31
|
+
gap: canvasItemGap({
|
|
32
|
+
width,
|
|
33
|
+
height: 0
|
|
34
|
+
}, sidebarWidth, slotWidth)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
6
37
|
/** World-space bounds of the gap, so very narrow or wide canvases still space Pages alike. */
|
|
7
38
|
const MIN_CANVAS_ITEM_GAP = 96;
|
|
8
39
|
const MAX_CANVAS_ITEM_GAP = 320;
|
|
@@ -11,27 +42,27 @@ const MAX_CANVAS_ITEM_GAP = 320;
|
|
|
11
42
|
* across the sidebar laid over the working area's edge. The snapped zoom follows the working
|
|
12
43
|
* area's width, so the gap does too.
|
|
13
44
|
*/
|
|
14
|
-
function canvasItemGap(workingArea, sidebarWidth) {
|
|
45
|
+
function canvasItemGap(workingArea, sidebarWidth, slotWidth = canvasSlotWidth(workingArea.width)) {
|
|
15
46
|
const fit = fitCanvasPage(workingArea, {
|
|
16
47
|
left: 0,
|
|
17
|
-
width:
|
|
48
|
+
width: slotWidth
|
|
18
49
|
});
|
|
19
|
-
const gap = ((workingArea.width -
|
|
50
|
+
const gap = ((workingArea.width - slotWidth * fit.scale) / 2 + sidebarWidth / 2) / fit.scale;
|
|
20
51
|
return Math.min(320, Math.max(96, gap));
|
|
21
52
|
}
|
|
22
53
|
/**
|
|
23
54
|
* World-space positions of the Canvas row, matching its flex layout: every Page
|
|
24
55
|
* side by side, in Canvas order, a gap apart.
|
|
25
56
|
*/
|
|
26
|
-
function positionCanvasPages(pages, gap) {
|
|
57
|
+
function positionCanvasPages(pages, gap, slotWidth) {
|
|
27
58
|
return {
|
|
28
59
|
items: pages.map((page, index) => ({
|
|
29
60
|
key: page.key,
|
|
30
61
|
page,
|
|
31
|
-
left: index * (
|
|
32
|
-
width:
|
|
62
|
+
left: index * (slotWidth + gap),
|
|
63
|
+
width: slotWidth
|
|
33
64
|
})),
|
|
34
|
-
width: Math.max(0, pages.length * (
|
|
65
|
+
width: Math.max(0, pages.length * (slotWidth + gap) - gap)
|
|
35
66
|
};
|
|
36
67
|
}
|
|
37
68
|
function canvasSnapTargets(items) {
|
|
@@ -43,4 +74,4 @@ function canvasSnapTargets(items) {
|
|
|
43
74
|
}
|
|
44
75
|
|
|
45
76
|
//#endregion
|
|
46
|
-
export {
|
|
77
|
+
export { MIN_CANVAS_SLOT_WIDTH, canvasItemGap, canvasLayout, canvasSlotWidth, canvasSnapTargets, positionCanvasPages };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useCanvasLayout } from "../useCanvasLayout.js";
|
|
1
2
|
import { c } from "react/compiler-runtime";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
|
|
@@ -8,7 +9,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
8
9
|
* around them, the Canvas shows through.
|
|
9
10
|
*/
|
|
10
11
|
function ContentSidebarFrame(t0) {
|
|
11
|
-
const $ = c(
|
|
12
|
+
const $ = c(11);
|
|
12
13
|
let children;
|
|
13
14
|
let label;
|
|
14
15
|
let props;
|
|
@@ -23,13 +24,15 @@ function ContentSidebarFrame(t0) {
|
|
|
23
24
|
label = $[2];
|
|
24
25
|
props = $[3];
|
|
25
26
|
}
|
|
27
|
+
const { sidebarWidth } = useCanvasLayout();
|
|
26
28
|
let t1;
|
|
27
|
-
if ($[4]
|
|
28
|
-
t1 = { width:
|
|
29
|
-
$[4] =
|
|
30
|
-
|
|
29
|
+
if ($[4] !== sidebarWidth) {
|
|
30
|
+
t1 = { width: sidebarWidth };
|
|
31
|
+
$[4] = sidebarWidth;
|
|
32
|
+
$[5] = t1;
|
|
33
|
+
} else t1 = $[5];
|
|
31
34
|
let t2;
|
|
32
|
-
if ($[
|
|
35
|
+
if ($[6] !== children || $[7] !== label || $[8] !== props || $[9] !== t1) {
|
|
33
36
|
t2 = /* @__PURE__ */ jsx("aside", {
|
|
34
37
|
"aria-label": label,
|
|
35
38
|
className: "absolute inset-y-0 left-0 z-10 flex flex-col py-2",
|
|
@@ -37,11 +40,12 @@ function ContentSidebarFrame(t0) {
|
|
|
37
40
|
...props,
|
|
38
41
|
children
|
|
39
42
|
});
|
|
40
|
-
$[
|
|
41
|
-
$[
|
|
42
|
-
$[
|
|
43
|
-
$[
|
|
44
|
-
|
|
43
|
+
$[6] = children;
|
|
44
|
+
$[7] = label;
|
|
45
|
+
$[8] = props;
|
|
46
|
+
$[9] = t1;
|
|
47
|
+
$[10] = t2;
|
|
48
|
+
} else t2 = $[10];
|
|
45
49
|
return t2;
|
|
46
50
|
}
|
|
47
51
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { canvasLayout } from "./canvasItems.js";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/features/canvas/useCanvasLayout.ts
|
|
6
|
+
function subscribeToWindowWidth(onChange) {
|
|
7
|
+
window.addEventListener("resize", onChange);
|
|
8
|
+
return () => window.removeEventListener("resize", onChange);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The sidebars' width beside the Canvas, each Page's area in the Canvas row, and the gap between
|
|
12
|
+
* them. The Canvas spans the window, so all follow the window's width. They read the window from
|
|
13
|
+
* the first render, before the camera measures the Canvas.
|
|
14
|
+
*/
|
|
15
|
+
function useCanvasLayout() {
|
|
16
|
+
const $ = c(2);
|
|
17
|
+
const windowWidth = React.useSyncExternalStore(subscribeToWindowWidth, _temp, _temp2);
|
|
18
|
+
let t0;
|
|
19
|
+
if ($[0] !== windowWidth) {
|
|
20
|
+
t0 = canvasLayout(windowWidth);
|
|
21
|
+
$[0] = windowWidth;
|
|
22
|
+
$[1] = t0;
|
|
23
|
+
} else t0 = $[1];
|
|
24
|
+
return t0;
|
|
25
|
+
}
|
|
26
|
+
function _temp2() {
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
function _temp() {
|
|
30
|
+
return window.innerWidth;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { useCanvasLayout };
|