@lerx/promise-modal 0.0.17 → 0.0.18
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/components/Background/Background.d.ts +1 -1
- package/dist/components/Background/Background.d.ts.map +1 -1
- package/dist/components/Background/index.d.ts +1 -1
- package/dist/components/Background/index.d.ts.map +1 -1
- package/dist/components/Foreground/Foreground.d.ts +1 -1
- package/dist/components/Foreground/Foreground.d.ts.map +1 -1
- package/dist/components/Foreground/components/AlertInner.d.ts.map +1 -1
- package/dist/components/Foreground/components/ConfirmInner.d.ts.map +1 -1
- package/dist/components/Foreground/components/PromptInner.d.ts.map +1 -1
- package/dist/components/Foreground/index.d.ts +1 -1
- package/dist/components/Foreground/index.d.ts.map +1 -1
- package/dist/core/handle/prompt.d.ts.map +1 -1
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/providers/ModalContext/ModalContext.d.ts +5 -5
- package/dist/providers/ModalContext/ModalContext.d.ts.map +1 -1
- package/dist/providers/ModalContext/ModalContextProvider.d.ts +7 -6
- package/dist/providers/ModalContext/ModalContextProvider.d.ts.map +1 -1
- package/dist/providers/UserDefinedContext/UserDefinedContext.d.ts +6 -0
- package/dist/providers/UserDefinedContext/UserDefinedContext.d.ts.map +1 -0
- package/dist/providers/UserDefinedContext/UserDefinedContextProvider.d.ts +8 -0
- package/dist/providers/UserDefinedContext/UserDefinedContextProvider.d.ts.map +1 -0
- package/dist/providers/UserDefinedContext/index.d.ts +3 -0
- package/dist/providers/UserDefinedContext/index.d.ts.map +1 -0
- package/dist/providers/UserDefinedContext/useUserDefinedContext.d.ts +3 -0
- package/dist/providers/UserDefinedContext/useUserDefinedContext.d.ts.map +1 -0
- package/dist/types/alert.d.ts +7 -5
- package/dist/types/alert.d.ts.map +1 -1
- package/dist/types/base.d.ts +8 -2
- package/dist/types/base.d.ts.map +1 -1
- package/dist/types/confirm.d.ts +7 -5
- package/dist/types/confirm.d.ts.map +1 -1
- package/dist/types/modal.d.ts +4 -3
- package/dist/types/modal.d.ts.map +1 -1
- package/dist/types/prompt.d.ts +14 -12
- package/dist/types/prompt.d.ts.map +1 -1
- package/package.json +11 -11
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ModalLayerProps } from '../../types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const BackgroundFrame: ({ modalId, onChangeOrder, }: ModalLayerProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
3
3
|
//# sourceMappingURL=Background.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Background.d.ts","sourceRoot":"","sources":["../../../src/components/Background/Background.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Background.d.ts","sourceRoot":"","sources":["../../../src/components/Background/Background.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,eAAO,MAAM,eAAe,gCAGzB,eAAe,mDAgDjB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Background } from './Background';
|
|
1
|
+
export { BackgroundFrame as Background } from './Background';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Background/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Background/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ModalLayerProps } from '../../types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const ForegroundFrame: ({ modalId, onChangeOrder, }: ModalLayerProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
3
3
|
//# sourceMappingURL=Foreground.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Foreground.d.ts","sourceRoot":"","sources":["../../../src/components/Foreground/Foreground.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Foreground.d.ts","sourceRoot":"","sources":["../../../src/components/Foreground/Foreground.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAK7D,eAAO,MAAM,eAAe,gCAGzB,eAAe,mDAmDjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertInner.d.ts","sourceRoot":"","sources":["../../../../src/components/Foreground/components/AlertInner.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"AlertInner.d.ts","sourceRoot":"","sources":["../../../../src/components/Foreground/components/AlertInner.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,UAAU,eAAe,CAAC,CAAC;IACzB,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACpB,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;CAC3C;AAED,eAAO,MAAM,UAAU,wCACpB,CAAC,uBAAwB,eAAe,CAAC,CAAC,CAAC,8CA2D7C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmInner.d.ts","sourceRoot":"","sources":["../../../../src/components/Foreground/components/ConfirmInner.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfirmInner.d.ts","sourceRoot":"","sources":["../../../../src/components/Foreground/components/ConfirmInner.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,UAAU,iBAAiB,CAAC,CAAC;IAC3B,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACtB,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,WAAW,GAAG,SAAS,CAAC,CAAC;CACvD;AAED,eAAO,MAAM,YAAY,wCACtB,CAAC,uBAAwB,iBAAiB,CAAC,CAAC,CAAC,8CAkE/C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromptInner.d.ts","sourceRoot":"","sources":["../../../../src/components/Foreground/components/PromptInner.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"PromptInner.d.ts","sourceRoot":"","sources":["../../../../src/components/Foreground/components/PromptInner.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,UAAU,gBAAgB,CAAC,CAAC,EAAE,CAAC;IAC7B,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACxB,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC,CAAC;CACpE;AAED,eAAO,MAAM,WAAW,wCACrB,CAAC,EAAE,CAAC,uBAAuB,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,8CAyHnD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Foreground } from './Foreground';
|
|
1
|
+
export { ForegroundFrame as Foreground } from './Foreground';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Foreground/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Foreground/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../src/core/handle/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAI/B,UAAU,WAAW,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACxD,KAAK,EAAE,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;IACjD,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;IACjC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,aAA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,CAAC;IAC1C,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;CAC3C;AAED,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,CAAC,yLAcxB,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,eAwBnB,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),n=require("react"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),n=require("react"),t=require("react-dom"),o=require("@winglet/react-utils"),r=require("@winglet/common-utils"),i=require("@emotion/css");const s={current:[]},a={current:e=>{s.current.push(e)}},l={current:null},c={get prerender(){return s.current},clearPrerender(){s.current=[]},open(e){a.current(e)},setupOpen(e){a.current=e},anchor(e,n="promise-modal"){if(l.current){const e=document.getElementById(l.current.id);if(e)return e}const t=document.createElement(e);return t.setAttribute("id",`${n}-${r.getRandomString(36)}`),document.body.appendChild(t),l.current=t,t}},u="300ms",d="rgba(0, 0, 0, 0.5)",m=n.createContext({context:r.EMPTY_OBJECT}),p=({context:t,children:o})=>{const i=n.useMemo((()=>({context:t||r.EMPTY_OBJECT})),[t]);return e.jsx(m.Provider,{value:i,children:o})},f=()=>n.useContext(m);function b(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}const h=i.css("production"===process.env.NODE_ENV?{name:"u7uu4v",styles:"display:none;position:fixed;inset:0;z-index:-999;pointer-events:none;>*{pointer-events:none;}"}:{name:"coymdj-background",styles:"display:none;position:fixed;inset:0;z-index:-999;pointer-events:none;>*{pointer-events:none;};label:background;",toString:b}),C=i.css("production"===process.env.NODE_ENV?{name:"n07k1x",styles:"pointer-events:all"}:{name:"1hektcs-active",styles:"pointer-events:all;label:active;",toString:b}),g=i.css("production"===process.env.NODE_ENV?{name:"1wnowod",styles:"display:flex;align-items:center;justify-content:center"}:{name:"xppew7-visible",styles:"display:flex;align-items:center;justify-content:center;label:visible;",toString:b}),y=({modalId:t,onChangeOrder:o})=>{const{BackgroundComponent:r}=ue(),{context:s}=f(),{modal:a,onClose:l,onChange:c,onConfirm:u,onDestroy:d}=K(t),m=n.useCallback((e=>{a&&a.closeOnBackdropClick&&a.visible&&l(),e.stopPropagation()}),[a,l]),p=n.useMemo((()=>a?.BackgroundComponent||r),[r,a]);return a?e.jsx("div",{className:i.cx(h,{[g]:a.manualDestroy?a.alive:a.visible,[C]:a.closeOnBackdropClick&&a.visible}),onClick:m,children:p&&e.jsx(p,{id:a.id,type:a.type,alive:a.alive,visible:a.visible,initiator:a.initiator,manualDestroy:a.manualDestroy,closeOnBackdropClick:a.closeOnBackdropClick,background:a.background,onChange:c,onConfirm:u,onClose:l,onDestroy:d,onChangeOrder:o,context:s})}):null};function v(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}const k=i.css("production"===process.env.NODE_ENV?{name:"12g0hx0",styles:"pointer-events:none;display:none;position:fixed;inset:0;z-index:1"}:{name:"1hcczik-foreground",styles:"pointer-events:none;display:none;position:fixed;inset:0;z-index:1;label:foreground;",toString:v}),x=i.css("production"===process.env.NODE_ENV?{name:"1g95xyq",styles:">*{pointer-events:all;}"}:{name:"123csva-active",styles:">*{pointer-events:all;};label:active;",toString:v}),j=i.css("production"===process.env.NODE_ENV?{name:"1fmljv2",styles:"display:flex!important;justify-content:center;align-items:center"}:{name:"1p4unab-visible",styles:"display:flex!important;justify-content:center;align-items:center;label:visible;",toString:v}),O=n.memo((({modal:t,handlers:i})=>{const{title:s,subtitle:a,content:l,footer:c}=n.useMemo((()=>t),[t]),{context:u}=f(),{onConfirm:d}=n.useMemo((()=>i),[i]),m=o.useHandle(d),{TitleComponent:p,SubtitleComponent:b,ContentComponent:h,FooterComponent:C}=ue();return e.jsxs(n.Fragment,{children:[s&&(r.isString(s)?e.jsx(p,{context:u,children:s}):s),a&&(r.isString(a)?e.jsx(b,{context:u,children:a}):a),l&&(r.isString(l)?e.jsx(h,{context:u,children:l}):o.renderComponent(l,{onConfirm:m})),!1!==c&&("function"==typeof c?c({onConfirm:m,context:u}):e.jsx(C,{onConfirm:m,confirmLabel:c?.confirm,hideConfirm:c?.hideConfirm,context:u}))]})})),w=n.memo((({modal:t,handlers:i})=>{const{title:s,subtitle:a,content:l,footer:c}=n.useMemo((()=>t),[t]),{context:u}=f(),{onConfirm:d,onClose:m}=n.useMemo((()=>i),[i]),p=o.useHandle(d),b=o.useHandle(m),{TitleComponent:h,SubtitleComponent:C,ContentComponent:g,FooterComponent:y}=ue();return e.jsxs(n.Fragment,{children:[s&&(r.isString(s)?e.jsx(h,{context:u,children:s}):s),a&&(r.isString(a)?e.jsx(C,{context:u,children:a}):a),l&&(r.isString(l)?e.jsx(g,{context:u,children:l}):o.renderComponent(l,{onConfirm:p,onCancel:b,context:u})),!1!==c&&("function"==typeof c?c({onConfirm:p,onCancel:b,context:u}):e.jsx(y,{onConfirm:p,onCancel:b,confirmLabel:c?.confirm,cancelLabel:c?.cancel,hideConfirm:c?.hideConfirm,hideCancel:c?.hideCancel,context:u}))]})})),D=n.memo((({modal:t,handlers:i})=>{const{Input:s,defaultValue:a,disabled:l,title:c,subtitle:u,content:d,footer:m}=n.useMemo((()=>({...t,Input:n.memo(o.withErrorBoundary(t.Input))})),[t]),{context:p}=f(),[b,h]=n.useState(a),{onChange:C,onClose:g,onConfirm:y}=n.useMemo((()=>i),[i]),v=o.useHandle(g),k=o.useHandle((e=>{const n=r.isFunction(e)?e(b):e;h(n),C(n)})),x=n.useCallback((()=>{setTimeout((()=>{y()}))}),[y]),j=n.useMemo((()=>!!b&&!!l?.(b)),[l,b]),{TitleComponent:O,SubtitleComponent:w,ContentComponent:D,FooterComponent:B}=ue();return e.jsxs(n.Fragment,{children:[c&&(r.isString(c)?e.jsx(O,{context:p,children:c}):c),u&&(r.isString(u)?e.jsx(w,{context:p,children:u}):u),d&&(r.isString(d)?e.jsx(D,{context:p,children:d}):o.renderComponent(d,{onConfirm:x,onCancel:v,context:p})),s&&e.jsx(s,{defaultValue:a,value:b,onChange:k,onConfirm:x,onCancel:v,context:p}),!1!==m&&("function"==typeof m?m({value:b,disabled:j,onChange:k,onConfirm:x,onCancel:v,context:p}):e.jsx(B,{disabled:j,onConfirm:x,onCancel:v,confirmLabel:m?.confirm,cancelLabel:m?.cancel,hideConfirm:m?.hideConfirm,hideCancel:m?.hideCancel,context:p}))]})})),B=({modalId:t,onChangeOrder:o})=>{const{ForegroundComponent:r}=ue(),{context:s}=f(),{modal:a,onChange:l,onConfirm:c,onClose:u,onDestroy:d}=K(t),m=n.useMemo((()=>a?.ForegroundComponent||r),[r,a]);return a?e.jsx("div",{className:i.cx(k,{[j]:a.manualDestroy?a.alive:a.visible,[x]:a.visible}),children:e.jsxs(m,{id:a.id,type:a.type,alive:a.alive,visible:a.visible,initiator:a.initiator,manualDestroy:a.manualDestroy,closeOnBackdropClick:a.closeOnBackdropClick,background:a.background,onChange:l,onConfirm:c,onClose:u,onDestroy:d,onChangeOrder:o,context:s,children:["alert"===a.type&&e.jsx(O,{modal:a,handlers:{onConfirm:c}}),"confirm"===a.type&&e.jsx(w,{modal:a,handlers:{onConfirm:c,onClose:u}}),"prompt"===a.type&&e.jsx(D,{modal:a,handlers:{onChange:l,onConfirm:c,onClose:u}})]})}):null},F=e=>{const[n,t]=o.useTick();return o.useOnMount((()=>{if(e)return e.subscribe(t)})),n},P=i.css("production"===process.env.NODE_ENV?{name:"13dmkf4",styles:"position:fixed;inset:0;pointer-events:none;overflow:hidden"}:{name:"yjeu12-presenter",styles:"position:fixed;inset:0;pointer-events:none;overflow:hidden;label:presenter;",toString:function(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}});let E=1;const M=n.memo((({modalId:t})=>{const r=n.useRef(null),{modal:i}=K(t);F(i);const s=o.useHandle((()=>{r.current&&(r.current.style.zIndex=""+E++)}));return e.jsxs("div",{ref:r,className:P,children:[e.jsx(y,{modalId:t,onChangeOrder:s}),e.jsx(B,{modalId:t,onChangeOrder:s})]})})),N=(e=0)=>{const{modalIds:t,getModalNode:o}=G();return n.useMemo((()=>{let e=0;for(const n of t)o(n)?.visible&&e++;return e}),[o,t,e])};
|
|
2
2
|
/******************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -14,5 +14,5 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
***************************************************************************** */
|
|
16
16
|
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
17
|
-
function E(e,n,o,t){if("a"===o&&!t)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof n?e!==n||!t:!n.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===o?t:"a"===o?t.call(e):t?t.value:n.get(e)}function M(e,n,o,t,r){if("m"===t)throw new TypeError("Private method is not writable");if("a"===t&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof n?e!==n||!r:!n.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===t?r.call(e,o):r?r.value=o:n.set(e,o),o}var N,S,I,V,T;"function"==typeof SuppressedError&&SuppressedError;class L{get alive(){return E(this,N,"f")}get visible(){return E(this,S,"f")}constructor({id:e,initiator:n,title:o,subtitle:t,background:r,manualDestroy:i=!1,closeOnBackdropClick:s=!0,resolve:a,ForegroundComponent:l,BackgroundComponent:c}){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"initiator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"subtitle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"background",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualDestroy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"closeOnBackdropClick",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ForegroundComponent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"BackgroundComponent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),N.set(this,void 0),S.set(this,void 0),I.set(this,void 0),V.set(this,[]),this.id=e,this.initiator=n,this.title=o,this.subtitle=t,this.background=r,this.manualDestroy=i,this.closeOnBackdropClick=s,this.ForegroundComponent=l,this.BackgroundComponent=c,M(this,N,!0,"f"),M(this,S,!0,"f"),M(this,I,a,"f")}subscribe(e){return E(this,V,"f").push(e),()=>{M(this,V,E(this,V,"f").filter((n=>n!==e)),"f")}}publish(){for(const e of E(this,V,"f"))e()}resolve(e){E(this,I,"f").call(this,e)}onDestroy(){const e=!0===E(this,N,"f");M(this,N,!1,"f"),this.manualDestroy&&e&&this.publish()}onShow(){const e=!1===E(this,S,"f");M(this,S,!0,"f"),e&&this.publish()}onHide(){const e=!0===E(this,S,"f");M(this,S,!1,"f"),e&&this.publish()}}N=new WeakMap,S=new WeakMap,I=new WeakMap,V=new WeakMap;class R extends L{constructor({id:e,initiator:n,type:o,subtype:t,title:r,subtitle:i,content:s,footer:a,background:l,manualDestroy:c,closeOnBackdropClick:u,resolve:d,ForegroundComponent:m,BackgroundComponent:p}){super({id:e,initiator:n,title:r,subtitle:i,background:l,manualDestroy:c,closeOnBackdropClick:u,resolve:d,ForegroundComponent:m,BackgroundComponent:p}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"subtype",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.type=o,this.subtype=t,this.content=s,this.footer=a}onClose(){this.resolve(null)}onConfirm(){this.resolve(null)}}class _ extends L{constructor({id:e,initiator:n,type:o,subtype:t,title:r,subtitle:i,content:s,footer:a,background:l,manualDestroy:c,closeOnBackdropClick:u,resolve:d,ForegroundComponent:m,BackgroundComponent:p}){super({id:e,initiator:n,title:r,subtitle:i,background:l,manualDestroy:c,closeOnBackdropClick:u,resolve:d,ForegroundComponent:m,BackgroundComponent:p}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"subtype",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.type=o,this.subtype=t,this.content=s,this.footer=a}onClose(){this.resolve(!1)}onConfirm(){this.resolve(!0)}}class q extends L{constructor({id:e,initiator:n,type:o,title:t,subtitle:r,content:i,defaultValue:s,Input:a,disabled:l,returnOnCancel:c,footer:u,background:d,manualDestroy:m,closeOnBackdropClick:p,resolve:f,ForegroundComponent:b,BackgroundComponent:h}){super({id:e,initiator:n,title:t,subtitle:r,background:d,manualDestroy:m,closeOnBackdropClick:p,resolve:f,ForegroundComponent:b,BackgroundComponent:h}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"Input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnOnCancel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),T.set(this,void 0),this.type=o,this.content=i,this.Input=a,this.defaultValue=s,M(this,T,s,"f"),this.disabled=l,this.returnOnCancel=c,this.footer=u}onChange(e){M(this,T,e,"f")}onConfirm(){this.resolve(E(this,T,"f")??null)}onClose(){this.returnOnCancel?this.resolve(E(this,T,"f")??null):this.resolve(null)}}T=new WeakMap;const H=e=>{switch(e.type){case"alert":return new R(e);case"confirm":return new _(e);case"prompt":return new q(e)}throw new Error(`Unknown modal: ${e.type}`,{modal:e})},z=/^\s*(\d+)\s*(ms|s|m|h)\s*$/,$=e=>{const[,n,o]=e.match(z)||[];if(!n||!o)return 0;const t=parseInt(n);return"ms"===o?t:"s"===o?1e3*t:"m"===o?60*t*1e3:"h"===o?60*t*60*1e3:0},A=n.createContext({modalIds:[],getModalNode:r.undefinedFunction,onChange:r.undefinedFunction,onConfirm:r.undefinedFunction,onClose:r.undefinedFunction,onDestroy:r.undefinedFunction,setUpdater:r.undefinedFunction,getModal:()=>({modal:void 0,onConfirm:r.undefinedFunction,onClose:r.undefinedFunction,onChange:r.undefinedFunction,onDestroy:r.undefinedFunction})}),W=n.memo((({pathname:o,children:r})=>{const i=n.useRef(new Map),[s,a]=n.useState([]),l=t.useReference(s),u=n.useRef(o),d=n.useRef(0),m=le(),p=n.useMemo((()=>$(m.duration)),[m]);t.useOnMountLayout((()=>{const{manualDestroy:e,closeOnBackdropClick:n}=m;for(const o of c.prerender){const t=H({...o,id:d.current++,initiator:u.current,manualDestroy:void 0!==o.manualDestroy?o.manualDestroy:e,closeOnBackdropClick:void 0!==o.closeOnBackdropClick?o.closeOnBackdropClick:n});i.current.set(t.id,t),a((e=>[...e,t.id]))}c.setupOpen((o=>{const t=H({...o,id:d.current++,initiator:u.current,manualDestroy:void 0!==o.manualDestroy?o.manualDestroy:e,closeOnBackdropClick:void 0!==o.closeOnBackdropClick?o.closeOnBackdropClick:n});i.current.set(t.id,t),a((e=>[...e.filter((e=>{const n=!i.current.get(e)?.alive;return n&&i.current.delete(e),!n})),t.id]))})),c.clearPrerender()})),n.useLayoutEffect((()=>{for(const e of l.current){const n=i.current.get(e);n?.alive&&(n.initiator===o?n.onShow():n.onHide())}u.current=o}),[l,o]);const f=n.useCallback((e=>i.current.get(e)),[]),b=n.useCallback((e=>{const n=i.current.get(e);n&&(n.onDestroy(),h.current?.())}),[]),h=n.useRef(),C=n.useCallback((e=>{const n=i.current.get(e);n&&(n.onHide(),h.current?.(),n.manualDestroy||setTimeout((()=>{n.onDestroy()}),p))}),[p]),g=n.useCallback(((e,n)=>{const o=i.current.get(e);o&&"prompt"===o.type&&o.onChange(n)}),[]),y=n.useCallback((e=>{const n=i.current.get(e);n&&(n.onConfirm(),C(e))}),[C]),v=n.useCallback((e=>{const n=i.current.get(e);n&&(n.onClose(),C(e))}),[C]),k=n.useCallback((e=>({modal:f(e),onConfirm:()=>y(e),onClose:()=>v(e),onChange:n=>g(e,n),onDestroy:()=>b(e)})),[f,y,v,g,b]),x=n.useMemo((()=>({modalIds:s,getModalNode:f,onChange:g,onConfirm:y,onClose:v,onDestroy:b,getModal:k,setUpdater:e=>{h.current=e}})),[s,k,f,g,y,v,b]);return e.jsx(A.Provider,{value:x,children:r})})),Y=()=>n.useContext(A),U=e=>{const{getModal:o}=Y();return n.useMemo((()=>o(e)),[e,o])},G=i.css("production"===process.env.NODE_ENV?{name:"2hpasy",styles:"display:flex;align-items:center;justify-content:center;position:fixed;inset:0;pointer-events:none;z-index:1000;transition:background-color ease-in-out"}:{name:"lhj8co-anchor",styles:"display:flex;align-items:center;justify-content:center;position:fixed;inset:0;pointer-events:none;z-index:1000;transition:background-color ease-in-out;label:anchor;",toString:function(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}}),J=n.memo(t.withErrorBoundary((()=>{const[o,r]=t.useTick(),{modalIds:i,setUpdater:s}=Y();n.useEffect((()=>{s(r)}),[s,r]);const{options:a}=ae(),l=P(o);return e.jsx("div",{className:G,style:{transitionDuration:a.duration,backgroundColor:l?a.backdrop:"transparent"},children:i.map((n=>e.jsx(F,{modalId:n},n)))})})));function K(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}const Q=i.css("production"===process.env.NODE_ENV?{name:"131j9g2",styles:"margin:unset"}:{name:"1w3kbco-fallback",styles:"margin:unset;label:fallback;",toString:K}),X=i.css("production"===process.env.NODE_ENV?{name:"1kuk3a3",styles:"display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:white;padding:20px 80px;gap:10px;border:1px solid black"}:{name:"16dbbea-frame",styles:"display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:white;padding:20px 80px;gap:10px;border:1px solid black;label:frame;",toString:K}),Z=({children:n})=>e.jsx("h2",{className:Q,children:n}),ee=({children:n})=>e.jsx("h3",{className:Q,children:n}),ne=({children:n})=>e.jsx("div",{className:Q,children:n}),oe=({confirmLabel:n,hideConfirm:o=!1,cancelLabel:t,hideCancel:r=!1,disabled:i,onConfirm:s,onCancel:a})=>e.jsxs("div",{children:[!o&&e.jsx("button",{onClick:s,disabled:i,children:n||"확인"}),!r&&"function"==typeof a&&e.jsx("button",{onClick:a,children:t||"취소"})]}),te=n.forwardRef((({id:o,onChangeOrder:t,children:r},i)=>{const s=P(),[a,l]=n.useMemo((()=>{const e=s>1;return[e?Math.floor(o/5)%3*100:0,e?o%5*35:0]}),[s,o]);return e.jsx("div",{ref:i,className:X,onClick:t,style:{marginBottom:`calc(25vh + ${a}px)`,marginLeft:`${a}px`,transform:`translate(${l}px, ${l}px)`},children:r})})),re=()=>{const[e,o]=n.useState(window.location.pathname);return n.useLayoutEffect((()=>{let n;const t=()=>{n&&cancelAnimationFrame(n),e!==window.location.pathname?o(window.location.pathname):n=requestAnimationFrame(t)};return n=requestAnimationFrame(t),()=>{n&&cancelAnimationFrame(n)}}),[e]),{pathname:e}},ie=n.createContext({ForegroundComponent:te,TitleComponent:Z,SubtitleComponent:ee,ContentComponent:ne,FooterComponent:oe,options:{duration:u,backdrop:d,manualDestroy:!1,closeOnBackdropClick:!0}}),se=n.memo((({ForegroundComponent:r,BackgroundComponent:i,TitleComponent:s,SubtitleComponent:a,ContentComponent:l,FooterComponent:m,options:p,usePathname:f,children:b})=>{const{pathname:h}=(f||re)(),[,C]=t.useTick(),g=n.useRef(null);t.useOnMount((()=>(g.current=c.anchor("div"),C(),()=>{g.current&&g.current.remove()})));const y=n.useMemo((()=>({BackgroundComponent:i,ForegroundComponent:r||te,TitleComponent:s||Z,SubtitleComponent:a||ee,ContentComponent:n.memo(l||ne),FooterComponent:n.memo(m||oe),options:{duration:u,backdrop:d,closeOnBackdropClick:!0,manualDestroy:!1,...p}})),[r,i,l,m,a,s,p]);return e.jsxs(ie.Provider,{value:y,children:[b,g.current&&o.createPortal(e.jsx(W,{pathname:h,children:e.jsx(J,{})}),g.current)]})})),ae=()=>n.useContext(ie),le=()=>{const{options:e}=n.useContext(ie);return e};exports.ModalProvider=se,exports.alert=({subtype:e,title:n,subtitle:o,content:t,background:r,footer:i,manualDestroy:s,closeOnBackdropClick:a,ForegroundComponent:l,BackgroundComponent:u})=>new Promise(((d,m)=>{try{c.open({type:"alert",subtype:e,resolve:()=>d(),title:n,subtitle:o,content:t,background:r,footer:i,manualDestroy:s,closeOnBackdropClick:a,ForegroundComponent:l,BackgroundComponent:u})}catch(e){m(e)}})),exports.confirm=({subtype:e,title:n,subtitle:o,content:t,background:r,footer:i,manualDestroy:s,closeOnBackdropClick:a,ForegroundComponent:l,BackgroundComponent:u})=>new Promise(((d,m)=>{try{c.open({type:"confirm",subtype:e,resolve:e=>d(e??!1),title:n,subtitle:o,content:t,background:r,footer:i,manualDestroy:s,closeOnBackdropClick:a,ForegroundComponent:l,BackgroundComponent:u})}catch(e){m(e)}})),exports.prompt=({defaultValue:e,title:n,subtitle:o,content:t,Input:r,disabled:i,returnOnCancel:s,background:a,footer:l,manualDestroy:u,closeOnBackdropClick:d,ForegroundComponent:m,BackgroundComponent:p})=>new Promise(((f,b)=>{try{c.open({type:"prompt",resolve:e=>f(e),title:n,subtitle:o,content:t,Input:({defaultValue:e,onChange:n,onConfirm:o,onCancel:t})=>r({defaultValue:e,onChange:n,onConfirm:o,onCancel:t}),defaultValue:e,disabled:i,returnOnCancel:s,background:a,footer:l,manualDestroy:u,closeOnBackdropClick:d,ForegroundComponent:m,BackgroundComponent:p})}catch(e){b(e)}})),exports.useDestroyAfter=(e,o)=>{const{modal:t,onDestroy:i}=U(e),s=w(t),a=n.useRef({modal:t,onDestroy:i,milliseconds:r.isString(o)?$(o):o});n.useEffect((()=>{const{modal:e,onDestroy:n,milliseconds:o}=a.current;if(!e||e.visible||!e.alive)return;const t=setTimeout((()=>{n()}),o);return()=>{t&&clearTimeout(t)}}),[s])},exports.useModalBackdrop=()=>{const{backdrop:e}=le();return e},exports.useModalDuration=()=>{const{duration:e}=le();return{duration:e,milliseconds:$(e)}},exports.useModalOptions=le,exports.useSubscribeModal=w;
|
|
17
|
+
function S(e,n,t,o){if("a"===t&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof n?e!==n||!o:!n.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?o:"a"===t?o.call(e):o?o.value:n.get(e)}function I(e,n,t,o,r){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof n?e!==n||!r:!n.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?r.call(e,t):r?r.value=t:n.set(e,t),t}var T,V,_,L,R;"function"==typeof SuppressedError&&SuppressedError;class q{get alive(){return S(this,T,"f")}get visible(){return S(this,V,"f")}constructor({id:e,initiator:n,title:t,subtitle:o,background:r,manualDestroy:i=!1,closeOnBackdropClick:s=!0,resolve:a,ForegroundComponent:l,BackgroundComponent:c}){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"initiator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"subtitle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"background",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualDestroy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"closeOnBackdropClick",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ForegroundComponent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"BackgroundComponent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),T.set(this,void 0),V.set(this,void 0),_.set(this,void 0),L.set(this,[]),this.id=e,this.initiator=n,this.title=t,this.subtitle=o,this.background=r,this.manualDestroy=i,this.closeOnBackdropClick=s,this.ForegroundComponent=l,this.BackgroundComponent=c,I(this,T,!0,"f"),I(this,V,!0,"f"),I(this,_,a,"f")}subscribe(e){return S(this,L,"f").push(e),()=>{I(this,L,S(this,L,"f").filter((n=>n!==e)),"f")}}publish(){for(const e of S(this,L,"f"))e()}resolve(e){S(this,_,"f").call(this,e)}onDestroy(){const e=!0===S(this,T,"f");I(this,T,!1,"f"),this.manualDestroy&&e&&this.publish()}onShow(){const e=!1===S(this,V,"f");I(this,V,!0,"f"),e&&this.publish()}onHide(){const e=!0===S(this,V,"f");I(this,V,!1,"f"),e&&this.publish()}}T=new WeakMap,V=new WeakMap,_=new WeakMap,L=new WeakMap;class H extends q{constructor({id:e,initiator:n,type:t,subtype:o,title:r,subtitle:i,content:s,footer:a,background:l,manualDestroy:c,closeOnBackdropClick:u,resolve:d,ForegroundComponent:m,BackgroundComponent:p}){super({id:e,initiator:n,title:r,subtitle:i,background:l,manualDestroy:c,closeOnBackdropClick:u,resolve:d,ForegroundComponent:m,BackgroundComponent:p}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"subtype",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.type=t,this.subtype=o,this.content=s,this.footer=a}onClose(){this.resolve(null)}onConfirm(){this.resolve(null)}}class z extends q{constructor({id:e,initiator:n,type:t,subtype:o,title:r,subtitle:i,content:s,footer:a,background:l,manualDestroy:c,closeOnBackdropClick:u,resolve:d,ForegroundComponent:m,BackgroundComponent:p}){super({id:e,initiator:n,title:r,subtitle:i,background:l,manualDestroy:c,closeOnBackdropClick:u,resolve:d,ForegroundComponent:m,BackgroundComponent:p}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"subtype",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.type=t,this.subtype=o,this.content=s,this.footer=a}onClose(){this.resolve(!1)}onConfirm(){this.resolve(!0)}}class $ extends q{constructor({id:e,initiator:n,type:t,title:o,subtitle:r,content:i,defaultValue:s,Input:a,disabled:l,returnOnCancel:c,footer:u,background:d,manualDestroy:m,closeOnBackdropClick:p,resolve:f,ForegroundComponent:b,BackgroundComponent:h}){super({id:e,initiator:n,title:o,subtitle:r,background:d,manualDestroy:m,closeOnBackdropClick:p,resolve:f,ForegroundComponent:b,BackgroundComponent:h}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"Input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnOnCancel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),R.set(this,void 0),this.type=t,this.content=i,this.Input=a,this.defaultValue=s,I(this,R,s,"f"),this.disabled=l,this.returnOnCancel=c,this.footer=u}onChange(e){I(this,R,e,"f")}onConfirm(){this.resolve(S(this,R,"f")??null)}onClose(){this.returnOnCancel?this.resolve(S(this,R,"f")??null):this.resolve(null)}}R=new WeakMap;const Y=e=>{switch(e.type){case"alert":return new H(e);case"confirm":return new z(e);case"prompt":return new $(e)}throw new Error(`Unknown modal: ${e.type}`,{modal:e})},A=/^\s*(\d+)\s*(ms|s|m|h)\s*$/,W=e=>{const[,n,t]=e.match(A)||[];if(!n||!t)return 0;const o=parseInt(n);return"ms"===t?o:"s"===t?1e3*o:"m"===t?60*o*1e3:"h"===t?60*o*60*1e3:0},U=n.createContext({modalIds:[],getModalNode:r.undefinedFunction,onChange:r.undefinedFunction,onConfirm:r.undefinedFunction,onClose:r.undefinedFunction,onDestroy:r.undefinedFunction,setUpdater:r.undefinedFunction,getModal:()=>({modal:void 0,onConfirm:r.undefinedFunction,onClose:r.undefinedFunction,onChange:r.undefinedFunction,onDestroy:r.undefinedFunction})}),J=n.memo((({pathname:t,children:r})=>{const i=n.useRef(new Map),[s,a]=n.useState([]),l=o.useReference(s),u=n.useRef(t),d=n.useRef(0),m=de(),p=n.useMemo((()=>W(m.duration)),[m]);o.useOnMountLayout((()=>{const{manualDestroy:e,closeOnBackdropClick:n}=m;for(const t of c.prerender){const o=Y({...t,id:d.current++,initiator:u.current,manualDestroy:void 0!==t.manualDestroy?t.manualDestroy:e,closeOnBackdropClick:void 0!==t.closeOnBackdropClick?t.closeOnBackdropClick:n});i.current.set(o.id,o),a((e=>[...e,o.id]))}c.setupOpen((t=>{const o=Y({...t,id:d.current++,initiator:u.current,manualDestroy:void 0!==t.manualDestroy?t.manualDestroy:e,closeOnBackdropClick:void 0!==t.closeOnBackdropClick?t.closeOnBackdropClick:n});i.current.set(o.id,o),a((e=>[...e.filter((e=>{const n=!i.current.get(e)?.alive;return n&&i.current.delete(e),!n})),o.id]))})),c.clearPrerender()})),n.useLayoutEffect((()=>{for(const e of l.current){const n=i.current.get(e);n?.alive&&(n.initiator===t?n.onShow():n.onHide())}u.current=t}),[l,t]);const f=n.useCallback((e=>i.current.get(e)),[]),b=n.useCallback((e=>{const n=i.current.get(e);n&&(n.onDestroy(),h.current?.())}),[]),h=n.useRef(),C=n.useCallback((e=>{const n=i.current.get(e);n&&(n.onHide(),h.current?.(),n.manualDestroy||setTimeout((()=>{n.onDestroy()}),p))}),[p]),g=n.useCallback(((e,n)=>{const t=i.current.get(e);t&&"prompt"===t.type&&t.onChange(n)}),[]),y=n.useCallback((e=>{const n=i.current.get(e);n&&(n.onConfirm(),C(e))}),[C]),v=n.useCallback((e=>{const n=i.current.get(e);n&&(n.onClose(),C(e))}),[C]),k=n.useCallback((e=>({modal:f(e),onConfirm:()=>y(e),onClose:()=>v(e),onChange:n=>g(e,n),onDestroy:()=>b(e)})),[f,y,v,g,b]),x=n.useMemo((()=>({modalIds:s,getModalNode:f,onChange:g,onConfirm:y,onClose:v,onDestroy:b,getModal:k,setUpdater:e=>{h.current=e}})),[s,k,f,g,y,v,b]);return e.jsx(U.Provider,{value:x,children:r})})),G=()=>n.useContext(U),K=e=>{const{getModal:t}=G();return n.useMemo((()=>t(e)),[e,t])},Q=i.css("production"===process.env.NODE_ENV?{name:"2hpasy",styles:"display:flex;align-items:center;justify-content:center;position:fixed;inset:0;pointer-events:none;z-index:1000;transition:background-color ease-in-out"}:{name:"lhj8co-anchor",styles:"display:flex;align-items:center;justify-content:center;position:fixed;inset:0;pointer-events:none;z-index:1000;transition:background-color ease-in-out;label:anchor;",toString:function(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}}),X=n.memo(o.withErrorBoundary((()=>{const[t,r]=o.useTick(),{modalIds:i,setUpdater:s}=G();n.useEffect((()=>{s(r)}),[s,r]);const{options:a}=ue(),l=N(t);return e.jsx("div",{className:Q,style:{transitionDuration:a.duration,backgroundColor:l?a.backdrop:"transparent"},children:i.map((n=>e.jsx(M,{modalId:n},n)))})})));function Z(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}const ee=i.css("production"===process.env.NODE_ENV?{name:"131j9g2",styles:"margin:unset"}:{name:"1w3kbco-fallback",styles:"margin:unset;label:fallback;",toString:Z}),ne=i.css("production"===process.env.NODE_ENV?{name:"1kuk3a3",styles:"display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:white;padding:20px 80px;gap:10px;border:1px solid black"}:{name:"16dbbea-frame",styles:"display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:white;padding:20px 80px;gap:10px;border:1px solid black;label:frame;",toString:Z}),te=({children:n})=>e.jsx("h2",{className:ee,children:n}),oe=({children:n})=>e.jsx("h3",{className:ee,children:n}),re=({children:n})=>e.jsx("div",{className:ee,children:n}),ie=({confirmLabel:n,hideConfirm:t=!1,cancelLabel:o,hideCancel:r=!1,disabled:i,onConfirm:s,onCancel:a})=>e.jsxs("div",{children:[!t&&e.jsx("button",{onClick:s,disabled:i,children:n||"확인"}),!r&&"function"==typeof a&&e.jsx("button",{onClick:a,children:o||"취소"})]}),se=n.forwardRef((({id:t,onChangeOrder:o,children:r},i)=>{const s=N(),[a,l]=n.useMemo((()=>{const e=s>1;return[e?Math.floor(t/5)%3*100:0,e?t%5*35:0]}),[s,t]);return e.jsx("div",{ref:i,className:ne,onClick:o,style:{marginBottom:`calc(25vh + ${a}px)`,marginLeft:`${a}px`,transform:`translate(${l}px, ${l}px)`},children:r})})),ae=()=>{const[e,t]=n.useState(window.location.pathname);return n.useLayoutEffect((()=>{let n;const o=()=>{n&&cancelAnimationFrame(n),e!==window.location.pathname?t(window.location.pathname):n=requestAnimationFrame(o)};return n=requestAnimationFrame(o),()=>{n&&cancelAnimationFrame(n)}}),[e]),{pathname:e}},le=n.createContext({ForegroundComponent:se,TitleComponent:te,SubtitleComponent:oe,ContentComponent:re,FooterComponent:ie,options:{duration:u,backdrop:d,manualDestroy:!1,closeOnBackdropClick:!0}}),ce=n.memo((({ForegroundComponent:r,BackgroundComponent:i,TitleComponent:s,SubtitleComponent:a,ContentComponent:l,FooterComponent:m,options:f,context:b,usePathname:h,children:C})=>{const{pathname:g}=(h||ae)(),[,y]=o.useTick(),v=n.useRef(null);o.useOnMount((()=>(v.current=c.anchor("div"),y(),()=>{v.current&&v.current.remove()})));const k=n.useMemo((()=>({BackgroundComponent:i,ForegroundComponent:r||se,TitleComponent:s||te,SubtitleComponent:a||oe,ContentComponent:n.memo(l||re),FooterComponent:n.memo(m||ie),options:{duration:u,backdrop:d,closeOnBackdropClick:!0,manualDestroy:!1,...f}})),[r,i,l,m,a,s,f]);return e.jsxs(le.Provider,{value:k,children:[C,v.current&&t.createPortal(e.jsx(p,{context:b,children:e.jsx(J,{pathname:g,children:e.jsx(X,{})})}),v.current)]})})),ue=()=>n.useContext(le),de=()=>{const{options:e}=n.useContext(le);return e};exports.ModalProvider=ce,exports.alert=({subtype:e,title:n,subtitle:t,content:o,background:r,footer:i,manualDestroy:s,closeOnBackdropClick:a,ForegroundComponent:l,BackgroundComponent:u})=>new Promise(((d,m)=>{try{c.open({type:"alert",subtype:e,resolve:()=>d(),title:n,subtitle:t,content:o,background:r,footer:i,manualDestroy:s,closeOnBackdropClick:a,ForegroundComponent:l,BackgroundComponent:u})}catch(e){m(e)}})),exports.confirm=({subtype:e,title:n,subtitle:t,content:o,background:r,footer:i,manualDestroy:s,closeOnBackdropClick:a,ForegroundComponent:l,BackgroundComponent:u})=>new Promise(((d,m)=>{try{c.open({type:"confirm",subtype:e,resolve:e=>d(e??!1),title:n,subtitle:t,content:o,background:r,footer:i,manualDestroy:s,closeOnBackdropClick:a,ForegroundComponent:l,BackgroundComponent:u})}catch(e){m(e)}})),exports.prompt=({defaultValue:e,title:n,subtitle:t,content:o,Input:r,disabled:i,returnOnCancel:s,background:a,footer:l,manualDestroy:u,closeOnBackdropClick:d,ForegroundComponent:m,BackgroundComponent:p})=>new Promise(((f,b)=>{try{c.open({type:"prompt",resolve:e=>f(e),title:n,subtitle:t,content:o,Input:r,defaultValue:e,disabled:i,returnOnCancel:s,background:a,footer:l,manualDestroy:u,closeOnBackdropClick:d,ForegroundComponent:m,BackgroundComponent:p})}catch(e){b(e)}})),exports.useDestroyAfter=(e,t)=>{const{modal:o,onDestroy:i}=K(e),s=F(o),a=n.useRef({modal:o,onDestroy:i,milliseconds:r.isString(t)?W(t):t});n.useEffect((()=>{const{modal:e,onDestroy:n,milliseconds:t}=a.current;if(!e||e.visible||!e.alive)return;const o=setTimeout((()=>{n()}),t);return()=>{o&&clearTimeout(o)}}),[s])},exports.useModalBackdrop=()=>{const{backdrop:e}=de();return e},exports.useModalDuration=()=>{const{duration:e}=de();return{duration:e,milliseconds:W(e)}},exports.useModalOptions=de,exports.useSubscribeModal=F;
|
|
18
18
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/app/ModalManager.ts","../src/app/constant.ts","../src/components/Background/classNames.emotion.ts","../src/components/Background/Background.tsx","../src/components/Foreground/classNames.emotion.ts","../src/components/Foreground/components/AlertInner.tsx","../src/components/Foreground/components/ConfirmInner.tsx","../src/components/Foreground/components/PromptInner.tsx","../src/components/Foreground/Foreground.tsx","../src/hooks/useSubscribeModal.ts","../src/components/Presenter/classNames.emotion.ts","../src/components/Presenter/Presenter.tsx","../src/hooks/useActiveModalCount.ts","../src/core/node/ModalNode/AbstractBaseNode.ts","../src/core/node/ModalNode/AlertNode.ts","../src/core/node/ModalNode/ConfirmNode.ts","../src/core/node/ModalNode/PromptNode.ts","../src/core/node/nodeFactory.ts","../src/helpers/getMillisecondsFromDuration.ts","../src/providers/ModalDataContext/ModalDataContext.ts","../src/providers/ModalDataContext/ModalDataContextProvider.tsx","../src/providers/ModalDataContext/useModalDataContext.ts","../src/components/Anchor/classNames.emotion.ts","../src/components/Anchor/Anchor.tsx","../src/components/FallbackComponents/classNames.emotion.ts","../src/components/FallbackComponents/FallbackTitle.tsx","../src/components/FallbackComponents/FallbackSubtitle.tsx","../src/components/FallbackComponents/FallbackContent.tsx","../src/components/FallbackComponents/FallbackFooter.tsx","../src/components/FallbackComponents/FallbackForegroundFrame.tsx","../src/hooks/useDefaultPathname.ts","../src/providers/ModalContext/ModalContext.ts","../src/providers/ModalContext/ModalContextProvider.tsx","../src/providers/ModalContext/useModalContext.ts","../src/core/handle/alert.ts","../src/core/handle/confirm.ts","../src/core/handle/prompt.ts","../src/hooks/useDestroyAfter.ts"],"sourcesContent":["import { MutableRefObject } from 'react';\n\nimport { getRandomString } from '@winglet/common-utils';\n\nimport type { Fn } from '@aileron/types';\n\nimport type { Modal } from '@/promise-modal/types';\n\nconst prerenderListRef: MutableRefObject<Modal[]> = {\n current: [],\n};\n\nconst openModalRef: MutableRefObject<Fn<[Modal], void>> = {\n current: (modal: Modal) => {\n prerenderListRef.current.push(modal);\n },\n};\n\nconst anchorRef: MutableRefObject<HTMLElement | null> = {\n current: null,\n};\n\nexport const ModalManager = {\n get prerender() {\n return prerenderListRef.current;\n },\n clearPrerender() {\n prerenderListRef.current = [];\n },\n open(modal: Modal) {\n openModalRef.current(modal);\n },\n setupOpen(open: (modal: Modal) => void) {\n openModalRef.current = open;\n },\n anchor(name: string, prefix = 'promise-modal'): HTMLElement {\n if (anchorRef.current) {\n const anchor = document.getElementById(anchorRef.current.id);\n if (anchor) return anchor;\n }\n const node = document.createElement(name);\n node.setAttribute('id', `${prefix}-${getRandomString(36)}`);\n document.body.appendChild(node);\n anchorRef.current = node;\n return node;\n },\n};\n","import type { Color, Duration } from '@aileron/types';\n\nexport const DEFAULT_ANIMATION_DURATION: Duration = '300ms';\n\nexport const DEFAULT_BACKDROP_COLOR: Color = 'rgba(0, 0, 0, 0.5)';\n","import { css } from '@emotion/css';\n\nexport const background = css`\n display: none;\n position: fixed;\n inset: 0;\n z-index: -999;\n pointer-events: none;\n > * {\n pointer-events: none;\n }\n`;\n\nexport const active = css`\n pointer-events: all;\n`;\n\nexport const visible = css`\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n","import { type MouseEvent, useCallback, useMemo } from 'react';\n\nimport { cx } from '@emotion/css';\n\nimport { useModal, useModalContext } from '@/promise-modal/providers';\nimport type { ModalLayerProps } from '@/promise-modal/types';\n\nimport { active, background, visible } from './classNames.emotion';\n\nexport const Background = ({ modalId, onChangeOrder }: ModalLayerProps) => {\n const { BackgroundComponent } = useModalContext();\n const { modal, onClose, onChange, onConfirm, onDestroy } = useModal(modalId);\n\n const handleClose = useCallback(\n (event: MouseEvent) => {\n if (modal && modal.closeOnBackdropClick && modal.visible) onClose();\n event.stopPropagation();\n },\n [modal, onClose],\n );\n\n const Background = useMemo(\n () => modal?.BackgroundComponent || BackgroundComponent,\n [BackgroundComponent, modal],\n );\n\n if (!modal) return null;\n\n return (\n <div\n className={cx(background, {\n [visible]: modal.manualDestroy ? modal.alive : modal.visible,\n [active]: modal.closeOnBackdropClick && modal.visible,\n })}\n onClick={handleClose}\n >\n {Background && (\n <Background\n id={modal.id}\n type={modal.type}\n alive={modal.alive}\n visible={modal.visible}\n initiator={modal.initiator}\n manualDestroy={modal.manualDestroy}\n closeOnBackdropClick={modal.closeOnBackdropClick}\n background={modal.background}\n onChange={onChange}\n onConfirm={onConfirm}\n onClose={onClose}\n onDestroy={onDestroy}\n onChangeOrder={onChangeOrder}\n />\n )}\n </div>\n );\n};\n","import { css } from '@emotion/css';\n\nexport const foreground = css`\n pointer-events: none;\n display: none;\n position: fixed;\n inset: 0;\n z-index: 1;\n`;\n\nexport const active = css`\n > * {\n pointer-events: all;\n }\n`;\n\nexport const visible = css`\n display: flex !important;\n justify-content: center;\n align-items: center;\n`;\n","import { Fragment, memo, useMemo } from 'react';\n\nimport { isString } from '@winglet/common-utils';\nimport { renderComponent, useHandle } from '@winglet/react-utils';\n\nimport type { AlertNode } from '@/promise-modal/core';\nimport { useModalContext } from '@/promise-modal/providers';\nimport type { ModalActions } from '@/promise-modal/types';\n\ninterface AlertInnerProps<B> {\n modal: AlertNode<B>;\n handlers: Pick<ModalActions, 'onConfirm'>;\n}\n\nexport const AlertInner = memo(\n <B,>({ modal, handlers }: AlertInnerProps<B>) => {\n const { title, subtitle, content, footer } = useMemo(() => modal, [modal]);\n const { onConfirm } = useMemo(() => handlers, [handlers]);\n\n const handleConfirm = useHandle(onConfirm);\n\n const {\n TitleComponent,\n SubtitleComponent,\n ContentComponent,\n FooterComponent,\n } = useModalContext();\n\n return (\n <Fragment>\n {title &&\n (isString(title) ? <TitleComponent>{title}</TitleComponent> : title)}\n {subtitle &&\n (isString(subtitle) ? (\n <SubtitleComponent>{subtitle}</SubtitleComponent>\n ) : (\n subtitle\n ))}\n {content &&\n (isString(content) ? (\n <ContentComponent>{content}</ContentComponent>\n ) : (\n renderComponent(content, {\n onConfirm: handleConfirm,\n })\n ))}\n {footer !== false &&\n (typeof footer === 'function' ? (\n footer({ onConfirm: handleConfirm })\n ) : (\n <FooterComponent\n onConfirm={handleConfirm}\n confirmLabel={footer?.confirm}\n hideConfirm={footer?.hideConfirm}\n />\n ))}\n </Fragment>\n );\n },\n);\n","import { Fragment, memo, useMemo } from 'react';\n\nimport { isString } from '@winglet/common-utils';\nimport { renderComponent, useHandle } from '@winglet/react-utils';\n\nimport type { ConfirmNode } from '@/promise-modal/core';\nimport { useModalContext } from '@/promise-modal/providers';\nimport type { ModalActions } from '@/promise-modal/types';\n\ninterface ConfirmInnerProps<B> {\n modal: ConfirmNode<B>;\n handlers: Pick<ModalActions, 'onConfirm' | 'onClose'>;\n}\n\nexport const ConfirmInner = memo(\n <B,>({ modal, handlers }: ConfirmInnerProps<B>) => {\n const { title, subtitle, content, footer } = useMemo(() => modal, [modal]);\n const { onConfirm, onClose } = useMemo(() => handlers, [handlers]);\n\n const handleConfirm = useHandle(onConfirm);\n const handleClose = useHandle(onClose);\n\n const {\n TitleComponent,\n SubtitleComponent,\n ContentComponent,\n FooterComponent,\n } = useModalContext();\n\n return (\n <Fragment>\n {title &&\n (isString(title) ? <TitleComponent>{title}</TitleComponent> : title)}\n {subtitle &&\n (isString(subtitle) ? (\n <SubtitleComponent>{subtitle}</SubtitleComponent>\n ) : (\n subtitle\n ))}\n {content &&\n (isString(content) ? (\n <ContentComponent>{content}</ContentComponent>\n ) : (\n renderComponent(content, {\n onConfirm: handleConfirm,\n onCancel: handleClose,\n })\n ))}\n {footer !== false &&\n (typeof footer === 'function' ? (\n footer({\n onConfirm: handleConfirm,\n onCancel: handleClose,\n })\n ) : (\n <FooterComponent\n onConfirm={handleConfirm}\n onCancel={handleClose}\n confirmLabel={footer?.confirm}\n cancelLabel={footer?.cancel}\n hideConfirm={footer?.hideConfirm}\n hideCancel={footer?.hideCancel}\n />\n ))}\n </Fragment>\n );\n },\n);\n","import { Fragment, memo, useCallback, useMemo, useState } from 'react';\n\nimport { isFunction, isString } from '@winglet/common-utils';\nimport {\n renderComponent,\n useHandle,\n withErrorBoundary,\n} from '@winglet/react-utils';\n\nimport type { PromptNode } from '@/promise-modal/core';\nimport { useModalContext } from '@/promise-modal/providers';\nimport type { ModalActions } from '@/promise-modal/types';\n\ninterface PromptInnerProps<T, B> {\n modal: PromptNode<T, B>;\n handlers: Pick<ModalActions, 'onChange' | 'onClose' | 'onConfirm'>;\n}\n\nexport const PromptInner = memo(\n <T, B>({ modal, handlers }: PromptInnerProps<T, B>) => {\n const {\n Input,\n defaultValue,\n disabled: checkDisabled,\n title,\n subtitle,\n content,\n footer,\n } = useMemo(\n () => ({\n ...modal,\n Input: memo(withErrorBoundary(modal.Input)),\n }),\n [modal],\n );\n\n const [value, setValue] = useState<T | undefined>(defaultValue);\n\n const { onChange, onClose, onConfirm } = useMemo(\n () => handlers,\n [handlers],\n );\n\n const handleClose = useHandle(onClose);\n const handleChange = useHandle(\n (inputValue?: T | ((prevState: T | undefined) => T | undefined)) => {\n const input = isFunction(inputValue) ? inputValue(value) : inputValue;\n setValue(input);\n onChange(input);\n },\n );\n\n const handleConfirm = useCallback(() => {\n // NOTE: wait for the next tick to ensure the value is updated\n setTimeout(() => {\n onConfirm();\n });\n }, [onConfirm]);\n\n const disabled = useMemo(\n () => (value ? !!checkDisabled?.(value) : false),\n [checkDisabled, value],\n );\n\n const {\n TitleComponent,\n SubtitleComponent,\n ContentComponent,\n FooterComponent,\n } = useModalContext();\n\n return (\n <Fragment>\n {title &&\n (isString(title) ? <TitleComponent>{title}</TitleComponent> : title)}\n {subtitle &&\n (isString(subtitle) ? (\n <SubtitleComponent>{subtitle}</SubtitleComponent>\n ) : (\n subtitle\n ))}\n {content &&\n (isString(content) ? (\n <ContentComponent>{content}</ContentComponent>\n ) : (\n renderComponent(content, {\n onConfirm: handleConfirm,\n onCancel: handleClose,\n })\n ))}\n\n {Input && (\n <Input\n defaultValue={defaultValue}\n value={value}\n onChange={handleChange}\n onConfirm={handleConfirm}\n onCancel={handleClose}\n />\n )}\n\n {footer !== false &&\n (typeof footer === 'function' ? (\n footer({\n onChange: handleChange,\n onConfirm: handleConfirm,\n onCancel: handleClose,\n value,\n disabled,\n })\n ) : (\n <FooterComponent\n onConfirm={handleConfirm}\n onCancel={handleClose}\n disabled={disabled}\n confirmLabel={footer?.confirm}\n cancelLabel={footer?.cancel}\n hideConfirm={footer?.hideConfirm}\n hideCancel={footer?.hideCancel}\n />\n ))}\n </Fragment>\n );\n },\n);\n","import { useMemo } from 'react';\n\nimport { cx } from '@emotion/css';\n\nimport { useModal, useModalContext } from '@/promise-modal/providers';\nimport type { ModalLayerProps } from '@/promise-modal/types';\n\nimport { active, foreground, visible } from './classNames.emotion';\nimport { AlertInner, ConfirmInner, PromptInner } from './components';\n\nexport const Foreground = ({ modalId, onChangeOrder }: ModalLayerProps) => {\n const { ForegroundComponent } = useModalContext();\n\n const { modal, onChange, onConfirm, onClose, onDestroy } = useModal(modalId);\n\n const Foreground = useMemo(\n () => modal?.ForegroundComponent || ForegroundComponent,\n [ForegroundComponent, modal],\n );\n\n if (!modal) return null;\n\n return (\n <div\n className={cx(foreground, {\n [visible]: modal.manualDestroy ? modal.alive : modal.visible,\n [active]: modal.visible,\n })}\n >\n <Foreground\n id={modal.id}\n type={modal.type}\n alive={modal.alive}\n visible={modal.visible}\n initiator={modal.initiator}\n manualDestroy={modal.manualDestroy}\n closeOnBackdropClick={modal.closeOnBackdropClick}\n background={modal.background}\n onChange={onChange}\n onConfirm={onConfirm}\n onClose={onClose}\n onDestroy={onDestroy}\n onChangeOrder={onChangeOrder}\n >\n {modal.type === 'alert' && (\n <AlertInner modal={modal} handlers={{ onConfirm }} />\n )}\n {modal.type === 'confirm' && (\n <ConfirmInner modal={modal} handlers={{ onConfirm, onClose }} />\n )}\n {modal.type === 'prompt' && (\n <PromptInner\n modal={modal}\n handlers={{ onChange, onConfirm, onClose }}\n />\n )}\n </Foreground>\n </div>\n );\n};\n","import { useOnMount, useTick } from '@winglet/react-utils';\n\nimport type { ModalNode } from '@/promise-modal/core';\n\nexport const useSubscribeModal = (modal?: ModalNode) => {\n const [tick, update] = useTick();\n useOnMount(() => {\n if (!modal) return;\n const unsubscribe = modal.subscribe(update);\n return unsubscribe;\n });\n return tick;\n};\n","import { css } from '@emotion/css';\n\nexport const presenter = css`\n position: fixed;\n inset: 0;\n pointer-events: none;\n overflow: hidden;\n`;\n","import { memo, useRef } from 'react';\n\nimport { useHandle } from '@winglet/react-utils';\n\nimport { Background } from '@/promise-modal/components/Background';\nimport { Foreground } from '@/promise-modal/components/Foreground';\nimport { useSubscribeModal } from '@/promise-modal/hooks/useSubscribeModal';\nimport { useModal } from '@/promise-modal/providers';\nimport type { ModalIdProps } from '@/promise-modal/types';\n\nimport { presenter } from './classNames.emotion';\n\nlet zIndex = 1;\n\nexport const Presenter = memo(({ modalId }: ModalIdProps) => {\n const ref = useRef<HTMLDivElement>(null);\n const { modal } = useModal(modalId);\n useSubscribeModal(modal);\n const handleChangeOrder = useHandle(() => {\n if (ref.current) {\n ref.current.style.zIndex = `${zIndex++}`;\n }\n });\n return (\n <div ref={ref} className={presenter}>\n <Background modalId={modalId} onChangeOrder={handleChangeOrder} />\n <Foreground modalId={modalId} onChangeOrder={handleChangeOrder} />\n </div>\n );\n});\n","import { useMemo } from 'react';\n\nimport { useModalDataContext } from '../providers';\n\nexport const useActiveModalCount = (tick: string | number = 0) => {\n const { modalIds, getModalNode } = useModalDataContext();\n return useMemo(() => {\n let count = 0;\n for (const id of modalIds) {\n if (getModalNode(id)?.visible) count++;\n }\n return count;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [getModalNode, modalIds, tick]);\n};\n","import type { ReactNode } from 'react';\n\nimport type { Fn } from '@aileron/types';\n\nimport type {\n BackgroundComponent,\n BaseModal,\n ForegroundComponent,\n ManagedEntity,\n ModalBackground,\n} from '@/promise-modal/types';\n\ntype BaseNodeProps<T, B> = BaseModal<T, B> & ManagedEntity;\n\nexport abstract class BaseNode<T, B> {\n readonly id: number;\n readonly initiator: string;\n\n readonly title?: ReactNode;\n readonly subtitle?: ReactNode;\n readonly background?: ModalBackground<B>;\n\n readonly manualDestroy: boolean;\n readonly closeOnBackdropClick: boolean;\n\n readonly ForegroundComponent?: ForegroundComponent;\n readonly BackgroundComponent?: BackgroundComponent;\n\n #alive: boolean;\n get alive() {\n return this.#alive;\n }\n #visible: boolean;\n get visible() {\n return this.#visible;\n }\n\n #resolve: (result: T | null) => void;\n #listeners: Fn[] = [];\n\n constructor({\n id,\n initiator,\n title,\n subtitle,\n background,\n manualDestroy = false,\n closeOnBackdropClick = true,\n resolve,\n ForegroundComponent,\n BackgroundComponent,\n }: BaseNodeProps<T, B>) {\n this.id = id;\n this.initiator = initiator;\n this.title = title;\n this.subtitle = subtitle;\n this.background = background;\n this.manualDestroy = manualDestroy;\n this.closeOnBackdropClick = closeOnBackdropClick;\n\n this.ForegroundComponent = ForegroundComponent;\n this.BackgroundComponent = BackgroundComponent;\n\n this.#alive = true;\n this.#visible = true;\n this.#resolve = resolve;\n }\n\n subscribe(listener: Fn) {\n this.#listeners.push(listener);\n return () => {\n this.#listeners = this.#listeners.filter((l) => l !== listener);\n };\n }\n publish() {\n for (const listener of this.#listeners) listener();\n }\n protected resolve(result: T | null) {\n this.#resolve(result);\n }\n onDestroy() {\n const needPublish = this.#alive === true;\n this.#alive = false;\n if (this.manualDestroy && needPublish) this.publish();\n }\n onShow() {\n const needPublish = this.#visible === false;\n this.#visible = true;\n if (needPublish) this.publish();\n }\n onHide() {\n const needPublish = this.#visible === true;\n this.#visible = false;\n if (needPublish) this.publish();\n }\n abstract onClose(): void;\n abstract onConfirm(): void;\n}\n","import type { ComponentType, ReactNode } from 'react';\n\nimport type {\n AlertContentProps,\n AlertFooterRender,\n AlertModal,\n FooterOptions,\n ManagedEntity,\n} from '@/promise-modal/types';\n\nimport { BaseNode } from './AbstractBaseNode';\n\ntype AlertNodeProps<B> = AlertModal<B> & ManagedEntity;\n\nexport class AlertNode<B> extends BaseNode<null, B> {\n readonly type: 'alert';\n readonly subtype?: 'info' | 'success' | 'warning' | 'error';\n readonly content?: ReactNode | ComponentType<AlertContentProps>;\n readonly footer?:\n | AlertFooterRender\n | Pick<FooterOptions, 'confirm' | 'hideConfirm'>\n | false;\n\n constructor({\n id,\n initiator,\n type,\n subtype,\n title,\n subtitle,\n content,\n footer,\n background,\n manualDestroy,\n closeOnBackdropClick,\n resolve,\n ForegroundComponent,\n BackgroundComponent,\n }: AlertNodeProps<B>) {\n super({\n id,\n initiator,\n title,\n subtitle,\n background,\n manualDestroy,\n closeOnBackdropClick,\n resolve,\n ForegroundComponent,\n BackgroundComponent,\n });\n this.type = type;\n this.subtype = subtype;\n this.content = content;\n this.footer = footer;\n }\n onClose() {\n this.resolve(null);\n }\n onConfirm() {\n this.resolve(null);\n }\n}\n","import type { ComponentType, ReactNode } from 'react';\n\nimport type {\n ConfirmContentProps,\n ConfirmFooterRender,\n ConfirmModal,\n FooterOptions,\n ManagedEntity,\n} from '@/promise-modal/types';\n\nimport { BaseNode } from './AbstractBaseNode';\n\ntype ConfirmNodeProps<B> = ConfirmModal<B> & ManagedEntity;\n\nexport class ConfirmNode<B> extends BaseNode<boolean, B> {\n readonly type: 'confirm';\n readonly subtype?: 'info' | 'success' | 'warning' | 'error';\n readonly content?: ReactNode | ComponentType<ConfirmContentProps>;\n readonly footer?: ConfirmFooterRender | FooterOptions | false;\n\n constructor({\n id,\n initiator,\n type,\n subtype,\n title,\n subtitle,\n content,\n footer,\n background,\n manualDestroy,\n closeOnBackdropClick,\n resolve,\n ForegroundComponent,\n BackgroundComponent,\n }: ConfirmNodeProps<B>) {\n super({\n id,\n initiator,\n title,\n subtitle,\n background,\n manualDestroy,\n closeOnBackdropClick,\n resolve,\n ForegroundComponent,\n BackgroundComponent,\n });\n this.type = type;\n this.subtype = subtype;\n this.content = content;\n this.footer = footer;\n }\n onClose() {\n this.resolve(false);\n }\n onConfirm() {\n this.resolve(true);\n }\n}\n","import type { ComponentType, ReactNode } from 'react';\n\nimport type {\n FooterOptions,\n ManagedEntity,\n PromptContentProps,\n PromptFooterRender,\n PromptInputProps,\n PromptModal,\n} from '@/promise-modal/types';\n\nimport { BaseNode } from './AbstractBaseNode';\n\ntype PromptNodeProps<T, B> = PromptModal<T, B> & ManagedEntity;\n\nexport class PromptNode<T, B> extends BaseNode<T, B> {\n readonly type: 'prompt';\n readonly content?: ReactNode | ComponentType<PromptContentProps>;\n readonly defaultValue: T | undefined;\n readonly Input: (props: PromptInputProps<T>) => ReactNode;\n readonly disabled?: (value: T) => boolean;\n readonly returnOnCancel?: boolean;\n readonly footer?: PromptFooterRender<T> | FooterOptions | false;\n #value: T | undefined;\n\n constructor({\n id,\n initiator,\n type,\n title,\n subtitle,\n content,\n defaultValue,\n Input,\n disabled,\n returnOnCancel,\n footer,\n background,\n manualDestroy,\n closeOnBackdropClick,\n resolve,\n ForegroundComponent,\n BackgroundComponent,\n }: PromptNodeProps<T, B>) {\n super({\n id,\n initiator,\n title,\n subtitle,\n background,\n manualDestroy,\n closeOnBackdropClick,\n resolve,\n ForegroundComponent,\n BackgroundComponent,\n });\n this.type = type;\n this.content = content;\n this.Input = Input;\n this.defaultValue = defaultValue;\n this.#value = defaultValue;\n this.disabled = disabled;\n this.returnOnCancel = returnOnCancel;\n this.footer = footer;\n }\n\n onChange(value: T) {\n this.#value = value;\n }\n onConfirm() {\n this.resolve(this.#value ?? null);\n }\n onClose() {\n if (this.returnOnCancel) this.resolve(this.#value ?? null);\n else this.resolve(null);\n }\n}\n","import type { ManagedModal } from '@/promise-modal/types';\n\nimport { AlertNode, ConfirmNode, PromptNode } from './ModalNode';\n\nexport const nodeFactory = <T, B>(modal: ManagedModal<T, B>) => {\n switch (modal.type) {\n case 'alert':\n return new AlertNode<B>(modal);\n case 'confirm':\n return new ConfirmNode<B>(modal);\n case 'prompt':\n return new PromptNode<T, B>(modal);\n }\n // @ts-expect-error: This state is unreachable by design and should NEVER occur.\n throw new Error(`Unknown modal: ${modal.type}`, { modal });\n};\n","const DURATION_REGEX = /^\\s*(\\d+)\\s*(ms|s|m|h)\\s*$/;\n\nexport const getMillisecondsFromDuration = (input: string) => {\n const [, durationString, unit] = input.match(DURATION_REGEX) || [];\n if (!durationString || !unit) return 0;\n const duration = parseInt(durationString);\n if (unit === 'ms') return duration;\n if (unit === 's') return duration * 1000;\n if (unit === 'm') return duration * 60 * 1000;\n if (unit === 'h') return duration * 60 * 60 * 1000;\n else return 0;\n};\n","import { createContext } from 'react';\n\nimport { undefinedFunction } from '@winglet/common-utils';\n\nimport type { Fn } from '@aileron/types';\n\nimport type { ModalNode } from '@/promise-modal/core';\nimport type { ModalActions, ModalHandlersWithId } from '@/promise-modal/types';\n\nexport interface ModalDataContextProps extends ModalHandlersWithId {\n modalIds: ModalNode['id'][];\n getModal: Fn<[id: ModalNode['id']], ModalActions>;\n getModalNode: Fn<[id: ModalNode['id']], ModalNode | undefined>;\n setUpdater: Fn<[updater: Fn]>;\n}\n\nexport const ModalDataContext = createContext<ModalDataContextProps>({\n modalIds: [],\n getModalNode: undefinedFunction,\n onChange: undefinedFunction,\n onConfirm: undefinedFunction,\n onClose: undefinedFunction,\n onDestroy: undefinedFunction,\n setUpdater: undefinedFunction,\n getModal: () => ({\n modal: undefined,\n onConfirm: undefinedFunction,\n onClose: undefinedFunction,\n onChange: undefinedFunction,\n onDestroy: undefinedFunction,\n }),\n});\n","import {\n type PropsWithChildren,\n memo,\n useCallback,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { useOnMountLayout, useReference } from '@winglet/react-utils';\n\nimport type { Fn } from '@aileron/types';\n\nimport { ModalManager } from '@/promise-modal/app/ModalManager';\nimport { type ModalNode, nodeFactory } from '@/promise-modal/core';\nimport { getMillisecondsFromDuration } from '@/promise-modal/helpers/getMillisecondsFromDuration';\nimport { useModalOptions } from '@/promise-modal/providers';\nimport type { Modal } from '@/promise-modal/types';\n\nimport { ModalDataContext } from './ModalDataContext';\n\ninterface ModalDataContextProviderProps {\n pathname: string;\n}\n\nexport const ModalDataContextProvider = memo(\n ({\n pathname,\n children,\n }: PropsWithChildren<ModalDataContextProviderProps>) => {\n const modalDictionary = useRef<Map<ModalNode['id'], ModalNode>>(new Map());\n\n const [modalIds, setModalIds] = useState<ModalNode['id'][]>([]);\n const modalIdsRef = useReference(modalIds);\n\n const initiator = useRef(pathname);\n const modalIdSequence = useRef(0);\n\n const options = useModalOptions();\n\n const duration = useMemo(\n () => getMillisecondsFromDuration(options.duration),\n [options],\n );\n\n useOnMountLayout(() => {\n const { manualDestroy, closeOnBackdropClick } = options;\n\n for (const data of ModalManager.prerender) {\n const modal = nodeFactory({\n ...data,\n id: modalIdSequence.current++,\n initiator: initiator.current,\n manualDestroy:\n data.manualDestroy !== undefined\n ? data.manualDestroy\n : manualDestroy,\n closeOnBackdropClick:\n data.closeOnBackdropClick !== undefined\n ? data.closeOnBackdropClick\n : closeOnBackdropClick,\n });\n modalDictionary.current.set(modal.id, modal);\n setModalIds((ids) => [...ids, modal.id]);\n }\n\n ModalManager.setupOpen((data: Modal) => {\n const modal = nodeFactory({\n ...data,\n id: modalIdSequence.current++,\n initiator: initiator.current,\n manualDestroy:\n data.manualDestroy !== undefined\n ? data.manualDestroy\n : manualDestroy,\n closeOnBackdropClick:\n data.closeOnBackdropClick !== undefined\n ? data.closeOnBackdropClick\n : closeOnBackdropClick,\n });\n modalDictionary.current.set(modal.id, modal);\n setModalIds((ids) => {\n const aliveIds = ids.filter((id) => {\n const destroyed = !modalDictionary.current.get(id)?.alive;\n if (destroyed) modalDictionary.current.delete(id);\n return !destroyed;\n });\n return [...aliveIds, modal.id];\n });\n });\n ModalManager.clearPrerender();\n });\n\n useLayoutEffect(() => {\n for (const id of modalIdsRef.current) {\n const modal = modalDictionary.current.get(id);\n if (!modal?.alive) continue;\n if (modal.initiator === pathname) modal.onShow();\n else modal.onHide();\n }\n initiator.current = pathname;\n }, [modalIdsRef, pathname]);\n\n const getModalNode = useCallback((modalId: ModalNode['id']) => {\n return modalDictionary.current.get(modalId);\n }, []);\n\n const onDestroy = useCallback((modalId: ModalNode['id']) => {\n const modal = modalDictionary.current.get(modalId);\n if (!modal) return;\n modal.onDestroy();\n updaterRef.current?.();\n }, []);\n\n const updaterRef = useRef<Fn>();\n const hideModal = useCallback(\n (modalId: ModalNode['id']) => {\n const modal = modalDictionary.current.get(modalId);\n if (!modal) return;\n modal.onHide();\n updaterRef.current?.();\n if (!modal.manualDestroy)\n setTimeout(() => {\n modal.onDestroy();\n }, duration);\n },\n [duration],\n );\n\n const onChange = useCallback((modalId: ModalNode['id'], value: any) => {\n const modal = modalDictionary.current.get(modalId);\n if (!modal) return;\n if (modal.type === 'prompt') modal.onChange(value);\n }, []);\n\n const onConfirm = useCallback(\n (modalId: ModalNode['id']) => {\n const modal = modalDictionary.current.get(modalId);\n if (!modal) return;\n modal.onConfirm();\n hideModal(modalId);\n },\n [hideModal],\n );\n\n const onClose = useCallback(\n (modalId: ModalNode['id']) => {\n const modal = modalDictionary.current.get(modalId);\n if (!modal) return;\n modal.onClose();\n hideModal(modalId);\n },\n [hideModal],\n );\n\n const getModal = useCallback(\n (modalId: ModalNode['id']) => ({\n modal: getModalNode(modalId),\n onConfirm: () => onConfirm(modalId),\n onClose: () => onClose(modalId),\n onChange: (value: any) => onChange(modalId, value),\n onDestroy: () => onDestroy(modalId),\n }),\n [getModalNode, onConfirm, onClose, onChange, onDestroy],\n );\n\n const value = useMemo(() => {\n return {\n modalIds,\n getModalNode,\n onChange,\n onConfirm,\n onClose,\n onDestroy,\n getModal,\n setUpdater: (updater: Fn) => {\n updaterRef.current = updater;\n },\n };\n }, [\n modalIds,\n getModal,\n getModalNode,\n onChange,\n onConfirm,\n onClose,\n onDestroy,\n ]);\n\n return (\n <ModalDataContext.Provider value={value}>\n {children}\n </ModalDataContext.Provider>\n );\n },\n);\n","import { useContext, useMemo } from 'react';\n\nimport type { ManagedModal } from '@/promise-modal/types';\n\nimport { ModalDataContext } from './ModalDataContext';\n\nexport const useModalDataContext = () => useContext(ModalDataContext);\n\nexport const useModal = (id: ManagedModal['id']) => {\n const { getModal } = useModalDataContext();\n return useMemo(() => getModal(id), [id, getModal]);\n};\n","import { css } from '@emotion/css';\n\nexport const anchor = css`\n display: flex;\n align-items: center;\n justify-content: center;\n position: fixed;\n inset: 0;\n pointer-events: none;\n z-index: 1000;\n transition: background-color ease-in-out;\n`;\n","import { memo, useEffect } from 'react';\n\nimport { useTick, withErrorBoundary } from '@winglet/react-utils';\n\nimport { Presenter } from '@/promise-modal/components/Presenter';\nimport { useActiveModalCount } from '@/promise-modal/hooks/useActiveModalCount';\nimport { useModalContext } from '@/promise-modal/providers';\nimport { useModalDataContext } from '@/promise-modal/providers/ModalDataContext';\n\nimport { anchor } from './classNames.emotion';\n\nconst AnchorInner = () => {\n const [key, update] = useTick();\n\n const { modalIds, setUpdater } = useModalDataContext();\n\n useEffect(() => {\n setUpdater(update);\n }, [setUpdater, update]);\n\n const { options } = useModalContext();\n\n const dimmed = useActiveModalCount(key);\n\n return (\n <div\n className={anchor}\n style={{\n transitionDuration: options.duration,\n backgroundColor: dimmed ? options.backdrop : 'transparent',\n }}\n >\n {modalIds.map((id) => {\n return <Presenter key={id} modalId={id} />;\n })}\n </div>\n );\n};\n\nexport const Anchor = memo(withErrorBoundary(AnchorInner));\n","import { css } from '@emotion/css';\n\nexport const fallback = css`\n margin: unset;\n`;\n\nexport const frame = css`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n background-color: white;\n padding: 20px 80px;\n gap: 10px;\n border: 1px solid black;\n`;\n","import type { PropsWithChildren } from 'react';\n\nimport { fallback } from './classNames.emotion';\n\nexport const FallbackTitle = ({ children }: PropsWithChildren) => {\n return <h2 className={fallback}>{children}</h2>;\n};\n","import type { PropsWithChildren } from 'react';\n\nimport { fallback } from './classNames.emotion';\n\nexport const FallbackSubtitle = ({ children }: PropsWithChildren) => {\n return <h3 className={fallback}>{children}</h3>;\n};\n","import type { PropsWithChildren } from 'react';\n\nimport { fallback } from './classNames.emotion';\n\nexport const FallbackContent = ({ children }: PropsWithChildren) => {\n return <div className={fallback}>{children}</div>;\n};\n","import type { FooterComponentProps } from '@/promise-modal/types';\n\nexport const FallbackFooter = ({\n confirmLabel,\n hideConfirm = false,\n cancelLabel,\n hideCancel = false,\n disabled,\n onConfirm,\n onCancel,\n}: FooterComponentProps) => {\n return (\n <div>\n {!hideConfirm && (\n <button onClick={onConfirm} disabled={disabled}>\n {confirmLabel || '확인'}\n </button>\n )}\n\n {!hideCancel && typeof onCancel === 'function' && (\n <button onClick={onCancel}>{cancelLabel || '취소'}</button>\n )}\n </div>\n );\n};\n","import {\n type ForwardedRef,\n type PropsWithChildren,\n forwardRef,\n useMemo,\n} from 'react';\n\nimport { useActiveModalCount } from '@/promise-modal/hooks/useActiveModalCount';\nimport type { ModalFrameProps } from '@/promise-modal/types';\n\nimport { frame } from './classNames.emotion';\n\nconst MAX_MODAL_COUNT = 5;\nconst MAX_MODAL_LEVEL = 3;\n\nexport const FallbackForegroundFrame = forwardRef(\n (\n { id, onChangeOrder, children }: PropsWithChildren<ModalFrameProps>,\n ref: ForwardedRef<HTMLDivElement>,\n ) => {\n const activeCount = useActiveModalCount();\n const [level, offset] = useMemo(() => {\n const stacked = activeCount > 1;\n const level = stacked\n ? (Math.floor(id / MAX_MODAL_COUNT) % MAX_MODAL_LEVEL) * 100\n : 0;\n const offset = stacked ? (id % MAX_MODAL_COUNT) * 35 : 0;\n return [level, offset];\n }, [activeCount, id]);\n\n return (\n <div\n ref={ref}\n className={frame}\n onClick={onChangeOrder}\n style={{\n marginBottom: `calc(25vh + ${level}px)`,\n marginLeft: `${level}px`,\n transform: `translate(${offset}px, ${offset}px)`,\n }}\n >\n {children}\n </div>\n );\n },\n);\n","import { useLayoutEffect, useState } from 'react';\n\nexport const usePathname = () => {\n const [pathname, setPathname] = useState(window.location.pathname);\n\n useLayoutEffect(() => {\n let requestId: number;\n\n const checkPathname = () => {\n if (requestId) cancelAnimationFrame(requestId);\n if (pathname !== window.location.pathname) {\n setPathname(window.location.pathname);\n } else {\n requestId = requestAnimationFrame(checkPathname);\n }\n };\n\n requestId = requestAnimationFrame(checkPathname);\n\n return () => {\n if (requestId) cancelAnimationFrame(requestId);\n };\n }, [pathname]);\n\n return { pathname };\n};\n","import {\n type ComponentType,\n type PropsWithChildren,\n createContext,\n} from 'react';\n\nimport type { Color, Duration } from '@aileron/types';\n\nimport {\n DEFAULT_ANIMATION_DURATION,\n DEFAULT_BACKDROP_COLOR,\n} from '@/promise-modal/app/constant';\nimport {\n FallbackContent,\n FallbackFooter,\n FallbackForegroundFrame,\n FallbackSubtitle,\n FallbackTitle,\n} from '@/promise-modal/components/FallbackComponents';\nimport type {\n BackgroundComponent,\n FooterComponentProps,\n ForegroundComponent,\n} from '@/promise-modal/types';\n\nexport interface ModalContextProps {\n ForegroundComponent: ForegroundComponent;\n BackgroundComponent?: BackgroundComponent;\n TitleComponent: ComponentType<PropsWithChildren>;\n SubtitleComponent: ComponentType<PropsWithChildren>;\n ContentComponent: ComponentType<PropsWithChildren>;\n FooterComponent: ComponentType<FooterComponentProps>;\n options: {\n duration: Duration;\n backdrop: Color;\n manualDestroy: boolean;\n closeOnBackdropClick: boolean;\n };\n}\n\nexport const ModalContext = createContext<ModalContextProps>({\n ForegroundComponent: FallbackForegroundFrame,\n TitleComponent: FallbackTitle,\n SubtitleComponent: FallbackSubtitle,\n ContentComponent: FallbackContent,\n FooterComponent: FallbackFooter,\n options: {\n duration: DEFAULT_ANIMATION_DURATION,\n backdrop: DEFAULT_BACKDROP_COLOR,\n manualDestroy: false,\n closeOnBackdropClick: true,\n },\n});\n","import {\n type ComponentType,\n type PropsWithChildren,\n memo,\n useMemo,\n useRef,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\n\nimport { useOnMount, useTick } from '@winglet/react-utils';\n\nimport type { Color, Duration } from '@aileron/types';\n\nimport { ModalManager } from '@/promise-modal/app/ModalManager';\nimport {\n DEFAULT_ANIMATION_DURATION,\n DEFAULT_BACKDROP_COLOR,\n} from '@/promise-modal/app/constant';\nimport { Anchor } from '@/promise-modal/components/Anchor';\nimport {\n FallbackContent,\n FallbackFooter,\n FallbackForegroundFrame,\n FallbackSubtitle,\n FallbackTitle,\n} from '@/promise-modal/components/FallbackComponents';\nimport { usePathname as useDefaultPathname } from '@/promise-modal/hooks/useDefaultPathname';\nimport type {\n FooterComponentProps,\n ModalFrameProps,\n} from '@/promise-modal/types';\n\nimport { ModalDataContextProvider } from '../ModalDataContext';\nimport { ModalContext } from './ModalContext';\n\ninterface ModalContextProviderProps {\n BackgroundComponent?: ComponentType<ModalFrameProps>;\n ForegroundComponent?: ComponentType<ModalFrameProps>;\n TitleComponent?: ComponentType<PropsWithChildren>;\n SubtitleComponent?: ComponentType<PropsWithChildren>;\n ContentComponent?: ComponentType<PropsWithChildren>;\n FooterComponent?: ComponentType<FooterComponentProps>;\n options?: {\n /** Modal transition time(ms, s) */\n duration?: Duration;\n /** Modal backdrop color */\n backdrop?: Color;\n /** Whether to destroy the modal manually */\n manualDestroy?: boolean;\n /** Whether to close the modal when the backdrop is clicked */\n closeOnBackdropClick?: boolean;\n };\n usePathname?: () => { pathname: string };\n}\n\nexport const ModalContextProvider = memo(\n ({\n ForegroundComponent,\n BackgroundComponent,\n TitleComponent,\n SubtitleComponent,\n ContentComponent,\n FooterComponent,\n options,\n usePathname,\n children,\n }: PropsWithChildren<ModalContextProviderProps>) => {\n const { pathname } = (usePathname || useDefaultPathname)();\n const [, update] = useTick();\n const portalRef = useRef<HTMLElement | null>(null);\n\n useOnMount(() => {\n portalRef.current = ModalManager.anchor('div');\n update();\n return () => {\n if (portalRef.current) {\n portalRef.current.remove();\n }\n };\n });\n\n const value = useMemo(\n () => ({\n BackgroundComponent,\n ForegroundComponent: ForegroundComponent || FallbackForegroundFrame,\n TitleComponent: TitleComponent || FallbackTitle,\n SubtitleComponent: SubtitleComponent || FallbackSubtitle,\n ContentComponent: memo(ContentComponent || FallbackContent),\n FooterComponent: memo(FooterComponent || FallbackFooter),\n options: {\n duration: DEFAULT_ANIMATION_DURATION,\n backdrop: DEFAULT_BACKDROP_COLOR,\n closeOnBackdropClick: true,\n manualDestroy: false,\n ...options,\n } satisfies ModalContextProviderProps['options'],\n }),\n [\n ForegroundComponent,\n BackgroundComponent,\n ContentComponent,\n FooterComponent,\n SubtitleComponent,\n TitleComponent,\n options,\n ],\n );\n\n return (\n <ModalContext.Provider value={value}>\n {children}\n {portalRef.current &&\n createPortal(\n <ModalDataContextProvider pathname={pathname}>\n <Anchor />\n </ModalDataContextProvider>,\n portalRef.current,\n )}\n </ModalContext.Provider>\n );\n },\n);\n","import { useContext } from 'react';\n\nimport { getMillisecondsFromDuration } from '@/promise-modal/helpers/getMillisecondsFromDuration';\n\nimport { ModalContext } from './ModalContext';\n\nexport const useModalContext = () => useContext(ModalContext);\n\nexport const useModalOptions = () => {\n const { options } = useContext(ModalContext);\n return options;\n};\n\nexport const useModalDuration = () => {\n const { duration } = useModalOptions();\n return { duration, milliseconds: getMillisecondsFromDuration(duration) };\n};\n\nexport const useModalBackdrop = () => {\n const { backdrop } = useModalOptions();\n return backdrop;\n};\n","import type { ComponentType, ReactNode } from 'react';\n\nimport { ModalManager } from '@/promise-modal/app/ModalManager';\nimport type {\n AlertContentProps,\n AlertFooterRender,\n BackgroundComponent,\n FooterOptions,\n ForegroundComponent,\n ModalBackground,\n} from '@/promise-modal/types';\n\ninterface AlertProps<B> {\n subtype?: 'info' | 'success' | 'warning' | 'error';\n title?: ReactNode;\n subtitle?: ReactNode;\n content?: ReactNode | ComponentType<AlertContentProps>;\n background?: ModalBackground<B>;\n footer?:\n | AlertFooterRender\n | Pick<FooterOptions, 'confirm' | 'hideConfirm'>\n | false;\n manualDestroy?: boolean;\n closeOnBackdropClick?: boolean;\n ForegroundComponent?: ForegroundComponent;\n BackgroundComponent?: BackgroundComponent;\n}\n\nexport const alert = <B = any>({\n subtype,\n title,\n subtitle,\n content,\n background,\n footer,\n manualDestroy,\n closeOnBackdropClick,\n ForegroundComponent,\n BackgroundComponent,\n}: AlertProps<B>) => {\n return new Promise<void>((resolve, reject) => {\n try {\n ModalManager.open({\n type: 'alert',\n subtype,\n resolve: () => resolve(),\n title,\n subtitle,\n content,\n background,\n footer,\n manualDestroy,\n closeOnBackdropClick,\n ForegroundComponent,\n BackgroundComponent,\n });\n } catch (error) {\n reject(error);\n }\n });\n};\n","import type { ComponentType, ReactNode } from 'react';\n\nimport { ModalManager } from '@/promise-modal/app/ModalManager';\nimport type {\n BackgroundComponent,\n ConfirmContentProps,\n ConfirmFooterRender,\n FooterOptions,\n ForegroundComponent,\n ModalBackground,\n} from '@/promise-modal/types';\n\ninterface ConfirmProps<B> {\n subtype?: 'info' | 'success' | 'warning' | 'error';\n title?: ReactNode;\n subtitle?: ReactNode;\n content?: ReactNode | ComponentType<ConfirmContentProps>;\n background?: ModalBackground<B>;\n footer?: ConfirmFooterRender | FooterOptions | false;\n closeOnBackdropClick?: boolean;\n manualDestroy?: boolean;\n ForegroundComponent?: ForegroundComponent;\n BackgroundComponent?: BackgroundComponent;\n}\n\nexport const confirm = <B = any>({\n subtype,\n title,\n subtitle,\n content,\n background,\n footer,\n manualDestroy,\n closeOnBackdropClick,\n ForegroundComponent,\n BackgroundComponent,\n}: ConfirmProps<B>) => {\n return new Promise<boolean>((resolve, reject) => {\n try {\n ModalManager.open({\n type: 'confirm',\n subtype,\n resolve: (result) => resolve(result ?? false),\n title,\n subtitle,\n content,\n background,\n footer,\n manualDestroy,\n closeOnBackdropClick,\n ForegroundComponent,\n BackgroundComponent,\n });\n } catch (error) {\n reject(error);\n }\n });\n};\n","import type { ComponentType, ReactNode } from 'react';\n\nimport type {\n BackgroundComponent,\n FooterOptions,\n ForegroundComponent,\n ModalBackground,\n PromptContentProps,\n PromptFooterRender,\n PromptInputProps,\n} from '@/promise-modal/types';\n\nimport { ModalManager } from '../../app/ModalManager';\n\ninterface PromptProps<T, B = any> {\n title?: ReactNode;\n subtitle?: ReactNode;\n content?: ReactNode | ComponentType<PromptContentProps>;\n Input: (props: PromptInputProps<T>) => ReactNode;\n defaultValue?: T;\n disabled?: (value: T) => boolean;\n returnOnCancel?: boolean;\n background?: ModalBackground<B>;\n footer?: PromptFooterRender<T> | FooterOptions | false;\n manualDestroy?: boolean;\n closeOnBackdropClick?: boolean;\n ForegroundComponent?: ForegroundComponent;\n BackgroundComponent?: BackgroundComponent;\n}\n\nexport const prompt = <T, B = any>({\n defaultValue,\n title,\n subtitle,\n content,\n Input,\n disabled,\n returnOnCancel,\n background,\n footer,\n manualDestroy,\n closeOnBackdropClick,\n ForegroundComponent,\n BackgroundComponent,\n}: PromptProps<T, B>) => {\n return new Promise<T>((resolve, reject) => {\n try {\n ModalManager.open({\n type: 'prompt',\n resolve: (result) => resolve(result as T),\n title,\n subtitle,\n content,\n Input: ({\n defaultValue,\n onChange,\n onConfirm,\n onCancel,\n }: PromptInputProps<T>) =>\n Input({\n defaultValue,\n onChange,\n onConfirm,\n onCancel,\n }),\n defaultValue,\n disabled,\n returnOnCancel,\n background,\n footer,\n manualDestroy,\n closeOnBackdropClick,\n ForegroundComponent,\n BackgroundComponent,\n });\n } catch (error) {\n reject(error);\n }\n });\n};\n","import { useEffect, useRef } from 'react';\n\nimport { isString } from '@winglet/common-utils';\n\nimport type { Duration } from '@aileron/types';\n\nimport type { ModalNode } from '@/promise-modal/core';\nimport { getMillisecondsFromDuration } from '@/promise-modal/helpers/getMillisecondsFromDuration';\n\nimport { useModal } from '../providers';\nimport { useSubscribeModal } from './useSubscribeModal';\n\nexport const useDestroyAfter = (\n modalId: ModalNode['id'],\n duration: Duration | number,\n) => {\n const { modal, onDestroy } = useModal(modalId);\n const tick = useSubscribeModal(modal);\n\n const reference = useRef({\n modal,\n onDestroy,\n milliseconds: isString(duration)\n ? getMillisecondsFromDuration(duration)\n : duration,\n });\n\n useEffect(() => {\n const { modal, onDestroy, milliseconds } = reference.current;\n if (!modal || modal.visible || !modal.alive) return;\n const timer = setTimeout(() => {\n onDestroy();\n }, milliseconds);\n return () => {\n if (timer) clearTimeout(timer);\n };\n }, [tick]);\n};\n"],"names":["prerenderListRef","current","openModalRef","modal","push","anchorRef","ModalManager","prerender","clearPrerender","open","setupOpen","anchor","name","prefix","document","getElementById","id","node","createElement","setAttribute","getRandomString","body","appendChild","DEFAULT_ANIMATION_DURATION","DEFAULT_BACKDROP_COLOR","background","css","process","env","NODE_ENV","styles","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","active","visible","Background","modalId","onChangeOrder","BackgroundComponent","useModalContext","onClose","onChange","onConfirm","onDestroy","useModal","handleClose","useCallback","event","closeOnBackdropClick","stopPropagation","useMemo","_jsx","jsx","className","cx","visible$1","manualDestroy","alive","active$1","onClick","children","type","initiator","foreground","AlertInner","memo","handlers","title","subtitle","content","footer","handleConfirm","useHandle","TitleComponent","SubtitleComponent","ContentComponent","FooterComponent","_jsxs","Fragment","isString","renderComponent","confirmLabel","confirm","hideConfirm","ConfirmInner","onCancel","cancelLabel","cancel","hideCancel","PromptInner","Input","defaultValue","disabled","checkDisabled","withErrorBoundary","value","setValue","useState","handleChange","inputValue","input","isFunction","setTimeout","Foreground","ForegroundComponent","useSubscribeModal","tick","update","useTick","useOnMount","subscribe","presenter","zIndex","Presenter","ref","useRef","handleChangeOrder","style","useActiveModalCount","modalIds","getModalNode","useModalDataContext","count","BaseNode","__classPrivateFieldGet","this","_BaseNode_alive","_BaseNode_visible","constructor","resolve","Object","defineProperty","set","_BaseNode_resolve","_BaseNode_listeners","__classPrivateFieldSet","listener","filter","l","publish","result","call","needPublish","onShow","onHide","AlertNode","subtype","super","ConfirmNode","PromptNode","returnOnCancel","_PromptNode_value","nodeFactory","Error","DURATION_REGEX","getMillisecondsFromDuration","durationString","unit","match","duration","parseInt","ModalDataContext","createContext","undefinedFunction","setUpdater","getModal","undefined","ModalDataContextProvider","pathname","modalDictionary","Map","setModalIds","modalIdsRef","useReference","modalIdSequence","options","useModalOptions","useOnMountLayout","data","ids","destroyed","get","delete","useLayoutEffect","updaterRef","hideModal","updater","Provider","useContext","Anchor","key","useEffect","dimmed","transitionDuration","backgroundColor","backdrop","map","fallback","frame","FallbackTitle","FallbackSubtitle","FallbackContent","FallbackFooter","FallbackForegroundFrame","forwardRef","activeCount","level","offset","stacked","Math","floor","marginBottom","marginLeft","transform","usePathname","setPathname","window","location","requestId","checkPathname","cancelAnimationFrame","requestAnimationFrame","ModalContext","ModalContextProvider","useDefaultPathname","portalRef","remove","jsxs","createPortal","Promise","reject","error","reference","milliseconds","timer","clearTimeout"],"mappings":"yLAQA,MAAMA,EAA8C,CAClDC,QAAS,IAGLC,EAAoD,CACxD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YrH,EAAAA,OAAO,CACvBhH,QACAwC,YACA8L,aAAc1J,EAAQA,SAACgF,GACnBJ,EAA4BI,GAC5BA,IAGNgC,EAAAA,WAAU,KACR,MAAM5L,MAAEA,EAAKwC,UAAEA,EAAS8L,aAAEA,GAAiBD,EAAUvO,QACrD,IAAKE,GAASA,EAAM+B,UAAY/B,EAAMsD,MAAO,OAC7C,MAAMiL,EAAQpI,YAAW,KACvB3D,GAAW,GACV8L,GACH,MAAO,KACDC,GAAOC,aAAaD,EAAM,CAC/B,GACA,CAAChI,GAAM,2BJlBoB,KAC9B,MAAMyF,SAAEA,GAAanB,KACrB,OAAOmB,CAAQ,2BAPe,KAC9B,MAAMpC,SAAEA,GAAaiB,KACrB,MAAO,CAAEjB,WAAU0E,aAAc9E,EAA4BI,GAAW"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/app/ModalManager.ts","../src/app/constant.ts","../src/providers/UserDefinedContext/UserDefinedContext.ts","../src/providers/UserDefinedContext/UserDefinedContextProvider.tsx","../src/providers/UserDefinedContext/useUserDefinedContext.ts","../src/components/Background/classNames.emotion.ts","../src/components/Background/Background.tsx","../src/components/Foreground/classNames.emotion.ts","../src/components/Foreground/components/AlertInner.tsx","../src/components/Foreground/components/ConfirmInner.tsx","../src/components/Foreground/components/PromptInner.tsx","../src/components/Foreground/Foreground.tsx","../src/hooks/useSubscribeModal.ts","../src/components/Presenter/classNames.emotion.ts","../src/components/Presenter/Presenter.tsx","../src/hooks/useActiveModalCount.ts","../src/core/node/ModalNode/AbstractBaseNode.ts","../src/core/node/ModalNode/AlertNode.ts","../src/core/node/ModalNode/ConfirmNode.ts","../src/core/node/ModalNode/PromptNode.ts","../src/core/node/nodeFactory.ts","../src/helpers/getMillisecondsFromDuration.ts","../src/providers/ModalDataContext/ModalDataContext.ts","../src/providers/ModalDataContext/ModalDataContextProvider.tsx","../src/providers/ModalDataContext/useModalDataContext.ts","../src/components/Anchor/classNames.emotion.ts","../src/components/Anchor/Anchor.tsx","../src/components/FallbackComponents/classNames.emotion.ts","../src/components/FallbackComponents/FallbackTitle.tsx","../src/components/FallbackComponents/FallbackSubtitle.tsx","../src/components/FallbackComponents/FallbackContent.tsx","../src/components/FallbackComponents/FallbackFooter.tsx","../src/components/FallbackComponents/FallbackForegroundFrame.tsx","../src/hooks/useDefaultPathname.ts","../src/providers/ModalContext/ModalContext.ts","../src/providers/ModalContext/ModalContextProvider.tsx","../src/providers/ModalContext/useModalContext.ts","../src/core/handle/alert.ts","../src/core/handle/confirm.ts","../src/core/handle/prompt.ts","../src/hooks/useDestroyAfter.ts"],"sourcesContent":["import { MutableRefObject } from 'react';\n\nimport { getRandomString } from '@winglet/common-utils';\n\nimport type { Fn } from '@aileron/types';\n\nimport type { Modal } from '@/promise-modal/types';\n\nconst prerenderListRef: MutableRefObject<Modal[]> = {\n current: [],\n};\n\nconst openModalRef: MutableRefObject<Fn<[Modal], void>> = {\n current: (modal: Modal) => {\n prerenderListRef.current.push(modal);\n },\n};\n\nconst anchorRef: MutableRefObject<HTMLElement | null> = {\n current: null,\n};\n\nexport const ModalManager = {\n get prerender() {\n return prerenderListRef.current;\n },\n clearPrerender() {\n prerenderListRef.current = [];\n },\n open(modal: Modal) {\n openModalRef.current(modal);\n },\n setupOpen(open: (modal: Modal) => void) {\n openModalRef.current = open;\n },\n anchor(name: string, prefix = 'promise-modal'): HTMLElement {\n if (anchorRef.current) {\n const anchor = document.getElementById(anchorRef.current.id);\n if (anchor) return anchor;\n }\n const node = document.createElement(name);\n node.setAttribute('id', `${prefix}-${getRandomString(36)}`);\n document.body.appendChild(node);\n anchorRef.current = node;\n return node;\n },\n};\n","import type { Color, Duration } from '@aileron/types';\n\nexport const DEFAULT_ANIMATION_DURATION: Duration = '300ms';\n\nexport const DEFAULT_BACKDROP_COLOR: Color = 'rgba(0, 0, 0, 0.5)';\n","import { createContext } from 'react';\n\nimport { EMPTY_OBJECT } from '@winglet/common-utils';\n\nimport type { Dictionary } from '@aileron/types';\n\nexport interface UserDefinedContext {\n context: Dictionary;\n}\n\nexport const UserDefinedContext = createContext<UserDefinedContext>({\n context: EMPTY_OBJECT,\n});\n","import { PropsWithChildren, useMemo } from 'react';\n\nimport { EMPTY_OBJECT } from '@winglet/common-utils';\n\nimport type { Dictionary } from '@aileron/types';\n\nimport { UserDefinedContext } from './UserDefinedContext';\n\ninterface UserDefinedContextProviderProps {\n /** 사용자 정의 컨텍스트 */\n context?: Dictionary;\n}\n\nexport const UserDefinedContextProvider = ({\n context,\n children,\n}: PropsWithChildren<UserDefinedContextProviderProps>) => {\n const contextValue = useMemo(\n () => ({ context: context || EMPTY_OBJECT }),\n [context],\n );\n return (\n <UserDefinedContext.Provider value={contextValue}>\n {children}\n </UserDefinedContext.Provider>\n );\n};\n","import { useContext } from 'react';\n\nimport { UserDefinedContext } from './UserDefinedContext';\n\nexport const useUserDefinedContext = () => {\n return useContext(UserDefinedContext);\n};\n","import { css } from '@emotion/css';\n\nexport const background = css`\n display: none;\n position: fixed;\n inset: 0;\n z-index: -999;\n pointer-events: none;\n > * {\n pointer-events: none;\n }\n`;\n\nexport const active = css`\n pointer-events: all;\n`;\n\nexport const visible = css`\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n","import { type MouseEvent, useCallback, useMemo } from 'react';\n\nimport { cx } from '@emotion/css';\n\nimport { useModal, useModalContext } from '@/promise-modal/providers';\nimport { useUserDefinedContext } from '@/promise-modal/providers/UserDefinedContext';\nimport type { ModalLayerProps } from '@/promise-modal/types';\n\nimport { active, background, visible } from './classNames.emotion';\n\nexport const BackgroundFrame = ({\n modalId,\n onChangeOrder,\n}: ModalLayerProps) => {\n const { BackgroundComponent } = useModalContext();\n const { context: userDefinedContext } = useUserDefinedContext();\n const { modal, onClose, onChange, onConfirm, onDestroy } = useModal(modalId);\n\n const handleClose = useCallback(\n (event: MouseEvent) => {\n if (modal && modal.closeOnBackdropClick && modal.visible) onClose();\n event.stopPropagation();\n },\n [modal, onClose],\n );\n\n const Background = useMemo(\n () => modal?.BackgroundComponent || BackgroundComponent,\n [BackgroundComponent, modal],\n );\n\n if (!modal) return null;\n\n return (\n <div\n className={cx(background, {\n [visible]: modal.manualDestroy ? modal.alive : modal.visible,\n [active]: modal.closeOnBackdropClick && modal.visible,\n })}\n onClick={handleClose}\n >\n {Background && (\n <Background\n id={modal.id}\n type={modal.type}\n alive={modal.alive}\n visible={modal.visible}\n initiator={modal.initiator}\n manualDestroy={modal.manualDestroy}\n closeOnBackdropClick={modal.closeOnBackdropClick}\n background={modal.background}\n onChange={onChange}\n onConfirm={onConfirm}\n onClose={onClose}\n onDestroy={onDestroy}\n onChangeOrder={onChangeOrder}\n context={userDefinedContext}\n />\n )}\n </div>\n );\n};\n","import { css } from '@emotion/css';\n\nexport const foreground = css`\n pointer-events: none;\n display: none;\n position: fixed;\n inset: 0;\n z-index: 1;\n`;\n\nexport const active = css`\n > * {\n pointer-events: all;\n }\n`;\n\nexport const visible = css`\n display: flex !important;\n justify-content: center;\n align-items: center;\n`;\n","import { Fragment, memo, useMemo } from 'react';\n\nimport { isString } from '@winglet/common-utils';\nimport { renderComponent, useHandle } from '@winglet/react-utils';\n\nimport type { AlertNode } from '@/promise-modal/core';\nimport { useModalContext } from '@/promise-modal/providers';\nimport { useUserDefinedContext } from '@/promise-modal/providers/UserDefinedContext';\nimport type { ModalActions } from '@/promise-modal/types';\n\ninterface AlertInnerProps<B> {\n modal: AlertNode<B>;\n handlers: Pick<ModalActions, 'onConfirm'>;\n}\n\nexport const AlertInner = memo(\n <B,>({ modal, handlers }: AlertInnerProps<B>) => {\n const { title, subtitle, content, footer } = useMemo(() => modal, [modal]);\n const { context: userDefinedContext } = useUserDefinedContext();\n const { onConfirm } = useMemo(() => handlers, [handlers]);\n\n const handleConfirm = useHandle(onConfirm);\n\n const {\n TitleComponent,\n SubtitleComponent,\n ContentComponent,\n FooterComponent,\n } = useModalContext();\n\n return (\n <Fragment>\n {title &&\n (isString(title) ? (\n <TitleComponent context={userDefinedContext}>\n {title}\n </TitleComponent>\n ) : (\n title\n ))}\n {subtitle &&\n (isString(subtitle) ? (\n <SubtitleComponent context={userDefinedContext}>\n {subtitle}\n </SubtitleComponent>\n ) : (\n subtitle\n ))}\n {content &&\n (isString(content) ? (\n <ContentComponent context={userDefinedContext}>\n {content}\n </ContentComponent>\n ) : (\n renderComponent(content, {\n onConfirm: handleConfirm,\n })\n ))}\n {footer !== false &&\n (typeof footer === 'function' ? (\n footer({\n onConfirm: handleConfirm,\n context: userDefinedContext,\n })\n ) : (\n <FooterComponent\n onConfirm={handleConfirm}\n confirmLabel={footer?.confirm}\n hideConfirm={footer?.hideConfirm}\n context={userDefinedContext}\n />\n ))}\n </Fragment>\n );\n },\n);\n","import { Fragment, memo, useMemo } from 'react';\n\nimport { isString } from '@winglet/common-utils';\nimport { renderComponent, useHandle } from '@winglet/react-utils';\n\nimport type { ConfirmNode } from '@/promise-modal/core';\nimport { useModalContext } from '@/promise-modal/providers';\nimport { useUserDefinedContext } from '@/promise-modal/providers/UserDefinedContext';\nimport type { ModalActions } from '@/promise-modal/types';\n\ninterface ConfirmInnerProps<B> {\n modal: ConfirmNode<B>;\n handlers: Pick<ModalActions, 'onConfirm' | 'onClose'>;\n}\n\nexport const ConfirmInner = memo(\n <B,>({ modal, handlers }: ConfirmInnerProps<B>) => {\n const { title, subtitle, content, footer } = useMemo(() => modal, [modal]);\n const { context: userDefinedContext } = useUserDefinedContext();\n const { onConfirm, onClose } = useMemo(() => handlers, [handlers]);\n\n const handleConfirm = useHandle(onConfirm);\n const handleClose = useHandle(onClose);\n\n const {\n TitleComponent,\n SubtitleComponent,\n ContentComponent,\n FooterComponent,\n } = useModalContext();\n\n return (\n <Fragment>\n {title &&\n (isString(title) ? (\n <TitleComponent context={userDefinedContext}>\n {title}\n </TitleComponent>\n ) : (\n title\n ))}\n {subtitle &&\n (isString(subtitle) ? (\n <SubtitleComponent context={userDefinedContext}>\n {subtitle}\n </SubtitleComponent>\n ) : (\n subtitle\n ))}\n {content &&\n (isString(content) ? (\n <ContentComponent context={userDefinedContext}>\n {content}\n </ContentComponent>\n ) : (\n renderComponent(content, {\n onConfirm: handleConfirm,\n onCancel: handleClose,\n context: userDefinedContext,\n })\n ))}\n {footer !== false &&\n (typeof footer === 'function' ? (\n footer({\n onConfirm: handleConfirm,\n onCancel: handleClose,\n context: userDefinedContext,\n })\n ) : (\n <FooterComponent\n onConfirm={handleConfirm}\n onCancel={handleClose}\n confirmLabel={footer?.confirm}\n cancelLabel={footer?.cancel}\n hideConfirm={footer?.hideConfirm}\n hideCancel={footer?.hideCancel}\n context={userDefinedContext}\n />\n ))}\n </Fragment>\n );\n },\n);\n","import { Fragment, memo, useCallback, useMemo, useState } from 'react';\n\nimport { isFunction, isString } from '@winglet/common-utils';\nimport {\n renderComponent,\n useHandle,\n withErrorBoundary,\n} from '@winglet/react-utils';\n\nimport type { PromptNode } from '@/promise-modal/core';\nimport { useModalContext } from '@/promise-modal/providers';\nimport { useUserDefinedContext } from '@/promise-modal/providers/UserDefinedContext';\nimport type { ModalActions } from '@/promise-modal/types';\n\ninterface PromptInnerProps<T, B> {\n modal: PromptNode<T, B>;\n handlers: Pick<ModalActions, 'onChange' | 'onClose' | 'onConfirm'>;\n}\n\nexport const PromptInner = memo(\n <T, B>({ modal, handlers }: PromptInnerProps<T, B>) => {\n const {\n Input,\n defaultValue,\n disabled: checkDisabled,\n title,\n subtitle,\n content,\n footer,\n } = useMemo(\n () => ({\n ...modal,\n Input: memo(withErrorBoundary(modal.Input)),\n }),\n [modal],\n );\n\n const { context: userDefinedContext } = useUserDefinedContext();\n\n const [value, setValue] = useState<T | undefined>(defaultValue);\n\n const { onChange, onClose, onConfirm } = useMemo(\n () => handlers,\n [handlers],\n );\n\n const handleClose = useHandle(onClose);\n const handleChange = useHandle(\n (inputValue?: T | ((prevState: T | undefined) => T | undefined)) => {\n const input = isFunction(inputValue) ? inputValue(value) : inputValue;\n setValue(input);\n onChange(input);\n },\n );\n\n const handleConfirm = useCallback(() => {\n // NOTE: wait for the next tick to ensure the value is updated\n setTimeout(() => {\n onConfirm();\n });\n }, [onConfirm]);\n\n const disabled = useMemo(\n () => (value ? !!checkDisabled?.(value) : false),\n [checkDisabled, value],\n );\n\n const {\n TitleComponent,\n SubtitleComponent,\n ContentComponent,\n FooterComponent,\n } = useModalContext();\n\n return (\n <Fragment>\n {title &&\n (isString(title) ? (\n <TitleComponent context={userDefinedContext}>\n {title}\n </TitleComponent>\n ) : (\n title\n ))}\n {subtitle &&\n (isString(subtitle) ? (\n <SubtitleComponent context={userDefinedContext}>\n {subtitle}\n </SubtitleComponent>\n ) : (\n subtitle\n ))}\n {content &&\n (isString(content) ? (\n <ContentComponent context={userDefinedContext}>\n {content}\n </ContentComponent>\n ) : (\n renderComponent(content, {\n onConfirm: handleConfirm,\n onCancel: handleClose,\n context: userDefinedContext,\n })\n ))}\n\n {Input && (\n <Input\n defaultValue={defaultValue}\n value={value}\n onChange={handleChange}\n onConfirm={handleConfirm}\n onCancel={handleClose}\n context={userDefinedContext}\n />\n )}\n\n {footer !== false &&\n (typeof footer === 'function' ? (\n footer({\n value,\n disabled,\n onChange: handleChange,\n onConfirm: handleConfirm,\n onCancel: handleClose,\n context: userDefinedContext,\n })\n ) : (\n <FooterComponent\n disabled={disabled}\n onConfirm={handleConfirm}\n onCancel={handleClose}\n confirmLabel={footer?.confirm}\n cancelLabel={footer?.cancel}\n hideConfirm={footer?.hideConfirm}\n hideCancel={footer?.hideCancel}\n context={userDefinedContext}\n />\n ))}\n </Fragment>\n );\n },\n);\n","import { useMemo } from 'react';\n\nimport { cx } from '@emotion/css';\n\nimport { useModal, useModalContext } from '@/promise-modal/providers';\nimport { useUserDefinedContext } from '@/promise-modal/providers/UserDefinedContext';\nimport type { ModalLayerProps } from '@/promise-modal/types';\n\nimport { active, foreground, visible } from './classNames.emotion';\nimport { AlertInner, ConfirmInner, PromptInner } from './components';\n\nexport const ForegroundFrame = ({\n modalId,\n onChangeOrder,\n}: ModalLayerProps) => {\n const { ForegroundComponent } = useModalContext();\n const { context: userDefinedContext } = useUserDefinedContext();\n\n const { modal, onChange, onConfirm, onClose, onDestroy } = useModal(modalId);\n\n const Foreground = useMemo(\n () => modal?.ForegroundComponent || ForegroundComponent,\n [ForegroundComponent, modal],\n );\n\n if (!modal) return null;\n\n return (\n <div\n className={cx(foreground, {\n [visible]: modal.manualDestroy ? modal.alive : modal.visible,\n [active]: modal.visible,\n })}\n >\n <Foreground\n id={modal.id}\n type={modal.type}\n alive={modal.alive}\n visible={modal.visible}\n initiator={modal.initiator}\n manualDestroy={modal.manualDestroy}\n closeOnBackdropClick={modal.closeOnBackdropClick}\n background={modal.background}\n onChange={onChange}\n onConfirm={onConfirm}\n onClose={onClose}\n onDestroy={onDestroy}\n onChangeOrder={onChangeOrder}\n context={userDefinedContext}\n >\n {modal.type === 'alert' && (\n <AlertInner modal={modal} handlers={{ onConfirm }} />\n )}\n {modal.type === 'confirm' && (\n <ConfirmInner modal={modal} handlers={{ onConfirm, onClose }} />\n )}\n {modal.type === 'prompt' && (\n <PromptInner\n modal={modal}\n handlers={{ onChange, onConfirm, onClose }}\n />\n )}\n </Foreground>\n </div>\n );\n};\n","import { useOnMount, useTick } from '@winglet/react-utils';\n\nimport type { ModalNode } from '@/promise-modal/core';\n\nexport const useSubscribeModal = (modal?: ModalNode) => {\n const [tick, update] = useTick();\n useOnMount(() => {\n if (!modal) return;\n const unsubscribe = modal.subscribe(update);\n return unsubscribe;\n });\n return tick;\n};\n","import { css } from '@emotion/css';\n\nexport const presenter = css`\n position: fixed;\n inset: 0;\n pointer-events: none;\n overflow: hidden;\n`;\n","import { memo, useRef } from 'react';\n\nimport { useHandle } from '@winglet/react-utils';\n\nimport { Background } from '@/promise-modal/components/Background';\nimport { Foreground } from '@/promise-modal/components/Foreground';\nimport { useSubscribeModal } from '@/promise-modal/hooks/useSubscribeModal';\nimport { useModal } from '@/promise-modal/providers';\nimport type { ModalIdProps } from '@/promise-modal/types';\n\nimport { presenter } from './classNames.emotion';\n\nlet zIndex = 1;\n\nexport const Presenter = memo(({ modalId }: ModalIdProps) => {\n const ref = useRef<HTMLDivElement>(null);\n const { modal } = useModal(modalId);\n useSubscribeModal(modal);\n const handleChangeOrder = useHandle(() => {\n if (ref.current) {\n ref.current.style.zIndex = `${zIndex++}`;\n }\n });\n return (\n <div ref={ref} className={presenter}>\n <Background modalId={modalId} onChangeOrder={handleChangeOrder} />\n <Foreground modalId={modalId} onChangeOrder={handleChangeOrder} />\n </div>\n );\n});\n","import { useMemo } from 'react';\n\nimport { useModalDataContext } from '../providers';\n\nexport const useActiveModalCount = (tick: string | number = 0) => {\n const { modalIds, getModalNode } = useModalDataContext();\n return useMemo(() => {\n let count = 0;\n for (const id of modalIds) {\n if (getModalNode(id)?.visible) count++;\n }\n return count;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [getModalNode, modalIds, tick]);\n};\n","import type { ReactNode } from 'react';\n\nimport type { Fn } from '@aileron/types';\n\nimport type {\n BackgroundComponent,\n BaseModal,\n ForegroundComponent,\n ManagedEntity,\n ModalBackground,\n} from '@/promise-modal/types';\n\ntype BaseNodeProps<T, B> = BaseModal<T, B> & ManagedEntity;\n\nexport abstract class BaseNode<T, B> {\n readonly id: number;\n readonly initiator: string;\n\n readonly title?: ReactNode;\n readonly subtitle?: ReactNode;\n readonly background?: ModalBackground<B>;\n\n readonly manualDestroy: boolean;\n readonly closeOnBackdropClick: boolean;\n\n readonly ForegroundComponent?: ForegroundComponent;\n readonly BackgroundComponent?: BackgroundComponent;\n\n #alive: boolean;\n get alive() {\n return this.#alive;\n }\n #visible: boolean;\n get visible() {\n return this.#visible;\n }\n\n #resolve: (result: T | null) => void;\n #listeners: Fn[] = [];\n\n constructor({\n id,\n initiator,\n title,\n subtitle,\n background,\n manualDestroy = false,\n closeOnBackdropClick = true,\n resolve,\n ForegroundComponent,\n BackgroundComponent,\n }: BaseNodeProps<T, B>) {\n this.id = id;\n this.initiator = initiator;\n this.title = title;\n this.subtitle = subtitle;\n this.background = background;\n this.manualDestroy = manualDestroy;\n this.closeOnBackdropClick = closeOnBackdropClick;\n\n this.ForegroundComponent = ForegroundComponent;\n this.BackgroundComponent = BackgroundComponent;\n\n this.#alive = true;\n this.#visible = true;\n this.#resolve = resolve;\n }\n\n subscribe(listener: Fn) {\n this.#listeners.push(listener);\n return () => {\n this.#listeners = this.#listeners.filter((l) => l !== listener);\n };\n }\n publish() {\n for (const listener of this.#listeners) listener();\n }\n protected resolve(result: T | null) {\n this.#resolve(result);\n }\n onDestroy() {\n const needPublish = this.#alive === true;\n this.#alive = false;\n if (this.manualDestroy && needPublish) this.publish();\n }\n onShow() {\n const needPublish = this.#visible === false;\n this.#visible = true;\n if (needPublish) this.publish();\n }\n onHide() {\n const needPublish = this.#visible === true;\n this.#visible = false;\n if (needPublish) this.publish();\n }\n abstract onClose(): void;\n abstract onConfirm(): void;\n}\n","import type { ComponentType, ReactNode } from 'react';\n\nimport type {\n AlertContentProps,\n AlertFooterRender,\n AlertModal,\n FooterOptions,\n ManagedEntity,\n} from '@/promise-modal/types';\n\nimport { BaseNode } from './AbstractBaseNode';\n\ntype AlertNodeProps<B> = AlertModal<B> & ManagedEntity;\n\nexport class AlertNode<B> extends BaseNode<null, B> {\n readonly type: 'alert';\n readonly subtype?: 'info' | 'success' | 'warning' | 'error';\n readonly content?: ReactNode | ComponentType<AlertContentProps>;\n readonly footer?:\n | AlertFooterRender\n | Pick<FooterOptions, 'confirm' | 'hideConfirm'>\n | false;\n\n constructor({\n id,\n initiator,\n type,\n subtype,\n title,\n subtitle,\n content,\n footer,\n background,\n manualDestroy,\n closeOnBackdropClick,\n resolve,\n ForegroundComponent,\n BackgroundComponent,\n }: AlertNodeProps<B>) {\n super({\n id,\n initiator,\n title,\n subtitle,\n background,\n manualDestroy,\n closeOnBackdropClick,\n resolve,\n ForegroundComponent,\n BackgroundComponent,\n });\n this.type = type;\n this.subtype = subtype;\n this.content = content;\n this.footer = footer;\n }\n onClose() {\n this.resolve(null);\n }\n onConfirm() {\n this.resolve(null);\n }\n}\n","import type { ComponentType, ReactNode } from 'react';\n\nimport type {\n ConfirmContentProps,\n ConfirmFooterRender,\n ConfirmModal,\n FooterOptions,\n ManagedEntity,\n} from '@/promise-modal/types';\n\nimport { BaseNode } from './AbstractBaseNode';\n\ntype ConfirmNodeProps<B> = ConfirmModal<B> & ManagedEntity;\n\nexport class ConfirmNode<B> extends BaseNode<boolean, B> {\n readonly type: 'confirm';\n readonly subtype?: 'info' | 'success' | 'warning' | 'error';\n readonly content?: ReactNode | ComponentType<ConfirmContentProps>;\n readonly footer?: ConfirmFooterRender | FooterOptions | false;\n\n constructor({\n id,\n initiator,\n type,\n subtype,\n title,\n subtitle,\n content,\n footer,\n background,\n manualDestroy,\n closeOnBackdropClick,\n resolve,\n ForegroundComponent,\n BackgroundComponent,\n }: ConfirmNodeProps<B>) {\n super({\n id,\n initiator,\n title,\n subtitle,\n background,\n manualDestroy,\n closeOnBackdropClick,\n resolve,\n ForegroundComponent,\n BackgroundComponent,\n });\n this.type = type;\n this.subtype = subtype;\n this.content = content;\n this.footer = footer;\n }\n onClose() {\n this.resolve(false);\n }\n onConfirm() {\n this.resolve(true);\n }\n}\n","import type { ComponentType, ReactNode } from 'react';\n\nimport type {\n FooterOptions,\n ManagedEntity,\n PromptContentProps,\n PromptFooterRender,\n PromptInputProps,\n PromptModal,\n} from '@/promise-modal/types';\n\nimport { BaseNode } from './AbstractBaseNode';\n\ntype PromptNodeProps<T, B> = PromptModal<T, B> & ManagedEntity;\n\nexport class PromptNode<T, B> extends BaseNode<T, B> {\n readonly type: 'prompt';\n readonly content?: ReactNode | ComponentType<PromptContentProps>;\n readonly defaultValue: T | undefined;\n readonly Input: (props: PromptInputProps<T>) => ReactNode;\n readonly disabled?: (value: T) => boolean;\n readonly returnOnCancel?: boolean;\n readonly footer?: PromptFooterRender<T> | FooterOptions | false;\n #value: T | undefined;\n\n constructor({\n id,\n initiator,\n type,\n title,\n subtitle,\n content,\n defaultValue,\n Input,\n disabled,\n returnOnCancel,\n footer,\n background,\n manualDestroy,\n closeOnBackdropClick,\n resolve,\n ForegroundComponent,\n BackgroundComponent,\n }: PromptNodeProps<T, B>) {\n super({\n id,\n initiator,\n title,\n subtitle,\n background,\n manualDestroy,\n closeOnBackdropClick,\n resolve,\n ForegroundComponent,\n BackgroundComponent,\n });\n this.type = type;\n this.content = content;\n this.Input = Input;\n this.defaultValue = defaultValue;\n this.#value = defaultValue;\n this.disabled = disabled;\n this.returnOnCancel = returnOnCancel;\n this.footer = footer;\n }\n\n onChange(value: T) {\n this.#value = value;\n }\n onConfirm() {\n this.resolve(this.#value ?? null);\n }\n onClose() {\n if (this.returnOnCancel) this.resolve(this.#value ?? null);\n else this.resolve(null);\n }\n}\n","import type { ManagedModal } from '@/promise-modal/types';\n\nimport { AlertNode, ConfirmNode, PromptNode } from './ModalNode';\n\nexport const nodeFactory = <T, B>(modal: ManagedModal<T, B>) => {\n switch (modal.type) {\n case 'alert':\n return new AlertNode<B>(modal);\n case 'confirm':\n return new ConfirmNode<B>(modal);\n case 'prompt':\n return new PromptNode<T, B>(modal);\n }\n // @ts-expect-error: This state is unreachable by design and should NEVER occur.\n throw new Error(`Unknown modal: ${modal.type}`, { modal });\n};\n","const DURATION_REGEX = /^\\s*(\\d+)\\s*(ms|s|m|h)\\s*$/;\n\nexport const getMillisecondsFromDuration = (input: string) => {\n const [, durationString, unit] = input.match(DURATION_REGEX) || [];\n if (!durationString || !unit) return 0;\n const duration = parseInt(durationString);\n if (unit === 'ms') return duration;\n if (unit === 's') return duration * 1000;\n if (unit === 'm') return duration * 60 * 1000;\n if (unit === 'h') return duration * 60 * 60 * 1000;\n else return 0;\n};\n","import { createContext } from 'react';\n\nimport { undefinedFunction } from '@winglet/common-utils';\n\nimport type { Fn } from '@aileron/types';\n\nimport type { ModalNode } from '@/promise-modal/core';\nimport type { ModalActions, ModalHandlersWithId } from '@/promise-modal/types';\n\nexport interface ModalDataContextProps extends ModalHandlersWithId {\n modalIds: ModalNode['id'][];\n getModal: Fn<[id: ModalNode['id']], ModalActions>;\n getModalNode: Fn<[id: ModalNode['id']], ModalNode | undefined>;\n setUpdater: Fn<[updater: Fn]>;\n}\n\nexport const ModalDataContext = createContext<ModalDataContextProps>({\n modalIds: [],\n getModalNode: undefinedFunction,\n onChange: undefinedFunction,\n onConfirm: undefinedFunction,\n onClose: undefinedFunction,\n onDestroy: undefinedFunction,\n setUpdater: undefinedFunction,\n getModal: () => ({\n modal: undefined,\n onConfirm: undefinedFunction,\n onClose: undefinedFunction,\n onChange: undefinedFunction,\n onDestroy: undefinedFunction,\n }),\n});\n","import {\n type PropsWithChildren,\n memo,\n useCallback,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { useOnMountLayout, useReference } from '@winglet/react-utils';\n\nimport type { Fn } from '@aileron/types';\n\nimport { ModalManager } from '@/promise-modal/app/ModalManager';\nimport { type ModalNode, nodeFactory } from '@/promise-modal/core';\nimport { getMillisecondsFromDuration } from '@/promise-modal/helpers/getMillisecondsFromDuration';\nimport { useModalOptions } from '@/promise-modal/providers';\nimport type { Modal } from '@/promise-modal/types';\n\nimport { ModalDataContext } from './ModalDataContext';\n\ninterface ModalDataContextProviderProps {\n pathname: string;\n}\n\nexport const ModalDataContextProvider = memo(\n ({\n pathname,\n children,\n }: PropsWithChildren<ModalDataContextProviderProps>) => {\n const modalDictionary = useRef<Map<ModalNode['id'], ModalNode>>(new Map());\n\n const [modalIds, setModalIds] = useState<ModalNode['id'][]>([]);\n const modalIdsRef = useReference(modalIds);\n\n const initiator = useRef(pathname);\n const modalIdSequence = useRef(0);\n\n const options = useModalOptions();\n\n const duration = useMemo(\n () => getMillisecondsFromDuration(options.duration),\n [options],\n );\n\n useOnMountLayout(() => {\n const { manualDestroy, closeOnBackdropClick } = options;\n\n for (const data of ModalManager.prerender) {\n const modal = nodeFactory({\n ...data,\n id: modalIdSequence.current++,\n initiator: initiator.current,\n manualDestroy:\n data.manualDestroy !== undefined\n ? data.manualDestroy\n : manualDestroy,\n closeOnBackdropClick:\n data.closeOnBackdropClick !== undefined\n ? data.closeOnBackdropClick\n : closeOnBackdropClick,\n });\n modalDictionary.current.set(modal.id, modal);\n setModalIds((ids) => [...ids, modal.id]);\n }\n\n ModalManager.setupOpen((data: Modal) => {\n const modal = nodeFactory({\n ...data,\n id: modalIdSequence.current++,\n initiator: initiator.current,\n manualDestroy:\n data.manualDestroy !== undefined\n ? data.manualDestroy\n : manualDestroy,\n closeOnBackdropClick:\n data.closeOnBackdropClick !== undefined\n ? data.closeOnBackdropClick\n : closeOnBackdropClick,\n });\n modalDictionary.current.set(modal.id, modal);\n setModalIds((ids) => {\n const aliveIds = ids.filter((id) => {\n const destroyed = !modalDictionary.current.get(id)?.alive;\n if (destroyed) modalDictionary.current.delete(id);\n return !destroyed;\n });\n return [...aliveIds, modal.id];\n });\n });\n ModalManager.clearPrerender();\n });\n\n useLayoutEffect(() => {\n for (const id of modalIdsRef.current) {\n const modal = modalDictionary.current.get(id);\n if (!modal?.alive) continue;\n if (modal.initiator === pathname) modal.onShow();\n else modal.onHide();\n }\n initiator.current = pathname;\n }, [modalIdsRef, pathname]);\n\n const getModalNode = useCallback((modalId: ModalNode['id']) => {\n return modalDictionary.current.get(modalId);\n }, []);\n\n const onDestroy = useCallback((modalId: ModalNode['id']) => {\n const modal = modalDictionary.current.get(modalId);\n if (!modal) return;\n modal.onDestroy();\n updaterRef.current?.();\n }, []);\n\n const updaterRef = useRef<Fn>();\n const hideModal = useCallback(\n (modalId: ModalNode['id']) => {\n const modal = modalDictionary.current.get(modalId);\n if (!modal) return;\n modal.onHide();\n updaterRef.current?.();\n if (!modal.manualDestroy)\n setTimeout(() => {\n modal.onDestroy();\n }, duration);\n },\n [duration],\n );\n\n const onChange = useCallback((modalId: ModalNode['id'], value: any) => {\n const modal = modalDictionary.current.get(modalId);\n if (!modal) return;\n if (modal.type === 'prompt') modal.onChange(value);\n }, []);\n\n const onConfirm = useCallback(\n (modalId: ModalNode['id']) => {\n const modal = modalDictionary.current.get(modalId);\n if (!modal) return;\n modal.onConfirm();\n hideModal(modalId);\n },\n [hideModal],\n );\n\n const onClose = useCallback(\n (modalId: ModalNode['id']) => {\n const modal = modalDictionary.current.get(modalId);\n if (!modal) return;\n modal.onClose();\n hideModal(modalId);\n },\n [hideModal],\n );\n\n const getModal = useCallback(\n (modalId: ModalNode['id']) => ({\n modal: getModalNode(modalId),\n onConfirm: () => onConfirm(modalId),\n onClose: () => onClose(modalId),\n onChange: (value: any) => onChange(modalId, value),\n onDestroy: () => onDestroy(modalId),\n }),\n [getModalNode, onConfirm, onClose, onChange, onDestroy],\n );\n\n const value = useMemo(() => {\n return {\n modalIds,\n getModalNode,\n onChange,\n onConfirm,\n onClose,\n onDestroy,\n getModal,\n setUpdater: (updater: Fn) => {\n updaterRef.current = updater;\n },\n };\n }, [\n modalIds,\n getModal,\n getModalNode,\n onChange,\n onConfirm,\n onClose,\n onDestroy,\n ]);\n\n return (\n <ModalDataContext.Provider value={value}>\n {children}\n </ModalDataContext.Provider>\n );\n },\n);\n","import { useContext, useMemo } from 'react';\n\nimport type { ManagedModal } from '@/promise-modal/types';\n\nimport { ModalDataContext } from './ModalDataContext';\n\nexport const useModalDataContext = () => useContext(ModalDataContext);\n\nexport const useModal = (id: ManagedModal['id']) => {\n const { getModal } = useModalDataContext();\n return useMemo(() => getModal(id), [id, getModal]);\n};\n","import { css } from '@emotion/css';\n\nexport const anchor = css`\n display: flex;\n align-items: center;\n justify-content: center;\n position: fixed;\n inset: 0;\n pointer-events: none;\n z-index: 1000;\n transition: background-color ease-in-out;\n`;\n","import { memo, useEffect } from 'react';\n\nimport { useTick, withErrorBoundary } from '@winglet/react-utils';\n\nimport { Presenter } from '@/promise-modal/components/Presenter';\nimport { useActiveModalCount } from '@/promise-modal/hooks/useActiveModalCount';\nimport { useModalContext } from '@/promise-modal/providers';\nimport { useModalDataContext } from '@/promise-modal/providers/ModalDataContext';\n\nimport { anchor } from './classNames.emotion';\n\nconst AnchorInner = () => {\n const [key, update] = useTick();\n\n const { modalIds, setUpdater } = useModalDataContext();\n\n useEffect(() => {\n setUpdater(update);\n }, [setUpdater, update]);\n\n const { options } = useModalContext();\n\n const dimmed = useActiveModalCount(key);\n\n return (\n <div\n className={anchor}\n style={{\n transitionDuration: options.duration,\n backgroundColor: dimmed ? options.backdrop : 'transparent',\n }}\n >\n {modalIds.map((id) => {\n return <Presenter key={id} modalId={id} />;\n })}\n </div>\n );\n};\n\nexport const Anchor = memo(withErrorBoundary(AnchorInner));\n","import { css } from '@emotion/css';\n\nexport const fallback = css`\n margin: unset;\n`;\n\nexport const frame = css`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n background-color: white;\n padding: 20px 80px;\n gap: 10px;\n border: 1px solid black;\n`;\n","import type { PropsWithChildren } from 'react';\n\nimport { fallback } from './classNames.emotion';\n\nexport const FallbackTitle = ({ children }: PropsWithChildren) => {\n return <h2 className={fallback}>{children}</h2>;\n};\n","import type { PropsWithChildren } from 'react';\n\nimport { fallback } from './classNames.emotion';\n\nexport const FallbackSubtitle = ({ children }: PropsWithChildren) => {\n return <h3 className={fallback}>{children}</h3>;\n};\n","import type { PropsWithChildren } from 'react';\n\nimport { fallback } from './classNames.emotion';\n\nexport const FallbackContent = ({ children }: PropsWithChildren) => {\n return <div className={fallback}>{children}</div>;\n};\n","import type { FooterComponentProps } from '@/promise-modal/types';\n\nexport const FallbackFooter = ({\n confirmLabel,\n hideConfirm = false,\n cancelLabel,\n hideCancel = false,\n disabled,\n onConfirm,\n onCancel,\n}: FooterComponentProps) => {\n return (\n <div>\n {!hideConfirm && (\n <button onClick={onConfirm} disabled={disabled}>\n {confirmLabel || '확인'}\n </button>\n )}\n\n {!hideCancel && typeof onCancel === 'function' && (\n <button onClick={onCancel}>{cancelLabel || '취소'}</button>\n )}\n </div>\n );\n};\n","import {\n type ForwardedRef,\n type PropsWithChildren,\n forwardRef,\n useMemo,\n} from 'react';\n\nimport { useActiveModalCount } from '@/promise-modal/hooks/useActiveModalCount';\nimport type { ModalFrameProps } from '@/promise-modal/types';\n\nimport { frame } from './classNames.emotion';\n\nconst MAX_MODAL_COUNT = 5;\nconst MAX_MODAL_LEVEL = 3;\n\nexport const FallbackForegroundFrame = forwardRef(\n (\n { id, onChangeOrder, children }: PropsWithChildren<ModalFrameProps>,\n ref: ForwardedRef<HTMLDivElement>,\n ) => {\n const activeCount = useActiveModalCount();\n const [level, offset] = useMemo(() => {\n const stacked = activeCount > 1;\n const level = stacked\n ? (Math.floor(id / MAX_MODAL_COUNT) % MAX_MODAL_LEVEL) * 100\n : 0;\n const offset = stacked ? (id % MAX_MODAL_COUNT) * 35 : 0;\n return [level, offset];\n }, [activeCount, id]);\n\n return (\n <div\n ref={ref}\n className={frame}\n onClick={onChangeOrder}\n style={{\n marginBottom: `calc(25vh + ${level}px)`,\n marginLeft: `${level}px`,\n transform: `translate(${offset}px, ${offset}px)`,\n }}\n >\n {children}\n </div>\n );\n },\n);\n","import { useLayoutEffect, useState } from 'react';\n\nexport const usePathname = () => {\n const [pathname, setPathname] = useState(window.location.pathname);\n\n useLayoutEffect(() => {\n let requestId: number;\n\n const checkPathname = () => {\n if (requestId) cancelAnimationFrame(requestId);\n if (pathname !== window.location.pathname) {\n setPathname(window.location.pathname);\n } else {\n requestId = requestAnimationFrame(checkPathname);\n }\n };\n\n requestId = requestAnimationFrame(checkPathname);\n\n return () => {\n if (requestId) cancelAnimationFrame(requestId);\n };\n }, [pathname]);\n\n return { pathname };\n};\n","import { type ComponentType, createContext } from 'react';\n\nimport type { Color, Duration } from '@aileron/types';\n\nimport {\n DEFAULT_ANIMATION_DURATION,\n DEFAULT_BACKDROP_COLOR,\n} from '@/promise-modal/app/constant';\nimport {\n FallbackContent,\n FallbackFooter,\n FallbackForegroundFrame,\n FallbackSubtitle,\n FallbackTitle,\n} from '@/promise-modal/components/FallbackComponents';\nimport type {\n BackgroundComponent,\n FooterComponentProps,\n ForegroundComponent,\n WrapperComponentProps,\n} from '@/promise-modal/types';\n\nexport interface ModalContextProps {\n ForegroundComponent: ForegroundComponent;\n BackgroundComponent?: BackgroundComponent;\n TitleComponent: ComponentType<WrapperComponentProps>;\n SubtitleComponent: ComponentType<WrapperComponentProps>;\n ContentComponent: ComponentType<WrapperComponentProps>;\n FooterComponent: ComponentType<FooterComponentProps>;\n options: {\n duration: Duration;\n backdrop: Color;\n manualDestroy: boolean;\n closeOnBackdropClick: boolean;\n };\n}\n\nexport const ModalContext = createContext<ModalContextProps>({\n ForegroundComponent: FallbackForegroundFrame,\n TitleComponent: FallbackTitle,\n SubtitleComponent: FallbackSubtitle,\n ContentComponent: FallbackContent,\n FooterComponent: FallbackFooter,\n options: {\n duration: DEFAULT_ANIMATION_DURATION,\n backdrop: DEFAULT_BACKDROP_COLOR,\n manualDestroy: false,\n closeOnBackdropClick: true,\n },\n});\n","import {\n type ComponentType,\n type PropsWithChildren,\n memo,\n useMemo,\n useRef,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\n\nimport { useOnMount, useTick } from '@winglet/react-utils';\n\nimport type { Color, Dictionary, Duration } from '@aileron/types';\n\nimport { ModalManager } from '@/promise-modal/app/ModalManager';\nimport {\n DEFAULT_ANIMATION_DURATION,\n DEFAULT_BACKDROP_COLOR,\n} from '@/promise-modal/app/constant';\nimport { Anchor } from '@/promise-modal/components/Anchor';\nimport {\n FallbackContent,\n FallbackFooter,\n FallbackForegroundFrame,\n FallbackSubtitle,\n FallbackTitle,\n} from '@/promise-modal/components/FallbackComponents';\nimport { usePathname as useDefaultPathname } from '@/promise-modal/hooks/useDefaultPathname';\nimport type {\n FooterComponentProps,\n ModalFrameProps,\n WrapperComponentProps,\n} from '@/promise-modal/types';\n\nimport { ModalDataContextProvider } from '../ModalDataContext';\nimport { UserDefinedContextProvider } from '../UserDefinedContext';\nimport { ModalContext } from './ModalContext';\n\ninterface ModalContextProviderProps {\n BackgroundComponent?: ComponentType<ModalFrameProps>;\n ForegroundComponent?: ComponentType<ModalFrameProps>;\n TitleComponent?: ComponentType<WrapperComponentProps>;\n SubtitleComponent?: ComponentType<WrapperComponentProps>;\n ContentComponent?: ComponentType<WrapperComponentProps>;\n FooterComponent?: ComponentType<FooterComponentProps>;\n options?: {\n /** Modal transition time(ms, s) */\n duration?: Duration;\n /** Modal backdrop color */\n backdrop?: Color;\n /** Whether to destroy the modal manually */\n manualDestroy?: boolean;\n /** Whether to close the modal when the backdrop is clicked */\n closeOnBackdropClick?: boolean;\n };\n context?: Dictionary;\n usePathname?: () => { pathname: string };\n}\n\nexport const ModalContextProvider = memo(\n ({\n ForegroundComponent,\n BackgroundComponent,\n TitleComponent,\n SubtitleComponent,\n ContentComponent,\n FooterComponent,\n options,\n context,\n usePathname,\n children,\n }: PropsWithChildren<ModalContextProviderProps>) => {\n const { pathname } = (usePathname || useDefaultPathname)();\n const [, update] = useTick();\n const portalRef = useRef<HTMLElement | null>(null);\n\n useOnMount(() => {\n portalRef.current = ModalManager.anchor('div');\n update();\n return () => {\n if (portalRef.current) {\n portalRef.current.remove();\n }\n };\n });\n\n const value = useMemo(\n () => ({\n BackgroundComponent,\n ForegroundComponent: ForegroundComponent || FallbackForegroundFrame,\n TitleComponent: TitleComponent || FallbackTitle,\n SubtitleComponent: SubtitleComponent || FallbackSubtitle,\n ContentComponent: memo(ContentComponent || FallbackContent),\n FooterComponent: memo(FooterComponent || FallbackFooter),\n options: {\n duration: DEFAULT_ANIMATION_DURATION,\n backdrop: DEFAULT_BACKDROP_COLOR,\n closeOnBackdropClick: true,\n manualDestroy: false,\n ...options,\n } satisfies ModalContextProviderProps['options'],\n }),\n [\n ForegroundComponent,\n BackgroundComponent,\n ContentComponent,\n FooterComponent,\n SubtitleComponent,\n TitleComponent,\n options,\n ],\n );\n\n return (\n <ModalContext.Provider value={value}>\n {children}\n {portalRef.current &&\n createPortal(\n <UserDefinedContextProvider context={context}>\n <ModalDataContextProvider pathname={pathname}>\n <Anchor />\n </ModalDataContextProvider>\n </UserDefinedContextProvider>,\n portalRef.current,\n )}\n </ModalContext.Provider>\n );\n },\n);\n","import { useContext } from 'react';\n\nimport { getMillisecondsFromDuration } from '@/promise-modal/helpers/getMillisecondsFromDuration';\n\nimport { ModalContext } from './ModalContext';\n\nexport const useModalContext = () => useContext(ModalContext);\n\nexport const useModalOptions = () => {\n const { options } = useContext(ModalContext);\n return options;\n};\n\nexport const useModalDuration = () => {\n const { duration } = useModalOptions();\n return { duration, milliseconds: getMillisecondsFromDuration(duration) };\n};\n\nexport const useModalBackdrop = () => {\n const { backdrop } = useModalOptions();\n return backdrop;\n};\n","import type { ComponentType, ReactNode } from 'react';\n\nimport { ModalManager } from '@/promise-modal/app/ModalManager';\nimport type {\n AlertContentProps,\n AlertFooterRender,\n BackgroundComponent,\n FooterOptions,\n ForegroundComponent,\n ModalBackground,\n} from '@/promise-modal/types';\n\ninterface AlertProps<B> {\n subtype?: 'info' | 'success' | 'warning' | 'error';\n title?: ReactNode;\n subtitle?: ReactNode;\n content?: ReactNode | ComponentType<AlertContentProps>;\n background?: ModalBackground<B>;\n footer?:\n | AlertFooterRender\n | Pick<FooterOptions, 'confirm' | 'hideConfirm'>\n | false;\n manualDestroy?: boolean;\n closeOnBackdropClick?: boolean;\n ForegroundComponent?: ForegroundComponent;\n BackgroundComponent?: BackgroundComponent;\n}\n\nexport const alert = <B = any>({\n subtype,\n title,\n subtitle,\n content,\n background,\n footer,\n manualDestroy,\n closeOnBackdropClick,\n ForegroundComponent,\n BackgroundComponent,\n}: AlertProps<B>) => {\n return new Promise<void>((resolve, reject) => {\n try {\n ModalManager.open({\n type: 'alert',\n subtype,\n resolve: () => resolve(),\n title,\n subtitle,\n content,\n background,\n footer,\n manualDestroy,\n closeOnBackdropClick,\n ForegroundComponent,\n BackgroundComponent,\n });\n } catch (error) {\n reject(error);\n }\n });\n};\n","import type { ComponentType, ReactNode } from 'react';\n\nimport { ModalManager } from '@/promise-modal/app/ModalManager';\nimport type {\n BackgroundComponent,\n ConfirmContentProps,\n ConfirmFooterRender,\n FooterOptions,\n ForegroundComponent,\n ModalBackground,\n} from '@/promise-modal/types';\n\ninterface ConfirmProps<B> {\n subtype?: 'info' | 'success' | 'warning' | 'error';\n title?: ReactNode;\n subtitle?: ReactNode;\n content?: ReactNode | ComponentType<ConfirmContentProps>;\n background?: ModalBackground<B>;\n footer?: ConfirmFooterRender | FooterOptions | false;\n closeOnBackdropClick?: boolean;\n manualDestroy?: boolean;\n ForegroundComponent?: ForegroundComponent;\n BackgroundComponent?: BackgroundComponent;\n}\n\nexport const confirm = <B = any>({\n subtype,\n title,\n subtitle,\n content,\n background,\n footer,\n manualDestroy,\n closeOnBackdropClick,\n ForegroundComponent,\n BackgroundComponent,\n}: ConfirmProps<B>) => {\n return new Promise<boolean>((resolve, reject) => {\n try {\n ModalManager.open({\n type: 'confirm',\n subtype,\n resolve: (result) => resolve(result ?? false),\n title,\n subtitle,\n content,\n background,\n footer,\n manualDestroy,\n closeOnBackdropClick,\n ForegroundComponent,\n BackgroundComponent,\n });\n } catch (error) {\n reject(error);\n }\n });\n};\n","import type { ComponentType, ReactNode } from 'react';\n\nimport type {\n BackgroundComponent,\n FooterOptions,\n ForegroundComponent,\n ModalBackground,\n PromptContentProps,\n PromptFooterRender,\n PromptInputProps,\n} from '@/promise-modal/types';\n\nimport { ModalManager } from '../../app/ModalManager';\n\ninterface PromptProps<T, B = any> {\n title?: ReactNode;\n subtitle?: ReactNode;\n content?: ReactNode | ComponentType<PromptContentProps>;\n Input: (props: PromptInputProps<T>) => ReactNode;\n defaultValue?: T;\n disabled?: (value: T) => boolean;\n returnOnCancel?: boolean;\n background?: ModalBackground<B>;\n footer?: PromptFooterRender<T> | FooterOptions | false;\n manualDestroy?: boolean;\n closeOnBackdropClick?: boolean;\n ForegroundComponent?: ForegroundComponent;\n BackgroundComponent?: BackgroundComponent;\n}\n\nexport const prompt = <T, B = any>({\n defaultValue,\n title,\n subtitle,\n content,\n Input,\n disabled,\n returnOnCancel,\n background,\n footer,\n manualDestroy,\n closeOnBackdropClick,\n ForegroundComponent,\n BackgroundComponent,\n}: PromptProps<T, B>) => {\n return new Promise<T>((resolve, reject) => {\n try {\n ModalManager.open({\n type: 'prompt',\n resolve: (result) => resolve(result as T),\n title,\n subtitle,\n content,\n Input,\n defaultValue,\n disabled,\n returnOnCancel,\n background,\n footer,\n manualDestroy,\n closeOnBackdropClick,\n ForegroundComponent,\n BackgroundComponent,\n });\n } catch (error) {\n reject(error);\n }\n });\n};\n","import { useEffect, useRef } from 'react';\n\nimport { isString } from '@winglet/common-utils';\n\nimport type { Duration } from '@aileron/types';\n\nimport type { ModalNode } from '@/promise-modal/core';\nimport { getMillisecondsFromDuration } from '@/promise-modal/helpers/getMillisecondsFromDuration';\n\nimport { useModal } from '../providers';\nimport { useSubscribeModal } from './useSubscribeModal';\n\nexport const useDestroyAfter = (\n modalId: ModalNode['id'],\n duration: Duration | number,\n) => {\n const { modal, onDestroy } = useModal(modalId);\n const tick = useSubscribeModal(modal);\n\n const reference = useRef({\n modal,\n onDestroy,\n milliseconds: isString(duration)\n ? getMillisecondsFromDuration(duration)\n : duration,\n });\n\n useEffect(() => {\n const { modal, onDestroy, milliseconds } = reference.current;\n if (!modal || modal.visible || !modal.alive) return;\n const timer = setTimeout(() => {\n onDestroy();\n }, milliseconds);\n return () => {\n if (timer) clearTimeout(timer);\n };\n }, [tick]);\n};\n"],"names":["prerenderListRef","current","openModalRef","modal","push","anchorRef","ModalManager","prerender","clearPrerender","open","setupOpen","anchor","name","prefix","document","getElementById","id","node","createElement","setAttribute","getRandomString","body","appendChild","DEFAULT_ANIMATION_DURATION","DEFAULT_BACKDROP_COLOR","UserDefinedContext","createContext","context","EMPTY_OBJECT","UserDefinedContextProvider","children","contextValue","useMemo","_jsx","jsx","Provider","value","useUserDefinedContext","useContext","background","css","process","env","NODE_ENV","styles","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","active","visible","BackgroundFrame","modalId","onChangeOrder","BackgroundComponent","useModalContext","userDefinedContext","onClose","onChange","onConfirm","onDestroy","useModal","handleClose","useCallback","event","closeOnBackdropClick","stopPropagation","Background","className","cx","visible$1","manualDestroy","alive","active$1","onClick","type","initiator","foreground","AlertInner","memo","handlers","title","subtitle","content","footer","handleConfirm","useHandle","TitleComponent","SubtitleComponent","ContentComponent","FooterComponent","_jsxs","Fragment","isString","renderComponent","confirmLabel","confirm","hideConfirm","ConfirmInner","onCancel","cancelLabel","cancel","hideCancel","PromptInner","Input","defaultValue","disabled","checkDisabled","withErrorBoundary","setValue","useState","handleChange","inputValue","input","isFunction","setTimeout","ForegroundFrame","ForegroundComponent","Foreground","useSubscribeModal","tick","update","useTick","useOnMount","subscribe","presenter","zIndex","Presenter","ref","useRef","handleChangeOrder","style","useActiveModalCount","modalIds","getModalNode","useModalDataContext","count","BaseNode","__classPrivateFieldGet","this","_BaseNode_alive","_BaseNode_visible","constructor","resolve","Object","defineProperty","set","_BaseNode_resolve","_BaseNode_listeners","__classPrivateFieldSet","listener","filter","l","publish","result","call","needPublish","onShow","onHide","AlertNode","subtype","super","ConfirmNode","PromptNode","returnOnCancel","_PromptNode_value","nodeFactory","Error","DURATION_REGEX","getMillisecondsFromDuration","durationString","unit","match","duration","parseInt","ModalDataContext","undefinedFunction","setUpdater","getModal","undefined","ModalDataContextProvider","pathname","modalDictionary","Map","setModalIds","modalIdsRef","useReference","modalIdSequence","options","useModalOptions","useOnMountLayout","data","ids","destroyed","get","delete","useLayoutEffect","updaterRef","hideModal","updater","Anchor","key","useEffect","dimmed","transitionDuration","backgroundColor","backdrop","map","fallback","frame","FallbackTitle","FallbackSubtitle","FallbackContent","FallbackFooter","FallbackForegroundFrame","forwardRef","activeCount","level","offset","stacked","Math","floor","marginBottom","marginLeft","transform","usePathname","setPathname","window","location","requestId","checkPathname","cancelAnimationFrame","requestAnimationFrame","ModalContext","ModalContextProvider","useDefaultPathname","portalRef","remove","jsxs","createPortal","Promise","reject","error","reference","milliseconds","timer","clearTimeout"],"m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MAAO,CAAEhB,WAAUuE,aAAc3E,EAA4BI,GAAW"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ export { ModalContextProvider as ModalProvider, useModalOptions, useModalDuratio
|
|
|
2
2
|
export { useSubscribeModal } from './hooks/useSubscribeModal';
|
|
3
3
|
export { useDestroyAfter } from './hooks/useDestroyAfter';
|
|
4
4
|
export { alert, confirm, prompt } from './core';
|
|
5
|
-
export type { ModalFrameProps, FooterComponentProps, ModalBackground, PromptInputProps, AlertContentProps, ConfirmContentProps, PromptContentProps, } from './types';
|
|
5
|
+
export type { ModalFrameProps, FooterComponentProps, ModalBackground, PromptInputProps, AlertContentProps, ConfirmContentProps, PromptContentProps, WrapperComponentProps, } from './types';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|