camox 0.67.0 → 0.69.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 (33) hide show
  1. package/dist/core/editing/createEditableBlock.js +2 -1
  2. package/dist/features/canvas/canvasFrameDocument.js +25 -2
  3. package/dist/features/canvas/useCanvasFrame.js +6 -2
  4. package/dist/features/preview/components/PreviewToolbar.js +77 -68
  5. package/dist/features/preview/components/previewStyles.js +11 -2
  6. package/dist/features/preview/repeatableItemTargets.js +13 -7
  7. package/dist/features/provider/AuthenticatedCamoxProvider.js +33 -28
  8. package/dist/features/renderer/RendererApp.js +202 -154
  9. package/dist/features/renderer/RendererFrames.js +87 -55
  10. package/dist/features/renderer/definitionAnswers.js +1 -0
  11. package/dist/features/renderer/rendererHost.js +4 -0
  12. package/dist/features/renderer/studioConnection.js +9 -1
  13. package/dist/features/runtime/RuntimeChrome.js +47 -61
  14. package/dist/features/runtime/pageNavigation.js +93 -17
  15. package/dist/features/runtime/rendererClient.js +13 -6
  16. package/dist/features/studio/components/ChatWidget.js +3 -4
  17. package/dist/features/studio/components/ConnectAgent.js +33 -59
  18. package/dist/features/studio/components/DraftBar.js +139 -0
  19. package/dist/features/studio/components/DraftsControl.js +129 -164
  20. package/dist/features/studio/components/LocalePicker.js +22 -4
  21. package/dist/features/studio/components/Navbar.js +3 -2
  22. package/dist/features/studio/components/ReviewDraftSheet.js +2 -21
  23. package/dist/features/studio/components/UserButton.js +7 -11
  24. package/dist/features/studio/studioStore.js +0 -13
  25. package/dist/features/studio/viewSwitch.js +64 -0
  26. package/dist/lib/auth.js +5 -1
  27. package/dist/lib/draft-scope.js +28 -15
  28. package/dist/lib/studio-reads.js +46 -13
  29. package/dist/lib/view-switch.js +64 -0
  30. package/dist/package.js +1 -1
  31. package/dist/studio.css +1 -1
  32. package/package.json +4 -4
  33. package/dist/features/studio/components/UnnamedDraftBar.js +0 -349
@@ -1,3 +1,4 @@
1
+ import { parseLocalePath } from "../../lib/locale-path.js";
1
2
  import { ViewLocaleContext } from "../../lib/view-locale-context.js";
2
3
  import { NavigationProvider } from "../navigation/navigation.js";
3
4
  import { reads, useRead } from "../../lib/studio-reads.js";
@@ -31,7 +32,7 @@ import { createPortal } from "react-dom";
31
32
  function RendererApp(t0) {
32
33
  const $ = c(27);
33
34
  const { connection, camoxApp, codeLoaded, projectUuid, runtimeBasePath } = t0;
34
- const frames = React.useSyncExternalStore(connection.subscribe, connection.frames, connection.frames);
35
+ const frames = useFrames(connection);
35
36
  const thumbnails = React.useSyncExternalStore(connection.subscribe, connection.thumbnails, connection.thumbnails);
36
37
  const t1 = connection.edit;
37
38
  let t2;
@@ -111,6 +112,32 @@ function RendererApp(t0) {
111
112
  } else t6 = $[26];
112
113
  return t6;
113
114
  }
115
+ /**
116
+ * The frames the studio gives the renderer to fill. Each change renders in a transition, so a
117
+ * frame switching to another page or locale keeps showing the last one until the next loads.
118
+ */
119
+ function useFrames(connection) {
120
+ const $ = c(3);
121
+ const [frames, setFrames] = React.useState(connection.frames);
122
+ let t0;
123
+ let t1;
124
+ if ($[0] !== connection) {
125
+ t0 = () => {
126
+ const follow = () => React.startTransition(() => setFrames(connection.frames()));
127
+ follow();
128
+ return connection.subscribe(follow);
129
+ };
130
+ t1 = [connection];
131
+ $[0] = connection;
132
+ $[1] = t0;
133
+ $[2] = t1;
134
+ } else {
135
+ t0 = $[1];
136
+ t1 = $[2];
137
+ }
138
+ React.useEffect(t0, t1);
139
+ return frames;
140
+ }
114
141
  /** A block's thumbnail, rendered by the draft's code into its frame: nothing for a block it lacks. */
