@nodehive/nextjs 0.6.0 → 0.7.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/README.md +9 -0
- package/dist/puck-editor/index.d.ts +1 -1
- package/dist/puck-editor/index.js +1 -1
- package/dist/puck-editor/index.js.map +1 -1
- package/dist/puck-editor/internal/api/client.d.ts +4 -4
- package/dist/puck-editor/internal/api/client.js +14 -6
- package/dist/puck-editor/internal/api/client.js.map +1 -1
- package/dist/puck-editor/internal/api/create-puck-api.js +1 -1
- package/dist/puck-editor/internal/api/create-puck-api.js.map +1 -1
- package/dist/puck-editor/internal/api/handlers/template.d.ts +1 -1
- package/dist/puck-editor/internal/api/handlers/template.js +16 -4
- package/dist/puck-editor/internal/api/handlers/template.js.map +1 -1
- package/dist/puck-editor/internal/api/handlers/upload.js +6 -3
- package/dist/puck-editor/internal/api/handlers/upload.js.map +1 -1
- package/dist/puck-editor/internal/api/media-upload.d.ts +2 -2
- package/dist/puck-editor/internal/api/media-upload.js +6 -1
- package/dist/puck-editor/internal/api/media-upload.js.map +1 -1
- package/dist/puck-editor/internal/editor/picker-model.d.ts +1 -1
- package/dist/puck-editor/internal/editor/puck-editor.js +148 -134
- package/dist/puck-editor/internal/editor/puck-editor.js.map +1 -1
- package/dist/puck-editor/internal/editor-config.d.ts +5 -2
- package/dist/puck-editor/internal/editor-config.js +32 -26
- package/dist/puck-editor/internal/editor-config.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.js +323 -290
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.js +3 -2
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.js +3 -4
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.d.ts +2 -2
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.js +118 -101
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.js +3 -2
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.js.map +1 -1
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.d.ts +21 -13
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.js +9 -35
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/node-selector/node-selector-field.d.ts +12 -0
- package/dist/puck-editor/internal/fields/node-selector/node-selector-field.js +56 -0
- package/dist/puck-editor/internal/fields/node-selector/node-selector-field.js.map +1 -0
- package/dist/puck-editor/internal/locale.d.ts +2 -6
- package/dist/puck-editor/internal/locale.js +6 -8
- package/dist/puck-editor/internal/locale.js.map +1 -1
- package/dist/puck-editor/internal/native-puck-dictionaries.d.ts +2 -0
- package/dist/puck-editor/internal/native-puck-dictionaries.js +160 -0
- package/dist/puck-editor/internal/native-puck-dictionaries.js.map +1 -0
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.js +4 -4
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.js +0 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.d.ts +2 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.js +7 -7
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.js +3 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.d.ts +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.js +3 -3
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.js +32 -37
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.d.ts +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.js +95 -72
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.js.map +1 -1
- package/dist/puck-editor/internal/puck-wrapper.d.ts +1 -1
- package/dist/puck-editor/internal/puck-wrapper.js +89 -83
- package/dist/puck-editor/internal/puck-wrapper.js.map +1 -1
- package/dist/puck-editor/internal/use-puck-overlay.d.ts +3 -2
- package/dist/puck-editor/internal/use-puck-overlay.js +67 -56
- package/dist/puck-editor/internal/use-puck-overlay.js.map +1 -1
- package/dist/puck-editor/puck-theme.css +3 -3
- package/dist/theme.css +2 -2
- package/package.json +20 -20
|
@@ -4,11 +4,11 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
import { createUsePuck } from '@puckeditor/core';
|
|
6
6
|
import * as Popover from '@radix-ui/react-popover';
|
|
7
|
-
import {
|
|
7
|
+
import { useQuery } from '@tanstack/react-query';
|
|
8
8
|
import { ChevronDown, Search, X } from 'lucide-react';
|
|
9
9
|
import { puckFetch } from "../../api/client.js";
|
|
10
|
+
import { usePuckContentLocale } from "../../editor-config.js";
|
|
10
11
|
import { usePuckDictionary, usePuckLocale } from "../../i18n.js";
|
|
11
|
-
import { getPathLocale } from "../../locale.js";
|
|
12
12
|
import { collectPageAnchors, hasAnchorFragment } from "./anchor.js";
|
|
13
13
|
import { humanize } from "./humanize.js";
|
|
14
14
|
import { isExternalHref, isSafeHref } from "./link-value.js";
|
|
@@ -53,7 +53,7 @@ function displayPath(path, locale) {
|
|
|
53
53
|
* richtext link popover so both surfaces share identical selection UI.
|
|
54
54
|
*/
|
|
55
55
|
export default function LinkPickerControl(t0) {
|
|
56
|
-
const $ = _c(
|
|
56
|
+
const $ = _c(44);
|
|
57
57
|
const {
|
|
58
58
|
href,
|
|
59
59
|
onHrefChange,
|
|
@@ -92,314 +92,347 @@ export default function LinkPickerControl(t0) {
|
|
|
92
92
|
const [query, setQuery] = useState("");
|
|
93
93
|
const [activeGroup, setActiveGroup] = useState(null);
|
|
94
94
|
const [unsafeHint, setUnsafeHint] = useState(false);
|
|
95
|
-
const locale =
|
|
96
|
-
const {
|
|
97
|
-
data: links,
|
|
98
|
-
isLoading: loading,
|
|
99
|
-
isError: error
|
|
100
|
-
} = useQuery({
|
|
101
|
-
queryKey: ["puck-links", locale],
|
|
102
|
-
queryFn: async () => {
|
|
103
|
-
const data = await puckFetch(`/links?lang=${locale}`);
|
|
104
|
-
return Array.isArray(data) ? data : [];
|
|
105
|
-
},
|
|
106
|
-
enabled: mode === "internal" && open,
|
|
107
|
-
staleTime: Infinity,
|
|
108
|
-
placeholderData: keepPreviousData
|
|
109
|
-
});
|
|
110
|
-
const selectedLink = links?.find(l => l.path === href) ?? null;
|
|
111
|
-
const info = new Map();
|
|
112
|
-
(links ?? []).forEach(l_0 => {
|
|
113
|
-
const key = l_0.group ?? "page";
|
|
114
|
-
if (!info.has(key)) {
|
|
115
|
-
info.set(key, {
|
|
116
|
-
label: l_0.groupLabel ?? humanize(key),
|
|
117
|
-
order: info.size
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
const groupInfo = info;
|
|
122
|
-
const groupLabelOf = key_0 => groupInfo.get(key_0)?.label ?? humanize(key_0);
|
|
123
|
-
const groupOrderOf = key_1 => groupInfo.get(key_1)?.order ?? Number.MAX_SAFE_INTEGER;
|
|
95
|
+
const locale = usePuckContentLocale();
|
|
124
96
|
let t4;
|
|
125
|
-
bb0: {
|
|
126
|
-
if (!links) {
|
|
127
|
-
t4 = [];
|
|
128
|
-
break bb0;
|
|
129
|
-
}
|
|
130
|
-
const keys = new Set(links.map(_temp));
|
|
131
|
-
t4 = [...keys].map(key_2 => ({
|
|
132
|
-
key: key_2,
|
|
133
|
-
label: groupLabelOf(key_2),
|
|
134
|
-
order: groupOrderOf(key_2)
|
|
135
|
-
})).sort(_temp2);
|
|
136
|
-
}
|
|
137
|
-
const availableGroups = t4;
|
|
138
97
|
let t5;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const q = query.trim().toLowerCase();
|
|
145
|
-
const filtered = links.filter(l_2 => {
|
|
146
|
-
if (activeGroup && (l_2.group ?? "page") !== activeGroup) {
|
|
147
|
-
return false;
|
|
148
|
-
}
|
|
149
|
-
if (!q) {
|
|
150
|
-
return true;
|
|
151
|
-
}
|
|
152
|
-
return l_2.path.toLowerCase().includes(q) || linkLabel(l_2, locale).toLowerCase().includes(q);
|
|
153
|
-
});
|
|
154
|
-
const byGroup = new Map();
|
|
155
|
-
for (const link of filtered) {
|
|
156
|
-
const key_3 = link.group ?? "page";
|
|
157
|
-
const bucket = byGroup.get(key_3) ?? [];
|
|
158
|
-
bucket.push(link);
|
|
159
|
-
byGroup.set(key_3, bucket);
|
|
160
|
-
}
|
|
161
|
-
t5 = [...byGroup.entries()].map(t6 => {
|
|
162
|
-
const [key_4, items] = t6;
|
|
163
|
-
return {
|
|
164
|
-
key: key_4,
|
|
165
|
-
label: groupLabelOf(key_4),
|
|
166
|
-
order: groupOrderOf(key_4),
|
|
167
|
-
items: items.sort((a_0, b_0) => linkLabel(a_0, locale).localeCompare(linkLabel(b_0, locale), editorLocale))
|
|
168
|
-
};
|
|
169
|
-
}).sort(_temp3);
|
|
170
|
-
}
|
|
171
|
-
const groups = t5;
|
|
172
|
-
let t6;
|
|
173
|
-
if ($[6] !== onSubmit) {
|
|
174
|
-
t6 = e => {
|
|
175
|
-
if (e.key === "Enter") {
|
|
176
|
-
e.preventDefault();
|
|
177
|
-
onSubmit?.();
|
|
178
|
-
}
|
|
98
|
+
if ($[6] !== locale) {
|
|
99
|
+
t4 = ["puck-links", locale];
|
|
100
|
+
t5 = async () => {
|
|
101
|
+
const data = await puckFetch(`/links?lang=${locale}`);
|
|
102
|
+
return Array.isArray(data) ? data : [];
|
|
179
103
|
};
|
|
180
|
-
$[6] =
|
|
181
|
-
$[7] =
|
|
104
|
+
$[6] = locale;
|
|
105
|
+
$[7] = t4;
|
|
106
|
+
$[8] = t5;
|
|
182
107
|
} else {
|
|
183
|
-
|
|
108
|
+
t4 = $[7];
|
|
109
|
+
t5 = $[8];
|
|
184
110
|
}
|
|
185
|
-
const
|
|
111
|
+
const t6 = mode === "internal" && open;
|
|
186
112
|
let t7;
|
|
187
|
-
if ($[
|
|
188
|
-
t7 =
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
setUnsafeHint(true);
|
|
194
|
-
return true;
|
|
113
|
+
if ($[9] !== t4 || $[10] !== t5 || $[11] !== t6) {
|
|
114
|
+
t7 = {
|
|
115
|
+
queryKey: t4,
|
|
116
|
+
queryFn: t5,
|
|
117
|
+
enabled: t6,
|
|
118
|
+
staleTime: Infinity
|
|
195
119
|
};
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
120
|
+
$[9] = t4;
|
|
121
|
+
$[10] = t5;
|
|
122
|
+
$[11] = t6;
|
|
123
|
+
$[12] = t7;
|
|
199
124
|
} else {
|
|
200
|
-
t7 = $[
|
|
125
|
+
t7 = $[12];
|
|
201
126
|
}
|
|
202
|
-
const
|
|
127
|
+
const {
|
|
128
|
+
data: links,
|
|
129
|
+
isLoading: loading,
|
|
130
|
+
isError: error
|
|
131
|
+
} = useQuery(t7);
|
|
203
132
|
let t8;
|
|
204
|
-
if ($[
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
133
|
+
if ($[13] !== activeGroup || $[14] !== anchors || $[15] !== editorLocale || $[16] !== error || $[17] !== href || $[18] !== links || $[19] !== loading || $[20] !== locale || $[21] !== mode || $[22] !== onHrefChange || $[23] !== onSubmit || $[24] !== open || $[25] !== query || $[26] !== t || $[27] !== unsafeHint) {
|
|
134
|
+
const selectedLink = links?.find(l => l.path === href) ?? null;
|
|
135
|
+
const info = new Map();
|
|
136
|
+
(links ?? []).forEach(l_0 => {
|
|
137
|
+
const key = l_0.group ?? "page";
|
|
138
|
+
if (!info.has(key)) {
|
|
139
|
+
info.set(key, {
|
|
140
|
+
label: l_0.groupLabel ?? humanize(key),
|
|
141
|
+
order: info.size
|
|
142
|
+
});
|
|
208
143
|
}
|
|
209
|
-
setMode(next);
|
|
210
|
-
onHrefChange("");
|
|
211
|
-
setQuery("");
|
|
212
|
-
setActiveGroup(null);
|
|
213
|
-
setOpen(false);
|
|
214
|
-
};
|
|
215
|
-
$[11] = mode;
|
|
216
|
-
$[12] = onHrefChange;
|
|
217
|
-
$[13] = t8;
|
|
218
|
-
} else {
|
|
219
|
-
t8 = $[13];
|
|
220
|
-
}
|
|
221
|
-
const switchMode = t8;
|
|
222
|
-
const t9 = "nh:flex nh:flex-col nh:gap-2";
|
|
223
|
-
let t10;
|
|
224
|
-
if ($[14] !== t) {
|
|
225
|
-
t10 = MODE_VALUES.map(value => ({
|
|
226
|
-
value,
|
|
227
|
-
label: t[value]
|
|
228
|
-
}));
|
|
229
|
-
$[14] = t;
|
|
230
|
-
$[15] = t10;
|
|
231
|
-
} else {
|
|
232
|
-
t10 = $[15];
|
|
233
|
-
}
|
|
234
|
-
let t11;
|
|
235
|
-
if ($[16] !== mode || $[17] !== switchMode || $[18] !== t.linkMode || $[19] !== t10) {
|
|
236
|
-
t11 = /*#__PURE__*/_jsx(SegmentedControl, {
|
|
237
|
-
options: t10,
|
|
238
|
-
value: mode,
|
|
239
|
-
onChange: switchMode,
|
|
240
|
-
variant: "puck",
|
|
241
|
-
ariaLabel: t.linkMode
|
|
242
144
|
});
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
145
|
+
const groupInfo = info;
|
|
146
|
+
const groupLabelOf = key_0 => groupInfo.get(key_0)?.label ?? humanize(key_0);
|
|
147
|
+
const groupOrderOf = key_1 => groupInfo.get(key_1)?.order ?? Number.MAX_SAFE_INTEGER;
|
|
148
|
+
let t9;
|
|
149
|
+
bb0: {
|
|
150
|
+
if (!links) {
|
|
151
|
+
t9 = [];
|
|
152
|
+
break bb0;
|
|
153
|
+
}
|
|
154
|
+
const keys = new Set(links.map(_temp));
|
|
155
|
+
t9 = [...keys].map(key_2 => ({
|
|
156
|
+
key: key_2,
|
|
157
|
+
label: groupLabelOf(key_2),
|
|
158
|
+
order: groupOrderOf(key_2)
|
|
159
|
+
})).sort(_temp2);
|
|
160
|
+
}
|
|
161
|
+
const availableGroups = t9;
|
|
162
|
+
let t10;
|
|
163
|
+
bb1: {
|
|
164
|
+
if (!links) {
|
|
165
|
+
t10 = [];
|
|
166
|
+
break bb1;
|
|
167
|
+
}
|
|
168
|
+
const q = query.trim().toLowerCase();
|
|
169
|
+
const filtered = links.filter(l_2 => {
|
|
170
|
+
if (activeGroup && (l_2.group ?? "page") !== activeGroup) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
if (!q) {
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
return l_2.path.toLowerCase().includes(q) || linkLabel(l_2, locale).toLowerCase().includes(q);
|
|
177
|
+
});
|
|
178
|
+
const byGroup = new Map();
|
|
179
|
+
for (const link of filtered) {
|
|
180
|
+
const key_3 = link.group ?? "page";
|
|
181
|
+
const bucket = byGroup.get(key_3) ?? [];
|
|
182
|
+
bucket.push(link);
|
|
183
|
+
byGroup.set(key_3, bucket);
|
|
184
|
+
}
|
|
185
|
+
t10 = [...byGroup.entries()].map(t11 => {
|
|
186
|
+
const [key_4, items] = t11;
|
|
187
|
+
return {
|
|
188
|
+
key: key_4,
|
|
189
|
+
label: groupLabelOf(key_4),
|
|
190
|
+
order: groupOrderOf(key_4),
|
|
191
|
+
items: items.sort((a_0, b_0) => linkLabel(a_0, locale).localeCompare(linkLabel(b_0, locale), editorLocale))
|
|
192
|
+
};
|
|
193
|
+
}).sort(_temp3);
|
|
194
|
+
}
|
|
195
|
+
const groups = t10;
|
|
196
|
+
let t11;
|
|
197
|
+
if ($[29] !== onSubmit) {
|
|
198
|
+
t11 = e => {
|
|
199
|
+
if (e.key === "Enter") {
|
|
200
|
+
e.preventDefault();
|
|
201
|
+
onSubmit?.();
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
$[29] = onSubmit;
|
|
205
|
+
$[30] = t11;
|
|
206
|
+
} else {
|
|
207
|
+
t11 = $[30];
|
|
208
|
+
}
|
|
209
|
+
const submitOnEnter = t11;
|
|
210
|
+
let t12;
|
|
211
|
+
if ($[31] !== href || $[32] !== onHrefChange) {
|
|
212
|
+
t12 = () => {
|
|
213
|
+
if (isSafeHref(href)) {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
onHrefChange("");
|
|
217
|
+
setUnsafeHint(true);
|
|
218
|
+
return true;
|
|
219
|
+
};
|
|
220
|
+
$[31] = href;
|
|
221
|
+
$[32] = onHrefChange;
|
|
222
|
+
$[33] = t12;
|
|
223
|
+
} else {
|
|
224
|
+
t12 = $[33];
|
|
225
|
+
}
|
|
226
|
+
const neutralizeUnsafe = t12;
|
|
227
|
+
let t13;
|
|
228
|
+
if ($[34] !== mode || $[35] !== onHrefChange) {
|
|
229
|
+
t13 = next => {
|
|
230
|
+
if (next === mode) {
|
|
263
231
|
return;
|
|
264
232
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
233
|
+
setMode(next);
|
|
234
|
+
onHrefChange("");
|
|
235
|
+
setQuery("");
|
|
236
|
+
setActiveGroup(null);
|
|
237
|
+
setOpen(false);
|
|
238
|
+
};
|
|
239
|
+
$[34] = mode;
|
|
240
|
+
$[35] = onHrefChange;
|
|
241
|
+
$[36] = t13;
|
|
242
|
+
} else {
|
|
243
|
+
t13 = $[36];
|
|
244
|
+
}
|
|
245
|
+
const switchMode = t13;
|
|
246
|
+
let t14;
|
|
247
|
+
if ($[37] !== t) {
|
|
248
|
+
t14 = MODE_VALUES.map(value => ({
|
|
249
|
+
value,
|
|
250
|
+
label: t[value]
|
|
251
|
+
}));
|
|
252
|
+
$[37] = t;
|
|
253
|
+
$[38] = t14;
|
|
254
|
+
} else {
|
|
255
|
+
t14 = $[38];
|
|
256
|
+
}
|
|
257
|
+
let t15;
|
|
258
|
+
if ($[39] !== mode || $[40] !== switchMode || $[41] !== t.linkMode || $[42] !== t14) {
|
|
259
|
+
t15 = /*#__PURE__*/_jsx(SegmentedControl, {
|
|
260
|
+
options: t14,
|
|
261
|
+
value: mode,
|
|
262
|
+
onChange: switchMode,
|
|
263
|
+
variant: "puck",
|
|
264
|
+
ariaLabel: t.linkMode
|
|
265
|
+
});
|
|
266
|
+
$[39] = mode;
|
|
267
|
+
$[40] = switchMode;
|
|
268
|
+
$[41] = t.linkMode;
|
|
269
|
+
$[42] = t14;
|
|
270
|
+
$[43] = t15;
|
|
271
|
+
} else {
|
|
272
|
+
t15 = $[43];
|
|
273
|
+
}
|
|
274
|
+
t8 = /*#__PURE__*/_jsxs("div", {
|
|
275
|
+
className: "nh:flex nh:flex-col nh:gap-2",
|
|
276
|
+
children: [t15, mode === "external" ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
277
|
+
children: [/*#__PURE__*/_jsx("input", {
|
|
278
|
+
type: "text",
|
|
279
|
+
value: href,
|
|
280
|
+
placeholder: t.externalPlaceholder,
|
|
281
|
+
onChange: e_0 => {
|
|
282
|
+
setUnsafeHint(false);
|
|
283
|
+
onHrefChange(e_0.target.value);
|
|
284
|
+
},
|
|
285
|
+
onKeyDown: e_1 => {
|
|
286
|
+
if (e_1.key === "Enter" && neutralizeUnsafe()) {
|
|
287
|
+
e_1.preventDefault();
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
submitOnEnter(e_1);
|
|
291
|
+
},
|
|
292
|
+
onBlur: () => neutralizeUnsafe(),
|
|
293
|
+
className: "nh:w-full nh:rounded-sm nh:border nh:border-(--nh-border) nh:p-3 nh:text-sm"
|
|
294
|
+
}), unsafeHint && /*#__PURE__*/_jsx("p", {
|
|
295
|
+
className: "nh:text-xs nh:text-red-600",
|
|
296
|
+
children: t.unsafeLink
|
|
297
|
+
})]
|
|
298
|
+
}) : mode === "anchor" ? /*#__PURE__*/_jsx(AnchorInput, {
|
|
299
|
+
href: href,
|
|
300
|
+
anchors: anchors,
|
|
301
|
+
onHrefChange: onHrefChange,
|
|
302
|
+
onSubmit: onSubmit
|
|
303
|
+
}) : /*#__PURE__*/_jsx(Popover.Root, {
|
|
304
|
+
open: open,
|
|
305
|
+
onOpenChange: setOpen,
|
|
306
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
307
|
+
className: "nh:relative",
|
|
308
|
+
children: [/*#__PURE__*/_jsx(Popover.Trigger, {
|
|
309
|
+
asChild: true,
|
|
310
|
+
children: /*#__PURE__*/_jsxs("button", {
|
|
339
311
|
type: "button",
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
children: t.loading
|
|
350
|
-
}), !loading && error && /*#__PURE__*/_jsx("div", {
|
|
351
|
-
className: "nh:px-3 nh:py-4 nh:text-center nh:text-xs nh:text-red-600",
|
|
352
|
-
children: t.loadFailed
|
|
353
|
-
}), !loading && !error && groups.length === 0 && /*#__PURE__*/_jsx("div", {
|
|
354
|
-
className: "nh:px-3 nh:py-4 nh:text-center nh:text-xs nh:text-gray-500",
|
|
355
|
-
children: t.noResults
|
|
356
|
-
}), groups.map(group => /*#__PURE__*/_jsxs("div", {
|
|
357
|
-
children: [!activeGroup && /*#__PURE__*/_jsx("div", {
|
|
358
|
-
className: "nh:px-3 nh:pt-2 nh:pb-1 nh:text-xs nh:font-semibold nh:tracking-wide nh:text-gray-500 nh:uppercase",
|
|
359
|
-
children: group.label
|
|
360
|
-
}), group.items.map(link_0 => {
|
|
361
|
-
const isSelected = link_0.path === href;
|
|
362
|
-
return /*#__PURE__*/_jsxs("button", {
|
|
363
|
-
type: "button",
|
|
364
|
-
onClick: () => {
|
|
365
|
-
onHrefChange(link_0.path);
|
|
366
|
-
setOpen(false);
|
|
367
|
-
},
|
|
368
|
-
className: `nh:flex nh:w-full nh:flex-col nh:items-start nh:gap-0.5 nh:px-3 nh:py-2 nh:text-left nh:hover:bg-(--nh-muted) ${isSelected ? "bg-(--nh-muted)" : ""}`,
|
|
369
|
-
children: [/*#__PURE__*/_jsxs("span", {
|
|
370
|
-
className: "nh:flex nh:w-full nh:items-center nh:gap-2 nh:text-sm",
|
|
371
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
372
|
-
className: "nh:truncate",
|
|
373
|
-
children: linkLabel(link_0, locale)
|
|
374
|
-
}), link_0.published === false && /*#__PURE__*/_jsx("span", {
|
|
375
|
-
className: "nh:shrink-0 nh:rounded-full nh:bg-amber-50 nh:px-1.5 nh:py-0.5 nh:text-[9px] nh:font-semibold nh:uppercase nh:tracking-wide nh:text-amber-600 nh:ring-1 nh:ring-inset nh:ring-amber-200",
|
|
376
|
-
children: t.draft
|
|
377
|
-
})]
|
|
378
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
379
|
-
className: "nh:w-full nh:truncate nh:font-mono nh:text-xs nh:text-gray-500",
|
|
380
|
-
title: link_0.path,
|
|
381
|
-
children: displayPath(link_0.path, locale)
|
|
312
|
+
className: "nh:flex nh:w-full nh:items-center nh:justify-between nh:gap-2 nh:rounded-sm nh:border nh:border-(--nh-border) nh:p-3 nh:text-left nh:text-sm nh:hover:bg-(--nh-muted)",
|
|
313
|
+
children: [/*#__PURE__*/_jsxs("span", {
|
|
314
|
+
className: "nh:flex nh:min-w-0 nh:items-center nh:gap-2",
|
|
315
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
316
|
+
className: isEmptyValue(href) ? "nh:truncate nh:text-gray-500" : "nh:truncate",
|
|
317
|
+
children: isEmptyValue(href) ? t.selectPage : selectedLink ? linkLabel(selectedLink, locale) : href
|
|
318
|
+
}), selectedLink?.published === false && /*#__PURE__*/_jsx("span", {
|
|
319
|
+
className: "nh:shrink-0 nh:rounded-full nh:bg-amber-50 nh:px-1.5 nh:py-0.5 nh:text-[9px] nh:font-semibold nh:uppercase nh:tracking-wide nh:text-amber-600 nh:ring-1 nh:ring-inset nh:ring-amber-200",
|
|
320
|
+
children: t.draft
|
|
382
321
|
})]
|
|
383
|
-
},
|
|
322
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
323
|
+
className: "nh:flex nh:shrink-0 nh:items-center nh:gap-1",
|
|
324
|
+
children: [!isEmptyValue(href) && /*#__PURE__*/_jsx(X, {
|
|
325
|
+
className: "nh:size-4 nh:text-gray-500 nh:hover:text-(--nh-fg)",
|
|
326
|
+
onClick: e_2 => {
|
|
327
|
+
e_2.stopPropagation();
|
|
328
|
+
onHrefChange("");
|
|
329
|
+
}
|
|
330
|
+
}), /*#__PURE__*/_jsx(ChevronDown, {
|
|
331
|
+
className: "nh:size-4 nh:text-gray-500"
|
|
332
|
+
})]
|
|
333
|
+
})]
|
|
334
|
+
})
|
|
335
|
+
}), !isEmptyValue(href) && /*#__PURE__*/_jsx("div", {
|
|
336
|
+
className: "nh:mt-1 nh:truncate nh:font-mono nh:text-xs nh:text-gray-500",
|
|
337
|
+
title: href,
|
|
338
|
+
children: displayPath(href, locale)
|
|
339
|
+
}), /*#__PURE__*/_jsxs(Popover.Content, {
|
|
340
|
+
align: "start",
|
|
341
|
+
sideOffset: 4,
|
|
342
|
+
"data-puck-rte-menu": true,
|
|
343
|
+
className: "nh:z-50 nh:w-(--radix-popover-trigger-width) nh:overflow-hidden nh:rounded-md nh:border nh:border-(--nh-border) nh:bg-(--nh-bg) nh:text-(--nh-fg) nh:shadow-md",
|
|
344
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
345
|
+
className: "nh:flex nh:items-center nh:gap-2 nh:border-b nh:border-(--nh-border) nh:p-2",
|
|
346
|
+
children: [/*#__PURE__*/_jsx(Search, {
|
|
347
|
+
className: "nh:size-4 nh:shrink-0 nh:text-gray-500"
|
|
348
|
+
}), /*#__PURE__*/_jsx("input", {
|
|
349
|
+
type: "text",
|
|
350
|
+
autoFocus: true,
|
|
351
|
+
value: query,
|
|
352
|
+
placeholder: t.searchPlaceholder,
|
|
353
|
+
onChange: e_3 => setQuery(e_3.target.value),
|
|
354
|
+
className: "nh:w-full nh:text-sm outline-none"
|
|
355
|
+
})]
|
|
356
|
+
}), availableGroups.length > 1 && /*#__PURE__*/_jsx("div", {
|
|
357
|
+
className: "nh:flex nh:flex-wrap nh:gap-1 nh:border-b nh:border-(--nh-border) nh:p-2",
|
|
358
|
+
children: [{
|
|
359
|
+
key: null,
|
|
360
|
+
label: t.all
|
|
361
|
+
}, ...availableGroups].map(chip => {
|
|
362
|
+
const isActive = activeGroup === chip.key;
|
|
363
|
+
return /*#__PURE__*/_jsx("button", {
|
|
364
|
+
type: "button",
|
|
365
|
+
onClick: () => setActiveGroup(chip.key),
|
|
366
|
+
className: `nh:rounded-full nh:px-2.5 nh:py-1 nh:text-xs nh:font-medium nh:transition-colors ${isActive ? "nh:bg-(--nh-primary) nh:text-(--nh-primary-fg)" : "nh:text-gray-500 bg-(--nh-muted) hover:bg-gray-200"}`,
|
|
367
|
+
children: chip.label
|
|
368
|
+
}, chip.key ?? "__all");
|
|
369
|
+
})
|
|
370
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
371
|
+
className: "nh:max-h-72 nh:overflow-y-auto nh:py-1",
|
|
372
|
+
children: [loading && /*#__PURE__*/_jsx("div", {
|
|
373
|
+
className: "nh:px-3 nh:py-4 nh:text-center nh:text-xs nh:text-gray-500",
|
|
374
|
+
children: t.loading
|
|
375
|
+
}), !loading && error && /*#__PURE__*/_jsx("div", {
|
|
376
|
+
className: "nh:px-3 nh:py-4 nh:text-center nh:text-xs nh:text-red-600",
|
|
377
|
+
children: t.loadFailed
|
|
378
|
+
}), !loading && !error && groups.length === 0 && /*#__PURE__*/_jsx("div", {
|
|
379
|
+
className: "nh:px-3 nh:py-4 nh:text-center nh:text-xs nh:text-gray-500",
|
|
380
|
+
children: t.noResults
|
|
381
|
+
}), groups.map(group => /*#__PURE__*/_jsxs("div", {
|
|
382
|
+
children: [!activeGroup && /*#__PURE__*/_jsx("div", {
|
|
383
|
+
className: "nh:px-3 nh:pt-2 nh:pb-1 nh:text-xs nh:font-semibold nh:tracking-wide nh:text-gray-500 nh:uppercase",
|
|
384
|
+
children: group.label
|
|
385
|
+
}), group.items.map(link_0 => {
|
|
386
|
+
const isSelected = link_0.path === href;
|
|
387
|
+
return /*#__PURE__*/_jsxs("button", {
|
|
388
|
+
type: "button",
|
|
389
|
+
onClick: () => {
|
|
390
|
+
onHrefChange(link_0.path);
|
|
391
|
+
setOpen(false);
|
|
392
|
+
},
|
|
393
|
+
className: `nh:flex nh:w-full nh:flex-col nh:items-start nh:gap-0.5 nh:px-3 nh:py-2 nh:text-left nh:hover:bg-(--nh-muted) ${isSelected ? "bg-(--nh-muted)" : ""}`,
|
|
394
|
+
children: [/*#__PURE__*/_jsxs("span", {
|
|
395
|
+
className: "nh:flex nh:w-full nh:items-center nh:gap-2 nh:text-sm",
|
|
396
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
397
|
+
className: "nh:truncate",
|
|
398
|
+
children: linkLabel(link_0, locale)
|
|
399
|
+
}), link_0.published === false && /*#__PURE__*/_jsx("span", {
|
|
400
|
+
className: "nh:shrink-0 nh:rounded-full nh:bg-amber-50 nh:px-1.5 nh:py-0.5 nh:text-[9px] nh:font-semibold nh:uppercase nh:tracking-wide nh:text-amber-600 nh:ring-1 nh:ring-inset nh:ring-amber-200",
|
|
401
|
+
children: t.draft
|
|
402
|
+
})]
|
|
403
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
404
|
+
className: "nh:w-full nh:truncate nh:font-mono nh:text-xs nh:text-gray-500",
|
|
405
|
+
title: link_0.path,
|
|
406
|
+
children: displayPath(link_0.path, locale)
|
|
407
|
+
})]
|
|
408
|
+
}, link_0.path);
|
|
409
|
+
})]
|
|
410
|
+
}, group.key))]
|
|
384
411
|
})]
|
|
385
|
-
}
|
|
386
|
-
})
|
|
412
|
+
})]
|
|
413
|
+
})
|
|
387
414
|
})]
|
|
388
|
-
})
|
|
389
|
-
});
|
|
390
|
-
let t13;
|
|
391
|
-
if ($[21] !== t11 || $[22] !== t12) {
|
|
392
|
-
t13 = /*#__PURE__*/_jsxs("div", {
|
|
393
|
-
className: t9,
|
|
394
|
-
children: [t11, t12]
|
|
395
415
|
});
|
|
396
|
-
$[
|
|
397
|
-
$[
|
|
398
|
-
$[
|
|
416
|
+
$[13] = activeGroup;
|
|
417
|
+
$[14] = anchors;
|
|
418
|
+
$[15] = editorLocale;
|
|
419
|
+
$[16] = error;
|
|
420
|
+
$[17] = href;
|
|
421
|
+
$[18] = links;
|
|
422
|
+
$[19] = loading;
|
|
423
|
+
$[20] = locale;
|
|
424
|
+
$[21] = mode;
|
|
425
|
+
$[22] = onHrefChange;
|
|
426
|
+
$[23] = onSubmit;
|
|
427
|
+
$[24] = open;
|
|
428
|
+
$[25] = query;
|
|
429
|
+
$[26] = t;
|
|
430
|
+
$[27] = unsafeHint;
|
|
431
|
+
$[28] = t8;
|
|
399
432
|
} else {
|
|
400
|
-
|
|
433
|
+
t8 = $[28];
|
|
401
434
|
}
|
|
402
|
-
return
|
|
435
|
+
return t8;
|
|
403
436
|
}
|
|
404
437
|
function _temp3(a_1, b_1) {
|
|
405
438
|
return a_1.order - b_1.order;
|