@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/CHANGELOG.md +23 -1
- package/dist/{chunk-U4JCC3MX.js → chunk-CLT55JEM.js} +2 -2
- package/dist/{chunk-U4JCC3MX.js.map → chunk-CLT55JEM.js.map} +1 -1
- package/dist/{core-BnA2w3yb.d.ts → core-CKNOs-JN.d.ts} +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.d.ts +22 -3
- package/dist/index.js +218 -170
- package/dist/index.js.map +1 -1
- package/docs/theming.md +22 -0
- package/package.json +1 -1
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:
|