Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
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 0 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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.