Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
svelte-movable
Advanced tools
use:movable
While mousedown
of the trigger button
element
mousemove
will trigger div
to move accordingly; a CustomEvent
movablestart
is dispatched,containerNode
, plus and minus 20% of the width & height of the div
that the action is being used on,mouseup
will stop the movement; a CustomEvent
movableend
is dispatched.<script lang="ts">
import arrows from 'svelte-awesome/icons/arrows';
import Icon from 'svelte-awesome/components/Icon.svelte';
let modal = false;
let triggerNode: HTMLElement;
</script>
<container>
<!-- ... some other content ... -->
{#if modal}
<div
transition:fade={{ duration: 200 }}
class="absolute top-1/2 left-1/2 -translate-y-1/2 -translate-x-1/2 w-full max-w-sm"
use:movable={{
limit: {
delta: '20%',
parent: containerNode,
},
trigger: triggerNode,
}}
on:movablestart={(node) => console.log('movable:start', node)}
on:movableend={(node) => console.log('movable:end', node)}
>
<button
bind:this={triggerNode}
class="c-btn-icon absolute top-2 right-10 hover:cursor-move"
>
<Icon data={arrows} />
</button>
<!-- ... some other modal content ... -->
</div>
{/if}
</container>
/// <reference types="@sveltejs/kit" />
/// <reference types="svelte" />
// Typescript support in svelte-kit, see
// https://github.com/sveltejs/language-tools/blob/master/docs/preprocessors/typescript.md#im-using-an-attributeevent-on-a-dom-element-and-it-throws-a-type-error
declare namespace svelte.JSX {
interface HTMLAttributes<T> {
// on:movablestart
onmovablestart?: (event: CustomEvent<HTMLElement>) => void;
// on:movableend
onmovableend?: (event: CustomEvent<HTMLElement>) => void;
}
}
For detailed documentation, see the extracted API.
Quick access to the parameter interface accepted by the action: MovableParameters.
Note: action accepts Partial<MovableParameters>
. By default you don't need to provide any option.
separate helper methods & implement unit tests
add field test for svelte kit (integration)
CI workflow (github action)
FAQs
Action to move node on mousedown & mousemove
The npm package svelte-movable receives a total of 4 weekly downloads. As such, svelte-movable popularity was classified as not popular.
We found that svelte-movable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.