@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.
Files changed (74) hide show
  1. package/README.md +9 -0
  2. package/dist/puck-editor/index.d.ts +1 -1
  3. package/dist/puck-editor/index.js +1 -1
  4. package/dist/puck-editor/index.js.map +1 -1
  5. package/dist/puck-editor/internal/api/client.d.ts +4 -4
  6. package/dist/puck-editor/internal/api/client.js +14 -6
  7. package/dist/puck-editor/internal/api/client.js.map +1 -1
  8. package/dist/puck-editor/internal/api/create-puck-api.js +1 -1
  9. package/dist/puck-editor/internal/api/create-puck-api.js.map +1 -1
  10. package/dist/puck-editor/internal/api/handlers/template.d.ts +1 -1
  11. package/dist/puck-editor/internal/api/handlers/template.js +16 -4
  12. package/dist/puck-editor/internal/api/handlers/template.js.map +1 -1
  13. package/dist/puck-editor/internal/api/handlers/upload.js +6 -3
  14. package/dist/puck-editor/internal/api/handlers/upload.js.map +1 -1
  15. package/dist/puck-editor/internal/api/media-upload.d.ts +2 -2
  16. package/dist/puck-editor/internal/api/media-upload.js +6 -1
  17. package/dist/puck-editor/internal/api/media-upload.js.map +1 -1
  18. package/dist/puck-editor/internal/editor/picker-model.d.ts +1 -1
  19. package/dist/puck-editor/internal/editor/puck-editor.js +148 -134
  20. package/dist/puck-editor/internal/editor/puck-editor.js.map +1 -1
  21. package/dist/puck-editor/internal/editor-config.d.ts +5 -2
  22. package/dist/puck-editor/internal/editor-config.js +32 -26
  23. package/dist/puck-editor/internal/editor-config.js.map +1 -1
  24. package/dist/puck-editor/internal/fields/link-picker/link-picker-control.js +323 -290
  25. package/dist/puck-editor/internal/fields/link-picker/link-picker-control.js.map +1 -1
  26. package/dist/puck-editor/internal/fields/media-selector/image-upload-form.js +3 -2
  27. package/dist/puck-editor/internal/fields/media-selector/image-upload-form.js.map +1 -1
  28. package/dist/puck-editor/internal/fields/media-selector/media-selector-field.js +3 -4
  29. package/dist/puck-editor/internal/fields/media-selector/media-selector-field.js.map +1 -1
  30. package/dist/puck-editor/internal/fields/media-selector/use-media-library.d.ts +2 -2
  31. package/dist/puck-editor/internal/fields/media-selector/use-media-library.js +118 -101
  32. package/dist/puck-editor/internal/fields/media-selector/use-media-library.js.map +1 -1
  33. package/dist/puck-editor/internal/fields/media-selector/video-upload-form.js +3 -2
  34. package/dist/puck-editor/internal/fields/media-selector/video-upload-form.js.map +1 -1
  35. package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.d.ts +21 -13
  36. package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.js +9 -35
  37. package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.js.map +1 -1
  38. package/dist/puck-editor/internal/fields/node-selector/node-selector-field.d.ts +12 -0
  39. package/dist/puck-editor/internal/fields/node-selector/node-selector-field.js +56 -0
  40. package/dist/puck-editor/internal/fields/node-selector/node-selector-field.js.map +1 -0
  41. package/dist/puck-editor/internal/locale.d.ts +2 -6
  42. package/dist/puck-editor/internal/locale.js +6 -8
  43. package/dist/puck-editor/internal/locale.js.map +1 -1
  44. package/dist/puck-editor/internal/native-puck-dictionaries.d.ts +2 -0
  45. package/dist/puck-editor/internal/native-puck-dictionaries.js +160 -0
  46. package/dist/puck-editor/internal/native-puck-dictionaries.js.map +1 -0
  47. package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.d.ts +1 -2
  48. package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.js +4 -4
  49. package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.js.map +1 -1
  50. package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.d.ts +1 -2
  51. package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.js +0 -2
  52. package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.js.map +1 -1
  53. package/dist/puck-editor/internal/plugins/agent-plugin/templates.d.ts +2 -2
  54. package/dist/puck-editor/internal/plugins/agent-plugin/templates.js +7 -7
  55. package/dist/puck-editor/internal/plugins/agent-plugin/templates.js.map +1 -1
  56. package/dist/puck-editor/internal/plugins/templates-plugin/template-form.js +3 -1
  57. package/dist/puck-editor/internal/plugins/templates-plugin/template-form.js.map +1 -1
  58. package/dist/puck-editor/internal/plugins/templates-plugin/templates.d.ts +1 -1
  59. package/dist/puck-editor/internal/plugins/templates-plugin/templates.js +3 -3
  60. package/dist/puck-editor/internal/plugins/templates-plugin/templates.js.map +1 -1
  61. package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.js +32 -37
  62. package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.js.map +1 -1
  63. package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.d.ts +1 -1
  64. package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.js +95 -72
  65. package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.js.map +1 -1
  66. package/dist/puck-editor/internal/puck-wrapper.d.ts +1 -1
  67. package/dist/puck-editor/internal/puck-wrapper.js +89 -83
  68. package/dist/puck-editor/internal/puck-wrapper.js.map +1 -1
  69. package/dist/puck-editor/internal/use-puck-overlay.d.ts +3 -2
  70. package/dist/puck-editor/internal/use-puck-overlay.js +67 -56
  71. package/dist/puck-editor/internal/use-puck-overlay.js.map +1 -1
  72. package/dist/puck-editor/puck-theme.css +3 -3
  73. package/dist/theme.css +2 -2
  74. 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 { keepPreviousData, useQuery } from '@tanstack/react-query';
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(24);
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 = typeof window !== "undefined" ? getPathLocale(window.location.pathname) : "en";
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
- bb1: {
140
- if (!links) {
141
- t5 = [];
142
- break bb1;
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] = onSubmit;
181
- $[7] = t6;
104
+ $[6] = locale;
105
+ $[7] = t4;
106
+ $[8] = t5;
182
107
  } else {
183
- t6 = $[7];
108
+ t4 = $[7];
109
+ t5 = $[8];
184
110
  }
