pivotkit-react 0.4.0 → 0.6.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +267 -1
  2. package/README.md +5 -2
  3. package/dist/chunks/{chunk-YITKWZ4L.js → chunk-2RAVX4DO.js} +604 -505
  4. package/dist/chunks/{chunk-ZYEYZSYL.js → chunk-7LERNGUW.js} +36 -2
  5. package/dist/chunks/{chunk-EM23V5GH.js → chunk-E6M57YLL.js} +19 -8
  6. package/dist/chunks/{chunk-RWYHJRQO.js → chunk-JMRTIOX4.js} +17 -7
  7. package/dist/chunks/{chunk-XN55BQ4M.js → chunk-RIOSIYGC.js} +54 -7
  8. package/dist/chunks/{chunk-LEN5RPBM.js → chunk-TR2HROIK.js} +43 -7
  9. package/dist/chunks/chunk-W2KIPREL.js +36 -0
  10. package/dist/chunks/{chunk-6MDAL3IO.js → chunk-XN5HNKJ2.js} +88 -101
  11. package/dist/chunks/{chunk-WB4GKWFQ.js → chunk-YXLANLGL.js} +34 -6
  12. package/dist/chunks/report-run-BZBFOMPF.js +12 -0
  13. package/dist/chunks/{unused-texts-K3VFH65P.js → unused-texts-Y4R67XSN.js} +1 -1
  14. package/dist/chunks/{unused-texts-de-OW4TGIVX.js → unused-texts-de-6YVPTNVS.js} +1 -1
  15. package/dist/echarts.js +38 -156
  16. package/dist/import-ui.js +69 -168
  17. package/dist/index.js +160 -102
  18. package/dist/labels.js +6 -6
  19. package/dist/menu-texts-de.js +1 -1
  20. package/dist/menus.js +778 -277
  21. package/dist/styles.css +207 -93
  22. package/package.json +8 -4
  23. package/types/chart-decorate.d.ts +28 -4
  24. package/types/chart-types.d.ts +2 -4
  25. package/types/echarts.d.ts +1 -1
  26. package/types/export-run.d.ts +42 -4
  27. package/types/field-info.d.ts +3 -10
  28. package/types/filter.d.ts +1 -1
  29. package/types/icons.d.ts +1 -0
  30. package/types/import-host.d.ts +34 -8
  31. package/types/import-labels.d.ts +47 -0
  32. package/types/import-limits.d.ts +6 -0
  33. package/types/import-module.d.ts +1 -1
  34. package/types/import-steps.d.ts +8 -0
  35. package/types/import-ui.d.ts +18 -4
  36. package/types/index.d.ts +76 -17
  37. package/types/labels.d.ts +200 -24
  38. package/types/light-tokens.d.ts +16 -0
  39. package/types/menu-labels.d.ts +43 -14
  40. package/types/menu-ops.d.ts +166 -43
  41. package/types/menu-topics.d.ts +7 -4
  42. package/types/names.d.ts +47 -19
  43. package/types/place.d.ts +24 -0
  44. package/types/print-frame.d.ts +24 -0
  45. package/types/report-run.d.ts +14 -0
  46. package/types/share-actions.d.ts +17 -3
  47. package/types/share.d.ts +13 -17
  48. package/types/sheet-views.d.ts +60 -0
  49. package/types/templates.d.ts +21 -1
  50. package/types/theme.d.ts +2 -16
  51. package/types/tips.d.ts +5 -0
  52. package/types/toolbar-panels.d.ts +9 -6
  53. package/types/unused-texts.d.ts +13 -3
  54. package/types/use-export.d.ts +2 -2
  55. package/types/view-ops.d.ts +65 -6
  56. package/types/view-save.d.ts +10 -6
  57. package/types/view-store.d.ts +21 -11
  58. package/types/chart-layout.d.ts +0 -111
  59. package/types/import-source.d.ts +0 -32
@@ -36,20 +36,64 @@ export declare function binProblem(size: number, start: number, range: {
36
36
  max: number;
37
37
  } | null): "far" | null;
38
38
  /**
39
- * The item filter of a field from the selected values: everything selected removes it; otherwise the
40
- * values not selected are excluded, so values that appear in newer data are shown, as in Excel.
39
+ * The pick of a field from the selected values: everything selected removes it; otherwise the
40
+ * values not selected are dropped (pickFilter), so values that appear in newer data are shown, as in Excel.
41
41
  * @param {any} view
42
42
  * @param {string} field
43
43
  * @param {Array<unknown>} selected values (null is blank)
44
44
  * @param {Array<unknown>} all every value of the field
45
45
  */
46
46
  export declare function setItemFilter(view: any, field: string, selected: Array<unknown>, all: Array<unknown>): any;
