camox 0.63.0 → 0.66.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.
Files changed (60) hide show
  1. package/dist/core/createApp.d.ts +28 -28
  2. package/dist/core/createLayout.d.ts +1 -1
  3. package/dist/core/derivedRoutes.js +3 -30
  4. package/dist/core/editing/createEditableBlock.d.ts +604 -604
  5. package/dist/features/canvas/CamoxCanvas.js +195 -173
  6. package/dist/features/canvas/canvasCamera.js +11 -2
  7. package/dist/features/canvas/canvasFrameCapture.js +5 -12
  8. package/dist/features/canvas/canvasFrameDocument.js +90 -29
  9. package/dist/features/canvas/canvasItems.js +22 -6
  10. package/dist/features/canvas/sidebar/ContentSidebar.js +19 -21
  11. package/dist/features/canvas/sidebar/LayoutPageOverview.js +22 -49
  12. package/dist/features/canvas/sidebar/LayoutPageSeo.js +73 -76
  13. package/dist/features/canvas/sidebar/PageInspector.js +61 -50
  14. package/dist/features/canvas/sidebar/PageInspectorSkeleton.js +4 -4
  15. package/dist/features/canvas/useCanvasCamera.js +36 -15
  16. package/dist/features/page/CuratedPageContent.js +2 -1
  17. package/dist/features/page/UnplacedBlockContent.js +52 -0
  18. package/dist/features/preview/components/PageInfo.js +103 -100
  19. package/dist/features/preview/components/PreviewPanel.js +40 -12
  20. package/dist/features/preview/components/SidebarStack.js +78 -9
  21. package/dist/features/preview/strayCaretGuard.js +34 -0
  22. package/dist/features/provider/CoreCamoxProvider.js +5 -3
  23. package/dist/features/routes/pageRuntime.d.ts +2 -0
  24. package/dist/features/routes/pageRuntime.js +8 -5
  25. package/dist/features/runtime/RuntimeChrome.js +66 -40
  26. package/dist/features/runtime/pageApp.js +111 -74
  27. package/dist/features/runtime/pageClient.js +22 -2
  28. package/dist/features/runtime/runtime.d.ts +10 -0
  29. package/dist/features/runtime/runtime.js +314 -4
  30. package/dist/features/runtime/runtimeRoutes.d.ts +5 -0
  31. package/dist/features/runtime/runtimeRoutes.js +5 -0
  32. package/dist/features/studio/components/AgentSidebar.js +3 -3
  33. package/dist/features/studio/components/ChatWidget.js +106 -75
  34. package/dist/features/studio/components/ConnectAgent.js +313 -0
  35. package/dist/features/studio/components/DraftsControl.js +172 -159
  36. package/dist/features/studio/components/Patrol.js +605 -350
  37. package/dist/features/studio/components/ReviewDraftSheet.js +566 -430
  38. package/dist/features/studio/components/Squareling.js +74 -41
  39. package/dist/features/studio/components/ThreadComposer.js +192 -107
  40. package/dist/features/studio/components/ThreadMessages.js +95 -18
  41. package/dist/features/studio/components/UnnamedDraftBar.js +349 -0
  42. package/dist/features/studio/components/clientLogoPaths.js +10 -0
  43. package/dist/features/studio/findingSentence.js +37 -0
  44. package/dist/features/studio/patrollerBio.js +40 -0
  45. package/dist/features/studio/reportSentence.js +15 -0
  46. package/dist/features/studio/studioStore.js +36 -1
  47. package/dist/features/studio/workingSentence.js +10 -7
  48. package/dist/lib/api-client.d.ts +1 -0
  49. package/dist/lib/auth.js +34 -32
  50. package/dist/lib/queries.js +9 -1
  51. package/dist/lib/revisions.js +25 -3
  52. package/dist/lib/server-auth-cookie.js +17 -4
  53. package/dist/lib/studio-reads.d.ts +1 -1
  54. package/dist/lib/studio-reads.js +5 -1
  55. package/dist/lib/use-thread.js +1 -1
  56. package/dist/package.js +1 -1
  57. package/dist/studio.css +1 -1
  58. package/package.json +15 -4
  59. package/dist/features/canvas/sidebar/DerivedPageInspector.js +0 -49
  60. package/dist/features/canvas/sidebar/SingletonPageInspector.js +0 -39
