@mcpview/components 0.12.1 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -265,6 +265,17 @@ Use `Disclosure` on its own for an inline technical section: `label` is supplied
265
265
  `FocusedView` requires a `detailsLabel` whenever it receives `details`; omit both to render no
266
266
  technical control. Keep consequential state in `status` or `primary`.
267
267
 
268
+ ## Saved snippet library
269
+
270
+ Import `SnippetLibrary` from `@mcpview/components/preact/components`. Supply the snippet summaries
271
+ as `entries` and localized text as `labels`. The library filters names and descriptions locally. Use
272
+ `onInspect(entry)` to fetch the selected source, then pass it as `source` to show the program as
273
+ selectable text. Set `source.language` to `"javascript"` for syntax highlighting. Clear `source` in
274
+ `onBack` to return to the list.
275
+
276
+ The App owns the catalog calls and can provide navigation next to the library title through
277
+ `headerAction`. The component uses the package's existing theme styles.
278
+
268
279
  ## Theme
269
280
 
270
281
  `installMcpViewTheme()` installs the shared CSS once. The defaults are light-first and include an
@@ -586,7 +597,7 @@ local checkout); the `/surface` entry is derived from the latter unless
586
597
  `MCP_VIEW_COMPONENTS_SURFACE_MODULE` names it. Run the generator from JSR:
587
598
 
588
599
  ```sh
589
- deno run -A jsr:@mcpview/components@0.12.1/scaffold result-viewer ./result-viewer
600
+ deno run -A jsr:@mcpview/components@0.13.1/scaffold result-viewer ./result-viewer
590
601
  ```
591
602
 
592
603
  The npm package contains only the runtime and presentation entry points. It does not export or ship
@@ -19,4 +19,6 @@ export { CollectionCard, ElementBody, ElementIdent, ElementLimit, ElementProvena
19
19
  export type { CollectionCardProps, ElementBodyProps, ElementIdentProps, ElementLimitProps, ElementProvenanceProps, ElementReadingProps, ElementSectionProps, ElementVerdictProps, SemanticElementDensity, SemanticElementProps, SemanticListProps, } from "./src/preact/semantic-element.js";
20
20
  export { Disclosure, FocusedView } from "./src/preact/focused-view.js";
21
21
  export type { DisclosureProps, FocusedViewProps } from "./src/preact/focused-view.js";
22
+ export { SnippetLibrary } from "./src/preact/snippet-library.js";
23
+ export type { SnippetLibraryEntry, SnippetLibraryLabels, SnippetLibraryProps, SnippetLibrarySource, } from "./src/preact/snippet-library.js";
22
24
  //# sourceMappingURL=preact-components.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"preact-components.d.ts","sourceRoot":"","sources":["../src/preact-components.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,qBAAqB,CAAC;AAG7B,OAAO,EACL,KAAK,EACL,UAAU,EACV,MAAM,EACN,IAAI,EACJ,SAAS,EACT,cAAc,EACd,SAAS,EACT,UAAU,EACV,UAAU,EACV,YAAY,EACZ,OAAO,EACP,MAAM,EACN,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,GAAG,EACH,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,SAAS,EACT,OAAO,GACR,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,eAAe,EACf,UAAU,EACV,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,eAAe,EACf,eAAe,EACf,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,YAAY,GACb,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,WAAW,EACX,SAAS,EACT,UAAU,EACV,4BAA4B,EAC5B,OAAO,EACP,MAAM,EACN,WAAW,EACX,QAAQ,EACR,SAAS,GACV,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,eAAe,EACf,WAAW,EACX,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,QAAQ,GACT,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC7E,YAAY,EACV,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,cAAc,GACf,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,GACb,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACvE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"preact-components.d.ts","sourceRoot":"","sources":["../src/preact-components.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,qBAAqB,CAAC;AAG7B,OAAO,EACL,KAAK,EACL,UAAU,EACV,MAAM,EACN,IAAI,EACJ,SAAS,EACT,cAAc,EACd,SAAS,EACT,UAAU,EACV,UAAU,EACV,YAAY,EACZ,OAAO,EACP,MAAM,EACN,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,GAAG,EACH,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,SAAS,EACT,OAAO,GACR,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,eAAe,EACf,UAAU,EACV,WAAW,EACX,SAAS,EACT,cAA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ClB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACvE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEtF,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,iCAAiC,CAAC"}
@@ -14,6 +14,7 @@ export { ArtifactRow, DrillHint, LimitGauge, PATH_BAR_DEFAULT_MAX_VISIBLE, PathB
14
14
  export { IntervalPlot, SeriesChart, Sparkline } from "./src/preact/plots.js";
15
15
  export { CollectionCard, ElementBody, ElementIdent, ElementLimit, ElementProvenance, ElementReading, ElementSection, ElementVerdict, SemanticElement, SemanticList, } from "./src/preact/semantic-element.js";
16
16
  export { Disclosure, FocusedView } from "./src/preact/focused-view.js";
17
+ export { SnippetLibrary } from "./src/preact/snippet-library.js";
17
18
  // The stylesheet and its types ship from the package root with
18
19
  // `installMcpViewTheme`, never from this entry. Re-exporting them here handed
19
20
  // the whole sheet to every caller that only wanted one component: the theme is
@@ -1,6 +1,6 @@
1
1
  /** Preact integration for `@mcpview/components` surfaces. */
2
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";
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, SnippetLibrary, Sparkline, Stack, StaleBanner, StateMessage, TextInput, Toolbar, TreeList, TypeBadge, } from "../../preact-components.js";
4
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";
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, SnippetLibraryEntry, SnippetLibraryLabels, SnippetLibraryProps, SnippetLibrarySource, SparklineProps, StackProps, StaleBannerAction, StaleBannerProps, StateMessageProps, StatusMessageMount, TextInputProps, ToolbarProps, TreeListNode, TreeListProps, TypeBadgeProps, ViewKind, } from "../../preact-components.js";
6
6
  //# sourceMappingURL=mod.d.ts.map
