camox 0.58.0 → 0.59.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/createApp.d.ts +2 -2
- package/dist/core/createBlock.js +1 -1
- package/dist/core/createLayout.d.ts +1 -1
- package/dist/core/editing/createEditableBlock.d.ts +1 -1
- package/dist/core/editing/createEditableBlock.js +1 -1
- package/dist/core/lib/recordScope.js +1 -1
- package/dist/features/canvas/CamoxCanvas.js +2 -2
- package/dist/features/canvas/CanvasOverlays.js +1 -1
- package/dist/features/canvas/sidebar/LayoutPageSeo.js +1 -1
- package/dist/features/canvas/sidebar/PageInspector.js +1 -1
- package/dist/features/content/CamoxContent.js +1 -1
- package/dist/features/content/components/MissingFromLocale.js +1 -1
- package/dist/features/page/CuratedPageContent.js +1 -1
- package/dist/features/preview/CamoxPreview.js +3 -3
- package/dist/features/preview/components/AddBlockSheet.js +1 -1
- package/dist/features/preview/components/AssetLightbox.js +1 -1
- package/dist/features/preview/components/BlockActionsPopover.js +1 -1
- package/dist/features/preview/components/CreatePageModal.js +2 -2
- package/dist/features/preview/components/FieldOverlayStyles.js +1 -1
- package/dist/features/preview/components/MobilePreviewDrawer.js +1 -1
- package/dist/features/preview/components/Overlays.js +1 -1
- package/dist/features/preview/components/PageInfo.js +1 -1
- package/dist/features/preview/components/PagePicker.js +1 -1
- package/dist/features/preview/components/PageTree.js +1 -1
- package/dist/features/preview/components/PreviewPanel.js +1 -1
- package/dist/features/preview/components/PreviewToolbar.js +1 -1
- package/dist/features/preview/components/SelectionEditor.js +1 -1
- package/dist/features/preview/components/StudioEditingFallback.js +1 -1
- package/dist/features/provider/AuthenticatedCamoxProvider.js +1 -1
- package/dist/features/provider/CamoxProvider.js +1 -1
- package/dist/features/provider/CoreCamoxProvider.js +3 -3
- package/dist/features/provider/components/CommandPalette.js +1 -1
- package/dist/features/renderer/rendererHost.js +3 -7
- package/dist/features/routes/pageRuntime.d.ts +2 -5
- package/dist/features/routes/pageRuntime.js +1 -2
- package/dist/features/runtime/RuntimeChrome.js +1 -1
- package/dist/features/runtime/navigationTarget.js +1 -2
- package/dist/features/runtime/pageApp.js +1 -1
- package/dist/features/runtime/rendererClient.js +1 -1
- package/dist/features/runtime/runtime.d.ts +0 -5
- package/dist/features/runtime/runtime.js +28 -32
- package/dist/features/runtime/worker.js +3 -3
- package/dist/features/settings/FaviconSettings.js +1 -1
- package/dist/features/studio/CamoxStudio.js +1 -1
- package/dist/features/studio/FollowAgentProvider.js +1 -1
- package/dist/features/studio/components/ChatWidget.js +1 -1
- package/dist/features/studio/components/DraftsControl.js +232 -201
- package/dist/features/studio/components/LocalePicker.js +2 -2
- package/dist/features/studio/components/Navbar.js +3 -3
- package/dist/features/studio/components/Patrol.js +1 -1
- package/dist/features/studio/components/ProjectMenu.js +2 -2
- package/dist/features/studio/components/ReviewDraftSheet.js +9 -15
- package/dist/features/studio/components/ThreadMessages.js +103 -21
- package/dist/features/studio/components/UserButton.js +2 -2
- package/dist/features/studio/draftLabel.js +1 -2
- package/dist/features/studio/draftNotice.js +0 -1
- package/dist/features/studio/showInCanvas.js +1 -1
- package/dist/features/vite/definitionsSync.js +14 -60
- package/dist/features/vite/devSignIn.js +1 -1
- package/dist/features/vite/runtimeDev.js +0 -1
- package/dist/features/vite/vite.d.ts +8 -5
- package/dist/features/vite/vite.js +34 -25
- package/dist/lib/api-client-server.js +25 -8
- package/dist/lib/api-client.js +2 -6
- package/dist/lib/auth.js +1 -1
- package/dist/lib/draft-scope.js +5 -25
- package/dist/lib/preview-handoff.js +1 -1
- package/dist/lib/server-auth-cookie.js +12 -10
- package/dist/lib/studio-reads.js +1 -1
- package/dist/lib/use-thread.js +31 -35
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +4 -4
- package/skills/camox/references/block-definitions.md +1 -1
- package/dist/features/vite/publishSeededContent.js +0 -30
- package/skills/camox-cli/SKILL.md +0 -15
- package/skills/camox-cli/references/cli-common.md +0 -58
- package/skills/camox-cli/references/cli-content.md +0 -181
- package/skills/camox-cli/references/cli-publishing.md +0 -26
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { serializeJsonForHtml } from "../../lib/html.js";
|
|
2
2
|
import { createRequestContext } from "../../core/requestContext.js";
|
|
3
|
-
import { buildClearServerAuthCookieHeader, getServerAuthCookieHeader } from "../../lib/server-auth-cookie.js";
|
|
4
3
|
import { UNNAMED_DEFAULT_LOCALE, localizedPath, parseLocalePath } from "../../lib/locale-path.js";
|
|
5
4
|
import { draftNamedBy } from "../../lib/draft-scope.js";
|
|
5
|
+
import { buildClearServerAuthCookieHeader, getServerAuthCookieHeader } from "../../lib/server-auth-cookie.js";
|
|
6
6
|
import { ARTIFACTS_PATH_PREFIX, RUNTIME_ROUTE_PATHS, matchRuntimeOwnedRoute } from "./runtimeRoutes.js";
|
|
7
7
|
import { reads } from "../../lib/studio-reads.js";
|
|
8
8
|
import { asCollectionItem, recordMarkdownTemplate, recordPageValues } from "../../core/recordItem.js";
|
|
@@ -26,7 +26,7 @@ import { getPageBlockTypes } from "./pageBlockTypes.js";
|
|
|
26
26
|
import { withPageUrls } from "./structuredData.js";
|
|
27
27
|
import { curatedPageDescription, pageRecords, placedBlockNodes, withStructuredData } from "./pageGraph.js";
|
|
28
28
|
import { createProjectLogoResponse, projectLogo } from "./projectLogo.js";
|
|
29
|
-
import {
|
|
29
|
+
import { LOCALE_HEADER } from "@camox/api-contract/drafts";
|
|
30
30
|
import { QueryClient, dehydrate } from "@tanstack/react-query";
|
|
31
31
|
import { createHead, renderSSRHead } from "@unhead/react/server";
|
|
32
32
|
|
|
@@ -52,20 +52,16 @@ function getRuntimePathname(url, runtimeBasePath = DEFAULT_RUNTIME_BASE_PATH) {
|
|
|
52
52
|
if (!pathname.startsWith(`${basePath}/`)) return null;
|
|
53
53
|
return pathname.slice(basePath.length) || "/";
|
|
54
54
|
}
|
|
55
|
-
/**
|
|
56
|
-
|
|
57
|
-
* Markdown ignore it: they read Live.
|
|
58
|
-
*/
|
|
59
|
-
function getRequestDraftId(request, options) {
|
|
60
|
-
if (options.developmentDraft) return DEVELOPMENT_DRAFT;
|
|
55
|
+
/** The draft the request's URL names, if any. Sitemaps and Markdown ignore it: they read Live. */
|
|
56
|
+
function getRequestDraftId(request) {
|
|
61
57
|
return draftNamedBy(request.url) ?? void 0;
|
|
62
58
|
}
|
|
63
59
|
/**
|
|
64
60
|
* Whether a response may show what only this visitor sees: a session, or a draft named in the
|
|
65
61
|
* URL. Shared caches must never keep it.
|
|
66
62
|
*/
|
|
67
|
-
function isPrivateRender(request
|
|
68
|
-
return !!getServerAuthCookieHeader(request.headers) || getRequestDraftId(request
|
|
63
|
+
function isPrivateRender(request) {
|
|
64
|
+
return !!getServerAuthCookieHeader(request.headers) || getRequestDraftId(request) !== void 0;
|
|
69
65
|
}
|
|
70
66
|
/** The routes whose response is the same for every visitor, unless the request is private. */
|
|
71
67
|
const PUBLIC_ROUTE_KINDS = /* @__PURE__ */ new Set([
|
|
@@ -83,7 +79,7 @@ const PUBLIC_ROUTE_KINDS = /* @__PURE__ */ new Set([
|
|
|
83
79
|
*/
|
|
84
80
|
function isPublicRequest(request, options = {}) {
|
|
85
81
|
if (request.method !== "GET" && request.method !== "HEAD") return false;
|
|
86
|
-
if (isPrivateRender(request
|
|
82
|
+
if (isPrivateRender(request) || isPreviewHandoff(request, options)) return false;
|
|
87
83
|
const pathname = getRuntimePathname(request.url, options.runtimeBasePath);
|
|
88
84
|
return pathname !== null && PUBLIC_ROUTE_KINDS.has(matchRuntimeRoute(pathname).kind);
|
|
89
85
|
}
|
|
@@ -316,7 +312,7 @@ async function createOgResponse(request, options) {
|
|
|
316
312
|
source.context,
|
|
317
313
|
style
|
|
318
314
|
])),
|
|
319
|
-
"Cache-Control": isPrivateRender(request
|
|
315
|
+
"Cache-Control": isPrivateRender(request) ? "private, no-store" : "public, no-cache"
|
|
320
316
|
};
|
|
321
317
|
if (namesEtag(request, headers.ETag)) return new Response(null, {
|
|
322
318
|
status: 304,
|
|
@@ -337,7 +333,7 @@ async function readPageImageSource(request, options, app) {
|
|
|
337
333
|
const { project } = await resolveRequestMember(request, options);
|
|
338
334
|
const member = project !== void 0;
|
|
339
335
|
const authCookieHeader = member ? getServerAuthCookieHeader(request.headers) : void 0;
|
|
340
|
-
const requestedDraft = getRequestDraftId(request
|
|
336
|
+
const requestedDraft = getRequestDraftId(request);
|
|
341
337
|
const api = (draftId) => createServerApiClient(apiUrl, {
|
|
342
338
|
authCookieHeader,
|
|
343
339
|
draftId,
|
|
@@ -534,11 +530,11 @@ function hydrationInputFor(input, html) {
|
|
|
534
530
|
/**
|
|
535
531
|
* The render input with its artifacts loaded by URL, where a visitor reads Live: each artifact
|
|
536
532
|
* source becomes a reference to the document the website serves, so neither the page's HTML nor
|
|
537
|
-
* its data carries a source, and the client renders the frames the server did. The studio
|
|
538
|
-
*
|
|
533
|
+
* its data carries a source, and the client renders the frames the server did. The studio and
|
|
534
|
+
* drafts keep inlined sources, so an agent's change shows at once.
|
|
539
535
|
*/
|
|
540
536
|
async function withArtifactsByUrl(input, options) {
|
|
541
|
-
if (input.presentation !== "public" || input.draftId
|
|
537
|
+
if (input.presentation !== "public" || input.draftId) return input;
|
|
542
538
|
const shell = await readArtifactShell(options);
|
|
543
539
|
const artifactsPath = `${input.runtimeBasePath}${ARTIFACTS_PATH_PREFIX}${shell.hash}/`;
|
|
544
540
|
return {
|
|
@@ -551,10 +547,10 @@ function renderStudioThemeScript(enabled) {
|
|
|
551
547
|
}
|
|
552
548
|
/**
|
|
553
549
|
* The analytics providers a render counts its reader with: only a visitor, meaning someone the
|
|
554
|
-
* API didn't confirm as a member, on a Live page.
|
|
550
|
+
* API didn't confirm as a member, on a Live page.
|
|
555
551
|
*/
|
|
556
|
-
function visitorAnalytics(
|
|
557
|
-
if (render.studio || render.draftId
|
|
552
|
+
function visitorAnalytics(render, project) {
|
|
553
|
+
if (render.studio || render.draftId) return void 0;
|
|
558
554
|
return configuredProviders(project.analytics);
|
|
559
555
|
}
|
|
560
556
|
/** Whether a request is a preview link's token handoff, which signs in before reading anything. */
|
|
@@ -757,7 +753,7 @@ function readCuratedPage(options, request, { locale, path }) {
|
|
|
757
753
|
result: loadCamoxPageForRequest({
|
|
758
754
|
apiUrl: options.apiUrl,
|
|
759
755
|
authCookieHeader: getServerAuthCookieHeader(request.headers),
|
|
760
|
-
draftId: getRequestDraftId(request
|
|
756
|
+
draftId: getRequestDraftId(request),
|
|
761
757
|
locale,
|
|
762
758
|
origin: new URL(request.url).origin,
|
|
763
759
|
pathname: path,
|
|
@@ -806,7 +802,7 @@ function curatedPageLocaleReads(options, request, located, queryClient) {
|
|
|
806
802
|
draftId,
|
|
807
803
|
queryClient
|
|
808
804
|
});
|
|
809
|
-
if (!(!getRequestDraftId(request
|
|
805
|
+
if (!(!getRequestDraftId(request) || !authCookieHeader)) return forDraft;
|
|
810
806
|
const live = forDraft(void 0);
|
|
811
807
|
if (located.locales.length > 1) for (const locale of located.locales) {
|
|
812
808
|
if (locale.tag === located.locale.tag || locale.isDefault) continue;
|
|
@@ -837,7 +833,7 @@ async function createPageHtmlResponse({ options, pathname, located, request, pag
|
|
|
837
833
|
Vary: "Cookie",
|
|
838
834
|
Link: llmsTxtLinkHeader(options)
|
|
839
835
|
});
|
|
840
|
-
if (isPrivateRender(request
|
|
836
|
+
if (isPrivateRender(request)) headers.set("Cache-Control", "private, no-store");
|
|
841
837
|
if (result.shouldClearAuthCookie) headers.append("Set-Cookie", buildClearServerAuthCookieHeader());
|
|
842
838
|
const camoxApp = await options.getCamoxApp?.();
|
|
843
839
|
const document = await options.getDocument?.() ?? {};
|
|
@@ -854,7 +850,7 @@ async function createPageHtmlResponse({ options, pathname, located, request, pag
|
|
|
854
850
|
const dehydratedState = dehydrate(queryClient);
|
|
855
851
|
const { project } = result;
|
|
856
852
|
const studio = project !== void 0;
|
|
857
|
-
const analytics = visitorAnalytics(
|
|
853
|
+
const analytics = visitorAnalytics({
|
|
858
854
|
studio,
|
|
859
855
|
draftId: result.draftId
|
|
860
856
|
}, result.data.page.project);
|
|
@@ -1071,7 +1067,7 @@ async function createLayoutMarkdownDataResponse(options, request, pathname) {
|
|
|
1071
1067
|
if (!match || matchLocalizedRoute(located.path)?.kind !== "page") return new Response("Not found", { status: 404 });
|
|
1072
1068
|
const { project, clearAuthCookie } = await resolveRequestMember(request, options);
|
|
1073
1069
|
const headers = {
|
|
1074
|
-
...isPrivateRender(request
|
|
1070
|
+
...isPrivateRender(request) ? { "Cache-Control": "private, no-store" } : {},
|
|
1075
1071
|
Vary: "Cookie",
|
|
1076
1072
|
...clearAuthCookie ? { "Set-Cookie": buildClearServerAuthCookieHeader() } : {}
|
|
1077
1073
|
};
|
|
@@ -1082,7 +1078,7 @@ async function createLayoutMarkdownDataResponse(options, request, pathname) {
|
|
|
1082
1078
|
}, {
|
|
1083
1079
|
member: project !== void 0,
|
|
1084
1080
|
authCookieHeader: getServerAuthCookieHeader(request.headers),
|
|
1085
|
-
requestedDraft: getRequestDraftId(request
|
|
1081
|
+
requestedDraft: getRequestDraftId(request)
|
|
1086
1082
|
});
|
|
1087
1083
|
return Response.json({ markdown }, { headers });
|
|
1088
1084
|
} catch (error) {
|
|
@@ -1103,7 +1099,7 @@ async function createDerivedResponse(options, pathname, located, request, { data
|
|
|
1103
1099
|
const { project, clearAuthCookie } = await resolveRequestMember(request, options);
|
|
1104
1100
|
const studio = project !== void 0;
|
|
1105
1101
|
const authCookieHeader = studio ? getServerAuthCookieHeader(request.headers) : void 0;
|
|
1106
|
-
const requestedDraft = getRequestDraftId(request
|
|
1102
|
+
const requestedDraft = getRequestDraftId(request);
|
|
1107
1103
|
const readLayout = () => readDraftOrLive(requestedDraft, studio, (draftId) => createServerApiClient(options.apiUrl, {
|
|
1108
1104
|
authCookieHeader,
|
|
1109
1105
|
draftId,
|
|
@@ -1183,7 +1179,7 @@ async function createDerivedResponse(options, pathname, located, request, { data
|
|
|
1183
1179
|
draftId: read.draftId
|
|
1184
1180
|
})
|
|
1185
1181
|
});
|
|
1186
|
-
const analytics = dataOnly ? void 0 : visitorAnalytics(
|
|
1182
|
+
const analytics = dataOnly ? void 0 : visitorAnalytics({
|
|
1187
1183
|
studio,
|
|
1188
1184
|
draftId: read.draftId
|
|
1189
1185
|
}, shared.project);
|
|
@@ -1220,7 +1216,7 @@ async function createDerivedResponse(options, pathname, located, request, { data
|
|
|
1220
1216
|
const document = await options.getDocument?.() ?? {};
|
|
1221
1217
|
preparePreviewDocument(input, options, document);
|
|
1222
1218
|
if (dataOnly) return Response.json(input, { headers: {
|
|
1223
|
-
...isPrivateRender(request
|
|
1219
|
+
...isPrivateRender(request) ? { "Cache-Control": "private, no-store" } : {},
|
|
1224
1220
|
Vary: "Cookie",
|
|
1225
1221
|
...clearAuthCookie ? { "Set-Cookie": buildClearServerAuthCookieHeader() } : {}
|
|
1226
1222
|
} });
|
|
@@ -1230,7 +1226,7 @@ async function createDerivedResponse(options, pathname, located, request, { data
|
|
|
1230
1226
|
"Content-Type": "text/html; charset=utf-8",
|
|
1231
1227
|
Vary: "Cookie",
|
|
1232
1228
|
Link: llmsTxtLinkHeader(options),
|
|
1233
|
-
...isPrivateRender(request
|
|
1229
|
+
...isPrivateRender(request) ? { "Cache-Control": "private, no-store" } : {},
|
|
1234
1230
|
...clearAuthCookie ? { "Set-Cookie": buildClearServerAuthCookieHeader() } : {}
|
|
1235
1231
|
} });
|
|
1236
1232
|
} catch (error) {
|
|
@@ -1319,7 +1315,7 @@ async function createCanvasOnlyResponse({ options, pathname, located, request, d
|
|
|
1319
1315
|
loaderData: null,
|
|
1320
1316
|
dehydratedState: dehydrate(new QueryClient()),
|
|
1321
1317
|
canvasOnly: true,
|
|
1322
|
-
draftId: studio ? getRequestDraftId(request
|
|
1318
|
+
draftId: studio ? getRequestDraftId(request) : void 0
|
|
1323
1319
|
};
|
|
1324
1320
|
const headers = {
|
|
1325
1321
|
"Cache-Control": "private, no-store",
|
|
@@ -1353,7 +1349,7 @@ async function createPageDataResponse({ options, pathname, located, request, pag
|
|
|
1353
1349
|
"Content-Type": "application/json; charset=utf-8",
|
|
1354
1350
|
Vary: "Cookie"
|
|
1355
1351
|
});
|
|
1356
|
-
if (isPrivateRender(request
|
|
1352
|
+
if (isPrivateRender(request)) headers.set("Cache-Control", "private, no-store");
|
|
1357
1353
|
if (result.shouldClearAuthCookie) headers.append("Set-Cookie", buildClearServerAuthCookieHeader());
|
|
1358
1354
|
const camoxApp = await options.getCamoxApp?.();
|
|
1359
1355
|
const { alternates, head } = await readAlternates(request, options, {
|
|
@@ -1529,7 +1525,7 @@ async function locateRequest(request, options, pathname) {
|
|
|
1529
1525
|
apiUrl,
|
|
1530
1526
|
projectUuid,
|
|
1531
1527
|
authCookieHeader: getServerAuthCookieHeader(request.headers),
|
|
1532
|
-
draftId: getRequestDraftId(request
|
|
1528
|
+
draftId: getRequestDraftId(request)
|
|
1533
1529
|
}) : [UNNAMED_DEFAULT_LOCALE];
|
|
1534
1530
|
return {
|
|
1535
1531
|
...parseLocalePath(pathname, locales),
|
|
@@ -16,9 +16,9 @@ function notFound() {
|
|
|
16
16
|
return new Response("Not found", { status: 404 });
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* Answers a request, from the edge cache when every visitor sees the same. Dev
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* Answers a request, from the edge cache when every visitor sees the same. Dev serves code that
|
|
20
|
+
* changes on every save, and a Worker calling this one without its context can't keep anything
|
|
21
|
+
* past the response.
|
|
22
22
|
*/
|
|
23
23
|
function respond(request, context) {
|
|
24
24
|
const caches = globalThis.caches;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getApiUrl } from "../../lib/api-client.js";
|
|
2
1
|
import { reads, useStudioCache } from "../../lib/studio-reads.js";
|
|
2
|
+
import { getApiUrl } from "../../lib/api-client.js";
|
|
3
3
|
import { buildDefaultFaviconUrl, buildFaviconUrl } from "../routes/pageRuntime.js";
|
|
4
4
|
import { SettingsPart } from "./SettingsPart.js";
|
|
5
5
|
import { useProjectMutation } from "./useProjectMutation.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useAuthState, useSignInRedirect } from "../../lib/auth.js";
|
|
2
1
|
import { Navigate } from "../navigation/navigation.js";
|
|
2
|
+
import { useAuthState, useSignInRedirect } from "../../lib/auth.js";
|
|
3
3
|
import { useLocalePath, useLocalizedPath } from "../../lib/view-locale.js";
|
|
4
4
|
import { STUDIO_BASE_PATH } from "./routes.js";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useProjectUuid } from "../../lib/auth.js";
|
|
2
1
|
import { parseLocalePath } from "../../lib/locale-path.js";
|
|
3
2
|
import { useViewLocale } from "../../lib/view-locale-context.js";
|
|
4
3
|
import { useLocation, useNavigate } from "../navigation/navigation.js";
|
|
4
|
+
import { useProjectUuid } from "../../lib/auth.js";
|
|
5
5
|
import { reads, useReadQueries, useReadQuery } from "../../lib/studio-reads.js";
|
|
6
6
|
import { useRoutableLayouts } from "../../lib/studio-definitions.js";
|
|
7
7
|
import { FollowAgentContext } from "./followAgentContext.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AuthContext } from "../../../lib/auth.js";
|
|
2
1
|
import { useCurrentDraftId, useDraftScope } from "../../../lib/draft-scope.js";
|
|
3
2
|
import { useNavigate } from "../../navigation/navigation.js";
|
|
3
|
+
import { AuthContext } from "../../../lib/auth.js";
|
|
4
4
|
import { reads, useReadQuery } from "../../../lib/studio-reads.js";
|
|
5
5
|
import { cn } from "../../../lib/utils.js";
|
|
6
6
|
import { BOTTOM_CARD_EDGES, CARD_BODY_EDGES } from "../../preview/components/SidebarStack.js";
|