@tutti-os/workspace-file-preview 0.0.190 → 0.0.192

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
@@ -1,26 +1,36 @@
1
1
  # @tutti-os/workspace-file-preview
2
2
 
3
- Shared, host-neutral file preview helpers for workspace features.
3
+ Shared, host-neutral workspace file preview helpers.
4
4
 
5
- This package owns file preview classification, safe byte handling, text
6
- decoding, image mime resolution, and byte-limit helpers. Host adapters remain
7
- responsible for reading bytes from the local workspace.
5
+ **Authority for ownership and boundary decisions:**
6
+ [CONTRACT.md](./CONTRACT.md). Read that file before changing classification,
7
+ loading lifecycle, renderer hooks, or fallback behavior.
8
8
 
9
- It also exposes a small React preview surface for consumers that want the shared
10
- image, text, loading, and readonly rendering shell while keeping host-specific
11
- icons and localized copy outside this package.
9
+ ## Package surface
12
10
 
13
- `createWorkspaceFilePreviewController` owns the shared frontend loading
14
- lifecycle. Consumers inject a byte reader and entry projection; the controller
15
- owns readiness checks, stale-request fencing, cancellation, decoding, canonical
16
- language-neutral state, and media object-URL cleanup. Product controllers keep
17
- selection, editing, persistence, transport, and localized error presentation.
11
+ This package ships:
12
+
13
+ - Flat `previewKind` classification (`directory` / media / text-family /
14
+ Office / `unsupported`), plus a separate coarser `visualKind` for icons
15
+ - `createWorkspaceFilePreviewController` for shared frontend loading lifecycle
16
+ (readiness, cancellation, stale-request fencing, decoding, object-URL cleanup)
17
+ - Built-in React preview shells for `image` / `video` / `text`
18
+ - Host renderer registry (by `previewKind`) and a resolve chain:
19
+ host hook → text degradation → unsupported state
20
+ - `toSurfaceState(controllerState, copy)` to project controller state into the
21
+ React surface
22
+
23
+ Hosts inject read/projection capabilities. Product controllers keep selection,
24
+ editing, persistence, transport wiring, and localized error presentation.
25
+
26
+ Open / reveal / open-with / browser activation are **not** owned here. Those
27
+ helpers live on the host edge (for Tutti:
28
+ `@tutti-os/workspace-file-manager/services`).
18
29
 
19
30
  Sources may provide `canReadEntry` as a capability gate. Returning `false`
20
31
  blocks reads for every non-directory entry, while returning `true` also allows
21
32
  the injected reader to classify file types that local extension detection does
22
33
  not recognize. Omitting the callback keeps the default local classification.
23
34
 
24
- HTML files are shown as source text. Opening or executing an HTML document
25
- belongs to a separate browser activation flow rather than the ordinary file
26
- preview surface.
35
+ HTML files degrade to source text in the built-in surface. Opening or executing
36
+ an HTML document belongs to a separate browser activation flow.