@asteby/metacore-theme 2.23.0 → 2.25.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/README.md +31 -0
- package/package.json +1 -1
- package/styles/glass.css +64 -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
|
@@ -179,6 +179,29 @@
|
|
|
179
179
|
overflow: hidden;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
/*
|
|
183
|
+
* ─── Nested surfaces: any plain `.bg-card` inside the shell ───
|
|
184
|
+
* `.bg-card` already gets translucency + blur from the rule above, but none
|
|
185
|
+
* of the "floating panel" treatment (rim, lift, clip) that sidebar-inset and
|
|
186
|
+
* dialogs get — so a card sitting on the page (a settings panel, an empty
|
|
187
|
+
* state) reads as a flat, barely-differentiated rectangle instead of a
|
|
188
|
+
* floating one.
|
|
189
|
+
*
|
|
190
|
+
* Deliberately NOT `--glass-rim` here: that token is white, meant to catch
|
|
191
|
+
* light on a panel's OUTER edge against the colorful gradient backdrop
|
|
192
|
+
* (sidebar-inset, dialogs sit directly on it). A `.bg-card` is nested one
|
|
193
|
+
* layer deeper, already inside that panel's own blur-diluted near-white
|
|
194
|
+
* backdrop — a white rim there is white-on-white, invisible. `--border` is
|
|
195
|
+
* the token already defined above for exactly this ("a dark hairline reads
|
|
196
|
+
* on white glass, a white one doesn't") — reuse it instead of inventing a
|
|
197
|
+
* second rim color.
|
|
198
|
+
*/
|
|
199
|
+
[data-ui-theme='glass'] .bg-card {
|
|
200
|
+
border-color: var(--border);
|
|
201
|
+
box-shadow: var(--glass-highlight), var(--glass-shadow);
|
|
202
|
+
background-clip: padding-box;
|
|
203
|
+
}
|
|
204
|
+
|
|
182
205
|
/*
|
|
183
206
|
* The plain `sidebar` variant is flush to the viewport edge with a border:
|
|
184
207
|
* give it the same 0.5rem gutter the floating/inset variants have, and the
|
|
@@ -197,19 +220,53 @@
|
|
|
197
220
|
width: calc(var(--sidebar-width-icon) + 1rem);
|
|
198
221
|
}
|
|
199
222
|
|
|
223
|
+
/*
|
|
224
|
+
* Host chrome awareness. A host with fixed chrome around the app shell
|
|
225
|
+
* publishes its sizes as CSS variables on :root (all default to 0, so without
|
|
226
|
+
* them nothing changes):
|
|
227
|
+
*
|
|
228
|
+
* --app-topbar-h height of a fixed top bar
|
|
229
|
+
* --app-notice-h height of a notice strip under it (0 when hidden)
|
|
230
|
+
* --app-bottombar-h height of a bottom dock (mobile)
|
|
231
|
+
*
|
|
232
|
+
* The floating inset leaves them free: top margin = topbar + notice + gutter,
|
|
233
|
+
* bottom margin (mobile) = bottombar + gutter. Optionally cap the panel with
|
|
234
|
+
* --glass-inset-max-height: calc(100svh - var(--app-topbar-h) - var(--app-notice-h) - 1rem);
|
|
235
|
+
* when the shell wrapper is not height-bound (min-h-svh) — the SDK
|
|
236
|
+
* SidebarProvider is h-svh, where the panel already stretches to fit.
|
|
237
|
+
*/
|
|
200
238
|
@media (min-width: 768px) {
|
|
201
239
|
[data-ui-theme='glass'] [data-slot='sidebar'][data-variant='sidebar'] ~ [data-slot='sidebar-inset'] {
|
|
202
|
-
margin: 0.5rem;
|
|
240
|
+
margin: calc(var(--app-topbar-h, 0px) + var(--app-notice-h, 0px) + 0.5rem) 0.5rem 0.5rem;
|
|
203
241
|
margin-inline-start: 0;
|
|
242
|
+
max-height: var(--glass-inset-max-height, none);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/*
|
|
246
|
+
* Opt-in: an inset with no sidebar sibling (chat-like screens) floats the
|
|
247
|
+
* same way with <SidebarInset data-glass-float>.
|
|
248
|
+
*/
|
|
249
|
+
[data-ui-theme='glass'] [data-slot='sidebar-inset'][data-glass-float] {
|
|
250
|
+
margin: calc(var(--app-topbar-h, 0px) + var(--app-notice-h, 0px) + 0.5rem) 0.5rem 0.5rem;
|
|
251
|
+
max-height: var(--glass-inset-max-height, none);
|
|
204
252
|
}
|
|
205
253
|
}
|
|
206
254
|
|
|
207
255
|
@media (max-width: 767px) {
|
|
208
|
-
/*
|
|
256
|
+
/*
|
|
257
|
+
* No sidebar panel beside it on phones: by default the inset is the whole
|
|
258
|
+
* screen, flat. Opt in to a floating panel with --glass-mobile-gutter
|
|
259
|
+
* (e.g. 0.5rem), --glass-mobile-radius (e.g. var(--glass-radius)),
|
|
260
|
+
* --glass-mobile-border-width (e.g. 1px) and --glass-mobile-shadow
|
|
261
|
+
* (e.g. var(--glass-highlight), var(--glass-shadow)).
|
|
262
|
+
*/
|
|
209
263
|
[data-ui-theme='glass'] [data-slot='sidebar-inset'] {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
264
|
+
margin: calc(var(--app-topbar-h, 0px) + var(--app-notice-h, 0px) + var(--glass-mobile-gutter, 0px))
|
|
265
|
+
var(--glass-mobile-gutter, 0px) calc(var(--app-bottombar-h, 0px) + var(--glass-mobile-gutter, 0px));
|
|
266
|
+
max-height: var(--glass-inset-max-height, none);
|
|
267
|
+
border-width: var(--glass-mobile-border-width, 0px);
|
|
268
|
+
border-radius: var(--glass-mobile-radius, 0px);
|
|
269
|
+
box-shadow: var(--glass-mobile-shadow, none);
|
|
213
270
|
}
|
|
214
271
|
}
|
|
215
272
|
|
|
@@ -219,7 +276,8 @@
|
|
|
219
276
|
* gutter, over the dimmed overlay, so it takes the denser popover glass.
|
|
220
277
|
*/
|
|
221
278
|
[data-ui-theme='glass'] [data-mobile='true'][data-slot='sidebar'] {
|
|
222
|
-
inset-block: 0.5rem;
|
|
279
|
+
inset-block-start: calc(var(--app-topbar-h, 0px) + var(--app-notice-h, 0px) + 0.5rem);
|
|
280
|
+
inset-block-end: calc(var(--app-bottombar-h, 0px) + 0.5rem);
|
|
223
281
|
inset-inline-start: 0.5rem;
|
|
224
282
|
height: auto;
|
|
225
283
|
background-color: var(--popover);
|