@asteby/metacore-theme 2.23.0 → 2.25.0
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/README.md +31 -0
- package/package.json +1 -1
- package/styles/glass.css +41 -6
package/README.md
CHANGED
|
@@ -66,6 +66,37 @@ the brand painted by `applyBranding`. Import it after your tokens:
|
|
|
66
66
|
It includes a near-opaque fallback for browsers without `backdrop-filter`
|
|
67
67
|
and for `prefers-reduced-transparency`.
|
|
68
68
|
|
|
69
|
+
#### Host chrome and mobile floating panel (optional variables)
|
|
70
|
+
|
|
71
|
+
A host with fixed chrome around the shell publishes its sizes on `:root`. All
|
|
72
|
+
variables are optional and default to `0`/flat: without them the compiled CSS
|
|
73
|
+
behaves exactly as before.
|
|
74
|
+
|
|
75
|
+
| Variable | Default | Effect |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| `--app-topbar-h` | `0px` | Fixed top bar: pushes the inset (and `@asteby/metacore-ui` `Sidebar`) down |
|
|
78
|
+
| `--app-notice-h` | `0px` | Notice strip under the top bar (0 when hidden) |
|
|
79
|
+
| `--app-bottombar-h` | `0px` | Bottom dock on mobile: bottom margin of the inset and the mobile sidebar sheet |
|
|
80
|
+
| `--glass-inset-max-height` | `none` | Cap for the inset when the wrapper is not height-bound, e.g. `calc(100svh - var(--app-topbar-h) - var(--app-notice-h) - 1rem)` |
|
|
81
|
+
| `--glass-mobile-gutter` | `0px` | Margin around the inset on phones (e.g. `0.5rem`) |
|
|
82
|
+
| `--glass-mobile-radius` | `0px` | Corner radius of the inset on phones (e.g. `var(--glass-radius)`) |
|
|
83
|
+
| `--glass-mobile-border-width` | `0px` | Rim width on phones (e.g. `1px`) |
|
|
84
|
+
| `--glass-mobile-shadow` | `none` | Shadow on phones (e.g. `var(--glass-highlight), var(--glass-shadow)`) |
|
|
85
|
+
|
|
86
|
+
```css
|
|
87
|
+
:root {
|
|
88
|
+
--app-topbar-h: 3rem;
|
|
89
|
+
--app-bottombar-h: 4rem; /* 0 from sm up if the dock is mobile-only */
|
|
90
|
+
--glass-mobile-gutter: 0.5rem;
|
|
91
|
+
--glass-mobile-radius: var(--glass-radius);
|
|
92
|
+
--glass-mobile-border-width: 1px;
|
|
93
|
+
--glass-mobile-shadow: var(--glass-highlight), var(--glass-shadow);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
An inset with no sidebar sibling (chat-like screens) floats on desktop with
|
|
98
|
+
`<SidebarInset data-glass-float>`.
|
|
99
|
+
|
|
69
100
|
## Usage from JS/TS
|
|
70
101
|
|
|
71
102
|
For programmatic access (Storybook, charts, PDF):
|
package/package.json
CHANGED
package/styles/glass.css
CHANGED
|
@@ -197,19 +197,53 @@
|
|
|
197
197
|
width: calc(var(--sidebar-width-icon) + 1rem);
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
+
/*
|
|
201
|
+
* Host chrome awareness. A host with fixed chrome around the app shell
|
|
202
|
+
* publishes its sizes as CSS variables on :root (all default to 0, so without
|
|
203
|
+
* them nothing changes):
|
|
204
|
+
*
|
|
205
|
+
* --app-topbar-h height of a fixed top bar
|
|
206
|
+
* --app-notice-h height of a notice strip under it (0 when hidden)
|
|
207
|
+
* --app-bottombar-h height of a bottom dock (mobile)
|
|
208
|
+
*
|
|
209
|
+
* The floating inset leaves them free: top margin = topbar + notice + gutter,
|
|
210
|
+
* bottom margin (mobile) = bottombar + gutter. Optionally cap the panel with
|
|
211
|
+
* --glass-inset-max-height: calc(100svh - var(--app-topbar-h) - var(--app-notice-h) - 1rem);
|
|
212
|
+
* when the shell wrapper is not height-bound (min-h-svh) — the SDK
|
|
213
|
+
* SidebarProvider is h-svh, where the panel already stretches to fit.
|
|
214
|
+
*/
|
|
200
215
|
@media (min-width: 768px) {
|
|
201
216
|
[data-ui-theme='glass'] [data-slot='sidebar'][data-variant='sidebar'] ~ [data-slot='sidebar-inset'] {
|
|
202
|
-
margin: 0.5rem;
|
|
217
|
+
margin: calc(var(--app-topbar-h, 0px) + var(--app-notice-h, 0px) + 0.5rem) 0.5rem 0.5rem;
|
|
203
218
|
margin-inline-start: 0;
|
|
219
|
+
max-height: var(--glass-inset-max-height, none);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/*
|
|
223
|
+
* Opt-in: an inset with no sidebar sibling (chat-like screens) floats the
|
|
224
|
+
* same way with <SidebarInset data-glass-float>.
|
|
225
|
+
*/
|
|
226
|
+
[data-ui-theme='glass'] [data-slot='sidebar-inset'][data-glass-float] {
|
|
227
|
+
margin: calc(var(--app-topbar-h, 0px) + var(--app-notice-h, 0px) + 0.5rem) 0.5rem 0.5rem;
|
|
228
|
+
max-height: var(--glass-inset-max-height, none);
|
|
204
229
|
}
|
|
205
230
|
}
|
|
206
231
|
|
|
207
232
|
@media (max-width: 767px) {
|
|
208
|
-
/*
|
|
233
|
+
/*
|
|
234
|
+
* No sidebar panel beside it on phones: by default the inset is the whole
|
|
235
|
+
* screen, flat. Opt in to a floating panel with --glass-mobile-gutter
|
|
236
|
+
* (e.g. 0.5rem), --glass-mobile-radius (e.g. var(--glass-radius)),
|
|
237
|
+
* --glass-mobile-border-width (e.g. 1px) and --glass-mobile-shadow
|
|
238
|
+
* (e.g. var(--glass-highlight), var(--glass-shadow)).
|
|
239
|
+
*/
|
|
209
240
|
[data-ui-theme='glass'] [data-slot='sidebar-inset'] {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
241
|
+
margin: calc(var(--app-topbar-h, 0px) + var(--app-notice-h, 0px) + var(--glass-mobile-gutter, 0px))
|
|
242
|
+
var(--glass-mobile-gutter, 0px) calc(var(--app-bottombar-h, 0px) + var(--glass-mobile-gutter, 0px));
|
|
243
|
+
max-height: var(--glass-inset-max-height, none);
|
|
244
|
+
border-width: var(--glass-mobile-border-width, 0px);
|
|
245
|
+
border-radius: var(--glass-mobile-radius, 0px);
|
|
246
|
+
box-shadow: var(--glass-mobile-shadow, none);
|
|
213
247
|
}
|
|
214
248
|
}
|
|
215
249
|
|
|
@@ -219,7 +253,8 @@
|
|
|
219
253
|
* gutter, over the dimmed overlay, so it takes the denser popover glass.
|
|
220
254
|
*/
|
|
221
255
|
[data-ui-theme='glass'] [data-mobile='true'][data-slot='sidebar'] {
|
|
222
|
-
inset-block: 0.5rem;
|
|
256
|
+
inset-block-start: calc(var(--app-topbar-h, 0px) + var(--app-notice-h, 0px) + 0.5rem);
|
|
257
|
+
inset-block-end: calc(var(--app-bottombar-h, 0px) + 0.5rem);
|
|
223
258
|
inset-inline-start: 0.5rem;
|
|
224
259
|
height: auto;
|
|
225
260
|
background-color: var(--popover);
|