{"_id":"@amonratcha/web-minimal-spinner","name":"@amonratcha/web-minimal-spinner","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.2":{"name":"@amonratcha/web-minimal-spinner","version":"0.0.2","description":"Tiny spinner for browser (Angular-ready ESM bundle)","main":"dist/browser.js","module":"dist/browser.js","browser":"dist/browser.js","types":"dist/browser.d.ts","scripts":{"build":"npm run build:types && npm run build:browser","build:types":"tsc -p tsconfig.json","build:browser":"esbuild src/browser.ts --bundle --format=esm --target=es2017 --outfile=dist/browser.js","prepare":"npm run build","test":"vitest --run"},"keywords":["spinner","browser","angular"],"author":{"name":"Ash-alt-max"},"license":"MIT","devDependencies":{"esbuild":"^0.18.0","typescript":"^5.5.0","vitest":"^1.0.0","@types/node":"^18.0.0"},"exports":{".":{"import":"./dist/browser.js","require":"./dist/browser.js"}},"publishConfig":{"access":"public"},"_id":"@amonratcha/web-minimal-spinner@0.0.2","_nodeVersion":"18.14.2","_npmVersion":"9.5.0","dist":{"integrity":"sha512-k6exxbP+h0FHVA6sKaId9S0HbFJMqOfv4J86hHGBkTjwaS5TVCVx6KR2/ZoYDe4ZVekxTiQJdAz7rERSe7r7Ug==","shasum":"41b80388da7505dae08298ae233cd854918d36fa","tarball":"https://registry.npmjs.org/@amonratcha/web-minimal-spinner/-/web-minimal-spinner-0.0.2.tgz","fileCount":4,"unpackedSize":6562,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAnxVLIES0uu+VdjR3CpemFKXQM9/I5y2Gx/6vL+tPNJAiEA82E8CALBvHCXL26VzY8ICRB1tdHcSjNW8/dcEOpvdbs="}]},"_npmUser":{"name":"amonratcha","email":"anonataszx@outlook.co.th"},"directories":{},"maintainers":[{"name":"amonratcha","email":"anonataszx@outlook.co.th"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/web-minimal-spinner_0.0.2_1763456446732_0.4442395565169235"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-18T09:00:46.563Z","0.0.2":"2025-11-18T09:00:46.906Z","modified":"2025-11-18T09:00:47.209Z"},"maintainers":[{"name":"amonratcha","email":"anonataszx@outlook.co.th"}],"description":"Tiny spinner for browser (Angular-ready ESM bundle)","keywords":["spinner","browser","angular"],"author":{"name":"Ash-alt-max"},"license":"MIT","readme":"```markdown\r\n# minimal-spinner\r\n\r\nTiny spinner for Node (CLI) and browser (DOM). This package provides a browser-ready ESM bundle so frontend frameworks (Angular, Vite, webpack) can import it directly.\r\n\r\n## Install\r\n\r\nnpm:\r\n```bash\r\nnpm install minimal-spinner\r\n```\r\n\r\n## Build (for maintainers)\r\n\r\n```bash\r\nnpm install\r\nnpm run build\r\n```\r\n\r\n- `npm run build` runs `tsc` to emit types and Node build, and `esbuild` to create `dist/browser.js` (ES module).\r\n\r\n## Usage — Angular (example)\r\n\r\nIn your Angular component import the browser bundle entry (the package `exports` points `import` to `dist/browser.js`, so typically you can write `import Spinner from 'minimal-spinner'`):\r\n\r\n```ts\r\n// src/app/spinner-demo/spinner-demo.component.ts\r\nimport { Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';\r\nimport Spinner from 'minimal-spinner'; // bundlers will resolve to dist/browser.js\r\n\r\n@Component({\r\n  selector: 'app-spinner-demo',\r\n  template: `\r\n    <div #host></div>\r\n    <button (click)=\"start()\">Start</button>\r\n    <button (click)=\"succeed()\">Succeed</button>\r\n    <button (click)=\"fail()\">Fail</button>\r\n  `\r\n})\r\nexport class SpinnerDemoComponent implements OnInit, OnDestroy {\r\n  @ViewChild('host', { static: true }) host!: ElementRef<HTMLDivElement>;\r\n  private spinner: any;\r\n\r\n  ngOnInit(): void {\r\n    // ensure this runs only in browser (if using SSR, guard with isPlatformBrowser)\r\n    this.spinner = new Spinner({ container: this.host.nativeElement, text: 'Loading...', interval: 100 });\r\n  }\r\n\r\n  start() { this.spinner.start(); }\r\n  succeed() { this.spinner.succeed('Done'); }\r\n  fail() { this.spinner.fail('Failed'); }\r\n\r\n  ngOnDestroy() { this.spinner?.stop(true); }\r\n}\r\n```\r\n\r\nNotes:\r\n- If your Angular app uses SSR (Angular Universal), do not construct or start spinner on server — guard with `isPlatformBrowser`.\r\n- To test locally without publishing, use `npm pack` in the spinner project and `npm install ../path/to/minimal-spinner-0.0.1.tgz` in your Angular project, or use `npm link`.\r\n```","readmeFilename":"README.md","_rev":"1-fd5caeb649924f1ec7b9aaae19ddaff4"}