volto-silverpoint 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.
Files changed (53) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE +21 -0
  3. package/README.md +145 -2
  4. package/locales/en/LC_MESSAGES/volto.po +992 -0
  5. package/locales/en.ui.json +26 -0
  6. package/locales/es/LC_MESSAGES/volto.po +992 -0
  7. package/locales/es.catalog.json +248 -0
  8. package/locales/volto.pot +992 -0
  9. package/package.json +69 -3
  10. package/src/components/.gitkeep +0 -0
  11. package/src/components/Block/ChartFrame.tsx +50 -0
  12. package/src/components/Block/Edit.test.tsx +275 -0
  13. package/src/components/Block/Edit.tsx +173 -0
  14. package/src/components/Block/View.test.tsx +97 -0
  15. package/src/components/Block/View.tsx +78 -0
  16. package/src/components/Block/binding.test.ts +65 -0
  17. package/src/components/Block/binding.ts +124 -0
  18. package/src/components/Block/schema.test.ts +134 -0
  19. package/src/components/Block/schema.ts +160 -0
  20. package/src/components/Block/table.test.ts +65 -0
  21. package/src/components/Block/table.ts +118 -0
  22. package/src/components.generated.ts +321 -0
  23. package/src/config/blocks.test.ts +36 -0
  24. package/src/config/blocks.ts +36 -0
  25. package/src/config/settings.ts +5 -0
  26. package/src/i18n.test.ts +28 -0
  27. package/src/icons/silverpoint.svg +1 -0
  28. package/src/index.ts +11 -0
  29. package/src/messages.generated.ts +992 -0
  30. package/src/schema.generated.ts +2126 -0
  31. package/src/types.ts +37 -0
  32. package/vendor/embed/VENDORED.json +25 -0
  33. package/vendor/embed/chunk-HWM2EKXA.js +200 -0
  34. package/vendor/embed/chunk-HWM2EKXA.js.map +1 -0
  35. package/vendor/embed/chunk-LN5NAHZI.js +212 -0
  36. package/vendor/embed/chunk-LN5NAHZI.js.map +1 -0
  37. package/vendor/embed/client.d.ts +77 -0
  38. package/vendor/embed/client.js +492 -0
  39. package/vendor/embed/client.js.map +1 -0
  40. package/vendor/embed/conformance.d.ts +27 -0
  41. package/vendor/embed/conformance.js +734 -0
  42. package/vendor/embed/conformance.js.map +1 -0
  43. package/vendor/embed/conformance.json +705 -0
  44. package/vendor/embed/host-catalog.json +28819 -0
  45. package/vendor/embed/hosts.d.ts +117 -0
  46. package/vendor/embed/hosts.js +28992 -0
  47. package/vendor/embed/hosts.js.map +1 -0
  48. package/vendor/embed/index.d.ts +86 -0
  49. package/vendor/embed/index.js +4 -0
  50. package/vendor/embed/index.js.map +1 -0
  51. package/vendor/embed/integrity.json +6 -0
  52. package/vendor/embed/package.json +1 -0
  53. package/vendor/embed/types-DIxV3Dgv.d.ts +71 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ <!-- You should *NOT* be adding new change log entries to this file.