47
- /** The label condition of a field ({ op, value }) or null to remove it. */
48
- export declare function setLabelFilter(view: any, field: any, condition: any): any;
49
47
  /**
50
- * Top or bottom N items of a field by a value ({ count, bottom, by }), or null to remove it. `previous`
51
- * is the top filter being edited (the view's own entry); without it the field's top filters are
52
- * replaced. Another top filter of the field (a view may hold two) stays.
48
+ * A rule on the name of a field's items: a text filter ({ op, value, on }, `op` a menu's operator of
49
+ * RULE_OPS.text, `on` textOn()), case and runs of whitespace ignored, or null to remove the field's
50
+ * text filters.
51
+ * @param {any} view
52
+ * @param {string} field
53
+ * @param {{ op: string, value: string, on: "value" | "label" } | null} condition
54
+ */
55
+ export declare function setLabelFilter(view: any, field: string, condition: {
56
+ op: string;
57
+ value: string;
58
+ on: "value" | "label";
59
+ } | null): any;
60
+ /**
61
+ * A text filter of a menu's rule on the name: `op` a menu's operator, the text matched as people type
62
+ * it (MATCH_DEFAULTS: case and runs of whitespace, a no-break space among them, do not matter), the
63
+ * blanks dropped.
64
+ * @param {string} field
65
+ * @param {{ op: string, value: string, on: "value" | "label" }} condition
66
+ */
67
+ export declare const textRule: (field: string, { op, value, on }: {
68
+ op: string;
69
+ value: string;
70
+ on: "value" | "label";
71
+ }) => {
72
+ op: string;
73
+ not: boolean;
74
+ field: string;
75
+ type: string;
76
+ value: string;
77
+ on: "label" | "value";
78
+ match: {
79
+ case: "insensitive";
80
+ whitespace: "collapse";
81
+ };
82
+ blanks: string;
83
+ };
84
+ /**
85
+ * What a rule on the name compares: a text field's value, else the label the table shows (a number,
86
+ * a grouping's "Mar 2025").
87
+ * @param {import("pivotkit-core").Encoded} encoded
88
+ * @param {string} field
89
+ * @returns {"value" | "label"}
90
+ */
91
+ export declare const textOn: (encoded: import("pivotkit-core").Encoded, field: string) => "value" | "label";
92
+ /**
93
+ * Top or bottom N items of a field by a value ({ count, bottom, by, ties }), or null to remove it.
94
+ * `ties` "all" keeps the items tied with the last one too; without it the previous filter's ties stay.
95
+ * `previous` is the top filter being edited (the view's own entry); without it the field's top filters
96
+ * are replaced. Another top filter of the field (a view may hold two) stays.
53
97
  */
54
98
  export declare function setTopFilter(view: any, field: any, top: any, previous: any): any;
55
99
  /**
@@ -77,14 +121,18 @@ export declare const RULE_TYPES: readonly string[];
77
121
  export declare const RULES_MAX = 10;
78
122
  /**
79
123
  * Replaces one rule of a field, `previous` (the view's own entry, matched by its content), with
80
- * `entry` (a filter of RULE_TYPES), removes it when `entry` is null, or adds `entry` after the field's
81
- * other filters without `previous`.
124
+ * `entry` (a filter of RULE_TYPES), removes it when `entry` is null, or adds `entry` without
125
+ * `previous`: before the rule `before` (a rule emptied and typed again keeps its place among the
126
+ * others), else after the field's other filters.
82
127
  * @param {any} view
83
128
  * @param {string} field
84
129
  * @param {object | null} previous
85
130
  * @param {object | null} entry
131
+ * @param {object | null} [before]
86
132
  */
87
- export declare const setRule: (view: any, field: string, previous: object | null, entry: object | null) => any;
133
+ export declare const setRule: (view: any, field: string, previous: object | null, entry: object | null, before?: object | null) => any;
134
+ /** The units of a date's quick choices, finest first (hours are left to a view's own filters). */
135
+ export declare const QUICK_UNITS: readonly string[];
88
136
  /**
89
137
  * How the Filter level's rules compare a field's items. `item`: "number" (a number typed), "date" (a
90
138
  * date field or a day grouping: a day chosen), "group" (another grouping: one of its items chosen),
@@ -93,11 +141,12 @@ export declare const setRule: (view: any, field: string, previous: object | null
93
141
  * Years combined instead of the quick choices); `quick`: the quick choices are offered (a date along
94
142
  * the time line); `months`: "Last N months" among them (not for a grouping by year or quarter);
95
143
  * `days`: "Last N days" too (a date field or a day grouping). `unit`: the grouping's unit, for the
96
- * noun of its items.
144
+ * noun of its items. `units`: the units the quick choices count in (QUICK_UNITS), none finer than the
145
+ * grouping (by month: months, quarters, years; a date itself or by day: days and weeks too).
97
146
  * @param {import("pivotkit-core").Encoded} encoded
98
147
  * @param {any} view
99
148
  * @param {string} field
100
- * @returns {{ item: "number" | "date" | "group" | null, dates: boolean, cyclic: boolean, quick: boolean, months: boolean, days: boolean, unit: string | null }}
149
+ * @returns {{ item: "number" | "date" | "group" | null, dates: boolean, cyclic: boolean, quick: boolean, months: boolean, days: boolean, unit: string | null, units: string[] }}
101
150
  */
