@tissuumaps/core 0.1.0-beta.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.
@@ -0,0 +1,4533 @@
1
+ import { default as default_2 } from 'openseadragon';
2
+ import { JsonSchema } from '@jsonforms/core';
3
+ import { mat3 } from 'gl-matrix';
4
+ import { Mutate } from 'zustand';
5
+ import { StoreApi } from 'zustand';
6
+ import { UISchemaElement } from '@jsonforms/core';
7
+
8
+ /**
9
+ * Base interface for data providers opening {@link AnnotatedDataSource}s
10
+ *
11
+ * In addition to a {@link DataProvider}, an annotated data provider receives
12
+ * the data of the table referenced by the data source, if any, when loading
13
+ * (see {@link AnnotatedDataProviderLoadOptions}).
14
+ *
15
+ * @typeParam TAnnotatedDataSource - The data source type this data provider
16
+ * opens
17
+ * @typeParam TData - The {@link Data} type produced by this data provider
18
+ * @typeParam TNormalizedAnnotatedDataSource - The data source type produced by
19
+ * {@link DataProvider.normalize} and accepted by
20
+ * {@link AnnotatedDataProvider.load}
21
+ */
22
+ export declare interface AnnotatedDataProvider<TAnnotatedDataSource extends AnnotatedDataSource, TData extends Data, TNormalizedAnnotatedDataSource extends TAnnotatedDataSource = TAnnotatedDataSource> extends DataProvider<TAnnotatedDataSource, TData, TNormalizedAnnotatedDataSource> {
23
+ /**
24
+ * Opens a data source and returns the loaded data accessor
25
+ *
26
+ * The data source has to have been normalized by
27
+ * {@link DataProvider.normalize} beforehand.
28
+ *
29
+ * @param normalizedDataSource - The normalized data source to open
30
+ * @param options - See {@link AnnotatedDataProviderLoadOptions}
31
+ * @returns A promise that resolves to the loaded data accessor
32
+ */
33
+ load(normalizedDataSource: TNormalizedAnnotatedDataSource, options?: AnnotatedDataProviderLoadOptions): Promise<TData>;
34
+ }
35
+
36
+ /**
37
+ * Options accepted by {@link AnnotatedDataProvider.load}
38
+ */
39
+ export declare type AnnotatedDataProviderLoadOptions = DataProviderLoadOptions & {
40
+ /** The data of the table referenced by the data source, if any */
41
+ tableDataPromise: Promise<TableData> | undefined;
42
+ };
43
+
44
+ /**
45
+ * A {@link RawAnnotatedDataSource} with {@link annotatedDataSourceDefaults} applied
46
+ */
47
+ export declare type AnnotatedDataSource<TType extends string = string> = DataSource<TType> & Required<Pick<RawAnnotatedDataSource<TType>, keyof typeof annotatedDataSourceDefaults>> & Omit<RawAnnotatedDataSource<TType>, keyof typeof annotatedDataSourceDefaults>;
48
+
49
+ /**
50
+ * Default values for {@link RawAnnotatedDataSource}
51
+ */
52
+ export declare const annotatedDataSourceDefaults: {};
53
+
54
+ /**
55
+ * The app store, i.e. its state and actions
56
+ */
57
+ export declare type AppStore = AppStoreState & AppStoreActions;
58
+
59
+ /**
60
+ * The actions of the app store
61
+ *
62
+ * Registering a data provider for a data source type that is already taken
63
+ * replaces the previously registered provider, which invalidates the data
64
+ * loaded through it.
65
+ */
66
+ export declare type AppStoreActions = {
67
+ /**
68
+ * Opens a workspace, against which local data source paths are resolved
69
+ *
70
+ * @param workspace - The directory handle of the workspace, or `null` to
71
+ * close the open workspace
72
+ */
73
+ setWorkspace: (workspace: FileSystemDirectoryHandle | null) => void;
74
+ /**
75
+ * Sets how mouse events in the viewer are interpreted
76
+ *
77
+ * @param interactionMode - The interaction mode to switch to
78
+ */
79
+ setInteractionMode: (interactionMode: InteractionMode) => void;
80
+ /**
81
+ * Previews a single image channel on its own, or ends the preview
82
+ *
83
+ * @param imageChannelPreview - The image and channel to preview, or `null` to
84
+ * end the preview
85
+ */
86
+ setImageChannelPreview: (imageChannelPreview: ImageChannelPreview | null) => void;
87
+ /**
88
+ * Marks a project as open, or as closed
89
+ *
90
+ * @param projectOpen - Whether a project is open
91
+ */
92
+ setProjectOpen: (projectOpen: boolean) => void;
93
+ /**
94
+ * Highlights a group of an object in the viewer
95
+ *
96
+ * @param highlightedItemGroup - The group to highlight, or `null` to highlight
97
+ * none
98
+ */
99
+ setHighlightedItemGroup: (highlightedItemGroup: HighlightedItemGroup | null) => void;
100
+ /**
101
+ * Registers an image data provider
102
+ *
103
+ * @param type - The data source type the provider handles
104
+ * @param dataProvider - The data provider to register
105
+ */
106
+ registerImageDataProvider: (type: string, dataProvider: ImageDataProvider<ImageDataSource, ImageData_2>) => void;
107
+ /**
108
+ * Registers a labels data provider
109
+ *
110
+ * @param type - The data source type the provider handles
111
+ * @param dataProvider - The data provider to register
112
+ */
113
+ registerLabelsDataProvider: (type: string, dataProvider: LabelsDataProvider<LabelsDataSource, LabelsData>) => void;
114
+ /**
115
+ * Registers a points data provider
116
+ *
117
+ * @param type - The data source type the provider handles
118
+ * @param dataProvider - The data provider to register
119
+ */
120
+ registerPointsDataProvider: (type: string, dataProvider: PointsDataProvider<PointsDataSource, PointsData>) => void;
121
+ /**
122
+ * Registers a shapes data provider
123
+ *
124
+ * @param type - The data source type the provider handles
125
+ * @param dataProvider - The data provider to register
126
+ */
127
+ registerShapesDataProvider: (type: string, dataProvider: ShapesDataProvider<ShapesDataSource, ShapesData>) => void;
128
+ /**
129
+ * Registers a table data provider
130
+ *
131
+ * @param type - The data source type the provider handles
132
+ * @param dataProvider - The data provider to register
133
+ */
134
+ registerTableDataProvider: (type: string, dataProvider: TableDataProvider<TableDataSource, TableData>) => void;
135
+ };
136
+
137
+ /**
138
+ * The API through which the app store is read, written and subscribed to
139
+ */
140
+ export declare type AppStoreApi = Mutate<StoreApi<AppStore>, [
141
+ ["zustand/immer", never]
142
+ ]>;
143
+
144
+ /**
145
+ * The state of the app store, holding what is not part of the project
146
+ */
147
+ export declare type AppStoreState = {
148
+ /** The directory handle of the open workspace, if any */
149
+ workspace: FileSystemDirectoryHandle | null;
150
+ /**
151
+ * Whether a project is open, possibly an empty one; the Project tab shows
152
+ * its welcome view otherwise
153
+ */
154
+ projectOpen: boolean;
155
+ /** How mouse events in the viewer are currently interpreted */
156
+ interactionMode: InteractionMode;
157
+ /** The channel previewed on its own while it is hovered, if any */
158
+ imageChannelPreview: ImageChannelPreview | null;
159
+ /**
160
+ * The group shown alone in the viewer, hiding every other item of its
161
+ * object, or `null` for none
162
+ */
163
+ highlightedItemGroup: HighlightedItemGroup | null;
164
+ /** The registered image data providers, by data source type */
165
+ imageDataProviders: Map<string, ImageDataProvider<ImageDataSource, ImageData_2>>;
166
+ /** The registered labels data providers, by data source type */
167
+ labelsDataProviders: Map<string, LabelsDataProvider<LabelsDataSource, LabelsData>>;
168
+ /** The registered points data providers, by data source type */
169
+ pointsDataProviders: Map<string, PointsDataProvider<PointsDataSource, PointsData>>;
170
+ /** The registered shapes data providers, by data source type */
171
+ shapesDataProviders: Map<string, ShapesDataProvider<ShapesDataSource, ShapesData>>;
172
+ /** The registered table data providers, by data source type */
173
+ tableDataProviders: Map<string, TableDataProvider<TableDataSource, TableData>>;
174
+ /**
175
+ * The registered plugins, by plugin ID, each as its human-readable name
176
+ * together with the element its user interface is mounted into, if it has one
177
+ *
178
+ * Written by the plugin registry, which owns the plugin lifecycle and keeps
179
+ * the plugin objects themselves to itself, so that nothing a plugin owns ends
180
+ * up frozen in the store.
181
+ */
182
+ plugins: Map<string, {
183
+ name: string;
184
+ container?: HTMLElement;
185
+ }>;
186
+ };
187
+
188
+ /**
189
+ * Utility methods for converting arrays to the types the storage API holds
190
+ */
191
+ export declare class ArrayUtils {
192
+ /**
193
+ * Converts item IDs to an `IDArray`
194
+ *
195
+ * Integer typed arrays, string arrays and 64-bit float arrays holding safe
196
+ * integers are returned as they are. Any other array has to hold either
197
+ * strings only, which are copied into a string array, or safe integers only,
198
+ * which are copied into 64-bit floats. Numeric strings are not parsed:
199
+ * whether `"12"` is an ID or a number is up to the data provider. An empty
200
+ * array yields an empty unsigned 32-bit integer array.
201
+ *
202
+ * @param values - The IDs to convert
203
+ * @returns The IDs as an integer typed array, a 64-bit float array or a
204
+ * string array
205
+ * @throws Error if a value is neither a string nor a safe integer, or if
206
+ * strings and integers are mixed
207
+ */
208
+ static toIDArray(values: ArrayLike<unknown>): IDArray;
209
+ /**
210
+ * Tells whether an array is an integer typed array of at most 32 bits
211
+ */
212
+ private static _isIntOrUintArray;
213
+ /**
214
+ * Converts 64-bit integers to 64-bit floats
215
+ *
216
+ * @param values - The integers, as read from a file (e.g. a `BigInt64Array`)
217
+ * @returns The integers as floats
218
+ * @throws Error if an integer is outside the safe integer range
219
+ */
220
+ static parseSafeInts(values: ArrayLike<bigint>): Float64Array;
221
+ }
222
+
223
+ /**
224
+ * Utility methods for running large CPU workloads on the main thread without
225
+ * blocking the UI, by cooperatively yielding to the event loop
226
+ */
227
+ export declare class AsyncUtils {
228
+ private static _messageChannel;
229
+ private static _pendingResolvers;
230
+ /**
231
+ * Yields control back to the event loop, allowing the browser to paint and
232
+ * process input before resuming.
233
+ *
234
+ * Uses the native `scheduler.yield()` when available, otherwise falls back to
235
+ * a shared `MessageChannel` (a macrotask without `setTimeout`'s clamping).
236
+ *
237
+ * @returns A promise that resolves once the event loop has been yielded to
238
+ */
239
+ static yield(): Promise<void>;
240
+ /**
241
+ * Creates a time-sliced yielder for loops whose iterations are too coarse or
242
+ * heterogeneous for {@link AsyncUtils.forEach} (e.g. nested loops).
243
+ *
244
+ * Call the returned function at safe points inside a loop: it checks the
245
+ * abort signal on every call for fail-fast cancellation, and additionally
246
+ * yields to the event loop once the time budget since the last yield is
247
+ * exceeded. When within budget and not aborted, it is a cheap no-op.
248
+ *
249
+ * @param options - Optional time (ms) to run before yielding
250
+ * @returns The yielder, which takes an optional abort signal
251
+ */
252
+ static createYielder(options?: {
253
+ yieldMs?: number;
254
+ }): (opts?: {
255
+ signal?: AbortSignal;
256
+ }) => Promise<void>;
257
+ /**
258
+ * Invokes `callback(item, index)` for every element of `items`, yielding to
259
+ * the event loop whenever the time budget is exceeded so the UI stays
260
+ * responsive.
261
+ *
262
+ * The abort signal is checked up front and after every yield, preserving
263
+ * fail-fast cancellation: an abort rejects with the signal's reason and no
264
+ * further iterations run.
265
+ *
266
+ * @param items - The array-like collection to iterate over
267
+ * @param callback - Synchronous work to perform for each `item` and its `index`
268
+ * @param options - Optional abort signal, time (ms) to run before yielding
269
+ * (`yieldMs`), and the number of iterations between budget checks
270
+ * (`checkEvery`)
271
+ * @returns A promise that resolves once every item has been visited, or
272
+ * rejects with the signal's reason
273
+ */
274
+ static forEach<T>(items: ArrayLike<T>, callback: (item: T, index: number) => void, options?: {
275
+ signal?: AbortSignal;
276
+ yieldMs?: number;
277
+ checkEvery?: number;
278
+ }): Promise<void>;
279
+ /**
280
+ * Returns a promise that resolves or rejects with the given `promise`, but
281
+ * rejects early if the given `signal` is aborted.
282
+ *
283
+ * @param promise - The promise to race against the abort signal
284
+ * @param options - Optional abort signal to race against the promise
285
+ * @returns A promise that resolves or rejects based on the race condition
286
+ */
287
+ static raceSignal<T>(promise: Promise<T>, options?: {
288
+ signal?: AbortSignal;
289
+ }): Promise<T>;
290
+ /**
291
+ * Creates a promise together with the functions that resolve and reject it,
292
+ * like `Promise.withResolvers()`, which is not yet widely available.
293
+ *
294
+ * @returns The promise and the functions that resolve and reject it
295
+ */
296
+ static withResolvers<T>(): {
297
+ promise: Promise<T>;
298
+ resolve: (value: T | PromiseLike<T>) => void;
299
+ reject: (reason?: unknown) => void;
300
+ };
301
+ }
302
+
303
+ /** Utility methods for bitwise operations that yield unsigned 32-bit results */
304
+ export declare class BitUtils {
305
+ /**
306
+ * Performs a bitwise AND, returning an unsigned 32-bit result
307
+ *
308
+ * @param a - First operand
309
+ * @param b - Second operand
310
+ * @returns The result, as an unsigned 32-bit integer
311
+ */
312
+ static safeAnd(a: number, b: number): number;
313
+ /**
314
+ * Performs a bitwise OR, returning an unsigned 32-bit result
315
+ *
316
+ * @param a - First operand
317
+ * @param b - Second operand
318
+ * @returns The result, as an unsigned 32-bit integer
319
+ */
320
+ static safeOr(a: number, b: number): number;
321
+ /**
322
+ * Performs a bitwise XOR, returning an unsigned 32-bit result
323
+ *
324
+ * @param a - First operand
325
+ * @param b - Second operand
326
+ * @returns The result, as an unsigned 32-bit integer
327
+ */
328
+ static safeXor(a: number, b: number): number;
329
+ /**
330
+ * Performs a bitwise NOT, returning an unsigned 32-bit result
331
+ *
332
+ * @param a - The operand
333
+ * @returns The result, as an unsigned 32-bit integer
334
+ */
335
+ static safeNot(a: number): number;
336
+ /**
337
+ * Performs a left shift, returning an unsigned 32-bit result
338
+ *
339
+ * @param value - The value to shift
340
+ * @param shift - Number of bit positions to shift
341
+ * @returns The result, as an unsigned 32-bit integer
342
+ */
343
+ static safeLeftShift(value: number, shift: number): number;
344
+ /**
345
+ * Performs an unsigned right shift
346
+ *
347
+ * @param value - The value to shift
348
+ * @param shift - Number of bit positions to shift
349
+ * @returns The result, as an unsigned 32-bit integer
350
+ */
351
+ static safeRightShift(value: number, shift: number): number;
352
+ }
353
+
354
+ /** Color palettes suitable for categorical data */
355
+ export declare const categoricalColorPalettes: ColorPalette[];
356
+
357
+ /** A color in RGB format */
358
+ export declare type Color = {
359
+ /** Red component, between 0 and 255 */
360
+ r: number;
361
+ /** Green component, between 0 and 255 */
362
+ g: number;
363
+ /** Blue component, between 0 and 255 */
364
+ b: number;
365
+ };
366
+
367
+ /**
368
+ * Color configuration
369
+ *
370
+ * When sourced from a numerical table column, values are clipped to the
371
+ * configured range - or min-max-scaled, if none is given - and then mapped to
372
+ * the configured color palette.
373
+ */
374
+ export declare type ColorConfig = ConstantConfig<Color> | FromConfig<{
375
+ /**
376
+ * Value range that is linearly mapped to the color palette
377
+ *
378
+ * Values are clipped to this range before mapping them to colors.
379
+ *
380
+ * If not specified, min-max-scaling is used.
381
+ */
382
+ range?: [number, number];
383
+ /** ID of the color palette to which clipped and rescaled numerical values are mapped */
384
+ palette: string;
385
+ }> | GroupByConfig<false, {
386
+ /**
387
+ * ID of the color palette for mapping hashed group names to colors
388
+ *
389
+ * Only used when no project-global colormap is specified
390
+ */
391
+ palette?: string;
392
+ }> | RandomConfig<{
393
+ /** ID of the color palette from which colors are randomly drawn */
394
+ palette: string;
395
+ }>;
396
+
397
+ /** A named, identifiable list of colors */
398
+ export declare type ColorPalette = {
399
+ /** Color palette ID */
400
+ id: string;
401
+ /** Human-readable color palette name */
402
+ name: string;
403
+ /** The colors making up the palette, in order */
404
+ colors: Color[];
405
+ };
406
+
407
+ /** All available color palettes, continuous and categorical */
408
+ export declare const colorPalettes: ColorPalette[];
409
+
410
+ /** Utility methods for color parsing, packing, and conversion */
411
+ export declare class ColorUtils {
412
+ /**
413
+ * Parses a text-based color palette into an array of colors
414
+ *
415
+ * Each non-empty line is expected to contain three numeric components
416
+ * separated by `sep`, scaled from `[0, maxValue]` to `[0, 255]`.
417
+ *
418
+ * @param str - Multi-line palette string
419
+ * @param options - Component separator (default `" "`) and maximum input
420
+ * value per component (default `1`)
421
+ * @returns The parsed colors, in the order of the palette's lines
422
+ * @throws Error if a non-empty line does not hold exactly three components
423
+ */
424
+ static parsePalette(str: string, options?: {
425
+ sep?: string;
426
+ maxValue?: number;
427
+ }): Color[];
428
+ /**
429
+ * Samples a continuous color scheme into an array of colors
430
+ *
431
+ * The scheme is evaluated at `n` evenly spaced positions covering the whole
432
+ * `[0, 1]` range, both ends included.
433
+ *
434
+ * @param colorScheme - Maps a position within `[0, 1]` to a CSS color string
435
+ * @param n - Number of colors to sample, an integer of at least two
436
+ * @returns The sampled colors, in the order of the scheme
437
+ * @throws Error if `n` is not an integer of at least two, or if the scheme
438
+ * yields a color string that cannot be parsed
439
+ */
440
+ static sampleColorScheme(colorScheme: (t: number) => string, n: number): Color[];
441
+ /**
442
+ * Packs an RGB color into a single 24-bit integer, `0xBBGGRR`
443
+ *
444
+ * The red component occupies the lowest byte, so that the integer, when
445
+ * stored in host byte order on a little-endian host, matches the R, G, B byte
446
+ * order of a canvas `ImageData` buffer.
447
+ *
448
+ * @param color - The color to pack
449
+ * @returns The packed color, `0xBBGGRR`
450
+ */
451
+ static packColor(color: Color): number;
452
+ /**
453
+ * Packs a visibility into the form that {@link withAlpha} folds into a color
454
+ *
455
+ * @param visibility - The visibility
456
+ * @returns `1` if visible, `0` if not
457
+ */
458
+ static packVisibility(visibility: boolean): number;
459
+ /**
460
+ * Packs an opacity into the form that {@link withAlpha} folds into a color
461
+ *
462
+ * @param opacity - The opacity, in the range [0, 1]; values outside are clamped
463
+ * @returns The opacity as an integer in the range [0, 255]
464
+ */
465
+ static packOpacity(opacity: number): number;
466
+ /**
467
+ * Folds a visibility and an opacity into the alpha channel of a packed color
468
+ *
469
+ * Combines the lower 24 bits of `color` (see {@link packColor}) with
470
+ * `opacity` as alpha if `visibility` is non-zero, and with zero alpha
471
+ * otherwise, into a packed 32-bit RGBA color, `0xAABBGGRR`.
472
+ *
473
+ * @param packedColor - The packed color, `0xBBGGRR`; any higher bits are discarded
474
+ * @param packedVisibility - The visibility, larger than `0` for visible
475
+ * @param packedOpacity - The opacity, in the range [0, 255]
476
+ * @returns The packed RGBA color, `0xAABBGGRR`, as an unsigned 32-bit integer
477
+ */
478
+ static withAlpha(packedColor: number, packedVisibility: number, packedOpacity: number): number;
479
+ /**
480
+ * Parses a hex color string into a {@link Color}
481
+ *
482
+ * @param hex - A `#RRGGBB` hex string
483
+ * @returns The parsed color
484
+ * @throws Error if the string is not a valid 6-digit hex color
485
+ */
486
+ static fromHex(hex: string): Color;
487
+ /**
488
+ * Formats a {@link Color} as a `#RRGGBB` hex string
489
+ *
490
+ * @param color - The color to format
491
+ * @returns The formatted hex string
492
+ */
493
+ static toHex(color: Color): string;
494
+ /**
495
+ * Checks whether two colors have identical RGB components
496
+ *
497
+ * Components are compared exactly, without rounding or tolerance.
498
+ *
499
+ * @param a - The first color
500
+ * @param b - The second color
501
+ * @returns `true` if all three components are equal, `false` otherwise
502
+ */
503
+ static equals(a: Color, b: Color): boolean;
504
+ /**
505
+ * Converts an HSB (HSV) color to RGB, following Java's `Color.HSBtoRGB`
506
+ *
507
+ * @param hue - The hue, in the range [0, 1) (values outside wrap around)
508
+ * @param saturation - The saturation, in the range [0, 1]
509
+ * @param brightness - The brightness, in the range [0, 1]
510
+ * @returns The RGB color, with integer components in the range [0, 255]
511
+ */
512
+ static fromHSB(hue: number, saturation: number, brightness: number): Color;
513
+ }
514
+
515
+ /**
516
+ * Base type for property configurations that can be sourced from different providers
517
+ *
518
+ * Concrete configuration types (e.g. {@link ColorConfig}, {@link SizeConfig}) are unions
519
+ * of this base with one or more source-specific types such as {@link ConstantConfig},
520
+ * {@link FromConfig}, {@link GroupByConfig}, and {@link RandomConfig}.
521
+ */
522
+ export declare type Config<TSource extends string> = {
523
+ /**
524
+ * Explicitly prioritized configuration source
525
+ *
526
+ * When set, this overrides the automatic source detection in {@link getActiveConfigSource}.
527
+ */
528
+ source?: TSource;
529
+ };
530
+
531
+ /** Utility methods for property configurations */
532
+ export declare class ConfigUtils {
533
+ /**
534
+ * Returns the group-to-value map that a configuration resolves its values
535
+ * from, if any
536
+ *
537
+ * Only an active `groupBy` source (see {@link getActiveConfigSource}) with a
538
+ * map ID resolves from a map. The map is returned as found in `maps`, rather
539
+ * than copied: maps are never mutated, as an edit replaces the map, so
540
+ * callers can detect an edit by comparing the returned maps by identity.
541
+ *
542
+ * @param config - The configuration
543
+ * @param maps - The project-global maps to look the referenced map up in
544
+ * @returns The map, or `undefined` if the configuration does not resolve
545
+ * from a map, or if the map it references does not exist
546
+ */
547
+ static findGroupByMap<TValue>(config: Config<string>, maps: GroupValueMap<TValue>[]): GroupValueMap<TValue> | undefined;
548
+ /**
549
+ * Returns the IDs of the maps that configurations refer to
550
+ *
551
+ * A configuration refers to its map whatever its active source, as switching
552
+ * back to `groupBy` uses the map again.
553
+ *
554
+ * @param configs - The configurations
555
+ * @returns The IDs of the referenced maps
556
+ */
557
+ static getGroupByMapIds(configs: Config<string>[]): Set<string>;
558
+ /**
559
+ * Creates the function that returns the value a group-by configuration
560
+ * assigns to a group
561
+ *
562
+ * With a map, a group takes its value in the map, else the map's default,
563
+ * else `defaultValue`; a map that does not exist gives every group
564
+ * `defaultValue`. Without a map, a group takes the palette value its name
565
+ * hashes to, or `defaultValue` if there is no palette.
566
+ *
567
+ * @param config - The group-by configuration
568
+ * @param map - The map the configuration refers to (see
569
+ * {@link findGroupByMap}), or `undefined` if it refers to none or the map
570
+ * does not exist
571
+ * @param defaultValue - The value of a group that nothing assigns one to
572
+ * @param palette - The values to pick from by hash if there is no map
573
+ * @returns The value of a group, by group name (the cell value as a string)
574
+ */
575
+ static createGroupValueGetter<TValue>(config: GroupByConfig<false>, map: GroupValueMap<TValue> | undefined, defaultValue: TValue, palette?: readonly TValue[]): (group: string) => TValue;
576
+ /**
577
+ * Returns the table column a configuration groups by
578
+ *
579
+ * @param config - The configuration
580
+ * @returns The column, or `undefined` if `groupBy` is not the active source
581
+ */
582
+ static getGroupByColumn(config: Config<string>): TableColumnRef | undefined;
583
+ /**
584
+ * Points a configuration at a map, grouping by a column
585
+ *
586
+ * The configuration keeps its other sources and the extra fields of its
587
+ * `groupBy` specification (e.g. a palette), so that switching back to them
588
+ * restores them. The unit of the active source, which only sizes have, is
589
+ * carried over, so that the values keep their scale. A configuration that
590
+ * already groups by the column with the map is returned as is, so that
591
+ * updating an object with it changes nothing.
592
+ *
593
+ * @param config - The configuration
594
+ * @param groupBy - The categorical table column to group by
595
+ * @param mapId - ID of the project-global map to take the group values from
596
+ * @returns The configuration, with `groupBy` as its active source
597
+ */
598
+ static withGroupByMap(config: Config<string>, groupBy: TableColumnRef, mapId: string): GroupByConfig<true>;
599
+ /**
600
+ * Returns the unit of the active source of a configuration
601
+ *
602
+ * @param config - The configuration, of which only sizes have a unit
603
+ * @returns The unit, or `undefined` if the active source has none
604
+ */
605
+ static getUnit(config: Config<string>): CoordinateSpace | undefined;
606
+ /**
607
+ * Determines whether two table column references point to the same column
608
+ *
609
+ * References without a table point to the column of `defaultTable`.
610
+ *
611
+ * @param tableColumnRef - The table column reference
612
+ * @param otherTableColumnRef - The table column reference to compare with
613
+ * @param defaultTable - ID of the table of references without a table
614
+ * @returns Whether both references point to the same column
615
+ */
616
+ static isSameTableColumn(tableColumnRef: TableColumnRef, otherTableColumnRef: TableColumnRef, defaultTable?: string): boolean;
617
+ }
618
+
619
+ /** Configuration to use a constant value */
620
+ export declare type ConstantConfig<TValue, TConstantExtra = unknown> = Config<"constant"> & {
621
+ /** Specification of a constant value */
622
+ constant: {
623
+ value: NonNullable<TValue>;
624
+ } & TConstantExtra;
625
+ };
626
+
627
+ /** Color palettes suitable for continuous data */
628
+ export declare const continuousColorPalettes: ColorPalette[];
629
+
630
+ /** Coordinate space */
631
+ export declare type CoordinateSpace =
632
+ /** Data (e.g. pixel) space */
633
+ "data"
634
+ /** Layer (e.g. physical) space */
635
+ | "layer"
636
+ /** World (i.e. global) space */
637
+ | "world";
638
+
639
+ /**
640
+ * Creates an {@link AnnotatedDataSource} from a {@link RawAnnotatedDataSource} by applying {@link annotatedDataSourceDefaults}
641
+ *
642
+ * @param rawAnnotatedDataSource - The raw annotated data source
643
+ * @returns The complete annotated data source with default values applied
644
+ */
645
+ export declare function createAnnotatedDataSource<TType extends string>(rawAnnotatedDataSource: RawAnnotatedDataSource<TType>): AnnotatedDataSource<TType>;
646
+
647
+ /**
648
+ * Creates a {@link DataObject} from a {@link RawDataObject} by applying {@link dataObjectDefaults}
649
+ *
650
+ * @param rawDataObject - The raw data object
651
+ * @returns The complete data object with default values applied
652
+ */
653
+ export declare function createDataObject<TType extends string, TRawDataSource extends RawDataSource<TType>>(rawDataObject: RawDataObject<TRawDataSource>): DataObject<DataSource<TType>>;
654
+
655
+ /**
656
+ * Creates a {@link DataSource} from a {@link RawDataSource} by applying {@link dataSourceDefaults}
657
+ *
658
+ * @param rawDataSource - The raw data source
659
+ * @returns The complete data source with default values applied
660
+ */
661
+ export declare function createDataSource<TType extends string>(rawDataSource: RawDataSource<TType>): DataSource<TType>;
662
+
663
+ /**
664
+ * Creates an {@link Image} from a {@link RawImage} by applying {@link imageDefaults}
665
+ *
666
+ * @param rawImage - The raw image
667
+ * @returns The complete image with default values applied
668
+ */
669
+ export declare function createImage(rawImage: RawImage): Image_2;
670
+
671
+ /**
672
+ * Creates an {@link ImageDataSource} from a {@link RawImageDataSource} by applying {@link imageDataSourceDefaults}
673
+ *
674
+ * @param rawImageDataSource - The raw image data source
675
+ * @returns The complete image data source with default values applied
676
+ */
677
+ export declare function createImageDataSource<TType extends string>(rawImageDataSource: RawImageDataSource<TType>): ImageDataSource<TType>;
678
+
679
+ /**
680
+ * Creates a {@link Labels} from a {@link RawLabels} by applying {@link labelsDefaults}
681
+ *
682
+ * @param rawLabels - The raw labels
683
+ * @returns The complete labels with default values applied
684
+ */
685
+ export declare function createLabels(rawLabels: RawLabels): Labels;
686
+
687
+ /**
688
+ * Creates a {@link LabelsDataSource} from a {@link RawLabelsDataSource} by applying {@link labelsDataSourceDefaults}
689
+ *
690
+ * @param rawLabelsDataSource - The raw labels data source
691
+ * @returns The complete labels data source with default values applied
692
+ */
693
+ export declare function createLabelsDataSource<TType extends string>(rawLabelsDataSource: RawLabelsDataSource<TType>): LabelsDataSource<TType>;
694
+
695
+ /**
696
+ * Creates a {@link Layer} from a {@link RawLayer} by applying {@link layerDefaults}
697
+ *
698
+ * @param rawLayer - The raw layer
699
+ * @returns The complete layer with default values applied
700
+ */
701
+ export declare function createLayer(rawLayer: RawLayer): Layer;
702
+
703
+ /**
704
+ * Creates a {@link Model} from a {@link RawModel} by applying {@link modelDefaults}
705
+ *
706
+ * @param rawModel - The raw model
707
+ * @returns The complete model with default values applied
708
+ */
709
+ export declare function createModel(rawModel: RawModel): Model;
710
+
711
+ /**
712
+ * Creates a {@link Points} from a {@link RawPoints} by applying {@link pointsDefaults}
713
+ *
714
+ * @param rawPoints - The raw points
715
+ * @returns The complete points with default values applied
716
+ */
717
+ export declare function createPoints(rawPoints: RawPoints): Points;
718
+
719
+ /**
720
+ * Creates a {@link PointsDataSource} from a {@link RawPointsDataSource} by applying {@link pointsDataSourceDefaults}
721
+ *
722
+ * @param rawPointsDataSource - The raw points data source
723
+ * @returns The complete points data source with default values applied
724
+ */
725
+ export declare function createPointsDataSource<TType extends string>(rawPointsDataSource: RawPointsDataSource<TType>): PointsDataSource<TType>;
726
+
727
+ /**
728
+ * Creates a {@link Project} from a {@link RawProject} by applying {@link projectDefaults}
729
+ *
730
+ * @param rawProject - The raw project
731
+ * @returns The complete project with default values applied
732
+ */
733
+ export declare function createProject(rawProject: RawProject): Project;
734
+
735
+ /**
736
+ * Creates a {@link RenderedDataObject} from a {@link RawRenderedDataObject} by applying {@link renderedDataObjectDefaults}
737
+ *
738
+ * @param rawRenderedDataObject - The raw rendered data object
739
+ * @returns The complete rendered data object with default values applied
740
+ */
741
+ export declare function createRenderedDataObject<TType extends string, TRawDataSource extends RawDataSource<TType>>(rawRenderedDataObject: RawRenderedDataObject<TRawDataSource>): RenderedDataObject<DataSource<TType>>;
742
+
743
+ /**
744
+ * Creates a {@link RenderedItemsDataObject} from a {@link RawRenderedItemsDataObject} by applying {@link renderedItemsDataObjectDefaults}
745
+ *
746
+ * @param rawRenderedItemsDataObject - The raw rendered items data object
747
+ * @returns The complete rendered items data object with default values applied
748
+ */
749
+ export declare function createRenderedItemsDataObject<TType extends string, TRawDataSource extends RawDataSource<TType>>(rawRenderedItemsDataObject: RawRenderedItemsDataObject<TRawDataSource>): RenderedItemsDataObject<DataSource<TType>>;
750
+
751
+ /**
752
+ * Creates a {@link RenderedRasterDataObject} from a {@link RawRenderedRasterDataObject} by applying {@link renderedRasterDataObjectDefaults}
753
+ *
754
+ * @param rawRenderedRasterDataObject - The raw rendered raster data object
755
+ * @returns The complete rendered raster data object with default values applied
756
+ */
757
+ export declare function createRenderedRasterDataObject<TType extends string, TRawDataSource extends RawDataSource<TType>>(rawRenderedRasterDataObject: RawRenderedRasterDataObject<TRawDataSource>): RenderedRasterDataObject<DataSource<TType>>;
758
+
759
+ /**
760
+ * Creates a {@link Shapes} from a {@link RawShapes} by applying {@link shapesDefaults}
761
+ *
762
+ * @param rawShapes - The raw shapes
763
+ * @returns The complete shapes with default values applied
764
+ */
765
+ export declare function createShapes(rawShapes: RawShapes): Shapes;
766
+
767
+ /**
768
+ * Creates a {@link ShapesDataSource} from a {@link RawShapesDataSource} by applying {@link shapesDataSourceDefaults}
769
+ *
770
+ * @param rawShapesDataSource - The raw shapes data source
771
+ * @returns The complete shapes data source with default values applied
772
+ */
773
+ export declare function createShapesDataSource<TType extends string>(rawShapesDataSource: RawShapesDataSource<TType>): ShapesDataSource<TType>;
774
+
775
+ /**
776
+ * Creates a {@link Table} from a {@link RawTable} by applying {@link tableDefaults}
777
+ *
778
+ * @param rawTable - The raw table
779
+ * @returns The complete table with default values applied
780
+ */
781
+ export declare function createTable(rawTable: RawTable): Table;
782
+
783
+ /**
784
+ * Creates a {@link TableDataSource} from a {@link RawTableDataSource} by applying {@link tableDataSourceDefaults}
785
+ *
786
+ * @param rawTableDataSource - The raw table data source
787
+ * @returns The complete table data source with default values applied
788
+ */
789
+ export declare function createTableDataSource<TType extends string>(rawTableDataSource: RawTableDataSource<TType>): TableDataSource<TType>;
790
+
791
+ /** A custom tile source that resolves tile URLs programmatically */
792
+ export declare interface CustomTileSource {
793
+ /**
794
+ * Returns the URL for a specific tile
795
+ *
796
+ * @param level - Pyramid level
797
+ * @param x - Tile column index
798
+ * @param y - Tile row index
799
+ * @returns The tile URL, or a function that returns the URL
800
+ */
801
+ getTileUrl(level: number, x: number, y: number): string | (() => string);
802
+ }
803
+
804
+ /**
805
+ * Base interface for loaded data objects
806
+ */
807
+ export declare interface Data {
808
+ /** Releases all resources held by this data object */
809
+ close(): void;
810
+ }
811
+
812
+ /**
813
+ * A {@link RawDataObject} with {@link dataObjectDefaults} applied
814
+ */
815
+ export declare type DataObject<TDataSource extends DataSource<string>> = Model & Required<Pick<RawDataObject<TDataSource>, keyof typeof dataObjectDefaults>> & Omit<RawDataObject<TDataSource>, keyof typeof dataObjectDefaults>;
816
+
817
+ /**
818
+ * Default values for {@link RawDataObject}
819
+ */
820
+ export declare const dataObjectDefaults: {};
821
+
822
+ /**
823
+ * Base interface for data providers
824
+ *
825
+ * @typeParam TDataSource - The data source type this data provider opens
826
+ * @typeParam TData - The {@link Data} type produced by this data provider
827
+ * @typeParam TNormalizedDataSource - The data source type produced by
828
+ * {@link DataProvider.normalize} and accepted by {@link DataProvider.load}
829
+ */
830
+ export declare interface DataProvider<TDataSource extends DataSource, TData extends Data, TNormalizedDataSource extends TDataSource = TDataSource> {
831
+ /** The name of the data provider */
832
+ readonly name: string;
833
+ /** The JSON schema for the data source */
834
+ readonly schema: JsonSchema;
835
+ /** The JSON Forms UI schema for the data source */
836
+ readonly uischema: UISchemaElement;
837
+ /**
838
+ * Returns the data source with all of this data provider's defaults applied
839
+ * and its source normalized
840
+ *
841
+ * Data sources that normalize to the same value are considered equal, and
842
+ * their data is loaded only once and shared between all referencing objects.
843
+ * Normalization has to be idempotent: normalizing an already normalized data
844
+ * source must return the same value again.
845
+ *
846
+ * The source is normalized with `SourceUtils.normalizeSource`, which resolves
847
+ * it against the project source and the open workspace, so the result has to
848
+ * be recomputed when either changes.
849
+ *
850
+ * Normalizing may throw, e.g. for a source that cannot be resolved against
851
+ * the given workspace and project source. The data cache catches it, so only
852
+ * the objects referencing that data source fail to load; the data of all
853
+ * other objects is unaffected.
854
+ *
855
+ * @param dataSource - The data source to normalize
856
+ * @param workspace - The directory handle of the open workspace, if any
857
+ * @param projectSource - Where the project was loaded from: its absolute URL,
858
+ * the workspace-relative path of the project file, or `null` for projects
859
+ * that were loaded from neither
860
+ * @returns The normalized data source
861
+ */
862
+ normalize(dataSource: TDataSource, workspace: FileSystemDirectoryHandle | null, projectSource: string | null): TNormalizedDataSource;
863
+ /**
864
+ * Opens a data source and returns the loaded data accessor
865
+ *
866
+ * The data source has to have been normalized by
867
+ * {@link DataProvider.normalize} beforehand.
868
+ *
869
+ * @param normalizedDataSource - The normalized data source to open
870
+ * @param options - See {@link DataProviderLoadOptions}
871
+ * @returns A promise that resolves to the loaded data accessor
872
+ */
873
+ load(normalizedDataSource: TNormalizedDataSource, options?: DataProviderLoadOptions): Promise<TData>;
874
+ }
875
+
876
+ /**
877
+ * Options accepted by {@link DataProvider.load}
878
+ */
879
+ export declare type DataProviderLoadOptions = {
880
+ /** Signal for aborting the load operation */
881
+ signal?: AbortSignal;
882
+ /** Directory handle of the open workspace, if any */
883
+ workspace?: FileSystemDirectoryHandle | null;
884
+ /** Callback for reporting the progress of the load operation */
885
+ onProgress?: ProgressCallback;
886
+ };
887
+
888
+ /**
889
+ * A reference to an object's data, in one of three states
890
+ *
891
+ * While `status` is `"loading"`, `progress` and `total` carry the most recent
892
+ * progress report, if there was any; `"loaded"` carries the data, and
893
+ * `"error"` the reason why loading it failed. A reference is replaced, rather
894
+ * than mutated, whenever its state changes.
895
+ */
896
+ export declare type DataRef<TData extends Data> = {
897
+ /** Resolves with the loaded data, or rejects with the loading error */
898
+ promise: Promise<TData>;
899
+ } & ({
900
+ status: "loading";
901
+ progress?: number;
902
+ total?: number;
903
+ } | {
904
+ status: "loaded";
905
+ data: TData;
906
+ } | {
907
+ status: "error";
908
+ error: unknown;
909
+ });
910
+
911
+ /**
912
+ * A {@link RawDataSource} with {@link dataSourceDefaults} applied
913
+ */
914
+ export declare type DataSource<TType extends string = string> = Model & Required<Pick<RawDataSource<TType>, keyof typeof dataSourceDefaults>> & Omit<RawDataSource<TType>, keyof typeof dataSourceDefaults>;
915
+
916
+ /**
917
+ * Default values for {@link RawDataSource}
918
+ */
919
+ export declare const dataSourceDefaults: {};
920
+
921
+ /**
922
+ * The data store, i.e. its state and actions
923
+ */
924
+ export declare type DataStore = DataStoreState & DataStoreActions;
925
+
926
+ /**
927
+ * The actions of the data store
928
+ *
929
+ * The data store has none: it is written to by the application, which keeps it
930
+ * in sync with the project and with the data it has loaded.
931
+ */
932
+ export declare type DataStoreActions = {};
933
+
934
+ /**
935
+ * The API through which the data store is read and subscribed to
936
+ */
937
+ export declare type DataStoreApi = Mutate<StoreApi<DataStore>, [
938
+ ["zustand/immer", never]
939
+ ]>;
940
+
941
+ /**
942
+ * The state of the data store, holding the data of the current project
943
+ *
944
+ * Each map is keyed by object ID; objects whose data is neither loaded nor
945
+ * being loaded are absent.
946
+ */
947
+ export declare type DataStoreState = {
948
+ /** The data references of the project's images */
949
+ imageDataRefs: Map<string, DataRef<ImageData_2>>;
950
+ /** The data references of the project's labels */
951
+ labelsDataRefs: Map<string, DataRef<LabelsData>>;
952
+ /** The data references of the project's points */
953
+ pointsDataRefs: Map<string, DataRef<PointsData>>;
954
+ /** The data references of the project's shapes */
955
+ shapesDataRefs: Map<string, DataRef<ShapesData>>;
956
+ /** The data references of the project's tables */
957
+ tableDataRefs: Map<string, DataRef<TableData>>;
958
+ };
959
+
960
+ /** Default label color */
961
+ export declare const defaultLabelColor: {
962
+ readonly r: 255;
963
+ readonly g: 255;
964
+ readonly b: 255;
965
+ };
966
+
967
+ /** ID of the default color palette for random label colors */
968
+ export declare const defaultLabelColorPalette = "distinct";
969
+
970
+ /** Default label opacity */
971
+ export declare const defaultLabelOpacity = 1;
972
+
973
+ /** Default label visibility */
974
+ export declare const defaultLabelVisibility = true;
975
+
976
+ /** Default point color */
977
+ export declare const defaultPointColor: {
978
+ readonly r: 255;
979
+ readonly g: 255;
980
+ readonly b: 255;
981
+ };
982
+
983
+ /** Default point marker */
984
+ export declare const defaultPointMarker: 6;
985
+
986
+ /** Default point opacity */
987
+ export declare const defaultPointOpacity = 1;
988
+
989
+ /** Default point size */
990
+ export declare const defaultPointSize = 1;
991
+
992
+ /** Default coordinate space in which point sizes are specified */
993
+ export declare const defaultPointSizeUnit: CoordinateSpace;
994
+
995
+ /** Default point visibility */
996
+ export declare const defaultPointVisibility = true;
997
+
998
+ /**
999
+ * Default seed of random configurations (see `RandomConfig`), used when a
1000
+ * configuration does not specify one
1001
+ */
1002
+ export declare const defaultRandomSeed = 0;
1003
+
1004
+ /** Default shape fill color */
1005
+ export declare const defaultShapeFillColor: {
1006
+ readonly r: 255;
1007
+ readonly g: 255;
1008
+ readonly b: 255;
1009
+ };
1010
+
1011
+ /** Default shape fill opacity */
1012
+ export declare const defaultShapeFillOpacity = 1;
1013
+
1014
+ /** Default shape fill visibility */
1015
+ export declare const defaultShapeFillVisibility = true;
1016
+
1017
+ /** Default shape opacity */
1018
+ export declare const defaultShapeOpacity = 1;
1019
+
1020
+ /** Default shape stroke color */
1021
+ export declare const defaultShapeStrokeColor: {
1022
+ readonly r: 0;
1023
+ readonly g: 0;
1024
+ readonly b: 0;
1025
+ };
1026
+
1027
+ /** Default shape stroke opacity */
1028
+ export declare const defaultShapeStrokeOpacity = 1;
1029
+
1030
+ /** Default shape stroke visibility */
1031
+ export declare const defaultShapeStrokeVisibility = true;
1032
+
1033
+ /** Default shape visibility */
1034
+ export declare const defaultShapeVisibility = true;
1035
+
1036
+ /** Dimensions of a two-dimensional object */
1037
+ export declare type Dims = {
1038
+ /** The width of the object */
1039
+ width: number;
1040
+ /** The height of the object */
1041
+ height: number;
1042
+ };
1043
+
1044
+ /**
1045
+ * Looks up a color palette by ID
1046
+ *
1047
+ * @param colorPaletteId - The ID of the color palette
1048
+ * @returns The color palette, or `undefined` if no palette has the ID
1049
+ */
1050
+ export declare function findColorPalette(colorPaletteId: string | undefined): ColorPalette | undefined;
1051
+
1052
+ declare type Float16Array = typeof globalThis extends {
1053
+ Float16Array: {
1054
+ prototype: infer TFloat16ArrayPrototype;
1055
+ };
1056
+ } ? TFloat16ArrayPrototype : never;
1057
+
1058
+ /** Union of all natively supported floating-point typed arrays */
1059
+ export declare type FloatArray = Float16Array | Float32Array | Float64Array;
1060
+
1061
+ /**
1062
+ * Constants for the three-round xorshift-multiply finalizer {@link HashUtils.fmix32}
1063
+ *
1064
+ * The finalizer computes `h ^= h >>> s1; h *= m1; h ^= h >>> s2; h *= m2;
1065
+ * h ^= h >>> s3` in 32-bit arithmetic. Shifts must lie in `[1, 31]` and
1066
+ * multipliers must be odd for the finalizer to remain a bijection.
1067
+ */
1068
+ export declare type Fmix32Config = {
1069
+ /** Right shift of the first xorshift round, in bits */
1070
+ s1: number;
1071
+ /** Odd 32-bit multiplier applied after the first xorshift */
1072
+ m1: number;
1073
+ /** Right shift of the second xorshift round, in bits */
1074
+ s2: number;
1075
+ /** Odd 32-bit multiplier applied after the second xorshift */
1076
+ m2: number;
1077
+ /** Right shift of the final xorshift round, in bits */
1078
+ s3: number;
1079
+ };
1080
+
1081
+ /** Configuration to load values from a table column */
1082
+ export declare type FromConfig<TFromExtra = unknown> = Config<"from"> & {
1083
+ /** Specification of what table column to load */
1084
+ from: TableColumnRef & TFromExtra;
1085
+ };
1086
+
1087
+ /** Utility methods for rectangle and dimension geometry */
1088
+ export declare class GeometryUtils {
1089
+ /**
1090
+ * Computes the union of multiple rectangles and returns the smallest rectangle that contains all of them
1091
+ *
1092
+ * @param rects - The rectangles to compute the union of
1093
+ * @returns The smallest rectangle that contains all the input rectangles, or `null` if no rectangles are provided
1094
+ */
1095
+ static union(...rects: Rect[]): Rect | null;
1096
+ /**
1097
+ * Computes the intersection of two rectangles
1098
+ *
1099
+ * @param a - The first rectangle
1100
+ * @param b - The second rectangle
1101
+ * @returns The rectangle covered by both, or `null` if they do not overlap
1102
+ * (touching edges do not count as overlapping)
1103
+ */
1104
+ static intersection(a: Rect, b: Rect): Rect | null;
1105
+ /**
1106
+ * Grows a rectangle by the same amount on every side
1107
+ *
1108
+ * @param rect - The rectangle to grow
1109
+ * @param amount - The amount to move every side outwards by; negative
1110
+ * amounts shrink the rectangle
1111
+ * @returns The grown rectangle
1112
+ */
1113
+ static dilate(rect: Rect, amount: number): Rect;
1114
+ /**
1115
+ * Checks if two dimensions are equal by comparing their width and height properties
1116
+ *
1117
+ * @param a - The first dimensions to compare
1118
+ * @param b - The second dimensions to compare
1119
+ * @returns `true` if the dimensions are equal, `false` otherwise
1120
+ */
1121
+ static dimsEquals(a: Dims, b: Dims): boolean;
1122
+ /**
1123
+ * Checks if two rectangles are equal by comparing their x, y, width, and height properties
1124
+ *
1125
+ * @param a - The first rectangle to compare
1126
+ * @param b - The second rectangle to compare
1127
+ * @returns `true` if the rectangles are equal, `false` otherwise
1128
+ */
1129
+ static rectEquals(a: Rect, b: Rect): boolean;
1130
+ }
1131
+
1132
+ /**
1133
+ * Determines the active source of the given {@link Config}
1134
+ *
1135
+ * If a source is explicitly prioritized using {@link Config.source}, that source is returned.
1136
+ *
1137
+ * Otherwise, the active source is determined by checking for the presence of configuration-specific fields in the following order:
1138
+ * - {@link ConstantConfig}
1139
+ * - {@link FromConfig}
1140
+ * - {@link GroupByConfig}
1141
+ * - {@link RandomConfig}
1142
+ *
1143
+ * @param config - The configuration
1144
+ * @returns The active configuration source, or `undefined` if none is active
1145
+ */
1146
+ export declare function getActiveConfigSource<TSource extends string>(config: Config<TSource>): TSource | undefined;
1147
+
1148
+ /** Configuration to map a categorical table column to values */
1149
+ export declare type GroupByConfig<TMapRequired extends boolean, TGroupByExtra = unknown> = Config<"groupBy"> & {
1150
+ /** Specification of what categorical table column to load and how to map groups to values */
1151
+ groupBy: TableColumnRef & {
1152
+ /** Project-global group-to-value map ID */
1153
+ map: TMapRequired extends true ? string : string | undefined;
1154
+ } & TGroupByExtra;
1155
+ };
1156
+
1157
+ /** A named mapping from string keys (groups) to typed values with an optional default value */
1158
+ export declare type GroupValueMap<TValue> = {
1159
+ /** Map ID, referenced from data object configurations */
1160
+ id: string;
1161
+ /** Human-readable map name */
1162
+ name: string;
1163
+ /**
1164
+ * Mapping from group names to values
1165
+ *
1166
+ * Group names are the table cell values as strings, e.g. `"3"` for a numeric
1167
+ * cell.
1168
+ */
1169
+ values: {
1170
+ [key: string]: TValue;
1171
+ };
1172
+ /** Default value for groups not present in {@link values} */
1173
+ default?: TValue;
1174
+ };
1175
+
1176
+ /**
1177
+ * Utility methods for non-cryptographic hashing
1178
+ *
1179
+ * Hashing a string is split into two steps: {@link hashRaw} reduces the
1180
+ * string to a 32-bit integer, and {@link mix} scrambles that integer together
1181
+ * with a seed. Callers that hash the same key repeatedly with different seeds
1182
+ * can cache the raw hash and only re-run the cheap mixing step. {@link hash}
1183
+ * does both in one call.
1184
+ *
1185
+ * The underlying primitives, {@link fnv1a} and {@link fmix32}, are exposed
1186
+ * for callers that need the plain algorithms without the seeding convention
1187
+ * of the methods above.
1188
+ */
1189
+ export declare class HashUtils {
1190
+ private static readonly _murmur3Config;
1191
+ /**
1192
+ * Computes the raw hash of a string
1193
+ *
1194
+ * Currently {@link fnv1a}. The raw hash is fast and deterministic, but only
1195
+ * weakly mixed: similar keys yield correlated hashes, and the hash of an
1196
+ * empty string is non-zero. Pass the result through {@link mix} before
1197
+ * using it to select from a small range.
1198
+ *
1199
+ * @param key - The string to hash; hashed by UTF-16 code unit
1200
+ * @returns The raw hash, as a non-negative 32-bit integer
1201
+ */
1202
+ static hashRaw(key: string): number;
1203
+ /**
1204
+ * Scrambles a 32-bit integer with a seed
1205
+ *
1206
+ * The seed is XOR-ed into the value, which is then passed through
1207
+ * {@link fmix32}. Consecutive inputs map to unrelated outputs, so the result
1208
+ * is suitable for scattering sequential IDs or raw string hashes over a
1209
+ * small range, e.g. `mix(id, seed) % palette.length`. Different seeds yield
1210
+ * different outputs for the same input.
1211
+ *
1212
+ * @param h - The integer to mix; only its lower 32 bits are used
1213
+ * @param seed - The seed; only its lower 32 bits are used
1214
+ * @returns The mixed value, as a non-negative 32-bit integer
1215
+ */
1216
+ static mix(h: number, seed?: number): number;
1217
+ /**
1218
+ * Computes a seeded 32-bit hash of a string
1219
+ *
1220
+ * Equivalent to `mix(hashRaw(key), seed)`.
1221
+ *
1222
+ * @param key - The string to hash; hashed by UTF-16 code unit
1223
+ * @param seed - The seed; only its lower 32 bits are used
1224
+ * @returns The hash, as a non-negative 32-bit integer
1225
+ */
1226
+ static hash(key: string, seed?: number): number;
1227
+ /**
1228
+ * Computes the 32-bit FNV-1a hash of a string
1229
+ *
1230
+ * Iterates over the UTF-16 code units of the string, XOR-ing each into the
1231
+ * running hash and multiplying by the FNV prime. The hash of an empty string
1232
+ * is the FNV offset basis (`0x811c9dc5`). Code units above `0xff` are XOR-ed
1233
+ * in whole rather than byte-wise, so results for non-Latin-1 text differ
1234
+ * from byte-oriented FNV-1a implementations.
1235
+ *
1236
+ * @see http://www.isthe.com/chongo/tech/comp/fnv/
1237
+ * @param str - The string to hash
1238
+ * @returns The hash, as a non-negative 32-bit integer
1239
+ */
1240
+ static fnv1a(str: string): number;
1241
+ /**
1242
+ * Applies a three-round xorshift-multiply finalizer; defaults to MurmurHash3's constants
1243
+ *
1244
+ * The finalizer is a bijective avalanche step: every input bit affects
1245
+ * every output bit, and distinct 32-bit inputs map to distinct outputs.
1246
+ * Note that `fmix32(0)` is `0`.
1247
+ *
1248
+ * @see https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp
1249
+ * @param h - The integer to finalize; only its lower 32 bits are used
1250
+ * @param c - The constants to use; defaults are the MurmurHash3 finalizer constants
1251
+ * @returns The finalized value, as a non-negative 32-bit integer
1252
+ */
1253
+ static fmix32(h: number, c?: Fmix32Config): number;
1254
+ }
1255
+
1256
+ /** The items of one group of a labels, points or shapes object, highlighted in the viewer */
1257
+ export declare type HighlightedItemGroup = {
1258
+ /**
1259
+ * The object whose items are grouped, by the ID of its labels, points or
1260
+ * shapes; IDs are only unique within each of these lists
1261
+ */
1262
+ annotatedObject: {
1263
+ labelsId: string;
1264
+ } | {
1265
+ pointsId: string;
1266
+ } | {
1267
+ shapesId: string;
1268
+ };
1269
+ /** The categorical table column */
1270
+ groupBy: TableColumnRef;
1271
+ /** The group, i.e. the cell value as a string */
1272
+ group: string;
1273
+ };
1274
+
1275
+ /**
1276
+ * The array types that can hold ID values
1277
+ *
1278
+ * Integer IDs are held by an integer typed array or by 64-bit floats (safe
1279
+ * integers only), string IDs by a plain array.
1280
+ */
1281
+ export declare type IDArray = IntOrUintArray | Float64Array | string[];
1282
+
1283
+ /** Identity similarity transform */
1284
+ export declare const identityTransform: {
1285
+ readonly flip: false;
1286
+ readonly scale: 1;
1287
+ readonly rotation: 0;
1288
+ readonly translation: {
1289
+ readonly x: 0;
1290
+ readonly y: 0;
1291
+ };
1292
+ };
1293
+
1294
+ /**
1295
+ * A {@link RawImage} with {@link imageDefaults} applied
1296
+ */
1297
+ declare type Image_2 = RenderedRasterDataObject<ImageDataSource<string>> & Required<Pick<RawImage, keyof typeof imageDefaults>> & Omit<RawImage, keyof typeof imageDefaults>;
1298
+ export { Image_2 as Image }
1299
+
1300
+ /**
1301
+ * A channel of a two-dimensional raster image
1302
+ *
1303
+ * Channels are only applied to multi-channel image data, as reported by the
1304
+ * image's data provider.
1305
+ */
1306
+ export declare type ImageChannel = {
1307
+ /**
1308
+ * Channel name
1309
+ *
1310
+ * Overrides the channel name provided by the image data provider, if any.
1311
+ *
1312
+ * @defaultValue The name reported by the image data provider, or `undefined`
1313
+ */
1314
+ name?: string;
1315
+ /**
1316
+ * Channel visibility
1317
+ *
1318
+ * Overrides the channel visibility provided by the image data provider, if any.
1319
+ *
1320
+ * @defaultValue The visibility reported by the image data provider, or `true`
1321
+ */
1322
+ visibility?: boolean;
1323
+ /**
1324
+ * Channel opacity, in the range [0, 1]
1325
+ *
1326
+ * Overrides the channel opacity provided by the image data provider, if any.
1327
+ *
1328
+ * @defaultValue The opacity reported by the image data provider, or `1`
1329
+ */
1330
+ opacity?: number;
1331
+ /**
1332
+ * Channel color
1333
+ *
1334
+ * Overrides the channel color provided by the image data provider, if any.
1335
+ *
1336
+ * @defaultValue The color reported by the image data provider, or white for
1337
+ * single-channel image data, or a default color for the channel index
1338
+ * otherwise (see {@link ImageUtils.getDefaultChannelColor})
1339
+ */
1340
+ color?: Color;
1341
+ /**
1342
+ * Channel contrast limits, in the channel's image data value range
1343
+ *
1344
+ * Overrides the channel contrast limits provided by the image data provider, if any.
1345
+ *
1346
+ * @defaultValue The contrast limits reported by the image data provider, or
1347
+ * limits derived from the channel histogram reported by the image data
1348
+ * provider (see {@link ImageUtils.getDefaultContrastLimits}), or the value
1349
+ * range of the channel's data type
1350
+ */
1351
+ contrastLimits?: [number, number];
1352
+ };
1353
+
1354
+ /** The value histogram of a channel, in raw pixel values */
1355
+ export declare type ImageChannelHistogram = {
1356
+ /**
1357
+ * The number of samples per bin, bin `i` of `n` counting the values around
1358
+ * `vmin + i / (n - 1) * (vmax - vmin)` (see
1359
+ * {@link MathUtils.computeHistogram})
1360
+ */
1361
+ hist: number[];
1362
+ /** The values the first and the last bin are centered on, as `[vmin, vmax]` */
1363
+ range: [number, number];
1364
+ };
1365
+
1366
+ /** A single image channel shown on its own, without touching the project */
1367
+ export declare type ImageChannelPreview = {
1368
+ /** The ID of the previewed image */
1369
+ imageId: string;
1370
+ /** The index of the previewed channel (0-based) */
1371
+ channelIndex: number;
1372
+ };
1373
+
1374
+ /**
1375
+ * How the channels of multi-channel image data are displayed
1376
+ *
1377
+ * - `composite`: all visible channels, blended in their colors
1378
+ * - `grayscale`: the active channel alone, in gray
1379
+ * - `color`: the active channel alone, in its color
1380
+ */
1381
+ export declare const ImageChannelViewMode: {
1382
+ readonly composite: "composite";
1383
+ readonly grayscale: "grayscale";
1384
+ readonly color: "color";
1385
+ };
1386
+
1387
+ /** One of the channel view modes of the {@link ImageChannelViewMode} object */
1388
+ export declare type ImageChannelViewMode = (typeof ImageChannelViewMode)[keyof typeof ImageChannelViewMode];
1389
+
1390
+ /**
1391
+ * Loaded image data providing one or more OpenSeadragon-compatible tile sources
1392
+ *
1393
+ * Image data is either multi-channel, in which case it provides one tile source
1394
+ * per channel, addressed by channel index; or it is not, in which case it
1395
+ * provides a single tile source that is not addressed by channel.
1396
+ * {@link ImageData.getSizeC} returns `undefined` for image data that is not multi-channel.
1397
+ *
1398
+ * Multi-channel image data that implements {@link RasterData.getTileData}
1399
+ * provides a single sample ("grayscale value") per pixel and channel, which the
1400
+ * renderer contrast-stretches and colorizes (see
1401
+ * {@link ImageData.getChannelContrastLimits} and
1402
+ * {@link ImageData.getChannelColor}). Multi-channel image data that does not
1403
+ * implement it is free to provide grayscale or RGB tile sources per channel,
1404
+ * which are drawn as they are.
1405
+ */
1406
+ declare interface ImageData_2 extends RasterData {
1407
+ /** Returns the number of channels in the image, or undefined if not multi-channel */
1408
+ getSizeC(): number | undefined;
1409
+ /**
1410
+ * Returns the tile source of a channel, or the only tile source of image data that is not multi-channel
1411
+ *
1412
+ * @param c - The channel index (0-based), required for multi-channel image
1413
+ * data and to be omitted otherwise
1414
+ * @returns The tile source, which can be a URL string, a TileSourceConfig
1415
+ * object, or a CustomTileSource object
1416
+ * @throws Error if `c` is omitted for multi-channel image data, if `c` is
1417
+ * passed for image data that is not multi-channel, or if `c` is out of bounds
1418
+ */
1419
+ getTileSource(c?: number): string | TileSourceConfig | CustomTileSource;
1420
+ /** Returns the name of a specific channel, or undefined if not available */
1421
+ getChannelName?: (c: number) => string | undefined;
1422
+ /** Returns the visibility of a specific channel, or undefined if not available */
1423
+ getChannelVisibility?: (c: number) => boolean | undefined;
1424
+ /** Returns the opacity of a specific channel, or undefined if not available */
1425
+ getChannelOpacity?: (c: number) => number | undefined;
1426
+ /**
1427
+ * Returns the color of a specific channel, or undefined if not available
1428
+ *
1429
+ * Channels without a color (neither configured on the image nor returned
1430
+ * here) are colorized with a default color derived from the channel index
1431
+ * (see {@link ImageUtils.getDefaultChannelColor}), so that multi-channel image data
1432
+ * without any color information renders as distinguishable channels rather
1433
+ * than as a single white blob; the only channel of single-channel image data
1434
+ * is colorized white instead. Data providers should only return colors that
1435
+ * their image metadata actually specifies, and `undefined` for all other
1436
+ * channels, leaving the choice of default colors to the renderer.
1437
+ *
1438
+ * @param c - The channel index (0-based)
1439
+ * @returns The channel's color, or `undefined` if not available
1440
+ */
1441
+ getChannelColor?: (c: number) => Color | undefined;
1442
+ /**
1443
+ * Returns the value histogram of a specific channel, or undefined if not available
1444
+ *
1445
+ * `hist[i]` counts the channel values that fall into bin `i`, with bins
1446
+ * spread evenly over `range`: the first bin corresponds to the range's lower
1447
+ * bound, the last bin to its upper bound. The histogram may be computed from
1448
+ * a downsampled resolution level. The renderer derives default contrast
1449
+ * limits from the histogram for channels without contrast limits (neither
1450
+ * configured on the image nor returned by
1451
+ * {@link ImageData.getChannelContrastLimits}, see
1452
+ * {@link ImageUtils.getDefaultContrastLimits}). As the renderer calls this on every
1453
+ * synchronization, implementations should return a precomputed histogram
1454
+ * rather than compute one on each call.
1455
+ *
1456
+ * @param c - The channel index (0-based)
1457
+ * @returns The channel's histogram, as bin counts and the value range the
1458
+ * bins span, or `undefined` if not available
1459
+ */
1460
+ getChannelHistogram?: (c: number) => ImageChannelHistogram | undefined;
1461
+ /**
1462
+ * Returns the range the data type of a specific channel can hold, or undefined if not available
1463
+ *
1464
+ * The full range of integer channel data of at most 32 bits, e.g.
1465
+ * `[0, 65535]` for unsigned 16-bit samples. Other channel data has no such
1466
+ * range and returns `undefined`.
1467
+ *
1468
+ * @param c - The channel index (0-based)
1469
+ * @returns The data type range, as `[min, max]`, or `undefined` if not
1470
+ * available
1471
+ */
1472
+ getChannelDataTypeRange?: (c: number) => [number, number] | undefined;
1473
+ /**
1474
+ * Returns the contrast limits of a specific channel, or undefined if not available
1475
+ *
1476
+ * The renderer scales each channel value linearly between the contrast
1477
+ * limits, clamps the result to `[0, 1]` and multiplies it with the channel's
1478
+ * color. Channels without contrast limits (neither configured on the image
1479
+ * nor returned here) are stretched between quantile-based limits derived
1480
+ * from the channel's histogram, if {@link ImageData.getChannelHistogram}
1481
+ * provides one (see {@link ImageUtils.getDefaultContrastLimits}), then over
1482
+ * the data type range declared by {@link ImageData.getChannelDataTypeRange},
1483
+ * and otherwise over the value range that the data type of their channel data
1484
+ * can hold, as returned by {@link ImageUtils.getDataTypeRange} (the full
1485
+ * integer range for integer typed arrays, `[0, 1]` for floating-point typed
1486
+ * arrays).
1487
+ *
1488
+ * @param c - The channel index (0-based)
1489
+ * @returns The channel's contrast limits, in the channel's value range, or
1490
+ * `undefined` if not available
1491
+ */
1492
+ getChannelContrastLimits?: (c: number) => [number, number] | undefined;
1493
+ }
1494
+ export { ImageData_2 as ImageData }
1495
+
1496
+ /**
1497
+ * Data provider for raster images
1498
+ *
1499
+ * @typeParam TImageDataSource - The data source type this data provider opens
1500
+ * @typeParam TImageData - The {@link ImageData} type produced by this data
1501
+ * provider
1502
+ * @typeParam TNormalizedImageDataSource - The normalized data source type
1503
+ * produced by `normalize` and accepted by `load`
1504
+ */
1505
+ export declare interface ImageDataProvider<TImageDataSource extends ImageDataSource, TImageData extends ImageData_2, TNormalizedImageDataSource extends TImageDataSource = TImageDataSource> extends DataProvider<TImageDataSource, TImageData, TNormalizedImageDataSource> {
1506
+ }
1507
+
1508
+ /**
1509
+ * A {@link RawImageDataSource} with {@link imageDataSourceDefaults} applied
1510
+ */
1511
+ export declare type ImageDataSource<TType extends string = string> = DataSource<TType> & Required<Pick<RawImageDataSource<TType>, keyof typeof imageDataSourceDefaults>> & Omit<RawImageDataSource<TType>, keyof typeof imageDataSourceDefaults>;
1512
+
1513
+ /**
1514
+ * Default values for {@link RawImageDataSource}
1515
+ */
1516
+ export declare const imageDataSourceDefaults: {};
1517
+
1518
+ /**
1519
+ * Default values for {@link RawImage}
1520
+ */
1521
+ export declare const imageDefaults: {
1522
+ readonly channelViewMode: "composite";
1523
+ readonly activeChannel: 0;
1524
+ };
1525
+
1526
+ /** Utility methods for resolving and defaulting image channel settings */
1527
+ export declare class ImageUtils {
1528
+ /**
1529
+ * Returns the color of a channel
1530
+ *
1531
+ * The color configured on the image wins, then the one its data states, and
1532
+ * the only channel of single-channel image data is white, as a grayscale
1533
+ * image rather than in the red the index-based default would give it (see
1534
+ * {@link ImageUtils.getDefaultChannelColor}).
1535
+ *
1536
+ * @param image - The image
1537
+ * @param data - The image data providing the channel
1538
+ * @param c - The channel index (0-based)
1539
+ * @returns The channel's color
1540
+ */
1541
+ static getChannelColor(image: Image_2, data: ImageData_2, c: number): Color;
1542
+ /**
1543
+ * Returns the contrast limits of a channel
1544
+ *
1545
+ * The limits configured on the image win over those its data states.
1546
+ * Channels with neither are stretched between quantile-based limits derived
1547
+ * from their histogram (see {@link ImageUtils.getDefaultContrastLimits}), if
1548
+ * the data provides one, and otherwise over the range the data declares for
1549
+ * their data type.
1550
+ *
1551
+ * @param image - The image
1552
+ * @param data - The image data providing the channel
1553
+ * @param c - The channel index (0-based)
1554
+ * @returns The channel's contrast limits, or `undefined` if the data
1555
+ * provides neither limits, a histogram nor a data type range
1556
+ */
1557
+ static getChannelContrastLimits(image: Image_2, data: ImageData_2, c: number): [number, number] | undefined;
1558
+ /**
1559
+ * Returns the visibility of a channel
1560
+ *
1561
+ * The visibility configured on the image wins over the one its data states,
1562
+ * and channels with neither are visible.
1563
+ *
1564
+ * @param image - The image
1565
+ * @param data - The image data providing the channel
1566
+ * @param c - The channel index (0-based)
1567
+ * @returns Whether the channel is visible
1568
+ */
1569
+ static getChannelVisibility(image: Image_2, data: ImageData_2, c: number): boolean;
1570
+ /**
1571
+ * Returns the opacity of a channel
1572
+ *
1573
+ * The opacity configured on the image wins over the one its data states,
1574
+ * and channels with neither are fully opaque.
1575
+ *
1576
+ * @param image - The image
1577
+ * @param data - The image data providing the channel
1578
+ * @param c - The channel index (0-based)
1579
+ * @returns The channel's opacity, in `[0, 1]`
1580
+ */
1581
+ static getChannelOpacity(image: Image_2, data: ImageData_2, c: number): number;
1582
+ /**
1583
+ * Returns the channel an image shows in the single-channel view modes
1584
+ *
1585
+ * The image's active channel is bounded to the channels the data has, so
1586
+ * that an image kept from data with more channels still shows one.
1587
+ *
1588
+ * @param image - The image
1589
+ * @param sizeC - The number of channels the image data has
1590
+ * @returns The channel index (0-based)
1591
+ */
1592
+ static getActiveChannel(image: Image_2, sizeC: number): number;
1593
+ /**
1594
+ * Returns a default color for a channel, for use when no channel colors are
1595
+ * known
1596
+ *
1597
+ * The first six channels map to red, green, blue, yellow, cyan, and magenta.
1598
+ * Further channels are assigned hues 128 degrees apart, with saturation and
1599
+ * brightness decreasing by 0.05 every ten channels. Channel indices wrap
1600
+ * around after 100, so that saturation and brightness stay above 0.5.
1601
+ * Colors are not guaranteed to be unique.
1602
+ *
1603
+ * Resembles `ImageChannel.getDefaultChannelColor` in QuPath v0.7.0, except
1604
+ * that yellow, cyan, and magenta have been replaced by pure versions (255
1605
+ * for the two highest components, 0 for the lowest), and that QuPath wraps
1606
+ * after 360 channels instead, yielding dim colors and eventually black.
1607
+ *
1608
+ * @param c - The channel index, a non-negative integer
1609
+ * @returns The default color for the channel
1610
+ */
1611
+ static getDefaultChannelColor(c: number): Color;
1612
+ /**
1613
+ * Returns quantile-based contrast limits derived from a channel histogram,
1614
+ * for use as default contrast limits when no contrast limits are known
1615
+ *
1616
+ * The histogram's `hist[i]` counts the values that fall into bin `i`, with
1617
+ * bins spread evenly over `range`: bin `0` maps to the range's lower bound,
1618
+ * the last bin to its upper bound, and each bin in between to
1619
+ * `vmin + i / (n - 1) * (vmax - vmin)` (see
1620
+ * {@link MathUtils.computeHistogram}). The lower limit is the value of the
1621
+ * first bin at which the cumulative count from the bottom reaches the
1622
+ * fraction `qlow` of the total count, the upper limit is the value of the
1623
+ * first bin at which the cumulative count from the top reaches the fraction
1624
+ * `1 - qhigh`; i.e., the fraction `qlow` of the values is clipped at the
1625
+ * bottom and the fraction `1 - qhigh` at the top. Only non-empty bins are
1626
+ * considered, so quantiles of `0` and `1` yield the first and last non-empty
1627
+ * bin, respectively. Values that fall into the same bin cannot be told
1628
+ * apart, so the limits are only as precise as the bins.
1629
+ *
1630
+ * Histograms with fewer than two bins, histograms whose counts sum to zero
1631
+ * and degenerate ranges return `range` as is. So do histograms whose clipped
1632
+ * limits would not be ascending (upper bin at or below lower bin), which
1633
+ * happens if more than `qhigh - qlow` of the values fall into a single bin,
1634
+ * e.g. for sparse channels that are mostly background, or if `qhigh` is
1635
+ * below `qlow`, and a `qlow` above `1`, which no bin can reach.
1636
+ *
1637
+ * @param histogram - The channel histogram, as bin counts and value range
1638
+ * @param qlow - The quantile of the lower limit, in `[0, 1]`
1639
+ * @param qhigh - The quantile of the upper limit, in `[0, 1]`, above `qlow`
1640
+ * @returns The contrast limits, as `[low, high]` in the histogram's value
1641
+ * range, with `low < high` unless the range is degenerate
1642
+ */
1643
+ static getDefaultContrastLimits(histogram: ImageChannelHistogram, qlow?: number, qhigh?: number): [number, number];
1644
+ /**
1645
+ * Returns the value range that an integer type can hold
1646
+ *
1647
+ * @param bits - The number of bits per value, at most 32
1648
+ * @param signed - Whether the type is signed
1649
+ * @returns The value range, as `[min, max]`
1650
+ */
1651
+ static getIntegerTypeRange(bits: number, signed: boolean): [number, number];
1652
+ /**
1653
+ * Returns the value range that the type of the given array can hold, for use
1654
+ * as default contrast limits of image channel data
1655
+ *
1656
+ * Integer typed arrays span their full integer range, floating-point typed
1657
+ * arrays are taken to hold normalized values in `[0, 1]`.
1658
+ *
1659
+ * @param values - The array whose value range to return
1660
+ * @returns The value range, as `[min, max]`
1661
+ */
1662
+ static getDataTypeRange(values: TypedArray): [number, number];
1663
+ }
1664
+
1665
+ /** Union of all natively supported signed integer typed arrays */
1666
+ export declare type IntArray = Int8Array | Int16Array | Int32Array;
1667
+
1668
+ /**
1669
+ * Interaction mode, determining how mouse events are interpreted
1670
+ */
1671
+ export declare type InteractionMode = "pan" | "drawRectangle" | "drawPolygon" | "drawFreehand";
1672
+
1673
+ /** Union of all natively supported integer typed arrays */
1674
+ export declare type IntOrUintArray = IntArray | UintArray;
1675
+
1676
+ /**
1677
+ * Determines whether the given object is a {@link ConstantConfig}
1678
+ *
1679
+ * @param obj - The object to check
1680
+ * @returns Whether the object is a {@link ConstantConfig}
1681
+ */
1682
+ export declare function isConstantConfig<TValue, TConstantExtra = unknown>(obj: unknown): obj is ConstantConfig<TValue, TConstantExtra>;
1683
+
1684
+ /**
1685
+ * Determines whether the given object is a {@link FromConfig}
1686
+ *
1687
+ * @param obj - The object to check
1688
+ * @returns Whether the object is a {@link FromConfig}
1689
+ */
1690
+ export declare function isFromConfig<TFromExtra = unknown>(obj: unknown): obj is FromConfig<TFromExtra>;
1691
+
1692
+ /**
1693
+ * Determines whether the given object is a {@link GroupByConfig}
1694
+ *
1695
+ * @param obj - The object to check
1696
+ * @returns Whether the object is a {@link GroupByConfig}
1697
+ */
1698
+ export declare function isGroupByConfig<TMapRequired extends boolean, TGroupByExtra = unknown>(obj: unknown): obj is GroupByConfig<TMapRequired, TGroupByExtra>;
1699
+
1700
+ /**
1701
+ * Determines whether the given object is a {@link RandomConfig}
1702
+ *
1703
+ * @param obj - The object to check
1704
+ * @returns Whether the object is a {@link RandomConfig}
1705
+ */
1706
+ export declare function isRandomConfig<TRandomExtra = unknown>(obj: unknown): obj is RandomConfig<TRandomExtra>;
1707
+
1708
+ /**
1709
+ * A {@link Data} object that contains an indexed collection of items
1710
+ *
1711
+ * Extended by data types whose storage is addressable by item IDs
1712
+ * (e.g. points, shapes, tables).
1713
+ *
1714
+ * Implementations have to be immutable: the values returned by their accessors
1715
+ * must not change over the lifetime of the object, and the arrays they return
1716
+ * have to keep their identity across calls (i.e. be memoized rather than built
1717
+ * anew on every call). Consumers rely on that identity to detect change - a
1718
+ * renderer that compares the previous `getIds()` result against the current one
1719
+ * re-uploads its GPU buffers whenever the two differ - so an implementation
1720
+ * returning a fresh array each time is correct but defeats every such cache.
1721
+ */
1722
+ export declare interface ItemsData extends Data {
1723
+ /**
1724
+ * Returns an array of item IDs
1725
+ *
1726
+ * IDs are either integers, held by an integer typed array or by 64-bit
1727
+ * floats (safe integers only), or strings, held by a plain array (see
1728
+ * `IDArray`). The returned array is owned by this data object: callers must
1729
+ * not modify it, and every call returns the very same array (see
1730
+ * {@link ItemsData}). IDs are expected to be unique, which is not checked.
1731
+ *
1732
+ * @returns The item IDs
1733
+ */
1734
+ getIds(): IDArray;
1735
+ /**
1736
+ * Returns the total number of items
1737
+ *
1738
+ * @returns The item count
1739
+ */
1740
+ getSize(): number;
1741
+ /**
1742
+ * Returns the item names if available, otherwise undefined
1743
+ *
1744
+ * Optional: data types that never carry item names need not implement it.
1745
+ *
1746
+ * The returned array is owned by this data object: callers must not modify it,
1747
+ * and every call returns the very same array (see {@link ItemsData}).
1748
+ *
1749
+ * @returns The item names, or `undefined` if not available
1750
+ */
1751
+ getNames?: () => string[] | undefined;
1752
+ }
1753
+
1754
+ /**
1755
+ * Utility methods for JSON serialization with support for non-finite numbers
1756
+ *
1757
+ * `NaN`, `Infinity` and `-Infinity` are encoded as the sentinel strings
1758
+ * `"__NaN__"`, `"__PositiveInfinity__"` and `"__NegativeInfinity__"`, which
1759
+ * {@link JSONUtils.parse} decodes back into numbers. Strings that happen to
1760
+ * equal a sentinel are therefore not round-trip safe.
1761
+ */
1762
+ export declare class JSONUtils {
1763
+ /**
1764
+ * Serializes a value to JSON, encoding non-finite numbers as sentinel strings
1765
+ *
1766
+ * Behaves like `JSON.stringify` without indentation: `toJSON` methods are
1767
+ * honored, and object properties that cannot be represented (`undefined`,
1768
+ * functions, symbols) are omitted.
1769
+ *
1770
+ * It differs from `JSON.stringify` where the latter is lossy: such a value
1771
+ * throws instead of yielding `undefined` when it is the top-level value, and
1772
+ * throws instead of being written as `null` when it is an array element. It
1773
+ * also does not detect circular references, which overflow the stack rather
1774
+ * than throwing a `TypeError`.
1775
+ *
1776
+ * @param value - The value to serialize
1777
+ * @param options - Optional `stable` flag, sorting object keys alphabetically
1778
+ * so that the output is independent of property insertion order
1779
+ * (default `false`)
1780
+ * @throws If the value itself, or any array element it contains, cannot be
1781
+ * represented in JSON
1782
+ */
1783
+ static stringify(value: unknown, options?: {
1784
+ stable?: boolean;
1785
+ }): string;
1786
+ /**
1787
+ * Parses JSON, decoding the sentinel strings written by
1788
+ * {@link JSONUtils.stringify} back into `NaN`, `Infinity` and `-Infinity`
1789
+ *
1790
+ * @param text - The JSON text to parse
1791
+ * @throws If the text is not valid JSON
1792
+ */
1793
+ static parse(text: string): unknown;
1794
+ /** Whether a value can be represented in JSON */
1795
+ private static _isStringifiable;
1796
+ /**
1797
+ * Serializes a single primitive value (or object key) using
1798
+ * `JSON.stringify`, replacing non-finite numbers with sentinel strings
1799
+ *
1800
+ * The replacer reads the raw value from the holder object, because
1801
+ * `JSON.stringify` would otherwise pass the already-converted value (`null`
1802
+ * for non-finite numbers) to the replacer.
1803
+ */
1804
+ private static _stringifyPrimitive;
1805
+ }
1806
+
1807
+ /**
1808
+ * A {@link RawLabels} with {@link labelsDefaults} applied
1809
+ */
1810
+ export declare type Labels = RenderedRasterDataObject<LabelsDataSource<string>> & Required<Pick<RawLabels, keyof typeof labelsDefaults>> & Omit<RawLabels, keyof typeof labelsDefaults>;
1811
+
1812
+ /**
1813
+ * Loaded label image data providing a tiled, multi-resolution integer raster
1814
+ *
1815
+ * Each pixel value represents a label (segment) ID. Unlike points and shapes, a
1816
+ * label image does not enumerate its labels: their IDs are only known per
1817
+ * tile, as the tiles are read, so that arbitrarily large label images can be
1818
+ * opened without scanning them.
1819
+ */
1820
+ export declare interface LabelsData extends RasterData {
1821
+ /**
1822
+ * Extracts the label IDs of an invalidated tile
1823
+ *
1824
+ * Label images always carry values rather than colors, so unlike for
1825
+ * {@link RasterData.getTileData} this is not optional, and the values are
1826
+ * integers (signed or unsigned, of up to 32 bits).
1827
+ *
1828
+ * @param event - The tile invalidation event
1829
+ * @returns The label IDs of the invalidated tile, one per raster pixel in
1830
+ * row-major order, along with the width and height of the raster in pixels
1831
+ * @throws Error if the event does not contain label image data
1832
+ */
1833
+ getTileData(event: default_2.TileInvalidatedEvent): Promise<{
1834
+ values: IntOrUintArray;
1835
+ width: number;
1836
+ height: number;
1837
+ }>;
1838
+ }
1839
+
1840
+ /**
1841
+ * Data provider for label images
1842
+ *
1843
+ * @typeParam TLabelsDataSource - The data source type this data provider opens
1844
+ * @typeParam TLabelsData - The {@link LabelsData} type produced by this data
1845
+ * provider
1846
+ * @typeParam TNormalizedLabelsDataSource - The normalized data source type
1847
+ * produced by `normalize` and accepted by `load`
1848
+ */
1849
+ export declare interface LabelsDataProvider<TLabelsDataSource extends LabelsDataSource, TLabelsData extends LabelsData, TNormalizedLabelsDataSource extends TLabelsDataSource = TLabelsDataSource> extends AnnotatedDataProvider<TLabelsDataSource, TLabelsData, TNormalizedLabelsDataSource> {
1850
+ }
1851
+
1852
+ /**
1853
+ * A {@link RawLabelsDataSource} with {@link labelsDataSourceDefaults} applied
1854
+ */
1855
+ export declare type LabelsDataSource<TType extends string = string> = AnnotatedDataSource<TType> & Required<Pick<RawLabelsDataSource<TType>, keyof typeof labelsDataSourceDefaults>> & Omit<RawLabelsDataSource<TType>, keyof typeof labelsDataSourceDefaults>;
1856
+
1857
+ /**
1858
+ * Default values for {@link RawLabelsDataSource}
1859
+ */
1860
+ export declare const labelsDataSourceDefaults: {};
1861
+
1862
+ /**
1863
+ * Default values for {@link RawLabels}
1864
+ */
1865
+ export declare const labelsDefaults: {
1866
+ readonly labelColor: {
1867
+ readonly random: {
1868
+ readonly palette: "distinct";
1869
+ };
1870
+ };
1871
+ readonly labelVisibility: {
1872
+ readonly constant: {
1873
+ readonly value: true;
1874
+ };
1875
+ };
1876
+ readonly labelOpacity: {
1877
+ readonly constant: {
1878
+ readonly value: 1;
1879
+ };
1880
+ };
1881
+ };
1882
+
1883
+ /**
1884
+ * A {@link RawLayer} with {@link layerDefaults} applied
1885
+ */
1886
+ export declare type Layer = Model & Required<Pick<RawLayer, keyof typeof layerDefaults>> & Omit<RawLayer, keyof typeof layerDefaults>;
1887
+
1888
+ /**
1889
+ * Default values for {@link RawLayer}
1890
+ */
1891
+ export declare const layerDefaults: {
1892
+ readonly transform: {
1893
+ readonly flip: false;
1894
+ readonly scale: 1;
1895
+ readonly rotation: 0;
1896
+ readonly translation: {
1897
+ readonly x: 0;
1898
+ readonly y: 0;
1899
+ };
1900
+ };
1901
+ readonly visibility: true;
1902
+ readonly opacity: 1;
1903
+ readonly pointSizeFactor: 1;
1904
+ };
1905
+
1906
+ /** The marker shapes that points can be rendered as */
1907
+ export declare const Marker: {
1908
+ readonly Cross: 0;
1909
+ readonly Diamond: 1;
1910
+ readonly Square: 2;
1911
+ readonly TriangleUp: 3;
1912
+ readonly Star: 4;
1913
+ readonly Clobber: 5;
1914
+ readonly Disc: 6;
1915
+ readonly HBar: 7;
1916
+ readonly VBar: 8;
1917
+ readonly TailedArrow: 9;
1918
+ readonly TriangleDown: 10;
1919
+ readonly Ring: 11;
1920
+ readonly X: 12;
1921
+ readonly Arrow: 13;
1922
+ readonly Gaussian: 14;
1923
+ };
1924
+
1925
+ /** One of the marker shapes of the {@link Marker} object, as its index */
1926
+ export declare type Marker = (typeof Marker)[keyof typeof Marker];
1927
+
1928
+ /**
1929
+ * Marker configuration
1930
+ *
1931
+ * When sourced from a table column, numerical values are interpreted as
1932
+ * {@link Marker} indices (e.g. `0` = Cross, `6` = Disc).
1933
+ */
1934
+ export declare type MarkerConfig = ConstantConfig<Marker> | FromConfig | GroupByConfig<false>;
1935
+
1936
+ /** Ordered palette of marker shapes, for distinguishing categorical groups */
1937
+ export declare const markerPalette: (0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14)[];
1938
+
1939
+ /**
1940
+ * Utility methods for numeric clamping, remapping, alignment, rounding,
1941
+ * medians, histograms and counts
1942
+ */
1943
+ export declare class MathUtils {
1944
+ /**
1945
+ * Clamps a value to the range `[min, max]`
1946
+ *
1947
+ * @param value - The value to clamp
1948
+ * @param min - Lower bound
1949
+ * @param max - Upper bound
1950
+ * @returns The clamped value
1951
+ */
1952
+ static clamp(value: number, min: number, max: number): number;
1953
+ /**
1954
+ * Linearly maps a value from one range to another
1955
+ *
1956
+ * Values outside `from` are extrapolated, not clamped; clamp at the call
1957
+ * site where the domain is known. Swapping `from` and `to` yields the
1958
+ * inverse mapping.
1959
+ *
1960
+ * @param value - The value to map
1961
+ * @param from - The source range, as `[min, max]`, with `min !== max`
1962
+ * @param to - The target range, as `[min, max]`
1963
+ * @returns The mapped value
1964
+ * @throws Error if `from` is degenerate
1965
+ */
1966
+ static remap(value: number, from: [number, number], to: [number, number]): number;
1967
+ /**
1968
+ * Aligns a positive number `n` to the next multiple of `m`
1969
+ *
1970
+ * If `n` is already a multiple of `m`, returns `n`.
1971
+ * Otherwise, returns the smallest multiple of `m` that is greater than `n`.
1972
+ *
1973
+ * @param n - The non-negative number to align
1974
+ * @param m - The strictly positive multiple to align to
1975
+ * @returns The aligned number
1976
+ * @throws Error if `n` is negative, or if `m` is not strictly positive
1977
+ */
1978
+ static align(n: number, m: number): number;
1979
+ /**
1980
+ * Rounds a value to the decimal places that a step needs
1981
+ *
1982
+ * Steps of `1` or more round to whole numbers, `0.1` to one decimal place,
1983
+ * `0.05` to two. Stepping through a range adds floating-point noise that this
1984
+ * rounds away, e.g. `0.30000000000000004` becomes `0.3` for a step of `0.1`.
1985
+ *
1986
+ * @param value - The value to round
1987
+ * @param step - The strictly positive step
1988
+ * @returns The rounded value
1989
+ * @throws Error if `step` is not strictly positive
1990
+ */
1991
+ static roundToStepDecimals(value: number, step: number): number;
1992
+ /**
1993
+ * Computes the weighted median of numeric values
1994
+ *
1995
+ * Returns the smallest value whose cumulative weight, in ascending order of
1996
+ * the values, reaches half the total weight. If the total weight is zero,
1997
+ * all values are weighted equally instead.
1998
+ *
1999
+ * @param values - The non-empty values to compute the weighted median of
2000
+ * @param weights - The non-negative weight of each value
2001
+ * @returns The weighted median
2002
+ * @throws Error if `values` is empty, or if `weights` has a different length
2003
+ */
2004
+ static computeWeightedMedian(values: TypedArray, weights: TypedArray): number;
2005
+ /**
2006
+ * Computes the range of numeric values, as their minimum and maximum
2007
+ *
2008
+ * Non-finite values (`NaN`, infinities) are ignored. If no finite value is
2009
+ * found (e.g. for empty arrays), the empty range `[Infinity, -Infinity]` is
2010
+ * returned; callers can detect it by checking that the lower bound exceeds
2011
+ * the upper bound.
2012
+ *
2013
+ * The values are traversed on the main thread, yielding to the event loop
2014
+ * periodically so the UI stays responsive for large arrays (see
2015
+ * {@link AsyncUtils.forEach}). Aborting the signal rejects with its reason.
2016
+ *
2017
+ * @param values - The values to compute the range of
2018
+ * @param options - Optional abort signal
2019
+ * @returns A promise that resolves to the range, as `[min, max]`
2020
+ */
2021
+ static computeRange(values: TypedArray, options?: {
2022
+ signal?: AbortSignal;
2023
+ }): Promise<[number, number]>;
2024
+ /**
2025
+ * Computes the histogram of numeric values over a given value range
2026
+ *
2027
+ * `hist[i]` counts the values that are closest to bin `i`, with bins spread
2028
+ * evenly over `range`: bin `0` maps to the range's lower bound, the last bin
2029
+ * to its upper bound, and each bin in between to `vmin + i / (bins - 1) *
2030
+ * (vmax - vmin)`. Values outside the range are counted in the nearest edge
2031
+ * bin, non-finite values (`NaN`, infinities) are ignored. If the range is
2032
+ * degenerate (upper bound not above lower bound), or if `bins` is `1`, all
2033
+ * values fall into bin `0`.
2034
+ *
2035
+ * If `sample` is positive and smaller than the number of values, the
2036
+ * histogram is estimated from `sample` values drawn uniformly with
2037
+ * replacement, using the seeded generator of
2038
+ * {@link RandomUtils.createUint32RNG}; the counts then sum to `sample`
2039
+ * (minus ignored non-finite values) rather than to the number of values.
2040
+ * Sampling is deterministic for a given `seed`. Otherwise, every value is
2041
+ * counted exactly once.
2042
+ *
2043
+ * The values are traversed on the main thread, yielding to the event loop
2044
+ * periodically so the UI stays responsive for large arrays (see
2045
+ * {@link AsyncUtils.forEach}). Aborting the signal rejects with its reason.
2046
+ *
2047
+ * @param values - The values to compute the histogram of
2048
+ * @param range - The value range the bins span, as `[min, max]`
2049
+ * @param options - Optional abort signal (`signal`), number of bins
2050
+ * (`bins`, a positive integer, defaults to `1024`), number of values to
2051
+ * sample (`sample`; omitting it, `0`, or at least the number of values
2052
+ * disables sampling), and seed for sampling (`seed`, defaults to `0`)
2053
+ * @returns A promise that resolves to the histogram, as bin counts (`hist`)
2054
+ * and the given value range (`range`)
2055
+ */
2056
+ static computeHistogram(values: TypedArray, range: [number, number], options?: {
2057
+ signal?: AbortSignal;
2058
+ bins?: number;
2059
+ sample?: number;
2060
+ seed?: number;
2061
+ }): Promise<{
2062
+ hist: number[];
2063
+ range: [number, number];
2064
+ }>;
2065
+ /**
2066
+ * Redistributes the counts of a histogram over equal bins of another range
2067
+ *
2068
+ * The new bins split `range` into `bins` equal intervals, the upper bound
2069
+ * counting in the last one. Each bin of `histogram` is counted in the new bin
2070
+ * that its value falls into (see {@link computeHistogram}), or dropped if
2071
+ * its value is outside `range`. If `range` is degenerate (upper bound not
2072
+ * above lower bound), all counts fall into bin `0`.
2073
+ *
2074
+ * @param histogram - The histogram to redistribute, as bin counts (`hist`)
2075
+ * and the value range they span (`range`)
2076
+ * @param range - The value range the new bins span, as `[min, max]`
2077
+ * @param bins - The number of new bins, a positive integer
2078
+ * @returns The redistributed histogram, as the counts of the new bins
2079
+ * (`hist`) and the given value range (`range`)
2080
+ */
2081
+ static rebinHistogram(histogram: {
2082
+ hist: number[];
2083
+ range: [number, number];
2084
+ }, range: [number, number], bins: number): {
2085
+ hist: number[];
2086
+ range: [number, number];
2087
+ };
2088
+ /**
2089
+ * Counts the number of occurrences of every distinct value
2090
+ *
2091
+ * The counts are keyed by value, in the order the values first occur.
2092
+ * Distinctness follows `Map` key equality, i.e. `NaN` counts as one value
2093
+ * and `0` and `-0` as the same one.
2094
+ *
2095
+ * The values are traversed on the main thread, yielding to the event loop
2096
+ * periodically so the UI stays responsive for large arrays (see
2097
+ * {@link AsyncUtils.forEach}). Aborting the signal rejects with its reason.
2098
+ *
2099
+ * @typeParam T - Element type of the values
2100
+ * @param values - The values to count
2101
+ * @param options - Optional abort signal
2102
+ * @returns A promise that resolves to the count of every distinct value, in
2103
+ * the order the values first appear
2104
+ */
2105
+ static computeUniqueValueCounts<T>(values: TypedArrayOrArray<T>, options?: {
2106
+ signal?: AbortSignal;
2107
+ }): Promise<Map<T, number>>;
2108
+ }
2109
+
2110
+ /**
2111
+ * A {@link RawModel} with {@link modelDefaults} applied
2112
+ */
2113
+ export declare type Model = object & Required<Pick<RawModel, keyof typeof modelDefaults>> & Omit<RawModel, keyof typeof modelDefaults>;
2114
+
2115
+ /**
2116
+ * Default values for {@link RawModel}
2117
+ */
2118
+ export declare const modelDefaults: {};
2119
+
2120
+ /** A geometry consisting of one or more {@link Polygon}s */
2121
+ export declare type MultiPolygon = {
2122
+ /** The individual polygons that make up this multi-polygon */
2123
+ polygons: Polygon[];
2124
+ };
2125
+
2126
+ /**
2127
+ * Utility methods for coercing untrusted values to numbers
2128
+ *
2129
+ * Numbers, bigints and non-blank strings are accepted; everything else, and
2130
+ * everything that does not coerce to a finite number, is rejected. The
2131
+ * `tryParse*` methods report rejection by returning `undefined`, the `parse*`
2132
+ * methods by throwing.
2133
+ */
2134
+ export declare class NumberUtils {
2135
+ private static readonly _minSafeBigInt;
2136
+ private static readonly _maxSafeBigInt;
2137
+ /**
2138
+ * Parses a value as a finite number
2139
+ *
2140
+ * @param value - The value to parse
2141
+ * @returns The parsed number
2142
+ * @throws Error if the value is not a finite number
2143
+ */
2144
+ static parseFinite(value: unknown): number;
2145
+ /**
2146
+ * Parses a value as a safe integer
2147
+ *
2148
+ * @param value - The value to parse
2149
+ * @returns The parsed integer
2150
+ * @throws Error if the value is not a safe integer
2151
+ */
2152
+ static parseSafeInt(value: unknown): number;
2153
+ /**
2154
+ * Parses a value as a finite number, without throwing
2155
+ *
2156
+ * A bigint outside of the safe integer range loses precision when converted:
2157
+ * by default this is only warned about, `requireSafeBigInt` rejects it.
2158
+ *
2159
+ * @param value - The value to parse
2160
+ * @param options - Set `requireSafeBigInt` to reject bigints that are outside
2161
+ * of the safe integer range, rather than converting them with a warning
2162
+ * @returns The parsed number, or `undefined` if the value is not a finite
2163
+ * number
2164
+ */
2165
+ static tryParseFinite(value: unknown, options?: {
2166
+ requireSafeBigInt?: boolean;
2167
+ }): number | undefined;
2168
+ /**
2169
+ * Parses a value as a safe integer, without throwing
2170
+ *
2171
+ * @param value - The value to parse
2172
+ * @returns The parsed integer, or `undefined` if the value is not a safe
2173
+ * integer
2174
+ */
2175
+ static tryParseSafeInt(value: unknown): number | undefined;
2176
+ }
2177
+
2178
+ /**
2179
+ * Opacity configuration
2180
+ *
2181
+ * Numerical table values are interpreted as opacities between `0` (fully transparent) and `1` (fully opaque).
2182
+ */
2183
+ export declare type OpacityConfig = ConstantConfig<number> | FromConfig | GroupByConfig<true>;
2184
+
2185
+ /**
2186
+ * OpenSeadragon options, as consumed by the `OpenSeadragonContext` of
2187
+ * `@tissuumaps/render`
2188
+ *
2189
+ * @see https://openseadragon.github.io/docs/OpenSeadragon.html#.Options
2190
+ */
2191
+ export declare type OpenSeadragonOptions = {
2192
+ /** Options applied to the viewer and its tiled images */
2193
+ viewerOptions: OpenSeadragonViewerOptions;
2194
+ /** Options applied while the viewer is animating */
2195
+ viewerAnimationStartOptions: OpenSeadragonViewerOptions;
2196
+ /**
2197
+ * Options applied once the viewer stopped animating, on top of the restored
2198
+ * pre-animation values
2199
+ */
2200
+ viewerAnimationFinishOptions: OpenSeadragonViewerOptions;
2201
+ };
2202
+
2203
+ /**
2204
+ * OpenSeadragon viewer options, without options requiring a DOM element reference
2205
+ *
2206
+ * Viewer options may originate from a serialized project, which cannot carry DOM
2207
+ * element references. Options taking an element are therefore either narrowed to
2208
+ * an element ID or disallowed. In addition, `element` is omitted, as the viewer
2209
+ * sets it to its own container element (which takes precedence over
2210
+ * OpenSeadragon's `id` option), and `compositeOperation` is omitted, as viewer
2211
+ * options are applied to every tiled image in the world, which would overwrite
2212
+ * the composite operations that the renderers set per tiled image.
2213
+ */
2214
+ export declare type OpenSeadragonViewerOptions = Omit<default_2.Options, "element" | "compositeOperation"> & {
2215
+ /** Unsupported, use `navigatorId` instead */
2216
+ navigatorElement?: never;
2217
+ /** Element ID of the toolbar container */
2218
+ toolbar?: string;
2219
+ /** Element ID of the zoom-in button */
2220
+ zoomInButton?: string;
2221
+ /** Element ID of the zoom-out button */
2222
+ zoomOutButton?: string;
2223
+ /** Element ID of the home (reset zoom) button */
2224
+ homeButton?: string;
2225
+ /** Element ID of the full-page toggle button */
2226
+ fullPageButton?: string;
2227
+ /** Element ID of the rotate-left button */
2228
+ rotateLeftButton?: string;
2229
+ /** Element ID of the rotate-right button */
2230
+ rotateRightButton?: string;
2231
+ /** Element ID of the previous-page button */
2232
+ previousButton?: string;
2233
+ /** Element ID of the next-page button */
2234
+ nextButton?: string;
2235
+ /** Unsupported */
2236
+ referenceStripElement?: never;
2237
+ };
2238
+
2239
+ /** An ordered sequence of vertices forming an open or closed path */
2240
+ export declare type Path = Vertex[];
2241
+
2242
+ /**
2243
+ * A plugin that can be registered with the application
2244
+ *
2245
+ * A plugin's lifecycle is `setup`, `mount`, `unmount`, `teardown`: registering
2246
+ * the plugin calls {@link setup} and then {@link mount}, and unregistering it
2247
+ * calls the callback returned by `mount` and then the callback returned by
2248
+ * `setup`. All four steps are optional.
2249
+ */
2250
+ declare type Plugin_2 = {
2251
+ /** The unique ID of the plugin */
2252
+ id: string;
2253
+ /** The human-readable name of the plugin */
2254
+ name: string;
2255
+ /**
2256
+ * Sets up the plugin and registers any necessary event listeners or other resources
2257
+ *
2258
+ * Called first when the plugin is registered. A plugin whose `setup` throws is
2259
+ * not registered, and the teardown callback is not called: releasing whatever
2260
+ * `setup` had already acquired before it throws is `setup`'s own
2261
+ * responsibility.
2262
+ *
2263
+ * A plugin that only contributes a user interface does not need a `setup`:
2264
+ * its {@link mount} receives the same stores.
2265
+ *
2266
+ * @param stores - The stores provided by the application for the plugin to interact with
2267
+ * @returns A teardown callback that unregisters the event listeners and
2268
+ * releases the other resources again, if any. It is called last when the
2269
+ * plugin is unregistered, after the user interface has been unmounted, and
2270
+ * only for a plugin that was registered successfully.
2271
+ */
2272
+ setup?: (stores: PluginStores) => (() => void) | void;
2273
+ /**
2274
+ * Mounts the plugin's user interface, if any
2275
+ *
2276
+ * A plugin with a `mount` is shown as a panel titled with the plugin's
2277
+ * {@link name}, for exactly as long as the plugin is registered. Closing the
2278
+ * panel unregisters the plugin; a plugin without a `mount` can only be
2279
+ * unregistered through the registry.
2280
+ *
2281
+ * Called once {@link setup} has returned successfully, with an empty element
2282
+ * owned by the application. The element is not part of the document yet: the
2283
+ * application attaches it to the panel once that is shown, and keeps the user
2284
+ * interface mounted while the panel is hidden behind other tabs or moved.
2285
+ * A plugin whose `mount` throws is not registered, and the teardown callback
2286
+ * returned by `setup` is called.
2287
+ *
2288
+ * The container is discarded together with the plugin, so the returned
2289
+ * callback only has to release what is not plain DOM, such as store
2290
+ * subscriptions, listeners on `window`, or a React root.
2291
+ *
2292
+ * @param container - The element to mount the user interface into
2293
+ * @param stores - The stores provided by the application for the plugin to interact with
2294
+ * @returns An unmount callback that unmounts the user interface again, if
2295
+ * any. It is called first when the plugin is unregistered, before the
2296
+ * teardown callback returned by {@link setup}.
2297
+ */
2298
+ mount?: (container: HTMLElement, stores: PluginStores) => (() => void) | void;
2299
+ };
2300
+ export { Plugin_2 as Plugin }
2301
+
2302
+ /**
2303
+ * The registry through which the application registers and unregisters plugins
2304
+ */
2305
+ export declare type PluginRegistry = {
2306
+ /**
2307
+ * Registers a plugin, calling its `setup` and then its `mount`, if it has them
2308
+ *
2309
+ * Registering a plugin whose ID is already in use unregisters the previously
2310
+ * registered plugin first.
2311
+ *
2312
+ * @param plugin - The plugin to register
2313
+ */
2314
+ registerPlugin: (plugin: Plugin_2) => void;
2315
+ /**
2316
+ * Unregisters a registered plugin, calling the unmount callback returned by
2317
+ * its `mount` and then the teardown callback returned by its `setup`
2318
+ *
2319
+ * @param pluginId - The ID of the plugin to unregister
2320
+ */
2321
+ unregisterPlugin: (pluginId: string) => void;
2322
+ };
2323
+
2324
+ /**
2325
+ * The stores provided by the application for a plugin to interact with
2326
+ */
2327
+ export declare type PluginStores = {
2328
+ appStore: AppStoreApi;
2329
+ dataStore: DataStoreApi;
2330
+ projectStore: ProjectStoreApi;
2331
+ settingsStore: SettingsStoreApi;
2332
+ };
2333
+
2334
+ /**
2335
+ * A {@link RawPoints} object with {@link pointsDefaults} applied
2336
+ */
2337
+ export declare type Points = RenderedItemsDataObject<PointsDataSource<string>> & Required<Pick<RawPoints, keyof typeof pointsDefaults>> & Omit<RawPoints, keyof typeof pointsDefaults>;
2338
+
2339
+ /**
2340
+ * Loaded point cloud data providing coordinate access
2341
+ */
2342
+ export declare interface PointsData extends ItemsData {
2343
+ /**
2344
+ * Loads the geometry for all points
2345
+ *
2346
+ * @param options - Optional abort signal and progress callback
2347
+ * @returns A promise that resolves to the loaded points geometry
2348
+ */
2349
+ loadGeometry(options?: {
2350
+ signal?: AbortSignal;
2351
+ onProgress?: ProgressCallback;
2352
+ }): Promise<PointsGeometry>;
2353
+ }
2354
+
2355
+ /**
2356
+ * Data provider for point clouds
2357
+ *
2358
+ * @typeParam TPointsDataSource - The data source type this data provider opens
2359
+ * @typeParam TPointsData - The {@link PointsData} type produced by this data
2360
+ * provider
2361
+ * @typeParam TNormalizedPointsDataSource - The normalized data source type
2362
+ * produced by `normalize` and accepted by `load`
2363
+ */
2364
+ export declare interface PointsDataProvider<TPointsDataSource extends PointsDataSource, TPointsData extends PointsData, TNormalizedPointsDataSource extends TPointsDataSource = TPointsDataSource> extends AnnotatedDataProvider<TPointsDataSource, TPointsData, TNormalizedPointsDataSource> {
2365
+ }
2366
+
2367
+ /**
2368
+ * A {@link RawPointsDataSource} with {@link pointsDataSourceDefaults} applied
2369
+ */
2370
+ export declare type PointsDataSource<TType extends string = string> = AnnotatedDataSource<TType> & Required<Pick<RawPointsDataSource<TType>, keyof typeof pointsDataSourceDefaults>> & Omit<RawPointsDataSource<TType>, keyof typeof pointsDataSourceDefaults>;
2371
+
2372
+ /**
2373
+ * Default values for {@link RawPointsDataSource}
2374
+ */
2375
+ export declare const pointsDataSourceDefaults: {};
2376
+
2377
+ /**
2378
+ * Default values for {@link RawPoints}
2379
+ */
2380
+ export declare const pointsDefaults: {
2381
+ readonly pointMarker: {
2382
+ readonly constant: {
2383
+ readonly value: 6;
2384
+ };
2385
+ };
2386
+ readonly pointSize: {
2387
+ readonly constant: {
2388
+ readonly value: 1;
2389
+ };
2390
+ };
2391
+ readonly pointColor: {
2392
+ readonly constant: {
2393
+ readonly value: {
2394
+ readonly r: 255;
2395
+ readonly g: 255;
2396
+ readonly b: 255;
2397
+ };
2398
+ };
2399
+ };
2400
+ readonly pointVisibility: {
2401
+ readonly constant: {
2402
+ readonly value: true;
2403
+ };
2404
+ };
2405
+ readonly pointOpacity: {
2406
+ readonly constant: {
2407
+ readonly value: 1;
2408
+ };
2409
+ };
2410
+ readonly pointSizeFactor: 1;
2411
+ };
2412
+
2413
+ /** Point cloud geometry consisting of separate arrays for x and y coordinates */
2414
+ export declare type PointsGeometry = {
2415
+ /** X coordinates of the points */
2416
+ xs: Float32Array;
2417
+ /** Y coordinates of the points */
2418
+ ys: Float32Array;
2419
+ };
2420
+
2421
+ /** A polygon defined by an outer shell and zero or more interior holes */
2422
+ export declare type Polygon = {
2423
+ /** The outer boundary of the polygon */
2424
+ shell: Path;
2425
+ /** Interior rings that are subtracted from the polygon area */
2426
+ holes: Path[];
2427
+ };
2428
+
2429
+ /**
2430
+ * A callback function that receives progress updates
2431
+ *
2432
+ * @param progress - The current progress value in the range [0, total]
2433
+ * @param total - The total amount of work to be done
2434
+ */
2435
+ export declare type ProgressCallback = (progress: number, total: number) => void;
2436
+
2437
+ /**
2438
+ * A {@link RawProject} with {@link projectDefaults} applied
2439
+ */
2440
+ export declare type Project = Model & Required<Pick<RawProject, keyof typeof projectDefaults>> & Omit<RawProject, keyof typeof projectDefaults | ("layers" | "images" | "labels" | "points" | "shapes" | "tables")> & {
2441
+ layers: Layer[];
2442
+ images: Image_2[];
2443
+ labels: Labels[];
2444
+ points: Points[];
2445
+ shapes: Shapes[];
2446
+ tables: Table[];
2447
+ };
2448
+
2449
+ /**
2450
+ * Default values for {@link RawProject}
2451
+ */
2452
+ export declare const projectDefaults: {
2453
+ readonly markerMaps: [];
2454
+ readonly sizeMaps: [];
2455
+ readonly colorMaps: [];
2456
+ readonly visibilityMaps: [];
2457
+ readonly opacityMaps: [];
2458
+ readonly osOptions: {
2459
+ readonly viewerOptions: {
2460
+ readonly minZoomImageRatio: 0;
2461
+ readonly maxZoomPixelRatio: number;
2462
+ readonly preserveImageSizeOnResize: true;
2463
+ readonly visibilityRatio: 0;
2464
+ readonly animationTime: 0;
2465
+ readonly gestureSettingsMouse: {
2466
+ readonly flickEnabled: false;
2467
+ };
2468
+ readonly gestureSettingsTouch: {
2469
+ readonly flickEnabled: false;
2470
+ };
2471
+ readonly gestureSettingsPen: {
2472
+ readonly flickEnabled: false;
2473
+ };
2474
+ readonly gestureSettingsUnknown: {
2475
+ readonly flickEnabled: false;
2476
+ };
2477
+ readonly zoomPerClick: 1;
2478
+ readonly showNavigator: true;
2479
+ readonly navigatorPosition: "BOTTOM_LEFT";
2480
+ readonly maxImageCacheCount: 2000;
2481
+ readonly showNavigationControl: false;
2482
+ readonly imageSmoothingEnabled: false;
2483
+ };
2484
+ readonly viewerAnimationStartOptions: {
2485
+ readonly immediateRender: false;
2486
+ readonly imageLoaderLimit: 1;
2487
+ };
2488
+ readonly viewerAnimationFinishOptions: {
2489
+ readonly immediateRender: true;
2490
+ };
2491
+ };
2492
+ readonly glOptions: {
2493
+ readonly pointsRenderOptions: {
2494
+ readonly globalPointSizeFactor: 1;
2495
+ };
2496
+ readonly shapesRenderOptions: {
2497
+ readonly strokeWidth: 1;
2498
+ readonly edgesPerScanline: 8;
2499
+ readonly binWidthFactor: 1;
2500
+ readonly shapePadding: 0.2;
2501
+ };
2502
+ };
2503
+ readonly viewerBackgroundColor: {
2504
+ readonly r: 0;
2505
+ readonly g: 0;
2506
+ readonly b: 0;
2507
+ };
2508
+ };
2509
+
2510
+ /**
2511
+ * The project store, i.e. its state and actions
2512
+ */
2513
+ export declare type ProjectStore = ProjectStoreState & ProjectStoreActions;
2514
+
2515
+ /**
2516
+ * The actions of the project store
2517
+ *
2518
+ * Every collection of the project - its layers, images, labels, points, shapes
2519
+ * and tables - is manipulated through the same five families of actions:
2520
+ * `add*` inserts an object, `update*` overwrites some of its properties,
2521
+ * `move*` reorders it, `delete*` removes it, and `clear*` empties the whole
2522
+ * collection. Objects are addressed by their ID, and their order within a
2523
+ * collection is meaningful: it is the order in which they are listed and
2524
+ * rendered.
2525
+ *
2526
+ * Adding an object whose ID is already taken, referring to one that is not
2527
+ * part of the project, or passing an index outside of a collection's bounds is
2528
+ * an error.
2529
+ *
2530
+ * The lists of maps are not reordered, so they have no `move*` actions.
2531
+ */
2532
+ export declare type ProjectStoreActions = {
2533
+ /**
2534
+ * Renames the project
2535
+ *
2536
+ * @param name - The new project name
2537
+ */
2538
+ setName: (name: string) => void;
2539
+ /**
2540
+ * Adds a layer to the project
2541
+ *
2542
+ * @param layer - The layer to add
2543
+ * @param index - The index to insert at, defaulting to the end of the
2544
+ * collection
2545
+ */
2546
+ addLayer: (layer: Layer, index?: number) => void;
2547
+ /**
2548
+ * Adds an image to the project
2549
+ *
2550
+ * @param image - The image to add
2551
+ * @param index - The index to insert at, defaulting to the end of the
2552
+ * collection
2553
+ */
2554
+ addImage: (image: Image_2, index?: number) => void;
2555
+ /**
2556
+ * Adds labels to the project
2557
+ *
2558
+ * @param labels - The labels to add
2559
+ * @param index - The index to insert at, defaulting to the end of the
2560
+ * collection
2561
+ */
2562
+ addLabels: (labels: Labels, index?: number) => void;
2563
+ /**
2564
+ * Adds points to the project
2565
+ *
2566
+ * @param points - The points to add
2567
+ * @param index - The index to insert at, defaulting to the end of the
2568
+ * collection
2569
+ */
2570
+ addPoints: (points: Points, index?: number) => void;
2571
+ /**
2572
+ * Adds shapes to the project
2573
+ *
2574
+ * @param shapes - The shapes to add
2575
+ * @param index - The index to insert at, defaulting to the end of the
2576
+ * collection
2577
+ */
2578
+ addShapes: (shapes: Shapes, index?: number) => void;
2579
+ /**
2580
+ * Adds a table to the project
2581
+ *
2582
+ * @param table - The table to add
2583
+ * @param index - The index to insert at, defaulting to the end of the
2584
+ * collection
2585
+ */
2586
+ addTable: (table: Table, index?: number) => void;
2587
+ /**
2588
+ * Adds a marker map to the project
2589
+ *
2590
+ * @param map - The map to add
2591
+ */
2592
+ addMarkerMap: (map: GroupValueMap<Marker>) => void;
2593
+ /**
2594
+ * Adds a size map to the project
2595
+ *
2596
+ * @param map - The map to add
2597
+ */
2598
+ addSizeMap: (map: GroupValueMap<number>) => void;
2599
+ /**
2600
+ * Adds a color map to the project
2601
+ *
2602
+ * @param map - The map to add
2603
+ */
2604
+ addColorMap: (map: GroupValueMap<Color>) => void;
2605
+ /**
2606
+ * Adds a visibility map to the project
2607
+ *
2608
+ * @param map - The map to add
2609
+ */
2610
+ addVisibilityMap: (map: GroupValueMap<boolean>) => void;
2611
+ /**
2612
+ * Adds an opacity map to the project
2613
+ *
2614
+ * @param map - The map to add
2615
+ */
2616
+ addOpacityMap: (map: GroupValueMap<number>) => void;
2617
+ /**
2618
+ * Applies updates to a layer of the project
2619
+ *
2620
+ * @param layerId - The ID of the layer to update
2621
+ * @param updates - The properties to overwrite on the layer
2622
+ */
2623
+ updateLayer: (layerId: string, updates: Partial<Omit<Layer, "id">>) => void;
2624
+ /**
2625
+ * Applies updates to an image of the project
2626
+ *
2627
+ * @param imageId - The ID of the image to update
2628
+ * @param updates - The properties to overwrite on the image
2629
+ */
2630
+ updateImage: (imageId: string, updates: Partial<Omit<Image_2, "id">>) => void;
2631
+ /**
2632
+ * Applies updates to labels of the project
2633
+ *
2634
+ * @param labelsId - The ID of the labels to update
2635
+ * @param updates - The properties to overwrite on the labels
2636
+ */
2637
+ updateLabels: (labelsId: string, updates: Partial<Omit<Labels, "id">>) => void;
2638
+ /**
2639
+ * Applies updates to points of the project
2640
+ *
2641
+ * @param pointsId - The ID of the points to update
2642
+ * @param updates - The properties to overwrite on the points
2643
+ */
2644
+ updatePoints: (pointsId: string, updates: Partial<Omit<Points, "id">>) => void;
2645
+ /**
2646
+ * Applies updates to shapes of the project
2647
+ *
2648
+ * @param shapesId - The ID of the shapes to update
2649
+ * @param updates - The properties to overwrite on the shapes
2650
+ */
2651
+ updateShapes: (shapesId: string, updates: Partial<Omit<Shapes, "id">>) => void;
2652
+ /**
2653
+ * Applies updates to a table of the project
2654
+ *
2655
+ * @param tableId - The ID of the table to update
2656
+ * @param updates - The properties to overwrite on the table
2657
+ */
2658
+ updateTable: (tableId: string, updates: Partial<Omit<Table, "id">>) => void;
2659
+ /**
2660
+ * Applies updates to a marker map of the project
2661
+ *
2662
+ * @param mapId - The ID of the map to update
2663
+ * @param updates - The properties to overwrite on the map
2664
+ */
2665
+ updateMarkerMap: (mapId: string, updates: Partial<Omit<GroupValueMap<Marker>, "id">>) => void;
2666
+ /**
2667
+ * Applies updates to a size map of the project
2668
+ *
2669
+ * @param mapId - The ID of the map to update
2670
+ * @param updates - The properties to overwrite on the map
2671
+ */
2672
+ updateSizeMap: (mapId: string, updates: Partial<Omit<GroupValueMap<number>, "id">>) => void;
2673
+ /**
2674
+ * Applies updates to a color map of the project
2675
+ *
2676
+ * @param mapId - The ID of the map to update
2677
+ * @param updates - The properties to overwrite on the map
2678
+ */
2679
+ updateColorMap: (mapId: string, updates: Partial<Omit<GroupValueMap<Color>, "id">>) => void;
2680
+ /**
2681
+ * Applies updates to a visibility map of the project
2682
+ *
2683
+ * @param mapId - The ID of the map to update
2684
+ * @param updates - The properties to overwrite on the map
2685
+ */
2686
+ updateVisibilityMap: (mapId: string, updates: Partial<Omit<GroupValueMap<boolean>, "id">>) => void;
2687
+ /**
2688
+ * Applies updates to an opacity map of the project
2689
+ *
2690
+ * @param mapId - The ID of the map to update
2691
+ * @param updates - The properties to overwrite on the map
2692
+ */
2693
+ updateOpacityMap: (mapId: string, updates: Partial<Omit<GroupValueMap<number>, "id">>) => void;
2694
+ /**
2695
+ * Moves a layer of the project to another index
2696
+ *
2697
+ * @param layerId - The ID of the layer to move
2698
+ * @param newIndex - The index to move the layer to
2699
+ */
2700
+ moveLayer: (layerId: string, newIndex: number) => void;
2701
+ /**
2702
+ * Moves an image of the project to another index
2703
+ *
2704
+ * @param imageId - The ID of the image to move
2705
+ * @param newIndex - The index to move the image to
2706
+ */
2707
+ moveImage: (imageId: string, newIndex: number) => void;
2708
+ /**
2709
+ * Moves labels of the project to another index
2710
+ *
2711
+ * @param labelsId - The ID of the labels to move
2712
+ * @param newIndex - The index to move the labels to
2713
+ */
2714
+ moveLabels: (labelsId: string, newIndex: number) => void;
2715
+ /**
2716
+ * Moves points of the project to another index
2717
+ *
2718
+ * @param pointsId - The ID of the points to move
2719
+ * @param newIndex - The index to move the points to
2720
+ */
2721
+ movePoints: (pointsId: string, newIndex: number) => void;
2722
+ /**
2723
+ * Moves shapes of the project to another index
2724
+ *
2725
+ * @param shapesId - The ID of the shapes to move
2726
+ * @param newIndex - The index to move the shapes to
2727
+ */
2728
+ moveShapes: (shapesId: string, newIndex: number) => void;
2729
+ /**
2730
+ * Removes a layer from the project
2731
+ *
2732
+ * @param layerId - The ID of the layer to remove
2733
+ */
2734
+ deleteLayer: (layerId: string) => void;
2735
+ /**
2736
+ * Removes an image from the project
2737
+ *
2738
+ * @param imageId - The ID of the image to remove
2739
+ */
2740
+ deleteImage: (imageId: string) => void;
2741
+ /**
2742
+ * Removes labels from the project
2743
+ *
2744
+ * @param labelsId - The ID of the labels to remove
2745
+ */
2746
+ deleteLabels: (labelsId: string) => void;
2747
+ /**
2748
+ * Removes points from the project
2749
+ *
2750
+ * @param pointsId - The ID of the points to remove
2751
+ */
2752
+ deletePoints: (pointsId: string) => void;
2753
+ /**
2754
+ * Removes shapes from the project
2755
+ *
2756
+ * @param shapesId - The ID of the shapes to remove
2757
+ */
2758
+ deleteShapes: (shapesId: string) => void;
2759
+ /**
2760
+ * Removes a table from the project
2761
+ *
2762
+ * @param tableId - The ID of the table to remove
2763
+ */
2764
+ deleteTable: (tableId: string) => void;
2765
+ /**
2766
+ * Removes a marker map from the project
2767
+ *
2768
+ * @param mapId - The ID of the map to remove
2769
+ */
2770
+ deleteMarkerMap: (mapId: string) => void;
2771
+ /**
2772
+ * Removes a size map from the project
2773
+ *
2774
+ * @param mapId - The ID of the map to remove
2775
+ */
2776
+ deleteSizeMap: (mapId: string) => void;
2777
+ /**
2778
+ * Removes a color map from the project
2779
+ *
2780
+ * @param mapId - The ID of the map to remove
2781
+ */
2782
+ deleteColorMap: (mapId: string) => void;
2783
+ /**
2784
+ * Removes a visibility map from the project
2785
+ *
2786
+ * @param mapId - The ID of the map to remove
2787
+ */
2788
+ deleteVisibilityMap: (mapId: string) => void;
2789
+ /**
2790
+ * Removes an opacity map from the project
2791
+ *
2792
+ * @param mapId - The ID of the map to remove
2793
+ */
2794
+ deleteOpacityMap: (mapId: string) => void;
2795
+ /**
2796
+ * Removes all layers from the project
2797
+ */
2798
+ clearLayers: () => void;
2799
+ /**
2800
+ * Removes all images from the project
2801
+ */
2802
+ clearImages: () => void;
2803
+ /**
2804
+ * Removes all labels from the project
2805
+ */
2806
+ clearLabels: () => void;
2807
+ /**
2808
+ * Removes all points from the project
2809
+ */
2810
+ clearPoints: () => void;
2811
+ /**
2812
+ * Removes all shapes from the project
2813
+ */
2814
+ clearShapes: () => void;
2815
+ /**
2816
+ * Removes all tables from the project
2817
+ */
2818
+ clearTables: () => void;
2819
+ /**
2820
+ * Removes all marker maps from the project
2821
+ */
2822
+ clearMarkerMaps: () => void;
2823
+ /**
2824
+ * Removes all size maps from the project
2825
+ */
2826
+ clearSizeMaps: () => void;
2827
+ /**
2828
+ * Removes all color maps from the project
2829
+ */
2830
+ clearColorMaps: () => void;
2831
+ /**
2832
+ * Removes all visibility maps from the project
2833
+ */
2834
+ clearVisibilityMaps: () => void;
2835
+ /**
2836
+ * Removes all opacity maps from the project
2837
+ */
2838
+ clearOpacityMaps: () => void;
2839
+ /**
2840
+ * Sets the project's OpenSeadragon viewer options
2841
+ *
2842
+ * @param osOptions - The OpenSeadragon options to apply
2843
+ */
2844
+ setOSOptions: (osOptions: Project["osOptions"]) => void;
2845
+ /**
2846
+ * Sets the project's WebGL render options
2847
+ *
2848
+ * @param glOptions - The WebGL options to apply
2849
+ */
2850
+ setGLOptions: (glOptions: Project["glOptions"]) => void;
2851
+ /**
2852
+ * Sets the project's viewer background color
2853
+ *
2854
+ * @param viewerBackgroundColor - The viewer background color to apply
2855
+ */
2856
+ setViewerBackgroundColor: (viewerBackgroundColor: Project["viewerBackgroundColor"]) => void;
2857
+ /**
2858
+ * Replaces the project with a new, empty one
2859
+ */
2860
+ clear: () => void;
2861
+ };
2862
+
2863
+ /**
2864
+ * The API through which the project store is read, written and subscribed to
2865
+ */
2866
+ export declare type ProjectStoreApi = Mutate<StoreApi<ProjectStore>, [
2867
+ ["zustand/immer", never]
2868
+ ]>;
2869
+
2870
+ /**
2871
+ * The state of the project store, i.e. the currently open {@link Project}
2872
+ *
2873
+ * In addition to the project itself, the store keeps track of where the
2874
+ * project was loaded from, which is what project-relative paths in its data
2875
+ * sources are resolved against, and of an ID identifying the open project as
2876
+ * such. Both
2877
+ * describe how the project was opened rather than what it contains, so they are
2878
+ * not part of {@link Project} and are not to be saved, serialized or exported
2879
+ * with it.
2880
+ */
2881
+ export declare type ProjectStoreState = Project & {
2882
+ /**
2883
+ * Where the open project was loaded from: its absolute URL, the
2884
+ * workspace-relative path of the project file, or `null` if it was loaded
2885
+ * from neither
2886
+ */
2887
+ source: string | null;
2888
+ /**
2889
+ * Identifies the open project regardless of its content: a fresh ID is
2890
+ * generated whenever a project is loaded or the store is cleared, so that a
2891
+ * new project can be told apart from edits to the open one
2892
+ */
2893
+ instanceId: string;
2894
+ };
2895
+
2896
+ /** Utility methods for projects */
2897
+ export declare class ProjectUtils {
2898
+ /**
2899
+ * Returns whether a project has any data objects
2900
+ *
2901
+ * @param project - The project, or only its data objects
2902
+ * @returns `true` if the project has images, labels, points, shapes or tables
2903
+ */
2904
+ static hasData(project: Pick<Project, "images" | "labels" | "points" | "shapes" | "tables">): boolean;
2905
+ /**
2906
+ * Returns the marker configurations of a project's points
2907
+ *
2908
+ * @param project - The project, or only its labels, points and shapes
2909
+ * @returns The marker configurations
2910
+ */
2911
+ static getMarkerConfigs(project: Pick<Project, "labels" | "points" | "shapes">): MarkerConfig[];
2912
+ /**
2913
+ * Returns the size configurations of a project's points
2914
+ *
2915
+ * @param project - The project, or only its labels, points and shapes
2916
+ * @returns The size configurations
2917
+ */
2918
+ static getSizeConfigs(project: Pick<Project, "labels" | "points" | "shapes">): SizeConfig[];
2919
+ /**
2920
+ * Returns the color configurations of a project's labels, points and shapes
2921
+ *
2922
+ * @param project - The project, or only its labels, points and shapes
2923
+ * @returns The color configurations, including the fill and stroke colors of
2924
+ * shapes
2925
+ */
2926
+ static getColorConfigs(project: Pick<Project, "labels" | "points" | "shapes">): ColorConfig[];
2927
+ /**
2928
+ * Returns the visibility configurations of a project's labels, points and
2929
+ * shapes
2930
+ *
2931
+ * @param project - The project, or only its labels, points and shapes
2932
+ * @returns The visibility configurations, including the shape, fill and
2933
+ * stroke visibilities of shapes
2934
+ */
2935
+ static getVisibilityConfigs(project: Pick<Project, "labels" | "points" | "shapes">): VisibilityConfig[];
2936
+ /**
2937
+ * Returns the opacity configurations of a project's labels, points and shapes
2938
+ *
2939
+ * @param project - The project, or only its labels, points and shapes
2940
+ * @returns The opacity configurations, including the shape, fill and stroke
2941
+ * opacities of shapes
2942
+ */
2943
+ static getOpacityConfigs(project: Pick<Project, "labels" | "points" | "shapes">): OpacityConfig[];
2944
+ }
2945
+
2946
+ /** Configuration to use random values */
2947
+ export declare type RandomConfig<TRandomExtra = unknown> = Config<"random"> & {
2948
+ /** Specification of random value generation */
2949
+ random: {
2950
+ /**
2951
+ * The seed for the random number generator
2952
+ *
2953
+ * Values are drawn deterministically from the item ID and the seed, so
2954
+ * different seeds yield different assignments for the same items.
2955
+ *
2956
+ * @defaultValue {@link defaultRandomSeed}
2957
+ */
2958
+ seed?: number;
2959
+ } & TRandomExtra;
2960
+ };
2961
+
2962
+ /**
2963
+ * Utility methods for seeded, non-cryptographic pseudo-random numbers
2964
+ *
2965
+ * All methods except {@link seed} are deterministic: the same seed always
2966
+ * yields the same sequence, so callers can store a seed instead of the values
2967
+ * it produced (e.g. for reproducible random colors). None of the generators
2968
+ * are suitable for security-sensitive purposes.
2969
+ *
2970
+ * {@link createUint32RNG} returns a generator that draws one 32-bit integer
2971
+ * per call; {@link toUnitFloat32} maps such a draw to `[0, 1)`. The scalar
2972
+ * `rand*` methods take the first draw of a fresh generator, and the
2973
+ * `rand*Array` methods write consecutive draws of a fresh generator into a
2974
+ * typed array. Because they all consume the same stream,
2975
+ * `randUint32Array(n, seed)` starts with `randUint32(seed)`, and a longer
2976
+ * array has the shorter one as a prefix.
2977
+ *
2978
+ * Every `rand*` method takes either a seed or a generator as `seedOrRng`. A
2979
+ * seed creates a fresh generator; passing a generator draws from it instead,
2980
+ * which allows continuing one stream across several calls.
2981
+ *
2982
+ * The underlying generator, {@link splitmix32}, is exposed for callers that
2983
+ * need the plain algorithm regardless of the current default.
2984
+ */
2985
+ export declare class RandomUtils {
2986
+ private static readonly _splitmix32Config;
2987
+ /**
2988
+ * Draws a random seed from `Math.random()`
2989
+ *
2990
+ * This is the one non-deterministic method of this class; use it to obtain
2991
+ * a seed for the other methods when reproducibility is not required, e.g.
2992
+ * for a "shuffle" action. The result is stored rather than the values it
2993
+ * produces, so the draw can be reproduced later.
2994
+ *
2995
+ * @returns A uniformly distributed non-negative 32-bit integer
2996
+ */
2997
+ static seed(): number;
2998
+ /**
2999
+ * Creates a seeded generator of 32-bit integers
3000
+ *
3001
+ * Currently {@link splitmix32}. Each call to the returned function yields
3002
+ * the next value of the stream.
3003
+ *
3004
+ * @param seed - The seed; only its lower 32 bits are used
3005
+ * @returns A function that returns the next non-negative 32-bit integer
3006
+ */
3007
+ static createUint32RNG(seed?: number): () => number;
3008
+ /**
3009
+ * Draws a 32-bit integer
3010
+ *
3011
+ * Given a seed, returns the first value of a fresh generator for it, i.e.
3012
+ * `createUint32RNG(seed)()`. Note that this is a pure function of the seed:
3013
+ * calling it repeatedly with the same seed returns the same value. Given a
3014
+ * generator, returns its next value instead.
3015
+ *
3016
+ * @param seedOrRng - The seed (only its lower 32 bits are used), or the
3017
+ * generator to draw from
3018
+ * @returns A non-negative 32-bit integer
3019
+ */
3020
+ static randUint32(seedOrRng?: number | (() => number)): number;
3021
+ /**
3022
+ * Draws consecutive 32-bit integers into an array
3023
+ *
3024
+ * Given a seed, values come from a fresh generator for it, so the first
3025
+ * element equals `randUint32(seed)`. Given a generator, its next `n` values
3026
+ * are drawn instead, e.g. to continue one stream across several arrays. By
3027
+ * default, a new array of length `n` is allocated; pass `array` to fill the
3028
+ * first `n` elements of an existing array in place instead, leaving any
3029
+ * further elements untouched.
3030
+ *
3031
+ * @param n - The number of values to draw, a non-negative integer
3032
+ * @param seedOrRng - The seed (only its lower 32 bits are used), or the
3033
+ * generator to draw from
3034
+ * @param array - The array to fill; defaults to `new Uint32Array(n)`
3035
+ * @returns The filled array, i.e. `array` if given
3036
+ * @throws RangeError if `array` is given and holds fewer than `n` elements
3037
+ */
3038
+ static randUint32Array(n: number, seedOrRng?: number | (() => number), array?: Uint32Array): Uint32Array;
3039
+ /**
3040
+ * Maps a 32-bit integer to a float in `[0, 1)` that is exact in `float32`
3041
+ *
3042
+ * Uses the upper 24 bits of the integer, so the result is a multiple of
3043
+ * `2^-24` and survives storage in a `Float32Array` without rounding. The
3044
+ * largest possible result is `1 - 2^-24`; the lower 8 bits of the input are
3045
+ * discarded.
3046
+ *
3047
+ * @param uint32 - The integer to map; only its lower 32 bits are used
3048
+ * @returns A float in `[0, 1)`
3049
+ */
3050
+ static toUnitFloat32(uint32: number): number;
3051
+ /**
3052
+ * Draws a float in `[0, 1)` that is exact in `float32`
3053
+ *
3054
+ * Equivalent to `toUnitFloat32(randUint32(seedOrRng))`. Given a seed, this
3055
+ * is a pure function of it: calling it repeatedly with the same seed returns
3056
+ * the same value. Given a generator, its next value is drawn instead.
3057
+ *
3058
+ * @param seedOrRng - The seed (only its lower 32 bits are used), or the
3059
+ * generator to draw from
3060
+ * @returns A float in `[0, 1)`, exact in `float32`
3061
+ */
3062
+ static randUnitFloat32(seedOrRng?: number | (() => number)): number;
3063
+ /**
3064
+ * Draws consecutive floats in `[0, 1)` into an array
3065
+ *
3066
+ * Each element is `toUnitFloat32` of the corresponding element that
3067
+ * {@link randUint32Array} would produce for the same arguments, and is
3068
+ * stored in the `Float32Array` without rounding. Given a seed, values come
3069
+ * from a fresh generator for it, so the first element equals
3070
+ * `randUnitFloat32(seed)`. Given a generator, its next `n` values are drawn
3071
+ * instead, e.g. to continue one stream across several arrays. By default, a
3072
+ * new array of length `n` is allocated; pass `array` to fill the first `n`
3073
+ * elements of an existing array in place instead, leaving any further
3074
+ * elements untouched.
3075
+ *
3076
+ * @param n - The number of values to draw, a non-negative integer
3077
+ * @param seedOrRng - The seed (only its lower 32 bits are used), or the
3078
+ * generator to draw from
3079
+ * @param array - The array to fill; defaults to `new Float32Array(n)`
3080
+ * @returns The filled array, i.e. `array` if given
3081
+ * @throws RangeError if `array` is given and holds fewer than `n` elements
3082
+ */
3083
+ static randUnitFloat32Array(n: number, seedOrRng?: number | (() => number), array?: Float32Array): Float32Array;
3084
+ /**
3085
+ * Creates a SplitMix32 generator
3086
+ *
3087
+ * The state is a 32-bit counter advanced by the golden-ratio constant
3088
+ * `0x9e3779b9` (a Weyl sequence); each output is the state passed through
3089
+ * {@link HashUtils.fmix32} with the SplitMix32 constants. Since the
3090
+ * finalizer is a bijection, the stream has a period of `2^32` and visits
3091
+ * every 32-bit value exactly once per period. All seeds walk the same
3092
+ * cycle; seeds that differ in their lower 32 bits start at different points.
3093
+ *
3094
+ * @see https://github.com/bryc/code/blob/master/jshash/PRNGs.md#splitmix32
3095
+ * @param seed - The seed; only its lower 32 bits are used
3096
+ * @returns A function that returns the next non-negative 32-bit integer
3097
+ */
3098
+ static splitmix32(seed?: number): () => number;
3099
+ /**
3100
+ * Resolves a seed or generator to a generator
3101
+ *
3102
+ * @param seedOrRng - A seed, or an existing generator
3103
+ * @returns A fresh generator for the seed, or the given generator
3104
+ */
3105
+ private static _toRNG;
3106
+ }
3107
+
3108
+ /**
3109
+ * A {@link Data} object that provides a tiled, multi-resolution raster
3110
+ *
3111
+ * Extended by data types that are drawn as OpenSeadragon tiled images (e.g.
3112
+ * images, labels).
3113
+ */
3114
+ export declare interface RasterData extends Data {
3115
+ /**
3116
+ * Returns the tile source of this raster
3117
+ *
3118
+ * Data types providing more than one tile source (see `ImageData`) extend
3119
+ * this to address them.
3120
+ *
3121
+ * @returns The tile source, which can be a URL string, a TileSourceConfig
3122
+ * object, or a CustomTileSource object
3123
+ */
3124
+ getTileSource(): string | TileSourceConfig | CustomTileSource;
3125
+ /**
3126
+ * Extracts the raw values of an invalidated tile
3127
+ *
3128
+ * Provided by raster data whose tiles carry values rather than colors (e.g.
3129
+ * label IDs, or one sample per pixel of an image channel), which the renderer
3130
+ * recolors through a data transfer; raster data whose tiles are drawn as they
3131
+ * are does not provide it. The tile in `event` already belongs to one of this
3132
+ * raster's tile sources, which identifies the channel for multi-channel data.
3133
+ *
3134
+ * The raster does not need to be cropped to the tile's source bounds: it may
3135
+ * cover the full tile size, as the renderer crops it when drawing.
3136
+ *
3137
+ * @param event - The tile invalidation event
3138
+ * @returns The values of the invalidated tile, one per raster pixel in
3139
+ * row-major order, along with the width and height of the raster in pixels
3140
+ * @throws Error if the event does not contain raster data
3141
+ */
3142
+ getTileData?: (event: default_2.TileInvalidatedEvent) => Promise<{
3143
+ values: TypedArray;
3144
+ width: number;
3145
+ height: number;
3146
+ }>;
3147
+ }
3148
+
3149
+ /**
3150
+ * A data source for rendered data objects whose items can be annotated by a
3151
+ * referenced table (e.g. labels, points, shapes)
3152
+ */
3153
+ export declare interface RawAnnotatedDataSource<TType extends string = string> extends RawDataSource<TType> {
3154
+ /** ID of the table holding the per-item annotations of this data source, if any */
3155
+ table?: string;
3156
+ }
3157
+
3158
+ /**
3159
+ * A named, identifiable data object backed by a data source
3160
+ */
3161
+ export declare interface RawDataObject<TRawDataSource extends RawDataSource<string>> extends RawModel {
3162
+ /** Data object ID */
3163
+ id: string;
3164
+ /** Human-readable data object name */
3165
+ name: string;
3166
+ /** Data source */
3167
+ dataSource: TRawDataSource;
3168
+ }
3169
+
3170
+ /**
3171
+ * A data source for data objects
3172
+ */
3173
+ export declare interface RawDataSource<TType extends string = string> extends RawModel {
3174
+ /**
3175
+ * Data source type
3176
+ */
3177
+ type: TType;
3178
+ /**
3179
+ * Where the data is loaded from: a URL, an app-relative path (`//` prefix),
3180
+ * a workspace-relative path (`/` prefix), or a project-relative path (no
3181
+ * prefix); see `SourceUtils` for the syntax and how paths are resolved
3182
+ */
3183
+ source?: string;
3184
+ }
3185
+
3186
+ /**
3187
+ * A two-dimensional raster image
3188
+ */
3189
+ export declare interface RawImage extends RawRenderedRasterDataObject<RawImageDataSource<string>> {
3190
+ /**
3191
+ * The channels of the image, indexed by channel
3192
+ *
3193
+ * Channels beyond the end of the array, and channels of images whose data is
3194
+ * not multi-channel, use the default values of {@link ImageChannel}.
3195
+ */
3196
+ channels?: ImageChannel[];
3197
+ /**
3198
+ * How the channels are displayed
3199
+ *
3200
+ * In the single-channel modes, only {@link RawImage.activeChannel} is shown,
3201
+ * whatever the visibility of the channels; the channel colors are kept, and
3202
+ * ignored in grayscale.
3203
+ *
3204
+ * @defaultValue {@link imageDefaults.channelViewMode}
3205
+ */
3206
+ channelViewMode?: ImageChannelViewMode;
3207
+ /**
3208
+ * The channel shown in the single-channel view modes (0-based)
3209
+ *
3210
+ * @defaultValue {@link imageDefaults.activeChannel}
3211
+ */
3212
+ activeChannel?: number;
3213
+ }
3214
+
3215
+ /**
3216
+ * A data source for two-dimensional raster images
3217
+ */
3218
+ export declare interface RawImageDataSource<TType extends string = string> extends RawDataSource<TType> {
3219
+ }
3220
+
3221
+ /**
3222
+ * A two-dimensional label mask
3223
+ */
3224
+ export declare interface RawLabels extends RawRenderedRasterDataObject<RawLabelsDataSource<string>> {
3225
+ /**
3226
+ * Label color
3227
+ *
3228
+ * @defaultValue {@link labelsDefaults.labelColor}
3229
+ */
3230
+ labelColor?: ColorConfig;
3231
+ /**
3232
+ * Label visibility
3233
+ *
3234
+ * @defaultValue {@link labelsDefaults.labelVisibility}
3235
+ */
3236
+ labelVisibility?: VisibilityConfig;
3237
+ /**
3238
+ * Label opacity
3239
+ *
3240
+ * @defaultValue {@link labelsDefaults.labelOpacity}
3241
+ */
3242
+ labelOpacity?: OpacityConfig;
3243
+ }
3244
+
3245
+ /**
3246
+ * A data source for two-dimensional label masks
3247
+ */
3248
+ export declare interface RawLabelsDataSource<TType extends string = string> extends RawAnnotatedDataSource<TType> {
3249
+ }
3250
+
3251
+ /**
3252
+ * A named collection of rendered data objects sharing the same (e.g. physical) coordinate system
3253
+ */
3254
+ export declare interface RawLayer extends RawModel {
3255
+ /**
3256
+ * Layer ID
3257
+ */
3258
+ id: string;
3259
+ /**
3260
+ * Human-readable layer name
3261
+ */
3262
+ name: string;
3263
+ /**
3264
+ * Transformation from layer space to world space
3265
+ *
3266
+ * @defaultValue {@link layerDefaults.transform}
3267
+ */
3268
+ transform?: SimilarityTransform;
3269
+ /**
3270
+ * Layer visibility
3271
+ *
3272
+ * @defaultValue {@link layerDefaults.visibility}
3273
+ */
3274
+ visibility?: boolean;
3275
+ /**
3276
+ * Layer opacity, in the range [0, 1]
3277
+ *
3278
+ * @defaultValue {@link layerDefaults.opacity}
3279
+ */
3280
+ opacity?: number;
3281
+ /**
3282
+ * Layer-level point size scaling factor
3283
+ *
3284
+ * A unitless scaling factor by which the size of every point rendered on this
3285
+ * layer is multiplied, for adjusting point sizes per layer.
3286
+ *
3287
+ * Point sizes are also affected by the project-global
3288
+ * {@link WebGLPointsRenderOptions.globalPointSizeFactor} and by the
3289
+ * {@link RawPoints}-specific size settings.
3290
+ *
3291
+ * @defaultValue {@link layerDefaults.pointSizeFactor}
3292
+ */
3293
+ pointSizeFactor?: number;
3294
+ }
3295
+
3296
+ /**
3297
+ * Base interface for all model types in a TissUUmaps project
3298
+ */
3299
+ export declare interface RawModel {
3300
+ }
3301
+
3302
+ /**
3303
+ * A two-dimensional point cloud
3304
+ */
3305
+ export declare interface RawPoints extends RawRenderedItemsDataObject<RawPointsDataSource<string>> {
3306
+ /**
3307
+ * Point marker
3308
+ *
3309
+ * @defaultValue {@link pointsDefaults.pointMarker}
3310
+ */
3311
+ pointMarker?: MarkerConfig;
3312
+ /**
3313
+ * Point size
3314
+ *
3315
+ * @defaultValue {@link pointsDefaults.pointSize}
3316
+ */
3317
+ pointSize?: SizeConfig;
3318
+ /**
3319
+ * Point color
3320
+ *
3321
+ * @defaultValue {@link pointsDefaults.pointColor}
3322
+ */
3323
+ pointColor?: ColorConfig;
3324
+ /**
3325
+ * Point visibility
3326
+ *
3327
+ * @defaultValue {@link pointsDefaults.pointVisibility}
3328
+ */
3329
+ pointVisibility?: VisibilityConfig;
3330
+ /**
3331
+ * Point opacity
3332
+ *
3333
+ * @defaultValue {@link pointsDefaults.pointOpacity}
3334
+ */
3335
+ pointOpacity?: OpacityConfig;
3336
+ /**
3337
+ * Object-level point size scaling factor
3338
+ *
3339
+ * A unitless scaling factor by which the size of every point of this object is
3340
+ * multiplied, for adjusting point sizes without touching the individual point
3341
+ * sizes or their unit.
3342
+ *
3343
+ * Point sizes are also affected by {@link RawLayer.pointSizeFactor} and by the
3344
+ * project-global {@link WebGLPointsRenderOptions.globalPointSizeFactor}.
3345
+ *
3346
+ * @defaultValue {@link pointsDefaults.pointSizeFactor}
3347
+ */
3348
+ pointSizeFactor?: number;
3349
+ }
3350
+
3351
+ /**
3352
+ * A data source for two-dimensional point clouds
3353
+ */
3354
+ export declare interface RawPointsDataSource<TType extends string = string> extends RawAnnotatedDataSource<TType> {
3355
+ }
3356
+
3357
+ /**
3358
+ * A TissUUmaps project
3359
+ *
3360
+ * Top-level container that assembles layers, data objects (images, labels,
3361
+ * points, shapes), tables, group-to-value maps, and viewer/render options
3362
+ * into a single serializable configuration.
3363
+ */
3364
+ export declare interface RawProject extends RawModel {
3365
+ /**
3366
+ * Project name
3367
+ */
3368
+ name: string;
3369
+ /**
3370
+ * Layers
3371
+ */
3372
+ layers?: RawLayer[];
3373
+ /**
3374
+ * Images
3375
+ */
3376
+ images?: RawImage[];
3377
+ /**
3378
+ * Labels
3379
+ */
3380
+ labels?: RawLabels[];
3381
+ /**
3382
+ * Points
3383
+ */
3384
+ points?: RawPoints[];
3385
+ /**
3386
+ * Shapes
3387
+ */
3388
+ shapes?: RawShapes[];
3389
+ /**
3390
+ * Tables
3391
+ */
3392
+ tables?: RawTable[];
3393
+ /**
3394
+ * Project-global marker maps, referenced by {@link GroupByConfig} marker configurations
3395
+ *
3396
+ * Map IDs are unique within this list; the other lists of maps may reuse them.
3397
+ *
3398
+ * @defaultValue {@link projectDefaults.markerMaps}
3399
+ */
3400
+ markerMaps?: GroupValueMap<Marker>[];
3401
+ /**
3402
+ * Project-global size maps, referenced by {@link GroupByConfig} size configurations
3403
+ *
3404
+ * Map IDs are unique within this list; the other lists of maps may reuse them.
3405
+ *
3406
+ * @defaultValue {@link projectDefaults.sizeMaps}
3407
+ */
3408
+ sizeMaps?: GroupValueMap<number>[];
3409
+ /**
3410
+ * Project-global color maps, referenced by {@link GroupByConfig} color configurations
3411
+ *
3412
+ * Map IDs are unique within this list; the other lists of maps may reuse them.
3413
+ *
3414
+ * @defaultValue {@link projectDefaults.colorMaps}
3415
+ */
3416
+ colorMaps?: GroupValueMap<Color>[];
3417
+ /**
3418
+ * Project-global visibility maps, referenced by {@link GroupByConfig} visibility configurations
3419
+ *
3420
+ * Map IDs are unique within this list; the other lists of maps may reuse them.
3421
+ *
3422
+ * @defaultValue {@link projectDefaults.visibilityMaps}
3423
+ */
3424
+ visibilityMaps?: GroupValueMap<boolean>[];
3425
+ /**
3426
+ * Project-global opacity maps, referenced by {@link GroupByConfig} opacity configurations
3427
+ *
3428
+ * Map IDs are unique within this list; the other lists of maps may reuse them.
3429
+ *
3430
+ * @defaultValue {@link projectDefaults.opacityMaps}
3431
+ */
3432
+ opacityMaps?: GroupValueMap<number>[];
3433
+ /**
3434
+ * OpenSeadragon viewer options for images/labels
3435
+ *
3436
+ * @defaultValue {@link projectDefaults.osOptions}
3437
+ * @see https://openseadragon.github.io/docs/OpenSeadragon.html#.Options
3438
+ */
3439
+ osOptions?: OpenSeadragonOptions;
3440
+ /**
3441
+ * WebGL render options for points/shapes
3442
+ *
3443
+ * @defaultValue {@link projectDefaults.glOptions}
3444
+ */
3445
+ glOptions?: WebGLOptions;
3446
+ /**
3447
+ * Color of the viewer background, behind all rendered content
3448
+ *
3449
+ * @defaultValue {@link projectDefaults.viewerBackgroundColor}
3450
+ */
3451
+ viewerBackgroundColor?: Color;
3452
+ }
3453
+
3454
+ /**
3455
+ * A data object that is rendered
3456
+ *
3457
+ * Which layer(s) a rendered data object is drawn on depends on its kind of
3458
+ * data (see {@link RawRenderedRasterDataObject} and
3459
+ * {@link RawRenderedItemsDataObject}).
3460
+ */
3461
+ export declare interface RawRenderedDataObject<TRawDataSource extends RawDataSource<string>> extends RawDataObject<TRawDataSource> {
3462
+ /**
3463
+ * Data object visibility
3464
+ *
3465
+ * @defaultValue {@link renderedDataObjectDefaults.visibility}
3466
+ */
3467
+ visibility?: boolean;
3468
+ /**
3469
+ * Data object opacity, in the range [0, 1]
3470
+ *
3471
+ * @defaultValue {@link renderedDataObjectDefaults.opacity}
3472
+ */
3473
+ opacity?: number;
3474
+ /**
3475
+ * Transformation from data object space to layer space
3476
+ *
3477
+ * @defaultValue {@link renderedDataObjectDefaults.transform}
3478
+ */
3479
+ transform?: SimilarityTransform;
3480
+ }
3481
+
3482
+ /**
3483
+ * A rendered data object whose data consists of items (e.g. points, shapes)
3484
+ *
3485
+ * Items can be distributed across layers, so the layer may be given per item.
3486
+ * Tables consist of items as well, but are not rendered, and hence are plain
3487
+ * {@link RawDataObject}s.
3488
+ */
3489
+ export declare interface RawRenderedItemsDataObject<TRawDataSource extends RawDataSource<string>> extends RawRenderedDataObject<TRawDataSource> {
3490
+ /**
3491
+ * Layer ID
3492
+ *
3493
+ * Can be specified as:
3494
+ * - An ID of an existing Layer
3495
+ * - A table column holding the layer ID values for each item, of the
3496
+ * object's own table unless it names another
3497
+ */
3498
+ layer: string | TableColumnRef;
3499
+ }
3500
+
3501
+ /**
3502
+ * A rendered data object whose data is a raster (e.g. images, labels)
3503
+ *
3504
+ * A raster cannot be split between layers, so it is drawn on a single layer.
3505
+ */
3506
+ export declare interface RawRenderedRasterDataObject<TRawDataSource extends RawDataSource<string>> extends RawRenderedDataObject<TRawDataSource> {
3507
+ /** Layer ID */
3508
+ layer: string;
3509
+ }
3510
+
3511
+ /**
3512
+ * A two-dimensional shape cloud
3513
+ */
3514
+ export declare interface RawShapes extends RawRenderedItemsDataObject<RawShapesDataSource<string>> {
3515
+ /**
3516
+ * Shape visibility
3517
+ *
3518
+ * Applies to both the fill and the stroke of a shape, on top of
3519
+ * {@link shapeFillVisibility} and {@link shapeStrokeVisibility}.
3520
+ *
3521
+ * @defaultValue {@link shapesDefaults.shapeVisibility}
3522
+ */
3523
+ shapeVisibility?: VisibilityConfig;
3524
+ /**
3525
+ * Shape opacity
3526
+ *
3527
+ * Multiplies {@link shapeFillOpacity} and {@link shapeStrokeOpacity}.
3528
+ *
3529
+ * @defaultValue {@link shapesDefaults.shapeOpacity}
3530
+ */
3531
+ shapeOpacity?: OpacityConfig;
3532
+ /**
3533
+ * Shape fill color
3534
+ *
3535
+ * @defaultValue {@link shapesDefaults.shapeFillColor}
3536
+ */
3537
+ shapeFillColor?: ColorConfig;
3538
+ /**
3539
+ * Shape fill visibility
3540
+ *
3541
+ * @defaultValue {@link shapesDefaults.shapeFillVisibility}
3542
+ */
3543
+ shapeFillVisibility?: VisibilityConfig;
3544
+ /**
3545
+ * Shape fill opacity
3546
+ *
3547
+ * @defaultValue {@link shapesDefaults.shapeFillOpacity}
3548
+ */
3549
+ shapeFillOpacity?: OpacityConfig;
3550
+ /**
3551
+ * Shape stroke color
3552
+ *
3553
+ * @defaultValue {@link shapesDefaults.shapeStrokeColor}
3554
+ */
3555
+ shapeStrokeColor?: ColorConfig;
3556
+ /**
3557
+ * Shape stroke visibility
3558
+ *
3559
+ * @defaultValue {@link shapesDefaults.shapeStrokeVisibility}
3560
+ */
3561
+ shapeStrokeVisibility?: VisibilityConfig;
3562
+ /**
3563
+ * Shape stroke opacity
3564
+ *
3565
+ * @defaultValue {@link shapesDefaults.shapeStrokeOpacity}
3566
+ */
3567
+ shapeStrokeOpacity?: OpacityConfig;
3568
+ }
3569
+
3570
+ /**
3571
+ * A data source for two-dimensional shape clouds
3572
+ */
3573
+ export declare interface RawShapesDataSource<TType extends string = string> extends RawAnnotatedDataSource<TType> {
3574
+ }
3575
+
3576
+ /**
3577
+ * Tabular data
3578
+ */
3579
+ export declare interface RawTable extends RawDataObject<RawTableDataSource<string>> {
3580
+ }
3581
+
3582
+ /**
3583
+ * A data source for tabular data
3584
+ */
3585
+ export declare interface RawTableDataSource<TType extends string = string> extends RawDataSource<TType> {
3586
+ }
3587
+
3588
+ /** An axis-aligned rectangle defined by its top-left corner and dimensions */
3589
+ export declare type Rect = {
3590
+ /** X coordinate of the top-left corner */
3591
+ x: number;
3592
+ /** Y coordinate of the top-left corner */
3593
+ y: number;
3594
+ /** Width of the rectangle */
3595
+ width: number;
3596
+ /** Height of the rectangle */
3597
+ height: number;
3598
+ };
3599
+
3600
+ /**
3601
+ * A {@link RawRenderedDataObject} with {@link renderedDataObjectDefaults} applied
3602
+ */
3603
+ export declare type RenderedDataObject<TDataSource extends DataSource<string>> = DataObject<TDataSource> & Required<Pick<RawRenderedDataObject<TDataSource>, keyof typeof renderedDataObjectDefaults>> & Omit<RawRenderedDataObject<TDataSource>, keyof typeof renderedDataObjectDefaults>;
3604
+
3605
+ /**
3606
+ * Default values for {@link RawRenderedDataObject}
3607
+ */
3608
+ export declare const renderedDataObjectDefaults: {
3609
+ readonly visibility: true;
3610
+ readonly opacity: 1;
3611
+ readonly transform: {
3612
+ readonly flip: false;
3613
+ readonly scale: 1;
3614
+ readonly rotation: 0;
3615
+ readonly translation: {
3616
+ readonly x: 0;
3617
+ readonly y: 0;
3618
+ };
3619
+ };
3620
+ };
3621
+
3622
+ /**
3623
+ * A {@link RawRenderedItemsDataObject} with {@link renderedItemsDataObjectDefaults} applied
3624
+ */
3625
+ export declare type RenderedItemsDataObject<TDataSource extends DataSource<string>> = RenderedDataObject<TDataSource> & Required<Pick<RawRenderedItemsDataObject<TDataSource>, keyof typeof renderedItemsDataObjectDefaults>> & Omit<RawRenderedItemsDataObject<TDataSource>, keyof typeof renderedItemsDataObjectDefaults>;
3626
+
3627
+ /**
3628
+ * Default values for {@link RawRenderedItemsDataObject}
3629
+ */
3630
+ export declare const renderedItemsDataObjectDefaults: {};
3631
+
3632
+ /**
3633
+ * A {@link RawRenderedRasterDataObject} with {@link renderedRasterDataObjectDefaults} applied
3634
+ */
3635
+ export declare type RenderedRasterDataObject<TDataSource extends DataSource<string>> = RenderedDataObject<TDataSource> & Required<Pick<RawRenderedRasterDataObject<TDataSource>, keyof typeof renderedRasterDataObjectDefaults>> & Omit<RawRenderedRasterDataObject<TDataSource>, keyof typeof renderedRasterDataObjectDefaults>;
3636
+
3637
+ /**
3638
+ * Default values for {@link RawRenderedRasterDataObject}
3639
+ */
3640
+ export declare const renderedRasterDataObjectDefaults: {};
3641
+
3642
+ /**
3643
+ * The settings store, i.e. its state and actions
3644
+ */
3645
+ export declare type SettingsStore = SettingsStoreState & SettingsStoreActions;
3646
+
3647
+ /**
3648
+ * The actions of the settings store
3649
+ */
3650
+ export declare type SettingsStoreActions = {
3651
+ /**
3652
+ * Switches the user interface between light and dark mode
3653
+ *
3654
+ * @param dark - Whether to show the user interface in dark mode
3655
+ */
3656
+ setDark: (dark: boolean) => void;
3657
+ };
3658
+
3659
+ /**
3660
+ * The API through which the settings store is read, written and subscribed to
3661
+ */
3662
+ export declare type SettingsStoreApi = Mutate<StoreApi<SettingsStore>, [
3663
+ ["zustand/immer", never]
3664
+ ]>;
3665
+
3666
+ /**
3667
+ * The state of the settings store, holding the user's application settings
3668
+ */
3669
+ export declare type SettingsStoreState = {
3670
+ /** Whether the user interface is shown in dark mode */
3671
+ dark: boolean;
3672
+ };
3673
+
3674
+ /**
3675
+ * A {@link RawShapes} object with {@link shapesDefaults} applied
3676
+ */
3677
+ export declare type Shapes = RenderedItemsDataObject<ShapesDataSource<string>> & Required<Pick<RawShapes, keyof typeof shapesDefaults>> & Omit<RawShapes, keyof typeof shapesDefaults>;
3678
+
3679
+ /**
3680
+ * Loaded shape collection data providing geometry access
3681
+ */
3682
+ export declare interface ShapesData extends ItemsData {
3683
+ /**
3684
+ * Loads the geometry for all shapes
3685
+ *
3686
+ * @param options - Optional abort signal and progress callback
3687
+ * @returns A promise that resolves to the loaded shapes geometry
3688
+ */
3689
+ loadGeometry(options?: {
3690
+ signal?: AbortSignal;
3691
+ onProgress?: ProgressCallback;
3692
+ }): Promise<ShapesGeometry>;
3693
+ }
3694
+
3695
+ /**
3696
+ * Data provider for shape (polygon) collections
3697
+ *
3698
+ * @typeParam TShapesDataSource - The data source type this data provider opens
3699
+ * @typeParam TShapesData - The {@link ShapesData} type produced by this data
3700
+ * provider
3701
+ * @typeParam TNormalizedShapesDataSource - The normalized data source type
3702
+ * produced by `normalize` and accepted by `load`
3703
+ */
3704
+ export declare interface ShapesDataProvider<TShapesDataSource extends ShapesDataSource, TShapesData extends ShapesData, TNormalizedShapesDataSource extends TShapesDataSource = TShapesDataSource> extends AnnotatedDataProvider<TShapesDataSource, TShapesData, TNormalizedShapesDataSource> {
3705
+ }
3706
+
3707
+ /**
3708
+ * A {@link RawShapesDataSource} with {@link shapesDataSourceDefaults} applied
3709
+ */
3710
+ export declare type ShapesDataSource<TType extends string = string> = AnnotatedDataSource<TType> & Required<Pick<RawShapesDataSource<TType>, keyof typeof shapesDataSourceDefaults>> & Omit<RawShapesDataSource<TType>, keyof typeof shapesDataSourceDefaults>;
3711
+
3712
+ /**
3713
+ * Default values for {@link RawShapesDataSource}
3714
+ */
3715
+ export declare const shapesDataSourceDefaults: {};
3716
+
3717
+ /**
3718
+ * Default values for {@link RawShapes}
3719
+ */
3720
+ export declare const shapesDefaults: {
3721
+ readonly shapeVisibility: {
3722
+ readonly constant: {
3723
+ readonly value: true;
3724
+ };
3725
+ };
3726
+ readonly shapeOpacity: {
3727
+ readonly constant: {
3728
+ readonly value: 1;
3729
+ };
3730
+ };
3731
+ readonly shapeFillColor: {
3732
+ readonly constant: {
3733
+ readonly value: {
3734
+ readonly r: 255;
3735
+ readonly g: 255;
3736
+ readonly b: 255;
3737
+ };
3738
+ };
3739
+ };
3740
+ readonly shapeFillVisibility: {
3741
+ readonly constant: {
3742
+ readonly value: true;
3743
+ };
3744
+ };
3745
+ readonly shapeFillOpacity: {
3746
+ readonly constant: {
3747
+ readonly value: 1;
3748
+ };
3749
+ };
3750
+ readonly shapeStrokeColor: {
3751
+ readonly constant: {
3752
+ readonly value: {
3753
+ readonly r: 0;
3754
+ readonly g: 0;
3755
+ readonly b: 0;
3756
+ };
3757
+ };
3758
+ };
3759
+ readonly shapeStrokeVisibility: {
3760
+ readonly constant: {
3761
+ readonly value: true;
3762
+ };
3763
+ };
3764
+ readonly shapeStrokeOpacity: {
3765
+ readonly constant: {
3766
+ readonly value: 1;
3767
+ };
3768
+ };
3769
+ };
3770
+
3771
+ /**
3772
+ * Geometry for shapes (multi-polygons) stored in CSR-style format
3773
+ *
3774
+ * Shapes are organized in a shapes -> polygons -> rings -> vertices structure,
3775
+ * using CSR-style offset arrays to define the relationships between these elements.
3776
+ * Typed arrays are used for efficient storage and transfer across worker boundaries.
3777
+ *
3778
+ * - Shape `s` owns polygons `[shapePolygonOffsets[s], shapePolygonOffsets[s+1])`
3779
+ * - Polygon `p` owns rings `[polygonRingOffsets[p], polygonRingOffsets[p+1])`
3780
+ * - Ring `r` owns vertices `[ringVertexOffsets[r], ringVertexOffsets[r+1])`
3781
+ * - Vertex `v` has coordinates at `coords[2*v]` (x) and `coords[2*v + 1]` (y)
3782
+ */
3783
+ export declare type ShapesGeometry = {
3784
+ /**
3785
+ * Shape --> polygon offsets
3786
+ *
3787
+ * Length: number of shapes + 1 (last entry is total polygon count)
3788
+ *
3789
+ * One entry per shape (multi-polygon), giving the starting polygon index for each shape.
3790
+ */
3791
+ shapePolygonOffsets: Uint32Array;
3792
+ /**
3793
+ * Polygon --> ring offsets
3794
+ *
3795
+ * Length: number of polygons + 1 (last entry is total ring count)
3796
+ *
3797
+ * One entry per polygon, giving the starting ring index for each polygon; the first ring is the shell, and any subsequent rings are holes.
3798
+ */
3799
+ polygonRingOffsets: Uint32Array;
3800
+ /**
3801
+ * Ring --> vertex offsets
3802
+ *
3803
+ * Length: number of rings + 1 (last entry is total vertex count)
3804
+ *
3805
+ * One entry per ring, giving the starting vertex index for each ring; the last vertex of a ring is implicitly connected to the first vertex.
3806
+ */
3807
+ ringVertexOffsets: Uint32Array;
3808
+ /**
3809
+ * Vertex coordinates
3810
+ *
3811
+ * Length: 2 * number of vertices
3812
+ *
3813
+ * Two entries per vertex, giving the x and y coordinates of each vertex; the coordinates of vertex i are at indices 2*i and 2*i + 1 (interleaved).
3814
+ */
3815
+ coords: Float32Array;
3816
+ };
3817
+
3818
+ /** Similarity transform (uniform scale, rotation, translation, and flip) */
3819
+ export declare type SimilarityTransform = {
3820
+ /** Horizontal reflection, applied before scaling, rotation, and translation */
3821
+ flip: boolean;
3822
+ /** Uniform scale factor (1 = no scaling) */
3823
+ scale: number;
3824
+ /** Rotation around origin, in degrees */
3825
+ rotation: number;
3826
+ /** Translation in X and Y, applied after scaling and rotation */
3827
+ translation: {
3828
+ x: number;
3829
+ y: number;
3830
+ };
3831
+ };
3832
+
3833
+ /**
3834
+ * Size configuration
3835
+ *
3836
+ * When sourced from a table column, numerical values are interpreted as sizes
3837
+ * in the specified {@link CoordinateSpace} unit.
3838
+ */
3839
+ export declare type SizeConfig = ConstantConfig<number, {
3840
+ /** Coordinate space in which the size values are specified */
3841
+ unit?: CoordinateSpace;
3842
+ }> | FromConfig<{
3843
+ /** Coordinate space in which the size values are specified */
3844
+ unit?: CoordinateSpace;
3845
+ }> | GroupByConfig<true, {
3846
+ /** Coordinate space in which the size values are specified */
3847
+ unit?: CoordinateSpace;
3848
+ }>;
3849
+
3850
+ /**
3851
+ * Utility methods for resolving the `source` of data sources to URLs or file
3852
+ * system handles
3853
+ *
3854
+ * A source is one of the following, tried in this order:
3855
+ *
3856
+ * 1. A URL with a scheme (e.g. `https://…`, `blob:…`, `data:…`), which is
3857
+ * normalized and returned as is.
3858
+ * 2. An app-relative path, prefixed with `//`, resolved against the base URL
3859
+ * of the application (e.g. `//data/points.csv`).
3860
+ * 3. A workspace-relative path, prefixed with `/`, resolved to a file or
3861
+ * directory within the open workspace (e.g. `/data/points.csv`). Without an
3862
+ * open workspace it falls back to being app-relative.
3863
+ * 4. A project-relative path, without prefix, resolved against where the
3864
+ * project was loaded from: a URL, or a workspace-relative path (e.g.
3865
+ * `points.csv`, `./points.csv`, `../shared/points.csv`). Without a project
3866
+ * source it falls back to being workspace-relative. Whenever it resolves to
3867
+ * a workspace-relative path - against a workspace-relative project source,
3868
+ * or through that fallback - it falls back further to being app-relative if
3869
+ * no workspace is open.
3870
+ *
3871
+ * Resolution happens in two steps:
3872
+ *
3873
+ * 1. {@link SourceUtils.normalizeSource} classifies the source, applies the
3874
+ * fallbacks and normalizes it, synchronously and without touching the file
3875
+ * system. The result is either an absolute URL or a workspace-relative
3876
+ * path. Sources referring to the same data normalize to the same string,
3877
+ * and normalizing a normalized source yields it unchanged.
3878
+ * 2. {@link SourceUtils.resolveSource} opens the file or directory that a
3879
+ * normalized workspace-relative path refers to;
3880
+ * {@link SourceUtils.resolveSourceFile} and
3881
+ * {@link SourceUtils.resolveSourceDirectory} accept only one of the two,
3882
+ * and {@link SourceUtils.openSourceFile} also opens the file.
3883
+ * URLs need no such step and are returned as is.
3884
+ *
3885
+ * Paths use `/` as separator and may contain `.` and `..` segments. Resolving
3886
+ * against a URL follows URL semantics: `..` segments beyond the root of the
3887
+ * URL's path are dropped silently. Resolving within the workspace collapses the
3888
+ * segments and fails if the path leaves the workspace.
3889
+ *
3890
+ * A relative path whose first segment contains a colon (e.g.
3891
+ * `sample1:ch2.tif`) is taken for a URL; write it as `./sample1:ch2.tif`
3892
+ * instead.
3893
+ */
3894
+ export declare class SourceUtils {
3895
+ private static readonly _pathSep;
3896
+ private static readonly _appPathPrefix;
3897
+ private static readonly _workspacePathPrefix;
3898
+ private static readonly _urlSchemePattern;
3899
+ /**
3900
+ * Returns whether a normalized source refers to a file or directory within
3901
+ * the workspace
3902
+ *
3903
+ * @param normalizedSource - The normalized source (see
3904
+ * {@link SourceUtils.normalizeSource})
3905
+ * @returns `true` for workspace-relative paths, `false` for URLs and
3906
+ * app-relative paths
3907
+ */
3908
+ static isWorkspacePath(normalizedSource: string): boolean;
3909
+ /**
3910
+ * Builds a workspace-relative path from the segments of a path within the
3911
+ * workspace, as returned by `FileSystemDirectoryHandle.resolve`
3912
+ *
3913
+ * @param segments - The path segments, from the workspace root down to the
3914
+ * file or directory
3915
+ * @returns The workspace-relative path (with `/` prefix)
3916
+ */
3917
+ static makeWorkspacePath(segments: string[]): string;
3918
+ /**
3919
+ * Returns the directory that contains a normalized source
3920
+ *
3921
+ * @param normalizedSource - The normalized source (see
3922
+ * {@link SourceUtils.normalizeSource})
3923
+ * @returns The normalized parent source and the name of the source within
3924
+ * it, decoded for URLs; `null` if the source is the root of its URL's path
3925
+ * or lies directly in the workspace, as the workspace root is no source
3926
+ */
3927
+ static getParentSource(normalizedSource: string): {
3928
+ parentSource: string;
3929
+ name: string;
3930
+ } | null;
3931
+ /**
3932
+ * Normalizes a source, applying the fallbacks for missing project sources
3933
+ * and workspaces
3934
+ *
3935
+ * @param source - The source to normalize
3936
+ * @param workspace - The directory handle of the open workspace, if any
3937
+ * @param projectSource - Where the project was loaded from: its absolute URL,
3938
+ * the workspace-relative path of the project file (with `/` prefix), or
3939
+ * `null` for projects that were loaded from neither (e.g. uploaded ones)
3940
+ * @param options - Optional base URL that app-relative paths are resolved
3941
+ * against (default `document.baseURI`); the application relies on the
3942
+ * default, and the option is what keeps normalization a pure function of
3943
+ * its arguments, testable without a `document`
3944
+ * @returns The absolute URL for URLs, app-relative paths, and paths that fall
3945
+ * back to being app-relative or resolve against a project URL; or the
3946
+ * normalized workspace-relative path (with `/` prefix) for paths within the
3947
+ * open workspace
3948
+ * @throws Error if the source is empty or not a valid URL, or if it cannot be
3949
+ * normalized as a project-relative, workspace-relative or app-relative path
3950
+ * (see {@link SourceUtils._normalizeProjectPath},
3951
+ * {@link SourceUtils._normalizeWorkspacePath} and
3952
+ * {@link SourceUtils._normalizeAppPath})
3953
+ */
3954
+ static normalizeSource(source: string, workspace: FileSystemDirectoryHandle | null, projectSource: string | null, options?: {
3955
+ baseUrl?: string;
3956
+ }): string;
3957
+ /**
3958
+ * Resolves a normalized source to an absolute URL, a file handle or a
3959
+ * directory handle
3960
+ *
3961
+ * URLs are returned as is. A workspace-relative path is opened within the
3962
+ * workspace one directory at a time, and its last segment as a file, or as a
3963
+ * directory if it names one. No fallbacks apply here: the source has to be
3964
+ * normalized with {@link SourceUtils.normalizeSource} first, using the same
3965
+ * workspace. Nothing is thrown synchronously: the returned promise rejects
3966
+ * instead.
3967
+ *
3968
+ * @param normalizedSource - The normalized source to resolve: an absolute URL
3969
+ * or a workspace-relative path (with `/` prefix), as returned by
3970
+ * {@link SourceUtils.normalizeSource}
3971
+ * @param workspace - The directory handle of the open workspace, if any
3972
+ * @param options - Optional abort signal, checked upfront and between file
3973
+ * system calls
3974
+ * @returns A promise that resolves to the absolute URL, or to the file or
3975
+ * directory handle for sources within the workspace
3976
+ * @throws Error if a workspace-relative path is given without an open
3977
+ * workspace, or if the path leaves the workspace or names its root
3978
+ * @throws DOMException if a segment names nothing within the workspace
3979
+ * (`NotFoundError`), if a segment other than the last names a file
3980
+ * (`TypeMismatchError`), or if the operation is aborted (`AbortError`)
3981
+ */
3982
+ static resolveSource(normalizedSource: string, workspace: FileSystemDirectoryHandle | null, options?: {
3983
+ signal?: AbortSignal;
3984
+ }): Promise<string | FileSystemFileHandle | FileSystemDirectoryHandle>;
3985
+ /**
3986
+ * Resolves a normalized source to an absolute URL or a file handle
3987
+ *
3988
+ * Like {@link SourceUtils.resolveSource}, for sources that have to refer to
3989
+ * a file.
3990
+ *
3991
+ * @param normalizedSource - See {@link SourceUtils.resolveSource}
3992
+ * @param workspace - See {@link SourceUtils.resolveSource}
3993
+ * @param options - See {@link SourceUtils.resolveSource}
3994
+ * @returns A promise that resolves to the absolute URL, or to the file handle
3995
+ * for sources within the workspace
3996
+ * @throws See {@link SourceUtils.resolveSource}
3997
+ * @throws DOMException if the source refers to a directory within the
3998
+ * workspace (`TypeMismatchError`)
3999
+ */
4000
+ static resolveSourceFile(normalizedSource: string, workspace: FileSystemDirectoryHandle | null, options?: {
4001
+ signal?: AbortSignal;
4002
+ }): Promise<string | FileSystemFileHandle>;
4003
+ /**
4004
+ * Resolves a normalized source to an absolute URL or an opened file
4005
+ *
4006
+ * Like {@link SourceUtils.resolveSourceFile}, for readers that take either
4007
+ * a URL or a `File`: a file in the workspace is opened right away.
4008
+ *
4009
+ * @param normalizedSource - See {@link SourceUtils.resolveSource}
4010
+ * @param workspace - See {@link SourceUtils.resolveSource}
4011
+ * @param options - See {@link SourceUtils.resolveSource}; the signal is
4012
+ * also checked once the file is open, as opening it does not throw on
4013
+ * abort
4014
+ * @returns A promise that resolves to the absolute URL, or to the opened
4015
+ * file for sources within the workspace
4016
+ * @throws See {@link SourceUtils.resolveSourceFile}
4017
+ * @throws DOMException if the file cannot be opened, e.g. because it was
4018
+ * removed (`NotFoundError`) or its read permission was revoked
4019
+ * (`NotAllowedError`)
4020
+ * @throws The abort reason of the signal, if it is aborted once the file
4021
+ * is open
4022
+ */
4023
+ static openSourceFile(normalizedSource: string, workspace: FileSystemDirectoryHandle | null, options?: {
4024
+ signal?: AbortSignal;
4025
+ }): Promise<{
4026
+ url: string;
4027
+ file?: undefined;
4028
+ } | {
4029
+ url?: undefined;
4030
+ file: File;
4031
+ }>;
4032
+ /**
4033
+ * Resolves a normalized source to an absolute URL or a directory handle
4034
+ *
4035
+ * Like {@link SourceUtils.resolveSource}, for sources that have to refer to
4036
+ * a directory.
4037
+ *
4038
+ * @param normalizedSource - See {@link SourceUtils.resolveSource}
4039
+ * @param workspace - See {@link SourceUtils.resolveSource}
4040
+ * @param options - See {@link SourceUtils.resolveSource}
4041
+ * @returns A promise that resolves to the absolute URL, or to the directory
4042
+ * handle for sources within the workspace
4043
+ * @throws See {@link SourceUtils.resolveSource}
4044
+ * @throws DOMException if the source refers to a file within the workspace
4045
+ * (`TypeMismatchError`)
4046
+ */
4047
+ static resolveSourceDirectory(normalizedSource: string, workspace: FileSystemDirectoryHandle | null, options?: {
4048
+ signal?: AbortSignal;
4049
+ }): Promise<string | FileSystemDirectoryHandle>;
4050
+ /**
4051
+ * Normalizes a project-relative path
4052
+ *
4053
+ * Against a project URL, the path is resolved to an absolute URL. Against a
4054
+ * workspace-relative project path, the path is resolved within the project
4055
+ * file's directory to a workspace-relative path. Without a project source,
4056
+ * the path is normalized as a workspace-relative path as is. Both of the
4057
+ * latter go through {@link SourceUtils._normalizeWorkspacePath}, including
4058
+ * its fallback for when no workspace is open.
4059
+ *
4060
+ * @param projectPath - The project-relative path (without prefix)
4061
+ * @param workspace - The directory handle of the open workspace, if any
4062
+ * @param projectSource - See {@link SourceUtils.normalizeSource}
4063
+ * @param options - Optional base URL for the app-relative fallback (see
4064
+ * {@link SourceUtils._normalizeAppPath})
4065
+ * @returns The absolute URL, or the normalized workspace-relative path
4066
+ * @throws Error if the path does not form a valid URL with the project URL,
4067
+ * if it leaves the workspace, or if it cannot be normalized as a
4068
+ * workspace-relative path (see {@link SourceUtils._normalizeWorkspacePath})
4069
+ */
4070
+ private static _normalizeProjectPath;
4071
+ /**
4072
+ * Normalizes a workspace-relative path
4073
+ *
4074
+ * With an open workspace, the path's segments are collapsed and the `/`
4075
+ * prefix is kept. Without one, the path is normalized as an app-relative
4076
+ * path instead (see {@link SourceUtils._normalizeAppPath}), dropping its `/`
4077
+ * prefix: `/data/points.csv` then resolves like `//data/points.csv`.
4078
+ *
4079
+ * @param workspacePath - The workspace-relative path (with `/` prefix)
4080
+ * @param workspace - The directory handle of the open workspace, if any
4081
+ * @param options - Optional base URL for the app-relative fallback (see
4082
+ * {@link SourceUtils._normalizeAppPath})
4083
+ * @returns The normalized workspace-relative path, or the absolute URL if no
4084
+ * workspace is open
4085
+ * @throws Error if the path lacks the `/` prefix, or if it leaves the
4086
+ * workspace or names its root (with an open workspace) or cannot be
4087
+ * normalized as an app-relative path (without one, see
4088
+ * {@link SourceUtils._normalizeAppPath})
4089
+ */
4090
+ private static _normalizeWorkspacePath;
4091
+ /**
4092
+ * Normalizes an app-relative path to an absolute URL
4093
+ *
4094
+ * The path is resolved against the base URL like a relative URL, so `..`
4095
+ * segments can lead above the application and a `/` right after the prefix
4096
+ * makes the path absolute within the origin.
4097
+ *
4098
+ * @param appPath - The app-relative path (with `//` prefix)
4099
+ * @param options - Optional base URL to resolve against (default
4100
+ * `document.baseURI`)
4101
+ * @returns The absolute URL
4102
+ * @throws Error if the path lacks the `//` prefix
4103
+ * @throws TypeError if the path does not form a valid URL with the base URL
4104
+ */
4105
+ private static _normalizeAppPath;
4106
+ /**
4107
+ * Splits a path into segments, dropping empty and `.` segments and
4108
+ * collapsing `..` segments against the segments preceding them
4109
+ *
4110
+ * @param path - The path to split, using `/` as separator
4111
+ * @param baseSegments - The segments of the directory the path is relative
4112
+ * to, which `..` segments collapse against first (default: the root)
4113
+ * @returns The collapsed segments, empty if the path names the root itself
4114
+ * @throws Error if the path leads above the root
4115
+ */
4116
+ private static _collapseSegments;
4117
+ }
4118
+
4119
+ /**
4120
+ * A {@link RawTable} with {@link tableDefaults} applied
4121
+ */
4122
+ export declare type Table = DataObject<TableDataSource<string>> & Required<Pick<RawTable, keyof typeof tableDefaults>> & Omit<RawTable, keyof typeof tableDefaults>;
4123
+
4124
+ /** A column query suggested by `TableData.suggestColumnQueries` */
4125
+ export declare type TableColumnQuerySuggestion = {
4126
+ /** The suggested query, in the provider's own format */
4127
+ query: string;
4128
+ /**
4129
+ * Whether the query continues into a group of columns
4130
+ *
4131
+ * A group suggestion does not resolve to a column; it continues the query,
4132
+ * e.g. into the columns of a group or a matrix. Other suggestions are
4133
+ * expected to resolve to an exact column name.
4134
+ *
4135
+ * @defaultValue false
4136
+ */
4137
+ group?: boolean;
4138
+ };
4139
+
4140
+ /** Reference to a table column */
4141
+ export declare type TableColumnRef = {
4142
+ /**
4143
+ * ID of the table holding the column
4144
+ *
4145
+ * If not specified, the table of the data source is used.
4146
+ */
4147
+ table?: string;
4148
+ /** Name of the table column */
4149
+ column: string;
4150
+ };
4151
+
4152
+ /**
4153
+ * Loaded tabular data providing column-wise access
4154
+ *
4155
+ * The items of a table are its rows, each of which annotates one item of
4156
+ * another data object (see `AnnotatedDataSource`); the item IDs and names are
4157
+ * those of the annotated items, in row order.
4158
+ */
4159
+ export declare interface TableData extends ItemsData {
4160
+ /**
4161
+ * Returns column query suggestions for the current query
4162
+ *
4163
+ * The query format is up to the provider. Suggestions matching the current
4164
+ * query come first, best matches first, followed by the other suggestions.
4165
+ * The list is not capped.
4166
+ *
4167
+ * @param currentQuery - The partial column query to autocomplete
4168
+ * @param options - Optional abort signal
4169
+ * @returns A list of suggested column queries
4170
+ */
4171
+ suggestColumnQueries(currentQuery: string, options?: {
4172
+ signal?: AbortSignal;
4173
+ }): Promise<TableColumnQuerySuggestion[]>;
4174
+ /**
4175
+ * Resolves a query to an exact column name
4176
+ *
4177
+ * @param query - The column query
4178
+ * @param options - Optional abort signal
4179
+ * @returns The resolved column name, or `null` if no match is found
4180
+ */
4181
+ resolveColumnQuery(query: string, options?: {
4182
+ signal?: AbortSignal;
4183
+ }): Promise<string | null>;
4184
+ /**
4185
+ * Loads a column's values
4186
+ *
4187
+ * Numeric columns are loaded as numeric typed arrays, all other columns as
4188
+ * plain arrays (see `TypedArrayOrArray`).
4189
+ *
4190
+ * @typeParam T - Element type of the returned array
4191
+ * @param column - The column name
4192
+ * @param options - Optional abort signal and progress callback
4193
+ * @returns The column values
4194
+ */
4195
+ loadValues<T>(column: string, options?: {
4196
+ signal?: AbortSignal;
4197
+ onProgress?: ProgressCallback;
4198
+ }): Promise<TypedArrayOrArray<T>>;
4199
+ /**
4200
+ * Loads the number of rows per unique value of a column
4201
+ *
4202
+ * @typeParam T - Element type of the column
4203
+ * @param column - The column name
4204
+ * @param options - Optional abort signal and progress callback
4205
+ * @returns The row count of every unique column value, keyed by value, in the
4206
+ * order the values first appear
4207
+ */
4208
+ loadUniqueValueCounts<T>(column: string, options?: {
4209
+ signal?: AbortSignal;
4210
+ onProgress?: ProgressCallback;
4211
+ }): Promise<Map<T, number>>;
4212
+ /**
4213
+ * Loads a column's minimum and maximum values
4214
+ *
4215
+ * @param column - The column name
4216
+ * @param options - Optional abort signal and progress callback
4217
+ * @returns The numeric [min, max] value range of the column, or `undefined` if not numeric
4218
+ */
4219
+ loadValueRange(column: string, options?: {
4220
+ signal?: AbortSignal;
4221
+ onProgress?: ProgressCallback;
4222
+ }): Promise<[number, number] | undefined>;
4223
+ }
4224
+
4225
+ /**
4226
+ * Data provider for tabular data
4227
+ *
4228
+ * @typeParam TTableDataSource - The data source type this data provider opens
4229
+ * @typeParam TTableData - The {@link TableData} type produced by this data
4230
+ * provider
4231
+ * @typeParam TNormalizedTableDataSource - The normalized data source type
4232
+ * produced by `normalize` and accepted by `load`
4233
+ */
4234
+ export declare interface TableDataProvider<TTableDataSource extends TableDataSource, TTableData extends TableData, TNormalizedTableDataSource extends TTableDataSource = TTableDataSource> extends DataProvider<TTableDataSource, TTableData, TNormalizedTableDataSource> {
4235
+ }
4236
+
4237
+ /**
4238
+ * A {@link RawTableDataSource} with {@link tableDataSourceDefaults} applied
4239
+ */
4240
+ export declare type TableDataSource<TType extends string = string> = DataSource<TType> & Required<Pick<RawTableDataSource<TType>, keyof typeof tableDataSourceDefaults>> & Omit<RawTableDataSource<TType>, keyof typeof tableDataSourceDefaults>;
4241
+
4242
+ /**
4243
+ * Default values for {@link RawTableDataSource}
4244
+ */
4245
+ export declare const tableDataSourceDefaults: {};
4246
+
4247
+ /**
4248
+ * Default values for {@link RawTable}
4249
+ */
4250
+ export declare const tableDefaults: {};
4251
+
4252
+ /**
4253
+ * Lookups into tabular data (`TableData`) by item ID
4254
+ *
4255
+ * A table annotates the items of another data object: each of its rows holds
4256
+ * the item ID it belongs to, and consumers address rows by that ID rather than
4257
+ * by position (see `ItemsData`). Looking rows up by ID needs a map from ID to
4258
+ * row index, which is linear in the size of the table to build and costly to
4259
+ * hold; {@link forEachRow} therefore builds it at most once per table, and not
4260
+ * at all in the common case that the IDs to look up are the table's own, in
4261
+ * row order. Once built, the map is retained for as long as the table's data
4262
+ * is: it is keyed by the identity of the table's ID array, so it is freed
4263
+ * together with the data, and a table that is looked up by other IDs - shapes
4264
+ * annotated by a separate table, or the items of one layer of an object -
4265
+ * keeps one entry per row alive until then. That is the price of sharing the
4266
+ * map between every consumer of the table.
4267
+ *
4268
+ * Item IDs are expected to be unique within a table (see `ItemsData`). For a
4269
+ * duplicated ID, the row-order fast path addresses each row by its own
4270
+ * position, whereas the lookup maps the ID to its last row; a table with
4271
+ * duplicated IDs is reported once, when its map is built.
4272
+ *
4273
+ * On top of the row lookup, {@link fillFromTableValues} and
4274
+ * {@link fillFromTableGroups} fill a typed array with one packed value per
4275
+ * item from a table column, one by parsing the cell values and one by mapping
4276
+ * their distinct values as groups. IDs that the table does not contain fall
4277
+ * back to a default value, with a warning.
4278
+ */
4279
+ export declare class TableUtils {
4280
+ /**
4281
+ * Row indices by item ID, by the table's ID array
4282
+ *
4283
+ * Keyed by the array that `getIds()` returns, which stays the very same array
4284
+ * for as long as the data is unchanged (see `ItemsData`), so an entry lives
4285
+ * exactly as long as the data it was built from. Holds the pending build,
4286
+ * so that concurrent lookups share it.
4287
+ */
4288
+ private static readonly _rowIndicesCache;
4289
+ /**
4290
+ * Fills `packedValues` by loading values from the given table column
4291
+ *
4292
+ * For each ID in `ids`, the corresponding row is looked up in the table by ID
4293
+ * (see {@link forEachRow}). The raw cell value is parsed by
4294
+ * `parseTableValue`; if that fails, or if the table does not contain the ID,
4295
+ * `defaultValue` is used instead.
4296
+ *
4297
+ * @param packedValues - Output typed array to fill, in the order of `ids`
4298
+ * @param tableData - The table to look up values in
4299
+ * @param ids - Ordered list of item IDs
4300
+ * @param column - Name of the table column to load values from
4301
+ * @param defaultValue - Value used when the ID is missing or parsing fails
4302
+ * @param parseTableValue - Converts a raw cell value to `TValue`, or to
4303
+ * `undefined` on failure
4304
+ * @param packValue - Converts `TValue` to the numeric representation stored
4305
+ * in `packedValues`
4306
+ * @param options - Optional abort signal
4307
+ */
4308
+ static fillFromTableValues<TValue>(packedValues: TypedArray, tableData: TableData, ids: IDArray, column: string, defaultValue: TValue, parseTableValue: (value: unknown) => TValue | undefined, packValue: (value: TValue) => number, options?: {
4309
+ signal?: AbortSignal;
4310
+ }): Promise<void>;
4311
+ /**
4312
+ * Fills `packedValues` by grouping IDs by the given table column and mapping the groups to values
4313
+ *
4314
+ * For each ID in `ids`, the corresponding row is looked up in the table by ID
4315
+ * (see {@link forEachRow}). The raw cell value is converted to a string to
4316
+ * form the group key, which `mapGroupToValue` maps to a value; if the table
4317
+ * does not contain the ID, `defaultValue` is used instead. Groups are
4318
+ * resolved once per distinct cell value, i.e. `mapGroupToValue` is not
4319
+ * called per item.
4320
+ *
4321
+ * @param packedValues - Output typed array to fill, in the order of `ids`
4322
+ * @param tableData - The table to look up group keys in
4323
+ * @param ids - Ordered list of item IDs
4324
+ * @param column - Name of the table column to load group keys from
4325
+ * @param defaultValue - Value used when the ID is missing
4326
+ * @param mapGroupToValue - Maps a group key (the cell value as a string) to
4327
+ * `TValue`
4328
+ * @param packValue - Converts `TValue` to the numeric representation stored
4329
+ * in `packedValues`
4330
+ * @param options - Optional abort signal
4331
+ */
4332
+ static fillFromTableGroups<TValue>(packedValues: TypedArray, tableData: TableData, ids: IDArray, column: string, defaultValue: TValue, mapGroupToValue: (group: string) => TValue, packValue: (value: TValue) => number, options?: {
4333
+ signal?: AbortSignal;
4334
+ }): Promise<void>;
4335
+ /**
4336
+ * Calls `callback` for every ID with the index of the table row holding that ID
4337
+ *
4338
+ * If `ids` is the table's own ID array, the ID at position `i` is held by
4339
+ * row `i` and no lookup is needed. Otherwise the rows are looked up in the
4340
+ * table's row indices (see {@link getRowIndices}); IDs the table does not
4341
+ * contain are reported with an undefined row index.
4342
+ *
4343
+ * @param ids - Ordered list of item IDs
4344
+ * @param tableData - The table to look the IDs up in
4345
+ * @param callback - Called with the row index of each ID, or `undefined` if
4346
+ * the table does not contain it, and the position of the ID in `ids`
4347
+ * @param options - Optional abort signal
4348
+ */
4349
+ static forEachRow(ids: IDArray, tableData: TableData, callback: (rowIndex: number | undefined, i: number) => void, options?: {
4350
+ signal?: AbortSignal;
4351
+ }): Promise<void>;
4352
+ /**
4353
+ * Returns the row indices of a table by item ID
4354
+ *
4355
+ * Built at most once per table, cooperatively yielding, and shared by all
4356
+ * callers, which is why a caller's abort signal only detaches that caller:
4357
+ * the build itself keeps going for the others, and for the next lookup.
4358
+ *
4359
+ * @param tableData - The table to return the row indices of
4360
+ * @param options - Optional abort signal
4361
+ * @returns The row index of every item ID of the table; for an ID occurring
4362
+ * more than once, which is reported with a warning, the index of its last row
4363
+ */
4364
+ static getRowIndices(tableData: TableData, options?: {
4365
+ signal?: AbortSignal;
4366
+ }): Promise<ReadonlyMap<number | string, number>>;
4367
+ /**
4368
+ * Builds the row indices by item ID for the given table IDs
4369
+ */
4370
+ private static _buildRowIndices;
4371
+ }
4372
+
4373
+ /** Configuration object accepted by OpenSeadragon as a tile source */
4374
+ export declare type TileSourceConfig = object;
4375
+
4376
+ /**
4377
+ * Utility methods for converting between {@link SimilarityTransform}
4378
+ * objects and `gl-matrix` {@link mat3} matrices
4379
+ */
4380
+ export declare class TransformUtils {
4381
+ /**
4382
+ * Decomposes a 3×3 similarity matrix into a {@link SimilarityTransform}
4383
+ *
4384
+ * Extracts flip, uniform scale, rotation (in degrees), and translation
4385
+ * from a column-major `gl-matrix` {@link mat3}. A negative 2D determinant
4386
+ * indicates a horizontal reflection.
4387
+ *
4388
+ * If `pivot` is given, flip and rotation are expressed about `pivot`
4389
+ * (in the input coordinates of `m`) instead of the origin, while scale
4390
+ * stays about the origin. Flip, scale, and rotation are unaffected; only
4391
+ * the translation changes to `m(pivot) - scale * pivot`, i.e. the position
4392
+ * of the scaled content before it is flipped and rotated about its (scaled)
4393
+ * pivot. This matches viewers that place an image by its top-left corner
4394
+ * and then flip/rotate it about its center.
4395
+ *
4396
+ * @param m - The source matrix
4397
+ * @param pivot - Optional point about which flip and rotation are expressed
4398
+ * @returns The decomposed transform
4399
+ */
4400
+ static decompose(m: mat3, pivot?: {
4401
+ x: number;
4402
+ y: number;
4403
+ }): SimilarityTransform;
4404
+ /**
4405
+ * Builds a 3×3 similarity matrix from a (partial) {@link SimilarityTransform}
4406
+ *
4407
+ * Applies, in order: flip/scale, rotation, and translation.
4408
+ *
4409
+ * If `pivot` is given, flip and rotation are applied about `pivot` (in the
4410
+ * source coordinates of the transform) instead of the origin, while scale
4411
+ * stays about the origin. The translation is then the position of the
4412
+ * scaled content before it is flipped and rotated about its (scaled)
4413
+ * pivot. This is the inverse of {@link decompose} called with
4414
+ * the same pivot.
4415
+ *
4416
+ * @param tf - The transform components (all optional)
4417
+ * @param pivot - Optional point about which flip and rotation are applied
4418
+ * @returns The composed matrix
4419
+ */
4420
+ static compose(tf: Partial<SimilarityTransform>, pivot?: {
4421
+ x: number;
4422
+ y: number;
4423
+ }): mat3;
4424
+ /**
4425
+ * Transforms an axis-aligned rectangle and returns the axis-aligned bounding box of the transformed corners
4426
+ *
4427
+ * @param rect - The rectangle to transform
4428
+ * @param m - The transformation matrix to apply to the rectangle corners
4429
+ * @returns The axis-aligned bounding box of the transformed rectangle
4430
+ */
4431
+ static transformBoundingBox(rect: Rect, m: mat3): Rect;
4432
+ }
4433
+
4434
+ /** Union of all natively supported numeric typed arrays */
4435
+ export declare type TypedArray = IntOrUintArray | FloatArray;
4436
+
4437
+ /**
4438
+ * The array types that can hold values of type `T`
4439
+ *
4440
+ * Numbers are held by numeric typed arrays only, anything else by a plain
4441
+ * array. For an unconstrained `T`, both are possible.
4442
+ */
4443
+ export declare type TypedArrayOrArray<T> = [T] extends [number] ? TypedArray : unknown extends T ? TypedArray | T[] : T[];
4444
+
4445
+ /** Union of all natively supported unsigned integer typed arrays */
4446
+ export declare type UintArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array;
4447
+
4448
+ /** A 2-D point */
4449
+ export declare type Vertex = {
4450
+ /** X coordinate of the vertex */
4451
+ x: number;
4452
+ /** Y coordinate of the vertex */
4453
+ y: number;
4454
+ };
4455
+
4456
+ /**
4457
+ * Visibility configuration
4458
+ *
4459
+ * Numerical table values are interpreted as booleans, where `0` is `false` and any other value is `true`.
4460
+ */
4461
+ export declare type VisibilityConfig = ConstantConfig<boolean> | FromConfig | GroupByConfig<true>;
4462
+
4463
+ /**
4464
+ * Options for the WebGL renderers
4465
+ */
4466
+ export declare type WebGLOptions = {
4467
+ /** Options for rendering the project's points */
4468
+ pointsRenderOptions: WebGLPointsRenderOptions;
4469
+ /** Options for rendering the project's shapes */
4470
+ shapesRenderOptions: WebGLShapesRenderOptions;
4471
+ };
4472
+
4473
+ /**
4474
+ * Options for rendering points
4475
+ */
4476
+ export declare type WebGLPointsRenderOptions = {
4477
+ /**
4478
+ * Unitless factor by which the size of every point is multiplied
4479
+ *
4480
+ * Applies on top of the layer- and object-level point size settings.
4481
+ */
4482
+ globalPointSizeFactor: number;
4483
+ };
4484
+
4485
+ /**
4486
+ * Options for rendering shapes
4487
+ */
4488
+ export declare type WebGLShapesRenderOptions = {
4489
+ /** Width of the shape outlines, in world coordinates */
4490
+ strokeWidth: number;
4491
+ /**
4492
+ * Number of polygon edges of a typical shape that a scanline holds, when
4493
+ * rasterizing a shapes object
4494
+ *
4495
+ * The rasterizer divides a shapes object's bounding box into horizontal
4496
+ * scanlines, and each scanline into x-bins, and lists for each of them the
4497
+ * shapes and polygon edges reaching into it (including their padding, see
4498
+ * {@link shapePadding}), so that the fragment shader only has to consider
4499
+ * those. As edges are only assigned to scanlines, the scanline height bounds
4500
+ * the number of edges a fragment tests per shape. Fewer edges per scanline
4501
+ * mean fewer edges to test per fragment, at the cost of a larger scanline
4502
+ * texture, as shapes and edges spanning several scanlines are listed in each
4503
+ * of them.
4504
+ */
4505
+ edgesPerScanline: number;
4506
+ /**
4507
+ * Width of the x-bins of the scanlines a shapes object is rasterized into
4508
+ * (see {@link edgesPerScanline}), relative to the median width of its shapes
4509
+ *
4510
+ * The bin width bounds the number of shapes a fragment considers. Narrower
4511
+ * bins mean fewer shapes to consider per fragment, at the cost of a larger
4512
+ * scanline texture, as shapes spanning several bins are listed in each of
4513
+ * them.
4514
+ */
4515
+ binWidthFactor: number;
4516
+ /**
4517
+ * Fraction of the median height and width of the shapes that shapes and
4518
+ * polygon edges are padded by on either side when rasterizing a shapes
4519
+ * object (see {@link edgesPerScanline})
4520
+ *
4521
+ * Strokes and anti-aliased edges reaching beyond a shape are only drawn
4522
+ * within the padding, i.e. half the stroke width is limited to this fraction
4523
+ * of the median shape height vertically and of the median shape width
4524
+ * horizontally, whatever the numbers of scanlines and bins. Zoomed out far
4525
+ * enough that the padding is only about a pixel, even the thinnest strokes
4526
+ * and anti-aliased edges are cut off. Larger paddings let strokes reach
4527
+ * further, at the cost of more shapes and edges to test per fragment and a
4528
+ * larger scanline texture.
4529
+ */
4530
+ shapePadding: number;
4531
+ };
4532
+
4533
+ export { }