camox 0.40.0 → 0.41.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/components/PlatformLabel.js +62 -0
- package/dist/core/components/lexical/GradientNode.js +126 -0
- package/dist/core/components/lexical/InlineLexicalEditor.js +37 -56
- package/dist/core/components/lexical/InlineStylesPlugin.js +183 -0
- package/dist/core/components/lexical/SelectionBroadcaster.js +49 -46
- package/dist/core/components/lexical/SidebarLexicalEditor.js +197 -151
- package/dist/core/components/lexical/editorConfig.js +25 -7
- package/dist/core/components/lexical/selectTextLink.js +21 -0
- package/dist/core/createApp.d.ts +30 -17
- package/dist/core/createApp.js +14 -3
- package/dist/core/createBlock.d.ts +2 -2
- package/dist/core/createBlock.js +17 -28
- package/dist/core/createLayout.d.ts +48 -4
- package/dist/core/createLayout.js +51 -23
- package/dist/core/derivedRoutes.js +36 -0
- package/dist/core/editing/BlockEditingRuntime.js +4 -4
- package/dist/core/editing/CompleteBlockEditingRuntime.js +5 -5
- package/dist/core/editing/createEditableBlock.d.ts +9 -8
- package/dist/core/editing/createEditableBlock.js +265 -403
- package/dist/core/hooks/useIsEditable.js +4 -7
- package/dist/core/hooks/useRequireDraftSource.js +7 -11
- package/dist/core/lib/lexicalReact.d.ts +1 -26
- package/dist/core/lib/lexicalReact.js +46 -60
- package/dist/core/lib/lexicalState.js +164 -81
- package/dist/core/lib/modifierFormats.js +4 -15
- package/dist/core/lib/textStyles.d.ts +27 -0
- package/dist/core/lib/textStyles.js +47 -0
- package/dist/features/navigation/navigation.d.ts +2 -0
- package/dist/features/navigation/navigation.js +51 -46
- package/dist/features/page/DerivedPageContent.js +61 -0
- package/dist/features/page/PublishedPageContent.js +52 -83
- package/dist/features/page/SharedLayoutContent.js +66 -0
- package/dist/features/preview/CamoxPreview.d.ts +16 -1
- package/dist/features/preview/CamoxPreview.js +246 -290
- package/dist/features/preview/DerivedPreview.js +134 -0
- package/dist/features/preview/EditablePageExperience.js +25 -8
- package/dist/features/preview/components/AddBlockSidebar.js +43 -33
- package/dist/features/preview/components/AssetLightbox.js +1 -1
- package/dist/features/preview/components/BlockActionsPopover.js +8 -8
- package/dist/features/preview/components/BlockThumbnail.js +192 -0
- package/dist/features/preview/components/CreatePageModal.js +123 -115
- package/dist/features/preview/components/DerivedLayoutDialog.js +100 -0
- package/dist/features/preview/components/DerivedLayoutSidebar.d.ts +5 -0
- package/dist/features/preview/components/DerivedLayoutSidebar.js +160 -0
- package/dist/features/preview/components/DerivedPageInfoSidebar.js +57 -0
- package/dist/features/preview/components/FieldToolbar.js +42 -20
- package/dist/features/preview/components/Frame.js +133 -140
- package/dist/features/preview/components/LeftSidebar.js +42 -38
- package/dist/features/preview/components/LinkFieldEditor.js +3 -4
- package/dist/features/preview/components/MobilePreviewDrawer.js +4 -4
- package/dist/features/preview/components/Overlays.js +59 -47
- package/dist/features/preview/components/PageEditorSidebar.js +194 -203
- package/dist/features/preview/components/PageInfoSidebar.js +63 -55
- package/dist/features/preview/components/PageNavigatorSidebar.js +34 -483
- package/dist/features/preview/components/PagePicker.js +205 -153
- package/dist/features/preview/components/PageTree.js +366 -340
- package/dist/features/preview/components/PreviewActivation.js +78 -0
- package/dist/features/preview/components/PreviewPanel.js +98 -68
- package/dist/features/preview/components/PreviewToolbar.js +224 -241
- package/dist/features/preview/components/PreviewToolbarSpacer.js +43 -0
- package/dist/features/preview/components/PublicationRow.js +425 -0
- package/dist/features/preview/components/PublishDialog.js +180 -97
- package/dist/features/preview/components/RightSidebar.js +19 -34
- package/dist/features/preview/components/previewStyles.js +8 -0
- package/dist/features/preview/components/useUpdateBlockPosition.js +7 -13
- package/dist/features/preview/previewConstants.js +8 -0
- package/dist/features/preview/previewStore.js +18 -39
- package/dist/features/preview/publication.js +71 -0
- package/dist/features/provider/AuthenticatedCamoxProvider.js +2 -1
- package/dist/features/provider/CoreCamoxProvider.js +11 -2
- package/dist/features/provider/LocalhostPreviewProvider.js +6 -7
- package/dist/features/provider/useAdminShortcuts.js +5 -4
- package/dist/features/routes/pageRuntime.d.ts +10 -0
- package/dist/features/routes/pageRuntime.js +7 -9
- package/dist/features/runtime/PreviewDocumentContext.js +7 -0
- package/dist/features/runtime/RuntimeChrome.js +149 -0
- package/dist/features/runtime/SharedChromeContext.js +7 -0
- package/dist/features/runtime/navigationRequest.js +21 -0
- package/dist/features/runtime/navigationTarget.js +23 -0
- package/dist/features/runtime/pageApp.js +196 -121
- package/dist/features/runtime/pageNavigation.js +79 -130
- package/dist/features/runtime/runtime.d.ts +11 -0
- package/dist/features/runtime/runtime.js +183 -47
- package/dist/features/runtime/studioApp.d.ts +2 -11
- package/dist/features/runtime/studioApp.js +14 -177
- package/dist/features/studio/CamoxStudio.js +27 -13
- package/dist/features/studio/components/Navbar.js +80 -74
- package/dist/features/studio/components/UserButton.js +4 -4
- package/dist/features/studio/studioTheme.js +25 -0
- package/dist/features/studio/useTheme.js +94 -109
- package/dist/features/vite/appGeneration.js +12 -3
- package/dist/features/vite/definitionsSync.js +4 -2
- package/dist/features/vite/layoutGeneration.js +38 -0
- package/dist/features/vite/runtimeDev.js +3 -1
- package/dist/lib/auth.js +15 -13
- package/dist/lib/normalized-data.js +4 -4
- package/dist/lib/platform.js +13 -0
- package/dist/lib/utils.js +90 -38
- package/dist/studio-overlays.css +5 -40
- package/dist/studio.css +1 -1
- package/package.json +8 -4
- package/skills/camox/SKILL.md +2 -0
- package/skills/camox/references/block-definitions.md +31 -12
- package/skills/camox/references/layout-definitions.md +2 -0
- package/dist/core/lib/modifiers.js +0 -24
- package/dist/features/preview/components/DraftSwitchDialog.js +0 -66
- package/dist/features/preview/previewQueryFns.js +0 -23
- package/dist/features/runtime/studioNavigation.js +0 -120
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { FORMAT_FLAGS, lexicalTextToMarkdown } from "./modifierFormats.js";
|
|
2
|
-
import "react";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
5
|
-
//#region src/core/lib/modifiers.tsx
|
|
6
|
-
const TEXT_MODIFIERS = {
|
|
7
|
-
bold: {
|
|
8
|
-
formatFlag: FORMAT_FLAGS.bold,
|
|
9
|
-
label: "Bold",
|
|
10
|
-
icon: "B",
|
|
11
|
-
render: (children) => /* @__PURE__ */ jsx("strong", { children }),
|
|
12
|
-
toMarkdown: (text) => `**${text}**`
|
|
13
|
-
},
|
|
14
|
-
italic: {
|
|
15
|
-
formatFlag: FORMAT_FLAGS.italic,
|
|
16
|
-
label: "Italic",
|
|
17
|
-
icon: "I",
|
|
18
|
-
render: (children) => /* @__PURE__ */ jsx("em", { children }),
|
|
19
|
-
toMarkdown: (text) => `*${text}*`
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
export { TEXT_MODIFIERS };
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { previewStore } from "../previewStore.js";
|
|
2
|
-
import { c } from "react/compiler-runtime";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { useSelector } from "@xstate/store-react";
|
|
5
|
-
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
|
|
6
|
-
|
|
7
|
-
//#region src/features/preview/components/DraftSwitchDialog.tsx
|
|
8
|
-
/**
|
|
9
|
-
* Global confirmation that the user wants to leave a non-draft preview
|
|
10
|
-
* before editing. The CTA only flips `previewSource` to `'draft'` — the
|
|
11
|
-
* original edit attempt is intentionally NOT replayed; the user re-issues it
|
|
12
|
-
* once back on draft. This keeps the action explicit and avoids "magical"
|
|
13
|
-
* delayed edits the user might no longer want.
|
|
14
|
-
*/
|
|
15
|
-
function DraftSwitchDialog() {
|
|
16
|
-
const $ = c(5);
|
|
17
|
-
if ($[0] !== "3be875184f6abab2ae16a64fbececa2389b1e6a2f4ea614823966b8277e4826b") {
|
|
18
|
-
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
19
|
-
$[0] = "3be875184f6abab2ae16a64fbececa2389b1e6a2f4ea614823966b8277e4826b";
|
|
20
|
-
}
|
|
21
|
-
const open = useSelector(previewStore, _temp);
|
|
22
|
-
let t0;
|
|
23
|
-
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
24
|
-
t0 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: "Switch to draft to edit?" }), /* @__PURE__ */ jsx(AlertDialogDescription, { children: "You're previewing the live version. Switch to the draft to make changes." })] });
|
|
25
|
-
$[1] = t0;
|
|
26
|
-
} else t0 = $[1];
|
|
27
|
-
let t1;
|
|
28
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
29
|
-
t1 = /* @__PURE__ */ jsxs(AlertDialogContent, { children: [t0, /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [/* @__PURE__ */ jsx(AlertDialogCancel, {
|
|
30
|
-
variant: "outline",
|
|
31
|
-
size: "default",
|
|
32
|
-
children: "Cancel"
|
|
33
|
-
}), /* @__PURE__ */ jsx(AlertDialogAction, {
|
|
34
|
-
onClick: _temp3,
|
|
35
|
-
children: "Switch to draft"
|
|
36
|
-
})] })] });
|
|
37
|
-
$[2] = t1;
|
|
38
|
-
} else t1 = $[2];
|
|
39
|
-
let t2;
|
|
40
|
-
if ($[3] !== open) {
|
|
41
|
-
t2 = /* @__PURE__ */ jsx(AlertDialog, {
|
|
42
|
-
open,
|
|
43
|
-
onOpenChange: _temp2,
|
|
44
|
-
children: t1
|
|
45
|
-
});
|
|
46
|
-
$[3] = open;
|
|
47
|
-
$[4] = t2;
|
|
48
|
-
} else t2 = $[4];
|
|
49
|
-
return t2;
|
|
50
|
-
}
|
|
51
|
-
function _temp3() {
|
|
52
|
-
previewStore.send({
|
|
53
|
-
type: "setPreviewSource",
|
|
54
|
-
source: "draft"
|
|
55
|
-
});
|
|
56
|
-
previewStore.send({ type: "dismissDraftSwitch" });
|
|
57
|
-
}
|
|
58
|
-
function _temp2(next) {
|
|
59
|
-
if (!next) previewStore.send({ type: "dismissDraftSwitch" });
|
|
60
|
-
}
|
|
61
|
-
function _temp(state) {
|
|
62
|
-
return state.context.isDraftSwitchDialogOpen;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
//#endregion
|
|
66
|
-
export { DraftSwitchDialog };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { getApiClient } from "../../lib/api-client.js";
|
|
2
|
-
import { seedBlockCaches } from "../../lib/normalized-data.js";
|
|
3
|
-
|
|
4
|
-
//#region src/features/preview/previewQueryFns.ts
|
|
5
|
-
function pageFullQueryFn(queryClient, path, projectSlug, source) {
|
|
6
|
-
return async () => {
|
|
7
|
-
const data = await getApiClient().pages.getByPath({
|
|
8
|
-
path,
|
|
9
|
-
projectSlug,
|
|
10
|
-
source
|
|
11
|
-
});
|
|
12
|
-
seedBlockCaches(queryClient, data, source);
|
|
13
|
-
return {
|
|
14
|
-
page: data.page,
|
|
15
|
-
layout: data.layout,
|
|
16
|
-
projectName: data.projectName,
|
|
17
|
-
project: data.project
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
//#endregion
|
|
23
|
-
export { pageFullQueryFn };
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { NavigationProvider } from "../navigation/navigation.js";
|
|
2
|
-
import { c } from "react/compiler-runtime";
|
|
3
|
-
import "react";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
|
|
6
|
-
//#region src/features/runtime/studioNavigation.tsx
|
|
7
|
-
function normalizeRuntimeBasePath(basePath) {
|
|
8
|
-
if (!basePath || basePath === "/") return "";
|
|
9
|
-
return basePath.startsWith("/") ? basePath.replace(/\/+$/, "") : `/${basePath.replace(/\/+$/, "")}`;
|
|
10
|
-
}
|
|
11
|
-
function normalizeRuntimePathname(pathname, runtimeBasePath) {
|
|
12
|
-
const basePath = normalizeRuntimeBasePath(runtimeBasePath);
|
|
13
|
-
if (!basePath) return pathname || "/";
|
|
14
|
-
if (pathname === basePath) return "/";
|
|
15
|
-
if (pathname.startsWith(`${basePath}/`)) return pathname.slice(basePath.length) || "/";
|
|
16
|
-
return pathname || "/";
|
|
17
|
-
}
|
|
18
|
-
function toRuntimePathname(pathname, runtimeBasePath) {
|
|
19
|
-
const basePath = normalizeRuntimeBasePath(runtimeBasePath);
|
|
20
|
-
const normalizedPathname = pathname.startsWith("/") ? pathname : `/${pathname}`;
|
|
21
|
-
if (!basePath) return normalizedPathname;
|
|
22
|
-
if (normalizedPathname === "/") return `${basePath}/`;
|
|
23
|
-
if (normalizedPathname.startsWith(`${basePath}/`)) return normalizedPathname;
|
|
24
|
-
return `${basePath}${normalizedPathname}`;
|
|
25
|
-
}
|
|
26
|
-
function getStudioLocation(runtimeBasePath) {
|
|
27
|
-
return {
|
|
28
|
-
hash: window.location.hash,
|
|
29
|
-
href: window.location.href,
|
|
30
|
-
pathname: normalizeRuntimePathname(window.location.pathname, runtimeBasePath),
|
|
31
|
-
search: window.location.search
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function getStudioTarget(to, runtimeBasePath) {
|
|
35
|
-
const url = new URL(to, window.location.href);
|
|
36
|
-
if (url.origin !== window.location.origin) return null;
|
|
37
|
-
url.pathname = toRuntimePathname(normalizeRuntimePathname(url.pathname, runtimeBasePath), runtimeBasePath);
|
|
38
|
-
return url;
|
|
39
|
-
}
|
|
40
|
-
function StudioNavigationProvider(t0) {
|
|
41
|
-
const $ = c(19);
|
|
42
|
-
if ($[0] !== "8131144acb7b9faccf5f5924d863b9186349bfc7c842e7feba7a3ac1e01ed910") {
|
|
43
|
-
for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
44
|
-
$[0] = "8131144acb7b9faccf5f5924d863b9186349bfc7c842e7feba7a3ac1e01ed910";
|
|
45
|
-
}
|
|
46
|
-
const { children, href, pathname, runtimeBasePath } = t0;
|
|
47
|
-
let t1;
|
|
48
|
-
if ($[1] !== runtimeBasePath) {
|
|
49
|
-
t1 = async (t2) => {
|
|
50
|
-
const { replace, to } = t2;
|
|
51
|
-
const target = getStudioTarget(to, runtimeBasePath);
|
|
52
|
-
if (!target) {
|
|
53
|
-
window.location.assign(to);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const currentPathname = normalizeRuntimePathname(window.location.pathname, runtimeBasePath);
|
|
57
|
-
if (normalizeRuntimePathname(target.pathname, runtimeBasePath) !== currentPathname) {
|
|
58
|
-
window.location.assign(target.href);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if (replace) window.history.replaceState(null, "", target.href);
|
|
62
|
-
else window.history.pushState(null, "", target.href);
|
|
63
|
-
window.dispatchEvent(new Event("camox:navigation"));
|
|
64
|
-
};
|
|
65
|
-
$[1] = runtimeBasePath;
|
|
66
|
-
$[2] = t1;
|
|
67
|
-
} else t1 = $[2];
|
|
68
|
-
const navigate = t1;
|
|
69
|
-
let t2;
|
|
70
|
-
if ($[3] !== runtimeBasePath) {
|
|
71
|
-
t2 = () => getStudioLocation(runtimeBasePath);
|
|
72
|
-
$[3] = runtimeBasePath;
|
|
73
|
-
$[4] = t2;
|
|
74
|
-
} else t2 = $[4];
|
|
75
|
-
const getLocation = t2;
|
|
76
|
-
let t3;
|
|
77
|
-
if ($[5] !== href) {
|
|
78
|
-
t3 = new URL(href);
|
|
79
|
-
$[5] = href;
|
|
80
|
-
$[6] = t3;
|
|
81
|
-
} else t3 = $[6];
|
|
82
|
-
let t4;
|
|
83
|
-
if ($[7] !== href) {
|
|
84
|
-
t4 = new URL(href);
|
|
85
|
-
$[7] = href;
|
|
86
|
-
$[8] = t4;
|
|
87
|
-
} else t4 = $[8];
|
|
88
|
-
let t5;
|
|
89
|
-
if ($[9] !== href || $[10] !== pathname || $[11] !== t3.hash || $[12] !== t4.search) {
|
|
90
|
-
t5 = {
|
|
91
|
-
hash: t3.hash,
|
|
92
|
-
href,
|
|
93
|
-
pathname,
|
|
94
|
-
search: t4.search
|
|
95
|
-
};
|
|
96
|
-
$[9] = href;
|
|
97
|
-
$[10] = pathname;
|
|
98
|
-
$[11] = t3.hash;
|
|
99
|
-
$[12] = t4.search;
|
|
100
|
-
$[13] = t5;
|
|
101
|
-
} else t5 = $[13];
|
|
102
|
-
let t6;
|
|
103
|
-
if ($[14] !== children || $[15] !== getLocation || $[16] !== navigate || $[17] !== t5) {
|
|
104
|
-
t6 = /* @__PURE__ */ jsx(NavigationProvider, {
|
|
105
|
-
getLocation,
|
|
106
|
-
initialLocation: t5,
|
|
107
|
-
navigate,
|
|
108
|
-
children
|
|
109
|
-
});
|
|
110
|
-
$[14] = children;
|
|
111
|
-
$[15] = getLocation;
|
|
112
|
-
$[16] = navigate;
|
|
113
|
-
$[17] = t5;
|
|
114
|
-
$[18] = t6;
|
|
115
|
-
} else t6 = $[18];
|
|
116
|
-
return t6;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
//#endregion
|
|
120
|
-
export { StudioNavigationProvider };
|