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

@svelteuidev/actions

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@svelteuidev/actions - npm Package Compare versions

Comparing version 0.6.0 to 0.6.2

2

dist/use-click-outside/use-click-outside.js

@@ -27,3 +27,3 @@ /**

* @param params - Object that contains two properties {enabled: boolean, callback: (any) => unknown}
* @see https://svelteui-docs.vercel.app/docs/actions/use-click-outside
* @see https://svelteui.org/actions/use-click-outside
*/

@@ -30,0 +30,0 @@ export function clickoutside(node, params) {

@@ -8,3 +8,3 @@ /**

* @param text - The text that you want to be copied when the DOM element is clicked
* @see https://svelteui-docs.vercel.app/docs/actions/use-clipboard
* @see https://svelteui.org/actions/use-clipboard
*/

@@ -11,0 +11,0 @@ export function clipboard(node, text) {

@@ -29,3 +29,3 @@ /**

* @param props - A reactive object with properties that should be treated as css custom properties.
* @see https://svelteui-docs.vercel.app/docs/actions/use-css-variable
* @see https://svelteui.org/actions/use-css-variable
*/

@@ -32,0 +32,0 @@ export function cssvariable(node, props) {

@@ -9,3 +9,3 @@ import { tick } from 'svelte';

* @param params - Object that contains two properties {blob: Blob, filename: string}
* @see https://svelteui-docs.vercel.app/docs/actions/use-download
* @see https://svelteui.org/actions/use-download
*/

@@ -12,0 +12,0 @@ export function download(node, params) {

@@ -7,3 +7,3 @@ /**

* ```
* @see https://svelteui-docs.vercel.app/docs/actions/use-focus
* @see https://svelteui.org/actions/use-focus
*/

@@ -10,0 +10,0 @@ export function focus(node) {

@@ -24,3 +24,3 @@ const nodeAttributesMap = new WeakMap();

* @param attributes - an object whose properties are the attributes to be applied, and the values are the attr values
* @see https://svelteui-docs.vercel.app/docs/actions/use-lazy
* @see https://svelteui.org/actions/use-lazy
*/

@@ -27,0 +27,0 @@ export function lazy(node, attributes) {

/**
* Creates `long press` event when mousedown is above the `duration` milliseconds..
* Creates `long press` event when mousedown or touchstart is above the `duration` milliseconds.
*

@@ -10,7 +10,7 @@ * ```tsx

* @param duration - The duration until the longpress event is dispatched
* @see https://svelteui-docs.vercel.app/docs/actions/use-longpress
* @see https://svelteui.org/actions/use-longpress
*/
export function longpress(node, duration) {
let timer;
function handleMouseDown() {
function handlePress() {
timer = window.setTimeout(() => {

@@ -20,18 +20,22 @@ node.dispatchEvent(new CustomEvent('uselongpress'));

}
function handleMouseUp() {
function handleRelease() {
clearTimeout(timer);
}
node.addEventListener('mousedown', handleMouseDown);
node.addEventListener('mouseup', handleMouseUp);
node.addEventListener('mousedown', handlePress);
node.addEventListener('mouseup', handleRelease);
node.addEventListener('touchstart', handlePress);
node.addEventListener('touchend', handleRelease);
return {
update(newDuration) {
handleMouseUp();
handleRelease();
duration = newDuration;
},
destroy() {
handleMouseUp();
node.removeEventListener('mousedown', handleMouseDown);
node.removeEventListener('mouseup', handleMouseUp);
handleRelease();
node.removeEventListener('mousedown', handlePress);
node.removeEventListener('mouseup', handleRelease);
node.removeEventListener('touchstart', handlePress);
node.removeEventListener('touchstart', handleRelease);
}
};
}

@@ -8,3 +8,3 @@ /**

* @param enabled - Determines whether the action should execute or not.
* @see https://svelteui-docs.vercel.app/docs/actions/use-persistenttab
* @see https://svelteui.org/actions/use-persistenttab
*/

@@ -11,0 +11,0 @@ export function persistenttab(node, enabled) {

@@ -7,3 +7,3 @@ // adapted from romkor/svelte-portal

* @param target- DOM element or CSS selector to be appended to
* @see https://svelteui-docs.vercel.app/docs/actions/use-portal
* @see https://svelteui.org/actions/use-portal
*/

@@ -10,0 +10,0 @@ export function portal(node, target = 'body') {

{
"name": "@svelteuidev/actions",
"version": "0.6.0",
"description": "Svelte actions library with useful lifecycle functions (aka actions).",
"keywords": [
"svelte",
"sveltekit",
"svelteui",
"library",
"frontend",
"svelte-actions",
"actions",
"state",
"dom"
],
"homepage": "https://svelteui-docs.vercel.app",
"repository": {
"type": "git",
"url": "https://github.com/svelteuidev/svelteui.git",
"directory": "packages/svelteui-actions"
},
"license": "MIT",
"author": "Kamell Perry <kamellperry33@gmail.com>",
"sideEffects": false,
"type": "module",
"types": "types/index.d.ts",
"files": [
"index.js",
"dist/**/*.{js,svelte}",
"types/**/*.d.ts"
],
"devDependencies": {
"@sveltejs/kit": "1.0.0-next.310",
"@svelteuidev/tsconfig": "^*",
"@testing-library/svelte": "3.1.1",
"autoprefixer": "10.4.4",
"cssnano": "5.1.7",
"jsdom": "19.0.0",
"postcss": "8.4.12",
"sass": "1.50.0",
"svelte": "3.47.0",
"svelte-check": "2.5.0",
"svelte-preprocess": "4.10.5",
"svelte2tsx": "0.5.7",
"tslib": "2.3.1",
"typescript": "4.6.3"
},
"exports": {
"./package.json": "./package.json",
"./dist": "./dist/index.js",
"./dist/use-click-outside": "./dist/use-click-outside/index.js",
"./dist/use-click-outside/use-click-outside": "./dist/use-click-outside/use-click-outside.js",
"./dist/use-clipboard": "./dist/use-clipboard/index.js",
"./dist/use-clipboard/use-clipboard": "./dist/use-clipboard/use-clipboard.js",
"./dist/use-css-variable": "./dist/use-css-variable/index.js",
"./dist/use-css-variable/use-css-variable": "./dist/use-css-variable/use-css-variable.js",
"./dist/use-download": "./dist/use-download/index.js",
"./dist/use-download/use-download": "./dist/use-download/use-download.js",
"./dist/use-focus": "./dist/use-focus/index.js",
"./dist/use-focus/use-focus": "./dist/use-focus/use-focus.js",
"./dist/use-hot-key": "./dist/use-hot-key/index.js",
"./dist/use-hot-key/parse-hotkey": "./dist/use-hot-key/parse-hotkey.js",
"./dist/use-hot-key/use-hot-key": "./dist/use-hot-key/use-hot-key.js",
"./dist/use-lazy": "./dist/use-lazy/index.js",
"./dist/use-lazy/use-lazy": "./dist/use-lazy/use-lazy.js",
"./dist/use-long-press": "./dist/use-long-press/index.js",
"./dist/use-long-press/use-long-press": "./dist/use-long-press/use-long-press.js",
"./dist/use-page-leave": "./dist/use-page-leave/index.js",
"./dist/use-page-leave/use-page-leave": "./dist/use-page-leave/use-page-leave.js",
"./dist/use-persistent-tab": "./dist/use-persistent-tab/index.js",
"./dist/use-persistent-tab/use-persistent-tab": "./dist/use-persistent-tab/use-persistent-tab.js",
"./dist/use-portal": "./dist/use-portal/index.js",
"./dist/use-portal/use-portal": "./dist/use-portal/use-portal.js",
"./dist/use-tab-leave": "./dist/use-tab-leave/index.js",
"./dist/use-tab-leave/use-tab-leave": "./dist/use-tab-leave/use-tab-leave.js",
".": "./index.js"
}
}
"name": "@svelteuidev/actions",
"version": "0.6.2",
"description": "Svelte actions library with useful lifecycle functions (aka actions).",
"keywords": [
"svelte",
"sveltekit",
"svelteui",
"library",
"frontend",
"svelte-actions",
"actions",
"state",
"dom"
],
"main": "index.js",
"module": "index.js",
"homepage": "https://svelteui.org",
"repository": {
"type": "git",
"url": "https://https://github.com/svelteuidev/svelteui",
"directory": "packages/svelteui-actions"
},
"license": "MIT",
"author": "Kamell Perry <kamellperry33@gmail.com>",
"sideEffects": false,
"type": "module",
"types": "types/index.d.ts",
"files": [
"index.js",
"dist/**/*.{js,svelte}",
"types/**/*.d.ts"
],
"devDependencies": {
"@sveltejs/kit": "1.0.0-next.310",
"@svelteuidev/tsconfig": "^*",
"@testing-library/svelte": "3.1.1",
"autoprefixer": "10.4.4",
"cssnano": "5.1.7",
"jsdom": "19.0.0",
"postcss": "8.4.12",
"sass": "1.50.0",
"svelte": "3.47.0",
"svelte-check": "2.5.0",
"svelte-preprocess": "4.10.5",
"svelte2tsx": "0.5.7",
"tslib": "2.3.1",
"typescript": "4.6.3"
},
"exports": {
"./package.json": "./package.json",
"./dist": "./dist/index.js",
"./dist/use-click-outside": "./dist/use-click-outside/index.js",
"./dist/use-click-outside/use-click-outside": "./dist/use-click-outside/use-click-outside.js",
"./dist/use-clipboard": "./dist/use-clipboard/index.js",
"./dist/use-clipboard/use-clipboard": "./dist/use-clipboard/use-clipboard.js",
"./dist/use-css-variable": "./dist/use-css-variable/index.js",
"./dist/use-css-variable/use-css-variable": "./dist/use-css-variable/use-css-variable.js",
"./dist/use-download": "./dist/use-download/index.js",
"./dist/use-download/use-download": "./dist/use-download/use-download.js",
"./dist/use-focus": "./dist/use-focus/index.js",
"./dist/use-focus/use-focus": "./dist/use-focus/use-focus.js",
"./dist/use-hot-key": "./dist/use-hot-key/index.js",
"./dist/use-hot-key/parse-hotkey": "./dist/use-hot-key/parse-hotkey.js",
"./dist/use-hot-key/use-hot-key": "./dist/use-hot-key/use-hot-key.js",
"./dist/use-lazy": "./dist/use-lazy/index.js",
"./dist/use-lazy/use-lazy": "./dist/use-lazy/use-lazy.js",
"./dist/use-long-press": "./dist/use-long-press/index.js",
"./dist/use-long-press/use-long-press": "./dist/use-long-press/use-long-press.js",
"./dist/use-page-leave": "./dist/use-page-leave/index.js",
"./dist/use-page-leave/use-page-leave": "./dist/use-page-leave/use-page-leave.js",
"./dist/use-persistent-tab": "./dist/use-persistent-tab/index.js",
"./dist/use-persistent-tab/use-persistent-tab": "./dist/use-persistent-tab/use-persistent-tab.js",
"./dist/use-portal": "./dist/use-portal/index.js",
"./dist/use-portal/use-portal": "./dist/use-portal/use-portal.js",
"./dist/use-tab-leave": "./dist/use-tab-leave/index.js",
"./dist/use-tab-leave/use-tab-leave": "./dist/use-tab-leave/use-tab-leave.js",
".": "./index.js"
}
}

@@ -10,3 +10,3 @@ # SvelteUI Actions

[See full documentation on svelteui website](https://svelteui-docs.vercel.app/)
[See full documentation on svelteui website](https://svelteui.org/)

@@ -25,6 +25,14 @@ ## Installation

- [use-click-outside](https://svelteui-docs.vercel.app/docs/actions/use-click-outside) – Triggers a callback when a user clicks outside of a given element.
- [use-clipboard](https://svelteui-docs.vercel.app/docs/actions/use-clipboard) - Copies text to the clipboard when dom element is clicked
- [use-css-variable](https://svelteui-docs.vercel.app/docs/actions/use-css-variable) - Update css properties on the fly whenever some of their values change.
- [use-focus](https://svelteui-docs.vercel.app/docs/actions/use-focus) - Calls focus on a node once mounted into the dom
- [use-click-outside](https://svelteui.org/actions/use-click-outside) – Triggers a callback when a user clicks outside of a given element
- [use-clipboard](https://svelteui.org/actions/use-clipboard) - Copies text to the clipboard when DOM element is clicked
- [use-css-variable](https://svelteui.org/actions/use-css-variable) - Update css properties on the fly whenever some of their values change
- [use-download](https://svelteui.org/actions/use-download) - Causes a download to occur with a given Blob object
- [use-focus](https://svelteui.org/actions/use-focus) - Calls focus on a node once mounted into the DOM
- [use-hot-key](https://svelteui.org/actions/use-hot-key) - Calls focus on a node once mounted into the DOM
- [use-lazy](https://svelteui.org/actions/use-lazy) - Lazily attach properties to any DOM element when it is in the window
- [use-long-press](https://svelteui.org/actions/use-long-press) - Creates a longpress event when mousedown is above a duration in milliseconds
- [use-page-leave](https://svelteui.org/actions/use-page-leave) - Prevent current tab from being closed by user
- [use-persistent-tab](https://svelteui.org/actions/use-persistent-tab) - Render an element or component anywhere in the DOM
- [use-portal](https://svelteui.org/actions/use-portal) - Call function when mouse leaves the page
- [use-tab-leave](https://svelteui.org/actions/use-tab-leave) - Call a function when the current tab is switched

@@ -31,0 +39,0 @@ ## License

@@ -28,3 +28,3 @@ import type { Action } from '../types/ActionTypes';

* @param params - Object that contains two properties {enabled: boolean, callback: (any) => unknown}
* @see https://svelteui-docs.vercel.app/docs/actions/use-click-outside
* @see https://svelteui.org/actions/use-click-outside
*/

@@ -31,0 +31,0 @@ export declare function clickoutside(node: HTMLElement, params: {

@@ -9,4 +9,4 @@ import type { Action } from '../types/ActionTypes';

* @param text - The text that you want to be copied when the DOM element is clicked
* @see https://svelteui-docs.vercel.app/docs/actions/use-clipboard
* @see https://svelteui.org/actions/use-clipboard
*/
export declare function clipboard(node: HTMLElement, text: string): ReturnType<Action>;

@@ -30,4 +30,4 @@ import type { Action, UnknownKeyString } from '../types/ActionTypes';

* @param props - A reactive object with properties that should be treated as css custom properties.
* @see https://svelteui-docs.vercel.app/docs/actions/use-css-variable
* @see https://svelteui.org/actions/use-css-variable
*/
export declare function cssvariable(node: HTMLElement, props: UnknownKeyString<string>): ReturnType<Action>;

@@ -9,3 +9,3 @@ import type { Action } from '../types/ActionTypes';

* @param params - Object that contains two properties {blob: Blob, filename: string}
* @see https://svelteui-docs.vercel.app/docs/actions/use-download
* @see https://svelteui.org/actions/use-download
*/

@@ -12,0 +12,0 @@ export declare function download(node: HTMLElement, params: {

@@ -8,4 +8,4 @@ import type { Action, FocusableElement } from '../types/ActionTypes';

* ```
* @see https://svelteui-docs.vercel.app/docs/actions/use-focus
* @see https://svelteui.org/actions/use-focus
*/
export declare function focus(node: FocusableElement): ReturnType<Action>;

@@ -10,4 +10,4 @@ import type { Action } from '../types';

* @param attributes - an object whose properties are the attributes to be applied, and the values are the attr values
* @see https://svelteui-docs.vercel.app/docs/actions/use-lazy
* @see https://svelteui.org/actions/use-lazy
*/
export declare function lazy(node: HTMLElement, attributes: Record<string, number | string>): ReturnType<Action>;
import type { Action } from '../types';
/**
* Creates `long press` event when mousedown is above the `duration` milliseconds..
* Creates `long press` event when mousedown or touchstart is above the `duration` milliseconds.
*

@@ -11,4 +11,4 @@ * ```tsx

* @param duration - The duration until the longpress event is dispatched
* @see https://svelteui-docs.vercel.app/docs/actions/use-longpress
* @see https://svelteui.org/actions/use-longpress
*/
export declare function longpress(node: HTMLElement, duration: number): ReturnType<Action>;

@@ -9,4 +9,4 @@ import type { Action } from '../types';

* @param enabled - Determines whether the action should execute or not.
* @see https://svelteui-docs.vercel.app/docs/actions/use-persistenttab
* @see https://svelteui.org/actions/use-persistenttab
*/
export declare function persistenttab(node: HTMLElement, enabled: boolean): ReturnType<Action>;

@@ -7,5 +7,5 @@ import type { Action } from '../types';

* @param target- DOM element or CSS selector to be appended to
* @see https://svelteui-docs.vercel.app/docs/actions/use-portal
* @see https://svelteui.org/actions/use-portal
*/
export declare function portal(node: HTMLElement, target?: Target): ReturnType<Action>;
export {};
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