@dashspec/renderer 0.1.24 → 0.1.26
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 +15 -0
- package/dist/{chunk-2MDF5QTY.js → chunk-IMQSGBGY.js} +2 -2
- package/dist/{chunk-2MDF5QTY.js.map → chunk-IMQSGBGY.js.map} +1 -1
- package/dist/{core-CoD8E3Nf.d.ts → core-CM3wqmfR.d.ts} +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.d.ts +30 -5
- package/dist/index.js +142 -3
- package/dist/index.js.map +1 -1
- package/docs/styling-hooks.md +61 -0
- package/docs/theming.md +4 -1
- package/package.json +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Styling hooks: CSS classes and attributes
|
|
2
|
+
|
|
3
|
+
`theme.widgets["Kind"]` and `theme.widgets["Kind:variant"]` take a `css` string where `&` is the panel
|
|
4
|
+
(see [theming.md](theming.md)). These are the class names and attributes inside a panel you can target.
|
|
5
|
+
They are part of the public contract: a name listed here is not renamed or removed within a major version
|
|
6
|
+
(`test/css-hooks.test.ts` fails if one disappears from the source). Anything not listed is internal.
|
|
7
|
+
|
|
8
|
+
## Two ways to write `css`
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
widgets: {
|
|
12
|
+
// A string: plain CSS, `&` is the panel.
|
|
13
|
+
"Kpi": { css: "& .ds-kpi-label { text-transform: uppercase; }" },
|
|
14
|
+
// An object: your editor suggests every "& .ds-…" selector below and type-checks the properties.
|
|
15
|
+
"Kpi:hero": {
|
|
16
|
+
css: {
|
|
17
|
+
"& .ds-kpi-label": { textTransform: "uppercase", fontSize: 12 }, // numbers become px
|
|
18
|
+
"&:hover": { boxShadow: "var(--ds-shadow-md)", "--ds-space-md": "8px" },
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Any other selector still works in the object (`"& td:nth-child(2)"`). `DS_CLASSES` and the `DsClass` type are
|
|
25
|
+
exported if you need the list in code.
|
|
26
|
+
|
|
27
|
+
## Attributes on every panel
|
|
28
|
+
|
|
29
|
+
| Attribute | Value |
|
|
30
|
+
|---|---|
|
|
31
|
+
| `data-panel` | the panel id |
|
|
32
|
+
| `data-kind` | the widget kind, e.g. `Kpi` |
|
|
33
|
+
| `data-variant` | the panel's `style.variant` |
|
|
34
|
+
| `data-nested` | set on a panel drawn inside a slot |
|
|
35
|
+
|
|
36
|
+
Prefer `theme.widgets` (scoped by kind/variant) over global selectors on these.
|
|
37
|
+
|
|
38
|
+
## Classes by widget
|
|
39
|
+
|
|
40
|
+
| Widget | Classes |
|
|
41
|
+
|---|---|
|
|
42
|
+
| Breakdown | `.ds-donut`, `.ds-dot`, `.ds-kpi-sub`, `.ds-legend`, `.ds-meter-head`, `.ds-meter-value`, `.ds-meters`, `.ds-progress`, `.ds-segbar` |
|
|
43
|
+
| CardGrid | `.ds-card`, `.ds-card-fields`, `.ds-card-head`, `.ds-cards`, `.ds-chip-count`, `.ds-pill`, `.ds-progress` |
|
|
44
|
+
| Container | `.ds-container`, `.ds-slot-hint` |
|
|
45
|
+
| Content | `.ds-content` |
|
|
46
|
+
| Filter | `.ds-filter-missing`, `.ds-filter-widget` |
|
|
47
|
+
| Image | `.ds-plain`, `.ds-state` |
|
|
48
|
+
| ImageMap | `.ds-imagemap`, `.ds-marker` |
|
|
49
|
+
| Kpi | `.ds-chip`, `.ds-kpi`, `.ds-kpi-delta`, `.ds-kpi-empty`, `.ds-kpi-foot`, `.ds-kpi-label`, `.ds-kpi-main`, `.ds-kpi-sub`, `.ds-kpi-unit`, `.ds-kpi-value`, `.ds-progress` |
|
|
50
|
+
| StageTracker | `.ds-stage-dot`, `.ds-stages` |
|
|
51
|
+
| StateTimeline | `.ds-dot`, `.ds-legend`, `.ds-timeline`, `.ds-timeline-axis`, `.ds-timeline-bar`, `.ds-timeline-lane`, `.ds-timeline-name` |
|
|
52
|
+
| Status | `.ds-dot`, `.ds-pill`, `.ds-status`, `.ds-status-label` |
|
|
53
|
+
| Table | `.ds-button`, `.ds-cell`, `.ds-cell-empty`, `.ds-cell-filter`, `.ds-cell-list`, `.ds-cell-sub`, `.ds-cell-value`, `.ds-chip`, `.ds-filter-row`, `.ds-inline`, `.ds-link`, `.ds-page-gap`, `.ds-pager`, `.ds-pager-of`, `.ds-pager-range`, `.ds-pager-size`, `.ds-pages`, `.ds-progress`, `.ds-row-detail`, `.ds-search`, `.ds-sort`, `.ds-spacer`, `.ds-table`, `.ds-table-busy`, `.ds-table-count`, `.ds-table-scroll`, `.ds-table-tools`, `.ds-table-wrap` |
|
|
54
|
+
| Tiles | `.ds-chip-count`, `.ds-dot`, `.ds-kpi-unit`, `.ds-tile`, `.ds-tile-caption`, `.ds-tile-label`, `.ds-tile-main`, `.ds-tile-value`, `.ds-tiles` |
|
|
55
|
+
| Atoms (Text, Value, Progress, Icon, Divider, Button) | `.ds-atom-divider`, `.ds-atom-icon`, `.ds-atom-progress`, `.ds-atom-text`, `.ds-atom-value`, `.ds-button` |
|
|
56
|
+
| BarChart, LineChart, PieChart, Scatter, Gauge | `.ds-chart`, `.ds-chart-legend`, `.ds-swatch`, `.ds-swatch-line` |
|
|
57
|
+
| Card, Tabs, Repeater | `.ds-card-body`, `.ds-repeater`, `.ds-repeater-item`, `.ds-slot-hint`, `.ds-state`, `.ds-tabs`, `.ds-tabs-bar`, `.ds-tabs-panel` |
|
|
58
|
+
| Every panel (frame) | `.ds-badge`, `.ds-crumbs`, `.ds-live`, `.ds-loading`, `.ds-loading-text`, `.ds-panel`, `.ds-panel-addons`, `.ds-panel-body`, `.ds-panel-foot`, `.ds-panel-head`, `.ds-panel-meta`, `.ds-panel-title`, `.ds-panel-toolbar`, `.ds-panel-tools`, `.ds-part-selected`, `.ds-skeleton`, `.ds-state` |
|
|
59
|
+
|
|
60
|
+
The dashboard root is `ds-root` (`data-ds-theme="light|dark"`). Colours, fonts and sizes are better changed
|
|
61
|
+
through tokens (`--ds-*` variables) than through these classes; use classes for layout and details tokens don't cover.
|
package/docs/theming.md
CHANGED
|
@@ -114,7 +114,7 @@ const theme = createTheme({
|
|
|
114
114
|
widgets: {
|
|
115
115
|
Kpi: {
|
|
116
116
|
vars: { "--ds-type-kpi-size": "32px" }, // any --ds-* token, or your own variables
|
|
117
|
-
css: "& .ds-kpi-label { text-transform: uppercase; }", // & is the panel
|
|
117
|
+
css: "& .ds-kpi-label { text-transform: uppercase; }", // & is the panel; classes: docs/styling-hooks.md
|
|
118
118
|
},
|
|
119
119
|
"acme.Gauge": { settings: { ring: "thick" } }, // read by your widget
|
|
120
120
|
},
|
|
@@ -267,3 +267,6 @@ is merged last:
|
|
|
267
267
|
`echartsTheme(theme, mode)` returns the ECharts theme object built from the tokens, if
|
|
268
268
|
you draw your own ECharts charts and want them to match. Inside a widget,
|
|
269
269
|
`useThemeTokens()` gives you `{ theme, mode }`.
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
The class names and attributes you can target in `css` are listed in [styling-hooks.md](styling-hooks.md).
|