@blendviewer/vision-scope 0.1.0 → 0.1.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.
package/README.md CHANGED
@@ -35,6 +35,7 @@ await scope.load('https://example.com/path/to/file.glb');
35
35
  Try the live playground: **[vision-scope.blendviewer.com](https://vision-scope.blendviewer.com)**
36
36
 
37
37
  - [PDF Document](https://vision-scope.blendviewer.com/?file=https://oss.blendviewer.com/public/788d77d0-1d49-11ef-861a-b3174c760332/math/9912/9912227v2.pdf)
38
+ - [PPTX Powerpoint](https://vision-scope.blendviewer.com/?file=https://oss.blendviewer.com/public/57f41350-1e82-11ef-b5e1-03b42f41a1d3/examples/SMART-Animals.pptx)
38
39
  - [3D Model (GLB)](https://vision-scope.blendviewer.com/?file=https://oss.blendviewer.com/public/57f41350-1e82-11ef-b5e1-03b42f41a1d3/bee.glb)
39
40
 
40
41
  Share links with `?file=` query parameters, for example:
@@ -53,7 +54,7 @@ Vision Scope comes with built-in renderers for a wide variety of file formats:
53
54
  - **CAD**: `dwg`, `dxf`
54
55
  - **Point Cloud**: `pcd`, `ply`, `las`
55
56
  - **GPU Textures**: `ktx2`, `basis`
56
- - **Documents**: `pdf`, `docx`, `doc`, `pptx`, `ppt`, `txt`, `md`
57
+ - **Documents**: `pdf`, `doc`, `pptx`, `ppt`, `txt`, `md` — `.docx` via Hub plugin `com.blendviewer.vision-docx`
57
58
  - **Tabular / Spreadsheets**: `csv`, `tsv`, `xlsx`, `xls`, `ods`
58
59
  - **Media (Video/Audio)**: `mp4`, `webm`, `avi`, `mov`, `mkv`, `mp3`, `wav`, `flac`, `aac`, `ogg`
59
60
  - **Code & Text**: `js`, `ts`, `jsx`, `tsx`, `py`, `java`, `go`, `rs`, `c`, `cpp`, `html`, `css`, `json`, `yaml`, `xml`, `sql`, `sh`, `dockerfile`, and many more.
@@ -61,35 +62,36 @@ Vision Scope comes with built-in renderers for a wide variety of file formats:
61
62
 
62
63
  ## Scope Extensions (Plugins)
63
64
 
64
- Vision Hub plugins can extend file preview capabilities beyond built-in types. You can export an extension from your plugin module:
65
+ Hub plugins declare handled formats in **`scopeExtension.formats[]`** (one object per extension). Do not add plugin-only types to `FileTypeDetector`.
65
66
 
66
67
  ```javascript
67
68
  export const scopeExtension = {
68
69
  id: 'com.example.my-viewer',
69
- extensions: ['h5', 'hdf5'],
70
+ formats: [
71
+ { ext: 'docx', kind: 'document', subtype: 'word', mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' },
72
+ ],
70
73
  mountPreview(container, context) {
71
- // context.url, context.filename, context.readOnly, etc.
72
- // Initialize your custom viewer here
73
-
74
- return {
75
- destroy() {
76
- // Cleanup resources when the viewer is unmounted
77
- },
78
- };
74
+ return { destroy() {} };
79
75
  },
80
76
  };
81
77
  ```
82
78
 
83
- Register the extension at runtime:
79
+ Register at runtime:
84
80
 
85
81
  ```javascript
86
82
  import { VisionScope } from '@blendviewer/vision-scope';
87
83
 
88
- // Register a static extension object
89
84
  VisionScope.registerExtension(scopeExtension);
90
-
91
- // Or register via dynamic import
92
85
  await VisionScope.registerExtensionModule(() => import('./path/to/plugin.js'));
93
86
  ```
94
87
 
95
- Built-in routing uses a file type detector first; unknown extensions fall through to the extension registry.
88
+ | Field | Required | Purpose |
89
+ |-------|----------|---------|
90
+ | `formats[].ext` | yes | Extension without dot — routing + detection |
91
+ | `formats[].kind` | yes | Semantic category (`document`, `tabular`, `spatial`, …) |
92
+ | `formats[].mime` | no | MIME routing when extension is missing |
93
+ | `formats[].subtype` | no | Display / logging hint |
94
+ | `rendererKey` | no | RendererFactory key; defaults to `scope:<id>` |
95
+ | `mountPreview` | yes* | Preview UI (*or `createRendererClass`) |
96
+
97
+ Built-in types stay in `FileTypeDetector`. Hosts use `detectFileTypeFromExtension()` and `archiveFileIconSvg()` to merge built-in + plugin metadata.