seitu 0.4.3 → 0.4.5

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.
@@ -1,5 +1,5 @@
1
- import type { Readable, Subscribable } from '../core/index';
2
- export interface MediaQuery extends Subscribable<boolean>, Readable<boolean> {
1
+ import type { Destroyable, Readable, Subscribable } from '../core/index';
2
+ export interface MediaQuery extends Subscribable<boolean>, Readable<boolean>, Destroyable {
3
3
  }
4
4
  type MinMaxPrefix = 'min-' | 'max-' | '';
5
5
  type CSSUnitSuffix = 'px' | 'em' | 'rem' | 'vw' | 'vh' | 'dvw' | 'dvh' | 'svw' | 'svh' | 'lvw' | 'lvh' | 'cqw' | 'cqh' | 'vmin' | 'vmax' | 'cm' | 'mm' | 'in' | 'pt' | 'pc';
package/dist/web.js CHANGED
@@ -102,22 +102,12 @@ function o(e) {
102
102
  //#endregion
103
103
  //#region src/web/media-query.ts
104
104
  function s(e) {
105
- let { subscribe: t, notify: r } = n(), i = () => {
106
- if (typeof window > "u") return e.defaultMatches ?? !1;
107
- try {
108
- return window.matchMedia(e.query).matches;
109
- } catch {
110
- return e.defaultMatches ?? !1;
111
- }
112
- };
113
- return {
114
- get: i,
115
- subscribe: (n) => {
116
- if (typeof window > "u") return n(i()), () => {};
117
- let r = t(() => n(i())), a = window.matchMedia(e.query), o = () => n(i());
118
- return a.addEventListener("change", o), () => {
119
- r(), a.removeEventListener("change", o);
120
- };
105
+ let { subscribe: t, notify: r } = n(), i = typeof window > "u" ? null : window.matchMedia(e.query), a = () => i?.matches ?? e.defaultMatches ?? !1, o = () => r();
106
+ return i?.addEventListener("change", o), {
107
+ get: a,
108
+ subscribe: (e) => t(() => e(a())),
109
+ destroy: () => {
110
+ i?.removeEventListener("change", o);
121
111
  },
122
112
  "~": {
123
113
  output: null,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "seitu",
3
3
  "displayName": "Seitu",
4
4
  "type": "module",
5
- "version": "0.4.3",
5
+ "version": "0.4.5",
6
6
  "private": false,
7
7
  "author": "Valerii Strilets",
8
8
  "license": "MIT",