@jskit-ai/material-web 0.1.1 → 0.1.3
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 +20 -0
- package/README.md +66 -15
- package/package.json +2 -2
- package/src/client/defaults.js +39 -26
- package/src/client/index.js +30 -6
- package/src/client/material.css +325 -20
- package/test/materialWeb.test.js +110 -1
- package/test/typography.test.js +43 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- Buttons' and pressable chips' state layers are their shape again: the 48dp touch target makes a button's overflow visible, which stopped it clipping Vuetify's overlay and underlay, so hover, focus and press drew a square on every round icon button (an app bar avatar, the rail's menu control) and on disabled ones. They now take the button's corners.
|
|
6
|
+
- A labelled switch sits after its label, at the end of the row, as Material 3 places it, instead of before it. A switch without a label of its own (one in a list row's append slot) stays where it is.
|
|
7
|
+
- `theme.typography: { brand, plain }` names Material 3's brand typeface (display, headline, title-large) and plain one (title-medium and -small, body, label) as CSS font-family values, both Roboto Flex by default. They become the theme variables `--v-font-heading` and `--v-font-body`, which Vuetify's type classes read; `material.css` keeps Roboto Flex for both only as a fallback in the `vuetify-core` layer, so an app's typefaces win. Upgrading: an app with its own fonts names them here instead of overriding `--v-font-body` or `font-family` in CSS.
|
|
8
|
+
- Cards have no default `elevation`: Vuetify's elevated variant (the default) keeps its level-1 shadow, and flat, tonal and outlined cards (banners, heroes, containers) have none, as Material 3 draws them; the same for cards in a bottom sheet.
|
|
9
|
+
- FABs keep Material 3's sizes instead of the common button's 40dp: 56dp, small 40dp, large 96dp (36dp icon), and the extended FAB 56dp tall.
|
|
10
|
+
- Small, x-small and large buttons get the 48dp touch target that default and icon buttons have, as a transparent hit area around the unchanged visual; stacked buttons are left as they are. The hit area is ink overflow (layout containment), so a button at the edge of a window or scroll container adds no scrollbar.
|
|
11
|
+
- A button label stays on one line and ends in an ellipsis when it is longer than its button, instead of spilling out of it.
|
|
5
12
|
- A theme colour can keep its own hue: `colors: { learning: { value: "#F5C518", blend: false } }` still gets its four roles, light and dark, without the shift toward the seed (Material Theme Builder's Blend switched off). A hex string, or `{ value }`, stays harmonized as before.
|
|
13
|
+
- `v-btn-toggle` is a Material 3 segmented button: a 40dp outlined pill (the outline role) whose segments share its width, each with a 48dp touch target; an unselected segment has no container, and the selected one is `secondary-container` and leads with a check, which takes the place of its icon. Its segments, and those of any `v-btn-group`, have 12dp sides instead of the common button's 24dp, so a group in a filter row's narrow `auto` column keeps whole labels instead of squeezing a segment to a sliver.
|
|
14
|
+
- Filter chips are Material 3's: chips in a `v-chip-group` (now `filter` by default) and chips that toggle with `aria-pressed` have an outline-role border with no container when unselected, and `secondary-container` with a leading check when selected; 32dp tall with 8dp corners, 16dp sides (8dp beside the check) and a 48dp touch target. Outlined chips draw the outline role, as every Material 3 chip does, instead of outline-variant.
|
|
15
|
+
- Fixed tabs (`v-tabs grow`) share the row's width equally without Vuetify's 90dp tab minimum, so five short ones fit a phone; when a label still can't fit, the tabs scroll instead of cutting it.
|
|
16
|
+
- A menu's own list is its container (surface-container at level 2, with the menu's 4dp corners), now drawn by `material.css`, and a list inside a card or sheet in the menu, a rich menu panel, is a plain list again. The defaults set nothing under `VMenu`, so a `v-select`'s typeahead scrolls to and focuses its match again, whether typed while the menu opens or after: under any `VMenu` sub-component default, Vuetify 4.2.1 to 4.3.2 rebuild the menu's root defaults when an ancestor of the select re-renders (a form does on every change), its virtual list resets its item height to 0, and the match further down ("o" then "s" for Osaka) was selected but never shown ([vuetifyjs/vuetify#23366](https://github.com/vuetifyjs/vuetify/issues/23366)). See the README's Upstream workarounds.
|
|
17
|
+
- The defaults set nothing under `VDialog`: material.css draws a dialog's card (surface-container-high at level 3, 28dp corners) and every card's 12dp corners, which the `VCard` default drew as an inline `rounded` style. Under any `VDialog` default, Vuetify 4.2.1 to 4.3.2 rebuild a dialog's defaults whenever an ancestor re-renders, as they do a menu's, so a virtual-scroll list in the dialog fed fresh items lost its item heights and `scrollToIndex` gave up. A bottom sheet's card is now the card's surface-container-low with square corners inside the sheet's 28dp top ones, as the `VBottomSheet` default meant but never reached (the dialog a bottom sheet renders starts again from the app's defaults); it was surface-container-high with rounded bottom corners. An app's `rounded-*` class on a card now takes effect, as its `rounded` prop always did.
|
|
18
|
+
- Dialog actions sit 24dp from the dialog's sides and bottom, 8dp apart.
|
|
19
|
+
- Cards rest flat: the default card is `variant="flat"` on surface-container-low, and `variant="elevated"` is Material 3's elevated card with its level-1 shadow. Expansion panels are flat by default. Dialogs keep their level 3.
|
|
20
|
+
- Tonal buttons and chips, disabled filled buttons, and every button's or pressable chip's hover, focus, pressed and selected layer are one pill again: their state layer, underlay and press ripple take the control's corners. Since 0.1.2's 48dp touch target unclipped them, Vuetify's square layers drew square tinted boxes behind the pill.
|
|
21
|
+
- A disabled filled, elevated or tonal button is Material 3's on-surface at 12% with a 38% label, whatever its colour, instead of a faded primary.
|
|
22
|
+
- A button with `to` is active only on exactly its route (`exact` by default), so a button to a section no longer shows selected on the pages under it; `:active="false"` on such buttons can go. Tabs keep their own.
|
|
23
|
+
- A pagination's current page has the activated state layer, so its number shows; it was a solid square, since Vuetify ties it to the border opacity.
|
|
24
|
+
- Adjacent buttons no longer take each other's presses. An icon button is never under Material 3's 32dp extra-small size, so `density="compact"` and `"comfortable"` icon buttons (20dp and 28dp since 0.1.2's 40dp icon buttons) hold their 24dp icon again; and a button that follows another one stops its 48dp touch target at its own edge on that side, so its target, painted over the earlier button, never covers it. A press or click on either button's visible box reaches that button, as in a table row's compact actions or a pair of tab actions.
|
|
25
|
+
- A shown placeholder is on-surface-variant at full strength (it was faded on-surface at 2.2:1); a labelled field still hides it until the field is active.
|
|
6
26
|
|
|
7
27
|
## 0.1.0
|
|
8
28
|
|
package/README.md
CHANGED
|
@@ -21,7 +21,8 @@ The app's only theme file is `src/theme/index.js`:
|
|
|
21
21
|
export const theme = {
|
|
22
22
|
seed: "#6750A4",
|
|
23
23
|
colors: {},
|
|
24
|
-
icons: {}
|
|
24
|
+
icons: {},
|
|
25
|
+
typography: {}
|
|
25
26
|
};
|
|
26
27
|
```
|
|
27
28
|
|
|
@@ -54,21 +55,71 @@ export const theme = {
|
|
|
54
55
|
`theme.icons` as `{ name: "<24x24 path data>" }`, copied from the Material
|
|
55
56
|
Symbols Rounded glyph (the `material-symbols:<name>-rounded` path in
|
|
56
57
|
`@iconify-json/material-symbols`); `$name` then works everywhere.
|
|
57
|
-
- **Type.** Roboto Flex (variable weight)
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
- **Type.** Material 3's two typefaces, Roboto Flex (variable weight) unless
|
|
59
|
+
the app names its own in `theme.typography`: `brand` for display, headline
|
|
60
|
+
and title-large, `plain` for title-medium and -small, body and label. Each is
|
|
61
|
+
a CSS font-family value, such as `'"Fraunces", serif'`; the app loads the
|
|
62
|
+
font itself. The Material 3 type scale is Vuetify's `text-display-*`,
|
|
63
|
+
`text-headline-*`, `text-title-*`, `text-body-*` and `text-label-*` classes,
|
|
64
|
+
which read them as `--v-font-heading` and `--v-font-body`.
|
|
60
65
|
- **Components.** The md3 blueprint plus JSKIT's defaults: full-shape filled
|
|
61
|
-
buttons
|
|
62
|
-
fields, 8dp chips that close with
|
|
63
|
-
the inverse-surface snackbar, the Material switch and the 16dp
|
|
64
|
-
`primary-container` FAB
|
|
65
|
-
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
buttons (with `to`, active only on exactly their route), cards that rest
|
|
67
|
+
flat on `surface-container-low` (`variant="elevated"` for level 1), flat expansion panels, outlined fields, 8dp chips that close with
|
|
68
|
+
`$close`, the inverse-surface snackbar, the Material switch and the 16dp
|
|
69
|
+
`primary-container` FAB; `v-btn-toggle` as a segmented button and
|
|
70
|
+
`v-chip-group` as filter chips, selected in `secondary-container`.
|
|
71
|
+
- **`material.css`.** What props cannot set: 40dp buttons and 40dp icon
|
|
72
|
+
buttons (none under 32dp, whatever its density), a 48dp touch target on
|
|
73
|
+
every button size (small and x-small keep their look, and their state
|
|
74
|
+
layers keep their corners) that stops at a neighbouring button, disabled container
|
|
75
|
+
buttons in on-surface at 12% and 38%, a pagination's current page in the
|
|
76
|
+
activated layer, placeholders in on-surface-variant, one-line labels that
|
|
77
|
+
end in an ellipsis, 12dp card corners, 28dp dialogs on
|
|
78
|
+
`surface-container-high` at level 3 and bottom sheets with a square card on
|
|
79
|
+
`surface-container-low`, square full-screen dialogs on `surface`, a 48dp touch target on clickable chips,
|
|
80
|
+
inverse-surface tooltips, 40dp outlined segmented buttons and outlined
|
|
81
|
+
filter chips that lead with a check when selected (chips with
|
|
82
|
+
`aria-pressed` too), fixed tabs that share the width or else scroll, dialog
|
|
83
|
+
actions 24dp from the edges, a menu's own list as its container
|
|
84
|
+
(`surface-container` at level 2, in the menu's 4dp corners) while a list in a
|
|
85
|
+
rich menu panel (a card or sheet in the menu) stays plain, emphasized easing
|
|
86
|
+
and reduced motion. Its
|
|
87
|
+
component rules sit in Vuetify's `vuetify-overrides` cascade layer, so an
|
|
88
|
+
app's own props and utility classes still win; only a disabled button's
|
|
89
|
+
colours and a full-screen dialog's surface are unlayered, over the colour
|
|
90
|
+
class a `color` prop gives. Nothing uses
|
|
91
|
+
`!important` or Sass.
|
|
92
|
+
|
|
93
|
+
## Upstream workarounds
|
|
94
|
+
|
|
95
|
+
Each one comes off when the upstream fix ships; its test says when.
|
|
96
|
+
|
|
97
|
+
- **Vuetify 4.2.1 to 4.3.2 (measured): `VMenu` defaults and a `v-select`
|
|
98
|
+
typeahead.** With any `VMenu` entry in the app's defaults, a sub-component
|
|
99
|
+
default such as `VMenu: { VSheet: {} }` or even a prop default such as
|
|
100
|
+
`VMenu: { scrim: false }`, a re-render of an ancestor of a `v-select` makes
|
|
101
|
+
VMenu's `root` defaults provider build a new merged object; the menu's
|
|
102
|
+
`VVirtualScroll` then resets its item height to 0 and `scrollToIndex`
|
|
103
|
+
silently gives up. Letters typed during or after the menu's opening change
|
|
104
|
+
the selection, but the match further down ("o" then "s" for Osaka, the last
|
|
105
|
+
AWS region) is never scrolled to or focused. JSKIT sets no `VMenu` defaults:
|
|
106
|
+
`material.css` draws a menu's own list as its container instead. Upstream
|
|
107
|
+
issue:
|
|
108
|
+
[vuetifyjs/vuetify#23366](https://github.com/vuetifyjs/vuetify/issues/23366).
|
|
109
|
+
connectors-web's browser test "Vuetify still loses a select's typeahead
|
|
110
|
+
match under a VMenu sub-component default when a panel around it re-renders"
|
|
111
|
+
fails once a Vuetify release past 4.3.2 fixes it; then delete that test, and
|
|
112
|
+
the menu list may go back to `VMenu` defaults. An app that adds its own
|
|
113
|
+
`VMenu` defaults brings the bug back, except in connectors-web's
|
|
114
|
+
configuration form, whose fields take the app's root defaults instead of
|
|
115
|
+
each expansion panel's; an app's own panels can wrap their fields in
|
|
116
|
+
`<v-defaults-provider root>` the same way. `VDialog`, Vuetify's other `root`
|
|
117
|
+
defaults provider, does the same to a virtual-scroll list in a dialog under
|
|
118
|
+
any `VDialog` default, so JSKIT sets none either: `material.css` draws a
|
|
119
|
+
dialog's card (and every card's 12dp corners, which a `rounded` default
|
|
120
|
+
would make an inline style). shell-web's browser test "a virtual-scroll list
|
|
121
|
+
in a dialog reaches its last item after the page around it re-renders"
|
|
122
|
+
guards it; it fails with `VDialog: { VCard: {} }` in the defaults.
|
|
72
123
|
|
|
73
124
|
## Maintaining the icon set
|
|
74
125
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/material-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Exact Material 3 for JSKIT Vuetify apps: seed-generated light and dark schemes, Material Symbols Rounded icon aliases, Roboto Flex and Material 3 component defaults.",
|
|
6
6
|
"exports": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
|
-
"test": "
|
|
37
|
+
"test": "jskit test",
|
|
38
38
|
"symbols:generate": "node ./scripts/generate-symbols.mjs"
|
|
39
39
|
}
|
|
40
40
|
}
|
package/src/client/defaults.js
CHANGED
|
@@ -1,42 +1,62 @@
|
|
|
1
|
-
// JSKIT's Material 3 component defaults, on top of Vuetify's md3 blueprint: full-shape filled buttons,
|
|
2
|
-
// on surface-container-low
|
|
3
|
-
// inverse-surface snackbar, the Material switch,
|
|
4
|
-
//
|
|
1
|
+
// JSKIT's Material 3 component defaults, on top of Vuetify's md3 blueprint: full-shape filled buttons, cards that rest
|
|
2
|
+
// flat on surface-container-low, flat expansion panels, outlined fields, 8dp chips that close with $close, segmented buttons and
|
|
3
|
+
// filter chips that select in secondary-container, the inverse-surface snackbar, the Material switch,
|
|
4
|
+
// and the 16dp primary-container FAB. A number for `rounded` is an exact corner in dp. Card, dialog and bottom sheet
|
|
5
|
+
// corners and colours, a menu's own list, and the sizes and states props cannot set, are in material.css. No VMenu sub-component
|
|
6
|
+
// defaults: under them, in Vuetify 4.2.1 to 4.3.2, an ancestor's re-render makes the menu's virtual list lose its item
|
|
7
|
+
// heights, so a v-select's typeahead never scrolls to its match (https://github.com/vuetifyjs/vuetify/issues/23366;
|
|
8
|
+
// README, Upstream workarounds).
|
|
5
9
|
const materialDefaults = Object.freeze({
|
|
6
10
|
VAppBar: {
|
|
7
11
|
color: "surface",
|
|
8
12
|
flat: true,
|
|
9
13
|
height: 64
|
|
10
14
|
},
|
|
15
|
+
// `exact`: a button with `to` is active (its selected state layer) only on exactly its route, not on the pages under
|
|
16
|
+
// it; navigation that marks a section, such as tabs, keeps its own.
|
|
11
17
|
VBtn: {
|
|
12
18
|
color: "primary",
|
|
19
|
+
exact: true,
|
|
13
20
|
rounded: "pill",
|
|
14
21
|
variant: "flat"
|
|
15
22
|
},
|
|
23
|
+
// Cards rest flat. `variant="elevated"` is Material 3's elevated card, with its level-1 shadow; no default
|
|
24
|
+
// elevation, which would lift flat, tonal and outlined cards too. Their 12dp corners are in material.css, so a
|
|
25
|
+
// dialog's card can have 28dp ones: a `rounded` number would be an inline style no rule can outrank, and the md3
|
|
26
|
+
// blueprint's `rounded: "lg"` goes too.
|
|
16
27
|
VCard: {
|
|
17
28
|
color: "surface-container-low",
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
rounded: undefined,
|
|
30
|
+
variant: "flat"
|
|
20
31
|
},
|
|
21
32
|
VChip: {
|
|
22
33
|
closeIcon: "$close",
|
|
23
34
|
rounded: 8
|
|
24
35
|
},
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
// Material 3 segmented buttons: an outlined pill divided into segments, the selected one in secondary-container.
|
|
37
|
+
VBtnToggle: {
|
|
38
|
+
border: true,
|
|
39
|
+
color: "secondary-container",
|
|
40
|
+
divided: true,
|
|
41
|
+
rounded: "pill",
|
|
42
|
+
variant: "flat"
|
|
43
|
+
},
|
|
44
|
+
// Material 3 filter chips: a selected chip is secondary-container with a check; material.css draws the outline.
|
|
45
|
+
VChipGroup: {
|
|
46
|
+
color: "secondary-container",
|
|
47
|
+
filter: true,
|
|
48
|
+
variant: "flat"
|
|
32
49
|
},
|
|
50
|
+
// A dialog's and a bottom sheet's card are drawn by material.css. Nothing goes under VDialog, Vuetify's other root
|
|
51
|
+
// defaults provider: with any default there, a virtual-scroll list in a dialog loses its item heights whenever an
|
|
52
|
+
// ancestor re-renders, as a select's list does under VMenu defaults (README, Upstream workarounds). Under
|
|
53
|
+
// VBottomSheet, a VCard default never reached the card: the dialog it renders starts again from the app's defaults.
|
|
33
54
|
VBottomSheet: {
|
|
34
|
-
contentClass: "jskit-material-bottom-sheet"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
55
|
+
contentClass: "jskit-material-bottom-sheet"
|
|
56
|
+
},
|
|
57
|
+
// Expansion panels rest flat, as Material 3's lists and cards do.
|
|
58
|
+
VExpansionPanels: {
|
|
59
|
+
flat: true
|
|
40
60
|
},
|
|
41
61
|
VFab: {
|
|
42
62
|
color: "primary-container",
|
|
@@ -46,13 +66,6 @@ const materialDefaults = Object.freeze({
|
|
|
46
66
|
VList: {
|
|
47
67
|
bgColor: "transparent"
|
|
48
68
|
},
|
|
49
|
-
VMenu: {
|
|
50
|
-
VList: {
|
|
51
|
-
bgColor: "surface-container",
|
|
52
|
-
elevation: 2,
|
|
53
|
-
rounded: 4
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
69
|
VSnackbar: {
|
|
57
70
|
color: "inverse-surface",
|
|
58
71
|
rounded: 4,
|
package/src/client/index.js
CHANGED
|
@@ -5,6 +5,24 @@ import { materialSymbols } from "./symbols.js";
|
|
|
5
5
|
|
|
6
6
|
// The default Material 3 seed, the baseline purple of the Material 3 guidelines.
|
|
7
7
|
const DEFAULT_SEED = "#6750A4";
|
|
8
|
+
// Roboto Flex, Material 3's default for both typefaces (material.css loads it).
|
|
9
|
+
const ROBOTO_FLEX = '"Roboto Flex Variable", "Roboto Flex", Roboto, system-ui, sans-serif';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Material 3's two typefaces as Vuetify theme variables: brand for display, headline and title-large (Vuetify's
|
|
13
|
+
* heading font), plain for title-medium and -small, body and label (its body font). Each is a CSS font-family value.
|
|
14
|
+
* @param {{ brand?: string, plain?: string }} typography
|
|
15
|
+
*/
|
|
16
|
+
function typefaceVariables({ brand = ROBOTO_FLEX, plain = ROBOTO_FLEX } = {}) {
|
|
17
|
+
const family = (value, role) => {
|
|
18
|
+
const text = String(value ?? "").trim();
|
|
19
|
+
if (!text || /[;{}<>]/u.test(text)) {
|
|
20
|
+
throw new TypeError(`Theme typography.${role} needs a CSS font-family value, such as '"Inter", sans-serif', not "${text}".`);
|
|
21
|
+
}
|
|
22
|
+
return text;
|
|
23
|
+
};
|
|
24
|
+
return { "font-heading": family(brand, "brand"), "font-body": family(plain, "plain") };
|
|
25
|
+
}
|
|
8
26
|
|
|
9
27
|
/**
|
|
10
28
|
* An app's own icons as Vuetify aliases: `{ name: "<24x24 path data>" }` becomes `$name`.
|
|
@@ -24,12 +42,18 @@ function appIconAliases(icons) {
|
|
|
24
42
|
|
|
25
43
|
/**
|
|
26
44
|
* Vuetify options for an exact Material 3 app: the md3 blueprint, light and dark schemes generated from the seed (with
|
|
27
|
-
* the app's own colours as harmonized custom colours), following the system's light or dark setting,
|
|
28
|
-
*
|
|
29
|
-
* createVuetify(); import
|
|
30
|
-
* @
|
|
45
|
+
* the app's own colours as harmonized custom colours), following the system's light or dark setting, the brand and
|
|
46
|
+
* plain typefaces (Roboto Flex unless the app names its own), Material Symbols Rounded behind every icon alias (plus
|
|
47
|
+
* the app's own), and JSKIT's Material 3 component defaults. Pass the result to createVuetify(); import
|
|
48
|
+
* "@jskit-ai/material-web/client/material.css" after "vuetify/styles".
|
|
49
|
+
* @param {{ seed?: string, colors?: Record<string, string | { value: string, blend?: boolean }>, icons?: Record<string, string>, typography?: { brand?: string, plain?: string } }} [theme]
|
|
31
50
|
*/
|
|
32
|
-
function createMaterialVuetifyOptions({ seed = DEFAULT_SEED, colors = {}, icons = {} } = {}) {
|
|
51
|
+
function createMaterialVuetifyOptions({ seed = DEFAULT_SEED, colors = {}, icons = {}, typography = {} } = {}) {
|
|
52
|
+
const themes = materialThemes(seed, colors);
|
|
53
|
+
const typefaces = typefaceVariables(typography);
|
|
54
|
+
for (const theme of Object.values(themes)) {
|
|
55
|
+
theme.variables = { ...theme.variables, ...typefaces };
|
|
56
|
+
}
|
|
33
57
|
return {
|
|
34
58
|
blueprint: md3,
|
|
35
59
|
defaults: materialDefaults,
|
|
@@ -42,7 +66,7 @@ function createMaterialVuetifyOptions({ seed = DEFAULT_SEED, colors = {}, icons
|
|
|
42
66
|
},
|
|
43
67
|
theme: {
|
|
44
68
|
defaultTheme: "system",
|
|
45
|
-
themes
|
|
69
|
+
themes
|
|
46
70
|
}
|
|
47
71
|
};
|
|
48
72
|
}
|
package/src/client/material.css
CHANGED
|
@@ -2,13 +2,25 @@
|
|
|
2
2
|
* JSKIT's Material 3 rules for Vuetify: the sizes and shapes component props cannot set, Roboto Flex, emphasized
|
|
3
3
|
* motion and reduced motion. Import it after "vuetify/styles". Component rules live in Vuetify's own
|
|
4
4
|
* vuetify-overrides cascade layer, so they beat Vuetify's component styles while an app's utility classes
|
|
5
|
-
* (rounded-0, bg-*, pa-*) and props still win without any rule forcing priority.
|
|
5
|
+
* (rounded-0, bg-*, pa-*) and props still win without any rule forcing priority. A few rules are unlayered, over
|
|
6
|
+
* the colour class a color prop gives: a disabled button's colours and a full-screen dialog's surface.
|
|
6
7
|
*/
|
|
7
8
|
@layer vuetify-core, vuetify-components, vuetify-overrides, vuetify-utilities, vuetify-final;
|
|
8
9
|
@import "@fontsource-variable/roboto-flex/index.css";
|
|
9
10
|
|
|
11
|
+
/*
|
|
12
|
+
* Material 3's brand typeface (display, headline, title-large: Vuetify's heading font) and plain one (the rest: its
|
|
13
|
+
* body font), Roboto Flex by default. The theme's own, from createMaterialVuetifyOptions({ typography }), come in a
|
|
14
|
+
* later Vuetify layer and win, so this is only the fallback.
|
|
15
|
+
*/
|
|
16
|
+
@layer vuetify-core {
|
|
17
|
+
:root {
|
|
18
|
+
--v-font-heading: "Roboto Flex Variable", "Roboto Flex", Roboto, system-ui, sans-serif;
|
|
19
|
+
--v-font-body: "Roboto Flex Variable", "Roboto Flex", Roboto, system-ui, sans-serif;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
10
23
|
:root {
|
|
11
|
-
--v-font-body: "Roboto Flex Variable", "Roboto Flex", Roboto, system-ui, sans-serif;
|
|
12
24
|
--md-sys-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);
|
|
13
25
|
--md-sys-motion-easing-emphasized: cubic-bezier(0.2, 0, 0, 1);
|
|
14
26
|
--md-sys-motion-easing-emphasized-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1);
|
|
@@ -20,55 +32,132 @@
|
|
|
20
32
|
}
|
|
21
33
|
|
|
22
34
|
@layer vuetify-overrides {
|
|
23
|
-
/* Common buttons: 40dp tall, full shape, 24dp side padding (16dp beside an icon)
|
|
24
|
-
.v-btn--size-default:not(.v-btn--stacked, .v-btn--icon) {
|
|
35
|
+
/* Common buttons: 40dp tall, full shape, 24dp side padding (16dp beside an icon). */
|
|
36
|
+
.v-btn--size-default:not(.v-btn--stacked, .v-btn--icon, .v-fab .v-btn) {
|
|
25
37
|
--v-btn-height: 40px;
|
|
26
38
|
padding-inline: 24px;
|
|
27
39
|
}
|
|
28
40
|
|
|
29
|
-
.v-btn--size-default:not(.v-btn--stacked, .v-btn--icon):has(> .v-btn__prepend) {
|
|
41
|
+
.v-btn--size-default:not(.v-btn--stacked, .v-btn--icon, .v-fab .v-btn):has(> .v-btn__prepend) {
|
|
30
42
|
padding-inline-start: 16px;
|
|
31
43
|
}
|
|
32
44
|
|
|
33
|
-
.v-btn--size-default:not(.v-btn--stacked, .v-btn--icon):has(> .v-btn__append) {
|
|
45
|
+
.v-btn--size-default:not(.v-btn--stacked, .v-btn--icon, .v-fab .v-btn):has(> .v-btn__append) {
|
|
34
46
|
padding-inline-end: 16px;
|
|
35
47
|
}
|
|
36
48
|
|
|
37
|
-
.v-btn--size-default.v-btn--variant-text:not(.v-btn--stacked, .v-btn--icon) {
|
|
49
|
+
.v-btn--size-default.v-btn--variant-text:not(.v-btn--stacked, .v-btn--icon, .v-fab .v-btn) {
|
|
38
50
|
padding-inline: 12px;
|
|
39
51
|
}
|
|
40
52
|
|
|
41
53
|
/* Icon buttons: a 40dp state layer around a 24dp icon. */
|
|
42
|
-
.v-btn--icon.v-btn--size-default {
|
|
54
|
+
.v-btn--icon.v-btn--size-default:not(.v-fab .v-btn) {
|
|
43
55
|
--v-btn-height: 28px;
|
|
44
56
|
}
|
|
45
57
|
|
|
58
|
+
/* No icon button is smaller than Material 3's 32dp extra-small one, so a comfortable or compact one (and a compact
|
|
59
|
+
small one) still holds its icon, where Vuetify's density would take it to 28dp or 20dp. */
|
|
60
|
+
.v-btn--icon:not(.v-fab .v-btn) {
|
|
61
|
+
min-height: 32px;
|
|
62
|
+
min-width: 32px;
|
|
63
|
+
}
|
|
64
|
+
|
|
46
65
|
.v-btn--icon.v-btn--size-default .v-icon {
|
|
47
66
|
font-size: 24px;
|
|
48
67
|
}
|
|
49
68
|
|
|
50
|
-
|
|
69
|
+
/* Switches: Material 3 puts the switch after its label, at the end of the row. A switch without a label (one a
|
|
70
|
+
list row's append slot holds) stays where it is. */
|
|
71
|
+
.v-switch .v-selection-control:has(> .v-label) {
|
|
72
|
+
flex-direction: row-reverse;
|
|
73
|
+
justify-content: space-between;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.v-switch .v-selection-control > .v-label {
|
|
77
|
+
padding-inline: 0 16px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* FABs are not common buttons: 56dp (small 40dp, large 96dp with a 36dp icon), and the extended FAB is 56dp tall. */
|
|
81
|
+
.v-fab .v-btn {
|
|
82
|
+
--jskit-fab-size: 56px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.v-fab .v-btn--size-small {
|
|
86
|
+
--jskit-fab-size: 40px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.v-fab .v-btn--size-large {
|
|
90
|
+
--jskit-fab-size: 96px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.v-fab .v-btn--icon {
|
|
94
|
+
height: var(--jskit-fab-size);
|
|
95
|
+
width: var(--jskit-fab-size);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.v-fab--extended .v-btn {
|
|
99
|
+
--v-btn-height: var(--jskit-fab-size);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.v-fab .v-btn .v-icon {
|
|
103
|
+
font-size: 24px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.v-fab .v-btn--size-large .v-icon {
|
|
107
|
+
font-size: 36px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* Every button, small, x-small and icon buttons included, keeps its visual size and gets a 48dp touch target: a
|
|
111
|
+
transparent hit area centred on it. Layout containment makes what reaches outside the button ink overflow, so a
|
|
112
|
+
hit area at the edge of a window or scroll container never adds a scrollbar. */
|
|
113
|
+
.v-btn:not(.v-btn--stacked) {
|
|
114
|
+
contain: layout;
|
|
51
115
|
overflow: visible;
|
|
52
116
|
}
|
|
53
117
|
|
|
54
|
-
.v-btn
|
|
118
|
+
.v-btn:not(.v-btn--stacked)::before {
|
|
55
119
|
content: "";
|
|
56
|
-
|
|
57
|
-
|
|
120
|
+
inset-block: min(0px, calc(50% - 24px));
|
|
121
|
+
inset-inline: min(0px, calc(50% - 24px));
|
|
58
122
|
position: absolute;
|
|
59
|
-
top: 50%;
|
|
60
|
-
transform: translate(-50%, -50%);
|
|
61
|
-
width: max(100%, 48px);
|
|
62
123
|
}
|
|
63
124
|
|
|
64
|
-
/*
|
|
125
|
+
/* A touch target never covers the button beside it: a button that follows another one paints over it, so its
|
|
126
|
+
target stops at its own edge on that side, and a press on either button's visible box reaches that button. The
|
|
127
|
+
earlier button's target still reaches into the gap, under the later one. */
|
|
128
|
+
.v-btn + .v-btn:not(.v-btn--stacked)::before {
|
|
129
|
+
inset-inline-start: 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* With buttons and pressable chips no longer clipping (their touch target reaches outside them), their state layer,
|
|
133
|
+
underlay and ripple take the control's corners themselves, as the focus ring already does: a tonal button or chip,
|
|
134
|
+
a disabled filled button (whose state layer shows at rest) and a hovered, focused, pressed or selected one stay
|
|
135
|
+
one pill, not a square tinted block. Vuetify squares a button's ripple container, relying on the button's clip. */
|
|
136
|
+
.v-btn > .v-btn__overlay,
|
|
137
|
+
.v-btn > .v-btn__underlay,
|
|
138
|
+
.v-btn > .v-ripple__container,
|
|
139
|
+
.v-chip > .v-chip__overlay,
|
|
140
|
+
.v-chip > .v-chip__underlay,
|
|
141
|
+
.v-chip > .v-ripple__container {
|
|
142
|
+
border-radius: inherit;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* A label stays on one line, as Material 3 draws it; one longer than its button ends in an ellipsis. */
|
|
146
|
+
.v-btn:not(.v-btn--stacked, .v-btn--icon) > .v-btn__content:not(:has(> *)) {
|
|
147
|
+
display: block;
|
|
148
|
+
min-width: 0;
|
|
149
|
+
overflow: hidden;
|
|
150
|
+
text-overflow: ellipsis;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* Outlined buttons and outlined chips draw the outline role. */
|
|
65
154
|
.v-btn--variant-outlined:not([class*=" text-"]) {
|
|
66
155
|
border-color: rgb(var(--v-theme-outline));
|
|
67
156
|
color: rgb(var(--v-theme-primary));
|
|
68
157
|
}
|
|
69
158
|
|
|
70
159
|
.v-chip--variant-outlined:not([class*=" text-"]) {
|
|
71
|
-
border-color: rgb(var(--v-theme-outline
|
|
160
|
+
border-color: rgb(var(--v-theme-outline));
|
|
72
161
|
color: rgb(var(--v-theme-on-surface-variant));
|
|
73
162
|
}
|
|
74
163
|
|
|
@@ -84,6 +173,11 @@
|
|
|
84
173
|
overflow: visible;
|
|
85
174
|
}
|
|
86
175
|
|
|
176
|
+
.v-chip--link.v-chip--size-default > .v-chip__overlay,
|
|
177
|
+
.v-chip--link.v-chip--size-default > .v-chip__underlay {
|
|
178
|
+
border-radius: inherit;
|
|
179
|
+
}
|
|
180
|
+
|
|
87
181
|
.v-chip--link.v-chip--size-default::after {
|
|
88
182
|
content: "";
|
|
89
183
|
height: max(100%, 48px);
|
|
@@ -95,7 +189,15 @@
|
|
|
95
189
|
z-index: -1;
|
|
96
190
|
}
|
|
97
191
|
|
|
98
|
-
/*
|
|
192
|
+
/* Cards: 12dp corners. Here and not a `rounded` default, so a dialog's card can have its own, and an app's rounded
|
|
193
|
+
prop or rounded-* class still wins. */
|
|
194
|
+
.v-card {
|
|
195
|
+
border-radius: 12px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* Dialogs: 28dp corners and a headline-small title, and the card at level 3; full-screen dialogs are square. CSS,
|
|
199
|
+
not VDialog sub-component defaults, which cost a virtual-scroll list in a dialog its item heights (README,
|
|
200
|
+
Upstream workarounds). */
|
|
99
201
|
.v-dialog > .v-overlay__content > .v-card,
|
|
100
202
|
.v-dialog > .v-overlay__content > .v-sheet,
|
|
101
203
|
.v-dialog > .v-overlay__content > form > .v-card,
|
|
@@ -119,6 +221,13 @@
|
|
|
119
221
|
color: rgb(var(--v-theme-on-surface-variant));
|
|
120
222
|
}
|
|
121
223
|
|
|
224
|
+
.v-dialog:not(.v-bottom-sheet) > .v-overlay__content > .v-card,
|
|
225
|
+
.v-dialog:not(.v-bottom-sheet) > .v-overlay__content > form > .v-card {
|
|
226
|
+
--v-elevation-overlay: color-mix(in srgb, var(--v-elevation-overlay-color) 6%, transparent);
|
|
227
|
+
box-shadow: 0px 1px 3px 0px rgba(var(--v-shadow-color), var(--v-shadow-key-opacity, 0.3)),
|
|
228
|
+
0px 4px 8px 3px rgba(var(--v-shadow-color), var(--v-shadow-ambient-opacity, 0.15));
|
|
229
|
+
}
|
|
230
|
+
|
|
122
231
|
.v-dialog--fullscreen > .v-overlay__content > .v-card,
|
|
123
232
|
.v-dialog--fullscreen > .v-overlay__content > .v-sheet,
|
|
124
233
|
.v-dialog--fullscreen > .v-overlay__content > form > .v-card,
|
|
@@ -126,12 +235,17 @@
|
|
|
126
235
|
border-radius: 0;
|
|
127
236
|
}
|
|
128
237
|
|
|
129
|
-
/* Bottom sheets: 28dp top corners. */
|
|
238
|
+
/* Bottom sheets: 28dp top corners on the sheet, whose card (a card's surface-container-low) is square inside it. */
|
|
130
239
|
.jskit-material-bottom-sheet {
|
|
131
240
|
border-radius: 28px 28px 0 0;
|
|
132
241
|
overflow: hidden;
|
|
133
242
|
}
|
|
134
243
|
|
|
244
|
+
.v-bottom-sheet > .v-overlay__content > .v-card,
|
|
245
|
+
.v-bottom-sheet > .v-overlay__content > form > .v-card {
|
|
246
|
+
border-radius: 0;
|
|
247
|
+
}
|
|
248
|
+
|
|
135
249
|
/* Plain tooltips: inverse surface, 4dp corners, body-small. */
|
|
136
250
|
.v-tooltip > .v-overlay__content {
|
|
137
251
|
background: rgb(var(--v-theme-inverse-surface));
|
|
@@ -144,6 +258,166 @@
|
|
|
144
258
|
padding: 4px 8px;
|
|
145
259
|
}
|
|
146
260
|
|
|
261
|
+
/* Segmented buttons (v-btn-toggle): a 40dp pill in the outline role whose segments share its width, each with a 48dp
|
|
262
|
+
touch target. An unselected segment has no container; the selected one is secondary-container and leads with a
|
|
263
|
+
check, which takes the place of its icon. */
|
|
264
|
+
.v-btn-toggle {
|
|
265
|
+
border-color: rgb(var(--v-theme-outline));
|
|
266
|
+
color: rgb(var(--v-theme-on-surface));
|
|
267
|
+
overflow: visible;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.v-btn-toggle.v-btn-group--horizontal {
|
|
271
|
+
display: inline-grid;
|
|
272
|
+
grid-auto-columns: 1fr;
|
|
273
|
+
grid-auto-flow: column;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.v-btn-toggle.v-btn-group--horizontal.v-btn-group--density-default:not(.v-btn-group--has-size) {
|
|
277
|
+
height: 40px;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.v-btn-toggle.v-btn-group--horizontal.v-btn-group--divided > .v-btn:not(:last-child) {
|
|
281
|
+
border-inline-end-color: rgb(var(--v-theme-outline));
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.v-btn-toggle.v-btn-group--vertical.v-btn-group--divided > .v-btn:not(:last-child) {
|
|
285
|
+
border-block-end-color: rgb(var(--v-theme-outline));
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.v-btn-toggle > .v-btn:not(.v-btn--active) {
|
|
289
|
+
background: transparent;
|
|
290
|
+
color: inherit;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/* A segment, in a segmented button or any button group, has Material 3's 12dp sides, not a common button's 24dp
|
|
294
|
+
(16dp beside an icon), so a group in a narrow column keeps whole labels instead of squeezing its segments. */
|
|
295
|
+
.v-btn-group > .v-btn.v-btn--size-default:not(.v-btn--icon, .v-btn--stacked) {
|
|
296
|
+
min-width: 48px;
|
|
297
|
+
padding-inline: 12px;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.v-btn-toggle > .v-btn > .v-btn__prepend {
|
|
301
|
+
margin-inline: 0 8px;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.v-btn-toggle > .v-btn > .v-btn__prepend > .v-icon {
|
|
305
|
+
font-size: 18px;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.v-btn-toggle > .v-btn--active:not(.v-btn--icon, :has(> .v-btn__prepend)) > .v-btn__content::before {
|
|
309
|
+
content: "";
|
|
310
|
+
display: inline-block;
|
|
311
|
+
flex: none;
|
|
312
|
+
height: 18px;
|
|
313
|
+
margin-inline-end: 8px;
|
|
314
|
+
vertical-align: -4px;
|
|
315
|
+
width: 18px;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/* Filter chips: chips in a v-chip-group (Vuetify's filter chips) and chips that toggle with aria-pressed. An
|
|
319
|
+
unselected one has no container inside an outline-role border; a selected one is secondary-container and leads
|
|
320
|
+
with a check, which takes the place of its icon. 16dp from the container's edge, 8dp beside the leading check or
|
|
321
|
+
icon, inside the 1dp border. */
|
|
322
|
+
.v-chip--filter,
|
|
323
|
+
.v-chip[aria-pressed] {
|
|
324
|
+
background: transparent;
|
|
325
|
+
border: thin solid rgb(var(--v-theme-outline));
|
|
326
|
+
color: rgb(var(--v-theme-on-surface-variant));
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.v-chip--filter.v-chip--selected,
|
|
330
|
+
.v-chip[aria-pressed="true"] {
|
|
331
|
+
background: rgb(var(--v-theme-secondary-container));
|
|
332
|
+
border-color: transparent;
|
|
333
|
+
color: rgb(var(--v-theme-on-secondary-container));
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.v-chip[aria-pressed] > .v-chip__underlay {
|
|
337
|
+
opacity: 0;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.v-chip--filter.v-chip--size-default,
|
|
341
|
+
.v-chip[aria-pressed].v-chip--size-default {
|
|
342
|
+
padding-inline: 15px;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.v-chip--filter.v-chip--size-default:is(.v-chip--selected, :has(> .v-chip__prepend)),
|
|
346
|
+
.v-chip[aria-pressed].v-chip--size-default:is([aria-pressed="true"], :has(> .v-chip__prepend)) {
|
|
347
|
+
padding-inline-start: 7px;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.v-chip.v-chip--size-default > .v-chip__filter,
|
|
351
|
+
.v-chip:is(.v-chip--filter, [aria-pressed]).v-chip--size-default > .v-chip__prepend > .v-icon--start {
|
|
352
|
+
margin-inline: 0 8px;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.v-chip .v-chip__filter .v-icon {
|
|
356
|
+
font-size: 18px;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.v-chip[aria-pressed="true"]:not(:has(> .v-chip__prepend))::before {
|
|
360
|
+
content: "";
|
|
361
|
+
flex: none;
|
|
362
|
+
height: 18px;
|
|
363
|
+
margin-inline-end: 8px;
|
|
364
|
+
width: 18px;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/* The check a selected segment or filter chip leads with: Material Symbols' check in the label's colour. */
|
|
368
|
+
.v-btn-toggle > .v-btn--active:not(.v-btn--icon, :has(> .v-btn__prepend)) > .v-btn__content::before,
|
|
369
|
+
.v-btn-toggle > .v-btn--active > .v-btn__prepend > .v-icon,
|
|
370
|
+
.v-chip[aria-pressed="true"]:not(:has(> .v-chip__prepend))::before,
|
|
371
|
+
.v-chip[aria-pressed="true"] > .v-chip__prepend > .v-icon {
|
|
372
|
+
background-color: currentColor;
|
|
373
|
+
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m9.55 15.15l8.475-8.475q.3-.3.7-.3t.7.3t.3.713t-.3.712l-9.175 9.2q-.3.3-.7.3t-.7-.3L4.55 13q-.3-.3-.288-.712t.313-.713t.713-.3t.712.3z'/%3E%3C/svg%3E") center / 18px 18px no-repeat;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.v-btn-toggle > .v-btn--active > .v-btn__prepend > .v-icon > svg,
|
|
377
|
+
.v-chip[aria-pressed="true"] > .v-chip__prepend > .v-icon > svg {
|
|
378
|
+
visibility: hidden;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/* Fixed tabs (grow) share the row's width equally, without Vuetify's 90dp minimum, so four fit a phone; when a label
|
|
382
|
+
still can't fit, the tabs scroll instead of cutting it. */
|
|
383
|
+
.v-tabs--grow .v-tab {
|
|
384
|
+
flex: 1 1 0;
|
|
385
|
+
min-width: max-content;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/* A menu's own list is its container, at level 2 with the menu's 4dp corners; a list inside a card or sheet in the
|
|
389
|
+
menu (a rich menu panel, a select's list) stays a plain list. CSS, not VMenu sub-component defaults: under those,
|
|
390
|
+
in Vuetify 4.2.1 to 4.3.2, an ancestor's re-render rebuilds VMenu's root defaults, its VVirtualScroll resets its
|
|
391
|
+
item height to 0 and a v-select's typeahead never scrolls to its match (upstream issue:
|
|
392
|
+
https://github.com/vuetifyjs/vuetify/issues/23366). Remove when a Vuetify past 4.3.2 fails connectors-web's
|
|
393
|
+
"Vuetify still loses a select's typeahead match…" browser test, which then goes too; see the README's Upstream
|
|
394
|
+
workarounds. */
|
|
395
|
+
.v-menu > .v-overlay__content > .v-list {
|
|
396
|
+
--v-elevation-overlay: color-mix(in srgb, var(--v-elevation-overlay-color) 4%, transparent);
|
|
397
|
+
box-shadow: 0px 1px 2px 0px rgba(var(--v-shadow-color), var(--v-shadow-key-opacity, 0.3)),
|
|
398
|
+
0px 2px 6px 2px rgba(var(--v-shadow-color), var(--v-shadow-ambient-opacity, 0.15));
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/* Dialog actions: 24dp from the dialog's sides and bottom, 8dp between buttons. */
|
|
402
|
+
.v-dialog > .v-overlay__content > .v-card > .v-card-actions,
|
|
403
|
+
.v-dialog > .v-overlay__content > form > .v-card > .v-card-actions {
|
|
404
|
+
gap: 8px;
|
|
405
|
+
padding: 0 24px 24px;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/* A pagination's current page has the activated state layer, as a selected button does. Vuetify ties it to the
|
|
409
|
+
border opacity, which the outline roles keep at full strength, so the page was a solid square over its number. */
|
|
410
|
+
.v-pagination .v-pagination__item--is-active .v-btn__overlay {
|
|
411
|
+
opacity: calc(var(--v-activated-opacity) * var(--v-theme-overlay-multiplier));
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/* A shown placeholder is on-surface-variant at full strength, as Material 3's text field and search bar draw it,
|
|
415
|
+
instead of Vuetify's faded on-surface (2.2:1). A labelled field still hides it until the field is active. */
|
|
416
|
+
.v-field:is(.v-field--active, .v-field--no-label) :is(input, textarea)::placeholder {
|
|
417
|
+
color: rgb(var(--v-theme-on-surface-variant));
|
|
418
|
+
opacity: 1;
|
|
419
|
+
}
|
|
420
|
+
|
|
147
421
|
/* Dividers and table rules use outline-variant at full strength (the theme's border colour). Vuetify draws a
|
|
148
422
|
divider in the text colour, so one without a color prop takes outline-variant. */
|
|
149
423
|
.v-divider {
|
|
@@ -191,6 +465,21 @@
|
|
|
191
465
|
* icon or a text button would find no class. These text-on-* forms make it work.
|
|
192
466
|
*/
|
|
193
467
|
@layer vuetify-utilities {
|
|
468
|
+
/* A menu's own list is surface-container. In this layer, outside its theme sublayers, so it outranks the
|
|
469
|
+
bg-transparent every list has by default; a list given its own bg-color keeps it. */
|
|
470
|
+
.v-menu > .v-overlay__content > .v-list.bg-transparent {
|
|
471
|
+
background-color: rgb(var(--v-theme-surface-container));
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/* A dialog's card is surface-container-high. Here too, it recolours only the surface-container-low class every
|
|
475
|
+
card has by default, so a card given its own colour keeps it. */
|
|
476
|
+
.v-dialog:not(.v-bottom-sheet) > .v-overlay__content > .v-card.bg-surface-container-low,
|
|
477
|
+
.v-dialog:not(.v-bottom-sheet) > .v-overlay__content > form > .v-card.bg-surface-container-low {
|
|
478
|
+
--v-theme-overlay-multiplier: var(--v-theme-surface-container-high-overlay-multiplier);
|
|
479
|
+
background-color: rgb(var(--v-theme-surface-container-high));
|
|
480
|
+
color: rgb(var(--v-theme-on-surface-container-high));
|
|
481
|
+
}
|
|
482
|
+
|
|
194
483
|
.text-on-background {
|
|
195
484
|
color: rgb(var(--v-theme-on-background));
|
|
196
485
|
}
|
|
@@ -262,7 +551,7 @@
|
|
|
262
551
|
|
|
263
552
|
/*
|
|
264
553
|
* A full-screen dialog's container is the surface, not the dialog's surface-container-high. Unlayered, so it
|
|
265
|
-
* outranks the bg-* class the
|
|
554
|
+
* outranks the bg-* class the card's default colour sets.
|
|
266
555
|
*/
|
|
267
556
|
.v-dialog--fullscreen > .v-overlay__content > .v-card,
|
|
268
557
|
.v-dialog--fullscreen > .v-overlay__content > form > .v-card {
|
|
@@ -282,3 +571,19 @@
|
|
|
282
571
|
transition-duration: 1ms;
|
|
283
572
|
}
|
|
284
573
|
}
|
|
574
|
+
|
|
575
|
+
/*
|
|
576
|
+
* A disabled filled, elevated or tonal button is Material 3's: on-surface at 12% for the container and 38% for the
|
|
577
|
+
* label, with no state layer or shadow. Unlayered, so it outranks the bg-* class (a vuetify-utilities rule) that the
|
|
578
|
+
* button's color prop gives it, in whatever order an app's stylesheets load.
|
|
579
|
+
*/
|
|
580
|
+
.v-btn--disabled:is(.v-btn--variant-flat, .v-btn--variant-elevated, .v-btn--variant-tonal) {
|
|
581
|
+
background-color: rgba(var(--v-theme-on-surface), 0.12);
|
|
582
|
+
box-shadow: none;
|
|
583
|
+
color: rgba(var(--v-theme-on-surface), var(--v-disabled-opacity));
|
|
584
|
+
opacity: 1;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
.v-btn--disabled:is(.v-btn--variant-flat, .v-btn--variant-elevated, .v-btn--variant-tonal) > :is(.v-btn__overlay, .v-btn__underlay) {
|
|
588
|
+
opacity: 0;
|
|
589
|
+
}
|
package/test/materialWeb.test.js
CHANGED
|
@@ -138,12 +138,21 @@ test("the Vuetify options follow the system scheme on the md3 blueprint with Mat
|
|
|
138
138
|
assert.equal(options.icons.defaultSet, "svg");
|
|
139
139
|
assert.equal(options.icons.aliases.arrowBack, materialSymbols.arrowBack);
|
|
140
140
|
assert.equal(options.icons.aliases.myLeaf, "svg:M1 1h22v22H1z");
|
|
141
|
-
|
|
141
|
+
// A card's 12dp corners are in material.css; a rounded default would be an inline style a dialog's 28dp couldn't beat.
|
|
142
|
+
assert.ok("rounded" in options.defaults.VCard);
|
|
143
|
+
assert.equal(options.defaults.VCard.rounded, undefined);
|
|
144
|
+
// Cards rest flat; variant="elevated" keeps Material 3's level 1, which a default elevation would add to every card.
|
|
145
|
+
assert.equal(options.defaults.VCard.variant, "flat");
|
|
146
|
+
assert.equal("elevation" in options.defaults.VCard, false);
|
|
147
|
+
assert.deepEqual(options.defaults.VExpansionPanels, { flat: true });
|
|
148
|
+
assert.deepEqual(options.defaults.VBottomSheet, { contentClass: "jskit-material-bottom-sheet" });
|
|
142
149
|
assert.equal(options.defaults.VChip.rounded, 8);
|
|
143
150
|
assert.equal(options.defaults.VFab.rounded, 16);
|
|
144
151
|
assert.equal(options.defaults.VChip.closeIcon, "$close");
|
|
145
152
|
assert.equal(options.defaults.VSwitch.inset, "material");
|
|
146
153
|
assert.equal(options.defaults.VSnackbar.color, "inverse-surface");
|
|
154
|
+
// A button with `to` is active only on exactly its route.
|
|
155
|
+
assert.equal(options.defaults.VBtn.exact, true);
|
|
147
156
|
assert.throws(() => createMaterialVuetifyOptions({ icons: { "my-leaf": "M0 0" } }), /camelCase/u);
|
|
148
157
|
});
|
|
149
158
|
|
|
@@ -173,6 +182,22 @@ test("material.css holds the exact-size rules without Sass or !important", async
|
|
|
173
182
|
assert.doesNotMatch(css, /\$[a-z-]+\s*:/u);
|
|
174
183
|
assert.match(css, /--v-btn-height: 40px/u);
|
|
175
184
|
assert.match(css, /height: max\(100%, 48px\)/u);
|
|
185
|
+
// Every button size gets the touch target, not only the default one, and a long label ends in an ellipsis.
|
|
186
|
+
assert.match(
|
|
187
|
+
css,
|
|
188
|
+
/\.v-btn:not\(\.v-btn--stacked\)::before \{[^}]*inset-block: min\(0px, calc\(50% - 24px\)\);[^}]*inset-inline: min\(0px, calc\(50% - 24px\)\);/u
|
|
189
|
+
);
|
|
190
|
+
// A button that follows another stops its target at its own edge on that side, and no icon button is under 32dp,
|
|
191
|
+
// so adjacent compact icon buttons each answer their own presses.
|
|
192
|
+
assert.match(css, /\.v-btn \+ \.v-btn:not\(\.v-btn--stacked\)::before \{\s*inset-inline-start: 0;\s*\}/u);
|
|
193
|
+
assert.match(css, /\.v-btn--icon:not\(\.v-fab \.v-btn\) \{\s*min-height: 32px;\s*min-width: 32px;\s*\}/u);
|
|
194
|
+
assert.match(css, /\.v-btn:not\(\.v-btn--stacked\) \{[^}]*contain: layout;/u);
|
|
195
|
+
// FABs keep their own sizes: the common and icon button sizes leave them out.
|
|
196
|
+
assert.match(css, /\.v-btn--size-default:not\(\.v-btn--stacked, \.v-btn--icon, \.v-fab \.v-btn\) \{[^}]*--v-btn-height: 40px;/u);
|
|
197
|
+
assert.match(css, /\.v-btn--icon\.v-btn--size-default:not\(\.v-fab \.v-btn\) \{[^}]*--v-btn-height: 28px;/u);
|
|
198
|
+
assert.match(css, /\.v-fab--extended \.v-btn \{[^}]*--v-btn-height: var\(--jskit-fab-size\);/u);
|
|
199
|
+
assert.doesNotMatch(css, /\.v-btn--size-default:not\(\.v-btn--stacked\)::before/u);
|
|
200
|
+
assert.match(css, /> \.v-btn__content:not\(:has\(> \*\)\) \{[^}]*text-overflow: ellipsis;/u);
|
|
176
201
|
assert.match(css, /border-radius: 28px;/u);
|
|
177
202
|
assert.match(css, /v-dialog--fullscreen[^{]+\{\s*border-radius: 0;/u);
|
|
178
203
|
assert.match(css, /border-radius: 28px 28px 0 0/u);
|
|
@@ -182,3 +207,87 @@ test("material.css holds the exact-size rules without Sass or !important", async
|
|
|
182
207
|
assert.match(css, /@layer vuetify-overrides \{/u);
|
|
183
208
|
assert.match(css, /\.text-on-surface-variant \{\s*color: rgb\(var\(--v-theme-on-surface-variant\)\);/u);
|
|
184
209
|
});
|
|
210
|
+
|
|
211
|
+
test("segmented buttons and filter chips select in secondary-container; a menu's own list is the menu's container", () => {
|
|
212
|
+
const { defaults } = createMaterialVuetifyOptions();
|
|
213
|
+
assert.deepEqual(defaults.VBtnToggle, {
|
|
214
|
+
border: true,
|
|
215
|
+
color: "secondary-container",
|
|
216
|
+
divided: true,
|
|
217
|
+
rounded: "pill",
|
|
218
|
+
variant: "flat"
|
|
219
|
+
});
|
|
220
|
+
assert.deepEqual(defaults.VChipGroup, { color: "secondary-container", filter: true, variant: "flat" });
|
|
221
|
+
// A menu's own list is drawn by material.css, not VMenu sub-component defaults, under which Vuetify 4.2.1 to 4.3.2
|
|
222
|
+
// lose a v-select's typeahead match when an ancestor re-renders (README, Upstream workarounds).
|
|
223
|
+
assert.equal(defaults.VMenu, undefined, "no VMenu sub-component defaults");
|
|
224
|
+
// VDialog is Vuetify's other root defaults provider: a dialog's card is drawn by material.css too.
|
|
225
|
+
assert.equal(defaults.VDialog, undefined, "no VDialog defaults");
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
test("material.css draws cards, a dialog's card and a bottom sheet's card", async () => {
|
|
229
|
+
const css = await readFile(path.join(PACKAGE_ROOT, "src/client/material.css"), "utf8");
|
|
230
|
+
assert.match(css, /\n {2}\.v-card \{\s*border-radius: 12px;\s*\}/u);
|
|
231
|
+
assert.match(
|
|
232
|
+
css,
|
|
233
|
+
/\.v-dialog:not\(\.v-bottom-sheet\) > \.v-overlay__content > form > \.v-card \{[^}]*box-shadow: 0px 1px 3px 0px[^}]*0px 4px 8px 3px/u
|
|
234
|
+
);
|
|
235
|
+
assert.match(
|
|
236
|
+
css,
|
|
237
|
+
/@layer vuetify-utilities \{[\s\S]*\.v-dialog:not\(\.v-bottom-sheet\) > \.v-overlay__content > form > \.v-card\.bg-surface-container-low \{[^}]*background-color: rgb\(var\(--v-theme-surface-container-high\)\);/u
|
|
238
|
+
);
|
|
239
|
+
assert.match(css, /\.v-bottom-sheet > \.v-overlay__content > form > \.v-card \{\s*border-radius: 0;/u);
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
test("material.css draws a menu's own list as its container and leaves other lists in a menu plain", async () => {
|
|
243
|
+
const css = await readFile(path.join(PACKAGE_ROOT, "src/client/material.css"), "utf8");
|
|
244
|
+
assert.match(
|
|
245
|
+
css,
|
|
246
|
+
/@layer vuetify-utilities \{\s*\/\*[^*]*\*\/\s*\.v-menu > \.v-overlay__content > \.v-list\.bg-transparent \{\s*background-color: rgb\(var\(--v-theme-surface-container\)\);/u
|
|
247
|
+
);
|
|
248
|
+
assert.match(css, /\.v-menu > \.v-overlay__content > \.v-list \{[^}]*box-shadow: 0px 1px 2px 0px[^}]*0px 2px 6px 2px/u);
|
|
249
|
+
assert.doesNotMatch(css, /\.v-menu > \.v-overlay__content > \.v-(?:card|sheet)/u);
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
test("material.css draws segmented buttons, filter chips, fixed tabs and dialog actions as Material 3 does", async () => {
|
|
253
|
+
const css = await readFile(path.join(PACKAGE_ROOT, "src/client/material.css"), "utf8");
|
|
254
|
+
const rule = (selector) => {
|
|
255
|
+
const escaped = selector.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
|
256
|
+
return css.match(new RegExp(`(?:^|\\n)\\s*${escaped}[^{]*\\{([^}]*)\\}`, "u"))?.[1] || "";
|
|
257
|
+
};
|
|
258
|
+
// The check a selected segment or filter chip leads with is Material Symbols' own check glyph.
|
|
259
|
+
const check = materialSymbols.check.slice("svg:".length);
|
|
260
|
+
const mask = css.match(/mask: url\("data:image\/svg\+xml,[^"]*d='([^']+)'/u)?.[1];
|
|
261
|
+
assert.equal(mask, check);
|
|
262
|
+
assert.match(rule(".v-btn-toggle.v-btn-group--horizontal"), /grid-auto-columns: 1fr;/u);
|
|
263
|
+
assert.match(rule(".v-btn-toggle.v-btn-group--horizontal.v-btn-group--density-default"), /height: 40px;/u);
|
|
264
|
+
assert.match(rule(".v-btn-toggle"), /border-color: rgb\(var\(--v-theme-outline\)\);[\s\S]*overflow: visible;/u);
|
|
265
|
+
// Every button group's segments have 12dp sides, after the common button's 24dp (and 16dp beside an icon) rules.
|
|
266
|
+
assert.match(rule(".v-btn-group > .v-btn.v-btn--size-default"), /min-width: 48px;\s*padding-inline: 12px;/u);
|
|
267
|
+
assert.ok(css.indexOf(".v-btn-group > .v-btn.v-btn--size-default") > css.indexOf(":has(> .v-btn__append)"));
|
|
268
|
+
assert.match(css, /\.v-chip--filter,\s*\.v-chip\[aria-pressed\] \{[^}]*border: thin solid rgb\(var\(--v-theme-outline\)\);/u);
|
|
269
|
+
assert.match(css, /\.v-chip--filter\.v-chip--selected,\s*\.v-chip\[aria-pressed="true"\] \{[^}]*secondary-container/u);
|
|
270
|
+
assert.match(rule(".v-chip--variant-outlined:not"), /border-color: rgb\(var\(--v-theme-outline\)\);/u);
|
|
271
|
+
assert.match(rule(".v-tabs--grow .v-tab"), /flex: 1 1 0;[\s\S]*min-width: max-content;/u);
|
|
272
|
+
assert.match(css, /\.v-dialog > \.v-overlay__content > \.v-card > \.v-card-actions,[^{]*\{\s*gap: 8px;\s*padding: 0 24px 24px;/u);
|
|
273
|
+
// A pagination's current page has the activated layer, not the border opacity; a shown placeholder is
|
|
274
|
+
// on-surface-variant, and a labelled field still hides it until active.
|
|
275
|
+
assert.match(
|
|
276
|
+
rule(".v-pagination .v-pagination__item--is-active .v-btn__overlay"),
|
|
277
|
+
/opacity: calc\(var\(--v-activated-opacity\) \* var\(--v-theme-overlay-multiplier\)\);/u
|
|
278
|
+
);
|
|
279
|
+
assert.match(
|
|
280
|
+
css,
|
|
281
|
+
/\.v-field:is\(\.v-field--active, \.v-field--no-label\) :is\(input, textarea\)::placeholder \{\s*color: rgb\(var\(--v-theme-on-surface-variant\)\);\s*opacity: 1;/u
|
|
282
|
+
);
|
|
283
|
+
// A disabled container button is on-surface 12% and 38%, unlayered over its colour class.
|
|
284
|
+
assert.match(
|
|
285
|
+
css,
|
|
286
|
+
/^\.v-btn--disabled:is\(\.v-btn--variant-flat, \.v-btn--variant-elevated, \.v-btn--variant-tonal\) \{\s*background-color: rgba\(var\(--v-theme-on-surface\), 0\.12\);/mu
|
|
287
|
+
);
|
|
288
|
+
// The touch target unclips buttons, so their state layer, underlay and ripple keep the button's corners themselves.
|
|
289
|
+
assert.match(
|
|
290
|
+
css,
|
|
291
|
+
/\.v-btn > \.v-btn__overlay,\s*\.v-btn > \.v-btn__underlay,\s*\.v-btn > \.v-ripple__container,\s*\.v-chip > \.v-chip__overlay,\s*\.v-chip > \.v-chip__underlay,\s*\.v-chip > \.v-ripple__container \{\s*border-radius: inherit;/u
|
|
292
|
+
);
|
|
293
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import test from "node:test";
|
|
4
|
+
import { createVuetify } from "vuetify";
|
|
5
|
+
import { createMaterialVuetifyOptions } from "../src/client/index.js";
|
|
6
|
+
|
|
7
|
+
const ROBOTO_FLEX = '"Roboto Flex Variable", "Roboto Flex", Roboto, system-ui, sans-serif';
|
|
8
|
+
|
|
9
|
+
test("both Material 3 typefaces default to Roboto Flex in the light and dark themes", () => {
|
|
10
|
+
const { themes } = createMaterialVuetifyOptions().theme;
|
|
11
|
+
for (const theme of [themes.light, themes.dark]) {
|
|
12
|
+
assert.equal(theme.variables["font-heading"], ROBOTO_FLEX);
|
|
13
|
+
assert.equal(theme.variables["font-body"], ROBOTO_FLEX);
|
|
14
|
+
assert.equal(theme.variables["hover-opacity"], 0.08, "the state layers stay beside them");
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test("typography sets the brand typeface for Vuetify's heading roles and the plain one for the rest", () => {
|
|
19
|
+
const options = createMaterialVuetifyOptions({ typography: { brand: '"Fraunces", serif', plain: '"Inter", sans-serif' } });
|
|
20
|
+
assert.equal(options.theme.themes.light.variables["font-heading"], '"Fraunces", serif');
|
|
21
|
+
assert.equal(options.theme.themes.dark.variables["font-body"], '"Inter", sans-serif');
|
|
22
|
+
// One typeface given: the other stays Roboto Flex.
|
|
23
|
+
const brandOnly = createMaterialVuetifyOptions({ typography: { brand: "Fraunces" } }).theme.themes.light.variables;
|
|
24
|
+
assert.deepEqual([brandOnly["font-heading"], brandOnly["font-body"]], ["Fraunces", ROBOTO_FLEX]);
|
|
25
|
+
// Vuetify writes them as --v-font-heading and --v-font-body, which its type classes read, on :root and each theme.
|
|
26
|
+
const styles = createVuetify(options).theme.styles.value;
|
|
27
|
+
assert.match(styles, /:root \{[^}]*--v-font-heading: "Fraunces", serif;[^}]*--v-font-body: "Inter", sans-serif;/u);
|
|
28
|
+
assert.match(styles, /\.v-theme--dark \{[^}]*--v-font-heading: "Fraunces", serif;/u);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("a typeface that isn't a CSS font-family value is refused", () => {
|
|
32
|
+
assert.throws(() => createMaterialVuetifyOptions({ typography: { brand: " " } }), /typography\.brand needs a CSS font-family value/u);
|
|
33
|
+
assert.throws(() => createMaterialVuetifyOptions({ typography: { plain: "Inter; color: red" } }), /typography\.plain/u);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test("material.css declares Roboto Flex for both typefaces only as a fallback below the theme's", async () => {
|
|
37
|
+
const css = await readFile(new URL("../src/client/material.css", import.meta.url), "utf8");
|
|
38
|
+
const fallback = /@layer vuetify-core \{\s*:root \{([^}]*)\}\s*\}/u.exec(css);
|
|
39
|
+
assert.ok(fallback, "the fallback sits in the vuetify-core layer");
|
|
40
|
+
assert.match(fallback[1], /--v-font-heading: "Roboto Flex Variable"/u);
|
|
41
|
+
assert.match(fallback[1], /--v-font-body: "Roboto Flex Variable"/u);
|
|
42
|
+
assert.equal((css.match(/--v-font-(?:heading|body)\s*:/gu) || []).length, 2, "no unlayered rule outranks the theme's typefaces");
|
|
43
|
+
});
|