@bettercms-ai/kit 3.0.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brand/logo.js +18 -67
- package/dist/brand/logo.js.map +1 -1
- package/dist/context.js +3 -8
- package/dist/context.js.map +1 -1
- package/dist/controls/button.js +134 -451
- package/dist/controls/button.js.map +1 -1
- package/dist/controls/choice.js +95 -336
- package/dist/controls/choice.js.map +1 -1
- package/dist/controls/code.js +72 -245
- package/dist/controls/code.js.map +1 -1
- package/dist/controls/color.js +31 -108
- package/dist/controls/color.js.map +1 -1
- package/dist/controls/date.js +83 -268
- package/dist/controls/date.js.map +1 -1
- package/dist/controls/form-picker.js +9 -26
- package/dist/controls/form-picker.js.map +1 -1
- package/dist/controls/icon.js +100 -341
- package/dist/controls/icon.js.map +1 -1
- package/dist/controls/json.js +7 -20
- package/dist/controls/json.js.map +1 -1
- package/dist/controls/link.js +156 -561
- package/dist/controls/link.js.map +1 -1
- package/dist/controls/location.js +35 -124
- package/dist/controls/location.js.map +1 -1
- package/dist/controls/media.js +267 -928
- package/dist/controls/media.js.map +1 -1
- package/dist/controls/number.js +23 -80
- package/dist/controls/number.js.map +1 -1
- package/dist/controls/reference.js +155 -516
- package/dist/controls/reference.js.map +1 -1
- package/dist/controls/rich-text/article-shell.js +86 -327
- package/dist/controls/rich-text/article-shell.js.map +1 -1
- package/dist/controls/rich-text/author.js +21 -78
- package/dist/controls/rich-text/author.js.map +1 -1
- package/dist/controls/rich-text/blocks.js +317 -1086
- package/dist/controls/rich-text/blocks.js.map +1 -1
- package/dist/controls/rich-text/button.js +10 -31
- package/dist/controls/rich-text/button.js.map +1 -1
- package/dist/controls/rich-text/catalog.js +51 -168
- package/dist/controls/rich-text/catalog.js.map +1 -1
- package/dist/controls/rich-text/columns.js +31 -104
- package/dist/controls/rich-text/columns.js.map +1 -1
- package/dist/controls/rich-text/component-card.js +209 -790
- package/dist/controls/rich-text/component-card.js.map +1 -1
- package/dist/controls/rich-text/component-panel.js +40 -102
- package/dist/controls/rich-text/component-panel.js.map +1 -1
- package/dist/controls/rich-text/control.js +32 -101
- package/dist/controls/rich-text/control.js.map +1 -1
- package/dist/controls/rich-text/editor.js +108 -369
- package/dist/controls/rich-text/editor.js.map +1 -1
- package/dist/controls/rich-text/embed.js +51 -184
- package/dist/controls/rich-text/embed.js.map +1 -1
- package/dist/controls/rich-text/floating.js +42 -171
- package/dist/controls/rich-text/floating.js.map +1 -1
- package/dist/controls/rich-text/footnote.js +28 -89
- package/dist/controls/rich-text/footnote.js.map +1 -1
- package/dist/controls/rich-text/gallery.js +27 -88
- package/dist/controls/rich-text/gallery.js.map +1 -1
- package/dist/controls/rich-text/link-form.d.ts +10 -0
- package/dist/controls/rich-text/link-form.js +16 -204
- package/dist/controls/rich-text/link-form.js.map +1 -1
- package/dist/controls/rich-text/plain.js +3 -8
- package/dist/controls/rich-text/plain.js.map +1 -1
- package/dist/controls/rich-text/related.js +25 -86
- package/dist/controls/rich-text/related.js.map +1 -1
- package/dist/controls/rich-text/toc.js +15 -48
- package/dist/controls/rich-text/toc.js.map +1 -1
- package/dist/controls/rich-text/toolbar.js +105 -402
- package/dist/controls/rich-text/toolbar.js.map +1 -1
- package/dist/controls/scale.js +52 -169
- package/dist/controls/scale.js.map +1 -1
- package/dist/controls/slot.js +73 -238
- package/dist/controls/slot.js.map +1 -1
- package/dist/controls/table/table-editor.js +500 -1766
- package/dist/controls/table/table-editor.js.map +1 -1
- package/dist/controls/table/table-link.js +41 -121
- package/dist/controls/table/table-link.js.map +1 -1
- package/dist/controls/table/table.js +9 -26
- package/dist/controls/table/table.js.map +1 -1
- package/dist/controls/text.js +68 -221
- package/dist/controls/text.js.map +1 -1
- package/dist/controls/unknown-value.js +22 -79
- package/dist/controls/unknown-value.js.map +1 -1
- package/dist/engine/array.js +228 -821
- package/dist/engine/array.js.map +1 -1
- package/dist/engine/bits.js +13 -38
- package/dist/engine/bits.js.map +1 -1
- package/dist/engine/breadcrumb.js +8 -25
- package/dist/engine/breadcrumb.js.map +1 -1
- package/dist/engine/expand.js +13 -38
- package/dist/engine/expand.js.map +1 -1
- package/dist/engine/field-list.js +5 -14
- package/dist/engine/field-list.js.map +1 -1
- package/dist/engine/field-shell.js +244 -849
- package/dist/engine/field-shell.js.map +1 -1
- package/dist/engine/frame.js +78 -275
- package/dist/engine/frame.js.map +1 -1
- package/dist/engine/grouping.js +193 -630
- package/dist/engine/grouping.js.map +1 -1
- package/dist/engine/item-list.js +50 -187
- package/dist/engine/item-list.js.map +1 -1
- package/dist/engine/kit-field.js +95 -320
- package/dist/engine/kit-field.js.map +1 -1
- package/dist/engine/schema-form.js +32 -101
- package/dist/engine/schema-form.js.map +1 -1
- package/dist/engine/slot.js +45 -146
- package/dist/engine/slot.js.map +1 -1
- package/dist/lib/icons.js +5 -14
- package/dist/lib/icons.js.map +1 -1
- package/dist/styles.css +1 -5821
- package/dist/table/table-view.js +16 -49
- package/dist/table/table-view.js.map +1 -1
- package/dist/testing/test-form.js +5 -14
- package/dist/testing/test-form.js.map +1 -1
- package/dist/theme.js +3 -8
- package/dist/theme.js.map +1 -1
- package/dist/ui/action-tray.js +24 -97
- package/dist/ui/action-tray.js.map +1 -1
- package/dist/ui/autocomplete.js +38 -135
- package/dist/ui/autocomplete.js.map +1 -1
- package/dist/ui/button.js +31 -108
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/choice-switch.js +5 -14
- package/dist/ui/choice-switch.js.map +1 -1
- package/dist/ui/controls.js +86 -279
- package/dist/ui/controls.js.map +1 -1
- package/dist/ui/display.js +116 -401
- package/dist/ui/display.js.map +1 -1
- package/dist/ui/expanded-editor-modal.js +27 -100
- package/dist/ui/expanded-editor-modal.js.map +1 -1
- package/dist/ui/floating-panel.js +37 -130
- package/dist/ui/floating-panel.js.map +1 -1
- package/dist/ui/input.js +59 -196
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/mode-bar.js +11 -32
- package/dist/ui/mode-bar.js.map +1 -1
- package/dist/ui/overlay.js +176 -613
- package/dist/ui/overlay.js.map +1 -1
- package/dist/ui/path-crumbs.js +113 -374
- package/dist/ui/path-crumbs.js.map +1 -1
- package/dist/ui/select.js +78 -311
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/shortcut-hint.js +6 -19
- package/dist/ui/shortcut-hint.js.map +1 -1
- package/dist/ui/spinner.js +7 -20
- package/dist/ui/spinner.js.map +1 -1
- package/dist/ui/split-button.js +10 -35
- package/dist/ui/split-button.js.map +1 -1
- package/dist/ui/tab.js +17 -50
- package/dist/ui/tab.js.map +1 -1
- package/dist/ui/toast.js +30 -107
- package/dist/ui/toast.js.map +1 -1
- package/dist/ui/tooltip-root.js +7 -24
- package/dist/ui/tooltip-root.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Input } from "../../ui/input.js";
|
|
4
|
-
import { LinkLine, normLink } from "../link.js";
|
|
5
|
-
import * as React from "react";
|
|
6
|
-
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
7
|
-
import { IconLink } from "@tabler/icons-react";
|
|
1
|
+
import { LinkPopoverBody } from "../link.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
3
|
//#region src/controls/rich-text/link-form.tsx
|
|
9
4
|
/**
|
|
10
5
|
* RICH TEXT · a link inside the text. A text link and a button are edited in V2's own link panel (controls/link.tsx
|
|
11
6
|
* LinkPopoverBody: Type, the page/section/address, new tab and Rel; RTE:1696) and stored as production's link mark:
|
|
12
|
-
* the resolved href, target and rel (`toLinkValue` / `fromLinkValue`).
|
|
13
|
-
*
|
|
7
|
+
* the resolved href, target and rel (`toLinkValue` / `fromLinkValue`). The image block uses the same panel; `LinkForm`
|
|
8
|
+
* below is kept only as a deprecated alias of it.
|
|
14
9
|
*/
|
|
15
|
-
var _jsxFileName = "D:/Github/bettercms/bettercms-backend/packages/kit/src/controls/rich-text/link-form.tsx";
|
|
16
10
|
var RELS = [
|
|
17
11
|
"nofollow",
|
|
18
12
|
"sponsored",
|
|
@@ -56,201 +50,19 @@ function linkProblem(href) {
|
|
|
56
50
|
if (/^[^\s/]+\.[^\s]+$/.test(h)) return `Add https:// in front: https://${h}`;
|
|
57
51
|
return "Use a full address (https://…), a page path (/about) or an anchor (#section).";
|
|
58
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated since 3.1.0: the address-only form V2 never had. It now renders V2's one link panel (`LinkPopoverBody`,
|
|
55
|
+
* controls/link.tsx), so every link opens the same UI; import that directly. Removed at the next major.
|
|
56
|
+
*/
|
|
59
57
|
function LinkForm({ initial, allowNewTab, onSave, onCancel, onDetach, dirty = false }) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const ok = !linkProblem(href);
|
|
69
|
-
return /* @__PURE__ */ jsxDEV("form", {
|
|
70
|
-
className: "flex flex-col gap-3",
|
|
71
|
-
onSubmit: (e) => {
|
|
72
|
-
e.preventDefault();
|
|
73
|
-
const p = linkProblem(href);
|
|
74
|
-
setProblem(p);
|
|
75
|
-
if (!p) onSave({
|
|
76
|
-
href: href.trim(),
|
|
77
|
-
newTab: allowNewTab && newTab
|
|
78
|
-
});
|
|
79
|
-
},
|
|
80
|
-
children: [
|
|
81
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
82
|
-
className: "flex min-w-0 flex-col gap-1",
|
|
83
|
-
children: [/* @__PURE__ */ jsxDEV("span", {
|
|
84
|
-
className: "text-kit-sm font-medium text-kit-fg",
|
|
85
|
-
children: "Link"
|
|
86
|
-
}, void 0, false, {
|
|
87
|
-
fileName: _jsxFileName,
|
|
88
|
-
lineNumber: 91,
|
|
89
|
-
columnNumber: 9
|
|
90
|
-
}, this), start ? /* @__PURE__ */ jsxDEV("span", {
|
|
91
|
-
className: "flex min-w-0 text-kit-fg-2",
|
|
92
|
-
children: /* @__PURE__ */ jsxDEV(LinkLine, { v: normLink({
|
|
93
|
-
href: start,
|
|
94
|
-
newTab: !!initial.newTab
|
|
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", {
|
|
105
|
-
className: "text-kit-xs text-kit-fg-3",
|
|
106
|
-
children: "No link yet"
|
|
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", {
|
|
118
|
-
className: "flex flex-col gap-1.5",
|
|
119
|
-
onBlur: (e) => {
|
|
120
|
-
if (!e.currentTarget.contains(e.relatedTarget) && href.trim()) setProblem(linkProblem(href));
|
|
121
|
-
},
|
|
122
|
-
children: [
|
|
123
|
-
/* @__PURE__ */ jsxDEV("label", {
|
|
124
|
-
htmlFor: urlId,
|
|
125
|
-
className: "text-kit-xs text-kit-fg-2",
|
|
126
|
-
children: "Link to"
|
|
127
|
-
}, void 0, false, {
|
|
128
|
-
fileName: _jsxFileName,
|
|
129
|
-
lineNumber: 106,
|
|
130
|
-
columnNumber: 9
|
|
131
|
-
}, this),
|
|
132
|
-
/* @__PURE__ */ jsxDEV(Input, {
|
|
133
|
-
id: urlId,
|
|
134
|
-
autoFocus: true,
|
|
135
|
-
size: "sm",
|
|
136
|
-
value: href,
|
|
137
|
-
onChange: (e) => {
|
|
138
|
-
setHref(e.target.value);
|
|
139
|
-
if (problem) setProblem(null);
|
|
140
|
-
},
|
|
141
|
-
onKeyDown: (e) => {
|
|
142
|
-
if (e.key === "Enter" && !ok) {
|
|
143
|
-
e.preventDefault();
|
|
144
|
-
setProblem(linkProblem(href));
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
placeholder: "https://… or /page",
|
|
148
|
-
leading: /* @__PURE__ */ jsxDEV(IconLink, { stroke: 1.5 }, void 0, false, {
|
|
149
|
-
fileName: _jsxFileName,
|
|
150
|
-
lineNumber: 126,
|
|
151
|
-
columnNumber: 20
|
|
152
|
-
}, this),
|
|
153
|
-
"aria-invalid": problem ? true : void 0,
|
|
154
|
-
"aria-describedby": problem ? errId : void 0
|
|
155
|
-
}, void 0, false, {
|
|
156
|
-
fileName: _jsxFileName,
|
|
157
|
-
lineNumber: 109,
|
|
158
|
-
columnNumber: 9
|
|
159
|
-
}, this),
|
|
160
|
-
problem ? /* @__PURE__ */ jsxDEV("p", {
|
|
161
|
-
id: errId,
|
|
162
|
-
role: "alert",
|
|
163
|
-
className: "text-kit-xs text-kit-danger-fg",
|
|
164
|
-
children: problem
|
|
165
|
-
}, void 0, false, {
|
|
166
|
-
fileName: _jsxFileName,
|
|
167
|
-
lineNumber: 131,
|
|
168
|
-
columnNumber: 11
|
|
169
|
-
}, this) : null
|
|
170
|
-
]
|
|
171
|
-
}, void 0, true, {
|
|
172
|
-
fileName: _jsxFileName,
|
|
173
|
-
lineNumber: 100,
|
|
174
|
-
columnNumber: 7
|
|
175
|
-
}, this),
|
|
176
|
-
allowNewTab ? /* @__PURE__ */ jsxDEV("label", {
|
|
177
|
-
htmlFor: tabId,
|
|
178
|
-
className: "flex min-h-7 items-center justify-between gap-3",
|
|
179
|
-
children: [/* @__PURE__ */ jsxDEV("span", {
|
|
180
|
-
className: "text-kit-xs text-kit-fg-2",
|
|
181
|
-
children: "Open in new tab"
|
|
182
|
-
}, void 0, false, {
|
|
183
|
-
fileName: _jsxFileName,
|
|
184
|
-
lineNumber: 138,
|
|
185
|
-
columnNumber: 11
|
|
186
|
-
}, this), /* @__PURE__ */ jsxDEV(Switch, {
|
|
187
|
-
id: tabId,
|
|
188
|
-
size: "sm",
|
|
189
|
-
checked: newTab,
|
|
190
|
-
onCheckedChange: setNewTab
|
|
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", {
|
|
202
|
-
className: "flex items-center gap-2 border-t border-kit-line pt-2.5",
|
|
203
|
-
children: [
|
|
204
|
-
onDetach ? /* @__PURE__ */ jsxDEV(Button, {
|
|
205
|
-
type: "button",
|
|
206
|
-
size: "xs",
|
|
207
|
-
variant: "danger-ghost",
|
|
208
|
-
onClick: onDetach,
|
|
209
|
-
children: "Remove link"
|
|
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, {
|
|
221
|
-
type: "button",
|
|
222
|
-
size: "xs",
|
|
223
|
-
variant: "ghost",
|
|
224
|
-
onClick: onCancel,
|
|
225
|
-
children: "Cancel"
|
|
226
|
-
}, void 0, false, {
|
|
227
|
-
fileName: _jsxFileName,
|
|
228
|
-
lineNumber: 149,
|
|
229
|
-
columnNumber: 9
|
|
230
|
-
}, this),
|
|
231
|
-
/* @__PURE__ */ jsxDEV(Button, {
|
|
232
|
-
type: "submit",
|
|
233
|
-
size: "xs",
|
|
234
|
-
variant: "primary",
|
|
235
|
-
disabled: !changed || !ok,
|
|
236
|
-
children: "Apply"
|
|
237
|
-
}, void 0, false, {
|
|
238
|
-
fileName: _jsxFileName,
|
|
239
|
-
lineNumber: 152,
|
|
240
|
-
columnNumber: 9
|
|
241
|
-
}, this)
|
|
242
|
-
]
|
|
243
|
-
}, void 0, true, {
|
|
244
|
-
fileName: _jsxFileName,
|
|
245
|
-
lineNumber: 142,
|
|
246
|
-
columnNumber: 7
|
|
247
|
-
}, this)
|
|
248
|
-
]
|
|
249
|
-
}, void 0, true, {
|
|
250
|
-
fileName: _jsxFileName,
|
|
251
|
-
lineNumber: 81,
|
|
252
|
-
columnNumber: 5
|
|
253
|
-
}, this);
|
|
58
|
+
return /* @__PURE__ */ jsx(LinkPopoverBody, {
|
|
59
|
+
initial: toLinkValue(initial),
|
|
60
|
+
hideOptions: !allowNewTab,
|
|
61
|
+
onSave: (v) => onSave(fromLinkValue(v, allowNewTab)),
|
|
62
|
+
onCancel,
|
|
63
|
+
onDetach,
|
|
64
|
+
dirty
|
|
65
|
+
});
|
|
254
66
|
}
|
|
255
67
|
//#endregion
|
|
256
68
|
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,GAAsB,GAAa;CAC/D,EAAE,aAAa,QAAQ,EAAE,IAAI;CAC7B,IAAI,EAAE,QAAQ,EAAE,aAAa,U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AU,OAAO,KAAA;MAC/B,oBAAkB,UAAU,QAAQ,KAAA;KACrC,GAAA,KAAA,GAAA,OAAA;;;;;KACA,UACC,uBAAC,KAAD;MAAG,IAAI;MAAO,MAAK;MAAQ,WAAU;MAClC,UAAA;KACA,GAAA,KAAA,GAAA,OAAA;;;;KACD,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
|
+
{"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`). The image block uses the same panel; `LinkForm`\n * below is kept only as a deprecated alias of it.\n */\nimport { LinkPopoverBody, 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\n/**\n * @deprecated since 3.1.0: the address-only form V2 never had. It now renders V2's one link panel (`LinkPopoverBody`,\n * controls/link.tsx), so every link opens the same UI; import that directly. Removed at the next major.\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 return (\n <LinkPopoverBody\n initial={toLinkValue(initial)}\n hideOptions={!allowNewTab}\n onSave={(v) => onSave(fromLinkValue(v, allowNewTab))}\n onCancel={onCancel}\n onDetach={onDetach}\n dirty={dirty}\n />\n );\n}\n"],"mappings":";;;;;;;;;AAeA,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,CAAC,EAAE;CAAQ,KAAK,EAAE,OAAO;AAAS;;AAEnH,IAAa,iBAAiB,GAAc,iBAAoC;CAC9E,MAAM,EAAE;CACR,QAAQ,eAAe,CAAC,CAAC,EAAE;CAC3B,GAAI,EAAE,OAAO,EAAE,QAAQ,WAAW,EAAE,KAAK,EAAE,IAAI,IAAI,CAAC;AACtD;;AAGA,SAAgB,YAAY,MAA6B;CACvD,MAAM,IAAI,KAAK,KAAK;CACpB,IAAI,CAAC,GAAG,OAAO;CACf,IAAI,kFAAkF,KAAK,CAAC,GAAG,OAAO;CACtG,IAAI,uBAAuB,KAAK,CAAC,GAAG,OAAO;CAC3C,IAAI,oBAAoB,KAAK,CAAC,GAAG,OAAO,kCAAkC;CAC1E,OAAO;AACT;;;;;AAMA,SAAgB,SAAS,EACvB,SACA,aACA,QACA,UACA,UACA,QAAQ,SASP;CACD,OACE,oBAAC,iBAAD;EACE,SAAS,YAAY,OAAO;EAC5B,aAAa,CAAC;EACd,SAAS,MAAM,OAAO,cAAc,GAAG,WAAW,CAAC;EACzC;EACA;EACH;CACR,CAAA;AAEL"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx } from "react/jsx-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,7 +8,6 @@ import { jsxDEV } from "react/jsx-dev-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";
|
|
12
11
|
/** The html as textarea text — one line per `<p>` — or null when a textarea cannot carry it back unchanged. */
|
|
13
12
|
function plainParagraphs(html) {
|
|
14
13
|
if (html === void 0 || html === null || html === "") return "";
|
|
@@ -33,14 +32,10 @@ function paragraphsHtml(text) {
|
|
|
33
32
|
var PlainRichText = React.createContext(false);
|
|
34
33
|
/** Inside this scope a rich-text field holding plain paragraphs is drawn as V2's growing textarea. */
|
|
35
34
|
function PlainRichTextScope({ children }) {
|
|
36
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ jsx(PlainRichText.Provider, {
|
|
37
36
|
value: true,
|
|
38
37
|
children
|
|
39
|
-
}
|
|
40
|
-
fileName: _jsxFileName,
|
|
41
|
-
lineNumber: 38,
|
|
42
|
-
columnNumber: 10
|
|
43
|
-
}, this);
|
|
38
|
+
});
|
|
44
39
|
}
|
|
45
40
|
var usePlainRichText = () => React.useContext(PlainRichText);
|
|
46
41
|
//#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, \"&\").replace(/</g, \"<\").replace(/>/g, \">\");\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":"
|
|
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, \"&\").replace(/</g, \"<\").replace(/>/g, \">\");\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,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 {
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { IconPlus } from "@tabler/icons-react";
|
|
6
6
|
//#region src/controls/rich-text/related.tsx
|
|
7
7
|
/**
|
|
@@ -19,7 +19,6 @@ 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";
|
|
23
22
|
var RELATED_LABEL = "Related posts";
|
|
24
23
|
/** `topic: false`: the collection has nothing to rank Same topic by, so a new block is Newest. */
|
|
25
24
|
var relatedDefault = (topic = true) => ({
|
|
@@ -135,108 +134,56 @@ function relatedRequest(m, collection, excludeId) {
|
|
|
135
134
|
function RelatedPreview({ m, onPick, ro, collection, excludeId }) {
|
|
136
135
|
const { items, loading, error } = useRichTextRefs(relatedRequest(m, collection, excludeId));
|
|
137
136
|
const posts = m.mode === "manual" ? m.posts.map((id) => items.find((x) => x.id === id)).filter((x) => !!x) : items;
|
|
138
|
-
if (m.mode === "manual" && !loading && !error && !posts.length) return /* @__PURE__ */
|
|
139
|
-
icon: /* @__PURE__ */
|
|
140
|
-
fileName: _jsxFileName,
|
|
141
|
-
lineNumber: 96,
|
|
142
|
-
columnNumber: 32
|
|
143
|
-
}, this),
|
|
137
|
+
if (m.mode === "manual" && !loading && !error && !posts.length) return /* @__PURE__ */ jsx(ArticleEmpty, {
|
|
138
|
+
icon: /* @__PURE__ */ jsx(IconPlus, { stroke: 1.5 }),
|
|
144
139
|
title: m.title || "Related posts",
|
|
145
140
|
action: "Pick stories",
|
|
146
141
|
onAction: onPick,
|
|
147
142
|
ro
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
lineNumber: 96,
|
|
151
|
-
columnNumber: 12
|
|
152
|
-
}, this);
|
|
153
|
-
return /* @__PURE__ */ jsxDEV("aside", {
|
|
143
|
+
});
|
|
144
|
+
return /* @__PURE__ */ jsxs("aside", {
|
|
154
145
|
className: "rounded-kit-lg border border-kit-line bg-kit-surface px-4 py-3",
|
|
155
146
|
"aria-label": m.title || "Related posts",
|
|
156
147
|
"aria-busy": loading || void 0,
|
|
157
|
-
children: [/* @__PURE__ */
|
|
148
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
158
149
|
className: "mb-2 flex items-baseline gap-2",
|
|
159
|
-
children: [m.title ? /* @__PURE__ */
|
|
150
|
+
children: [m.title ? /* @__PURE__ */ jsx("p", {
|
|
160
151
|
"data-field": "title",
|
|
161
152
|
className: "text-kit-sm font-semibold text-kit-fg",
|
|
162
153
|
children: m.title
|
|
163
|
-
}
|
|
164
|
-
fileName: _jsxFileName,
|
|
165
|
-
lineNumber: 101,
|
|
166
|
-
columnNumber: 11
|
|
167
|
-
}, this) : null, m.mode !== "manual" ? /* @__PURE__ */ jsxDEV("span", {
|
|
154
|
+
}) : null, m.mode !== "manual" ? /* @__PURE__ */ jsx("span", {
|
|
168
155
|
"data-field": "mode",
|
|
169
156
|
className: "text-kit-2xs text-kit-fg-3",
|
|
170
157
|
children: MODE_TAG[m.mode]
|
|
171
|
-
}
|
|
172
|
-
|
|
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", {
|
|
158
|
+
}) : null]
|
|
159
|
+
}), error ? /* @__PURE__ */ jsxs("p", {
|
|
181
160
|
role: "status",
|
|
182
161
|
className: "text-kit-sm text-kit-warning-fg",
|
|
183
162
|
children: ["The stories couldn't load: ", error]
|
|
184
|
-
}
|
|
185
|
-
fileName: _jsxFileName,
|
|
186
|
-
lineNumber: 112,
|
|
187
|
-
columnNumber: 9
|
|
188
|
-
}, this) : /* @__PURE__ */ jsxDEV("ul", {
|
|
163
|
+
}) : /* @__PURE__ */ jsx("ul", {
|
|
189
164
|
className: "m-0 grid grid-cols-3 gap-3 p-0",
|
|
190
165
|
"data-field": m.mode === "manual" ? "posts" : "count",
|
|
191
|
-
children: posts.map((e) => /* @__PURE__ */
|
|
166
|
+
children: posts.map((e) => /* @__PURE__ */ jsxs("li", {
|
|
192
167
|
className: "min-w-0 list-none",
|
|
193
168
|
children: [
|
|
194
|
-
e.cover ? /* @__PURE__ */
|
|
169
|
+
e.cover ? /* @__PURE__ */ jsx("img", {
|
|
195
170
|
src: e.cover,
|
|
196
171
|
alt: "",
|
|
197
172
|
draggable: false,
|
|
198
173
|
className: "block aspect-[4/3] w-full rounded-kit-md border border-kit-line object-cover"
|
|
199
|
-
}
|
|
200
|
-
|
|
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", {
|
|
174
|
+
}) : /* @__PURE__ */ jsx("div", { className: "aspect-[4/3] rounded-kit-md bg-kit-muted" }),
|
|
175
|
+
/* @__PURE__ */ jsx("p", {
|
|
209
176
|
className: "mt-1.5 line-clamp-2 text-kit-xs font-medium leading-snug text-kit-fg",
|
|
210
177
|
children: e.title
|
|
211
|
-
},
|
|
212
|
-
|
|
213
|
-
lineNumber: 124,
|
|
214
|
-
columnNumber: 15
|
|
215
|
-
}, this),
|
|
216
|
-
e.category ? /* @__PURE__ */ jsxDEV("p", {
|
|
178
|
+
}),
|
|
179
|
+
e.category ? /* @__PURE__ */ jsx("p", {
|
|
217
180
|
className: "mt-0.5 truncate text-kit-2xs text-kit-fg-3",
|
|
218
181
|
children: e.category
|
|
219
|
-
}
|
|
220
|
-
fileName: _jsxFileName,
|
|
221
|
-
lineNumber: 125,
|
|
222
|
-
columnNumber: 29
|
|
223
|
-
}, this) : null
|
|
182
|
+
}) : null
|
|
224
183
|
]
|
|
225
|
-
}, e.id
|
|
226
|
-
|
|
227
|
-
|
|
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);
|
|
184
|
+
}, e.id))
|
|
185
|
+
})]
|
|
186
|
+
});
|
|
240
187
|
}
|
|
241
188
|
function RelatedBlock({ m, set, el, ctx, autoFocus, collection, excludeId, topic = true, noun }) {
|
|
242
189
|
const schema = React.useMemo(() => relatedSchema([collection], m.mode, topic, {
|
|
@@ -249,7 +196,7 @@ function RelatedBlock({ m, set, el, ctx, autoFocus, collection, excludeId, topic
|
|
|
249
196
|
noun,
|
|
250
197
|
excludeId
|
|
251
198
|
]);
|
|
252
|
-
return /* @__PURE__ */
|
|
199
|
+
return /* @__PURE__ */ jsx(ArticlePanelBlock, {
|
|
253
200
|
label: RELATED_LABEL,
|
|
254
201
|
kind: "related",
|
|
255
202
|
schema,
|
|
@@ -271,22 +218,14 @@ function RelatedBlock({ m, set, el, ctx, autoFocus, collection, excludeId, topic
|
|
|
271
218
|
count: clampCount(v.count),
|
|
272
219
|
posts: Array.isArray(v.posts) ? v.posts.filter((x) => typeof x === "string") : []
|
|
273
220
|
}),
|
|
274
|
-
children: (open, ro) => /* @__PURE__ */
|
|
221
|
+
children: (open, ro) => /* @__PURE__ */ jsx(RelatedPreview, {
|
|
275
222
|
m,
|
|
276
223
|
onPick: () => open("posts"),
|
|
277
224
|
ro,
|
|
278
225
|
collection,
|
|
279
226
|
excludeId
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
lineNumber: 171,
|
|
283
|
-
columnNumber: 22
|
|
284
|
-
}, this)
|
|
285
|
-
}, void 0, false, {
|
|
286
|
-
fileName: _jsxFileName,
|
|
287
|
-
lineNumber: 153,
|
|
288
|
-
columnNumber: 5
|
|
289
|
-
}, this);
|
|
227
|
+
})
|
|
228
|
+
});
|
|
290
229
|
}
|
|
291
230
|
//#endregion
|
|
292
231
|
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,MAAM,YAAY,MAAM,WAAW,IAAI;AACpF,IAAM,cAAc,MAAe,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,KAAK,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;;;;;AAMtF,IAA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O,MAAM,QAAQ,IAAI,CAAC;EAC/F;EAEE,WAAA,MAAM,OAAO,uBAAC,gBAAD;GAAmB;GAAG,cAAc,KAAK,OAAO;GAAO;GAAgB;GAAuB;EAAY,GAAA,KAAA,GAAA,OAAA;;;;;CACxG,GAAA,KAAA,GAAA,OAAA;;;;;AAEvB"}
|
|
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,gBAAg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