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,5 +1,5 @@
|
|
|
1
|
-
import { FORMAT_FLAGS, lexicalTextToMarkdown } from "./modifierFormats.js";
|
|
2
1
|
import { isValidTextLinkTarget } from "./textLinks.js";
|
|
2
|
+
import { FORMAT_FLAGS, lexicalTextToMarkdown } from "./modifierFormats.js";
|
|
3
3
|
|
|
4
4
|
//#region src/core/lib/lexicalState.ts
|
|
5
5
|
function isLexicalState(value) {
|
|
@@ -5,9 +5,9 @@ import { previewStore } from "../../preview/previewStore.js";
|
|
|
5
5
|
import { AgentChatThread } from "./AgentChatThread.js";
|
|
6
6
|
import { c } from "react/compiler-runtime";
|
|
7
7
|
import { useQuery } from "@tanstack/react-query";
|
|
8
|
-
import { useSelector } from "@xstate/store-react";
|
|
9
8
|
import * as React from "react";
|
|
10
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { useSelector } from "@xstate/store-react";
|
|
11
11
|
import { Button } from "@camox/ui/button";
|
|
12
12
|
import { Lock, Plus, X } from "lucide-react";
|
|
13
13
|
import { Alert, AlertDescription, AlertTitle } from "@camox/ui/alert";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cn } from "../../../lib/utils.js";
|
|
2
1
|
import { transformImageUrl } from "../../../core/lib/imageTransform.js";
|
|
2
|
+
import { cn } from "../../../lib/utils.js";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { FileIcon } from "lucide-react";
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { useLocation } from "../navigation/navigation.js";
|
|
2
|
+
import { useProjectSlug } from "../../lib/auth.js";
|
|
3
|
+
import { getApiClient } from "../../lib/api-client.js";
|
|
4
|
+
import { viewBlockQueries } from "../../lib/view-queries.js";
|
|
5
|
+
import { NormalizedDataProvider, usePageBlocks } from "../../lib/normalized-data.js";
|
|
6
|
+
import { BlockErrorBoundary } from "../preview/components/BlockErrorBoundary.js";
|
|
7
|
+
import { useCamoxApp } from "../provider/components/CamoxAppContext.js";
|
|
8
|
+
import { c } from "react/compiler-runtime";
|
|
9
|
+
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
10
|
+
import "react";
|
|
11
|
+
import { jsx } from "react/jsx-runtime";
|
|
12
|
+
import { queryKeys } from "@camox/api-contract/query-keys";
|
|
13
|
+
|
|
14
|
+
//#region src/features/page/PublishedPageContent.tsx
|
|
15
|
+
function pageStructureQueryFn(path, projectSlug, source) {
|
|
16
|
+
return () => getApiClient().pages.getStructure({
|
|
17
|
+
path,
|
|
18
|
+
projectSlug,
|
|
19
|
+
source
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function PublishedBlock(t0) {
|
|
23
|
+
const $ = c(21);
|
|
24
|
+
if ($[0] !== "6b1d872701fbf673bbf88f17d9fcd827a3ba76fd3c668c35080c3a59e9b03bf1") {
|
|
25
|
+
for (let $i = 0; $i < 21; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
26
|
+
$[0] = "6b1d872701fbf673bbf88f17d9fcd827a3ba76fd3c668c35080c3a59e9b03bf1";
|
|
27
|
+
}
|
|
28
|
+
const { blockId, mode, source } = t0;
|
|
29
|
+
let t1;
|
|
30
|
+
if ($[1] !== blockId || $[2] !== source) {
|
|
31
|
+
t1 = viewBlockQueries.get(blockId, source);
|
|
32
|
+
$[1] = blockId;
|
|
33
|
+
$[2] = source;
|
|
34
|
+
$[3] = t1;
|
|
35
|
+
} else t1 = $[3];
|
|
36
|
+
const { data } = useSuspenseQuery(t1);
|
|
37
|
+
const camoxApp = useCamoxApp();
|
|
38
|
+
let t2;
|
|
39
|
+
if ($[4] !== camoxApp || $[5] !== data.block.type) {
|
|
40
|
+
t2 = camoxApp.getBlockById(data.block.type);
|
|
41
|
+
$[4] = camoxApp;
|
|
42
|
+
$[5] = data.block.type;
|
|
43
|
+
$[6] = t2;
|
|
44
|
+
} else t2 = $[6];
|
|
45
|
+
const blockDef = t2;
|
|
46
|
+
if (!blockDef) return null;
|
|
47
|
+
const t3 = data.files;
|
|
48
|
+
const t4 = data.repeatableItems;
|
|
49
|
+
const T0 = blockDef._internal.Component;
|
|
50
|
+
const t5 = data.block.id;
|
|
51
|
+
const t6 = data.block.type;
|
|
52
|
+
const t7 = data.block.content;
|
|
53
|
+
const t8 = data.block.settings;
|
|
54
|
+
const t9 = String(data.block.position);
|
|
55
|
+
let t10;
|
|
56
|
+
if ($[7] !== data.block.id || $[8] !== data.block.type || $[9] !== t7 || $[10] !== t8 || $[11] !== t9) {
|
|
57
|
+
t10 = {
|
|
58
|
+
_id: t5,
|
|
59
|
+
type: t6,
|
|
60
|
+
content: t7,
|
|
61
|
+
settings: t8,
|
|
62
|
+
position: t9
|
|
63
|
+
};
|
|
64
|
+
$[7] = data.block.id;
|
|
65
|
+
$[8] = data.block.type;
|
|
66
|
+
$[9] = t7;
|
|
67
|
+
$[10] = t8;
|
|
68
|
+
$[11] = t9;
|
|
69
|
+
$[12] = t10;
|
|
70
|
+
} else t10 = $[12];
|
|
71
|
+
let t11;
|
|
72
|
+
if ($[13] !== blockDef._internal.Component || $[14] !== mode || $[15] !== t10) {
|
|
73
|
+
t11 = /* @__PURE__ */ jsx(T0, {
|
|
74
|
+
blockData: t10,
|
|
75
|
+
mode,
|
|
76
|
+
showAddBlockTop: false,
|
|
77
|
+
showAddBlockBottom: false
|
|
78
|
+
});
|
|
79
|
+
$[13] = blockDef._internal.Component;
|
|
80
|
+
$[14] = mode;
|
|
81
|
+
$[15] = t10;
|
|
82
|
+
$[16] = t11;
|
|
83
|
+
} else t11 = $[16];
|
|
84
|
+
let t12;
|
|
85
|
+
if ($[17] !== data.files || $[18] !== data.repeatableItems || $[19] !== t11) {
|
|
86
|
+
t12 = /* @__PURE__ */ jsx(NormalizedDataProvider, {
|
|
87
|
+
files: t3,
|
|
88
|
+
repeatableItems: t4,
|
|
89
|
+
children: t11
|
|
90
|
+
});
|
|
91
|
+
$[17] = data.files;
|
|
92
|
+
$[18] = data.repeatableItems;
|
|
93
|
+
$[19] = t11;
|
|
94
|
+
$[20] = t12;
|
|
95
|
+
} else t12 = $[20];
|
|
96
|
+
return t12;
|
|
97
|
+
}
|
|
98
|
+
function PublishedPageContent(t0) {
|
|
99
|
+
const $ = c(35);
|
|
100
|
+
if ($[0] !== "6b1d872701fbf673bbf88f17d9fcd827a3ba76fd3c668c35080c3a59e9b03bf1") {
|
|
101
|
+
for (let $i = 0; $i < 35; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
102
|
+
$[0] = "6b1d872701fbf673bbf88f17d9fcd827a3ba76fd3c668c35080c3a59e9b03bf1";
|
|
103
|
+
}
|
|
104
|
+
const { source } = t0;
|
|
105
|
+
const { pathname } = useLocation();
|
|
106
|
+
const projectSlug = useProjectSlug();
|
|
107
|
+
const camoxApp = useCamoxApp();
|
|
108
|
+
let t1;
|
|
109
|
+
if ($[1] !== pathname || $[2] !== source) {
|
|
110
|
+
t1 = queryKeys.pages.getByPath(pathname, source);
|
|
111
|
+
$[1] = pathname;
|
|
112
|
+
$[2] = source;
|
|
113
|
+
$[3] = t1;
|
|
114
|
+
} else t1 = $[3];
|
|
115
|
+
let t2;
|
|
116
|
+
if ($[4] !== pathname || $[5] !== projectSlug || $[6] !== source) {
|
|
117
|
+
t2 = pageStructureQueryFn(pathname, projectSlug, source);
|
|
118
|
+
$[4] = pathname;
|
|
119
|
+
$[5] = projectSlug;
|
|
120
|
+
$[6] = source;
|
|
121
|
+
$[7] = t2;
|
|
122
|
+
} else t2 = $[7];
|
|
123
|
+
let t3;
|
|
124
|
+
if ($[8] !== t1 || $[9] !== t2) {
|
|
125
|
+
t3 = {
|
|
126
|
+
queryKey: t1,
|
|
127
|
+
queryFn: t2,
|
|
128
|
+
staleTime: Infinity
|
|
129
|
+
};
|
|
130
|
+
$[8] = t1;
|
|
131
|
+
$[9] = t2;
|
|
132
|
+
$[10] = t3;
|
|
133
|
+
} else t3 = $[10];
|
|
134
|
+
const { data: pageData } = useSuspenseQuery(t3);
|
|
135
|
+
const { pageBlocks, beforeBlocks, afterBlocks, layoutFiles, layoutItems } = usePageBlocks(pageData, source);
|
|
136
|
+
let t4;
|
|
137
|
+
if ($[11] !== camoxApp || $[12] !== pageData.layout) {
|
|
138
|
+
t4 = pageData.layout ? camoxApp.getLayoutById(pageData.layout.layoutId) : void 0;
|
|
139
|
+
$[11] = camoxApp;
|
|
140
|
+
$[12] = pageData.layout;
|
|
141
|
+
$[13] = t4;
|
|
142
|
+
} else t4 = $[13];
|
|
143
|
+
const layout = t4;
|
|
144
|
+
let t5;
|
|
145
|
+
bb0: {
|
|
146
|
+
if (!pageData.layout) {
|
|
147
|
+
t5 = null;
|
|
148
|
+
break bb0;
|
|
149
|
+
}
|
|
150
|
+
let blocks;
|
|
151
|
+
if ($[14] !== afterBlocks || $[15] !== beforeBlocks) {
|
|
152
|
+
blocks = {};
|
|
153
|
+
for (const block of [...beforeBlocks, ...afterBlocks]) blocks[block.type] = {
|
|
154
|
+
_id: block.id,
|
|
155
|
+
type: block.type,
|
|
156
|
+
content: block.content,
|
|
157
|
+
settings: block.settings,
|
|
158
|
+
position: String(block.position)
|
|
159
|
+
};
|
|
160
|
+
$[14] = afterBlocks;
|
|
161
|
+
$[15] = beforeBlocks;
|
|
162
|
+
$[16] = blocks;
|
|
163
|
+
} else blocks = $[16];
|
|
164
|
+
t5 = blocks;
|
|
165
|
+
}
|
|
166
|
+
const layoutBlocksMap = t5;
|
|
167
|
+
let t6;
|
|
168
|
+
if ($[17] !== pageBlocks || $[18] !== source) {
|
|
169
|
+
let t7;
|
|
170
|
+
if ($[20] !== source) {
|
|
171
|
+
t7 = (block_0) => /* @__PURE__ */ jsx(BlockErrorBoundary, {
|
|
172
|
+
blockId: block_0.id,
|
|
173
|
+
blockType: block_0.type,
|
|
174
|
+
children: /* @__PURE__ */ jsx(PublishedBlock, {
|
|
175
|
+
blockId: block_0.id,
|
|
176
|
+
mode: "site",
|
|
177
|
+
source
|
|
178
|
+
})
|
|
179
|
+
}, block_0.id);
|
|
180
|
+
$[20] = source;
|
|
181
|
+
$[21] = t7;
|
|
182
|
+
} else t7 = $[21];
|
|
183
|
+
t6 = pageBlocks.map(t7);
|
|
184
|
+
$[17] = pageBlocks;
|
|
185
|
+
$[18] = source;
|
|
186
|
+
$[19] = t6;
|
|
187
|
+
} else t6 = $[19];
|
|
188
|
+
const pageBlocksContent = t6;
|
|
189
|
+
if (!layout || !layoutBlocksMap) {
|
|
190
|
+
let t7;
|
|
191
|
+
if ($[22] !== pageBlocksContent) {
|
|
192
|
+
t7 = /* @__PURE__ */ jsx("main", {
|
|
193
|
+
className: "flex min-h-screen flex-col",
|
|
194
|
+
children: pageBlocksContent
|
|
195
|
+
});
|
|
196
|
+
$[22] = pageBlocksContent;
|
|
197
|
+
$[23] = t7;
|
|
198
|
+
} else t7 = $[23];
|
|
199
|
+
return t7;
|
|
200
|
+
}
|
|
201
|
+
const LayoutComponent = layout._internal.component;
|
|
202
|
+
let t7;
|
|
203
|
+
if ($[24] !== LayoutComponent || $[25] !== pageBlocksContent) {
|
|
204
|
+
t7 = /* @__PURE__ */ jsx(LayoutComponent, { children: pageBlocksContent });
|
|
205
|
+
$[24] = LayoutComponent;
|
|
206
|
+
$[25] = pageBlocksContent;
|
|
207
|
+
$[26] = t7;
|
|
208
|
+
} else t7 = $[26];
|
|
209
|
+
let t8;
|
|
210
|
+
if ($[27] !== layout._internal.Provider || $[28] !== layoutBlocksMap || $[29] !== t7) {
|
|
211
|
+
t8 = /* @__PURE__ */ jsx(layout._internal.Provider, {
|
|
212
|
+
layoutBlocks: layoutBlocksMap,
|
|
213
|
+
children: t7
|
|
214
|
+
});
|
|
215
|
+
$[27] = layout._internal.Provider;
|
|
216
|
+
$[28] = layoutBlocksMap;
|
|
217
|
+
$[29] = t7;
|
|
218
|
+
$[30] = t8;
|
|
219
|
+
} else t8 = $[30];
|
|
220
|
+
let t9;
|
|
221
|
+
if ($[31] !== layoutFiles || $[32] !== layoutItems || $[33] !== t8) {
|
|
222
|
+
t9 = /* @__PURE__ */ jsx(NormalizedDataProvider, {
|
|
223
|
+
files: layoutFiles,
|
|
224
|
+
repeatableItems: layoutItems,
|
|
225
|
+
children: t8
|
|
226
|
+
});
|
|
227
|
+
$[31] = layoutFiles;
|
|
228
|
+
$[32] = layoutItems;
|
|
229
|
+
$[33] = t8;
|
|
230
|
+
$[34] = t9;
|
|
231
|
+
} else t9 = $[34];
|
|
232
|
+
return t9;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
//#endregion
|
|
236
|
+
export { PublishedPageContent };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PublishedPageContent } from "./PublishedPageContent.js";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/features/page/PublishedPageExperience.tsx
|
|
6
|
+
function PublishedPageExperience(t0) {
|
|
7
|
+
const $ = c(3);
|
|
8
|
+
if ($[0] !== "f8c4ab62f3391b7d7d7c339075d7595002caf53b46af25469e17c7fecd4d7d52") {
|
|
9
|
+
for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
10
|
+
$[0] = "f8c4ab62f3391b7d7d7c339075d7595002caf53b46af25469e17c7fecd4d7d52";
|
|
11
|
+
}
|
|
12
|
+
const { source } = t0;
|
|
13
|
+
let t1;
|
|
14
|
+
if ($[1] !== source) {
|
|
15
|
+
t1 = /* @__PURE__ */ jsx(PublishedPageContent, { source });
|
|
16
|
+
$[1] = source;
|
|
17
|
+
$[2] = t1;
|
|
18
|
+
} else t1 = $[2];
|
|
19
|
+
return t1;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { PublishedPageExperience };
|