@bettercms-ai/kit 3.0.1 → 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.
- package/dist/brand/logo.js +67 -18
- package/dist/brand/logo.js.map +1 -1
- package/dist/context.js +8 -3
- package/dist/context.js.map +1 -1
- package/dist/controls/button.js +451 -134
- package/dist/controls/button.js.map +1 -1
- package/dist/controls/choice.js +336 -95
- package/dist/controls/choice.js.map +1 -1
- package/dist/controls/code.js +245 -72
- package/dist/controls/code.js.map +1 -1
- package/dist/controls/color.js +108 -31
- package/dist/controls/color.js.map +1 -1
- package/dist/controls/date.js +268 -83
- package/dist/controls/date.js.map +1 -1
- package/dist/controls/form-picker.js +26 -9
- package/dist/controls/form-picker.js.map +1 -1
- package/dist/controls/icon.js +341 -100
- package/dist/controls/icon.js.map +1 -1
- package/dist/controls/json.js +20 -7
- package/dist/controls/json.js.map +1 -1
- package/dist/controls/link.js +561 -156
- package/dist/controls/link.js.map +1 -1
- package/dist/controls/location.js +124 -35
- package/dist/controls/location.js.map +1 -1
- package/dist/controls/media.js +928 -267
- package/dist/controls/media.js.map +1 -1
- package/dist/controls/number.js +80 -23
- package/dist/controls/number.js.map +1 -1
- package/dist/controls/reference.js +516 -155
- package/dist/controls/reference.js.map +1 -1
- package/dist/controls/rich-text/article-shell.js +327 -86
- package/dist/controls/rich-text/article-shell.js.map +1 -1
- package/dist/controls/rich-text/author.js +78 -21
- package/dist/controls/rich-text/author.js.map +1 -1
- package/dist/controls/rich-text/blocks.js +1084 -315
- package/dist/controls/rich-text/blocks.js.map +1 -1
- package/dist/controls/rich-text/button.js +30 -9
- package/dist/controls/rich-text/button.js.map +1 -1
- package/dist/controls/rich-text/catalog.js +168 -51
- package/dist/controls/rich-text/catalog.js.map +1 -1
- package/dist/controls/rich-text/columns.js +104 -31
- package/dist/controls/rich-text/columns.js.map +1 -1
- package/dist/controls/rich-text/component-card.js +790 -209
- package/dist/controls/rich-text/component-card.js.map +1 -1
- package/dist/controls/rich-text/component-panel.js +102 -40
- package/dist/controls/rich-text/component-panel.js.map +1 -1
- package/dist/controls/rich-text/control.js +101 -32
- package/dist/controls/rich-text/control.js.map +1 -1
- package/dist/controls/rich-text/editor.js +423 -121
- package/dist/controls/rich-text/editor.js.map +1 -1
- package/dist/controls/rich-text/embed.js +184 -51
- package/dist/controls/rich-text/embed.js.map +1 -1
- package/dist/controls/rich-text/floating.js +171 -42
- package/dist/controls/rich-text/floating.js.map +1 -1
- package/dist/controls/rich-text/footnote.js +89 -28
- package/dist/controls/rich-text/footnote.js.map +1 -1
- package/dist/controls/rich-text/gallery.js +88 -27
- package/dist/controls/rich-text/gallery.js.map +1 -1
- package/dist/controls/rich-text/link-form.js +111 -34
- package/dist/controls/rich-text/link-form.js.map +1 -1
- package/dist/controls/rich-text/plain.js +8 -3
- package/dist/controls/rich-text/plain.js.map +1 -1
- package/dist/controls/rich-text/related.js +86 -25
- package/dist/controls/rich-text/related.js.map +1 -1
- package/dist/controls/rich-text/toc.js +48 -15
- package/dist/controls/rich-text/toc.js.map +1 -1
- package/dist/controls/rich-text/toolbar.js +408 -107
- package/dist/controls/rich-text/toolbar.js.map +1 -1
- package/dist/controls/scale.js +169 -52
- package/dist/controls/scale.js.map +1 -1
- package/dist/controls/slot.js +238 -73
- package/dist/controls/slot.js.map +1 -1
- package/dist/controls/table/table-editor.js +1766 -500
- package/dist/controls/table/table-editor.js.map +1 -1
- package/dist/controls/table/table-link.js +119 -38
- package/dist/controls/table/table-link.js.map +1 -1
- package/dist/controls/table/table.js +26 -9
- package/dist/controls/table/table.js.map +1 -1
- package/dist/controls/text.js +221 -68
- package/dist/controls/text.js.map +1 -1
- package/dist/controls/unknown-value.js +79 -22
- package/dist/controls/unknown-value.js.map +1 -1
- package/dist/engine/array.js +821 -228
- package/dist/engine/array.js.map +1 -1
- package/dist/engine/bits.js +38 -13
- package/dist/engine/bits.js.map +1 -1
- package/dist/engine/breadcrumb.js +25 -8
- package/dist/engine/breadcrumb.js.map +1 -1
- package/dist/engine/expand.js +38 -13
- package/dist/engine/expand.js.map +1 -1
- package/dist/engine/field-list.js +14 -5
- package/dist/engine/field-list.js.map +1 -1
- package/dist/engine/field-shell.js +849 -244
- package/dist/engine/field-shell.js.map +1 -1
- package/dist/engine/frame.js +275 -78
- package/dist/engine/frame.js.map +1 -1
- package/dist/engine/grouping.js +630 -193
- package/dist/engine/grouping.js.map +1 -1
- package/dist/engine/item-list.js +187 -50
- package/dist/engine/item-list.js.map +1 -1
- package/dist/engine/kit-field.js +320 -95
- package/dist/engine/kit-field.js.map +1 -1
- package/dist/engine/schema-form.js +101 -32
- package/dist/engine/schema-form.js.map +1 -1
- package/dist/engine/slot.js +146 -45
- package/dist/engine/slot.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/lib/icons.js +14 -5
- package/dist/lib/icons.js.map +1 -1
- package/dist/styles.css +5821 -1
- package/dist/table/table-view.js +49 -16
- package/dist/table/table-view.js.map +1 -1
- package/dist/testing/test-form.js +14 -5
- package/dist/testing/test-form.js.map +1 -1
- package/dist/theme.js +8 -3
- package/dist/theme.js.map +1 -1
- package/dist/ui/action-tray.js +97 -24
- package/dist/ui/action-tray.js.map +1 -1
- package/dist/ui/autocomplete.js +135 -38
- package/dist/ui/autocomplete.js.map +1 -1
- package/dist/ui/button.js +108 -31
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/choice-switch.js +14 -5
- package/dist/ui/choice-switch.js.map +1 -1
- package/dist/ui/controls.js +279 -86
- package/dist/ui/controls.js.map +1 -1
- package/dist/ui/display.js +401 -116
- package/dist/ui/display.js.map +1 -1
- package/dist/ui/expanded-editor-modal.js +100 -27
- package/dist/ui/expanded-editor-modal.js.map +1 -1
- package/dist/ui/floating-panel.js +130 -37
- package/dist/ui/floating-panel.js.map +1 -1
- package/dist/ui/index.js +2 -2
- package/dist/ui/input.js +196 -59
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/mode-bar.js +32 -11
- package/dist/ui/mode-bar.js.map +1 -1
- package/dist/ui/overlay.js +616 -179
- package/dist/ui/overlay.js.map +1 -1
- package/dist/ui/path-crumbs.js +374 -113
- package/dist/ui/path-crumbs.js.map +1 -1
- package/dist/ui/select.js +311 -78
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/shortcut-hint.d.ts +3 -0
- package/dist/ui/shortcut-hint.js +33 -7
- package/dist/ui/shortcut-hint.js.map +1 -1
- package/dist/ui/spinner.js +20 -7
- package/dist/ui/spinner.js.map +1 -1
- package/dist/ui/split-button.js +35 -10
- package/dist/ui/split-button.js.map +1 -1
- package/dist/ui/tab.js +50 -17
- package/dist/ui/tab.js.map +1 -1
- package/dist/ui/toast.js +107 -30
- package/dist/ui/toast.js.map +1 -1
- package/dist/ui/tooltip-root.js +24 -7
- package/dist/ui/tooltip-root.js.map +1 -1
- package/package.json +2 -2
|
@@ -11,7 +11,7 @@ import { editorRoundTrip } from "./dom.js";
|
|
|
11
11
|
import { RichTextEditor } from "./editor.js";
|
|
12
12
|
import { paragraphsHtml, plainParagraphs, usePlainRichText } from "./plain.js";
|
|
13
13
|
import * as React from "react";
|
|
14
|
-
import {
|
|
14
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
15
15
|
import { IconArrowsMaximize } from "@tabler/icons-react";
|
|
16
16
|
//#region src/controls/rich-text/control.tsx
|
|
17
17
|
/**
|
|
@@ -29,6 +29,7 @@ import { IconArrowsMaximize } from "@tabler/icons-react";
|
|
|
29
29
|
* - probe: a value the editor cannot carry unchanged (open → no edit → write ≠ stored) is not opened here at all: the
|
|
30
30
|
* host's own control edits it (LegacyFallback), with the reason above it. Opening never writes.
|
|
31
31
|
*/
|
|
32
|
+
var _jsxFileName = "D:/Github/bettercms/bettercms-backend/packages/kit/src/controls/rich-text/control.tsx";
|
|
32
33
|
var openKey = null;
|
|
33
34
|
var subs = /* @__PURE__ */ new Set();
|
|
34
35
|
function setFullEditor(key) {
|
|
@@ -107,11 +108,19 @@ function openValue(codec, value, at) {
|
|
|
107
108
|
}
|
|
108
109
|
function RichTextControl(props) {
|
|
109
110
|
const { richText } = useKitServices();
|
|
110
|
-
if (!richText) return /* @__PURE__ */
|
|
111
|
-
|
|
111
|
+
if (!richText) return /* @__PURE__ */ jsxDEV(LegacyFallback, { ...props }, void 0, false, {
|
|
112
|
+
fileName: _jsxFileName,
|
|
113
|
+
lineNumber: 121,
|
|
114
|
+
columnNumber: 25
|
|
115
|
+
}, this);
|
|
116
|
+
return /* @__PURE__ */ jsxDEV(CodecRichText, {
|
|
112
117
|
codec: richText,
|
|
113
118
|
...props
|
|
114
|
-
}
|
|
119
|
+
}, void 0, false, {
|
|
120
|
+
fileName: _jsxFileName,
|
|
121
|
+
lineNumber: 122,
|
|
122
|
+
columnNumber: 10
|
|
123
|
+
}, this);
|
|
115
124
|
}
|
|
116
125
|
function CodecRichText({ codec, field, value, onChange, readOnly, path, id, invalid }) {
|
|
117
126
|
const env = useKitEnv();
|
|
@@ -150,9 +159,9 @@ function CodecRichText({ codec, field, value, onChange, readOnly, path, id, inva
|
|
|
150
159
|
setHandedOff(docKey, !opened.ok);
|
|
151
160
|
if (!opened.ok && openKey === docKey) setFullEditor(null);
|
|
152
161
|
}, [docKey, opened.ok]);
|
|
153
|
-
if (!opened.ok) return /* @__PURE__ */
|
|
162
|
+
if (!opened.ok) return /* @__PURE__ */ jsxDEV("div", {
|
|
154
163
|
className: "flex min-w-0 flex-col gap-1.5",
|
|
155
|
-
children: [/* @__PURE__ */
|
|
164
|
+
children: [/* @__PURE__ */ jsxDEV("p", {
|
|
156
165
|
role: "note",
|
|
157
166
|
"data-slot": "kit-richtext-handoff",
|
|
158
167
|
className: "rounded-kit-md bg-kit-subtle px-2.5 py-1.5 text-kit-xs text-kit-fg-2",
|
|
@@ -161,7 +170,11 @@ function CodecRichText({ codec, field, value, onChange, readOnly, path, id, inva
|
|
|
161
170
|
opened.reason,
|
|
162
171
|
"."
|
|
163
172
|
]
|
|
164
|
-
}
|
|
173
|
+
}, void 0, true, {
|
|
174
|
+
fileName: _jsxFileName,
|
|
175
|
+
lineNumber: 168,
|
|
176
|
+
columnNumber: 9
|
|
177
|
+
}, this), /* @__PURE__ */ jsxDEV(LegacyFallback, {
|
|
165
178
|
field,
|
|
166
179
|
value,
|
|
167
180
|
onChange,
|
|
@@ -169,8 +182,16 @@ function CodecRichText({ codec, field, value, onChange, readOnly, path, id, inva
|
|
|
169
182
|
path,
|
|
170
183
|
id,
|
|
171
184
|
invalid
|
|
172
|
-
}
|
|
173
|
-
|
|
185
|
+
}, void 0, false, {
|
|
186
|
+
fileName: _jsxFileName,
|
|
187
|
+
lineNumber: 171,
|
|
188
|
+
columnNumber: 9
|
|
189
|
+
}, this)]
|
|
190
|
+
}, void 0, true, {
|
|
191
|
+
fileName: _jsxFileName,
|
|
192
|
+
lineNumber: 167,
|
|
193
|
+
columnNumber: 7
|
|
194
|
+
}, this);
|
|
174
195
|
const { read, html } = opened;
|
|
175
196
|
const write = (next) => {
|
|
176
197
|
let res;
|
|
@@ -193,9 +214,9 @@ function CodecRichText({ codec, field, value, onChange, readOnly, path, id, inva
|
|
|
193
214
|
onChange(res.value);
|
|
194
215
|
};
|
|
195
216
|
const plain = plainScope && !read.losses.length ? plainParagraphs(html) : null;
|
|
196
|
-
if (plain !== null) return /* @__PURE__ */
|
|
217
|
+
if (plain !== null) return /* @__PURE__ */ jsxDEV("div", {
|
|
197
218
|
className: "flex min-w-0 flex-col gap-1.5",
|
|
198
|
-
children: [/* @__PURE__ */
|
|
219
|
+
children: [/* @__PURE__ */ jsxDEV(Textarea, {
|
|
199
220
|
id,
|
|
200
221
|
rows: 3,
|
|
201
222
|
value: plain,
|
|
@@ -204,14 +225,26 @@ function CodecRichText({ codec, field, value, onChange, readOnly, path, id, inva
|
|
|
204
225
|
placeholder: field.placeholder,
|
|
205
226
|
onChange: (e) => write(paragraphsHtml(e.target.value)),
|
|
206
227
|
className: cn(TEXT_FOCUS, "leading-5")
|
|
207
|
-
}
|
|
228
|
+
}, void 0, false, {
|
|
229
|
+
fileName: _jsxFileName,
|
|
230
|
+
lineNumber: 200,
|
|
231
|
+
columnNumber: 9
|
|
232
|
+
}, this), refusal ? /* @__PURE__ */ jsxDEV("p", {
|
|
208
233
|
role: "alert",
|
|
209
234
|
className: "text-kit-xs text-kit-danger-fg",
|
|
210
235
|
children: refusal
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
236
|
+
}, void 0, false, {
|
|
237
|
+
fileName: _jsxFileName,
|
|
238
|
+
lineNumber: 211,
|
|
239
|
+
columnNumber: 11
|
|
240
|
+
}, this) : null]
|
|
241
|
+
}, void 0, true, {
|
|
242
|
+
fileName: _jsxFileName,
|
|
243
|
+
lineNumber: 199,
|
|
244
|
+
columnNumber: 7
|
|
245
|
+
}, this);
|
|
246
|
+
return /* @__PURE__ */ jsxDEV("div", { children: [
|
|
247
|
+
read.losses.length ? /* @__PURE__ */ jsxDEV("p", {
|
|
215
248
|
role: "status",
|
|
216
249
|
className: "mb-1.5 rounded-kit-md bg-kit-warning-soft px-2.5 py-1.5 text-kit-xs text-kit-warning-fg",
|
|
217
250
|
children: [
|
|
@@ -219,17 +252,29 @@ function CodecRichText({ codec, field, value, onChange, readOnly, path, id, inva
|
|
|
219
252
|
read.losses.join(", "),
|
|
220
253
|
". Nothing changes until you edit."
|
|
221
254
|
]
|
|
222
|
-
}
|
|
223
|
-
|
|
255
|
+
}, void 0, true, {
|
|
256
|
+
fileName: _jsxFileName,
|
|
257
|
+
lineNumber: 222,
|
|
258
|
+
columnNumber: 9
|
|
259
|
+
}, this) : null,
|
|
260
|
+
read.undeclared?.length && codec.remap ? /* @__PURE__ */ jsxDEV("div", {
|
|
224
261
|
className: "mb-1.5",
|
|
225
|
-
children: /* @__PURE__ */
|
|
262
|
+
children: /* @__PURE__ */ jsxDEV(UnknownValueNote, {
|
|
226
263
|
items: read.undeclared,
|
|
227
264
|
onRemap: (key, to) => onChange(codec.remap(value, at, key, to)),
|
|
228
265
|
onRemove: (key) => onChange(codec.remap(value, at, key, null)),
|
|
229
266
|
readOnly
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
|
|
267
|
+
}, void 0, false, {
|
|
268
|
+
fileName: _jsxFileName,
|
|
269
|
+
lineNumber: 228,
|
|
270
|
+
columnNumber: 11
|
|
271
|
+
}, this)
|
|
272
|
+
}, void 0, false, {
|
|
273
|
+
fileName: _jsxFileName,
|
|
274
|
+
lineNumber: 227,
|
|
275
|
+
columnNumber: 9
|
|
276
|
+
}, this) : null,
|
|
277
|
+
/* @__PURE__ */ jsxDEV(RichTextEditor, {
|
|
233
278
|
value: html,
|
|
234
279
|
onChange: write,
|
|
235
280
|
readOnly,
|
|
@@ -248,13 +293,25 @@ function CodecRichText({ codec, field, value, onChange, readOnly, path, id, inva
|
|
|
248
293
|
expandedOpen: open,
|
|
249
294
|
onExpandedOpenChange: (o) => setFullEditor(o ? docKey : null),
|
|
250
295
|
onComment: env.onComment ? (quote) => env.onComment?.(path, field, quote) : void 0
|
|
251
|
-
}
|
|
252
|
-
|
|
296
|
+
}, void 0, false, {
|
|
297
|
+
fileName: _jsxFileName,
|
|
298
|
+
lineNumber: 236,
|
|
299
|
+
columnNumber: 7
|
|
300
|
+
}, this),
|
|
301
|
+
refusal ? /* @__PURE__ */ jsxDEV("p", {
|
|
253
302
|
role: "alert",
|
|
254
303
|
className: "mt-1.5 text-kit-xs text-kit-danger-fg",
|
|
255
304
|
children: refusal
|
|
256
|
-
}
|
|
257
|
-
|
|
305
|
+
}, void 0, false, {
|
|
306
|
+
fileName: _jsxFileName,
|
|
307
|
+
lineNumber: 258,
|
|
308
|
+
columnNumber: 9
|
|
309
|
+
}, this) : null
|
|
310
|
+
] }, void 0, true, {
|
|
311
|
+
fileName: _jsxFileName,
|
|
312
|
+
lineNumber: 220,
|
|
313
|
+
columnNumber: 5
|
|
314
|
+
}, this);
|
|
258
315
|
}
|
|
259
316
|
/** Label-row action (at rest): the field's toolbar holds the same button while it's open. */
|
|
260
317
|
function readsPlain(codec, value, field, path) {
|
|
@@ -275,21 +332,33 @@ function RichTextExpandAction({ path, field, value }) {
|
|
|
275
332
|
const plainScope = usePlainRichText();
|
|
276
333
|
if (env.variant === "document" || !richText || handed) return null;
|
|
277
334
|
if (plainScope && readsPlain(richText, value, field, path)) return null;
|
|
278
|
-
return /* @__PURE__ */
|
|
335
|
+
return /* @__PURE__ */ jsxDEV(Tooltip, {
|
|
279
336
|
content: "Expand editor",
|
|
280
337
|
shortcut: "⌘↵",
|
|
281
|
-
children: /* @__PURE__ */
|
|
338
|
+
children: /* @__PURE__ */ jsxDEV("button", {
|
|
282
339
|
type: "button",
|
|
283
340
|
"aria-label": `Expand ${field.title}`,
|
|
284
341
|
onClick: () => setFullEditor(`${env.docId}:${pathKey(path)}`),
|
|
285
342
|
className: cn("-my-0.5 hidden size-6 items-center justify-center rounded-kit-md text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg", "group-hover/field:inline-flex group-focus-within/field:!hidden [@media(pointer:coarse)]:inline-flex"),
|
|
286
|
-
children: /* @__PURE__ */
|
|
343
|
+
children: /* @__PURE__ */ jsxDEV(IconArrowsMaximize, {
|
|
287
344
|
className: "size-3.5",
|
|
288
345
|
stroke: 1.5,
|
|
289
346
|
"aria-hidden": true
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
|
|
347
|
+
}, void 0, false, {
|
|
348
|
+
fileName: _jsxFileName,
|
|
349
|
+
lineNumber: 296,
|
|
350
|
+
columnNumber: 9
|
|
351
|
+
}, this)
|
|
352
|
+
}, void 0, false, {
|
|
353
|
+
fileName: _jsxFileName,
|
|
354
|
+
lineNumber: 287,
|
|
355
|
+
columnNumber: 7
|
|
356
|
+
}, this)
|
|
357
|
+
}, void 0, false, {
|
|
358
|
+
fileName: _jsxFileName,
|
|
359
|
+
lineNumber: 286,
|
|
360
|
+
columnNumber: 5
|
|
361
|
+
}, this);
|
|
293
362
|
}
|
|
294
363
|
//#endregion
|
|
295
364
|
export { RichTextControl, RichTextExpandAction, openValue, setFullEditor };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.js","names":[],"sources":["../../../src/controls/rich-text/control.tsx"],"sourcesContent":["/**\n * Rich text field (V2 HEAD controls/richtext.tsx, CPO D49).\n * - The editor stays in place: the document variant is the full editor in the column, the panel variant (inspector)\n * the same editor height-capped.\n * - Expanding (the toolbar's expand button, ⌘↵, or the expand icon in the field's label row at rest) opens the shared\n * ExpandedEditorModal: breadcrumb \"Section › Item › Field\", word count, Done. Esc closes and focus returns.\n *\n * STORAGE. The editor edits HTML; the stored value stays what production stores for the field, through the host's\n * codec (KitServices.richText, see ./codec.ts):\n * - read: stored value → the HTML the editor opens on (+ what the field accepts)\n * - write: edited HTML → the stored value, in the surface's own shape; a write that would drop something is refused,\n * named, and nothing is stored\n * - probe: a value the editor cannot carry unchanged (open → no edit → write ≠ stored) is not opened here at all: the\n * host's own control edits it (LegacyFallback), with the reason above it. Opening never writes.\n */\nimport * as React from \"react\";\nimport { IconArrowsMaximize } from \"@tabler/icons-react\";\nimport { cn } from \"../../lib/cn\";\nimport { useForm, useKitEnv, useKitServices } from \"../../context\";\nimport { resolveFrames } from \"../../lib/frames\";\nimport { pathKey } from \"../../lib/path\";\nimport type { ControlProps } from \"../../types\";\nimport { Tooltip } from \"../../ui/overlay\";\nimport { LegacyFallback } from \"../../engine/kit-field\";\nimport type { KitRichTextCodec, RichTextRead } from \"./codec\";\nimport { editorRoundTrip } from \"./dom\";\nimport { RichTextEditor } from \"./editor\";\nimport { paragraphsHtml, plainParagraphs, usePlainRichText } from \"./plain\";\nimport { Textarea } from \"../../ui/input\";\nimport { TEXT_FOCUS } from \"../text\";\nimport { UnknownValueNote } from \"../unknown-value\";\n\n/* ── which rich-text field (docKey) has its full editor open — shared with the label-row action ── */\nlet openKey: string | null = null;\nconst subs = new Set<() => void>();\nexport function setFullEditor(key: string | null) {\n openKey = key;\n subs.forEach((s) => s());\n}\nfunction useFullEditorKey() {\n return React.useSyncExternalStore(\n (cb) => {\n subs.add(cb);\n return () => subs.delete(cb);\n },\n () => openKey,\n () => openKey,\n );\n}\n\n/* ── fields whose value went to the host's own control: the label-row expand button is not theirs to draw ── */\nconst handedOff = new Set<string>();\nfunction setHandedOff(key: string, on: boolean) {\n if (handedOff.has(key) === on) return;\n if (on) handedOff.add(key);\n else handedOff.delete(key);\n subs.forEach((s) => s());\n}\nfunction useHandedOff(key: string) {\n return React.useSyncExternalStore(\n (cb) => {\n subs.add(cb);\n return () => subs.delete(cb);\n },\n () => handedOff.has(key),\n () => handedOff.has(key),\n );\n}\n\n/** The expanded editor's breadcrumb: the form's frames (root › drilled items) and this field. */\nfunction useExpandCrumbs(fieldTitle: string): string[] {\n const form = useForm();\n const env = useKitEnv();\n if (!form) return [env.docTitle, fieldTitle].filter(Boolean) as string[];\n const { frames } = resolveFrames(form.schema, form.value, form.path, form.resolveSchema);\n const titles = frames.filter((f) => f.kind !== \"history\").map((f, i) => (i === 0 ? env.docTitle || f.title : f.title));\n return [...titles, fieldTitle];\n}\n\n/** A stored block array, or the `{ content }` / `{ format, value }` envelope around one, holding a pull quote block. */\nconst holdsPullQuote = (seed: unknown): boolean =>\n Array.isArray(seed)\n ? seed.some((b) => !!b && typeof b === \"object\" && (b as { _type?: unknown })._type === \"pullQuote\")\n : !!seed && typeof seed === \"object\" && holdsPullQuote((seed as { content?: unknown; value?: unknown }).content ?? (seed as { value?: unknown }).value);\n\n/** What the control decided for one stored value. */\ntype Opened =\n | { ok: true; read: RichTextRead; html: string }\n | { ok: false; reason: string };\n\n/**\n * Open a stored value: read it, then prove the editor carries it unchanged (load → serialize → write === stored).\n * A codec that throws, or a value that does not survive, is handed to the host's own control with the reason.\n */\nexport function openValue(codec: KitRichTextCodec, value: unknown, at: Parameters<KitRichTextCodec[\"read\"]>[1]): Opened {\n let read: RichTextRead;\n try {\n read = codec.read(value, at);\n } catch (err) {\n return { ok: false, reason: `the stored text could not be read (${err instanceof Error ? err.message : String(err)})` };\n }\n // a pull quote (V2 D55 article block) opens as the editor's pull-quote island, but only when the codec renders the\n // stored block as its markup in a field that offers it: a codec that renders nothing for it, or a field with no place\n // for one (a single paragraph), would lose it, so the standard editor edits it\n if (holdsPullQuote(read.seed) && (!/data-rt=\"pullquote\"/.test(read.html) || !read.features.includes(\"pullquote\")))\n return { ok: false, reason: \"it holds a pull quote, which the standard editor edits\" };\n // tables and pull quotes are islands (V2 TableBlock, PullQuote); the probe below proves they survive unchanged\n const html = editorRoundTrip(read.html);\n try {\n const back = codec.write(html, at, value);\n if (back.losses.length) return { ok: false, reason: `this editor would drop ${back.losses.join(\", \")}` };\n if (!codec.same(back.value, read.seed)) return { ok: false, reason: \"it holds formatting this editor cannot keep\" };\n } catch (err) {\n return { ok: false, reason: `the text could not be checked (${err instanceof Error ? err.message : String(err)})` };\n }\n return { ok: true, read, html };\n}\n\nexport function RichTextControl(props: ControlProps) {\n const { richText } = useKitServices();\n if (!richText) return <LegacyFallback {...props} />;\n return <CodecRichText codec={richText} {...props} />;\n}\n\nfunction CodecRichText({ codec, field, value, onChange, readOnly, path, id, invalid }: ControlProps & { codec: KitRichTextCodec }) {\n const env = useKitEnv();\n const docKey = `${env.docId}:${pathKey(path)}`;\n const open = useFullEditorKey() === docKey;\n const crumbs = useExpandCrumbs(field.title);\n const plainScope = usePlainRichText();\n const at = React.useMemo(() => ({ field, path }), [field, path]);\n // the components this field may embed (More components): a hook with one identity for the form's life, so calling it\n // only when the host provides it keeps the hook order fixed\n const { useInsertableComponents } = useKitServices();\n const insertable = useInsertableComponents?.(at);\n /* our own last write: its value comes back as `value`, and the editor keeps the HTML it emitted (no reload, no probe) */\n const mine = React.useRef<{ value: unknown; html: string } | null>(null);\n const [refusal, setRefusal] = React.useState<string | null>(null);\n const opened = React.useMemo<Opened>(() => {\n if (mine.current && mine.current.value === value) {\n try {\n return { ok: true, read: codec.read(value, at), html: mine.current.html };\n } catch {\n /* judged afresh below, which names the failure */\n }\n }\n return openValue(codec, value, at);\n // `at` changes identity with the field object; the field's content is what matters\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [codec, value, JSON.stringify(field), pathKey(path)]);\n\n // close when this field goes away (block deselected, drilled elsewhere)\n React.useEffect(\n () => () => {\n if (openKey === docKey) setFullEditor(null);\n setHandedOff(docKey, false);\n },\n [docKey],\n );\n React.useLayoutEffect(() => {\n setHandedOff(docKey, !opened.ok);\n if (!opened.ok && openKey === docKey) setFullEditor(null);\n }, [docKey, opened.ok]);\n\n if (!opened.ok)\n return (\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n <p role=\"note\" data-slot=\"kit-richtext-handoff\" className=\"rounded-kit-md bg-kit-subtle px-2.5 py-1.5 text-kit-xs text-kit-fg-2\">\n Edited with the standard editor: {opened.reason}.\n </p>\n <LegacyFallback field={field} value={value} onChange={onChange} readOnly={readOnly} path={path} id={id} invalid={invalid} />\n </div>\n );\n\n const { read, html } = opened;\n const write = (next: string) => {\n let res;\n try {\n res = codec.write(next, at, value);\n } catch (err) {\n setRefusal(`Not saved: the text could not be stored (${err instanceof Error ? err.message : String(err)}). Undo the last change with ⌘Z; leaving the field puts back the saved text.`);\n return;\n }\n if (res.losses.length) {\n setRefusal(`Not saved: this field cannot keep ${res.losses.join(\", \")}. Undo the last change with ⌘Z; leaving the field puts back the saved text.`);\n return;\n }\n setRefusal(null);\n if (codec.same(res.value, value)) return;\n mine.current = { value: res.value, html: next };\n onChange(res.value);\n };\n\n // The Values popover (PlainRichTextScope): plain paragraphs are V2's growing textarea (its `text` control), written\n // back through the same codec, one `<p>` per line. Anything richer keeps the editor below.\n const plain = plainScope && !read.losses.length ? plainParagraphs(html) : null;\n if (plain !== null)\n return (\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n <Textarea\n id={id}\n rows={3}\n value={plain}\n readOnly={readOnly}\n aria-invalid={invalid || !!refusal}\n placeholder={field.placeholder}\n onChange={(e) => write(paragraphsHtml(e.target.value))}\n className={cn(TEXT_FOCUS, \"leading-5\")}\n />\n {refusal ? (\n <p role=\"alert\" className=\"text-kit-xs text-kit-danger-fg\">\n {refusal}\n </p>\n ) : null}\n </div>\n );\n\n /* V2 richtext.tsx:57: the editor sits in a plain <div>; the dash-only notes keep the 6px gap as their own margin */\n return (\n <div>\n {read.losses.length ? (\n <p role=\"status\" className=\"mb-1.5 rounded-kit-md bg-kit-warning-soft px-2.5 py-1.5 text-kit-xs text-kit-warning-fg\">\n Saved by an earlier editor. Editing here would drop {read.losses.join(\", \")}. Nothing changes until you edit.\n </p>\n ) : null}\n {read.undeclared?.length && codec.remap ? (\n <div className=\"mb-1.5\">\n <UnknownValueNote\n items={read.undeclared}\n onRemap={(key, to) => onChange(codec.remap!(value, at, key, to))}\n onRemove={(key) => onChange(codec.remap!(value, at, key, null))}\n readOnly={readOnly}\n />\n </div>\n ) : null}\n <RichTextEditor\n value={html}\n onChange={write}\n readOnly={readOnly}\n placeholder={field.placeholder}\n docKey={docKey}\n id={id}\n invalid={invalid || !!refusal}\n features={read.features}\n references={read.references}\n single={read.single}\n allowNewTab={read.newTab}\n components={insertable && !read.single && !readOnly ? insertable : undefined}\n variant={env.variant === \"document\" ? \"document\" : \"panel\"}\n maxHeight={env.variant === \"document\" ? undefined : 320}\n expandCrumbs={crumbs}\n expandedOpen={open}\n onExpandedOpenChange={(o) => setFullEditor(o ? docKey : null)}\n // select words → Comment in the toolbar: the host's comment popover opens on this field, quoting them\n onComment={env.onComment ? (quote) => env.onComment?.(path, field, quote) : undefined}\n />\n {refusal ? (\n <p role=\"alert\" className=\"mt-1.5 text-kit-xs text-kit-danger-fg\">\n {refusal}\n </p>\n ) : null}\n </div>\n );\n}\n\n/** Label-row action (at rest): the field's toolbar holds the same button while it's open. */\nfunction readsPlain(codec: KitRichTextCodec, value: unknown, field: ControlProps[\"field\"], path: ControlProps[\"path\"]) {\n try {\n const read = codec.read(value, { field, path });\n return !read.losses.length && plainParagraphs(editorRoundTrip(read.html)) !== null;\n } catch {\n return false; // the control names the failure itself\n }\n}\n\nexport function RichTextExpandAction({ path, field, value }: ControlProps) {\n const env = useKitEnv();\n const { richText } = useKitServices();\n const handed = useHandedOff(`${env.docId}:${pathKey(path)}`);\n const plainScope = usePlainRichText();\n // the host's own control (no codec, or a value handed to it) has its own full-screen button\n if (env.variant === \"document\" || !richText || handed) return null;\n // drawn as a plain textarea (V2's `text` control has no ⤢)\n if (plainScope && readsPlain(richText, value, field, path)) return null;\n return (\n <Tooltip content=\"Expand editor\" shortcut=\"⌘↵\">\n <button\n type=\"button\"\n aria-label={`Expand ${field.title}`}\n onClick={() => setFullEditor(`${env.docId}:${pathKey(path)}`)}\n className={cn(\n \"-my-0.5 hidden size-6 items-center justify-center rounded-kit-md text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg\",\n \"group-hover/field:inline-flex group-focus-within/field:!hidden [@media(pointer:coarse)]:inline-flex\",\n )}\n >\n <IconArrowsMaximize className=\"size-3.5\" stroke={1.5} aria-hidden />\n </button>\n </Tooltip>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAI,UAAyB;AAC7B,IAAM,uBAAO,IAAI,IAAgB;AACjC,SAAgB,cAAc,KAAoB;CAChD,UAAU;CACV,KAAK,SAAS,MAAM,EAAE,CAAC;AACzB;AACA,SAAS,mBAAmB;CAC1B,OAAO,MAAM,sBACV,OAAO;EACN,KAAK,IAAI,EAAE;EACX,aAAa,KAAK,OAAO,EAAE;CAC7B,SACM,eACA,OACR;AACF;AAGA,IAAM,4BAAY,IAAI,IAAY;AAClC,SAAS,aAAa,KAAa,IAAa;CAC9C,IAAI,UAAU,IAAI,GAAG,MAAM,IAAI;CAC/B,IAAI,IAAI,UAAU,IAAI,GAAG;MACpB,UAAU,OAAO,GAAG;CACzB,KAAK,SAAS,MAAM,EAAE,CAAC;AACzB;AACA,SAAS,aAAa,KAAa;CACjC,OAAO,MAAM,sBACV,OAAO;EACN,KAAK,IAAI,EAAE;EACX,aAAa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AA;EACA,CAAA,IACD;CACD,EAAA,CAAA;AAET;;AAGA,SAAS,WAAW,OAAyB,OAAgB,OAA8B,MAA4B;CACrH,IAAI;EACF,MAAM,OAAO,MAAM,KAAK,OAAO;GAAE;GAAO;EAAK,CAAC;EAC9C,OAAO,CAAC,KAAK,OAAO,UAAU,gBAAgB,gBAAgB,KAAK,IAAI,CAAC,MAAM;CAChF,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAgB,qBAAqB,EAAE,MAAM,OAAO,SAAuB;CACzE,MAAM,MAAM,UAAU;CACtB,MAAM,EAAE,aAAa,eAAe;CACpC,MAAM,SAAS,aAAa,GAAG,IAAI,MAAM,GAAG,QAAQ,IAAI,GAAG;CAC3D,MAAM,aAAa,iBAAiB;CAEpC,IAAI,IAAI,YAAY,cAAc,CAAC,YAAY,QAAQ,OAAO;CAE9D,IAAI,cAAc,WAAW,UAAU,OAAO,OAAO,IAAI,GAAG,OAAO;CACnE,OACE,oBAAC,SAAD;EAAS,SAAQ;EAAgB,UAAS;EACxC,UAAA,oBAAC,UAAD;GACE,MAAK;GACL,cAAY,UAAU,MAAM;GAC5B,eAAe,cAAc,GAAG,IAAI,MAAM,GAAG,QAAQ,IAAI,GAAG;GAC5D,WAAW,GACT,uHACA,qGACF;GAEA,UAAA,oBAAC,oBAAD;IAAoB,WAAU;IAAW,QAAQ;IAAK,eAAA;GAAa,CAAA;EAC7D,CAAA;CACD,CAAA;AAEb"}
|
|
1
|
+
{"version":3,"file":"control.js","names":[],"sources":["../../../src/controls/rich-text/control.tsx"],"sourcesContent":["/**\n * Rich text field (V2 HEAD controls/richtext.tsx, CPO D49).\n * - The editor stays in place: the document variant is the full editor in the column, the panel variant (inspector)\n * the same editor height-capped.\n * - Expanding (the toolbar's expand button, ⌘↵, or the expand icon in the field's label row at rest) opens the shared\n * ExpandedEditorModal: breadcrumb \"Section › Item › Field\", word count, Done. Esc closes and focus returns.\n *\n * STORAGE. The editor edits HTML; the stored value stays what production stores for the field, through the host's\n * codec (KitServices.richText, see ./codec.ts):\n * - read: stored value → the HTML the editor opens on (+ what the field accepts)\n * - write: edited HTML → the stored value, in the surface's own shape; a write that would drop something is refused,\n * named, and nothing is stored\n * - probe: a value the editor cannot carry unchanged (open → no edit → write ≠ stored) is not opened here at all: the\n * host's own control edits it (LegacyFallback), with the reason above it. Opening never writes.\n */\nimport * as React from \"react\";\nimport { IconArrowsMaximize } from \"@tabler/icons-react\";\nimport { cn } from \"../../lib/cn\";\nimport { useForm, useKitEnv, useKitServices } from \"../../context\";\nimport { resolveFrames } from \"../../lib/frames\";\nimport { pathKey } from \"../../lib/path\";\nimport type { ControlProps } from \"../../types\";\nimport { Tooltip } from \"../../ui/overlay\";\nimport { LegacyFallback } from \"../../engine/kit-field\";\nimport type { KitRichTextCodec, RichTextRead } from \"./codec\";\nimport { editorRoundTrip } from \"./dom\";\nimport { RichTextEditor } from \"./editor\";\nimport { paragraphsHtml, plainParagraphs, usePlainRichText } from \"./plain\";\nimport { Textarea } from \"../../ui/input\";\nimport { TEXT_FOCUS } from \"../text\";\nimport { UnknownValueNote } from \"../unknown-value\";\n\n/* ── which rich-text field (docKey) has its full editor open — shared with the label-row action ── */\nlet openKey: string | null = null;\nconst subs = new Set<() => void>();\nexport function setFullEditor(key: string | null) {\n openKey = key;\n subs.forEach((s) => s());\n}\nfunction useFullEditorKey() {\n return React.useSyncExternalStore(\n (cb) => {\n subs.add(cb);\n return () => subs.delete(cb);\n },\n () => openKey,\n () => openKey,\n );\n}\n\n/* ── fields whose value went to the host's own control: the label-row expand button is not theirs to draw ── */\nconst handedOff = new Set<string>();\nfunction setHandedOff(key: string, on: boolean) {\n if (handedOff.has(key) === on) return;\n if (on) handedOff.add(key);\n else handedOff.delete(key);\n subs.forEach((s) => s());\n}\nfunction useHandedOff(key: string) {\n return React.useSyncExternalStore(\n (cb) => {\n subs.add(cb);\n return () => subs.delete(cb);\n },\n () => handedOff.has(key),\n () => handedOff.has(key),\n );\n}\n\n/** The expanded editor's breadcrumb: the form's frames (root › drilled items) and this field. */\nfunction useExpandCrumbs(fieldTitle: string): string[] {\n const form = useForm();\n const env = useKitEnv();\n if (!form) return [env.docTitle, fieldTitle].filter(Boolean) as string[];\n const { frames } = resolveFrames(form.schema, form.value, form.path, form.resolveSchema);\n const titles = frames.filter((f) => f.kind !== \"history\").map((f, i) => (i === 0 ? env.docTitle || f.title : f.title));\n return [...titles, fieldTitle];\n}\n\n/** A stored block array, or the `{ content }` / `{ format, value }` envelope around one, holding a pull quote block. */\nconst holdsPullQuote = (seed: unknown): boolean =>\n Array.isArray(seed)\n ? seed.some((b) => !!b && typeof b === \"object\" && (b as { _type?: unknown })._type === \"pullQuote\")\n : !!seed && typeof seed === \"object\" && holdsPullQuote((seed as { content?: unknown; value?: unknown }).content ?? (seed as { value?: unknown }).value);\n\n/** What the control decided for one stored value. */\ntype Opened =\n | { ok: true; read: RichTextRead; html: string }\n | { ok: false; reason: string };\n\n/**\n * Open a stored value: read it, then prove the editor carries it unchanged (load → serialize → write === stored).\n * A codec that throws, or a value that does not survive, is handed to the host's own control with the reason.\n */\nexport function openValue(codec: KitRichTextCodec, value: unknown, at: Parameters<KitRichTextCodec[\"read\"]>[1]): Opened {\n let read: RichTextRead;\n try {\n read = codec.read(value, at);\n } catch (err) {\n return { ok: false, reason: `the stored text could not be read (${err instanceof Error ? err.message : String(err)})` };\n }\n // a pull quote (V2 D55 article block) opens as the editor's pull-quote island, but only when the codec renders the\n // stored block as its markup in a field that offers it: a codec that renders nothing for it, or a field with no place\n // for one (a single paragraph), would lose it, so the standard editor edits it\n if (holdsPullQuote(read.seed) && (!/data-rt=\"pullquote\"/.test(read.html) || !read.features.includes(\"pullquote\")))\n return { ok: false, reason: \"it holds a pull quote, which the standard editor edits\" };\n // tables and pull quotes are islands (V2 TableBlock, PullQuote); the probe below proves they survive unchanged\n const html = editorRoundTrip(read.html);\n try {\n const back = codec.write(html, at, value);\n if (back.losses.length) return { ok: false, reason: `this editor would drop ${back.losses.join(\", \")}` };\n if (!codec.same(back.value, read.seed)) return { ok: false, reason: \"it holds formatting this editor cannot keep\" };\n } catch (err) {\n return { ok: false, reason: `the text could not be checked (${err instanceof Error ? err.message : String(err)})` };\n }\n return { ok: true, read, html };\n}\n\nexport function RichTextControl(props: ControlProps) {\n const { richText } = useKitServices();\n if (!richText) return <LegacyFallback {...props} />;\n return <CodecRichText codec={richText} {...props} />;\n}\n\nfunction CodecRichText({ codec, field, value, onChange, readOnly, path, id, invalid }: ControlProps & { codec: KitRichTextCodec }) {\n const env = useKitEnv();\n const docKey = `${env.docId}:${pathKey(path)}`;\n const open = useFullEditorKey() === docKey;\n const crumbs = useExpandCrumbs(field.title);\n const plainScope = usePlainRichText();\n const at = React.useMemo(() => ({ field, path }), [field, path]);\n // the components this field may embed (More components): a hook with one identity for the form's life, so calling it\n // only when the host provides it keeps the hook order fixed\n const { useInsertableComponents } = useKitServices();\n const insertable = useInsertableComponents?.(at);\n /* our own last write: its value comes back as `value`, and the editor keeps the HTML it emitted (no reload, no probe) */\n const mine = React.useRef<{ value: unknown; html: string } | null>(null);\n const [refusal, setRefusal] = React.useState<string | null>(null);\n const opened = React.useMemo<Opened>(() => {\n if (mine.current && mine.current.value === value) {\n try {\n return { ok: true, read: codec.read(value, at), html: mine.current.html };\n } catch {\n /* judged afresh below, which names the failure */\n }\n }\n return openValue(codec, value, at);\n // `at` changes identity with the field object; the field's content is what matters\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [codec, value, JSON.stringify(field), pathKey(path)]);\n\n // close when this field goes away (block deselected, drilled elsewhere)\n React.useEffect(\n () => () => {\n if (openKey === docKey) setFullEditor(null);\n setHandedOff(docKey, false);\n },\n [docKey],\n );\n React.useLayoutEffect(() => {\n setHandedOff(docKey, !opened.ok);\n if (!opened.ok && openKey === docKey) setFullEditor(null);\n }, [docKey, opened.ok]);\n\n if (!opened.ok)\n return (\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n <p role=\"note\" data-slot=\"kit-richtext-handoff\" className=\"rounded-kit-md bg-kit-subtle px-2.5 py-1.5 text-kit-xs text-kit-fg-2\">\n Edited with the standard editor: {opened.reason}.\n </p>\n <LegacyFallback field={field} value={value} onChange={onChange} readOnly={readOnly} path={path} id={id} invalid={invalid} />\n </div>\n );\n\n const { read, html } = opened;\n const write = (next: string) => {\n let res;\n try {\n res = codec.write(next, at, value);\n } catch (err) {\n setRefusal(`Not saved: the text could not be stored (${err instanceof Error ? err.message : String(err)}). Undo the last change with ⌘Z; leaving the field puts back the saved text.`);\n return;\n }\n if (res.losses.length) {\n setRefusal(`Not saved: this field cannot keep ${res.losses.join(\", \")}. Undo the last change with ⌘Z; leaving the field puts back the saved text.`);\n return;\n }\n setRefusal(null);\n if (codec.same(res.value, value)) return;\n mine.current = { value: res.value, html: next };\n onChange(res.value);\n };\n\n // The Values popover (PlainRichTextScope): plain paragraphs are V2's growing textarea (its `text` control), written\n // back through the same codec, one `<p>` per line. Anything richer keeps the editor below.\n const plain = plainScope && !read.losses.length ? plainParagraphs(html) : null;\n if (plain !== null)\n return (\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n <Textarea\n id={id}\n rows={3}\n value={plain}\n readOnly={readOnly}\n aria-invalid={invalid || !!refusal}\n placeholder={field.placeholder}\n onChange={(e) => write(paragraphsHtml(e.target.value))}\n className={cn(TEXT_FOCUS, \"leading-5\")}\n />\n {refusal ? (\n <p role=\"alert\" className=\"text-kit-xs text-kit-danger-fg\">\n {refusal}\n </p>\n ) : null}\n </div>\n );\n\n /* V2 richtext.tsx:57: the editor sits in a plain <div>; the dash-only notes keep the 6px gap as their own margin */\n return (\n <div>\n {read.losses.length ? (\n <p role=\"status\" className=\"mb-1.5 rounded-kit-md bg-kit-warning-soft px-2.5 py-1.5 text-kit-xs text-kit-warning-fg\">\n Saved by an earlier editor. Editing here would drop {read.losses.join(\", \")}. Nothing changes until you edit.\n </p>\n ) : null}\n {read.undeclared?.length && codec.remap ? (\n <div className=\"mb-1.5\">\n <UnknownValueNote\n items={read.undeclared}\n onRemap={(key, to) => onChange(codec.remap!(value, at, key, to))}\n onRemove={(key) => onChange(codec.remap!(value, at, key, null))}\n readOnly={readOnly}\n />\n </div>\n ) : null}\n <RichTextEditor\n value={html}\n onChange={write}\n readOnly={readOnly}\n placeholder={field.placeholder}\n docKey={docKey}\n id={id}\n invalid={invalid || !!refusal}\n features={read.features}\n references={read.references}\n single={read.single}\n allowNewTab={read.newTab}\n components={insertable && !read.single && !readOnly ? insertable : undefined}\n variant={env.variant === \"document\" ? \"document\" : \"panel\"}\n maxHeight={env.variant === \"document\" ? undefined : 320}\n expandCrumbs={crumbs}\n expandedOpen={open}\n onExpandedOpenChange={(o) => setFullEditor(o ? docKey : null)}\n // select words → Comment in the toolbar: the host's comment popover opens on this field, quoting them\n onComment={env.onComment ? (quote) => env.onComment?.(path, field, quote) : undefined}\n />\n {refusal ? (\n <p role=\"alert\" className=\"mt-1.5 text-kit-xs text-kit-danger-fg\">\n {refusal}\n </p>\n ) : null}\n </div>\n );\n}\n\n/** Label-row action (at rest): the field's toolbar holds the same button while it's open. */\nfunction readsPlain(codec: KitRichTextCodec, value: unknown, field: ControlProps[\"field\"], path: ControlProps[\"path\"]) {\n try {\n const read = codec.read(value, { field, path });\n return !read.losses.length && plainParagraphs(editorRoundTrip(read.html)) !== null;\n } catch {\n return false; // the control names the failure itself\n }\n}\n\nexport function RichTextExpandAction({ path, field, value }: ControlProps) {\n const env = useKitEnv();\n const { richText } = useKitServices();\n const handed = useHandedOff(`${env.docId}:${pathKey(path)}`);\n const plainScope = usePlainRichText();\n // the host's own control (no codec, or a value handed to it) has its own full-screen button\n if (env.variant === \"document\" || !richText || handed) return null;\n // drawn as a plain textarea (V2's `text` control has no ⤢)\n if (plainScope && readsPlain(richText, value, field, path)) return null;\n return (\n <Tooltip content=\"Expand editor\" shortcut=\"⌘↵\">\n <button\n type=\"button\"\n aria-label={`Expand ${field.title}`}\n onClick={() => setFullEditor(`${env.docId}:${pathKey(path)}`)}\n className={cn(\n \"-my-0.5 hidden size-6 items-center justify-center rounded-kit-md text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg\",\n \"group-hover/field:inline-flex group-focus-within/field:!hidden [@media(pointer:coarse)]:inline-flex\",\n )}\n >\n <IconArrowsMaximize className=\"size-3.5\" stroke={1.5} aria-hidden />\n </button>\n </Tooltip>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAI,UAAyB;AAC7B,IAAM,uBAAO,IAAI,IAAgB;AACjC,SAAgB,cAAc,KAAoB;CAChD,UAAU;CACV,KAAK,SAAS,MAAM,EAAE,CAAC;AACzB;AACA,SAAS,mBAAmB;CAC1B,OAAO,MAAM,sBACV,OAAO;EACN,KAAK,IAAI,EAAE;EACX,aAAa,KAAK,OAAO,EAAE;CAC7B,SACM,eACA,OACR;AACF;AAGA,IAAM,4BAAY,IAAI,IAAY;AAClC,SAAS,aAAa,KAAa,IAAa;CAC9C,IAAI,UAAU,IAAI,GAAG,MAAM,IAAI;CAC/B,IAAI,IAAI,UAAU,IAAI,GAAG;MACpB,UAAU,OAAO,GAAG;CACzB,KAAK,SAAS,MAAM,EAAE,CAAC;AACzB;AACA,SAAS,aAAa,KAAa;CACjC,OAAO,MAAM,sBACV,OAAO;EACN,KAAK,IAAI,EAAE;EACX,aAAa,KAAK,OAAO,EAAE;CAC7B,SACM,UAAU,IAAI,GAAG,SACjB,UAAU,IAAI,GAAG,CACzB;AACF;;AAGA,SAAS,gBAAgB,YAA8B;CACrD,MAAM,OAAO,QAAQ;CACrB,MAAM,MAAM,UAAU;CACtB,IAAI,CAAC,MAAM,OAAO,CAAC,IAAI,UAAU,UAAU,CAAC,CAAC,OAAO,OAAO;CAC3D,MAAM,EAAE,WAAW,cAAc,KAAK,QAAQ,KAAK,OAAO,KAAK,MAAM,KAAK,aAAa;CAEvF,OAAO,CAAC,GADO,OAAO,QAAQ,MAAM,EAAE,SAAS,SAAS,CAAC,CAAC,KAA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