pivotkit-element 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 ADDED
@@ -0,0 +1,143 @@
1
+ # Changelog
2
+
3
+ All notable changes to `pivotkit-element` are documented in this file. The format is based on
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this package adheres to
5
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.2.0] - 2026-11-08
10
+
11
+ ### Added
12
+
13
+ - pivotkit-react's warning for a view's unused parts, in plain words
14
+ ([#56](https://github.com/eizedev/pivotkit/issues/56)): its words are a chunk of their own (the
15
+ load group "unused", 4.2 KiB measured, budget 4.7), loaded only when a view has such parts; the
16
+ first load holds the warning's frame and pivotkit-core's issue codes (149.4 KiB measured, budget
17
+ raised from 149 to 150). Label changes as in pivotkit-react: `unusedParts`, `unusedPath`, `unusedMore` and `unusedFewer` new,
18
+ `issues`, `viewMissingFields`, `viewOtherIssue` and `viewOtherIssues` gone, `labels.unused` for the
19
+ lines. No new attribute or event.
20
+ - pivotkit-react's sorting with a click on a table header
21
+ ([#55](https://github.com/eizedev/pivotkit/issues/55)): a value's name sorts the innermost row
22
+ field by it, a row field's name A to Z and Z to A; a `pivot-view-change` like the chip menu's sort.
23
+ No new attribute or event.
24
+ - pivotkit-react's Save, Save as and New for views
25
+ ([#60](https://github.com/eizedev/pivotkit/issues/60)): Save on a user's view sends
26
+ `pivot-template-save` (with `save-templates`) or writes the browser store, Save on a shared view
27
+ sends `pivot-template-publish` (with `can-publish` and after the user confirmed, else it is off
28
+ with the reason), Save as onto a name that exists asks the user first. No new attribute or event.
29
+ - Host notes: `pivot-template-save` and `pivot-template-publish` come with a name that exists for
30
+ Save and for Save as after the user confirmed: the page replaces the view of that name (an upsert
31
+ by name), it does not add a second one.
32
+
33
+ ### Changed
34
+
35
+ - pivotkit-react's field chip menu with each setting in one line and folded menu sections that say
36
+ what they hold ([#57](https://github.com/eizedev/pivotkit/issues/57)); no new attribute or event.
37
+ The menus' size budget is 20 KiB (19.3 measured).
38
+
39
+ - What runs only after a click left the first load
40
+ ([#73](https://github.com/eizedev/pivotkit/issues/73)): the menus' view changes, sharing's copy,
41
+ download and load, the drill-down's table and the texts only they show load with the menus, the
42
+ chart's label layout with the chart. The first load is 147.8 KiB gzip (152.2 before, measured on one
43
+ Mac), the menus 22.8, their German texts 4.4. Every size budget of a loaded chunk is now 3 to 5 % above what CI
44
+ measures, the first load's about 1 KiB: initial 149, chart 211, export 11.5, link 7.3, menus 24, texts 4.9. No new attribute
45
+ or event.
46
+
47
+ - pivotkit-react's menu texts in German are a chunk of their own, loaded with the menus only for a
48
+ German report or when `locale` changes to German, and the menus' sections moved out of the first
49
+ load ([#73](https://github.com/eizedev/pivotkit/issues/73)): the menus 20.6 to 17.9 KiB gzip, the
50
+ first load 152.1 to 152.2 with the loading of the texts and English standing in when they fail
51
+ (measured on one Mac); a German page loads the texts' 4.0 KiB on top. The
52
+ size check has a group "texts" for it (budget 4.5 KiB).
53
+
54
+ - The README, the package's page on npm, is a short landing page: what pivotkit-element is, one screenshot,
55
+ install, one example and a table of links into the
56
+ [documentation site](https://pivotkit.eize.dev/), which holds the details.
57
+ - pivotkit-react's toolbar: Views is the last button to move into "More", so it stays in the toolbar
58
+ from about 1280 px (the chart type moves into "More" before it); New is in the Views menu only.
59
+ Every save closes the Views menu; the question before a view is replaced has the focus on Cancel;
60
+ the view loaded has a check mark in its group, and More the dot for unsaved changes while Views
61
+ is in it.
62
+
63
+ ### Fixed
64
+
65
+ - No `pivot-export` for an empty report: its Export entries are off with "Add a field first."
66
+ ([#61](https://github.com/eizedev/pivotkit/issues/61)).
67
+
68
+ ## [0.1.0] - 2026-11-07
69
+
70
+ First release.
71
+
72
+ ### Added
73
+
74
+ - The attribute `field-list` (`"open"`, `"collapsed"`): the field list collapsed to a rail, as
75
+ pivotkit-react's `fieldList`.
76
+ - Templates as pivotkit-react's: `templates` entries with `scope` and `file`, the attributes
77
+ `template-store` (`"browser"`: "My views" in localStorage, no event for its saves and deletes) and
78
+ `can-publish`, the event `pivot-template-publish` (`{ name, view, respondWith }`), and `scope` in
79
+ the details of `pivot-template-save` and `pivot-template-delete`.
80
+ - `pivot-export` also for every copy and the drill-down's exports: kinds `copy-table`, `copy-json`,
81
+ `drill-copy`, `drill-json`, `drill-csv`, `drill-xlsx`; a copy has `text`, a drill-down export
82
+ `rows: { shown, count }`; `preventDefault()` keeps a copy from the clipboard as it keeps a file
83
+ from the download. The Export menu loads with the menus (first load 151.0 KiB measured, budget 152
84
+ unchanged); the menus' budget is 17.5 KiB (16.4 measured), the export's 11.5 (10.6 with the rows
85
+ export, TSV and JSON); the size check follows the chunks a chunk loads (the export is loaded from
86
+ the menus).
87
+ - Attributes `share-link`, `persist-view`, `loading`, `field-info` and `zone-info`, and the property
88
+ `chartOptions`, as pivotkit-react's props; `pivot-export` also for a downloaded view (`kind`
89
+ `"json"`). pivotkit-core's link module is a chunk of its own, loaded on the first link; the size
90
+ budget of the first load is 152 KiB (150.7 measured with the chart display settings, sharing, the
91
+ skeleton, the menu changes, the value conditions and locale number entry).
92
+ - Attributes `tips` ("on", "off" or a comma-separated list of tip ids) and `storage-key`, the property
93
+ `dismissedTips` and the event `pivot-tip-dismiss` (`{ id, dismissed }`), as pivotkit-react's tips
94
+ props; `fieldDefaults` takes `label`, `description`, `href` and `type`.
95
+ - The attribute `grow` (pivotkit-react's `grow`: past the height or inside it).
96
+ - The menus' texts load with the menus (pivotkit-react's `menu-labels.js`): the first load stays
97
+ within its 152 KiB budget (151.0 measured with the automatic chart type, the field list's keys, the
98
+ touch targets and the settings' explanations loaded with the menus); the menus' budget is 15 KiB
99
+ (13.8 measured).
100
+ - The attribute `schema-url` (pivotkit-react's `schemaUrl`: the `$schema` of the view files; `""` for none).
101
+ - Attributes `setting-info` (the "i" next to the settings, as pivotkit-react's `settingInfo`),
102
+ `source-id` and `source-name` (the data shown, for the shared view files and the check before a
103
+ view for other data loads), the property `sources` and the event `pivot-source-switch`
104
+ (`{ source, view, name }`: "Switch to … and load"). Full screen works on the report inside the
105
+ shadow root.
106
+
107
+ - `<pivot-report>`: pivotkit-react's `<PivotReport>` as a custom element in an open shadow root, with
108
+ its own React 18.3.1, ReactDOM, pivotkit-react, pivotkit-core and @dnd-kit in the bundle; ECharts
109
+ (bar, line, pie and heatmap only) and the XLSX/CSV export are chunks loaded on first use.
110
+ - Properties `data`, `dataKey`, `view`, `defaultView`, `templates`, `labels`, `fieldDefaults`, `limits`;
111
+ reflected attributes `locale` (else the element's `lang`), `theme`, `height`, `time-zone`,
112
+ `file-name`, `drill-down`, `drill-down-limit`, `save-templates`; JSON attributes `view` and
113
+ `default-view`. Controlled and uncontrolled as in pivotkit-react; a different `defaultView` starts
114
+ the report again on it, the view the report last reported does not. `height="100%"` fills the
115
+ element.
116
+ - Events `pivot-view-change`, `pivot-cell-click`, `pivot-template-save` and `pivot-template-delete`
117
+ (answered with `detail.respondWith(promise)`, a console warning when nothing answered), and
118
+ `pivot-export` (cancelable: the page keeps the file); all bubble and are composed.
119
+ - Styles in the shadow root as one shared constructed stylesheet (a `<style>` element where there is
120
+ none); the `--pk-*` tokens are declared on `:host`, so the page themes the element with rules on it
121
+ and nothing else crosses; `data-pk-theme` on the element tells the theme shown.
122
+ - Lifecycle: properties set before the definition are taken over, a disconnected element unmounts its
123
+ React root (a move in the same task keeps it), a reconnected one mounts again on its last view.
124
+ - `define(name)` for another tag name; loading the package twice does not throw and warns with both
125
+ versions (`PivotReportElement.version`). Imports in Node without defining anything.
126
+ - Type declarations: the element, `PivotReportEventMap`, `HTMLElementTagNameMap` and the event map of
127
+ the DOM; `pivotkit-element/jsx` declares the element in React's JSX.
128
+ - `dist/THIRD_PARTY_LICENSES.txt` with the license texts of the bundled packages; a size budget per
129
+ load group (`npm run size`).
130
+ - `fieldDefaults[field].drillFormat` as in pivotkit-react: the format of a field's values in the
131
+ drill-down.
132
+ - Attribute and property `label`: the name of the report's region landmark, one per report on a
133
+ page.
134
+ - Everything of pivotkit-core and pivotkit-react 0.1.0 in the bundle, among it number ranges with
135
+ "Starting at", custom sort orders (`fieldDefaults[field].order`, reversed too, also for saved views),
136
+ unclickable empty cells with a text for screen readers, row labels that wrap on a phone and are
137
+ shown whole in the status line of a long table, one header for a single value, year ranges without
138
+ thousands separators, CSV percentages and calculations as the table shows them, heatmaps without
139
+ grey empty cells.
140
+
141
+ [Unreleased]: https://github.com/eizedev/pivotkit/compare/pivotkit-element@0.2.0...HEAD
142
+ [0.2.0]: https://github.com/eizedev/pivotkit/compare/pivotkit-element@0.1.0...pivotkit-element@0.2.0
143
+ [0.1.0]: https://github.com/eizedev/pivotkit/releases/tag/pivotkit-element@0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 eizedev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,74 @@
1
- # Temporary Holding Version
1
+ # pivotkit-element
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The pivot report builder of [pivotkit](https://pivotkit.eize.dev/) as one web component,
4
+ `<pivot-report>`, for pages without React: Angular apps, PHP and other server-rendered pages, plain
5
+ HTML. It brings its own React ([which version](https://pivotkit.eize.dev/browser-support/#react)), [pivotkit-react](https://www.npmjs.com/package/pivotkit-react),
6
+ [pivotkit-core](https://www.npmjs.com/package/pivotkit-core) and @dnd-kit, renders into an open shadow
7
+ root and loads ECharts on the first chart. Everything the React component does works the same: field
8
+ list, drag and drop, table and chart, filters, drill-down, undo, saved and shared views, export.
9
+
10
+ ![A line chart of monthly revenue per category](https://pivotkit.eize.dev/assets/screenshots/chart-light.png)
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ npm install pivotkit-element
16
+ ```
17
+
18
+ With a bundler, `import "pivotkit-element";` once defines `<pivot-report>`. Without one, serve the
19
+ package's whole `dist/` directory: its chunks are loaded by relative URL from `dist/index.js`, so
20
+ `index.js` alone is not enough. The package has no runtime dependency; the licenses of what it
21
+ bundles are in `dist/THIRD_PARTY_LICENSES.txt`. Browsers: Chrome 111, Firefox 113, Safari 16.4 or
22
+ later.
23
+
24
+ ## Example
25
+
26
+ ```html
27
+ <script type="module" src="/assets/pivotkit-element/dist/index.js"></script>
28
+
29
+ <pivot-report
30
+ locale="de-DE"
31
+ height="640"
32
+ default-view='{"rows":["Region"],"values":[{"field":"Sales","agg":"sum"}]}'
33
+ ></pivot-report>
34
+
35
+ <script type="module" src="/assets/report.js"></script>
36
+ ```
37
+
38
+ ```js
39
+ // report.js
40
+ const report = document.querySelector("pivot-report");
41
+ report.data = rows; // an array of objects, property only
42
+ report.templates = [{ name: "By region", view: { rows: ["Region"] } }];
43
+ report.addEventListener("pivot-view-change", (e) => localStorage.setItem("view", JSON.stringify(e.detail.view)));
44
+ ```
45
+
46
+ ## Where in the docs
47
+
48
+ | Topic | Page |
49
+ | --- | --- |
50
+ | Getting started: install, first report, saving views on a server | [Getting started with the web component](https://pivotkit.eize.dev/getting-started/web-component/) |
51
+ | PHP and server-rendered pages | [PHP and other server-rendered pages](https://pivotkit.eize.dev/getting-started/web-component/#php-and-other-server-rendered-pages) |
52
+ | Angular | [Angular](https://pivotkit.eize.dev/getting-started/web-component/#angular), [Angular and zone.js](https://pivotkit.eize.dev/reference/element/#angular-and-zonejs) |
53
+ | A page with React of its own | [React on the page](https://pivotkit.eize.dev/reference/element/#react-on-the-page) |
54
+ | Entries, loading from a CDN | [Entries](https://pivotkit.eize.dev/reference/element/#entries), [Loading](https://pivotkit.eize.dev/reference/element/#loading) |
55
+ | Every property and attribute | [Properties and attributes](https://pivotkit.eize.dev/reference/element/#properties-and-attributes) |
56
+ | Controlled and uncontrolled | [Controlled and uncontrolled](https://pivotkit.eize.dev/reference/element/#controlled-and-uncontrolled) |
57
+ | Events | [Events](https://pivotkit.eize.dev/reference/element/#events) |
58
+ | Styles and theming | [Styles](https://pivotkit.eize.dev/reference/element/#styles), [Theming](https://pivotkit.eize.dev/reference/theming/#on-the-web-component) |
59
+ | Languages and labels | [Localisation](https://pivotkit.eize.dev/reference/localisation/) |
60
+ | The view, saved and shared views | [Views and saved views](https://pivotkit.eize.dev/concepts/views/), [Templates and shared views](https://pivotkit.eize.dev/concepts/templates/), [View file format](https://pivotkit.eize.dev/reference/view-file/) |
61
+ | TypeScript | [Types](https://pivotkit.eize.dev/reference/element/#types) |
62
+ | Bundle size | [Bundle size](https://pivotkit.eize.dev/reference/element/#bundle-size) |
63
+ | Content-Security-Policy | [Security](https://pivotkit.eize.dev/security/#content-security-policy) |
64
+ | Limits | [Locale, time zones, limits and errors](https://pivotkit.eize.dev/concepts/limits/#limits) |
65
+ | Browser support | [Browser support](https://pivotkit.eize.dev/browser-support/) |
66
+ | Recipes | [Recipes](https://pivotkit.eize.dev/embed/recipes/) |
67
+ | What the people using the report can do | [Use a report](https://pivotkit.eize.dev/use/) |
68
+ | Try it | [Live demo and the element example](https://pivotkit.eize.dev/demo/#the-web-component-example), [feature list](https://pivotkit.eize.dev/features/), [FAQ](https://pivotkit.eize.dev/faq/) |
69
+ | Changes | [CHANGELOG](https://github.com/eizedev/pivotkit/blob/main/packages/pivotkit-element/CHANGELOG.md) |
70
+
71
+ ## License
72
+
73
+ [MIT](https://github.com/eizedev/pivotkit/blob/main/LICENSE); the bundled packages under their own
74
+ licenses, see `dist/THIRD_PARTY_LICENSES.txt`.