m3-svelte 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -92,7 +92,10 @@
92
92
  gap: 0.5rem;
93
93
  padding: 0 1rem;
94
94
  border-radius: var(--m3-button-shape);
95
- transition: all 200ms;
95
+ transition:
96
+ border-radius var(--m3-util-easing-fast-spatial),
97
+ background-color var(--m3-util-easing-fast),
98
+ color var(--m3-util-easing-fast);
96
99
 
97
100
  align-items: center;
98
101
  justify-content: center;
@@ -146,7 +149,7 @@
146
149
  }
147
150
  &.outlined:not(:disabled, :global(input:disabled) + label) {
148
151
  outline-color: rgb(var(--m3-scheme-outline));
149
- color: rgb(var(--m3-scheme-primary));
152
+ color: rgb(var(--m3-scheme-on-surface-variant));
150
153
  &:is(:global(input:checked) + label) {
151
154
  outline-color: rgb(var(--m3-scheme-inverse-surface));
152
155
  background-color: rgb(var(--m3-scheme-inverse-surface));
@@ -67,7 +67,6 @@
67
67
  align-items: center;
68
68
  justify-content: center;
69
69
  cursor: pointer;
70
- transition: all 200ms;
71
70
  }
72
71
 
73
72
  .elevation-normal {
@@ -44,7 +44,6 @@
44
44
 
45
45
  -webkit-tap-highlight-color: transparent;
46
46
  cursor: pointer;
47
- transition: all 200ms;
48
47
  }
49
48
  .icon {
50
49
  width: 1.5rem;
@@ -19,6 +19,7 @@
19
19
  import iconX from "@ktibow/iconset-material-symbols/close";
20
20
  import Icon from "../misc/_icon.svelte";
21
21
  import SnackbarItem from "./SnackbarItem.svelte";
22
+ import Layer from "../misc/Layer.svelte";
22
23
 
23
24
  type SnackbarConfig = Omit<ComponentProps<typeof SnackbarItem>, "children">;
24
25
 
@@ -63,6 +64,7 @@
63
64
  snackbar = undefined;
64
65
  }}
65
66
  >
67
+ <Layer />
66
68
  <Icon icon={iconX} />
67
69
  </button>
68
70
  {/if}
@@ -92,10 +94,9 @@
92
94
  border: none;
93
95
 
94
96
  background-color: transparent;
95
- color: rgb(var(--text));
96
97
  -webkit-tap-highlight-color: transparent;
97
98
  cursor: pointer;
98
- transition: all 200ms;
99
+ position: relative;
99
100
  }
100
101
  button :global(svg) {
101
102
  width: 1.5rem;
@@ -103,21 +104,12 @@
103
104
  }
104
105
 
105
106
  .action {
106
- --text: var(--m3-scheme-inverse-primary);
107
+ color: var(--m3-scheme-inverse-primary);
107
108
  padding: 0 0.5rem;
108
109
  }
109
110
  .close {
110
- --text: var(--m3-scheme-inverse-on-surface);
111
+ color: var(--m3-scheme-inverse-on-surface);
111
112
  padding: 0 0.75rem;
112
113
  margin-right: -1rem;
113
114
  }
114
- @media (hover: hover) {
115
- button:hover {
116
- background-color: rgb(var(--text) / 0.08);
117
- }
118
- }
119
- button:focus-visible,
120
- button:active {
121
- background-color: rgb(var(--text) / 0.12);
122
- }
123
115
  </style>
@@ -55,7 +55,7 @@
55
55
  inset: 0.6875rem;
56
56
  border-radius: 0.125rem;
57
57
  border: solid 0.125rem currentColor;
58
- transition: all 200ms;
58
+ transition: var(--m3-util-easing-fast);
59
59
  -webkit-tap-highlight-color: transparent;
60
60
  }
61
61
 
@@ -65,11 +65,11 @@
65
65
  color: rgb(var(--m3-scheme-on-primary));
66
66
  opacity: 0;
67
67
  pointer-events: none;
68
- transition: opacity 200ms;
68
+ transition: var(--m3-util-easing-fast);
69
69
  path {
70
70
  stroke-dasharray: 20.874 20.874;
71
71
  stroke-dashoffset: 20.874;
72
- transition: stroke-dashoffset 0ms 200ms;
72
+ transition: stroke-dashoffset 0ms 300ms;
73
73
  }
