@xeonr/renderer-sdk 1.1.0 → 1.5.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/dist/client.d.ts +79 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +204 -1
- package/dist/client.js.map +1 -1
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/useRendererClient.d.ts +18 -0
- package/dist/react/useRendererClient.d.ts.map +1 -1
- package/dist/react/useRendererClient.js +83 -18
- package/dist/react/useRendererClient.js.map +1 -1
- package/dist/react/useReportFatalError.d.ts +37 -0
- package/dist/react/useReportFatalError.d.ts.map +1 -0
- package/dist/react/useReportFatalError.js +71 -0
- package/dist/react/useReportFatalError.js.map +1 -0
- package/dist/resources.d.ts +25 -0
- package/dist/resources.d.ts.map +1 -0
- package/dist/resources.js +104 -0
- package/dist/resources.js.map +1 -0
- package/dist/types.d.ts +37 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +18 -3
- package/src/client.ts +237 -1
- package/src/react/index.ts +1 -0
- package/src/react/useRendererClient.ts +107 -21
- package/src/react/useReportFatalError.tsx +71 -0
- package/src/resources.ts +119 -0
- package/src/types.ts +37 -0
package/src/types.ts
CHANGED
|
@@ -32,6 +32,25 @@ export interface RendererConfig {
|
|
|
32
32
|
* republished without bumping the archive). Bounded to 64 chars.
|
|
33
33
|
*/
|
|
34
34
|
buildHash?: string;
|
|
35
|
+
/**
|
|
36
|
+
* When true, the SDK holds `uplim:ack` until the renderer explicitly
|
|
37
|
+
* calls `markReady()` from `useRendererClient()`. The host's loading
|
|
38
|
+
* overlay stays visible until that signal arrives, so the user
|
|
39
|
+
* never sees a blank canvas between bridge ack and the renderer's
|
|
40
|
+
* first paint.
|
|
41
|
+
*
|
|
42
|
+
* Leave unset (or `false`) for fast renderers where the gap is
|
|
43
|
+
* invisible — that's the right default and lowest-friction pattern
|
|
44
|
+
* (image, code, plain markdown). Set `true` when the renderer takes
|
|
45
|
+
* perceptible time to settle (large file fetch, video decode,
|
|
46
|
+
* multi-page paginate) and the blank-canvas flash is noticeable.
|
|
47
|
+
*
|
|
48
|
+
* The SDK auto-acks after 30s (configurable via
|
|
49
|
+
* `RendererClientOptions.readyTimeoutMs`) and logs a warning if
|
|
50
|
+
* `markReady()` never fires — so a forgotten signal can't trap
|
|
51
|
+
* users behind the overlay.
|
|
52
|
+
*/
|
|
53
|
+
deferReady?: boolean;
|
|
35
54
|
}
|
|
36
55
|
|
|
37
56
|
export type RendererPermission =
|
|
@@ -116,4 +135,22 @@ export interface InitPayload {
|
|
|
116
135
|
config: RendererConfig;
|
|
117
136
|
/** Initial hash path to navigate to, derived from the host URL fragment. */
|
|
118
137
|
initialPath?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Pre-loaded resource snapshot the host already had on hand when it
|
|
140
|
+
* mounted the iframe — typically the `Upload` proto (in its JSON
|
|
141
|
+
* encoding) for upload-scoped renderers, or `Folder` for folder
|
|
142
|
+
* scopes. Renderers can consume this directly to avoid an extra
|
|
143
|
+
* GetUpload / GetFolder round trip on first paint.
|
|
144
|
+
*
|
|
145
|
+
* Shape is intentionally loose (`unknown`) because the SDK is
|
|
146
|
+
* deliberately decoupled from the @xeonr/uploads-protocol types —
|
|
147
|
+
* renderers cast to the proto JSON type (e.g. `UploadJson`) on use.
|
|
148
|
+
* Treat as advisory: if absent or stale, fall back to a fresh fetch.
|
|
149
|
+
*
|
|
150
|
+
* Stays in sync via the existing `resource_url`-style fetches that
|
|
151
|
+
* the renderer triggers when the host posts an updated init (e.g.
|
|
152
|
+
* after edit / replace flows). For now hosts only populate the
|
|
153
|
+
* field for upload-typed scopes; future hosts may extend.
|
|
154
|
+
*/
|
|
155
|
+
resource?: unknown;
|
|
119
156
|
}
|