reactive-md 0.9.0 → 0.9.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 +13 -0
- package/CHANGELOG.md +13 -0
- package/README-ch.md +6 -6
- package/README-en.md +6 -6
- package/README.md +6 -6
- package/SECURITY-ch.md +3 -3
- package/SECURITY.md +3 -3
- package/THIRD_PARTY_NOTICES.md +111 -1
- package/cli/build.mjs +1 -0
- package/cli/init.mjs +1 -1
- package/dist-library/{LocalDocumentView-K7Y-2bRJ.js → LocalDocumentView-sthUP0ct.js} +10 -10
- package/dist-library/LocalDocumentViewCore-GiWV3bey.js +9829 -0
- package/dist-library/LocalReactiveDocumentCore-ZjQSGyHE.js +275 -0
- package/dist-library/{authoring-Co_TiE-P.js → authoring-Dsune4Hy.js} +40 -20
- package/dist-library/{compile-LhpTKqCR.js → compile-wUv8KEge.js} +1 -1
- package/dist-library/{compiler-core-DTxY-qYz.js → compiler-core-As_m-MNm.js} +2449 -1742
- package/dist-library/{compiler-DfGbQhyD.js → compiler-eOfcinZs.js} +19 -19
- package/dist-library/{component-state-BBJ08vML.js → component-state-C52ZFJGl.js} +1 -1
- package/dist-library/{config-BUo-8O5C.js → config-BadfhjdP.js} +1 -1
- package/dist-library/{config-validation-C5kJYk-J.js → config-validation-F47AcE6o.js} +49 -1
- package/dist-library/{controls-BWiLLtBO.js → controls-CcT6n7k_.js} +2433 -2409
- package/dist-library/{coordinate-BSl6enWV.js → coordinate-CWS9p5q_.js} +108 -107
- package/dist-library/{data-table-DfvytZKQ.js → data-table-Bgccxd7h.js} +68 -65
- package/dist-library/{display-lw3BT1TA.js → display-B-VhqVND.js} +1 -1
- package/dist-library/{export-C7IDW9ul.js → export-BqVmTXm8.js} +145 -87
- package/dist-library/{gallery-B8kSt1oI.js → gallery-CY6mTx8i.js} +151 -147
- package/dist-library/html-CNT4KD-2.js +757 -0
- package/dist-library/{incremental-D_6vwAAE.js → incremental-Dv0FSp_U.js} +404 -142
- package/dist-library/layout-C0YlEPGr.js +562 -0
- package/dist-library/{mount-preset-C5s9ebEH.js → mount-preset-KxvtKgJb.js} +2 -2
- package/dist-library/options-1aDLK7JY.js +121 -0
- package/dist-library/{package-core-D0POW4Gd.js → package-core-WFK1RhAZ.js} +3 -3
- package/dist-library/{parser-standard-OToYcOBL.js → parser-standard-Yuf3A_VI.js} +3270 -3778
- package/dist-library/react-D5iGiUdL.js +7 -0
- package/dist-library/reactive-md-authoring.js +16 -18
- package/dist-library/reactive-md-build.js +51 -51
- package/dist-library/reactive-md-compiler-standard.js +10 -9
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-export.js +4 -4
- package/dist-library/reactive-md-minimal-react-preset.js +3 -3
- package/dist-library/reactive-md-pdf.js +127 -3
- package/dist-library/reactive-md-plugin-chart.js +2 -2
- package/dist-library/reactive-md-plugin-data.js +4 -4
- package/dist-library/reactive-md-plugin-diagram.js +3 -3
- package/dist-library/reactive-md-plugin-forms.js +2 -2
- package/dist-library/reactive-md-plugin-gallery.js +2 -2
- package/dist-library/reactive-md-plugin-navigation.js +2 -2
- package/dist-library/reactive-md-plugin-network.js +117 -115
- package/dist-library/reactive-md-plugin-plot.js +3 -3
- package/dist-library/reactive-md-react-minimal.js +4 -4
- package/dist-library/reactive-md-react-server.js +6 -6
- package/dist-library/reactive-md-react-unstyled.js +10 -11
- package/dist-library/reactive-md-react.js +10 -11
- package/dist-library/reactive-md-sdk.js +3 -3
- package/dist-library/reactive-md-standalone-configured.js +2 -2
- package/dist-library/reactive-md-standalone-host.js +2 -2
- package/dist-library/reactive-md-testing-browser.js +2 -2
- package/dist-library/reactive-md-testing-react.js +6 -6
- package/dist-library/reactive-md-testing.js +4 -4
- package/dist-library/reactive-md.js +280 -193
- package/dist-library/{registry-05JiqmEp.js → registry-B9NGct4d.js} +1 -1
- package/dist-library/{resources-IeJomeUT.js → resources-D2GDQS0p.js} +1 -1
- package/dist-library/{runtime-CuOyRe9f.js → runtime-kcA7bG7G.js} +341 -341
- package/dist-library/{schema-C-AeByPp.js → schema-BufhKUSM.js} +5 -5
- package/dist-library/{sdk-core-BJLJaVR5.js → sdk-core-BoJT1SIt.js} +490 -150
- package/dist-library/{session-core-BGka5D1J.js → session-core-nmJHuR9c.js} +170 -156
- package/dist-library/{shareable-jkGi2g6y.js → shareable-DpbE-59H.js} +207 -242
- package/dist-library/types/authoring/catalog.d.ts +1 -2
- package/dist-library/types/components/shared/visual-frame.d.ts +6 -2
- package/dist-library/types/local/compilation/compiler-capabilities.d.ts +3 -0
- package/dist-library/types/local/compilation/compiler-core.d.ts +11 -3
- package/dist-library/types/local/compilation/compiler-services.d.ts +8 -4
- package/dist-library/types/local/compilation/compiler.d.ts +3 -3
- package/dist-library/types/local/compilation/session/incremental.d.ts +20 -5
- package/dist-library/types/local/compilation/streaming.d.ts +27 -0
- package/dist-library/types/local/configuration/capability-policy.d.ts +3 -0
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +48 -0
- package/dist-library/types/local/configuration/options-core.d.ts +1 -2
- package/dist-library/types/local/configuration/options.d.ts +1 -0
- package/dist-library/types/local/css/author-css.d.ts +66 -0
- package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
- package/dist-library/types/local/html/html.d.ts +39 -3
- package/dist-library/types/local/index.d.ts +1 -1
- package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
- package/dist-library/types/local/parsing/parse-session.d.ts +2 -2
- package/dist-library/types/local/parsing/parser-convert.d.ts +2 -1
- package/dist-library/types/local/parsing/parser-core.d.ts +8 -1
- package/dist-library/types/local/parsing/parser.d.ts +2 -2
- package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
- package/dist-library/types/local/rendering/document/LocalDocumentViewCore.d.ts +25 -1
- package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +1 -1
- package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
- package/dist-library/types/local/rendering/document/view-render-context.d.ts +11 -1
- package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
- package/dist-library/types/local/transport/worker.d.ts +27 -4
- package/dist-library/types/local/types.d.ts +52 -16
- package/dist-library/types/react/component-api.d.ts +10 -1
- package/dist-library/types/react/component-utils.d.ts +9 -1
- package/dist-library/types/react/sdk-core.d.ts +4 -1
- package/dist-library/types/shareable.d.ts +5 -4
- package/dist-library/types/standalone/prepare.d.ts +1 -1
- package/dist-library/types/standalone/session-core.d.ts +3 -2
- package/dist-library/{types-BFC5rzC4.js → types-BeNtPqdY.js} +1 -1
- package/dist-library/{validation-BlDL2uD9.js → validation-BEBA_HvS.js} +88 -72
- package/dist-library/{visual-frame-G8PHoj1e.js → visual-frame-CyV1FXzs.js} +6 -5
- package/dist-library/{visuals-BkYRmYGO.js → visuals-BZbZYA7w.js} +24181 -24180
- package/dist-standalone/reactive-md-standalone.js +124 -117
- package/docs/README-ch.md +2 -1
- package/docs/README.md +2 -1
- package/docs/compatibility/compatibility-ch.md +6 -6
- package/docs/compatibility/compatibility-en.md +6 -6
- package/docs/compatibility/source-versioning-ch.md +1 -1
- package/docs/compatibility/source-versioning-en.md +1 -1
- package/docs/development/component-development-ch.md +2 -2
- package/docs/development/component-development-en.md +2 -2
- package/docs/development/component-development-reference-ch.md +2 -2
- package/docs/development/component-development-reference-en.md +2 -2
- package/docs/development/component-protocol-ch.md +2 -2
- package/docs/development/component-protocol-en.md +2 -2
- package/docs/development/extension-tutorial-ch.md +3 -3
- package/docs/development/extension-tutorial-en.md +3 -3
- package/docs/integration/author-tools-ch.md +1 -1
- package/docs/integration/author-tools-en.md +1 -1
- package/docs/integration/compiler-ch.md +3 -1
- package/docs/integration/compiler-en.md +3 -1
- package/docs/integration/editor-ch.md +3 -3
- package/docs/integration/editor-en.md +3 -3
- package/docs/integration/extension-sdk-ch.md +2 -2
- package/docs/integration/extension-sdk-en.md +2 -2
- package/docs/integration/local-integration-ch.md +130 -8
- package/docs/integration/local-integration-en.md +130 -8
- package/docs/integration/shareable-export-ch.md +4 -2
- package/docs/integration/shareable-export-en.md +4 -2
- package/docs/reference/html-compatibility-ch.md +20 -67
- package/docs/reference/html-compatibility-en.md +19 -64
- package/docs/reference/public-api-ch.md +10 -7
- package/docs/reference/public-api-en.md +10 -7
- package/docs/releases/release-0.9.1-ch.md +29 -0
- package/docs/releases/release-0.9.1-en.md +29 -0
- package/examples/component-package/README-ch.md +1 -1
- package/examples/component-package/README.md +1 -1
- package/examples/game-2048-package/README-ch.md +1 -1
- package/examples/game-2048-package/README.md +1 -1
- package/examples/integration/README-ch.md +21 -2
- package/examples/integration/README.md +21 -2
- package/examples/integration/extension-sdk/README-ch.md +1 -1
- package/examples/integration/extension-sdk/README.md +1 -1
- package/examples/integration/streaming/index.html +48 -0
- package/examples/integration/streaming/main.js +175 -0
- package/examples/integration/streaming/package.json +13 -0
- package/examples/integration/streaming/worker.js +3 -0
- package/examples/minimal-extension/README-ch.md +3 -3
- package/examples/minimal-extension/README.md +3 -3
- package/examples/tetris-package/README-ch.md +1 -1
- package/examples/tetris-package/README.md +1 -1
- package/package.json +6 -1
- package/dist-library/LocalDocumentViewCore-BLG4hMuO.js +0 -9535
- package/dist-library/LocalReactiveDocumentCore-DVQ6WA9G.js +0 -259
- package/dist-library/component-utils-BvHL8VGt.js +0 -298
- package/dist-library/layout-C22VjZh0.js +0 -542
- package/dist-library/options-CdSKOi7p.js +0 -116
- package/dist-library/react-LY5qsVeP.js +0 -7
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { LocalValue } from '../types.js';
|
|
2
|
+
export declare const COUNTER_ACTIONS: readonly ['increment', 'decrement', 'reset'];
|
|
3
|
+
export type AuthorAction = (typeof COUNTER_ACTIONS)[number];
|
|
4
|
+
export type AuthorBindingRequest = {
|
|
5
|
+
operation: 'get';
|
|
6
|
+
name: string;
|
|
7
|
+
} | {
|
|
8
|
+
operation: 'set';
|
|
9
|
+
name: string;
|
|
10
|
+
value: LocalValue;
|
|
11
|
+
} | {
|
|
12
|
+
operation: 'setMany';
|
|
13
|
+
values: Record<string, LocalValue>;
|
|
14
|
+
};
|
|
15
|
+
export type AuthorBindingReply = {
|
|
16
|
+
ok: true;
|
|
17
|
+
value?: LocalValue;
|
|
18
|
+
} | {
|
|
19
|
+
ok: false;
|
|
20
|
+
message: string;
|
|
21
|
+
};
|
|
22
|
+
export interface AuthorActionRegistration {
|
|
23
|
+
target: string;
|
|
24
|
+
action: AuthorAction;
|
|
25
|
+
takeover: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface AuthorActionTarget {
|
|
28
|
+
id: string;
|
|
29
|
+
epoch: number;
|
|
30
|
+
}
|
|
31
|
+
export type AuthorWorkerInput = {
|
|
32
|
+
kind: 'start';
|
|
33
|
+
blocks: readonly string[];
|
|
34
|
+
targets: readonly string[];
|
|
35
|
+
} | {
|
|
36
|
+
kind: 'reply';
|
|
37
|
+
id: number;
|
|
38
|
+
result: AuthorBindingReply;
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'action';
|
|
41
|
+
target: AuthorActionTarget;
|
|
42
|
+
action: AuthorAction;
|
|
43
|
+
};
|
|
44
|
+
export type AuthorWorkerOutput = {
|
|
45
|
+
kind: 'request';
|
|
46
|
+
id: number;
|
|
47
|
+
request: AuthorBindingRequest;
|
|
48
|
+
target?: AuthorActionTarget;
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'registered';
|
|
51
|
+
registrations: AuthorActionRegistration[];
|
|
52
|
+
} | {
|
|
53
|
+
kind: 'diagnostic';
|
|
54
|
+
block: number;
|
|
55
|
+
message: string;
|
|
56
|
+
} | {
|
|
57
|
+
kind: 'failed';
|
|
58
|
+
message: string;
|
|
59
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LOCAL_RESULT_PATCH_PROTOCOL, type LocalResultPatch, type LocalSourceEdit } from './compile-patch.js';
|
|
2
2
|
import { FLAT_COMPILED_DATA_PROTOCOL, type FlatCompiledData } from './flat-compiled-data.js';
|
|
3
|
-
import type { Diagnostic, LocalCompileOptions, LocalCompileResult } from '../types.js';
|
|
3
|
+
import type { Diagnostic, LocalCompileOptions, LocalCompileResult, LocalSourcePhase } from '../types.js';
|
|
4
4
|
import type { AuthorAnalysis } from '../source/authoring.js';
|
|
5
5
|
import { type LocalIncrementalStats } from '../compilation/session/incremental.js';
|
|
6
6
|
export type LocalCompileProtocol = typeof LOCAL_RESULT_PATCH_PROTOCOL;
|
|
@@ -19,6 +19,13 @@ export interface LocalCompileRequest {
|
|
|
19
19
|
* reference path.
|
|
20
20
|
*/
|
|
21
21
|
options?: LocalCompileOptions;
|
|
22
|
+
/**
|
|
23
|
+
* Source generation phase. Omitted keeps the legacy final compile: the
|
|
24
|
+
* response then has the historical shape without `status`. `streaming`
|
|
25
|
+
* returns the provisional snapshot in the result itself; the transport does
|
|
26
|
+
* not alter or patch it.
|
|
27
|
+
*/
|
|
28
|
+
sourcePhase?: LocalSourcePhase;
|
|
22
29
|
/**
|
|
23
30
|
* Advertised by a client that understands `patch-v1`. A worker echoes its
|
|
24
31
|
* support on the full response, after which both sides may exchange edits
|
|
@@ -86,6 +93,8 @@ export interface LocalCompilePatchResponse {
|
|
|
86
93
|
revision: number;
|
|
87
94
|
patch: LocalResultPatch;
|
|
88
95
|
duration: number;
|
|
96
|
+
/** Phase of the result this patch extends; present when the client asked for one. */
|
|
97
|
+
sourcePhase?: LocalSourcePhase;
|
|
89
98
|
incremental?: Readonly<LocalIncrementalStats>;
|
|
90
99
|
metrics?: LocalCompileWorkerMetrics;
|
|
91
100
|
}
|
|
@@ -94,6 +103,8 @@ export type LocalCompileResponse = {
|
|
|
94
103
|
ok: true;
|
|
95
104
|
result: LocalCompileResult;
|
|
96
105
|
duration: number;
|
|
106
|
+
/** Echo of the request phase; omitted for legacy clients. */
|
|
107
|
+
sourcePhase?: LocalSourcePhase;
|
|
97
108
|
incremental?: Readonly<LocalIncrementalStats>;
|
|
98
109
|
protocol?: LocalCompileProtocol;
|
|
99
110
|
revision?: number;
|
|
@@ -145,15 +156,21 @@ export interface LocalCompileOutcome {
|
|
|
145
156
|
metrics?: LocalCompileMetrics;
|
|
146
157
|
/** Source revision when the worker negotiated `patch-v1`. */
|
|
147
158
|
revision?: number;
|
|
159
|
+
/**
|
|
160
|
+
* Set for streaming snapshots and for callers that supplied a phase
|
|
161
|
+
* themselves. Legacy final jobs omit it and keep the historical shape.
|
|
162
|
+
*/
|
|
163
|
+
sourcePhase?: LocalSourcePhase;
|
|
148
164
|
}
|
|
149
165
|
export interface LocalCompileSchedulerOptions {
|
|
150
166
|
includeAuthorAnalysis?: boolean;
|
|
151
167
|
createWorker(): LocalCompileWorker;
|
|
152
168
|
/**
|
|
153
169
|
* Defaults to compileLocal. Runs on the main thread only when the worker is
|
|
154
|
-
* unavailable or failed. One-argument callbacks remain supported
|
|
170
|
+
* unavailable or failed. One- and two-argument callbacks remain supported;
|
|
171
|
+
* an explicit source phase is passed as the third argument.
|
|
155
172
|
*/
|
|
156
|
-
fallbackCompile?(source: string, options?: LocalCompileOptions): LocalCompileResult;
|
|
173
|
+
fallbackCompile?(source: string, options?: LocalCompileOptions, sourcePhase?: LocalSourcePhase): LocalCompileResult;
|
|
157
174
|
onResult(outcome: LocalCompileOutcome): void;
|
|
158
175
|
onPendingChange?(pending: boolean): void;
|
|
159
176
|
onModeChange?(mode: LocalCompileMode, detail?: string): void;
|
|
@@ -199,8 +216,14 @@ export declare class LocalCompileScheduler {
|
|
|
199
216
|
* any, is replaced. Options are copied so a later mutation cannot change the
|
|
200
217
|
* permissions of an in-flight compile. An options-only edit still supersedes
|
|
201
218
|
* an older result for the same source.
|
|
219
|
+
*
|
|
220
|
+
* `sourcePhase` is optional. Streaming snapshots keep the debounce; a
|
|
221
|
+
* snapshot that explicitly declares `final` is dispatched immediately so it
|
|
222
|
+
* can replace a queued intermediate one and settle as soon as any in-flight
|
|
223
|
+
* compile returns. Calls that declare no phase keep the historical debounce
|
|
224
|
+
* and wire shape.
|
|
202
225
|
*/
|
|
203
|
-
schedule(source: string, options?: LocalCompileOptions, hint?: LocalCompileEditHint): void;
|
|
226
|
+
schedule(source: string, options?: LocalCompileOptions, hint?: LocalCompileEditHint, sourcePhase?: LocalSourcePhase): void;
|
|
204
227
|
/** Stop the timer and terminate the worker. No callbacks fire afterwards. */
|
|
205
228
|
dispose(): void;
|
|
206
229
|
private drain;
|
|
@@ -223,6 +223,18 @@ export interface LocalDocumentKernel {
|
|
|
223
223
|
inlineMathReads?: boolean;
|
|
224
224
|
}>>;
|
|
225
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Source generation phase supplied by a streaming host. Omitted keeps the
|
|
228
|
+
* historical final-compilation semantics; `strict` remains an independent
|
|
229
|
+
* structural-recovery switch.
|
|
230
|
+
*/
|
|
231
|
+
export type LocalSourcePhase = 'streaming' | 'final';
|
|
232
|
+
/**
|
|
233
|
+
* Compilation status. `partial` is only produced for an explicit streaming
|
|
234
|
+
* snapshot; final callers that do not opt into phases keep the historical
|
|
235
|
+
* result shape without a `status` field.
|
|
236
|
+
*/
|
|
237
|
+
export type LocalCompileStatus = 'partial' | 'valid' | 'recovered' | 'failed';
|
|
226
238
|
/** Compiler-produced documents contain only plain records, arrays and primitives. */
|
|
227
239
|
export interface LocalDocument {
|
|
228
240
|
syntax: 'local';
|
|
@@ -232,12 +244,12 @@ export interface LocalDocument {
|
|
|
232
244
|
/** Effective syntax revision; absent on older hand-built runtime documents. */
|
|
233
245
|
syntaxVersion?: 'local-draft-3';
|
|
234
246
|
/**
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
* original source is preserved and `nodes` carries one `htmlDocument` node
|
|
238
|
-
* whose `value` is the sanitized, complete iframe document.
|
|
247
|
+
* Policy on legacy whole-document HTML results. Mixed-source compilers
|
|
248
|
+
* record author content in `capabilities`.
|
|
239
249
|
*/
|
|
240
250
|
html?: LocalHtmlPolicy;
|
|
251
|
+
/** Serializable author content and its compile-time permission ceiling. */
|
|
252
|
+
capabilities?: LocalDocumentCapabilities;
|
|
241
253
|
versionDeclaration?: LocalVersionDeclaration;
|
|
242
254
|
nodes: LocalNode[];
|
|
243
255
|
initialState: Record<string, LocalValue>;
|
|
@@ -330,28 +342,33 @@ export interface LocalCompileLimits {
|
|
|
330
342
|
readonly maxMarkdownDepth?: number;
|
|
331
343
|
}
|
|
332
344
|
/**
|
|
333
|
-
* Host-owned capability flags for the
|
|
334
|
-
*
|
|
335
|
-
* All flags default to `false`. When every flag is false the existing
|
|
336
|
-
* Markdown/ReactiveMD pipeline runs unchanged. When any flag is true the whole
|
|
337
|
-
* source is interpreted as native HTML and rendered inside a sandboxed iframe;
|
|
338
|
-
* Markdown, interpolation, bindings, formulas and ReactiveMD components are not
|
|
339
|
-
* interpreted in that mode.
|
|
345
|
+
* Host-owned capability flags for the mixed Markdown and ReactiveMD pipeline.
|
|
340
346
|
*/
|
|
341
347
|
export interface LocalHtmlOptions {
|
|
342
|
-
/** Allow
|
|
348
|
+
/** Allow document styles and component declarations. Defaults to true. */
|
|
343
349
|
readonly enableCss?: boolean;
|
|
344
|
-
/** Allow
|
|
350
|
+
/** Allow author JavaScript in interactive mounts. Defaults to false. */
|
|
345
351
|
readonly enableJavaScript?: boolean;
|
|
346
|
-
/** Allow
|
|
352
|
+
/** Allow additional native HTML fragments. Defaults to false. */
|
|
347
353
|
readonly enableExtendedHtml?: boolean;
|
|
348
354
|
}
|
|
349
|
-
/**
|
|
355
|
+
/** Resolved document capability flags. */
|
|
350
356
|
export interface LocalHtmlPolicy {
|
|
351
357
|
readonly enableCss: boolean;
|
|
352
358
|
readonly enableJavaScript: boolean;
|
|
353
359
|
readonly enableExtendedHtml: boolean;
|
|
354
360
|
}
|
|
361
|
+
export interface LocalAuthorBlock {
|
|
362
|
+
readonly text: string;
|
|
363
|
+
readonly range: SourceRange;
|
|
364
|
+
}
|
|
365
|
+
export interface LocalDocumentCapabilities {
|
|
366
|
+
readonly policy: LocalHtmlPolicy;
|
|
367
|
+
readonly styles: readonly LocalAuthorBlock[];
|
|
368
|
+
readonly scripts: readonly LocalAuthorBlock[];
|
|
369
|
+
readonly componentStyles: Readonly<Record<string, string>>;
|
|
370
|
+
readonly actionTargets: Readonly<Record<string, string>>;
|
|
371
|
+
}
|
|
355
372
|
export type LocalHostPropKind = 'string' | 'number' | 'boolean' | 'enum';
|
|
356
373
|
export interface LocalHostPropSchema {
|
|
357
374
|
readonly kind: LocalHostPropKind;
|
|
@@ -418,17 +435,36 @@ export interface LocalCompileOptions extends LocalHtmlOptions {
|
|
|
418
435
|
* errors remain errors. Only booleans are accepted.
|
|
419
436
|
*/
|
|
420
437
|
readonly strict?: boolean;
|
|
438
|
+
/**
|
|
439
|
+
* Marks the snapshot as still being generated. Omitted or `final` keeps the
|
|
440
|
+
* historical final-compilation semantics, including `strict` recovery.
|
|
441
|
+
* `streaming` selects provisional rendering and diagnostics; it is not part
|
|
442
|
+
* of the compile identity and must not be used as a structural-recovery
|
|
443
|
+
* switch. Only accepted values are `streaming` and `final`.
|
|
444
|
+
*/
|
|
445
|
+
readonly sourcePhase?: LocalSourcePhase;
|
|
421
446
|
}
|
|
422
|
-
/**
|
|
447
|
+
/**
|
|
448
|
+
* Public compiler output is plain data, including nested attributes and
|
|
449
|
+
* dependencies. `status` and `transientDiagnostics` are present only for
|
|
450
|
+
* callers that explicitly supplied a source phase; legacy callers keep the
|
|
451
|
+
* historical shape.
|
|
452
|
+
*/
|
|
423
453
|
export type LocalCompileResult = {
|
|
424
454
|
ok: true;
|
|
425
455
|
document: LocalDocument;
|
|
426
456
|
diagnostics: Diagnostic[];
|
|
427
457
|
recoveries?: LocalRecovery[];
|
|
458
|
+
status?: Exclude<LocalCompileStatus, 'failed'>;
|
|
459
|
+
/** Fixable issues from a streaming snapshot; never merged into `diagnostics`. */
|
|
460
|
+
transientDiagnostics?: Diagnostic[];
|
|
428
461
|
} | {
|
|
429
462
|
ok: false;
|
|
430
463
|
diagnostics: Diagnostic[];
|
|
431
464
|
recoveries?: LocalRecovery[];
|
|
465
|
+
status?: 'failed';
|
|
466
|
+
/** Fixable issues observed before a deterministic failure. */
|
|
467
|
+
transientDiagnostics?: Diagnostic[];
|
|
432
468
|
};
|
|
433
469
|
/**
|
|
434
470
|
* Frozen state of the current revision. It contains controls, successful
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ComponentType, type ReactNode } from 'react';
|
|
1
|
+
import { type ComponentType, type CSSProperties, type ReactNode } from 'react';
|
|
2
2
|
import type { Diagnostic, LocalNode, LocalRuntime, LocalSnapshot, LocalSubmissionFieldCheck, LocalSubmissionFieldsResult, LocalValue, SourceRange } from '../local/types.js';
|
|
3
3
|
import type { LocalRenderMode, LocalSourceTarget } from '../local/rendering/render-types.js';
|
|
4
4
|
import type { LocalUrlPolicy } from '../local/rendering/document/LocalDocumentView.js';
|
|
@@ -149,6 +149,12 @@ export interface LocalComponentServices {
|
|
|
149
149
|
/** Context passed to every SDK component. It contains no AST. */
|
|
150
150
|
export interface LocalComponentContext {
|
|
151
151
|
readonly props: Readonly<Record<string, LocalComponentValue>>;
|
|
152
|
+
/** Author declarations for the component's visible root. */
|
|
153
|
+
readonly authorStyle?: CSSProperties;
|
|
154
|
+
/** Sanitized ordered declarations when repeated properties need browser fallbacks. */
|
|
155
|
+
readonly authorStyleText?: string;
|
|
156
|
+
/** Return true when the current mount delegates this action to author JavaScript. */
|
|
157
|
+
readonly dispatchAuthorAction?: (action: import('../local/runtime/author-script-protocol.js').AuthorAction) => boolean;
|
|
152
158
|
readonly content: LocalComponentContent;
|
|
153
159
|
readonly services: LocalComponentServices;
|
|
154
160
|
readonly bindings: {
|
|
@@ -203,6 +209,9 @@ export interface LocalReactPreset {
|
|
|
203
209
|
* internal nodes only to `component-api`, never to component implementations.
|
|
204
210
|
*/
|
|
205
211
|
export interface LocalComponentAdapterEnvironment {
|
|
212
|
+
readonly authorStyle?: LocalComponentContext['authorStyle'];
|
|
213
|
+
readonly authorStyleText?: LocalComponentContext['authorStyleText'];
|
|
214
|
+
readonly dispatchAuthorAction?: LocalComponentContext['dispatchAuthorAction'];
|
|
206
215
|
readonly runtime: LocalRuntime;
|
|
207
216
|
readonly network?: ComponentNetwork;
|
|
208
217
|
/** Optional runtime-scoped services. Falls back to detached services. */
|
|
@@ -94,12 +94,20 @@ export declare function numericRange(context: LocalComponentContext, minName: st
|
|
|
94
94
|
};
|
|
95
95
|
export declare const EMPTY_STATIC_VALUE = "\u2014";
|
|
96
96
|
export declare function staticText(value: string): string;
|
|
97
|
-
export declare function
|
|
97
|
+
export declare function useAuthorComponentRoot(context: LocalComponentContext): (defaults?: CSSProperties) => {
|
|
98
|
+
style: CSSProperties | undefined;
|
|
99
|
+
ref: undefined;
|
|
100
|
+
} | {
|
|
101
|
+
style: CSSProperties;
|
|
102
|
+
ref: (element: HTMLElement | null) => void;
|
|
103
|
+
};
|
|
104
|
+
export declare function StaticValue({ label, value, hint, className, multiline, authorRoot, }: {
|
|
98
105
|
label: string;
|
|
99
106
|
value: ReactNode;
|
|
100
107
|
hint?: ReactNode;
|
|
101
108
|
className?: string;
|
|
102
109
|
multiline?: boolean;
|
|
110
|
+
authorRoot?: ReturnType<ReturnType<typeof useAuthorComponentRoot>>;
|
|
103
111
|
}): import("react").JSX.Element;
|
|
104
112
|
export declare function PrintValue({ value, block }: {
|
|
105
113
|
value: ReactNode;
|
|
@@ -7,12 +7,15 @@ import type { LocalThemePackage } from '../sdk/theme.js';
|
|
|
7
7
|
import type { LocalRuntimeServices } from '../runtime-services/runtime.js';
|
|
8
8
|
import type { ComponentNetwork } from '../runtime-services/network.js';
|
|
9
9
|
import type { LocalComponentDefinition, LocalConfig } from '../sdk/types.js';
|
|
10
|
-
import { type LocalComponentContext, type LocalReactComponent, type LocalReactPreset } from './component-api.js';
|
|
10
|
+
import { type LocalComponentAdapterEnvironment, type LocalComponentContext, type LocalReactComponent, type LocalReactPreset } from './component-api.js';
|
|
11
11
|
export type { LocalComponentRender } from './component-api.js';
|
|
12
12
|
export { defineReactComponent, type LocalComponentBindingHandle, type LocalComponentContext, type LocalComponentInstance, type LocalComponentPropValue, type LocalComponentSetResult, type LocalComponentValue, type LocalReactComponent, type LocalReactComponentImplementation, type LocalReactPreset, } from './component-api.js';
|
|
13
13
|
/** Everything a renderer needs from the document view. */
|
|
14
14
|
export interface LocalReactRenderEnvironment {
|
|
15
15
|
runtime: LocalRuntime;
|
|
16
|
+
authorStyle?: LocalComponentAdapterEnvironment['authorStyle'];
|
|
17
|
+
authorStyleText?: LocalComponentAdapterEnvironment['authorStyleText'];
|
|
18
|
+
dispatchAuthorAction?: LocalComponentAdapterEnvironment['dispatchAuthorAction'];
|
|
16
19
|
network?: ComponentNetwork;
|
|
17
20
|
/** Runtime-scoped services; omitted only by hand-built render environments. */
|
|
18
21
|
services?: LocalRuntimeServices;
|
|
@@ -11,6 +11,8 @@ export type ShareableHtmlMode = 'interactive' | 'static';
|
|
|
11
11
|
export type ShareableAssetMode = 'inline' | 'omit';
|
|
12
12
|
export interface ShareableMountPayload {
|
|
13
13
|
version: 1 | 2;
|
|
14
|
+
/** Source interpretation, independent of the restoration envelope. */
|
|
15
|
+
sourceSemantics?: 'mixed-rmd-v1';
|
|
14
16
|
target: string;
|
|
15
17
|
source: string;
|
|
16
18
|
state: LocalStateFile;
|
|
@@ -37,7 +39,7 @@ export interface ShareableHtmlOptions {
|
|
|
37
39
|
title: string;
|
|
38
40
|
source: string;
|
|
39
41
|
state: LocalStateFile;
|
|
40
|
-
/**
|
|
42
|
+
/** Trusted static markup. Render it with the same CSS and Extended HTML grants as the export. */
|
|
41
43
|
staticMarkup: string;
|
|
42
44
|
/** Trusted host stylesheet, normally the built reactive-md.css. */
|
|
43
45
|
css: string;
|
|
@@ -61,9 +63,8 @@ export interface ShareableHtmlOptions {
|
|
|
61
63
|
notices?: string;
|
|
62
64
|
targetId?: string;
|
|
63
65
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* re-sanitized with author JavaScript forced off.
|
|
66
|
+
* Capabilities granted by the host and used to compile this document.
|
|
67
|
+
* Interactive exports replay them after state restoration.
|
|
67
68
|
*/
|
|
68
69
|
compileOptions?: LocalCompileOptions;
|
|
69
70
|
/** Companion component requirements, separate from the v1 state format. */
|
|
@@ -18,4 +18,4 @@ export interface PreparedStandaloneDocument {
|
|
|
18
18
|
* `compileOptions` replays the capability flags and limits an export was
|
|
19
19
|
* created with; omitting them keeps the default ReactiveMD route.
|
|
20
20
|
*/
|
|
21
|
-
export declare function prepareStandaloneDocument(source: string, state?: LocalStateFile | string, theme?: string, compileOptions?: LocalCompileOptions, beforeState?: (document: LocalDocument) => void): PreparedStandaloneDocument;
|
|
21
|
+
export declare function prepareStandaloneDocument(source: string, state?: LocalStateFile | string, theme?: string, compileOptions?: LocalCompileOptions, beforeState?: (document: LocalDocument) => void, legacyPayload?: boolean): PreparedStandaloneDocument;
|
|
@@ -23,8 +23,7 @@ export interface ReactiveMDMountOptions {
|
|
|
23
23
|
hydrate?: boolean;
|
|
24
24
|
generator?: LocalStateGenerator;
|
|
25
25
|
/**
|
|
26
|
-
* Capability flags and limits used by the export.
|
|
27
|
-
* payload values enable the native HTML route; source text and state never do.
|
|
26
|
+
* Capability flags and limits used by the export.
|
|
28
27
|
*/
|
|
29
28
|
compileOptions?: LocalCompileOptions;
|
|
30
29
|
/** Trusted implementations explicitly installed by the standalone host. */
|
|
@@ -47,6 +46,8 @@ export interface ReactiveMDHandle {
|
|
|
47
46
|
}
|
|
48
47
|
/** Internal hooks used by the Web Component; not part of the public mount API. */
|
|
49
48
|
export interface StandaloneHostHooks {
|
|
49
|
+
/** Version 1 and 2 payloads created before sourceSemantics was introduced. */
|
|
50
|
+
legacyPayload?: boolean;
|
|
50
51
|
/** Host-only theme override, applied to an immutable document clone. */
|
|
51
52
|
theme?: string;
|
|
52
53
|
onDiagnostics?: (diagnostics: Diagnostic[]) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as e } from "./compiler-core-As_m-MNm.js";
|
|
2
2
|
// src/compiler/result.ts
|
|
3
3
|
var t = Object.freeze({ optional: Object.freeze([]) }), n = Object.freeze({ optional: Object.freeze([Object.freeze({
|
|
4
4
|
id: "math-display",
|