@urbit-xyz/azimuth-hanzi 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 azimuth-hanzi 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.
package/README.md ADDED
@@ -0,0 +1,98 @@
1
+ # azimuth-hanzi
2
+
3
+ Chinese-character sigils for Urbit Azimuth identities. Maps the 512 Urbit syllables (256 prefixes + 256 suffixes) to Hanzi characters and renders them as SVG.
4
+
5
+ > **Status:** the mapping is a work in progress. This repository is open so the character assignments can be refined collaboratively before they are finalized. See [DESIGN.md](./DESIGN.md) for the ruleset and open items.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @urbit-xyz/azimuth-hanzi
11
+ ```
12
+
13
+ ## Use
14
+
15
+ ```typescript
16
+ import { hanziSigil, parsePoint } from '@urbit-xyz/azimuth-hanzi'
17
+
18
+ const svg = hanziSigil({
19
+ point: '~sampel-palnet',
20
+ size: 128,
21
+ background: '#000',
22
+ foreground: '#fff',
23
+ space: 'default', // 'none' | 'default' | 'large'
24
+ })
25
+
26
+ const parsed = parsePoint('~sampel-palnet')
27
+ // { phonemes: ['sam', 'pel', 'pal', 'net'], characters: ['森', '培', ...], type: 'planet' }
28
+ ```
29
+
30
+ Layout by point type:
31
+
32
+ | Ship type | Characters | Layout |
33
+ | --------- | ---------- | ------------ |
34
+ | Galaxy | 1 | Centered |
35
+ | Star | 2 | Side-by-side |
36
+ | Planet | 4 | 2×2 grid |
37
+ | Moon | 8 | 2×4 grid |
38
+
39
+ For repeated renders of the same configuration, use `memoizedHanziSigil` (same signature, cached by config).
40
+
41
+ ### Web components
42
+
43
+ Auto-registered on module load:
44
+
45
+ ```html
46
+ <urbit-hanzi point="~sampel-palnet" size="128" background="#000" foreground="#fff"></urbit-hanzi>
47
+ <urbit-hanzi-image point="~sampel-palnet" size="128"></urbit-hanzi-image>
48
+ ```
49
+
50
+ ### Inspecting the mapping
51
+
52
+ ```typescript
53
+ import { PREFIXES, PREFIX_GROUPS, getCharacter } from '@urbit-xyz/azimuth-hanzi'
54
+
55
+ PREFIXES[0] // 'doz' — Urbit syllable for byte 0
56
+ getCharacter('doz') // '红' — assigned Hanzi
57
+ PREFIX_GROUPS['Colors & Light'] // { 0: ['红', 'hóng', 'red'], 1: ['青', 'qīng', 'azure'], ... }
58
+ ```
59
+
60
+ `SUFFIXES`, `SUFFIX_GROUPS`, `PREFIX_CHARACTERS` (flat map with category attached), `PHONEME_INDEX`, `isPrefix`, and `isSuffix` are also exported.
61
+
62
+ ## Develop
63
+
64
+ ```bash
65
+ git clone https://github.com/master-malwyl/azimuth-hanzi
66
+ cd azimuth-hanzi
67
+ npm install
68
+ npm run build # emits ./dist
69
+ npm test
70
+ npm run preview # serves http://localhost:8080/preview.html
71
+ ```
72
+
73
+ `preview.html` is a single-file catalogue viewer: every prefix and suffix side-by-side with pinyin and gloss, plus a generator that renders any Urbit ID.
74
+
75
+ ## Contributing
76
+
77
+ Read [DESIGN.md](./DESIGN.md) first — it explains the goal, the ruleset that guides character choices, and the open items a refinement pass should tackle.
78
+
79
+ The canonical 512-character mapping lives in [`src/mapping.ts`](./src/mapping.ts), keyed by byte (0–255) and grouped by theme:
80
+
81
+ ```typescript
82
+ export const PREFIX_GROUPS = {
83
+ 'Colors & Light': { // bytes 0-21 (doz..lid)
84
+ 0: ['红', 'hóng', 'red'],
85
+ 1: ['青', 'qīng', 'azure'],
86
+ // ...
87
+ },
88
+ // ...
89
+ }
90
+ ```
91
+
92
+ To change an assignment, edit the `[character, pinyin, gloss]` tuple in place. The group key is the category; moving an entry to a different category means moving the line to a different group (and updating the byte-range comment on both groups).
93
+
94
+ Open a PR explaining which rule from DESIGN.md the change advances.
95
+
96
+ ## License
97
+
98
+ MIT. See [LICENSE](./LICENSE).