An opinionated toast component for React.
feat: support shadow dom (#647)
rxliuli30d7ef434420
diff --git a/package.json b/package.jsonindex 1a7d32c..ad48286 100644--- a/package.json+++ b/package.json@@ -5,7 +5,7 @@"exports": {".": {"import": {- "types": "./dist/index.d.mts",+ "types": "./dist/index.d.ts","default": "./dist/index.mjs"},"require": {@@ -22,8 +22,8 @@"dist"],"scripts": {- "dev": "bunchee --watch",- "build": "bunchee && cp src/styles.css dist/styles.css",+ "dev": "tsc && vite build --watch",+ "build": "tsc && vite build && cp src/styles.css dist/styles.css","type-check": "tsc --noEmit","dev:website": "turbo run dev --filter=website...","dev:test": "turbo run dev --filter=test...",@@ -56,7 +56,8 @@"react": "^18.2.0","react-dom": "^18.2.0","turbo": "1.6",- "typescript": "^4.8.4"+ "typescript": "^4.8.4",+ "vite": "^6.3.5"},"peerDependencies": {"react": "^18.0.0 || ^19.0.0 || ^19.0.0-rc",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 7ec6a3e..cd25137 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -35,6 +35,9 @@ importers:typescript:specifier: ^4.8.4version: 4.9.5+ vite:+ specifier: ^6.3.5+ version: 6.3.5(@types/[email protected])test:dependencies:@@ -323,6 +326,231 @@ packages:dev: falseoptional: true+ /@esbuild/[email protected]:+ resolution: {integrity: sha512-9o3TMmpmftaCMepOdA5k/yDw8SfInyzWWTjYTFCX3kPSDJMROQTb8jg+h9Cnwnmm1vOzvxN7gIfB5V2ewpjtGA==}+ engines: {node: '>=18'}+ cpu: [ppc64]+ os: [aix]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-VGzGhj4lJO+TVGV1v8ntCZWJktV7SGCs3Pn1GRWI1SBFtRALoomm8k5E9Pmwg3HOAal2VDc2F9+PM/rEY6oIDg==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [android]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA==}+ engines: {node: '>=18'}+ cpu: [arm]+ os: [android]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-D2GyJT1kjvO//drbRT3Hib9XPwQeWd9vZoBJn+bu/lVsOZ13cqNdDeqIF/xQ5/VmWvMduP6AmXvylO/PIc2isw==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [android]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [darwin]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-1iT4FVL0dJ76/q1wd7XDsXrSW+oLoquptvh4CLR4kITDtqi2e/xwXwdCVH8hVHU43wgJdsq7Gxuzcs6Iq/7bxQ==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [darwin]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [freebsd]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-PrikaNjiXdR2laW6OIjlbeuCPrPaAl0IwPIaRv+SMV8CiM8i2LqVUHFC1+8eORgWyY7yhQY+2U2fA55mBzReaw==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [freebsd]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-Z9kfb1v6ZlGbWj8EJk9T6czVEjjq2ntSYLY2cw6pAZl4oKtfgQuS4HOq41M/BcoLPzrUbNd+R4BXFyH//nHxVg==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-cPzojwW2okgh7ZlRpcBEtsX7WBuqbLrNXqLU89GxWbNt6uIg78ET82qifUy3W6OVww6ZWobWub5oqZOVtwolfw==}+ engines: {node: '>=18'}+ cpu: [arm]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-sQ7l00M8bSv36GLV95BVAdhJ2QsIbCuCjh/uYrWiMQSUuV+LpXwIqhgJDcvMTj+VsQmqAHL2yYaasENvJ7CDKA==}+ engines: {node: '>=18'}+ cpu: [ia32]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-0ur7ae16hDUC4OL5iEnDb0tZHDxYmuQyhKhsPBV8f99f6Z9KQM02g33f93rNH5A30agMS46u2HP6qTdEt6Q1kg==}+ engines: {node: '>=18'}+ cpu: [loong64]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-kB/66P1OsHO5zLz0i6X0RxlQ+3cu0mkxS3TKFvkb5lin6uwZ/ttOkP3Z8lfR9mJOBk14ZwZ9182SIIWFGNmqmg==}+ engines: {node: '>=18'}+ cpu: [mips64el]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-UZCmJ7r9X2fe2D6jBmkLBMQetXPXIsZjQJCjgwpVDz+YMcS6oFR27alkgGv3Oqkv07bxdvw7fyB71/olceJhkQ==}+ engines: {node: '>=18'}+ cpu: [ppc64]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-kTxwu4mLyeOlsVIFPfQo+fQJAV9mh24xL+y+Bm6ej067sYANjyEw1dNHmvoqxJUCMnkBdKpvOn0Ahql6+4VyeA==}+ engines: {node: '>=18'}+ cpu: [riscv64]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-K2dSKTKfmdh78uJ3NcWFiqyRrimfdinS5ErLSn3vluHNeHVnBAFWC8a4X5N+7FgVE1EjXS1QDZbpqZBjfrqMTQ==}+ engines: {node: '>=18'}+ cpu: [s390x]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-uhj8N2obKTE6pSZ+aMUbqq+1nXxNjZIIjCjGLfsWvVpy7gKCOL6rsY1MhRh9zLtUtAI7vpgLMK6DxjO8Qm9lJw==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-pwHtMP9viAy1oHPvgxtOv+OkduK5ugofNTVDilIzBLpoWAM16r7b/mxBvfpuQDpRQFMfuVr5aLcn4yveGvBZvw==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [netbsd]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-WOb5fKrvVTRMfWFNCroYWWklbnXH0Q5rZppjq0vQIdlsQKuw6mdSihwSo4RV/YdQ5UCKKvBy7/0ZZYLBZKIbwQ==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [netbsd]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-7A208+uQKgTxHd0G0uqZO8UjK2R0DDb4fDmERtARjSHWxqMTye4Erz4zZafx7Di9Cv+lNHYuncAkiGFySoD+Mw==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [openbsd]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-G4hE405ErTWraiZ8UiSoesH8DaCsMm0Cay4fsFWOOUcz8b8rC6uCvnagr+gnioEjWn0wC+o1/TAHt+It+MpIMg==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [openbsd]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-l+azKShMy7FxzY0Rj4RCt5VD/q8mG/e+mDivgspo+yL8zW7qEwctQ6YqKX34DTEleFAvCIUviCFX1SDZRSyMQA==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [sunos]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-O2S7SNZzdcFG7eFKgvwUEZ2VG9D/sn/eIiz8XRZ1Q/DO5a3s76Xv0mdBzVM5j5R639lXQmPmSo0iRpHqUUrsxw==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [win32]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-onOJ02pqs9h1iMJ1PQphR+VZv8qBMQ77Klcsqv9CNW2w6yLqoURLcgERAIurY6QE63bbLuqgP9ATqajFLK5AMQ==}+ engines: {node: '>=18'}+ cpu: [ia32]+ os: [win32]+ requiresBuild: true+ dev: true+ optional: true++ /@esbuild/[email protected]:+ resolution: {integrity: sha512-TXv6YnJ8ZMVdX+SXWVBo/0p8LTcrUYngpWjvm91TMjjBQii7Oz11Lw5lbDV5Y0TzuhSJHwiH4hEtC1I42mMS0g==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [win32]+ requiresBuild: true+ dev: true+ optional: true+/@eslint/[email protected]:resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==}engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}@@ -898,6 +1126,14 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-NELNvyEWZ6R9QMkiytB4/L4zSEaBC03KIXEghptLGLZWJ6VPrL63ooZQCOnlx36aQPGhzuOMwDerC1Eb2VmrLw==}+ cpu: [arm]+ os: [android]+ requiresBuild: true+ dev: true+ optional: true+/@rollup/[email protected]:resolution: {integrity: sha512-E8+2qCIjciYUnCa1AiVF1BkRgqIGW9KzJeesQqVfyRITGQN+dFuoivO0hnro1DjT74wXLRZ7QF8MIbz+luGaJA==}cpu: [arm64]@@ -906,6 +1142,14 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-DXdQe1BJ6TK47ukAoZLehRHhfKnKg9BjnQYUu9gzhI8Mwa1d2fzxA1aw2JixHVl403bwp1+/o/NhhHtxWJBgEA==}+ cpu: [arm64]+ os: [android]+ requiresBuild: true+ dev: true+ optional: true+/@rollup/[email protected]:resolution: {integrity: sha512-z9Ib+OzqN3DZEjX7PDQMHEhtF+t6Mi2z/ueChQPLS/qUMKY7Ybn5A2ggFoKRNRh1q1T03YTQfBTQCJZiepESAg==}cpu: [arm64]@@ -914,6 +1158,14 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-5afxvwszzdulsU2w8JKWwY8/sJOLPzf0e1bFuvcW5h9zsEg+RQAojdW0ux2zyYAz7R8HvvzKCjLNJhVq965U7w==}+ cpu: [arm64]+ os: [darwin]+ requiresBuild: true+ dev: true+ optional: true+/@rollup/[email protected]:resolution: {integrity: sha512-PShKVY4u0FDAR7jskyFIYVyHEPCPnIQY8s5OcXkdU8mz3Y7eXDJPdyM/ZWjkYdR2m0izD9HHWA8sGcXn+Qrsyg==}cpu: [x64]@@ -922,6 +1174,14 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-egpJACny8QOdHNNMZKf8xY0Is6gIMz+tuqXlusxquWu3F833DcMwmGM7WlvCO9sB3OsPjdC4U0wHw5FabzCGZg==}+ cpu: [x64]+ os: [darwin]+ requiresBuild: true+ dev: true+ optional: true+/@rollup/[email protected]:resolution: {integrity: sha512-YSwyOqlDAdKqs0iKuqvRHLN4SrD2TiswfoLfvYXseKbL47ht1grQpq46MSiQAx6rQEN8o8URtpXARCpqabqxGQ==}cpu: [arm64]@@ -930,6 +1190,14 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-DBVMZH5vbjgRk3r0OzgjS38z+atlupJ7xfKIDJdZZL6sM6wjfDNo64aowcLPKIx7LMQi8vybB56uh1Ftck/Atg==}+ cpu: [arm64]+ os: [freebsd]+ requiresBuild: true+ dev: true+ optional: true+/@rollup/[email protected]:resolution: {integrity: sha512-HEP4CgPAY1RxXwwL5sPFv6BBM3tVeLnshF03HMhJYCNc6kvSqBgTMmsEjb72RkZBAWIqiPUyF1JpEBv5XT9wKQ==}cpu: [x64]@@ -938,6 +1206,14 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-3FkydeohozEskBxNWEIbPfOE0aqQgB6ttTkJ159uWOFn42VLyfAiyD9UK5mhu+ItWzft60DycIN1Xdgiy8o/SA==}+ cpu: [x64]+ os: [freebsd]+ requiresBuild: true+ dev: true+ optional: true+/@rollup/[email protected]:resolution: {integrity: sha512-88fSzjC5xeH9S2Vg3rPgXJULkHcLYMkh8faix8DX4h4TIAL65ekwuQMA/g2CXq8W+NJC43V6fUpYZNjaX3+IIg==}cpu: [arm]@@ -946,6 +1222,14 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-wC53ZNDgt0pqx5xCAgNunkTzFE8GTgdZ9EwYGVcg+jEjJdZGtq9xPjDnFgfFozQI/Xm1mh+D9YlYtl+ueswNEg==}+ cpu: [arm]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true+/@rollup/[email protected]:resolution: {integrity: sha512-wM4ztnutBqYFyvNeR7Av+reWI/enK9tDOTKNF+6Kk2Q96k9bwhDDOlnCUNRPvromlVXo04riSliMBs/Z7RteEg==}cpu: [arm]@@ -954,6 +1238,14 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-jwKCca1gbZkZLhLRtsrka5N8sFAaxrGz/7wRJ8Wwvq3jug7toO21vWlViihG85ei7uJTpzbXZRcORotE+xyrLA==}+ cpu: [arm]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true+/@rollup/[email protected]:resolution: {integrity: sha512-9RyprECbRa9zEjXLtvvshhw4CMrRa3K+0wcp3KME0zmBe1ILmvcVHnypZ/aIDXpRyfhSYSuN4EPdCCj5Du8FIA==}cpu: [arm64]@@ -962,6 +1254,14 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-g0UBcNknsmmNQ8V2d/zD2P7WWfJKU0F1nu0k5pW4rvdb+BIqMm8ToluW/eeRmxCared5dD76lS04uL4UaNgpNA==}+ cpu: [arm64]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true+/@rollup/[email protected]:resolution: {integrity: sha512-qTmklhCTyaJSB05S+iSovfo++EwnIEZxHkzv5dep4qoszUMX5Ca4WM4zAVUMbfdviLgCSQOu5oU8YoGk1s6M9Q==}cpu: [arm64]@@ -970,6 +1270,14 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-XZpeGB5TKEZWzIrj7sXr+BEaSgo/ma/kCgrZgL0oo5qdB1JlTzIYQKel/RmhT6vMAvOdM2teYlAaOGJpJ9lahg==}+ cpu: [arm64]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true+/@rollup/[email protected]:resolution: {integrity: sha512-4Qmkaps9yqmpjY5pvpkfOerYgKNUGzQpFxV6rnS7c/JfYbDSU0y6WpbbredB5cCpLFGJEqYX40WUmxMkwhWCjw==}cpu: [loong64]@@ -978,6 +1286,14 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-bkCfDJ4qzWfFRCNt5RVV4DOw6KEgFTUZi2r2RuYhGWC8WhCA8lCAJhDeAmrM/fdiAH54m0mA0Vk2FGRPyzI+tw==}+ cpu: [loong64]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true+/@rollup/[email protected]:resolution: {integrity: sha512-Zsrtux3PuaxuBTX/zHdLaFmcofWGzaWW1scwLU3ZbW/X+hSsFbz9wDIp6XvnT7pzYRl9MezWqEqKy7ssmDEnuQ==}cpu: [ppc64]@@ -986,6 +1302,14 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-3mr3Xm+gvMX+/8EKogIZSIEF0WUu0HL9di+YWlJpO8CQBnoLAEL/roTCxuLncEdgcfJcvA4UMOf+2dnjl4Ut1A==}+ cpu: [ppc64]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true+/@rollup/[email protected]:resolution: {integrity: sha512-aK+Zp+CRM55iPrlyKiU3/zyhgzWBxLVrw2mwiQSYJRobCURb781+XstzvA8Gkjg/hbdQFuDw44aUOxVQFycrAg==}cpu: [riscv64]@@ -994,6 +1318,22 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-3rwCIh6MQ1LGrvKJitQjZFuQnT2wxfU+ivhNBzmxXTXPllewOF7JR1s2vMX/tWtUYFgphygxjqMl76q4aMotGw==}+ cpu: [riscv64]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true++ /@rollup/[email protected]:+ resolution: {integrity: sha512-LdIUOb3gvfmpkgFZuccNa2uYiqtgZAz3PTzjuM5bH3nvuy9ty6RGc/Q0+HDFrHrizJGVpjnTZ1yS5TNNjFlklw==}+ cpu: [riscv64]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true+/@rollup/[email protected]:resolution: {integrity: sha512-WoKLVrY9ogmaYPXwTH326+ErlCIgMmsoRSx6bO+l68YgJnlOXhygDYSZe/qbUJCSiCiZAQ+tKm88NcWuUXqOzw==}cpu: [s390x]@@ -1002,6 +1342,14 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-oIE6M8WC9ma6xYqjvPhzZYk6NbobIURvP/lEbh7FWplcMO6gn7MM2yHKA1eC/GvYwzNKK/1LYgqzdkZ8YFxR8g==}+ cpu: [s390x]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true+/@rollup/[email protected]:resolution: {integrity: sha512-Sht4aFvmA4ToHd2vFzwMFaQCiYm2lDFho5rPcvPBT5pCdC+GwHG6CMch4GQfmWTQ1SwRKS0dhDYb54khSrjDWw==}cpu: [x64]@@ -1010,6 +1358,14 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-cWBOvayNvA+SyeQMp79BHPK8ws6sHSsYnK5zDcsC3Hsxr1dgTABKjMnMslPq1DvZIp6uO7kIWhiGwaTdR4Og9A==}+ cpu: [x64]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true+/@rollup/[email protected]:resolution: {integrity: sha512-zmmpOQh8vXc2QITsnCiODCDGXFC8LMi64+/oPpPx5qz3pqv0s6x46ps4xoycfUiVZps5PFn1gksZzo4RGTKT+A==}cpu: [x64]@@ -1018,6 +1374,14 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-y5CbN44M+pUCdGDlZFzGGBSKCA4A/J2ZH4edTYSSxFg7ce1Xt3GtydbVKWLlzL+INfFIZAEg1ZV6hh9+QQf9YQ==}+ cpu: [x64]+ os: [linux]+ requiresBuild: true+ dev: true+ optional: true+/@rollup/[email protected]:resolution: {integrity: sha512-3/q1qUsO/tLqGBaD4uXsB6coVGB3usxw3qyeVb59aArCgedSF66MPdgRStUd7vbZOsko/CgVaY5fo2vkvPLWiA==}cpu: [arm64]@@ -1026,6 +1390,14 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-lZkCxIrjlJlMt1dLO/FbpZbzt6J/A8p4DnqzSa4PWqPEUUUnzXLeki/iyPLfV0BmHItlYgHUqJe+3KiyydmiNQ==}+ cpu: [arm64]+ os: [win32]+ requiresBuild: true+ dev: true+ optional: true+/@rollup/[email protected]:resolution: {integrity: sha512-oLHxuyywc6efdKVTxvc0135zPrRdtYVjtVD5GUm55I3ODxhU/PwkQFD97z16Xzxa1Fz0AEe4W/2hzRtd+IfpOA==}cpu: [ia32]@@ -1034,6 +1406,14 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-+psFT9+pIh2iuGsxFYYa/LhS5MFKmuivRsx9iPJWNSGbh2XVEjk90fmpUEjCnILPEPJnikAU6SFDiEUyOv90Pg==}+ cpu: [ia32]+ os: [win32]+ requiresBuild: true+ dev: true+ optional: true+/@rollup/[email protected]:resolution: {integrity: sha512-0PVwmgzZ8+TZ9oGBmdZoQVXflbvuwzN/HRclujpl4N/q3i+y0lqLw8n1bXA8ru3sApDjlmONaNAuYr38y1Kr9w==}cpu: [x64]@@ -1042,6 +1422,14 @@ packages:dev: trueoptional: true+ /@rollup/[email protected]:+ resolution: {integrity: sha512-Wq2zpapRYLfi4aKxf2Xff0tN+7slj2d4R87WEzqw7ZLsVvO5zwYCIuEGSZYiK41+GlwUo1HiR+GdkLEJnCKTCw==}+ cpu: [x64]+ os: [win32]+ requiresBuild: true+ dev: true+ optional: true+/@rushstack/[email protected]:resolution: {integrity: sha512-qC/xYId4NMebE6w/V33Fh9gWxLgURiNYgVNObbJl2LZv0GUUItCcCqC5axQSwRaAgaxl2mELq1rMzlswaQ0Zxg==}dev: false@@ -1266,6 +1654,10 @@ packages:/@types/[email protected]:resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==}+ dev: true++ /@types/[email protected]:+ resolution: {integrity: sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==}/@types/[email protected]:resolution: {integrity: sha512-McWspRw8xx8J9HurkVBfYj0xKoE25tOFlHGdx4MJ5xORQrMGZNqJhVQWaIbm6Oyla5kYOXtDiopzKRJzEOkwJw==}@@ -1472,7 +1864,7 @@ packages:'@vue/shared': 3.5.13estree-walker: 2.0.2magic-string: 0.30.17- postcss: 8.5.1+ postcss: 8.5.4source-map-js: 1.2.1dev: false@@ -1895,7 +2287,7 @@ packages:picomatch: 4.0.2pretty-bytes: 5.6.0rollup: 4.34.6- rollup-plugin-dts: 6.1.1([email protected])([email protected])+ rollup-plugin-dts: 6.2.1([email protected])([email protected])rollup-plugin-swc3: 0.11.2(@swc/[email protected])([email protected])rollup-preserve-directives: 1.1.3([email protected])tslib: 2.8.1@@ -2719,6 +3111,39 @@ packages:is-symbol: 1.0.4dev: false+ resolution: {integrity: sha512-P8OtKZRv/5J5hhz0cUAdu/cLuPIKXpQl1R9pZtvmHWQvrAUVd0UNIPT4IB4W3rNOqVO0rlqHmCIbSwxh/c9yUQ==}+ engines: {node: '>=18'}+ hasBin: true+ requiresBuild: true+ optionalDependencies:+ '@esbuild/aix-ppc64': 0.25.5+ '@esbuild/android-arm': 0.25.5+ '@esbuild/android-arm64': 0.25.5+ '@esbuild/android-x64': 0.25.5+ '@esbuild/darwin-arm64': 0.25.5+ '@esbuild/darwin-x64': 0.25.5+ '@esbuild/freebsd-arm64': 0.25.5+ '@esbuild/freebsd-x64': 0.25.5+ '@esbuild/linux-arm': 0.25.5+ '@esbuild/linux-arm64': 0.25.5+ '@esbuild/linux-ia32': 0.25.5+ '@esbuild/linux-loong64': 0.25.5+ '@esbuild/linux-mips64el': 0.25.5+ '@esbuild/linux-ppc64': 0.25.5+ '@esbuild/linux-riscv64': 0.25.5+ '@esbuild/linux-s390x': 0.25.5+ '@esbuild/linux-x64': 0.25.5+ '@esbuild/netbsd-arm64': 0.25.5+ '@esbuild/netbsd-x64': 0.25.5+ '@esbuild/openbsd-arm64': 0.25.5+ '@esbuild/openbsd-x64': 0.25.5+ '@esbuild/sunos-x64': 0.25.5+ '@esbuild/win32-arm64': 0.25.5+ '@esbuild/win32-ia32': 0.25.5+ '@esbuild/win32-x64': 0.25.5+ dev: true+resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==}engines: {node: '>=6'}@@ -3176,6 +3601,17 @@ packages:picomatch: 4.0.2dev: true+ resolution: {integrity: sha512-4BG7puHpVsIYxZUbiUE3RqGloLaSSwzYie5jvasC4LWuBWzZawynvYouhjbQKw2JuIGYdm0DzIxl8iVidKlUEw==}+ peerDependencies:+ picomatch: ^3 || ^4+ peerDependenciesMeta:+ picomatch:+ optional: true+ dependencies:+ picomatch: 4.0.2+ dev: true+resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==}engines: {node: ^10.12.0 || >=12.0.0}@@ -3874,7 +4310,7 @@ packages:resolution: {integrity: sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==}dependencies:- '@types/estree': 1.0.6+ '@types/estree': 1.0.7dev: false@@ -4871,6 +5307,11 @@ packages:thenify-all: 1.6.0dev: true+ resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==}+ engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}+ hasBin: true+resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==}engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}@@ -5450,9 +5891,9 @@ packages:resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==}engines: {node: ^10 || ^12 || >=14}dependencies:- nanoid: 3.3.7- picocolors: 1.0.1- source-map-js: 1.2.0+ nanoid: 3.3.8+ picocolors: 1.1.1+ source-map-js: 1.2.1dev: false@@ -5464,14 +5905,13 @@ packages:source-map-js: 1.2.0dev: true- resolution: {integrity: sha512-6oz2beyjc5VMn/KV1pPw8fliQkhBXrVn1Z3TVyqZxU8kZpzEKhBdmCFqI6ZbmGtamQvQGuU1sgPTk8ZrXDD7jQ==}+ resolution: {integrity: sha512-QSa9EBe+uwlGTFmHsPKokv3B/oEMQZxfqW0QqNCyhpa6mB1afzulwn8hihglqAb2pOw+BJgNlmXQ8la2VeHB7w==}engines: {node: ^10 || ^12 || >=14}dependencies:- nanoid: 3.3.8+ nanoid: 3.3.11picocolors: 1.1.1source-map-js: 1.2.1- dev: falseresolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}@@ -5768,8 +6208,8 @@ packages:resolution: {integrity: sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==}dev: false- resolution: {integrity: sha512-aSHRcJ6KG2IHIioYlvAOcEq6U99sVtqDDKVhnwt70rW6tsz3tv5OSjEiWcgzfsHdLyGXZ/3b/7b/+Za3Y6r1XA==}+ resolution: {integrity: sha512-sR3CxYUl7i2CHa0O7bA45mCrgADyAQ0tVtGSqi3yvH28M+eg1+g5d7kQ9hLvEz5dorK3XVsH5L2jwHLQf72DzA==}engines: {node: '>=16'}peerDependencies:rollup: ^3.29.4 || ^4@@ -5835,6 +6275,36 @@ packages:fsevents: 2.3.3dev: true+ resolution: {integrity: sha512-cPmwD3FnFv8rKMBc1MxWCwVQFxwf1JEmSX3iQXrRVVG15zerAIXRjMFVWnd5Q5QvgKF7Aj+5ykXFhUl+QGnyOw==}+ engines: {node: '>=18.0.0', npm: '>=8.0.0'}+ hasBin: true+ dependencies:+ '@types/estree': 1.0.7+ optionalDependencies:+ '@rollup/rollup-android-arm-eabi': 4.41.1+ '@rollup/rollup-android-arm64': 4.41.1+ '@rollup/rollup-darwin-arm64': 4.41.1+ '@rollup/rollup-darwin-x64': 4.41.1+ '@rollup/rollup-freebsd-arm64': 4.41.1+ '@rollup/rollup-freebsd-x64': 4.41.1+ '@rollup/rollup-linux-arm-gnueabihf': 4.41.1+ '@rollup/rollup-linux-arm-musleabihf': 4.41.1+ '@rollup/rollup-linux-arm64-gnu': 4.41.1+ '@rollup/rollup-linux-arm64-musl': 4.41.1+ '@rollup/rollup-linux-loongarch64-gnu': 4.41.1+ '@rollup/rollup-linux-powerpc64le-gnu': 4.41.1+ '@rollup/rollup-linux-riscv64-gnu': 4.41.1+ '@rollup/rollup-linux-riscv64-musl': 4.41.1+ '@rollup/rollup-linux-s390x-gnu': 4.41.1+ '@rollup/rollup-linux-x64-gnu': 4.41.1+ '@rollup/rollup-linux-x64-musl': 4.41.1+ '@rollup/rollup-win32-arm64-msvc': 4.41.1+ '@rollup/rollup-win32-ia32-msvc': 4.41.1+ '@rollup/rollup-win32-x64-msvc': 4.41.1+ fsevents: 2.3.3+ dev: true+resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}dependencies:@@ -6003,7 +6473,6 @@ packages:resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}engines: {node: '>=0.10.0'}- dev: falseresolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==}@@ -6236,7 +6705,7 @@ packages:dependencies:'@ampproject/remapping': 2.3.0'@jridgewell/sourcemap-codec': 1.5.0- '@types/estree': 1.0.6+ '@types/estree': 1.0.7acorn: 8.14.0acorn-typescript: 1.4.13([email protected])aria-query: 5.3.2@@ -6325,6 +6794,14 @@ packages:any-promise: 1.3.0dev: true+ resolution: {integrity: sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==}+ engines: {node: '>=12.0.0'}+ dependencies:+ fdir: 6.4.5([email protected])+ picomatch: 4.0.2+ dev: true+resolution: {integrity: sha512-20JyowYglSEeCvZv3EZ0nZ046vLarO37prvV0mbtQV7C8DJPGgN967r8SJkqd3XK3K3lD3/Iyfp3avjfil8Q2Q==}hasBin: true@@ -6757,6 +7234,57 @@ packages:vfile-message: 4.0.2dev: false+ /[email protected](@types/[email protected]):+ resolution: {integrity: sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ==}+ engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}+ hasBin: true+ peerDependencies:+ '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0+ jiti: '>=1.21.0'+ less: '*'+ lightningcss: ^1.21.0+ sass: '*'+ sass-embedded: '*'+ stylus: '*'+ sugarss: '*'+ terser: ^5.16.0+ tsx: ^4.8.1+ yaml: ^2.4.2+ peerDependenciesMeta:+ '@types/node':+ optional: true+ jiti:+ optional: true+ less:+ optional: true+ lightningcss:+ optional: true+ sass:+ optional: true+ sass-embedded:+ optional: true+ stylus:+ optional: true+ sugarss:+ optional: true+ terser:+ optional: true+ tsx:+ optional: true+ yaml:+ optional: true+ dependencies:+ '@types/node': 18.15.0+ esbuild: 0.25.5+ fdir: 6.4.5([email protected])+ picomatch: 4.0.2+ postcss: 8.5.4+ rollup: 4.41.1+ tinyglobby: 0.2.14+ optionalDependencies:+ fsevents: 2.3.3+ dev: true+resolution: {integrity: sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==}dev: falsediff --git a/src/index.tsx b/src/index.tsxindex 4956fa8..cdf6a1c 100644--- a/src/index.tsx+++ b/src/index.tsx@@ -6,7 +6,7 @@ import ReactDOM from 'react-dom';import { CloseIcon, getAsset, Loader } from './assets';import { useIsDocumentHidden } from './hooks';import { toast, ToastState } from './state';-import './styles.css';+import globalStyle from './styles.css?inline';import {isAction,SwipeDirection,@@ -588,6 +588,16 @@ function useSonner() {};}+function insertCSS(target: HTMLElement, code: string) {+ if (!code) {+ return;+ }+ const style = document.createElement('style');+ style.type = 'text/css';+ target.appendChild(style);+ style.appendChild(document.createTextNode(code));+}+const Toaster = React.forwardRef<HTMLElement, ToasterProps>(function Toaster(props, ref) {const {invert,@@ -608,6 +618,7 @@ const Toaster = React.forwardRef<HTMLElement, ToasterProps>(function Toaster(progap = GAP,icons,containerAriaLabel = 'Notifications',+ container,} = props;const [toasts, setToasts] = React.useState<ToastT[]>([]);const possiblePositions = React.useMemo(() => {@@ -643,6 +654,12 @@ const Toaster = React.forwardRef<HTMLElement, ToasterProps>(function Toaster(pro});}, []);+ React.useEffect(() => {+ if (typeof document !== 'undefined') {+ insertCSS(container ?? document.body, globalStyle);+ }+ }, [container]);+React.useEffect(() => {return ToastState.subscribe((toast) => {if ((toast as ToastToDismiss).dismiss) {diff --git a/src/types.ts b/src/types.tsindex ac0563f..501d746 100644--- a/src/types.ts+++ b/src/types.ts@@ -142,6 +142,7 @@ export interface ToasterProps {swipeDirections?: SwipeDirection[];icons?: ToastIcons;containerAriaLabel?: string;+ container?: HTMLElement | null;}export type SwipeDirection = 'top' | 'right' | 'bottom' | 'left';diff --git a/src/vite-env.d.ts b/src/vite-env.d.tsnew file mode 100644index 0000000..151aa68--- /dev/null+++ b/src/vite-env.d.ts@@ -0,0 +1 @@+/// <reference types="vite/client" />\ No newline at end of filediff --git a/tsconfig.json b/tsconfig.jsonindex 8ff924f..0f7a026 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -4,7 +4,11 @@"target": "ES2018","moduleResolution": "node","esModuleInterop": true,- "lib": ["es2015", "dom"]+ "lib": ["es2015", "dom"],+ "skipLibCheck": true,+ "declaration": true,+ "emitDeclarationOnly": true,+ "outDir": "dist"},"include": ["src"]}diff --git a/vite.config.ts b/vite.config.tsnew file mode 100644index 0000000..8cda7ae--- /dev/null+++ b/vite.config.ts@@ -0,0 +1,22 @@+import { defineConfig, type Plugin } from 'vite';++export default defineConfig({+ build: {+ lib: {+ entry: 'src/index.tsx',+ fileName: 'index',+ formats: ['es', 'cjs'],+ },+ rollupOptions: {+ external: ['react', 'react-dom'],+ // https://github.com/vitejs/vite/issues/15012#issuecomment-1816102409+ onwarn(warning, defaultHandler) {+ if (warning.code === 'MODULE_LEVEL_DIRECTIVE' && warning.message.includes('use client')) {+ return;+ }+ defaultHandler(warning);+ },+ },+ emptyOutDir: false,+ },+});