102
151
  export declare function ruleKind(encoded: import("pivotkit-core").Encoded, view: any, field: string): {
103
152
  item: "number" | "date" | "group" | null;
@@ -107,6 +156,7 @@ export declare function ruleKind(encoded: import("pivotkit-core").Encoded, view:
107
156
  months: boolean;
108
157
  days: boolean;
109
158
  unit: string | null;
159
+ units: string[];
110
160
  };
111
161
  /**
112
162
  * A rule (RULE_TYPES) in short, as the chip and the Filter level say it: "last 5 years (2022–2026)",
@@ -125,44 +175,53 @@ export declare function ruleText(view: any, f: any, { labels, locale, timeZone,
125
175
  min: number;
126
176
  max: number;
127
177
  } | null;
128
- }): string;
178
+ }): any;
129
179
  /**
130
- * The quick choice of a date field's Filter level its filters match: "all" (no relative range),
131
- * "thisYear", "years", "months" or "days" with their count and anchor (the field's first relative
132
- * range of a unit that is offered: months and days only where they are) and the filter itself; the
133
- * field's other ranges and its comparisons are rules. For a cyclic grouping "yearsCombined" with the
134
- * years its whole-year comparisons keep (`years`, ascending, from `all`, the years of the data) and
135
- * those filters, "all" without any, else "custom" (its comparisons hold more).
180
+ * The quick choice of a date field's Filter level its filters match: "all" (no relative range), or the
181
+ * direction of the field's first relative range in a unit the choices offer (`fk.units`) that is not
182
+ * inverted and keeps no blanks alone: "this", "last", "next" or "before", with its unit, count,
183
+ * anchor, whether it goes by whole calendar periods (`calendar`) and takes the current one
184
+ * (`includeCurrent`), and the filter itself; the field's other ranges and its comparisons are rules.
185
+ * For a cyclic grouping "yearsCombined" with the years its whole-year comparisons keep (`years`,
186
+ * ascending, from `all`, the years of the data) and those filters, "all" without any.
136
187
  * @param {any} view
137
188
  * @param {string} field
138
- * @param {{ cyclic: boolean, months: boolean, days: boolean }} fk ruleKind()
189
+ * @param {{ cyclic: boolean, units?: string[] }} fk ruleKind()
139
190
  * @param {number[]} [all] the years of the data, for a cyclic grouping
140
- * @returns {{ id: "all" | "thisYear" | "years" | "months" | "days" | "yearsCombined" | "custom", count?: number, anchor?: string, years?: number[], filters: any[] }}
191
+ * @returns {{ id: "all" | "this" | "last" | "next" | "before" | "yearsCombined", unit?: string, count?: number, anchor?: string, calendar?: boolean, includeCurrent?: boolean, years?: number[], filters: any[] }}
141
192
  */
142
193
  export declare function quickChoice(view: any, field: string, fk: {
143
194
  cyclic: boolean;
144
- months: boolean;
145
- days: boolean;
195
+ units?: string[];
146
196
  }, all?: number[]): {
147
- id: "all" | "thisYear" | "years" | "months" | "days" | "yearsCombined" | "custom";
197
+ id: "all" | "this" | "last" | "next" | "before" | "yearsCombined";
198
+ unit?: string;
148
199
  count?: number;
149
200
  anchor?: string;
201
+ calendar?: boolean;
202
+ includeCurrent?: boolean;
150
203
  years?: number[];
151
204
  filters: any[];
152
205
  };
153
- /** A comparison of whole years of days (Jan 1 to Dec 31), as Years combined writes them. */
206
+ /** A comparison of whole years of days (Jan 1 to Dec 31), as Years combined writes them (the blanks kept or not). */
154
207
  export declare const isWholeYear: (f: any) => boolean;
155
- /** The whole-year comparisons that keep `years` of `all` (ascending): the span they cover, less each gap in it. */
156
- export declare function yearRules(field: any, years: any, all: any): {
208
+ /**
209
+ * The whole-year comparisons that keep `years` of `all` (ascending): the span they cover, less each
210
+ * gap in it; `blanks` as the field's rules have them.
211
+ */
212
+ export declare function yearRules(field: any, years: any, all: any, blanks?: string): {
157
213
  field: any;
158
214
  type: string;
159
- op: any;
215
+ op: string;
160
216
  value: string;
161
217
  value2: string;
218
+ not: any;
219
+ blanks: string;
162
220
  }[];
163
221
  /**
164
222
  * Years combined of a cyclic grouping: its whole-year comparisons are replaced by the ones that keep
165
- * `years` (yearRules); all of the data's years keep none. Its other filters, its other comparisons
223
+ * `years` (yearRules), keeping the blanks as the field's rules do (keepsBlanks); all of the data's
224
+ * years keep none. Its other filters, its other comparisons
166
225
  * (rules such as "is from Jun") among them, stay.
167
226
  * @param {any} view
168
227
  * @param {string} field
@@ -170,28 +229,80 @@ export declare function yearRules(field: any, years: any, all: any): {
170
229
  * @param {number[]} all the years of the data
171
230
  */
172
231
  export declare function setYearsCombined(view: any, field: string, years: number[], all: number[]): any;
232
+ export type QuickRange = {
233
+ direction?: string;
234
+ unit: string;
235
+ count?: number;
236
+ anchor?: string;
237
+ calendar?: boolean;
238
+ includeCurrent?: boolean;
239
+ blanks?: string;
240
+ };
173
241
  /**
174
- * A quick choice applied: the field's relative ranges are replaced by one range ({ unit, count,
175
- * anchor }, the anchor "today" not written), or removed for All (null). Its other filters, the
176
- * comparisons of the item among them, stay: picks, quick choice and rules apply together.
242
+ * @typedef {{ direction?: string, unit: string, count?: number, anchor?: string, calendar?: boolean, includeCurrent?: boolean, blanks?: string }} QuickRange
243
+ * a relative range as the quick choices and the rules write it: `direction` "last" (the default),
244
+ * "this", "next" or "before"; `anchor` "today" (the default), "latest", "first" or a day
245
+ * ("2025-06-30"); `calendar` false for rolling periods; `includeCurrent` false to leave the current
246
+ * unit out; `blanks` "exclude" (the default) or "include"
247
+ */
248
+ /**
249
+ * A quick choice applied: `previous`, the field's quick range (quickChoice().filters[0], null for
250
+ * none), is replaced by `range`, or removed for All (null); without `previous` (undefined) every
251
+ * relative range of the field is. Its other filters, the comparisons of the item among them, stay:
252
+ * picks, quick choice and rules apply together.
177
253
  * @param {any} view
178
254
  * @param {string} field
179
- * @param {{ unit: string, count: number, anchor?: string } | null} range
255
+ * @param {QuickRange | null} range
256
+ * @param {object | null} [previous]
257
+ */
258
+ export declare function setQuickRange(view: any, field: string, range: QuickRange | null, previous?: object | null): any;
259
+ /**
260
+ * A relative range as the quick choices and the rules write it (QuickRange): only what differs from
261
+ * the defaults, no count for "this", no `includeCurrent` for a rolling range (it counts from the
262
+ * moment itself), not inverted.
263
+ * @param {string} field
264
+ * @param {QuickRange} range
180
265
  */
181
- export declare function setQuickRange(view: any, field: string, range: {
266
+ export declare const relativeRule: (field: string, { direction, unit, count, anchor, calendar, includeCurrent, blanks }: QuickRange) => {
267
+ field: string;
268
+ type: string;
269
+ direction?: string | undefined;
182
270
  unit: string;
183
- count: number;
184
- anchor?: string;
185
- } | null): any;
271
+ count?: number | undefined;
272
+ calendar?: boolean | undefined;
273
+ includeCurrent?: boolean | undefined;
274
+ anchor?: string | undefined;
275
+ not: boolean;
276
+ blanks: string;
277
+ };
278
+ /**
279
+ * What the field's relative ranges count from: "today" (not written), "latest" or "first", the data's
280
+ * latest or first record, or a day ("2025-06-30"). Every range of the field takes it; the view stays
281
+ * the same without one.
282
+ * @param {any} view
283
+ * @param {string} field
284
+ * @param {string} anchor
285
+ */
286
+ export declare function setAnchor(view: any, field: string, anchor: string): any;
287
+ /** The filter types of a field's rules on its items, whose blanks "Also keep items without a value" decides. */
288
+ export declare const ITEM_RULE_TYPES: readonly string[];
186
289
  /**
187
- * What the field's relative ranges count back from: "today" (not written) or "latest", the data's
188
- * latest record. Every range of the field takes it; the view stays the same without one.
290
+ * Whether a field's rules on its items (its quick choice among them) keep its blank items: each of
291
+ * them has `blanks: "include"`, and there is one.
189
292
  * @param {any} view
190
293
  * @param {string} field
191
- * @param {"today" | "latest"} anchor
192
294
  */
193
- export declare function setAnchor(view: any, field: string, anchor: "today" | "latest"): any;
194
- /** Takes the whole filter of a field off: its picks, its quick choice and its rules; Top N stays. */
295
+ export declare function keepsBlanks(view: any, field: string): any;
296
+ /**
297
+ * "Also keep items without a value": every rule of a field on its items (ITEM_RULE_TYPES, its quick
298
+ * choice among them) keeps the blank items, or none does. A rule on the total has no blanks of its
299
+ * own; only blanks stay possible through the picks ("(blank)" alone ticked).
300
+ * @param {any} view
301
+ * @param {string} field
302
+ * @param {boolean} keep
303
+ */
304
+ export declare function setRuleBlanks(view: any, field: string, keep: boolean): any;
305
+ /** Takes the whole filter of a field off: its picks, its quick choice and its rules (a loaded view's blank filter too); Top N stays. */
195
306
  export declare const resetFilter: (view: any, field: any) => any;
196
307
  /**
197
308
  * The totals a rule on the total compares, as the table's Grand Total shows them: one per item of
@@ -251,7 +362,8 @@ export declare const TOTALS: readonly string[];
251
362
  /**
252
363
  * Why a total of Options would change nothing in this view, or null when it changes something: a
253
364
  * grand total row needs a field in Rows (without one the only row is the total), a grand total column
254
- * one in Columns, subtotals two or more fields on their axis. The key names the text (labels).
365
+ * one in Columns, subtotals two or more fields on their axis, and every total a value (without one a
366
+ * total has no number, and the table draws none). The key names the text (labels).
255
367
  * @param {any} view
256
368
  * @param {string} key one of TOTALS
257
369
  * @returns {string | null}
@@ -284,3 +396,14 @@ export declare function filterState(view: any, field: string, state: {
284
396
  } | null;
285
397
  rules?: string[];
286
398
  } | null | undefined, labels: import("./labels.js").UiLabels, locale: string): string | null;
399
+ /**
400
+ * The rows of a date column in the dates of a relative range (pivotkit-core's relativeDateRange:
401
+ * both bounds included, a day or a minute, `from` null for "before"): what a quick choice keeps.
402
+ * @param {{ from: string | null, to: string }} range
403
+ * @param {ArrayLike<unknown>} dict the column's dictionary (dates as wall-clock ms)
404
+ * @param {ArrayLike<number>} counts rows per dictionary code
405
+ */
406
+ export declare function rowsInRange(range: {
407
+ from: string | null;
408
+ to: string;
409
+ }, dict: ArrayLike<unknown>, counts: ArrayLike<number>): number;
@@ -47,12 +47,14 @@ export type Topic = {
47
47
  text: string;
48
48
  focus?: string;
49
49
  choice?: Choice;
50
+ keywords?: string;
50
51
  }>;
51
52
  searchFor?: (query: string) => Array<{
52
53
  id: string;
53
54
  text: string;
54
55
  focus?: string;
55
56
  choice: Choice;
57
+ keywords?: string;
56
58
  }>;
57
59
  };
58
60
  /**
@@ -76,8 +78,8 @@ export type Topic = {
76
78
  * @typedef {{ id: string, title: string, kind: "segmented" | "inline" | "menu" | "panel",
77
79
  * groups?: Array<{ title?: string, choices: Choice[] }>, state?: string | null, changed?: boolean,
78
80
  * icon?: string, titled?: boolean, info?: string, hidden?: boolean, levelTitle?: string, note?: string | null, noteId?: string,
79
- * keywords?: string, searchExtra?: Array<{ id: string, text: string, focus?: string, choice?: Choice }>,
80
- * searchFor?: (query: string) => Array<{ id: string, text: string, focus?: string, choice: Choice }> }} Topic
81
+ * keywords?: string, searchExtra?: Array<{ id: string, text: string, focus?: string, choice?: Choice, keywords?: string }>,
82
+ * searchFor?: (query: string) => Array<{ id: string, text: string, focus?: string, choice: Choice, keywords?: string }> }} Topic
81
83
  * `keywords`: more words the search finds the topic's entries by (a choice's own `keywords` put it
82
84
  * first among the hits for them); `searchExtra`: more entries of a panel topic (a part of its level,
83
85
  * or a quick choice of it); `searchFor`: entries made from what is typed ("last 3 years", "from 2022").
@@ -176,7 +178,7 @@ export declare function valueTopics({ view, index, types, labels, locale, defaul
176
178
  }): Topic[];
177
179
  /**
178
180
  * The topics of the Options menu: the totals (each a switch; one that would change nothing in this
179
- * view is off, with the reason), Expand all and Collapse all (each only when it changes something,
181
+ * view is disabled and unticked, with the reason), Expand all and Collapse all (each only when it changes something,
180
182
  * else with the reason), and help: Show tips, Show explanations, Show dismissed tips again, and the
181
183
  * keyboard shortcuts (a level). What each does is the report's (`act`).
182
184
  * @param {{ view: any, labels: any, folding: { canExpand: boolean, canCollapse: boolean, why: { expand?: string | null, collapse?: string | null } },
@@ -238,11 +240,12 @@ export type SearchEntry = {
238
240
  topic: Topic;
239
241
  choice?: Choice;
240
242
  focus?: string;
243
+ keywords?: string;
241
244
  };
242
245
  /**
243
246
  * One entry of a menu's search: a choice of a topic (with the path to it), or a topic's level
244
247
  * (`focus`: the part of it to show and focus).
245
- * @typedef {{ id: string, text: string, path: string, topic: Topic, choice?: Choice, focus?: string }} SearchEntry
248
+ * @typedef {{ id: string, text: string, path: string, topic: Topic, choice?: Choice, focus?: string, keywords?: string }} SearchEntry
246
249
  */
247
250
  /**
248
251
  * Every entry of a menu, for its search: each choice with the titles above it as its path ("Number
package/types/names.d.ts CHANGED
@@ -42,7 +42,7 @@ export declare function valueConditionText(view: any, f: {
42
42
  op: string;
43
43
  value: number;
44
44
  value2?: number;
45
- }, labels: import("./labels.js").UiLabels, locale: string): string;
45
+ }, labels: import("./labels.js").UiLabels, locale: string): any;
46
46
  /** A calendar day ("2022-03-01") as the locale writes a date. */
47
47
  export declare const dayText: (iso: any, locale: any) => string;
48
48
  /** A calendar day of wall-clock ms ("2022-03-01"), as a date column holds dates. */
@@ -51,24 +51,44 @@ export declare const isoDay: (ms: any) => string;
51
51
  * The days a relative filter keeps, both included (pivotkit-core's relativeDateRange): counted back
52
52
  * from today (`now`, default the current time) or, with `anchor: "latest"`, from the data's latest
53
53
  * date (`latest`, wall-clock ms); null without one then, or for a range that leaves what a Date holds.
54
- * @param {{ unit: string, count: number, anchor?: string }} f a `relative` filter
54
+ * @param {{ unit: string, count?: number, anchor?: string, direction?: string, calendar?: boolean, includeCurrent?: boolean }} f a `relative` filter
55
55
  * @param {string} timeZone the data's
56
56
  * @param {Date | number | string} [now]
57
57
  * @param {number | null} [latest]
58
- * @returns {{ from: string, to: string } | null}
58
+ * @param {{ first?: number | null, weekStart?: number }} [more] the data's first date (anchor "first"), the view's first day of a week
59
+ * @returns {{ from: string, to: string } | null} null too for a range without a start ("before")
59
60
  */
60
- export declare const relativeDays: (f: {
61
+ export declare function relativeDays(f: {
61
62
  unit: string;
62
- count: number;
63
+ count?: number;
63
64
  anchor?: string;
64
- }, timeZone: string, now?: Date | number | string, latest?: number | null) => {
65
+ direction?: string;
66
+ calendar?: boolean;
67
+ includeCurrent?: boolean;
68
+ }, timeZone: string, now?: Date | number | string, latest?: number | null, more?: {
69
+ first?: number | null;
70
+ weekStart?: number;
71
+ }): {
65
72
  from: string;
66
73
  to: string;
67
74
  } | null;
68
75
  /**
69
- * A range of days as the unit writes it: "2022–2026" for years, "Dec 2025–Nov 2026" for months, dates
70
- * for days; one period alone ("2026").
71
- * @param {{ from: string, to: string }} range ISO days, both included
76
+ * Whether a relative range is said in short with its periods ("last 3 months (Aug–Oct 2026)", "this
77
+ * quarter (Q4 2026)"): the last N or this day, week, month, quarter or year, in whole calendar
78
+ * periods, counted from today or from the latest record. The others are said with their dates.
79
+ * @param {{ unit: string, direction?: string, calendar?: boolean, includeCurrent?: boolean, anchor?: string }} f
80
+ */
81
+ export declare const plainRange: (f: {
82
+ unit: string;
83
+ direction?: string;
84
+ calendar?: boolean;
85
+ includeCurrent?: boolean;
86
+ anchor?: string;
87
+ }) => boolean;
88
+ /**
89
+ * A range of days as the unit writes it: "2022–2026" for years, "Q4 2025–Q3 2026" for quarters, "Dec
90
+ * 2025–Nov 2026" for months, dates for weeks and days; one period alone ("2026").
91
+ * @param {{ from: string, to: string }} range ISO days, both included (a minute's day is read)
72
92
  * @param {string} unit
73
93
  * @param {string} locale
74
94
  */
@@ -120,21 +140,25 @@ export declare function rangeShare(range: {
120
140
  * (2026)". With the data's span, the data's share of them: "last 2 years (2025; 2026 has no data)",
121
141
  * "this year (2026 has no data)". Anchored at the data's latest date: "last 12 months to Dec 2025",
122
142
  * its days only when the data do not cover them all.
123
- * @param {{ unit: string, count: number, anchor?: string }} f a `relative` filter
143
+ * @param {{ unit: string, count?: number, anchor?: string, direction?: string, calendar?: boolean, includeCurrent?: boolean }} f a `relative` filter
124
144
  * @param {import("./labels.js").UiLabels} labels
125
145
  * @param {string} locale
126
146
  * @param {string} timeZone the data's
127
147
  * @param {Date | number | string} [now] today, default the current time
128
148
  * @param {{ min: number, max: number } | null} [span] the data's first and last date (wall-clock ms)
149
+ * @param {number} [weekStart] the view's first day of a week, 1 (Monday, the default) to 7
129
150
  */
130
151
  export declare function relativeText(f: {
131
152
  unit: string;
132
- count: number;
153
+ count?: number;
133
154
  anchor?: string;
155
+ direction?: string;
156
+ calendar?: boolean;
157
+ includeCurrent?: boolean;
134
158
  }, labels: import("./labels.js").UiLabels, locale: string, timeZone: string, now?: Date | number | string, span?: {
135
159
  min: number;
136
160
  max: number;
137
- } | null): string;
161
+ } | null, weekStart?: number): any;
138
162
  /**
139
163
  * The years two calendar days bound as whole years (Jan 1 to Dec 31), or null: the days a comparison
140
164
  * on a date grouping's source dates gets from Years combined.
@@ -144,7 +168,7 @@ export declare function wholeYears(from: any, to: any): [string, string] | null;
144
168
  /**
145
169
  * A comparison of the item itself in short: "from 2022", "2022 to 2024" for a date or a date
146
170
  * grouping, "≥ 10" for a number. `labelOf` gives an item's label (a grouping's "Mar 2025").
147
- * @param {{ op: string, value: number | string, value2?: number | string }} f a `compare` filter
171
+ * @param {{ op: string, value: number | string, value2?: number | string, precision?: string, not?: boolean }} f a `compare` filter
148
172
  * @param {import("./labels.js").UiLabels} labels
149
173
  * @param {string} locale
150
174
  * @param {{ date: boolean, labelOf?: (value: number) => string | undefined }} kind
@@ -153,18 +177,20 @@ export declare function compareText(f: {
153
177
  op: string;
154
178
  value: number | string;
155
179
  value2?: number | string;
180
+ precision?: string;
181
+ not?: boolean;
156
182
  }, labels: import("./labels.js").UiLabels, locale: string, { date, labelOf }: {
157
183
  date: boolean;
158
184
  labelOf?: (value: number) => string | undefined;
159
- }): string;
185
+ }): any;
160
186
  /**
161
187
  * A rule on a field's items in short, as its chip and its menu say it: "last 5 years (2022–2026)",
162
188
  * "from 2022", "contains “an”".
163
- * @param {{ type: string, op?: string, value?: any, value2?: any, unit?: string, count?: number }} f a `relative`, `compare` or `label` filter
189
+ * @param {{ type: string, op?: string, value?: any, value2?: any, unit?: string, count?: number, not?: boolean }} f a `relative`, `compare` or `text` filter
164
190
  * @param {import("./labels.js").UiLabels} labels
165
191
  * @param {string} locale
166
- * @param {{ timeZone: string, date: boolean, labelOf?: (value: number) => string | undefined, span?: { min: number, max: number } | null }} kind
167
- * `span`: the data's first and last date, for the data's share of a relative range
192
+ * @param {{ timeZone: string, date: boolean, labelOf?: (value: number) => string | undefined, span?: { min: number, max: number } | null, weekStart?: number }} kind
193
+ * `span`: the data's first and last date, for the data's share of a relative range; `weekStart`: the view's first day of a week
168
194
  */
169
195
  export declare function itemRuleText(f: {
170
196
  type: string;
@@ -173,7 +199,8 @@ export declare function itemRuleText(f: {
173
199
  value2?: any;
174
200
  unit?: string;
175
201
  count?: number;
176
- }, labels: import("./labels.js").UiLabels, locale: string, { timeZone, date, labelOf, span }: {
202
+ not?: boolean;
203
+ }, labels: import("./labels.js").UiLabels, locale: string, { timeZone, date, labelOf, span, weekStart }: {
177
204
  timeZone: string;
178
205
  date: boolean;
179
206
  labelOf?: (value: number) => string | undefined;
@@ -181,7 +208,8 @@ export declare function itemRuleText(f: {
181
208
  min: number;
182
209
  max: number;
183
210
  } | null;
184
- }): string;
211
+ weekStart?: number;
212
+ }): any;
185
213
  /** The name of a derived field for a grouping, in the labels' language: "Date by month", "Amount (by 100)". */
186
214
  export declare function groupingName(source: any, unit: any, labels: any, size: any): string;
187
215
  /** The zone a click on a field of the field list puts it in: numbers to Values, the rest to Rows. */
package/types/place.d.ts CHANGED
@@ -85,3 +85,27 @@ export declare function fromOrigin<T extends {
85
85
  top: number;
86
86
  left: number;
87
87
  }): T;
88
+ /**
89
+ * Whether a point is on the way from an anchor to its popover: inside the smallest convex shape that
90
+ * holds both boxes (their convex hull). A pointer moving in a straight line from anywhere on the one
91
+ * to anywhere on the other stays inside it, also where the popover is moved aside to stay in the
92
+ * window and the way runs beside the anchor first, and in the gap between them. A hover tip stays
93
+ * while the pointer is there (info.jsx), whatever time the move takes.
94
+ * @param {{ top: number, bottom: number, left: number, right: number }} anchor getBoundingClientRect()
95
+ * @param {{ top: number, bottom: number, left: number, right: number }} popover getBoundingClientRect()
96
+ * @param {{ x: number, y: number } | null} point client coordinates
97
+ */
98
+ export declare function onTheWay(anchor: {
99
+ top: number;
100
+ bottom: number;
101
+ left: number;
102
+ right: number;
103
+ }, popover: {
104
+ top: number;
105
+ bottom: number;
106
+ left: number;
107
+ right: number;
108
+ }, point: {
109
+ x: number;
110
+ y: number;
111
+ } | null): boolean;
@@ -0,0 +1,24 @@
1
+ /** How long the frame may take to load before printing is given up as blocked (ms). */
2
+ export declare const PRINT_LOAD_TIMEOUT = 5000;
3
+ /**
4
+ * The parts of a report's HTML for the frame: its stylesheet, language, title and body nodes. The
5
+ * stylesheet is cut out of the text before it is parsed (a <style> parsed on a page with a strict
6
+ * policy is reported as a violation, also in a document of DOMParser); meta elements and scripts are
7
+ * left out (the frame is filled as DOM).
8
+ * @param {string} html
9
+ * @param {DOMParser} parser
10
+ */
11
+ export declare function printParts(html: string, parser: DOMParser): {
12
+ css: string;
13
+ lang: string;
14
+ dir: string;
15
+ title: string;
16
+ body: HTMLElement;
17
+ };
18
+ /**
19
+ * Prints the report's HTML from a hidden frame in `container`.
20
+ * @param {string} html pivotkit-report's HTML (format "html", chartEmbed "inline")
21
+ * @param {HTMLElement} container the report's root
22
+ * @returns {Promise<boolean>} false when the frame could not be used (blocked by the page)
23
+ */
24
+ export declare function printHtml(html: string, container: HTMLElement): Promise<boolean>;
@@ -0,0 +1,14 @@
1
+ import { render } from "pivotkit-report";
2
+ export { render };
3
+ /**
4
+ * The tokens of an HTML report and an SVG, as the report's light theme resolves them (export-run.js):
5
+ * pivotkit-report's colours, font weights and corners, and a host's middle colour of a colour scale.
6
+ * The chart's lengths in px come from the chart's module (LENGTH_TOKENS).
7
+ */
8
+ export declare const REPORT_TOKENS: readonly string[];
9
+ /**
10
+ * The HTML report's font sizes, in px as the report resolves them (export-run.js): its text and
11
+ * secondary text, so the file's text is the size the screen's is, and a host's title and print sizes
12
+ * where it sets them (pivotkit-report's own defaults else).
13
+ */
14
+ export declare const REPORT_LENGTHS: readonly string[];
@@ -17,6 +17,17 @@ export type ShareContext = {
17
17
  viewName: string | null;
18
18
  sourceId: string | undefined;
19
19
  sourceName: string | undefined;
20
+ /**
21
+ * the source's params the files and links carry (a loaded workbook's sheet)
22
+ */
23
+ sourceParams: Record<string, string> | undefined;
24
+ /**
25
+ * a view file made on another sheet of the workbook shown: reads that sheet, then loads `file` on it ("switch" when that started)
26
+ */
27
+ viaSheet: ((made: {
28
+ id?: string | null;
29
+ sheet?: string | null;
30
+ }, name: string, file: object) => "switch" | "missing" | "none") | undefined;
20
31
  /**
21
32
  * the `$schema` of the view files (the prop)
22
33
  */
@@ -27,9 +38,9 @@ export type ShareContext = {
27
38
  */
28
39
  shareLink: boolean | string | undefined;
29
40
  /**
30
- * the link's parameter in the fragment
41
+ * the report's key in the fragment (its storageKey): "pivot-<key>", else "pivot"
31
42
  */
32
- param: string;
43
+ linkKey: string | undefined;
33
44
  /**
34
45
  * the report's root (copies and downloads start from its document)
35
46
  */
@@ -61,10 +72,13 @@ export type ShareContext = {
61
72
  * @property {string | null} viewName the loaded view's name
62
73
  * @property {string | undefined} sourceId
63
74
  * @property {string | undefined} sourceName
75
+ * @property {Record<string, string> | undefined} sourceParams the source's params the files and links carry (a loaded workbook's sheet)
76
+ * @property {((made: { id?: string | null, sheet?: string | null }, name: string, file: object) => "switch" | "missing" | "none") | undefined} viaSheet
77
+ * a view file made on another sheet of the workbook shown: reads that sheet, then loads `file` on it ("switch" when that started)
64
78
  * @property {string | null | undefined} schemaUrl the `$schema` of the view files (the prop)
65
79
  * @property {import("pivotkit-core").Encoded} encoded
66
80
  * @property {boolean | string | undefined} shareLink the prop: the base of the link
67
- * @property {string} param the link's parameter in the fragment
81
+ * @property {string | undefined} linkKey the report's key in the fragment (its storageKey): "pivot-<key>", else "pivot"
68
82
  * @property {{ current: HTMLElement | null }} root the report's root (copies and downloads start from its document)
69
83
  * @property {string | undefined} fileName the host's file name of exports
70
84
  * @property {((file: any) => unknown) | undefined} onExport