@codeleap/portals 7.0.0 → 7.0.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/dist/factors/alert.js +40 -0
- package/dist/factors/alert.js.map +1 -0
- package/dist/factors/bottomSheet.js +107 -0
- package/dist/factors/bottomSheet.js.map +1 -0
- package/dist/factors/drawer.js +52 -0
- package/dist/factors/drawer.js.map +1 -0
- package/dist/factors/modal.js +52 -0
- package/dist/factors/modal.js.map +1 -0
- package/dist/globals.js +3 -0
- package/dist/globals.js.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/Portal.js +258 -0
- package/dist/lib/Portal.js.map +1 -0
- package/dist/lib/PortalRegistry.js +84 -0
- package/dist/lib/PortalRegistry.js.map +1 -0
- package/dist/lib/PortalRequest.js +69 -0
- package/dist/lib/PortalRequest.js.map +1 -0
- package/dist/lib/PortalState.js +168 -0
- package/dist/lib/PortalState.js.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/misc.js +2 -0
- package/dist/types/misc.js.map +1 -0
- package/dist/types/portal.js +2 -0
- package/dist/types/portal.js.map +1 -0
- package/dist/utils.js +30 -0
- package/dist/utils.js.map +1 -0
- package/package.json +9 -9
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alert utility for displaying typed alert modals (info, error, warn, ask, custom).
|
|
3
|
+
* Provides convenient methods for common alert scenarios.
|
|
4
|
+
*/
|
|
5
|
+
export class Alert {
|
|
6
|
+
/**
|
|
7
|
+
* Returns the Modal instance used to display alerts.
|
|
8
|
+
* Must be implemented by the consuming app before calling any alert method.
|
|
9
|
+
* @throws Error if not implemented
|
|
10
|
+
*/
|
|
11
|
+
static openAlert() {
|
|
12
|
+
throw new Error('Please implement Alert.openAlert to use the alert system');
|
|
13
|
+
}
|
|
14
|
+
trigger(args) {
|
|
15
|
+
Alert.openAlert().open(args);
|
|
16
|
+
}
|
|
17
|
+
/** Opens an alert with 'ask' type. */
|
|
18
|
+
ask(args) {
|
|
19
|
+
this.trigger(Object.assign(Object.assign({}, args), { type: 'ask' }));
|
|
20
|
+
}
|
|
21
|
+
/** Opens an alert with 'error' type. */
|
|
22
|
+
error(args) {
|
|
23
|
+
this.trigger(Object.assign(Object.assign({}, args), { type: 'error' }));
|
|
24
|
+
}
|
|
25
|
+
/** Opens an alert with 'warn' type. */
|
|
26
|
+
warn(args) {
|
|
27
|
+
this.trigger(Object.assign(Object.assign({}, args), { type: 'warn' }));
|
|
28
|
+
}
|
|
29
|
+
/** Opens an alert with 'info' type. */
|
|
30
|
+
info(args) {
|
|
31
|
+
this.trigger(Object.assign(Object.assign({}, args), { type: 'info' }));
|
|
32
|
+
}
|
|
33
|
+
/** Opens a custom alert with user-defined options and type. */
|
|
34
|
+
custom(options) {
|
|
35
|
+
this.trigger(Object.assign(Object.assign({}, options), { type: 'custom' }));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** Global alert instance for showing alerts throughout the app. */
|
|
39
|
+
export const alert = new Alert();
|
|
40
|
+
//# sourceMappingURL=alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.js","sourceRoot":"","sources":["../../src/factors/alert.ts"],"names":[],"mappings":"AAsBA;;;GAGG;AACH,MAAM,OAAO,KAAK;IAEhB;;;;OAIG;IACH,MAAM,CAAC,SAAS;QACd,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAA;IAC7E,CAAC;IAEO,OAAO,CAAC,IAAkB;QAChC,KAAK,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC9B,CAAC;IAED,sCAAsC;IACtC,GAAG,CAAC,IAAkB;QACpB,IAAI,CAAC,OAAO,iCAAM,IAAI,KAAE,IAAI,EAAE,KAAK,IAAG,CAAA;IACxC,CAAC;IAED,wCAAwC;IACxC,KAAK,CAAC,IAAkB;QACtB,IAAI,CAAC,OAAO,iCAAM,IAAI,KAAE,IAAI,EAAE,OAAO,IAAG,CAAA;IAC1C,CAAC;IAED,uCAAuC;IACvC,IAAI,CAAC,IAAkB;QACrB,IAAI,CAAC,OAAO,iCAAM,IAAI,KAAE,IAAI,EAAE,MAAM,IAAG,CAAA;IACzC,CAAC;IAED,uCAAuC;IACvC,IAAI,CAAC,IAAkB;QACrB,IAAI,CAAC,OAAO,iCAAM,IAAI,KAAE,IAAI,EAAE,MAAM,IAAG,CAAA;IACzC,CAAC;IAED,+DAA+D;IAC/D,MAAM,CAAI,OAAkC;QAC1C,IAAI,CAAC,OAAO,iCAAO,OAAe,KAAE,IAAI,EAAE,QAAQ,IAAG,CAAA;IACvD,CAAC;CACF;AAED,mEAAmE;AACnE,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAA"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Portal } from '../lib/Portal';
|
|
11
|
+
/**
|
|
12
|
+
* Bottom sheet portal for bottom-sliding panels.
|
|
13
|
+
* Extends Portal with bottom sheet-specific wrapper, configuration and ref methods.
|
|
14
|
+
*
|
|
15
|
+
* @template Params - Custom bottom sheet parameters
|
|
16
|
+
* @template Result - Type of result returned by request
|
|
17
|
+
* @template Metadata - Additional configuration metadata
|
|
18
|
+
*/
|
|
19
|
+
export class BottomSheet extends Portal {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.displayName = 'BottomSheet';
|
|
23
|
+
}
|
|
24
|
+
/** @inheritdoc */
|
|
25
|
+
get defaultTransitionDuration() {
|
|
26
|
+
return BottomSheet.DEFAULT_TRANSITION_DURATION;
|
|
27
|
+
}
|
|
28
|
+
/** @inheritdoc */
|
|
29
|
+
get wrapperComponent() {
|
|
30
|
+
return BottomSheet.WrapperComponent;
|
|
31
|
+
}
|
|
32
|
+
/** Closes all open BottomSheet instances. */
|
|
33
|
+
static closeAll() {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const registries = BottomSheet.registry.getAll();
|
|
36
|
+
yield Promise.all(registries.map(instance => instance.close()));
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/** Returns default config: `rendersWhenHidden=true` and `resetParamsOnClose=false`. */
|
|
40
|
+
getDefaultConfig() {
|
|
41
|
+
return {
|
|
42
|
+
rendersWhenHidden: true,
|
|
43
|
+
resetParamsOnClose: false,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** Calls the native open method on the ref via `openKeyMethod`, if configured. */
|
|
47
|
+
openBottomSheet() {
|
|
48
|
+
var _a, _b, _c, _d;
|
|
49
|
+
if (!!BottomSheet.openKeyMethod && !!((_a = this.ref) === null || _a === void 0 ? void 0 : _a.current)) {
|
|
50
|
+
(_d = (_c = (_b = this.ref) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c[BottomSheet.openKeyMethod]) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** Calls the native close method on the ref via `closeKeyMethod`, if configured. */
|
|
54
|
+
closeBottomSheet() {
|
|
55
|
+
var _a, _b, _c, _d;
|
|
56
|
+
if (!!BottomSheet.closeKeyMethod && !!((_a = this.ref) === null || _a === void 0 ? void 0 : _a.current)) {
|
|
57
|
+
(_d = (_c = (_b = this.ref) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c[BottomSheet.closeKeyMethod]) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/** @inheritdoc — also triggers the native open animation via `openBottomSheet()`. */
|
|
61
|
+
handleOpen() {
|
|
62
|
+
this.openBottomSheet();
|
|
63
|
+
}
|
|
64
|
+
/** @inheritdoc — also triggers the native close animation via `closeBottomSheet()`. */
|
|
65
|
+
handleClose() {
|
|
66
|
+
this.closeBottomSheet();
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Registers a callback to be called when bottom sheet opens.
|
|
70
|
+
* Overrides parent to ensure native open method is called.
|
|
71
|
+
* @param callback - Function to execute on open
|
|
72
|
+
* @returns The bottom sheet instance for chaining
|
|
73
|
+
*/
|
|
74
|
+
onOpen(callback) {
|
|
75
|
+
this.handleOpen = () => {
|
|
76
|
+
this.openBottomSheet();
|
|
77
|
+
callback(this);
|
|
78
|
+
};
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Registers a callback to be called when bottom sheet closes.
|
|
83
|
+
* Overrides parent to ensure native close method is called.
|
|
84
|
+
* @param callback - Function to execute on close
|
|
85
|
+
* @returns The bottom sheet instance for chaining
|
|
86
|
+
*/
|
|
87
|
+
onClose(callback) {
|
|
88
|
+
this.handleClose = () => {
|
|
89
|
+
this.closeBottomSheet();
|
|
90
|
+
callback(this);
|
|
91
|
+
};
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/** Wrapper component used to render bottom sheet UI. Must be assigned by the consuming app. */
|
|
96
|
+
BottomSheet.WrapperComponent = () => null;
|
|
97
|
+
/** Default transition duration in milliseconds for bottom sheet open/close animations. */
|
|
98
|
+
BottomSheet.DEFAULT_TRANSITION_DURATION = 200;
|
|
99
|
+
/**
|
|
100
|
+
* Factory function to create a new BottomSheet instance.
|
|
101
|
+
* @param idOrConfig - BottomSheet ID or configuration object
|
|
102
|
+
* @returns New BottomSheet instance
|
|
103
|
+
*/
|
|
104
|
+
export function bottomSheet(idOrConfig) {
|
|
105
|
+
return new BottomSheet(idOrConfig);
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=bottomSheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bottomSheet.js","sourceRoot":"","sources":["../../src/factors/bottomSheet.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAMtC;;;;;;;GAOG;AACH,MAAM,OAAO,WAAqD,SAAQ,MAAyE;IAAnJ;;QACE,gBAAW,GAAG,aAAa,CAAA;IA2F7B,CAAC;IAnFC,kBAAkB;IAClB,IAAc,yBAAyB;QACrC,OAAO,WAAW,CAAC,2BAA2B,CAAA;IAChD,CAAC;IAED,kBAAkB;IAClB,IAAc,gBAAgB;QAC5B,OAAO,WAAW,CAAC,gBAAgB,CAAA;IACrC,CAAC;IAED,6CAA6C;IAC7C,MAAM,CAAO,QAAQ;;YACnB,MAAM,UAAU,GAAG,WAAW,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAA;YAChD,MAAM,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;QACjE,CAAC;KAAA;IAQD,uFAAuF;IAC7E,gBAAgB;QACxB,OAAO;YACL,iBAAiB,EAAE,IAAI;YACvB,kBAAkB,EAAE,KAAK;SACiB,CAAA;IAC9C,CAAC;IAED,kFAAkF;IACxE,eAAe;;QACvB,IAAI,CAAC,CAAC,WAAW,CAAC,aAAa,IAAI,CAAC,CAAC,CAAA,MAAA,IAAI,CAAC,GAAG,0CAAE,OAAO,CAAA,EAAE,CAAC;YACvD,MAAA,MAAC,MAAA,IAAI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
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Portal } from '../lib/Portal';
|
|
11
|
+
/**
|
|
12
|
+
* Drawer portal for side-sliding panels.
|
|
13
|
+
* Extends Portal with drawer-specific wrapper and configuration.
|
|
14
|
+
*
|
|
15
|
+
* @template Params - Custom drawer parameters
|
|
16
|
+
* @template Result - Type of result returned by request
|
|
17
|
+
* @template Metadata - Additional configuration metadata
|
|
18
|
+
*/
|
|
19
|
+
export class Drawer extends Portal {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.displayName = 'Drawer';
|
|
23
|
+
}
|
|
24
|
+
/** @inheritdoc */
|
|
25
|
+
get defaultTransitionDuration() {
|
|
26
|
+
return Drawer.DEFAULT_TRANSITION_DURATION;
|
|
27
|
+
}
|
|
28
|
+
/** @inheritdoc */
|
|
29
|
+
get wrapperComponent() {
|
|
30
|
+
return Drawer.WrapperComponent;
|
|
31
|
+
}
|
|
32
|
+
/** Closes all open Drawer instances. */
|
|
33
|
+
static closeAll() {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const registries = Drawer.registry.getAll();
|
|
36
|
+
yield Promise.all(registries.map(instance => instance.close()));
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** Wrapper component used to render drawer UI. Must be assigned by the consuming app. */
|
|
41
|
+
Drawer.WrapperComponent = () => null;
|
|
42
|
+
/** Default transition duration in milliseconds for drawer open/close animations. */
|
|
43
|
+
Drawer.DEFAULT_TRANSITION_DURATION = 200;
|
|
44
|
+
/**
|
|
45
|
+
* Factory function to create a new Drawer instance.
|
|
46
|
+
* @param idOrConfig - Drawer ID or configuration object
|
|
47
|
+
* @returns New Drawer instance
|
|
48
|
+
*/
|
|
49
|
+
export function drawer(idOrConfig) {
|
|
50
|
+
return new Drawer(idOrConfig);
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=drawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../src/factors/drawer.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAGtC;;;;;;;GAOG;AACH,MAAM,OAAO,MAAgD,SAAQ,MAA+D;IAApI;;QACE,gBAAW,GAAG,QAAQ,CAAA;IAuBxB,CAAC;IAfC,kBAAkB;IAClB,IAAc,yBAAyB;QACrC,OAAO,MAAM,CAAC,2BAA2B,CAAA;IAC3C,CAAC;IAED,kBAAkB;IAClB,IAAc,gBAAgB;QAC5B,OAAO,MAAM,CAAC,gBAAgB,CAAA;IAChC,CAAC;IAED,wCAAwC;IACxC,MAAM,CAAO,QAAQ;;YACnB,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAA;YAC3C,MAAM,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;QACjE,CAAC;KAAA;;AApBD,yFAAyF;AAClF,uBAAgB,GAAsF,GAAG,EAAE,CAAC,IAAI,AAAhG,CAAgG;AAEvH,oFAAoF;AAC7E,kCAA2B,GAAG,GAAG,AAAN,CAAM;AAmB1C;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAA0C,UAAqD;IACnH,OAAO,IAAI,MAAM,CAA2B,UAAU,CAAC,CAAA;AACzD,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Portal } from '../lib/Portal';
|
|
11
|
+
/**
|
|
12
|
+
* Modal portal for centered overlay dialogs.
|
|
13
|
+
* Extends Portal with modal-specific wrapper and configuration.
|
|
14
|
+
*
|
|
15
|
+
* @template Params - Custom modal parameters
|
|
16
|
+
* @template Result - Type of result returned by request
|
|
17
|
+
* @template Metadata - Additional configuration metadata
|
|
18
|
+
*/
|
|
19
|
+
export class Modal extends Portal {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.displayName = 'Modal';
|
|
23
|
+
}
|
|
24
|
+
/** @inheritdoc */
|
|
25
|
+
get defaultTransitionDuration() {
|
|
26
|
+
return Modal.DEFAULT_TRANSITION_DURATION;
|
|
27
|
+
}
|
|
28
|
+
/** @inheritdoc */
|
|
29
|
+
get wrapperComponent() {
|
|
30
|
+
return Modal.WrapperComponent;
|
|
31
|
+
}
|
|
32
|
+
/** Closes all open Modal instances. */
|
|
33
|
+
static closeAll() {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const registries = Modal.registry.getAll();
|
|
36
|
+
yield Promise.all(registries.map(instance => instance.close()));
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** Wrapper component used to render modal UI. Must be assigned by the consuming app. */
|
|
41
|
+
Modal.WrapperComponent = () => null;
|
|
42
|
+
/** Default transition duration in milliseconds for modal open/close animations. */
|
|
43
|
+
Modal.DEFAULT_TRANSITION_DURATION = 200;
|
|
44
|
+
/**
|
|
45
|
+
* Factory function to create a new Modal instance.
|
|
46
|
+
* @param idOrConfig - Modal ID or configuration object
|
|
47
|
+
* @returns New Modal instance
|
|
48
|
+
*/
|
|
49
|
+
export function modal(idOrConfig) {
|
|
50
|
+
return new Modal(idOrConfig);
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal.js","sourceRoot":"","sources":["../../src/factors/modal.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAGtC;;;;;;;GAOG;AACH,MAAM,OAAO,KAA+C,SAAQ,MAA6D;IAAjI;;QACE,gBAAW,GAAG,OAAO,CAAA;IAuBvB,CAAC;IAfC,kBAAkB;IAClB,IAAc,yBAAyB;QACrC,OAAO,KAAK,CAAC,2BAA2B,CAAA;IAC1C,CAAC;IAED,kBAAkB;IAClB,IAAc,gBAAgB;QAC5B,OAAO,KAAK,CAAC,gBAAgB,CAAA;IAC/B,CAAC;IAED,uCAAuC;IACvC,MAAM,CAAO,QAAQ;;YACnB,MAAM,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAA;YAC1C,MAAM,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;QACjE,CAAC;KAAA;;AApBD,wFAAwF;AACjF,sBAAgB,GAAoF,GAAG,EAAE,CAAC,IAAI,AAA9F,CAA8F;AAErH,mFAAmF;AAC5E,iCAA2B,GAAG,GAAG,AAAN,CAAM;AAmB1C;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAA0C,UAAqD;IAClH,OAAO,IAAI,KAAK,CAA2B,UAAU,CAAC,CAAA;AACxD,CAAC"}
|
package/dist/globals.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globals.js","sourceRoot":"","sources":["../src/globals.ts"],"names":[],"mappings":"AAAA,0DAA0D"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './lib/Portal';
|
|
2
|
+
export * from './lib/PortalRegistry';
|
|
3
|
+
export * from './lib/PortalState';
|
|
4
|
+
export * from './lib/PortalRequest';
|
|
5
|
+
export * from './types/misc';
|
|
6
|
+
export * from './types/portal';
|
|
7
|
+
export * from './utils';
|
|
8
|
+
// export * from './lib/modalFlow'
|
|
9
|
+
export * from './factors/alert';
|
|
10
|
+
export * from './factors/modal';
|
|
11
|
+
export * from './factors/bottomSheet';
|
|
12
|
+
export * from './factors/drawer';
|
|
13
|
+
export * from './globals';
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,kCAAkC;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,WAAW,CAAA"}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { useLayoutEffect } from 'react';
|
|
13
|
+
import { atom } from 'nanostores';
|
|
14
|
+
import { useStore } from '@nanostores/react';
|
|
15
|
+
import { TypeGuards } from '@codeleap/types';
|
|
16
|
+
import { logger } from '@codeleap/logger';
|
|
17
|
+
import { randomId } from '../utils';
|
|
18
|
+
import { PortalRegistry } from './PortalRegistry';
|
|
19
|
+
import { PortalState } from './PortalState';
|
|
20
|
+
import { PortalRequest } from './PortalRequest';
|
|
21
|
+
/**
|
|
22
|
+
* Nanostores atom holding the IDs of all currently registered portals in creation order.
|
|
23
|
+
* Drives `GlobalOutlet` re-renders when portals are added or removed (including ephemeral ones).
|
|
24
|
+
* Read-only outside of portal lifecycle code — mutate only via `Portal` constructor/`onVisibilityChanged`.
|
|
25
|
+
*/
|
|
26
|
+
export const registeredIds = atom([]);
|
|
27
|
+
/**
|
|
28
|
+
* Base class for creating portals (modal, drawer, bottom sheet, etc).
|
|
29
|
+
* Manages state, visibility, params and lifecycle of floating components.
|
|
30
|
+
*
|
|
31
|
+
* @template Params - Custom portal parameters
|
|
32
|
+
* @template Result - Type of result returned by request
|
|
33
|
+
* @template Metadata - Additional configuration metadata
|
|
34
|
+
* @template RefType - Type of wrapper component ref
|
|
35
|
+
* @template WrapperProps - Props for wrapper component
|
|
36
|
+
*/
|
|
37
|
+
export class Portal extends PortalState {
|
|
38
|
+
getDefaultConfig() {
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
41
|
+
get registry() {
|
|
42
|
+
return Portal.registry;
|
|
43
|
+
}
|
|
44
|
+
get idGenerator() {
|
|
45
|
+
return Portal.generateId;
|
|
46
|
+
}
|
|
47
|
+
get defaultTransitionDuration() {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
get wrapperComponent() {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Sets the render function for portal content.
|
|
55
|
+
* @param render - Function that renders the portal content
|
|
56
|
+
* @returns The portal instance for chaining
|
|
57
|
+
*/
|
|
58
|
+
content(render) {
|
|
59
|
+
this.RenderContent = render;
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
/** Gets the resolve handler for the pending request. */
|
|
63
|
+
get resolve() {
|
|
64
|
+
return this.requestHandler.resolve;
|
|
65
|
+
}
|
|
66
|
+
/** Gets the reject handler for the pending request. */
|
|
67
|
+
get reject() {
|
|
68
|
+
return this.requestHandler.reject;
|
|
69
|
+
}
|
|
70
|
+
onVisibilityChanged(visible, wasVisible) {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
if (this._config.independent) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (visible) {
|
|
76
|
+
this.registry.push(this.id);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
if (wasVisible && !visible) {
|
|
80
|
+
if (this.hasPendingRequest) {
|
|
81
|
+
(_b = (_a = this.requestHandler).resolve) === null || _b === void 0 ? void 0 : _b.call(_a, undefined);
|
|
82
|
+
this.requestHandler.clearRequest();
|
|
83
|
+
}
|
|
84
|
+
if (this._config.ephemeral) {
|
|
85
|
+
this.registry.unregister(this.id);
|
|
86
|
+
registeredIds.set(registeredIds.get().filter(id => id !== this.id));
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
this.registry.remove(this.id);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/** Gets the z-index position of the portal in the registry stack. */
|
|
94
|
+
get stackIndex() {
|
|
95
|
+
return this.registry.getStackIndex(this.id);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Creates a new portal instance.
|
|
99
|
+
* @param idOrConfig - Portal ID string or configuration object with optional id field
|
|
100
|
+
*/
|
|
101
|
+
constructor(idOrConfig) {
|
|
102
|
+
super();
|
|
103
|
+
this.displayName = 'Portal';
|
|
104
|
+
const id = TypeGuards.isString(idOrConfig) ? idOrConfig : idOrConfig === null || idOrConfig === void 0 ? void 0 : idOrConfig.id;
|
|
105
|
+
const config = TypeGuards.isObject(idOrConfig) ? idOrConfig : {};
|
|
106
|
+
this._config = Object.assign(Object.assign({ initialParams: {}, startsOpen: false, independent: false, rendersWhenHidden: false, metadata: {}, resetParamsOnClose: true, transitionDuration: this.constructor.DEFAULT_TRANSITION_DURATION }, this.getDefaultConfig()), config);
|
|
107
|
+
this.initializeState({
|
|
108
|
+
initialParams: this._config.initialParams,
|
|
109
|
+
startsOpen: this._config.startsOpen,
|
|
110
|
+
resetParamsOnClose: this._config.resetParamsOnClose,
|
|
111
|
+
transitionDuration: this._config.transitionDuration,
|
|
112
|
+
});
|
|
113
|
+
this.id = id !== null && id !== void 0 ? id : this.idGenerator();
|
|
114
|
+
this.requestHandler = new PortalRequest(this.open.bind(this), this.close.bind(this));
|
|
115
|
+
this._wrapperProps = atom({});
|
|
116
|
+
this.ref = React.createRef();
|
|
117
|
+
this.registry.register(this.id, this);
|
|
118
|
+
registeredIds.set([...registeredIds.get(), this.id]);
|
|
119
|
+
this.subscribe((visible, wasVisible) => {
|
|
120
|
+
this.onVisibilityChanged(visible, wasVisible);
|
|
121
|
+
});
|
|
122
|
+
this.Component = this.Component.bind(this);
|
|
123
|
+
this.useState = this.useState.bind(this);
|
|
124
|
+
this.useProps = this.useProps.bind(this);
|
|
125
|
+
this.toggle = this.toggle.bind(this);
|
|
126
|
+
this.open = this.open.bind(this);
|
|
127
|
+
this.close = this.close.bind(this);
|
|
128
|
+
this.setParams = this.setParams.bind(this);
|
|
129
|
+
this.resetParams = this.resetParams.bind(this);
|
|
130
|
+
this.getParams = this.getParams.bind(this);
|
|
131
|
+
this.request = this.request.bind(this);
|
|
132
|
+
this.assertInitialized = this.assertInitialized.bind(this);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Registers a callback to be called when portal closes.
|
|
136
|
+
* @param callback - Function to execute on close
|
|
137
|
+
* @returns The portal instance for chaining
|
|
138
|
+
*/
|
|
139
|
+
onClose(callback) {
|
|
140
|
+
this.handleClose = () => callback(this);
|
|
141
|
+
return this;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Registers a callback to be called when portal opens.
|
|
145
|
+
* @param callback - Function to execute on open
|
|
146
|
+
* @returns The portal instance for chaining
|
|
147
|
+
*/
|
|
148
|
+
onOpen(callback) {
|
|
149
|
+
this.handleOpen = () => callback(this);
|
|
150
|
+
return this;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Sets wrapper component props. Can be static or a function based on params.
|
|
154
|
+
* @param props - Props object or function that returns props
|
|
155
|
+
* @returns The portal instance for chaining
|
|
156
|
+
*/
|
|
157
|
+
props(props) {
|
|
158
|
+
if (TypeGuards.isFunction(props)) {
|
|
159
|
+
this._lazyWrapperProps = props;
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
this._wrapperProps.set(props);
|
|
163
|
+
}
|
|
164
|
+
return this;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* React hook to update wrapper props with dependency tracking.
|
|
168
|
+
* @param props - Props to merge with existing wrapper props
|
|
169
|
+
* @param deps - Dependency array for effect
|
|
170
|
+
*/
|
|
171
|
+
useProps(props, deps = []) {
|
|
172
|
+
useLayoutEffect(() => {
|
|
173
|
+
this._wrapperProps.set(Object.assign(Object.assign({}, this._wrapperProps.get()), props));
|
|
174
|
+
}, deps);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* React hook to access portal state (visibility and params).
|
|
178
|
+
* @returns Object with visible and params state
|
|
179
|
+
*/
|
|
180
|
+
useState() {
|
|
181
|
+
const { visible: visibleStore, params: paramsStore } = this.assertInitialized();
|
|
182
|
+
const visible = useStore(visibleStore);
|
|
183
|
+
const params = useStore(paramsStore);
|
|
184
|
+
return { visible, params };
|
|
185
|
+
}
|
|
186
|
+
/** Whether there is a pending request awaiting resolution. */
|
|
187
|
+
get hasPendingRequest() {
|
|
188
|
+
return this.requestHandler.hasPendingRequest;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Renders the portal component. Use this as a React component.
|
|
192
|
+
* @param props - Combined params and wrapper props
|
|
193
|
+
* @returns JSX element with portal content wrapped in wrapper component
|
|
194
|
+
*/
|
|
195
|
+
Component(props) {
|
|
196
|
+
var _a;
|
|
197
|
+
const { visible, params } = this.useState();
|
|
198
|
+
const wrapperProps = useStore(this._wrapperProps);
|
|
199
|
+
const _b = props || {}, { portalProps = {} } = _b, propParams = __rest(_b, ["portalProps"]);
|
|
200
|
+
const [mounted, setMounted] = React.useState(visible);
|
|
201
|
+
React.useEffect(() => {
|
|
202
|
+
var _a, _b;
|
|
203
|
+
if (visible) {
|
|
204
|
+
setMounted(true);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
const timer = setTimeout(() => setMounted(false), (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.transitionDuration) !== null && _b !== void 0 ? _b : 0);
|
|
208
|
+
return () => clearTimeout(timer);
|
|
209
|
+
}, [visible]);
|
|
210
|
+
const Content = this.RenderContent;
|
|
211
|
+
if (!Content) {
|
|
212
|
+
logger.warn(`${this.displayName} ${this.id} has no content. Did you forget to call .content()?`);
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
if (!visible && !mounted && !((_a = this._config) === null || _a === void 0 ? void 0 : _a.rendersWhenHidden))
|
|
216
|
+
return null;
|
|
217
|
+
const request = this.requestHandler.getRequestHandlers();
|
|
218
|
+
const lazyWrapperProps = (this === null || this === void 0 ? void 0 : this._lazyWrapperProps) ? this._lazyWrapperProps(params) : {};
|
|
219
|
+
const WrapperComponent = this.wrapperComponent;
|
|
220
|
+
return React.createElement(WrapperComponent, Object.assign({}, this._config, this._wrapperProps, portalProps, wrapperProps, lazyWrapperProps, { close: this.close, open: this.open, visible: visible, toggle: this.toggle, zIndex: this.stackIndex, ref: this.ref }),
|
|
221
|
+
React.createElement(Content, Object.assign({ visible: visible, toggle: this.toggle, close: this.close, open: this.open, setParams: this.setParams }, params, (propParams !== null && propParams !== void 0 ? propParams : {}), { request: this.hasPendingRequest ? request : undefined, nextOrToggle: this.toggle, previousOrToggle: this.toggle, ref: this.ref })));
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Creates a request promise that resolves when portal is closed with result.
|
|
225
|
+
* @param params - Parameters to pass to the portal
|
|
226
|
+
* @param force - Force new request even if one is pending
|
|
227
|
+
* @returns Promise that resolves with portal result
|
|
228
|
+
*/
|
|
229
|
+
request(params, force = false) {
|
|
230
|
+
return this.requestHandler.request(params, force);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Resets all registered portals to their closed initial state.
|
|
234
|
+
* Useful in test afterEach hooks to prevent state leaking between tests.
|
|
235
|
+
*/
|
|
236
|
+
static resetAll() {
|
|
237
|
+
Portal.registry.getAll().forEach(portal => {
|
|
238
|
+
var _a, _b;
|
|
239
|
+
(_a = portal.visible) === null || _a === void 0 ? void 0 : _a.set(false);
|
|
240
|
+
if (portal._initialParams !== undefined) {
|
|
241
|
+
(_b = portal.params) === null || _b === void 0 ? void 0 : _b.set(portal._initialParams);
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Global outlet component that renders all non-independent portals.
|
|
247
|
+
* Place this once in your app root.
|
|
248
|
+
* @returns JSX element rendering all registered portals
|
|
249
|
+
*/
|
|
250
|
+
static GlobalOutlet() {
|
|
251
|
+
useStore(registeredIds);
|
|
252
|
+
const portals = Portal.registry.filter(p => { var _a; return !((_a = p._config) === null || _a === void 0 ? void 0 : _a.independent); });
|
|
253
|
+
return React.createElement(React.Fragment, null, portals.map(portal => React.createElement(portal.Component, { key: portal.id })));
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
Portal.registry = new PortalRegistry();
|
|
257
|
+
Portal.generateId = randomId;
|
|
258
|
+
//# sourceMappingURL=Portal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Portal.js","sourceRoot":"","sources":["../../src/lib/Portal.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAO,eAAe,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAa,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAI/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAW,EAAE,CAAC,CAAA;AAE/C;;;;;;;;;GASG;AACH,MAAM,OAAO,MAAyF,SAAQ,WAAmB;IAqBrH,gBAAgB;QACxB,OAAO,EAAE,CAAA;IACX,CAAC;IAED,IAAc,QAAQ;QACpB,OAAO,MAAM,CAAC,QAAQ,CAAA;IACxB,CAAC;IAED,IAAc,WAAW;QACvB,OAAO,MAAM,CAAC,UAAU,CAAA;IAC1B,CAAC;IAED,IAAc,yBAAyB;QACrC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAc,gBAAgB;QAC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;IACH,OAAO,CAAC,MAAe,EAAE,KAAK,GAAG,KAAK;QACpC,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IACnD,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACb,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;;YACxC,MAAA,MAAM,CAAC,OAAO,0CAAE,GAAG,CAAC,KAAK,CAAC,CAAA;YAC1B,IAAI,MAAM,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;gBACxC,MAAA,MAAM,CAAC,MAAM,0CAAE,GAAG,CAAC,MAAM,CAAC,cAAqB,CAAC,CAAA;YAClD,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,YAAY;QACjB,QAAQ,CAAC,aAAa,CAAC,CAAA;QACvB,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,WAAC,OAAA,CAAC,CAAA,MAAA,CAAC,CAAC,OAAO,0CAAE,WAAW,CAAA,CAAA,EAAA,CAAC,CAAA;QACpE,OAAO,0CAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,oBAAC,MAAM,CAAC,SAAS,IAAC,GAAG,EAAE,MAAM,CAAC,EAAE,GAAI,CAAC,CAAI,CAAA;IAC3E,CAAC;;AA3SM,eAAQ,GAAG,IAAI,cAAc,EAAyB,AAA9C,CAA8C;AAEtD,iBAAU,GAAG,QAAQ,AAAX,CAAW"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry for managing portal instances and their stacking order.
|
|
3
|
+
* Maintains a registry of portals by ID and tracks their z-index stack.
|
|
4
|
+
*
|
|
5
|
+
* @template T - Type of portal instances to manage
|
|
6
|
+
*/
|
|
7
|
+
export class PortalRegistry {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.registry = {};
|
|
10
|
+
this.stack = [];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Registers a portal instance with an ID.
|
|
14
|
+
* @param id - Unique identifier for the portal
|
|
15
|
+
* @param instance - Portal instance to register
|
|
16
|
+
*/
|
|
17
|
+
register(id, instance) {
|
|
18
|
+
this.registry[id] = instance;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Unregisters a portal and removes it from the stack.
|
|
22
|
+
* @param id - Portal ID to unregister
|
|
23
|
+
*/
|
|
24
|
+
unregister(id) {
|
|
25
|
+
delete this.registry[id];
|
|
26
|
+
this.remove(id);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves a portal instance by ID.
|
|
30
|
+
* @param id - Portal ID to retrieve
|
|
31
|
+
* @returns Portal instance or undefined
|
|
32
|
+
*/
|
|
33
|
+
getInstance(id) {
|
|
34
|
+
return this.registry[id];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Adds a portal ID to the top of the stack.
|
|
38
|
+
* @param id - Portal ID to push
|
|
39
|
+
*/
|
|
40
|
+
push(id) {
|
|
41
|
+
this.stack.push(id);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Removes a portal ID from the stack and all portals above it.
|
|
45
|
+
* @param id - Portal ID to remove
|
|
46
|
+
*/
|
|
47
|
+
remove(id) {
|
|
48
|
+
const index = this.stack.indexOf(id);
|
|
49
|
+
if (index > -1) {
|
|
50
|
+
this.stack = this.stack.slice(0, index);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Gets the stack index (z-index position) of a portal.
|
|
55
|
+
* @param id - Portal ID to find
|
|
56
|
+
* @returns Stack index or -1 if not found
|
|
57
|
+
*/
|
|
58
|
+
getStackIndex(id) {
|
|
59
|
+
return this.stack.indexOf(id);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Retrieves all registered portal instances.
|
|
63
|
+
* @returns Array of all portal instances
|
|
64
|
+
*/
|
|
65
|
+
getAll() {
|
|
66
|
+
return Object.values(this.registry);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Filters portal instances by predicate function.
|
|
70
|
+
* @param predicate - Function to test each instance
|
|
71
|
+
* @returns Filtered array of portal instances
|
|
72
|
+
*/
|
|
73
|
+
filter(predicate) {
|
|
74
|
+
return this.getAll().filter(predicate);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Clears all portals from registry and stack.
|
|
78
|
+
*/
|
|
79
|
+
clear() {
|
|
80
|
+
this.registry = {};
|
|
81
|
+
this.stack = [];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=PortalRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortalRegistry.js","sourceRoot":"","sources":["../../src/lib/PortalRegistry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IAA3B;QACU,aAAQ,GAAsB,EAAE,CAAA;QAEhC,UAAK,GAAa,EAAE,CAAA;IAiF9B,CAAC;IA/EC;;;;OAIG;IACH,QAAQ,CAAC,EAAU,EAAE,QAAW;QAC9B,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAA;IAC9B,CAAC;IAED;;;OAGG;IACH,UAAU,CAAC,EAAU;QACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;QACxB,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IACjB,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,EAAU;QACpB,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAC1B,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,EAAU;QACb,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACrB,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,EAAU;QACf,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QACpC,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;QACzC,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,aAAa,CAAC,EAAU;QACtB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IAC/B,CAAC;IAED;;;OAGG;IACH,MAAM;QACJ,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACrC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,SAAmC;QACxC,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IACxC,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAA;QAClB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAA;IACjB,CAAC;CACF"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handles promise-based portal requests with resolve/reject semantics.
|
|
3
|
+
* Manages the async flow of opening a portal and waiting for a result.
|
|
4
|
+
*
|
|
5
|
+
* @template Params - Parameters for opening the portal
|
|
6
|
+
* @template Result - Type of result returned when request resolves
|
|
7
|
+
*/
|
|
8
|
+
export class PortalRequest {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a portal request handler.
|
|
11
|
+
* @param onOpen - Function to call when opening portal
|
|
12
|
+
* @param onClose - Function to call when closing portal
|
|
13
|
+
*/
|
|
14
|
+
constructor(onOpen, onClose) {
|
|
15
|
+
this.onOpen = onOpen;
|
|
16
|
+
this.onClose = onClose;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Checks if there's a pending request waiting for resolution.
|
|
20
|
+
* @returns True if request is pending
|
|
21
|
+
*/
|
|
22
|
+
get hasPendingRequest() {
|
|
23
|
+
return !!this.resolve && !!this.reject;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new request promise that opens the portal and waits for result.
|
|
27
|
+
* @param params - Parameters to pass when opening portal
|
|
28
|
+
* @param force - Force new request even if one is pending
|
|
29
|
+
* @returns Promise that resolves with portal result
|
|
30
|
+
*/
|
|
31
|
+
request(params, force = false) {
|
|
32
|
+
if (this.hasPendingRequest && !force) {
|
|
33
|
+
return Promise.reject(new Error('This portal already has a pending request'));
|
|
34
|
+
}
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
const onResolve = (result) => {
|
|
37
|
+
resolve(result);
|
|
38
|
+
this.onClose();
|
|
39
|
+
this.clearRequest();
|
|
40
|
+
};
|
|
41
|
+
const onReject = (reason) => {
|
|
42
|
+
reject(reason);
|
|
43
|
+
this.onClose();
|
|
44
|
+
this.clearRequest();
|
|
45
|
+
};
|
|
46
|
+
this.resolve = onResolve;
|
|
47
|
+
this.reject = onReject;
|
|
48
|
+
this.onOpen(params);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Clears the current request resolve/reject handlers.
|
|
53
|
+
*/
|
|
54
|
+
clearRequest() {
|
|
55
|
+
this.resolve = undefined;
|
|
56
|
+
this.reject = undefined;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Gets the current request handlers for resolve and reject.
|
|
60
|
+
* @returns Object with resolve and reject functions
|
|
61
|
+
*/
|
|
62
|
+
getRequestHandlers() {
|
|
63
|
+
return {
|
|
64
|
+
resolve: this.resolve,
|
|
65
|
+
reject: this.reject,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=PortalRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortalRequ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AS,CAAA;QACxB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAA;IACzB,CAAC;IAED;;;OAGG;IACH,kBAAkB;QAChB,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { atom, onMount, task } from 'nanostores';
|
|
11
|
+
import { TypeGuards } from '@codeleap/types';
|
|
12
|
+
import { awaitTransition } from '../utils';
|
|
13
|
+
function initAtomWithPromise(a, promise) {
|
|
14
|
+
onMount(a, () => {
|
|
15
|
+
task(() => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
a.set(yield promise);
|
|
17
|
+
}));
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Manages portal visibility and parameter state with nanostores.
|
|
22
|
+
* Handles opening, closing, toggling and parameter updates.
|
|
23
|
+
*
|
|
24
|
+
* @template Params - Type of parameters managed by the state
|
|
25
|
+
*/
|
|
26
|
+
export class PortalState {
|
|
27
|
+
/**
|
|
28
|
+
* Asserts the portal state has been initialized and returns the initialized stores.
|
|
29
|
+
* @throws Error if `initializeState()` has not been called yet
|
|
30
|
+
*/
|
|
31
|
+
assertInitialized() {
|
|
32
|
+
if (!this.visible || !this.params || !this.config || this._initialParams === undefined) {
|
|
33
|
+
throw new Error('PortalState has not been initialized. Call initializeState() first.');
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
visible: this.visible,
|
|
37
|
+
params: this.params,
|
|
38
|
+
config: this.config,
|
|
39
|
+
initialParams: this._initialParams,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Initializes the portal state with configuration.
|
|
44
|
+
* @param config - Configuration for initial state, visibility and params
|
|
45
|
+
*/
|
|
46
|
+
initializeState(config) {
|
|
47
|
+
var _a;
|
|
48
|
+
this.config = config;
|
|
49
|
+
const initialVisible = TypeGuards.isBoolean(config.startsOpen) ? config.startsOpen : false;
|
|
50
|
+
const initialParams = TypeGuards.isFunction(config.initialParams)
|
|
51
|
+
? {}
|
|
52
|
+
: ((_a = config.initialParams) !== null && _a !== void 0 ? _a : {});
|
|
53
|
+
this._initialParams = initialParams;
|
|
54
|
+
this.visible = atom(initialVisible);
|
|
55
|
+
this.params = atom(initialParams);
|
|
56
|
+
if (TypeGuards.isFunction(config.startsOpen)) {
|
|
57
|
+
initAtomWithPromise(this.visible, config.startsOpen());
|
|
58
|
+
}
|
|
59
|
+
if (TypeGuards.isFunction(config.initialParams)) {
|
|
60
|
+
initAtomWithPromise(this.params, config.initialParams().then(p => {
|
|
61
|
+
this._initialParams = p;
|
|
62
|
+
return p;
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** Gets the current visibility state. */
|
|
67
|
+
get isVisible() {
|
|
68
|
+
const { visible } = this.assertInitialized();
|
|
69
|
+
return visible.get();
|
|
70
|
+
}
|
|
71
|
+
/** Gets the current parameter values. */
|
|
72
|
+
get currentParams() {
|
|
73
|
+
const { params } = this.assertInitialized();
|
|
74
|
+
return params.get();
|
|
75
|
+
}
|
|
76
|
+
awaitTransition(count = 1) {
|
|
77
|
+
const { config } = this.assertInitialized();
|
|
78
|
+
return awaitTransition(count, config.transitionDuration);
|
|
79
|
+
}
|
|
80
|
+
/** Lifecycle hook called after the portal opens. Override in subclasses to run custom logic. */
|
|
81
|
+
handleOpen() { }
|
|
82
|
+
/**
|
|
83
|
+
* Opens the portal with optional parameters.
|
|
84
|
+
* @param params - Parameters to merge with current params
|
|
85
|
+
*/
|
|
86
|
+
open(params) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const { visible, params: paramsAtom } = this.assertInitialized();
|
|
89
|
+
if (visible.get()) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (params) {
|
|
93
|
+
paramsAtom.set(Object.assign(Object.assign({}, paramsAtom.get()), params));
|
|
94
|
+
}
|
|
95
|
+
visible.set(true);
|
|
96
|
+
yield this.awaitTransition();
|
|
97
|
+
this.handleOpen();
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/** Lifecycle hook called after the portal closes. Override in subclasses to run custom logic. */
|
|
101
|
+
handleClose() { }
|
|
102
|
+
/**
|
|
103
|
+
* Closes the portal and optionally resets parameters.
|
|
104
|
+
*/
|
|
105
|
+
close() {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
const { visible, config } = this.assertInitialized();
|
|
108
|
+
if (!visible.get()) {
|
|
109
|
+
return this.awaitTransition();
|
|
110
|
+
}
|
|
111
|
+
visible.set(false);
|
|
112
|
+
if (config.resetParamsOnClose) {
|
|
113
|
+
setTimeout(() => {
|
|
114
|
+
this.resetParams();
|
|
115
|
+
}, 1000);
|
|
116
|
+
}
|
|
117
|
+
this.handleClose();
|
|
118
|
+
yield this.awaitTransition();
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Toggles portal visibility (opens if closed, closes if open).
|
|
123
|
+
*/
|
|
124
|
+
toggle() {
|
|
125
|
+
const { visible } = this.assertInitialized();
|
|
126
|
+
if (visible.get()) {
|
|
127
|
+
return this.close();
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
return this.open();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Updates portal parameters by merging with current params.
|
|
135
|
+
* @param next - Partial params or updater function
|
|
136
|
+
*/
|
|
137
|
+
setParams(next) {
|
|
138
|
+
const { params } = this.assertInitialized();
|
|
139
|
+
const prev = params.get();
|
|
140
|
+
const patch = TypeGuards.isFunction(next) ? next(prev) : next;
|
|
141
|
+
params.set(Object.assign(Object.assign({}, prev), patch));
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Resets parameters to initial values.
|
|
145
|
+
*/
|
|
146
|
+
resetParams() {
|
|
147
|
+
const { params, initialParams } = this.assertInitialized();
|
|
148
|
+
params.set(initialParams);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Gets current parameter values.
|
|
152
|
+
* @returns Current params object
|
|
153
|
+
*/
|
|
154
|
+
getParams() {
|
|
155
|
+
const { params } = this.assertInitialized();
|
|
156
|
+
return params.get();
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Subscribes to visibility changes.
|
|
160
|
+
* @param callback - Function called when visibility changes
|
|
161
|
+
* @returns Unsubscribe function
|
|
162
|
+
*/
|
|
163
|
+
subscribe(callback) {
|
|
164
|
+
const { visible } = this.assertInitialized();
|
|
165
|
+
return visible.subscribe(callback);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=PortalState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortalState.js","sourceRoot":"","sources":["../../src/lib/PortalState.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAI1C,SAAS,mBAAmB,CAAI,CAAW,EAAE,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CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QAE7D,MAAM,CAAC,GAAG,iCACL,IAAI,GACJ,KAAK,EACR,CAAA;IACJ,CAAC;IAED;;OAEG;IACH,WAAW;QACT,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAC1D,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IAC3B,CAAC;IAED;;;OAGG;IACH,SAAS;QACP,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAC3C,OAAO,MAAM,CAAC,GAAG,EAAE,CAAA;IACrB,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAC,QAA0D;QAClE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAC5C,OAAO,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;IACpC,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"misc.js","sourceRoot":"","sources":["../../src/types/misc.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal.js","sourceRoot":"","sources":["../../src/types/portal.ts"],"names":[],"mappings":""}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { waitFor } from '@codeleap/utils';
|
|
11
|
+
/**
|
|
12
|
+
* Generates a random 7-character alphanumeric ID.
|
|
13
|
+
* @returns Random ID string
|
|
14
|
+
*/
|
|
15
|
+
export const randomId = () => {
|
|
16
|
+
return Math.random().toString(36).slice(2, 9);
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Waits for one or more animation transitions to complete.
|
|
20
|
+
* @param count - Number of transitions to wait for (defaults to 1)
|
|
21
|
+
* @param duration - Duration per transition in milliseconds (defaults to 1000)
|
|
22
|
+
*/
|
|
23
|
+
export function awaitTransition(count_1) {
|
|
24
|
+
return __awaiter(this, arguments, void 0, function* (count, duration = 1000) {
|
|
25
|
+
for (let i = 0; i < (count !== null && count !== void 0 ? count : 1); i++) {
|
|
26
|
+
yield waitFor(duration);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAC/C,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,UAAgB,eAAe;yDAAC,KAAc,EAAE,QAAQ,GAAG,IAAI;QACnE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAA;QACzB,CAAC;IACH,CAAC;CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/portals",
|
|
3
|
-
"version": "7.0.
|
|
4
|
-
"main": "
|
|
3
|
+
"version": "7.0.1",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"directory": "packages/portals"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@codeleap/types": "7.0.
|
|
26
|
-
"@codeleap/config": "7.0.
|
|
27
|
-
"@codeleap/utils": "7.0.
|
|
28
|
-
"@codeleap/logger": "7.0.
|
|
25
|
+
"@codeleap/types": "7.0.1",
|
|
26
|
+
"@codeleap/config": "7.0.1",
|
|
27
|
+
"@codeleap/utils": "7.0.1",
|
|
28
|
+
"@codeleap/logger": "7.0.1",
|
|
29
29
|
"ts-node-dev": "1.1.8"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"run-sc": "tsnd --transpile-only"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@codeleap/types": "7.0.
|
|
39
|
-
"@codeleap/utils": "7.0.
|
|
40
|
-
"@codeleap/logger": "7.0.
|
|
38
|
+
"@codeleap/types": "7.0.1",
|
|
39
|
+
"@codeleap/utils": "7.0.1",
|
|
40
|
+
"@codeleap/logger": "7.0.1",
|
|
41
41
|
"typescript": "6.0.3",
|
|
42
42
|
"react": "19.1.0",
|
|
43
43
|
"nanostores": "*",
|