@dashspec/renderer 0.1.6 → 0.1.8

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/docs/theming.md CHANGED
@@ -103,6 +103,28 @@ const acme = createTheme({
103
103
 
104
104
  `createTheme` never changes its input or the base theme.
105
105
 
106
+ ## Per-widget overrides
107
+
108
+ `widgets` in `createTheme` styles every panel of one widget kind (built-in or your own) and carries
109
+ settings for your own widgets. It is scoped to the dashboards using that theme.
110
+
111
+ ```ts
112
+ const theme = createTheme({
113
+ widgets: {
114
+ Kpi: {
115
+ vars: { "--ds-type-kpi-size": "32px" }, // any --ds-* token, or your own variables
116
+ css: "& .ds-kpi-label { text-transform: uppercase; }", // & is the panel
117
+ },
118
+ "acme.Gauge": { settings: { ring: "thick" } }, // read by your widget
119
+ },
120
+ });
121
+ ```
122
+
123
+ Each panel carries `data-kind="<kind>"`, which is what these rules target. Your own widget
124
+ (registered with `widgets` on the provider or renderer) reads its entry with
125
+ `useThemeTokens()?.theme.widgets?.["acme.Gauge"]`. Variable names must look like `--name`; values
126
+ with `;`, braces or `<>` are dropped, and `css` may not contain a `<style>` tag.
127
+
106
128
  ## Use a theme
107
129
 
108
130
  Pass it to the renderer, a provider, or a design system:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashspec/renderer",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Draws a dashboard from DashSpec JSON: widgets, data, events, state.",
5
5
  "keywords": [
6
6
  "dashboard",