tamil-toolkit 0.0.0-stage → 0.1.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,141 @@
1
+ # Third-party notices
2
+
3
+ Original tamil-toolkit code is MIT licensed. The following upstream data and
4
+ mapping notices retain their original terms; the project MIT license does not
5
+ replace them. Generated lexicon copies are checked against the canonical data.
6
+
7
+ Unicode 17 and CLDR 49 data: https://www.unicode.org/ and https://cldr.unicode.org/
8
+ Bamini mapping sources: https://github.com/ag-sanjjeev/app-tamil-fonts-unicode-converter
9
+ and https://github.com/Pakeetharan/unicode-bamini-converter
10
+ TSCII mapping source: https://github.com/mayooresan/Android-TamilUtil
11
+ Exact sources, revisions, digests and profile limits are recorded at:
12
+ https://github.com/abishtakan/tamil-toolkit/tree/HEAD/tests/reference
13
+ and https://github.com/abishtakan/tamil-toolkit/tree/HEAD/docs/specs
14
+
15
+ Binary distributions also include THIRD_PARTY_LICENSES.txt, generated from the
16
+ locked Rust dependency graph with the complete upstream license texts.
17
+
18
+ ## Unicode License V3
19
+
20
+ ```text
21
+ UNICODE LICENSE V3
22
+
23
+ COPYRIGHT AND PERMISSION NOTICE
24
+
25
+ Copyright © 1991-2026 Unicode, Inc.
26
+
27
+ NOTICE TO USER: Carefully read the following legal agreement. BY
28
+ DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR
29
+ SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
30
+ TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT
31
+ DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
32
+
33
+ Permission is hereby granted, free of charge, to any person obtaining a
34
+ copy of data files and any associated documentation (the "Data Files") or
35
+ software and any associated documentation (the "Software") to deal in the
36
+ Data Files or Software without restriction, including without limitation
37
+ the rights to use, copy, modify, merge, publish, distribute, and/or sell
38
+ copies of the Data Files or Software, and to permit persons to whom the
39
+ Data Files or Software are furnished to do so, provided that either (a)
40
+ this copyright and permission notice appear with all copies of the Data
41
+ Files or Software, or (b) this copyright and permission notice appear in
42
+ associated Documentation.
43
+
44
+ THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
45
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
46
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
47
+ THIRD PARTY RIGHTS.
48
+
49
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE
50
+ BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES,
51
+ OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
52
+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
53
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA
54
+ FILES OR SOFTWARE.
55
+
56
+ Except as contained in this notice, the name of a copyright holder shall
57
+ not be used in advertising or otherwise to promote the sale, use or other
58
+ dealings in these Data Files or Software without prior written
59
+ authorization of the copyright holder.
60
+ ```
61
+
62
+ ## ag-sanjjeev Bamini source (MIT)
63
+
64
+ ```text
65
+ MIT License
66
+
67
+ Copyright (c) 2023 ag-sanjjeev
68
+
69
+ Permission is hereby granted, free of charge, to any person obtaining a copy
70
+ of this software and associated documentation files (the "Software"), to deal
71
+ in the Software without restriction, including without limitation the rights
72
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
73
+ copies of the Software, and to permit persons to whom the Software is
74
+ furnished to do so, subject to the following conditions:
75
+
76
+ The above copyright notice and this permission notice shall be included in all
77
+ copies or substantial portions of the Software.
78
+
79
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
80
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
81
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
82
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
83
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
84
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
85
+ SOFTWARE.
86
+ ```
87
+
88
+ ## Pakeetharan Balasubramaniam Bamini reference (MIT)
89
+
90
+ ```text
91
+ MIT License
92
+
93
+ Copyright (c) 2025 Pakeetharan Balasubramaniam
94
+
95
+ Permission is hereby granted, free of charge, to any person obtaining a copy
96
+ of this software and associated documentation files (the "Software"), to deal
97
+ in the Software without restriction, including without limitation the rights
98
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99
+ copies of the Software, and to permit persons to whom the Software is
100
+ furnished to do so, subject to the following conditions:
101
+
102
+ The above copyright notice and this permission notice shall be included in all
103
+ copies or substantial portions of the Software.
104
+
105
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
106
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
107
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
108
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
109
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
110
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
111
+ SOFTWARE.
112
+ ```
113
+
114
+ ## Jay Mayu Android TamilUtil reference (MIT)
115
+
116
+ ```text
117
+ The MIT License (MIT)
118
+
119
+ Copyright (c) 2016 Jay Mayu
120
+
121
+ Permission is hereby granted, free of charge, to any person obtaining a copy
122
+ of this software and associated documentation files (the "Software"), to deal
123
+ in the Software without restriction, including without limitation the rights
124
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
125
+ copies of the Software, and to permit persons to whom the Software is
126
+ furnished to do so, subject to the following conditions:
127
+
128
+ The above copyright notice and this permission notice shall be included in all
129
+ copies or substantial portions of the Software.
130
+
131
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
132
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
133
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
134
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
135
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
136
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
137
+ SOFTWARE.
138
+
139
+ Above license is for Tamil-Utill only. We do not offer fonts used in the example under the same license.
140
+ ```
141
+
package/dist/api.d.ts ADDED
@@ -0,0 +1,56 @@
1
+ export interface Uyirmei {
2
+ mei: string;
3
+ uyir: string;
4
+ }
5
+ export interface Request {
6
+ op: string;
7
+ input: unknown;
8
+ }
9
+ export type Locale = "TN" | "SL";
10
+ export type Currency = "INR" | "LKR";
11
+ export type CodecErrorPolicy = "strict" | "preserve";
12
+ export type DigitStyle = "latin" | "tamil";
13
+ export type DateStyle = "short" | "medium" | "long" | "full";
14
+ export interface Inspection {
15
+ nfc: string;
16
+ nfd: string;
17
+ is_nfc: boolean;
18
+ is_nfd: boolean;
19
+ ezhuthu_count: number;
20
+ grapheme_count: number;
21
+ letters: {
22
+ text: string;
23
+ classification: string;
24
+ }[];
25
+ }
26
+ /** Serialization only. The Rust dispatcher owns every operation. */
27
+ export declare function createApi(nativeExecute: (request: string) => string): {
28
+ execute: (request: Request) => unknown;
29
+ get_letters: (text: string) => string[];
30
+ normalize_nfc: (text: string) => string;
31
+ normalize_nfd: (text: string) => string;
32
+ split_uyirmei: (text: string) => Uyirmei;
33
+ compose_uyirmei: (mei: string, uyir: string) => string;
34
+ inspect_tamil_string: (text: string) => Inspection;
35
+ compare: (left: string, right: string) => -1 | 0 | 1;
36
+ sort_words: (words: string[]) => string[];
37
+ sort_key: (text: string) => number[];
38
+ search_key: (text: string) => number[];
39
+ to_words: (value: number, locale?: Locale) => string;
40
+ format_currency: (amount_minor: number, currency: Currency, locale?: Locale) => string;
41
+ currency_to_words: (amount_minor: number, currency: Currency, locale?: Locale) => string;
42
+ bamini_to_unicode: (text: string, errors?: CodecErrorPolicy) => string;
43
+ unicode_to_bamini: (text: string) => string;
44
+ anjal_bytes_to_unicode: (bytes: Uint8Array | number[]) => string;
45
+ unicode_to_anjal_bytes: (text: string) => number[];
46
+ tam_bytes_to_unicode: (bytes: Uint8Array | number[]) => string;
47
+ unicode_to_tam_bytes: (text: string) => number[];
48
+ tab_bytes_to_unicode: (bytes: Uint8Array | number[]) => string;
49
+ unicode_to_tab_bytes: (text: string) => number[];
50
+ tscii_bytes_to_unicode: (bytes: Uint8Array | number[]) => string;
51
+ unicode_to_tscii_bytes: (text: string) => number[];
52
+ format_fraction: (numerator: number, denominator: number, digits?: DigitStyle) => string;
53
+ fraction_to_words: (numerator: number, denominator: number, locale?: Locale) => string;
54
+ fraction_symbol: (numerator: number, denominator: number) => string;
55
+ format_date: (year: number, month: number, day: number, locale?: Locale, style?: DateStyle, digits?: DigitStyle) => string;
56
+ };
package/dist/api.js ADDED
@@ -0,0 +1,34 @@
1
+ /** Serialization only. The Rust dispatcher owns every operation. */
2
+ export function createApi(nativeExecute) {
3
+ const execute = (request) => JSON.parse(nativeExecute(JSON.stringify(request)));
4
+ return {
5
+ execute,
6
+ get_letters: (text) => execute({ op: "get_letters", input: text }),
7
+ normalize_nfc: (text) => execute({ op: "normalize_nfc", input: text }),
8
+ normalize_nfd: (text) => execute({ op: "normalize_nfd", input: text }),
9
+ split_uyirmei: (text) => execute({ op: "split_uyirmei", input: text }),
10
+ compose_uyirmei: (mei, uyir) => execute({ op: "compose_uyirmei", input: { mei, uyir } }),
11
+ inspect_tamil_string: (text) => execute({ op: "inspect_tamil_string", input: text }),
12
+ compare: (left, right) => execute({ op: "compare", input: { left, right } }),
13
+ sort_words: (words) => execute({ op: "sort_words", input: words }),
14
+ sort_key: (text) => execute({ op: "sort_key", input: text }),
15
+ search_key: (text) => execute({ op: "search_key", input: text }),
16
+ to_words: (value, locale = "TN") => execute({ op: "to_words", input: { value, locale } }),
17
+ format_currency: (amount_minor, currency, locale = "TN") => execute({ op: "format_currency", input: { amount_minor, currency, locale } }),
18
+ currency_to_words: (amount_minor, currency, locale = "TN") => execute({ op: "currency_to_words", input: { amount_minor, currency, locale } }),
19
+ bamini_to_unicode: (text, errors = "strict") => execute({ op: "bamini_to_unicode", input: { text, errors } }),
20
+ unicode_to_bamini: (text) => execute({ op: "unicode_to_bamini", input: { text } }),
21
+ anjal_bytes_to_unicode: (bytes) => execute({ op: "anjal_bytes_to_unicode", input: { bytes: Array.from(bytes) } }),
22
+ unicode_to_anjal_bytes: (text) => execute({ op: "unicode_to_anjal_bytes", input: { text } }),
23
+ tam_bytes_to_unicode: (bytes) => execute({ op: "tam_bytes_to_unicode", input: { bytes: Array.from(bytes) } }),
24
+ unicode_to_tam_bytes: (text) => execute({ op: "unicode_to_tam_bytes", input: { text } }),
25
+ tab_bytes_to_unicode: (bytes) => execute({ op: "tab_bytes_to_unicode", input: { bytes: Array.from(bytes) } }),
26
+ unicode_to_tab_bytes: (text) => execute({ op: "unicode_to_tab_bytes", input: { text } }),
27
+ tscii_bytes_to_unicode: (bytes) => execute({ op: "tscii_bytes_to_unicode", input: { bytes: Array.from(bytes) } }),
28
+ unicode_to_tscii_bytes: (text) => execute({ op: "unicode_to_tscii_bytes", input: { text } }),
29
+ format_fraction: (numerator, denominator, digits = "latin") => execute({ op: "format_fraction", input: { numerator, denominator, digits } }),
30
+ fraction_to_words: (numerator, denominator, locale = "TN") => execute({ op: "fraction_to_words", input: { numerator, denominator, locale } }),
31
+ fraction_symbol: (numerator, denominator) => execute({ op: "fraction_symbol", input: { numerator, denominator } }),
32
+ format_date: (year, month, day, locale = "TN", style = "long", digits = "latin") => execute({ op: "format_date", input: { year, month, day, locale, style, digits } }),
33
+ };
34
+ }
@@ -0,0 +1,2 @@
1
+ export type { Uyirmei, Request, Inspection, Locale, Currency, CodecErrorPolicy, DigitStyle, DateStyle } from "./api.js";
2
+ export declare const execute: (request: import("./api.js").Request) => unknown, get_letters: (text: string) => string[], normalize_nfc: (text: string) => string, normalize_nfd: (text: string) => string, split_uyirmei: (text: string) => import("./api.js").Uyirmei, compose_uyirmei: (mei: string, uyir: string) => string, inspect_tamil_string: (text: string) => import("./api.js").Inspection, compare: (left: string, right: string) => -1 | 0 | 1, sort_words: (words: string[]) => string[], sort_key: (text: string) => number[], search_key: (text: string) => number[], to_words: (value: number, locale?: import("./api.js").Locale) => string, format_currency: (amount_minor: number, currency: import("./api.js").Currency, locale?: import("./api.js").Locale) => string, currency_to_words: (amount_minor: number, currency: import("./api.js").Currency, locale?: import("./api.js").Locale) => string, bamini_to_unicode: (text: string, errors?: import("./api.js").CodecErrorPolicy) => string, unicode_to_bamini: (text: string) => string, anjal_bytes_to_unicode: (bytes: Uint8Array | number[]) => string, unicode_to_anjal_bytes: (text: string) => number[], tam_bytes_to_unicode: (bytes: Uint8Array | number[]) => string, unicode_to_tam_bytes: (text: string) => number[], tab_bytes_to_unicode: (bytes: Uint8Array | number[]) => string, unicode_to_tab_bytes: (text: string) => number[], tscii_bytes_to_unicode: (bytes: Uint8Array | number[]) => string, unicode_to_tscii_bytes: (text: string) => number[], format_fraction: (numerator: number, denominator: number, digits?: import("./api.js").DigitStyle) => string, fraction_to_words: (numerator: number, denominator: number, locale?: import("./api.js").Locale) => string, fraction_symbol: (numerator: number, denominator: number) => string, format_date: (year: number, month: number, day: number, locale?: import("./api.js").Locale, style?: import("./api.js").DateStyle, digits?: import("./api.js").DigitStyle) => string;
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import { execute as nativeExecute } from "../pkg-node/tamil_toolkit.js";
2
+ import { createApi } from "./api.js";
3
+ export const { execute, get_letters, normalize_nfc, normalize_nfd, split_uyirmei, compose_uyirmei, inspect_tamil_string, compare, sort_words, sort_key, search_key, to_words, format_currency, currency_to_words, bamini_to_unicode, unicode_to_bamini, anjal_bytes_to_unicode, unicode_to_anjal_bytes, tam_bytes_to_unicode, unicode_to_tam_bytes, tab_bytes_to_unicode, unicode_to_tab_bytes, tscii_bytes_to_unicode, unicode_to_tscii_bytes, format_fraction, fraction_to_words, fraction_symbol, format_date } = createApi(nativeExecute);
package/dist/web.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import init from "../pkg-web/tamil_toolkit.js";
2
+ export { init };
3
+ export type { Uyirmei, Request, Inspection, Locale, Currency, CodecErrorPolicy, DigitStyle, DateStyle } from "./api.js";
4
+ export declare const execute: (request: import("./api.js").Request) => unknown, get_letters: (text: string) => string[], normalize_nfc: (text: string) => string, normalize_nfd: (text: string) => string, split_uyirmei: (text: string) => import("./api.js").Uyirmei, compose_uyirmei: (mei: string, uyir: string) => string, inspect_tamil_string: (text: string) => import("./api.js").Inspection, compare: (left: string, right: string) => -1 | 0 | 1, sort_words: (words: string[]) => string[], sort_key: (text: string) => number[], search_key: (text: string) => number[], to_words: (value: number, locale?: import("./api.js").Locale) => string, format_currency: (amount_minor: number, currency: import("./api.js").Currency, locale?: import("./api.js").Locale) => string, currency_to_words: (amount_minor: number, currency: import("./api.js").Currency, locale?: import("./api.js").Locale) => string, bamini_to_unicode: (text: string, errors?: import("./api.js").CodecErrorPolicy) => string, unicode_to_bamini: (text: string) => string, anjal_bytes_to_unicode: (bytes: Uint8Array | number[]) => string, unicode_to_anjal_bytes: (text: string) => number[], tam_bytes_to_unicode: (bytes: Uint8Array | number[]) => string, unicode_to_tam_bytes: (text: string) => number[], tab_bytes_to_unicode: (bytes: Uint8Array | number[]) => string, unicode_to_tab_bytes: (text: string) => number[], tscii_bytes_to_unicode: (bytes: Uint8Array | number[]) => string, unicode_to_tscii_bytes: (text: string) => number[], format_fraction: (numerator: number, denominator: number, digits?: import("./api.js").DigitStyle) => string, fraction_to_words: (numerator: number, denominator: number, locale?: import("./api.js").Locale) => string, fraction_symbol: (numerator: number, denominator: number) => string, format_date: (year: number, month: number, day: number, locale?: import("./api.js").Locale, style?: import("./api.js").DateStyle, digits?: import("./api.js").DigitStyle) => string;
package/dist/web.js ADDED
@@ -0,0 +1,4 @@
1
+ import init, { execute as nativeExecute } from "../pkg-web/tamil_toolkit.js";
2
+ import { createApi } from "./api.js";
3
+ export { init };
4
+ export const { execute, get_letters, normalize_nfc, normalize_nfd, split_uyirmei, compose_uyirmei, inspect_tamil_string, compare, sort_words, sort_key, search_key, to_words, format_currency, currency_to_words, bamini_to_unicode, unicode_to_bamini, anjal_bytes_to_unicode, unicode_to_anjal_bytes, tam_bytes_to_unicode, unicode_to_tam_bytes, tab_bytes_to_unicode, unicode_to_tab_bytes, tscii_bytes_to_unicode, unicode_to_tscii_bytes, format_fraction, fraction_to_words, fraction_symbol, format_date } = createApi(nativeExecute);
package/package.json CHANGED
@@ -1,6 +1,23 @@
1
1
  {
2
2
  "name": "tamil-toolkit",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0-alpha.2",
4
+ "license": "MIT",
5
+ "repository": {"type": "git", "url": "https://github.com/abishtakan/tamil-toolkit.git", "directory": "bindings/js-wasm"},
6
+ "homepage": "https://github.com/abishtakan/tamil-toolkit#readme",
7
+ "bugs": "https://github.com/abishtakan/tamil-toolkit/issues",
8
+ "keywords": ["tamil", "unicode", "wasm", "collation", "numerals", "bamini"],
9
+ "engines": {"node": ">=22"},
10
+ "publishConfig": {"access": "public", "tag": "alpha"},
11
+ "type": "module",
12
+ "description": "Thin TypeScript/WASM bindings for the Rust Tamil toolkit",
13
+ "exports": {
14
+ ".": {
15
+ "node": {"types": "./dist/index.d.ts", "default": "./dist/index.js"},
16
+ "default": {"types": "./dist/web.d.ts", "default": "./dist/web.js"}
17
+ },
18
+ "./web": {"types": "./dist/web.d.ts", "default": "./dist/web.js"}
19
+ },
20
+ "files": ["dist", "pkg-node", "pkg-web", "README.md", "LICENSE", "THIRD_PARTY_NOTICES.md", "THIRD_PARTY_LICENSES.txt"],
21
+ "scripts": {"build": "tsc", "test": "vitest run"},
22
+ "devDependencies": {"@types/node": "^24.0.0", "typescript": "7.0.2", "vitest": "5.0.5", "wasm-pack": "0.15.1"}
23
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 tamil-toolkit contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,39 @@
1
+ # tamil-toolkit for TypeScript / WASM
2
+
3
+ `just sync-bindings` produces Node and browser WASM builds and TypeScript
4
+ declarations. Node: `import * as tamil from 'tamil-toolkit'`. Browser:
5
+ `import { init, get_letters } from 'tamil-toolkit/web'; await init();`.
6
+ Install the experimental MIT-licensed alpha on npm with `npm install tamil-toolkit@alpha`.
7
+ These adapters serialize calls into the shared Rust dispatcher. Planned modules
8
+ are excluded. APIs may change before stability. Node 22+ is supported; browser
9
+ consumers must initialize the WASM module before calling its functions.
10
+
11
+ ```javascript
12
+ import { format_fraction, format_currency } from "tamil-toolkit";
13
+
14
+ console.log(format_fraction(2, 4)); // 1/2
15
+ console.log(format_currency(102550, "LKR", "SL")); // LKR 1,025.50
16
+ ```
17
+
18
+ The package includes core Unicode/Ezhuthu functions, Agara collation, bounded
19
+ TN/SL integer and currency words, fractions, Gregorian dates, and explicit
20
+ Bamini and bounded TSCII, TAB, TAM and Anjal byte conversion. For browser code use the `/web` entry point, `await init()`,
21
+ then call the same methods. Hosts must serve the packaged WASM file with the
22
+ generated loader; bundlers must support WebAssembly assets and ES modules.
23
+ See LICENSE, THIRD_PARTY_NOTICES.md, and bundled dependency license notices.
24
+
25
+ Both entry points expose `compare`, `sort_words`, `sort_key`, and `search_key`.
26
+ Use the comparison result or numeric-array keys for ordering; comparing their
27
+ JSON string representation is incorrect. The versioned `agara-v1` profile and
28
+ its mixed-script fallback are specified at
29
+ https://github.com/abishtakan/tamil-toolkit/tree/HEAD/docs/specs/collate-v0.1.md.
30
+
31
+ This distribution provides `tscii_bytes_to_unicode(new Uint8Array([0xba, 0xa2, 0xc5, 0xfd]))`.
32
+
33
+ `unicode_to_tscii_bytes(text)` returns an array of byte values.
34
+
35
+ This distribution provides `tab_bytes_to_unicode(bytes)` and `unicode_to_tab_bytes(text)`.
36
+
37
+ This distribution provides `tam_bytes_to_unicode(bytes)` and `unicode_to_tam_bytes(text)`; TAM bytes do not preserve Latin letters.
38
+
39
+ This distribution provides `anjal_bytes_to_unicode(bytes)` and `unicode_to_anjal_bytes(text)`; ambiguous legacy bytes raise an error.
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "tamil-wasm",
3
+ "description": "Thin WASM bindings for tamil-toolkit",
4
+ "version": "0.1.0-alpha.2",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/abishtakan/tamil-toolkit"
9
+ },
10
+ "files": [
11
+ "tamil_toolkit_bg.wasm",
12
+ "tamil_toolkit.js",
13
+ "tamil_toolkit.d.ts"
14
+ ],
15
+ "main": "tamil_toolkit.js",
16
+ "types": "tamil_toolkit.d.ts"
17
+ }
@@ -0,0 +1,4 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export function execute(request: string): string;
@@ -0,0 +1,132 @@
1
+ /* @ts-self-types="./tamil_toolkit.d.ts" */
2
+
3
+ /**
4
+ * @param {string} request
5
+ * @returns {string}
6
+ */
7
+ function execute(request) {
8
+ let deferred3_0;
9
+ let deferred3_1;
10
+ try {
11
+ const ptr0 = passStringToWasm0(request, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
12
+ const len0 = WASM_VECTOR_LEN;
13
+ const ret = wasm.execute(ptr0, len0);
14
+ var ptr2 = ret[0];
15
+ var len2 = ret[1];
16
+ if (ret[3]) {
17
+ ptr2 = 0; len2 = 0;
18
+ throw takeFromExternrefTable0(ret[2]);
19
+ }
20
+ deferred3_0 = ptr2;
21
+ deferred3_1 = len2;
22
+ return getStringFromWasm0(ptr2, len2);
23
+ } finally {
24
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
25
+ }
26
+ }
27
+ exports.execute = execute;
28
+ function __wbg_get_imports() {
29
+ const import0 = {
30
+ __proto__: null,
31
+ __wbg_Error_208446807d0d1e30: function(arg0, arg1) {
32
+ const ret = Error(getStringFromWasm0(arg0, arg1));
33
+ return ret;
34
+ },
35
+ __wbindgen_init_externref_table: function() {
36
+ const table = wasm.__wbindgen_externrefs;
37
+ table.set(0, undefined);
38
+ table.set(1024, undefined);
39
+ table.set(1025, null);
40
+ table.set(1026, true);
41
+ table.set(1027, false);
42
+ },
43
+ };
44
+ return {
45
+ __proto__: null,
46
+ "./tamil_toolkit_bg.js": import0,
47
+ };
48
+ }
49
+
50
+ function getStringFromWasm0(ptr, len) {
51
+ ptr = ptr >>> 0;
52
+ return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
53
+ }
54
+
55
+ let cachedUint8ArrayMemory0 = null;
56
+ function getUint8ArrayMemory0() {
57
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
58
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
59
+ }
60
+ return cachedUint8ArrayMemory0;
61
+ }
62
+
63
+ function passStringToWasm0(arg, malloc, realloc) {
64
+ if (realloc === undefined) {
65
+ const buf = cachedTextEncoder.encode(arg);
66
+ const ptr = malloc(buf.length, 1) >>> 0;
67
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
68
+ WASM_VECTOR_LEN = buf.length;
69
+ return ptr;
70
+ }
71
+
72
+ let len = arg.length;
73
+ let ptr = malloc(len, 1) >>> 0;
74
+
75
+ const mem = getUint8ArrayMemory0();
76
+
77
+ let offset = 0;
78
+
79
+ for (; offset < len; offset++) {
80
+ const code = arg.charCodeAt(offset);
81
+ if (code > 0x7F) break;
82
+ mem[ptr + offset] = code;
83
+ }
84
+ if (offset !== len) {
85
+ if (offset !== 0) {
86
+ arg = arg.slice(offset);
87
+ }
88
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
89
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
90
+ const ret = cachedTextEncoder.encodeInto(arg, view);
91
+
92
+ offset += ret.written;
93
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
94
+ }
95
+
96
+ WASM_VECTOR_LEN = offset;
97
+ return ptr;
98
+ }
99
+
100
+ function takeFromExternrefTable0(idx) {
101
+ const value = wasm.__wbindgen_externrefs.get(idx);
102
+ wasm.__externref_table_dealloc(idx);
103
+ return value;
104
+ }
105
+
106
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
107
+ cachedTextDecoder.decode();
108
+ function decodeText(bytes) {
109
+ return cachedTextDecoder.decode(bytes);
110
+ }
111
+
112
+ const cachedTextEncoder = new TextEncoder();
113
+
114
+ if (!('encodeInto' in cachedTextEncoder)) {
115
+ cachedTextEncoder.encodeInto = function (arg, view) {
116
+ const buf = cachedTextEncoder.encode(arg);
117
+ view.set(buf);
118
+ return {
119
+ read: arg.length,
120
+ written: buf.length
121
+ };
122
+ };
123
+ }
124
+
125
+ let WASM_VECTOR_LEN = 0;
126
+
127
+ const wasmPath = `${__dirname}/tamil_toolkit_bg.wasm`;
128
+ const wasmBytes = require('fs').readFileSync(wasmPath);
129
+ const wasmModule = new WebAssembly.Module(wasmBytes);
130
+ let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
131
+ let wasm = wasmInstance.exports;
132
+ wasm.__wbindgen_start();
Binary file
@@ -0,0 +1,10 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const execute: (a: number, b: number) => [number, number, number, number];
5
+ export const __wbindgen_externrefs: WebAssembly.Table;
6
+ export const __wbindgen_malloc: (a: number, b: number) => number;
7
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
8
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
9
+ export const __externref_table_dealloc: (a: number) => void;
10
+ export const __wbindgen_start: () => void;
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 tamil-toolkit contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,39 @@
1
+ # tamil-toolkit for TypeScript / WASM
2
+
3
+ `just sync-bindings` produces Node and browser WASM builds and TypeScript
4
+ declarations. Node: `import * as tamil from 'tamil-toolkit'`. Browser:
5
+ `import { init, get_letters } from 'tamil-toolkit/web'; await init();`.
6
+ Install the experimental MIT-licensed alpha on npm with `npm install tamil-toolkit@alpha`.
7
+ These adapters serialize calls into the shared Rust dispatcher. Planned modules
8
+ are excluded. APIs may change before stability. Node 22+ is supported; browser
9
+ consumers must initialize the WASM module before calling its functions.
10
+
11
+ ```javascript
12
+ import { format_fraction, format_currency } from "tamil-toolkit";
13
+
14
+ console.log(format_fraction(2, 4)); // 1/2
15
+ console.log(format_currency(102550, "LKR", "SL")); // LKR 1,025.50
16
+ ```
17
+
18
+ The package includes core Unicode/Ezhuthu functions, Agara collation, bounded
19
+ TN/SL integer and currency words, fractions, Gregorian dates, and explicit
20
+ Bamini and bounded TSCII, TAB, TAM and Anjal byte conversion. For browser code use the `/web` entry point, `await init()`,
21
+ then call the same methods. Hosts must serve the packaged WASM file with the
22
+ generated loader; bundlers must support WebAssembly assets and ES modules.
23
+ See LICENSE, THIRD_PARTY_NOTICES.md, and bundled dependency license notices.
24
+
25
+ Both entry points expose `compare`, `sort_words`, `sort_key`, and `search_key`.
26
+ Use the comparison result or numeric-array keys for ordering; comparing their
27
+ JSON string representation is incorrect. The versioned `agara-v1` profile and
28
+ its mixed-script fallback are specified at
29
+ https://github.com/abishtakan/tamil-toolkit/tree/HEAD/docs/specs/collate-v0.1.md.
30
+
31
+ This distribution provides `tscii_bytes_to_unicode(new Uint8Array([0xba, 0xa2, 0xc5, 0xfd]))`.
32
+
33
+ `unicode_to_tscii_bytes(text)` returns an array of byte values.
34
+
35
+ This distribution provides `tab_bytes_to_unicode(bytes)` and `unicode_to_tab_bytes(text)`.
36
+
37
+ This distribution provides `tam_bytes_to_unicode(bytes)` and `unicode_to_tam_bytes(text)`; TAM bytes do not preserve Latin letters.
38
+
39
+ This distribution provides `anjal_bytes_to_unicode(bytes)` and `unicode_to_anjal_bytes(text)`; ambiguous legacy bytes raise an error.
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "tamil-wasm",
3
+ "type": "module",
4
+ "description": "Thin WASM bindings for tamil-toolkit",
5
+ "version": "0.1.0-alpha.2",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/abishtakan/tamil-toolkit"
10
+ },
11
+ "files": [
12
+ "tamil_toolkit_bg.wasm",
13
+ "tamil_toolkit.js",
14
+ "tamil_toolkit.d.ts"
15
+ ],
16
+ "main": "tamil_toolkit.js",
17
+ "types": "tamil_toolkit.d.ts",
18
+ "sideEffects": [
19
+ "./snippets/*"
20
+ ]
21
+ }
@@ -0,0 +1,39 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export function execute(request: string): string;
5
+
6
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
7
+
8
+ export interface InitOutput {
9
+ readonly memory: WebAssembly.Memory;
10
+ readonly execute: (a: number, b: number) => [number, number, number, number];
11
+ readonly __wbindgen_externrefs: WebAssembly.Table;
12
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
13
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
14
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
15
+ readonly __externref_table_dealloc: (a: number) => void;
16
+ readonly __wbindgen_start: () => void;
17
+ }
18
+
19
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
20
+
21
+ /**
22
+ * Instantiates the given `module`, which can either be bytes or
23
+ * a precompiled `WebAssembly.Module`.
24
+ *
25
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
26
+ *
27
+ * @returns {InitOutput}
28
+ */
29
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
30
+
31
+ /**
32
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
33
+ * for everything else, calls `WebAssembly.instantiate` directly.
34
+ *
35
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
36
+ *
37
+ * @returns {Promise<InitOutput>}
38
+ */
39
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;