@solid-primitives/resize-observer
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -0,5 +1,9 @@ | ||
declare type ResizeHandler = (size: { | ||
width: number; | ||
height: number; | ||
}, ref: Element) => void; | ||
/** | ||
* Create resize observer is a helper primitive for binding resize events. | ||
* | ||
* @param opts.refs - Either an `HTMLElement`, an array of `HTMLElement`s, or a signal returning one of these. | ||
* @param opts.refs - Either an `Element`, an array of `Element`s, or a signal returning one of these. | ||
* @param opts.onResize - Function handler to trigger on resize | ||
@@ -9,3 +13,3 @@ * @return A callback that can be used to add refs to observe resizing | ||
*/ | ||
declare function createResizeObserver<T extends HTMLElement>(opts: { | ||
declare function createResizeObserver<T extends Element>(opts: { | ||
onResize: ResizeHandler; | ||
@@ -12,0 +16,0 @@ refs?: T | T[] | (() => T | T[]); |
@@ -6,3 +6,3 @@ // src/index.ts | ||
const refCallback = (e) => setOtherRefs((l) => l.concat(e)); | ||
const previousMap = new Map(); | ||
const previousMap = /* @__PURE__ */ new Map(); | ||
const resizeObserver = new ResizeObserver((entries) => { | ||
@@ -9,0 +9,0 @@ if (!Array.isArray(entries)) { |
{ | ||
"name": "@solid-primitives/resize-observer", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Primitive to observer browser resizes", | ||
@@ -13,3 +13,3 @@ "author": "Moshe Udimar", | ||
"primitive": { | ||
"name": "resiz-observer", | ||
"name": "resize-observer", | ||
"stage": 3, | ||
@@ -48,3 +48,3 @@ "list": [ | ||
"devDependencies": { | ||
"@types/jest": "^26.0.10", | ||
"@types/jest": "^27.0.0", | ||
"prettier": "^2.0.5", | ||
@@ -56,4 +56,4 @@ "solid-testing-library": "^0.2.0", | ||
}, | ||
"dependencies": { | ||
"solid-js": "^1.2.1" | ||
"peerDependencies": { | ||
"solid-js": "1.3.0" | ||
}, | ||
@@ -65,2 +65,2 @@ "jest": { | ||
} | ||
} | ||
} |
@@ -6,2 +6,3 @@ # solid-primitives/resize-observer | ||
[![size](https://img.shields.io/npm/v/@solid-primitives/resize-observer?style=for-the-badge)](https://www.npmjs.com/package/@solid-primitives/resize-observer) | ||
[![stage](https://img.shields.io/endpoint?style=for-the-badge&url=https%3A%2F%2Fraw.githubusercontent.com%2Fdavedbase%2Fsolid-primitives%2Fmain%2Fassets%2Fbadges%2Fstage-3.json)](https://github.com/davedbase/solid-primitives#contribution-process) | ||
@@ -25,3 +26,3 @@ Provides a reactive resize observer wrapper. | ||
```ts | ||
const [refCallback] = createResizeObserver(() => console.log("resized")); | ||
const refCallback = createResizeObserver(() => console.log("resized")); | ||
``` | ||
@@ -42,2 +43,6 @@ | ||
1.0.4 | ||
Patched HTMLElement to Element to resolve type error on buildd. Updated to Solid 1.3. | ||
</details> | ||
@@ -44,0 +49,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10827
191
50
+ Addedsolid-js@1.3.0(transitive)
- Removedsolid-js@^1.2.1
- Removedcsstype@3.1.3(transitive)
- Removedseroval@1.1.1(transitive)
- Removedseroval-plugins@1.1.1(transitive)
- Removedsolid-js@1.9.3(transitive)