m3-svelte 4.0.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.
- package/package/buttons/Button.svelte +18 -15
- package/package/buttons/Button.svelte.d.ts +1 -1
- 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 +1 -1
- package/package/forms/CircularProgressIndeterminate.svelte +1 -1
- package/package/forms/LinearProgress.svelte +1 -1
- 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/_picker/FocusPicker.svelte +5 -13
- package/package/forms/_picker/Header.svelte +8 -11
- package/package/forms/_picker/Item.svelte +9 -15
- package/package/index.d.ts +1 -2
- package/package/index.js +1 -2
- package/package/misc/_ripple.svelte +9 -12
- 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 +2 -5
- package/package/misc/utils.js +8 -60
- 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 +19 -20
- package/package/misc/StyleFromScheme.svelte +0 -18
- package/package/misc/StyleFromScheme.svelte.d.ts +0 -10
- package/package/misc/_styling.svelte +0 -26
- package/package/misc/_styling.svelte.d.ts +0 -9
- package/package/misc/serializeScheme.d.ts +0 -7
- package/package/misc/serializeScheme.js +0 -13
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
// If you want a toggle button, use `for` with an `<input>`.
|
|
11
11
|
type ActionProps =
|
|
12
|
-
| ({ click
|
|
12
|
+
| ({ click?: () => void; disabled?: boolean } & HTMLButtonAttributes)
|
|
13
13
|
| ({ href: string } & HTMLAnchorAttributes)
|
|
14
14
|
| ({ for: string } & HTMLLabelAttributes);
|
|
15
15
|
type Props = {
|
|
@@ -22,26 +22,24 @@
|
|
|
22
22
|
let props: Props = $props();
|
|
23
23
|
</script>
|
|
24
24
|
|
|
25
|
-
{#if "
|
|
25
|
+
{#if "for" in props}
|
|
26
26
|
{@const {
|
|
27
27
|
variant = "filled",
|
|
28
|
-
|
|
29
|
-
disabled,
|
|
28
|
+
for: forItem,
|
|
30
29
|
square = false,
|
|
31
30
|
iconType = "none",
|
|
32
31
|
children,
|
|
33
32
|
...extra
|
|
34
33
|
} = props}
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
{disabled}
|
|
34
|
+
<label
|
|
35
|
+
for={forItem}
|
|
38
36
|
class="m3-container m3-font-label-large {variant} icon-{iconType}"
|
|
39
37
|
class:square
|
|
40
38
|
{...extra}
|
|
41
39
|
>
|
|
42
40
|
<Layer />
|
|
43
41
|
{@render children()}
|
|
44
|
-
</
|
|
42
|
+
</label>
|
|
45
43
|
{:else if "href" in props}
|
|
46
44
|
{@const {
|
|
47
45
|
variant = "filled",
|
|
@@ -63,21 +61,23 @@
|
|
|
63
61
|
{:else}
|
|
64
62
|
{@const {
|
|
65
63
|
variant = "filled",
|
|
66
|
-
|
|
64
|
+
click,
|
|
65
|
+
disabled,
|
|
67
66
|
square = false,
|
|
68
67
|
iconType = "none",
|
|
69
68
|
children,
|
|
70
69
|
...extra
|
|
71
70
|
} = props}
|
|
72
|
-
<
|
|
73
|
-
|
|
71
|
+
<button
|
|
72
|
+
onclick={click}
|
|
73
|
+
{disabled}
|
|
74
74
|
class="m3-container m3-font-label-large {variant} icon-{iconType}"
|
|
75
75
|
class:square
|
|
76
76
|
{...extra}
|
|
77
77
|
>
|
|
78
78
|
<Layer />
|
|
79
79
|
{@render children()}
|
|
80
|
-
</
|
|
80
|
+
</button>
|
|
81
81
|
{/if}
|
|
82
82
|
|
|
83
83
|
<style>
|
|
@@ -92,7 +92,10 @@
|
|
|
92
92
|
gap: 0.5rem;
|
|
93
93
|
padding: 0 1rem;
|
|
94
94
|
border-radius: var(--m3-button-shape);
|
|
95
|
-
transition:
|
|
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-
|
|
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));
|
|
@@ -170,7 +173,7 @@
|
|
|
170
173
|
&:is(:global(input:checked) + label):not(.square) {
|
|
171
174
|
border-radius: var(--m3-util-rounding-medium);
|
|
172
175
|
}
|
|
173
|
-
&:
|
|
176
|
+
&:active {
|
|
174
177
|
border-radius: var(--m3-util-rounding-small) !important;
|
|
175
178
|
}
|
|
176
179
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HTMLButtonAttributes, HTMLAnchorAttributes, HTMLLabelAttributes } from "svelte/elements";
|
|
2
2
|
import type { Snippet } from "svelte";
|
|
3
3
|
type ActionProps = ({
|
|
4
|
-
click
|
|
4
|
+
click?: () => void;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
} & HTMLButtonAttributes) | ({
|
|
7
7
|
href: string;
|
|
@@ -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
|
-
|
|
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
|
-
|
|
107
|
+
color: var(--m3-scheme-inverse-primary);
|
|
107
108
|
padding: 0 0.5rem;
|
|
108
109
|
}
|
|
109
110
|
.close {
|
|
110
|
-
|
|
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:
|
|
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:
|
|
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
|
|
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
|
|
91
|
+
transition: stroke-dashoffset var(--m3-util-easing-slow);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -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);
|
|
@@ -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>
|
package/package/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
export { default as StyleFromScheme } from "./misc/StyleFromScheme.svelte";
|
|
2
1
|
export { default as Icon } from "./misc/_icon.svelte";
|
|
3
2
|
export { default as Layer } from "./misc/Layer.svelte";
|
|
4
3
|
export * from "./misc/animation.js";
|
|
4
|
+
export * from "./misc/colors.js";
|
|
5
5
|
export * from "./misc/utils.js";
|
|
6
6
|
export * from "./misc/easing.js";
|
|
7
|
-
export * from "./misc/serializeScheme.js";
|
|
8
7
|
export { default as Button } from "./buttons/Button.svelte";
|
|
9
8
|
export { default as ConnectedButtons } from "./buttons/ConnectedButtons.svelte";
|
|
10
9
|
export { default as FAB } from "./buttons/FAB.svelte";
|
package/package/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
export { default as StyleFromScheme } from "./misc/StyleFromScheme.svelte";
|
|
2
1
|
export { default as Icon } from "./misc/_icon.svelte";
|
|
3
2
|
export { default as Layer } from "./misc/Layer.svelte";
|
|
4
3
|
export * from "./misc/animation.js";
|
|
4
|
+
export * from "./misc/colors.js";
|
|
5
5
|
export * from "./misc/utils.js";
|
|
6
6
|
export * from "./misc/easing.js";
|
|
7
|
-
export * from "./misc/serializeScheme.js";
|
|
8
7
|
export { default as Button } from "./buttons/Button.svelte";
|
|
9
8
|
export { default as ConnectedButtons } from "./buttons/ConnectedButtons.svelte";
|
|
10
9
|
export { default as FAB } from "./buttons/FAB.svelte";
|
|
@@ -101,8 +101,6 @@
|
|
|
101
101
|
|
|
102
102
|
node.appendChild(svg);
|
|
103
103
|
|
|
104
|
-
parent.classList.toggle("activated", true);
|
|
105
|
-
|
|
106
104
|
cancelRipples.push(() => {
|
|
107
105
|
const fade = document.createElementNS("http://www.w3.org/2000/svg", "animate");
|
|
108
106
|
fade.setAttribute("attributeName", "opacity");
|
|
@@ -115,8 +113,6 @@
|
|
|
115
113
|
circle.appendChild(fade);
|
|
116
114
|
fade.beginElement();
|
|
117
115
|
setTimeout(() => svg.remove(), 800);
|
|
118
|
-
|
|
119
|
-
parent.classList.toggle("activated", false);
|
|
120
116
|
});
|
|
121
117
|
};
|
|
122
118
|
|
|
@@ -161,19 +157,20 @@
|
|
|
161
157
|
|
|
162
158
|
background-color: currentColor;
|
|
163
159
|
opacity: 0;
|
|
164
|
-
transition: opacity
|
|
165
|
-
}
|
|
160
|
+
transition: opacity var(--m3-util-easing-fast);
|
|
166
161
|
|
|
167
|
-
:global(:not(input:disabled + label, input:disabled + .layer-container, :disabled)) {
|
|
168
162
|
@media (hover: hover) {
|
|
169
|
-
&: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
|
+
) {
|
|
170
168
|
opacity: 0.08;
|
|
171
169
|
}
|
|
172
170
|
}
|
|
173
|
-
|
|
174
|
-
&:is(:global(
|
|
175
|
-
&:
|
|
176
|
-
&: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) {
|
|
177
174
|
opacity: 0.12;
|
|
178
175
|
}
|
|
179
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,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export type SerializedScheme = Record<Color, number>;
|
|
3
|
-
export declare const pairs: string[][];
|
|
4
|
-
export declare const colors: Color[];
|
|
1
|
+
import { type DynamicScheme } from "@ktibow/material-color-utilities-nightly";
|
|
5
2
|
/**
|
|
6
3
|
* @returns A string of CSS code with custom properties representing the color scheme values.
|
|
7
4
|
* */
|
|
8
|
-
export declare const genCSS: (light:
|
|
5
|
+
export declare const genCSS: (light: DynamicScheme, dark: DynamicScheme) => string;
|
|
9
6
|
export declare const parseSize: (size: string) => number;
|
package/package/misc/utils.js
CHANGED
|
@@ -1,74 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
["primaryContainer", "onPrimaryContainer"],
|
|
4
|
-
["secondary", "onSecondary"],
|
|
5
|
-
["secondaryContainer", "onSecondaryContainer"],
|
|
6
|
-
["tertiary", "onTertiary"],
|
|
7
|
-
["tertiaryContainer", "onTertiaryContainer"],
|
|
8
|
-
["background", "onBackground"],
|
|
9
|
-
["surface", "onSurface"],
|
|
10
|
-
["inverseSurface", "inverseOnSurface"],
|
|
11
|
-
["surfaceVariant", "onSurfaceVariant"],
|
|
12
|
-
["error", "onError"],
|
|
13
|
-
["errorContainer", "onErrorContainer"],
|
|
14
|
-
];
|
|
15
|
-
export const colors = [
|
|
16
|
-
"primary",
|
|
17
|
-
"onPrimary",
|
|
18
|
-
"primaryContainer",
|
|
19
|
-
"onPrimaryContainer",
|
|
20
|
-
"inversePrimary",
|
|
21
|
-
"secondary",
|
|
22
|
-
"onSecondary",
|
|
23
|
-
"secondaryContainer",
|
|
24
|
-
"onSecondaryContainer",
|
|
25
|
-
"tertiary",
|
|
26
|
-
"onTertiary",
|
|
27
|
-
"tertiaryContainer",
|
|
28
|
-
"onTertiaryContainer",
|
|
29
|
-
"error",
|
|
30
|
-
"onError",
|
|
31
|
-
"errorContainer",
|
|
32
|
-
"onErrorContainer",
|
|
33
|
-
"background",
|
|
34
|
-
"onBackground",
|
|
35
|
-
"surface",
|
|
36
|
-
"onSurface",
|
|
37
|
-
"surfaceVariant",
|
|
38
|
-
"onSurfaceVariant",
|
|
39
|
-
"inverseSurface",
|
|
40
|
-
"inverseOnSurface",
|
|
41
|
-
"outline",
|
|
42
|
-
"outlineVariant",
|
|
43
|
-
"shadow",
|
|
44
|
-
"scrim",
|
|
45
|
-
"surfaceDim",
|
|
46
|
-
"surfaceBright",
|
|
47
|
-
"surfaceContainerLowest",
|
|
48
|
-
"surfaceContainerLow",
|
|
49
|
-
"surfaceContainer",
|
|
50
|
-
"surfaceContainerHigh",
|
|
51
|
-
"surfaceContainerHighest",
|
|
52
|
-
"surfaceTint",
|
|
53
|
-
];
|
|
1
|
+
import {} from "@ktibow/material-color-utilities-nightly";
|
|
2
|
+
import { colors } from "./colors";
|
|
54
3
|
/**
|
|
55
4
|
* @returns A string of CSS code with custom properties representing the color scheme values.
|
|
56
5
|
* */
|
|
57
6
|
export const genCSS = (light, dark) => {
|
|
58
7
|
const genColorVariable = (name, argb) => {
|
|
59
|
-
const kebabCase = name.
|
|
8
|
+
const kebabCase = name.replaceAll("_", "-");
|
|
60
9
|
const red = (argb >> 16) & 255;
|
|
61
10
|
const green = (argb >> 8) & 255;
|
|
62
11
|
const blue = argb & 255;
|
|
63
12
|
return `--m3-scheme-${kebabCase}: ${red} ${green} ${blue};`;
|
|
64
13
|
};
|
|
65
|
-
const lightColors =
|
|
66
|
-
.map((
|
|
14
|
+
const lightColors = colors
|
|
15
|
+
.map((color) => genColorVariable(color.name, color.getArgb(light)))
|
|
67
16
|
.join("\n");
|
|
68
|
-
const darkColors =
|
|
69
|
-
.map((
|
|
17
|
+
const darkColors = colors
|
|
18
|
+
.map((color) => genColorVariable(color.name, color.getArgb(dark)))
|
|
70
19
|
.join("\n");
|
|
71
|
-
|
|
20
|
+
return `@media (prefers-color-scheme: light) {
|
|
72
21
|
:root {
|
|
73
22
|
color-scheme: light;
|
|
74
23
|
}
|
|
@@ -84,7 +33,6 @@ ${lightColors}
|
|
|
84
33
|
${darkColors}
|
|
85
34
|
}
|
|
86
35
|
}`;
|
|
87
|
-
return colors;
|
|
88
36
|
};
|
|
89
37
|
export const parseSize = (size) => (size.endsWith("px")
|
|
90
38
|
? +size.slice(0, -2)
|
|
@@ -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:
|
|
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:
|
|
112
|
+
transition: var(--m3-util-easing);
|
|
113
113
|
}
|
|
114
114
|
.icon::before {
|
|
115
115
|
position: absolute;
|
package/package/nav/Tabs.svelte
CHANGED
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
user-select: none;
|
|
72
72
|
-webkit-tap-highlight-color: transparent;
|
|
73
73
|
cursor: pointer;
|
|
74
|
-
transition:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
48
|
-
easing: "
|
|
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:
|
|
63
|
-
easing: "
|
|
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:
|
|
135
|
+
transition: color var(--m3-util-easing-fast);
|
|
136
136
|
}
|
|
137
137
|
label > :global(svg) {
|
|
138
138
|
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.
|
|
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,30 +30,29 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@iconify/types": "^2.0.0",
|
|
32
32
|
"@ktibow/iconset-material-symbols": "^0.0.1747426012",
|
|
33
|
-
"@
|
|
34
|
-
"svelte": "^5.
|
|
33
|
+
"@ktibow/material-color-utilities-nightly": "^0.3.11748742074820",
|
|
34
|
+
"svelte": "^5.33.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@eslint/compat": "^1.2.
|
|
38
|
-
"@eslint/js": "^9.
|
|
37
|
+
"@eslint/compat": "^1.2.9",
|
|
38
|
+
"@eslint/js": "^9.27.0",
|
|
39
39
|
"@sveltejs/adapter-static": "^3.0.8",
|
|
40
|
-
"@sveltejs/kit": "^2.
|
|
41
|
-
"@sveltejs/package": "^2.
|
|
42
|
-
"@sveltejs/vite-plugin-svelte": "^5.0.
|
|
43
|
-
"eslint": "^9.
|
|
44
|
-
"eslint-config-prettier": "^10.
|
|
45
|
-
"eslint-plugin-svelte": "^3.
|
|
40
|
+
"@sveltejs/kit": "^2.21.1",
|
|
41
|
+
"@sveltejs/package": "^2.3.11",
|
|
42
|
+
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
|
43
|
+
"eslint": "^9.27.0",
|
|
44
|
+
"eslint-config-prettier": "^10.1.5",
|
|
45
|
+
"eslint-plugin-svelte": "^3.9.0",
|
|
46
46
|
"fast-glob": "^3.3.3",
|
|
47
|
-
"globals": "^16.
|
|
48
|
-
"prettier": "^3.
|
|
49
|
-
"prettier-plugin-svelte": "^3.
|
|
50
|
-
"publint": "^0.3.
|
|
51
|
-
"svelte": "^
|
|
52
|
-
"svelte-check": "^4.0.0",
|
|
47
|
+
"globals": "^16.2.0",
|
|
48
|
+
"prettier": "^3.5.3",
|
|
49
|
+
"prettier-plugin-svelte": "^3.4.0",
|
|
50
|
+
"publint": "^0.3.12",
|
|
51
|
+
"svelte-check": "^4.2.1",
|
|
53
52
|
"svelte-highlight": "^7.8.3",
|
|
54
|
-
"typescript": "^5.
|
|
55
|
-
"typescript-eslint": "^8.
|
|
56
|
-
"vite": "^6.
|
|
53
|
+
"typescript": "^5.8.3",
|
|
54
|
+
"typescript-eslint": "^8.32.1",
|
|
55
|
+
"vite": "^6.3.5"
|
|
57
56
|
},
|
|
58
57
|
"keywords": [
|
|
59
58
|
"svelte",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@component
|
|
3
|
-
@deprecated Directly set styles instead
|
|
4
|
-
-->
|
|
5
|
-
<script lang="ts">
|
|
6
|
-
import type { SerializedScheme } from "./utils";
|
|
7
|
-
import Styling from "./_styling.svelte";
|
|
8
|
-
import "./styles.css";
|
|
9
|
-
|
|
10
|
-
interface Props {
|
|
11
|
-
lightScheme: SerializedScheme;
|
|
12
|
-
darkScheme: SerializedScheme;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
let { lightScheme, darkScheme }: Props = $props();
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<Styling {lightScheme} {darkScheme} />
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { SerializedScheme } from "./utils";
|
|
2
|
-
import "./styles.css";
|
|
3
|
-
interface Props {
|
|
4
|
-
lightScheme: SerializedScheme;
|
|
5
|
-
darkScheme: SerializedScheme;
|
|
6
|
-
}
|
|
7
|
-
/** @deprecated Directly set styles instead */
|
|
8
|
-
declare const StyleFromScheme: import("svelte").Component<Props, {}, "">;
|
|
9
|
-
type StyleFromScheme = ReturnType<typeof StyleFromScheme>;
|
|
10
|
-
export default StyleFromScheme;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@component
|
|
3
|
-
@deprecated Directly set styles instead
|
|
4
|
-
-->
|
|
5
|
-
<script lang="ts">
|
|
6
|
-
import { genCSS, type SerializedScheme } from "./utils";
|
|
7
|
-
|
|
8
|
-
interface Props {
|
|
9
|
-
lightScheme: SerializedScheme;
|
|
10
|
-
darkScheme: SerializedScheme;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
let { lightScheme, darkScheme }: Props = $props();
|
|
14
|
-
const hexCode = (argb: number) => "#" + ((argb & 0xffffff) + 0x1000000).toString(16).slice(1);
|
|
15
|
-
let styling = $derived(genCSS(lightScheme, darkScheme));
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<svelte:head>
|
|
19
|
-
<meta name="theme-color" content={hexCode(lightScheme["primary"])} />
|
|
20
|
-
<meta
|
|
21
|
-
name="theme-color"
|
|
22
|
-
media="(prefers-color-scheme: dark)"
|
|
23
|
-
content={hexCode(darkScheme["primary"])}
|
|
24
|
-
/>
|
|
25
|
-
</svelte:head>
|
|
26
|
-
{@html `<${""}style>${styling}</${""}style>`}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type SerializedScheme } from "./utils";
|
|
2
|
-
interface Props {
|
|
3
|
-
lightScheme: SerializedScheme;
|
|
4
|
-
darkScheme: SerializedScheme;
|
|
5
|
-
}
|
|
6
|
-
/** @deprecated Directly set styles instead */
|
|
7
|
-
declare const Styling: import("svelte").Component<Props, {}, "">;
|
|
8
|
-
type Styling = ReturnType<typeof Styling>;
|
|
9
|
-
export default Styling;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type DynamicScheme } from "@material/material-color-utilities";
|
|
2
|
-
import { type SerializedScheme } from "./utils";
|
|
3
|
-
/**
|
|
4
|
-
* @description Serializes the {@link DynamicScheme} so that it can be used by {@link StyleFromScheme} and {@link genCSS}.
|
|
5
|
-
* @param scheme The theme generated by material-color-utils.
|
|
6
|
-
* */
|
|
7
|
-
export declare const serializeScheme: (scheme: DynamicScheme) => SerializedScheme;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { MaterialDynamicColors } from "@material/material-color-utilities";
|
|
2
|
-
import { colors } from "./utils";
|
|
3
|
-
/**
|
|
4
|
-
* @description Serializes the {@link DynamicScheme} so that it can be used by {@link StyleFromScheme} and {@link genCSS}.
|
|
5
|
-
* @param scheme The theme generated by material-color-utils.
|
|
6
|
-
* */
|
|
7
|
-
export const serializeScheme = (scheme) => {
|
|
8
|
-
const out = {};
|
|
9
|
-
for (const color of colors) {
|
|
10
|
-
out[color] = MaterialDynamicColors[color].getArgb(scheme);
|
|
11
|
-
}
|
|
12
|
-
return out;
|
|
13
|
-
};
|