@imanect/yui 0.0.0-stage → 0.2.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-APACHE +202 -0
- package/LICENSE-MIT +21 -0
- package/README.md +85 -2
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/ir.d.ts +105 -0
- package/dist/ir.d.ts.map +1 -0
- package/dist/ir.js +8 -0
- package/dist/ir.js.map +1 -0
- package/dist/kinds/chart.d.ts +5 -0
- package/dist/kinds/chart.d.ts.map +1 -0
- package/dist/kinds/chart.js +110 -0
- package/dist/kinds/chart.js.map +1 -0
- package/dist/kinds/flow.d.ts +17 -0
- package/dist/kinds/flow.d.ts.map +1 -0
- package/dist/kinds/flow.js +175 -0
- package/dist/kinds/flow.js.map +1 -0
- package/dist/kinds/stack.d.ts +17 -0
- package/dist/kinds/stack.d.ts.map +1 -0
- package/dist/kinds/stack.js +106 -0
- package/dist/kinds/stack.js.map +1 -0
- package/dist/kinds/stat.d.ts +5 -0
- package/dist/kinds/stat.d.ts.map +1 -0
- package/dist/kinds/stat.js +56 -0
- package/dist/kinds/stat.js.map +1 -0
- package/dist/lines.d.ts +57 -0
- package/dist/lines.d.ts.map +1 -0
- package/dist/lines.js +129 -0
- package/dist/lines.js.map +1 -0
- package/dist/markdown.d.ts +41 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.js +84 -0
- package/dist/markdown.js.map +1 -0
- package/dist/number.d.ts +32 -0
- package/dist/number.d.ts.map +1 -0
- package/dist/number.js +101 -0
- package/dist/number.js.map +1 -0
- package/dist/parse.d.ts +15 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +124 -0
- package/dist/parse.js.map +1 -0
- package/dist/react/index.d.ts +46 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +119 -0
- package/dist/react/index.js.map +1 -0
- package/dist/render/chart.d.ts +10 -0
- package/dist/render/chart.d.ts.map +1 -0
- package/dist/render/chart.js +237 -0
- package/dist/render/chart.js.map +1 -0
- package/dist/render/flow.d.ts +12 -0
- package/dist/render/flow.d.ts.map +1 -0
- package/dist/render/flow.js +284 -0
- package/dist/render/flow.js.map +1 -0
- package/dist/render/frame.d.ts +44 -0
- package/dist/render/frame.d.ts.map +1 -0
- package/dist/render/frame.js +79 -0
- package/dist/render/frame.js.map +1 -0
- package/dist/render/layout.d.ts +7 -0
- package/dist/render/layout.d.ts.map +1 -0
- package/dist/render/layout.js +29 -0
- package/dist/render/layout.js.map +1 -0
- package/dist/render/measure.d.ts +16 -0
- package/dist/render/measure.d.ts.map +1 -0
- package/dist/render/measure.js +86 -0
- package/dist/render/measure.js.map +1 -0
- package/dist/render/scene.d.ts +60 -0
- package/dist/render/scene.d.ts.map +1 -0
- package/dist/render/scene.js +20 -0
- package/dist/render/scene.js.map +1 -0
- package/dist/render/stack.d.ts +11 -0
- package/dist/render/stack.d.ts.map +1 -0
- package/dist/render/stack.js +112 -0
- package/dist/render/stack.js.map +1 -0
- package/dist/render/stat.d.ts +5 -0
- package/dist/render/stat.d.ts.map +1 -0
- package/dist/render/stat.js +36 -0
- package/dist/render/stat.js.map +1 -0
- package/dist/render/svg.d.ts +19 -0
- package/dist/render/svg.d.ts.map +1 -0
- package/dist/render/svg.js +88 -0
- package/dist/render/svg.js.map +1 -0
- package/dist/render/theme.d.ts +20 -0
- package/dist/render/theme.d.ts.map +1 -0
- package/dist/render/theme.js +87 -0
- package/dist/render/theme.js.map +1 -0
- package/dist/svg.d.ts +8 -0
- package/dist/svg.d.ts.map +1 -0
- package/dist/svg.js +7 -0
- package/dist/svg.js.map +1 -0
- package/dist/text.d.ts +17 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +173 -0
- package/dist/text.js.map +1 -0
- package/package.json +66 -4
package/LICENSE-APACHE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Imanect Labs
|
|
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
CHANGED
|
@@ -1,3 +1,86 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @imanect/yui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Yui (結)** — a tiny, LLM-friendly notation for drawing figures inside Markdown, with a parser, an SVG renderer and React components.
|
|
4
|
+
|
|
5
|
+
Models write a few lines of data in a ` ```ui ` block; the renderer decides layout, colors and axes.
|
|
6
|
+
It is designed to be written correctly by small models with a short prompt, rendered while streaming, and safe for any input (no HTML, URLs or scripts).
|
|
7
|
+
|
|
8
|
+
````md
|
|
9
|
+
```ui
|
|
10
|
+
bar Monthly sales [1]
|
|
11
|
+
unit: 10k JPY
|
|
12
|
+
Month | Sales | Profit
|
|
13
|
+
Jan | 120 | 30
|
|
14
|
+
Feb | 150 | -10
|
|
15
|
+
```
|
|
16
|
+
````
|
|
17
|
+
|
|
18
|
+
Five figure kinds: `bar`, `line`, `stat` (KPI cards), `flow` (flowcharts with branches and loops) and `stack` (layered architecture diagrams).
|
|
19
|
+
The parser is lenient with what models naturally write (GFM tables, Mermaid-style arrows, Japanese number formats such as `1億2,000万円` or `△120`) and reports per-line diagnostics instead of failing the whole block.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npm install @imanect/yui
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`react` (>= 18) is an optional peer dependency, needed only for `@imanect/yui/react`.
|
|
28
|
+
|
|
29
|
+
## React
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { YuiBlock, isYuiLanguage } from "@imanect/yui/react";
|
|
33
|
+
|
|
34
|
+
// e.g. with react-markdown
|
|
35
|
+
<Markdown
|
|
36
|
+
components={{
|
|
37
|
+
code({ className, children }) {
|
|
38
|
+
return isYuiLanguage(className)
|
|
39
|
+
? <YuiBlock source={String(children)} streaming={isStreaming} />
|
|
40
|
+
: <code className={className}>{children}</code>;
|
|
41
|
+
},
|
|
42
|
+
}}
|
|
43
|
+
>
|
|
44
|
+
{text}
|
|
45
|
+
</Markdown>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`YuiBlock` re-lays out to its container width, follows the page's light/dark theme, and while `streaming` draws only completed lines — a figure grows and never shows a half-written value.
|
|
49
|
+
|
|
50
|
+
## SVG (browser or server)
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { parseBlock } from "@imanect/yui";
|
|
54
|
+
import { renderSVG } from "@imanect/yui/svg";
|
|
55
|
+
|
|
56
|
+
const { figure } = parseBlock(source, { final: true });
|
|
57
|
+
renderSVG(figure!); // for screens: CSS variables, fluid width
|
|
58
|
+
renderSVG(figure!, { theme: "light", width: 720 }); // for export: colors and size baked in
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The same layout drives both outputs, so what you export is what you saw. Every SVG carries a `<desc>` with a plain-text table of the data for screen readers.
|
|
62
|
+
|
|
63
|
+
## Theming
|
|
64
|
+
|
|
65
|
+
Colors are CSS custom properties: `--yui-s1` … `--yui-s8` (series), `--yui-ink`, `--yui-ink2`, `--yui-muted`, `--yui-grid`, `--yui-axis`, `--yui-surface`, `--yui-surface2`, `--yui-border`, `--yui-accentWash`, `--yui-accentLine`.
|
|
66
|
+
Set them on any ancestor to match your design system. The defaults are a colorblind-validated palette with separate light and dark steps.
|
|
67
|
+
|
|
68
|
+
## Parser only
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { parseMarkdown, toText } from "@imanect/yui";
|
|
72
|
+
|
|
73
|
+
for (const seg of parseMarkdown(streamingText)) {
|
|
74
|
+
if (seg.type === "ui" && seg.result.figure) draw(seg.result.figure);
|
|
75
|
+
}
|
|
76
|
+
toText(figure); // plain-Markdown fallback (tables / lists)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Docs
|
|
80
|
+
|
|
81
|
+
- Notation spec (Japanese): [docs/spec.md](https://github.com/imanect-labs/y-ui/blob/main/docs/spec.md)
|
|
82
|
+
- Evaluation with small models (Japanese): [docs/eval-results-2026-10-12-gemma.md](https://github.com/imanect-labs/y-ui/blob/main/docs/eval-results-2026-10-12-gemma.md)
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
Licensed under either of [MIT](./LICENSE-MIT) or [Apache-2.0](./LICENSE-APACHE) at your option.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./ir.js";
|
|
2
|
+
export { parseNumber, parseCell, normalize, type ParsedNumber, type CellValue } from "./number.js";
|
|
3
|
+
export { parseBlock, resolveKind, isEmpty, type ParseOptions } from "./parse.js";
|
|
4
|
+
export { splitMarkdown, parseMarkdown, isUiInfo, type Segment, type ParsedSegment, type ParsedSegmentUi } from "./markdown.js";
|
|
5
|
+
export { toSource, toText, transformMarkdown, type UiExportMode } from "./text.js";
|
|
6
|
+
export { LIMITS } from "./lines.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAC/H,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./ir.js";
|
|
2
|
+
export { parseNumber, parseCell, normalize } from "./number.js";
|
|
3
|
+
export { parseBlock, resolveKind, isEmpty } from "./parse.js";
|
|
4
|
+
export { splitMarkdown, parseMarkdown, isUiInfo } from "./markdown.js";
|
|
5
|
+
export { toSource, toText, transformMarkdown } from "./text.js";
|
|
6
|
+
export { LIMITS } from "./lines.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAqC,MAAM,aAAa,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAqB,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAA0D,MAAM,eAAe,CAAC;AAC/H,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAqB,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/ir.d.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Yui の中間表現(IR)。
|
|
3
|
+
*
|
|
4
|
+
* パーサの出力であり、レンダラー・テキスト化・評価の入力。
|
|
5
|
+
* LLM が書くソースは寛容に受けるが、IR は常にこの形に正規化されている。
|
|
6
|
+
*/
|
|
7
|
+
export declare const KINDS: readonly ["bar", "line", "stat", "flow", "stack"];
|
|
8
|
+
export type Kind = (typeof KINDS)[number];
|
|
9
|
+
/** 全図に共通する項目。 */
|
|
10
|
+
export interface FigureBase {
|
|
11
|
+
kind: Kind;
|
|
12
|
+
/** 見出し。無ければ空文字。 */
|
|
13
|
+
title: string;
|
|
14
|
+
/** 見出しに付いた引用番号(`[1]` → 1)。 */
|
|
15
|
+
refs: number[];
|
|
16
|
+
/** 図の下の注記(`note:`)。 */
|
|
17
|
+
note?: string;
|
|
18
|
+
/**
|
|
19
|
+
* データ参照(`src:`)。Yui 本体は解決しない。
|
|
20
|
+
* ホストが閲覧者の権限で解決する前提の不透明な文字列。
|
|
21
|
+
*/
|
|
22
|
+
src?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ChartRow {
|
|
25
|
+
label: string;
|
|
26
|
+
/** 列ごとの値。欠損(空・`-`)は null。 */
|
|
27
|
+
values: (number | null)[];
|
|
28
|
+
refs: number[];
|
|
29
|
+
}
|
|
30
|
+
export interface ChartFigure extends FigureBase {
|
|
31
|
+
kind: "bar" | "line";
|
|
32
|
+
/** 列名。columns[0] はラベル列の見出し、columns[1..] が系列名。 */
|
|
33
|
+
columns: string[];
|
|
34
|
+
rows: ChartRow[];
|
|
35
|
+
unit?: string;
|
|
36
|
+
stacked?: boolean;
|
|
37
|
+
horizontal?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface StatItem {
|
|
40
|
+
label: string;
|
|
41
|
+
/** 表示用の文字列(書かれたまま)。 */
|
|
42
|
+
value: string;
|
|
43
|
+
/** value を数値として読めた場合の値。 */
|
|
44
|
+
num?: number;
|
|
45
|
+
/** 補足(3 列目)。 */
|
|
46
|
+
sub?: string;
|
|
47
|
+
refs: number[];
|
|
48
|
+
}
|
|
49
|
+
export interface StatFigure extends FigureBase {
|
|
50
|
+
kind: "stat";
|
|
51
|
+
items: StatItem[];
|
|
52
|
+
}
|
|
53
|
+
export type NodeShape = "box" | "decision" | "terminal";
|
|
54
|
+
export interface FlowNode {
|
|
55
|
+
id: string;
|
|
56
|
+
label: string;
|
|
57
|
+
shape: NodeShape;
|
|
58
|
+
}
|
|
59
|
+
export interface FlowEdge {
|
|
60
|
+
from: string;
|
|
61
|
+
to: string;
|
|
62
|
+
label?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface FlowFigure extends FigureBase {
|
|
65
|
+
kind: "flow";
|
|
66
|
+
direction: "TB" | "LR";
|
|
67
|
+
nodes: FlowNode[];
|
|
68
|
+
edges: FlowEdge[];
|
|
69
|
+
}
|
|
70
|
+
export interface StackBox {
|
|
71
|
+
title: string;
|
|
72
|
+
desc?: string;
|
|
73
|
+
children: StackBox[];
|
|
74
|
+
refs: number[];
|
|
75
|
+
}
|
|
76
|
+
/** 層。boxes が 1 つなら通常の層、複数なら横並び。 */
|
|
77
|
+
export interface StackTier {
|
|
78
|
+
boxes: StackBox[];
|
|
79
|
+
/** この層の直前の矢印に付くラベル(`↓ HTTPS`)。 */
|
|
80
|
+
arrowLabel?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface StackFigure extends FigureBase {
|
|
83
|
+
kind: "stack";
|
|
84
|
+
tiers: StackTier[];
|
|
85
|
+
}
|
|
86
|
+
export type Figure = ChartFigure | StatFigure | FlowFigure | StackFigure;
|
|
87
|
+
export type Severity = "error" | "warning" | "info";
|
|
88
|
+
export interface Diagnostic {
|
|
89
|
+
/** ブロック内の行番号(1 始まり)。ブロック全体に関するものは 0。 */
|
|
90
|
+
line: number;
|
|
91
|
+
severity: Severity;
|
|
92
|
+
code: DiagnosticCode;
|
|
93
|
+
message: string;
|
|
94
|
+
}
|
|
95
|
+
export type DiagnosticCode = "empty" | "unknown_kind" | "missing_header" | "bad_number" | "extra_cells" | "unrecognized_line" | "unknown_option" | "limit_exceeded" | "text_too_long" | "nested_too_deep";
|
|
96
|
+
export interface ParseResult {
|
|
97
|
+
/** 描画できる図。種類が分からない場合のみ null。 */
|
|
98
|
+
figure: Figure | null;
|
|
99
|
+
diagnostics: Diagnostic[];
|
|
100
|
+
/**
|
|
101
|
+
* 未確定の最終行を保留したか(ストリーミング中で、末尾が改行で終わっていない)。
|
|
102
|
+
*/
|
|
103
|
+
pending: boolean;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=ir.d.ts.map
|
package/dist/ir.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir.d.ts","sourceRoot":"","sources":["../src/ir.ts"],"names":[],"mappings":"AAA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gBAAgB,GAChB,YAAY,GACZ,aAAa,GACb,mBAAmB,GACnB,gBAAgB,GAChB,gBAAgB,GAChB,eAAe,GACf,iBAAiB,CAAC;AAEtB,MAAM,WAAW,WAAW;IAC1B,gCAAgC;IAChC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB"}
|
package/dist/ir.js
ADDED
package/dist/ir.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir.js","sourceRoot":"","sources":["../src/ir.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../src/kinds/chart.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAE3B,OAAO,KAAK,EAAE,WAAW,EAAY,MAAM,UAAU,CAAC;AAEtD,OAAO,EAEL,WAAW,EAIX,KAAK,IAAI,EAMV,MAAM,aAAa,CAAC;AAIrB,wBAAgB,UAAU,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CA0CnF"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/** bar / line: 表形式のデータ。 */
|
|
2
|
+
import { parseCell, parseNumber } from "../number.js";
|
|
3
|
+
import { clip, hasPipe, isSeparatorRow, LIMITS, parseOption, splitCells, stripListMarker, takeRefs, truthy, } from "../lines.js";
|
|
4
|
+
const OPTIONS = ["note", "unit", "src", "stacked", "horizontal"];
|
|
5
|
+
export function parseChart(fig, body, diags) {
|
|
6
|
+
let header = null;
|
|
7
|
+
for (const line of body) {
|
|
8
|
+
const raw = stripListMarker(line.text.trim()).text;
|
|
9
|
+
if (!hasPipe(raw) && !raw.includes("\t")) {
|
|
10
|
+
const opt = parseOption(raw, OPTIONS);
|
|
11
|
+
if (opt) {
|
|
12
|
+
applyOption(fig, opt.key, opt.value);
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
// `1月: 120` のような 1 系列の行も受ける。
|
|
16
|
+
const kv = /^(.+?)\s*[::]\s*(.+)$/.exec(raw);
|
|
17
|
+
if (kv && parseNumber(kv[2])) {
|
|
18
|
+
if (!header)
|
|
19
|
+
header = synthesizeHeader(1, line.no, diags);
|
|
20
|
+
pushRow(fig, header, [kv[1], kv[2]], line.no, diags);
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
diags.add(line.no, "warning", "unrecognized_line", `解釈できない行を無視しました: ${raw}`);
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
const cells = splitCells(raw);
|
|
27
|
+
if (isSeparatorRow(cells))
|
|
28
|
+
continue;
|
|
29
|
+
if (!header) {
|
|
30
|
+
if (looksLikeHeader(cells)) {
|
|
31
|
+
header = cells.slice(0, LIMITS.chartColumns).map((c, i) => clip(takeRefs(c).text, line.no, diags) || (i === 0 ? "項目" : `系列${i}`));
|
|
32
|
+
if (cells.length > LIMITS.chartColumns) {
|
|
33
|
+
diags.add(line.no, "warning", "limit_exceeded", `列は ${LIMITS.chartColumns} 列までです`);
|
|
34
|
+
}
|
|
35
|
+
fig.columns = header;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
header = synthesizeHeader(cells.length - 1, line.no, diags);
|
|
39
|
+
fig.columns = header;
|
|
40
|
+
}
|
|
41
|
+
pushRow(fig, header, cells, line.no, diags);
|
|
42
|
+
}
|
|
43
|
+
if (header)
|
|
44
|
+
fig.columns = header;
|
|
45
|
+
}
|
|
46
|
+
function applyOption(fig, key, value) {
|
|
47
|
+
switch (key) {
|
|
48
|
+
case "note":
|
|
49
|
+
fig.note = value;
|
|
50
|
+
break;
|
|
51
|
+
case "unit":
|
|
52
|
+
fig.unit = value;
|
|
53
|
+
break;
|
|
54
|
+
case "src":
|
|
55
|
+
fig.src = value;
|
|
56
|
+
break;
|
|
57
|
+
case "stacked":
|
|
58
|
+
fig.stacked = truthy(value);
|
|
59
|
+
break;
|
|
60
|
+
case "horizontal":
|
|
61
|
+
fig.horizontal = truthy(value);
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const PERIOD_LIKE = /^((19|20)\d{2}(年度|年)?|FY\s?\d{2,4}|\d{4}\/\d{1,2}|\d{1,2}月|Q[1-4]|第?\d+四半期|第?\d+期)$/i;
|
|
66
|
+
/**
|
|
67
|
+
* 見出し行とみなす条件: 2 列目以降に数値として読めないセルがある、
|
|
68
|
+
* または全部が年・月・期のような期間の表記(`2024` `2025年度` は数値としても読めてしまう)。
|
|
69
|
+
*/
|
|
70
|
+
function looksLikeHeader(cells) {
|
|
71
|
+
if (cells.length < 2)
|
|
72
|
+
return true;
|
|
73
|
+
const rest = cells.slice(1).map((c) => c.normalize("NFKC").trim());
|
|
74
|
+
return rest.some((c) => parseCell(c).kind === "bad") || rest.every((c) => PERIOD_LIKE.test(c));
|
|
75
|
+
}
|
|
76
|
+
function synthesizeHeader(series, line, diags) {
|
|
77
|
+
diags.add(line, "info", "missing_header", "列名の行が無いため、系列名を補いました");
|
|
78
|
+
const n = Math.max(1, Math.min(series, LIMITS.chartColumns - 1));
|
|
79
|
+
return ["項目", ...Array.from({ length: n }, (_, i) => (n === 1 ? "値" : `系列${i + 1}`))];
|
|
80
|
+
}
|
|
81
|
+
function pushRow(fig, header, cells, line, diags) {
|
|
82
|
+
if (fig.rows.length >= LIMITS.chartRows) {
|
|
83
|
+
diags.addOnce(line, "warning", "limit_exceeded", `データ行は ${LIMITS.chartRows} 行までです。以降を省略しました`);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const label = takeRefs(cells[0] ?? "");
|
|
87
|
+
const width = header.length - 1;
|
|
88
|
+
if (cells.length - 1 > width) {
|
|
89
|
+
diags.add(line, "warning", "extra_cells", `列名より多いセルを無視しました(${cells.length - 1} > ${width})`);
|
|
90
|
+
}
|
|
91
|
+
const values = [];
|
|
92
|
+
const refs = [...label.refs];
|
|
93
|
+
for (let i = 1; i <= width; i++) {
|
|
94
|
+
const cellText = cells[i] ?? "";
|
|
95
|
+
const cellRefs = takeRefs(cellText);
|
|
96
|
+
refs.push(...cellRefs.refs);
|
|
97
|
+
const v = parseCell(cellRefs.text);
|
|
98
|
+
if (v.kind === "bad") {
|
|
99
|
+
diags.add(line, "warning", "bad_number", `「${label.text}」の「${cellText}」は数値として読めないため、この行を表示しません`);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
values.push(v.kind === "number" ? v.value : null);
|
|
103
|
+
}
|
|
104
|
+
const row = { label: clip(label.text, line, diags), values, refs: dedupe(refs) };
|
|
105
|
+
fig.rows.push(row);
|
|
106
|
+
}
|
|
107
|
+
function dedupe(xs) {
|
|
108
|
+
return [...new Set(xs)];
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.js","sourceRoot":"","sources":["../../src/kinds/chart.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAG3B,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EACL,IAAI,EAEJ,OAAO,EACP,cAAc,EACd,MAAM,EAEN,WAAW,EACX,UAAU,EACV,eAAe,EACf,QAAQ,EACR,MAAM,GACP,MAAM,aAAa,CAAC;AAErB,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,CAAU,CAAC;AAE1E,MAAM,UAAU,UAAU,CAAC,GAAgB,EAAE,IAAY,EAAE,KAAkB;IAC3E,IAAI,MAAM,GAAoB,IAAI,CAAC;IAEnC,KAAK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AAC,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;YACrB,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,KAAK,CAAC,IAAI,MAAM,QAAQ,0BAA0B,CAAC,CAAC;YACjG,OAAO;QACT,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC;IACD,MAAM,GAAG,GAAa,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;IAC3F,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC;AAED,SAAS,MAAM,CAAC,EAAY;IAC1B,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* flow: 矢印でつないだ流れ図。
|
|
3
|
+
*
|
|
4
|
+
* - `A -> B -> C`(`-->` `→` `=>` も可)
|
|
5
|
+
* - ラベル付き: `A -はい-> B` / `A -->|はい| B` / `A -- はい --> B`
|
|
6
|
+
* - Mermaid 風のノード定義 `A[注文] --> B{在庫あり?}` も受ける(id で同一ノード)。
|
|
7
|
+
* - 矢印の無い行は単独のノード。
|
|
8
|
+
*/
|
|
9
|
+
import type { FlowFigure } from "../ir.js";
|
|
10
|
+
import { Diagnostics, type Line } from "../lines.js";
|
|
11
|
+
/** 1 行をノード文字列と辺ラベルの列に分ける。 */
|
|
12
|
+
export declare function splitChain(text: string): {
|
|
13
|
+
nodes: string[];
|
|
14
|
+
labels: (string | undefined)[];
|
|
15
|
+
};
|
|
16
|
+
export declare function parseFlow(fig: FlowFigure, body: Line[], diags: Diagnostics): void;
|
|
17
|
+
//# sourceMappingURL=flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../../src/kinds/flow.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAuB,MAAM,UAAU,CAAC;AAChE,OAAO,EAAQ,WAAW,EAAU,KAAK,IAAI,EAAyC,MAAM,aAAa,CAAC;AA6B1G,6BAA6B;AAC7B,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAA;CAAE,CA8B5F;AAoBD,wBAAgB,SAAS,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAmFjF"}
|