{"_id":"@alphatype/alda-js","name":"@alphatype/alda-js","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@alphatype/alda-js","version":"0.1.0","description":"Parser and utilities for the Alda skeleton motion font format","main":"src/index.js","types":"src/index.d.ts","scripts":{"test":"node test/index.test.js","build":"npx esbuild src/alda-text.js --bundle --outfile=dist/alda-text.js --platform=browser --format=iife --global-name=AldaText --minify","build:dev":"npx esbuild src/alda-text.js --bundle --outfile=dist/alda-text.js --platform=browser --format=iife --global-name=AldaText --sourcemap"},"keywords":["font","skeleton","motion","animation","alda","hangul","typography"],"author":{"name":"Alphatype"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/alphatype-studio/alda.git","directory":"alda-js"},"homepage":"https://github.com/alphatype-studio/alda#readme","bugs":{"url":"https://github.com/alphatype-studio/alda/issues"},"engines":{"node":">=16"},"_id":"@alphatype/alda-js@0.1.0","gitHead":"55a722c23ce2d3816c44394bca610423412c6bfc","_nodeVersion":"22.12.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-/obKYTC7QMe+ZFhFNRBzxLBPe45gaSngBPvRUA4UbjyuJIM7nDauzl6l2onYQE1Jw3nm9s1bNUk3LrG+2oGX0A==","shasum":"c6f3a6c1547925166d6fea743fb5b60c31db2ad4","tarball":"https://registry.npmjs.org/@alphatype/alda-js/-/alda-js-0.1.0.tgz","fileCount":10,"unpackedSize":52566,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHxkvmqpqRGlQdnpKr/+ilJSqrbd78E8DyZnLuCht1qvAiA9t2vUrRXaLaC5bcDyFCzYEWqMXU68gEC69jvA8Bn/AA=="}]},"_npmUser":{"name":"hyperfection","email":"contact.yongjoo@gmail.com"},"directories":{},"maintainers":[{"name":"hyperfection","email":"contact.yongjoo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/alda-js_0.1.0_1774390475179_0.6034391793561642"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-24T22:14:35.074Z","0.1.0":"2026-03-24T22:14:35.313Z","modified":"2026-03-24T22:14:35.851Z"},"maintainers":[{"name":"hyperfection","email":"contact.yongjoo@gmail.com"}],"description":"Parser and utilities for the Alda skeleton motion font format","homepage":"https://github.com/alphatype-studio/alda#readme","keywords":["font","skeleton","motion","animation","alda","hangul","typography"],"repository":{"type":"git","url":"git+https://github.com/alphatype-studio/alda.git","directory":"alda-js"},"author":{"name":"Alphatype"},"bugs":{"url":"https://github.com/alphatype-studio/alda/issues"},"license":"MIT","readme":"# @alphatype/alda-js\n\nParser and utilities for the [Alda](https://github.com/alphatype/alda) skeleton motion font format.\n\n[![npm version](https://img.shields.io/npm/v/@alphatype/alda-js)](https://www.npmjs.com/package/@alphatype/alda-js)\n[![license](https://img.shields.io/npm/l/@alphatype/alda-js)](LICENSE)\n\n## Install\n\n```bash\nnpm install @alphatype/alda-js\n```\n\nOr use via CDN (no install needed):\n\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/@alphatype/alda-js/src/index.js\"></script>\n```\n\n## Quick Start\n\n```js\nimport Alda from '@alphatype/alda-js'\n\nconst font = Alda.load(aldaJsonString)  // → AldaFont\n\n// Look up a glyph\nconst glyph = font.getGlyphByChar('가')\nconsole.log(glyph.skeleton)  // stroke array\n\n// Play animation\nconst anim = font.getAnimation('write')\nconsole.log(anim.tracks)\n\n// Active FX\nconsole.log(font.getEnabledFx())\n```\n\n## API\n\n### `Alda.load(jsonStringOrObject) → AldaFont`\n\nParse and validate an Alda document. Throws `TypeError` with a list of validation errors if the document is invalid.\n\n### `Alda.isValid(data) → boolean`\n\nReturns `true` if `data` is a structurally valid Alda document.\n\n### `AldaFont`\n\n| Method | Returns | Description |\n|---|---|---|\n| `.getGlyph(unicode)` | `AldaGlyph \\| null` | Look up by hex codepoint e.g. `'AC00'` |\n| `.getGlyphByChar(char)` | `AldaGlyph \\| null` | Look up by character e.g. `'가'` |\n| `.getAnimation(id)` | `AldaAnimation \\| null` | Look up animation by id |\n| `.getEnabledFx()` | `AldaFx[]` | All FX with `enabled: true` |\n| `.toJSON()` | `string` | Serialize back to `.alda` JSON |\n| `.meta` | `AldaMeta` | Font metadata |\n| `.glyphs` | `AldaGlyph[]` | All glyphs |\n| `.animations` | `AldaAnimation[]` | All animations |\n| `.fx` | `AldaFx[]` | All FX |\n\n### `Alda.brush`\n\nBrush math utilities based on the elliptical brush model `S = √(rx × ry)`.\n\n| Method | Description |\n|---|---|\n| `.computeS(rx, ry)` | `S = √(rx·ry)` — geometric mean (size scalar) |\n| `.computeRy(S, rx)` | `ry = S²/rx` — recover ry when S is fixed |\n| `.computeRoundness(rx, ry)` | `(ry/rx)×100` — roundness % |\n| `.scale(brush, factor)` | Scale brush preserving ratio and angle |\n| `.normalize(brush?)` | Fill missing fields with defaults |\n\n## Format\n\nSee [spec/alda-spec-v0.1.md](../spec/alda-spec-v0.1.md) for the full format specification.\n\nA minimal `.alda` file:\n\n```json\n{\n  \"alda\": \"0.1\",\n  \"meta\": {\n    \"name\": \"My Font\",\n    \"upm\": 1000,\n    \"ascender\": 800,\n    \"descender\": -200\n  },\n  \"glyphs\": [\n    {\n      \"unicode\": \"AC00\",\n      \"name\": \"가\",\n      \"advance\": 550,\n      \"skeleton\": [\n        {\n          \"id\": \"stroke-0\",\n          \"points\": [\n            { \"x\": 275, \"y\": 750, \"type\": \"move\" },\n            { \"x\": 275, \"y\": 50,  \"type\": \"line\" }\n          ],\n          \"width_profile\": [30, 25]\n        }\n      ],\n      \"brush\": { \"rx\": 14, \"ry\": 6, \"angle\": -0.3, \"roundness\": 43 }\n    }\n  ]\n}\n```\n\n## License\n\nMIT © Alphatype\n","readmeFilename":"README.md","_rev":"1-cece84f279f7f1f6eb4561fc80ed317a"}