@smui/ripple
Advanced tools
Comparing version 8.0.0-beta.1 to 8.0.0-beta.2
@@ -6,2 +6,13 @@ # Change Log | ||
# [8.0.0-beta.2](https://github.com/hperrin/svelte-material-ui/compare/v8.0.0-beta.1...v8.0.0-beta.2) (2024-12-13) | ||
### Bug Fixes | ||
* use svelte event on instead of addEventListener ([11b68e7](https://github.com/hperrin/svelte-material-ui/commit/11b68e7ffa75a87be6cb5b47dd2d92ab59763774)) | ||
# [8.0.0-beta.1](https://github.com/hperrin/svelte-material-ui/compare/v8.0.0-beta.0...v8.0.0-beta.1) (2024-12-11) | ||
@@ -8,0 +19,0 @@ |
import { MDCRippleFoundation, util } from '@material/ripple'; | ||
import { events, ponyfill } from '@material/dom'; | ||
import { getContext } from 'svelte'; | ||
import { SvelteEventManager } from '@smui/common/internal'; | ||
const { applyPassive } = events; | ||
@@ -8,2 +9,3 @@ const { matches } = ponyfill; | ||
let instance; | ||
let eventManager = new SvelteEventManager(); | ||
let addLayoutListener = getContext('SMUI:addLayoutListener'); | ||
@@ -52,15 +54,24 @@ let removeLayoutListener; | ||
containsEventTarget: (target) => node.contains(target), | ||
deregisterDocumentInteractionHandler: (evtType, handler) => document.documentElement.removeEventListener(evtType, handler, applyPassive()), | ||
deregisterInteractionHandler: (evtType, handler) => (eventTarget || node).removeEventListener(evtType, handler, applyPassive()), | ||
deregisterDocumentInteractionHandler: (evtType, handler) => eventManager.off(document.documentElement, evtType, handler), | ||
deregisterInteractionHandler: (evtType, handler) => eventManager.off(eventTarget || node, evtType, handler), | ||
deregisterResizeHandler: (handler) => window.removeEventListener('resize', handler), | ||
getWindowPageOffset: () => ({ | ||
x: window.pageXOffset, | ||
y: window.pageYOffset, | ||
}), | ||
getWindowPageOffset: () => { | ||
var _a, _b; | ||
return ({ | ||
x: (_a = window.pageXOffset) !== null && _a !== void 0 ? _a : window.scrollX, | ||
y: (_b = window.pageYOffset) !== null && _b !== void 0 ? _b : window.scrollY, | ||
}); | ||
}, | ||
isSurfaceActive: () => active == null ? matches(activeTarget || node, ':active') : active, | ||
isSurfaceDisabled: () => !!disabled, | ||
isUnbounded: () => !!unbounded, | ||
registerDocumentInteractionHandler: (evtType, handler) => document.documentElement.addEventListener(evtType, handler, applyPassive()), | ||
registerInteractionHandler: (evtType, handler) => (eventTarget || node).addEventListener(evtType, handler, applyPassive()), | ||
registerResizeHandler: (handler) => window.addEventListener('resize', handler), | ||
registerDocumentInteractionHandler: (evtType, handler) => { | ||
const opts = applyPassive(); | ||
eventManager.on(document.documentElement, evtType, handler, typeof opts === 'boolean' ? { capture: opts } : opts); | ||
}, | ||
registerInteractionHandler: (evtType, handler) => { | ||
const opts = applyPassive(); | ||
eventManager.on(eventTarget || node, evtType, handler, typeof opts === 'boolean' ? { capture: opts } : opts); | ||
}, | ||
registerResizeHandler: (handler) => eventManager.on(window, 'resize', handler), | ||
removeClass, | ||
@@ -81,2 +92,3 @@ updateCssVariable: addStyle, | ||
instance = undefined; | ||
eventManager.clear(); | ||
} | ||
@@ -134,2 +146,3 @@ }); | ||
instance = undefined; | ||
eventManager.clear(); | ||
removeClass('mdc-ripple-surface'); | ||
@@ -136,0 +149,0 @@ removeClass('smui-ripple-surface--primary'); |
{ | ||
"name": "@smui/ripple", | ||
"version": "8.0.0-beta.1", | ||
"version": "8.0.0-beta.2", | ||
"description": "Svelte Material UI - Ripple", | ||
@@ -53,3 +53,3 @@ "type": "module", | ||
"@material/ripple": "^14.0.0", | ||
"@smui/common": "^8.0.0-beta.1", | ||
"@smui/common": "^8.0.0-beta.2", | ||
"svelte2tsx": "^0.7.26" | ||
@@ -64,3 +64,3 @@ }, | ||
}, | ||
"gitHead": "cf78a993fe276816e10dd5a3be86b8cfa333ea0e" | ||
"gitHead": "cdb983378b3a26e5e745f3e250ad52636d2d761f" | ||
} |
@@ -5,2 +5,3 @@ import { MDCRippleFoundation, util } from '@material/ripple'; | ||
import type { AddLayoutListener, RemoveLayoutListener } from '@smui/common'; | ||
import { SvelteEventManager } from '@smui/common/internal'; | ||
const { applyPassive } = events; | ||
@@ -45,2 +46,3 @@ const { matches } = ponyfill; | ||
let instance: MDCRippleFoundation | undefined; | ||
let eventManager = new SvelteEventManager(); | ||
let addLayoutListener = getContext<AddLayoutListener | undefined>( | ||
@@ -92,18 +94,10 @@ 'SMUI:addLayoutListener', | ||
deregisterDocumentInteractionHandler: (evtType, handler) => | ||
document.documentElement.removeEventListener( | ||
evtType, | ||
handler, | ||
applyPassive(), | ||
), | ||
eventManager.off(document.documentElement, evtType, handler), | ||
deregisterInteractionHandler: (evtType, handler) => | ||
(eventTarget || node).removeEventListener( | ||
evtType, | ||
handler, | ||
applyPassive(), | ||
), | ||
eventManager.off(eventTarget || node, evtType, handler), | ||
deregisterResizeHandler: (handler) => | ||
window.removeEventListener('resize', handler), | ||
getWindowPageOffset: () => ({ | ||
x: window.pageXOffset, | ||
y: window.pageYOffset, | ||
x: window.pageXOffset ?? window.scrollX, | ||
y: window.pageYOffset ?? window.scrollY, | ||
}), | ||
@@ -114,16 +108,22 @@ isSurfaceActive: () => | ||
isUnbounded: () => !!unbounded, | ||
registerDocumentInteractionHandler: (evtType, handler) => | ||
document.documentElement.addEventListener( | ||
registerDocumentInteractionHandler: (evtType, handler) => { | ||
const opts = applyPassive(); | ||
eventManager.on( | ||
document.documentElement, | ||
evtType, | ||
handler, | ||
applyPassive(), | ||
), | ||
registerInteractionHandler: (evtType, handler) => | ||
(eventTarget || node).addEventListener( | ||
typeof opts === 'boolean' ? { capture: opts } : opts, | ||
); | ||
}, | ||
registerInteractionHandler: (evtType, handler) => { | ||
const opts = applyPassive(); | ||
eventManager.on( | ||
eventTarget || node, | ||
evtType, | ||
handler, | ||
applyPassive(), | ||
), | ||
typeof opts === 'boolean' ? { capture: opts } : opts, | ||
); | ||
}, | ||
registerResizeHandler: (handler) => | ||
window.addEventListener('resize', handler), | ||
eventManager.on(window, 'resize', handler), | ||
removeClass, | ||
@@ -144,2 +144,3 @@ updateCssVariable: addStyle, | ||
instance = undefined; | ||
eventManager.clear(); | ||
} | ||
@@ -222,2 +223,3 @@ }); | ||
instance = undefined; | ||
eventManager.clear(); | ||
removeClass('mdc-ripple-surface'); | ||
@@ -224,0 +226,0 @@ removeClass('smui-ripple-surface--primary'); |
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
68003
618
+ Added@smui/common@8.0.0-beta.2(transitive)
+ Addedsvelte@5.15.0(transitive)
- Removed@smui/common@8.0.0-beta.3(transitive)
- Removedclsx@2.1.1(transitive)
- Removedsvelte@5.16.0(transitive)
Updated@smui/common@^8.0.0-beta.2