@jskit-ai/material-web 0.1.3 → 0.1.5
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 +6 -0
- package/README.md +14 -4
- package/package.json +1 -1
- package/src/client/defaults.js +3 -6
- package/src/client/material.css +170 -1
- package/test/materialWeb.test.js +35 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- `material.css` draws every `v-bottom-navigation` as Material 3's navigation bar: a destination (each of its stacked buttons) has its icon, its `prepend-icon` or the first icon in its content (bare or in a badge), 24dp in a 64x32 pill that is its active indicator (`secondary-container`, the icon `on-secondary-container`) and holds its hover, focus and pressed state layer, where Vuetify drew its overlay and ripple across the whole button; the label is label-medium, 4dp below, `on-surface-variant` at rest and `on-surface` when active. A comfortable bar (48dp) drops the 4dp and a compact one (40dp) has a 24dp pill, so neither clips a label. The colours apply only where the app set none: a bar's `bg-color` (other than a surface tone) or colour class, and a destination's `color`, `base-color` or colour class, keep the app's colour on label and icon, the active pill drawn in that colour. An append icon, a badge's own icon and `mode="horizontal"` keep Vuetify's look. It was drawn only by the shell's `ShellTabLinkItem`, so an app's own bar of `v-btn`s kept Vuetify's look.
|
|
6
|
+
- **Breaking (visual).** Fields (`v-text-field`, `v-textarea`, `v-select`, `v-autocomplete`, `v-combobox`, `v-file-input`) keep Vuetify's line for their supporting text, as a Material 3 text field does: the defaults no longer set `hideDetails: "auto"`. With it, a field had no line until it had a message, so an error shown on blur or submit pushed the rest of the form down under the person's finger, and forms made up the space with a margin under each field. Upgrading: in a form, remove the `mb-*` margin under each field (the line is the gap now); a field outside a form (a search box, a filter, a toolbar select, a composer) sets `hide-details`, or `hide-details="auto"` to show a message only when it has one.
|
|
7
|
+
- `material.css` has a `text-on-*` class for every `on-*` role of the scheme. It had them for the main roles, success, warning and info, but not for the fixed roles' (`on-primary-fixed`, `on-primary-fixed-variant` and the secondary and tertiary ones) or the surface tones' (`on-surface-dim`, `on-surface-bright`, `on-surface-container-lowest` to `-highest`), so `color="on-primary-fixed-variant"` found no class. Vuetify names an `on-*` role's class `.on-<role>` only; an app colour's `on-*` roles keep that class alone. material-web's node test checks the classes against the generated scheme's roles.
|
|
8
|
+
- An active list item's subtitle is at full strength too, in the item's own colour, as a selected Material 3 list item's supporting text takes its label's: it was at Vuetify's medium-emphasis opacity, 4.45:1 on a card's surface-container-low, under WCAG's 4.5:1. So is the subtitle of an item with its own text colour, in that colour; an item at rest without one is still on-surface-variant, and a disabled item keeps its fade. shell-web's adaptive-shell browser test measures both subtitles' contrast over the card and the active item's state layer, in light and dark.
|
|
9
|
+
- A text field's label and its supporting text (hints and messages) are on-surface-variant at full strength, as Material 3's text field draws them, instead of Vuetify's on-surface at the medium-emphasis opacity, which read 4.4:1 on a light surface, under WCAG's 4.5:1. A focused field's label keeps the field's colour, and an invalid field's label and messages keep error.
|
|
10
|
+
- A list item's subtitle is on-surface-variant at full strength, as Material 3's list draws its supporting text, instead of the item's on-surface at the medium-emphasis opacity (4.35:1 on surface-container-low). An active item, one with its own text colour and a disabled one keep theirs.
|
|
5
11
|
- 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
12
|
- 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
13
|
- `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.
|
package/README.md
CHANGED
|
@@ -73,7 +73,8 @@ export const theme = {
|
|
|
73
73
|
every button size (small and x-small keep their look, and their state
|
|
74
74
|
layers keep their corners) that stops at a neighbouring button, disabled container
|
|
75
75
|
buttons in on-surface at 12% and 38%, a pagination's current page in the
|
|
76
|
-
activated layer, placeholders
|
|
76
|
+
activated layer, placeholders, text field labels and supporting text and list
|
|
77
|
+
item subtitles in on-surface-variant, one-line labels that
|
|
77
78
|
end in an ellipsis, 12dp card corners, 28dp dialogs on
|
|
78
79
|
`surface-container-high` at level 3 and bottom sheets with a square card on
|
|
79
80
|
`surface-container-low`, square full-screen dialogs on `surface`, a 48dp touch target on clickable chips,
|
|
@@ -82,10 +83,19 @@ export const theme = {
|
|
|
82
83
|
`aria-pressed` too), fixed tabs that share the width or else scroll, dialog
|
|
83
84
|
actions 24dp from the edges, a menu's own list as its container
|
|
84
85
|
(`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,
|
|
86
|
-
|
|
86
|
+
rich menu panel (a card or sheet in the menu) stays plain, a
|
|
87
|
+
`v-bottom-navigation` as Material 3's navigation bar (each destination's 24dp
|
|
88
|
+
icon in a 64x32 indicator, in `secondary-container` when active and holding
|
|
89
|
+
the state layer, over a label-medium label; the indicator 24dp tall in a
|
|
90
|
+
compact bar; a bar's `bg-color` or a destination's `color`, `base-color` or
|
|
91
|
+
colour class keeps the app's colours), emphasized easing and reduced
|
|
92
|
+
motion. It adds a `text-on-*` class for every `on-*` role of the
|
|
93
|
+
scheme, which Vuetify names only `.on-<role>`, so `color="on-surface-variant"`
|
|
94
|
+
and `class="text-on-surface-variant"` work; an app colour's `on-*` roles keep
|
|
95
|
+
only Vuetify's `.on-<name>` class. Its
|
|
87
96
|
component rules sit in Vuetify's `vuetify-overrides` cascade layer, so an
|
|
88
|
-
app's own props and utility classes still win
|
|
97
|
+
app's own props and utility classes still win (a typography class for a
|
|
98
|
+
navigation bar's label goes on the label); only a disabled button's
|
|
89
99
|
colours and a full-screen dialog's surface are unlayered, over the colour
|
|
90
100
|
class a `color` prop gives. Nothing uses
|
|
91
101
|
`!important` or Sass.
|
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.5",
|
|
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": {
|
package/src/client/defaults.js
CHANGED
|
@@ -78,28 +78,25 @@ const materialDefaults = Object.freeze({
|
|
|
78
78
|
color: "primary",
|
|
79
79
|
inset: "material"
|
|
80
80
|
},
|
|
81
|
+
// Outlined fields keep Vuetify's line for their supporting text, as a Material 3 text field does, so an error or
|
|
82
|
+
// hint appears in place without moving what is below it. A field outside a form (a search box, a filter, a
|
|
83
|
+
// composer) sets `hide-details` itself.
|
|
81
84
|
VAutocomplete: {
|
|
82
|
-
hideDetails: "auto",
|
|
83
85
|
variant: "outlined"
|
|
84
86
|
},
|
|
85
87
|
VCombobox: {
|
|
86
|
-
hideDetails: "auto",
|
|
87
88
|
variant: "outlined"
|
|
88
89
|
},
|
|
89
90
|
VFileInput: {
|
|
90
|
-
hideDetails: "auto",
|
|
91
91
|
variant: "outlined"
|
|
92
92
|
},
|
|
93
93
|
VSelect: {
|
|
94
|
-
hideDetails: "auto",
|
|
95
94
|
variant: "outlined"
|
|
96
95
|
},
|
|
97
96
|
VTextarea: {
|
|
98
|
-
hideDetails: "auto",
|
|
99
97
|
variant: "outlined"
|
|
100
98
|
},
|
|
101
99
|
VTextField: {
|
|
102
|
-
hideDetails: "auto",
|
|
103
100
|
variant: "outlined"
|
|
104
101
|
},
|
|
105
102
|
VCheckbox: {
|
package/src/client/material.css
CHANGED
|
@@ -418,6 +418,33 @@
|
|
|
418
418
|
opacity: 1;
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
+
/* A text field's label and its supporting text are on-surface-variant at full strength, as Material 3's text field
|
|
422
|
+
draws them, instead of Vuetify's on-surface at the medium-emphasis opacity: 4.4:1 on a light surface, under
|
|
423
|
+
WCAG's 4.5:1. A focused field's label keeps the field's colour, an invalid field's label and messages keep error,
|
|
424
|
+
and a disabled field keeps its own fade. */
|
|
425
|
+
.v-field:not(.v-field--focused, .v-field--error) .v-label.v-field-label {
|
|
426
|
+
color: rgb(var(--v-theme-on-surface-variant));
|
|
427
|
+
opacity: 1;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.v-input:not(.v-input--error, .v-input--disabled) > .v-input__details .v-messages {
|
|
431
|
+
color: rgb(var(--v-theme-on-surface-variant));
|
|
432
|
+
opacity: 1;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/* A list item's supporting text is at full strength, as Material 3's list draws it, instead of the item's colour at
|
|
436
|
+
Vuetify's medium-emphasis opacity: 4.35:1 on surface-container-low for an item at rest and 4.45:1 for an active
|
|
437
|
+
one, under WCAG's 4.5:1. An item at rest without a text colour of its own draws it in on-surface-variant; an
|
|
438
|
+
active item keeps the item's colour, as a selected Material 3 list item's supporting text takes its label's, and
|
|
439
|
+
so does one with its own text colour. A disabled item keeps its own fade. */
|
|
440
|
+
.v-list-item:not(.v-list-item--disabled) .v-list-item-subtitle {
|
|
441
|
+
opacity: 1;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.v-list-item:not(.v-list-item--active, .v-list-item--disabled, [class*=" text-"]) .v-list-item-subtitle {
|
|
445
|
+
color: rgb(var(--v-theme-on-surface-variant));
|
|
446
|
+
}
|
|
447
|
+
|
|
421
448
|
/* Dividers and table rules use outline-variant at full strength (the theme's border colour). Vuetify draws a
|
|
422
449
|
divider in the text colour, so one without a color prop takes outline-variant. */
|
|
423
450
|
.v-divider {
|
|
@@ -428,6 +455,94 @@
|
|
|
428
455
|
color: rgb(var(--v-theme-outline-variant));
|
|
429
456
|
}
|
|
430
457
|
|
|
458
|
+
/* Material 3's navigation bar (v-bottom-navigation). Its destinations are its stacked buttons (mode="horizontal"
|
|
459
|
+
lays them flat, as Vuetify draws them). A destination's icon (its prepend-icon, or the first icon in its content,
|
|
460
|
+
bare or in a badge; not an append icon or a badge's own) sits in a 64x32 pill, the icon's own box: the active
|
|
461
|
+
indicator, and the state layer, where Vuetify draws its overlay and ripple across the whole button. The label is
|
|
462
|
+
label-medium, 4dp below; a comfortable bar (48dp) drops the 4dp and a compact one (40dp) has a 24dp pill as well,
|
|
463
|
+
so neither clips a label. The label's type is set on the button's content, which Vuetify's reset otherwise gives
|
|
464
|
+
the button's own (`font: inherit`), so a typography class goes on the label itself. */
|
|
465
|
+
.v-bottom-navigation .v-bottom-navigation__content > .v-btn--stacked > :is(.v-btn__overlay, .v-btn__underlay, .v-ripple__container) {
|
|
466
|
+
display: none;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.v-bottom-navigation .v-bottom-navigation__content > .v-btn--stacked > .v-btn__content {
|
|
470
|
+
font-size: 0.75rem;
|
|
471
|
+
font-weight: 500;
|
|
472
|
+
gap: 4px;
|
|
473
|
+
letter-spacing: 0.03125rem;
|
|
474
|
+
line-height: 1rem;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.v-bottom-navigation .v-bottom-navigation__content > .v-btn--stacked
|
|
478
|
+
:is(.v-btn__prepend > .v-icon, .v-btn__content > .v-icon:first-child,
|
|
479
|
+
.v-btn__content > .v-badge:first-child > .v-badge__wrapper > .v-icon) {
|
|
480
|
+
--jskit-navigation-state: transparent;
|
|
481
|
+
background-image: linear-gradient(var(--jskit-navigation-state), var(--jskit-navigation-state));
|
|
482
|
+
border-radius: 16px;
|
|
483
|
+
box-sizing: border-box;
|
|
484
|
+
font-size: 24px;
|
|
485
|
+
height: 32px;
|
|
486
|
+
padding: 4px 20px;
|
|
487
|
+
transition: background-color 200ms var(--md-sys-motion-easing-standard);
|
|
488
|
+
width: 64px;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
.v-bottom-navigation .v-bottom-navigation__content > .v-btn--stacked:hover
|
|
492
|
+
:is(.v-btn__prepend > .v-icon, .v-btn__content > .v-icon:first-child,
|
|
493
|
+
.v-btn__content > .v-badge:first-child > .v-badge__wrapper > .v-icon) {
|
|
494
|
+
--jskit-navigation-state: color-mix(in srgb, currentColor calc(var(--v-hover-opacity) * 100%), transparent);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.v-bottom-navigation .v-bottom-navigation__content > .v-btn--stacked:is(:focus-visible, :active)
|
|
498
|
+
:is(.v-btn__prepend > .v-icon, .v-btn__content > .v-icon:first-child,
|
|
499
|
+
.v-btn__content > .v-badge:first-child > .v-badge__wrapper > .v-icon) {
|
|
500
|
+
--jskit-navigation-state: color-mix(in srgb, currentColor calc(var(--v-focus-opacity) * 100%), transparent);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/* The active indicator in the destination's own colour, where the app gave the bar or the destination one. */
|
|
504
|
+
.v-bottom-navigation .v-bottom-navigation__content > .v-btn--stacked.v-btn--active
|
|
505
|
+
:is(.v-btn__prepend > .v-icon, .v-btn__content > .v-icon:first-child,
|
|
506
|
+
.v-btn__content > .v-badge:first-child > .v-badge__wrapper > .v-icon) {
|
|
507
|
+
background-color: color-mix(in srgb, currentColor calc(var(--v-activated-opacity) * 100%), transparent);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.v-bottom-navigation:is(.v-bottom-navigation--density-comfortable, .v-bottom-navigation--density-compact)
|
|
511
|
+
.v-bottom-navigation__content > .v-btn--stacked,
|
|
512
|
+
.v-bottom-navigation:is(.v-bottom-navigation--density-comfortable, .v-bottom-navigation--density-compact)
|
|
513
|
+
.v-bottom-navigation__content > .v-btn--stacked > .v-btn__content {
|
|
514
|
+
gap: 0;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.v-bottom-navigation.v-bottom-navigation--density-compact .v-bottom-navigation__content > .v-btn--stacked
|
|
518
|
+
:is(.v-btn__prepend > .v-icon, .v-btn__content > .v-icon:first-child,
|
|
519
|
+
.v-btn__content > .v-badge:first-child > .v-badge__wrapper > .v-icon) {
|
|
520
|
+
height: 24px;
|
|
521
|
+
padding: 0 20px;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/* Material 3's colours, where the app set none: on a bar with no bg-color but a surface tone, no colour class and
|
|
525
|
+
no colour of its own, to a destination with no color, base-color or colour class (Vuetify's text-* and bg-*). A
|
|
526
|
+
destination the app colours, or any destination of a bar it colours, keeps that colour, label and icon alike.
|
|
527
|
+
They are set on the content and the icon, as the reset gives the button its bar's colour. */
|
|
528
|
+
.v-bottom-navigation:not([class*=" bg-"]:not([class*=" bg-surface"]), [class*=" text-"], [style*="background"], [style*="color"])
|
|
529
|
+
.v-bottom-navigation__content > .v-btn--stacked:not([class*=" text-"], [class*=" bg-"], [style*="color"]) > :is(.v-btn__prepend, .v-btn__content) {
|
|
530
|
+
color: rgb(var(--v-theme-on-surface-variant));
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.v-bottom-navigation:not([class*=" bg-"]:not([class*=" bg-surface"]), [class*=" text-"], [style*="background"], [style*="color"])
|
|
534
|
+
.v-bottom-navigation__content > .v-btn--stacked:not([class*=" text-"], [class*=" bg-"], [style*="color"]).v-btn--active > .v-btn__content {
|
|
535
|
+
color: rgb(var(--v-theme-on-surface));
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.v-bottom-navigation:not([class*=" bg-"]:not([class*=" bg-surface"]), [class*=" text-"], [style*="background"], [style*="color"])
|
|
539
|
+
.v-bottom-navigation__content > .v-btn--stacked:not([class*=" text-"], [class*=" bg-"], [style*="color"]).v-btn--active
|
|
540
|
+
:is(.v-btn__prepend > .v-icon, .v-btn__content > .v-icon:first-child,
|
|
541
|
+
.v-btn__content > .v-badge:first-child > .v-badge__wrapper > .v-icon) {
|
|
542
|
+
background-color: rgb(var(--v-theme-secondary-container));
|
|
543
|
+
color: rgb(var(--v-theme-on-secondary-container));
|
|
544
|
+
}
|
|
545
|
+
|
|
431
546
|
/* Motion: emphasized easing; entering elements decelerate, leaving ones accelerate. */
|
|
432
547
|
.v-navigation-drawer,
|
|
433
548
|
.v-bottom-navigation,
|
|
@@ -462,7 +577,9 @@
|
|
|
462
577
|
|
|
463
578
|
/*
|
|
464
579
|
* Vuetify names the utility class of an on-* colour role ".on-surface-variant", so color="on-surface-variant" on an
|
|
465
|
-
* icon or a text button would find no class. These text-on-* forms make it work
|
|
580
|
+
* icon or a text button would find no class. These text-on-* forms make it work for every on-* role of the scheme:
|
|
581
|
+
* the scheme's roles, the fixed roles' and the surface tones', and success, warning and info with their containers.
|
|
582
|
+
* An app colour's on-* roles have only Vuetify's own class (class="on-partner"); bg-partner already sets on-partner.
|
|
466
583
|
*/
|
|
467
584
|
@layer vuetify-utilities {
|
|
468
585
|
/* A menu's own list is surface-container. In this layer, outside its theme sublayers, so it outranks the
|
|
@@ -492,6 +609,34 @@
|
|
|
492
609
|
color: rgb(var(--v-theme-on-surface-variant));
|
|
493
610
|
}
|
|
494
611
|
|
|
612
|
+
.text-on-surface-dim {
|
|
613
|
+
color: rgb(var(--v-theme-on-surface-dim));
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
.text-on-surface-bright {
|
|
617
|
+
color: rgb(var(--v-theme-on-surface-bright));
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
.text-on-surface-container-lowest {
|
|
621
|
+
color: rgb(var(--v-theme-on-surface-container-lowest));
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
.text-on-surface-container-low {
|
|
625
|
+
color: rgb(var(--v-theme-on-surface-container-low));
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
.text-on-surface-container {
|
|
629
|
+
color: rgb(var(--v-theme-on-surface-container));
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
.text-on-surface-container-high {
|
|
633
|
+
color: rgb(var(--v-theme-on-surface-container-high));
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
.text-on-surface-container-highest {
|
|
637
|
+
color: rgb(var(--v-theme-on-surface-container-highest));
|
|
638
|
+
}
|
|
639
|
+
|
|
495
640
|
.text-on-primary {
|
|
496
641
|
color: rgb(var(--v-theme-on-primary));
|
|
497
642
|
}
|
|
@@ -516,6 +661,30 @@
|
|
|
516
661
|
color: rgb(var(--v-theme-on-tertiary-container));
|
|
517
662
|
}
|
|
518
663
|
|
|
664
|
+
.text-on-primary-fixed {
|
|
665
|
+
color: rgb(var(--v-theme-on-primary-fixed));
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
.text-on-primary-fixed-variant {
|
|
669
|
+
color: rgb(var(--v-theme-on-primary-fixed-variant));
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
.text-on-secondary-fixed {
|
|
673
|
+
color: rgb(var(--v-theme-on-secondary-fixed));
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
.text-on-secondary-fixed-variant {
|
|
677
|
+
color: rgb(var(--v-theme-on-secondary-fixed-variant));
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
.text-on-tertiary-fixed {
|
|
681
|
+
color: rgb(var(--v-theme-on-tertiary-fixed));
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
.text-on-tertiary-fixed-variant {
|
|
685
|
+
color: rgb(var(--v-theme-on-tertiary-fixed-variant));
|
|
686
|
+
}
|
|
687
|
+
|
|
519
688
|
.text-on-error {
|
|
520
689
|
color: rgb(var(--v-theme-on-error));
|
|
521
690
|
}
|
package/test/materialWeb.test.js
CHANGED
|
@@ -153,6 +153,10 @@ test("the Vuetify options follow the system scheme on the md3 blueprint with Mat
|
|
|
153
153
|
assert.equal(options.defaults.VSnackbar.color, "inverse-surface");
|
|
154
154
|
// A button with `to` is active only on exactly its route.
|
|
155
155
|
assert.equal(options.defaults.VBtn.exact, true);
|
|
156
|
+
// Fields keep their supporting-text line, so an error or hint appears without moving the form below it.
|
|
157
|
+
for (const field of ["VAutocomplete", "VCombobox", "VFileInput", "VSelect", "VTextarea", "VTextField"]) {
|
|
158
|
+
assert.deepEqual(options.defaults[field], { variant: "outlined" }, field);
|
|
159
|
+
}
|
|
156
160
|
assert.throws(() => createMaterialVuetifyOptions({ icons: { "my-leaf": "M0 0" } }), /camelCase/u);
|
|
157
161
|
});
|
|
158
162
|
|
|
@@ -208,6 +212,20 @@ test("material.css holds the exact-size rules without Sass or !important", async
|
|
|
208
212
|
assert.match(css, /\.text-on-surface-variant \{\s*color: rgb\(var\(--v-theme-on-surface-variant\)\);/u);
|
|
209
213
|
});
|
|
210
214
|
|
|
215
|
+
// Vuetify gives an on-* role only the class ".on-<role>", so color="on-<role>" finds no text-on-<role> class unless
|
|
216
|
+
// material.css has one: it has one for every Material 3 on-* role the scheme defines (surface-light is a Vuetify-only
|
|
217
|
+
// name, so its on-surface-light is not one), and none for a role the scheme lacks.
|
|
218
|
+
test("material.css has a text-on-* class for every Material 3 on-* role of the scheme", async () => {
|
|
219
|
+
const css = await readFile(path.join(PACKAGE_ROOT, "src/client/material.css"), "utf8");
|
|
220
|
+
const onRoles = Object.keys(materialThemes("#6750A4").light.colors)
|
|
221
|
+
.filter((role) => role.startsWith("on-") && role !== "on-surface-light")
|
|
222
|
+
.sort();
|
|
223
|
+
const classes = [...css.matchAll(/^ {2}\.text-(on-[a-z-]+) \{\s*color: rgb\(var\(--v-theme-(on-[a-z-]+)\)\);\s*\}/gmu)];
|
|
224
|
+
for (const [, name, role] of classes) assert.equal(name, role, `.text-${name} reads its own role`);
|
|
225
|
+
assert.deepEqual(classes.map(([, name]) => name).sort(), onRoles);
|
|
226
|
+
assert.ok(onRoles.includes("on-primary-fixed-variant") && onRoles.includes("on-surface-container-high"), onRoles.join(", "));
|
|
227
|
+
});
|
|
228
|
+
|
|
211
229
|
test("segmented buttons and filter chips select in secondary-container; a menu's own list is the menu's container", () => {
|
|
212
230
|
const { defaults } = createMaterialVuetifyOptions();
|
|
213
231
|
assert.deepEqual(defaults.VBtnToggle, {
|
|
@@ -280,6 +298,23 @@ test("material.css draws segmented buttons, filter chips, fixed tabs and dialog
|
|
|
280
298
|
css,
|
|
281
299
|
/\.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
300
|
);
|
|
301
|
+
// A resting field's label and a valid field's supporting text are on-surface-variant at full strength, not on-surface
|
|
302
|
+
// at the medium-emphasis opacity.
|
|
303
|
+
assert.match(
|
|
304
|
+
css,
|
|
305
|
+
/\.v-field:not\(\.v-field--focused, \.v-field--error\) \.v-label\.v-field-label \{\s*color: rgb\(var\(--v-theme-on-surface-variant\)\);\s*opacity: 1;/u
|
|
306
|
+
);
|
|
307
|
+
assert.match(
|
|
308
|
+
css,
|
|
309
|
+
/\.v-input:not\(\.v-input--error, \.v-input--disabled\) > \.v-input__details \.v-messages \{\s*color: rgb\(var\(--v-theme-on-surface-variant\)\);\s*opacity: 1;/u
|
|
310
|
+
);
|
|
311
|
+
// So is an inactive, uncoloured list item's subtitle; every enabled item's subtitle, an active one's included, is
|
|
312
|
+
// at full strength in the item's own colour.
|
|
313
|
+
assert.match(
|
|
314
|
+
css,
|
|
315
|
+
/\.v-list-item:not\(\.v-list-item--active, \.v-list-item--disabled, \[class\*=" text-"\]\) \.v-list-item-subtitle \{\s*color: rgb\(var\(--v-theme-on-surface-variant\)\);\s*\}/u
|
|
316
|
+
);
|
|
317
|
+
assert.match(css, /\.v-list-item:not\(\.v-list-item--disabled\) \.v-list-item-subtitle \{\s*opacity: 1;\s*\}/u);
|
|
283
318
|
// A disabled container button is on-surface 12% and 38%, unlayered over its colour class.
|
|
284
319
|
assert.match(
|
|
285
320
|
css,
|