camox 0.3.0 → 0.3.1
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/components/AuthGate.js +2 -1
- package/dist/core/components/AddBlockControlBar.js +117 -44
- package/dist/core/components/lexical/InlineContentEditable.js +37 -17
- package/dist/core/components/lexical/InlineLexicalEditor.js +84 -25
- package/dist/core/components/lexical/SelectionBroadcaster.js +84 -47
- package/dist/core/components/lexical/SidebarLexicalEditor.js +54 -19
- package/dist/core/createBlock.js +1172 -414
- package/dist/core/createLayout.js +48 -16
- package/dist/core/hooks/useFieldSelection.js +24 -13
- package/dist/core/hooks/useIsEditable.js +8 -2
- package/dist/core/hooks/useOverlayMessage.js +51 -20
- package/dist/features/content/CamoxContent.js +239 -107
- package/dist/features/content/components/AssetCard.js +78 -16
- package/dist/features/content/components/AssetCardSkeleton.js +11 -4
- package/dist/features/content/components/ContentSidebar.js +15 -8
- package/dist/features/content/components/UploadDropZone.js +77 -34
- package/dist/features/content/components/UploadProgressDrawer.js +201 -58
- package/dist/features/metadata/sitemap.js +15 -0
- package/dist/features/preview/CamoxPreview.js +447 -179
- package/dist/features/preview/components/AddBlockSheet.js +344 -167
- package/dist/features/preview/components/AgentChatSheet.js +32 -10
- package/dist/features/preview/components/AssetFieldEditor.js +185 -50
- package/dist/features/preview/components/AssetLightbox.js +60 -33
- package/dist/features/preview/components/AssetPickerGrid.js +203 -71
- package/dist/features/preview/components/BlockActionsPopover.js +295 -218
- package/dist/features/preview/components/CreatePageSheet.js +3 -3
- package/dist/features/preview/components/DebouncedFieldEditor.js +80 -23
- package/dist/features/preview/components/EditPageSheet.js +241 -86
- package/dist/features/preview/components/ItemFieldsEditor.js +209 -115
- package/dist/features/preview/components/LinkFieldEditor.js +351 -153
- package/dist/features/preview/components/MultipleAssetFieldEditor.js +245 -92
- package/dist/features/preview/components/OverlayTracker.js +58 -23
- package/dist/features/preview/components/Overlays.js +85 -43
- package/dist/features/preview/components/PageContentSheet.js +18 -18
- package/dist/features/preview/components/PageLocationFieldset.js +229 -63
- package/dist/features/preview/components/PagePicker.js +27 -27
- package/dist/features/preview/components/PageTree.js +921 -319
- package/dist/features/preview/components/PeekedBlock.js +173 -63
- package/dist/features/preview/components/PreviewPanel.js +271 -148
- package/dist/features/preview/components/PreviewSideSheet.js +44 -11
- package/dist/features/preview/components/PreviewToolbar.js +262 -59
- package/dist/features/preview/components/RepeatableItemsList.js +187 -78
- package/dist/features/preview/components/ShikiMarkdown.js +46 -20
- package/dist/features/preview/components/TextFormatToolbar.js +81 -23
- package/dist/features/preview/components/UnlinkAssetButton.js +161 -40
- package/dist/features/preview/components/useUpdateBlockPosition.js +64 -47
- package/dist/features/preview/previewStore.d.ts +2 -2
- package/dist/features/provider/CamoxProvider.js +69 -21
- package/dist/features/provider/actionsStore.d.ts +2 -2
- package/dist/features/provider/components/CamoxAppContext.js +15 -5
- package/dist/features/provider/components/CommandPalette.js +199 -92
- package/dist/features/provider/useAdminShortcuts.js +80 -64
- package/dist/features/routes/pageRoute.js +8 -1
- package/dist/features/studio/CamoxStudio.js +45 -9
- package/dist/features/studio/components/EnvironmentMenu.js +47 -12
- package/dist/features/studio/components/Navbar.js +163 -65
- package/dist/features/studio/components/ProjectMenu.js +263 -82
- package/dist/features/studio/components/UserButton.js +21 -6
- package/dist/features/studio/studioStore.d.ts +2 -2
- package/dist/features/studio/useTheme.js +128 -74
- package/dist/hooks/use-file-upload.js +11 -11
- package/dist/hooks/use-marquee-selection.js +121 -74
- package/dist/lib/auth.js +95 -51
- package/dist/lib/normalized-data.js +103 -30
- package/dist/lib/use-project-room.js +55 -22
- package/dist/studio.css +2 -2
- package/package.json +29 -26
- package/dist/lib/auth.d.ts +0 -2130
- package/dist/lib/auth.d.ts.map +0 -1
|
@@ -1,36 +1,75 @@
|
|
|
1
|
+
import { c } from "react/compiler-runtime";
|
|
1
2
|
import { Input } from "@camox/ui/input";
|
|
2
3
|
import { Label } from "@camox/ui/label";
|
|
3
4
|
import * as React from "react";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
import { Textarea } from "@camox/ui/textarea";
|
|
6
7
|
//#region src/features/preview/components/DebouncedFieldEditor.tsx
|
|
7
|
-
var DebouncedFieldEditor = (
|
|
8
|
+
var DebouncedFieldEditor = (t0) => {
|
|
9
|
+
const $ = c(22);
|
|
10
|
+
const { label, placeholder, initialValue, onSave, disabled, rows } = t0;
|
|
8
11
|
const [value, setValue] = React.useState(initialValue);
|
|
9
12
|
const timerRef = React.useRef(null);
|
|
10
13
|
const inputId = React.useId();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
let t1;
|
|
15
|
+
let t2;
|
|
16
|
+
if ($[0] !== initialValue) {
|
|
17
|
+
t1 = () => {
|
|
18
|
+
setValue(initialValue);
|
|
19
|
+
};
|
|
20
|
+
t2 = [initialValue];
|
|
21
|
+
$[0] = initialValue;
|
|
22
|
+
$[1] = t1;
|
|
23
|
+
$[2] = t2;
|
|
24
|
+
} else {
|
|
25
|
+
t1 = $[1];
|
|
26
|
+
t2 = $[2];
|
|
27
|
+
}
|
|
28
|
+
React.useEffect(t1, t2);
|
|
29
|
+
let t3;
|
|
30
|
+
if ($[3] !== disabled || $[4] !== onSave || $[5] !== rows) {
|
|
31
|
+
t3 = (newValue) => {
|
|
32
|
+
if (disabled) return;
|
|
33
|
+
if (rows) newValue = newValue.replace(/\n/g, " ");
|
|
34
|
+
setValue(newValue);
|
|
35
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
36
|
+
timerRef.current = window.setTimeout(() => {
|
|
37
|
+
onSave(newValue);
|
|
38
|
+
}, 500);
|
|
39
|
+
};
|
|
40
|
+
$[3] = disabled;
|
|
41
|
+
$[4] = onSave;
|
|
42
|
+
$[5] = rows;
|
|
43
|
+
$[6] = t3;
|
|
44
|
+
} else t3 = $[6];
|
|
45
|
+
const handleChange = t3;
|
|
46
|
+
let t4;
|
|
47
|
+
let t5;
|
|
48
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
49
|
+
t4 = () => () => {
|
|
25
50
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
26
51
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
52
|
+
t5 = [];
|
|
53
|
+
$[7] = t4;
|
|
54
|
+
$[8] = t5;
|
|
55
|
+
} else {
|
|
56
|
+
t4 = $[7];
|
|
57
|
+
t5 = $[8];
|
|
58
|
+
}
|
|
59
|
+
React.useEffect(t4, t5);
|
|
60
|
+
let t6;
|
|
61
|
+
if ($[9] !== inputId || $[10] !== label) {
|
|
62
|
+
t6 = /* @__PURE__ */ jsx(Label, {
|
|
31
63
|
htmlFor: inputId,
|
|
32
64
|
children: label
|
|
33
|
-
})
|
|
65
|
+
});
|
|
66
|
+
$[9] = inputId;
|
|
67
|
+
$[10] = label;
|
|
68
|
+
$[11] = t6;
|
|
69
|
+
} else t6 = $[11];
|
|
70
|
+
let t7;
|
|
71
|
+
if ($[12] !== disabled || $[13] !== handleChange || $[14] !== inputId || $[15] !== placeholder || $[16] !== rows || $[17] !== value) {
|
|
72
|
+
t7 = rows ? /* @__PURE__ */ jsx(Textarea, {
|
|
34
73
|
id: inputId,
|
|
35
74
|
value,
|
|
36
75
|
onChange: (e) => handleChange(e.target.value),
|
|
@@ -41,11 +80,29 @@ var DebouncedFieldEditor = ({ label, placeholder, initialValue, onSave, disabled
|
|
|
41
80
|
}) : /* @__PURE__ */ jsx(Input, {
|
|
42
81
|
id: inputId,
|
|
43
82
|
value,
|
|
44
|
-
onChange: (
|
|
83
|
+
onChange: (e_0) => handleChange(e_0.target.value),
|
|
45
84
|
placeholder,
|
|
46
85
|
disabled
|
|
47
|
-
})
|
|
48
|
-
|
|
86
|
+
});
|
|
87
|
+
$[12] = disabled;
|
|
88
|
+
$[13] = handleChange;
|
|
89
|
+
$[14] = inputId;
|
|
90
|
+
$[15] = placeholder;
|
|
91
|
+
$[16] = rows;
|
|
92
|
+
$[17] = value;
|
|
93
|
+
$[18] = t7;
|
|
94
|
+
} else t7 = $[18];
|
|
95
|
+
let t8;
|
|
96
|
+
if ($[19] !== t6 || $[20] !== t7) {
|
|
97
|
+
t8 = /* @__PURE__ */ jsxs("div", {
|
|
98
|
+
className: "space-y-2",
|
|
99
|
+
children: [t6, t7]
|
|
100
|
+
});
|
|
101
|
+
$[19] = t6;
|
|
102
|
+
$[20] = t7;
|
|
103
|
+
$[21] = t8;
|
|
104
|
+
} else t8 = $[21];
|
|
105
|
+
return t8;
|
|
49
106
|
};
|
|
50
107
|
//#endregion
|
|
51
108
|
export { DebouncedFieldEditor };
|
|
@@ -7,6 +7,7 @@ import { trackClientEvent } from "../../../lib/analytics-client.js";
|
|
|
7
7
|
import { PageLocationFieldset } from "./PageLocationFieldset.js";
|
|
8
8
|
import { DebouncedFieldEditor } from "./DebouncedFieldEditor.js";
|
|
9
9
|
import { ShikiMarkdown } from "./ShikiMarkdown.js";
|
|
10
|
+
import { c } from "react/compiler-runtime";
|
|
10
11
|
import { Label } from "@camox/ui/label";
|
|
11
12
|
import { toast } from "@camox/ui/toaster";
|
|
12
13
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
@@ -24,9 +25,16 @@ import { useForm } from "@tanstack/react-form";
|
|
|
24
25
|
import { Switch } from "@camox/ui/switch";
|
|
25
26
|
//#region src/features/preview/components/EditPageSheet.tsx
|
|
26
27
|
var EditPageSheet = () => {
|
|
27
|
-
const
|
|
28
|
+
const $ = c(2);
|
|
29
|
+
const editingPageId = useSelector(previewStore, _temp);
|
|
28
30
|
if (!editingPageId) return null;
|
|
29
|
-
|
|
31
|
+
let t0;
|
|
32
|
+
if ($[0] !== editingPageId) {
|
|
33
|
+
t0 = /* @__PURE__ */ jsx(EditPageSheetContent, { pageId: editingPageId });
|
|
34
|
+
$[0] = editingPageId;
|
|
35
|
+
$[1] = t0;
|
|
36
|
+
} else t0 = $[1];
|
|
37
|
+
return t0;
|
|
30
38
|
};
|
|
31
39
|
var EditPageSheetContent = ({ pageId }) => {
|
|
32
40
|
const projectSlug = useProjectSlug();
|
|
@@ -159,7 +167,7 @@ var EditPageSheetContent = ({ pageId }) => {
|
|
|
159
167
|
className: "space-y-2",
|
|
160
168
|
children: [/* @__PURE__ */ jsx(Label, { children: "Layout" }), /* @__PURE__ */ jsxs(Select, {
|
|
161
169
|
value: field.state.value ? String(field.state.value) : "",
|
|
162
|
-
onValueChange: (
|
|
170
|
+
onValueChange: (value_0) => field.handleChange(Number(value_0)),
|
|
163
171
|
children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select a layout" }) }), /* @__PURE__ */ jsx(SelectContent, { children: layouts.map((t) => /* @__PURE__ */ jsx(SelectItem, {
|
|
164
172
|
value: String(t.id),
|
|
165
173
|
children: camoxApp.getLayoutById(t.layoutId)?.title ?? t.layoutId
|
|
@@ -216,9 +224,9 @@ var EditPageSheetContent = ({ pageId }) => {
|
|
|
216
224
|
placeholder: "Page title...",
|
|
217
225
|
initialValue: page.metaTitle ?? "",
|
|
218
226
|
disabled: page.aiSeoEnabled !== false,
|
|
219
|
-
onSave: (
|
|
227
|
+
onSave: (value_1) => setMetaTitle.mutate({
|
|
220
228
|
id: page.id,
|
|
221
|
-
metaTitle:
|
|
229
|
+
metaTitle: value_1
|
|
222
230
|
})
|
|
223
231
|
}),
|
|
224
232
|
/* @__PURE__ */ jsx(DebouncedFieldEditor, {
|
|
@@ -227,9 +235,9 @@ var EditPageSheetContent = ({ pageId }) => {
|
|
|
227
235
|
initialValue: page.metaDescription ?? "",
|
|
228
236
|
disabled: page.aiSeoEnabled !== false,
|
|
229
237
|
rows: 2,
|
|
230
|
-
onSave: (
|
|
238
|
+
onSave: (value_2) => setMetaDescription.mutate({
|
|
231
239
|
id: page.id,
|
|
232
|
-
metaDescription:
|
|
240
|
+
metaDescription: value_2
|
|
233
241
|
})
|
|
234
242
|
}),
|
|
235
243
|
/* @__PURE__ */ jsx(SearchEnginePreview, {
|
|
@@ -270,95 +278,242 @@ function truncateText(text, maxLen) {
|
|
|
270
278
|
if (text.length <= maxLen) return text;
|
|
271
279
|
return text.slice(0, maxLen) + "...";
|
|
272
280
|
}
|
|
273
|
-
var SearchEnginePreview = (
|
|
281
|
+
var SearchEnginePreview = (t0) => {
|
|
282
|
+
const $ = c(16);
|
|
283
|
+
const { page, metaTitle, metaDescription } = t0;
|
|
274
284
|
const url = `${typeof window !== "undefined" ? window.location.origin : ""}${page.fullPath}`;
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
285
|
+
let t1;
|
|
286
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
287
|
+
t1 = /* @__PURE__ */ jsx(Label, { children: "Search engine preview" });
|
|
288
|
+
$[0] = t1;
|
|
289
|
+
} else t1 = $[0];
|
|
290
|
+
let t2;
|
|
291
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
292
|
+
t2 = /* @__PURE__ */ jsxs("div", {
|
|
278
293
|
className: "flex items-center gap-1.5",
|
|
279
|
-
children: [
|
|
294
|
+
children: [t1, /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
280
295
|
asChild: true,
|
|
281
296
|
children: /* @__PURE__ */ jsx(Info, { className: "text-muted-foreground size-3.5" })
|
|
282
297
|
}), /* @__PURE__ */ jsx(TooltipContent, { children: "Titles are cropped after 60 characters and descriptions after 155, like Google typically does." })] })]
|
|
283
|
-
})
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
298
|
+
});
|
|
299
|
+
$[1] = t2;
|
|
300
|
+
} else t2 = $[1];
|
|
301
|
+
let t3;
|
|
302
|
+
if ($[2] !== url) {
|
|
303
|
+
t3 = /* @__PURE__ */ jsx("p", {
|
|
304
|
+
className: "text-muted-foreground truncate text-xs",
|
|
305
|
+
children: url
|
|
306
|
+
});
|
|
307
|
+
$[2] = url;
|
|
308
|
+
$[3] = t3;
|
|
309
|
+
} else t3 = $[3];
|
|
310
|
+
const t4 = metaTitle || "Untitled";
|
|
311
|
+
let t5;
|
|
312
|
+
if ($[4] !== t4) {
|
|
313
|
+
t5 = truncateText(t4, 60);
|
|
314
|
+
$[4] = t4;
|
|
315
|
+
$[5] = t5;
|
|
316
|
+
} else t5 = $[5];
|
|
317
|
+
let t6;
|
|
318
|
+
if ($[6] !== t5) {
|
|
319
|
+
t6 = /* @__PURE__ */ jsx("p", {
|
|
320
|
+
className: "text-base font-medium text-blue-600 dark:text-blue-400",
|
|
321
|
+
children: t5
|
|
322
|
+
});
|
|
323
|
+
$[6] = t5;
|
|
324
|
+
$[7] = t6;
|
|
325
|
+
} else t6 = $[7];
|
|
326
|
+
const t7 = metaDescription || "No description";
|
|
327
|
+
let t8;
|
|
328
|
+
if ($[8] !== t7) {
|
|
329
|
+
t8 = truncateText(t7, 155);
|
|
330
|
+
$[8] = t7;
|
|
331
|
+
$[9] = t8;
|
|
332
|
+
} else t8 = $[9];
|
|
333
|
+
let t9;
|
|
334
|
+
if ($[10] !== t8) {
|
|
335
|
+
t9 = /* @__PURE__ */ jsx("p", {
|
|
336
|
+
className: "text-muted-foreground line-clamp-2 text-xs",
|
|
337
|
+
children: t8
|
|
338
|
+
});
|
|
339
|
+
$[10] = t8;
|
|
340
|
+
$[11] = t9;
|
|
341
|
+
} else t9 = $[11];
|
|
342
|
+
let t10;
|
|
343
|
+
if ($[12] !== t3 || $[13] !== t6 || $[14] !== t9) {
|
|
344
|
+
t10 = /* @__PURE__ */ jsxs("div", {
|
|
345
|
+
className: "space-y-1 pt-2",
|
|
346
|
+
children: [t2, /* @__PURE__ */ jsxs("div", {
|
|
347
|
+
className: "border-border space-y-0.5 rounded-lg border p-3",
|
|
348
|
+
children: [
|
|
349
|
+
t3,
|
|
350
|
+
t6,
|
|
351
|
+
t9
|
|
352
|
+
]
|
|
353
|
+
})]
|
|
354
|
+
});
|
|
355
|
+
$[12] = t3;
|
|
356
|
+
$[13] = t6;
|
|
357
|
+
$[14] = t9;
|
|
358
|
+
$[15] = t10;
|
|
359
|
+
} else t10 = $[15];
|
|
360
|
+
return t10;
|
|
301
361
|
};
|
|
302
|
-
var SocialPreviewSection = (
|
|
362
|
+
var SocialPreviewSection = (t0) => {
|
|
363
|
+
const $ = c(22);
|
|
364
|
+
const { page, metaTitle, metaDescription, layoutId, projectName } = t0;
|
|
303
365
|
const pageMetaTitle = page.metaTitle ?? page.pathSegment;
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
366
|
+
let t1;
|
|
367
|
+
if ($[0] !== layoutId || $[1] !== page.metaDescription || $[2] !== pageMetaTitle || $[3] !== projectName) {
|
|
368
|
+
t1 = new URLSearchParams({
|
|
369
|
+
...layoutId && { layoutId },
|
|
370
|
+
title: pageMetaTitle,
|
|
371
|
+
...page.metaDescription && { description: page.metaDescription },
|
|
372
|
+
...projectName && { projectName }
|
|
373
|
+
}).toString();
|
|
374
|
+
$[0] = layoutId;
|
|
375
|
+
$[1] = page.metaDescription;
|
|
376
|
+
$[2] = pageMetaTitle;
|
|
377
|
+
$[3] = projectName;
|
|
378
|
+
$[4] = t1;
|
|
379
|
+
} else t1 = $[4];
|
|
380
|
+
const ogImage = `/og?${t1}`;
|
|
310
381
|
const url = `${typeof window !== "undefined" ? window.location.origin : ""}${page.fullPath}`;
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
382
|
+
let t2;
|
|
383
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
384
|
+
t2 = /* @__PURE__ */ jsx(Label, { children: "Social preview" });
|
|
385
|
+
$[5] = t2;
|
|
386
|
+
} else t2 = $[5];
|
|
387
|
+
let t3;
|
|
388
|
+
if ($[6] !== ogImage) {
|
|
389
|
+
t3 = ogImage ? /* @__PURE__ */ jsx("img", {
|
|
390
|
+
src: ogImage,
|
|
391
|
+
alt: "",
|
|
392
|
+
className: "w-full object-cover",
|
|
393
|
+
style: { aspectRatio: "1200 / 630" }
|
|
394
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
395
|
+
className: "bg-muted w-full",
|
|
396
|
+
style: { aspectRatio: "1200 / 630" }
|
|
397
|
+
});
|
|
398
|
+
$[6] = ogImage;
|
|
399
|
+
$[7] = t3;
|
|
400
|
+
} else t3 = $[7];
|
|
401
|
+
const t4 = metaTitle || "Untitled";
|
|
402
|
+
let t5;
|
|
403
|
+
if ($[8] !== t4) {
|
|
404
|
+
t5 = /* @__PURE__ */ jsx("p", {
|
|
405
|
+
className: "text-foreground truncate text-sm font-semibold",
|
|
406
|
+
children: t4
|
|
407
|
+
});
|
|
408
|
+
$[8] = t4;
|
|
409
|
+
$[9] = t5;
|
|
410
|
+
} else t5 = $[9];
|
|
411
|
+
const t6 = metaDescription || "No description";
|
|
412
|
+
let t7;
|
|
413
|
+
if ($[10] !== t6) {
|
|
414
|
+
t7 = /* @__PURE__ */ jsx("p", {
|
|
415
|
+
className: "text-muted-foreground line-clamp-2 text-xs",
|
|
416
|
+
children: t6
|
|
417
|
+
});
|
|
418
|
+
$[10] = t6;
|
|
419
|
+
$[11] = t7;
|
|
420
|
+
} else t7 = $[11];
|
|
421
|
+
let t8;
|
|
422
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
423
|
+
t8 = /* @__PURE__ */ jsx(Globe, { className: "size-3 shrink-0" });
|
|
424
|
+
$[12] = t8;
|
|
425
|
+
} else t8 = $[12];
|
|
426
|
+
let t9;
|
|
427
|
+
if ($[13] !== url) {
|
|
428
|
+
t9 = /* @__PURE__ */ jsx("div", {
|
|
429
|
+
className: "pt-1.5",
|
|
430
|
+
children: /* @__PURE__ */ jsxs("p", {
|
|
431
|
+
className: "text-muted-foreground flex items-center gap-1 text-xs",
|
|
432
|
+
children: [t8, /* @__PURE__ */ jsx("span", {
|
|
433
|
+
className: "truncate",
|
|
434
|
+
children: url
|
|
435
|
+
})]
|
|
436
|
+
})
|
|
437
|
+
});
|
|
438
|
+
$[13] = url;
|
|
439
|
+
$[14] = t9;
|
|
440
|
+
} else t9 = $[14];
|
|
441
|
+
let t10;
|
|
442
|
+
if ($[15] !== t5 || $[16] !== t7 || $[17] !== t9) {
|
|
443
|
+
t10 = /* @__PURE__ */ jsxs("div", {
|
|
444
|
+
className: "space-y-1.5 border-t px-3 py-2.5",
|
|
445
|
+
children: [
|
|
446
|
+
t5,
|
|
447
|
+
t7,
|
|
448
|
+
t9
|
|
449
|
+
]
|
|
450
|
+
});
|
|
451
|
+
$[15] = t5;
|
|
452
|
+
$[16] = t7;
|
|
453
|
+
$[17] = t9;
|
|
454
|
+
$[18] = t10;
|
|
455
|
+
} else t10 = $[18];
|
|
456
|
+
let t11;
|
|
457
|
+
if ($[19] !== t10 || $[20] !== t3) {
|
|
458
|
+
t11 = /* @__PURE__ */ jsxs("div", {
|
|
459
|
+
className: "space-y-2 pt-2",
|
|
460
|
+
children: [t2, /* @__PURE__ */ jsxs("div", {
|
|
461
|
+
className: "border-border bg-background overflow-hidden rounded-lg border",
|
|
462
|
+
children: [t3, t10]
|
|
345
463
|
})]
|
|
346
|
-
})
|
|
347
|
-
|
|
464
|
+
});
|
|
465
|
+
$[19] = t10;
|
|
466
|
+
$[20] = t3;
|
|
467
|
+
$[21] = t11;
|
|
468
|
+
} else t11 = $[21];
|
|
469
|
+
return t11;
|
|
348
470
|
};
|
|
349
|
-
var PageMarkdownPreview = (
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
471
|
+
var PageMarkdownPreview = (t0) => {
|
|
472
|
+
const $ = c(8);
|
|
473
|
+
const { pageId, metaTitle, metaDescription } = t0;
|
|
474
|
+
let t1;
|
|
475
|
+
if ($[0] !== pageId) {
|
|
476
|
+
t1 = blockQueries.getPageMarkdown(pageId);
|
|
477
|
+
$[0] = pageId;
|
|
478
|
+
$[1] = t1;
|
|
479
|
+
} else t1 = $[1];
|
|
480
|
+
const { data: markdown } = useQuery(t1);
|
|
481
|
+
if (markdown === void 0) {
|
|
482
|
+
let t2;
|
|
483
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
484
|
+
t2 = /* @__PURE__ */ jsxs("div", {
|
|
485
|
+
className: "text-muted-foreground flex items-center gap-2 py-2 text-sm",
|
|
486
|
+
children: [/* @__PURE__ */ jsx(Spinner, { className: "size-3.5" }), "Loading..."]
|
|
487
|
+
});
|
|
488
|
+
$[2] = t2;
|
|
489
|
+
} else t2 = $[2];
|
|
490
|
+
return t2;
|
|
491
|
+
}
|
|
492
|
+
const t2 = `title: "${metaTitle}"`;
|
|
493
|
+
const t3 = `description: "${metaDescription}"`;
|
|
494
|
+
let frontmatterLines;
|
|
495
|
+
if ($[3] !== t2 || $[4] !== t3) {
|
|
496
|
+
frontmatterLines = [
|
|
497
|
+
"---",
|
|
498
|
+
t2,
|
|
499
|
+
t3
|
|
500
|
+
];
|
|
501
|
+
frontmatterLines.push("---");
|
|
502
|
+
$[3] = t2;
|
|
503
|
+
$[4] = t3;
|
|
504
|
+
$[5] = frontmatterLines;
|
|
505
|
+
} else frontmatterLines = $[5];
|
|
506
|
+
const fullMarkdown = frontmatterLines.join("\n") + "\n\n" + (markdown ?? "");
|
|
507
|
+
let t4;
|
|
508
|
+
if ($[6] !== fullMarkdown) {
|
|
509
|
+
t4 = /* @__PURE__ */ jsx(ShikiMarkdown, { code: fullMarkdown });
|
|
510
|
+
$[6] = fullMarkdown;
|
|
511
|
+
$[7] = t4;
|
|
512
|
+
} else t4 = $[7];
|
|
513
|
+
return t4;
|
|
362
514
|
};
|
|
515
|
+
function _temp(state) {
|
|
516
|
+
return state.context.editingPageId;
|
|
517
|
+
}
|
|
363
518
|
//#endregion
|
|
364
519
|
export { EditPageSheet };
|