layerpro 3.0.1 → 3.1.1

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "layerpro",
3
3
  "codeName": "layerpro",
4
- "version": "3.0.1",
4
+ "version": "3.1.1",
5
5
  "description": "The real custom modals, alert, confirm, prompt... for your browser",
6
6
  "main": "./index.cjs",
7
7
  "browser": "./index.js",
@@ -4,16 +4,21 @@
4
4
  /// <reference types="react" />
5
5
 
6
6
  /** Generate custom alert using alert([text]) */
7
- declare function alert(f1?: string): any
7
+ declare function alert(f1?: string): void
8
8
 
9
- /** Generate custom confirm using confirm([text],[callback for YES],[optional callback for NO]) */
10
- declare function confirm(message: string, func1: Function, func2?: Function): boolean
9
+ /** Generate custom confirm using confirm([text],[callback for YES],[optional callback for NO])
10
+ * WARNING: This overrides the native confirm(). The return value is NOT a usable
11
+ * boolean — callbacks are invoked asynchronously instead. Never rely on the
12
+ * return value; use the yes/no callbacks. */
13
+ declare function confirm(message: string, func1: (yes: boolean) => void, func2?: (no: boolean) => void): void
11
14
 
12
15
  /** Generate custom message using message([text],[callback]) and option callback */
13
- declare function message(f1?: string, func1?: Function): any
16
+ declare function message(f1?: string, func1?: () => void): void
14
17
 
15
- /** Generate custom message using message([text],[callback]) and option callback */
16
- declare function prompt(f1?: string, func1?: Function): any
18
+ /** Generate custom prompt using prompt([text],[callback]) and option callback
19
+ * WARNING: This overrides the native prompt(). The return value is NOT a usable
20
+ * string — use the callback to receive the input. */
21
+ declare function prompt(f1?: string, func1?: (input: string) => void): void
17
22
 
18
23
  ///
19
24
 
@@ -62,7 +67,9 @@ interface GenLayerProps {
62
67
  resizable?: boolean
63
68
  close?: boolean
64
69
  raised?: boolean
70
+ modal?: boolean
65
71
  iconize?: boolean
72
+ center?: boolean
66
73
 
67
74
  source?: string
68
75
  store?: any
@@ -77,26 +84,29 @@ interface _layerpro {
77
84
  [key: string]: any
78
85
 
79
86
  readonly alert: (txt: string) => void
80
- readonly prompt: (txt: string, callback: (input: string) => void, event: Event) => void
87
+ readonly prompt: (txt: string, callback: (input: string) => void) => void
81
88
  readonly message: (txt: string, callback: () => void) => void
82
- readonly confirm: (txt: string, yesCallback: () => void, noCallback: () => void) => void
89
+ readonly confirm: (txt: string, yesCallback: () => void, noCallback?: () => void) => void
83
90
  readonly credits: (txt: string) => void
84
91
 
85
- setProps: (obj, options?) => void
92
+ setProps: (obj: Record<string, unknown>, options?: { enumerable?: boolean, writable?: boolean }) => void
93
+
94
+ /** Remove the global alert/confirm/prompt/message overrides and restore
95
+ * the native browser implementations. Call this right after importing
96
+ * LayerPro if your codebase depends on synchronous native globals. */
97
+ readonly noGlobals: () => void
86
98
 
87
99
  readonly popup: {
88
100
  open: (props: GenLayerProps) => GenLayerProps
89
- center: (props: any) => void
90
- maximize: (props: any) => void
91
- iconize: (props: any) => void
92
- raised: (props: any) => void
93
- movable: (props: any) => void
94
- resizable: (props: any) => void
95
- dockable: (props: any) => void
96
- store: (props: any) => void
97
- index: (props: any) => void
98
- zIndex: (props?: any) => number
99
- close: (props: any) => any
101
+ center: (id: string | number | GenLayerProps, offset?: number) => void
102
+ maximize: (props: GenLayerProps) => void
103
+ iconize: (id: string | number | GenLayerProps) => void
104
+ movable: (props: GenLayerProps) => void
105
+ resizable: (props: GenLayerProps) => void
106
+ store: (element: unknown) => void
107
+ index: (id: string | number | GenLayerProps) => void
108
+ zIndex: (props?: GenLayerProps) => number
109
+ close: (id: string | number | GenLayerProps) => void
100
110
  // React root management for memory cleanup
101
111
  unmount: (id: string) => void
102
112
  getReactRoot: (id: string) => any
@@ -106,13 +116,17 @@ interface _layerpro {
106
116
 
107
117
  }
108
118
 
119
+ /**
120
+ * LayerPro overrides the native alert/confirm/prompt globals and adds a
121
+ * `message` global. They are callback-based and do NOT return native values.
122
+ * Call `layerpro.noGlobals()` to restore the synchronous natives.
123
+ */
109
124
  interface Window {
110
- [key: string]: any
111
- }
112
-
113
- interface globalThis {
114
- [key: string]: any
125
+ layerpro: _layerpro
115
126
  }
116
127
 
117
128
  declare var layerpro: _layerpro
118
129
  type layerpro = _layerpro
130
+
131
+ declare var popup: layerpro
132
+ type popup = layerpro