@bettercms-ai/kit 3.0.0 → 3.0.2

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 (157) hide show
  1. package/dist/brand/logo.js +67 -18
  2. package/dist/brand/logo.js.map +1 -1
  3. package/dist/context.js +8 -3
  4. package/dist/context.js.map +1 -1
  5. package/dist/controls/button.js +451 -134
  6. package/dist/controls/button.js.map +1 -1
  7. package/dist/controls/choice.js +336 -95
  8. package/dist/controls/choice.js.map +1 -1
  9. package/dist/controls/code.js +245 -72
  10. package/dist/controls/code.js.map +1 -1
  11. package/dist/controls/color.js +108 -31
  12. package/dist/controls/color.js.map +1 -1
  13. package/dist/controls/date.js +268 -83
  14. package/dist/controls/date.js.map +1 -1
  15. package/dist/controls/form-picker.js +26 -9
  16. package/dist/controls/form-picker.js.map +1 -1
  17. package/dist/controls/icon.js +341 -100
  18. package/dist/controls/icon.js.map +1 -1
  19. package/dist/controls/json.js +20 -7
  20. package/dist/controls/json.js.map +1 -1
  21. package/dist/controls/link.js +561 -156
  22. package/dist/controls/link.js.map +1 -1
  23. package/dist/controls/location.js +124 -35
  24. package/dist/controls/location.js.map +1 -1
  25. package/dist/controls/media.js +928 -267
  26. package/dist/controls/media.js.map +1 -1
  27. package/dist/controls/number.js +80 -23
  28. package/dist/controls/number.js.map +1 -1
  29. package/dist/controls/reference.js +516 -155
  30. package/dist/controls/reference.js.map +1 -1
  31. package/dist/controls/rich-text/article-shell.js +327 -86
  32. package/dist/controls/rich-text/article-shell.js.map +1 -1
  33. package/dist/controls/rich-text/author.js +78 -21
  34. package/dist/controls/rich-text/author.js.map +1 -1
  35. package/dist/controls/rich-text/blocks.js +1084 -315
  36. package/dist/controls/rich-text/blocks.js.map +1 -1
  37. package/dist/controls/rich-text/button.js +30 -9
  38. package/dist/controls/rich-text/button.js.map +1 -1
  39. package/dist/controls/rich-text/catalog.js +168 -51
  40. package/dist/controls/rich-text/catalog.js.map +1 -1
  41. package/dist/controls/rich-text/columns.js +104 -31
  42. package/dist/controls/rich-text/columns.js.map +1 -1
  43. package/dist/controls/rich-text/component-card.js +790 -209
  44. package/dist/controls/rich-text/component-card.js.map +1 -1
  45. package/dist/controls/rich-text/component-panel.js +102 -40
  46. package/dist/controls/rich-text/component-panel.js.map +1 -1
  47. package/dist/controls/rich-text/control.js +101 -32
  48. package/dist/controls/rich-text/control.js.map +1 -1
  49. package/dist/controls/rich-text/editor.js +423 -121
  50. package/dist/controls/rich-text/editor.js.map +1 -1
  51. package/dist/controls/rich-text/embed.js +184 -51
  52. package/dist/controls/rich-text/embed.js.map +1 -1
  53. package/dist/controls/rich-text/floating.js +171 -42
  54. package/dist/controls/rich-text/floating.js.map +1 -1
  55. package/dist/controls/rich-text/footnote.js +89 -28
  56. package/dist/controls/rich-text/footnote.js.map +1 -1
  57. package/dist/controls/rich-text/gallery.js +88 -27
  58. package/dist/controls/rich-text/gallery.js.map +1 -1
  59. package/dist/controls/rich-text/link-form.js +111 -34
  60. package/dist/controls/rich-text/link-form.js.map +1 -1
  61. package/dist/controls/rich-text/plain.js +8 -3
  62. package/dist/controls/rich-text/plain.js.map +1 -1
  63. package/dist/controls/rich-text/related.js +86 -25
  64. package/dist/controls/rich-text/related.js.map +1 -1
  65. package/dist/controls/rich-text/toc.js +48 -15
  66. package/dist/controls/rich-text/toc.js.map +1 -1
  67. package/dist/controls/rich-text/toolbar.js +408 -107
  68. package/dist/controls/rich-text/toolbar.js.map +1 -1
  69. package/dist/controls/scale.js +169 -52
  70. package/dist/controls/scale.js.map +1 -1
  71. package/dist/controls/slot.js +238 -73
  72. package/dist/controls/slot.js.map +1 -1
  73. package/dist/controls/table/table-editor.js +1766 -500
  74. package/dist/controls/table/table-editor.js.map +1 -1
  75. package/dist/controls/table/table-link.js +119 -38
  76. package/dist/controls/table/table-link.js.map +1 -1
  77. package/dist/controls/table/table.js +26 -9
  78. package/dist/controls/table/table.js.map +1 -1
  79. package/dist/controls/text.js +221 -68
  80. package/dist/controls/text.js.map +1 -1
  81. package/dist/controls/unknown-value.js +79 -22
  82. package/dist/controls/unknown-value.js.map +1 -1
  83. package/dist/engine/array.js +875 -233
  84. package/dist/engine/array.js.map +1 -1
  85. package/dist/engine/bits.js +38 -13
  86. package/dist/engine/bits.js.map +1 -1
  87. package/dist/engine/breadcrumb.js +25 -8
  88. package/dist/engine/breadcrumb.js.map +1 -1
  89. package/dist/engine/expand.js +38 -13
  90. package/dist/engine/expand.js.map +1 -1
  91. package/dist/engine/field-list.js +14 -5
  92. package/dist/engine/field-list.js.map +1 -1
  93. package/dist/engine/field-shell.js +849 -244
  94. package/dist/engine/field-shell.js.map +1 -1
  95. package/dist/engine/frame.js +275 -78
  96. package/dist/engine/frame.js.map +1 -1
  97. package/dist/engine/grouping.js +630 -193
  98. package/dist/engine/grouping.js.map +1 -1
  99. package/dist/engine/item-list.js +187 -50
  100. package/dist/engine/item-list.js.map +1 -1
  101. package/dist/engine/kit-field.js +320 -95
  102. package/dist/engine/kit-field.js.map +1 -1
  103. package/dist/engine/schema-form.js +101 -32
  104. package/dist/engine/schema-form.js.map +1 -1
  105. package/dist/engine/slot.js +146 -45
  106. package/dist/engine/slot.js.map +1 -1
  107. package/dist/index.js +2 -2
  108. package/dist/lib/icons.js +14 -5
  109. package/dist/lib/icons.js.map +1 -1
  110. package/dist/styles.css +5821 -1
  111. package/dist/table/table-view.js +49 -16
  112. package/dist/table/table-view.js.map +1 -1
  113. package/dist/testing/test-form.js +14 -5
  114. package/dist/testing/test-form.js.map +1 -1
  115. package/dist/theme.js +8 -3
  116. package/dist/theme.js.map +1 -1
  117. package/dist/ui/action-tray.js +97 -24
  118. package/dist/ui/action-tray.js.map +1 -1
  119. package/dist/ui/autocomplete.js +135 -38
  120. package/dist/ui/autocomplete.js.map +1 -1
  121. package/dist/ui/button.js +108 -31
  122. package/dist/ui/button.js.map +1 -1
  123. package/dist/ui/choice-switch.js +14 -5
  124. package/dist/ui/choice-switch.js.map +1 -1
  125. package/dist/ui/controls.js +279 -86
  126. package/dist/ui/controls.js.map +1 -1
  127. package/dist/ui/display.js +401 -116
  128. package/dist/ui/display.js.map +1 -1
  129. package/dist/ui/expanded-editor-modal.js +100 -27
  130. package/dist/ui/expanded-editor-modal.js.map +1 -1
  131. package/dist/ui/floating-panel.js +130 -37
  132. package/dist/ui/floating-panel.js.map +1 -1
  133. package/dist/ui/index.js +2 -2
  134. package/dist/ui/input.js +196 -59
  135. package/dist/ui/input.js.map +1 -1
  136. package/dist/ui/mode-bar.js +32 -11
  137. package/dist/ui/mode-bar.js.map +1 -1
  138. package/dist/ui/overlay.js +616 -179
  139. package/dist/ui/overlay.js.map +1 -1
  140. package/dist/ui/path-crumbs.js +374 -113
  141. package/dist/ui/path-crumbs.js.map +1 -1
  142. package/dist/ui/select.js +311 -78
  143. package/dist/ui/select.js.map +1 -1
  144. package/dist/ui/shortcut-hint.d.ts +3 -0
  145. package/dist/ui/shortcut-hint.js +33 -7
  146. package/dist/ui/shortcut-hint.js.map +1 -1
  147. package/dist/ui/spinner.js +20 -7
  148. package/dist/ui/spinner.js.map +1 -1
  149. package/dist/ui/split-button.js +35 -10
  150. package/dist/ui/split-button.js.map +1 -1
  151. package/dist/ui/tab.js +50 -17
  152. package/dist/ui/tab.js.map +1 -1
  153. package/dist/ui/toast.js +107 -30
  154. package/dist/ui/toast.js.map +1 -1
  155. package/dist/ui/tooltip-root.js +24 -7
  156. package/dist/ui/tooltip-root.js.map +1 -1
  157. package/package.json +2 -2
@@ -3,7 +3,7 @@ import { Switch } from "../../ui/controls.js";
3
3
  import { Input } from "../../ui/input.js";
4
4
  import { LinkLine, normLink } from "../link.js";
5
5
  import * as React from "react";
6
- import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { jsxDEV } from "react/jsx-dev-runtime";
7
7
  import { IconLink } from "@tabler/icons-react";
8
8
  //#region src/controls/rich-text/link-form.tsx
9
9
  /**
@@ -12,6 +12,7 @@ import { IconLink } from "@tabler/icons-react";
12
12
  * the resolved href, target and rel (`toLinkValue` / `fromLinkValue`). `LinkForm` below is the address-only form an
13
13
  * image block links with.
14
14
  */
