derive-dashboards 0.7.1 → 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 +86 -44
- 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 -32
- 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 +51 -9
- 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 +12 -6
- 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/marks/x-axis.mjs +3 -2
- 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.d.mts +25 -25
- package/dist/charts/theme.mjs +47 -30
- 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 +11 -8
- package/dist/core/document/display.mjs +26 -3
- 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 -18
- package/dist/core/time/bucket.mjs +12 -8
- 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.d.mts +6 -1
- package/dist/core/time/zone.mjs +13 -4
- 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 +90 -69
- package/dist/react/Cell.mjs +2 -1
- package/dist/react/Dashboard.d.mts +15 -1
- package/dist/react/Dashboard.mjs +43 -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 +25 -52
- 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/columns.mjs +9 -1
- 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/board.mjs +1 -0
- package/dist/react/drill/host.mjs +4 -1
- package/dist/react/drill/lazy.mjs +2 -27
- package/dist/react/drill/props.d.mts +19 -8
- package/dist/react/drill/props.mjs +62 -18
- 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 +35 -122
- package/dist/react/headline.d.mts +12 -0
- package/dist/react/headline.mjs +107 -0
- package/dist/react/index.d.mts +20 -17
- package/dist/react/index.mjs +13 -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/place.mjs +4 -2
- 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 +154 -92
- 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 +23 -17
- package/dist/recharts/marks.mjs +2 -1
- package/dist/recharts/parts.mjs +19 -14
- 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 +25 -9
- 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,18 +1,44 @@
|
|
|
1
|
+
import { HEADER, checkInput, keysOf } from "../data/clean.mjs";
|
|
2
|
+
import { wordsOf } from "../data/words.mjs";
|
|
1
3
|
import { bare, headerNodes } from "../layout/frame.mjs";
|
|
2
4
|
import { paintsOf, seriesPaint } from "../theme.mjs";
|
|
5
|
+
import { leftOf, leftOut } from "../marks/more.mjs";
|
|
3
6
|
import { cleaned, ordered } from "./bars-data.mjs";
|
|
4
7
|
import { rowsMore, rowsZero } from "./row-marks.mjs";
|
|
5
8
|
import { layoutOf } from "./bars-layout.mjs";
|
|
6
9
|
import { rowNodes } from "./bars-marks.mjs";
|
|
7
10
|
import { describeBars, stopOf } from "./bars-words.mjs";
|
|
8
|
-
import { hasRoom } from "./row-chart.mjs";
|
|
11
|
+
import { hasRoom, sizingOf, wantsOf } from "./row-chart.mjs";
|
|
9
12
|
// src/kinds/bars.ts
|
|
13
|
+
/** The keys barChart takes: any other is refused, with the one it most likely meant. */
|
|
14
|
+
const KEYS = keysOf({
|
|
15
|
+
...HEADER,
|
|
16
|
+
measure: true,
|
|
17
|
+
sort: true,
|
|
18
|
+
focus: true,
|
|
19
|
+
againstLabel: true,
|
|
20
|
+
slot: true
|
|
21
|
+
});
|
|
10
22
|
/** Ranked bars of one measure by category. */
|
|
11
23
|
function barChart(rows, options, env) {
|
|
24
|
+
checkInput({
|
|
25
|
+
what: "rows",
|
|
26
|
+
data: rows
|
|
27
|
+
}, options, env, {
|
|
28
|
+
known: KEYS,
|
|
29
|
+
needs: ["measure"]
|
|
30
|
+
});
|
|
12
31
|
const { measure, focus } = options;
|
|
13
|
-
const all = ordered(cleaned(rows), options.sort);
|
|
14
|
-
|
|
15
|
-
|
|
32
|
+
const all = ordered(cleaned(rows, measure), options.sort);
|
|
33
|
+
if (env.sizing === true) {
|
|
34
|
+
const drawn = all.some((row) => row.value !== null);
|
|
35
|
+
return sizingOf(env, { header: options }, {
|
|
36
|
+
count: all.length,
|
|
37
|
+
drawn
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const { frame, reach, x, kept, moreSlot, drawn, write, plot } = layoutOf(all, options, env);
|
|
41
|
+
const roomy = hasRoom(frame, reach, drawn) && write !== void 0;
|
|
16
42
|
const summary = describeBars(all, {
|
|
17
43
|
shown: roomy ? kept.length : 0,
|
|
18
44
|
measure,
|
|
@@ -28,7 +54,7 @@ function barChart(rows, options, env) {
|
|
|
28
54
|
focus,
|
|
29
55
|
own,
|
|
30
56
|
paints: new Map(all.map((row, i) => [row, tones[i] ?? own])),
|
|
31
|
-
|
|
57
|
+
write,
|
|
32
58
|
env
|
|
33
59
|
};
|
|
34
60
|
const placed = kept.map(({ row, slot }) => ({
|
|
@@ -36,11 +62,18 @@ function barChart(rows, options, env) {
|
|
|
36
62
|
slot,
|
|
37
63
|
nodes: rowNodes(row, slot, at)
|
|
38
64
|
}));
|
|
65
|
+
const left = leftOut(all, placed.map(({ row }) => row));
|
|
66
|
+
const { againstLabel } = options;
|
|
67
|
+
const marked = placed.some(({ row }) => row.against !== void 0);
|
|
39
68
|
return {
|
|
40
69
|
width: env.width,
|
|
41
70
|
height: env.height,
|
|
42
71
|
plot,
|
|
72
|
+
natural: frame.natural,
|
|
43
73
|
summary,
|
|
74
|
+
...marked && againstLabel !== void 0 ? { footnote: wordsOf(env).against(againstLabel) } : {},
|
|
75
|
+
...leftOf(left),
|
|
76
|
+
...wantsOf(frame),
|
|
44
77
|
nodes: [
|
|
45
78
|
...headerNodes(env, options),
|
|
46
79
|
...placed.flatMap(({ nodes }) => nodes),
|
|
@@ -49,7 +82,7 @@ function barChart(rows, options, env) {
|
|
|
49
82
|
x,
|
|
50
83
|
plot
|
|
51
84
|
}),
|
|
52
|
-
...rowsMore(
|
|
85
|
+
...rowsMore(left, {
|
|
53
86
|
frame,
|
|
54
87
|
env,
|
|
55
88
|
slot: moreSlot
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { least } from "../data/range.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { stackOf } from "../layout/stack.mjs";
|
|
3
3
|
// src/kinds/columns-data.ts
|
|
4
4
|
/** A column fills this much of its bucket's band. */
|
|
5
5
|
const FILL = .72;
|
|
@@ -102,10 +102,19 @@ function mergedSeries(series, merge, stack) {
|
|
|
102
102
|
};
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
+
/** The series drawn in some columns, stacked once when they stack. */
|
|
106
|
+
function drawnIn(series, merge, stack) {
|
|
107
|
+
const drawn = mergedSeries(series, merge, stack);
|
|
108
|
+
const values = drawn.map((s) => s.values);
|
|
109
|
+
return {
|
|
110
|
+
series: drawn,
|
|
111
|
+
stack: stack ? stackOf(values, merge.slots.length) : void 0
|
|
112
|
+
};
|
|
113
|
+
}
|
|
105
114
|
/** Every height the axis must reach: the stacks' ends, or each bar's own value. */
|
|
106
|
-
function heightsOf(
|
|
107
|
-
|
|
108
|
-
return
|
|
115
|
+
function heightsOf(drawn) {
|
|
116
|
+
if (drawn.stack !== void 0) return [...drawn.stack.reach];
|
|
117
|
+
return drawn.series.flatMap((s) => s.values).filter((v) => v !== null);
|
|
109
118
|
}
|
|
110
119
|
/** How many buckets a column holds, when every column holds as many; nothing when they differ. */
|
|
111
120
|
function evenSize(merge) {
|
|
@@ -113,4 +122,4 @@ function evenSize(merge) {
|
|
|
113
122
|
const [size] = sizes;
|
|
114
123
|
return sizes.size === 1 ? size : void 0;
|
|
115
124
|
}
|
|
116
|
-
export { FILL, evenSize, heightsOf, meanIn, mergeOf,
|
|
125
|
+
export { FILL, drawnIn, evenSize, heightsOf, meanIn, mergeOf, sizeFor };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { pairKey } from "../data/rows.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { stackedAt } from "../layout/stack.mjs";
|
|
3
|
+
import { SURFACE } from "../scene/paint.mjs";
|
|
3
4
|
import { zeroIn } from "../marks/axes.mjs";
|
|
4
|
-
import { MARK, paintAt, roundedEnd } from "../theme.mjs";
|
|
5
|
+
import { MARK, paintAt, repeatsOf, roundedEnd } from "../theme.mjs";
|
|
5
6
|
import { FILL } from "./columns-data.mjs";
|
|
6
7
|
// src/kinds/columns-marks.ts
|
|
7
8
|
/** A column is never wider than this. */
|
|
@@ -38,6 +39,13 @@ function columnAt(frame, paints, rows) {
|
|
|
38
39
|
function barKey(series, stand) {
|
|
39
40
|
return stand === void 0 ? {} : { key: pairKey(series.key, stand.label) };
|
|
40
41
|
}
|
|
42
|
+
/** A series whose colour an earlier one wears: its bars hollow, ringed in a dash of its colour. */
|
|
43
|
+
const cued = (repeats, color) => repeats ? {
|
|
44
|
+
fill: SURFACE,
|
|
45
|
+
stroke: color,
|
|
46
|
+
strokeWidth: MARK.hair,
|
|
47
|
+
dash: MARK.repeat
|
|
48
|
+
} : {};
|
|
41
49
|
/** A column the data covers only part of, at either end, is drawn faint. */
|
|
42
50
|
const faint = (stand, color) => stand.faint ? {
|
|
43
51
|
opacity: MARK.partialFill,
|
|
@@ -74,36 +82,55 @@ function segment(span, at) {
|
|
|
74
82
|
height,
|
|
75
83
|
fill: at.fill,
|
|
76
84
|
...at.outer ? { radius: roundedEnd(up ? "up" : "down") } : {},
|
|
77
|
-
...faint(stand, at.fill)
|
|
85
|
+
...faint(stand, at.fill),
|
|
86
|
+
...cued(at.repeats, at.fill)
|
|
78
87
|
};
|
|
79
88
|
}
|
|
89
|
+
/** A series' span at a place of a stack; nothing where it has no value. */
|
|
90
|
+
const spanIn = (stack, s, i) => stackedAt(stack, s, i) ? {
|
|
91
|
+
from: stack.from[s]?.[i] ?? 0,
|
|
92
|
+
to: stack.to[s]?.[i] ?? 0
|
|
93
|
+
} : void 0;
|
|
94
|
+
/**
|
|
95
|
+
* At each place, the last series that stacks up from zero and the last that stacks down (a value
|
|
96
|
+
* of nothing counts as down): the one whose segment is its stack's outer end that way.
|
|
97
|
+
*/
|
|
98
|
+
function outerEnds(stack, series) {
|
|
99
|
+
const up = new Int32Array(stack.places).fill(-1);
|
|
100
|
+
const down = new Int32Array(stack.places).fill(-1);
|
|
101
|
+
for (let s = 0; s < series; s++) for (let i = 0; i < stack.places; i++) {
|
|
102
|
+
const span = spanIn(stack, s, i);
|
|
103
|
+
if (span !== void 0) (span.to > span.from ? up : down)[i] = s;
|
|
104
|
+
}
|
|
105
|
+
return (s, i, rising) => (rising ? up : down)[i] === s;
|
|
106
|
+
}
|
|
80
107
|
/**
|
|
81
108
|
* One column per bucket, its series stacked. Each series is named beside its last segment.
|
|
82
|
-
* `series` are the series as drawn
|
|
109
|
+
* `series` are the series as drawn (a value a column), and `stack` their one stack.
|
|
83
110
|
*/
|
|
84
|
-
function stackedBars(
|
|
111
|
+
function stackedBars(drawn, at) {
|
|
112
|
+
const { series, stack } = drawn;
|
|
85
113
|
const places = at.stands.length;
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const nodes = spans.flatMap((row, s) => row.flatMap((span, i) => {
|
|
92
|
-
const [one, stand] = [series[s], at.stands[i]];
|
|
93
|
-
if (span === void 0 || one === void 0 || stand === void 0) return [];
|
|
94
|
-
if (span.from === span.to) return [];
|
|
114
|
+
const outer = outerEnds(stack, series.length);
|
|
115
|
+
const repeats = repeatsOf(series.map((_one, s) => paintAt(at.paints, s)));
|
|
116
|
+
const nodes = series.flatMap((one, s) => at.stands.flatMap((stand, i) => {
|
|
117
|
+
const span = spanIn(stack, s, i);
|
|
118
|
+
if (span === void 0 || span.from === span.to) return [];
|
|
95
119
|
const end = outer(s, i, span.to > span.from);
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
frame: at.frame,
|
|
99
|
-
fill,
|
|
120
|
+
const look = {
|
|
121
|
+
fill: paintAt(at.paints, s),
|
|
100
122
|
series: one,
|
|
101
123
|
stand,
|
|
102
|
-
outer: end
|
|
124
|
+
outer: end,
|
|
125
|
+
repeats: repeats[s] === true
|
|
126
|
+
};
|
|
127
|
+
return [segment(span, {
|
|
128
|
+
frame: at.frame,
|
|
129
|
+
...look
|
|
103
130
|
})];
|
|
104
131
|
}));
|
|
105
132
|
const middle = (s, i) => {
|
|
106
|
-
const span =
|
|
133
|
+
const span = spanIn(stack, s, i);
|
|
107
134
|
return span === void 0 ? void 0 : at.frame.place((span.from + span.to) / 2);
|
|
108
135
|
};
|
|
109
136
|
return {
|
|
@@ -111,8 +138,8 @@ function stackedBars(series, at) {
|
|
|
111
138
|
band: at.lit,
|
|
112
139
|
labelY: (s) => middle(s, places - 1),
|
|
113
140
|
markAt: (one, i) => {
|
|
114
|
-
const
|
|
115
|
-
const y =
|
|
141
|
+
const found = drawnAt(at, one, i);
|
|
142
|
+
const y = found === void 0 ? void 0 : middle(found.place, found.slot);
|
|
116
143
|
return y === void 0 ? void 0 : {
|
|
117
144
|
x: at.frame.time.center(i),
|
|
118
145
|
y
|
|
@@ -127,6 +154,7 @@ function stackedBars(series, at) {
|
|
|
127
154
|
function groupedBars(series, at) {
|
|
128
155
|
const { frame } = at;
|
|
129
156
|
const zero = zeroIn(frame.plot, frame.place);
|
|
157
|
+
const repeats = repeatsOf(series.map((_one, n) => paintAt(at.paints, n)));
|
|
130
158
|
const count = Math.max(1, series.length);
|
|
131
159
|
/** A series' bar in a column: its left edge and its width. */
|
|
132
160
|
const barIn = (stand, place) => {
|
|
@@ -150,7 +178,8 @@ function groupedBars(series, at) {
|
|
|
150
178
|
height,
|
|
151
179
|
fill: paintAt(at.paints, n),
|
|
152
180
|
radius: roundedEnd(value >= 0 ? "up" : "down"),
|
|
153
|
-
...faint(stand, paintAt(at.paints, n))
|
|
181
|
+
...faint(stand, paintAt(at.paints, n)),
|
|
182
|
+
...cued(repeats[n] === true, paintAt(at.paints, n))
|
|
154
183
|
}];
|
|
155
184
|
})),
|
|
156
185
|
band: at.lit,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Env, Header, TimeTable } from "../data/types.mjs";
|
|
1
|
+
import { Env, Header, TimeTable, ValueIn } from "../data/types.mjs";
|
|
2
2
|
import { Scene } from "../scene/types.mjs";
|
|
3
3
|
import { Naming, TimeNotes } from "./time-plan.mjs";
|
|
4
4
|
export type ColumnOptions = Header & TimeNotes & {
|
|
@@ -10,4 +10,4 @@ export type ColumnOptions = Header & TimeNotes & {
|
|
|
10
10
|
naming?: Naming;
|
|
11
11
|
};
|
|
12
12
|
/** A column chart of series over time. */
|
|
13
|
-
export declare function columnChart(given: TimeTable
|
|
13
|
+
export declare function columnChart(given: TimeTable<ValueIn>, options: ColumnOptions, env: Env): Scene;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { cleanTable } from "../data/clean.mjs";
|
|
1
|
+
import { HEADER, NOTES, checkInput, cleanTable, keysOf } from "../data/clean.mjs";
|
|
2
2
|
import { addsUp, asShares, levelsOfShares, stackOrder } from "../data/shares.mjs";
|
|
3
|
+
import { columnWidth } from "../marks/budget.mjs";
|
|
3
4
|
import { paintsOf } from "../theme.mjs";
|
|
4
|
-
import {
|
|
5
|
+
import { FILL, drawnIn, heightsOf } from "./columns-data.mjs";
|
|
5
6
|
import { columnsFor } from "./columns-layout.mjs";
|
|
6
7
|
import { columnAt, groupedBars, mergedTargets, stackedBars } from "./columns-marks.mjs";
|
|
7
8
|
import { mergedWords } from "./columns-words.mjs";
|
|
8
|
-
import { namingOf, reachEnd } from "./time-plan.mjs";
|
|
9
|
+
import { inFirstUnit, namingOf, reachEnd } from "./time-plan.mjs";
|
|
9
10
|
import { framedChart, framedOf } from "./time-chart.mjs";
|
|
10
11
|
// src/kinds/columns.ts
|
|
11
12
|
/** The series to draw and how: shares are stacked; values that do not add up stand side by side. */
|
|
@@ -26,16 +27,31 @@ function arranged(table, options, env) {
|
|
|
26
27
|
share: true
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
|
-
/**
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* What a bucket's own column must be wide to be drawn: a pixel, or side by side a pixel a
|
|
32
|
+
* series; and wide enough for its segments to keep to the mark budget.
|
|
33
|
+
*/
|
|
34
|
+
const neededOf = (shape) => Math.max(shape.stack ? 1 : shape.series.length, columnWidth(shape.series.length, FILL));
|
|
35
|
+
/** The keys columnChart takes: any other is refused, with the one it most likely meant. */
|
|
36
|
+
const KEYS = keysOf({
|
|
37
|
+
...HEADER,
|
|
38
|
+
...NOTES,
|
|
39
|
+
arrange: true,
|
|
40
|
+
naming: true
|
|
41
|
+
});
|
|
31
42
|
/** A column chart of series over time. */
|
|
32
43
|
function columnChart(given, options, env) {
|
|
33
|
-
|
|
44
|
+
checkInput({
|
|
45
|
+
what: "table",
|
|
46
|
+
data: given
|
|
47
|
+
}, options, env, { known: KEYS });
|
|
48
|
+
const { table, left: otherUnit } = inFirstUnit(cleanTable(given));
|
|
34
49
|
const shape = arranged(table, options, env);
|
|
35
50
|
const paints = paintsOf(shape.series);
|
|
36
51
|
const count = shape.series.length;
|
|
37
52
|
const base = {
|
|
38
53
|
what: "Column chart",
|
|
54
|
+
left: otherUnit,
|
|
39
55
|
table: {
|
|
40
56
|
x: table.x,
|
|
41
57
|
series: shape.series
|
|
@@ -54,13 +70,20 @@ function columnChart(given, options, env) {
|
|
|
54
70
|
env
|
|
55
71
|
}),
|
|
56
72
|
zero: "always",
|
|
57
|
-
bands: true
|
|
73
|
+
bands: true,
|
|
74
|
+
stacked: shape.stack
|
|
75
|
+
};
|
|
76
|
+
const made = /* @__PURE__ */ new Map();
|
|
77
|
+
const drawnOf = (merge) => {
|
|
78
|
+
const known = made.get(merge) ?? drawnIn(shape.series, merge, shape.stack);
|
|
79
|
+
made.set(merge, known);
|
|
80
|
+
return known;
|
|
58
81
|
};
|
|
59
82
|
/** The plan with its buckets drawn in some columns: the axis reaches the columns' heights. */
|
|
60
83
|
const planOf = (merge, gutter) => ({
|
|
61
84
|
...base,
|
|
62
85
|
...mergedWords(merge, table.x, env),
|
|
63
|
-
values: heightsOf(
|
|
86
|
+
values: heightsOf(drawnOf(merge)),
|
|
64
87
|
gutter
|
|
65
88
|
});
|
|
66
89
|
const { merge, gutter, room } = columnsFor(table.x, neededOf(shape), (tried, left) => framedOf(planOf(tried, left), env));
|
|
@@ -69,8 +92,11 @@ function columnChart(given, options, env) {
|
|
|
69
92
|
given: shape.series,
|
|
70
93
|
merge
|
|
71
94
|
});
|
|
72
|
-
const drawn =
|
|
73
|
-
return mergedTargets(
|
|
95
|
+
const drawn = drawnOf(merge);
|
|
96
|
+
return mergedTargets(drawn.stack === void 0 ? groupedBars(drawn.series, at) : stackedBars({
|
|
97
|
+
series: drawn.series,
|
|
98
|
+
stack: drawn.stack
|
|
99
|
+
}, at), merge);
|
|
74
100
|
};
|
|
75
101
|
return framedChart(planOf(merge, gutter), env, {
|
|
76
102
|
room,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { cleanTable } from "../data/clean.mjs";
|
|
2
|
+
import { ChartInputError } from "../data/input-error.mjs";
|
|
3
|
+
import { isRunning, isStarting } from "derive-dashboards/core";
|
|
4
|
+
// src/kinds/course-data.ts
|
|
5
|
+
/**
|
|
6
|
+
* The course: the table's first series, cleaned, over its buckets. A first bucket the data
|
|
7
|
+
* starts part of the way into is left out, as a stat's course leaves it out: a part of a week
|
|
8
|
+
* reads as a fall, and a course has no room to say it is a part. A bucket still running is
|
|
9
|
+
* kept, and drawn as running. A series' comparison period is not drawn: a course is one line.
|
|
10
|
+
*/
|
|
11
|
+
function courseOf(given) {
|
|
12
|
+
if (given === void 0) return void 0;
|
|
13
|
+
const table = cleanTable(given);
|
|
14
|
+
const [first] = table.series;
|
|
15
|
+
if (first === void 0) return void 0;
|
|
16
|
+
const { buckets, titles } = table.x;
|
|
17
|
+
const from = isStarting(buckets[0]) && !isRunning(buckets[0]) ? 1 : 0;
|
|
18
|
+
const { previous: _previous, texts, ...rest } = first;
|
|
19
|
+
const series = {
|
|
20
|
+
...rest,
|
|
21
|
+
values: rest.values.slice(from),
|
|
22
|
+
...texts === void 0 ? {} : { texts: texts.slice(from) }
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
table: {
|
|
26
|
+
x: {
|
|
27
|
+
...table.x,
|
|
28
|
+
buckets: buckets.slice(from),
|
|
29
|
+
...titles === void 0 ? {} : { titles: titles.slice(from) }
|
|
30
|
+
},
|
|
31
|
+
series: [series]
|
|
32
|
+
},
|
|
33
|
+
series
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** The shape asked for, else columns for values that add up and a line for the rest; a shape that is neither is refused. */
|
|
37
|
+
function shapeOf(series, asked) {
|
|
38
|
+
if (asked === "columns" || asked === "line") return asked;
|
|
39
|
+
if (asked !== void 0) throw new ChartInputError("shape", "Expected columns, line.");
|
|
40
|
+
return series?.measure.additive === false ? "line" : "columns";
|
|
41
|
+
}
|
|
42
|
+
/** Whether a course has any value to draw. */
|
|
43
|
+
const anyValue = (course) => course?.series.values.some((v) => v !== null) === true;
|
|
44
|
+
export { anyValue, courseOf, shapeOf };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { least, most } from "../data/range.mjs";
|
|
2
|
+
import { roomy } from "../layout/frame.mjs";
|
|
3
|
+
import { columnWidth } from "../marks/budget.mjs";
|
|
4
|
+
import { timeScale } from "../scale/time.mjs";
|
|
5
|
+
import { placeOn, placeable } from "../scale/value.mjs";
|
|
6
|
+
import { FILL, drawnIn, heightsOf, mergeOf, sizeFor } from "./columns-data.mjs";
|
|
7
|
+
import { END_ROOM } from "./time-plot.mjs";
|
|
8
|
+
// src/kinds/course-layout.ts
|
|
9
|
+
/**
|
|
10
|
+
* The least and the most of some values, zero among them when `zero`. Columns of nothing but
|
|
11
|
+
* zero stand on a scale from zero to one, at its foot; a line of one value is level.
|
|
12
|
+
*/
|
|
13
|
+
function axisOf(values, zero) {
|
|
14
|
+
const kept = [...values.map((v) => placeable(v)), ...zero ? [0] : []];
|
|
15
|
+
const [min, max] = kept.length === 0 ? [0, 0] : [least(kept), most(kept)];
|
|
16
|
+
return {
|
|
17
|
+
min,
|
|
18
|
+
max: zero && min === max ? 1 : max,
|
|
19
|
+
ticks: []
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/** Where a value sits between two heights: a level course, every value one, runs through the middle. */
|
|
23
|
+
function placeIn(axis, bottom, top) {
|
|
24
|
+
if (axis.min === axis.max) return () => (bottom + top) / 2;
|
|
25
|
+
const scale = placeOn(axis, bottom, top);
|
|
26
|
+
return (value) => scale(placeable(value));
|
|
27
|
+
}
|
|
28
|
+
/** The plot a shape is drawn in: the whole box for columns, the box less the end dot's room for a line. */
|
|
29
|
+
function plotOf(shape, env) {
|
|
30
|
+
const inset = shape === "line" ? END_ROOM : 0;
|
|
31
|
+
return {
|
|
32
|
+
x: inset,
|
|
33
|
+
y: inset,
|
|
34
|
+
width: env.width - 2 * inset,
|
|
35
|
+
height: env.height - 2 * inset
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Where a course's marks go; nothing when it has no value to draw, or a box under the least a
|
|
40
|
+
* plot may be, where it draws nothing and keeps its summary.
|
|
41
|
+
*/
|
|
42
|
+
function layoutOf(course, shape, env) {
|
|
43
|
+
const box = {
|
|
44
|
+
x: 0,
|
|
45
|
+
y: 0,
|
|
46
|
+
width: env.width,
|
|
47
|
+
height: env.height
|
|
48
|
+
};
|
|
49
|
+
if (!roomy(box)) return void 0;
|
|
50
|
+
const plot = plotOf(shape, env);
|
|
51
|
+
const { x } = course.table;
|
|
52
|
+
const bands = shape === "columns";
|
|
53
|
+
const time = timeScale(x, {
|
|
54
|
+
from: plot.x,
|
|
55
|
+
to: plot.x + plot.width
|
|
56
|
+
}, bands);
|
|
57
|
+
const size = bands ? sizeFor(time.band, columnWidth(1, FILL)) : 1;
|
|
58
|
+
const merge = mergeOf(x, size);
|
|
59
|
+
const drawn = drawnIn([course.series], merge, false);
|
|
60
|
+
const axis = axisOf(heightsOf(drawn), bands);
|
|
61
|
+
const place = placeIn(axis, plot.y + plot.height, plot.y);
|
|
62
|
+
return {
|
|
63
|
+
shape,
|
|
64
|
+
plot,
|
|
65
|
+
frame: {
|
|
66
|
+
buckets: x.buckets,
|
|
67
|
+
plot,
|
|
68
|
+
axis,
|
|
69
|
+
place,
|
|
70
|
+
time,
|
|
71
|
+
base: []
|
|
72
|
+
},
|
|
73
|
+
merge,
|
|
74
|
+
drawn
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export { layoutOf };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { thinningStep } from "../marks/budget.mjs";
|
|
2
|
+
import { linePoints, pointsOf, seriesLine } from "../marks/series-line.mjs";
|
|
3
|
+
import { ownPaint } from "../theme.mjs";
|
|
4
|
+
import { columnAt, groupedBars, mergedTargets } from "./columns-marks.mjs";
|
|
5
|
+
// src/kinds/course-marks.ts
|
|
6
|
+
/** The course's colour: the series' own when it brings one (Other's grey when it is that), else the chart's. A series' slot is not read. */
|
|
7
|
+
const colorOf = (series, at) => ownPaint(series) ?? at.own;
|
|
8
|
+
/** Columns from zero, one a bucket, or one for several where a bucket's own would be under a pixel. */
|
|
9
|
+
function columnsOf(at) {
|
|
10
|
+
const { frame, merge, drawn } = at.layout;
|
|
11
|
+
const columns = columnAt(frame, [colorOf(at.series, at)], {
|
|
12
|
+
given: [at.series],
|
|
13
|
+
merge
|
|
14
|
+
});
|
|
15
|
+
return mergedTargets(groupedBars(drawn.series, columns), merge);
|
|
16
|
+
}
|
|
17
|
+
/** The line, thinned to what its pixels show, and where each of its values sits. */
|
|
18
|
+
function lineOf(at) {
|
|
19
|
+
const { frame } = at.layout;
|
|
20
|
+
const { buckets, plot, time, place } = frame;
|
|
21
|
+
const step = thinningStep(linePoints(at.series, false), 4, buckets.length / Math.max(1, plot.width));
|
|
22
|
+
const where = {
|
|
23
|
+
buckets,
|
|
24
|
+
center: time.center,
|
|
25
|
+
place,
|
|
26
|
+
step
|
|
27
|
+
};
|
|
28
|
+
const points = pointsOf(at.series.values, where);
|
|
29
|
+
return {
|
|
30
|
+
nodes: seriesLine(at.series, where, {
|
|
31
|
+
color: colorOf(at.series, at),
|
|
32
|
+
curve: "straight"
|
|
33
|
+
}),
|
|
34
|
+
labelY: () => void 0,
|
|
35
|
+
dotY: (_series, i) => points[i]?.y
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** The course drawn, as one group keyed by its series. */
|
|
39
|
+
function courseNodes(at) {
|
|
40
|
+
const painted = at.layout.shape === "columns" ? columnsOf(at) : lineOf(at);
|
|
41
|
+
const group = {
|
|
42
|
+
kind: "group",
|
|
43
|
+
part: "series",
|
|
44
|
+
key: at.series.key,
|
|
45
|
+
children: [...painted.nodes]
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
...painted,
|
|
49
|
+
nodes: [group]
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export { colorOf, courseNodes };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { textAt, topAsWritten } from "../data/format.mjs";
|
|
2
|
+
import { course, missingOf, periodOf, spanOf, summary } from "../describe.mjs";
|
|
3
|
+
import { bucketTitles } from "../scale/calendar.mjs";
|
|
4
|
+
import { colorOf } from "./course-marks.mjs";
|
|
5
|
+
import { timeStops } from "./time-stops.mjs";
|
|
6
|
+
// src/kinds/course-words.ts
|
|
7
|
+
/** Where its course went, in words: from its first value to its last, and over what. */
|
|
8
|
+
function courseSaid(table, series, titles) {
|
|
9
|
+
const went = course(series, {
|
|
10
|
+
titles,
|
|
11
|
+
table
|
|
12
|
+
});
|
|
13
|
+
const valued = spanOf(series, titles);
|
|
14
|
+
const over = periodOf(valued);
|
|
15
|
+
return went === void 0 || over === void 0 || valued.length < 2 ? went : `${went}, ${over}`;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Its highest and lowest buckets, by name and value, each only when it reads apart from every
|
|
19
|
+
* other value as written: among values that read alike none is named.
|
|
20
|
+
*/
|
|
21
|
+
function extremes(series, titles) {
|
|
22
|
+
const valued = series.values.flatMap((v, i) => v === null ? [] : [{
|
|
23
|
+
i,
|
|
24
|
+
v
|
|
25
|
+
}]);
|
|
26
|
+
const reads = series.measure.text;
|
|
27
|
+
const high = topAsWritten(valued, (one) => one.v, reads);
|
|
28
|
+
const low = topAsWritten(valued, (one) => -one.v, (value) => reads(-value));
|
|
29
|
+
const said = (word, one) => one === void 0 ? [] : [`${word}: ${titles[one.i] ?? ""}, ${textAt(series, one.i) ?? ""}`];
|
|
30
|
+
return [...said("Highest", high), ...said("Lowest", low)];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* What the course shows, in words. With no table at all it says it has nothing to draw; with
|
|
34
|
+
* one it says what it is a course of, where it went and over what, its highest and lowest, that
|
|
35
|
+
* its columns are averages when they are, and what had no value. A course too small to draw
|
|
36
|
+
* says the same: its words do not turn on its room.
|
|
37
|
+
*/
|
|
38
|
+
function describeCourse(drawn, { env, merged }) {
|
|
39
|
+
if (drawn === void 0) return summary(["Course"], ["No data"]);
|
|
40
|
+
const { table, series } = drawn;
|
|
41
|
+
const titles = bucketTitles(table.x, env.locale);
|
|
42
|
+
return summary([`Course of ${series.measure.label}`], [
|
|
43
|
+
courseSaid(table, series, titles),
|
|
44
|
+
...extremes(series, titles),
|
|
45
|
+
...merged.also ?? [],
|
|
46
|
+
...missingOf(table)
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
49
|
+
/** What a pointer finds along the course: one stop a bucket, with its value where it has one. */
|
|
50
|
+
function stopsOf(drawn, at, painted, wording) {
|
|
51
|
+
const { frame } = at.layout;
|
|
52
|
+
return timeStops(drawn.table, at.env, {
|
|
53
|
+
plot: frame.plot,
|
|
54
|
+
center: frame.time.center,
|
|
55
|
+
titles: bucketTitles(drawn.table.x, at.env.locale),
|
|
56
|
+
paints: [colorOf(drawn.series, at)],
|
|
57
|
+
noteAt: wording.merged.noteAt,
|
|
58
|
+
...painted.dotY === void 0 ? {} : { y: painted.dotY },
|
|
59
|
+
...painted.markAt === void 0 ? {} : { markAt: painted.markAt },
|
|
60
|
+
...painted.spanAt === void 0 ? {} : { spanAt: painted.spanAt },
|
|
61
|
+
...painted.band === void 0 ? {} : { band: painted.band }
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export { describeCourse, stopsOf };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Env, TimeTable } from "../data/types.mjs";
|
|
2
|
+
import { Scene } from "../scene/types.mjs";
|
|
3
|
+
export type CourseOptions = {
|
|
4
|
+
/** Columns or a line; by the measure when left out: columns for one that adds up, a line for the rest. */
|
|
5
|
+
shape?: "columns" | "line";
|
|
6
|
+
/** The palette place of the course's colour. A series that brings its own colour keeps it. */
|
|
7
|
+
slot?: number;
|
|
8
|
+
};
|
|
9
|
+
/** A course of the table's first series over time, alone in its box. */
|
|
10
|
+
export declare function courseChart(given: TimeTable | undefined, options: CourseOptions, env: Env): Scene;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { checkInput, keysOf } from "../data/clean.mjs";
|
|
2
|
+
import { bare } from "../layout/frame.mjs";
|
|
3
|
+
import { seriesPaint } from "../theme.mjs";
|
|
4
|
+
import { mergedWords } from "./columns-words.mjs";
|
|
5
|
+
import { anyValue, courseOf, shapeOf } from "./course-data.mjs";
|
|
6
|
+
import { layoutOf } from "./course-layout.mjs";
|
|
7
|
+
import { courseNodes } from "./course-marks.mjs";
|
|
8
|
+
import { describeCourse, stopsOf } from "./course-words.mjs";
|
|
9
|
+
// src/kinds/course.ts
|
|
10
|
+
/** The keys courseChart takes: any other is refused, with the one it most likely meant. */
|
|
11
|
+
const KEYS = keysOf({
|
|
12
|
+
shape: true,
|
|
13
|
+
slot: true
|
|
14
|
+
});
|
|
15
|
+
/** A course of the table's first series over time, alone in its box. */
|
|
16
|
+
function courseChart(given, options, env) {
|
|
17
|
+
checkInput({
|
|
18
|
+
what: "course",
|
|
19
|
+
data: given
|
|
20
|
+
}, options, env, {
|
|
21
|
+
known: KEYS,
|
|
22
|
+
needs: []
|
|
23
|
+
});
|
|
24
|
+
const drawn = courseOf(given);
|
|
25
|
+
const shape = shapeOf(drawn?.series, options.shape);
|
|
26
|
+
const layout = drawn === void 0 || !anyValue(drawn) ? void 0 : layoutOf(drawn, shape, env);
|
|
27
|
+
if (drawn === void 0 || layout === void 0) return bare(env, {}, describeCourse(drawn, {
|
|
28
|
+
env,
|
|
29
|
+
merged: {}
|
|
30
|
+
}));
|
|
31
|
+
const wording = {
|
|
32
|
+
env,
|
|
33
|
+
merged: mergedWords(layout.merge, drawn.table.x, env)
|
|
34
|
+
};
|
|
35
|
+
const said = describeCourse(drawn, wording);
|
|
36
|
+
const at = {
|
|
37
|
+
layout,
|
|
38
|
+
series: drawn.series,
|
|
39
|
+
own: seriesPaint(options.slot ?? 0),
|
|
40
|
+
env
|
|
41
|
+
};
|
|
42
|
+
const painted = courseNodes(at);
|
|
43
|
+
return {
|
|
44
|
+
width: env.width,
|
|
45
|
+
height: env.height,
|
|
46
|
+
plot: layout.plot,
|
|
47
|
+
summary: said,
|
|
48
|
+
nodes: painted.nodes,
|
|
49
|
+
hover: {
|
|
50
|
+
snap: "x",
|
|
51
|
+
stops: stopsOf(drawn, at, painted, wording)
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export { courseChart };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Points } from "../data/format.mjs";
|
|
2
2
|
import { Named } from "../data/rows.mjs";
|
|
3
|
-
import { Measure, Value } from "../data/types.mjs";
|
|
4
|
-
export type DumbbellRow = Named & {
|
|
3
|
+
import { Measure, Value, ValueIn } from "../data/types.mjs";
|
|
4
|
+
export type DumbbellRow<V extends ValueIn = Value> = Named & {
|
|
5
5
|
/** Where it was, and where it is now. */
|
|
6
|
-
from:
|
|
7
|
-
to:
|
|
6
|
+
from: V;
|
|
7
|
+
to: V;
|
|
8
8
|
/** The rest of the rows, as one: it is put last and never named as having moved most. */
|
|
9
9
|
other?: boolean;
|
|
10
10
|
};
|