@hatiolab/things-scene 2.7.19 → 2.7.23
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/package.json +3 -3
- package/things-scene-ie.js +1 -1
- package/things-scene-min.js +1 -1
- package/things-scene.d.ts +50 -24
- package/things-scene.mjs +1 -1
package/things-scene.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
declare module '@hatiolab/things-scene' {
|
|
2
2
|
type Constructor<T = {}> = new (...args: any[]) => T
|
|
3
|
+
type Class = { new (...args: any[]): any }
|
|
4
|
+
type Properties = { [key: string]: any }
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
const MODE_VIEW = 0
|
|
7
|
+
const MODE_EDIT = 1
|
|
8
|
+
const MODE_SHIFT = 2
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
enum SCENE_MODE {
|
|
11
|
+
VIEW = 0,
|
|
12
|
+
EDIT = 1
|
|
13
|
+
}
|
|
9
14
|
|
|
10
15
|
type FITMODE = 'both' | 'ratio' | 'width' | 'height' | 'center' | 'none'
|
|
11
16
|
type DIMENSION = { x: number; y: number }
|
|
@@ -13,7 +18,31 @@ declare module '@hatiolab/things-scene' {
|
|
|
13
18
|
type TRANSLATE = DIMENSION
|
|
14
19
|
type POSITION = DIMENSION
|
|
15
20
|
|
|
16
|
-
type
|
|
21
|
+
type LAYOUT = {
|
|
22
|
+
reflow: (container: Container) => void
|
|
23
|
+
capturables?: (container: Container) => boolean
|
|
24
|
+
drawables?: (container: Container) => boolean
|
|
25
|
+
isStuck?: (component: Container) => boolean
|
|
26
|
+
keyNavigate?: (container: Container, component: Component, e: KeyboardEvent) => Component
|
|
27
|
+
joinType?: boolean
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const AbsoluteLayout: LAYOUT & { ABSOLUTE: boolean }
|
|
31
|
+
const TableLayout: LAYOUT
|
|
32
|
+
const CardLayout: LAYOUT
|
|
33
|
+
const HTMLAbsoluteLayout: LAYOUT
|
|
34
|
+
const LinearHorizontal: LAYOUT
|
|
35
|
+
const LinearVertical: LAYOUT
|
|
36
|
+
|
|
37
|
+
type AnimationConfig = {
|
|
38
|
+
duration?: number
|
|
39
|
+
delay?: number
|
|
40
|
+
step: Function
|
|
41
|
+
delta: 'linear' | 'quad' | 'circ' | 'back' | 'bounce' | 'elastic' | Function
|
|
42
|
+
ease: 'out' | 'inout'
|
|
43
|
+
options?: object
|
|
44
|
+
repeat?: boolean
|
|
45
|
+
}
|
|
17
46
|
|
|
18
47
|
type ControlHandler = {
|
|
19
48
|
ondragstart?(point: POSITION, index: number, component: Component): void
|
|
@@ -62,7 +91,7 @@ declare module '@hatiolab/things-scene' {
|
|
|
62
91
|
}
|
|
63
92
|
|
|
64
93
|
class Model {
|
|
65
|
-
static compile(model: Model, context
|
|
94
|
+
static compile(model: Model, context?: any): Component
|
|
66
95
|
|
|
67
96
|
type: string;
|
|
68
97
|
[key: string]: any
|
|
@@ -131,6 +160,7 @@ declare module '@hatiolab/things-scene' {
|
|
|
131
160
|
|
|
132
161
|
class Component extends MixinEvent(Object) {
|
|
133
162
|
static register(type: string, Clazz: typeof Component): void
|
|
163
|
+
static memoize(base: any, property: string, needClone: boolean): void
|
|
134
164
|
|
|
135
165
|
state: Properties
|
|
136
166
|
bounds: { top: number; left: number; width: number; height: number }
|
|
@@ -157,6 +187,11 @@ declare module '@hatiolab/things-scene' {
|
|
|
157
187
|
transcoordP2S(x: number, y: number): POSITION
|
|
158
188
|
render(context: CanvasRenderingContext2D): void
|
|
159
189
|
executeMappings(force?: boolean): void
|
|
190
|
+
invalidate(): void
|
|
191
|
+
animate(config: AnimationConfig): {
|
|
192
|
+
start: Function /* start function */
|
|
193
|
+
stop: Function /* stop function */
|
|
194
|
+
}
|
|
160
195
|
|
|
161
196
|
onchange(after: Properties, before: Properties): void
|
|
162
197
|
|
|
@@ -180,6 +215,11 @@ declare module '@hatiolab/things-scene' {
|
|
|
180
215
|
indexOf(component: Component): number
|
|
181
216
|
insertComponentAt(target: Component, idx: number): void
|
|
182
217
|
findById(id: string): Component
|
|
218
|
+
|
|
219
|
+
add(components: Component[] | Component): Container
|
|
220
|
+
remove(components: Component[] | Component): Container
|
|
221
|
+
|
|
222
|
+
components: Component[]
|
|
183
223
|
}
|
|
184
224
|
class RootContainer extends Container {}
|
|
185
225
|
|
|
@@ -188,15 +228,17 @@ declare module '@hatiolab/things-scene' {
|
|
|
188
228
|
canvas: HTMLCanvasElement
|
|
189
229
|
|
|
190
230
|
getContext(): CanvasRenderingContext2D
|
|
191
|
-
invalidate(): void
|
|
192
231
|
}
|
|
193
232
|
|
|
194
233
|
class ModelLayer extends Layer {
|
|
195
234
|
overlay: HTMLDivElement
|
|
196
235
|
}
|
|
197
236
|
|
|
237
|
+
class Text extends RectPath(Component) {}
|
|
198
238
|
class Shape extends Component {}
|
|
199
239
|
class Ellipse extends Shape {}
|
|
240
|
+
class Polygon extends Shape {}
|
|
241
|
+
class Donut extends Ellipse {}
|
|
200
242
|
class Rect extends RectPath(Shape) {}
|
|
201
243
|
class HTMLOverlayElement extends MixinHTMLElement(RectPath(Component)) {}
|
|
202
244
|
|
|
@@ -231,23 +273,7 @@ declare module '@hatiolab/things-scene' {
|
|
|
231
273
|
*/
|
|
232
274
|
remove(): void
|
|
233
275
|
|
|
234
|
-
animate({
|
|
235
|
-
duration /* unit: milli-second, 1000 milli-seconds by default */,
|
|
236
|
-
delay /* default 30 */,
|
|
237
|
-
step /* step function */,
|
|
238
|
-
delta /* delta function */,
|
|
239
|
-
ease /* ease function */,
|
|
240
|
-
options,
|
|
241
|
-
repeat /* default false */
|
|
242
|
-
}: {
|
|
243
|
-
duration: number
|
|
244
|
-
delay: number
|
|
245
|
-
step: Function
|
|
246
|
-
delta: 'linear' | 'quad' | 'circ' | 'back' | 'bounce' | 'elastic' | Function
|
|
247
|
-
ease: 'out' | 'inout'
|
|
248
|
-
options?: object
|
|
249
|
-
repeat: boolean
|
|
250
|
-
}): {
|
|
276
|
+
animate(config: AnimationConfig): {
|
|
251
277
|
start: Function /* start function */
|
|
252
278
|
stop: Function /* stop function */
|
|
253
279
|
}
|