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
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { toast } from "@camox/ui/toaster";
|
|
3
|
+
|
|
4
|
+
//#region src/features/preview/studioNotice.ts
|
|
5
|
+
/** Shows a notice in this document's toasts. */
|
|
6
|
+
function showNotice({ tone, message }) {
|
|
7
|
+
toast[tone](message);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Where the notices of a page's blocks go. The renderer frame's document shows no toasts: it
|
|
11
|
+
* hands them to the studio, which shows them.
|
|
12
|
+
*/
|
|
13
|
+
const StudioNoticeContext = React.createContext(null);
|
|
14
|
+
/** Tells the editor something, in the studio's toasts. */
|
|
15
|
+
function useStudioNotice() {
|
|
16
|
+
return React.use(StudioNoticeContext) ?? showNotice;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { StudioNoticeContext, showNotice, useStudioNotice };
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { AuthContext, useAuthActions } from "../../lib/auth.js";
|
|
2
2
|
import { useDraftScope } from "../../lib/draft-scope.js";
|
|
3
3
|
import { reads, useReadQuery, useStudioCache } from "../../lib/studio-reads.js";
|
|
4
|
+
import { RevisionsContext, createRevisions } from "../../lib/revisions.js";
|
|
5
|
+
import { useAdminShortcuts } from "./useAdminShortcuts.js";
|
|
4
6
|
import { useApplyTheme, useThemeActions } from "../studio/useTheme.js";
|
|
5
7
|
import { usePreviewPagesActions, useShowCanvasAction } from "../preview/CamoxPreview.js";
|
|
6
8
|
import { useProjectRoom } from "../../lib/use-project-room.js";
|
|
7
9
|
import { useNavbarActions } from "../studio/components/Navbar.js";
|
|
8
10
|
import { draftNoticeMessage } from "../studio/draftNotice.js";
|
|
9
11
|
import { CommandPalette, useCommandPaletteActions } from "./components/CommandPalette.js";
|
|
10
|
-
import { useAdminShortcuts } from "./useAdminShortcuts.js";
|
|
11
12
|
import { c } from "react/compiler-runtime";
|
|
12
13
|
import * as React from "react";
|
|
13
|
-
import {
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
15
|
import { Toaster, toast } from "@camox/ui/toaster";
|
|
15
16
|
import studioCssUrl from "virtual:camox-studio-css";
|
|
16
17
|
|
|
17
18
|
//#region src/features/provider/AuthenticatedCamoxProvider.tsx
|
|
18
19
|
function AuthenticatedCamoxProvider(t0) {
|
|
19
|
-
const $ = c(
|
|
20
|
+
const $ = c(18);
|
|
20
21
|
const { children } = t0;
|
|
21
22
|
useAdminShortcuts();
|
|
22
23
|
useCommandPaletteActions();
|
|
@@ -48,49 +49,64 @@ function AuthenticatedCamoxProvider(t0) {
|
|
|
48
49
|
t3 = $[4];
|
|
49
50
|
}
|
|
50
51
|
React.useEffect(t2, t3);
|
|
52
|
+
const [revisions] = React.useState(createRevisions);
|
|
51
53
|
let t4;
|
|
52
|
-
if ($[5] !== draftScope) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
if ($[5] !== draftScope || $[6] !== revisions) {
|
|
55
|
+
let t5;
|
|
56
|
+
if ($[8] !== revisions) {
|
|
57
|
+
t5 = (revision) => revisions.announce(revision);
|
|
58
|
+
$[8] = revisions;
|
|
59
|
+
$[9] = t5;
|
|
60
|
+
} else t5 = $[9];
|
|
61
|
+
t4 = {
|
|
62
|
+
onDraftEnded(ended) {
|
|
63
|
+
if (ended.draftId !== draftScope.current()) return;
|
|
64
|
+
draftScope.leave(ended, { notice: true });
|
|
65
|
+
},
|
|
66
|
+
onRevision: t5
|
|
67
|
+
};
|
|
57
68
|
$[5] = draftScope;
|
|
58
|
-
$[6] =
|
|
59
|
-
|
|
69
|
+
$[6] = revisions;
|
|
70
|
+
$[7] = t4;
|
|
71
|
+
} else t4 = $[7];
|
|
60
72
|
useProjectRoom(apiUrl, project?.id, studioCache, t4);
|
|
61
73
|
const { resolvedTheme } = useApplyTheme();
|
|
62
74
|
let t5;
|
|
63
|
-
if ($[
|
|
75
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
64
76
|
t5 = /* @__PURE__ */ jsx("link", {
|
|
65
77
|
rel: "stylesheet",
|
|
66
78
|
href: studioCssUrl,
|
|
67
79
|
"data-camox-studio": true
|
|
68
80
|
});
|
|
69
|
-
$[
|
|
70
|
-
} else t5 = $[
|
|
81
|
+
$[10] = t5;
|
|
82
|
+
} else t5 = $[10];
|
|
71
83
|
let t6;
|
|
72
|
-
if ($[
|
|
84
|
+
if ($[11] !== resolvedTheme) {
|
|
73
85
|
t6 = /* @__PURE__ */ jsx(Toaster, { theme: resolvedTheme });
|
|
74
|
-
$[
|
|
75
|
-
$[
|
|
76
|
-
} else t6 = $[
|
|
86
|
+
$[11] = resolvedTheme;
|
|
87
|
+
$[12] = t6;
|
|
88
|
+
} else t6 = $[12];
|
|
77
89
|
let t7;
|
|
78
|
-
if ($[
|
|
90
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
79
91
|
t7 = /* @__PURE__ */ jsx(CommandPalette, {});
|
|
80
|
-
$[
|
|
81
|
-
} else t7 = $[
|
|
92
|
+
$[13] = t7;
|
|
93
|
+
} else t7 = $[13];
|
|
82
94
|
let t8;
|
|
83
|
-
if ($[
|
|
84
|
-
t8 = /* @__PURE__ */ jsxs(
|
|
85
|
-
|
|
86
|
-
children
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
if ($[14] !== children || $[15] !== revisions || $[16] !== t6) {
|
|
96
|
+
t8 = /* @__PURE__ */ jsxs(RevisionsContext, {
|
|
97
|
+
value: revisions,
|
|
98
|
+
children: [
|
|
99
|
+
t5,
|
|
100
|
+
children,
|
|
101
|
+
t6,
|
|
102
|
+
t7
|
|
103
|
+
]
|
|
104
|
+
});
|
|
105
|
+
$[14] = children;
|
|
106
|
+
$[15] = revisions;
|
|
107
|
+
$[16] = t6;
|
|
108
|
+
$[17] = t8;
|
|
109
|
+
} else t8 = $[17];
|
|
94
110
|
return t8;
|
|
95
111
|
}
|
|
96
112
|
function _temp(notice) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { actionsStore } from "../actionsStore.js";
|
|
2
|
-
import { formatShortcut } from "../../../lib/
|
|
2
|
+
import { formatShortcut } from "../../../lib/shortcuts.js";
|
|
3
3
|
import { studioStore } from "../../studio/studioStore.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
5
|
import * as React from "react";
|
|
@@ -249,10 +249,7 @@ function _temp7() {
|
|
|
249
249
|
groupLabel: "Invisible",
|
|
250
250
|
checkIfAvailable: _temp4,
|
|
251
251
|
execute: _temp5,
|
|
252
|
-
shortcut:
|
|
253
|
-
key: "k",
|
|
254
|
-
withMeta: true
|
|
255
|
-
}
|
|
252
|
+
shortcut: "Mod+K"
|
|
256
253
|
}
|
|
257
254
|
});
|
|
258
255
|
return _temp6;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useSignInRedirect } from "../../lib/auth.js";
|
|
2
|
-
import { TOGGLE_CANVAS_SHORTCUT } from "../preview/previewConstants.js";
|
|
3
2
|
import { c } from "react/compiler-runtime";
|
|
4
3
|
import * as React from "react";
|
|
5
4
|
|
|
@@ -28,7 +27,7 @@ function useSignInShortcut(enabled) {
|
|
|
28
27
|
t0 = () => {
|
|
29
28
|
if (!enabled) return;
|
|
30
29
|
const handleKeyDown = (event) => {
|
|
31
|
-
if (event.key !==
|
|
30
|
+
if (event.key !== "Enter" || !(event.metaKey || event.ctrlKey)) return;
|
|
32
31
|
if (event.altKey || event.shiftKey || event.defaultPrevented || isTyping()) return;
|
|
33
32
|
event.preventDefault();
|
|
34
33
|
signIn();
|
|
@@ -1,75 +1,69 @@
|
|
|
1
1
|
import { actionsStore } from "./actionsStore.js";
|
|
2
2
|
import { checkIfInputFocused } from "../../lib/utils.js";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
|
-
import * as React from "react";
|
|
5
4
|
import { useSelector } from "@xstate/store-react";
|
|
5
|
+
import { parseHotkey, useHotkeys } from "@tanstack/react-hotkeys";
|
|
6
6
|
|
|
7
7
|
//#region src/features/provider/useAdminShortcuts.tsx
|
|
8
|
+
/** Listens for the shortcuts of the actions in the actionsStore, on the Studio's window. */
|
|
9
|
+
function useAdminShortcuts() {
|
|
10
|
+
useActionShortcuts(typeof window === "undefined" ? null : window);
|
|
11
|
+
}
|
|
8
12
|
/**
|
|
9
|
-
*
|
|
13
|
+
* Runs the first available action whose shortcut is pressed in `win`, which may be a preview
|
|
14
|
+
* iframe's window. Shortcuts no available action claims leave the key to the page.
|
|
10
15
|
*/
|
|
11
|
-
function
|
|
12
|
-
const $ = c(
|
|
16
|
+
function useActionShortcuts(win) {
|
|
17
|
+
const $ = c(4);
|
|
13
18
|
const actions = useSelector(actionsStore, _temp);
|
|
14
19
|
let t0;
|
|
15
20
|
let t1;
|
|
16
|
-
if ($[0] !== actions) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const handleEscape = (event_1) => {
|
|
41
|
-
if (event_1.key !== "Escape" || event_1.defaultPrevented) return;
|
|
42
|
-
handleKeyDown(event_1);
|
|
43
|
-
};
|
|
44
|
-
const handleMessage = (event_2) => {
|
|
45
|
-
if (event_2.data?.type === "executeAction") {
|
|
46
|
-
const { actionId } = event_2.data;
|
|
47
|
-
const action_0 = actions.find((a) => a.id === actionId);
|
|
48
|
-
if (action_0) action_0.execute();
|
|
21
|
+
if ($[0] !== actions || $[1] !== win) {
|
|
22
|
+
const shortcuts = [...new Set(actions.flatMap(_temp2))];
|
|
23
|
+
t0 = useHotkeys;
|
|
24
|
+
t1 = win ? shortcuts.map((shortcut) => {
|
|
25
|
+
const { key, ctrl, meta, alt } = parseHotkey(shortcut);
|
|
26
|
+
const escape = key === "Escape";
|
|
27
|
+
return {
|
|
28
|
+
hotkey: shortcut,
|
|
29
|
+
callback: (event) => {
|
|
30
|
+
if (escape && event.defaultPrevented) return;
|
|
31
|
+
const action_0 = findAvailableAction(shortcut);
|
|
32
|
+
if (!action_0) return;
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
event.stopPropagation();
|
|
35
|
+
if (escape && checkIfInputFocused(win.document)) win.document.activeElement.blur();
|
|
36
|
+
action_0.execute();
|
|
37
|
+
},
|
|
38
|
+
options: {
|
|
39
|
+
target: escape ? win : win.document,
|
|
40
|
+
capture: !escape,
|
|
41
|
+
ignoreInputs: key === "Backspace" || !ctrl && !meta && !alt && !escape,
|
|
42
|
+
preventDefault: false,
|
|
43
|
+
stopPropagation: false,
|
|
44
|
+
conflictBehavior: "allow"
|
|
49
45
|
}
|
|
50
46
|
};
|
|
51
|
-
|
|
52
|
-
window.addEventListener("keydown", handleEscape);
|
|
53
|
-
window.addEventListener("message", handleMessage);
|
|
54
|
-
return () => {
|
|
55
|
-
document.removeEventListener("keydown", handleCapturedKeyDown, true);
|
|
56
|
-
window.removeEventListener("keydown", handleEscape);
|
|
57
|
-
window.removeEventListener("message", handleMessage);
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
t1 = [actions];
|
|
47
|
+
}) : [];
|
|
61
48
|
$[0] = actions;
|
|
62
|
-
$[1] =
|
|
63
|
-
$[2] =
|
|
49
|
+
$[1] = win;
|
|
50
|
+
$[2] = t0;
|
|
51
|
+
$[3] = t1;
|
|
64
52
|
} else {
|
|
65
|
-
t0 = $[
|
|
66
|
-
t1 = $[
|
|
53
|
+
t0 = $[2];
|
|
54
|
+
t1 = $[3];
|
|
67
55
|
}
|
|
68
|
-
|
|
56
|
+
t0(t1);
|
|
57
|
+
}
|
|
58
|
+
function _temp2(action) {
|
|
59
|
+
return action.shortcut ?? [];
|
|
69
60
|
}
|
|
70
61
|
function _temp(state) {
|
|
71
62
|
return state.context.actions;
|
|
72
63
|
}
|
|
64
|
+
function findAvailableAction(shortcut) {
|
|
65
|
+
return actionsStore.getSnapshot().context.actions.find((action) => action.shortcut === shortcut && action.checkIfAvailable());
|
|
66
|
+
}
|
|
73
67
|
|
|
74
68
|
//#endregion
|
|
75
|
-
export { useAdminShortcuts };
|
|
69
|
+
export { useActionShortcuts, useAdminShortcuts };
|