m3-svelte 3.6.1 → 4.0.0-beta.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 +142 -78
- package/package/buttons/Button.svelte.d.ts +17 -34
- package/package/buttons/ConnectedButtons.svelte +26 -0
- package/package/buttons/ConnectedButtons.svelte.d.ts +8 -0
- package/package/buttons/FAB.svelte +30 -15
- package/package/buttons/FAB.svelte.d.ts +14 -25
- package/package/containers/BottomSheet.svelte +33 -27
- package/package/containers/BottomSheet.svelte.d.ts +7 -21
- package/package/containers/Card.svelte +45 -14
- package/package/containers/Card.svelte.d.ts +10 -30
- package/package/containers/Dialog.svelte +46 -32
- package/package/containers/Dialog.svelte.d.ts +9 -34
- package/package/containers/ListItem.svelte +78 -14
- package/package/containers/ListItem.svelte.d.ts +14 -25
- package/package/containers/Menu.svelte +6 -3
- package/package/containers/Menu.svelte.d.ts +6 -28
- package/package/containers/MenuItem.svelte +15 -5
- package/package/containers/MenuItem.svelte.d.ts +7 -29
- package/package/containers/Snackbar.svelte +35 -37
- package/package/containers/Snackbar.svelte.d.ts +7 -22
- package/package/containers/SnackbarItem.svelte +6 -6
- package/package/containers/SnackbarItem.svelte.d.ts +6 -29
- package/package/containers/StandardSideSheet.svelte +14 -8
- package/package/containers/StandardSideSheet.svelte.d.ts +7 -30
- package/package/forms/Checkbox.svelte +19 -4
- package/package/forms/Checkbox.svelte.d.ts +6 -29
- package/package/forms/Chip.svelte +41 -29
- package/package/forms/Chip.svelte.d.ts +18 -41
- package/package/forms/CircularProgress.svelte +4 -6
- package/package/forms/CircularProgress.svelte.d.ts +4 -20
- package/package/forms/CircularProgressIndeterminate.svelte +3 -4
- package/package/forms/CircularProgressIndeterminate.svelte.d.ts +2 -20
- package/package/forms/DatePickerDocked.svelte +52 -35
- package/package/forms/DatePickerDocked.svelte.d.ts +6 -22
- package/package/forms/LinearProgress.svelte +10 -5
- package/package/forms/LinearProgress.svelte.d.ts +4 -20
- package/package/forms/LinearProgressIndeterminate.svelte +4 -3
- package/package/forms/LinearProgressIndeterminate.svelte.d.ts +2 -20
- package/package/forms/RadioAnim1.svelte +10 -4
- package/package/forms/RadioAnim1.svelte.d.ts +6 -29
- package/package/forms/RadioAnim2.svelte +10 -4
- package/package/forms/RadioAnim2.svelte.d.ts +6 -29
- package/package/forms/RadioAnim3.svelte +10 -4
- package/package/forms/RadioAnim3.svelte.d.ts +6 -29
- package/package/forms/Slider.svelte +32 -26
- package/package/forms/Slider.svelte.d.ts +5 -21
- package/package/forms/SliderTicks.svelte +40 -33
- package/package/forms/SliderTicks.svelte.d.ts +5 -21
- package/package/forms/Switch.svelte +23 -21
- package/package/forms/Switch.svelte.d.ts +5 -22
- package/package/forms/TextField.svelte +36 -19
- package/package/forms/TextField.svelte.d.ts +14 -27
- package/package/forms/TextFieldMultiline.svelte +21 -21
- package/package/forms/TextFieldMultiline.svelte.d.ts +6 -23
- package/package/forms/TextFieldOutlined.svelte +36 -18
- package/package/forms/TextFieldOutlined.svelte.d.ts +14 -26
- package/package/forms/TextFieldOutlinedMultiline.svelte +21 -21
- package/package/forms/TextFieldOutlinedMultiline.svelte.d.ts +6 -23
- package/package/forms/_picker/Actions.svelte +16 -18
- package/package/forms/_picker/Actions.svelte.d.ts +7 -22
- package/package/forms/_picker/CalendarPicker.svelte +14 -4
- package/package/forms/_picker/CalendarPicker.svelte.d.ts +4 -18
- package/package/forms/_picker/FocusPicker.svelte +8 -9
- package/package/forms/_picker/FocusPicker.svelte.d.ts +5 -21
- package/package/forms/_picker/Header.svelte +20 -9
- package/package/forms/_picker/Header.svelte.d.ts +4 -18
- package/package/forms/_picker/Item.svelte +15 -6
- package/package/forms/_picker/Item.svelte.d.ts +8 -23
- package/package/index.d.ts +3 -9
- package/package/index.js +1 -8
- package/package/misc/Layer.svelte +7 -3
- package/package/misc/Layer.svelte.d.ts +5 -17
- package/package/misc/StyleFromScheme.svelte +6 -2
- package/package/misc/StyleFromScheme.svelte.d.ts +5 -19
- package/package/misc/_icon.svelte +12 -5
- package/package/misc/_icon.svelte.d.ts +5 -19
- package/package/misc/_ripple.svelte +11 -3
- package/package/misc/_ripple.svelte.d.ts +5 -17
- package/package/misc/_ripplesimple.svelte +4 -0
- package/package/misc/_ripplesimple.svelte.d.ts +5 -25
- package/package/misc/_styling.svelte +7 -3
- package/package/misc/_styling.svelte.d.ts +5 -19
- package/package/misc/animation.js +1 -5
- package/package/misc/easing.js +1 -28
- package/package/misc/styles.css +135 -107
- package/package/misc/utils.d.ts +1 -0
- package/package/misc/utils.js +5 -0
- package/package/nav/NavDrawer.svelte +9 -5
- package/package/nav/NavDrawer.svelte.d.ts +6 -30
- package/package/nav/NavDrawerButton.svelte +22 -12
- package/package/nav/NavDrawerButton.svelte.d.ts +8 -31
- package/package/nav/NavDrawerLink.svelte +21 -12
- package/package/nav/NavDrawerLink.svelte.d.ts +8 -30
- package/package/nav/NavList.svelte +13 -9
- package/package/nav/NavList.svelte.d.ts +7 -31
- package/package/nav/NavListButton.svelte +26 -22
- package/package/nav/NavListButton.svelte.d.ts +9 -33
- package/package/nav/NavListLink.svelte +26 -23
- package/package/nav/NavListLink.svelte.d.ts +9 -32
- package/package/nav/Tabs.svelte +20 -19
- package/package/nav/Tabs.svelte.d.ts +5 -22
- package/package/nav/TabsLink.svelte +22 -18
- package/package/nav/TabsLink.svelte.d.ts +5 -22
- package/package/nav/VariableTabs.svelte +25 -20
- package/package/nav/VariableTabs.svelte.d.ts +5 -22
- package/package/nav/VariableTabsLink.svelte +29 -22
- package/package/nav/VariableTabsLink.svelte.d.ts +5 -22
- package/package/utils/ChipChooser.svelte +10 -4
- package/package/utils/ChipChooser.svelte.d.ts +5 -19
- package/package/utils/DateField.svelte +24 -18
- package/package/utils/DateField.svelte.d.ts +4 -19
- package/package/utils/Divider.svelte +5 -1
- package/package/utils/Divider.svelte.d.ts +4 -18
- package/package.json +44 -43
- package/package/buttons/ButtonLink.svelte +0 -116
- package/package/buttons/ButtonLink.svelte.d.ts +0 -34
- package/package/buttons/SegmentedButtonContainer.svelte +0 -27
- package/package/buttons/SegmentedButtonContainer.svelte.d.ts +0 -31
- package/package/buttons/SegmentedButtonItem.svelte +0 -119
- package/package/buttons/SegmentedButtonItem.svelte.d.ts +0 -34
- package/package/containers/CardClickable.svelte +0 -78
- package/package/containers/CardClickable.svelte.d.ts +0 -34
- package/package/containers/ListItemButton.svelte +0 -86
- package/package/containers/ListItemButton.svelte.d.ts +0 -31
- package/package/containers/ListItemLabel.svelte +0 -82
- package/package/containers/ListItemLabel.svelte.d.ts +0 -29
- package/package/containers/SnackbarAnim.svelte +0 -127
- package/package/containers/SnackbarAnim.svelte.d.ts +0 -33
- package/package/forms/CheckboxAnim.svelte +0 -116
- package/package/forms/CheckboxAnim.svelte.d.ts +0 -31
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const Layer: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
-
[evt: string]: CustomEvent<any>;
|
|
16
|
-
}, {}, {}, string>;
|
|
17
|
-
type Layer = InstanceType<typeof Layer>;
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
morph?: boolean;
|
|
3
|
+
};
|
|
4
|
+
declare const Layer: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
5
|
+
type Layer = ReturnType<typeof Layer>;
|
|
18
6
|
export default Layer;
|
|
@@ -7,8 +7,12 @@
|
|
|
7
7
|
import Styling from "./_styling.svelte";
|
|
8
8
|
import "./styles.css";
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
interface Props {
|
|
11
|
+
lightScheme: SerializedScheme;
|
|
12
|
+
darkScheme: SerializedScheme;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let { lightScheme, darkScheme }: Props = $props();
|
|
12
16
|
</script>
|
|
13
17
|
|
|
14
18
|
<Styling {lightScheme} {darkScheme} />
|
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
import type { SerializedScheme } from "./utils";
|
|
2
2
|
import "./styles.css";
|
|
3
|
-
interface
|
|
4
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
5
|
-
$$bindings?: Bindings;
|
|
6
|
-
} & Exports;
|
|
7
|
-
(internal: unknown, props: Props & {
|
|
8
|
-
$$events?: Events;
|
|
9
|
-
$$slots?: Slots;
|
|
10
|
-
}): Exports & {
|
|
11
|
-
$set?: any;
|
|
12
|
-
$on?: any;
|
|
13
|
-
};
|
|
14
|
-
z_$$bindings?: Bindings;
|
|
15
|
-
}
|
|
16
|
-
/** @deprecated Directly set styles instead */
|
|
17
|
-
declare const StyleFromScheme: $$__sveltets_2_IsomorphicComponent<{
|
|
3
|
+
interface Props {
|
|
18
4
|
lightScheme: SerializedScheme;
|
|
19
5
|
darkScheme: SerializedScheme;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
type StyleFromScheme =
|
|
6
|
+
}
|
|
7
|
+
/** @deprecated Directly set styles instead */
|
|
8
|
+
declare const StyleFromScheme: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type StyleFromScheme = ReturnType<typeof StyleFromScheme>;
|
|
24
10
|
export default StyleFromScheme;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { IconifyIcon } from "@iconify/types";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
icon,
|
|
6
|
+
width = "1em",
|
|
7
|
+
height = "1em",
|
|
8
|
+
class: clazz,
|
|
9
|
+
}: {
|
|
10
|
+
icon: IconifyIcon;
|
|
11
|
+
width?: string;
|
|
12
|
+
height?: string;
|
|
13
|
+
class?: string;
|
|
14
|
+
} = $props();
|
|
8
15
|
</script>
|
|
9
16
|
|
|
10
17
|
<svg {width} {height} class={clazz} viewBox="0 0 {icon.width} {icon.height}">
|
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
import type { IconifyIcon } from "@iconify/types";
|
|
2
|
-
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: Props & {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const Icon: $$__sveltets_2_IsomorphicComponent<{
|
|
2
|
+
type $$ComponentProps = {
|
|
16
3
|
icon: IconifyIcon;
|
|
17
4
|
width?: string;
|
|
18
5
|
height?: string;
|
|
19
|
-
class?: string
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
type Icon = InstanceType<typeof Icon>;
|
|
6
|
+
class?: string;
|
|
7
|
+
};
|
|
8
|
+
declare const Icon: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
9
|
+
type Icon = ReturnType<typeof Icon>;
|
|
24
10
|
export default Icon;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
2
|
+
import { parseSize } from "./utils";
|
|
3
|
+
|
|
4
|
+
let { morph }: { morph: boolean } = $props();
|
|
5
|
+
|
|
6
|
+
let cancelRipples: (() => void)[] = $state([]);
|
|
3
7
|
|
|
4
8
|
const createRipple = (node: HTMLDivElement) => {
|
|
5
9
|
node.classList.remove("broken");
|
|
@@ -101,6 +105,8 @@
|
|
|
101
105
|
|
|
102
106
|
node.appendChild(svg);
|
|
103
107
|
|
|
108
|
+
parent.classList.toggle("activated", true);
|
|
109
|
+
|
|
104
110
|
cancelRipples.push(() => {
|
|
105
111
|
const fade = document.createElementNS("http://www.w3.org/2000/svg", "animate");
|
|
106
112
|
fade.setAttribute("attributeName", "opacity");
|
|
@@ -113,6 +119,8 @@
|
|
|
113
119
|
circle.appendChild(fade);
|
|
114
120
|
fade.beginElement();
|
|
115
121
|
setTimeout(() => svg.remove(), 800);
|
|
122
|
+
|
|
123
|
+
parent.classList.toggle("activated", false);
|
|
116
124
|
});
|
|
117
125
|
};
|
|
118
126
|
|
|
@@ -127,11 +135,11 @@
|
|
|
127
135
|
</script>
|
|
128
136
|
|
|
129
137
|
<svelte:window
|
|
130
|
-
|
|
138
|
+
onpointerup={() => {
|
|
131
139
|
cancelRipples.forEach((cancel) => cancel());
|
|
132
140
|
cancelRipples = [];
|
|
133
141
|
}}
|
|
134
|
-
|
|
142
|
+
ondragend={() => {
|
|
135
143
|
cancelRipples.forEach((cancel) => cancel());
|
|
136
144
|
cancelRipples = [];
|
|
137
145
|
}}
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const Ripple: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
-
[evt: string]: CustomEvent<any>;
|
|
16
|
-
}, {}, {}, string>;
|
|
17
|
-
type Ripple = InstanceType<typeof Ripple>;
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
morph: boolean;
|
|
3
|
+
};
|
|
4
|
+
declare const Ripple: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
5
|
+
type Ripple = ReturnType<typeof Ripple>;
|
|
18
6
|
export default Ripple;
|
|
@@ -1,26 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
[x: string]: never;
|
|
4
|
-
}, {
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
}, {}> & {
|
|
7
|
-
$$bindings?: string | undefined;
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
morph: boolean;
|
|
8
3
|
};
|
|
9
|
-
declare const Ripplesimple:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
}, {}, {}, string>;
|
|
14
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
-
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
-
$$bindings?: Bindings;
|
|
17
|
-
} & Exports;
|
|
18
|
-
(internal: unknown, props: {
|
|
19
|
-
$$events?: Events;
|
|
20
|
-
$$slots?: Slots;
|
|
21
|
-
}): Exports & {
|
|
22
|
-
$set?: any;
|
|
23
|
-
$on?: any;
|
|
24
|
-
};
|
|
25
|
-
z_$$bindings?: Bindings;
|
|
26
|
-
}
|
|
4
|
+
declare const Ripplesimple: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
5
|
+
type Ripplesimple = ReturnType<typeof Ripplesimple>;
|
|
6
|
+
export default Ripplesimple;
|
|
@@ -5,10 +5,14 @@
|
|
|
5
5
|
<script lang="ts">
|
|
6
6
|
import { genCSS, type SerializedScheme } from "./utils";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
interface Props {
|
|
9
|
+
lightScheme: SerializedScheme;
|
|
10
|
+
darkScheme: SerializedScheme;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let { lightScheme, darkScheme }: Props = $props();
|
|
10
14
|
const hexCode = (argb: number) => "#" + ((argb & 0xffffff) + 0x1000000).toString(16).slice(1);
|
|
11
|
-
|
|
15
|
+
let styling = $derived(genCSS(lightScheme, darkScheme));
|
|
12
16
|
</script>
|
|
13
17
|
|
|
14
18
|
<svelte:head>
|
|
@@ -1,23 +1,9 @@
|
|
|
1
1
|
import { type SerializedScheme } from "./utils";
|
|
2
|
-
interface
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: Props & {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
/** @deprecated Directly set styles instead */
|
|
16
|
-
declare const Styling: $$__sveltets_2_IsomorphicComponent<{
|
|
2
|
+
interface Props {
|
|
17
3
|
lightScheme: SerializedScheme;
|
|
18
4
|
darkScheme: SerializedScheme;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
type Styling =
|
|
5
|
+
}
|
|
6
|
+
/** @deprecated Directly set styles instead */
|
|
7
|
+
declare const Styling: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type Styling = ReturnType<typeof Styling>;
|
|
23
9
|
export default Styling;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { easeEmphasized } from "./easing";
|
|
2
|
-
|
|
3
|
-
? +size.slice(0, -2)
|
|
4
|
-
: size.endsWith("rem")
|
|
5
|
-
? +size.slice(0, -3) * 16
|
|
6
|
-
: null) || 0;
|
|
2
|
+
import { parseSize } from "./utils";
|
|
7
3
|
const getBackgroundColor = (node, defaultColor) => {
|
|
8
4
|
if (!defaultColor) {
|
|
9
5
|
const tmp = document.createElement("div");
|
package/package/misc/easing.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// TODO: update for Expressive
|
|
1
2
|
const createBezierLUT = (points, pointCount = 100) => {
|
|
2
3
|
const lut = [];
|
|
3
4
|
for (let t = 0; t < 1; t += 1 / pointCount) {
|
|
@@ -35,34 +36,6 @@ export const easeEmphasized = createEase([
|
|
|
35
36
|
[1, 1],
|
|
36
37
|
],
|
|
37
38
|
]);
|
|
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 ===
|
|
54
|
-
https://cdn.discordapp.com/attachments/1058124584286683237/1064238491904524308/w9blD3eMKQBwAAAABJRU5ErkJggg.png
|
|
55
|
-
cubic-bezier(0.254, 0.029, 0, 1.2) is preferred, it is the most accurate to the acceleration
|
|
56
|
-
cubic-bezier(0.356, 0.701, 0, 1.004) is the most accurate to the deceleration
|
|
57
|
-
cubic-bezier(0.291, 0.281, 0, 1.2) has no weighting
|
|
58
|
-
|
|
59
|
-
=== OLD CSS VERSION: UNLIMITED OVERSHOOT ===
|
|
60
|
-
https://cdn.discordapp.com/attachments/1058124584286683237/1064238129306927124/H47ZvYKwT8COjeuQXsI8AE4554luCbtMqAAqAJubZ9I2452QBcREREJgab5REREREKgZEpEREQkBEqmREREREKgZEpEREQkBEqmREREREKgZEpEREQkBEqmREREREKgZEpEREQkBP8PcBLo5kfHxSYAAAAASUVORK5CYII.png
|
|
61
|
-
cubic-bezier(0.271, -0.011, 0, 1.449) is the most accurate to the acceleration (but has a large overshoot)
|
|
62
|
-
the deceleration is the same as before
|
|
63
|
-
cubic-bezier(0.278, 0.195, 0, 1.251) has no weighting
|
|
64
|
-
the m3 docs randomly mention 0.2, 0, 0, 1 but that seems off
|
|
65
|
-
*/
|
|
66
39
|
export const easeEmphasizedDecel = createEase([
|
|
67
40
|
[
|
|
68
41
|
[0, 0],
|
package/package/misc/styles.css
CHANGED
|
@@ -23,120 +23,148 @@
|
|
|
23
23
|
0px 6px 30px 5px rgb(var(--m3-scheme-shadow) / 0.12);
|
|
24
24
|
--m3-util-bottom-offset: 0;
|
|
25
25
|
|
|
26
|
-
/*
|
|
26
|
+
/* Shapes */
|
|
27
27
|
--m3-util-rounding-none: 0;
|
|
28
|
-
--m3-util-rounding-extra-small:
|
|
29
|
-
--m3-util-rounding-small:
|
|
30
|
-
--m3-util-rounding-medium:
|
|
31
|
-
--m3-util-rounding-large:
|
|
32
|
-
--m3-util-rounding-extra-large:
|
|
33
|
-
--m3-util-rounding-full:
|
|
28
|
+
--m3-util-rounding-extra-small: 4px;
|
|
29
|
+
--m3-util-rounding-small: 8px;
|
|
30
|
+
--m3-util-rounding-medium: 12px;
|
|
31
|
+
--m3-util-rounding-large: 16px;
|
|
32
|
+
--m3-util-rounding-extra-large: 28px;
|
|
33
|
+
--m3-util-rounding-full: 9999px;
|
|
34
34
|
|
|
35
35
|
--m3-font: Roboto, system-ui, sans-serif;
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
/* Expressive easing */
|
|
38
|
+
--m3-util-easing-fast-spatial: cubic-bezier(0.42, 1.67, 0.21, 0.9) 350ms;
|
|
39
|
+
--m3-util-easing-spatial: cubic-bezier(0.38, 1.21, 0.22, 1) 500ms;
|
|
40
|
+
--m3-util-easing-slow-spatial: cubic-bezier(0.39, 1.29, 0.35, 0.98) 650ms;
|
|
41
|
+
--m3-util-easing-fast: cubic-bezier(0.31, 0.94, 0.34, 1) 150ms;
|
|
42
|
+
--m3-util-easing: cubic-bezier(0.34, 0.8, 0.34, 1) 200ms;
|
|
43
|
+
--m3-util-easing-slow: cubic-bezier(0.34, 0.88, 0.34, 1) 300ms;
|
|
44
|
+
/* Emphasized easing, curve derived from this code:
|
|
45
|
+
const createBezierLUT = (points: number[][], pointCount: number = 100): number[][] => {
|
|
46
|
+
const lut: number[][] = [];
|
|
47
|
+
for (let t = 0; t < 1; t += 1 / pointCount) {
|
|
48
|
+
const a = (1 - t) * (1 - t) * (1 - t);
|
|
49
|
+
const b = (1 - t) * (1 - t) * t;
|
|
50
|
+
const c = (1 - t) * t * t;
|
|
51
|
+
const d = t * t * t;
|
|
52
|
+
const x = a * points[0][0] + 3 * b * points[1][0] + 3 * c * points[2][0] + d * points[3][0];
|
|
53
|
+
const y = a * points[0][1] + 3 * b * points[1][1] + 3 * c * points[2][1] + d * points[3][1];
|
|
54
|
+
lut.push([x, y]);
|
|
55
|
+
}
|
|
56
|
+
return lut;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const createCSSEaseOptimized = (
|
|
60
|
+
lutOptions: number[][][],
|
|
61
|
+
maxErrorThreshold: number = 0.01
|
|
62
|
+
): string => {
|
|
63
|
+
// Create the full lookup table
|
|
64
|
+
const lut = lutOptions.map((args) => createBezierLUT(args)).flat();
|
|
65
|
+
|
|
66
|
+
// Find key points using Douglas-Peucker algorithm
|
|
67
|
+
const keyPoints: number[][] = [lut[0], lut[lut.length - 1]];
|
|
68
|
+
const segments: number[][] = [[0, lut.length - 1]];
|
|
69
|
+
|
|
70
|
+
while (segments.length > 0) {
|
|
71
|
+
const [startIdx, endIdx] = segments.pop() || [0, 0];
|
|
72
|
+
let maxError = 0;
|
|
73
|
+
let maxErrorIdx = -1;
|
|
74
|
+
|
|
75
|
+
// Skip if segment is too small
|
|
76
|
+
if (endIdx - startIdx <= 1) continue;
|
|
77
|
+
|
|
78
|
+
const [startX, startY] = lut[startIdx];
|
|
79
|
+
const [endX, endY] = lut[endIdx];
|
|
80
|
+
|
|
81
|
+
// Find point with maximum error
|
|
82
|
+
for (let i = startIdx + 1; i < endIdx; i++) {
|
|
83
|
+
const [x, y] = lut[i];
|
|
84
|
+
|
|
85
|
+
// Linear interpolation
|
|
86
|
+
const t = (x - startX) / (endX - startX);
|
|
87
|
+
const interpolatedY = startY + t * (endY - startY);
|
|
88
|
+
|
|
89
|
+
const error = Math.abs(y - interpolatedY);
|
|
90
|
+
|
|
91
|
+
if (error > maxError) {
|
|
92
|
+
maxError = error;
|
|
93
|
+
maxErrorIdx = i;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// If error exceeds threshold, add point and split segment
|
|
98
|
+
if (maxError > maxErrorThreshold) {
|
|
99
|
+
keyPoints.push(lut[maxErrorIdx]);
|
|
100
|
+
segments.push([startIdx, maxErrorIdx]);
|
|
101
|
+
segments.push([maxErrorIdx, endIdx]);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Sort by x value
|
|
106
|
+
keyPoints.sort((a, b) => a[0] - b[0]);
|
|
107
|
+
|
|
108
|
+
// Format result using CSS linear() with explicit percentages
|
|
109
|
+
let result = "linear(";
|
|
110
|
+
|
|
111
|
+
// First point (no percentage for first point)
|
|
112
|
+
result += keyPoints[0][1].toFixed(3);
|
|
113
|
+
|
|
114
|
+
// Middle points with explicit percentages
|
|
115
|
+
for (let i = 1; i < keyPoints.length - 1; i++) {
|
|
116
|
+
const [x, y] = keyPoints[i];
|
|
117
|
+
const percentage = (x * 100).toFixed(0) + "%";
|
|
118
|
+
result += `, ${y.toFixed(3)} ${percentage}`;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Last point (no percentage for last point)
|
|
122
|
+
result += `, ${keyPoints[keyPoints.length - 1][1].toFixed(3)}`;
|
|
123
|
+
result += ")";
|
|
124
|
+
|
|
125
|
+
return result;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// Example usage
|
|
129
|
+
const testInput = [
|
|
130
|
+
[
|
|
131
|
+
[0, 0],
|
|
132
|
+
[0.05, 0],
|
|
133
|
+
[0.133, 0.06],
|
|
134
|
+
[0.166, 0.4],
|
|
135
|
+
],
|
|
136
|
+
[
|
|
137
|
+
[0.166, 0.4],
|
|
138
|
+
[0.208, 0.82],
|
|
139
|
+
[0.25, 1],
|
|
140
|
+
[1, 1],
|
|
141
|
+
],
|
|
142
|
+
];
|
|
143
|
+
|
|
144
|
+
// Run optimized function with a more relaxed threshold for smaller size
|
|
145
|
+
const optimizedSmallResult = createCSSEaseOptimized(testInput, 0.01);
|
|
146
|
+
console.log("Optimized result (relaxed threshold 0.01):");
|
|
147
|
+
console.log(optimizedSmallResult);
|
|
148
|
+
*/
|
|
149
|
+
--m3-util-curve: linear(
|
|
38
150
|
0,
|
|
39
|
-
0.
|
|
40
|
-
0.
|
|
41
|
-
0.
|
|
42
|
-
0.
|
|
43
|
-
0.
|
|
44
|
-
0.
|
|
45
|
-
0.
|
|
46
|
-
0.
|
|
47
|
-
0.
|
|
48
|
-
0.
|
|
49
|
-
0.
|
|
50
|
-
0.
|
|
51
|
-
0.
|
|
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,
|
|
151
|
+
0.034 6%,
|
|
152
|
+
0.073 9%,
|
|
153
|
+
0.126 11%,
|
|
154
|
+
0.194 13%,
|
|
155
|
+
0.273 15%,
|
|
156
|
+
0.351 16%,
|
|
157
|
+
0.541 18%,
|
|
158
|
+
0.652 20%,
|
|
159
|
+
0.755 24%,
|
|
160
|
+
0.839 30%,
|
|
161
|
+
0.91 39%,
|
|
162
|
+
0.959 53%,
|
|
163
|
+
0.989 72%,
|
|
137
164
|
1
|
|
138
165
|
);
|
|
139
|
-
--m3-
|
|
166
|
+
--m3-util-curve-decel: cubic-bezier(0.05, 0.7, 0.1, 1);
|
|
167
|
+
--m3-util-curve-accel: cubic-bezier(0.3, 0, 0.8, 0.15);
|
|
140
168
|
|
|
141
169
|
accent-color: rgb(var(--m3-scheme-primary));
|
|
142
170
|
}
|
package/package/misc/utils.d.ts
CHANGED
|
@@ -6,3 +6,4 @@ export declare const colors: Color[];
|
|
|
6
6
|
* @returns A string of CSS code with custom properties representing the color scheme values.
|
|
7
7
|
* */
|
|
8
8
|
export declare const genCSS: (light: SerializedScheme, dark: SerializedScheme) => string;
|
|
9
|
+
export declare const parseSize: (size: string) => number;
|
package/package/misc/utils.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
let {
|
|
5
|
+
children,
|
|
6
|
+
}: {
|
|
7
|
+
children: Snippet;
|
|
8
|
+
} = $props();
|
|
6
9
|
</script>
|
|
7
10
|
|
|
8
|
-
<nav class="m3-container"
|
|
9
|
-
|
|
11
|
+
<nav class="m3-container">
|
|
12
|
+
{@render children()}
|
|
10
13
|
</nav>
|
|
11
14
|
|
|
12
15
|
<style>
|
|
13
16
|
.m3-container {
|
|
17
|
+
display: flex;
|
|
14
18
|
flex-direction: column;
|
|
15
19
|
width: 22.5rem;
|
|
16
20
|
padding: 1rem 0.75rem 0 0.75rem;
|
|
@@ -1,31 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
16
|
-
default: any;
|
|
17
|
-
} ? Props extends Record<string, never> ? any : {
|
|
18
|
-
children?: any;
|
|
19
|
-
} : {});
|
|
20
|
-
declare const NavDrawer: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
21
|
-
display?: string;
|
|
22
|
-
extraOptions?: HTMLAttributes<HTMLElement>;
|
|
23
|
-
}, {
|
|
24
|
-
default: {};
|
|
25
|
-
}>, {
|
|
26
|
-
[evt: string]: CustomEvent<any>;
|
|
27
|
-
}, {
|
|
28
|
-
default: {};
|
|
29
|
-
}, {}, string>;
|
|
30
|
-
type NavDrawer = InstanceType<typeof NavDrawer>;
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
children: Snippet;
|
|
4
|
+
};
|
|
5
|
+
declare const NavDrawer: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
+
type NavDrawer = ReturnType<typeof NavDrawer>;
|
|
31
7
|
export default NavDrawer;
|