@axium/client 0.4.3 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export declare function copy(type: string, ...parts: BlobPart[]): Promise<void>;
@@ -0,0 +1,5 @@
1
+ export async function copy(type, ...parts) {
2
+ const blob = new Blob(parts, { type });
3
+ const item = new ClipboardItem({ [type]: blob });
4
+ await navigator.clipboard.write([item]);
5
+ }
@@ -2,15 +2,14 @@
2
2
  import { fade } from 'svelte/transition';
3
3
  import { wait } from 'utilium';
4
4
  import Icon from './Icon.svelte';
5
+ import * as clip from '@axium/client/clipboard';
5
6
 
6
7
  const { value, type = 'text/plain' }: { value: BlobPart; type?: string } = $props();
7
8
 
8
9
  let success = $state(false);
9
10
 
10
11
  async function onclick() {
11
- const blob = new Blob([value], { type });
12
- const item = new ClipboardItem({ [type]: blob });
13
- await navigator.clipboard.write([item]);
12
+ await clip.copy(type, value);
14
13
  success = true;
15
14
  await wait(3000);
16
15
  success = false;
package/lib/tsconfig.json CHANGED
@@ -4,7 +4,8 @@
4
4
  "target": "ES2023",
5
5
  "strict": true,
6
6
  "rootDir": ".",
7
- "lib": ["ESNext", "DOM", "DOM.Iterable"]
7
+ "lib": ["ESNext", "DOM", "DOM.Iterable"],
8
+ "types": ["@sveltejs/kit"]
8
9
  },
9
10
  "include": ["./**/*"],
10
11
  "references": [{ "path": ".." }]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/client",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "author": "James Prevett <jp@jamespre.dev>",
5
5
  "funding": {
6
6
  "type": "individual",