camox 0.34.0 → 0.36.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/InlineLexicalEditor.js +1 -1
- package/dist/core/components/lexical/SidebarLexicalEditor.js +7 -7
- package/dist/core/components/lexical/TextLinkPopover.js +4 -4
- package/dist/core/createApp.d.ts +2 -1
- package/dist/core/createBlock.d.ts +5 -1451
- package/dist/core/createBlock.js +449 -1602
- package/dist/core/editing/BlockEditingRuntime.js +36 -0
- package/dist/core/editing/CompleteBlockEditingRuntime.js +76 -0
- package/dist/core/editing/createEditableBlock.d.ts +1455 -0
- package/dist/core/editing/createEditableBlock.js +1751 -0
- package/dist/core/lib/lexicalState.js +1 -1
- package/dist/features/agent-chat/components/AgentChatSidebar.js +1 -1
- package/dist/features/content/components/AssetCard.js +1 -1
- package/dist/features/page/PublishedPageContent.js +236 -0
- package/dist/features/page/PublishedPageExperience.js +23 -0
- package/dist/features/preview/CamoxPreview.d.ts +1 -0
- package/dist/features/preview/CamoxPreview.js +110 -93
- package/dist/features/preview/EditablePageContent.js +3 -0
- package/dist/features/preview/EditablePageExperience.js +24 -0
- package/dist/features/preview/components/AddBlockSidebar.js +3 -3
- package/dist/features/preview/components/AssetFieldEditor.js +1 -1
- package/dist/features/preview/components/AssetLightbox.js +47 -111
- package/dist/features/preview/components/BlockActionsPopover.js +6 -6
- package/dist/features/preview/components/CreatePageModal.js +4 -4
- package/dist/features/preview/components/DebouncedFieldEditor.js +2 -2
- package/dist/features/preview/components/DraftSwitchDialog.js +1 -1
- package/dist/features/preview/components/FieldToolbar.js +3 -3
- package/dist/features/preview/components/Frame.js +1 -1
- package/dist/features/preview/components/ItemFieldsEditor.js +3 -3
- package/dist/features/preview/components/LeftSidebar.js +1 -1
- package/dist/features/preview/components/LinkFieldEditor.js +3 -3
- package/dist/features/preview/components/Metadata.js +87 -0
- package/dist/features/preview/components/MultipleAssetFieldEditor.js +1 -1
- package/dist/features/preview/components/OverlayTracker.js +3 -3
- package/dist/features/preview/components/Overlays.js +3 -3
- package/dist/features/preview/components/PageEditorSidebar.js +40 -30
- package/dist/features/preview/components/PageInfoSidebar.js +158 -74
- package/dist/features/preview/components/PageLocationFieldset.js +1 -1
- package/dist/features/preview/components/PageNavigatorSidebar.js +244 -316
- package/dist/features/preview/components/PageNicknameField.js +2 -2
- package/dist/features/preview/components/PagePicker.js +3 -3
- package/dist/features/preview/components/PageTree.js +3 -3
- package/dist/features/preview/components/PeekedBlock.js +2 -2
- package/dist/features/preview/components/PreviewPanel.js +2 -2
- package/dist/features/preview/components/PreviewToolbar.js +77 -51
- package/dist/features/preview/components/PublishDialog.js +2 -2
- package/dist/features/preview/components/RepeatableItemsList.js +1 -1
- package/dist/features/preview/components/RightSidebar.js +1 -1
- package/dist/features/preview/components/useRepeatableItemActions.js +1 -1
- package/dist/features/preview/components/useUpdateBlockPosition.js +1 -1
- package/dist/features/preview/previewStore.js +13 -6
- package/dist/features/provider/AuthenticatedCamoxProvider.js +63 -0
- package/dist/features/provider/CamoxProvider.d.ts +5 -12
- package/dist/features/provider/CamoxProvider.js +80 -338
- package/dist/features/provider/CoreCamoxProvider.js +37 -0
- package/dist/features/provider/LocalhostPreviewProvider.js +159 -0
- package/dist/features/provider/components/CommandPalette.js +1 -1
- package/dist/features/provider/useAdminShortcuts.js +1 -1
- package/dist/features/runtime/hydrationData.js +9 -0
- package/dist/features/runtime/pageApp.js +148 -35
- package/dist/features/runtime/pageClient.d.ts +1 -2
- package/dist/features/runtime/pageClient.js +3 -20
- package/dist/features/runtime/runtime.d.ts +1 -0
- package/dist/features/runtime/studioApp.js +76 -8
- package/dist/features/runtime/studioClient.d.ts +6 -0
- package/dist/features/runtime/studioClient.js +20 -0
- package/dist/features/runtime/studioNavigation.js +7 -2
- package/dist/features/studio/CamoxStudio.js +1 -1
- package/dist/features/studio/components/EnvironmentMenu.js +2 -2
- package/dist/features/studio/components/Navbar.js +5 -5
- package/dist/features/studio/components/ProjectMenu.js +5 -5
- package/dist/features/studio/useTheme.js +1 -22
- package/dist/features/vite/runtimeDev.js +24 -3
- package/dist/features/vite/vite.d.ts +1 -1
- package/dist/features/vite/vite.js +9 -3
- package/dist/lib/normalized-data.js +6 -6
- package/dist/lib/telemetry-client.js +2 -2
- package/dist/lib/view-queries.js +28 -0
- package/dist/studio.css +1 -1
- package/package.json +9 -4
|
@@ -2,25 +2,25 @@ import { useLocation, useNavigate } from "../navigation/navigation.js";
|
|
|
2
2
|
import { actionsStore } from "../provider/actionsStore.js";
|
|
3
3
|
import { useIsAuthenticated, useProjectSlug } from "../../lib/auth.js";
|
|
4
4
|
import { getApiClient } from "../../lib/api-client.js";
|
|
5
|
-
import { blockQueries, pageQueries, projectQueries } from "../../lib/queries.js";
|
|
6
|
-
import { cn } from "../../lib/utils.js";
|
|
7
|
-
import { previewStore } from "./previewStore.js";
|
|
8
5
|
import { NormalizedDataProvider, seedBlockCaches, usePageBlocks } from "../../lib/normalized-data.js";
|
|
9
6
|
import { BlockErrorBoundary } from "./components/BlockErrorBoundary.js";
|
|
7
|
+
import { blockQueries, pageQueries, projectQueries } from "../../lib/queries.js";
|
|
8
|
+
import { cn } from "../../lib/utils.js";
|
|
10
9
|
import { useCamoxApp } from "../provider/components/CamoxAppContext.js";
|
|
11
10
|
import { Navbar } from "../studio/components/Navbar.js";
|
|
11
|
+
import { previewStore } from "./previewStore.js";
|
|
12
12
|
import { CreatePageModal } from "./components/CreatePageModal.js";
|
|
13
13
|
import { DraftSwitchDialog } from "./components/DraftSwitchDialog.js";
|
|
14
|
-
import { pageFullQueryFn } from "./previewQueryFns.js";
|
|
15
14
|
import { LeftSidebar } from "./components/LeftSidebar.js";
|
|
16
15
|
import { PeekedBlock } from "./components/PeekedBlock.js";
|
|
17
16
|
import { PreviewPanel } from "./components/PreviewPanel.js";
|
|
18
17
|
import { RightSidebar } from "./components/RightSidebar.js";
|
|
18
|
+
import { pageFullQueryFn } from "./previewQueryFns.js";
|
|
19
19
|
import { c } from "react/compiler-runtime";
|
|
20
20
|
import { keepPreviousData, useQuery, useQueryClient, useSuspenseQuery } from "@tanstack/react-query";
|
|
21
|
-
import { useSelector } from "@xstate/store-react";
|
|
22
21
|
import * as React from "react";
|
|
23
22
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
+
import { useSelector } from "@xstate/store-react";
|
|
24
24
|
import { queryKeys } from "@camox/api-contract/query-keys";
|
|
25
25
|
|
|
26
26
|
//#region src/features/preview/CamoxPreview.tsx
|
|
@@ -51,9 +51,9 @@ function pageStructureQueryFn(path, projectSlug, source) {
|
|
|
51
51
|
}
|
|
52
52
|
function usePreviewedPage() {
|
|
53
53
|
const $ = c(26);
|
|
54
|
-
if ($[0] !== "
|
|
54
|
+
if ($[0] !== "a8aadbae83f448aedc99fd8344f3c11935e775ce61e901362c961f0c7099892d") {
|
|
55
55
|
for (let $i = 0; $i < 26; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
56
|
-
$[0] = "
|
|
56
|
+
$[0] = "a8aadbae83f448aedc99fd8344f3c11935e775ce61e901362c961f0c7099892d";
|
|
57
57
|
}
|
|
58
58
|
const { pathname } = useLocation();
|
|
59
59
|
const queryClient = useQueryClient();
|
|
@@ -150,9 +150,9 @@ function _temp(state) {
|
|
|
150
150
|
}
|
|
151
151
|
const BlockRenderer = (t0) => {
|
|
152
152
|
const $ = c(23);
|
|
153
|
-
if ($[0] !== "
|
|
153
|
+
if ($[0] !== "a8aadbae83f448aedc99fd8344f3c11935e775ce61e901362c961f0c7099892d") {
|
|
154
154
|
for (let $i = 0; $i < 23; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
155
|
-
$[0] = "
|
|
155
|
+
$[0] = "a8aadbae83f448aedc99fd8344f3c11935e775ce61e901362c961f0c7099892d";
|
|
156
156
|
}
|
|
157
157
|
const { blockId, mode, showAddBlockTop, showAddBlockBottom } = t0;
|
|
158
158
|
const previewSource = useSelector(previewStore, _temp3);
|
|
@@ -295,9 +295,9 @@ const PageContent = () => {
|
|
|
295
295
|
};
|
|
296
296
|
function useHydrateDraftCache() {
|
|
297
297
|
const $ = c(7);
|
|
298
|
-
if ($[0] !== "
|
|
298
|
+
if ($[0] !== "a8aadbae83f448aedc99fd8344f3c11935e775ce61e901362c961f0c7099892d") {
|
|
299
299
|
for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
300
|
-
$[0] = "
|
|
300
|
+
$[0] = "a8aadbae83f448aedc99fd8344f3c11935e775ce61e901362c961f0c7099892d";
|
|
301
301
|
}
|
|
302
302
|
const isAuthenticated = useIsAuthenticated();
|
|
303
303
|
const queryClient = useQueryClient();
|
|
@@ -347,15 +347,16 @@ function useHydrateDraftCache() {
|
|
|
347
347
|
}
|
|
348
348
|
function _temp4() {}
|
|
349
349
|
const CamoxPreview = (t0) => {
|
|
350
|
-
const $ = c(
|
|
351
|
-
if ($[0] !== "
|
|
352
|
-
for (let $i = 0; $i <
|
|
353
|
-
$[0] = "
|
|
350
|
+
const $ = c(39);
|
|
351
|
+
if ($[0] !== "a8aadbae83f448aedc99fd8344f3c11935e775ce61e901362c961f0c7099892d") {
|
|
352
|
+
for (let $i = 0; $i < 39; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
353
|
+
$[0] = "a8aadbae83f448aedc99fd8344f3c11935e775ce61e901362c961f0c7099892d";
|
|
354
354
|
}
|
|
355
355
|
const { children } = t0;
|
|
356
356
|
const isAuthenticated = useIsAuthenticated();
|
|
357
357
|
const isEditMode = useSelector(previewStore, _temp5);
|
|
358
|
-
const
|
|
358
|
+
const isToolbarHidden = useSelector(previewStore, _temp6);
|
|
359
|
+
const previewSource = useSelector(previewStore, _temp7);
|
|
359
360
|
const pageData = usePreviewedPage();
|
|
360
361
|
useHydrateDraftCache();
|
|
361
362
|
const hasLiveCheckpoint = pageData.page.livePublishedCheckpointId != null;
|
|
@@ -375,7 +376,7 @@ const CamoxPreview = (t0) => {
|
|
|
375
376
|
],
|
|
376
377
|
groupLabel: "Preview",
|
|
377
378
|
checkIfAvailable: () => isAuthenticated && isEditMode,
|
|
378
|
-
execute:
|
|
379
|
+
execute: _temp8,
|
|
379
380
|
shortcut: {
|
|
380
381
|
key: "Enter",
|
|
381
382
|
withMeta: true
|
|
@@ -391,7 +392,7 @@ const CamoxPreview = (t0) => {
|
|
|
391
392
|
],
|
|
392
393
|
groupLabel: "Preview",
|
|
393
394
|
checkIfAvailable: () => isAuthenticated && !isEditMode,
|
|
394
|
-
execute:
|
|
395
|
+
execute: _temp9,
|
|
395
396
|
shortcut: {
|
|
396
397
|
key: "Enter",
|
|
397
398
|
withMeta: true
|
|
@@ -407,7 +408,7 @@ const CamoxPreview = (t0) => {
|
|
|
407
408
|
],
|
|
408
409
|
groupLabel: "Preview",
|
|
409
410
|
checkIfAvailable: () => isAuthenticated && previewSource === "draft" && hasLiveCheckpoint,
|
|
410
|
-
execute:
|
|
411
|
+
execute: _temp0,
|
|
411
412
|
shortcut: {
|
|
412
413
|
key: "d",
|
|
413
414
|
withAlt: true
|
|
@@ -423,7 +424,7 @@ const CamoxPreview = (t0) => {
|
|
|
423
424
|
],
|
|
424
425
|
groupLabel: "Preview",
|
|
425
426
|
checkIfAvailable: () => isAuthenticated && previewSource === "live",
|
|
426
|
-
execute:
|
|
427
|
+
execute: _temp1,
|
|
427
428
|
shortcut: {
|
|
428
429
|
key: "d",
|
|
429
430
|
withAlt: true
|
|
@@ -434,8 +435,8 @@ const CamoxPreview = (t0) => {
|
|
|
434
435
|
label: "Clear selection",
|
|
435
436
|
aliases: ["Deselect", "Unselect"],
|
|
436
437
|
groupLabel: "Preview",
|
|
437
|
-
checkIfAvailable:
|
|
438
|
-
execute:
|
|
438
|
+
checkIfAvailable: _temp10,
|
|
439
|
+
execute: _temp11,
|
|
439
440
|
shortcut: { key: "Escape" }
|
|
440
441
|
}
|
|
441
442
|
];
|
|
@@ -446,7 +447,7 @@ const CamoxPreview = (t0) => {
|
|
|
446
447
|
return () => {
|
|
447
448
|
actionsStore.send({
|
|
448
449
|
type: "unregisterManyActions",
|
|
449
|
-
ids: actions.map(
|
|
450
|
+
ids: actions.map(_temp12)
|
|
450
451
|
});
|
|
451
452
|
};
|
|
452
453
|
};
|
|
@@ -476,7 +477,6 @@ const CamoxPreview = (t0) => {
|
|
|
476
477
|
} else t3 = $[8];
|
|
477
478
|
return t3;
|
|
478
479
|
}
|
|
479
|
-
const shouldShowStudioChrome = isEditMode;
|
|
480
480
|
const t3 = !isEditMode && "bg-black";
|
|
481
481
|
let t4;
|
|
482
482
|
if ($[9] !== t3) {
|
|
@@ -485,85 +485,99 @@ const CamoxPreview = (t0) => {
|
|
|
485
485
|
$[10] = t4;
|
|
486
486
|
} else t4 = $[10];
|
|
487
487
|
let t5;
|
|
488
|
-
if ($[11] !==
|
|
489
|
-
t5 =
|
|
490
|
-
$[11] =
|
|
488
|
+
if ($[11] !== isToolbarHidden) {
|
|
489
|
+
t5 = !isToolbarHidden && /* @__PURE__ */ jsx(Navbar, {});
|
|
490
|
+
$[11] = isToolbarHidden;
|
|
491
491
|
$[12] = t5;
|
|
492
492
|
} else t5 = $[12];
|
|
493
493
|
let t6;
|
|
494
|
-
if ($[13] !==
|
|
495
|
-
t6 =
|
|
496
|
-
$[13] =
|
|
497
|
-
$[14] =
|
|
494
|
+
if ($[13] !== isEditMode || $[14] !== pageData.page) {
|
|
495
|
+
t6 = isEditMode && /* @__PURE__ */ jsx(LeftSidebar, { page: pageData.page });
|
|
496
|
+
$[13] = isEditMode;
|
|
497
|
+
$[14] = pageData.page;
|
|
498
498
|
$[15] = t6;
|
|
499
499
|
} else t6 = $[15];
|
|
500
500
|
let t7;
|
|
501
|
-
if ($[16] !==
|
|
502
|
-
t7 =
|
|
501
|
+
if ($[16] !== hasLiveCheckpoint || $[17] !== pageData.page.status) {
|
|
502
|
+
t7 = {
|
|
503
|
+
pageStatus: pageData.page.status,
|
|
504
|
+
hasLiveVersion: hasLiveCheckpoint
|
|
505
|
+
};
|
|
506
|
+
$[16] = hasLiveCheckpoint;
|
|
507
|
+
$[17] = pageData.page.status;
|
|
508
|
+
$[18] = t7;
|
|
509
|
+
} else t7 = $[18];
|
|
510
|
+
let t8;
|
|
511
|
+
if ($[19] !== isEditMode) {
|
|
512
|
+
t8 = isEditMode && /* @__PURE__ */ jsx("div", { style: {
|
|
503
513
|
height: "80px",
|
|
504
514
|
background: "transparent"
|
|
505
515
|
} });
|
|
506
|
-
$[
|
|
507
|
-
$[17] = t7;
|
|
508
|
-
} else t7 = $[17];
|
|
509
|
-
let t8;
|
|
510
|
-
if ($[18] !== children || $[19] !== t7) {
|
|
511
|
-
t8 = /* @__PURE__ */ jsxs(PreviewPanel, { children: [children, t7] });
|
|
512
|
-
$[18] = children;
|
|
513
|
-
$[19] = t7;
|
|
516
|
+
$[19] = isEditMode;
|
|
514
517
|
$[20] = t8;
|
|
515
518
|
} else t8 = $[20];
|
|
516
519
|
let t9;
|
|
517
|
-
if ($[21] !==
|
|
518
|
-
t9 =
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
520
|
+
if ($[21] !== children || $[22] !== t7 || $[23] !== t8) {
|
|
521
|
+
t9 = /* @__PURE__ */ jsxs(PreviewPanel, {
|
|
522
|
+
toolbarProps: t7,
|
|
523
|
+
children: [children, t8]
|
|
524
|
+
});
|
|
525
|
+
$[21] = children;
|
|
526
|
+
$[22] = t7;
|
|
527
|
+
$[23] = t8;
|
|
528
|
+
$[24] = t9;
|
|
529
|
+
} else t9 = $[24];
|
|
523
530
|
let t10;
|
|
524
|
-
if ($[
|
|
525
|
-
t10 = /* @__PURE__ */
|
|
531
|
+
if ($[25] !== isEditMode || $[26] !== pageData.page.id) {
|
|
532
|
+
t10 = isEditMode && /* @__PURE__ */ jsx(RightSidebar, { pageId: pageData.page.id });
|
|
533
|
+
$[25] = isEditMode;
|
|
534
|
+
$[26] = pageData.page.id;
|
|
535
|
+
$[27] = t10;
|
|
536
|
+
} else t10 = $[27];
|
|
537
|
+
let t11;
|
|
538
|
+
if ($[28] !== t10 || $[29] !== t6 || $[30] !== t9) {
|
|
539
|
+
t11 = /* @__PURE__ */ jsxs("div", {
|
|
526
540
|
className: "flex h-full flex-row items-stretch",
|
|
527
541
|
children: [
|
|
528
542
|
t6,
|
|
529
|
-
|
|
530
|
-
|
|
543
|
+
t9,
|
|
544
|
+
t10
|
|
531
545
|
]
|
|
532
546
|
});
|
|
533
|
-
$[
|
|
534
|
-
$[
|
|
535
|
-
$[
|
|
536
|
-
$[
|
|
537
|
-
} else
|
|
538
|
-
let t11;
|
|
539
|
-
if ($[28] !== shouldShowStudioChrome) {
|
|
540
|
-
t11 = shouldShowStudioChrome && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CreatePageModal, {}), /* @__PURE__ */ jsx(DraftSwitchDialog, {})] });
|
|
541
|
-
$[28] = shouldShowStudioChrome;
|
|
542
|
-
$[29] = t11;
|
|
543
|
-
} else t11 = $[29];
|
|
547
|
+
$[28] = t10;
|
|
548
|
+
$[29] = t6;
|
|
549
|
+
$[30] = t9;
|
|
550
|
+
$[31] = t11;
|
|
551
|
+
} else t11 = $[31];
|
|
544
552
|
let t12;
|
|
545
|
-
if ($[
|
|
546
|
-
t12 = /* @__PURE__ */ jsxs(
|
|
553
|
+
if ($[32] !== isEditMode) {
|
|
554
|
+
t12 = isEditMode && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CreatePageModal, {}), /* @__PURE__ */ jsx(DraftSwitchDialog, {})] });
|
|
555
|
+
$[32] = isEditMode;
|
|
556
|
+
$[33] = t12;
|
|
557
|
+
} else t12 = $[33];
|
|
558
|
+
let t13;
|
|
559
|
+
if ($[34] !== t11 || $[35] !== t12 || $[36] !== t4 || $[37] !== t5) {
|
|
560
|
+
t13 = /* @__PURE__ */ jsxs("div", {
|
|
547
561
|
className: t4,
|
|
548
562
|
children: [
|
|
549
563
|
t5,
|
|
550
|
-
|
|
551
|
-
|
|
564
|
+
t11,
|
|
565
|
+
t12
|
|
552
566
|
]
|
|
553
567
|
});
|
|
554
|
-
$[
|
|
555
|
-
$[
|
|
556
|
-
$[
|
|
557
|
-
$[
|
|
558
|
-
$[
|
|
559
|
-
} else
|
|
560
|
-
return
|
|
568
|
+
$[34] = t11;
|
|
569
|
+
$[35] = t12;
|
|
570
|
+
$[36] = t4;
|
|
571
|
+
$[37] = t5;
|
|
572
|
+
$[38] = t13;
|
|
573
|
+
} else t13 = $[38];
|
|
574
|
+
return t13;
|
|
561
575
|
};
|
|
562
576
|
function usePreviewPagesActions() {
|
|
563
577
|
const $ = c(13);
|
|
564
|
-
if ($[0] !== "
|
|
578
|
+
if ($[0] !== "a8aadbae83f448aedc99fd8344f3c11935e775ce61e901362c961f0c7099892d") {
|
|
565
579
|
for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
566
|
-
$[0] = "
|
|
580
|
+
$[0] = "a8aadbae83f448aedc99fd8344f3c11935e775ce61e901362c961f0c7099892d";
|
|
567
581
|
}
|
|
568
582
|
const navigate = useNavigate();
|
|
569
583
|
const { pathname } = useLocation();
|
|
@@ -604,8 +618,8 @@ function usePreviewPagesActions() {
|
|
|
604
618
|
label: "Create page",
|
|
605
619
|
aliases: ["New page", "Add page"],
|
|
606
620
|
groupLabel: "Preview",
|
|
607
|
-
checkIfAvailable:
|
|
608
|
-
execute:
|
|
621
|
+
checkIfAvailable: _temp13,
|
|
622
|
+
execute: _temp14
|
|
609
623
|
},
|
|
610
624
|
{
|
|
611
625
|
id: "edit-current-page",
|
|
@@ -636,14 +650,14 @@ function usePreviewPagesActions() {
|
|
|
636
650
|
groupLabel: "Preview",
|
|
637
651
|
checkIfAvailable: () => !!pages,
|
|
638
652
|
hasChildren: true,
|
|
639
|
-
execute:
|
|
653
|
+
execute: _temp15
|
|
640
654
|
},
|
|
641
655
|
...pages ? pages.map((page) => ({
|
|
642
656
|
id: `go-to-page-${page.id}`,
|
|
643
657
|
parentActionId: "go-to-page",
|
|
644
658
|
label: `Go to "${page.nickname}"`,
|
|
645
659
|
groupLabel: "Preview",
|
|
646
|
-
checkIfAvailable:
|
|
660
|
+
checkIfAvailable: _temp16,
|
|
647
661
|
execute: () => navigate({ to: page.fullPath })
|
|
648
662
|
})) : []
|
|
649
663
|
];
|
|
@@ -654,7 +668,7 @@ function usePreviewPagesActions() {
|
|
|
654
668
|
return () => {
|
|
655
669
|
actionsStore.send({
|
|
656
670
|
type: "unregisterManyActions",
|
|
657
|
-
ids: actions.map(
|
|
671
|
+
ids: actions.map(_temp17)
|
|
658
672
|
});
|
|
659
673
|
};
|
|
660
674
|
};
|
|
@@ -674,17 +688,17 @@ function usePreviewPagesActions() {
|
|
|
674
688
|
}
|
|
675
689
|
React.useEffect(t4, t5);
|
|
676
690
|
}
|
|
677
|
-
function
|
|
691
|
+
function _temp17(a) {
|
|
678
692
|
return a.id;
|
|
679
693
|
}
|
|
680
|
-
function
|
|
694
|
+
function _temp16() {
|
|
681
695
|
return true;
|
|
682
696
|
}
|
|
683
|
-
function
|
|
684
|
-
function
|
|
697
|
+
function _temp15() {}
|
|
698
|
+
function _temp14() {
|
|
685
699
|
return previewStore.send({ type: "openCreatePageModal" });
|
|
686
700
|
}
|
|
687
|
-
function
|
|
701
|
+
function _temp13() {
|
|
688
702
|
return true;
|
|
689
703
|
}
|
|
690
704
|
function _temp3(state) {
|
|
@@ -694,33 +708,36 @@ function _temp5(state) {
|
|
|
694
708
|
return state.context.isEditMode;
|
|
695
709
|
}
|
|
696
710
|
function _temp6(state_0) {
|
|
697
|
-
return state_0.context.
|
|
711
|
+
return state_0.context.isToolbarHidden;
|
|
698
712
|
}
|
|
699
|
-
function _temp7() {
|
|
700
|
-
return
|
|
713
|
+
function _temp7(state_1) {
|
|
714
|
+
return state_1.context.previewSource;
|
|
701
715
|
}
|
|
702
716
|
function _temp8() {
|
|
703
|
-
return previewStore.send({ type: "
|
|
717
|
+
return previewStore.send({ type: "exitEditMode" });
|
|
704
718
|
}
|
|
705
719
|
function _temp9() {
|
|
720
|
+
return previewStore.send({ type: "enterEditMode" });
|
|
721
|
+
}
|
|
722
|
+
function _temp0() {
|
|
706
723
|
return previewStore.send({
|
|
707
724
|
type: "setPreviewSource",
|
|
708
725
|
source: "live"
|
|
709
726
|
});
|
|
710
727
|
}
|
|
711
|
-
function
|
|
728
|
+
function _temp1() {
|
|
712
729
|
return previewStore.send({
|
|
713
730
|
type: "setPreviewSource",
|
|
714
731
|
source: "draft"
|
|
715
732
|
});
|
|
716
733
|
}
|
|
717
|
-
function
|
|
734
|
+
function _temp10() {
|
|
718
735
|
return true;
|
|
719
736
|
}
|
|
720
|
-
function
|
|
737
|
+
function _temp11() {
|
|
721
738
|
previewStore.send({ type: "clearSelection" });
|
|
722
739
|
}
|
|
723
|
-
function
|
|
740
|
+
function _temp12(a) {
|
|
724
741
|
return a.id;
|
|
725
742
|
}
|
|
726
743
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CamoxPreview, PageContent } from "./CamoxPreview.js";
|
|
2
|
+
import { AuthenticatedCamoxProvider } from "../provider/AuthenticatedCamoxProvider.js";
|
|
3
|
+
import { CompleteBlockEditingRuntimeProvider } from "../../core/editing/CompleteBlockEditingRuntime.js";
|
|
4
|
+
import "./EditablePageContent.js";
|
|
5
|
+
import { c } from "react/compiler-runtime";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/features/preview/EditablePageExperience.tsx
|
|
9
|
+
function EditablePageExperience(t0) {
|
|
10
|
+
const $ = c(2);
|
|
11
|
+
if ($[0] !== "62fa8b2b4207f6a9197bd7473308418337b4719a942b8cb83f05f5f584c962c9") {
|
|
12
|
+
for (let $i = 0; $i < 2; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
13
|
+
$[0] = "62fa8b2b4207f6a9197bd7473308418337b4719a942b8cb83f05f5f584c962c9";
|
|
14
|
+
}
|
|
15
|
+
let t1;
|
|
16
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
17
|
+
t1 = /* @__PURE__ */ jsx(AuthenticatedCamoxProvider, { children: /* @__PURE__ */ jsx(CompleteBlockEditingRuntimeProvider, { children: /* @__PURE__ */ jsx(CamoxPreview, { children: /* @__PURE__ */ jsx(PageContent, {}) }) }) });
|
|
18
|
+
$[1] = t1;
|
|
19
|
+
} else t1 = $[1];
|
|
20
|
+
return t1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { EditablePageExperience };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { useLocation } from "../../navigation/navigation.js";
|
|
2
2
|
import { useProjectSlug } from "../../../lib/auth.js";
|
|
3
|
+
import { usePageBlocks } from "../../../lib/normalized-data.js";
|
|
3
4
|
import { blockMutations, blockQueries, projectQueries } from "../../../lib/queries.js";
|
|
5
|
+
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
4
6
|
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
5
7
|
import { previewStore } from "../previewStore.js";
|
|
6
|
-
import { usePageBlocks } from "../../../lib/normalized-data.js";
|
|
7
|
-
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
8
8
|
import { useRequireDraftSource } from "../../../core/hooks/useRequireDraftSource.js";
|
|
9
9
|
import { usePreviewedPage } from "../CamoxPreview.js";
|
|
10
10
|
import { c } from "react/compiler-runtime";
|
|
11
11
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
12
|
-
import { useSelector } from "@xstate/store-react";
|
|
13
12
|
import { generateKeyBetween } from "fractional-indexing";
|
|
14
13
|
import * as React from "react";
|
|
15
14
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
import { useSelector } from "@xstate/store-react";
|
|
16
16
|
import { queryKeys } from "@camox/api-contract/query-keys";
|
|
17
17
|
import { Button } from "@camox/ui/button";
|
|
18
18
|
import { ArrowLeft } from "lucide-react";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useProjectSlug } from "../../../lib/auth.js";
|
|
2
|
-
import { projectQueries } from "../../../lib/queries.js";
|
|
3
2
|
import { transformImageUrl } from "../../../core/lib/imageTransform.js";
|
|
3
|
+
import { projectQueries } from "../../../lib/queries.js";
|
|
4
4
|
import { UploadDropZone } from "../../content/components/UploadDropZone.js";
|
|
5
5
|
import { UploadItemRow } from "../../content/components/UploadProgressDrawer.js";
|
|
6
6
|
import { useFileUpload } from "../../../hooks/use-file-upload.js";
|
|
@@ -1,75 +1,30 @@
|
|
|
1
1
|
import { getAuthCookieHeader, getAuthRequestCredentials } from "../../../lib/auth.js";
|
|
2
2
|
import { getApiUrl, getEnvironmentName } from "../../../lib/api-client.js";
|
|
3
|
+
import { isRasterImage, transformImageUrl } from "../../../core/lib/imageTransform.js";
|
|
3
4
|
import { fileMutations, fileQueries } from "../../../lib/queries.js";
|
|
4
5
|
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
5
|
-
import { isRasterImage, transformImageUrl } from "../../../core/lib/imageTransform.js";
|
|
6
6
|
import { UploadDropZone } from "../../content/components/UploadDropZone.js";
|
|
7
7
|
import { DebouncedFieldEditor } from "./DebouncedFieldEditor.js";
|
|
8
|
+
import { Metadata, MetadataRow, formatRelativeTime } from "./Metadata.js";
|
|
8
9
|
import { c } from "react/compiler-runtime";
|
|
9
|
-
import { Label } from "@camox/ui/label";
|
|
10
10
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
11
11
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { toast } from "@camox/ui/toaster";
|
|
14
13
|
import { Button } from "@camox/ui/button";
|
|
15
14
|
import { Check, Download, FileIcon, Info, Link, Loader2, Trash2, X } from "lucide-react";
|
|
15
|
+
import { toast } from "@camox/ui/toaster";
|
|
16
16
|
import { Dialog, DialogContent, DialogTitle } from "@camox/ui/dialog";
|
|
17
|
+
import { Label } from "@camox/ui/label";
|
|
17
18
|
import { ButtonGroup } from "@camox/ui/button-group";
|
|
18
|
-
import { Switch } from "@camox/ui/switch";
|
|
19
19
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@camox/ui/tooltip";
|
|
20
|
+
import { Switch } from "@camox/ui/switch";
|
|
20
21
|
|
|
21
22
|
//#region src/features/preview/components/AssetLightbox.tsx
|
|
22
|
-
function MetadataRow(t0) {
|
|
23
|
-
const $ = c(9);
|
|
24
|
-
if ($[0] !== "57c6d07de7206779e7a888ace2e7d9e6b374e2f3c9aed614f5bd25f704694553") {
|
|
25
|
-
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
26
|
-
$[0] = "57c6d07de7206779e7a888ace2e7d9e6b374e2f3c9aed614f5bd25f704694553";
|
|
27
|
-
}
|
|
28
|
-
const { label, children } = t0;
|
|
29
|
-
let t1;
|
|
30
|
-
if ($[1] !== label) {
|
|
31
|
-
t1 = /* @__PURE__ */ jsx("span", {
|
|
32
|
-
className: "shrink-0",
|
|
33
|
-
children: label
|
|
34
|
-
});
|
|
35
|
-
$[1] = label;
|
|
36
|
-
$[2] = t1;
|
|
37
|
-
} else t1 = $[2];
|
|
38
|
-
let t2;
|
|
39
|
-
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
40
|
-
t2 = /* @__PURE__ */ jsx("span", { className: "border-border min-w-0 flex-1 border-b" });
|
|
41
|
-
$[3] = t2;
|
|
42
|
-
} else t2 = $[3];
|
|
43
|
-
let t3;
|
|
44
|
-
if ($[4] !== children) {
|
|
45
|
-
t3 = /* @__PURE__ */ jsx("span", {
|
|
46
|
-
className: "text-foreground shrink-0",
|
|
47
|
-
children
|
|
48
|
-
});
|
|
49
|
-
$[4] = children;
|
|
50
|
-
$[5] = t3;
|
|
51
|
-
} else t3 = $[5];
|
|
52
|
-
let t4;
|
|
53
|
-
if ($[6] !== t1 || $[7] !== t3) {
|
|
54
|
-
t4 = /* @__PURE__ */ jsxs("div", {
|
|
55
|
-
className: "flex items-baseline gap-2",
|
|
56
|
-
children: [
|
|
57
|
-
t1,
|
|
58
|
-
t2,
|
|
59
|
-
t3
|
|
60
|
-
]
|
|
61
|
-
});
|
|
62
|
-
$[6] = t1;
|
|
63
|
-
$[7] = t3;
|
|
64
|
-
$[8] = t4;
|
|
65
|
-
} else t4 = $[8];
|
|
66
|
-
return t4;
|
|
67
|
-
}
|
|
68
23
|
function DeliveredSize(t0) {
|
|
69
24
|
const $ = c(16);
|
|
70
|
-
if ($[0] !== "
|
|
25
|
+
if ($[0] !== "1dc3a839581aee4dce763fdadc5f599293f7d6288e481a0914cf562382a66ab9") {
|
|
71
26
|
for (let $i = 0; $i < 16; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
72
|
-
$[0] = "
|
|
27
|
+
$[0] = "1dc3a839581aee4dce763fdadc5f599293f7d6288e481a0914cf562382a66ab9";
|
|
73
28
|
}
|
|
74
29
|
const { bytes, raw } = t0;
|
|
75
30
|
if (bytes == null) {
|
|
@@ -138,9 +93,9 @@ function DeliveredSize(t0) {
|
|
|
138
93
|
}
|
|
139
94
|
function DeliveredLabel(t0) {
|
|
140
95
|
const $ = c(4);
|
|
141
|
-
if ($[0] !== "
|
|
96
|
+
if ($[0] !== "1dc3a839581aee4dce763fdadc5f599293f7d6288e481a0914cf562382a66ab9") {
|
|
142
97
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
143
|
-
$[0] = "
|
|
98
|
+
$[0] = "1dc3a839581aee4dce763fdadc5f599293f7d6288e481a0914cf562382a66ab9";
|
|
144
99
|
}
|
|
145
100
|
const { children } = t0;
|
|
146
101
|
let t1;
|
|
@@ -175,22 +130,6 @@ function DeliveredLabel(t0) {
|
|
|
175
130
|
} else t2 = $[3];
|
|
176
131
|
return t2;
|
|
177
132
|
}
|
|
178
|
-
function formatRelativeTime(epochMs) {
|
|
179
|
-
const now = Temporal.Now.instant();
|
|
180
|
-
const then = Temporal.Instant.fromEpochMilliseconds(epochMs);
|
|
181
|
-
const totalSeconds = now.since(then).total("seconds");
|
|
182
|
-
const rtf = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
|
|
183
|
-
if (totalSeconds < 60) return rtf.format(-Math.floor(totalSeconds), "second");
|
|
184
|
-
const totalMinutes = Math.floor(totalSeconds / 60);
|
|
185
|
-
if (totalMinutes < 60) return rtf.format(-totalMinutes, "minute");
|
|
186
|
-
const totalHours = Math.floor(totalMinutes / 60);
|
|
187
|
-
if (totalHours < 24) return rtf.format(-totalHours, "hour");
|
|
188
|
-
const totalDays = Math.floor(totalHours / 24);
|
|
189
|
-
if (totalDays < 30) return rtf.format(-totalDays, "day");
|
|
190
|
-
const totalMonths = Math.floor(totalDays / 30);
|
|
191
|
-
if (totalMonths < 12) return rtf.format(-totalMonths, "month");
|
|
192
|
-
return rtf.format(-Math.floor(totalDays / 365), "year");
|
|
193
|
-
}
|
|
194
133
|
function formatFileSize(bytes) {
|
|
195
134
|
if (bytes < 1024) return `${bytes} B`;
|
|
196
135
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
@@ -555,48 +494,45 @@ const AssetLightbox = ({ open, onOpenChange, fileId }) => {
|
|
|
555
494
|
alt: value_0
|
|
556
495
|
})
|
|
557
496
|
}),
|
|
558
|
-
/* @__PURE__ */ jsxs(
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
}),
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
bytes: deliveredSizes.phone,
|
|
573
|
-
raw: file.size
|
|
574
|
-
})
|
|
575
|
-
}), /* @__PURE__ */ jsx(MetadataRow, {
|
|
576
|
-
label: /* @__PURE__ */ jsx(DeliveredLabel, { children: "On laptop" }),
|
|
577
|
-
children: /* @__PURE__ */ jsx(DeliveredSize, {
|
|
578
|
-
bytes: deliveredSizes.laptop,
|
|
579
|
-
raw: file.size
|
|
580
|
-
})
|
|
581
|
-
})] }),
|
|
582
|
-
/* @__PURE__ */ jsx(MetadataRow, {
|
|
583
|
-
label: "Created",
|
|
584
|
-
children: formatRelativeTime(file.createdAt)
|
|
585
|
-
}),
|
|
586
|
-
/* @__PURE__ */ jsx(MetadataRow, {
|
|
587
|
-
label: "Updated",
|
|
588
|
-
children: formatRelativeTime(file.updatedAt)
|
|
589
|
-
}),
|
|
590
|
-
/* @__PURE__ */ jsxs(MetadataRow, {
|
|
591
|
-
label: "Used in",
|
|
592
|
-
children: [
|
|
593
|
-
usageCount == null && "…",
|
|
594
|
-
usageCount === 0 && "No blocks",
|
|
595
|
-
usageCount != null && usageCount > 0 && `${usageCount} ${usageCount === 1 ? "block" : "blocks"}`
|
|
596
|
-
]
|
|
497
|
+
/* @__PURE__ */ jsxs(Metadata, { children: [
|
|
498
|
+
/* @__PURE__ */ jsx(MetadataRow, {
|
|
499
|
+
label: "Format",
|
|
500
|
+
children: file.mimeType.split("/").pop()?.toUpperCase() ?? "Unknown"
|
|
501
|
+
}),
|
|
502
|
+
/* @__PURE__ */ jsx(MetadataRow, {
|
|
503
|
+
label: "Raw size",
|
|
504
|
+
children: file.size != null ? formatFileSize(file.size) : "Unknown"
|
|
505
|
+
}),
|
|
506
|
+
isImage && deliveredSizes && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MetadataRow, {
|
|
507
|
+
label: /* @__PURE__ */ jsx(DeliveredLabel, { children: "On phone" }),
|
|
508
|
+
children: /* @__PURE__ */ jsx(DeliveredSize, {
|
|
509
|
+
bytes: deliveredSizes.phone,
|
|
510
|
+
raw: file.size
|
|
597
511
|
})
|
|
598
|
-
|
|
599
|
-
|
|
512
|
+
}), /* @__PURE__ */ jsx(MetadataRow, {
|
|
513
|
+
label: /* @__PURE__ */ jsx(DeliveredLabel, { children: "On laptop" }),
|
|
514
|
+
children: /* @__PURE__ */ jsx(DeliveredSize, {
|
|
515
|
+
bytes: deliveredSizes.laptop,
|
|
516
|
+
raw: file.size
|
|
517
|
+
})
|
|
518
|
+
})] }),
|
|
519
|
+
/* @__PURE__ */ jsx(MetadataRow, {
|
|
520
|
+
label: "Created",
|
|
521
|
+
children: formatRelativeTime(file.createdAt)
|
|
522
|
+
}),
|
|
523
|
+
/* @__PURE__ */ jsx(MetadataRow, {
|
|
524
|
+
label: "Updated",
|
|
525
|
+
children: formatRelativeTime(file.updatedAt)
|
|
526
|
+
}),
|
|
527
|
+
/* @__PURE__ */ jsxs(MetadataRow, {
|
|
528
|
+
label: "Used in",
|
|
529
|
+
children: [
|
|
530
|
+
usageCount == null && "…",
|
|
531
|
+
usageCount === 0 && "No blocks",
|
|
532
|
+
usageCount != null && usageCount > 0 && `${usageCount} ${usageCount === 1 ? "block" : "blocks"}`
|
|
533
|
+
]
|
|
534
|
+
})
|
|
535
|
+
] }),
|
|
600
536
|
/* @__PURE__ */ jsx("input", {
|
|
601
537
|
ref: replaceInputRef,
|
|
602
538
|
type: "file",
|