camox 0.41.1 → 0.42.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/components/lexical/SidebarLexicalEditor.js +42 -39
- package/dist/core/createApp.d.ts +18 -4
- package/dist/core/createLayout.d.ts +1 -1
- package/dist/core/editing/createEditableBlock.d.ts +8 -1
- package/dist/core/editing/createEditableBlock.js +636 -459
- package/dist/core/hooks/useOverlayState.js +11 -0
- package/dist/core/lib/fieldTypes.js +5 -5
- package/dist/core/lib/lexicalState.js +17 -1
- package/dist/features/preview/CamoxPreview.js +80 -73
- package/dist/features/preview/commentsEnabled.js +8 -0
- package/dist/features/preview/components/AddBlockSidebar.js +79 -89
- package/dist/features/preview/components/AssetLightbox.js +4 -11
- package/dist/features/preview/components/AttachedComments.js +194 -0
- package/dist/features/preview/components/BlockActionsPopover.js +13 -64
- package/dist/features/preview/components/CommentHeader.js +122 -0
- package/dist/features/preview/components/CommentSidebar.js +29 -0
- package/dist/features/preview/components/CommentTargetQuote.js +166 -0
- package/dist/features/preview/components/CreatePageModal.js +2 -8
- package/dist/features/preview/components/ItemFieldsEditor.js +275 -204
- package/dist/features/preview/components/LeftSidebar.js +18 -18
- package/dist/features/preview/components/OverlayTracker.js +14 -20
- package/dist/features/preview/components/Overlays.js +26 -35
- package/dist/features/preview/components/PageEditorSidebar.js +89 -90
- package/dist/features/preview/components/PageInfoSidebar.js +126 -157
- package/dist/features/preview/components/PagePicker.js +13 -8
- package/dist/features/preview/components/PageTree.js +158 -156
- package/dist/features/preview/components/PreviewComments.js +56 -0
- package/dist/features/preview/components/PreviewPanel.js +122 -78
- package/dist/features/preview/components/PreviewToolbar.js +280 -231
- package/dist/features/preview/components/PublicationRow.js +4 -11
- package/dist/features/preview/components/RightSidebar.js +14 -11
- package/dist/features/preview/components/SidebarSection.js +121 -0
- package/dist/features/preview/previewCommentsStore.js +115 -0
- package/dist/features/preview/previewSelection.js +75 -0
- package/dist/features/preview/previewStore.js +19 -39
- package/dist/features/provider/AuthenticatedCamoxProvider.js +46 -34
- package/dist/features/provider/components/CommandPalette.js +142 -58
- package/dist/features/provider/useAdminShortcuts.js +19 -8
- package/dist/features/routes/pageRuntime.js +0 -6
- package/dist/features/runtime/RuntimeChrome.js +40 -37
- package/dist/features/studio/CamoxStudio.js +30 -50
- package/dist/features/vite/runtimeDev.js +4 -1
- package/dist/features/vite/vite.d.ts +3 -2
- package/dist/features/vite/vite.js +9 -5
- package/dist/hooks/use-file-upload.js +0 -2
- package/dist/studio.css +1 -1
- package/package.json +5 -7
- package/dist/lib/telemetry-client.js +0 -66
- package/dist/lib/telemetry.js +0 -26
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/core/hooks/useOverlayState.ts
|
|
2
|
+
/** Native and sidebar hover use the same overlay attributes in every editing mode. */
|
|
3
|
+
function useOverlayState(hovered, focused = false) {
|
|
4
|
+
return {
|
|
5
|
+
"data-camox-hovered": hovered || void 0,
|
|
6
|
+
"data-camox-focused": focused || void 0
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { useOverlayState };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
//#region src/core/lib/fieldTypes.tsx
|
|
2
2
|
const fieldTypesDictionary = {
|
|
3
|
-
String: { hasOwnView:
|
|
4
|
-
Repeater: { hasOwnView:
|
|
5
|
-
Enum: { hasOwnView:
|
|
6
|
-
Boolean: { hasOwnView:
|
|
7
|
-
Embed: { hasOwnView:
|
|
3
|
+
String: { hasOwnView: true },
|
|
4
|
+
Repeater: { hasOwnView: true },
|
|
5
|
+
Enum: { hasOwnView: true },
|
|
6
|
+
Boolean: { hasOwnView: true },
|
|
7
|
+
Embed: { hasOwnView: true },
|
|
8
8
|
Link: { hasOwnView: true },
|
|
9
9
|
Image: { hasOwnView: true },
|
|
10
10
|
File: { hasOwnView: true },
|
|
@@ -12,6 +12,22 @@ function isLexicalState(value) {
|
|
|
12
12
|
return false;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
function lexicalStateToPlainText(serialized) {
|
|
16
|
+
try {
|
|
17
|
+
return extractText((typeof serialized === "object" ? serialized : JSON.parse(serialized)).root);
|
|
18
|
+
} catch {
|
|
19
|
+
return typeof serialized === "string" ? serialized : "";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function extractText(node) {
|
|
23
|
+
if (node.type === "text") return node.text ?? "";
|
|
24
|
+
if (node.type === "linebreak") return "\n";
|
|
25
|
+
if (!node.children) return "";
|
|
26
|
+
const parts = [];
|
|
27
|
+
for (const child of node.children) parts.push(extractText(child));
|
|
28
|
+
if (node.type === "paragraph" || node.type === "inline-paragraph" || node.type === "heading") return parts.join("");
|
|
29
|
+
return parts.join(node.type === "root" ? "\n\n" : "");
|
|
30
|
+
}
|
|
15
31
|
function lexicalStateToMarkdown(serialized) {
|
|
16
32
|
try {
|
|
17
33
|
return extractMarkdown((typeof serialized === "object" ? serialized : JSON.parse(serialized)).root);
|
|
@@ -224,4 +240,4 @@ function parseTokens(tokens, format) {
|
|
|
224
240
|
}
|
|
225
241
|
|
|
226
242
|
//#endregion
|
|
227
|
-
export { isLexicalState, lexicalStateToMarkdown, markdownToLexicalState };
|
|
243
|
+
export { isLexicalState, lexicalStateToMarkdown, lexicalStateToPlainText, markdownToLexicalState };
|
|
@@ -36,9 +36,9 @@ function getMobileStudioSnapshot() {
|
|
|
36
36
|
}
|
|
37
37
|
function useIsMobileStudio() {
|
|
38
38
|
const $ = c(1);
|
|
39
|
-
if ($[0] !== "
|
|
39
|
+
if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
|
|
40
40
|
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
41
|
-
$[0] = "
|
|
41
|
+
$[0] = "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b";
|
|
42
42
|
}
|
|
43
43
|
return React.useSyncExternalStore(subscribeToMobileStudio, getMobileStudioSnapshot, _temp);
|
|
44
44
|
}
|
|
@@ -71,9 +71,9 @@ function pageStructureQueryFn(path, projectSlug, source) {
|
|
|
71
71
|
}
|
|
72
72
|
function usePreviewedPage() {
|
|
73
73
|
const $ = c(11);
|
|
74
|
-
if ($[0] !== "
|
|
74
|
+
if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
|
|
75
75
|
for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
76
|
-
$[0] = "
|
|
76
|
+
$[0] = "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b";
|
|
77
77
|
}
|
|
78
78
|
const { pathname } = useLocation();
|
|
79
79
|
const projectSlug = useProjectSlug();
|
|
@@ -109,9 +109,9 @@ function usePreviewedPage() {
|
|
|
109
109
|
}
|
|
110
110
|
const BlockRenderer = (t0) => {
|
|
111
111
|
const $ = c(23);
|
|
112
|
-
if ($[0] !== "
|
|
112
|
+
if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
|
|
113
113
|
for (let $i = 0; $i < 23; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
114
|
-
$[0] = "
|
|
114
|
+
$[0] = "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b";
|
|
115
115
|
}
|
|
116
116
|
const { blockId, mode, showAddBlockTop, showAddBlockBottom } = t0;
|
|
117
117
|
const previewSource = useSelector(previewStore, selectPreviewSource);
|
|
@@ -254,9 +254,9 @@ const PageContent = () => {
|
|
|
254
254
|
};
|
|
255
255
|
function useHydrateDraftCache() {
|
|
256
256
|
const $ = c(7);
|
|
257
|
-
if ($[0] !== "
|
|
257
|
+
if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
|
|
258
258
|
for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
259
|
-
$[0] = "
|
|
259
|
+
$[0] = "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b";
|
|
260
260
|
}
|
|
261
261
|
const isAuthenticated = useIsAuthenticated();
|
|
262
262
|
const queryClient = useQueryClient();
|
|
@@ -307,9 +307,9 @@ function useHydrateDraftCache() {
|
|
|
307
307
|
function _temp2() {}
|
|
308
308
|
const CamoxPreview = (t0) => {
|
|
309
309
|
const $ = c(4);
|
|
310
|
-
if ($[0] !== "
|
|
310
|
+
if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
|
|
311
311
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
312
|
-
$[0] = "
|
|
312
|
+
$[0] = "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b";
|
|
313
313
|
}
|
|
314
314
|
const { children } = t0;
|
|
315
315
|
const pageData = usePreviewedPage();
|
|
@@ -328,10 +328,10 @@ const CamoxPreview = (t0) => {
|
|
|
328
328
|
};
|
|
329
329
|
/** Studio chrome is shared; only curated previews require a Camox page record. */
|
|
330
330
|
const PreviewShell = (t0) => {
|
|
331
|
-
const $ = c(
|
|
332
|
-
if ($[0] !== "
|
|
333
|
-
for (let $i = 0; $i <
|
|
334
|
-
$[0] = "
|
|
331
|
+
const $ = c(59);
|
|
332
|
+
if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
|
|
333
|
+
for (let $i = 0; $i < 59; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
334
|
+
$[0] = "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b";
|
|
335
335
|
}
|
|
336
336
|
const { children, pageData, hasLiveVersion: t1, derivedLayoutId, derivedLayout } = t0;
|
|
337
337
|
const hasLiveVersion = t1 === void 0 ? false : t1;
|
|
@@ -517,98 +517,101 @@ const PreviewShell = (t0) => {
|
|
|
517
517
|
} else t10 = $[27];
|
|
518
518
|
const t11 = pageData?.page;
|
|
519
519
|
const t12 = pageData?.projectName;
|
|
520
|
-
const t13 = pageData?.page.
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
520
|
+
const t13 = pageData?.page.id;
|
|
521
|
+
const t14 = pageData?.page.status;
|
|
522
|
+
let t15;
|
|
523
|
+
if ($[28] !== hasLiveCheckpoint || $[29] !== t13 || $[30] !== t14) {
|
|
524
|
+
t15 = {
|
|
525
|
+
pageId: t13,
|
|
526
|
+
pageStatus: t14,
|
|
525
527
|
hasLiveVersion: hasLiveCheckpoint
|
|
526
528
|
};
|
|
527
529
|
$[28] = hasLiveCheckpoint;
|
|
528
530
|
$[29] = t13;
|
|
529
531
|
$[30] = t14;
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
if ($[31] !== isEditMode || $[32] !== isMobileStudio) {
|
|
533
|
-
t15 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx(PreviewToolbarSpacer, {});
|
|
534
|
-
$[31] = isEditMode;
|
|
535
|
-
$[32] = isMobileStudio;
|
|
536
|
-
$[33] = t15;
|
|
537
|
-
} else t15 = $[33];
|
|
532
|
+
$[31] = t15;
|
|
533
|
+
} else t15 = $[31];
|
|
538
534
|
let t16;
|
|
539
|
-
if ($[
|
|
540
|
-
t16 = /* @__PURE__ */
|
|
535
|
+
if ($[32] !== isEditMode || $[33] !== isMobileStudio) {
|
|
536
|
+
t16 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx(PreviewToolbarSpacer, {});
|
|
537
|
+
$[32] = isEditMode;
|
|
538
|
+
$[33] = isMobileStudio;
|
|
539
|
+
$[34] = t16;
|
|
540
|
+
} else t16 = $[34];
|
|
541
|
+
let t17;
|
|
542
|
+
if ($[35] !== children || $[36] !== isMobileStudio || $[37] !== t11 || $[38] !== t12 || $[39] !== t15 || $[40] !== t16) {
|
|
543
|
+
t17 = /* @__PURE__ */ jsxs(PreviewPanel, {
|
|
541
544
|
isMobileExperience: isMobileStudio,
|
|
542
545
|
page: t11,
|
|
543
546
|
projectName: t12,
|
|
544
|
-
toolbarProps:
|
|
545
|
-
children: [children,
|
|
547
|
+
toolbarProps: t15,
|
|
548
|
+
children: [children, t16]
|
|
546
549
|
});
|
|
547
|
-
$[
|
|
548
|
-
$[
|
|
549
|
-
$[
|
|
550
|
-
$[
|
|
551
|
-
$[38] = t14;
|
|
550
|
+
$[35] = children;
|
|
551
|
+
$[36] = isMobileStudio;
|
|
552
|
+
$[37] = t11;
|
|
553
|
+
$[38] = t12;
|
|
552
554
|
$[39] = t15;
|
|
553
555
|
$[40] = t16;
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
556
|
+
$[41] = t17;
|
|
557
|
+
} else t17 = $[41];
|
|
558
|
+
let t18;
|
|
559
|
+
if ($[42] !== derivedLayoutId || $[43] !== isEditMode || $[44] !== isMobileStudio || $[45] !== pageData?.page) {
|
|
560
|
+
t18 = !isMobileStudio && isEditMode && /* @__PURE__ */ jsx(RightSidebar, {
|
|
558
561
|
pageId: pageData?.page.id,
|
|
559
562
|
derivedLayoutId
|
|
560
563
|
});
|
|
561
|
-
$[
|
|
562
|
-
$[
|
|
563
|
-
$[
|
|
564
|
-
$[
|
|
565
|
-
$[
|
|
566
|
-
} else
|
|
567
|
-
let
|
|
568
|
-
if ($[
|
|
569
|
-
|
|
564
|
+
$[42] = derivedLayoutId;
|
|
565
|
+
$[43] = isEditMode;
|
|
566
|
+
$[44] = isMobileStudio;
|
|
567
|
+
$[45] = pageData?.page;
|
|
568
|
+
$[46] = t18;
|
|
569
|
+
} else t18 = $[46];
|
|
570
|
+
let t19;
|
|
571
|
+
if ($[47] !== t10 || $[48] !== t17 || $[49] !== t18) {
|
|
572
|
+
t19 = /* @__PURE__ */ jsxs("div", {
|
|
570
573
|
className: "flex h-full flex-row items-stretch",
|
|
571
574
|
children: [
|
|
572
575
|
t10,
|
|
573
|
-
|
|
574
|
-
|
|
576
|
+
t17,
|
|
577
|
+
t18
|
|
575
578
|
]
|
|
576
579
|
});
|
|
577
|
-
$[
|
|
578
|
-
$[47] = t16;
|
|
580
|
+
$[47] = t10;
|
|
579
581
|
$[48] = t17;
|
|
580
582
|
$[49] = t18;
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
if ($[50] !== isEditMode || $[51] !== isMobileStudio) {
|
|
584
|
-
t19 = (isMobileStudio || isEditMode) && /* @__PURE__ */ jsx(CreatePageModal, {});
|
|
585
|
-
$[50] = isEditMode;
|
|
586
|
-
$[51] = isMobileStudio;
|
|
587
|
-
$[52] = t19;
|
|
588
|
-
} else t19 = $[52];
|
|
583
|
+
$[50] = t19;
|
|
584
|
+
} else t19 = $[50];
|
|
589
585
|
let t20;
|
|
590
|
-
if ($[
|
|
591
|
-
t20 = /* @__PURE__ */
|
|
586
|
+
if ($[51] !== isEditMode || $[52] !== isMobileStudio) {
|
|
587
|
+
t20 = (isMobileStudio || isEditMode) && /* @__PURE__ */ jsx(CreatePageModal, {});
|
|
588
|
+
$[51] = isEditMode;
|
|
589
|
+
$[52] = isMobileStudio;
|
|
590
|
+
$[53] = t20;
|
|
591
|
+
} else t20 = $[53];
|
|
592
|
+
let t21;
|
|
593
|
+
if ($[54] !== t19 || $[55] !== t20 || $[56] !== t8 || $[57] !== t9) {
|
|
594
|
+
t21 = /* @__PURE__ */ jsxs("div", {
|
|
592
595
|
className: t8,
|
|
593
596
|
children: [
|
|
594
597
|
t9,
|
|
595
|
-
|
|
596
|
-
|
|
598
|
+
t19,
|
|
599
|
+
t20
|
|
597
600
|
]
|
|
598
601
|
});
|
|
599
|
-
$[53] = t18;
|
|
600
602
|
$[54] = t19;
|
|
601
|
-
$[55] =
|
|
602
|
-
$[56] =
|
|
603
|
-
$[57] =
|
|
604
|
-
|
|
605
|
-
|
|
603
|
+
$[55] = t20;
|
|
604
|
+
$[56] = t8;
|
|
605
|
+
$[57] = t9;
|
|
606
|
+
$[58] = t21;
|
|
607
|
+
} else t21 = $[58];
|
|
608
|
+
return t21;
|
|
606
609
|
};
|
|
607
610
|
function usePreviewPagesActions() {
|
|
608
611
|
const $ = c(13);
|
|
609
|
-
if ($[0] !== "
|
|
612
|
+
if ($[0] !== "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b") {
|
|
610
613
|
for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
611
|
-
$[0] = "
|
|
614
|
+
$[0] = "c1ecb280688848a0300c65af5bc156d964441b9c769c2e406123217a6e83b30b";
|
|
612
615
|
}
|
|
613
616
|
const navigate = useNavigate();
|
|
614
617
|
const { pathname } = useLocation();
|
|
@@ -754,6 +757,10 @@ function _temp9() {
|
|
|
754
757
|
return true;
|
|
755
758
|
}
|
|
756
759
|
function _temp0() {
|
|
760
|
+
previewStore.send({
|
|
761
|
+
type: "setCommentMode",
|
|
762
|
+
enabled: false
|
|
763
|
+
});
|
|
757
764
|
previewStore.send({ type: "clearSelection" });
|
|
758
765
|
}
|
|
759
766
|
function _temp1(a) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/features/preview/commentsEnabled.ts
|
|
2
|
+
/** Opt-in prototype flag, replaced by the Camox Vite plugin in both client and SSR builds. */
|
|
3
|
+
function areCommentsEnabled() {
|
|
4
|
+
return typeof __CAMOX_ENABLE_COMMENTS__ !== "undefined" && __CAMOX_ENABLE_COMMENTS__;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { areCommentsEnabled };
|
|
@@ -3,7 +3,6 @@ import { useProjectSlug } from "../../../lib/auth.js";
|
|
|
3
3
|
import { usePageBlocks } from "../../../lib/normalized-data.js";
|
|
4
4
|
import { blockMutations, blockQueries, projectQueries } from "../../../lib/queries.js";
|
|
5
5
|
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
6
|
-
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
7
6
|
import { previewStore } from "../previewStore.js";
|
|
8
7
|
import { useRequireDraftSource } from "../../../core/hooks/useRequireDraftSource.js";
|
|
9
8
|
import { BlockThumbnail } from "./BlockThumbnail.js";
|
|
@@ -23,10 +22,10 @@ import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, Command
|
|
|
23
22
|
|
|
24
23
|
//#region src/features/preview/components/AddBlockSidebar.tsx
|
|
25
24
|
const AddBlockSidebar = () => {
|
|
26
|
-
const $ = c(
|
|
27
|
-
if ($[0] !== "
|
|
28
|
-
for (let $i = 0; $i <
|
|
29
|
-
$[0] = "
|
|
25
|
+
const $ = c(57);
|
|
26
|
+
if ($[0] !== "4c8d55ba83f686c7bfc04ce464d348e236b6ed16fb43d0305b13b93cf8de061f") {
|
|
27
|
+
for (let $i = 0; $i < 57; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
28
|
+
$[0] = "4c8d55ba83f686c7bfc04ce464d348e236b6ed16fb43d0305b13b93cf8de061f";
|
|
30
29
|
}
|
|
31
30
|
const [highlightedValue, setHighlightedValue] = React.useState("");
|
|
32
31
|
const queryClient = useQueryClient();
|
|
@@ -167,9 +166,8 @@ const AddBlockSidebar = () => {
|
|
|
167
166
|
} else t8 = $[16];
|
|
168
167
|
const pageCounts = t8;
|
|
169
168
|
const peekedBlockPosition = useSelector(previewStore, _temp3);
|
|
170
|
-
const addBlockSource = useSelector(previewStore, _temp4);
|
|
171
169
|
let t9;
|
|
172
|
-
if ($[17] !==
|
|
170
|
+
if ($[17] !== createBlock || $[18] !== page || $[19] !== pageBlocks_0 || $[20] !== peekedBlockPosition || $[21] !== requireDraft) {
|
|
173
171
|
t9 = async (block_0) => {
|
|
174
172
|
if (!page) return;
|
|
175
173
|
if (!requireDraft()) return;
|
|
@@ -183,27 +181,22 @@ const AddBlockSidebar = () => {
|
|
|
183
181
|
afterPosition: afterPosition_0,
|
|
184
182
|
repeatableItems: bundle.repeatableItems
|
|
185
183
|
});
|
|
186
|
-
trackClientEvent("block_added", {
|
|
187
|
-
blockType: block_0._internal.id,
|
|
188
|
-
via: addBlockSource ?? "unknown"
|
|
189
|
-
});
|
|
190
184
|
previewStore.send({
|
|
191
185
|
type: "focusCreatedBlock",
|
|
192
186
|
blockId
|
|
193
187
|
});
|
|
194
188
|
previewStore.send({ type: "exitPeekedBlock" });
|
|
195
189
|
};
|
|
196
|
-
$[17] =
|
|
197
|
-
$[18] =
|
|
198
|
-
$[19] =
|
|
199
|
-
$[20] =
|
|
200
|
-
$[21] =
|
|
201
|
-
$[22] =
|
|
202
|
-
|
|
203
|
-
} else t9 = $[23];
|
|
190
|
+
$[17] = createBlock;
|
|
191
|
+
$[18] = page;
|
|
192
|
+
$[19] = pageBlocks_0;
|
|
193
|
+
$[20] = peekedBlockPosition;
|
|
194
|
+
$[21] = requireDraft;
|
|
195
|
+
$[22] = t9;
|
|
196
|
+
} else t9 = $[22];
|
|
204
197
|
const handleAddBlock = t9;
|
|
205
198
|
let t10;
|
|
206
|
-
if ($[
|
|
199
|
+
if ($[23] !== pageBlocks_0 || $[24] !== peekedBlockPosition) {
|
|
207
200
|
t10 = (block_1) => {
|
|
208
201
|
const afterPosition_1 = peekedBlockPosition === "" ? "" : peekedBlockPosition ?? pageBlocks_0[pageBlocks_0.length - 1]?.position;
|
|
209
202
|
previewStore.send({
|
|
@@ -212,10 +205,10 @@ const AddBlockSidebar = () => {
|
|
|
212
205
|
afterPosition: afterPosition_1
|
|
213
206
|
});
|
|
214
207
|
};
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
218
|
-
} else t10 = $[
|
|
208
|
+
$[23] = pageBlocks_0;
|
|
209
|
+
$[24] = peekedBlockPosition;
|
|
210
|
+
$[25] = t10;
|
|
211
|
+
} else t10 = $[25];
|
|
219
212
|
const handlePreviewBlock = t10;
|
|
220
213
|
const handleValueChange = (value) => {
|
|
221
214
|
setHighlightedValue(value);
|
|
@@ -224,62 +217,62 @@ const AddBlockSidebar = () => {
|
|
|
224
217
|
else previewStore.send({ type: "clearPeekedBlock" });
|
|
225
218
|
};
|
|
226
219
|
let t11;
|
|
227
|
-
if ($[
|
|
220
|
+
if ($[26] !== pageCounts || $[27] !== totalCounts) {
|
|
228
221
|
t11 = (blockId_0) => {
|
|
229
222
|
const total = totalCounts[blockId_0] ?? 0;
|
|
230
223
|
if (total === 0) return "Never used";
|
|
231
224
|
const page_0 = pageCounts[blockId_0] ?? "none";
|
|
232
225
|
return `${total} use${total > 1 ? "s" : ""} (${page_0} here)`;
|
|
233
226
|
};
|
|
234
|
-
$[
|
|
235
|
-
$[
|
|
236
|
-
$[
|
|
237
|
-
} else t11 = $[
|
|
227
|
+
$[26] = pageCounts;
|
|
228
|
+
$[27] = totalCounts;
|
|
229
|
+
$[28] = t11;
|
|
230
|
+
} else t11 = $[28];
|
|
238
231
|
const displayCount = t11;
|
|
239
232
|
let t12;
|
|
240
|
-
if ($[
|
|
233
|
+
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
|
|
241
234
|
t12 = /* @__PURE__ */ jsx("div", {
|
|
242
|
-
className: "px-2 pt-
|
|
235
|
+
className: "px-2 pt-2",
|
|
243
236
|
children: /* @__PURE__ */ jsxs(Button, {
|
|
244
237
|
variant: "ghost",
|
|
245
238
|
className: "w-full justify-start",
|
|
246
|
-
onClick:
|
|
239
|
+
onClick: _temp4,
|
|
247
240
|
children: [/* @__PURE__ */ jsx(ArrowLeft, { className: "text-muted-foreground" }), "Add new block"]
|
|
248
241
|
})
|
|
249
242
|
});
|
|
250
|
-
$[
|
|
251
|
-
} else t12 = $[
|
|
243
|
+
$[29] = t12;
|
|
244
|
+
} else t12 = $[29];
|
|
252
245
|
const T0 = PanelContent;
|
|
253
|
-
const t13 = "flex grow basis-0 flex-col overflow-
|
|
246
|
+
const t13 = "flex min-h-0 grow basis-0 flex-col overflow-hidden px-2 pt-2";
|
|
254
247
|
const T1 = Command;
|
|
255
|
-
const t14 = "
|
|
256
|
-
const t15 =
|
|
248
|
+
const t14 = "h-0 min-h-0 flex-1 rounded-none! bg-transparent! p-0!";
|
|
249
|
+
const t15 = _temp5;
|
|
257
250
|
let t16;
|
|
258
|
-
if ($[
|
|
251
|
+
if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
|
|
259
252
|
t16 = /* @__PURE__ */ jsx(CommandInput, {
|
|
260
253
|
placeholder: "Search blocks...",
|
|
261
254
|
className: "px-0 pt-0",
|
|
262
255
|
autoFocus: true
|
|
263
256
|
});
|
|
264
|
-
$[
|
|
265
|
-
} else t16 = $[
|
|
257
|
+
$[30] = t16;
|
|
258
|
+
} else t16 = $[30];
|
|
266
259
|
const T2 = CommandList;
|
|
267
|
-
const t17 = "mt-2 max-h-
|
|
260
|
+
const t17 = "mt-2 max-h-none min-h-0 flex-1 pb-2";
|
|
268
261
|
let t18;
|
|
269
|
-
if ($[
|
|
262
|
+
if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
|
|
270
263
|
t18 = /* @__PURE__ */ jsx(CommandEmpty, { children: "No blocks found." });
|
|
271
|
-
$[
|
|
272
|
-
} else t18 = $[
|
|
264
|
+
$[31] = t18;
|
|
265
|
+
} else t18 = $[31];
|
|
273
266
|
const T3 = CommandGroup;
|
|
274
267
|
const t19 = "p-0";
|
|
275
268
|
let t20;
|
|
276
|
-
if ($[
|
|
269
|
+
if ($[32] !== totalCounts) {
|
|
277
270
|
t20 = (a, b_3) => (totalCounts[b_3._internal.id] ?? 0) - (totalCounts[a._internal.id] ?? 0);
|
|
278
|
-
$[
|
|
279
|
-
$[
|
|
280
|
-
} else t20 = $[
|
|
271
|
+
$[32] = totalCounts;
|
|
272
|
+
$[33] = t20;
|
|
273
|
+
} else t20 = $[33];
|
|
281
274
|
let t21;
|
|
282
|
-
if ($[
|
|
275
|
+
if ($[34] !== displayCount || $[35] !== handleAddBlock) {
|
|
283
276
|
t21 = (block_3) => /* @__PURE__ */ jsxs(CommandItem, {
|
|
284
277
|
value: block_3._internal.title,
|
|
285
278
|
keywords: [block_3._internal.description ?? ""],
|
|
@@ -287,7 +280,7 @@ const AddBlockSidebar = () => {
|
|
|
287
280
|
onSelect: () => {
|
|
288
281
|
handleAddBlock(block_3);
|
|
289
282
|
},
|
|
290
|
-
className: "group bg-card data-[selected=true]:border-primary
|
|
283
|
+
className: "group bg-card data-[selected=true]:border-primary mb-3 flex flex-col items-stretch gap-0 overflow-hidden rounded-lg border-2 p-0 last:mb-0",
|
|
291
284
|
children: [/* @__PURE__ */ jsx(BlockThumbnail, { block: block_3 }), /* @__PURE__ */ jsxs("div", {
|
|
292
285
|
className: "border-border flex flex-col gap-1 border-t px-3 py-2",
|
|
293
286
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -306,34 +299,34 @@ const AddBlockSidebar = () => {
|
|
|
306
299
|
})]
|
|
307
300
|
})]
|
|
308
301
|
}, block_3._internal.id);
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
311
|
-
$[
|
|
312
|
-
} else t21 = $[
|
|
302
|
+
$[34] = displayCount;
|
|
303
|
+
$[35] = handleAddBlock;
|
|
304
|
+
$[36] = t21;
|
|
305
|
+
} else t21 = $[36];
|
|
313
306
|
const t22 = availableBlocks.sort(t20).map(t21);
|
|
314
307
|
let t23;
|
|
315
|
-
if ($[
|
|
308
|
+
if ($[37] !== T3 || $[38] !== t22) {
|
|
316
309
|
t23 = /* @__PURE__ */ jsx(T3, {
|
|
317
310
|
className: t19,
|
|
318
311
|
children: t22
|
|
319
312
|
});
|
|
320
|
-
$[
|
|
321
|
-
$[
|
|
322
|
-
$[
|
|
323
|
-
} else t23 = $[
|
|
313
|
+
$[37] = T3;
|
|
314
|
+
$[38] = t22;
|
|
315
|
+
$[39] = t23;
|
|
316
|
+
} else t23 = $[39];
|
|
324
317
|
let t24;
|
|
325
|
-
if ($[
|
|
318
|
+
if ($[40] !== T2 || $[41] !== t18 || $[42] !== t23) {
|
|
326
319
|
t24 = /* @__PURE__ */ jsxs(T2, {
|
|
327
320
|
className: t17,
|
|
328
321
|
children: [t18, t23]
|
|
329
322
|
});
|
|
330
|
-
$[
|
|
331
|
-
$[
|
|
332
|
-
$[
|
|
333
|
-
$[
|
|
334
|
-
} else t24 = $[
|
|
323
|
+
$[40] = T2;
|
|
324
|
+
$[41] = t18;
|
|
325
|
+
$[42] = t23;
|
|
326
|
+
$[43] = t24;
|
|
327
|
+
} else t24 = $[43];
|
|
335
328
|
let t25;
|
|
336
|
-
if ($[
|
|
329
|
+
if ($[44] !== T1 || $[45] !== handleValueChange || $[46] !== highlightedValue || $[47] !== t15 || $[48] !== t16 || $[49] !== t24) {
|
|
337
330
|
t25 = /* @__PURE__ */ jsxs(T1, {
|
|
338
331
|
value: highlightedValue,
|
|
339
332
|
onValueChange: handleValueChange,
|
|
@@ -341,31 +334,31 @@ const AddBlockSidebar = () => {
|
|
|
341
334
|
onKeyDown: t15,
|
|
342
335
|
children: [t16, t24]
|
|
343
336
|
});
|
|
344
|
-
$[
|
|
345
|
-
$[
|
|
346
|
-
$[
|
|
347
|
-
$[
|
|
348
|
-
$[
|
|
349
|
-
$[
|
|
350
|
-
$[
|
|
351
|
-
} else t25 = $[
|
|
337
|
+
$[44] = T1;
|
|
338
|
+
$[45] = handleValueChange;
|
|
339
|
+
$[46] = highlightedValue;
|
|
340
|
+
$[47] = t15;
|
|
341
|
+
$[48] = t16;
|
|
342
|
+
$[49] = t24;
|
|
343
|
+
$[50] = t25;
|
|
344
|
+
} else t25 = $[50];
|
|
352
345
|
let t26;
|
|
353
|
-
if ($[
|
|
346
|
+
if ($[51] !== T0 || $[52] !== t25) {
|
|
354
347
|
t26 = /* @__PURE__ */ jsx(T0, {
|
|
355
348
|
className: t13,
|
|
356
349
|
children: t25
|
|
357
350
|
});
|
|
358
|
-
$[
|
|
359
|
-
$[
|
|
360
|
-
$[
|
|
361
|
-
} else t26 = $[
|
|
351
|
+
$[51] = T0;
|
|
352
|
+
$[52] = t25;
|
|
353
|
+
$[53] = t26;
|
|
354
|
+
} else t26 = $[53];
|
|
362
355
|
let t27;
|
|
363
|
-
if ($[
|
|
356
|
+
if ($[54] !== t12 || $[55] !== t26) {
|
|
364
357
|
t27 = /* @__PURE__ */ jsxs(Fragment, { children: [t12, t26] });
|
|
365
|
-
$[
|
|
366
|
-
$[
|
|
367
|
-
$[
|
|
368
|
-
} else t27 = $[
|
|
358
|
+
$[54] = t12;
|
|
359
|
+
$[55] = t26;
|
|
360
|
+
$[56] = t27;
|
|
361
|
+
} else t27 = $[56];
|
|
369
362
|
return t27;
|
|
370
363
|
};
|
|
371
364
|
function _temp(b) {
|
|
@@ -377,13 +370,10 @@ function _temp2(b_1) {
|
|
|
377
370
|
function _temp3(state) {
|
|
378
371
|
return state.context.peekedBlockPosition;
|
|
379
372
|
}
|
|
380
|
-
function _temp4(
|
|
381
|
-
return state_0.context.addBlockSource;
|
|
382
|
-
}
|
|
383
|
-
function _temp5() {
|
|
373
|
+
function _temp4() {
|
|
384
374
|
return previewStore.send({ type: "closeAddBlockSidebar" });
|
|
385
375
|
}
|
|
386
|
-
function
|
|
376
|
+
function _temp5(e) {
|
|
387
377
|
if (e.key === "Escape") previewStore.send({ type: "closeAddBlockSidebar" });
|
|
388
378
|
}
|
|
389
379
|
|
|
@@ -2,7 +2,6 @@ import { getAuthCookieHeader, getAuthRequestCredentials } from "../../../lib/aut
|
|
|
2
2
|
import { getApiUrl, getEnvironmentName } from "../../../lib/api-client.js";
|
|
3
3
|
import { isRasterImage, transformImageUrl } from "../../../core/lib/imageTransform.js";
|
|
4
4
|
import { fileMutations, fileQueries } from "../../../lib/queries.js";
|
|
5
|
-
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
6
5
|
import { UploadDropZone } from "../../content/components/UploadDropZone.js";
|
|
7
6
|
import { DebouncedFieldEditor } from "./DebouncedFieldEditor.js";
|
|
8
7
|
import { Metadata, MetadataRow, formatRelativeTime } from "./Metadata.js";
|
|
@@ -22,9 +21,9 @@ import { Switch } from "@camox/ui/switch";
|
|
|
22
21
|
//#region src/features/preview/components/AssetLightbox.tsx
|
|
23
22
|
function DeliveredSize(t0) {
|
|
24
23
|
const $ = c(16);
|
|
25
|
-
if ($[0] !== "
|
|
24
|
+
if ($[0] !== "974fbfa56da78c6c8e188316efcb7f5517bffbf74578eecb8288c82aad4e9b63") {
|
|
26
25
|
for (let $i = 0; $i < 16; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
27
|
-
$[0] = "
|
|
26
|
+
$[0] = "974fbfa56da78c6c8e188316efcb7f5517bffbf74578eecb8288c82aad4e9b63";
|
|
28
27
|
}
|
|
29
28
|
const { bytes, raw } = t0;
|
|
30
29
|
if (bytes == null) {
|
|
@@ -93,9 +92,9 @@ function DeliveredSize(t0) {
|
|
|
93
92
|
}
|
|
94
93
|
function DeliveredLabel(t0) {
|
|
95
94
|
const $ = c(4);
|
|
96
|
-
if ($[0] !== "
|
|
95
|
+
if ($[0] !== "974fbfa56da78c6c8e188316efcb7f5517bffbf74578eecb8288c82aad4e9b63") {
|
|
97
96
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
98
|
-
$[0] = "
|
|
97
|
+
$[0] = "974fbfa56da78c6c8e188316efcb7f5517bffbf74578eecb8288c82aad4e9b63";
|
|
99
98
|
}
|
|
100
99
|
const { children } = t0;
|
|
101
100
|
let t1;
|
|
@@ -460,12 +459,6 @@ const AssetLightbox = ({ open, onOpenChange, fileId }) => {
|
|
|
460
459
|
id: fileId,
|
|
461
460
|
enabled: checked
|
|
462
461
|
});
|
|
463
|
-
trackClientEvent("ai_metadata_toggled", {
|
|
464
|
-
target: "file",
|
|
465
|
-
enabled: checked,
|
|
466
|
-
fileId,
|
|
467
|
-
mimeType: file.mimeType
|
|
468
|
-
});
|
|
469
462
|
}
|
|
470
463
|
}), /* @__PURE__ */ jsx(Label, {
|
|
471
464
|
htmlFor: "ai-metadata",
|