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
|
@@ -74,8 +74,8 @@ var PageContentSheet = () => {
|
|
|
74
74
|
const updateSettings = useMutation(blockMutations.updateSettings());
|
|
75
75
|
const updateRepeatableContent = useMutation(repeatableItemMutations.updateContent());
|
|
76
76
|
const isOpen = useSelector(previewStore, (state) => state.context.isPageContentSheetOpen);
|
|
77
|
-
const selection = useSelector(previewStore, (
|
|
78
|
-
const iframeElement = useSelector(previewStore, (
|
|
77
|
+
const selection = useSelector(previewStore, (state_0) => state_0.context.selection);
|
|
78
|
+
const iframeElement = useSelector(previewStore, (state_1) => state_1.context.iframeElement);
|
|
79
79
|
const postToIframe = React.useCallback((message) => {
|
|
80
80
|
if (!iframeElement?.contentWindow) return;
|
|
81
81
|
iframeElement.contentWindow.postMessage(message, "*");
|
|
@@ -94,9 +94,9 @@ var PageContentSheet = () => {
|
|
|
94
94
|
const fileIds = React.useMemo(() => (blockBundle?.files ?? []).map((f) => f.id), [blockBundle?.files]);
|
|
95
95
|
const fileResults = useQueries({ queries: fileIds.map((id) => fileQueries.get(id)) });
|
|
96
96
|
const filesMap = React.useMemo(() => {
|
|
97
|
-
const map = new Map((blockBundle?.files ?? []).map((
|
|
98
|
-
for (let
|
|
99
|
-
const data = fileResults[
|
|
97
|
+
const map = new Map((blockBundle?.files ?? []).map((f_0) => [f_0.id, f_0]));
|
|
98
|
+
for (let i_0 = 0; i_0 < fileIds.length; i_0++) {
|
|
99
|
+
const data = fileResults[i_0]?.data;
|
|
100
100
|
if (data) map.set(data.id, data);
|
|
101
101
|
}
|
|
102
102
|
return map;
|
|
@@ -147,9 +147,9 @@ var PageContentSheet = () => {
|
|
|
147
147
|
}
|
|
148
148
|
return value;
|
|
149
149
|
};
|
|
150
|
-
const
|
|
151
|
-
for (const [key,
|
|
152
|
-
return
|
|
150
|
+
const resolved_0 = {};
|
|
151
|
+
for (const [key, value_0] of Object.entries(rawCurrentData)) resolved_0[key] = resolveValue(value_0);
|
|
152
|
+
return resolved_0;
|
|
153
153
|
}, [rawCurrentData, filesMap]);
|
|
154
154
|
const isViewingLink = fieldInfo?.fieldType === "Link";
|
|
155
155
|
const linkFieldName = isViewingLink ? fieldInfo.fieldName : null;
|
|
@@ -214,18 +214,18 @@ var PageContentSheet = () => {
|
|
|
214
214
|
id: action.id
|
|
215
215
|
});
|
|
216
216
|
}, [blockId, isOpen]);
|
|
217
|
-
const handleBlockFieldChange = React.useCallback((fieldName,
|
|
217
|
+
const handleBlockFieldChange = React.useCallback((fieldName, value_1) => {
|
|
218
218
|
if (!block) return;
|
|
219
219
|
updateContent.mutate({
|
|
220
220
|
id: block.id,
|
|
221
|
-
content: { [fieldName]:
|
|
221
|
+
content: { [fieldName]: value_1 }
|
|
222
222
|
});
|
|
223
223
|
}, [block, updateContent]);
|
|
224
|
-
const handleItemFieldChange = React.useCallback((
|
|
224
|
+
const handleItemFieldChange = React.useCallback((fieldName_0, value_2) => {
|
|
225
225
|
if (!currentItemId) return;
|
|
226
226
|
updateRepeatableContent.mutate({
|
|
227
227
|
id: Number(currentItemId),
|
|
228
|
-
content: { [
|
|
228
|
+
content: { [fieldName_0]: value_2 }
|
|
229
229
|
});
|
|
230
230
|
}, [currentItemId, updateRepeatableContent]);
|
|
231
231
|
const activeFieldChangeHandler = currentItemId ? handleItemFieldChange : handleBlockFieldChange;
|
|
@@ -343,8 +343,8 @@ var PageContentSheet = () => {
|
|
|
343
343
|
href: "",
|
|
344
344
|
newTab: false
|
|
345
345
|
},
|
|
346
|
-
onSave: (
|
|
347
|
-
activeFieldChangeHandler(
|
|
346
|
+
onSave: (fieldName_1, value_3) => {
|
|
347
|
+
activeFieldChangeHandler(fieldName_1, value_3);
|
|
348
348
|
}
|
|
349
349
|
})
|
|
350
350
|
}),
|
|
@@ -367,14 +367,14 @@ var PageContentSheet = () => {
|
|
|
367
367
|
const label = field.label ?? formatFieldName(field.name);
|
|
368
368
|
const settingsValues = block.settings ?? {};
|
|
369
369
|
if (field.fieldType === "Enum") {
|
|
370
|
-
const
|
|
370
|
+
const value_4 = settingsValues[field.name] ?? (blockDef.settingsSchema?.properties?.[field.name])?.default ?? "";
|
|
371
371
|
return /* @__PURE__ */ jsxs("div", {
|
|
372
372
|
className: "space-y-2",
|
|
373
373
|
children: [/* @__PURE__ */ jsx(Label, {
|
|
374
374
|
htmlFor: `setting-${field.name}`,
|
|
375
375
|
children: label
|
|
376
376
|
}), /* @__PURE__ */ jsxs(Select, {
|
|
377
|
-
value,
|
|
377
|
+
value: value_4,
|
|
378
378
|
onValueChange: (newValue) => {
|
|
379
379
|
updateSettings.mutate({
|
|
380
380
|
id: block.id,
|
|
@@ -401,10 +401,10 @@ var PageContentSheet = () => {
|
|
|
401
401
|
}), /* @__PURE__ */ jsx(Switch, {
|
|
402
402
|
id: `setting-${field.name}`,
|
|
403
403
|
checked,
|
|
404
|
-
onCheckedChange: (
|
|
404
|
+
onCheckedChange: (newValue_0) => {
|
|
405
405
|
updateSettings.mutate({
|
|
406
406
|
id: block.id,
|
|
407
|
-
settings: { [field.name]:
|
|
407
|
+
settings: { [field.name]: newValue_0 }
|
|
408
408
|
});
|
|
409
409
|
}
|
|
410
410
|
})]
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { formatPathSegment } from "../../../lib/utils.js";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
2
3
|
import { Input } from "@camox/ui/input";
|
|
3
4
|
import { Label } from "@camox/ui/label";
|
|
4
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -7,71 +8,236 @@ import * as ControlGroup from "@camox/ui/control-group";
|
|
|
7
8
|
import { InputBase, InputBaseAdornment } from "@camox/ui/input-base";
|
|
8
9
|
//#region src/features/preview/components/PageLocationFieldset.tsx
|
|
9
10
|
var NO_PARENT_VALUE = "__no_parent__";
|
|
10
|
-
var PageLocationFieldset = (
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
var PageLocationFieldset = (t0) => {
|
|
12
|
+
const $ = c(60);
|
|
13
|
+
const { parentPageId, onParentPageIdChange, pathSegment, onPathSegmentChange, disabled, pages, excludePageId } = t0;
|
|
14
|
+
let t1;
|
|
15
|
+
if ($[0] !== pages || $[1] !== parentPageId) {
|
|
16
|
+
t1 = () => {
|
|
17
|
+
if (!pages || !parentPageId) return "/";
|
|
18
|
+
const page = pages.find((p) => p.id === parentPageId);
|
|
19
|
+
return page ? page.fullPath + "/" : "/";
|
|
20
|
+
};
|
|
21
|
+
$[0] = pages;
|
|
22
|
+
$[1] = parentPageId;
|
|
23
|
+
$[2] = t1;
|
|
24
|
+
} else t1 = $[2];
|
|
25
|
+
const getParentPath = t1;
|
|
26
|
+
let T0;
|
|
27
|
+
let T1;
|
|
28
|
+
let t10;
|
|
29
|
+
let t2;
|
|
30
|
+
let t3;
|
|
31
|
+
let t4;
|
|
32
|
+
let t5;
|
|
33
|
+
let t6;
|
|
34
|
+
let t7;
|
|
35
|
+
let t8;
|
|
36
|
+
let t9;
|
|
37
|
+
if ($[3] !== disabled || $[4] !== excludePageId || $[5] !== onParentPageIdChange || $[6] !== pages || $[7] !== parentPageId) {
|
|
38
|
+
const nonRootPages = pages?.filter((page_0) => page_0.id !== excludePageId && page_0.fullPath !== "/");
|
|
39
|
+
const hasParentOptions = nonRootPages && nonRootPages.length > 0;
|
|
40
|
+
t9 = "space-y-2";
|
|
41
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
42
|
+
t10 = /* @__PURE__ */ jsxs(Label, { children: ["Parent page ", /* @__PURE__ */ jsx("span", {
|
|
22
43
|
className: "text-muted-foreground",
|
|
23
44
|
children: "(optional)"
|
|
24
|
-
})] })
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
]
|
|
74
|
-
|
|
45
|
+
})] });
|
|
46
|
+
$[19] = t10;
|
|
47
|
+
} else t10 = $[19];
|
|
48
|
+
T1 = Select;
|
|
49
|
+
t5 = parentPageId != null ? String(parentPageId) : "";
|
|
50
|
+
t6 = disabled || !hasParentOptions;
|
|
51
|
+
if ($[20] !== onParentPageIdChange) {
|
|
52
|
+
t7 = (value) => onParentPageIdChange(["", NO_PARENT_VALUE].includes(value) ? void 0 : Number(value));
|
|
53
|
+
$[20] = onParentPageIdChange;
|
|
54
|
+
$[21] = t7;
|
|
55
|
+
} else t7 = $[21];
|
|
56
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
57
|
+
t8 = /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "No parent" }) });
|
|
58
|
+
$[22] = t8;
|
|
59
|
+
} else t8 = $[22];
|
|
60
|
+
T0 = SelectContent;
|
|
61
|
+
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
62
|
+
t2 = /* @__PURE__ */ jsx(SelectItem, {
|
|
63
|
+
value: NO_PARENT_VALUE,
|
|
64
|
+
children: "No parent"
|
|
65
|
+
});
|
|
66
|
+
t3 = /* @__PURE__ */ jsx(SelectSeparator, {});
|
|
67
|
+
$[23] = t2;
|
|
68
|
+
$[24] = t3;
|
|
69
|
+
} else {
|
|
70
|
+
t2 = $[23];
|
|
71
|
+
t3 = $[24];
|
|
72
|
+
}
|
|
73
|
+
t4 = nonRootPages?.map(_temp);
|
|
74
|
+
$[3] = disabled;
|
|
75
|
+
$[4] = excludePageId;
|
|
76
|
+
$[5] = onParentPageIdChange;
|
|
77
|
+
$[6] = pages;
|
|
78
|
+
$[7] = parentPageId;
|
|
79
|
+
$[8] = T0;
|
|
80
|
+
$[9] = T1;
|
|
81
|
+
$[10] = t10;
|
|
82
|
+
$[11] = t2;
|
|
83
|
+
$[12] = t3;
|
|
84
|
+
$[13] = t4;
|
|
85
|
+
$[14] = t5;
|
|
86
|
+
$[15] = t6;
|
|
87
|
+
$[16] = t7;
|
|
88
|
+
$[17] = t8;
|
|
89
|
+
$[18] = t9;
|
|
90
|
+
} else {
|
|
91
|
+
T0 = $[8];
|
|
92
|
+
T1 = $[9];
|
|
93
|
+
t10 = $[10];
|
|
94
|
+
t2 = $[11];
|
|
95
|
+
t3 = $[12];
|
|
96
|
+
t4 = $[13];
|
|
97
|
+
t5 = $[14];
|
|
98
|
+
t6 = $[15];
|
|
99
|
+
t7 = $[16];
|
|
100
|
+
t8 = $[17];
|
|
101
|
+
t9 = $[18];
|
|
102
|
+
}
|
|
103
|
+
let t11;
|
|
104
|
+
if ($[25] !== T0 || $[26] !== t2 || $[27] !== t3 || $[28] !== t4) {
|
|
105
|
+
t11 = /* @__PURE__ */ jsxs(T0, { children: [
|
|
106
|
+
t2,
|
|
107
|
+
t3,
|
|
108
|
+
t4
|
|
109
|
+
] });
|
|
110
|
+
$[25] = T0;
|
|
111
|
+
$[26] = t2;
|
|
112
|
+
$[27] = t3;
|
|
113
|
+
$[28] = t4;
|
|
114
|
+
$[29] = t11;
|
|
115
|
+
} else t11 = $[29];
|
|
116
|
+
let t12;
|
|
117
|
+
if ($[30] !== T1 || $[31] !== t11 || $[32] !== t5 || $[33] !== t6 || $[34] !== t7 || $[35] !== t8) {
|
|
118
|
+
t12 = /* @__PURE__ */ jsxs(T1, {
|
|
119
|
+
value: t5,
|
|
120
|
+
disabled: t6,
|
|
121
|
+
onValueChange: t7,
|
|
122
|
+
children: [t8, t11]
|
|
123
|
+
});
|
|
124
|
+
$[30] = T1;
|
|
125
|
+
$[31] = t11;
|
|
126
|
+
$[32] = t5;
|
|
127
|
+
$[33] = t6;
|
|
128
|
+
$[34] = t7;
|
|
129
|
+
$[35] = t8;
|
|
130
|
+
$[36] = t12;
|
|
131
|
+
} else t12 = $[36];
|
|
132
|
+
let t13;
|
|
133
|
+
if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
|
|
134
|
+
t13 = /* @__PURE__ */ jsx("p", {
|
|
135
|
+
className: "text-muted-foreground text-xs",
|
|
136
|
+
children: "Select a parent page to nest this page under it."
|
|
137
|
+
});
|
|
138
|
+
$[37] = t13;
|
|
139
|
+
} else t13 = $[37];
|
|
140
|
+
let t14;
|
|
141
|
+
if ($[38] !== t10 || $[39] !== t12 || $[40] !== t9) {
|
|
142
|
+
t14 = /* @__PURE__ */ jsxs("div", {
|
|
143
|
+
className: t9,
|
|
144
|
+
children: [
|
|
145
|
+
t10,
|
|
146
|
+
t12,
|
|
147
|
+
t13
|
|
148
|
+
]
|
|
149
|
+
});
|
|
150
|
+
$[38] = t10;
|
|
151
|
+
$[39] = t12;
|
|
152
|
+
$[40] = t9;
|
|
153
|
+
$[41] = t14;
|
|
154
|
+
} else t14 = $[41];
|
|
155
|
+
let t15;
|
|
156
|
+
if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
|
|
157
|
+
t15 = /* @__PURE__ */ jsx(Label, {
|
|
158
|
+
htmlFor: "pathSegment",
|
|
159
|
+
children: "Page path"
|
|
160
|
+
});
|
|
161
|
+
$[42] = t15;
|
|
162
|
+
} else t15 = $[42];
|
|
163
|
+
const t16 = getParentPath();
|
|
164
|
+
let t17;
|
|
165
|
+
if ($[43] !== t16) {
|
|
166
|
+
t17 = /* @__PURE__ */ jsx(ControlGroup.ControlGroupItem, {
|
|
167
|
+
className: "shrink-0",
|
|
168
|
+
children: /* @__PURE__ */ jsx(InputBase, { children: /* @__PURE__ */ jsx(InputBaseAdornment, { children: t16 }) })
|
|
169
|
+
});
|
|
170
|
+
$[43] = t16;
|
|
171
|
+
$[44] = t17;
|
|
172
|
+
} else t17 = $[44];
|
|
173
|
+
let t18;
|
|
174
|
+
if ($[45] !== onPathSegmentChange) {
|
|
175
|
+
t18 = (e) => onPathSegmentChange(e.target.value);
|
|
176
|
+
$[45] = onPathSegmentChange;
|
|
177
|
+
$[46] = t18;
|
|
178
|
+
} else t18 = $[46];
|
|
179
|
+
let t19;
|
|
180
|
+
if ($[47] !== disabled || $[48] !== pathSegment || $[49] !== t18) {
|
|
181
|
+
t19 = /* @__PURE__ */ jsx(ControlGroup.ControlGroupItem, { children: /* @__PURE__ */ jsx(Input, {
|
|
182
|
+
id: "pathSegment",
|
|
183
|
+
value: pathSegment,
|
|
184
|
+
disabled,
|
|
185
|
+
onChange: t18,
|
|
186
|
+
placeholder: "e.g. pricing, about-us"
|
|
187
|
+
}) });
|
|
188
|
+
$[47] = disabled;
|
|
189
|
+
$[48] = pathSegment;
|
|
190
|
+
$[49] = t18;
|
|
191
|
+
$[50] = t19;
|
|
192
|
+
} else t19 = $[50];
|
|
193
|
+
let t20;
|
|
194
|
+
if ($[51] !== t17 || $[52] !== t19) {
|
|
195
|
+
t20 = /* @__PURE__ */ jsxs(ControlGroup.ControlGroup, { children: [t17, t19] });
|
|
196
|
+
$[51] = t17;
|
|
197
|
+
$[52] = t19;
|
|
198
|
+
$[53] = t20;
|
|
199
|
+
} else t20 = $[53];
|
|
200
|
+
let t21;
|
|
201
|
+
if ($[54] === Symbol.for("react.memo_cache_sentinel")) {
|
|
202
|
+
t21 = /* @__PURE__ */ jsx("p", {
|
|
203
|
+
className: "text-muted-foreground text-xs",
|
|
204
|
+
children: "Used to generate the page URL, along with the parent page."
|
|
205
|
+
});
|
|
206
|
+
$[54] = t21;
|
|
207
|
+
} else t21 = $[54];
|
|
208
|
+
let t22;
|
|
209
|
+
if ($[55] !== t20) {
|
|
210
|
+
t22 = /* @__PURE__ */ jsxs("div", {
|
|
211
|
+
className: "space-y-2",
|
|
212
|
+
children: [
|
|
213
|
+
t15,
|
|
214
|
+
t20,
|
|
215
|
+
t21
|
|
216
|
+
]
|
|
217
|
+
});
|
|
218
|
+
$[55] = t20;
|
|
219
|
+
$[56] = t22;
|
|
220
|
+
} else t22 = $[56];
|
|
221
|
+
let t23;
|
|
222
|
+
if ($[57] !== t14 || $[58] !== t22) {
|
|
223
|
+
t23 = /* @__PURE__ */ jsxs(Fragment, { children: [t14, t22] });
|
|
224
|
+
$[57] = t14;
|
|
225
|
+
$[58] = t22;
|
|
226
|
+
$[59] = t23;
|
|
227
|
+
} else t23 = $[59];
|
|
228
|
+
return t23;
|
|
75
229
|
};
|
|
230
|
+
function _temp(page_1) {
|
|
231
|
+
return /* @__PURE__ */ jsx(SelectItem, {
|
|
232
|
+
value: String(page_1.id),
|
|
233
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
234
|
+
className: "flex flex-col items-start",
|
|
235
|
+
children: [/* @__PURE__ */ jsx("span", { children: page_1.metaTitle ?? formatPathSegment(page_1.pathSegment) }), /* @__PURE__ */ jsx("span", {
|
|
236
|
+
className: "text-muted-foreground font-mono text-xs [[data-slot=select-value]_&]:hidden",
|
|
237
|
+
children: page_1.fullPath
|
|
238
|
+
})]
|
|
239
|
+
})
|
|
240
|
+
}, page_1.id);
|
|
241
|
+
}
|
|
76
242
|
//#endregion
|
|
77
243
|
export { PageLocationFieldset };
|
|
@@ -47,7 +47,7 @@ var PagePicker = () => {
|
|
|
47
47
|
children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-3 flex-1" }), /* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })]
|
|
48
48
|
});
|
|
49
49
|
if (!pages) return skeleton;
|
|
50
|
-
const currentPage = pages.find((
|
|
50
|
+
const currentPage = pages.find((page_0) => page_0.fullPath === pathname);
|
|
51
51
|
if (!currentPage) return skeleton;
|
|
52
52
|
const peekedFullPath = peekedPagePathname ?? currentPage.fullPath;
|
|
53
53
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Popover, {
|
|
@@ -73,14 +73,14 @@ var PagePicker = () => {
|
|
|
73
73
|
side: "bottom",
|
|
74
74
|
children: /* @__PURE__ */ jsxs(Command, {
|
|
75
75
|
value: peekedFullPath,
|
|
76
|
-
onValueChange: (
|
|
77
|
-
if (
|
|
76
|
+
onValueChange: (value_0) => {
|
|
77
|
+
if (value_0 === CREATE_PAGE_VALUE) {
|
|
78
78
|
previewStore.send({ type: "clearPeekedPage" });
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
previewStore.send({
|
|
82
82
|
type: "setPeekedPage",
|
|
83
|
-
pathname:
|
|
83
|
+
pathname: value_0
|
|
84
84
|
});
|
|
85
85
|
},
|
|
86
86
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
@@ -91,23 +91,23 @@ var PagePicker = () => {
|
|
|
91
91
|
}),
|
|
92
92
|
/* @__PURE__ */ jsxs(CommandList, {
|
|
93
93
|
className: "flex-1 overflow-y-auto",
|
|
94
|
-
children: [/* @__PURE__ */ jsx(CommandEmpty, { children: "No page found." }), /* @__PURE__ */ jsx(CommandGroup, { children: pages.map((
|
|
95
|
-
value:
|
|
94
|
+
children: [/* @__PURE__ */ jsx(CommandEmpty, { children: "No page found." }), /* @__PURE__ */ jsx(CommandGroup, { children: pages.map((page_1) => /* @__PURE__ */ jsxs(CommandItem, {
|
|
95
|
+
value: page_1.fullPath,
|
|
96
96
|
className: "group/item justify-between",
|
|
97
97
|
onSelect: () => {
|
|
98
|
-
navigate({ to:
|
|
98
|
+
navigate({ to: page_1.fullPath });
|
|
99
99
|
setOpen(false);
|
|
100
100
|
},
|
|
101
101
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
102
102
|
className: "flex min-w-0 flex-1 items-start gap-2",
|
|
103
|
-
children: [/* @__PURE__ */ jsx(Check, { className: cn("size-4 mt-0.5 shrink-0", currentPage.fullPath !==
|
|
103
|
+
children: [/* @__PURE__ */ jsx(Check, { className: cn("size-4 mt-0.5 shrink-0", currentPage.fullPath !== page_1.fullPath && "invisible") }), /* @__PURE__ */ jsxs("div", {
|
|
104
104
|
className: "flex min-w-0 flex-col",
|
|
105
105
|
children: [/* @__PURE__ */ jsx("p", {
|
|
106
106
|
className: "truncate",
|
|
107
|
-
children:
|
|
107
|
+
children: page_1.metaTitle ?? formatPathSegment(page_1.pathSegment)
|
|
108
108
|
}), /* @__PURE__ */ jsx("p", {
|
|
109
109
|
className: "text-muted-foreground truncate font-mono text-xs",
|
|
110
|
-
children:
|
|
110
|
+
children: page_1.fullPath
|
|
111
111
|
})]
|
|
112
112
|
})]
|
|
113
113
|
}), /* @__PURE__ */ jsxs("div", {
|
|
@@ -119,40 +119,40 @@ var PagePicker = () => {
|
|
|
119
119
|
e.stopPropagation();
|
|
120
120
|
previewStore.send({
|
|
121
121
|
type: "openEditPageSheet",
|
|
122
|
-
pageId:
|
|
122
|
+
pageId: page_1.id
|
|
123
123
|
});
|
|
124
124
|
setOpen(false);
|
|
125
125
|
},
|
|
126
|
-
onKeyDown: (
|
|
127
|
-
if (
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
onKeyDown: (e_0) => {
|
|
127
|
+
if (e_0.key === "Enter" || e_0.key === " ") {
|
|
128
|
+
e_0.preventDefault();
|
|
129
|
+
e_0.stopPropagation();
|
|
130
130
|
previewStore.send({
|
|
131
131
|
type: "openEditPageSheet",
|
|
132
|
-
pageId:
|
|
132
|
+
pageId: page_1.id
|
|
133
133
|
});
|
|
134
134
|
setOpen(false);
|
|
135
135
|
}
|
|
136
136
|
},
|
|
137
137
|
children: /* @__PURE__ */ jsx(Pencil, { className: "size-4" })
|
|
138
|
-
}),
|
|
138
|
+
}), page_1.fullPath !== "/" && /* @__PURE__ */ jsx(Button, {
|
|
139
139
|
variant: "ghost",
|
|
140
140
|
size: "icon-sm",
|
|
141
|
-
onClick: (
|
|
142
|
-
|
|
143
|
-
setPageToDelete(
|
|
141
|
+
onClick: (e_1) => {
|
|
142
|
+
e_1.stopPropagation();
|
|
143
|
+
setPageToDelete(page_1);
|
|
144
144
|
},
|
|
145
|
-
onKeyDown: (
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
setPageToDelete(
|
|
145
|
+
onKeyDown: (e_2) => {
|
|
146
|
+
if (e_2.key === "Enter" || e_2.key === " ") {
|
|
147
|
+
e_2.preventDefault();
|
|
148
|
+
e_2.stopPropagation();
|
|
149
|
+
setPageToDelete(page_1);
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
152
|
children: /* @__PURE__ */ jsx(Trash2, { className: "size-4" })
|
|
153
153
|
})]
|
|
154
154
|
})]
|
|
155
|
-
},
|
|
155
|
+
}, page_1.id)) })]
|
|
156
156
|
}),
|
|
157
157
|
/* @__PURE__ */ jsx(CommandSeparator, { className: "m-0" }),
|
|
158
158
|
/* @__PURE__ */ jsx(CommandGroup, {
|
|
@@ -171,7 +171,7 @@ var PagePicker = () => {
|
|
|
171
171
|
})]
|
|
172
172
|
}), /* @__PURE__ */ jsx(AlertDialog, {
|
|
173
173
|
open: !!pageToDelete,
|
|
174
|
-
onOpenChange: (
|
|
174
|
+
onOpenChange: (open_0) => !open_0 && setPageToDelete(null),
|
|
175
175
|
children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [/* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: "Delete page" }), /* @__PURE__ */ jsxs(AlertDialogDescription, { children: [
|
|
176
176
|
"Are you sure you want to delete",
|
|
177
177
|
" ",
|