@smarterplan/ngx-smarterplan-core 1.2.39 → 1.2.45

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.
Files changed (170) hide show
  1. package/README.md +24 -24
  2. package/esm2020/lib/components/csv-export/csv-export.component.mjs +59 -59
  3. package/esm2020/lib/components/loader/loader.component.mjs +23 -23
  4. package/esm2020/lib/components/menu-bar/avatar/avatar.component.mjs +80 -80
  5. package/esm2020/lib/components/menu-bar/menu-bar.component.mjs +99 -99
  6. package/esm2020/lib/components/menu-bar/navigation-bar/navigation-bar.component.mjs +384 -384
  7. package/esm2020/lib/components/menu-bar/range-date-picker/range-date-picker.component.mjs +147 -147
  8. package/esm2020/lib/components/modal-switch-visit/modal-switch-visit.component.mjs +40 -40
  9. package/esm2020/lib/components/search-bar/search-bar.component.mjs +63 -63
  10. package/esm2020/lib/components/support-modal/support-modal.component.mjs +66 -66
  11. package/esm2020/lib/config.mjs +4 -4
  12. package/esm2020/lib/helpers.service.mjs +470 -470
  13. package/esm2020/lib/matterport-extensions/hsl-loader/HlsLoader.mjs +69 -69
  14. package/esm2020/lib/matterport-extensions/nest-thermostat/CanvasImage.mjs +51 -51
  15. package/esm2020/lib/matterport-extensions/nest-thermostat/CanvasRenderer.mjs +61 -61
  16. package/esm2020/lib/matterport-extensions/nest-thermostat/NestThermostat.mjs +158 -158
  17. package/esm2020/lib/matterport-extensions/nest-thermostat/PlaneRenderer.mjs +85 -85
  18. package/esm2020/lib/matterport-extensions/scene-component/SceneComponent.mjs +128 -128
  19. package/esm2020/lib/matterport-extensions/security-camera/SecurityCamera.mjs +249 -249
  20. package/esm2020/lib/matterport-extensions/tv-player/TvPlayer.mjs +98 -98
  21. package/esm2020/lib/matterport-extensions/video-renderer/VideoRenderer.mjs +64 -64
  22. package/esm2020/lib/matterport-extensions/view-frustum-mesh/ViewFrustumMesh.mjs +221 -221
  23. package/esm2020/lib/mattertagData.mjs +165 -165
  24. package/esm2020/lib/ngx-smarterplan-core.module.mjs +122 -122
  25. package/esm2020/lib/ngx-smarterplan-core.service.mjs +14 -14
  26. package/esm2020/lib/pipes/duration-to-string.pipe.mjs +66 -66
  27. package/esm2020/lib/pipes/format-date-number-to-digits.pipe.mjs +30 -30
  28. package/esm2020/lib/pipes/hashtag-from-id.pipe.mjs +26 -26
  29. package/esm2020/lib/pipes/safe-url.pipe.mjs +20 -20
  30. package/esm2020/lib/pipes/time-date-to-local-string.pipe.mjs +104 -104
  31. package/esm2020/lib/pipes/username-from-id.pipe.mjs +29 -29
  32. package/esm2020/lib/services/amplify-cache.service.mjs +72 -72
  33. package/esm2020/lib/services/base-tab.service.mjs +24 -24
  34. package/esm2020/lib/services/baseVisibility.service.mjs +18 -18
  35. package/esm2020/lib/services/content.service.mjs +135 -135
  36. package/esm2020/lib/services/filter.service.mjs +599 -599
  37. package/esm2020/lib/services/intervention.service.mjs +236 -236
  38. package/esm2020/lib/services/locale.service.mjs +45 -45
  39. package/esm2020/lib/services/matterport-import.service.mjs +340 -340
  40. package/esm2020/lib/services/matterport.service.mjs +1587 -1587
  41. package/esm2020/lib/services/models/affectation.service.mjs +60 -60
  42. package/esm2020/lib/services/models/base-object.service.mjs +70 -70
  43. package/esm2020/lib/services/models/capture.service.mjs +34 -34
  44. package/esm2020/lib/services/models/comment.service.mjs +98 -98
  45. package/esm2020/lib/services/models/domain.service.mjs +78 -78
  46. package/esm2020/lib/services/models/equipment.service.mjs +683 -683
  47. package/esm2020/lib/services/models/event.service.mjs +128 -128
  48. package/esm2020/lib/services/models/feature.service.mjs +380 -364
  49. package/esm2020/lib/services/models/hashtag.service.mjs +38 -38
  50. package/esm2020/lib/services/models/layer.service.mjs +33 -33
  51. package/esm2020/lib/services/models/measurement.service.mjs +199 -199
  52. package/esm2020/lib/services/models/mission.service.mjs +206 -206
  53. package/esm2020/lib/services/models/navigation.service.mjs +92 -92
  54. package/esm2020/lib/services/models/node.service.mjs +31 -31
  55. package/esm2020/lib/services/models/object3D.service.mjs +364 -364
  56. package/esm2020/lib/services/models/operation.service.mjs +59 -59
  57. package/esm2020/lib/services/models/organisation.service.mjs +73 -73
  58. package/esm2020/lib/services/models/plan.service.mjs +799 -799
  59. package/esm2020/lib/services/models/poi.service.mjs +103 -103
  60. package/esm2020/lib/services/models/profile.service.mjs +58 -58
  61. package/esm2020/lib/services/models/property.service.mjs +44 -44
  62. package/esm2020/lib/services/models/space.service.mjs +204 -204
  63. package/esm2020/lib/services/models/template.service.mjs +41 -41
  64. package/esm2020/lib/services/models/ticket.service.mjs +526 -526
  65. package/esm2020/lib/services/models/visit.service.mjs +130 -130
  66. package/esm2020/lib/services/models/zone.service.mjs +225 -225
  67. package/esm2020/lib/services/navigator.service.mjs +212 -212
  68. package/esm2020/lib/services/s3.service.mjs +137 -137
  69. package/esm2020/lib/services/search.service.mjs +124 -124
  70. package/esm2020/lib/services/support.service.mjs +42 -42
  71. package/esm2020/lib/services/tag.service.mjs +111 -111
  72. package/esm2020/lib/services/user.service.mjs +501 -501
  73. package/esm2020/lib/services/validators.service.mjs +50 -50
  74. package/esm2020/lib/services/viewer.service.mjs +389 -389
  75. package/esm2020/lib/services/zone-drawer.service.mjs +76 -76
  76. package/esm2020/lib/services/zoneChange.service.mjs +30 -30
  77. package/esm2020/lib/types.service.mjs +311 -310
  78. package/esm2020/lib/validators/email.directive.mjs +7 -7
  79. package/esm2020/lib/validators/no-empty.directive.mjs +12 -12
  80. package/esm2020/lib/validators/number.directive.mjs +12 -12
  81. package/esm2020/lib/validators/text.directive.mjs +12 -12
  82. package/esm2020/public-api.mjs +72 -72
  83. package/esm2020/smarterplan-ngx-smarterplan-core.mjs +4 -4
  84. package/fesm2015/smarterplan-ngx-smarterplan-core.mjs +13009 -12992
  85. package/fesm2015/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
  86. package/fesm2020/smarterplan-ngx-smarterplan-core.mjs +12258 -12241
  87. package/fesm2020/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
  88. package/lib/components/csv-export/csv-export.component.d.ts +18 -18
  89. package/lib/components/loader/loader.component.d.ts +10 -10
  90. package/lib/components/menu-bar/avatar/avatar.component.d.ts +21 -21
  91. package/lib/components/menu-bar/menu-bar.component.d.ts +38 -38
  92. package/lib/components/menu-bar/navigation-bar/navigation-bar.component.d.ts +73 -73
  93. package/lib/components/menu-bar/range-date-picker/range-date-picker.component.d.ts +35 -35
  94. package/lib/components/modal-switch-visit/modal-switch-visit.component.d.ts +22 -22
  95. package/lib/components/search-bar/search-bar.component.d.ts +16 -16
  96. package/lib/components/support-modal/support-modal.component.d.ts +26 -26
  97. package/lib/config.d.ts +22 -22
  98. package/lib/helpers.service.d.ts +79 -79
  99. package/lib/matterport-extensions/hsl-loader/HlsLoader.d.ts +26 -26
  100. package/lib/matterport-extensions/nest-thermostat/CanvasImage.d.ts +31 -31
  101. package/lib/matterport-extensions/nest-thermostat/CanvasRenderer.d.ts +37 -37
  102. package/lib/matterport-extensions/nest-thermostat/NestThermostat.d.ts +42 -42
  103. package/lib/matterport-extensions/nest-thermostat/PlaneRenderer.d.ts +46 -46
  104. package/lib/matterport-extensions/scene-component/SceneComponent.d.ts +388 -388
  105. package/lib/matterport-extensions/security-camera/SecurityCamera.d.ts +47 -47
  106. package/lib/matterport-extensions/tv-player/TvPlayer.d.ts +26 -26
  107. package/lib/matterport-extensions/video-renderer/VideoRenderer.d.ts +26 -26
  108. package/lib/matterport-extensions/view-frustum-mesh/ViewFrustumMesh.d.ts +43 -43
  109. package/lib/mattertagData.d.ts +70 -70
  110. package/lib/ngx-smarterplan-core.module.d.ts +29 -29
  111. package/lib/ngx-smarterplan-core.service.d.ts +6 -6
  112. package/lib/pipes/duration-to-string.pipe.d.ts +12 -12
  113. package/lib/pipes/format-date-number-to-digits.pipe.d.ts +10 -10
  114. package/lib/pipes/hashtag-from-id.pipe.d.ts +10 -10
  115. package/lib/pipes/safe-url.pipe.d.ts +10 -10
  116. package/lib/pipes/time-date-to-local-string.pipe.d.ts +16 -16
  117. package/lib/pipes/username-from-id.pipe.d.ts +11 -11
  118. package/lib/services/amplify-cache.service.d.ts +37 -37
  119. package/lib/services/base-tab.service.d.ts +10 -10
  120. package/lib/services/baseVisibility.service.d.ts +9 -9
  121. package/lib/services/content.service.d.ts +28 -28
  122. package/lib/services/filter.service.d.ts +60 -60
  123. package/lib/services/intervention.service.d.ts +25 -25
  124. package/lib/services/locale.service.d.ts +23 -23
  125. package/lib/services/matterport-import.service.d.ts +53 -53
  126. package/lib/services/matterport.service.d.ts +336 -336
  127. package/lib/services/models/affectation.service.d.ts +14 -14
  128. package/lib/services/models/base-object.service.d.ts +20 -20
  129. package/lib/services/models/capture.service.d.ts +13 -13
  130. package/lib/services/models/comment.service.d.ts +26 -26
  131. package/lib/services/models/domain.service.d.ts +19 -19
  132. package/lib/services/models/equipment.service.d.ts +93 -93
  133. package/lib/services/models/event.service.d.ts +43 -43
  134. package/lib/services/models/feature.service.d.ts +75 -74
  135. package/lib/services/models/hashtag.service.d.ts +13 -13
  136. package/lib/services/models/layer.service.d.ts +11 -11
  137. package/lib/services/models/measurement.service.d.ts +51 -51
  138. package/lib/services/models/mission.service.d.ts +39 -39
  139. package/lib/services/models/navigation.service.d.ts +29 -29
  140. package/lib/services/models/node.service.d.ts +12 -12
  141. package/lib/services/models/object3D.service.d.ts +57 -57
  142. package/lib/services/models/operation.service.d.ts +15 -15
  143. package/lib/services/models/organisation.service.d.ts +19 -19
  144. package/lib/services/models/plan.service.d.ts +133 -133
  145. package/lib/services/models/poi.service.d.ts +25 -25
  146. package/lib/services/models/profile.service.d.ts +16 -16
  147. package/lib/services/models/property.service.d.ts +13 -13
  148. package/lib/services/models/space.service.d.ts +46 -46
  149. package/lib/services/models/template.service.d.ts +15 -15
  150. package/lib/services/models/ticket.service.d.ts +93 -93
  151. package/lib/services/models/visit.service.d.ts +24 -24
  152. package/lib/services/models/zone.service.d.ts +50 -50
  153. package/lib/services/navigator.service.d.ts +61 -61
  154. package/lib/services/s3.service.d.ts +14 -14
  155. package/lib/services/search.service.d.ts +20 -20
  156. package/lib/services/support.service.d.ts +17 -17
  157. package/lib/services/tag.service.d.ts +29 -29
  158. package/lib/services/user.service.d.ts +118 -118
  159. package/lib/services/validators.service.d.ts +18 -18
  160. package/lib/services/viewer.service.d.ts +110 -110
  161. package/lib/services/zone-drawer.service.d.ts +7 -7
  162. package/lib/services/zoneChange.service.d.ts +17 -17
  163. package/lib/types.service.d.ts +842 -840
  164. package/lib/validators/email.directive.d.ts +2 -2
  165. package/lib/validators/no-empty.directive.d.ts +2 -2
  166. package/lib/validators/number.directive.d.ts +2 -2
  167. package/lib/validators/text.directive.d.ts +2 -2
  168. package/package.json +1 -1
  169. package/public-api.d.ts +64 -64
  170. package/smarterplan-ngx-smarterplan-core.d.ts +5 -5
