@takumi-rs/helpers 1.0.8 → 1.0.10

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.
Files changed (2) hide show
  1. package/README.md +57 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,5 +1,60 @@
1
1
  # @takumi-rs/helpers
2
2
 
3
- Helper package for constructing Takumi layout.
3
+ **Utility functions and types for working with Takumi node trees.**
4
4
 
5
- Checkout [documentation](https://takumi.kane.tw/docs/deep-dives/from-jsx-helper) for usage.
5
+ This package provides the core logic for converting JSX and HTML into the layout-ready node trees that Takumi's Rust engine expects. It also handles resource fetching (fonts, images) and emoji processing.
6
+
7
+ [Documentation](https://takumi.kane.tw/docs/architecture#fromjsx-helper) · [GitHub](https://github.com/kane50613/takumi)
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @takumi-rs/helpers
13
+ ```
14
+
15
+ ## Features
16
+
17
+ ### JSX to Node Tree
18
+
19
+ Convert React-like elements into a serializable node tree + stylesheets.
20
+
21
+ ```tsx
22
+ import { fromJsx } from "@takumi-rs/helpers/jsx";
23
+
24
+ const { node, stylesheets } = await fromJsx(<div style={{ display: "flex" }}>Hello</div>);
25
+ ```
26
+
27
+ ### HTML to Node Tree
28
+
29
+ Parse HTML strings into Takumi nodes.
30
+
31
+ ```ts
32
+ import { fromHtml } from "@takumi-rs/helpers/html";
33
+
34
+ const { node, stylesheets } = await fromHtml("<div style='color: red'>Hello</div>");
35
+ ```
36
+
37
+ ### Resource Fetching
38
+
39
+ Extract and fetch external resources (images, fonts) mentioned in a node tree.
40
+
41
+ ```ts
42
+ import { extractResourceUrls, fetchResources } from "@takumi-rs/helpers";
43
+
44
+ const urls = extractResourceUrls(node);
45
+ const resources = await fetchResources(urls);
46
+ ```
47
+
48
+ ### Emoji Processing
49
+
50
+ Find and replace emoji characters in text nodes with image nodes (Twemoji or custom).
51
+
52
+ ```ts
53
+ import { extractEmojis } from "@takumi-rs/helpers/emoji";
54
+
55
+ const newNode = extractEmojis(oldNode, "twemoji");
56
+ ```
57
+
58
+ ## License
59
+
60
+ MIT or Apache-2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takumi-rs/helpers",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "author": {
6
6
  "name": "Kane Wang",