@markii/stdlib 0.17.0-next.0 → 0.17.0-next.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/diagnostics.d.ts
CHANGED
|
@@ -32,8 +32,29 @@
|
|
|
32
32
|
* terminal, a terminal-only component in an editor preview). It rendered
|
|
33
33
|
* the fallback box, labeled as a missing view rather than an unknown
|
|
34
34
|
* component. Only reported when the host passed `unavailableComponents`.
|
|
35
|
+
*
|
|
36
|
+
* `'unknown-directive'` — a directive names no registered component and
|
|
37
|
+
* rendered as the unknown-component fallback box. Reported by the terminal
|
|
38
|
+
* engine only, so a host that wants a finding for every unknown directive
|
|
39
|
+
* (the language server) can place it; the other engines draw the same
|
|
40
|
+
* fallback and stay quiet.
|
|
41
|
+
*
|
|
42
|
+
* `'code-renderer-failed'` — a host's `renderCode` callback threw for an
|
|
43
|
+
* ordinary fenced code block; the block rendered as usual. Carries no
|
|
44
|
+
* directive or attribute.
|
|
45
|
+
*/
|
|
46
|
+
export type DiagnosticKind = 'invalid-attribute-value' | 'unsafe-image-src' | 'form-mismatch' | 'no-engine-view' | 'unknown-directive' | 'code-renderer-failed';
|
|
47
|
+
/**
|
|
48
|
+
* Where in the note's source an event happened: the directive's range, in
|
|
49
|
+
* unist coordinates (1-based line, 1-based column, end exclusive). Present
|
|
50
|
+
* only when the engine knows the node the event came from.
|
|
35
51
|
*/
|
|
36
|
-
export
|
|
52
|
+
export interface DiagnosticPosition {
|
|
53
|
+
readonly startLine: number;
|
|
54
|
+
readonly startColumn: number;
|
|
55
|
+
readonly endLine: number;
|
|
56
|
+
readonly endColumn: number;
|
|
57
|
+
}
|
|
37
58
|
export interface DiagnosticEvent {
|
|
38
59
|
readonly kind: DiagnosticKind;
|
|
39
60
|
/** The directive name the event happened on, when there is a single unambiguous one. */
|
|
@@ -42,6 +63,8 @@ export interface DiagnosticEvent {
|
|
|
42
63
|
readonly attribute?: string;
|
|
43
64
|
/** The same human-readable text the in-page marker's tooltip carries. */
|
|
44
65
|
readonly message: string;
|
|
66
|
+
/** The source range of the directive the event came from, when the engine can say. */
|
|
67
|
+
readonly position?: DiagnosticPosition;
|
|
45
68
|
}
|
|
46
69
|
export type OnDiagnostic = (event: DiagnosticEvent) => void;
|
|
47
70
|
/**
|
|
@@ -62,11 +85,18 @@ export declare function reportDiagnostic(onDiagnostic: OnDiagnostic | undefined,
|
|
|
62
85
|
* `directive` is the composed directive name (`ana_meter`), `pack` the
|
|
63
86
|
* pack's namespace, and `engines` the engine ids (`react`, `ansi`) the
|
|
64
87
|
* component DOES ship a view for.
|
|
88
|
+
*
|
|
89
|
+
* `loadFailed` marks a component whose pack could not be loaded for this
|
|
90
|
+
* render's engine at all (its view script threw, registered nothing, or
|
|
91
|
+
* registered another namespace). The renderer then words the fallback as a
|
|
92
|
+
* failed pack rather than a missing view. Absent means the pack loaded and
|
|
93
|
+
* simply has no view for the component.
|
|
65
94
|
*/
|
|
66
95
|
export interface UnavailableComponent {
|
|
67
96
|
readonly directive: string;
|
|
68
97
|
readonly pack: string;
|
|
69
98
|
readonly engines: readonly string[];
|
|
99
|
+
readonly loadFailed?: true;
|
|
70
100
|
}
|
|
71
101
|
/** A lookup from a directive name to its `UnavailableComponent`, or `undefined`. */
|
|
72
102
|
export type UnavailableComponentLookup = (directive: string) => UnavailableComponent | undefined;
|
package/dist/diagnostics.js
CHANGED
|
@@ -47,7 +47,7 @@ export function createUnavailableComponentLookup(components) {
|
|
|
47
47
|
for (const entry of components) {
|
|
48
48
|
if (entry === null || typeof entry !== 'object')
|
|
49
49
|
continue;
|
|
50
|
-
const { directive, pack, engines } = entry;
|
|
50
|
+
const { directive, pack, engines, loadFailed } = entry;
|
|
51
51
|
if (typeof directive !== 'string' || typeof pack !== 'string')
|
|
52
52
|
continue;
|
|
53
53
|
if (!Array.isArray(engines))
|
|
@@ -58,6 +58,7 @@ export function createUnavailableComponentLookup(components) {
|
|
|
58
58
|
directive,
|
|
59
59
|
pack,
|
|
60
60
|
engines: engines.filter((e) => typeof e === 'string'),
|
|
61
|
+
...(loadFailed === true ? { loadFailed: true } : {}),
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
64
|
if (byName.size === 0)
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* how a note renders.
|
|
23
23
|
*
|
|
24
24
|
* Pure and host-neutral: no editor API, no filesystem, no `node:*`. It is
|
|
25
|
-
* re-exported from `@markii/host
|
|
25
|
+
* re-exported from `@markii/host`'s main entry, and
|
|
26
26
|
* `apps/vscode/src/browser-entry.probe.test.ts` is the gate for that.
|
|
27
27
|
*/
|
|
28
28
|
/** A container-directive fence pair enclosing an insertion point. */
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* how a note renders.
|
|
23
23
|
*
|
|
24
24
|
* Pure and host-neutral: no editor API, no filesystem, no `node:*`. It is
|
|
25
|
-
* re-exported from `@markii/host
|
|
25
|
+
* re-exported from `@markii/host`'s main entry, and
|
|
26
26
|
* `apps/vscode/src/browser-entry.probe.test.ts` is the gate for that.
|
|
27
27
|
*/
|
|
28
28
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export { ALIGN_PRESETS, LAYOUT_ATTRIBUTE_KEYS, LAYOUT_ATTRIBUTES, WIDTH_PRESETS,
|
|
|
3
3
|
export { TEXT_ALIGN_ATTRIBUTE, TEXT_ALIGN_COMPONENTS, TEXT_ALIGN_PRESETS, type TextAlignPreset, } from './text-align.js';
|
|
4
4
|
export { formatValue, isNumericLike, FORMAT_ATTRIBUTE, DECIMALS_ATTRIBUTE, type ValueFormat, } from './value-format.js';
|
|
5
5
|
export { deriveTableShape, type TableShape } from './table-shape.js';
|
|
6
|
-
export { reportDiagnostic, createUnavailableComponentLookup, type UnavailableComponent, type UnavailableComponentLookup, type DiagnosticEvent, type DiagnosticKind, type OnDiagnostic, } from './diagnostics.js';
|
|
6
|
+
export { reportDiagnostic, createUnavailableComponentLookup, type UnavailableComponent, type UnavailableComponentLookup, type DiagnosticEvent, type DiagnosticPosition, type DiagnosticKind, type OnDiagnostic, } from './diagnostics.js';
|
|
7
7
|
export { INTERACTIVE_ATTRIBUTE } from './interactive.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markii/stdlib",
|
|
3
|
-
"version": "0.17.0-next.
|
|
3
|
+
"version": "0.17.0-next.2",
|
|
4
4
|
"description": "Neutral, framework-agnostic standard component contracts for Mark (.mk.md) — the kind/attribute-schema seam every renderer (e.g. @markii/react) implements against. No React, zero dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|