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
|
@@ -5,13 +5,16 @@ import { LINE, MARK, SPACE, TEXT } from "../theme.mjs";
|
|
|
5
5
|
/** The room the labels under a plot take: the gap above them, their height, and a little under. */
|
|
6
6
|
const X_ROOM = SPACE.under + LINE.tick;
|
|
7
7
|
/**
|
|
8
|
-
* How an axis's ticks read: the measure's short form,
|
|
9
|
-
* for values a few hundred apart), in
|
|
8
|
+
* How an axis's ticks read: the measure's short form, in the unit the axis steps in when it
|
|
9
|
+
* names one, unless that reads two ticks alike (1M, 1M for values a few hundred apart), in
|
|
10
|
+
* which case its full form.
|
|
10
11
|
*/
|
|
11
12
|
function tickTexts(axis, reads) {
|
|
12
13
|
if (reads === void 0) return String;
|
|
13
|
-
const
|
|
14
|
-
|
|
14
|
+
const { unit } = axis;
|
|
15
|
+
const tick = (value) => reads.tick(value, unit);
|
|
16
|
+
const short = axis.ticks.map((t) => tick(t));
|
|
17
|
+
return new Set(short).size === short.length ? tick : reads.text;
|
|
15
18
|
}
|
|
16
19
|
/** The left margin a value axis needs: its widest label and the gutter. */
|
|
17
20
|
function gutterOf(axis, reads, measure) {
|
|
@@ -44,7 +47,8 @@ function valueGrid(axis, at) {
|
|
|
44
47
|
x2: plot.x + plot.width,
|
|
45
48
|
y1: place(one.value),
|
|
46
49
|
y2: place(one.value),
|
|
47
|
-
stroke: RULE
|
|
50
|
+
stroke: RULE,
|
|
51
|
+
opacity: MARK.grid
|
|
48
52
|
}, ...written.has(one) ? [{
|
|
49
53
|
kind: "text",
|
|
50
54
|
part: "tick",
|
|
@@ -79,6 +83,8 @@ function across(place, at) {
|
|
|
79
83
|
* stand on, on an axis that leaves zero out.
|
|
80
84
|
*/
|
|
81
85
|
const zeroIn = (plot, place) => Math.min(plot.y + plot.height, Math.max(plot.y, place(0)));
|
|
86
|
+
/** Where zero sits, when it is on the axis: what a wash under a line fills down to, else none. */
|
|
87
|
+
const zeroOn = (axis, place) => axis.min > 0 || axis.max < 0 ? void 0 : place(0);
|
|
82
88
|
/** The zero line, when zero is on the axis: drawn over the marks that stand on it. */
|
|
83
89
|
function zeroLine(axis, at) {
|
|
84
90
|
if (axis.min > 0 || axis.max < 0) return [];
|
|
@@ -134,4 +140,4 @@ function readable(labels, at) {
|
|
|
134
140
|
* axis's room, is left out, and when only one would be left none is written.
|
|
135
141
|
*/
|
|
136
142
|
const writtenOf = (ticks, at) => scaled(readable(ticks.filter((one, i) => one.text !== ticks[i - 1]?.text), at));
|
|
137
|
-
export { X_ROOM, gutterOf, labelsUnder, scaled, tickTexts, tickUnder, valueGrid, writtenOf, zeroIn, zeroLine };
|
|
143
|
+
export { X_ROOM, gutterOf, labelsUnder, scaled, tickTexts, tickUnder, valueGrid, writtenOf, zeroIn, zeroLine, zeroOn };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** The most shapes a picture of a width draws. */
|
|
2
|
+
const shapesFor = (width) => 16 * Math.max(1, Number.isFinite(width) ? Math.floor(width) : 1);
|
|
3
|
+
/**
|
|
4
|
+
* How many pixels wide a thinning column (`marks/thin.ts`) must be for paths going through
|
|
5
|
+
* `points` points a place, each keeping at most `kept` places a column, at `density` places a
|
|
6
|
+
* pixel: one while they fit, else as wide as it takes.
|
|
7
|
+
*/
|
|
8
|
+
function thinningStep(points, kept, density) {
|
|
9
|
+
if (!(points * density > 32)) return 1;
|
|
10
|
+
return Math.ceil(points * kept / 32);
|
|
11
|
+
}
|
|
12
|
+
/** How wide a column of `parts` shapes filling `fill` of its stretch is drawn, to keep to the budget. */
|
|
13
|
+
const columnWidth = (parts, fill) => Math.max(1, parts * fill / 16);
|
|
14
|
+
export { columnWidth, shapesFor, thinningStep };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { dodge, roomFor } from "../layout/dodge.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { pathRound } from "../scene/markup.mjs";
|
|
3
|
+
import { fitOrNone, wholeOf } from "../text/measure.mjs";
|
|
3
4
|
import { LINE, MARK, TEXT } from "../theme.mjs";
|
|
4
5
|
import { END_REACH } from "./series-line.mjs";
|
|
5
6
|
// src/marks/end-labels.ts
|
|
@@ -78,13 +79,7 @@ function endLabels(labels, at) {
|
|
|
78
79
|
const x = edge + LEAD;
|
|
79
80
|
const valueWidth = measure(label.value, VALUE_RUN);
|
|
80
81
|
if (LEAD + valueWidth > at.room + .5) return [];
|
|
81
|
-
const
|
|
82
|
-
const runs = runsOf(label.name === void 0 ? void 0 : fitOrNone(label.name, {
|
|
83
|
-
width: nameRoom,
|
|
84
|
-
least: LEAST_NAME,
|
|
85
|
-
font: TEXT.name,
|
|
86
|
-
measure
|
|
87
|
-
}), label.value);
|
|
82
|
+
const { runs, shown, whole } = wordsIn(label, at.room - LEAD - BETWEEN - valueWidth, measure);
|
|
88
83
|
const ends = Math.min(edge, label.x ?? edge);
|
|
89
84
|
return [...leader({
|
|
90
85
|
from: ends + CLEAR.dot,
|
|
@@ -99,7 +94,8 @@ function endLabels(labels, at) {
|
|
|
99
94
|
key: label.key,
|
|
100
95
|
x,
|
|
101
96
|
y,
|
|
102
|
-
text:
|
|
97
|
+
text: shown,
|
|
98
|
+
...wholeOf(shown, whole),
|
|
103
99
|
runs,
|
|
104
100
|
...TEXT.name,
|
|
105
101
|
baseline: "middle",
|
|
@@ -108,6 +104,24 @@ function endLabels(labels, at) {
|
|
|
108
104
|
});
|
|
109
105
|
}
|
|
110
106
|
/**
|
|
107
|
+
* A label's words for the room its name has: its runs, the text they make, and the whole text,
|
|
108
|
+
* the name uncut. The name is cut to the room, and left out when that is too little to say anything.
|
|
109
|
+
*/
|
|
110
|
+
function wordsIn(label, room, measure) {
|
|
111
|
+
const runs = runsOf(label.name === void 0 ? void 0 : fitOrNone(label.name, {
|
|
112
|
+
width: room,
|
|
113
|
+
least: LEAST_NAME,
|
|
114
|
+
font: TEXT.name,
|
|
115
|
+
measure
|
|
116
|
+
}), label.value);
|
|
117
|
+
const text = (of) => of.map((run) => run.text).join("");
|
|
118
|
+
return {
|
|
119
|
+
runs,
|
|
120
|
+
shown: text(runs),
|
|
121
|
+
whole: text(runsOf(label.name, label.value))
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
111
125
|
* A thin line from where the series ends to its label, when the label is off it: moved up or
|
|
112
126
|
* down to clear another, or `apart` from marks that end short of the plot's edge.
|
|
113
127
|
*/
|
|
@@ -116,7 +130,7 @@ function leader(at) {
|
|
|
116
130
|
return [{
|
|
117
131
|
kind: "path",
|
|
118
132
|
part: "leader",
|
|
119
|
-
d: `M${
|
|
133
|
+
d: `M${pathRound(at.from)},${pathRound(at.y)}L${pathRound(at.to)},${pathRound(at.moved)}`,
|
|
120
134
|
stroke: at.color,
|
|
121
135
|
opacity: MARK.faint
|
|
122
136
|
}];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { SURFACE } from "../scene/paint.mjs";
|
|
1
2
|
import { headerHeight } from "../layout/frame.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { LINE, MARK, TEXT } from "../theme.mjs";
|
|
3
|
+
import { fitted } from "../text/measure.mjs";
|
|
4
|
+
import { LINE, MARK, TEXT, repeatsOf } from "../theme.mjs";
|
|
4
5
|
import { dot, dotReach } from "./dot.mjs";
|
|
5
6
|
import { moreLine } from "./more.mjs";
|
|
6
7
|
// src/marks/legend.ts
|
|
@@ -26,7 +27,8 @@ const UNDER = 8;
|
|
|
26
27
|
/** The width an entry's swatch and the room after it take, before its name. */
|
|
27
28
|
const SWATCH_ROOM = 14;
|
|
28
29
|
/** An entry's swatch, its left edge at `x`, its middle at `mid`. */
|
|
29
|
-
function swatch(item, x, mid) {
|
|
30
|
+
function swatch(item, x, mid, repeats) {
|
|
31
|
+
const cue = repeats ? { dash: MARK.repeat } : {};
|
|
30
32
|
if (item.shape === "line") return {
|
|
31
33
|
kind: "line",
|
|
32
34
|
part: "legend",
|
|
@@ -36,7 +38,8 @@ function swatch(item, x, mid) {
|
|
|
36
38
|
y1: mid,
|
|
37
39
|
y2: mid,
|
|
38
40
|
stroke: item.color,
|
|
39
|
-
strokeWidth: MARK.line
|
|
41
|
+
strokeWidth: MARK.line,
|
|
42
|
+
...cue
|
|
40
43
|
};
|
|
41
44
|
if (item.shape === "dot" || item.shape === "ring") {
|
|
42
45
|
const hollow = item.shape === "ring";
|
|
@@ -59,7 +62,13 @@ function swatch(item, x, mid) {
|
|
|
59
62
|
width: SWATCH,
|
|
60
63
|
height: SWATCH,
|
|
61
64
|
radius: CORNER,
|
|
62
|
-
fill: item.color
|
|
65
|
+
fill: item.color,
|
|
66
|
+
...repeats ? {
|
|
67
|
+
fill: SURFACE,
|
|
68
|
+
stroke: item.color,
|
|
69
|
+
strokeWidth: MARK.hair,
|
|
70
|
+
...cue
|
|
71
|
+
} : {}
|
|
63
72
|
};
|
|
64
73
|
}
|
|
65
74
|
/** Where a legend stands in every kind: under the header, across the whole picture. */
|
|
@@ -72,10 +81,11 @@ const underHeader = (header, env) => ({
|
|
|
72
81
|
function legend(items, at) {
|
|
73
82
|
let left = 0;
|
|
74
83
|
let row = 0;
|
|
84
|
+
const repeats = repeatsOf(items.map((item) => item.color));
|
|
75
85
|
return {
|
|
76
|
-
nodes: items.flatMap((item) => {
|
|
86
|
+
nodes: items.flatMap((item, i) => {
|
|
77
87
|
const room = Math.min(NAME_MOST, at.width - SWATCH_ROOM);
|
|
78
|
-
const label =
|
|
88
|
+
const { text: label, full } = fitted(item.label, room, TEXT.name, at.measure);
|
|
79
89
|
const width = SWATCH_ROOM + at.measure(label, TEXT.name);
|
|
80
90
|
if (left > 0 && left + width > at.width) {
|
|
81
91
|
left = 0;
|
|
@@ -84,12 +94,13 @@ function legend(items, at) {
|
|
|
84
94
|
const x = at.x + left;
|
|
85
95
|
const mid = at.y + row * LEGEND_LINE + LEGEND_LINE / 2;
|
|
86
96
|
left += width + BETWEEN;
|
|
87
|
-
return [swatch(item, x, mid), {
|
|
97
|
+
return [swatch(item, x, mid, repeats[i] === true), {
|
|
88
98
|
kind: "text",
|
|
89
99
|
part: "legend",
|
|
90
100
|
x: x + SWATCH_ROOM,
|
|
91
101
|
y: mid,
|
|
92
102
|
text: label,
|
|
103
|
+
...full === void 0 ? {} : { full },
|
|
93
104
|
...TEXT.name,
|
|
94
105
|
baseline: "middle"
|
|
95
106
|
}];
|
|
@@ -12,15 +12,15 @@ function broken(points, buckets) {
|
|
|
12
12
|
}
|
|
13
13
|
/** The path through the points. */
|
|
14
14
|
function linePath(points, curve) {
|
|
15
|
-
return line().defined((p) => p !== void 0).x((p) => p?.x ?? 0).y((p) => p?.y ?? 0).curve(CURVES[curve])([...points]) ?? "";
|
|
15
|
+
return line().defined((p) => p !== void 0).x((p) => p?.x ?? 0).y((p) => p?.y ?? 0).curve(CURVES[curve]).digits(1)([...points]) ?? "";
|
|
16
16
|
}
|
|
17
17
|
/** The shape between the points and a level `base`. */
|
|
18
18
|
function areaPath(points, base, curve) {
|
|
19
|
-
return area().defined((p) => p !== void 0).x((p) => p?.x ?? 0).y1((p) => p?.y ?? 0).y0(base).curve(CURVES[curve])([...points]) ?? "";
|
|
19
|
+
return area().defined((p) => p !== void 0).x((p) => p?.x ?? 0).y1((p) => p?.y ?? 0).y0(base).curve(CURVES[curve]).digits(1)([...points]) ?? "";
|
|
20
20
|
}
|
|
21
21
|
/** The shape between two runs of points, place for place: one band of a stack. */
|
|
22
22
|
function bandPath(top, bottom, curve) {
|
|
23
|
-
return area().defined((i) => top[i] !== void 0 && bottom[i] !== void 0).x((i) => top[i]?.x ?? 0).y1((i) => top[i]?.y ?? 0).y0((i) => bottom[i]?.y ?? 0).curve(CURVES[curve])(top.map((_p, i) => i)) ?? "";
|
|
23
|
+
return area().defined((i) => top[i] !== void 0 && bottom[i] !== void 0).x((i) => top[i]?.x ?? 0).y1((i) => top[i]?.y ?? 0).y0((i) => bottom[i]?.y ?? 0).curve(CURVES[curve]).digits(1)(top.map((_p, i) => i)) ?? "";
|
|
24
24
|
}
|
|
25
25
|
/** The points that stand alone, with no value either side: a path draws nothing for them, so a dot does. */
|
|
26
26
|
function alone(points) {
|
|
@@ -1,18 +1,84 @@
|
|
|
1
|
+
import { keyOf } from "../data/rows.mjs";
|
|
1
2
|
import { wordsOf } from "../data/words.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { TEXT } from "../theme.mjs";
|
|
3
|
+
import { fitted } from "../text/measure.mjs";
|
|
4
|
+
import { LINE, TEXT } from "../theme.mjs";
|
|
4
5
|
// src/marks/more.ts
|
|
6
|
+
/**
|
|
7
|
+
* The room under a plot for the line that names or counts what was left out: its line, and a
|
|
8
|
+
* gap of its own that keeps it apart from the time under the plot.
|
|
9
|
+
*/
|
|
10
|
+
const MORE_ROOM = LINE.tick + 6;
|
|
11
|
+
/** One line of grey words, its middle at `y`, cut to the width. */
|
|
12
|
+
const line = (text, at) => ({
|
|
13
|
+
kind: "text",
|
|
14
|
+
part: "more",
|
|
15
|
+
x: at.x ?? 0,
|
|
16
|
+
y: at.y,
|
|
17
|
+
...fitted(text, at.width, TEXT.tick, at.env.measure),
|
|
18
|
+
...TEXT.tick,
|
|
19
|
+
baseline: "middle"
|
|
20
|
+
});
|
|
5
21
|
/** The line that says how many things there was no room for, its middle at `y`; nothing for none. */
|
|
6
22
|
function moreLine(left, at) {
|
|
7
|
-
|
|
8
|
-
return [{
|
|
9
|
-
kind: "text",
|
|
10
|
-
part: "more",
|
|
11
|
-
x: at.x ?? 0,
|
|
12
|
-
y: at.y,
|
|
13
|
-
text: fitText(wordsOf(at.env).more(left), at.width, TEXT.tick, at.env.measure),
|
|
14
|
-
...TEXT.tick,
|
|
15
|
-
baseline: "middle"
|
|
16
|
-
}];
|
|
23
|
+
return left <= 0 ? [] : [line(wordsOf(at.env).more(left), at)];
|
|
17
24
|
}
|
|
18
|
-
|
|
25
|
+
/** What some given things leave out when only some are drawn: each one not drawn, by key and name, in the given order. */
|
|
26
|
+
function leftOut(all, drawn) {
|
|
27
|
+
const kept = new Set(drawn);
|
|
28
|
+
return all.flatMap((thing) => kept.has(thing) ? [] : [{
|
|
29
|
+
key: keyOf(thing),
|
|
30
|
+
label: thing.label
|
|
31
|
+
}]);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The words that name what was left out in a width: as many by name as fit there, the rest
|
|
35
|
+
* counted; the first alone, cut, when even that does not fit. That is the most names whose
|
|
36
|
+
* line fits, found by doubling from one name and then halving, rather than by trying every
|
|
37
|
+
* count: a chart of thousands of rows measures a few dozen short lines, not thousands of long
|
|
38
|
+
* ones.
|
|
39
|
+
*
|
|
40
|
+
* The search assumes a line grows as it names more, and it nearly does. Naming them all drops
|
|
41
|
+
* the count, so that line is tried first on its own. And naming one more can make a line
|
|
42
|
+
* narrower by one step: an empty name adds only ", ", narrower than the digit the count loses
|
|
43
|
+
* going from ten to nine. The step after it adds a whole ", " again, so a count that does not
|
|
44
|
+
* fit rules out every count two or more past it; the two counts past the one the search
|
|
45
|
+
* settles on are tried too, and the answer is the one counting down from every name would
|
|
46
|
+
* give. A law holds it to that for the built-in words, and for a host's own (`notShown`) of
|
|
47
|
+
* the same shape: names parted by more than a digit is wide, then the count, written the same
|
|
48
|
+
* way whatever its number. Words that part names by nothing, or whose count changes its form
|
|
49
|
+
* with its number (", another" for one, ", 14 more not included" for more), can get narrower
|
|
50
|
+
* as they name more: there the line may name fewer than counting down would, and still fits.
|
|
51
|
+
*/
|
|
52
|
+
function leftText(left, at) {
|
|
53
|
+
const labels = left.map((thing) => thing.label);
|
|
54
|
+
const notShown = wordsOf(at.env).notShown;
|
|
55
|
+
const said = (named) => notShown(labels.slice(0, named), labels.length - named);
|
|
56
|
+
const fits = (named) => at.env.measure(said(named), TEXT.tick) <= at.width;
|
|
57
|
+
const all = labels.length;
|
|
58
|
+
if (all <= 1 || fits(all)) return said(all);
|
|
59
|
+
return said(mostThatFit(fits, all - 1));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The most of `most` names that `fits` allows, at least one. It doubles from one name until a
|
|
63
|
+
* count does not fit, so the lines measured are about as long as the answer however many names
|
|
64
|
+
* there are; halves between the last that fit and the one that did not; then tries the two
|
|
65
|
+
* counts past where it settles.
|
|
66
|
+
*/
|
|
67
|
+
function mostThatFit(fits, most) {
|
|
68
|
+
let low = 1;
|
|
69
|
+
while (low * 2 <= most && fits(low * 2)) low *= 2;
|
|
70
|
+
let high = Math.min(most, low * 2 - 1);
|
|
71
|
+
while (low < high) {
|
|
72
|
+
const middle = Math.ceil((low + high) / 2);
|
|
73
|
+
if (fits(middle)) low = middle;
|
|
74
|
+
else high = middle - 1;
|
|
75
|
+
}
|
|
76
|
+
return [low + 2, low + 1].filter((named) => named <= most).find((named) => fits(named)) ?? low;
|
|
77
|
+
}
|
|
78
|
+
/** The line that names what was left out, its middle at `y`; nothing when everything is drawn. */
|
|
79
|
+
function leftLine(left, at) {
|
|
80
|
+
return left.length === 0 ? [] : [line(leftText(left, at), at)];
|
|
81
|
+
}
|
|
82
|
+
/** A scene's list of what it left out: none when it drew everything. */
|
|
83
|
+
const leftOf = (left) => left.length === 0 ? {} : { left };
|
|
84
|
+
export { MORE_ROOM, leftLine, leftOf, leftOut, moreLine };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MUTED } from "../scene/paint.mjs";
|
|
2
2
|
import { firstFree } from "../layout/boxes.mjs";
|
|
3
|
-
import { fitOrNone, fitText } from "../text/measure.mjs";
|
|
3
|
+
import { fitOrNone, fitText, wholeOf } from "../text/measure.mjs";
|
|
4
4
|
import { LINE, MARK, TEXT } from "../theme.mjs";
|
|
5
5
|
// src/marks/notes.ts
|
|
6
6
|
/**
|
|
@@ -74,12 +74,14 @@ function wordsFor({ name, value }, width, { measure }) {
|
|
|
74
74
|
});
|
|
75
75
|
return kept === void 0 ? value : `${kept}${after}`;
|
|
76
76
|
}
|
|
77
|
-
/** A line's words cut to a width,
|
|
77
|
+
/** A line's words cut to a width, how wide they then are, and their whole when they were cut. */
|
|
78
78
|
function cut(words, width, room) {
|
|
79
79
|
const text = wordsFor(words, width, room);
|
|
80
|
+
const whole = words.value === void 0 ? words.name : `${words.name} ${words.value}`;
|
|
80
81
|
return {
|
|
81
82
|
text,
|
|
82
|
-
width: room.measure(text, TEXT.tick)
|
|
83
|
+
width: room.measure(text, TEXT.tick),
|
|
84
|
+
whole: text === "" ? {} : wholeOf(text, whole)
|
|
83
85
|
};
|
|
84
86
|
}
|
|
85
87
|
/** The places a name may take: none when there is nothing to write, so its line stands unnamed. */
|
|
@@ -103,7 +105,7 @@ function levelNotes(references, at, room) {
|
|
|
103
105
|
return references.flatMap((reference) => {
|
|
104
106
|
const y = at.place(reference.value);
|
|
105
107
|
if (!within(y, plot.y, plot.height)) return [];
|
|
106
|
-
const { text, width } = cut({
|
|
108
|
+
const { text, width, whole } = cut({
|
|
107
109
|
name: reference.label,
|
|
108
110
|
value: at.text(reference.value)
|
|
109
111
|
}, plot.width - 8, room);
|
|
@@ -135,6 +137,7 @@ function levelNotes(references, at, room) {
|
|
|
135
137
|
upright: false,
|
|
136
138
|
at: y,
|
|
137
139
|
text,
|
|
140
|
+
...whole,
|
|
138
141
|
spots
|
|
139
142
|
}];
|
|
140
143
|
});
|
|
@@ -146,7 +149,7 @@ function upright(mark, room) {
|
|
|
146
149
|
const bounds = boundsOf(room);
|
|
147
150
|
const rightward = mark.x <= bounds.x + bounds.width / 2;
|
|
148
151
|
const space = rightward ? bounds.x + bounds.width - mark.x - OFF : mark.x - OFF - bounds.x;
|
|
149
|
-
const { text, width } = cut(mark.words, space, room);
|
|
152
|
+
const { text, width, whole } = cut(mark.words, space, room);
|
|
150
153
|
const top = room.lane === void 0 ? plot.y + OFF / 2 : plot.y - room.lane;
|
|
151
154
|
const after = (line) => spot(mark.x + OFF, top + line * NOTE_LINE, {
|
|
152
155
|
width,
|
|
@@ -158,13 +161,15 @@ function upright(mark, room) {
|
|
|
158
161
|
});
|
|
159
162
|
const spots = Array.from({ length: LINES }, (_v, line) => rightward ? [after(line), before(line)] : [before(line), after(line)]).flat();
|
|
160
163
|
const dash = mark.part === "event" ? MARK.moment : MARK.dash;
|
|
164
|
+
const named = spotsFor(text, spots);
|
|
161
165
|
return [{
|
|
162
166
|
part: mark.part,
|
|
163
167
|
dash,
|
|
164
168
|
upright: true,
|
|
165
169
|
at: mark.x,
|
|
166
170
|
text,
|
|
167
|
-
|
|
171
|
+
...whole,
|
|
172
|
+
spots: named
|
|
168
173
|
}];
|
|
169
174
|
}
|
|
170
175
|
/** A dashed upright line for each reference value on an axis along the bottom. */
|
|
@@ -238,6 +243,7 @@ function marked(notes, room) {
|
|
|
238
243
|
x: found.x,
|
|
239
244
|
y: found.box.y + TEXT.tick.size / 2,
|
|
240
245
|
text: note.text,
|
|
246
|
+
...note.full === void 0 ? {} : { full: note.full },
|
|
241
247
|
...TEXT.tick,
|
|
242
248
|
anchor: found.anchor,
|
|
243
249
|
baseline: "middle",
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { follows
|
|
1
|
+
import { follows } from "../data/buckets.mjs";
|
|
2
2
|
import { MARK } from "../theme.mjs";
|
|
3
3
|
import { dot, widestReach } from "./dot.mjs";
|
|
4
4
|
import { alone, areaPath, broken, lastOf, linePath } from "./lines.mjs";
|
|
5
5
|
import { thinned } from "./thin.mjs";
|
|
6
|
+
import { isRunning, isStarting } from "derive-dashboards/core";
|
|
6
7
|
// src/marks/series-line.ts
|
|
8
|
+
/** How many points a series' line goes through at each place: its line, its wash's two edges, and its comparison period's line. */
|
|
9
|
+
const linePoints = (series, washed) => 1 + (washed ? 2 : 0) + (series.previous === void 0 ? 0 : 1);
|
|
7
10
|
/** The radius of the dot at a line's end. */
|
|
8
11
|
const END = 3.5;
|
|
9
12
|
/** How far the dot at a line's end reaches past the line's last point, filled or hollow. */
|
|
@@ -21,14 +24,15 @@ function pointsOf(values, at) {
|
|
|
21
24
|
});
|
|
22
25
|
}
|
|
23
26
|
/** The line in its parts: what is final, and the dotted steps at an end that is not whole. */
|
|
24
|
-
function parted(points,
|
|
27
|
+
function parted(points, at) {
|
|
28
|
+
const { buckets } = at;
|
|
25
29
|
const first = points.findIndex((p) => p !== void 0);
|
|
26
30
|
const last = points.findLastIndex((p) => p !== void 0);
|
|
27
|
-
const open = last !== -1 &&
|
|
28
|
-
const stepsIn = first !== -1 && first !== last &&
|
|
31
|
+
const open = last !== -1 && isRunning(buckets[last]);
|
|
32
|
+
const stepsIn = first !== -1 && first !== last && isStarting(buckets[first]) && follows(buckets, first + 1) && points[first + 1] !== void 0;
|
|
29
33
|
const whole = points.map((p, i) => open && i === last || stepsIn && i === first ? void 0 : p);
|
|
30
34
|
return {
|
|
31
|
-
settled: thinned(broken(whole, buckets)),
|
|
35
|
+
settled: thinned(broken(whole, buckets), at.step),
|
|
32
36
|
open,
|
|
33
37
|
head: stepsIn ? [points[first], points[first + 1]] : [],
|
|
34
38
|
tail: open && follows(buckets, last) ? [points[last - 1], points[last]] : []
|
|
@@ -37,7 +41,7 @@ function parted(points, buckets) {
|
|
|
37
41
|
/** The marks of one series' line. */
|
|
38
42
|
function seriesLine(series, at, look) {
|
|
39
43
|
const points = pointsOf(series.values, at);
|
|
40
|
-
const parts = parted(points, at
|
|
44
|
+
const parts = parted(points, at);
|
|
41
45
|
const quiet = look.quiet === true;
|
|
42
46
|
const path = (d, dash) => d === "" ? [] : [{
|
|
43
47
|
kind: "path",
|
|
@@ -48,9 +52,9 @@ function seriesLine(series, at, look) {
|
|
|
48
52
|
...dash === void 0 ? {} : { dash }
|
|
49
53
|
}];
|
|
50
54
|
return [
|
|
51
|
-
...wash(thinned(broken(points, at.buckets)), look),
|
|
55
|
+
...wash(thinned(broken(points, at.buckets), at.step), look),
|
|
52
56
|
...ghost(series, at, look),
|
|
53
|
-
...path(linePath(parts.settled, look.curve)),
|
|
57
|
+
...path(linePath(parts.settled, look.curve), look.dash),
|
|
54
58
|
...path(linePath(parts.head, "straight"), MARK.step),
|
|
55
59
|
...path(linePath(parts.tail, "straight"), MARK.step),
|
|
56
60
|
...dots(quiet ? [] : alone(parts.settled), look.color),
|
|
@@ -77,7 +81,7 @@ function wash(points, look) {
|
|
|
77
81
|
/** The comparison period, place for place, behind the line. */
|
|
78
82
|
function ghost(series, at, look) {
|
|
79
83
|
if (series.previous === void 0) return [];
|
|
80
|
-
const before = thinned(broken(pointsOf(series.previous, at), at.buckets));
|
|
84
|
+
const before = thinned(broken(pointsOf(series.previous, at), at.buckets), at.step);
|
|
81
85
|
const d = linePath(before, look.curve);
|
|
82
86
|
return d === "" ? [] : [{
|
|
83
87
|
kind: "path",
|
|
@@ -107,4 +111,4 @@ function endDot(at, look) {
|
|
|
107
111
|
part: "end"
|
|
108
112
|
})];
|
|
109
113
|
}
|
|
110
|
-
export { END_REACH, pointsOf, seriesLine };
|
|
114
|
+
export { END_REACH, linePoints, pointsOf, seriesLine };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/marks/thin.ts
|
|
2
|
-
/** The
|
|
3
|
-
const columnOf = (item, read) => Math.floor(read.x(item));
|
|
2
|
+
/** The thinning column a thing stands in. */
|
|
3
|
+
const columnOf = (item, read) => Math.floor(read.x(item) / (read.step ?? 1));
|
|
4
4
|
/** The runs of things between breaks, in order. */
|
|
5
5
|
function runsIn(items) {
|
|
6
6
|
const runs = [];
|
|
@@ -99,40 +99,23 @@ function shown(runs, read) {
|
|
|
99
99
|
}
|
|
100
100
|
return [...out, ...reaching(inside, read)];
|
|
101
101
|
}
|
|
102
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* Things in their order across, a break (nothing) between two runs, thinned to what the pixels
|
|
104
|
+
* can show. The one thinning every path goes through: points, a band's paired edges, or places
|
|
105
|
+
* read straight from a stack before any point is made of them.
|
|
106
|
+
*/
|
|
103
107
|
function thin(items, read) {
|
|
104
108
|
return shown(runsIn(items).map((run) => thinnedRun(run, read)), read).flatMap((run, i) => i === 0 ? run : [void 0, ...run]);
|
|
105
109
|
}
|
|
106
|
-
const POINT = {
|
|
107
|
-
x: (point) => point.x,
|
|
108
|
-
ys: [(point) => point.y]
|
|
109
|
-
};
|
|
110
110
|
/**
|
|
111
111
|
* The points a path is drawn through, for points in their order across with a break (nothing)
|
|
112
|
-
* wherever a line stops: in each
|
|
113
|
-
* and last points. A line with no more than two points to a
|
|
112
|
+
* wherever a line stops: in each thinning column (a pixel wide, or `step`) each unbroken piece
|
|
113
|
+
* keeps its first, least, most and last points. A line with no more than two points to a column
|
|
114
|
+
* comes back whole.
|
|
114
115
|
*/
|
|
115
|
-
const thinned = (points) => thin(points,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
* A band's two edges, place for place, thinned together so they still pair: in each pixel
|
|
122
|
-
* column each unbroken piece keeps its first and last places and the least and the most of
|
|
123
|
-
* each edge. A place where either edge is missing is a break.
|
|
124
|
-
*/
|
|
125
|
-
function thinnedBand(top, bottom) {
|
|
126
|
-
const kept = thin(top.map((upper, i) => {
|
|
127
|
-
const lower = bottom[i];
|
|
128
|
-
return upper === void 0 || lower === void 0 ? void 0 : {
|
|
129
|
-
top: upper,
|
|
130
|
-
bottom: lower
|
|
131
|
-
};
|
|
132
|
-
}), EDGES);
|
|
133
|
-
return {
|
|
134
|
-
top: kept.map((place) => place?.top),
|
|
135
|
-
bottom: kept.map((place) => place?.bottom)
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
export { thinned, thinnedBand };
|
|
116
|
+
const thinned = (points, step = 1) => thin(points, {
|
|
117
|
+
x: (point) => point.x,
|
|
118
|
+
ys: [(point) => point.y],
|
|
119
|
+
step
|
|
120
|
+
});
|
|
121
|
+
export { thin, thinned };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RULE } from "../scene/paint.mjs";
|
|
2
|
-
import { TEXT } from "../theme.mjs";
|
|
2
|
+
import { MARK, TEXT } from "../theme.mjs";
|
|
3
3
|
import { tickTexts, tickUnder, writtenOf } from "./axes.mjs";
|
|
4
4
|
// src/marks/x-axis.ts
|
|
5
5
|
/** The ticks whose numbers are written, left to right, by the rule of every value axis (`writtenOf`). */
|
|
@@ -26,7 +26,8 @@ function xGrid(axis, at) {
|
|
|
26
26
|
x2: place(value),
|
|
27
27
|
y1: plot.y,
|
|
28
28
|
y2: plot.y + plot.height,
|
|
29
|
-
stroke: RULE
|
|
29
|
+
stroke: RULE,
|
|
30
|
+
opacity: MARK.grid
|
|
30
31
|
})), ...writtenTicks(axis, at).map((tick) => tickUnder(tick, plot))];
|
|
31
32
|
}
|
|
32
33
|
export { xGrid };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { said } from "../data/format.mjs";
|
|
2
2
|
// src/scale/calendar.ts
|
|
3
3
|
const DATE = /^(\d{4})-(\d{2})-(\d{2})$/u;
|
|
4
|
+
const DAY = 864e5;
|
|
4
5
|
/** The calendar parts of each bucket, in the buckets' order. */
|
|
5
6
|
function partsOf(x) {
|
|
6
7
|
let zoned;
|
|
@@ -75,14 +76,13 @@ function asDate(p) {
|
|
|
75
76
|
function dateWriter(locale) {
|
|
76
77
|
const made = /* @__PURE__ */ new Map();
|
|
77
78
|
const formatOf = (options) => {
|
|
78
|
-
const
|
|
79
|
-
const kept = made.get(key);
|
|
79
|
+
const kept = made.get(options);
|
|
80
80
|
if (kept !== void 0) return kept;
|
|
81
81
|
const format = new Intl.DateTimeFormat(locale, {
|
|
82
82
|
...options,
|
|
83
83
|
timeZone: "UTC"
|
|
84
84
|
});
|
|
85
|
-
made.set(
|
|
85
|
+
made.set(options, format);
|
|
86
86
|
return format;
|
|
87
87
|
};
|
|
88
88
|
return {
|
|
@@ -90,6 +90,26 @@ function dateWriter(locale) {
|
|
|
90
90
|
range: (from, to, options) => formatOf(options).formatRange(asDate(from), to)
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
+
/** The forms a date is written in: each one object, which a writer keeps its formatter by. */
|
|
94
|
+
const FORMS = {
|
|
95
|
+
year: { year: "numeric" },
|
|
96
|
+
month: { month: "short" },
|
|
97
|
+
monthYear: {
|
|
98
|
+
month: "short",
|
|
99
|
+
year: "numeric"
|
|
100
|
+
},
|
|
101
|
+
day: { day: "numeric" },
|
|
102
|
+
monthDay: {
|
|
103
|
+
month: "short",
|
|
104
|
+
day: "numeric"
|
|
105
|
+
},
|
|
106
|
+
hour: { hour: "numeric" },
|
|
107
|
+
week: {
|
|
108
|
+
month: "short",
|
|
109
|
+
day: "numeric",
|
|
110
|
+
year: "numeric"
|
|
111
|
+
}
|
|
112
|
+
};
|
|
93
113
|
/**
|
|
94
114
|
* A tick's label, as short as its neighbours allow: a day reads "4" after "Nov 3", a month
|
|
95
115
|
* "Feb" after "Jan 2026". `before` is the tick before it, when there is one.
|
|
@@ -98,21 +118,11 @@ function tickText(kind, at, write) {
|
|
|
98
118
|
const { parts, before } = at;
|
|
99
119
|
const newYear = before === void 0 || before.year !== parts.year;
|
|
100
120
|
const newMonth = newYear || before.month !== parts.month;
|
|
101
|
-
if (kind === "year") return write.text(parts,
|
|
102
|
-
if (kind === "month") return write.text(parts, newYear ?
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
} : { month: "short" });
|
|
106
|
-
if (kind === "day") return write.text(parts, newMonth ? {
|
|
107
|
-
month: "short",
|
|
108
|
-
day: "numeric"
|
|
109
|
-
} : { day: "numeric" });
|
|
110
|
-
return parts.hour === 0 ? write.text(parts, {
|
|
111
|
-
month: "short",
|
|
112
|
-
day: "numeric"
|
|
113
|
-
}) : write.text(parts, { hour: "numeric" });
|
|
121
|
+
if (kind === "year") return write.text(parts, FORMS.year);
|
|
122
|
+
if (kind === "month") return write.text(parts, newYear ? FORMS.monthYear : FORMS.month);
|
|
123
|
+
if (kind === "day") return write.text(parts, newMonth ? FORMS.monthDay : FORMS.day);
|
|
124
|
+
return write.text(parts, parts.hour === 0 ? FORMS.monthDay : FORMS.hour);
|
|
114
125
|
}
|
|
115
|
-
const DAY = 864e5;
|
|
116
126
|
const TITLES = {
|
|
117
127
|
hour: {
|
|
118
128
|
month: "short",
|
|
@@ -143,22 +153,27 @@ function bucketTitle(bucket, at, write) {
|
|
|
143
153
|
month: parts.month + 2,
|
|
144
154
|
day: 1
|
|
145
155
|
});
|
|
146
|
-
const options = grain === "week" ?
|
|
147
|
-
month: "short",
|
|
148
|
-
day: "numeric",
|
|
149
|
-
year: "numeric"
|
|
150
|
-
} : {
|
|
151
|
-
month: "short",
|
|
152
|
-
year: "numeric"
|
|
153
|
-
};
|
|
156
|
+
const options = grain === "week" ? FORMS.week : FORMS.monthYear;
|
|
154
157
|
return bucket.to > bucket.from ? write.range(parts, end, options) : write.text(parts, options);
|
|
155
158
|
}
|
|
159
|
+
/** Each axis's buckets' names, by locale: written once, however often the chart is drawn again (a resize). */
|
|
160
|
+
const TITLED = /* @__PURE__ */ new WeakMap();
|
|
156
161
|
/**
|
|
157
162
|
* Every bucket's whole name, for a tooltip and a summary: the host's own for it when it gave
|
|
158
163
|
* one, else the calendar's, read from the bucket's label when that is a date and from its first
|
|
159
|
-
* instant when it is not.
|
|
164
|
+
* instant when it is not. Written once an axis and a locale: an axis is read as it was given.
|
|
160
165
|
*/
|
|
161
166
|
function bucketTitles(x, locale) {
|
|
167
|
+
const known = TITLED.get(x) ?? /* @__PURE__ */ new Map();
|
|
168
|
+
TITLED.set(x, known);
|
|
169
|
+
const kept = known.get(locale ?? "");
|
|
170
|
+
if (kept !== void 0) return kept;
|
|
171
|
+
const titles = titlesOf(x, locale);
|
|
172
|
+
known.set(locale ?? "", titles);
|
|
173
|
+
return titles;
|
|
174
|
+
}
|
|
175
|
+
/** Every bucket's whole name, written. */
|
|
176
|
+
function titlesOf(x, locale) {
|
|
162
177
|
const parts = partsOf(x);
|
|
163
178
|
const write = dateWriter(locale);
|
|
164
179
|
return x.buckets.map((bucket, i) => {
|