m3-svelte 4.1.0 → 4.3.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.
- package/package/buttons/Button.svelte +5 -2
- package/package/buttons/FAB.svelte +0 -1
- package/package/containers/MenuItem.svelte +0 -1
- package/package/containers/Snackbar.svelte +5 -13
- package/package/forms/Checkbox.svelte +4 -4
- package/package/forms/Chip.svelte +1 -1
- package/package/forms/CircularProgress.svelte +27 -14
- package/package/forms/CircularProgress.svelte.d.ts +2 -0
- package/package/forms/CircularProgressEstimate.svelte +97 -0
- package/package/forms/CircularProgressEstimate.svelte.d.ts +8 -0
- package/package/forms/CircularProgressIndeterminate.svelte +5 -1
- package/package/forms/CircularProgressIndeterminate.svelte.d.ts +1 -0
- package/package/forms/LinearProgress.svelte +12 -29
- package/package/forms/LinearProgress.svelte.d.ts +2 -2
- package/package/forms/LinearProgressEstimate.svelte +136 -0
- package/package/forms/LinearProgressEstimate.svelte.d.ts +7 -0
- package/package/forms/LinearProgressIndeterminate.svelte +4 -0
- package/package/forms/LinearProgressIndeterminate.svelte.d.ts +1 -0
- package/package/forms/LoadingIndicator.svelte +64 -0
- package/package/forms/LoadingIndicator.svelte.d.ts +8 -0
- package/package/forms/RadioAnim1.svelte +2 -2
- package/package/forms/RadioAnim2.svelte +2 -2
- package/package/forms/RadioAnim3.svelte +2 -2
- package/package/forms/Slider.svelte +2 -2
- package/package/forms/SliderTicks.svelte +2 -2
- package/package/forms/Switch.svelte +6 -4
- package/package/forms/WavyLinearProgress.svelte +67 -0
- package/package/forms/WavyLinearProgress.svelte.d.ts +9 -0
- package/package/forms/WavyLinearProgressEstimate.svelte +82 -0
- package/package/forms/WavyLinearProgressEstimate.svelte.d.ts +9 -0
- package/package/forms/_picker/FocusPicker.svelte +5 -13
- package/package/forms/_picker/Header.svelte +8 -11
- package/package/forms/_picker/Item.svelte +9 -15
- package/package/forms/_wavy.d.ts +2 -0
- package/package/forms/_wavy.js +32 -0
- package/package/index.d.ts +5 -0
- package/package/index.js +5 -0
- package/package/misc/_ripple.svelte +9 -8
- package/package/misc/_ripplesimple.svelte +9 -8
- package/package/misc/colors.d.ts +4 -0
- package/package/misc/colors.js +24 -0
- package/package/misc/utils.d.ts +0 -4
- package/package/misc/utils.js +5 -57
- package/package/nav/NavCMLXItem.svelte +2 -2
- package/package/nav/Tabs.svelte +2 -2
- package/package/nav/TabsLink.svelte +2 -2
- package/package/nav/VariableTabs.svelte +5 -5
- package/package/nav/VariableTabsLink.svelte +1 -1
- package/package/utils/DateField.svelte +3 -11
- package/package.json +2 -2
|
@@ -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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
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:
|
|
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:
|
|
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);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount, untrack } from "svelte";
|
|
3
|
+
import { linear, trackOpacity } from "./_wavy";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
width = 600,
|
|
7
|
+
height = 10,
|
|
8
|
+
thickness = 4,
|
|
9
|
+
percent,
|
|
10
|
+
}: { width?: number; height?: number; thickness?: number; percent: number } = $props();
|
|
11
|
+
|
|
12
|
+
let time = $state(0);
|
|
13
|
+
|
|
14
|
+
let top = $derived(thickness * 0.5);
|
|
15
|
+
let bottom = $derived(height - thickness * 0.5);
|
|
16
|
+
let left = $derived(thickness * 0.5);
|
|
17
|
+
let right = $derived(width - thickness * 0.5);
|
|
18
|
+
let percentX = $derived((percent / 100) * (right - left) + left);
|
|
19
|
+
|
|
20
|
+
const getSMILData = (time: number) => {
|
|
21
|
+
let paths: string[] = [];
|
|
22
|
+
for (let x = 0; x <= 1000; x += 1000 / 30) {
|
|
23
|
+
paths.push(linear(top, bottom, left, percentX, time + x));
|
|
24
|
+
}
|
|
25
|
+
return paths.join(";");
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
onMount(() => {
|
|
29
|
+
let mounted = true;
|
|
30
|
+
const start = performance.now();
|
|
31
|
+
const update = () => {
|
|
32
|
+
if (!mounted) return;
|
|
33
|
+
|
|
34
|
+
time = performance.now() - start;
|
|
35
|
+
requestAnimationFrame(update);
|
|
36
|
+
};
|
|
37
|
+
update();
|
|
38
|
+
return () => (mounted = false);
|
|
39
|
+
});
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<svg viewBox="0 0 {width} {height}">
|
|
43
|
+
<path
|
|
44
|
+
fill="none"
|
|
45
|
+
stroke="rgb(var(--m3-scheme-primary))"
|
|
46
|
+
stroke-width={thickness}
|
|
47
|
+
stroke-linecap="round"
|
|
48
|
+
>
|
|
49
|
+
<animate
|
|
50
|
+
attributeName="d"
|
|
51
|
+
dur="1s"
|
|
52
|
+
repeatCount="indefinite"
|
|
53
|
+
values={getSMILData(untrack(() => time))}
|
|
54
|
+
/>
|
|
55
|
+
</path>
|
|
56
|
+
<line
|
|
57
|
+
fill="none"
|
|
58
|
+
stroke="rgb(var(--m3-scheme-secondary-container))"
|
|
59
|
+
stroke-width={thickness}
|
|
60
|
+
stroke-linecap="round"
|
|
61
|
+
x1={percentX + thickness + 4}
|
|
62
|
+
y1={height / 2}
|
|
63
|
+
x2={right}
|
|
64
|
+
y2={height / 2}
|
|
65
|
+
opacity={trackOpacity(right, percentX + thickness + 4)}
|
|
66
|
+
/>
|
|
67
|
+
</svg>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
width?: number;
|
|
3
|
+
height?: number;
|
|
4
|
+
thickness?: number;
|
|
5
|
+
percent: number;
|
|
6
|
+
};
|
|
7
|
+
declare const WavyLinearProgress: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type WavyLinearProgress = ReturnType<typeof WavyLinearProgress>;
|
|
9
|
+
export default WavyLinearProgress;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { linear, trackOpacity } from "./_wavy";
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
sToHalfway = 1,
|
|
6
|
+
width = 600,
|
|
7
|
+
height = 10,
|
|
8
|
+
thickness = 4,
|
|
9
|
+
}: { sToHalfway?: number; width?: number; height?: number; thickness?: number } = $props();
|
|
10
|
+
|
|
11
|
+
let top = $derived(thickness * 0.5);
|
|
12
|
+
let bottom = $derived(height - thickness * 0.5);
|
|
13
|
+
let left = $derived(thickness * 0.5);
|
|
14
|
+
let right = $derived(width - thickness * 0.5);
|
|
15
|
+
let endTime = $derived(sToHalfway * 8);
|
|
16
|
+
|
|
17
|
+
const expressiveSMIL = $derived.by(() => {
|
|
18
|
+
let paths: string[] = [];
|
|
19
|
+
|
|
20
|
+
for (let time = 0; time < endTime; time += 1 / 30) {
|
|
21
|
+
let value = 1 - Math.pow(0.5, time / sToHalfway);
|
|
22
|
+
if (value == 0) value = 0.001;
|
|
23
|
+
const ms = time * 1000;
|
|
24
|
+
paths.push(linear(top, bottom, left, right, ms, value * (right - left) + left));
|
|
25
|
+
}
|
|
26
|
+
return paths.join(";");
|
|
27
|
+
});
|
|
28
|
+
const infiniteSMIL = $derived.by(() => {
|
|
29
|
+
let paths: string[] = [];
|
|
30
|
+
for (let time = 0; time <= 1; time += 1 / 30) {
|
|
31
|
+
paths.push(linear(top, bottom, left, right, time * 1000));
|
|
32
|
+
}
|
|
33
|
+
return paths.join(";");
|
|
34
|
+
});
|
|
35
|
+
let { trackSMIL, opacitySMIL } = $derived.by(() => {
|
|
36
|
+
let xs: number[] = [];
|
|
37
|
+
let opacities: number[] = [];
|
|
38
|
+
|
|
39
|
+
for (let time = 0; time < endTime; time += 1 / 30) {
|
|
40
|
+
const value = 1 - Math.pow(0.5, time / sToHalfway);
|
|
41
|
+
const percentX = value * (right - left) + left;
|
|
42
|
+
const x = percentX + thickness + 4;
|
|
43
|
+
xs.push(x);
|
|
44
|
+
|
|
45
|
+
opacities.push(trackOpacity(right, x));
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
trackSMIL: xs.join(";"),
|
|
49
|
+
opacitySMIL: opacities.join(";"),
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<svg viewBox="0 0 {width} {height}">
|
|
55
|
+
<path
|
|
56
|
+
fill="none"
|
|
57
|
+
stroke="rgb(var(--m3-scheme-primary))"
|
|
58
|
+
stroke-width={thickness}
|
|
59
|
+
stroke-linecap="round"
|
|
60
|
+
>
|
|
61
|
+
<animate attributeName="d" dur="{endTime}s" values={expressiveSMIL} />
|
|
62
|
+
<animate
|
|
63
|
+
attributeName="d"
|
|
64
|
+
dur="1s"
|
|
65
|
+
begin="{endTime}s"
|
|
66
|
+
repeatCount="indefinite"
|
|
67
|
+
values={infiniteSMIL}
|
|
68
|
+
/>
|
|
69
|
+
</path>
|
|
70
|
+
<line
|
|
71
|
+
fill="none"
|
|
72
|
+
stroke="rgb(var(--m3-scheme-secondary-container))"
|
|
73
|
+
stroke-width={thickness}
|
|
74
|
+
stroke-linecap="round"
|
|
75
|
+
y1={height / 2}
|
|
76
|
+
x2={right}
|
|
77
|
+
y2={height / 2}
|
|
78
|
+
>
|
|
79
|
+
<animate attributeName="x1" dur="{endTime}s" values={trackSMIL} />
|
|
80
|
+
<animate attributeName="opacity" dur="{endTime}s" values={opacitySMIL} fill="freeze" />
|
|
81
|
+
</line>
|
|
82
|
+
</svg>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
sToHalfway?: number;
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
thickness?: number;
|
|
6
|
+
};
|
|
7
|
+
declare const WavyLinearProgressEstimate: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type WavyLinearProgressEstimate = ReturnType<typeof WavyLinearProgressEstimate>;
|
|
9
|
+
export default WavyLinearProgressEstimate;
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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(--
|
|
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:
|
|
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(--
|
|
60
|
-
|
|
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
|
-
|
|
58
|
+
color: rgb(var(--m3-scheme-on-primary));
|
|
65
59
|
}
|
|
66
60
|
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const frequencyT = (Math.PI * 2) / 1000;
|
|
2
|
+
const frequencyX = (Math.PI * 2) / 40;
|
|
3
|
+
const round2 = (x) => Math.round(x * 100) / 100;
|
|
4
|
+
const round1 = (x) => Math.round(x * 10) / 10;
|
|
5
|
+
export const linear = (t, b, from, to, time, cutoffTo) => {
|
|
6
|
+
time = time * frequencyT;
|
|
7
|
+
time %= Math.PI * 2;
|
|
8
|
+
if (from >= to)
|
|
9
|
+
return "";
|
|
10
|
+
let path = "";
|
|
11
|
+
for (let xIterator = from; xIterator <= to; xIterator += 0.5) {
|
|
12
|
+
const x = cutoffTo ? Math.min(cutoffTo, xIterator) : xIterator;
|
|
13
|
+
const sinV = (Math.sin(x * frequencyX + time) + 1) * 0.5;
|
|
14
|
+
const y = sinV * (t - b) + b;
|
|
15
|
+
if (x == from) {
|
|
16
|
+
path = `M ${round1(x)} ${round2(y)}`;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
path += ` ${round1(x)} ${round2(y)}`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return path;
|
|
23
|
+
};
|
|
24
|
+
export const trackOpacity = (right, x) => {
|
|
25
|
+
let opacity = right - x;
|
|
26
|
+
if (opacity < 0)
|
|
27
|
+
opacity = 0;
|
|
28
|
+
if (opacity > 1)
|
|
29
|
+
opacity = 1;
|
|
30
|
+
opacity = round2(opacity);
|
|
31
|
+
return opacity;
|
|
32
|
+
};
|
package/package/index.d.ts
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";
|
|
@@ -17,8 +18,12 @@ export { default as Snackbar } from "./containers/Snackbar.svelte";
|
|
|
17
18
|
export type { SnackbarIn } from "./containers/Snackbar.svelte";
|
|
18
19
|
export { default as SnackbarItem } from "./containers/SnackbarItem.svelte";
|
|
19
20
|
export { default as LinearProgress } from "./forms/LinearProgress.svelte";
|
|
21
|
+
export { default as LinearProgressEstimate } from "./forms/LinearProgressEstimate.svelte";
|
|
20
22
|
export { default as LinearProgressIndeterminate } from "./forms/LinearProgressIndeterminate.svelte";
|
|
23
|
+
export { default as WavyLinearProgress } from "./forms/WavyLinearProgress.svelte";
|
|
24
|
+
export { default as WavyLinearProgressEstimate } from "./forms/WavyLinearProgressEstimate.svelte";
|
|
21
25
|
export { default as CircularProgress } from "./forms/CircularProgress.svelte";
|
|
26
|
+
export { default as CircularProgressEstimate } from "./forms/CircularProgressEstimate.svelte";
|
|
22
27
|
export { default as CircularProgressIndeterminate } from "./forms/CircularProgressIndeterminate.svelte";
|
|
23
28
|
export { default as RadioAnim1 } from "./forms/RadioAnim1.svelte";
|
|
24
29
|
export { default as RadioAnim2 } from "./forms/RadioAnim2.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";
|
|
@@ -16,8 +17,12 @@ export { default as MenuItem } from "./containers/MenuItem.svelte";
|
|
|
16
17
|
export { default as Snackbar } from "./containers/Snackbar.svelte";
|
|
17
18
|
export { default as SnackbarItem } from "./containers/SnackbarItem.svelte";
|
|
18
19
|
export { default as LinearProgress } from "./forms/LinearProgress.svelte";
|
|
20
|
+
export { default as LinearProgressEstimate } from "./forms/LinearProgressEstimate.svelte";
|
|
19
21
|
export { default as LinearProgressIndeterminate } from "./forms/LinearProgressIndeterminate.svelte";
|
|
22
|
+
export { default as WavyLinearProgress } from "./forms/WavyLinearProgress.svelte";
|
|
23
|
+
export { default as WavyLinearProgressEstimate } from "./forms/WavyLinearProgressEstimate.svelte";
|
|
20
24
|
export { default as CircularProgress } from "./forms/CircularProgress.svelte";
|
|
25
|
+
export { default as CircularProgressEstimate } from "./forms/CircularProgressEstimate.svelte";
|
|
21
26
|
export { default as CircularProgressIndeterminate } from "./forms/CircularProgressIndeterminate.svelte";
|
|
22
27
|
export { default as RadioAnim1 } from "./forms/RadioAnim1.svelte";
|
|
23
28
|
export { default as RadioAnim2 } from "./forms/RadioAnim2.svelte";
|
|
@@ -157,19 +157,20 @@
|
|
|
157
157
|
|
|
158
158
|
background-color: currentColor;
|
|
159
159
|
opacity: 0;
|
|
160
|
-
transition: opacity
|
|
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(
|
|
171
|
-
&:
|
|
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
|
|
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(
|
|
25
|
-
&:
|
|
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,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
|
+
];
|
package/package/misc/utils.d.ts
CHANGED
|
@@ -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
|
* */
|