ikoneme-lib 0.1.1 → 0.4.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/README.md CHANGED
@@ -1,252 +1,274 @@
1
- # ikoneme-lib
2
-
3
- React components to render and edit **ikonemes** — ordered sequences of **ikons**
4
- ("rich icons" / "super icons") — using the same rich JSON payload produced by
5
- the KomunIKON NLP pipeline and consumed by [ikonchat](../ikonchat).
6
-
7
- This package has no server-side logic of its own: it is a pure rendering/editing
8
- layer over the ikon JSON payload. The goal is for ikonchat (and any other
9
- messaging UI) to depend on this library instead of carrying its own copy of the
10
- rich-icon rendering code.
11
-
12
- ## Concepts
13
-
14
- - **Ikon** — a single rich icon: a 6x6 grid of zones (`context`, `reference`,
15
- `role`, `modes`, `root`, `tenses`) plus a grammatical `border`.
16
- - **Ikoneme** — an ordered list of ikons, e.g. one per word/concept extracted
17
- from a sentence. This is what you render in a chat bubble.
18
-
19
- ### JSON payload
20
-
21
- An ikoneme is a plain array of ikon objects:
22
-
23
- ```json
24
- [
25
- {
26
- "context": { "name": "Male", "url": "https://.../KomunIKON_Male.svg" },
27
- "reference": {
28
- "left": null,
29
- "right": { "name": "Two", "url": "https://.../KomunIKON_Two.svg" }
30
- },
31
- "role": { "name": "agent", "url": "https://.../KomunIKON_agent.svg" },
32
- "modes": { "name": "Exclam", "url": "https://.../KomunIKON_Exclam.svg" },
33
- "root": { "name": "Love/Passion", "url": "https://.../ZFcaar88AP.png" },
34
- "rootName": "Love/Passion",
35
- "tenses": { "name": "as", "url": "https://.../KomunIKON_Verbal_Tense_as.svg" },
36
- "border": "verb"
37
- }
38
- ]
39
- ```
40
-
41
- This is **exactly** the shape ikonchat stores per message (`message.richIcons`).
42
- Any extra fields (e.g. a `metadata` block from the NLP pipeline) are preserved
43
- untouched by `normalizeIkon`/`normalizeIkoneme`.
44
-
45
- It also maps directly onto the NLP "Rich Icon Output Specification" vocabulary:
46
-
47
- | This library / ikonchat | NLP spec |
48
- | ------------------------------------- | ------------- |
49
- | `context` | `gender` |
50
- | `modes` | `mode` |
51
- | `tenses` | `time-tenses` |
52
- | `reference`, `role`, `root`, `border` | same name |
53
-
54
- ## Components
55
-
56
- ### `<Ikoneme>`
57
-
58
- The main component. Renders a row of ikons for one message.
59
-
60
- ```jsx
61
- import { Ikoneme } from 'ikoneme-lib'
62
-
63
- // Read-only, for a chat/messaging timeline
64
- <Ikoneme ikons={message.richIcons} mode="view" size={64} />
65
-
66
- // Editable: adds hover/tap edit + delete buttons on each ikon and opens
67
- // the full ikon editor. `onChange` receives the updated ikoneme array.
68
- <Ikoneme
69
- ikons={message.richIcons}
70
- mode="edit"
71
- size={64}
72
- onChange={(nextIkons) => updateMessage(message.id, nextIkons)}
73
- />
74
- ```
75
-
76
- Props:
77
-
78
- | Prop | Type | Default | Notes |
79
- | -------------------- | -------------------------------------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
80
- | `ikons` | `Array<Ikon>` | `[]` | The ikoneme payload. |
81
- | `mode` | `'view' \| 'edit'` | `'view'` | `'edit'` shows per-ikon edit/delete controls and the editor modal. |
82
- | `size` | `number` | `64` | Pixel size of each ikon. |
83
- | `gap` | `number` | `6` | Pixel gap between ikons. |
84
- | `onChange` | `(nextIkons) => void` | — | Called after an edit is saved or an ikon is deleted. Required for edit/delete to do anything — the component is otherwise controlled. |
85
- | `onIkonClick` | `(ikon, index) => void` | — | Click handler in `view` mode only (e.g. show original source text). Fires independently of `zoom`. |
86
- | `zoom` | `boolean` | `true` | `true`: clicking any ikon (in either mode) opens a large read-only view of it. `false`: the click is ignored for zoom purposes (`onIkonClick` still fires as usual). |
87
- | `zoomSize` | `number` | `320` | Pixel size of the ikon inside the zoomed view (clamped to fit the viewport). |
88
- | `searchRoot` | `(query) => Promise<{id?,name,url}[]>` | IkonDB (public) | Overrides the root-icon search backend used by the editor. Default: `defaultSearchRoot`, which searches the public [IkonDB](https://ikondb.iigap.com/api/docs) icon database (full list fetched once and cached for an hour; matched client-side by name). On select, the editor fetches that icon's fuller media set (`svg`/`thumb`/`preview`) via `GET /api/ikons/{id}`. |
89
- | `theme` | `object` | — | Override any `--ikoneme-*` CSS custom property (see Theming). |
90
- | `className`, `style` | | | Passed to the wrapper element. |
91
-
92
- ### `<Ikon>` and `<IkonEditor>`
93
-
94
- Lower-level building blocks, exported for advanced use:
95
-
96
- ```jsx
97
- import { Ikon, IkonEditor } from 'ikoneme-lib'
98
- ```
99
-
100
- - `<Ikon ikon={...} size={64} onClick={...} />` — renders a single ikon. The
101
- grammatical border's thickness scales with `size` (roughly `size / 40`, min
102
- 2px) so it stays legible both tiny in a chat bubble and large in a zoomed view.
103
- - `<IkonEditor ikon={...} onSave={...} onClose={...} searchRoot={...} />` —
104
- the full-screen zone editor for one ikon.
105
- - `<IkonZoomView ikon={...} size={320} onClose={...} />` — the read-only
106
- "lightbox" view `<Ikoneme zoom>` opens on click; exported in case you want
107
- to trigger it yourself.
108
-
109
- ### Schema utilities
110
-
111
- ```js
112
- import {
113
- ZONE_CONFIG,
114
- BORDER_CONFIG,
115
- createDefaultIkon,
116
- normalizeIkon,
117
- normalizeIkoneme,
118
- generateIkonemeFromText
119
- } from 'ikoneme-lib'
120
- ```
121
-
122
- - `normalizeIkoneme(ikons)` — upgrades any legacy/URL-only stored payloads to
123
- the `{ name, url }` shape. Run this on data loaded from storage/an API
124
- before rendering.
125
- - `generateIkonemeFromText(text)` — deterministic placeholder generator
126
- (hash-based), useful for demos/tests until real NLP output is wired in.
127
-
128
- ### IkonDB helpers
129
-
130
- The public [IkonDB](https://ikondb.iigap.com/api/docs) client backing the
131
- default root search, exported for reuse:
132
-
133
- ```js
134
- import { searchIkons, getIkonDetails, getIkonList, IKONDB_BASE_URL } from 'ikoneme-lib'
135
- ```
136
-
137
- - `searchIkons(query, { limit })` — `{ id, name, url }[]`, matched by name
138
- against the full list (fetched once, cached for an hour).
139
- - `getIkonDetails(id)` — `{ id, name, url, origin, preview, thumb, svg }` for one
140
- icon (cached per id), or `null` if it does not exist.
141
- - `getIkonList()` — the whole cached list.
142
- - `clearIkonDbCache()` — drops the in-memory caches.
143
-
144
- Icons whose IkonDB record has no image are omitted from search results.
145
-
146
- ## Theming
147
-
148
- Components read colors from `--ikoneme-*` CSS custom properties and ship with
149
- sensible dark-mode defaults, so nothing else is required to use them. To match
150
- your app's palette, pass a `theme` override:
151
-
152
- ```jsx
153
- <Ikoneme
154
- ikons={ikons}
155
- theme={{
156
- '--ikoneme-primary': '#00a884',
157
- '--ikoneme-background': '#0c0e12',
158
- '--ikoneme-panel-bg': '#181b20',
159
- '--ikoneme-surface': '#080a0e',
160
- '--ikoneme-border': '#2a2e36',
161
- '--ikoneme-text-primary': '#e9edef',
162
- '--ikoneme-text-secondary': '#8696a0',
163
- '--ikoneme-hover': '#2a2e36'
164
- }}
165
- />
166
- ```
167
-
168
- ## Building
169
-
170
- ```bash
171
- npm install
172
- npm run build # outputs dist/ikoneme-lib.js (ESM) and dist/ikoneme-lib.cjs (CJS)
173
- ```
174
-
175
- ## Using this library in another project (local, no registry)
176
-
177
- This package is not published to npm/a registry. Pick one of the following to
178
- consume it locally.
179
-
180
- ### Option A — `file:` dependency (recommended)
181
-
182
- 1. Build a tarball from this repo:
183
- ```bash
184
- cd ikoneme-lib
185
- npm install
186
- npm run build
187
- npm pack # produces ikoneme-lib-<version>.tgz
188
- ```
189
- 2. In the consuming project (e.g. ikonchat), add it as a dependency pointing
190
- at the tarball (adjust the relative path to wherever you placed it):
191
- ```bash
192
- npm install ../ikoneme-lib/ikoneme-lib-0.1.0.tgz
193
- ```
194
- This writes a `"ikoneme-lib": "file:../ikoneme-lib/ikoneme-lib-0.1.0.tgz"`
195
- entry to the consumer's `package.json` and copies/extracts the packed
196
- `dist/` into `node_modules` — no symlink, so it behaves like a real
197
- registry install (safe for CI/Docker builds too, as long as the tarball
198
- path is available at install time).
199
- 3. Re-run steps 1–2 whenever you change the library and want the consumer to
200
- pick up the new build.
201
-
202
- ### Option B — `npm link` (fastest for active local development)
203
-
204
- ```bash
205
- cd ikoneme-lib
206
- npm install
207
- npm run build
208
- npm link
209
-
210
- cd ../ikonchat
211
- npm link ikoneme-lib
212
- ```
213
-
214
- This symlinks `ikoneme-lib` into the consumer's `node_modules`, so rebuilding
215
- the library (`npm run build`) is immediately visible to the consumer without
216
- reinstalling. Undo with `npm unlink ikoneme-lib` in the consumer and
217
- `npm unlink` in this repo.
218
-
219
- ### Option C — local npm registry (Verdaccio)
220
-
221
- For multi-developer/team setups where `file:`/`link:` paths are inconvenient,
222
- run a local registry and publish there instead of to the public npm registry:
223
-
224
- ```bash
225
- npx verdaccio # starts a registry on http://localhost:4873
226
- npm publish --registry http://localhost:4873
227
- # in the consumer:
228
- npm install ikoneme-lib --registry http://localhost:4873
229
- ```
230
-
231
- ## Example app
232
-
233
- `example/` is a minimal Vite + React app that installs this library via the
234
- `file:` tarball approach (Option A) and renders an ikoneme in both `view` and
235
- `edit` mode. Use it to sanity-check changes before wiring the library into
236
- ikonchat:
237
-
238
- ```bash
239
- npm run build && npm pack --pack-destination ./example
240
- cd example
241
- npm install
242
- npm run dev
243
- ```
244
-
245
- ## Next step
246
-
247
- `ikonchat` currently has its own copies of this rendering/editing logic
248
- (`app/components/RichIcon.jsx`, `RichIconEditor.jsx`,
249
- `app/utils/richIconMapping.js`). The follow-up work is to delete those and
250
- replace their usages (`ChatWindow.jsx`, etc.) with `<Ikoneme>` from this
251
- package, keeping ikonchat's own responsibility limited to chat/business logic
252
- (messages, contacts, backend sync) rather than ikon rendering.
1
+ # ikoneme-lib
2
+
3
+ React components to render and edit **ikonemes** — ordered sequences of **ikons**
4
+ ("rich icons" / "super icons") — using the same rich JSON payload produced by
5
+ the KomunIKON NLP pipeline and consumed by [ikonchat](../ikonchat).
6
+
7
+ This package has no server-side logic of its own: it is a pure rendering/editing
8
+ layer over the ikon JSON payload. The goal is for ikonchat (and any other
9
+ messaging UI) to depend on this library instead of carrying its own copy of the
10
+ rich-icon rendering code.
11
+
12
+ ## Concepts
13
+
14
+ - **Ikon** — a single rich icon: a 6x6 grid of zones (`context`, `reference`,
15
+ `role`, `modes`, `root`, `tenses`) plus a grammatical `border`.
16
+ - **Ikoneme** — an ordered list of ikons, e.g. one per word/concept extracted
17
+ from a sentence. This is what you render in a chat bubble.
18
+
19
+ ### JSON payload
20
+
21
+ An ikoneme is a plain array of ikon objects:
22
+
23
+ ```json
24
+ [
25
+ {
26
+ "context": { "name": "Male", "url": "https://.../KomunIKON_Male.svg" },
27
+ "reference": {
28
+ "left": null,
29
+ "right": { "name": "Two", "url": "https://.../KomunIKON_Two.svg" }
30
+ },
31
+ "role": { "name": "agent", "url": "https://.../KomunIKON_agent.svg" },
32
+ "modes": { "name": "Exclam", "url": "https://.../KomunIKON_Exclam.svg" },
33
+ "root": { "name": "Love/Passion", "url": "https://.../ZFcaar88AP.png" },
34
+ "rootName": "Love/Passion",
35
+ "tenses": { "name": "as", "url": "https://.../KomunIKON_Verbal_Tense_as.svg" },
36
+ "border": "verb"
37
+ }
38
+ ]
39
+ ```
40
+
41
+ This is **exactly** the shape ikonchat stores per message (`message.richIcons`).
42
+ Any extra fields (e.g. a `metadata` block from the NLP pipeline) are preserved
43
+ untouched by `normalizeIkon`/`normalizeIkoneme`.
44
+
45
+ It also maps directly onto the NLP "Rich Icon Output Specification" vocabulary:
46
+
47
+ | This library / ikonchat | NLP spec |
48
+ | ------------------------------------- | ------------- |
49
+ | `context` | `gender` |
50
+ | `modes` | `mode` |
51
+ | `tenses` | `time-tenses` |
52
+ | `reference`, `role`, `root`, `border` | same name |
53
+
54
+ ## Components
55
+
56
+ ### `<Ikoneme>`
57
+
58
+ The main component. Renders a row of ikons for one message.
59
+
60
+ ```jsx
61
+ import { Ikoneme } from 'ikoneme-lib'
62
+
63
+ // Read-only, for a chat/messaging timeline
64
+ <Ikoneme ikons={message.richIcons} mode="view" size={64} />
65
+
66
+ // Editable: adds hover/tap edit + delete buttons on each ikon and opens
67
+ // the full ikon editor. `onChange` receives the updated ikoneme array.
68
+ <Ikoneme
69
+ ikons={message.richIcons}
70
+ mode="edit"
71
+ size={64}
72
+ onChange={(nextIkons) => updateMessage(message.id, nextIkons)}
73
+ />
74
+ ```
75
+
76
+ Props:
77
+
78
+ | Prop | Type | Default | Notes |
79
+ | -------------------- | -------------------------------------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
80
+ | `ikons` | `Array<Ikon>` | `[]` | The ikoneme payload. |
81
+ | `mode` | `'view' \| 'edit'` | `'view'` | `'edit'` shows per-ikon edit/delete controls and the editor modal. |
82
+ | `size` | `number` | `64` | Pixel size of each ikon. |
83
+ | `gap` | `number` | `6` | Pixel gap between ikons. |
84
+ | `onChange` | `(nextIkons) => void` | — | Called after an edit is saved or an ikon is deleted. Required for edit/delete to do anything — the component is otherwise controlled. |
85
+ | `onIkonClick` | `(ikon, index) => void` | — | Click handler in `view` mode only (e.g. show original source text). Fires independently of `zoom`. |
86
+ | `zoom` | `boolean` | `true` | `true`: clicking any ikon (in either mode) opens a large read-only view of it. `false`: the click is ignored for zoom purposes (`onIkonClick` still fires as usual). |
87
+ | `zoomSize` | `number` | `320` | Pixel size of the ikon inside the zoomed view (clamped to fit the viewport). |
88
+ | `searchRoot` | `(query) => Promise<{id?,name,url}[]>` | IkonDB (public) | Overrides the root-icon search backend used by the editor. Default: `defaultSearchRoot`, which searches the public [IkonDB](https://ikondb.iigap.com/api/docs) icon database (full list fetched once and cached for an hour; matched client-side by name). On select, the editor fetches that icon's fuller media set (`svg`/`thumb`/`preview`) via `GET /api/ikons/{id}`. |
89
+ | `theme` | `object` | — | Override any `--ikoneme-*` CSS custom property (see Theming). |
90
+ | `className`, `style` | | | Passed to the wrapper element. |
91
+
92
+ ### `<Ikon>` and `<IkonEditor>`
93
+
94
+ Lower-level building blocks, exported for advanced use:
95
+
96
+ ```jsx
97
+ import { Ikon, IkonEditor } from 'ikoneme-lib'
98
+ ```
99
+
100
+ - `<Ikon ikon={...} size={64} onClick={...} />` — renders a single ikon. The
101
+ grammatical border is the official KomunIKON artwork (`src/borders`: one
102
+ colour and dash pattern per category, single frame for singular, double
103
+ frame for plural), scaled with `size` so it stays legible both tiny in a chat
104
+ bubble and large in a zoomed view. The ikon stays square either way.
105
+ - `<IkonEditor ikon={...} onSave={...} onClose={...} searchRoot={...} />` —
106
+ the full-screen zone editor for one ikon.
107
+ - `<IkonZoomView ikon={...} size={320} onClose={...} />` — the read-only
108
+ "lightbox" view `<Ikoneme zoom>` opens on click; exported in case you want
109
+ to trigger it yourself.
110
+
111
+ ### Schema utilities
112
+
113
+ ```js
114
+ import {
115
+ ZONE_CONFIG,
116
+ BORDER_CONFIG,
117
+ getBorderImageStyle,
118
+ createDefaultIkon,
119
+ normalizeIkon,
120
+ normalizeIkoneme,
121
+ generateIkonemeFromText
122
+ } from 'ikoneme-lib'
123
+ ```
124
+
125
+ - `normalizeIkoneme(ikons)` — upgrades any legacy/URL-only stored payloads to
126
+ the `{ name, url }` shape. Run this on data loaded from storage/an API
127
+ before rendering.
128
+ - `generateIkonemeFromText(text)` — deterministic placeholder generator
129
+ (hash-based), useful for demos/tests until real NLP output is wired in.
130
+ - `BORDER_CONFIG` — the 12 border types (`{ id, label, color, plural, image }`);
131
+ `image` is the artwork as a data URI, `color` its main colour.
132
+ - `getBorderImageStyle(border, size)` — inline style that draws a border's
133
+ artwork around a square box of `size` px (what `<Ikon>` uses).
134
+ - `createEmptyIkon()` — an ikon with every zone empty and no border.
135
+
136
+ ### Image export
137
+
138
+ ```js
139
+ import { renderIkonemeToPng, renderIkonemeToCanvas, drawIkon } from 'ikoneme-lib'
140
+
141
+ const blob = await renderIkonemeToPng(ikons, { size: 120, perRow: 8, title: 'hello' })
142
+ ```
143
+
144
+ Draws ikons on a canvas with the same layout, tints and border artwork as
145
+ `<Ikon>`. Options: `size`, `gap`, `padding`, `perRow`, `background`, `title`,
146
+ `titleColor`, `titleFont`, `pixelRatio`. Remote icons are loaded with CORS, so
147
+ an image host without `Access-Control-Allow-Origin` is skipped (the browser
148
+ won't let it into an exportable canvas).
149
+
150
+ ### IkonDB helpers
151
+
152
+ The public [IkonDB](https://ikondb.iigap.com/api/docs) client backing the
153
+ default root search, exported for reuse:
154
+
155
+ ```js
156
+ import { searchIkons, getIkonDetails, getIkonList, IKONDB_BASE_URL } from 'ikoneme-lib'
157
+ ```
158
+
159
+ - `searchIkons(query, { limit })` — `{ id, name, url }[]`, matched by name
160
+ against the full list (fetched once, cached for an hour).
161
+ - `getIkonDetails(id)` — `{ id, name, url, origin, preview, thumb, svg }` for one
162
+ icon (cached per id), or `null` if it does not exist.
163
+ - `getIkonList()` — the whole cached list.
164
+ - `clearIkonDbCache()` — drops the in-memory caches.
165
+
166
+ Icons whose IkonDB record has no image are omitted from search results.
167
+
168
+ ## Theming
169
+
170
+ Components read colors from `--ikoneme-*` CSS custom properties and ship with
171
+ sensible dark-mode defaults, so nothing else is required to use them. To match
172
+ your app's palette, pass a `theme` override:
173
+
174
+ ```jsx
175
+ <Ikoneme
176
+ ikons={ikons}
177
+ theme={{
178
+ '--ikoneme-primary': '#00a884',
179
+ '--ikoneme-background': '#0c0e12',
180
+ '--ikoneme-panel-bg': '#181b20',
181
+ '--ikoneme-surface': '#080a0e',
182
+ '--ikoneme-border': '#2a2e36',
183
+ '--ikoneme-text-primary': '#e9edef',
184
+ '--ikoneme-text-secondary': '#8696a0',
185
+ '--ikoneme-hover': '#2a2e36'
186
+ }}
187
+ />
188
+ ```
189
+
190
+ ## Building
191
+
192
+ ```bash
193
+ npm install
194
+ npm run build # outputs dist/ikoneme-lib.js (ESM) and dist/ikoneme-lib.cjs (CJS)
195
+ ```
196
+
197
+ ## Using this library in another project (local, no registry)
198
+
199
+ This package is not published to npm/a registry. Pick one of the following to
200
+ consume it locally.
201
+
202
+ ### Option A — `file:` dependency (recommended)
203
+
204
+ 1. Build a tarball from this repo:
205
+ ```bash
206
+ cd ikoneme-lib
207
+ npm install
208
+ npm run build
209
+ npm pack # produces ikoneme-lib-<version>.tgz
210
+ ```
211
+ 2. In the consuming project (e.g. ikonchat), add it as a dependency pointing
212
+ at the tarball (adjust the relative path to wherever you placed it):
213
+ ```bash
214
+ npm install ../ikoneme-lib/ikoneme-lib-0.1.0.tgz
215
+ ```
216
+ This writes a `"ikoneme-lib": "file:../ikoneme-lib/ikoneme-lib-0.1.0.tgz"`
217
+ entry to the consumer's `package.json` and copies/extracts the packed
218
+ `dist/` into `node_modules` — no symlink, so it behaves like a real
219
+ registry install (safe for CI/Docker builds too, as long as the tarball
220
+ path is available at install time).
221
+ 3. Re-run steps 1–2 whenever you change the library and want the consumer to
222
+ pick up the new build.
223
+
224
+ ### Option B — `npm link` (fastest for active local development)
225
+
226
+ ```bash
227
+ cd ikoneme-lib
228
+ npm install
229
+ npm run build
230
+ npm link
231
+
232
+ cd ../ikonchat
233
+ npm link ikoneme-lib
234
+ ```
235
+
236
+ This symlinks `ikoneme-lib` into the consumer's `node_modules`, so rebuilding
237
+ the library (`npm run build`) is immediately visible to the consumer without
238
+ reinstalling. Undo with `npm unlink ikoneme-lib` in the consumer and
239
+ `npm unlink` in this repo.
240
+
241
+ ### Option C — local npm registry (Verdaccio)
242
+
243
+ For multi-developer/team setups where `file:`/`link:` paths are inconvenient,
244
+ run a local registry and publish there instead of to the public npm registry:
245
+
246
+ ```bash
247
+ npx verdaccio # starts a registry on http://localhost:4873
248
+ npm publish --registry http://localhost:4873
249
+ # in the consumer:
250
+ npm install ikoneme-lib --registry http://localhost:4873
251
+ ```
252
+
253
+ ## Example app
254
+
255
+ `example/` is a minimal Vite + React app that installs this library via the
256
+ `file:` tarball approach (Option A) and renders an ikoneme in both `view` and
257
+ `edit` mode. Use it to sanity-check changes before wiring the library into
258
+ ikonchat:
259
+
260
+ ```bash
261
+ npm run build && npm pack --pack-destination ./example
262
+ cd example
263
+ npm install
264
+ npm run dev
265
+ ```
266
+
267
+ ## Next step
268
+
269
+ `ikonchat` currently has its own copies of this rendering/editing logic
270
+ (`app/components/RichIcon.jsx`, `RichIconEditor.jsx`,
271
+ `app/utils/richIconMapping.js`). The follow-up work is to delete those and
272
+ replace their usages (`ChatWindow.jsx`, etc.) with `<Ikoneme>` from this
273
+ package, keeping ikonchat's own responsibility limited to chat/business logic
274
+ (messages, contacts, backend sync) rather than ikon rendering.
@@ -0,0 +1,13 @@
1
+ export function drawIkon(ctx: any, ikon: any, x: any, y: any, size: any): Promise<void>;
2
+ export function renderIkonemeToCanvas(ikons: any, { size, gap, padding, perRow, background, title, titleColor, titleFont, pixelRatio }?: {
3
+ size?: number;
4
+ gap?: number;
5
+ padding?: number;
6
+ perRow?: number;
7
+ background?: string;
8
+ title?: any;
9
+ titleColor?: string;
10
+ titleFont?: string;
11
+ pixelRatio?: number;
12
+ }): Promise<HTMLCanvasElement>;
13
+ export function renderIkonemeToPng(ikons: any, options: any): Promise<any>;
@@ -0,0 +1,69 @@
1
+ export function getIkonPaddings(size: any): {
2
+ framePad: number;
3
+ zonePad: number;
4
+ rootPad: number;
5
+ };
6
+ export function trackOffsets(length: any, weights: any): number[];
7
+ export const EDGE_FR: 1.18;
8
+ export const MID_FR: 0.95;
9
+ export const TRACK_WEIGHTS: number[];
10
+ export const REF_WEIGHTS: number[];
11
+ export namespace ZONE_BACKGROUNDS {
12
+ let context: string;
13
+ let reference: string;
14
+ let role: string;
15
+ let modes: string;
16
+ let root: string;
17
+ let east: string;
18
+ let tenses: string;
19
+ }
20
+ export const ZONE_DIVIDER: "rgba(0, 0, 0, 0.14)";
21
+ export namespace ZONE_GRID {
22
+ export namespace context_1 {
23
+ let cols: number[];
24
+ let rows: number[];
25
+ }
26
+ export { context_1 as context };
27
+ export namespace reference_1 {
28
+ let cols_1: number[];
29
+ export { cols_1 as cols };
30
+ let rows_1: number[];
31
+ export { rows_1 as rows };
32
+ }
33
+ export { reference_1 as reference };
34
+ export namespace role_1 {
35
+ let cols_2: number[];
36
+ export { cols_2 as cols };
37
+ let rows_2: number[];
38
+ export { rows_2 as rows };
39
+ }
40
+ export { role_1 as role };
41
+ export namespace modes_1 {
42
+ let cols_3: number[];
43
+ export { cols_3 as cols };
44
+ let rows_3: number[];
45
+ export { rows_3 as rows };
46
+ }
47
+ export { modes_1 as modes };
48
+ export namespace root_1 {
49
+ let cols_4: number[];
50
+ export { cols_4 as cols };
51
+ let rows_4: number[];
52
+ export { rows_4 as rows };
53
+ }
54
+ export { root_1 as root };
55
+ export namespace east_1 {
56
+ let cols_5: number[];
57
+ export { cols_5 as cols };
58
+ let rows_5: number[];
59
+ export { rows_5 as rows };
60
+ }
61
+ export { east_1 as east };
62
+ export namespace tenses_1 {
63
+ let cols_6: number[];
64
+ export { cols_6 as cols };
65
+ let rows_6: number[];
66
+ export { rows_6 as rows };
67
+ }
68
+ export { tenses_1 as tenses };
69
+ }