@hyvor/design 0.0.61 → 0.0.62

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.
@@ -23,6 +23,7 @@ $: {
23
23
  title={$confirmStore.title}
24
24
  bind:show={show}
25
25
  size="small"
26
+ loading={$confirmStore.loading}
26
27
  >
27
28
 
28
29
  {#if typeof $confirmStore.content === "string"}
@@ -6,11 +6,16 @@ interface ConfirmConfig {
6
6
  confirmText?: string;
7
7
  cancelText?: string;
8
8
  danger?: boolean;
9
+ loading?: boolean | string;
10
+ autoClose?: boolean;
9
11
  }
10
12
  interface ConfirmStore extends ConfirmConfig {
11
13
  onConfirm: () => void;
12
14
  onCancel: () => void;
13
15
  }
14
16
  export declare const confirmStore: import("svelte/store").Writable<ConfirmStore | null>;
15
- export declare function confirm(config: ConfirmConfig): Promise<boolean>;
17
+ export declare function confirm(config: ConfirmConfig): Promise<false | {
18
+ loading: (status?: string | boolean) => void;
19
+ close: () => void;
20
+ }>;
16
21
  export {};
@@ -2,17 +2,32 @@ import {} from "svelte";
2
2
  import { writable } from "svelte/store";
3
3
  export const confirmStore = writable(null);
4
4
  export function confirm(config) {
5
+ function getOptions() {
6
+ return {
7
+ loading: (status = true) => {
8
+ confirmStore.update((store) => {
9
+ if (store) {
10
+ store.loading = status;
11
+ }
12
+ return store;
13
+ });
14
+ },
15
+ close: () => confirmStore.set(null),
16
+ };
17
+ }
5
18
  return new Promise((resolve, reject) => {
6
19
  confirmStore.set({
7
20
  ...config,
8
21
  onConfirm: () => {
9
- resolve(true);
10
- confirmStore.set(null);
22
+ if (config.autoClose !== false) {
23
+ confirmStore.set(null);
24
+ }
25
+ resolve(getOptions());
11
26
  },
12
27
  onCancel: () => {
13
28
  resolve(false);
14
29
  confirmStore.set(null);
15
- }
30
+ },
16
31
  });
17
32
  });
18
33
  }
package/package.json CHANGED
@@ -1,60 +1,60 @@
1
1
  {
2
- "name": "@hyvor/design",
3
- "version": "0.0.61",
4
- "license": "MIT",
5
- "private": false,
6
- "scripts": {
7
- "dev": "vite dev",
8
- "build": "vite build && npm run package",
9
- "preview": "vite preview",
10
- "package": "svelte-kit sync && svelte-package && publint",
11
- "prepublishOnly": "npm run package",
12
- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
13
- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
14
- },
15
- "exports": {
16
- "./components": {
17
- "types": "./dist/components/index.d.ts",
18
- "svelte": "./dist/components/index.js"
19
- },
20
- "./marketing": {
21
- "types": "./dist/marketing/index.d.ts",
22
- "svelte": "./dist/marketing/index.js"
23
- }
24
- },
25
- "files": [
26
- "dist",
27
- "!dist/**/*.test.*",
28
- "!dist/**/*.spec.*"
29
- ],
30
- "peerDependencies": {
31
- "@sveltejs/kit": "^2.0.0",
32
- "sass": "^1.68.0",
33
- "svelte": "^4.0.0"
34
- },
35
- "devDependencies": {
36
- "@sveltejs/adapter-static": "^3.0.0",
37
- "@sveltejs/package": "^2.0.0",
38
- "@sveltejs/vite-plugin-svelte": "^3.0.0",
39
- "publint": "^0.1.9",
40
- "svelte": "^4.0.5",
41
- "svelte-check": "^3.4.3",
42
- "tslib": "^2.4.1",
43
- "typescript": "^5.0.0",
44
- "vite": "^5.0.0"
45
- },
46
- "dependencies": {
47
- "@fontsource/readex-pro": "^5.0.8",
48
- "@hyvor/icons": "^0.0.3",
49
- "deepmerge-ts": "^5.1.0",
50
- "highlight.js": "^11.9.0",
51
- "intl-messageformat": "^10.5.11",
52
- "npm": "^10.4.0",
53
- "svelte-awesome-color-picker": "^3.0.4",
54
- "tocbot": "^4.25.0"
55
- },
56
- "type": "module",
57
- "publishConfig": {
58
- "access": "public"
59
- }
2
+ "name": "@hyvor/design",
3
+ "version": "0.0.62",
4
+ "license": "MIT",
5
+ "private": false,
6
+ "scripts": {
7
+ "dev": "vite dev",
8
+ "build": "vite build && npm run package",
9
+ "preview": "vite preview",
10
+ "package": "svelte-kit sync && svelte-package && publint",
11
+ "prepublishOnly": "npm run package",
12
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
13
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
14
+ },
15
+ "exports": {
16
+ "./components": {
17
+ "types": "./dist/components/index.d.ts",
18
+ "svelte": "./dist/components/index.js"
19
+ },
20
+ "./marketing": {
21
+ "types": "./dist/marketing/index.d.ts",
22
+ "svelte": "./dist/marketing/index.js"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "!dist/**/*.test.*",
28
+ "!dist/**/*.spec.*"
29
+ ],
30
+ "peerDependencies": {
31
+ "@sveltejs/kit": "^2.0.0",
32
+ "sass": "^1.68.0",
33
+ "svelte": "^4.0.0"
34
+ },
35
+ "devDependencies": {
36
+ "@sveltejs/adapter-static": "^3.0.0",
37
+ "@sveltejs/package": "^2.0.0",
38
+ "@sveltejs/vite-plugin-svelte": "^3.0.0",
39
+ "publint": "^0.1.9",
40
+ "svelte": "^4.0.5",
41
+ "svelte-check": "^3.4.3",
42
+ "tslib": "^2.4.1",
43
+ "typescript": "^5.0.0",
44
+ "vite": "^5.0.0"
45
+ },
46
+ "dependencies": {
47
+ "@fontsource/readex-pro": "^5.0.8",
48
+ "@hyvor/icons": "^0.0.3",
49
+ "deepmerge-ts": "^5.1.0",
50
+ "highlight.js": "^11.9.0",
51
+ "intl-messageformat": "^10.5.11",
52
+ "npm": "^10.4.0",
53
+ "svelte-awesome-color-picker": "^3.0.4",
54
+ "tocbot": "^4.25.0"
55
+ },
56
+ "type": "module",
57
+ "publishConfig": {
58
+ "access": "public"
59
+ }
60
60
  }