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.
- package/dist/core/editing/createEditableBlock.js +2 -1
- package/dist/features/canvas/canvasFrameDocument.js +25 -2
- package/dist/features/canvas/useCanvasFrame.js +6 -2
- package/dist/features/preview/components/PreviewToolbar.js +77 -68
- package/dist/features/preview/components/previewStyles.js +11 -2
- package/dist/features/preview/repeatableItemTargets.js +13 -7
- package/dist/features/provider/AuthenticatedCamoxProvider.js +33 -28
- package/dist/features/renderer/RendererApp.js +202 -154
- package/dist/features/renderer/RendererFrames.js +87 -55
- package/dist/features/renderer/definitionAnswers.js +1 -0
- package/dist/features/renderer/rendererHost.js +4 -0
- package/dist/features/renderer/studioConnection.js +9 -1
- package/dist/features/runtime/RuntimeChrome.js +47 -61
- package/dist/features/runtime/pageNavigation.js +93 -17
- package/dist/features/runtime/rendererClient.js +13 -6
- package/dist/features/studio/components/ChatWidget.js +3 -4
- package/dist/features/studio/components/ConnectAgent.js +33 -59
- package/dist/features/studio/components/DraftBar.js +139 -0
- package/dist/features/studio/components/DraftsControl.js +129 -164
- package/dist/features/studio/components/LocalePicker.js +22 -4
- package/dist/features/studio/components/Navbar.js +3 -2
- package/dist/features/studio/components/ReviewDraftSheet.js +2 -21
- package/dist/features/studio/components/UserButton.js +7 -11
- package/dist/features/studio/studioStore.js +0 -13
- package/dist/features/studio/viewSwitch.js +64 -0
- package/dist/lib/auth.js +5 -1
- package/dist/lib/draft-scope.js +28 -15
- package/dist/lib/studio-reads.js +46 -13
- package/dist/lib/view-switch.js +64 -0
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +4 -4
- 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 =
|
|
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(
|
|
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] !==
|
|
281
|
-
t3 = (
|
|
282
|
-
|
|
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
|
-
$[
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
292
|
-
} else
|
|
293
|
-
const navigate =
|
|
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
|
|
296
|
-
if ($[
|
|
297
|
-
|
|
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,
|
|
301
|
-
const immediate =
|
|
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
|
-
$[
|
|
311
|
-
$[
|
|
312
|
-
$[
|
|
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
|
|
350
|
+
const workspace = t5;
|
|
327
351
|
let t6;
|
|
328
|
-
if ($[12] !==
|
|
329
|
-
t6 =
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
$[
|
|
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
|
|
361
|
+
const frameContext = t6;
|
|
339
362
|
let t7;
|
|
340
363
|
if ($[15] !== connection || $[16] !== frameId) {
|
|
341
|
-
t7 = () => connection.send({
|
|
342
|
-
type: "
|
|
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
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
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
|
-
$[
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
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
|
-
$[
|
|
371
|
-
$[
|
|
372
|
-
$[
|
|
373
|
-
$[
|
|
374
|
-
$[
|
|
375
|
-
$[
|
|
376
|
-
$[
|
|
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
|
-
|
|
394
|
-
|
|
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 ($[
|
|
397
|
-
t13 = /* @__PURE__ */
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
$[
|
|
403
|
-
$[
|
|
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] !==
|
|
410
|
-
t14 = /* @__PURE__ */ jsx(
|
|
411
|
-
|
|
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] =
|
|
415
|
-
$[38] =
|
|
416
|
-
$[39] =
|
|
417
|
-
|
|
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 ($[
|
|
420
|
-
t15 = /* @__PURE__ */ jsx(
|
|
421
|
-
|
|
448
|
+
if ($[43] !== t14 || $[44] !== t9) {
|
|
449
|
+
t15 = /* @__PURE__ */ jsx(React.Activity, {
|
|
450
|
+
mode: t9,
|
|
422
451
|
children: t14
|
|
423
452
|
});
|
|
424
|
-
$[
|
|
425
|
-
$[
|
|
426
|
-
$[
|
|
427
|
-
} else t15 = $[
|
|
453
|
+
$[43] = t14;
|
|
454
|
+
$[44] = t9;
|
|
455
|
+
$[45] = t15;
|
|
456
|
+
} else t15 = $[45];
|
|
428
457
|
let t16;
|
|
429
|
-
if ($[
|
|
430
|
-
t16 = /* @__PURE__ */ jsx(
|
|
431
|
-
value: target.
|
|
458
|
+
if ($[46] !== t15 || $[47] !== target.artifactStudio) {
|
|
459
|
+
t16 = /* @__PURE__ */ jsx(ArtifactStudioContext, {
|
|
460
|
+
value: target.artifactStudio,
|
|
432
461
|
children: t15
|
|
433
462
|
});
|
|
434
|
-
$[
|
|
435
|
-
$[
|
|
436
|
-
$[
|
|
437
|
-
} else t16 = $[
|
|
463
|
+
$[46] = t15;
|
|
464
|
+
$[47] = target.artifactStudio;
|
|
465
|
+
$[48] = t16;
|
|
466
|
+
} else t16 = $[48];
|
|
438
467
|
let t17;
|
|
439
|
-
if ($[
|
|
440
|
-
t17 = /* @__PURE__ */ jsx(
|
|
441
|
-
value: target.
|
|
468
|
+
if ($[49] !== t16 || $[50] !== target.artifactsRun) {
|
|
469
|
+
t17 = /* @__PURE__ */ jsx(ArtifactsRunContext, {
|
|
470
|
+
value: target.artifactsRun,
|
|
442
471
|
children: t16
|
|
443
472
|
});
|
|
444
|
-
$[
|
|
445
|
-
$[
|
|
446
|
-
$[
|
|
447
|
-
} else t17 = $[
|
|
473
|
+
$[49] = t16;
|
|
474
|
+
$[50] = target.artifactsRun;
|
|
475
|
+
$[51] = t17;
|
|
476
|
+
} else t17 = $[51];
|
|
448
477
|
let t18;
|
|
449
|
-
if ($[
|
|
450
|
-
t18 = /* @__PURE__ */ jsx(
|
|
451
|
-
value:
|
|
478
|
+
if ($[52] !== t17 || $[53] !== target.editable) {
|
|
479
|
+
t18 = /* @__PURE__ */ jsx(EditableSurfaceContext, {
|
|
480
|
+
value: target.editable,
|
|
452
481
|
children: t17
|
|
453
482
|
});
|
|
454
|
-
$[
|
|
455
|
-
$[
|
|
456
|
-
$[
|
|
457
|
-
} else t18 = $[
|
|
483
|
+
$[52] = t17;
|
|
484
|
+
$[53] = target.editable;
|
|
485
|
+
$[54] = t18;
|
|
486
|
+
} else t18 = $[54];
|
|
458
487
|
let t19;
|
|
459
|
-
if ($[
|
|
460
|
-
t19 = /* @__PURE__ */ jsx(
|
|
461
|
-
value:
|
|
488
|
+
if ($[55] !== t18 || $[56] !== workspace) {
|
|
489
|
+
t19 = /* @__PURE__ */ jsx(CanvasWorkspaceContext, {
|
|
490
|
+
value: workspace,
|
|
462
491
|
children: t18
|
|
463
492
|
});
|
|
464
|
-
$[
|
|
465
|
-
$[
|
|
466
|
-
$[
|
|
467
|
-
} else t19 = $[
|
|
493
|
+
$[55] = t18;
|
|
494
|
+
$[56] = workspace;
|
|
495
|
+
$[57] = t19;
|
|
496
|
+
} else t19 = $[57];
|
|
468
497
|
let t20;
|
|
469
|
-
if ($[
|
|
470
|
-
t20 = /* @__PURE__ */ jsx(
|
|
471
|
-
value:
|
|
498
|
+
if ($[58] !== t19 || $[59] !== target.owner) {
|
|
499
|
+
t20 = /* @__PURE__ */ jsx(PreviewEditingOwnerContext, {
|
|
500
|
+
value: target.owner,
|
|
472
501
|
children: t19
|
|
473
502
|
});
|
|
474
|
-
$[
|
|
475
|
-
$[
|
|
476
|
-
$[
|
|
477
|
-
} else t20 = $[
|
|
503
|
+
$[58] = t19;
|
|
504
|
+
$[59] = target.owner;
|
|
505
|
+
$[60] = t20;
|
|
506
|
+
} else t20 = $[60];
|
|
478
507
|
let t21;
|
|
479
|
-
if ($[
|
|
480
|
-
t21 = /* @__PURE__ */ jsx(
|
|
481
|
-
|
|
482
|
-
navigate,
|
|
508
|
+
if ($[61] !== frameContext || $[62] !== t20) {
|
|
509
|
+
t21 = /* @__PURE__ */ jsx(FrameContext.Provider, {
|
|
510
|
+
value: frameContext,
|
|
483
511
|
children: t20
|
|
484
512
|
});
|
|
485
|
-
$[
|
|
486
|
-
$[
|
|
487
|
-
$[
|
|
488
|
-
|
|
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 ($[
|
|
493
|
-
t22 =
|
|
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
|
-
$[
|
|
498
|
-
$[
|
|
499
|
-
$[
|
|
500
|
-
} else
|
|
501
|
-
return
|
|
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 = {
|
|
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(
|
|
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
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
154
|
-
|
|
155
|
-
|
|
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] =
|
|
161
|
+
$[9] = host;
|
|
158
162
|
$[10] = t4;
|
|
159
|
-
|
|
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
|
-
|
|
162
|
-
|
|
178
|
+
t5 = $[13];
|
|
179
|
+
t6 = $[14];
|
|
163
180
|
}
|
|
164
|
-
React.useEffect(
|
|
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
|
|
168
|
-
let
|
|
169
|
-
if ($[
|
|
170
|
-
|
|
171
|
-
const { draftId } =
|
|
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
|
-
|
|
205
|
+
reload(true);
|
|
174
206
|
setLoads(_temp2);
|
|
175
207
|
});
|
|
176
|
-
|
|
208
|
+
t9 = [
|
|
177
209
|
revisions,
|
|
178
210
|
draftScope,
|
|
179
|
-
|
|
211
|
+
reload
|
|
180
212
|
];
|
|
181
|
-
$[
|
|
182
|
-
$[
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
213
|
+
$[17] = draftScope;
|
|
214
|
+
$[18] = reload;
|
|
215
|
+
$[19] = revisions;
|
|
216
|
+
$[20] = t8;
|
|
217
|
+
$[21] = t9;
|
|
186
218
|
} else {
|
|
187
|
-
|
|
188
|
-
|
|
219
|
+
t8 = $[20];
|
|
220
|
+
t9 = $[21];
|
|
189
221
|
}
|
|
190
|
-
React.useEffect(
|
|
191
|
-
let
|
|
192
|
-
if ($[
|
|
193
|
-
|
|
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
|
-
$[
|
|
197
|
-
$[
|
|
198
|
-
} else
|
|
199
|
-
const connect =
|
|
200
|
-
let
|
|
201
|
-
if ($[
|
|
202
|
-
|
|
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
|
-
$[
|
|
210
|
-
$[
|
|
211
|
-
$[
|
|
212
|
-
$[
|
|
213
|
-
$[
|
|
214
|
-
} else
|
|
215
|
-
let
|
|
216
|
-
if ($[
|
|
217
|
-
|
|
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,
|
|
251
|
+
children: [children, t11]
|
|
220
252
|
});
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
} else
|
|
226
|
-
return
|
|
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;
|