4
+ You should create a file in the news directory instead.
5
+ For helpful instructions, please see:
6
+ https://6.docs.plone.org/contributing/index.html#contributing-change-log-label
7
+ -->
8
+
9
+ <!-- towncrier release notes start -->
10
+
11
+ ## 0.1.0 (2026-11-27)
12
+
13
+
14
+ ### Feature
15
+
16
+ - A Volto block that draws silverpoint charts (*Silverpoint chart*), on Volto 18 and 19: table pasted, uploaded or read from a File item; sidebar generated from the host catalog; server-rendered and hydrated; English and Spanish. @ecrespo
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ernesto Crespo
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,146 @@
1
- # Temporary Holding Version
1
+ # volto-silverpoint
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
+ A [Plone Volto](https://6.docs.plone.org/volto/) add-on with one block, **Silverpoint chart**, that
4
+ draws [silverpoint](https://github.com/ecrespo/silverpoint) charts from a table. The table is pasted
5
+ or uploaded as CSV or JSON, or read from a File content item. The sidebar is generated from
6
+ silverpoint's pinned host catalog. The block renders on Volto's server and hydrates in the browser.
7
+
8
+ - 56 charts, grouped by family, each drawn by its `@silverpoint/react` component and loaded lazily
9
+ (one chunk per chart).
10
+ - One column selector per role of the chosen chart. Roles are preselected when exactly one column
11
+ fits.
12
+ - Chart options, appearance (ground, substrate, mode, palette) and the view fields (title,
13
+ description, data table).
14
+ - Sidebar labels in English and Spanish, through Volto's i18n.
15
+ - The library's stylesheet and fonts load from the add-on's own configuration, with no change to
16
+ your theme.
17
+
18
+ ## Requirements
19
+
20
+ | | |
21
+ |---|---|
22
+ | Volto | 18 and 19 (tested on 18.36.0 and 19.8.1) |
23
+ | Plone backend | 6.x with `plone.volto` and `plone.restapi` |
24
+ | Node / pnpm | Node 22+, pnpm 10 |
25
+
26
+ No backend package is needed (VOL-DD-04).
27
+
28
+ ## Install in a Volto project
29
+
30
+ ```sh
31
+ pnpm add volto-silverpoint
32
+ ```
33
+
34
+ Add it to your project's add-ons, for example in `volto.config.js`:
35
+
36
+ ```js
37
+ module.exports = { addons: ['volto-silverpoint'] };
38
+ ```
39
+
40
+ ## Using the block
41
+
42
+ 1. Add a **Silverpoint chart** block (group *Common*, allowed in every content type).
43
+ 2. Give it a table, in one of three ways:
44
+ - **Paste** CSV (comma-, semicolon- or tab-separated, RFC 4180 quotes) or JSON, either as
45
+ `[{"col": value, …}]` or as `{"columns": […], "values": [[…]]}`.
46
+ - **Upload** a `.csv` or `.json` file.
47
+ - **Table file**: choose a File item in the sidebar. Its table is fetched each time the block
48
+ renders and is referenced, not copied into the block. Use this for tables over the cap.
49
+ 3. Choose the chart type, then map its roles to columns, and set options and appearance.
50
+
51
+ Pasted and uploaded tables are stored in the block, up to **2,000 rows** (VOL-DD-02). A larger table
52
+ is refused and the editor asks for a File item. Cells that look like numbers are stored as numbers,
53
+ and empty cells as `null`.
54
+
55
+ If the table is missing, can't be read or doesn't bind to the chart, the editor shows the reason in
56
+ the block. The public view shows only the block's title and description.
57
+
58
+ ### What the block saves
59
+
60
+ The block's data is plain JSON: the chart's slug, the table, the role mapping, the options and the
61
+ appearance. No rendered markup is stored (VOL-Art. 1). `plone.restapi` returns it unchanged, so a
62
+ search index or `collective.silverpoint` can read it:
63
+
64
+ ```json
65
+ {
66
+ "@type": "silverpointChart",
67
+ "chart": "bar-chart",
68
+ "table": { "columns": ["team", "wins"], "rows": [{ "team": "A", "wins": 12 }] },
69
+ "role_x": "team",
70
+ "role_value": "wins",
71
+ "opt_orientation": "rows",
72
+ "ground": "cyanotype",
73
+ "title": "Wins per team"
74
+ }
75
+ ```
76
+
77
+ A File item replaces `table` with `"file": [{ "@id": "…/data/wins.csv" }]`.
78
+
79
+ ## Development
80
+
81
+ This repository is Cookieplone's `frontend_addon` layout. The add-on is in
82
+ `packages/volto-silverpoint/`, and `make install` checks Volto's core out into `core/`.
83
+
84
+ ```sh
85
+ make install # Volto core 19.8.1, dependencies, @plone/registry and @plone/components
86
+ make start # Volto in development mode, with the add-on
87
+ ```
88
+
89
+ To work on Volto 18 instead, run `make install-volto18` (`VOLTO18_VERSION`, 18.36.0 by default). It
90
+ clones Volto 18 into `core/` and installs without the lockfile, because `pnpm-lock.yaml` is Volto 19's
91
+ and stays untouched. `make clean install` goes back to Volto 19.
92
+
93
+ > If your npm configuration sets `ignore-scripts=true`, the `lightningcss-cli` binary is not
94
+ > linked and `make install` fails while building `@plone/components` (`lightningcss: This: not
95
+ > found`). Run `node postinstall.js` in `node_modules/.pnpm/lightningcss-cli@*/node_modules/lightningcss-cli`,
96
+ > then `pnpm --filter @plone/components build`.
97
+
98
+ ### Checks
99
+
100
+ ```sh
101
+ cd packages/volto-silverpoint
102
+ pnpm generate # schema fragments, messages, lazy chart map and catalogs, from vendor/embed/host-catalog.json
103
+ pnpm check # the generated files are current (H-3); vendor/embed matches VENDORED.json (H-2)
104
+ pnpm typecheck # tsc --noEmit, strict
105
+ pnpm conformance # silverpoint's conformance kit through the module entry the add-on resolves
106
+ pnpm test # Vitest, with Volto's configuration
107
+ cd ../..
108
+ pnpm lint # Volto's ESLint (also: make lint for Prettier and Stylelint)
109
+ pnpm build # a production build with the add-on (client and server)
110
+ ```
111
+
112
+ ### Acceptance tests (Playwright)
113
+
114
+ They test the production build, served by Volto's server, against a Plone acceptance backend: the
115
+ server's HTML, hydration with no mismatch, keyboard reading, axe, the block in `plone.restapi`, and the
116
+ editor (the block, its generated sidebar and a binding error). Serve Volto on port 3000: the acceptance
117
+ backend only allows CORS from there, and the editor calls the backend from the browser.
118
+
119
+ ```sh
120
+ make acceptance-backend-start # Plone on :55001 (Docker, plone/server-acceptance:6)
121
+ pnpm build
122
+ (cd core/packages/volto && RAZZLE_API_PATH=http://127.0.0.1:55001/plone PORT=3000 NODE_ENV=production node build/server.js)
123
+ npx playwright install chromium # once
124
+ npx playwright test -c acceptance/playwright.config.ts
125
+ ```
126
+
127
+ CI runs all of this on Volto 19 and Volto 18 in `.github/workflows/silverpoint.yml`, alongside the
128
+ template's `main.yml`.
129
+
130
+ ### The engine
131
+
132
+ The chart components come from `@silverpoint/react` 0.10.1 on npm. The binding (`specFromTable`),
133
+ the host catalog and the conformance kit come from `@silverpoint/embed` 0.10.1, vendored unmodified
134
+ in `packages/volto-silverpoint/vendor/embed/` with SHA-384 digests in `VENDORED.json` until it is on
135
+ npm (VOL-D1). To update both, run `node scripts/vendor.mjs X.Y.Z` (or `--from PATH`), bump
136
+ `@silverpoint/*` and `silverpoint.engine` in `package.json`, then run `pnpm generate`. Every list in
137
+ the sidebar is generated: none is typed by hand.
138
+
139
+ ### Specs
140
+
141
+ `specs/` holds the constitution, the PRD (VOL-REQ-001..011), the technical design, the tasks ledger
142
+ and the PoC findings. Each test cites the requirement it checks.
143
+
144
+ ## Licence
145
+
146
+ MIT.