@toon-ui/core 0.1.0-beta.0 → 0.1.2-beta.1

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 +96 -0
  2. package/package.json +9 -2
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # @toon-ui/core
2
+
3
+ Core parser, AST, validation, and protocol utilities for ToonUI.
4
+
5
+ This package is for low-level usage.
6
+
7
+ If you want the easiest React integration, use:
8
+
9
+ - `@toon-ui/toon-ui`
10
+
11
+ ---
12
+
13
+ ## What it includes
14
+
15
+ - `parseToonUI()`
16
+ - `validateToonUI()`
17
+ - `extractToonBlocks()`
18
+ - `createRules()`
19
+ - `createPrompt()`
20
+ - `formatReplyMessage()`
21
+ - `formatSubmitMessage()`
22
+
23
+ ---
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ pnpm add @toon-ui/core
29
+ ```
30
+
31
+ ---
32
+
33
+ ## Example
34
+
35
+ ```ts
36
+ import {
37
+ extractToonBlocks,
38
+ parseToonUI,
39
+ validateToonUI,
40
+ } from '@toon-ui/core';
41
+
42
+ const content = `
43
+ Claro, encontré este producto.
44
+
45
+ \`\`\`toon-ui
46
+ card "Producto encontrado":
47
+ text "Coca-Cola 400ml"
48
+ badge "Activo" success
49
+ \`\`\`
50
+ `;
51
+
52
+ const blocks = extractToonBlocks(content);
53
+ const ast = parseToonUI(blocks[0].raw);
54
+ const result = validateToonUI(ast);
55
+
56
+ console.log(result.ok);
57
+ ```
58
+
59
+ ---
60
+
61
+ ## Typical use cases
62
+
63
+ Use `@toon-ui/core` if you want to:
64
+
65
+ - parse ToonUI without React
66
+ - build your own renderer
67
+ - validate assistant output before rendering
68
+ - inspect ASTs in tooling or CI
69
+ - format structured reply/submit messages yourself
70
+
71
+ ---
72
+
73
+ ## Important boundary
74
+
75
+ `@toon-ui/core` does NOT know:
76
+
77
+ - React
78
+ - your components
79
+ - AI SDK tools
80
+ - backend logic
81
+
82
+ It only owns:
83
+
84
+ - grammar
85
+ - typed AST
86
+ - validation
87
+ - protocol formatting
88
+
89
+ ---
90
+
91
+ ## Related packages
92
+
93
+ - `@toon-ui/react` — React runtime and component registry
94
+ - `@toon-ui/prompts` — prompt helpers
95
+ - `@toon-ui/toon-ui` — easiest public entrypoint
96
+
package/package.json CHANGED
@@ -1,8 +1,15 @@
1
1
  {
2
2
  "name": "@toon-ui/core",
3
- "version": "0.1.0-beta.0",
3
+ "version": "0.1.2-beta.1",
4
4
  "description": "Core parser, AST, validation, and protocol utilities for ToonUI.",
5
- "keywords": ["toon-ui", "ai", "ui", "chat", "dsl", "parser"],
5
+ "keywords": [
6
+ "toon-ui",
7
+ "ai",
8
+ "ui",
9
+ "chat",
10
+ "dsl",
11
+ "parser"
12
+ ],
6
13
  "homepage": "https://github.com/jefferson-lopez/toon-ui#readme",
7
14
  "bugs": {
8
15
  "url": "https://github.com/jefferson-lopez/toon-ui/issues"