camox 0.63.0 → 0.65.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.
Files changed (41) 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/canvasCamera.js +11 -2
  6. package/dist/features/canvas/useCanvasCamera.js +14 -10
  7. package/dist/features/page/CuratedPageContent.js +2 -1
  8. package/dist/features/page/UnplacedBlockContent.js +52 -0
  9. package/dist/features/preview/components/PreviewPanel.js +40 -12
  10. package/dist/features/preview/components/SidebarStack.js +78 -9
  11. package/dist/features/preview/strayCaretGuard.js +34 -0
  12. package/dist/features/provider/CoreCamoxProvider.js +5 -3
  13. package/dist/features/routes/pageRuntime.d.ts +2 -0
  14. package/dist/features/routes/pageRuntime.js +8 -5
  15. package/dist/features/runtime/pageApp.js +111 -74
  16. package/dist/features/runtime/pageClient.js +22 -2
  17. package/dist/features/runtime/runtime.d.ts +10 -0
  18. package/dist/features/runtime/runtime.js +314 -4
  19. package/dist/features/runtime/runtimeRoutes.d.ts +5 -0
  20. package/dist/features/runtime/runtimeRoutes.js +5 -0
  21. package/dist/features/studio/components/ChatWidget.js +88 -62
  22. package/dist/features/studio/components/ConnectAgent.js +313 -0
  23. package/dist/features/studio/components/Patrol.js +455 -205
  24. package/dist/features/studio/components/ReviewDraftSheet.js +431 -334
  25. package/dist/features/studio/components/Squareling.js +74 -41
  26. package/dist/features/studio/components/ThreadComposer.js +130 -107
  27. package/dist/features/studio/components/ThreadMessages.js +82 -13
  28. package/dist/features/studio/components/clientLogoPaths.js +10 -0
  29. package/dist/features/studio/findingSentence.js +37 -0
  30. package/dist/features/studio/reportSentence.js +15 -0
  31. package/dist/features/studio/studioStore.js +23 -1
  32. package/dist/features/studio/workingSentence.js +8 -0
  33. package/dist/lib/api-client.d.ts +1 -0
  34. package/dist/lib/auth.js +34 -32
  35. package/dist/lib/queries.js +9 -1
  36. package/dist/lib/server-auth-cookie.js +17 -4
  37. package/dist/lib/studio-reads.d.ts +1 -1
  38. package/dist/lib/studio-reads.js +5 -1
  39. package/dist/package.js +1 -1
  40. package/dist/studio.css +1 -1
  41. package/package.json +15 -4
@@ -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. */