@@ -6,7 +6,7 @@ import { PAGE_IMAGE_SIZE, pageImageUrl } from "../og/pageImage.js";
6
6
  import { curatedLayoutContext } from "../../core/layoutContext.js";
7
7
  import { isArticle } from "../../core/structuredData.js";
8
8
  import { publishingDraft } from "../runtime/publishingDraft.js";
9
- import { DRAFT_ENDED_ERROR_CODE, DRAFT_HEADER, PUBLISHING_DRAFT_HEADER } from "@camox/api-contract/drafts";
9
+ import { DRAFT_ENDED_ERROR_CODE, DRAFT_HEADER, LOOK_TOKEN_HEADER, PUBLISHING_DRAFT_HEADER } from "@camox/api-contract/drafts";
10
10
  import { createORPCClient } from "@orpc/client";
11
11
  import { RPCLink } from "@orpc/client/fetch";
12
12
 
@@ -38,7 +38,8 @@ function parseMarkdownPath(pathname) {
38
38
  }
39
39
  function createServerApiClient(apiUrl, options) {
40
40
  const headers = localeHeaders(options?.locale);
41
- if (options?.draftId && options.authCookieHeader) headers[DRAFT_HEADER] = options.draftId;
41
+ if (options?.lookToken) headers[LOOK_TOKEN_HEADER] = options.lookToken;
42
+ if (options?.draftId && (options.authCookieHeader || options.lookToken)) headers[DRAFT_HEADER] = options.draftId;
42
43
  else {
43
44
  const publishing = publishingDraft();
44
45
  if (publishing) headers[PUBLISHING_DRAFT_HEADER] = publishing;
@@ -115,13 +116,14 @@ async function readDraftOrLive(draftId, member, read) {
115
116
  function renderedHref(url, read) {
116
117
  return read.refusedDraft ? withoutDraft(url) : url;
117
118
  }
118
- async function loadCamoxPage({ apiUrl, authCookieHeader, draftId, locale, pathname, projectUuid, queryClient }) {
119
+ async function loadCamoxPage({ apiUrl, authCookieHeader, lookToken, draftId, locale, pathname, projectUuid, queryClient }) {
119
120
  const studioCache = createServerStudioCache(queryClient, {
120
121
  apiUrl,
121
122
  authCookieHeader,
123
+ lookToken,
122
124
  locale
123
125
  });
124
- const inDraft = { in: draftId && authCookieHeader ? draftId : null };
126
+ const inDraft = { in: draftId && (authCookieHeader || lookToken) ? draftId : null };
125
127
  const fallback = locale && linkFallbackLocale(locale);
126
128
  const [page] = await Promise.all([
127
129
  studioCache.ensure(reads.pageStructure({
@@ -140,12 +142,13 @@ async function loadCamoxPage({ apiUrl, authCookieHeader, draftId, locale, pathna
140
142
  * The studio's reads for one server request, read with its session. Each operation names the
141
143
  * draft it acts in, once the request settled which one it reads.
142
144
  */
143
- function createServerStudioCache(queryClient, { apiUrl, authCookieHeader, locale }) {
145
+ function createServerStudioCache(queryClient, { apiUrl, authCookieHeader, lookToken, locale }) {
144
146
  return createStudioCache({
145
147
  queryClient,
146
148
  scope: createDraftScope({ queryClient }),
147
149
  api: (draft, inLocale) => createServerApiClient(apiUrl, {
148
150
  authCookieHeader,
151
+ lookToken,
149
152
  draftId: draft ?? void 0,
150
153
  locale: inLocale
151
154
  }),
@@ -5,6 +5,7 @@ import { Navbar } from "../studio/components/Navbar.js";
5
5
  import { EditingFallbackContext } from "./editingFallback.js";
6
6
  import { PreviewToolbar } from "../preview/components/PreviewToolbar.js";
7
7
  import { AgentSidebar } from "../studio/components/AgentSidebar.js";
8
+ import { UnnamedDraftBar } from "../studio/components/UnnamedDraftBar.js";
8
9
  import { FollowAgentProvider } from "../studio/FollowAgentProvider.js";
9
10
  import { c } from "react/compiler-runtime";
10
11
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -14,7 +15,7 @@ import studioCssUrl from "virtual:camox-studio-css";
14
15
  //#region src/features/runtime/RuntimeChrome.tsx
15
16
  const renderEditingFallback = ({ layoutPage }) => /* @__PURE__ */ jsx(StudioEditingFallback, { layoutPage });
16
17
  function RuntimeChrome(t0) {
17
- const $ = c(32);
18
+ const $ = c(39);
18
19
  const { input, children } = t0;
19
20
  const website = !input.routeKind;
20
21
  const hidden = useSelector(previewStore, _temp);
@@ -92,56 +93,81 @@ function RuntimeChrome(t0) {
92
93
  $[15] = t11;
93
94
  $[16] = t13;
94
95
  } else t13 = $[16];
95
- let t14;
96
- if ($[17] !== t13 || $[18] !== t9) {
97
- t14 = /* @__PURE__ */ jsxs("div", {
98
- className: "relative flex min-h-0 min-w-0 flex-1 flex-col",
99
- children: [t9, t13]
96
+ const t14 = website && hidden;
97
+ const t15 = website ? "max-md:hidden" : void 0;
98
+ let t16;
99
+ if ($[17] !== website) {
100
+ t16 = /* @__PURE__ */ jsx(UnnamedDraftBar, { stacked: website });
101
+ $[17] = website;
102
+ $[18] = t16;
103
+ } else t16 = $[18];
104
+ let t17;
105
+ if ($[19] !== t14 || $[20] !== t15 || $[21] !== t16) {
106
+ t17 = /* @__PURE__ */ jsx("div", {
107
+ hidden: t14,
108
+ className: t15,
109
+ children: t16
100
110
  });
101
- $[17] = t13;
102
- $[18] = t9;
103
111
  $[19] = t14;
104
- } else t14 = $[19];
105
- const t15 = !showAgentSidebar;
106
- let t16;
107
- if ($[20] !== t15) {
108
- t16 = /* @__PURE__ */ jsx(AgentSidebar, { hidden: t15 });
109
112
  $[20] = t15;
110
113
  $[21] = t16;
111
- } else t16 = $[21];
112
- let t17;
113
- if ($[22] !== t14 || $[23] !== t16) {
114
- t17 = /* @__PURE__ */ jsxs("div", {
115
- className: "relative flex min-h-0 flex-1",
116
- children: [t14, t16]
117
- });
118
- $[22] = t14;
119
- $[23] = t16;
120
- $[24] = t17;
121
- } else t17 = $[24];
114
+ $[22] = t17;
115
+ } else t17 = $[22];
122
116
  let t18;
123
- if ($[25] !== t17 || $[26] !== t7) {
117
+ if ($[23] !== t13 || $[24] !== t17 || $[25] !== t9) {
124
118
  t18 = /* @__PURE__ */ jsxs("div", {
119
+ className: "relative flex min-h-0 min-w-0 flex-1 flex-col",
120
+ children: [
121
+ t9,
122
+ t13,
123
+ t17
124
+ ]
125
+ });
126
+ $[23] = t13;
127
+ $[24] = t17;
128
+ $[25] = t9;
129
+ $[26] = t18;
130
+ } else t18 = $[26];
131
+ const t19 = !showAgentSidebar;
132
+ let t20;
133
+ if ($[27] !== t19) {
134
+ t20 = /* @__PURE__ */ jsx(AgentSidebar, { hidden: t19 });
135
+ $[27] = t19;
136
+ $[28] = t20;
137
+ } else t20 = $[28];
138
+ let t21;
139
+ if ($[29] !== t18 || $[30] !== t20) {
140
+ t21 = /* @__PURE__ */ jsxs("div", {
141
+ className: "relative flex min-h-0 flex-1",
142
+ children: [t18, t20]
143
+ });
144
+ $[29] = t18;
145
+ $[30] = t20;
146
+ $[31] = t21;
147
+ } else t21 = $[31];
148
+ let t22;
149
+ if ($[32] !== t21 || $[33] !== t7) {
150
+ t22 = /* @__PURE__ */ jsxs("div", {
125
151
  className: "bg-background flex h-screen flex-col overflow-hidden",
126
- children: [t7, t17]
152
+ children: [t7, t21]
127
153
  });
128
- $[25] = t17;
129
- $[26] = t7;
130
- $[27] = t18;
131
- } else t18 = $[27];
132
- let t19;
133
- if ($[28] !== input.runtimeBasePath || $[29] !== t18 || $[30] !== website) {
134
- t19 = /* @__PURE__ */ jsxs(FollowAgentProvider, {
154
+ $[32] = t21;
155
+ $[33] = t7;
156
+ $[34] = t22;
157
+ } else t22 = $[34];
158
+ let t23;
159
+ if ($[35] !== input.runtimeBasePath || $[36] !== t22 || $[37] !== website) {
160
+ t23 = /* @__PURE__ */ jsxs(FollowAgentProvider, {
135
161
  runtimeBasePath: t1,
136
162
  website,
137
- children: [t2, t18]
163
+ children: [t2, t22]
138
164
  });
139
- $[28] = input.runtimeBasePath;
140
- $[29] = t18;
141
- $[30] = website;
142
- $[31] = t19;
143
- } else t19 = $[31];
144
- return t19;
165
+ $[35] = input.runtimeBasePath;
166
+ $[36] = t22;
167
+ $[37] = website;
168
+ $[38] = t23;
169
+ } else t23 = $[38];
170
+ return t23;
145
171
  }
146
172
  function _temp(state) {
147
173
  return state.context.isToolbarHidden;
@@ -8,6 +8,7 @@ import { PreviewSignInPage } from "../provider/PreviewSignInPage.js";
8
8
  import { CoreCamoxProvider } from "../provider/CoreCamoxProvider.js";
9
9
  import { CuratedPageContent } from "../page/CuratedPageContent.js";
10
10
  import { DerivedPageContent } from "../page/DerivedPageContent.js";
11
+ import { UnplacedBlockContent } from "../page/UnplacedBlockContent.js";
11
12
  import { EditingFallbackSlot } from "./editingFallback.js";
12
13
  import { PageNavigationProvider } from "./pageNavigation.js";
13
14
  import { RuntimeChromeSlot } from "./runtimeChromeLoader.js";
@@ -19,11 +20,11 @@ import { HydrationBoundary, QueryClientProvider } from "@tanstack/react-query";
19
20
  //#region src/features/runtime/pageApp.tsx
20
21
  /** The page app of one server request or browser window, viewing the draft `draftScope` names. */
21
22
  function PageApp(t0) {
22
- const $ = c(22);
23
+ const $ = c(23);
23
24
  const { camoxApp, draftScope, input, queryClient } = t0;
24
25
  const t1 = input.dehydratedState;
25
26
  let t2;
26
- if ($[0] !== camoxApp || $[1] !== input.apiUrl || $[2] !== input.authenticationUrl || $[3] !== input.presentation || $[4] !== input.previewHandoff || $[5] !== input.projectUuid || $[6] !== queryClient) {
27
+ if ($[0] !== camoxApp || $[1] !== input.apiUrl || $[2] !== input.authenticationUrl || $[3] !== input.look || $[4] !== input.presentation || $[5] !== input.previewHandoff || $[6] !== input.projectUuid || $[7] !== queryClient) {
27
28
  t2 = (currentInput) => /* @__PURE__ */ jsx(CoreCamoxProvider, {
28
29
  camoxApp,
29
30
  authenticationUrl: input.authenticationUrl,
@@ -31,9 +32,13 @@ function PageApp(t0) {
31
32
  projectUuid: input.projectUuid,
32
33
  initialAuthenticated: input.presentation === "studio",
33
34
  initialProject: currentInput.project,
35
+ sessionless: input.look,
34
36
  children: /* @__PURE__ */ jsx(PreviewDocumentContext.Provider, {
35
37
  value: currentInput.previewDocument,
36
- children: input.previewHandoff ? /* @__PURE__ */ jsx(PreviewSignInPage, {}) : /* @__PURE__ */ jsx(PageExperience, {
38
+ children: input.previewHandoff ? /* @__PURE__ */ jsx(PreviewSignInPage, {}) : input.look ? /* @__PURE__ */ jsx(PageContent, {
39
+ camoxApp,
40
+ input: currentInput
41
+ }) : /* @__PURE__ */ jsx(PageExperience, {
37
42
  camoxApp,
38
43
  input: currentInput,
39
44
  queryClient,
@@ -44,56 +49,57 @@ function PageApp(t0) {
44
49
  $[0] = camoxApp;
45
50
  $[1] = input.apiUrl;
46
51
  $[2] = input.authenticationUrl;
47
- $[3] = input.presentation;
48
- $[4] = input.previewHandoff;
49
- $[5] = input.projectUuid;
50
- $[6] = queryClient;
51
- $[7] = t2;
52
- } else t2 = $[7];
52
+ $[3] = input.look;
53
+ $[4] = input.presentation;
54
+ $[5] = input.previewHandoff;
55
+ $[6] = input.projectUuid;
56
+ $[7] = queryClient;
57
+ $[8] = t2;
58
+ } else t2 = $[8];
53
59
  let t3;
54
- if ($[8] !== camoxApp || $[9] !== input || $[10] !== queryClient || $[11] !== t2) {
60
+ if ($[9] !== camoxApp || $[10] !== input || $[11] !== queryClient || $[12] !== t2) {
55
61
  t3 = /* @__PURE__ */ jsx(PageNavigationProvider, {
56
62
  camoxApp,
57
63
  initialInput: input,
58
64
  queryClient,
59
65
  children: t2
60
66
  });
61
- $[8] = camoxApp;
62
- $[9] = input;
63
- $[10] = queryClient;
64
- $[11] = t2;
65
- $[12] = t3;
66
- } else t3 = $[12];
67
+ $[9] = camoxApp;
68
+ $[10] = input;
69
+ $[11] = queryClient;
70
+ $[12] = t2;
71
+ $[13] = t3;
72
+ } else t3 = $[13];
67
73
  let t4;
68
- if ($[13] !== t1 || $[14] !== t3) {
74
+ if ($[14] !== t1 || $[15] !== t3) {
69
75
  t4 = /* @__PURE__ */ jsx(HydrationBoundary, {
70
76
  state: t1,
71
77
  children: t3
72
78
  });
73
- $[13] = t1;
74
- $[14] = t3;
75
- $[15] = t4;
76
- } else t4 = $[15];
79
+ $[14] = t1;
80
+ $[15] = t3;
81
+ $[16] = t4;
82
+ } else t4 = $[16];
77
83
  let t5;
78
- if ($[16] !== draftScope || $[17] !== t4) {
84
+ if ($[17] !== draftScope || $[18] !== t4) {
79
85
  t5 = /* @__PURE__ */ jsx(DraftScopeContext.Provider, {
80
86
  value: draftScope,
81
87
  children: t4
82
88
  });
83
- $[16] = draftScope;
84
- $[17] = t4;
85
- $[18] = t5;
86
- } else t5 = $[18];
89
+ $[17] = draftScope;
90
+ $[18] = t4;
91
+ $[19] = t5;
92
+ } else t5 = $[19];
87
93
  let t6;
88
- if ($[19] !== queryClient || $[20] !== t5) {
94
+ if ($[20] !== queryClient || $[21] !== t5) {
89
95
  t6 = /* @__PURE__ */ jsx(QueryClientProvider, {
90
96
  client: queryClient,
91
97
  children: t5
92
98
  });
93
- $[19] = queryClient;
94
- $[20] = t5;
95
- $[21] = t6;
96
- } else t6 = $[21];
99
+ $[20] = queryClient;
100
+ $[21] = t5;
101
+ $[22] = t6;
102
+ } else t6 = $[22];
97
103
  return t6;
98
104
  }
99
105
  const LazyEditablePageExperience = React.lazy(() => import("../preview/EditablePageExperience.js").then((module) => ({ default: module.EditablePageExperience })));
@@ -111,7 +117,7 @@ var EditingActivationBoundary = class extends React.Component {
111
117
  };
112
118
  const subscribeToHydration = () => () => {};
113
119
  function PageExperience(t0) {
114
- const $ = c(31);
120
+ const $ = c(29);
115
121
  const { camoxApp, input, queryClient, studioDocument } = t0;
116
122
  const { isAuthenticated, isLoading } = useAuthState();
117
123
  const hasHydrated = React.useSyncExternalStore(subscribeToHydration, _temp, _temp2);
@@ -151,48 +157,46 @@ function PageExperience(t0) {
151
157
  } else t3 = $[6];
152
158
  const loading = t3;
153
159
  let t4;
154
- if ($[7] !== camoxApp || $[8] !== input.canvasOnly || $[9] !== input.derived || $[10] !== input.routeKind) {
155
- t4 = input.routeKind ? loading : input.canvasOnly ? null : input.derived ? /* @__PURE__ */ jsx(DerivedPageContent, {
160
+ if ($[7] !== camoxApp || $[8] !== input) {
161
+ t4 = input.routeKind ? loading : input.canvasOnly ? null : /* @__PURE__ */ jsx(PageContent, {
156
162
  camoxApp,
157
- derived: input.derived
158
- }) : /* @__PURE__ */ jsx(CuratedPageContent, {});
163
+ input
164
+ });
159
165
  $[7] = camoxApp;
160
- $[8] = input.canvasOnly;
161
- $[9] = input.derived;
162
- $[10] = input.routeKind;
163
- $[11] = t4;
164
- } else t4 = $[11];
166
+ $[8] = input;
167
+ $[9] = t4;
168
+ } else t4 = $[9];
165
169
  const readOnlyPage = t4;
166
170
  let t5;
167
- if ($[12] !== readOnlyPage) {
171
+ if ($[10] !== readOnlyPage) {
168
172
  t5 = /* @__PURE__ */ jsx(Frame, { children: readOnlyPage });
169
- $[12] = readOnlyPage;
170
- $[13] = t5;
171
- } else t5 = $[13];
173
+ $[10] = readOnlyPage;
174
+ $[11] = t5;
175
+ } else t5 = $[11];
172
176
  const isolatedPage = t5;
173
177
  if (isAuthenticated) {
174
178
  let t6;
175
- if ($[14] !== camoxApp || $[15] !== hasHydrated || $[16] !== input || $[17] !== queryClient) {
179
+ if ($[12] !== camoxApp || $[13] !== hasHydrated || $[14] !== input || $[15] !== queryClient) {
176
180
  t6 = hasHydrated ? /* @__PURE__ */ jsx(LazyEditablePageExperience, {
177
181
  camoxApp,
178
182
  input,
179
183
  queryClient
180
184
  }) : null;
181
- $[14] = camoxApp;
182
- $[15] = hasHydrated;
183
- $[16] = input;
184
- $[17] = queryClient;
185
- $[18] = t6;
186
- } else t6 = $[18];
185
+ $[12] = camoxApp;
186
+ $[13] = hasHydrated;
187
+ $[14] = input;
188
+ $[15] = queryClient;
189
+ $[16] = t6;
190
+ } else t6 = $[16];
187
191
  const editor = t6;
188
192
  const t7 = input.routeKind ? loading : studioDocument ? null : isolatedPage;
189
193
  let t8;
190
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
194
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
191
195
  t8 = /* @__PURE__ */ jsx(StudioLoadError, {});
192
- $[19] = t8;
193
- } else t8 = $[19];
196
+ $[17] = t8;
197
+ } else t8 = $[17];
194
198
  let t9;
195
- if ($[20] !== editor || $[21] !== input.derived || $[22] !== input.routeKind) {
199
+ if ($[18] !== editor || $[19] !== input.derived || $[20] !== input.routeKind) {
196
200
  t9 = /* @__PURE__ */ jsx(EditingActivationBoundary, {
197
201
  fallback: t8,
198
202
  children: input.routeKind ? /* @__PURE__ */ jsx(React.Suspense, {
@@ -203,41 +207,41 @@ function PageExperience(t0) {
203
207
  children: editor
204
208
  })
205
209
  });
206
- $[20] = editor;
207
- $[21] = input.derived;
208
- $[22] = input.routeKind;
209
- $[23] = t9;
210
- } else t9 = $[23];
210
+ $[18] = editor;
211
+ $[19] = input.derived;
212
+ $[20] = input.routeKind;
213
+ $[21] = t9;
214
+ } else t9 = $[21];
211
215
  let t10;
212
- if ($[24] !== input || $[25] !== t7 || $[26] !== t9) {
216
+ if ($[22] !== input || $[23] !== t7 || $[24] !== t9) {
213
217
  t10 = /* @__PURE__ */ jsx(RuntimeChromeSlot, {
214
218
  input,
215
219
  fallback: t7,
216
220
  children: t9
217
221
  });
218
- $[24] = input;
219
- $[25] = t7;
220
- $[26] = t9;
221
- $[27] = t10;
222
- } else t10 = $[27];
222
+ $[22] = input;
223
+ $[23] = t7;
224
+ $[24] = t9;
225
+ $[25] = t10;
226
+ } else t10 = $[25];
223
227
  return t10;
224
228
  }
225
229
  if (studioOnly) return null;
226
230
  if (studioDocument) {
227
231
  let t6;
228
- if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
232
+ if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
229
233
  t6 = { height: "100vh" };
230
- $[28] = t6;
231
- } else t6 = $[28];
234
+ $[26] = t6;
235
+ } else t6 = $[26];
232
236
  let t7;
233
- if ($[29] !== isolatedPage) {
237
+ if ($[27] !== isolatedPage) {
234
238
  t7 = /* @__PURE__ */ jsx("div", {
235
239
  style: t6,
236
240
  children: isolatedPage
237
241
  });
238
- $[29] = isolatedPage;
239
- $[30] = t7;
240
- } else t7 = $[30];
242
+ $[27] = isolatedPage;
243
+ $[28] = t7;
244
+ } else t7 = $[28];
241
245
  return t7;
242
246
  }
243
247
  return readOnlyPage;
@@ -248,6 +252,39 @@ function _temp2() {
248
252
  function _temp() {
249
253
  return true;
250
254
  }
255
+ /** The page's blocks, read-only, or the look document's one unplaced block. */
256
+ function PageContent(t0) {
257
+ const $ = c(6);
258
+ const { camoxApp, input } = t0;
259
+ if (input.lookBlock) {
260
+ let t1;
261
+ if ($[0] !== input.lookBlock) {
262
+ t1 = /* @__PURE__ */ jsx(UnplacedBlockContent, { blockId: input.lookBlock });
263
+ $[0] = input.lookBlock;
264
+ $[1] = t1;
265
+ } else t1 = $[1];
266
+ return t1;
267
+ }
268
+ if (input.derived) {
269
+ let t1;
270
+ if ($[2] !== camoxApp || $[3] !== input.derived) {
271
+ t1 = /* @__PURE__ */ jsx(DerivedPageContent, {
272
+ camoxApp,
273
+ derived: input.derived
274
+ });
275
+ $[2] = camoxApp;
276
+ $[3] = input.derived;
277
+ $[4] = t1;
278
+ } else t1 = $[4];
279
+ return t1;
280
+ }
281
+ let t1;
282
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
283
+ t1 = /* @__PURE__ */ jsx(CuratedPageContent, {});
284
+ $[5] = t1;
285
+ } else t1 = $[5];
286
+ return t1;
287
+ }
251
288
  function StudioLoadError() {
252
289
  const $ = c(1);
253
290
  let t0;
@@ -4,11 +4,31 @@ import { getPageBlockTypes } from "./pageBlockTypes.js";
4
4
  import { loadRuntimeChrome } from "./runtimeChromeLoader.js";
5
5
  import { PageApp } from "./pageApp.js";
6
6
  import { readHydrationData } from "./hydrationData.js";
7
+ import { c } from "react/compiler-runtime";
8
+ import * as React from "react";
7
9
  import { jsx } from "react/jsx-runtime";
8
10
  import { QueryClient } from "@tanstack/react-query";
9
11
  import { hydrateRoot } from "react-dom/client";
10
12
 
11
13
  //#region src/features/runtime/pageClient.tsx
14
+ /**
15
+ * Announces, as `camox:hydrated` on the window, that React hydrated the page: the look document
16
+ * waits on it before it marks itself ready (ADR 0032).
17
+ */
18
+ function AnnounceHydrated(t0) {
19
+ const $ = c(1);
20
+ const { children } = t0;
21
+ let t1;
22
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
23
+ t1 = [];
24
+ $[0] = t1;
25
+ } else t1 = $[0];
26
+ React.useEffect(_temp, t1);
27
+ return children;
28
+ }
29
+ function _temp() {
30
+ window.dispatchEvent(new window.Event("camox:hydrated"));
31
+ }
12
32
  async function hydratePageWithApp(camoxApp) {
13
33
  const root = document.getElementById("root");
14
34
  if (!root) throw new Error("Camox runtime root element was not found.");
@@ -23,12 +43,12 @@ async function hydratePageWithApp(camoxApp) {
23
43
  queryClient,
24
44
  browser: window
25
45
  });
26
- hydrateRoot(root, /* @__PURE__ */ jsx(PageApp, {
46
+ hydrateRoot(root, /* @__PURE__ */ jsx(AnnounceHydrated, { children: /* @__PURE__ */ jsx(PageApp, {
27
47
  camoxApp,
28
48
  draftScope,
29
49
  input,
30
50
  queryClient
31
- }));
51
+ }) }));
32
52
  }
33
53
 
34
54
  //#endregion
@@ -34,6 +34,16 @@ export interface PageRenderInput extends DraftRead {
34
34
  analytics?: AnalyticsProviders;
35
35
  /** Authenticate before rendering, to show the Studio around the page. */
36
36
  previewHandoff?: boolean;
37
+ /**
38
+ * The look document's Block Definition mode (ADR 0032): the id of the one block it shows, alone,
39
+ * instead of a page. Its block bundle is in the dehydrated state.
40
+ */
41
+ lookBlock?: string;
42
+ /**
43
+ * Whether this is the look document (ADR 0032), whose client only shows the draft: it asks
44
+ * nothing about a session and offers no sign-in, which would add requests to its captures.
45
+ */
46
+ look?: boolean;
37
47
  previewDocument?: string;
38
48
  routeKind?: StudioRouteKind;
39
49
  /** Whether the location is the Canvas with nothing selected, which only the Canvas shows. */