@mcpview/components 0.16.1 → 0.17.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 +8 -1
- package/esm/preact-components.d.ts +4 -0
- package/esm/preact-components.d.ts.map +1 -1
- package/esm/preact-components.js +2 -0
- package/esm/src/preact/mod.d.ts +2 -2
- package/esm/src/preact/mod.d.ts.map +1 -1
- package/esm/src/preact/mod.js +1 -1
- package/esm/src/preact/range-scrubber.d.ts +71 -0
- package/esm/src/preact/range-scrubber.d.ts.map +1 -0
- package/esm/src/preact/range-scrubber.js +51 -0
- package/esm/src/preact/stacked-distribution-bar.d.ts +63 -0
- package/esm/src/preact/stacked-distribution-bar.d.ts.map +1 -0
- package/esm/src/preact/stacked-distribution-bar.js +69 -0
- package/esm/src/theme.d.ts.map +1 -1
- package/esm/src/theme.js +289 -2
- package/package.json +1 -1
- package/script/preact-components.d.ts +4 -0
- package/script/preact-components.d.ts.map +1 -1
- package/script/preact-components.js +5 -1
- package/script/src/preact/mod.d.ts +2 -2
- package/script/src/preact/mod.d.ts.map +1 -1
- package/script/src/preact/mod.js +4 -1
- package/script/src/preact/range-scrubber.d.ts +71 -0
- package/script/src/preact/range-scrubber.d.ts.map +1 -0
- package/script/src/preact/range-scrubber.js +54 -0
- package/script/src/preact/stacked-distribution-bar.d.ts +63 -0
- package/script/src/preact/stacked-distribution-bar.d.ts.map +1 -0
- package/script/src/preact/stacked-distribution-bar.js +72 -0
- package/script/src/theme.d.ts.map +1 -1
- package/script/src/theme.js +289 -2
package/README.md
CHANGED
|
@@ -125,6 +125,13 @@ Numeric evidence:
|
|
|
125
125
|
- `IntervalPlot` for caller-declared deviation intervals laid out against a shared zero line. The
|
|
126
126
|
scale must contain zero; every bound and label is caller-supplied. Labels, interval tracks, and
|
|
127
127
|
readings share aligned columns across rows, including at narrow widths.
|
|
128
|
+
- `StackedDistributionBar` for one or more 100% horizontal proportional bars with an automatic or
|
|
129
|
+
caller-supplied legend, controlled `focusedId`, and optional `onSelect` interactivity (degrading
|
|
130
|
+
to static read-only marks when omitted). Segments accept theme tones (`SeriesChartTone`) or an
|
|
131
|
+
explicit CSS `color` token.
|
|
132
|
+
- `RangeScrubber` for an indexed or continuous native `<input type="range">` scrubber with
|
|
133
|
+
`aria-valuetext`, Prev/Next step buttons, optional quick-jump `actions` (hidden when `compact` is
|
|
134
|
+
true), optional lower/center/upper bound labels, and discrete event `markers` along the track.
|
|
128
135
|
|
|
129
136
|
`Sparkline` and `SeriesChart` series also accept `"accent"` and `"brand"` tones. These plot-specific
|
|
130
137
|
choices use `--mcp-view-accent` and `--mcp-view-brand`, respectively, and do not extend
|
|
@@ -597,7 +604,7 @@ local checkout); the `/surface` entry is derived from the latter unless
|
|
|
597
604
|
`MCP_VIEW_COMPONENTS_SURFACE_MODULE` names it. Run the generator from JSR:
|
|
598
605
|
|
|
599
606
|
```sh
|
|
600
|
-
deno run -A jsr:@mcpview/components@0.
|
|
607
|
+
deno run -A jsr:@mcpview/components@0.17.0/scaffold result-viewer ./result-viewer
|
|
601
608
|
```
|
|
602
609
|
|
|
603
610
|
The npm package contains only the runtime and presentation entry points. It does not export or ship
|
|
@@ -15,6 +15,10 @@ export { ArtifactRow, DrillHint, LimitGauge, PATH_BAR_DEFAULT_MAX_VISIBLE, PathB
|
|
|
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";
|
|
17
17
|
export type { IntervalPlotInterval, IntervalPlotProps, SeriesChartCursor, SeriesChartProps, SeriesChartReadout, SeriesChartSeries, SeriesChartSummaryItem, SeriesChartTone, SeriesPoint, SparklineProps, } from "./src/preact/plots.js";
|
|
18
|
+
export { StackedDistributionBar } from "./src/preact/stacked-distribution-bar.js";
|
|
19
|
+
export type { StackedDistributionBarProps, StackedDistributionLegendItem, StackedDistributionRow, StackedDistributionSegment, } from "./src/preact/stacked-distribution-bar.js";
|
|
20
|
+
export { RangeScrubber } from "./src/preact/range-scrubber.js";
|
|
21
|
+
export type { RangeScrubberAction, RangeScrubberMarker, RangeScrubberProps, } from "./src/preact/range-scrubber.js";
|
|
18
22
|
export { CollectionCard, ElementBody, ElementIdent, ElementLimit, ElementProvenance, ElementReading, ElementSection, ElementVerdict, SemanticElement, SemanticList, } from "./src/preact/semantic-element.js";
|
|
19
23
|
export type { CollectionCardProps, ElementBodyProps, ElementIdentProps, ElementLimitProps, ElementProvenanceProps, ElementReadingProps, ElementSectionProps, ElementVerdictProps, SemanticElementDensity, SemanticElementProps, SemanticListProps, } from "./src/preact/semantic-element.js";
|
|
20
24
|
export { Disclosure, FocusedView } from "./src/preact/focused-view.js";
|
|
@@ -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,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,eAAe,EACf,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,UAAU,EACV,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M,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,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,EA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package/esm/preact-components.js
CHANGED
|
@@ -12,6 +12,8 @@ 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
13
|
export { ArtifactRow, DrillHint, LimitGauge, PATH_BAR_DEFAULT_MAX_VISIBLE, PathBar, Slot3D, StaleBanner, TreeList, TypeBadge, } from "./src/preact/structural.js";
|
|
14
14
|
export { IntervalPlot, SeriesChart, Sparkline } from "./src/preact/plots.js";
|
|
15
|
+
export { StackedDistributionBar } from "./src/preact/stacked-distribution-bar.js";
|
|
16
|
+
export { RangeScrubber } from "./src/preact/range-scrubber.js";
|
|
15
17
|
export { CollectionCard, ElementBody, ElementIdent, ElementLimit, ElementProvenance, ElementReading, ElementSection, ElementVerdict, SemanticElement, SemanticList, } from "./src/preact/semantic-element.js";
|
|
16
18
|
export { Disclosure, FocusedView } from "./src/preact/focused-view.js";
|
|
17
19
|
export { SnippetLibrary } from "./src/preact/snippet-library.js";
|
package/esm/src/preact/mod.d.ts
CHANGED
|
@@ -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, SnippetLibrary, 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, RangeScrubber, renderStatusMessage, Row, SemanticElement, SemanticList, SeriesChart, Skeleton, Slot3D, SnippetLibrary, Sparkline, Stack, StackedDistributionBar, 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, DataTableDisclosure, 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";
|
|
5
|
+
export type { ArtifactFingerprint, ArtifactRowProps, ArtifactVerification, BadgeGroupProps, BadgeProps, ButtonProps, CardProps, CodeBlockProps, CollectionCardProps, CrossSelectionProps, DataTableColumn, DataTableDisclosure, 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, RangeScrubberAction, RangeScrubberMarker, RangeScrubberProps, RowProps, SemanticElementDensity, SemanticElementProps, SemanticListProps, SeriesChartCursor, SeriesChartProps, SeriesChartReadout, SeriesChartSeries, SeriesChartSummaryItem, SeriesChartTone, SeriesPoint, SkeletonProps, Slot3DProps, SnippetLibraryEntry, SnippetLibraryLabels, SnippetLibraryProps, SnippetLibrarySource, SparklineProps, StackedDistributionBarProps, StackedDistributionLegendItem, StackedDistributionRow, StackedDistributionSegment, 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,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,mBAAmB,EACnB,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
|
+
{"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,aAA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a,EACb,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,2BAA2B,EAC3B,6BAA6B,EAC7B,sBAAsB,EACtB,0BAA0B,EAC1B,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"}
|
package/esm/src/preact/mod.js
CHANGED
|
@@ -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, SnippetLibrary, 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, RangeScrubber, renderStatusMessage, Row, SemanticElement, SemanticList, SeriesChart, Skeleton, Slot3D, SnippetLibrary, Sparkline, Stack, StackedDistributionBar, StaleBanner, StateMessage, TextInput, Toolbar, TreeList, TypeBadge, } from "../../preact-components.js";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** @jsxImportSource preact */
|
|
2
|
+
/**
|
|
3
|
+
* Indexed / continuous range scrubber built on native `<input type="range">`
|
|
4
|
+
* with optional discrete event markers, Prev/Next step buttons, and quick-jump
|
|
5
|
+
* action buttons.
|
|
6
|
+
*
|
|
7
|
+
* Pure controlled Preact primitive: the caller owns `value`, formatted labels,
|
|
8
|
+
* and marker positions (`positionPct`).
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import type { JSX } from "preact";
|
|
13
|
+
import type { SeriesChartTone } from "./plots.js";
|
|
14
|
+
export interface RangeScrubberMarker {
|
|
15
|
+
readonly id?: string;
|
|
16
|
+
/** Caller-supplied horizontal offset percentage in `[0, 100]`. */
|
|
17
|
+
readonly positionPct: number;
|
|
18
|
+
/** Semantic or categorical theme tone (default `"accent"`). */
|
|
19
|
+
readonly tone?: SeriesChartTone;
|
|
20
|
+
/** Optional explicit CSS color or custom property (overrides `tone`). */
|
|
21
|
+
readonly color?: string;
|
|
22
|
+
/** Emphasize marker height for primary milestones (default `false`). */
|
|
23
|
+
readonly emphasized?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface RangeScrubberAction {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly label: string;
|
|
28
|
+
/** Value emitted via `onChange` when activated. */
|
|
29
|
+
readonly value: number;
|
|
30
|
+
readonly title?: string;
|
|
31
|
+
readonly pressed?: boolean;
|
|
32
|
+
readonly disabled?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface RangeScrubberProps {
|
|
35
|
+
/** Visible heading bound to the `<input type="range">` via `<label for=...>`. */
|
|
36
|
+
readonly label: string;
|
|
37
|
+
/** Accessible name of the range input (defaults to `label`). */
|
|
38
|
+
readonly ariaLabel?: string;
|
|
39
|
+
/** Caller-formatted `aria-valuetext` including units. */
|
|
40
|
+
readonly valueText: string;
|
|
41
|
+
readonly value: number;
|
|
42
|
+
readonly min: number;
|
|
43
|
+
readonly max: number;
|
|
44
|
+
readonly step?: number;
|
|
45
|
+
/** Optional lower-bound label below the track. */
|
|
46
|
+
readonly minLabel?: string;
|
|
47
|
+
/** Optional center annotation below the track (e.g. sample count). */
|
|
48
|
+
readonly centerLabel?: string;
|
|
49
|
+
/** Optional upper-bound label below the track. */
|
|
50
|
+
readonly maxLabel?: string;
|
|
51
|
+
/** Optional discrete event markers aligned below the range track. */
|
|
52
|
+
readonly markers?: readonly RangeScrubberMarker[];
|
|
53
|
+
/** Optional quick-jump buttons shown in the header toolbar (hidden when `compact` is true). */
|
|
54
|
+
readonly actions?: readonly RangeScrubberAction[];
|
|
55
|
+
/** Render Prev / Next stepping buttons in the header toolbar (default `true`). */
|
|
56
|
+
readonly showStepButtons?: boolean;
|
|
57
|
+
readonly prevLabel?: string;
|
|
58
|
+
readonly nextLabel?: string;
|
|
59
|
+
readonly prevTitle?: string;
|
|
60
|
+
readonly nextTitle?: string;
|
|
61
|
+
/** Accessible label for the step/jump toolbar (default `"Range controls"`). */
|
|
62
|
+
readonly toolbarLabel?: string;
|
|
63
|
+
/** Compact narrow-tier mode: hides quick-jump `actions` while keeping Prev/Next and track. */
|
|
64
|
+
readonly compact?: boolean;
|
|
65
|
+
readonly disabled?: boolean;
|
|
66
|
+
readonly onChange: (nextValue: number) => void;
|
|
67
|
+
readonly className?: string;
|
|
68
|
+
}
|
|
69
|
+
/** Accessible range scrubber with Prev/Next stepping, quick-jump buttons, and event markers. */
|
|
70
|
+
export declare function RangeScrubber({ label, ariaLabel, valueText, value, min, max, step, minLabel, centerLabel, maxLabel, markers, actions, showStepButtons, prevLabel, nextLabel, prevTitle, nextTitle, toolbarLabel, compact, disabled, onChange, className, }: RangeScrubberProps): JSX.Element;
|
|
71
|
+
//# sourceMappingURL=range-scrubber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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B,OAAe,EACf,QAAgB,EAChB,QAAQ,EACR,SAAS,GACV,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CA6HlC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { useId } from "preact/hooks";
|
|
3
|
+
import { Button, Toolbar } from "./components.js";
|
|
4
|
+
/** Accessible range scrubber with Prev/Next stepping, quick-jump buttons, and event markers. */
|
|
5
|
+
export function RangeScrubber({ label, ariaLabel, valueText, value, min, max, step = 1, minLabel, centerLabel, maxLabel, markers = [], actions = [], showStepButtons = true, prevLabel = "Prev", nextLabel = "Next", prevTitle = "Previous", nextTitle = "Next", toolbarLabel = "Range controls", compact = false, disabled = false, onChange, className, }) {
|
|
6
|
+
if (!Number.isFinite(min) || !Number.isFinite(max) || !Number.isFinite(value)) {
|
|
7
|
+
throw new TypeError("RangeScrubber min, max, and value must be finite numbers");
|
|
8
|
+
}
|
|
9
|
+
if (max < min) {
|
|
10
|
+
throw new RangeError("RangeScrubber max must be greater than or equal to min");
|
|
11
|
+
}
|
|
12
|
+
if (!Number.isFinite(step) || step <= 0) {
|
|
13
|
+
throw new RangeError("RangeScrubber step must be a positive finite number");
|
|
14
|
+
}
|
|
15
|
+
for (const marker of markers) {
|
|
16
|
+
if (!Number.isFinite(marker.positionPct)) {
|
|
17
|
+
throw new TypeError("RangeScrubber marker positionPct must be finite");
|
|
18
|
+
}
|
|
19
|
+
if (marker.positionPct < 0 || marker.positionPct > 100) {
|
|
20
|
+
throw new RangeError("RangeScrubber marker positionPct must be within [0, 100]");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const inputId = useId();
|
|
24
|
+
const clamped = Math.max(min, Math.min(max, value));
|
|
25
|
+
const span = max - min;
|
|
26
|
+
const progressPct = span > 0 ? Math.round(((clamped - min) / span) * 1000) / 10 : 100;
|
|
27
|
+
const isDisabled = disabled || span === 0;
|
|
28
|
+
const visibleActions = compact ? [] : actions;
|
|
29
|
+
const hasToolbar = showStepButtons || visibleActions.length > 0;
|
|
30
|
+
const hasBounds = minLabel !== undefined || centerLabel !== undefined || maxLabel !== undefined;
|
|
31
|
+
const stepBy = (delta) => {
|
|
32
|
+
const next = Math.max(min, Math.min(max, clamped + delta));
|
|
33
|
+
onChange(Number.isInteger(step) ? Math.round(next) : next);
|
|
34
|
+
};
|
|
35
|
+
return (_jsxs("div", { class: classes("mcp-view-scrubber", className), "data-compact": String(compact), children: [_jsxs("div", { class: "mcp-view-scrubber-header", children: [_jsx("label", { class: "mcp-view-scrubber-heading", for: inputId, children: label }), hasToolbar && (_jsxs(Toolbar, { label: toolbarLabel, className: "mcp-view-scrubber-actions", children: [showStepButtons && (_jsxs(_Fragment, { children: [_jsx(Button, { disabled: isDisabled || clamped <= min, title: prevTitle, onClick: () => stepBy(-step), children: prevLabel }), _jsx(Button, { disabled: isDisabled || clamped >= max, title: nextTitle, onClick: () => stepBy(step), children: nextLabel })] })), visibleActions.map((action) => (_jsx(Button, { pressed: action.pressed, disabled: disabled || action.disabled, title: action.title, onClick: () => onChange(action.value), children: action.label }, action.id)))] }))] }), _jsxs("div", { class: "mcp-view-scrubber-track-wrap", children: [_jsx("input", { id: inputId, type: "range", class: "mcp-view-scrubber-input", min: min, max: max, step: step, value: clamped, disabled: isDisabled, "aria-label": ariaLabel ?? label, "aria-valuetext": valueText, style: { "--mcp-view-scrubber-progress": `${progressPct}%` }, onInput: (event) => {
|
|
36
|
+
const next = Number.parseFloat(event.currentTarget.value);
|
|
37
|
+
if (Number.isFinite(next))
|
|
38
|
+
onChange(next);
|
|
39
|
+
} }), markers.length > 0 && (_jsx("div", { class: "mcp-view-scrubber-markers", "aria-hidden": "true", children: markers.map((marker, idx) => {
|
|
40
|
+
const style = {
|
|
41
|
+
left: `${marker.positionPct}%`,
|
|
42
|
+
};
|
|
43
|
+
if (marker.color) {
|
|
44
|
+
style["--mcp-view-scrubber-marker-bg"] = marker.color;
|
|
45
|
+
}
|
|
46
|
+
return (_jsx("span", { class: "mcp-view-scrubber-marker", "data-tone": marker.tone ?? "accent", "data-emphasized": marker.emphasized ? "true" : undefined, style: style }, marker.id ?? `m-${idx}`));
|
|
47
|
+
}) }))] }), hasBounds && (_jsxs("div", { class: "mcp-view-scrubber-bounds", "aria-hidden": "true", children: [_jsx("span", { children: minLabel ?? "" }), centerLabel !== undefined && _jsx("span", { children: centerLabel }), _jsx("span", { children: maxLabel ?? "" })] }))] }));
|
|
48
|
+
}
|
|
49
|
+
function classes(...names) {
|
|
50
|
+
return names.filter(Boolean).join(" ");
|
|
51
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** @jsxImportSource preact */
|
|
2
|
+
/**
|
|
3
|
+
* Multi-row 100% stacked horizontal distribution bar with optional interactive
|
|
4
|
+
* category selection and shared legend.
|
|
5
|
+
*
|
|
6
|
+
* Pure presentation: every percentage share, label, and inline caption is
|
|
7
|
+
* caller-supplied. Focus state is controlled by the caller (`focusedId`).
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import type { JSX } from "preact";
|
|
12
|
+
import type { SeriesChartTone } from "./plots.js";
|
|
13
|
+
export interface StackedDistributionSegment {
|
|
14
|
+
/** Stable identifier shared across rows and legend (matched by `focusedId` / `onSelect`). */
|
|
15
|
+
readonly id: string;
|
|
16
|
+
/** Human-readable category label. */
|
|
17
|
+
readonly label: string;
|
|
18
|
+
/** Caller-supplied percentage share in `[0, 100]`. */
|
|
19
|
+
readonly sharePct: number;
|
|
20
|
+
/** Caller-formatted percentage string (e.g. `"34.2%"`), used in accessible labels and tooltips. */
|
|
21
|
+
readonly shareLabel: string;
|
|
22
|
+
/** Optional caller-formatted quantity string (e.g. `"14m 20s"`, `"1,240 mm"`). */
|
|
23
|
+
readonly valueLabel?: string;
|
|
24
|
+
/** Optional caller-formatted short caption rendered inside the segment when wide enough. */
|
|
25
|
+
readonly inlineLabel?: string;
|
|
26
|
+
/** Semantic or categorical theme tone. */
|
|
27
|
+
readonly tone?: SeriesChartTone;
|
|
28
|
+
/** Optional explicit CSS color or custom property (overrides `tone`). */
|
|
29
|
+
readonly color?: string;
|
|
30
|
+
/** Optional explicit tooltip text; defaults to `label: shareLabel` (+ `valueLabel`). */
|
|
31
|
+
readonly title?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface StackedDistributionRow {
|
|
34
|
+
readonly id: string;
|
|
35
|
+
readonly label: string;
|
|
36
|
+
readonly segments: readonly StackedDistributionSegment[];
|
|
37
|
+
}
|
|
38
|
+
export interface StackedDistributionLegendItem {
|
|
39
|
+
readonly id: string;
|
|
40
|
+
readonly label: string;
|
|
41
|
+
readonly tone?: SeriesChartTone;
|
|
42
|
+
readonly color?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface StackedDistributionBarProps {
|
|
45
|
+
/** Accessible name of the distribution figure. */
|
|
46
|
+
readonly label: string;
|
|
47
|
+
/** One or more rows of proportional segments. */
|
|
48
|
+
readonly rows: readonly StackedDistributionRow[];
|
|
49
|
+
/** Explicit legend entries; when omitted, deduplicated automatically from `rows`. */
|
|
50
|
+
readonly legend?: readonly StackedDistributionLegendItem[];
|
|
51
|
+
/** Whether to render the shared legend below the rows (default `true`). */
|
|
52
|
+
readonly showLegend?: boolean;
|
|
53
|
+
/** Accessible name for the legend group (default `"Distribution legend"`). */
|
|
54
|
+
readonly legendLabel?: string;
|
|
55
|
+
/** Controlled active category identifier (`null` / `undefined` = none focused). */
|
|
56
|
+
readonly focusedId?: string | null;
|
|
57
|
+
/** Selection handler; when omitted, segments and legend render as static read-only marks. */
|
|
58
|
+
readonly onSelect?: (id: string) => void;
|
|
59
|
+
readonly className?: string;
|
|
60
|
+
}
|
|
61
|
+
/** Stacked 100% horizontal distribution bars comparing proportional shares across rows. */
|
|
62
|
+
export declare function StackedDistributionBar({ label, rows, legend, showLegend, legendLabel, focusedId, onSelect, className, }: StackedDistributionBarProps): JSX.Element;
|
|
63
|
+
//# sourceMappingURL=stacked-distribution-bar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stacked-distribution-bar.d.ts","sourceRoot":"","sources":["../../../src/src/preact/stacked-distribution-bar.tsx"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,0BAA0B;IACzC,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,mGAAmG;IACnG,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,kFAAkF;IAClF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,4FAA4F;IAC5F,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC;IAChC,yEAAyE;IACzE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,wFAAwF;IACxF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,SAAS,0BAA0B,EAAE,CAAC;CAC1D;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,2BAA2B;IAC1C,kDAAkD;IAClD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,QAAQ,CAAC,IAAI,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACjD,qFAAqF;IACrF,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,6BAA6B,EAAE,CAAC;IAC3D,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,mFAAmF;IACnF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,6FAA6F;IAC7F,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,2FAA2F;AAC3F,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,IAAI,EACJ,MAAM,EACN,UAAiB,EACjB,WAAmC,EACnC,SAAgB,EAChB,QAAQ,EACR,SAAS,GACV,EAAE,2BAA2B,GAAG,GAAG,CAAC,OAAO,CAqJ3C"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
|
|
2
|
+
/** Stacked 100% horizontal distribution bars comparing proportional shares across rows. */
|
|
3
|
+
export function StackedDistributionBar({ label, rows, legend, showLegend = true, legendLabel = "Distribution legend", focusedId = null, onSelect, className, }) {
|
|
4
|
+
for (const row of rows) {
|
|
5
|
+
for (const seg of row.segments) {
|
|
6
|
+
if (!Number.isFinite(seg.sharePct)) {
|
|
7
|
+
throw new TypeError(`StackedDistributionBar segment "${seg.id}" sharePct must be finite`);
|
|
8
|
+
}
|
|
9
|
+
if (seg.sharePct < 0 || seg.sharePct > 100) {
|
|
10
|
+
throw new RangeError(`StackedDistributionBar segment "${seg.id}" sharePct must be within [0, 100]`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const legendItems = legend ??
|
|
15
|
+
deriveLegend(rows);
|
|
16
|
+
return (_jsxs("figure", { class: classes("mcp-view-stacked-bar", className), "aria-label": label, children: [_jsx("div", { class: "mcp-view-stacked-bar-rows", children: rows.map((row) => (_jsxs("div", { class: "mcp-view-stacked-bar-row", children: [_jsx("span", { class: "mcp-view-stacked-bar-row-label", children: row.label }), _jsx("div", { class: "mcp-view-stacked-bar-track", role: "group", "aria-label": `${row.label} distribution`, children: row.segments.map((seg) => {
|
|
17
|
+
const isFocused = focusedId !== null && focusedId === seg.id;
|
|
18
|
+
const isDimmed = focusedId !== null && !isFocused;
|
|
19
|
+
const title = seg.title ??
|
|
20
|
+
(seg.valueLabel
|
|
21
|
+
? `${seg.label}: ${seg.shareLabel} (${seg.valueLabel})`
|
|
22
|
+
: `${seg.label}: ${seg.shareLabel}`);
|
|
23
|
+
const style = {
|
|
24
|
+
width: `${seg.sharePct}%`,
|
|
25
|
+
};
|
|
26
|
+
if (seg.color) {
|
|
27
|
+
style["--mcp-view-stacked-segment-bg"] = seg.color;
|
|
28
|
+
}
|
|
29
|
+
const content = seg.inlineLabel
|
|
30
|
+
? (_jsx("span", { class: "mcp-view-stacked-bar-segment-label", children: seg.inlineLabel }))
|
|
31
|
+
: null;
|
|
32
|
+
if (onSelect) {
|
|
33
|
+
return (_jsx("button", { type: "button", class: "mcp-view-stacked-bar-segment", "data-tone": seg.tone ?? "accent", "data-focused": String(isFocused), "data-dimmed": String(isDimmed), "aria-label": title, "aria-pressed": isFocused, style: style, title: title, onClick: () => onSelect(seg.id), children: content }, seg.id));
|
|
34
|
+
}
|
|
35
|
+
return (_jsx("span", { class: "mcp-view-stacked-bar-segment", "data-tone": seg.tone ?? "accent", "data-focused": String(isFocused), "data-dimmed": String(isDimmed), style: style, title: title, children: content }, seg.id));
|
|
36
|
+
}) })] }, row.id))) }), showLegend && legendItems.length > 0 && (_jsx("div", { class: "mcp-view-stacked-bar-legend", role: "group", "aria-label": legendLabel, children: legendItems.map((item) => {
|
|
37
|
+
const isFocused = focusedId !== null && focusedId === item.id;
|
|
38
|
+
const isDimmed = focusedId !== null && !isFocused;
|
|
39
|
+
const swatchStyle = item.color
|
|
40
|
+
? { "--mcp-view-stacked-segment-bg": item.color }
|
|
41
|
+
: undefined;
|
|
42
|
+
const inner = (_jsxs(_Fragment, { children: [_jsx("span", { class: "mcp-view-stacked-bar-swatch", "data-tone": item.tone ?? "accent", style: swatchStyle, "aria-hidden": "true" }), _jsx("span", { children: item.label })] }));
|
|
43
|
+
if (onSelect) {
|
|
44
|
+
return (_jsx("button", { type: "button", class: "mcp-view-stacked-bar-legend-item", "data-focused": String(isFocused), "data-dimmed": String(isDimmed), "aria-pressed": isFocused, onClick: () => onSelect(item.id), children: inner }, item.id));
|
|
45
|
+
}
|
|
46
|
+
return (_jsx("span", { class: "mcp-view-stacked-bar-legend-item", "data-focused": String(isFocused), "data-dimmed": String(isDimmed), children: inner }, item.id));
|
|
47
|
+
}) }))] }));
|
|
48
|
+
}
|
|
49
|
+
function deriveLegend(rows) {
|
|
50
|
+
const seen = new Set();
|
|
51
|
+
const items = [];
|
|
52
|
+
for (const row of rows) {
|
|
53
|
+
for (const seg of row.segments) {
|
|
54
|
+
if (seen.has(seg.id))
|
|
55
|
+
continue;
|
|
56
|
+
seen.add(seg.id);
|
|
57
|
+
items.push({
|
|
58
|
+
id: seg.id,
|
|
59
|
+
label: seg.label,
|
|
60
|
+
tone: seg.tone,
|
|
61
|
+
color: seg.color,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return items;
|
|
66
|
+
}
|
|
67
|
+
function classes(...names) {
|
|
68
|
+
return names.filter(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