@@ -1 +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,YA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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"}
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,cAAc,EACd,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,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,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"}
@@ -1,3 +1,3 @@
1
1
  /** Preact integration for `@mcpview/components` surfaces. */
2
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";
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, SnippetLibrary, Sparkline, Stack, StaleBanner, StateMessage, TextInput, Toolbar, TreeList, TypeBadge, } from "../../preact-components.js";
@@ -0,0 +1,10 @@
1
+ type Style = "comment" | "keyword" | "string" | "literal";
2
+ type Range = {
3
+ start: number;
4
+ end: number;
5
+ style: Style;
6
+ };
7
+ /** Offset ranges leave line endings, escape sequences and all other source text untouched. */
8
+ export declare function javascriptHighlightRanges(code: string): Range[];
9
+ export {};
10
+ //# sourceMappingURL=snippet-javascript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snippet-javascript.d.ts","sourceRoot":"","sources":["../../../src/src/preact/snippet-javascript.ts"],"names":[],"mappings":"AAEA,KAAK,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAC1D,KAAK,KAAK,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAuB1D,8FAA8F;AAC9F,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,EAAE,CAmB/D"}
@@ -0,0 +1,46 @@
1
+ import { parse, tokTypes } from "acorn";
2
+ function tokenStyle(type, text) {
3
+ switch (type) {
4
+ case tokTypes.string:
5
+ case tokTypes.regexp:
6
+ case tokTypes.template:
7
+ case tokTypes.invalidTemplate:
8
+ case tokTypes.backQuote:
9
+ return "string";
10
+ case tokTypes.num:
11
+ case tokTypes._null:
12
+ case tokTypes._true:
13
+ case tokTypes._false:
14
+ return "literal";
15
+ case tokTypes.name:
16
+ if (["async", "await", "let", "yield"].includes(text))
17
+ return "keyword";
18
+ return;
19
+ default:
20
+ if (type.keyword)
21
+ return "keyword";
22
+ }
23
+ }
24
+ /** Offset ranges leave line endings, escape sequences and all other source text untouched. */
25
+ export function javascriptHighlightRanges(code) {
26
+ const ranges = [];
27
+ try {
28
+ parse(code, {
29
+ ecmaVersion: "latest",
30
+ sourceType: "module",
31
+ allowReturnOutsideFunction: true,
32
+ onComment: (_block, _text, start, end) => {
33
+ ranges.push({ start, end, style: "comment" });
34
+ },
35
+ onToken: ({ type, start, end }) => {
36
+ const style = tokenStyle(type, code.slice(start, end));
37
+ if (style && start < end)
38
+ ranges.push({ start, end, style });
39
+ },
40
+ });
41
+ }
42
+ catch {
43
+ return [];
44
+ }
45
+ return ranges.sort((a, b) => a.start - b.start);
46
+ }
@@ -0,0 +1,37 @@
1
+ /** @jsxImportSource preact */
2
+ import type { ComponentChildren, JSX } from "preact";
3
+ export interface SnippetLibraryEntry {
4
+ /** Stable identifier passed back to the caller in onInspect. */
5
+ readonly id: string;
6
+ readonly name: string;
7
+ readonly description?: string;
8
+ }
9
+ export interface SnippetLibrarySource {
10
+ readonly name: string;
11
+ readonly description?: string;
12
+ readonly code: string;
13
+ /** Omit to display plain text. */
14
+ readonly language?: "javascript";
15
+ }
16
+ export interface SnippetLibraryLabels {
17
+ readonly title: string;
18
+ readonly search: string;
19
+ readonly view: string;
20
+ readonly viewNamed: (name: string) => string;
21
+ readonly back: string;
22
+ readonly empty: string;
23
+ readonly noMatch: string;
24
+ }
25
+ export interface SnippetLibraryProps {
26
+ readonly entries?: readonly SnippetLibraryEntry[];
27
+ readonly source?: SnippetLibrarySource;
28
+ readonly labels: SnippetLibraryLabels;
29
+ readonly busy?: boolean;
30
+ /** Optional navigation shown beside the library title while browsing. */
31
+ readonly headerAction?: ComponentChildren;
32
+ readonly onInspect?: (entry: SnippetLibraryEntry) => void;
33
+ readonly onBack?: () => void;
34
+ }
35
+ /** Search snippet metadata and present caller-supplied source as exact, selectable text. */
36
+ export declare function SnippetLibrary({ entries, source, labels, busy, headerAction, onInspect, onBack, }: SnippetLibraryProps): JSX.Element;
37
+ //# sourceMappingURL=snippet-library.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snippet-library.d.ts","sourceRoot":"","sources":["../../../src/src/preact/snippet-library.tsx"],"names":[],"mappings":"AAAA,8BAA8B;AAE9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAKrD,MAAM,WAAW,mBAAmB;IAClC,gEAAgE;IAChE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kCAAkC;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;CAClC;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,oBAAoB,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;IACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,yEAAyE;IACzE,QAAQ,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAC;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC1D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B;AA4BD,4FAA4F;AAC5F,wBAAgB,cAAc,CAAC,EAC7B,OAAY,EACZ,MAAM,EACN,MAAM,EACN,IAAY,EACZ,YAAY,EACZ,SAAS,EACT,MAAM,GACP,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAwFnC"}
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
2
+ import { useLayoutEffect, useMemo, useRef, useState } from "preact/hooks";
3
+ import { Button, CodeBlock } from "./components.js";
4
+ import { javascriptHighlightRanges } from "./snippet-javascript.js";
5
+ function SnippetCode({ code, language }) {
6
+ const content = useMemo(() => {
7
+ if (language !== "javascript")
8
+ return code;
9
+ const ranges = javascriptHighlightRanges(code);
10
+ if (!ranges.length)
11
+ return code;
12
+ const children = [];
13
+ let offset = 0;
14
+ for (const { start, end, style } of ranges) {
15
+ if (start > offset)
16
+ children.push(code.slice(offset, start));
17
+ children.push(_jsx("span", { class: `mcp-view-snippet-token-${style}`, children: code.slice(start, end) }, start));
18
+ offset = end;
19
+ }
20
+ children.push(code.slice(offset));
21
+ return children;
22
+ }, [code, language]);
23
+ return _jsx(CodeBlock, { children: content });
24
+ }
25
+ /** Search snippet metadata and present caller-supplied source as exact, selectable text. */
26
+ export function SnippetLibrary({ entries = [], source, labels, busy = false, headerAction, onInspect, onBack, }) {
27
+ const [filter, setFilter] = useState("");
28
+ const search = useRef(null);
29
+ const heading = useRef(null);
30
+ useLayoutEffect(() => {
31
+ (source ? heading.current : search.current)?.focus();
32
+ }, [source]);
33
+ const query = filter.trim().toLocaleLowerCase();
34
+ const matches = entries.filter(({ name, description }) => name.toLocaleLowerCase().includes(query) ||
35
+ description?.toLocaleLowerCase().includes(query));
36
+ return (_jsxs("section", { class: "mcp-view-snippet-library", "aria-label": labels.title, "aria-busy": busy, children: [_jsxs("header", { class: "mcp-view-snippet-header", children: [_jsx("h2", { children: labels.title }), !source && headerAction] }), source
37
+ ? (_jsxs("div", { class: "mcp-view-snippet-source", children: [_jsx("h3", { ref: heading, tabIndex: -1, children: _jsx("bdi", { children: source.name }) }), source.description && _jsx("p", { dir: "auto", children: source.description }), _jsx("div", { class: "mcp-view-snippet-code", role: "region", "aria-label": labels.viewNamed(source.name), tabIndex: 0, dir: "ltr", children: _jsx(SnippetCode, { code: source.code, language: source.language }) }), onBack && (_jsx(Button, { disabled: busy, onClick: onBack, children: labels.back }))] }))
38
+ : (_jsxs(_Fragment, { children: [_jsxs("label", { class: "mcp-view-snippet-search", children: [labels.search, _jsx("input", { class: "mcp-view-text-input", type: "search", ref: search, value: filter, onInput: (event) => setFilter(event.currentTarget.value) })] }), matches.length > 0
39
+ ? (_jsx("ul", { class: "mcp-view-snippet-list", children: matches.map((entry) => (_jsxs("li", { children: [_jsxs("div", { children: [_jsx("strong", { children: _jsx("bdi", { children: entry.name }) }), entry.description && _jsx("p", { dir: "auto", children: entry.description })] }), _jsx("button", { class: "mcp-view-button", type: "button", disabled: busy || !onInspect, "aria-label": labels.viewNamed(entry.name), onClick: () => onInspect?.(entry), children: labels.view })] }, entry.id))) }))
40
+ : (_jsx("p", { class: "mcp-view-snippet-empty", role: "status", children: entries.length ? labels.noMatch : labels.empty }))] }))] }));
41
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/src/theme.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAE5E,eAAO,MAAM,uBAAuB,mBAAmB,CAAC;AAExD,sEAAsE;AACtE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,KAAK,EAAE,kBAAkB,CAAC;IAC1B,MAAM,EAAE,mBAAmB,CAAC;IAC5B,KAAK,EAAE,kBAAkB,CAAC;IAC1B,MAAM,EAAE,mBAAmB,CAAC;IAC5B,MAAM,EAAE,mBAAmB,CAAC;IAC5B,KAAK,EAAE,kBAAkB,CAAC;IAC1B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,MAAM,EAAE,mBAAmB,CAAC;IAC5B,WAAW,EAAE,yBAAyB,CAAC;IACvC,QAAQ,EAAE,sBAAsB,CAAC;IACjC,QAAQ,EAAE,sBAAsB,CAAC;IACjC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,WAAW,EAAE,sBAAsB,CAAC;IACpC,GAAG,EAAE,gBAAgB,CAAC;IACtB,aAAa,EAAE,2BAA2B,CAAC;IAC3C,KAAK,EAAE,kBAAkB,CAAC;IAC1B,UAAU,EAAE,wBAAwB,CAAC;IACrC,YAAY,EAAE,0BAA0B,CAAC;IACzC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,KAAK,EAAE,kBAAkB,CAAC;IAC1B,UAAU,EAAE,wBAAwB,CAAC;IACrC,SAAS,EAAE,uBAAuB,CAAC;IACnC,WAA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IACjC,QAAQ,EAAE,sBAAsB,CAAC;IACjC,aAAa,EAAE,4BAA4B,CAAC;IAC5C,SAAS,EAAE,uBAAuB,CAAC;IACnC,SAAS,EAAE,uBAAuB,CAAC;IACnC,UAAU,EAAE,wBAAwB,CAAC;IACrC,aAAa,EAAE,2BAA2B,CAAC;IAC3C,YAAY,EAAE,0BAA0B,CAAC;IACzC,eAAe,EAAE,6BAA6B,CAAC;IAC/C,aAAa,EAAE,2BAA2B,CAAC;IAC3C,cAAc,EAAE,4BAA4B,CAAC;CAC9C,CAAC,CAAC;AAEH,eAAO,MAAM,qBAAqB,EAAE,kBA+CnC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,MAAM,kBAAkB,CAAC,CAAC;AAE7E;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,MA27DhC,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAC3C,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;IAC/C,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB,CAAC;CACnD;AAED,qEAAqE;AACrE,wBAAgB,mBAAmB,CACjC,MAAM,GAAE,oBAA+B,GACtC,gBAAgB,CASlB"}
package/esm/src/theme.js CHANGED
@@ -680,6 +680,86 @@ export const MCP_VIEW_THEME_CSS = String.raw `
680
680
  white-space: pre-wrap;
681
681
  }
682
682
 
683
+ .mcp-view-snippet-library,
684
+ .mcp-view-snippet-search,
685
+ .mcp-view-snippet-source {
686
+ display: grid;
687
+ grid-template-columns: minmax(0, 1fr);
688
+ gap: 8px;
689
+ overflow-wrap: anywhere;
690
+ }
691
+
692
+ .mcp-view-snippet-library h2,
693
+ .mcp-view-snippet-library h3,
694
+ .mcp-view-snippet-library p {
695
+ margin: 0;
696
+ }
697
+
698
+ .mcp-view-snippet-header,
699
+ .mcp-view-snippet-list li {
700
+ display: flex;
701
+ flex-wrap: wrap;
702
+ align-items: center;
703
+ justify-content: space-between;
704
+ gap: 8px 12px;
705
+ }
706
+
707
+ .mcp-view-snippet-list {
708
+ /* Use a fixed cap because the host can resize the iframe to its content. */
709
+ max-block-size: 20rem;
710
+ margin: 0;
711
+ padding: 0;
712
+ overflow: auto;
713
+ list-style: none;
714
+ }
715
+
716
+ .mcp-view-snippet-list li {
717
+ padding-block: 8px;
718
+ border-block-start: 1px solid var(--mcp-view-border-soft);
719
+ }
720
+ .mcp-view-snippet-list li > div { flex: 1 1 12rem; min-inline-size: 0; }
721
+
722
+ .mcp-view-snippet-code {
723
+ max-block-size: 20rem;
724
+ overflow: auto;
725
+ border: 1px solid var(--mcp-view-border-soft);
726
+ border-radius: var(--mcp-view-radius-sm);
727
+ background: var(--mcp-view-subtle);
728
+ }
729
+ .mcp-view-snippet-code:focus-visible {
730
+ outline: 2px solid var(--mcp-view-accent);
731
+ outline-offset: 2px;
732
+ }
733
+ .mcp-view-snippet-code .mcp-view-code-block {
734
+ max-height: none;
735
+ overflow: visible;
736
+ border: 0;
737
+ white-space: pre;
738
+ }
739
+ .mcp-view-snippet-code code {
740
+ font-variant-ligatures: none;
741
+ font-feature-settings: "liga" 0, "calt" 0;
742
+ }
743
+ .mcp-view-snippet-token-comment { color: var(--mcp-view-muted); }
744
+ .mcp-view-snippet-token-keyword { color: var(--mcp-view-brand-text); }
745
+ .mcp-view-snippet-token-string {
746
+ color: var(--mcp-view-text-secondary);
747
+ color: color-mix(in srgb, var(--mcp-view-success) 85%, var(--mcp-view-text-secondary));
748
+ }
749
+ .mcp-view-snippet-token-literal { color: var(--mcp-view-accent-text); }
750
+ .mcp-view-snippet-source button { justify-self: start; }
751
+ .mcp-view-snippet-empty {
752
+ padding: 8px;
753
+ border-radius: var(--mcp-view-radius-sm);
754
+ background: var(--mcp-view-subtle);
755
+ color: var(--mcp-view-muted);
756
+ }
757
+
758
+ @media (pointer: coarse) {
759
+ .mcp-view-snippet-library .mcp-view-button,
760
+ .mcp-view-snippet-search .mcp-view-text-input { min-height: 44px; }
761
+ }
762
+
683
763
  .mcp-view-inline-code {
684
764
  max-width: 100%;
685
765
  padding: 1px 4px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpview/components",
3
- "version": "0.12.1",
3
+ "version": "0.13.1",
4
4
  "description": "Optional light-first component runtime for small composable MCP App viewers",
5
5
  "keywords": [
6
6
  "mcp",
@@ -62,6 +62,7 @@
62
62
  "node": ">=20"
63
63
  },
64
64
  "dependencies": {
65
+ "acorn": "^8.19.0",
65
66
  "@mcpview/view": "^0.11.1",
66
67
  "@mcpview/contracts": "^0.2.1"
67
68
  },
@@ -19,4 +19,6 @@ export { CollectionCard, ElementBody, ElementIdent, ElementLimit, ElementProvena
19
19
  export type { CollectionCardProps, ElementBodyProps, ElementIdentProps, ElementLimitProps, ElementProvenanceProps, ElementReadingProps, ElementSectionProps, ElementVerdictProps, SemanticElementDensity, SemanticElementProps, SemanticListProps, } from "./src/preact/semantic-element.js";
20
20
  export { Disclosure, FocusedView } from "./src/preact/focused-view.js";
21
21
  export type { DisclosureProps, FocusedViewProps } from "./src/preact/focused-view.js";
22
+ export { SnippetLibrary } from "./src/preact/snippet-library.js";
23
+ export type { SnippetLibraryEntry, SnippetLibraryLabels, SnippetLibraryProps, SnippetLibrarySource, } from "./src/preact/snippet-library.js";
22
24
  //# sourceMappingURL=preact-components.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"preact-components.d.ts","sourceRoot":"","sources":["../src/preact-components.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,qBAAqB,CAAC;AAG7B,OAAO,EACL,KAAK,EACL,UAAU,EACV,MAAM,EACN,IAAI,EACJ,SAAS,EACT,cAAc,EACd,SAAS,EACT,UAAU,EACV,UAAU,EACV,YAAY,EACZ,OAAO,EACP,MAAM,EACN,UAAU,EACV,WAAW,EACX,mB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AY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACvE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"preact-components.d.ts","sourceRoot":"","sources":["../src/preact-components.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,qBAAqB,CAAC;AAG7B,OAAO,EACL,KAAK,EACL,UAAU,EACV,MAAM,EACN,IAAI,EACJ,SAAS,EACT,cAAc,EACd,SAAS,EACT,UAAU,EACV,UAAU,EACV,YAAY,EACZ,OAAO,EACP,MAAM,EACN,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,GAAG,EACH,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,SAAS,EACT,OAAO,GACR,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,eAAe,EACf,UAAU,EACV,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,eAAe,EACf,eAAe,EACf,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,YAAY,GACb,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,WAAW,EACX,SAAS,EACT,UAAU,EACV,4BAA4B,EAC5B,OAAO,EACP,MAAM,EACN,WAAW,EACX,QAAQ,EACR,SAAS,GACV,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,eAAe,EACf,WAAW,EACX,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,QAAQ,GACT,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC7E,YAAY,EACV,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,cAAc,GACf,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,GACb,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACvE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEtF,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,iCAAiC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FocusedView = exports.Disclosure = exports.SemanticList = exports.SemanticElement = exports.ElementVerdict = exports.ElementSection = exports.ElementReading = exports.ElementProvenance = exports.ElementLimit = exports.ElementIdent = exports.ElementBody = exports.CollectionCard = exports.Sparkline = exports.SeriesChart = exports.IntervalPlot = exports.TypeBadge = exports.TreeList = exports.StaleBanner = exports.Slot3D = exports.PathBar = exports.PATH_BAR_DEFAULT_MAX_VISIBLE = exports.LimitGauge = exports.DrillHint = exports.ArtifactRow = exports.Toolbar = exports.TextInput = exports.StateMessage = exports.Stack = exports.Skeleton = exports.Row = exports.renderStatusMessage = exports.NoticeGroup = exports.MetricGrid = exports.Metric = exports.Message = exports.KeyValueList = exports.InlineCode = exports.EmptyState = exports.DataTable = exports.CrossSelection = exports.CodeBlock = exports.Card = exports.Button = exports.BadgeGroup = exports.Badge = void 0;
3
+ exports.SnippetLibrary = exports.FocusedView = exports.Disclosure = exports.SemanticList = exports.SemanticElement = exports.ElementVerdict = exports.ElementSection = exports.ElementReading = exports.ElementProvenance = exports.ElementLimit = exports.ElementIdent = exports.ElementBody = exports.CollectionCard = exports.Sparkline = exports.SeriesChart = exports.IntervalPlot = exports.TypeBadge = exports.TreeList = exports.StaleBanner = exports.Slot3D = exports.PathBar = exports.PATH_BAR_DEFAULT_MAX_VISIBLE = exports.LimitGauge = exports.DrillHint = exports.ArtifactRow = exports.Toolbar = exports.TextInput = exports.StateMessage = exports.Stack = exports.Skeleton = exports.Row = exports.renderStatusMessage = exports.NoticeGroup = exports.MetricGrid = exports.Metric = exports.Message = exports.KeyValueList = exports.InlineCode = exports.EmptyState = exports.DataTable = exports.CrossSelection = exports.CodeBlock = exports.Card = exports.Button = exports.BadgeGroup = exports.Badge = void 0;
4
4
  /**
5
5
  * Pure Preact presentation primitives for native applications and MCP Apps.
6
6
  *
@@ -62,6 +62,8 @@ Object.defineProperty(exports, "SemanticList", { enumerable: true, get: function
62
62
  var focused_view_js_1 = require("./src/preact/focused-view.js");
63
63
  Object.defineProperty(exports, "Disclosure", { enumerable: true, get: function () { return focused_view_js_1.Disclosure; } });
64
64
  Object.defineProperty(exports, "FocusedView", { enumerable: true, get: function () { return focused_view_js_1.FocusedView; } });
65
+ var snippet_library_js_1 = require("./src/preact/snippet-library.js");
66
+ Object.defineProperty(exports, "SnippetLibrary", { enumerable: true, get: function () { return snippet_library_js_1.SnippetLibrary; } });
65
67
  // The stylesheet and its types ship from the package root with
66
68
  // `installMcpViewTheme`, never from this entry. Re-exporting them here handed
67
69
  // the whole sheet to every caller that only wanted one component: the theme is
@@ -1,6 +1,6 @@
1
1
  /** Preact integration for `@mcpview/components` surfaces. */
2
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";
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, SnippetLibrary, Sparkline, Stack, StaleBanner, StateMessage, TextInput, Toolbar, TreeList, TypeBadge, } from "../../preact-components.js";
4
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";
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, SnippetLibraryEntry, SnippetLibraryLabels, SnippetLibraryProps, SnippetLibrarySource, SparklineProps, StackProps, StaleBannerAction, StaleBannerProps, StateMessageProps, StatusMessageMount, TextInputProps, ToolbarProps, TreeListNode, TreeListProps, TypeBadgeProps, ViewKind, } from "../../preact-components.js";
6
6
  //# sourceMappingURL=mod.d.ts.map
@@ -1 +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"}
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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,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,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,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"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /** Preact integration for `@mcpview/components` surfaces. */
3
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;
4
+ exports.TypeBadge = exports.TreeList = exports.Toolbar = exports.TextInput = exports.StateMessage = exports.StaleBanner = exports.Stack = exports.Sparkline = exports.SnippetLibrary = 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
5
  var surface_js_1 = require("./surface.js");
6
6
  Object.defineProperty(exports, "definePreactComponent", { enumerable: true, get: function () { return surface_js_1.definePreactComponent; } });
7
7
  Object.defineProperty(exports, "preactSurfaceRenderer", { enumerable: true, get: function () { return surface_js_1.preactSurfaceRenderer; } });
@@ -45,6 +45,7 @@ Object.defineProperty(exports, "SemanticList", { enumerable: true, get: function
45
45
  Object.defineProperty(exports, "SeriesChart", { enumerable: true, get: function () { return preact_components_js_1.SeriesChart; } });
46
46
  Object.defineProperty(exports, "Skeleton", { enumerable: true, get: function () { return preact_components_js_1.Skeleton; } });
47
47
  Object.defineProperty(exports, "Slot3D", { enumerable: true, get: function () { return preact_components_js_1.Slot3D; } });
48
+ Object.defineProperty(exports, "SnippetLibrary", { enumerable: true, get: function () { return preact_components_js_1.SnippetLibrary; } });
48
49
  Object.defineProperty(exports, "Sparkline", { enumerable: true, get: function () { return preact_components_js_1.Sparkline; } });
49
50
  Object.defineProperty(exports, "Stack", { enumerable: true, get: function () { return preact_components_js_1.Stack; } });
50
51
  Object.defineProperty(exports, "StaleBanner", { enumerable: true, get: function () { return preact_components_js_1.StaleBanner; } });
@@ -0,0 +1,10 @@
1
+ type Style = "comment" | "keyword" | "string" | "literal";
2
+ type Range = {
3
+ start: number;
4
+ end: number;
5
+ style: Style;
6
+ };
7
+ /** Offset ranges leave line endings, escape sequences and all other source text untouched. */
8
+ export declare function javascriptHighlightRanges(code: string): Range[];
9
+ export {};
10
+ //# sourceMappingURL=snippet-javascript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snippet-javascript.d.ts","sourceRoot":"","sources":["../../../src/src/preact/snippet-javascript.ts"],"names":[],"mappings":"AAEA,KAAK,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAC1D,KAAK,KAAK,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAuB1D,8FAA8F;AAC9F,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,EAAE,CAmB/D"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.javascriptHighlightRanges = javascriptHighlightRanges;
4
+ const acorn_1 = require("acorn");
5
+ function tokenStyle(type, text) {
6
+ switch (type) {
7
+ case acorn_1.tokTypes.string:
8
+ case acorn_1.tokTypes.regexp:
9
+ case acorn_1.tokTypes.template:
10
+ case acorn_1.tokTypes.invalidTemplate:
11
+ case acorn_1.tokTypes.backQuote:
12
+ return "string";
13
+ case acorn_1.tokTypes.num:
14
+ case acorn_1.tokTypes._null:
15
+ case acorn_1.tokTypes._true:
16
+ case acorn_1.tokTypes._false:
17
+ return "literal";
18
+ case acorn_1.tokTypes.name:
19
+ if (["async", "await", "let", "yield"].includes(text))
20
+ return "keyword";
21
+ return;
22
+ default:
23
+ if (type.keyword)
24
+ return "keyword";
25
+ }
26
+ }
27
+ /** Offset ranges leave line endings, escape sequences and all other source text untouched. */
28
+ function javascriptHighlightRanges(code) {
29
+ const ranges = [];
30
+ try {
31
+ (0, acorn_1.parse)(code, {
32
+ ecmaVersion: "latest",
33
+ sourceType: "module",
34
+ allowReturnOutsideFunction: true,
35
+ onComment: (_block, _text, start, end) => {
36
+ ranges.push({ start, end, style: "comment" });
37
+ },
38
+ onToken: ({ type, start, end }) => {
39
+ const style = tokenStyle(type, code.slice(start, end));
40
+ if (style && start < end)
41
+ ranges.push({ start, end, style });
42
+ },
43
+ });
44
+ }
45
+ catch {
46
+ return [];
47
+ }
48
+ return ranges.sort((a, b) => a.start - b.start);
49
+ }
@@ -0,0 +1,37 @@
1
+ /** @jsxImportSource preact */
2
+ import type { ComponentChildren, JSX } from "preact";
3
+ export interface SnippetLibraryEntry {
4
+ /** Stable identifier passed back to the caller in onInspect. */
5
+ readonly id: string;
6
+ readonly name: string;
7
+ readonly description?: string;
8
+ }
9
+ export interface SnippetLibrarySource {
10
+ readonly name: string;
11
+ readonly description?: string;
12
+ readonly code: string;
13
+ /** Omit to display plain text. */
14
+ readonly language?: "javascript";
15
+ }
16
+ export interface SnippetLibraryLabels {
17
+ readonly title: string;
18
+ readonly search: string;
19
+ readonly view: string;
20
+ readonly viewNamed: (name: string) => string;
21
+ readonly back: string;
22
+ readonly empty: string;
23
+ readonly noMatch: string;
24
+ }
25
+ export interface SnippetLibraryProps {
26
+ readonly entries?: readonly SnippetLibraryEntry[];
27
+ readonly source?: SnippetLibrarySource;
28
+ readonly labels: SnippetLibraryLabels;
29
+ readonly busy?: boolean;
30
+ /** Optional navigation shown beside the library title while browsing. */
31
+ readonly headerAction?: ComponentChildren;
32
+ readonly onInspect?: (entry: SnippetLibraryEntry) => void;
33
+ readonly onBack?: () => void;
34
+ }
35
+ /** Search snippet metadata and present caller-supplied source as exact, selectable text. */
36
+ export declare function SnippetLibrary({ entries, source, labels, busy, headerAction, onInspect, onBack, }: SnippetLibraryProps): JSX.Element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OAAO,CAAC;IACxB,yEAAyE;IACzE,QAAQ,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAC;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC1D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B;AA4BD,4FAA4F;AAC5F,wBAAgB,cAAc,CAAC,EAC7B,OAAY,EACZ,MAAM,EACN,MAAM,EACN,IAAY,EACZ,YAAY,EACZ,SAAS,EACT,MAAM,GACP,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAwFnC"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SnippetLibrary = SnippetLibrary;
4
+ const jsx_runtime_1 = require("preact/jsx-runtime");
5
+ const hooks_1 = require("preact/hooks");
6
+ const components_js_1 = require("./components.js");
7
+ const snippet_javascript_js_1 = require("./snippet-javascript.js");
8
+ function SnippetCode({ code, language }) {
9
+ const content = (0, hooks_1.useMemo)(() => {
10
+ if (language !== "javascript")
11
+ return code;
12
+ const ranges = (0, snippet_javascript_js_1.javascriptHighlightRanges)(code);
13
+ if (!ranges.length)
14
+ return code;
15
+ const children = [];
16
+ let offset = 0;
17
+ for (const { start, end, style } of ranges) {
18
+ if (start > offset)
19
+ children.push(code.slice(offset, start));
20
+ children.push((0, jsx_runtime_1.jsx)("span", { class: `mcp-view-snippet-token-${style}`, children: code.slice(start, end) }, start));
21
+ offset = end;
22
+ }
23
+ children.push(code.slice(offset));
24
+ return children;
25
+ }, [code, language]);
26
+ return (0, jsx_runtime_1.jsx)(components_js_1.CodeBlock, { children: content });
27
+ }
28
+ /** Search snippet metadata and present caller-supplied source as exact, selectable text. */
29
+ function SnippetLibrary({ entries = [], source, labels, busy = false, headerAction, onInspect, onBack, }) {
30
+ const [filter, setFilter] = (0, hooks_1.useState)("");
31
+ const search = (0, hooks_1.useRef)(null);
32
+ const heading = (0, hooks_1.useRef)(null);
33
+ (0, hooks_1.useLayoutEffect)(() => {
34
+ (source ? heading.current : search.current)?.focus();
35
+ }, [source]);
36
+ const query = filter.trim().toLocaleLowerCase();
37
+ const matches = entries.filter(({ name, description }) => name.toLocaleLowerCase().includes(query) ||
38
+ description?.toLocaleLowerCase().includes(query));
39
+ return ((0, jsx_runtime_1.jsxs)("section", { class: "mcp-view-snippet-library", "aria-label": labels.title, "aria-busy": busy, children: [(0, jsx_runtime_1.jsxs)("header", { class: "mcp-view-snippet-header", children: [(0, jsx_runtime_1.jsx)("h2", { children: labels.title }), !source && headerAction] }), source
40
+ ? ((0, jsx_runtime_1.jsxs)("div", { class: "mcp-view-snippet-source", children: [(0, jsx_runtime_1.jsx)("h3", { ref: heading, tabIndex: -1, children: (0, jsx_runtime_1.jsx)("bdi", { children: source.name }) }), source.description && (0, jsx_runtime_1.jsx)("p", { dir: "auto", children: source.description }), (0, jsx_runtime_1.jsx)("div", { class: "mcp-view-snippet-code", role: "region", "aria-label": labels.viewNamed(source.name), tabIndex: 0, dir: "ltr", children: (0, jsx_runtime_1.jsx)(SnippetCode, { code: source.code, language: source.language }) }), onBack && ((0, jsx_runtime_1.jsx)(components_js_1.Button, { disabled: busy, onClick: onBack, children: labels.back }))] }))
41
+ : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("label", { class: "mcp-view-snippet-search", children: [labels.search, (0, jsx_runtime_1.jsx)("input", { class: "mcp-view-text-input", type: "search", ref: search, value: filter, onInput: (event) => setFilter(event.currentTarget.value) })] }), matches.length > 0
42
+ ? ((0, jsx_runtime_1.jsx)("ul", { class: "mcp-view-snippet-list", children: matches.map((entry) => ((0, jsx_runtime_1.jsxs)("li", { children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("strong", { children: (0, jsx_runtime_1.jsx)("bdi", { children: entry.name }) }), entry.description && (0, jsx_runtime_1.jsx)("p", { dir: "auto", children: entry.description })] }), (0, jsx_runtime_1.jsx)("button", { class: "mcp-view-button", type: "button", disabled: busy || !onInspect, "aria-label": labels.viewNamed(entry.name), onClick: () => onInspect?.(entry), children: labels.view })] }, entry.id))) }))
43
+ : ((0, jsx_runtime_1.jsx)("p", { class: "mcp-view-snippet-empty", role: "status", children: entries.length ? labels.noMatch : labels.empty }))] }))] }));
44
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/src/theme.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAE5E,eAAO,MAAM,uBAAuB,mBAAmB,CAAC;AAExD,sEAAsE;AACtE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,KAAK,EAAE,kBAAkB,CAAC;IAC1B,MAAM,EAAE,mBAAmB,CAAC;IAC5B,KAAK,EAAE,kBAAkB,CAAC;IAC1B,MAAM,EAAE,mBAAmB,CAAC;IAC5B,MAAM,EAAE,mBAAmB,CAAC;IAC5B,KAAK,EAAE,kBAAkB,CAAC;IAC1B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,MAAM,EAAE,mBAAmB,CAAC;IAC5B,WAAW,EAAE,yBAAyB,CAAC;IACvC,QAAQ,EAAE,sBAAsB,CAAC;IACjC,QAAQ,EAAE,sBAAsB,CAAC;IACjC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,WAAW,EAAE,sBAAsB,CAAC;IACpC,GAAG,EAAE,gBAAgB,CAAC;IACtB,aAAa,EAAE,2BAA2B,CAAC;IAC3C,KAAK,EAAE,kBAAkB,CAAC;IAC1B,UAAU,EAAE,wBAAwB,CAAC;IACrC,YAAY,EAAE,0BAA0B,CAAC;IACzC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,KAAK,EAAE,kBAAkB,CAAC;IAC1B,UAA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jC,QAAQ,EAAE,sBAAsB,CAAC;IACjC,QAAQ,EAAE,sBAAsB,CAAC;IACjC,QAAQ,EAAE,sBAAsB,CAAC;IACjC,aAAa,EAAE,4BAA4B,CAAC;IAC5C,SAAS,EAAE,uBAAuB,CAAC;IACnC,SAAS,EAAE,uBAAuB,CAAC;IACnC,UAAU,EAAE,wBAAwB,CAAC;IACrC,aAAa,EAAE,2BAA2B,CAAC;IAC3C,YAAY,EAAE,0BAA0B,CAAC;IACzC,eAAe,EAAE,6BAA6B,CAAC;IAC/C,aAAa,EAAE,2BAA2B,CAAC;IAC3C,cAAc,EAAE,4BAA4B,CAAC;CAC9C,CAAC,CAAC;AAEH,eAAO,MAAM,qBAAqB,EAAE,kBA+CnC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,MAAM,kBAAkB,CAAC,CAAC;AAE7E;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,MA27DhC,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAC3C,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;IAC/C,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB,CAAC;CACnD;AAED,qEAAqE;AACrE,wBAAgB,mBAAmB,CACjC,MAAM,GAAE,oBAA+B,GACtC,gBAAgB,CASlB"}
@@ -684,6 +684,86 @@ exports.MCP_VIEW_THEME_CSS = String.raw `
684
684
  white-space: pre-wrap;
685
685
  }
