{"_id":"@dhanukanavodya/nova-alert","name":"@dhanukanavodya/nova-alert","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@dhanukanavodya/nova-alert","version":"0.1.0","description":"A lightweight, accessible, promise-based alert, confirm, prompt, loading, and toast library for JavaScript and TypeScript.","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./styles.css":"./styles/nova-alert.css"},"sideEffects":["**/*.css"],"scripts":{"dev":"tsup --watch","build":"tsup","test":"vitest run","test:watch":"vitest","typecheck":"tsc --noEmit","check":"npm run typecheck && npm run test && npm run build","check-package":"npm pack --dry-run","prepublishOnly":"npm run check"},"keywords":["alert","modal","dialog","confirm","prompt","toast","notification","popup","typescript","javascript","accessible"],"author":{"name":"Dhanuka Navodya"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/DhanukaNavodya/nova-alert.git"},"homepage":"https://github.com/DhanukaNavodya/nova-alert#readme","bugs":{"url":"https://github.com/DhanukaNavodya/nova-alert/issues"},"publishConfig":{"access":"public"},"engines":{"node":">=18"},"devDependencies":{"jsdom":"^26.1.0","tsup":"^8.5.0","typescript":"^5.8.3","vitest":"^3.2.4"},"_id":"@dhanukanavodya/nova-alert@0.1.0","_nodeVersion":"24.13.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-OJkUUzEgPciwxC5aS8IwcsbxWBNBKbN3lIPu2aqhaIzHU/VT8QdtDuOlsZw1XAee69beWy544OcMTTrGGkeFTQ==","shasum":"5f7a7a3b96eb3a7ac609b1d55a1860a286cc7170","tarball":"https://registry.npmjs.org/@dhanukanavodya/nova-alert/-/nova-alert-0.1.0.tgz","fileCount":10,"unpackedSize":153211,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIG82DZ6u1bNkBrg+0zktgSBhRwIA5cY8bE/+vS9Bc4JOAiEAlz5Ga9dFzR++dx7DtJg849H9xd+WT1/levq5xFVGX4E="}]},"_npmUser":{"name":"dhanukanavodya","email":"dhanukanavodya97@gmail.com"},"directories":{},"maintainers":[{"name":"dhanukanavodya","email":"dhanukanavodya97@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nova-alert_0.1.0_1784399094449_0.5919572720966011"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-18T18:24:54.271Z","0.1.0":"2026-07-18T18:24:54.570Z","modified":"2026-07-18T18:24:54.745Z"},"maintainers":[{"name":"dhanukanavodya","email":"dhanukanavodya97@gmail.com"}],"description":"A lightweight, accessible, promise-based alert, confirm, prompt, loading, and toast library for JavaScript and TypeScript.","homepage":"https://github.com/DhanukaNavodya/nova-alert#readme","keywords":["alert","modal","dialog","confirm","prompt","toast","notification","popup","typescript","javascript","accessible"],"repository":{"type":"git","url":"git+https://github.com/DhanukaNavodya/nova-alert.git"},"author":{"name":"Dhanuka Navodya"},"bugs":{"url":"https://github.com/DhanukaNavodya/nova-alert/issues"},"license":"MIT","readme":"# NovaAlert\n\nA lightweight, accessible, promise-based alert, confirmation, prompt, loading, and toast library for JavaScript and TypeScript.\n\n> Before publishing, replace `@dhanukanavodya/nova-alert`, repository URLs, author name, and license copyright information.\n\n## Features\n\n- Framework-independent TypeScript core\n- Alerts, confirmations, prompts, loading dialogs, and toasts\n- Promise-based result objects\n- Async confirmation handlers with loading states\n- Built-in input validation\n- Light, dark, and automatic themes\n- Keyboard navigation, focus trapping, and focus restoration\n- Escape, backdrop, timer, and programmatic dismissal\n- Toast positions, actions, progress bars, and stacking\n- ESM, CommonJS, and TypeScript declaration output\n\n## Install\n\n```bash\nnpm install @dhanukanavodya/nova-alert\n```\n\nImport the library and CSS:\n\n```ts\nimport NovaAlert from \"@dhanukanavodya/nova-alert\";\nimport \"@dhanukanavodya/nova-alert/styles.css\";\n```\n\n## Alert\n\n```ts\nawait NovaAlert.alert({\n  title: \"Saved\",\n  message: \"Employee details were saved.\",\n  icon: \"success\"\n});\n```\n\nYou can also use a shortcut:\n\n```ts\nawait NovaAlert.success(\"Employee details were saved.\");\n```\n\n## Confirmation\n\n```ts\nconst result = await NovaAlert.confirm({\n  title: \"Delete employee?\",\n  message: \"This action cannot be undone.\",\n  confirmText: \"Delete\",\n  cancelText: \"Cancel\",\n  icon: \"warning\",\n  variant: \"danger\"\n});\n\nif (result.confirmed) {\n  // Delete the employee.\n}\n```\n\n## Prompt\n\n```ts\nconst result = await NovaAlert.prompt({\n  title: \"Employee name\",\n  input: {\n    type: \"text\",\n    label: \"Name\",\n    placeholder: \"Enter employee name\",\n    required: true,\n    minLength: 3\n  },\n  validate(value) {\n    return value.trim().length >= 3 || \"Use at least 3 characters.\";\n  }\n});\n\nif (result.confirmed) {\n  console.log(result.value);\n}\n```\n\n## Async confirmation\n\nThe dialog remains open and displays a loading state while `onConfirm` is running. Throw an error to show a message without closing the dialog.\n\n```ts\nawait NovaAlert.confirm({\n  title: \"Submit request?\",\n  confirmText: \"Submit\",\n  async onConfirm() {\n    const response = await fetch(\"/api/requests\", {\n      method: \"POST\"\n    });\n\n    if (!response.ok) {\n      throw new Error(\"The request could not be submitted.\");\n    }\n\n    return response.json();\n  }\n});\n```\n\n## Toast\n\n```ts\nNovaAlert.toast({\n  title: \"Saved\",\n  message: \"Department created successfully.\",\n  type: \"success\",\n  position: \"top-right\",\n  duration: 3500\n});\n```\n\nToast with an action:\n\n```ts\nNovaAlert.toast({\n  message: \"Employee archived.\",\n  type: \"info\",\n  actionText: \"Undo\",\n  async onAction() {\n    await restoreEmployee();\n  }\n});\n```\n\n## Timer\n\n```ts\nawait NovaAlert.fire({\n  title: \"Session updated\",\n  message: \"This dialog closes automatically.\",\n  timer: 2500,\n  showTimerProgress: true\n});\n```\n\n## Global configuration\n\n```ts\nNovaAlert.configure({\n  theme: \"dark\",\n  confirmText: \"Continue\",\n  cancelText: \"Go back\",\n  toastPosition: \"bottom-right\",\n  toastDuration: 5000\n});\n```\n\nReset configuration:\n\n```ts\nNovaAlert.resetDefaults();\n```\n\n## Custom colors\n\nOverride the CSS variables in your application:\n\n```css\n:root {\n  --nova-primary: #7c3aed;\n  --nova-primary-hover: #6d28d9;\n  --nova-success: #059669;\n  --nova-danger: #dc2626;\n  --nova-radius: 16px;\n}\n```\n\n## Development\n\n```bash\nnpm install\nnpm run dev\n```\n\nRun all checks:\n\n```bash\nnpm run check\n```\n\nBuild the package:\n\n```bash\nnpm run build\n```\n\nInspect the files that npm will publish:\n\n```bash\nnpm run check-package\n```\n\n## Test the package locally\n\nCreate the package archive:\n\n```bash\nnpm pack\n```\n\nInstall the generated `.tgz` file in another project:\n\n```bash\nnpm install ../nova-alert/your-npm-username-nova-alert-0.1.0.tgz\n```\n\n## Publish to npm\n\n1. Create and verify an npm account.\n2. Change the package name and author details in `package.json`.\n3. Log in:\n\n```bash\nnpm login\nnpm whoami\n```\n\n4. Check the package:\n\n```bash\nnpm run check\nnpm pack --dry-run\n```\n\n5. Publish a public scoped package:\n\n```bash\nnpm publish --access public\n```\n\nFor later releases, increase the version first:\n\n```bash\nnpm version patch\nnpm publish\n```\n\nUse `minor` for backward-compatible features and `major` for breaking changes.\n\n## API summary\n\n```ts\nNovaAlert.fire(options)\nNovaAlert.alert(options)\nNovaAlert.confirm(options)\nNovaAlert.prompt(options)\nNovaAlert.success(message, title?)\nNovaAlert.error(message, title?)\nNovaAlert.warning(message, title?)\nNovaAlert.info(message, title?)\nNovaAlert.loading(options?)\nNovaAlert.toast(options)\nNovaAlert.closeAll()\nNovaAlert.configure(defaults)\nNovaAlert.getDefaults()\nNovaAlert.resetDefaults()\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-965d74f056fc03452fd34dc38afd5713"}