m3-svelte 6.0.2 → 6.0.3

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.
@@ -16,7 +16,7 @@
16
16
  headline = "",
17
17
  supporting = "",
18
18
  trailing,
19
- lines = overline && supporting ? 3 : overline || supporting ? 2 : 1,
19
+ lines: _lines,
20
20
  ...props
21
21
  }: {
22
22
  leading?: Snippet;
@@ -26,6 +26,8 @@
26
26
  trailing?: Snippet;
27
27
  lines?: number;
28
28
  } & ActionProps = $props();
29
+
30
+ let lines = $derived(_lines ?? (overline && supporting ? 3 : overline || supporting ? 2 : 1));
29
31
  </script>
30
32
 
31
33
  {#snippet content()}
@@ -78,6 +80,7 @@
78
80
  <style>
79
81
  .m3-container {
80
82
  display: flex;
83
+ justify-self: stretch;
81
84
  padding: 0.5rem 1.5rem 0.5rem 1rem;
82
85
  align-items: center;
83
86
  gap: 1rem;
@@ -9,7 +9,13 @@
9
9
  let {
10
10
  date = "",
11
11
  clearable,
12
+ // eslint and svelte disagree
13
+ // eslint-disable-next-line svelte/no-unused-svelte-ignore
14
+ // svelte-ignore state_referenced_locally
12
15
  focusedMonth = $bindable(parseInt(date.slice(5, 7)) - 1 || now.getMonth()),
16
+ // eslint and svelte disagree
17
+ // eslint-disable-next-line svelte/no-unused-svelte-ignore
18
+ // svelte-ignore state_referenced_locally
13
19
  focusedYear = $bindable(parseInt(date.slice(0, 4)) || now.getFullYear()),
14
20
  startYear = now.getFullYear() - 50,
15
21
  endYear = now.getFullYear() + 10,
@@ -29,10 +35,7 @@
29
35
  } = $props();
30
36
 
31
37
  let currentView: "calendar" | "year" | "month" = $state("calendar");
32
- let chosenDate = $state(date);
33
- $effect(() => {
34
- chosenDate = date;
35
- });
38
+ let chosenDate = $derived(date);
36
39
 
37
40
  const getLongMonth = (month: number) =>
38
41
  new Date(0, month).toLocaleDateString(undefined, { month: "long" });
@@ -1,2 +1,2 @@
1
- export declare const linear: (amp: number, center: number, from: number, to: number, time: number, cutoffTo?: number) => string;
1
+ export declare const linear: (amp: number, center: number, from: number, to: number, time: number, softTo?: number) => string;
2
2
  export declare const trackOpacity: (right: number, x: number) => number;
@@ -2,14 +2,14 @@ const frequencyT = (Math.PI * 2) / 1000;
2
2
  const frequencyX = (Math.PI * 2) / 40;
3
3
  const round2 = (x) => Math.round(x * 100) / 100;
4
4
  const round1 = (x) => Math.round(x * 10) / 10;
5
- export const linear = (amp, center, from, to, time, cutoffTo) => {
5
+ export const linear = (amp, center, from, to, time, softTo) => {
6
6
  time = time * frequencyT;
7
7
  time %= Math.PI * 2;
8
8
  if (from >= to)
9
9
  return "";
10
10
  let path = "";
11
11
  for (let xIterator = from; xIterator <= to; xIterator += 0.5) {
12
- const x = cutoffTo ? Math.min(cutoffTo, xIterator) : xIterator;
12
+ const x = softTo ? Math.min(softTo, xIterator) : xIterator;
13
13
  const sinV = Math.sin(x * frequencyX + time);
14
14
  const y = sinV * amp + center;
15
15
  if (x == from) {
@@ -1,7 +1,7 @@
1
1
  export const addBadge = (icon, n) => {
2
2
  const { width, height } = icon;
3
3
  if (!width || !height)
4
- throw new Error("Icon must have icon and height");
4
+ throw new Error("Icon must have width and height");
5
5
  let badge;
6
6
  if (n) {
7
7
  const x = width - 12;
@@ -21,7 +21,7 @@ export const addBadge = (icon, n) => {
21
21
  "border-radius:var(--m3-shape-full)",
22
22
  ].join(";")}">` +
23
23
  text +
24
- `</div>`;
24
+ `</div></foreignObject>`;
25
25
  }
26
26
  else {
27
27
  badge = `<circle cx="${width - 3}" cy="3" r="3" fill="var(--m3c-error)"/>`;
@@ -1,6 +1,6 @@
1
1
  import { MaterialDynamicColors, DynamicColor, ContrastCurve, } from "@ktibow/material-color-utilities-nightly";
2
2
  export const materialColors = new MaterialDynamicColors();
3
- // Custom color role used for switch
3
+ // Generates on-on-primary for Switch, read more: https://ktibow.github.io/blog/humanresearch/ononprimary/
4
4
  const onOnPrimary = DynamicColor.fromPalette({
5
5
  name: "on_on_primary",
6
6
  palette: (s) => s.primaryPalette,
@@ -20,6 +20,7 @@
20
20
  }[];
21
21
  } & HTMLAnchorAttributes = $props();
22
22
 
23
+ // svelte-ignore state_referenced_locally
23
24
  let prevTab = $state(tab);
24
25
  let wrapper: HTMLDivElement | undefined = $state();
25
26
  $effect(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "m3-svelte",
3
- "version": "6.0.2",
3
+ "version": "6.0.3",
4
4
  "license": "Apache-2.0 OR GPL-3.0-only",
5
5
  "repository": "KTibow/m3-svelte",
6
6
  "author": {
@@ -38,13 +38,13 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@eslint/compat": "^2.0.0",
41
- "@eslint/js": "^9.39.1",
41
+ "@eslint/js": "^9.39.2",
42
42
  "@sveltejs/adapter-static": "^3.0.10",
43
43
  "@sveltejs/kit": "^2.49.1",
44
44
  "@sveltejs/package": "^2.5.7",
45
45
  "@sveltejs/vite-plugin-svelte": "^6.2.1",
46
46
  "@types/flubber": "^0.4.0",
47
- "@types/node": "^24.10.1",
47
+ "@types/node": "^25.0.2",
48
48
  "eslint": "^9.39.1",
49
49
  "eslint-config-prettier": "^10.1.8",
50
50
  "eslint-plugin-svelte": "^3.13.1",
@@ -52,15 +52,15 @@
52
52
  "globals": "^16.5.0",
53
53
  "m3-svelte": "link:",
54
54
  "prettier": "^3.7.4",
55
- "prettier-plugin-svelte": "^3.4.0",
56
- "publint": "^0.3.15",
57
- "svelte": "^5.45.6",
55
+ "prettier-plugin-svelte": "^3.4.1",
56
+ "publint": "^0.3.16",
57
+ "svelte": "^5.46.0",
58
58
  "svelte-check": "^4.3.4",
59
59
  "svelte-highlight": "^7.9.0",
60
60
  "tinyglobby": "^0.2.15",
61
61
  "typescript": "^5.9.3",
62
- "typescript-eslint": "^8.49.0",
63
- "vite": "^7.2.7",
62
+ "typescript-eslint": "^8.50.0",
63
+ "vite": "^7.3.0",
64
64
  "vite-plugin-functions-mixins": "^0.4.0",
65
65
  "vite-plugin-token-shaker": "^0.0.3"
66
66
  },