pivotkit-report 0.0.0-stage → 0.2.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 +88 -0
- package/LICENSE +21 -0
- package/README.md +44 -2
- package/package.json +78 -4
- package/src/default-template.js +33 -0
- package/src/html-table.js +104 -0
- package/src/index.js +24 -0
- package/src/operations.js +808 -0
- package/src/render.js +279 -0
- package/src/report-css.js +61 -0
- package/src/svg.js +170 -0
- package/src/template.js +324 -0
- package/src/texts.js +63 -0
- package/src/tokens.js +180 -0
- package/types/default-template.d.ts +2 -0
- package/types/html-table.d.ts +36 -0
- package/types/index.d.ts +13 -0
- package/types/operations.d.ts +362 -0
- package/types/render.d.ts +177 -0
- package/types/report-css.d.ts +14 -0
- package/types/svg.d.ts +39 -0
- package/types/template.d.ts +37 -0
- package/types/texts.d.ts +44 -0
- package/types/tokens.d.ts +114 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/** The light theme: print, and a screen in light mode. */
|
|
2
|
+
export declare const LIGHT_TOKENS: Readonly<{
|
|
3
|
+
"--pk-surface": "#ffffff";
|
|
4
|
+
"--pk-surface-2": "#f6f7f9";
|
|
5
|
+
"--pk-surface-raised": "#ffffff";
|
|
6
|
+
"--pk-text": "#1a1d23";
|
|
7
|
+
"--pk-muted": "#5a6270";
|
|
8
|
+
"--pk-border": "#dde1e7";
|
|
9
|
+
"--pk-border-strong": "#c3c9d2";
|
|
10
|
+
"--pk-grid": "#edf0f3";
|
|
11
|
+
"--pk-total": "#eef1f5";
|
|
12
|
+
"--pk-total-strong": "#e9edf3";
|
|
13
|
+
"--pk-shadow": "0 1px 2px rgb(16 24 40 / 0.06), 0 4px 12px rgb(16 24 40 / 0.08)";
|
|
14
|
+
"--pk-heat-low": "#eaf1fb";
|
|
15
|
+
"--pk-heat-high": "#2a78d6";
|
|
16
|
+
"--pk-scale-low": "var(--pk-heat-low)";
|
|
17
|
+
"--pk-scale-high": "var(--pk-heat-high)";
|
|
18
|
+
"--pk-chart-1": "#2a78d6";
|
|
19
|
+
"--pk-chart-2": "#eb6834";
|
|
20
|
+
"--pk-chart-3": "#1baf7a";
|
|
21
|
+
"--pk-chart-4": "#eda100";
|
|
22
|
+
"--pk-chart-5": "#e87ba4";
|
|
23
|
+
"--pk-chart-6": "#008300";
|
|
24
|
+
"--pk-chart-7": "#6250d6";
|
|
25
|
+
"--pk-chart-8": "#e34948";
|
|
26
|
+
}>;
|
|
27
|
+
/** The dark theme, for a report read on a screen in dark mode (never printed: print is light). */
|
|
28
|
+
export declare const DARK_TOKENS: Readonly<{
|
|
29
|
+
"--pk-surface": "#16181d";
|
|
30
|
+
"--pk-surface-2": "#1c1f25";
|
|
31
|
+
"--pk-surface-raised": "#22262d";
|
|
32
|
+
"--pk-text": "#e8eaef";
|
|
33
|
+
"--pk-muted": "#a3aab7";
|
|
34
|
+
"--pk-border": "#2f343e";
|
|
35
|
+
"--pk-border-strong": "#454c58";
|
|
36
|
+
"--pk-grid": "#23272e";
|
|
37
|
+
"--pk-total": "#21252d";
|
|
38
|
+
"--pk-total-strong": "#252a33";
|
|
39
|
+
"--pk-shadow": "0 1px 2px rgb(0 0 0 / 0.4), 0 4px 12px rgb(0 0 0 / 0.3)";
|
|
40
|
+
"--pk-heat-low": "#1d2735";
|
|
41
|
+
"--pk-heat-high": "#3987e5";
|
|
42
|
+
"--pk-scale-low": "var(--pk-heat-low)";
|
|
43
|
+
"--pk-scale-high": "var(--pk-heat-high)";
|
|
44
|
+
"--pk-chart-1": "#3987e5";
|
|
45
|
+
"--pk-chart-2": "#d95926";
|
|
46
|
+
"--pk-chart-3": "#199e70";
|
|
47
|
+
"--pk-chart-4": "#c98500";
|
|
48
|
+
"--pk-chart-5": "#d55181";
|
|
49
|
+
"--pk-chart-6": "#008300";
|
|
50
|
+
"--pk-chart-7": "#9085e9";
|
|
51
|
+
"--pk-chart-8": "#e66767";
|
|
52
|
+
}>;
|
|
53
|
+
/** The font weights, the same in both themes: pivotkit-react's scale (test/tokens.test.js compares them). */
|
|
54
|
+
export declare const WEIGHT_TOKENS: Readonly<{
|
|
55
|
+
"--pk-weight-normal": "400";
|
|
56
|
+
"--pk-weight-medium": "500";
|
|
57
|
+
"--pk-weight-strong": "600";
|
|
58
|
+
"--pk-weight-bold": "700";
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* The corners the report draws, the same in both themes: the chart's card, as pivotkit-react's tooltip
|
|
62
|
+
* (test/tokens.test.js compares them).
|
|
63
|
+
*/
|
|
64
|
+
export declare const SHAPE_TOKENS: Readonly<{
|
|
65
|
+
"--pk-radius-card": "8px";
|
|
66
|
+
}>;
|
|
67
|
+
/**
|
|
68
|
+
* The report's font sizes, the same in both themes: its text (--pk-font-size, 14 px, the report's own
|
|
69
|
+
* default: pivotkit-react's follows the page, at least 14 px, and its Export menu passes it in px),
|
|
70
|
+
* secondary text (--pk-small, pivotkit-react's: the details, never below 14 px), the title (20 px at a
|
|
71
|
+
* 14 px text) and the printed text, in pt on paper: the table and, for a very wide table, the smaller
|
|
72
|
+
* size (PRINT_WIDE.small, never below 7 pt). A host passes its own as `tokens`.
|
|
73
|
+
*/
|
|
74
|
+
export declare const SIZE_TOKENS: Readonly<{
|
|
75
|
+
"--pk-font-size": "14px";
|
|
76
|
+
"--pk-small": "max(14px, 0.93em)";
|
|
77
|
+
"--pk-report-title-size": "calc(var(--pk-font-size) * 10 / 7)";
|
|
78
|
+
"--pk-print-size": "10pt";
|
|
79
|
+
"--pk-print-small": "7pt";
|
|
80
|
+
}>;
|
|
81
|
+
/**
|
|
82
|
+
* The report's font: the system's, as the screen's report inherits from most hosts. Without quotes
|
|
83
|
+
* (names of several words are valid unquoted): ECharts 6.1 writes a font into an SVG's style attribute
|
|
84
|
+
* without escaping its quotes, which would end the attribute.
|
|
85
|
+
*/
|
|
86
|
+
export declare const REPORT_FONT = "system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif";
|
|
87
|
+
/**
|
|
88
|
+
* The tokens as a style the chart's code reads (getPropertyValue), the host's over the light ones.
|
|
89
|
+
* @param {Record<string, string>} [tokens]
|
|
90
|
+
* @returns {{ getPropertyValue(name: string): string }}
|
|
91
|
+
*/
|
|
92
|
+
export declare function tokenStyle(tokens?: Record<string, string>): {
|
|
93
|
+
getPropertyValue(name: string): string;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* The host's tokens that may go into CSS: --pk-* names (and font-family) with plain values that call
|
|
97
|
+
* no function but SAFE_FUNCTIONS; others are left out.
|
|
98
|
+
* @param {Record<string, string>} tokens
|
|
99
|
+
*/
|
|
100
|
+
export declare function cleanTokens(tokens: Record<string, string>): Record<string, string>;
|
|
101
|
+
/**
|
|
102
|
+
* The colours of a colour scale and of data bars whose view names none, from the host's tokens over
|
|
103
|
+
* the light ones, as the report on screen resolves them: the scale --pk-scale-low, the host's
|
|
104
|
+
* --pk-scale-mid and --pk-scale-high (by default the heat tokens), the bars --pk-chart-1. A value
|
|
105
|
+
* that is no plain hex colour (another token is followed) keeps pivotkit-core's default.
|
|
106
|
+
* @param {Record<string, string>} [tokens]
|
|
107
|
+
* @returns {{ colorScale?: string[], dataBar?: string }}
|
|
108
|
+
*/
|
|
109
|
+
export declare function conditionalColors(tokens?: Record<string, string>): {
|
|
110
|
+
colorScale?: string[];
|
|
111
|
+
dataBar?: string;
|
|
112
|
+
};
|
|
113
|
+
/** Tokens as CSS declarations. */
|
|
114
|
+
export declare const declarations: (tokens: any) => string;
|