@purr-core/hooks.media-query 0.0.6 → 0.0.8

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.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purr-core/hooks.media-query",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "peerDependencies": {
24
24
  "typescript": "*",
25
25
  "react": "*",
26
- "@purr-core/hooks.isomorphic-layout-effect": "0.0.6"
26
+ "@purr-core/hooks.isomorphic-layout-effect": "0.0.8"
27
27
  },
28
28
  "author": "@DinhThienPhuc",
29
29
  "license": "ISC",
@@ -32,6 +32,8 @@
32
32
  "scripts": {
33
33
  "dev": "vite build --watch",
34
34
  "build": "tsc && vite build",
35
+ "build:vite": "tsc && vite build",
36
+ "build:tsup": "tsup",
35
37
  "lint": "eslint . --ext ts,tsx --max-warnings 0"
36
38
  }
37
39
  }
package/dist/_hook.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export interface IMediaQuery {
2
- defaultValue?: boolean;
3
- initializeWithValue?: boolean;
4
- }
5
- declare const useMediaQuery: (query: string, { defaultValue, initializeWithValue }?: IMediaQuery) => boolean;
6
- export default useMediaQuery;
package/dist/index.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";const o=require("react"),d=require("@purr-core/hooks.isomorphic-layout-effect"),h=typeof window>"u",u=(n,{defaultValue:s=!1,initializeWithValue:i=!0}={})=>{const r=e=>h?s:window.matchMedia(e).matches,[c,a]=o.useState(()=>i?r(n):s),t=()=>{a(r(n))};return d(()=>{const e=window.matchMedia(n);return t(),e.addListener?e.addListener(t):e.addEventListener("change",t),()=>{e.removeListener?e.removeListener(t):e.removeEventListener("change",t)}},[n]),c};module.exports=u;
package/dist/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export { default } from './_hook';
package/dist/index.js DELETED
@@ -1,16 +0,0 @@
1
- import { useState as c } from "react";
2
- import d from "@purr-core/hooks.isomorphic-layout-effect";
3
- const m = typeof window > "u", u = (n, { defaultValue: r = !1, initializeWithValue: a = !0 } = {}) => {
4
- const s = (e) => m ? r : window.matchMedia(e).matches, [i, o] = c(() => a ? s(n) : r), t = () => {
5
- o(s(n));
6
- };
7
- return d(() => {
8
- const e = window.matchMedia(n);
9
- return t(), e.addListener ? e.addListener(t) : e.addEventListener("change", t), () => {
10
- e.removeListener ? e.removeListener(t) : e.removeEventListener("change", t);
11
- };
12
- }, [n]), i;
13
- };
14
- export {
15
- u as default
16
- };