@deltarobotics/uhd-viewer 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/CHANGELOG.md +41 -0
- package/LICENSE +202 -0
- package/NOTICE +22 -0
- package/README.md +168 -2
- package/bin/serve.d.mts +62 -0
- package/bin/serve.mjs +257 -0
- package/bin/uhd-viewer.mjs +75 -0
- package/dist/app/assets/KodeMono-Bold-DdIivhPN.woff2 +0 -0
- package/dist/app/assets/KodeMono-Medium-CVnTuv5A.ttf +0 -0
- package/dist/app/assets/KodeMono-Regular-Bdr_-rJX.woff2 +0 -0
- package/dist/app/assets/KodeMono-SemiBold-JAfn5Dpm.ttf +0 -0
- package/dist/app/assets/index-Boi2erhd.css +2 -0
- package/dist/app/assets/index-CkpIRYgM.js +3853 -0
- package/dist/app/index.html +16 -0
- package/dist/components/components.css +6108 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +26048 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/types/uhd-viewer/src/api.d.ts +286 -0
- package/dist/components/types/uhd-viewer/src/cad/CadView.d.ts +52 -0
- package/dist/components/types/uhd-viewer/src/cad/ModelView.d.ts +28 -0
- package/dist/components/types/uhd-viewer/src/cad/explode.d.ts +110 -0
- package/dist/components/types/uhd-viewer/src/cad/explodeSample.d.ts +25 -0
- package/dist/components/types/uhd-viewer/src/cad/findings.d.ts +41 -0
- package/dist/components/types/uhd-viewer/src/cad/labels.d.ts +76 -0
- package/dist/components/types/uhd-viewer/src/cad/model.d.ts +132 -0
- package/dist/components/types/uhd-viewer/src/cad/row.d.ts +15 -0
- package/dist/components/types/uhd-viewer/src/cad/scene.d.ts +95 -0
- package/dist/components/types/uhd-viewer/src/cad/scope.d.ts +89 -0
- package/dist/components/types/uhd-viewer/src/canvas/Canvas.d.ts +86 -0
- package/dist/components/types/uhd-viewer/src/canvas/Icon.d.ts +5 -0
- package/dist/components/types/uhd-viewer/src/canvas/LinkEdge.d.ts +40 -0
- package/dist/components/types/uhd-viewer/src/canvas/Port.d.ts +18 -0
- package/dist/components/types/uhd-viewer/src/canvas/actions.d.ts +5 -0
- package/dist/components/types/uhd-viewer/src/canvas/geometry.d.ts +72 -0
- package/dist/components/types/uhd-viewer/src/canvas/interaction.d.ts +162 -0
- package/dist/components/types/uhd-viewer/src/canvas/nodes.d.ts +43 -0
- package/dist/components/types/uhd-viewer/src/canvas/reveal.d.ts +37 -0
- package/dist/components/types/uhd-viewer/src/canvas/rightDrag.d.ts +51 -0
- package/dist/components/types/uhd-viewer/src/canvas/routing.d.ts +28 -0
- package/dist/components/types/uhd-viewer/src/chrome/ArtifactCards.d.ts +30 -0
- package/dist/components/types/uhd-viewer/src/chrome/Artifacts.d.ts +44 -0
- package/dist/components/types/uhd-viewer/src/chrome/BoardInspector.d.ts +53 -0
- package/dist/components/types/uhd-viewer/src/chrome/Chrome.d.ts +116 -0
- package/dist/components/types/uhd-viewer/src/chrome/Evidence.d.ts +20 -0
- package/dist/components/types/uhd-viewer/src/chrome/InterfaceCards.d.ts +56 -0
- package/dist/components/types/uhd-viewer/src/chrome/PairView.d.ts +37 -0
- package/dist/components/types/uhd-viewer/src/chrome/Sections.d.ts +107 -0
- package/dist/components/types/uhd-viewer/src/components.d.ts +60 -0
- package/dist/components/types/uhd-viewer/src/host/channel.d.ts +49 -0
- package/dist/components/types/uhd-viewer/src/host/context.d.ts +29 -0
- package/dist/components/types/uhd-viewer/src/host/protocol.d.ts +22 -0
- package/dist/components/types/uhd-viewer/src/host/targets.d.ts +85 -0
- package/dist/components/types/uhd-viewer/src/layout/board-layout.d.ts +69 -0
- package/dist/components/types/uhd-viewer/src/layout/card-body.d.ts +64 -0
- package/dist/components/types/uhd-viewer/src/layout/layout.d.ts +94 -0
- package/dist/components/types/uhd-viewer/src/layout/module-layout.d.ts +32 -0
- package/dist/components/types/uhd-viewer/src/layout/router.d.ts +55 -0
- package/dist/components/types/uhd-viewer/src/layout/taps.d.ts +20 -0
- package/dist/components/types/uhd-viewer/src/model/artifacts.d.ts +129 -0
- package/dist/components/types/uhd-viewer/src/model/classification.d.ts +38 -0
- package/dist/components/types/uhd-viewer/src/model/diagnostics.d.ts +27 -0
- package/dist/components/types/uhd-viewer/src/model/evidence.d.ts +63 -0
- package/dist/components/types/uhd-viewer/src/model/from-uhd.d.ts +57 -0
- package/dist/components/types/uhd-viewer/src/model/hierarchy.d.ts +169 -0
- package/dist/components/types/uhd-viewer/src/model/isolate.d.ts +33 -0
- package/dist/components/types/uhd-viewer/src/model/nets.d.ts +53 -0
- package/dist/components/types/uhd-viewer/src/model/outputs.d.ts +79 -0
- package/dist/components/types/uhd-viewer/src/model/slots.d.ts +182 -0
- package/dist/components/types/uhd-viewer/src/model/types.d.ts +213 -0
- package/dist/components/types/uhd-viewer/src/options.d.ts +27 -0
- package/dist/components/types/uhd-viewer/src/source/source.d.ts +109 -0
- package/dist/components/types/uhd-viewer/src/source/tolerant.d.ts +45 -0
- package/dist/components/types/uhd-viewer/src/theme/ThemeProvider.d.ts +33 -0
- package/dist/components/types/uhd-viewer/src/theme/adapters.d.ts +28 -0
- package/dist/components/types/uhd-viewer/src/theme/resolve.d.ts +19 -0
- package/dist/components/types/uhd-viewer/src/theme/themes.d.ts +67 -0
- package/dist/components/types/uhd-viewer/src/theme/tokens.d.ts +175 -0
- package/dist/components/types/uhd-viewer/src/ui/Inspector.d.ts +45 -0
- package/dist/components/types/uhd-viewer/src/ui/Legend.d.ts +40 -0
- package/dist/components/types/uhd-viewer/src/ui/ScrollArea.d.ts +16 -0
- package/dist/components/types/uhd-viewer/src/ui/Toolbar.d.ts +49 -0
- package/dist/components/types/uhd-viewer/src/ui/Tooltips.d.ts +3 -0
- package/dist/components/types/uhd-viewer/src/ui/cx.d.ts +2 -0
- package/dist/components/types/uhd-viewer/src/ui/legendFit.d.ts +42 -0
- package/dist/components/types/uhd-viewer/src/viewer/controller.d.ts +218 -0
- package/dist/components/types/uhd-viewer/src/viewer/details.d.ts +81 -0
- package/dist/components/types/uhd-viewer/src/viewer/hierarchy.d.ts +60 -0
- package/dist/components/types/uhd-viewer/src/viewer/mount.d.ts +12 -0
- package/dist/components/types/uhd-viewer/src/viewer/views.d.ts +156 -0
- package/dist/headless/index.d.ts +71 -0
- package/dist/headless/index.js +7425 -0
- package/dist/headless/index.js.map +1 -0
- package/dist/lib/api.d.ts +252 -0
- package/dist/lib/uhd-viewer.css +3 -0
- package/dist/lib/uhd-viewer.d.ts +4 -0
- package/dist/lib/uhd-viewer.js +97469 -0
- package/package.json +110 -4
- package/src/styles/fonts/OFL.txt +93 -0
- package/src/styles/tailwind-theme.css +48 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to **uhd-viewer** (`@deltarobotics/uhd-viewer`) are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.2.0] — 2026-10-25
|
|
10
|
+
|
|
11
|
+
The first public release, and the first on npmjs. The 0.1.x versions were built with the Protoboard stack and never published to npmjs; this section summarises what changed since them.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **Open source.** The viewer is under the Apache License 2.0 (`LICENSE`, `NOTICE`). Contributions are welcome with a Developer Certificate of Origin sign-off and no CLA (`CONTRIBUTING.md`, `DCO`). `TRADEMARKS.md` says how the Protoboard name and logo may be used.
|
|
16
|
+
- **UHD 0.3.0.** The viewer reads UHD 0.3.0 bundles: an export may be a net port, and a module may be marked as a board.
|
|
17
|
+
- **A hierarchy panel** (`ViewerHierarchy`): the whole module tree, docked at the left of the view and kept in step with the canvas. A click selects a module, a double-click opens it, and you can type to filter it. It folds, resizes, works from the keyboard as a tree, and stays within its view's width.
|
|
18
|
+
- **A new inspector layout**: sections with clear headers, and cards for interfaces that expand to show their pins. Alike interfaces share one card ("Motor pads ×4"), power comes before signal, and an exported interface says what it is exported as.
|
|
19
|
+
- **Automatic layout that reads better.** A level of modules is laid out as a block rather than one long row, in reading order. A proposed layout replaces a saved one only when it is clearly better. Layout metrics and the layout itself are available without a browser from `@deltarobotics/uhd-viewer/headless`.
|
|
20
|
+
- **The 3D view borrows placement.** A module with no assembly of its own is shown in the nearest assembly above it, and the view says where the placement comes from.
|
|
21
|
+
- **Canvas controls**: right-drag pans (a right-click without a drag still opens the menu); Space-drag pans from over a module too.
|
|
22
|
+
- **The legend makes way**: on a small view it shrinks to a compact form, then to a toolbar button.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- Labels and headers use bold Kode Mono (SIL Open Font License, shipped with its licence text) in place of the earlier commercial face.
|
|
27
|
+
- Shorter interface text throughout, and an empty level says what to do in one line.
|
|
28
|
+
- A module picked again while it is selected is reported to the host again, so a host's inspector comes back each time.
|
|
29
|
+
- Viewports a host gives after the viewer has started are applied.
|
|
30
|
+
|
|
31
|
+
### Security
|
|
32
|
+
|
|
33
|
+
- `uhd-viewer serve` sends every artifact with a sandboxing content security policy and `X-Content-Type-Options: nosniff`, and an HTML artifact is downloaded rather than shown, so a file in a bundle cannot run script on the viewer's origin.
|
|
34
|
+
|
|
35
|
+
### Packaging
|
|
36
|
+
|
|
37
|
+
- The package is public on npmjs with provenance, released from a tag by `.github/workflows/release.yml`. It carries `LICENSE`, `NOTICE` and the font licence.
|
|
38
|
+
|
|
39
|
+
## 0.1.0 – 0.1.4 — 2026-09-26 to 2026-10-11
|
|
40
|
+
|
|
41
|
+
Built and published with the Protoboard stack only, not on npmjs. In brief: the system diagram (modules, interfaces, links routed orthogonally, harnesses, bundles that open into their conductors, domain, DRC and signal classifications, the pair view, system checks and fault scenarios); boards, nets and enclosures; the 3D view assembled from UHD's mechanical links, with exploded and section views and callout labels; the viewer as a library (`mountViewer`), a React component library with token theming (a VS Code adapter included), and `uhd-viewer serve`; the host message protocol (focus, select, drill, set view, and the events back); marks on modules; isolating a legend entry; artifacts as cards in the inspector; and the select and pan tools with a selection box and keys.
|
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,22 @@
|
|
|
1
|
+
Protoboard Stack: UHD Viewer (@deltarobotics/uhd-viewer)
|
|
2
|
+
Copyright 2026 Delta Robotics, Inc.
|
|
3
|
+
|
|
4
|
+
This product includes software developed at Delta Robotics, Inc.
|
|
5
|
+
(https://deltaroboticsinc.com).
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License").
|
|
8
|
+
See the LICENSE file in the root of this repository for full terms.
|
|
9
|
+
|
|
10
|
+
"Protoboard", the Protoboard logo and the "0" mark are trademarks of
|
|
11
|
+
Delta Robotics, Inc. The License grants no rights to them (section 6);
|
|
12
|
+
see TRADEMARKS.md.
|
|
13
|
+
|
|
14
|
+
The built application and headless bundles (dist/app, dist/headless)
|
|
15
|
+
include third-party packages (React, three.js, React Flow, Radix UI,
|
|
16
|
+
Lucide), each under its own licence, which applies to that code.
|
|
17
|
+
|
|
18
|
+
The stylesheets (src/styles, and the built dist/components and dist/app)
|
|
19
|
+
carry the Kode Mono font, Copyright 2023 The Kode Mono Project Authors
|
|
20
|
+
(https://github.com/isaozler/kode-mono), under the SIL Open Font License
|
|
21
|
+
1.1: src/styles/fonts/OFL.txt. The .woff2 files are the released fonts
|
|
22
|
+
converted to WOFF2, glyphs unchanged.
|
package/README.md
CHANGED
|
@@ -1,3 +1,169 @@
|
|
|
1
|
-
#
|
|
1
|
+
# uhd-viewer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**See a hardware system as a diagram and in 3D, from its UHD description.**
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@deltarobotics/uhd-viewer)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
`@deltarobotics/uhd-viewer` draws systems described in
|
|
9
|
+
[UHD](https://github.com/Delta-Robotics-Inc/OpenUHD) (Universal Hardware
|
|
10
|
+
Description, an open language for multidisciplinary hardware): the modules,
|
|
11
|
+
their interfaces, the links between them and the harnesses that carry them.
|
|
12
|
+
You give it one UHD bundle (a JSON file) and it shows:
|
|
13
|
+
|
|
14
|
+
- **a system diagram**: modules as cards, links routed between their ports, bundles and cables that open into
|
|
15
|
+
their conductors, colours by domain, signal type or check result, and a module opened as a level of its own;
|
|
16
|
+
- **a 3D view**: the system assembled from its mechanical links, with exploded and section views and labels;
|
|
17
|
+
- **boards and enclosures**: a board's nets, pins and drawings;
|
|
18
|
+
- **a hierarchy and an inspector**: the module tree, and the details, interfaces, checks and files of what is selected;
|
|
19
|
+
- **system checks**: supply budgets, bus addresses, interface reuse and the other checks UHD runs, on the
|
|
20
|
+
diagram and in a panel.
|
|
21
|
+
|
|
22
|
+
It knows only UHD and needs no account or service. It is the viewer of the
|
|
23
|
+
[Protoboard stack](https://github.com/Delta-Robotics-Inc/protoboard-stack),
|
|
24
|
+
and works the same in any web page, an editor webview or a test harness.
|
|
25
|
+
|
|
26
|
+

|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install @deltarobotics/uhd-viewer
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Node.js 22 or later for the server; any current browser for the viewer.
|
|
35
|
+
|
|
36
|
+
## Look at a bundle
|
|
37
|
+
|
|
38
|
+
The package has a small server for the built viewer, a bundle and the files
|
|
39
|
+
the bundle references:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx @deltarobotics/uhd-viewer serve path/to/uhd-bundle.json --open
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
It binds to `127.0.0.1:5179`, serves only the files the bundle names as
|
|
46
|
+
artifacts, and re-reads the bundle when it changes, so a rebuild shows on
|
|
47
|
+
reload. `--port`, `--host` and `--host-origin` (to let another page frame it)
|
|
48
|
+
are in the [reference](docs/reference.md#uhd-viewer-serve).
|
|
49
|
+
|
|
50
|
+
A bundle (`uhd.bundle/v0`, defined in UHD) holds a root module, the
|
|
51
|
+
definitions it uses, scenarios, where each definition's files are, and
|
|
52
|
+
display hints. The Protoboard stack writes one with `protoboard build`;
|
|
53
|
+
[`fixtures/imu-pod/uhd-bundle.json`](fixtures/imu-pod/uhd-bundle.json) in this
|
|
54
|
+
repository is a small example.
|
|
55
|
+
|
|
56
|
+
## Embed it
|
|
57
|
+
|
|
58
|
+
### The whole viewer in an element
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
import { mountViewer } from "@deltarobotics/uhd-viewer";
|
|
62
|
+
import "@deltarobotics/uhd-viewer/style.css";
|
|
63
|
+
|
|
64
|
+
const viewer = mountViewer(document.getElementById("viewer")!, {
|
|
65
|
+
bundleUrl: "/uhd-bundle.json", // or bundle: a parsed bundle
|
|
66
|
+
theme: "system", // "dark", "light", "vscode", or a theme of your own
|
|
67
|
+
onSelectionChanged: (selection) => console.log(selection),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
viewer.focus("arm_fl/motor"); // drill to a module, select it and bring it into view
|
|
71
|
+
viewer.setView("3d");
|
|
72
|
+
viewer.update({ bundle: rebuilt }); // after a rebuild
|
|
73
|
+
viewer.unmount();
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The element needs a height; the viewer fills it. This entry bundles React,
|
|
77
|
+
three.js and React Flow, so it works on any page.
|
|
78
|
+
|
|
79
|
+
### React components
|
|
80
|
+
|
|
81
|
+
For a React app with its own layout, `/components` gives the views on their
|
|
82
|
+
own, with React, three.js and React Flow shared with your app:
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
import { ThemeProvider, UhdViewer, DiagramCanvas, ViewerInspector, defaultThemeAdapter } from "@deltarobotics/uhd-viewer/components";
|
|
86
|
+
import "@deltarobotics/uhd-viewer/components.css";
|
|
87
|
+
|
|
88
|
+
export function SystemView() {
|
|
89
|
+
return (
|
|
90
|
+
<ThemeProvider adapter={defaultThemeAdapter("system")}>
|
|
91
|
+
<UhdViewer bundleUrl="/uhd-bundle.json">
|
|
92
|
+
<DiagramCanvas />
|
|
93
|
+
<ViewerInspector />
|
|
94
|
+
</UhdViewer>
|
|
95
|
+
</ThemeProvider>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Every colour is a theme token (`--uhd-*`); `vscodeThemeAdapter()` follows a VS
|
|
101
|
+
Code webview's theme, and `defineTheme` makes your own.
|
|
102
|
+
|
|
103
|
+
### Driving it from a host
|
|
104
|
+
|
|
105
|
+
A host can tell the viewer to focus, select, drill into a level or switch
|
|
106
|
+
view, and hears what the user selects and opens. The messages are the same
|
|
107
|
+
through the handle or, with the viewer in a frame, through `postMessage`:
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
frame.contentWindow.postMessage({ type: "uhd-viewer:focus", path: "arm_fl/motor" }, viewerOrigin);
|
|
111
|
+
window.addEventListener("message", (e) => {
|
|
112
|
+
if (e.data?.type === "uhd-viewer:selectionChanged") show(e.data.selection);
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
A framed viewer listens only to the origins its server allows
|
|
117
|
+
(`serve --host-origin`).
|
|
118
|
+
|
|
119
|
+
### Entry points
|
|
120
|
+
|
|
121
|
+
| Import | What |
|
|
122
|
+
| --- | --- |
|
|
123
|
+
| `@deltarobotics/uhd-viewer` (+ `/style.css`) | `mountViewer`: the whole viewer in an element, everything bundled |
|
|
124
|
+
| `@deltarobotics/uhd-viewer/components` (+ `/components.css`) | The views as React components, the theme provider and adapters, the inspector's details on their own |
|
|
125
|
+
| `@deltarobotics/uhd-viewer/headless` | The layout and its metrics without a browser |
|
|
126
|
+
| `@deltarobotics/uhd-viewer/serve` | `viewerHandler`: the server's routes for a Node server of your own |
|
|
127
|
+
| `@deltarobotics/uhd-viewer/tailwind-theme.css` | The Tailwind 4 theme, for a host's own build |
|
|
128
|
+
| `@deltarobotics/uhd-viewer/app/*` | The built standalone app |
|
|
129
|
+
|
|
130
|
+
The [reference](docs/reference.md) has the rest: every option, the host
|
|
131
|
+
messages, URL parameters, pointer and keys, the 3D view, boards and nets,
|
|
132
|
+
and how the bundle is read.
|
|
133
|
+
|
|
134
|
+
## Develop
|
|
135
|
+
|
|
136
|
+
The viewer builds against UHD's source in a sibling checkout:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
git clone https://github.com/Delta-Robotics-Inc/OpenUHD uhd
|
|
140
|
+
git -C uhd checkout v0.3.0
|
|
141
|
+
git clone https://github.com/Delta-Robotics-Inc/uhd-viewer
|
|
142
|
+
cd uhd-viewer
|
|
143
|
+
npm install
|
|
144
|
+
npm run dev # http://localhost:5178/?bundle=<url of a bundle>
|
|
145
|
+
npm test
|
|
146
|
+
npm run build # type-check, then the app, the library, the components and the headless entry into dist/
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) has the details, and how to sign off
|
|
150
|
+
your commits.
|
|
151
|
+
|
|
152
|
+
## Related
|
|
153
|
+
|
|
154
|
+
- [OpenUHD](https://github.com/Delta-Robotics-Inc/OpenUHD): the description language the viewer reads (`@deltarobotics/uhd`).
|
|
155
|
+
- [Protoboard stack](https://github.com/Delta-Robotics-Inc/protoboard-stack): the command line, VS Code extension and agent tools that build UHD bundles from a project, and show them in this viewer.
|
|
156
|
+
|
|
157
|
+
## Licence
|
|
158
|
+
|
|
159
|
+
Apache License 2.0: see [LICENSE](LICENSE) and [NOTICE](NOTICE). The fonts are
|
|
160
|
+
Kode Mono under the SIL Open Font License 1.1
|
|
161
|
+
([OFL.txt](src/styles/fonts/OFL.txt)). Contributions are welcome under the
|
|
162
|
+
same licence, with a Developer Certificate of Origin sign-off and no CLA
|
|
163
|
+
([CONTRIBUTING.md](CONTRIBUTING.md)). Report security problems privately
|
|
164
|
+
([SECURITY.md](.github/SECURITY.md)).
|
|
165
|
+
|
|
166
|
+
"Protoboard", its logo and the "0" mark are trademarks of Delta Robotics,
|
|
167
|
+
Inc.; the licence does not grant them ([TRADEMARKS.md](TRADEMARKS.md)). The
|
|
168
|
+
hosted Protoboard cloud (the parts library, accounts and cloud services) is a
|
|
169
|
+
separate service with its own terms, not covered by this licence.
|
package/bin/serve.d.mts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declarations for `@deltarobotics/uhd-viewer/serve` (bin/serve.mjs), written
|
|
3
|
+
* by hand: the server is plain JavaScript. test/serve-types.test.ts checks
|
|
4
|
+
* that they match what the module exports.
|
|
5
|
+
*/
|
|
6
|
+
import type { IncomingMessage, Server, ServerResponse } from "node:http";
|
|
7
|
+
|
|
8
|
+
export declare const BUNDLE_SCHEMA: "uhd.bundle/v0";
|
|
9
|
+
/** URL path of the served (rewritten) bundle, relative to the app. */
|
|
10
|
+
export declare const BUNDLE_URL: "uhd-bundle.json";
|
|
11
|
+
export declare const DEFAULT_PORT: number;
|
|
12
|
+
/** The built app (dist/app) next to this file. */
|
|
13
|
+
export declare const APP_DIR: string;
|
|
14
|
+
|
|
15
|
+
export interface BundlePlan {
|
|
16
|
+
/** URL name → base folder. */
|
|
17
|
+
mounts: Map<string, string>;
|
|
18
|
+
/** "<name>/<artifact path>" → file on disk. */
|
|
19
|
+
files: Map<string, string>;
|
|
20
|
+
/** Definition id → mount name or URL. */
|
|
21
|
+
bases: Record<string, string>;
|
|
22
|
+
/** The bundle as served from `origin` (artifact bases rewritten to URLs, everything else as given). */
|
|
23
|
+
rewrite: (origin: string) => { [key: string]: unknown; artifactBases: Record<string, string> };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** What to serve for one parsed `uhd.bundle/v0` read from `bundleFile`. Throws if it is not a bundle. */
|
|
27
|
+
export declare function planBundle(bundle: unknown, bundleFile: string): BundlePlan;
|
|
28
|
+
|
|
29
|
+
/** Headers every artifact response carries: a sandboxing Content-Security-Policy and `X-Content-Type-Options: nosniff`. */
|
|
30
|
+
export declare const ARTIFACT_HEADERS: Readonly<Record<"content-security-policy" | "x-content-type-options", string>>;
|
|
31
|
+
/** The headers an artifact file is sent with: ARTIFACT_HEADERS, and `Content-Disposition: attachment` for an HTML file. */
|
|
32
|
+
export declare function artifactHeaders(file: string): Record<string, string>;
|
|
33
|
+
|
|
34
|
+
/** The app's index.html with `config` injected as `<script type="application/json" id="uhd-viewer-config">`. */
|
|
35
|
+
export declare function injectConfig(html: string, config: { bundleUrl?: string; hostOrigins?: string[] }): string;
|
|
36
|
+
|
|
37
|
+
export interface ViewerHandlerOptions {
|
|
38
|
+
/** The bundle on disk (re-read when it changes). */
|
|
39
|
+
bundleFile: string;
|
|
40
|
+
/** The built app; defaults to APP_DIR. */
|
|
41
|
+
appDir?: string;
|
|
42
|
+
/** Which Host header names to answer; defaults to loopback names only. */
|
|
43
|
+
allowHost?: (hostname: string) => boolean;
|
|
44
|
+
/** Parent origins the app takes host messages from when framed (exact, `scheme://*` or `*`); none by default. */
|
|
45
|
+
hostOrigins?: string[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** A request handler for the viewer, a bundle and its artifacts. It answers every request it is given. */
|
|
49
|
+
export declare function viewerHandler(options: ViewerHandlerOptions): (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
50
|
+
|
|
51
|
+
export interface StartServerOptions {
|
|
52
|
+
bundleFile: string;
|
|
53
|
+
port?: number;
|
|
54
|
+
/** Interface to bind; defaults to 127.0.0.1. */
|
|
55
|
+
host?: string;
|
|
56
|
+
appDir?: string;
|
|
57
|
+
/** Parent origins the app takes host messages from when framed (`--host-origin`). */
|
|
58
|
+
hostOrigins?: string[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Starts the server. Fails before listening if the bundle or the built app is missing. */
|
|
62
|
+
export declare function startServer(options: StartServerOptions): Promise<{ url: string; server: Server; close: () => Promise<void> }>;
|