185
- const submitOnEnter = t6;
111
+ const t6 = mode === "internal" && open;
186
112
  let t7;
187
- if ($[8] !== href || $[9] !== onHrefChange) {
188
- t7 = () => {
189
- if (isSafeHref(href)) {
190
- return false;
191
- }
192
- onHrefChange("");
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
- $[8] = href;
197
- $[9] = onHrefChange;
198
- $[10] = t7;
120
+ $[9] = t4;
121
+ $[10] = t5;
122
+ $[11] = t6;
123
+ $[12] = t7;
199
124
  } else {
200
- t7 = $[10];
125
+ t7 = $[12];
201
126
  }
202
- const neutralizeUnsafe = t7;
127
+ const {
128
+ data: links,
129
+ isLoading: loading,
130
+ isError: error
131
+ } = useQuery(t7);
203
132
  let t8;
204
- if ($[11] !== mode || $[12] !== onHrefChange) {
205
- t8 = next => {
206
- if (next === mode) {
207
- return;
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
- $[16] = mode;
244
- $[17] = switchMode;
245
- $[18] = t.linkMode;
246
- $[19] = t10;
247
- $[20] = t11;
248
- } else {
249
- t11 = $[20];
250
- }
251
- const t12 = mode === "external" ? /*#__PURE__*/_jsxs(_Fragment, {
252
- children: [/*#__PURE__*/_jsx("input", {
253
- type: "text",
254
- value: href,
255
- placeholder: t.externalPlaceholder,
256
- onChange: e_0 => {
257
- setUnsafeHint(false);
258
- onHrefChange(e_0.target.value);
259
- },
260
- onKeyDown: e_1 => {
261
- if (e_1.key === "Enter" && neutralizeUnsafe()) {
262
- e_1.preventDefault();
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
- submitOnEnter(e_1);
266
- },
267
- onBlur: () => neutralizeUnsafe(),
268
- className: "nh:w-full nh:rounded-sm nh:border nh:border-(--nh-border) nh:p-3 nh:text-sm"
269
- }), unsafeHint && /*#__PURE__*/_jsx("p", {
270
- className: "nh:text-xs nh:text-red-600",
271
- children: t.unsafeLink
272
- })]
273
- }) : mode === "anchor" ? /*#__PURE__*/_jsx(AnchorInput, {
274
- href: href,
275
- anchors: anchors,
276
- onHrefChange: onHrefChange,
277
- onSubmit: onSubmit
278
- }) : /*#__PURE__*/_jsx(Popover.Root, {
279
- open: open,
280
- onOpenChange: setOpen,
281
- children: /*#__PURE__*/_jsxs("div", {
282
- className: "nh:relative",
283
- children: [/*#__PURE__*/_jsx(Popover.Trigger, {
284
- asChild: true,
285
- children: /*#__PURE__*/_jsxs("button", {
286
- type: "button",
287
- 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)",
288
- children: [/*#__PURE__*/_jsxs("span", {
289
- className: "nh:flex nh:min-w-0 nh:items-center nh:gap-2",
290
- children: [/*#__PURE__*/_jsx("span", {
291
- className: isEmptyValue(href) ? "nh:truncate nh:text-gray-500" : "nh:truncate",
292
- children: isEmptyValue(href) ? t.selectPage : selectedLink ? linkLabel(selectedLink, locale) : href
293
- }), selectedLink?.published === false && /*#__PURE__*/_jsx("span", {
294
- 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",
295
- children: t.draft
296
- })]
297
- }), /*#__PURE__*/_jsxs("span", {
298
- className: "nh:flex nh:shrink-0 nh:items-center nh:gap-1",
299
- children: [!isEmptyValue(href) && /*#__PURE__*/_jsx(X, {
300
- className: "nh:size-4 nh:text-gray-500 nh:hover:text-(--nh-fg)",
301
- onClick: e_2 => {
302
- e_2.stopPropagation();
303
- onHrefChange("");
304
- }
305
- }), /*#__PURE__*/_jsx(ChevronDown, {
306
- className: "nh:size-4 nh:text-gray-500"
307
- })]
308
- })]
309
- })
310
- }), !isEmptyValue(href) && /*#__PURE__*/_jsx("div", {
311
- className: "nh:mt-1 nh:truncate nh:font-mono nh:text-xs nh:text-gray-500",
312
- title: href,
313
- children: displayPath(href, locale)
314
- }), /*#__PURE__*/_jsxs(Popover.Content, {
315
- align: "start",
316
- sideOffset: 4,
317
- "data-puck-rte-menu": true,
318
- 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",
319
- children: [/*#__PURE__*/_jsxs("div", {
320
- className: "nh:flex nh:items-center nh:gap-2 nh:border-b nh:border-(--nh-border) nh:p-2",
321
- children: [/*#__PURE__*/_jsx(Search, {
322
- className: "nh:size-4 nh:shrink-0 nh:text-gray-500"
323
- }), /*#__PURE__*/_jsx("input", {
324
- type: "text",
325
- autoFocus: true,
326
- value: query,
327
- placeholder: t.searchPlaceholder,
328
- onChange: e_3 => setQuery(e_3.target.value),
329
- className: "nh:w-full nh:text-sm outline-none"
330
- })]
331
- }), availableGroups.length > 1 && /*#__PURE__*/_jsx("div", {
332
- className: "nh:flex nh:flex-wrap nh:gap-1 nh:border-b nh:border-(--nh-border) nh:p-2",
333
- children: [{
334
- key: null,
335
- label: t.all
336
- }, ...availableGroups].map(chip => {
337
- const isActive = activeGroup === chip.key;
338
- return /*#__PURE__*/_jsx("button", {
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
- onClick: () => setActiveGroup(chip.key),
341
- 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"}`,
342
- children: chip.label
343
- }, chip.key ?? "__all");
344
- })
345
- }), /*#__PURE__*/_jsxs("div", {
346
- className: "nh:max-h-72 nh:overflow-y-auto nh:py-1",
347
- children: [loading && /*#__PURE__*/_jsx("div", {
348
- className: "nh:px-3 nh:py-4 nh:text-center nh:text-xs nh:text-gray-500",
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
- }, link_0.path);
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
- }, group.key))]
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
- $[21] = t11;
397
- $[22] = t12;
398
- $[23] = t13;
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
- t13 = $[23];
433
+ t8 = $[28];
401
434
  }
402
- return t13;
435
+ return t8;
403
436
  }
404
437
  function _temp3(a_1, b_1) {
405
438
  return a_1.order - b_1.order;