@mechane-ai/elements 0.45.0 → 0.47.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 +353 -50
- package/bin/mechane-elements-catalog.mjs +42 -4
- package/dist/ai.js +268 -202
- package/dist/catalog.json +2480 -71
- package/dist/categorical-values-DdfGIowV.js +107 -0
- package/dist/cells--Bd1fQFR.js +384 -0
- package/dist/chart-cursor-1mFd48Jc.js +23 -0
- package/dist/chart-link-AE_xuxiP.js +35 -0
- package/dist/chart-tones-ei3BC2AL.js +27 -0
- package/dist/charts/cartesian.js +1 -2792
- package/dist/charts/cells.js +1 -0
- package/dist/charts/comparison.js +1 -0
- package/dist/charts/distribution.js +1 -709
- package/dist/charts/figure.js +3404 -0
- package/dist/charts/graph.js +1 -641
- package/dist/charts/hierarchy.js +1 -112
- package/dist/charts/image.js +1 -0
- package/dist/charts/matrix.js +3 -637
- package/dist/charts/plot.js +15 -0
- package/dist/charts/relationship.js +1 -0
- package/dist/charts/text.js +1 -0
- package/dist/charts/timeline.js +1 -233
- package/dist/charts/transforms.js +677 -0
- package/dist/charts/trend.js +1 -0
- package/dist/charts.js +8 -3
- package/dist/{code-block-Cpfr7B6a.js → code-block-DioAM2bZ.js} +67 -52
- package/dist/collections.js +1 -1735
- package/dist/color-legend-CIo7DhXB.js +62 -0
- package/dist/content/code.js +1 -1
- package/dist/content/diff.js +67 -66
- package/dist/content/link.js +1 -1
- package/dist/content/markdown.js +2 -2
- package/dist/content/tree.js +2 -2
- package/dist/{content-link-CGeFFb9F.js → content-link-NWuHp5rC.js} +1 -1
- package/dist/content.js +1 -1
- package/dist/csp.js +6 -11
- package/dist/dates-Cww8UR_n.js +810 -0
- package/dist/dumbbell-plot-B2ZTgQaI.js +508 -0
- package/dist/embedding-map-CGM_k6lC.js +1929 -0
- package/dist/feedback.js +1 -1
- package/dist/figure-format-B8kRZMlo.js +36 -0
- package/dist/figure-frame-wRkIEAwe.js +270 -0
- package/dist/forms/dates.js +1 -750
- package/dist/{forms-DeU0Tiv3.js → forms-CEbwzlRR.js} +50 -41
- package/dist/forms.js +3 -3
- package/dist/heatmap-scale-Zte6Ya-g.js +20 -0
- package/dist/image-grid-CVA4SOy_.js +598 -0
- package/dist/index.js +1 -1
- package/dist/kits/evaluation.js +431 -0
- package/dist/kits/explainers.js +452 -0
- package/dist/kits/interpretability.js +1033 -0
- package/dist/kits/operations.js +239 -0
- package/dist/kits/training.js +335 -0
- package/dist/label-place-Z0fryBZb.js +42 -0
- package/dist/layout.js +207 -207
- package/dist/locate-Bcg3QcP4.js +11 -0
- package/dist/navigation.js +4 -3
- package/dist/packages/ai/src/conversation.d.ts +2 -0
- package/dist/packages/ai/src/prompt-input.d.ts +7 -2
- package/dist/packages/charts/src/cartesian/bar-chart.d.ts +40 -21
- package/dist/packages/charts/src/cartesian/bar-data.d.ts +15 -4
- package/dist/packages/charts/src/cartesian/bar-overlays.d.ts +7 -3
- package/dist/packages/charts/src/cartesian/breakdown-bar.d.ts +10 -8
- package/dist/packages/charts/src/cartesian/bridge-chart.d.ts +20 -16
- package/dist/packages/charts/src/cartesian/bridge-data.d.ts +5 -4
- package/dist/packages/charts/src/cartesian/composition-bars.d.ts +8 -4
- package/dist/packages/charts/src/cartesian/index.d.ts +6 -5
- package/dist/packages/charts/src/cartesian/reference-lines.d.ts +25 -18
- package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +37 -26
- package/dist/packages/charts/src/cartesian/sparkline.d.ts +14 -2
- package/dist/packages/charts/src/cartesian/time-series-bands.d.ts +3 -2
- package/dist/packages/charts/src/cartesian/time-series-data.d.ts +12 -2
- package/dist/packages/charts/src/cartesian/time-series-line.d.ts +2 -2
- package/dist/packages/charts/src/cartesian/time-series-overlays.d.ts +6 -4
- package/dist/packages/charts/src/cartesian/time-series.d.ts +61 -27
- package/dist/packages/charts/src/cartesian/value-labels.d.ts +22 -0
- package/dist/packages/charts/src/categorical-values.d.ts +15 -10
- package/dist/packages/charts/src/cells/bar-cell.d.ts +13 -0
- package/dist/packages/charts/src/cells/cell-layout.d.ts +81 -0
- package/dist/packages/charts/src/cells/change-cell.d.ts +17 -0
- package/dist/packages/charts/src/cells/heat-cell.d.ts +19 -0
- package/dist/packages/charts/src/cells/index.d.ts +11 -0
- package/dist/packages/charts/src/cells/interval-cell.d.ts +16 -0
- package/dist/packages/charts/src/cells/spark-cell.d.ts +22 -0
- package/dist/packages/charts/src/chart-frame.d.ts +17 -12
- package/dist/packages/charts/src/chart-grid.d.ts +19 -0
- package/dist/packages/charts/src/chart-input.d.ts +1 -9
- package/dist/packages/charts/src/chart-inspection.d.ts +1 -2
- package/dist/packages/charts/src/chart-link.d.ts +56 -0
- package/dist/packages/charts/src/chart-range.d.ts +33 -0
- package/dist/packages/charts/src/chart-rows.d.ts +20 -0
- package/dist/packages/charts/src/chart-theme.d.ts +17 -0
- package/dist/packages/charts/src/chart.d.ts +73 -0
- package/dist/packages/charts/src/comparison/bullet-bar.d.ts +34 -0
- package/dist/packages/charts/src/comparison/comparison-plot.d.ts +54 -0
- package/dist/packages/charts/src/comparison/dot-plot.d.ts +41 -0
- package/dist/packages/charts/src/comparison/dumbbell-plot.d.ts +33 -0
- package/dist/packages/charts/src/comparison/index.d.ts +6 -0
- package/dist/packages/charts/src/distribution/box-plot.d.ts +40 -0
- package/dist/packages/charts/src/distribution/distribution-input.d.ts +5 -3
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +28 -161
- package/dist/packages/charts/src/distribution/ecdf.d.ts +16 -15
- package/dist/packages/charts/src/distribution/group-plot-input.d.ts +35 -0
- package/dist/packages/charts/src/distribution/group-plot-layout.d.ts +79 -0
- package/dist/packages/charts/src/distribution/group-plot.d.ts +73 -0
- package/dist/packages/charts/src/distribution/histogram.d.ts +16 -16
- package/dist/packages/charts/src/distribution/index.d.ts +11 -0
- package/dist/packages/charts/src/distribution/interval-plot.d.ts +16 -13
- package/dist/packages/charts/src/distribution/ranked-bars.d.ts +17 -14
- package/dist/packages/charts/src/distribution/ridgeline.d.ts +34 -0
- package/dist/packages/charts/src/distribution/strip-plot.d.ts +37 -0
- package/dist/packages/charts/src/distribution/violin-plot.d.ts +34 -0
- package/dist/packages/charts/src/figure/figure-format.d.ts +34 -0
- package/dist/packages/charts/src/figure/figure-frame.d.ts +47 -0
- package/dist/packages/charts/src/figure/figure-props.d.ts +54 -0
- package/dist/packages/charts/src/figure/tone-scope.d.ts +32 -0
- package/dist/packages/charts/src/graph/attribution-graph.d.ts +62 -0
- package/dist/packages/charts/src/graph/attribution-layout.d.ts +88 -0
- package/dist/packages/charts/src/graph/flow-diagram.d.ts +14 -15
- package/dist/packages/charts/src/graph/flow-layout.d.ts +4 -2
- package/dist/packages/charts/src/graph/graph-canvas.d.ts +33 -0
- package/dist/packages/charts/src/graph/index.d.ts +6 -2
- package/dist/packages/charts/src/graph/relation-graph.d.ts +24 -13
- package/dist/packages/charts/src/graph/tree-diagram.d.ts +41 -0
- package/dist/packages/charts/src/graph/tree-layout.d.ts +71 -0
- package/dist/packages/charts/src/hierarchy/area-mark.d.ts +17 -0
- package/dist/packages/charts/src/hierarchy/icicle.d.ts +35 -0
- package/dist/packages/charts/src/hierarchy/index.d.ts +2 -0
- package/dist/packages/charts/src/hierarchy/partition-layout.d.ts +25 -0
- package/dist/packages/charts/src/hierarchy/treemap-layout.d.ts +26 -0
- package/dist/packages/charts/src/hierarchy/treemap.d.ts +11 -9
- package/dist/packages/charts/src/image/attribution-legend.d.ts +13 -0
- package/dist/packages/charts/src/image/attribution-overlay.d.ts +50 -0
- package/dist/packages/charts/src/image/attribution-ramp.d.ts +16 -0
- package/dist/packages/charts/src/image/image-atlas.d.ts +37 -0
- package/dist/packages/charts/src/image/image-fill.d.ts +9 -0
- package/dist/packages/charts/src/image/image-grid.d.ts +26 -0
- package/dist/packages/charts/src/image/image-input.d.ts +27 -0
- package/dist/packages/charts/src/image/image-tile.d.ts +27 -0
- package/dist/packages/charts/src/image/index.d.ts +7 -0
- package/dist/packages/charts/src/index.d.ts +16 -1
- package/dist/packages/charts/src/matrix/attention-matrix.d.ts +41 -0
- package/dist/packages/charts/src/matrix/calendar-heatmap.d.ts +37 -0
- package/dist/packages/charts/src/matrix/color-legend.d.ts +9 -2
- package/dist/packages/charts/src/matrix/confusion-matrix.d.ts +36 -0
- package/dist/packages/charts/src/matrix/correlation-matrix.d.ts +34 -0
- package/dist/packages/charts/src/matrix/heatmap-scale.d.ts +8 -2
- package/dist/packages/charts/src/matrix/index.d.ts +14 -3
- package/dist/packages/charts/src/matrix/matrix-cells.d.ts +27 -3
- package/dist/packages/charts/src/matrix/matrix-figure.d.ts +50 -0
- package/dist/packages/charts/src/matrix/matrix-mark.d.ts +34 -0
- package/dist/packages/charts/src/matrix/matrix-presets.d.ts +20 -0
- package/dist/packages/charts/src/matrix/matrix-range.d.ts +45 -0
- package/dist/packages/charts/src/matrix/matrix-strip.d.ts +13 -14
- package/dist/packages/charts/src/matrix/matrix-types.d.ts +40 -0
- package/dist/packages/charts/src/matrix/matrix.d.ts +13 -11
- package/dist/packages/charts/src/matrix/token-heatmap.d.ts +16 -10
- package/dist/packages/charts/src/plot/contours.d.ts +45 -0
- package/dist/packages/charts/src/plot/index.d.ts +49 -0
- package/dist/packages/charts/src/plot/label-place.d.ts +35 -0
- package/dist/packages/charts/src/plot/locate.d.ts +18 -0
- package/dist/packages/charts/src/plot/path.d.ts +39 -0
- package/dist/packages/charts/src/plot/plot-axes.d.ts +20 -0
- package/dist/packages/charts/src/plot/plot-layout.d.ts +221 -0
- package/dist/packages/charts/src/plot/plot-marks.d.ts +124 -0
- package/dist/packages/charts/src/plot/plot-surface.d.ts +32 -0
- package/dist/packages/charts/src/plot/render/density-layer.d.ts +17 -0
- package/dist/packages/charts/src/plot/render/hit-index.d.ts +37 -0
- package/dist/packages/charts/src/plot/render/plot-viewport.d.ts +39 -0
- package/dist/packages/charts/src/plot/render/point-layer.d.ts +41 -0
- package/dist/packages/charts/src/plot/render/theme-colors.d.ts +15 -0
- package/dist/packages/charts/src/plot/scale.d.ts +48 -0
- package/dist/packages/charts/src/plot/ticks.d.ts +34 -0
- package/dist/packages/charts/src/plot-width.d.ts +3 -3
- package/dist/packages/charts/src/relationship/contour-plot.d.ts +61 -0
- package/dist/packages/charts/src/relationship/density-map.d.ts +45 -0
- package/dist/packages/charts/src/relationship/embedding-map.d.ts +75 -0
- package/dist/packages/charts/src/relationship/index.d.ts +11 -0
- package/dist/packages/charts/src/relationship/level-legend.d.ts +11 -0
- package/dist/packages/charts/src/relationship/measures.d.ts +85 -0
- package/dist/packages/charts/src/relationship/parallel-coordinates.d.ts +30 -0
- package/dist/packages/charts/src/relationship/range-controls.d.ts +20 -0
- package/dist/packages/charts/src/relationship/scatter-matrix.d.ts +20 -0
- package/dist/packages/charts/src/spec/chart-guide.d.ts +21 -0
- package/dist/packages/charts/src/spec/figure-registry.d.ts +44 -0
- package/dist/packages/charts/src/spec/figure-spec.d.ts +147 -0
- package/dist/packages/charts/src/spec/figure-text.d.ts +8 -0
- package/dist/packages/charts/src/spec/figure.d.ts +12 -0
- package/dist/packages/charts/src/spec/guide-data.d.ts +85 -0
- package/dist/packages/charts/src/spec/index.d.ts +10 -0
- package/dist/packages/charts/src/spec/validate-figure.d.ts +15 -0
- package/dist/packages/charts/src/text/index.d.ts +11 -0
- package/dist/packages/charts/src/text/token-examples.d.ts +42 -0
- package/dist/packages/charts/src/text/token-grid.d.ts +47 -0
- package/dist/packages/charts/src/text/token-links.d.ts +49 -0
- package/dist/packages/charts/src/text/token-predictions.d.ts +38 -0
- package/dist/packages/charts/src/text/token-scale.d.ts +20 -0
- package/dist/packages/charts/src/text/token-text.d.ts +39 -0
- package/dist/packages/charts/src/timeline/event-strip.d.ts +70 -0
- package/dist/packages/charts/src/timeline/index.d.ts +3 -1
- package/dist/packages/charts/src/timeline/waterfall.d.ts +29 -14
- package/dist/packages/charts/src/transforms/bins.d.ts +91 -0
- package/dist/packages/charts/src/transforms/density.d.ts +53 -0
- package/dist/packages/charts/src/transforms/fits.d.ts +50 -0
- package/dist/packages/charts/src/transforms/index.d.ts +19 -0
- package/dist/packages/charts/src/transforms/matrices.d.ts +49 -0
- package/dist/packages/charts/src/transforms/quantiles.d.ts +96 -0
- package/dist/packages/charts/src/transforms/ranks.d.ts +44 -0
- package/dist/packages/charts/src/transforms/runs.d.ts +47 -0
- package/dist/packages/charts/src/transforms/sampling.d.ts +75 -0
- package/dist/packages/charts/src/transforms/smoothing.d.ts +41 -0
- package/dist/packages/charts/src/transforms/values.d.ts +70 -0
- package/dist/packages/charts/src/trend/bump-chart.d.ts +33 -0
- package/dist/packages/charts/src/trend/column-figure.d.ts +38 -0
- package/dist/packages/charts/src/trend/column-positions.d.ts +21 -0
- package/dist/packages/charts/src/trend/curve-chart.d.ts +69 -0
- package/dist/packages/charts/src/trend/end-labels.d.ts +40 -0
- package/dist/packages/charts/src/trend/horizon-chart.d.ts +37 -0
- package/dist/packages/charts/src/trend/index.d.ts +10 -0
- package/dist/packages/charts/src/trend/line-locate.d.ts +21 -0
- package/dist/packages/charts/src/trend/runs-chart.d.ts +50 -0
- package/dist/packages/charts/src/trend/slope-chart.d.ts +35 -0
- package/dist/packages/collections/src/collection-controls.d.ts +5 -1
- package/dist/packages/collections/src/collection-filters.d.ts +4 -1
- package/dist/packages/collections/src/control-toolbar.d.ts +13 -0
- package/dist/packages/collections/src/data-table-layout.d.ts +78 -0
- package/dist/packages/collections/src/data-table-rows.d.ts +54 -0
- package/dist/packages/collections/src/data-table-styles.d.ts +340 -0
- package/dist/packages/collections/src/data-table-text.d.ts +13 -0
- package/dist/packages/collections/src/data-table-trigger.d.ts +23 -0
- package/dist/packages/collections/src/data-table.d.ts +3 -85
- package/dist/packages/collections/src/index.d.ts +11 -6
- package/dist/packages/collections/src/query-controls.d.ts +6 -2
- package/dist/packages/collections/src/table-results.d.ts +47 -13
- package/dist/packages/collections/src/timeline.d.ts +1 -0
- package/dist/packages/collections/src/use-collection-controls.d.ts +2 -1
- package/dist/packages/collections/src/use-table-window.d.ts +25 -0
- package/dist/packages/content/src/viewer.d.ts +8 -0
- package/dist/packages/core/src/disclosure.d.ts +9 -1
- package/dist/packages/core/src/index.d.ts +1 -0
- package/dist/packages/core/src/route-link.d.ts +11 -0
- package/dist/packages/forms/src/dates/date-inputs.d.ts +3 -1
- package/dist/packages/forms/src/file-picker.d.ts +15 -0
- package/dist/packages/forms/src/form-controls.d.ts +1 -6
- package/dist/packages/forms/src/forms.d.ts +4 -1
- package/dist/packages/forms/src/index.d.ts +4 -2
- package/dist/packages/forms/src/selection.d.ts +14 -0
- package/dist/packages/foundations/src/csp/index.d.ts +1 -1
- package/dist/packages/foundations/src/csp/provider.d.ts +7 -2
- package/dist/packages/kits/src/evaluation/evaluation-data.d.ts +31 -0
- package/dist/packages/kits/src/evaluation/index.d.ts +8 -0
- package/dist/packages/kits/src/evaluation/leaderboard-cells.d.ts +62 -0
- package/dist/packages/kits/src/evaluation/leaderboard.d.ts +59 -0
- package/dist/packages/kits/src/evaluation/model-comparison.d.ts +59 -0
- package/dist/packages/kits/src/evaluation/score-breakdown.d.ts +33 -0
- package/dist/packages/kits/src/explainers/bound-value.d.ts +29 -0
- package/dist/packages/kits/src/explainers/figures.d.ts +31 -0
- package/dist/packages/kits/src/explainers/index.d.ts +8 -0
- package/dist/packages/kits/src/explainers/linked-target.d.ts +22 -0
- package/dist/packages/kits/src/explainers/story-steps.d.ts +46 -0
- package/dist/packages/kits/src/explainers/term.d.ts +29 -0
- package/dist/packages/kits/src/interpretability/attention-head-grid.d.ts +56 -0
- package/dist/packages/kits/src/interpretability/attribution-workbench.d.ts +29 -0
- package/dist/packages/kits/src/interpretability/embedding-atlas.d.ts +41 -0
- package/dist/packages/kits/src/interpretability/feature-card.d.ts +33 -0
- package/dist/packages/kits/src/interpretability/feature-list.d.ts +51 -0
- package/dist/packages/kits/src/interpretability/feature-logits.d.ts +23 -0
- package/dist/packages/kits/src/interpretability/features.d.ts +70 -0
- package/dist/packages/kits/src/interpretability/index.d.ts +16 -0
- package/dist/packages/kits/src/interpretability/kit-styles.d.ts +118 -0
- package/dist/packages/kits/src/interpretability/logit-lens.d.ts +50 -0
- package/dist/packages/kits/src/interpretability/node-panel.d.ts +32 -0
- package/dist/packages/kits/src/interpretability/shared-link.d.ts +8 -0
- package/dist/packages/kits/src/interpretability/steering-panel.d.ts +52 -0
- package/dist/packages/kits/src/operations/budget-board.d.ts +49 -0
- package/dist/packages/kits/src/operations/incident-timeline.d.ts +30 -0
- package/dist/packages/kits/src/operations/index.d.ts +6 -0
- package/dist/packages/kits/src/operations/service-health.d.ts +66 -0
- package/dist/packages/kits/src/training/index.d.ts +8 -0
- package/dist/packages/kits/src/training/run-dashboard.d.ts +49 -0
- package/dist/packages/kits/src/training/run-legend.d.ts +21 -0
- package/dist/packages/kits/src/training/run-marker.d.ts +5 -0
- package/dist/packages/kits/src/training/run-state.d.ts +7 -0
- package/dist/packages/kits/src/training/run-table.d.ts +63 -0
- package/dist/packages/kits/src/training/runs-overview.d.ts +20 -0
- package/dist/packages/kits/src/training/runs.d.ts +34 -0
- package/dist/packages/navigation/src/index.d.ts +1 -1
- package/dist/path-BglsXpnO.js +59 -0
- package/dist/{pierre-diff-B3tD3-6z.js → pierre-diff-DlvjyuJn.js} +1 -1
- package/dist/plot-axes-DJkLW4wk.js +100 -0
- package/dist/plot-layout-BEuoOHbs.js +911 -0
- package/dist/plot-marks-A64v7aTw.js +226 -0
- package/dist/plot-surface-CJTIqtck.js +51 -0
- package/dist/{plot-width-CIqBiHcd.js → plot-width-DcqtSgzb.js} +22 -3
- package/dist/point-layer-C-EYETAt.js +655 -0
- package/dist/reference-lines-CWA8VeUR.js +82 -0
- package/dist/scale-C2xgZyZN.js +63 -0
- package/dist/slope-chart-DT22h_ym.js +1279 -0
- package/dist/{src-gqEebHEa.js → src-1EHkSFS-.js} +395 -274
- package/dist/{src-DBNncL7_.js → src-BPTDJqt0.js} +48 -68
- package/dist/{src-Dcs3SZ9V.js → src-CExIrXPC.js} +170 -194
- package/dist/src-CGc_hjxJ.js +409 -0
- package/dist/{src-DcW_gMX8.js → src-CpdJlDhO.js} +480 -362
- package/dist/src-D5NXRJZe.js +2195 -0
- package/dist/src-DIS0YOj0.js +44 -0
- package/dist/styles2.css +574 -161
- package/dist/time-series-IB3CB93O.js +2668 -0
- package/dist/token-heatmap-C00DnoNO.js +1354 -0
- package/dist/token-predictions-Cxx29iDr.js +1093 -0
- package/dist/tone-scope-DKiSw-JR.js +32 -0
- package/dist/tree-diagram-DsckNKaW.js +1629 -0
- package/dist/treemap-9_DpLCW9.js +472 -0
- package/dist/values-963L6n1m.js +65 -0
- package/dist/violin-plot-BhPHKXsN.js +1291 -0
- package/dist/waterfall-CGksuTy5.js +576 -0
- package/package.json +57 -7
- package/recipes/allocation-report.tsx +15 -7
- package/skills/extend-elements/SKILL.md +134 -0
- package/skills/review-elements/SKILL.md +118 -0
- package/skills/upgrade-elements/SKILL.md +36 -0
- package/skills/upgrade-elements/references/releases.md +242 -0
- package/skills/use-elements/SKILL.md +70 -13
- package/skills/use-elements/references/agent.md +57 -0
- package/skills/use-elements/references/charts.md +384 -0
- package/skills/use-elements/references/collections.md +89 -0
- package/skills/use-elements/references/conversations.md +47 -0
- package/skills/use-elements/references/figures.md +173 -0
- package/skills/use-elements/references/forms.md +81 -0
- package/skills/use-elements/references/kits.md +198 -0
- package/skills/use-elements/references/styling.md +70 -0
- package/skills/use-elements/references/workspace.md +3 -3
- package/dist/categorical-values-DZLGQVW1.js +0 -63
- package/dist/chart-frame-Ztktqs1b.js +0 -255
- package/dist/chart-input-BO3BqlFO.js +0 -22
- package/dist/chart-navigation-BAbb5PV9.js +0 -154
- package/dist/header-styles-COxCYFZx.js +0 -90
- package/dist/packages/charts/src/chart-navigation.d.ts +0 -39
- package/dist/packages/charts/src/chart-surface.d.ts +0 -27
- package/dist/packages/navigation/src/route-link.d.ts +0 -2
- package/dist/src-Bk7M67zy.js +0 -396
package/README.md
CHANGED
|
@@ -11,18 +11,37 @@ navigation and modifier-key behavior.
|
|
|
11
11
|
|
|
12
12
|
## Build with an agent
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
The package ships skills that teach a coding agent this library, matched to the installed version. Copy them into the
|
|
15
|
+
agent's skills directory from a project with Elements installed:
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
```sh
|
|
18
|
+
pnpm exec mechane-elements-catalog --install-skills .claude/skills
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Use `.agents/skills` or another directory for an agent that reads skills from there. Run the command again after each
|
|
22
|
+
upgrade; it replaces the three skills with the new version's copies.
|
|
23
|
+
|
|
24
|
+
| Skill | Use it to |
|
|
25
|
+
| ---------------------------------------------------- | ------------------------------------------------------------------------ |
|
|
26
|
+
| [use-elements](skills/use-elements/SKILL.md) | Choose components and build a page, with a guide for each family. |
|
|
27
|
+
| [review-elements](skills/review-elements/SKILL.md) | Check a page by keyboard, read state, width, theme and agent access. |
|
|
28
|
+
| [upgrade-elements](skills/upgrade-elements/SKILL.md) | Move an app to a new version, with the changes each release needs. |
|
|
29
|
+
| [extend-elements](skills/extend-elements/SKILL.md) | Change the library itself. It stays in the package and is not installed. |
|
|
30
|
+
|
|
31
|
+
An agent without skills can read the same files in place. Add one line to its instructions file, such as `AGENTS.md`:
|
|
32
|
+
"Before building UI, read `node_modules/@mechane-ai/elements/skills/use-elements/SKILL.md`."
|
|
33
|
+
|
|
34
|
+
Find a recipe by task, or a component by its export name:
|
|
18
35
|
|
|
19
36
|
```sh
|
|
20
37
|
pnpm exec mechane-elements-catalog "searchable table with filters"
|
|
38
|
+
pnpm exec mechane-elements-catalog segmentedcontrol
|
|
21
39
|
```
|
|
22
40
|
|
|
23
|
-
The catalog connects a task to the example's TSX, public imports, and rendered Storybook story
|
|
24
|
-
programmatically at `@mechane-ai/elements/catalog.json`. When
|
|
25
|
-
client to `http://localhost:6006/mcp` to explore the examples while
|
|
41
|
+
The catalog connects a task to the example's TSX, public imports, and rendered Storybook story, and a component to its
|
|
42
|
+
import path and declaration file. Read the same index programmatically at `@mechane-ai/elements/catalog.json`. When
|
|
43
|
+
running the local Elements Storybook, connect an MCP client to `http://localhost:6006/mcp` to explore the examples while
|
|
44
|
+
developing.
|
|
26
45
|
|
|
27
46
|
## Enable an agent in an app
|
|
28
47
|
|
|
@@ -46,12 +65,12 @@ available actions. After requesting a change, read the resulting state, includin
|
|
|
46
65
|
data owner. Keep credentials and private values out of observable labels, descriptions, and results. The application
|
|
47
66
|
authorizes data reads and mutations on the server.
|
|
48
67
|
|
|
49
|
-
| What the agent needs | What to look for in the mounted UI
|
|
50
|
-
| ----------------------- |
|
|
51
|
-
| Find and open a record | Use the named `collection-query`, then re-read `collection-results` until its `status` is `ready`. A pending or failed read can retain the previous rows.
|
|
52
|
-
| Know where the user is | Read the `page-title`, current `
|
|
53
|
-
| Inspect a chart or file | Query chart or tree items for the visible label and identifier. Read the chart's formatted `readout` after inspection. After selection, query the inspector's labeled `detail-field` entries.
|
|
54
|
-
| Complete a form | Use visible field validation and `form-status` for pending, error, or success. Use `Field.Root isSensitive` to hide sensitive labels, values, and validation from the bridge. Put `ConfirmButton` on the action that performs a consequential mutation.
|
|
68
|
+
| What the agent needs | What to look for in the mounted UI |
|
|
69
|
+
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
70
|
+
| Find and open a record | Use the named `collection-query`, then re-read `collection-results` until its `status` is `ready`. A pending or failed read can retain the previous rows. Each item is a row named as a reader sees it. Use the `open`, `sort`, `select`, `previousPage` and `nextPage` actions of `collection-results`. |
|
|
71
|
+
| Know where the user is | Read the `page-title`, current `link` or tab, and the `page-section` at the reading position. Scrolling updates the section an agent can query. |
|
|
72
|
+
| Inspect a chart or file | Query chart or tree items for the visible label and identifier. Read the chart's formatted `readout` after inspection. After selection, query the inspector's labeled `detail-field` entries. |
|
|
73
|
+
| Complete a form | Use visible field validation and `form-status` for pending, error, or success. Use `Field.Root isSensitive` to hide sensitive labels, values, and validation from the bridge. Put `ConfirmButton` on the action that performs a consequential mutation. |
|
|
55
74
|
|
|
56
75
|
## Install
|
|
57
76
|
|
|
@@ -96,38 +115,52 @@ emitted layers and selector specificity.
|
|
|
96
115
|
|
|
97
116
|
Every path below belongs to `@mechane-ai/elements`. There is one package, version, and stylesheet.
|
|
98
117
|
|
|
99
|
-
| Entry
|
|
100
|
-
|
|
|
101
|
-
| Root
|
|
102
|
-
| `/forms`
|
|
103
|
-
| `/forms/dates`
|
|
104
|
-
| `/overlays`
|
|
105
|
-
| `/feedback`
|
|
106
|
-
| `/navigation`
|
|
107
|
-
| `/navigation/commands`
|
|
108
|
-
| `/layout`
|
|
109
|
-
| `/collections`
|
|
110
|
-
| `/content`
|
|
111
|
-
| `/content/link`
|
|
112
|
-
| `/content/markdown`
|
|
113
|
-
| `/content/code`
|
|
114
|
-
| `/content/diff`
|
|
115
|
-
| `/content/tree`
|
|
116
|
-
| `/ai`
|
|
117
|
-
| `/charts`
|
|
118
|
-
| `/charts/cartesian`
|
|
119
|
-
| `/charts/distribution`
|
|
120
|
-
| `/charts/matrix`
|
|
121
|
-
| `/charts/graph`
|
|
122
|
-
| `/charts/hierarchy`
|
|
123
|
-
| `/charts/timeline`
|
|
124
|
-
| `/
|
|
125
|
-
| `/
|
|
126
|
-
| `/
|
|
127
|
-
| `/
|
|
128
|
-
| `/
|
|
129
|
-
| `/
|
|
130
|
-
| `/
|
|
118
|
+
| Entry | Responsibility |
|
|
119
|
+
| ------------------------ | -------------------------------------------------------------------------------------------------------------- |
|
|
120
|
+
| Root | Buttons, text, surfaces, disclosure, avatars, and CopyValue. |
|
|
121
|
+
| `/forms` | Fields, inputs, selection, appearance picking, file picking, and settings sections. |
|
|
122
|
+
| `/forms/dates` | Civil-date pickers, range selection, and a controlled event month. |
|
|
123
|
+
| `/overlays` | Dialog, Drawer, Menu, Popover, Preview, Tooltip, and AlertDialog. |
|
|
124
|
+
| `/feedback` | Async regions, skeletons, progress, meters, notices, empty states, and toasts. |
|
|
125
|
+
| `/navigation` | Tabs, page navigation, breadcrumbs, skip links, and shortcut labels. |
|
|
126
|
+
| `/navigation/commands` | Command palette and scoped application-owned shortcuts. |
|
|
127
|
+
| `/layout` | Application shell, sidebar, toolbars, compound record pages, and resizable panes. |
|
|
128
|
+
| `/collections` | Tables, inspectors, collection controls, timelines, metrics, and timestamps. |
|
|
129
|
+
| `/content` | Trace, JSON, recorded logs, and stack traces. |
|
|
130
|
+
| `/content/link` | Safe content links without a renderer dependency. |
|
|
131
|
+
| `/content/markdown` | Completed and streaming Markdown, embedded headings, and inert previews. |
|
|
132
|
+
| `/content/code` | Source-preserving code highlighting. |
|
|
133
|
+
| `/content/diff` | File changes and patches. |
|
|
134
|
+
| `/content/tree` | File paths, statuses, and controlled selection. |
|
|
135
|
+
| `/ai` | Conversations, messages, prompts, approvals, sources, and citations. |
|
|
136
|
+
| `/charts` | Figure props, formats, tone scope, linked inspection, frames, legends, and grids. |
|
|
137
|
+
| `/charts/cartesian` | Lines, ranges, areas, sparklines, small multiples, bars, bridges, and scatter plots. |
|
|
138
|
+
| `/charts/distribution` | Histograms, cumulative distributions, intervals, ranked values, box, violin, strip, and ridgeline plots. |
|
|
139
|
+
| `/charts/matrix` | Matrices and their confusion, correlation, attention, and calendar presets, token heatmaps, and color legends. |
|
|
140
|
+
| `/charts/graph` | Supplied relationships, weighted flows, attribution graphs, and tree diagrams. |
|
|
141
|
+
| `/charts/hierarchy` | Treemaps and icicles. |
|
|
142
|
+
| `/charts/timeline` | Waterfall intervals and instants, and lanes of events. |
|
|
143
|
+
| `/charts/trend` | Curves over a step or layer, many runs, slopes, rank changes, and horizon rows. |
|
|
144
|
+
| `/charts/comparison` | Dot plots, dumbbells, and bullet bars. |
|
|
145
|
+
| `/charts/relationship` | Contours, scatter matrices, parallel coordinates, embedding maps, and density maps. |
|
|
146
|
+
| `/charts/text` | Token examples, next-token predictions, layer by position token grids, and token links. |
|
|
147
|
+
| `/charts/image` | Image grids, attribution overlays, and image atlases. |
|
|
148
|
+
| `/charts/cells` | Bar, heat, change, interval, and spark graphics for table cells. |
|
|
149
|
+
| `/charts/transforms` | Bins, densities, fits, quantiles, ranks, smoothing, and sampling that an application calls before drawing. |
|
|
150
|
+
| `/charts/plot` | The plot kernel: scales, ticks, axes, marks, and states for a chart the library lacks. |
|
|
151
|
+
| `/charts/figure` | Figure specs as JSON: validate a spec, draw it, describe it, and read the chart guide. |
|
|
152
|
+
| `/kits/explainers` | Numbered figures, linked terms, bound values, and guided steps. |
|
|
153
|
+
| `/kits/training` | A run dashboard, a run table, and a sweep overview. |
|
|
154
|
+
| `/kits/operations` | Service health, budgets against objectives, and an incident timeline. |
|
|
155
|
+
| `/kits/evaluation` | A model leaderboard, a score breakdown, and a two-model comparison. |
|
|
156
|
+
| `/kits/interpretability` | Feature cards and lists, an attribution workbench, attention heads, a logit lens, a feature map, and steering. |
|
|
157
|
+
| `/theme` | Light and dark theme props. |
|
|
158
|
+
| `/agent` | Optional UI SDK bridge for a host that enables component inspection and actions. |
|
|
159
|
+
| `/csp` | Application-supplied content security policy configuration. |
|
|
160
|
+
| `/tokens` | Compiled token references for runtime styles. |
|
|
161
|
+
| `/tokens.stylex` | Variable definitions for StyleX authoring and themes. |
|
|
162
|
+
| `/constants.stylex` | Compile-time conditions, palette values, layers, and shared geometry. |
|
|
163
|
+
| `/styles.css` | Component styles and token defaults. |
|
|
131
164
|
|
|
132
165
|
Focused entries keep renderer and chart dependencies out of basic controls. There is no all-components barrel. Renderers
|
|
133
166
|
initialize when used, without a consumer-managed worker pool or grammar CDN. The
|
|
@@ -181,8 +214,14 @@ application owns which view is active and when to unmount it; use this for a dra
|
|
|
181
214
|
inspection. `WorkbenchScroll` requires an accessible `label`; its `isFlush` mode leaves list insets to the table. Its
|
|
182
215
|
`scrollRestorationId` identifies the actual scroll region for application-owned restoration. Layout wrappers leave
|
|
183
216
|
sequential keyboard navigation to their controls. Tables and viewers add a named scroll stop when overflow needs one.
|
|
184
|
-
Interactive
|
|
185
|
-
|
|
217
|
+
Interactive charts have one Tab stop, a local datum cursor, and arrow-key inspection. Enter or Space activates supplied
|
|
218
|
+
selection; Escape dismisses the readout while retaining the cursor.
|
|
219
|
+
|
|
220
|
+
Change callbacks receive the UI SDK's change details after the value. `details.reason` names what happened, such as
|
|
221
|
+
`input-change`, `clear-press` or `item-press`, and `details.source` says whether a pointer, the keyboard, an agent or
|
|
222
|
+
code caused it. `Input` and `Textarea` `onValueChange`, a collection's `search.onChange` and `search.onSubmit`, a
|
|
223
|
+
filter's `onChange`, `FilterChips` `onRemove`, a chart's `onSelectedChange` and a table's `onSortChange` and
|
|
224
|
+
`onSelectionChange` all pass them.
|
|
186
225
|
|
|
187
226
|
`Workbench` accepts an optional `inspector={{ label: 'Workspace', content: <WorkspaceFiles /> }}`. The application
|
|
188
227
|
supplies the accessible name with the panel content and owns opening, closing, and focus restoration. The inspector
|
|
@@ -211,10 +250,15 @@ Set `rowSizing="content"` for records that need multiline cells; virtualization
|
|
|
211
250
|
belongs in a detail view or a deliberately content-sized row, not behind a clipped control. Use `DataTableText` for a
|
|
212
251
|
primary string and optional secondary string inside one cell; both text elements own their ellipsis. Arbitrary nested
|
|
213
252
|
layouts do not inherit text truncation. Give dates and numeric values sufficient column width or explicit content
|
|
214
|
-
sizing. The table owns its cell insets, so an enclosing page should not add another gutter around its rows.
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
253
|
+
sizing. The table owns its cell insets, so an enclosing page should not add another gutter around its rows. A table's
|
|
254
|
+
row actions share one Tab stop. Arrow keys move by a row, Page Up and Page Down by ten, and Home and End reach the first
|
|
255
|
+
and last supplied row, including rows the window has not rendered. With `selectedIds`, a row's checkbox toggles it,
|
|
256
|
+
Shift and a click select the range from the row chosen before, and the header checkbox selects every supplied row. The
|
|
257
|
+
control row above a table is one UI SDK toolbar: applied filter chips, find, filters and display share a Tab stop, and
|
|
258
|
+
arrow keys move between them. `CollectionEnd` renders nothing when complete unless an explicit summary is supplied.
|
|
259
|
+
`Timeline.Root` and `Timeline.Item` compose readable activity with supplied titles, icons, timestamps, metadata, and
|
|
260
|
+
body content, without interpreting domain events. The events share one Tab stop on the UI SDK timeline, and arrow keys
|
|
261
|
+
move between them.
|
|
218
262
|
|
|
219
263
|
`CommandActivity` from `/ai` presents a collapsed Bash command with supplied execution state. Its `CommandDetails` body
|
|
220
264
|
is also available for an existing trace disclosure. Supply command and output text separately, with explicit omission
|
|
@@ -320,6 +364,265 @@ Build placeholders from the same layouts as their destinations. `DataTablePlaceh
|
|
|
320
364
|
`DataTableColumnLayout` definitions and optional decorative cells. The async region owns the loading announcement; its
|
|
321
365
|
placeholders must not contain interactive controls, invented records, or independent status announcements.
|
|
322
366
|
|
|
367
|
+
## Charts and figures
|
|
368
|
+
|
|
369
|
+
Every chart is built from one plot kernel and takes the same figure props. This is the idea:
|
|
370
|
+
|
|
371
|
+
- **One kernel.** Scales, ticks, axes, marks, readout and keyboard cursor come from `/charts/plot`, so charts behave
|
|
372
|
+
alike. A chart owns its input and the arrangement of parts.
|
|
373
|
+
- **Shared figure props.** Each chart takes `title`, `description`, `locale`, `source`, `coverage`, `transforms`,
|
|
374
|
+
`status` and `emptyLabel`. Selection is `selected` with `onSelectedChange`. `Waterfall` takes a subset of these.
|
|
375
|
+
`Sparkline`, `ColorLegend` and the table cells are compact graphics and do not take them.
|
|
376
|
+
- **Declared formats and locale.** A number is written from `Intl` options and the figure's required `locale`. There is
|
|
377
|
+
no formatter-function prop. Axes are `{ label, domain?, scale?, format, tickFormat? }`, and heights are `'compact'`,
|
|
378
|
+
`'regular'` or `'tall'`.
|
|
379
|
+
- **One meaning per visual channel.** Hue names a thing, lightness is a magnitude, two hues around a middle are a signed
|
|
380
|
+
value, a dashed stroke is modelled, a pale band is uncertainty, a hollow mark is missing and gray is context.
|
|
381
|
+
- **States.** Each figure has loading, empty, invalid and partial states. A figure that draws part of its data says how
|
|
382
|
+
much beside its title. The footnote names the source and each transform.
|
|
383
|
+
|
|
384
|
+
Statistics stay outside charts. Compute bins, quantiles, densities and fits with `/charts/transforms` and name them in
|
|
385
|
+
`transforms`.
|
|
386
|
+
|
|
387
|
+
### Choose a chart
|
|
388
|
+
|
|
389
|
+
The table is the library's own `chartGuide`: one entry per registered chart, grouped by family, with the question the
|
|
390
|
+
chart answers. Each family is the import entry `@mechane-ai/elements/charts/<family>`. The
|
|
391
|
+
[chart guide](https://github.com/mechane-ai/mechane/blob/main/workspaces/core/docs/ui-charts.md#choose-a-chart) adds
|
|
392
|
+
when to use each chart and when another is better. Use a table when exact comparison matters more than shape.
|
|
393
|
+
|
|
394
|
+
| Family entry | Chart | The reader asks |
|
|
395
|
+
| ---------------------- | --------------------- | ------------------------------------------------------------------------ |
|
|
396
|
+
| `/charts/trend` | `CurveChart` | How did a metric change over training steps or another ordered variable? |
|
|
397
|
+
| `/charts/trend` | `RunsChart` | How does one run compare with the whole sweep it belongs to? |
|
|
398
|
+
| `/charts/trend` | `SlopeChart` | How did each item move between two to six conditions? |
|
|
399
|
+
| `/charts/trend` | `BumpChart` | How did the ranking of items change across stages? |
|
|
400
|
+
| `/charts/trend` | `HorizonChart` | Which of many series run above or below normal, and when? |
|
|
401
|
+
| `/charts/comparison` | `DotPlot` | How do a few models compare on each of several measures? |
|
|
402
|
+
| `/charts/comparison` | `DumbbellPlot` | How much did each row change between two measurements? |
|
|
403
|
+
| `/charts/comparison` | `BulletBar` | Is each measure meeting its target? |
|
|
404
|
+
| `/charts/cartesian` | `BarChart` | How large is each amount, by category and series? |
|
|
405
|
+
| `/charts/cartesian` | `BridgeChart` | Which changes add up to the difference between two totals? |
|
|
406
|
+
| `/charts/cartesian` | `BreakdownBar` | How does one total split into parts? |
|
|
407
|
+
| `/charts/cartesian` | `ScatterPlot` | How do two measures of the same records relate? |
|
|
408
|
+
| `/charts/cartesian` | `LineChart` | How did a measure change over time? |
|
|
409
|
+
| `/charts/cartesian` | `AreaChart` | How did a total and its parts change over time? |
|
|
410
|
+
| `/charts/cartesian` | `SmallMultiples` | How do several related measures move together over the same time? |
|
|
411
|
+
| `/charts/cartesian` | `Sparkline` | Which way is one measure trending, at a glance? |
|
|
412
|
+
| `/charts/distribution` | `Histogram` | How are the values of one measure distributed? |
|
|
413
|
+
| `/charts/distribution` | `ECDF` | What share of values falls below a given level? |
|
|
414
|
+
| `/charts/distribution` | `IntervalPlot` | What is each estimate, and how uncertain is it? |
|
|
415
|
+
| `/charts/distribution` | `RankedBars` | Which items rank highest on one measure? |
|
|
416
|
+
| `/charts/distribution` | `BoxPlot` | How do the distributions of several groups compare? |
|
|
417
|
+
| `/charts/distribution` | `ViolinPlot` | How does the shape of a distribution differ between groups? |
|
|
418
|
+
| `/charts/distribution` | `StripPlot` | Where does every single value of each group fall? |
|
|
419
|
+
| `/charts/distribution` | `Ridgeline` | How does a distribution shift across many ordered groups? |
|
|
420
|
+
| `/charts/matrix` | `Matrix` | What is the value for every pair of two categories? |
|
|
421
|
+
| `/charts/matrix` | `TokenHeatmap` | Which tokens of a text carry the most of a score? |
|
|
422
|
+
| `/charts/matrix` | `ConfusionMatrix` | Which classes does a classifier confuse with which? |
|
|
423
|
+
| `/charts/matrix` | `CorrelationMatrix` | Which measures move together? |
|
|
424
|
+
| `/charts/matrix` | `AttentionMatrix` | Which earlier tokens does each token attend to? |
|
|
425
|
+
| `/charts/matrix` | `CalendarHeatmap` | How does a daily measure vary by week and weekday? |
|
|
426
|
+
| `/charts/graph` | `RelationGraph` | How are a few named things connected? |
|
|
427
|
+
| `/charts/graph` | `FlowDiagram` | Where does a quantity go between stages? |
|
|
428
|
+
| `/charts/graph` | `AttributionGraph` | Which features carry a model’s answer from the prompt to the output? |
|
|
429
|
+
| `/charts/graph` | `TreeDiagram` | How is a hierarchy structured? |
|
|
430
|
+
| `/charts/hierarchy` | `Treemap` | Which parts make up most of a total? |
|
|
431
|
+
| `/charts/hierarchy` | `Icicle` | How does a total split through nested levels? |
|
|
432
|
+
| `/charts/timeline` | `Waterfall` | When did each step of a request or run start and end? |
|
|
433
|
+
| `/charts/timeline` | `EventStrip` | What happened when, across a few kinds of events? |
|
|
434
|
+
| `/charts/relationship` | `ContourPlot` | What does a value look like over two continuous inputs? |
|
|
435
|
+
| `/charts/relationship` | `ScatterMatrix` | How do several measures relate to each other, pair by pair? |
|
|
436
|
+
| `/charts/relationship` | `ParallelCoordinates` | Which records do well on many measures at once? |
|
|
437
|
+
| `/charts/relationship` | `EmbeddingMap` | How do many items cluster in a learned embedding space? |
|
|
438
|
+
| `/charts/relationship` | `DensityMap` | Where are points concentrated over two measures? |
|
|
439
|
+
| `/charts/text` | `TokenExamples` | On which passages, and which tokens, does a feature fire? |
|
|
440
|
+
| `/charts/text` | `TokenPredictions` | Which tokens does the model expect next, and how did that change? |
|
|
441
|
+
| `/charts/text` | `TokenGrid` | How does a per-token value change across layers or conditions? |
|
|
442
|
+
| `/charts/text` | `TokenLinks` | Which tokens most influence which later tokens? |
|
|
443
|
+
| `/charts/image` | `ImageGrid` | What do a set of images look like, with a value for each? |
|
|
444
|
+
| `/charts/image` | `AttributionOverlay` | Which parts of an image drove the model’s output? |
|
|
445
|
+
| `/charts/image` | `ImageAtlas` | How do images arrange over a two-dimensional layout? |
|
|
446
|
+
|
|
447
|
+
`ColorLegend`, the table cells in `/charts/cells`, the placeholders and the kits are not registered charts, so the guide
|
|
448
|
+
does not list them. `chartGuide` is exported from `@mechane-ai/elements/charts/figure`, so an application or an agent
|
|
449
|
+
can read the same guidance at run time. Each entry has `chart`, `family`, `question`, `use`, `avoid` and `example`, a
|
|
450
|
+
small valid figure spec.
|
|
451
|
+
|
|
452
|
+
```ts
|
|
453
|
+
import { chartGuide } from '@mechane-ai/elements/charts/figure';
|
|
454
|
+
|
|
455
|
+
const entry = chartGuide.find((item) => item.chart === 'Histogram');
|
|
456
|
+
// entry?.question, entry?.use, entry?.avoid, entry?.example
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
### Link figures and keep one hue per thing
|
|
460
|
+
|
|
461
|
+
Give a thing one id in every figure. `ToneScope` gives each id one hue. `ChartLink` shares one inspected id between the
|
|
462
|
+
figures inside it: pointing at a record in one figure marks the record with the same id in the others. `ChartGrid` is a
|
|
463
|
+
`ChartLink` and a `ToneScope` laid out as panels with one title.
|
|
464
|
+
|
|
465
|
+
```tsx
|
|
466
|
+
import { ChartLink, ToneScope } from '@mechane-ai/elements/charts';
|
|
467
|
+
import { DotPlot } from '@mechane-ai/elements/charts/comparison';
|
|
468
|
+
import { CurveChart } from '@mechane-ai/elements/charts/trend';
|
|
469
|
+
|
|
470
|
+
export function Runs() {
|
|
471
|
+
return (
|
|
472
|
+
<ToneScope ids={['base', 'wide']}>
|
|
473
|
+
<ChartLink>
|
|
474
|
+
<CurveChart
|
|
475
|
+
title="Validation loss"
|
|
476
|
+
locale="en-US"
|
|
477
|
+
series={[
|
|
478
|
+
{
|
|
479
|
+
id: 'base',
|
|
480
|
+
label: 'Base',
|
|
481
|
+
points: [
|
|
482
|
+
{ x: 100, y: 4.2 },
|
|
483
|
+
{ x: 1000, y: 2.6 },
|
|
484
|
+
],
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
id: 'wide',
|
|
488
|
+
label: 'Wide',
|
|
489
|
+
points: [
|
|
490
|
+
{ x: 100, y: 4.1 },
|
|
491
|
+
{ x: 1000, y: 2.2 },
|
|
492
|
+
],
|
|
493
|
+
},
|
|
494
|
+
]}
|
|
495
|
+
x={{ label: 'Training step', scale: 'log', format: { maximumFractionDigits: 0 } }}
|
|
496
|
+
y={{ label: 'Loss (nats)', format: { maximumFractionDigits: 2 } }}
|
|
497
|
+
/>
|
|
498
|
+
<DotPlot
|
|
499
|
+
title="Score by task"
|
|
500
|
+
locale="en-US"
|
|
501
|
+
rows={[{ id: 'code', label: 'Code' }]}
|
|
502
|
+
series={[
|
|
503
|
+
{ id: 'base', label: 'Base', values: { code: 0.61 } },
|
|
504
|
+
{ id: 'wide', label: 'Wide', values: { code: 0.68 } },
|
|
505
|
+
]}
|
|
506
|
+
value={{ label: 'Accuracy', domain: [0, 1], format: { style: 'percent' } }}
|
|
507
|
+
/>
|
|
508
|
+
</ChartLink>
|
|
509
|
+
</ToneScope>
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
A figure that draws series can also take emphasis from outside, which never changes selection:
|
|
515
|
+
|
|
516
|
+
- `CurveChart`, `DotPlot` and `BarChart` take `highlighted`, the id of the one series drawn at full strength while the
|
|
517
|
+
others fade, or `null` for none. Left out on `CurveChart` and `DotPlot`, it follows the enclosing `ChartLink`, so
|
|
518
|
+
hovering a table row that inspects a series id lights that series. `RunsChart` takes `featured`, a required list of
|
|
519
|
+
the run ids drawn in their hue, and no `highlighted`.
|
|
520
|
+
- `CurveChart` takes `labels`: `'legend'` (the default) names the series in a legend, `'inline'` writes each name at the
|
|
521
|
+
end of its line when there is room, and `'none'` leaves them out when a legend beside a grid already names them.
|
|
522
|
+
- `useScopedTone(id)` returns the hue the enclosing `ToneScope` gives an id, or `undefined` outside a scope. Use it so a
|
|
523
|
+
word or a diagram part matches its chart.
|
|
524
|
+
- `useChartLinkControl()` returns `{ inspected, inspect }` for the enclosing `ChartLink`, or `undefined` outside one.
|
|
525
|
+
Call `inspect(id, { reason, event })` from prose or a diagram to point every linked figure at a record.
|
|
526
|
+
|
|
527
|
+
### Describe a figure as JSON
|
|
528
|
+
|
|
529
|
+
A figure spec is `{ chart, props }` as plain JSON. `chart` is the name of a registered chart, and `props` are its props
|
|
530
|
+
without callbacks and React content, such as `actions`. An agent or a server writes it. The entry
|
|
531
|
+
`@mechane-ai/elements/charts/figure` exports:
|
|
532
|
+
|
|
533
|
+
| Export | What it does |
|
|
534
|
+
| ----------------------- | ----------------------------------------------------------------------------------------------------------- |
|
|
535
|
+
| `FigureSpec` | The type of a spec. `FigureSpecOf<'Histogram'>` is the spec of one chart. |
|
|
536
|
+
| `validateFigureSpec(x)` | Returns `{ kind: 'ok', spec }` or `{ kind: 'invalid', message }`. It checks the structure and never throws. |
|
|
537
|
+
| `Figure` | Draws a spec. It takes `selected`, `onSelectedChange` and `status` beside it. |
|
|
538
|
+
| `describeFigure(spec)` | Returns the figure as one short text for a place that cannot draw it. |
|
|
539
|
+
| `figureCharts` | `{ chart, family }` for every registered chart. |
|
|
540
|
+
| `chartGuide` | The guide above, as data. |
|
|
541
|
+
|
|
542
|
+
`validateFigureSpec` checks that the input is an object, that `chart` is registered, that `props` is an object holding
|
|
543
|
+
every required prop with the right JSON kind, that no function is inside, and that `locale` is not empty. Each chart
|
|
544
|
+
then checks its own values. `Figure` runs the same check. For a bad spec it draws the shared invalid figure with the
|
|
545
|
+
reason in place of the chart, so a spec an agent got wrong is visible and nothing throws. `selected` and
|
|
546
|
+
`onSelectedChange` reach only the charts that take a selection, and `status` replaces the spec's own while newer data
|
|
547
|
+
loads.
|
|
548
|
+
|
|
549
|
+
```tsx
|
|
550
|
+
import { Figure, describeFigure, validateFigureSpec } from '@mechane-ai/elements/charts/figure';
|
|
551
|
+
|
|
552
|
+
const spec = {
|
|
553
|
+
chart: 'Histogram',
|
|
554
|
+
props: {
|
|
555
|
+
title: 'Request latency',
|
|
556
|
+
description: 'Synthetic requests over one hour, in 25 ms bins.',
|
|
557
|
+
locale: 'en-US',
|
|
558
|
+
source: 'Synthetic trace',
|
|
559
|
+
transforms: ['Binned at 25 ms'],
|
|
560
|
+
value: { label: 'Latency (ms)', format: { maximumFractionDigits: 0 } },
|
|
561
|
+
count: { label: 'Requests', format: { maximumFractionDigits: 0 } },
|
|
562
|
+
bins: [
|
|
563
|
+
{ id: 'b0', label: '0 to 25 ms', lowerBound: 0, upperBound: 25, count: 120 },
|
|
564
|
+
{ id: 'b1', label: '25 to 50 ms', lowerBound: 25, upperBound: 50, count: 340 },
|
|
565
|
+
],
|
|
566
|
+
},
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
const result = validateFigureSpec(spec);
|
|
570
|
+
|
|
571
|
+
export function Latency() {
|
|
572
|
+
return result.kind === 'ok' ? <Figure spec={result.spec} /> : null;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
// For this spec, describeFigure(result.spec) returns:
|
|
576
|
+
// A histogram, "Request latency", with 2 bins. Synthetic requests over one hour, in 25 ms bins. Source: Synthetic trace. Transforms: Binned at 25 ms.
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
`describeFigure` names the chart and its title, then the description, how much of the data is drawn when `coverage` is
|
|
580
|
+
set, the source, the transforms, and how many records the spec holds. It does not restate the values.
|
|
581
|
+
|
|
582
|
+
A misspelt chart name is refused with the close names:
|
|
583
|
+
|
|
584
|
+
```ts
|
|
585
|
+
validateFigureSpec({ chart: 'Histogramm', props: { title: 'Request latency', locale: 'en-US' } });
|
|
586
|
+
// { kind: 'invalid', message: '"Histogramm" is not a registered chart. Did you mean Histogram?' }
|
|
587
|
+
|
|
588
|
+
validateFigureSpec({ chart: 'Bar', props: {} });
|
|
589
|
+
// { kind: 'invalid', message: '"Bar" is not a registered chart. Did you mean BarChart, BreakdownBar, RankedBars?' }
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
The `use-elements` skill's [figures guide](skills/use-elements/references/figures.md) has the rules for an agent that
|
|
593
|
+
writes specs.
|
|
594
|
+
|
|
595
|
+
### Build a chart the library lacks
|
|
596
|
+
|
|
597
|
+
`@mechane-ai/elements/charts/plot` is the kernel every chart uses. It exports the scales, ticks and paths, the plot
|
|
598
|
+
layout, `PlotSurface`, `PlotAxes` and `PlotClip`, the marks (`LineMark`, `AreaMark`, `BandMark`, `DotMark`, `BarMark`,
|
|
599
|
+
`RuleMark`, `IntervalMark`, `LabelMark`, `SymbolMark`, `RingMark`, `LinkMark`, `ConnectorMark` and `GuideMark`), the
|
|
600
|
+
`Chart` primitive with `ChartCursor`, `ChartInspection` and `ChartData`, the frame and its states (`FigureFrame`,
|
|
601
|
+
`FigureLoading`, `FigureEmpty`, `FigureInvalid`), `useTones`, the tick helpers (`axisTicks`, `timeAxisTicks`,
|
|
602
|
+
`tickTexts`, `ticksMinimum`), the label placement helpers (`freeLabelSpot`, `labelBox`), and the canvas and WebGL
|
|
603
|
+
layers. `FigureFrame` takes `seriesLegend`, a legend that names things, above the plot, and `scaleLegend`, a color or
|
|
604
|
+
size scale, below it. A custom chart that is built from these has the same axes, readout, keyboard cursor, states and
|
|
605
|
+
tones as the others. Take `FigureProps`, `formatValue` and `useLinkedInspection` from `/charts`. Do not draw your own
|
|
606
|
+
scale or axis.
|
|
607
|
+
|
|
608
|
+
### Kits
|
|
609
|
+
|
|
610
|
+
A kit composes charts into a page for one domain: `/kits/training` for runs, `/kits/evaluation` for model comparison,
|
|
611
|
+
`/kits/operations` for service health, `/kits/interpretability` for features, attribution, attention and steering, and
|
|
612
|
+
`/kits/explainers` for long articles. A kit adds no marks. It decides which figures answer the question and shares one
|
|
613
|
+
tone scope and one linked inspection between them. The application supplies every value. The `use-elements` skill's
|
|
614
|
+
[kits guide](skills/use-elements/references/kits.md) lists each component and the data it takes.
|
|
615
|
+
|
|
616
|
+
### Renderer limits
|
|
617
|
+
|
|
618
|
+
Marks a reader inspects one by one draw as SVG. Most charts export a limits object, such as `scatterLimits`, and refuse
|
|
619
|
+
input above it with a message that names the limit. `BarChart`, `BridgeChart`, `BreakdownBar` and `Treemap` share
|
|
620
|
+
`categoricalLimits`, exported from `/charts`. `Histogram`, `ECDF`, `IntervalPlot` and `RankedBars` share
|
|
621
|
+
`distributionLimits`, exported from `/charts/distribution`. `EmbeddingMap` draws on canvas up to 100,000 points and with
|
|
622
|
+
WebGL up to 1,000,000, and `DensityMap` draws its grid on canvas. A canvas or WebGL plot keeps the same inspection,
|
|
623
|
+
selection, readout and text alternative as an SVG plot. The WebGL figure was measured in a headless software renderer,
|
|
624
|
+
not on a GPU.
|
|
625
|
+
|
|
323
626
|
## Develop and release
|
|
324
627
|
|
|
325
628
|
From `workspaces/core`:
|
|
@@ -1,10 +1,34 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
1
|
+
import { cpSync, readFileSync, rmSync } from 'node:fs';
|
|
2
|
+
import { join, resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
2
4
|
import { parseArgs } from 'node:util';
|
|
3
5
|
|
|
4
6
|
const ignored = new Set(['a', 'an', 'and', 'are', 'build', 'for', 'in', 'of', 'on', 'page', 'the', 'to', 'with']);
|
|
5
7
|
|
|
8
|
+
/** The skills for an application that uses Elements. The package also ships a skill for changing the library. */
|
|
9
|
+
const appSkills = ['use-elements', 'review-elements', 'upgrade-elements'];
|
|
10
|
+
|
|
6
11
|
/** @import {Catalog} from './catalog.d.mts' */
|
|
7
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Replaces each application skill in the directory with the copy from the installed package.
|
|
15
|
+
*
|
|
16
|
+
* @param {Catalog} catalog The catalog built from the public package.
|
|
17
|
+
* @param {string} directory The agent's skills directory, such as `.claude/skills`.
|
|
18
|
+
*/
|
|
19
|
+
function installSkills(catalog, directory) {
|
|
20
|
+
const installed = appSkills.map((name) => {
|
|
21
|
+
const target = resolve(directory, name);
|
|
22
|
+
|
|
23
|
+
rmSync(target, { recursive: true, force: true });
|
|
24
|
+
cpSync(fileURLToPath(new URL(`../skills/${name}`, import.meta.url)), target, { recursive: true });
|
|
25
|
+
|
|
26
|
+
return join(directory, name);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return { package: catalog.package, version: catalog.version, installed };
|
|
30
|
+
}
|
|
31
|
+
|
|
8
32
|
/**
|
|
9
33
|
* @param {Catalog} catalog The catalog built from the public package.
|
|
10
34
|
* @param {string} query Normalized task or public export name.
|
|
@@ -44,17 +68,31 @@ function lookup(catalog, query) {
|
|
|
44
68
|
};
|
|
45
69
|
}
|
|
46
70
|
|
|
71
|
+
const usage = [
|
|
72
|
+
'Usage: mechane-elements-catalog [task or public export name]',
|
|
73
|
+
' mechane-elements-catalog --install-skills <directory>',
|
|
74
|
+
'',
|
|
75
|
+
'With a task, prints the matching recipes, public exports and the best example as JSON.',
|
|
76
|
+
'With --install-skills, copies the Elements skills into an agent skills directory such as .claude/skills.',
|
|
77
|
+
].join('\n');
|
|
78
|
+
|
|
47
79
|
/** @param {Catalog} catalog The catalog built from the public package. */
|
|
48
80
|
export function runCatalog(catalog) {
|
|
49
81
|
const { positionals, values } = parseArgs({
|
|
50
82
|
allowPositionals: true,
|
|
51
|
-
options: { help: { type: 'boolean', short: 'h', default: false } },
|
|
83
|
+
options: { 'help': { type: 'boolean', short: 'h', default: false }, 'install-skills': { type: 'string' } },
|
|
52
84
|
});
|
|
53
85
|
|
|
86
|
+
const directory = values['install-skills'];
|
|
87
|
+
|
|
54
88
|
if (values.help) {
|
|
55
|
-
process.stdout.write(
|
|
89
|
+
process.stdout.write(`${usage}\n`);
|
|
56
90
|
} else {
|
|
57
|
-
const result =
|
|
91
|
+
const result =
|
|
92
|
+
directory === undefined
|
|
93
|
+
? lookup(catalog, positionals.join(' ').trim().toLowerCase())
|
|
94
|
+
: installSkills(catalog, directory);
|
|
95
|
+
|
|
58
96
|
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
59
97
|
}
|
|
60
98
|
}
|