{"_id":"@dnsam/sinhala-phonetics","_rev":"2-f568c1550e62eee10cec8b46d8b5d681","name":"@dnsam/sinhala-phonetics","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@dnsam/sinhala-phonetics","version":"0.1.0","keywords":["sinhala","phonetics","react","input","unicode","transliteration"],"author":{"name":"Dileepa Sam"},"license":"MIT","_id":"@dnsam/sinhala-phonetics@0.1.0","maintainers":[{"name":"dnsam","email":"dnsam.dell@gmail.com"}],"homepage":"https://dnsamw.github.io/sinhala-phonetics","bugs":{"url":"https://github.com/dnsamw/sinhala-phonetics/issues"},"dist":{"shasum":"3297a5a884e06e9d2dfd6b4da296e8eff7885923","tarball":"https://registry.npmjs.org/@dnsam/sinhala-phonetics/-/sinhala-phonetics-0.1.0.tgz","fileCount":8,"integrity":"sha512-C/hHE/e6TK1WnesJcKipNFZA4DLtzE8t7OVNCVE2ECQ/3z0dQmRlIsN22lPYNILb9qunplfWZFmxzzW5pd1WWA==","signatures":[{"sig":"MEUCIQD5qqo+JFkyVP/I6Jhf6CDRTOP4XmVvAhguHHTE2Q+JHAIgWUeb/qBMqGFBLCRw+Tb8TK4feaWQwe3MEZy4orbbuKo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":156906},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"6b0aa1a76a73b0015be33fba835c42ec2b1f6c98","scripts":{"dev":"tsup --watch","build":"tsup"},"_npmUser":{"name":"dnsam","email":"dnsam.dell@gmail.com"},"repository":{"url":"git+https://github.com/dnsamw/sinhala-phonetics.git","type":"git"},"_npmVersion":"11.6.2","description":"Sinhala phonetic input with word predictions — React components + headless converter","directories":{},"_nodeVersion":"24.15.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","react":"^18.0.0","react-dom":"^18.0.0","typescript":"^5.0.0","@types/react":"^18.0.0","@types/react-dom":"^18.0.0"},"peerDependencies":{"react":">=17.0.0","react-dom":">=17.0.0"},"peerDependenciesMeta":{"react":{"optional":true},"react-dom":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sinhala-phonetics_0.1.0_1779673994356_0.23523246124091712","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@dnsam/sinhala-phonetics","version":"0.1.1","description":"Sinhala phonetic input with word predictions — React components + headless converter","author":{"name":"Dileepa Sam"},"license":"MIT","keywords":["sinhala","phonetics","react","input","unicode","transliteration"],"repository":{"type":"git","url":"git+https://github.com/dnsamw/sinhala-phonetics.git"},"homepage":"https://dnsamw.github.io/sinhala-phonetics","bugs":{"url":"https://github.com/dnsamw/sinhala-phonetics/issues"},"main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./dict-core":{"types":"./dist/dict-core.d.ts","import":"./dist/dict-core.mjs","require":"./dist/dict-core.js"},"./dict-social":{"types":"./dist/dict-social.d.ts","import":"./dist/dict-social.mjs","require":"./dist/dict-social.js"}},"scripts":{"build":"tsup","dev":"tsup --watch"},"peerDependencies":{"react":">=17.0.0","react-dom":">=17.0.0"},"peerDependenciesMeta":{"react":{"optional":true},"react-dom":{"optional":true}},"devDependencies":{"@types/react":"^18.0.0","@types/react-dom":"^18.0.0","react":"^18.0.0","react-dom":"^18.0.0","tsup":"^8.0.0","typescript":"^5.0.0"},"gitHead":"3cab5d62883bef2043774ca21b717a74ba2251d2","_id":"@dnsam/sinhala-phonetics@0.1.1","_nodeVersion":"24.15.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-4XNroREKDppAsNFX4jS6QsS8lGYt2S1N1IWi7uxP4Eu/r4kB1MK+0m/w0duK1l8QtVf5zgAHlykZvkDVcAft1A==","shasum":"38ab65e9e2ff426532da83559a83ae67b4ab86e1","tarball":"https://registry.npmjs.org/@dnsam/sinhala-phonetics/-/sinhala-phonetics-0.1.1.tgz","fileCount":20,"unpackedSize":509857,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCfYgkNBTwABmN0b9P8Q+tmmhq6WUvu2KjU/rwhYUItRwIhAIaHp81nr1mLpwT07zMViuxQ4LHPnbO8GlMOXM8DG5BC"}]},"_npmUser":{"name":"dnsam","email":"dnsam.dell@gmail.com"},"directories":{},"maintainers":[{"name":"dnsam","email":"dnsam.dell@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sinhala-phonetics_0.1.1_1779675104937_0.025634830079669157"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-25T01:53:14.259Z","modified":"2026-05-25T02:11:45.222Z","0.1.0":"2026-05-25T01:53:14.498Z","0.1.1":"2026-05-25T02:11:45.106Z"},"bugs":{"url":"https://github.com/dnsamw/sinhala-phonetics/issues"},"author":{"name":"Dileepa Sam"},"license":"MIT","homepage":"https://dnsamw.github.io/sinhala-phonetics","keywords":["sinhala","phonetics","react","input","unicode","transliteration"],"repository":{"type":"git","url":"git+https://github.com/dnsamw/sinhala-phonetics.git"},"description":"Sinhala phonetic input with word predictions — React components + headless converter","maintainers":[{"name":"dnsam","email":"dnsam.dell@gmail.com"}],"readme":"# @dnsam/sinhala-phonetics\n\n> Type Sinhala phonetically. Get Unicode. Instantly.\n\nA fully TypeScript-supported npm package for Sinhala phonetic input — ships React components with real-time conversion, word prediction, and full Tailwind CSS support.\n\n```\nnpm install @dnsam/sinhala-phonetics\n```\n\n---\n\n## Features\n\n- **Real-time conversion** — type `ayubowan`, get `ආයුබෝවන්`\n- **Word prediction** — dropdown suggestions as you type, powered by a built-in Sinhala dictionary\n- **React-ready** — drop-in `<SinhalaTypewriter>` component with suggestion dropdown\n- **Tailwind styled** — default styles included; fully overridable via `className` props\n- **Headless option** — pass `unstyled` to get bare elements and style your own way\n- **Framework-agnostic core** — use `convertText()` and `SinhalaPredictor` anywhere (Node, browser, Svelte, Vue…)\n- **Dual ESM + CJS** — tree-shakeable, works in all modern bundlers\n- **Zero runtime dependencies**\n\n---\n\n## Quick Start\n\n### All-in-one component (recommended)\n\n```tsx\nimport { SinhalaTypewriter } from '@dnsam/sinhala-phonetics';\n\nexport default function App() {\n  const [text, setText] = useState('');\n\n  return (\n    <SinhalaTypewriter\n      onChange={setText}\n      placeholder='Type \"ayubowan\"…'\n      maxSuggestions={5}\n    />\n  );\n}\n```\n\n### Tailwind content path\n\nAdd this to your `tailwind.config.js` so the default styles are not purged:\n\n```js\ncontent: [\n  // ... your other paths\n  './node_modules/@dnsam/sinhala-phonetics/dist/**/*.js',\n]\n```\n\n---\n\n## Phonetic Reference\n\n| Type      | You get   | Meaning        |\n|-----------|-----------|----------------|\n| `ayubowan`| ආයුබෝවන් | Hello / Welcome |\n| `mama`    | මම        | I / Me          |\n| `amma`    | අම්මා     | Mother          |\n| `kohomada`| කොහොමද   | How are you?    |\n| `rata`    | රට        | Country         |\n| `gama`    | ගම        | Village         |\n| `aadare`  | ආදරේ      | Love            |\n| `isthuthi`| ඉස්තූති   | Thanks          |\n\nFull phonetic mapping: [see the converter source](src/core/converter.ts).\n\n---\n\n## API Reference\n\n### `<SinhalaTypewriter>` — all-in-one component\n\n```tsx\n<SinhalaTypewriter\n  value={string}                   // controlled value (Sinhala)\n  defaultValue={string}            // uncontrolled initial value\n  onChange={(sinhala) => void}     // fires with converted Sinhala text\n  onPhoneticChange={(raw) => void} // fires with raw phonetic input\n  onSuggestionSelect={(word) => void}\n  showSuggestions={true}           // default: true\n  maxSuggestions={5}               // default: 5\n  placeholder={string}\n  disabled={boolean}\n  rows={number}                    // default: 4\n  unstyled={boolean}               // strip all default styles\n\n  // className overrides\n  className={string}               // wrapper div\n  inputClassName={string}          // textarea\n  suggestionsClassName={string}    // dropdown list <ul>\n  suggestionItemClassName={string} // each <li>\n/>\n```\n\n### `<SinhalaInput>` — textarea only (no suggestions)\n\n```tsx\n<SinhalaInput\n  onChange={(sinhala) => void}\n  placeholder=\"Type here…\"\n  rows={6}\n/>\n```\n\n### `<SuggestionList>` — standalone suggestion dropdown\n\n```tsx\n<SuggestionList\n  suggestions={[{ word: 'ගෙදර' }, { word: 'ගෙනාවා' }]}\n  onSelect={(word) => console.log(word)}\n/>\n```\n\n---\n\n## Hooks\n\n### `useSinhalaConverter`\n\nManages the phonetic ↔ Sinhala state. Useful when building a custom UI.\n\n```tsx\nimport { useSinhalaConverter } from '@dnsam/sinhala-phonetics';\n\nconst {\n  phoneticValue,       // raw typed input\n  sinhalaValue,        // converted Sinhala text\n  currentWordPhonetic, // phonetic text of the word being typed\n  currentWordSinhala,  // Sinhala conversion of current word\n  handlePhoneticChange,// call this with textarea value on onChange\n  replaceCurrentWord,  // inject a word, replaces current partial word\n  reset,               // clear everything\n} = useSinhalaConverter('', (sinhala) => console.log(sinhala));\n```\n\n### `useWordPrediction`\n\n```tsx\nimport { useWordPrediction } from '@dnsam/sinhala-phonetics';\n\nconst suggestions = useWordPrediction(currentWordSinhala, {\n  maxSuggestions: 5,\n  predictor: myCustomPredictor, // optional, defaults to built-in\n});\n// suggestions: Array<{ word: string }>\n```\n\n---\n\n## Core Utilities\n\n### `convertText(input: string): string`\n\nFramework-agnostic converter. Works in Node, Deno, browsers — anywhere.\n\n```ts\nimport { convertText } from '@dnsam/sinhala-phonetics';\n\nconvertText('mama')      // → 'මම'\nconvertText('ayubowan') // → 'ආයුබෝවන්'\nconvertText('kohomada') // → 'කොහොමද'\n```\n\n### `SinhalaPredictor`\n\nBuild your own predictor with a custom word list.\n\n```ts\nimport { SinhalaPredictor } from '@dnsam/sinhala-phonetics';\n\nconst predictor = new SinhalaPredictor(['ගෙදර', 'ගෙනාවා', 'ගෙල']);\npredictor.addWords(['අම්මා', 'තාත්තා']);\n\npredictor.predict('ගෙ', 3);\n// → [{ word: 'ගෙදර' }, { word: 'ගෙනාවා' }, { word: 'ගෙල' }]\n```\n\n### `SINHALA_WORDS`\n\nThe built-in dictionary (~350 common words) as a plain `string[]`. Import it to extend or inspect.\n\n```ts\nimport { SINHALA_WORDS } from '@dnsam/sinhala-phonetics';\n```\n\n---\n\n## TypeScript Types\n\n```ts\nimport type {\n  WordSuggestion,        // { word: string; frequency?: number }\n  SinhalaInputProps,\n  SinhalaTypewriterProps,\n  SuggestionListProps,\n} from '@dnsam/sinhala-phonetics';\n```\n\n---\n\n## Unstyled / Headless Usage\n\nPass `unstyled` to remove all default Tailwind classes and style entirely yourself:\n\n```tsx\n<SinhalaTypewriter\n  unstyled\n  inputClassName=\"my-textarea-class\"\n  suggestionsClassName=\"my-dropdown-class\"\n  suggestionItemClassName=\"my-item-class\"\n  onChange={setText}\n/>\n```\n\n---\n\n## Roadmap\n\n- [ ] Keyboard navigation for suggestions (↑ ↓ Enter)\n- [ ] Larger curated word dictionary\n- [ ] Frequency-based suggestion ranking\n- [ ] `<SinhalaInlineInput>` (single-line `<input>`)\n- [ ] Svelte / Vue wrappers\n\n---\n\n## License\n\nMIT © [Dileepa Sam](https://github.com/dnsamw)\n","readmeFilename":"README.md"}