@mcpview/components 0.0.0-stage → 0.11.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 +593 -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 +130 -0
- package/esm/src/preact/plots.d.ts.map +1 -0
- package/esm/src/preact/plots.js +166 -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 +1964 -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 +130 -0
- package/script/src/preact/plots.d.ts.map +1 -0
- package/script/src/preact/plots.js +171 -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 +1968 -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,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Stack = Stack;
|
|
4
|
+
exports.Row = Row;
|
|
5
|
+
exports.Card = Card;
|
|
6
|
+
exports.BadgeGroup = BadgeGroup;
|
|
7
|
+
exports.Badge = Badge;
|
|
8
|
+
exports.Metric = Metric;
|
|
9
|
+
exports.MetricGrid = MetricGrid;
|
|
10
|
+
exports.KeyValueList = KeyValueList;
|
|
11
|
+
exports.DataTable = DataTable;
|
|
12
|
+
exports.Button = Button;
|
|
13
|
+
exports.TextInput = TextInput;
|
|
14
|
+
exports.CodeBlock = CodeBlock;
|
|
15
|
+
exports.InlineCode = InlineCode;
|
|
16
|
+
exports.Toolbar = Toolbar;
|
|
17
|
+
exports.EmptyState = EmptyState;
|
|
18
|
+
exports.Skeleton = Skeleton;
|
|
19
|
+
exports.Message = Message;
|
|
20
|
+
exports.NoticeGroup = NoticeGroup;
|
|
21
|
+
exports.renderStatusMessage = renderStatusMessage;
|
|
22
|
+
exports.CrossSelection = CrossSelection;
|
|
23
|
+
exports.StateMessage = StateMessage;
|
|
24
|
+
const preact_1 = require("preact");
|
|
25
|
+
const jsx_runtime_1 = require("preact/jsx-runtime");
|
|
26
|
+
/** @jsxImportSource preact */
|
|
27
|
+
/** Shared Preact presentation primitives for composable MCP Apps. */
|
|
28
|
+
const preact_2 = require("preact");
|
|
29
|
+
/** Simple vertical composition primitive; it carries no domain semantics. */
|
|
30
|
+
function Stack({ gap = "md", className, children }) {
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)("div", { class: classes("mcp-view-stack", className), "data-gap": gap, children: children }));
|
|
32
|
+
}
|
|
33
|
+
/** Horizontal fact or control row; its contents and meaning remain caller-owned. */
|
|
34
|
+
function Row({ label, responsive = false, className, children, }) {
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)("div", { "aria-label": label, class: classes("mcp-view-row", responsive ? "mcp-view-row-responsive" : undefined, className), role: label ? "group" : undefined, children: children }));
|
|
36
|
+
}
|
|
37
|
+
/** The canonical MCP component container. */
|
|
38
|
+
function Card({ title, eyebrow, actions, className, children, }) {
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)("section", { class: classes("mcp-view-card", className), children: [(title || eyebrow || actions) && ((0, jsx_runtime_1.jsxs)("header", { class: "mcp-view-card-header", children: [(0, jsx_runtime_1.jsxs)("div", { class: "mcp-view-card-heading", children: [eyebrow && (0, jsx_runtime_1.jsx)("p", { class: "mcp-view-card-eyebrow", children: eyebrow }), title && (0, jsx_runtime_1.jsx)("h2", { class: "mcp-view-card-title", children: title })] }), actions && (0, jsx_runtime_1.jsx)("div", { class: "mcp-view-card-actions", children: actions })] })), children] }));
|
|
40
|
+
}
|
|
41
|
+
/** Accessible wrapping group for compact status and classification badges. */
|
|
42
|
+
function BadgeGroup({ label, className, children, }) {
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)("div", { "aria-label": label, class: classes("mcp-view-badges", className), role: "group", children: children }));
|
|
44
|
+
}
|
|
45
|
+
/** Compact status or classification label. */
|
|
46
|
+
function Badge({ tone = "neutral", children, className }) {
|
|
47
|
+
return ((0, jsx_runtime_1.jsx)("span", { class: classes("mcp-view-badge", className), "data-tone": tone, children: children }));
|
|
48
|
+
}
|
|
49
|
+
/** One unit-bearing reading. Callers remain responsible for the value and its tone. */
|
|
50
|
+
function Metric({ id, label, value, unit, detail, tone = "neutral", className, }) {
|
|
51
|
+
return ((0, jsx_runtime_1.jsxs)("article", { class: classes("mcp-view-metric", className), "data-metric": id, "data-tone": tone, children: [(0, jsx_runtime_1.jsx)("span", { class: "mcp-view-metric-label", children: label }), (0, jsx_runtime_1.jsx)("strong", { class: "mcp-view-metric-value", children: value }), unit && (0, jsx_runtime_1.jsx)("small", { class: "mcp-view-metric-unit", children: unit }), detail && (0, jsx_runtime_1.jsx)("small", { class: "mcp-view-metric-detail", children: detail })] }));
|
|
52
|
+
}
|
|
53
|
+
/** Responsive, container-aware metrics with stable semantic slots. */
|
|
54
|
+
function MetricGrid({ items, className }) {
|
|
55
|
+
return ((0, jsx_runtime_1.jsx)("div", { class: classes("mcp-view-metrics", className), children: items.map((metric) => (0, preact_1.createElement)(Metric, { ...metric, key: metric.id })) }));
|
|
56
|
+
}
|
|
57
|
+
/** Provenance and identity facts with safe wrapping for hashes and URIs. */
|
|
58
|
+
function KeyValueList({ items, layout = "inspector", className, }) {
|
|
59
|
+
return ((0, jsx_runtime_1.jsx)("dl", { class: classes("mcp-view-key-values", className), "data-layout": layout === "inspector" ? undefined : layout, children: items.map((item) => ((0, jsx_runtime_1.jsxs)("div", { class: "mcp-view-key-value", children: [(0, jsx_runtime_1.jsx)("dt", { children: item.label }), (0, jsx_runtime_1.jsx)("dd", { children: item.value })] }, item.id))) }));
|
|
60
|
+
}
|
|
61
|
+
/** Accessible compact table; selection behavior is opt-in and keyboard-safe. */
|
|
62
|
+
function DataTable({ label, rows, columns, rowKey, selected, onSelect, emptyLabel = "No matching data", className, }) {
|
|
63
|
+
if (rows.length === 0) {
|
|
64
|
+
return ((0, jsx_runtime_1.jsx)("div", { "aria-label": label, class: classes("mcp-view-table-wrap", className), role: "status", children: (0, jsx_runtime_1.jsx)(EmptyState, { children: emptyLabel }) }));
|
|
65
|
+
}
|
|
66
|
+
return ((0, jsx_runtime_1.jsx)("div", { class: classes("mcp-view-table-wrap", className), children: (0, jsx_runtime_1.jsxs)("table", { class: "mcp-view-table", "aria-label": label, children: [(0, jsx_runtime_1.jsx)("thead", { children: (0, jsx_runtime_1.jsx)("tr", { children: columns.map((column) => ((0, jsx_runtime_1.jsx)("th", { scope: "col", "data-align": column.align ?? "left", children: column.label }, column.id))) }) }), (0, jsx_runtime_1.jsx)("tbody", { children: rows.map((row) => {
|
|
67
|
+
const interactive = onSelect !== undefined;
|
|
68
|
+
const isSelected = selected?.(row);
|
|
69
|
+
const choose = () => onSelect?.(row);
|
|
70
|
+
return ((0, jsx_runtime_1.jsx)("tr", { "aria-selected": selected ? isSelected : undefined, class: isSelected ? "mcp-view-selected" : undefined, "data-interactive": interactive ? "true" : undefined, tabIndex: interactive ? 0 : undefined, onClick: interactive
|
|
71
|
+
? (event) => {
|
|
72
|
+
if (eventStartedInInteractiveChild(event.currentTarget, event.target))
|
|
73
|
+
return;
|
|
74
|
+
choose();
|
|
75
|
+
}
|
|
76
|
+
: undefined, onKeyDown: interactive
|
|
77
|
+
? (event) => {
|
|
78
|
+
if (event.target !== event.currentTarget)
|
|
79
|
+
return;
|
|
80
|
+
if (event.key !== "Enter" && event.key !== " ")
|
|
81
|
+
return;
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
choose();
|
|
84
|
+
}
|
|
85
|
+
: undefined, children: columns.map((column) => ((0, jsx_runtime_1.jsx)("td", { "data-align": column.align ?? "left", children: column.render(row) }, column.id))) }, rowKey(row)));
|
|
86
|
+
}) })] }) }));
|
|
87
|
+
}
|
|
88
|
+
/** Small dashboard-safe action, never a product-wide navigation control. */
|
|
89
|
+
function Button({ type = "button", pressed, disabled, title, className, onClick, children, }) {
|
|
90
|
+
return ((0, jsx_runtime_1.jsx)("button", { "aria-pressed": pressed, class: classes("mcp-view-button", className), disabled: disabled, onClick: onClick, title: title, type: type, children: children }));
|
|
91
|
+
}
|
|
92
|
+
/** Compact controlled text input with a mandatory accessible label. */
|
|
93
|
+
function TextInput({ label, value, placeholder, type = "search", disabled, className, onValueInput, }) {
|
|
94
|
+
return ((0, jsx_runtime_1.jsx)("input", { "aria-label": label, class: classes("mcp-view-text-input", className), disabled: disabled, onInput: (event) => onValueInput?.(event.currentTarget.value), placeholder: placeholder, type: type, value: value }));
|
|
95
|
+
}
|
|
96
|
+
/** Bounded preformatted content for expressions, source excerpts, and exact text. */
|
|
97
|
+
function CodeBlock({ label, className, children }) {
|
|
98
|
+
return ((0, jsx_runtime_1.jsx)("pre", { "aria-label": label, class: classes("mcp-view-code-block", className), children: (0, jsx_runtime_1.jsx)("code", { children: children }) }));
|
|
99
|
+
}
|
|
100
|
+
/** Inline exact text with safe wrapping for fingerprints, identifiers, and URIs. */
|
|
101
|
+
function InlineCode({ title, className, children, }) {
|
|
102
|
+
return ((0, jsx_runtime_1.jsx)("code", { class: classes("mcp-view-inline-code", className), title: title, children: children }));
|
|
103
|
+
}
|
|
104
|
+
function Toolbar({ label, className, children, }) {
|
|
105
|
+
return ((0, jsx_runtime_1.jsx)("div", { "aria-label": label, class: classes("mcp-view-toolbar", className), role: "group", children: children }));
|
|
106
|
+
}
|
|
107
|
+
function EmptyState({ children, className, }) {
|
|
108
|
+
return (0, jsx_runtime_1.jsx)("p", { class: classes("mcp-view-empty", className), children: children });
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Frame-first loading placeholder: the structure of a recorded view appears
|
|
112
|
+
* before its values, so nothing shifts once the values arrive.
|
|
113
|
+
*/
|
|
114
|
+
function Skeleton({ label, lines = 3, className }) {
|
|
115
|
+
if (!Number.isInteger(lines) || lines < 1) {
|
|
116
|
+
throw new RangeError("Skeleton lines must be a positive integer");
|
|
117
|
+
}
|
|
118
|
+
return ((0, jsx_runtime_1.jsx)("div", { "aria-busy": "true", "aria-label": label, class: classes("mcp-view-skeleton", className), role: "status", children: Array.from({ length: lines }, (_unused, index) => (0, jsx_runtime_1.jsx)("span", { "aria-hidden": "true", class: "mcp-view-skeleton-line" }, index)) }));
|
|
119
|
+
}
|
|
120
|
+
/** Compact inline notice that keeps surrounding values visible. */
|
|
121
|
+
function Message({ tone = "neutral", children, className, }) {
|
|
122
|
+
return ((0, jsx_runtime_1.jsx)("div", { class: classes("mcp-view-message", className), "data-tone": tone, role: tone === "danger" ? "alert" : "status", children: children }));
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Short notices gathered under one severity heading.
|
|
126
|
+
*
|
|
127
|
+
* Renders nothing when there is nothing to say, so a caller never has to guard
|
|
128
|
+
* the call site. Truncation is stated by the caller: the group displays the
|
|
129
|
+
* notices it was handed and never counts what it was not.
|
|
130
|
+
*/
|
|
131
|
+
function NoticeGroup({ label, items, tone = "neutral", omittedLabel, className, }) {
|
|
132
|
+
// `{count && `${count} more`}` yields 0 and `{text && text}` yields "" for a
|
|
133
|
+
// caller who means nothing was left out. Counting those as content would
|
|
134
|
+
// render the very group this contract promises to hide.
|
|
135
|
+
const omitted = omittedLabel !== undefined && omittedLabel !== null &&
|
|
136
|
+
omittedLabel !== false && omittedLabel !== "" && omittedLabel !== 0;
|
|
137
|
+
if (items.length === 0 && !omitted)
|
|
138
|
+
return null;
|
|
139
|
+
return ((0, jsx_runtime_1.jsxs)("section", { "aria-label": label, class: classes("mcp-view-notice-group", className), "data-tone": tone,
|
|
140
|
+
// One live region for the group, not one per notice. Wrapping each item
|
|
141
|
+
// in Message announced N separate alerts for what reads on screen as a
|
|
142
|
+
// single severity heading with its list underneath.
|
|
143
|
+
role: tone === "danger" ? "alert" : "status", children: [(0, jsx_runtime_1.jsx)("strong", { class: "mcp-view-notice-group-label", children: label }), (0, jsx_runtime_1.jsx)("ul", { class: "mcp-view-notice-group-items", children: items.map((item, index) => (0, jsx_runtime_1.jsx)("li", { class: "mcp-view-notice-group-item", children: item }, index)) }), omitted && (0, jsx_runtime_1.jsx)("small", { class: "mcp-view-notice-group-omitted", children: omittedLabel })] }));
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Render a `StateMessage` into a real DOM node and hand that node back.
|
|
147
|
+
*
|
|
148
|
+
* `defineView` returns a native element, so every viewer built on it has to
|
|
149
|
+
* bridge Preact to the DOM itself. Hand-written bridges drift — the tone, the
|
|
150
|
+
* alert role and the class stop matching between surfaces of the same product.
|
|
151
|
+
* This is that bridge, so one status looks like every other status.
|
|
152
|
+
*/
|
|
153
|
+
function renderStatusMessage(detail, options = {}) {
|
|
154
|
+
const host = options.container ?? document.createElement("div");
|
|
155
|
+
(0, preact_2.render)((0, preact_2.createElement)(StateMessage, {
|
|
156
|
+
busy: options.busy,
|
|
157
|
+
className: options.className,
|
|
158
|
+
title: options.title,
|
|
159
|
+
tone: options.tone,
|
|
160
|
+
}, detail), host);
|
|
161
|
+
// Without a container the caller mounts what comes back — typically as the
|
|
162
|
+
// return of `defineView`, which hands its element straight to the router.
|
|
163
|
+
// Returning the bare wrapper gave them a div carrying neither the class nor
|
|
164
|
+
// the alert role, so `replaceChildren` produced a root that no viewer stylesheet
|
|
165
|
+
// and no assistive technology could see. The container form returns the node
|
|
166
|
+
// the caller already owns.
|
|
167
|
+
if (options.container)
|
|
168
|
+
return options.container;
|
|
169
|
+
const rendered = host.firstElementChild;
|
|
170
|
+
if (!rendered)
|
|
171
|
+
throw new Error("renderStatusMessage rendered no element");
|
|
172
|
+
return rendered;
|
|
173
|
+
}
|
|
174
|
+
/** Read-only projection of a selection coordinated by an owning host. */
|
|
175
|
+
function CrossSelection({ label, value, status, className, }) {
|
|
176
|
+
return ((0, jsx_runtime_1.jsxs)("div", { class: classes("mcp-view-cross-selection", className), role: "status", children: [(0, jsx_runtime_1.jsx)("span", { class: "mcp-view-cross-selection-label", children: label }), (0, jsx_runtime_1.jsx)("strong", { class: "mcp-view-cross-selection-value", children: value }), status && (0, jsx_runtime_1.jsx)("span", { class: "mcp-view-cross-selection-status", children: status })] }));
|
|
177
|
+
}
|
|
178
|
+
function StateMessage({ title, tone = "neutral", busy, children, className, }) {
|
|
179
|
+
return ((0, jsx_runtime_1.jsxs)("div", { "aria-busy": busy, class: classes("mcp-view-state", className), "data-tone": tone, role: tone === "danger" ? "alert" : "status", children: [busy && (0, jsx_runtime_1.jsx)("span", { "aria-hidden": "true", class: "mcp-view-state-busy" }), title && (0, jsx_runtime_1.jsx)("strong", { children: title }), children && (0, jsx_runtime_1.jsx)("div", { class: "mcp-view-state-detail", children: children })] }));
|
|
180
|
+
}
|
|
181
|
+
const INTERACTIVE_CHILD_SELECTOR = [
|
|
182
|
+
"a[href]",
|
|
183
|
+
"button",
|
|
184
|
+
"input",
|
|
185
|
+
"select",
|
|
186
|
+
"textarea",
|
|
187
|
+
"[role='button']",
|
|
188
|
+
"[role='link']",
|
|
189
|
+
].join(",");
|
|
190
|
+
function eventStartedInInteractiveChild(row, target) {
|
|
191
|
+
const candidate = target;
|
|
192
|
+
if (!candidate || typeof candidate.closest !== "function")
|
|
193
|
+
return false;
|
|
194
|
+
const interactive = candidate.closest(INTERACTIVE_CHILD_SELECTOR);
|
|
195
|
+
return interactive !== null && interactive !== row && row.contains(interactive);
|
|
196
|
+
}
|
|
197
|
+
function classes(...values) {
|
|
198
|
+
return values.filter(Boolean).join(" ");
|
|
199
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** @jsxImportSource preact */
|
|
2
|
+
/** Presentation slots for one useful view and its optional technical details. */
|
|
3
|
+
import type { ComponentChildren, JSX } from "preact";
|
|
4
|
+
import type { LayoutHostHints, ViewerLayout } from "../layout/viewer-layout.js";
|
|
5
|
+
export interface DisclosureProps {
|
|
6
|
+
/** Visible, caller-worded summary and accessible name of the native control. */
|
|
7
|
+
readonly label: string;
|
|
8
|
+
readonly children?: ComponentChildren;
|
|
9
|
+
/** Omit for a native disclosure that starts closed. */
|
|
10
|
+
readonly open?: boolean;
|
|
11
|
+
readonly onToggle?: (open: boolean) => void;
|
|
12
|
+
readonly className?: string;
|
|
13
|
+
}
|
|
14
|
+
/** Native keyboard and disclosure semantics; never hides a caller's critical status by itself. */
|
|
15
|
+
export declare function Disclosure({ label, children, open, onToggle, className, }: DisclosureProps): JSX.Element;
|
|
16
|
+
interface FocusedViewSlots {
|
|
17
|
+
/** Accessible name for this bounded group, supplied by the viewer. */
|
|
18
|
+
readonly label: string;
|
|
19
|
+
/** The visualization or reading that gives this viewer its purpose. */
|
|
20
|
+
readonly primary: ComponentChildren;
|
|
21
|
+
/** Critical recorded state belongs here, outside the collapsed details. */
|
|
22
|
+
readonly status?: ComponentChildren;
|
|
23
|
+
/** Passed by value; this component imports no MCP Apps lifecycle. */
|
|
24
|
+
readonly hostContext?: LayoutHostHints;
|
|
25
|
+
/** Optional review override; otherwise the host, container and pointer decide. */
|
|
26
|
+
readonly layout?: ViewerLayout;
|
|
27
|
+
readonly className?: string;
|
|
28
|
+
}
|
|
29
|
+
export type FocusedViewProps = FocusedViewSlots & ({
|
|
30
|
+
readonly details?: never;
|
|
31
|
+
readonly detailsLabel?: never;
|
|
32
|
+
} | {
|
|
33
|
+
readonly details: ComponentChildren;
|
|
34
|
+
readonly detailsLabel: string;
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* One primary view, an overt status and a closed technical disclosure. The
|
|
38
|
+
* outer MCP surface supplies the frame. The viewer owns every value and label.
|
|
39
|
+
*/
|
|
40
|
+
export declare function FocusedView({ label, primary, status, details, detailsLabel, hostContext, layout: forced, className, }: FocusedViewProps): JSX.Element;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=focused-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focused-view.d.ts","sourceRoot":"","sources":["../../../src/src/preact/focused-view.tsx"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,iFAAiF;AAEjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAErD,OAAO,KAAK,EAAE,eA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1B,KAAK,EACL,OAAO,EACP,MAAM,EACN,OAAO,EACP,YAAY,EACZ,WAAW,EACX,MAAM,EAAE,MAAM,EACd,SAAS,GACV,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAkBhC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Disclosure = Disclosure;
|
|
4
|
+
exports.FocusedView = FocusedView;
|
|
5
|
+
const jsx_runtime_1 = require("preact/jsx-runtime");
|
|
6
|
+
const hooks_js_1 = require("../layout/hooks.js");
|
|
7
|
+
/** Native keyboard and disclosure semantics; never hides a caller's critical status by itself. */
|
|
8
|
+
function Disclosure({ label, children, open, onToggle, className, }) {
|
|
9
|
+
return ((0, jsx_runtime_1.jsxs)("details", { class: classes("mcp-view-disclosure", className), open: open, onToggle: onToggle ? (event) => onToggle(event.currentTarget.open) : undefined, children: [(0, jsx_runtime_1.jsx)("summary", { class: "mcp-view-disclosure-summary", children: label }), (0, jsx_runtime_1.jsx)("div", { class: "mcp-view-disclosure-body", children: children })] }));
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* One primary view, an overt status and a closed technical disclosure. The
|
|
13
|
+
* outer MCP surface supplies the frame. The viewer owns every value and label.
|
|
14
|
+
*/
|
|
15
|
+
function FocusedView({ label, primary, status, details, detailsLabel, hostContext, layout: forced, className, }) {
|
|
16
|
+
const { ref, layout, boundsStyle } = (0, hooks_js_1.useViewerLayout)(hostContext, { forced });
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, role: "group", "aria-label": label, class: classes("mcp-view-focused-view", className), "data-layout": layout, style: boundsStyle, children: [isPresent(status) && (0, jsx_runtime_1.jsx)("div", { class: "mcp-view-focused-status", children: status }), (0, jsx_runtime_1.jsx)("div", { class: "mcp-view-focused-primary", children: primary }), isPresent(details) && detailsLabel !== undefined && ((0, jsx_runtime_1.jsx)(Disclosure, { label: detailsLabel, children: details }))] }));
|
|
18
|
+
}
|
|
19
|
+
function isPresent(value) {
|
|
20
|
+
return value !== undefined && value !== null && value !== false;
|
|
21
|
+
}
|
|
22
|
+
function classes(...values) {
|
|
23
|
+
return values.filter(Boolean).join(" ");
|
|
24
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Preact integration for `@mcpview/components` surfaces. */
|
|
2
|
+
export { definePreactComponent, preactSurfaceRenderer, startPreactSurfaceApp, SurfaceAppError, } from "./surface.js";
|
|
3
|
+
export { ArtifactRow, Badge, BadgeGroup, Button, Card, CodeBlock, CollectionCard, CrossSelection, DataTable, Disclosure, DrillHint, ElementBody, ElementIdent, ElementLimit, ElementProvenance, ElementReading, ElementSection, ElementVerdict, EmptyState, FocusedView, InlineCode, IntervalPlot, KeyValueList, LimitGauge, Message, Metric, MetricGrid, NoticeGroup, PATH_BAR_DEFAULT_MAX_VISIBLE, PathBar, renderStatusMessage, Row, SemanticElement, SemanticList, SeriesChart, Skeleton, Slot3D, Sparkline, Stack, StaleBanner, StateMessage, TextInput, Toolbar, TreeList, TypeBadge, } from "../../preact-components.js";
|
|
4
|
+
export type { PreactComponentRenderer, PreactSurfaceAppOptions, PreactSurfaceAppState, PreactSurfaceComponentProps, PreactSurfaceContext, SurfaceAppErrorCode, SurfaceAppHandle, SurfaceAppRuntime, SurfaceDisplayState, SurfaceHostAccess, SurfaceLabel, SurfaceMessageKind, SurfaceProjection, SurfaceStatus, SurfaceStatusTone, SurfaceToolResult, SurfaceViewerSession, } from "./surface.js";
|
|
5
|
+
export type { ArtifactFingerprint, ArtifactRowProps, ArtifactVerification, BadgeGroupProps, BadgeProps, ButtonProps, CardProps, CodeBlockProps, CollectionCardProps, CrossSelectionProps, DataTableColumn, DataTableProps, DisclosureProps, DrillHintDirection, DrillHintProps, ElementBodyProps, ElementIdentProps, ElementLimitProps, ElementProvenanceProps, ElementReadingProps, ElementSectionProps, ElementVerdictProps, EmptyStateProps, FocusedViewProps, InlineCodeProps, IntervalPlotInterval, IntervalPlotProps, KeyValueItem, KeyValueLayout, KeyValueListProps, LimitGaugeLimit, LimitGaugeProps, MessageProps, MetricGridProps, MetricItem, MetricProps, NoticeGroupProps, PathBarItem, PathBarProps, PresentationTone, RowProps, SemanticElementDensity, SemanticElementProps, SemanticListProps, SeriesChartCursor, SeriesChartProps, SeriesChartReadout, SeriesChartSeries, SeriesChartSummaryItem, SeriesChartTone, SeriesPoint, SkeletonProps, Slot3DProps, SparklineProps, StackProps, StaleBannerAction, StaleBannerProps, StateMessageProps, StatusMessageMount, TextInputProps, ToolbarProps, TreeListNode, TreeListProps, TypeBadgeProps, ViewKind, } from "../../preact-components.js";
|
|
6
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/src/preact/mod.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EACX,KAAK,EACL,UAAU,EACV,MAAM,EACN,IAAI,EACJ,SAAS,EACT,cAAc,EACd,cAAc,EACd,SAAS,EACT,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,UAAU,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,OAAO,EACP,MAAM,EACN,UAAU,EACV,WAAW,EACX,4BAA4B,EAC5B,OAAO,EACP,mBAAmB,EACnB,GAAG,EACH,eAAe,EACf,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,WAAW,EACX,YAAY,EACZ,SAAS,EACT,OAAO,EACP,QAAQ,EACR,SAAS,GACV,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,2BAA2B,EAC3B,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,UAAU,EACV,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,eAAe,EACf,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACR,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,aAAa,EACb,WAAW,EACX,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,cAAc,EACd,QAAQ,GACT,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Preact integration for `@mcpview/components` surfaces. */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TypeBadge = exports.TreeList = exports.Toolbar = exports.TextInput = exports.StateMessage = exports.StaleBanner = exports.Stack = exports.Sparkline = exports.Slot3D = exports.Skeleton = exports.SeriesChart = exports.SemanticList = exports.SemanticElement = exports.Row = exports.renderStatusMessage = exports.PathBar = exports.PATH_BAR_DEFAULT_MAX_VISIBLE = exports.NoticeGroup = exports.MetricGrid = exports.Metric = exports.Message = exports.LimitGauge = exports.KeyValueList = exports.IntervalPlot = exports.InlineCode = exports.FocusedView = exports.EmptyState = exports.ElementVerdict = exports.ElementSection = exports.ElementReading = exports.ElementProvenance = exports.ElementLimit = exports.ElementIdent = exports.ElementBody = exports.DrillHint = exports.Disclosure = exports.DataTable = exports.CrossSelection = exports.CollectionCard = exports.CodeBlock = exports.Card = exports.Button = exports.BadgeGroup = exports.Badge = exports.ArtifactRow = exports.SurfaceAppError = exports.startPreactSurfaceApp = exports.preactSurfaceRenderer = exports.definePreactComponent = void 0;
|
|
5
|
+
var surface_js_1 = require("./surface.js");
|
|
6
|
+
Object.defineProperty(exports, "definePreactComponent", { enumerable: true, get: function () { return surface_js_1.definePreactComponent; } });
|
|
7
|
+
Object.defineProperty(exports, "preactSurfaceRenderer", { enumerable: true, get: function () { return surface_js_1.preactSurfaceRenderer; } });
|
|
8
|
+
Object.defineProperty(exports, "startPreactSurfaceApp", { enumerable: true, get: function () { return surface_js_1.startPreactSurfaceApp; } });
|
|
9
|
+
Object.defineProperty(exports, "SurfaceAppError", { enumerable: true, get: function () { return surface_js_1.SurfaceAppError; } });
|
|
10
|
+
var preact_components_js_1 = require("../../preact-components.js");
|
|
11
|
+
Object.defineProperty(exports, "ArtifactRow", { enumerable: true, get: function () { return preact_components_js_1.ArtifactRow; } });
|
|
12
|
+
Object.defineProperty(exports, "Badge", { enumerable: true, get: function () { return preact_components_js_1.Badge; } });
|
|
13
|
+
Object.defineProperty(exports, "BadgeGroup", { enumerable: true, get: function () { return preact_components_js_1.BadgeGroup; } });
|
|
14
|
+
Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return preact_components_js_1.Button; } });
|
|
15
|
+
Object.defineProperty(exports, "Card", { enumerable: true, get: function () { return preact_components_js_1.Card; } });
|
|
16
|
+
Object.defineProperty(exports, "CodeBlock", { enumerable: true, get: function () { return preact_components_js_1.CodeBlock; } });
|
|
17
|
+
Object.defineProperty(exports, "CollectionCard", { enumerable: true, get: function () { return preact_components_js_1.CollectionCard; } });
|
|
18
|
+
Object.defineProperty(exports, "CrossSelection", { enumerable: true, get: function () { return preact_components_js_1.CrossSelection; } });
|
|
19
|
+
Object.defineProperty(exports, "DataTable", { enumerable: true, get: function () { return preact_components_js_1.DataTable; } });
|
|
20
|
+
Object.defineProperty(exports, "Disclosure", { enumerable: true, get: function () { return preact_components_js_1.Disclosure; } });
|
|
21
|
+
Object.defineProperty(exports, "DrillHint", { enumerable: true, get: function () { return preact_components_js_1.DrillHint; } });
|
|
22
|
+
Object.defineProperty(exports, "ElementBody", { enumerable: true, get: function () { return preact_components_js_1.ElementBody; } });
|
|
23
|
+
Object.defineProperty(exports, "ElementIdent", { enumerable: true, get: function () { return preact_components_js_1.ElementIdent; } });
|
|
24
|
+
Object.defineProperty(exports, "ElementLimit", { enumerable: true, get: function () { return preact_components_js_1.ElementLimit; } });
|
|
25
|
+
Object.defineProperty(exports, "ElementProvenance", { enumerable: true, get: function () { return preact_components_js_1.ElementProvenance; } });
|
|
26
|
+
Object.defineProperty(exports, "ElementReading", { enumerable: true, get: function () { return preact_components_js_1.ElementReading; } });
|
|
27
|
+
Object.defineProperty(exports, "ElementSection", { enumerable: true, get: function () { return preact_components_js_1.ElementSection; } });
|
|
28
|
+
Object.defineProperty(exports, "ElementVerdict", { enumerable: true, get: function () { return preact_components_js_1.ElementVerdict; } });
|
|
29
|
+
Object.defineProperty(exports, "EmptyState", { enumerable: true, get: function () { return preact_components_js_1.EmptyState; } });
|
|
30
|
+
Object.defineProperty(exports, "FocusedView", { enumerable: true, get: function () { return preact_components_js_1.FocusedView; } });
|
|
31
|
+
Object.defineProperty(exports, "InlineCode", { enumerable: true, get: function () { return preact_components_js_1.InlineCode; } });
|
|
32
|
+
Object.defineProperty(exports, "IntervalPlot", { enumerable: true, get: function () { return preact_components_js_1.IntervalPlot; } });
|
|
33
|
+
Object.defineProperty(exports, "KeyValueList", { enumerable: true, get: function () { return preact_components_js_1.KeyValueList; } });
|
|
34
|
+
Object.defineProperty(exports, "LimitGauge", { enumerable: true, get: function () { return preact_components_js_1.LimitGauge; } });
|
|
35
|
+
Object.defineProperty(exports, "Message", { enumerable: true, get: function () { return preact_components_js_1.Message; } });
|
|
36
|
+
Object.defineProperty(exports, "Metric", { enumerable: true, get: function () { return preact_components_js_1.Metric; } });
|
|
37
|
+
Object.defineProperty(exports, "MetricGrid", { enumerable: true, get: function () { return preact_components_js_1.MetricGrid; } });
|
|
38
|
+
Object.defineProperty(exports, "NoticeGroup", { enumerable: true, get: function () { return preact_components_js_1.NoticeGroup; } });
|
|
39
|
+
Object.defineProperty(exports, "PATH_BAR_DEFAULT_MAX_VISIBLE", { enumerable: true, get: function () { return preact_components_js_1.PATH_BAR_DEFAULT_MAX_VISIBLE; } });
|
|
40
|
+
Object.defineProperty(exports, "PathBar", { enumerable: true, get: function () { return preact_components_js_1.PathBar; } });
|
|
41
|
+
Object.defineProperty(exports, "renderStatusMessage", { enumerable: true, get: function () { return preact_components_js_1.renderStatusMessage; } });
|
|
42
|
+
Object.defineProperty(exports, "Row", { enumerable: true, get: function () { return preact_components_js_1.Row; } });
|
|
43
|
+
Object.defineProperty(exports, "SemanticElement", { enumerable: true, get: function () { return preact_components_js_1.SemanticElement; } });
|
|
44
|
+
Object.defineProperty(exports, "SemanticList", { enumerable: true, get: function () { return preact_components_js_1.SemanticList; } });
|
|
45
|
+
Object.defineProperty(exports, "SeriesChart", { enumerable: true, get: function () { return preact_components_js_1.SeriesChart; } });
|
|
46
|
+
Object.defineProperty(exports, "Skeleton", { enumerable: true, get: function () { return preact_components_js_1.Skeleton; } });
|
|
47
|
+
Object.defineProperty(exports, "Slot3D", { enumerable: true, get: function () { return preact_components_js_1.Slot3D; } });
|
|
48
|
+
Object.defineProperty(exports, "Sparkline", { enumerable: true, get: function () { return preact_components_js_1.Sparkline; } });
|
|
49
|
+
Object.defineProperty(exports, "Stack", { enumerable: true, get: function () { return preact_components_js_1.Stack; } });
|
|
50
|
+
Object.defineProperty(exports, "StaleBanner", { enumerable: true, get: function () { return preact_components_js_1.StaleBanner; } });
|
|
51
|
+
Object.defineProperty(exports, "StateMessage", { enumerable: true, get: function () { return preact_components_js_1.StateMessage; } });
|
|
52
|
+
Object.defineProperty(exports, "TextInput", { enumerable: true, get: function () { return preact_components_js_1.TextInput; } });
|
|
53
|
+
Object.defineProperty(exports, "Toolbar", { enumerable: true, get: function () { return preact_components_js_1.Toolbar; } });
|
|
54
|
+
Object.defineProperty(exports, "TreeList", { enumerable: true, get: function () { return preact_components_js_1.TreeList; } });
|
|
55
|
+
Object.defineProperty(exports, "TypeBadge", { enumerable: true, get: function () { return preact_components_js_1.TypeBadge; } });
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/** @jsxImportSource preact */
|
|
2
|
+
/**
|
|
3
|
+
* Data marks for recorded numeric evidence.
|
|
4
|
+
*
|
|
5
|
+
* Every plot draws exactly the samples, bounds, and wording the caller passes.
|
|
6
|
+
* None of them resamples, interpolates a missing point, formats a number, picks
|
|
7
|
+
* a unit, derives an extremum, or owns pointer state: a cursor is declared by
|
|
8
|
+
* the provider that already resolved the reading behind it.
|
|
9
|
+
*/
|
|
10
|
+
import type { JSX } from "preact";
|
|
11
|
+
import type { PresentationTone } from "./components.js";
|
|
12
|
+
/** Plot colors, including the two categorical theme colors. */
|
|
13
|
+
export type SeriesChartTone = PresentationTone | "accent" | "brand";
|
|
14
|
+
export interface SparklineProps {
|
|
15
|
+
/** Accessible name of the sampled quantity. */
|
|
16
|
+
readonly label: string;
|
|
17
|
+
/** At least two finite samples, already ordered by the caller. */
|
|
18
|
+
readonly values: readonly number[];
|
|
19
|
+
/** Caller-formatted summary, including units. */
|
|
20
|
+
readonly summaryLabel: string;
|
|
21
|
+
/** Inline mark by default; block also displays the supplied label and summary. */
|
|
22
|
+
readonly variant?: "inline" | "block";
|
|
23
|
+
readonly tone?: SeriesChartTone;
|
|
24
|
+
readonly className?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Compact shape of one recorded series, readable at chip and row density. */
|
|
27
|
+
export declare function Sparkline({ label, values, summaryLabel, variant, tone, className, }: SparklineProps): JSX.Element;
|
|
28
|
+
export interface SeriesPoint {
|
|
29
|
+
readonly x: number;
|
|
30
|
+
readonly y: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* How one series may be drawn.
|
|
34
|
+
*
|
|
35
|
+
* `line` connects consecutive samples, which asserts the quantity existed
|
|
36
|
+
* between them — only true when the series is sampled densely enough for that
|
|
37
|
+
* claim to hold. `bar` draws each recorded sample on its own and claims nothing
|
|
38
|
+
* in between. The provider knows its sampling, so it declares the mark; the
|
|
39
|
+
* chart never infers one from point spacing.
|
|
40
|
+
*/
|
|
41
|
+
export type SeriesMark = "line" | "bar";
|
|
42
|
+
export interface SeriesChartSeries {
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly label: string;
|
|
45
|
+
/** Declared, never inferred. A sparse series drawn as a line invents values. */
|
|
46
|
+
readonly mark: SeriesMark;
|
|
47
|
+
/** At least two finite points, already ordered by the caller. */
|
|
48
|
+
readonly points: readonly SeriesPoint[];
|
|
49
|
+
readonly tone?: SeriesChartTone;
|
|
50
|
+
}
|
|
51
|
+
export interface SeriesChartReadout {
|
|
52
|
+
/** Must name one declared series. */
|
|
53
|
+
readonly seriesId: string;
|
|
54
|
+
/** Caller-formatted value at the cursor, including units. */
|
|
55
|
+
readonly valueLabel: string;
|
|
56
|
+
}
|
|
57
|
+
export interface SeriesChartCursor {
|
|
58
|
+
/** Position on the shared x scale. The chart resolves nothing itself. */
|
|
59
|
+
readonly x: number;
|
|
60
|
+
/** Caller-formatted position, such as an instant. */
|
|
61
|
+
readonly label: string;
|
|
62
|
+
/**
|
|
63
|
+
* Values the provider actually recorded at that position. A series with no
|
|
64
|
+
* sample there is simply absent: the chart never interpolates between two
|
|
65
|
+
* samples, never snaps to a neighbour, and never fills a gap to look complete.
|
|
66
|
+
*/
|
|
67
|
+
readonly readouts: readonly SeriesChartReadout[];
|
|
68
|
+
}
|
|
69
|
+
export interface SeriesChartSummaryItem {
|
|
70
|
+
readonly id: string;
|
|
71
|
+
/** Caller wording for the extremum, such as min, max, or final. */
|
|
72
|
+
readonly label: string;
|
|
73
|
+
/** Caller-formatted value, including units and where it occurred. */
|
|
74
|
+
readonly valueLabel: string;
|
|
75
|
+
}
|
|
76
|
+
export interface SeriesChartProps {
|
|
77
|
+
/** Accessible name of the chart. */
|
|
78
|
+
readonly label: string;
|
|
79
|
+
readonly series: readonly SeriesChartSeries[];
|
|
80
|
+
readonly xMin: number;
|
|
81
|
+
readonly xMax: number;
|
|
82
|
+
readonly yMin: number;
|
|
83
|
+
readonly yMax: number;
|
|
84
|
+
/** Show caller-labelled series keys when at least two series are present. */
|
|
85
|
+
readonly legend?: boolean;
|
|
86
|
+
/** Caller-formatted y ticks on the declared shared scale. */
|
|
87
|
+
readonly yTicks?: readonly {
|
|
88
|
+
readonly value: number;
|
|
89
|
+
readonly label: string;
|
|
90
|
+
}[];
|
|
91
|
+
/** Caller-formatted ticks, left to right. */
|
|
92
|
+
readonly axisLabels?: readonly string[];
|
|
93
|
+
/** Caller-computed extrema. The chart never scans the samples for them. */
|
|
94
|
+
readonly summary?: readonly SeriesChartSummaryItem[];
|
|
95
|
+
/** Declared cursor. Omit it and the chart shows no readout. */
|
|
96
|
+
readonly cursor?: SeriesChartCursor;
|
|
97
|
+
/**
|
|
98
|
+
* Pointer position on the shared x scale, or `undefined` once the pointer
|
|
99
|
+
* leaves. The chart reports screen geometry only; which recorded sample that
|
|
100
|
+
* position corresponds to — or that none does — stays the provider's call.
|
|
101
|
+
*/
|
|
102
|
+
readonly onScrub?: (x: number | undefined) => void;
|
|
103
|
+
readonly className?: string;
|
|
104
|
+
}
|
|
105
|
+
/** Multi-series plot on one shared finite scale, with a declared cursor readout. */
|
|
106
|
+
export declare function SeriesChart({ label, series, xMin, xMax, yMin, yMax, axisLabels, legend, yTicks, summary, cursor, onScrub, className, }: SeriesChartProps): JSX.Element;
|
|
107
|
+
export interface IntervalPlotInterval {
|
|
108
|
+
readonly id: string;
|
|
109
|
+
/** Caller wording for the interval, such as a tolerance class. */
|
|
110
|
+
readonly label: string;
|
|
111
|
+
readonly lower: number;
|
|
112
|
+
readonly upper: number;
|
|
113
|
+
/** Caller-formatted deviations, including units. */
|
|
114
|
+
readonly lowerLabel: string;
|
|
115
|
+
readonly upperLabel: string;
|
|
116
|
+
readonly tone?: PresentationTone;
|
|
117
|
+
}
|
|
118
|
+
export interface IntervalPlotProps {
|
|
119
|
+
/** Accessible name of the plot. */
|
|
120
|
+
readonly label: string;
|
|
121
|
+
readonly min: number;
|
|
122
|
+
readonly max: number;
|
|
123
|
+
/** Caller wording for the zero reference, such as the nominal size. */
|
|
124
|
+
readonly zeroLabel: string;
|
|
125
|
+
readonly intervals: readonly IntervalPlotInterval[];
|
|
126
|
+
readonly className?: string;
|
|
127
|
+
}
|
|
128
|
+
/** Caller-declared deviation intervals laid out against a shared zero line. */
|
|
129
|
+
export declare function IntervalPlot({ label, min, max, zeroLabel, intervals, className, }: IntervalPlotProps): JSX.Element;
|
|
130
|
+
//# sourceMappingURL=plots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plots.d.ts","sourceRoot":"","sources":["../../../src/src/preact/plots.tsx"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,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