├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ └── config.yml ├── actions │ └── setup │ │ └── action.yml └── workflows │ └── ci.yml ├── .gitignore ├── .nvmrc ├── .watchmanconfig ├── .yarn ├── plugins │ └── @yarnpkg │ │ ├── plugin-interactive-tools.cjs │ │ └── plugin-workspace-tools.cjs └── releases │ └── yarn-3.6.1.cjs ├── .yarnrc.yml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── babel.config.js ├── demo ├── basics.gif ├── confetti.gif ├── customizations.gif ├── keyboard.gif └── updating.gif ├── eslint.config.mjs ├── example ├── app.json ├── assets │ ├── adaptive-icon.png │ ├── favicon.png │ ├── icon.png │ └── splash-icon.png ├── babel.config.js ├── index.js ├── metro.config.js ├── package.json ├── src │ ├── App.tsx │ ├── components │ │ ├── Button │ │ │ └── index.tsx │ │ ├── Section │ │ │ └── index.tsx │ │ └── icons │ │ │ └── Danger.tsx │ ├── containers │ │ ├── Basics.tsx │ │ ├── Confetti.tsx │ │ ├── Customizations.tsx │ │ ├── Keyboard.tsx │ │ └── Updating.tsx │ └── types │ │ └── react-native-alert-queue.d.ts └── tsconfig.json ├── lefthook.yml ├── package.json ├── src ├── components │ ├── Alert │ │ ├── controller.ts │ │ ├── hooks │ │ │ └── useContainerDimensions.ts │ │ ├── index.tsx │ │ ├── styles.ts │ │ └── types.ts │ ├── Backdrop │ │ ├── index.tsx │ │ └── types.ts │ ├── Button │ │ └── index.tsx │ ├── Confetti │ │ ├── Piece.tsx │ │ ├── constants.ts │ │ ├── hooks │ │ │ └── useWaitForAnimations.ts │ │ ├── index.tsx │ │ └── types.ts │ └── icons │ │ ├── Close.tsx │ │ ├── Info.tsx │ │ └── Success.tsx ├── containers │ ├── AlertContainer │ │ ├── alert.api.ts │ │ ├── controller.platform.native.ts │ │ ├── controller.platform.ts │ │ ├── controller.ts │ │ ├── index.tsx │ │ ├── styles.ts │ │ ├── types.ts │ │ └── utils.ts │ └── ConfettiContainer │ │ └── index.tsx ├── hooks │ └── useAnimation.ts ├── index.tsx └── utils │ └── EventEmitter.ts ├── tsconfig.build.json ├── tsconfig.json └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | 9 | indent_style = space 10 | indent_size = 2 11 | 12 | end_of_line = lf 13 | charset = utf-8 14 | trim_trailing_whitespace = true 15 | insert_final_newline = true 16 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | # specific for windows script files 3 | *.bat text eol=crlf -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [xxsnakerxx] 4 | buy_me_a_coffee: xxsnakerxx 5 | thanks_dev: xxsnakerxx 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: 🐛 Bug report 2 | description: Report a reproducible bug or regression in this library. 3 | labels: [bug] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | # Bug report 9 | 10 | 👋 Hi! 11 | 12 | **Please fill the following carefully before opening a new issue ❗** 13 | *(Your issue may be closed if it doesn't provide the required pieces of information)* 14 | - type: checkboxes 15 | attributes: 16 | label: Before submitting a new issue 17 | description: Please perform simple checks first. 18 | options: 19 | - label: I tested using the latest version of the library, as the bug might be already fixed. 20 | required: true 21 | - label: I tested using a [supported version](https://github.com/reactwg/react-native-releases/blob/main/docs/support.md) of react native. 22 | required: true 23 | - label: I checked for possible duplicate issues, with possible answers. 24 | required: true 25 | - type: textarea 26 | id: summary 27 | attributes: 28 | label: Bug summary 29 | description: | 30 | Provide a clear and concise description of what the bug is. 31 | If needed, you can also provide other samples: error messages / stack traces, screenshots, gifs, etc. 32 | validations: 33 | required: true 34 | - type: input 35 | id: library-version 36 | attributes: 37 | label: Library version 38 | description: What version of the library are you using? 39 | placeholder: 'x.x.x' 40 | validations: 41 | required: true 42 | - type: textarea 43 | id: react-native-info 44 | attributes: 45 | label: Environment info 46 | description: Run `react-native info` in your terminal and paste the results here. 47 | render: shell 48 | validations: 49 | required: true 50 | - type: textarea 51 | id: steps-to-reproduce 52 | attributes: 53 | label: Steps to reproduce 54 | description: | 55 | You must provide a clear list of steps and code to reproduce the problem. 56 | value: | 57 | 1. … 58 | 2. … 59 | validations: 60 | required: true 61 | - type: input 62 | id: reproducible-example 63 | attributes: 64 | label: Reproducible example repository 65 | description: Please provide a link to a repository on GitHub with a reproducible example. 66 | validations: 67 | required: true 68 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Feature Request 💡 4 | url: https://github.com/xxsnakerxx/react-native-alert-queue/discussions/new?category=ideas 5 | about: If you have a feature request, please create a new discussion on GitHub. 6 | - name: Discussions on GitHub 💬 7 | url: https://github.com/xxsnakerxx/react-native-alert-queue/discussions 8 | about: If this library works as promised but you need help, please ask questions there. 9 | -------------------------------------------------------------------------------- /.github/actions/setup/action.yml: -------------------------------------------------------------------------------- 1 | name: Setup 2 | description: Setup Node.js and install dependencies 3 | 4 | runs: 5 | using: composite 6 | steps: 7 | - name: Setup Node.js 8 | uses: actions/setup-node@v4 9 | with: 10 | node-version-file: .nvmrc 11 | 12 | - name: Restore dependencies 13 | id: yarn-cache 14 | uses: actions/cache/restore@v4 15 | with: 16 | path: | 17 | **/node_modules 18 | .yarn/install-state.gz 19 | key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }} 20 | restore-keys: | 21 | ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} 22 | ${{ runner.os }}-yarn- 23 | 24 | - name: Install dependencies 25 | if: steps.yarn-cache.outputs.cache-hit != 'true' 26 | run: yarn install --immutable 27 | shell: bash 28 | 29 | - name: Cache dependencies 30 | if: steps.yarn-cache.outputs.cache-hit != 'true' 31 | uses: actions/cache/save@v4 32 | with: 33 | path: | 34 | **/node_modules 35 | .yarn/install-state.gz 36 | key: ${{ steps.yarn-cache.outputs.cache-primary-key }} 37 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | branches: 8 | - main 9 | merge_group: 10 | types: 11 | - checks_requested 12 | 13 | jobs: 14 | lint: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v4 19 | 20 | - name: Setup 21 | uses: ./.github/actions/setup 22 | 23 | - name: Lint files 24 | run: yarn lint 25 | 26 | - name: Typecheck files 27 | run: yarn typecheck 28 | 29 | # test: 30 | # runs-on: ubuntu-latest 31 | # steps: 32 | # - name: Checkout 33 | # uses: actions/checkout@v4 34 | 35 | # - name: Setup 36 | # uses: ./.github/actions/setup 37 | 38 | # - name: Run unit tests 39 | # run: yarn test --maxWorkers=2 --coverage 40 | 41 | build-library: 42 | runs-on: ubuntu-latest 43 | steps: 44 | - name: Checkout 45 | uses: actions/checkout@v4 46 | 47 | - name: Setup 48 | uses: ./.github/actions/setup 49 | 50 | - name: Build package 51 | run: yarn prepare 52 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # XDE 6 | .expo/ 7 | 8 | # VSCode 9 | .vscode/ 10 | jsconfig.json 11 | 12 | # Xcode 13 | # 14 | build/ 15 | *.pbxuser 16 | !default.pbxuser 17 | *.mode1v3 18 | !default.mode1v3 19 | *.mode2v3 20 | !default.mode2v3 21 | *.perspectivev3 22 | !default.perspectivev3 23 | xcuserdata 24 | *.xccheckout 25 | *.moved-aside 26 | DerivedData 27 | *.hmap 28 | *.ipa 29 | *.xcuserstate 30 | project.xcworkspace 31 | **/.xcode.env.local 32 | 33 | # Android/IJ 34 | # 35 | .classpath 36 | .cxx 37 | .gradle 38 | .idea 39 | .project 40 | .settings 41 | local.properties 42 | android.iml 43 | 44 | # Cocoapods 45 | # 46 | example/ios/Pods 47 | 48 | # Ruby 49 | example/vendor/ 50 | 51 | # node.js 52 | # 53 | node_modules/ 54 | npm-debug.log 55 | yarn-debug.log 56 | yarn-error.log 57 | 58 | # BUCK 59 | buck-out/ 60 | \.buckd/ 61 | android/app/libs 62 | android/keystores/debug.keystore 63 | 64 | # Yarn 65 | .yarn/* 66 | !.yarn/patches 67 | !.yarn/plugins 68 | !.yarn/releases 69 | !.yarn/sdks 70 | !.yarn/versions 71 | 72 | # Expo 73 | .expo/ 74 | 75 | # Turborepo 76 | .turbo/ 77 | 78 | # generated by bob 79 | lib/ 80 | 81 | # React Native Codegen 82 | ios/generated 83 | android/generated 84 | 85 | # React Native Nitro Modules 86 | nitrogen/ 87 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | v20.19.0 2 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | //prettier-ignore 3 | module.exports = { 4 | name: "@yarnpkg/plugin-workspace-tools", 5 | factory: function (require) { 6 | var plugin=(()=>{var yr=Object.create;var we=Object.defineProperty;var _r=Object.getOwnPropertyDescriptor;var Er=Object.getOwnPropertyNames;var br=Object.getPrototypeOf,xr=Object.prototype.hasOwnProperty;var W=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(r,t)=>(typeof require<"u"?require:r)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var q=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Cr=(e,r)=>{for(var t in r)we(e,t,{get:r[t],enumerable:!0})},Je=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of Er(r))!xr.call(e,s)&&s!==t&&we(e,s,{get:()=>r[s],enumerable:!(n=_r(r,s))||n.enumerable});return e};var Be=(e,r,t)=>(t=e!=null?yr(br(e)):{},Je(r||!e||!e.__esModule?we(t,"default",{value:e,enumerable:!0}):t,e)),wr=e=>Je(we({},"__esModule",{value:!0}),e);var ve=q(ee=>{"use strict";ee.isInteger=e=>typeof e=="number"?Number.isInteger(e):typeof e=="string"&&e.trim()!==""?Number.isInteger(Number(e)):!1;ee.find=(e,r)=>e.nodes.find(t=>t.type===r);ee.exceedsLimit=(e,r,t=1,n)=>n===!1||!ee.isInteger(e)||!ee.isInteger(r)?!1:(Number(r)-Number(e))/Number(t)>=n;ee.escapeNode=(e,r=0,t)=>{let n=e.nodes[r];!n||(t&&n.type===t||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};ee.encloseBrace=e=>e.type!=="brace"?!1:e.commas>>0+e.ranges>>0===0?(e.invalid=!0,!0):!1;ee.isInvalidBrace=e=>e.type!=="brace"?!1:e.invalid===!0||e.dollar?!0:e.commas>>0+e.ranges>>0===0||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1;ee.isOpenOrClose=e=>e.type==="open"||e.type==="close"?!0:e.open===!0||e.close===!0;ee.reduce=e=>e.reduce((r,t)=>(t.type==="text"&&r.push(t.value),t.type==="range"&&(t.type="text"),r),[]);ee.flatten=(...e)=>{let r=[],t=n=>{for(let s=0;s{"use strict";var tt=ve();rt.exports=(e,r={})=>{let t=(n,s={})=>{let i=r.escapeInvalid&&tt.isInvalidBrace(s),a=n.invalid===!0&&r.escapeInvalid===!0,c="";if(n.value)return(i||a)&&tt.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let p of n.nodes)c+=t(p);return c};return t(e)}});var st=q((Vn,nt)=>{"use strict";nt.exports=function(e){return typeof e=="number"?e-e===0:typeof e=="string"&&e.trim()!==""?Number.isFinite?Number.isFinite(+e):isFinite(+e):!1}});var ht=q((Jn,pt)=>{"use strict";var at=st(),le=(e,r,t)=>{if(at(e)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(r===void 0||e===r)return String(e);if(at(r)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...t};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let s=String(n.relaxZeros),i=String(n.shorthand),a=String(n.capture),c=String(n.wrap),p=e+":"+r+"="+s+i+a+c;if(le.cache.hasOwnProperty(p))return le.cache[p].result;let m=Math.min(e,r),h=Math.max(e,r);if(Math.abs(m-h)===1){let y=e+"|"+r;return n.capture?`(${y})`:n.wrap===!1?y:`(?:${y})`}let R=ft(e)||ft(r),f={min:e,max:r,a:m,b:h},$=[],_=[];if(R&&(f.isPadded=R,f.maxLen=String(f.max).length),m<0){let y=h<0?Math.abs(h):1;_=it(y,Math.abs(m),f,n),m=f.a=0}return h>=0&&($=it(m,h,f,n)),f.negatives=_,f.positives=$,f.result=Sr(_,$,n),n.capture===!0?f.result=`(${f.result})`:n.wrap!==!1&&$.length+_.length>1&&(f.result=`(?:${f.result})`),le.cache[p]=f,f.result};function Sr(e,r,t){let n=Pe(e,r,"-",!1,t)||[],s=Pe(r,e,"",!1,t)||[],i=Pe(e,r,"-?",!0,t)||[];return n.concat(i).concat(s).join("|")}function vr(e,r){let t=1,n=1,s=ut(e,t),i=new Set([r]);for(;e<=s&&s<=r;)i.add(s),t+=1,s=ut(e,t);for(s=ct(r+1,n)-1;e1&&c.count.pop(),c.count.push(h.count[0]),c.string=c.pattern+lt(c.count),a=m+1;continue}t.isPadded&&(R=Lr(m,t,n)),h.string=R+h.pattern+lt(h.count),i.push(h),a=m+1,c=h}return i}function Pe(e,r,t,n,s){let i=[];for(let a of e){let{string:c}=a;!n&&!ot(r,"string",c)&&i.push(t+c),n&&ot(r,"string",c)&&i.push(t+c)}return i}function $r(e,r){let t=[];for(let n=0;nr?1:r>e?-1:0}function ot(e,r,t){return e.some(n=>n[r]===t)}function ut(e,r){return Number(String(e).slice(0,-r)+"9".repeat(r))}function ct(e,r){return e-e%Math.pow(10,r)}function lt(e){let[r=0,t=""]=e;return t||r>1?`{${r+(t?","+t:"")}}`:""}function kr(e,r,t){return`[${e}${r-e===1?"":"-"}${r}]`}function ft(e){return/^-?(0+)\d/.test(e)}function Lr(e,r,t){if(!r.isPadded)return e;let n=Math.abs(r.maxLen-String(e).length),s=t.relaxZeros!==!1;switch(n){case 0:return"";case 1:return s?"0?":"0";case 2:return s?"0{0,2}":"00";default:return s?`0{0,${n}}`:`0{${n}}`}}le.cache={};le.clearCache=()=>le.cache={};pt.exports=le});var Ue=q((es,Et)=>{"use strict";var Or=W("util"),At=ht(),dt=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Nr=e=>r=>e===!0?Number(r):String(r),Me=e=>typeof e=="number"||typeof e=="string"&&e!=="",Ae=e=>Number.isInteger(+e),De=e=>{let r=`${e}`,t=-1;if(r[0]==="-"&&(r=r.slice(1)),r==="0")return!1;for(;r[++t]==="0";);return t>0},Ir=(e,r,t)=>typeof e=="string"||typeof r=="string"?!0:t.stringify===!0,Br=(e,r,t)=>{if(r>0){let n=e[0]==="-"?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?r-1:r,"0")}return t===!1?String(e):e},gt=(e,r)=>{let t=e[0]==="-"?"-":"";for(t&&(e=e.slice(1),r--);e.length{e.negatives.sort((a,c)=>ac?1:0),e.positives.sort((a,c)=>ac?1:0);let t=r.capture?"":"?:",n="",s="",i;return e.positives.length&&(n=e.positives.join("|")),e.negatives.length&&(s=`-(${t}${e.negatives.join("|")})`),n&&s?i=`${n}|${s}`:i=n||s,r.wrap?`(${t}${i})`:i},mt=(e,r,t,n)=>{if(t)return At(e,r,{wrap:!1,...n});let s=String.fromCharCode(e);if(e===r)return s;let i=String.fromCharCode(r);return`[${s}-${i}]`},Rt=(e,r,t)=>{if(Array.isArray(e)){let n=t.wrap===!0,s=t.capture?"":"?:";return n?`(${s}${e.join("|")})`:e.join("|")}return At(e,r,t)},yt=(...e)=>new RangeError("Invalid range arguments: "+Or.inspect(...e)),_t=(e,r,t)=>{if(t.strictRanges===!0)throw yt([e,r]);return[]},Mr=(e,r)=>{if(r.strictRanges===!0)throw new TypeError(`Expected step "${e}" to be a number`);return[]},Dr=(e,r,t=1,n={})=>{let s=Number(e),i=Number(r);if(!Number.isInteger(s)||!Number.isInteger(i)){if(n.strictRanges===!0)throw yt([e,r]);return[]}s===0&&(s=0),i===0&&(i=0);let a=s>i,c=String(e),p=String(r),m=String(t);t=Math.max(Math.abs(t),1);let h=De(c)||De(p)||De(m),R=h?Math.max(c.length,p.length,m.length):0,f=h===!1&&Ir(e,r,n)===!1,$=n.transform||Nr(f);if(n.toRegex&&t===1)return mt(gt(e,R),gt(r,R),!0,n);let _={negatives:[],positives:[]},y=T=>_[T<0?"negatives":"positives"].push(Math.abs(T)),E=[],S=0;for(;a?s>=i:s<=i;)n.toRegex===!0&&t>1?y(s):E.push(Br($(s,S),R,f)),s=a?s-t:s+t,S++;return n.toRegex===!0?t>1?Pr(_,n):Rt(E,null,{wrap:!1,...n}):E},Ur=(e,r,t=1,n={})=>{if(!Ae(e)&&e.length>1||!Ae(r)&&r.length>1)return _t(e,r,n);let s=n.transform||(f=>String.fromCharCode(f)),i=`${e}`.charCodeAt(0),a=`${r}`.charCodeAt(0),c=i>a,p=Math.min(i,a),m=Math.max(i,a);if(n.toRegex&&t===1)return mt(p,m,!1,n);let h=[],R=0;for(;c?i>=a:i<=a;)h.push(s(i,R)),i=c?i-t:i+t,R++;return n.toRegex===!0?Rt(h,null,{wrap:!1,options:n}):h},$e=(e,r,t,n={})=>{if(r==null&&Me(e))return[e];if(!Me(e)||!Me(r))return _t(e,r,n);if(typeof t=="function")return $e(e,r,1,{transform:t});if(dt(t))return $e(e,r,0,t);let s={...n};return s.capture===!0&&(s.wrap=!0),t=t||s.step||1,Ae(t)?Ae(e)&&Ae(r)?Dr(e,r,t,s):Ur(e,r,Math.max(Math.abs(t),1),s):t!=null&&!dt(t)?Mr(t,s):$e(e,r,1,t)};Et.exports=$e});var Ct=q((ts,xt)=>{"use strict";var Gr=Ue(),bt=ve(),qr=(e,r={})=>{let t=(n,s={})=>{let i=bt.isInvalidBrace(s),a=n.invalid===!0&&r.escapeInvalid===!0,c=i===!0||a===!0,p=r.escapeInvalid===!0?"\\":"",m="";if(n.isOpen===!0||n.isClose===!0)return p+n.value;if(n.type==="open")return c?p+n.value:"(";if(n.type==="close")return c?p+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":c?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let h=bt.reduce(n.nodes),R=Gr(...h,{...r,wrap:!1,toRegex:!0});if(R.length!==0)return h.length>1&&R.length>1?`(${R})`:R}if(n.nodes)for(let h of n.nodes)m+=t(h,n);return m};return t(e)};xt.exports=qr});var vt=q((rs,St)=>{"use strict";var Kr=Ue(),wt=He(),he=ve(),fe=(e="",r="",t=!1)=>{let n=[];if(e=[].concat(e),r=[].concat(r),!r.length)return e;if(!e.length)return t?he.flatten(r).map(s=>`{${s}}`):r;for(let s of e)if(Array.isArray(s))for(let i of s)n.push(fe(i,r,t));else for(let i of r)t===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?fe(s,i,t):s+i);return he.flatten(n)},Wr=(e,r={})=>{let t=r.rangeLimit===void 0?1e3:r.rangeLimit,n=(s,i={})=>{s.queue=[];let a=i,c=i.queue;for(;a.type!=="brace"&&a.type!=="root"&&a.parent;)a=a.parent,c=a.queue;if(s.invalid||s.dollar){c.push(fe(c.pop(),wt(s,r)));return}if(s.type==="brace"&&s.invalid!==!0&&s.nodes.length===2){c.push(fe(c.pop(),["{}"]));return}if(s.nodes&&s.ranges>0){let R=he.reduce(s.nodes);if(he.exceedsLimit(...R,r.step,t))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let f=Kr(...R,r);f.length===0&&(f=wt(s,r)),c.push(fe(c.pop(),f)),s.nodes=[];return}let p=he.encloseBrace(s),m=s.queue,h=s;for(;h.type!=="brace"&&h.type!=="root"&&h.parent;)h=h.parent,m=h.queue;for(let R=0;R{"use strict";Ht.exports={MAX_LENGTH:1024*64,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:` 7 | `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var Nt=q((ss,Ot)=>{"use strict";var jr=He(),{MAX_LENGTH:Tt,CHAR_BACKSLASH:Ge,CHAR_BACKTICK:Fr,CHAR_COMMA:Qr,CHAR_DOT:Xr,CHAR_LEFT_PARENTHESES:Zr,CHAR_RIGHT_PARENTHESES:Yr,CHAR_LEFT_CURLY_BRACE:zr,CHAR_RIGHT_CURLY_BRACE:Vr,CHAR_LEFT_SQUARE_BRACKET:kt,CHAR_RIGHT_SQUARE_BRACKET:Lt,CHAR_DOUBLE_QUOTE:Jr,CHAR_SINGLE_QUOTE:en,CHAR_NO_BREAK_SPACE:tn,CHAR_ZERO_WIDTH_NOBREAK_SPACE:rn}=$t(),nn=(e,r={})=>{if(typeof e!="string")throw new TypeError("Expected a string");let t=r||{},n=typeof t.maxLength=="number"?Math.min(Tt,t.maxLength):Tt;if(e.length>n)throw new SyntaxError(`Input length (${e.length}), exceeds max characters (${n})`);let s={type:"root",input:e,nodes:[]},i=[s],a=s,c=s,p=0,m=e.length,h=0,R=0,f,$={},_=()=>e[h++],y=E=>{if(E.type==="text"&&c.type==="dot"&&(c.type="text"),c&&c.type==="text"&&E.type==="text"){c.value+=E.value;return}return a.nodes.push(E),E.parent=a,E.prev=c,c=E,E};for(y({type:"bos"});h0){if(a.ranges>0){a.ranges=0;let E=a.nodes.shift();a.nodes=[E,{type:"text",value:jr(a)}]}y({type:"comma",value:f}),a.commas++;continue}if(f===Xr&&R>0&&a.commas===0){let E=a.nodes;if(R===0||E.length===0){y({type:"text",value:f});continue}if(c.type==="dot"){if(a.range=[],c.value+=f,c.type="range",a.nodes.length!==3&&a.nodes.length!==5){a.invalid=!0,a.ranges=0,c.type="text";continue}a.ranges++,a.args=[];continue}if(c.type==="range"){E.pop();let S=E[E.length-1];S.value+=c.value+f,c=S,a.ranges--;continue}y({type:"dot",value:f});continue}y({type:"text",value:f})}do if(a=i.pop(),a.type!=="root"){a.nodes.forEach(T=>{T.nodes||(T.type==="open"&&(T.isOpen=!0),T.type==="close"&&(T.isClose=!0),T.nodes||(T.type="text"),T.invalid=!0)});let E=i[i.length-1],S=E.nodes.indexOf(a);E.nodes.splice(S,1,...a.nodes)}while(i.length>0);return y({type:"eos"}),s};Ot.exports=nn});var Pt=q((as,Bt)=>{"use strict";var It=He(),sn=Ct(),an=vt(),on=Nt(),Z=(e,r={})=>{let t=[];if(Array.isArray(e))for(let n of e){let s=Z.create(n,r);Array.isArray(s)?t.push(...s):t.push(s)}else t=[].concat(Z.create(e,r));return r&&r.expand===!0&&r.nodupes===!0&&(t=[...new Set(t)]),t};Z.parse=(e,r={})=>on(e,r);Z.stringify=(e,r={})=>It(typeof e=="string"?Z.parse(e,r):e,r);Z.compile=(e,r={})=>(typeof e=="string"&&(e=Z.parse(e,r)),sn(e,r));Z.expand=(e,r={})=>{typeof e=="string"&&(e=Z.parse(e,r));let t=an(e,r);return r.noempty===!0&&(t=t.filter(Boolean)),r.nodupes===!0&&(t=[...new Set(t)]),t};Z.create=(e,r={})=>e===""||e.length<3?[e]:r.expand!==!0?Z.compile(e,r):Z.expand(e,r);Bt.exports=Z});var me=q((is,qt)=>{"use strict";var un=W("path"),se="\\\\/",Mt=`[^${se}]`,ie="\\.",cn="\\+",ln="\\?",Te="\\/",fn="(?=.)",Dt="[^/]",qe=`(?:${Te}|$)`,Ut=`(?:^|${Te})`,Ke=`${ie}{1,2}${qe}`,pn=`(?!${ie})`,hn=`(?!${Ut}${Ke})`,dn=`(?!${ie}{0,1}${qe})`,gn=`(?!${Ke})`,An=`[^.${Te}]`,mn=`${Dt}*?`,Gt={DOT_LITERAL:ie,PLUS_LITERAL:cn,QMARK_LITERAL:ln,SLASH_LITERAL:Te,ONE_CHAR:fn,QMARK:Dt,END_ANCHOR:qe,DOTS_SLASH:Ke,NO_DOT:pn,NO_DOTS:hn,NO_DOT_SLASH:dn,NO_DOTS_SLASH:gn,QMARK_NO_DOT:An,STAR:mn,START_ANCHOR:Ut},Rn={...Gt,SLASH_LITERAL:`[${se}]`,QMARK:Mt,STAR:`${Mt}*?`,DOTS_SLASH:`${ie}{1,2}(?:[${se}]|$)`,NO_DOT:`(?!${ie})`,NO_DOTS:`(?!(?:^|[${se}])${ie}{1,2}(?:[${se}]|$))`,NO_DOT_SLASH:`(?!${ie}{0,1}(?:[${se}]|$))`,NO_DOTS_SLASH:`(?!${ie}{1,2}(?:[${se}]|$))`,QMARK_NO_DOT:`[^.${se}]`,START_ANCHOR:`(?:^|[${se}])`,END_ANCHOR:`(?:[${se}]|$)`},yn={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};qt.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:yn,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:un.sep,extglobChars(e){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(e){return e===!0?Rn:Gt}}});var Re=q(Q=>{"use strict";var _n=W("path"),En=process.platform==="win32",{REGEX_BACKSLASH:bn,REGEX_REMOVE_BACKSLASH:xn,REGEX_SPECIAL_CHARS:Cn,REGEX_SPECIAL_CHARS_GLOBAL:wn}=me();Q.isObject=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);Q.hasRegexChars=e=>Cn.test(e);Q.isRegexChar=e=>e.length===1&&Q.hasRegexChars(e);Q.escapeRegex=e=>e.replace(wn,"\\$1");Q.toPosixSlashes=e=>e.replace(bn,"/");Q.removeBackslashes=e=>e.replace(xn,r=>r==="\\"?"":r);Q.supportsLookbehinds=()=>{let e=process.version.slice(1).split(".").map(Number);return e.length===3&&e[0]>=9||e[0]===8&&e[1]>=10};Q.isWindows=e=>e&&typeof e.windows=="boolean"?e.windows:En===!0||_n.sep==="\\";Q.escapeLast=(e,r,t)=>{let n=e.lastIndexOf(r,t);return n===-1?e:e[n-1]==="\\"?Q.escapeLast(e,r,n-1):`${e.slice(0,n)}\\${e.slice(n)}`};Q.removePrefix=(e,r={})=>{let t=e;return t.startsWith("./")&&(t=t.slice(2),r.prefix="./"),t};Q.wrapOutput=(e,r={},t={})=>{let n=t.contains?"":"^",s=t.contains?"":"$",i=`${n}(?:${e})${s}`;return r.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var Yt=q((us,Zt)=>{"use strict";var Kt=Re(),{CHAR_ASTERISK:We,CHAR_AT:Sn,CHAR_BACKWARD_SLASH:ye,CHAR_COMMA:vn,CHAR_DOT:je,CHAR_EXCLAMATION_MARK:Fe,CHAR_FORWARD_SLASH:Xt,CHAR_LEFT_CURLY_BRACE:Qe,CHAR_LEFT_PARENTHESES:Xe,CHAR_LEFT_SQUARE_BRACKET:Hn,CHAR_PLUS:$n,CHAR_QUESTION_MARK:Wt,CHAR_RIGHT_CURLY_BRACE:Tn,CHAR_RIGHT_PARENTHESES:jt,CHAR_RIGHT_SQUARE_BRACKET:kn}=me(),Ft=e=>e===Xt||e===ye,Qt=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)},Ln=(e,r)=>{let t=r||{},n=e.length-1,s=t.parts===!0||t.scanToEnd===!0,i=[],a=[],c=[],p=e,m=-1,h=0,R=0,f=!1,$=!1,_=!1,y=!1,E=!1,S=!1,T=!1,L=!1,z=!1,I=!1,re=0,K,g,v={value:"",depth:0,isGlob:!1},k=()=>m>=n,l=()=>p.charCodeAt(m+1),H=()=>(K=g,p.charCodeAt(++m));for(;m0&&(B=p.slice(0,h),p=p.slice(h),R-=h),w&&_===!0&&R>0?(w=p.slice(0,R),o=p.slice(R)):_===!0?(w="",o=p):w=p,w&&w!==""&&w!=="/"&&w!==p&&Ft(w.charCodeAt(w.length-1))&&(w=w.slice(0,-1)),t.unescape===!0&&(o&&(o=Kt.removeBackslashes(o)),w&&T===!0&&(w=Kt.removeBackslashes(w)));let u={prefix:B,input:e,start:h,base:w,glob:o,isBrace:f,isBracket:$,isGlob:_,isExtglob:y,isGlobstar:E,negated:L,negatedExtglob:z};if(t.tokens===!0&&(u.maxDepth=0,Ft(g)||a.push(v),u.tokens=a),t.parts===!0||t.tokens===!0){let P;for(let b=0;b{"use strict";var ke=me(),Y=Re(),{MAX_LENGTH:Le,POSIX_REGEX_SOURCE:On,REGEX_NON_SPECIAL_CHARS:Nn,REGEX_SPECIAL_CHARS_BACKREF:In,REPLACEMENTS:zt}=ke,Bn=(e,r)=>{if(typeof r.expandRange=="function")return r.expandRange(...e,r);e.sort();let t=`[${e.join("-")}]`;try{new RegExp(t)}catch{return e.map(s=>Y.escapeRegex(s)).join("..")}return t},de=(e,r)=>`Missing ${e}: "${r}" - use "\\\\${r}" to match literal characters`,Vt=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a string");e=zt[e]||e;let t={...r},n=typeof t.maxLength=="number"?Math.min(Le,t.maxLength):Le,s=e.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);let i={type:"bos",value:"",output:t.prepend||""},a=[i],c=t.capture?"":"?:",p=Y.isWindows(r),m=ke.globChars(p),h=ke.extglobChars(m),{DOT_LITERAL:R,PLUS_LITERAL:f,SLASH_LITERAL:$,ONE_CHAR:_,DOTS_SLASH:y,NO_DOT:E,NO_DOT_SLASH:S,NO_DOTS_SLASH:T,QMARK:L,QMARK_NO_DOT:z,STAR:I,START_ANCHOR:re}=m,K=A=>`(${c}(?:(?!${re}${A.dot?y:R}).)*?)`,g=t.dot?"":E,v=t.dot?L:z,k=t.bash===!0?K(t):I;t.capture&&(k=`(${k})`),typeof t.noext=="boolean"&&(t.noextglob=t.noext);let l={input:e,index:-1,start:0,dot:t.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:a};e=Y.removePrefix(e,l),s=e.length;let H=[],w=[],B=[],o=i,u,P=()=>l.index===s-1,b=l.peek=(A=1)=>e[l.index+A],V=l.advance=()=>e[++l.index]||"",J=()=>e.slice(l.index+1),X=(A="",O=0)=>{l.consumed+=A,l.index+=O},Ee=A=>{l.output+=A.output!=null?A.output:A.value,X(A.value)},mr=()=>{let A=1;for(;b()==="!"&&(b(2)!=="("||b(3)==="?");)V(),l.start++,A++;return A%2===0?!1:(l.negated=!0,l.start++,!0)},be=A=>{l[A]++,B.push(A)},oe=A=>{l[A]--,B.pop()},C=A=>{if(o.type==="globstar"){let O=l.braces>0&&(A.type==="comma"||A.type==="brace"),d=A.extglob===!0||H.length&&(A.type==="pipe"||A.type==="paren");A.type!=="slash"&&A.type!=="paren"&&!O&&!d&&(l.output=l.output.slice(0,-o.output.length),o.type="star",o.value="*",o.output=k,l.output+=o.output)}if(H.length&&A.type!=="paren"&&(H[H.length-1].inner+=A.value),(A.value||A.output)&&Ee(A),o&&o.type==="text"&&A.type==="text"){o.value+=A.value,o.output=(o.output||"")+A.value;return}A.prev=o,a.push(A),o=A},xe=(A,O)=>{let d={...h[O],conditions:1,inner:""};d.prev=o,d.parens=l.parens,d.output=l.output;let x=(t.capture?"(":"")+d.open;be("parens"),C({type:A,value:O,output:l.output?"":_}),C({type:"paren",extglob:!0,value:V(),output:x}),H.push(d)},Rr=A=>{let O=A.close+(t.capture?")":""),d;if(A.type==="negate"){let x=k;A.inner&&A.inner.length>1&&A.inner.includes("/")&&(x=K(t)),(x!==k||P()||/^\)+$/.test(J()))&&(O=A.close=`)$))${x}`),A.inner.includes("*")&&(d=J())&&/^\.[^\\/.]+$/.test(d)&&(O=A.close=`)${d})${x})`),A.prev.type==="bos"&&(l.negatedExtglob=!0)}C({type:"paren",extglob:!0,value:u,output:O}),oe("parens")};if(t.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let A=!1,O=e.replace(In,(d,x,M,j,G,Ie)=>j==="\\"?(A=!0,d):j==="?"?x?x+j+(G?L.repeat(G.length):""):Ie===0?v+(G?L.repeat(G.length):""):L.repeat(M.length):j==="."?R.repeat(M.length):j==="*"?x?x+j+(G?k:""):k:x?d:`\\${d}`);return A===!0&&(t.unescape===!0?O=O.replace(/\\/g,""):O=O.replace(/\\+/g,d=>d.length%2===0?"\\\\":d?"\\":"")),O===e&&t.contains===!0?(l.output=e,l):(l.output=Y.wrapOutput(O,l,r),l)}for(;!P();){if(u=V(),u==="\0")continue;if(u==="\\"){let d=b();if(d==="/"&&t.bash!==!0||d==="."||d===";")continue;if(!d){u+="\\",C({type:"text",value:u});continue}let x=/^\\+/.exec(J()),M=0;if(x&&x[0].length>2&&(M=x[0].length,l.index+=M,M%2!==0&&(u+="\\")),t.unescape===!0?u=V():u+=V(),l.brackets===0){C({type:"text",value:u});continue}}if(l.brackets>0&&(u!=="]"||o.value==="["||o.value==="[^")){if(t.posix!==!1&&u===":"){let d=o.value.slice(1);if(d.includes("[")&&(o.posix=!0,d.includes(":"))){let x=o.value.lastIndexOf("["),M=o.value.slice(0,x),j=o.value.slice(x+2),G=On[j];if(G){o.value=M+G,l.backtrack=!0,V(),!i.output&&a.indexOf(o)===1&&(i.output=_);continue}}}(u==="["&&b()!==":"||u==="-"&&b()==="]")&&(u=`\\${u}`),u==="]"&&(o.value==="["||o.value==="[^")&&(u=`\\${u}`),t.posix===!0&&u==="!"&&o.value==="["&&(u="^"),o.value+=u,Ee({value:u});continue}if(l.quotes===1&&u!=='"'){u=Y.escapeRegex(u),o.value+=u,Ee({value:u});continue}if(u==='"'){l.quotes=l.quotes===1?0:1,t.keepQuotes===!0&&C({type:"text",value:u});continue}if(u==="("){be("parens"),C({type:"paren",value:u});continue}if(u===")"){if(l.parens===0&&t.strictBrackets===!0)throw new SyntaxError(de("opening","("));let d=H[H.length-1];if(d&&l.parens===d.parens+1){Rr(H.pop());continue}C({type:"paren",value:u,output:l.parens?")":"\\)"}),oe("parens");continue}if(u==="["){if(t.nobracket===!0||!J().includes("]")){if(t.nobracket!==!0&&t.strictBrackets===!0)throw new SyntaxError(de("closing","]"));u=`\\${u}`}else be("brackets");C({type:"bracket",value:u});continue}if(u==="]"){if(t.nobracket===!0||o&&o.type==="bracket"&&o.value.length===1){C({type:"text",value:u,output:`\\${u}`});continue}if(l.brackets===0){if(t.strictBrackets===!0)throw new SyntaxError(de("opening","["));C({type:"text",value:u,output:`\\${u}`});continue}oe("brackets");let d=o.value.slice(1);if(o.posix!==!0&&d[0]==="^"&&!d.includes("/")&&(u=`/${u}`),o.value+=u,Ee({value:u}),t.literalBrackets===!1||Y.hasRegexChars(d))continue;let x=Y.escapeRegex(o.value);if(l.output=l.output.slice(0,-o.value.length),t.literalBrackets===!0){l.output+=x,o.value=x;continue}o.value=`(${c}${x}|${o.value})`,l.output+=o.value;continue}if(u==="{"&&t.nobrace!==!0){be("braces");let d={type:"brace",value:u,output:"(",outputIndex:l.output.length,tokensIndex:l.tokens.length};w.push(d),C(d);continue}if(u==="}"){let d=w[w.length-1];if(t.nobrace===!0||!d){C({type:"text",value:u,output:u});continue}let x=")";if(d.dots===!0){let M=a.slice(),j=[];for(let G=M.length-1;G>=0&&(a.pop(),M[G].type!=="brace");G--)M[G].type!=="dots"&&j.unshift(M[G].value);x=Bn(j,t),l.backtrack=!0}if(d.comma!==!0&&d.dots!==!0){let M=l.output.slice(0,d.outputIndex),j=l.tokens.slice(d.tokensIndex);d.value=d.output="\\{",u=x="\\}",l.output=M;for(let G of j)l.output+=G.output||G.value}C({type:"brace",value:u,output:x}),oe("braces"),w.pop();continue}if(u==="|"){H.length>0&&H[H.length-1].conditions++,C({type:"text",value:u});continue}if(u===","){let d=u,x=w[w.length-1];x&&B[B.length-1]==="braces"&&(x.comma=!0,d="|"),C({type:"comma",value:u,output:d});continue}if(u==="/"){if(o.type==="dot"&&l.index===l.start+1){l.start=l.index+1,l.consumed="",l.output="",a.pop(),o=i;continue}C({type:"slash",value:u,output:$});continue}if(u==="."){if(l.braces>0&&o.type==="dot"){o.value==="."&&(o.output=R);let d=w[w.length-1];o.type="dots",o.output+=u,o.value+=u,d.dots=!0;continue}if(l.braces+l.parens===0&&o.type!=="bos"&&o.type!=="slash"){C({type:"text",value:u,output:R});continue}C({type:"dot",value:u,output:R});continue}if(u==="?"){if(!(o&&o.value==="(")&&t.noextglob!==!0&&b()==="("&&b(2)!=="?"){xe("qmark",u);continue}if(o&&o.type==="paren"){let x=b(),M=u;if(x==="<"&&!Y.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(o.value==="("&&!/[!=<:]/.test(x)||x==="<"&&!/<([!=]|\w+>)/.test(J()))&&(M=`\\${u}`),C({type:"text",value:u,output:M});continue}if(t.dot!==!0&&(o.type==="slash"||o.type==="bos")){C({type:"qmark",value:u,output:z});continue}C({type:"qmark",value:u,output:L});continue}if(u==="!"){if(t.noextglob!==!0&&b()==="("&&(b(2)!=="?"||!/[!=<:]/.test(b(3)))){xe("negate",u);continue}if(t.nonegate!==!0&&l.index===0){mr();continue}}if(u==="+"){if(t.noextglob!==!0&&b()==="("&&b(2)!=="?"){xe("plus",u);continue}if(o&&o.value==="("||t.regex===!1){C({type:"plus",value:u,output:f});continue}if(o&&(o.type==="bracket"||o.type==="paren"||o.type==="brace")||l.parens>0){C({type:"plus",value:u});continue}C({type:"plus",value:f});continue}if(u==="@"){if(t.noextglob!==!0&&b()==="("&&b(2)!=="?"){C({type:"at",extglob:!0,value:u,output:""});continue}C({type:"text",value:u});continue}if(u!=="*"){(u==="$"||u==="^")&&(u=`\\${u}`);let d=Nn.exec(J());d&&(u+=d[0],l.index+=d[0].length),C({type:"text",value:u});continue}if(o&&(o.type==="globstar"||o.star===!0)){o.type="star",o.star=!0,o.value+=u,o.output=k,l.backtrack=!0,l.globstar=!0,X(u);continue}let A=J();if(t.noextglob!==!0&&/^\([^?]/.test(A)){xe("star",u);continue}if(o.type==="star"){if(t.noglobstar===!0){X(u);continue}let d=o.prev,x=d.prev,M=d.type==="slash"||d.type==="bos",j=x&&(x.type==="star"||x.type==="globstar");if(t.bash===!0&&(!M||A[0]&&A[0]!=="/")){C({type:"star",value:u,output:""});continue}let G=l.braces>0&&(d.type==="comma"||d.type==="brace"),Ie=H.length&&(d.type==="pipe"||d.type==="paren");if(!M&&d.type!=="paren"&&!G&&!Ie){C({type:"star",value:u,output:""});continue}for(;A.slice(0,3)==="/**";){let Ce=e[l.index+4];if(Ce&&Ce!=="/")break;A=A.slice(3),X("/**",3)}if(d.type==="bos"&&P()){o.type="globstar",o.value+=u,o.output=K(t),l.output=o.output,l.globstar=!0,X(u);continue}if(d.type==="slash"&&d.prev.type!=="bos"&&!j&&P()){l.output=l.output.slice(0,-(d.output+o.output).length),d.output=`(?:${d.output}`,o.type="globstar",o.output=K(t)+(t.strictSlashes?")":"|$)"),o.value+=u,l.globstar=!0,l.output+=d.output+o.output,X(u);continue}if(d.type==="slash"&&d.prev.type!=="bos"&&A[0]==="/"){let Ce=A[1]!==void 0?"|$":"";l.output=l.output.slice(0,-(d.output+o.output).length),d.output=`(?:${d.output}`,o.type="globstar",o.output=`${K(t)}${$}|${$}${Ce})`,o.value+=u,l.output+=d.output+o.output,l.globstar=!0,X(u+V()),C({type:"slash",value:"/",output:""});continue}if(d.type==="bos"&&A[0]==="/"){o.type="globstar",o.value+=u,o.output=`(?:^|${$}|${K(t)}${$})`,l.output=o.output,l.globstar=!0,X(u+V()),C({type:"slash",value:"/",output:""});continue}l.output=l.output.slice(0,-o.output.length),o.type="globstar",o.output=K(t),o.value+=u,l.output+=o.output,l.globstar=!0,X(u);continue}let O={type:"star",value:u,output:k};if(t.bash===!0){O.output=".*?",(o.type==="bos"||o.type==="slash")&&(O.output=g+O.output),C(O);continue}if(o&&(o.type==="bracket"||o.type==="paren")&&t.regex===!0){O.output=u,C(O);continue}(l.index===l.start||o.type==="slash"||o.type==="dot")&&(o.type==="dot"?(l.output+=S,o.output+=S):t.dot===!0?(l.output+=T,o.output+=T):(l.output+=g,o.output+=g),b()!=="*"&&(l.output+=_,o.output+=_)),C(O)}for(;l.brackets>0;){if(t.strictBrackets===!0)throw new SyntaxError(de("closing","]"));l.output=Y.escapeLast(l.output,"["),oe("brackets")}for(;l.parens>0;){if(t.strictBrackets===!0)throw new SyntaxError(de("closing",")"));l.output=Y.escapeLast(l.output,"("),oe("parens")}for(;l.braces>0;){if(t.strictBrackets===!0)throw new SyntaxError(de("closing","}"));l.output=Y.escapeLast(l.output,"{"),oe("braces")}if(t.strictSlashes!==!0&&(o.type==="star"||o.type==="bracket")&&C({type:"maybe_slash",value:"",output:`${$}?`}),l.backtrack===!0){l.output="";for(let A of l.tokens)l.output+=A.output!=null?A.output:A.value,A.suffix&&(l.output+=A.suffix)}return l};Vt.fastpaths=(e,r)=>{let t={...r},n=typeof t.maxLength=="number"?Math.min(Le,t.maxLength):Le,s=e.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);e=zt[e]||e;let i=Y.isWindows(r),{DOT_LITERAL:a,SLASH_LITERAL:c,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOTS:R,NO_DOTS_SLASH:f,STAR:$,START_ANCHOR:_}=ke.globChars(i),y=t.dot?R:h,E=t.dot?f:h,S=t.capture?"":"?:",T={negated:!1,prefix:""},L=t.bash===!0?".*?":$;t.capture&&(L=`(${L})`);let z=g=>g.noglobstar===!0?L:`(${S}(?:(?!${_}${g.dot?m:a}).)*?)`,I=g=>{switch(g){case"*":return`${y}${p}${L}`;case".*":return`${a}${p}${L}`;case"*.*":return`${y}${L}${a}${p}${L}`;case"*/*":return`${y}${L}${c}${p}${E}${L}`;case"**":return y+z(t);case"**/*":return`(?:${y}${z(t)}${c})?${E}${p}${L}`;case"**/*.*":return`(?:${y}${z(t)}${c})?${E}${L}${a}${p}${L}`;case"**/.*":return`(?:${y}${z(t)}${c})?${a}${p}${L}`;default:{let v=/^(.*?)\.(\w+)$/.exec(g);if(!v)return;let k=I(v[1]);return k?k+a+v[2]:void 0}}},re=Y.removePrefix(e,T),K=I(re);return K&&t.strictSlashes!==!0&&(K+=`${c}?`),K};Jt.exports=Vt});var rr=q((ls,tr)=>{"use strict";var Pn=W("path"),Mn=Yt(),Ze=er(),Ye=Re(),Dn=me(),Un=e=>e&&typeof e=="object"&&!Array.isArray(e),D=(e,r,t=!1)=>{if(Array.isArray(e)){let h=e.map(f=>D(f,r,t));return f=>{for(let $ of h){let _=$(f);if(_)return _}return!1}}let n=Un(e)&&e.tokens&&e.input;if(e===""||typeof e!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let s=r||{},i=Ye.isWindows(r),a=n?D.compileRe(e,r):D.makeRe(e,r,!1,!0),c=a.state;delete a.state;let p=()=>!1;if(s.ignore){let h={...r,ignore:null,onMatch:null,onResult:null};p=D(s.ignore,h,t)}let m=(h,R=!1)=>{let{isMatch:f,match:$,output:_}=D.test(h,a,r,{glob:e,posix:i}),y={glob:e,state:c,regex:a,posix:i,input:h,output:_,match:$,isMatch:f};return typeof s.onResult=="function"&&s.onResult(y),f===!1?(y.isMatch=!1,R?y:!1):p(h)?(typeof s.onIgnore=="function"&&s.onIgnore(y),y.isMatch=!1,R?y:!1):(typeof s.onMatch=="function"&&s.onMatch(y),R?y:!0)};return t&&(m.state=c),m};D.test=(e,r,t,{glob:n,posix:s}={})=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(e==="")return{isMatch:!1,output:""};let i=t||{},a=i.format||(s?Ye.toPosixSlashes:null),c=e===n,p=c&&a?a(e):e;return c===!1&&(p=a?a(e):e,c=p===n),(c===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?c=D.matchBase(e,r,t,s):c=r.exec(p)),{isMatch:Boolean(c),match:c,output:p}};D.matchBase=(e,r,t,n=Ye.isWindows(t))=>(r instanceof RegExp?r:D.makeRe(r,t)).test(Pn.basename(e));D.isMatch=(e,r,t)=>D(r,t)(e);D.parse=(e,r)=>Array.isArray(e)?e.map(t=>D.parse(t,r)):Ze(e,{...r,fastpaths:!1});D.scan=(e,r)=>Mn(e,r);D.compileRe=(e,r,t=!1,n=!1)=>{if(t===!0)return e.output;let s=r||{},i=s.contains?"":"^",a=s.contains?"":"$",c=`${i}(?:${e.output})${a}`;e&&e.negated===!0&&(c=`^(?!${c}).*$`);let p=D.toRegex(c,r);return n===!0&&(p.state=e),p};D.makeRe=(e,r={},t=!1,n=!1)=>{if(!e||typeof e!="string")throw new TypeError("Expected a non-empty string");let s={negated:!1,fastpaths:!0};return r.fastpaths!==!1&&(e[0]==="."||e[0]==="*")&&(s.output=Ze.fastpaths(e,r)),s.output||(s=Ze(e,r)),D.compileRe(s,r,t,n)};D.toRegex=(e,r)=>{try{let t=r||{};return new RegExp(e,t.flags||(t.nocase?"i":""))}catch(t){if(r&&r.debug===!0)throw t;return/$^/}};D.constants=Dn;tr.exports=D});var sr=q((fs,nr)=>{"use strict";nr.exports=rr()});var cr=q((ps,ur)=>{"use strict";var ir=W("util"),or=Pt(),ae=sr(),ze=Re(),ar=e=>e===""||e==="./",N=(e,r,t)=>{r=[].concat(r),e=[].concat(e);let n=new Set,s=new Set,i=new Set,a=0,c=h=>{i.add(h.output),t&&t.onResult&&t.onResult(h)};for(let h=0;h!n.has(h));if(t&&m.length===0){if(t.failglob===!0)throw new Error(`No matches found for "${r.join(", ")}"`);if(t.nonull===!0||t.nullglob===!0)return t.unescape?r.map(h=>h.replace(/\\/g,"")):r}return m};N.match=N;N.matcher=(e,r)=>ae(e,r);N.isMatch=(e,r,t)=>ae(r,t)(e);N.any=N.isMatch;N.not=(e,r,t={})=>{r=[].concat(r).map(String);let n=new Set,s=[],a=N(e,r,{...t,onResult:c=>{t.onResult&&t.onResult(c),s.push(c.output)}});for(let c of s)a.includes(c)||n.add(c);return[...n]};N.contains=(e,r,t)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${ir.inspect(e)}"`);if(Array.isArray(r))return r.some(n=>N.contains(e,n,t));if(typeof r=="string"){if(ar(e)||ar(r))return!1;if(e.includes(r)||e.startsWith("./")&&e.slice(2).includes(r))return!0}return N.isMatch(e,r,{...t,contains:!0})};N.matchKeys=(e,r,t)=>{if(!ze.isObject(e))throw new TypeError("Expected the first argument to be an object");let n=N(Object.keys(e),r,t),s={};for(let i of n)s[i]=e[i];return s};N.some=(e,r,t)=>{let n=[].concat(e);for(let s of[].concat(r)){let i=ae(String(s),t);if(n.some(a=>i(a)))return!0}return!1};N.every=(e,r,t)=>{let n=[].concat(e);for(let s of[].concat(r)){let i=ae(String(s),t);if(!n.every(a=>i(a)))return!1}return!0};N.all=(e,r,t)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${ir.inspect(e)}"`);return[].concat(r).every(n=>ae(n,t)(e))};N.capture=(e,r,t)=>{let n=ze.isWindows(t),i=ae.makeRe(String(e),{...t,capture:!0}).exec(n?ze.toPosixSlashes(r):r);if(i)return i.slice(1).map(a=>a===void 0?"":a)};N.makeRe=(...e)=>ae.makeRe(...e);N.scan=(...e)=>ae.scan(...e);N.parse=(e,r)=>{let t=[];for(let n of[].concat(e||[]))for(let s of or(String(n),r))t.push(ae.parse(s,r));return t};N.braces=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a string");return r&&r.nobrace===!0||!/\{.*\}/.test(e)?[e]:or(e,r)};N.braceExpand=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a string");return N.braces(e,{...r,expand:!0})};ur.exports=N});var fr=q((hs,lr)=>{"use strict";lr.exports=(e,...r)=>new Promise(t=>{t(e(...r))})});var hr=q((ds,Ve)=>{"use strict";var Gn=fr(),pr=e=>{if(e<1)throw new TypeError("Expected `concurrency` to be a number from 1 and up");let r=[],t=0,n=()=>{t--,r.length>0&&r.shift()()},s=(c,p,...m)=>{t++;let h=Gn(c,...m);p(h),h.then(n,n)},i=(c,p,...m)=>{tnew Promise(m=>i(c,m,...p));return Object.defineProperties(a,{activeCount:{get:()=>t},pendingCount:{get:()=>r.length}}),a};Ve.exports=pr;Ve.exports.default=pr});var jn={};Cr(jn,{default:()=>Wn});var Se=W("@yarnpkg/cli"),ne=W("@yarnpkg/core"),et=W("@yarnpkg/core"),ue=W("clipanion"),ce=class extends Se.BaseCommand{constructor(){super(...arguments);this.json=ue.Option.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.production=ue.Option.Boolean("--production",!1,{description:"Only install regular dependencies by omitting dev dependencies"});this.all=ue.Option.Boolean("-A,--all",!1,{description:"Install the entire project"});this.workspaces=ue.Option.Rest()}async execute(){let t=await ne.Configuration.find(this.context.cwd,this.context.plugins),{project:n,workspace:s}=await ne.Project.find(t,this.context.cwd),i=await ne.Cache.find(t);await n.restoreInstallState({restoreResolutions:!1});let a;if(this.all)a=new Set(n.workspaces);else if(this.workspaces.length===0){if(!s)throw new Se.WorkspaceRequiredError(n.cwd,this.context.cwd);a=new Set([s])}else a=new Set(this.workspaces.map(p=>n.getWorkspaceByIdent(et.structUtils.parseIdent(p))));for(let p of a)for(let m of this.production?["dependencies"]:ne.Manifest.hardDependencies)for(let h of p.manifest.getForScope(m).values()){let R=n.tryWorkspaceByDescriptor(h);R!==null&&a.add(R)}for(let p of n.workspaces)a.has(p)?this.production&&p.manifest.devDependencies.clear():(p.manifest.installConfig=p.manifest.installConfig||{},p.manifest.installConfig.selfReferences=!1,p.manifest.dependencies.clear(),p.manifest.devDependencies.clear(),p.manifest.peerDependencies.clear(),p.manifest.scripts.clear());return(await ne.StreamReport.start({configuration:t,json:this.json,stdout:this.context.stdout,includeLogs:!0},async p=>{await n.install({cache:i,report:p,persistProject:!1})})).exitCode()}};ce.paths=[["workspaces","focus"]],ce.usage=ue.Command.Usage({category:"Workspace-related commands",description:"install a single workspace and its dependencies",details:"\n This command will run an install as if the specified workspaces (and all other workspaces they depend on) were the only ones in the project. If no workspaces are explicitly listed, the active one will be assumed.\n\n Note that this command is only very moderately useful when using zero-installs, since the cache will contain all the packages anyway - meaning that the only difference between a full install and a focused install would just be a few extra lines in the `.pnp.cjs` file, at the cost of introducing an extra complexity.\n\n If the `-A,--all` flag is set, the entire project will be installed. Combine with `--production` to replicate the old `yarn install --production`.\n "});var Ne=W("@yarnpkg/cli"),ge=W("@yarnpkg/core"),_e=W("@yarnpkg/core"),F=W("@yarnpkg/core"),gr=W("@yarnpkg/plugin-git"),U=W("clipanion"),Oe=Be(cr()),Ar=Be(hr()),te=Be(W("typanion")),pe=class extends Ne.BaseCommand{constructor(){super(...arguments);this.recursive=U.Option.Boolean("-R,--recursive",!1,{description:"Find packages via dependencies/devDependencies instead of using the workspaces field"});this.from=U.Option.Array("--from",[],{description:"An array of glob pattern idents from which to base any recursion"});this.all=U.Option.Boolean("-A,--all",!1,{description:"Run the command on all workspaces of a project"});this.verbose=U.Option.Boolean("-v,--verbose",!1,{description:"Prefix each output line with the name of the originating workspace"});this.parallel=U.Option.Boolean("-p,--parallel",!1,{description:"Run the commands in parallel"});this.interlaced=U.Option.Boolean("-i,--interlaced",!1,{description:"Print the output of commands in real-time instead of buffering it"});this.jobs=U.Option.String("-j,--jobs",{description:"The maximum number of parallel tasks that the execution will be limited to; or `unlimited`",validator:te.isOneOf([te.isEnum(["unlimited"]),te.applyCascade(te.isNumber(),[te.isInteger(),te.isAtLeast(1)])])});this.topological=U.Option.Boolean("-t,--topological",!1,{description:"Run the command after all workspaces it depends on (regular) have finished"});this.topologicalDev=U.Option.Boolean("--topological-dev",!1,{description:"Run the command after all workspaces it depends on (regular + dev) have finished"});this.include=U.Option.Array("--include",[],{description:"An array of glob pattern idents; only matching workspaces will be traversed"});this.exclude=U.Option.Array("--exclude",[],{description:"An array of glob pattern idents; matching workspaces won't be traversed"});this.publicOnly=U.Option.Boolean("--no-private",{description:"Avoid running the command on private workspaces"});this.since=U.Option.String("--since",{description:"Only include workspaces that have been changed since the specified ref.",tolerateBoolean:!0});this.commandName=U.Option.String();this.args=U.Option.Proxy()}async execute(){let t=await ge.Configuration.find(this.context.cwd,this.context.plugins),{project:n,workspace:s}=await ge.Project.find(t,this.context.cwd);if(!this.all&&!s)throw new Ne.WorkspaceRequiredError(n.cwd,this.context.cwd);await n.restoreInstallState();let i=this.cli.process([this.commandName,...this.args]),a=i.path.length===1&&i.path[0]==="run"&&typeof i.scriptName<"u"?i.scriptName:null;if(i.path.length===0)throw new U.UsageError("Invalid subcommand name for iteration - use the 'run' keyword if you wish to execute a script");let c=this.all?n.topLevelWorkspace:s,p=this.since?Array.from(await gr.gitUtils.fetchChangedWorkspaces({ref:this.since,project:n})):[c,...this.from.length>0?c.getRecursiveWorkspaceChildren():[]],m=g=>Oe.default.isMatch(F.structUtils.stringifyIdent(g.locator),this.from),h=this.from.length>0?p.filter(m):p,R=new Set([...h,...h.map(g=>[...this.recursive?this.since?g.getRecursiveWorkspaceDependents():g.getRecursiveWorkspaceDependencies():g.getRecursiveWorkspaceChildren()]).flat()]),f=[],$=!1;if(a!=null&&a.includes(":")){for(let g of n.workspaces)if(g.manifest.scripts.has(a)&&($=!$,$===!1))break}for(let g of R)a&&!g.manifest.scripts.has(a)&&!$&&!(await ge.scriptUtils.getWorkspaceAccessibleBinaries(g)).has(a)||a===process.env.npm_lifecycle_event&&g.cwd===s.cwd||this.include.length>0&&!Oe.default.isMatch(F.structUtils.stringifyIdent(g.locator),this.include)||this.exclude.length>0&&Oe.default.isMatch(F.structUtils.stringifyIdent(g.locator),this.exclude)||this.publicOnly&&g.manifest.private===!0||f.push(g);let _=this.parallel?this.jobs==="unlimited"?1/0:Number(this.jobs)||Math.ceil(F.nodeUtils.availableParallelism()/2):1,y=_===1?!1:this.parallel,E=y?this.interlaced:!0,S=(0,Ar.default)(_),T=new Map,L=new Set,z=0,I=null,re=!1,K=await _e.StreamReport.start({configuration:t,stdout:this.context.stdout,includePrefix:!1},async g=>{let v=async(k,{commandIndex:l})=>{if(re)return-1;!y&&this.verbose&&l>1&&g.reportSeparator();let H=qn(k,{configuration:t,verbose:this.verbose,commandIndex:l}),[w,B]=dr(g,{prefix:H,interlaced:E}),[o,u]=dr(g,{prefix:H,interlaced:E});try{this.verbose&&g.reportInfo(null,`${H} Process started`);let P=Date.now(),b=await this.cli.run([this.commandName,...this.args],{cwd:k.cwd,stdout:w,stderr:o})||0;w.end(),o.end(),await B,await u;let V=Date.now();if(this.verbose){let J=t.get("enableTimers")?`, completed in ${F.formatUtils.pretty(t,V-P,F.formatUtils.Type.DURATION)}`:"";g.reportInfo(null,`${H} Process exited (exit code ${b})${J}`)}return b===130&&(re=!0,I=b),b}catch(P){throw w.end(),o.end(),await B,await u,P}};for(let k of f)T.set(k.anchoredLocator.locatorHash,k);for(;T.size>0&&!g.hasErrors();){let k=[];for(let[w,B]of T){if(L.has(B.anchoredDescriptor.descriptorHash))continue;let o=!0;if(this.topological||this.topologicalDev){let u=this.topologicalDev?new Map([...B.manifest.dependencies,...B.manifest.devDependencies]):B.manifest.dependencies;for(let P of u.values()){let b=n.tryWorkspaceByDescriptor(P);if(o=b===null||!T.has(b.anchoredLocator.locatorHash),!o)break}}if(!!o&&(L.add(B.anchoredDescriptor.descriptorHash),k.push(S(async()=>{let u=await v(B,{commandIndex:++z});return T.delete(w),L.delete(B.anchoredDescriptor.descriptorHash),u})),!y))break}if(k.length===0){let w=Array.from(T.values()).map(B=>F.structUtils.prettyLocator(t,B.anchoredLocator)).join(", ");g.reportError(_e.MessageName.CYCLIC_DEPENDENCIES,`Dependency cycle detected (${w})`);return}let H=(await Promise.all(k)).find(w=>w!==0);I===null&&(I=typeof H<"u"?1:I),(this.topological||this.topologicalDev)&&typeof H<"u"&&g.reportError(_e.MessageName.UNNAMED,"The command failed for workspaces that are depended upon by other workspaces; can't satisfy the dependency graph")}});return I!==null?I:K.exitCode()}};pe.paths=[["workspaces","foreach"]],pe.usage=U.Command.Usage({category:"Workspace-related commands",description:"run a command on all workspaces",details:"\n This command will run a given sub-command on current and all its descendant workspaces. Various flags can alter the exact behavior of the command:\n\n - If `-p,--parallel` is set, the commands will be ran in parallel; they'll by default be limited to a number of parallel tasks roughly equal to half your core number, but that can be overridden via `-j,--jobs`, or disabled by setting `-j unlimited`.\n\n - If `-p,--parallel` and `-i,--interlaced` are both set, Yarn will print the lines from the output as it receives them. If `-i,--interlaced` wasn't set, it would instead buffer the output from each process and print the resulting buffers only after their source processes have exited.\n\n - If `-t,--topological` is set, Yarn will only run the command after all workspaces that it depends on through the `dependencies` field have successfully finished executing. If `--topological-dev` is set, both the `dependencies` and `devDependencies` fields will be considered when figuring out the wait points.\n\n - If `-A,--all` is set, Yarn will run the command on all the workspaces of a project. By default yarn runs the command only on current and all its descendant workspaces.\n\n - If `-R,--recursive` is set, Yarn will find workspaces to run the command on by recursively evaluating `dependencies` and `devDependencies` fields, instead of looking at the `workspaces` fields.\n\n - If `--from` is set, Yarn will use the packages matching the 'from' glob as the starting point for any recursive search.\n\n - If `--since` is set, Yarn will only run the command on workspaces that have been modified since the specified ref. By default Yarn will use the refs specified by the `changesetBaseRefs` configuration option.\n\n - The command may apply to only some workspaces through the use of `--include` which acts as a whitelist. The `--exclude` flag will do the opposite and will be a list of packages that mustn't execute the script. Both flags accept glob patterns (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.\n\n Adding the `-v,--verbose` flag will cause Yarn to print more information; in particular the name of the workspace that generated the output will be printed at the front of each line.\n\n If the command is `run` and the script being run does not exist the child workspace will be skipped without error.\n ",examples:[["Publish current and all descendant packages","yarn workspaces foreach npm publish --tolerate-republish"],["Run build script on current and all descendant packages","yarn workspaces foreach run build"],["Run build script on current and all descendant packages in parallel, building package dependencies first","yarn workspaces foreach -pt run build"],["Run build script on several packages and all their dependencies, building dependencies first","yarn workspaces foreach -ptR --from '{workspace-a,workspace-b}' run build"]]});function dr(e,{prefix:r,interlaced:t}){let n=e.createStreamReporter(r),s=new F.miscUtils.DefaultStream;s.pipe(n,{end:!1}),s.on("finish",()=>{n.end()});let i=new Promise(c=>{n.on("finish",()=>{c(s.active)})});if(t)return[s,i];let a=new F.miscUtils.BufferStream;return a.pipe(s,{end:!1}),a.on("finish",()=>{s.end()}),[a,i]}function qn(e,{configuration:r,commandIndex:t,verbose:n}){if(!n)return null;let i=`[${F.structUtils.stringifyIdent(e.locator)}]:`,a=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],c=a[t%a.length];return F.formatUtils.pretty(r,i,c)}var Kn={commands:[ce,pe]},Wn=Kn;return wr(jn);})(); 8 | /*! 9 | * fill-range 10 | * 11 | * Copyright (c) 2014-present, Jon Schlinkert. 12 | * Licensed under the MIT License. 13 | */ 14 | /*! 15 | * is-number 16 | * 17 | * Copyright (c) 2014-present, Jon Schlinkert. 18 | * Released under the MIT License. 19 | */ 20 | /*! 21 | * to-regex-range 22 | * 23 | * Copyright (c) 2015-present, Jon Schlinkert. 24 | * Released under the MIT License. 25 | */ 26 | return plugin; 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /.yarnrc.yml: -------------------------------------------------------------------------------- 1 | nodeLinker: node-modules 2 | nmHoistingLimits: workspaces 3 | 4 | plugins: 5 | - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs 6 | spec: "@yarnpkg/plugin-interactive-tools" 7 | - path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs 8 | spec: "@yarnpkg/plugin-workspace-tools" 9 | 10 | yarnPath: .yarn/releases/yarn-3.6.1.cjs 11 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | 2 | # Contributor Covenant Code of Conduct 3 | 4 | ## Our Pledge 5 | 6 | We as members, contributors, and leaders pledge to make participation in our 7 | community a harassment-free experience for everyone, regardless of age, body 8 | size, visible or invisible disability, ethnicity, sex characteristics, gender 9 | identity and expression, level of experience, education, socio-economic status, 10 | nationality, personal appearance, race, caste, color, religion, or sexual 11 | identity and orientation. 12 | 13 | We pledge to act and interact in ways that contribute to an open, welcoming, 14 | diverse, inclusive, and healthy community. 15 | 16 | ## Our Standards 17 | 18 | Examples of behavior that contributes to a positive environment for our 19 | community include: 20 | 21 | * Demonstrating empathy and kindness toward other people 22 | * Being respectful of differing opinions, viewpoints, and experiences 23 | * Giving and gracefully accepting constructive feedback 24 | * Accepting responsibility and apologizing to those affected by our mistakes, 25 | and learning from the experience 26 | * Focusing on what is best not just for us as individuals, but for the overall 27 | community 28 | 29 | Examples of unacceptable behavior include: 30 | 31 | * The use of sexualized language or imagery, and sexual attention or advances of 32 | any kind 33 | * Trolling, insulting or derogatory comments, and personal or political attacks 34 | * Public or private harassment 35 | * Publishing others' private information, such as a physical or email address, 36 | without their explicit permission 37 | * Other conduct which could reasonably be considered inappropriate in a 38 | professional setting 39 | 40 | ## Enforcement Responsibilities 41 | 42 | Community leaders are responsible for clarifying and enforcing our standards of 43 | acceptable behavior and will take appropriate and fair corrective action in 44 | response to any behavior that they deem inappropriate, threatening, offensive, 45 | or harmful. 46 | 47 | Community leaders have the right and responsibility to remove, edit, or reject 48 | comments, commits, code, wiki edits, issues, and other contributions that are 49 | not aligned to this Code of Conduct, and will communicate reasons for moderation 50 | decisions when appropriate. 51 | 52 | ## Scope 53 | 54 | This Code of Conduct applies within all community spaces, and also applies when 55 | an individual is officially representing the community in public spaces. 56 | Examples of representing our community include using an official e-mail address, 57 | posting via an official social media account, or acting as an appointed 58 | representative at an online or offline event. 59 | 60 | ## Enforcement 61 | 62 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 63 | reported to the community leaders responsible for enforcement at 64 | [INSERT CONTACT METHOD]. 65 | All complaints will be reviewed and investigated promptly and fairly. 66 | 67 | All community leaders are obligated to respect the privacy and security of the 68 | reporter of any incident. 69 | 70 | ## Enforcement Guidelines 71 | 72 | Community leaders will follow these Community Impact Guidelines in determining 73 | the consequences for any action they deem in violation of this Code of Conduct: 74 | 75 | ### 1. Correction 76 | 77 | **Community Impact**: Use of inappropriate language or other behavior deemed 78 | unprofessional or unwelcome in the community. 79 | 80 | **Consequence**: A private, written warning from community leaders, providing 81 | clarity around the nature of the violation and an explanation of why the 82 | behavior was inappropriate. A public apology may be requested. 83 | 84 | ### 2. Warning 85 | 86 | **Community Impact**: A violation through a single incident or series of 87 | actions. 88 | 89 | **Consequence**: A warning with consequences for continued behavior. No 90 | interaction with the people involved, including unsolicited interaction with 91 | those enforcing the Code of Conduct, for a specified period of time. This 92 | includes avoiding interactions in community spaces as well as external channels 93 | like social media. Violating these terms may lead to a temporary or permanent 94 | ban. 95 | 96 | ### 3. Temporary Ban 97 | 98 | **Community Impact**: A serious violation of community standards, including 99 | sustained inappropriate behavior. 100 | 101 | **Consequence**: A temporary ban from any sort of interaction or public 102 | communication with the community for a specified period of time. No public or 103 | private interaction with the people involved, including unsolicited interaction 104 | with those enforcing the Code of Conduct, is allowed during this period. 105 | Violating these terms may lead to a permanent ban. 106 | 107 | ### 4. Permanent Ban 108 | 109 | **Community Impact**: Demonstrating a pattern of violation of community 110 | standards, including sustained inappropriate behavior, harassment of an 111 | individual, or aggression toward or disparagement of classes of individuals. 112 | 113 | **Consequence**: A permanent ban from any sort of public interaction within the 114 | community. 115 | 116 | ## Attribution 117 | 118 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 119 | version 2.1, available at 120 | [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. 121 | 122 | Community Impact Guidelines were inspired by 123 | [Mozilla's code of conduct enforcement ladder][Mozilla CoC]. 124 | 125 | For answers to common questions about this code of conduct, see the FAQ at 126 | [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at 127 | [https://www.contributor-covenant.org/translations][translations]. 128 | 129 | [homepage]: https://www.contributor-covenant.org 130 | [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html 131 | [Mozilla CoC]: https://github.com/mozilla/diversity 132 | [FAQ]: https://www.contributor-covenant.org/faq 133 | [translations]: https://www.contributor-covenant.org/translations 134 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions are always welcome, no matter how large or small! 4 | 5 | We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. Before contributing, please read the [code of conduct](./CODE_OF_CONDUCT.md). 6 | 7 | ## Development workflow 8 | 9 | This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/features/workspaces). It contains the following packages: 10 | 11 | - The library package in the root directory. 12 | - An example app in the `example/` directory. 13 | 14 | To get started with the project, run `yarn` in the root directory to install the required dependencies for each package: 15 | 16 | ```sh 17 | yarn 18 | ``` 19 | 20 | > Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development. 21 | 22 | The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make. 23 | 24 | It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app. 25 | 26 | You can use various commands from the root directory to work with the project. 27 | 28 | To start the packager: 29 | 30 | ```sh 31 | yarn example start 32 | ``` 33 | 34 | To run the example app on Android: 35 | 36 | ```sh 37 | yarn example android 38 | ``` 39 | 40 | To run the example app on iOS: 41 | 42 | ```sh 43 | yarn example ios 44 | ``` 45 | 46 | To run the example app on Web: 47 | 48 | ```sh 49 | yarn example web 50 | ``` 51 | 52 | Make sure your code passes TypeScript and ESLint. Run the following to verify: 53 | 54 | ```sh 55 | yarn typecheck 56 | yarn lint 57 | ``` 58 | 59 | To fix formatting errors, run the following: 60 | 61 | ```sh 62 | yarn lint --fix 63 | ``` 64 | 65 | Remember to add tests for your change if possible. Run the unit tests by: 66 | 67 | ```sh 68 | yarn test 69 | ``` 70 | 71 | ### Commit message convention 72 | 73 | We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages: 74 | 75 | - `fix`: bug fixes, e.g. fix crash due to deprecated method. 76 | - `feat`: new features, e.g. add new method to the module. 77 | - `refactor`: code refactor, e.g. migrate from class components to hooks. 78 | - `docs`: changes into documentation, e.g. add usage example for the module.. 79 | - `test`: adding or updating tests, e.g. add integration tests using detox. 80 | - `chore`: tooling changes, e.g. change CI config. 81 | 82 | Our pre-commit hooks verify that your commit message matches this format when committing. 83 | 84 | ### Linting and tests 85 | 86 | [ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/) 87 | 88 | We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing. 89 | 90 | Our pre-commit hooks verify that the linter and tests pass when committing. 91 | 92 | ### Publishing to npm 93 | 94 | We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc. 95 | 96 | To publish new versions, run the following: 97 | 98 | ```sh 99 | yarn release 100 | ``` 101 | 102 | ### Scripts 103 | 104 | The `package.json` file contains various scripts for common tasks: 105 | 106 | - `yarn`: setup project by installing dependencies. 107 | - `yarn typecheck`: type-check files with TypeScript. 108 | - `yarn lint`: lint files with ESLint. 109 | - `yarn test`: run unit tests with Jest. 110 | - `yarn example start`: start the Metro server for the example app. 111 | - `yarn example android`: run the example app on Android. 112 | - `yarn example ios`: run the example app on iOS. 113 | 114 | ### Sending a pull request 115 | 116 | > **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github). 117 | 118 | When you're sending a pull request: 119 | 120 | - Prefer small pull requests focused on one change. 121 | - Verify that linters and tests are passing. 122 | - Review the documentation to make sure it looks good. 123 | - Follow the pull request template when opening a pull request. 124 | - For pull requests that change the API or implementation, discuss with maintainers first by opening an issue. 125 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Dmitrii Kolesnikov 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-native-alert-queue 2 | 3 | A fully customizable alert system for React Native with promise-based API and queue support 4 | 5 | [![npm version](https://img.shields.io/npm/v/react-native-alert-queue?style=flat-square)](https://www.npmjs.com/package/react-native-alert-queue) 6 | [![npm downloads](https://img.shields.io/npm/dm/react-native-alert-queue?style=flat-square)](https://www.npmjs.com/package/react-native-alert-queue) 7 | [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://opensource.org/licenses/MIT) 8 | [![GitHub Sponsors](https://img.shields.io/github/sponsors/xxsnakerxx?style=flat-square)](https://github.com/sponsors/xxsnakerxx) 9 | 10 | ![Made with Love](https://img.shields.io/badge/Made%20with-%E2%9D%A4-red?style=flat-square) 11 | [![Built with create-react-native-library](https://img.shields.io/badge/built%20with-create--react--native--library-9cf?style=flat-square)](https://github.com/callstack/react-native-builder-bob) 12 | [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) 13 | 14 | ## Key Features 15 | 16 | - ⚡ Easy `async/await` usage (`await alert.show()`) 17 | - ⏳ Sequential alert queue management 18 | - 🛠️ Realtime UI update: dynamically update alert title, message, buttons, and more 19 | - 🎨 Full UI customization with slots and custom renderers 20 | - 🖼️ SVG icon support 21 | - ⚙️ Global styling and behavior configuration 22 | - ✅ Built-in helpers for success, error, and confirm dialogs 23 | - 🎉 Confetti support 24 | - 🌐 React Native Web support 25 | 26 | ## 📺 Demo 27 | 28 | See how `react-native-alert-queue` works in action! 🚀 29 | 30 | --- 31 | 32 | ### 🛠 Basics 33 | 34 | Basic usage: 35 | 36 | ![Basics Demo](./demo/basics.gif) 37 | 38 | --- 39 | 40 | ### 🎨 Customizations 41 | 42 | Custom titles, messages, icons, buttons, and slots: 43 | 44 | ![Customizations Demo](./demo/customizations.gif) 45 | 46 | --- 47 | 48 | ### 🔄 Real-Time Updating 49 | 50 | Dynamically update the alert while it's displayed: 51 | 52 | ![Updating Demo](./demo/updating.gif) 53 | 54 | --- 55 | 56 | ### 🎹 Keyboard Avoidance 57 | 58 | Alerts automatically adjust position when the keyboard appears: 59 | 60 | ![Keyboard Avoidance Demo](./demo/keyboard.gif) 61 | 62 | --- 63 | 64 | ### 🎉 Confetti Animation 65 | 66 | Celebrate success with built-in confetti effects: 67 | 68 | ![Confetti Demo](./demo/confetti.gif) 69 | 70 | --- 71 | 72 | ## Requirements 73 | 74 | - `2.x` versions require [`react-native-reanimated 3.x`](https://docs.swmansion.com/react-native-reanimated/). 75 | - If your project does not use Reanimated, you can use `react-native-alert-queue@1.x`. 76 | 77 | Install `RN Reanimated` following [their official guide](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started#installation). 78 | 79 | ## Installation 80 | 81 | ```sh 82 | npm install react-native-alert-queue 83 | # or 84 | yarn add react-native-alert-queue 85 | ``` 86 | 87 | ## Usage 88 | 89 | > ⚡ **Full working examples available!** 90 | > Explore the [example app here](https://github.com/xxsnakerxx/react-native-alert-queue/tree/main/example/src/containers) to see all features in action. 91 | 92 | ### Basic Setup 93 | 94 | First, add the `AlertContainer` to your app: 95 | 96 | ```tsx 97 | import { AlertContainer } from 'react-native-alert-queue'; 98 | 99 | function App() { 100 | return ( 101 | 102 | {/* Your app content */} 103 | 104 | 105 | ); 106 | } 107 | ``` 108 | 109 | ### Showing Alerts 110 | 111 | Any where in your app you can show alerts by using the `alert` object: 112 | 113 | ```tsx 114 | import { alert } from 'react-native-alert-queue'; 115 | 116 | // Basic alert 117 | alert.show({ 118 | title: 'Hello', 119 | message: 'I am an alert', 120 | }); 121 | 122 | // Success alert 123 | alert.success({ 124 | message: 'Operation successful', 125 | }); 126 | 127 | // Error alert 128 | alert.error(new Error('Something went wrong')); 129 | 130 | // Confirm dialog 131 | const result = await alert.confirm({ 132 | message: 'Are you sure you want to proceed?', 133 | }); 134 | ``` 135 | 136 | ### Alert Types 137 | 138 | #### Basic Alert 139 | 140 | ```tsx 141 | alert.show({ 142 | title: 'Custom Alert', 143 | message: 'This is a custom alert', 144 | buttons: [ 145 | { 146 | text: 'OK!', 147 | onPress: () => console.log('OK pressed'), 148 | }, 149 | ], 150 | }); 151 | ``` 152 | 153 | #### Success Alert 154 | 155 | ```tsx 156 | alert.success({ 157 | message: 'Operation completed successfully', 158 | }); 159 | ``` 160 | 161 | #### Error Alert 162 | 163 | ```tsx 164 | alert.error(new Error('Operation failed')); 165 | ``` 166 | 167 | #### Confirm Dialog 168 | 169 | ```tsx 170 | const result = await alert.confirm({ 171 | message: 'Are you sure you want to proceed?', 172 | }); 173 | ``` 174 | 175 | ### Confetti 176 | 177 | ```tsx 178 | alert.show({ 179 | message: 'Welcome to the app!', 180 | confetti: true, 181 | }); 182 | ``` 183 | 184 | ```tsx 185 | alert.show({ 186 | title: 'Congratulations!', 187 | message: 'You are a winner!', 188 | confetti: { 189 | colors: ['#4CAF50', '#8BC34A', '#CDDC39', '#81C784', '#A5D6A7', '#C8E6C9'], 190 | numberOfPieces: 200, 191 | pieceDimensions: { 192 | height: 10, 193 | width: 30, 194 | }, 195 | }, 196 | }); 197 | ``` 198 | 199 | Confetti can be used with any alert type. Also, you can customize the confetti appearance globally in the config. 200 | 201 | ### Advanced Features 202 | 203 | #### Custom Helper Functions 204 | 205 | You can create your own helper functions to simplify common alert patterns in your app: 206 | 207 | ```tsx 208 | const transactionCompletedAlert = (amount: string) => 209 | alert.show({ 210 | title: 'Transaction Complete', 211 | message: `Successfully transferred ${amount}`, 212 | icon: SuccessIcon, 213 | buttons: [ 214 | { 215 | text: 'View Details', 216 | onPress: () => navigateToTransactionDetails(), 217 | }, 218 | { 219 | text: 'Done', 220 | }, 221 | ], 222 | }); 223 | 224 | // Create a custom error alert for network issues 225 | const networkErrorAlert = (retryCallback: () => void) => 226 | alert.show({ 227 | title: 'Network Error', 228 | message: 'Network connection lost', 229 | icon: NetworkErrorIcon, 230 | buttons: [ 231 | { 232 | text: 'Retry', 233 | onPress: retryCallback, 234 | }, 235 | { 236 | text: 'Cancel', 237 | }, 238 | ], 239 | }); 240 | 241 | // Usage 242 | await transactionCompletedAlert('$100.00'); 243 | 244 | networkErrorAlert(() => fetchData()); 245 | ``` 246 | 247 | #### Custom Rendering 248 | 249 | ```tsx 250 | alert.show({ 251 | title: 'Custom Alert', 252 | message: 'This alert has custom rendering', 253 | renderTitle: ({ style, text }) => ( 254 | {text} 255 | ), 256 | renderMessage: ({ style, text }) => ( 257 | {text} 258 | ), 259 | renderButton: (props) => ( 260 | 265 | {props.text} 266 | 267 | ), 268 | renderDismissButton: ({ onPress }) => ( 269 | 270 | × 271 | 272 | ), 273 | }); 274 | ``` 275 | 276 | #### Slots 277 | 278 | Slots allow you to inject custom content at specific positions within the alert: 279 | 280 | ```tsx 281 | alert.show({ 282 | title: 'Alert with Slots', 283 | message: 'This alert uses slots for custom content', 284 | // Content before the title 285 | beforeTitleSlot: () => ( 286 | 287 | New 288 | 289 | ), 290 | // Content before the message 291 | beforeMessageSlot: () => , 292 | // Content before the buttons 293 | beforeButtonsSlot: () => ( 294 | 295 | By continuing you agree to our terms 296 | 297 | ), 298 | // Content after the buttons 299 | afterButtonsSlot: () => ( 300 | 301 | Need help? Contact support 302 | 303 | ), 304 | }); 305 | ``` 306 | 307 | #### Async Operations 308 | 309 | ```tsx 310 | const result = await alert.show({ 311 | title: 'Async Operation', 312 | buttons: [ 313 | { 314 | text: 'Confirm', 315 | onAwaitablePress: async (resolve) => { 316 | // Perform async operation 317 | resolve('Operation completed'); 318 | }, 319 | }, 320 | { 321 | text: 'Cancel', 322 | onAwaitablePress: async (resolve) => { 323 | resolve(null); 324 | }, 325 | }, 326 | ], 327 | }); 328 | ``` 329 | 330 | #### Queue Management 331 | 332 | ```tsx 333 | // These alerts will be shown in sequence 334 | alert.show({ message: 'First alert' }); 335 | alert.show({ message: 'Second alert' }); 336 | alert.show({ message: 'Third alert' }); 337 | ``` 338 | 339 | #### Custom Button Props 340 | 341 | You can extend the `AlertButtonCustomProps` interface to add custom properties to your buttons using TypeScript declaration merging: 342 | 343 | ```tsx 344 | // In your project's type declaration file (e.g., types.d.ts) 345 | import 'react-native-alert-queue'; 346 | 347 | declare module 'react-native-alert-queue' { 348 | interface AlertButtonCustomProps { 349 | // Add your custom props here 350 | variant?: 'primary' | 'secondary' | 'danger'; 351 | size?: 'small' | 'medium' | 'large'; 352 | isLoading?: boolean; 353 | // ... any other custom props 354 | } 355 | } 356 | 357 | // Usage in your components 358 | alert.show({ 359 | title: 'Custom Button Props', 360 | message: 'This alert uses custom button props', 361 | buttons: [ 362 | { 363 | text: 'Primary Button', 364 | customProps: { 365 | variant: 'primary', 366 | size: 'large', 367 | isLoading: true, 368 | }, 369 | }, 370 | { 371 | text: 'Secondary Button', 372 | customProps: { 373 | variant: 'secondary', 374 | size: 'medium', 375 | }, 376 | }, 377 | ], 378 | // you can define it globally in the config or override it here 379 | renderButton: (props) => ( 380 | 389 | {props.customProps.isLoading ? ( 390 | 391 | ) : ( 392 | {props.text} 393 | )} 394 | 395 | ), 396 | }); 397 | ``` 398 | 399 | ### Configuration 400 | 401 | You can customize the default appearance and behavior of alerts using the `config` prop: 402 | 403 | ```tsx 404 | 432 | ``` 433 | 434 | ### API Reference 435 | 436 | #### Alert Methods 437 | 438 | - `show(alert: AlertProps)` - Shows a custom alert 439 | - `success(alert: AlertProps)` - Shows a success alert 440 | - `error(error: Error, isFixable?: boolean)` - Shows an error alert 441 | - `confirm(alert?: ConfirmProps)` - Shows a confirmation dialog 442 | - `hide()` - Hides the currently displayed alert 443 | - `clearQueue(hideDisplayedAlert?: boolean)` - Clears the alert queue 444 | - `update(id: string, alert: AlertProps)` - Updates an existing alert 445 | - `getAlertData(id: string)` - Retrieves alert data by ID 446 | 447 | #### Alert Props 448 | 449 | - `id?: string` - Unique identifier 450 | - `title?: string` - Alert title 451 | - `message?: string` - Alert message 452 | - `testID?: string` - Test identifier 453 | - `isDismissible?: boolean` - Whether alert can be dismissed 454 | - `buttonsDirection?: 'row' | 'column'` - Button layout direction 455 | - `icon?: FC` - Custom icon component 456 | - `iconColor?: ColorValue` - Icon color 457 | - `iconSize?: number` - Icon size 458 | - `buttons?: AlertButton[]` - Array of buttons 459 | - `confetti?: boolean | ConfettiProps` - Confetti configuration 460 | - `renderMessage?: ({ style, text }) => ReactElement` - Custom message renderer 461 | - `renderTitle?: ({ style, text }) => ReactElement` - Custom title renderer 462 | - `renderButton?: (props) => ReactElement` - Custom button renderer 463 | - `renderDismissButton?: ({ onPress }) => ReactElement` - Custom dismiss button renderer 464 | - `beforeTitleSlot?: () => ReactElement` - Content to render before the title 465 | - `beforeMessageSlot?: () => ReactElement` - Content to render before the message 466 | - `beforeButtonsSlot?: () => ReactElement` - Content to render before the buttons 467 | - `afterButtonsSlot?: () => ReactElement` - Content to render after the buttons 468 | 469 | #### AlertButton Props 470 | 471 | - `text: string` - Button text 472 | - `onPress?: () => Promise | R` - Press handler 473 | - `disabled?: boolean` - Whether button is disabled 474 | - `testID?: string` - Test identifier 475 | - `hideAlertOnPress?: boolean` - Whether to hide alert on press 476 | - `onAwaitablePress?: (resolve) => void` - Async press handler 477 | - `customProps?: AlertButtonCustomProps` - Custom button properties 478 | 479 | #### AlertConfig 480 | 481 | ```tsx 482 | type AlertConfig = { 483 | // Test identifier for the alert 484 | testID?: string; 485 | 486 | // Background color of the backdrop 487 | backdropBackgroundColor?: ColorValue; 488 | 489 | // Custom alert style 490 | alertStyle?: StyleProp; 491 | 492 | // Default success alert configuration 493 | success?: { 494 | // Custom icon component for success alerts 495 | icon?: FC; 496 | // Icon color for success alerts 497 | iconColor?: ColorValue; 498 | // Icon size for success alerts 499 | iconSize?: number; 500 | // Default title for success alerts 501 | title?: string; 502 | }; 503 | 504 | // Default error alert configuration 505 | error?: { 506 | // Custom icon component for error alerts 507 | icon?: FC; 508 | // Icon color for error alerts 509 | iconColor?: ColorValue; 510 | // Icon size for error alerts 511 | iconSize?: number; 512 | // Default title for error alerts 513 | title?: string; 514 | }; 515 | 516 | // Default confirm dialog configuration 517 | confirm?: { 518 | // Custom icon component for confirm dialogs 519 | icon?: FC; 520 | // Icon color for confirm dialogs 521 | iconColor?: ColorValue; 522 | // Icon size for confirm dialogs 523 | iconSize?: number; 524 | // Default title for confirm dialogs 525 | title?: string; 526 | // Default button texts for confirm dialogs 527 | buttons?: { 528 | text: string; 529 | customProps?: AlertButtonCustomProps; 530 | }[]; 531 | }; 532 | 533 | // Global icon configuration 534 | icon?: { 535 | // Default icon size 536 | size?: number; 537 | // Default icon color 538 | color?: ColorValue; 539 | }; 540 | 541 | // Confetti configuration 542 | confetti?: ConfettiProps; 543 | 544 | // Custom renderers for alert components 545 | renderTitle?: AlertProps['renderTitle']; 546 | renderMessage?: AlertProps['renderMessage']; 547 | renderDismissButton?: AlertProps['renderDismissButton']; 548 | 549 | // Custom slots for additional content 550 | afterButtonsSlot?: AlertProps['afterButtonsSlot']; 551 | beforeButtonsSlot?: AlertProps['beforeButtonsSlot']; 552 | beforeMessageSlot?: AlertProps['beforeMessageSlot']; 553 | beforeTitleSlot?: AlertProps['beforeTitleSlot']; 554 | 555 | // Button configuration 556 | buttons?: { 557 | // Gap between buttons 558 | gap?: number; 559 | // Custom button renderer 560 | render?: AlertProps['renderButton']; 561 | // Default button configuration 562 | default?: { 563 | // Default button text 564 | text?: string; 565 | // Default button testID 566 | testID?: string; 567 | }; 568 | }; 569 | }; 570 | ``` 571 | 572 | ## Contributing 573 | 574 | See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow. 575 | 576 | ## License 577 | 578 | MIT 579 | 580 | --- 581 | 582 | Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob) 583 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:react-native-builder-bob/babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /demo/basics.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxsnakerxx/react-native-alert-queue/77026dd1859a646e7e4722521f57c2f433c72e7f/demo/basics.gif -------------------------------------------------------------------------------- /demo/confetti.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxsnakerxx/react-native-alert-queue/77026dd1859a646e7e4722521f57c2f433c72e7f/demo/confetti.gif -------------------------------------------------------------------------------- /demo/customizations.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxsnakerxx/react-native-alert-queue/77026dd1859a646e7e4722521f57c2f433c72e7f/demo/customizations.gif -------------------------------------------------------------------------------- /demo/keyboard.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxsnakerxx/react-native-alert-queue/77026dd1859a646e7e4722521f57c2f433c72e7f/demo/keyboard.gif -------------------------------------------------------------------------------- /demo/updating.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxsnakerxx/react-native-alert-queue/77026dd1859a646e7e4722521f57c2f433c72e7f/demo/updating.gif -------------------------------------------------------------------------------- /eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import { fixupConfigRules } from '@eslint/compat'; 2 | import { FlatCompat } from '@eslint/eslintrc'; 3 | import js from '@eslint/js'; 4 | import prettier from 'eslint-plugin-prettier'; 5 | import { defineConfig } from 'eslint/config'; 6 | import path from 'node:path'; 7 | import { fileURLToPath } from 'node:url'; 8 | 9 | const __filename = fileURLToPath(import.meta.url); 10 | const __dirname = path.dirname(__filename); 11 | const compat = new FlatCompat({ 12 | baseDirectory: __dirname, 13 | recommendedConfig: js.configs.recommended, 14 | allConfig: js.configs.all, 15 | }); 16 | 17 | export default defineConfig([ 18 | { 19 | extends: fixupConfigRules(compat.extends('@react-native', 'prettier')), 20 | plugins: { prettier }, 21 | rules: { 22 | 'react/react-in-jsx-scope': 'off', 23 | 'prettier/prettier': [ 24 | 'error', 25 | { 26 | quoteProps: 'consistent', 27 | singleQuote: true, 28 | tabWidth: 2, 29 | trailingComma: 'es5', 30 | useTabs: false, 31 | }, 32 | ], 33 | 'no-console': 'error', 34 | }, 35 | }, 36 | { 37 | ignores: ['node_modules/', 'lib/'], 38 | }, 39 | ]); 40 | -------------------------------------------------------------------------------- /example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "expo": { 3 | "name": "example", 4 | "slug": "example", 5 | "version": "1.0.0", 6 | "orientation": "portrait", 7 | "icon": "./assets/icon.png", 8 | "userInterfaceStyle": "light", 9 | "newArchEnabled": true, 10 | "splash": { 11 | "image": "./assets/splash-icon.png", 12 | "resizeMode": "contain", 13 | "backgroundColor": "#ffffff" 14 | }, 15 | "ios": { 16 | "supportsTablet": true, 17 | "bundleIdentifier": "alertqueue.example" 18 | }, 19 | "android": { 20 | "adaptiveIcon": { 21 | "foregroundImage": "./assets/adaptive-icon.png", 22 | "backgroundColor": "#ffffff" 23 | }, 24 | "package": "alertqueue.example" 25 | }, 26 | "web": { 27 | "favicon": "./assets/favicon.png" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /example/assets/adaptive-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxsnakerxx/react-native-alert-queue/77026dd1859a646e7e4722521f57c2f433c72e7f/example/assets/adaptive-icon.png -------------------------------------------------------------------------------- /example/assets/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxsnakerxx/react-native-alert-queue/77026dd1859a646e7e4722521f57c2f433c72e7f/example/assets/favicon.png -------------------------------------------------------------------------------- /example/assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxsnakerxx/react-native-alert-queue/77026dd1859a646e7e4722521f57c2f433c72e7f/example/assets/icon.png -------------------------------------------------------------------------------- /example/assets/splash-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxsnakerxx/react-native-alert-queue/77026dd1859a646e7e4722521f57c2f433c72e7f/example/assets/splash-icon.png -------------------------------------------------------------------------------- /example/babel.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const { getConfig } = require('react-native-builder-bob/babel-config'); 3 | const pkg = require('../package.json'); 4 | 5 | const root = path.resolve(__dirname, '..'); 6 | 7 | module.exports = function (api) { 8 | api.cache(true); 9 | 10 | return getConfig( 11 | { 12 | presets: ['babel-preset-expo'], 13 | }, 14 | { root, pkg } 15 | ); 16 | }; 17 | -------------------------------------------------------------------------------- /example/index.js: -------------------------------------------------------------------------------- 1 | import { registerRootComponent } from 'expo'; 2 | 3 | import App from './src/App'; 4 | 5 | // registerRootComponent calls AppRegistry.registerComponent('main', () => App); 6 | // It also ensures that whether you load the app in Expo Go or in a native build, 7 | // the environment is set up appropriately 8 | registerRootComponent(App); 9 | -------------------------------------------------------------------------------- /example/metro.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const { getDefaultConfig } = require('@expo/metro-config'); 3 | const { getConfig } = require('react-native-builder-bob/metro-config'); 4 | const pkg = require('../package.json'); 5 | 6 | const root = path.resolve(__dirname, '..'); 7 | 8 | /** 9 | * Metro configuration 10 | * https://facebook.github.io/metro/docs/configuration 11 | * 12 | * @type {import('metro-config').MetroConfig} 13 | */ 14 | module.exports = getConfig(getDefaultConfig(__dirname), { 15 | root, 16 | pkg, 17 | project: __dirname, 18 | }); 19 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-alert-queue-example", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "start": "expo start", 7 | "android": "expo start --android", 8 | "ios": "expo start --ios", 9 | "web": "expo start --web" 10 | }, 11 | "dependencies": { 12 | "@expo/metro-runtime": "~4.0.1", 13 | "expo": "~52.0.46", 14 | "expo-status-bar": "~2.0.1", 15 | "react": "18.3.1", 16 | "react-dom": "18.3.1", 17 | "react-native": "0.76.9", 18 | "react-native-reanimated": "~3.16.1", 19 | "react-native-safe-area-context": "4.12.0", 20 | "react-native-web": "0.19.13" 21 | }, 22 | "devDependencies": { 23 | "@babel/core": "^7.20.0", 24 | "react-native-builder-bob": "^0.40.6" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /example/src/App.tsx: -------------------------------------------------------------------------------- 1 | import { Text, View, StyleSheet, ScrollView } from 'react-native'; 2 | 3 | import { AlertContainer } from 'react-native-alert-queue'; 4 | 5 | import { SafeAreaView, SafeAreaProvider } from 'react-native-safe-area-context'; 6 | import { Basics } from './containers/Basics'; 7 | import { Customizations } from './containers/Customizations'; 8 | import { Updating } from './containers/Updating'; 9 | import { KeyboardAvoiding } from './containers/Keyboard'; 10 | import { Confetti } from './containers/Confetti'; 11 | 12 | export default function App() { 13 | return ( 14 | 15 | 16 | 17 | React Native Alert Queue 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | ); 30 | } 31 | 32 | const styles = StyleSheet.create({ 33 | container: { 34 | flex: 1, 35 | }, 36 | wrapper: { 37 | flex: 1, 38 | }, 39 | scrollViewContent: { 40 | paddingHorizontal: 20, 41 | paddingBottom: 20, 42 | }, 43 | title: { 44 | fontSize: 26, 45 | fontWeight: 'bold', 46 | marginVertical: 20, 47 | textAlign: 'center', 48 | }, 49 | }); 50 | -------------------------------------------------------------------------------- /example/src/components/Button/index.tsx: -------------------------------------------------------------------------------- 1 | import { Pressable, StyleSheet, Text } from 'react-native'; 2 | 3 | export const Button = ({ 4 | onPress, 5 | text, 6 | }: { 7 | onPress: () => void; 8 | text: string; 9 | }) => { 10 | return ( 11 | 12 | {text} 13 | 14 | ); 15 | }; 16 | 17 | const styles = StyleSheet.create({ 18 | button: { 19 | backgroundColor: '#f0f0f0', 20 | borderRadius: 10, 21 | paddingVertical: 10, 22 | paddingHorizontal: 20, 23 | }, 24 | text: { 25 | color: 'black', 26 | fontSize: 16, 27 | textAlign: 'center', 28 | }, 29 | }); 30 | -------------------------------------------------------------------------------- /example/src/components/Section/index.tsx: -------------------------------------------------------------------------------- 1 | import type { FC, PropsWithChildren } from 'react'; 2 | import { StyleSheet, Text, View } from 'react-native'; 3 | 4 | type Props = PropsWithChildren<{ 5 | title: string; 6 | }>; 7 | 8 | export const Section: FC = ({ children, title }) => { 9 | return ( 10 | 11 | {title} 12 | {children} 13 | 14 | ); 15 | }; 16 | 17 | const styles = StyleSheet.create({ 18 | title: { 19 | fontSize: 20, 20 | fontWeight: 'bold', 21 | marginVertical: 20, 22 | }, 23 | container: { 24 | gap: 10, 25 | }, 26 | }); 27 | -------------------------------------------------------------------------------- /example/src/components/icons/Danger.tsx: -------------------------------------------------------------------------------- 1 | import Svg, { type SvgProps, Path } from 'react-native-svg'; 2 | 3 | export const DangerIcon = (props: SvgProps) => ( 4 | 5 | 9 | 14 | 15 | ); 16 | -------------------------------------------------------------------------------- /example/src/containers/Basics.tsx: -------------------------------------------------------------------------------- 1 | import { alert } from 'react-native-alert-queue'; 2 | import { Button } from '../components/Button'; 3 | import { Section } from '../components/Section'; 4 | 5 | export const Basics = () => { 6 | return ( 7 |
8 |
114 | ); 115 | }; 116 | -------------------------------------------------------------------------------- /example/src/containers/Confetti.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable react/no-unstable-nested-components */ 2 | /* eslint-disable react-native/no-inline-styles */ 3 | 4 | import { alert } from 'react-native-alert-queue'; 5 | import { Button } from '../components/Button'; 6 | import { Section } from '../components/Section'; 7 | import { Text, View } from 'react-native'; 8 | 9 | export const Confetti = () => { 10 | return ( 11 |
12 |
70 | ); 71 | }; 72 | -------------------------------------------------------------------------------- /example/src/containers/Customizations.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable react-native/no-inline-styles */ 2 | /* eslint-disable react/no-unstable-nested-components */ 3 | 4 | import { alert, type AlertButtonCustomProps } from 'react-native-alert-queue'; 5 | import { Button } from '../components/Button'; 6 | import { Section } from '../components/Section'; 7 | import { 8 | Pressable, 9 | StyleSheet, 10 | Text, 11 | View, 12 | type ColorValue, 13 | type StyleProp, 14 | type ViewStyle, 15 | } from 'react-native'; 16 | import { DangerIcon } from '../components/icons/Danger'; 17 | 18 | export const Customizations = () => { 19 | return ( 20 |
21 |
180 | ); 181 | }; 182 | 183 | const Slot = ({ 184 | text, 185 | style, 186 | }: { 187 | text: string; 188 | style?: StyleProp; 189 | }) => { 190 | return ( 191 | 192 | {text} 193 | 194 | ); 195 | }; 196 | 197 | const CustomButton = ({ 198 | text, 199 | onPress, 200 | disabled, 201 | testID, 202 | customProps, 203 | }: { 204 | text: string; 205 | onPress: () => void; 206 | disabled?: boolean; 207 | testID?: string; 208 | customProps?: AlertButtonCustomProps; 209 | }) => { 210 | const { scheme } = customProps || {}; 211 | 212 | let backgroundColor: ColorValue = 'black'; 213 | 214 | switch (scheme) { 215 | case 'primary': 216 | backgroundColor = 'green'; 217 | break; 218 | case 'secondary': 219 | backgroundColor = 'blue'; 220 | break; 221 | } 222 | 223 | return ( 224 | 232 | {text} 233 | 234 | ); 235 | }; 236 | 237 | const styles = StyleSheet.create({ 238 | slot: { 239 | backgroundColor: 'black', 240 | padding: 10, 241 | }, 242 | slotText: { 243 | color: 'white', 244 | fontSize: 16, 245 | fontWeight: 'bold', 246 | }, 247 | button: { 248 | backgroundColor: 'black', 249 | padding: 10, 250 | borderRadius: 999, 251 | }, 252 | buttonText: { 253 | color: 'white', 254 | fontSize: 16, 255 | fontWeight: 'bold', 256 | textAlign: 'center', 257 | }, 258 | }); 259 | -------------------------------------------------------------------------------- /example/src/containers/Keyboard.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable react-native/no-inline-styles */ 2 | 3 | import { alert } from 'react-native-alert-queue'; 4 | import { Button } from '../components/Button'; 5 | import { Section } from '../components/Section'; 6 | import { TextInput } from 'react-native'; 7 | 8 | export const KeyboardAvoiding = () => { 9 | return ( 10 |
11 |
50 | ); 51 | }; 52 | -------------------------------------------------------------------------------- /example/src/containers/Updating.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable react-native/no-inline-styles */ 2 | 3 | import { alert } from 'react-native-alert-queue'; 4 | import { Button } from '../components/Button'; 5 | import { Section } from '../components/Section'; 6 | import { ActivityIndicator, Text, View } from 'react-native'; 7 | 8 | export const Updating = () => { 9 | return ( 10 |
11 |
102 | ); 103 | }; 104 | -------------------------------------------------------------------------------- /example/src/types/react-native-alert-queue.d.ts: -------------------------------------------------------------------------------- 1 | import 'react-native-alert-queue'; 2 | 3 | declare module 'react-native-alert-queue' { 4 | export interface AlertButtonCustomProps { 5 | scheme?: 'primary' | 'secondary'; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig", 3 | "compilerOptions": { 4 | // Avoid expo-cli auto-generating a tsconfig 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /lefthook.yml: -------------------------------------------------------------------------------- 1 | pre-commit: 2 | parallel: true 3 | commands: 4 | lint: 5 | glob: "*.{js,ts,jsx,tsx}" 6 | run: npx eslint {staged_files} 7 | types: 8 | glob: "*.{js,ts, jsx, tsx}" 9 | run: npx tsc 10 | commit-msg: 11 | parallel: true 12 | commands: 13 | commitlint: 14 | run: npx commitlint --edit 15 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-alert-queue", 3 | "version": "2.1.0", 4 | "description": "Fully customizable, promise-based alert system for React Native with queue and async/await support.", 5 | "source": "./src/index.tsx", 6 | "main": "./lib/module/index.js", 7 | "types": "./lib/typescript/src/index.d.ts", 8 | "exports": { 9 | ".": { 10 | "types": "./lib/typescript/src/index.d.ts", 11 | "default": "./lib/module/index.js" 12 | }, 13 | "./package.json": "./package.json" 14 | }, 15 | "files": [ 16 | "src", 17 | "lib", 18 | "android", 19 | "ios", 20 | "cpp", 21 | "*.podspec", 22 | "react-native.config.js", 23 | "!ios/build", 24 | "!android/build", 25 | "!android/gradle", 26 | "!android/gradlew", 27 | "!android/gradlew.bat", 28 | "!android/local.properties", 29 | "!**/__tests__", 30 | "!**/__fixtures__", 31 | "!**/__mocks__", 32 | "!**/.*" 33 | ], 34 | "scripts": { 35 | "example": "yarn workspace react-native-alert-queue-example", 36 | "test": "jest", 37 | "typecheck": "tsc", 38 | "lint": "eslint \"**/*.{js,ts,tsx}\"", 39 | "clean": "del-cli lib", 40 | "prepare": "bob build", 41 | "release": "release-it" 42 | }, 43 | "keywords": [ 44 | "react-native", 45 | "react native", 46 | "alert", 47 | "dialog", 48 | "promise", 49 | "async", 50 | "queue", 51 | "modal", 52 | "ui", 53 | "react" 54 | ], 55 | "repository": { 56 | "type": "git", 57 | "url": "git+https://github.com/xxsnakerxx/react-native-alert-queue.git" 58 | }, 59 | "author": "Dmitrii Kolesnikov (https://github.com/xxsnakerxx)", 60 | "license": "MIT", 61 | "bugs": { 62 | "url": "https://github.com/xxsnakerxx/react-native-alert-queue/issues" 63 | }, 64 | "homepage": "https://github.com/xxsnakerxx/react-native-alert-queue#readme", 65 | "publishConfig": { 66 | "registry": "https://registry.npmjs.org/" 67 | }, 68 | "devDependencies": { 69 | "@commitlint/config-conventional": "^19.6.0", 70 | "@eslint/compat": "^1.2.7", 71 | "@eslint/eslintrc": "^3.3.0", 72 | "@eslint/js": "^9.22.0", 73 | "@evilmartians/lefthook": "^1.5.0", 74 | "@react-native/eslint-config": "^0.78.0", 75 | "@release-it/conventional-changelog": "^9.0.2", 76 | "@types/jest": "^29.5.5", 77 | "@types/react": "^19.0.12", 78 | "commitlint": "^19.6.1", 79 | "del-cli": "^5.1.0", 80 | "eslint": "^9.22.0", 81 | "eslint-config-prettier": "^10.1.1", 82 | "eslint-plugin-prettier": "^5.2.3", 83 | "jest": "^29.7.0", 84 | "prettier": "^3.0.3", 85 | "react": "18.3.1", 86 | "react-native": "0.76.9", 87 | "react-native-builder-bob": "^0.40.6", 88 | "react-native-reanimated": "~3.16.1", 89 | "react-native-svg": "15.8.0", 90 | "release-it": "^17.10.0", 91 | "typescript": "^5.2.2" 92 | }, 93 | "peerDependencies": { 94 | "react": "*", 95 | "react-native": "*", 96 | "react-native-reanimated": "^3.0.0" 97 | }, 98 | "workspaces": [ 99 | "example" 100 | ], 101 | "packageManager": "yarn@3.6.1", 102 | "jest": { 103 | "preset": "react-native", 104 | "modulePathIgnorePatterns": [ 105 | "/example/node_modules", 106 | "/lib/" 107 | ] 108 | }, 109 | "commitlint": { 110 | "extends": [ 111 | "@commitlint/config-conventional" 112 | ], 113 | "rules": { 114 | "header-max-length": [ 115 | 2, 116 | "always", 117 | 140 118 | ] 119 | } 120 | }, 121 | "release-it": { 122 | "git": { 123 | "commitMessage": "chore: release ${version}", 124 | "tagName": "v${version}" 125 | }, 126 | "npm": { 127 | "publish": true 128 | }, 129 | "github": { 130 | "release": true 131 | }, 132 | "plugins": { 133 | "@release-it/conventional-changelog": { 134 | "preset": { 135 | "name": "angular" 136 | } 137 | } 138 | } 139 | }, 140 | "prettier": { 141 | "quoteProps": "consistent", 142 | "singleQuote": true, 143 | "tabWidth": 2, 144 | "trailingComma": "es5", 145 | "useTabs": false 146 | }, 147 | "react-native-builder-bob": { 148 | "source": "src", 149 | "output": "lib", 150 | "targets": [ 151 | [ 152 | "module", 153 | { 154 | "esm": true 155 | } 156 | ], 157 | [ 158 | "typescript", 159 | { 160 | "project": "tsconfig.build.json" 161 | } 162 | ] 163 | ] 164 | }, 165 | "create-react-native-library": { 166 | "languages": "js", 167 | "type": "library", 168 | "version": "0.49.8" 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /src/components/Alert/controller.ts: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react'; 2 | 3 | import type { AlertButton, AlertViewProps } from './types'; 4 | import { alert } from '../../containers/AlertContainer/alert.api'; 5 | 6 | export const useController = ({ 7 | onAwaitableDismiss, 8 | onDismiss, 9 | resolve, 10 | }: AlertViewProps) => { 11 | const onButtonPress = useCallback( 12 | (button: AlertButton) => { 13 | const resolveWrapper = (value: R) => { 14 | resolve(value); 15 | 16 | if (button.hideAlertOnPress !== false) { 17 | alert.hide(); 18 | } 19 | }; 20 | 21 | if (button.onAwaitablePress) { 22 | button.onAwaitablePress(resolveWrapper); 23 | } else { 24 | button.onPress?.(); 25 | 26 | resolveWrapper(undefined as R); 27 | } 28 | }, 29 | [resolve] 30 | ); 31 | 32 | const onDismissButtonPress = useCallback(() => { 33 | const resolveWrapper = (value: R) => { 34 | resolve(value); 35 | 36 | alert.hide(); 37 | }; 38 | 39 | if (onAwaitableDismiss) { 40 | onAwaitableDismiss(resolveWrapper); 41 | } else { 42 | onDismiss?.(); 43 | 44 | resolveWrapper(undefined as R); 45 | } 46 | }, [onAwaitableDismiss, onDismiss, resolve]); 47 | 48 | return { onDismissButtonPress, onButtonPress }; 49 | }; 50 | -------------------------------------------------------------------------------- /src/components/Alert/hooks/useContainerDimensions.ts: -------------------------------------------------------------------------------- 1 | import type { ViewStyle, StyleProp } from 'react-native'; 2 | 3 | import { Platform, useWindowDimensions } from 'react-native'; 4 | 5 | export const useContainerDimensions = (): StyleProp => { 6 | const { width: windowWidth, height: windowHeight } = useWindowDimensions(); 7 | 8 | const maxWidth = Platform.select({ 9 | web: 450, 10 | default: 340, 11 | }); 12 | const maxHeight = Math.round(windowHeight * 0.85); 13 | 14 | return { 15 | width: windowWidth - 10 * 2, 16 | maxWidth, 17 | maxHeight, 18 | }; 19 | }; 20 | -------------------------------------------------------------------------------- /src/components/Alert/index.tsx: -------------------------------------------------------------------------------- 1 | import { 2 | type FC, 3 | Fragment, 4 | type ReactElement, 5 | useCallback, 6 | useMemo, 7 | } from 'react'; 8 | import { 9 | Pressable, 10 | ScrollView, 11 | StyleSheet, 12 | Text, 13 | View, 14 | type StyleProp, 15 | type ViewStyle, 16 | Platform, 17 | } from 'react-native'; 18 | 19 | import Animated, { 20 | useAnimatedStyle, 21 | interpolate, 22 | CurvedTransition, 23 | } from 'react-native-reanimated'; 24 | 25 | import type { AlertViewProps } from './types'; 26 | 27 | import { CloseIcon } from '../../components/icons/Close'; 28 | 29 | import { useAnimation } from '../../hooks/useAnimation'; 30 | import { useController } from './controller'; 31 | import { styles } from './styles'; 32 | import { Button } from '../Button'; 33 | import { useContainerDimensions } from './hooks/useContainerDimensions'; 34 | 35 | export const Alert: FC = (props) => { 36 | const { 37 | afterButtonsSlot, 38 | animationDuration, 39 | beforeButtonsSlot, 40 | beforeMessageSlot, 41 | beforeTitleSlot, 42 | renderDismissButton, 43 | icon, 44 | iconColor, 45 | iconSize, 46 | isDismissible, 47 | isHiding, 48 | testID, 49 | buttons, 50 | buttonsDirection = 'column', 51 | renderButton, 52 | title, 53 | renderTitle, 54 | message, 55 | renderMessage, 56 | config, 57 | } = props; 58 | 59 | const { animation } = useAnimation({ 60 | animationDuration, 61 | isHiding, 62 | }); 63 | 64 | const { onDismissButtonPress, onButtonPress } = useController(props); 65 | 66 | const containerDimensions = useContainerDimensions(); 67 | 68 | const containerAnimation = useAnimatedStyle(() => { 69 | return { 70 | opacity: interpolate(animation.value, [0, 1], [0, 1]), 71 | transform: [ 72 | { 73 | scaleX: interpolate(animation.value, [0, 1], [0.8, 1]), 74 | }, 75 | { 76 | scaleY: interpolate(animation.value, [0, 1], [0.8, 1]), 77 | }, 78 | ], 79 | }; 80 | }); 81 | 82 | const containerStyle = useMemo( 83 | () => 84 | StyleSheet.flatten([ 85 | styles.container, 86 | containerDimensions, 87 | config?.alertStyle, 88 | ]), 89 | [containerDimensions, config?.alertStyle] 90 | ); 91 | 92 | const beforeTitleSlotElement = useMemo(() => { 93 | return beforeTitleSlot?.() || config?.beforeTitleSlot?.() || null; 94 | }, [beforeTitleSlot, config]); 95 | 96 | const titleContainerStyle = useMemo(() => { 97 | const style: StyleProp[] = [styles.titleContainer]; 98 | 99 | if (isDismissible && !(icon || beforeTitleSlotElement)) { 100 | style.push(styles.dismissibleTitleContainer); 101 | } 102 | 103 | return StyleSheet.flatten(style); 104 | }, [isDismissible, icon, beforeTitleSlotElement]); 105 | 106 | const renderTitleCb = useCallback(() => { 107 | const renderTitleFn = renderTitle || config?.renderTitle; 108 | 109 | let titleElement: ReactElement | null = null; 110 | 111 | if (renderTitleFn) { 112 | titleElement = renderTitleFn({ style: styles.title, text: title ?? '' }); 113 | } else if (title) { 114 | titleElement = ( 115 | 116 | {title} 117 | 118 | ); 119 | } 120 | 121 | return titleElement ? ( 122 | {titleElement} 123 | ) : null; 124 | }, [title, renderTitle, titleContainerStyle, config]); 125 | 126 | const beforeMessageSlotElement = useMemo(() => { 127 | return beforeMessageSlot?.() || config?.beforeMessageSlot?.() || null; 128 | }, [beforeMessageSlot, config]); 129 | 130 | const renderMessageCb = useCallback(() => { 131 | const renderMessageFn = renderMessage || config?.renderMessage; 132 | 133 | let messageElement: ReactElement | null = null; 134 | 135 | if (renderMessageFn) { 136 | messageElement = renderMessageFn({ 137 | style: styles.message, 138 | text: message ?? '', 139 | }); 140 | } else if (message) { 141 | messageElement = {message}; 142 | } 143 | 144 | return messageElement ? ( 145 | 146 | {messageElement} 147 | 148 | ) : null; 149 | }, [message, renderMessage, config]); 150 | 151 | const renderIconCb = useCallback(() => { 152 | const Svg = icon; 153 | 154 | const iconConfig = config?.icon; 155 | 156 | const defaultIconSize = iconSize || iconConfig?.size || 72; 157 | const defaultIconColor = iconColor || iconConfig?.color || 'black'; 158 | 159 | return Svg ? ( 160 | 161 | 166 | 167 | ) : null; 168 | }, [icon, iconColor, iconSize, config]); 169 | 170 | const renderDismissButtonCb = useCallback(() => { 171 | const defaultDismissButton = ( 172 | 173 | 174 | 175 | ); 176 | 177 | const dismissButton = isDismissible 178 | ? renderDismissButton?.({ onPress: onDismissButtonPress }) || 179 | config?.renderDismissButton?.({ onPress: onDismissButtonPress }) || 180 | defaultDismissButton 181 | : null; 182 | 183 | return dismissButton; 184 | }, [isDismissible, onDismissButtonPress, renderDismissButton, config]); 185 | 186 | const buttonsContainerStyle = useMemo(() => { 187 | return StyleSheet.compose(styles.buttonsContainer, { 188 | flexDirection: buttonsDirection, 189 | gap: config?.buttons?.gap || 10, 190 | }); 191 | }, [buttonsDirection, config]); 192 | 193 | const beforeButtonsSlotElement = useMemo(() => { 194 | return beforeButtonsSlot?.() || config?.beforeButtonsSlot?.() || null; 195 | }, [beforeButtonsSlot, config]); 196 | 197 | const afterButtonsSlotElement = useMemo(() => { 198 | return afterButtonsSlot?.() || config?.afterButtonsSlot?.() || null; 199 | }, [afterButtonsSlot, config]); 200 | 201 | const renderButtonsCb = useCallback(() => { 202 | if (buttons?.length) { 203 | return ( 204 | 205 | {buttons.map((button, i) => { 206 | const renderFn = renderButton || config?.buttons?.render; 207 | 208 | if (renderFn) { 209 | return ( 210 | 211 | {renderFn({ 212 | text: button.text, 213 | onPress: () => onButtonPress(button), 214 | disabled: button.disabled, 215 | testID: button.testID, 216 | customProps: button.customProps, 217 | })} 218 | 219 | ); 220 | } 221 | 222 | return ( 223 |