camox 0.47.0 → 0.48.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/createApp.d.ts +19 -6
- package/dist/core/createApp.js +7 -2
- package/dist/core/createBlock.js +54 -43
- package/dist/core/createCollection.d.ts +25 -7
- package/dist/core/createCollection.js +28 -9
- package/dist/core/createLayout.d.ts +98 -71
- package/dist/core/createLayout.js +10 -16
- package/dist/core/derivedRoutes.js +1 -1
- package/dist/core/editing/BlockEditingRuntime.d.ts +3 -2
- package/dist/core/editing/CompleteBlockEditingRuntime.js +2 -1
- package/dist/core/editing/createEditableBlock.d.ts +59 -19
- package/dist/core/editing/createEditableBlock.js +162 -151
- package/dist/core/editing/useLatestRecord.js +7 -7
- package/dist/core/layoutContext.d.ts +54 -0
- package/dist/core/layoutContext.js +66 -0
- package/dist/core/lib/contentType.d.ts +91 -4
- package/dist/core/lib/contentType.js +84 -7
- package/dist/core/lib/recordScope.js +19 -17
- package/dist/core/lib/reference.d.ts +6 -2
- package/dist/core/recordItem.js +55 -2
- package/dist/core/requestContext.d.ts +18 -0
- package/dist/core/structuredData.d.ts +126 -0
- package/dist/core/structuredData.js +40 -0
- package/dist/features/canvas/canvasCamera.js +1 -1
- package/dist/features/canvas/sidebar/CanvasSidebarFrame.js +1 -1
- package/dist/features/content/ContentCollection.js +13 -7
- package/dist/features/content/collection-form.js +6 -2
- package/dist/features/content/components/MissingFromLocale.js +1 -1
- package/dist/features/og/pageImage.js +89 -0
- package/dist/features/page/CuratedPageContent.js +45 -32
- package/dist/features/page/DerivedPageContent.js +49 -22
- package/dist/features/page/SharedLayoutContent.js +26 -22
- package/dist/features/preview/CamoxPreview.js +40 -26
- package/dist/features/preview/components/AddBlockSheet.js +1 -0
- package/dist/features/preview/components/BlockActionsPopover.js +8 -6
- package/dist/features/preview/components/PageInfo.js +244 -264
- package/dist/features/preview/components/PageTree.js +63 -53
- package/dist/features/preview/components/RecordCard.js +50 -34
- package/dist/features/preview/components/RecordCombobox.js +12 -5
- package/dist/features/preview/components/ReferenceFieldEditor.js +4 -2
- package/dist/features/preview/components/ReferenceListFieldEditor.js +24 -19
- package/dist/features/preview/components/RepeatableItemsList.js +62 -46
- package/dist/features/preview/components/SelectionEditor.js +3 -2
- package/dist/features/preview/components/useFieldWriter.js +2 -4
- package/dist/features/preview/components/useRecordView.js +2 -2
- package/dist/features/preview/entityName.js +11 -0
- package/dist/features/preview/pageRecord.js +17 -18
- package/dist/features/routes/pageRuntime.d.ts +15 -1
- package/dist/features/routes/pageRuntime.js +35 -38
- package/dist/features/runtime/RuntimeChrome.js +1 -1
- package/dist/features/runtime/breadcrumbs.js +68 -0
- package/dist/features/runtime/livePages.js +3 -2
- package/dist/features/runtime/pageGraph.js +92 -0
- package/dist/features/runtime/projectLogo.js +110 -0
- package/dist/features/runtime/runtime.d.ts +11 -6
- package/dist/features/runtime/runtime.js +278 -55
- package/dist/features/runtime/runtimeRoutes.d.ts +1 -0
- package/dist/features/runtime/runtimeRoutes.js +1 -0
- package/dist/features/runtime/structuredData.js +213 -0
- package/dist/features/studio/components/ChatSidebar.js +5 -5
- package/dist/features/studio/components/ProjectMenu.js +127 -100
- package/dist/features/studio/components/SocialProfilesDialog.js +342 -0
- package/dist/features/studio/components/ThreadMessages.js +2 -2
- package/dist/features/vite/blockBoilerplate.js +3 -2
- package/dist/features/vite/layoutGeneration.js +3 -2
- package/dist/features/vite/vite.js +1 -0
- package/dist/lib/queries.d.ts +4 -0
- package/dist/lib/queries.js +1 -0
- package/dist/lib/studio-reads.js +3 -1
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +5 -4
- package/skills/camox/references/block-definitions.md +105 -25
- package/skills/camox/references/layout-definitions.md +53 -17
- package/skills/camox/references/routed-layouts.md +17 -14
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { useProjectUuid } from "../../../lib/auth.js";
|
|
2
|
+
import { useOptionalDraftScope } from "../../../lib/draft-scope.js";
|
|
3
|
+
import { useViewLocale } from "../../../lib/view-locale-context.js";
|
|
2
4
|
import { useNavigate } from "../../navigation/navigation.js";
|
|
3
5
|
import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
|
|
4
6
|
import { reads, useReadQuery, useStudioCache } from "../../../lib/studio-reads.js";
|
|
7
|
+
import { curatedLayoutContext } from "../../../core/layoutContext.js";
|
|
5
8
|
import { cn } from "../../../lib/utils.js";
|
|
6
9
|
import { UploadDropZone } from "../../content/components/UploadDropZone.js";
|
|
7
10
|
import { pageMutations } from "../../../lib/queries.js";
|
|
@@ -12,6 +15,7 @@ import { useLocalizedPath } from "../../../lib/view-locale.js";
|
|
|
12
15
|
import { PageNicknameField } from "./PageNicknameField.js";
|
|
13
16
|
import { PageInfoSkeleton } from "./PageInfoSkeleton.js";
|
|
14
17
|
import { PageLocationFieldset } from "./PageLocationFieldset.js";
|
|
18
|
+
import { pageImageUrl } from "../../og/pageImage.js";
|
|
15
19
|
import { ShikiMarkdown } from "./ShikiMarkdown.js";
|
|
16
20
|
import { c } from "react/compiler-runtime";
|
|
17
21
|
import * as React from "react";
|
|
@@ -37,7 +41,7 @@ import { Checkbox } from "@camox/ui/checkbox";
|
|
|
37
41
|
|
|
38
42
|
//#region src/features/preview/components/PageInfo.tsx
|
|
39
43
|
const usePageMetadataData = (pageId) => {
|
|
40
|
-
const $ = c(
|
|
44
|
+
const $ = c(23);
|
|
41
45
|
const projectUuid = useProjectUuid();
|
|
42
46
|
const camoxApp = useCamoxApp();
|
|
43
47
|
let t0;
|
|
@@ -90,32 +94,16 @@ const usePageMetadataData = (pageId) => {
|
|
|
90
94
|
$[14] = t8;
|
|
91
95
|
} else t8 = $[14];
|
|
92
96
|
const layouts = t8;
|
|
93
|
-
|
|
97
|
+
const pageLayoutRecord = allLayouts?.find((l) => l.layoutId === page?.layoutId);
|
|
98
|
+
const layoutDef = pageLayoutRecord ? camoxApp.getLayoutById(pageLayoutRecord.layoutId) : void 0;
|
|
99
|
+
const { locale } = useViewLocale();
|
|
100
|
+
const metaTitle = layoutDef && page ? layoutDef._internal.toTitle(curatedLayoutContext({
|
|
101
|
+
page,
|
|
102
|
+
projectName: project?.name ?? ""
|
|
103
|
+
}, locale)) : page?.metaTitle ?? "";
|
|
94
104
|
let t9;
|
|
95
|
-
if ($[15] !==
|
|
96
|
-
|
|
97
|
-
const layoutDef = pageLayoutRecord ? camoxApp.getLayoutById(pageLayoutRecord.layoutId) : void 0;
|
|
98
|
-
t9 = layoutDef && page ? layoutDef._internal.buildMetaTitle({
|
|
99
|
-
pageMetaTitle: page.metaTitle ?? "",
|
|
100
|
-
projectName: project?.name ?? "",
|
|
101
|
-
pageFullPath: page.fullPath,
|
|
102
|
-
data: void 0,
|
|
103
|
-
params: {}
|
|
104
|
-
}) : page?.metaTitle ?? "";
|
|
105
|
-
$[15] = allLayouts;
|
|
106
|
-
$[16] = camoxApp;
|
|
107
|
-
$[17] = page;
|
|
108
|
-
$[18] = project?.name;
|
|
109
|
-
$[19] = pageLayoutRecord;
|
|
110
|
-
$[20] = t9;
|
|
111
|
-
} else {
|
|
112
|
-
pageLayoutRecord = $[19];
|
|
113
|
-
t9 = $[20];
|
|
114
|
-
}
|
|
115
|
-
const metaTitle = t9;
|
|
116
|
-
let t10;
|
|
117
|
-
if ($[21] !== camoxApp || $[22] !== layouts || $[23] !== metaTitle || $[24] !== page || $[25] !== pageLayoutRecord || $[26] !== pages || $[27] !== project) {
|
|
118
|
-
t10 = {
|
|
105
|
+
if ($[15] !== camoxApp || $[16] !== layouts || $[17] !== metaTitle || $[18] !== page || $[19] !== pageLayoutRecord || $[20] !== pages || $[21] !== project) {
|
|
106
|
+
t9 = {
|
|
119
107
|
page,
|
|
120
108
|
project,
|
|
121
109
|
pages,
|
|
@@ -124,16 +112,16 @@ const usePageMetadataData = (pageId) => {
|
|
|
124
112
|
metaTitle,
|
|
125
113
|
camoxApp
|
|
126
114
|
};
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
} else
|
|
136
|
-
return
|
|
115
|
+
$[15] = camoxApp;
|
|
116
|
+
$[16] = layouts;
|
|
117
|
+
$[17] = metaTitle;
|
|
118
|
+
$[18] = page;
|
|
119
|
+
$[19] = pageLayoutRecord;
|
|
120
|
+
$[20] = pages;
|
|
121
|
+
$[21] = project;
|
|
122
|
+
$[22] = t9;
|
|
123
|
+
} else t9 = $[22];
|
|
124
|
+
return t9;
|
|
137
125
|
};
|
|
138
126
|
const PAGE_SETTINGS_ITEM = "page-settings";
|
|
139
127
|
const SHOW_PAGE_SETTINGS_STORAGE_KEY = "camox:studio:showPageSettings";
|
|
@@ -1021,31 +1009,27 @@ const PageSeoSheet = (t0) => {
|
|
|
1021
1009
|
return t3;
|
|
1022
1010
|
};
|
|
1023
1011
|
const PageSeoContent = (t0) => {
|
|
1024
|
-
const $ = c(
|
|
1012
|
+
const $ = c(3);
|
|
1025
1013
|
const { pageId } = t0;
|
|
1026
|
-
const { page, metaTitle
|
|
1014
|
+
const { page, metaTitle } = usePageMetadataData(pageId);
|
|
1027
1015
|
let t1;
|
|
1028
|
-
if ($[0] !== metaTitle || $[1] !== page
|
|
1016
|
+
if ($[0] !== metaTitle || $[1] !== page) {
|
|
1029
1017
|
t1 = page ? /* @__PURE__ */ jsx(PageSeoEditor, {
|
|
1030
1018
|
page,
|
|
1031
|
-
metaTitle
|
|
1032
|
-
layoutId: pageLayoutRecord?.layoutId,
|
|
1033
|
-
projectName: project?.name
|
|
1019
|
+
metaTitle
|
|
1034
1020
|
}) : /* @__PURE__ */ jsxs("div", {
|
|
1035
1021
|
className: "text-muted-foreground flex items-center gap-2 py-6 text-sm",
|
|
1036
1022
|
children: [/* @__PURE__ */ jsx(Spinner, { className: "size-3.5" }), " Loading..."]
|
|
1037
1023
|
});
|
|
1038
1024
|
$[0] = metaTitle;
|
|
1039
1025
|
$[1] = page;
|
|
1040
|
-
$[2] =
|
|
1041
|
-
|
|
1042
|
-
$[4] = t1;
|
|
1043
|
-
} else t1 = $[4];
|
|
1026
|
+
$[2] = t1;
|
|
1027
|
+
} else t1 = $[2];
|
|
1044
1028
|
return t1;
|
|
1045
1029
|
};
|
|
1046
1030
|
const PageSeoEditor = (t0) => {
|
|
1047
|
-
const $ = c(
|
|
1048
|
-
const { page, metaTitle
|
|
1031
|
+
const $ = c(38);
|
|
1032
|
+
const { page, metaTitle } = t0;
|
|
1049
1033
|
let t1;
|
|
1050
1034
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1051
1035
|
t1 = pageMutations.setSeo();
|
|
@@ -1158,23 +1142,19 @@ const PageSeoEditor = (t0) => {
|
|
|
1158
1142
|
} else t13 = $[27];
|
|
1159
1143
|
const t14 = page.metaDescription ?? "";
|
|
1160
1144
|
let t15;
|
|
1161
|
-
if ($[28] !==
|
|
1145
|
+
if ($[28] !== metaTitle || $[29] !== page || $[30] !== t14) {
|
|
1162
1146
|
t15 = /* @__PURE__ */ jsx(SocialPreviewSection, {
|
|
1163
1147
|
page,
|
|
1164
1148
|
metaTitle,
|
|
1165
|
-
metaDescription: t14
|
|
1166
|
-
layoutId,
|
|
1167
|
-
projectName
|
|
1149
|
+
metaDescription: t14
|
|
1168
1150
|
});
|
|
1169
|
-
$[28] =
|
|
1170
|
-
$[29] =
|
|
1171
|
-
$[30] =
|
|
1172
|
-
$[31] =
|
|
1173
|
-
|
|
1174
|
-
$[33] = t15;
|
|
1175
|
-
} else t15 = $[33];
|
|
1151
|
+
$[28] = metaTitle;
|
|
1152
|
+
$[29] = page;
|
|
1153
|
+
$[30] = t14;
|
|
1154
|
+
$[31] = t15;
|
|
1155
|
+
} else t15 = $[31];
|
|
1176
1156
|
let t16;
|
|
1177
|
-
if ($[
|
|
1157
|
+
if ($[32] !== t11 || $[33] !== t13 || $[34] !== t15 || $[35] !== t5 || $[36] !== t8) {
|
|
1178
1158
|
t16 = /* @__PURE__ */ jsxs("div", {
|
|
1179
1159
|
className: "space-y-4",
|
|
1180
1160
|
children: [
|
|
@@ -1185,13 +1165,13 @@ const PageSeoEditor = (t0) => {
|
|
|
1185
1165
|
t15
|
|
1186
1166
|
]
|
|
1187
1167
|
});
|
|
1188
|
-
$[
|
|
1189
|
-
$[
|
|
1190
|
-
$[
|
|
1191
|
-
$[
|
|
1192
|
-
$[
|
|
1193
|
-
$[
|
|
1194
|
-
} else t16 = $[
|
|
1168
|
+
$[32] = t11;
|
|
1169
|
+
$[33] = t13;
|
|
1170
|
+
$[34] = t15;
|
|
1171
|
+
$[35] = t5;
|
|
1172
|
+
$[36] = t8;
|
|
1173
|
+
$[37] = t16;
|
|
1174
|
+
} else t16 = $[37];
|
|
1195
1175
|
return t16;
|
|
1196
1176
|
};
|
|
1197
1177
|
const PageMarkdownSheet = (t0) => {
|
|
@@ -1360,144 +1340,144 @@ const SearchEnginePreview = (t0) => {
|
|
|
1360
1340
|
return t11;
|
|
1361
1341
|
};
|
|
1362
1342
|
const SocialPreviewSection = (t0) => {
|
|
1363
|
-
const $ = c(
|
|
1364
|
-
const { page, metaTitle, metaDescription
|
|
1343
|
+
const $ = c(70);
|
|
1344
|
+
const { page, metaTitle, metaDescription } = t0;
|
|
1365
1345
|
const studioCache = useStudioCache();
|
|
1366
|
-
const pageMetaTitle = page.metaTitle ?? page.pathSegment;
|
|
1367
|
-
let t1;
|
|
1368
|
-
if ($[0] !== layoutId || $[1] !== page.metaDescription || $[2] !== pageMetaTitle || $[3] !== projectName) {
|
|
1369
|
-
let t2;
|
|
1370
|
-
if ($[5] !== layoutId) {
|
|
1371
|
-
t2 = layoutId && { layoutId };
|
|
1372
|
-
$[5] = layoutId;
|
|
1373
|
-
$[6] = t2;
|
|
1374
|
-
} else t2 = $[6];
|
|
1375
|
-
let t3;
|
|
1376
|
-
if ($[7] !== page.metaDescription) {
|
|
1377
|
-
t3 = page.metaDescription && { description: page.metaDescription };
|
|
1378
|
-
$[7] = page.metaDescription;
|
|
1379
|
-
$[8] = t3;
|
|
1380
|
-
} else t3 = $[8];
|
|
1381
|
-
let t4;
|
|
1382
|
-
if ($[9] !== projectName) {
|
|
1383
|
-
t4 = projectName && { projectName };
|
|
1384
|
-
$[9] = projectName;
|
|
1385
|
-
$[10] = t4;
|
|
1386
|
-
} else t4 = $[10];
|
|
1387
|
-
t1 = new URLSearchParams({
|
|
1388
|
-
...t2,
|
|
1389
|
-
title: pageMetaTitle,
|
|
1390
|
-
...t3,
|
|
1391
|
-
...t4
|
|
1392
|
-
}).toString();
|
|
1393
|
-
$[0] = layoutId;
|
|
1394
|
-
$[1] = page.metaDescription;
|
|
1395
|
-
$[2] = pageMetaTitle;
|
|
1396
|
-
$[3] = projectName;
|
|
1397
|
-
$[4] = t1;
|
|
1398
|
-
} else t1 = $[4];
|
|
1399
|
-
const generatedOgImage = `/og?${t1}`;
|
|
1400
|
-
const ogImage = page.customOgImageUrl ?? generatedOgImage;
|
|
1401
1346
|
const localized = useLocalizedPath();
|
|
1402
|
-
const
|
|
1347
|
+
const { scope } = useOptionalDraftScope();
|
|
1348
|
+
let t1;
|
|
1403
1349
|
let t2;
|
|
1404
|
-
if ($[
|
|
1405
|
-
|
|
1406
|
-
$[
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1350
|
+
if ($[0] !== localized || $[1] !== page.fullPath || $[2] !== page.metaDescription || $[3] !== page.metaTitle) {
|
|
1351
|
+
const version = new URLSearchParams({ v: `${page.metaTitle ?? ""}|${page.metaDescription ?? ""}` });
|
|
1352
|
+
if ($[6] !== localized || $[7] !== page.fullPath) {
|
|
1353
|
+
t1 = pageImageUrl({
|
|
1354
|
+
origin: "",
|
|
1355
|
+
path: localized(page.fullPath)
|
|
1356
|
+
});
|
|
1357
|
+
$[6] = localized;
|
|
1358
|
+
$[7] = page.fullPath;
|
|
1359
|
+
$[8] = t1;
|
|
1360
|
+
} else t1 = $[8];
|
|
1361
|
+
t2 = version.toString();
|
|
1362
|
+
$[0] = localized;
|
|
1363
|
+
$[1] = page.fullPath;
|
|
1364
|
+
$[2] = page.metaDescription;
|
|
1365
|
+
$[3] = page.metaTitle;
|
|
1366
|
+
$[4] = t1;
|
|
1367
|
+
$[5] = t2;
|
|
1368
|
+
} else {
|
|
1369
|
+
t1 = $[4];
|
|
1370
|
+
t2 = $[5];
|
|
1371
|
+
}
|
|
1372
|
+
const generatedOgImage = `${t1}&${t2}`;
|
|
1412
1373
|
let t3;
|
|
1413
|
-
if ($[
|
|
1414
|
-
t3 =
|
|
1415
|
-
$[
|
|
1416
|
-
|
|
1374
|
+
if ($[9] !== generatedOgImage || $[10] !== page.customOgImageUrl || $[11] !== scope) {
|
|
1375
|
+
t3 = page.customOgImageUrl || (scope?.hrefFor(generatedOgImage) ?? generatedOgImage);
|
|
1376
|
+
$[9] = generatedOgImage;
|
|
1377
|
+
$[10] = page.customOgImageUrl;
|
|
1378
|
+
$[11] = scope;
|
|
1379
|
+
$[12] = t3;
|
|
1380
|
+
} else t3 = $[12];
|
|
1381
|
+
const ogImage = t3;
|
|
1382
|
+
const origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
1417
1383
|
let t4;
|
|
1418
|
-
if ($[
|
|
1419
|
-
t4 =
|
|
1420
|
-
|
|
1384
|
+
if ($[13] !== localized || $[14] !== page.fullPath) {
|
|
1385
|
+
t4 = localized(page.fullPath);
|
|
1386
|
+
$[13] = localized;
|
|
1387
|
+
$[14] = page.fullPath;
|
|
1388
|
+
$[15] = t4;
|
|
1389
|
+
} else t4 = $[15];
|
|
1390
|
+
const url = `${origin}${t4}`;
|
|
1391
|
+
const fileInputRef = React.useRef(null);
|
|
1392
|
+
let t5;
|
|
1393
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1394
|
+
t5 = pageMutations.uploadCustomOgImage();
|
|
1395
|
+
$[16] = t5;
|
|
1396
|
+
} else t5 = $[16];
|
|
1397
|
+
let t6;
|
|
1398
|
+
if ($[17] !== page.id || $[18] !== studioCache) {
|
|
1399
|
+
t6 = {
|
|
1400
|
+
...t5,
|
|
1421
1401
|
onSuccess: () => {
|
|
1422
1402
|
studioCache.invalidate(reads.page({ id: page.id }));
|
|
1423
1403
|
},
|
|
1424
1404
|
onError: _temp7
|
|
1425
1405
|
};
|
|
1426
|
-
$[
|
|
1427
|
-
$[
|
|
1428
|
-
$[
|
|
1429
|
-
} else
|
|
1430
|
-
const uploadCustomOgImage = useMutation(
|
|
1431
|
-
let
|
|
1432
|
-
if ($[
|
|
1433
|
-
|
|
1434
|
-
$[
|
|
1435
|
-
} else
|
|
1436
|
-
let
|
|
1437
|
-
if ($[
|
|
1438
|
-
|
|
1439
|
-
...
|
|
1406
|
+
$[17] = page.id;
|
|
1407
|
+
$[18] = studioCache;
|
|
1408
|
+
$[19] = t6;
|
|
1409
|
+
} else t6 = $[19];
|
|
1410
|
+
const uploadCustomOgImage = useMutation(t6);
|
|
1411
|
+
let t7;
|
|
1412
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1413
|
+
t7 = pageMutations.deleteCustomOgImage();
|
|
1414
|
+
$[20] = t7;
|
|
1415
|
+
} else t7 = $[20];
|
|
1416
|
+
let t8;
|
|
1417
|
+
if ($[21] !== page.id || $[22] !== studioCache) {
|
|
1418
|
+
t8 = {
|
|
1419
|
+
...t7,
|
|
1440
1420
|
onSuccess: () => {
|
|
1441
1421
|
studioCache.invalidate(reads.page({ id: page.id }));
|
|
1442
1422
|
},
|
|
1443
1423
|
onError: _temp8
|
|
1444
1424
|
};
|
|
1445
|
-
$[
|
|
1446
|
-
$[
|
|
1447
|
-
$[
|
|
1448
|
-
} else
|
|
1449
|
-
const deleteCustomOgImage = useMutation(
|
|
1425
|
+
$[21] = page.id;
|
|
1426
|
+
$[22] = studioCache;
|
|
1427
|
+
$[23] = t8;
|
|
1428
|
+
} else t8 = $[23];
|
|
1429
|
+
const deleteCustomOgImage = useMutation(t8);
|
|
1450
1430
|
const hasCustomImage = !!page.customOgImageUrl;
|
|
1451
1431
|
const isBusy = uploadCustomOgImage.isPending || deleteCustomOgImage.isPending;
|
|
1452
|
-
let
|
|
1453
|
-
if ($[
|
|
1454
|
-
|
|
1432
|
+
let t9;
|
|
1433
|
+
if ($[24] !== page.id || $[25] !== uploadCustomOgImage) {
|
|
1434
|
+
t9 = (files) => {
|
|
1455
1435
|
const file = files[0];
|
|
1456
1436
|
if (file) uploadCustomOgImage.mutate({
|
|
1457
1437
|
pageId: page.id,
|
|
1458
1438
|
file
|
|
1459
1439
|
});
|
|
1460
1440
|
};
|
|
1461
|
-
$[
|
|
1462
|
-
$[
|
|
1463
|
-
$[24] = t7;
|
|
1464
|
-
} else t7 = $[24];
|
|
1465
|
-
const handleFiles = t7;
|
|
1466
|
-
let t8;
|
|
1467
|
-
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1468
|
-
t8 = /* @__PURE__ */ jsx(Label, { children: "Social preview" });
|
|
1469
|
-
$[25] = t8;
|
|
1470
|
-
} else t8 = $[25];
|
|
1471
|
-
let t9;
|
|
1472
|
-
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1473
|
-
t9 = () => fileInputRef.current?.click();
|
|
1441
|
+
$[24] = page.id;
|
|
1442
|
+
$[25] = uploadCustomOgImage;
|
|
1474
1443
|
$[26] = t9;
|
|
1475
1444
|
} else t9 = $[26];
|
|
1445
|
+
const handleFiles = t9;
|
|
1476
1446
|
let t10;
|
|
1477
|
-
if ($[27]
|
|
1478
|
-
t10 =
|
|
1479
|
-
$[27] =
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1447
|
+
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1448
|
+
t10 = /* @__PURE__ */ jsx(Label, { children: "Social preview" });
|
|
1449
|
+
$[27] = t10;
|
|
1450
|
+
} else t10 = $[27];
|
|
1451
|
+
let t11;
|
|
1452
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1453
|
+
t11 = () => fileInputRef.current?.click();
|
|
1454
|
+
$[28] = t11;
|
|
1455
|
+
} else t11 = $[28];
|
|
1483
1456
|
let t12;
|
|
1484
|
-
if ($[29] !==
|
|
1485
|
-
t12 = /* @__PURE__ */
|
|
1457
|
+
if ($[29] !== uploadCustomOgImage.isPending) {
|
|
1458
|
+
t12 = uploadCustomOgImage.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : /* @__PURE__ */ jsx(Upload, { className: "size-3.5" });
|
|
1459
|
+
$[29] = uploadCustomOgImage.isPending;
|
|
1460
|
+
$[30] = t12;
|
|
1461
|
+
} else t12 = $[30];
|
|
1462
|
+
const t13 = hasCustomImage ? "Replace custom image" : "Upload custom image";
|
|
1463
|
+
let t14;
|
|
1464
|
+
if ($[31] !== isBusy || $[32] !== t12 || $[33] !== t13) {
|
|
1465
|
+
t14 = /* @__PURE__ */ jsxs(Button, {
|
|
1486
1466
|
type: "button",
|
|
1487
1467
|
variant: "secondary",
|
|
1488
1468
|
size: "sm",
|
|
1489
1469
|
disabled: isBusy,
|
|
1490
|
-
onClick:
|
|
1491
|
-
children: [
|
|
1470
|
+
onClick: t11,
|
|
1471
|
+
children: [t12, t13]
|
|
1492
1472
|
});
|
|
1493
|
-
$[
|
|
1494
|
-
$[30] = t10;
|
|
1495
|
-
$[31] = t11;
|
|
1473
|
+
$[31] = isBusy;
|
|
1496
1474
|
$[32] = t12;
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1475
|
+
$[33] = t13;
|
|
1476
|
+
$[34] = t14;
|
|
1477
|
+
} else t14 = $[34];
|
|
1478
|
+
let t15;
|
|
1479
|
+
if ($[35] !== deleteCustomOgImage || $[36] !== hasCustomImage || $[37] !== isBusy || $[38] !== page.id) {
|
|
1480
|
+
t15 = hasCustomImage && /* @__PURE__ */ jsxs(Button, {
|
|
1501
1481
|
type: "button",
|
|
1502
1482
|
variant: "ghost",
|
|
1503
1483
|
disabled: isBusy,
|
|
@@ -1509,15 +1489,15 @@ const SocialPreviewSection = (t0) => {
|
|
|
1509
1489
|
"Clear"
|
|
1510
1490
|
]
|
|
1511
1491
|
});
|
|
1512
|
-
$[
|
|
1513
|
-
$[
|
|
1514
|
-
$[
|
|
1515
|
-
$[
|
|
1516
|
-
$[
|
|
1517
|
-
} else
|
|
1518
|
-
let
|
|
1519
|
-
if ($[
|
|
1520
|
-
|
|
1492
|
+
$[35] = deleteCustomOgImage;
|
|
1493
|
+
$[36] = hasCustomImage;
|
|
1494
|
+
$[37] = isBusy;
|
|
1495
|
+
$[38] = page.id;
|
|
1496
|
+
$[39] = t15;
|
|
1497
|
+
} else t15 = $[39];
|
|
1498
|
+
let t16;
|
|
1499
|
+
if ($[40] !== handleFiles) {
|
|
1500
|
+
t16 = /* @__PURE__ */ jsx("input", {
|
|
1521
1501
|
type: "file",
|
|
1522
1502
|
ref: fileInputRef,
|
|
1523
1503
|
className: "hidden",
|
|
@@ -1527,134 +1507,134 @@ const SocialPreviewSection = (t0) => {
|
|
|
1527
1507
|
e.target.value = "";
|
|
1528
1508
|
}
|
|
1529
1509
|
});
|
|
1530
|
-
$[
|
|
1531
|
-
$[
|
|
1532
|
-
} else
|
|
1533
|
-
let
|
|
1534
|
-
if ($[
|
|
1535
|
-
|
|
1510
|
+
$[40] = handleFiles;
|
|
1511
|
+
$[41] = t16;
|
|
1512
|
+
} else t16 = $[41];
|
|
1513
|
+
let t17;
|
|
1514
|
+
if ($[42] !== t14 || $[43] !== t15 || $[44] !== t16) {
|
|
1515
|
+
t17 = /* @__PURE__ */ jsxs("div", {
|
|
1536
1516
|
className: "flex items-center gap-2",
|
|
1537
1517
|
children: [
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1518
|
+
t14,
|
|
1519
|
+
t15,
|
|
1520
|
+
t16
|
|
1541
1521
|
]
|
|
1542
1522
|
});
|
|
1543
|
-
$[40] = t12;
|
|
1544
|
-
$[41] = t13;
|
|
1545
1523
|
$[42] = t14;
|
|
1546
1524
|
$[43] = t15;
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1525
|
+
$[44] = t16;
|
|
1526
|
+
$[45] = t17;
|
|
1527
|
+
} else t17 = $[45];
|
|
1528
|
+
const t18 = hasCustomImage ? "Drop image to replace" : "Drop image to upload";
|
|
1529
|
+
let t19;
|
|
1530
|
+
if ($[46] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1531
|
+
t19 = { aspectRatio: "1200 / 630" };
|
|
1532
|
+
$[46] = t19;
|
|
1533
|
+
} else t19 = $[46];
|
|
1534
|
+
let t20;
|
|
1535
|
+
if ($[47] !== ogImage) {
|
|
1536
|
+
t20 = /* @__PURE__ */ jsx("img", {
|
|
1557
1537
|
src: ogImage,
|
|
1558
1538
|
alt: "",
|
|
1559
1539
|
className: "w-full object-cover",
|
|
1560
|
-
style:
|
|
1540
|
+
style: t19
|
|
1561
1541
|
});
|
|
1562
|
-
$[
|
|
1563
|
-
$[
|
|
1564
|
-
} else
|
|
1565
|
-
let
|
|
1566
|
-
if ($[
|
|
1567
|
-
|
|
1542
|
+
$[47] = ogImage;
|
|
1543
|
+
$[48] = t20;
|
|
1544
|
+
} else t20 = $[48];
|
|
1545
|
+
let t21;
|
|
1546
|
+
if ($[49] !== handleFiles || $[50] !== t18 || $[51] !== t20) {
|
|
1547
|
+
t21 = /* @__PURE__ */ jsx(UploadDropZone, {
|
|
1568
1548
|
onDrop: handleFiles,
|
|
1569
|
-
label:
|
|
1549
|
+
label: t18,
|
|
1570
1550
|
className: "block",
|
|
1571
|
-
children: t18
|
|
1572
|
-
});
|
|
1573
|
-
$[47] = handleFiles;
|
|
1574
|
-
$[48] = t16;
|
|
1575
|
-
$[49] = t18;
|
|
1576
|
-
$[50] = t19;
|
|
1577
|
-
} else t19 = $[50];
|
|
1578
|
-
const t20 = metaTitle || "Untitled";
|
|
1579
|
-
let t21;
|
|
1580
|
-
if ($[51] !== t20) {
|
|
1581
|
-
t21 = /* @__PURE__ */ jsx("p", {
|
|
1582
|
-
className: "text-foreground truncate text-sm font-semibold",
|
|
1583
1551
|
children: t20
|
|
1584
1552
|
});
|
|
1553
|
+
$[49] = handleFiles;
|
|
1554
|
+
$[50] = t18;
|
|
1585
1555
|
$[51] = t20;
|
|
1586
1556
|
$[52] = t21;
|
|
1587
1557
|
} else t21 = $[52];
|
|
1588
|
-
const t22 =
|
|
1558
|
+
const t22 = metaTitle || "Untitled";
|
|
1589
1559
|
let t23;
|
|
1590
1560
|
if ($[53] !== t22) {
|
|
1591
1561
|
t23 = /* @__PURE__ */ jsx("p", {
|
|
1592
|
-
className: "text-
|
|
1562
|
+
className: "text-foreground truncate text-sm font-semibold",
|
|
1593
1563
|
children: t22
|
|
1594
1564
|
});
|
|
1595
1565
|
$[53] = t22;
|
|
1596
1566
|
$[54] = t23;
|
|
1597
1567
|
} else t23 = $[54];
|
|
1598
|
-
|
|
1599
|
-
if ($[55] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1600
|
-
t24 = /* @__PURE__ */ jsx(Globe, { className: "size-3 shrink-0" });
|
|
1601
|
-
$[55] = t24;
|
|
1602
|
-
} else t24 = $[55];
|
|
1568
|
+
const t24 = metaDescription || "No description";
|
|
1603
1569
|
let t25;
|
|
1604
|
-
if ($[
|
|
1605
|
-
t25 = /* @__PURE__ */ jsx("
|
|
1570
|
+
if ($[55] !== t24) {
|
|
1571
|
+
t25 = /* @__PURE__ */ jsx("p", {
|
|
1572
|
+
className: "text-muted-foreground line-clamp-2 text-xs",
|
|
1573
|
+
children: t24
|
|
1574
|
+
});
|
|
1575
|
+
$[55] = t24;
|
|
1576
|
+
$[56] = t25;
|
|
1577
|
+
} else t25 = $[56];
|
|
1578
|
+
let t26;
|
|
1579
|
+
if ($[57] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1580
|
+
t26 = /* @__PURE__ */ jsx(Globe, { className: "size-3 shrink-0" });
|
|
1581
|
+
$[57] = t26;
|
|
1582
|
+
} else t26 = $[57];
|
|
1583
|
+
let t27;
|
|
1584
|
+
if ($[58] !== url) {
|
|
1585
|
+
t27 = /* @__PURE__ */ jsx("div", {
|
|
1606
1586
|
className: "pt-1.5",
|
|
1607
1587
|
children: /* @__PURE__ */ jsxs("p", {
|
|
1608
1588
|
className: "text-muted-foreground flex items-center gap-1 text-xs",
|
|
1609
|
-
children: [
|
|
1589
|
+
children: [t26, /* @__PURE__ */ jsx("span", {
|
|
1610
1590
|
className: "truncate",
|
|
1611
1591
|
children: url
|
|
1612
1592
|
})]
|
|
1613
1593
|
})
|
|
1614
1594
|
});
|
|
1615
|
-
$[
|
|
1616
|
-
$[
|
|
1617
|
-
} else
|
|
1618
|
-
let
|
|
1619
|
-
if ($[
|
|
1620
|
-
|
|
1595
|
+
$[58] = url;
|
|
1596
|
+
$[59] = t27;
|
|
1597
|
+
} else t27 = $[59];
|
|
1598
|
+
let t28;
|
|
1599
|
+
if ($[60] !== t23 || $[61] !== t25 || $[62] !== t27) {
|
|
1600
|
+
t28 = /* @__PURE__ */ jsxs("div", {
|
|
1621
1601
|
className: "space-y-1.5 border-t px-3 py-2.5",
|
|
1622
1602
|
children: [
|
|
1623
|
-
t21,
|
|
1624
1603
|
t23,
|
|
1625
|
-
t25
|
|
1604
|
+
t25,
|
|
1605
|
+
t27
|
|
1626
1606
|
]
|
|
1627
1607
|
});
|
|
1628
|
-
$[
|
|
1629
|
-
$[
|
|
1630
|
-
$[
|
|
1631
|
-
$[
|
|
1632
|
-
} else
|
|
1633
|
-
let
|
|
1634
|
-
if ($[
|
|
1635
|
-
|
|
1608
|
+
$[60] = t23;
|
|
1609
|
+
$[61] = t25;
|
|
1610
|
+
$[62] = t27;
|
|
1611
|
+
$[63] = t28;
|
|
1612
|
+
} else t28 = $[63];
|
|
1613
|
+
let t29;
|
|
1614
|
+
if ($[64] !== t21 || $[65] !== t28) {
|
|
1615
|
+
t29 = /* @__PURE__ */ jsxs("div", {
|
|
1636
1616
|
className: "border-border max-w-xl overflow-hidden rounded-lg border",
|
|
1637
|
-
children: [
|
|
1617
|
+
children: [t21, t28]
|
|
1638
1618
|
});
|
|
1639
|
-
$[
|
|
1640
|
-
$[
|
|
1641
|
-
$[
|
|
1642
|
-
} else
|
|
1643
|
-
let
|
|
1644
|
-
if ($[
|
|
1645
|
-
|
|
1619
|
+
$[64] = t21;
|
|
1620
|
+
$[65] = t28;
|
|
1621
|
+
$[66] = t29;
|
|
1622
|
+
} else t29 = $[66];
|
|
1623
|
+
let t30;
|
|
1624
|
+
if ($[67] !== t17 || $[68] !== t29) {
|
|
1625
|
+
t30 = /* @__PURE__ */ jsxs("div", {
|
|
1646
1626
|
className: "space-y-2 pt-2",
|
|
1647
1627
|
children: [
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1628
|
+
t10,
|
|
1629
|
+
t17,
|
|
1630
|
+
t29
|
|
1651
1631
|
]
|
|
1652
1632
|
});
|
|
1653
|
-
$[
|
|
1654
|
-
$[
|
|
1655
|
-
$[
|
|
1656
|
-
} else
|
|
1657
|
-
return
|
|
1633
|
+
$[67] = t17;
|
|
1634
|
+
$[68] = t29;
|
|
1635
|
+
$[69] = t30;
|
|
1636
|
+
} else t30 = $[69];
|
|
1637
|
+
return t30;
|
|
1658
1638
|
};
|
|
1659
1639
|
const PageMarkdownPreview = (t0) => {
|
|
1660
1640
|
const $ = c(8);
|