@lerx/promise-modal 0.4.2 → 0.5.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.
@@ -2,7 +2,7 @@ import type { Fn } from '../@aileron/declare';
2
2
  import type { Modal } from '../types';
3
3
  export declare class ModalManager {
4
4
  #private;
5
- static activate(): boolean;
5
+ static initialize(): boolean;
6
6
  static anchor(options?: {
7
7
  tag?: string;
8
8
  prefix?: string;
package/dist/index.cjs CHANGED
@@ -16,11 +16,11 @@ const render = require('@winglet/react-utils/render');
16
16
  const console = require('@winglet/common-utils/console');
17
17
 
18
18
  class ModalManager {
19
- static #active = false;
20
- static activate() {
21
- if (ModalManager.#active)
19
+ static #initialized = false;
20
+ static initialize() {
21
+ if (ModalManager.#initialized)
22
22
  return false;
23
- return (ModalManager.#active = true);
23
+ return (ModalManager.#initialized = true);
24
24
  }
25
25
  static #anchor = null;
26
26
  static #scope = `promise-modal-${lib.getRandomString(36)}`;
@@ -61,7 +61,7 @@ class ModalManager {
61
61
  return `${styleId}-${ModalManager.#hash}`;
62
62
  }
63
63
  static reset() {
64
- ModalManager.#active = false;
64
+ ModalManager.#initialized = false;
65
65
  ModalManager.#anchor = null;
66
66
  ModalManager.#prerenderList = [];
67
67
  ModalManager.#openHandler = (modal) => ModalManager.#prerenderList.push(modal);
@@ -862,7 +862,7 @@ const Anchor = react.memo(hoc.withErrorBoundary(AnchorInner));
862
862
  const bootstrap = ({ ForegroundComponent, BackgroundComponent, TitleComponent, SubtitleComponent, ContentComponent, FooterComponent, usePathname, options, context, anchor, }) => reactDom.createPortal(jsxRuntime.jsx(UserDefinedContextProvider, { context: context, children: jsxRuntime.jsx(ConfigurationContextProvider, { ForegroundComponent: ForegroundComponent, BackgroundComponent: BackgroundComponent, TitleComponent: TitleComponent, SubtitleComponent: SubtitleComponent, ContentComponent: ContentComponent, FooterComponent: FooterComponent, options: options, children: jsxRuntime.jsx(ModalManagerContextProvider, { usePathname: usePathname, children: jsxRuntime.jsx(Anchor, {}) }) }) }), anchor);
863
863
 
864
864
  const useInitialize = () => {
865
- const permitted = react.useRef(ModalManager.activate());
865
+ const permitted = react.useRef(ModalManager.initialize());
866
866
  const anchorRef = react.useRef(null);
867
867
  const [, update] = hook.useVersion();
868
868
  const handleInitialize = react.useCallback((root) => {
package/dist/index.mjs CHANGED
@@ -14,11 +14,11 @@ import { renderComponent } from '@winglet/react-utils/render';
14
14
  import { printError } from '@winglet/common-utils/console';
15
15
 
16
16
  class ModalManager {
17
- static #active = false;
18
- static activate() {
19
- if (ModalManager.#active)
17
+ static #initialized = false;
18
+ static initialize() {
19
+ if (ModalManager.#initialized)
20
20
  return false;
21
- return (ModalManager.#active = true);
21
+ return (ModalManager.#initialized = true);
22
22
  }
23
23
  static #anchor = null;
24
24
  static #scope = `promise-modal-${getRandomString(36)}`;
@@ -59,7 +59,7 @@ class ModalManager {
59
59
  return `${styleId}-${ModalManager.#hash}`;
60
60
  }
61
61
  static reset() {
62
- ModalManager.#active = false;
62
+ ModalManager.#initialized = false;
63
63
  ModalManager.#anchor = null;
64
64
  ModalManager.#prerenderList = [];
65
65
  ModalManager.#openHandler = (modal) => ModalManager.#prerenderList.push(modal);
@@ -860,7 +860,7 @@ const Anchor = memo(withErrorBoundary(AnchorInner));
860
860
  const bootstrap = ({ ForegroundComponent, BackgroundComponent, TitleComponent, SubtitleComponent, ContentComponent, FooterComponent, usePathname, options, context, anchor, }) => createPortal(jsx(UserDefinedContextProvider, { context: context, children: jsx(ConfigurationContextProvider, { ForegroundComponent: ForegroundComponent, BackgroundComponent: BackgroundComponent, TitleComponent: TitleComponent, SubtitleComponent: SubtitleComponent, ContentComponent: ContentComponent, FooterComponent: FooterComponent, options: options, children: jsx(ModalManagerContextProvider, { usePathname: usePathname, children: jsx(Anchor, {}) }) }) }), anchor);
861
861
 
862
862
  const useInitialize = () => {
863
- const permitted = useRef(ModalManager.activate());
863
+ const permitted = useRef(ModalManager.initialize());
864
864
  const anchorRef = useRef(null);
865
865
  const [, update] = useVersion();
866
866
  const handleInitialize = useCallback((root) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lerx/promise-modal",
3
- "version": "0.4.2",
3
+ "version": "0.5.1",
4
4
  "description": "Universal React modal utility that can be used outside React components with promise-based results for alert, confirm, and prompt modals",
5
5
  "keywords": [
6
6
  "react",
@@ -64,9 +64,9 @@
64
64
  "version:patch": "yarn version patch"
65
65
  },
66
66
  "dependencies": {
67
- "@winglet/common-utils": "^0.4.4",
68
- "@winglet/react-utils": "^0.4.2",
69
- "@winglet/style-utils": "^0.4.2"
67
+ "@winglet/common-utils": "^0.5.1",
68
+ "@winglet/react-utils": "^0.5.1",
69
+ "@winglet/style-utils": "^0.5.1"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/react": "^19.0.0",