m3-svelte 3.4.11 → 3.5.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.
@@ -117,8 +117,8 @@
117
117
  visibility: visible;
118
118
  pointer-events: auto;
119
119
  animation:
120
- dialogIn 0.5s cubic-bezier(0.05, 0.7, 0.1, 1),
121
- opacity 100ms cubic-bezier(0.05, 0.7, 0.1, 1);
120
+ dialogIn 500ms var(--m3-easing-decel),
121
+ opacity 100ms var(--m3-easing-decel);
122
122
  }
123
123
  dialog[open] .headline {
124
124
  animation: opacity 150ms;
@@ -129,7 +129,7 @@
129
129
  dialog[open] .buttons {
130
130
  position: relative;
131
131
  animation:
132
- buttonsIn 0.5s cubic-bezier(0.05, 0.7, 0.1, 1),
132
+ buttonsIn 500ms var(--m3-easing-decel),
133
133
  opacity 200ms 100ms backwards;
134
134
  }
135
135
  dialog::backdrop {
@@ -25,8 +25,8 @@
25
25
  background-color: rgb(var(--m3-scheme-inverse-surface));
26
26
  color: rgb(var(--m3-scheme-inverse-on-surface));
27
27
  animation:
28
- snackbarIn 0.5s cubic-bezier(0.05, 0.7, 0.1, 1),
29
- opacity 100ms cubic-bezier(0.05, 0.7, 0.1, 1);
28
+ snackbarIn 500ms var(--m3-easing-decel),
29
+ opacity 100ms var(--m3-easing-decel);
30
30
  }
31
31
  /*@TODO: Fix animation with different shaping or something*/
32
32
  @keyframes snackbarIn {
@@ -52,7 +52,7 @@
52
52
  class="tick"
53
53
  class:hidden={Math.abs(tick / 100 - $valueDisplayed / range) < 0.01}
54
54
  class:inactive={tick / 100 > $valueDisplayed / range}
55
- style="left: calc(4px + {tick}% - {i * 2}px);"
55
+ style:--x={tick / 100 - 0.5}
56
56
  ></div>
57
57
  {/each}
58
58
  <div class="thumb"></div>
@@ -125,7 +125,8 @@
125
125
  height: 4px;
126
126
  border-radius: var(--m3-util-rounding-full);
127
127
  top: 50%;
128
- translate: 0 -50%;
128
+ left: calc(50% + (100% - 0.75rem) * var(--x));
129
+ translate: -50% -50%;
129
130
  background-color: rgb(var(--m3-scheme-primary-container));
130
131
  pointer-events: none;
131
132
  }
@@ -85,7 +85,7 @@
85
85
  background-color: rgb(var(--m3-scheme-outline));
86
86
  cursor: pointer;
87
87
  -webkit-tap-highlight-color: transparent;
88
- transition: all 300ms cubic-bezier(0.271, -0.011, 0, 1.449);
88
+ transition: all 300ms var(--m3-easing);
89
89
 
90
90
  left: 0.5rem;
91
91
  top: 50%;
@@ -100,8 +100,8 @@
100
100
  color: rgb(var(--m3-scheme-on-primary-container));
101
101
  opacity: 0;
102
102
  transition:
103
- opacity 300ms cubic-bezier(0.271, -0.011, 0, 1.449),
104
- scale 300ms cubic-bezier(0.271, -0.011, 0, 1.449);
103
+ opacity 300ms var(--m3-easing),
104
+ scale 300ms var(--m3-easing);
105
105
  }
