@hatiolab/things-scene 2.7.21 → 2.7.25
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 +1 -1
- package/things-scene.d.ts +60 -22
- package/things-scene.mjs +1 -1
package/package.json
CHANGED
package/things-scene.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
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
6
|
const MODE_VIEW = 0
|
|
5
7
|
const MODE_EDIT = 1
|
|
@@ -15,8 +17,33 @@ declare module '@hatiolab/things-scene' {
|
|
|
15
17
|
type SCALE = DIMENSION
|
|
16
18
|
type TRANSLATE = DIMENSION
|
|
17
19
|
type POSITION = DIMENSION
|
|
20
|
+
type POINT = DIMENSION
|
|
21
|
+
|
|
22
|
+
type LAYOUT = {
|
|
23
|
+
reflow: (container: Container) => void
|
|
24
|
+
capturables?: (container: Container) => boolean
|
|
25
|
+
drawables?: (container: Container) => boolean
|
|
26
|
+
isStuck?: (component: Container) => boolean
|
|
27
|
+
keyNavigate?: (container: Container, component: Component, e: KeyboardEvent) => Component
|
|
28
|
+
joinType?: boolean
|
|
29
|
+
}
|
|
18
30
|
|
|
19
|
-
|
|
31
|
+
const AbsoluteLayout: LAYOUT & { ABSOLUTE: boolean }
|
|
32
|
+
const TableLayout: LAYOUT
|
|
33
|
+
const CardLayout: LAYOUT
|
|
34
|
+
const HTMLAbsoluteLayout: LAYOUT
|
|
35
|
+
const LinearHorizontal: LAYOUT
|
|
36
|
+
const LinearVertical: LAYOUT
|
|
37
|
+
|
|
38
|
+
type AnimationConfig = {
|
|
39
|
+
duration?: number
|
|
40
|
+
delay?: number
|
|
41
|
+
step: Function
|
|
42
|
+
delta: 'linear' | 'quad' | 'circ' | 'back' | 'bounce' | 'elastic' | Function
|
|
43
|
+
ease: 'out' | 'inout'
|
|
44
|
+
options?: object
|
|
45
|
+
repeat?: boolean
|
|
46
|
+
}
|
|
20
47
|
|
|
21
48
|
type ControlHandler = {
|
|
22
49
|
ondragstart?(point: POSITION, index: number, component: Component): void
|
|
@@ -65,7 +92,7 @@ declare module '@hatiolab/things-scene' {
|
|
|
65
92
|
}
|
|
66
93
|
|
|
67
94
|
class Model {
|
|
68
|
-
static compile(model: Model, context
|
|
95
|
+
static compile(model: Model, context?: any): Component
|
|
69
96
|
|
|
70
97
|
type: string;
|
|
71
98
|
[key: string]: any
|
|
@@ -134,6 +161,7 @@ declare module '@hatiolab/things-scene' {
|
|
|
134
161
|
|
|
135
162
|
class Component extends MixinEvent(Object) {
|
|
136
163
|
static register(type: string, Clazz: typeof Component): void
|
|
164
|
+
static memoize(base: any, property: string, needClone: boolean): void
|
|
137
165
|
|
|
138
166
|
state: Properties
|
|
139
167
|
bounds: { top: number; left: number; width: number; height: number }
|
|
@@ -145,7 +173,12 @@ declare module '@hatiolab/things-scene' {
|
|
|
145
173
|
hierarchy: Model
|
|
146
174
|
path: Array<DIMENSION>
|
|
147
175
|
anchors: Array<Anchor>
|
|
148
|
-
|
|
176
|
+
|
|
177
|
+
get data(): any
|
|
178
|
+
set data(data: any)
|
|
179
|
+
|
|
180
|
+
get center(): POINT
|
|
181
|
+
set center(point: POINT)
|
|
149
182
|
|
|
150
183
|
get controls(): Array<Control> | undefined
|
|
151
184
|
get hasTextProperty(): boolean
|
|
@@ -155,12 +188,23 @@ declare module '@hatiolab/things-scene' {
|
|
|
155
188
|
getState(prop: string): any
|
|
156
189
|
setState(props: Properties | any, value?: any): void
|
|
157
190
|
get(prop: string): any
|
|
191
|
+
contains(x: number, y: number): boolean
|
|
158
192
|
set(props: Properties | string, value?: any): void
|
|
159
193
|
reposition(): void
|
|
194
|
+
|
|
160
195
|
transcoordP2S(x: number, y: number): POSITION
|
|
196
|
+
transcoordC2S(x: number, y: number, top?: RootContainer): POSITION
|
|
197
|
+
|
|
198
|
+
prerender(context: CanvasRenderingContext2D): void
|
|
161
199
|
render(context: CanvasRenderingContext2D): void
|
|
200
|
+
postrender(context: CanvasRenderingContext2D): void
|
|
201
|
+
|
|
162
202
|
executeMappings(force?: boolean): void
|
|
163
203
|
invalidate(): void
|
|
204
|
+
animate(config: AnimationConfig): {
|
|
205
|
+
start: Function /* start function */
|
|
206
|
+
stop: Function /* stop function */
|
|
207
|
+
}
|
|
164
208
|
|
|
165
209
|
onchange(after: Properties, before: Properties): void
|
|
166
210
|
|
|
@@ -179,12 +223,20 @@ declare module '@hatiolab/things-scene' {
|
|
|
179
223
|
ondblclick(e: MouseEvent): void
|
|
180
224
|
}
|
|
181
225
|
|
|
182
|
-
class ContainerAbstract extends MoveHandle(RectPath(Component)) {
|
|
183
|
-
class Container extends MixinHTMLElement(ContainerAbstract) {
|
|
226
|
+
class ContainerAbstract extends MoveHandle(RectPath(Component)) {
|
|
184
227
|
indexOf(component: Component): number
|
|
228
|
+
size(): number
|
|
229
|
+
addComponent(target: Component): void
|
|
230
|
+
removeComponent(target: Component): void
|
|
185
231
|
insertComponentAt(target: Component, idx: number): void
|
|
186
232
|
findById(id: string): Component
|
|
233
|
+
|
|
234
|
+
add(components: Component[] | Component): Container
|
|
235
|
+
remove(components: Component[] | Component): Container
|
|
236
|
+
|
|
237
|
+
components: Component[]
|
|
187
238
|
}
|
|
239
|
+
class Container extends MixinHTMLElement(ContainerAbstract) {}
|
|
188
240
|
class RootContainer extends Container {}
|
|
189
241
|
|
|
190
242
|
class Layer extends ContainerAbstract {
|
|
@@ -201,6 +253,8 @@ declare module '@hatiolab/things-scene' {
|
|
|
201
253
|
class Text extends RectPath(Component) {}
|
|
202
254
|
class Shape extends Component {}
|
|
203
255
|
class Ellipse extends Shape {}
|
|
256
|
+
class Polygon extends Shape {}
|
|
257
|
+
class Donut extends Ellipse {}
|
|
204
258
|
class Rect extends RectPath(Shape) {}
|
|
205
259
|
class HTMLOverlayElement extends MixinHTMLElement(RectPath(Component)) {}
|
|
206
260
|
|
|
@@ -235,23 +289,7 @@ declare module '@hatiolab/things-scene' {
|
|
|
235
289
|
*/
|
|
236
290
|
remove(): void
|
|
237
291
|
|
|
238
|
-
animate({
|
|
239
|
-
duration /* unit: milli-second, 1000 milli-seconds by default */,
|
|
240
|
-
delay /* default 30 */,
|
|
241
|
-
step /* step function */,
|
|
242
|
-
delta /* delta function */,
|
|
243
|
-
ease /* ease function */,
|
|
244
|
-
options,
|
|
245
|
-
repeat /* default false */
|
|
246
|
-
}: {
|
|
247
|
-
duration: number
|
|
248
|
-
delay: number
|
|
249
|
-
step: Function
|
|
250
|
-
delta: 'linear' | 'quad' | 'circ' | 'back' | 'bounce' | 'elastic' | Function
|
|
251
|
-
ease: 'out' | 'inout'
|
|
252
|
-
options?: object
|
|
253
|
-
repeat: boolean
|
|
254
|
-
}): {
|
|
292
|
+
animate(config: AnimationConfig): {
|
|
255
293
|
start: Function /* start function */
|
|
256
294
|
stop: Function /* stop function */
|
|
257
295
|
}
|