@chartpng/render 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +165 -2
- package/SECURITY.md +34 -0
- package/THIRD_PARTY_NOTICES.md +253 -0
- package/bin/chartpng-render.js +2 -0
- package/dist/packages/render/cli.d.ts +1 -0
- package/dist/packages/render/cli.js +88 -0
- package/dist/packages/render/index.d.ts +61 -0
- package/dist/packages/render/index.js +79 -0
- package/dist/src/fonts/plex.d.ts +2 -0
- package/dist/src/fonts/plex.js +9 -0
- package/dist/src/lib/errors.d.ts +4 -0
- package/dist/src/lib/errors.js +9 -0
- package/dist/src/lib/maker.d.ts +90 -0
- package/dist/src/lib/maker.js +297 -0
- package/dist/src/lib/presets.d.ts +61 -0
- package/dist/src/lib/presets.js +576 -0
- package/dist/src/lib/render.d.ts +38 -0
- package/dist/src/lib/render.js +738 -0
- package/dist/src/lib/repair.d.ts +8 -0
- package/dist/src/lib/repair.js +598 -0
- package/dist/src/lib/style.d.ts +23 -0
- package/dist/src/lib/style.js +110 -0
- package/dist/src/lib/table-chart.d.ts +133 -0
- package/dist/src/lib/table-chart.js +624 -0
- package/dist/src/lib/theme.d.ts +37 -0
- package/dist/src/lib/theme.js +288 -0
- package/package.json +51 -3
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
// The makers on the report-preset guides (kpi, ranking, comparison, funnel and gauge): turn what a
|
|
2
|
+
// person typed into the /chart URL of that preset. Pure and without imports from the renderer, so
|
|
3
|
+
// the page script can bundle it for the browser and a test can run it under node.
|
|
4
|
+
//
|
|
5
|
+
// The size is fixed. Every maker draws at 800 wide and dpr 2, the same as the static example on
|
|
6
|
+
// each page, which is far under the free plan's 4 megapixels (test/maker.test.ts checks every
|
|
7
|
+
// size against checkFreeSize).
|
|
8
|
+
export const MAKER_WIDTH = 800;
|
|
9
|
+
export const MAKER_DPR = 2;
|
|
10
|
+
// Same as FUNNEL_MAX_STAGES in presets.ts; a test keeps the two equal.
|
|
11
|
+
export const MAKER_MIN_STAGES = 2;
|
|
12
|
+
export const MAKER_MAX_STAGES = 12;
|
|
13
|
+
// Rows of a ranking or a comparison: the same range, so the row editor has one limit.
|
|
14
|
+
export const MAKER_MIN_ROWS = 2;
|
|
15
|
+
export const MAKER_MAX_ROWS = 12;
|
|
16
|
+
// A kpi needs two points to draw a line; 60 is five years of months, far more than a card shows.
|
|
17
|
+
export const MAKER_MIN_POINTS = 2;
|
|
18
|
+
export const MAKER_MAX_POINTS = 60;
|
|
19
|
+
export const MAKER_FREE_PIXELS = 4_000_000;
|
|
20
|
+
// The guides tell people to use a POST past a few thousand characters. The preview is a GET,
|
|
21
|
+
// so the maker stops there instead of building a URL that may not survive an email client.
|
|
22
|
+
export const MAKER_MAX_URL = 3500;
|
|
23
|
+
const MAX_LABEL = 40;
|
|
24
|
+
const MAX_TITLE = 60;
|
|
25
|
+
const MAX_AFFIX = 12;
|
|
26
|
+
// Big enough for any real count or sum, small enough that the number stays readable in JSON.
|
|
27
|
+
const MAX_ABS = 1e15;
|
|
28
|
+
// The example of each guide; test/maker.test.ts compares each with the config written on its page.
|
|
29
|
+
export const FUNNEL_EXAMPLE = {
|
|
30
|
+
title: 'Signup funnel, October',
|
|
31
|
+
stages: [
|
|
32
|
+
{ label: 'Visitors', value: '12400' },
|
|
33
|
+
{ label: 'Signups', value: '3100' },
|
|
34
|
+
{ label: 'Trials', value: '930' },
|
|
35
|
+
{ label: 'Paying', value: '214' },
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
export const GAUGE_EXAMPLE = { value: '37250', max: '50000', label: 'Q4 revenue goal', prefix: '$', suffix: '' };
|
|
39
|
+
export const KPI_EXAMPLE = { title: '', name: 'MRR', series: '8200 8650 8400 8900 9100 9350 9100 9840', previous: '9100', prefix: '$', suffix: '' };
|
|
40
|
+
export const RANKING_EXAMPLE = {
|
|
41
|
+
title: '',
|
|
42
|
+
name: 'Share of signups',
|
|
43
|
+
rows: [
|
|
44
|
+
{ label: 'Newsletter', value: '27' },
|
|
45
|
+
{ label: 'Organic search', value: '38' },
|
|
46
|
+
{ label: 'Direct', value: '12' },
|
|
47
|
+
{ label: 'Referral', value: '17' },
|
|
48
|
+
{ label: 'Social', value: '6' },
|
|
49
|
+
],
|
|
50
|
+
prefix: '',
|
|
51
|
+
suffix: '%',
|
|
52
|
+
};
|
|
53
|
+
export const COMPARISON_EXAMPLE = {
|
|
54
|
+
title: '',
|
|
55
|
+
current: 'This week',
|
|
56
|
+
previous: 'Last week',
|
|
57
|
+
rows: [
|
|
58
|
+
{ label: 'Mon', value: '42', previous: '36' },
|
|
59
|
+
{ label: 'Tue', value: '55', previous: '48' },
|
|
60
|
+
{ label: 'Wed', value: '38', previous: '41' },
|
|
61
|
+
{ label: 'Thu', value: '61', previous: '52' },
|
|
62
|
+
{ label: 'Fri', value: '70', previous: '58' },
|
|
63
|
+
{ label: 'Sat', value: '33', previous: '35' },
|
|
64
|
+
{ label: 'Sun', value: '29', previous: '24' },
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
// A plain decimal such as 12400, 0.5 or -3. No thousands separators: "1,200" is 1200 in one
|
|
68
|
+
// country and 1.2 in another, so it is refused rather than guessed.
|
|
69
|
+
function toNumber(text) {
|
|
70
|
+
const trimmed = text.trim();
|
|
71
|
+
if (!/^[+-]?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i.test(trimmed))
|
|
72
|
+
return null;
|
|
73
|
+
const n = Number(trimmed);
|
|
74
|
+
return Number.isFinite(n) && Math.abs(n) <= MAX_ABS ? n : null;
|
|
75
|
+
}
|
|
76
|
+
// `unit` names what to cut in the message when the URL is too long.
|
|
77
|
+
function finish(config, height, alt, unit = 'stages') {
|
|
78
|
+
const path = `/chart?c=${encodeURIComponent(JSON.stringify(config))}&w=${MAKER_WIDTH}&h=${height}&dpr=${MAKER_DPR}`;
|
|
79
|
+
if (path.length > MAKER_MAX_URL) {
|
|
80
|
+
return { ok: false, errors: [{ field: 'url', message: `The image URL would be ${path.length} characters, over the ${MAKER_MAX_URL} the maker allows. Shorten the labels or use fewer ${unit}.` }] };
|
|
81
|
+
}
|
|
82
|
+
return { ok: true, path, width: MAKER_WIDTH, height, alt, config };
|
|
83
|
+
}
|
|
84
|
+
// A horizontal bar chart needs a row of height per bar; 450 is the page's example with four or five.
|
|
85
|
+
export const funnelHeight = (stages) => Math.max(450, 90 + stages * 40);
|
|
86
|
+
export const rankingHeight = funnelHeight;
|
|
87
|
+
// The comparison draws its bars upright, so its height does not depend on the rows.
|
|
88
|
+
export const COMPARISON_HEIGHT = 450;
|
|
89
|
+
export const KPI_HEIGHT = 400;
|
|
90
|
+
// The checks the makers share. Each pushes an error for a bad input and returns the cleaned value.
|
|
91
|
+
function checkTitle(errors, text) {
|
|
92
|
+
const title = text.trim();
|
|
93
|
+
if (title.length > MAX_TITLE)
|
|
94
|
+
errors.push({ field: 'title', message: `The title takes up to ${MAX_TITLE} characters.` });
|
|
95
|
+
return title;
|
|
96
|
+
}
|
|
97
|
+
function checkName(errors, field, text, what) {
|
|
98
|
+
const name = text.trim();
|
|
99
|
+
if (name.length > MAX_LABEL)
|
|
100
|
+
errors.push({ field, message: `${what} takes up to ${MAX_LABEL} characters.` });
|
|
101
|
+
return name;
|
|
102
|
+
}
|
|
103
|
+
function checkRowLabel(errors, field, noun, n, text) {
|
|
104
|
+
const label = text.trim();
|
|
105
|
+
if (!label)
|
|
106
|
+
errors.push({ field, message: `${noun} ${n} needs a label.` });
|
|
107
|
+
else if (label.length > MAX_LABEL)
|
|
108
|
+
errors.push({ field, message: `${noun} ${n}: the label takes up to ${MAX_LABEL} characters.` });
|
|
109
|
+
return label;
|
|
110
|
+
}
|
|
111
|
+
// `what` names the number in the message: "the value", "the previous value".
|
|
112
|
+
function checkRowNumber(errors, field, noun, n, text, what, nonNegative) {
|
|
113
|
+
const value = toNumber(text);
|
|
114
|
+
if (value === null)
|
|
115
|
+
errors.push({ field, message: `${noun} ${n}: ${what} must be a plain number such as 1200, without separators.` });
|
|
116
|
+
else if (nonNegative && value < 0)
|
|
117
|
+
errors.push({ field, message: `${noun} ${n}: ${what} must be zero or more.` });
|
|
118
|
+
return value ?? 0;
|
|
119
|
+
}
|
|
120
|
+
function checkAffixes(errors, prefix, suffix) {
|
|
121
|
+
if (prefix.length > MAX_AFFIX)
|
|
122
|
+
errors.push({ field: 'prefix', message: `The prefix takes up to ${MAX_AFFIX} characters.` });
|
|
123
|
+
if (suffix.length > MAX_AFFIX)
|
|
124
|
+
errors.push({ field: 'suffix', message: `The suffix takes up to ${MAX_AFFIX} characters.` });
|
|
125
|
+
}
|
|
126
|
+
const titleBlock = (title) => (title ? { title: { display: true, text: title } } : {});
|
|
127
|
+
const affixes = (prefix, suffix) => ({ ...(prefix ? { prefix } : {}), ...(suffix ? { suffix } : {}) });
|
|
128
|
+
const named = (name) => (name ? { label: name } : {});
|
|
129
|
+
// The config of a ranking chart: the one place it is built, for the maker on the ranking guide and
|
|
130
|
+
// for the ranking type of the table editor (src/lib/table-chart.ts), so both draw the same chart
|
|
131
|
+
// from the same rows. A null value is a gap, which only the table editor passes.
|
|
132
|
+
export function rankingConfig({ labels, values, name = '', title = '', prefix = '', suffix = '' }) {
|
|
133
|
+
return {
|
|
134
|
+
type: 'bar',
|
|
135
|
+
data: { labels, datasets: [{ ...named(name), data: values }] },
|
|
136
|
+
options: {
|
|
137
|
+
plugins: {
|
|
138
|
+
...titleBlock(title),
|
|
139
|
+
chartpng: { preset: 'ranking', ...affixes(prefix, suffix) },
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
export function funnelUrl(input) {
|
|
145
|
+
const errors = [];
|
|
146
|
+
const title = checkTitle(errors, input.title);
|
|
147
|
+
const { stages } = input;
|
|
148
|
+
if (stages.length < MAKER_MIN_STAGES || stages.length > MAKER_MAX_STAGES) {
|
|
149
|
+
errors.push({ field: 'stages', message: `A funnel takes ${MAKER_MIN_STAGES} to ${MAKER_MAX_STAGES} stages.` });
|
|
150
|
+
}
|
|
151
|
+
const labels = [];
|
|
152
|
+
const values = [];
|
|
153
|
+
stages.forEach((stage, i) => {
|
|
154
|
+
labels.push(checkRowLabel(errors, `stage.${i}.label`, 'Stage', i + 1, stage.label));
|
|
155
|
+
values.push(checkRowNumber(errors, `stage.${i}.value`, 'Stage', i + 1, stage.value, 'the value', true));
|
|
156
|
+
});
|
|
157
|
+
if (errors.length)
|
|
158
|
+
return { ok: false, errors };
|
|
159
|
+
const config = {
|
|
160
|
+
type: 'bar',
|
|
161
|
+
data: { labels, datasets: [{ data: values }] },
|
|
162
|
+
options: { plugins: { ...titleBlock(title), chartpng: { preset: 'funnel' } } },
|
|
163
|
+
};
|
|
164
|
+
const first = labels[0];
|
|
165
|
+
const last = labels[labels.length - 1];
|
|
166
|
+
return finish(config, funnelHeight(stages.length), `Funnel chart of ${stages.length} stages, from ${first} to ${last}`);
|
|
167
|
+
}
|
|
168
|
+
export function gaugeUrl(input) {
|
|
169
|
+
const errors = [];
|
|
170
|
+
const label = input.label.trim();
|
|
171
|
+
const prefix = input.prefix;
|
|
172
|
+
const suffix = input.suffix;
|
|
173
|
+
const value = toNumber(input.value);
|
|
174
|
+
const max = toNumber(input.max);
|
|
175
|
+
if (value === null)
|
|
176
|
+
errors.push({ field: 'value', message: 'The value must be a plain number such as 37250, without separators.' });
|
|
177
|
+
if (max === null)
|
|
178
|
+
errors.push({ field: 'max', message: 'The goal (max) must be a plain number such as 50000, without separators.' });
|
|
179
|
+
else if (max <= 0)
|
|
180
|
+
errors.push({ field: 'max', message: 'The goal (max) must be above 0.' });
|
|
181
|
+
if (label.length > MAX_TITLE)
|
|
182
|
+
errors.push({ field: 'label', message: `The label takes up to ${MAX_TITLE} characters.` });
|
|
183
|
+
checkAffixes(errors, prefix, suffix);
|
|
184
|
+
if (errors.length)
|
|
185
|
+
return { ok: false, errors };
|
|
186
|
+
const config = {
|
|
187
|
+
type: 'doughnut',
|
|
188
|
+
data: { datasets: [{ data: [value] }] },
|
|
189
|
+
options: {
|
|
190
|
+
plugins: {
|
|
191
|
+
...titleBlock(label),
|
|
192
|
+
chartpng: { preset: 'gauge', max, ...affixes(prefix, suffix) },
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
const shown = (n) => `${prefix}${n}${suffix}`;
|
|
197
|
+
return finish(config, 450, `Half-ring gauge showing ${shown(value)} of a ${shown(max)} goal`);
|
|
198
|
+
}
|
|
199
|
+
// The tokens of a pasted series. Spaces, new lines and semicolons separate them, and so does a comma
|
|
200
|
+
// followed by a space; a comma inside a token ("1,200", "8200,8650") is not guessed at and is refused.
|
|
201
|
+
const seriesTokens = (text) => text
|
|
202
|
+
.trim()
|
|
203
|
+
.split(/[\s;]+/)
|
|
204
|
+
.filter(Boolean)
|
|
205
|
+
.map((token) => token.replace(/,$/, ''));
|
|
206
|
+
export function kpiUrl(input) {
|
|
207
|
+
const errors = [];
|
|
208
|
+
const title = checkTitle(errors, input.title);
|
|
209
|
+
const name = checkName(errors, 'name', input.name, 'The name');
|
|
210
|
+
const { prefix, suffix } = input;
|
|
211
|
+
checkAffixes(errors, prefix, suffix);
|
|
212
|
+
const tokens = seriesTokens(input.series);
|
|
213
|
+
const values = [];
|
|
214
|
+
if (tokens.length < MAKER_MIN_POINTS || tokens.length > MAKER_MAX_POINTS) {
|
|
215
|
+
errors.push({ field: 'series', message: `The series takes ${MAKER_MIN_POINTS} to ${MAKER_MAX_POINTS} numbers, oldest first.` });
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
for (const [i, token] of tokens.entries()) {
|
|
219
|
+
const n = toNumber(token);
|
|
220
|
+
if (n === null) {
|
|
221
|
+
errors.push({ field: 'series', message: `Value ${i + 1} of the series is not a plain number such as 8200, without separators. Separate the numbers with spaces or new lines.` });
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
values.push(n);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
let previous = null;
|
|
228
|
+
if (input.previous.trim()) {
|
|
229
|
+
previous = toNumber(input.previous);
|
|
230
|
+
if (previous === null)
|
|
231
|
+
errors.push({ field: 'previous', message: 'The previous value must be a plain number such as 9100, without separators.' });
|
|
232
|
+
}
|
|
233
|
+
if (errors.length)
|
|
234
|
+
return { ok: false, errors };
|
|
235
|
+
// The kpi draws no axes, so the labels never show; W1, W2... only give each value a place.
|
|
236
|
+
const config = {
|
|
237
|
+
type: 'line',
|
|
238
|
+
data: { labels: values.map((_, i) => `W${i + 1}`), datasets: [{ ...named(name), data: values }] },
|
|
239
|
+
options: {
|
|
240
|
+
plugins: {
|
|
241
|
+
...titleBlock(title),
|
|
242
|
+
chartpng: { preset: 'kpi', ...(previous !== null ? { previous } : {}), ...affixes(prefix, suffix) },
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
};
|
|
246
|
+
const shown = `${prefix}${values[values.length - 1]}${suffix}`;
|
|
247
|
+
return finish(config, KPI_HEIGHT, `KPI card showing ${shown} with a sparkline of ${values.length} values`, 'values');
|
|
248
|
+
}
|
|
249
|
+
export function rankingUrl(input) {
|
|
250
|
+
const errors = [];
|
|
251
|
+
const title = checkTitle(errors, input.title);
|
|
252
|
+
const name = checkName(errors, 'name', input.name, 'The name');
|
|
253
|
+
const { prefix, suffix, rows } = input;
|
|
254
|
+
checkAffixes(errors, prefix, suffix);
|
|
255
|
+
if (rows.length < MAKER_MIN_ROWS || rows.length > MAKER_MAX_ROWS) {
|
|
256
|
+
errors.push({ field: 'rows', message: `A ranking takes ${MAKER_MIN_ROWS} to ${MAKER_MAX_ROWS} rows.` });
|
|
257
|
+
}
|
|
258
|
+
const labels = [];
|
|
259
|
+
const values = [];
|
|
260
|
+
rows.forEach((row, i) => {
|
|
261
|
+
labels.push(checkRowLabel(errors, `row.${i}.label`, 'Row', i + 1, row.label));
|
|
262
|
+
values.push(checkRowNumber(errors, `row.${i}.value`, 'Row', i + 1, row.value, 'the value', false));
|
|
263
|
+
});
|
|
264
|
+
if (errors.length)
|
|
265
|
+
return { ok: false, errors };
|
|
266
|
+
const config = rankingConfig({ labels, values, name, title, prefix, suffix });
|
|
267
|
+
// The preset sorts the bars; the biggest value leads.
|
|
268
|
+
const lead = labels[values.indexOf(Math.max(...values))];
|
|
269
|
+
return finish(config, rankingHeight(rows.length), `Ranking chart of ${rows.length} rows, led by ${lead}`, 'rows');
|
|
270
|
+
}
|
|
271
|
+
export function comparisonUrl(input) {
|
|
272
|
+
const errors = [];
|
|
273
|
+
const title = checkTitle(errors, input.title);
|
|
274
|
+
const current = checkName(errors, 'current', input.current, 'The name of the current period');
|
|
275
|
+
const previous = checkName(errors, 'previousName', input.previous, 'The name of the previous period');
|
|
276
|
+
const { rows } = input;
|
|
277
|
+
if (rows.length < MAKER_MIN_ROWS || rows.length > MAKER_MAX_ROWS) {
|
|
278
|
+
errors.push({ field: 'rows', message: `A comparison takes ${MAKER_MIN_ROWS} to ${MAKER_MAX_ROWS} rows.` });
|
|
279
|
+
}
|
|
280
|
+
const labels = [];
|
|
281
|
+
const now = [];
|
|
282
|
+
const before = [];
|
|
283
|
+
rows.forEach((row, i) => {
|
|
284
|
+
labels.push(checkRowLabel(errors, `row.${i}.label`, 'Row', i + 1, row.label));
|
|
285
|
+
now.push(checkRowNumber(errors, `row.${i}.value`, 'Row', i + 1, row.value, 'the current value', false));
|
|
286
|
+
before.push(checkRowNumber(errors, `row.${i}.previous`, 'Row', i + 1, row.previous, 'the previous value', false));
|
|
287
|
+
});
|
|
288
|
+
if (errors.length)
|
|
289
|
+
return { ok: false, errors };
|
|
290
|
+
const config = {
|
|
291
|
+
type: 'bar',
|
|
292
|
+
data: { labels, datasets: [{ ...named(current), data: now }, { ...named(previous), data: before }] },
|
|
293
|
+
options: { plugins: { ...titleBlock(title), chartpng: { preset: 'comparison' } } },
|
|
294
|
+
};
|
|
295
|
+
const names = current && previous ? `${current} with ${previous}` : 'the current period with the previous one';
|
|
296
|
+
return finish(config, COMPARISON_HEIGHT, `Bar chart comparing ${names} across ${rows.length} rows`, 'rows');
|
|
297
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Plugin } from 'chart.js';
|
|
2
|
+
import { applyTheme } from './theme.js';
|
|
3
|
+
import type { ChartConfig } from './render.js';
|
|
4
|
+
export declare const PRESET_NAMES: readonly ['kpi', 'ranking', 'comparison', 'funnel', 'gauge'];
|
|
5
|
+
export type PresetName = (typeof PRESET_NAMES)[number];
|
|
6
|
+
export declare const TONES: {
|
|
7
|
+
light: {
|
|
8
|
+
up: {
|
|
9
|
+
text: string;
|
|
10
|
+
fill: string;
|
|
11
|
+
};
|
|
12
|
+
down: {
|
|
13
|
+
text: string;
|
|
14
|
+
fill: string;
|
|
15
|
+
};
|
|
16
|
+
flat: {
|
|
17
|
+
text: string;
|
|
18
|
+
fill: string;
|
|
19
|
+
};
|
|
20
|
+
muted: string;
|
|
21
|
+
previous: string;
|
|
22
|
+
};
|
|
23
|
+
dark: {
|
|
24
|
+
up: {
|
|
25
|
+
text: string;
|
|
26
|
+
fill: string;
|
|
27
|
+
};
|
|
28
|
+
down: {
|
|
29
|
+
text: string;
|
|
30
|
+
fill: string;
|
|
31
|
+
};
|
|
32
|
+
flat: {
|
|
33
|
+
text: string;
|
|
34
|
+
fill: string;
|
|
35
|
+
};
|
|
36
|
+
muted: string;
|
|
37
|
+
previous: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export declare function variation(current: unknown, base: unknown): number | null;
|
|
41
|
+
type Direction = 'up' | 'down' | 'flat';
|
|
42
|
+
export declare function formatChange(change: number, compact?: boolean): {
|
|
43
|
+
text: string;
|
|
44
|
+
direction: Direction;
|
|
45
|
+
};
|
|
46
|
+
export declare function kpiFigures(values: unknown, previous: unknown): {
|
|
47
|
+
value: number | null;
|
|
48
|
+
change: number | null;
|
|
49
|
+
};
|
|
50
|
+
export declare const OUTPUT_PRESET_NAMES: readonly ['email', 'slack'];
|
|
51
|
+
export type OutputPresetName = (typeof OUTPUT_PRESET_NAMES)[number];
|
|
52
|
+
export declare function readPresets(value: unknown): {
|
|
53
|
+
report?: PresetName;
|
|
54
|
+
output?: OutputPresetName;
|
|
55
|
+
};
|
|
56
|
+
export declare const FUNNEL_MAX_STAGES = 12;
|
|
57
|
+
export declare function conversion(current: number | null, previous: number | null): number | null;
|
|
58
|
+
export declare function formatShare(percent: number): string;
|
|
59
|
+
export declare function applyPreset(config: ChartConfig, background: string): ReturnType<typeof applyTheme>;
|
|
60
|
+
export declare const presetPlugin: Plugin;
|
|
61
|
+
export {};
|