@mcpview/components 0.0.0-stage → 0.10.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/LICENSE +21 -0
- package/README.md +575 -2
- package/esm/_dnt.polyfills.d.ts +12 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -0
- package/esm/_dnt.polyfills.js +15 -0
- package/esm/fonts.d.ts +13 -0
- package/esm/fonts.d.ts.map +1 -0
- package/esm/fonts.js +12 -0
- package/esm/layout.d.ts +14 -0
- package/esm/layout.d.ts.map +1 -0
- package/esm/layout.js +13 -0
- package/esm/mod.d.ts +19 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +14 -0
- package/esm/package.json +3 -0
- package/esm/preact-components.d.ts +22 -0
- package/esm/preact-components.d.ts.map +1 -0
- package/esm/preact-components.js +20 -0
- package/esm/preact.d.ts +10 -0
- package/esm/preact.d.ts.map +1 -0
- package/esm/preact.js +9 -0
- package/esm/src/component-primitives.d.ts +41 -0
- package/esm/src/component-primitives.d.ts.map +1 -0
- package/esm/src/component-primitives.js +121 -0
- package/esm/src/components.d.ts +50 -0
- package/esm/src/components.d.ts.map +1 -0
- package/esm/src/components.js +283 -0
- package/esm/src/font-families.d.ts +16 -0
- package/esm/src/font-families.d.ts.map +1 -0
- package/esm/src/font-families.js +11 -0
- package/esm/src/fonts-data.d.ts +2 -0
- package/esm/src/fonts-data.d.ts.map +1 -0
- package/esm/src/fonts-data.js +42 -0
- package/esm/src/fonts.d.ts +12 -0
- package/esm/src/fonts.d.ts.map +1 -0
- package/esm/src/fonts.js +19 -0
- package/esm/src/i18n.d.ts +44 -0
- package/esm/src/i18n.d.ts.map +1 -0
- package/esm/src/i18n.js +98 -0
- package/esm/src/layout/hooks.d.ts +60 -0
- package/esm/src/layout/hooks.d.ts.map +1 -0
- package/esm/src/layout/hooks.js +121 -0
- package/esm/src/layout/mod.d.ts +6 -0
- package/esm/src/layout/mod.d.ts.map +1 -0
- package/esm/src/layout/mod.js +3 -0
- package/esm/src/layout/viewer-layout.d.ts +82 -0
- package/esm/src/layout/viewer-layout.d.ts.map +1 -0
- package/esm/src/layout/viewer-layout.js +74 -0
- package/esm/src/preact/components.d.ts +215 -0
- package/esm/src/preact/components.d.ts.map +1 -0
- package/esm/src/preact/components.js +176 -0
- package/esm/src/preact/focused-view.d.ts +42 -0
- package/esm/src/preact/focused-view.d.ts.map +1 -0
- package/esm/src/preact/focused-view.js +20 -0
- package/esm/src/preact/mod.d.ts +6 -0
- package/esm/src/preact/mod.d.ts.map +1 -0
- package/esm/src/preact/mod.js +3 -0
- package/esm/src/preact/plots.d.ts +119 -0
- package/esm/src/preact/plots.d.ts.map +1 -0
- package/esm/src/preact/plots.js +152 -0
- package/esm/src/preact/semantic-element.d.ts +103 -0
- package/esm/src/preact/semantic-element.d.ts.map +1 -0
- package/esm/src/preact/semantic-element.js +103 -0
- package/esm/src/preact/structural.d.ts +178 -0
- package/esm/src/preact/structural.d.ts.map +1 -0
- package/esm/src/preact/structural.js +147 -0
- package/esm/src/preact/surface.d.ts +37 -0
- package/esm/src/preact/surface.d.ts.map +1 -0
- package/esm/src/preact/surface.js +47 -0
- package/esm/src/surface-app.d.ts +188 -0
- package/esm/src/surface-app.d.ts.map +1 -0
- package/esm/src/surface-app.js +374 -0
- package/esm/src/theme.d.ts +65 -0
- package/esm/src/theme.d.ts.map +1 -0
- package/esm/src/theme.js +1877 -0
- package/esm/surface.d.ts +12 -0
- package/esm/surface.d.ts.map +1 -0
- package/esm/surface.js +10 -0
- package/package.json +68 -4
- package/script/_dnt.polyfills.d.ts +12 -0
- package/script/_dnt.polyfills.d.ts.map +1 -0
- package/script/_dnt.polyfills.js +16 -0
- package/script/fonts.d.ts +13 -0
- package/script/fonts.d.ts.map +1 -0
- package/script/fonts.js +19 -0
- package/script/layout.d.ts +14 -0
- package/script/layout.d.ts.map +1 -0
- package/script/layout.js +29 -0
- package/script/mod.d.ts +19 -0
- package/script/mod.d.ts.map +1 -0
- package/script/mod.js +40 -0
- package/script/package.json +3 -0
- package/script/preact-components.d.ts +22 -0
- package/script/preact-components.d.ts.map +1 -0
- package/script/preact-components.js +68 -0
- package/script/preact.d.ts +10 -0
- package/script/preact.d.ts.map +1 -0
- package/script/preact.js +25 -0
- package/script/src/component-primitives.d.ts +41 -0
- package/script/src/component-primitives.d.ts.map +1 -0
- package/script/src/component-primitives.js +127 -0
- package/script/src/components.d.ts +50 -0
- package/script/src/components.d.ts.map +1 -0
- package/script/src/components.js +297 -0
- package/script/src/font-families.d.ts +16 -0
- package/script/src/font-families.d.ts.map +1 -0
- package/script/src/font-families.js +14 -0
- package/script/src/fonts-data.d.ts +2 -0
- package/script/src/fonts-data.d.ts.map +1 -0
- package/script/src/fonts-data.js +45 -0
- package/script/src/fonts.d.ts +12 -0
- package/script/src/fonts.d.ts.map +1 -0
- package/script/src/fonts.js +24 -0
- package/script/src/i18n.d.ts +44 -0
- package/script/src/i18n.d.ts.map +1 -0
- package/script/src/i18n.js +102 -0
- package/script/src/layout/hooks.d.ts +60 -0
- package/script/src/layout/hooks.d.ts.map +1 -0
- package/script/src/layout/hooks.js +126 -0
- package/script/src/layout/mod.d.ts +6 -0
- package/script/src/layout/mod.d.ts.map +1 -0
- package/script/src/layout/mod.js +17 -0
- package/script/src/layout/viewer-layout.d.ts +82 -0
- package/script/src/layout/viewer-layout.d.ts.map +1 -0
- package/script/src/layout/viewer-layout.js +83 -0
- package/script/src/preact/components.d.ts +215 -0
- package/script/src/preact/components.d.ts.map +1 -0
- package/script/src/preact/components.js +199 -0
- package/script/src/preact/focused-view.d.ts +42 -0
- package/script/src/preact/focused-view.d.ts.map +1 -0
- package/script/src/preact/focused-view.js +24 -0
- package/script/src/preact/mod.d.ts +6 -0
- package/script/src/preact/mod.d.ts.map +1 -0
- package/script/src/preact/mod.js +55 -0
- package/script/src/preact/plots.d.ts +119 -0
- package/script/src/preact/plots.d.ts.map +1 -0
- package/script/src/preact/plots.js +157 -0
- package/script/src/preact/semantic-element.d.ts +103 -0
- package/script/src/preact/semantic-element.d.ts.map +1 -0
- package/script/src/preact/semantic-element.js +115 -0
- package/script/src/preact/structural.d.ts +178 -0
- package/script/src/preact/structural.d.ts.map +1 -0
- package/script/src/preact/structural.js +158 -0
- package/script/src/preact/surface.d.ts +37 -0
- package/script/src/preact/surface.d.ts.map +1 -0
- package/script/src/preact/surface.js +53 -0
- package/script/src/surface-app.d.ts +188 -0
- package/script/src/surface-app.d.ts.map +1 -0
- package/script/src/surface-app.js +379 -0
- package/script/src/theme.d.ts +65 -0
- package/script/src/theme.d.ts.map +1 -0
- package/script/src/theme.js +1881 -0
- package/script/surface.d.ts +12 -0
- package/script/surface.d.ts.map +1 -0
- package/script/surface.js +15 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/** @jsxImportSource preact */
|
|
2
|
+
/** Generic, domain-neutral presentation shell for one semantic object. */
|
|
3
|
+
import type { ComposedSemanticRef } from "@mcpview/contracts";
|
|
4
|
+
import type { ComponentChildren, JSX, VNode } from "preact";
|
|
5
|
+
import { type CardProps, type PresentationTone } from "./components.js";
|
|
6
|
+
export type SemanticElementDensity = "chip" | "row" | "card";
|
|
7
|
+
export interface SemanticListProps {
|
|
8
|
+
readonly label: string;
|
|
9
|
+
readonly scrollable?: boolean;
|
|
10
|
+
readonly className?: string;
|
|
11
|
+
readonly children?: ComponentChildren;
|
|
12
|
+
}
|
|
13
|
+
/** Bounded group for row-density semantic objects; it owns no domain ordering. */
|
|
14
|
+
export declare function SemanticList({ label, scrollable, className, children, }: SemanticListProps): JSX.Element;
|
|
15
|
+
export interface CollectionCardProps extends Pick<CardProps, "title" | "eyebrow" | "actions" | "className" | "children">, Pick<SemanticListProps, "label" | "scrollable"> {
|
|
16
|
+
}
|
|
17
|
+
/** Card-hosted SemanticList that keeps a single outer border. */
|
|
18
|
+
export declare function CollectionCard({ label, title, eyebrow, actions, scrollable, className, children, }: CollectionCardProps): JSX.Element;
|
|
19
|
+
export interface ElementIdentProps {
|
|
20
|
+
readonly label: ComponentChildren;
|
|
21
|
+
readonly detail?: ComponentChildren;
|
|
22
|
+
readonly marker?: ComponentChildren;
|
|
23
|
+
readonly className?: string;
|
|
24
|
+
}
|
|
25
|
+
/** Required human-facing identity slot. Its content is already resolved by the caller. */
|
|
26
|
+
export declare function ElementIdent({ label, detail, marker, className, }: ElementIdentProps): JSX.Element;
|
|
27
|
+
export interface ElementReadingProps {
|
|
28
|
+
readonly value: ComponentChildren;
|
|
29
|
+
readonly label?: ComponentChildren;
|
|
30
|
+
readonly unit?: ComponentChildren;
|
|
31
|
+
readonly detail?: ComponentChildren;
|
|
32
|
+
readonly className?: string;
|
|
33
|
+
}
|
|
34
|
+
/** Resolved measurement or documentary reading; no unit is guessed. */
|
|
35
|
+
export declare function ElementReading({ value, label, unit, detail, className, }: ElementReadingProps): JSX.Element;
|
|
36
|
+
export interface ElementLimitProps {
|
|
37
|
+
readonly operator: ComponentChildren;
|
|
38
|
+
readonly value: ComponentChildren;
|
|
39
|
+
readonly label?: ComponentChildren;
|
|
40
|
+
readonly unit?: ComponentChildren;
|
|
41
|
+
readonly detail?: ComponentChildren;
|
|
42
|
+
readonly className?: string;
|
|
43
|
+
}
|
|
44
|
+
/** Caller-declared limit statement; never infers a range, measurement, or verdict. */
|
|
45
|
+
export declare function ElementLimit({ operator, value, label, unit, detail, className, }: ElementLimitProps): JSX.Element;
|
|
46
|
+
export interface ElementVerdictProps {
|
|
47
|
+
readonly value: ComponentChildren;
|
|
48
|
+
readonly label?: ComponentChildren;
|
|
49
|
+
readonly className?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface ElementBodyProps {
|
|
52
|
+
readonly children?: ComponentChildren;
|
|
53
|
+
readonly className?: string;
|
|
54
|
+
}
|
|
55
|
+
/** Optional provider-owned visualization slot, such as a gauge or compact domain plot. */
|
|
56
|
+
export declare function ElementBody({ children, className }: ElementBodyProps): JSX.Element;
|
|
57
|
+
export interface ElementSectionProps {
|
|
58
|
+
/** Visible heading and accessible name of the group; the caller words it. */
|
|
59
|
+
readonly title: string;
|
|
60
|
+
readonly className?: string;
|
|
61
|
+
readonly children?: ComponentChildren;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* One titled group inside an ElementBody. A datasheet body is sections, not one
|
|
65
|
+
* list: each fact belongs to exactly one, and the section names what its facts are.
|
|
66
|
+
*/
|
|
67
|
+
export declare function ElementSection({ title, className, children, }: ElementSectionProps): JSX.Element;
|
|
68
|
+
/** Caller-authored verdict. Tone remains an explicit SemanticElement concern. */
|
|
69
|
+
export declare function ElementVerdict({ value, label, className, }: ElementVerdictProps): JSX.Element;
|
|
70
|
+
export interface ElementProvenanceProps {
|
|
71
|
+
readonly value: ComponentChildren;
|
|
72
|
+
readonly label?: ComponentChildren;
|
|
73
|
+
readonly className?: string;
|
|
74
|
+
}
|
|
75
|
+
/** Exact caller-provided provenance such as a source, revision, or fingerprint. */
|
|
76
|
+
export declare function ElementProvenance({ value, label, className, }: ElementProvenanceProps): JSX.Element;
|
|
77
|
+
export interface SemanticElementProps {
|
|
78
|
+
/** Structured identity only. This component never resolves or dereferences it. */
|
|
79
|
+
readonly reference: ComposedSemanticRef;
|
|
80
|
+
/** Presentation density. A whole viewer is deliberately not a density. */
|
|
81
|
+
readonly density: SemanticElementDensity;
|
|
82
|
+
/** Explicit visual verdict. Omit when the object has no warranted verdict. */
|
|
83
|
+
readonly tone?: PresentationTone;
|
|
84
|
+
/** Explicit current selection; presentation and accessible state stay kit-owned. */
|
|
85
|
+
readonly selected?: boolean;
|
|
86
|
+
/** Every semantic object must provide a resolved identity slot. */
|
|
87
|
+
readonly ident: VNode<ElementIdentProps>;
|
|
88
|
+
readonly reading?: VNode<ElementReadingProps | ElementLimitProps> | readonly VNode<ElementReadingProps | ElementLimitProps>[];
|
|
89
|
+
readonly body?: VNode<ElementBodyProps> | readonly VNode<ElementBodyProps>[];
|
|
90
|
+
readonly verdict?: VNode<ElementVerdictProps>;
|
|
91
|
+
readonly provenance?: VNode<ElementProvenanceProps>;
|
|
92
|
+
readonly activationLabel?: string;
|
|
93
|
+
readonly onActivate?: (reference: ComposedSemanticRef) => void;
|
|
94
|
+
readonly className?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Render one semantic object without owning domain vocabulary or reference resolution.
|
|
98
|
+
*
|
|
99
|
+
* The same slots survive chip, row, and card composition. When a tone is explicitly
|
|
100
|
+
* supplied, an inline-start verdict border is invariant across all three densities.
|
|
101
|
+
*/
|
|
102
|
+
export declare function SemanticElement({ reference, density, tone, selected, ident, reading, body, verdict, provenance, activationLabel, onActivate, className, }: SemanticElementProps): JSX.Element;
|
|
103
|
+
//# sourceMappingURL=semantic-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic-element.d.ts","sourceRoot":"","sources":["../../../src/src/preact/semantic-element.tsx"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,0EAA0E;AAE1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE9E,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED,kFAAkF;AAClF,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,UAAkB,EAClB,SAAS,EACT,QAAQ,GACT,EAAE,iBAAiB,GAA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AC,SAAS,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC/D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,OAAO,EACP,IAAI,EACJ,OAAO,EACP,UAAU,EACV,eAAe,EACf,UAAU,EACV,SAAS,GACV,EAAE,oBAAoB,GAAG,GAAG,CAAC,OAAO,CAoDpC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { Card } from "./components.js";
|
|
3
|
+
/** Bounded group for row-density semantic objects; it owns no domain ordering. */
|
|
4
|
+
export function SemanticList({ label, scrollable = false, className, children, }) {
|
|
5
|
+
return (_jsx("div", { "aria-label": label, class: classes("mcp-view-semantic-list", className), "data-scrollable": scrollable ? "true" : undefined, role: "group", children: children }));
|
|
6
|
+
}
|
|
7
|
+
/** Card-hosted SemanticList that keeps a single outer border. */
|
|
8
|
+
export function CollectionCard({ label, title, eyebrow, actions, scrollable = false, className, children, }) {
|
|
9
|
+
return (_jsx(Card, { title: title, eyebrow: eyebrow, actions: actions, className: classes("mcp-view-collection-card", className), children: _jsx(SemanticList, { label: label, scrollable: scrollable, children: children }) }));
|
|
10
|
+
}
|
|
11
|
+
/** Required human-facing identity slot. Its content is already resolved by the caller. */
|
|
12
|
+
export function ElementIdent({ label, detail, marker, className, }) {
|
|
13
|
+
return (_jsxs("header", { class: classes("mcp-view-element-ident", className), "data-element-slot": "ident", children: [isPresent(marker) && _jsx("span", { class: "mcp-view-element-ident-marker", children: marker }), _jsxs("span", { class: "mcp-view-element-ident-copy", children: [_jsx("strong", { class: "mcp-view-element-ident-label", children: label }), isPresent(detail) && _jsx("small", { class: "mcp-view-element-ident-detail", children: detail })] })] }));
|
|
14
|
+
}
|
|
15
|
+
/** Resolved measurement or documentary reading; no unit is guessed. */
|
|
16
|
+
export function ElementReading({ value, label, unit, detail, className, }) {
|
|
17
|
+
return (_jsxs("div", { class: classes("mcp-view-element-reading", className), "data-element-slot": "reading", children: [isPresent(label) && _jsx("span", { class: "mcp-view-element-reading-label", children: label }), _jsxs("span", { class: "mcp-view-element-reading-measure", children: [_jsx("strong", { class: "mcp-view-element-reading-value", children: value }), isPresent(unit) && _jsx("span", { class: "mcp-view-element-reading-unit", children: unit })] }), isPresent(detail) && _jsx("small", { class: "mcp-view-element-reading-detail", children: detail })] }));
|
|
18
|
+
}
|
|
19
|
+
/** Caller-declared limit statement; never infers a range, measurement, or verdict. */
|
|
20
|
+
export function ElementLimit({ operator, value, label, unit, detail, className, }) {
|
|
21
|
+
return (_jsxs("div", { class: classes("mcp-view-element-limit", className), "data-element-slot": "reading", children: [isPresent(label) && _jsx("span", { class: "mcp-view-element-limit-label", children: label }), _jsxs("span", { class: "mcp-view-element-limit-statement", children: [_jsx("span", { class: "mcp-view-element-limit-operator", children: operator }), _jsx("strong", { class: "mcp-view-element-limit-value", children: value }), isPresent(unit) && _jsx("span", { class: "mcp-view-element-limit-unit", children: unit })] }), isPresent(detail) && _jsx("small", { class: "mcp-view-element-limit-detail", children: detail })] }));
|
|
22
|
+
}
|
|
23
|
+
/** Optional provider-owned visualization slot, such as a gauge or compact domain plot. */
|
|
24
|
+
export function ElementBody({ children, className }) {
|
|
25
|
+
return (_jsx("div", { class: classes("mcp-view-element-body", className), "data-element-slot": "body", children: children }));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* One titled group inside an ElementBody. A datasheet body is sections, not one
|
|
29
|
+
* list: each fact belongs to exactly one, and the section names what its facts are.
|
|
30
|
+
*/
|
|
31
|
+
export function ElementSection({ title, className, children, }) {
|
|
32
|
+
return (_jsxs("div", { "aria-label": title, class: classes("mcp-view-element-section", className), "data-element-slot": "section", role: "group", children: [_jsx("span", { class: "mcp-view-element-section-title", children: title }), children] }));
|
|
33
|
+
}
|
|
34
|
+
/** Caller-authored verdict. Tone remains an explicit SemanticElement concern. */
|
|
35
|
+
export function ElementVerdict({ value, label, className, }) {
|
|
36
|
+
return (_jsxs("div", { class: classes("mcp-view-element-verdict", className), "data-element-slot": "verdict", children: [isPresent(label) && _jsx("span", { class: "mcp-view-element-verdict-label", children: label }), _jsx("strong", { class: "mcp-view-element-verdict-value", children: value })] }));
|
|
37
|
+
}
|
|
38
|
+
/** Exact caller-provided provenance such as a source, revision, or fingerprint. */
|
|
39
|
+
export function ElementProvenance({ value, label, className, }) {
|
|
40
|
+
return (_jsxs("footer", { class: classes("mcp-view-element-provenance", className), "data-element-slot": "provenance", children: [isPresent(label) && _jsx("span", { class: "mcp-view-element-provenance-label", children: label }), _jsx("span", { class: "mcp-view-element-provenance-value", children: value })] }));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Render one semantic object without owning domain vocabulary or reference resolution.
|
|
44
|
+
*
|
|
45
|
+
* The same slots survive chip, row, and card composition. When a tone is explicitly
|
|
46
|
+
* supplied, an inline-start verdict border is invariant across all three densities.
|
|
47
|
+
*/
|
|
48
|
+
export function SemanticElement({ reference, density, tone, selected, ident, reading, body, verdict, provenance, activationLabel, onActivate, className, }) {
|
|
49
|
+
if (!ident)
|
|
50
|
+
throw new TypeError("SemanticElement requires an ElementIdent slot");
|
|
51
|
+
const interactive = onActivate !== undefined;
|
|
52
|
+
const activate = () => onActivate?.(reference);
|
|
53
|
+
return (_jsxs("div", { "aria-current": !interactive && selected ? "true" : undefined, "aria-label": interactive ? activationLabel : undefined, "aria-pressed": interactive && selected !== undefined ? selected : undefined, class: classes("mcp-view-semantic-element", selected ? "mcp-view-selected" : undefined, className), "data-density": density, "data-interactive": interactive ? "true" : undefined, "data-selected": selected === undefined ? undefined : String(selected), "data-semantic-domain": reference.domain, "data-semantic-id": reference.id, "data-semantic-kind": reference.kind, "data-basis-fingerprint": reference.basisFingerprint, "data-tone": tone, role: interactive ? "button" : undefined, style: tone ? { borderInlineStart: verdictBorder(tone) } : undefined, tabIndex: interactive ? 0 : undefined, onClick: interactive
|
|
54
|
+
? (event) => {
|
|
55
|
+
if (eventStartedInInteractiveChild(event.currentTarget, event.target))
|
|
56
|
+
return;
|
|
57
|
+
activate();
|
|
58
|
+
}
|
|
59
|
+
: undefined, onKeyDown: interactive
|
|
60
|
+
? (event) => {
|
|
61
|
+
if (event.target !== event.currentTarget)
|
|
62
|
+
return;
|
|
63
|
+
if (event.key !== "Enter" && event.key !== " ")
|
|
64
|
+
return;
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
activate();
|
|
67
|
+
}
|
|
68
|
+
: undefined, children: [ident, isPresent(reading) && (_jsx("div", { class: "mcp-view-element-readings", "data-element-slot": "readings", children: reading })), body, verdict, provenance] }));
|
|
69
|
+
}
|
|
70
|
+
const INTERACTIVE_CHILD_SELECTOR = [
|
|
71
|
+
"a[href]",
|
|
72
|
+
"button",
|
|
73
|
+
"input",
|
|
74
|
+
"select",
|
|
75
|
+
"textarea",
|
|
76
|
+
"[role='button']",
|
|
77
|
+
"[role='link']",
|
|
78
|
+
].join(",");
|
|
79
|
+
function eventStartedInInteractiveChild(element, target) {
|
|
80
|
+
const candidate = target;
|
|
81
|
+
if (!candidate || typeof candidate.closest !== "function")
|
|
82
|
+
return false;
|
|
83
|
+
const interactive = candidate.closest(INTERACTIVE_CHILD_SELECTOR);
|
|
84
|
+
return interactive !== null && interactive !== element && element.contains(interactive);
|
|
85
|
+
}
|
|
86
|
+
function verdictBorder(tone) {
|
|
87
|
+
const color = {
|
|
88
|
+
neutral: "var(--mcp-view-muted, currentColor)",
|
|
89
|
+
info: "var(--mcp-view-accent, currentColor)",
|
|
90
|
+
success: "var(--mcp-view-success, currentColor)",
|
|
91
|
+
warning: "var(--mcp-view-warning, currentColor)",
|
|
92
|
+
danger: "var(--mcp-view-danger, currentColor)",
|
|
93
|
+
}[tone];
|
|
94
|
+
return `var(--mcp-view-semantic-verdict-border-width, 3px) solid ${color}`;
|
|
95
|
+
}
|
|
96
|
+
function isPresent(value) {
|
|
97
|
+
if (value === undefined || value === null || value === false)
|
|
98
|
+
return false;
|
|
99
|
+
return !(Array.isArray(value) && value.length === 0);
|
|
100
|
+
}
|
|
101
|
+
function classes(...values) {
|
|
102
|
+
return values.filter(Boolean).join(" ");
|
|
103
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/** @jsxImportSource preact */
|
|
2
|
+
/** Pure presentation structures shared by composable MCP Apps. */
|
|
3
|
+
import type { ComponentChildren, JSX } from "preact";
|
|
4
|
+
import type { PresentationTone } from "./components.js";
|
|
5
|
+
export interface PathBarItem {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly label: ComponentChildren;
|
|
8
|
+
/** Recorded state of that kept level, revealed only by the collapsed disclosure. */
|
|
9
|
+
readonly detail?: ComponentChildren;
|
|
10
|
+
}
|
|
11
|
+
/** Trailing items kept inline before the leading ones collapse. */
|
|
12
|
+
export declare const PATH_BAR_DEFAULT_MAX_VISIBLE = 3;
|
|
13
|
+
export interface PathBarProps {
|
|
14
|
+
/** Accessible name for the navigation landmark. */
|
|
15
|
+
readonly label: string;
|
|
16
|
+
/** Ordered path, including the current item. */
|
|
17
|
+
readonly items: readonly PathBarItem[];
|
|
18
|
+
/** Controlled identity of the current item. */
|
|
19
|
+
readonly currentId: string;
|
|
20
|
+
/** Local navigation callback. The component owns no routing state. */
|
|
21
|
+
readonly onSelect: (id: string) => void;
|
|
22
|
+
/** Inline capacity before the leading items collapse. Defaults to three. */
|
|
23
|
+
readonly maxVisible?: number;
|
|
24
|
+
/** Accessible name of the collapsed disclosure. Omit to never collapse. */
|
|
25
|
+
readonly collapsedLabel?: string;
|
|
26
|
+
/** Accessible name of the leading step-out control. Omit to render none. */
|
|
27
|
+
readonly backLabel?: string;
|
|
28
|
+
readonly className?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Controlled breadcrumb-like navigation without host or MCP side effects.
|
|
32
|
+
*
|
|
33
|
+
* A one-item path renders nothing: the first level has nothing to leave.
|
|
34
|
+
*/
|
|
35
|
+
export declare function PathBar({ label, items, currentId, onSelect, maxVisible, collapsedLabel, backLabel, className, }: PathBarProps): JSX.Element | null;
|
|
36
|
+
/** Where one available drill-down leads. */
|
|
37
|
+
export type DrillHintDirection = "in-view" | "to-model";
|
|
38
|
+
interface DrillHintBaseProps {
|
|
39
|
+
readonly label: ComponentChildren;
|
|
40
|
+
readonly direction: DrillHintDirection;
|
|
41
|
+
readonly className?: string;
|
|
42
|
+
}
|
|
43
|
+
interface StaticDrillHintProps extends DrillHintBaseProps {
|
|
44
|
+
readonly onActivate?: undefined;
|
|
45
|
+
readonly actionLabel?: never;
|
|
46
|
+
}
|
|
47
|
+
interface InteractiveDrillHintProps extends DrillHintBaseProps {
|
|
48
|
+
readonly onActivate: () => void;
|
|
49
|
+
/** Accessible action name, supplied together with the callback. */
|
|
50
|
+
readonly actionLabel: string;
|
|
51
|
+
}
|
|
52
|
+
export type DrillHintProps = StaticDrillHintProps | InteractiveDrillHintProps;
|
|
53
|
+
/**
|
|
54
|
+
* Affordance for one available drill-down.
|
|
55
|
+
*
|
|
56
|
+
* Without a callback the hint degrades to plain text and shows no glyph, so a
|
|
57
|
+
* host that cannot follow it never advertises a step that does not exist.
|
|
58
|
+
*/
|
|
59
|
+
export declare function DrillHint(props: DrillHintProps): JSX.Element;
|
|
60
|
+
/** Shape of one recorded level, so a path never hides what it opens onto. */
|
|
61
|
+
export type ViewKind = "list" | "chart" | "record";
|
|
62
|
+
export interface TypeBadgeProps {
|
|
63
|
+
readonly kind: ViewKind;
|
|
64
|
+
/** Caller-provided wording. The kit never translates or invents a label. */
|
|
65
|
+
readonly label: ComponentChildren;
|
|
66
|
+
readonly className?: string;
|
|
67
|
+
}
|
|
68
|
+
/** Names what one level is, next to the path that reached it. */
|
|
69
|
+
export declare function TypeBadge({ kind, label, className }: TypeBadgeProps): JSX.Element;
|
|
70
|
+
export interface StaleBannerAction {
|
|
71
|
+
readonly label: string;
|
|
72
|
+
readonly onActivate: () => void;
|
|
73
|
+
}
|
|
74
|
+
export interface StaleBannerProps {
|
|
75
|
+
/** Caller-formatted sentence, including the instant those values were recorded. */
|
|
76
|
+
readonly message: ComponentChildren;
|
|
77
|
+
readonly tone?: PresentationTone;
|
|
78
|
+
readonly action?: StaleBannerAction;
|
|
79
|
+
readonly className?: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Marks the surrounding values as recorded earlier without hiding them.
|
|
83
|
+
*
|
|
84
|
+
* The banner refetches nothing and never replaces a dated value with a gap.
|
|
85
|
+
*/
|
|
86
|
+
export declare function StaleBanner({ message, tone, action, className, }: StaleBannerProps): JSX.Element;
|
|
87
|
+
export interface Slot3DProps {
|
|
88
|
+
/** Accessible name of the reserved area. */
|
|
89
|
+
readonly label: string;
|
|
90
|
+
/** Caller-provided wording for the reserved state. */
|
|
91
|
+
readonly statusLabel: ComponentChildren;
|
|
92
|
+
/** A provider-owned renderer. Without one the slot stays visibly reserved. */
|
|
93
|
+
readonly children?: ComponentChildren;
|
|
94
|
+
readonly className?: string;
|
|
95
|
+
}
|
|
96
|
+
/** Reserved area for a provider-owned 3D pose. The kit renders no geometry. */
|
|
97
|
+
export declare function Slot3D({ label, statusLabel, children, className }: Slot3DProps): JSX.Element;
|
|
98
|
+
export interface TreeListNode {
|
|
99
|
+
readonly id: string;
|
|
100
|
+
readonly label: ComponentChildren;
|
|
101
|
+
/** Caller-provided type wording, such as a package, part, or attribute. */
|
|
102
|
+
readonly typeLabel?: ComponentChildren;
|
|
103
|
+
readonly detail?: ComponentChildren;
|
|
104
|
+
/** Caller-computed coverage wording. The kit counts nothing. */
|
|
105
|
+
readonly coverageLabel?: ComponentChildren;
|
|
106
|
+
readonly tone?: PresentationTone;
|
|
107
|
+
readonly children?: readonly TreeListNode[];
|
|
108
|
+
}
|
|
109
|
+
export interface TreeListProps {
|
|
110
|
+
/** Accessible name for the tree. */
|
|
111
|
+
readonly label: string;
|
|
112
|
+
readonly nodes: readonly TreeListNode[];
|
|
113
|
+
/** Controlled expansion. The component keeps no local disclosure state. */
|
|
114
|
+
readonly expandedIds: readonly string[];
|
|
115
|
+
readonly onToggle: (id: string) => void;
|
|
116
|
+
/** Accessible name shared by every disclosure control. */
|
|
117
|
+
readonly toggleLabel: string;
|
|
118
|
+
readonly selectedId?: string;
|
|
119
|
+
/** Omit to render a read-only tree with no selection affordance. */
|
|
120
|
+
readonly onSelect?: (id: string) => void;
|
|
121
|
+
readonly className?: string;
|
|
122
|
+
}
|
|
123
|
+
/** Controlled hierarchy with caller-owned type wording and coverage. */
|
|
124
|
+
export declare function TreeList({ label, nodes, expandedIds, onToggle, toggleLabel, selectedId, onSelect, className, }: TreeListProps): JSX.Element;
|
|
125
|
+
export interface LimitGaugeLimit {
|
|
126
|
+
/** Position of the caller-provided limit on the same finite scale. */
|
|
127
|
+
readonly value: number;
|
|
128
|
+
/** Visible description of that recorded limit. */
|
|
129
|
+
readonly label: string;
|
|
130
|
+
}
|
|
131
|
+
export interface LimitGaugeProps {
|
|
132
|
+
readonly label: string;
|
|
133
|
+
readonly min: number;
|
|
134
|
+
readonly max: number;
|
|
135
|
+
readonly value: number;
|
|
136
|
+
/** Caller-formatted reading, including its unit when applicable. */
|
|
137
|
+
readonly valueLabel: string;
|
|
138
|
+
/** Caller-provided state text; the gauge never derives a verdict. */
|
|
139
|
+
readonly statusLabel: string;
|
|
140
|
+
readonly tone: PresentationTone;
|
|
141
|
+
readonly limit?: LimitGaugeLimit;
|
|
142
|
+
readonly className?: string;
|
|
143
|
+
}
|
|
144
|
+
/** Finite meter with an optional caller-supplied limit marker and explicit status text. */
|
|
145
|
+
export declare function LimitGauge({ label, min, max, value, valueLabel, statusLabel, tone, limit, className, }: LimitGaugeProps): JSX.Element;
|
|
146
|
+
export interface ArtifactFingerprint {
|
|
147
|
+
readonly algorithm: string;
|
|
148
|
+
readonly digest: string;
|
|
149
|
+
}
|
|
150
|
+
export interface ArtifactVerification {
|
|
151
|
+
/** Literal verification state supplied by the caller. */
|
|
152
|
+
readonly label: ComponentChildren;
|
|
153
|
+
readonly tone: PresentationTone;
|
|
154
|
+
}
|
|
155
|
+
interface ArtifactRowBaseProps {
|
|
156
|
+
readonly label: ComponentChildren;
|
|
157
|
+
readonly kind?: ComponentChildren;
|
|
158
|
+
readonly uri: string;
|
|
159
|
+
readonly fingerprint?: ArtifactFingerprint;
|
|
160
|
+
/** Caller-formatted byte size or other bounded size description. */
|
|
161
|
+
readonly sizeLabel?: ComponentChildren;
|
|
162
|
+
readonly verification?: ArtifactVerification;
|
|
163
|
+
readonly className?: string;
|
|
164
|
+
}
|
|
165
|
+
interface StaticArtifactRowProps extends ArtifactRowBaseProps {
|
|
166
|
+
readonly onActivate?: undefined;
|
|
167
|
+
readonly actionLabel?: never;
|
|
168
|
+
}
|
|
169
|
+
interface InteractiveArtifactRowProps extends ArtifactRowBaseProps {
|
|
170
|
+
readonly onActivate: () => void;
|
|
171
|
+
/** Accessible action name, supplied together with the callback. */
|
|
172
|
+
readonly actionLabel: string;
|
|
173
|
+
}
|
|
174
|
+
export type ArtifactRowProps = StaticArtifactRowProps | InteractiveArtifactRowProps;
|
|
175
|
+
/** Immutable-artifact presentation; verification is displayed, never inferred or performed. */
|
|
176
|
+
export declare function ArtifactRow(props: ArtifactRowProps): JSX.Element;
|
|
177
|
+
export {};
|
|
178
|
+
//# sourceMappingURL=structural.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structural.d.ts","sourceRoot":"","sources":["../../../src/src/preact/structural.tsx"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,kEAAkE;AAElE,OAAO,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,M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S,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,yDAAyD;IACzD,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;CACjC;AAED,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,IAAI,CAAC,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAC3C,oEAAoE;IACpE,QAAQ,CAAC,SAAS,CAAC,EAAE,iBAAiB,CAAC;IACvC,QAAQ,CAAC,YAAY,CAAC,EAAE,oBAAoB,CAAC;IAC7C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,UAAU,sBAAuB,SAAQ,oBAAoB;IAC3D,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC;IAChC,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC;CAC9B;AAED,UAAU,2BAA4B,SAAQ,oBAAoB;IAChE,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;IAChC,mEAAmE;IACnE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,MAAM,gBAAgB,GAAG,sBAAsB,GAAG,2BAA2B,CAAC;AAEpF,+FAA+F;AAC/F,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAwChE"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
|
|
2
|
+
/** Trailing items kept inline before the leading ones collapse. */
|
|
3
|
+
export const PATH_BAR_DEFAULT_MAX_VISIBLE = 3;
|
|
4
|
+
/**
|
|
5
|
+
* Controlled breadcrumb-like navigation without host or MCP side effects.
|
|
6
|
+
*
|
|
7
|
+
* A one-item path renders nothing: the first level has nothing to leave.
|
|
8
|
+
*/
|
|
9
|
+
export function PathBar({ label, items, currentId, onSelect, maxVisible = PATH_BAR_DEFAULT_MAX_VISIBLE, collapsedLabel, backLabel, className, }) {
|
|
10
|
+
validatePath(items, currentId, maxVisible);
|
|
11
|
+
if (items.length < 2)
|
|
12
|
+
return null;
|
|
13
|
+
const collapsed = collapsedLabel !== undefined && items.length > maxVisible
|
|
14
|
+
? items.slice(0, items.length - maxVisible)
|
|
15
|
+
: [];
|
|
16
|
+
const visible = items.slice(collapsed.length);
|
|
17
|
+
const currentIndex = items.findIndex((item) => item.id === currentId);
|
|
18
|
+
const previous = currentIndex > 0 ? items[currentIndex - 1] : undefined;
|
|
19
|
+
return (_jsxs("nav", { "aria-label": label, class: classes("mcp-view-path-bar", className), children: [backLabel !== undefined && previous !== undefined && (_jsx("button", { "aria-label": backLabel, class: "mcp-view-path-bar-back", onClick: () => onSelect(previous.id), type: "button", children: _jsx("span", { "aria-hidden": "true", children: "\u2039" }) })), collapsed.length > 0 && (_jsxs("details", { class: "mcp-view-path-bar-collapsed", children: [_jsx("summary", { "aria-label": collapsedLabel, class: "mcp-view-path-bar-collapsed-summary", children: _jsx("span", { "aria-hidden": "true", children: `…${collapsed.length}` }) }), _jsx("ul", { class: "mcp-view-path-bar-kept", children: collapsed.map((item, index) => (_jsx("li", { children: _jsxs("button", { class: "mcp-view-path-bar-kept-button", onClick: () => onSelect(item.id), type: "button", children: [_jsx("span", { "aria-hidden": "true", class: "mcp-view-path-bar-kept-rank", children: index + 1 }), _jsx("span", { class: "mcp-view-path-bar-kept-label", children: item.label }), item.detail !== undefined && (_jsx("small", { class: "mcp-view-path-bar-kept-detail", children: item.detail }))] }) }, item.id))) })] })), _jsx("ol", { class: "mcp-view-path-bar-list", children: visible.map((item) => {
|
|
20
|
+
const current = item.id === currentId;
|
|
21
|
+
return (_jsx("li", { class: "mcp-view-path-bar-item", "data-current": current ? "true" : undefined, children: current
|
|
22
|
+
? (_jsx("span", { "aria-current": "page", class: "mcp-view-path-bar-current", children: item.label }))
|
|
23
|
+
: (_jsx("button", { class: "mcp-view-path-bar-button", onClick: () => onSelect(item.id), type: "button", children: item.label })) }, item.id));
|
|
24
|
+
}) })] }));
|
|
25
|
+
}
|
|
26
|
+
const DRILL_HINT_GLYPH = Object.freeze({
|
|
27
|
+
"in-view": "›",
|
|
28
|
+
"to-model": "~",
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Affordance for one available drill-down.
|
|
32
|
+
*
|
|
33
|
+
* Without a callback the hint degrades to plain text and shows no glyph, so a
|
|
34
|
+
* host that cannot follow it never advertises a step that does not exist.
|
|
35
|
+
*/
|
|
36
|
+
export function DrillHint(props) {
|
|
37
|
+
const className = classes("mcp-view-drill-hint", props.className);
|
|
38
|
+
if (props.onActivate === undefined) {
|
|
39
|
+
return (_jsx("span", { class: className, "data-degraded": "true", "data-direction": props.direction, children: props.label }));
|
|
40
|
+
}
|
|
41
|
+
return (_jsxs("button", { "aria-label": props.actionLabel, class: className, "data-direction": props.direction, onClick: props.onActivate, type: "button", children: [_jsx("span", { class: "mcp-view-drill-hint-label", children: props.label }), _jsx("span", { "aria-hidden": "true", class: "mcp-view-drill-hint-glyph", children: DRILL_HINT_GLYPH[props.direction] })] }));
|
|
42
|
+
}
|
|
43
|
+
/** Names what one level is, next to the path that reached it. */
|
|
44
|
+
export function TypeBadge({ kind, label, className }) {
|
|
45
|
+
return (_jsx("span", { class: classes("mcp-view-type-badge", className), "data-kind": kind, children: label }));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Marks the surrounding values as recorded earlier without hiding them.
|
|
49
|
+
*
|
|
50
|
+
* The banner refetches nothing and never replaces a dated value with a gap.
|
|
51
|
+
*/
|
|
52
|
+
export function StaleBanner({ message, tone = "warning", action, className, }) {
|
|
53
|
+
return (_jsxs("div", { class: classes("mcp-view-stale-banner", className), "data-tone": tone, role: tone === "danger" ? "alert" : "status", children: [_jsx("span", { class: "mcp-view-stale-banner-message", children: message }), action && (_jsx("button", { class: "mcp-view-stale-banner-action", onClick: action.onActivate, type: "button", children: action.label }))] }));
|
|
54
|
+
}
|
|
55
|
+
/** Reserved area for a provider-owned 3D pose. The kit renders no geometry. */
|
|
56
|
+
export function Slot3D({ label, statusLabel, children, className }) {
|
|
57
|
+
const reserved = children === undefined || children === null || children === false;
|
|
58
|
+
return (_jsxs("figure", { "aria-label": label, class: classes("mcp-view-slot-3d", className), "data-reserved": reserved ? "true" : undefined, role: "group", children: [_jsx("div", { class: "mcp-view-slot-3d-frame", children: reserved ? _jsx("span", { "aria-hidden": "true", class: "mcp-view-slot-3d-mark" }) : children }), _jsx("figcaption", { class: "mcp-view-slot-3d-status", children: statusLabel })] }));
|
|
59
|
+
}
|
|
60
|
+
/** Controlled hierarchy with caller-owned type wording and coverage. */
|
|
61
|
+
export function TreeList({ label, nodes, expandedIds, onToggle, toggleLabel, selectedId, onSelect, className, }) {
|
|
62
|
+
validateTree(nodes);
|
|
63
|
+
const expanded = new Set(expandedIds);
|
|
64
|
+
return (_jsx("ul", { "aria-label": label, class: classes("mcp-view-tree-list", className), role: "tree", children: nodes.map((node) => (_jsx(TreeListItem, { expanded: expanded, level: 1, node: node, onSelect: onSelect, onToggle: onToggle, selectedId: selectedId, toggleLabel: toggleLabel }, node.id))) }));
|
|
65
|
+
}
|
|
66
|
+
function TreeListItem({ node, level, expanded, onToggle, toggleLabel, selectedId, onSelect, }) {
|
|
67
|
+
const children = node.children ?? [];
|
|
68
|
+
const open = children.length > 0 && expanded.has(node.id);
|
|
69
|
+
const selected = selectedId === node.id;
|
|
70
|
+
return (_jsxs("li", { "aria-expanded": children.length > 0 ? open : undefined, "aria-level": level, "aria-selected": onSelect === undefined ? undefined : selected, class: "mcp-view-tree-list-item", "data-tone": node.tone, role: "treeitem", children: [_jsxs("div", { class: "mcp-view-tree-list-row", style: { paddingInlineStart: `${(level - 1) * 0.9}rem` }, children: [children.length > 0
|
|
71
|
+
? (_jsx("button", { "aria-expanded": open, "aria-label": toggleLabel, class: "mcp-view-tree-list-twisty", onClick: () => onToggle(node.id), type: "button", children: _jsx("span", { "aria-hidden": "true", children: open ? "▾" : "▸" }) }))
|
|
72
|
+
: _jsx("span", { "aria-hidden": "true", class: "mcp-view-tree-list-twisty", "data-empty": "true" }), node.typeLabel !== undefined && (_jsx("span", { class: "mcp-view-tree-list-type", children: node.typeLabel })), onSelect === undefined
|
|
73
|
+
? _jsx("span", { class: "mcp-view-tree-list-label", children: node.label })
|
|
74
|
+
: (_jsx("button", { class: "mcp-view-tree-list-label", onClick: () => onSelect(node.id), type: "button", children: node.label })), node.detail !== undefined && _jsx("span", { class: "mcp-view-tree-list-detail", children: node.detail }), node.coverageLabel !== undefined && (_jsx("span", { class: "mcp-view-tree-list-coverage", "data-tone": node.tone, children: node.coverageLabel }))] }), open && (_jsx("ul", { class: "mcp-view-tree-list-group", role: "group", children: children.map((child) => (_jsx(TreeListItem, { expanded: expanded, level: level + 1, node: child, onSelect: onSelect, onToggle: onToggle, selectedId: selectedId, toggleLabel: toggleLabel }, child.id))) }))] }));
|
|
75
|
+
}
|
|
76
|
+
/** Finite meter with an optional caller-supplied limit marker and explicit status text. */
|
|
77
|
+
export function LimitGauge({ label, min, max, value, valueLabel, statusLabel, tone, limit, className, }) {
|
|
78
|
+
validateGaugeRange(min, max, value, limit);
|
|
79
|
+
const markerPosition = limit === undefined
|
|
80
|
+
? undefined
|
|
81
|
+
: `${((limit.value - min) / (max - min)) * 100}%`;
|
|
82
|
+
return (_jsxs("div", { class: classes("mcp-view-limit-gauge", className), "data-tone": tone, children: [_jsx("span", { class: "mcp-view-limit-gauge-label", children: label }), _jsxs("div", { class: "mcp-view-limit-gauge-track", children: [_jsx("meter", { "aria-label": label, "aria-valuetext": `${valueLabel}; ${statusLabel}`, class: "mcp-view-limit-gauge-meter", min: min, max: max, value: value }), limit && (_jsx("span", { "aria-hidden": "true", class: "mcp-view-limit-gauge-marker", style: { left: markerPosition } }))] }), _jsx("span", { class: "mcp-view-limit-gauge-reading", children: valueLabel }), _jsx("span", { class: "mcp-view-limit-gauge-status", "data-tone": tone, children: statusLabel }), limit && _jsx("span", { class: "mcp-view-limit-gauge-limit", children: limit.label })] }));
|
|
83
|
+
}
|
|
84
|
+
/** Immutable-artifact presentation; verification is displayed, never inferred or performed. */
|
|
85
|
+
export function ArtifactRow(props) {
|
|
86
|
+
const content = (_jsxs(_Fragment, { children: [_jsxs("span", { class: "mcp-view-artifact-row-identity", children: [props.kind && _jsx("span", { class: "mcp-view-artifact-row-kind", children: props.kind }), _jsx("strong", { class: "mcp-view-artifact-row-label", children: props.label })] }), _jsx("code", { class: "mcp-view-artifact-row-uri", children: props.uri }), props.fingerprint && (_jsxs("span", { class: "mcp-view-artifact-row-fingerprint", children: [_jsx("span", { children: props.fingerprint.algorithm }), _jsx("code", { children: props.fingerprint.digest })] })), props.sizeLabel && _jsx("span", { class: "mcp-view-artifact-row-size", children: props.sizeLabel }), props.verification && (_jsx("span", { class: "mcp-view-artifact-row-verification", "data-tone": props.verification.tone, children: props.verification.label }))] }));
|
|
87
|
+
const className = classes("mcp-view-artifact-row", props.className);
|
|
88
|
+
if (props.onActivate) {
|
|
89
|
+
return (_jsx("button", { "aria-label": props.actionLabel, class: className, onClick: props.onActivate, type: "button", children: content }));
|
|
90
|
+
}
|
|
91
|
+
return _jsx("article", { class: className, children: content });
|
|
92
|
+
}
|
|
93
|
+
function validatePath(items, currentId, maxVisible) {
|
|
94
|
+
if (items.length === 0)
|
|
95
|
+
throw new TypeError("PathBar items must not be empty");
|
|
96
|
+
if (!Number.isInteger(maxVisible) || maxVisible < 1) {
|
|
97
|
+
throw new RangeError("PathBar maxVisible must be a positive integer");
|
|
98
|
+
}
|
|
99
|
+
const ids = new Set();
|
|
100
|
+
for (const item of items) {
|
|
101
|
+
if (!item.id.trim())
|
|
102
|
+
throw new TypeError("PathBar item ids must be non-empty");
|
|
103
|
+
if (ids.has(item.id))
|
|
104
|
+
throw new TypeError(`PathBar item id ${item.id} is duplicated`);
|
|
105
|
+
ids.add(item.id);
|
|
106
|
+
}
|
|
107
|
+
if (!ids.has(currentId))
|
|
108
|
+
throw new TypeError("PathBar currentId must identify one item");
|
|
109
|
+
}
|
|
110
|
+
function validateTree(nodes) {
|
|
111
|
+
if (nodes.length === 0)
|
|
112
|
+
throw new TypeError("TreeList nodes must not be empty");
|
|
113
|
+
const ids = new Set();
|
|
114
|
+
const walk = (candidates) => {
|
|
115
|
+
for (const node of candidates) {
|
|
116
|
+
if (!node.id.trim())
|
|
117
|
+
throw new TypeError("TreeList node ids must be non-empty");
|
|
118
|
+
if (ids.has(node.id))
|
|
119
|
+
throw new TypeError(`TreeList node id ${node.id} is duplicated`);
|
|
120
|
+
ids.add(node.id);
|
|
121
|
+
if (node.children)
|
|
122
|
+
walk(node.children);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
walk(nodes);
|
|
126
|
+
}
|
|
127
|
+
function validateGaugeRange(min, max, value, limit) {
|
|
128
|
+
for (const [name, candidate] of [["min", min], ["max", max], ["value", value]]) {
|
|
129
|
+
if (!Number.isFinite(candidate))
|
|
130
|
+
throw new TypeError(`LimitGauge ${name} must be finite`);
|
|
131
|
+
}
|
|
132
|
+
if (max <= min)
|
|
133
|
+
throw new RangeError("LimitGauge max must be greater than min");
|
|
134
|
+
if (value < min || value > max) {
|
|
135
|
+
throw new RangeError("LimitGauge value must be within min and max");
|
|
136
|
+
}
|
|
137
|
+
if (limit === undefined)
|
|
138
|
+
return;
|
|
139
|
+
if (!Number.isFinite(limit.value))
|
|
140
|
+
throw new TypeError("LimitGauge limit must be finite");
|
|
141
|
+
if (limit.value < min || limit.value > max) {
|
|
142
|
+
throw new RangeError("LimitGauge limit must be within min and max");
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function classes(...values) {
|
|
146
|
+
return values.filter(Boolean).join(" ");
|
|
147
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Preact bindings for result-driven MCP App component surfaces. */
|
|
2
|
+
import { type FunctionComponent } from "preact";
|
|
3
|
+
import { type JsonValue, type ViewComponentDefinition, type ViewComponentDescriptor } from "../components.js";
|
|
4
|
+
import { type SurfaceAppContext, type SurfaceAppHandle, type SurfaceAppOptions, type SurfaceAppRuntime, type SurfaceAppState, type SurfaceStatus } from "../surface-app.js";
|
|
5
|
+
export type { SurfaceAppErrorCode, SurfaceAppHandle, SurfaceAppRuntime, SurfaceDisplayState, SurfaceHostAccess, SurfaceLabel, SurfaceMessageKind, SurfaceProjection, SurfaceStatus, SurfaceStatusTone, SurfaceToolResult, SurfaceViewerSession, } from "../surface-app.js";
|
|
6
|
+
export { SurfaceAppError } from "../surface-app.js";
|
|
7
|
+
export type PreactSurfaceAppState<TData> = SurfaceAppState<TData>;
|
|
8
|
+
export type PreactSurfaceContext<TData> = SurfaceAppContext<TData>;
|
|
9
|
+
export interface PreactSurfaceComponentProps<TData, TAppContext = PreactSurfaceContext<TData>> {
|
|
10
|
+
readonly data: TData;
|
|
11
|
+
readonly context: TAppContext;
|
|
12
|
+
readonly instanceId: string;
|
|
13
|
+
readonly props: Readonly<Record<string, JsonValue>>;
|
|
14
|
+
}
|
|
15
|
+
/** Small injection seam for DOM-light unit tests. */
|
|
16
|
+
export interface PreactComponentRenderer {
|
|
17
|
+
mount<P extends object>(component: FunctionComponent<P>, props: P, target: HTMLElement): void;
|
|
18
|
+
unmount(target: HTMLElement): void;
|
|
19
|
+
}
|
|
20
|
+
export declare const preactSurfaceRenderer: PreactComponentRenderer;
|
|
21
|
+
/** Turn one Preact component into a renderer-neutral mcp-view component. */
|
|
22
|
+
export declare function definePreactComponent<TData, TAppContext = PreactSurfaceContext<TData>>(descriptor: ViewComponentDescriptor, component: FunctionComponent<PreactSurfaceComponentProps<TData, TAppContext>>, renderer?: PreactComponentRenderer): ViewComponentDefinition<TData, TAppContext>;
|
|
23
|
+
export interface PreactSurfaceAppOptions<TData, TSession = never> extends Omit<SurfaceAppOptions<TData, TSession>, "renderStatus" | "surfaceClassName"> {
|
|
24
|
+
/** Class of the element wrapping the mounted surface. Default `mcp-view-preact-surface`. */
|
|
25
|
+
readonly surfaceClassName?: string;
|
|
26
|
+
/** Extra class on the rendered `StateMessage`, for viewer-owned styling hooks. */
|
|
27
|
+
readonly statusClassName?: string;
|
|
28
|
+
/** Replace the `StateMessage` bridge with a viewer-owned status renderer. */
|
|
29
|
+
readonly renderStatus?: (status: SurfaceStatus) => Node;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Start a result-driven MCP App whose statuses render through the Preact
|
|
33
|
+
* `StateMessage`. Everything else is `startSurfaceApp`; the shell keeps the
|
|
34
|
+
* `mcp-view-preact-surface` class 0.5 viewers style.
|
|
35
|
+
*/
|
|
36
|
+
export declare function startPreactSurfaceApp<TData, TSession = never>(options: PreactSurfaceAppOptions<TData, TSession>, runtime?: SurfaceAppRuntime): Promise<SurfaceAppHandle<TData>>;
|
|
37
|
+
//# sourceMappingURL=surface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../../../src/src/preact/surface.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAEpE,OAAO,EAAiB,KAAK,iBAAiB,EAAU,MAAM,QAAQ,CAAC;AAEvE,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,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