reactive-md 0.5.0 → 0.5.1
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-ch.md +16 -0
- package/CHANGELOG.md +16 -0
- package/README-ch.md +9 -7
- package/README-en.md +10 -7
- package/README.md +10 -7
- package/SECURITY-ch.md +4 -3
- package/SECURITY.md +4 -3
- package/THIRD_PARTY_NOTICES.md +45 -1
- package/dist-library/reactive-md-editor.css +1 -1
- package/dist-library/reactive-md-editor.js +739 -615
- package/dist-library/reactive-md-react.js +2081 -1904
- package/dist-library/reactive-md.js +440 -320
- package/dist-library/{runtime-DPuMxM_y.js → runtime-CXBdLQ3A.js} +8405 -2745
- package/dist-library/types/editor/editor-i18n.d.ts +7 -0
- package/dist-library/types/editor/editor-view-bar.d.ts +11 -0
- package/dist-library/types/editor/index.d.ts +1 -1
- package/dist-library/types/editor/types.d.ts +8 -1
- package/dist-library/types/local/LocalDocumentView.d.ts +10 -3
- package/dist-library/types/local/code-block.d.ts +3 -1
- package/dist-library/types/local/diagnostics.d.ts +25 -0
- package/dist-library/types/local/heading-anchors.d.ts +2 -0
- package/dist-library/types/local/html.d.ts +16 -0
- package/dist-library/types/local/image-view.d.ts +3 -1
- package/dist-library/types/local/index.d.ts +1 -1
- package/dist-library/types/local/options.d.ts +29 -0
- package/dist-library/types/local/types.d.ts +35 -1
- package/dist-library/types/local/worker.d.ts +18 -6
- package/dist-library/types/shareable.d.ts +9 -1
- package/dist-standalone/reactive-md-standalone.js +48 -48
- package/docs/compatibility-ch.md +4 -4
- package/docs/compatibility-en.md +4 -4
- package/docs/editor-ch.md +235 -216
- package/docs/editor-en.md +235 -216
- package/docs/html-compatibility-ch.md +98 -0
- package/docs/html-compatibility-en.md +98 -0
- package/docs/local-integration-ch.md +4 -1
- package/docs/local-integration-en.md +4 -1
- package/docs/local-interaction-syntax-ch.md +3 -1
- package/docs/local-interaction-syntax-en.md +1 -1
- package/docs/release-0.5.1-ch.md +39 -0
- package/docs/release-0.5.1-en.md +39 -0
- package/docs/releasing-ch.md +7 -7
- package/docs/releasing-en.md +8 -8
- package/docs/shareable-export-ch.md +2 -0
- package/docs/shareable-export-en.md +2 -0
- package/examples/local/README.md +2 -0
- package/examples/local/html-compat.reactive.md +24 -0
- package/package.json +3 -1
|
@@ -95,6 +95,13 @@ export interface EditorChromeCopy {
|
|
|
95
95
|
/** Accessible name for the textarea when the host passes no ariaLabel. */
|
|
96
96
|
sourceLabel: string;
|
|
97
97
|
region: string;
|
|
98
|
+
previewRegion: string;
|
|
99
|
+
viewLabel: string;
|
|
100
|
+
count(value: string): string;
|
|
101
|
+
keyboardHint: string;
|
|
102
|
+
edit: string;
|
|
103
|
+
split: string;
|
|
104
|
+
preview: string;
|
|
98
105
|
}
|
|
99
106
|
export declare const EDITOR_CHROME_COPY: Record<EditorLocale, EditorChromeCopy>;
|
|
100
107
|
export declare const EDITOR_COMMAND_COPY: Record<EditorLocale, EditorCommandCopy>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EditorViewMode } from './types.js';
|
|
2
|
+
export declare function EditorViewBar({ source, mode, onModeChange, sourceId, previewId, hasPreview, allowSplit, toolbar }: {
|
|
3
|
+
source: string;
|
|
4
|
+
mode: EditorViewMode;
|
|
5
|
+
onModeChange(mode: EditorViewMode): void;
|
|
6
|
+
sourceId: string;
|
|
7
|
+
previewId: string;
|
|
8
|
+
hasPreview: boolean;
|
|
9
|
+
allowSplit: boolean;
|
|
10
|
+
toolbar: boolean;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* for the stylesheet, or use `./library` for the CSS-included bundle.
|
|
7
7
|
*/
|
|
8
8
|
export { ReactiveMarkdownEditor } from './ReactiveMarkdownEditor.js';
|
|
9
|
-
export type { EditorEdit, EditorLocale, EditorSelection, EditorTheme, ReactiveMarkdownEditorHandle, ReactiveMarkdownEditorProps, } from './types.js';
|
|
9
|
+
export type { EditorEdit, EditorLocale, EditorSelection, EditorTheme, EditorViewMode, ReactiveMarkdownEditorHandle, ReactiveMarkdownEditorProps, } from './types.js';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { CSSProperties, RefObject } from 'react';
|
|
1
|
+
import type { CSSProperties, ReactNode, RefObject } from 'react';
|
|
2
2
|
import type { Diagnostic, LocalDocument, SourceRange } from '../local/types.js';
|
|
3
3
|
export type EditorLocale = 'en' | 'zh';
|
|
4
4
|
export type EditorTheme = 'light' | 'dark' | 'auto';
|
|
5
|
+
export type EditorViewMode = 'edit' | 'split' | 'preview';
|
|
5
6
|
export interface EditorSelection {
|
|
6
7
|
start: number;
|
|
7
8
|
end: number;
|
|
@@ -15,6 +16,12 @@ export interface ReactiveMarkdownEditorProps {
|
|
|
15
16
|
onChange(value: string): void;
|
|
16
17
|
locale?: EditorLocale;
|
|
17
18
|
theme?: EditorTheme;
|
|
19
|
+
/** Preview content rendered inside the editor frame. Enables view switching. */
|
|
20
|
+
preview?: ReactNode;
|
|
21
|
+
/** Controlled view mode; omit to let the editor manage its own mode. */
|
|
22
|
+
viewMode?: EditorViewMode;
|
|
23
|
+
defaultViewMode?: EditorViewMode;
|
|
24
|
+
onViewModeChange?(mode: EditorViewMode): void;
|
|
18
25
|
id?: string;
|
|
19
26
|
className?: string;
|
|
20
27
|
style?: CSSProperties;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import type { Diagnostic, LocalDocument, LocalNode, LocalRuntime } from './types.js';
|
|
2
|
+
import type { Diagnostic, LocalCompileOptions, LocalDocument, LocalNode, LocalRuntime } from './types.js';
|
|
3
3
|
import type { LocalRenderMode } from './render-types.js';
|
|
4
4
|
import { type LocalColorScheme, type LocalThemeDefinition } from './theme.js';
|
|
5
5
|
import { type LocalLocale, type Localize } from './i18n.js';
|
|
@@ -59,6 +59,12 @@ export interface LocalReactiveDocumentProps {
|
|
|
59
59
|
staticFirst?: boolean;
|
|
60
60
|
/** Trusted image URL mapping forwarded to `LocalDocumentView`. */
|
|
61
61
|
imageResolver?: LocalImageResolver;
|
|
62
|
+
/**
|
|
63
|
+
* Host-owned compile options. HTML capability flags select the temporary
|
|
64
|
+
* whole-document native branch; the component recompiles when a flag or the
|
|
65
|
+
* node budget changes, but not when an equal object is recreated.
|
|
66
|
+
*/
|
|
67
|
+
compileOptions?: LocalCompileOptions;
|
|
62
68
|
}
|
|
63
69
|
interface LocalComponentProps {
|
|
64
70
|
node: LocalNode;
|
|
@@ -77,6 +83,7 @@ export declare function textProblem(value: string, options: {
|
|
|
77
83
|
email?: boolean;
|
|
78
84
|
}, t?: Localize): string | null;
|
|
79
85
|
export declare const COMPONENTS: Record<string, (props: LocalComponentProps) => ReactNode>;
|
|
80
|
-
|
|
81
|
-
export declare function
|
|
86
|
+
/** Keep the two render paths in separate components so mode changes obey hook ordering. */
|
|
87
|
+
export declare function LocalDocumentView(props: LocalDocumentViewProps): import("react").JSX.Element;
|
|
88
|
+
export declare function LocalReactiveDocument({ source, onDiagnostics, urlPolicy, locale, themes, colorScheme, mode, staticFirst, imageResolver, compileOptions, }: LocalReactiveDocumentProps): import("react").JSX.Element;
|
|
82
89
|
export {};
|
|
@@ -20,5 +20,7 @@ export interface CodeBlockViewProps {
|
|
|
20
20
|
value: string;
|
|
21
21
|
language?: string;
|
|
22
22
|
mode: 'interactive' | 'static';
|
|
23
|
+
/** Renderer-validated P0 HTML attributes, never raw source attributes. */
|
|
24
|
+
htmlProps?: Record<string, string>;
|
|
23
25
|
}
|
|
24
|
-
export declare function CodeBlockView({ value, language, mode }: CodeBlockViewProps): ReactElement;
|
|
26
|
+
export declare function CodeBlockView({ value, language, mode, htmlProps }: CodeBlockViewProps): ReactElement;
|
|
@@ -226,6 +226,26 @@ export declare const LOCAL_DIAGNOSTIC_MESSAGES: {
|
|
|
226
226
|
readonly en: 'Raw HTML is not part of the local interaction syntax.';
|
|
227
227
|
readonly zh: '原始 HTML 不属于本地交互语法。';
|
|
228
228
|
};
|
|
229
|
+
readonly 'html.extended': {
|
|
230
|
+
readonly en: 'HTML element <{name}> requires enableExtendedHtml in this mode; it is shown as source.';
|
|
231
|
+
readonly zh: '此模式下 HTML 元素 <{name}> 需要启用 enableExtendedHtml;已按源码显示。';
|
|
232
|
+
};
|
|
233
|
+
readonly 'html.attribute': {
|
|
234
|
+
readonly en: 'HTML attribute {name} on <{tag}> is not supported; the element is shown as source.';
|
|
235
|
+
readonly zh: '<{tag}> 上的 HTML 属性 {name} 不受支持;该元素已按源码显示。';
|
|
236
|
+
};
|
|
237
|
+
readonly 'html.unsafeUrl': {
|
|
238
|
+
readonly en: 'Unsafe URL in attribute {name} was removed.';
|
|
239
|
+
readonly zh: '属性 {name} 中的不安全 URL 已移除。';
|
|
240
|
+
};
|
|
241
|
+
readonly 'html.capability': {
|
|
242
|
+
readonly en: 'Author {feature} was disabled by the compile options.';
|
|
243
|
+
readonly zh: '编译选项已禁用作者提供的{feature}。';
|
|
244
|
+
};
|
|
245
|
+
readonly 'options.htmlFlag': {
|
|
246
|
+
readonly en: 'Compile option {name} must be a boolean.';
|
|
247
|
+
readonly zh: '编译选项 {name} 必须是布尔值。';
|
|
248
|
+
};
|
|
229
249
|
readonly 'component.unknownSuggestion': {
|
|
230
250
|
readonly en: 'Unknown component <{name}>. Did you mean <{suggestion}>?';
|
|
231
251
|
readonly zh: '未知组件 <{name}>。是否想使用 <{suggestion}>?';
|
|
@@ -1241,6 +1261,11 @@ declare const LOCAL_DIAGNOSTIC_TEMPLATE_ALIASES: {
|
|
|
1241
1261
|
readonly 'local.math.whitespace': 'math.whitespace';
|
|
1242
1262
|
readonly 'local.footnote.unsupported': 'footnote.unsupported';
|
|
1243
1263
|
readonly 'local.html': 'html.raw';
|
|
1264
|
+
readonly 'local.html.extended': 'html.extended';
|
|
1265
|
+
readonly 'local.html.attribute': 'html.attribute';
|
|
1266
|
+
readonly 'local.html.unsafe-url': 'html.unsafeUrl';
|
|
1267
|
+
readonly 'local.html.capability': 'html.capability';
|
|
1268
|
+
readonly 'local.options.invalid.html-flag': 'options.htmlFlag';
|
|
1244
1269
|
readonly 'local.component.unknown.suggestion': 'component.unknownSuggestion';
|
|
1245
1270
|
readonly 'local.component.unknown': 'component.unknownPlain';
|
|
1246
1271
|
readonly 'local.attribute.format': 'attribute.lowercase';
|
|
@@ -11,7 +11,9 @@ import type { LocalDocument, LocalNode } from './types.js';
|
|
|
11
11
|
export declare function createHeadingAnchors(document: LocalDocument, namespace: string, includeExplicitAnchors?: boolean): {
|
|
12
12
|
ids: Map<LocalNode, string>;
|
|
13
13
|
anchorIds: Map<LocalNode, string>;
|
|
14
|
+
htmlIds: Map<LocalNode, string>;
|
|
14
15
|
/** Namespaced DOM id for a static jump/anchor target slug, if it exists. */
|
|
15
16
|
targetId(to: string): string | undefined;
|
|
17
|
+
referenceId(to: string): string;
|
|
16
18
|
resolve(href: string): string;
|
|
17
19
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Diagnostic, LocalHtmlPolicy } from './types.js';
|
|
2
|
+
export interface LocalHtmlSanitizeResult {
|
|
3
|
+
markup: string;
|
|
4
|
+
diagnostics: Diagnostic[];
|
|
5
|
+
}
|
|
6
|
+
/** The sandbox always keeps author documents separate from their host. */
|
|
7
|
+
export declare function localHtmlSandbox(policy: LocalHtmlPolicy): string;
|
|
8
|
+
/** Resources stay offline; extended HTML permits explicit HTTP(S) form submissions. */
|
|
9
|
+
export declare function localHtmlContentSecurityPolicy(policy: LocalHtmlPolicy): string;
|
|
10
|
+
/**
|
|
11
|
+
* Parse, sanitize and serialize a whole native HTML document. The result is a
|
|
12
|
+
* complete document string suitable for a sandboxed `srcdoc` iframe.
|
|
13
|
+
*/
|
|
14
|
+
export declare function sanitizeLocalHtmlDocument(source: string, policy: LocalHtmlPolicy, maxSyntaxNodes: number): LocalHtmlSanitizeResult;
|
|
15
|
+
export declare const LOCAL_HTML_P0_ELEMENTS: Set<string>;
|
|
16
|
+
export declare const LOCAL_HTML_VOID_ELEMENTS: Set<string>;
|
|
@@ -12,10 +12,12 @@ import { type RefObject } from 'react';
|
|
|
12
12
|
* is a button only when it is not already wrapped in a Markdown link; a
|
|
13
13
|
* link-wrapped image keeps the anchor's navigation and has no extra tab stop.
|
|
14
14
|
*/
|
|
15
|
-
export declare function ZoomableImage({ src, alt, title, mode, rootRef, }: {
|
|
15
|
+
export declare function ZoomableImage({ src, alt, title, mode, rootRef, imageProps, }: {
|
|
16
16
|
src: string;
|
|
17
17
|
alt: string;
|
|
18
18
|
title?: string;
|
|
19
19
|
mode: 'interactive' | 'static';
|
|
20
20
|
rootRef: RefObject<HTMLElement | null>;
|
|
21
|
+
/** Validated source attributes for P0 HTML images; zoom behaviour is shared. */
|
|
22
|
+
imageProps?: Record<string, string | number | undefined>;
|
|
21
23
|
}): import("react").JSX.Element;
|
|
@@ -14,7 +14,7 @@ export type { LocalVersionDeclaration } from './types.js';
|
|
|
14
14
|
export type { LocalLocale } from './locale.js';
|
|
15
15
|
export { LOCAL_THEME_PROTOCOL, DEFAULT_LOCAL_THEME, resolveLocalTheme, isLocalThemeName } from './theme.js';
|
|
16
16
|
export type { LocalColorScheme, LocalThemeDefinition, LocalThemeResolution } from './theme.js';
|
|
17
|
-
export type { Diagnostic, LocalDiagnosticParam, LocalDiagnosticParams, SourceRange, LocalValue, LocalValueKind, LocalNode, LocalBinding, LocalComputation, LocalValidation, LocalDocument, LocalCompileLimits, LocalCompileOptions, LocalCompileResult, LocalRuntime, LocalSnapshot } from './types.js';
|
|
17
|
+
export type { Diagnostic, LocalDiagnosticParam, LocalDiagnosticParams, SourceRange, LocalValue, LocalValueKind, LocalNode, LocalBinding, LocalComputation, LocalValidation, LocalDocument, LocalHtmlOptions, LocalHtmlPolicy, LocalCompileLimits, LocalCompileOptions, LocalCompileResult, LocalRuntime, LocalSnapshot } from './types.js';
|
|
18
18
|
export { LOCAL_STATE_FORMAT, localSourceDigest, createLocalStateFile, parseLocalState, resolveLocalState, applyLocalState, exportLocalState, importLocalState, serializeLocalState, } from './state.js';
|
|
19
19
|
export type { LocalStateGenerator, LocalStateFile, LocalStateParseResult, LocalStateResolution, } from './state.js';
|
|
20
20
|
export { planLocalStateRetention, applyLocalStateRetention } from './retention.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { LocalCompileOptions, LocalHtmlPolicy } from './types.js';
|
|
2
|
+
/** Capability flags that select the temporary whole-document HTML branch. */
|
|
3
|
+
export declare const LOCAL_HTML_FLAGS: readonly ['enableCss', 'enableJavaScript', 'enableExtendedHtml'];
|
|
4
|
+
export type LocalHtmlFlag = (typeof LOCAL_HTML_FLAGS)[number];
|
|
5
|
+
export type LocalOptionCheck = {
|
|
6
|
+
ok: true;
|
|
7
|
+
/** Validated syntax-node budget for this compilation. */
|
|
8
|
+
maxSyntaxNodes: number;
|
|
9
|
+
/** Effective HTML policy; every flag is false by default. */
|
|
10
|
+
html: LocalHtmlPolicy;
|
|
11
|
+
/** True when at least one capability flag is enabled. */
|
|
12
|
+
htmlActive: boolean;
|
|
13
|
+
} | {
|
|
14
|
+
ok: false;
|
|
15
|
+
message: string;
|
|
16
|
+
key: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Read and validate host compile options once. Every call site (Markdown
|
|
20
|
+
* parser, HTML compiler, worker and React component) uses the same rules so a
|
|
21
|
+
* malformed flag can never silently fall back to the Markdown pipeline.
|
|
22
|
+
*/
|
|
23
|
+
export declare function readLocalCompileOptions(options: LocalCompileOptions | undefined): LocalOptionCheck;
|
|
24
|
+
/**
|
|
25
|
+
* Stable signature of the option values that affect compilation. Used to
|
|
26
|
+
* recompile on flag/limit changes and to keep worker races keyed by more than
|
|
27
|
+
* the source text. Unknown keys are deliberately ignored.
|
|
28
|
+
*/
|
|
29
|
+
export declare function localCompileOptionsKey(options: LocalCompileOptions | undefined): string;
|
|
@@ -44,6 +44,10 @@ export interface LocalNode {
|
|
|
44
44
|
url?: string;
|
|
45
45
|
title?: string | null;
|
|
46
46
|
alt?: string;
|
|
47
|
+
/** Rendered width of an HTML `<img>`, in CSS pixels. */
|
|
48
|
+
width?: number;
|
|
49
|
+
/** Rendered height of an HTML `<img>`, in CSS pixels. */
|
|
50
|
+
height?: number;
|
|
47
51
|
lang?: string;
|
|
48
52
|
align?: ('left' | 'center' | 'right' | null)[];
|
|
49
53
|
/**
|
|
@@ -104,6 +108,13 @@ export interface LocalDocument {
|
|
|
104
108
|
source: string;
|
|
105
109
|
/** Effective syntax revision; absent on older hand-built runtime documents. */
|
|
106
110
|
syntaxVersion?: 'local-draft-2';
|
|
111
|
+
/**
|
|
112
|
+
* Present only when at least one HTML capability flag was enabled. Its
|
|
113
|
+
* presence routes rendering to the isolated native-HTML branch; the
|
|
114
|
+
* original source is preserved and `nodes` carries one `htmlDocument` node
|
|
115
|
+
* whose `value` is the sanitized, complete iframe document.
|
|
116
|
+
*/
|
|
117
|
+
html?: LocalHtmlPolicy;
|
|
107
118
|
versionDeclaration?: LocalVersionDeclaration;
|
|
108
119
|
nodes: LocalNode[];
|
|
109
120
|
initialState: Record<string, LocalValue>;
|
|
@@ -153,7 +164,30 @@ export interface LocalCompileLimits {
|
|
|
153
164
|
/** Positive safe integer; defaults to 10,000 cumulative LocalNode creations. */
|
|
154
165
|
readonly maxSyntaxNodes?: number;
|
|
155
166
|
}
|
|
156
|
-
|
|
167
|
+
/**
|
|
168
|
+
* Host-owned capability flags for the temporary whole-document HTML mode.
|
|
169
|
+
*
|
|
170
|
+
* All flags default to `false`. When every flag is false the existing
|
|
171
|
+
* Markdown/ReactiveMD pipeline runs unchanged. When any flag is true the whole
|
|
172
|
+
* source is interpreted as native HTML and rendered inside a sandboxed iframe;
|
|
173
|
+
* Markdown, interpolation, bindings, formulas and ReactiveMD components are not
|
|
174
|
+
* interpreted in that mode.
|
|
175
|
+
*/
|
|
176
|
+
export interface LocalHtmlOptions {
|
|
177
|
+
/** Allow authored CSS; external resources remain subject to the native CSP. */
|
|
178
|
+
readonly enableCss?: boolean;
|
|
179
|
+
/** Allow authored scripts and inline event handlers. */
|
|
180
|
+
readonly enableJavaScript?: boolean;
|
|
181
|
+
/** Allow HTML beyond the safe P0 subset (tables, forms, SVG/MathML, ...). */
|
|
182
|
+
readonly enableExtendedHtml?: boolean;
|
|
183
|
+
}
|
|
184
|
+
/** Effective, non-optional policy recorded on a compiled HTML-branch document. */
|
|
185
|
+
export interface LocalHtmlPolicy {
|
|
186
|
+
readonly enableCss: boolean;
|
|
187
|
+
readonly enableJavaScript: boolean;
|
|
188
|
+
readonly enableExtendedHtml: boolean;
|
|
189
|
+
}
|
|
190
|
+
export interface LocalCompileOptions extends LocalHtmlOptions {
|
|
157
191
|
readonly limits?: LocalCompileLimits;
|
|
158
192
|
}
|
|
159
193
|
export type LocalCompileResult = {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type { Diagnostic, LocalCompileResult } from './types.js';
|
|
1
|
+
import type { Diagnostic, LocalCompileOptions, LocalCompileResult } from './types.js';
|
|
2
2
|
/** Editors are coalesced for this long before a compile is dispatched. */
|
|
3
3
|
export declare const LOCAL_COMPILE_DELAY_MS = 150;
|
|
4
4
|
export interface LocalCompileRequest {
|
|
5
5
|
id: number;
|
|
6
6
|
source: string;
|
|
7
|
+
/** Capability flags and limits granted for this compile. */
|
|
8
|
+
options?: LocalCompileOptions;
|
|
7
9
|
}
|
|
8
10
|
export type LocalCompileResponse = {
|
|
9
11
|
id: number;
|
|
@@ -32,11 +34,16 @@ export interface LocalCompileOutcome {
|
|
|
32
34
|
result: LocalCompileResult;
|
|
33
35
|
duration: number;
|
|
34
36
|
mode: LocalCompileMode;
|
|
37
|
+
/** Snapshot of the options this result was compiled with, when supplied. */
|
|
38
|
+
options?: LocalCompileOptions;
|
|
35
39
|
}
|
|
36
40
|
export interface LocalCompileSchedulerOptions {
|
|
37
41
|
createWorker(): LocalCompileWorker;
|
|
38
|
-
/**
|
|
39
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Defaults to compileLocal. Runs on the main thread only when the worker is
|
|
44
|
+
* unavailable or failed. One-argument callbacks remain supported.
|
|
45
|
+
*/
|
|
46
|
+
fallbackCompile?(source: string, options?: LocalCompileOptions): LocalCompileResult;
|
|
40
47
|
onResult(outcome: LocalCompileOutcome): void;
|
|
41
48
|
onPendingChange?(pending: boolean): void;
|
|
42
49
|
onModeChange?(mode: LocalCompileMode, detail?: string): void;
|
|
@@ -52,14 +59,19 @@ export declare class LocalCompileScheduler {
|
|
|
52
59
|
private readonly delay;
|
|
53
60
|
private worker;
|
|
54
61
|
private timer;
|
|
55
|
-
private
|
|
62
|
+
private queued;
|
|
56
63
|
private inFlight;
|
|
57
64
|
private nextId;
|
|
58
65
|
private pending;
|
|
59
66
|
private disposed;
|
|
60
67
|
constructor(options: LocalCompileSchedulerOptions);
|
|
61
|
-
/**
|
|
62
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Queue the newest source and its compile options; the previous timer, if
|
|
70
|
+
* any, is replaced. Options are copied so a later mutation cannot change the
|
|
71
|
+
* permissions of an in-flight compile. An options-only edit still supersedes
|
|
72
|
+
* an older result for the same source.
|
|
73
|
+
*/
|
|
74
|
+
schedule(source: string, options?: LocalCompileOptions): void;
|
|
63
75
|
/** Stop the timer and terminate the worker. No callbacks fire afterwards. */
|
|
64
76
|
dispose(): void;
|
|
65
77
|
private drain;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type LocalStateFile, type LocalStateGenerator } from './local/state.js';
|
|
2
|
-
import type { Diagnostic, LocalDocument, LocalValue } from './local/types.js';
|
|
2
|
+
import type { Diagnostic, LocalCompileOptions, LocalDocument, LocalValue } from './local/types.js';
|
|
3
3
|
/** Version of the single-file HTML envelope, not of the document syntax. */
|
|
4
4
|
export declare const SHAREABLE_HTML_FORMAT: 'reactive-md-html/v1';
|
|
5
5
|
export type ShareableHtmlMode = 'interactive' | 'static';
|
|
@@ -12,6 +12,8 @@ export interface ShareableMountPayload {
|
|
|
12
12
|
locale: 'en' | 'zh';
|
|
13
13
|
colorScheme: 'light' | 'dark' | 'auto';
|
|
14
14
|
hydrate: boolean;
|
|
15
|
+
/** Capability flags and limits the document was compiled with. */
|
|
16
|
+
compileOptions?: LocalCompileOptions;
|
|
15
17
|
/** Verified relative image URL -> inline raster data URL. */
|
|
16
18
|
images?: Readonly<Record<string, string>>;
|
|
17
19
|
}
|
|
@@ -37,6 +39,12 @@ export interface ShareableHtmlOptions {
|
|
|
37
39
|
images?: Readonly<Record<string, string>>;
|
|
38
40
|
notices?: string;
|
|
39
41
|
targetId?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Routing capabilities granted by the host and used to compile this exact
|
|
44
|
+
* document. Interactive exports replay them; static native exports are
|
|
45
|
+
* re-sanitized with author JavaScript forced off.
|
|
46
|
+
*/
|
|
47
|
+
compileOptions?: LocalCompileOptions;
|
|
40
48
|
}
|
|
41
49
|
export interface LocalStateBaselineResult {
|
|
42
50
|
document: LocalDocument;
|