106
106
  .hover {
107
107
  position: absolute;
@@ -111,7 +111,7 @@
111
111
 
112
112
  cursor: pointer;
113
113
  -webkit-tap-highlight-color: transparent;
114
- transition: all 300ms cubic-bezier(0.271, -0.011, 0, 1.449);
114
+ transition: all 300ms var(--m3-easing);
115
115
 
116
116
  left: 1rem;
117
117
  top: 50%;
@@ -34,13 +34,29 @@ export const easeEmphasized = createEase([
34
34
  [0.25, 1],
35
35
  [1, 1],
36
36
  ],
37
- ]); /* css versions:
38
- with limited overshoot:
37
+ ]);
38
+ /*
39
+ === NEW CSS VERSION ===
40
+ is in var(--m3-easing), generated with
41
+ const createCSSEase = (lutOptions: [number, number][][]) => {
42
+ const lut = lutOptions.map((args) => createBezierLUT(args)).flat();
43
+ let stops: number[] = [];
44
+ for (let t = 0; t <= 1; t += 0.01) {
45
+ const closestPoint = lut.find((p) => p[0] >= t);
46
+ const closestY = closestPoint ? closestPoint[1] : 1;
47
+ stops.push(closestY);
48
+ }
49
+
50
+ return `linear(${stops.map((s) => +s.toFixed(3)).join(", ")})`;
51
+ };
52
+
53
+ === OLD CSS VERSION: LIMITED OVERSHOOT ===
39
54
  https://cdn.discordapp.com/attachments/1058124584286683237/1064238491904524308/w9blD3eMKQBwAAAABJRU5ErkJggg.png
40
55
  cubic-bezier(0.254, 0.029, 0, 1.2) is preferred, it is the most accurate to the acceleration
41
56
  cubic-bezier(0.356, 0.701, 0, 1.004) is the most accurate to the deceleration
42
57
  cubic-bezier(0.291, 0.281, 0, 1.2) has no weighting
43
- unlimited overshoot:
58
+
59
+ === OLD CSS VERSION: UNLIMITED OVERSHOOT ===
44
60
  https://cdn.discordapp.com/attachments/1058124584286683237/1064238129306927124/H47ZvYKwT8COjeuQXsI8AE4554luCbtMqAAqAJubZ9I2452QBcREREJgab5REREREKgZEpEREQkBEqmREREREKgZEpEREQkBEqmREREREKgZEpEREQkBEqmREREREKgZEpEREQkBP8PcBLo5kfHxSYAAAAASUVORK5CYII.png
45
61
  cubic-bezier(0.271, -0.011, 0, 1.449) is the most accurate to the acceleration (but has a large overshoot)
46
62
  the deceleration is the same as before
@@ -34,6 +34,110 @@
34
34
 
35
35
  --m3-font: Roboto, system-ui, sans-serif;
36
36
 
37
+ --m3-easing: linear(
38
+ 0,
39
+ 0.001,
40
+ 0.004,
41
+ 0.008,
42
+ 0.013,
43
+ 0.022,
44
+ 0.031,
45
+ 0.043,
46
+ 0.06,
47
+ 0.076,
48
+ 0.095,
49
+ 0.122,
50
+ 0.152,
51
+ 0.188,
52
+ 0.228,
53
+ 0.281,
54
+ 0.351,
55
+ 0.449,
56
+ 0.53,
57
+ 0.594,
58
+ 0.643,
59
+ 0.68,
60
+ 0.715,
61
+ 0.74,
62
+ 0.755,
63
+ 0.778,
64
+ 0.793,
65
+ 0.807,
66
+ 0.82,
67
+ 0.833,
68
+ 0.846,
69
+ 0.852,
70
+ 0.863,
71
+ 0.869,
72
+ 0.88,
73
+ 0.885,
74
+ 0.89,
75
+ 0.9,
76
+ 0.905,
77
+ 0.91,
78
+ 0.914,
79
+ 0.919,
80
+ 0.923,
81
+ 0.927,
82
+ 0.931,
83
+ 0.935,
84
+ 0.939,
85
+ 0.943,
86
+ 0.946,
87
+ 0.95,
88
+ 0.953,
89
+ 0.956,
90
+ 0.956,
91
+ 0.959,
92
+ 0.962,
93
+ 0.965,
94
+ 0.968,
95
+ 0.968,
96
+ 0.971,
97
+ 0.973,
98
+ 0.973,
99
+ 0.976,
100
+ 0.978,
101
+ 0.98,
102
+ 0.98,
103
+ 0.982,
104
+ 0.984,
105
+ 0.984,
106
+ 0.986,
107
+ 0.986,
108
+ 0.988,
109
+ 0.989,
110
+ 0.989,
111
+ 0.991,
112
+ 0.991,
113
+ 0.992,
114
+ 0.993,
115
+ 0.993,
116
+ 0.995,
117
+ 0.995,
118
+ 0.996,
119
+ 0.996,
120
+ 0.997,
121
+ 0.997,
122
+ 0.997,
123
+ 0.997,
124
+ 0.998,
125
+ 0.998,
126
+ 0.999,
127
+ 0.999,
128
+ 0.999,
129
+ 0.999,
130
+ 1,
131
+ 1,
132
+ 1,
133
+ 1,
134
+ 1,
135
+ 1,
136
+ 1,
137
+ 1
138
+ );
139
+ --m3-easing-decel: cubic-bezier(0.05, 0.7, 0.1, 1);
140
+
37
141
  accent-color: rgb(var(--m3-scheme-primary));
38
142
  }
39
143
  .m3-font-display-large,
@@ -102,8 +102,8 @@
102
102
  inset: 0 0;
103
103
  width: 100%;
104
104
  transition:
105
- width 400ms cubic-bezier(0.356, 0.701, 0, 1.004),
106
- inset 400ms cubic-bezier(0.356, 0.701, 0, 1.004);
105
+ width 400ms var(--m3-easing),
106
+ inset 400ms var(--m3-easing);
107
107
  }
108
108
  .selected > .icon-space > :global(svg) {
109
109
  color: rgb(var(--m3-scheme-on-secondary-container));
@@ -101,8 +101,8 @@
101
101
  inset: 0 0;
102
102
  width: 100%;
103
103
  transition:
104
- width 400ms cubic-bezier(0.356, 0.701, 0, 1.004),
105
- inset 400ms cubic-bezier(0.356, 0.701, 0, 1.004);
104
+ width 400ms var(--m3-easing),
105
+ inset 400ms var(--m3-easing);
106
106
  }
107
107
  .selected > .icon-space > :global(svg) {
108
108
  color: rgb(var(--m3-scheme-on-secondary-container));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "m3-svelte",
3
- "version": "3.4.11",
3
+ "version": "3.5.0",
4
4
  "license": "Apache-2.0 OR GPL-3.0-only",
5
5
  "repository": "KTibow/m3-svelte",
6
6
  "author": {