@alleninstitute/vis-core 0.0.6
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/LICENSE.md +11 -0
- package/README.md +8 -0
- package/dist/main.js +1426 -0
- package/dist/main.js.map +1 -0
- package/dist/module.js +1271 -0
- package/dist/module.js.map +1 -0
- package/dist/types.d.ts +435 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +63 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import { box2D, vec2, vec4, vec3 } from "@alleninstitute/vis-geometry";
|
|
2
|
+
import REGL from "regl";
|
|
3
|
+
type RecordKey = string | number | symbol;
|
|
4
|
+
interface AsyncCache<SemanticKey extends RecordKey, CacheKey extends RecordKey, D> {
|
|
5
|
+
isCached(k: CacheKey): boolean;
|
|
6
|
+
getCachedUNSAFE(k: CacheKey): D | undefined;
|
|
7
|
+
cacheAndUse(workingSet: Record<SemanticKey, () => Promise<D>>, use: (items: Record<SemanticKey, D>) => void, cacheKey: (semantic: SemanticKey) => CacheKey): cancelFn | undefined;
|
|
8
|
+
}
|
|
9
|
+
type cancelFn = () => void;
|
|
10
|
+
/**
|
|
11
|
+
* `AsyncDataCache` asynchronous data cache, useful for minimizing network requests by caching the results of
|
|
12
|
+
* a network request and returning the cached result if the request has already been made previously
|
|
13
|
+
* for a given key.
|
|
14
|
+
*
|
|
15
|
+
* It is generalizable over any type of data.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* const getMyData = ()=>fetch('https://example.com/data.json');
|
|
19
|
+
* myCache.cache('myKey', getMyData).then((data)=>{console.log('its here now (and we cached it) ', data)});
|
|
20
|
+
* }
|
|
21
|
+
|
|
22
|
+
*/
|
|
23
|
+
export class AsyncDataCache<SemanticKey extends RecordKey, CacheKey extends RecordKey, D> implements AsyncCache<SemanticKey, CacheKey, D> {
|
|
24
|
+
/**
|
|
25
|
+
* the intended use of this cache is to store resources used for rendering. Because the specific contents are generic, a simple interface must be provided
|
|
26
|
+
* to support LRU cache eviction
|
|
27
|
+
* occasionally, it can be necessary to manage these resources more explicitly (see https://stackoverflow.com/a/31250301 for a great example)
|
|
28
|
+
* @param destroy a function which safely releases the resources owned by an entry in this cache - for normal garbage-collected objects, a no-op function will suffice.
|
|
29
|
+
* @param size a function which returns the size of a resource - this is used only in relation to the cacheLimit
|
|
30
|
+
* @param cacheLimit a limit (in whatever units are returned by the size() parameter) to place on cache contents
|
|
31
|
+
* note that this limit is not a hard limit - old entries are evicted when new data is fetched, but the limit may be exceeded occasionally
|
|
32
|
+
* a reasonable implementation may simply return 1 for size, and a desired occupancy count for the limit
|
|
33
|
+
*/
|
|
34
|
+
constructor(destroy: (data: D) => void, size: (data: D) => number, cacheLimit: number);
|
|
35
|
+
/**
|
|
36
|
+
* `isCached` checks if the entry is in the cache with a resolved promise.
|
|
37
|
+
*
|
|
38
|
+
* @param key The entry key to check for in the cache
|
|
39
|
+
* @returns True if the entry in the cache has been resolved, false if there is no entry with that key or the promise is still pending
|
|
40
|
+
*/
|
|
41
|
+
isCached(key: CacheKey): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* `areKeysAllCached` checks if all the keys provided are in the cache with resolved promises.
|
|
44
|
+
*
|
|
45
|
+
* Useful for checking if all the data needed for a particular operation is already in the cache.
|
|
46
|
+
*
|
|
47
|
+
* @param cacheKeys A list of keys to check for in the cache
|
|
48
|
+
* @returns True if all keys are cached, false if any are not in the cache
|
|
49
|
+
*/
|
|
50
|
+
areKeysAllCached(cacheKeys: readonly CacheKey[]): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated to alert (external) users to avoid calling this!
|
|
53
|
+
* `getCachedUNSAFE` gets an entry from the cache for the given key (if the promise is resolved).
|
|
54
|
+
* because of how eviction works - this method should be considered unsafe! consider the following
|
|
55
|
+
* @example
|
|
56
|
+
* const entry = cache.getCachedUnsafe('whatever')
|
|
57
|
+
* const otherStuff = await fetch('....')
|
|
58
|
+
* ... more code
|
|
59
|
+
* doSomethingCool(entry, otherStuff)
|
|
60
|
+
*
|
|
61
|
+
* by the time the caller gets to the doSomethingCool call, the resources bound to the cache entry
|
|
62
|
+
* may have been disposed!
|
|
63
|
+
* do note that if you use a cache-entry synchronously (no awaits!) after requesting it, you're likely to not
|
|
64
|
+
* encounter any issues, however its a much more robust practice to simply refactor like so:
|
|
65
|
+
*
|
|
66
|
+
* const otherStuff = await fetch('...')
|
|
67
|
+
* cache.cacheAndUse({...}, (...args)=>doSomethingCool(otherStuff, ..args), ...)
|
|
68
|
+
*
|
|
69
|
+
* @param key Entry key to look up in the cache
|
|
70
|
+
* @returns The entry (D) if it is present, or undefined if it is not
|
|
71
|
+
*/
|
|
72
|
+
getCachedUNSAFE(key: CacheKey): D | undefined;
|
|
73
|
+
getNumPendingTasks(): number;
|
|
74
|
+
cacheAndUse(workingSet: Record<SemanticKey, (signal: AbortSignal) => Promise<D>>, use: (items: Record<SemanticKey, D>) => void, toCacheKey: (semanticKey: SemanticKey) => CacheKey, taskFinished?: () => void): cancelFn | undefined;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* FrameLifecycle type that defines the functions a user can call to interact with the frame lifecycle.
|
|
78
|
+
*
|
|
79
|
+
* Currently only supports `cancelFrame` to allow the user to cancel the frame on an ad-hoc basis.
|
|
80
|
+
*/
|
|
81
|
+
type FrameLifecycle = {
|
|
82
|
+
cancelFrame: (reason?: string) => void;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* NormalStatus type that defines the possible non-error statuses for a frame.
|
|
86
|
+
*
|
|
87
|
+
* `begun` - The frame has started running
|
|
88
|
+
*
|
|
89
|
+
* `finished` - The frame has finished running
|
|
90
|
+
*
|
|
91
|
+
* `cancelled` - The frame was cancelled by the user
|
|
92
|
+
*
|
|
93
|
+
* `finished_synchronously` - The frame finished synchronously
|
|
94
|
+
*
|
|
95
|
+
* `progress` - The frame is still running and has not finished
|
|
96
|
+
*/
|
|
97
|
+
type NormalStatus = 'begun' | 'finished' | 'cancelled' | 'finished_synchronously' | 'progress';
|
|
98
|
+
type RenderCallback = (event: {
|
|
99
|
+
status: NormalStatus;
|
|
100
|
+
} | {
|
|
101
|
+
status: 'error';
|
|
102
|
+
error: unknown;
|
|
103
|
+
}) => void;
|
|
104
|
+
/**
|
|
105
|
+
* `beingLongRunningFrame` starts a long-running frame that will render a list of items asynchronously based on
|
|
106
|
+
* the provided data, settings, and rendering functions.
|
|
107
|
+
*
|
|
108
|
+
* The frame will run until all items have been rendered, or until the user cancels the frame. It will update the
|
|
109
|
+
* provided cache so that the data is available for other frames that may be running. This function is safe to call
|
|
110
|
+
* multiple times in different areas of your code, as it will complete quickly if/when all the data is already cached and available.
|
|
111
|
+
*
|
|
112
|
+
* You can listen for the status of the frame, allowing you to make decisions based on the progress of the frame.
|
|
113
|
+
*
|
|
114
|
+
* In addition, you can cancel the frame at any time, which will stop the frame from running and prevent any further
|
|
115
|
+
* rendering or data fetching from occurring.
|
|
116
|
+
*
|
|
117
|
+
* @deprecated consider using beginFrame instead
|
|
118
|
+
* @param maximumInflightAsyncTasks The maximum number of async tasks to run at once.
|
|
119
|
+
* @param queueProcessingIntervalMS The length of time to wait between processing the queue in milliseconds.
|
|
120
|
+
* @param items An array of generic items to render
|
|
121
|
+
* @param mutableCache The asynchronous cache used to store the data
|
|
122
|
+
* @param settings Flexible object of settings related to the items that are being rendered
|
|
123
|
+
* @param requestsForItem a function which returns a mapping of "columns" to async functions that would fetch the column
|
|
124
|
+
* @param render The main render function that will be called once all data is available
|
|
125
|
+
* @param lifecycleCallback Callback function so they user can be notified of the status of the frame
|
|
126
|
+
* @param cacheKeyForRequest A function for generating a cache key for a given request key, item, and settings. Defaults to the request key if not provided.
|
|
127
|
+
* @param queueTimeBudgetMS the maximum ammount of time (milliseconds) to spend rendering before yeilding to allow other work to run - rendering will resume next frame (@param queueProcessingIntervalMS)
|
|
128
|
+
* @returns A FrameLifecycle object with a cancelFrame function to allow users to cancel the frame when necessary
|
|
129
|
+
*/
|
|
130
|
+
export function beginLongRunningFrame<Column, Item, Settings>(maximumInflightAsyncTasks: number, queueProcessingIntervalMS: number, items: Item[], mutableCache: AsyncDataCache<string, string, Column>, settings: Settings, requestsForItem: (item: Item, settings: Settings, signal?: AbortSignal) => Record<string, () => Promise<Column>>, render: (item: Item, settings: Settings, columns: Record<string, Column | undefined>) => void, lifecycleCallback: RenderCallback, cacheKeyForRequest?: (requestKey: string, item: Item, settings: Settings) => string, queueTimeBudgetMS?: number): FrameLifecycle;
|
|
131
|
+
export type BufferPair<T> = {
|
|
132
|
+
writeTo: T;
|
|
133
|
+
readFrom: T;
|
|
134
|
+
};
|
|
135
|
+
export function swapBuffers<T>(doubleBuffer: BufferPair<T>): {
|
|
136
|
+
readFrom: T;
|
|
137
|
+
writeTo: T;
|
|
138
|
+
};
|
|
139
|
+
type RenderFn<Data, Settings> = (target: REGL.Framebuffer2D | null, thing: Readonly<Data>, settings: Readonly<Settings>) => FrameLifecycle;
|
|
140
|
+
type Image = {
|
|
141
|
+
resolution: vec2;
|
|
142
|
+
texture: REGL.Framebuffer2D;
|
|
143
|
+
bounds: box2D | undefined;
|
|
144
|
+
};
|
|
145
|
+
type ImageRendererProps = {
|
|
146
|
+
target: REGL.Framebuffer2D | null;
|
|
147
|
+
box: vec4;
|
|
148
|
+
view: vec4;
|
|
149
|
+
viewport: REGL.BoundingBox;
|
|
150
|
+
img: REGL.Texture2D | REGL.Framebuffer2D;
|
|
151
|
+
};
|
|
152
|
+
type ImageRenderer = (props: ImageRendererProps) => void;
|
|
153
|
+
type RequiredSettings = {
|
|
154
|
+
camera: {
|
|
155
|
+
view: box2D;
|
|
156
|
+
};
|
|
157
|
+
callback: RenderCallback;
|
|
158
|
+
};
|
|
159
|
+
export class ReglLayer2D<Renderable, RenderSettings extends RequiredSettings> {
|
|
160
|
+
constructor(regl: REGL.Regl, imgRenderer: ImageRenderer, renderFn: RenderFn<Renderable, RenderSettings & RequiredSettings>, resolution: vec2);
|
|
161
|
+
destroy(): void;
|
|
162
|
+
renderingInProgress(): boolean;
|
|
163
|
+
getRenderResults(stage: 'prev' | 'cur'): Image;
|
|
164
|
+
onChange(props: {
|
|
165
|
+
readonly data: Readonly<Renderable>;
|
|
166
|
+
readonly settings: Readonly<RenderSettings>;
|
|
167
|
+
}, cancel?: boolean): void;
|
|
168
|
+
}
|
|
169
|
+
export class VisError extends Error {
|
|
170
|
+
}
|
|
171
|
+
declare const RESOURCE_TYPE_S3: "s3";
|
|
172
|
+
declare const RESOURCE_TYPE_HTTPS: "https";
|
|
173
|
+
export type HttpsResource = {
|
|
174
|
+
type: typeof RESOURCE_TYPE_HTTPS;
|
|
175
|
+
url: string;
|
|
176
|
+
};
|
|
177
|
+
export type S3Resource = {
|
|
178
|
+
type: typeof RESOURCE_TYPE_S3;
|
|
179
|
+
url: string;
|
|
180
|
+
region: string;
|
|
181
|
+
};
|
|
182
|
+
export function createHttpsResource(url: string): {
|
|
183
|
+
type: "https";
|
|
184
|
+
url: string;
|
|
185
|
+
};
|
|
186
|
+
export function createS3Resource(url: string, region: string): S3Resource;
|
|
187
|
+
export function isS3Resource(res: WebResource): res is S3Resource;
|
|
188
|
+
export function isHttpsResource(res: WebResource): res is HttpsResource;
|
|
189
|
+
export type WebResource = HttpsResource | S3Resource;
|
|
190
|
+
export function getResourceUrl(res: WebResource): string;
|
|
191
|
+
type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'none';
|
|
192
|
+
export class Logger {
|
|
193
|
+
constructor(name: string, level?: LogLevel);
|
|
194
|
+
setLevel(level: LogLevel): void;
|
|
195
|
+
debug(message: string, ...optionalParams: unknown[]): void;
|
|
196
|
+
dir(obj: unknown, ...optionalParams: unknown[]): void;
|
|
197
|
+
info(message: string, ...optionalParams: unknown[]): void;
|
|
198
|
+
warn(message: string, ...optionalParams: unknown[]): void;
|
|
199
|
+
error(message: string, ...optionalParams: unknown[]): void;
|
|
200
|
+
}
|
|
201
|
+
export const logger: Logger;
|
|
202
|
+
/**
|
|
203
|
+
* Converts a color hash string to a vec3 RGB color vector.
|
|
204
|
+
*
|
|
205
|
+
* @param colorHashStr A string representing a color in hex format, e.g., '#f00' or 'ff0000'.
|
|
206
|
+
* @param normalized A boolean indicating whether to normalize the color values to the range [0, 1]. Defaults to true.
|
|
207
|
+
* @returns A vec3 array representing the RGB color vector. If the input is invalid, returns [0, 0, 0].
|
|
208
|
+
*/
|
|
209
|
+
export function makeRGBColorVector(colorHashStr: string, normalized?: boolean): vec3;
|
|
210
|
+
/**
|
|
211
|
+
* Converts a color hash string to a vec4 RGBA color vector.
|
|
212
|
+
*
|
|
213
|
+
* @param colorHashStr A string representing a color in hex format, e.g., '#f00f' or 'ff0000ff'.
|
|
214
|
+
* @param normalized A boolean indicating whether to normalize the color values to the range [0, 1]. Defaults to true.
|
|
215
|
+
* @returns A vec3 array representing the RGB color vector. If the input is invalid, returns [0, 0, 0, 0].
|
|
216
|
+
*/
|
|
217
|
+
export function makeRGBAColorVector(colorHashStr: string, normalized?: boolean): vec4;
|
|
218
|
+
export type CachedTexture = {
|
|
219
|
+
texture: REGL.Texture2D;
|
|
220
|
+
bytes: number;
|
|
221
|
+
type: 'texture';
|
|
222
|
+
};
|
|
223
|
+
export type CachedVertexBuffer = {
|
|
224
|
+
buffer: REGL.Buffer;
|
|
225
|
+
bytes: number;
|
|
226
|
+
type: 'buffer';
|
|
227
|
+
};
|
|
228
|
+
export type ReglCacheEntry = CachedTexture | CachedVertexBuffer;
|
|
229
|
+
export type Renderer<Dataset, Item, Settings, GpuData extends Record<string, ReglCacheEntry>> = {
|
|
230
|
+
/**
|
|
231
|
+
* a function which returns items from the given dataset - this is the place to express spatial indexing
|
|
232
|
+
* or any other filtering that may be appropriate
|
|
233
|
+
* @param data the dataset to pull items from
|
|
234
|
+
* @param settings the settings that determine what items are appropriate
|
|
235
|
+
* @returns a list of the requested items, whatever they may be
|
|
236
|
+
*/
|
|
237
|
+
getVisibleItems: (data: Dataset, settings: Settings) => Array<Item>;
|
|
238
|
+
/**
|
|
239
|
+
* fetch raw, expensive-to-load content (an "Item" is a placeholder for that content)
|
|
240
|
+
* @param item An item to fetch content for
|
|
241
|
+
* @param dataset the dataset which owns the given item
|
|
242
|
+
* @param settings
|
|
243
|
+
* @param signal an AbortSignal that allows the fetching of content to be cancelled
|
|
244
|
+
* @returns a map of meaningful names (eg. position, color, amplitude, etc) to functions that promise raw content, like pixels or other raw, renderable information.
|
|
245
|
+
* expect that the functions returned in this way have closures over the other arguments to this function -
|
|
246
|
+
* that is to say, DONT mutate them (make them Readonly if possible)
|
|
247
|
+
*/
|
|
248
|
+
fetchItemContent: (item: Item, dataset: Dataset, settings: Settings) => Record<string, (signal: AbortSignal) => Promise<ReglCacheEntry>>;
|
|
249
|
+
/**
|
|
250
|
+
*
|
|
251
|
+
* @param cacheData the results of fetching all the content for an Item
|
|
252
|
+
* @returns true if the content matches the expectations of our rendering function
|
|
253
|
+
*/
|
|
254
|
+
isPrepared: (cacheData: Record<string, ReglCacheEntry | undefined>) => cacheData is GpuData;
|
|
255
|
+
/**
|
|
256
|
+
* actually render the content of an item
|
|
257
|
+
* @param target REGL framebuffer to render to (null is the canvas to which regl is bound - it is shared and mutable!)
|
|
258
|
+
* @param item the item describing the content to render
|
|
259
|
+
* @param data the dataset which owns the item
|
|
260
|
+
* @param settings the configuration of the current rendering task
|
|
261
|
+
* @param gpuData the data as fetched and uploaded to the GPU @see fetchItemContent and validated by @see isPrepared
|
|
262
|
+
* @returns void - this function will render (mutate!) the content (pixels!) of the target
|
|
263
|
+
*/
|
|
264
|
+
renderItem: (target: REGL.Framebuffer2D | null, item: Item, data: Dataset, settings: Settings, gpuData: GpuData) => void;
|
|
265
|
+
/**
|
|
266
|
+
* compute a unique (but please not random!) string that the cache system can use to identify the content
|
|
267
|
+
* associated with this {item, settings, data}
|
|
268
|
+
* @param item the item we're caching the data for
|
|
269
|
+
* @param requestKey a key of gpuData (TODO: make this fact official via Typescript if possible)
|
|
270
|
+
* @param data the dataset that owns the given item
|
|
271
|
+
* @param settings the configuration of the current rendering task
|
|
272
|
+
* @returns a string, suitable for use in a cache
|
|
273
|
+
*/
|
|
274
|
+
cacheKey: (item: Item, requestKey: string, data: Dataset, settings: Settings) => string;
|
|
275
|
+
/**
|
|
276
|
+
* in some cases, rendering may rely on non-item-specific rendering resources (lookup tables, buffers, etc)
|
|
277
|
+
* this function is the place to release those
|
|
278
|
+
* @param regl the regl context (the same that was used to create this renderer)
|
|
279
|
+
* @returns
|
|
280
|
+
*/
|
|
281
|
+
destroy: (regl: REGL.Regl) => void;
|
|
282
|
+
};
|
|
283
|
+
type _FrameLifecycle1 = {
|
|
284
|
+
cancelFrame: (reason?: string) => void;
|
|
285
|
+
};
|
|
286
|
+
type FrameBegin = {
|
|
287
|
+
status: 'begin';
|
|
288
|
+
};
|
|
289
|
+
type FrameProgress<Dataset, Item> = {
|
|
290
|
+
status: 'progress';
|
|
291
|
+
dataset: Dataset;
|
|
292
|
+
renderedItems: ReadonlyArray<Item>;
|
|
293
|
+
};
|
|
294
|
+
type FrameCancelled = {
|
|
295
|
+
status: 'cancelled';
|
|
296
|
+
};
|
|
297
|
+
type FrameFinished = {
|
|
298
|
+
status: 'finished';
|
|
299
|
+
};
|
|
300
|
+
type FrameError = {
|
|
301
|
+
status: 'error';
|
|
302
|
+
error: unknown;
|
|
303
|
+
};
|
|
304
|
+
type AsyncFrameEvent<Dataset, Item> = FrameBegin | FrameProgress<Dataset, Item> | FrameFinished | FrameCancelled | FrameError;
|
|
305
|
+
type _RenderCallback1<Dataset, Item> = (event: AsyncFrameEvent<Dataset, Item>) => void;
|
|
306
|
+
export type RenderFrameConfig<Dataset, Item, Settings, RqKey extends string, CacheKey extends string, CacheEntryType, GpuData extends Record<RqKey, CacheEntryType>> = {
|
|
307
|
+
maximumInflightAsyncTasks: number;
|
|
308
|
+
queueProcessingIntervalMS: number;
|
|
309
|
+
queueTimeBudgetMS: number;
|
|
310
|
+
items: Item[];
|
|
311
|
+
mutableCache: AsyncDataCache<RqKey, CacheKey, CacheEntryType>;
|
|
312
|
+
dataset: Dataset;
|
|
313
|
+
settings: Settings;
|
|
314
|
+
requestsForItem: (item: Item, dataset: Dataset, settings: Settings, signal?: AbortSignal) => Record<RqKey, (signal: AbortSignal) => Promise<CacheEntryType>>;
|
|
315
|
+
lifecycleCallback: _RenderCallback1<Dataset, Item>;
|
|
316
|
+
cacheKeyForRequest: (item: Item, requestKey: RqKey, dataset: Dataset, settings: Settings) => CacheKey;
|
|
317
|
+
isPrepared: (cacheData: Record<RqKey, CacheEntryType | undefined>) => cacheData is GpuData;
|
|
318
|
+
renderItem: (item: Item, dataset: Dataset, settings: Settings, gpuData: GpuData) => void;
|
|
319
|
+
};
|
|
320
|
+
export function beginFrame<Dataset, Item, Settings, RqKey extends string, CacheKey extends string, CacheEntryType, GpuData extends Record<RqKey, CacheEntryType>>(config: RenderFrameConfig<Dataset, Item, Settings, RqKey, CacheKey, CacheEntryType, GpuData>): _FrameLifecycle1;
|
|
321
|
+
type QueueOptions = {
|
|
322
|
+
queueProcessingIntervalMS?: number;
|
|
323
|
+
maximumInflightAsyncTasks?: number;
|
|
324
|
+
queueTimeBudgetMS?: number;
|
|
325
|
+
};
|
|
326
|
+
export function buildAsyncRenderer<Dataset, Item, Settings, SemanticKey extends string, CacheKeyType extends string, GpuData extends Record<SemanticKey, ReglCacheEntry>>(renderer: Renderer<Dataset, Item, Settings, GpuData>, queueOptions?: QueueOptions): (data: Dataset, settings: Settings, callback: _RenderCallback1<Dataset, Item>, target: REGL.Framebuffer2D | null, cache: AsyncDataCache<SemanticKey, CacheKeyType, ReglCacheEntry>) => _FrameLifecycle1;
|
|
327
|
+
type ServerActions = {
|
|
328
|
+
copyToClient: (composite: Compositor) => void;
|
|
329
|
+
};
|
|
330
|
+
type Compositor = (ctx: CanvasRenderingContext2D, glImage: ImageData) => void;
|
|
331
|
+
type RenderEvent<D, I> = AsyncFrameEvent<D, I> & {
|
|
332
|
+
target: REGL.Framebuffer2D | null;
|
|
333
|
+
server: ServerActions;
|
|
334
|
+
};
|
|
335
|
+
type ServerCallback<D, I> = (event: RenderEvent<D, I>) => void;
|
|
336
|
+
type RenderFrameFn<D, I> = (target: REGL.Framebuffer2D | null, cache: AsyncDataCache<string, string, ReglCacheEntry>, callback: _RenderCallback1<D, I>) => FrameLifecycle | null;
|
|
337
|
+
type Client = HTMLCanvasElement;
|
|
338
|
+
export class RenderServer {
|
|
339
|
+
regl: REGL.Regl;
|
|
340
|
+
cache: AsyncDataCache<string, string, ReglCacheEntry>;
|
|
341
|
+
constructor(maxSize: vec2, extensions: string[], cacheByteLimit?: number);
|
|
342
|
+
destroyClient(client: Client): void;
|
|
343
|
+
beginRendering<D, I>(renderFn: RenderFrameFn<D, I>, callback: ServerCallback<D, I>, client: Client): void;
|
|
344
|
+
}
|
|
345
|
+
type CacheKey = string;
|
|
346
|
+
export interface Cacheable {
|
|
347
|
+
destroy?: () => void;
|
|
348
|
+
sizeInBytes: () => number;
|
|
349
|
+
}
|
|
350
|
+
interface Store<K extends {}, V> {
|
|
351
|
+
set(k: K, v: V): void;
|
|
352
|
+
get(k: K): V | undefined;
|
|
353
|
+
has(k: K): boolean;
|
|
354
|
+
delete(k: K): void;
|
|
355
|
+
keys(): Iterable<K>;
|
|
356
|
+
values(): Iterable<V>;
|
|
357
|
+
}
|
|
358
|
+
type ScoreFn = (k: CacheKey) => number;
|
|
359
|
+
type FetchResult = {
|
|
360
|
+
status: 'success';
|
|
361
|
+
} | {
|
|
362
|
+
status: 'failure';
|
|
363
|
+
reason: unknown;
|
|
364
|
+
};
|
|
365
|
+
export class PriorityCache<T extends Cacheable> {
|
|
366
|
+
#private;
|
|
367
|
+
constructor(store: Store<CacheKey, T>, score: ScoreFn, limitInBytes: number);
|
|
368
|
+
protected get score(): ScoreFn;
|
|
369
|
+
put(key: CacheKey, item: T): boolean;
|
|
370
|
+
reprioritize(score?: ScoreFn | undefined): void;
|
|
371
|
+
get(key: CacheKey): T | undefined;
|
|
372
|
+
has(key: CacheKey): boolean;
|
|
373
|
+
cached(key: CacheKey): boolean;
|
|
374
|
+
isFull(): boolean;
|
|
375
|
+
}
|
|
376
|
+
export class AsyncPriorityCache<T extends Cacheable> extends PriorityCache<T> {
|
|
377
|
+
#private;
|
|
378
|
+
constructor(store: Store<CacheKey, T>, score: (k: CacheKey) => number, limitInBytes: number, maxFetches: number, onDataArrived?: (key: CacheKey, result: FetchResult) => void);
|
|
379
|
+
enqueue(key: CacheKey, fetcher: (abort: AbortSignal) => Promise<T>): boolean;
|
|
380
|
+
reprioritize(score?: ScoreFn | undefined): void;
|
|
381
|
+
pending(key: CacheKey): boolean;
|
|
382
|
+
cachedOrPending(key: CacheKey): boolean;
|
|
383
|
+
}
|
|
384
|
+
type CacheInterface<Item, ItemContent extends Record<string, Cacheable>> = {
|
|
385
|
+
get: (k: Item) => ItemContent | undefined;
|
|
386
|
+
has: (k: Item) => boolean;
|
|
387
|
+
unsubscribeFromCache: () => void;
|
|
388
|
+
setPriorities: (low: Iterable<Item>, high: Iterable<Item>) => void;
|
|
389
|
+
};
|
|
390
|
+
type ClientSpec<Item, ItemContent extends Record<string, Cacheable>> = {
|
|
391
|
+
isValue: (v: Record<string, Cacheable | undefined>) => v is ItemContent;
|
|
392
|
+
cacheKeys: (item: Item) => {
|
|
393
|
+
[k in keyof ItemContent]: string;
|
|
394
|
+
};
|
|
395
|
+
onDataArrived?: (cacheKey: string, result: FetchResult) => void;
|
|
396
|
+
fetch: (item: Item) => {
|
|
397
|
+
[k in keyof ItemContent]: (abort: AbortSignal) => Promise<Cacheable>;
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
export class SharedPriorityCache {
|
|
401
|
+
constructor(store: Store<string, Cacheable>, limitInBytes: number, max_concurrent_fetches?: number);
|
|
402
|
+
registerClient<Item, ItemContent extends Record<string, Cacheable>>(spec: ClientSpec<Item, ItemContent>): CacheInterface<Item, ItemContent>;
|
|
403
|
+
}
|
|
404
|
+
export type WorkerMessage = {
|
|
405
|
+
type: string;
|
|
406
|
+
};
|
|
407
|
+
export type WorkerMessageWithId = WorkerMessage & {
|
|
408
|
+
id: string;
|
|
409
|
+
};
|
|
410
|
+
export function isWorkerMessage(val: unknown): val is WorkerMessage;
|
|
411
|
+
export function isWorkerMessageWithId(val: unknown): val is WorkerMessageWithId;
|
|
412
|
+
export const HEARTBEAT_RATE_MS = 500;
|
|
413
|
+
type MessageValidator<T> = TypeGuardFunction<unknown, T>;
|
|
414
|
+
type TypeGuardFunction<T, S extends T> = (value: T) => value is S;
|
|
415
|
+
type WorkerInstantiationCallback = () => Worker;
|
|
416
|
+
export type WorkerInit = URL | WorkerInstantiationCallback;
|
|
417
|
+
enum WorkerStatus {
|
|
418
|
+
Available = "Available",
|
|
419
|
+
Unresponsive = "Unresponsive"
|
|
420
|
+
}
|
|
421
|
+
export class WorkerPool {
|
|
422
|
+
#private;
|
|
423
|
+
constructor(size: number, workerInit: WorkerInit);
|
|
424
|
+
/**
|
|
425
|
+
* Warning - nothing in this class should be considered useable after
|
|
426
|
+
* calling this method - any/all methods called should be expected to be
|
|
427
|
+
* completely unreliable. dont call me unless you're about to dispose of all references to this object
|
|
428
|
+
*/
|
|
429
|
+
destroy(): void;
|
|
430
|
+
submitRequest(message: WorkerMessage, responseValidator: MessageValidator<WorkerMessageWithId>, transfers: Transferable[], signal?: AbortSignal | undefined): Promise<WorkerMessageWithId>;
|
|
431
|
+
getStatus(workerIndex: number): WorkerStatus;
|
|
432
|
+
getStatuses(): ReadonlyMap<number, WorkerStatus>;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;AACA,iBAAiB,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAC1C,qBAA4B,WAAW,SAAS,SAAS,EAAE,QAAQ,SAAS,SAAS,EAAE,CAAC;IACpF,QAAQ,CAAC,CAAC,E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AI,mBAAmB,CAE9E;AAUD,OAAO,MAAM,uBAAuB,CAAC;ACrBrC,sBAAsB,CAAC,IAAI,kBAAkB,OAAO,EAAE,CAAC,CAAC,CAAC;AAEzD,uBAAuB,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;AAElE,mCAA0C,MAAM,MAAM,CAAC;AAEvD,yBAAyB,GAAG,GAAG,2BAA2B,CAAC;AAS3D;IACI,SAAS,cAAc;IACvB,YAAY,iBAAiB;CAChC;AAED;;gBAMgB,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU;IAehD;;;;OAIG;IACH,OAAO;IAuCD,aAAa,CACf,OAAO,EAAE,aAAa,EACtB,iBAAiB,EAAE,iBAAiB,mBAAmB,CAAC,EACxD,SAAS,EAAE,YAAY,EAAE,EACzB,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,GACjC,OAAO,CAAC,mBAAmB,CAAC;IAgD/B,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,YAAY;IAe5C,WAAW,IAAI,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC;CAWnD","sources":["packages/core/src/src/dataset-cache.ts","packages/core/src/src/render-queue.ts","packages/core/src/src/layers/buffer-pair.ts","packages/core/src/src/layers/types.ts","packages/core/src/src/layers/layer-2D.ts","packages/core/src/src/errors.ts","packages/core/src/src/resources.ts","packages/core/src/src/logger.ts","packages/core/src/src/colors.ts","packages/core/src/src/abstract/types.ts","packages/core/src/src/abstract/async-frame.ts","packages/core/src/src/abstract/render-server.ts","packages/core/src/src/shared-priority-cache/min-heap.ts","packages/core/src/src/shared-priority-cache/keyed-heap.ts","packages/core/src/src/shared-priority-cache/priority-cache.ts","packages/core/src/src/shared-priority-cache/utils.ts","packages/core/src/src/shared-priority-cache/shared-cache.ts","packages/core/src/src/workers/messages.ts","packages/core/src/src/workers/worker-pool.ts","packages/core/src/src/index.ts","packages/core/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"export { beginLongRunningFrame } from './render-queue';\nexport { AsyncDataCache } from './dataset-cache';\nexport { ReglLayer2D } from './layers/layer-2D';\nexport * from './layers/buffer-pair';\nexport * from './resources';\nexport * from './errors';\nexport * from './colors';\n\nexport {\n beginFrame,\n buildAsyncRenderer,\n type RenderFrameConfig,\n} from './abstract/async-frame';\nexport type {\n CachedTexture,\n CachedVertexBuffer,\n ReglCacheEntry,\n Renderer,\n} from './abstract/types';\nexport { RenderServer } from './abstract/render-server';\n\nexport { Logger, logger } from './logger';\nexport { PriorityCache, AsyncPriorityCache, type Cacheable } from './shared-priority-cache/priority-cache';\nexport { SharedPriorityCache } from './shared-priority-cache/shared-cache';\n\nexport {\n type WorkerMessage,\n type WorkerMessageWithId,\n isWorkerMessage,\n isWorkerMessageWithId,\n HEARTBEAT_RATE_MS,\n} from './workers/messages';\n\nexport { WorkerPool, type WorkerInit } from './workers/worker-pool';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@alleninstitute/vis-core",
|
|
3
|
+
"version": "0.0.6",
|
|
4
|
+
"contributors": [
|
|
5
|
+
{
|
|
6
|
+
"name": "Lane Sawyer",
|
|
7
|
+
"email": "lane.sawyer@alleninstitute.org"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"name": "James Gerstenberger",
|
|
11
|
+
"email": "james.gerstenberger@alleninstitute.org"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "Noah Shepard",
|
|
15
|
+
"email": "noah.shepard@alleninstitute.org"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "Skyler Moosman",
|
|
19
|
+
"email": "skyler.moosman@alleninstitute.org"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "Su Li",
|
|
23
|
+
"email": "su.li@alleninstitute.org"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "Joel Arbuckle",
|
|
27
|
+
"email": "joel.arbuckle@alleninstitute.org"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"license": "BSD-3-Clause",
|
|
31
|
+
"source": "src/index.ts",
|
|
32
|
+
"main": "dist/main.js",
|
|
33
|
+
"types": "dist/types.d.ts",
|
|
34
|
+
"type": "module",
|
|
35
|
+
"files": [
|
|
36
|
+
"dist"
|
|
37
|
+
],
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://github.com/AllenInstitute/vis.git"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"registry": "https://registry.npmjs.org",
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/lodash": "4.17.24"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"lodash": "4.17.23",
|
|
51
|
+
"regl": "2.1.1",
|
|
52
|
+
"uuid": "13.0.0",
|
|
53
|
+
"@alleninstitute/vis-geometry": "0.0.8"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"typecheck": "tsc --noEmit",
|
|
57
|
+
"build": "parcel build --no-cache",
|
|
58
|
+
"dev": "parcel watch --port 1235",
|
|
59
|
+
"test": "vitest --watch",
|
|
60
|
+
"test:ci": "vitest run",
|
|
61
|
+
"coverage": "vitest run --coverage"
|
|
62
|
+
}
|
|
63
|
+
}
|