74
74
  }
75
75
 
@@ -88,7 +88,7 @@
88
88
  opacity: 1;
89
89
  path {
90
90
  stroke-dashoffset: 0;
91
- transition: stroke-dashoffset 200ms;
91
+ transition: stroke-dashoffset var(--m3-util-easing-slow);
92
92
  }
93
93
  }
94
94
 
@@ -71,7 +71,7 @@
71
71
  position: relative;
72
72
  cursor: pointer;
73
73
  -webkit-tap-highlight-color: transparent;
74
- transition: all 200ms;
74
+ transition: var(--m3-util-easing-fast);
75
75
  }
76
76
 
77
77
  .m3-container > :global(:is(.ripple-container, .tint)) {
@@ -32,6 +32,6 @@
32
32
  }
33
33
  circle {
34
34
  stroke-dashoffset: calc((var(--percent) / -100 + 1px) * 125.66);
35
- transition: all 200ms;
35
+ transition: var(--m3-util-easing-fast);
36
36
  }
37
37
  </style>
@@ -30,7 +30,7 @@
30
30
  animation: progressRotate 2.2s infinite linear;
31
31
  }
32
32
  circle {
33
- transition: all 200ms;
33
+ transition: var(--m3-util-easing-fast);
34
34
  animation: progressSize 2.2s infinite linear;
35
35
  }
36
36
  @keyframes progressRotate {
@@ -27,7 +27,7 @@
27
27
  }
28
28
  .percent {
29
29
  background-color: rgb(var(--m3-scheme-primary));
30
- transition: all 200ms;
30
+ transition: var(--m3-util-easing-fast);
31
31
  border-radius: var(--m3-linear-progress-shape);
32
32
  }
33
33
 
@@ -51,7 +51,7 @@
51
51
  height: 1.25rem;
52
52
  border-radius: var(--m3-util-rounding-full);
53
53
  border: solid 0.125rem currentColor;
54
- transition: all 0.3s;
54
+ transition: border var(--m3-util-easing-fast);
55
55
  -webkit-tap-highlight-color: transparent;
56
56
  }
57
57
 
@@ -63,7 +63,7 @@
63
63
  scale: 0;
64
64
  border-radius: var(--m3-util-rounding-full);
65
65
  background-color: currentColor;
66
- transition: all 0.3s;
66
+ transition: scale var(--m3-util-easing-fast-spatial);
67
67
  -webkit-tap-highlight-color: transparent;
68
68
  }
69
69
 
@@ -51,7 +51,7 @@
51
51
  height: 1.25rem;
52
52
  border-radius: var(--m3-util-rounding-full);
53
53
  border: solid 0.125rem currentColor;
54
- transition: all 0.3s;
54
+ transition: border var(--m3-util-easing-fast);
55
55
  -webkit-tap-highlight-color: transparent;
56
56
  }
57
57
 
@@ -76,7 +76,7 @@
76
76
 
77
77
  :global(input:checked) + .layer-container .radio-dot {
78
78
  scale: 1;
79
- transition: all 0.3s;
79
+ transition: scale var(--m3-util-easing-fast-spatial);
80
80
  }
81
81
 
82
82
  :global(input:disabled) + .layer-container {
@@ -51,7 +51,7 @@
51
51
  height: 1.25rem;
52
52
  border-radius: var(--m3-util-rounding-full);
53
53
  border: solid 0.125rem currentColor;
54
- transition: all 0.3s;
54
+ transition: border var(--m3-util-easing-fast);
55
55
  -webkit-tap-highlight-color: transparent;
56
56
  }
57
57
 
@@ -62,7 +62,7 @@
62
62
  height: 1rem;
63
63
  border-radius: var(--m3-util-rounding-full);
64
64
  outline: solid 0 currentColor;
65
- transition: all 0.3s;
65
+ transition: var(--m3-util-easing);
66
66
  -webkit-tap-highlight-color: transparent;
67
67
  }
68
68
 
@@ -121,7 +121,7 @@
121
121
  background-color: rgb(var(--m3-scheme-primary));
122
122
 
123
123
  pointer-events: none;
124
- transition: width 200ms;
124
+ transition: width var(--m3-util-easing);
125
125
  }
