@omrips/viewstl 0.0.0-stage → 2.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +162 -2
  3. package/THIRD-PARTY-NOTICES.txt +1129 -0
  4. package/build/v2/README.md +11 -0
  5. package/build/v2/THIRD-PARTY-NOTICES.txt +1129 -0
  6. package/build/v2/cad/occt-import-js.js +8 -0
  7. package/build/v2/cad/occt-import-js.source.txt +57 -0
  8. package/build/v2/cad/occt-import-js.wasm +0 -0
  9. package/build/v2/cad/prepare-cad.source.txt +112 -0
  10. package/build/v2/chunks/archive-VGS4J4Z7.js +1 -0
  11. package/build/v2/chunks/cad-VY42CMP4.js +1 -0
  12. package/build/v2/chunks/chunk-JH3H3JWA.js +1 -0
  13. package/build/v2/chunks/chunk-JS56KC3I.js +1 -0
  14. package/build/v2/chunks/chunk-R3HNTB5A.js +38 -0
  15. package/build/v2/chunks/chunk-U33KANV7.js +1 -0
  16. package/build/v2/chunks/chunk-ZMK3UZZE.js +1 -0
  17. package/build/v2/chunks/chunk-ZSV4PTIA.js +1 -0
  18. package/build/v2/chunks/export-7OP4ZGGJ.js +29 -0
  19. package/build/v2/chunks/export-cad-QPBT756V.js +13 -0
  20. package/build/v2/chunks/export-zip-EDCWH5PX.js +1 -0
  21. package/build/v2/chunks/print-check-2PU7CSL3.js +1 -0
  22. package/build/v2/chunks/scene-export-KQBS7VRJ.js +1 -0
  23. package/build/v2/chunks/scene-reader-APUJOPUR.js +1 -0
  24. package/build/v2/stl_viewer.min.js +51 -0
  25. package/build/v2/viewstl.cjs +5445 -0
  26. package/build/v2/viewstl.d.cts +446 -0
  27. package/build/v2/viewstl.d.ts +446 -0
  28. package/build/v2/viewstl.js +5426 -0
  29. package/build/v2/viewstl.min.js +51 -0
  30. package/build/v2/viewstl.worker.js +1 -0
  31. package/docs/v2-compatibility.md +204 -0
  32. package/docs/v2-usage.md +723 -0
  33. package/docs/v2-verification.md +423 -0
  34. package/legacy/README.md +43 -0
  35. package/package.json +73 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 omrips
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,163 @@
1
- # Temporary Holding Version
1
+ # ViewSTL v2.00
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **A new JavaScript 3D viewer built on native WebGL 2.**
4
+
5
+ Embed a viewer in your website, open local 3D files, inspect models and save the result. ViewSTL v2 uses its own renderer, with no Three.js runtime required. File parsing and geometry analysis run in workers, with memory limits and cancellation support.
6
+
7
+ [Try the preview](https://preview.viewstl.com/) · [v2 usage and API notes](https://unpkg.com/@omrips/viewstl@2.0.0-rc.1/docs/v2-usage.md) · [Legacy plugin documentation](https://www.viewstl.com/plugin/)
8
+
9
+ > **Preview release: 2.0.0-rc.1.** v2 is a new implementation, with documented differences from v1. Existing versions remain available at their original paths. Read the migration notes before updating an existing integration.
10
+
11
+ ## What v2 can do
12
+
13
+ - **Open models:** binary and ASCII STL, OBJ, 3MF, STEP/STP and IGES/IGS.
14
+ - **Work with scenes:** multiple models, selection, independent position, rotation and scale, colors, camera controls and an infinite grid.
15
+ - **Inspect geometry:** solid, smooth, edges, wireframe, X-ray and face-orientation views, section cuts, dimensions and mesh information.
16
+ - **Save locally:** PNG images and mesh exports in binary STL, OBJ, 3MF, STEP and IGES.
17
+ - **Save and restore scenes:** VSB packages the scene and meshes; VSJ stores scene settings and references to model files.
18
+ - **Check meshes for 3D printing:** topology checks, detailed intersection and volume analysis, issue highlights and optional FDM estimates.
19
+ - **Embed in your own interface:** use the `StlViewer` API, or bind your own markup to the optional `mountViewstlApp` controller.
20
+
21
+ ## Usage
22
+
23
+ Choose a script tag, a browser ES module, or an npm package with your bundler. Each option uses the same viewer API and processes local files on the user's device.
24
+
25
+ ### Script tag
26
+
27
+ Copy the **complete `build/v2/` directory** to your web server, for example as `/viewstl-v2/`. Keep its worker, `chunks/`, `cad/` and notice files together with the viewer.
28
+
29
+ ```html
30
+ <input id="model-file" type="file" accept=".stl,.obj,.3mf,.step,.stp,.iges,.igs">
31
+ <div id="viewer" style="width:100%;height:500px"></div>
32
+
33
+ <script src="/viewstl-v2/viewstl.min.js"></script>
34
+ <script>
35
+ const viewer = new StlViewer(document.getElementById('viewer'), {
36
+ load_error_callback: message => console.error(message)
37
+ });
38
+
39
+ document.getElementById('model-file').addEventListener('change', event => {
40
+ const file = event.target.files[0];
41
+ if (file) viewer.add_model({ local_file: file });
42
+ });
43
+ </script>
44
+ ```
45
+
46
+ Each file selected in this example is added to the viewer. Files are read on the user's device. Serve the page over HTTP(S), and give the viewer container a nonzero height.
47
+
48
+ ### ES modules
49
+
50
+ With the same `build/v2/` directory hosted on your server, use a module script:
51
+
52
+ ```html
53
+ <div id="viewer" style="width:100%;height:500px"></div>
54
+ <script type="module">
55
+ import StlViewer from '/viewstl-v2/viewstl.js';
56
+
57
+ const viewer = new StlViewer(document.getElementById('viewer'), {
58
+ models: [{ id: 0, filename: '/models/part.stl' }]
59
+ });
60
+ </script>
61
+ ```
62
+
63
+ Replace `/models/part.stl` with a model URL you serve. To open a local file instead, call `viewer.add_model({ local_file: file })` with a browser `File`, as in the script-tag example.
64
+
65
+ ### npm and bundlers
66
+
67
+ > **Release candidate:** `2.0.0-rc.1` is the first npm release of ViewSTL v2.00. Candidates use the `next` dist-tag; pin the version below for a repeatable installation.
68
+
69
+ Install the package in your application:
70
+
71
+ ```sh
72
+ npm install @omrips/viewstl@2.0.0-rc.1
73
+ ```
74
+
75
+ Copy the **complete `node_modules/@omrips/viewstl/build/v2/` directory** to your application's static assets. For an application that serves `public/` at its root, use `public/viewstl-v2/`. Keep the worker, `chunks/`, `cad/` and notices together; repeat this copy when updating the package.
76
+
77
+ Add a container to your page:
78
+
79
+ ```html
80
+ <div id="viewer" style="width:100%;height:500px"></div>
81
+ ```
82
+
83
+ Then import the viewer in your application's browser entry point, after the container exists:
84
+
85
+ ```js
86
+ import StlViewer from '@omrips/viewstl';
87
+
88
+ const viewer = new StlViewer(document.getElementById('viewer'), {
89
+ worker_url: '/viewstl-v2/viewstl.worker.js',
90
+ models: [{ id: 0, filename: '/models/part.stl' }],
91
+ load_error_callback: message => console.error(message)
92
+ });
93
+ ```
94
+
95
+ Set `worker_url` to the URL where your application serves the copied worker, and replace `/models/part.stl` with your model URL. The bundler handles the viewer import; the static directory supplies its worker and optional parser assets. Creating a viewer requires a browser DOM and WebGL 2.
96
+
97
+ The distribution includes TypeScript declarations and a CommonJS entry point. The static-assets setup above is verified with Vite 8.3.4 and Webpack 5.112.0. See [usage and packaging](https://unpkg.com/@omrips/viewstl@2.0.0-rc.1/docs/v2-usage.md) for worker factories, callbacks and more examples.
98
+
99
+ ## Formats and saving
100
+
101
+ | Format | Open | Save |
102
+ | --- | --- | --- |
103
+ | STL | Binary and ASCII, including supported color variants | Binary STL |
104
+ | OBJ | Geometry | Geometry; optional colors through an MTL companion |
105
+ | 3MF | Supported mesh, component, unit and color data | Meshes and colors |
106
+ | STEP / STP | CAD surfaces tessellated for viewing | Triangle surfaces |
107
+ | IGES / IGS | CAD surfaces tessellated for viewing | Triangle surfaces |
108
+ | VSB | Packaged ViewSTL scene | Scene settings and meshes in one archive |
109
+ | VSJ | ViewSTL scene with model references | Scene settings and model references |
110
+ | PNG | — | Image of the current view |
111
+
112
+ STL, OBJ, 3MF, STEP and IGES export model geometry. **VSB and VSJ save the scene**, including its models, transforms and viewing settings. VSJ requires access to its referenced model files; VSB carries its mesh data inside the archive.
113
+
114
+ STEP/IGES exports describe the loaded triangle mesh. They do not reconstruct original CAD solids, curves, feature history or assemblies. OBJ import does not load external materials or textures, and 3MF support does not cover every extension. See the [format and export details](https://unpkg.com/@omrips/viewstl@2.0.0-rc.1/docs/v2-usage.md#rendering-and-file-processing).
115
+
116
+ ## Local files and URL imports
117
+
118
+ Local file contents are processed on the user's device. Rendering, mesh checks, model exports and scene saving do not require an upload or a conversion service. Archive and CAD support load additional assets only when needed.
119
+
120
+ Direct URL imports require the remote server to allow browser access through CORS. A host application can configure its own streaming relay for other public URLs. **The relay is a separate server service**, not part of the plugin's JavaScript bundle. The preview website uses such a relay; URL imports pass through that server. See [URL import configuration](https://unpkg.com/@omrips/viewstl@2.0.0-rc.1/docs/v2-usage.md#optional-streaming-url-imports).
121
+
122
+ ## Existing users and previous versions
123
+
124
+ **The legacy plugin remains available in the GitHub repository.** v2 has separate source and build directories, so switching to it is an explicit choice. The npm package contains the v2 distribution; it does not replace legacy download paths.
125
+
126
+ | | Legacy v1 | New v2 |
127
+ | --- | --- | --- |
128
+ | Source | Existing files in `src/` | `src/v2/` |
129
+ | Browser script | `build/stl_viewer.min.js` | `build/v2/viewstl.min.js` |
130
+ | Renderer | Three.js | Native WebGL 2 |
131
+ | Documentation | [viewstl.com/plugin](https://www.viewstl.com/plugin/) | [Package usage and API notes](https://unpkg.com/@omrips/viewstl@2.0.0-rc.1/docs/v2-usage.md) |
132
+
133
+ The familiar `StlViewer` constructor and many public methods are retained. Integrations that access Three.js camera, scene, renderer or model internals need migration. v2 requires WebGL 2 and does not include the legacy WebGL 1 or Canvas fallback. See [API differences and migration notes](https://unpkg.com/@omrips/viewstl@2.0.0-rc.1/docs/v2-usage.md#existing-api-and-intentional-differences).
134
+
135
+ Existing tags and release history are retained. The [legacy archive notes](https://unpkg.com/@omrips/viewstl@2.0.0-rc.1/legacy/README.md) also describe the separate local v1.14 snapshot and its provenance.
136
+
137
+ The documentation link remains **https://www.viewstl.com/plugin/**. It currently documents the legacy plugin; v2 guidance is included in this package while the website documentation is prepared.
138
+
139
+ ## Requirements and current limits
140
+
141
+ - A browser with WebGL 2 and module-worker support; WebAssembly is required for STEP/IGES import.
142
+ - Model capacity depends on geometry complexity and available browser/GPU memory. Configured limits reject files that exceed the budget.
143
+ - Print checks describe the loaded mesh. FDM results are estimates, and checks do not guarantee a successful print. Models are checked separately; assembly overlaps are not evaluated.
144
+ - The preview has automated and desktop Chromium/Edge coverage. Firefox, Safari and physical mobile-device validation remain pending. See [verification and known limits](https://unpkg.com/@omrips/viewstl@2.0.0-rc.1/docs/v2-verification.md).
145
+
146
+ ## Development
147
+
148
+ For contributors working in the source checkout, use Node.js 20 or newer and pnpm. The npm package contains the built viewer and documentation:
149
+
150
+ ```sh
151
+ pnpm install --frozen-lockfile
152
+ pnpm build
153
+ pnpm test
154
+ pnpm check:types
155
+ pnpm check:legacy
156
+ pnpm start
157
+ ```
158
+
159
+ Open `http://127.0.0.1:8772/examples/v2/` for the local demo. The build writes to `build/v2/`; the legacy check verifies that preserved source, builds and archived files remain unchanged.
160
+
161
+ ## License
162
+
163
+ ViewSTL is available under the [MIT license](https://unpkg.com/@omrips/viewstl@2.0.0-rc.1/LICENSE). Optional archive and CAD dependencies have their own licenses and notices; see [third-party notices](https://unpkg.com/@omrips/viewstl@2.0.0-rc.1/THIRD-PARTY-NOTICES.txt).