@svelteuidev/composables
Advanced tools
Comparing version 0.11.1 to 0.12.0
@@ -7,2 +7,8 @@ /** | ||
* ``` | ||
* or | ||
* | ||
* ```tsx | ||
* <button use:clipboard={() => `This text will be copied at ${new Date().toUTCString()}`}>Copy Me</button> | ||
* ``` | ||
* | ||
* @param text - The text that you want to be copied when the DOM element is clicked | ||
@@ -13,6 +19,7 @@ * @see https://svelteui.org/actions/use-clipboard | ||
const click = async () => { | ||
if (text) | ||
const detailText = typeof text === 'function' ? text() : text; | ||
if (detailText) | ||
try { | ||
await navigator.clipboard.writeText(text); | ||
node.dispatchEvent(new CustomEvent('useclipboard', { detail: text })); | ||
await navigator.clipboard.writeText(detailText); | ||
node.dispatchEvent(new CustomEvent('useclipboard', { detail: detailText })); | ||
} | ||
@@ -19,0 +26,0 @@ catch (e) { |
{ | ||
"name": "@svelteuidev/composables", | ||
"version": "0.11.1", | ||
"version": "0.12.0", | ||
"description": "Svelte actions and utilities library", | ||
@@ -51,9 +51,9 @@ "keywords": [ | ||
"prettier-plugin-svelte": "2.7.0", | ||
"svelte": "3.55.0", | ||
"svelte": "3.58.0", | ||
"svelte-check": "3.0.2", | ||
"svelte-loader": "3.1.3", | ||
"svelte-preprocess": "4.10.6", | ||
"svelte-loader": "3.1.7", | ||
"svelte-preprocess": "4.10.7", | ||
"tslib": "2.3.1", | ||
"typescript": "4.7.4", | ||
"vite": "3.2.2" | ||
"vite": "4.3.1" | ||
}, | ||
@@ -64,3 +64,2 @@ "exports": { | ||
"./actions/use-click-outside": "./actions/use-click-outside/index.js", | ||
"./actions/use-click-outside/use-click-outside.stories.svelte": "./actions/use-click-outside/use-click-outside.stories.svelte", | ||
"./actions/use-click-outside/use-click-outside": "./actions/use-click-outside/use-click-outside.js", | ||
@@ -79,3 +78,2 @@ "./actions/use-clipboard": "./actions/use-clipboard/index.js", | ||
"./actions/use-focus-trap/tabbable": "./actions/use-focus-trap/tabbable.js", | ||
"./actions/use-focus-trap/use-focus-trap.stories.svelte": "./actions/use-focus-trap/use-focus-trap.stories.svelte", | ||
"./actions/use-focus-trap/use-focus-trap": "./actions/use-focus-trap/use-focus-trap.js", | ||
@@ -100,3 +98,2 @@ "./actions/use-hot-key": "./actions/use-hot-key/index.js", | ||
"./actions/use-move": "./actions/use-move/index.js", | ||
"./actions/use-move/use-move.stories.svelte": "./actions/use-move/use-move.stories.svelte", | ||
"./actions/use-move/use-move": "./actions/use-move/use-move.js", | ||
@@ -140,3 +137,2 @@ "./actions/use-page-leave": "./actions/use-page-leave/index.js", | ||
"./utilities/use-debounce": "./utilities/use-debounce/index.js", | ||
"./utilities/use-debounce/use-debounce.stories.svelte": "./utilities/use-debounce/use-debounce.stories.svelte", | ||
"./utilities/use-debounce/use-debounce": "./utilities/use-debounce/use-debounce.js", | ||
@@ -152,3 +148,2 @@ "./utilities/use-deep-search": "./utilities/use-deep-search/index.js", | ||
"./utilities/use-focus-return": "./utilities/use-focus-return/index.js", | ||
"./utilities/use-focus-return/use-focus-return.stories.svelte": "./utilities/use-focus-return/use-focus-return.stories.svelte", | ||
"./utilities/use-focus-return/use-focus-return": "./utilities/use-focus-return/use-focus-return.js", | ||
@@ -155,0 +150,0 @@ "./utilities/use-focus-within": "./utilities/use-focus-within/index.js", |
@@ -8,5 +8,11 @@ import type { Action } from '../../shared/actions/types'; | ||
* ``` | ||
* or | ||
* | ||
* ```tsx | ||
* <button use:clipboard={() => `This text will be copied at ${new Date().toUTCString()}`}>Copy Me</button> | ||
* ``` | ||
* | ||
* @param text - The text that you want to be copied when the DOM element is clicked | ||
* @see https://svelteui.org/actions/use-clipboard | ||
*/ | ||
export declare function clipboard(node: HTMLElement, text: string): ReturnType<Action>; | ||
export declare function clipboard(node: HTMLElement, text: string | (() => string)): ReturnType<Action>; |
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
104513
223
2595