@particle-academy/react-fancy 5.67.0 → 5.69.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/CHANGELOG.md +63 -0
- package/dist/ContentRenderer.types-RO_l7_6N.d.cts +137 -0
- package/dist/ContentRenderer.types-RO_l7_6N.d.ts +137 -0
- package/dist/{PastedFilesInput-Bt3KSTVN.d.ts → PastedFilesInput-BT5y95sb.d.ts} +2 -1
- package/dist/{PastedFilesInput-CUQeOeOA.d.cts → PastedFilesInput-Cd4k6a38.d.cts} +2 -1
- package/dist/{chunk-U5LKNGHU.cjs → chunk-2PSHIUM7.cjs} +8 -8
- package/dist/{chunk-U5LKNGHU.cjs.map → chunk-2PSHIUM7.cjs.map} +1 -1
- package/dist/{chunk-QSGAFKK2.js → chunk-4UEIMGHZ.js} +3 -3
- package/dist/{chunk-QSGAFKK2.js.map → chunk-4UEIMGHZ.js.map} +1 -1
- package/dist/{chunk-YIKXJWO4.js → chunk-4WIPWJYD.js} +5 -4
- package/dist/chunk-4WIPWJYD.js.map +1 -0
- package/dist/{chunk-7FYRFNPX.cjs → chunk-FPFQBYKJ.cjs} +9 -9
- package/dist/{chunk-7FYRFNPX.cjs.map → chunk-FPFQBYKJ.cjs.map} +1 -1
- package/dist/{chunk-23AVEYUP.js → chunk-HRZDEZSE.js} +24 -19
- package/dist/chunk-HRZDEZSE.js.map +1 -0
- package/dist/{chunk-SAG6DHQK.cjs → chunk-ISNS4GAW.cjs} +29 -24
- package/dist/chunk-ISNS4GAW.cjs.map +1 -0
- package/dist/{chunk-6CAXLP7D.cjs → chunk-J5TFVYYM.cjs} +6 -6
- package/dist/{chunk-6CAXLP7D.cjs.map → chunk-J5TFVYYM.cjs.map} +1 -1
- package/dist/{chunk-E5UU666U.cjs → chunk-KGJ2ORY6.cjs} +148 -56
- package/dist/chunk-KGJ2ORY6.cjs.map +1 -0
- package/dist/{chunk-HEY4SMS2.js → chunk-LLVYCACC.js} +10 -4
- package/dist/chunk-LLVYCACC.js.map +1 -0
- package/dist/{chunk-4S5DFN5N.cjs → chunk-O4KZYGGC.cjs} +17 -11
- package/dist/chunk-O4KZYGGC.cjs.map +1 -0
- package/dist/{chunk-DCAD2JPP.js → chunk-U4PWNLOH.js} +3 -3
- package/dist/{chunk-DCAD2JPP.js.map → chunk-U4PWNLOH.js.map} +1 -1
- package/dist/{chunk-B4LVQ4QI.js → chunk-YEGFOMJB.js} +3 -3
- package/dist/{chunk-B4LVQ4QI.js.map → chunk-YEGFOMJB.js.map} +1 -1
- package/dist/{chunk-HFK5SBNM.cjs → chunk-YJETQ76J.cjs} +5 -4
- package/dist/chunk-YJETQ76J.cjs.map +1 -0
- package/dist/{chunk-FXOT4P4P.js → chunk-Z6RA37IC.js} +148 -56
- package/dist/chunk-Z6RA37IC.js.map +1 -0
- package/dist/composer.cjs +4 -4
- package/dist/composer.js +2 -2
- package/dist/content-renderer.cjs +4 -4
- package/dist/content-renderer.d.cts +3 -72
- package/dist/content-renderer.d.ts +3 -72
- package/dist/content-renderer.js +1 -1
- package/dist/editor.cjs +4 -4
- package/dist/editor.d.cts +19 -2
- package/dist/editor.d.ts +19 -2
- package/dist/editor.js +2 -2
- package/dist/{index-XR5t8bTq.d.ts → index-BQi_n6eS.d.ts} +21 -3
- package/dist/{index-DWtSViJ3.d.cts → index-n_4_OZK_.d.cts} +21 -3
- package/dist/index.cjs +38 -38
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -7
- package/dist/input.cjs +3 -3
- package/dist/input.js +2 -2
- package/dist/inputs.cjs +3 -3
- package/dist/inputs.js +2 -2
- package/dist/json-editor.cjs +14 -14
- package/dist/json-editor.js +3 -3
- package/dist/paste-pills.cjs +14 -14
- package/dist/paste-pills.d.cts +1 -1
- package/dist/paste-pills.d.ts +1 -1
- package/dist/paste-pills.js +1 -1
- package/dist/prompt-input.cjs +5 -5
- package/dist/prompt-input.d.cts +1 -1
- package/dist/prompt-input.d.ts +1 -1
- package/dist/prompt-input.js +2 -2
- package/docs/ContentRenderer.md +63 -6
- package/docs/Editor.md +38 -0
- package/docs/PromptInput.md +3 -2
- package/package.json +1 -1
- package/dist/chunk-23AVEYUP.js.map +0 -1
- package/dist/chunk-4S5DFN5N.cjs.map +0 -1
- package/dist/chunk-E5UU666U.cjs.map +0 -1
- package/dist/chunk-FXOT4P4P.js.map +0 -1
- package/dist/chunk-HEY4SMS2.js.map +0 -1
- package/dist/chunk-HFK5SBNM.cjs.map +0 -1
- package/dist/chunk-SAG6DHQK.cjs.map +0 -1
- package/dist/chunk-YIKXJWO4.js.map +0 -1
- package/dist/extensions-DiByZIpD.d.cts +0 -61
- package/dist/extensions-DiByZIpD.d.ts +0 -61
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,69 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
11
11
|
|
|
12
12
|
## [Unreleased]
|
|
13
13
|
|
|
14
|
+
## [5.69.0] - 2026-10-27
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- **`PromptInput`'s `focus()` and `setDraft(draft, { focus: true })` no longer
|
|
19
|
+
scroll the page** (genie#1290). They called the element's `focus()` with no
|
|
20
|
+
options, so the browser scrolled every scrollable ancestor, up to the
|
|
21
|
+
document, to reveal the composer. In Genie's Electron window that scrolled the
|
|
22
|
+
whole window. Both now pass `{ preventScroll: true }`. To get the old
|
|
23
|
+
behaviour, pass `{ preventScroll: false }` to `focus()` or `setDraft`. The new
|
|
24
|
+
`PromptFocusOptions` type is exported. Focus that follows the person's own
|
|
25
|
+
keypress (choosing from the `/` or `@` picker) is unchanged.
|
|
26
|
+
`InlinePasteEditorHandle.focus()` now accepts optional `FocusOptions` and
|
|
27
|
+
passes them through. With no argument it behaves as before.
|
|
28
|
+
- **`ContentRenderer`'s copy status region can no longer stretch the
|
|
29
|
+
document** (genie#1290, from 5.67.0). The `aria-live` region relied on the
|
|
30
|
+
host's Tailwind generating `sr-only`, and nothing around it was positioned.
|
|
31
|
+
Inside an unpositioned scroll container it escaped the scroller's clip and
|
|
32
|
+
extended the document. When the host's Tailwind never generated `sr-only`,
|
|
33
|
+
it rendered as visible text. The region now carries the sr-only clip pattern
|
|
34
|
+
inline. The root is `position: relative` while copy buttons are on, unless
|
|
35
|
+
the host's `className` already sets a position. Each copy-block wrapper is
|
|
36
|
+
`position: relative` inline as well. Nothing to do on upgrade.
|
|
37
|
+
|
|
38
|
+
## [5.68.0] - 2026-10-27
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- **`Editor` forwards `copyButtons`, `clipboardWriter` and `onCopy` to the
|
|
43
|
+
`ContentRenderer` its view mode renders through.** 5.67.0 turned copy buttons
|
|
44
|
+
on in view mode but gave a host no way to route those copies (a sandboxed
|
|
45
|
+
Electron window), observe them, or turn them off from `Editor`. Same types and
|
|
46
|
+
same defaults as on `ContentRenderer`; with the props absent nothing changes.
|
|
47
|
+
They have no effect in edit mode. Editor's docs now also document `mode`.
|
|
48
|
+
- **`ContentRenderer streaming="progressive"`: an open block shows as it
|
|
49
|
+
fills.** `streaming={true}` still hides an open block until it closes. In the
|
|
50
|
+
new mode:
|
|
51
|
+
- an open tag of a registered extension whose opening tag is complete renders
|
|
52
|
+
its component with the body so far (a `markdown` extension gets it as
|
|
53
|
+
`content` and rendered, sanitised, as `children`);
|
|
54
|
+
- an open code fence renders as a code block of what has arrived, with **no
|
|
55
|
+
copy button until it closes** (hidden rather than disabled: half a block is
|
|
56
|
+
never what a copy means). Finished blocks before it keep theirs;
|
|
57
|
+
- a partial opening tag (`<result title="Do`), a partial closing tag, a fence
|
|
58
|
+
marker still arriving and a fence opener line with no newline yet are still
|
|
59
|
+
held back, so none of it flashes raw. Inside an open fence `<` is code;
|
|
60
|
+
- it closes the open fence and open tags itself and renders normally, so the
|
|
61
|
+
body is the one the final render shows once the real closes arrive.
|
|
62
|
+
- The root carries `data-streaming-mode="progressive"` as well as
|
|
63
|
+
`data-streaming="true"`.
|
|
64
|
+
|
|
65
|
+
It is a value of `streaming` rather than a new prop because it is a way of
|
|
66
|
+
streaming: a separate flag would add a combination that means nothing.
|
|
67
|
+
`streaming` is now typed `boolean | "progressive"`. Code that passes a
|
|
68
|
+
boolean is unaffected; code that READS the prop's type and assumes `boolean`
|
|
69
|
+
needs to allow the string.
|
|
70
|
+
|
|
71
|
+
### Changed
|
|
72
|
+
|
|
73
|
+
- **Docs: `markdown` tags are lifted only at line start and only when closed,
|
|
74
|
+
and that is now stated as deliberate.** The behaviour is unchanged.
|
|
75
|
+
Progressive streaming does not relax either rule.
|
|
76
|
+
|
|
14
77
|
## [5.67.0] - 2026-10-27
|
|
15
78
|
|
|
16
79
|
### Added
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/** Props passed to every render-extension component. */
|
|
4
|
+
interface RenderExtensionProps {
|
|
5
|
+
/**
|
|
6
|
+
* The inner content of the custom tag (raw string). For an extension with
|
|
7
|
+
* `markdown: true` in markdown content this is the raw MARKDOWN body, before
|
|
8
|
+
* conversion. Either way it is untrusted: render `children` rather than
|
|
9
|
+
* injecting it.
|
|
10
|
+
*/
|
|
11
|
+
content: string;
|
|
12
|
+
/**
|
|
13
|
+
* Parsed attributes from the opening tag. Event handlers (`on*`), `srcdoc`,
|
|
14
|
+
* and URL attributes with an unsafe scheme are removed (unless the renderer
|
|
15
|
+
* is `unsafe`).
|
|
16
|
+
*/
|
|
17
|
+
attributes: Record<string, string>;
|
|
18
|
+
/**
|
|
19
|
+
* Only for extensions with `markdown: true`: the body, rendered by the same
|
|
20
|
+
* pipeline as the rest of the content (sanitised, nested extensions, copy
|
|
21
|
+
* buttons).
|
|
22
|
+
*/
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
/** Registers a custom tag with a React component for rendering. */
|
|
26
|
+
interface RenderExtension {
|
|
27
|
+
/** Tag name to match, e.g. "questions", "thinking". Case-insensitive. */
|
|
28
|
+
tag: string;
|
|
29
|
+
/** React component that renders the matched tag. */
|
|
30
|
+
component: ComponentType<RenderExtensionProps>;
|
|
31
|
+
/**
|
|
32
|
+
* Whether this is a block-level element.
|
|
33
|
+
* Block extensions are wrapped in a `<div>`, inline in a `<span>`.
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
block?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The tag's body is MARKDOWN. In markdown content, a tag that starts a line
|
|
39
|
+
* is lifted out of the source before conversion, so the component gets the
|
|
40
|
+
* raw markdown as `content` and the rendered, sanitised body as `children`.
|
|
41
|
+
* In HTML content the body is HTML and `children` renders it.
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
markdown?: boolean;
|
|
45
|
+
}
|
|
46
|
+
/** A parsed segment — either raw HTML or a matched extension tag. */
|
|
47
|
+
type ContentSegment = {
|
|
48
|
+
type: "html";
|
|
49
|
+
content: string;
|
|
50
|
+
} | {
|
|
51
|
+
type: "extension";
|
|
52
|
+
tag: string;
|
|
53
|
+
content: string;
|
|
54
|
+
attributes: Record<string, string>;
|
|
55
|
+
};
|
|
56
|
+
/** Register a single render extension globally (available to all ContentRenderer and Editor instances). */
|
|
57
|
+
declare function registerExtension(extension: RenderExtension): void;
|
|
58
|
+
/** Register multiple render extensions globally. */
|
|
59
|
+
declare function registerExtensions(extensions: RenderExtension[]): void;
|
|
60
|
+
|
|
61
|
+
/** What a copy button copies. */
|
|
62
|
+
type ContentCopyKind = "code" | "table";
|
|
63
|
+
/** What is handed to a clipboard writer. */
|
|
64
|
+
interface ContentClipboardPayload {
|
|
65
|
+
kind: ContentCopyKind;
|
|
66
|
+
/**
|
|
67
|
+
* Plain text. For code: exactly the code between the fences, with no
|
|
68
|
+
* language label and no added trailing newline. For a table: TSV (tab
|
|
69
|
+
* between cells, newline between rows, no trailing newline).
|
|
70
|
+
*/
|
|
71
|
+
text: string;
|
|
72
|
+
/** The block's sanitised HTML (`<pre>…</pre>` or `<table>…</table>`), for rich paste. */
|
|
73
|
+
html: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Writes one copy to the clipboard. Throwing, rejecting, or returning `false`
|
|
77
|
+
* means the copy failed; the failure is announced, never swallowed.
|
|
78
|
+
*/
|
|
79
|
+
type ContentClipboardWriter = (payload: ContentClipboardPayload) => void | boolean | Promise<void | boolean>;
|
|
80
|
+
/** Reported through `onCopy` after every copy attempt. */
|
|
81
|
+
interface ContentCopyEvent extends ContentClipboardPayload {
|
|
82
|
+
/** Position of the button among this renderer's copy buttons, in document order. */
|
|
83
|
+
index: number;
|
|
84
|
+
/** Whether the clipboard write succeeded. */
|
|
85
|
+
ok: boolean;
|
|
86
|
+
}
|
|
87
|
+
interface ContentRendererProps {
|
|
88
|
+
value: string;
|
|
89
|
+
format?: "html" | "markdown" | "auto";
|
|
90
|
+
lineSpacing?: number;
|
|
91
|
+
className?: string;
|
|
92
|
+
/** Per-instance render extensions. Merged with any globally-registered extensions. */
|
|
93
|
+
extensions?: RenderExtension[];
|
|
94
|
+
/**
|
|
95
|
+
* Skip HTML sanitization. By default, rendered output is sanitized to remove
|
|
96
|
+
* `<script>`, `<iframe>`, event handlers, and `javascript:` URIs. Pass
|
|
97
|
+
* `unsafe` only when the input is fully trusted (e.g. server-rendered
|
|
98
|
+
* markdown from your own CMS).
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
101
|
+
unsafe?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Copy buttons on code blocks and tables. `false` turns them all off; an
|
|
104
|
+
* object turns kinds off individually (`{ table: false }`).
|
|
105
|
+
* @default true
|
|
106
|
+
*/
|
|
107
|
+
copyButtons?: boolean | {
|
|
108
|
+
code?: boolean;
|
|
109
|
+
table?: boolean;
|
|
110
|
+
};
|
|
111
|
+
/** Called after every copy attempt, successful or not. */
|
|
112
|
+
onCopy?: (event: ContentCopyEvent) => void;
|
|
113
|
+
/**
|
|
114
|
+
* Host-supplied clipboard writer, for environments where
|
|
115
|
+
* `navigator.clipboard` is unreliable (e.g. a sandboxed Electron window:
|
|
116
|
+
* pass one that calls Electron's `clipboard`). The default writes
|
|
117
|
+
* text/html + text/plain via `ClipboardItem`, falling back to `writeText`.
|
|
118
|
+
*/
|
|
119
|
+
clipboardWriter?: ContentClipboardWriter;
|
|
120
|
+
/**
|
|
121
|
+
* The value is still arriving. Set it back to `false` when the stream ends
|
|
122
|
+
* and everything renders.
|
|
123
|
+
*
|
|
124
|
+
* - `true` holds back an unfinished trailing custom tag (of a registered
|
|
125
|
+
* extension) or code fence until it closes, so a partial `<result` or half
|
|
126
|
+
* a code block never flashes as raw text.
|
|
127
|
+
* - `"progressive"` shows an open block as it fills: an open registered tag
|
|
128
|
+
* whose opening tag is complete renders its component with the body so
|
|
129
|
+
* far, and an open code fence renders as a code block of what has arrived
|
|
130
|
+
* (with no copy button until it closes). A partial opening tag
|
|
131
|
+
* (`<result title="Do`) is still held back.
|
|
132
|
+
* @default false
|
|
133
|
+
*/
|
|
134
|
+
streaming?: boolean | "progressive";
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export { type ContentClipboardPayload as C, type RenderExtension as R, type ContentClipboardWriter as a, type ContentCopyEvent as b, type ContentCopyKind as c, type ContentRendererProps as d, type RenderExtensionProps as e, registerExtensions as f, type ContentSegment as g, registerExtension as r };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/** Props passed to every render-extension component. */
|
|
4
|
+
interface RenderExtensionProps {
|
|
5
|
+
/**
|
|
6
|
+
* The inner content of the custom tag (raw string). For an extension with
|
|
7
|
+
* `markdown: true` in markdown content this is the raw MARKDOWN body, before
|
|
8
|
+
* conversion. Either way it is untrusted: render `children` rather than
|
|
9
|
+
* injecting it.
|
|
10
|
+
*/
|
|
11
|
+
content: string;
|
|
12
|
+
/**
|
|
13
|
+
* Parsed attributes from the opening tag. Event handlers (`on*`), `srcdoc`,
|
|
14
|
+
* and URL attributes with an unsafe scheme are removed (unless the renderer
|
|
15
|
+
* is `unsafe`).
|
|
16
|
+
*/
|
|
17
|
+
attributes: Record<string, string>;
|
|
18
|
+
/**
|
|
19
|
+
* Only for extensions with `markdown: true`: the body, rendered by the same
|
|
20
|
+
* pipeline as the rest of the content (sanitised, nested extensions, copy
|
|
21
|
+
* buttons).
|
|
22
|
+
*/
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
/** Registers a custom tag with a React component for rendering. */
|
|
26
|
+
interface RenderExtension {
|
|
27
|
+
/** Tag name to match, e.g. "questions", "thinking". Case-insensitive. */
|
|
28
|
+
tag: string;
|
|
29
|
+
/** React component that renders the matched tag. */
|
|
30
|
+
component: ComponentType<RenderExtensionProps>;
|
|
31
|
+
/**
|
|
32
|
+
* Whether this is a block-level element.
|
|
33
|
+
* Block extensions are wrapped in a `<div>`, inline in a `<span>`.
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
block?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The tag's body is MARKDOWN. In markdown content, a tag that starts a line
|
|
39
|
+
* is lifted out of the source before conversion, so the component gets the
|
|
40
|
+
* raw markdown as `content` and the rendered, sanitised body as `children`.
|
|
41
|
+
* In HTML content the body is HTML and `children` renders it.
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
markdown?: boolean;
|
|
45
|
+
}
|
|
46
|
+
/** A parsed segment — either raw HTML or a matched extension tag. */
|
|
47
|
+
type ContentSegment = {
|
|
48
|
+
type: "html";
|
|
49
|
+
content: string;
|
|
50
|
+
} | {
|
|
51
|
+
type: "extension";
|
|
52
|
+
tag: string;
|
|
53
|
+
content: string;
|
|
54
|
+
attributes: Record<string, string>;
|
|
55
|
+
};
|
|
56
|
+
/** Register a single render extension globally (available to all ContentRenderer and Editor instances). */
|
|
57
|
+
declare function registerExtension(extension: RenderExtension): void;
|
|
58
|
+
/** Register multiple render extensions globally. */
|
|
59
|
+
declare function registerExtensions(extensions: RenderExtension[]): void;
|
|
60
|
+
|
|
61
|
+
/** What a copy button copies. */
|
|
62
|
+
type ContentCopyKind = "code" | "table";
|
|
63
|
+
/** What is handed to a clipboard writer. */
|
|
64
|
+
interface ContentClipboardPayload {
|
|
65
|
+
kind: ContentCopyKind;
|
|
66
|
+
/**
|
|
67
|
+
* Plain text. For code: exactly the code between the fences, with no
|
|
68
|
+
* language label and no added trailing newline. For a table: TSV (tab
|
|
69
|
+
* between cells, newline between rows, no trailing newline).
|
|
70
|
+
*/
|
|
71
|
+
text: string;
|
|
72
|
+
/** The block's sanitised HTML (`<pre>…</pre>` or `<table>…</table>`), for rich paste. */
|
|
73
|
+
html: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Writes one copy to the clipboard. Throwing, rejecting, or returning `false`
|
|
77
|
+
* means the copy failed; the failure is announced, never swallowed.
|
|
78
|
+
*/
|
|
79
|
+
type ContentClipboardWriter = (payload: ContentClipboardPayload) => void | boolean | Promise<void | boolean>;
|
|
80
|
+
/** Reported through `onCopy` after every copy attempt. */
|
|
81
|
+
interface ContentCopyEvent extends ContentClipboardPayload {
|
|
82
|
+
/** Position of the button among this renderer's copy buttons, in document order. */
|
|
83
|
+
index: number;
|
|
84
|
+
/** Whether the clipboard write succeeded. */
|
|
85
|
+
ok: boolean;
|
|
86
|
+
}
|
|
87
|
+
interface ContentRendererProps {
|
|
88
|
+
value: string;
|
|
89
|
+
format?: "html" | "markdown" | "auto";
|
|
90
|
+
lineSpacing?: number;
|
|
91
|
+
className?: string;
|
|
92
|
+
/** Per-instance render extensions. Merged with any globally-registered extensions. */
|
|
93
|
+
extensions?: RenderExtension[];
|
|
94
|
+
/**
|
|
95
|
+
* Skip HTML sanitization. By default, rendered output is sanitized to remove
|
|
96
|
+
* `<script>`, `<iframe>`, event handlers, and `javascript:` URIs. Pass
|
|
97
|
+
* `unsafe` only when the input is fully trusted (e.g. server-rendered
|
|
98
|
+
* markdown from your own CMS).
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
101
|
+
unsafe?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Copy buttons on code blocks and tables. `false` turns them all off; an
|
|
104
|
+
* object turns kinds off individually (`{ table: false }`).
|
|
105
|
+
* @default true
|
|
106
|
+
*/
|
|
107
|
+
copyButtons?: boolean | {
|
|
108
|
+
code?: boolean;
|
|
109
|
+
table?: boolean;
|
|
110
|
+
};
|
|
111
|
+
/** Called after every copy attempt, successful or not. */
|
|
112
|
+
onCopy?: (event: ContentCopyEvent) => void;
|
|
113
|
+
/**
|
|
114
|
+
* Host-supplied clipboard writer, for environments where
|
|
115
|
+
* `navigator.clipboard` is unreliable (e.g. a sandboxed Electron window:
|
|
116
|
+
* pass one that calls Electron's `clipboard`). The default writes
|
|
117
|
+
* text/html + text/plain via `ClipboardItem`, falling back to `writeText`.
|
|
118
|
+
*/
|
|
119
|
+
clipboardWriter?: ContentClipboardWriter;
|
|
120
|
+
/**
|
|
121
|
+
* The value is still arriving. Set it back to `false` when the stream ends
|
|
122
|
+
* and everything renders.
|
|
123
|
+
*
|
|
124
|
+
* - `true` holds back an unfinished trailing custom tag (of a registered
|
|
125
|
+
* extension) or code fence until it closes, so a partial `<result` or half
|
|
126
|
+
* a code block never flashes as raw text.
|
|
127
|
+
* - `"progressive"` shows an open block as it fills: an open registered tag
|
|
128
|
+
* whose opening tag is complete renders its component with the body so
|
|
129
|
+
* far, and an open code fence renders as a code block of what has arrived
|
|
130
|
+
* (with no copy button until it closes). A partial opening tag
|
|
131
|
+
* (`<result title="Do`) is still held back.
|
|
132
|
+
* @default false
|
|
133
|
+
*/
|
|
134
|
+
streaming?: boolean | "progressive";
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export { type ContentClipboardPayload as C, type RenderExtension as R, type ContentClipboardWriter as a, type ContentCopyEvent as b, type ContentCopyKind as c, type ContentRendererProps as d, type RenderExtensionProps as e, registerExtensions as f, type ContentSegment as g, registerExtension as r };
|
|
@@ -10,7 +10,8 @@ interface PillToInsert {
|
|
|
10
10
|
block: boolean;
|
|
11
11
|
}
|
|
12
12
|
interface InlinePasteEditorHandle {
|
|
13
|
-
focus()
|
|
13
|
+
/** Focus, caret at the end. `options` go to the element's `focus()` as given. */
|
|
14
|
+
focus(options?: FocusOptions): void;
|
|
14
15
|
/** Swap a pill for plain text, where it sits. */
|
|
15
16
|
replacePill(id: string, text: string): void;
|
|
16
17
|
/**
|
|
@@ -10,7 +10,8 @@ interface PillToInsert {
|
|
|
10
10
|
block: boolean;
|
|
11
11
|
}
|
|
12
12
|
interface InlinePasteEditorHandle {
|
|
13
|
-
focus()
|
|
13
|
+
/** Focus, caret at the end. `options` go to the element's `focus()` as given. */
|
|
14
|
+
focus(options?: FocusOptions): void;
|
|
14
15
|
/** Swap a pill for plain text, where it sits. */
|
|
15
16
|
replacePill(id: string, text: string): void;
|
|
16
17
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunk2O5UXH5R_cjs = require('./chunk-2O5UXH5R.cjs');
|
|
4
4
|
var chunkTLRFXSPA_cjs = require('./chunk-TLRFXSPA.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkJ5TFVYYM_cjs = require('./chunk-J5TFVYYM.cjs');
|
|
6
6
|
var chunkWKPBCB67_cjs = require('./chunk-WKPBCB67.cjs');
|
|
7
7
|
var chunkMAZEX4EZ_cjs = require('./chunk-MAZEX4EZ.cjs');
|
|
8
8
|
var chunkP53432AK_cjs = require('./chunk-P53432AK.cjs');
|
|
@@ -572,7 +572,7 @@ function JsonEditorValue({ node, mode, size, readOnly, id, onCommit }) {
|
|
|
572
572
|
);
|
|
573
573
|
case "secret":
|
|
574
574
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
575
|
-
|
|
575
|
+
chunkJ5TFVYYM_cjs.Input,
|
|
576
576
|
{
|
|
577
577
|
...common,
|
|
578
578
|
type: "password",
|
|
@@ -587,7 +587,7 @@ function JsonEditorValue({ node, mode, size, readOnly, id, onCommit }) {
|
|
|
587
587
|
case "string":
|
|
588
588
|
default:
|
|
589
589
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
590
|
-
|
|
590
|
+
chunkJ5TFVYYM_cjs.Input,
|
|
591
591
|
{
|
|
592
592
|
...common,
|
|
593
593
|
type: node.type === "url" ? "url" : node.type === "email" ? "email" : "text",
|
|
@@ -639,7 +639,7 @@ function RawValueEditor({
|
|
|
639
639
|
);
|
|
640
640
|
}
|
|
641
641
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
642
|
-
|
|
642
|
+
chunkJ5TFVYYM_cjs.Input,
|
|
643
643
|
{
|
|
644
644
|
id,
|
|
645
645
|
size,
|
|
@@ -712,7 +712,7 @@ function JsonEditorRow({ node }) {
|
|
|
712
712
|
className: "w-1/3 min-w-0 shrink-0",
|
|
713
713
|
children: [
|
|
714
714
|
renameable ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
715
|
-
|
|
715
|
+
chunkJ5TFVYYM_cjs.Input,
|
|
716
716
|
{
|
|
717
717
|
size: ctx.size,
|
|
718
718
|
mode: "edit",
|
|
@@ -889,7 +889,7 @@ function JsonEditorAddForm({ path, kind, depth, suggestedType }) {
|
|
|
889
889
|
style: { paddingInlineStart: depth * INDENT + 32 },
|
|
890
890
|
children: [
|
|
891
891
|
kind === "object" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
892
|
-
|
|
892
|
+
chunkJ5TFVYYM_cjs.Input,
|
|
893
893
|
{
|
|
894
894
|
size: ctx.size,
|
|
895
895
|
mode: "edit",
|
|
@@ -1350,5 +1350,5 @@ exports.parsePath = parsePath;
|
|
|
1350
1350
|
exports.pathToString = pathToString;
|
|
1351
1351
|
exports.resolveKeyRule = resolveKeyRule;
|
|
1352
1352
|
exports.typeMatches = typeMatches;
|
|
1353
|
-
//# sourceMappingURL=chunk-
|
|
1354
|
-
//# sourceMappingURL=chunk-
|
|
1353
|
+
//# sourceMappingURL=chunk-2PSHIUM7.cjs.map
|
|
1354
|
+
//# sourceMappingURL=chunk-2PSHIUM7.cjs.map
|