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
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { actionsStore } from "../../provider/actionsStore.js";
|
|
2
|
+
import { usePageBlocks } from "../../../lib/normalized-data.js";
|
|
2
3
|
import { blockMutations, repeatableItemMutations } from "../../../lib/queries.js";
|
|
3
|
-
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
4
4
|
import { formatShortcut } from "../../../lib/utils.js";
|
|
5
|
-
import { previewStore, selectionItemId } from "../previewStore.js";
|
|
6
|
-
import { usePageBlocks } from "../../../lib/normalized-data.js";
|
|
7
5
|
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
6
|
+
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
7
|
+
import { previewStore, selectionItemId } from "../previewStore.js";
|
|
8
8
|
import { useRequireDraftSource } from "../../../core/hooks/useRequireDraftSource.js";
|
|
9
9
|
import { useUpdateBlockPosition } from "./useUpdateBlockPosition.js";
|
|
10
10
|
import { usePreviewedPage } from "../CamoxPreview.js";
|
|
11
11
|
import { c } from "react/compiler-runtime";
|
|
12
|
-
import { Popover, PopoverContent, PopoverTrigger } from "@camox/ui/popover";
|
|
13
12
|
import { useMutation } from "@tanstack/react-query";
|
|
14
|
-
import { useSelector } from "@xstate/store-react";
|
|
15
13
|
import * as React from "react";
|
|
16
14
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
-
import {
|
|
15
|
+
import { useSelector } from "@xstate/store-react";
|
|
18
16
|
import { Copy, Pen, Settings, Trash2 } from "lucide-react";
|
|
19
17
|
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
|
|
18
|
+
import { Popover, PopoverContent, PopoverTrigger } from "@camox/ui/popover";
|
|
19
|
+
import { toast } from "@camox/ui/toaster";
|
|
20
20
|
import { Command, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut } from "@camox/ui/command";
|
|
21
21
|
|
|
22
22
|
//#region src/features/preview/components/BlockActionsPopover.tsx
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { useNavigate } from "../../navigation/navigation.js";
|
|
2
2
|
import { useProjectSlug } from "../../../lib/auth.js";
|
|
3
3
|
import { layoutQueries, pageMutations, pageQueries, projectQueries } from "../../../lib/queries.js";
|
|
4
|
+
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
4
5
|
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
5
6
|
import { previewStore } from "../previewStore.js";
|
|
6
|
-
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
7
7
|
import { PageLocationFieldset } from "./PageLocationFieldset.js";
|
|
8
8
|
import { PageNicknameField } from "./PageNicknameField.js";
|
|
9
9
|
import { c } from "react/compiler-runtime";
|
|
10
|
-
import { Label } from "@camox/ui/label";
|
|
11
10
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
12
|
-
import { useSelector } from "@xstate/store-react";
|
|
13
11
|
import { useEffect } from "react";
|
|
14
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
-
import {
|
|
13
|
+
import { useSelector } from "@xstate/store-react";
|
|
16
14
|
import { Button } from "@camox/ui/button";
|
|
17
15
|
import { Spinner } from "@camox/ui/spinner";
|
|
16
|
+
import { toast } from "@camox/ui/toaster";
|
|
18
17
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@camox/ui/dialog";
|
|
18
|
+
import { Label } from "@camox/ui/label";
|
|
19
19
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@camox/ui/select";
|
|
20
20
|
import { useForm } from "@tanstack/react-form";
|
|
21
21
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useDebouncedField } from "../../../hooks/use-debounced-field.js";
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
|
-
import { Input } from "@camox/ui/input";
|
|
4
|
-
import { Label } from "@camox/ui/label";
|
|
5
3
|
import * as React from "react";
|
|
6
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Label } from "@camox/ui/label";
|
|
6
|
+
import { Input } from "@camox/ui/input";
|
|
7
7
|
import { Textarea } from "@camox/ui/textarea";
|
|
8
8
|
|
|
9
9
|
//#region src/features/preview/components/DebouncedFieldEditor.tsx
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { previewStore } from "../previewStore.js";
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
|
-
import { useSelector } from "@xstate/store-react";
|
|
4
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useSelector } from "@xstate/store-react";
|
|
5
5
|
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
|
|
6
6
|
|
|
7
7
|
//#region src/features/preview/components/DraftSwitchDialog.tsx
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { cn } from "../../../lib/utils.js";
|
|
2
|
-
import { isOverlayMessage } from "../overlayMessages.js";
|
|
3
2
|
import { previewStore } from "../previewStore.js";
|
|
4
|
-
import { FORMAT_FLAGS } from "../../../core/lib/modifierFormats.js";
|
|
5
3
|
import { TextLinkPopover } from "../../../core/components/lexical/TextLinkPopover.js";
|
|
4
|
+
import { FORMAT_FLAGS } from "../../../core/lib/modifierFormats.js";
|
|
5
|
+
import { isOverlayMessage } from "../overlayMessages.js";
|
|
6
6
|
import { c } from "react/compiler-runtime";
|
|
7
|
-
import { useSelector } from "@xstate/store-react";
|
|
8
7
|
import * as React from "react";
|
|
9
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { useSelector } from "@xstate/store-react";
|
|
10
10
|
import { Kbd } from "@camox/ui/kbd";
|
|
11
11
|
import { Button } from "@camox/ui/button";
|
|
12
12
|
import { Bold, Italic } from "lucide-react";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { cn } from "../../../lib/utils.js";
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { createPortal } from "react-dom";
|
|
5
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { createPortal } from "react-dom";
|
|
6
6
|
|
|
7
7
|
//#region src/features/preview/components/Frame.tsx
|
|
8
8
|
const FrameContext = React.createContext({
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { previewStore } from "../previewStore.js";
|
|
2
1
|
import { isFileMarker, isItemMarker, resolveFileMarker } from "../../../lib/normalized-data.js";
|
|
2
|
+
import { previewStore } from "../previewStore.js";
|
|
3
3
|
import { SidebarLexicalEditor } from "../../../core/components/lexical/SidebarLexicalEditor.js";
|
|
4
4
|
import { RepeatableItemsList } from "./RepeatableItemsList.js";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
6
|
-
import { Input } from "@camox/ui/input";
|
|
7
|
-
import { Label } from "@camox/ui/label";
|
|
8
6
|
import * as React from "react";
|
|
9
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
8
|
import { FileIcon, ImageIcon, Images, Link2 } from "lucide-react";
|
|
9
|
+
import { Label } from "@camox/ui/label";
|
|
11
10
|
import { useForm } from "@tanstack/react-form";
|
|
11
|
+
import { Input } from "@camox/ui/input";
|
|
12
12
|
|
|
13
13
|
//#region src/features/preview/components/ItemFieldsEditor.tsx
|
|
14
14
|
const formatFieldName = (fieldName) => {
|
|
@@ -2,8 +2,8 @@ import { previewStore } from "../previewStore.js";
|
|
|
2
2
|
import { AddBlockSidebar } from "./AddBlockSidebar.js";
|
|
3
3
|
import { PageNavigatorSidebar } from "./PageNavigatorSidebar.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
|
-
import { useSelector } from "@xstate/store-react";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { useSelector } from "@xstate/store-react";
|
|
7
7
|
|
|
8
8
|
//#region src/features/preview/components/LeftSidebar.tsx
|
|
9
9
|
const getLeftSidebarRoute = ({ isAddBlockSidebarOpen }) => {
|
|
@@ -3,14 +3,14 @@ import { pageQueries, projectQueries } from "../../../lib/queries.js";
|
|
|
3
3
|
import { cn } from "../../../lib/utils.js";
|
|
4
4
|
import { useDebouncedField } from "../../../hooks/use-debounced-field.js";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
6
|
-
import { Input } from "@camox/ui/input";
|
|
7
|
-
import { Label } from "@camox/ui/label";
|
|
8
|
-
import { Popover, PopoverContent, PopoverTrigger } from "@camox/ui/popover";
|
|
9
6
|
import { useQuery } from "@tanstack/react-query";
|
|
10
7
|
import * as React from "react";
|
|
11
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
9
|
import { Button } from "@camox/ui/button";
|
|
13
10
|
import { Check, ChevronsUpDown } from "lucide-react";
|
|
11
|
+
import { Popover, PopoverContent, PopoverTrigger } from "@camox/ui/popover";
|
|
12
|
+
import { Label } from "@camox/ui/label";
|
|
13
|
+
import { Input } from "@camox/ui/input";
|
|
14
14
|
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@camox/ui/command";
|
|
15
15
|
import { Switch } from "@camox/ui/switch";
|
|
16
16
|
import { Tabs, TabsList, TabsTrigger } from "@camox/ui/tabs";
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { c } from "react/compiler-runtime";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/features/preview/components/Metadata.tsx
|
|
5
|
+
function Metadata(t0) {
|
|
6
|
+
const $ = c(3);
|
|
7
|
+
if ($[0] !== "0cab1dfcfdb2036df169f46d25dd9f41685cc99f911ce3094b6e2273b2fb83fa") {
|
|
8
|
+
for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
9
|
+
$[0] = "0cab1dfcfdb2036df169f46d25dd9f41685cc99f911ce3094b6e2273b2fb83fa";
|
|
10
|
+
}
|
|
11
|
+
const { children } = t0;
|
|
12
|
+
let t1;
|
|
13
|
+
if ($[1] !== children) {
|
|
14
|
+
t1 = /* @__PURE__ */ jsx("div", {
|
|
15
|
+
className: "text-muted-foreground space-y-1 text-sm",
|
|
16
|
+
children
|
|
17
|
+
});
|
|
18
|
+
$[1] = children;
|
|
19
|
+
$[2] = t1;
|
|
20
|
+
} else t1 = $[2];
|
|
21
|
+
return t1;
|
|
22
|
+
}
|
|
23
|
+
function MetadataRow(t0) {
|
|
24
|
+
const $ = c(9);
|
|
25
|
+
if ($[0] !== "0cab1dfcfdb2036df169f46d25dd9f41685cc99f911ce3094b6e2273b2fb83fa") {
|
|
26
|
+
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
27
|
+
$[0] = "0cab1dfcfdb2036df169f46d25dd9f41685cc99f911ce3094b6e2273b2fb83fa";
|
|
28
|
+
}
|
|
29
|
+
const { label, children } = t0;
|
|
30
|
+
let t1;
|
|
31
|
+
if ($[1] !== label) {
|
|
32
|
+
t1 = /* @__PURE__ */ jsx("span", {
|
|
33
|
+
className: "shrink-0",
|
|
34
|
+
children: label
|
|
35
|
+
});
|
|
36
|
+
$[1] = label;
|
|
37
|
+
$[2] = t1;
|
|
38
|
+
} else t1 = $[2];
|
|
39
|
+
let t2;
|
|
40
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
41
|
+
t2 = /* @__PURE__ */ jsx("span", { className: "border-border min-w-0 flex-1 border-b" });
|
|
42
|
+
$[3] = t2;
|
|
43
|
+
} else t2 = $[3];
|
|
44
|
+
let t3;
|
|
45
|
+
if ($[4] !== children) {
|
|
46
|
+
t3 = /* @__PURE__ */ jsx("span", {
|
|
47
|
+
className: "text-foreground min-w-0 truncate",
|
|
48
|
+
children
|
|
49
|
+
});
|
|
50
|
+
$[4] = children;
|
|
51
|
+
$[5] = t3;
|
|
52
|
+
} else t3 = $[5];
|
|
53
|
+
let t4;
|
|
54
|
+
if ($[6] !== t1 || $[7] !== t3) {
|
|
55
|
+
t4 = /* @__PURE__ */ jsxs("div", {
|
|
56
|
+
className: "flex items-baseline gap-2",
|
|
57
|
+
children: [
|
|
58
|
+
t1,
|
|
59
|
+
t2,
|
|
60
|
+
t3
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
$[6] = t1;
|
|
64
|
+
$[7] = t3;
|
|
65
|
+
$[8] = t4;
|
|
66
|
+
} else t4 = $[8];
|
|
67
|
+
return t4;
|
|
68
|
+
}
|
|
69
|
+
function formatRelativeTime(epochMs) {
|
|
70
|
+
const now = Temporal.Now.instant();
|
|
71
|
+
const then = Temporal.Instant.fromEpochMilliseconds(epochMs);
|
|
72
|
+
const totalSeconds = now.since(then).total("seconds");
|
|
73
|
+
const rtf = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
|
|
74
|
+
if (totalSeconds < 60) return rtf.format(-Math.floor(totalSeconds), "second");
|
|
75
|
+
const totalMinutes = Math.floor(totalSeconds / 60);
|
|
76
|
+
if (totalMinutes < 60) return rtf.format(-totalMinutes, "minute");
|
|
77
|
+
const totalHours = Math.floor(totalMinutes / 60);
|
|
78
|
+
if (totalHours < 24) return rtf.format(-totalHours, "hour");
|
|
79
|
+
const totalDays = Math.floor(totalHours / 24);
|
|
80
|
+
if (totalDays < 30) return rtf.format(-totalDays, "day");
|
|
81
|
+
const totalMonths = Math.floor(totalDays / 30);
|
|
82
|
+
if (totalMonths < 12) return rtf.format(-totalMonths, "month");
|
|
83
|
+
return rtf.format(-Math.floor(totalDays / 365), "year");
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
//#endregion
|
|
87
|
+
export { Metadata, MetadataRow, formatRelativeTime };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useProjectSlug } from "../../../lib/auth.js";
|
|
2
|
+
import { transformImageUrl } from "../../../core/lib/imageTransform.js";
|
|
2
3
|
import { projectQueries } from "../../../lib/queries.js";
|
|
3
4
|
import { cn } from "../../../lib/utils.js";
|
|
4
|
-
import { transformImageUrl } from "../../../core/lib/imageTransform.js";
|
|
5
5
|
import { UploadDropZone } from "../../content/components/UploadDropZone.js";
|
|
6
6
|
import { useFileUpload } from "../../../hooks/use-file-upload.js";
|
|
7
7
|
import { AssetLightbox } from "./AssetLightbox.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { useFrame } from "./Frame.js";
|
|
2
|
-
import { isOverlayMessage } from "../overlayMessages.js";
|
|
3
1
|
import { previewStore } from "../previewStore.js";
|
|
2
|
+
import { isOverlayMessage } from "../overlayMessages.js";
|
|
3
|
+
import { useFrame } from "./Frame.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
|
-
import { useSelector } from "@xstate/store-react";
|
|
6
5
|
import * as React from "react";
|
|
6
|
+
import { useSelector } from "@xstate/store-react";
|
|
7
7
|
|
|
8
8
|
//#region src/features/preview/components/OverlayTracker.tsx
|
|
9
9
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { isOverlayMessage } from "../overlayMessages.js";
|
|
2
|
-
import { previewStore } from "../previewStore.js";
|
|
3
1
|
import { usePageBlocks } from "../../../lib/normalized-data.js";
|
|
2
|
+
import { previewStore } from "../previewStore.js";
|
|
3
|
+
import { isOverlayMessage } from "../overlayMessages.js";
|
|
4
4
|
import { usePreviewedPage } from "../CamoxPreview.js";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
6
|
-
import { useSelector } from "@xstate/store-react";
|
|
7
6
|
import * as React from "react";
|
|
7
|
+
import { useSelector } from "@xstate/store-react";
|
|
8
8
|
|
|
9
9
|
//#region src/features/preview/components/Overlays.tsx
|
|
10
10
|
const Overlays = (t0) => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { isFileMarker } from "../../../lib/normalized-data.js";
|
|
1
2
|
import { blockMutations, blockQueries, fileQueries, repeatableItemMutations } from "../../../lib/queries.js";
|
|
2
|
-
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
3
3
|
import { cn } from "../../../lib/utils.js";
|
|
4
|
-
import { previewStore, selectionBlockId, selectionField, selectionItemId } from "../previewStore.js";
|
|
5
|
-
import { isFileMarker } from "../../../lib/normalized-data.js";
|
|
6
4
|
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
5
|
+
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
6
|
+
import { previewStore, selectionBlockId, selectionField, selectionItemId } from "../previewStore.js";
|
|
7
7
|
import { useRequireDraftSource } from "../../../core/hooks/useRequireDraftSource.js";
|
|
8
8
|
import { fieldTypesDictionary } from "../../../core/lib/fieldTypes.js";
|
|
9
9
|
import { SingleAssetFieldEditor } from "./AssetFieldEditor.js";
|
|
@@ -11,14 +11,14 @@ import { useRepeatableItemActions } from "./useRepeatableItemActions.js";
|
|
|
11
11
|
import { ItemFieldsEditor, formatFieldName } from "./ItemFieldsEditor.js";
|
|
12
12
|
import { LinkFieldEditor } from "./LinkFieldEditor.js";
|
|
13
13
|
import { MultipleAssetFieldEditor } from "./MultipleAssetFieldEditor.js";
|
|
14
|
-
import { Label } from "@camox/ui/label";
|
|
15
14
|
import { useMutation, useQueries, useQuery } from "@tanstack/react-query";
|
|
16
|
-
import { useSelector } from "@xstate/store-react";
|
|
17
15
|
import * as React from "react";
|
|
18
16
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
import { useSelector } from "@xstate/store-react";
|
|
19
18
|
import { Button } from "@camox/ui/button";
|
|
20
19
|
import { CircleMinus, CirclePlus, CornerLeftUp } from "lucide-react";
|
|
21
20
|
import { Spinner } from "@camox/ui/spinner";
|
|
21
|
+
import { Label } from "@camox/ui/label";
|
|
22
22
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@camox/ui/select";
|
|
23
23
|
import { Switch } from "@camox/ui/switch";
|
|
24
24
|
|
|
@@ -272,7 +272,7 @@ const PageEditorSidebar = () => {
|
|
|
272
272
|
children: [/* @__PURE__ */ jsx(Spinner, { className: "mr-2 size-3.5" }), " Loading block..."]
|
|
273
273
|
});
|
|
274
274
|
const fieldHasOwnView = fieldInfo ? fieldTypesDictionary[fieldInfo.fieldType].hasOwnView : false;
|
|
275
|
-
const
|
|
275
|
+
const navigationItems = [
|
|
276
276
|
{
|
|
277
277
|
key: "page",
|
|
278
278
|
label: "Page",
|
|
@@ -307,47 +307,57 @@ const PageEditorSidebar = () => {
|
|
|
307
307
|
];
|
|
308
308
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
309
309
|
className: "border-border flex flex-col gap-1.5 border-b px-2 py-4",
|
|
310
|
-
children: /* @__PURE__ */
|
|
310
|
+
children: /* @__PURE__ */ jsx("nav", {
|
|
311
311
|
"aria-label": "Selection path",
|
|
312
312
|
className: "text-muted-foreground text-sm",
|
|
313
|
-
children:
|
|
314
|
-
type: "button",
|
|
315
|
-
className: "hover:text-foreground block min-w-0 cursor-pointer truncate py-0.5 text-left transition-colors",
|
|
316
|
-
onClick: pageNavigationItem.onClick,
|
|
317
|
-
children: pageNavigationItem.label
|
|
318
|
-
}) : /* @__PURE__ */ jsx("span", {
|
|
319
|
-
className: "text-foreground block min-w-0 truncate py-0.5 font-medium",
|
|
320
|
-
children: pageNavigationItem?.label
|
|
321
|
-
}), /* @__PURE__ */ jsx("ol", {
|
|
313
|
+
children: /* @__PURE__ */ jsx("ol", {
|
|
322
314
|
className: "flex flex-col",
|
|
323
|
-
children:
|
|
315
|
+
children: navigationItems.map((item, index) => {
|
|
316
|
+
const isFirstItem = index === 0;
|
|
317
|
+
const isLastItem = index === navigationItems.length - 1;
|
|
324
318
|
return /* @__PURE__ */ jsxs("li", {
|
|
325
319
|
className: "relative min-w-0 pl-6",
|
|
326
|
-
children: [/* @__PURE__ */
|
|
320
|
+
children: [/* @__PURE__ */ jsxs("svg", {
|
|
327
321
|
"aria-hidden": "true",
|
|
328
|
-
className: "text-muted-foreground pointer-events-none absolute top-0 left-0 h-
|
|
322
|
+
className: "text-muted-foreground pointer-events-none absolute top-0 left-0 h-7 w-4",
|
|
329
323
|
fill: "none",
|
|
330
324
|
preserveAspectRatio: "none",
|
|
331
|
-
viewBox: "0 0 16
|
|
332
|
-
children:
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
325
|
+
viewBox: "0 0 16 28",
|
|
326
|
+
children: [
|
|
327
|
+
!isFirstItem && /* @__PURE__ */ jsx("path", {
|
|
328
|
+
d: "M8 0 V10",
|
|
329
|
+
stroke: "currentColor",
|
|
330
|
+
strokeWidth: "1.5",
|
|
331
|
+
vectorEffect: "non-scaling-stroke"
|
|
332
|
+
}),
|
|
333
|
+
!isLastItem && /* @__PURE__ */ jsx("path", {
|
|
334
|
+
d: "M8 18 V28",
|
|
335
|
+
stroke: "currentColor",
|
|
336
|
+
strokeWidth: "1.5",
|
|
337
|
+
vectorEffect: "non-scaling-stroke"
|
|
338
|
+
}),
|
|
339
|
+
/* @__PURE__ */ jsx("circle", {
|
|
340
|
+
className: "fill-background",
|
|
341
|
+
cx: "8",
|
|
342
|
+
cy: "14",
|
|
343
|
+
r: "4",
|
|
344
|
+
stroke: "currentColor",
|
|
345
|
+
strokeWidth: "1.5",
|
|
346
|
+
vectorEffect: "non-scaling-stroke"
|
|
347
|
+
})
|
|
348
|
+
]
|
|
339
349
|
}), item.onClick ? /* @__PURE__ */ jsx("button", {
|
|
340
350
|
type: "button",
|
|
341
|
-
className: cn("hover:text-foreground
|
|
351
|
+
className: cn("hover:text-foreground flex h-7 min-w-0 cursor-pointer items-center truncate text-left transition-colors", item.isCurrent && "text-foreground font-medium"),
|
|
342
352
|
onClick: item.onClick,
|
|
343
353
|
children: item.label
|
|
344
354
|
}) : /* @__PURE__ */ jsx("span", {
|
|
345
|
-
className: "text-foreground
|
|
355
|
+
className: "text-foreground block h-7 min-w-0 truncate leading-7 font-medium",
|
|
346
356
|
children: item.label
|
|
347
357
|
})]
|
|
348
358
|
}, item.key);
|
|
349
359
|
})
|
|
350
|
-
})
|
|
360
|
+
})
|
|
351
361
|
})
|
|
352
362
|
}), /* @__PURE__ */ jsxs("div", {
|
|
353
363
|
className: "relative flex-1 overflow-auto",
|