derive-dashboards 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +513 -0
- package/README.md +8 -2
- package/dist/adapter/statement.mjs +9 -7
- package/dist/authorize.mjs +27 -6
- package/dist/body.mjs +28 -25
- package/dist/cache.d.mts +2 -2
- package/dist/charts/data/buckets.d.mts +25 -7
- package/dist/charts/data/buckets.mjs +92 -15
- package/dist/charts/data/clean.mjs +254 -12
- package/dist/charts/data/format.d.mts +7 -2
- package/dist/charts/data/format.mjs +68 -70
- package/dist/charts/data/input-error.d.mts +2 -0
- package/dist/charts/data/input-error.mjs +2 -0
- package/dist/charts/data/rows.d.mts +3 -1
- package/dist/charts/data/rows.mjs +4 -2
- package/dist/charts/data/types.d.mts +50 -7
- package/dist/charts/data/words.d.mts +13 -0
- package/dist/charts/data/words.mjs +8 -1
- package/dist/charts/describe.mjs +6 -6
- package/dist/charts/index.d.mts +14 -14
- package/dist/charts/index.mjs +4 -1
- package/dist/charts/kinds/area-marks.mjs +67 -26
- package/dist/charts/kinds/area.d.mts +3 -3
- package/dist/charts/kinds/area.mjs +32 -11
- package/dist/charts/kinds/bars-data.d.mts +3 -3
- package/dist/charts/kinds/bars-data.mjs +12 -6
- package/dist/charts/kinds/bars-layout.mjs +60 -6
- package/dist/charts/kinds/bars-marks.mjs +6 -6
- package/dist/charts/kinds/bars.d.mts +5 -3
- package/dist/charts/kinds/bars.mjs +39 -6
- package/dist/charts/kinds/columns-data.mjs +14 -5
- package/dist/charts/kinds/columns-marks.mjs +52 -23
- package/dist/charts/kinds/columns.d.mts +2 -2
- package/dist/charts/kinds/columns.mjs +36 -10
- package/dist/charts/kinds/course-data.mjs +44 -0
- package/dist/charts/kinds/course-layout.mjs +77 -0
- package/dist/charts/kinds/course-marks.mjs +52 -0
- package/dist/charts/kinds/course-words.mjs +64 -0
- package/dist/charts/kinds/course.d.mts +10 -0
- package/dist/charts/kinds/course.mjs +55 -0
- package/dist/charts/kinds/dumbbell-data.d.mts +4 -4
- package/dist/charts/kinds/dumbbell-data.mjs +3 -3
- package/dist/charts/kinds/dumbbell-layout.mjs +17 -8
- package/dist/charts/kinds/dumbbell.d.mts +5 -3
- package/dist/charts/kinds/dumbbell.mjs +35 -4
- package/dist/charts/kinds/funnel-data.d.mts +3 -3
- package/dist/charts/kinds/funnel-data.mjs +11 -16
- package/dist/charts/kinds/funnel-layout.mjs +7 -6
- package/dist/charts/kinds/funnel.d.mts +5 -4
- package/dist/charts/kinds/funnel.mjs +33 -6
- package/dist/charts/kinds/grid-data.d.mts +3 -3
- package/dist/charts/kinds/grid-data.mjs +55 -13
- package/dist/charts/kinds/grid-layout.mjs +88 -13
- package/dist/charts/kinds/grid-legend.mjs +60 -0
- package/dist/charts/kinds/grid-marks.mjs +81 -30
- package/dist/charts/kinds/grid-time.mjs +19 -5
- package/dist/charts/kinds/grid-words.mjs +57 -35
- package/dist/charts/kinds/grid.d.mts +7 -4
- package/dist/charts/kinds/grid.mjs +49 -8
- package/dist/charts/kinds/histogram-data.mjs +68 -26
- package/dist/charts/kinds/histogram-layout.mjs +4 -3
- package/dist/charts/kinds/histogram-words.mjs +2 -3
- package/dist/charts/kinds/histogram.d.mts +2 -2
- package/dist/charts/kinds/histogram.mjs +17 -1
- package/dist/charts/kinds/line-marks.mjs +19 -11
- package/dist/charts/kinds/line.d.mts +2 -2
- package/dist/charts/kinds/line.mjs +21 -3
- package/dist/charts/kinds/multiples-grid.mjs +57 -27
- package/dist/charts/kinds/multiples-head.mjs +52 -22
- package/dist/charts/kinds/multiples-layout.mjs +106 -52
- package/dist/charts/kinds/multiples-marks.mjs +6 -5
- package/dist/charts/kinds/multiples-words.mjs +53 -38
- package/dist/charts/kinds/multiples.d.mts +2 -2
- package/dist/charts/kinds/multiples.mjs +35 -7
- package/dist/charts/kinds/row-chart.d.mts +7 -0
- package/dist/charts/kinds/row-chart.mjs +47 -10
- package/dist/charts/kinds/row-marks.mjs +5 -5
- package/dist/charts/kinds/scatter-data.d.mts +5 -5
- package/dist/charts/kinds/scatter-data.mjs +6 -6
- package/dist/charts/kinds/scatter-marks.mjs +46 -19
- package/dist/charts/kinds/scatter-words.mjs +8 -8
- package/dist/charts/kinds/scatter.d.mts +5 -3
- package/dist/charts/kinds/scatter.mjs +18 -0
- package/dist/charts/kinds/stat-data.mjs +7 -7
- package/dist/charts/kinds/stat-marks.mjs +2 -2
- package/dist/charts/kinds/stat.d.mts +4 -4
- package/dist/charts/kinds/stat.mjs +19 -0
- package/dist/charts/kinds/time-chart.mjs +13 -4
- package/dist/charts/kinds/time-frame.mjs +50 -19
- package/dist/charts/kinds/time-plan.mjs +29 -2
- package/dist/charts/kinds/time-plot.mjs +1 -1
- package/dist/charts/kinds/time-stops.mjs +58 -29
- package/dist/charts/kinds/waterfall-data.d.mts +3 -3
- package/dist/charts/kinds/waterfall-data.mjs +2 -2
- package/dist/charts/kinds/waterfall.d.mts +5 -4
- package/dist/charts/kinds/waterfall.mjs +29 -2
- package/dist/charts/layout/frame.mjs +5 -3
- package/dist/charts/layout/stack.mjs +43 -22
- package/dist/charts/marks/axes.mjs +10 -5
- package/dist/charts/marks/budget.mjs +14 -0
- package/dist/charts/marks/end-labels.mjs +24 -10
- package/dist/charts/marks/legend.mjs +19 -8
- package/dist/charts/marks/lines.mjs +3 -3
- package/dist/charts/marks/more.mjs +79 -13
- package/dist/charts/marks/notes.mjs +12 -6
- package/dist/charts/marks/series-line.mjs +14 -10
- package/dist/charts/marks/thin.mjs +16 -33
- package/dist/charts/scale/calendar.mjs +41 -26
- package/dist/charts/scale/linear.mjs +58 -0
- package/dist/charts/scale/value.d.mts +21 -0
- package/dist/charts/scale/value.mjs +67 -9
- package/dist/charts/scene/lazy.mjs +27 -0
- package/dist/charts/scene/markup.mjs +2 -1
- package/dist/charts/scene/svg.mjs +20 -8
- package/dist/charts/scene/types.d.mts +34 -0
- package/dist/charts/text/measure.mjs +33 -3
- package/dist/charts/theme.mjs +13 -4
- package/dist/charts-react/Chart.d.mts +20 -0
- package/dist/charts-react/Chart.mjs +9 -67
- package/dist/charts-react/Reader.mjs +50 -96
- package/dist/charts-react/box.mjs +106 -0
- package/dist/charts-react/bucket-names.mjs +9 -24
- package/dist/charts-react/columns-picture.mjs +12 -0
- package/dist/charts-react/exact-sum.mjs +4 -7
- package/dist/charts-react/from-answer.mjs +9 -4
- package/dist/charts-react/index.d.mts +9 -2
- package/dist/charts-react/index.mjs +9 -2
- package/dist/charts-react/kinds/area.d.mts +4 -0
- package/dist/charts-react/kinds/area.mjs +38 -0
- package/dist/charts-react/kinds/bar.d.mts +4 -0
- package/dist/charts-react/kinds/bar.mjs +15 -0
- package/dist/charts-react/kinds/funnel.d.mts +4 -0
- package/dist/charts-react/kinds/funnel.mjs +13 -0
- package/dist/charts-react/kinds/heatmap.d.mts +4 -0
- package/dist/charts-react/kinds/heatmap.mjs +13 -0
- package/dist/charts-react/kinds/line.d.mts +4 -0
- package/dist/charts-react/kinds/line.mjs +20 -0
- package/dist/charts-react/kinds/multiples.d.mts +4 -0
- package/dist/charts-react/kinds/multiples.mjs +33 -0
- package/dist/charts-react/kinds/number.d.mts +5 -0
- package/dist/charts-react/kinds/number.mjs +86 -0
- package/dist/charts-react/plan-bars.mjs +15 -8
- package/dist/charts-react/plan-funnel.mjs +3 -1
- package/dist/charts-react/plan-grid.mjs +14 -5
- package/dist/charts-react/plan-of.mjs +17 -0
- package/dist/charts-react/plan-parts.mjs +16 -5
- package/dist/charts-react/plan-time.mjs +4 -53
- package/dist/charts-react/reader-page.d.mts +1 -1
- package/dist/charts-react/reader-page.mjs +19 -9
- package/dist/charts-react/renderers.d.mts +14 -0
- package/dist/charts-react/renderers.mjs +22 -0
- package/dist/charts-react/table.d.mts +1 -0
- package/dist/charts-react/table.mjs +108 -0
- package/dist/charts-react/tiles.mjs +21 -49
- package/dist/charts-react/useScene.mjs +45 -17
- package/dist/charts-react/words.mjs +19 -0
- package/dist/checks.mjs +97 -19
- package/dist/cli/add.mjs +4 -3
- package/dist/cli/doctor.mjs +2 -2
- package/dist/core/conformance/index.d.mts +5 -2
- package/dist/core/conformance/index.mjs +5 -2
- package/dist/core/conformance/memory/aggregate.mjs +11 -6
- package/dist/core/conformance/memory/rows.d.mts +7 -3
- package/dist/core/conformance/memory/rows.mjs +19 -13
- package/dist/core/conformance/memory/source.mjs +4 -4
- package/dist/core/document/control-fields.d.mts +20 -0
- package/dist/core/document/control-fields.mjs +117 -0
- package/dist/core/document/display-comparisons.d.mts +17 -0
- package/dist/core/document/display-comparisons.mjs +15 -4
- package/dist/core/document/display-entries.d.mts +14 -0
- package/dist/core/document/display-entries.mjs +25 -9
- package/dist/core/document/display-validation.d.mts +5 -1
- package/dist/core/document/display-validation.mjs +14 -7
- package/dist/core/document/display.d.mts +10 -8
- package/dist/core/document/display.mjs +25 -4
- package/dist/core/document/layout.d.mts +8 -9
- package/dist/core/document/layout.mjs +23 -6
- package/dist/core/document/stacked.d.mts +0 -7
- package/dist/core/document/types.mjs +8 -6
- package/dist/core/document/upgrade.d.mts +1 -0
- package/dist/core/document/upgrade.mjs +4 -2
- package/dist/core/engine/access.mjs +3 -3
- package/dist/core/engine/assert.mjs +4 -2
- package/dist/core/engine/bucket.mjs +2 -2
- package/dist/core/engine/checks.mjs +6 -7
- package/dist/core/engine/custom/ask.mjs +22 -2
- package/dist/core/engine/custom/cells.mjs +22 -22
- package/dist/core/engine/custom/level.mjs +12 -13
- package/dist/core/engine/custom/measures.mjs +12 -9
- package/dist/core/engine/custom/reader.mjs +3 -1
- package/dist/core/engine/custom/records.mjs +8 -7
- package/dist/core/engine/custom/unread.mjs +78 -0
- package/dist/core/engine/custom/where.mjs +15 -10
- package/dist/core/engine/index.d.mts +2 -13
- package/dist/core/engine/index.mjs +2 -12
- package/dist/core/engine/measure.mjs +1 -0
- package/dist/core/engine/members.mjs +7 -3
- package/dist/core/engine/nan.mjs +10 -1
- package/dist/core/engine/native.mjs +2 -20
- package/dist/core/engine/numbers.mjs +26 -14
- package/dist/core/engine/postgres.mjs +9 -5
- package/dist/core/engine/prepare.mjs +4 -4
- package/dist/core/engine/rank-sets.mjs +1 -1
- package/dist/core/engine/read.mjs +5 -4
- package/dist/core/engine/reader.d.mts +6 -0
- package/dist/core/engine/record-layout.mjs +3 -3
- package/dist/core/engine/run.mjs +77 -20
- package/dist/core/engine/segmented.d.mts +2 -1
- package/dist/core/engine/segmented.mjs +19 -12
- package/dist/core/engine/series.mjs +1 -1
- package/dist/core/engine/shape.mjs +8 -8
- package/dist/core/engine/sql-partition.mjs +2 -2
- package/dist/core/engine/sql-pass.mjs +3 -2
- package/dist/core/engine/sql-reader.mjs +13 -5
- package/dist/core/engine/sql-reads.mjs +2 -1
- package/dist/core/engine/sql-records.mjs +2 -2
- package/dist/core/engine/sql-split.mjs +1 -1
- package/dist/core/engine/sql-unread.mjs +70 -0
- package/dist/core/engine/time.mjs +2 -1
- package/dist/core/engine/types.d.mts +17 -0
- package/dist/core/engine/version.d.mts +1 -1
- package/dist/core/engine/version.mjs +1 -1
- package/dist/core/error/codes.d.mts +24 -1
- package/dist/core/error/codes.mjs +23 -3
- package/dist/core/error/refusal.d.mts +8 -3
- package/dist/core/error/refusal.mjs +6 -1
- package/dist/core/exact/decimal.d.mts +1 -14
- package/dist/core/exact/decimal.mjs +9 -19
- package/dist/core/exact/stored.d.mts +9 -0
- package/dist/core/exact/stored.mjs +38 -0
- package/dist/core/exact/text.d.mts +16 -1
- package/dist/core/exact/text.mjs +50 -1
- package/dist/core/format/digits.mjs +55 -0
- package/dist/core/format/index.d.mts +16 -0
- package/dist/core/format/index.mjs +27 -0
- package/dist/core/format/number.d.mts +27 -0
- package/dist/core/format/number.mjs +158 -0
- package/dist/core/format/write.d.mts +6 -0
- package/dist/core/format/write.mjs +57 -0
- package/dist/core/index.d.mts +43 -33
- package/dist/core/index.mjs +31 -28
- package/dist/core/model/defaults.d.mts +18 -1
- package/dist/core/model/defaults.mjs +19 -1
- package/dist/core/model/define.d.mts +17 -8
- package/dist/core/model/define.mjs +2 -0
- package/dist/core/model/member.d.mts +5 -3
- package/dist/core/model/member.mjs +33 -6
- package/dist/core/model/storage.mjs +40 -12
- package/dist/core/model/types.d.mts +17 -1
- package/dist/core/model/types.mjs +5 -0
- package/dist/core/model/validate/expr.d.mts +1 -7
- package/dist/core/model/validate/fields.d.mts +2 -0
- package/dist/core/model/validate/fields.mjs +14 -7
- package/dist/core/model/validate/issues.mjs +5 -1
- package/dist/core/model/validate/known-members.mjs +6 -5
- package/dist/core/model/validate/shape.mjs +36 -3
- package/dist/core/model/validate/source.mjs +2 -2
- package/dist/core/oracle/data.d.mts +4 -2
- package/dist/core/oracle/evaluate.d.mts +19 -1
- package/dist/core/oracle/evaluate.mjs +56 -10
- package/dist/core/oracle/expr.mjs +1 -1
- package/dist/core/oracle/facts.mjs +12 -5
- package/dist/core/oracle/measure.mjs +1 -1
- package/dist/core/oracle/request.mjs +39 -4
- package/dist/core/oracle/segmented.d.mts +3 -1
- package/dist/core/oracle/segmented.mjs +19 -13
- package/dist/core/oracle/unread.mjs +32 -0
- package/dist/core/oracle/visibility.mjs +4 -3
- package/dist/core/policy/bind.d.mts +2 -11
- package/dist/core/policy/bind.mjs +1 -1
- package/dist/core/policy/match.mjs +1 -1
- package/dist/core/query/closure.d.mts +7 -2
- package/dist/core/query/closure.mjs +29 -12
- package/dist/core/query/compose-tile.d.mts +3 -2
- package/dist/core/query/compose-tile.mjs +32 -13
- package/dist/core/query/compose.d.mts +0 -5
- package/dist/core/query/drill/internal.d.mts +5 -5
- package/dist/core/query/drill/internal.mjs +11 -0
- package/dist/core/query/drill/links.d.mts +2 -3
- package/dist/core/query/drill/links.mjs +18 -4
- package/dist/core/query/drill/selection.d.mts +8 -2
- package/dist/core/query/drill/selection.mjs +14 -3
- package/dist/core/query/drill/synthetic.mjs +1 -1
- package/dist/core/query/drill/time.mjs +11 -10
- package/dist/core/query/filter.d.mts +1 -6
- package/dist/core/query/filter.mjs +1 -4
- package/dist/core/query/fold.mjs +23 -0
- package/dist/core/query/segments.mjs +42 -3
- package/dist/core/query/to-wire.d.mts +7 -0
- package/dist/core/query/to-wire.mjs +14 -2
- package/dist/core/query/types.d.mts +30 -13
- package/dist/core/result/columns.mjs +23 -13
- package/dist/core/result/number.mjs +3 -3
- package/dist/core/result/status.d.mts +13 -0
- package/dist/core/result/status.mjs +18 -0
- package/dist/core/result/time-axis.d.mts +14 -13
- package/dist/core/result/time-axis.mjs +20 -2
- package/dist/core/result/types.d.mts +33 -3
- package/dist/core/result/whole.d.mts +23 -0
- package/dist/core/result/whole.mjs +27 -0
- package/dist/core/schema/agent-query.d.mts +89 -0
- package/dist/core/schema/agent-query.mjs +115 -0
- package/dist/core/schema/aliases.mjs +1 -52
- package/dist/core/schema/answer-parts.mjs +17 -13
- package/dist/core/schema/answers.d.mts +787 -319
- package/dist/core/schema/commands.d.mts +33 -23
- package/dist/core/schema/commands.mjs +26 -18
- package/dist/core/schema/custom.mjs +46 -45
- package/dist/core/schema/document.d.mts +32 -27
- package/dist/core/schema/document.mjs +61 -81
- package/dist/core/schema/drill-answers.mjs +4 -1
- package/dist/core/schema/drill.d.mts +14 -9
- package/dist/core/schema/drill.mjs +23 -22
- package/dist/core/schema/index.d.mts +5 -3
- package/dist/core/schema/index.mjs +5 -3
- package/dist/core/schema/options.d.mts +92 -0
- package/dist/core/schema/options.mjs +104 -0
- package/dist/core/schema/picks.d.mts +2 -2
- package/dist/core/schema/picks.mjs +7 -6
- package/dist/core/schema/query.d.mts +9 -83
- package/dist/core/schema/query.mjs +49 -73
- package/dist/core/schema/strict.d.mts +3 -0
- package/dist/core/schema/strict.mjs +91 -0
- package/dist/core/schema/union-error.mjs +30 -7
- package/dist/core/schema/view.d.mts +4 -3
- package/dist/core/schema/view.mjs +16 -11
- package/dist/core/store/ddl.d.mts +0 -2
- package/dist/core/store/ddl.mjs +1 -5
- package/dist/core/time/bucket.d.mts +1 -19
- package/dist/core/time/bucket.mjs +6 -6
- package/dist/core/time/compare.mjs +3 -2
- package/dist/core/time/index.d.mts +7 -8
- package/dist/core/time/instant.d.mts +15 -9
- package/dist/core/time/instant.mjs +23 -9
- package/dist/core/time/range.d.mts +3 -15
- package/dist/core/time/range.mjs +17 -7
- package/dist/core/time/stored.d.mts +8 -5
- package/dist/core/time/stored.mjs +51 -15
- package/dist/core/time/temporal.d.mts +1 -5
- package/dist/core/time/temporal.mjs +9 -4
- package/dist/core/time/text-time.d.mts +31 -2
- package/dist/core/time/text-time.mjs +139 -22
- package/dist/core/time/zone.mjs +2 -2
- package/dist/core/types/api.d.mts +1 -1
- package/dist/core/types/api.mjs +1 -1
- package/dist/core/types/dashboard.d.mts +185 -0
- package/dist/core/types/dashboard.mjs +26 -0
- package/dist/core/types/drill-api.d.mts +14 -2
- package/dist/core/types/infer.d.mts +0 -4
- package/dist/core/types/options-check.d.mts +42 -0
- package/dist/core/types/options-check.mjs +90 -0
- package/dist/core/types/options.d.mts +14 -8
- package/dist/core/value/casefold.d.mts +1 -3
- package/dist/core/value/stored.d.mts +26 -0
- package/dist/core/value/stored.mjs +28 -0
- package/dist/cursor-seal.mjs +37 -9
- package/dist/dashboard-documents.d.mts +14 -6
- package/dist/dashboard-documents.mjs +32 -12
- package/dist/dashboards.mjs +10 -9
- package/dist/drill-access.mjs +6 -6
- package/dist/drill-change.mjs +18 -20
- package/dist/drill-comparison.mjs +2 -1
- package/dist/drill-crumbs.mjs +63 -28
- package/dist/drill-distinct.mjs +2 -1
- package/dist/drill-explain.mjs +1 -1
- package/dist/drill-items.mjs +1 -1
- package/dist/drill-open.mjs +39 -23
- package/dist/drill-seal.mjs +41 -13
- package/dist/drill-share.mjs +1 -1
- package/dist/drill-summary.mjs +2 -1
- package/dist/drill-targets.mjs +4 -4
- package/dist/drill-views.mjs +4 -3
- package/dist/drill.mjs +1 -1
- package/dist/editing.mjs +5 -3
- package/dist/endpoints/index.d.mts +29 -8
- package/dist/endpoints/index.mjs +4 -1
- package/dist/endpoints/meta.mjs +4 -3
- package/dist/endpoints/query.mjs +5 -2
- package/dist/endpoints/read.mjs +7 -6
- package/dist/endpoints/versions.mjs +2 -1
- package/dist/execute.d.mts +3 -0
- package/dist/execute.mjs +23 -12
- package/dist/grant.d.mts +9 -0
- package/dist/grant.mjs +43 -0
- package/dist/handler.mjs +8 -13
- package/dist/http.d.mts +6 -2
- package/dist/http.mjs +6 -2
- package/dist/index.d.mts +25 -4
- package/dist/index.mjs +91 -40
- package/dist/llms.txt +3 -3
- package/dist/mcp/api.mjs +2 -1
- package/dist/mcp/query.mjs +3 -8
- package/dist/mcp/resolve.mjs +9 -2
- package/dist/node/index.d.mts +36 -0
- package/dist/node/index.mjs +89 -0
- package/dist/node/request.d.mts +12 -0
- package/dist/node/request.mjs +119 -0
- package/dist/node/response.mjs +58 -0
- package/dist/principal.mjs +15 -7
- package/dist/react/Canvas.mjs +88 -67
- package/dist/react/Cell.mjs +2 -1
- package/dist/react/Dashboard.d.mts +9 -1
- package/dist/react/Dashboard.mjs +42 -42
- package/dist/react/DashboardList.mjs +9 -4
- package/dist/react/Editing.d.mts +9 -0
- package/dist/react/Editing.mjs +8 -3
- package/dist/react/Grid.mjs +1 -1
- package/dist/react/Header.mjs +4 -35
- package/dist/react/History.mjs +3 -2
- package/dist/react/LoadFailed.mjs +59 -0
- package/dist/react/Panel.d.mts +1 -1
- package/dist/react/Panel.mjs +1 -1
- package/dist/react/Parts.d.mts +34 -0
- package/dist/react/Parts.mjs +9 -6
- package/dist/react/ReviewPanel.mjs +1 -1
- package/dist/react/RowBody.d.mts +2 -0
- package/dist/react/RowBody.mjs +5 -1
- package/dist/react/Share.mjs +153 -0
- package/dist/react/TabStrip.mjs +37 -0
- package/dist/react/Tile.d.mts +3 -1
- package/dist/react/Tile.mjs +89 -92
- package/dist/react/TileState.mjs +117 -0
- package/dist/react/ago.mjs +45 -0
- package/dist/react/arrange.mjs +1 -1
- package/dist/react/board.mjs +2 -2
- package/dist/react/bucket-name.d.mts +8 -0
- package/dist/react/bucket-name.mjs +13 -0
- package/dist/react/builder/DisplayOptions.mjs +219 -0
- package/dist/react/builder/Preview.mjs +13 -13
- package/dist/react/builder/RangeEditor.mjs +4 -3
- package/dist/react/builder/WidgetBuilder.d.mts +1 -7
- package/dist/react/builder/WidgetBuilder.mjs +12 -3
- package/dist/react/builder/base.d.mts +13 -2
- package/dist/react/builder/base.mjs +70 -12
- package/dist/react/builder/display.d.mts +3 -0
- package/dist/react/builder/display.mjs +256 -0
- package/dist/react/builder/labels.mjs +19 -5
- package/dist/react/builder/options.mjs +11 -6
- package/dist/react/builder/state.mjs +25 -3
- package/dist/react/builder/useBuilder.d.mts +7 -1
- package/dist/react/builder/useBuilder.mjs +6 -9
- package/dist/react/builder/usePreview.mjs +3 -2
- package/dist/react/builder/words.d.mts +16 -1
- package/dist/react/builder/words.mjs +41 -1
- package/dist/react/change-text.mjs +149 -0
- package/dist/react/client.d.mts +9 -0
- package/dist/react/client.mjs +105 -14
- package/dist/react/context.d.mts +24 -3
- package/dist/react/context.mjs +23 -7
- package/dist/react/dates-shown.mjs +76 -0
- package/dist/react/draft.mjs +3 -2
- package/dist/react/drill/Bars.mjs +12 -16
- package/dist/react/drill/Comparison.mjs +1 -1
- package/dist/react/drill/DrillPanel.d.mts +1 -1
- package/dist/react/drill/DrillPanel.mjs +2 -1
- package/dist/react/drill/Header.mjs +65 -12
- package/dist/react/drill/Items.d.mts +1 -1
- package/dist/react/drill/Notes.mjs +10 -7
- package/dist/react/drill/PanelStates.mjs +8 -1
- package/dist/react/drill/Trend.mjs +10 -5
- package/dist/react/drill/board.d.mts +1 -1
- package/dist/react/drill/host.mjs +4 -1
- package/dist/react/drill/lazy.mjs +2 -27
- package/dist/react/drill/props.d.mts +17 -7
- package/dist/react/drill/props.mjs +55 -14
- package/dist/react/drill/state.d.mts +15 -5
- package/dist/react/drill/state.mjs +12 -3
- package/dist/react/drill/words.d.mts +46 -3
- package/dist/react/drill/words.mjs +30 -5
- package/dist/react/english.mjs +33 -8
- package/dist/react/export/ExportButton.mjs +4 -1
- package/dist/react/export/csv.d.mts +7 -2
- package/dist/react/export/csv.mjs +24 -7
- package/dist/react/failure-words.mjs +60 -0
- package/dist/react/filters/bar.d.mts +1 -1
- package/dist/react/filters/bar.mjs +4 -1
- package/dist/react/filters/calendar.mjs +23 -8
- package/dist/react/filters/chip.mjs +7 -3
- package/dist/react/filters/context.d.mts +13 -1
- package/dist/react/filters/context.mjs +1 -1
- package/dist/react/filters/dates-said.mjs +57 -0
- package/dist/react/filters/days.d.mts +3 -4
- package/dist/react/filters/days.mjs +10 -17
- package/dist/react/filters/hooks.d.mts +11 -0
- package/dist/react/filters/hooks.mjs +10 -6
- package/dist/react/filters/menu-search.mjs +17 -9
- package/dist/react/filters/menu.mjs +10 -8
- package/dist/react/filters/phone.mjs +41 -16
- package/dist/react/filters/place.mjs +40 -0
- package/dist/react/filters/popover.mjs +18 -13
- package/dist/react/filters/rules.d.mts +4 -3
- package/dist/react/filters/rules.mjs +3 -3
- package/dist/react/filters/sheet.mjs +7 -3
- package/dist/react/filters/state.mjs +6 -1
- package/dist/react/filters/values.mjs +24 -7
- package/dist/react/filters/words.d.mts +13 -0
- package/dist/react/filters/words.mjs +5 -0
- package/dist/react/format-time.d.mts +17 -6
- package/dist/react/format-time.mjs +152 -33
- package/dist/react/format.d.mts +3 -3
- package/dist/react/format.mjs +27 -133
- package/dist/react/headline.d.mts +6 -3
- package/dist/react/headline.mjs +81 -25
- package/dist/react/index.d.mts +19 -17
- package/dist/react/index.mjs +12 -10
- package/dist/react/lazy.mjs +38 -0
- package/dist/react/messages.d.mts +78 -2
- package/dist/react/now.mjs +38 -0
- package/dist/react/read.d.mts +1 -0
- package/dist/react/read.mjs +140 -9
- package/dist/react/renderers/exact.mjs +31 -59
- package/dist/react/renderers/index.d.mts +27 -6
- package/dist/react/renderers/index.mjs +141 -102
- package/dist/react/renderers/list-parts.mjs +24 -0
- package/dist/react/renderers/list.d.mts +1 -0
- package/dist/react/renderers/list.mjs +99 -43
- package/dist/react/renderers/more-rows.mjs +75 -0
- package/dist/react/renderers/number-before.mjs +320 -0
- package/dist/react/renderers/number-period.mjs +54 -0
- package/dist/react/renderers/number-whole.mjs +29 -0
- package/dist/react/renderers/props.d.mts +24 -1
- package/dist/react/renderers/props.mjs +8 -0
- package/dist/react/renderers/table-cells.mjs +137 -31
- package/dist/react/renderers/table-fit.mjs +55 -10
- package/dist/react/renderers/table-measure.mjs +29 -9
- package/dist/react/renderers/table-row.mjs +14 -9
- package/dist/react/renderers/table-scale.mjs +2 -3
- package/dist/react/renderers/table-sort.mjs +3 -2
- package/dist/react/renderers/table-whole.mjs +37 -0
- package/dist/react/renderers/table.mjs +73 -53
- package/dist/react/review.d.mts +7 -0
- package/dist/react/review.mjs +35 -8
- package/dist/react/roving.d.mts +6 -0
- package/dist/react/roving.mjs +123 -0
- package/dist/react/says-dates.d.mts +7 -0
- package/dist/react/says-dates.mjs +51 -0
- package/dist/react/series.mjs +5 -6
- package/dist/react/stable.mjs +1 -1
- package/dist/react/tabs/EditTabs.mjs +125 -0
- package/dist/react/tabs/NameField.mjs +72 -0
- package/dist/react/tabs/TabMenu.mjs +175 -0
- package/dist/react/tabs/actions.mjs +37 -0
- package/dist/react/tabs/commands.mjs +76 -0
- package/dist/react/tabs/focus.mjs +22 -0
- package/dist/react/tabs/keys.mjs +28 -0
- package/dist/react/theme-unlayered.css +1 -1
- package/dist/react/theme.css +1 -1
- package/dist/react/tile-store.d.mts +4 -0
- package/dist/react/tile-store.mjs +93 -13
- package/dist/react/touch.d.mts +16 -0
- package/dist/react/touch.mjs +39 -0
- package/dist/react/useBoard.d.mts +6 -0
- package/dist/react/useBoard.mjs +1 -0
- package/dist/react/useDashboard.d.mts +2 -0
- package/dist/react/useDashboard.mjs +5 -2
- package/dist/react/useTiles.d.mts +3 -0
- package/dist/react/useTiles.mjs +73 -17
- package/dist/react/view-grid.mjs +2 -2
- package/dist/react/view.mjs +1 -1
- package/dist/recharts/axes.mjs +1 -1
- package/dist/recharts/axis.mjs +23 -73
- package/dist/recharts/bar.d.mts +2 -1
- package/dist/recharts/bar.mjs +140 -64
- package/dist/recharts/fit.mjs +33 -0
- package/dist/recharts/line.mjs +21 -15
- package/dist/recharts/marks.mjs +2 -1
- package/dist/recharts/parts.mjs +16 -13
- package/dist/recharts/table.mjs +8 -3
- package/dist/refusal.mjs +46 -0
- package/dist/registry/filter-bar.json +1 -1
- package/dist/skills/derive-dashboards/SKILL.md +23 -8
- package/dist/tile-doc.mjs +1 -1
- package/package.json +21 -6
- package/dist/charts-react/plan.d.mts +0 -3
- package/dist/charts-react/plan.mjs +0 -37
- package/dist/charts-react/tiles.d.mts +0 -24
- package/dist/core/policy/match.d.mts +0 -16
- package/dist/core/schema/aliases.d.mts +0 -7
- package/dist/core/time/compare.d.mts +0 -30
- package/dist/react/EditBar.d.mts +0 -16
- package/dist/react/History.d.mts +0 -30
- package/dist/react/ReviewPanel.d.mts +0 -15
- package/dist/react/digits.mjs +0 -46
- package/dist/react/drill/trend-touch.mjs +0 -33
- package/dist/react/renderers/exact.d.mts +0 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fractionAlong, least, most } from "../data/range.mjs";
|
|
2
|
+
import { niceSpan, spanTicks } from "./linear.mjs";
|
|
2
3
|
import { tickStep } from "d3-array";
|
|
3
|
-
import { scaleLinear } from "d3-scale";
|
|
4
4
|
// src/scale/value.ts
|
|
5
5
|
/** A plot this tall has room for about this many ticks: one every 44 pixels, from 2 to 6. */
|
|
6
6
|
const tickCount = (height) => Math.max(2, Math.min(6, Math.floor(height / 44)));
|
|
@@ -18,9 +18,33 @@ function valueAxis(values, rule) {
|
|
|
18
18
|
high
|
|
19
19
|
]
|
|
20
20
|
};
|
|
21
|
+
const inUnit = unitAxis(low, high, rule);
|
|
22
|
+
if (inUnit !== void 0) return inUnit;
|
|
21
23
|
if (rule.reads?.whole === true && tickStep(low, high, rule.count) < 1) return wholeAxis(low, high, rule.count);
|
|
22
24
|
return roundAxis(low, high, rule.count);
|
|
23
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* The round numbers between two ends: none where the span is too small for a float to step.
|
|
28
|
+
* D3 has no step for such a span and throws rather than name a number, so it is not asked: the
|
|
29
|
+
* axis then keeps its values' own ends.
|
|
30
|
+
*/
|
|
31
|
+
const stepped = (from, to, count) => tickStep(from, to, count) > 0 ? spanTicks(from, to, count) : [];
|
|
32
|
+
/**
|
|
33
|
+
* For a measure counted in several units (a duration), the axis in the largest unit whose
|
|
34
|
+
* round steps are whole: 0 to 14 days by 2, where in seconds it stepped by 200,000 and read
|
|
35
|
+
* 2.31, 4.63, 6.94 days. None when even the smallest unit would step in fractions.
|
|
36
|
+
*/
|
|
37
|
+
function unitAxis(low, high, rule) {
|
|
38
|
+
const unit = rule.reads?.units?.find((size) => tickStep(low / size, high / size, rule.count) >= 1);
|
|
39
|
+
if (unit === void 0) return void 0;
|
|
40
|
+
const counted = roundAxis(low / unit, high / unit, rule.count);
|
|
41
|
+
return {
|
|
42
|
+
min: Math.min(low, counted.min * unit),
|
|
43
|
+
max: Math.max(high, counted.max * unit),
|
|
44
|
+
ticks: counted.ticks.map((tick) => tick * unit),
|
|
45
|
+
unit
|
|
46
|
+
};
|
|
47
|
+
}
|
|
24
48
|
/** Whether a span has zero in it: the rule kept it, or the values lie on both sides. */
|
|
25
49
|
const holdsZero = (low, high) => low <= 0 && high >= 0;
|
|
26
50
|
/**
|
|
@@ -37,13 +61,12 @@ const stretched = (ends, low, high) => ends.max - ends.min > 2 * (high - low) ||
|
|
|
37
61
|
*/
|
|
38
62
|
function roundAxis(low, high, count) {
|
|
39
63
|
for (let ask = count; ask >= 1; ask--) {
|
|
40
|
-
const
|
|
41
|
-
const
|
|
64
|
+
const [from, to] = niceSpan(low, high, ask);
|
|
65
|
+
const ticks = toppedOff(stepped(from, to, ask), Math.max(to, high));
|
|
42
66
|
const ends = {
|
|
43
67
|
min: Math.min(from, low),
|
|
44
|
-
max: Math.max(to, high)
|
|
68
|
+
max: Math.max(to, high, ticks.at(-1) ?? high)
|
|
45
69
|
};
|
|
46
|
-
const ticks = scale.ticks(ask);
|
|
47
70
|
if (ticks.length >= 2 && ticks.length <= count + 1 && Number.isFinite(ends.min) && Number.isFinite(ends.max) && !stretched(ends, low, high)) return {
|
|
48
71
|
...ends,
|
|
49
72
|
ticks
|
|
@@ -55,27 +78,62 @@ function roundAxis(low, high, count) {
|
|
|
55
78
|
/** How many more ticks than the plot has room to write an axis on its values' own ends may ask for. */
|
|
56
79
|
const SPARE = 3;
|
|
57
80
|
/**
|
|
58
|
-
*
|
|
81
|
+
* Round ticks with one more step on top where the last falls short of the highest value: the
|
|
82
|
+
* axis then ends on a number, so no value peaks above the last line a reader can read across to.
|
|
83
|
+
* One step more is less than the span the ticks lie in, so the axis is not stretched past twice it.
|
|
84
|
+
*/
|
|
85
|
+
function toppedOff(ticks, high) {
|
|
86
|
+
const [a, b] = ticks;
|
|
87
|
+
const last = ticks.at(-1);
|
|
88
|
+
if (a === void 0 || b === void 0 || last === void 0 || last >= high) return ticks;
|
|
89
|
+
const step = b - a;
|
|
90
|
+
return [...ticks, Number((last + step).toPrecision(12))];
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* An axis that ends where its values do at its foot and on a round number at its top, naming
|
|
94
|
+
* the round numbers between: for a plot too
|
|
59
95
|
* short for round ends that would not stretch the span. It takes the fewest round numbers that
|
|
60
96
|
* are at least two, though that be one more than the plot has room to write: where numbers
|
|
61
97
|
* are written, one with no room is left out and its hairline stays.
|
|
62
98
|
*/
|
|
63
99
|
function ownEnds(low, high, count) {
|
|
64
|
-
|
|
100
|
+
let first;
|
|
65
101
|
for (let ask = 1; ask <= count + SPARE; ask++) {
|
|
66
|
-
const ticks =
|
|
67
|
-
if (ticks.length
|
|
102
|
+
const ticks = stepped(low, high, ask);
|
|
103
|
+
if (ticks.length < 2) continue;
|
|
104
|
+
first ??= {
|
|
68
105
|
min: low,
|
|
69
106
|
max: high,
|
|
70
107
|
ticks
|
|
71
108
|
};
|
|
109
|
+
const fit = [ticks, everyOther(ticks)].map((some) => toppedOff(some, high)).find((some) => {
|
|
110
|
+
const top = some.at(-1) ?? high;
|
|
111
|
+
const zeroBack = !holdsZero(low, high) && holdsZero(low, top);
|
|
112
|
+
return some.length >= 2 && some.length <= count + 1 && !zeroBack && !stretched({
|
|
113
|
+
min: low,
|
|
114
|
+
max: top
|
|
115
|
+
}, low, high);
|
|
116
|
+
});
|
|
117
|
+
if (fit !== void 0) return {
|
|
118
|
+
min: low,
|
|
119
|
+
max: Math.max(high, fit.at(-1) ?? high),
|
|
120
|
+
ticks: fit
|
|
121
|
+
};
|
|
72
122
|
}
|
|
123
|
+
if (first !== void 0) return first;
|
|
73
124
|
return {
|
|
74
125
|
min: low,
|
|
75
126
|
max: high,
|
|
76
127
|
ticks: [low, high]
|
|
77
128
|
};
|
|
78
129
|
}
|
|
130
|
+
/** Round ticks twice as far apart: those on a whole number of the wider step, zero among them. */
|
|
131
|
+
function everyOther(ticks) {
|
|
132
|
+
const [a, b] = ticks;
|
|
133
|
+
if (a === void 0 || b === void 0) return ticks;
|
|
134
|
+
const wide = 2 * (b - a);
|
|
135
|
+
return ticks.filter((t) => Math.abs(t / wide - Math.round(t / wide)) < 1e-9);
|
|
136
|
+
}
|
|
79
137
|
/**
|
|
80
138
|
* An axis whose ticks are its two ends, on the round step that holds the span: 0 and 5K for
|
|
81
139
|
* 4,870. Where the span crosses zero, zero is a tick too: the zero line is the one line a chart
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// src/scene/lazy.ts
|
|
2
|
+
/**
|
|
3
|
+
* A stop whose items are made the first time they are read. Every kind whose stops each write
|
|
4
|
+
* values builds its stops through this, so building a scene costs nothing per value.
|
|
5
|
+
*/
|
|
6
|
+
function lazyStop(stop, items) {
|
|
7
|
+
let made;
|
|
8
|
+
return {
|
|
9
|
+
...stop,
|
|
10
|
+
get items() {
|
|
11
|
+
made ??= items();
|
|
12
|
+
return made;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/** What a pointer finds, its stops made the first time they are read. */
|
|
17
|
+
function lazyHover(hover, stops) {
|
|
18
|
+
let made;
|
|
19
|
+
return {
|
|
20
|
+
...hover,
|
|
21
|
+
get stops() {
|
|
22
|
+
made ??= stops();
|
|
23
|
+
return made;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export { lazyHover, lazyStop };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/scene/markup.ts
|
|
2
2
|
/** A number as SVG writes it: two decimals at most. */
|
|
3
3
|
const round = (value) => String(Math.round(value * 100) / 100);
|
|
4
|
+
const pathRound = (value) => String(Math.round(value * 10) / 10);
|
|
4
5
|
/** Whether XML allows a character: tab, line feed and carriage return and nothing else below a space, and no half of a pair. */
|
|
5
6
|
function allowed(char) {
|
|
6
7
|
const code = char.codePointAt(0) ?? 0;
|
|
@@ -32,4 +33,4 @@ function stamp(text) {
|
|
|
32
33
|
const attrs = (given) => Object.entries(given).filter(([, value]) => value !== void 0).map(([name, value]) => {
|
|
33
34
|
return ` ${name}="${typeof value === "number" ? round(value) : escapeText(String(value))}"`;
|
|
34
35
|
}).join("");
|
|
35
|
-
export { attrs, escapeText, round, stamp };
|
|
36
|
+
export { attrs, escapeText, pathRound, round, stamp };
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
import { checkSize, keysOf, knownKeys } from "../data/clean.mjs";
|
|
1
2
|
import { defs, ids } from "./defs.mjs";
|
|
2
|
-
import { attrs, escapeText, round, stamp } from "./markup.mjs";
|
|
3
|
+
import { attrs, escapeText, pathRound, round, stamp } from "./markup.mjs";
|
|
3
4
|
import { SURFACE, paintCss } from "./paint.mjs";
|
|
4
5
|
// src/scene/svg.ts
|
|
6
|
+
/** The keys a picture is written with: any other is refused, with the one it most likely meant. */
|
|
7
|
+
const SVG = keysOf({
|
|
8
|
+
markKeys: true,
|
|
9
|
+
id: true,
|
|
10
|
+
theme: true,
|
|
11
|
+
font: true
|
|
12
|
+
});
|
|
5
13
|
/** The width of the surface ring behind a text that asks for a halo. */
|
|
6
14
|
const HALO = 3;
|
|
7
15
|
/** The page's own font when the page styles the picture; a system face when it stands alone. */
|
|
@@ -15,6 +23,7 @@ const flat = (nodes) => nodes.flatMap((node) => node.kind === "group" ? [node, .
|
|
|
15
23
|
* them: for a layer drawn over a picture, such as what lights at a hover stop.
|
|
16
24
|
*/
|
|
17
25
|
function renderNodes(nodes, options = {}) {
|
|
26
|
+
knownKeys(options, SVG);
|
|
18
27
|
const all = flat(nodes);
|
|
19
28
|
const fillDefs = all.flatMap((n) => "fill" in n && isFade(n.fill) ? [n.fill] : []);
|
|
20
29
|
const clipDefs = all.flatMap((n) => n.kind === "group" && n.clip !== void 0 ? [n.clip] : []);
|
|
@@ -35,6 +44,7 @@ function renderNodes(nodes, options = {}) {
|
|
|
35
44
|
}
|
|
36
45
|
/** The picture as SVG text. */
|
|
37
46
|
function renderSvg(scene, options = {}) {
|
|
47
|
+
checkSize(scene);
|
|
38
48
|
return `<svg${attrs({
|
|
39
49
|
xmlns: "http://www.w3.org/2000/svg",
|
|
40
50
|
viewBox: `0 0 ${round(scene.width)} ${round(scene.height)}`,
|
|
@@ -135,16 +145,16 @@ function cornered(box, radius) {
|
|
|
135
145
|
fit(radius[3])
|
|
136
146
|
];
|
|
137
147
|
const { x, y, width: w, height: h } = box;
|
|
138
|
-
const arc = (r, dx, dy) => `a${
|
|
148
|
+
const arc = (r, dx, dy) => `a${pathRound(r)},${pathRound(r)} 0 0 1 ${pathRound(dx)},${pathRound(dy)}`;
|
|
139
149
|
return [
|
|
140
|
-
`M${
|
|
141
|
-
`h${
|
|
150
|
+
`M${pathRound(x + tl)},${pathRound(y)}`,
|
|
151
|
+
`h${pathRound(w - tl - tr)}`,
|
|
142
152
|
arc(tr, tr, tr),
|
|
143
|
-
`v${
|
|
153
|
+
`v${pathRound(h - tr - br)}`,
|
|
144
154
|
arc(br, -br, br),
|
|
145
|
-
`h${
|
|
155
|
+
`h${pathRound(-(w - br - bl))}`,
|
|
146
156
|
arc(bl, -bl, -bl),
|
|
147
|
-
`v${
|
|
157
|
+
`v${pathRound(-(h - bl - tl))}`,
|
|
148
158
|
arc(tl, tl, -tl),
|
|
149
159
|
"Z"
|
|
150
160
|
].join("");
|
|
@@ -169,8 +179,10 @@ function textSvg(node, context) {
|
|
|
169
179
|
"stroke-width": halo ? HALO : void 0,
|
|
170
180
|
"stroke-linejoin": halo ? "round" : void 0,
|
|
171
181
|
"paint-order": halo ? "stroke" : void 0
|
|
172
|
-
})}>${runsSvg(node, context)}</text>`;
|
|
182
|
+
})}>${titleSvg(node)}${runsSvg(node, context)}</text>`;
|
|
173
183
|
}
|
|
184
|
+
/** A cut text's whole, as its title: what a pointer resting on it reads. Nothing for a whole text. */
|
|
185
|
+
const titleSvg = (node) => node.full === void 0 ? "" : `<title>${escapeText(node.full)}</title>`;
|
|
174
186
|
/** The text's parts as spans, the browser setting each after the last; or the text itself. */
|
|
175
187
|
function runsSvg(node, context) {
|
|
176
188
|
if (node.runs === void 0) return escapeText(node.text);
|
|
@@ -86,6 +86,12 @@ export type TextNode = Shared & {
|
|
|
86
86
|
* its value. `text` is the whole of it.
|
|
87
87
|
*/
|
|
88
88
|
runs?: readonly TextRun[];
|
|
89
|
+
/**
|
|
90
|
+
* The whole text, when `text` is cut to fit its room ("A very long category n…"): written as
|
|
91
|
+
* the text's `<title>`, so a pointer resting on a cut name reads all of it. Left out when the
|
|
92
|
+
* text is whole.
|
|
93
|
+
*/
|
|
94
|
+
full?: string;
|
|
89
95
|
};
|
|
90
96
|
export type TextRun = {
|
|
91
97
|
text: string;
|
|
@@ -158,8 +164,13 @@ export type Hover = {
|
|
|
158
164
|
rows: readonly HoverColumn[];
|
|
159
165
|
columns: readonly HoverColumn[];
|
|
160
166
|
heading?: string;
|
|
167
|
+
/** The words the picture writes over its rows' names and over its columns', which head the table too. */
|
|
168
|
+
down?: string | undefined;
|
|
169
|
+
across?: string | undefined;
|
|
161
170
|
/** All cells are stops in row order, including empty cells (a navigable heatmap). */
|
|
162
171
|
rowMajor?: boolean;
|
|
172
|
+
/** A cell no stop holds (a series the chart had no room to draw), its value written when read. */
|
|
173
|
+
cell?: (row: number, column: number) => string | undefined;
|
|
163
174
|
};
|
|
164
175
|
};
|
|
165
176
|
export type Scene = {
|
|
@@ -171,7 +182,30 @@ export type Scene = {
|
|
|
171
182
|
summary: string;
|
|
172
183
|
/** Context to show beside the picture, such as the period covered by a merged column. */
|
|
173
184
|
footnote?: string;
|
|
185
|
+
/**
|
|
186
|
+
* For a chart of rows (ranked bars, a heatmap), the height that draws every row, the same
|
|
187
|
+
* at any height: a box that can grow, as a dashboard's tile on a phone does, takes it when
|
|
188
|
+
* it has less, and draws them all.
|
|
189
|
+
*/
|
|
190
|
+
wants?: number;
|
|
174
191
|
nodes: readonly SceneNode[];
|
|
175
192
|
hover?: Hover;
|
|
193
|
+
/**
|
|
194
|
+
* How tall the picture would be with every row at its fullest height and none left out for
|
|
195
|
+
* want of height, whatever height it was given: what a chart of rows lying down asks for, so a
|
|
196
|
+
* box can be as tall as its chart instead of cutting rows or leaving room under them. A grid
|
|
197
|
+
* draws no more rows than its marks' budget has cells for (16 a pixel column of its width):
|
|
198
|
+
* past that it asks for the rows it draws, and counts the rest however tall it is. Small
|
|
199
|
+
* multiples ask too: the height at which every series has a panel, each at the shape a panel
|
|
200
|
+
* is best at for the columns its width gives. Left out by a chart that fills whatever height
|
|
201
|
+
* it is given, and by one with no room to draw a row.
|
|
202
|
+
*/
|
|
203
|
+
natural?: number;
|
|
204
|
+
/**
|
|
205
|
+
* What the chart was given and had no room to draw (rows, panels), by key and name, in the
|
|
206
|
+
* order given: no mark of the picture is keyed by one, and the picture names them where they
|
|
207
|
+
* would have been ("Not shown: e"). Left out when everything given is drawn.
|
|
208
|
+
*/
|
|
209
|
+
left?: readonly HoverColumn[];
|
|
176
210
|
};
|
|
177
211
|
export {};
|
|
@@ -36,6 +36,7 @@ const WIDTHS = {
|
|
|
36
36
|
"–": 556,
|
|
37
37
|
"—": 1e3,
|
|
38
38
|
"…": 1e3,
|
|
39
|
+
"": 0,
|
|
39
40
|
"’": 222,
|
|
40
41
|
"€": 610,
|
|
41
42
|
"£": 610,
|
|
@@ -90,6 +91,21 @@ function widest(texts, font, measure) {
|
|
|
90
91
|
}
|
|
91
92
|
const SLACK = .01;
|
|
92
93
|
/**
|
|
94
|
+
* Whether the last letter of a text is of a script read right to left (Arabic, Hebrew, Syriac,
|
|
95
|
+
* Thaana, N'Ko, Adlam); digits and spaces after it do not count.
|
|
96
|
+
*/
|
|
97
|
+
const endsRightToLeft = (text) => /[\p{sc=Arab}\p{sc=Hebr}\p{sc=Syrc}\p{sc=Thaa}\p{sc=Nkoo}\p{sc=Adlm}]\P{L}*$/u.test(text);
|
|
98
|
+
/**
|
|
99
|
+
* The start of a text that is kept, and the ellipsis that says the rest was cut. After letters
|
|
100
|
+
* read right to left the ellipsis is followed by a right-to-left mark (no width): alone at the
|
|
101
|
+
* end of a line read left to right it would be set at the far right, where such a name begins,
|
|
102
|
+
* and say its start was cut.
|
|
103
|
+
*/
|
|
104
|
+
function cutOff(chars, keep) {
|
|
105
|
+
const kept = chars.slice(0, keep).join("").trimEnd();
|
|
106
|
+
return `${kept}…${endsRightToLeft(kept) ? "" : ""}`;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
93
109
|
* A text cut to a width, ending in an ellipsis when it was cut; the whole text when it fits.
|
|
94
110
|
* Cut no shorter than two characters and the ellipsis (a shorter text that does not fit is cut
|
|
95
111
|
* to what it has, down to the ellipsis alone), even where that is still too wide: a label
|
|
@@ -99,9 +115,23 @@ function fitText(text, width, font, measure) {
|
|
|
99
115
|
if (measure(text, font) <= width + SLACK) return text;
|
|
100
116
|
const chars = Array.from(text);
|
|
101
117
|
let keep = chars.length - 1;
|
|
102
|
-
while (keep > 2 && measure(
|
|
103
|
-
return
|
|
118
|
+
while (keep > 2 && measure(cutOff(chars, keep), font) > width + SLACK) keep--;
|
|
119
|
+
return cutOff(chars, keep);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* A text node's words for a width: the text cut to fit (`fitText`), and, when it was cut, the
|
|
123
|
+
* whole of it (`full`), which the picture writes as the text's title. Every text a chart cuts
|
|
124
|
+
* to fit is set through this, so no cut name is left with no way to read it whole.
|
|
125
|
+
*/
|
|
126
|
+
function fitted(text, width, font, measure) {
|
|
127
|
+
const cut = fitText(text, width, font, measure);
|
|
128
|
+
return {
|
|
129
|
+
text: cut,
|
|
130
|
+
...wholeOf(cut, text)
|
|
131
|
+
};
|
|
104
132
|
}
|
|
133
|
+
/** A text node's whole text, when what it shows was cut from it; nothing for a text shown whole. */
|
|
134
|
+
const wholeOf = (shown, whole) => shown === whole ? {} : { full: whole };
|
|
105
135
|
/**
|
|
106
136
|
* A text for a width: whole when it fits; else cut, when the width is at least `least` and the
|
|
107
137
|
* cut fits (a cut never goes below two letters, so it can still be too wide); else nothing. A
|
|
@@ -120,4 +150,4 @@ function spaced(texts, gap) {
|
|
|
120
150
|
return before === void 0 || text.x - before.x >= (text.width + before.width) / 2 + gap;
|
|
121
151
|
});
|
|
122
152
|
}
|
|
123
|
-
export { fitOrNone, fitText, spaced, tableMeasure, widest };
|
|
153
|
+
export { fitOrNone, fitText, fitted, spaced, tableMeasure, wholeOf, widest };
|
package/dist/charts/theme.mjs
CHANGED
|
@@ -64,7 +64,8 @@ const LINE = {
|
|
|
64
64
|
* strong a band's tint, a partial fill and a background wash are; how strong the hue is in a
|
|
65
65
|
* gridline is beside a border in the same colour, so a host's heavy border leaves a plot quiet; how strong the hue is in a
|
|
66
66
|
* heat grid's palest cell and its deepest (with its number on it, in the palette's first two
|
|
67
|
-
* colours and in any of them, and with no number)
|
|
67
|
+
* colours and in any of them, and with no number), and the power a cell's shade is eased by on
|
|
68
|
+
* the way there (`kinds/grid-marks.ts`); and the dashes: of a line the data is read against, of a
|
|
68
69
|
* marked moment (finer, since it marks a time and not a value), of the comparison period's
|
|
69
70
|
* line, and of a step into or out of a period that is not whole.
|
|
70
71
|
*/
|
|
@@ -84,12 +85,14 @@ const MARK = {
|
|
|
84
85
|
deepest: .72,
|
|
85
86
|
deepestAny: .44,
|
|
86
87
|
deepestBare: .9,
|
|
88
|
+
heatEase: .6,
|
|
87
89
|
partialFill: .55,
|
|
88
90
|
wash: .2,
|
|
89
91
|
dash: "4 4",
|
|
90
92
|
moment: "2 3",
|
|
91
93
|
before: "2 4",
|
|
92
|
-
step: "1 5"
|
|
94
|
+
step: "1 5",
|
|
95
|
+
repeat: "6 3"
|
|
93
96
|
};
|
|
94
97
|
/** A bar's corners, clockwise from the top left: rounded at its data end, square where it stands. */
|
|
95
98
|
function roundedEnd(end) {
|
|
@@ -147,6 +150,12 @@ function signPaint(sign, measure, own) {
|
|
|
147
150
|
if (way === 0) return MUTED;
|
|
148
151
|
return way > 0 ? GOOD : BAD;
|
|
149
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Whether each colour repeats one an earlier thing wears: past the palette, such a thing wears
|
|
155
|
+
* a second cue, its line dashed or its shape hollow (`MARK.repeat`), so no two things are told
|
|
156
|
+
* apart by colour alone. Other's grey tells nothing apart, and is never cued.
|
|
157
|
+
*/
|
|
158
|
+
const repeatsOf = (paints) => paints.map((paint, i) => paint !== "--dd-other" && paints.indexOf(paint) < i);
|
|
150
159
|
/** The palette's colour at a place. */
|
|
151
160
|
const seriesPaint = (place) => `--dd-series-${String(placeOf(place) + 1)}`;
|
|
152
161
|
/**
|
|
@@ -184,7 +193,7 @@ const slotted = (thing) => thing.other !== true && thing.slot !== void 0;
|
|
|
184
193
|
* value the model declares before one placed later, whatever order they are drawn in) and the
|
|
185
194
|
* other takes the first place still free, as a thing with no slot does when `all` are placed.
|
|
186
195
|
* A thing with its own colour still holds its slot's place, so no other is given the colour
|
|
187
|
-
* it would have worn. Only past the palette's six do two things share a colour. The same rule
|
|
196
|
+
* it would have worn. Only past the palette's six do two things share a colour, and then the later wears a second cue (`repeatsOf`). The same rule
|
|
188
197
|
* as the dashboards' own tiles, so a value wears one colour on every tile.
|
|
189
198
|
*/
|
|
190
199
|
function placesOf(things, all) {
|
|
@@ -244,4 +253,4 @@ const THEMES = {
|
|
|
244
253
|
"--dd-series-6": "#d5dcf7"
|
|
245
254
|
}
|
|
246
255
|
};
|
|
247
|
-
export { INK, LINE, MARK, MUTED, OTHER, PALETTE, RULE, SPACE, SURFACE, TEXT, THEMES, ownPaint, paintAt, paintsOf, roundedEnd, seriesPaint, signPaint };
|
|
256
|
+
export { INK, LINE, MARK, MUTED, OTHER, PALETTE, RULE, SPACE, SURFACE, TEXT, THEMES, ownPaint, paintAt, paintsOf, repeatsOf, roundedEnd, seriesPaint, signPaint };
|
|
@@ -17,6 +17,26 @@ export type ChartProps = {
|
|
|
17
17
|
draw: (env: Env) => Scene;
|
|
18
18
|
/** The chart's height in pixels; the box's own height when left out. */
|
|
19
19
|
height?: number;
|
|
20
|
+
/**
|
|
21
|
+
* As tall as its picture asks. A chart of rows lying down (ranked bars, a funnel, a grid)
|
|
22
|
+
* says how tall it is with every row at its fullest and none left out (`Scene.natural`); told
|
|
23
|
+
* to fit, its stage is that tall, up to the most a tile grows (`--dd-fit-most`, 560 pixels
|
|
24
|
+
* unless a theme says otherwise), past which its rows close up and then are counted. The box
|
|
25
|
+
* then says so (`data-fit="content"`), for whatever sizes itself by what it holds. Small
|
|
26
|
+
* multiples say how tall a panel for every series is, and fit the same way. A chart that
|
|
27
|
+
* fills any height it is given (a line, columns or an area over time) asks for none and still
|
|
28
|
+
* fills its box, as does one with no room to draw a row. A `height` given is kept, and `fit`
|
|
29
|
+
* then does nothing. A chart told to fit is always measured, with a `width` given too: its
|
|
30
|
+
* most is the theme's to say, so a server writes its box at the height asked for, with the
|
|
31
|
+
* chart's words in it, and the picture comes in the browser. So that its box is that tall before
|
|
32
|
+
* it is measured, `draw` is first asked only for the height (`env.sizing`), which a chart of
|
|
33
|
+
* rows answers without laying a row out; pass `fit` for a chart of rows, since any other is
|
|
34
|
+
* laid out once more for nothing. The height is asked at the `width` given, or a usual tile's
|
|
35
|
+
* (640) until the box is measured: a grid of more rows than its cells allow at its real width
|
|
36
|
+
* asks again once measured, and is laid out a second time, as small multiples are whose real
|
|
37
|
+
* width gives another number of panels across.
|
|
38
|
+
*/
|
|
39
|
+
fit?: boolean;
|
|
20
40
|
/**
|
|
21
41
|
* A fixed width in pixels: for tests and pictures made off screen. With `height` too, the box
|
|
22
42
|
* is not measured at all, and a server draws the picture; alone, it stands for the measured
|
|
@@ -1,73 +1,14 @@
|
|
|
1
|
+
import { boxOf, stageOf } from "./box.mjs";
|
|
1
2
|
import { useChartEvents } from "./events.mjs";
|
|
2
3
|
import { LitLayer } from "./Overlay.mjs";
|
|
3
4
|
import { offers, opensAny, spokenOf } from "./opens.mjs";
|
|
4
5
|
import { Picture } from "./Picture.mjs";
|
|
5
6
|
import { Live, SceneTable, liveText, readerStyle } from "./Reader.mjs";
|
|
6
7
|
import { useScenes } from "./useScene.mjs";
|
|
7
|
-
import { useSize } from "./useSize.mjs";
|
|
8
8
|
import { useId, useMemo, useRef } from "react";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
// src/Chart.tsx
|
|
11
11
|
/**
|
|
12
|
-
* The stage holds the picture and the layer over it, and takes the room the box has left over
|
|
13
|
-
* what is under it. No line box under the picture: an inline SVG would sit on a text baseline,
|
|
14
|
-
* a few pixels up.
|
|
15
|
-
*/
|
|
16
|
-
const STAGE = {
|
|
17
|
-
position: "relative",
|
|
18
|
-
lineHeight: 0,
|
|
19
|
-
flex: "1 1 0",
|
|
20
|
-
minHeight: 0,
|
|
21
|
-
overflow: "clip"
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* A stage with stops to move through keeps a finger's sideways drag for itself, to move the
|
|
25
|
-
* tooltip along, and leaves the page its scroll up and down and its pinch.
|
|
26
|
-
*/
|
|
27
|
-
const SCRUBBED = {
|
|
28
|
-
...STAGE,
|
|
29
|
-
touchAction: "pan-y pinch-zoom"
|
|
30
|
-
};
|
|
31
|
-
/** The stage, of a fixed height when one is given: the picture's own, not shared with what is under it. */
|
|
32
|
-
function stageOf(height, scene) {
|
|
33
|
-
const stage = (scene?.hover?.stops.length ?? 0) > 0 ? SCRUBBED : STAGE;
|
|
34
|
-
return height === void 0 ? stage : {
|
|
35
|
-
...stage,
|
|
36
|
-
flex: "none",
|
|
37
|
-
height
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* The chart's box, named as the theme names a chart (`dd-chart`): named by the summary,
|
|
42
|
-
* described by how to move through its values that open when some do, one tab stop when it has
|
|
43
|
-
* stops to move through. Its stage has its height before anything is drawn in it, so the page
|
|
44
|
-
* does not jump. It is marked drillable as the theme marks a chart (`data-drillable`: some value of it
|
|
45
|
-
* opens), and `data-opens` while the value the lit stop means opens. It is a column: the
|
|
46
|
-
* stage, then what is shown under it (a tile's note), and in a column of its own it takes the
|
|
47
|
-
* room left.
|
|
48
|
-
*/
|
|
49
|
-
function boxOf(at) {
|
|
50
|
-
const { props, described } = at;
|
|
51
|
-
const stops = at.said?.hover?.stops.length ?? 0;
|
|
52
|
-
return {
|
|
53
|
-
className: props.className === void 0 ? "dd-chart" : `dd-chart ${props.className}`,
|
|
54
|
-
"aria-label": at.said?.summary,
|
|
55
|
-
"aria-describedby": described,
|
|
56
|
-
tabIndex: stops > 0 ? 0 : void 0,
|
|
57
|
-
"data-drillable": at.drillable,
|
|
58
|
-
"data-opens": at.open,
|
|
59
|
-
style: {
|
|
60
|
-
position: "relative",
|
|
61
|
-
display: "flex",
|
|
62
|
-
flexDirection: "column",
|
|
63
|
-
flex: "1 1 auto",
|
|
64
|
-
minHeight: 0,
|
|
65
|
-
height: props.height === void 0 ? "100%" : "auto",
|
|
66
|
-
width: props.width
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
12
|
* Whether some value of the scene opens, and then the id of the instruction that describes the
|
|
72
13
|
* chart, when there is one; with nothing to open, nothing describes it.
|
|
73
14
|
*/
|
|
@@ -100,11 +41,7 @@ function useDrillable(props, scene) {
|
|
|
100
41
|
*/
|
|
101
42
|
function Chart(props) {
|
|
102
43
|
const stage = useRef(null);
|
|
103
|
-
const
|
|
104
|
-
width: props.width,
|
|
105
|
-
height: props.height
|
|
106
|
-
});
|
|
107
|
-
const { scene, said } = useScenes(props, size);
|
|
44
|
+
const { scene, said, asked } = useScenes(props, stage);
|
|
108
45
|
const { lit, stop, handlers } = useChartEvents(scene, props, stage);
|
|
109
46
|
const open = offers(props, lit, stop);
|
|
110
47
|
const spoken = spokenOf(props, lit, stop);
|
|
@@ -115,6 +52,7 @@ function Chart(props) {
|
|
|
115
52
|
...boxOf({
|
|
116
53
|
props,
|
|
117
54
|
said,
|
|
55
|
+
asked,
|
|
118
56
|
drillable,
|
|
119
57
|
open,
|
|
120
58
|
described
|
|
@@ -124,7 +62,10 @@ function Chart(props) {
|
|
|
124
62
|
/* @__PURE__ */ jsxs("div", {
|
|
125
63
|
ref: stage,
|
|
126
64
|
className: "dd-c-stage",
|
|
127
|
-
style: stageOf(props
|
|
65
|
+
style: stageOf(props, {
|
|
66
|
+
scene,
|
|
67
|
+
asked
|
|
68
|
+
}),
|
|
128
69
|
children: [/* @__PURE__ */ jsx(Picture, {
|
|
129
70
|
scene,
|
|
130
71
|
noPlot: props.noPlot,
|
|
@@ -152,7 +93,8 @@ function Chart(props) {
|
|
|
152
93
|
}),
|
|
153
94
|
/* @__PURE__ */ jsx(Live, { said: liveText(lit, stop, {
|
|
154
95
|
said: spoken,
|
|
155
|
-
noValue: props.noValue
|
|
96
|
+
noValue: props.noValue,
|
|
97
|
+
scene
|
|
156
98
|
}) }),
|
|
157
99
|
described === void 0 ? null : /* @__PURE__ */ jsx("div", {
|
|
158
100
|
id: described,
|