lightnet 4.4.1 → 4.4.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # lightnet
2
2
 
3
+ ## 4.4.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#415](https://github.com/LightNetDev/LightNet/pull/415) [`af6b338`](https://github.com/LightNetDev/LightNet/commit/af6b338bb84a45f6a45dc72c9f7be5a6d315c76b) - Update dependencies
8
+
9
+ - [#415](https://github.com/LightNetDev/LightNet/pull/415) [`af6b338`](https://github.com/LightNetDev/LightNet/commit/af6b338bb84a45f6a45dc72c9f7be5a6d315c76b) - Respect prefers reduced motion from main menu, toast and view transistion.
10
+
11
+ ## 4.4.2
12
+
13
+ ### Patch Changes
14
+
15
+ - [#413](https://github.com/LightNetDev/LightNet/pull/413) [`3bdac34`](https://github.com/LightNetDev/LightNet/commit/3bdac343f7a0d18c63e5fb25c306b4eb2a3af9be) - Update dependencies after setting pnpm minReleaseAge to one day.
16
+
3
17
  ## 4.4.1
4
18
 
5
19
  ### Patch Changes
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "LightNet makes it easy to run your own digital media library.",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
- "version": "4.4.1",
6
+ "version": "4.4.3",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/LightNetDev/lightnet",
@@ -52,28 +52,28 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@astrojs/react": "^5.0.7",
55
- "@iconify-json/lucide": "^1.2.111",
55
+ "@iconify-json/lucide": "^1.2.113",
56
56
  "@iconify-json/mdi": "^1.2.3",
57
57
  "@iconify/tailwind": "^1.2.0",
58
58
  "@tailwindcss/typography": "^0.5.20",
59
- "@tanstack/react-virtual": "^3.14.2",
59
+ "@tanstack/react-virtual": "^3.14.3",
60
60
  "autoprefixer": "^10.5.0",
61
61
  "embla-carousel": "^8.6.0",
62
62
  "embla-carousel-wheel-gestures": "^8.1.0",
63
63
  "fuse.js": "^7.4.2",
64
64
  "i18next": "^26.3.1",
65
- "lucide-react": "^1.17.0",
65
+ "lucide-react": "^1.18.0",
66
66
  "marked": "^18.0.5",
67
67
  "postcss": "^8.5.15",
68
68
  "postcss-load-config": "^6.0.1",
69
69
  "yaml": "^2.9.0"
70
70
  },
71
71
  "devDependencies": {
72
- "@playwright/test": "^1.60.0",
72
+ "@playwright/test": "^1.61.0",
73
73
  "@types/react": "^19.2.17",
74
- "astro": "^6.4.6",
74
+ "astro": "^6.4.7",
75
75
  "typescript": "^6.0.3",
76
- "vitest": "^4.1.8",
76
+ "vitest": "^4.1.9",
77
77
  "@internal/e2e-test-utils": "^0.0.1"
78
78
  },
79
79
  "engines": {
@@ -3,6 +3,7 @@ const TIMEOUT_DATA_KEY = "toastHideTimeoutId"
3
3
  const DEFAULT_HIDDEN_TRANSFORM = "translateY(1.5rem)"
4
4
  const DEFAULT_VISIBLE_TRANSFORM = "translateY(0)"
5
5
  const DEFAULT_OVERSHOOT_TRANSFORM = "translateY(-0.25rem)"
6
+ const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)"
6
7
 
7
8
  type ShowToastOptions = {
8
9
  duration?: number
@@ -17,6 +18,7 @@ export function showToast(
17
18
  options: ShowToastOptions = {},
18
19
  ) {
19
20
  const duration = options.duration ?? DEFAULT_DURATION_MS
21
+ const prefersReducedMotion = window.matchMedia(REDUCED_MOTION_QUERY).matches
20
22
  const existingTimeoutId = element.dataset[TIMEOUT_DATA_KEY]
21
23
  const hiddenTransform =
22
24
  element.dataset.toastHiddenTransform ?? DEFAULT_HIDDEN_TRANSFORM
@@ -31,20 +33,29 @@ export function showToast(
31
33
 
32
34
  element.style.display = "flex"
33
35
  element.style.opacity = "100%"
34
- element.style.transform = overshootTransform
36
+ element.style.transitionDuration = prefersReducedMotion ? "0s" : ""
37
+ element.style.transform = prefersReducedMotion
38
+ ? visibleTransform
39
+ : overshootTransform
35
40
  element.dataset.toastVisible = "true"
36
41
 
37
42
  const settleIntoPlace = () => {
38
43
  element.style.transform = visibleTransform
39
44
  }
40
45
 
41
- window.requestAnimationFrame(() => {
42
- window.requestAnimationFrame(settleIntoPlace)
43
- })
46
+ if (prefersReducedMotion) {
47
+ settleIntoPlace()
48
+ } else {
49
+ window.requestAnimationFrame(() => {
50
+ window.requestAnimationFrame(settleIntoPlace)
51
+ })
52
+ }
44
53
 
45
54
  const timeoutId = window.setTimeout(() => {
46
55
  element.style.opacity = "0%"
47
- element.style.transform = hiddenTransform
56
+ element.style.transform = prefersReducedMotion
57
+ ? visibleTransform
58
+ : hiddenTransform
48
59
  element.dataset.toastVisible = "false"
49
60
  element.style.display = "hidden"
50
61
  delete element.dataset[TIMEOUT_DATA_KEY]
@@ -21,7 +21,7 @@ const { label, disabled } = Astro.props
21
21
  data-menu-panel
22
22
  aria-hidden="true"
23
23
  inert
24
- class="pointer-events-none absolute end-3 top-full mt-px flex w-48 origin-top scale-y-90 flex-col overflow-hidden rounded-b-md bg-white py-3 opacity-0 shadow-lg transition-all duration-100 ease-out"
24
+ class="pointer-events-none absolute end-3 top-full mt-px flex w-48 origin-top scale-y-90 flex-col overflow-hidden rounded-b-md bg-white py-3 opacity-0 shadow-lg transition-all duration-100 ease-out motion-reduce:transform-none motion-reduce:transition-none"
25
25
  >
26
26
  <slot />
27
27
  </ul>
@@ -30,6 +30,7 @@ const { label, disabled } = Astro.props
30
30
  class Menu extends HTMLElement {
31
31
  menuPanel = this.querySelector<HTMLElement>("[data-menu-panel]")!
32
32
  isMenuOpened = false
33
+ reducedMotionQuery = window.matchMedia("(prefers-reduced-motion: reduce)")
33
34
  handleOutsideClick = (event: MouseEvent) => {
34
35
  if (!this.isMenuOpened) {
35
36
  return
@@ -55,7 +56,9 @@ const { label, disabled } = Astro.props
55
56
  }
56
57
  this.menuPanel.style.opacity = "1"
57
58
  this.menuPanel.style.pointerEvents = "auto"
58
- this.menuPanel.style.transform = "scaleY(1)"
59
+ this.menuPanel.style.transform = this.reducedMotionQuery.matches
60
+ ? ""
61
+ : "scaleY(1)"
59
62
 
60
63
  this.menuPanel.setAttribute("aria-hidden", "false")
61
64
  this.menuPanel.removeAttribute("inert")
@@ -69,7 +72,9 @@ const { label, disabled } = Astro.props
69
72
  }
70
73
  this.menuPanel.style.opacity = "0"
71
74
  this.menuPanel.style.pointerEvents = "none"
72
- this.menuPanel.style.transform = "scaleY(0.9)"
75
+ this.menuPanel.style.transform = this.reducedMotionQuery.matches
76
+ ? ""
77
+ : "scaleY(0.9)"
73
78
 
74
79
  this.menuPanel.setAttribute("aria-hidden", "true")
75
80
  this.menuPanel.setAttribute("inert", "")
@@ -6,4 +6,10 @@
6
6
  @view-transition {
7
7
  navigation: auto;
8
8
  }
9
+
10
+ @media (prefers-reduced-motion: reduce) {
11
+ @view-transition {
12
+ navigation: none;
13
+ }
14
+ }
9
15
  </style>