{"_id":"@ancientbag/react-typewriter","_rev":"2-201bafccb80a15b0eb0d1ab1ccea3603","name":"@ancientbag/react-typewriter","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@ancientbag/react-typewriter","version":"1.0.0","keywords":["react","typewriter","animation","hook","smart","text-effect"],"author":{"name":"Denis Timashev"},"license":"MIT","_id":"@ancientbag/react-typewriter@1.0.0","maintainers":[{"name":"ancientbag","email":"pleasenonaga@gmail.com"}],"homepage":"https://github.com/ancientbag/react-typewriter#readme","bugs":{"url":"https://github.com/ancientbag/react-typewriter/issues"},"dist":{"shasum":"6c38e8266564015f84fd46eb61839528a2718f20","tarball":"https://registry.npmjs.org/@ancientbag/react-typewriter/-/react-typewriter-1.0.0.tgz","fileCount":7,"integrity":"sha512-6aW44xy2M8Dphmaz7usQ1VvTQCP5TwbnJLRkozRTCLi+JHr2MG2BSB8oJyFxVbspYAlddHB+DfpzstbdE0nS7Q==","signatures":[{"sig":"MEUCICM/3NLFu6nyjM36P56gtvdpiBbPBlTQhmNQrvUyd3nrAiEAja8RYK2w05Sy2qao3TMPn4IYi7vwFMdWSP0CpX9rEdw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25440},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"gitHead":"876c1c1db7a35d5d9703affde7b69c4e1c808063","scripts":{"lint":"tsc --noEmit","build":"tsup src/index.ts --format cjs,esm --dts --clean","prepublishOnly":"npm run build"},"_npmUser":{"name":"ancientbag","email":"pleasenonaga@gmail.com"},"repository":{"url":"git+https://github.com/ancientbag/react-typewriter.git","type":"git"},"_npmVersion":"10.9.7","description":"React hooks for typewriter text animation effects","directories":{},"sideEffects":false,"_nodeVersion":"22.22.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.4.0","typescript":"^5.7.0","@types/react":"^19.1.0"},"peerDependencies":{"react":">=17.0.0"},"_npmOperationalInternal":{"tmp":"tmp/react-typewriter_1.0.0_1781339347652_0.324162724176815","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@ancientbag/react-typewriter","version":"1.0.1","description":"React hooks for typewriter text animation effects","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"sideEffects":false,"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts --clean","lint":"tsc --noEmit","prepublishOnly":"npm run build"},"peerDependencies":{"react":">=17.0.0"},"publishConfig":{"access":"public"},"devDependencies":{"tsup":"^8.4.0","typescript":"^5.7.0","@types/react":"^19.1.0"},"keywords":["react","typewriter","animation","hook","smart","text-effect"],"license":"MIT","author":{"name":"Denis Timashev"},"repository":{"type":"git","url":"git+https://github.com/ancientbag/react-typewriter.git"},"_id":"@ancientbag/react-typewriter@1.0.1","gitHead":"58278f05b2e0de018f3111f9bb030126328ec5ed","bugs":{"url":"https://github.com/ancientbag/react-typewriter/issues"},"homepage":"https://github.com/ancientbag/react-typewriter#readme","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-5K3U5eu6md/JsZIBp/ZbCJlY07VU8XFIBFzoEpHTkKUGp5W5pZ/vPusIl9jy+knPdSViI1Hwbkw0Jno9PdcJLQ==","shasum":"4c443c727d0d9263a681163ab2218c819b558247","tarball":"https://registry.npmjs.org/@ancientbag/react-typewriter/-/react-typewriter-1.0.1.tgz","fileCount":7,"unpackedSize":25476,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAerJf/Avi+Q5X7aWNQ2n5hGupW0XvYoi71vsIA/KKfFAiEAkFoTLzgZV1ZkfD3Gcxqyv35MPh/Sd112IFMnmMx9Q4A="}]},"_npmUser":{"name":"ancientbag","email":"pleasenonaga@gmail.com"},"directories":{},"maintainers":[{"name":"ancientbag","email":"pleasenonaga@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/react-typewriter_1.0.1_1781345414364_0.6367397542416953"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-13T08:29:07.484Z","modified":"2026-06-13T10:10:14.630Z","1.0.0":"2026-06-13T08:29:07.776Z","1.0.1":"2026-06-13T10:10:14.506Z"},"bugs":{"url":"https://github.com/ancientbag/react-typewriter/issues"},"author":{"name":"Denis Timashev"},"license":"MIT","homepage":"https://github.com/ancientbag/react-typewriter#readme","keywords":["react","typewriter","animation","hook","smart","text-effect"],"repository":{"type":"git","url":"git+https://github.com/ancientbag/react-typewriter.git"},"description":"React hooks for typewriter text animation effects","maintainers":[{"name":"ancientbag","email":"pleasenonaga@gmail.com"}],"readme":"# react-typewriter\n\nReact hooks for typewriter text animation effects.\n\n## Install\n\n```bash\nnpm install @ancientbag/react-typewriter\n```\n\n## `useTypewriter`\n\nAnimates a single string.\n\n```tsx\nimport { useTypewriter } from \"@ancientbag/react-typewriter\";\n\nfunction App() {\n    const { ref, isFinished, restart } = useTypewriter(\"Hello, world!\", {\n        delay: 100,\n        autoStart: true,\n    });\n\n    return (\n        <>\n            <h1 ref={ref} />\n            {isFinished && (\n                <button type=\"button\" onClick={restart}>\n                    Replay\n                </button>\n            )}\n        </>\n    );\n}\n```\n\n**Options**\n\n| Option      | Type      | Default | Description              |\n| ----------- | --------- | ------- | ------------------------ |\n| `delay`     | `number`  | `100`   | ms between each char     |\n| `autoStart` | `boolean` | `true`  | start animating on mount |\n\n**Returns**\n\n| Field        | Type           | Description                     |\n| ------------ | -------------- | ------------------------------- |\n| `ref`        | `RefObject<T>` | attach to any HTML element      |\n| `start`      | `() => void`   | start typing from the beginning |\n| `restart`    | `() => void`   | cancel and restart typing       |\n| `pause`      | `() => void`   | pause typing                    |\n| `resume`     | `() => void`   | resume typing after pause       |\n| `isFinished` | `boolean`      | `true` when animation completes |\n\n## `useSmartTypewriter`\n\nAnimates multiple sentences with per-sentence and per-letter delays.\n\n```tsx\nimport { useSmartTypewriter } from \"@ancientbag/react-typewriter\";\n\nfunction App() {\n    const { ref, isFinished, restart } = useSmartTypewriter({\n        sentences: [\n            { text: \"Hello!\", delay: 80 },\n            { text: \"How are you?\", delayByLetter: { \" \": 300 } },\n        ],\n        sentenceDelay: 500,\n    });\n\n    return (\n        <>\n            <h1 ref={ref} />\n            {isFinished && (\n                <button type=\"button\" onClick={restart}>\n                    Replay\n                </button>\n            )}\n        </>\n    );\n}\n```\n\n**Options**\n\n| Option          | Type          | Default | Description                             |\n| --------------- | ------------- | ------- | --------------------------------------- |\n| `sentences`     | `TSentence[]` | —       | sentences to type (required)            |\n| `sentenceDelay` | `number`      | `300`   | ms delay before starting a new sentence |\n| `autoStart`     | `boolean`     | `true`  | start animating on mount                |\n| `onFinish`      | `() => void`  | —       | called when all sentences finish typing |\n\n**Sentence object**\n\n| Field            | Type                     | Description                       |\n| ---------------- | ------------------------ | --------------------------------- |\n| `text`           | `string`                 | the sentence to type              |\n| `delay?`         | `number`                 | ms between chars (default `100`)  |\n| `delayByLetter?` | `Record<string, number>` | override delay for specific chars |\n\n**Returns**\n\n| Field        | Type           | Description                     |\n| ------------ | -------------- | ------------------------------- |\n| `ref`        | `RefObject<T>` | attach to any HTML element      |\n| `start`      | `() => void`   | start typing from the beginning |\n| `restart`    | `() => void`   | cancel and restart typing       |\n| `pause`      | `() => void`   | pause typing                    |\n| `resume`     | `() => void`   | resume typing after pause       |\n| `isFinished` | `boolean`      | `true` when animation completes |\n\n## License\n\nMIT\n","readmeFilename":"README.md"}