115
142
  function RendererThumbnail(t0) {
116
143
  const $ = c(17);
@@ -263,7 +290,7 @@ function locationOf(href) {
263
290
  }
264
291
  /** One frame's page, with what the studio says of the frame around it. */
265
292
  function RendererFrameContent(t0) {
266
- const $ = c(65);
293
+ const $ = c(71);
267
294
  const { frame: t1, connection, camoxApp, codeLoaded, projectUuid, runtimeBasePath } = t0;
268
295
  const { frameId, slot, target } = t1;
269
296
  const frameWindow = slot.ownerDocument.defaultView;
@@ -277,28 +304,36 @@ function RendererFrameContent(t0) {
277
304
  } else t2 = $[1];
278
305
  const location = t2;
279
306
  let t3;
280
- if ($[2] !== connection || $[3] !== frameId) {
281
- t3 = (t4) => {
282
- const { to } = t4;
307
+ if ($[2] !== target.locale || $[3] !== target.pathname) {
308
+ t3 = target.locale ? parseLocalePath(target.pathname, target.locale.locales).path : target.pathname;
309
+ $[2] = target.locale;
310
+ $[3] = target.pathname;
311
+ $[4] = t3;
312
+ } else t3 = $[4];
313
+ const page = t3;
314
+ let t4;
315
+ if ($[5] !== connection || $[6] !== frameId) {
316
+ t4 = (t5) => {
317
+ const { to } = t5;
283
318
  return connection.send({
284
319
  type: "navigate",
285
320
  frameId,
286
321
  to
287
322
  });
288
323
  };
289
- $[2] = connection;
290
- $[3] = frameId;
291
- $[4] = t3;
292
- } else t3 = $[4];
293
- const navigate = t3;
324
+ $[5] = connection;
325
+ $[6] = frameId;
326
+ $[7] = t4;
327
+ } else t4 = $[7];
328
+ const navigate = t4;
294
329
  const workspaceKey = target.canvas?.workspaceKey;
295
- let t4;
296
- if ($[5] !== connection || $[6] !== frameId || $[7] !== workspaceKey) {
297
- t4 = workspaceKey === void 0 ? null : {
330
+ let t5;
331
+ if ($[8] !== connection || $[9] !== frameId || $[10] !== workspaceKey) {
332
+ t5 = workspaceKey === void 0 ? null : {
298
333
  workspaceKey,
299
334
  mirrorCamera: _temp2,
300
- reveal: (element, t5) => {
301
- const immediate = t5 === void 0 ? false : t5;
335
+ reveal: (element, t6) => {
336
+ const immediate = t6 === void 0 ? false : t6;
302
337
  return connection.send({
303
338
  type: "reveal",
304
339
  frameId,
@@ -307,58 +342,59 @@ function RendererFrameContent(t0) {
307
342
  });
308
343
  }
309
344
  };
310
- $[5] = connection;
311
- $[6] = frameId;
312
- $[7] = workspaceKey;
313
- $[8] = t4;
314
- } else t4 = $[8];
315
- const workspace = t4;
316
- let t5;
317
- if ($[9] !== frameElement || $[10] !== frameWindow) {
318
- t5 = {
319
- window: frameWindow,
320
- iframeElement: frameElement
321
- };
322
- $[9] = frameElement;
323
- $[10] = frameWindow;
345
+ $[8] = connection;
346
+ $[9] = frameId;
347
+ $[10] = workspaceKey;
324
348
  $[11] = t5;
325
349
  } else t5 = $[11];
326
- const frameContext = t5;
350
+ const workspace = t5;
327
351
  let t6;
328
- if ($[12] !== connection || $[13] !== frameId) {
329
- t6 = (message) => connection.send({
330
- type: "error",
331
- frameId,
332
- message
333
- });
334
- $[12] = connection;
335
- $[13] = frameId;
352
+ if ($[12] !== frameElement || $[13] !== frameWindow) {
353
+ t6 = {
354
+ window: frameWindow,
355
+ iframeElement: frameElement
356
+ };
357
+ $[12] = frameElement;
358
+ $[13] = frameWindow;
336
359
  $[14] = t6;
337
360
  } else t6 = $[14];
338
- const failed = t6;
361
+ const frameContext = t6;
339
362
  let t7;
340
363
  if ($[15] !== connection || $[16] !== frameId) {
341
- t7 = () => connection.send({
342
- type: "rendered",
343
- frameId
364
+ t7 = (message) => connection.send({
365
+ type: "error",
366
+ frameId,
367
+ message
344
368
  });
345
369
  $[15] = connection;
346
370
  $[16] = frameId;
347
371
  $[17] = t7;
348
372
  } else t7 = $[17];
349
- const rendered = t7;
350
- const t8 = target.resting ? "hidden" : "visible";
351
- let t9;
352
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
353
- t9 = /* @__PURE__ */ jsx("div", {
373
+ const failed = t7;
374
+ let t8;
375
+ if ($[18] !== connection || $[19] !== frameId) {
376
+ t8 = () => connection.send({
377
+ type: "rendered",
378
+ frameId
379
+ });
380
+ $[18] = connection;
381
+ $[19] = frameId;
382
+ $[20] = t8;
383
+ } else t8 = $[20];
384
+ const rendered = t8;
385
+ const t9 = target.resting ? "hidden" : "visible";
386
+ let t10;
387
+ if ($[21] !== left.length) {
388
+ t10 = left.length ? null : /* @__PURE__ */ jsx("div", {
354
389
  role: "status",
355
390
  children: "Loading page…"
356
391
  });
357
- $[18] = t9;
358
- } else t9 = $[18];
359
- let t10;
360
- if ($[19] !== camoxApp || $[20] !== codeLoaded || $[21] !== projectUuid || $[22] !== rendered || $[23] !== runtimeBasePath || $[24] !== target.derivedLayoutId || $[25] !== target.pathname) {
361
- t10 = /* @__PURE__ */ jsx(FramePage, {
392
+ $[21] = left.length;
393
+ $[22] = t10;
394
+ } else t10 = $[22];
395
+ let t11;
396
+ if ($[23] !== camoxApp || $[24] !== codeLoaded || $[25] !== projectUuid || $[26] !== rendered || $[27] !== runtimeBasePath || $[28] !== target.derivedLayoutId || $[29] !== target.pathname) {
397
+ t11 = /* @__PURE__ */ jsx(FramePage, {
362
398
  camoxApp,
363
399
  codeLoaded,
364
400
  projectUuid,
@@ -367,138 +403,141 @@ function RendererFrameContent(t0) {
367
403
  derivedLayoutId: target.derivedLayoutId,
368
404
  onRendered: rendered
369
405
  });
370
- $[19] = camoxApp;
371
- $[20] = codeLoaded;
372
- $[21] = projectUuid;
373
- $[22] = rendered;
374
- $[23] = runtimeBasePath;
375
- $[24] = target.derivedLayoutId;
376
- $[25] = target.pathname;
377
- $[26] = t10;
378
- } else t10 = $[26];
379
- let t11;
380
- if ($[27] !== left) {
381
- t11 = /* @__PURE__ */ jsx(RemovesLeft, { nodes: left });
382
- $[27] = left;
383
- $[28] = t11;
384
- } else t11 = $[28];
385
- let t12;
386
- if ($[29] !== t10 || $[30] !== t11) {
387
- t12 = /* @__PURE__ */ jsxs(React.Suspense, {
388
- fallback: t9,
389
- children: [t10, t11]
390
- });
391
- $[29] = t10;
406
+ $[23] = camoxApp;
407
+ $[24] = codeLoaded;
408
+ $[25] = projectUuid;
409
+ $[26] = rendered;
410
+ $[27] = runtimeBasePath;
411
+ $[28] = target.derivedLayoutId;
412
+ $[29] = target.pathname;
392
413
  $[30] = t11;
393
- $[31] = t12;
394
- } else t12 = $[31];
414
+ } else t11 = $[30];
415
+ let t12;
416
+ if ($[31] !== left) {
417
+ t12 = /* @__PURE__ */ jsx(RemovesLeft, { nodes: left });
418
+ $[31] = left;
419
+ $[32] = t12;
420
+ } else t12 = $[32];
395
421
  let t13;
396
- if ($[32] !== failed || $[33] !== left || $[34] !== t12 || $[35] !== target.pathname) {
397
- t13 = /* @__PURE__ */ jsx(FrameErrorBoundary, {
398
- onError: failed,
399
- left,
400
- children: t12
401
- }, target.pathname);
402
- $[32] = failed;
403
- $[33] = left;
404
- $[34] = t12;
405
- $[35] = target.pathname;
422
+ if ($[33] !== t10 || $[34] !== t11 || $[35] !== t12) {
423
+ t13 = /* @__PURE__ */ jsxs(React.Suspense, {
424
+ fallback: t10,
425
+ children: [t11, t12]
426
+ });
427
+ $[33] = t10;
428
+ $[34] = t11;
429
+ $[35] = t12;
406
430
  $[36] = t13;
407
431
  } else t13 = $[36];
408
432
  let t14;
409
- if ($[37] !== t13 || $[38] !== t8) {
410
- t14 = /* @__PURE__ */ jsx(React.Activity, {
411
- mode: t8,
433
+ if ($[37] !== failed || $[38] !== left || $[39] !== page || $[40] !== t13 || $[41] !== target.pathname) {
434
+ t14 = /* @__PURE__ */ jsx(FrameErrorBoundary, {
435
+ pathname: target.pathname,
436
+ onError: failed,
437
+ left,
412
438
  children: t13
413
- });
414
- $[37] = t13;
415
- $[38] = t8;
416
- $[39] = t14;
417
- } else t14 = $[39];
439
+ }, page);
440
+ $[37] = failed;
441
+ $[38] = left;
442
+ $[39] = page;
443
+ $[40] = t13;
444
+ $[41] = target.pathname;
445
+ $[42] = t14;
446
+ } else t14 = $[42];
418
447
  let t15;
419
- if ($[40] !== t14 || $[41] !== target.artifactStudio) {
420
- t15 = /* @__PURE__ */ jsx(ArtifactStudioContext, {
421
- value: target.artifactStudio,
448
+ if ($[43] !== t14 || $[44] !== t9) {
449
+ t15 = /* @__PURE__ */ jsx(React.Activity, {
450
+ mode: t9,
422
451
  children: t14
423
452
  });
424
- $[40] = t14;
425
- $[41] = target.artifactStudio;
426
- $[42] = t15;
427
- } else t15 = $[42];
453
+ $[43] = t14;
454
+ $[44] = t9;
455
+ $[45] = t15;
456
+ } else t15 = $[45];
428
457
  let t16;
429
- if ($[43] !== t15 || $[44] !== target.artifactsRun) {
430
- t16 = /* @__PURE__ */ jsx(ArtifactsRunContext, {
431
- value: target.artifactsRun,
458
+ if ($[46] !== t15 || $[47] !== target.artifactStudio) {
459
+ t16 = /* @__PURE__ */ jsx(ArtifactStudioContext, {
460
+ value: target.artifactStudio,
432
461
  children: t15
433
462
  });
434
- $[43] = t15;
435
- $[44] = target.artifactsRun;
436
- $[45] = t16;
437
- } else t16 = $[45];
463
+ $[46] = t15;
464
+ $[47] = target.artifactStudio;
465
+ $[48] = t16;
466
+ } else t16 = $[48];
438
467
  let t17;
439
- if ($[46] !== t16 || $[47] !== target.editable) {
440
- t17 = /* @__PURE__ */ jsx(EditableSurfaceContext, {
441
- value: target.editable,
468
+ if ($[49] !== t16 || $[50] !== target.artifactsRun) {
469
+ t17 = /* @__PURE__ */ jsx(ArtifactsRunContext, {
470
+ value: target.artifactsRun,
442
471
  children: t16
443
472
  });
444
- $[46] = t16;
445
- $[47] = target.editable;
446
- $[48] = t17;
447
- } else t17 = $[48];
473
+ $[49] = t16;
474
+ $[50] = target.artifactsRun;
475
+ $[51] = t17;
476
+ } else t17 = $[51];
448
477
  let t18;
449
- if ($[49] !== t17 || $[50] !== workspace) {
450
- t18 = /* @__PURE__ */ jsx(CanvasWorkspaceContext, {
451
- value: workspace,
478
+ if ($[52] !== t17 || $[53] !== target.editable) {
479
+ t18 = /* @__PURE__ */ jsx(EditableSurfaceContext, {
480
+ value: target.editable,
452
481
  children: t17
453
482
  });
454
- $[49] = t17;
455
- $[50] = workspace;
456
- $[51] = t18;
457
- } else t18 = $[51];
483
+ $[52] = t17;
484
+ $[53] = target.editable;
485
+ $[54] = t18;
486
+ } else t18 = $[54];
458
487
  let t19;
459
- if ($[52] !== t18 || $[53] !== target.owner) {
460
- t19 = /* @__PURE__ */ jsx(PreviewEditingOwnerContext, {
461
- value: target.owner,
488
+ if ($[55] !== t18 || $[56] !== workspace) {
489
+ t19 = /* @__PURE__ */ jsx(CanvasWorkspaceContext, {
490
+ value: workspace,
462
491
  children: t18
463
492
  });
464
- $[52] = t18;
465
- $[53] = target.owner;
466
- $[54] = t19;
467
- } else t19 = $[54];
493
+ $[55] = t18;
494
+ $[56] = workspace;
495
+ $[57] = t19;
496
+ } else t19 = $[57];
468
497
  let t20;
469
- if ($[55] !== frameContext || $[56] !== t19) {
470
- t20 = /* @__PURE__ */ jsx(FrameContext.Provider, {
471
- value: frameContext,
498
+ if ($[58] !== t19 || $[59] !== target.owner) {
499
+ t20 = /* @__PURE__ */ jsx(PreviewEditingOwnerContext, {
500
+ value: target.owner,
472
501
  children: t19
473
502
  });
474
- $[55] = frameContext;
475
- $[56] = t19;
476
- $[57] = t20;
477
- } else t20 = $[57];
503
+ $[58] = t19;
504
+ $[59] = target.owner;
505
+ $[60] = t20;
506
+ } else t20 = $[60];
478
507
  let t21;
479
- if ($[58] !== location || $[59] !== navigate || $[60] !== t20) {
480
- t21 = /* @__PURE__ */ jsx(NavigationProvider, {
481
- location,
482
- navigate,
508
+ if ($[61] !== frameContext || $[62] !== t20) {
509
+ t21 = /* @__PURE__ */ jsx(FrameContext.Provider, {
510
+ value: frameContext,
483
511
  children: t20
484
512
  });
485
- $[58] = location;
486
- $[59] = navigate;
487
- $[60] = t20;
488
- $[61] = t21;
489
- } else t21 = $[61];
490
- const content = t21;
513
+ $[61] = frameContext;
514
+ $[62] = t20;
515
+ $[63] = t21;
516
+ } else t21 = $[63];
491
517
  let t22;
492
- if ($[62] !== content || $[63] !== target.locale) {
493
- t22 = target.locale ? /* @__PURE__ */ jsx(ViewLocaleContext, {
518
+ if ($[64] !== location || $[65] !== navigate || $[66] !== t21) {
519
+ t22 = /* @__PURE__ */ jsx(NavigationProvider, {
520
+ location,
521
+ navigate,
522
+ children: t21
523
+ });
524
+ $[64] = location;
525
+ $[65] = navigate;
526
+ $[66] = t21;
527
+ $[67] = t22;
528
+ } else t22 = $[67];
529
+ const content = t22;
530
+ let t23;
531
+ if ($[68] !== content || $[69] !== target.locale) {
532
+ t23 = target.locale ? /* @__PURE__ */ jsx(ViewLocaleContext, {
494
533
  value: target.locale,
495
534
  children: content
496
535
  }) : content;
497
- $[62] = content;
498
- $[63] = target.locale;
499
- $[64] = t22;
500
- } else t22 = $[64];
501
- return t22;
536
+ $[68] = content;
537
+ $[69] = target.locale;
538
+ $[70] = t23;
539
+ } else t23 = $[70];
540
+ return t23;
502
541
  }
503
542
  function _temp2() {
504
543
  return _temp;
@@ -606,10 +645,19 @@ const ERROR_STYLE = {
606
645
  * the studio. The studio and every other frame keep working.
607
646
  */
608
647
  var FrameErrorBoundary = class extends React.Component {
609
- state = { error: null };
648
+ state = {
649
+ error: null,
650
+ pathname: this.props.pathname
651
+ };
610
652
  static getDerivedStateFromError(error) {
611
653
  return { error: messageOf(error) };
612
654
  }
655
+ static getDerivedStateFromProps(props, state) {
656
+ return props.pathname === state.pathname ? null : {
657
+ error: null,
658
+ pathname: props.pathname
659
+ };
660
+ }
613
661
  componentDidCatch(error) {
614
662
  this.props.onError(messageOf(error));
615
663
  }
@@ -2,6 +2,7 @@ import { useDraftScope } from "../../lib/draft-scope.js";
2
2
  import { ViewLocaleContext } from "../../lib/view-locale-context.js";
3
3
  import { useLocation, useNavigate } from "../navigation/navigation.js";
4
4
  import { runtimePath } from "../runtime/navigationTarget.js";
5
+ import { useViewPreparer } from "../../lib/view-switch.js";
5
6
  import { useStudioCache } from "../../lib/studio-reads.js";
6
7
  import { ArtifactStudioContext, ArtifactsRunContext } from "../../core/hooks/useArtifactHost.js";
7
8
  import { EditableSurfaceContext } from "../../core/hooks/useIsEditable.js";
@@ -102,7 +103,7 @@ function _temp() {}
102
103
  * the studio keeps the Canvas position and selection, and tells the new renderer.
103
104
  */
104
105
  function RendererFramesProvider(t0) {
105
- const $ = c(28);
106
+ const $ = c(33);
106
107
  const { runtimeBasePath, children } = t0;
107
108
  const queryClient = useQueryClient();
108
109
  const studioCache = useStudioCache();
@@ -145,85 +146,116 @@ function RendererFramesProvider(t0) {
145
146
  } else t3 = $[7];
146
147
  const documentUrl = t3;
147
148
  const [source, setSource] = React.useState(documentUrl);
149
+ const loaded = React.useRef(source);
148
150
  let t4;
149
- let t5;
150
- if ($[8] !== documentUrl || $[9] !== draftScope) {
151
- t4 = () => draftScope.subscribe((t6) => {
152
- const { move } = t6;
153
- if (move !== "started") setSource(documentUrl());
154
- });
155
- t5 = [draftScope, documentUrl];
151
+ if ($[8] !== documentUrl || $[9] !== host) {
152
+ t4 = (t5) => {
153
+ const always = t5 === void 0 ? false : t5;
154
+ const next = documentUrl();
155
+ if (next === loaded.current && !always) return;
156
+ loaded.current = next;
157
+ host?.replacing();
158
+ setSource(next);
159
+ };
156
160
  $[8] = documentUrl;
157
- $[9] = draftScope;
161
+ $[9] = host;
158
162
  $[10] = t4;
159
- $[11] = t5;
163
+ } else t4 = $[10];
164
+ const reload = t4;
165
+ let t5;
166
+ let t6;
167
+ if ($[11] !== draftScope || $[12] !== reload) {
168
+ t5 = () => draftScope.subscribe((t7) => {
169
+ const { move } = t7;
170
+ if (move !== "started") reload();
171
+ });
172
+ t6 = [draftScope, reload];
173
+ $[11] = draftScope;
174
+ $[12] = reload;
175
+ $[13] = t5;
176
+ $[14] = t6;
160
177
  } else {
161
- t4 = $[10];
162
- t5 = $[11];
178
+ t5 = $[13];
179
+ t6 = $[14];
163
180
  }
164
- React.useEffect(t4, t5);
181
+ React.useEffect(t5, t6);
182
+ let t7;
183
+ if ($[15] !== host) {
184
+ t7 = (next_0) => {
185
+ if (!host) return Promise.resolve();
186
+ return host.ask({
187
+ type: "prepareFrame",
188
+ pathname: next_0.pathname,
189
+ ...next_0.derivedLayoutId && { derivedLayoutId: next_0.derivedLayoutId },
190
+ locale: next_0.locale
191
+ });
192
+ };
193
+ $[15] = host;
194
+ $[16] = t7;
195
+ } else t7 = $[16];
196
+ useViewPreparer(t7);
165
197
  const [loads, setLoads] = React.useState(0);
166
198
  const revisions = React.use(RevisionsContext);
167
- let t6;
168
- let t7;
169
- if ($[12] !== documentUrl || $[13] !== draftScope || $[14] !== revisions) {
170
- t6 = () => revisions?.subscribe((t8) => {
171
- const { draftId } = t8;
199
+ let t8;
200
+ let t9;
201
+ if ($[17] !== draftScope || $[18] !== reload || $[19] !== revisions) {
202
+ t8 = () => revisions?.subscribe((t10) => {
203
+ const { draftId } = t10;
172
204
  if (draftId !== draftScope.current()) return;
173
- setSource(documentUrl());
205
+ reload(true);
174
206
  setLoads(_temp2);
175
207
  });
176
- t7 = [
208
+ t9 = [
177
209
  revisions,
178
210
  draftScope,
179
- documentUrl
211
+ reload
180
212
  ];
181
- $[12] = documentUrl;
182
- $[13] = draftScope;
183
- $[14] = revisions;
184
- $[15] = t6;
185
- $[16] = t7;
213
+ $[17] = draftScope;
214
+ $[18] = reload;
215
+ $[19] = revisions;
216
+ $[20] = t8;
217
+ $[21] = t9;
186
218
  } else {
187
- t6 = $[15];
188
- t7 = $[16];
219
+ t8 = $[20];
220
+ t9 = $[21];
189
221
  }
190
- React.useEffect(t6, t7);
191
- let t8;
192
- if ($[17] !== host) {
193
- t8 = (frame) => {
222
+ React.useEffect(t8, t9);
223
+ let t10;
224
+ if ($[22] !== host) {
225
+ t10 = (frame) => {
194
226
  if (frame && host) frame[STUDIO_HANDLE_KEY] = host.handle;
195
227
  };
196
- $[17] = host;
197
- $[18] = t8;
198
- } else t8 = $[18];
199
- const connect = t8;
200
- let t9;
201
- if ($[19] !== connect || $[20] !== host || $[21] !== loads || $[22] !== source) {
202
- t9 = host && /* @__PURE__ */ jsx("iframe", {
228
+ $[22] = host;
229
+ $[23] = t10;
230
+ } else t10 = $[23];
231
+ const connect = t10;
232
+ let t11;
233
+ if ($[24] !== connect || $[25] !== host || $[26] !== loads || $[27] !== source) {
234
+ t11 = host && /* @__PURE__ */ jsx("iframe", {
203
235
  ref: connect,
204
236
  src: source,
205
237
  hidden: true,
206
238
  title: "Website renderer",
207
239
  "data-camox-renderer": true
208
240
  }, `${source}#${loads}`);
209
- $[19] = connect;
210
- $[20] = host;
211
- $[21] = loads;
212
- $[22] = source;
213
- $[23] = t9;
214
- } else t9 = $[23];
215
- let t10;
216
- if ($[24] !== children || $[25] !== host || $[26] !== t9) {
217
- t10 = /* @__PURE__ */ jsxs(RendererHostContext, {
241
+ $[24] = connect;
242
+ $[25] = host;
243
+ $[26] = loads;
244
+ $[27] = source;
245
+ $[28] = t11;
246
+ } else t11 = $[28];
247
+ let t12;
248
+ if ($[29] !== children || $[30] !== host || $[31] !== t11) {
249
+ t12 = /* @__PURE__ */ jsxs(RendererHostContext, {
218
250
  value: host,
219
- children: [children, t9]
251
+ children: [children, t11]
220
252
  });
221
- $[24] = children;
222
- $[25] = host;
223
- $[26] = t9;
224
- $[27] = t10;
225
- } else t10 = $[27];
226
- return t10;
253
+ $[29] = children;
254
+ $[30] = host;
255
+ $[31] = t11;
256
+ $[32] = t12;
257
+ } else t12 = $[32];
258
+ return t12;
227
259
  }
228
260
  function _temp2(count) {
229
261
  return count + 1;
@@ -10,6 +10,7 @@ async function blockOfCode(camoxApp, type) {
10
10
  async function answerFromCode(camoxApp, question) {
11
11
  switch (question.type) {
12
12
  case "initialBundle": return (await blockOfCode(camoxApp, question.blockType))?._internal.getInitialBundle() ?? null;
13
+ case "prepareFrame": return null;
13
14
  case "pageTitle": {
14
15
  const layout = camoxApp.getLayoutById(question.layoutId);
15
16
  if (!layout) return null;
@@ -194,6 +194,10 @@ function createRendererHost({ studioCache, draftScope, queryClient, notify } = {
194
194
  frameId
195
195
  });
196
196
  },
197
+ replacing() {
198
+ renderer = null;
199
+ welcomed = false;
200
+ },
197
201
  ask(question) {
198
202
  return new Promise((resolve, reject) => {
199
203
  const askId = ++lastAskId;