camox 0.41.1 → 0.43.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/components/lexical/{GradientNode.js → HighlightNode.js} +34 -34
- package/dist/core/components/lexical/InlineLexicalEditor.js +14 -14
- package/dist/core/components/lexical/InlineStylesPlugin.js +6 -6
- package/dist/core/components/lexical/SelectionBroadcaster.js +5 -5
- package/dist/core/components/lexical/SidebarLexicalEditor.js +52 -49
- package/dist/core/components/lexical/TextLinkPopover.js +191 -208
- package/dist/core/components/lexical/editorConfig.js +2 -2
- package/dist/core/createApp.d.ts +19 -4
- package/dist/core/createApp.js +2 -1
- package/dist/core/createLayout.d.ts +16 -3
- package/dist/core/createLayout.js +15 -15
- package/dist/core/derivedRoutes.js +1 -1
- package/dist/core/dom.d.ts +17 -0
- package/dist/core/dom.js +22 -0
- package/dist/core/editing/createEditableBlock.d.ts +8 -1
- package/dist/core/editing/createEditableBlock.js +636 -459
- package/dist/core/hooks/useOverlayState.js +11 -0
- package/dist/core/lib/fieldTypes.js +5 -5
- package/dist/core/lib/lexicalReact.js +4 -4
- package/dist/core/lib/lexicalState.js +20 -4
- package/dist/core/lib/modifierFormats.js +1 -1
- package/dist/core/lib/textLinks.js +5 -2
- package/dist/core/lib/textStyles.d.ts +2 -2
- package/dist/core/lib/textStyles.js +6 -11
- package/dist/core/pageDestinations.js +37 -0
- package/dist/features/og/imageResponse.node.js +11 -9
- package/dist/features/preview/CamoxPreview.js +108 -124
- package/dist/features/preview/commentsEnabled.js +8 -0
- package/dist/features/preview/components/AddBlockSidebar.js +80 -90
- package/dist/features/preview/components/AssetLightbox.js +4 -11
- package/dist/features/preview/components/AttachedComments.js +194 -0
- package/dist/features/preview/components/BlockActionsPopover.js +14 -65
- package/dist/features/preview/components/CommentHeader.js +122 -0
- package/dist/features/preview/components/CommentSidebar.js +29 -0
- package/dist/features/preview/components/CommentTargetQuote.js +166 -0
- package/dist/features/preview/components/CreatePageModal.js +4 -10
- package/dist/features/preview/components/DerivedLayoutSidebar.js +45 -26
- package/dist/features/preview/components/DerivedPageInfoSidebar.js +38 -26
- package/dist/features/preview/components/FieldToolbar.js +7 -7
- package/dist/features/preview/components/ItemFieldsEditor.js +275 -204
- package/dist/features/preview/components/LeftSidebar.js +18 -18
- package/dist/features/preview/components/LinkFieldEditor.js +212 -209
- package/dist/features/preview/components/OverlayTracker.js +14 -20
- package/dist/features/preview/components/Overlays.js +26 -35
- package/dist/features/preview/components/PageEditorSidebar.js +90 -91
- package/dist/features/preview/components/PageInfoSidebar.js +128 -159
- package/dist/features/preview/components/PagePicker.js +29 -24
- package/dist/features/preview/components/PageTree.js +159 -157
- package/dist/features/preview/components/PreviewComments.js +56 -0
- package/dist/features/preview/components/PreviewPanel.js +122 -78
- package/dist/features/preview/components/PreviewToolbar.js +280 -231
- package/dist/features/preview/components/PublicationRow.js +8 -11
- package/dist/features/preview/components/RightSidebar.js +14 -11
- package/dist/features/preview/components/SidebarSection.js +121 -0
- package/dist/features/preview/components/useRepeatableItemActions.js +1 -1
- package/dist/features/preview/previewCommentsStore.js +115 -0
- package/dist/features/preview/previewSelection.js +75 -0
- package/dist/features/preview/previewStore.js +19 -39
- package/dist/features/preview/publication.js +10 -0
- package/dist/features/provider/AuthenticatedCamoxProvider.js +46 -34
- package/dist/features/provider/CoreCamoxProvider.js +1 -1
- package/dist/features/provider/components/CommandPalette.js +142 -58
- package/dist/features/provider/useAdminShortcuts.js +19 -8
- package/dist/features/routes/pageRuntime.js +0 -6
- package/dist/features/runtime/RuntimeChrome.js +40 -37
- package/dist/features/runtime/runtime.js +20 -21
- package/dist/features/studio/CamoxStudio.js +30 -50
- package/dist/features/studio/components/EnvironmentMenu.js +3 -2
- package/dist/features/studio/components/Navbar.js +53 -80
- package/dist/features/vite/layoutGeneration.js +7 -3
- package/dist/features/vite/runtimeDev.js +4 -1
- package/dist/features/vite/vite.d.ts +3 -2
- package/dist/features/vite/vite.js +14 -6
- package/dist/hooks/use-file-upload.js +0 -2
- package/dist/hooks/use-page-destinations.js +53 -0
- package/dist/lib/auth.js +11 -14
- package/dist/lib/server-auth-cookie.js +21 -0
- package/dist/studio.css +1 -1
- package/package.json +9 -7
- package/skills/camox/SKILL.md +32 -9
- package/skills/camox/references/block-definitions.md +84 -290
- package/skills/camox/references/cli-common.md +2 -4
- package/skills/camox/references/cli-content.md +147 -0
- package/skills/camox/references/cli-environments.md +1 -1
- package/skills/camox/references/dom-integrations.md +93 -0
- package/skills/camox/references/field-styling.md +50 -0
- package/skills/camox/references/layout-definitions.md +33 -147
- package/skills/camox/references/routed-layouts.md +71 -0
- package/skills/camoxify/SKILL.md +52 -0
- package/dist/lib/telemetry-client.js +0 -66
- package/dist/lib/telemetry.js +0 -26
- package/skills/camox/references/cli-blocks.md +0 -78
- package/skills/camox/references/cli-pages.md +0 -53
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/core/hooks/useOverlayState.ts
|
|
2
|
+
/** Native and sidebar hover use the same overlay attributes in every editing mode. */
|
|
3
|
+
function useOverlayState(hovered, focused = false) {
|
|
4
|
+
return {
|
|
5
|
+
"data-camox-hovered": hovered || void 0,
|
|
6
|
+
"data-camox-focused": focused || void 0
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { useOverlayState };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
//#region src/core/lib/fieldTypes.tsx
|
|
2
2
|
const fieldTypesDictionary = {
|
|
3
|
-
String: { hasOwnView:
|
|
4
|
-
Repeater: { hasOwnView:
|
|
5
|
-
Enum: { hasOwnView:
|
|
6
|
-
Boolean: { hasOwnView:
|
|
7
|
-
Embed: { hasOwnView:
|
|
3
|
+
String: { hasOwnView: true },
|
|
4
|
+
Repeater: { hasOwnView: true },
|
|
5
|
+
Enum: { hasOwnView: true },
|
|
6
|
+
Boolean: { hasOwnView: true },
|
|
7
|
+
Embed: { hasOwnView: true },
|
|
8
8
|
Link: { hasOwnView: true },
|
|
9
9
|
Image: { hasOwnView: true },
|
|
10
10
|
File: { hasOwnView: true },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FORMAT_FLAGS } from "./modifierFormats.js";
|
|
2
2
|
import { getPageIdFromTextLinkTarget, isHttpTextLinkTarget, resolveTextLinkHref, shouldOpenTextLinkInNewTab } from "./textLinks.js";
|
|
3
3
|
import { isLexicalState, markdownToLexicalState } from "./lexicalState.js";
|
|
4
|
-
import {
|
|
4
|
+
import { getHighlightStyle, getTextAppearance } from "./textStyles.js";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
|
|
@@ -23,9 +23,9 @@ function markdownToReactNodes(value, options = {}) {
|
|
|
23
23
|
}
|
|
24
24
|
if (node.type === "linebreak") return /* @__PURE__ */ jsx("br", {}, key);
|
|
25
25
|
const children = (node.children ?? []).map(render);
|
|
26
|
-
if (node.type === "
|
|
27
|
-
"data-camox-
|
|
28
|
-
...
|
|
26
|
+
if (node.type === "highlight") return /* @__PURE__ */ jsx("span", {
|
|
27
|
+
"data-camox-highlight": "",
|
|
28
|
+
...getHighlightStyle(options),
|
|
29
29
|
children
|
|
30
30
|
}, key);
|
|
31
31
|
if (node.type === "link") {
|
|
@@ -12,6 +12,22 @@ function isLexicalState(value) {
|
|
|
12
12
|
return false;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
function lexicalStateToPlainText(serialized) {
|
|
16
|
+
try {
|
|
17
|
+
return extractText((typeof serialized === "object" ? serialized : JSON.parse(serialized)).root);
|
|
18
|
+
} catch {
|
|
19
|
+
return typeof serialized === "string" ? serialized : "";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function extractText(node) {
|
|
23
|
+
if (node.type === "text") return node.text ?? "";
|
|
24
|
+
if (node.type === "linebreak") return "\n";
|
|
25
|
+
if (!node.children) return "";
|
|
26
|
+
const parts = [];
|
|
27
|
+
for (const child of node.children) parts.push(extractText(child));
|
|
28
|
+
if (node.type === "paragraph" || node.type === "inline-paragraph" || node.type === "heading") return parts.join("");
|
|
29
|
+
return parts.join(node.type === "root" ? "\n\n" : "");
|
|
30
|
+
}
|
|
15
31
|
function lexicalStateToMarkdown(serialized) {
|
|
16
32
|
try {
|
|
17
33
|
return extractMarkdown((typeof serialized === "object" ? serialized : JSON.parse(serialized)).root);
|
|
@@ -20,7 +36,7 @@ function lexicalStateToMarkdown(serialized) {
|
|
|
20
36
|
}
|
|
21
37
|
}
|
|
22
38
|
function extractMarkdownFromNode(node) {
|
|
23
|
-
if (node.type === "
|
|
39
|
+
if (node.type === "highlight") return `<highlight>${serializeInlineChildren(node.children ?? [])}</highlight>`;
|
|
24
40
|
if (node.type === "link") {
|
|
25
41
|
const text = serializeInlineChildren(node.children ?? []);
|
|
26
42
|
const url = typeof node.url === "string" ? node.url : "";
|
|
@@ -188,7 +204,7 @@ function parseTokens(tokens, format) {
|
|
|
188
204
|
else nodes.push(...children);
|
|
189
205
|
continue;
|
|
190
206
|
}
|
|
191
|
-
const tag = token.type === "html" ? /^<(
|
|
207
|
+
const tag = token.type === "html" ? /^<(highlight|u|strong|em)>$/.exec(token.raw)?.[1] : void 0;
|
|
192
208
|
if (tag) {
|
|
193
209
|
let depth = 1;
|
|
194
210
|
let end = i + 1;
|
|
@@ -205,7 +221,7 @@ function parseTokens(tokens, format) {
|
|
|
205
221
|
em: FORMAT_FLAGS.italic
|
|
206
222
|
};
|
|
207
223
|
const children = parseTokens(tokens.slice(i + 1, end), format | (tagFlags[tag] ?? 0));
|
|
208
|
-
if (tag === "
|
|
224
|
+
if (tag === "highlight") nodes.push(inlineElement("highlight", children));
|
|
209
225
|
else nodes.push(...children);
|
|
210
226
|
i = end;
|
|
211
227
|
continue;
|
|
@@ -224,4 +240,4 @@ function parseTokens(tokens, format) {
|
|
|
224
240
|
}
|
|
225
241
|
|
|
226
242
|
//#endregion
|
|
227
|
-
export { isLexicalState, lexicalStateToMarkdown, markdownToLexicalState };
|
|
243
|
+
export { isLexicalState, lexicalStateToMarkdown, lexicalStateToPlainText, markdownToLexicalState };
|
|
@@ -12,12 +12,15 @@ function createPageTextLinkTarget(pageId) {
|
|
|
12
12
|
function isHttpTextLinkTarget(target) {
|
|
13
13
|
return /^https?:\/\//i.test(target);
|
|
14
14
|
}
|
|
15
|
+
function isInternalTextLinkTarget(target) {
|
|
16
|
+
return /^\/(?!\/)[^\s\\\p{Cc}]*$/u.test(target);
|
|
17
|
+
}
|
|
15
18
|
function isValidTextLinkTarget(target) {
|
|
16
|
-
return getPageIdFromTextLinkTarget(target) != null || isHttpTextLinkTarget(target);
|
|
19
|
+
return getPageIdFromTextLinkTarget(target) != null || isHttpTextLinkTarget(target) || isInternalTextLinkTarget(target);
|
|
17
20
|
}
|
|
18
21
|
function resolveTextLinkHref(target, pages, fallbackHref) {
|
|
19
22
|
const pageId = getPageIdFromTextLinkTarget(target);
|
|
20
|
-
if (pageId == null) return
|
|
23
|
+
if (pageId == null) return isValidTextLinkTarget(target) ? target : null;
|
|
21
24
|
return (pages?.find((p) => String(p.id) === pageId))?.fullPath ?? fallbackHref;
|
|
22
25
|
}
|
|
23
26
|
function shouldOpenTextLinkInNewTab(target) {
|
|
@@ -6,8 +6,8 @@ interface InlineStyle {
|
|
|
6
6
|
style?: CSSProperties;
|
|
7
7
|
}
|
|
8
8
|
interface TextStyleData {
|
|
9
|
-
/** True when styling the shared
|
|
10
|
-
|
|
9
|
+
/** True when styling the shared highlight wrapper. Other flags are false for this call. */
|
|
10
|
+
highlight: boolean;
|
|
11
11
|
bold: boolean;
|
|
12
12
|
italic: boolean;
|
|
13
13
|
underline: boolean;
|
|
@@ -3,7 +3,7 @@ import { FORMAT_FLAGS } from "./modifierFormats.js";
|
|
|
3
3
|
//#region src/core/lib/textStyles.ts
|
|
4
4
|
function getTextStyleData(format) {
|
|
5
5
|
return {
|
|
6
|
-
|
|
6
|
+
highlight: false,
|
|
7
7
|
bold: !!(format & FORMAT_FLAGS.bold),
|
|
8
8
|
italic: !!(format & FORMAT_FLAGS.italic),
|
|
9
9
|
underline: !!(format & FORMAT_FLAGS.underline)
|
|
@@ -21,15 +21,10 @@ function getTextAppearance(format, styles) {
|
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
backgroundClip: "text",
|
|
27
|
-
WebkitBackgroundClip: "text",
|
|
28
|
-
WebkitTextFillColor: "transparent"
|
|
29
|
-
};
|
|
30
|
-
function getGradientStyle(styles) {
|
|
24
|
+
const defaultHighlightStyle = { color: "var(--primary, currentColor)" };
|
|
25
|
+
function getHighlightStyle(styles) {
|
|
31
26
|
const custom = styles.textStyle?.({
|
|
32
|
-
|
|
27
|
+
highlight: true,
|
|
33
28
|
bold: false,
|
|
34
29
|
italic: false,
|
|
35
30
|
underline: false
|
|
@@ -37,11 +32,11 @@ function getGradientStyle(styles) {
|
|
|
37
32
|
return {
|
|
38
33
|
className: custom?.className,
|
|
39
34
|
style: {
|
|
40
|
-
...
|
|
35
|
+
...defaultHighlightStyle,
|
|
41
36
|
...custom?.style
|
|
42
37
|
}
|
|
43
38
|
};
|
|
44
39
|
}
|
|
45
40
|
|
|
46
41
|
//#endregion
|
|
47
|
-
export {
|
|
42
|
+
export { getHighlightStyle, getTextAppearance };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createPageTextLinkTarget } from "./lib/textLinks.js";
|
|
2
|
+
|
|
3
|
+
//#region src/core/pageDestinations.ts
|
|
4
|
+
/** Concrete navigable pages, not records that can all be mutated through pages.*. */
|
|
5
|
+
function getPageDestinations(pages, layouts) {
|
|
6
|
+
return [...pages.map((page) => ({
|
|
7
|
+
key: `page:${page.id}`,
|
|
8
|
+
kind: "curated",
|
|
9
|
+
pageId: page.id,
|
|
10
|
+
title: page.nickname,
|
|
11
|
+
fullPath: page.fullPath
|
|
12
|
+
})), ...layouts.filter((layout) => layout._internal.kind === "singleton").map(({ _internal: layout }) => ({
|
|
13
|
+
key: `singleton:${layout.id}`,
|
|
14
|
+
kind: "singleton",
|
|
15
|
+
layoutId: layout.id,
|
|
16
|
+
title: layout.title,
|
|
17
|
+
fullPath: `/${layout.id.split(".").map(encodeURIComponent).join("/")}`
|
|
18
|
+
}))];
|
|
19
|
+
}
|
|
20
|
+
/** Singleton links are ordinary internal URLs, never synthetic database page IDs. */
|
|
21
|
+
function destinationLink(destination) {
|
|
22
|
+
if (destination.kind === "curated") return {
|
|
23
|
+
type: "page",
|
|
24
|
+
pageId: String(destination.pageId)
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
type: "external",
|
|
28
|
+
href: destination.fullPath
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function destinationTextLink(destination) {
|
|
32
|
+
if (destination.kind === "curated") return createPageTextLinkTarget(destination.pageId);
|
|
33
|
+
return destination.fullPath;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { destinationLink, destinationTextLink, getPageDestinations };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_FONTS } from "./defaultFonts.js";
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
4
2
|
import { ImageResponse as ImageResponse$1 } from "@takumi-rs/image-response/wasm";
|
|
3
|
+
import wasmModule from "@takumi-rs/wasm/next";
|
|
5
4
|
import { Renderer, initSync } from "@takumi-rs/wasm/no-bundler";
|
|
6
5
|
|
|
7
6
|
//#region src/features/og/imageResponse.node.ts
|
|
@@ -14,12 +13,10 @@ import { Renderer, initSync } from "@takumi-rs/wasm/no-bundler";
|
|
|
14
13
|
* about which engine to use any more — it's only about *how* the wasm module
|
|
15
14
|
* gets loaded:
|
|
16
15
|
*
|
|
17
|
-
* - Here, we
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* once the package is externalised by Nitro/Vite — so we go through the
|
|
22
|
-
* `no-bundler` entry directly.
|
|
16
|
+
* - Here, we import the wasm module and `initSync` it ourselves before
|
|
17
|
+
* constructing a `Renderer`. The static `?module` import lets Nitro emit
|
|
18
|
+
* the asset into the deployment instead of relying on a runtime
|
|
19
|
+
* `require.resolve` that dependency tracing cannot reliably discover.
|
|
23
20
|
*
|
|
24
21
|
* - In `imageResponse.workerd.ts` there's no filesystem; instead we pass a
|
|
25
22
|
* `WebAssembly.Module` reference via `?module` import and let the
|
|
@@ -28,7 +25,12 @@ import { Renderer, initSync } from "@takumi-rs/wasm/no-bundler";
|
|
|
28
25
|
* We use the BYO-renderer path of `@takumi-rs/image-response/wasm` so the
|
|
29
26
|
* `module:` option isn't needed here — the renderer is already alive.
|
|
30
27
|
*/
|
|
31
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Resolve and initialise the wasm module once at module load. `initSync`
|
|
30
|
+
* compiles the wasm and wires up the JS bindings; subsequent `new Renderer()`
|
|
31
|
+
* calls are cheap.
|
|
32
|
+
*/
|
|
33
|
+
initSync({ module: wasmModule });
|
|
32
34
|
/**
|
|
33
35
|
* Module-scoped singleton — building the renderer compiles the wasm module
|
|
34
36
|
* and loads Geist; not free, and there's no reason to do it per request.
|
|
@@ -4,9 +4,10 @@ import { useIsAuthenticated, useProjectSlug } from "../../lib/auth.js";
|
|
|
4
4
|
import { getApiClient } from "../../lib/api-client.js";
|
|
5
5
|
import { NormalizedDataProvider, seedBlockCaches, usePageBlocks } from "../../lib/normalized-data.js";
|
|
6
6
|
import { BlockErrorBoundary } from "./components/BlockErrorBoundary.js";
|
|
7
|
-
import { blockQueries, pageQueries, projectQueries } from "../../lib/queries.js";
|
|
8
|
-
import { cn } from "../../lib/utils.js";
|
|
9
7
|
import { useCamoxApp } from "../provider/components/CamoxAppContext.js";
|
|
8
|
+
import { blockQueries } from "../../lib/queries.js";
|
|
9
|
+
import { usePageDestinations } from "../../hooks/use-page-destinations.js";
|
|
10
|
+
import { cn } from "../../lib/utils.js";
|
|
10
11
|
import { SharedChromeContext } from "../runtime/SharedChromeContext.js";
|
|
11
12
|
import { previewStore, selectIsEditMode, selectPreviewSource } from "./previewStore.js";
|
|
12
13
|
import { Navbar } from "../studio/components/Navbar.js";
|
|
@@ -18,7 +19,7 @@ import { PreviewPanel } from "./components/PreviewPanel.js";
|
|
|
18
19
|
import { PreviewToolbarSpacer } from "./components/PreviewToolbarSpacer.js";
|
|
19
20
|
import { RightSidebar } from "./components/RightSidebar.js";
|
|
20
21
|
import { c } from "react/compiler-runtime";
|
|
21
|
-
import {
|
|
22
|
+
import { useQueryClient, useSuspenseQuery } from "@tanstack/react-query";
|
|
22
23
|
import * as React from "react";
|
|
23
24
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
24
25
|
import { useSelector } from "@xstate/store-react";
|
|
@@ -36,9 +37,9 @@ function getMobileStudioSnapshot() {
|
|
|
36
37
|
}
|
|
37
38
|
function useIsMobileStudio() {
|
|
38
39
|
const $ = c(1);
|
|
39
|
-
if ($[0] !== "
|
|
40
|
+
if ($[0] !== "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082") {
|
|
40
41
|
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
41
|
-
$[0] = "
|
|
42
|
+
$[0] = "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082";
|
|
42
43
|
}
|
|
43
44
|
return React.useSyncExternalStore(subscribeToMobileStudio, getMobileStudioSnapshot, _temp);
|
|
44
45
|
}
|
|
@@ -71,9 +72,9 @@ function pageStructureQueryFn(path, projectSlug, source) {
|
|
|
71
72
|
}
|
|
72
73
|
function usePreviewedPage() {
|
|
73
74
|
const $ = c(11);
|
|
74
|
-
if ($[0] !== "
|
|
75
|
+
if ($[0] !== "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082") {
|
|
75
76
|
for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
76
|
-
$[0] = "
|
|
77
|
+
$[0] = "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082";
|
|
77
78
|
}
|
|
78
79
|
const { pathname } = useLocation();
|
|
79
80
|
const projectSlug = useProjectSlug();
|
|
@@ -109,9 +110,9 @@ function usePreviewedPage() {
|
|
|
109
110
|
}
|
|
110
111
|
const BlockRenderer = (t0) => {
|
|
111
112
|
const $ = c(23);
|
|
112
|
-
if ($[0] !== "
|
|
113
|
+
if ($[0] !== "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082") {
|
|
113
114
|
for (let $i = 0; $i < 23; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
114
|
-
$[0] = "
|
|
115
|
+
$[0] = "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082";
|
|
115
116
|
}
|
|
116
117
|
const { blockId, mode, showAddBlockTop, showAddBlockBottom } = t0;
|
|
117
118
|
const previewSource = useSelector(previewStore, selectPreviewSource);
|
|
@@ -254,9 +255,9 @@ const PageContent = () => {
|
|
|
254
255
|
};
|
|
255
256
|
function useHydrateDraftCache() {
|
|
256
257
|
const $ = c(7);
|
|
257
|
-
if ($[0] !== "
|
|
258
|
+
if ($[0] !== "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082") {
|
|
258
259
|
for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
259
|
-
$[0] = "
|
|
260
|
+
$[0] = "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082";
|
|
260
261
|
}
|
|
261
262
|
const isAuthenticated = useIsAuthenticated();
|
|
262
263
|
const queryClient = useQueryClient();
|
|
@@ -307,9 +308,9 @@ function useHydrateDraftCache() {
|
|
|
307
308
|
function _temp2() {}
|
|
308
309
|
const CamoxPreview = (t0) => {
|
|
309
310
|
const $ = c(4);
|
|
310
|
-
if ($[0] !== "
|
|
311
|
+
if ($[0] !== "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082") {
|
|
311
312
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
312
|
-
$[0] = "
|
|
313
|
+
$[0] = "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082";
|
|
313
314
|
}
|
|
314
315
|
const { children } = t0;
|
|
315
316
|
const pageData = usePreviewedPage();
|
|
@@ -328,10 +329,10 @@ const CamoxPreview = (t0) => {
|
|
|
328
329
|
};
|
|
329
330
|
/** Studio chrome is shared; only curated previews require a Camox page record. */
|
|
330
331
|
const PreviewShell = (t0) => {
|
|
331
|
-
const $ = c(
|
|
332
|
-
if ($[0] !== "
|
|
333
|
-
for (let $i = 0; $i <
|
|
334
|
-
$[0] = "
|
|
332
|
+
const $ = c(59);
|
|
333
|
+
if ($[0] !== "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082") {
|
|
334
|
+
for (let $i = 0; $i < 59; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
335
|
+
$[0] = "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082";
|
|
335
336
|
}
|
|
336
337
|
const { children, pageData, hasLiveVersion: t1, derivedLayoutId, derivedLayout } = t0;
|
|
337
338
|
const hasLiveVersion = t1 === void 0 ? false : t1;
|
|
@@ -517,132 +518,110 @@ const PreviewShell = (t0) => {
|
|
|
517
518
|
} else t10 = $[27];
|
|
518
519
|
const t11 = pageData?.page;
|
|
519
520
|
const t12 = pageData?.projectName;
|
|
520
|
-
const t13 = pageData?.page.
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
521
|
+
const t13 = pageData?.page.id;
|
|
522
|
+
const t14 = pageData?.page.status;
|
|
523
|
+
let t15;
|
|
524
|
+
if ($[28] !== hasLiveCheckpoint || $[29] !== t13 || $[30] !== t14) {
|
|
525
|
+
t15 = {
|
|
526
|
+
pageId: t13,
|
|
527
|
+
pageStatus: t14,
|
|
525
528
|
hasLiveVersion: hasLiveCheckpoint
|
|
526
529
|
};
|
|
527
530
|
$[28] = hasLiveCheckpoint;
|
|
528
531
|
$[29] = t13;
|
|
529
532
|
$[30] = t14;
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
if ($[31] !== isEditMode || $[32] !== isMobileStudio) {
|
|
533
|
-
t15 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx(PreviewToolbarSpacer, {});
|
|
534
|
-
$[31] = isEditMode;
|
|
535
|
-
$[32] = isMobileStudio;
|
|
536
|
-
$[33] = t15;
|
|
537
|
-
} else t15 = $[33];
|
|
533
|
+
$[31] = t15;
|
|
534
|
+
} else t15 = $[31];
|
|
538
535
|
let t16;
|
|
539
|
-
if ($[
|
|
540
|
-
t16 = /* @__PURE__ */
|
|
536
|
+
if ($[32] !== isEditMode || $[33] !== isMobileStudio) {
|
|
537
|
+
t16 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx(PreviewToolbarSpacer, {});
|
|
538
|
+
$[32] = isEditMode;
|
|
539
|
+
$[33] = isMobileStudio;
|
|
540
|
+
$[34] = t16;
|
|
541
|
+
} else t16 = $[34];
|
|
542
|
+
let t17;
|
|
543
|
+
if ($[35] !== children || $[36] !== isMobileStudio || $[37] !== t11 || $[38] !== t12 || $[39] !== t15 || $[40] !== t16) {
|
|
544
|
+
t17 = /* @__PURE__ */ jsxs(PreviewPanel, {
|
|
541
545
|
isMobileExperience: isMobileStudio,
|
|
542
546
|
page: t11,
|
|
543
547
|
projectName: t12,
|
|
544
|
-
toolbarProps:
|
|
545
|
-
children: [children,
|
|
548
|
+
toolbarProps: t15,
|
|
549
|
+
children: [children, t16]
|
|
546
550
|
});
|
|
547
|
-
$[
|
|
548
|
-
$[
|
|
549
|
-
$[
|
|
550
|
-
$[
|
|
551
|
-
$[38] = t14;
|
|
551
|
+
$[35] = children;
|
|
552
|
+
$[36] = isMobileStudio;
|
|
553
|
+
$[37] = t11;
|
|
554
|
+
$[38] = t12;
|
|
552
555
|
$[39] = t15;
|
|
553
556
|
$[40] = t16;
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
557
|
+
$[41] = t17;
|
|
558
|
+
} else t17 = $[41];
|
|
559
|
+
let t18;
|
|
560
|
+
if ($[42] !== derivedLayoutId || $[43] !== isEditMode || $[44] !== isMobileStudio || $[45] !== pageData?.page) {
|
|
561
|
+
t18 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx(RightSidebar, {
|
|
558
562
|
pageId: pageData?.page.id,
|
|
559
563
|
derivedLayoutId
|
|
560
564
|
});
|
|
561
|
-
$[
|
|
562
|
-
$[
|
|
563
|
-
$[
|
|
564
|
-
$[
|
|
565
|
-
$[
|
|
566
|
-
} else
|
|
567
|
-
let
|
|
568
|
-
if ($[
|
|
569
|
-
|
|
565
|
+
$[42] = derivedLayoutId;
|
|
566
|
+
$[43] = isEditMode;
|
|
567
|
+
$[44] = isMobileStudio;
|
|
568
|
+
$[45] = pageData?.page;
|
|
569
|
+
$[46] = t18;
|
|
570
|
+
} else t18 = $[46];
|
|
571
|
+
let t19;
|
|
572
|
+
if ($[47] !== t10 || $[48] !== t17 || $[49] !== t18) {
|
|
573
|
+
t19 = /* @__PURE__ */ jsxs("div", {
|
|
570
574
|
className: "flex h-full flex-row items-stretch",
|
|
571
575
|
children: [
|
|
572
576
|
t10,
|
|
573
|
-
|
|
574
|
-
|
|
577
|
+
t17,
|
|
578
|
+
t18
|
|
575
579
|
]
|
|
576
580
|
});
|
|
577
|
-
$[
|
|
578
|
-
$[47] = t16;
|
|
581
|
+
$[47] = t10;
|
|
579
582
|
$[48] = t17;
|
|
580
583
|
$[49] = t18;
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
if ($[50] !== isEditMode || $[51] !== isMobileStudio) {
|
|
584
|
-
t19 = (isMobileStudio || isEditMode) && /* @__PURE__ */ jsx(CreatePageModal, {});
|
|
585
|
-
$[50] = isEditMode;
|
|
586
|
-
$[51] = isMobileStudio;
|
|
587
|
-
$[52] = t19;
|
|
588
|
-
} else t19 = $[52];
|
|
584
|
+
$[50] = t19;
|
|
585
|
+
} else t19 = $[50];
|
|
589
586
|
let t20;
|
|
590
|
-
if ($[
|
|
591
|
-
t20 = /* @__PURE__ */
|
|
587
|
+
if ($[51] !== isEditMode || $[52] !== isMobileStudio) {
|
|
588
|
+
t20 = (isMobileStudio || isEditMode) && /* @__PURE__ */ jsx(CreatePageModal, {});
|
|
589
|
+
$[51] = isEditMode;
|
|
590
|
+
$[52] = isMobileStudio;
|
|
591
|
+
$[53] = t20;
|
|
592
|
+
} else t20 = $[53];
|
|
593
|
+
let t21;
|
|
594
|
+
if ($[54] !== t19 || $[55] !== t20 || $[56] !== t8 || $[57] !== t9) {
|
|
595
|
+
t21 = /* @__PURE__ */ jsxs("div", {
|
|
592
596
|
className: t8,
|
|
593
597
|
children: [
|
|
594
598
|
t9,
|
|
595
|
-
|
|
596
|
-
|
|
599
|
+
t19,
|
|
600
|
+
t20
|
|
597
601
|
]
|
|
598
602
|
});
|
|
599
|
-
$[53] = t18;
|
|
600
603
|
$[54] = t19;
|
|
601
|
-
$[55] =
|
|
602
|
-
$[56] =
|
|
603
|
-
$[57] =
|
|
604
|
-
|
|
605
|
-
|
|
604
|
+
$[55] = t20;
|
|
605
|
+
$[56] = t8;
|
|
606
|
+
$[57] = t9;
|
|
607
|
+
$[58] = t21;
|
|
608
|
+
} else t21 = $[58];
|
|
609
|
+
return t21;
|
|
606
610
|
};
|
|
607
611
|
function usePreviewPagesActions() {
|
|
608
|
-
const $ = c(
|
|
609
|
-
if ($[0] !== "
|
|
610
|
-
for (let $i = 0; $i <
|
|
611
|
-
$[0] = "
|
|
612
|
+
const $ = c(6);
|
|
613
|
+
if ($[0] !== "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082") {
|
|
614
|
+
for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
615
|
+
$[0] = "2d1a4df08feec350ec60cc84fec5c50c421655f0e335816baf3bbe36ccd11082";
|
|
612
616
|
}
|
|
613
617
|
const navigate = useNavigate();
|
|
614
618
|
const { pathname } = useLocation();
|
|
615
|
-
const
|
|
619
|
+
const pages = usePageDestinations();
|
|
616
620
|
let t0;
|
|
617
|
-
if ($[1] !== projectSlug) {
|
|
618
|
-
t0 = projectQueries.getBySlug(projectSlug);
|
|
619
|
-
$[1] = projectSlug;
|
|
620
|
-
$[2] = t0;
|
|
621
|
-
} else t0 = $[2];
|
|
622
|
-
const { data: project } = useQuery(t0);
|
|
623
621
|
let t1;
|
|
624
|
-
if ($[3] !==
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
$[4] = t1;
|
|
628
|
-
} else t1 = $[4];
|
|
629
|
-
const t2 = !!project;
|
|
630
|
-
let t3;
|
|
631
|
-
if ($[5] !== t1 || $[6] !== t2) {
|
|
632
|
-
t3 = {
|
|
633
|
-
...t1,
|
|
634
|
-
enabled: t2
|
|
635
|
-
};
|
|
636
|
-
$[5] = t1;
|
|
637
|
-
$[6] = t2;
|
|
638
|
-
$[7] = t3;
|
|
639
|
-
} else t3 = $[7];
|
|
640
|
-
const { data: pages } = useQuery(t3);
|
|
641
|
-
let t4;
|
|
642
|
-
let t5;
|
|
643
|
-
if ($[8] !== navigate || $[9] !== pages || $[10] !== pathname) {
|
|
644
|
-
t4 = () => {
|
|
645
|
-
const currentPage = pages?.find((p) => p.fullPath === pathname);
|
|
622
|
+
if ($[1] !== navigate || $[2] !== pages || $[3] !== pathname) {
|
|
623
|
+
t0 = () => {
|
|
624
|
+
const currentPage = pages.find((p) => p.kind === "curated" && p.fullPath === pathname);
|
|
646
625
|
const actions = [
|
|
647
626
|
{
|
|
648
627
|
id: "create-page",
|
|
@@ -661,12 +640,12 @@ function usePreviewPagesActions() {
|
|
|
661
640
|
"Page metadata"
|
|
662
641
|
],
|
|
663
642
|
groupLabel: "Preview",
|
|
664
|
-
checkIfAvailable: () =>
|
|
643
|
+
checkIfAvailable: () => currentPage?.kind === "curated",
|
|
665
644
|
execute: () => {
|
|
666
|
-
if (
|
|
645
|
+
if (currentPage?.kind !== "curated") return;
|
|
667
646
|
previewStore.send({
|
|
668
647
|
type: "openEditPageModal",
|
|
669
|
-
pageId: currentPage.
|
|
648
|
+
pageId: currentPage.pageId
|
|
670
649
|
});
|
|
671
650
|
}
|
|
672
651
|
},
|
|
@@ -679,18 +658,19 @@ function usePreviewPagesActions() {
|
|
|
679
658
|
"Switch page"
|
|
680
659
|
],
|
|
681
660
|
groupLabel: "Preview",
|
|
682
|
-
checkIfAvailable: () =>
|
|
661
|
+
checkIfAvailable: () => pages.length > 0,
|
|
683
662
|
hasChildren: true,
|
|
684
663
|
execute: _temp13
|
|
685
664
|
},
|
|
686
|
-
...pages
|
|
687
|
-
id: `go-to-page-${page.
|
|
665
|
+
...pages.map((page) => ({
|
|
666
|
+
id: `go-to-page-${page.key}`,
|
|
688
667
|
parentActionId: "go-to-page",
|
|
689
|
-
label: `Go to "${page.
|
|
668
|
+
label: `Go to "${page.title}"`,
|
|
669
|
+
aliases: [page.fullPath],
|
|
690
670
|
groupLabel: "Preview",
|
|
691
671
|
checkIfAvailable: _temp14,
|
|
692
672
|
execute: () => navigate({ to: page.fullPath })
|
|
693
|
-
}))
|
|
673
|
+
}))
|
|
694
674
|
];
|
|
695
675
|
actionsStore.send({
|
|
696
676
|
type: "registerManyActions",
|
|
@@ -703,21 +683,21 @@ function usePreviewPagesActions() {
|
|
|
703
683
|
});
|
|
704
684
|
};
|
|
705
685
|
};
|
|
706
|
-
|
|
686
|
+
t1 = [
|
|
707
687
|
navigate,
|
|
708
688
|
pages,
|
|
709
689
|
pathname
|
|
710
690
|
];
|
|
711
|
-
$[
|
|
712
|
-
$[
|
|
713
|
-
$[
|
|
714
|
-
$[
|
|
715
|
-
$[
|
|
691
|
+
$[1] = navigate;
|
|
692
|
+
$[2] = pages;
|
|
693
|
+
$[3] = pathname;
|
|
694
|
+
$[4] = t0;
|
|
695
|
+
$[5] = t1;
|
|
716
696
|
} else {
|
|
717
|
-
|
|
718
|
-
|
|
697
|
+
t0 = $[4];
|
|
698
|
+
t1 = $[5];
|
|
719
699
|
}
|
|
720
|
-
React.useEffect(
|
|
700
|
+
React.useEffect(t0, t1);
|
|
721
701
|
}
|
|
722
702
|
function _temp15(a) {
|
|
723
703
|
return a.id;
|
|
@@ -754,6 +734,10 @@ function _temp9() {
|
|
|
754
734
|
return true;
|
|
755
735
|
}
|
|
756
736
|
function _temp0() {
|
|
737
|
+
previewStore.send({
|
|
738
|
+
type: "setCommentMode",
|
|
739
|
+
enabled: false
|
|
740
|
+
});
|
|
757
741
|
previewStore.send({ type: "clearSelection" });
|
|
758
742
|
}
|
|
759
743
|
function _temp1(a) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/features/preview/commentsEnabled.ts
|
|
2
|
+
/** Opt-in prototype flag, replaced by the Camox Vite plugin in both client and SSR builds. */
|
|
3
|
+
function areCommentsEnabled() {
|
|
4
|
+
return typeof __CAMOX_ENABLE_COMMENTS__ !== "undefined" && __CAMOX_ENABLE_COMMENTS__;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { areCommentsEnabled };
|