@@ -1,388 +1,388 @@
1
- /// <reference types="node" />
2
- import THREE, { Scene } from 'three';
3
- import Dict = NodeJS.Dict;
4
- /**
5
- * The base of all `SceneComponent` created with the sdk.
6
- * All properties of this class are always available to all components generated through the sdk.
7
- * These properties should all be considered reserved and should not be overwritten by the subclass.
8
- */
9
- declare abstract class SceneComponentPrivate {
10
- /**
11
- * @reserved
12
- * The name registered to the factory used to generate this component.
13
- */
14
- readonly componentType: string;
15
- /**
16
- * @reserved
17
- * A dictionary of properties that this component computes. Every component is guaranteed to have `outputs.collider` and `outputs.objectRoot`.
18
- * This dictionary is observable and can be the source of a bind target.
19
- *
20
- */
21
- outputs: ComponentOutput;
22
- /**
23
- * @reserved
24
- * A dictionary of events that will be handled by this component's `onEvent`. Every component is guaranteed to have all of the `InteractionSelection` keys:
25
- * `events[InteractionSelection.CLICK]`, `events[InteractionSelection.HOVER]`, `events[InteractionSelection.DRAG]`
26
- * Note: registering to receive `InteractionSelection.HOVER` will produce both `InteractionType.HOVER` and `InteractionType.UNHOVER` in `onEvent`.
27
- */
28
- events: Dict<boolean>;
29
- /**
30
- * @reserved
31
- * The context provides access to the underlying framework, e.g. THREE.js.
32
- */
33
- context: ComponentContext;
34
- /**
35
- * @reserved
36
- * Binds `this[prop]` to the output of `src[srcProp]`.
37
- * When the value of `src[srcProp]` changes, the value is propagated and sets `this[prop]` to the same value automatically.
38
- */
39
- bind: (prop: string, src: SceneComponent['outputs' | 'inputs'], srcProp: keyof SceneComponent['outputs' | 'inputs']) => void;
40
- /**
41
- * @reserved
42
- * Notifies this component of an `eventType` when the `src` Component calls `notify` with a `srcEventType` event
43
- */
44
- bindEvent: (eventType: string, src: SceneComponent, srcEventType: string) => void;
45
- /**
46
- * @reserved
47
- * Notifies any event bindings of an event with `eventType` and data `eventData`
48
- */
49
- notify: (eventType: string, eventData?: unknown) => void;
50
- /**
51
- * @reserved
52
- * Spy on a component's notify from outside of the component system
53
- */
54
- spyOnEvent: (spy: IComponentEventSpy) => ISubscription;
55
- }
56
- export declare abstract class SceneComponent extends SceneComponentPrivate {
57
- /**
58
- * An optional dictionary of properties that affects the behavior of the component.
59
- * The properties can be changed by an external source at any time. It is up to the component to respond appropriately to the changes.
60
- * The input properties can also be bind targets to another observable source, e.g. the output property of another component.
61
- */
62
- inputs?: Dict<any>;
63
- /**
64
- * This event is called once after the scene node its attached to has started.
65
- */
66
- onInit?(): void;
67
- /**
68
- * This event is called at most once per frame when there are events on this component.
69
- * Any of the interaction types specified in `this.interactions` or a call to notify for a bound event will trigger this event.
70
- * @property {string | ComponentInteractionType} eventType The event type
71
- * @property {unknown} eventData The data payload of the event
72
- */
73
- onEvent?(eventType: string, eventData: unknown): void;
74
- /**
75
- * This event is called after an input property has changed.
76
- * It will be called at most once a frame.
77
- */
78
- onInputsUpdated?(previousInputs: this['inputs']): void;
79
- /**
80
- * This event is called once a frame after input changes have been detected.
81
- */
82
- onTick?(tickDelta: number): void;
83
- /**
84
- * @reserved
85
- * A dictionary of events that will be handled by this component's `onEvent`. Every component is guaranteed to have all of the `InteractionSelection` keys:
86
- * `events[InteractionSelection.CLICK]`, `events[InteractionSelection.HOVER]`, `events[InteractionSelection.DRAG]`
87
- * Note: registering to receive `InteractionSelection.HOVER` will produce both `InteractionType.HOVER` and `InteractionType.UNHOVER` in `onEvent`.
88
- */
89
- events: Record<string, boolean>;
90
- /**
91
- * @reserved
92
- * A dictionary of events that will be emitted by this component.
93
- */
94
- emits?: Record<string, boolean>;
95
- /**
96
- * This event is called once right before the scene node has stopped.
97
- */
98
- onDestroy?(): void;
99
- }
100
- /**
101
- * A node of a scene graph.
102
- * Aggregates `SceneComponent` as children.
103
- */
104
- export interface ISceneNode {
105
- /**
106
- * A human readable name provided by the user.
107
- */
108
- name: string;
109
- /**
110
- * The position of the node.
111
- * The position, quaternion, scale transforms are applied in scale, quaternion, then scale order. (same as THREE.js)
112
- */
113
- readonly position: THREE.Vector3;
114
- /**
115
- * The orientation of the node.
116
- * The position, quaternion, scale transforms are applied in scale, quaternion, then scale order. (same as THREE.js)
117
- */
118
- readonly quaternion: THREE.Quaternion;
119
- /**
120
- * The scale of the node.
121
- * The position, quaternion, scale transforms are applied in scale, quaternion, then scale order. (same as THREE.js)
122
- */
123
- readonly scale: THREE.Vector3;
124
- /**
125
- * Create and add a child component to this node.
126
- *
127
- * @param factory The name associated with the factory to generate a `SceneComponent`
128
- * @param initialInputs An initial set of inputs, immediately available to the newly create `SceneComponent.onInit`
129
- */
130
- addComponent(factory: string, initialInputs?: SceneComponent['inputs']): SceneComponent;
131
- /**
132
- * An iterator to iterate over the components added to this node using a for-of loop.
133
- */
134
- componentIterator(): IterableIterator<SceneComponent>;
135
- /**
136
- * Start the node and its components.
137
- */
138
- start(): void;
139
- /**
140
- * Stop the node and its components.
141
- */
142
- stop(): void;
143
- }
144
- /**
145
- * The types of the Interaction events received from the registered `InteractionSelection`
146
- */
147
- export declare enum ComponentInteractionType {
148
- /** CLICK events */
149
- CLICK = "INTERACTION.CLICK",
150
- /** HOVER events */
151
- HOVER = "INTERACTION.HOVER",
152
- /** DRAG events (mousedown then move) */
153
- DRAG = "INTERACTION.DRAG",
154
- DRAG_BEGIN = "INTERACTION.DRAG_BEGIN",
155
- DRAG_END = "INTERACTION.DRAG_END",
156
- POINTER_MOVE = "INTERACTION.POINTER_MOVE",
157
- POINTER_BUTTON = "INTERACTION.POINTER_BUTTON",
158
- SCROLL = "INTERACTION.SCROLL",
159
- KEY = "INTERACTION.KEY",
160
- LONG_PRESS_START = "INTERACTION.LONG_PRESS_START",
161
- LONG_PRESS_END = "INTERACTION.LONG_PRESS_END",
162
- MULTI_SWIPE = "INTERACTION.MULTI_SWIPE",
163
- MULTI_SWIPE_END = "INTERACTION.MULTI_SWIPE_END",
164
- PINCH = "INTERACTION.PINCH",
165
- PINCH_END = "INTERACTION.PINCH_END",
166
- ROTATE = "INTERACTION.ROTATE",
167
- ROTATE_END = "INTERACTION.ROTATE_END"
168
- }
169
- declare abstract class ComponentOutputReserved {
170
- objectRoot: THREE.Object3D | null;
171
- collider: THREE.Object3D | null;
172
- }
173
- interface ComponentOut extends Dict<any> {
174
- }
175
- declare class ComponentOut extends ComponentOutputReserved {
176
- }
177
- /**
178
- * A general-use bag of properties.
179
- * At a minimum, it has `objectRoot` and `collider` automatically defined.
180
- */
181
- export declare type ComponentOutput = ComponentOut;
182
- /**
183
- * The context of a component (available as `this.context`) in a `SceneComponent` subclass.
184
- * Access to the root `ISceneNode` and the THREE.js are available.
185
- */
186
- export declare type ComponentContext = {
187
- three: typeof THREE;
188
- root: ISceneNode;
189
- renderer: THREE.WebGLRenderer;
190
- user: Dict<any>;
191
- scene: Scene;
192
- };
193
- /**
194
- * A raycast intersection with a mesh
195
- */
196
- export declare type Intersect = {
197
- point: THREE.Vector3;
198
- normal: THREE.Vector3;
199
- collider: THREE.Object3D;
200
- };
201
- /**
202
- * A spy that can be attached to a component using `spyOnEvent`
203
- */
204
- export interface IComponentEventSpy<T = unknown> {
205
- readonly eventType: string;
206
- onEvent(eventData?: T): void;
207
- }
208
- /**
209
- * An object responsible for removing a spy from a component's event
210
- */
211
- export interface ISubscription {
212
- cancel(): void;
213
- }
214
- export interface IVector2 {
215
- x: number;
216
- y: number;
217
- }
218
- export interface IVector3 {
219
- x: number;
220
- y: number;
221
- z: number;
222
- }
223
- export declare enum PointerButton {
224
- PRIMARY = 0,
225
- MIDDLE = 1,
226
- SECONDARY = 2,
227
- BACK = 3,
228
- FORWARD = 4,
229
- COUNT = 5
230
- }
231
- export declare enum PointerButtonMask {
232
- NONE = 0,
233
- PRIMARY = 1,
234
- SECONDARY = 4,
235
- MIDDLE = 2,
236
- BACK = 8,
237
- FORWARD = 16,
238
- ALL = 31
239
- }
240
- export declare enum PointerDevice {
241
- MOUSE = "mouse",
242
- TOUCH = "touch",
243
- PEN = "pen",
244
- GAMEPAD = "gamepad"
245
- }
246
- /**
247
- * Fired on every mouse down, provides current position/buttons down.
248
- */
249
- export interface DragBeginEvent {
250
- /** Current position */
251
- readonly position: IVector2;
252
- /** Buttons down during event */
253
- readonly buttons: PointerButtonMask;
254
- }
255
- /**
256
- * Fired only after the pointer has moved far enough from DragBeginEvent
257
- */
258
- export interface DragEvent {
259
- /** Current position */
260
- readonly position: IVector2;
261
- /** Delta moved since last drag event */
262
- readonly delta: IVector2;
263
- /** Buttons down during event */
264
- readonly buttons: PointerButtonMask;
265
- }
266
- /**
267
- * Fired on every mouse up, includes information about the difference between the DragBegin and current positions
268
- */
269
- export interface DragEndEvent extends DragEvent {
270
- /** duration since last DragEvent */
271
- readonly timeSinceLastMove: number;
272
- /** The delta between position, and the position from DragBeginEvent */
273
- readonly fullDelta: IVector2;
274
- }
275
- export interface PointerMoveEvent {
276
- readonly id: number;
277
- readonly position: IVector2;
278
- readonly buttons: PointerButtonMask;
279
- readonly device: PointerDevice;
280
- }
281
- export interface PointerButtonEvent {
282
- readonly id: number;
283
- readonly position: IVector2;
284
- readonly button: PointerButton;
285
- readonly down: boolean;
286
- readonly device: PointerDevice;
287
- }
288
- export interface ScrollEvent {
289
- readonly position: IVector2;
290
- readonly delta: IVector2;
291
- }
292
- export declare enum KeyState {
293
- DOWN = 0,
294
- PRESSED = 1,
295
- UP = 2
296
- }
297
- export declare enum Keys {
298
- ESCAPE = 27,
299
- ZERO = 48,
300
- ONE = 49,
301
- TWO = 50,
302
- THREE = 51,
303
- FOUR = 52,
304
- FIVE = 53,
305
- SIX = 54,
306
- SEVEN = 55,
307
- EIGHT = 56,
308
- NINE = 57,
309
- LEFTARROW = 37,
310
- UPARROW = 38,
311
- RIGHTARROW = 39,
312
- DOWNARROW = 40,
313
- TAB = 9,
314
- A = 65,
315
- B = 66,
316
- C = 67,
317
- D = 68,
318
- E = 69,
319
- F = 70,
320
- G = 71,
321
- H = 72,
322
- I = 73,
323
- J = 74,
324
- K = 75,
325
- L = 76,
326
- M = 77,
327
- N = 78,
328
- O = 79,
329
- P = 80,
330
- Q = 81,
331
- R = 82,
332
- S = 83,
333
- T = 84,
334
- U = 85,
335
- V = 86,
336
- W = 87,
337
- X = 88,
338
- Y = 89,
339
- Z = 90,
340
- SPACE = 32,
341
- RETURN = 13,
342
- DELETE = 46,
343
- BACKSPACE = 8,
344
- SEMICOLON = 186,
345
- PLUSEQUALS = 187,
346
- DASHUNDERSCORE = 189,
347
- OPENBRACKET = 219,
348
- SHIFT = 16,
349
- ALT = 18,
350
- CONTROL = 17
351
- }
352
- export interface KeyEvent {
353
- key: Keys;
354
- state: KeyState;
355
- modifiers: {
356
- altKey: boolean;
357
- shiftKey: boolean;
358
- ctrlKey: boolean;
359
- };
360
- }
361
- export interface LongPressStartEvent {
362
- readonly position: IVector2;
363
- readonly buttons: PointerButtonMask;
364
- readonly threshold: number;
365
- }
366
- export interface LongPressEndEvent {
367
- }
368
- export interface MultiSwipeEvent {
369
- readonly pointerCount: number;
370
- readonly position: IVector2;
371
- readonly delta: IVector2;
372
- }
373
- export interface MultiSwipeEndEvent extends MultiSwipeEvent {
374
- readonly timeSinceLastMove: number;
375
- }
376
- export interface PinchEvent {
377
- readonly pinchDelta: number;
378
- }
379
- export interface PinchEndEvent extends PinchEvent {
380
- readonly timeSinceLastMove: number;
381
- }
382
- export interface RotateEvent {
383
- readonly rotateDelta: number;
384
- }
385
- export interface RotateEndEvent extends RotateEvent {
386
- readonly timeSinceLastMove: number;
387
- }
388
- export {};
1
+ /// <reference types="node" />
2
+ import THREE, { Scene } from 'three';
3
+ import Dict = NodeJS.Dict;
4
+ /**
5
+ * The base of all `SceneComponent` created with the sdk.
6
+ * All properties of this class are always available to all components generated through the sdk.
7
+ * These properties should all be considered reserved and should not be overwritten by the subclass.
8
+ */
9
+ declare abstract class SceneComponentPrivate {
10
+ /**
11
+ * @reserved
12
+ * The name registered to the factory used to generate this component.
13
+ */
14
+ readonly componentType: string;
15
+ /**
16
+ * @reserved
17
+ * A dictionary of properties that this component computes. Every component is guaranteed to have `outputs.collider` and `outputs.objectRoot`.
18
+ * This dictionary is observable and can be the source of a bind target.
19
+ *
20
+ */
21
+ outputs: ComponentOutput;
22
+ /**
23
+ * @reserved
24
+ * A dictionary of events that will be handled by this component's `onEvent`. Every component is guaranteed to have all of the `InteractionSelection` keys:
25
+ * `events[InteractionSelection.CLICK]`, `events[InteractionSelection.HOVER]`, `events[InteractionSelection.DRAG]`
26
+ * Note: registering to receive `InteractionSelection.HOVER` will produce both `InteractionType.HOVER` and `InteractionType.UNHOVER` in `onEvent`.
27
+ */
28
+ events: Dict<boolean>;
29
+ /**
30
+ * @reserved
31
+ * The context provides access to the underlying framework, e.g. THREE.js.
32
+ */
33
+ context: ComponentContext;
34
+ /**
35
+ * @reserved
36
+ * Binds `this[prop]` to the output of `src[srcProp]`.
37
+ * When the value of `src[srcProp]` changes, the value is propagated and sets `this[prop]` to the same value automatically.
38
+ */
39
+ bind: (prop: string, src: SceneComponent['outputs' | 'inputs'], srcProp: keyof SceneComponent['outputs' | 'inputs']) => void;
40
+ /**
41
+ * @reserved
42
+ * Notifies this component of an `eventType` when the `src` Component calls `notify` with a `srcEventType` event
43
+ */
44
+ bindEvent: (eventType: string, src: SceneComponent, srcEventType: string) => void;
45
+ /**
46
+ * @reserved
47
+ * Notifies any event bindings of an event with `eventType` and data `eventData`
48
+ */
49
+ notify: (eventType: string, eventData?: unknown) => void;
50
+ /**
51
+ * @reserved
52
+ * Spy on a component's notify from outside of the component system
53
+ */
54
+ spyOnEvent: (spy: IComponentEventSpy) => ISubscription;
55
+ }
56
+ export declare abstract class SceneComponent extends SceneComponentPrivate {
57
+ /**
58
+ * An optional dictionary of properties that affects the behavior of the component.
59
+ * The properties can be changed by an external source at any time. It is up to the component to respond appropriately to the changes.
60
+ * The input properties can also be bind targets to another observable source, e.g. the output property of another component.
61
+ */
62
+ inputs?: Dict<any>;
63
+ /**
64
+ * This event is called once after the scene node its attached to has started.
65
+ */
66
+ onInit?(): void;
67
+ /**
68
+ * This event is called at most once per frame when there are events on this component.
69
+ * Any of the interaction types specified in `this.interactions` or a call to notify for a bound event will trigger this event.
70
+ * @property {string | ComponentInteractionType} eventType The event type
71
+ * @property {unknown} eventData The data payload of the event
72
+ */
73
+ onEvent?(eventType: string, eventData: unknown): void;
74
+ /**
75
+ * This event is called after an input property has changed.
76
+ * It will be called at most once a frame.
77
+ */
78
+ onInputsUpdated?(previousInputs: this['inputs']): void;
79
+ /**
80
+ * This event is called once a frame after input changes have been detected.
81
+ */
82
+ onTick?(tickDelta: number): void;
83
+ /**
84
+ * @reserved
85
+ * A dictionary of events that will be handled by this component's `onEvent`. Every component is guaranteed to have all of the `InteractionSelection` keys:
86
+ * `events[InteractionSelection.CLICK]`, `events[InteractionSelection.HOVER]`, `events[InteractionSelection.DRAG]`
87
+ * Note: registering to receive `InteractionSelection.HOVER` will produce both `InteractionType.HOVER` and `InteractionType.UNHOVER` in `onEvent`.
88
+ */
89
+ events: Record<string, boolean>;
90
+ /**
91
+ * @reserved
92
+ * A dictionary of events that will be emitted by this component.
93
+ */
94
+ emits?: Record<string, boolean>;
95
+ /**
96
+ * This event is called once right before the scene node has stopped.
97
+ */
98
+ onDestroy?(): void;
99
+ }
100
+ /**
101
+ * A node of a scene graph.
102
+ * Aggregates `SceneComponent` as children.
103
+ */
104
+ export interface ISceneNode {
105
+ /**
106
+ * A human readable name provided by the user.
107
+ */
108
+ name: string;
109
+ /**
110
+ * The position of the node.
111
+ * The position, quaternion, scale transforms are applied in scale, quaternion, then scale order. (same as THREE.js)
112
+ */
113
+ readonly position: THREE.Vector3;
114
+ /**
115
+ * The orientation of the node.
116
+ * The position, quaternion, scale transforms are applied in scale, quaternion, then scale order. (same as THREE.js)
117
+ */
118
+ readonly quaternion: THREE.Quaternion;
119
+ /**
120
+ * The scale of the node.
121
+ * The position, quaternion, scale transforms are applied in scale, quaternion, then scale order. (same as THREE.js)
122
+ */
123
+ readonly scale: THREE.Vector3;
124
+ /**
125
+ * Create and add a child component to this node.
126
+ *
127
+ * @param factory The name associated with the factory to generate a `SceneComponent`
128
+ * @param initialInputs An initial set of inputs, immediately available to the newly create `SceneComponent.onInit`
129
+ */
130
+ addComponent(factory: string, initialInputs?: SceneComponent['inputs']): SceneComponent;
131
+ /**
132
+ * An iterator to iterate over the components added to this node using a for-of loop.
133
+ */
134
+ componentIterator(): IterableIterator<SceneComponent>;
135
+ /**
136
+ * Start the node and its components.
137
+ */
138
+ start(): void;
139
+ /**
140
+ * Stop the node and its components.
141
+ */
142
+ stop(): void;
143
+ }
144
+ /**
145
+ * The types of the Interaction events received from the registered `InteractionSelection`
146
+ */
147
+ export declare enum ComponentInteractionType {
148
+ /** CLICK events */
149
+ CLICK = "INTERACTION.CLICK",
150
+ /** HOVER events */
151
+ HOVER = "INTERACTION.HOVER",
152
+ /** DRAG events (mousedown then move) */
153
+ DRAG = "INTERACTION.DRAG",
154
+ DRAG_BEGIN = "INTERACTION.DRAG_BEGIN",
155
+ DRAG_END = "INTERACTION.DRAG_END",
156
+ POINTER_MOVE = "INTERACTION.POINTER_MOVE",
157
+ POINTER_BUTTON = "INTERACTION.POINTER_BUTTON",
158
+ SCROLL = "INTERACTION.SCROLL",
159
+ KEY = "INTERACTION.KEY",
160
+ LONG_PRESS_START = "INTERACTION.LONG_PRESS_START",
161
+ LONG_PRESS_END = "INTERACTION.LONG_PRESS_END",
162
+ MULTI_SWIPE = "INTERACTION.MULTI_SWIPE",
163
+ MULTI_SWIPE_END = "INTERACTION.MULTI_SWIPE_END",
164
+ PINCH = "INTERACTION.PINCH",
165
+ PINCH_END = "INTERACTION.PINCH_END",
166
+ ROTATE = "INTERACTION.ROTATE",
167
+ ROTATE_END = "INTERACTION.ROTATE_END"
168
+ }
169
+ declare abstract class ComponentOutputReserved {
170
+ objectRoot: THREE.Object3D | null;
171
+ collider: THREE.Object3D | null;
172
+ }
173
+ interface ComponentOut extends Dict<any> {
174
+ }
175
+ declare class ComponentOut extends ComponentOutputReserved {
176
+ }
177
+ /**
178
+ * A general-use bag of properties.
179
+ * At a minimum, it has `objectRoot` and `collider` automatically defined.
180
+ */
181
+ export declare type ComponentOutput = ComponentOut;
182
+ /**
183
+ * The context of a component (available as `this.context`) in a `SceneComponent` subclass.
184
+ * Access to the root `ISceneNode` and the THREE.js are available.
185
+ */
186
+ export declare type ComponentContext = {
187
+ three: typeof THREE;
188
+ root: ISceneNode;
189
+ renderer: THREE.WebGLRenderer;
190
+ user: Dict<any>;
191
+ scene: Scene;
192
+ };
193
+ /**
194
+ * A raycast intersection with a mesh
195
+ */
196
+ export declare type Intersect = {
197
+ point: THREE.Vector3;
198
+ normal: THREE.Vector3;
199
+ collider: THREE.Object3D;
200
+ };
201
+ /**
202
+ * A spy that can be attached to a component using `spyOnEvent`
203
+ */
204
+ export interface IComponentEventSpy<T = unknown> {
205
+ readonly eventType: string;
206
+ onEvent(eventData?: T): void;
207
+ }
208
+ /**
209
+ * An object responsible for removing a spy from a component's event
210
+ */
211
+ export interface ISubscription {
212
+ cancel(): void;
213
+ }
214
+ export interface IVector2 {
215
+ x: number;
216
+ y: number;
217
+ }
218
+ export interface IVector3 {
219
+ x: number;
220
+ y: number;
221
+ z: number;
222
+ }
223
+ export declare enum PointerButton {
224
+ PRIMARY = 0,
225
+ MIDDLE = 1,
226
+ SECONDARY = 2,
227
+ BACK = 3,
228
+ FORWARD = 4,
229
+ COUNT = 5
230
+ }
231
+ export declare enum PointerButtonMask {
232
+ NONE = 0,
233
+ PRIMARY = 1,
234
+ SECONDARY = 4,
235
+ MIDDLE = 2,
236
+ BACK = 8,
237
+ FORWARD = 16,
238
+ ALL = 31
239
+ }
240
+ export declare enum PointerDevice {
241
+ MOUSE = "mouse",
242
+ TOUCH = "touch",
243
+ PEN = "pen",
244
+ GAMEPAD = "gamepad"
245
+ }
246
+ /**
247
+ * Fired on every mouse down, provides current position/buttons down.
248
+ */
249
+ export interface DragBeginEvent {
250
+ /** Current position */
251
+ readonly position: IVector2;
252
+ /** Buttons down during event */
253
+ readonly buttons: PointerButtonMask;
254
+ }
255
+ /**
256
+ * Fired only after the pointer has moved far enough from DragBeginEvent
257
+ */
258
+ export interface DragEvent {
259
+ /** Current position */
260
+ readonly position: IVector2;
261
+ /** Delta moved since last drag event */
262
+ readonly delta: IVector2;
263
+ /** Buttons down during event */
264
+ readonly buttons: PointerButtonMask;
265
+ }
266
+ /**
267
+ * Fired on every mouse up, includes information about the difference between the DragBegin and current positions
268
+ */
269
+ export interface DragEndEvent extends DragEvent {
270
+ /** duration since last DragEvent */
271
+ readonly timeSinceLastMove: number;
272
+ /** The delta between position, and the position from DragBeginEvent */
273
+ readonly fullDelta: IVector2;
274
+ }
275
+ export interface PointerMoveEvent {
276
+ readonly id: number;
277
+ readonly position: IVector2;
278
+ readonly buttons: PointerButtonMask;
279
+ readonly device: PointerDevice;
280
+ }
281
+ export interface PointerButtonEvent {
282
+ readonly id: number;
283
+ readonly position: IVector2;
284
+ readonly button: PointerButton;
285
+ readonly down: boolean;
286
+ readonly device: PointerDevice;
287
+ }
288
+ export interface ScrollEvent {
289
+ readonly position: IVector2;
290
+ readonly delta: IVector2;
291
+ }
292
+ export declare enum KeyState {
293
+ DOWN = 0,
294
+ PRESSED = 1,
295
+ UP = 2
296
+ }
297
+ export declare enum Keys {
298
+ ESCAPE = 27,
299
+ ZERO = 48,
300
+ ONE = 49,
301
+ TWO = 50,
302
+ THREE = 51,
303
+ FOUR = 52,
304
+ FIVE = 53,
305
+ SIX = 54,
306
+ SEVEN = 55,
307
+ EIGHT = 56,
308
+ NINE = 57,
309
+ LEFTARROW = 37,
310
+ UPARROW = 38,
311
+ RIGHTARROW = 39,
312
+ DOWNARROW = 40,
313
+ TAB = 9,
314
+ A = 65,
315
+ B = 66,
316
+ C = 67,
317
+ D = 68,
318
+ E = 69,
319
+ F = 70,
320
+ G = 71,
321
+ H = 72,
322
+ I = 73,
323
+ J = 74,
324
+ K = 75,
325
+ L = 76,
326
+ M = 77,
327
+ N = 78,
328
+ O = 79,
329
+ P = 80,
330
+ Q = 81,
331
+ R = 82,
332
+ S = 83,
333
+ T = 84,
334
+ U = 85,
335
+ V = 86,
336
+ W = 87,
337
+ X = 88,
338
+ Y = 89,
339
+ Z = 90,
340
+ SPACE = 32,
341
+ RETURN = 13,
342
+ DELETE = 46,
343
+ BACKSPACE = 8,
344
+ SEMICOLON = 186,
345
+ PLUSEQUALS = 187,
346
+ DASHUNDERSCORE = 189,
347
+ OPENBRACKET = 219,
348
+ SHIFT = 16,
349
+ ALT = 18,
350
+ CONTROL = 17
351
+ }
352
+ export interface KeyEvent {
353
+ key: Keys;
354
+ state: KeyState;
355
+ modifiers: {
356
+ altKey: boolean;
357
+ shiftKey: boolean;
358
+ ctrlKey: boolean;
359
+ };
360
+ }
361
+ export interface LongPressStartEvent {
362
+ readonly position: IVector2;
363
+ readonly buttons: PointerButtonMask;
364
+ readonly threshold: number;
365
+ }
366
+ export interface LongPressEndEvent {
367
+ }
368
+ export interface MultiSwipeEvent {
369
+ readonly pointerCount: number;
370
+ readonly position: IVector2;
371
+ readonly delta: IVector2;
372
+ }
373
+ export interface MultiSwipeEndEvent extends MultiSwipeEvent {
374
+ readonly timeSinceLastMove: number;
375
+ }
376
+ export interface PinchEvent {
377
+ readonly pinchDelta: number;
378
+ }
379
+ export interface PinchEndEvent extends PinchEvent {
380
+ readonly timeSinceLastMove: number;
381
+ }
382
+ export interface RotateEvent {
383
+ readonly rotateDelta: number;
384
+ }
385
+ export interface RotateEndEvent extends RotateEvent {
386
+ readonly timeSinceLastMove: number;
387
+ }
388
+ export {};