15
+ var _jsxFileName = "D:/Github/bettercms/bettercms-backend/packages/kit/src/controls/rich-text/link-form.tsx";
15
16
  var RELS = [
16
17
  "nofollow",
17
18
  "sponsored",
@@ -65,7 +66,7 @@ function LinkForm({ initial, allowNewTab, onSave, onCancel, onDetach, dirty = fa
65
66
  const start = initial.href.trim();
66
67
  const changed = dirty || href.trim() !== start || allowNewTab && newTab !== !!initial.newTab;
67
68
  const ok = !linkProblem(href);
68
- return /* @__PURE__ */ jsxs("form", {
69
+ return /* @__PURE__ */ jsxDEV("form", {
69
70
  className: "flex flex-col gap-3",
70
71
  onSubmit: (e) => {
71
72
  e.preventDefault();
@@ -77,34 +78,58 @@ function LinkForm({ initial, allowNewTab, onSave, onCancel, onDetach, dirty = fa
77
78
  });
78
79
  },
79
80
  children: [
80
- /* @__PURE__ */ jsxs("div", {
81
+ /* @__PURE__ */ jsxDEV("div", {
81
82
  className: "flex min-w-0 flex-col gap-1",
82
- children: [/* @__PURE__ */ jsx("span", {
83
+ children: [/* @__PURE__ */ jsxDEV("span", {
83
84
  className: "text-kit-sm font-medium text-kit-fg",
84
85
  children: "Link"
85
- }), start ? /* @__PURE__ */ jsx("span", {
86
+ }, void 0, false, {
87
+ fileName: _jsxFileName,
88
+ lineNumber: 91,
89
+ columnNumber: 9
90
+ }, this), start ? /* @__PURE__ */ jsxDEV("span", {
86
91
  className: "flex min-w-0 text-kit-fg-2",
87
- children: /* @__PURE__ */ jsx(LinkLine, { v: normLink({
92
+ children: /* @__PURE__ */ jsxDEV(LinkLine, { v: normLink({
88
93
  href: start,
89
94
  newTab: !!initial.newTab
90
- }) })
91
- }) : /* @__PURE__ */ jsx("span", {
95
+ }) }, void 0, false, {
96
+ fileName: _jsxFileName,
97
+ lineNumber: 94,
98
+ columnNumber: 13
99
+ }, this)
100
+ }, void 0, false, {
101
+ fileName: _jsxFileName,
102
+ lineNumber: 93,
103
+ columnNumber: 11
104
+ }, this) : /* @__PURE__ */ jsxDEV("span", {
92
105
  className: "text-kit-xs text-kit-fg-3",
93
106
  children: "No link yet"
94
- })]
95
- }),
96
- /* @__PURE__ */ jsxs("div", {
107
+ }, void 0, false, {
108
+ fileName: _jsxFileName,
109
+ lineNumber: 97,
110
+ columnNumber: 11
111
+ }, this)]
112
+ }, void 0, true, {
113
+ fileName: _jsxFileName,
114
+ lineNumber: 90,
115
+ columnNumber: 7
116
+ }, this),
117
+ /* @__PURE__ */ jsxDEV("div", {
97
118
  className: "flex flex-col gap-1.5",
98
119
  onBlur: (e) => {
99
120
  if (!e.currentTarget.contains(e.relatedTarget) && href.trim()) setProblem(linkProblem(href));
100
121
  },
101
122
  children: [
102
- /* @__PURE__ */ jsx("label", {
123
+ /* @__PURE__ */ jsxDEV("label", {
103
124
  htmlFor: urlId,
104
125
  className: "text-kit-xs text-kit-fg-2",
105
126
  children: "Link to"
106
- }),
107
- /* @__PURE__ */ jsx(Input, {
127
+ }, void 0, false, {
128
+ fileName: _jsxFileName,
129
+ lineNumber: 106,
130
+ columnNumber: 9
131
+ }, this),
132
+ /* @__PURE__ */ jsxDEV(Input, {
108
133
  id: urlId,
109
134
  autoFocus: true,
110
135
  size: "sm",
@@ -120,60 +145,112 @@ function LinkForm({ initial, allowNewTab, onSave, onCancel, onDetach, dirty = fa
120
145
  }
121
146
  },
122
147
  placeholder: "https://… or /page",
123
- leading: /* @__PURE__ */ jsx(IconLink, { stroke: 1.5 }),
148
+ leading: /* @__PURE__ */ jsxDEV(IconLink, { stroke: 1.5 }, void 0, false, {
149
+ fileName: _jsxFileName,
150
+ lineNumber: 126,
151
+ columnNumber: 20
152
+ }, this),
124
153
  "aria-invalid": problem ? true : void 0,
125
154
  "aria-describedby": problem ? errId : void 0
126
- }),
127
- problem ? /* @__PURE__ */ jsx("p", {
155
+ }, void 0, false, {
156
+ fileName: _jsxFileName,
157
+ lineNumber: 109,
158
+ columnNumber: 9
159
+ }, this),
160
+ problem ? /* @__PURE__ */ jsxDEV("p", {
128
161
  id: errId,
129
162
  role: "alert",
130
163
  className: "text-kit-xs text-kit-danger-fg",
131
164
  children: problem
132
- }) : null
165
+ }, void 0, false, {
166
+ fileName: _jsxFileName,
167
+ lineNumber: 131,
168
+ columnNumber: 11
169
+ }, this) : null
133
170
  ]
134
- }),
135
- allowNewTab ? /* @__PURE__ */ jsxs("label", {
171
+ }, void 0, true, {
172
+ fileName: _jsxFileName,
173
+ lineNumber: 100,
174
+ columnNumber: 7
175
+ }, this),
176
+ allowNewTab ? /* @__PURE__ */ jsxDEV("label", {
136
177
  htmlFor: tabId,
137
178
  className: "flex min-h-7 items-center justify-between gap-3",
138
- children: [/* @__PURE__ */ jsx("span", {
179
+ children: [/* @__PURE__ */ jsxDEV("span", {
139
180
  className: "text-kit-xs text-kit-fg-2",
140
181
  children: "Open in new tab"
141
- }), /* @__PURE__ */ jsx(Switch, {
182
+ }, void 0, false, {
183
+ fileName: _jsxFileName,
184
+ lineNumber: 138,
185
+ columnNumber: 11
186
+ }, this), /* @__PURE__ */ jsxDEV(Switch, {
142
187
  id: tabId,
143
188
  size: "sm",
144
189
  checked: newTab,
145
190
  onCheckedChange: setNewTab
146
- })]
147
- }) : null,
148
- /* @__PURE__ */ jsxs("div", {
191
+ }, void 0, false, {
192
+ fileName: _jsxFileName,
193
+ lineNumber: 139,
194
+ columnNumber: 11
195
+ }, this)]
196
+ }, void 0, true, {
197
+ fileName: _jsxFileName,
198
+ lineNumber: 137,
199
+ columnNumber: 9
200
+ }, this) : null,
201
+ /* @__PURE__ */ jsxDEV("div", {
149
202
  className: "flex items-center gap-2 border-t border-kit-line pt-2.5",
150
203
  children: [
151
- onDetach ? /* @__PURE__ */ jsx(Button, {
204
+ onDetach ? /* @__PURE__ */ jsxDEV(Button, {
152
205
  type: "button",
153
206
  size: "xs",
154
207
  variant: "danger-ghost",
155
208
  onClick: onDetach,
156
209
  children: "Remove link"
157
- }) : null,
158
- /* @__PURE__ */ jsx("span", { className: "flex-1" }),
159
- /* @__PURE__ */ jsx(Button, {
210
+ }, void 0, false, {
211
+ fileName: _jsxFileName,
212
+ lineNumber: 144,
213
+ columnNumber: 11
214
+ }, this) : null,
215
+ /* @__PURE__ */ jsxDEV("span", { className: "flex-1" }, void 0, false, {
216
+ fileName: _jsxFileName,
217
+ lineNumber: 148,
218
+ columnNumber: 9
219
+ }, this),
220
+ /* @__PURE__ */ jsxDEV(Button, {
160
221
  type: "button",
161
222
  size: "xs",
162
223
  variant: "ghost",
163
224
  onClick: onCancel,
164
225
  children: "Cancel"
165
- }),
166
- /* @__PURE__ */ jsx(Button, {
226
+ }, void 0, false, {
227
+ fileName: _jsxFileName,
228
+ lineNumber: 149,
229
+ columnNumber: 9
230
+ }, this),
231
+ /* @__PURE__ */ jsxDEV(Button, {
167
232
  type: "submit",
168
233
  size: "xs",
169
234
  variant: "primary",
170
235
  disabled: !changed || !ok,
171
236
  children: "Apply"
172
- })
237
+ }, void 0, false, {
238
+ fileName: _jsxFileName,
239
+ lineNumber: 152,
240
+ columnNumber: 9
241
+ }, this)
173
242
  ]
174
- })
243
+ }, void 0, true, {
244
+ fileName: _jsxFileName,
245
+ lineNumber: 142,
246
+ columnNumber: 7
247
+ }, this)
175
248
  ]
176
- });
249
+ }, void 0, true, {
250
+ fileName: _jsxFileName,
251
+ lineNumber: 81,
252
+ columnNumber: 5
253
+ }, this);
177
254
  }
178
255
  //#endregion
179
256
  export { LinkForm, applyTextLink, fromLinkValue, linkProblem, textLinkOf, toLinkValue };
@@ -1 +1 @@
1
- {"version":3,"file":"link-form.js","names":[],"sources":["../../../src/controls/rich-text/link-form.tsx"],"sourcesContent":["/**\n * RICH TEXT · a link inside the text. A text link and a button are edited in V2's own link panel (controls/link.tsx\n * LinkPopoverBody: Type, the page/section/address, new tab and Rel; RTE:1696) and stored as production's link mark:\n * the resolved href, target and rel (`toLinkValue` / `fromLinkValue`). `LinkForm` below is the address-only form an\n * image block links with.\n */\nimport * as React from \"react\";\nimport { IconLink } from \"@tabler/icons-react\";\nimport { Button } from \"../../ui/button\";\nimport { Switch } from \"../../ui/controls\";\nimport { Input } from \"../../ui/input\";\nimport { LinkLine, normLink, type LinkRel, type LinkValue } from \"../link\";\n\nexport interface TextLink {\n href: string;\n newTab?: boolean;\n /** absent = follow (V2 writes no rel for it) */\n rel?: Exclude<LinkRel, \"follow\">;\n}\n\nconst RELS: Exclude<LinkRel, \"follow\">[] = [\"nofollow\", \"sponsored\", \"ugc\"];\n/** An anchor's link as stored: href, a new tab, and its rel (a new tab's noopener/noreferrer are the renderer's). */\nexport function textLinkOf(a: HTMLAnchorElement): TextLink {\n const tokens = (a.getAttribute(\"rel\") ?? \"\").toLowerCase().split(/\\s+/);\n const rel = RELS.find((r) => tokens.includes(r));\n return { href: a.getAttribute(\"href\") ?? \"\", newTab: a.getAttribute(\"target\") === \"_blank\", ...(rel ? { rel } : {}) };\n}\n/** Writes a link onto its anchor: href, target and rel (none for follow). */\nexport function applyTextLink(a: HTMLAnchorElement, l: TextLink) {\n a.setAttribute(\"href\", l.href);\n if (l.newTab) a.setAttribute(\"target\", \"_blank\");\n else a.removeAttribute(\"target\");\n if (l.rel) a.setAttribute(\"rel\", l.rel);\n else a.removeAttribute(\"rel\");\n}\nexport const toLinkValue = (l: TextLink): LinkValue => ({ href: l.href, newTab: !!l.newTab, rel: l.rel ?? \"follow\" });\n/** V2 saveLink (RTE:883-899): the resolved href is what is stored; a page or section pick re-reads from it. */\nexport const fromLinkValue = (v: LinkValue, allowNewTab: boolean): TextLink => ({\n href: v.href,\n newTab: allowNewTab && !!v.newTab,\n ...(v.rel && v.rel !== \"follow\" ? { rel: v.rel } : {}),\n});\n\n/** An address a link may carry: http(s), mailto, tel, a site path or an in-page anchor. */\nexport function linkProblem(href: string): string | null {\n const h = href.trim();\n if (!h) return \"Add an address first.\";\n if (/^(https?:\\/\\/[^\\s]+|mailto:[^\\s]+|tel:[+\\d][\\d\\s()-]*|\\/(?!\\/)[^\\s]*|#[^\\s]+)$/i.test(h)) return null;\n if (/^[a-z][a-z0-9+.-]*:/i.test(h)) return \"Use an address that starts with https://, mailto: or tel:.\";\n if (/^[^\\s/]+\\.[^\\s]+$/.test(h)) return `Add https:// in front: https://${h}`;\n return \"Use a full address (https://…), a page path (/about) or an anchor (#section).\";\n}\n\nexport function LinkForm({\n initial,\n allowNewTab,\n onSave,\n onCancel,\n onDetach,\n dirty = false,\n}: {\n initial: TextLink;\n allowNewTab: boolean;\n onSave: (v: TextLink) => void;\n onCancel: () => void;\n onDetach?: () => void;\n /** something the host draws beside the form changed (a button's label), so Apply has something to save */\n dirty?: boolean;\n}) {\n const [href, setHref] = React.useState(initial.href);\n const [newTab, setNewTab] = React.useState(!!initial.newTab);\n const [problem, setProblem] = React.useState<string | null>(null);\n const urlId = React.useId();\n const tabId = React.useId();\n const errId = React.useId();\n const start = initial.href.trim();\n // V2 LinkPopoverBody (controls/link.tsx): Apply only when something changed and the link can be saved\n const changed = dirty || href.trim() !== start || (allowNewTab && newTab !== !!initial.newTab);\n const ok = !linkProblem(href);\n return (\n <form\n className=\"flex flex-col gap-3\"\n onSubmit={(e) => {\n e.preventDefault();\n const p = linkProblem(href);\n setProblem(p);\n if (!p) onSave({ href: href.trim(), newTab: allowNewTab && newTab });\n }}\n >\n <div className=\"flex min-w-0 flex-col gap-1\">\n <span className=\"text-kit-sm font-medium text-kit-fg\">Link</span>\n {start ? (\n <span className=\"flex min-w-0 text-kit-fg-2\">\n <LinkLine v={normLink({ href: start, newTab: !!initial.newTab })} />\n </span>\n ) : (\n <span className=\"text-kit-xs text-kit-fg-3\">No link yet</span>\n )}\n </div>\n <div\n className=\"flex flex-col gap-1.5\"\n onBlur={(e) => {\n if (!e.currentTarget.contains(e.relatedTarget as Node) && href.trim()) setProblem(linkProblem(href));\n }}\n >\n <label htmlFor={urlId} className=\"text-kit-xs text-kit-fg-2\">\n Link to\n </label>\n <Input\n id={urlId}\n autoFocus\n size=\"sm\"\n value={href}\n onChange={(e) => {\n setHref(e.target.value);\n if (problem) setProblem(null);\n }}\n onKeyDown={(e) => {\n // Apply is disabled while the address cannot be saved, so Enter says why instead of doing nothing\n if (e.key === \"Enter\" && !ok) {\n e.preventDefault();\n setProblem(linkProblem(href));\n }\n }}\n placeholder=\"https://… or /page\"\n leading={<IconLink stroke={1.5} />}\n aria-invalid={problem ? true : undefined}\n aria-describedby={problem ? errId : undefined}\n />\n {problem ? (\n <p id={errId} role=\"alert\" className=\"text-kit-xs text-kit-danger-fg\">\n {problem}\n </p>\n ) : null}\n </div>\n {allowNewTab ? (\n <label htmlFor={tabId} className=\"flex min-h-7 items-center justify-between gap-3\">\n <span className=\"text-kit-xs text-kit-fg-2\">Open in new tab</span>\n <Switch id={tabId} size=\"sm\" checked={newTab} onCheckedChange={setNewTab} />\n </label>\n ) : null}\n <div className=\"flex items-center gap-2 border-t border-kit-line pt-2.5\">\n {onDetach ? (\n <Button type=\"button\" size=\"xs\" variant=\"danger-ghost\" onClick={onDetach}>\n Remove link\n </Button>\n ) : null}\n <span className=\"flex-1\" />\n <Button type=\"button\" size=\"xs\" variant=\"ghost\" onClick={onCancel}>\n Cancel\n </Button>\n <Button type=\"submit\" size=\"xs\" variant=\"primary\" disabled={!changed || !ok}>\n Apply\n </Button>\n </div>\n </form>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAoBA,IAAM,OAAqC;CAAC;CAAY;CAAa;AAAK;;AAE1E,SAAgB,WAAW,GAAgC;CACzD,MAAM,UAAU,EAAE,aAAa,KAAK,KAAK,GAAA,CAAI,YAAY,CAAC,CAAC,MAAM,KAAK;CACtE,MAAM,MAAM,KAAK,MAAM,MAAM,OAAO,SAAS,CAAC,CAAC;CAC/C,OAAO;EAAE,MAAM,EAAE,aAAa,MAAM,KAAK;EAAI,QAAQ,EAAE,aAAa,QAAQ,MAAM;EAAU,GAAI,MAAM,EAAE,IAAI,IAAI,CAAC;CAAG;AACtH;;AAEA,SAAgB,cAAc,GAAs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AK;MAAQ,WAAU;MAClC,UAAA;KACA,CAAA,IACD;IACD;;GACJ,cACC,qBAAC,SAAD;IAAO,SAAS;IAAO,WAAU;IAAjC,UAAA,CACE,oBAAC,QAAD;KAAM,WAAU;KAA4B,UAAA;IAAqB,CAAA,GACjE,oBAAC,QAAD;KAAQ,IAAI;KAAO,MAAK;KAAK,SAAS;KAAQ,iBAAiB;IAAY,CAAA,CACtE;GACL,CAAA,IAAA;GACJ,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACG,WACC,oBAAC,QAAD;MAAQ,MAAK;MAAS,MAAK;MAAK,SAAQ;MAAe,SAAS;MAAU,UAAA;KAElE,CAAA,IACN;KACJ,oBAAC,QAAD,EAAM,WAAU,SAAU,CAAA;KAC1B,oBAAC,QAAD;MAAQ,MAAK;MAAS,MAAK;MAAK,SAAQ;MAAQ,SAAS;MAAU,UAAA;KAE3D,CAAA;KACR,oBAAC,QAAD;MAAQ,MAAK;MAAS,MAAK;MAAK,SAAQ;MAAU,UAAU,CAAC,WAAW,CAAC;MAAI,UAAA;KAErE,CAAA;IACL;;EACD;;AAEV"}
1
+ {"version":3,"file":"link-form.js","names":[],"sources":["../../../src/controls/rich-text/link-form.tsx"],"sourcesContent":["/**\n * RICH TEXT · a link inside the text. A text link and a button are edited in V2's own link panel (controls/link.tsx\n * LinkPopoverBody: Type, the page/section/address, new tab and Rel; RTE:1696) and stored as production's link mark:\n * the resolved href, target and rel (`toLinkValue` / `fromLinkValue`). `LinkForm` below is the address-only form an\n * image block links with.\n */\nimport * as React from \"react\";\nimport { IconLink } from \"@tabler/icons-react\";\nimport { Button } from \"../../ui/button\";\nimport { Switch } from \"../../ui/controls\";\nimport { Input } from \"../../ui/input\";\nimport { LinkLine, normLink, type LinkRel, type LinkValue } from \"../link\";\n\nexport interface TextLink {\n href: string;\n newTab?: boolean;\n /** absent = follow (V2 writes no rel for it) */\n rel?: Exclude<LinkRel, \"follow\">;\n}\n\nconst RELS: Exclude<LinkRel, \"follow\">[] = [\"nofollow\", \"sponsored\", \"ugc\"];\n/** An anchor's link as stored: href, a new tab, and its rel (a new tab's noopener/noreferrer are the renderer's). */\nexport function textLinkOf(a: HTMLAnchorElement): TextLink {\n const tokens = (a.getAttribute(\"rel\") ?? \"\").toLowerCase().split(/\\s+/);\n const rel = RELS.find((r) => tokens.includes(r));\n return { href: a.getAttribute(\"href\") ?? \"\", newTab: a.getAttribute(\"target\") === \"_blank\", ...(rel ? { rel } : {}) };\n}\n/** Writes a link onto its anchor: href, target and rel (none for follow). */\nexport function applyTextLink(a: HTMLAnchorElement, l: TextLink) {\n a.setAttribute(\"href\", l.href);\n if (l.newTab) a.setAttribute(\"target\", \"_blank\");\n else a.removeAttribute(\"target\");\n if (l.rel) a.setAttribute(\"rel\", l.rel);\n else a.removeAttribute(\"rel\");\n}\nexport const toLinkValue = (l: TextLink): LinkValue => ({ href: l.href, newTab: !!l.newTab, rel: l.rel ?? \"follow\" });\n/** V2 saveLink (RTE:883-899): the resolved href is what is stored; a page or section pick re-reads from it. */\nexport const fromLinkValue = (v: LinkValue, allowNewTab: boolean): TextLink => ({\n href: v.href,\n newTab: allowNewTab && !!v.newTab,\n ...(v.rel && v.rel !== \"follow\" ? { rel: v.rel } : {}),\n});\n\n/** An address a link may carry: http(s), mailto, tel, a site path or an in-page anchor. */\nexport function linkProblem(href: string): string | null {\n const h = href.trim();\n if (!h) return \"Add an address first.\";\n if (/^(https?:\\/\\/[^\\s]+|mailto:[^\\s]+|tel:[+\\d][\\d\\s()-]*|\\/(?!\\/)[^\\s]*|#[^\\s]+)$/i.test(h)) return null;\n if (/^[a-z][a-z0-9+.-]*:/i.test(h)) return \"Use an address that starts with https://, mailto: or tel:.\";\n if (/^[^\\s/]+\\.[^\\s]+$/.test(h)) return `Add https:// in front: https://${h}`;\n return \"Use a full address (https://…), a page path (/about) or an anchor (#section).\";\n}\n\nexport function LinkForm({\n initial,\n allowNewTab,\n onSave,\n onCancel,\n onDetach,\n dirty = false,\n}: {\n initial: TextLink;\n allowNewTab: boolean;\n onSave: (v: TextLink) => void;\n onCancel: () => void;\n onDetach?: () => void;\n /** something the host draws beside the form changed (a button's label), so Apply has something to save */\n dirty?: boolean;\n}) {\n const [href, setHref] = React.useState(initial.href);\n const [newTab, setNewTab] = React.useState(!!initial.newTab);\n const [problem, setProblem] = React.useState<string | null>(null);\n const urlId = React.useId();\n const tabId = React.useId();\n const errId = React.useId();\n const start = initial.href.trim();\n // V2 LinkPopoverBody (controls/link.tsx): Apply only when something changed and the link can be saved\n const changed = dirty || href.trim() !== start || (allowNewTab && newTab !== !!initial.newTab);\n const ok = !linkProblem(href);\n return (\n <form\n className=\"flex flex-col gap-3\"\n onSubmit={(e) => {\n e.preventDefault();\n const p = linkProblem(href);\n setProblem(p);\n if (!p) onSave({ href: href.trim(), newTab: allowNewTab && newTab });\n }}\n >\n <div className=\"flex min-w-0 flex-col gap-1\">\n <span className=\"text-kit-sm font-medium text-kit-fg\">Link</span>\n {start ? (\n <span className=\"flex min-w-0 text-kit-fg-2\">\n <LinkLine v={normLink({ href: start, newTab: !!initial.newTab })} />\n </span>\n ) : (\n <span className=\"text-kit-xs text-kit-fg-3\">No link yet</span>\n )}\n </div>\n <div\n className=\"flex flex-col gap-1.5\"\n onBlur={(e) => {\n if (!e.currentTarget.contains(e.relatedTarget as Node) && href.trim()) setProblem(linkProblem(href));\n }}\n >\n <label htmlFor={urlId} className=\"text-kit-xs text-kit-fg-2\">\n Link to\n </label>\n <Input\n id={urlId}\n autoFocus\n size=\"sm\"\n value={href}\n onChange={(e) => {\n setHref(e.target.value);\n if (problem) setProblem(null);\n }}\n onKeyDown={(e) => {\n // Apply is disabled while the address cannot be saved, so Enter says why instead of doing nothing\n if (e.key === \"Enter\" && !ok) {\n e.preventDefault();\n setProblem(linkProblem(href));\n }\n }}\n placeholder=\"https://… or /page\"\n leading={<IconLink stroke={1.5} />}\n aria-invalid={problem ? true : undefined}\n aria-describedby={problem ? errId : undefined}\n />\n {problem ? (\n <p id={errId} role=\"alert\" className=\"text-kit-xs text-kit-danger-fg\">\n {problem}\n </p>\n ) : null}\n </div>\n {allowNewTab ? (\n <label htmlFor={tabId} className=\"flex min-h-7 items-center justify-between gap-3\">\n <span className=\"text-kit-xs text-kit-fg-2\">Open in new tab</span>\n <Switch id={tabId} size=\"sm\" checked={newTab} onCheckedChange={setNewTab} />\n </label>\n ) : null}\n <div className=\"flex items-center gap-2 border-t border-kit-line pt-2.5\">\n {onDetach ? (\n <Button type=\"button\" size=\"xs\" variant=\"danger-ghost\" onClick={onDetach}>\n Remove link\n </Button>\n ) : null}\n <span className=\"flex-1\" />\n <Button type=\"button\" size=\"xs\" variant=\"ghost\" onClick={onCancel}>\n Cancel\n </Button>\n <Button type=\"submit\" size=\"xs\" variant=\"primary\" disabled={!changed || !ok}>\n Apply\n </Button>\n </div>\n </form>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,IAAM,OAAqC;CAAC;CAAY;CAAa;AAAK;;AAE1E,SAAgB,WAAW,GAAgC;CACzD,MAAM,UAAU,EAAE,aAAa,KAAK,KAAK,GAAA,CAAI,YAAY,CAAC,CAAC,MAAM,KAAK;CACtE,MAAM,MAAM,KAAK,MAAM,MAAM,OAAO,SAAS,CAAC,CAAC;CAC/C,OAAO;EAAE,MAAM,EAAE,aAAa,MAAM,KAAK;EAAI,QAAQ,EAAE,aAAa,QAAQ,MAAM;EAAU,GAAI,MAAM,EAAE,IAAI,IAAI,CAAC;CAAG;AACtH;;AAEA,SAAgB,cAAc,GAAsB,GAAa;CAC/D,EAAE,aAAa,QAAQ,EAAE,IAAI;CAC7B,IAAI,EAAE,QAAQ,EAAE,aAAa,UAAU,QAAQ;MAC1C,EAAE,gBAAgB,QAAQ;CAC/B,IAAI,EAAE,KAAK,EAAE,aAAa,OAAO,EAAE,GAAG;MACjC,EAAE,gBAAgB,KAAK;AAC9B;AACA,IAAa,eAAe,OAA4B;CAAE,MAAM,EAAE;CAAM,QAAQ,CAAC,CAA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GAAA,IAAA,IAAA;IACD;;;;;;GACJ,cACC,uBAAC,SAAD;IAAO,SAAS;IAAO,WAAU;IAAjC,UAAA,CACE,uBAAC,QAAD;KAAM,WAAU;KAA4B,UAAA;IAAqB,GAAA,KAAA,GAAA,OAAA;;;;IACjE,GAAA,IAAA,GAAA,uBAAC,QAAD;KAAQ,IAAI;KAAO,MAAK;KAAK,SAAS;KAAQ,iBAAiB;IAAY,GAAA,KAAA,GAAA,OAAA;;;;IACtE,GAAA,IAAA,CAAA;;;;;GACL,GAAA,IAAA,IAAA;GACJ,uBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACG,WACC,uBAAC,QAAD;MAAQ,MAAK;MAAS,MAAK;MAAK,SAAQ;MAAe,SAAS;MAAU,UAAA;KAElE,GAAA,KAAA,GAAA,OAAA;;;;KACN,GAAA,IAAA,IAAA;KACJ,uBAAC,QAAD,EAAM,WAAU,SAAU,GAAA,KAAA,GAAA,OAAA;;;;;KAC1B,uBAAC,QAAD;MAAQ,MAAK;MAAS,MAAK;MAAK,SAAQ;MAAQ,SAAS;MAAU,UAAA;KAE3D,GAAA,KAAA,GAAA,OAAA;;;;;KACR,uBAAC,QAAD;MAAQ,MAAK;MAAS,MAAK;MAAK,SAAQ;MAAU,UAAU,CAAC,WAAW,CAAC;MAAI,UAAA;KAErE,GAAA,KAAA,GAAA,OAAA;;;;;IACL;;;;;;EACD;;;;;;AAEV"}
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { jsx } from "react/jsx-runtime";
2
+ import { jsxDEV } from "react/jsx-dev-runtime";
3
3
  //#region src/controls/rich-text/plain.tsx
4
4
  /**
5
5
  * Plain paragraphs as a growing textarea (V2's `text` control), for hosts where V2 shows long text as a textarea
@@ -8,6 +8,7 @@ import { jsx } from "react/jsx-runtime";
8
8
  * keeps the rich editor, so editing never strips them. The textarea's text goes back as one `<p>` per line through
9
9
  * the field's own codec, so the stored shape is the field's as before.
10
10
  */
11
+ var _jsxFileName = "D:/Github/bettercms/bettercms-backend/packages/kit/src/controls/rich-text/plain.tsx";
11
12
  /** The html as textarea text — one line per `<p>` — or null when a textarea cannot carry it back unchanged. */
12
13
  function plainParagraphs(html) {
13
14
  if (html === void 0 || html === null || html === "") return "";
@@ -32,10 +33,14 @@ function paragraphsHtml(text) {
32
33
  var PlainRichText = React.createContext(false);
33
34
  /** Inside this scope a rich-text field holding plain paragraphs is drawn as V2's growing textarea. */
34
35
  function PlainRichTextScope({ children }) {
35
- return /* @__PURE__ */ jsx(PlainRichText.Provider, {
36
+ return /* @__PURE__ */ jsxDEV(PlainRichText.Provider, {
36
37
  value: true,
37
38
  children
38
- });
39
+ }, void 0, false, {
40
+ fileName: _jsxFileName,
41
+ lineNumber: 38,
42
+ columnNumber: 10
43
+ }, this);
39
44
  }
40
45
  var usePlainRichText = () => React.useContext(PlainRichText);
41
46
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"plain.js","names":[],"sources":["../../../src/controls/rich-text/plain.tsx"],"sourcesContent":["/**\n * Plain paragraphs as a growing textarea (V2's `text` control), for hosts where V2 shows long text as a textarea\n * rather than the rich editor: the canvas Values popover. A rich-text value whose html is only plain paragraphs\n * reads as one line per `<p>`; one that carries marks, links, line breaks, lists or attributes returns null and\n * keeps the rich editor, so editing never strips them. The textarea's text goes back as one `<p>` per line through\n * the field's own codec, so the stored shape is the field's as before.\n */\nimport * as React from \"react\";\n\n/** The html as textarea text — one line per `<p>` — or null when a textarea cannot carry it back unchanged. */\nexport function plainParagraphs(html: unknown): string | null {\n if (html === undefined || html === null || html === \"\") return \"\";\n if (typeof html !== \"string\") return null;\n const body = new DOMParser().parseFromString(html, \"text/html\").body;\n const lines: string[] = [];\n for (const node of Array.from(body.childNodes)) {\n if (node.nodeType === Node.TEXT_NODE && !node.textContent?.trim()) continue;\n if (node.nodeType !== Node.ELEMENT_NODE) return null;\n const el = node as Element;\n if (el.tagName !== \"P\" || el.attributes.length || Array.from(el.childNodes).some((c) => c.nodeType !== Node.TEXT_NODE)) return null;\n if (el.textContent?.includes(\"\\n\")) return null;\n lines.push(el.textContent ?? \"\");\n }\n return lines.join(\"\\n\");\n}\n\nconst escapeHtml = (s: string) => s.replace(/&/g, \"&amp;\").replace(/</g, \"&lt;\").replace(/>/g, \"&gt;\");\n\n/** Textarea text back to the paragraph html `plainParagraphs` reads: one `<p>` per line. */\nexport function paragraphsHtml(text: string): string {\n return text.split(/\\r?\\n/).map((line) => `<p>${escapeHtml(line)}</p>`).join(\"\");\n}\n\nconst PlainRichText = React.createContext(false);\n\n/** Inside this scope a rich-text field holding plain paragraphs is drawn as V2's growing textarea. */\nexport function PlainRichTextScope({ children }: { children: React.ReactNode }) {\n return <PlainRichText.Provider value>{children}</PlainRichText.Provider>;\n}\n\nexport const usePlainRichText = () => React.useContext(PlainRichText);\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,gBAAgB,MAA8B;CAC5D,IAAI,SAAS,KAAA,KAAa,SAAS,QAAQ,SAAS,IAAI,OAAO;CAC/D,IAAI,OAAO,SAAS,UAAU,OAAO;CACrC,MAAM,OAAO,IAAI,UAAU,CAAC,CAAC,gBAAgB,MAAM,WAAW,CAAC,CAAC;CAChE,MAAM,QAAkB,CAAC;CACzB,KAAK,MAAM,QAAQ,MAAM,KAAK,KAAK,UAAU,GAAG;EAC9C,IAAI,KAAK,aAAa,KAAK,aAAa,CAAC,KAAK,aAAa,KAAK,GAAG;EACnE,IAAI,KAAK,aAAa,KAAK,cAAc,OAAO;EAChD,MAAM,KAAK;EACX,IAAI,GAAG,YAAY,OAAO,GAAG,WAAW,UAAU,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,MAAM,MAAM,EAAE,aAAa,KAAK,SAAS,GAAG,OAAO;EAC/H,IAAI,GAAG,aAAa,SAAS,IAAI,GAAG,OAAO;EAC3C,MAAM,KAAK,GAAG,eAAe,EAAE;CACjC;CACA,OAAO,MAAM,KAAK,IAAI;AACxB;AAEA,IAAM,cAAc,MAAc,EAAE,QAAQ,MAAM,OAAO,CAAC,CAAC,QAAQ,MAAM,MAAM,CAAC,CAAC,QAAQ,MAAM,MAAM;;AAGrG,SAAgB,eAAe,MAAsB;CACnD,OAAO,KAAK,MAAM,OAAO,CAAC,CAAC,KAAK,SAAS,MAAM,WAAW,IAAI,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE;AAChF;AAEA,IAAM,gBAAgB,MAAM,cAAc,KAAK;;AAG/C,SAAgB,mBAAmB,EAAE,YAA2C;CAC9E,OAAO,oBAAC,cAAc,UAAf;EAAwB,OAAA;EAAO;CAAiC,CAAA;AACzE;AAEA,IAAa,yBAAyB,MAAM,WAAW,aAAa"}
1
+ {"version":3,"file":"plain.js","names":[],"sources":["../../../src/controls/rich-text/plain.tsx"],"sourcesContent":["/**\n * Plain paragraphs as a growing textarea (V2's `text` control), for hosts where V2 shows long text as a textarea\n * rather than the rich editor: the canvas Values popover. A rich-text value whose html is only plain paragraphs\n * reads as one line per `<p>`; one that carries marks, links, line breaks, lists or attributes returns null and\n * keeps the rich editor, so editing never strips them. The textarea's text goes back as one `<p>` per line through\n * the field's own codec, so the stored shape is the field's as before.\n */\nimport * as React from \"react\";\n\n/** The html as textarea text — one line per `<p>` — or null when a textarea cannot carry it back unchanged. */\nexport function plainParagraphs(html: unknown): string | null {\n if (html === undefined || html === null || html === \"\") return \"\";\n if (typeof html !== \"string\") return null;\n const body = new DOMParser().parseFromString(html, \"text/html\").body;\n const lines: string[] = [];\n for (const node of Array.from(body.childNodes)) {\n if (node.nodeType === Node.TEXT_NODE && !node.textContent?.trim()) continue;\n if (node.nodeType !== Node.ELEMENT_NODE) return null;\n const el = node as Element;\n if (el.tagName !== \"P\" || el.attributes.length || Array.from(el.childNodes).some((c) => c.nodeType !== Node.TEXT_NODE)) return null;\n if (el.textContent?.includes(\"\\n\")) return null;\n lines.push(el.textContent ?? \"\");\n }\n return lines.join(\"\\n\");\n}\n\nconst escapeHtml = (s: string) => s.replace(/&/g, \"&amp;\").replace(/</g, \"&lt;\").replace(/>/g, \"&gt;\");\n\n/** Textarea text back to the paragraph html `plainParagraphs` reads: one `<p>` per line. */\nexport function paragraphsHtml(text: string): string {\n return text.split(/\\r?\\n/).map((line) => `<p>${escapeHtml(line)}</p>`).join(\"\");\n}\n\nconst PlainRichText = React.createContext(false);\n\n/** Inside this scope a rich-text field holding plain paragraphs is drawn as V2's growing textarea. */\nexport function PlainRichTextScope({ children }: { children: React.ReactNode }) {\n return <PlainRichText.Provider value>{children}</PlainRichText.Provider>;\n}\n\nexport const usePlainRichText = () => React.useContext(PlainRichText);\n"],"mappings":";;;;;;;;;;;;AAUA,SAAgB,gBAAgB,MAA8B;CAC5D,IAAI,SAAS,KAAA,KAAa,SAAS,QAAQ,SAAS,IAAI,OAAO;CAC/D,IAAI,OAAO,SAAS,UAAU,OAAO;CACrC,MAAM,OAAO,IAAI,UAAU,CAAC,CAAC,gBAAgB,MAAM,WAAW,CAAC,CAAC;CAChE,MAAM,QAAkB,CAAC;CACzB,KAAK,MAAM,QAAQ,MAAM,KAAK,KAAK,UAAU,GAAG;EAC9C,IAAI,KAAK,aAAa,KAAK,aAAa,CAAC,KAAK,aAAa,KAAK,GAAG;EACnE,IAAI,KAAK,aAAa,KAAK,cAAc,OAAO;EAChD,MAAM,KAAK;EACX,IAAI,GAAG,YAAY,OAAO,GAAG,WAAW,UAAU,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,MAAM,MAAM,EAAE,aAAa,KAAK,SAAS,GAAG,OAAO;EAC/H,IAAI,GAAG,aAAa,SAAS,IAAI,GAAG,OAAO;EAC3C,MAAM,KAAK,GAAG,eAAe,EAAE;CACjC;CACA,OAAO,MAAM,KAAK,IAAI;AACxB;AAEA,IAAM,cAAc,MAAc,EAAE,QAAQ,MAAM,OAAO,CAAC,CAAC,QAAQ,MAAM,MAAM,CAAC,CAAC,QAAQ,MAAM,MAAM;;AAGrG,SAAgB,eAAe,MAAsB;CACnD,OAAO,KAAK,MAAM,OAAO,CAAC,CAAC,KAAK,SAAS,MAAM,WAAW,IAAI,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE;AAChF;AAEA,IAAM,gBAAgB,MAAM,cAAc,KAAK;;AAG/C,SAAgB,mBAAmB,EAAE,YAA2C;CAC9E,OAAO,uBAAC,cAAc,UAAf;EAAwB,OAAA;EAAO;CAAiC,GAAA,KAAA,GAAA,OAAA;;;;;AACzE;AAEA,IAAa,yBAAyB,MAAM,WAAW,aAAa"}
@@ -1,7 +1,7 @@
1
1
  import { useRichTextRefs } from "../../context.js";
2
2
  import { ArticleEmpty, ArticlePanelBlock } from "./article-shell.js";
3
3
  import * as React from "react";
4
- import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { jsxDEV } from "react/jsx-dev-runtime";
5
5
  import { IconPlus } from "@tabler/icons-react";
6
6
  //#region src/controls/rich-text/related.tsx
7
7
  /**
@@ -19,6 +19,7 @@ import { IconPlus } from "@tabler/icons-react";
19
19
  * data KitServices.resolveRichTextRefs (useRichTextRefs): ids for Hand-picked, a query for the automatic modes.
20
20
  * A fresh insert focuses the card (V2 article-blocks.tsx:131).
21
21
  */
22
+ var _jsxFileName = "D:/Github/bettercms/bettercms-backend/packages/kit/src/controls/rich-text/related.tsx";
22
23
  var RELATED_LABEL = "Related posts";
23
24
  /** `topic: false`: the collection has nothing to rank Same topic by, so a new block is Newest. */
24
25
  var relatedDefault = (topic = true) => ({
@@ -134,56 +135,108 @@ function relatedRequest(m, collection, excludeId) {
134
135
  function RelatedPreview({ m, onPick, ro, collection, excludeId }) {
135
136
  const { items, loading, error } = useRichTextRefs(relatedRequest(m, collection, excludeId));
136
137
  const posts = m.mode === "manual" ? m.posts.map((id) => items.find((x) => x.id === id)).filter((x) => !!x) : items;
137
- if (m.mode === "manual" && !loading && !error && !posts.length) return /* @__PURE__ */ jsx(ArticleEmpty, {
138
- icon: /* @__PURE__ */ jsx(IconPlus, { stroke: 1.5 }),
138
+ if (m.mode === "manual" && !loading && !error && !posts.length) return /* @__PURE__ */ jsxDEV(ArticleEmpty, {
139
+ icon: /* @__PURE__ */ jsxDEV(IconPlus, { stroke: 1.5 }, void 0, false, {
140
+ fileName: _jsxFileName,
141
+ lineNumber: 96,
142
+ columnNumber: 32
143
+ }, this),
139
144
  title: m.title || "Related posts",
140
145
  action: "Pick stories",
141
146
  onAction: onPick,
142
147
  ro
143
- });
144
- return /* @__PURE__ */ jsxs("aside", {
148
+ }, void 0, false, {
149
+ fileName: _jsxFileName,
150
+ lineNumber: 96,
151
+ columnNumber: 12
152
+ }, this);
153
+ return /* @__PURE__ */ jsxDEV("aside", {
145
154
  className: "rounded-kit-lg border border-kit-line bg-kit-surface px-4 py-3",
146
155
  "aria-label": m.title || "Related posts",
147
156
  "aria-busy": loading || void 0,
148
- children: [/* @__PURE__ */ jsxs("div", {
157
+ children: [/* @__PURE__ */ jsxDEV("div", {
149
158
  className: "mb-2 flex items-baseline gap-2",
150
- children: [m.title ? /* @__PURE__ */ jsx("p", {
159
+ children: [m.title ? /* @__PURE__ */ jsxDEV("p", {
151
160
  "data-field": "title",
152
161
  className: "text-kit-sm font-semibold text-kit-fg",
153
162
  children: m.title
154
- }) : null, m.mode !== "manual" ? /* @__PURE__ */ jsx("span", {
163
+ }, void 0, false, {
164
+ fileName: _jsxFileName,
165
+ lineNumber: 101,
166
+ columnNumber: 11
167
+ }, this) : null, m.mode !== "manual" ? /* @__PURE__ */ jsxDEV("span", {
155
168
  "data-field": "mode",
156
169
  className: "text-kit-2xs text-kit-fg-3",
157
170
  children: MODE_TAG[m.mode]
158
- }) : null]
159
- }), error ? /* @__PURE__ */ jsxs("p", {
171
+ }, void 0, false, {
172
+ fileName: _jsxFileName,
173
+ lineNumber: 106,
174
+ columnNumber: 11
175
+ }, this) : null]
176
+ }, void 0, true, {
177
+ fileName: _jsxFileName,
178
+ lineNumber: 99,
179
+ columnNumber: 7
180
+ }, this), error ? /* @__PURE__ */ jsxDEV("p", {
160
181
  role: "status",
161
182
  className: "text-kit-sm text-kit-warning-fg",
162
183
  children: ["The stories couldn't load: ", error]
163
- }) : /* @__PURE__ */ jsx("ul", {
184
+ }, void 0, true, {
185
+ fileName: _jsxFileName,
186
+ lineNumber: 112,
187
+ columnNumber: 9
188
+ }, this) : /* @__PURE__ */ jsxDEV("ul", {
164
189
  className: "m-0 grid grid-cols-3 gap-3 p-0",
165
190
  "data-field": m.mode === "manual" ? "posts" : "count",
166
- children: posts.map((e) => /* @__PURE__ */ jsxs("li", {
191
+ children: posts.map((e) => /* @__PURE__ */ jsxDEV("li", {
167
192
  className: "min-w-0 list-none",
168
193
  children: [
169
- e.cover ? /* @__PURE__ */ jsx("img", {
194
+ e.cover ? /* @__PURE__ */ jsxDEV("img", {
170
195
  src: e.cover,
171
196
  alt: "",
172
197
  draggable: false,
173
198
  className: "block aspect-[4/3] w-full rounded-kit-md border border-kit-line object-cover"
174
- }) : /* @__PURE__ */ jsx("div", { className: "aspect-[4/3] rounded-kit-md bg-kit-muted" }),
175
- /* @__PURE__ */ jsx("p", {
199
+ }, void 0, false, {
200
+ fileName: _jsxFileName,
201
+ lineNumber: 120,
202
+ columnNumber: 17
203
+ }, this) : /* @__PURE__ */ jsxDEV("div", { className: "aspect-[4/3] rounded-kit-md bg-kit-muted" }, void 0, false, {
204
+ fileName: _jsxFileName,
205
+ lineNumber: 122,
206
+ columnNumber: 17
207
+ }, this),
208
+ /* @__PURE__ */ jsxDEV("p", {
176
209
  className: "mt-1.5 line-clamp-2 text-kit-xs font-medium leading-snug text-kit-fg",
177
210
  children: e.title
178
- }),
179
- e.category ? /* @__PURE__ */ jsx("p", {
211
+ }, void 0, false, {
212
+ fileName: _jsxFileName,
213
+ lineNumber: 124,
214
+ columnNumber: 15
215
+ }, this),
216
+ e.category ? /* @__PURE__ */ jsxDEV("p", {
180
217
  className: "mt-0.5 truncate text-kit-2xs text-kit-fg-3",
181
218
  children: e.category
182
- }) : null
219
+ }, void 0, false, {
220
+ fileName: _jsxFileName,
221
+ lineNumber: 125,
222
+ columnNumber: 29
223
+ }, this) : null
183
224
  ]
184
- }, e.id))
185
- })]
186
- });
225
+ }, e.id, true, {
226
+ fileName: _jsxFileName,
227
+ lineNumber: 118,
228
+ columnNumber: 13
229
+ }, this))
230
+ }, void 0, false, {
231
+ fileName: _jsxFileName,
232
+ lineNumber: 116,
233
+ columnNumber: 9
234
+ }, this)]
235
+ }, void 0, true, {
236
+ fileName: _jsxFileName,
237
+ lineNumber: 98,
238
+ columnNumber: 5
239
+ }, this);
187
240
  }
188
241
  function RelatedBlock({ m, set, el, ctx, autoFocus, collection, excludeId, topic = true, noun }) {
189
242
  const schema = React.useMemo(() => relatedSchema([collection], m.mode, topic, {
@@ -196,7 +249,7 @@ function RelatedBlock({ m, set, el, ctx, autoFocus, collection, excludeId, topic
196
249
  noun,
197
250
  excludeId
198
251
  ]);
199
- return /* @__PURE__ */ jsx(ArticlePanelBlock, {
252
+ return /* @__PURE__ */ jsxDEV(ArticlePanelBlock, {
200
253
  label: RELATED_LABEL,
201
254
  kind: "related",
202
255
  schema,
@@ -218,14 +271,22 @@ function RelatedBlock({ m, set, el, ctx, autoFocus, collection, excludeId, topic
218
271
  count: clampCount(v.count),
219
272
  posts: Array.isArray(v.posts) ? v.posts.filter((x) => typeof x === "string") : []
220
273
  }),
221
- children: (open, ro) => /* @__PURE__ */ jsx(RelatedPreview, {
274
+ children: (open, ro) => /* @__PURE__ */ jsxDEV(RelatedPreview, {
222
275
  m,
223
276
  onPick: () => open("posts"),
224
277
  ro,
225
278
  collection,
226
279
  excludeId
227
- })
228
- });
280
+ }, void 0, false, {
281
+ fileName: _jsxFileName,
282
+ lineNumber: 171,
283
+ columnNumber: 22
284
+ }, this)
285
+ }, void 0, false, {
286
+ fileName: _jsxFileName,
287
+ lineNumber: 153,
288
+ columnNumber: 5
289
+ }, this);
229
290
  }
230
291
  //#endregion
231
292
  export { NO_TOPIC_REASON, RELATED_LABEL, RelatedBlock, RelatedPreview, relatedDefault, relatedRequest, relatedSchema };
@@ -1 +1 @@
1
- {"version":3,"file":"related.js","names":[],"sources":["../../../src/controls/rich-text/related.tsx"],"sourcesContent":["/**\n * RICH TEXT · Related posts (kit-richtext-ui-spec.md §6): V2's article block, stored as the PT block object\n * `{ _type: \"relatedPosts\", title?, mode, count, posts: { _ref }[] }`. Each post's title, cover, category and URL are\n * derived from the referenced or queried entries, never stored.\n *\n * modes e1 2026-10-24 (signed deviation from V2's Automatic | Hand-picked): Same topic (topic) · Newest (newest) ·\n * Hand-picked (manual). \"How many\" shows for the two automatic modes, Posts for Hand-picked. The schema's\n * `hidden` is \"show only when\" (schema/types.ts), as V2's was.\n * form V2 article.ts:167-195: Title (≤40, default \"Related stories\"), Stories (segmented), How many (1–6),\n * Posts (1–6 unique references to the field's collection). Four settings → the floating panel (D54).\n * preview V2 article-blocks.tsx:572-597: the title with the automatic mode's tag, three post cards (4:3 cover,\n * two-line title, category); \"Pick stories\" when Hand-picked holds nothing that resolves.\n * data KitServices.resolveRichTextRefs (useRichTextRefs): ids for Hand-picked, a query for the automatic modes.\n * A fresh insert focuses the card (V2 article-blocks.tsx:131).\n */\nimport * as React from \"react\";\nimport { IconPlus } from \"@tabler/icons-react\";\nimport { useRichTextRefs, type KitRichTextRefRequest } from \"../../context\";\nimport type { TypeSchema } from \"../../schema/types\";\nimport { ArticleEmpty, ArticlePanelBlock } from \"./article-shell\";\nimport type { IslandCtx } from \"./blocks\";\nimport type { IslandEl } from \"./dom\";\n\nexport type RelatedMode = \"topic\" | \"newest\" | \"manual\";\nexport interface RelatedModel {\n title: string;\n mode: RelatedMode;\n count: number;\n /** entry ids, Hand-picked only; the PT form wraps each as `{ _key, _ref }` */\n posts: string[];\n}\nexport const RELATED_LABEL = \"Related posts\";\n/** `topic: false`: the collection has nothing to rank Same topic by, so a new block is Newest. */\nexport const relatedDefault = (topic = true): RelatedModel => ({ title: \"Related stories\", mode: topic ? \"topic\" : \"newest\", count: 3, posts: [] });\n/** Why Same topic is not offered (RichTextRead.references.topic false; the entry write's relatedPosts.no_topic_field). */\nexport const NO_TOPIC_REASON = \"Same topic needs a tags or category field on this collection.\";\nconst MODE_TAG: Record<Exclude<RelatedMode, \"manual\">, string> = { topic: \"Same topic\", newest: \"Newest\" };\nconst asMode = (v: unknown): RelatedMode => (v === \"newest\" || v === \"manual\" ? v : \"topic\");\nconst clampCount = (v: unknown) => Math.min(6, Math.max(1, Math.round(Number(v) || 3)));\n\n/**\n * The panel form; `to` is the field's collection. \"How many\" explains the chosen automatic mode. With `topic` false,\n * Same topic is left out and Stories says why (a stored Same topic block keeps the option, so its value still shows).\n */\nexport const relatedSchema = (to: string[], mode: RelatedMode, topic = true, pick: { noun?: string; excludeId?: string } = {}): TypeSchema => ({\n name: \"relatedPosts\",\n title: RELATED_LABEL,\n kind: \"object\",\n icon: \"news\",\n fields: [\n { name: \"title\", title: \"Title\", type: \"string\", validation: { max: 40 } },\n {\n name: \"mode\",\n title: \"Stories\",\n type: \"select\",\n layout: \"segmented\",\n initialValue: topic ? \"topic\" : \"newest\",\n options: [\n ...(topic || mode === \"topic\" ? [{ value: \"topic\", label: \"Same topic\" }] : []),\n { value: \"newest\", label: \"Newest\" },\n { value: \"manual\", label: \"Hand-picked\" },\n ],\n ...(topic ? {} : { description: NO_TOPIC_REASON }),\n },\n {\n name: \"count\",\n title: \"How many\",\n type: \"number\",\n hidden: { field: \"mode\", op: \"in\", value: [\"topic\", \"newest\"] },\n numeric: { min: 1, max: 6, step: 1 },\n description: mode === \"newest\" ? \"Newest first.\" : \"Same topic, newest first.\",\n },\n {\n name: \"posts\",\n title: \"Posts\",\n type: \"array\",\n hidden: { field: \"mode\", equals: \"manual\" },\n validation: { min: 1, max: 6, unique: true },\n // Hand-picked never lists the entry being edited, and names a post as its collection does\n of: [{ name: \"post\", title: \"Post\", type: \"reference\", reference: { to, ...(pick.noun ? { noun: pick.noun } : {}), ...(pick.excludeId ? { excludeId: pick.excludeId } : {}) } }],\n },\n ],\n});\n\n/** What the preview asks the host for: the picked ids, or the automatic mode's query. */\nexport function relatedRequest(m: RelatedModel, collection?: string, excludeId?: string): KitRichTextRefRequest | null {\n if (m.mode === \"manual\") return m.posts.length ? { kind: \"relatedPosts\", ids: m.posts } : null;\n return { kind: \"relatedPosts\", query: { collection, mode: m.mode, count: m.count, excludeId } };\n}\n\nexport function RelatedPreview({ m, onPick, ro, collection, excludeId }: { m: RelatedModel; onPick: () => void; ro: boolean; collection?: string; excludeId?: string }) {\n const { items, loading, error } = useRichTextRefs(relatedRequest(m, collection, excludeId));\n // Hand-picked keeps the picked order; a post that no longer resolves is skipped (V2 .filter)\n const posts = m.mode === \"manual\" ? m.posts.map((id) => items.find((x) => x.id === id)).filter((x): x is NonNullable<typeof x> => !!x) : items;\n if (m.mode === \"manual\" && !loading && !error && !posts.length)\n return <ArticleEmpty icon={<IconPlus stroke={1.5} />} title={m.title || RELATED_LABEL} action=\"Pick stories\" onAction={onPick} ro={ro} />;\n return (\n <aside className=\"rounded-kit-lg border border-kit-line bg-kit-surface px-4 py-3\" aria-label={m.title || RELATED_LABEL} aria-busy={loading || undefined}>\n <div className=\"mb-2 flex items-baseline gap-2\">\n {m.title ? (\n <p data-field=\"title\" className=\"text-kit-sm font-semibold text-kit-fg\">\n {m.title}\n </p>\n ) : null}\n {m.mode !== \"manual\" ? (\n <span data-field=\"mode\" className=\"text-kit-2xs text-kit-fg-3\">\n {MODE_TAG[m.mode]}\n </span>\n ) : null}\n </div>\n {error ? (\n <p role=\"status\" className=\"text-kit-sm text-kit-warning-fg\">\n The stories couldn't load: {error}\n </p>\n ) : (\n <ul className=\"m-0 grid grid-cols-3 gap-3 p-0\" data-field={m.mode === \"manual\" ? \"posts\" : \"count\"}>\n {posts.map((e) => (\n <li key={e.id} className=\"min-w-0 list-none\">\n {e.cover ? (\n <img src={e.cover} alt=\"\" draggable={false} className=\"block aspect-[4/3] w-full rounded-kit-md border border-kit-line object-cover\" />\n ) : (\n <div className=\"aspect-[4/3] rounded-kit-md bg-kit-muted\" />\n )}\n <p className=\"mt-1.5 line-clamp-2 text-kit-xs font-medium leading-snug text-kit-fg\">{e.title}</p>\n {e.category ? <p className=\"mt-0.5 truncate text-kit-2xs text-kit-fg-3\">{e.category}</p> : null}\n </li>\n ))}\n </ul>\n )}\n </aside>\n );\n}\n\nexport function RelatedBlock({\n m, set, el, ctx, autoFocus, collection, excludeId, topic = true, noun,\n}: {\n m: RelatedModel;\n set: (fn: (m: RelatedModel) => RelatedModel, label?: string) => void;\n el: IslandEl;\n ctx: IslandCtx;\n autoFocus: boolean;\n /** the posts collection (the field's config) */\n collection: string;\n /** the entry being edited, left out of the automatic modes */\n excludeId?: string;\n /** false: the collection has no topic field, so Same topic is not offered */\n topic?: boolean;\n /** what one post is called (the collection's singular); absent → the picker's own noun */\n noun?: string;\n}) {\n const schema = React.useMemo(() => relatedSchema([collection], m.mode, topic, { noun, excludeId }), [collection, m.mode, topic, noun, excludeId]);\n return (\n <ArticlePanelBlock<RelatedModel>\n label={RELATED_LABEL}\n kind=\"related\"\n schema={schema}\n m={m}\n set={set}\n el={el}\n ctx={ctx}\n autoFocus={autoFocus}\n openOnInsert={false}\n toForm={(x) => ({ title: x.title, mode: x.mode, count: x.count, posts: x.posts })}\n fromForm={(v) => ({\n title: String(v.title ?? \"\"),\n mode: asMode(v.mode),\n count: clampCount(v.count),\n posts: Array.isArray(v.posts) ? v.posts.filter((x): x is string => typeof x === \"string\") : [],\n })}\n >\n {(open, ro) => <RelatedPreview m={m} onPick={() => open(\"posts\")} ro={ro} collection={collection} excludeId={excludeId} />}\n </ArticlePanelBlock>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+BA,IAAa,gBAAgB;;AAE7B,IAAa,kBAAkB,QAAQ,UAAwB;CAAE,OAAO;CAAmB,MAAM,QAAQ,UAAU;CAAU,OAAO;CAAG,OAAO,CAAC;AAAE;;AAEjJ,IAAa,kBAAkB;AAC/B,IAAM,WAA2D;CAAE,OAAO;CAAc,QAAQ;AAAS;AACzG,IAAM,UAAU,MAA6B,MAA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../src/controls/rich-text/related.tsx"],"sourcesContent":["/**\n * RICH TEXT · Related posts (kit-richtext-ui-spec.md §6): V2's article block, stored as the PT block object\n * `{ _type: \"relatedPosts\", title?, mode, count, posts: { _ref }[] }`. Each post's title, cover, category and URL are\n * derived from the referenced or queried entries, never stored.\n *\n * modes e1 2026-10-24 (signed deviation from V2's Automatic | Hand-picked): Same topic (topic) · Newest (newest) ·\n * Hand-picked (manual). \"How many\" shows for the two automatic modes, Posts for Hand-picked. The schema's\n * `hidden` is \"show only when\" (schema/types.ts), as V2's was.\n * form V2 article.ts:167-195: Title (≤40, default \"Related stories\"), Stories (segmented), How many (1–6),\n * Posts (1–6 unique references to the field's collection). Four settings → the floating panel (D54).\n * preview V2 article-blocks.tsx:572-597: the title with the automatic mode's tag, three post cards (4:3 cover,\n * two-line title, category); \"Pick stories\" when Hand-picked holds nothing that resolves.\n * data KitServices.resolveRichTextRefs (useRichTextRefs): ids for Hand-picked, a query for the automatic modes.\n * A fresh insert focuses the card (V2 article-blocks.tsx:131).\n */\nimport * as React from \"react\";\nimport { IconPlus } from \"@tabler/icons-react\";\nimport { useRichTextRefs, type KitRichTextRefRequest } from \"../../context\";\nimport type { TypeSchema } from \"../../schema/types\";\nimport { ArticleEmpty, ArticlePanelBlock } from \"./article-shell\";\nimport type { IslandCtx } from \"./blocks\";\nimport type { IslandEl } from \"./dom\";\n\nexport type RelatedMode = \"topic\" | \"newest\" | \"manual\";\nexport interface RelatedModel {\n title: string;\n mode: RelatedMode;\n count: number;\n /** entry ids, Hand-picked only; the PT form wraps each as `{ _key, _ref }` */\n posts: string[];\n}\nexport const RELATED_LABEL = \"Related posts\";\n/** `topic: false`: the collection has nothing to rank Same topic by, so a new block is Newest. */\nexport const relatedDefault = (topic = true): RelatedModel => ({ title: \"Related stories\", mode: topic ? \"topic\" : \"newest\", count: 3, posts: [] });\n/** Why Same topic is not offered (RichTextRead.references.topic false; the entry write's relatedPosts.no_topic_field). */\nexport const NO_TOPIC_REASON = \"Same topic needs a tags or category field on this collection.\";\nconst MODE_TAG: Record<Exclude<RelatedMode, \"manual\">, string> = { topic: \"Same topic\", newest: \"Newest\" };\nconst asMode = (v: unknown): RelatedMode => (v === \"newest\" || v === \"manual\" ? v : \"topic\");\nconst clampCount = (v: unknown) => Math.min(6, Math.max(1, Math.round(Number(v) || 3)));\n\n/**\n * The panel form; `to` is the field's collection. \"How many\" explains the chosen automatic mode. With `topic` false,\n * Same topic is left out and Stories says why (a stored Same topic block keeps the option, so its value still shows).\n */\nexport const relatedSchema = (to: string[], mode: RelatedMode, topic = true, pick: { noun?: string; excludeId?: string } = {}): TypeSchema => ({\n name: \"relatedPosts\",\n title: RELATED_LABEL,\n kind: \"object\",\n icon: \"news\",\n fields: [\n { name: \"title\", title: \"Title\", type: \"string\", validation: { max: 40 } },\n {\n name: \"mode\",\n title: \"Stories\",\n type: \"select\",\n layout: \"segmented\",\n initialValue: topic ? \"topic\" : \"newest\",\n options: [\n ...(topic || mode === \"topic\" ? [{ value: \"topic\", label: \"Same topic\" }] : []),\n { value: \"newest\", label: \"Newest\" },\n { value: \"manual\", label: \"Hand-picked\" },\n ],\n ...(topic ? {} : { description: NO_TOPIC_REASON }),\n },\n {\n name: \"count\",\n title: \"How many\",\n type: \"number\",\n hidden: { field: \"mode\", op: \"in\", value: [\"topic\", \"newest\"] },\n numeric: { min: 1, max: 6, step: 1 },\n description: mode === \"newest\" ? \"Newest first.\" : \"Same topic, newest first.\",\n },\n {\n name: \"posts\",\n title: \"Posts\",\n type: \"array\",\n hidden: { field: \"mode\", equals: \"manual\" },\n validation: { min: 1, max: 6, unique: true },\n // Hand-picked never lists the entry being edited, and names a post as its collection does\n of: [{ name: \"post\", title: \"Post\", type: \"reference\", reference: { to, ...(pick.noun ? { noun: pick.noun } : {}), ...(pick.excludeId ? { excludeId: pick.excludeId } : {}) } }],\n },\n ],\n});\n\n/** What the preview asks the host for: the picked ids, or the automatic mode's query. */\nexport function relatedRequest(m: RelatedModel, collection?: string, excludeId?: string): KitRichTextRefRequest | null {\n if (m.mode === \"manual\") return m.posts.length ? { kind: \"relatedPosts\", ids: m.posts } : null;\n return { kind: \"relatedPosts\", query: { collection, mode: m.mode, count: m.count, excludeId } };\n}\n\nexport function RelatedPreview({ m, onPick, ro, collection, excludeId }: { m: RelatedModel; onPick: () => void; ro: boolean; collection?: string; excludeId?: string }) {\n const { items, loading, error } = useRichTextRefs(relatedRequest(m, collection, excludeId));\n // Hand-picked keeps the picked order; a post that no longer resolves is skipped (V2 .filter)\n const posts = m.mode === \"manual\" ? m.posts.map((id) => items.find((x) => x.id === id)).filter((x): x is NonNullable<typeof x> => !!x) : items;\n if (m.mode === \"manual\" && !loading && !error && !posts.length)\n return <ArticleEmpty icon={<IconPlus stroke={1.5} />} title={m.title || RELATED_LABEL} action=\"Pick stories\" onAction={onPick} ro={ro} />;\n return (\n <aside className=\"rounded-kit-lg border border-kit-line bg-kit-surface px-4 py-3\" aria-label={m.title || RELATED_LABEL} aria-busy={loading || undefined}>\n <div className=\"mb-2 flex items-baseline gap-2\">\n {m.title ? (\n <p data-field=\"title\" className=\"text-kit-sm font-semibold text-kit-fg\">\n {m.title}\n </p>\n ) : null}\n {m.mode !== \"manual\" ? (\n <span data-field=\"mode\" className=\"text-kit-2xs text-kit-fg-3\">\n {MODE_TAG[m.mode]}\n </span>\n ) : null}\n </div>\n {error ? (\n <p role=\"status\" className=\"text-kit-sm text-kit-warning-fg\">\n The stories couldn't load: {error}\n </p>\n ) : (\n <ul className=\"m-0 grid grid-cols-3 gap-3 p-0\" data-field={m.mode === \"manual\" ? \"posts\" : \"count\"}>\n {posts.map((e) => (\n <li key={e.id} className=\"min-w-0 list-none\">\n {e.cover ? (\n <img src={e.cover} alt=\"\" draggable={false} className=\"block aspect-[4/3] w-full rounded-kit-md border border-kit-line object-cover\" />\n ) : (\n <div className=\"aspect-[4/3] rounded-kit-md bg-kit-muted\" />\n )}\n <p className=\"mt-1.5 line-clamp-2 text-kit-xs font-medium leading-snug text-kit-fg\">{e.title}</p>\n {e.category ? <p className=\"mt-0.5 truncate text-kit-2xs text-kit-fg-3\">{e.category}</p> : null}\n </li>\n ))}\n </ul>\n )}\n </aside>\n );\n}\n\nexport function RelatedBlock({\n m, set, el, ctx, autoFocus, collection, excludeId, topic = true, noun,\n}: {\n m: RelatedModel;\n set: (fn: (m: RelatedModel) => RelatedModel, label?: string) => void;\n el: IslandEl;\n ctx: IslandCtx;\n autoFocus: boolean;\n /** the posts collection (the field's config) */\n collection: string;\n /** the entry being edited, left out of the automatic modes */\n excludeId?: string;\n /** false: the collection has no topic field, so Same topic is not offered */\n topic?: boolean;\n /** what one post is called (the collection's singular); absent → the picker's own noun */\n noun?: string;\n}) {\n const schema = React.useMemo(() => relatedSchema([collection], m.mode, topic, { noun, excludeId }), [collection, m.mode, topic, noun, excludeId]);\n return (\n <ArticlePanelBlock<RelatedModel>\n label={RELATED_LABEL}\n kind=\"related\"\n schema={schema}\n m={m}\n set={set}\n el={el}\n ctx={ctx}\n autoFocus={autoFocus}\n openOnInsert={false}\n toForm={(x) => ({ title: x.title, mode: x.mode, count: x.count, posts: x.posts })}\n fromForm={(v) => ({\n title: String(v.title ?? \"\"),\n mode: asMode(v.mode),\n count: clampCount(v.count),\n posts: Array.isArray(v.posts) ? v.posts.filter((x): x is string => typeof x === \"string\") : [],\n })}\n >\n {(open, ro) => <RelatedPreview m={m} onPick={() => open(\"posts\")} ro={ro} collection={collection} excludeId={excludeId} />}\n </ArticlePanelBlock>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAa,gBAAgB;;AAE7B,IAAa,kBAAkB,QAAQ,UAAwB;CAAE,OAAO;CAAmB,MAAM,QAAQ,UAAU;CAAU,OAAO;CAAG,OAAO,CAAC;AAAE;;AAEjJ,IAAa,kBAAkB;AAC/B,IAAM,WAA2D;CAAE,OAAO;CAAc,QAAQ;AAAS;AACzG,IAAM,UAAU,MAA6B,MAAM,YAAY,MAAM,WAAW,IAAI;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