camox 0.34.0 → 0.35.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 +4 -4
- 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 +46 -110
- 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 +5 -5
- package/dist/features/preview/components/PageInfoSidebar.js +157 -73
- package/dist/features/preview/components/PageLocationFieldset.js +1 -1
- package/dist/features/preview/components/PageNavigatorSidebar.js +4 -4
- 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 +2 -2
- 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/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/studio/CamoxStudio.js +1 -1
- package/dist/features/studio/components/EnvironmentMenu.js +2 -2
- package/dist/features/studio/useTheme.js +1 -22
- package/dist/features/vite/runtimeDev.js +24 -3
- package/dist/features/vite/vite.js +7 -1
- package/dist/lib/normalized-data.js +6 -6
- package/dist/lib/view-queries.js +28 -0
- package/package.json +9 -4
|
@@ -4,15 +4,15 @@ import { pageMutations, pageQueries, projectQueries } from "../../../lib/queries
|
|
|
4
4
|
import { cn } from "../../../lib/utils.js";
|
|
5
5
|
import { previewStore } from "../previewStore.js";
|
|
6
6
|
import { PageStatusBadge } from "./PageStatusBadge.js";
|
|
7
|
-
import { Popover, PopoverContent, PopoverTrigger } from "@camox/ui/popover";
|
|
8
7
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
9
|
-
import { useSelector } from "@xstate/store-react";
|
|
10
8
|
import * as React from "react";
|
|
11
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
import {
|
|
10
|
+
import { useSelector } from "@xstate/store-react";
|
|
13
11
|
import { Button } from "@camox/ui/button";
|
|
14
12
|
import { Check, ChevronsUpDown, Pencil, Plus, Trash2 } from "lucide-react";
|
|
15
13
|
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
|
|
14
|
+
import { Popover, PopoverContent, PopoverTrigger } from "@camox/ui/popover";
|
|
15
|
+
import { toast } from "@camox/ui/toaster";
|
|
16
16
|
import { Skeleton } from "@camox/ui/skeleton";
|
|
17
17
|
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator } from "@camox/ui/command";
|
|
18
18
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { cn } from "../../../lib/utils.js";
|
|
2
|
-
import { previewStore } from "../previewStore.js";
|
|
3
1
|
import { usePageBlocks } from "../../../lib/normalized-data.js";
|
|
2
|
+
import { cn } from "../../../lib/utils.js";
|
|
4
3
|
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
4
|
+
import { previewStore } 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";
|
|
8
8
|
import { usePreviewedPage } from "../CamoxPreview.js";
|
|
9
9
|
import { c } from "react/compiler-runtime";
|
|
10
|
-
import { useSelector } from "@xstate/store-react";
|
|
11
10
|
import * as React from "react";
|
|
12
11
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { useSelector } from "@xstate/store-react";
|
|
13
13
|
import { Button } from "@camox/ui/button";
|
|
14
14
|
import { Ellipsis, GripVertical, LayoutTemplate, Plus } from "lucide-react";
|
|
15
15
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@camox/ui/tooltip";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { previewStore } from "../previewStore.js";
|
|
2
1
|
import { NormalizedDataProvider } from "../../../lib/normalized-data.js";
|
|
3
2
|
import { BlockErrorBoundary } from "./BlockErrorBoundary.js";
|
|
3
|
+
import { previewStore } from "../previewStore.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
|
-
import { useSelector } from "@xstate/store-react";
|
|
6
5
|
import * as React from "react";
|
|
7
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { useSelector } from "@xstate/store-react";
|
|
8
8
|
|
|
9
9
|
//#region src/features/preview/components/PeekedBlock.tsx
|
|
10
10
|
const PeekedBlock = (t0) => {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { actionsStore } from "../../provider/actionsStore.js";
|
|
2
2
|
import { checkIfInputFocused, cn } from "../../../lib/utils.js";
|
|
3
|
-
import { Frame, useFrame } from "./Frame.js";
|
|
4
3
|
import { previewStore } from "../previewStore.js";
|
|
5
4
|
import { useBlockActionsShortcuts } from "./BlockActionsPopover.js";
|
|
6
5
|
import { FieldOverlayStyles } from "./FieldOverlayStyles.js";
|
|
7
6
|
import { FieldToolbar } from "./FieldToolbar.js";
|
|
7
|
+
import { Frame, useFrame } from "./Frame.js";
|
|
8
8
|
import { Overlays } from "./Overlays.js";
|
|
9
9
|
import { OverlayTracker } from "./OverlayTracker.js";
|
|
10
10
|
import { PreviewToolbar } from "./PreviewToolbar.js";
|
|
11
11
|
import { c } from "react/compiler-runtime";
|
|
12
|
-
import { useSelector } from "@xstate/store-react";
|
|
13
12
|
import * as React from "react";
|
|
14
13
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { useSelector } from "@xstate/store-react";
|
|
15
15
|
import { PanelContent } from "@camox/ui/panel";
|
|
16
16
|
|
|
17
17
|
//#region src/features/preview/components/PreviewPanel.tsx
|
|
@@ -2,11 +2,11 @@ import { actionsStore } from "../../provider/actionsStore.js";
|
|
|
2
2
|
import { getActionShortcut } from "../../../lib/utils.js";
|
|
3
3
|
import { previewStore } from "../previewStore.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
|
-
import { Label } from "@camox/ui/label";
|
|
6
|
-
import { useSelector } from "@xstate/store-react";
|
|
7
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { useSelector } from "@xstate/store-react";
|
|
8
7
|
import { Button } from "@camox/ui/button";
|
|
9
8
|
import { Monitor, Smartphone, Tablet, X } from "lucide-react";
|
|
9
|
+
import { Label } from "@camox/ui/label";
|
|
10
10
|
import { ButtonGroup } from "@camox/ui/button-group";
|
|
11
11
|
import { Switch } from "@camox/ui/switch";
|
|
12
12
|
import * as Tooltip$1 from "@camox/ui/tooltip";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { pageMutations } from "../../../lib/queries.js";
|
|
2
2
|
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
3
|
-
import { Label } from "@camox/ui/label";
|
|
4
3
|
import { useMutation } from "@tanstack/react-query";
|
|
5
4
|
import * as React from "react";
|
|
6
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { toast } from "@camox/ui/toaster";
|
|
8
6
|
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
|
|
7
|
+
import { toast } from "@camox/ui/toaster";
|
|
8
|
+
import { Label } from "@camox/ui/label";
|
|
9
9
|
import { Switch } from "@camox/ui/switch";
|
|
10
10
|
|
|
11
11
|
//#region src/features/preview/components/PublishDialog.tsx
|
|
@@ -4,8 +4,8 @@ import { previewStore, selectionItemId } from "../previewStore.js";
|
|
|
4
4
|
import { useRepeatableItemActions } from "./useRepeatableItemActions.js";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
6
6
|
import { useMutation } from "@tanstack/react-query";
|
|
7
|
-
import { useSelector } from "@xstate/store-react";
|
|
8
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useSelector } from "@xstate/store-react";
|
|
9
9
|
import { Button } from "@camox/ui/button";
|
|
10
10
|
import { CircleMinus, CirclePlus, GripVertical } from "lucide-react";
|
|
11
11
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@camox/ui/tooltip";
|
|
@@ -3,8 +3,8 @@ import { AgentChatSidebar } from "../../agent-chat/components/AgentChatSidebar.j
|
|
|
3
3
|
import { PageEditorSidebar } from "./PageEditorSidebar.js";
|
|
4
4
|
import { PageInfoSidebar } from "./PageInfoSidebar.js";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
6
|
-
import { useSelector } from "@xstate/store-react";
|
|
7
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useSelector } from "@xstate/store-react";
|
|
8
8
|
|
|
9
9
|
//#region src/features/preview/components/RightSidebar.tsx
|
|
10
10
|
const getRightSidebarRoute = ({ pageId, selectedBlockId, isAgentChatSidebarOpen }) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { repeatableItemMutations } from "../../../lib/queries.js";
|
|
2
|
-
import { previewStore } from "../previewStore.js";
|
|
3
2
|
import "../../provider/components/CamoxAppContext.js";
|
|
3
|
+
import { previewStore } from "../previewStore.js";
|
|
4
4
|
import { useRequireDraftSource } from "../../../core/hooks/useRequireDraftSource.js";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
6
6
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
@@ -3,8 +3,8 @@ import { blockMutations } from "../../../lib/queries.js";
|
|
|
3
3
|
import { previewStore } from "../previewStore.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
5
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
|
-
import { useSelector } from "@xstate/store-react";
|
|
7
6
|
import { generateKeyBetween } from "fractional-indexing";
|
|
7
|
+
import { useSelector } from "@xstate/store-react";
|
|
8
8
|
import { queryKeys } from "@camox/api-contract/query-keys";
|
|
9
9
|
|
|
10
10
|
//#region src/features/preview/components/useUpdateBlockPosition.ts
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { AuthContext, useAuthActions } from "../../lib/auth.js";
|
|
2
|
+
import { projectQueries } from "../../lib/queries.js";
|
|
3
|
+
import { useApplyTheme, useThemeActions } from "../studio/useTheme.js";
|
|
4
|
+
import { useNavbarActions } from "../studio/components/Navbar.js";
|
|
5
|
+
import { identifyProject, identifyUser } from "../../lib/telemetry-client.js";
|
|
6
|
+
import { usePreviewPagesActions } from "../preview/CamoxPreview.js";
|
|
7
|
+
import { useProjectRoom } from "../../lib/use-project-room.js";
|
|
8
|
+
import { CommandPalette, useCommandPaletteActions } from "./components/CommandPalette.js";
|
|
9
|
+
import { useAdminShortcuts } from "./useAdminShortcuts.js";
|
|
10
|
+
import { useQuery } from "@tanstack/react-query";
|
|
11
|
+
import * as React from "react";
|
|
12
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Toaster } from "@camox/ui/toaster";
|
|
14
|
+
import studioCssUrl from "virtual:camox-studio-css";
|
|
15
|
+
|
|
16
|
+
//#region src/features/provider/AuthenticatedCamoxProvider.tsx
|
|
17
|
+
function AuthenticatedCamoxProvider({ children }) {
|
|
18
|
+
useAdminShortcuts();
|
|
19
|
+
useCommandPaletteActions();
|
|
20
|
+
useThemeActions();
|
|
21
|
+
useAuthActions();
|
|
22
|
+
useNavbarActions();
|
|
23
|
+
usePreviewPagesActions();
|
|
24
|
+
const { authClient, apiUrl, projectSlug, environmentName } = React.useContext(AuthContext);
|
|
25
|
+
const { data: session } = authClient.useSession();
|
|
26
|
+
const { data: project } = useQuery(projectQueries.getBySlug(projectSlug));
|
|
27
|
+
useProjectRoom(apiUrl, project?.id);
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
const user = session?.user;
|
|
30
|
+
if (!user) return;
|
|
31
|
+
identifyUser({
|
|
32
|
+
userId: user.id,
|
|
33
|
+
email: user.email,
|
|
34
|
+
name: user.name
|
|
35
|
+
});
|
|
36
|
+
}, [session?.user]);
|
|
37
|
+
React.useEffect(() => {
|
|
38
|
+
if (!project) return;
|
|
39
|
+
identifyProject({
|
|
40
|
+
projectId: project.id,
|
|
41
|
+
projectSlug,
|
|
42
|
+
projectName: project.name,
|
|
43
|
+
environmentName
|
|
44
|
+
});
|
|
45
|
+
}, [
|
|
46
|
+
environmentName,
|
|
47
|
+
project,
|
|
48
|
+
projectSlug
|
|
49
|
+
]);
|
|
50
|
+
const { resolvedTheme } = useApplyTheme();
|
|
51
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
52
|
+
/* @__PURE__ */ jsx("link", {
|
|
53
|
+
rel: "stylesheet",
|
|
54
|
+
href: studioCssUrl
|
|
55
|
+
}),
|
|
56
|
+
children,
|
|
57
|
+
/* @__PURE__ */ jsx(Toaster, { theme: resolvedTheme }),
|
|
58
|
+
/* @__PURE__ */ jsx(CommandPalette, {})
|
|
59
|
+
] });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
export { AuthenticatedCamoxProvider };
|
|
@@ -4,20 +4,13 @@ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
4
4
|
|
|
5
5
|
//#region src/features/provider/CamoxProvider.d.ts
|
|
6
6
|
interface CamoxProviderProps {
|
|
7
|
-
children: React.ReactNode;
|
|
8
|
-
camoxApp: CamoxApp;
|
|
9
|
-
authenticationUrl: string;
|
|
10
7
|
apiUrl: string;
|
|
11
|
-
|
|
8
|
+
authenticationUrl: string;
|
|
9
|
+
camoxApp: CamoxApp;
|
|
10
|
+
children: React.ReactNode;
|
|
12
11
|
environmentName?: string;
|
|
12
|
+
projectSlug: string;
|
|
13
13
|
}
|
|
14
|
-
declare function CamoxProvider(
|
|
15
|
-
children,
|
|
16
|
-
camoxApp,
|
|
17
|
-
authenticationUrl,
|
|
18
|
-
apiUrl,
|
|
19
|
-
projectSlug,
|
|
20
|
-
environmentName
|
|
21
|
-
}: CamoxProviderProps): _$react_jsx_runtime0.JSX.Element | null;
|
|
14
|
+
declare function CamoxProvider(props: CamoxProviderProps): _$react_jsx_runtime0.JSX.Element;
|
|
22
15
|
//#endregion
|
|
23
16
|
export { CamoxProvider };
|