derive-dashboards 0.8.0 → 0.9.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/CHANGELOG.md +513 -0
- package/README.md +8 -2
- package/dist/adapter/statement.mjs +9 -7
- package/dist/authorize.mjs +27 -6
- package/dist/body.mjs +28 -25
- package/dist/cache.d.mts +2 -2
- package/dist/charts/data/buckets.d.mts +25 -7
- package/dist/charts/data/buckets.mjs +92 -15
- package/dist/charts/data/clean.mjs +254 -12
- package/dist/charts/data/format.d.mts +7 -2
- package/dist/charts/data/format.mjs +68 -70
- package/dist/charts/data/input-error.d.mts +2 -0
- package/dist/charts/data/input-error.mjs +2 -0
- package/dist/charts/data/rows.d.mts +3 -1
- package/dist/charts/data/rows.mjs +4 -2
- package/dist/charts/data/types.d.mts +50 -7
- package/dist/charts/data/words.d.mts +13 -0
- package/dist/charts/data/words.mjs +8 -1
- package/dist/charts/describe.mjs +6 -6
- package/dist/charts/index.d.mts +14 -14
- package/dist/charts/index.mjs +4 -1
- package/dist/charts/kinds/area-marks.mjs +67 -26
- package/dist/charts/kinds/area.d.mts +3 -3
- package/dist/charts/kinds/area.mjs +32 -11
- package/dist/charts/kinds/bars-data.d.mts +3 -3
- package/dist/charts/kinds/bars-data.mjs +12 -6
- package/dist/charts/kinds/bars-layout.mjs +60 -6
- package/dist/charts/kinds/bars-marks.mjs +6 -6
- package/dist/charts/kinds/bars.d.mts +5 -3
- package/dist/charts/kinds/bars.mjs +39 -6
- package/dist/charts/kinds/columns-data.mjs +14 -5
- package/dist/charts/kinds/columns-marks.mjs +52 -23
- package/dist/charts/kinds/columns.d.mts +2 -2
- package/dist/charts/kinds/columns.mjs +36 -10
- package/dist/charts/kinds/course-data.mjs +44 -0
- package/dist/charts/kinds/course-layout.mjs +77 -0
- package/dist/charts/kinds/course-marks.mjs +52 -0
- package/dist/charts/kinds/course-words.mjs +64 -0
- package/dist/charts/kinds/course.d.mts +10 -0
- package/dist/charts/kinds/course.mjs +55 -0
- package/dist/charts/kinds/dumbbell-data.d.mts +4 -4
- package/dist/charts/kinds/dumbbell-data.mjs +3 -3
- package/dist/charts/kinds/dumbbell-layout.mjs +17 -8
- package/dist/charts/kinds/dumbbell.d.mts +5 -3
- package/dist/charts/kinds/dumbbell.mjs +35 -4
- package/dist/charts/kinds/funnel-data.d.mts +3 -3
- package/dist/charts/kinds/funnel-data.mjs +11 -16
- package/dist/charts/kinds/funnel-layout.mjs +7 -6
- package/dist/charts/kinds/funnel.d.mts +5 -4
- package/dist/charts/kinds/funnel.mjs +33 -6
- package/dist/charts/kinds/grid-data.d.mts +3 -3
- package/dist/charts/kinds/grid-data.mjs +55 -13
- package/dist/charts/kinds/grid-layout.mjs +88 -13
- package/dist/charts/kinds/grid-legend.mjs +60 -0
- package/dist/charts/kinds/grid-marks.mjs +81 -30
- package/dist/charts/kinds/grid-time.mjs +19 -5
- package/dist/charts/kinds/grid-words.mjs +57 -35
- package/dist/charts/kinds/grid.d.mts +7 -4
- package/dist/charts/kinds/grid.mjs +49 -8
- package/dist/charts/kinds/histogram-data.mjs +68 -26
- package/dist/charts/kinds/histogram-layout.mjs +4 -3
- package/dist/charts/kinds/histogram-words.mjs +2 -3
- package/dist/charts/kinds/histogram.d.mts +2 -2
- package/dist/charts/kinds/histogram.mjs +17 -1
- package/dist/charts/kinds/line-marks.mjs +19 -11
- package/dist/charts/kinds/line.d.mts +2 -2
- package/dist/charts/kinds/line.mjs +21 -3
- package/dist/charts/kinds/multiples-grid.mjs +57 -27
- package/dist/charts/kinds/multiples-head.mjs +52 -22
- package/dist/charts/kinds/multiples-layout.mjs +106 -52
- package/dist/charts/kinds/multiples-marks.mjs +6 -5
- package/dist/charts/kinds/multiples-words.mjs +53 -38
- package/dist/charts/kinds/multiples.d.mts +2 -2
- package/dist/charts/kinds/multiples.mjs +35 -7
- package/dist/charts/kinds/row-chart.d.mts +7 -0
- package/dist/charts/kinds/row-chart.mjs +47 -10
- package/dist/charts/kinds/row-marks.mjs +5 -5
- package/dist/charts/kinds/scatter-data.d.mts +5 -5
- package/dist/charts/kinds/scatter-data.mjs +6 -6
- package/dist/charts/kinds/scatter-marks.mjs +46 -19
- package/dist/charts/kinds/scatter-words.mjs +8 -8
- package/dist/charts/kinds/scatter.d.mts +5 -3
- package/dist/charts/kinds/scatter.mjs +18 -0
- package/dist/charts/kinds/stat-data.mjs +7 -7
- package/dist/charts/kinds/stat-marks.mjs +2 -2
- package/dist/charts/kinds/stat.d.mts +4 -4
- package/dist/charts/kinds/stat.mjs +19 -0
- package/dist/charts/kinds/time-chart.mjs +13 -4
- package/dist/charts/kinds/time-frame.mjs +50 -19
- package/dist/charts/kinds/time-plan.mjs +29 -2
- package/dist/charts/kinds/time-plot.mjs +1 -1
- package/dist/charts/kinds/time-stops.mjs +58 -29
- package/dist/charts/kinds/waterfall-data.d.mts +3 -3
- package/dist/charts/kinds/waterfall-data.mjs +2 -2
- package/dist/charts/kinds/waterfall.d.mts +5 -4
- package/dist/charts/kinds/waterfall.mjs +29 -2
- package/dist/charts/layout/frame.mjs +5 -3
- package/dist/charts/layout/stack.mjs +43 -22
- package/dist/charts/marks/axes.mjs +10 -5
- package/dist/charts/marks/budget.mjs +14 -0
- package/dist/charts/marks/end-labels.mjs +24 -10
- package/dist/charts/marks/legend.mjs +19 -8
- package/dist/charts/marks/lines.mjs +3 -3
- package/dist/charts/marks/more.mjs +79 -13
- package/dist/charts/marks/notes.mjs +12 -6
- package/dist/charts/marks/series-line.mjs +14 -10
- package/dist/charts/marks/thin.mjs +16 -33
- package/dist/charts/scale/calendar.mjs +41 -26
- package/dist/charts/scale/linear.mjs +58 -0
- package/dist/charts/scale/value.d.mts +21 -0
- package/dist/charts/scale/value.mjs +67 -9
- package/dist/charts/scene/lazy.mjs +27 -0
- package/dist/charts/scene/markup.mjs +2 -1
- package/dist/charts/scene/svg.mjs +20 -8
- package/dist/charts/scene/types.d.mts +34 -0
- package/dist/charts/text/measure.mjs +33 -3
- package/dist/charts/theme.mjs +13 -4
- package/dist/charts-react/Chart.d.mts +20 -0
- package/dist/charts-react/Chart.mjs +9 -67
- package/dist/charts-react/Reader.mjs +50 -96
- package/dist/charts-react/box.mjs +106 -0
- package/dist/charts-react/bucket-names.mjs +9 -24
- package/dist/charts-react/columns-picture.mjs +12 -0
- package/dist/charts-react/exact-sum.mjs +4 -7
- package/dist/charts-react/from-answer.mjs +9 -4
- package/dist/charts-react/index.d.mts +9 -2
- package/dist/charts-react/index.mjs +9 -2
- package/dist/charts-react/kinds/area.d.mts +4 -0
- package/dist/charts-react/kinds/area.mjs +38 -0
- package/dist/charts-react/kinds/bar.d.mts +4 -0
- package/dist/charts-react/kinds/bar.mjs +15 -0
- package/dist/charts-react/kinds/funnel.d.mts +4 -0
- package/dist/charts-react/kinds/funnel.mjs +13 -0
- package/dist/charts-react/kinds/heatmap.d.mts +4 -0
- package/dist/charts-react/kinds/heatmap.mjs +13 -0
- package/dist/charts-react/kinds/line.d.mts +4 -0
- package/dist/charts-react/kinds/line.mjs +20 -0
- package/dist/charts-react/kinds/multiples.d.mts +4 -0
- package/dist/charts-react/kinds/multiples.mjs +33 -0
- package/dist/charts-react/kinds/number.d.mts +5 -0
- package/dist/charts-react/kinds/number.mjs +86 -0
- package/dist/charts-react/plan-bars.mjs +15 -8
- package/dist/charts-react/plan-funnel.mjs +3 -1
- package/dist/charts-react/plan-grid.mjs +14 -5
- package/dist/charts-react/plan-of.mjs +17 -0
- package/dist/charts-react/plan-parts.mjs +16 -5
- package/dist/charts-react/plan-time.mjs +4 -53
- package/dist/charts-react/reader-page.d.mts +1 -1
- package/dist/charts-react/reader-page.mjs +19 -9
- package/dist/charts-react/renderers.d.mts +14 -0
- package/dist/charts-react/renderers.mjs +22 -0
- package/dist/charts-react/table.d.mts +1 -0
- package/dist/charts-react/table.mjs +108 -0
- package/dist/charts-react/tiles.mjs +21 -49
- package/dist/charts-react/useScene.mjs +45 -17
- package/dist/charts-react/words.mjs +19 -0
- package/dist/checks.mjs +97 -19
- package/dist/cli/add.mjs +4 -3
- package/dist/cli/doctor.mjs +2 -2
- package/dist/core/conformance/index.d.mts +5 -2
- package/dist/core/conformance/index.mjs +5 -2
- package/dist/core/conformance/memory/aggregate.mjs +11 -6
- package/dist/core/conformance/memory/rows.d.mts +7 -3
- package/dist/core/conformance/memory/rows.mjs +19 -13
- package/dist/core/conformance/memory/source.mjs +4 -4
- package/dist/core/document/control-fields.d.mts +20 -0
- package/dist/core/document/control-fields.mjs +117 -0
- package/dist/core/document/display-comparisons.d.mts +17 -0
- package/dist/core/document/display-comparisons.mjs +15 -4
- package/dist/core/document/display-entries.d.mts +14 -0
- package/dist/core/document/display-entries.mjs +25 -9
- package/dist/core/document/display-validation.d.mts +5 -1
- package/dist/core/document/display-validation.mjs +14 -7
- package/dist/core/document/display.d.mts +10 -8
- package/dist/core/document/display.mjs +25 -4
- package/dist/core/document/layout.d.mts +8 -9
- package/dist/core/document/layout.mjs +23 -6
- package/dist/core/document/stacked.d.mts +0 -7
- package/dist/core/document/types.mjs +8 -6
- package/dist/core/document/upgrade.d.mts +1 -0
- package/dist/core/document/upgrade.mjs +4 -2
- package/dist/core/engine/access.mjs +3 -3
- package/dist/core/engine/assert.mjs +4 -2
- package/dist/core/engine/bucket.mjs +2 -2
- package/dist/core/engine/checks.mjs +6 -7
- package/dist/core/engine/custom/ask.mjs +22 -2
- package/dist/core/engine/custom/cells.mjs +22 -22
- package/dist/core/engine/custom/level.mjs +12 -13
- package/dist/core/engine/custom/measures.mjs +12 -9
- package/dist/core/engine/custom/reader.mjs +3 -1
- package/dist/core/engine/custom/records.mjs +8 -7
- package/dist/core/engine/custom/unread.mjs +78 -0
- package/dist/core/engine/custom/where.mjs +15 -10
- package/dist/core/engine/index.d.mts +2 -13
- package/dist/core/engine/index.mjs +2 -12
- package/dist/core/engine/measure.mjs +1 -0
- package/dist/core/engine/members.mjs +7 -3
- package/dist/core/engine/nan.mjs +10 -1
- package/dist/core/engine/native.mjs +2 -20
- package/dist/core/engine/numbers.mjs +26 -14
- package/dist/core/engine/postgres.mjs +9 -5
- package/dist/core/engine/prepare.mjs +4 -4
- package/dist/core/engine/rank-sets.mjs +1 -1
- package/dist/core/engine/read.mjs +5 -4
- package/dist/core/engine/reader.d.mts +6 -0
- package/dist/core/engine/record-layout.mjs +3 -3
- package/dist/core/engine/run.mjs +77 -20
- package/dist/core/engine/segmented.d.mts +2 -1
- package/dist/core/engine/segmented.mjs +19 -12
- package/dist/core/engine/series.mjs +1 -1
- package/dist/core/engine/shape.mjs +8 -8
- package/dist/core/engine/sql-partition.mjs +2 -2
- package/dist/core/engine/sql-pass.mjs +3 -2
- package/dist/core/engine/sql-reader.mjs +13 -5
- package/dist/core/engine/sql-reads.mjs +2 -1
- package/dist/core/engine/sql-records.mjs +2 -2
- package/dist/core/engine/sql-split.mjs +1 -1
- package/dist/core/engine/sql-unread.mjs +70 -0
- package/dist/core/engine/time.mjs +2 -1
- package/dist/core/engine/types.d.mts +17 -0
- package/dist/core/engine/version.d.mts +1 -1
- package/dist/core/engine/version.mjs +1 -1
- package/dist/core/error/codes.d.mts +24 -1
- package/dist/core/error/codes.mjs +23 -3
- package/dist/core/error/refusal.d.mts +8 -3
- package/dist/core/error/refusal.mjs +6 -1
- package/dist/core/exact/decimal.d.mts +1 -14
- package/dist/core/exact/decimal.mjs +9 -19
- package/dist/core/exact/stored.d.mts +9 -0
- package/dist/core/exact/stored.mjs +38 -0
- package/dist/core/exact/text.d.mts +16 -1
- package/dist/core/exact/text.mjs +50 -1
- package/dist/core/format/digits.mjs +55 -0
- package/dist/core/format/index.d.mts +16 -0
- package/dist/core/format/index.mjs +27 -0
- package/dist/core/format/number.d.mts +27 -0
- package/dist/core/format/number.mjs +158 -0
- package/dist/core/format/write.d.mts +6 -0
- package/dist/core/format/write.mjs +57 -0
- package/dist/core/index.d.mts +43 -33
- package/dist/core/index.mjs +31 -28
- package/dist/core/model/defaults.d.mts +18 -1
- package/dist/core/model/defaults.mjs +19 -1
- package/dist/core/model/define.d.mts +17 -8
- package/dist/core/model/define.mjs +2 -0
- package/dist/core/model/member.d.mts +5 -3
- package/dist/core/model/member.mjs +33 -6
- package/dist/core/model/storage.mjs +40 -12
- package/dist/core/model/types.d.mts +17 -1
- package/dist/core/model/types.mjs +5 -0
- package/dist/core/model/validate/expr.d.mts +1 -7
- package/dist/core/model/validate/fields.d.mts +2 -0
- package/dist/core/model/validate/fields.mjs +14 -7
- package/dist/core/model/validate/issues.mjs +5 -1
- package/dist/core/model/validate/known-members.mjs +6 -5
- package/dist/core/model/validate/shape.mjs +36 -3
- package/dist/core/model/validate/source.mjs +2 -2
- package/dist/core/oracle/data.d.mts +4 -2
- package/dist/core/oracle/evaluate.d.mts +19 -1
- package/dist/core/oracle/evaluate.mjs +56 -10
- package/dist/core/oracle/expr.mjs +1 -1
- package/dist/core/oracle/facts.mjs +12 -5
- package/dist/core/oracle/measure.mjs +1 -1
- package/dist/core/oracle/request.mjs +39 -4
- package/dist/core/oracle/segmented.d.mts +3 -1
- package/dist/core/oracle/segmented.mjs +19 -13
- package/dist/core/oracle/unread.mjs +32 -0
- package/dist/core/oracle/visibility.mjs +4 -3
- package/dist/core/policy/bind.d.mts +2 -11
- package/dist/core/policy/bind.mjs +1 -1
- package/dist/core/policy/match.mjs +1 -1
- package/dist/core/query/closure.d.mts +7 -2
- package/dist/core/query/closure.mjs +29 -12
- package/dist/core/query/compose-tile.d.mts +3 -2
- package/dist/core/query/compose-tile.mjs +32 -13
- package/dist/core/query/compose.d.mts +0 -5
- package/dist/core/query/drill/internal.d.mts +5 -5
- package/dist/core/query/drill/internal.mjs +11 -0
- package/dist/core/query/drill/links.d.mts +2 -3
- package/dist/core/query/drill/links.mjs +18 -4
- package/dist/core/query/drill/selection.d.mts +8 -2
- package/dist/core/query/drill/selection.mjs +14 -3
- package/dist/core/query/drill/synthetic.mjs +1 -1
- package/dist/core/query/drill/time.mjs +11 -10
- package/dist/core/query/filter.d.mts +1 -6
- package/dist/core/query/filter.mjs +1 -4
- package/dist/core/query/fold.mjs +23 -0
- package/dist/core/query/segments.mjs +42 -3
- package/dist/core/query/to-wire.d.mts +7 -0
- package/dist/core/query/to-wire.mjs +14 -2
- package/dist/core/query/types.d.mts +30 -13
- package/dist/core/result/columns.mjs +23 -13
- package/dist/core/result/number.mjs +3 -3
- package/dist/core/result/status.d.mts +13 -0
- package/dist/core/result/status.mjs +18 -0
- package/dist/core/result/time-axis.d.mts +14 -13
- package/dist/core/result/time-axis.mjs +20 -2
- package/dist/core/result/types.d.mts +33 -3
- package/dist/core/result/whole.d.mts +23 -0
- package/dist/core/result/whole.mjs +27 -0
- package/dist/core/schema/agent-query.d.mts +89 -0
- package/dist/core/schema/agent-query.mjs +115 -0
- package/dist/core/schema/aliases.mjs +1 -52
- package/dist/core/schema/answer-parts.mjs +17 -13
- package/dist/core/schema/answers.d.mts +787 -319
- package/dist/core/schema/commands.d.mts +33 -23
- package/dist/core/schema/commands.mjs +26 -18
- package/dist/core/schema/custom.mjs +46 -45
- package/dist/core/schema/document.d.mts +32 -27
- package/dist/core/schema/document.mjs +61 -81
- package/dist/core/schema/drill-answers.mjs +4 -1
- package/dist/core/schema/drill.d.mts +14 -9
- package/dist/core/schema/drill.mjs +23 -22
- package/dist/core/schema/index.d.mts +5 -3
- package/dist/core/schema/index.mjs +5 -3
- package/dist/core/schema/options.d.mts +92 -0
- package/dist/core/schema/options.mjs +104 -0
- package/dist/core/schema/picks.d.mts +2 -2
- package/dist/core/schema/picks.mjs +7 -6
- package/dist/core/schema/query.d.mts +9 -83
- package/dist/core/schema/query.mjs +49 -73
- package/dist/core/schema/strict.d.mts +3 -0
- package/dist/core/schema/strict.mjs +91 -0
- package/dist/core/schema/union-error.mjs +30 -7
- package/dist/core/schema/view.d.mts +4 -3
- package/dist/core/schema/view.mjs +16 -11
- package/dist/core/store/ddl.d.mts +0 -2
- package/dist/core/store/ddl.mjs +1 -5
- package/dist/core/time/bucket.d.mts +1 -19
- package/dist/core/time/bucket.mjs +6 -6
- package/dist/core/time/compare.mjs +3 -2
- package/dist/core/time/index.d.mts +7 -8
- package/dist/core/time/instant.d.mts +15 -9
- package/dist/core/time/instant.mjs +23 -9
- package/dist/core/time/range.d.mts +3 -15
- package/dist/core/time/range.mjs +17 -7
- package/dist/core/time/stored.d.mts +8 -5
- package/dist/core/time/stored.mjs +51 -15
- package/dist/core/time/temporal.d.mts +1 -5
- package/dist/core/time/temporal.mjs +9 -4
- package/dist/core/time/text-time.d.mts +31 -2
- package/dist/core/time/text-time.mjs +139 -22
- package/dist/core/time/zone.mjs +2 -2
- package/dist/core/types/api.d.mts +1 -1
- package/dist/core/types/api.mjs +1 -1
- package/dist/core/types/dashboard.d.mts +185 -0
- package/dist/core/types/dashboard.mjs +26 -0
- package/dist/core/types/drill-api.d.mts +14 -2
- package/dist/core/types/infer.d.mts +0 -4
- package/dist/core/types/options-check.d.mts +42 -0
- package/dist/core/types/options-check.mjs +90 -0
- package/dist/core/types/options.d.mts +14 -8
- package/dist/core/value/casefold.d.mts +1 -3
- package/dist/core/value/stored.d.mts +26 -0
- package/dist/core/value/stored.mjs +28 -0
- package/dist/cursor-seal.mjs +37 -9
- package/dist/dashboard-documents.d.mts +14 -6
- package/dist/dashboard-documents.mjs +32 -12
- package/dist/dashboards.mjs +10 -9
- package/dist/drill-access.mjs +6 -6
- package/dist/drill-change.mjs +18 -20
- package/dist/drill-comparison.mjs +2 -1
- package/dist/drill-crumbs.mjs +63 -28
- package/dist/drill-distinct.mjs +2 -1
- package/dist/drill-explain.mjs +1 -1
- package/dist/drill-items.mjs +1 -1
- package/dist/drill-open.mjs +39 -23
- package/dist/drill-seal.mjs +41 -13
- package/dist/drill-share.mjs +1 -1
- package/dist/drill-summary.mjs +2 -1
- package/dist/drill-targets.mjs +4 -4
- package/dist/drill-views.mjs +4 -3
- package/dist/drill.mjs +1 -1
- package/dist/editing.mjs +5 -3
- package/dist/endpoints/index.d.mts +29 -8
- package/dist/endpoints/index.mjs +4 -1
- package/dist/endpoints/meta.mjs +4 -3
- package/dist/endpoints/query.mjs +5 -2
- package/dist/endpoints/read.mjs +7 -6
- package/dist/endpoints/versions.mjs +2 -1
- package/dist/execute.d.mts +3 -0
- package/dist/execute.mjs +23 -12
- package/dist/grant.d.mts +9 -0
- package/dist/grant.mjs +43 -0
- package/dist/handler.mjs +8 -13
- package/dist/http.d.mts +6 -2
- package/dist/http.mjs +6 -2
- package/dist/index.d.mts +25 -4
- package/dist/index.mjs +91 -40
- package/dist/llms.txt +3 -3
- package/dist/mcp/api.mjs +2 -1
- package/dist/mcp/query.mjs +3 -8
- package/dist/mcp/resolve.mjs +9 -2
- package/dist/node/index.d.mts +36 -0
- package/dist/node/index.mjs +89 -0
- package/dist/node/request.d.mts +12 -0
- package/dist/node/request.mjs +119 -0
- package/dist/node/response.mjs +58 -0
- package/dist/principal.mjs +15 -7
- package/dist/react/Canvas.mjs +88 -67
- package/dist/react/Cell.mjs +2 -1
- package/dist/react/Dashboard.d.mts +9 -1
- package/dist/react/Dashboard.mjs +42 -42
- package/dist/react/DashboardList.mjs +9 -4
- package/dist/react/Editing.d.mts +9 -0
- package/dist/react/Editing.mjs +8 -3
- package/dist/react/Grid.mjs +1 -1
- package/dist/react/Header.mjs +4 -35
- package/dist/react/History.mjs +3 -2
- package/dist/react/LoadFailed.mjs +59 -0
- package/dist/react/Panel.d.mts +1 -1
- package/dist/react/Panel.mjs +1 -1
- package/dist/react/Parts.d.mts +34 -0
- package/dist/react/Parts.mjs +9 -6
- package/dist/react/ReviewPanel.mjs +1 -1
- package/dist/react/RowBody.d.mts +2 -0
- package/dist/react/RowBody.mjs +5 -1
- package/dist/react/Share.mjs +153 -0
- package/dist/react/TabStrip.mjs +37 -0
- package/dist/react/Tile.d.mts +3 -1
- package/dist/react/Tile.mjs +89 -92
- package/dist/react/TileState.mjs +117 -0
- package/dist/react/ago.mjs +45 -0
- package/dist/react/arrange.mjs +1 -1
- package/dist/react/board.mjs +2 -2
- package/dist/react/bucket-name.d.mts +8 -0
- package/dist/react/bucket-name.mjs +13 -0
- package/dist/react/builder/DisplayOptions.mjs +219 -0
- package/dist/react/builder/Preview.mjs +13 -13
- package/dist/react/builder/RangeEditor.mjs +4 -3
- package/dist/react/builder/WidgetBuilder.d.mts +1 -7
- package/dist/react/builder/WidgetBuilder.mjs +12 -3
- package/dist/react/builder/base.d.mts +13 -2
- package/dist/react/builder/base.mjs +70 -12
- package/dist/react/builder/display.d.mts +3 -0
- package/dist/react/builder/display.mjs +256 -0
- package/dist/react/builder/labels.mjs +19 -5
- package/dist/react/builder/options.mjs +11 -6
- package/dist/react/builder/state.mjs +25 -3
- package/dist/react/builder/useBuilder.d.mts +7 -1
- package/dist/react/builder/useBuilder.mjs +6 -9
- package/dist/react/builder/usePreview.mjs +3 -2
- package/dist/react/builder/words.d.mts +16 -1
- package/dist/react/builder/words.mjs +41 -1
- package/dist/react/change-text.mjs +149 -0
- package/dist/react/client.d.mts +9 -0
- package/dist/react/client.mjs +105 -14
- package/dist/react/context.d.mts +24 -3
- package/dist/react/context.mjs +23 -7
- package/dist/react/dates-shown.mjs +76 -0
- package/dist/react/draft.mjs +3 -2
- package/dist/react/drill/Bars.mjs +12 -16
- package/dist/react/drill/Comparison.mjs +1 -1
- package/dist/react/drill/DrillPanel.d.mts +1 -1
- package/dist/react/drill/DrillPanel.mjs +2 -1
- package/dist/react/drill/Header.mjs +65 -12
- package/dist/react/drill/Items.d.mts +1 -1
- package/dist/react/drill/Notes.mjs +10 -7
- package/dist/react/drill/PanelStates.mjs +8 -1
- package/dist/react/drill/Trend.mjs +10 -5
- package/dist/react/drill/board.d.mts +1 -1
- package/dist/react/drill/host.mjs +4 -1
- package/dist/react/drill/lazy.mjs +2 -27
- package/dist/react/drill/props.d.mts +17 -7
- package/dist/react/drill/props.mjs +55 -14
- package/dist/react/drill/state.d.mts +15 -5
- package/dist/react/drill/state.mjs +12 -3
- package/dist/react/drill/words.d.mts +46 -3
- package/dist/react/drill/words.mjs +30 -5
- package/dist/react/english.mjs +33 -8
- package/dist/react/export/ExportButton.mjs +4 -1
- package/dist/react/export/csv.d.mts +7 -2
- package/dist/react/export/csv.mjs +24 -7
- package/dist/react/failure-words.mjs +60 -0
- package/dist/react/filters/bar.d.mts +1 -1
- package/dist/react/filters/bar.mjs +4 -1
- package/dist/react/filters/calendar.mjs +23 -8
- package/dist/react/filters/chip.mjs +7 -3
- package/dist/react/filters/context.d.mts +13 -1
- package/dist/react/filters/context.mjs +1 -1
- package/dist/react/filters/dates-said.mjs +57 -0
- package/dist/react/filters/days.d.mts +3 -4
- package/dist/react/filters/days.mjs +10 -17
- package/dist/react/filters/hooks.d.mts +11 -0
- package/dist/react/filters/hooks.mjs +10 -6
- package/dist/react/filters/menu-search.mjs +17 -9
- package/dist/react/filters/menu.mjs +10 -8
- package/dist/react/filters/phone.mjs +41 -16
- package/dist/react/filters/place.mjs +40 -0
- package/dist/react/filters/popover.mjs +18 -13
- package/dist/react/filters/rules.d.mts +4 -3
- package/dist/react/filters/rules.mjs +3 -3
- package/dist/react/filters/sheet.mjs +7 -3
- package/dist/react/filters/state.mjs +6 -1
- package/dist/react/filters/values.mjs +24 -7
- package/dist/react/filters/words.d.mts +13 -0
- package/dist/react/filters/words.mjs +5 -0
- package/dist/react/format-time.d.mts +17 -6
- package/dist/react/format-time.mjs +152 -33
- package/dist/react/format.d.mts +3 -3
- package/dist/react/format.mjs +27 -133
- package/dist/react/headline.d.mts +6 -3
- package/dist/react/headline.mjs +81 -25
- package/dist/react/index.d.mts +19 -17
- package/dist/react/index.mjs +12 -10
- package/dist/react/lazy.mjs +38 -0
- package/dist/react/messages.d.mts +78 -2
- package/dist/react/now.mjs +38 -0
- package/dist/react/read.d.mts +1 -0
- package/dist/react/read.mjs +140 -9
- package/dist/react/renderers/exact.mjs +31 -59
- package/dist/react/renderers/index.d.mts +27 -6
- package/dist/react/renderers/index.mjs +141 -102
- package/dist/react/renderers/list-parts.mjs +24 -0
- package/dist/react/renderers/list.d.mts +1 -0
- package/dist/react/renderers/list.mjs +99 -43
- package/dist/react/renderers/more-rows.mjs +75 -0
- package/dist/react/renderers/number-before.mjs +320 -0
- package/dist/react/renderers/number-period.mjs +54 -0
- package/dist/react/renderers/number-whole.mjs +29 -0
- package/dist/react/renderers/props.d.mts +24 -1
- package/dist/react/renderers/props.mjs +8 -0
- package/dist/react/renderers/table-cells.mjs +137 -31
- package/dist/react/renderers/table-fit.mjs +55 -10
- package/dist/react/renderers/table-measure.mjs +29 -9
- package/dist/react/renderers/table-row.mjs +14 -9
- package/dist/react/renderers/table-scale.mjs +2 -3
- package/dist/react/renderers/table-sort.mjs +3 -2
- package/dist/react/renderers/table-whole.mjs +37 -0
- package/dist/react/renderers/table.mjs +73 -53
- package/dist/react/review.d.mts +7 -0
- package/dist/react/review.mjs +35 -8
- package/dist/react/roving.d.mts +6 -0
- package/dist/react/roving.mjs +123 -0
- package/dist/react/says-dates.d.mts +7 -0
- package/dist/react/says-dates.mjs +51 -0
- package/dist/react/series.mjs +5 -6
- package/dist/react/stable.mjs +1 -1
- package/dist/react/tabs/EditTabs.mjs +125 -0
- package/dist/react/tabs/NameField.mjs +72 -0
- package/dist/react/tabs/TabMenu.mjs +175 -0
- package/dist/react/tabs/actions.mjs +37 -0
- package/dist/react/tabs/commands.mjs +76 -0
- package/dist/react/tabs/focus.mjs +22 -0
- package/dist/react/tabs/keys.mjs +28 -0
- package/dist/react/theme-unlayered.css +1 -1
- package/dist/react/theme.css +1 -1
- package/dist/react/tile-store.d.mts +4 -0
- package/dist/react/tile-store.mjs +93 -13
- package/dist/react/touch.d.mts +16 -0
- package/dist/react/touch.mjs +39 -0
- package/dist/react/useBoard.d.mts +6 -0
- package/dist/react/useBoard.mjs +1 -0
- package/dist/react/useDashboard.d.mts +2 -0
- package/dist/react/useDashboard.mjs +5 -2
- package/dist/react/useTiles.d.mts +3 -0
- package/dist/react/useTiles.mjs +73 -17
- package/dist/react/view-grid.mjs +2 -2
- package/dist/react/view.mjs +1 -1
- package/dist/recharts/axes.mjs +1 -1
- package/dist/recharts/axis.mjs +23 -73
- package/dist/recharts/bar.d.mts +2 -1
- package/dist/recharts/bar.mjs +140 -64
- package/dist/recharts/fit.mjs +33 -0
- package/dist/recharts/line.mjs +21 -15
- package/dist/recharts/marks.mjs +2 -1
- package/dist/recharts/parts.mjs +16 -13
- package/dist/recharts/table.mjs +8 -3
- package/dist/refusal.mjs +46 -0
- package/dist/registry/filter-bar.json +1 -1
- package/dist/skills/derive-dashboards/SKILL.md +23 -8
- package/dist/tile-doc.mjs +1 -1
- package/package.json +21 -6
- package/dist/charts-react/plan.d.mts +0 -3
- package/dist/charts-react/plan.mjs +0 -37
- package/dist/charts-react/tiles.d.mts +0 -24
- package/dist/core/policy/match.d.mts +0 -16
- package/dist/core/schema/aliases.d.mts +0 -7
- package/dist/core/time/compare.d.mts +0 -30
- package/dist/react/EditBar.d.mts +0 -16
- package/dist/react/History.d.mts +0 -30
- package/dist/react/ReviewPanel.d.mts +0 -15
- package/dist/react/digits.mjs +0 -46
- package/dist/react/drill/trend-touch.mjs +0 -33
- package/dist/react/renderers/exact.d.mts +0 -6
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { textAt, topAsWritten } from "../data/format.mjs";
|
|
2
2
|
import { lastAt, pairKey, rankable } from "../data/rows.mjs";
|
|
3
|
+
import { periodNote, wordsOf } from "../data/words.mjs";
|
|
3
4
|
import { coursesSaid, missingOf, openingOf, shownOf, soFar, summary } from "../describe.mjs";
|
|
4
5
|
import { pointsOf } from "../marks/series-line.mjs";
|
|
5
6
|
import { bucketTitles } from "../scale/calendar.mjs";
|
|
7
|
+
import { lazyHover } from "../scene/lazy.mjs";
|
|
6
8
|
import { colorOf } from "./multiples-marks.mjs";
|
|
7
9
|
import { timeStops } from "./time-stops.mjs";
|
|
8
10
|
// src/kinds/multiples-words.ts
|
|
@@ -11,52 +13,65 @@ import { timeStops } from "./time-stops.mjs";
|
|
|
11
13
|
* series, each set at its value's place, so the nearest stop to a pointer is the point it is
|
|
12
14
|
* over. Near a panel's edge, a point of the panel beside it may be nearer. A stop is keyed by
|
|
13
15
|
* its series and its bucket, and carries its panel's plot, so the lit line runs down that panel.
|
|
16
|
+
* With a stop at each point of every panel, the stops are made when first read (`lazyHover`).
|
|
14
17
|
*/
|
|
15
18
|
function hoverOf(table, panels, at) {
|
|
16
19
|
const titles = bucketTitles(table.x, at.env.locale);
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
label
|
|
20
|
+
const words = wordsOf(at.env);
|
|
21
|
+
const rows = table.x.buckets.map((bucket, i) => {
|
|
22
|
+
const label = titles[i] ?? bucket.label;
|
|
23
|
+
const note = panels.length === 0 ? void 0 : periodNote(bucket, words);
|
|
24
|
+
return {
|
|
25
|
+
key: bucket.label,
|
|
26
|
+
label: note === void 0 ? label : `${label} (${note})`
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
const stops = () => panels.flatMap(({ series, place, time, plot }, column) => {
|
|
30
|
+
const points = pointsOf(series.values, {
|
|
31
|
+
buckets: table.x.buckets,
|
|
32
|
+
center: time.center,
|
|
33
|
+
place
|
|
34
|
+
});
|
|
35
|
+
const stopsAt = {
|
|
36
|
+
plot,
|
|
37
|
+
center: time.center,
|
|
38
|
+
y: (_s, i) => points[i]?.y,
|
|
39
|
+
titles,
|
|
40
|
+
paints: [colorOf(series, at)]
|
|
41
|
+
};
|
|
42
|
+
return timeStops({
|
|
43
|
+
x: table.x,
|
|
44
|
+
series: [series]
|
|
45
|
+
}, at.env, stopsAt, (fields, row) => {
|
|
46
|
+
const point = points[row];
|
|
47
|
+
const key = pairKey(series.key, fields.key);
|
|
48
|
+
return point === void 0 ? void 0 : {
|
|
49
|
+
...fields,
|
|
50
|
+
key,
|
|
51
|
+
y: point.y,
|
|
52
|
+
plot,
|
|
53
|
+
cell: [row, column]
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
const drawn = new Set(panels.map((panel) => panel.series));
|
|
58
|
+
const all = [...drawn, ...table.series.filter((series) => !drawn.has(series))];
|
|
59
|
+
const columns = all.map(({ key, label }) => ({
|
|
60
|
+
key,
|
|
61
|
+
label
|
|
20
62
|
}));
|
|
21
|
-
|
|
63
|
+
const cell = (row, column) => {
|
|
64
|
+
const series = all[column];
|
|
65
|
+
return series === void 0 ? void 0 : textAt(series, row);
|
|
66
|
+
};
|
|
67
|
+
return lazyHover({
|
|
22
68
|
snap: "nearest",
|
|
23
|
-
stops: panels.flatMap(({ series, place, time, plot }, column) => {
|
|
24
|
-
const points = pointsOf(series.values, {
|
|
25
|
-
buckets: table.x.buckets,
|
|
26
|
-
center: time.center,
|
|
27
|
-
place
|
|
28
|
-
});
|
|
29
|
-
return timeStops({
|
|
30
|
-
x: table.x,
|
|
31
|
-
series: [series]
|
|
32
|
-
}, at.env, {
|
|
33
|
-
plot,
|
|
34
|
-
center: time.center,
|
|
35
|
-
y: (_s, i) => points[i]?.y,
|
|
36
|
-
titles,
|
|
37
|
-
paints: [colorOf(series, at)]
|
|
38
|
-
}).flatMap((stop, row) => {
|
|
39
|
-
const heading = rows[row];
|
|
40
|
-
if (column === 0 && heading !== void 0 && stop.note !== void 0) heading.label += " (" + stop.note + ")";
|
|
41
|
-
const [item] = stop.items;
|
|
42
|
-
const key = pairKey(series.key, stop.key);
|
|
43
|
-
return item === void 0 ? [] : [{
|
|
44
|
-
...stop,
|
|
45
|
-
key,
|
|
46
|
-
y: item.y,
|
|
47
|
-
plot,
|
|
48
|
-
cell: [row, column]
|
|
49
|
-
}];
|
|
50
|
-
});
|
|
51
|
-
}),
|
|
52
69
|
matrix: {
|
|
53
70
|
rows,
|
|
54
|
-
columns
|
|
55
|
-
|
|
56
|
-
label: series.label
|
|
57
|
-
}))
|
|
71
|
+
columns,
|
|
72
|
+
cell
|
|
58
73
|
}
|
|
59
|
-
};
|
|
74
|
+
}, stops);
|
|
60
75
|
}
|
|
61
76
|
/**
|
|
62
77
|
* The series' last values: the highest and the lowest at the end, by name, "so far" when that
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Env, Header, Reference, TimeTable } from "../data/types.mjs";
|
|
1
|
+
import { Env, Header, Reference, TimeTable, ValueIn } from "../data/types.mjs";
|
|
2
2
|
import { Scene } from "../scene/types.mjs";
|
|
3
3
|
import { Curve } from "../marks/lines.mjs";
|
|
4
4
|
/**
|
|
@@ -23,4 +23,4 @@ export type MultiplesOptions = Header & {
|
|
|
23
23
|
slot?: number;
|
|
24
24
|
};
|
|
25
25
|
/** Small multiples of series over time: one panel each, on one axis unless told otherwise. */
|
|
26
|
-
export declare function multiplesChart(given: TimeTable
|
|
26
|
+
export declare function multiplesChart(given: TimeTable<ValueIn>, options: MultiplesOptions, env: Env): Scene;
|
|
@@ -1,36 +1,64 @@
|
|
|
1
|
-
import { panelTable } from "../data/clean.mjs";
|
|
1
|
+
import { HEADER, checkInput, keysOf, panelTable } from "../data/clean.mjs";
|
|
2
2
|
import { bare, headerNodes } from "../layout/frame.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { thinningStep } from "../marks/budget.mjs";
|
|
4
|
+
import { leftLine, leftOf, leftOut } from "../marks/more.mjs";
|
|
5
|
+
import { linePoints } from "../marks/series-line.mjs";
|
|
4
6
|
import { seriesPaint } from "../theme.mjs";
|
|
5
|
-
import { layoutOf } from "./multiples-layout.mjs";
|
|
7
|
+
import { layoutOf, naturalOf } from "./multiples-layout.mjs";
|
|
6
8
|
import { panelNodes } from "./multiples-marks.mjs";
|
|
7
9
|
import { describeMultiples, hoverOf, wordingOf } from "./multiples-words.mjs";
|
|
8
10
|
// src/kinds/multiples.ts
|
|
11
|
+
/** How wide panels' washed lines are thinned in: those one above another share a pixel column. */
|
|
12
|
+
const stepOf = (panels, buckets) => thinningStep(new Set(panels.map((panel) => panel.plot.y)).size * Math.max(...panels.map((panel) => linePoints(panel.series, true))), 4, buckets / Math.max(1, Math.min(...panels.map((panel) => panel.plot.width))));
|
|
13
|
+
/** A scene with the height it asks for, when it asks for one. */
|
|
14
|
+
const asking = (scene, natural) => natural === void 0 ? scene : {
|
|
15
|
+
...scene,
|
|
16
|
+
natural
|
|
17
|
+
};
|
|
18
|
+
/** The keys multiplesChart takes: any other is refused, with the one it most likely meant. */
|
|
19
|
+
const KEYS = keysOf({
|
|
20
|
+
...HEADER,
|
|
21
|
+
references: true,
|
|
22
|
+
curve: true,
|
|
23
|
+
shared: true,
|
|
24
|
+
across: true,
|
|
25
|
+
zero: true,
|
|
26
|
+
slot: true
|
|
27
|
+
});
|
|
9
28
|
/** Small multiples of series over time: one panel each, on one axis unless told otherwise. */
|
|
10
29
|
function multiplesChart(given, options, env) {
|
|
30
|
+
checkInput({
|
|
31
|
+
what: "table",
|
|
32
|
+
data: given
|
|
33
|
+
}, options, env, { known: KEYS });
|
|
11
34
|
const table = panelTable(given);
|
|
12
|
-
|
|
35
|
+
if (env.sizing === true) return asking(bare(env, options, ""), naturalOf(table, options, env));
|
|
36
|
+
const { panels, plot, moreY, natural } = layoutOf(table, options, env);
|
|
13
37
|
const summary = describeMultiples(table, {
|
|
14
38
|
...wordingOf(table, options, env),
|
|
15
39
|
shown: panels.length
|
|
16
40
|
});
|
|
17
|
-
if (panels.length === 0) return bare(env, options, summary);
|
|
41
|
+
if (panels.length === 0) return asking(bare(env, options, summary), natural);
|
|
42
|
+
const left = leftOut(table.series, panels.map((panel) => panel.series));
|
|
18
43
|
const at = {
|
|
19
44
|
x: table.x,
|
|
20
45
|
curve: options.curve ?? "straight",
|
|
21
46
|
references: options.references ?? [],
|
|
22
47
|
own: seriesPaint(options.slot ?? 0),
|
|
23
|
-
env
|
|
48
|
+
env,
|
|
49
|
+
step: stepOf(panels, table.x.buckets.length)
|
|
24
50
|
};
|
|
25
51
|
return {
|
|
26
52
|
width: env.width,
|
|
27
53
|
height: env.height,
|
|
28
54
|
plot,
|
|
55
|
+
...natural === void 0 ? {} : { natural },
|
|
29
56
|
summary,
|
|
57
|
+
...leftOf(left),
|
|
30
58
|
nodes: [
|
|
31
59
|
...headerNodes(env, options),
|
|
32
60
|
...panels.flatMap((panel) => panelNodes(panel, at)),
|
|
33
|
-
...
|
|
61
|
+
...leftLine(left, {
|
|
34
62
|
y: moreY,
|
|
35
63
|
width: env.width,
|
|
36
64
|
env
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { contentBox } from "../layout/frame.mjs";
|
|
1
|
+
import { aroundHeight, bare, contentBox } from "../layout/frame.mjs";
|
|
2
2
|
import { widest } from "../text/measure.mjs";
|
|
3
3
|
import { SPACE, TEXT } from "../theme.mjs";
|
|
4
|
+
import { leftOf, leftOut } from "../marks/more.mjs";
|
|
4
5
|
import { rowBar, rowName, rowStop, rowValue, rowsMore, rowsZero } from "./row-marks.mjs";
|
|
5
6
|
// src/kinds/row-chart.ts
|
|
6
7
|
/** A row is this tall at most and at least; a bar this thick at most, with this much between two. */
|
|
@@ -13,17 +14,45 @@ const ROW = {
|
|
|
13
14
|
/** The most of the width the names take, and the least the marks keep whatever the numbers ask. */
|
|
14
15
|
const NAMES = .38;
|
|
15
16
|
const LEAST_MARKS = 40;
|
|
17
|
+
/**
|
|
18
|
+
* The height some rows ask for under a kind's rule: the header and the source, what the kind
|
|
19
|
+
* keeps above and below, and every row at its fullest, as many as the kind's marks allow
|
|
20
|
+
* (`cap`). It turns on how many rows there are, never on the height given.
|
|
21
|
+
*/
|
|
22
|
+
const naturalOf = (rule, count) => aroundHeight(rule.header) + (rule.above ?? 0) + Math.min(count, rule.cap ?? Number.POSITIVE_INFINITY) * (rule.most ?? ROW.most) + (rule.below ?? 0);
|
|
23
|
+
/**
|
|
24
|
+
* A chart of rows asked only how tall it would be (`Env.sizing`): its header alone, with the
|
|
25
|
+
* height its rows ask for when it has a value to draw. No row is laid out and nothing is said
|
|
26
|
+
* of them: this scene sizes a box, and is not one to read or to show.
|
|
27
|
+
*/
|
|
28
|
+
function sizingOf(env, rule, rows) {
|
|
29
|
+
const scene = bare(env, rule.header, "");
|
|
30
|
+
if (!rows.drawn || rows.count === 0) return scene;
|
|
31
|
+
return {
|
|
32
|
+
...scene,
|
|
33
|
+
natural: naturalOf(rule, rows.count)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** How wide the names' column is for some words: as wide as the widest, never past its share of the width. */
|
|
37
|
+
const namesWidth = (words, env) => Math.min(env.width * NAMES, Math.ceil(widest(words, TEXT.name, env.measure)));
|
|
38
|
+
/**
|
|
39
|
+
* The height that draws every row, whatever the height now: the same at every height, so a box
|
|
40
|
+
* that grows to it draws them all and stays. None when the kind's cap leaves rows out.
|
|
41
|
+
*/
|
|
42
|
+
const wantsFor = (count, at) => count <= at.cap ? { wants: Math.ceil(at.env.height - at.room + count * ROW.least) } : {};
|
|
16
43
|
/** Where the rows named by some labels go. */
|
|
17
44
|
function rowFrame(labels, rule, env) {
|
|
18
45
|
const box = contentBox(env, rule.header);
|
|
19
|
-
const
|
|
20
|
-
const
|
|
46
|
+
const above = rule.above ?? 0;
|
|
47
|
+
const below = rule.below ?? 0;
|
|
48
|
+
const top = box.y + above;
|
|
49
|
+
const room = Math.max(0, box.height - above - below);
|
|
21
50
|
const tallest = rule.most ?? ROW.most;
|
|
22
51
|
const rowHeight = Math.max(ROW.least, Math.min(tallest, room / Math.max(1, labels.length)));
|
|
23
|
-
const
|
|
52
|
+
const cap = rule.cap ?? Number.POSITIVE_INFINITY;
|
|
53
|
+
const fit = Math.min(Math.floor(room / rowHeight), cap);
|
|
24
54
|
const shown = labels.length <= fit ? labels.length : Math.max(0, fit - 1);
|
|
25
|
-
const
|
|
26
|
-
const names = Math.min(env.width * NAMES, Math.ceil(widest(words, TEXT.name, env.measure)));
|
|
55
|
+
const names = namesWidth([...rule.labelsOf?.(shown) ?? labels.slice(0, shown), ...rule.also ?? []], env);
|
|
27
56
|
return {
|
|
28
57
|
names,
|
|
29
58
|
left: names + SPACE.names,
|
|
@@ -31,6 +60,12 @@ function rowFrame(labels, rule, env) {
|
|
|
31
60
|
rowHeight,
|
|
32
61
|
fit,
|
|
33
62
|
shown,
|
|
63
|
+
natural: naturalOf(rule, labels.length),
|
|
64
|
+
...wantsFor(labels.length, {
|
|
65
|
+
room,
|
|
66
|
+
cap,
|
|
67
|
+
env
|
|
68
|
+
}),
|
|
34
69
|
middle: (slot) => top + (slot + .5) * rowHeight,
|
|
35
70
|
band: (slot) => ({
|
|
36
71
|
x: 0,
|
|
@@ -45,13 +80,13 @@ const barThick = (rowHeight, between = ROW.between) => Math.max(1, Math.min(ROW.
|
|
|
45
80
|
/**
|
|
46
81
|
* Where the marks run: from the names to the right edge, less the room kept past their ends for
|
|
47
82
|
* the numbers written there, on the left too when a mark can run left of zero. The numbers
|
|
48
|
-
* never squeeze the marks under a least width
|
|
49
|
-
* marks run the whole stretch.
|
|
83
|
+
* never squeeze the marks under a least width (`least`, 40 pixels unless a kind asks for less):
|
|
84
|
+
* numbers with no room are left out, and the marks run the whole stretch.
|
|
50
85
|
*/
|
|
51
86
|
function reachOf(frame, texts, at) {
|
|
52
87
|
const sides = at.bothSides === true ? 2 : 1;
|
|
53
88
|
const pad = SPACE.value + 1;
|
|
54
|
-
const cap = (at.env.width - frame.left - pad * sides - LEAST_MARKS) / sides;
|
|
89
|
+
const cap = (at.env.width - frame.left - pad * sides - (at.least ?? LEAST_MARKS)) / sides;
|
|
55
90
|
const wanted = Math.ceil(widest(texts, TEXT.value, at.env.measure));
|
|
56
91
|
const fits = wanted <= cap;
|
|
57
92
|
const room = fits ? Math.max(0, wanted) : 0;
|
|
@@ -109,4 +144,6 @@ const slotsOf = (kept) => (kept.at(-1)?.slot ?? -1) + 1;
|
|
|
109
144
|
* fits down, and the marks have room across. Without, the chart is its header alone.
|
|
110
145
|
*/
|
|
111
146
|
const hasRoom = (frame, reach, drawn) => drawn && frame.shown > 0 && reach.to - reach.from >= 24;
|
|
112
|
-
|
|
147
|
+
/** What a row chart's scene says of the height that draws all its rows. */
|
|
148
|
+
const wantsOf = (frame) => frame.wants === void 0 ? {} : { wants: frame.wants };
|
|
149
|
+
export { ROW, barThick, hasRoom, keptRows, leftOf, leftOut, namesWidth, reachOf, rowBar, rowFrame, rowName, rowPlot, rowStop, rowValue, rowsMore, rowsZero, sizingOf, slotsOf, slotted, wantsOf };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { most } from "../data/range.mjs";
|
|
2
2
|
import { rightOf } from "../layout/extent.mjs";
|
|
3
3
|
import { zeroLine } from "../marks/axes.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { leftLine } from "../marks/more.mjs";
|
|
5
|
+
import { fitted } from "../text/measure.mjs";
|
|
6
6
|
import { SPACE, TEXT, roundedEnd } from "../theme.mjs";
|
|
7
7
|
// src/kinds/row-marks.ts
|
|
8
8
|
/** A row's name: at the left of its row, cut to the names' width. */
|
|
@@ -13,7 +13,7 @@ function rowName(label, at) {
|
|
|
13
13
|
key: at.key,
|
|
14
14
|
x: 0,
|
|
15
15
|
y: at.frame.middle(at.slot),
|
|
16
|
-
|
|
16
|
+
...fitted(label, at.frame.names, TEXT.name, at.env.measure),
|
|
17
17
|
...TEXT.name,
|
|
18
18
|
baseline: "middle"
|
|
19
19
|
};
|
|
@@ -106,13 +106,13 @@ function rowStop(title, at) {
|
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
|
-
* The line that
|
|
109
|
+
* The line that names the rows left out, in the slot after the last row drawn unless a place
|
|
110
110
|
* is given. Nothing when every row is drawn, or when there is no room for even one.
|
|
111
111
|
*/
|
|
112
112
|
function rowsMore(left, at) {
|
|
113
113
|
if (at.frame.fit < 1) return [];
|
|
114
114
|
const y = at.y ?? at.frame.middle(at.slot ?? at.frame.shown);
|
|
115
|
-
return
|
|
115
|
+
return leftLine(left, {
|
|
116
116
|
y,
|
|
117
117
|
width: at.env.width,
|
|
118
118
|
env: at.env
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Named } from "../data/rows.mjs";
|
|
2
|
-
import { Tint, Value } from "../data/types.mjs";
|
|
2
|
+
import { Tint, Value, ValueIn } from "../data/types.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* A point to place. The colour it asks for (`Tint`: its own `color`, else its palette `slot`,
|
|
5
5
|
* as a series' and a ranked bar's) is its group's: the dots of a group share one colour, the
|
|
6
6
|
* one asked for by the first of its points that asks. A point in no group wears the chart's
|
|
7
7
|
* own colour, or grey beside groups.
|
|
8
8
|
*/
|
|
9
|
-
export type ScatterPoint = Named & Tint & {
|
|
10
|
-
x:
|
|
11
|
-
y:
|
|
9
|
+
export type ScatterPoint<V extends ValueIn = Value> = Named & Tint & {
|
|
10
|
+
x: V;
|
|
11
|
+
y: V;
|
|
12
12
|
/** The value the dot's area shows, when the chart is given a size measure. */
|
|
13
|
-
size?:
|
|
13
|
+
size?: V;
|
|
14
14
|
/** The dots of a group share a colour, and the groups are named in a legend. */
|
|
15
15
|
group?: string;
|
|
16
16
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { drawable } from "../data/clean.mjs";
|
|
2
2
|
import { keyOf } from "../data/rows.mjs";
|
|
3
|
+
import { sqrtScale } from "../scale/linear.mjs";
|
|
3
4
|
import { quantile } from "d3-array";
|
|
4
|
-
import { scaleSqrt } from "d3-scale";
|
|
5
5
|
// src/kinds/scatter-data.ts
|
|
6
6
|
/** The points that can be drawn: a point missing either value, or with one not finite, has no place. */
|
|
7
7
|
function cleaned(points) {
|
|
8
|
-
return points.flatMap(({ x, y, size, ...rest }) => {
|
|
9
|
-
const across = drawable(x);
|
|
10
|
-
const up = drawable(y);
|
|
11
|
-
const sized = drawable(size);
|
|
8
|
+
return points.flatMap(({ x, y, size, ...rest }, i) => {
|
|
9
|
+
const across = drawable(x, "points[#].x", i);
|
|
10
|
+
const up = drawable(y, "points[#].y", i);
|
|
11
|
+
const sized = drawable(size, "points[#].size", i);
|
|
12
12
|
if (across === null || up === null) return [];
|
|
13
13
|
const key = keyOf(rest);
|
|
14
14
|
return [{
|
|
@@ -61,7 +61,7 @@ function radiiOf(points, at) {
|
|
|
61
61
|
if (!at.sized) return points.map(() => 4);
|
|
62
62
|
const sizes = points.flatMap((p) => sizeOf(p) ?? []).toSorted((a, b) => a - b);
|
|
63
63
|
const cap = quantile(sizes, CAP) ?? 0;
|
|
64
|
-
const scale =
|
|
64
|
+
const scale = sqrtScale([0, cap > 0 ? cap : 1], [SMALLEST, at.biggest]);
|
|
65
65
|
return points.map((p) => {
|
|
66
66
|
const size = sizeOf(p);
|
|
67
67
|
return size === void 0 ? 4 : scale(size);
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import "../scene/paint.mjs";
|
|
2
2
|
import { placeLabels } from "../layout/place-labels.mjs";
|
|
3
3
|
import { X_ROOM, valueGrid, zeroLine } from "../marks/axes.mjs";
|
|
4
|
+
import { shapesFor } from "../marks/budget.mjs";
|
|
4
5
|
import { dot } from "../marks/dot.mjs";
|
|
5
6
|
import { levelNotes, marked, uprightNotes } from "../marks/notes.mjs";
|
|
6
7
|
import { xGrid } from "../marks/x-axis.mjs";
|
|
7
|
-
import {
|
|
8
|
+
import { fitted } from "../text/measure.mjs";
|
|
8
9
|
import { TEXT } from "../theme.mjs";
|
|
9
10
|
import { NAME_ROOM, clearOf } from "./scatter-layout.mjs";
|
|
10
11
|
// src/kinds/scatter-marks.ts
|
|
11
|
-
/**
|
|
12
|
-
* Dots are drawn a little see-through, so where many overlap the pile reads darker than one dot.
|
|
13
|
-
* The scatter's own: no other kind draws dots that may lie on top of each other.
|
|
14
|
-
*/
|
|
15
|
-
const SEE_THROUGH = .85;
|
|
16
12
|
/** A name is never wider than this share of the plot, nor narrower than this. */
|
|
17
13
|
const WIDEST = .4;
|
|
18
14
|
const NARROWEST = 40;
|
|
@@ -63,7 +59,7 @@ function axisNames(layout, at) {
|
|
|
63
59
|
const name = (text, place) => ({
|
|
64
60
|
kind: "text",
|
|
65
61
|
part: "axis-name",
|
|
66
|
-
|
|
62
|
+
...fitted(text, place.anchor === "end" ? right : env.width, TEXT.tick, env.measure),
|
|
67
63
|
...TEXT.tick,
|
|
68
64
|
baseline: "hanging",
|
|
69
65
|
...place
|
|
@@ -97,19 +93,50 @@ function notesOf(layout, at) {
|
|
|
97
93
|
}, room)], room);
|
|
98
94
|
}
|
|
99
95
|
/**
|
|
96
|
+
* The dots drawn, each with how many it stands for. Past the mark budget, dots of one look
|
|
97
|
+
* (colour, size to the pixel, hollow or not) in one square are drawn as one, the square a pixel
|
|
98
|
+
* and doubling until they fit: they lie on top of each other already.
|
|
99
|
+
*/
|
|
100
|
+
function piled(dots, at) {
|
|
101
|
+
let drawn = dots.map((one) => ({
|
|
102
|
+
dot: one,
|
|
103
|
+
count: 1
|
|
104
|
+
}));
|
|
105
|
+
const across = Math.max(at.env.width, at.env.height);
|
|
106
|
+
for (let square = 1; drawn.length > shapesFor(at.env.width) && square < across; square *= 2) {
|
|
107
|
+
const spots = /* @__PURE__ */ new Map();
|
|
108
|
+
for (const d of dots) {
|
|
109
|
+
const spot = `${[
|
|
110
|
+
Math.floor(d.x / square),
|
|
111
|
+
Math.floor(d.y / square),
|
|
112
|
+
Math.round(d.r),
|
|
113
|
+
d.hollow
|
|
114
|
+
].join(" ")} ${colorOf(d.point, at)}`;
|
|
115
|
+
const known = spots.get(spot);
|
|
116
|
+
if (known === void 0) spots.set(spot, {
|
|
117
|
+
dot: d,
|
|
118
|
+
count: 1
|
|
119
|
+
});
|
|
120
|
+
else known.count += 1;
|
|
121
|
+
}
|
|
122
|
+
drawn = [...spots.values()];
|
|
123
|
+
}
|
|
124
|
+
return drawn;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
100
127
|
* Dots, largest drawn first so the small ones stay on top and can be reached; a dot with no size
|
|
101
|
-
* in a sized chart hollow, ringed in its colour.
|
|
128
|
+
* in a sized chart hollow, ringed in its colour; a pile drawn as one as dark as the pile.
|
|
102
129
|
*/
|
|
103
130
|
function dotNodes(dots, at) {
|
|
104
|
-
return dots.toSorted((a, b) => b.r - a.r || a.index - b.index).map((
|
|
105
|
-
x:
|
|
106
|
-
y:
|
|
107
|
-
r:
|
|
108
|
-
color: colorOf(
|
|
109
|
-
hollow:
|
|
131
|
+
return piled(dots.toSorted((a, b) => b.r - a.r || a.index - b.index), at).map(({ dot: first, count }) => dot({
|
|
132
|
+
x: first.x,
|
|
133
|
+
y: first.y,
|
|
134
|
+
r: first.r,
|
|
135
|
+
color: colorOf(first.point, at),
|
|
136
|
+
hollow: first.hollow,
|
|
110
137
|
part: "dot",
|
|
111
|
-
key:
|
|
112
|
-
opacity:
|
|
138
|
+
key: first.key,
|
|
139
|
+
opacity: 1 - .15000000000000002 ** count
|
|
113
140
|
}));
|
|
114
141
|
}
|
|
115
142
|
/**
|
|
@@ -122,10 +149,10 @@ function nameNodes(layout, at) {
|
|
|
122
149
|
const { dots, plot } = layout;
|
|
123
150
|
const chosen = at.chosen.flatMap((i) => dots[i] ?? []);
|
|
124
151
|
const widest = Math.max(NARROWEST, plot.width * WIDEST);
|
|
125
|
-
const texts = chosen.map((d) =>
|
|
152
|
+
const texts = chosen.map((d) => fitted(d.point.label, widest, TEXT.name, env.measure));
|
|
126
153
|
const wanted = chosen.map((d, i) => ({
|
|
127
154
|
...clearOf(d),
|
|
128
|
-
width: env.measure(texts[i] ?? "", TEXT.name),
|
|
155
|
+
width: env.measure(texts[i]?.text ?? "", TEXT.name),
|
|
129
156
|
height: NAME_BOX
|
|
130
157
|
}));
|
|
131
158
|
const spots = placeLabels(wanted, plot, {
|
|
@@ -139,7 +166,7 @@ function nameNodes(layout, at) {
|
|
|
139
166
|
part: "name",
|
|
140
167
|
key: d.key,
|
|
141
168
|
...spot,
|
|
142
|
-
|
|
169
|
+
...texts[i] ?? { text: "" },
|
|
143
170
|
...TEXT.name,
|
|
144
171
|
baseline: "middle",
|
|
145
172
|
halo: true
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { counted, noValue, summary } from "../describe.mjs";
|
|
2
|
+
import { lazyStop } from "../scene/lazy.mjs";
|
|
2
3
|
import { colorOf } from "./scatter-marks.mjs";
|
|
3
4
|
// src/kinds/scatter-words.ts
|
|
4
5
|
/** Fewer points than this say nothing about how two measures move together. */
|
|
@@ -65,16 +66,15 @@ function stopOf(dot, at) {
|
|
|
65
66
|
r: dot.r
|
|
66
67
|
});
|
|
67
68
|
const { size } = dot.point;
|
|
68
|
-
return {
|
|
69
|
+
return lazyStop({
|
|
69
70
|
key: dot.key,
|
|
70
71
|
x: dot.x,
|
|
71
72
|
y: dot.y,
|
|
72
|
-
title: dot.point.label
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
};
|
|
73
|
+
title: dot.point.label
|
|
74
|
+
}, () => [
|
|
75
|
+
item("x", at.x, dot.point.x),
|
|
76
|
+
item("y", at.y, dot.point.y),
|
|
77
|
+
...at.size === void 0 || size === void 0 ? [] : [item("size", at.size, size)]
|
|
78
|
+
]);
|
|
79
79
|
}
|
|
80
80
|
export { describeScatter, stopOf };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { Env, Header, Measure, Reference } from "../data/types.mjs";
|
|
1
|
+
import { Env, Header, Measure, Reference, ValueIn } from "../data/types.mjs";
|
|
2
2
|
import { Scene } from "../scene/types.mjs";
|
|
3
|
-
import { ScatterNamed, ScatterPoint } from "./scatter-data.mjs";
|
|
3
|
+
import { ScatterNamed, ScatterPoint as ScatterPoint$1 } from "./scatter-data.mjs";
|
|
4
|
+
/** A point of a scatter as a host gives it: each value a number, decimal text, or null. */
|
|
5
|
+
export type ScatterPoint<V extends ValueIn = ValueIn> = ScatterPoint$1<V>;
|
|
4
6
|
export type ScatterOptions = Header & {
|
|
5
7
|
x: Measure;
|
|
6
8
|
y: Measure;
|
|
@@ -18,4 +20,4 @@ export type ScatterOptions = Header & {
|
|
|
18
20
|
};
|
|
19
21
|
/** A scatter of things by two measures, optionally sized by a third and coloured by group. */
|
|
20
22
|
export declare function scatterChart(points: readonly ScatterPoint[], options: ScatterOptions, env: Env): Scene;
|
|
21
|
-
export type { ScatterNamed
|
|
23
|
+
export type { ScatterNamed };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HEADER, checkInput, keysOf } from "../data/clean.mjs";
|
|
1
2
|
import { bare, headerNodes, roomy } from "../layout/frame.mjs";
|
|
2
3
|
import { seriesPaint } from "../theme.mjs";
|
|
3
4
|
import { chosenOf, cleaned } from "./scatter-data.mjs";
|
|
@@ -5,8 +6,25 @@ import { layoutOf } from "./scatter-layout.mjs";
|
|
|
5
6
|
import { axisNames, dotNodes, gridNodes, nameNodes, notesOf } from "./scatter-marks.mjs";
|
|
6
7
|
import { describeScatter, stopOf } from "./scatter-words.mjs";
|
|
7
8
|
// src/kinds/scatter.ts
|
|
9
|
+
/** The keys scatterChart takes: any other is refused, with the one it most likely meant. */
|
|
10
|
+
const KEYS = keysOf({
|
|
11
|
+
...HEADER,
|
|
12
|
+
x: true,
|
|
13
|
+
y: true,
|
|
14
|
+
size: true,
|
|
15
|
+
named: true,
|
|
16
|
+
references: true,
|
|
17
|
+
slot: true
|
|
18
|
+
});
|
|
8
19
|
/** A scatter of things by two measures, optionally sized by a third and coloured by group. */
|
|
9
20
|
function scatterChart(points, options, env) {
|
|
21
|
+
checkInput({
|
|
22
|
+
what: "points",
|
|
23
|
+
data: points
|
|
24
|
+
}, options, env, {
|
|
25
|
+
known: KEYS,
|
|
26
|
+
needs: ["x", "y"]
|
|
27
|
+
});
|
|
10
28
|
const all = cleaned(points);
|
|
11
29
|
const layout = layoutOf(all, options, env);
|
|
12
30
|
const roomy$1 = all.length > 0 && roomy(layout.plot);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { cleanTable, drawable } from "../data/clean.mjs";
|
|
1
|
+
import { cleanTable, drawable, writtenOf } from "../data/clean.mjs";
|
|
3
2
|
import { arrowOf, arrowed, changeWritten, movedAsWritten, said } from "../data/format.mjs";
|
|
3
|
+
import { isRunning, isStarting } from "derive-dashboards/core";
|
|
4
4
|
// src/kinds/stat-data.ts
|
|
5
5
|
/**
|
|
6
6
|
* The arrow a change is said with, so its colour is never its only sign. A stat's change is a
|
|
@@ -18,7 +18,7 @@ const ARROW = {
|
|
|
18
18
|
* none; a share's change is written and read by the shared rule.
|
|
19
19
|
*/
|
|
20
20
|
function changeOf(value, given, percent) {
|
|
21
|
-
const against = drawable(given.against ?? null);
|
|
21
|
+
const against = drawable(given.against ?? null, "against");
|
|
22
22
|
if (value === null || against === null) return void 0;
|
|
23
23
|
const written = changeWritten({
|
|
24
24
|
from: against,
|
|
@@ -46,12 +46,12 @@ function changeOf(value, given, percent) {
|
|
|
46
46
|
}
|
|
47
47
|
/** The stat cleaned, with its change worked out. */
|
|
48
48
|
function statOf(given, percent) {
|
|
49
|
-
const value = drawable(given.value);
|
|
49
|
+
const value = drawable(given.value, "value");
|
|
50
50
|
return {
|
|
51
51
|
title: given.title,
|
|
52
52
|
measure: given.measure,
|
|
53
53
|
value,
|
|
54
|
-
text: value === null ? void 0 : said(given.text) ?? given.measure.text(value),
|
|
54
|
+
text: value === null ? void 0 : said(given.text) ?? writtenOf(given.value, given.measure) ?? given.measure.text(value),
|
|
55
55
|
short: value === null ? void 0 : given.measure.tick(value),
|
|
56
56
|
change: changeOf(value, given, percent)
|
|
57
57
|
};
|
|
@@ -72,8 +72,8 @@ function settled(given) {
|
|
|
72
72
|
if (given === void 0) return void 0;
|
|
73
73
|
const table = cleanTable(given);
|
|
74
74
|
const { buckets } = table.x;
|
|
75
|
-
const from =
|
|
76
|
-
const to = buckets.length - (buckets.length > from &&
|
|
75
|
+
const from = isStarting(buckets[0]) ? 1 : 0;
|
|
76
|
+
const to = buckets.length - (buckets.length > from && isRunning(buckets.at(-1)) ? 1 : 0);
|
|
77
77
|
const { titles } = table.x;
|
|
78
78
|
return {
|
|
79
79
|
x: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { wordsOf } from "../data/words.mjs";
|
|
2
2
|
import { INK } from "../scene/paint.mjs";
|
|
3
3
|
import { seriesLine } from "../marks/series-line.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { fitted } from "../text/measure.mjs";
|
|
5
5
|
import { TEXT, ownPaint, signPaint } from "../theme.mjs";
|
|
6
6
|
import { changeParts } from "./stat-data.mjs";
|
|
7
7
|
import { BIG, TOPS } from "./stat-layout.mjs";
|
|
@@ -47,7 +47,7 @@ function headNodes(at) {
|
|
|
47
47
|
part: "header",
|
|
48
48
|
x: 0,
|
|
49
49
|
y: TOPS.title,
|
|
50
|
-
|
|
50
|
+
...fitted(stat.title, env.width, TEXT.subtitle, env.measure),
|
|
51
51
|
...TEXT.subtitle,
|
|
52
52
|
baseline: "hanging"
|
|
53
53
|
};
|