@jskit-ai/material-web 0.1.1 → 0.1.2

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 CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - 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.
6
+ - 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.
7
+ - 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.
8
+ - 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
9
  - 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.
6
10
 
7
11
  ## 0.1.0
package/README.md CHANGED
@@ -62,8 +62,10 @@ export const theme = {
62
62
  fields, 8dp chips that close with `$close`, 4dp menus on `surface-container`,
63
63
  the inverse-surface snackbar, the Material switch and the 16dp
64
64
  `primary-container` FAB.
65
- - **`material.css`.** What props cannot set: 40dp buttons with a 48dp touch
66
- target and 40dp icon buttons, 28dp dialogs and bottom sheets, square
65
+ - **`material.css`.** What props cannot set: 40dp buttons and 40dp icon
66
+ buttons, a 48dp touch target on every button size (small and x-small keep
67
+ their look), one-line labels that end in an ellipsis, 28dp dialogs and
68
+ bottom sheets, square
67
69
  full-screen dialogs on `surface`, a 48dp touch target on clickable chips,
68
70
  inverse-surface tooltips, emphasized easing
69
71
  and reduced motion. Its component rules sit in Vuetify's `vuetify-overrides`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/material-web",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
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": {
@@ -13,9 +13,9 @@ const materialDefaults = Object.freeze({
13
13
  rounded: "pill",
14
14
  variant: "flat"
15
15
  },
16
+ // No elevation: Vuetify's elevated variant (the default) draws level 1, and flat, tonal and outlined cards draw none.
16
17
  VCard: {
17
18
  color: "surface-container-low",
18
- elevation: 1,
19
19
  rounded: 12
20
20
  },
21
21
  VChip: {
@@ -34,7 +34,6 @@ const materialDefaults = Object.freeze({
34
34
  contentClass: "jskit-material-bottom-sheet",
35
35
  VCard: {
36
36
  color: "surface-container-low",
37
- elevation: 1,
38
37
  rounded: 0
39
38
  }
40
39
  },
@@ -20,26 +20,26 @@
20
20
  }
21
21
 
22
22
  @layer vuetify-overrides {
23
- /* Common buttons: 40dp tall, full shape, 24dp side padding (16dp beside an icon), a 48dp touch target. */
24
- .v-btn--size-default:not(.v-btn--stacked, .v-btn--icon) {
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, .v-fab .v-btn) {
25
25
  --v-btn-height: 40px;
26
26
  padding-inline: 24px;
27
27
  }
28
28
 
29
- .v-btn--size-default:not(.v-btn--stacked, .v-btn--icon):has(> .v-btn__prepend) {
29
+ .v-btn--size-default:not(.v-btn--stacked, .v-btn--icon, .v-fab .v-btn):has(> .v-btn__prepend) {
30
30
  padding-inline-start: 16px;
31
31
  }
32
32
 
33
- .v-btn--size-default:not(.v-btn--stacked, .v-btn--icon):has(> .v-btn__append) {
33
+ .v-btn--size-default:not(.v-btn--stacked, .v-btn--icon, .v-fab .v-btn):has(> .v-btn__append) {
34
34
  padding-inline-end: 16px;
35
35
  }
36
36
 
37
- .v-btn--size-default.v-btn--variant-text:not(.v-btn--stacked, .v-btn--icon) {
37
+ .v-btn--size-default.v-btn--variant-text:not(.v-btn--stacked, .v-btn--icon, .v-fab .v-btn) {
38
38
  padding-inline: 12px;
39
39
  }
40
40
 
41
41
  /* Icon buttons: a 40dp state layer around a 24dp icon. */
42
- .v-btn--icon.v-btn--size-default {
42
+ .v-btn--icon.v-btn--size-default:not(.v-fab .v-btn) {
43
43
  --v-btn-height: 28px;
44
44
  }
45
45
 
@@ -47,11 +47,45 @@
47
47
  font-size: 24px;
48
48
  }
49
49
 
50
- .v-btn--size-default:not(.v-btn--stacked) {
50
+ /* FABs are not common buttons: 56dp (small 40dp, large 96dp with a 36dp icon), and the extended FAB is 56dp tall. */
51
+ .v-fab .v-btn {
52
+ --jskit-fab-size: 56px;
53
+ }
54
+
55
+ .v-fab .v-btn--size-small {
56
+ --jskit-fab-size: 40px;
57
+ }
58
+
59
+ .v-fab .v-btn--size-large {
60
+ --jskit-fab-size: 96px;
61
+ }
62
+
63
+ .v-fab .v-btn--icon {
64
+ height: var(--jskit-fab-size);
65
+ width: var(--jskit-fab-size);
66
+ }
67
+
68
+ .v-fab--extended .v-btn {
69
+ --v-btn-height: var(--jskit-fab-size);
70
+ }
71
+
72
+ .v-fab .v-btn .v-icon {
73
+ font-size: 24px;
74
+ }
75
+
76
+ .v-fab .v-btn--size-large .v-icon {
77
+ font-size: 36px;
78
+ }
79
+
80
+ /* Every button, small, x-small and icon buttons included, keeps its visual size and gets a 48dp touch target: a
81
+ transparent hit area centred on it. Layout containment makes what reaches outside the button ink overflow, so a
82
+ hit area at the edge of a window or scroll container never adds a scrollbar. */
83
+ .v-btn:not(.v-btn--stacked) {
84
+ contain: layout;
51
85
  overflow: visible;
52
86
  }
53
87
 
54
- .v-btn--size-default:not(.v-btn--stacked)::before {
88
+ .v-btn:not(.v-btn--stacked)::before {
55
89
  content: "";
56
90
  height: max(100%, 48px);
57
91
  left: 50%;
@@ -61,6 +95,14 @@
61
95
  width: max(100%, 48px);
62
96
  }
63
97
 
98
+ /* A label stays on one line, as Material 3 draws it; one longer than its button ends in an ellipsis. */
99
+ .v-btn:not(.v-btn--stacked, .v-btn--icon) > .v-btn__content:not(:has(> *)) {
100
+ display: block;
101
+ min-width: 0;
102
+ overflow: hidden;
103
+ text-overflow: ellipsis;
104
+ }
105
+
64
106
  /* Outlined buttons draw the outline role, chips outline-variant. */
65
107
  .v-btn--variant-outlined:not([class*=" text-"]) {
66
108
  border-color: rgb(var(--v-theme-outline));
@@ -139,6 +139,9 @@ test("the Vuetify options follow the system scheme on the md3 blueprint with Mat
139
139
  assert.equal(options.icons.aliases.arrowBack, materialSymbols.arrowBack);
140
140
  assert.equal(options.icons.aliases.myLeaf, "svg:M1 1h22v22H1z");
141
141
  assert.equal(options.defaults.VCard.rounded, 12);
142
+ // Vuetify's elevated variant draws the card's level 1; a default elevation would also lift flat and tonal cards.
143
+ assert.equal("elevation" in options.defaults.VCard, false);
144
+ assert.equal("elevation" in options.defaults.VBottomSheet.VCard, false);
142
145
  assert.equal(options.defaults.VChip.rounded, 8);
143
146
  assert.equal(options.defaults.VFab.rounded, 16);
144
147
  assert.equal(options.defaults.VChip.closeIcon, "$close");
@@ -173,6 +176,15 @@ test("material.css holds the exact-size rules without Sass or !important", async
173
176
  assert.doesNotMatch(css, /\$[a-z-]+\s*:/u);
174
177
  assert.match(css, /--v-btn-height: 40px/u);
175
178
  assert.match(css, /height: max\(100%, 48px\)/u);
179
+ // Every button size gets the touch target, not only the default one, and a long label ends in an ellipsis.
180
+ assert.match(css, /\.v-btn:not\(\.v-btn--stacked\)::before \{[^}]*width: max\(100%, 48px\);/u);
181
+ assert.match(css, /\.v-btn:not\(\.v-btn--stacked\) \{[^}]*contain: layout;/u);
182
+ // FABs keep their own sizes: the common and icon button sizes leave them out.
183
+ assert.match(css, /\.v-btn--size-default:not\(\.v-btn--stacked, \.v-btn--icon, \.v-fab \.v-btn\) \{[^}]*--v-btn-height: 40px;/u);
184
+ assert.match(css, /\.v-btn--icon\.v-btn--size-default:not\(\.v-fab \.v-btn\) \{[^}]*--v-btn-height: 28px;/u);
185
+ assert.match(css, /\.v-fab--extended \.v-btn \{[^}]*--v-btn-height: var\(--jskit-fab-size\);/u);
186
+ assert.doesNotMatch(css, /\.v-btn--size-default:not\(\.v-btn--stacked\)::before/u);
187
+ assert.match(css, /> \.v-btn__content:not\(:has\(> \*\)\) \{[^}]*text-overflow: ellipsis;/u);
176
188
  assert.match(css, /border-radius: 28px;/u);
177
189
  assert.match(css, /v-dialog--fullscreen[^{]+\{\s*border-radius: 0;/u);
178
190
  assert.match(css, /border-radius: 28px 28px 0 0/u);