lintje 0.7.0 → 0.8.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/NOTICE.md +2 -0
- package/README.md +2 -2
- package/dist-elements/actions.js +1 -1
- package/dist-elements/chat.js +1 -1
- package/dist-elements/chunks/{addon-CFoSG70u.js → addon-B-nZKTVZ.js} +2 -2
- package/dist-elements/chunks/avatar-C1Wj9drG.js +1 -0
- package/dist-elements/chunks/axes-DPj3RyPk.js +129 -0
- package/dist-elements/chunks/base-lxVG98kf.js +226 -0
- package/dist-elements/chunks/chart-styles-sK3xVPFj.js +45 -0
- package/dist-elements/chunks/{date-format-5bii3QLP.js → date-format-DvDaZtFc.js} +1 -1
- package/dist-elements/chunks/{dialog-close-CzMRXkJ6.js → dialog-close-DpjJ6JbT.js} +1 -1
- package/dist-elements/chunks/disclosure-Ch2SwnkG.js +1 -0
- package/dist-elements/chunks/disclosure-o3Agc4Ji.js +20 -0
- package/dist-elements/chunks/download-C74iql1Q.js +18 -0
- package/dist-elements/chunks/{focus-trap-BDxiHED1.js → focus-trap-xGyZPSzU.js} +1 -1
- package/dist-elements/chunks/frame-BMR48Vea.js +1 -0
- package/dist-elements/chunks/{input-C7qx0e4p.js → input-C7MnFu5X.js} +4 -4
- package/dist-elements/chunks/input-CCT6CcW1.js +1 -0
- package/dist-elements/chunks/month-grid-CoYFI13w.js +26 -0
- package/dist-elements/chunks/{other-BaLStKaf.js → other-D_wlqvPA.js} +3 -3
- package/dist-elements/chunks/player-BW0tPg9_.js +39 -0
- package/dist-elements/chunks/{prose-DOF7h3je.js → prose-aNcSsHId.js} +1 -1
- package/dist-elements/chunks/search-text-i-Em9oIy.js +1 -0
- package/dist-elements/chunks/sentence-CJX3W7W5.js +3 -0
- package/dist-elements/chunks/stagger-DYloMMgF.js +27 -0
- package/dist-elements/chunks/wheel-Co2Dpj0Q.js +1 -0
- package/dist-elements/content.js +1 -1
- package/dist-elements/core.js +1 -1
- package/dist-elements/custom-elements.json +1298 -204
- package/dist-elements/data-types.json +2836 -622
- package/dist-elements/feedback.js +1 -1
- package/dist-elements/graph.d.ts +1 -0
- package/dist-elements/graph.js +1 -0
- package/dist-elements/guides/events.md +7 -3
- package/dist-elements/guides/loading.md +12 -9
- package/dist-elements/layout.js +1 -1
- package/dist-elements/lintje.js +3002 -2246
- package/dist-elements/overlays.js +1 -1
- package/dist-elements/skills/lintje/SKILL.md +26 -5
- package/dist-elements/skills/lintje/check.mjs +180 -0
- package/dist-elements/skills/lintje/reference.mjs +24 -3
- package/dist-elements/tables.js +1 -1
- package/dist-elements/tag/accordion.d.ts +1 -0
- package/dist-elements/tag/accordion.js +6 -0
- package/dist-elements/tag/activity-log.js +13 -11
- package/dist-elements/tag/ai-label.js +5 -5
- package/dist-elements/tag/announcement.js +2 -2
- package/dist-elements/tag/app-search.js +19 -19
- package/dist-elements/tag/attachment.d.ts +1 -0
- package/dist-elements/tag/attachment.js +54 -0
- package/dist-elements/tag/audio-player.js +42 -42
- package/dist-elements/tag/badge.js +1 -1
- package/dist-elements/tag/breadcrumbs.js +8 -8
- package/dist-elements/tag/button.js +1 -1
- package/dist-elements/tag/card-list.js +9 -9
- package/dist-elements/tag/card.js +41 -35
- package/dist-elements/tag/chart.js +682 -419
- package/dist-elements/tag/chat-answer.js +49 -47
- package/dist-elements/tag/chat-composer.js +100 -40
- package/dist-elements/tag/chat-message.js +16 -11
- package/dist-elements/tag/chat-questions.d.ts +1 -0
- package/dist-elements/tag/chat-questions.js +133 -0
- package/dist-elements/tag/chat-steps.d.ts +1 -0
- package/dist-elements/tag/chat-steps.js +52 -0
- package/dist-elements/tag/chat-strip.js +27 -27
- package/dist-elements/tag/chat-suggestions.js +9 -10
- package/dist-elements/tag/chat.js +70 -42
- package/dist-elements/tag/checkbox-group.js +8 -8
- package/dist-elements/tag/checkbox.js +7 -7
- package/dist-elements/tag/code.js +9 -9
- package/dist-elements/tag/combobox.js +22 -22
- package/dist-elements/tag/conflict-alert.js +7 -7
- package/dist-elements/tag/copy-button.js +9 -9
- package/dist-elements/tag/data-table.js +237 -232
- package/dist-elements/tag/date-input.js +15 -39
- package/dist-elements/tag/date-range.js +21 -46
- package/dist-elements/tag/description-list.js +21 -19
- package/dist-elements/tag/dialog.js +7 -7
- package/dist-elements/tag/document-viewer.js +23 -23
- package/dist-elements/tag/drawer.js +9 -9
- package/dist-elements/tag/empty-state.js +1 -1
- package/dist-elements/tag/error-page.js +11 -11
- package/dist-elements/tag/error-summary.js +12 -12
- package/dist-elements/tag/expander.js +5 -5
- package/dist-elements/tag/explainer.js +5 -5
- package/dist-elements/tag/field.js +4 -4
- package/dist-elements/tag/file-upload.js +32 -42
- package/dist-elements/tag/filter-bar.js +20 -20
- package/dist-elements/tag/filter-sheet.js +3 -3
- package/dist-elements/tag/filter-zone.js +15 -15
- package/dist-elements/tag/find.js +16 -16
- package/dist-elements/tag/footer.js +14 -14
- package/dist-elements/tag/form-actions.js +2 -2
- package/dist-elements/tag/form-section.js +3 -3
- package/dist-elements/tag/form.js +3 -3
- package/dist-elements/tag/gallery.js +10 -10
- package/dist-elements/tag/graph.d.ts +1 -0
- package/dist-elements/tag/graph.js +102 -0
- package/dist-elements/tag/grid-item.js +1 -1
- package/dist-elements/tag/grid.js +1 -1
- package/dist-elements/tag/hero.js +7 -7
- package/dist-elements/tag/highlight.js +4 -4
- package/dist-elements/tag/icon-button.js +1 -1
- package/dist-elements/tag/icon.js +1 -1
- package/dist-elements/tag/job-list.js +4 -4
- package/dist-elements/tag/key.d.ts +1 -0
- package/dist-elements/tag/key.js +1 -0
- package/dist-elements/tag/kpi-row.js +5 -5
- package/dist-elements/tag/kpi.js +70 -70
- package/dist-elements/tag/level-meter.js +8 -8
- package/dist-elements/tag/list.js +43 -42
- package/dist-elements/tag/log-viewer.js +68 -68
- package/dist-elements/tag/logo.js +23 -23
- package/dist-elements/tag/map.js +154 -153
- package/dist-elements/tag/menu-button.js +34 -34
- package/dist-elements/tag/modal.js +9 -9
- package/dist-elements/tag/multiselect.js +21 -22
- package/dist-elements/tag/note.js +2 -2
- package/dist-elements/tag/notifications.js +23 -23
- package/dist-elements/tag/number-input.js +18 -18
- package/dist-elements/tag/page-header.js +13 -13
- package/dist-elements/tag/pagination.js +26 -26
- package/dist-elements/tag/person-group.d.ts +1 -0
- package/dist-elements/tag/person-group.js +36 -0
- package/dist-elements/tag/person.d.ts +1 -0
- package/dist-elements/tag/person.js +11 -0
- package/dist-elements/tag/popover.js +1 -1
- package/dist-elements/tag/progress-bar.js +1 -1
- package/dist-elements/tag/prose.js +1 -1
- package/dist-elements/tag/qr-code.js +5 -5
- package/dist-elements/tag/radio-group.js +12 -12
- package/dist-elements/tag/range.js +24 -24
- package/dist-elements/tag/recording-status.js +9 -9
- package/dist-elements/tag/repeater.js +5 -5
- package/dist-elements/tag/segmented.js +8 -8
- package/dist-elements/tag/select.js +8 -8
- package/dist-elements/tag/shell.js +199 -199
- package/dist-elements/tag/skeleton.js +1 -1
- package/dist-elements/tag/slot-picker.js +15 -15
- package/dist-elements/tag/sortable-list.js +20 -20
- package/dist-elements/tag/spinner.js +1 -1
- package/dist-elements/tag/split-pane.js +9 -9
- package/dist-elements/tag/status-dot.js +1 -1
- package/dist-elements/tag/stepper.js +14 -14
- package/dist-elements/tag/streaming-text.js +13 -13
- package/dist-elements/tag/sub-nav.js +20 -20
- package/dist-elements/tag/tabs.js +37 -38
- package/dist-elements/tag/tag-input.js +28 -28
- package/dist-elements/tag/text-editor.js +25 -24
- package/dist-elements/tag/text-input.js +21 -21
- package/dist-elements/tag/textarea.js +11 -11
- package/dist-elements/tag/tile.js +1 -1
- package/dist-elements/tag/time-input.js +13 -13
- package/dist-elements/tag/toast.js +8 -8
- package/dist-elements/tag/toggle.js +5 -5
- package/dist-elements/tag/toggletip.js +6 -6
- package/dist-elements/tag/token-value.js +2 -2
- package/dist-elements/tag/tooltip.js +1 -1
- package/dist-elements/tag/transcript.js +32 -32
- package/dist-elements/tag/translator.js +6 -6
- package/dist-elements/tag/tree-view.js +22 -22
- package/dist-elements/tag/user-menu.js +37 -36
- package/dist-elements/tag/video-player.js +17 -14
- package/dist-elements/tokens.css +52 -1
- package/dist-elements/tokens.json +701 -313
- package/dist-elements/types/bundle/chat.d.ts +2 -0
- package/dist-elements/types/bundle/content.d.ts +2 -0
- package/dist-elements/types/bundle/graph.d.ts +2 -0
- package/dist-elements/types/bundle/index.d.ts +1 -1
- package/dist-elements/types/bundle/layout.d.ts +1 -0
- package/dist-elements/types/bundle/tables.d.ts +2 -0
- package/dist-elements/types/components/charts/chart/chart.d.ts +3 -12
- package/dist-elements/types/components/chat/chat/chat.d.ts +11 -2
- package/dist-elements/types/components/chat/chat-answer/chat-answer.d.ts +6 -4
- package/dist-elements/types/components/chat/chat-composer/chat-composer.d.ts +61 -4
- package/dist-elements/types/components/chat/chat-message/chat-message.d.ts +6 -2
- package/dist-elements/types/components/chat/chat-questions/chat-questions.d.ts +106 -0
- package/dist-elements/types/components/chat/chat-steps/chat-steps.d.ts +53 -0
- package/dist-elements/types/components/chat/chat-suggestions/chat-suggestions.d.ts +4 -11
- package/dist-elements/types/components/content/attachment/attachment.d.ts +58 -0
- package/dist-elements/types/components/content/audio-player/audio-player.d.ts +2 -1
- package/dist-elements/types/components/content/key/key.d.ts +21 -0
- package/dist-elements/types/components/content/prose/prose.d.ts +4 -3
- package/dist-elements/types/components/content/shared/player.d.ts +2 -1
- package/dist-elements/types/components/content/transcript/transcript.d.ts +7 -0
- package/dist-elements/types/components/content/video-player/video-player.d.ts +12 -3
- package/dist-elements/types/components/feedback/empty-state/empty-state.d.ts +2 -2
- package/dist-elements/types/components/feedback/status-dot/status-dot.d.ts +13 -2
- package/dist-elements/types/components/forms/form-actions/form-actions.d.ts +5 -2
- package/dist-elements/types/components/frame/app-search/app-search.d.ts +0 -2
- package/dist-elements/types/components/frame/user-menu/user-menu.d.ts +2 -2
- package/dist-elements/types/components/graph/graph/graph.d.ts +147 -0
- package/dist-elements/types/components/graph/graph/layout-runner.d.ts +13 -0
- package/dist-elements/types/components/graph/graph/layout-worker.d.ts +1 -0
- package/dist-elements/types/components/graph/graph/layout.d.ts +27 -0
- package/dist-elements/types/components/graph/graph/model.d.ts +81 -0
- package/dist-elements/types/components/graph/graph/routes.d.ts +62 -0
- package/dist-elements/types/components/graph/graph/view.d.ts +58 -0
- package/dist-elements/types/components/index.d.ts +20 -4
- package/dist-elements/types/components/inputs/combobox/combobox.d.ts +0 -2
- package/dist-elements/types/components/inputs/date-input/date-input.d.ts +1 -1
- package/dist-elements/types/components/inputs/date-range/date-range.d.ts +17 -6
- package/dist-elements/types/components/inputs/file-upload/file-upload.d.ts +10 -33
- package/dist-elements/types/components/inputs/multiselect/multiselect.d.ts +1 -11
- package/dist-elements/types/components/layout/accordion/accordion.d.ts +37 -0
- package/dist-elements/types/components/layout/expander/expander.d.ts +5 -1
- package/dist-elements/types/components/layout/split-pane/split-pane.d.ts +2 -0
- package/dist-elements/types/components/layout/tabs/tabs.d.ts +3 -0
- package/dist-elements/types/components/overlays/popover/popover.d.ts +7 -0
- package/dist-elements/types/components/overlays/tooltip/tooltip.d.ts +1 -1
- package/dist-elements/types/components/shared/avatar.d.ts +21 -0
- package/dist-elements/types/components/shared/charts/bar-chart/bar-chart.d.ts +3 -2
- package/dist-elements/types/components/shared/charts/dumbbell-chart/dumbbell-chart.d.ts +33 -0
- package/dist-elements/types/components/shared/charts/index.d.ts +6 -2
- package/dist-elements/types/components/shared/charts/kinds.d.ts +22 -4
- package/dist-elements/types/components/shared/charts/line-chart/line-chart.d.ts +3 -2
- package/dist-elements/types/components/shared/charts/sankey-chart/sankey-chart.d.ts +124 -0
- package/dist-elements/types/components/shared/charts/shared/axes.d.ts +33 -6
- package/dist-elements/types/components/shared/charts/shared/chart-states.d.ts +1 -1
- package/dist-elements/types/components/shared/charts/shared/chart-styles.d.ts +2 -0
- package/dist-elements/types/components/shared/charts/shared/colors.d.ts +29 -4
- package/dist-elements/types/components/shared/charts/shared/controller.d.ts +23 -3
- package/dist-elements/types/components/shared/charts/shared/forecast.d.ts +21 -0
- package/dist-elements/types/components/shared/charts/shared/plot-keys.d.ts +5 -0
- package/dist-elements/types/components/shared/charts/shared/tints.d.ts +2 -0
- package/dist-elements/types/components/shared/charts/shared/types.d.ts +146 -0
- package/dist-elements/types/components/shared/charts/shared/wheel.d.ts +11 -0
- package/dist-elements/types/components/shared/charts/treemap-chart/squarify.d.ts +16 -0
- package/dist-elements/types/components/shared/charts/treemap-chart/treemap-chart.d.ts +18 -0
- package/dist-elements/types/components/shared/charts/treemap-chart/treemap-labels.d.ts +36 -0
- package/dist-elements/types/components/shared/charts/treemap-chart/treemap-parts.d.ts +64 -0
- package/dist-elements/types/components/shared/disclosure.d.ts +5 -3
- package/dist-elements/types/components/shared/download.d.ts +28 -2
- package/dist-elements/types/components/shared/empty-state-block.d.ts +1 -1
- package/dist-elements/types/components/shared/files.d.ts +67 -0
- package/dist-elements/types/components/shared/heading.d.ts +4 -0
- package/dist-elements/types/components/shared/month-grid.d.ts +33 -0
- package/dist-elements/types/components/shared/place.d.ts +2 -2
- package/dist-elements/types/components/shared/search-text.d.ts +5 -0
- package/dist-elements/types/components/tables/activity-log/activity-log.d.ts +9 -2
- package/dist-elements/types/components/tables/card/card.d.ts +13 -2
- package/dist-elements/types/components/tables/data-table/editing.d.ts +7 -2
- package/dist-elements/types/components/tables/description-list/description-list.d.ts +4 -0
- package/dist-elements/types/components/tables/list/list.d.ts +9 -0
- package/dist-elements/types/components/tables/person/person.d.ts +35 -0
- package/dist-elements/types/components/tables/person-group/person-group.d.ts +42 -0
- package/dist-elements/types/core/format.d.ts +2 -2
- package/dist-elements/types/core/id.d.ts +2 -0
- package/dist-elements/types/icons/register.d.ts +1 -1
- package/dist-elements/types/types.d.ts +194 -15
- package/dist-elements/workers/layout-worker.js +3 -0
- package/dist-icons/functioneel-link.svg +1 -0
- package/dist-icons/functioneel-ondertiteling.svg +1 -0
- package/package.json +8 -1
- package/dist-elements/chunks/base-BsZyWDre.js +0 -226
- package/dist-elements/chunks/chart-styles-C5IzbVUF.js +0 -44
- package/dist-elements/chunks/disclosure-CQcLUnKh.js +0 -22
- package/dist-elements/chunks/disclosure-DjLQzn9n.js +0 -1
- package/dist-elements/chunks/download-CxEzwMxI.js +0 -13
- package/dist-elements/chunks/input-CazTpGUd.js +0 -1
- package/dist-elements/chunks/player-BEG3MVCm.js +0 -39
- package/dist-elements/chunks/sentence-CjgQjBP9.js +0 -3
- package/dist-elements/chunks/stagger-CwsMNTLl.js +0 -133
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sankey: how one count divides over two to four steps of a process. A step is a column of
|
|
3
|
+
* nodes, a flow a band as wide as its count between nodes of two consecutive steps. What flows
|
|
4
|
+
* is one variable, so nodes and bands take one colour, and bands may cross: one colour over
|
|
5
|
+
* itself darkens and mixes into no colour another variable has. A node is a part of the whole,
|
|
6
|
+
* a flow a part of its source. Below 768 px every transition becomes a bar per source (rule 9).
|
|
7
|
+
*/
|
|
8
|
+
import { type TemplateResult } from 'lit';
|
|
9
|
+
import type { ChartOptions } from '../shared/controller.js';
|
|
10
|
+
import type { ChartSpec } from '../shared/types.js';
|
|
11
|
+
type SankeySpec = Extract<ChartSpec, {
|
|
12
|
+
kind: 'sankey';
|
|
13
|
+
}>;
|
|
14
|
+
export interface SankeyNodeModel {
|
|
15
|
+
id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
href?: string;
|
|
18
|
+
/** The host's own count, which goes before the sum of its flows. */
|
|
19
|
+
value?: number;
|
|
20
|
+
step: number;
|
|
21
|
+
/** Its place in its step, top first. */
|
|
22
|
+
index: number;
|
|
23
|
+
/** The count it is drawn as: 0 when nothing of it is known. */
|
|
24
|
+
size: number;
|
|
25
|
+
/** No value and no known flow: it shows only its name and "geen gegevens". */
|
|
26
|
+
unknown: boolean;
|
|
27
|
+
/** Its count is a lower bound: a flow into it is missing, or one out of it with no value. */
|
|
28
|
+
atLeast: boolean;
|
|
29
|
+
/** The flows into it, in the order of their sources. */
|
|
30
|
+
inflow: SankeyFlowModel[];
|
|
31
|
+
/** The flows out of it, in the order of their targets. */
|
|
32
|
+
outflow: SankeyFlowModel[];
|
|
33
|
+
/** What no known flow out of it takes while one is missing: one hatched stub for them all. */
|
|
34
|
+
stub: number;
|
|
35
|
+
/** What ends here: neither a known flow nor the stub takes it. */
|
|
36
|
+
rest: number;
|
|
37
|
+
}
|
|
38
|
+
export interface SankeyFlowModel {
|
|
39
|
+
id: string;
|
|
40
|
+
from: SankeyNodeModel;
|
|
41
|
+
to: SankeyNodeModel;
|
|
42
|
+
/** null = no data, never 0 (rule 15). */
|
|
43
|
+
value: number | null;
|
|
44
|
+
href?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface SankeyModel {
|
|
47
|
+
steps: {
|
|
48
|
+
label: string;
|
|
49
|
+
nodes: SankeyNodeModel[];
|
|
50
|
+
}[];
|
|
51
|
+
/** The flows between consecutive steps, in the host's order; any other is left out. */
|
|
52
|
+
flows: SankeyFlowModel[];
|
|
53
|
+
/** The whole: what the first step counts. */
|
|
54
|
+
total: number;
|
|
55
|
+
/** What the host sent that the chart can only catch, for one warning in the console. */
|
|
56
|
+
problems: string[];
|
|
57
|
+
}
|
|
58
|
+
export declare function sankeyModel(spec: Pick<SankeySpec, 'steps' | 'flows'>): SankeyModel;
|
|
59
|
+
/** The height the drawing needs: the busiest step's labels and gaps, and the step names. */
|
|
60
|
+
export declare function sankeyHeight(spec: Pick<SankeySpec, 'steps'>): number;
|
|
61
|
+
/** One place the keyboard reads: a node, a flow, or the stub of a node's missing flows. */
|
|
62
|
+
export type SankeyStop = {
|
|
63
|
+
kind: 'node';
|
|
64
|
+
node: SankeyNodeModel;
|
|
65
|
+
} | {
|
|
66
|
+
kind: 'flow';
|
|
67
|
+
flow: SankeyFlowModel;
|
|
68
|
+
} | {
|
|
69
|
+
kind: 'stub';
|
|
70
|
+
node: SankeyNodeModel;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* The reading order: step by step, top to bottom, each node and then its flows out in the order
|
|
74
|
+
* of their targets, the stub once where its first missing flow stands. A flow of 0 draws no
|
|
75
|
+
* band and is read in the tooltips of its nodes.
|
|
76
|
+
*/
|
|
77
|
+
export declare function sankeyStops(model: SankeyModel): SankeyStop[];
|
|
78
|
+
export interface SankeyBand {
|
|
79
|
+
/** Top of the band at its source and at its target; `thickness` is at least 2 px. */
|
|
80
|
+
a: number;
|
|
81
|
+
b: number;
|
|
82
|
+
thickness: number;
|
|
83
|
+
x0: number;
|
|
84
|
+
/** Where the straight run after a middle step ends and the bend begins. */
|
|
85
|
+
xs: number;
|
|
86
|
+
x1: number;
|
|
87
|
+
}
|
|
88
|
+
export interface SankeyLayout {
|
|
89
|
+
width: number;
|
|
90
|
+
height: number;
|
|
91
|
+
/** px per count, one for every step. */
|
|
92
|
+
scale: number;
|
|
93
|
+
columns: number[];
|
|
94
|
+
/** The straight run after a middle step; 96 px unless the columns stand closer. */
|
|
95
|
+
strip: number;
|
|
96
|
+
/** The counts beside the names: all of them, or none when one does not fit. */
|
|
97
|
+
values: boolean;
|
|
98
|
+
node: Map<SankeyNodeModel, {
|
|
99
|
+
x: number;
|
|
100
|
+
y: number;
|
|
101
|
+
h: number;
|
|
102
|
+
slot: number;
|
|
103
|
+
slotTop: number;
|
|
104
|
+
}>;
|
|
105
|
+
band: Map<SankeyFlowModel, SankeyBand>;
|
|
106
|
+
stub: Map<SankeyNodeModel, {
|
|
107
|
+
x: number;
|
|
108
|
+
y: number;
|
|
109
|
+
h: number;
|
|
110
|
+
}>;
|
|
111
|
+
}
|
|
112
|
+
export interface LayoutInput {
|
|
113
|
+
width: number;
|
|
114
|
+
height: number;
|
|
115
|
+
/** A label's width: the name in 14 px, the count line in 12 px. */
|
|
116
|
+
nameWidth: (node: SankeyNodeModel) => number;
|
|
117
|
+
valueWidth: (node: SankeyNodeModel) => number;
|
|
118
|
+
}
|
|
119
|
+
/** Places the nodes, the bands and the stubs: one scale over all steps, within `height`. */
|
|
120
|
+
export declare function sankeyLayout(model: SankeyModel, input: LayoutInput): SankeyLayout;
|
|
121
|
+
/** The band's outline: straight from its source, then a cubic bend with its handles halfway. */
|
|
122
|
+
export declare function bandPath({ a, b, thickness: t, x0, xs, x1 }: SankeyBand): string;
|
|
123
|
+
export declare function renderSankeyChart(spec: SankeySpec, options: ChartOptions): TemplateResult;
|
|
124
|
+
export {};
|
|
@@ -11,8 +11,12 @@ export declare const MEDIAN_KEY = "reference:median";
|
|
|
11
11
|
export interface LegendItem {
|
|
12
12
|
label: string;
|
|
13
13
|
color?: string;
|
|
14
|
-
/**
|
|
15
|
-
|
|
14
|
+
/**
|
|
15
|
+
* `point`: the series' symbol alone, as a scatter plot or a map draws it; `hatch` is "no data".
|
|
16
|
+
* A forecast's keys: `dotted` its line, `open` its bar, `band` and `interval` its margin. `flow`
|
|
17
|
+
* is a sankey's flow, in its colour at the band's tint. A dumbbell's keys are its `KeyMark`s.
|
|
18
|
+
*/
|
|
19
|
+
shape?: 'square' | 'line' | 'dashed' | 'point' | 'hatch' | 'dotted' | 'open' | 'band' | 'interval' | 'flow' | KeyMark;
|
|
16
20
|
/** The shape the line carries at its end, drawn on its line marker (rule 13). */
|
|
17
21
|
symbol?: SeriesKey;
|
|
18
22
|
/** A `point` marker's shape when it is not the shape of a colour's name (a map's styled series). */
|
|
@@ -25,12 +29,21 @@ export interface LegendItem {
|
|
|
25
29
|
fixed?: boolean;
|
|
26
30
|
/** What `onToggle` receives; without it the label. */
|
|
27
31
|
key?: string;
|
|
32
|
+
/** An icon file name, drawn in the item's colour instead of a marker: a kind of node. */
|
|
33
|
+
icon?: string;
|
|
34
|
+
/** How many of it there are, after the label. */
|
|
35
|
+
count?: number;
|
|
28
36
|
}
|
|
29
37
|
/**
|
|
30
38
|
* A series' symbol as a scatter plot draws it, for a marker: its shape in `currentColor`, and a
|
|
31
|
-
*
|
|
39
|
+
* light one with its dark edge (`lineCasing`).
|
|
32
40
|
*/
|
|
33
41
|
export declare function renderSymbol(symbol: SeriesKey | undefined, color: string | undefined, centre: number, shape?: SeriesShape): SVGTemplateResult;
|
|
42
|
+
/** A dumbbell's marks as a key: the earlier moment's ring, the later one's dot, off the axis. */
|
|
43
|
+
export type KeyMark = 'ring' | 'dot' | 'off-axis';
|
|
44
|
+
/** A key mark in `currentColor` in a 14 px box; a dark-yellow dot keeps its edge (`lineCasing`). */
|
|
45
|
+
export declare function renderKeyMark(mark: KeyMark, color: string | undefined, centre: number): SVGTemplateResult;
|
|
46
|
+
export declare function isKeyMark(shape: string | undefined): shape is KeyMark;
|
|
34
47
|
export declare function renderLegend({ items, onToggle, onEmphasis, position, }: {
|
|
35
48
|
items: LegendItem[];
|
|
36
49
|
onToggle?: (label: string) => void;
|
|
@@ -58,6 +71,8 @@ export interface ChartFrameOptions {
|
|
|
58
71
|
height?: number;
|
|
59
72
|
/** Extra definitions (hatch patterns etc.). */
|
|
60
73
|
defs?: SvgSlot;
|
|
74
|
+
/** Drawn under the grid, such as the ground of a forecast. */
|
|
75
|
+
underlay?: SvgSlot;
|
|
61
76
|
zeroLine?: boolean;
|
|
62
77
|
/** How a tick is written; `axisColumn` decides between full and compact. Default full. */
|
|
63
78
|
formatTick?: (tick: number) => string;
|
|
@@ -90,12 +105,24 @@ export declare function thinLabels<T extends {
|
|
|
90
105
|
x: number;
|
|
91
106
|
anchor?: XAnchor;
|
|
92
107
|
}>(labels: T[], fontFamily?: string): T[];
|
|
93
|
-
export declare function renderChartFrame({ area, ticks, max, axisTitle, xLabels, xTitle, description, defs, zeroLine, formatTick, id, height, fontFamily, interactive, keys, }: ChartFrameOptions, children: SvgSlot): TemplateResult;
|
|
108
|
+
export declare function renderChartFrame({ area, ticks, max, axisTitle, xLabels, xTitle, description, defs, underlay, zeroLine, formatTick, id, height, fontFamily, interactive, keys, }: ChartFrameOptions, children: SvgSlot): TemplateResult;
|
|
109
|
+
/** The boundary of a forecast: one line at `x`, "Gemeten" left of it and the forecast's word right. */
|
|
110
|
+
export interface ForecastBoundary {
|
|
111
|
+
mode: 'forecast';
|
|
112
|
+
area?: PlotArea;
|
|
113
|
+
x: number;
|
|
114
|
+
/** The forecast's word, `forecastLabel`. */
|
|
115
|
+
label: string;
|
|
116
|
+
/** The resolved `--font-ui`, for measuring whether the word fits right of the line. */
|
|
117
|
+
fontFamily?: string;
|
|
118
|
+
}
|
|
94
119
|
/**
|
|
95
120
|
* The as-of marker. Up to 6 pending hours (tail) it draws nothing and the missing hours are
|
|
96
|
-
* hatched; beyond that (early) the series is cut off, with a line, a label and a note.
|
|
121
|
+
* hatched; beyond that (early) the series is cut off, with a line, a label and a note. A
|
|
122
|
+
* forecast's boundary (`mode: 'forecast'`) always draws, with its two words above the plot.
|
|
97
123
|
*/
|
|
98
|
-
export declare function renderAsOfMarker(
|
|
124
|
+
export declare function renderAsOfMarker(options: ForecastBoundary | {
|
|
125
|
+
mode?: 'as-of';
|
|
99
126
|
area?: PlotArea;
|
|
100
127
|
index: number;
|
|
101
128
|
count: number;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* with the shared blocks. The skeleton writes the markup of `lintje-skeleton`, not its CSS.
|
|
4
4
|
*/
|
|
5
5
|
import { type TemplateResult } from 'lit';
|
|
6
|
-
export type ChartSkeletonKind = 'line' | 'bar' | 'pie' | 'donut' | 'heatmap' | 'map' | 'table';
|
|
6
|
+
export type ChartSkeletonKind = 'line' | 'bar' | 'pie' | 'donut' | 'heatmap' | 'map' | 'table' | 'treemap';
|
|
7
7
|
/**
|
|
8
8
|
* Loading skeleton in the shape of the chart, exactly `height` tall so the tile keeps its size.
|
|
9
9
|
* Inside a tile's `loading` slot the tile's region speaks (`status: false`); on its own it is
|
|
@@ -6,5 +6,7 @@ import { type CSSResult } from 'lit';
|
|
|
6
6
|
export declare const chartFrameStyles: CSSResult;
|
|
7
7
|
export declare const pieChartStyles: CSSResult;
|
|
8
8
|
export declare const heatmapStyles: CSSResult;
|
|
9
|
+
export declare const treemapStyles: CSSResult;
|
|
10
|
+
export declare const sankeyStyles: CSSResult;
|
|
9
11
|
/** Everything a chart needs, in one list; the map adds `mapStyles`. */
|
|
10
12
|
export declare const chartStyles: CSSResult[];
|
|
@@ -1,12 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart colors as a host names them: a variable name becomes its token, anything else is
|
|
3
|
+
* already a CSS color and passes through. No color stays no color.
|
|
4
|
+
*/
|
|
5
|
+
import { type DataColor } from '../../../../tokens/colors.js';
|
|
1
6
|
import type { ChartColor } from './types.js';
|
|
2
7
|
/** What a figure draws when its data names no colour; the stylesheets name the same token. */
|
|
3
8
|
export declare const DEFAULT_SERIES_COLOR = "var(--color-chart-default)";
|
|
4
|
-
|
|
9
|
+
/** The data colours white text reaches 4.5:1 on; any other named fill but the rest takes ink. */
|
|
10
|
+
export declare const DARK_FILLS: ReadonlySet<string>;
|
|
5
11
|
/**
|
|
6
|
-
*
|
|
7
|
-
* the
|
|
8
|
-
* edge melts into the line.
|
|
12
|
+
* Whether text on rung `rung` (0 is the colour itself) of a variable's ladder is white: only on
|
|
13
|
+
* the darkest rung of a dark colour; every lighter rung takes ink.
|
|
9
14
|
*/
|
|
15
|
+
export declare function whiteOnRung(color: ChartColor | undefined, rung: number): boolean;
|
|
16
|
+
export declare function chartColor(color: ChartColor | undefined): string | undefined;
|
|
17
|
+
/** The edge under a line, a point or a legend shape in `color`, if that colour needs one. */
|
|
10
18
|
export declare function lineCasing(color: string | undefined): string | undefined;
|
|
19
|
+
/** The text a label on a fill takes: white, ink, or none where neither reaches 4.5:1. */
|
|
20
|
+
export type LabelInk = 'white' | 'ink' | null;
|
|
21
|
+
type Rungs = readonly [LabelInk, LabelInk, LabelInk, LabelInk, LabelInk];
|
|
22
|
+
/**
|
|
23
|
+
* Which text reaches 4.5:1 on each step of each data colour's ladder: step 1 is the colour, 2–5
|
|
24
|
+
* its tints, as `tintSteps` spreads them. Where neither does (`null`), the fill carries no label;
|
|
25
|
+
* its tooltip and table still name it. `colour-scheme.test.ts` checks every cell.
|
|
26
|
+
*/
|
|
27
|
+
export declare const LABEL_INK: Readonly<Record<DataColor, Rungs>>;
|
|
28
|
+
/**
|
|
29
|
+
* The ink of a label on step `step` of `color`'s ladder; without a colour, the default's. Any
|
|
30
|
+
* other fill a host names (a role, a CSS colour) is light and takes ink.
|
|
31
|
+
*/
|
|
32
|
+
export declare function labelInk(color: string | undefined, step?: number): LabelInk;
|
|
33
|
+
/** The class of a label drawn on a mark in that ink. */
|
|
34
|
+
export declare function insideLabelClass(ink: Exclude<LabelInk, null>): string;
|
|
11
35
|
/** The colour of a map point's series; colour names only. */
|
|
12
36
|
export declare function seriesColor(series: string | undefined): string | undefined;
|
|
37
|
+
export {};
|
|
@@ -2,6 +2,7 @@ import { type PlotArea } from './scale.js';
|
|
|
2
2
|
import type { LeafletSurface } from '../map-chart/leaflet.js';
|
|
3
3
|
import type { ChartSelection } from './mark-select.js';
|
|
4
4
|
import type { SeriesKey } from './series-shapes.js';
|
|
5
|
+
import type { KeyMark } from './axes.js';
|
|
5
6
|
import type { MapArea, MapTool } from './types.js';
|
|
6
7
|
/** What every `render*` takes besides its data. */
|
|
7
8
|
export interface ChartOptions {
|
|
@@ -38,11 +39,22 @@ export interface TooltipRow {
|
|
|
38
39
|
divider?: boolean;
|
|
39
40
|
/** The series' shape instead of a square swatch, as its legend draws it. */
|
|
40
41
|
symbol?: SeriesKey;
|
|
41
|
-
/**
|
|
42
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Instead of a square swatch, as its legend draws it: a line, plain or dashed (a norm), or
|
|
44
|
+
* dotted (a forecast); an open square for a forecast bar; a dumbbell's ring or dot.
|
|
45
|
+
*/
|
|
46
|
+
marker?: 'line' | 'dashed' | 'dotted' | 'open' | KeyMark;
|
|
47
|
+
/** A quieter line under the row before it, such as a forecast's margin. */
|
|
48
|
+
note?: boolean;
|
|
49
|
+
/** A muted word after the value, such as "buiten de as". */
|
|
50
|
+
aside?: string;
|
|
43
51
|
}
|
|
44
52
|
export interface TooltipContent {
|
|
53
|
+
/** A line above the title, in the muted text: what the title is part of. */
|
|
54
|
+
kicker?: string;
|
|
45
55
|
title: string;
|
|
56
|
+
/** A word after the title in the muted colour, such as "raming". */
|
|
57
|
+
note?: string;
|
|
46
58
|
rows: TooltipRow[];
|
|
47
59
|
/** The events at this category, under the values: their number and text. */
|
|
48
60
|
events?: {
|
|
@@ -54,6 +66,10 @@ export interface TooltipState {
|
|
|
54
66
|
x: number;
|
|
55
67
|
y: number;
|
|
56
68
|
content: TooltipContent;
|
|
69
|
+
/** `left` stands the tooltip left of `x`, for a mark whose right side carries its label. */
|
|
70
|
+
side?: 'left';
|
|
71
|
+
/** Where the tooltip ends when it does not fit right of `x`; centred when it fits neither. */
|
|
72
|
+
flip?: number;
|
|
57
73
|
}
|
|
58
74
|
/** What the chart asks the controller to watch; set by the chart, not by the host. */
|
|
59
75
|
export interface MeasureSpec {
|
|
@@ -82,6 +98,8 @@ export declare class ChartController {
|
|
|
82
98
|
emphasis: string | null;
|
|
83
99
|
/** The layers of a stacked map switched off in its legend, by their place in the stack. */
|
|
84
100
|
hiddenLayers: number[];
|
|
101
|
+
/** The parts a treemap on a phone shows opened, by their id. */
|
|
102
|
+
openParts: string[];
|
|
85
103
|
selectedCell: {
|
|
86
104
|
row: number;
|
|
87
105
|
column: number;
|
|
@@ -149,7 +167,8 @@ export declare class ChartController {
|
|
|
149
167
|
*/
|
|
150
168
|
showTooltip(event: MouseEvent, content: TooltipContent, from?: Element): void;
|
|
151
169
|
/** The tooltip at a place relative to the `data-tooltip-anchor`: the keyboard's way in. */
|
|
152
|
-
|
|
170
|
+
/** `place`: `left` stands it left of `x`; a number is where it ends when it does not fit right. */
|
|
171
|
+
showTooltipAt(x: number, y: number, content: TooltipContent, place?: 'left' | number): void;
|
|
153
172
|
hideTooltip(): void;
|
|
154
173
|
hoverAt(index: number | null, event?: MouseEvent, content?: TooltipContent): void;
|
|
155
174
|
/**
|
|
@@ -162,6 +181,7 @@ export declare class ChartController {
|
|
|
162
181
|
private watchEscape;
|
|
163
182
|
private unwatchEscape;
|
|
164
183
|
toggleLayer(index: number): void;
|
|
184
|
+
toggleOpen(id: string): void;
|
|
165
185
|
emphasise(label: string | null): void;
|
|
166
186
|
toggleSeries(label: string): void;
|
|
167
187
|
private read;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TooltipRow } from './controller.js';
|
|
2
|
+
import type { ChartForecast } from './types.js';
|
|
3
|
+
export declare const FORECAST_LABEL = "Raming";
|
|
4
|
+
export declare const INTERVAL_LABEL = "Marge";
|
|
5
|
+
/** The room above the plot for "Gemeten" and the forecast's word, over the boundary. */
|
|
6
|
+
export declare const FORECAST_ROOM = 16;
|
|
7
|
+
/** The first forecast index, or `null` when `forecastFrom` names no point after the first. */
|
|
8
|
+
export declare function forecastStart(from: number | undefined, count: number): number | null;
|
|
9
|
+
/** The bounds at a point; a missing one is `null`. */
|
|
10
|
+
export declare function boundsAt(forecast: ChartForecast | undefined, index: number): {
|
|
11
|
+
low: number | null;
|
|
12
|
+
high: number | null;
|
|
13
|
+
};
|
|
14
|
+
/** Whether the margin shows anywhere: a forecast point with both bounds. */
|
|
15
|
+
export declare function hasInterval(forecast: ChartForecast | undefined, from: number, count: number): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The tooltip's line under a forecast value: low – high, the one bound there is, or no margin.
|
|
18
|
+
*/
|
|
19
|
+
export declare function intervalRow(forecast: ChartForecast, index: number): TooltipRow;
|
|
20
|
+
/** Every bound of the margin, for the scale. */
|
|
21
|
+
export declare function intervalValues(forecast: ChartForecast | undefined): number[];
|
|
@@ -10,6 +10,11 @@ export interface PlotPoint {
|
|
|
10
10
|
x: number;
|
|
11
11
|
y: number;
|
|
12
12
|
content: TooltipContent;
|
|
13
|
+
/** What the status region says instead of the tooltip read as one sentence. */
|
|
14
|
+
sentence?: string;
|
|
15
|
+
side?: 'left';
|
|
16
|
+
/** Where the tooltip ends when it does not fit right of `x` (`TooltipState.flip`). */
|
|
17
|
+
flip?: number;
|
|
13
18
|
}
|
|
14
19
|
/** What the drawing (the `<svg>`) takes. */
|
|
15
20
|
export interface PlotKeys {
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
/** The steps of the ladder (1 the colour itself, 2–5 its tints) for `n` parts, darkest first. */
|
|
2
|
+
export declare function tintSteps(n: number): readonly number[];
|
|
1
3
|
/** The tint tokens for `n` parts of one variable, darkest first. */
|
|
2
4
|
export declare function tintsFor(n: number, color?: string): string[];
|
|
@@ -21,6 +21,19 @@ export interface LineSeriesData {
|
|
|
21
21
|
color?: ChartColor;
|
|
22
22
|
comparison?: boolean;
|
|
23
23
|
area?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The margin around the forecast, one bound per label, `null` before `forecastFrom`. The
|
|
26
|
+
* forecast values themselves are in `values`. A comparison has no forecast: this is ignored.
|
|
27
|
+
*/
|
|
28
|
+
forecast?: ChartForecast;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The margin of a forecast: a lower and an upper bound per label, `null` where there is none.
|
|
32
|
+
* A point with one bound only has no margin; the tooltip names that bound.
|
|
33
|
+
*/
|
|
34
|
+
export interface ChartForecast {
|
|
35
|
+
low?: (number | null)[];
|
|
36
|
+
high?: (number | null)[];
|
|
24
37
|
}
|
|
25
38
|
/**
|
|
26
39
|
* Something that happened at a category. The chart numbers its events 1, 2, … from left to
|
|
@@ -73,6 +86,16 @@ export type ChartSpec = {
|
|
|
73
86
|
small?: boolean;
|
|
74
87
|
/** Events: a numbered square above their category, listed with their text under the chart. */
|
|
75
88
|
events?: ChartEvent[];
|
|
89
|
+
/**
|
|
90
|
+
* The index in `labels` of the first forecast point: before it everything is measured.
|
|
91
|
+
* Dotted from the last measured point on, with its margin. With it `asOfIndex`, `asOfLabel`
|
|
92
|
+
* and `pendingHours` do not apply. At 0 or less, or past the labels, there is no forecast.
|
|
93
|
+
*/
|
|
94
|
+
forecastFrom?: number;
|
|
95
|
+
/** The word in the legend and above the forecast. Default "Raming". */
|
|
96
|
+
forecastLabel?: string;
|
|
97
|
+
/** The margin's name in the legend, as given ("Marge 80 %"). Default "Marge". */
|
|
98
|
+
intervalLabel?: string;
|
|
76
99
|
} | {
|
|
77
100
|
kind: 'bar';
|
|
78
101
|
labels: string[];
|
|
@@ -85,6 +108,17 @@ export type ChartSpec = {
|
|
|
85
108
|
small?: boolean;
|
|
86
109
|
/** One entry per value: the drilldown of that bar, or null. */
|
|
87
110
|
links?: (ChartLink | null)[];
|
|
111
|
+
/**
|
|
112
|
+
* The index in `labels` of the first forecast bar: it and those after it are open. At 0 or
|
|
113
|
+
* less, or past the labels, there is no forecast.
|
|
114
|
+
*/
|
|
115
|
+
forecastFrom?: number;
|
|
116
|
+
/** The margin of the forecast bars, `null` before `forecastFrom`. */
|
|
117
|
+
forecast?: ChartForecast;
|
|
118
|
+
/** The word in the legend and above the forecast. Default "Raming". */
|
|
119
|
+
forecastLabel?: string;
|
|
120
|
+
/** The margin's name in the legend, as given ("Marge 80 %"). Default "Marge". */
|
|
121
|
+
intervalLabel?: string;
|
|
88
122
|
} | {
|
|
89
123
|
kind: 'horizontal-bar';
|
|
90
124
|
rows: {
|
|
@@ -263,7 +297,99 @@ export type ChartSpec = {
|
|
|
263
297
|
/** The value under each axis name; with one layer only (all or nothing). Default true. */
|
|
264
298
|
dataLabels?: boolean;
|
|
265
299
|
small?: boolean;
|
|
300
|
+
} | {
|
|
301
|
+
kind: 'dumbbell';
|
|
302
|
+
/** The rows in the host's order; the chart never sorts them. */
|
|
303
|
+
rows: DumbbellRow[];
|
|
304
|
+
/** The earlier moment ('2024'): a grey ring, in the legend, the tooltip and the table. */
|
|
305
|
+
fromLabel: string;
|
|
306
|
+
/** The later moment ('2026'): a dot in `color`. */
|
|
307
|
+
toLabel: string;
|
|
308
|
+
/** The later moment's colour; without it the default chart colour. */
|
|
309
|
+
color?: ChartColor;
|
|
310
|
+
/**
|
|
311
|
+
* The ends of the axis. A dumbbell carries a position, not a length, so the axis may be
|
|
312
|
+
* shortened; without them it runs from 0 to a round value above the data and the norm.
|
|
313
|
+
* A value outside stands on the edge with an off-axis mark and never stretches the axis.
|
|
314
|
+
*/
|
|
315
|
+
min?: number;
|
|
316
|
+
max?: number;
|
|
317
|
+
unit?: string;
|
|
318
|
+
/** A vertical norm, dashed in the emphasis colour. */
|
|
319
|
+
threshold?: number;
|
|
320
|
+
thresholdLabel?: string;
|
|
321
|
+
} | {
|
|
322
|
+
kind: 'treemap';
|
|
323
|
+
/** The parts of the whole, in any order: the chart sorts them, the largest top left. */
|
|
324
|
+
parts: TreemapPart[];
|
|
325
|
+
/** The variable the whole divides: its parts take this colour's tints. Default sky blue. */
|
|
326
|
+
color?: ChartColor;
|
|
327
|
+
/** What the value is, in the tooltip, the table and the CSV, e.g. "Uitgaven". Default "Waarde". */
|
|
328
|
+
label?: string;
|
|
329
|
+
/** The unit in the total line, the tooltip, the table and the CSV, e.g. "mld euro". */
|
|
330
|
+
unit?: string;
|
|
331
|
+
/** Name and amount in the areas, as far as they fit. Off: no label at all. Default true. */
|
|
332
|
+
dataLabels?: boolean;
|
|
333
|
+
/** Header of the table's first column: what the parts are. Default "Deel". */
|
|
334
|
+
labelHeader?: string;
|
|
335
|
+
small?: boolean;
|
|
336
|
+
} | {
|
|
337
|
+
kind: 'sankey';
|
|
338
|
+
/** The steps of the process, left to right: two to four, with up to six nodes each. */
|
|
339
|
+
steps: SankeyStep[];
|
|
340
|
+
flows: SankeyFlow[];
|
|
341
|
+
/** What flows, in the legend, the tooltip and the table, such as "Aanvragen". Default "Aantal". */
|
|
342
|
+
label?: string;
|
|
343
|
+
/** The variable that flows: one colour for nodes and bands. Default sky blue. */
|
|
344
|
+
color?: ChartColor;
|
|
345
|
+
unit?: string;
|
|
346
|
+
/** The share beside the count in the labels. Default true. */
|
|
347
|
+
share?: boolean;
|
|
348
|
+
/** The least height is `--chart-h-small`; the busiest step still makes it taller. */
|
|
349
|
+
small?: boolean;
|
|
266
350
|
};
|
|
351
|
+
/**
|
|
352
|
+
* A node of a sankey: one category of one step. Its `id` is unique over all steps; with a
|
|
353
|
+
* `href` it is clickable, like a slice of a pie.
|
|
354
|
+
*/
|
|
355
|
+
export interface SankeyNode {
|
|
356
|
+
id: string;
|
|
357
|
+
label: string;
|
|
358
|
+
href?: string;
|
|
359
|
+
/**
|
|
360
|
+
* Its own count, which goes before the sum of its flows. Needed in the first step when a flow
|
|
361
|
+
* out of it is missing: the part no known flow takes is then drawn as one hatched stub.
|
|
362
|
+
*/
|
|
363
|
+
value?: number;
|
|
364
|
+
}
|
|
365
|
+
/** A step of a sankey: its name above the column and its nodes, top to bottom. */
|
|
366
|
+
export interface SankeyStep {
|
|
367
|
+
label: string;
|
|
368
|
+
nodes: SankeyNode[];
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* A flow of a sankey between nodes of two consecutive steps; one that skips a step or names an
|
|
372
|
+
* unknown node is left out, also from the table. `value: null` is no data, never 0 (rule 15).
|
|
373
|
+
*/
|
|
374
|
+
export interface SankeyFlow {
|
|
375
|
+
from: string;
|
|
376
|
+
to: string;
|
|
377
|
+
value: number | null;
|
|
378
|
+
/** The identity a click carries; without it `from→to`. */
|
|
379
|
+
id?: string;
|
|
380
|
+
href?: string;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* One row of a dumbbell chart: one measure at two moments. `null` is no data, never 0 (rule
|
|
384
|
+
* 15); with a `href` the row is clickable, as a row of horizontal bars is.
|
|
385
|
+
*/
|
|
386
|
+
export interface DumbbellRow {
|
|
387
|
+
label: string;
|
|
388
|
+
from: number | null;
|
|
389
|
+
to: number | null;
|
|
390
|
+
id?: string;
|
|
391
|
+
href?: string;
|
|
392
|
+
}
|
|
267
393
|
/**
|
|
268
394
|
* A layer of a radar chart: one value per axis, `null` for no data (rule 15). Without a colour
|
|
269
395
|
* the layers take the data colours in their order; a comparison is grey and dashed.
|
|
@@ -274,6 +400,26 @@ export interface RadarSeriesData {
|
|
|
274
400
|
color?: ChartColor;
|
|
275
401
|
comparison?: boolean;
|
|
276
402
|
}
|
|
403
|
+
/**
|
|
404
|
+
* A part of a treemap's whole. A part with `parts` is their sum: its own `value` is ignored, and
|
|
405
|
+
* it is missing when all of them are. A click anywhere in it chooses the part, with its `href`.
|
|
406
|
+
*/
|
|
407
|
+
export interface TreemapPart {
|
|
408
|
+
label: string;
|
|
409
|
+
/** null = no data, never 0 (rule 15): no area, "Geen gegevens" in the legend. */
|
|
410
|
+
value?: number | null;
|
|
411
|
+
id?: string;
|
|
412
|
+
href?: string;
|
|
413
|
+
/** Its sub-parts, one level deep: they share its tint and are never a choice of their own. */
|
|
414
|
+
parts?: TreemapSubPart[];
|
|
415
|
+
}
|
|
416
|
+
/** A sub-part of a treemap's part: no parts and no `href` of its own. */
|
|
417
|
+
export interface TreemapSubPart {
|
|
418
|
+
label: string;
|
|
419
|
+
/** null = no data, never 0 (rule 15). */
|
|
420
|
+
value: number | null;
|
|
421
|
+
id?: string;
|
|
422
|
+
}
|
|
277
423
|
export type ChartKind = ChartSpec['kind'];
|
|
278
424
|
/**
|
|
279
425
|
* What a map draws. `polygons` are areas that carry their own outline (`MapValue.polygon`);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wheel on a drawing that zooms, the map's and the graph's: it zooms only with Ctrl or ⌘,
|
|
3
|
+
* and without them it scrolls the page and a hint says how.
|
|
4
|
+
*/
|
|
5
|
+
/** How long the hint stays after the last wheel. */
|
|
6
|
+
export declare const HINT_MS = 1500;
|
|
7
|
+
/** A pinch on a trackpad arrives as a wheel with Ctrl, on every platform. */
|
|
8
|
+
export declare function zoomsWith(event: WheelEvent): boolean;
|
|
9
|
+
/** Doublings of the zoom a wheel asks for; lines and pages are turned into pixels. */
|
|
10
|
+
export declare function wheelDoublings(event: WheelEvent): number;
|
|
11
|
+
export declare function hintText(): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The squarified treemap layout (Bruls, Huizing and Van Wijk): the values fill the box in rows
|
|
3
|
+
* along its short side, each row as square as it can be. The first value lies top left. Pure:
|
|
4
|
+
* the same values in the same box give the same rectangles.
|
|
5
|
+
*/
|
|
6
|
+
export interface TreemapRect {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* One rectangle per value, in their order, together exactly the box. A value that is not
|
|
14
|
+
* positive has no area: its rectangle is empty, at the box's corner.
|
|
15
|
+
*/
|
|
16
|
+
export declare function squarify(values: readonly number[], box: TreemapRect): TreemapRect[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Treemap: the parts of one whole on one moment, each an area in proportion to its value, the
|
|
3
|
+
* largest top left, with their sub-parts inside them. The parts take the tints of one variable;
|
|
4
|
+
* a sub-part shares its part's tint and is told apart by a line, never by a colour of its own.
|
|
5
|
+
* Parts under 1 % of the whole fold into one grey "Overig" that is not clickable. With two levels
|
|
6
|
+
* the part is the click target. Below 768 px the whole becomes one strip over a row per part
|
|
7
|
+
* (rule 9).
|
|
8
|
+
*/
|
|
9
|
+
import { type TemplateResult } from 'lit';
|
|
10
|
+
import type { ChartOptions } from '../shared/controller.js';
|
|
11
|
+
import type { ChartSpec } from '../shared/types.js';
|
|
12
|
+
export { squarify } from './squarify.js';
|
|
13
|
+
export { fitLabel } from './treemap-labels.js';
|
|
14
|
+
export { treemapModel, treemapRows } from './treemap-parts.js';
|
|
15
|
+
type TreemapSpec = Extract<ChartSpec, {
|
|
16
|
+
kind: 'treemap';
|
|
17
|
+
}>;
|
|
18
|
+
export declare function renderTreemapChart(spec: TreemapSpec, options: ChartOptions): TemplateResult;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an area of a treemap says of itself: as much as fits, in a fixed order of fallbacks, and
|
|
3
|
+
* nothing where not even four letters of its name do. The full name and amount are always in the
|
|
4
|
+
* tooltip and the table.
|
|
5
|
+
*/
|
|
6
|
+
export interface LabelLine {
|
|
7
|
+
text: string;
|
|
8
|
+
size: 14 | 12;
|
|
9
|
+
bold: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** The width of a text in px at a size and weight. */
|
|
12
|
+
export type Measure = (text: string, size: number, bold: boolean) => number;
|
|
13
|
+
export interface LabelText {
|
|
14
|
+
name: string;
|
|
15
|
+
/** The amount, formatted. */
|
|
16
|
+
amount: string;
|
|
17
|
+
/** The share of the whole, formatted; a part shows it, a sub-part does not. */
|
|
18
|
+
share?: string;
|
|
19
|
+
}
|
|
20
|
+
/** From the area's edge to its text. */
|
|
21
|
+
export declare const LABEL_PAD = 8;
|
|
22
|
+
/** The height of a line of text, per size. */
|
|
23
|
+
export declare const LINE_HEIGHT: {
|
|
24
|
+
readonly 14: 18;
|
|
25
|
+
readonly 12: 16;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The label of an area of `width` by `height`: for a part (`share` given) its name in 14 px bold
|
|
29
|
+
* with amount and share under it, then the same in 12 px, then without the share, then the name
|
|
30
|
+
* alone; for a sub-part its name in 12 px and the amount in bold, then the name alone. Last, the
|
|
31
|
+
* name cut short with the amount if that fits. Empty where four letters do not fit.
|
|
32
|
+
*/
|
|
33
|
+
export declare function fitLabel(label: LabelText, box: {
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
}, measure: Measure): LabelLine[];
|