@ikonai/sdk-ui 1.0.65 → 1.0.67
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/assets/ui-worker-B0-YcaZ_.js +2806 -0
- package/ikon-ui-core.d.ts +22 -0
- package/index.d.ts +2 -1
- package/index.js +1600 -1379
- package/last-snapshot-cache.d.ts +57 -0
- package/package.json +1 -1
- package/ui-store.d.ts +2 -0
- package/assets/ui-worker-BCMvLBtA.js +0 -2784
package/ikon-ui-core.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { IkonClient } from '../../sdk/src/index.ts';
|
|
2
2
|
import { UiStore } from './ui-store';
|
|
3
3
|
import { ParsedUiUpdate } from './ui-types';
|
|
4
|
+
import { LastSnapshotCacheConfig } from './last-snapshot-cache';
|
|
5
|
+
/**
|
|
6
|
+
* Starts fetching the build-time boot snapshot as early as possible, independent of the
|
|
7
|
+
* auth/connect flow. The snapshot is a static CDN asset that needs nothing from the backend, so
|
|
8
|
+
* kicking the request off on mount lets it overlap the anonymous-auth round-trip instead of being
|
|
9
|
+
* serialized after it. `IkonUiCore` consumes the in-flight request when it seeds. Idempotent.
|
|
10
|
+
*/
|
|
11
|
+
export declare function prefetchBootSnapshot(): void;
|
|
4
12
|
export interface IkonUiCoreConfig {
|
|
5
13
|
client?: IkonClient | null;
|
|
6
14
|
threading?: {
|
|
@@ -8,6 +16,13 @@ export interface IkonUiCoreConfig {
|
|
|
8
16
|
flushIntervalMs?: number;
|
|
9
17
|
maxLatencyMs?: number;
|
|
10
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* When enabled, the last rendered UI is persisted to `localStorage` and re-seeded on the next
|
|
21
|
+
* load so the cached tree paints before the WebSocket connects. Opt-in.
|
|
22
|
+
*/
|
|
23
|
+
cache?: {
|
|
24
|
+
enabled: boolean;
|
|
25
|
+
} & LastSnapshotCacheConfig;
|
|
11
26
|
}
|
|
12
27
|
export type IkonUiUpdateListener = (streamId: string, update: ParsedUiUpdate) => void;
|
|
13
28
|
export type IkonUiStreamListener = (streamId: string) => void;
|
|
@@ -31,15 +46,22 @@ export declare class IkonUiCore {
|
|
|
31
46
|
private readonly uiStyleDeleteListeners;
|
|
32
47
|
private readonly uiStreamClearedListeners;
|
|
33
48
|
private readonly useUiWorker;
|
|
49
|
+
private cache;
|
|
50
|
+
private unsubscribeCacheCapture?;
|
|
34
51
|
constructor(config?: IkonUiCoreConfig);
|
|
35
52
|
dispose(): void;
|
|
36
53
|
private clearAllState;
|
|
54
|
+
private enterSnapshotMode;
|
|
37
55
|
subscribeToUiUpdates(listener: IkonUiUpdateListener): () => void;
|
|
38
56
|
subscribeToUiStreamCleared(listener: IkonUiStreamListener): () => void;
|
|
39
57
|
subscribeToUiStyles(listener: UiStyleListener): () => void;
|
|
40
58
|
subscribeToUiStyleDeletes(listener: UiStyleDeleteListener): () => void;
|
|
41
59
|
getUiStyles(): readonly UiStylePayload[];
|
|
42
60
|
private initialize;
|
|
61
|
+
private seedFromCache;
|
|
62
|
+
private seedFromBootSnapshot;
|
|
63
|
+
private loadBootSnapshotAsync;
|
|
64
|
+
private subscribeCacheCapture;
|
|
43
65
|
private startUiWorker;
|
|
44
66
|
private rehydrateStoresForMainThread;
|
|
45
67
|
private forwardMessageToWorker;
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { IkonUiCore, type IkonUiCoreConfig, type IkonUiStreamListener, type IkonUiUpdateListener, type UiStyleListener, type UiStyleDeleteListener, type UiStylePayload } from './ikon-ui-core';
|
|
1
|
+
export { IkonUiCore, prefetchBootSnapshot, type IkonUiCoreConfig, type IkonUiStreamListener, type IkonUiUpdateListener, type UiStyleListener, type UiStyleDeleteListener, type UiStylePayload } from './ikon-ui-core';
|
|
2
2
|
export { UiStore, UiStreamStore, type StreamSnapshot } from './ui-store';
|
|
3
|
+
export { LastSnapshotCache, type LastSnapshotCacheConfig, type CachedUiState } from './last-snapshot-cache';
|
|
3
4
|
export { parseUiUpdate, UiUpdateParseError } from './parse-ui-update';
|
|
4
5
|
export { HandlerCache } from './handler-cache';
|
|
5
6
|
export type { UiStreamSnapshotWire, UiStoreOp, UiStoreOpBatch } from './ui-store-ops';
|