m3-svelte 6.0.4 → 7.0.1
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 +39 -33
- package/package/buttons/Button.svelte.d.ts +7 -5
- package/package/buttons/ConnectedButtons.svelte +0 -6
- package/package/buttons/FAB.svelte +1 -4
- package/package/buttons/SplitButton.svelte +3 -6
- package/package/containers/Card.svelte +4 -6
- package/package/containers/ListItem.svelte +25 -20
- package/package/containers/ListItem.svelte.d.ts +7 -6
- package/package/containers/MenuItem.svelte +3 -4
- package/package/containers/Snackbar.svelte +2 -5
- package/package/{misc → etc}/colors.d.ts +2 -2
- package/package/{misc → etc}/colors.js +28 -17
- package/package/etc/layer.css +38 -0
- package/package/etc/layer.d.ts +1 -0
- package/package/etc/layer.js +142 -0
- package/package/etc/recommended-styles.css +8 -0
- package/package/{misc → etc}/styles.css +73 -47
- package/package/{misc → etc}/tailwind-styles.css +0 -2
- package/package/forms/Checkbox.svelte +1 -3
- package/package/forms/Chip.svelte +22 -14
- package/package/forms/Chip.svelte.d.ts +5 -2
- package/package/forms/DateField.svelte +9 -5
- package/package/forms/DateFieldOutlined.svelte +9 -5
- package/package/forms/RadioAnim1.svelte +1 -3
- package/package/forms/RadioAnim2.svelte +1 -3
- package/package/forms/RadioAnim3.svelte +1 -3
- package/package/forms/Select.svelte +4 -7
- package/package/forms/SelectOutlined.svelte +2 -5
- package/package/forms/TextField.svelte +2 -5
- package/package/forms/TextFieldMultiline.svelte +2 -3
- package/package/forms/TextFieldOutlined.svelte +2 -5
- package/package/forms/TextFieldOutlinedMultiline.svelte +2 -3
- package/package/forms/_picker/FocusPicker.svelte +1 -4
- package/package/forms/_picker/Header.svelte +22 -30
- package/package/forms/_picker/Item.svelte +1 -5
- package/package/index.d.ts +3 -7
- package/package/index.js +3 -7
- package/package/misc/animation.js +5 -1
- package/package/misc/badge.js +1 -1
- package/package/misc/typing-utils.d.ts +14 -5
- package/package/nav/NavCMLXItem.svelte +7 -10
- package/package/nav/NavCMLXItem.svelte.d.ts +2 -2
- package/package/nav/Tabs.svelte +1 -4
- package/package/nav/TabsLink.svelte +7 -4
- package/package/nav/VariableTabs.svelte +1 -4
- package/package/nav/VariableTabsLink.svelte +1 -3
- package/package.json +35 -19
- package/package/buttons/TogglePrimitive.svelte +0 -22
- package/package/buttons/TogglePrimitive.svelte.d.ts +0 -11
- package/package/misc/Layer.svelte +0 -213
- package/package/misc/Layer.svelte.d.ts +0 -3
- package/package/misc/recommended-styles.css +0 -41
- package/package/misc/utils.d.ts +0 -3
- package/package/misc/utils.js +0 -37
- /package/package/{misc → etc}/unocss-preset.d.ts +0 -0
- /package/package/{misc → etc}/unocss-preset.js +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "m3-svelte",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"license": "Apache-2.0 OR GPL-3.0-only",
|
|
5
5
|
"repository": "KTibow/m3-svelte",
|
|
6
6
|
"author": {
|
|
@@ -21,34 +21,42 @@
|
|
|
21
21
|
"types": "./package/index.d.ts",
|
|
22
22
|
"svelte": "./package/index.js"
|
|
23
23
|
},
|
|
24
|
-
"./
|
|
25
|
-
"style": "./package/
|
|
24
|
+
"./etc/styles.css": {
|
|
25
|
+
"style": "./package/etc/styles.css"
|
|
26
26
|
},
|
|
27
|
-
"./
|
|
28
|
-
"style": "./package/
|
|
27
|
+
"./etc/recommended-styles.css": {
|
|
28
|
+
"style": "./package/etc/recommended-styles.css"
|
|
29
29
|
},
|
|
30
|
-
"./
|
|
31
|
-
"style": "./package/
|
|
30
|
+
"./etc/tailwind-styles.css": {
|
|
31
|
+
"style": "./package/etc/tailwind-styles.css"
|
|
32
32
|
},
|
|
33
|
-
"./
|
|
34
|
-
"types": "./package/
|
|
35
|
-
"import": "./package/
|
|
33
|
+
"./etc/unocss-preset": {
|
|
34
|
+
"types": "./package/etc/unocss-preset.d.ts",
|
|
35
|
+
"import": "./package/etc/unocss-preset.js"
|
|
36
|
+
},
|
|
37
|
+
"./etc/colors": {
|
|
38
|
+
"types": "./package/etc/colors.d.ts",
|
|
39
|
+
"import": "./package/etc/colors.js"
|
|
40
|
+
},
|
|
41
|
+
"./etc/layer": {
|
|
42
|
+
"types": "./package/etc/layer.d.ts",
|
|
43
|
+
"import": "./package/etc/layer.js"
|
|
36
44
|
}
|
|
37
45
|
},
|
|
38
46
|
"dependencies": {
|
|
39
47
|
"@iconify/types": "^2.0.0",
|
|
40
|
-
"@ktibow/iconset-material-symbols": "~0.0.1764827375"
|
|
41
|
-
"@ktibow/material-color-utilities-nightly": "^0.3.11763580498000"
|
|
48
|
+
"@ktibow/iconset-material-symbols": "~0.0.1764827375"
|
|
42
49
|
},
|
|
43
50
|
"devDependencies": {
|
|
44
51
|
"@eslint/compat": "^2.0.0",
|
|
45
52
|
"@eslint/js": "^9.39.2",
|
|
53
|
+
"@ktibow/material-color-utilities-nightly": "^0.3.11763580498000",
|
|
46
54
|
"@sveltejs/adapter-static": "^3.0.10",
|
|
47
|
-
"@sveltejs/kit": "^2.49.
|
|
55
|
+
"@sveltejs/kit": "^2.49.2",
|
|
48
56
|
"@sveltejs/package": "^2.5.7",
|
|
49
57
|
"@sveltejs/vite-plugin-svelte": "^6.2.1",
|
|
50
58
|
"@types/node": "^25.0.3",
|
|
51
|
-
"eslint": "^9.39.
|
|
59
|
+
"eslint": "^9.39.2",
|
|
52
60
|
"eslint-config-prettier": "^10.1.8",
|
|
53
61
|
"eslint-plugin-svelte": "^3.13.1",
|
|
54
62
|
"globals": "^16.5.0",
|
|
@@ -56,20 +64,26 @@
|
|
|
56
64
|
"prettier": "^3.7.4",
|
|
57
65
|
"prettier-plugin-svelte": "^3.4.1",
|
|
58
66
|
"publint": "^0.3.16",
|
|
59
|
-
"
|
|
67
|
+
"shiki": "^3.20.0",
|
|
68
|
+
"svelte": "^5.46.1",
|
|
60
69
|
"svelte-check": "^4.3.5",
|
|
61
|
-
"svelte-highlight": "^7.9.0",
|
|
62
70
|
"tinyglobby": "^0.2.15",
|
|
63
71
|
"typescript": "^5.9.3",
|
|
64
|
-
"typescript-eslint": "^8.
|
|
65
|
-
"unocss": "^66.5.
|
|
72
|
+
"typescript-eslint": "^8.51.0",
|
|
73
|
+
"unocss": "^66.5.12",
|
|
66
74
|
"vite": "^7.3.0",
|
|
67
75
|
"vite-plugin-functions-mixins": "^0.4.0",
|
|
68
76
|
"vite-plugin-token-shaker": "^0.0.3"
|
|
69
77
|
},
|
|
70
78
|
"peerDependencies": {
|
|
79
|
+
"@ktibow/material-color-utilities-nightly": "^0.3.11763580498000",
|
|
71
80
|
"svelte": "^5.40.0"
|
|
72
81
|
},
|
|
82
|
+
"peerDependenciesMeta": {
|
|
83
|
+
"@ktibow/material-color-utilities-nightly": {
|
|
84
|
+
"optional": true
|
|
85
|
+
}
|
|
86
|
+
},
|
|
73
87
|
"keywords": [
|
|
74
88
|
"svelte",
|
|
75
89
|
"material",
|
|
@@ -82,7 +96,9 @@
|
|
|
82
96
|
"ui-library",
|
|
83
97
|
"theming"
|
|
84
98
|
],
|
|
85
|
-
"sideEffects":
|
|
99
|
+
"sideEffects": [
|
|
100
|
+
"./package/etc/layer.js"
|
|
101
|
+
],
|
|
86
102
|
"scripts": {
|
|
87
103
|
"dev": "vite dev",
|
|
88
104
|
"build": "vite build",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Snippet } from "svelte";
|
|
3
|
-
import Button from "./Button.svelte";
|
|
4
|
-
|
|
5
|
-
let {
|
|
6
|
-
toggle = $bindable(),
|
|
7
|
-
variant,
|
|
8
|
-
round = false,
|
|
9
|
-
size,
|
|
10
|
-
children,
|
|
11
|
-
}: {
|
|
12
|
-
toggle: boolean;
|
|
13
|
-
variant?: "filled" | "tonal";
|
|
14
|
-
round?: boolean;
|
|
15
|
-
size?: "xs" | "s" | "m" | "l" | "xl";
|
|
16
|
-
children: Snippet;
|
|
17
|
-
} = $props();
|
|
18
|
-
const id = $props.id();
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<input type="checkbox" {id} bind:checked={toggle} />
|
|
22
|
-
<Button for={id} {variant} square={!round} {size} {children} />
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from "svelte";
|
|
2
|
-
type $$ComponentProps = {
|
|
3
|
-
toggle: boolean;
|
|
4
|
-
variant?: "filled" | "tonal";
|
|
5
|
-
round?: boolean;
|
|
6
|
-
size?: "xs" | "s" | "m" | "l" | "xl";
|
|
7
|
-
children: Snippet;
|
|
8
|
-
};
|
|
9
|
-
declare const TogglePrimitive: import("svelte").Component<$$ComponentProps, {}, "toggle">;
|
|
10
|
-
type TogglePrimitive = ReturnType<typeof TogglePrimitive>;
|
|
11
|
-
export default TogglePrimitive;
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
type Ripples = (() => void)[];
|
|
3
|
-
let pointerRipples: Ripples = $state([]);
|
|
4
|
-
let keyboardRipples: Ripples = $state([]);
|
|
5
|
-
|
|
6
|
-
const createRipple = (node: HTMLDivElement) => {
|
|
7
|
-
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
|
|
8
|
-
|
|
9
|
-
node.classList.remove("broken");
|
|
10
|
-
|
|
11
|
-
const parent = node.parentElement!;
|
|
12
|
-
|
|
13
|
-
const isEnabled = () => {
|
|
14
|
-
if (parent instanceof HTMLButtonElement) {
|
|
15
|
-
if (parent.disabled) return false;
|
|
16
|
-
}
|
|
17
|
-
if (parent instanceof HTMLLabelElement) {
|
|
18
|
-
const control = parent.control;
|
|
19
|
-
if (control instanceof HTMLInputElement && control.disabled) return false;
|
|
20
|
-
}
|
|
21
|
-
if (parent.classList.contains("layer-container")) {
|
|
22
|
-
const input = parent.previousElementSibling;
|
|
23
|
-
if (input instanceof HTMLInputElement && input.disabled) return false;
|
|
24
|
-
}
|
|
25
|
-
return true;
|
|
26
|
-
};
|
|
27
|
-
const ripple = (x: number, y: number, width: number, height: number) => {
|
|
28
|
-
const size = Math.hypot(Math.max(x, width - x), Math.max(y, height - y)) * 2.5;
|
|
29
|
-
const speed = Math.max(Math.min(Math.log(size) * 50, 600), 200);
|
|
30
|
-
|
|
31
|
-
const gradient = document.createElementNS("http://www.w3.org/2000/svg", "radialGradient");
|
|
32
|
-
gradient.id = `ripple-${Date.now()}`;
|
|
33
|
-
|
|
34
|
-
const stops = [
|
|
35
|
-
{ offset: "0%", opacity: "0.12" },
|
|
36
|
-
{ offset: "70%", opacity: "0.12" },
|
|
37
|
-
{ offset: "100%", opacity: "0" },
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
stops.forEach(({ offset, opacity }) => {
|
|
41
|
-
const stop = document.createElementNS("http://www.w3.org/2000/svg", "stop");
|
|
42
|
-
stop.setAttribute("offset", offset);
|
|
43
|
-
stop.setAttribute("stop-color", "currentColor");
|
|
44
|
-
stop.setAttribute("stop-opacity", opacity);
|
|
45
|
-
gradient.appendChild(stop);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
const circle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
49
|
-
circle.setAttribute("cx", `${size / 2}`);
|
|
50
|
-
circle.setAttribute("cy", `${size / 2}`);
|
|
51
|
-
circle.setAttribute("r", "0");
|
|
52
|
-
circle.setAttribute("fill", `url(#${gradient.id})`);
|
|
53
|
-
|
|
54
|
-
const expand = document.createElementNS("http://www.w3.org/2000/svg", "animate");
|
|
55
|
-
expand.setAttribute("attributeName", "r");
|
|
56
|
-
expand.setAttribute("from", "0");
|
|
57
|
-
expand.setAttribute("to", `${size / 2}`);
|
|
58
|
-
expand.setAttribute("dur", `${speed}ms`);
|
|
59
|
-
expand.setAttribute("fill", "freeze");
|
|
60
|
-
expand.setAttribute("calcMode", "spline");
|
|
61
|
-
expand.setAttribute("keySplines", "0.4 0, 0.2 1");
|
|
62
|
-
|
|
63
|
-
circle.appendChild(expand);
|
|
64
|
-
|
|
65
|
-
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
66
|
-
svg.style.cssText = [
|
|
67
|
-
"position: absolute",
|
|
68
|
-
`left: ${x - size / 2}px`,
|
|
69
|
-
`top: ${y - size / 2}px`,
|
|
70
|
-
`width: ${size}px`,
|
|
71
|
-
`height: ${size}px`,
|
|
72
|
-
"pointer-events: none",
|
|
73
|
-
"overflow: visible",
|
|
74
|
-
].join(";");
|
|
75
|
-
svg.appendChild(gradient);
|
|
76
|
-
svg.appendChild(circle);
|
|
77
|
-
|
|
78
|
-
const ua = navigator.userAgent;
|
|
79
|
-
const isFirefox = ua.includes("Firefox");
|
|
80
|
-
const isTrulySafari = !ua.includes("Chrome") && ua.includes("Safari");
|
|
81
|
-
if (!isFirefox && !isTrulySafari && size > 100) {
|
|
82
|
-
const filter = document.createElementNS("http://www.w3.org/2000/svg", "filter");
|
|
83
|
-
filter.id = `noise-${Date.now()}`;
|
|
84
|
-
|
|
85
|
-
const turb = document.createElementNS("http://www.w3.org/2000/svg", "feTurbulence");
|
|
86
|
-
turb.setAttribute("type", "fractalNoise");
|
|
87
|
-
turb.setAttribute("baseFrequency", "0.6");
|
|
88
|
-
turb.setAttribute("seed", Math.random().toString());
|
|
89
|
-
|
|
90
|
-
const blur = document.createElementNS("http://www.w3.org/2000/svg", "feDisplacementMap");
|
|
91
|
-
blur.setAttribute("in", "SourceGraphic");
|
|
92
|
-
blur.setAttribute("in2", "turbulence");
|
|
93
|
-
blur.setAttribute("scale", `${size ** 2 * 0.0002}`);
|
|
94
|
-
blur.setAttribute("xChannelSelector", "R");
|
|
95
|
-
blur.setAttribute("yChannelSelector", "B");
|
|
96
|
-
|
|
97
|
-
filter.appendChild(turb);
|
|
98
|
-
filter.appendChild(blur);
|
|
99
|
-
|
|
100
|
-
circle.setAttribute("filter", `url(#${filter.id})`);
|
|
101
|
-
svg.appendChild(filter);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
node.appendChild(svg);
|
|
105
|
-
|
|
106
|
-
return () => {
|
|
107
|
-
const fade = document.createElementNS("http://www.w3.org/2000/svg", "animate");
|
|
108
|
-
fade.setAttribute("attributeName", "opacity");
|
|
109
|
-
fade.setAttribute("from", "1");
|
|
110
|
-
fade.setAttribute("to", "0");
|
|
111
|
-
fade.setAttribute("dur", "800ms");
|
|
112
|
-
fade.setAttribute("fill", "freeze");
|
|
113
|
-
fade.setAttribute("calcMode", "spline");
|
|
114
|
-
fade.setAttribute("keySplines", "0.4 0, 0.2 1");
|
|
115
|
-
circle.appendChild(fade);
|
|
116
|
-
fade.beginElement();
|
|
117
|
-
setTimeout(() => svg.remove(), 800);
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
const pointerdown = (e: PointerEvent) => {
|
|
121
|
-
if (!isEnabled()) return;
|
|
122
|
-
if (e.button != 0) return;
|
|
123
|
-
|
|
124
|
-
const rect = parent.getBoundingClientRect();
|
|
125
|
-
const cancel = ripple(e.clientX - rect.left, e.clientY - rect.top, rect.width, rect.height);
|
|
126
|
-
pointerRipples.push(cancel);
|
|
127
|
-
};
|
|
128
|
-
const keydown = (e: KeyboardEvent) => {
|
|
129
|
-
if (!isEnabled()) return;
|
|
130
|
-
if (e.repeat) return;
|
|
131
|
-
|
|
132
|
-
const isActivate = e.key == "Enter" || (e.key == " " && parent.tagName == "BUTTON");
|
|
133
|
-
if (!isActivate) return;
|
|
134
|
-
|
|
135
|
-
const rect = parent.getBoundingClientRect();
|
|
136
|
-
const cancel = ripple(rect.width / 2, rect.height / 2, rect.width, rect.height);
|
|
137
|
-
keyboardRipples.push(cancel);
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
parent.addEventListener("pointerdown", pointerdown);
|
|
141
|
-
parent.addEventListener("keydown", keydown);
|
|
142
|
-
|
|
143
|
-
return {
|
|
144
|
-
destroy() {
|
|
145
|
-
parent.removeEventListener("pointerdown", pointerdown);
|
|
146
|
-
parent.removeEventListener("keydown", keydown);
|
|
147
|
-
},
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
</script>
|
|
151
|
-
|
|
152
|
-
<svelte:window
|
|
153
|
-
onpointerup={() => {
|
|
154
|
-
pointerRipples.forEach((cancel) => cancel());
|
|
155
|
-
pointerRipples = [];
|
|
156
|
-
}}
|
|
157
|
-
ondragend={() => {
|
|
158
|
-
pointerRipples.forEach((cancel) => cancel());
|
|
159
|
-
pointerRipples = [];
|
|
160
|
-
}}
|
|
161
|
-
onkeyup={() => {
|
|
162
|
-
keyboardRipples.forEach((cancel) => cancel());
|
|
163
|
-
keyboardRipples = [];
|
|
164
|
-
}}
|
|
165
|
-
/>
|
|
166
|
-
|
|
167
|
-
<div class="hitbox"></div>
|
|
168
|
-
<div class="ripple-container broken" use:createRipple></div>
|
|
169
|
-
<div class="tint"></div>
|
|
170
|
-
|
|
171
|
-
<style>
|
|
172
|
-
.hitbox {
|
|
173
|
-
position: absolute;
|
|
174
|
-
inset: 0;
|
|
175
|
-
}
|
|
176
|
-
.ripple-container {
|
|
177
|
-
position: absolute;
|
|
178
|
-
inset: 0;
|
|
179
|
-
border-radius: inherit;
|
|
180
|
-
pointer-events: none;
|
|
181
|
-
|
|
182
|
-
overflow: hidden;
|
|
183
|
-
}
|
|
184
|
-
.tint {
|
|
185
|
-
position: absolute;
|
|
186
|
-
inset: 0;
|
|
187
|
-
border-radius: inherit;
|
|
188
|
-
pointer-events: none;
|
|
189
|
-
|
|
190
|
-
background-color: currentColor;
|
|
191
|
-
opacity: 0;
|
|
192
|
-
transition: opacity var(--m3-easing-fast);
|
|
193
|
-
|
|
194
|
-
&:not(
|
|
195
|
-
:global(input:disabled + label) > *,
|
|
196
|
-
:global(input:disabled + .layer-container) > *,
|
|
197
|
-
:global(:disabled) > *
|
|
198
|
-
) {
|
|
199
|
-
@media (hover: hover) {
|
|
200
|
-
&:is(:global(:hover) > *, :global(:active) > *) {
|
|
201
|
-
opacity: 0.08;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
&:is(
|
|
205
|
-
:global(input:focus-visible + label) > *,
|
|
206
|
-
:global(:focus-visible) > *,
|
|
207
|
-
:global(:active) > .ripple-container.broken + *
|
|
208
|
-
) {
|
|
209
|
-
opacity: 0.12;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
</style>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
@layer tokens {
|
|
2
|
-
:root {
|
|
3
|
-
--m3-refocus: refocus-outward 0.6s cubic-bezier(0.14, 5.63, 0.4, 0.5) forwards;
|
|
4
|
-
}
|
|
5
|
-
}
|
|
6
|
-
:focus-visible:not(.focus-inset, .focus-none) {
|
|
7
|
-
animation: var(--m3-refocus);
|
|
8
|
-
outline: none;
|
|
9
|
-
}
|
|
10
|
-
:focus-visible:is(.focus-inset):not(.focus-none) {
|
|
11
|
-
animation: refocus-inward 0.6s cubic-bezier(0.14, 5.63, 0.4, 0.5) forwards;
|
|
12
|
-
outline: none;
|
|
13
|
-
}
|
|
14
|
-
:focus-visible.focus-none {
|
|
15
|
-
outline: none;
|
|
16
|
-
}
|
|
17
|
-
@keyframes refocus-outward {
|
|
18
|
-
0% {
|
|
19
|
-
box-shadow: 0 0 0 0px var(--m3c-secondary);
|
|
20
|
-
}
|
|
21
|
-
100% {
|
|
22
|
-
box-shadow: 0 0 0 3px var(--m3c-secondary);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
@keyframes refocus-inward {
|
|
26
|
-
0% {
|
|
27
|
-
box-shadow: inset 0 0 0 0px var(--m3c-secondary);
|
|
28
|
-
}
|
|
29
|
-
100% {
|
|
30
|
-
box-shadow: inset 0 0 0 3px var(--m3c-secondary);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
[placeholder]::placeholder {
|
|
35
|
-
color: --translucent(var(--m3c-on-surface), 0.5);
|
|
36
|
-
opacity: 1;
|
|
37
|
-
}
|
|
38
|
-
::selection {
|
|
39
|
-
background-color: var(--m3c-tertiary-container);
|
|
40
|
-
color: var(--m3c-on-tertiary-container);
|
|
41
|
-
}
|
package/package/misc/utils.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { type DynamicScheme } from "@ktibow/material-color-utilities-nightly";
|
|
2
|
-
export declare const genCSS: (light: DynamicScheme, dark: DynamicScheme, cs?: import("@ktibow/material-color-utilities-nightly").DynamicColor[]) => string;
|
|
3
|
-
export declare const parseSize: (size: string) => number;
|
package/package/misc/utils.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import {} from "@ktibow/material-color-utilities-nightly";
|
|
2
|
-
import { colors } from "./colors";
|
|
3
|
-
// default cs value is deprecated
|
|
4
|
-
export const genCSS = (light, dark, cs = colors) => {
|
|
5
|
-
const genColorVariable = (name, argb) => {
|
|
6
|
-
const kebabCase = name.replaceAll("_", "-");
|
|
7
|
-
const hex = argb.toString(16).slice(-6);
|
|
8
|
-
return ` --m3c-${kebabCase}: #${hex};`;
|
|
9
|
-
};
|
|
10
|
-
const lightColors = cs
|
|
11
|
-
.map((color) => genColorVariable(color.name, color.getArgb(light)))
|
|
12
|
-
.join("\n");
|
|
13
|
-
const darkColors = cs
|
|
14
|
-
.map((color) => genColorVariable(color.name, color.getArgb(dark)))
|
|
15
|
-
.join("\n");
|
|
16
|
-
return `@media (prefers-color-scheme: light) {
|
|
17
|
-
:root {
|
|
18
|
-
color-scheme: light;
|
|
19
|
-
}
|
|
20
|
-
:root, ::backdrop {
|
|
21
|
-
${lightColors}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
@media (prefers-color-scheme: dark) {
|
|
25
|
-
:root {
|
|
26
|
-
color-scheme: dark;
|
|
27
|
-
}
|
|
28
|
-
:root, ::backdrop {
|
|
29
|
-
${darkColors}
|
|
30
|
-
}
|
|
31
|
-
}`;
|
|
32
|
-
};
|
|
33
|
-
export const parseSize = (size) => (size.endsWith("px")
|
|
34
|
-
? +size.slice(0, -2)
|
|
35
|
-
: size.endsWith("rem")
|
|
36
|
-
? +size.slice(0, -3) * 16
|
|
37
|
-
: null) || 0;
|
|
File without changes
|
|
File without changes
|