Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@solid-primitives/mouse

Package Overview
Dependencies
Maintainers
3
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solid-primitives/mouse - npm Package Compare versions

Comparing version 2.0.10 to 2.0.11

31

dist/index.js
import { makeEventListenerStack } from '@solid-primitives/event-listener';
import { noop, clamp, createStaticStore } from '@solid-primitives/utils';
import { noop, clamp, asAccessor } from '@solid-primitives/utils';
import { isServer } from 'solid-js/web';
import { createHydratableSingletonRoot } from '@solid-primitives/rootless';
import { createEffect, sharedConfig, onMount, createComputed } from 'solid-js';
import { createStaticStore, createDerivedStaticStore } from '@solid-primitives/static-store';
import { createEffect, sharedConfig, createSignal, onMount } from 'solid-js';

@@ -125,24 +126,14 @@ // src/common.ts

}
const isFn = typeof element === "function";
const calcState = (el) => {
const isFn = typeof element === "function", isHydrating = sharedConfig.context, getEl = asAccessor(element), [shouldFallback, setShouldFallback] = createSignal(!!isHydrating, { equals: false });
if (isHydrating || isFn)
onMount(() => setShouldFallback(false));
return createDerivedStaticStore(() => {
let el;
if (shouldFallback() || !(el = getEl()))
return fallback;
const { x, y } = pos();
return getPositionToElement(x, y, el);
};
const [state, setState] = createStaticStore(
isFn || sharedConfig.context ? fallback : calcState(element)
);
const getState = isFn ? () => {
const el = element();
return el ? calcState(el) : fallback;
} : calcState.bind(void 0, element), updateState = () => setState(getState());
if (sharedConfig.context) {
onMount(() => createComputed(updateState));
} else {
createComputed(updateState);
if (isFn)
onMount(updateState);
}
return state;
});
}
export { createMousePosition, createPositionToElement, getPositionInElement, getPositionToElement, getPositionToScreen, makeMouseInsideListener, makeMousePositionListener, useMousePosition };
{
"name": "@solid-primitives/mouse",
"version": "2.0.10",
"version": "2.0.11",
"description": "A collection of Solid Primitives, that capture current mouse cursor position, and help to deal with common related usecases.",

@@ -46,8 +46,9 @@ "author": "Damian Tarnawski <gthetarnav@gmail.com>",

"devDependencies": {
"@solid-primitives/raf": "^2.1.9"
"@solid-primitives/raf": "^2.1.10"
},
"dependencies": {
"@solid-primitives/event-listener": "^2.2.9",
"@solid-primitives/rootless": "^1.3.1",
"@solid-primitives/utils": "^5.5.1"
"@solid-primitives/event-listener": "^2.2.10",
"@solid-primitives/rootless": "^1.3.2",
"@solid-primitives/static-store": "^0.0.2",
"@solid-primitives/utils": "^6.0.0"
},

@@ -54,0 +55,0 @@ "peerDependencies": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc