camox 0.3.0 → 0.4.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/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.d.ts.map +1 -1
- package/dist/features/studio/components/ProjectMenu.js +284 -83
- 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/features/vite/definitionsSync.d.ts +7 -12
- package/dist/features/vite/definitionsSync.d.ts.map +1 -1
- package/dist/features/vite/definitionsSync.js +5 -16
- package/dist/features/vite/vite.d.ts +0 -3
- package/dist/features/vite/vite.d.ts.map +1 -1
- package/dist/features/vite/vite.js +1 -2
- 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,6 +1,7 @@
|
|
|
1
1
|
import { useProjectSlug } from "../../../lib/auth.js";
|
|
2
2
|
import { pageQueries, projectQueries } from "../../../lib/queries.js";
|
|
3
3
|
import { cn, formatPathSegment } from "../../../lib/utils.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
4
5
|
import { Input } from "@camox/ui/input";
|
|
5
6
|
import { Label } from "@camox/ui/label";
|
|
6
7
|
import { Popover, PopoverContent, PopoverTrigger } from "@camox/ui/popover";
|
|
@@ -21,176 +22,373 @@ var normalizeLinkValue = (value) => {
|
|
|
21
22
|
};
|
|
22
23
|
return value;
|
|
23
24
|
};
|
|
24
|
-
var LinkFieldEditor = (
|
|
25
|
-
const
|
|
25
|
+
var LinkFieldEditor = (t0) => {
|
|
26
|
+
const $ = c(70);
|
|
27
|
+
const { fieldName, linkValue: rawLinkValue, onSave } = t0;
|
|
28
|
+
let t1;
|
|
29
|
+
if ($[0] !== rawLinkValue) {
|
|
30
|
+
t1 = normalizeLinkValue(rawLinkValue);
|
|
31
|
+
$[0] = rawLinkValue;
|
|
32
|
+
$[1] = t1;
|
|
33
|
+
} else t1 = $[1];
|
|
34
|
+
const linkValue = t1;
|
|
26
35
|
const timerRef = React.useRef(null);
|
|
27
36
|
const [text, setText] = React.useState(linkValue.text);
|
|
28
37
|
const [href, setHref] = React.useState(linkValue.type === "external" ? linkValue.href : "");
|
|
29
38
|
const linkValueRef = React.useRef(linkValue);
|
|
30
39
|
const [pagePickerOpen, setPagePickerOpen] = React.useState(false);
|
|
31
40
|
const projectSlug = useProjectSlug();
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
let t2;
|
|
42
|
+
if ($[2] !== projectSlug) {
|
|
43
|
+
t2 = projectQueries.getBySlug(projectSlug);
|
|
44
|
+
$[2] = projectSlug;
|
|
45
|
+
$[3] = t2;
|
|
46
|
+
} else t2 = $[3];
|
|
47
|
+
const { data: project } = useQuery(t2);
|
|
48
|
+
let t3;
|
|
49
|
+
if ($[4] !== project?.id) {
|
|
50
|
+
t3 = pageQueries.list(project?.id ?? 0);
|
|
51
|
+
$[4] = project?.id;
|
|
52
|
+
$[5] = t3;
|
|
53
|
+
} else t3 = $[5];
|
|
54
|
+
const t4 = !!project;
|
|
55
|
+
let t5;
|
|
56
|
+
if ($[6] !== t3 || $[7] !== t4) {
|
|
57
|
+
t5 = {
|
|
58
|
+
...t3,
|
|
59
|
+
enabled: t4
|
|
60
|
+
};
|
|
61
|
+
$[6] = t3;
|
|
62
|
+
$[7] = t4;
|
|
63
|
+
$[8] = t5;
|
|
64
|
+
} else t5 = $[8];
|
|
65
|
+
const { data: pages } = useQuery(t5);
|
|
37
66
|
const selectedPage = linkValue.type === "page" ? pages?.find((p) => String(p.id) === linkValue.pageId) : null;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
67
|
+
let t6;
|
|
68
|
+
let t7;
|
|
69
|
+
if ($[9] !== linkValue) {
|
|
70
|
+
t6 = () => {
|
|
71
|
+
linkValueRef.current = linkValue;
|
|
72
|
+
};
|
|
73
|
+
t7 = [linkValue];
|
|
74
|
+
$[9] = linkValue;
|
|
75
|
+
$[10] = t6;
|
|
76
|
+
$[11] = t7;
|
|
77
|
+
} else {
|
|
78
|
+
t6 = $[10];
|
|
79
|
+
t7 = $[11];
|
|
80
|
+
}
|
|
81
|
+
React.useEffect(t6, t7);
|
|
82
|
+
let t8;
|
|
83
|
+
let t9;
|
|
84
|
+
if ($[12] !== linkValue.text) {
|
|
85
|
+
t8 = () => {
|
|
86
|
+
setText(linkValue.text);
|
|
87
|
+
};
|
|
88
|
+
t9 = [linkValue.text];
|
|
89
|
+
$[12] = linkValue.text;
|
|
90
|
+
$[13] = t8;
|
|
91
|
+
$[14] = t9;
|
|
92
|
+
} else {
|
|
93
|
+
t8 = $[13];
|
|
94
|
+
t9 = $[14];
|
|
95
|
+
}
|
|
96
|
+
React.useEffect(t8, t9);
|
|
97
|
+
let t10;
|
|
98
|
+
if ($[15] !== linkValue.href || $[16] !== linkValue.type) {
|
|
99
|
+
t10 = () => {
|
|
100
|
+
if (linkValue.type === "external") setHref(linkValue.href);
|
|
101
|
+
};
|
|
102
|
+
$[15] = linkValue.href;
|
|
103
|
+
$[16] = linkValue.type;
|
|
104
|
+
$[17] = t10;
|
|
105
|
+
} else t10 = $[17];
|
|
106
|
+
let t11;
|
|
107
|
+
if ($[18] !== linkValue) {
|
|
108
|
+
t11 = [linkValue];
|
|
109
|
+
$[18] = linkValue;
|
|
110
|
+
$[19] = t11;
|
|
111
|
+
} else t11 = $[19];
|
|
112
|
+
React.useEffect(t10, t11);
|
|
113
|
+
let t12;
|
|
114
|
+
let t13;
|
|
115
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
116
|
+
t12 = () => () => {
|
|
49
117
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
50
118
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
119
|
+
t13 = [];
|
|
120
|
+
$[20] = t12;
|
|
121
|
+
$[21] = t13;
|
|
122
|
+
} else {
|
|
123
|
+
t12 = $[20];
|
|
124
|
+
t13 = $[21];
|
|
125
|
+
}
|
|
126
|
+
React.useEffect(t12, t13);
|
|
127
|
+
let t14;
|
|
128
|
+
if ($[22] !== fieldName || $[23] !== onSave) {
|
|
129
|
+
t14 = (value) => {
|
|
130
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
131
|
+
timerRef.current = window.setTimeout(() => {
|
|
132
|
+
onSave(fieldName, {
|
|
133
|
+
...linkValueRef.current,
|
|
134
|
+
text: value
|
|
135
|
+
});
|
|
136
|
+
}, 500);
|
|
137
|
+
};
|
|
138
|
+
$[22] = fieldName;
|
|
139
|
+
$[23] = onSave;
|
|
140
|
+
$[24] = t14;
|
|
141
|
+
} else t14 = $[24];
|
|
142
|
+
const handleTextChange = t14;
|
|
143
|
+
let t15;
|
|
144
|
+
if ($[25] !== fieldName || $[26] !== onSave) {
|
|
145
|
+
t15 = (value_0) => {
|
|
146
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
147
|
+
timerRef.current = window.setTimeout(() => {
|
|
148
|
+
onSave(fieldName, {
|
|
149
|
+
...linkValueRef.current,
|
|
150
|
+
href: value_0
|
|
151
|
+
});
|
|
152
|
+
}, 500);
|
|
153
|
+
};
|
|
154
|
+
$[25] = fieldName;
|
|
155
|
+
$[26] = onSave;
|
|
156
|
+
$[27] = t15;
|
|
157
|
+
} else t15 = $[27];
|
|
158
|
+
const handleHrefChange = t15;
|
|
159
|
+
let t16;
|
|
160
|
+
if ($[28] !== fieldName || $[29] !== onSave) {
|
|
161
|
+
t16 = (mode) => {
|
|
162
|
+
if (mode === "page") onSave(fieldName, {
|
|
163
|
+
type: "page",
|
|
164
|
+
text: linkValueRef.current.text,
|
|
165
|
+
pageId: "",
|
|
166
|
+
newTab: linkValueRef.current.newTab
|
|
58
167
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
168
|
+
else onSave(fieldName, {
|
|
169
|
+
type: "external",
|
|
170
|
+
text: linkValueRef.current.text,
|
|
171
|
+
href: "",
|
|
172
|
+
newTab: linkValueRef.current.newTab
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
$[28] = fieldName;
|
|
176
|
+
$[29] = onSave;
|
|
177
|
+
$[30] = t16;
|
|
178
|
+
} else t16 = $[30];
|
|
179
|
+
const handleModeChange = t16;
|
|
180
|
+
let t17;
|
|
181
|
+
if ($[31] !== fieldName || $[32] !== onSave) {
|
|
182
|
+
t17 = (pageId) => {
|
|
64
183
|
onSave(fieldName, {
|
|
65
|
-
|
|
66
|
-
|
|
184
|
+
type: "page",
|
|
185
|
+
text: linkValueRef.current.text,
|
|
186
|
+
pageId,
|
|
187
|
+
newTab: linkValueRef.current.newTab
|
|
67
188
|
});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
189
|
+
setPagePickerOpen(false);
|
|
190
|
+
};
|
|
191
|
+
$[31] = fieldName;
|
|
192
|
+
$[32] = onSave;
|
|
193
|
+
$[33] = t17;
|
|
194
|
+
} else t17 = $[33];
|
|
195
|
+
const handlePageSelect = t17;
|
|
196
|
+
const t18 = "grid gap-3";
|
|
197
|
+
const t19 = `${fieldName}-text`;
|
|
198
|
+
let t20;
|
|
199
|
+
if ($[34] !== t19) {
|
|
200
|
+
t20 = /* @__PURE__ */ jsx(Label, {
|
|
201
|
+
htmlFor: t19,
|
|
202
|
+
children: "Text"
|
|
76
203
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
204
|
+
$[34] = t19;
|
|
205
|
+
$[35] = t20;
|
|
206
|
+
} else t20 = $[35];
|
|
207
|
+
const t21 = `${fieldName}-text`;
|
|
208
|
+
let t22;
|
|
209
|
+
if ($[36] !== handleTextChange) {
|
|
210
|
+
t22 = (e) => {
|
|
211
|
+
setText(e.target.value);
|
|
212
|
+
handleTextChange(e.target.value);
|
|
213
|
+
};
|
|
214
|
+
$[36] = handleTextChange;
|
|
215
|
+
$[37] = t22;
|
|
216
|
+
} else t22 = $[37];
|
|
217
|
+
let t23;
|
|
218
|
+
if ($[38] !== t21 || $[39] !== t22 || $[40] !== text) {
|
|
219
|
+
t23 = /* @__PURE__ */ jsx(Input, {
|
|
220
|
+
id: t21,
|
|
221
|
+
value: text,
|
|
222
|
+
onChange: t22,
|
|
223
|
+
autoFocus: true
|
|
82
224
|
});
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
225
|
+
$[38] = t21;
|
|
226
|
+
$[39] = t22;
|
|
227
|
+
$[40] = text;
|
|
228
|
+
$[41] = t23;
|
|
229
|
+
} else t23 = $[41];
|
|
230
|
+
let t24;
|
|
231
|
+
if ($[42] !== t20 || $[43] !== t23) {
|
|
232
|
+
t24 = /* @__PURE__ */ jsxs("div", {
|
|
233
|
+
className: "grid gap-1.5",
|
|
234
|
+
children: [t20, t23]
|
|
90
235
|
});
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
className: "text-muted-foreground",
|
|
143
|
-
children: "Select a page"
|
|
144
|
-
}), /* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })]
|
|
145
|
-
})
|
|
146
|
-
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
147
|
-
align: "start",
|
|
148
|
-
className: "p-0",
|
|
149
|
-
children: /* @__PURE__ */ jsxs(Command, { children: [/* @__PURE__ */ jsx(CommandInput, {
|
|
150
|
-
placeholder: "Search page...",
|
|
151
|
-
className: "h-9"
|
|
152
|
-
}), /* @__PURE__ */ jsxs(CommandList, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: "No page found." }), /* @__PURE__ */ jsx(CommandGroup, { children: pages?.map((page) => /* @__PURE__ */ jsxs(CommandItem, {
|
|
153
|
-
value: page.fullPath,
|
|
154
|
-
onSelect: () => handlePageSelect(String(page.id)),
|
|
155
|
-
children: [/* @__PURE__ */ jsx(Check, { className: cn("mr-2 size-4", selectedPage?.id === page.id ? "opacity-100" : "opacity-0") }), /* @__PURE__ */ jsxs("div", {
|
|
156
|
-
className: "flex flex-col",
|
|
157
|
-
children: [/* @__PURE__ */ jsx("span", { children: page.metaTitle ?? formatPathSegment(page.pathSegment) }), /* @__PURE__ */ jsx("span", {
|
|
158
|
-
className: "text-muted-foreground font-mono text-xs",
|
|
159
|
-
children: page.fullPath
|
|
160
|
-
})]
|
|
161
|
-
})]
|
|
162
|
-
}, page.id)) })] })] })
|
|
163
|
-
})]
|
|
164
|
-
}) : /* @__PURE__ */ jsx(Input, {
|
|
165
|
-
type: "url",
|
|
166
|
-
id: `${fieldName}-href`,
|
|
167
|
-
placeholder: "https://",
|
|
168
|
-
value: href,
|
|
169
|
-
onChange: (e) => {
|
|
170
|
-
setHref(e.target.value);
|
|
171
|
-
handleHrefChange(e.target.value);
|
|
172
|
-
}
|
|
173
|
-
})
|
|
174
|
-
]
|
|
175
|
-
}),
|
|
176
|
-
/* @__PURE__ */ jsxs("div", {
|
|
177
|
-
className: "flex items-center gap-2",
|
|
178
|
-
children: [/* @__PURE__ */ jsx(Switch, {
|
|
179
|
-
id: `${fieldName}-newtab`,
|
|
180
|
-
checked: linkValue.newTab,
|
|
181
|
-
onCheckedChange: (checked) => {
|
|
182
|
-
onSave(fieldName, {
|
|
183
|
-
...linkValueRef.current,
|
|
184
|
-
newTab: checked
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
}), /* @__PURE__ */ jsx(Label, {
|
|
188
|
-
htmlFor: `${fieldName}-newtab`,
|
|
189
|
-
children: "Open in new tab"
|
|
190
|
-
})]
|
|
236
|
+
$[42] = t20;
|
|
237
|
+
$[43] = t23;
|
|
238
|
+
$[44] = t24;
|
|
239
|
+
} else t24 = $[44];
|
|
240
|
+
const t25 = "grid gap-1.5";
|
|
241
|
+
let t26;
|
|
242
|
+
if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
|
|
243
|
+
t26 = /* @__PURE__ */ jsx(Label, { children: "Destination" });
|
|
244
|
+
$[45] = t26;
|
|
245
|
+
} else t26 = $[45];
|
|
246
|
+
let t27;
|
|
247
|
+
if ($[46] === Symbol.for("react.memo_cache_sentinel")) {
|
|
248
|
+
t27 = /* @__PURE__ */ jsxs(TabsList, {
|
|
249
|
+
className: "w-full",
|
|
250
|
+
children: [/* @__PURE__ */ jsx(TabsTrigger, {
|
|
251
|
+
value: "page",
|
|
252
|
+
children: "Page"
|
|
253
|
+
}), /* @__PURE__ */ jsx(TabsTrigger, {
|
|
254
|
+
value: "external",
|
|
255
|
+
children: "URL"
|
|
256
|
+
})]
|
|
257
|
+
});
|
|
258
|
+
$[46] = t27;
|
|
259
|
+
} else t27 = $[46];
|
|
260
|
+
let t28;
|
|
261
|
+
if ($[47] !== handleModeChange || $[48] !== linkValue.type) {
|
|
262
|
+
t28 = /* @__PURE__ */ jsx(Tabs, {
|
|
263
|
+
value: linkValue.type,
|
|
264
|
+
onValueChange: handleModeChange,
|
|
265
|
+
children: t27
|
|
266
|
+
});
|
|
267
|
+
$[47] = handleModeChange;
|
|
268
|
+
$[48] = linkValue.type;
|
|
269
|
+
$[49] = t28;
|
|
270
|
+
} else t28 = $[49];
|
|
271
|
+
const t29 = linkValue.type === "page" ? /* @__PURE__ */ jsxs(Popover, {
|
|
272
|
+
open: pagePickerOpen,
|
|
273
|
+
onOpenChange: setPagePickerOpen,
|
|
274
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
275
|
+
asChild: true,
|
|
276
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
277
|
+
variant: "outline",
|
|
278
|
+
role: "combobox",
|
|
279
|
+
className: "justify-between font-normal",
|
|
280
|
+
children: [selectedPage ? /* @__PURE__ */ jsx("span", {
|
|
281
|
+
className: "truncate",
|
|
282
|
+
children: selectedPage.metaTitle ?? formatPathSegment(selectedPage.pathSegment)
|
|
283
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
284
|
+
className: "text-muted-foreground",
|
|
285
|
+
children: "Select a page"
|
|
286
|
+
}), /* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })]
|
|
191
287
|
})
|
|
192
|
-
|
|
288
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
289
|
+
align: "start",
|
|
290
|
+
className: "p-0",
|
|
291
|
+
children: /* @__PURE__ */ jsxs(Command, { children: [/* @__PURE__ */ jsx(CommandInput, {
|
|
292
|
+
placeholder: "Search page...",
|
|
293
|
+
className: "h-9"
|
|
294
|
+
}), /* @__PURE__ */ jsxs(CommandList, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: "No page found." }), /* @__PURE__ */ jsx(CommandGroup, { children: pages?.map((page) => /* @__PURE__ */ jsxs(CommandItem, {
|
|
295
|
+
value: page.fullPath,
|
|
296
|
+
onSelect: () => handlePageSelect(String(page.id)),
|
|
297
|
+
children: [/* @__PURE__ */ jsx(Check, { className: cn("mr-2 size-4", selectedPage?.id === page.id ? "opacity-100" : "opacity-0") }), /* @__PURE__ */ jsxs("div", {
|
|
298
|
+
className: "flex flex-col",
|
|
299
|
+
children: [/* @__PURE__ */ jsx("span", { children: page.metaTitle ?? formatPathSegment(page.pathSegment) }), /* @__PURE__ */ jsx("span", {
|
|
300
|
+
className: "text-muted-foreground font-mono text-xs",
|
|
301
|
+
children: page.fullPath
|
|
302
|
+
})]
|
|
303
|
+
})]
|
|
304
|
+
}, page.id)) })] })] })
|
|
305
|
+
})]
|
|
306
|
+
}) : /* @__PURE__ */ jsx(Input, {
|
|
307
|
+
type: "url",
|
|
308
|
+
id: `${fieldName}-href`,
|
|
309
|
+
placeholder: "https://",
|
|
310
|
+
value: href,
|
|
311
|
+
onChange: (e_0) => {
|
|
312
|
+
setHref(e_0.target.value);
|
|
313
|
+
handleHrefChange(e_0.target.value);
|
|
314
|
+
}
|
|
193
315
|
});
|
|
316
|
+
let t30;
|
|
317
|
+
if ($[50] !== t26 || $[51] !== t28 || $[52] !== t29) {
|
|
318
|
+
t30 = /* @__PURE__ */ jsxs("div", {
|
|
319
|
+
className: t25,
|
|
320
|
+
children: [
|
|
321
|
+
t26,
|
|
322
|
+
t28,
|
|
323
|
+
t29
|
|
324
|
+
]
|
|
325
|
+
});
|
|
326
|
+
$[50] = t26;
|
|
327
|
+
$[51] = t28;
|
|
328
|
+
$[52] = t29;
|
|
329
|
+
$[53] = t30;
|
|
330
|
+
} else t30 = $[53];
|
|
331
|
+
const t31 = `${fieldName}-newtab`;
|
|
332
|
+
let t32;
|
|
333
|
+
if ($[54] !== fieldName || $[55] !== onSave) {
|
|
334
|
+
t32 = (checked) => {
|
|
335
|
+
onSave(fieldName, {
|
|
336
|
+
...linkValueRef.current,
|
|
337
|
+
newTab: checked
|
|
338
|
+
});
|
|
339
|
+
};
|
|
340
|
+
$[54] = fieldName;
|
|
341
|
+
$[55] = onSave;
|
|
342
|
+
$[56] = t32;
|
|
343
|
+
} else t32 = $[56];
|
|
344
|
+
let t33;
|
|
345
|
+
if ($[57] !== linkValue.newTab || $[58] !== t31 || $[59] !== t32) {
|
|
346
|
+
t33 = /* @__PURE__ */ jsx(Switch, {
|
|
347
|
+
id: t31,
|
|
348
|
+
checked: linkValue.newTab,
|
|
349
|
+
onCheckedChange: t32
|
|
350
|
+
});
|
|
351
|
+
$[57] = linkValue.newTab;
|
|
352
|
+
$[58] = t31;
|
|
353
|
+
$[59] = t32;
|
|
354
|
+
$[60] = t33;
|
|
355
|
+
} else t33 = $[60];
|
|
356
|
+
const t34 = `${fieldName}-newtab`;
|
|
357
|
+
let t35;
|
|
358
|
+
if ($[61] !== t34) {
|
|
359
|
+
t35 = /* @__PURE__ */ jsx(Label, {
|
|
360
|
+
htmlFor: t34,
|
|
361
|
+
children: "Open in new tab"
|
|
362
|
+
});
|
|
363
|
+
$[61] = t34;
|
|
364
|
+
$[62] = t35;
|
|
365
|
+
} else t35 = $[62];
|
|
366
|
+
let t36;
|
|
367
|
+
if ($[63] !== t33 || $[64] !== t35) {
|
|
368
|
+
t36 = /* @__PURE__ */ jsxs("div", {
|
|
369
|
+
className: "flex items-center gap-2",
|
|
370
|
+
children: [t33, t35]
|
|
371
|
+
});
|
|
372
|
+
$[63] = t33;
|
|
373
|
+
$[64] = t35;
|
|
374
|
+
$[65] = t36;
|
|
375
|
+
} else t36 = $[65];
|
|
376
|
+
let t37;
|
|
377
|
+
if ($[66] !== t24 || $[67] !== t30 || $[68] !== t36) {
|
|
378
|
+
t37 = /* @__PURE__ */ jsxs("form", {
|
|
379
|
+
className: t18,
|
|
380
|
+
children: [
|
|
381
|
+
t24,
|
|
382
|
+
t30,
|
|
383
|
+
t36
|
|
384
|
+
]
|
|
385
|
+
});
|
|
386
|
+
$[66] = t24;
|
|
387
|
+
$[67] = t30;
|
|
388
|
+
$[68] = t36;
|
|
389
|
+
$[69] = t37;
|
|
390
|
+
} else t37 = $[69];
|
|
391
|
+
return t37;
|
|
194
392
|
};
|
|
195
393
|
//#endregion
|
|
196
394
|
export { LinkFieldEditor };
|