126
126
 
127
127
  .value {
@@ -142,7 +142,7 @@
142
142
 
143
143
  opacity: 0;
144
144
  pointer-events: none;
145
- transition: opacity 200ms;
145
+ transition: opacity var(--m3-util-easing);
146
146
  }
147
147
 
148
148
  input:focus-visible ~ .thumb {
@@ -154,7 +154,7 @@
154
154
  background-color: rgb(var(--m3-scheme-primary));
155
155
 
156
156
  pointer-events: none;
157
- transition: width 200ms;
157
+ transition: width var(--m3-util-easing);
158
158
  }
159
159
 
160
160
  .value {
@@ -175,7 +175,7 @@
175
175
 
176
176
  opacity: 0;
177
177
  pointer-events: none;
178
- transition: opacity 200ms;
178
+ transition: opacity var(--m3-util-easing);
179
179
  }
180
180
 
181
181
  input:focus-visible ~ .thumb {
@@ -76,7 +76,7 @@
76
76
  border: solid 0.125rem rgb(var(--m3-scheme-outline));
77
77
  cursor: pointer;
78
78
  -webkit-tap-highlight-color: transparent;
79
- transition: all 300ms;
79
+ transition: var(--m3-util-easing);
80
80
  }
81
81
  .handle {
82
82
  position: absolute;
@@ -85,9 +85,11 @@
85
85
  border-radius: var(--m3-switch-handle-shape);
86
86
 
87
87
  background-color: rgb(var(--m3-scheme-outline));
88
+ /* Fallback for those without on on primary */
89
+ color: rgb(var(--m3-scheme-on-on-primary, var(--m3-scheme-on-primary-container)));
88
90
  cursor: pointer;
89
91
  -webkit-tap-highlight-color: transparent;
90
- transition: all var(--m3-util-easing-fast-spatial);
92
+ transition: var(--m3-util-easing-fast-spatial);
91
93
 
92
94
  left: 0.5rem;
93
95
  top: 50%;
@@ -99,7 +101,6 @@
99
101
  .handle > :global(svg) {
100
102
  width: 1rem;
101
103
  height: 1rem;
102
- color: rgb(var(--m3-scheme-on-primary-container));
103
104
  opacity: 0;
104
105
  transition:
105
106
  opacity var(--m3-util-easing-fast-spatial),
@@ -113,7 +114,7 @@
113
114
 
114
115
  cursor: pointer;
115
116
  -webkit-tap-highlight-color: transparent;
116
- transition: all var(--m3-util-easing-fast);
117
+ transition: var(--m3-util-easing-fast);
117
118
 
118
119
  left: 1rem;
119
120
  top: 50%;
@@ -130,6 +131,7 @@
130
131
  .m3-container:hover > input:enabled:checked + .handle,
131
132
  .m3-container > input:enabled:checked:is(:global(:active, :focus-visible)) + .handle {
132
133
  background-color: rgb(var(--m3-scheme-primary-container));
134
+ color: rgb(var(--m3-scheme-on-primary-container));
133
135
  }
134
136
  .m3-container:hover > input ~ .hover {
135
137
  background-color: rgb(var(--m3-scheme-on-surface) / 0.08);
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import Icon from "../../misc/_icon.svelte";
3
+ import Layer from "../../misc/Layer.svelte";
3
4
  import iconCheck from "@ktibow/iconset-material-symbols/check";
4
5
 
5
6
  const conditionalScroll = (node: Element, shouldScroll: boolean) => {
@@ -16,6 +17,7 @@
16
17
  <div class="m3-container">
17
18
  {#each options as { name, selected, activate }}
18
19
  <button class="m3-font-body-large" onclick={activate} use:conditionalScroll={selected}>
20
+ <Layer />
19
21
  {#if selected}
20
22
  <Icon icon={iconCheck} />
21
23
  {/if}
@@ -42,26 +44,16 @@
42
44
  background-color: transparent;
43
45
  color: rgb(var(--m3-scheme-on-surface));
44
46
  border: none;
45
- position: relative;
46
47
  -webkit-tap-highlight-color: transparent;
47
48
  cursor: pointer;
48
- transition: all 200ms;
49
+ position: relative;
49
50
  }
50
- button :global(svg) {
51
+ button > :global(svg) {
51
52
  width: 1.5rem;
52
53
  height: 1.5rem;
53
54
  position: absolute;
54
55
  left: 1rem;
55
56
  top: 50%;
56
- transform: translateY(-50%);
57
- }
58
- @media (hover: hover) {
59
- button:hover {
60
- background-color: rgb(var(--m3-scheme-on-surface) / 0.08);
61
- }
62
- }
63
- button:focus-visible,
64
- button:active {
65
- background-color: rgb(var(--m3-scheme-on-surface) / 0.12);
57
+ translate: 0 -50%;
66
58
  }
67
59
  </style>
@@ -3,6 +3,7 @@
3
3
  import iconLeft from "@ktibow/iconset-material-symbols/chevron-left";
4
4
  import iconRight from "@ktibow/iconset-material-symbols/chevron-right";
5
5
  import iconDown from "@ktibow/iconset-material-symbols/arrow-drop-down";
6
+ import Layer from "../../misc/Layer.svelte";
6
7
 
7
8
  let {
8
9
  currentView = $bindable(),
@@ -31,6 +32,7 @@
31
32
  class="arrow"
32
33
  onclick={() => (focusedMonth = (focusedMonth - 1 + 12) % 12)}
33
34
  >
35
+ <Layer />
34
36
  <Icon icon={iconLeft} />
35
37
  </button>
36
38
  <button
@@ -39,10 +41,12 @@
39
41
  onclick={monthClick}
40
42
  disabled={currentView == "year"}
41
43
  >
44
+ <Layer />
42
45
  {getShortMonth(focusedMonth)}
43
46
  <Icon icon={iconDown} />
44
47
  </button>
45
48
  <button type="button" class="arrow" onclick={() => (focusedMonth = (focusedMonth + 1) % 12)}>
49
+ <Layer />
46
50
  <Icon icon={iconRight} />
47
51
  </button>
48
52
  </div>
@@ -53,6 +57,7 @@
53
57
  disabled={focusedYear <= startYear}
54
58
  onclick={() => focusedYear--}
55
59
  >
60
+ <Layer />
56
61
  <Icon icon={iconLeft} />
57
62
  </button>
58
63
  <button
@@ -61,6 +66,7 @@
61
66
  onclick={yearClick}
62
67
  disabled={currentView == "month"}
63
68
  >
69
+ <Layer />
64
70
  {focusedYear}
65
71
  <Icon icon={iconDown} />
66
72
  </button>
@@ -70,6 +76,7 @@
70
76
  disabled={focusedYear >= endYear}
71
77
  onclick={() => focusedYear++}
72
78
  >
79
+ <Layer />
73
80
  <Icon icon={iconRight} />
74
81
  </button>
75
82
  </div>
@@ -79,7 +86,6 @@
79
86
  .m3-container {
80
87
  display: flex;
81
88
  height: 4rem;
82
- transition: all 200ms;
83
89
  border-bottom: solid 1px transparent;
84
90
  flex-shrink: 0;
85
91
  }
@@ -97,18 +103,9 @@
97
103
  color: rgb(var(--m3-scheme-on-surface-variant));
98
104
  border: none;
99
105
  padding: 0;
100
- transition: all 200ms;
101
106
  -webkit-tap-highlight-color: transparent;
102
107
  cursor: pointer;
103
- }
104
- @media (hover: hover) {
105
- button:enabled:hover {
106
- background-color: rgb(var(--m3-scheme-on-surface-variant) / 0.08);
107
- }
108
- }
109
- button:enabled:focus-visible,
110
- button:enabled:active {
111
- background-color: rgb(var(--m3-scheme-on-surface-variant) / 0.12);
108
+ position: relative;
112
109
  }
113
110
  button:disabled {
114
111
  cursor: auto;
@@ -1,4 +1,6 @@
1
1
  <script lang="ts">
2
+ import Layer from "../../misc/Layer.svelte";
3
+
2
4
  let {
3
5
  disabled,
4
6
  today,
@@ -22,6 +24,7 @@
22
24
  class:selected
23
25
  onclick={click}
24
26
  >
27
+ <Layer />
25
28
  {label}
26
29
  </button>
27
30
 
@@ -34,33 +37,24 @@
34
37
  align-items: center;
35
38
  justify-content: center;
36
39
 
37
- --text: var(--m3-scheme-on-surface);
38
40
  background-color: transparent;
39
- color: rgb(var(--text));
41
+ color: rgb(var(--m3-scheme-on-surface));
40
42
  border: none;
41
43
  -webkit-tap-highlight-color: transparent;
42
44
  cursor: pointer;
43
- transition: all 200ms;
44
- }
45
- @media (hover: hover) {
46
- button:enabled:hover {
47
- background-color: rgb(var(--text) / 0.08);
48
- }
49
- }
50
- button:enabled:focus-visible,
51
- button:enabled:active {
52
- background-color: rgb(var(--text) / 0.12);
45
+ transition: var(--m3-util-easing-fast);
46
+ position: relative;
53
47
  }
54
48
  button:disabled {
55
49
  cursor: auto;
56
50
  color: rgb(var(--m3-scheme-on-surface-variant) / 0.38);
57
51
  }
58
52
  .today {
59
- border: solid 1px rgb(var(--text));
60
- --text: var(--m3-scheme-primary);
53
+ border: solid 1px rgb(var(--m3-scheme-primary));
54
+ color: rgb(var(--m3-scheme-primary));
61
55
  }
62
56
  .selected {
63
57
  background-color: rgb(var(--m3-scheme-primary)) !important;
64
- --text: var(--m3-scheme-on-primary);
58
+ color: rgb(var(--m3-scheme-on-primary));
65
59
  }
66
60
  </style>
@@ -1,6 +1,7 @@
1
1
  export { default as Icon } from "./misc/_icon.svelte";
2
2
  export { default as Layer } from "./misc/Layer.svelte";
3
3
  export * from "./misc/animation.js";
4
+ export * from "./misc/colors.js";
4
5
  export * from "./misc/utils.js";
5
6
  export * from "./misc/easing.js";
6
7
  export { default as Button } from "./buttons/Button.svelte";
package/package/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { default as Icon } from "./misc/_icon.svelte";
2
2
  export { default as Layer } from "./misc/Layer.svelte";
3
3
  export * from "./misc/animation.js";
4
+ export * from "./misc/colors.js";
4
5
  export * from "./misc/utils.js";
5
6
  export * from "./misc/easing.js";
6
7
  export { default as Button } from "./buttons/Button.svelte";
@@ -157,19 +157,20 @@
157
157
 
158
158
  background-color: currentColor;
159
159
  opacity: 0;
160
- transition: opacity 200ms;
161
- }
160
+ transition: opacity var(--m3-util-easing-fast);
162
161
 
163
- :global(:not(input:disabled + label, input:disabled + .layer-container, :disabled)) {
164
162
  @media (hover: hover) {
165
- &:hover > .tint {
163
+ &:is(:global(:hover) > .tint):not(
164
+ :global(input:disabled + label) > .tint,
165
+ :global(input:disabled + .layer-container) > .tint,
166
+ :global(:disabled) > .tint
167
+ ) {
166
168
  opacity: 0.08;
167
169
  }
168
170
  }
169
-
170
- &:is(:global(input:focus-visible + label)) > .tint,
171
- &:focus-visible > .tint,
172
- &:active > .tint {
171
+ &:is(:global(input:focus-visible + label) > .tint),
172
+ &:is(:global(:focus-visible) > .tint),
173
+ &:is(.ripple-container.broken + .tint):is(:global(:active) > .tint) {
173
174
  opacity: 0.12;
174
175
  }
175
176
  }
@@ -11,19 +11,20 @@
11
11
 
12
12
  background-color: currentColor;
13
13
  opacity: 0;
14
- transition: opacity 200ms;
15
- }
14
+ transition: opacity var(--m3-util-easing-fast);
16
15
 
17
- :global(:not(input:disabled + label, input:disabled + .layer-container, :disabled)) {
18
16
  @media (hover: hover) {
19
- &:hover > .tint {
17
+ &:is(:global(:hover) > .tint):not(
18
+ :global(input:disabled + label) > .tint,
19
+ :global(input:disabled + .layer-container) > .tint,
20
+ :global(:disabled) > .tint
21
+ ) {
20
22
  opacity: 0.08;
21
23
  }
22
24
  }
23
-
24
- &:is(:global(input:focus-visible + label)) > .tint,
25
- &:focus-visible > .tint,
26
- &:active > .tint {
25
+ &:is(:global(input:focus-visible + label) > .tint),
26
+ &:is(:global(:focus-visible) > .tint),
27
+ &:is(.ripple-container.broken + .tint):is(:global(:active) > .tint) {
27
28
  opacity: 0.12;
28
29
  }
29
30
  }
@@ -0,0 +1,4 @@
1
+ import { MaterialDynamicColors, DynamicColor } from "@ktibow/material-color-utilities-nightly";
2
+ export declare const materialColors: MaterialDynamicColors;
3
+ export declare const colors: DynamicColor[];
4
+ export declare const pairs: DynamicColor[][];
@@ -0,0 +1,24 @@
1
+ import { MaterialDynamicColors, DynamicColor, ContrastCurve, } from "@ktibow/material-color-utilities-nightly";
2
+ export const materialColors = new MaterialDynamicColors();
3
+ // Custom color role used for switch
4
+ const onOnPrimary = DynamicColor.fromPalette({
5
+ name: "on_on_primary",
6
+ palette: (s) => s.primaryPalette,
7
+ background: () => materialColors.onPrimary(),
8
+ contrastCurve: () => new ContrastCurve(6, 6, 7, 11),
9
+ });
10
+ export const colors = [...materialColors.allColors, onOnPrimary];
11
+ export const pairs = [
12
+ [materialColors.onPrimary(), onOnPrimary],
13
+ [materialColors.primaryContainer(), materialColors.onPrimaryContainer()],
14
+ [materialColors.secondary(), materialColors.onSecondary()],
15
+ [materialColors.secondaryContainer(), materialColors.onSecondaryContainer()],
16
+ [materialColors.tertiary(), materialColors.onTertiary()],
17
+ [materialColors.tertiaryContainer(), materialColors.onTertiaryContainer()],
18
+ [materialColors.background(), materialColors.onBackground()],
19
+ [materialColors.surface(), materialColors.onSurface()],
20
+ [materialColors.inverseSurface(), materialColors.inverseOnSurface()],
21
+ [materialColors.surfaceVariant(), materialColors.onSurfaceVariant()],
22
+ [materialColors.error(), materialColors.onError()],
23
+ [materialColors.errorContainer(), materialColors.onErrorContainer()],
24
+ ];
@@ -1,8 +1,4 @@
1
1
  import { type DynamicScheme } from "@ktibow/material-color-utilities-nightly";
2
- export type Color = "primary" | "onPrimary" | "primaryContainer" | "onPrimaryContainer" | "inversePrimary" | "secondary" | "onSecondary" | "secondaryContainer" | "onSecondaryContainer" | "tertiary" | "onTertiary" | "tertiaryContainer" | "onTertiaryContainer" | "error" | "onError" | "errorContainer" | "onErrorContainer" | "background" | "onBackground" | "surface" | "onSurface" | "surfaceVariant" | "onSurfaceVariant" | "inverseSurface" | "inverseOnSurface" | "outline" | "outlineVariant" | "shadow" | "scrim" | "surfaceDim" | "surfaceBright" | "surfaceContainerLowest" | "surfaceContainerLow" | "surfaceContainer" | "surfaceContainerHigh" | "surfaceContainerHighest" | "surfaceTint";
3
- export type SerializedScheme = Record<Color, number>;
4
- export declare const pairs: string[][];
5
- export declare const colors: Color[];
6
2
  /**
7
3
  * @returns A string of CSS code with custom properties representing the color scheme values.
8
4
  * */
@@ -1,73 +1,21 @@
1
- import { MaterialDynamicColors, } from "@ktibow/material-color-utilities-nightly";
2
- export const pairs = [
3
- ["primary", "onPrimary"],
4
- ["primaryContainer", "onPrimaryContainer"],
5
- ["secondary", "onSecondary"],
6
- ["secondaryContainer", "onSecondaryContainer"],
7
- ["tertiary", "onTertiary"],
8
- ["tertiaryContainer", "onTertiaryContainer"],
9
- ["background", "onBackground"],
10
- ["surface", "onSurface"],
11
- ["inverseSurface", "inverseOnSurface"],
12
- ["surfaceVariant", "onSurfaceVariant"],
13
- ["error", "onError"],
14
- ["errorContainer", "onErrorContainer"],
15
- ];
16
- export const colors = [
17
- "primary",
18
- "onPrimary",
19
- "primaryContainer",
20
- "onPrimaryContainer",
21
- "inversePrimary",
22
- "secondary",
23
- "onSecondary",
24
- "secondaryContainer",
25
- "onSecondaryContainer",
26
- "tertiary",
27
- "onTertiary",
28
- "tertiaryContainer",
29
- "onTertiaryContainer",
30
- "error",
31
- "onError",
32
- "errorContainer",
33
- "onErrorContainer",
34
- "background",
35
- "onBackground",
36
- "surface",
37
- "onSurface",
38
- "surfaceVariant",
39
- "onSurfaceVariant",
40
- "inverseSurface",
41
- "inverseOnSurface",
42
- "outline",
43
- "outlineVariant",
44
- "shadow",
45
- "scrim",
46
- "surfaceDim",
47
- "surfaceBright",
48
- "surfaceContainerLowest",
49
- "surfaceContainerLow",
50
- "surfaceContainer",
51
- "surfaceContainerHigh",
52
- "surfaceContainerHighest",
53
- "surfaceTint",
54
- ];
1
+ import {} from "@ktibow/material-color-utilities-nightly";
2
+ import { colors } from "./colors";
55
3
  /**
56
4
  * @returns A string of CSS code with custom properties representing the color scheme values.
57
5
  * */
58
6
  export const genCSS = (light, dark) => {
59
7
  const genColorVariable = (name, argb) => {
60
- const kebabCase = name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
8
+ const kebabCase = name.replaceAll("_", "-");
61
9
  const red = (argb >> 16) & 255;
62
10
  const green = (argb >> 8) & 255;
63
11
  const blue = argb & 255;
64
12
  return `--m3-scheme-${kebabCase}: ${red} ${green} ${blue};`;
65
13
  };
66
14
  const lightColors = colors
67
- .map((name) => genColorVariable(name, MaterialDynamicColors[name].getArgb(light)))
15
+ .map((color) => genColorVariable(color.name, color.getArgb(light)))
68
16
  .join("\n");
69
17
  const darkColors = colors
70
- .map((name) => genColorVariable(name, MaterialDynamicColors[name].getArgb(dark)))
18
+ .map((color) => genColorVariable(color.name, color.getArgb(dark)))
71
19
  .join("\n");
72
20
  return `@media (prefers-color-scheme: light) {
73
21
  :root {
@@ -54,7 +54,7 @@
54
54
  align-items: center;
55
55
  position: relative;
56
56
  color: rgb(var(--m3-scheme-on-surface-variant));
57
- transition: all var(--m3-util-easing);
57
+ transition: var(--m3-util-easing);
58
58
  &:is(.compact .content, .large .content) {
59
59
  flex-direction: column;
60
60
  text-align: center;
@@ -109,7 +109,7 @@
109
109
  justify-content: center;
110
110
  border-radius: var(--m3-util-rounding-full);
111
111
  position: relative;
112
- transition: all var(--m3-util-easing);
112
+ transition: var(--m3-util-easing);
113
113
  }
114
114
  .icon::before {
115
115
  position: absolute;
@@ -71,7 +71,7 @@
71
71
  user-select: none;
72
72
  -webkit-tap-highlight-color: transparent;
73
73
  cursor: pointer;
74
- transition: all 200ms;
74
+ transition: color var(--m3-util-easing-fast);
75
75
  }
76
76
  label > :global(svg) {
77
77
  width: 1.5rem;
@@ -96,7 +96,7 @@
96
96
  height: 0;
97
97
  bottom: 0;
98
98
  pointer-events: none;
99
- transition: all 200ms;
99
+ transition: var(--m3-util-easing-fast-spatial);
100
100
  }
101
101
  input:checked:nth-of-type(1) ~ .bar {
102
102
  left: 0;
@@ -69,7 +69,7 @@
69
69
  user-select: none;
70
70
  -webkit-tap-highlight-color: transparent;
71
71
  cursor: pointer;
72
- transition: all 200ms;
72
+ transition: color var(--m3-util-easing-fast);
73
73
  }
74
74
  a > :global(svg) {
75
75
  width: 1.5rem;
@@ -95,7 +95,7 @@
95
95
  left: calc(100% / var(--items) * var(--i));
96
96
  bottom: 0;
97
97
  pointer-events: none;
98
- transition: all 200ms;
98
+ transition: var(--m3-util-easing-fast-spatial);
99
99
  }
100
100
 
101
101
  .primary > a {
@@ -44,8 +44,8 @@
44
44
  },
45
45
  ],
46
46
  {
47
- duration: 300,
48
- easing: "ease",
47
+ duration: 350,
48
+ easing: "cubic-bezier(0.42, 1.67, 0.21, 0.9)",
49
49
  },
50
50
  );
51
51
  } else {
@@ -59,8 +59,8 @@
59
59
  },
60
60
  ],
61
61
  {
62
- duration: 200,
63
- easing: "ease",
62
+ duration: 350,
63
+ easing: "cubic-bezier(0.42, 1.67, 0.21, 0.9)",
64
64
  },
65
65
  );
66
66
  }
@@ -132,7 +132,7 @@
132
132
  user-select: none;
133
133
  -webkit-tap-highlight-color: transparent;
134
134
  cursor: pointer;
135
- transition: all 200ms;
135
+ transition: color var(--m3-util-easing-fast);
136
136
  }
137
137
  label > :global(svg) {
138
138
  width: 1.5rem;
@@ -130,7 +130,7 @@
130
130
  user-select: none;
131
131
  -webkit-tap-highlight-color: transparent;
132
132
  cursor: pointer;
133
- transition: all 200ms;
133
+ transition: color var(--m3-util-easing-fast);
134
134
  }
135
135
  a > :global(svg) {
136
136
  width: 1.5rem;
@@ -2,8 +2,9 @@
2
2
  import { onMount } from "svelte";
3
3
  import type { HTMLInputAttributes } from "svelte/elements";
4
4
  import type { TransitionConfig } from "svelte/transition";
5
- import Icon from "../misc/_icon.svelte";
6
5
  import iconCalendar from "@ktibow/iconset-material-symbols/calendar-today-outline";
6
+ import Icon from "../misc/_icon.svelte";
7
+ import Layer from "../misc/Layer.svelte";
7
8
 
8
9
  import DatePickerDocked from "../forms/DatePickerDocked.svelte";
9
10
  import { easeEmphasized } from "../misc/easing";
@@ -65,6 +66,7 @@ opacity: ${Math.min(t * 3, 1)};`,
65
66
  />
66
67
  <label class="m3-font-body-small" for={id}>{name}</label>
67
68
  <button type="button" {disabled} onclick={() => (picker = !picker)}>
69
+ <Layer />
68
70
  <Icon icon={iconCalendar} />
69
71
  </button>
70
72
  {#if picker}
@@ -134,7 +136,6 @@ opacity: ${Math.min(t * 3, 1)};`,
134
136
 
135
137
  -webkit-tap-highlight-color: transparent;
136
138
  cursor: pointer;
137
- transition: all 200ms;
138
139
  }
139
140
 
140
141
  .m3-container.disabled {
@@ -161,15 +162,6 @@ opacity: ${Math.min(t * 3, 1)};`,
161
162
  z-index: 1;
162
163
  }
163
164
 
164
- @media (hover: hover) {
165
- button:enabled:hover {
166
- background-color: rgb(var(--m3-scheme-on-surface-variant) / 0.08);
167
- }
168
- }
169
- button:enabled:focus-visible,
170
- button:enabled:active {
171
- background-color: rgb(var(--m3-scheme-on-surface-variant) / 0.12);
172
- }
173
165
  @media (min-width: 37.5rem) {
174
166
  .has-js button {
175
167
  display: flex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "m3-svelte",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "license": "Apache-2.0 OR GPL-3.0-only",
5
5
  "repository": "KTibow/m3-svelte",
6
6
  "author": {
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@iconify/types": "^2.0.0",
32
32
  "@ktibow/iconset-material-symbols": "^0.0.1747426012",
33
- "@ktibow/material-color-utilities-nightly": "^0.3.11748493074137",
33
+ "@ktibow/material-color-utilities-nightly": "^0.3.11748742074820",
34
34
  "svelte": "^5.33.2"
35
35
  },
36
36
  "devDependencies": {