Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
890845d
feat(core): describeView writes its texts in German too
eizedev Nov 25, 2026
cb33a75
fix(report): a German HTML report writes its filters and summary in G…
eizedev Nov 25, 2026
f719f44
fix(core): describeView's words cover the engine's lists; partial tab…
eizedev Nov 25, 2026
6883571
docs(report): the filters and the summary follow the report's language
eizedev Nov 25, 2026
b1cdcb2
Merge remote-tracking branch 'origin/main' into fix/report-german-des…
eizedev Nov 25, 2026
41f34fa
fix(element): keep describeView's words out of the first load
eizedev Nov 25, 2026
d04bfc1
fix(core): describeView's German reads naturally and says what the en…
eizedev Nov 25, 2026
f1deaec
feat(report): describeLabels for the HTML report's filters and summary
eizedev Nov 25, 2026
ebd2b11
test(element): describe-labels.js stays out of the first load
eizedev Nov 25, 2026
ae577a0
fix(core): describeView's German one-unit ranges from an anchor name …
eizedev Nov 25, 2026
a3593a8
docs(element): the report group's measured size with the German words
eizedev Nov 25, 2026
56d6d3e
chore(element): raise the report budget to 29.7 KiB
eizedev Nov 25, 2026
6ae7aa6
fix(core): describeView's German lists, filter joins and yes/no read …
eizedev Nov 25, 2026
cfe7597
fix(report): describeLabels given in part go over the locale's words
eizedev Nov 25, 2026
d7313ee
docs(element): the report group's measured size after the German list…
eizedev Nov 25, 2026
1da0ac2
fix(core): describeView's labels and describeLabels refuse unknown ke…
eizedev Nov 25, 2026
871c8dd
fix(report): German filters in {{filters}} are joined by "; und ", ap…
eizedev Nov 25, 2026
caedf06
docs(element): the report group's measured size with the checked words
eizedev Nov 25, 2026
d2c0c11
fix(core): describe labels take every plural category and are frozen …
eizedev Nov 25, 2026
9cd2c6d
docs(report): describeLabels links to core for the filter list's join
eizedev Nov 25, 2026
d2a5993
docs(element): the report group's measured size after the plural forms
eizedev Nov 25, 2026
98baee2
Merge remote-tracking branch 'origin/main' into fix/report-german-des…
eizedev Nov 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/concepts/views.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ pivotkit-core has these functions for it:
probably meant (`params.suggestion`).
- The JSON Schema `pivotkit-core/schema/view-2.json` checks a view that a program or an LLM wrote,
before it reaches the data. The schema is built from the engine's tables.
- `describeView(view, data)` explains a view: its parts, with one short English text each
([reference](../reference/core.md#describing-data-and-views)).
- `describeView(view, data)` explains a view: its parts, with one short text each, in English or
German ([reference](../reference/core.md#describing-data-and-views)).

The UI normalizes every view it gets. It shows what it dropped as a warning above the result, in plain
words ([what people see](../use/behaviour.md#parts-of-a-view-that-were-not-used)).
Expand Down
8 changes: 4 additions & 4 deletions docs/reference/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,13 @@ pivotkit-core ships it as `pivotkit-core/schema/view-2.json`, and the site publi

### Describing data and views

Plain, structured summaries for a log, an approver or an LLM that writes or explains views. They are
JSON with one short English `text` per part, without a locale, and nothing rendered. Values from the
data are data, and a prompt should mark them as such.
Plain, structured summaries for a log, an approver or an LLM that writes or explains views: JSON with
one short `text` per part, nothing rendered. Values from the data are data; a prompt should mark them as such.

| Function | Returns | What |
| --- | --- | --- |
| `describeSource(data, { items })` | `{ rows, fields, text }` | Per field: `name`, `type`, and the `aggregators` and filter types (`filters`) that work on it. Encoded data adds `distinct`, `blanks`, the first `items` and `min`/`max` of numbers and dates (dates as ISO days). `items` holds at most `DESCRIBE_LIMITS.items`, 20, each cut at 80 characters. A schema `{ fields }` or a fields array gives the types only (`rows: null`). Rows that are not encoded throw `INVALID_ARGUMENT`, so `encode()` them first. Field names in the `text`s are cut at 80 characters, as items are. |
| `describeView(view, schema, { limits })` | object | The view as `normalize` reads it, in parts: `rows`, `cols`, `values` with their names, `filters`, `derived`, `sort` and `display`. Each normalized filter has its `text`: `Region is one of "North", "South" (blanks dropped)`. It adds `valid`, `errors` and `warnings` of `validate`, and `text`, the whole view in one sentence. A part with an error is left out of the parts. The `text` of an invalid view starts with `(invalid: n errors, the parts they name are left out)`. |
| `describeView(view, schema, { limits, labels, locale })` | object | The view as `normalize` reads it, in parts: `rows`, `cols`, `values` with their names, `filters`, `derived`, `sort` and `display`. Each normalized filter has its `text`: `Region is one of "North", "South" (blanks dropped)`. It adds `valid`, `errors` and `warnings` of `validate`, and `text`, the whole view in one sentence. A part with an error is left out of the parts. The `text` of an invalid view starts with `(invalid: n errors, the parts they name are left out)`. `labels` are the words of the texts, English by default ([`DESCRIBE_LABELS`](#helpers)): German writes `Region ist einer der Werte „North“; „South“, ohne leere Werte`: a list's items by "; " and filters by "; und ", as German numbers have a decimal comma. A key or a table entry that `labels` leaves out stays English, at any depth. `labels` that are not an object, or that hold a key `DESCRIBE_LABELS` does not have or a word of the wrong kind (a number for a text, a text for a table, a `lang` that is no language), throw `INVALID_OPTION`. `locale` writes the numbers of filter values as the locale does, without grouping (`1,5` and `2025` for `de-DE`); without it they are as in JSON. Dates stay ISO days. The `errors` and `warnings` stay English. |

### A view from field names { #view-from-field-names }

Expand Down Expand Up @@ -633,6 +632,7 @@ files contain and where Excel's number formats cannot follow the grid.
| `closest(name, candidates)` | "Did you mean": the name of `candidates` closest to `name` as `foldText` folds both, else `null`. The edit distance is at most a third of the name's length, at least 1 and at most 3. A swap of two neighbours is one edit. `HINT_LIMITS` (`{ candidates: 1000, length: 64, distance: 3 }`) bounds it, so a hint costs a few thousand steps per name at most. The view's hints, pivotkit-report's template check and pivotkit-cli's options use it. |
| `DEFAULT_LABELS` | The texts the engine writes (blank, totals, value names, aggregator names, "show as" names), to override per call with `labels`. |
| `REPORT_LABELS`, `reportLabels(locale)` | The same texts as a report shows them, per language. `en` has yes/no as words and the aggregators' longer names ("Distinct count"). `de` has "Gesamtergebnis" and "Summe von Units". `reportLabels` gives a locale's texts: German for `"de-DE"`, English for any other. pivotkit-react's report and pivotkit-report use them. |
| `DESCRIBE_LABELS`, `describeLabels(locale, own)` | The words of `describeView`, English and German. `describeLabels` gives a locale's words: German for `"de-DE"`, English for any other. `own` words go over them at any depth; words that name their language (`lang`) go over that language's. `own` that is not an object, or with a key or a word `describeView` refuses, throws `INVALID_ARGUMENT`. The result is a frozen copy. A table of forms by count (`top`, `invalid`, a range's forms) takes every plural category of its `lang` (`few`, `many`). `and` joins the filters in `describeView`'s `text` ("; and ", German "; und "); `filterList` joins a list of the filters alone, as the HTML report's `{{filters}}` does ("; ", German "; und ", as German lists use "; "). German names one whole unit of a relative range as the engine keeps it: "heute", "gestern", "im Vorjahr", and from an anchor "am Tag davor". pivotkit-report's HTML report uses them for its filters and its summary. |
| `ROW_COUNT_TEXTS` | The row count in words, English and German, with one form per plural category: `rowsCount` ("8 rows") and `rowsFiltered` ("6 of 8 rows") for when filters leave rows out. pivotkit-react's line under the result and pivotkit-report's HTML report both use them. |
| `pluralForm(forms, count, lang)`, `PLURAL_CATEGORIES` | The form of a count's words for `count` in the language `lang`, after `Intl.PluralRules`: `forms[category]`, else `forms.other`. `PLURAL_CATEGORIES` lists the categories a count's forms may have. pivotkit-react's labels and pivotkit-report's texts use them. |
| `numberRepeats(names)` | The names with each one that comes again numbered, case-insensitively: `["Sum of A", "sum of a"]` gives `["Sum of A", "sum of a (2)"]`. The grid, the chart's series and pivotkit-react's chips name a value that is in the view twice this way. |
Expand Down
3 changes: 3 additions & 0 deletions docs/reference/localisation.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ console which key holds that text now.

The report's `lang` attribute follows the labels, so screen readers use the right voice.

The HTML report of [pivotkit-report](report.md) writes its filters and its summary in the locale's
language too, with the locale's numbers ([`describeLabels`](report.md#options)).

The web component loads the German texts of the first render as a file of its own:

- Only a German report loads it, before it renders. Until then the report shows its skeleton without
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/print-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ A source's own template wins over `output.template`. Without either, the built-i
| `{{generated}}` | text | When it was made, in the locale and time zone ("Nov 13, 2026, 10:00 AM"; fixed with `now`). |
| `{{dataAsOf}}` | text | When the data is from, in the locale and time zone with the zone named ("Nov 15, 2026, 8:00 AM UTC"), from `dataAsOf`; empty without it. The REST service and the MCP server pass it. |
| `{{rows}}` | text | The data's rows ("8 rows"). When the filters leave rows out, the rows they keep of them ("6 of 8 rows"). Empty where the policy withholds the row count (`rows: false`). |
| `{{filters}}` | text | The view's filters in words, or "None". |
| `{{summary}}` | text | The view in one sentence ("sum of Units by Region"). |
| `{{filters}}` | text | The view's filters in words, or "None", in the report's language. |
| `{{summary}}` | text | The view in one sentence, in the report's language ("sum of Units by Region", "Summe von Units nach Region"). |
| `{{lang}}`, `{{dir}}` | text | The locale ("de-DE") and its direction (`ltr`, `rtl`). |
| `{{style}}` | markup | The report's `<style>`: tokens, table, print rules. |
| `{{chart}}` | markup | The chart in a `<figure>`, or nothing. |
Expand Down
3 changes: 3 additions & 0 deletions docs/reference/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ text. `data` is one of these:
| `trusted` | `false` | The view is the host's own: its limits instead of `outsideLimits()`. |
| `strict` | `false` | No body when the view has an error. Without it the normalized view is rendered, as the report on screen does. |
| `labels`, `texts` | the locale's language | pivotkit-core's texts (totals, value names; by default [`reportLabels`](core.md) of the view's or `locale`'s language: "Gesamtergebnis", "Summe von Units" for `de-DE`, the words the report on a page shows) and the report's words around the table (`REPORT_TEXTS`, English and German). A count (`rowsCount`, `rowsFiltered`) is one text for every count, or one text per plural category: `{ one: "{count} record", other: "{count} records" }`. |
| `describeLabels` | the locale's language | `html`: the words of the filters and the summary (`{{filters}}`, `{{summary}}`, the page's description), by default [`describeLabels`](core.md#helpers) of the view's or `locale`'s language; their numbers follow the locale ("1,5"). By default the table's words and these follow `locale`. A host that passes its own `labels` passes `describeLabels` too, so the report keeps to one language. Words given in part go over the locale's words; their own `lang` picks the base language instead. `{{filters}}` joins the filters with their `filterList` ([`describeLabels`](core.md#helpers)). |
| `title`, `description`, `source` | the view file's name and description | The report's heading, its line below, and the data's name in the details. Each is a text. |
| `tokens` | the light theme | `--pk-*` colours, font weights, font sizes and corners over [`LIGHT_TOKENS`](theming.md), `WEIGHT_TOKENS` (`--pk-weight-normal` to `--pk-weight-bold`, the chart's title and group labels too), `SIZE_TOKENS` (the HTML report's font sizes: `--pk-font-size` 14 px, `--pk-small`, `--pk-report-title-size`, `--pk-print-size` and `--pk-print-small`, [theming](theming.md#report-font-sizes)) and `SHAPE_TOKENS` (`--pk-radius-card`, the chart card), and the chart's `--pk-chart-title-size`, `--pk-chart-text-size` and `--pk-radius-chart` in px (else 16 px, 14 px and 4 px): names and plain values only (a comment, a line break and `url(` anywhere, also in a quoted string, leave the token out), and no function but colours, `calc()`, `min()`, `max()`, `clamp()` and `var()`, so a token loads nothing (`url()` and `image-set()` are left out). A colour scale or data bars whose view names no colours take `--pk-scale-low`, `--pk-scale-mid` (when set) and `--pk-scale-high` (by default the heat tokens) and `--pk-chart-1` in the HTML report's table and in the workbook, when they are `#rgb` or `#rrggbb`. `html`: the template's own `--pk-*` values win over these ([colours and font of your template](print-template.md#template-design)). |
| `darkTokens` | the dark theme | `html`: `--pk-*` colours over [`DARK_TOKENS`](theming.md) for a reader whose screen is dark, as `tokens` are over the light ones and checked the same way. Paper, a root that pins light (`data-pk-theme="light"`) and the chart keep the light colours; a template's own dark rules win over these. The colour scale's middle colour of `tokens` stays out of a dark screen (a light colour): set `--pk-scale-mid` here for one. pivotkit-react's Export passes the dark colours its report resolves. The host's `tokens` and `darkTokens` are not checked for contrast: the WCAG AA promise below covers the default colours. |
Expand Down Expand Up @@ -115,6 +116,8 @@ A bad view never throws: its issues come back. `render` throws `PivotkitError` f
- a `now` that is no date
- a `dataAsOf` in another form
- a `tokens` or `darkTokens` that is no object
- a `labels`, `describeLabels` or `texts` that is no object
- a `describeLabels` with a key `describeView` does not know or a word of the wrong kind
- a limit: `LIMIT_EXCEEDED`
- a refused template: `INVALID_TEMPLATE`, see [print template](print-template.md)

Expand Down
1 change: 1 addition & 0 deletions packages/pivotkit-core/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Reuse these instead of writing a second version:
| Every place a view names a field | `mapFieldRefs` in `view-file.js` |
| A loaded file's source id | `sourceIdOf` in `source-id.js` |
| Grouping names and report words, en and de | `GROUPING_NAMES`, `REPORT_LABELS` in `labels.js` |
| describeView's words, en and de | `DESCRIBE_LABELS` in `describe-labels.js` |
| Chart data and the type "auto" stands for | `toSeries`, `autoChartType` in `chart-series.js` |
| The ECharts option, loaded with the chart | `toEChartsOption` in `chart.js`, also exported by `chart-style.js` |
| Chart marks for screen, SVG and print | `decorateOption` in `chart-style.js` |
Expand Down
22 changes: 22 additions & 0 deletions packages/pivotkit-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ All notable changes to `pivotkit-core` are documented in this file. The format i

## [Unreleased]

### Added

- `describeView(view, schema, { labels, locale })` writes its texts in German too: `DESCRIBE_LABELS.de`,
or `describeLabels(locale)` for a locale's language. German quotes text values („North“) and names
one whole unit of a relative range as the engine keeps it ("heute", "gestern", "im Vorjahr"; from
an anchor "am Tag davor"). It separates the items of a list with "; ", so a decimal comma stays in
its number ("1; 2,5; 3"), joins filters with "; und ", and writes true and false as "Ja" and "Nein".
`labels` given in part keep English for the rest, at any depth. `labels` that are not an object,
or with a key it does not know or a word of the wrong kind, throw `INVALID_OPTION`. `locale` writes
the numbers of filter values as the locale does, without grouping (`1,5`). English stays the
default, word for word ([#798](https://github.com/eizedev/pivotkit/issues/798)).
- `describeLabels(locale, own)` puts a host's own words over the locale's, at any depth. Words that
name their language (`lang`) go over that language's. Words `describeView` would refuse throw
`INVALID_ARGUMENT`. A table of forms by count takes every plural category of its `lang` ("few"
for Polish), and the result is a frozen copy.

### Changed

- The Excel number format codes (`excelNumberFormat`) are in a file of their own, `excel-format.js`.
Expand Down Expand Up @@ -43,6 +59,12 @@ All notable changes to `pivotkit-core` are documented in this file. The format i
- The sample before an average's label takes the series' colour from `colorMap` and
`chart.colors`, as the line does.

### Fixed

- `describeView` no longer says "current excluded" of a rolling relative range (`calendar: false`).
The engine counts a rolling range back from the moment itself and ignores `includeCurrent` there,
so the text said something the filter does not do.

## [0.10.0] - 2026-11-24

### Fixed
Expand Down
Loading
Loading