@slotted/angular 0.1.0-beta.16 → 0.1.0-beta.17
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/dashboard-grid.json +6 -6
- package/docs/dashboard-grid.md +11 -5
- package/docs/guidelines/index.md +2 -0
- package/docs/guidelines/layout-alignment.md +2 -2
- package/docs/guidelines/overviews.md +21 -1
- package/docs/page.json +2 -2
- package/docs/page.md +1 -1
- package/docs/skills/compose-screen/SKILL.md +10 -1
- package/docs/skills/review-screen/SKILL.md +22 -20
- package/docs/stat-card.json +7 -4
- package/docs/stat-card.md +4 -4
- package/fesm2022/slotted-angular-chart.mjs +6 -0
- package/fesm2022/slotted-angular-chart.mjs.map +1 -1
- package/fesm2022/slotted-angular-dashboard-grid.mjs +60 -18
- package/fesm2022/slotted-angular-dashboard-grid.mjs.map +1 -1
- package/fesm2022/slotted-angular-page.mjs +26 -6
- package/fesm2022/slotted-angular-page.mjs.map +1 -1
- package/fesm2022/slotted-angular-stat-card.mjs +37 -6
- package/fesm2022/slotted-angular-stat-card.mjs.map +1 -1
- package/package.json +3 -3
- package/types/slotted-angular-chart.d.ts +9 -9
- package/types/slotted-angular-chart.d.ts.map +1 -1
- package/types/slotted-angular-dashboard-grid.d.ts +27 -7
- package/types/slotted-angular-dashboard-grid.d.ts.map +1 -1
- package/types/slotted-angular-page.d.ts +7 -1
- package/types/slotted-angular-page.d.ts.map +1 -1
- package/types/slotted-angular-stat-card.d.ts +8 -3
- package/types/slotted-angular-stat-card.d.ts.map +1 -1
package/docs/dashboard-grid.json
CHANGED
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
"type": "DashboardLayout",
|
|
244
244
|
"defaultValue": "[]",
|
|
245
245
|
"appliesTo": "[slDashboardGrid]",
|
|
246
|
-
"description": "The uncontrolled start. A widget it does not name takes the first cell it fits, in the order of the children"
|
|
246
|
+
"description": "The uncontrolled start, and what Reset asks for, bound or not. A widget it does not name takes the first cell it fits, in the order of the children"
|
|
247
247
|
},
|
|
248
248
|
{
|
|
249
249
|
"name": "editing",
|
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
"type": "string",
|
|
314
314
|
"defaultValue": "—",
|
|
315
315
|
"appliesTo": "sl-dashboard-widget",
|
|
316
|
-
"description": "The widget’s key in the layout. Required"
|
|
316
|
+
"description": "The widget’s key in the layout. Required. The grid finds a widget in its own content, inside an ng-container, or inside a component of the application"
|
|
317
317
|
},
|
|
318
318
|
{
|
|
319
319
|
"name": "title",
|
|
@@ -348,7 +348,7 @@
|
|
|
348
348
|
"type": "'auto'",
|
|
349
349
|
"defaultValue": "—",
|
|
350
350
|
"appliesTo": "sl-dashboard-widget",
|
|
351
|
-
"description": "Draws the widget as
|
|
351
|
+
"description": "Draws the widget as tall as its content, to a twelfth of a row’s step, and the widgets below rise or make room; at least one sub-row, or minRows when stated, at most maxRows. Moves and resizes read the content’s rows, rounded up"
|
|
352
352
|
},
|
|
353
353
|
{
|
|
354
354
|
"name": "minColumns",
|
|
@@ -506,10 +506,10 @@
|
|
|
506
506
|
},
|
|
507
507
|
{
|
|
508
508
|
"name": "persistedDashboardLayout",
|
|
509
|
-
"type": "({ key, storage?, defaultLayout?, injector? }) => { layout, clear }",
|
|
509
|
+
"type": "({ key, storage?, defaultLayout?, injector? }) => { layout, defaultLayout, clear }",
|
|
510
510
|
"defaultValue": "localStorage",
|
|
511
511
|
"appliesTo": "an injection context",
|
|
512
|
-
"description": "A signal read once from the store and written after every change; bind it with [(layout)]"
|
|
512
|
+
"description": "A signal read once from the store and written after every change; bind it with [(layout)], and its defaultLayout to [defaultLayout], which Reset asks for"
|
|
513
513
|
}
|
|
514
514
|
],
|
|
515
515
|
"composition": [],
|
|
@@ -679,7 +679,7 @@
|
|
|
679
679
|
"title": "A layout kept across visits",
|
|
680
680
|
"note": "Carry or pull a widget and reload the page: the layout comes back from localStorage under the key trailhead-sales. Forget layout clears it. Text the store cannot read falls back to the default.",
|
|
681
681
|
"language": "ts",
|
|
682
|
-
"source": "@Component({\n template: `<div
|
|
682
|
+
"source": "@Component({\n template: `<div\n slDashboardGrid\n [(layout)]=\"persisted.layout\"\n [defaultLayout]=\"persisted.defaultLayout\"\n >\n …\n </div>`,\n})\nclass SalesPage {\n readonly persisted = persistedDashboardLayout({ key: 'trailhead-sales' });\n}\n",
|
|
683
683
|
"verdict": "excerpt"
|
|
684
684
|
},
|
|
685
685
|
{
|
package/docs/dashboard-grid.md
CHANGED
|
@@ -67,7 +67,7 @@ Excerpt — not a complete module
|
|
|
67
67
|
| Name | Type | Default | Applies to | Description |
|
|
68
68
|
| --- | --- | --- | --- | --- |
|
|
69
69
|
| `layout` | `DashboardLayout` | — | [slDashboardGrid] | Where each widget stands and how big it is: [{ key, x, y, w, h, hidden? }] in cells of the expanded class. Present means controlled |
|
|
70
|
-
| `defaultLayout` | `DashboardLayout` | [] | [slDashboardGrid] | The uncontrolled start. A widget it does not name takes the first cell it fits, in the order of the children |
|
|
70
|
+
| `defaultLayout` | `DashboardLayout` | [] | [slDashboardGrid] | The uncontrolled start, and what Reset asks for, bound or not. A widget it does not name takes the first cell it fits, in the order of the children |
|
|
71
71
|
| `editing` | `boolean` | false | [slDashboardGrid] | The edit mode. Present means controlled |
|
|
72
72
|
| `defaultEditing` | `boolean` | false | [slDashboardGrid] | The uncontrolled mode, read once |
|
|
73
73
|
| `columns` | `number \| { expanded, medium, compact }` | 12 | [slDashboardGrid], provideDashboardGridDefaults | Columns from 1024 pixels of the grid’s width; below it the widgets flow in halves and wholes of half as many, and below 600 in one column |
|
|
@@ -77,12 +77,12 @@ Excerpt — not a complete module
|
|
|
77
77
|
| `messages` | `Partial<DashboardGridMessages>` | — | [slDashboardGrid] | Words laid over the language in force, key by key: editBar, editStatus, add, reset, cancel, done, handle, detail, retry, emptyTitle, errorTitle, empty, emptyEditing, the eight menu items, hide, size, moved, movedInOrder, resized, hidden, shown, resetDone, cancelled |
|
|
78
78
|
| `exportAs slDashboardGrid` | `SlDashboardGrid` | — | [slDashboardGrid] | focusWidget(key), commitEditing(), cancelEditing(), currentLayout(), isEditing() |
|
|
79
79
|
| `host attributes` | `the element slDashboardGrid is on` | — | [slDashboardGrid] | id, class, style, data-* and events stay on the host; aria-label and aria-labelledby name the list |
|
|
80
|
-
| `value` | `string` | — | sl-dashboard-widget | The widget’s key in the layout. Required |
|
|
80
|
+
| `value` | `string` | — | sl-dashboard-widget | The widget’s key in the layout. Required. The grid finds a widget in its own content, inside an ng-container, or inside a component of the application |
|
|
81
81
|
| `title` | `string` | — | sl-dashboard-widget | The heading, the article’s name, the handle’s name and the entry in Add widget. Required |
|
|
82
82
|
| `description` | `string` | — | sl-dashboard-widget | The line under the title |
|
|
83
83
|
| `defaultColumns` | `number` | 4 | sl-dashboard-widget | Expanded columns of a widget the layout does not name |
|
|
84
84
|
| `defaultRows` | `number` | 2 | sl-dashboard-widget | Rows of a widget the layout does not name |
|
|
85
|
-
| `rows` | `'auto'` | — | sl-dashboard-widget | Draws the widget as
|
|
85
|
+
| `rows` | `'auto'` | — | sl-dashboard-widget | Draws the widget as tall as its content, to a twelfth of a row’s step, and the widgets below rise or make room; at least one sub-row, or minRows when stated, at most maxRows. Moves and resizes read the content’s rows, rounded up |
|
|
86
86
|
| `minColumns` | `number` | 2 | sl-dashboard-widget | The fewest expanded columns a resize leaves |
|
|
87
87
|
| `maxColumns` | `number` | columns | sl-dashboard-widget | The most expanded columns a resize gives |
|
|
88
88
|
| `minRows` | `number` | 2 | sl-dashboard-widget | The fewest rows a resize leaves |
|
|
@@ -105,7 +105,7 @@ Excerpt — not a complete module
|
|
|
105
105
|
| `fill / size` | `CardFill / CardSize` | outline / md | sl-dashboard-widget | The card’s own axes |
|
|
106
106
|
| `content` | `projected content` | — | sl-dashboard-widget | The body; kept in a template and drawn by the grid inside its own li and card, in the layout’s order |
|
|
107
107
|
| `provideDashboardGridDefaults` | `{ columns, editBar, headingLevel }` | — | providers | The decisions an application takes once; an instance that states any of them wins. The words come from the language in force (provideSlotted) |
|
|
108
|
-
| `persistedDashboardLayout` | `({ key, storage?, defaultLayout?, injector? }) => { layout, clear }` | localStorage | an injection context | A signal read once from the store and written after every change; bind it with [(layout)] |
|
|
108
|
+
| `persistedDashboardLayout` | `({ key, storage?, defaultLayout?, injector? }) => { layout, defaultLayout, clear }` | localStorage | an injection context | A signal read once from the store and written after every change; bind it with [(layout)], and its defaultLayout to [defaultLayout], which Reset asks for |
|
|
109
109
|
|
|
110
110
|
## Events
|
|
111
111
|
|
|
@@ -234,7 +234,13 @@ Excerpt — not a complete module
|
|
|
234
234
|
|
|
235
235
|
```ts
|
|
236
236
|
@Component({
|
|
237
|
-
template: `<div
|
|
237
|
+
template: `<div
|
|
238
|
+
slDashboardGrid
|
|
239
|
+
[(layout)]="persisted.layout"
|
|
240
|
+
[defaultLayout]="persisted.defaultLayout"
|
|
241
|
+
>
|
|
242
|
+
…
|
|
243
|
+
</div>`,
|
|
238
244
|
})
|
|
239
245
|
class SalesPage {
|
|
240
246
|
readonly persisted = persistedDashboardLayout({ key: 'trailhead-sales' });
|
package/docs/guidelines/index.md
CHANGED
|
@@ -86,6 +86,8 @@ Every active rule, one line each. Load this first; load a topic file when the ta
|
|
|
86
86
|
| OV-04 | SHOULD | The thresholds are stated once in words beside the figures, and a figure past one says so in its own comparison line, on the line the placeholder reserves. | `overviews.md` |
|
|
87
87
|
| OV-05 | SHOULD | A chart takes the `card` `variant` when it is one of two or more peer tiles in one grid with no section heading of its own, and stays `plain` when it is the body of a titled section or the only content of a tab. | `overviews.md` |
|
|
88
88
|
| OV-06 | SHOULD | The cards of one row carry a label of at most three words, the figure, and the same optional parts on every card — a comparison of one line on each, or on none. | `overviews.md` |
|
|
89
|
+
| OV-07 | SHOULD | The overview is one `dashboard-grid` whose blocks are each one of its widgets, and each headline figure is a widget of its own whose title is the figure's label. | `overviews.md` |
|
|
90
|
+
| OV-08 | SHOULD | A `stat-card` inside a framed region takes the `plain` `fill` and a `chart` takes the `plain` `variant`; a frame inside a frame is a finding. | `overviews.md` |
|
|
89
91
|
| OE-01 | MUST | An element of the application's own reads only tokens of the groups `../tokens.md` lists for the application. | `own-elements.md` |
|
|
90
92
|
| OE-02 | MUST | Where two states hold at once, the element paints the ground, the edge and the text colour of the stronger, in the order `disabled`, `loading`, `readonly`, `invalid`, `checked`, `selected`, `pressed`, `current`, `complete`, `active`, `hover`; the focus ring of OE-03 is drawn over every state. | `own-elements.md` |
|
|
91
93
|
| OE-03 | MUST | In its `focus-visible` state the element draws an outline of `--slotted-focus-ring-width` in `--slotted-focus-ring-color`, offset by `--slotted-focus-ring-offset`. | `own-elements.md` |
|
|
@@ -90,8 +90,8 @@ Level: MUST
|
|
|
90
90
|
Applies to: an element a screen makes `position: sticky` inside a page — a preview beside a form, a summary beside a list, a column's own header
|
|
91
91
|
Rule: The element's offset starts at the page's published `--slotted-page-sticky-top`, the measured height of the chrome that stays (the stuck page-header's title area, a sticky section's header), and an element that may be taller than what stays visible caps its height by the same property and scrolls inside.
|
|
92
92
|
Why: An offset from the scroller's edge alone — `inset-block-start: var(--slotted-space-4)` — sticks the element behind the stuck header, which is painted above it: its top is hidden for as long as it is stuck.
|
|
93
|
-
Do: Write `inset-block-start: calc(var(--slotted-page-sticky-top, 0px) + <gap>)` and, when the element can outgrow the view, `max-block-size: calc(100dvh - var(--slotted-page-sticky-top, 0px) -
|
|
94
|
-
Don't: Measure the header in the screen's own code,
|
|
93
|
+
Do: Write `inset-block-start: calc(var(--slotted-page-sticky-top, 0px) + <gap>)` and, when the element can outgrow the view, `max-block-size: calc(var(--slotted-page-scrollport-block-size, 100dvh) - var(--slotted-page-sticky-top, 0px) - var(--slotted-page-sticky-bottom, 0px) - 2 * <gap>)` with `overflow: auto`: the page publishes the scroller's own height, which an inset application frame makes shorter than the viewport.
|
|
94
|
+
Don't: Measure the header or the scroller in the screen's own code, hard-code the header's height, or cap the element by the viewport's height, which overshoots a scroller the application frame insets: the header collapses, wraps and changes with the density, and the page already measures both.
|
|
95
95
|
Check: Scroll the page until the header sticks, at two scroll positions: the sticky element's top stands at or below the bottom of the stuck header's title area each time.
|
|
96
96
|
|
|
97
97
|
### LA-07 · A page footer's action-bar holds one row on a phone
|
|
@@ -3,7 +3,7 @@ topic: overviews
|
|
|
3
3
|
prefix: OV
|
|
4
4
|
triggers:
|
|
5
5
|
[overview, dashboard, flagship, figure, stat card, exception, summary, chart, door, phone, narrow]
|
|
6
|
-
families: [stat-card, chart, list, list-item, table, section, grid]
|
|
6
|
+
families: [stat-card, chart, list, list-item, table, section, grid, dashboard-grid, card]
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# Overviews
|
|
@@ -74,3 +74,23 @@ Why: One card with a long label and a wrapping comparison beside three cards wit
|
|
|
74
74
|
Do: Give every card a short label, its figure and one comparison line; detail that only one card has goes into its comparison or a tooltip.
|
|
75
75
|
Don't: Lengthen one card's label to carry its detail, or give one card of the row a part the others lack.
|
|
76
76
|
Check: In every row of `stat-card`s, every label has three words or fewer, and either every card has a comparison or none does.
|
|
77
|
+
|
|
78
|
+
### OV-07 · An arranged overview is a dashboard-grid
|
|
79
|
+
|
|
80
|
+
Level: SHOULD
|
|
81
|
+
Applies to: an overview whose blocks the reader moves, resizes or hides
|
|
82
|
+
Rule: The overview is one `dashboard-grid` whose blocks are each one of its widgets, and each headline figure is a widget of its own whose title is the figure's label.
|
|
83
|
+
Why: A grid of the application's own with its own menu for hiding blocks repeats the editing, the keyboard moves, the persistence and the Add widget menu the family already draws.
|
|
84
|
+
Do: Give each widget a `value` and a `title`, and let the `auto` `rows` size a figure's widget to its content; persist the layout with the family's own persistence.
|
|
85
|
+
Don't: Build a `grid` of sections with a menu of the application's own that hides or orders them, or put several figures inside one widget.
|
|
86
|
+
Check: Find every control of the overview that hides, moves or resizes a block: each is the `dashboard-grid`'s own.
|
|
87
|
+
|
|
88
|
+
### OV-08 · Inside a frame, a figure is plain
|
|
89
|
+
|
|
90
|
+
Level: SHOULD
|
|
91
|
+
Applies to: `stat-card` and `chart` inside a framed region — a widget of the `dashboard-grid`, a `section` with the `surface` `ground`, a `card`
|
|
92
|
+
Rule: A `stat-card` inside a framed region takes the `plain` `fill` and a `chart` takes the `plain` `variant`; a frame inside a frame is a finding.
|
|
93
|
+
Why: The region's frame already separates the figure from its neighbours, and a second frame inside it draws a card within a card whose inner edge sits one inset from the outer.
|
|
94
|
+
Do: Let the region's title name the figure, as a widget's title does, and keep the figure's own header for a status or an action.
|
|
95
|
+
Don't: Leave a `stat-card` at its default `outline` fill, or a `chart` at the `card` `variant`, inside a widget, a surface section or a card.
|
|
96
|
+
Check: For each `stat-card` and `chart`, name the frame around it: inside a widget, a surface section or a card, its fill or variant is `plain`.
|
package/docs/page.json
CHANGED
|
@@ -203,11 +203,11 @@
|
|
|
203
203
|
"description": "The five decisions an application takes once. A page that states any of them itself still wins"
|
|
204
204
|
},
|
|
205
205
|
{
|
|
206
|
-
"name": "--slotted-page-sticky-top, --slotted-page-sticky-bottom",
|
|
206
|
+
"name": "--slotted-page-sticky-top, --slotted-page-sticky-bottom, --slotted-page-scrollport-block-size",
|
|
207
207
|
"type": "runtime properties on the scroller",
|
|
208
208
|
"defaultValue": "—",
|
|
209
209
|
"appliesTo": "every family under the page, and the consumer’s own sticky elements inside it",
|
|
210
|
-
"description": "The height of the chrome that stays at the top, written by the header, and of the
|
|
210
|
+
"description": "The height of the chrome that stays at the top, written by the header, of the footer, and of the scroller itself, written by the page. A section’s sticky header reads the first; a table with stickyTo=\"page\" reads both through the bridge the page writes on its root. A consumer’s own position: sticky element reads the first as well: inset-block-start: calc(var(--slotted-page-sticky-top, 0px) + gap) stops it under the chrome instead of behind the stuck header, and max-block-size: calc(var(--slotted-page-scrollport-block-size, 100dvh) - var(--slotted-page-sticky-top, 0px) - var(--slotted-page-sticky-bottom, 0px) - 2 * gap) bounds one that may be taller than the scroller. The third is the scroller’s visible height, written by the page; under an inset canvas the scroller is shorter than the viewport"
|
|
211
211
|
},
|
|
212
212
|
{
|
|
213
213
|
"name": "native attributes",
|
package/docs/page.md
CHANGED
|
@@ -49,7 +49,7 @@ Excerpt — not a complete module
|
|
|
49
49
|
| `slPage on any element` | `directive` | — | the consumer’s own element | main keeps its native landmark; an article or a div gets role="main" unless landmark="none". The scroll part is the component’s, because it is the scroller |
|
|
50
50
|
| `exportAs slPage` | `SlPage` | — | a template reference | The resolved width, inset, scroll and ground as signals, which the header and the footer inject |
|
|
51
51
|
| `providePageDefaults()` | `{ width, inset, scroll, ground, landmark }` | — | an injector | The five decisions an application takes once. A page that states any of them itself still wins |
|
|
52
|
-
| `--slotted-page-sticky-top, --slotted-page-sticky-bottom` | `runtime properties on the scroller` | — | every family under the page, and the consumer’s own sticky elements inside it | The height of the chrome that stays at the top, written by the header, and of the
|
|
52
|
+
| `--slotted-page-sticky-top, --slotted-page-sticky-bottom, --slotted-page-scrollport-block-size` | `runtime properties on the scroller` | — | every family under the page, and the consumer’s own sticky elements inside it | The height of the chrome that stays at the top, written by the header, of the footer, and of the scroller itself, written by the page. A section’s sticky header reads the first; a table with stickyTo="page" reads both through the bridge the page writes on its root. A consumer’s own position: sticky element reads the first as well: inset-block-start: calc(var(--slotted-page-sticky-top, 0px) + gap) stops it under the chrome instead of behind the stuck header, and max-block-size: calc(var(--slotted-page-scrollport-block-size, 100dvh) - var(--slotted-page-sticky-top, 0px) - var(--slotted-page-sticky-bottom, 0px) - 2 * gap) bounds one that may be taller than the scroller. The third is the scroller’s visible height, written by the page; under an inset canvas the scroller is shorter than the viewport |
|
|
53
53
|
| `native attributes` | `on every part` | — | every part | Every directive sits on the consumer’s own element, so id, class, role and every listener stay where they were written; role and aria-label are read with HostAttributeToken before anything is written over them |
|
|
54
54
|
|
|
55
55
|
## Axes and defaults
|
|
@@ -41,7 +41,9 @@ topics.
|
|
|
41
41
|
1. `../../guidelines/index.md`.
|
|
42
42
|
2. `../../guidelines/composition.md`, always.
|
|
43
43
|
3. The topic of step 2. Add `layout-alignment.md` and `shell-composition.md`
|
|
44
|
-
when the screen places controls in a row
|
|
44
|
+
when the screen places controls in a row, makes an element of its own
|
|
45
|
+
`position: sticky` (a summary or a preview beside a form or a list), or
|
|
46
|
+
works in the application frame.
|
|
45
47
|
4. Add `errors-and-conflicts.md` and `reading-permissions.md` when the screen
|
|
46
48
|
writes data or reads under a role.
|
|
47
49
|
5. When the screen writes an element of its own, follow
|
|
@@ -74,6 +76,10 @@ element stands in that slot.
|
|
|
74
76
|
useDeferredValue or startTransition) (CP-09). A list longer than a hundred
|
|
75
77
|
rows is a `data-grid`, which windows its rows where it has a height of its
|
|
76
78
|
own and is served in pages below 600 pixels (LP-12, LP-14). Its columns, its disabled keys and a function row key are module constants or memoised: a new one on a render of the screen renders every mounted row again. Its renderers, its messages and its tree may be written inline.
|
|
79
|
+
- An element of the screen's own made `position: sticky` stops under the
|
|
80
|
+
page's chrome: its offset starts at `--slotted-page-sticky-top`, and its
|
|
81
|
+
height cap subtracts it (LA-06). An offset from the scroller's edge alone
|
|
82
|
+
sticks it behind the stuck header.
|
|
77
83
|
- Where no anatomy answers the problem, the screen writes an element of its
|
|
78
84
|
own instead of bending a family into a shape it does not have (CP-04). That
|
|
79
85
|
element is built with `../../skills/build-own-element/SKILL.md`.
|
|
@@ -101,3 +107,6 @@ Every region filled by a request and every control that starts one follow
|
|
|
101
107
|
against the task, and the reason is written beside it.
|
|
102
108
|
6. At 360 pixels with a coarse pointer, the header's actions and the footer's
|
|
103
109
|
actions each occupy one row (LA-03, LA-07).
|
|
110
|
+
7. Each element of the screen's own made sticky: scroll until the page header
|
|
111
|
+
sticks, at two positions; its top stands at or below the header's title
|
|
112
|
+
area (LA-06 Check).
|
|
@@ -32,26 +32,28 @@ A review answers one question per rule read: does the screen pass the rule's
|
|
|
32
32
|
|
|
33
33
|
Each search below finds a defect without running the screen.
|
|
34
34
|
|
|
35
|
-
| Search the screen's files for
|
|
36
|
-
|
|
|
37
|
-
| A colour literal (hex, rgb, hsl, oklch), a length in pixels or rem other than zero, or a font size, in the screen's CSS
|
|
38
|
-
| A rule of the application's CSS that sets colour, border, radius, padding or type on a family's `data-ui` or `data-part`
|
|
39
|
-
| A control that starts a request and is not in its `loading` state until the answer, except a Refresh of the whole page
|
|
40
|
-
| A Refresh of the whole page drawing a spinner on its button, or a refetch of data on screen with no `page-header` progress bar
|
|
41
|
-
| An empty state drawn from the initial value of the data, before the first answer
|
|
42
|
-
| A spinner standing in a region that has no items yet
|
|
43
|
-
| Siblings of the page's own spaced by margins, or text with a font size of its own
|
|
44
|
-
| A grid or flex track around a family that scrolls, with no zero minimum
|
|
45
|
-
| A badge, a tag or a colour beside a family that already draws the same state
|
|
46
|
-
| An element of the screen's own that takes focus with no ring in its `focus-visible` state
|
|
47
|
-
| A `data-grid` or `table` with no `variant` on a page whose `width` is not `bleed`
|
|
48
|
-
| A list page's `page-header` with a heading and no subheading, no figures and no solid primary action
|
|
49
|
-
| A grid whose column state unpins its `actions` column
|
|
50
|
-
| A row of `stat-card`s where a label has more than three words, or one card has a comparison the others lack
|
|
51
|
-
|
|
|
52
|
-
| A
|
|
53
|
-
| Two
|
|
54
|
-
| A
|
|
35
|
+
| Search the screen's files for | Defect | Rule |
|
|
36
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------- | ------------ |
|
|
37
|
+
| A colour literal (hex, rgb, hsl, oklch), a length in pixels or rem other than zero, or a font size, in the screen's CSS | a value the theme has a token for | CP-05, OE-01 |
|
|
38
|
+
| A rule of the application's CSS that sets colour, border, radius, padding or type on a family's `data-ui` or `data-part` | the screen restyles a family instead of setting its axes | OE-08 |
|
|
39
|
+
| A control that starts a request and is not in its `loading` state until the answer, except a Refresh of the whole page | a control that fires twice | AF-03 |
|
|
40
|
+
| A Refresh of the whole page drawing a spinner on its button, or a refetch of data on screen with no `page-header` progress bar | a wait in the wrong place, and no wait shown for the page | AF-07 |
|
|
41
|
+
| An empty state drawn from the initial value of the data, before the first answer | a wait shown as nothing | AF-01 |
|
|
42
|
+
| A spinner standing in a region that has no items yet | placeholders missing | AF-02 |
|
|
43
|
+
| Siblings of the page's own spaced by margins, or text with a font size of its own | layout outside the primitives | CP-02 |
|
|
44
|
+
| A grid or flex track around a family that scrolls, with no zero minimum | the page scrolls, not the family | CP-03 |
|
|
45
|
+
| A badge, a tag or a colour beside a family that already draws the same state | a state stated twice | CP-06 |
|
|
46
|
+
| An element of the screen's own that takes focus with no ring in its `focus-visible` state | focus not drawn | OE-03 |
|
|
47
|
+
| A `data-grid` or `table` with no `variant` on a page whose `width` is not `bleed` | a grid with no frame on the page's surface | LP-15 |
|
|
48
|
+
| A list page's `page-header` with a heading and no subheading, no figures and no solid primary action | a header that does not say what the list covers | LP-16 |
|
|
49
|
+
| A grid whose column state unpins its `actions` column | the row's actions leave the frame | LP-17 |
|
|
50
|
+
| A row of `stat-card`s where a label has more than three words, or one card has a comparison the others lack | a row of cards with no shared structure | OV-06 |
|
|
51
|
+
| A `stat-card` without the `plain` `fill`, or a `chart` with the `card` `variant`, inside a widget of the `dashboard-grid`, a `section` with the `surface` `ground` or a `card` | a frame inside a frame | OV-08 |
|
|
52
|
+
| A menu, a toggle or a state of the application's own that hides, orders or resizes the blocks of an overview | an arranged overview built outside `dashboard-grid` | OV-07 |
|
|
53
|
+
| Two destinations of the navigation whose `page`s state different `width`s | the column's edges move between destinations | CP-10 |
|
|
54
|
+
| A write whose success handler refreshes only the region of the control that wrote | figures elsewhere stay stale after the write | AF-08 |
|
|
55
|
+
| Two or more actions in a `page-header`'s `actions` outside a `toolbar` that folds into its menu, or toolbar items with no counterpart beside the primary one | a header whose actions wrap on a phone | LA-03 |
|
|
56
|
+
| A footer `action-bar` of three or more actions with no overflow control, or a secondary action with no counterpart | a footer that stacks into a column on a phone | LA-07 |
|
|
55
57
|
|
|
56
58
|
A rule whose `Check` needs the screen running — a size class, a throttled
|
|
57
59
|
network, the accessibility tree — is run when the environment can run it, and
|
package/docs/stat-card.json
CHANGED
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
"part": "trend",
|
|
179
179
|
"element": "div",
|
|
180
180
|
"required": false,
|
|
181
|
-
"purpose": "Where a sparkline goes: beside the figure, or under it when stacked or under 220 pixels. Hands the sparkline the card’s tone and
|
|
181
|
+
"purpose": "Where a sparkline goes: beside the figure, or under it when stacked or under 220 pixels. Hands the sparkline the card’s tone, ground and box, and draws a line smoothed and washed unless the application or the sparkline says otherwise; a block placeholder in the same box while loading; hidden under forty pixels."
|
|
182
182
|
},
|
|
183
183
|
{
|
|
184
184
|
"part": "message",
|
|
@@ -307,7 +307,7 @@
|
|
|
307
307
|
"type": "projected content",
|
|
308
308
|
"defaultValue": "—",
|
|
309
309
|
"appliesTo": "slStatCard",
|
|
310
|
-
"description": "Takes an slSparkline and hands it the card’s tone through --slotted-sparkline-color
|
|
310
|
+
"description": "Takes an slSparkline and hands it the card’s tone through --slotted-sparkline-color, its ground for the marker’s ring, and curve=\"monotone\" with area unless the sparkline defaults or the sparkline state otherwise; a tone or series on the sparkline still wins"
|
|
311
311
|
},
|
|
312
312
|
{
|
|
313
313
|
"name": "aria-label, aria-labelledby, id",
|
|
@@ -416,6 +416,9 @@
|
|
|
416
416
|
"--slotted-stat-card-region-gap-sm",
|
|
417
417
|
"--slotted-stat-card-shadow",
|
|
418
418
|
"--slotted-stat-card-shadow-elevated",
|
|
419
|
+
"--slotted-stat-card-trend-block-size",
|
|
420
|
+
"--slotted-stat-card-trend-block-size-lg",
|
|
421
|
+
"--slotted-stat-card-trend-block-size-sm",
|
|
419
422
|
"--slotted-stat-card-trend-gap",
|
|
420
423
|
"--slotted-stat-card-trend-gap-lg",
|
|
421
424
|
"--slotted-stat-card-trend-gap-sm",
|
|
@@ -484,7 +487,7 @@
|
|
|
484
487
|
{
|
|
485
488
|
"id": "layout",
|
|
486
489
|
"title": "The trend beside the figure, or under it",
|
|
487
|
-
"note": "inline puts the sparkline in a column beside the value,
|
|
490
|
+
"note": "inline puts the sparkline in a column beside the value, as tall as the figure; stacked runs it to the card’s edges on the last row, level with the bottom of every card in the row. Under 220 pixels a card stacks on its own and drops the value one step.",
|
|
488
491
|
"language": "html",
|
|
489
492
|
"source": "<div slStatCard layout=\"inline\">…</div>\n<div slStatCard layout=\"stacked\">…</div>\n",
|
|
490
493
|
"verdict": "excerpt"
|
|
@@ -492,7 +495,7 @@
|
|
|
492
495
|
{
|
|
493
496
|
"id": "loading",
|
|
494
497
|
"title": "The layout is kept while the value is on its way",
|
|
495
|
-
"note": "Every text part stands in with a placeholder of its own line height and the trend with a block the
|
|
498
|
+
"note": "Every text part stands in with a placeholder of its own line height and the trend with a block in the trend’s own box, so nothing moves when the numbers arrive; the previous value is not shown as if it were current.",
|
|
496
499
|
"language": "html",
|
|
497
500
|
"source": "<div slStatCard [loading]=\"pending()\">\n <div slStatCardHeader><span slStatCardLabel>Open orders</span></div>\n <div slStatCardFigure>\n <span slStatCardValue [value]=\"orders().total\"></span>\n <span slStatCardDelta [value]=\"orders().delta\"></span>\n </div>\n <div slStatCardTrend><span slSparkline [data]=\"orders().series\"></span></div>\n</div>\n",
|
|
498
501
|
"verdict": "excerpt"
|
package/docs/stat-card.md
CHANGED
|
@@ -82,7 +82,7 @@ Excerpt — not a complete module
|
|
|
82
82
|
| `projected content` | `ng-content` | — | slStatCardValue, slStatCardDelta | Your own rendering after the formatted number: a unit, or the whole text when value is unset |
|
|
83
83
|
| `[slStatCard…]` | `attribute selectors` | — | your elements | Every part is a directive on the element you wrote: a heading for the label, an anchor for the action, a p for the comparison |
|
|
84
84
|
| `exportAs` | `template reference` | — | slStatCard, slStatCardValue, slStatCardDelta, slStatCardTrend, … | Reaches the instance: the derived tone, the trend, the formatted text |
|
|
85
|
-
| `slStatCardTrend` | `projected content` | — | slStatCard | Takes an slSparkline and hands it the card’s tone through --slotted-sparkline-color
|
|
85
|
+
| `slStatCardTrend` | `projected content` | — | slStatCard | Takes an slSparkline and hands it the card’s tone through --slotted-sparkline-color, its ground for the marker’s ring, and curve="monotone" with area unless the sparkline defaults or the sparkline state otherwise; a tone or series on the sparkline still wins |
|
|
86
86
|
| `aria-label, aria-labelledby, id` | `attributes` | — | your elements | A name or an id you wrote on the host or on the label wins over the generated one |
|
|
87
87
|
| `trendOf, toneOf` | `function` | — | Application | The two derivations, exported for a delta you format yourself |
|
|
88
88
|
| `provideStatCardDefaults` | `StatCardDefaults` | — | Application | Sets goodWhen, size, fill, layout and formatOptions once, in a route or the application config; an input still wins |
|
|
@@ -110,7 +110,7 @@ Excerpt — not a complete module
|
|
|
110
110
|
|
|
111
111
|
## Tokens
|
|
112
112
|
|
|
113
|
-
`--slotted-border-subtle`, `--slotted-border-width-thin`, `--slotted-control-icon-size-md`, `--slotted-control-icon-size-sm`, `--slotted-font-family-sans`, `--slotted-font-size-2xl`, `--slotted-font-size-3xl`, `--slotted-font-size-4xl`, `--slotted-font-size-md`, `--slotted-font-size-sm`, `--slotted-font-size-xl`, `--slotted-font-size-xs`, `--slotted-font-weight-medium`, `--slotted-font-weight-semibold`, `--slotted-letter-spacing-tighter`, `--slotted-line-height-2xl`, `--slotted-line-height-3xl`, `--slotted-line-height-4xl`, `--slotted-line-height-md`, `--slotted-line-height-sm`, `--slotted-line-height-xl`, `--slotted-line-height-xs`, `--slotted-radius-lg`, `--slotted-radius-none`, `--slotted-shadow-md`, `--slotted-space-1`, `--slotted-space-11`, `--slotted-space-12`, `--slotted-space-2`, `--slotted-space-3`, `--slotted-space-4`, `--slotted-space-5`, `--slotted-space-6`, `--slotted-space-7`, `--slotted-space-8`, `--slotted-space-9`, `--slotted-sparkline-block-size`, `--slotted-sparkline-block-size-lg`, `--slotted-sparkline-block-size-sm`, `--slotted-stat-card-background`, `--slotted-stat-card-background-subtle`, `--slotted-stat-card-border-color`, `--slotted-stat-card-border-width`, `--slotted-stat-card-color`, `--slotted-stat-card-color-muted`, `--slotted-stat-card-delta-font-size`, `--slotted-stat-card-delta-font-size-lg`, `--slotted-stat-card-delta-font-size-sm`, `--slotted-stat-card-indicator-size`, `--slotted-stat-card-indicator-size-lg`, `--slotted-stat-card-label-font-size`, `--slotted-stat-card-label-font-size-lg`, `--slotted-stat-card-label-font-size-sm`, `--slotted-stat-card-label-line-height`, `--slotted-stat-card-label-line-height-lg`, `--slotted-stat-card-label-line-height-sm`, `--slotted-stat-card-min-inline-size`, `--slotted-stat-card-padding-block`, `--slotted-stat-card-padding-block-lg`, `--slotted-stat-card-padding-block-sm`, `--slotted-stat-card-padding-inline`, `--slotted-stat-card-padding-inline-lg`, `--slotted-stat-card-padding-inline-sm`, `--slotted-stat-card-prose-font-size`, `--slotted-stat-card-prose-font-size-lg`, `--slotted-stat-card-prose-line-height`, `--slotted-stat-card-prose-line-height-lg`, `--slotted-stat-card-radius`, `--slotted-stat-card-region-gap`, `--slotted-stat-card-region-gap-lg`, `--slotted-stat-card-region-gap-sm`, `--slotted-stat-card-shadow`, `--slotted-stat-card-shadow-elevated`, `--slotted-stat-card-trend-gap`, `--slotted-stat-card-trend-gap-lg`, `--slotted-stat-card-trend-gap-sm`, `--slotted-stat-card-trend-inline-size`, `--slotted-stat-card-trend-inline-size-lg`, `--slotted-stat-card-trend-inline-size-sm`, `--slotted-stat-card-value-font-size`, `--slotted-stat-card-value-font-size-lg`, `--slotted-stat-card-value-font-size-sm`, `--slotted-stat-card-value-line-height`, `--slotted-stat-card-value-line-height-lg`, `--slotted-stat-card-value-line-height-sm`, `--slotted-surface-raised`, `--slotted-surface-sunken`, `--slotted-target-comfortable`, `--slotted-text`, `--slotted-text-muted`, `--slotted-tone-accent-text`, `--slotted-tone-danger-text`, `--slotted-tone-info-text`, `--slotted-tone-secondary-text`, `--slotted-tone-success-text`, `--slotted-tone-warning-text`
|
|
113
|
+
`--slotted-border-subtle`, `--slotted-border-width-thin`, `--slotted-control-icon-size-md`, `--slotted-control-icon-size-sm`, `--slotted-font-family-sans`, `--slotted-font-size-2xl`, `--slotted-font-size-3xl`, `--slotted-font-size-4xl`, `--slotted-font-size-md`, `--slotted-font-size-sm`, `--slotted-font-size-xl`, `--slotted-font-size-xs`, `--slotted-font-weight-medium`, `--slotted-font-weight-semibold`, `--slotted-letter-spacing-tighter`, `--slotted-line-height-2xl`, `--slotted-line-height-3xl`, `--slotted-line-height-4xl`, `--slotted-line-height-md`, `--slotted-line-height-sm`, `--slotted-line-height-xl`, `--slotted-line-height-xs`, `--slotted-radius-lg`, `--slotted-radius-none`, `--slotted-shadow-md`, `--slotted-space-1`, `--slotted-space-11`, `--slotted-space-12`, `--slotted-space-2`, `--slotted-space-3`, `--slotted-space-4`, `--slotted-space-5`, `--slotted-space-6`, `--slotted-space-7`, `--slotted-space-8`, `--slotted-space-9`, `--slotted-sparkline-block-size`, `--slotted-sparkline-block-size-lg`, `--slotted-sparkline-block-size-sm`, `--slotted-stat-card-background`, `--slotted-stat-card-background-subtle`, `--slotted-stat-card-border-color`, `--slotted-stat-card-border-width`, `--slotted-stat-card-color`, `--slotted-stat-card-color-muted`, `--slotted-stat-card-delta-font-size`, `--slotted-stat-card-delta-font-size-lg`, `--slotted-stat-card-delta-font-size-sm`, `--slotted-stat-card-indicator-size`, `--slotted-stat-card-indicator-size-lg`, `--slotted-stat-card-label-font-size`, `--slotted-stat-card-label-font-size-lg`, `--slotted-stat-card-label-font-size-sm`, `--slotted-stat-card-label-line-height`, `--slotted-stat-card-label-line-height-lg`, `--slotted-stat-card-label-line-height-sm`, `--slotted-stat-card-min-inline-size`, `--slotted-stat-card-padding-block`, `--slotted-stat-card-padding-block-lg`, `--slotted-stat-card-padding-block-sm`, `--slotted-stat-card-padding-inline`, `--slotted-stat-card-padding-inline-lg`, `--slotted-stat-card-padding-inline-sm`, `--slotted-stat-card-prose-font-size`, `--slotted-stat-card-prose-font-size-lg`, `--slotted-stat-card-prose-line-height`, `--slotted-stat-card-prose-line-height-lg`, `--slotted-stat-card-radius`, `--slotted-stat-card-region-gap`, `--slotted-stat-card-region-gap-lg`, `--slotted-stat-card-region-gap-sm`, `--slotted-stat-card-shadow`, `--slotted-stat-card-shadow-elevated`, `--slotted-stat-card-trend-block-size`, `--slotted-stat-card-trend-block-size-lg`, `--slotted-stat-card-trend-block-size-sm`, `--slotted-stat-card-trend-gap`, `--slotted-stat-card-trend-gap-lg`, `--slotted-stat-card-trend-gap-sm`, `--slotted-stat-card-trend-inline-size`, `--slotted-stat-card-trend-inline-size-lg`, `--slotted-stat-card-trend-inline-size-sm`, `--slotted-stat-card-value-font-size`, `--slotted-stat-card-value-font-size-lg`, `--slotted-stat-card-value-font-size-sm`, `--slotted-stat-card-value-line-height`, `--slotted-stat-card-value-line-height-lg`, `--slotted-stat-card-value-line-height-sm`, `--slotted-surface-raised`, `--slotted-surface-sunken`, `--slotted-target-comfortable`, `--slotted-text`, `--slotted-text-muted`, `--slotted-tone-accent-text`, `--slotted-tone-danger-text`, `--slotted-tone-info-text`, `--slotted-tone-secondary-text`, `--slotted-tone-success-text`, `--slotted-tone-warning-text`
|
|
114
114
|
|
|
115
115
|
## Examples
|
|
116
116
|
|
|
@@ -183,7 +183,7 @@ Excerpt — not a complete module
|
|
|
183
183
|
|
|
184
184
|
### The trend beside the figure, or under it
|
|
185
185
|
|
|
186
|
-
inline puts the sparkline in a column beside the value,
|
|
186
|
+
inline puts the sparkline in a column beside the value, as tall as the figure; stacked runs it to the card’s edges on the last row, level with the bottom of every card in the row. Under 220 pixels a card stacks on its own and drops the value one step.
|
|
187
187
|
|
|
188
188
|
Excerpt — not a complete module
|
|
189
189
|
|
|
@@ -194,7 +194,7 @@ Excerpt — not a complete module
|
|
|
194
194
|
|
|
195
195
|
### The layout is kept while the value is on its way
|
|
196
196
|
|
|
197
|
-
Every text part stands in with a placeholder of its own line height and the trend with a block the
|
|
197
|
+
Every text part stands in with a placeholder of its own line height and the trend with a block in the trend’s own box, so nothing moves when the numbers arrive; the previous value is not shown as if it were current.
|
|
198
198
|
|
|
199
199
|
Excerpt — not a complete module
|
|
200
200
|
|
|
@@ -138,6 +138,11 @@ function focusVisible(element) {
|
|
|
138
138
|
* model, the keyboard, the text alternatives and the theme are
|
|
139
139
|
* `@slotted/core/chart`'s, shared with the React binding.
|
|
140
140
|
*/
|
|
141
|
+
/**
|
|
142
|
+
* `Row` is the type of one record, inferred from `data`. An interface without
|
|
143
|
+
* an index signature is accepted, and every field a series or the x axis names
|
|
144
|
+
* must be one of its keys.
|
|
145
|
+
*/
|
|
141
146
|
class SlChart {
|
|
142
147
|
/* ── What is drawn ─────────────────────────────────────────────────── */
|
|
143
148
|
data = input([], /* @ts-ignore */
|
|
@@ -305,6 +310,7 @@ class SlChart {
|
|
|
305
310
|
}), /* @ts-ignore */
|
|
306
311
|
...(ngDevMode ? [{ debugName: "resolvedTooltip" }] : /* istanbul ignore next */ []));
|
|
307
312
|
spec = computed(() => ({
|
|
313
|
+
// The model reads a record only by the fields the series name, which `Row` constrains.
|
|
308
314
|
data: this.data(),
|
|
309
315
|
series: this.series(),
|
|
310
316
|
x: this.x(),
|