@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
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Tables and collections
|
|
2
|
+
|
|
3
|
+
Import from `@mechane-ai/elements/collections`. The components render supplied records and report intent. The
|
|
4
|
+
application owns requests, URL state, permissions and saved preferences.
|
|
5
|
+
|
|
6
|
+
## Declare the query
|
|
7
|
+
|
|
8
|
+
Every `DataTable` takes a stable `getRowId`, a `caption`, an `empty` state and a `query`.
|
|
9
|
+
|
|
10
|
+
| Query mode | Use it when |
|
|
11
|
+
| ------------ | ------------------------------------------------------------------------------------------------------- |
|
|
12
|
+
| `local` | The app holds every row. Supply a search accessor and filter dimensions; the table filters and windows. |
|
|
13
|
+
| `controlled` | A server pages the rows. Supply search and filter values with callbacks, and reset the page on change. |
|
|
14
|
+
| `frame` | A shared header already holds the controls. Declare them once with `TableQueryFrame`. |
|
|
15
|
+
| `static` | The table is a fixed reference. Give a concrete `reason`. |
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
<DataTable
|
|
19
|
+
caption="Projects"
|
|
20
|
+
columns={columns}
|
|
21
|
+
rows={projects}
|
|
22
|
+
getRowId={(project) => project.id}
|
|
23
|
+
empty="No projects."
|
|
24
|
+
query={{
|
|
25
|
+
mode: 'local',
|
|
26
|
+
search: (project) => project.name,
|
|
27
|
+
filters: [{ id: 'status', label: 'Status', value: (project) => project.status }],
|
|
28
|
+
}}
|
|
29
|
+
/>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
To leave out only search or only filters, replace that capability with `{ reason: '…' }`. For a paged source, apply
|
|
33
|
+
search, filters and sort to the whole result before the server takes a page, with a unique key as the last sort field.
|
|
34
|
+
|
|
35
|
+
## Columns
|
|
36
|
+
|
|
37
|
+
Each column declares a `role`: `primary`, `text`, `status`, `number`, `timestamp` or `actions`. The role owns alignment
|
|
38
|
+
and minimum width, and the primary column takes the remaining space. Check the array with `satisfies`:
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
const columns = [
|
|
42
|
+
{ id: 'name', label: 'Name', role: 'primary', cell: (item: Item) => item.name },
|
|
43
|
+
] satisfies ReadonlyArray<DataTableColumn<Item>>;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
An explicit type annotation widens the columns and then requires the controlled sort props. A column with
|
|
47
|
+
`canSort: true` needs the `sort` and `onSortChange` pair, and the app sorts the rows.
|
|
48
|
+
|
|
49
|
+
- Rows are 48px and text truncates. Set `rowSizing="content"` for records that need several lines.
|
|
50
|
+
- Use `DataTableText` for a primary string with an optional second line.
|
|
51
|
+
- Mark a column `isSecondary` to hide it at the compact breakpoint.
|
|
52
|
+
- The table owns its cell insets. Keep a full-width table outside `PageContent`, or use `PageSection`'s `breakdown`.
|
|
53
|
+
|
|
54
|
+
## Opening, selecting and paging
|
|
55
|
+
|
|
56
|
+
- `rowAction` makes a record inspectable. Supply `href` for a real link, or a callback for a local action. Other cell
|
|
57
|
+
controls keep their own actions. `activeRowId` marks the inspected record without changing selection.
|
|
58
|
+
- Selection needs `selectedIds`, `onSelectionChange` and a label for each row's checkbox. Shift and a click select a
|
|
59
|
+
range, and the header checkbox selects every supplied row.
|
|
60
|
+
- `CollectionPagination` takes the position text and explicit previous and next availability. Never infer another page
|
|
61
|
+
from the row count.
|
|
62
|
+
- `window` limits the mounted rows of a long page. It does not fetch. Use `CollectionEnd` for loading more, with its
|
|
63
|
+
ready, loading, retry and complete states.
|
|
64
|
+
- Pass `resultStatus` while a read is pending or failed, and keep the previous rows on screen.
|
|
65
|
+
|
|
66
|
+
## The control row
|
|
67
|
+
|
|
68
|
+
A local or controlled query renders its own search and filters. For a custom header, call `useCollectionControls` with
|
|
69
|
+
the current values and callbacks. It returns `actions`, `chips`, `onKeyDown` and `openSearch`. Put the actions in the
|
|
70
|
+
page or section header and the chips below them in a `CollectionToolbar`.
|
|
71
|
+
|
|
72
|
+
The control row is one toolbar. Tab enters it once, and the arrow keys move between chips, find, filters and display
|
|
73
|
+
options. The search field releases the arrows only from the end of its text. Do not add a second Tab stop or a custom
|
|
74
|
+
key handler around it.
|
|
75
|
+
|
|
76
|
+
## What the keyboard does
|
|
77
|
+
|
|
78
|
+
- The row actions of a table share one Tab stop. Arrow keys move by a row, Page Up and Page Down by ten, and Home and
|
|
79
|
+
End reach the first and last supplied row.
|
|
80
|
+
- `Timeline` events share one Tab stop, and arrow keys move between them. Links inside an event keep their own stops.
|
|
81
|
+
- Register a shortcut with `useCommandShortcuts` from `/navigation/commands`, beside the action's owner, with an
|
|
82
|
+
explicit `isEnabled`. `CommandPalette` lists the same action records and registers nothing by mounting.
|
|
83
|
+
|
|
84
|
+
## A selected record
|
|
85
|
+
|
|
86
|
+
`Inspector` puts a list in `master` and the selected record in `detail`, side by side when there is room and stacked in
|
|
87
|
+
a narrow container. Change `revealKey` when the selection changes so a stacked detail scrolls into view. `Details`
|
|
88
|
+
renders labeled fields. `Metric` and `MetricGrid` summarize a record or a period; pass `isLoading` to reserve their
|
|
89
|
+
space. `Timestamp` takes an ISO datetime and a label the app formatted with an explicit locale and time zone.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Conversations and agent activity
|
|
2
|
+
|
|
3
|
+
Import from `@mechane-ai/elements/ai`. These parts render supplied records. They do not call a model, start a run, store
|
|
4
|
+
messages or decide permissions.
|
|
5
|
+
|
|
6
|
+
## The transcript
|
|
7
|
+
|
|
8
|
+
Compose `Conversation.Root`, `Viewport`, `Content` and one `Item` per message, with `JumpToLatest` inside the root.
|
|
9
|
+
|
|
10
|
+
- Give the viewport a label and each item a stable `messageId`. Key the root by conversation identity.
|
|
11
|
+
- A parent with a bounded height makes the transcript scroll. Without one it grows in page flow.
|
|
12
|
+
- A live conversation follows new content while the reader is at the end, and stops when they scroll up. Do not add a
|
|
13
|
+
scroll effect of your own.
|
|
14
|
+
- Mark the user's just-sent item with `shouldRevealOnAppend`, and keep its ID through acknowledgement.
|
|
15
|
+
- Use `initialPosition="start"` and `shouldFollow={false}` for a historical page.
|
|
16
|
+
- Pass `isStreaming` to `Content` while a reply is incomplete, and to the one `Markdown` message that is streaming.
|
|
17
|
+
|
|
18
|
+
`Message` takes an author, metadata, content, attachments and actions. Use `variant="chat"` for a compact chat with
|
|
19
|
+
end-aligned user messages. Render text with `Markdown` from `/content/markdown`. `MessageAction` is a named icon button
|
|
20
|
+
that shows on hover and focus. `ReplyIndicator` shows a supplied waiting label; remove it when real output arrives.
|
|
21
|
+
|
|
22
|
+
## The prompt
|
|
23
|
+
|
|
24
|
+
`PromptInput` takes `value`, `onValueChange` and `onSubmit`. The app owns the draft, the request identity, the result
|
|
25
|
+
and any retry. The component never clears the text, so a failed send keeps its draft.
|
|
26
|
+
|
|
27
|
+
- Enter adds a line by default. `enterBehavior="submit"` submits, and Shift and Enter adds a line. Command or Control
|
|
28
|
+
with Enter always submits.
|
|
29
|
+
- Pass `history`, oldest first, for Arrow Up recall on the first line.
|
|
30
|
+
- Supplying `onStop` shows Stop in place of Send.
|
|
31
|
+
- Use `isCompact` for a composer pinned below a conversation.
|
|
32
|
+
- Model choice, suggestions and attachments go in the `controls` and `attachments` slots.
|
|
33
|
+
|
|
34
|
+
## Activity, approvals and sources
|
|
35
|
+
|
|
36
|
+
| To show | Use |
|
|
37
|
+
| ----------------------------------- | ------------------------------------------------------------------ |
|
|
38
|
+
| A recorded shell command and output | `CommandActivity` |
|
|
39
|
+
| Ordered recorded steps, nested runs | `Trace` from `/content` |
|
|
40
|
+
| Tool input and output | `JsonViewer`, `CodeBlock`, `LogViewer`, `StackTrace` |
|
|
41
|
+
| A decision a person must make | `Approval` with an identified request |
|
|
42
|
+
| Where an answer came from | `Sources` and `InlineCitation` |
|
|
43
|
+
| A file change | `DiffViewer` from `/content/diff`, `FileTree` from `/content/tree` |
|
|
44
|
+
| Context use | `Meter` from `/feedback`, with `null` for unknown |
|
|
45
|
+
|
|
46
|
+
An `Approval` reports intent. Show it as settled only after the application acknowledges the outcome. A supplied summary
|
|
47
|
+
is not a model's hidden reasoning, and a recorded command is not a live terminal. Label them as what they are.
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# Figures as JSON
|
|
2
|
+
|
|
3
|
+
A figure spec names one chart and its props as plain JSON. An agent or a server writes it, `validateFigureSpec` checks
|
|
4
|
+
it and `Figure` draws it. Use it when the figure comes from data that is not code: a model's answer, a saved report or
|
|
5
|
+
an API response.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import {
|
|
9
|
+
Figure,
|
|
10
|
+
chartGuide,
|
|
11
|
+
describeFigure,
|
|
12
|
+
figureCharts,
|
|
13
|
+
validateFigureSpec,
|
|
14
|
+
} from '@mechane-ai/elements/charts/figure';
|
|
15
|
+
import type { FigureSpec } from '@mechane-ai/elements/charts/figure';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
| Export | What it is |
|
|
19
|
+
| -------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
20
|
+
| `FigureSpec` | The spec type: a union with one member per registered chart. `FigureSpecOf<'Histogram'>` is one. |
|
|
21
|
+
| `validateFigureSpec` | Checks the structure of any input. Returns `{ kind: 'ok', spec }` or `{ kind: 'invalid', message }`. |
|
|
22
|
+
| `Figure` | Draws a spec. It takes `selected`, `onSelectedChange` and `status` beside it. |
|
|
23
|
+
| `describeFigure` | Returns the figure as short plain text. |
|
|
24
|
+
| `figureCharts` | `{ chart, family }` for each of the 50 registered charts. |
|
|
25
|
+
| `chartGuide` | One entry per registered chart: `question`, `use`, `avoid`, `family` and a valid `example` spec. |
|
|
26
|
+
|
|
27
|
+
## The shape
|
|
28
|
+
|
|
29
|
+
A `FigureSpec` is `{ chart, props }`. The type is a union with one member for each registered chart, so
|
|
30
|
+
`chart: 'Histogram'` goes with the props of `Histogram`, and a TypeScript caller gets the right props for the name.
|
|
31
|
+
|
|
32
|
+
- `chart` is the exact name of a registered chart, such as `"Histogram"`. The charts and what each answers are in
|
|
33
|
+
[charts](charts.md), and in `chartGuide`.
|
|
34
|
+
- `props` are that chart's props, minus what JSON cannot carry: callbacks (`on...`), React slots such as `actions` and a
|
|
35
|
+
function format. Read the chart's declaration file for its props.
|
|
36
|
+
- Every spec needs `title` and `locale` in `props`, plus the props the chart cannot draw without.
|
|
37
|
+
- A format is an `Intl` options object. A `TimeFormat` names its `timeZone`.
|
|
38
|
+
- `ColorLegend`, the table cells, the placeholders and the kits are not registered, so a spec cannot name them.
|
|
39
|
+
|
|
40
|
+
## Start from the guide
|
|
41
|
+
|
|
42
|
+
`chartGuide` is the same guidance as the chooser in [charts](charts.md), as data. Read it to pick a chart and to start
|
|
43
|
+
from a spec that is known to be valid.
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
const entry = chartGuide.find((item) => item.chart === 'DumbbellPlot');
|
|
47
|
+
|
|
48
|
+
// entry?.question: "How much did each row change between two measurements?"
|
|
49
|
+
// entry?.use, entry?.avoid, entry?.family
|
|
50
|
+
// entry?.example is a FigureSpec to copy and change.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Write one
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"chart": "Histogram",
|
|
58
|
+
"props": {
|
|
59
|
+
"title": "Request latency",
|
|
60
|
+
"description": "Synthetic requests over one hour, in 25 ms bins.",
|
|
61
|
+
"locale": "en-US",
|
|
62
|
+
"source": "Synthetic trace",
|
|
63
|
+
"transforms": ["Binned at 25 ms"],
|
|
64
|
+
"value": { "label": "Latency (ms)", "format": { "maximumFractionDigits": 0 } },
|
|
65
|
+
"count": { "label": "Requests", "format": { "maximumFractionDigits": 0 } },
|
|
66
|
+
"bins": [
|
|
67
|
+
{ "id": "b0", "label": "0 to 25 ms", "lowerBound": 0, "upperBound": 25, "count": 120 },
|
|
68
|
+
{ "id": "b1", "label": "25 to 50 ms", "lowerBound": 25, "upperBound": 50, "count": 340 },
|
|
69
|
+
{ "id": "b2", "label": "50 to 75 ms", "lowerBound": 50, "upperBound": 75, "count": 180 },
|
|
70
|
+
{ "id": "b3", "label": "75 to 100 ms", "lowerBound": 75, "upperBound": 100, "count": null }
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The last bin has `"count": null`. The chart draws it hollow, not as zero.
|
|
77
|
+
|
|
78
|
+
## Check and draw it
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
import { Notice } from '@mechane-ai/elements/feedback';
|
|
82
|
+
import { useState } from 'react';
|
|
83
|
+
|
|
84
|
+
function AgentFigure({ input }: { readonly input: unknown }) {
|
|
85
|
+
const [selected, setSelected] = useState<string | null>(null);
|
|
86
|
+
const result = validateFigureSpec(input);
|
|
87
|
+
|
|
88
|
+
if (result.kind === 'invalid') {
|
|
89
|
+
return <Notice hasError>{result.message}</Notice>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return <Figure spec={result.spec} selected={selected} onSelectedChange={(id) => setSelected(id)} />;
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`validateFigureSpec(input)` takes `unknown`, so it accepts parsed JSON. The check is structural and never throws. It
|
|
97
|
+
confirms:
|
|
98
|
+
|
|
99
|
+
- the input is an object with a `chart` string that is registered;
|
|
100
|
+
- `props` is an object holding every required prop of the chart, each with the right JSON kind;
|
|
101
|
+
- no value anywhere in `props` is a function;
|
|
102
|
+
- `locale`, when present, is a non-empty string.
|
|
103
|
+
|
|
104
|
+
It does not check the deeper values. Each chart checks its own values and shows an invalid figure with the reason. A
|
|
105
|
+
chart name that is not registered gets up to three close names:
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
validateFigureSpec({ chart: 'Histogramm', props: { title: 'Request latency', locale: 'en-US' } });
|
|
109
|
+
// { kind: 'invalid', message: '"Histogramm" is not a registered chart. Did you mean Histogram?' }
|
|
110
|
+
|
|
111
|
+
validateFigureSpec({ chart: 'Bar', props: {} });
|
|
112
|
+
// { kind: 'invalid', message: '"Bar" is not a registered chart. Did you mean BarChart, BreakdownBar, RankedBars?' }
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Other messages state the first problem found:
|
|
116
|
+
|
|
117
|
+
| Input | `message` |
|
|
118
|
+
| ------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
119
|
+
| A `Histogram` with no `bins` | ``Histogram needs the prop `bins` (an array).`` |
|
|
120
|
+
| A `Histogram` with `count: 5` | ``Histogram needs `count` as an object, not a number.`` |
|
|
121
|
+
| A `Histogram` with `locale: ''` | ``Histogram needs `locale` as a non-empty string, such as "en-US".`` |
|
|
122
|
+
| A function inside `props` | `A figure spec is plain JSON, and its props hold a function. Pass callbacks to Figure beside the spec.` |
|
|
123
|
+
| A string, an array or `null` | ``A figure spec is an object with `chart` and `props`.`` |
|
|
124
|
+
|
|
125
|
+
`Figure` takes `spec: unknown` and these props beside it:
|
|
126
|
+
|
|
127
|
+
- `selected` and `onSelectedChange(id, details)` reach only the charts that take a selection. A press or Enter on a
|
|
128
|
+
record calls `onSelectedChange`. Leave both out for a read-only figure. A `Waterfall` drawn without a callback still
|
|
129
|
+
draws, and a press does nothing.
|
|
130
|
+
- `status` is `'ready'`, `'loading'` or `'refreshing'`, and replaces the spec's own `status` while newer data loads.
|
|
131
|
+
|
|
132
|
+
`Figure` runs `validateFigureSpec` itself. For a bad spec it draws the shared invalid figure, with the spec's `title`
|
|
133
|
+
and `locale` when they are strings, and the reason as its message. It never throws. Call `validateFigureSpec` first when
|
|
134
|
+
you want the message elsewhere, as above.
|
|
135
|
+
|
|
136
|
+
## Read it back as text
|
|
137
|
+
|
|
138
|
+
`describeFigure(spec)` returns a short plain-text account of a figure for a place that cannot draw it, such as a chat
|
|
139
|
+
transcript, a log or an agent reading its result back. It names the chart and its title, then the description, how much
|
|
140
|
+
of the data is drawn when `coverage` is set, the source, the transforms and how many records the spec holds. It does not
|
|
141
|
+
restate the values.
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
const text: string = describeFigure(result.spec);
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
For the spec above, `describeFigure` returns:
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
A histogram, "Request latency", with 4 bins. Synthetic requests over one hour, in 25 ms bins. Source: Synthetic trace. Transforms: Binned at 25 ms.
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
With `"coverage": { "shown": 640, "total": 1200, "unit": "requests" }` added to `props`, it adds a sentence after the
|
|
154
|
+
description:
|
|
155
|
+
|
|
156
|
+
```text
|
|
157
|
+
A histogram, "Request latency", with 4 bins. Synthetic requests over one hour, in 25 ms bins. 640 of 1,200 requests shown. Source: Synthetic trace. Transforms: Binned at 25 ms.
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
These two texts came from running `describeFigure` on those specs.
|
|
161
|
+
|
|
162
|
+
## Rules for an agent that writes a spec
|
|
163
|
+
|
|
164
|
+
- Pick the chart from the question, with the chooser in [charts](charts.md) or `chartGuide`. Do not invent a chart name.
|
|
165
|
+
- Start from the chart's `example` in the guide when you can. It is a valid spec.
|
|
166
|
+
- Write only props the chart declares. Do not add a function, a color, a pixel height or a formatter.
|
|
167
|
+
- Use a declared format and a `locale`. Put the unit in the axis `label`. Write a time format as options with a
|
|
168
|
+
`timeZone`, never as a function.
|
|
169
|
+
- Write a missing value as `null`. Never write it as zero.
|
|
170
|
+
- Put prepared values in the spec. Name each step you applied in `transforms` and the data's origin in `source`.
|
|
171
|
+
- Set `coverage` when the spec holds a sample or a window.
|
|
172
|
+
- Read the figure back after drawing it. The readout, the exact-value table and the invalid message state what was
|
|
173
|
+
drawn.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Forms
|
|
2
|
+
|
|
3
|
+
Import controls from `@mechane-ai/elements/forms` and date controls from `/forms/dates`. The application supplies
|
|
4
|
+
values, labels, validation, permissions and the save.
|
|
5
|
+
|
|
6
|
+
## Choose the control
|
|
7
|
+
|
|
8
|
+
| The reader | Use |
|
|
9
|
+
| ------------------------------------------------- | ------------------------------------------------------------------ |
|
|
10
|
+
| Types a line or several lines | `Input`, `Textarea` |
|
|
11
|
+
| Types a number with steps, or drags a bound | `NumberField`, `Slider`, both with a `locale` |
|
|
12
|
+
| Ticks a choice that a later save submits | `Checkbox` |
|
|
13
|
+
| Turns on a setting that applies at once | `Switch` |
|
|
14
|
+
| Picks one value in a form | `RadioGroup` |
|
|
15
|
+
| Switches between a few views, one always checked | `SegmentedControl` |
|
|
16
|
+
| Presses independent options, such as formatting | `ToggleGroup` |
|
|
17
|
+
| Picks one of several labeled strings | `SelectControl` |
|
|
18
|
+
| Needs rich options, object values or many choices | compound `Select` |
|
|
19
|
+
| Searches a finite or remote set of options | `Combobox` |
|
|
20
|
+
| Chooses, drops or pastes files | `FilePicker` |
|
|
21
|
+
| Picks a date, a day range, a month or months | `DatePicker`, `DateRangePicker`, `MonthPicker`, `MonthRangePicker` |
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
<SegmentedControl.Root value={view} onValueChange={setView} aria-label="View">
|
|
25
|
+
<SegmentedControl.Item value="table">Table</SegmentedControl.Item>
|
|
26
|
+
<SegmentedControl.Item value="chart">Chart</SegmentedControl.Item>
|
|
27
|
+
</SegmentedControl.Root>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Use `Menu` from `/overlays` for commands and immediate choices, not for a form value.
|
|
31
|
+
|
|
32
|
+
## Label and validate
|
|
33
|
+
|
|
34
|
+
`Field.Root` associates `Field.Label`, `Field.Description` and `Field.Error` with its control. Validation text stays
|
|
35
|
+
beside its field. Use `Fieldset` to name a group of fields, and `InputGroup` for a prefix, suffix or action beside an
|
|
36
|
+
`Input`.
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
<Field.Root name="reason" invalid={isInvalid}>
|
|
40
|
+
<Field.Label>Reason</Field.Label>
|
|
41
|
+
<Input required value={reason} onValueChange={setReason} />
|
|
42
|
+
<Field.Error match={isInvalid}>Enter a reason.</Field.Error>
|
|
43
|
+
</Field.Root>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- `Input` and `Textarea` report edits through `onValueChange`, from a person or an agent.
|
|
47
|
+
- Set `isSensitive` on `Field.Root` for credentials and private drafts. The value, label and validation then stay out of
|
|
48
|
+
what an agent can read. Password inputs do this already.
|
|
49
|
+
- A disabled control is unavailable. A read-only value stays selectable.
|
|
50
|
+
|
|
51
|
+
## Save
|
|
52
|
+
|
|
53
|
+
Put the submit row in `FormActions`. Pass `isPending` to the button while the request runs; it keeps focus and prevents
|
|
54
|
+
a second activation. Show the outcome with `FormStatus` in its pending, error or success state.
|
|
55
|
+
|
|
56
|
+
For a change that is hard to undo, use `ConfirmButton` with a `confirmation` sentence that names the record, usually
|
|
57
|
+
inside an `AlertDialog`. Keep the safe action first, keep the dialog open with an inline error until the server
|
|
58
|
+
acknowledges success, and keep the draft when the save fails. The **Consequential form** recipe shows the whole flow.
|
|
59
|
+
|
|
60
|
+
## Files
|
|
61
|
+
|
|
62
|
+
`FilePicker` takes `accept`, `multiple`, `maxFiles`, `maxSize` and `minSize`, and reports
|
|
63
|
+
`onValueChange(files, details)`. It lists the chosen files and says why one was refused. It never uploads or reads a
|
|
64
|
+
file. The application owns storage and progress, and the server still enforces every limit. State the formats and limits
|
|
65
|
+
in `Field.Description`.
|
|
66
|
+
|
|
67
|
+
## Dates
|
|
68
|
+
|
|
69
|
+
Dates are civil values, `{ year, month, day }` with one-based months. Supply the locale, time zone, today, bounds and
|
|
70
|
+
presets explicitly; a picker reads no clock. The app converts an inclusive range to its API's timestamps.
|
|
71
|
+
|
|
72
|
+
- The day pickers take a typed date, one field per unit. Digits fill a unit and the arrow keys step it.
|
|
73
|
+
- A picker keeps a draft in its popup. Apply commits one complete value. Escape and Cancel discard it.
|
|
74
|
+
- Use `isClearable={false}` for a required reporting period, and `validateRange` to refuse an unsupported interval.
|
|
75
|
+
- `parseCalendarDate`, `serializeCalendarDate`, `addCalendarDays` and their month forms convert and step values.
|
|
76
|
+
- `Calendar` is an inline calendar with immediate selection. `EventMonth` is a month grid of the app's own events.
|
|
77
|
+
|
|
78
|
+
## Settings pages
|
|
79
|
+
|
|
80
|
+
`SettingsSection` groups settings and `SettingsRow` binds a real `controlId` to its label and description. Settings that
|
|
81
|
+
apply at once use `Switch` or a select. Settings saved together use a form with `FormActions`.
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# Kits
|
|
2
|
+
|
|
3
|
+
A kit is a small set of domain components built from the chart families. A kit chooses which figures answer a domain
|
|
4
|
+
question, arranges them, shares one tone scope and one linked inspection between them, and writes the words. It adds no
|
|
5
|
+
marks, colors or axes.
|
|
6
|
+
|
|
7
|
+
Import a kit from `@mechane-ai/elements/kits/<kit>`. Every component of the training, operations, evaluation and
|
|
8
|
+
interpretability kits:
|
|
9
|
+
|
|
10
|
+
- takes `locale` and declared formats, never pre-formatted numbers;
|
|
11
|
+
- takes the state it shows as a value with a change callback, such as `selected` with `onSelectedChange`;
|
|
12
|
+
- takes its visible words as `labels`, a partial object with English defaults;
|
|
13
|
+
- handles `status`, empty and invalid input, and refuses bad input with a sentence;
|
|
14
|
+
- computes nothing. The application supplies means, intervals, ranks and deltas, or calls
|
|
15
|
+
`@mechane-ai/elements/charts/transforms` first. A list may sort and filter the rows it is given.
|
|
16
|
+
|
|
17
|
+
The explainers kit takes content slots, not data, and its pieces take only what they need. The rules are
|
|
18
|
+
[contract 141](https://github.com/mechane-ai/mechane/blob/main/workspaces/core/.contracts/141-ui-domain-kits/CONTRACT.md).
|
|
19
|
+
|
|
20
|
+
| Kit | Entry | Use it for |
|
|
21
|
+
| ---------------- | ------------------------ | -------------------------------------------------------------------------- |
|
|
22
|
+
| Explainers | `/kits/explainers` | A long page whose prose, figures and diagrams point at each other. |
|
|
23
|
+
| Training | `/kits/training` | Watching and comparing training runs. |
|
|
24
|
+
| Operations | `/kits/operations` | The health, budgets and events of a service. |
|
|
25
|
+
| Evaluation | `/kits/evaluation` | Ranking and comparing models on benchmarks. |
|
|
26
|
+
| Interpretability | `/kits/interpretability` | Reading learned features, attribution, attention, logit lens and steering. |
|
|
27
|
+
|
|
28
|
+
## Explainers
|
|
29
|
+
|
|
30
|
+
For a paper-like page. Give every thing one id and every figure one `id` in the explainer's list.
|
|
31
|
+
|
|
32
|
+
- `Explainer` takes `figures`, the ids of every numbered figure in reading order, and the article as `children`.
|
|
33
|
+
- `NumberedFigure` takes `id`, `caption` and a chart or diagram as `children`. It shows "Figure 2".
|
|
34
|
+
- `FigureReference` takes `to`, a figure id, and writes "Figure 2" as a link.
|
|
35
|
+
- `Term` takes `inspects`, an id the figures use, and words. Hovering or focusing it highlights that record in every
|
|
36
|
+
`ChartLink` figure.
|
|
37
|
+
- `DiagramPart` takes `inspects`, a `label` and SVG shapes, so a hand-drawn diagram links to the figures both ways.
|
|
38
|
+
- `BoundValue` is a number in a sentence the reader changes in place. It takes `value` with `onValueChange` or
|
|
39
|
+
`defaultValue`, `min`, `max`, `step`, optional `scale` (`'linear'` or `'log'`), `locale`, `format` and `label`.
|
|
40
|
+
- `StorySteps` walks through `steps` (`id`, `title`, `body`, optional `inspected`) beside the figures it takes as
|
|
41
|
+
`children`. It takes `step` with `onStepChange` or `defaultStep`, a `label` that names the walk, and `labels` for the
|
|
42
|
+
words of its controls. Each step points the linked figures at its `inspected` record.
|
|
43
|
+
|
|
44
|
+
The application supplies the prose, the figures and the ids. Put a `ChartLink` and a `ToneScope` around the article.
|
|
45
|
+
|
|
46
|
+
## Training
|
|
47
|
+
|
|
48
|
+
For runs of one experiment. A run keeps one id and one hue in the dashboard, the table and every chart.
|
|
49
|
+
|
|
50
|
+
- `RunDashboard` draws one `CurveChart` panel per metric with one step cursor. It takes `runs`, `metrics`, `series`
|
|
51
|
+
(metric id, then run id, then points in increasing step), a step axis `x`, `selected` with `onSelectedChange`, and
|
|
52
|
+
`hidden` with `onHiddenChange`.
|
|
53
|
+
- `RunTable` is the table and the legend. It takes `title`, `runs`, `columns` for settings, `metrics` as `bar` or
|
|
54
|
+
`spark` columns, `selected`, `hidden`, `sort` with `onSortChange` and `showOnlyDifferences`. Pressing a row asks to
|
|
55
|
+
focus the run, or to clear the focus when it is already focused, so `onSelectedChange` receives an id or `null`.
|
|
56
|
+
- `RunsOverview` shows a whole sweep as gray lines with one highlighted run and a median band. Use it when there are
|
|
57
|
+
more runs than hues. It takes `runs`, `x`, `y`, `summary` and `summaryText`.
|
|
58
|
+
|
|
59
|
+
A `RunRecord` is `{ id, label, state, detail?, tone? }`, with `state` one of `running`, `finished`, `failed` or
|
|
60
|
+
`stopped`. `runLimits.runs` is 12. The application supplies the prepared curves, smoothed or not, the settings per run
|
|
61
|
+
and the final results. It holds selection, hiding and sorting.
|
|
62
|
+
|
|
63
|
+
## Operations
|
|
64
|
+
|
|
65
|
+
For a service in production.
|
|
66
|
+
|
|
67
|
+
- `ServiceHealth` shows the service state in words, headline tiles with a trend, and time-series panels on one shared
|
|
68
|
+
time axis. It takes `service`, `indicators`, `charts`, `timestampUnit`, `timeFormat` and `locale`. Give a chart series
|
|
69
|
+
the same `id` as its indicator and the two share a hue.
|
|
70
|
+
- `BudgetBoard` shows objectives and budgets as bars against targets. It takes `groups` of rows that share a unit, each
|
|
71
|
+
with a `value` axis, and `selected` with `onSelectedChange`.
|
|
72
|
+
- `IncidentTimeline` shows deploys, alerts and incidents in three lanes over a `window`. It takes `events`, a
|
|
73
|
+
`timeFormat` that names its time zone, and `selected` with `onSelectedChange`.
|
|
74
|
+
|
|
75
|
+
The application judges every state and writes its words. Nothing here works out health from a number or a color.
|
|
76
|
+
|
|
77
|
+
## Evaluation
|
|
78
|
+
|
|
79
|
+
For models compared on benchmarks. Every model has one id, `EvaluationModel` `{ id, label, detail?, tone? }`.
|
|
80
|
+
|
|
81
|
+
- `Leaderboard` is a ranked table of models over measure columns. A column has a `kind` of `score`, `interval`,
|
|
82
|
+
`change`, `trend` or `heat`, a `format`, `isHigherBetter` and, except for `change`, a shared `domain`. It takes
|
|
83
|
+
`models`, `columns`, `rows`, `sort` with `onSortChange` and `selected` with `onSelectedChange`. Here `selected` is the
|
|
84
|
+
list of checked model ids, and the rows have no checkboxes without the callback. `leaderboardLimits` is 100 models and
|
|
85
|
+
10 columns.
|
|
86
|
+
- `ScoreBreakdown` shows one benchmark by category with a dot per model and an optional interval. It takes `models`,
|
|
87
|
+
`categories`, `scores`, `value` and `selected`.
|
|
88
|
+
- `ModelComparison` shows two models head to head: a dumbbell per benchmark and a table of differences. It takes `a`,
|
|
89
|
+
`b`, `rows`, `value`, `isHigherBetter` and `differenceFormat`. Each difference is B minus A.
|
|
90
|
+
|
|
91
|
+
A score is a number, an estimate with its interval `{ value, low, high }`, or `null` where it was not measured. The
|
|
92
|
+
application supplies the ranks, intervals, differences and tests. Resting on a leaderboard row marks that model in the
|
|
93
|
+
linked figures.
|
|
94
|
+
|
|
95
|
+
## Interpretability
|
|
96
|
+
|
|
97
|
+
For reading what a model learned and how it computes an answer. A feature, such as a sparse autoencoder latent, keeps
|
|
98
|
+
one id in the list, the card, the map and the attribution graph, so resting on it in one place lights it in the others.
|
|
99
|
+
A kit that holds several figures shares one tone scope and one chart link. The application supplies every activation,
|
|
100
|
+
attribution, attention weight and decoded layer. No component runs a model. A `FeatureSummary` is
|
|
101
|
+
`{ id, label, source?, explanation?, frequency? }`, and `featureLimits` is 5000 features and 8 search matches. Each
|
|
102
|
+
change callback receives `details` with a `reason` of `press`, `input` or `imperative`.
|
|
103
|
+
|
|
104
|
+
- `FeatureCard` answers "what is this feature?": its name, id and explanation, how often it fires, the contexts that
|
|
105
|
+
activate it most, and the output tokens it promotes and suppresses. It takes `feature` and, each optional, `density`
|
|
106
|
+
(`bins`, a `value` axis and a `count` axis), `examples` (`examples`, a `domain`, `valueFormat`, optional `palette` and
|
|
107
|
+
`context`) and `logits` (`tokens` of `{ id, token, value }` and a `value` axis). It leaves out what is absent. Use
|
|
108
|
+
`size="compact"` in grids and side panels, `actions` for controls beside the name, and `frequencyFormat` for the
|
|
109
|
+
share. It owns no state.
|
|
110
|
+
- `FeatureList` answers "which features exist, and which one should I open?" as a sortable, searchable table. Each row
|
|
111
|
+
is a `FeatureSummary` with optional `maxActivation` and a `profile`, one value per layer. It takes `title`,
|
|
112
|
+
`features`, `frequencyDomain` (starts at zero), `frequencyFormat`, `activationFormat` and optional `profileDomain`.
|
|
113
|
+
The application holds `selected` with `onSelectedChange`, `query` with `onQueryChange` and `sort` with `onSortChange`.
|
|
114
|
+
It filters and sorts the rows it is given, and refuses duplicate ids.
|
|
115
|
+
- `AttributionWorkbench` answers "which features carry the answer from the prompt to the output?" It is an
|
|
116
|
+
`AttributionGraph` beside a panel for the node in focus. It takes the graph's props (`title`, `locale`, `layers`,
|
|
117
|
+
`nodes`, `edges`, `weightLabel`, `weightFormat`, and optional `valueLabel`, `valueFormat` and `direction`) and
|
|
118
|
+
`details`, a `FeatureCardData` per node id. The application holds `selected` with `onSelectedChange` and `pinned` with
|
|
119
|
+
`onPinnedChange`. Pointing at a node shows its card, pressing keeps it, and pinning builds a subgraph. A key of
|
|
120
|
+
`details` that is not a node is refused.
|
|
121
|
+
- `AttentionHeadGrid` answers "what does each head look at?" One attention pattern per head over the same tokens and the
|
|
122
|
+
same 0 to 1 scale, with the selected head enlarged beside the lines from each token. It takes `title`, `tokens`,
|
|
123
|
+
`heads` (`id`, `label`, optional `description`, `weights` with null for a masked pair), `mask` of `none` or `causal`,
|
|
124
|
+
and `minPanelWidth`. The application holds `selected` (the enlarged head) with `onSelectedChange` and `pair`, the
|
|
125
|
+
token pair every head marks, with `onPairChange`. Its id is `matrixCellId(destination, source)`: the token that
|
|
126
|
+
attends, then the token attended to. Left out, `pair` is kept by the grid. It draws at most 32 heads
|
|
127
|
+
(`attentionHeadLimits`). Weights show where a head reads from, not what it computes.
|
|
128
|
+
- `LogitLens` answers "at which layer does the answer form?" A grid of the model's top next-token guess at every layer
|
|
129
|
+
and prompt position, shaded by probability, and a curve of chosen tokens by layer for the selected position. It takes
|
|
130
|
+
`title`, `columns` (the prompt tokens), `layers` (`id`, `label`, `depth`), `cells` (the top prediction and probability
|
|
131
|
+
per layer and position), optional `tracks` (`id`, `columnId`, `token` and one probability per layer) and
|
|
132
|
+
`valueFormat`. The application holds `selected`, a cell id from `tokenGridCellId(layerId, columnId)`, with
|
|
133
|
+
`onSelectedChange`, and decodes every layer.
|
|
134
|
+
- `EmbeddingAtlas` answers "where is a feature on the map, and what is it?" An `EmbeddingMap` with a search box, a list
|
|
135
|
+
of matches and a card for the open feature. It takes the map's props (`title`, `points`, `groups`, `x`, `y` and the
|
|
136
|
+
others), `landmarks` (`id`, `x`, `y`) and `details`, a `FeatureCardData` per landmark id. The application holds
|
|
137
|
+
`query` with `onQueryChange` and `selected` with `onSelectedChange`, and projects the points. A landmark with no
|
|
138
|
+
details is refused.
|
|
139
|
+
- `SteeringPanel` answers "what does the model do when I change a feature's strength?" A slider per feature beside
|
|
140
|
+
next-token predictions, with a tick for each token before steering, and optionally the text before and after. It takes
|
|
141
|
+
`title`, `features` (`id`, `label`, `min`, `max`, `step`, optional `neutral` and `description`), `values` by feature
|
|
142
|
+
id, `predictions` (each with a `baseline`), and optional `prompt`, `completions` (`baseline`, `steered`) and
|
|
143
|
+
`strengthFormat`. The application holds `values` with `onValuesChange`, which Reset also calls with every neutral
|
|
144
|
+
strength, and generates the outputs for the current setting.
|
|
145
|
+
|
|
146
|
+
```tsx
|
|
147
|
+
import { FeatureCard, FeatureList } from '@mechane-ai/elements/kits/interpretability';
|
|
148
|
+
|
|
149
|
+
<FeatureList
|
|
150
|
+
title="Layer 20 features"
|
|
151
|
+
locale="en-US"
|
|
152
|
+
features={[
|
|
153
|
+
{ id: 'f-1', label: 'Golden Gate Bridge', frequency: 0.0004, maxActivation: 9.2 },
|
|
154
|
+
{ id: 'f-2', label: 'Suspension bridges', frequency: 0.0011, maxActivation: 6.8 },
|
|
155
|
+
]}
|
|
156
|
+
frequencyDomain={[0, 0.002]}
|
|
157
|
+
frequencyFormat={{ style: 'percent', maximumFractionDigits: 2 }}
|
|
158
|
+
activationFormat={{ maximumFractionDigits: 1 }}
|
|
159
|
+
selected={openFeature}
|
|
160
|
+
onSelectedChange={(id) => setOpenFeature(id)}
|
|
161
|
+
/>;
|
|
162
|
+
|
|
163
|
+
<FeatureCard locale="en-US" size="compact" feature={{ id: 'f-1', label: 'Golden Gate Bridge', frequency: 0.0004 }} />;
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Put a kit on a page
|
|
167
|
+
|
|
168
|
+
The dashboard and the table each keep a tone scope over `runs`, so a run has one hue in both. The application holds
|
|
169
|
+
selection and hiding and passes them to both.
|
|
170
|
+
|
|
171
|
+
```tsx
|
|
172
|
+
import { RunDashboard, RunTable } from '@mechane-ai/elements/kits/training';
|
|
173
|
+
|
|
174
|
+
<>
|
|
175
|
+
<RunDashboard
|
|
176
|
+
title="Validation"
|
|
177
|
+
locale="en-US"
|
|
178
|
+
runs={runs}
|
|
179
|
+
metrics={metrics}
|
|
180
|
+
series={series}
|
|
181
|
+
x={{ label: 'Training step', format: { maximumFractionDigits: 0 } }}
|
|
182
|
+
selected={selected}
|
|
183
|
+
onSelectedChange={(id) => setSelected(id)}
|
|
184
|
+
hidden={hidden}
|
|
185
|
+
onHiddenChange={(ids) => setHidden(ids)}
|
|
186
|
+
hasLegend={false}
|
|
187
|
+
/>
|
|
188
|
+
<RunTable
|
|
189
|
+
title="Runs"
|
|
190
|
+
locale="en-US"
|
|
191
|
+
runs={runs}
|
|
192
|
+
selected={selected}
|
|
193
|
+
onSelectedChange={(id) => setSelected(id)}
|
|
194
|
+
hidden={hidden}
|
|
195
|
+
onHiddenChange={(ids) => setHidden(ids)}
|
|
196
|
+
/>
|
|
197
|
+
</>;
|
|
198
|
+
```
|