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
|
@@ -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 };
|
|
@@ -2,13 +2,13 @@ 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
14
|
import { pageFullQueryFn } from "./previewQueryFns.js";
|
|
@@ -18,9 +18,9 @@ import { PreviewPanel } from "./components/PreviewPanel.js";
|
|
|
18
18
|
import { RightSidebar } from "./components/RightSidebar.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
|
|
@@ -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
19
|
import { Switch } from "@camox/ui/switch";
|
|
19
20
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@camox/ui/tooltip";
|
|
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",
|
|
@@ -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
|