@marianmeres/stuic 1.25.0 → 1.26.0

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.
@@ -50,7 +50,7 @@ export declare const createAlertConfirmPromptStore: () => {
50
50
  confirm: (onOk: FnOnOK, o?: Partial<Dialog>) => void;
51
51
  prompt: (onOk: FnOnOK, o?: Partial<Dialog>) => void;
52
52
  };
53
- export declare const createAlert: (acp: ReturnType<typeof createAlertConfirmPromptStore>) => (message: string, o?: Partial<Dialog>) => Promise<unknown>;
54
- export declare const createConfirm: (acp: ReturnType<typeof createAlertConfirmPromptStore>) => (message: string, o?: Partial<Dialog>) => Promise<unknown>;
55
- export declare const createPrompt: (acp: ReturnType<typeof createAlertConfirmPromptStore>) => (message: string, defaultValue?: string, o?: Partial<Dialog>) => Promise<unknown>;
53
+ export declare const createAlert: (acp: ReturnType<typeof createAlertConfirmPromptStore>, defaults?: Partial<Dialog>) => (message: string, o?: Partial<Dialog>) => Promise<unknown>;
54
+ export declare const createConfirm: (acp: ReturnType<typeof createAlertConfirmPromptStore>, defaults?: Partial<Dialog>) => (message: string, o?: Partial<Dialog>) => Promise<unknown>;
55
+ export declare const createPrompt: (acp: ReturnType<typeof createAlertConfirmPromptStore>, defaults?: Partial<Dialog>) => (message: string, defaultValue?: string, o?: Partial<Dialog>) => Promise<unknown>;
56
56
  export {};
@@ -80,9 +80,10 @@ export const createAlertConfirmPromptStore = () => {
80
80
  };
81
81
  };
82
82
  // sugar helpers to patch the native window.alert/confirm/prompt
83
- export const createAlert = (acp) =>
83
+ export const createAlert = (acp, defaults) =>
84
84
  // allowing to add the custom param outside of the native signature
85
85
  (message, o) => new Promise((resolve) => acp.alert({
86
+ ...(defaults || {}),
86
87
  onOk: () => {
87
88
  acp.close();
88
89
  resolve(undefined);
@@ -94,12 +95,13 @@ export const createAlert = (acp) =>
94
95
  },
95
96
  ...(o || {}),
96
97
  }));
97
- export const createConfirm = (acp) =>
98
+ export const createConfirm = (acp, defaults) =>
98
99
  // allowing to add the custom param outside of the native signature
99
100
  (message, o) => new Promise((resolve) => acp.confirm(() => {
100
101
  acp.close();
101
102
  resolve(true);
102
103
  }, {
104
+ ...(defaults || {}),
103
105
  content: message,
104
106
  onCancel: () => {
105
107
  acp.close();
@@ -111,12 +113,13 @@ export const createConfirm = (acp) =>
111
113
  },
112
114
  ...(o || {}),
113
115
  }));
114
- export const createPrompt = (acp) =>
116
+ export const createPrompt = (acp, defaults) =>
115
117
  // allowing to add the custom param outside of the native signature
116
118
  (message, defaultValue = '', o) => new Promise((resolve) => acp.prompt((value) => {
117
119
  acp.close();
118
120
  resolve(value);
119
121
  }, {
122
+ ...(defaults || {}),
120
123
  content: message,
121
124
  value: defaultValue,
122
125
  onCancel: () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "1.25.0",
3
+ "version": "1.26.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package && node ./scripts/date.js",