@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,283 @@
|
|
|
1
|
+
/** Renderer-neutral component catalog and surface runtime for MCP Apps. */
|
|
2
|
+
import { CASYS_COMPONENT_CATALOG_CAPABILITY_KEY, readSurfaceContext, } from "@mcpview/contracts";
|
|
3
|
+
export { CASYS_COMPONENT_CATALOG_CAPABILITY_KEY, CASYS_SURFACE_CONTEXT_KEY, readSurfaceContext, } from "@mcpview/contracts";
|
|
4
|
+
export function defineViewComponent(definition) {
|
|
5
|
+
const descriptor = normalizedDescriptor(definition.descriptor);
|
|
6
|
+
if (typeof definition.mount !== "function") {
|
|
7
|
+
throw new TypeError("View component must declare a mount function");
|
|
8
|
+
}
|
|
9
|
+
return Object.freeze({ ...definition, descriptor });
|
|
10
|
+
}
|
|
11
|
+
export function defineComponentRegistry(registry) {
|
|
12
|
+
const entries = Object.entries(registry.components ?? {});
|
|
13
|
+
if (entries.length === 0) {
|
|
14
|
+
throw new TypeError("Component registry must declare at least one component");
|
|
15
|
+
}
|
|
16
|
+
for (const [id, component] of entries) {
|
|
17
|
+
validateComponentId(id, "Component registry key");
|
|
18
|
+
validateDescriptor(component.descriptor);
|
|
19
|
+
if (typeof component.mount !== "function") {
|
|
20
|
+
throw new TypeError(`Component ${JSON.stringify(id)} must declare a mount function`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const surface = registry.defaultSurface === undefined
|
|
24
|
+
? undefined
|
|
25
|
+
: defineComponentSurface(registry.defaultSurface);
|
|
26
|
+
if (surface) {
|
|
27
|
+
validateSurfaceComponents(surface, new Set(entries.map(([id]) => id)));
|
|
28
|
+
}
|
|
29
|
+
Object.freeze(registry.components);
|
|
30
|
+
return Object.freeze({
|
|
31
|
+
...registry,
|
|
32
|
+
...(surface ? { defaultSurface: surface } : {}),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export function defineComponentSurface(surface) {
|
|
36
|
+
validateLayout(surface?.layout);
|
|
37
|
+
if (!Array.isArray(surface?.components) || surface.components.length === 0) {
|
|
38
|
+
throw new TypeError("Component surface must contain at least one component");
|
|
39
|
+
}
|
|
40
|
+
const instanceIds = new Set();
|
|
41
|
+
const components = surface.components.map((item) => {
|
|
42
|
+
validateComponentId(item.id, "Surface component id");
|
|
43
|
+
validateComponentId(item.component, "Surface component key");
|
|
44
|
+
if (instanceIds.has(item.id)) {
|
|
45
|
+
throw new TypeError(`Duplicate surface component id ${JSON.stringify(item.id)}`);
|
|
46
|
+
}
|
|
47
|
+
instanceIds.add(item.id);
|
|
48
|
+
if (item.area !== undefined && !/^[A-Za-z][A-Za-z0-9_-]*$/.test(item.area)) {
|
|
49
|
+
throw new TypeError(`Invalid surface grid area ${JSON.stringify(item.area)}`);
|
|
50
|
+
}
|
|
51
|
+
if (item.props !== undefined)
|
|
52
|
+
validateJsonValue(item.props, `props for ${item.id}`);
|
|
53
|
+
return Object.freeze({
|
|
54
|
+
...item,
|
|
55
|
+
...(item.props ? { props: Object.freeze({ ...item.props }) } : {}),
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
return Object.freeze({
|
|
59
|
+
layout: Object.freeze({ ...surface.layout }),
|
|
60
|
+
components: Object.freeze(components),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/** Build the serializable value advertised in `AppConfig.capabilities.experimental`. */
|
|
64
|
+
export function componentCatalogCapabilities(registry) {
|
|
65
|
+
return {
|
|
66
|
+
[CASYS_COMPONENT_CATALOG_CAPABILITY_KEY]: advertisedComponentCatalog(registry),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export function advertisedComponentCatalog(registry) {
|
|
70
|
+
const components = Object.fromEntries(Object.entries(registry.components).map(([id, definition]) => [
|
|
71
|
+
id,
|
|
72
|
+
normalizedDescriptor(definition.descriptor),
|
|
73
|
+
]));
|
|
74
|
+
return Object.freeze({
|
|
75
|
+
components: Object.freeze(components),
|
|
76
|
+
...(registry.defaultSurface ? { defaultSurface: registry.defaultSurface } : {}),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/** Expose only surface identity/status for CSS and diagnostics, never component internals. */
|
|
80
|
+
export function applySurfaceContext(hostContext, target) {
|
|
81
|
+
const surface = readSurfaceContext(hostContext);
|
|
82
|
+
assignDataset(target.dataset, "casysSurfaceInstance", surface?.instanceId);
|
|
83
|
+
assignDataset(target.dataset, "casysSurfaceStatus", surface?.status);
|
|
84
|
+
assignDataset(target.dataset, "casysSurfaceSource", surface?.source);
|
|
85
|
+
}
|
|
86
|
+
export function activeComponentSurface(registry, hostContext) {
|
|
87
|
+
const context = readSurfaceContext(hostContext);
|
|
88
|
+
return context?.status === "ready" && context.surface
|
|
89
|
+
? defineComponentSurface(context.surface)
|
|
90
|
+
: registry.defaultSurface;
|
|
91
|
+
}
|
|
92
|
+
/** Mount one declarative surface and return deterministic aggregate cleanup. */
|
|
93
|
+
export async function mountComponentSurface(options) {
|
|
94
|
+
const selected = options.surface ??
|
|
95
|
+
activeComponentSurface(options.registry, options.hostContext);
|
|
96
|
+
if (!selected) {
|
|
97
|
+
throw new TypeError("Component-only App requires a host-selected surface");
|
|
98
|
+
}
|
|
99
|
+
const surface = defineComponentSurface(selected);
|
|
100
|
+
validateSurfaceComponents(surface, new Set(Object.keys(options.registry.components)));
|
|
101
|
+
const container = document.createElement("div");
|
|
102
|
+
container.className = `mcp-view-surface mcp-view-surface-${surface.layout.type}`;
|
|
103
|
+
container.dataset.surfaceLayout = surface.layout.type;
|
|
104
|
+
applySurfaceLayout(container, surface.layout);
|
|
105
|
+
const cleanups = [];
|
|
106
|
+
try {
|
|
107
|
+
for (const item of surface.components) {
|
|
108
|
+
const definition = options.registry.components[item.component];
|
|
109
|
+
const slot = document.createElement("section");
|
|
110
|
+
slot.className = "mcp-view-component";
|
|
111
|
+
slot.dataset.component = item.component;
|
|
112
|
+
slot.dataset.componentId = item.id;
|
|
113
|
+
if (item.area)
|
|
114
|
+
slot.style.gridArea = item.area;
|
|
115
|
+
container.append(slot);
|
|
116
|
+
const cleanup = await definition.mount(slot, {
|
|
117
|
+
data: options.data,
|
|
118
|
+
props: item.props ?? {},
|
|
119
|
+
instanceId: item.id,
|
|
120
|
+
appContext: options.appContext,
|
|
121
|
+
hostContext: options.hostContext,
|
|
122
|
+
});
|
|
123
|
+
if (typeof cleanup === "function")
|
|
124
|
+
cleanups.push(cleanup);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
await disposeAll(cleanups);
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
131
|
+
options.root.replaceChildren(container);
|
|
132
|
+
let disposed = false;
|
|
133
|
+
return {
|
|
134
|
+
surface,
|
|
135
|
+
async dispose() {
|
|
136
|
+
if (disposed)
|
|
137
|
+
return;
|
|
138
|
+
disposed = true;
|
|
139
|
+
await disposeAll(cleanups);
|
|
140
|
+
if (container.parentNode === options.root)
|
|
141
|
+
options.root.replaceChildren();
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function applySurfaceLayout(target, layout) {
|
|
146
|
+
const gaps = {
|
|
147
|
+
none: "0",
|
|
148
|
+
xs: "0.25rem",
|
|
149
|
+
sm: "0.5rem",
|
|
150
|
+
md: "1rem",
|
|
151
|
+
lg: "1.5rem",
|
|
152
|
+
};
|
|
153
|
+
target.style.display = "grid";
|
|
154
|
+
// Stacked components are separated by the theme's hairlines; rows and grids keep a gap.
|
|
155
|
+
target.style.gap = gaps[layout.gap ?? (layout.type === "stack" ? "none" : "md")];
|
|
156
|
+
target.style.minWidth = "0";
|
|
157
|
+
if (layout.type === "row") {
|
|
158
|
+
target.style.gridAutoFlow = "column";
|
|
159
|
+
target.style.gridAutoColumns = "minmax(0, 1fr)";
|
|
160
|
+
}
|
|
161
|
+
else if (layout.type === "grid") {
|
|
162
|
+
target.style.gridTemplateColumns = `repeat(${layout.columns ?? 2}, minmax(0, 1fr))`;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
target.style.gridTemplateColumns = "minmax(0, 1fr)";
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function validateLayout(layout) {
|
|
169
|
+
if (!layout || !["stack", "row", "grid"].includes(layout.type)) {
|
|
170
|
+
throw new TypeError("Surface layout type must be stack, row, or grid");
|
|
171
|
+
}
|
|
172
|
+
if (layout.columns !== undefined &&
|
|
173
|
+
(!Number.isInteger(layout.columns) || layout.columns < 1 || layout.columns > 12)) {
|
|
174
|
+
throw new TypeError("Surface grid columns must be an integer from 1 to 12");
|
|
175
|
+
}
|
|
176
|
+
if (layout.type !== "grid" && layout.columns !== undefined) {
|
|
177
|
+
throw new TypeError("Surface columns are valid only for grid layouts");
|
|
178
|
+
}
|
|
179
|
+
if (layout.gap !== undefined && !["none", "xs", "sm", "md", "lg"].includes(layout.gap)) {
|
|
180
|
+
throw new TypeError("Surface gap must be none, xs, sm, md, or lg");
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function validateSurfaceComponents(surface, known) {
|
|
184
|
+
const missing = [
|
|
185
|
+
...new Set(surface.components
|
|
186
|
+
.map((item) => item.component)
|
|
187
|
+
.filter((component) => !known.has(component))),
|
|
188
|
+
];
|
|
189
|
+
if (missing.length > 0) {
|
|
190
|
+
throw new TypeError(`Unknown surface components: ${missing.join(", ")}`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function validateDescriptor(descriptor) {
|
|
194
|
+
if (!descriptor || typeof descriptor.title !== "string" || !descriptor.title.trim()) {
|
|
195
|
+
throw new TypeError("View component descriptor must have a non-empty title");
|
|
196
|
+
}
|
|
197
|
+
if (descriptor.description !== undefined && typeof descriptor.description !== "string") {
|
|
198
|
+
throw new TypeError("View component description must be a string");
|
|
199
|
+
}
|
|
200
|
+
validateEventPorts(descriptor.events);
|
|
201
|
+
}
|
|
202
|
+
function normalizedDescriptor(descriptor) {
|
|
203
|
+
validateDescriptor(descriptor);
|
|
204
|
+
const events = descriptor.events === undefined ? undefined : Object.freeze({
|
|
205
|
+
...(descriptor.events.emits ? { emits: Object.freeze([...descriptor.events.emits]) } : {}),
|
|
206
|
+
...(descriptor.events.accepts
|
|
207
|
+
? { accepts: Object.freeze([...descriptor.events.accepts]) }
|
|
208
|
+
: {}),
|
|
209
|
+
});
|
|
210
|
+
return Object.freeze({
|
|
211
|
+
title: descriptor.title,
|
|
212
|
+
...(descriptor.description !== undefined ? { description: descriptor.description } : {}),
|
|
213
|
+
...(events ? { events } : {}),
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function validateEventPorts(ports) {
|
|
217
|
+
if (ports === undefined)
|
|
218
|
+
return;
|
|
219
|
+
if (!ports || typeof ports !== "object" || Array.isArray(ports)) {
|
|
220
|
+
throw new TypeError("View component events must be an object");
|
|
221
|
+
}
|
|
222
|
+
validateEventNames(ports.emits, "emits");
|
|
223
|
+
validateEventNames(ports.accepts, "accepts");
|
|
224
|
+
}
|
|
225
|
+
function validateEventNames(names, field) {
|
|
226
|
+
if (names === undefined)
|
|
227
|
+
return;
|
|
228
|
+
if (!Array.isArray(names)) {
|
|
229
|
+
throw new TypeError(`View component ${field} must be an array`);
|
|
230
|
+
}
|
|
231
|
+
const seen = new Set();
|
|
232
|
+
for (const name of names) {
|
|
233
|
+
if (typeof name !== "string" || !name.trim()) {
|
|
234
|
+
throw new TypeError(`View component ${field} names must be non-empty strings`);
|
|
235
|
+
}
|
|
236
|
+
if (seen.has(name)) {
|
|
237
|
+
throw new TypeError(`Duplicate View component ${field} name ${JSON.stringify(name)}`);
|
|
238
|
+
}
|
|
239
|
+
seen.add(name);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function validateComponentId(value, label) {
|
|
243
|
+
if (typeof value !== "string" || !/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/.test(value)) {
|
|
244
|
+
throw new TypeError(`${label} is invalid: ${JSON.stringify(value)}`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
function validateJsonValue(value, label) {
|
|
248
|
+
if (value === null || typeof value === "string" || typeof value === "boolean" ||
|
|
249
|
+
(typeof value === "number" && Number.isFinite(value)))
|
|
250
|
+
return;
|
|
251
|
+
if (Array.isArray(value)) {
|
|
252
|
+
for (const entry of value)
|
|
253
|
+
validateJsonValue(entry, label);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
if (value && typeof value === "object") {
|
|
257
|
+
for (const entry of Object.values(value))
|
|
258
|
+
validateJsonValue(entry, label);
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
throw new TypeError(`${label} must contain only JSON values`);
|
|
262
|
+
}
|
|
263
|
+
async function disposeAll(cleanups) {
|
|
264
|
+
const errors = [];
|
|
265
|
+
for (const cleanup of [...cleanups].reverse()) {
|
|
266
|
+
try {
|
|
267
|
+
await cleanup();
|
|
268
|
+
}
|
|
269
|
+
catch (error) {
|
|
270
|
+
errors.push(error);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (errors.length === 1)
|
|
274
|
+
throw errors[0];
|
|
275
|
+
if (errors.length > 1)
|
|
276
|
+
throw new AggregateError(errors, "Component cleanup failed");
|
|
277
|
+
}
|
|
278
|
+
function assignDataset(dataset, key, value) {
|
|
279
|
+
if (value === undefined)
|
|
280
|
+
delete dataset[key];
|
|
281
|
+
else
|
|
282
|
+
dataset[key] = value;
|
|
283
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** The families the shared theme names first; the generator and the entry share them. */
|
|
2
|
+
export interface McpViewFontFamily {
|
|
3
|
+
/** Family name as the theme's font stacks quote it. */
|
|
4
|
+
readonly family: string;
|
|
5
|
+
/** Variable weight range the embedded face covers, css2 syntax. */
|
|
6
|
+
readonly weights: `${number}..${number}`;
|
|
7
|
+
/** Theme role the family is the first choice for. */
|
|
8
|
+
readonly role: "heading" | "body" | "mono";
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The three families `MCP_VIEW_THEME_CSS` names first in its stacks. The theme
|
|
12
|
+
* falls back to system faces without them; embedding is what keeps a viewer
|
|
13
|
+
* rendering the same inside a host iframe with no network or a strict CSP.
|
|
14
|
+
*/
|
|
15
|
+
export declare const MCP_VIEW_FONT_FAMILIES: readonly McpViewFontFamily[];
|
|
16
|
+
//# sourceMappingURL=font-families.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-families.d.ts","sourceRoot":"","sources":["../../src/src/font-families.ts"],"names":[],"mappings":"AAAA,yFAAyF;AAEzF,MAAM,WAAW,iBAAiB;IAChC,uDAAuD;IACvD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,GAAG,MAAM,KAAK,MAAM,EAAE,CAAC;IACzC,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;CAC5C;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,iBAAiB,EAI9D,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** The families the shared theme names first; the generator and the entry share them. */
|
|
2
|
+
/**
|
|
3
|
+
* The three families `MCP_VIEW_THEME_CSS` names first in its stacks. The theme
|
|
4
|
+
* falls back to system faces without them; embedding is what keeps a viewer
|
|
5
|
+
* rendering the same inside a host iframe with no network or a strict CSP.
|
|
6
|
+
*/
|
|
7
|
+
export const MCP_VIEW_FONT_FAMILIES = [
|
|
8
|
+
{ family: "Space Grotesk", weights: "500..600", role: "heading" },
|
|
9
|
+
{ family: "Work Sans", weights: "400..500", role: "body" },
|
|
10
|
+
{ family: "JetBrains Mono", weights: "400..600", role: "mono" },
|
|
11
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fonts-data.d.ts","sourceRoot":"","sources":["../../src/src/fonts-data.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB,EAAE,MAwChC,CAAC"}
|