@mcpview/components 0.13.0 → 0.14.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/README.md +112 -2
- package/esm/preact-components.d.ts +1 -1
- package/esm/preact-components.d.ts.map +1 -1
- package/esm/preact-controls.d.ts +12 -0
- package/esm/preact-controls.d.ts.map +1 -0
- package/esm/preact-controls.js +8 -0
- package/esm/src/context-row-styles.d.ts +5 -0
- package/esm/src/context-row-styles.d.ts.map +1 -0
- package/esm/src/context-row-styles.js +96 -0
- package/esm/src/interaction-styles.d.ts +5 -0
- package/esm/src/interaction-styles.d.ts.map +1 -0
- package/esm/src/interaction-styles.js +55 -0
- package/esm/src/preact/components.d.ts +24 -1
- package/esm/src/preact/components.d.ts.map +1 -1
- package/esm/src/preact/components.js +86 -39
- package/esm/src/preact/interaction-controls.d.ts +22 -0
- package/esm/src/preact/interaction-controls.d.ts.map +1 -0
- package/esm/src/preact/interaction-controls.js +25 -0
- package/esm/src/preact/interactive-child.d.ts +2 -0
- package/esm/src/preact/interactive-child.d.ts.map +1 -0
- package/esm/src/preact/interactive-child.js +16 -0
- package/esm/src/preact/mod.d.ts +1 -1
- package/esm/src/preact/mod.d.ts.map +1 -1
- package/esm/src/preact/semantic-element.d.ts.map +1 -1
- package/esm/src/preact/semantic-element.js +3 -16
- package/esm/src/preact/snippet-javascript.d.ts +10 -0
- package/esm/src/preact/snippet-javascript.d.ts.map +1 -0
- package/esm/src/preact/snippet-javascript.js +46 -0
- package/esm/src/preact/snippet-library.d.ts +2 -0
- package/esm/src/preact/snippet-library.d.ts.map +1 -1
- package/esm/src/preact/snippet-library.js +23 -2
- package/esm/src/preact/structural.d.ts.map +1 -1
- package/esm/src/preact/structural.js +14 -7
- package/esm/src/preact/visual-item-gestures.d.ts +5 -0
- package/esm/src/preact/visual-item-gestures.d.ts.map +1 -0
- package/esm/src/preact/visual-item-gestures.js +30 -0
- package/esm/src/theme.d.ts.map +1 -1
- package/esm/src/theme.js +24 -0
- package/esm/src/visual-item-gestures.d.ts +17 -0
- package/esm/src/visual-item-gestures.d.ts.map +1 -0
- package/esm/src/visual-item-gestures.js +393 -0
- package/esm/src/visual-item-props.d.ts +27 -0
- package/esm/src/visual-item-props.d.ts.map +1 -0
- package/esm/src/visual-item-props.js +19 -0
- package/package.json +7 -1
- package/script/preact-components.d.ts +1 -1
- package/script/preact-components.d.ts.map +1 -1
- package/script/preact-controls.d.ts +12 -0
- package/script/preact-controls.d.ts.map +1 -0
- package/script/preact-controls.js +20 -0
- package/script/src/context-row-styles.d.ts +5 -0
- package/script/src/context-row-styles.d.ts.map +1 -0
- package/script/src/context-row-styles.js +99 -0
- package/script/src/interaction-styles.d.ts +5 -0
- package/script/src/interaction-styles.d.ts.map +1 -0
- package/script/src/interaction-styles.js +59 -0
- package/script/src/preact/components.d.ts +24 -1
- package/script/src/preact/components.d.ts.map +1 -1
- package/script/src/preact/components.js +85 -38
- package/script/src/preact/interaction-controls.d.ts +22 -0
- package/script/src/preact/interaction-controls.d.ts.map +1 -0
- package/script/src/preact/interaction-controls.js +29 -0
- package/script/src/preact/interactive-child.d.ts +2 -0
- package/script/src/preact/interactive-child.d.ts.map +1 -0
- package/script/src/preact/interactive-child.js +19 -0
- package/script/src/preact/mod.d.ts +1 -1
- package/script/src/preact/mod.d.ts.map +1 -1
- package/script/src/preact/semantic-element.d.ts.map +1 -1
- package/script/src/preact/semantic-element.js +4 -17
- package/script/src/preact/snippet-javascript.d.ts +10 -0
- package/script/src/preact/snippet-javascript.d.ts.map +1 -0
- package/script/src/preact/snippet-javascript.js +49 -0
- package/script/src/preact/snippet-library.d.ts +2 -0
- package/script/src/preact/snippet-library.d.ts.map +1 -1
- package/script/src/preact/snippet-library.js +22 -1
- package/script/src/preact/structural.d.ts.map +1 -1
- package/script/src/preact/structural.js +14 -7
- package/script/src/preact/visual-item-gestures.d.ts +5 -0
- package/script/src/preact/visual-item-gestures.d.ts.map +1 -0
- package/script/src/preact/visual-item-gestures.js +33 -0
- package/script/src/theme.d.ts.map +1 -1
- package/script/src/theme.js +24 -0
- package/script/src/visual-item-gestures.d.ts +17 -0
- package/script/src/visual-item-gestures.d.ts.map +1 -0
- package/script/src/visual-item-gestures.js +396 -0
- package/script/src/visual-item-props.d.ts +27 -0
- package/script/src/visual-item-props.d.ts.map +1 -0
- package/script/src/visual-item-props.js +22 -0
package/README.md
CHANGED
|
@@ -270,7 +270,8 @@ technical control. Keep consequential state in `status` or `primary`.
|
|
|
270
270
|
Import `SnippetLibrary` from `@mcpview/components/preact/components`. Supply the snippet summaries
|
|
271
271
|
as `entries` and localized text as `labels`. The library filters names and descriptions locally. Use
|
|
272
272
|
`onInspect(entry)` to fetch the selected source, then pass it as `source` to show the program as
|
|
273
|
-
selectable text.
|
|
273
|
+
selectable text. Set `source.language` to `"javascript"` for syntax highlighting. Clear `source` in
|
|
274
|
+
`onBack` to return to the list.
|
|
274
275
|
|
|
275
276
|
The App owns the catalog calls and can provide navigation next to the library title through
|
|
276
277
|
`headerAction`. The component uses the package's existing theme styles.
|
|
@@ -596,13 +597,122 @@ local checkout); the `/surface` entry is derived from the latter unless
|
|
|
596
597
|
`MCP_VIEW_COMPONENTS_SURFACE_MODULE` names it. Run the generator from JSR:
|
|
597
598
|
|
|
598
599
|
```sh
|
|
599
|
-
deno run -A jsr:@mcpview/components@0.
|
|
600
|
+
deno run -A jsr:@mcpview/components@0.14.0/scaffold result-viewer ./result-viewer
|
|
600
601
|
```
|
|
601
602
|
|
|
602
603
|
The npm package contains only the runtime and presentation entry points. It does not export or ship
|
|
603
604
|
`@mcpview/components/scaffold`; Node ESM imports and CommonJS requires of that subpath are expected
|
|
604
605
|
to fail with `ERR_PACKAGE_PATH_NOT_EXPORTED` rather than loading a Deno-only module.
|
|
605
606
|
|
|
607
|
+
## Opening details and pinning context
|
|
608
|
+
|
|
609
|
+
The working version of `@mcpview/components/preact/controls` provides `useVisualItemGestures` for
|
|
610
|
+
views that handle navigation and context directly on data. Attach the returned callback ref to the
|
|
611
|
+
collection. Give each selectable mark a stable `data-visual-item` ID. A click or tap calls
|
|
612
|
+
`onActivate(id)`. Double-click, long press, or Shift+Space calls `onToggle(id)`. Supply `onAdd(ids)`
|
|
613
|
+
for collections that support dragging a rectangle. It receives the covered IDs on release. The
|
|
614
|
+
viewer adds those identities to its current context and uses its acknowledged state to draw the
|
|
615
|
+
outline and update the basket.
|
|
616
|
+
|
|
617
|
+
```tsx
|
|
618
|
+
const gestures = useVisualItemGestures({
|
|
619
|
+
onActivate: openInvoice,
|
|
620
|
+
onToggle: contextSupported ? toggleInvoice : undefined,
|
|
621
|
+
onAdd: contextSupported ? addInvoices : undefined,
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
return (
|
|
625
|
+
<div ref={gestures} data-visual-selection-surface style={{ touchAction: "pan-y" }}>
|
|
626
|
+
{invoices.map((invoice) => (
|
|
627
|
+
<button
|
|
628
|
+
key={invoice.name}
|
|
629
|
+
data-visual-item={invoice.name}
|
|
630
|
+
data-visual-selection-start
|
|
631
|
+
aria-pressed={contextSupported ? isSelected(invoice.name) : undefined}
|
|
632
|
+
aria-keyshortcuts={contextSupported ? "Shift+Space" : undefined}
|
|
633
|
+
>
|
|
634
|
+
{invoice.name}
|
|
635
|
+
</button>
|
|
636
|
+
))}
|
|
637
|
+
</div>
|
|
638
|
+
);
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
Rectangles can start in the collection background or on a mark with `data-visual-selection-start`.
|
|
642
|
+
For draggable cards, leave the mark unflagged so the background starts a rectangle and the card
|
|
643
|
+
keeps its drag action. An image inside a rectangle start can also declare `draggable={false}` to
|
|
644
|
+
disable native image dragging explicitly.
|
|
645
|
+
|
|
646
|
+
Custom surfaces can supply `getItemBounds` and `intersectsItem` for their geometry, including marks
|
|
647
|
+
partially or completely covered by an opaque overlay. `DataTable` accounts for a continuous
|
|
648
|
+
top-sticky `thead` in its own table.
|
|
649
|
+
|
|
650
|
+
For viewers with explicit buttons, import `DisclosureChevron` and `ContextPinButton` from the same
|
|
651
|
+
entry. A standalone viewer can call `installMcpViewInteractionStyles()` once in its document, or
|
|
652
|
+
include `MCP_VIEW_INTERACTION_CSS` in its own stylesheet. The full MCPView theme already includes
|
|
653
|
+
these styles.
|
|
654
|
+
|
|
655
|
+
Place `DisclosureChevron` before the identity inside the button that opens a detail. Place
|
|
656
|
+
`ContextPinButton` beside that button, at the end of the row. The pin accepts a localized `label`, a
|
|
657
|
+
controlled `pressed` state, and `onToggle(shiftKey)`. Use `group` for a collection, with
|
|
658
|
+
`pressed="mixed"` when part of it is pinned. Show the pin when the host accepts context. The viewer
|
|
659
|
+
owns the item identity, the pin state and the operation sent to the host.
|
|
660
|
+
|
|
661
|
+
```tsx
|
|
662
|
+
<div class="mcp-view-disclosure-row">
|
|
663
|
+
<button type="button" aria-expanded={open} onClick={openInvoice}>
|
|
664
|
+
<DisclosureChevron expanded={open} /> {invoice.name}
|
|
665
|
+
</button>
|
|
666
|
+
<ContextPinButton label={pinLabel} pressed={pinned} onToggle={toggleInvoicePin} />
|
|
667
|
+
</div>;
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
`DataTable` can handle the gestures on the rows themselves. In this example `context` comes from
|
|
671
|
+
`useActiveContext(controller, scopeKey)`. The app supplies `invoiceContext(row)`, which returns a
|
|
672
|
+
stable `ContextSelectionItem` for that invoice.
|
|
673
|
+
|
|
674
|
+
```tsx
|
|
675
|
+
<DataTable
|
|
676
|
+
label="Invoices"
|
|
677
|
+
rows={invoices}
|
|
678
|
+
rowKey={(invoice) => invoice.name}
|
|
679
|
+
columns={columns}
|
|
680
|
+
getDisclosure={(invoice) => ({
|
|
681
|
+
label: `Open ${invoice.name}`,
|
|
682
|
+
onOpen: () => openInvoice(invoice.name),
|
|
683
|
+
})}
|
|
684
|
+
selected={(invoice) => context.isSelected(invoiceContext(invoice))}
|
|
685
|
+
contextSelection={contextSupported
|
|
686
|
+
? {
|
|
687
|
+
onToggle: (invoice) => context.toggle(invoiceContext(invoice)),
|
|
688
|
+
onAdd: (invoices) => context.select(invoices.map(invoiceContext), "add"),
|
|
689
|
+
}
|
|
690
|
+
: undefined}
|
|
691
|
+
/>;
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
A click opens the invoice through its disclosure. A double-click, long press or Shift+Space toggles
|
|
695
|
+
the targeted invoice. Dragging a rectangle with the mouse adds the covered rows in one context
|
|
696
|
+
update. Touch users can scroll horizontally. The selection outline follows the existing data cells
|
|
697
|
+
and surrounds each run of adjacent joined rows. A focused row announces its context status using
|
|
698
|
+
`contextSelection.labels.selected` or `contextSelection.labels.unselected` if provided. Pass
|
|
699
|
+
localized labels and use acknowledged selection state so that both the contour and the announcement
|
|
700
|
+
follow the host's reply.
|
|
701
|
+
|
|
702
|
+
Custom tables can use the same contour by installing `MCP_VIEW_CONTEXT_ROW_CSS` from
|
|
703
|
+
`@mcpview/components/preact/controls`; it is also included by `installMcpViewInteractionStyles()`.
|
|
704
|
+
Set `data-mcp-view-context-row="selected"` on each joined `tr`. For a list layout, put the attribute
|
|
705
|
+
on each row wrapper and `data-mcp-view-context-row-outline` on its content. If the wrapper also
|
|
706
|
+
contains an open detail below the row, mark the wrapper with `data-mcp-view-context-row-break` to
|
|
707
|
+
end that outline. `--mcp-view-context-row-accent` overrides the default `--mcp-view-accent` colour.
|
|
708
|
+
|
|
709
|
+
Rows without a disclosure retain their optional `onSelect` action. A `TreeList` branch expands from
|
|
710
|
+
its row when there is no selection action. When `onSelect` is supplied, the branch keeps its leading
|
|
711
|
+
disclosure and the label performs the selection.
|
|
712
|
+
|
|
713
|
+
On a KPI chart, a click can update a linked panel for the chosen month. A context gesture on another
|
|
714
|
+
month targets that month and preserves the period on display.
|
|
715
|
+
|
|
606
716
|
## Active context
|
|
607
717
|
|
|
608
718
|
`@mcpview/components/preact/context` exports `ActiveContextChip`, `useActiveContext`,
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import "./_dnt.polyfills.js";
|
|
12
12
|
export { Badge, BadgeGroup, Button, Card, CodeBlock, CrossSelection, DataTable, EmptyState, InlineCode, KeyValueList, Message, Metric, MetricGrid, NoticeGroup, renderStatusMessage, Row, Skeleton, Stack, StateMessage, TextInput, Toolbar, } from "./src/preact/components.js";
|
|
13
|
-
export type { BadgeGroupProps, BadgeProps, ButtonProps, CardProps, CodeBlockProps, CrossSelectionProps, DataTableColumn, DataTableProps, EmptyStateProps, InlineCodeProps, KeyValueItem, KeyValueLayout, KeyValueListProps, MessageProps, MetricGridProps, MetricItem, MetricProps, NoticeGroupProps, PresentationTone, RowProps, SkeletonProps, StackProps, StateMessageProps, StatusMessageMount, TextInputProps, ToolbarProps, } from "./src/preact/components.js";
|
|
13
|
+
export type { BadgeGroupProps, BadgeProps, ButtonProps, CardProps, CodeBlockProps, CrossSelectionProps, DataTableColumn, DataTableDisclosure, DataTableProps, EmptyStateProps, InlineCodeProps, KeyValueItem, KeyValueLayout, KeyValueListProps, MessageProps, MetricGridProps, MetricItem, MetricProps, NoticeGroupProps, PresentationTone, RowProps, SkeletonProps, StackProps, StateMessageProps, StatusMessageMount, TextInputProps, ToolbarProps, } from "./src/preact/components.js";
|
|
14
14
|
export { ArtifactRow, DrillHint, LimitGauge, PATH_BAR_DEFAULT_MAX_VISIBLE, PathBar, Slot3D, StaleBanner, TreeList, TypeBadge, } from "./src/preact/structural.js";
|
|
15
15
|
export type { ArtifactFingerprint, ArtifactRowProps, ArtifactVerification, DrillHintDirection, DrillHintProps, LimitGaugeLimit, LimitGaugeProps, PathBarItem, PathBarProps, Slot3DProps, StaleBannerAction, StaleBannerProps, TreeListNode, TreeListProps, TypeBadgeProps, ViewKind, } from "./src/preact/structural.js";
|
|
16
16
|
export { IntervalPlot, SeriesChart, Sparkline } from "./src/preact/plots.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preact-components.d.ts","sourceRoot":"","sources":["../src/preact-components.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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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
|
+
{"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,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,eAAe,EACf,YAAY,EACZ,cAAc,E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AC;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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Lightweight Preact controls for drill-down and context pinning. @module */
|
|
2
|
+
import "./_dnt.polyfills.js";
|
|
3
|
+
export { ContextPinButton, DisclosureChevron } from "./src/preact/interaction-controls.js";
|
|
4
|
+
export type { ContextPinButtonProps, DisclosureChevronProps, } from "./src/preact/interaction-controls.js";
|
|
5
|
+
export { installMcpViewInteractionStyles, MCP_VIEW_INTERACTION_CSS, } from "./src/interaction-styles.js";
|
|
6
|
+
export { bindVisualItemGestures } from "./src/visual-item-gestures.js";
|
|
7
|
+
export type { VisualItemGestureOptions } from "./src/visual-item-gestures.js";
|
|
8
|
+
export { useVisualItemGestures } from "./src/preact/visual-item-gestures.js";
|
|
9
|
+
export { CONTEXT_ROW_OUTLINE, MCP_VIEW_CONTEXT_ROW_CSS } from "./src/context-row-styles.js";
|
|
10
|
+
export { visualItemProps } from "./src/visual-item-props.js";
|
|
11
|
+
export type { VisualItemPropsOptions } from "./src/visual-item-props.js";
|
|
12
|
+
//# sourceMappingURL=preact-controls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preact-controls.d.ts","sourceRoot":"","sources":["../src/preact-controls.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAC3F,YAAY,EACV,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,GACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,YAAY,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,YAAY,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Lightweight Preact controls for drill-down and context pinning. @module */
|
|
2
|
+
import "./_dnt.polyfills.js";
|
|
3
|
+
export { ContextPinButton, DisclosureChevron } from "./src/preact/interaction-controls.js";
|
|
4
|
+
export { installMcpViewInteractionStyles, MCP_VIEW_INTERACTION_CSS, } from "./src/interaction-styles.js";
|
|
5
|
+
export { bindVisualItemGestures } from "./src/visual-item-gestures.js";
|
|
6
|
+
export { useVisualItemGestures } from "./src/preact/visual-item-gestures.js";
|
|
7
|
+
export { CONTEXT_ROW_OUTLINE, MCP_VIEW_CONTEXT_ROW_CSS } from "./src/context-row-styles.js";
|
|
8
|
+
export { visualItemProps } from "./src/visual-item-props.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Class for a standalone selected or partially selected visual item. */
|
|
2
|
+
export declare const CONTEXT_ROW_OUTLINE = "mcp-view-context-row-outline";
|
|
3
|
+
/** Opt-in outlines for adjacent selected rows and standalone pressed items. */
|
|
4
|
+
export declare const MCP_VIEW_CONTEXT_ROW_CSS: string;
|
|
5
|
+
//# sourceMappingURL=context-row-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-row-styles.d.ts","sourceRoot":"","sources":["../../src/src/context-row-styles.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,eAAO,MAAM,mBAAmB,iCAAiC,CAAC;AAElE,+EAA+E;AAC/E,eAAO,MAAM,wBAAwB,EAAE,MA4FtC,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/** Class for a standalone selected or partially selected visual item. */
|
|
2
|
+
export const CONTEXT_ROW_OUTLINE = "mcp-view-context-row-outline";
|
|
3
|
+
/** Opt-in outlines for adjacent selected rows and standalone pressed items. */
|
|
4
|
+
export const MCP_VIEW_CONTEXT_ROW_CSS = String.raw `
|
|
5
|
+
.${CONTEXT_ROW_OUTLINE}:is([aria-pressed="true"], [aria-pressed="mixed"]) {
|
|
6
|
+
box-shadow: inset 0 0 0 2px var(--mcp-view-context-row-accent, var(--mcp-view-accent, Highlight));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* Only adjoining selected rows share edges. A visible detail or action rail
|
|
10
|
+
after a row breaks the run before the next row. */
|
|
11
|
+
[data-mcp-view-context-row] {
|
|
12
|
+
--mcp-view-context-row-top: 2px;
|
|
13
|
+
--mcp-view-context-row-bottom: 2px;
|
|
14
|
+
--mcp-view-context-row-seam: 0px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
[data-mcp-view-context-row="selected"]:not([data-mcp-view-context-row-break]):has(+ [data-mcp-view-context-row="selected"]) {
|
|
18
|
+
--mcp-view-context-row-bottom: 0px;
|
|
19
|
+
--mcp-view-context-row-seam: 1px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[data-mcp-view-context-row="selected"]:not([data-mcp-view-context-row-break]) + [data-mcp-view-context-row="selected"] {
|
|
23
|
+
--mcp-view-context-row-top: 0px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[data-mcp-view-context-row="selected"] > [data-mcp-view-context-row-outline],
|
|
27
|
+
[data-mcp-view-context-row="selected"] > * > [data-mcp-view-context-row-outline] {
|
|
28
|
+
position: relative;
|
|
29
|
+
box-shadow:
|
|
30
|
+
inset 2px 0 var(--mcp-view-context-row-accent, var(--mcp-view-accent, Highlight)),
|
|
31
|
+
inset -2px 0 var(--mcp-view-context-row-accent, var(--mcp-view-accent, Highlight)),
|
|
32
|
+
inset 0 var(--mcp-view-context-row-top) var(--mcp-view-context-row-accent, var(--mcp-view-accent, Highlight)),
|
|
33
|
+
inset 0 calc(-1 * var(--mcp-view-context-row-bottom)) var(--mcp-view-context-row-accent, var(--mcp-view-accent, Highlight));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Collapsed table borders paint above the cells. Inset shadows on each
|
|
37
|
+
cell join across the row while preserving the neutral border. */
|
|
38
|
+
tr[data-mcp-view-context-row="selected"] > td {
|
|
39
|
+
--mcp-view-context-cell-left: 0px;
|
|
40
|
+
--mcp-view-context-cell-right: 0px;
|
|
41
|
+
box-shadow:
|
|
42
|
+
inset var(--mcp-view-context-cell-left) 0 var(--mcp-view-context-row-accent, var(--mcp-view-accent, Highlight)),
|
|
43
|
+
inset calc(-1 * var(--mcp-view-context-cell-right)) 0 var(--mcp-view-context-row-accent, var(--mcp-view-accent, Highlight)),
|
|
44
|
+
inset 0 var(--mcp-view-context-row-top) var(--mcp-view-context-row-accent, var(--mcp-view-accent, Highlight)),
|
|
45
|
+
inset 0 calc(-1 * var(--mcp-view-context-row-bottom)) var(--mcp-view-context-row-accent, var(--mcp-view-accent, Highlight));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
tr[data-mcp-view-context-row="selected"] > td:first-child {
|
|
49
|
+
--mcp-view-context-cell-left: 2px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
tr[data-mcp-view-context-row="selected"] > td:last-child {
|
|
53
|
+
--mcp-view-context-cell-right: 2px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
/* Continue the side edges across the one-pixel neutral separator only. */
|
|
58
|
+
[data-mcp-view-context-row="selected"] > [data-mcp-view-context-row-outline]::after,
|
|
59
|
+
[data-mcp-view-context-row="selected"] > * > [data-mcp-view-context-row-outline]::after {
|
|
60
|
+
content: "";
|
|
61
|
+
position: absolute;
|
|
62
|
+
inset-inline: 0;
|
|
63
|
+
inset-block-end: -1px;
|
|
64
|
+
height: var(--mcp-view-context-row-seam);
|
|
65
|
+
border-inline: 2px solid var(--mcp-view-context-row-accent, var(--mcp-view-accent, Highlight));
|
|
66
|
+
pointer-events: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
tr[data-mcp-view-context-row="selected"] > td:is(:first-child, :last-child) {
|
|
70
|
+
position: relative;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
tr[data-mcp-view-context-row="selected"] > td:is(:first-child, :last-child)::after {
|
|
74
|
+
content: "";
|
|
75
|
+
position: absolute;
|
|
76
|
+
inset-block-end: -1px;
|
|
77
|
+
width: 2px;
|
|
78
|
+
height: var(--mcp-view-context-row-seam);
|
|
79
|
+
background: var(--mcp-view-context-row-accent, var(--mcp-view-accent, Highlight));
|
|
80
|
+
pointer-events: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
tr[data-mcp-view-context-row="selected"] > td:first-child::after {
|
|
84
|
+
inset-inline-start: 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
tr[data-mcp-view-context-row="selected"] > td:last-child::after {
|
|
88
|
+
inset-inline-end: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
tr[data-mcp-view-context-row="selected"] > td:only-child::after {
|
|
92
|
+
width: auto;
|
|
93
|
+
background: none;
|
|
94
|
+
border-inline: 2px solid var(--mcp-view-context-row-accent, var(--mcp-view-accent, Highlight));
|
|
95
|
+
}
|
|
96
|
+
`;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Standalone styles for exploration and context controls. No global theme is required. */
|
|
2
|
+
export declare const MCP_VIEW_INTERACTION_CSS: string;
|
|
3
|
+
/** Install only the interaction styles once in a standalone viewer's document. */
|
|
4
|
+
export declare function installMcpViewInteractionStyles(target?: Document): HTMLStyleElement;
|
|
5
|
+
//# sourceMappingURL=interaction-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction-styles.d.ts","sourceRoot":"","sources":["../../src/src/interaction-styles.ts"],"names":[],"mappings":"AAEA,2FAA2F;AAC3F,eAAO,MAAM,wBAAwB,EAAE,MAwCtC,CAAC;AAEF,kFAAkF;AAClF,wBAAgB,+BAA+B,CAAC,MAAM,GAAE,QAAmB,GAAG,gBAAgB,CAS7F"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { MCP_VIEW_CONTEXT_ROW_CSS } from "./context-row-styles.js";
|
|
2
|
+
/** Standalone styles for exploration and context controls. No global theme is required. */
|
|
3
|
+
export const MCP_VIEW_INTERACTION_CSS = String.raw `
|
|
4
|
+
.mcp-view-disclosure-row { display: flex; align-items: center; gap: .5rem; }
|
|
5
|
+
.mcp-view-disclosure-row > :first-child:not(.mcp-view-context-pin) { flex: 1; min-width: 0; }
|
|
6
|
+
.mcp-view-disclosure-row > .mcp-view-context-pin { margin-inline-start: auto; }
|
|
7
|
+
.mcp-view-context-pin {
|
|
8
|
+
box-sizing: border-box; display: inline-grid; place-items: center; flex: none;
|
|
9
|
+
width: 36px; height: 36px; min-width: 36px; min-height: 36px; padding: 0;
|
|
10
|
+
border: 0; border-radius: var(--mcp-view-radius-control, 5px);
|
|
11
|
+
background: transparent; color: var(--mcp-view-quiet, GrayText); cursor: pointer;
|
|
12
|
+
}
|
|
13
|
+
.mcp-view-context-pin:hover:not(:disabled) {
|
|
14
|
+
background: var(--mcp-view-subtle, color-mix(in srgb, currentColor 8%, transparent));
|
|
15
|
+
}
|
|
16
|
+
.mcp-view-context-pin:focus-visible {
|
|
17
|
+
outline: 2px solid var(--mcp-view-accent, Highlight); outline-offset: -2px;
|
|
18
|
+
}
|
|
19
|
+
.mcp-view-context-pin:disabled { opacity: .5; cursor: default; }
|
|
20
|
+
.mcp-view-context-pin-stroke {
|
|
21
|
+
transform-box: fill-box; transform-origin: center; transform: rotate(30deg); stroke-width: 1.65;
|
|
22
|
+
}
|
|
23
|
+
.mcp-view-context-pin[aria-pressed="true"], .mcp-view-context-pin[aria-pressed="mixed"] {
|
|
24
|
+
color: var(--mcp-view-accent-text, var(--mcp-view-accent, Highlight));
|
|
25
|
+
}
|
|
26
|
+
.mcp-view-context-pin[aria-pressed="true"] .mcp-view-context-pin-stroke,
|
|
27
|
+
.mcp-view-context-pin[aria-pressed="mixed"] .mcp-view-context-pin-stroke:first-child {
|
|
28
|
+
transform: none; stroke-width: 2.5;
|
|
29
|
+
}
|
|
30
|
+
.mcp-view-context-pin[aria-pressed="mixed"] .mcp-view-context-pin-stroke:last-child {
|
|
31
|
+
stroke-dasharray: 2 2.6;
|
|
32
|
+
}
|
|
33
|
+
.mcp-view-disclosure-chevron { display: inline-block; flex: none; }
|
|
34
|
+
.mcp-view-disclosure-chevron:dir(rtl) { transform: rotate(180deg); }
|
|
35
|
+
.mcp-view-disclosure-chevron[data-expanded="true"] { transform: rotate(90deg); }
|
|
36
|
+
@media (pointer: coarse) {
|
|
37
|
+
.mcp-view-context-pin { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
|
|
38
|
+
}
|
|
39
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
40
|
+
.mcp-view-context-pin-stroke, .mcp-view-disclosure-chevron { transition: transform .18s; }
|
|
41
|
+
}
|
|
42
|
+
${MCP_VIEW_CONTEXT_ROW_CSS}
|
|
43
|
+
`;
|
|
44
|
+
/** Install only the interaction styles once in a standalone viewer's document. */
|
|
45
|
+
export function installMcpViewInteractionStyles(target = document) {
|
|
46
|
+
const id = "mcp-view-interaction-styles";
|
|
47
|
+
const existing = target.getElementById(id);
|
|
48
|
+
if (existing)
|
|
49
|
+
return existing;
|
|
50
|
+
const style = target.createElement("style");
|
|
51
|
+
style.id = id;
|
|
52
|
+
style.textContent = MCP_VIEW_INTERACTION_CSS;
|
|
53
|
+
target.head.append(style);
|
|
54
|
+
return style;
|
|
55
|
+
}
|
|
@@ -83,18 +83,41 @@ export interface DataTableColumn<TRow> {
|
|
|
83
83
|
readonly align?: "left" | "right";
|
|
84
84
|
readonly render: (row: TRow) => ComponentChildren;
|
|
85
85
|
}
|
|
86
|
+
export interface DataTableDisclosure {
|
|
87
|
+
/** Localized accessible action, including the row identity. */
|
|
88
|
+
readonly label: string;
|
|
89
|
+
/** Supply only for locally expandable details. */
|
|
90
|
+
readonly expanded?: boolean;
|
|
91
|
+
readonly controls?: string;
|
|
92
|
+
readonly onOpen: () => void;
|
|
93
|
+
}
|
|
86
94
|
export interface DataTableProps<TRow> {
|
|
87
95
|
readonly label: string;
|
|
88
96
|
readonly rows: readonly TRow[];
|
|
89
97
|
readonly columns: readonly DataTableColumn<TRow>[];
|
|
90
98
|
readonly rowKey: (row: TRow) => string | number;
|
|
99
|
+
/** Returns context membership when contextSelection is supplied. */
|
|
91
100
|
readonly selected?: (row: TRow) => boolean;
|
|
92
101
|
readonly onSelect?: (row: TRow) => void;
|
|
102
|
+
/** Opt into context gestures. The consumer controls membership through selected. */
|
|
103
|
+
readonly contextSelection?: {
|
|
104
|
+
/** Double-click, long press or Shift+Space toggles one row. */
|
|
105
|
+
readonly onToggle: (row: TRow) => void;
|
|
106
|
+
/** Rectangle selection adds these rows to the existing context. */
|
|
107
|
+
readonly onAdd?: (rows: readonly TRow[]) => void;
|
|
108
|
+
/** Spoken row status; default labels are in English. */
|
|
109
|
+
readonly labels?: {
|
|
110
|
+
readonly selected: string;
|
|
111
|
+
readonly unselected: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
/** A row with a disclosure opens on activation. Other rows keep their optional selection action. */
|
|
115
|
+
readonly getDisclosure?: (row: TRow) => DataTableDisclosure | undefined;
|
|
93
116
|
readonly emptyLabel?: string;
|
|
94
117
|
readonly className?: string;
|
|
95
118
|
}
|
|
96
119
|
/** Accessible compact table; selection behavior is opt-in and keyboard-safe. */
|
|
97
|
-
export declare function DataTable<TRow>({ label, rows, columns, rowKey, selected, onSelect, emptyLabel, className, }: DataTableProps<TRow>): JSX.Element;
|
|
120
|
+
export declare function DataTable<TRow>({ label, rows, columns, rowKey, selected, onSelect, contextSelection, getDisclosure, emptyLabel, className, }: DataTableProps<TRow>): JSX.Element;
|
|
98
121
|
export interface ButtonProps {
|
|
99
122
|
readonly type?: "button" | "submit" | "reset";
|
|
100
123
|
readonly pressed?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/src/preact/components.tsx"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,qEAAqE;
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/src/preact/components.tsx"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,qEAAqE;AAOrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAErD,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,MAAM,GACN,SAAS,GACT,SAAS,GACT,QAAQ,CAAC;AAEb,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED,6EAA6E;AAC7E,wBAAgB,KAAK,CAAC,EAAE,GAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CAMlF;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED,oFAAoF;AACpF,wBAAgB,GAAG,CAAC,EAClB,KAAK,EACL,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M,EACN,SAAS,GACV,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAQnC;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,IAAgB,EAChB,IAAI,EACJ,QAAQ,EACR,SAAS,GACV,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CAajC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { createElement as _createElement } from "preact";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
|
|
3
3
|
/** @jsxImportSource preact */
|
|
4
4
|
/** Shared Preact presentation primitives for composable MCP Apps. */
|
|
5
|
+
import { eventStartedInInteractiveChild } from "./interactive-child.js";
|
|
5
6
|
import { createElement, render } from "preact";
|
|
7
|
+
import { useId } from "preact/hooks";
|
|
8
|
+
import { DisclosureChevron } from "./interaction-controls.js";
|
|
9
|
+
import { useVisualItemGestures } from "./visual-item-gestures.js";
|
|
6
10
|
/** Simple vertical composition primitive; it carries no domain semantics. */
|
|
7
11
|
export function Stack({ gap = "md", className, children }) {
|
|
8
12
|
return (_jsx("div", { class: classes("mcp-view-stack", className), "data-gap": gap, children: children }));
|
|
@@ -35,32 +39,91 @@ export function MetricGrid({ items, className }) {
|
|
|
35
39
|
export function KeyValueList({ items, layout = "inspector", className, }) {
|
|
36
40
|
return (_jsx("dl", { class: classes("mcp-view-key-values", className), "data-layout": layout === "inspector" ? undefined : layout, children: items.map((item) => (_jsxs("div", { class: "mcp-view-key-value", children: [_jsx("dt", { children: item.label }), _jsx("dd", { children: item.value })] }, item.id))) }));
|
|
37
41
|
}
|
|
42
|
+
function tableRowIntersects(item, rectangle) {
|
|
43
|
+
const header = item.parentElement?.previousElementSibling;
|
|
44
|
+
if (header?.localName !== "thead")
|
|
45
|
+
return true;
|
|
46
|
+
const style = header.ownerDocument.defaultView?.getComputedStyle?.(header);
|
|
47
|
+
if (style?.position !== "sticky" || style.top === "auto" ||
|
|
48
|
+
style.visibility === "hidden" || style.visibility === "collapse")
|
|
49
|
+
return true;
|
|
50
|
+
const head = header.getBoundingClientRect();
|
|
51
|
+
if (head.width <= 0 || head.height <= 0)
|
|
52
|
+
return true;
|
|
53
|
+
const row = item.getBoundingClientRect();
|
|
54
|
+
// Only reject an overlap completely covered by this table's sticky header.
|
|
55
|
+
return Math.max(rectangle.left, row.left) < head.left ||
|
|
56
|
+
Math.min(rectangle.right, row.right) > head.right ||
|
|
57
|
+
Math.max(rectangle.top, row.top) < head.top ||
|
|
58
|
+
Math.min(rectangle.bottom, row.bottom) > head.bottom;
|
|
59
|
+
}
|
|
38
60
|
/** Accessible compact table; selection behavior is opt-in and keyboard-safe. */
|
|
39
|
-
export function DataTable({ label, rows, columns, rowKey, selected, onSelect, emptyLabel = "No matching data", className, }) {
|
|
61
|
+
export function DataTable({ label, rows, columns, rowKey, selected, onSelect, contextSelection, getDisclosure, emptyLabel = "No matching data", className, }) {
|
|
62
|
+
const statusId = useId();
|
|
63
|
+
const describeSelection = contextSelection !== undefined && selected !== undefined;
|
|
64
|
+
const items = rows.map((row) => {
|
|
65
|
+
const key = rowKey(row);
|
|
66
|
+
return {
|
|
67
|
+
row,
|
|
68
|
+
key,
|
|
69
|
+
id: typeof key === "string" ? `s:${key}` : `n:${key}`,
|
|
70
|
+
disclosure: getDisclosure?.(row),
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
const byId = new Map(contextSelection ? items.map((item) => [item.id, item]) : []);
|
|
74
|
+
const gestureRoot = useVisualItemGestures({
|
|
75
|
+
onActivate: (id) => {
|
|
76
|
+
const item = byId.get(id);
|
|
77
|
+
if (!item)
|
|
78
|
+
return;
|
|
79
|
+
if (item.disclosure)
|
|
80
|
+
item.disclosure.onOpen();
|
|
81
|
+
else
|
|
82
|
+
onSelect?.(item.row);
|
|
83
|
+
},
|
|
84
|
+
onToggle: contextSelection && ((id) => {
|
|
85
|
+
const item = byId.get(id);
|
|
86
|
+
if (item)
|
|
87
|
+
contextSelection.onToggle(item.row);
|
|
88
|
+
}),
|
|
89
|
+
onAdd: contextSelection?.onAdd && ((ids) => {
|
|
90
|
+
const added = ids.flatMap((id) => {
|
|
91
|
+
const item = byId.get(id);
|
|
92
|
+
return item ? [item.row] : [];
|
|
93
|
+
});
|
|
94
|
+
contextSelection.onAdd?.(added);
|
|
95
|
+
}),
|
|
96
|
+
intersectsItem: tableRowIntersects,
|
|
97
|
+
});
|
|
40
98
|
if (rows.length === 0) {
|
|
41
99
|
return (_jsx("div", { "aria-label": label, class: classes("mcp-view-table-wrap", className), role: "status", children: _jsx(EmptyState, { children: emptyLabel }) }));
|
|
42
100
|
}
|
|
43
|
-
return (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
101
|
+
return (_jsxs("div", { class: classes("mcp-view-table-wrap", className), children: [_jsxs("table", { class: "mcp-view-table", "aria-label": label, children: [_jsx("thead", { children: _jsx("tr", { children: columns.map((column) => (_jsx("th", { scope: "col", "data-align": column.align ?? "left", children: column.label }, column.id))) }) }), _jsx("tbody", { ref: contextSelection ? gestureRoot : undefined, "data-visual-selection-surface": contextSelection?.onAdd ? "" : undefined, children: items.map(({ row, key, id, disclosure }) => {
|
|
102
|
+
const interactive = disclosure !== undefined || onSelect !== undefined;
|
|
103
|
+
const isSelected = selected?.(row);
|
|
104
|
+
const choose = disclosure ? disclosure.onOpen : () => onSelect?.(row);
|
|
105
|
+
return (_jsx("tr", { "aria-describedby": describeSelection
|
|
106
|
+
? `${statusId}-${isSelected ? "selected" : "unselected"}`
|
|
107
|
+
: undefined, "aria-selected": selected ? isSelected : undefined, "aria-keyshortcuts": contextSelection ? "Shift+Space" : undefined, class: isSelected && !contextSelection ? "mcp-view-selected" : undefined, "data-mcp-view-context-row": contextSelection && isSelected ? "selected" : undefined, "data-interactive": interactive || contextSelection ? "true" : undefined, "data-visual-item": contextSelection ? id : undefined, "data-visual-no-activate": contextSelection && !interactive ? "" : undefined, "data-visual-selection-start": contextSelection?.onAdd ? "" : undefined, tabIndex: contextSelection || (interactive && !disclosure) ? 0 : undefined, onClick: interactive && !contextSelection
|
|
108
|
+
? (event) => {
|
|
109
|
+
if (eventStartedInInteractiveChild(event.currentTarget, event.target))
|
|
110
|
+
return;
|
|
111
|
+
choose();
|
|
112
|
+
}
|
|
113
|
+
: undefined, onKeyDown: interactive && !contextSelection
|
|
114
|
+
? (event) => {
|
|
115
|
+
if (event.target !== event.currentTarget)
|
|
116
|
+
return;
|
|
117
|
+
if (event.key !== "Enter" && event.key !== " ")
|
|
118
|
+
return;
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
choose();
|
|
121
|
+
}
|
|
122
|
+
: undefined, children: columns.map((column, index) => (_jsxs("td", { "data-align": column.align ?? "left", children: [index === 0 && disclosure && (_jsx("button", { type: "button", class: "mcp-view-table-disclosure", "data-visual-immediate-activate": contextSelection ? "" : undefined, "aria-label": disclosure.label, "aria-expanded": disclosure.expanded, "aria-controls": disclosure.controls, onClick: (event) => {
|
|
123
|
+
event.stopPropagation();
|
|
124
|
+
disclosure.onOpen();
|
|
125
|
+
}, children: _jsx(DisclosureChevron, { expanded: disclosure.expanded === true }) })), column.render(row)] }, column.id))) }, key));
|
|
126
|
+
}) })] }), describeSelection && (_jsxs(_Fragment, { children: [_jsx("span", { hidden: true, id: `${statusId}-selected`, children: contextSelection.labels?.selected ?? "Selected for context" }), _jsx("span", { hidden: true, id: `${statusId}-unselected`, children: contextSelection.labels?.unselected ?? "Not selected for context" })] }))] }));
|
|
64
127
|
}
|
|
65
128
|
/** Small dashboard-safe action, never a product-wide navigation control. */
|
|
66
129
|
export function Button({ type = "button", pressed, disabled, title, className, onClick, children, }) {
|
|
@@ -155,22 +218,6 @@ export function CrossSelection({ label, value, status, className, }) {
|
|
|
155
218
|
export function StateMessage({ title, tone = "neutral", busy, children, className, }) {
|
|
156
219
|
return (_jsxs("div", { "aria-busy": busy, class: classes("mcp-view-state", className), "data-tone": tone, role: tone === "danger" ? "alert" : "status", children: [busy && _jsx("span", { "aria-hidden": "true", class: "mcp-view-state-busy" }), title && _jsx("strong", { children: title }), children && _jsx("div", { class: "mcp-view-state-detail", children: children })] }));
|
|
157
220
|
}
|
|
158
|
-
const INTERACTIVE_CHILD_SELECTOR = [
|
|
159
|
-
"a[href]",
|
|
160
|
-
"button",
|
|
161
|
-
"input",
|
|
162
|
-
"select",
|
|
163
|
-
"textarea",
|
|
164
|
-
"[role='button']",
|
|
165
|
-
"[role='link']",
|
|
166
|
-
].join(",");
|
|
167
|
-
function eventStartedInInteractiveChild(row, target) {
|
|
168
|
-
const candidate = target;
|
|
169
|
-
if (!candidate || typeof candidate.closest !== "function")
|
|
170
|
-
return false;
|
|
171
|
-
const interactive = candidate.closest(INTERACTIVE_CHILD_SELECTOR);
|
|
172
|
-
return interactive !== null && interactive !== row && row.contains(interactive);
|
|
173
|
-
}
|
|
174
221
|
function classes(...values) {
|
|
175
222
|
return values.filter(Boolean).join(" ");
|
|
176
223
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** @jsxImportSource preact */
|
|
2
|
+
/** Controlled presentation for exploring a reading and pinning it to context. */
|
|
3
|
+
import type { JSX } from "preact";
|
|
4
|
+
export interface ContextPinButtonProps {
|
|
5
|
+
/** Localized accessible action, including its target. */
|
|
6
|
+
readonly label: string;
|
|
7
|
+
readonly pressed: boolean | "mixed";
|
|
8
|
+
/** Draw two strokes for a collection, including when all or none are pinned. */
|
|
9
|
+
readonly group?: boolean;
|
|
10
|
+
readonly disabled?: boolean;
|
|
11
|
+
readonly className?: string;
|
|
12
|
+
readonly onToggle: (shiftKey: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
/** Independent action beside a row, card, or active point. The viewer owns its selection. */
|
|
15
|
+
export declare function ContextPinButton({ label, pressed, group, disabled, className, onToggle, }: ContextPinButtonProps): JSX.Element;
|
|
16
|
+
export interface DisclosureChevronProps {
|
|
17
|
+
readonly expanded: boolean;
|
|
18
|
+
readonly className?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Decorative leading glyph. The containing button supplies its label, action and expanded state. */
|
|
21
|
+
export declare function DisclosureChevron({ expanded, className }: DisclosureChevronProps): JSX.Element;
|
|
22
|
+
//# sourceMappingURL=interaction-controls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction-controls.d.ts","sourceRoot":"","sources":["../../../src/src/preact/interaction-controls.tsx"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,iFAAiF;AACjF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAElC,MAAM,WAAW,qBAAqB;IACpC,yDAAyD;IACzD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC;IACpC,gFAAgF;IAChF,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CAChD;AAED,6FAA6F;AAC7F,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,OAAO,EACP,KAAa,EACb,QAAQ,EACR,SAAS,EACT,QAAQ,GACT,EAAE,qBAAqB,GAAG,GAAG,CAAC,OAAO,CAmDrC;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,qGAAqG;AACrG,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,sBAAsB,GAAG,GAAG,CAAC,OAAO,CAmB9F"}
|