camox 0.41.0 → 0.41.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.
- package/dist/core/createApp.d.ts +2 -2
- package/dist/core/createBlock.js +11 -25
- package/dist/core/createLayout.d.ts +1 -1
- package/dist/core/editing/BlockEditingRuntime.js +4 -4
- package/dist/core/editing/CompleteBlockEditingRuntime.js +5 -5
- package/dist/core/editing/createEditableBlock.js +169 -306
- package/dist/core/hooks/useIsEditable.js +4 -7
- package/dist/core/hooks/useRequireDraftSource.js +7 -11
- package/dist/features/preview/CamoxPreview.js +59 -80
- package/dist/features/preview/DerivedPreview.js +6 -9
- package/dist/features/preview/components/BlockActionsPopover.js +8 -8
- package/dist/features/preview/components/DerivedLayoutSidebar.js +4 -7
- package/dist/features/preview/components/LinkFieldEditor.js +3 -4
- package/dist/features/preview/components/MobilePreviewDrawer.js +3 -3
- package/dist/features/preview/components/Overlays.js +6 -9
- package/dist/features/preview/components/PageEditorSidebar.js +194 -203
- package/dist/features/preview/components/PageTree.js +162 -228
- package/dist/features/preview/components/PreviewPanel.js +39 -41
- package/dist/features/preview/components/PreviewToolbar.js +15 -18
- package/dist/features/preview/components/PreviewToolbarSpacer.js +43 -0
- package/dist/features/preview/components/PublicationRow.js +11 -17
- package/dist/features/preview/previewStore.js +18 -29
- package/dist/features/provider/useAdminShortcuts.js +5 -4
- package/dist/features/runtime/RuntimeChrome.js +98 -86
- package/dist/features/studio/components/UserButton.js +4 -4
- package/package.json +4 -4
- package/dist/features/preview/components/DraftSwitchDialog.js +0 -66
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { usePageBlocks } from "../../../lib/normalized-data.js";
|
|
2
2
|
import { cn } from "../../../lib/utils.js";
|
|
3
3
|
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
4
|
-
import { previewStore } from "../previewStore.js";
|
|
4
|
+
import { previewStore, selectPreviewSource } from "../previewStore.js";
|
|
5
5
|
import { useRequireDraftSource } from "../../../core/hooks/useRequireDraftSource.js";
|
|
6
6
|
import { useUpdateBlockPosition } from "./useUpdateBlockPosition.js";
|
|
7
7
|
import { BlockActionsPopover } from "./BlockActionsPopover.js";
|
|
@@ -21,22 +21,22 @@ import { CSS } from "@dnd-kit/utilities";
|
|
|
21
21
|
//#region src/features/preview/components/PageTree.tsx
|
|
22
22
|
const usePreviewSource = () => {
|
|
23
23
|
const $ = c(1);
|
|
24
|
-
if ($[0] !== "
|
|
24
|
+
if ($[0] !== "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d") {
|
|
25
25
|
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
26
|
-
$[0] = "
|
|
26
|
+
$[0] = "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d";
|
|
27
27
|
}
|
|
28
|
-
return useSelector(previewStore,
|
|
28
|
+
return useSelector(previewStore, selectPreviewSource);
|
|
29
29
|
};
|
|
30
30
|
function useBlockTreeItem(block, t0) {
|
|
31
31
|
const $ = c(17);
|
|
32
|
-
if ($[0] !== "
|
|
32
|
+
if ($[0] !== "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d") {
|
|
33
33
|
for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
34
|
-
$[0] = "
|
|
34
|
+
$[0] = "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d";
|
|
35
35
|
}
|
|
36
36
|
const isDragging = t0 === void 0 ? false : t0;
|
|
37
37
|
const [ellipsisPopoverOpen, setEllipsisPopoverOpen] = React.useState(false);
|
|
38
|
-
const selection = useSelector(previewStore,
|
|
39
|
-
const iframeElement = useSelector(previewStore,
|
|
38
|
+
const selection = useSelector(previewStore, _temp);
|
|
39
|
+
const iframeElement = useSelector(previewStore, _temp2);
|
|
40
40
|
const isBlockActive = selection?.blockId === block.id;
|
|
41
41
|
const isBlockSelected = selection?.type === "block" && selection.blockId === block.id;
|
|
42
42
|
const shouldShowHover = !isDragging && !isBlockActive;
|
|
@@ -106,17 +106,17 @@ function useBlockTreeItem(block, t0) {
|
|
|
106
106
|
} else t4 = $[16];
|
|
107
107
|
return t4;
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function _temp2(state_0) {
|
|
110
110
|
return state_0.context.iframeElement;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function _temp(state) {
|
|
113
113
|
return state.context.selection;
|
|
114
114
|
}
|
|
115
115
|
const BlockTreeItemHeader = (t0) => {
|
|
116
116
|
const $ = c(17);
|
|
117
|
-
if ($[0] !== "
|
|
117
|
+
if ($[0] !== "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d") {
|
|
118
118
|
for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
119
|
-
$[0] = "
|
|
119
|
+
$[0] = "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d";
|
|
120
120
|
}
|
|
121
121
|
let children;
|
|
122
122
|
let className;
|
|
@@ -169,9 +169,9 @@ const BlockTreeItemHeader = (t0) => {
|
|
|
169
169
|
};
|
|
170
170
|
const BlockTreeItemTrigger = (t0) => {
|
|
171
171
|
const $ = c(5);
|
|
172
|
-
if ($[0] !== "
|
|
172
|
+
if ($[0] !== "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d") {
|
|
173
173
|
for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
174
|
-
$[0] = "
|
|
174
|
+
$[0] = "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d";
|
|
175
175
|
}
|
|
176
176
|
const { displayText, onClick } = t0;
|
|
177
177
|
let t1;
|
|
@@ -196,9 +196,9 @@ const BlockTreeItemTrigger = (t0) => {
|
|
|
196
196
|
};
|
|
197
197
|
const BlockTreeItemEllipsis = (t0) => {
|
|
198
198
|
const $ = c(12);
|
|
199
|
-
if ($[0] !== "
|
|
199
|
+
if ($[0] !== "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d") {
|
|
200
200
|
for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
201
|
-
$[0] = "
|
|
201
|
+
$[0] = "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d";
|
|
202
202
|
}
|
|
203
203
|
let className;
|
|
204
204
|
let open;
|
|
@@ -248,164 +248,121 @@ const animateLayoutChanges = (args) => {
|
|
|
248
248
|
return defaultAnimateLayoutChanges(args);
|
|
249
249
|
};
|
|
250
250
|
const SortableBlock = (t0) => {
|
|
251
|
-
const $ = c(
|
|
252
|
-
if ($[0] !== "
|
|
253
|
-
for (let $i = 0; $i <
|
|
254
|
-
$[0] = "
|
|
251
|
+
const $ = c(38);
|
|
252
|
+
if ($[0] !== "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d") {
|
|
253
|
+
for (let $i = 0; $i < 38; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
254
|
+
$[0] = "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d";
|
|
255
255
|
}
|
|
256
256
|
const { block } = t0;
|
|
257
257
|
const [gripPopoverOpen, setGripPopoverOpen] = React.useState(false);
|
|
258
|
-
const previewSource = usePreviewSource();
|
|
259
|
-
const requireDraft = useRequireDraftSource();
|
|
260
|
-
const isReadOnly = previewSource !== "draft";
|
|
261
258
|
const t1 = String(block.id);
|
|
262
259
|
let t2;
|
|
263
|
-
if ($[1] !==
|
|
260
|
+
if ($[1] !== t1) {
|
|
264
261
|
t2 = {
|
|
265
262
|
id: t1,
|
|
266
|
-
animateLayoutChanges
|
|
267
|
-
disabled: isReadOnly
|
|
263
|
+
animateLayoutChanges
|
|
268
264
|
};
|
|
269
|
-
$[1] =
|
|
270
|
-
$[2] =
|
|
271
|
-
|
|
272
|
-
} else t2 = $[3];
|
|
265
|
+
$[1] = t1;
|
|
266
|
+
$[2] = t2;
|
|
267
|
+
} else t2 = $[2];
|
|
273
268
|
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable(t2);
|
|
274
269
|
let t3;
|
|
275
|
-
if ($[
|
|
270
|
+
if ($[3] !== transform) {
|
|
276
271
|
t3 = CSS.Transform.toString(transform);
|
|
277
|
-
$[
|
|
278
|
-
$[
|
|
279
|
-
} else t3 = $[
|
|
272
|
+
$[3] = transform;
|
|
273
|
+
$[4] = t3;
|
|
274
|
+
} else t3 = $[4];
|
|
280
275
|
const t4 = isDragging ? 0 : 1;
|
|
281
276
|
let t5;
|
|
282
|
-
if ($[
|
|
277
|
+
if ($[5] !== t3 || $[6] !== t4 || $[7] !== transition) {
|
|
283
278
|
t5 = {
|
|
284
279
|
transform: t3,
|
|
285
280
|
transition,
|
|
286
281
|
opacity: t4
|
|
287
282
|
};
|
|
288
|
-
$[
|
|
289
|
-
$[
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
292
|
-
} else t5 = $[
|
|
283
|
+
$[5] = t3;
|
|
284
|
+
$[6] = t4;
|
|
285
|
+
$[7] = transition;
|
|
286
|
+
$[8] = t5;
|
|
287
|
+
} else t5 = $[8];
|
|
293
288
|
const style = t5;
|
|
294
289
|
const ctx = useBlockTreeItem(block, isDragging);
|
|
295
|
-
|
|
290
|
+
let t6;
|
|
296
291
|
let t7;
|
|
297
|
-
if ($[
|
|
298
|
-
|
|
299
|
-
$[10] = t6;
|
|
300
|
-
$[11] = t7;
|
|
301
|
-
} else t7 = $[11];
|
|
302
|
-
let t8;
|
|
303
|
-
if ($[12] !== attributes || $[13] !== isReadOnly) {
|
|
304
|
-
t8 = isReadOnly ? {} : attributes;
|
|
305
|
-
$[12] = attributes;
|
|
306
|
-
$[13] = isReadOnly;
|
|
307
|
-
$[14] = t8;
|
|
308
|
-
} else t8 = $[14];
|
|
309
|
-
let t9;
|
|
310
|
-
if ($[15] !== isReadOnly || $[16] !== listeners) {
|
|
311
|
-
t9 = isReadOnly ? {} : listeners;
|
|
312
|
-
$[15] = isReadOnly;
|
|
313
|
-
$[16] = listeners;
|
|
314
|
-
$[17] = t9;
|
|
315
|
-
} else t9 = $[17];
|
|
316
|
-
let t10;
|
|
317
|
-
if ($[18] !== isReadOnly || $[19] !== requireDraft) {
|
|
318
|
-
t10 = isReadOnly ? (e) => {
|
|
319
|
-
e.preventDefault();
|
|
320
|
-
e.stopPropagation();
|
|
321
|
-
requireDraft();
|
|
322
|
-
} : void 0;
|
|
323
|
-
$[18] = isReadOnly;
|
|
324
|
-
$[19] = requireDraft;
|
|
325
|
-
$[20] = t10;
|
|
326
|
-
} else t10 = $[20];
|
|
327
|
-
let t11;
|
|
328
|
-
let t12;
|
|
329
|
-
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
330
|
-
t11 = /* @__PURE__ */ jsx("span", {
|
|
292
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
293
|
+
t6 = /* @__PURE__ */ jsx("span", {
|
|
331
294
|
className: "sr-only",
|
|
332
295
|
children: "Click and use arrow keys to reorder"
|
|
333
296
|
});
|
|
334
|
-
|
|
335
|
-
$[
|
|
336
|
-
$[
|
|
297
|
+
t7 = /* @__PURE__ */ jsx(GripVertical, { className: "h-4 w-4" });
|
|
298
|
+
$[9] = t6;
|
|
299
|
+
$[10] = t7;
|
|
337
300
|
} else {
|
|
338
|
-
|
|
339
|
-
|
|
301
|
+
t6 = $[9];
|
|
302
|
+
t7 = $[10];
|
|
340
303
|
}
|
|
341
|
-
let
|
|
342
|
-
if ($[
|
|
343
|
-
|
|
304
|
+
let t8;
|
|
305
|
+
if ($[11] !== attributes || $[12] !== listeners) {
|
|
306
|
+
t8 = /* @__PURE__ */ jsxs(Button, {
|
|
344
307
|
variant: "ghost",
|
|
345
308
|
size: "icon-sm",
|
|
346
|
-
className:
|
|
347
|
-
...
|
|
348
|
-
...
|
|
349
|
-
|
|
350
|
-
children: [t11, t12]
|
|
309
|
+
className: "text-muted-foreground hover:text-foreground flex cursor-grab active:cursor-grabbing",
|
|
310
|
+
...attributes,
|
|
311
|
+
...listeners,
|
|
312
|
+
children: [t6, t7]
|
|
351
313
|
});
|
|
352
|
-
$[
|
|
353
|
-
$[
|
|
354
|
-
$[
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
if ($[28] !== block || $[29] !== gripButton || $[30] !== gripPopoverOpen || $[31] !== isReadOnly) {
|
|
361
|
-
t14 = isReadOnly ? gripButton : /* @__PURE__ */ jsx(BlockActionsPopover, {
|
|
314
|
+
$[11] = attributes;
|
|
315
|
+
$[12] = listeners;
|
|
316
|
+
$[13] = t8;
|
|
317
|
+
} else t8 = $[13];
|
|
318
|
+
const gripButton = t8;
|
|
319
|
+
let t9;
|
|
320
|
+
if ($[14] !== block || $[15] !== gripButton || $[16] !== gripPopoverOpen) {
|
|
321
|
+
t9 = /* @__PURE__ */ jsx(BlockActionsPopover, {
|
|
362
322
|
block,
|
|
363
323
|
open: gripPopoverOpen,
|
|
364
324
|
onOpenChange: setGripPopoverOpen,
|
|
365
325
|
children: gripButton
|
|
366
326
|
});
|
|
367
|
-
$[
|
|
368
|
-
$[
|
|
369
|
-
$[
|
|
370
|
-
$[
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
displayText: t15,
|
|
327
|
+
$[14] = block;
|
|
328
|
+
$[15] = gripButton;
|
|
329
|
+
$[16] = gripPopoverOpen;
|
|
330
|
+
$[17] = t9;
|
|
331
|
+
} else t9 = $[17];
|
|
332
|
+
const t10 = block.summary || block.type;
|
|
333
|
+
let t11;
|
|
334
|
+
if ($[18] !== ctx.toggleSelection || $[19] !== t10) {
|
|
335
|
+
t11 = /* @__PURE__ */ jsx(BlockTreeItemTrigger, {
|
|
336
|
+
displayText: t10,
|
|
378
337
|
onClick: ctx.toggleSelection
|
|
379
338
|
});
|
|
380
|
-
$[
|
|
381
|
-
$[
|
|
382
|
-
$[
|
|
383
|
-
} else
|
|
384
|
-
let
|
|
385
|
-
if ($[
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
}) : /* @__PURE__ */ jsx(BlockActionsPopover, {
|
|
339
|
+
$[18] = ctx.toggleSelection;
|
|
340
|
+
$[19] = t10;
|
|
341
|
+
$[20] = t11;
|
|
342
|
+
} else t11 = $[20];
|
|
343
|
+
let t12;
|
|
344
|
+
if ($[21] !== ctx.ellipsisPopoverOpen) {
|
|
345
|
+
t12 = /* @__PURE__ */ jsx(BlockTreeItemEllipsis, { open: ctx.ellipsisPopoverOpen });
|
|
346
|
+
$[21] = ctx.ellipsisPopoverOpen;
|
|
347
|
+
$[22] = t12;
|
|
348
|
+
} else t12 = $[22];
|
|
349
|
+
let t13;
|
|
350
|
+
if ($[23] !== block || $[24] !== ctx.ellipsisPopoverOpen || $[25] !== ctx.setEllipsisPopoverOpen || $[26] !== t12) {
|
|
351
|
+
t13 = /* @__PURE__ */ jsx(BlockActionsPopover, {
|
|
394
352
|
block,
|
|
395
353
|
open: ctx.ellipsisPopoverOpen,
|
|
396
354
|
onOpenChange: ctx.setEllipsisPopoverOpen,
|
|
397
|
-
children:
|
|
355
|
+
children: t12
|
|
398
356
|
});
|
|
399
|
-
$[
|
|
400
|
-
$[
|
|
401
|
-
$[
|
|
402
|
-
$[
|
|
403
|
-
$[
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
t18 = /* @__PURE__ */ jsxs(BlockTreeItemHeader, {
|
|
357
|
+
$[23] = block;
|
|
358
|
+
$[24] = ctx.ellipsisPopoverOpen;
|
|
359
|
+
$[25] = ctx.setEllipsisPopoverOpen;
|
|
360
|
+
$[26] = t12;
|
|
361
|
+
$[27] = t13;
|
|
362
|
+
} else t13 = $[27];
|
|
363
|
+
let t14;
|
|
364
|
+
if ($[28] !== ctx.handleBlockMouseEnter || $[29] !== ctx.handleBlockMouseLeave || $[30] !== ctx.shouldShowActive || $[31] !== ctx.shouldShowHover || $[32] !== setNodeRef || $[33] !== style || $[34] !== t11 || $[35] !== t13 || $[36] !== t9) {
|
|
365
|
+
t14 = /* @__PURE__ */ jsxs(BlockTreeItemHeader, {
|
|
409
366
|
ref: setNodeRef,
|
|
410
367
|
style,
|
|
411
368
|
className: "group",
|
|
@@ -414,29 +371,29 @@ const SortableBlock = (t0) => {
|
|
|
414
371
|
onMouseEnter: ctx.handleBlockMouseEnter,
|
|
415
372
|
onMouseLeave: ctx.handleBlockMouseLeave,
|
|
416
373
|
children: [
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
374
|
+
t9,
|
|
375
|
+
t11,
|
|
376
|
+
t13
|
|
420
377
|
]
|
|
421
378
|
});
|
|
422
|
-
$[
|
|
423
|
-
$[
|
|
424
|
-
$[
|
|
425
|
-
$[
|
|
426
|
-
$[
|
|
427
|
-
$[
|
|
428
|
-
$[
|
|
429
|
-
$[
|
|
430
|
-
$[
|
|
431
|
-
$[
|
|
432
|
-
} else
|
|
433
|
-
return
|
|
379
|
+
$[28] = ctx.handleBlockMouseEnter;
|
|
380
|
+
$[29] = ctx.handleBlockMouseLeave;
|
|
381
|
+
$[30] = ctx.shouldShowActive;
|
|
382
|
+
$[31] = ctx.shouldShowHover;
|
|
383
|
+
$[32] = setNodeRef;
|
|
384
|
+
$[33] = style;
|
|
385
|
+
$[34] = t11;
|
|
386
|
+
$[35] = t13;
|
|
387
|
+
$[36] = t9;
|
|
388
|
+
$[37] = t14;
|
|
389
|
+
} else t14 = $[37];
|
|
390
|
+
return t14;
|
|
434
391
|
};
|
|
435
392
|
const LayoutBlockItem = (t0) => {
|
|
436
|
-
const $ = c(
|
|
437
|
-
if ($[0] !== "
|
|
438
|
-
for (let $i = 0; $i <
|
|
439
|
-
$[0] = "
|
|
393
|
+
const $ = c(29);
|
|
394
|
+
if ($[0] !== "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d") {
|
|
395
|
+
for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
396
|
+
$[0] = "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d";
|
|
440
397
|
}
|
|
441
398
|
const { block, layoutName, derived: t1 } = t0;
|
|
442
399
|
const derived = t1 === void 0 ? false : t1;
|
|
@@ -450,9 +407,7 @@ const LayoutBlockItem = (t0) => {
|
|
|
450
407
|
} else t2 = $[3];
|
|
451
408
|
const blockDef = t2;
|
|
452
409
|
const ctx = useBlockTreeItem(block);
|
|
453
|
-
const previewSource = usePreviewSource();
|
|
454
410
|
const requireDraft = useRequireDraftSource();
|
|
455
|
-
const isReadOnly = previewSource !== "draft";
|
|
456
411
|
const displayText = blockDef?._internal.title ?? block.type;
|
|
457
412
|
let t3;
|
|
458
413
|
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
@@ -501,7 +456,7 @@ const LayoutBlockItem = (t0) => {
|
|
|
501
456
|
$[13] = t8;
|
|
502
457
|
} else t8 = $[13];
|
|
503
458
|
let t9;
|
|
504
|
-
if ($[14] !== block || $[15] !== ctx.ellipsisPopoverOpen || $[16] !== ctx.setEllipsisPopoverOpen || $[17] !== derived || $[18] !== displayText || $[19] !==
|
|
459
|
+
if ($[14] !== block || $[15] !== ctx.ellipsisPopoverOpen || $[16] !== ctx.setEllipsisPopoverOpen || $[17] !== derived || $[18] !== displayText || $[19] !== requireDraft) {
|
|
505
460
|
t9 = derived ? /* @__PURE__ */ jsx(Button, {
|
|
506
461
|
variant: "ghost",
|
|
507
462
|
size: "icon-sm",
|
|
@@ -515,13 +470,6 @@ const LayoutBlockItem = (t0) => {
|
|
|
515
470
|
});
|
|
516
471
|
},
|
|
517
472
|
children: /* @__PURE__ */ jsx(Pencil, { className: "size-4" })
|
|
518
|
-
}) : isReadOnly ? /* @__PURE__ */ jsx(BlockTreeItemEllipsis, {
|
|
519
|
-
open: false,
|
|
520
|
-
onClick: (e) => {
|
|
521
|
-
e.preventDefault();
|
|
522
|
-
e.stopPropagation();
|
|
523
|
-
requireDraft();
|
|
524
|
-
}
|
|
525
473
|
}) : /* @__PURE__ */ jsx(BlockActionsPopover, {
|
|
526
474
|
block,
|
|
527
475
|
open: ctx.ellipsisPopoverOpen,
|
|
@@ -535,12 +483,11 @@ const LayoutBlockItem = (t0) => {
|
|
|
535
483
|
$[16] = ctx.setEllipsisPopoverOpen;
|
|
536
484
|
$[17] = derived;
|
|
537
485
|
$[18] = displayText;
|
|
538
|
-
$[19] =
|
|
539
|
-
$[20] =
|
|
540
|
-
|
|
541
|
-
} else t9 = $[21];
|
|
486
|
+
$[19] = requireDraft;
|
|
487
|
+
$[20] = t9;
|
|
488
|
+
} else t9 = $[20];
|
|
542
489
|
let t10;
|
|
543
|
-
if ($[
|
|
490
|
+
if ($[21] !== ctx.handleBlockMouseEnter || $[22] !== ctx.handleBlockMouseLeave || $[23] !== ctx.shouldShowActive || $[24] !== ctx.shouldShowHover || $[25] !== t7 || $[26] !== t8 || $[27] !== t9) {
|
|
544
491
|
t10 = /* @__PURE__ */ jsxs(BlockTreeItemHeader, {
|
|
545
492
|
className: "group",
|
|
546
493
|
shouldShowHover: ctx.shouldShowHover,
|
|
@@ -553,22 +500,22 @@ const LayoutBlockItem = (t0) => {
|
|
|
553
500
|
t9
|
|
554
501
|
]
|
|
555
502
|
});
|
|
556
|
-
$[
|
|
557
|
-
$[
|
|
558
|
-
$[
|
|
559
|
-
$[
|
|
560
|
-
$[
|
|
561
|
-
$[
|
|
562
|
-
$[
|
|
563
|
-
$[
|
|
564
|
-
} else t10 = $[
|
|
503
|
+
$[21] = ctx.handleBlockMouseEnter;
|
|
504
|
+
$[22] = ctx.handleBlockMouseLeave;
|
|
505
|
+
$[23] = ctx.shouldShowActive;
|
|
506
|
+
$[24] = ctx.shouldShowHover;
|
|
507
|
+
$[25] = t7;
|
|
508
|
+
$[26] = t8;
|
|
509
|
+
$[27] = t9;
|
|
510
|
+
$[28] = t10;
|
|
511
|
+
} else t10 = $[28];
|
|
565
512
|
return t10;
|
|
566
513
|
};
|
|
567
514
|
const BlockInsertionIndicator = () => {
|
|
568
515
|
const $ = c(4);
|
|
569
|
-
if ($[0] !== "
|
|
516
|
+
if ($[0] !== "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d") {
|
|
570
517
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
571
|
-
$[0] = "
|
|
518
|
+
$[0] = "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d";
|
|
572
519
|
}
|
|
573
520
|
const ref = React.useRef(null);
|
|
574
521
|
let t0;
|
|
@@ -601,17 +548,16 @@ const BlockInsertionIndicator = () => {
|
|
|
601
548
|
return t2;
|
|
602
549
|
};
|
|
603
550
|
const PageTree = () => {
|
|
604
|
-
const $ = c(
|
|
605
|
-
if ($[0] !== "
|
|
606
|
-
for (let $i = 0; $i <
|
|
607
|
-
$[0] = "
|
|
551
|
+
const $ = c(68);
|
|
552
|
+
if ($[0] !== "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d") {
|
|
553
|
+
for (let $i = 0; $i < 68; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
554
|
+
$[0] = "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d";
|
|
608
555
|
}
|
|
609
556
|
const page = usePreviewedPage();
|
|
610
|
-
const isAddBlockSidebarOpen = useSelector(previewStore,
|
|
611
|
-
const peekedBlockPosition = useSelector(previewStore,
|
|
557
|
+
const isAddBlockSidebarOpen = useSelector(previewStore, _temp3);
|
|
558
|
+
const peekedBlockPosition = useSelector(previewStore, _temp4);
|
|
612
559
|
const previewSource = usePreviewSource();
|
|
613
560
|
const requireDraft = useRequireDraftSource();
|
|
614
|
-
const isReadOnly = previewSource !== "draft";
|
|
615
561
|
const { pageBlocks, beforeBlocks: layoutBeforeBlocks, afterBlocks: layoutAfterBlocks } = usePageBlocks(page, previewSource);
|
|
616
562
|
const camoxApp = useCamoxApp();
|
|
617
563
|
const updatePosition = useUpdateBlockPosition();
|
|
@@ -735,7 +681,7 @@ const PageTree = () => {
|
|
|
735
681
|
} else t8 = $[23];
|
|
736
682
|
let t9;
|
|
737
683
|
if ($[24] !== pageBlocks) {
|
|
738
|
-
t9 = pageBlocks.map(
|
|
684
|
+
t9 = pageBlocks.map(_temp5);
|
|
739
685
|
$[24] = pageBlocks;
|
|
740
686
|
$[25] = t9;
|
|
741
687
|
} else t9 = $[25];
|
|
@@ -851,61 +797,49 @@ const PageTree = () => {
|
|
|
851
797
|
$[58] = t7;
|
|
852
798
|
$[59] = t17;
|
|
853
799
|
} else t17 = $[59];
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
t19 = cn(t18);
|
|
858
|
-
$[60] = t18;
|
|
859
|
-
$[61] = t19;
|
|
860
|
-
} else t19 = $[61];
|
|
861
|
-
let t20;
|
|
862
|
-
if ($[62] !== requireDraft) {
|
|
863
|
-
t20 = () => {
|
|
800
|
+
let t18;
|
|
801
|
+
if ($[60] !== requireDraft) {
|
|
802
|
+
t18 = () => {
|
|
864
803
|
if (!requireDraft()) return;
|
|
865
804
|
previewStore.send({
|
|
866
805
|
type: "openAddBlockSidebar",
|
|
867
806
|
via: "page-tree"
|
|
868
807
|
});
|
|
869
808
|
};
|
|
870
|
-
$[
|
|
871
|
-
$[
|
|
872
|
-
} else
|
|
873
|
-
let
|
|
874
|
-
if ($[
|
|
875
|
-
|
|
876
|
-
$[
|
|
877
|
-
} else
|
|
878
|
-
let
|
|
879
|
-
if ($[
|
|
880
|
-
|
|
809
|
+
$[60] = requireDraft;
|
|
810
|
+
$[61] = t18;
|
|
811
|
+
} else t18 = $[61];
|
|
812
|
+
let t19;
|
|
813
|
+
if ($[62] === Symbol.for("react.memo_cache_sentinel")) {
|
|
814
|
+
t19 = /* @__PURE__ */ jsx(Plus, {});
|
|
815
|
+
$[62] = t19;
|
|
816
|
+
} else t19 = $[62];
|
|
817
|
+
let t20;
|
|
818
|
+
if ($[63] !== t18) {
|
|
819
|
+
t20 = /* @__PURE__ */ jsxs(Button, {
|
|
881
820
|
variant: "secondary",
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
children: [t21, "Add block"]
|
|
821
|
+
onClick: t18,
|
|
822
|
+
children: [t19, "Add block"]
|
|
885
823
|
});
|
|
886
|
-
$[
|
|
824
|
+
$[63] = t18;
|
|
825
|
+
$[64] = t20;
|
|
826
|
+
} else t20 = $[64];
|
|
827
|
+
let t21;
|
|
828
|
+
if ($[65] !== t17 || $[66] !== t20) {
|
|
829
|
+
t21 = /* @__PURE__ */ jsxs(Fragment, { children: [t17, t20] });
|
|
830
|
+
$[65] = t17;
|
|
887
831
|
$[66] = t20;
|
|
888
|
-
$[67] =
|
|
889
|
-
} else
|
|
890
|
-
|
|
891
|
-
if ($[68] !== t17 || $[69] !== t22) {
|
|
892
|
-
t23 = /* @__PURE__ */ jsxs(Fragment, { children: [t17, t22] });
|
|
893
|
-
$[68] = t17;
|
|
894
|
-
$[69] = t22;
|
|
895
|
-
$[70] = t23;
|
|
896
|
-
} else t23 = $[70];
|
|
897
|
-
return t23;
|
|
832
|
+
$[67] = t21;
|
|
833
|
+
} else t21 = $[67];
|
|
834
|
+
return t21;
|
|
898
835
|
};
|
|
899
|
-
function
|
|
900
|
-
return state.context.previewSource;
|
|
901
|
-
}
|
|
902
|
-
function _temp4(state) {
|
|
836
|
+
function _temp3(state) {
|
|
903
837
|
return state.context.isAddBlockSidebarOpen;
|
|
904
838
|
}
|
|
905
|
-
function
|
|
839
|
+
function _temp4(state_0) {
|
|
906
840
|
return state_0.context.peekedBlockPosition;
|
|
907
841
|
}
|
|
908
|
-
function
|
|
842
|
+
function _temp5(block_3) {
|
|
909
843
|
return String(block_3.id);
|
|
910
844
|
}
|
|
911
845
|
|