@littlepress/renderer-web 0.0.0-stage → 1.0.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 +202 -0
- package/NOTICE +20 -0
- package/README.md +229 -2
- package/dist/answer/answerComponents.d.ts +107 -0
- package/dist/answer/answerComponents.js +637 -0
- package/dist/answer/download.d.ts +63 -0
- package/dist/answer/download.js +109 -0
- package/dist/answer/downloadExport.d.ts +44 -0
- package/dist/answer/downloadExport.js +266 -0
- package/dist/answer/hostValues.d.ts +28 -0
- package/dist/answer/hostValues.js +379 -0
- package/dist/answer/mapComponent.d.ts +6 -0
- package/dist/answer/mapComponent.js +213 -0
- package/dist/answer/math.d.ts +57 -0
- package/dist/answer/math.js +168 -0
- package/dist/answer/surfaceStream.d.ts +51 -0
- package/dist/answer/surfaceStream.js +260 -0
- package/dist/answer/tableLayout.d.ts +42 -0
- package/dist/answer/tableLayout.js +89 -0
- package/dist/controls/ActionFeedback.d.ts +5 -0
- package/dist/controls/ActionFeedback.js +43 -0
- package/dist/controls/actionDispatch.d.ts +51 -0
- package/dist/controls/actionDispatch.js +211 -0
- package/dist/controls/actionOutcome.generated.d.ts +64 -0
- package/dist/controls/actionOutcome.generated.js +64 -0
- package/dist/controls/calculationPublisher.d.ts +14 -0
- package/dist/controls/calculationPublisher.js +6 -0
- package/dist/controls/calculations.d.ts +20 -0
- package/dist/controls/calculations.generated.d.ts +73 -0
- package/dist/controls/calculations.generated.js +85 -0
- package/dist/controls/calculations.js +208 -0
- package/dist/controls/controlState.d.ts +84 -0
- package/dist/controls/controlState.js +256 -0
- package/dist/controls/fieldMessages.d.ts +41 -0
- package/dist/controls/fieldMessages.js +81 -0
- package/dist/controls/fieldValidation.d.ts +19 -0
- package/dist/controls/fieldValidation.js +98 -0
- package/dist/controls/formComponents.d.ts +23 -0
- package/dist/controls/formComponents.js +738 -0
- package/dist/controls/formProgress.d.ts +63 -0
- package/dist/controls/formProgress.js +122 -0
- package/dist/controls/inputDrafts.d.ts +55 -0
- package/dist/controls/inputDrafts.js +183 -0
- package/dist/controls/inputValidation.d.ts +33 -0
- package/dist/controls/inputValidation.js +119 -0
- package/dist/controls/localWrites.d.ts +9 -0
- package/dist/controls/localWrites.js +29 -0
- package/dist/core/A2uiSurface.d.ts +13 -0
- package/dist/core/A2uiSurface.js +15 -0
- package/dist/core/AtlasIcon.d.ts +18 -0
- package/dist/core/AtlasIcon.js +22 -0
- package/dist/core/AtlasMedia.d.ts +22 -0
- package/dist/core/AtlasMedia.js +45 -0
- package/dist/core/Carousel.d.ts +61 -0
- package/dist/core/Carousel.js +183 -0
- package/dist/core/CoreMedia.d.ts +19 -0
- package/dist/core/CoreMedia.js +25 -0
- package/dist/core/FoundationA2uiSurface.d.ts +86 -0
- package/dist/core/FoundationA2uiSurface.js +440 -0
- package/dist/core/ImagePreview.d.ts +42 -0
- package/dist/core/ImagePreview.js +73 -0
- package/dist/core/LucideIcon.d.ts +19 -0
- package/dist/core/LucideIcon.js +42 -0
- package/dist/core/SurfaceLink.d.ts +35 -0
- package/dist/core/SurfaceLink.js +60 -0
- package/dist/core/appearance/aegis.d.ts +49 -0
- package/dist/core/appearance/aegis.js +34 -0
- package/dist/core/appearance/colour.d.ts +24 -0
- package/dist/core/appearance/colour.js +103 -0
- package/dist/core/appearance/css.d.ts +17 -0
- package/dist/core/appearance/css.js +153 -0
- package/dist/core/appearance/presets.generated.d.ts +4 -0
- package/dist/core/appearance/presets.generated.js +1184 -0
- package/dist/core/appearance/react.d.ts +29 -0
- package/dist/core/appearance/react.js +110 -0
- package/dist/core/appearance/resolve.d.ts +76 -0
- package/dist/core/appearance/resolve.js +127 -0
- package/dist/core/appearance/textScale.d.ts +11 -0
- package/dist/core/appearance/textScale.js +51 -0
- package/dist/core/appearance/theme.d.ts +138 -0
- package/dist/core/appearance/theme.js +274 -0
- package/dist/core/baseComponents.d.ts +53 -0
- package/dist/core/baseComponents.js +480 -0
- package/dist/core/binding.d.ts +46 -0
- package/dist/core/binding.js +118 -0
- package/dist/core/bundle.d.ts +23 -0
- package/dist/core/bundle.js +75 -0
- package/dist/core/catalog/catalog-index.generated.d.ts +44 -0
- package/dist/core/catalog/catalog-index.generated.js +79 -0
- package/dist/core/catalog/icons.generated.d.ts +6 -0
- package/dist/core/catalog/icons.generated.js +1788 -0
- package/dist/core/catalog.d.ts +6 -0
- package/dist/core/catalog.generated.d.ts +50 -0
- package/dist/core/catalog.generated.js +2174 -0
- package/dist/core/catalog.js +8 -0
- package/dist/core/chartRows.d.ts +7 -0
- package/dist/core/chartRows.js +38 -0
- package/dist/core/component-support.d.ts +39 -0
- package/dist/core/component-support.js +127 -0
- package/dist/core/components/actions.d.ts +4 -0
- package/dist/core/components/actions.js +21 -0
- package/dist/core/components/cards.d.ts +9 -0
- package/dist/core/components/cards.js +227 -0
- package/dist/core/components/charts.d.ts +18 -0
- package/dist/core/components/charts.js +412 -0
- package/dist/core/components/comparisonTable.d.ts +50 -0
- package/dist/core/components/comparisonTable.js +89 -0
- package/dist/core/components/content.d.ts +13 -0
- package/dist/core/components/content.js +108 -0
- package/dist/core/components/seriesCharts.d.ts +531 -0
- package/dist/core/components/seriesCharts.js +1053 -0
- package/dist/core/components/stepFlow.d.ts +7 -0
- package/dist/core/components/stepFlow.js +13 -0
- package/dist/core/components.full.d.ts +10 -0
- package/dist/core/components.full.js +41 -0
- package/dist/core/context.d.ts +207 -0
- package/dist/core/context.js +172 -0
- package/dist/core/coverage.d.ts +30 -0
- package/dist/core/coverage.js +93 -0
- package/dist/core/foundation.d.ts +21 -0
- package/dist/core/foundation.js +22 -0
- package/dist/core/fullTheme.d.ts +5 -0
- package/dist/core/fullTheme.js +9 -0
- package/dist/core/iconNodes.generated.d.ts +7 -0
- package/dist/core/iconNodes.generated.js +5 -0
- package/dist/core/lucideIcons.d.ts +5 -0
- package/dist/core/lucideIcons.js +7 -0
- package/dist/core/messages.d.ts +111 -0
- package/dist/core/messages.js +134 -0
- package/dist/core/pointer.d.ts +17 -0
- package/dist/core/pointer.js +104 -0
- package/dist/core/registry.d.ts +12 -0
- package/dist/core/registry.js +114 -0
- package/dist/core/runtime.d.ts +8 -0
- package/dist/core/runtime.js +6 -0
- package/dist/core/state.d.ts +73 -0
- package/dist/core/state.js +274 -0
- package/dist/core/surfaceMotion.d.ts +5 -0
- package/dist/core/surfaceMotion.js +46 -0
- package/dist/core/theme.d.ts +5 -0
- package/dist/core/theme.js +7 -0
- package/dist/core/useSurfaceImage.d.ts +20 -0
- package/dist/core/useSurfaceImage.js +65 -0
- package/dist/graph/RelationshipGraph.d.ts +14 -0
- package/dist/graph/RelationshipGraph.js +206 -0
- package/dist/graph/model.d.ts +20 -0
- package/dist/graph/model.js +36 -0
- package/dist/graph/program/assets.d.ts +3 -0
- package/dist/graph/program/assets.js +3 -0
- package/dist/graph/program/bridge.d.ts +6 -0
- package/dist/graph/program/bridge.generated.d.ts +136 -0
- package/dist/graph/program/bridge.generated.js +1 -0
- package/dist/graph/program/bridge.js +24 -0
- package/dist/graph/program/bridge.schema.json +717 -0
- package/dist/graph/program/bridgeValidator.cjs +2 -0
- package/dist/graph/program/bridgeValidator.d.cts +4 -0
- package/dist/graph/program/runner.d.ts +1 -0
- package/dist/graph/program/runner.html +2193 -0
- package/dist/graph/program/runner.js +157 -0
- package/dist/graph/program/runtime-manifest.json +1 -0
- package/dist/graph/program/view.d.ts +11 -0
- package/dist/graph/program/view.js +210 -0
- package/dist/graph/program/worker.d.ts +1 -0
- package/dist/graph/program/worker.js +2186 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +45 -0
- package/dist/internal/dsh.d.ts +4 -0
- package/dist/internal/dsh.js +3 -0
- package/dist/internal/relationship-graph.d.ts +4 -0
- package/dist/internal/relationship-graph.js +7202 -0
- package/dist/page/layoutComponents.d.ts +6 -0
- package/dist/page/layoutComponents.js +123 -0
- package/dist/page/layoutGeometry.d.ts +68 -0
- package/dist/page/layoutGeometry.js +174 -0
- package/dist/page/pageFormat.d.ts +34 -0
- package/dist/page/pageFormat.js +119 -0
- package/dist/page/printFit.d.ts +81 -0
- package/dist/page/printFit.js +338 -0
- package/dist/react/index.d.ts +5 -0
- package/dist/react/index.js +2 -0
- package/dist/report/locate.d.ts +42 -0
- package/dist/report/locate.js +34 -0
- package/dist/styles/renderer.css +4580 -0
- package/licenses/LUCIDE-LICENSE.txt +43 -0
- package/licenses/QUICKJS-EMSCRIPTEN-LICENSE.txt +21 -0
- package/licenses/QUICKJS-VARIANT-LICENSE.txt +47 -0
- package/package.json +68 -3
package/LICENSE
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/NOTICE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
LittlePress Web Renderer
|
|
2
|
+
Copyright 2026 The LittlePress Authors
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0; see LICENSE.
|
|
5
|
+
|
|
6
|
+
Third-party components redistributed with this package keep their own licences:
|
|
7
|
+
|
|
8
|
+
- Lucide icons. The icon geometry bundled in the Web renderer
|
|
9
|
+
(`iconNodes.generated.js`) is derived from lucide-react 1.33.0.
|
|
10
|
+
Copyright (c) 2026 Lucide Icons and Contributors. ISC License.
|
|
11
|
+
115 of the icons are derived from the Feather project, Copyright (c)
|
|
12
|
+
2013-present Cole Bemis, MIT License. Both licences are in
|
|
13
|
+
licenses/LUCIDE-LICENSE.txt.
|
|
14
|
+
|
|
15
|
+
- QuickJS, through quickjs-emscripten 0.32.0 and
|
|
16
|
+
@jitl/quickjs-singlefile-browser-release-sync 0.32.0. QuickJS is
|
|
17
|
+
Copyright (c) 2017-2021 Fabrice Bellard and Charlie Gordon;
|
|
18
|
+
quickjs-emscripten is Copyright (c) 2019-2024 Jake Teton-Landis.
|
|
19
|
+
MIT License; see licenses/QUICKJS-EMSCRIPTEN-LICENSE.txt and
|
|
20
|
+
licenses/QUICKJS-VARIANT-LICENSE.txt.
|
package/README.md
CHANGED
|
@@ -1,3 +1,230 @@
|
|
|
1
|
-
#
|
|
1
|
+
# LittlePress Web Renderer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@littlepress/renderer-web` turns a validated `SurfaceArtifact` or a sequence of
|
|
4
|
+
A2UI messages into React components. Its normal entries include every component
|
|
5
|
+
the LittlePress v1 catalog can return: base controls and layouts, charts, metric
|
|
6
|
+
strips, comparison tables, step flows, fixed-page containers, five style packs,
|
|
7
|
+
and both controlled icon tables.
|
|
8
|
+
|
|
9
|
+
The runtime resolves JSON Pointer bindings against the data model. In a
|
|
10
|
+
repeated template, relative paths read the current item. Pass one action
|
|
11
|
+
handler to receive supported events and map your Host's result to an outcome.
|
|
12
|
+
|
|
13
|
+
## Public Entries
|
|
14
|
+
|
|
15
|
+
- `@littlepress/renderer-web`: complete DOM-free runtime helpers plus the stable
|
|
16
|
+
`rendererProtocolVersion`, `rendererCatalogId`, and `rendererCatalogVersion`
|
|
17
|
+
a Host sends in `render_target`.
|
|
18
|
+
- `@littlepress/renderer-web/react`: `A2uiSurface` and the Host action, input,
|
|
19
|
+
layout, and locate types. The package does not expose its complete registry for extension;
|
|
20
|
+
custom partner components are outside the v1 contract.
|
|
21
|
+
- `@littlepress/renderer-web/styles.css`: self-contained, flattened styles for
|
|
22
|
+
the complete renderer. It contains no CSS `@import` chain.
|
|
23
|
+
- `@littlepress/renderer-web/licenses/LUCIDE-LICENSE.txt`: license for the
|
|
24
|
+
controlled icon dependency.
|
|
25
|
+
|
|
26
|
+
The `./internal/*` entries serve LittlePress's own applications and
|
|
27
|
+
integrations. Their interfaces may change between releases.
|
|
28
|
+
|
|
29
|
+
Use `readA2uiSurfaceState(surfaceArtifact)` for a full artifact or
|
|
30
|
+
`readA2uiSurfaceStateFromMessages(messages)` for a message list.
|
|
31
|
+
|
|
32
|
+
Version fields use the format required by their wire contract. Use
|
|
33
|
+
`rendererProtocolVersion` (`"1.0"`, without `v`) for
|
|
34
|
+
`render_target.protocol_version` and to match `GET /v1/catalogs`. Use
|
|
35
|
+
`rendererSpecVersion` (`"v1.0"`) for the A2UI artifact envelope and message
|
|
36
|
+
`version`. Both exports come from the same Foundation catalog source.
|
|
37
|
+
|
|
38
|
+
The package-local component and core-icon lists are generated from the
|
|
39
|
+
versioned Foundation catalog. Refresh and verify the catalog, icon, style-token,
|
|
40
|
+
flattened-style and theme-preset outputs with:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
corepack pnpm --filter @littlepress/renderer-web generate:catalog
|
|
44
|
+
corepack pnpm --filter @littlepress/renderer-web check:catalog
|
|
45
|
+
corepack pnpm --filter @littlepress/renderer-web generate:assets
|
|
46
|
+
corepack pnpm --filter @littlepress/renderer-web check:assets
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Appearance
|
|
50
|
+
|
|
51
|
+
A Host decides how its cards look; nothing about appearance travels in A2UI messages, and a
|
|
52
|
+
message's `stylePack` is ignored. Wrap the page (or part of it) in `LittlePressAppearance`:
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import { themePresets } from "@littlepress/renderer-web";
|
|
56
|
+
import { A2uiSurface, LittlePressAppearance, useLittlePressAppearance } from "@littlepress/renderer-web/react";
|
|
57
|
+
|
|
58
|
+
<LittlePressAppearance theme={themePresets.companion} textScale={1.5} colorMode="system" onProblems={report}>
|
|
59
|
+
<A2uiSurface state={state} />
|
|
60
|
+
<MyButton />
|
|
61
|
+
</LittlePressAppearance>;
|
|
62
|
+
|
|
63
|
+
function MyButton() {
|
|
64
|
+
const look = useLittlePressAppearance(); // colours, text styles and sizes already resolved
|
|
65
|
+
return <button style={{ ...look.cssVariables, background: look.color.accent, color: look.color.onAccent, minHeight: look.minTouchTarget }}>OK</button>;
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- A theme is a set of explicit values, not a pack name: 16 required colours for light and for dark,
|
|
70
|
+
everything else optional. `themePresets` holds `neutral`, `editorial`, `minimal`, `system`, `m3` and
|
|
71
|
+
`companion`; copy one and change what you need.
|
|
72
|
+
- Changing any setting redraws in place: form drafts, selections and running programs are kept.
|
|
73
|
+
Nest `LittlePressAppearance` to change part of the page; an inner one only lists what it changes.
|
|
74
|
+
- System settings are followed when a setting is absent: `prefers-color-scheme`, `prefers-contrast`,
|
|
75
|
+
`prefers-reduced-motion` and the browser's text size (read from a hidden `font-size: medium` element, so a page's own `html { font-size }` does not shrink the cards; the Host scale times the browser scale stays within 0.85–3).
|
|
76
|
+
- A theme that fails the check is not used; the theme in use before stays, and `onProblems` receives
|
|
77
|
+
every reason with its JSON path (without `onProblems` they are logged with `console.error`).
|
|
78
|
+
`checkTheme(theme)` runs the same check up front, for example in a theme picker.
|
|
79
|
+
A field the SDK does not know (`code: "unknown"`, such as a token a newer version added) is only
|
|
80
|
+
a warning: the theme is used without it. `refusesTheme(problem)` tells warnings from refusals;
|
|
81
|
+
tools that write themes should treat any problem as an error.
|
|
82
|
+
- `A2uiSurface`'s `pack` and `mode` props still work for one surface: `pack` picks a preset by name.
|
|
83
|
+
|
|
84
|
+
| Setting | Values | When absent |
|
|
85
|
+
| --- | --- | --- |
|
|
86
|
+
| `theme` | a theme object | the `neutral` preset |
|
|
87
|
+
| `colorMode` | `light`, `dark`, `system` | follows the system |
|
|
88
|
+
| `textScale` | 0.85–3, multiplied with the browser text size; body text grows most, large figures least | 1 |
|
|
89
|
+
| `contrast` | `standard`, `high`, `system`; high derives 7:1 accent and button text | follows the system |
|
|
90
|
+
| `boldText` | `true`, `false`; adds 300 to every text weight, at most 800 | `false` (browsers have no such setting) |
|
|
91
|
+
| `reducedMotion` | `true` turns motion off; a Host cannot turn it back on | follows the system |
|
|
92
|
+
| `minTouchTarget` | CSS px; never below 44 | 44 |
|
|
93
|
+
|
|
94
|
+
The schema is `ui-foundation/surface/contracts/schema/appearance.json`; the shared cases every renderer
|
|
95
|
+
asserts are `ui-foundation/surface/contracts/fixtures/renderer/appearance.json`. Without a provider a
|
|
96
|
+
surface draws with the `neutral` preset, as before.
|
|
97
|
+
|
|
98
|
+
## Moving the Reader to a Heading
|
|
99
|
+
|
|
100
|
+
A Host table of contents can send the reader to a heading inside a surface. Pass
|
|
101
|
+
a `ref` to `A2uiSurface` to get an `A2uiSurfaceHandle`:
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
const surface = useRef<A2uiSurfaceHandle>(null);
|
|
105
|
+
<A2uiSurface ref={surface} state={state} layout="flow" />;
|
|
106
|
+
surface.current?.locateComponent("title_06", { behavior: "smooth" });
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`locateComponent(componentId, options?)` scrolls the component to the top of its
|
|
110
|
+
scroll container and moves keyboard focus to it. A heading cannot normally take
|
|
111
|
+
focus, so the renderer adds `tabindex="-1"` the first time; this does not add a
|
|
112
|
+
Tab stop. It returns `false` and changes nothing when the surface draws no
|
|
113
|
+
locatable element for that id.
|
|
114
|
+
|
|
115
|
+
Only a text heading (`LPText` with `role` `title` or `headline`, drawn as an H2)
|
|
116
|
+
that is drawn once can be located. Headings inside repeated rows get no id,
|
|
117
|
+
because one component id is drawn once per row. Each mounted surface puts its
|
|
118
|
+
own prefix in front of the ids it writes and searches only inside its own
|
|
119
|
+
element, so two surfaces on one page that both contain `title_02` never find
|
|
120
|
+
each other's heading. Do not build these ids yourself; the prefix is not part
|
|
121
|
+
of the API. The call does not change the surface contract, and native renderers
|
|
122
|
+
do not offer it yet.
|
|
123
|
+
|
|
124
|
+
If your page has a fixed header, set `scroll-padding-top` on the scrolling
|
|
125
|
+
element so the heading is not hidden under it.
|
|
126
|
+
|
|
127
|
+
## Streaming LP-MDX
|
|
128
|
+
|
|
129
|
+
A whole assistant answer reaches the page as one snapshot (a `SurfaceArtifact`)
|
|
130
|
+
and then only `SurfaceUpdate`s, the messages that changed from `base_revision` to
|
|
131
|
+
`revision`. Keep one stream per answer and draw it:
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
const stream = createSurfaceStream();
|
|
135
|
+
const result = stream.snapshot(firstArtifact); // later: stream.update(update)
|
|
136
|
+
if (result.status === "needs_snapshot") askHostForSnapshot(result.reason);
|
|
137
|
+
|
|
138
|
+
<A2uiSurface stream={stream} actionHandler={handler} />
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Both calls take the object or its JSON text and return `applied`, `ignored` (a
|
|
142
|
+
late or repeated revision; nothing to do) or `needs_snapshot` with
|
|
143
|
+
`no_snapshot`, `surface_mismatch`, `base_mismatch` or `invalid_update`. Nothing
|
|
144
|
+
changes on the page unless the result is `applied`. Each message gets the same
|
|
145
|
+
checks as on Compose and SwiftUI and is applied to the state already shown.
|
|
146
|
+
|
|
147
|
+
Once `/runtimeState/answerState` is `"done"`, the answer itself is final: an
|
|
148
|
+
update or a snapshot may change only the Widget that follows it (components whose
|
|
149
|
+
id starts with `w.` and data under `/data`), and anything else is refused with
|
|
150
|
+
`invalid_update`. Do not send a refused snapshot again; to show the whole answer
|
|
151
|
+
anew, create a new stream. Nothing is drawn before the first snapshot.
|
|
152
|
+
|
|
153
|
+
## Downloads in an answer
|
|
154
|
+
|
|
155
|
+
`LPDownload_Default` (LP-MDX `<download>`) writes the value at its `/data/` path
|
|
156
|
+
into a CSV or JSON file in the browser: CSV is RFC 4180, UTF-8 with a BOM and
|
|
157
|
+
CRLF line endings, with a `'` before text that starts like a formula; JSON is
|
|
158
|
+
indented by two spaces. A file over 1 MiB is not written, and the button shows
|
|
159
|
+
an error instead. By default the browser downloads it through a Blob URL that is
|
|
160
|
+
revoked afterwards. To take over (a native share sheet, cloud storage), pass
|
|
161
|
+
`saveFile`:
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
<A2uiSurface
|
|
165
|
+
stream={stream}
|
|
166
|
+
saveFile={async (name, mime, bytes) => (await myPicker.save(name, mime, bytes)) ? "saved" : "cancelled"}
|
|
167
|
+
/>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Resolve with `"cancelled"` when the user backs out (nothing is shown), `"saved"`
|
|
171
|
+
or nothing once saved, and reject when it fails. The button is disabled while
|
|
172
|
+
the answer streams and ignores taps while a save is open; results are announced
|
|
173
|
+
through a polite live region.
|
|
174
|
+
|
|
175
|
+
## Form drafts during refresh
|
|
176
|
+
|
|
177
|
+
Keep the same surface identity and React key when replacing data. Untouched
|
|
178
|
+
fields read the new values. Edits stay with their form, field, and stable row
|
|
179
|
+
identity. Only actions and forms that need a stale draft pause. The user can
|
|
180
|
+
restore the Host's current values with **Discard my changes**. See the
|
|
181
|
+
[Widget refresh guide](https://github.com/BinaryTape/LittlePress/blob/main/playground/web/content/docs/en/widget/data-updates.mdx).
|
|
182
|
+
|
|
183
|
+
## Composed list rows
|
|
184
|
+
|
|
185
|
+
`rendererCapabilities` advertises `list-row-thumbnail` and `list-row-tap`.
|
|
186
|
+
See the [composed row contract](https://github.com/BinaryTape/LittlePress/blob/main/docs/architecture/renderer-visual-contract.md#composed-list-rows)
|
|
187
|
+
for thumbnail layout, row identity, and action state.
|
|
188
|
+
|
|
189
|
+
## Local quotation calculations
|
|
190
|
+
|
|
191
|
+
Set `GenerateRequest.render_target.capabilities` from the root export
|
|
192
|
+
`rendererCapabilities` to advertise `local-calculation-v1`. The renderer
|
|
193
|
+
checks the capabilities required by each artifact. See the
|
|
194
|
+
[calculation guide](https://github.com/BinaryTape/LittlePress/blob/main/playground/web/content/docs/en/calculations.mdx)
|
|
195
|
+
for inputs, money values, and refresh behavior.
|
|
196
|
+
|
|
197
|
+
## React Versions
|
|
198
|
+
|
|
199
|
+
The renderer works with React 18.3 and React 19: `peerDependencies` declares
|
|
200
|
+
`react` `^18.3.1 || ^19.0.0`, and the code only uses APIs that both versions
|
|
201
|
+
have (for example `forwardRef` for the `A2uiSurface` handle). `corepack pnpm
|
|
202
|
+
test` runs every test twice, `test:react18` with React 18.3.1 and
|
|
203
|
+
`test:react19` with React 19.3.0, which `scripts/use-react-19.mjs` loads in
|
|
204
|
+
place of React 18. The published type declarations are built with
|
|
205
|
+
`@types/react` 18.3, and `typecheck` also checks the sources against
|
|
206
|
+
`@types/react` 19.3 (`tsconfig.react19.json`), so the declarations compile for a
|
|
207
|
+
Host on either version.
|
|
208
|
+
|
|
209
|
+
## Verify
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
cd ui-foundation/surface/typescript
|
|
213
|
+
corepack pnpm --filter @littlepress/renderer-web test
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
From the repository root, `./scripts/release/pack-renderer-web.sh` first builds its workspace
|
|
217
|
+
dependencies, including contracts, then builds this package from a clean `dist/`,
|
|
218
|
+
packs the same source twice, checks that both tarballs are byte-identical, and
|
|
219
|
+
writes `build/packages/littlepress-renderer-web-1.0.0.tgz`. The clean fixture in
|
|
220
|
+
`test/package-host/` installs only that tarball plus React and browser test tools;
|
|
221
|
+
it renders a Widget and Report and clicks a real action under React 18 and 19.
|
|
222
|
+
The tarball declares `license: "Apache-2.0"` and includes this module's `LICENSE`,
|
|
223
|
+
`NOTICE`, the Lucide license and the QuickJS licenses.
|
|
224
|
+
|
|
225
|
+
## Icons
|
|
226
|
+
|
|
227
|
+
The renderer bundles the pinned Lucide geometry: 1,776 icons and 258 aliases.
|
|
228
|
+
Remote content supplies an icon name, and the renderer draws its bundled
|
|
229
|
+
geometry. Run `scripts/generate-icons.mjs` to regenerate the geometry,
|
|
230
|
+
aliases, and catalog icon enum together.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type A2uiComponent } from "../core/messages.ts";
|
|
3
|
+
import { type ComponentRenderer, type RenderContext } from "../core/context.ts";
|
|
4
|
+
import { type PlacedCell } from "./tableLayout.ts";
|
|
5
|
+
export type CiteSourceKind = "web" | "code" | "file";
|
|
6
|
+
export type CiteSourceRecord = {
|
|
7
|
+
id: string;
|
|
8
|
+
kind: CiteSourceKind;
|
|
9
|
+
index: number;
|
|
10
|
+
title: string;
|
|
11
|
+
url?: string;
|
|
12
|
+
site?: string;
|
|
13
|
+
faviconUrl?: string;
|
|
14
|
+
excerpt?: string;
|
|
15
|
+
path?: string;
|
|
16
|
+
lineStart?: number;
|
|
17
|
+
lineEnd?: number;
|
|
18
|
+
preview?: string;
|
|
19
|
+
previewStartLine?: number;
|
|
20
|
+
fileName?: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function splitCodePreviewLines(preview: string): string[];
|
|
23
|
+
export declare function formatCodeLocation(path: string, lineStart: number, lineEnd?: number): string;
|
|
24
|
+
export declare function citeSourcePillLabel(source: CiteSourceRecord): string;
|
|
25
|
+
export declare function parseCiteSourceItem(item: Record<string, unknown>, fallbackIndex?: number): CiteSourceRecord | null;
|
|
26
|
+
export declare function buildOpenSourceEventAction(sourceId: string): {
|
|
27
|
+
event: {
|
|
28
|
+
name: string;
|
|
29
|
+
context: {
|
|
30
|
+
id: string;
|
|
31
|
+
_littlepress: {
|
|
32
|
+
handler: string;
|
|
33
|
+
risk: string;
|
|
34
|
+
loadingBehavior: string;
|
|
35
|
+
invokesModel: boolean;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export declare function CiteSourceIcon({ source, size, imgClassName, initialClassName, kindIconClassName, context, streaming, }: {
|
|
41
|
+
source: CiteSourceRecord;
|
|
42
|
+
size: number;
|
|
43
|
+
imgClassName: string;
|
|
44
|
+
initialClassName: string;
|
|
45
|
+
kindIconClassName: string;
|
|
46
|
+
context: RenderContext;
|
|
47
|
+
streaming: boolean;
|
|
48
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
/**
|
|
50
|
+
* Renders a Host-supplied image through the unified Host image entry point (`context.images`
|
|
51
|
+
* or `context.imageLoader`). Without `imageLoader`, valid `http://`, `https://`, and
|
|
52
|
+
* `data:image/*` URLs render directly with `referrerPolicy="no-referrer"`; when `imageLoader`
|
|
53
|
+
* is supplied, returning `null` keeps the monogram placeholder and never falls back.
|
|
54
|
+
*/
|
|
55
|
+
export declare function HostBadgeImage({ url, label, size, imgClassName, initialClassName, context, streaming, }: {
|
|
56
|
+
url: string | null | undefined;
|
|
57
|
+
label: string;
|
|
58
|
+
size: number;
|
|
59
|
+
imgClassName: string;
|
|
60
|
+
initialClassName: string;
|
|
61
|
+
context: RenderContext;
|
|
62
|
+
streaming: boolean;
|
|
63
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
64
|
+
export declare const renderRichText: ComponentRenderer;
|
|
65
|
+
export declare const renderList: ComponentRenderer;
|
|
66
|
+
export declare const renderListItem: ComponentRenderer;
|
|
67
|
+
type Cell = {
|
|
68
|
+
content?: unknown;
|
|
69
|
+
colSpan?: unknown;
|
|
70
|
+
rowSpan?: unknown;
|
|
71
|
+
align?: unknown;
|
|
72
|
+
};
|
|
73
|
+
/** The table's parts: header rows, body rows (`sectionRows` head a section) and footer rows. */
|
|
74
|
+
export type TableParts = {
|
|
75
|
+
header: Cell[][];
|
|
76
|
+
body: Cell[][];
|
|
77
|
+
sections: number[];
|
|
78
|
+
footer: number;
|
|
79
|
+
columns: number;
|
|
80
|
+
};
|
|
81
|
+
export declare function tableParts(component: A2uiComponent): TableParts;
|
|
82
|
+
/** Each cell's place in the layout rows (header rows, then body rows); `null` for a cell not drawn. */
|
|
83
|
+
export declare function tablePlacement(parts: TableParts): Array<Array<PlacedCell | null>>;
|
|
84
|
+
/**
|
|
85
|
+
* The table's rows as elements: `head` for `<thead>`, `bodies` for one `<tbody>` per section
|
|
86
|
+
* (the rows before the first section in their own), `foot` for `<tfoot>`, and `rows`, every body
|
|
87
|
+
* and footer row by its index in the props. The path of a link names its cell in the props,
|
|
88
|
+
* never its layout column.
|
|
89
|
+
*/
|
|
90
|
+
export declare function tableRows(component: A2uiComponent, context: RenderContext): {
|
|
91
|
+
head: ReactNode[];
|
|
92
|
+
bodies: ReactNode[][];
|
|
93
|
+
foot: ReactNode[];
|
|
94
|
+
rows: ReactNode[];
|
|
95
|
+
};
|
|
96
|
+
export declare const renderTable: ComponentRenderer;
|
|
97
|
+
/** The code as elements: one span per token, or the plain text while streaming or when tokens do not spell it. */
|
|
98
|
+
export declare function codeBody(component: A2uiComponent): ReactNode;
|
|
99
|
+
export declare const renderCodeBlock: ComponentRenderer;
|
|
100
|
+
export declare const renderBlockquote: ComponentRenderer;
|
|
101
|
+
export declare const renderMath: ComponentRenderer;
|
|
102
|
+
/** Maximum inline Aegis blocks admitted per answer; additional blocks degrade to fallback text. */
|
|
103
|
+
export declare const MAX_ANSWER_AEGIS_BLOCKS = 3;
|
|
104
|
+
/** Stable per-rendered-instance key so repeated or shared templates count each rendered slot separately. */
|
|
105
|
+
export declare function aegisInstanceKey(componentId: string, renderPath?: string | null): string;
|
|
106
|
+
export declare const renderAegisBlock: ComponentRenderer;
|
|
107
|
+
export {};
|