686
686
 
687
+ .mcp-view-snippet-library,
688
+ .mcp-view-snippet-search,
689
+ .mcp-view-snippet-source {
690
+ display: grid;
691
+ grid-template-columns: minmax(0, 1fr);
692
+ gap: 8px;
693
+ overflow-wrap: anywhere;
694
+ }
695
+
696
+ .mcp-view-snippet-library h2,
697
+ .mcp-view-snippet-library h3,
698
+ .mcp-view-snippet-library p {
699
+ margin: 0;
700
+ }
701
+
702
+ .mcp-view-snippet-header,
703
+ .mcp-view-snippet-list li {
704
+ display: flex;
705
+ flex-wrap: wrap;
706
+ align-items: center;
707
+ justify-content: space-between;
708
+ gap: 8px 12px;
709
+ }
710
+
711
+ .mcp-view-snippet-list {
712
+ /* Use a fixed cap because the host can resize the iframe to its content. */
713
+ max-block-size: 20rem;
714
+ margin: 0;
715
+ padding: 0;
716
+ overflow: auto;
717
+ list-style: none;
718
+ }
719
+
720
+ .mcp-view-snippet-list li {
721
+ padding-block: 8px;
722
+ border-block-start: 1px solid var(--mcp-view-border-soft);
723
+ }
724
+ .mcp-view-snippet-list li > div { flex: 1 1 12rem; min-inline-size: 0; }
725
+
726
+ .mcp-view-snippet-code {
727
+ max-block-size: 20rem;
728
+ overflow: auto;
729
+ border: 1px solid var(--mcp-view-border-soft);
730
+ border-radius: var(--mcp-view-radius-sm);
731
+ background: var(--mcp-view-subtle);
732
+ }
733
+ .mcp-view-snippet-code:focus-visible {
734
+ outline: 2px solid var(--mcp-view-accent);
735
+ outline-offset: 2px;
736
+ }
737
+ .mcp-view-snippet-code .mcp-view-code-block {
738
+ max-height: none;
739
+ overflow: visible;
740
+ border: 0;
741
+ white-space: pre;
742
+ }
743
+ .mcp-view-snippet-code code {
744
+ font-variant-ligatures: none;
745
+ font-feature-settings: "liga" 0, "calt" 0;
746
+ }
747
+ .mcp-view-snippet-token-comment { color: var(--mcp-view-muted); }
748
+ .mcp-view-snippet-token-keyword { color: var(--mcp-view-brand-text); }
749
+ .mcp-view-snippet-token-string {
750
+ color: var(--mcp-view-text-secondary);
751
+ color: color-mix(in srgb, var(--mcp-view-success) 85%, var(--mcp-view-text-secondary));
752
+ }
753
+ .mcp-view-snippet-token-literal { color: var(--mcp-view-accent-text); }
754
+ .mcp-view-snippet-source button { justify-self: start; }
755
+ .mcp-view-snippet-empty {
756
+ padding: 8px;
757
+ border-radius: var(--mcp-view-radius-sm);
758
+ background: var(--mcp-view-subtle);
759
+ color: var(--mcp-view-muted);
760
+ }
761
+
762
+ @media (pointer: coarse) {
763
+ .mcp-view-snippet-library .mcp-view-button,
764
+ .mcp-view-snippet-search .mcp-view-text-input { min-height: 44px; }
765
+ }
766
+
687
767
  .mcp-view-inline-code {
688
768
  max-width: 100%;
689
769
  padding: 1px 4px;