@atlas-viewer/atlas 1.6.6 → 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +2562 -1353
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +2571 -1349
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +73 -381
- package/dist/index.umd.js.map +1 -1
- package/dist/standalone.umd.js +17 -190
- package/dist/standalone.umd.js.map +1 -1
- package/dist/types/clean-objects/base.object.d.ts +31 -0
- package/dist/types/clean-objects/box.object.d.ts +17 -0
- package/dist/types/clean-objects/composite.object.d.ts +4 -0
- package/dist/types/clean-objects/container.object.d.ts +11 -0
- package/dist/types/clean-objects/image.object.d.ts +20 -0
- package/dist/types/clean-objects/texture.object.d.ts +0 -0
- package/dist/types/clean-objects/tiles.object.d.ts +0 -0
- package/dist/types/clean-objects/traits/container.d.ts +5 -0
- package/dist/types/clean-objects/traits/evented.d.ts +312 -0
- package/dist/types/clean-objects/traits/generic-object.d.ts +61 -0
- package/dist/types/clean-objects/traits/has-styles.d.ts +60 -0
- package/dist/types/clean-objects/traits/hosts.d.ts +59 -0
- package/dist/types/clean-objects/traits/layout.d.ts +61 -0
- package/dist/types/clean-objects/traits/paintable.d.ts +16 -0
- package/dist/types/clean-objects/traits/revision.d.ts +7 -0
- package/dist/types/clean-objects/traits/scheduled-updates.d.ts +9 -0
- package/dist/types/clean-objects/world.object.d.ts +15 -0
- package/dist/types/clean-objects/zone.object.d.ts +0 -0
- package/dist/types/events.d.ts +29 -29
- package/dist/types/index.d.ts +5 -0
- package/dist/types/modules/browser-event-manager/browser-event-manager.d.ts +6 -1
- package/dist/types/modules/canvas-renderer/canvas-renderer.d.ts +11 -1
- package/dist/types/modules/composite-renderer/composite-renderer.d.ts +9 -1
- package/dist/types/modules/debug-renderer/debug-renderer.d.ts +1 -0
- package/dist/types/modules/overlay-renderer/overlay-renderer.d.ts +21 -13
- package/dist/types/modules/react-reconciler/Atlas.d.ts +17 -7
- package/dist/types/modules/react-reconciler/components/AtlasAuto.d.ts +4 -8
- package/dist/types/modules/react-reconciler/components/AtlasContext.d.ts +4 -26
- package/dist/types/modules/react-reconciler/components/AtlasWithReconciler.d.ts +13 -0
- package/dist/types/modules/react-reconciler/components/RegionHighlight.d.ts +2 -2
- package/dist/types/modules/react-reconciler/hooks/use-atlas-image.d.ts +2 -2
- package/dist/types/modules/react-reconciler/hooks/use-atlas.d.ts +1 -1
- package/dist/types/modules/react-reconciler/hooks/use-canvas-position.d.ts +1 -0
- package/dist/types/modules/react-reconciler/hooks/use-classname.d.ts +1 -0
- package/dist/types/modules/react-reconciler/hooks/use-controlled-annotation-list.d.ts +0 -1
- package/dist/types/modules/react-reconciler/hooks/use-preset.d.ts +17 -0
- package/dist/types/modules/react-reconciler/hooks/use-resize-world-item.d.ts +0 -1
- package/dist/types/modules/react-reconciler/presets/_types.d.ts +23 -0
- package/dist/types/modules/react-reconciler/presets/default-preset.d.ts +10 -0
- package/dist/types/modules/react-reconciler/presets/index.d.ts +8 -0
- package/dist/types/modules/react-reconciler/presets/static-preset.d.ts +7 -0
- package/dist/types/modules/react-reconciler/reconciler.d.ts +4 -0
- package/dist/types/modules/react-reconciler/types.d.ts +11 -173
- package/dist/types/modules/static-renderer/static-renderer.d.ts +16 -1
- package/dist/types/modules/transition-manager/transition-manager.d.ts +63 -0
- package/dist/types/modules/webgl-renderer/webgl-renderer.d.ts +7 -1
- package/dist/types/objects/base-object.d.ts +2 -1
- package/dist/types/objects/box.d.ts +49 -1
- package/dist/types/objects/text.d.ts +8 -0
- package/dist/types/renderer/renderer.d.ts +11 -2
- package/dist/types/renderer/runtime.d.ts +44 -10
- package/dist/types/spacial-content/composite-resource.d.ts +13 -1
- package/dist/types/spacial-content/index.d.ts +1 -0
- package/dist/types/spacial-content/single-image.d.ts +6 -0
- package/dist/types/spacial-content/spacial-content.d.ts +4 -0
- package/dist/types/spacial-content/tiled-image.d.ts +6 -1
- package/dist/types/types.d.ts +17 -16
- package/dist/types/utility/are-inputs-equal.d.ts +1 -0
- package/dist/types/utility/easing-functions.d.ts +6 -0
- package/dist/types/utility/go-to-clamped.d.ts +1 -0
- package/dist/types/utility/hash.d.ts +1 -0
- package/dist/types/utility/merge-styles.d.ts +2 -0
- package/dist/types/utility/stylesheet.d.ts +17 -0
- package/dist/types/utility/to-box.d.ts +2 -0
- package/dist/types/utils.d.ts +1 -1
- package/dist/types/world-objects/world-object.d.ts +1 -1
- package/dist/types/world.d.ts +2 -1
- package/package.json +19 -27
- package/dist/types/modules/vanilla-controller/vanilla-controller.d.ts +0 -4
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SupportedEventNames, SupportedEvents } from '../events';
|
|
2
|
+
import { ContainerDefinition, GenericObject, GenericObjectProps } from './traits/generic-object';
|
|
3
|
+
import { Evented, EventListenerProps, EventedHelpers } from './traits/evented';
|
|
4
|
+
import { Revision } from './traits/revision';
|
|
5
|
+
import { Paint, PaintableObject } from './traits/paintable';
|
|
6
|
+
import { Strand } from '@atlas-viewer/dna';
|
|
7
|
+
export interface BaseObjectProps extends GenericObjectProps, EventListenerProps {
|
|
8
|
+
}
|
|
9
|
+
export declare abstract class BaseObject implements GenericObject, Evented, EventedHelpers, Revision, PaintableObject {
|
|
10
|
+
readonly id: GenericObject['id'];
|
|
11
|
+
abstract readonly type: GenericObject['type'];
|
|
12
|
+
readonly display: GenericObject['display'];
|
|
13
|
+
readonly points: GenericObject['points'];
|
|
14
|
+
readonly node: GenericObject['node'];
|
|
15
|
+
readonly buffers: GenericObject['buffers'];
|
|
16
|
+
revision: Revision['revision'];
|
|
17
|
+
events: Evented['events'];
|
|
18
|
+
protected constructor(options: {
|
|
19
|
+
type: 'container' | 'node';
|
|
20
|
+
});
|
|
21
|
+
getObjectsAt(target: Strand, zone?: PaintableObject<ContainerDefinition<PaintableObject>>): PaintableObject[];
|
|
22
|
+
getAllPointsAt(target: Strand, scale: number, aggregate?: Strand): Paint[];
|
|
23
|
+
addEventListener<Name extends SupportedEventNames>(name: Name, cb: (e: any) => void, options?: {
|
|
24
|
+
capture: boolean;
|
|
25
|
+
passive: boolean;
|
|
26
|
+
}): void;
|
|
27
|
+
removeEventListener<Name extends SupportedEventNames>(name: Name, cb: (e: any) => void): void;
|
|
28
|
+
dispatchEvent<Name extends keyof SupportedEvents>(name: Name, e: any): boolean;
|
|
29
|
+
captureEvent<Name extends keyof SupportedEvents>(name: Name, e: any): boolean;
|
|
30
|
+
applyProps(props: BaseObjectProps): boolean;
|
|
31
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { GenericObjectProps, NodeDefinition } from './traits/generic-object';
|
|
2
|
+
import { HasStyles, HasStylesProps } from './traits/has-styles';
|
|
3
|
+
import { BaseObject } from './base.object';
|
|
4
|
+
export interface BoxProps extends GenericObjectProps, HasStylesProps {
|
|
5
|
+
readonly type: 'box';
|
|
6
|
+
interactive?: boolean;
|
|
7
|
+
html?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class Box extends BaseObject implements HasStyles {
|
|
10
|
+
node: NodeDefinition;
|
|
11
|
+
readonly type = "box";
|
|
12
|
+
style: HasStyles['style'];
|
|
13
|
+
interactive: boolean;
|
|
14
|
+
isHTML: boolean;
|
|
15
|
+
constructor();
|
|
16
|
+
applyProps(props: BoxProps): boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseObject, BaseObjectProps } from './base.object';
|
|
2
|
+
import { HasStyles, HasStylesProps } from './traits/has-styles';
|
|
3
|
+
import { ContainerDefinition } from './traits/generic-object';
|
|
4
|
+
export interface ContainerObjectProps extends HasStylesProps, BaseObjectProps {
|
|
5
|
+
}
|
|
6
|
+
export declare class ContainerObject extends BaseObject implements HasStyles {
|
|
7
|
+
node: ContainerDefinition<any>;
|
|
8
|
+
readonly type = "container";
|
|
9
|
+
readonly style: HasStyles['style'];
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { GenericObjectProps, NodeDefinition } from './traits/generic-object';
|
|
2
|
+
import { HasStyles } from './traits/has-styles';
|
|
3
|
+
import { BaseObject } from './base.object';
|
|
4
|
+
declare type ImageStyles = {
|
|
5
|
+
opacity?: number;
|
|
6
|
+
};
|
|
7
|
+
export interface ImageObjectProps extends GenericObjectProps {
|
|
8
|
+
src: string;
|
|
9
|
+
priority?: boolean;
|
|
10
|
+
style?: ImageStyles;
|
|
11
|
+
}
|
|
12
|
+
export declare class ImageObject extends BaseObject implements HasStyles<ImageStyles> {
|
|
13
|
+
node: NodeDefinition;
|
|
14
|
+
readonly type = "image";
|
|
15
|
+
src?: string;
|
|
16
|
+
style: HasStyles<ImageStyles>['style'];
|
|
17
|
+
constructor();
|
|
18
|
+
applyProps(props: ImageObjectProps): boolean;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ContainerDefinition, GenericObject } from './generic-object';
|
|
2
|
+
export declare function append(object: GenericObject<ContainerDefinition>, toAppend: GenericObject): void;
|
|
3
|
+
export declare function insertBefore(object: GenericObject<ContainerDefinition>, item: GenericObject, before: GenericObject): void;
|
|
4
|
+
export declare function hideInstance(object: GenericObject): void;
|
|
5
|
+
export declare function remove(object: GenericObject<ContainerDefinition>, item: GenericObject): void;
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { AllEvents } from '../../modules/react-reconciler';
|
|
2
|
+
import { GenericObject } from './generic-object';
|
|
3
|
+
import { PaintableObject } from './paintable';
|
|
4
|
+
import { SupportedEvents } from '../../events';
|
|
5
|
+
export declare type SupportedEventNames = 'mousedown' | 'mouseenter' | 'mouseleave' | 'mousemove' | 'mouseout' | 'mouseover' | 'mouseup' | 'touchcancel' | 'touchend' | 'touchmove' | 'touchstart' | 'pointerdown' | 'pointermove' | 'pointerup' | 'pointercancel' | 'pointerenter' | 'pointerleave' | 'pointerover' | 'pointerout' | 'dragstart' | 'dragend' | 'dragenter' | 'dragexit' | 'drag' | 'dragover' | 'scroll' | 'wheel' | 'click';
|
|
6
|
+
export declare type SupportedEventFunctionNames = 'onMouseDown' | 'onMouseEnter' | 'onMouseLeave' | 'onMouseMove' | 'onMouseOut' | 'onMouseOver' | 'onMouseUp' | 'onTouchCancel' | 'onTouchEnd' | 'onTouchMove' | 'onTouchStart' | 'onPointerDown' | 'onPointerMove' | 'onPointerUp' | 'onPointerCancel' | 'onPointerEnter' | 'onPointerLeave' | 'onPointerOver' | 'onPointerOut' | 'onDragStart' | 'onDragEnd' | 'onDragEnter' | 'onDragExit' | 'onDrag' | 'onDragOver' | 'onScroll' | 'onWheel' | 'onClick';
|
|
7
|
+
export declare type SupportedEventTypeMapping = {
|
|
8
|
+
mousedown: 'onMouseDown';
|
|
9
|
+
mouseenter: 'onMouseEnter';
|
|
10
|
+
mouseleave: 'onMouseLeave';
|
|
11
|
+
mousemove: 'onMouseMove';
|
|
12
|
+
mouseout: 'onMouseOut';
|
|
13
|
+
mouseover: 'onMouseOver';
|
|
14
|
+
mouseup: 'onMouseUp';
|
|
15
|
+
touchcancel: 'onTouchCancel';
|
|
16
|
+
touchend: 'onTouchEnd';
|
|
17
|
+
touchmove: 'onTouchMove';
|
|
18
|
+
touchstart: 'onTouchStart';
|
|
19
|
+
pointerdown: 'onPointerDown';
|
|
20
|
+
pointermove: 'onPointerMove';
|
|
21
|
+
pointerup: 'onPointerUp';
|
|
22
|
+
pointercancel: 'onPointerCancel';
|
|
23
|
+
pointerenter: 'onPointerEnter';
|
|
24
|
+
pointerleave: 'onPointerLeave';
|
|
25
|
+
pointerover: 'onPointerOver';
|
|
26
|
+
pointerout: 'onPointerOut';
|
|
27
|
+
dragstart: 'onDragStart';
|
|
28
|
+
dragend: 'onDragEnd';
|
|
29
|
+
dragenter: 'onDragEnter';
|
|
30
|
+
dragexit: 'onDragExit';
|
|
31
|
+
drag: 'onDrag';
|
|
32
|
+
dragover: 'onDragOver';
|
|
33
|
+
scroll: 'onScroll';
|
|
34
|
+
wheel: 'onWheel';
|
|
35
|
+
click: 'onClick';
|
|
36
|
+
};
|
|
37
|
+
export declare type SupportedEventFunctions = {
|
|
38
|
+
onMouseDown(e: MouseEvent & {
|
|
39
|
+
atlas: {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
};
|
|
43
|
+
}): void;
|
|
44
|
+
onMouseEnter(e: MouseEvent & {
|
|
45
|
+
atlas: {
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
};
|
|
49
|
+
}): void;
|
|
50
|
+
onMouseLeave(e: MouseEvent & {
|
|
51
|
+
atlas: {
|
|
52
|
+
x: number;
|
|
53
|
+
y: number;
|
|
54
|
+
};
|
|
55
|
+
}): void;
|
|
56
|
+
onMouseMove(e: MouseEvent & {
|
|
57
|
+
atlas: {
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
};
|
|
61
|
+
}): void;
|
|
62
|
+
onMouseOut(e: MouseEvent & {
|
|
63
|
+
atlas: {
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
};
|
|
67
|
+
}): void;
|
|
68
|
+
onMouseOver(e: MouseEvent & {
|
|
69
|
+
atlas: {
|
|
70
|
+
x: number;
|
|
71
|
+
y: number;
|
|
72
|
+
};
|
|
73
|
+
}): void;
|
|
74
|
+
onMouseUp(e: MouseEvent & {
|
|
75
|
+
atlas: {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
};
|
|
79
|
+
}): void;
|
|
80
|
+
onTouchCancel(e: TouchEvent & {
|
|
81
|
+
atlas: {
|
|
82
|
+
x: number;
|
|
83
|
+
y: number;
|
|
84
|
+
};
|
|
85
|
+
}): void;
|
|
86
|
+
onTouchEnd(e: TouchEvent & {
|
|
87
|
+
atlas: {
|
|
88
|
+
x: number;
|
|
89
|
+
y: number;
|
|
90
|
+
};
|
|
91
|
+
}): void;
|
|
92
|
+
onTouchMove(e: TouchEvent & {
|
|
93
|
+
atlas: {
|
|
94
|
+
x: number;
|
|
95
|
+
y: number;
|
|
96
|
+
};
|
|
97
|
+
}): void;
|
|
98
|
+
onTouchStart(e: TouchEvent & {
|
|
99
|
+
atlas: {
|
|
100
|
+
x: number;
|
|
101
|
+
y: number;
|
|
102
|
+
};
|
|
103
|
+
}): void;
|
|
104
|
+
onPointerDown(e: PointerEvent & {
|
|
105
|
+
atlas: {
|
|
106
|
+
x: number;
|
|
107
|
+
y: number;
|
|
108
|
+
};
|
|
109
|
+
}): void;
|
|
110
|
+
onPointerMove(e: PointerEvent & {
|
|
111
|
+
atlas: {
|
|
112
|
+
x: number;
|
|
113
|
+
y: number;
|
|
114
|
+
};
|
|
115
|
+
}): void;
|
|
116
|
+
onPointerUp(e: PointerEvent & {
|
|
117
|
+
atlas: {
|
|
118
|
+
x: number;
|
|
119
|
+
y: number;
|
|
120
|
+
};
|
|
121
|
+
}): void;
|
|
122
|
+
onPointerCancel(e: PointerEvent & {
|
|
123
|
+
atlas: {
|
|
124
|
+
x: number;
|
|
125
|
+
y: number;
|
|
126
|
+
};
|
|
127
|
+
}): void;
|
|
128
|
+
onPointerEnter(e: PointerEvent & {
|
|
129
|
+
atlas: {
|
|
130
|
+
x: number;
|
|
131
|
+
y: number;
|
|
132
|
+
};
|
|
133
|
+
}): void;
|
|
134
|
+
onPointerLeave(e: PointerEvent & {
|
|
135
|
+
atlas: {
|
|
136
|
+
x: number;
|
|
137
|
+
y: number;
|
|
138
|
+
};
|
|
139
|
+
}): void;
|
|
140
|
+
onPointerOver(e: PointerEvent & {
|
|
141
|
+
atlas: {
|
|
142
|
+
x: number;
|
|
143
|
+
y: number;
|
|
144
|
+
};
|
|
145
|
+
}): void;
|
|
146
|
+
onPointerOut(e: PointerEvent & {
|
|
147
|
+
atlas: {
|
|
148
|
+
x: number;
|
|
149
|
+
y: number;
|
|
150
|
+
};
|
|
151
|
+
}): void;
|
|
152
|
+
onDragStart(e: DragEvent & {
|
|
153
|
+
atlas: {
|
|
154
|
+
x: number;
|
|
155
|
+
y: number;
|
|
156
|
+
};
|
|
157
|
+
}): void;
|
|
158
|
+
onDragEnd(e: DragEvent & {
|
|
159
|
+
atlas: {
|
|
160
|
+
x: number;
|
|
161
|
+
y: number;
|
|
162
|
+
};
|
|
163
|
+
}): void;
|
|
164
|
+
onDragEnter(e: DragEvent & {
|
|
165
|
+
atlas: {
|
|
166
|
+
x: number;
|
|
167
|
+
y: number;
|
|
168
|
+
};
|
|
169
|
+
}): void;
|
|
170
|
+
onDragExit(e: DragEvent & {
|
|
171
|
+
atlas: {
|
|
172
|
+
x: number;
|
|
173
|
+
y: number;
|
|
174
|
+
};
|
|
175
|
+
}): void;
|
|
176
|
+
onDrag(e: DragEvent & {
|
|
177
|
+
atlas: {
|
|
178
|
+
x: number;
|
|
179
|
+
y: number;
|
|
180
|
+
};
|
|
181
|
+
}): void;
|
|
182
|
+
onDragOver(e: DragEvent & {
|
|
183
|
+
atlas: {
|
|
184
|
+
x: number;
|
|
185
|
+
y: number;
|
|
186
|
+
};
|
|
187
|
+
}): void;
|
|
188
|
+
onScroll(e: UIEvent & {
|
|
189
|
+
atlas: {
|
|
190
|
+
x: number;
|
|
191
|
+
y: number;
|
|
192
|
+
};
|
|
193
|
+
}): void;
|
|
194
|
+
onWheel(e: WheelEvent & {
|
|
195
|
+
atlas: {
|
|
196
|
+
x: number;
|
|
197
|
+
y: number;
|
|
198
|
+
};
|
|
199
|
+
}): void;
|
|
200
|
+
onClick(e: MouseEvent & {
|
|
201
|
+
atlas: {
|
|
202
|
+
x: number;
|
|
203
|
+
y: number;
|
|
204
|
+
};
|
|
205
|
+
}): void;
|
|
206
|
+
};
|
|
207
|
+
export declare type EventMap = {
|
|
208
|
+
[Name in SupportedEventFunctionNames]: Array<{
|
|
209
|
+
listener: SupportedEventFunctions[Name];
|
|
210
|
+
options?: {
|
|
211
|
+
capture?: boolean;
|
|
212
|
+
};
|
|
213
|
+
}>;
|
|
214
|
+
};
|
|
215
|
+
export declare const supportedEventAttributes: Array<SupportedEventFunctionNames>;
|
|
216
|
+
export interface Evented {
|
|
217
|
+
events: {
|
|
218
|
+
props: AllEvents;
|
|
219
|
+
handlers: EventMap;
|
|
220
|
+
targets: GenericObject[];
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
export interface EventedHelpers {
|
|
224
|
+
addEventListener<Name extends SupportedEventNames>(name: Name, cb: (e: any) => void, options?: {
|
|
225
|
+
capture: boolean;
|
|
226
|
+
passive: boolean;
|
|
227
|
+
}): void;
|
|
228
|
+
removeEventListener<Name extends SupportedEventNames>(name: Name, cb: (e: any) => void): void;
|
|
229
|
+
dispatchEvent<Name extends SupportedEventFunctionNames>(name: Name, e: any): void;
|
|
230
|
+
}
|
|
231
|
+
export declare type EventListenerProps = Partial<SupportedEventFunctions>;
|
|
232
|
+
export declare const supportedEventMap: {
|
|
233
|
+
mousedown: "onMouseDown";
|
|
234
|
+
mouseenter: "onMouseEnter";
|
|
235
|
+
mouseleave: "onMouseLeave";
|
|
236
|
+
mousemove: "onMouseMove";
|
|
237
|
+
mouseout: "onMouseOut";
|
|
238
|
+
mouseover: "onMouseOver";
|
|
239
|
+
mouseup: "onMouseUp";
|
|
240
|
+
touchcancel: "onTouchCancel";
|
|
241
|
+
touchend: "onTouchEnd";
|
|
242
|
+
touchmove: "onTouchMove";
|
|
243
|
+
touchstart: "onTouchStart";
|
|
244
|
+
pointerdown: "onPointerDown";
|
|
245
|
+
pointermove: "onPointerMove";
|
|
246
|
+
pointerup: "onPointerUp";
|
|
247
|
+
pointercancel: "onPointerCancel";
|
|
248
|
+
pointerenter: "onPointerEnter";
|
|
249
|
+
pointerleave: "onPointerLeave";
|
|
250
|
+
pointerover: "onPointerOver";
|
|
251
|
+
pointerout: "onPointerOut";
|
|
252
|
+
scroll: "onScroll";
|
|
253
|
+
wheel: "onWheel";
|
|
254
|
+
click: "onClick";
|
|
255
|
+
dragstart: "onDragStart";
|
|
256
|
+
dragend: "onDragEnd";
|
|
257
|
+
dragenter: "onDragEnter";
|
|
258
|
+
dragexit: "onDragExit";
|
|
259
|
+
drag: "onDrag";
|
|
260
|
+
dragover: "onDragOver";
|
|
261
|
+
} & {
|
|
262
|
+
onMouseDown: "onMouseDown";
|
|
263
|
+
onMouseEnter: "onMouseEnter";
|
|
264
|
+
onMouseLeave: "onMouseLeave";
|
|
265
|
+
onMouseMove: "onMouseMove";
|
|
266
|
+
onMouseOut: "onMouseOut";
|
|
267
|
+
onMouseOver: "onMouseOver";
|
|
268
|
+
onMouseUp: "onMouseUp";
|
|
269
|
+
onTouchCancel: "onTouchCancel";
|
|
270
|
+
onTouchEnd: "onTouchEnd";
|
|
271
|
+
onTouchMove: "onTouchMove";
|
|
272
|
+
onTouchStart: "onTouchStart";
|
|
273
|
+
onPointerDown: "onPointerDown";
|
|
274
|
+
onPointerMove: "onPointerMove";
|
|
275
|
+
onPointerUp: "onPointerUp";
|
|
276
|
+
onPointerCancel: "onPointerCancel";
|
|
277
|
+
onPointerEnter: "onPointerEnter";
|
|
278
|
+
onPointerLeave: "onPointerLeave";
|
|
279
|
+
onPointerOver: "onPointerOver";
|
|
280
|
+
onPointerOut: "onPointerOut";
|
|
281
|
+
onScroll: "onScroll";
|
|
282
|
+
onWheel: "onWheel";
|
|
283
|
+
onClick: "onClick";
|
|
284
|
+
onDragStart: "onDragStart";
|
|
285
|
+
onDragEnd: "onDragEnd";
|
|
286
|
+
onDragEnter: "onDragEnter";
|
|
287
|
+
onDragExit: "onDragExit";
|
|
288
|
+
onDrag: "onDrag";
|
|
289
|
+
onDragOver: "onDragOver";
|
|
290
|
+
};
|
|
291
|
+
export declare function createDefaultEventMap(): EventMap;
|
|
292
|
+
export declare function addEventListener<Name extends SupportedEventNames>(object: Evented, name: Name, cb: (e: any) => void, options?: {
|
|
293
|
+
capture?: boolean;
|
|
294
|
+
passive?: boolean;
|
|
295
|
+
}): void;
|
|
296
|
+
export declare function removeEventListener<Name extends SupportedEventNames>(object: Evented, name: Name, cb: (e: any) => void): void;
|
|
297
|
+
export declare function isEvented(t: unknown): t is Evented;
|
|
298
|
+
export declare function dispatchEvent<Name extends SupportedEventFunctionNames | SupportedEventNames>(obj: unknown, name: Name, e: any, toCapture?: boolean): boolean;
|
|
299
|
+
export declare function eventsDefaults(): Evented;
|
|
300
|
+
export declare function applyEventProps(instance: Evented, props: EventListenerProps): boolean;
|
|
301
|
+
export declare function propagatePointerEvent<Name extends keyof SupportedEvents>(object: PaintableObject, eventName: Name, e: any, x: number, y: number, opts?: {
|
|
302
|
+
bubbles?: boolean;
|
|
303
|
+
cancelable?: boolean;
|
|
304
|
+
}): GenericObject<import("./generic-object").NodeDefinition | import("./generic-object").ContainerDefinition<any>>[];
|
|
305
|
+
export declare function propagateTouchEvent(object: PaintableObject, eventName: string, e: TouchEvent, touchTargets: Array<{
|
|
306
|
+
x: number;
|
|
307
|
+
y: number;
|
|
308
|
+
}>): void;
|
|
309
|
+
export declare function propagateEvent(object: GenericObject & Evented, eventName: string, e: any, filteredObjects: PaintableObject[][], { bubbles, cancelable }?: {
|
|
310
|
+
bubbles?: boolean;
|
|
311
|
+
cancelable?: boolean;
|
|
312
|
+
}): GenericObject<import("./generic-object").NodeDefinition | import("./generic-object").ContainerDefinition<any>>[];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { DisplayData } from '../../types';
|
|
2
|
+
import { Strand } from '@atlas-viewer/dna';
|
|
3
|
+
export interface GenericObject<Node extends NodeDefinition | ContainerDefinition<any> = NodeDefinition | ContainerDefinition<any>> {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly type: string;
|
|
6
|
+
readonly display: DisplayData;
|
|
7
|
+
points: Strand;
|
|
8
|
+
readonly node: Node;
|
|
9
|
+
readonly buffers: {
|
|
10
|
+
filteredPoints: Strand;
|
|
11
|
+
readonly intersectionPoints: Strand;
|
|
12
|
+
readonly aggregateTransform: Strand;
|
|
13
|
+
readonly invertedTransform: Strand;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare type NodeDefinition = {
|
|
17
|
+
readonly type: 'node';
|
|
18
|
+
cropped: boolean;
|
|
19
|
+
crop: Strand;
|
|
20
|
+
hidden: boolean;
|
|
21
|
+
parent?: ContainerDefinition;
|
|
22
|
+
};
|
|
23
|
+
export declare type ContainerDefinition<Contains extends GenericObject = GenericObject> = {
|
|
24
|
+
readonly type: 'container';
|
|
25
|
+
list: Array<Contains | null>;
|
|
26
|
+
listPoints: Strand;
|
|
27
|
+
lazy: boolean;
|
|
28
|
+
zone: boolean;
|
|
29
|
+
hidden: boolean;
|
|
30
|
+
cropped: boolean;
|
|
31
|
+
crop: Strand;
|
|
32
|
+
ordered: boolean;
|
|
33
|
+
order: number[];
|
|
34
|
+
parent?: ContainerDefinition;
|
|
35
|
+
};
|
|
36
|
+
export interface GenericObjectProps {
|
|
37
|
+
id?: string;
|
|
38
|
+
target?: {
|
|
39
|
+
x?: number;
|
|
40
|
+
y?: number;
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
};
|
|
44
|
+
display?: {
|
|
45
|
+
width: number;
|
|
46
|
+
height?: number;
|
|
47
|
+
};
|
|
48
|
+
crop?: {
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export declare function isGeneric(t: unknown): t is GenericObject;
|
|
56
|
+
export declare function genericObjectDefaults(type: 'node'): GenericObject<NodeDefinition>;
|
|
57
|
+
export declare function genericObjectDefaults(type: 'container'): GenericObject<ContainerDefinition>;
|
|
58
|
+
export declare function genericObjectDefaults(type: 'container' | 'node'): GenericObject<NodeDefinition | ContainerDefinition>;
|
|
59
|
+
export declare function applyGenericObjectProps(toObject: GenericObject, props: GenericObjectProps): boolean;
|
|
60
|
+
export declare function objectForEach<Contains extends GenericObject<any> = GenericObject<any>>(object: GenericObject, cb: (obj: Contains, index: number) => void): void;
|
|
61
|
+
export declare function getTopParent(object: GenericObject): GenericObject;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Evented } from './evented';
|
|
2
|
+
import { Revision } from './revision';
|
|
3
|
+
export interface HasStylesProps<T extends BoxStyle = BoxStyle> {
|
|
4
|
+
className?: string;
|
|
5
|
+
relativeStyle?: boolean;
|
|
6
|
+
style?: T;
|
|
7
|
+
}
|
|
8
|
+
export interface HasStyles<S extends _BoxStyle = _BoxStyle> {
|
|
9
|
+
style: {
|
|
10
|
+
className: string | null;
|
|
11
|
+
rules: S | null;
|
|
12
|
+
hoverRules: S | null;
|
|
13
|
+
activeRules: S | null;
|
|
14
|
+
parsed: {
|
|
15
|
+
border: {
|
|
16
|
+
id: string | null;
|
|
17
|
+
match: string[];
|
|
18
|
+
};
|
|
19
|
+
outline: {
|
|
20
|
+
id: string | null;
|
|
21
|
+
match: string[];
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
relative: boolean;
|
|
25
|
+
activeEvents: boolean;
|
|
26
|
+
hoverEvents: boolean;
|
|
27
|
+
isHovering: boolean;
|
|
28
|
+
isActive?: boolean;
|
|
29
|
+
handlers: {
|
|
30
|
+
addHover?: () => void;
|
|
31
|
+
removeHover?: () => void;
|
|
32
|
+
addActive?: () => void;
|
|
33
|
+
removeActive?: () => void;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export declare type BoxStyle<T extends _BoxStyle = _BoxStyle> = T & {
|
|
38
|
+
':hover'?: T;
|
|
39
|
+
':active'?: T;
|
|
40
|
+
};
|
|
41
|
+
declare type _BoxStyle = Partial<{
|
|
42
|
+
backgroundColor: string;
|
|
43
|
+
opacity: number;
|
|
44
|
+
boxShadow: string;
|
|
45
|
+
borderColor: string;
|
|
46
|
+
borderWidth: string;
|
|
47
|
+
borderStyle: string;
|
|
48
|
+
outlineColor: string;
|
|
49
|
+
outlineWidth: string;
|
|
50
|
+
outlineOffset: string;
|
|
51
|
+
outlineStyle: string;
|
|
52
|
+
border: string;
|
|
53
|
+
outline: string;
|
|
54
|
+
background: string;
|
|
55
|
+
}>;
|
|
56
|
+
export declare function hasStyles(obj: unknown): obj is HasStyles;
|
|
57
|
+
export declare function hasStylesDefaults(): HasStyles;
|
|
58
|
+
export declare function stylesDidUpdate(a: _BoxStyle | null, b: _BoxStyle | null): boolean;
|
|
59
|
+
export declare function applyHasStylesProps(object: HasStyles & Evented & Revision, props: HasStylesProps): boolean;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { GenericObject } from './generic-object';
|
|
2
|
+
export interface Hosts {
|
|
3
|
+
hosts: {
|
|
4
|
+
html?: HTMLContainerHost;
|
|
5
|
+
image?: DOMImageHost;
|
|
6
|
+
images?: DOMImageListHost;
|
|
7
|
+
canvas?: CanvasHost;
|
|
8
|
+
webgl?: WebGLImageHost;
|
|
9
|
+
};
|
|
10
|
+
readonly hostCreators?: {
|
|
11
|
+
readonly html?: (obj: GenericObject) => HTMLContainerHost;
|
|
12
|
+
readonly image?: (obj: GenericObject) => DOMImageHost;
|
|
13
|
+
readonly images?: (obj: GenericObject) => DOMImageListHost;
|
|
14
|
+
readonly canvas?: (obj: GenericObject) => CanvasHost;
|
|
15
|
+
readonly webgl?: (obj: GenericObject) => WebGLImageHost;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface HTMLContainerHost {
|
|
19
|
+
element: HTMLElement;
|
|
20
|
+
revision: number;
|
|
21
|
+
relative: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface DOMImageHost {
|
|
24
|
+
element: HTMLImageElement;
|
|
25
|
+
}
|
|
26
|
+
export interface DOMImageListHost {
|
|
27
|
+
elements: Array<{
|
|
28
|
+
image: HTMLImageElement;
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
31
|
+
export interface CanvasHost {
|
|
32
|
+
canvas: HTMLCanvasElement;
|
|
33
|
+
indices: number[];
|
|
34
|
+
loaded: number[];
|
|
35
|
+
loading: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface WebGLImageHost {
|
|
38
|
+
height: number;
|
|
39
|
+
width: number;
|
|
40
|
+
textures: WebGLTexture[];
|
|
41
|
+
loading: number[];
|
|
42
|
+
loaded: number[];
|
|
43
|
+
lastLevelRendered: number;
|
|
44
|
+
onLoad: (index: number, image: TexImageSource) => void;
|
|
45
|
+
lastImage?: string;
|
|
46
|
+
error?: Error;
|
|
47
|
+
}
|
|
48
|
+
export declare type CreateHosts<Obj extends GenericObject> = {
|
|
49
|
+
[Host in keyof Hosts['hosts']]?: (object: Obj) => Required<Hosts['hosts'][Host]>;
|
|
50
|
+
};
|
|
51
|
+
export declare type SupportedHost<Host extends keyof Hosts['hosts']> = {
|
|
52
|
+
hostCreators: {
|
|
53
|
+
[key in Host]-?: Hosts['hosts'];
|
|
54
|
+
};
|
|
55
|
+
hosts: {
|
|
56
|
+
[key in Host]-?: Hosts['hosts'];
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export declare function supportsHost<Host extends keyof Hosts['hosts']>(object: unknown, host: Host): object is SupportedHost<Host>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export interface Layout {
|
|
2
|
+
layout: {
|
|
3
|
+
triggerQueue: LayoutEvent[];
|
|
4
|
+
flushed: string[];
|
|
5
|
+
subscriptions: Array<(type: string, changes?: unknown) => void>;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export interface LayoutEvent {
|
|
9
|
+
type: string;
|
|
10
|
+
data?: any;
|
|
11
|
+
}
|
|
12
|
+
export interface RepaintLayoutEvent extends LayoutEvent {
|
|
13
|
+
type: 'repaint';
|
|
14
|
+
data?: never;
|
|
15
|
+
}
|
|
16
|
+
export interface EventActivationLayoutEvent extends LayoutEvent {
|
|
17
|
+
type: 'event-activation';
|
|
18
|
+
data?: never;
|
|
19
|
+
}
|
|
20
|
+
export interface GoToRegionLayoutEvent extends LayoutEvent {
|
|
21
|
+
type: 'goto-region';
|
|
22
|
+
data: {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
height: number;
|
|
26
|
+
width: number;
|
|
27
|
+
padding?: number;
|
|
28
|
+
nudge?: boolean;
|
|
29
|
+
immediate?: boolean;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface GoHomeLayoutEvent extends LayoutEvent {
|
|
33
|
+
type: 'go-home';
|
|
34
|
+
data: {
|
|
35
|
+
immediate?: boolean;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export interface ConstrainBoundsLayoutEvent extends LayoutEvent {
|
|
39
|
+
type: 'constrain-bounds';
|
|
40
|
+
data: {
|
|
41
|
+
immediate?: boolean;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export interface ZoomToLayoutEvent extends LayoutEvent {
|
|
45
|
+
type: 'zoom-to';
|
|
46
|
+
data: {
|
|
47
|
+
factor: number;
|
|
48
|
+
point?: {
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
};
|
|
52
|
+
stream?: boolean;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
declare type AllLayoutEvents = RepaintLayoutEvent | EventActivationLayoutEvent | GoToRegionLayoutEvent | GoHomeLayoutEvent | ConstrainBoundsLayoutEvent | ZoomToLayoutEvent;
|
|
56
|
+
export declare function revisionDefaults(): Layout;
|
|
57
|
+
export declare function hasLayouts(obj: unknown): obj is Layout;
|
|
58
|
+
export declare function addLayoutSubscription<T extends LayoutEvent = AllLayoutEvents>(input: unknown, subscription: (type: T['type'], data: T['data']) => void): () => void;
|
|
59
|
+
export declare function triggerLayout(object: unknown, event: AllLayoutEvents): void;
|
|
60
|
+
export declare function flushLayoutSubscriptions(input: Layout): void;
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Strand } from '@atlas-viewer/dna';
|
|
2
|
+
import { ContainerDefinition, GenericObject, NodeDefinition } from './generic-object';
|
|
3
|
+
import { Evented } from './evented';
|
|
4
|
+
export interface PaintableObject<Node extends NodeDefinition | ContainerDefinition<PaintableObject> = NodeDefinition | ContainerDefinition<any>> extends GenericObject<Node>, Evented {
|
|
5
|
+
}
|
|
6
|
+
export declare function isPaintable(obj: unknown): obj is PaintableObject;
|
|
7
|
+
export declare function getObjectsAt(object: PaintableObject, target: Strand, options?: {
|
|
8
|
+
loadLazy?: boolean;
|
|
9
|
+
zone?: PaintableObject<ContainerDefinition<any>>;
|
|
10
|
+
}): PaintableObject[];
|
|
11
|
+
export declare type Paint = [PaintableObject, Strand, Strand | undefined];
|
|
12
|
+
export declare function getAllPointsAt(object: PaintableObject<any>, target: Strand, scaleFactor: number, options?: {
|
|
13
|
+
loadLazy?: boolean;
|
|
14
|
+
zone?: PaintableObject<ContainerDefinition<PaintableObject>>;
|
|
15
|
+
aggregate?: Strand;
|
|
16
|
+
}): Paint[];
|