@synopackageland/ui 0.13.0 → 0.13.1
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 +9 -0
- package/README.md +25 -0
- package/dist/components/app/app-layout/AppLayout.vue.d.ts +8 -1
- package/dist/components/app/app-sidebar/AppTopNavItems.vue.d.ts +12 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7820 -7695
- package/dist/json/catalog.d.ts +8 -0
- package/dist/json/registry.d.ts +136 -0
- package/dist/json-ai-prompt.md +1 -1
- package/dist/json-catalog.schema.json +15 -1
- package/dist/json-preview/preview.js +12110 -9639
- package/dist/json.js +157 -155
- package/dist/lib/adaptiveLayout.d.ts +4 -0
- package/dist/reka-runtime.json +1 -1
- package/dist/theme.css +1 -1
- package/dist/themes/dsm7-embedded-theme.css +1 -1
- package/dist/themes/dsm7-embedded.css +1 -1
- package/dist/themes/dsm7.css +1 -1
- package/docs/adaptive-layout.md +5 -0
- package/docs/json-ui.md +2 -0
- package/docs/theme-hooks.md +142 -0
- package/package.json +3 -2
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Theme hooks: public `data-*` attributes and layout tokens
|
|
2
|
+
|
|
3
|
+
Since 0.13.1 the attributes and tokens on this page are **public API**. An app
|
|
4
|
+
or a workspace theme may select on them in its own CSS and set the tokens on
|
|
5
|
+
any ancestor. Class names, element nesting and every attribute not listed
|
|
6
|
+
here stay implementation details and can change in any release.
|
|
7
|
+
|
|
8
|
+
## Stability rules
|
|
9
|
+
|
|
10
|
+
- A listed attribute keeps its name, the element it sits on and the values
|
|
11
|
+
listed for it until a **major** release (or a 0.x minor release, which the
|
|
12
|
+
changelog marks as breaking, as for any other API).
|
|
13
|
+
- New values may be added to an attribute in a patch or minor release. A
|
|
14
|
+
selector that tests for a value (`[data-variant='primary']`) keeps working; a
|
|
15
|
+
rule that assumes the listed values are the only ones may not.
|
|
16
|
+
- A token keeps its name and meaning. Its **unset** value is the look the
|
|
17
|
+
component had before the token existed; changing that default is a visible
|
|
18
|
+
change and is announced in the changelog.
|
|
19
|
+
- Removing or renaming a listed attribute or token is breaking: it is first
|
|
20
|
+
deprecated in the changelog for at least one minor release.
|
|
21
|
+
- Select on what is listed, then on standard roles and ARIA states
|
|
22
|
+
(`[aria-current='page']`, `[aria-expanded]`, `[role='dialog']`). Do not
|
|
23
|
+
depend on child order, on the tag of an unlisted element or on Tailwind
|
|
24
|
+
classes.
|
|
25
|
+
|
|
26
|
+
## Attributes
|
|
27
|
+
|
|
28
|
+
### Application root and layout
|
|
29
|
+
|
|
30
|
+
| Attribute | On | Values |
|
|
31
|
+
| --- | --- | --- |
|
|
32
|
+
| `data-ui-app` | `AppRoot`'s root and its floating hosts (portals) | present |
|
|
33
|
+
| `data-ui-theme`, `data-ui-density`, `data-ui-accent` | the app root (mirrored on floating hosts) | theme name, `compact`/`comfortable`, present |
|
|
34
|
+
| `data-ui-presentation` | `AppRoot` root | `mobile`, `window`, `web` |
|
|
35
|
+
| `data-ui-floating` | a floating host (dialog, menu, popover) | present |
|
|
36
|
+
| `data-ui-layout-mode` | `AppLayout` root | `mobile`, `window`, `web` |
|
|
37
|
+
| `data-ui-navigation` | `AppLayout` root, and `AppSidebar`'s `<nav>`, while the navigation is a top bar | `top` (absent for the sidebar and on a phone) |
|
|
38
|
+
| `data-ui-layout-height` | `AppLayout` root | `auto`, `fill` |
|
|
39
|
+
| `data-ui-sidebar-collapsed` | `AppLayout` root and `AppSidebar`'s `<nav>` | `true` while the web rail shows icons only |
|
|
40
|
+
| `data-ui-mobile-open` | `AppLayout` root | `true` while the phone drawer is open |
|
|
41
|
+
| `data-ui-layout-sidebar` | the navigation region (left column, top bar, or phone drawer) | present |
|
|
42
|
+
| `data-ui-layout-main` | the page region beside or under the navigation | present |
|
|
43
|
+
| `data-ui-sidebar-brand` | the brand block (web sidebar, top bar, phone bar, drawer header) | present |
|
|
44
|
+
| `data-ui-brand-icon`, `data-ui-brand-name` | the brand's logo `<img>` and name | present |
|
|
45
|
+
| `data-ui-sidebar-body` | wrapper of the `sidebar` slot | present |
|
|
46
|
+
| `data-ui-sidebar-footer` | wrapper of the `sidebar-footer` slot | present |
|
|
47
|
+
| `data-ui-sidebar-collapse` | the web rail's collapse button | present |
|
|
48
|
+
| `data-ui-mobile-navigation` | the phone bar above the page | present |
|
|
49
|
+
| `data-ui-mobile-menu` | the phone bar's menu (hamburger) button | present |
|
|
50
|
+
| `data-ui-mobile-sidebar-header` | the drawer's header row | present |
|
|
51
|
+
| `data-ui-mobile-backdrop` | the drawer's backdrop | present |
|
|
52
|
+
| `data-ui-app-toolbar` | `AppToolbar` | present |
|
|
53
|
+
| `data-ui-page-header` | `PageHeader` | present |
|
|
54
|
+
| `data-ui-page-header-meta`, `data-ui-page-header-actions` | `PageHeader`'s meta and actions areas | present |
|
|
55
|
+
| `data-page-surface` | `PageContent` | `auto`, `card`, `flat`, `none` |
|
|
56
|
+
|
|
57
|
+
### Navigation rows (`AppSidebar`, side or top)
|
|
58
|
+
|
|
59
|
+
| Attribute | On | Values |
|
|
60
|
+
| --- | --- | --- |
|
|
61
|
+
| `data-nav-item` | a row that selects a page | present |
|
|
62
|
+
| `data-nav-branch` | a row with children (expands in the sidebar, opens a menu in the top bar) | present |
|
|
63
|
+
| `data-nav-group-label` | a group title (sidebar only) | present |
|
|
64
|
+
| `data-nav-group` | a group in the top bar, `role="group"` named by its label | present |
|
|
65
|
+
| `data-nav-label`, `data-nav-badge` | a row's label and badge | present |
|
|
66
|
+
| `data-nav-contains-current` | a top-bar branch whose child is the current page | present |
|
|
67
|
+
| `aria-current` | the current page's row | `page` |
|
|
68
|
+
| `data-ui-sidebar-user` | `AppSidebarUser` | present |
|
|
69
|
+
| `data-ui-user-avatar`, `data-ui-user-name`, `data-ui-user-detail` | its parts | present |
|
|
70
|
+
|
|
71
|
+
### Controls and surfaces
|
|
72
|
+
|
|
73
|
+
| Attribute | On | Values |
|
|
74
|
+
| --- | --- | --- |
|
|
75
|
+
| `data-variant` | `Button` | `primary`, `secondary`, `ghost`, `danger` |
|
|
76
|
+
| `data-variant` | `IconButton` | `primary`, `secondary`, `ghost` |
|
|
77
|
+
| `data-variant` | `SplitButton`'s outer group | `primary`, `secondary` |
|
|
78
|
+
| `data-kind` | `Button` | `tool`, `action` |
|
|
79
|
+
| `data-loading`, `data-disabled` | `Button` | present while loading / explicitly disabled |
|
|
80
|
+
| `data-split-main`, `data-split-arrow` | `SplitButton`'s two halves | present |
|
|
81
|
+
| `data-ui-surface` | `Surface` and every `Card` frame | present |
|
|
82
|
+
| `data-variant` | `Surface` / `Card` frame | `default`, `inset` |
|
|
83
|
+
| `data-ui-dialog`, `data-ui-sheet` | `Dialog` / `Sheet` panels | present |
|
|
84
|
+
| `data-ui-list-item-title`, `-description`, `-meta`, `-actions` | `ListItem` parts | present |
|
|
85
|
+
| `data-ui-statistic-label`, `-value`, `-note` | `Statistic` parts | present |
|
|
86
|
+
|
|
87
|
+
Select a `Button` variant with its tag so a `Surface`'s `data-variant` is not
|
|
88
|
+
caught as well: `button[data-variant='primary']`.
|
|
89
|
+
|
|
90
|
+
## Layout and theme tokens
|
|
91
|
+
|
|
92
|
+
Each token below is read with a fallback: unset, the component looks as it did
|
|
93
|
+
before the token existed. Set them on the app root or any ancestor.
|
|
94
|
+
|
|
95
|
+
| Token | Affects | Unset |
|
|
96
|
+
| --- | --- | --- |
|
|
97
|
+
| `--ui-icon-size` | icons in navigation rows (`AppSidebar`, side and top) | 22px in the sidebar, 18px in the top bar |
|
|
98
|
+
| `--ui-heading-weight` | `PageHeader` title, `Card` title, `TypoHeader`, web toolbar titles | 600 (`PageHeader`, `TypoHeader`, toolbar), 700 (`Card`, web `PageHeader`) |
|
|
99
|
+
| `--ui-card-padding` | a regular `Card`'s header, body and footer inset; the body's block padding is 0.8× | 20px (body 16px × 20px). Compact cards are unchanged |
|
|
100
|
+
| `--ui-top-nav-height` | the top navigation bar | `var(--ui-toolbar-height)` |
|
|
101
|
+
| `--ui-top-nav-bg` | the top navigation bar's background | `var(--ui-surface)`; web: `var(--ui-app-web-surface)` |
|
|
102
|
+
| `--ui-top-nav-border` | its bottom rule | `var(--ui-border)`; web: `var(--ui-app-web-border)` |
|
|
103
|
+
| `--ui-mobile-bar-bg` | the phone bar's background | `var(--ui-surface)` |
|
|
104
|
+
| `--ui-mobile-bar-fg` | the phone bar's text, menu button and brand | `var(--ui-text-secondary)` (text), `var(--ui-text)` (button, brand) |
|
|
105
|
+
| `--ui-mobile-bar-border` | the phone bar's bottom rule | `var(--ui-border-subtle)` |
|
|
106
|
+
|
|
107
|
+
The colour, radius, spacing and web tokens are listed in the
|
|
108
|
+
[README](../README.md#theme-override), [colour system](color-system.md) and
|
|
109
|
+
[adaptive layout](adaptive-layout.md#safe-overrides).
|
|
110
|
+
|
|
111
|
+
## Example: a dark top bar
|
|
112
|
+
|
|
113
|
+
```css
|
|
114
|
+
[data-ui-app] {
|
|
115
|
+
--ui-top-nav-bg: #111827;
|
|
116
|
+
--ui-top-nav-border: #111827;
|
|
117
|
+
--ui-mobile-bar-bg: #111827;
|
|
118
|
+
--ui-mobile-bar-fg: #f9fafb;
|
|
119
|
+
--ui-icon-size: 20px;
|
|
120
|
+
--ui-heading-weight: 700;
|
|
121
|
+
--ui-card-padding: 24px;
|
|
122
|
+
}
|
|
123
|
+
/* Text inside the bar reads on the dark background. */
|
|
124
|
+
[data-ui-app] [data-ui-layout-sidebar] {
|
|
125
|
+
--ui-text: #f9fafb;
|
|
126
|
+
--ui-text-muted: #9ca3af;
|
|
127
|
+
--ui-surface-hover: rgb(255 255 255 / 0.08);
|
|
128
|
+
}
|
|
129
|
+
[data-ui-app] button[data-variant='primary'] {
|
|
130
|
+
border-radius: 999px;
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
```vue
|
|
135
|
+
<AppLayout navigation="top" wide-layout="web">
|
|
136
|
+
<template #sidebar><AppSidebar v-model="page" :groups="groups" /></template>
|
|
137
|
+
<template #sidebar-footer><AppSidebarUser name="Ada Lin" /></template>
|
|
138
|
+
<PageContent>…</PageContent>
|
|
139
|
+
</AppLayout>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The Histoire story *DSM 7 / Top navigation and theme hooks* shows both.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synopackageland/ui",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "Shared Vue 3 UI component library with a DSM 7 inspired application theme",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"docs/color-system.md",
|
|
19
19
|
"docs/component-defaults-0.5.7.md",
|
|
20
20
|
"docs/json-ui.md",
|
|
21
|
-
"docs/layout-rules.md"
|
|
21
|
+
"docs/layout-rules.md",
|
|
22
|
+
"docs/theme-hooks.md"
|
|
22
23
|
],
|
|
23
24
|
"bin": {
|
|
24
25
|
"syno-pkg-land-ui": "./dist/cli.js"
|