layerpro 3.3.0 → 3.4.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.
- package/README.md +19 -19
- package/index.cjs +249 -239
- package/index.d.ts +1 -0
- package/index.js +249 -239
- package/llms.txt +55 -55
- package/markdown/GUIDE.md +9 -9
- package/package.json +3 -1
- package/react.d.ts +32 -0
- package/types/layerpro.d.ts +143 -133
package/llms.txt
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
# LayerPro
|
|
2
|
-
|
|
3
|
-
> Dependency-free custom modals (alert, confirm, prompt, message) and advanced
|
|
4
|
-
> popups for the browser. Vanilla DOM (no jQuery); React/react-dom are external
|
|
5
|
-
> and used only to render the modal body. Dockable, draggable, resizable,
|
|
6
|
-
> maximizable (pure CSS), with an OS-style taskbar.
|
|
7
|
-
|
|
8
|
-
## Source
|
|
9
|
-
|
|
10
|
-
- [index.ts](index.ts): Entry point. Sets `window.layerpro` (frozen, non-enumerable), imports SCSS, initializes mode.
|
|
11
|
-
- [core/dom.ts](core/dom.ts): jQuery-free chainable DOM helper (`LpEl`, `lp`, `lpAll`, `lpCreate`, `lpDoc`, `lpWin`)
|
|
12
|
-
- [core/properties.ts](core/properties.ts): The `popup` object
|
|
13
|
-
- [core/genLayer.ts](core/genLayer.ts): DOM builder for a popup, dock/buttons wiring, pointer/click/dblclick handlers.
|
|
14
|
-
- [core/message.ts](core/message.ts): `alert`/`confirm`/`message`/`prompt` implementations; overrides `window.alert`/`confirm`/`prompt` (callback-based, NOT synchronous) and provides `layerpro.noGlobals()` to restore natives.
|
|
15
|
-
- [core/mode.ts](core/mode.ts): Close popups on orientation/size mode switch.
|
|
16
|
-
- [core/mobile.ts](core/mobile.ts): Unified pointer/mouse/touch events (`getPointerDown`/`getPointerMove`/`getPointerUp`).
|
|
17
|
-
- [core/window.ts](core/window.ts): Window-level helpers (scroll, size).
|
|
18
|
-
- [core/credits.ts](core/credits.ts): Credits overlay helper.
|
|
19
|
-
- [core/namespace.ts](core/namespace.ts): Global namespace setup.
|
|
20
|
-
|
|
21
|
-
## Types
|
|
22
|
-
|
|
23
|
-
- [types/layerpro.d.ts](types/layerpro.d.ts): Public TypeScript definitions (`GenLayerProps`, the `layerpro` global, `Window`/`globalThis` augmentations).
|
|
24
|
-
|
|
25
|
-
## Docs
|
|
26
|
-
|
|
27
|
-
- [docs/README.md](docs/README.md): Project README (features, install, quick start).
|
|
28
|
-
- [docs/markdown/GUIDE.md](docs/markdown/GUIDE.md): Example-driven usage guide (modals, popups, dock, maximize, resize, React body, API).
|
|
29
|
-
- [docs/llms.txt](docs/llms.txt): This file.
|
|
30
|
-
|
|
31
|
-
## Build & Config
|
|
32
|
-
|
|
33
|
-
- [package.json](package.json): Manifest. React/react-dom are `devDependencies` (external at runtime); **jQuery removed**. `main`/`browser` → `index.js` (ESM), `exports.import` → `index.js`.
|
|
34
|
-
- [tsup.config.ts](tsup.config.ts): Build (CJS + ESM, terser minify, esbuild-sass-plugin). Externalizes devDependencies.
|
|
35
|
-
- [tsup.plugin.copyStatic.ts](tsup.plugin.copyStatic.ts): Copies static files (README, types, license) into `dist`.
|
|
36
|
-
- [tsup.plugin.injectCss.ts](tsup.plugin.injectCss.ts): Injects compiled SCSS into the bundle.
|
|
37
|
-
|
|
38
|
-
## Key behaviors
|
|
39
|
-
|
|
40
|
-
- **jQuery removed**
|
|
41
|
-
- **React external**
|
|
42
|
-
- **Instant resize**
|
|
43
|
-
- **Maximize is pure CSS**
|
|
44
|
-
- **Dock = OS taskbar**
|
|
45
|
-
- **z-index**
|
|
46
|
-
|
|
47
|
-
## Contributing
|
|
48
|
-
|
|
49
|
-
LayerPro is **open source** and free to use. The current codebase is private, but
|
|
50
|
-
**anyone is welcome to join**. If you would like to contribute, suggest changes,
|
|
51
|
-
or just chat about the project, contact the author:
|
|
52
|
-
|
|
53
|
-
- **Dario Passariello**
|
|
54
|
-
|
|
55
|
-
Participation is voluntary and free; everyone is free to take part.
|
|
1
|
+
# LayerPro
|
|
2
|
+
|
|
3
|
+
> Dependency-free custom modals (alert, confirm, prompt, message) and advanced
|
|
4
|
+
> popups for the browser. Vanilla DOM (no jQuery); React/react-dom are external
|
|
5
|
+
> and used only to render the modal body. Dockable, draggable, resizable,
|
|
6
|
+
> maximizable (pure CSS), with an OS-style taskbar.
|
|
7
|
+
|
|
8
|
+
## Source
|
|
9
|
+
|
|
10
|
+
- [index.ts](index.ts): Entry point. Sets `window.layerpro` (frozen, non-enumerable), imports SCSS, initializes mode.
|
|
11
|
+
- [core/dom.ts](core/dom.ts): jQuery-free chainable DOM helper (`LpEl`, `lp`, `lpAll`, `lpCreate`, `lpDoc`, `lpWin`) - the replacement for jQuery.
|
|
12
|
+
- [core/properties.ts](core/properties.ts): The `popup` object - `open`, `close`, `center`, `maximize`, `iconize`, `index`, `zIndex`, `movable`, `resizable`, `cleanupEvents`, `unmount`.
|
|
13
|
+
- [core/genLayer.ts](core/genLayer.ts): DOM builder for a popup, dock/buttons wiring, pointer/click/dblclick handlers.
|
|
14
|
+
- [core/message.ts](core/message.ts): `alert`/`confirm`/`message`/`prompt` implementations; overrides `window.alert`/`confirm`/`prompt` (callback-based, NOT synchronous) and provides `layerpro.noGlobals()` to restore natives.
|
|
15
|
+
- [core/mode.ts](core/mode.ts): Close popups on orientation/size mode switch.
|
|
16
|
+
- [core/mobile.ts](core/mobile.ts): Unified pointer/mouse/touch events (`getPointerDown`/`getPointerMove`/`getPointerUp`).
|
|
17
|
+
- [core/window.ts](core/window.ts): Window-level helpers (scroll, size).
|
|
18
|
+
- [core/credits.ts](core/credits.ts): Credits overlay helper.
|
|
19
|
+
- [core/namespace.ts](core/namespace.ts): Global namespace setup.
|
|
20
|
+
|
|
21
|
+
## Types
|
|
22
|
+
|
|
23
|
+
- [types/layerpro.d.ts](types/layerpro.d.ts): Public TypeScript definitions (`GenLayerProps`, the `layerpro` global, `Window`/`globalThis` augmentations).
|
|
24
|
+
|
|
25
|
+
## Docs
|
|
26
|
+
|
|
27
|
+
- [docs/README.md](docs/README.md): Project README (features, install, quick start).
|
|
28
|
+
- [docs/markdown/GUIDE.md](docs/markdown/GUIDE.md): Example-driven usage guide (modals, popups, dock, maximize, resize, React body, API).
|
|
29
|
+
- [docs/llms.txt](docs/llms.txt): This file.
|
|
30
|
+
|
|
31
|
+
## Build & Config
|
|
32
|
+
|
|
33
|
+
- [package.json](package.json): Manifest. React/react-dom are `devDependencies` (external at runtime); **jQuery removed**. `main`/`browser` → `index.js` (ESM), `exports.import` → `index.js`.
|
|
34
|
+
- [tsup.config.ts](tsup.config.ts): Build (CJS + ESM, terser minify, esbuild-sass-plugin). Externalizes devDependencies.
|
|
35
|
+
- [tsup.plugin.copyStatic.ts](tsup.plugin.copyStatic.ts): Copies static files (README, types, license) into `dist`.
|
|
36
|
+
- [tsup.plugin.injectCss.ts](tsup.plugin.injectCss.ts): Injects compiled SCSS into the bundle.
|
|
37
|
+
|
|
38
|
+
## Key behaviors
|
|
39
|
+
|
|
40
|
+
- **jQuery removed** - all DOM via `core/dom.ts`; public API unchanged.
|
|
41
|
+
- **React external** - only the modal `body` is rendered with `react-dom` `createRoot`.
|
|
42
|
+
- **Instant resize** - CSS `transition` disabled on the popup while resizing (no lag).
|
|
43
|
+
- **Maximize is pure CSS** - `position: fixed` + insets; follows viewport with no JS listeners.
|
|
44
|
+
- **Dock = OS taskbar** - click dock icon toggles restore / focus / minimize.
|
|
45
|
+
- **z-index** - set as unitless numbers; the base is read from the `--popup-z-index` CSS variable (default `1000`). Clicking the body or title bar selects (brings to front).
|
|
46
|
+
|
|
47
|
+
## Contributing
|
|
48
|
+
|
|
49
|
+
LayerPro is **open source** and free to use. The current codebase is private, but
|
|
50
|
+
**anyone is welcome to join**. If you would like to contribute, suggest changes,
|
|
51
|
+
or just chat about the project, contact the author:
|
|
52
|
+
|
|
53
|
+
- **Dario Passariello** - https://dario.passariello.ca/ - dariopassariello@gmail.com
|
|
54
|
+
|
|
55
|
+
Participation is voluntary and free; everyone is free to take part.
|
package/markdown/GUIDE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# LayerPro Guide
|
|
2
2
|
|
|
3
|
-
> A practical, example-driven guide to LayerPro
|
|
3
|
+
> A practical, example-driven guide to LayerPro - the real custom modals
|
|
4
4
|
> (alert, confirm, prompt, message) and advanced popups for the browser.
|
|
5
5
|
|
|
6
6
|
LayerPro is **dependency-free**: it no longer uses jQuery. All DOM work is done
|
|
@@ -50,11 +50,11 @@ Import LayerPro once at your app entry point. It overrides the global
|
|
|
50
50
|
import "layerpro";
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
That single import is enough
|
|
53
|
+
That single import is enough - `window.layerpro` becomes available and the
|
|
54
54
|
global `alert`/`confirm`/`prompt` are replaced, and a `message` global is added.
|
|
55
55
|
|
|
56
56
|
> **⚠️ Global override contract:** the overridden `confirm()` no longer returns a
|
|
57
|
-
> `boolean` and `prompt()` no longer returns a `string`
|
|
57
|
+
> `boolean` and `prompt()` no longer returns a `string` - they are callback-based
|
|
58
58
|
> and return `undefined`. If your codebase (or a third-party dependency) relies on
|
|
59
59
|
> the native synchronous return values, call `layerpro.noGlobals()` right after
|
|
60
60
|
> importing to restore the originals:
|
|
@@ -169,7 +169,7 @@ layerpro.popup.open({
|
|
|
169
169
|
iconize?: boolean, // allow minimize to dock
|
|
170
170
|
dockable?: boolean, // show an icon in the dock bar
|
|
171
171
|
close?: boolean, // show the close button
|
|
172
|
-
raised?: boolean, // alias: modal
|
|
172
|
+
raised?: boolean, // alias: modal - show a full-screen overlay that
|
|
173
173
|
modal?: boolean, // blocks pointer events to the page underneath
|
|
174
174
|
}
|
|
175
175
|
```
|
|
@@ -178,10 +178,10 @@ If `top/left/right/bottom` are all `0` (or unset) the popup is auto-centered.
|
|
|
178
178
|
Pass `center: true` to force centering regardless of the position props.
|
|
179
179
|
|
|
180
180
|
> **`raised` / `modal`** injects a full-viewport overlay (`popup_raised_<id>`)
|
|
181
|
-
> that intercepts every pointer event
|
|
181
|
+
> that intercepts every pointer event - the page underneath becomes unclickable
|
|
182
182
|
> until the popup closes. This is modal behavior; both names are accepted.
|
|
183
183
|
|
|
184
|
-
> **Duplicate id**
|
|
184
|
+
> **Duplicate id** - opening a popup whose `id` already exists brings that window
|
|
185
185
|
> to the front and refreshes its `body`/`buttons` instead of doing nothing.
|
|
186
186
|
|
|
187
187
|
---
|
|
@@ -189,7 +189,7 @@ Pass `center: true` to force centering regardless of the position props.
|
|
|
189
189
|
## Dock & Taskbar
|
|
190
190
|
|
|
191
191
|
When `dockable` and `iconize` are enabled, a minimized popup becomes an icon in
|
|
192
|
-
the bottom dock bar
|
|
192
|
+
the bottom dock bar - exactly like an OS taskbar:
|
|
193
193
|
|
|
194
194
|
```javascript
|
|
195
195
|
layerpro.popup.open({
|
|
@@ -215,7 +215,7 @@ The close `✕` on the dock icon closes the popup completely.
|
|
|
215
215
|
## Maximize & Minimize
|
|
216
216
|
|
|
217
217
|
Maximize is implemented with **pure CSS** (`position: fixed` + `inset`), so the
|
|
218
|
-
popup fills the viewport and follows window resizing automatically
|
|
218
|
+
popup fills the viewport and follows window resizing automatically - no JS
|
|
219
219
|
resize listeners are involved.
|
|
220
220
|
|
|
221
221
|
```javascript
|
|
@@ -364,4 +364,4 @@ elements without attribute selectors.
|
|
|
364
364
|
|
|
365
365
|
---
|
|
366
366
|
|
|
367
|
-
© [Dario Passariello](https://dario.passariello.ca/)
|
|
367
|
+
© [Dario Passariello](https://dario.passariello.ca/) - MIT License
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "layerpro",
|
|
3
3
|
"codeName": "layerpro",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.0",
|
|
5
5
|
"description": "The real custom modals, alert, confirm, prompt... for your browser",
|
|
6
6
|
"main": "./index.cjs",
|
|
7
7
|
"module": "./index.js",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"require": "./react.cjs",
|
|
19
19
|
"types": "./react.d.ts"
|
|
20
20
|
},
|
|
21
|
+
"./style.css": "./index.css",
|
|
21
22
|
"./types/*": "./types/*"
|
|
22
23
|
},
|
|
23
24
|
"license": "MIT",
|
|
@@ -66,6 +67,7 @@
|
|
|
66
67
|
"llms.txt",
|
|
67
68
|
"package.json",
|
|
68
69
|
"react.cjs",
|
|
70
|
+
"react.d.ts",
|
|
69
71
|
"react.js",
|
|
70
72
|
"README.md",
|
|
71
73
|
"SECURITY.md"
|
package/react.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference path="./types/layerpro.d.ts" />
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
|
|
4
|
+
import type { GenLayerProps } from "./types/layerpro"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* React adapter for LayerPro - powered by reattach.
|
|
8
|
+
*
|
|
9
|
+
* Lazily loaded by the core when a React element is passed as a layer body.
|
|
10
|
+
* This keeps react-dom out of the core bundle.
|
|
11
|
+
*
|
|
12
|
+
* reattach handles root creation, root reuse on duplicate-id reopen,
|
|
13
|
+
* context bridging (inheritContext), and auto-healing DOM (resilient).
|
|
14
|
+
*
|
|
15
|
+
* @param props - The layer props containing a ReactElement body
|
|
16
|
+
* @param container - The DOM node to mount into
|
|
17
|
+
*/
|
|
18
|
+
declare function renderReactBody(
|
|
19
|
+
props: GenLayerProps,
|
|
20
|
+
container: HTMLElement
|
|
21
|
+
): void
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Unmount a previously mounted React body via reattach.
|
|
25
|
+
* Called by LayerPro's close() lifecycle to prevent memory leaks.
|
|
26
|
+
*
|
|
27
|
+
* @param id - The layer ID (same as props.id used in renderReactBody)
|
|
28
|
+
*/
|
|
29
|
+
declare function unmountReactBody(id: string): void
|
|
30
|
+
|
|
31
|
+
export { unmountReactBody }
|
|
32
|
+
export default renderReactBody
|
package/types/layerpro.d.ts
CHANGED
|
@@ -1,133 +1,143 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
/** Generate custom alert using alert([text]) */
|
|
4
|
-
declare function alert(f1?: string): void
|
|
5
|
-
|
|
6
|
-
/** Generate custom confirm using confirm([text],[callback for YES],[optional callback for NO])
|
|
7
|
-
* WARNING: This overrides the native confirm(). The return value is NOT a usable
|
|
8
|
-
* boolean
|
|
9
|
-
* return value; use the yes/no callbacks. */
|
|
10
|
-
declare function confirm(message: string, func1: (yes: boolean) => void, func2?: (no: boolean) => void): void
|
|
11
|
-
|
|
12
|
-
/** Generate custom message using message([text],[callback]) and option callback */
|
|
13
|
-
declare function message(f1?: string, func1?: () => void): void
|
|
14
|
-
|
|
15
|
-
/** Generate custom prompt using prompt([text],[callback]) and option callback
|
|
16
|
-
* WARNING: This overrides the native prompt(). The return value is NOT a usable
|
|
17
|
-
* string
|
|
18
|
-
declare function prompt(f1?: string, func1?: (input: string) => void): void
|
|
19
|
-
|
|
20
|
-
///
|
|
21
|
-
|
|
22
|
-
interface LayerButtonConfig {
|
|
23
|
-
text: string
|
|
24
|
-
cb?: () => void
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface LayerButtonsConfig {
|
|
28
|
-
confirm?: LayerButtonConfig
|
|
29
|
-
cancel?: LayerButtonConfig
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
interface GenLayerProps {
|
|
33
|
-
id: string | number
|
|
34
|
-
body?: React.ReactElement | string | HTMLElement
|
|
35
|
-
name?: string
|
|
36
|
-
style?: Record<string, string | number>
|
|
37
|
-
class?: string
|
|
38
|
-
icon?: string
|
|
39
|
-
|
|
40
|
-
buttons?: LayerButtonsConfig
|
|
41
|
-
|
|
42
|
-
top?: number | string
|
|
43
|
-
left?: number | string
|
|
44
|
-
right?: number | string
|
|
45
|
-
bottom?: number | string
|
|
46
|
-
|
|
47
|
-
width?: number | string
|
|
48
|
-
height?: number | string
|
|
49
|
-
|
|
50
|
-
minWidth?: number
|
|
51
|
-
minHeight?: number
|
|
52
|
-
maxWidth?: number
|
|
53
|
-
maxHeight?: number
|
|
54
|
-
|
|
55
|
-
fadeIn?: number
|
|
56
|
-
fadeOut?: number
|
|
57
|
-
timer?: number
|
|
58
|
-
|
|
59
|
-
maximize?: boolean
|
|
60
|
-
isMaximize?: boolean
|
|
61
|
-
dockable?: boolean
|
|
62
|
-
movable?: boolean
|
|
63
|
-
|
|
64
|
-
resizable?: boolean
|
|
65
|
-
close?: boolean
|
|
66
|
-
raised?: boolean
|
|
67
|
-
modal?: boolean
|
|
68
|
-
iconize?: boolean
|
|
69
|
-
center?: boolean
|
|
70
|
-
|
|
71
|
-
source?: string
|
|
72
|
-
store?: unknown
|
|
73
|
-
inheritContext?: boolean
|
|
74
|
-
resilient?: boolean
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
interface _layerpro {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
readonly
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
|
|
3
|
+
/** Generate custom alert using alert([text]) */
|
|
4
|
+
declare function alert(f1?: string): void
|
|
5
|
+
|
|
6
|
+
/** Generate custom confirm using confirm([text],[callback for YES],[optional callback for NO])
|
|
7
|
+
* WARNING: This overrides the native confirm(). The return value is NOT a usable
|
|
8
|
+
* boolean - callbacks are invoked asynchronously instead. Never rely on the
|
|
9
|
+
* return value; use the yes/no callbacks. */
|
|
10
|
+
declare function confirm(message: string, func1: (yes: boolean) => void, func2?: (no: boolean) => void): void
|
|
11
|
+
|
|
12
|
+
/** Generate custom message using message([text],[callback]) and option callback */
|
|
13
|
+
declare function message(f1?: string, func1?: () => void): void
|
|
14
|
+
|
|
15
|
+
/** Generate custom prompt using prompt([text],[callback]) and option callback
|
|
16
|
+
* WARNING: This overrides the native prompt(). The return value is NOT a usable
|
|
17
|
+
* string - use the callback to receive the input. */
|
|
18
|
+
declare function prompt(f1?: string, func1?: (input: string) => void): void
|
|
19
|
+
|
|
20
|
+
///
|
|
21
|
+
|
|
22
|
+
interface LayerButtonConfig {
|
|
23
|
+
text: string
|
|
24
|
+
cb?: () => void
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface LayerButtonsConfig {
|
|
28
|
+
confirm?: LayerButtonConfig
|
|
29
|
+
cancel?: LayerButtonConfig
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface GenLayerProps {
|
|
33
|
+
id: string | number
|
|
34
|
+
body?: React.ReactElement | string | HTMLElement
|
|
35
|
+
name?: string
|
|
36
|
+
style?: Record<string, string | number>
|
|
37
|
+
class?: string
|
|
38
|
+
icon?: string
|
|
39
|
+
|
|
40
|
+
buttons?: LayerButtonsConfig
|
|
41
|
+
|
|
42
|
+
top?: number | string
|
|
43
|
+
left?: number | string
|
|
44
|
+
right?: number | string
|
|
45
|
+
bottom?: number | string
|
|
46
|
+
|
|
47
|
+
width?: number | string
|
|
48
|
+
height?: number | string
|
|
49
|
+
|
|
50
|
+
minWidth?: number
|
|
51
|
+
minHeight?: number
|
|
52
|
+
maxWidth?: number
|
|
53
|
+
maxHeight?: number
|
|
54
|
+
|
|
55
|
+
fadeIn?: number
|
|
56
|
+
fadeOut?: number
|
|
57
|
+
timer?: number
|
|
58
|
+
|
|
59
|
+
maximize?: boolean
|
|
60
|
+
isMaximize?: boolean
|
|
61
|
+
dockable?: boolean
|
|
62
|
+
movable?: boolean
|
|
63
|
+
|
|
64
|
+
resizable?: boolean
|
|
65
|
+
close?: boolean
|
|
66
|
+
raised?: boolean
|
|
67
|
+
modal?: boolean
|
|
68
|
+
iconize?: boolean
|
|
69
|
+
center?: boolean
|
|
70
|
+
|
|
71
|
+
source?: string
|
|
72
|
+
store?: unknown
|
|
73
|
+
inheritContext?: boolean
|
|
74
|
+
resilient?: boolean
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Interface for the layerpro object
|
|
79
|
+
*/
|
|
80
|
+
interface _layerpro {
|
|
81
|
+
|
|
82
|
+
/** Optional CSP nonce. Set via `layerpro.config({ nonce })` before importing
|
|
83
|
+
* the CSS-in-JS bundle so the injected `<style>` element passes strict CSP.
|
|
84
|
+
* If unset, the nonce is auto-detected from existing `<style>`/`<script>`
|
|
85
|
+
* elements on the page. */
|
|
86
|
+
nonce?: string
|
|
87
|
+
|
|
88
|
+
/** Runtime configuration. Currently supports `{ nonce: string }` for CSP. */
|
|
89
|
+
config: (opts: { nonce?: string }) => void
|
|
90
|
+
|
|
91
|
+
readonly alert: (txt: string) => void
|
|
92
|
+
readonly prompt: (txt: string, callback: (input: string) => void) => void
|
|
93
|
+
readonly message: (txt: string, callback: () => void) => void
|
|
94
|
+
readonly confirm: (txt: string, yesCallback: () => void, noCallback?: () => void) => void
|
|
95
|
+
readonly credits: (props: { name: string, version: string, description: string, license: string, author: { name: string, email: string } }) => void
|
|
96
|
+
|
|
97
|
+
setProps: (obj: Record<string, unknown>, options?: { enumerable?: boolean, writable?: boolean }) => void
|
|
98
|
+
|
|
99
|
+
/** Remove the global alert/confirm/prompt/message overrides and restore
|
|
100
|
+
* the native browser implementations. Call this right after importing
|
|
101
|
+
* LayerPro if your codebase depends on synchronous native globals. */
|
|
102
|
+
readonly noGlobals: () => void
|
|
103
|
+
|
|
104
|
+
/** Opt-in to override the browser's native alert/confirm/prompt/message
|
|
105
|
+
* globals with LayerPro's callback-based versions. This is opt-in so
|
|
106
|
+
* libraries embedded in other applications do not silently change
|
|
107
|
+
* global behavior. */
|
|
108
|
+
readonly installGlobals: () => void
|
|
109
|
+
|
|
110
|
+
readonly popup: {
|
|
111
|
+
open: (props: GenLayerProps) => GenLayerProps
|
|
112
|
+
center: (id: string | number | GenLayerProps, offset?: number) => void
|
|
113
|
+
maximize: (props: GenLayerProps) => void
|
|
114
|
+
iconize: (id: string | number | GenLayerProps) => void
|
|
115
|
+
movable: (props: GenLayerProps) => void
|
|
116
|
+
resizable: (props: GenLayerProps) => void
|
|
117
|
+
store: (element: unknown) => void
|
|
118
|
+
index: (id: string | number | GenLayerProps) => void
|
|
119
|
+
zIndex: (props?: GenLayerProps) => number
|
|
120
|
+
close: (id: string | number | GenLayerProps | null | undefined) => void
|
|
121
|
+
unmount: (id: string) => void
|
|
122
|
+
cleanupEvents: (id: string) => void
|
|
123
|
+
abortSource: (id: string) => void
|
|
124
|
+
useReactAdapter?: (props: GenLayerProps, container: HTMLElement) => void
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* LayerPro overrides the native alert/confirm/prompt globals and adds a
|
|
131
|
+
* `message` global. They are callback-based and do NOT return native values.
|
|
132
|
+
* Call `layerpro.noGlobals()` to restore the synchronous natives.
|
|
133
|
+
*/
|
|
134
|
+
interface Window {
|
|
135
|
+
layerpro: _layerpro
|
|
136
|
+
popup: _layerpro['popup']
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
declare var layerpro: _layerpro
|
|
140
|
+
type layerpro = _layerpro
|
|
141
|
+
|
|
142
|
+
declare var popup: _layerpro['popup']
|
|
143
|
+
type popup = _layerpro['popup']
|