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