@hatiolab/things-scene 2.7.24 → 2.7.28
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/db.sqlite +0 -0
- package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +3 -3
- package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +3 -28
- package/logs/application-2021-11-10-16.log +6 -0
- package/logs/connections-2021-11-10-16.log +32 -0
- package/package.json +3 -3
- package/things-scene-ie.js +1 -1
- package/things-scene-min.js +1 -1
- package/things-scene.d.ts +131 -22
- package/things-scene.mjs +1 -1
- package/logs/application-2021-11-18-10.log +0 -4
- package/logs/connections-2021-11-08-12.log +0 -0
- package/logs/connections-2021-11-08-14.log +0 -32
- package/logs/connections-2021-11-11-16.log +0 -64
- package/logs/connections-2021-11-15-16.log +0 -32
- package/logs/connections-2021-11-16-09.log +0 -32
- package/logs/connections-2021-11-18-10.log +0 -32
package/things-scene.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import { property } from 'lodash'
|
|
2
|
+
|
|
1
3
|
declare module '@hatiolab/things-scene' {
|
|
2
4
|
type Constructor<T = {}> = new (...args: any[]) => T
|
|
3
5
|
type Class = { new (...args: any[]): any }
|
|
4
6
|
type Properties = { [key: string]: any }
|
|
7
|
+
type State = Properties
|
|
8
|
+
type Style = Properties
|
|
9
|
+
|
|
10
|
+
type ChangeFunction = (selector: string, value: any, self: any) => Component[]
|
|
5
11
|
|
|
6
12
|
const MODE_VIEW = 0
|
|
7
13
|
const MODE_EDIT = 1
|
|
@@ -9,7 +15,8 @@ declare module '@hatiolab/things-scene' {
|
|
|
9
15
|
|
|
10
16
|
enum SCENE_MODE {
|
|
11
17
|
VIEW = 0,
|
|
12
|
-
EDIT = 1
|
|
18
|
+
EDIT = 1,
|
|
19
|
+
SHIFT = 2
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
type FITMODE = 'both' | 'ratio' | 'width' | 'height' | 'center' | 'none'
|
|
@@ -17,22 +24,55 @@ declare module '@hatiolab/things-scene' {
|
|
|
17
24
|
type SCALE = DIMENSION
|
|
18
25
|
type TRANSLATE = DIMENSION
|
|
19
26
|
type POSITION = DIMENSION
|
|
27
|
+
type POINT = DIMENSION
|
|
28
|
+
type BOUNDS = { left: number; top: number; width: number; height: number }
|
|
29
|
+
|
|
30
|
+
type ComponentNature = {
|
|
31
|
+
mutable?: boolean
|
|
32
|
+
resizable?: boolean
|
|
33
|
+
rotatable?: boolean
|
|
34
|
+
properties?: {
|
|
35
|
+
type: string
|
|
36
|
+
label: string
|
|
37
|
+
name: string
|
|
38
|
+
placeholder?: string
|
|
39
|
+
observe?: (this: HTMLElement, value: any) => void
|
|
40
|
+
property?:
|
|
41
|
+
| {
|
|
42
|
+
options?: any
|
|
43
|
+
[key: string]: any
|
|
44
|
+
}
|
|
45
|
+
| string
|
|
46
|
+
}[]
|
|
47
|
+
'value-property'?: string
|
|
48
|
+
valueProperty?: string
|
|
49
|
+
help?: string
|
|
50
|
+
}
|
|
20
51
|
|
|
21
|
-
|
|
52
|
+
interface LAYOUT {
|
|
22
53
|
reflow: (container: Container) => void
|
|
23
|
-
capturables?: (container: Container) =>
|
|
24
|
-
drawables?: (container: Container) =>
|
|
54
|
+
capturables?: (container: Container) => Component[]
|
|
55
|
+
drawables?: (container: Container) => Component[]
|
|
25
56
|
isStuck?: (component: Container) => boolean
|
|
26
|
-
keyNavigate?: (container: Container, component: Component, e: KeyboardEvent) => Component
|
|
57
|
+
keyNavigate?: (container: Container, component: Component, e: KeyboardEvent) => Component | undefined
|
|
27
58
|
joinType?: boolean
|
|
28
59
|
}
|
|
29
60
|
|
|
61
|
+
interface LayoutRegistry {
|
|
62
|
+
register(name: string, layout: LAYOUT): void
|
|
63
|
+
unregister(name: string): void
|
|
64
|
+
get(name: string): LAYOUT
|
|
65
|
+
list(): { [name: string]: LAYOUT }
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const Layout: LayoutRegistry
|
|
69
|
+
|
|
30
70
|
const AbsoluteLayout: LAYOUT & { ABSOLUTE: boolean }
|
|
31
71
|
const TableLayout: LAYOUT
|
|
32
72
|
const CardLayout: LAYOUT
|
|
33
73
|
const HTMLAbsoluteLayout: LAYOUT
|
|
34
|
-
const
|
|
35
|
-
const
|
|
74
|
+
const LinearHorizontalLayout: LAYOUT
|
|
75
|
+
const LinearVerticalLayout: LAYOUT
|
|
36
76
|
|
|
37
77
|
type AnimationConfig = {
|
|
38
78
|
duration?: number
|
|
@@ -93,13 +133,14 @@ declare module '@hatiolab/things-scene' {
|
|
|
93
133
|
class Model {
|
|
94
134
|
static compile(model: Model, context?: any): Component
|
|
95
135
|
|
|
96
|
-
type
|
|
136
|
+
type?: string;
|
|
97
137
|
[key: string]: any
|
|
98
138
|
}
|
|
99
139
|
|
|
100
140
|
class ApplicationContext {
|
|
101
141
|
readonly refProvider: any
|
|
102
142
|
readonly isViewMode: boolean
|
|
143
|
+
readonly isEditMode: boolean
|
|
103
144
|
|
|
104
145
|
mode: SCENE_MODE
|
|
105
146
|
baseUrl: string
|
|
@@ -152,7 +193,7 @@ declare module '@hatiolab/things-scene' {
|
|
|
152
193
|
on(name: string, callback: Function, context?: any): void
|
|
153
194
|
off(name: string, callback: Function, context?: any): void
|
|
154
195
|
once(name: string, callback: Function, context?: any): void
|
|
155
|
-
trigger(name: string): void
|
|
196
|
+
trigger(name: string, ...others: any[]): void
|
|
156
197
|
}
|
|
157
198
|
} & TBase
|
|
158
199
|
|
|
@@ -161,9 +202,11 @@ declare module '@hatiolab/things-scene' {
|
|
|
161
202
|
class Component extends MixinEvent(Object) {
|
|
162
203
|
static register(type: string, Clazz: typeof Component): void
|
|
163
204
|
static memoize(base: any, property: string, needClone: boolean): void
|
|
205
|
+
static drawStroke(context: CanvasRenderingContext2D, style: Style): void
|
|
164
206
|
|
|
165
207
|
state: Properties
|
|
166
|
-
bounds:
|
|
208
|
+
bounds: BOUNDS
|
|
209
|
+
textBounds: BOUNDS
|
|
167
210
|
root: RootContainer
|
|
168
211
|
rootModel: ModelLayer
|
|
169
212
|
parent: Container
|
|
@@ -172,21 +215,42 @@ declare module '@hatiolab/things-scene' {
|
|
|
172
215
|
hierarchy: Model
|
|
173
216
|
path: Array<DIMENSION>
|
|
174
217
|
anchors: Array<Anchor>
|
|
218
|
+
hidden: boolean
|
|
219
|
+
|
|
220
|
+
get nature(): ComponentNature
|
|
221
|
+
|
|
175
222
|
get data(): any
|
|
176
223
|
set data(data: any)
|
|
177
224
|
|
|
225
|
+
get center(): POINT
|
|
226
|
+
set center(point: POINT)
|
|
227
|
+
|
|
178
228
|
get controls(): Array<Control> | undefined
|
|
179
229
|
get hasTextProperty(): boolean
|
|
180
230
|
|
|
231
|
+
isRootModel(): boolean
|
|
232
|
+
isContainer(): boolean
|
|
233
|
+
isLine(): boolean
|
|
234
|
+
isLayer(): boolean
|
|
235
|
+
is3dish(): boolean
|
|
236
|
+
|
|
181
237
|
ready(): void
|
|
182
238
|
dispose(): void
|
|
183
239
|
getState(prop: string): any
|
|
184
240
|
setState(props: Properties | any, value?: any): void
|
|
185
241
|
get(prop: string): any
|
|
242
|
+
contains(x: number, y: number): boolean
|
|
186
243
|
set(props: Properties | string, value?: any): void
|
|
187
244
|
reposition(): void
|
|
245
|
+
clearCache(): void
|
|
246
|
+
|
|
188
247
|
transcoordP2S(x: number, y: number): POSITION
|
|
248
|
+
transcoordC2S(x: number, y: number, top?: RootContainer): POSITION
|
|
249
|
+
|
|
250
|
+
prerender(context: CanvasRenderingContext2D): void
|
|
189
251
|
render(context: CanvasRenderingContext2D): void
|
|
252
|
+
postrender(context: CanvasRenderingContext2D): void
|
|
253
|
+
|
|
190
254
|
executeMappings(force?: boolean): void
|
|
191
255
|
invalidate(): void
|
|
192
256
|
animate(config: AnimationConfig): {
|
|
@@ -211,22 +275,31 @@ declare module '@hatiolab/things-scene' {
|
|
|
211
275
|
ondblclick(e: MouseEvent): void
|
|
212
276
|
}
|
|
213
277
|
|
|
214
|
-
class ContainerAbstract extends MoveHandle(RectPath(Component)) {
|
|
215
|
-
class Container extends MixinHTMLElement(ContainerAbstract) {
|
|
278
|
+
class ContainerAbstract extends MoveHandle(RectPath(Component)) {
|
|
216
279
|
indexOf(component: Component): number
|
|
280
|
+
size(): number
|
|
281
|
+
addComponent(target: Component): void
|
|
282
|
+
removeComponent(target: Component): void
|
|
217
283
|
insertComponentAt(target: Component, idx: number): void
|
|
218
|
-
findById(id: string): Component
|
|
284
|
+
findById(id: string): Component | undefined
|
|
285
|
+
getAt(at: number): Component | undefined
|
|
286
|
+
|
|
287
|
+
reflow(): void
|
|
219
288
|
|
|
220
289
|
add(components: Component[] | Component): Container
|
|
221
290
|
remove(components: Component[] | Component): Container
|
|
222
291
|
|
|
223
292
|
components: Component[]
|
|
224
293
|
}
|
|
225
|
-
class
|
|
294
|
+
class Container extends MixinHTMLElement(ContainerAbstract) {}
|
|
295
|
+
class RootContainer extends Container {
|
|
296
|
+
get selected(): Component[]
|
|
297
|
+
set selected(selected: Component[])
|
|
298
|
+
}
|
|
226
299
|
|
|
227
300
|
class Layer extends ContainerAbstract {
|
|
228
|
-
target: HTMLElement
|
|
229
|
-
canvas: HTMLCanvasElement
|
|
301
|
+
target: HTMLElement | null
|
|
302
|
+
canvas: HTMLCanvasElement | null
|
|
230
303
|
|
|
231
304
|
getContext(): CanvasRenderingContext2D
|
|
232
305
|
}
|
|
@@ -258,7 +331,20 @@ declare module '@hatiolab/things-scene' {
|
|
|
258
331
|
* @param boundsOrOffset {object} - x, y, cx, cy, ...
|
|
259
332
|
* @param onto {string} - onto
|
|
260
333
|
*/
|
|
261
|
-
add(
|
|
334
|
+
add(
|
|
335
|
+
models: Model,
|
|
336
|
+
boundsOrOffset?: {
|
|
337
|
+
left?: number
|
|
338
|
+
top?: number
|
|
339
|
+
width?: number
|
|
340
|
+
height?: number
|
|
341
|
+
x?: number
|
|
342
|
+
y?: number
|
|
343
|
+
cx?: number
|
|
344
|
+
cy?: number
|
|
345
|
+
},
|
|
346
|
+
onto?: string
|
|
347
|
+
): Component
|
|
262
348
|
|
|
263
349
|
/**
|
|
264
350
|
* scene의 컴포넌트를 복제한다.
|
|
@@ -291,7 +377,7 @@ declare module '@hatiolab/things-scene' {
|
|
|
291
377
|
*/
|
|
292
378
|
variable(id: string, value: any): any
|
|
293
379
|
|
|
294
|
-
target: HTMLElement
|
|
380
|
+
target: HTMLElement | null
|
|
295
381
|
scale: SCALE
|
|
296
382
|
translate: TRANSLATE
|
|
297
383
|
|
|
@@ -300,6 +386,8 @@ declare module '@hatiolab/things-scene' {
|
|
|
300
386
|
readonly PPI: number
|
|
301
387
|
readonly DPPX: number
|
|
302
388
|
|
|
389
|
+
mode: SCENE_MODE
|
|
390
|
+
|
|
303
391
|
/**
|
|
304
392
|
* Scene 모델의 단위(unit)을 감안한 기본 Scale 값을 제공한다.
|
|
305
393
|
* 통산 'mm', 'cm' 단위의 Scene은 각 값에 10배를 곱한 수치로 모델링된다.(값을 10으로 나눈값이 실제 단위와 일치한다.)
|
|
@@ -323,6 +411,7 @@ declare module '@hatiolab/things-scene' {
|
|
|
323
411
|
*/
|
|
324
412
|
resize(): void
|
|
325
413
|
|
|
414
|
+
release(): void
|
|
326
415
|
dispose(): void
|
|
327
416
|
|
|
328
417
|
/* Selection Based API - Modeling APIs */
|
|
@@ -348,13 +437,13 @@ declare module '@hatiolab/things-scene' {
|
|
|
348
437
|
* selector에 해당하는 모든 컴포넌트들을 찾는다.
|
|
349
438
|
* @params selector {string}
|
|
350
439
|
*/
|
|
351
|
-
findAll(selector: string): Array<Component>
|
|
440
|
+
findAll(selector: string, component?: Component): Array<Component>
|
|
352
441
|
|
|
353
442
|
/*
|
|
354
443
|
* selector에 해당하는 첫번째 컴포넌트를 찾는다.
|
|
355
444
|
* @params selector {string}
|
|
356
445
|
*/
|
|
357
|
-
findFirst(selector: string): Component
|
|
446
|
+
findFirst(selector: string, ...others: any[]): Component
|
|
358
447
|
|
|
359
448
|
/*
|
|
360
449
|
* id를 갖는 컴포넌트를 찾는다.
|
|
@@ -369,14 +458,34 @@ declare module '@hatiolab/things-scene' {
|
|
|
369
458
|
|
|
370
459
|
on(event: string, listener: Function, context?: any): void
|
|
371
460
|
once(event: string, listener: Function, context?: any): void
|
|
372
|
-
off(event: string, listener
|
|
461
|
+
off(event: string, listener?: Function, context?: any): void
|
|
373
462
|
|
|
374
463
|
toDataURL(): string
|
|
375
464
|
|
|
376
465
|
fit(type: FITMODE): void
|
|
377
466
|
|
|
378
467
|
readonly fitMode: FITMODE
|
|
379
|
-
readonly ids: string[]
|
|
468
|
+
readonly ids: { [id: string]: any }[]
|
|
469
|
+
|
|
470
|
+
copy(): string
|
|
471
|
+
cut(): string
|
|
472
|
+
redo(): void
|
|
473
|
+
undo(): void
|
|
474
|
+
move(component: Component, to_container: Container, to_index: number): void
|
|
475
|
+
|
|
476
|
+
select(selector: string | Function, ...others: (string | Function)[]): Component[]
|
|
477
|
+
paste(clipboard: string): void
|
|
478
|
+
align(type: 'left' | 'right' | 'center' | 'top' | 'bottom' | 'middle' | string): void
|
|
479
|
+
distribute(type: string): void
|
|
480
|
+
symmetryX(): void
|
|
481
|
+
symmetryY(): void
|
|
482
|
+
|
|
483
|
+
group(): void
|
|
484
|
+
ungroup(): void
|
|
485
|
+
|
|
486
|
+
change(f: ChangeFunction): void
|
|
487
|
+
undoableChange(f: () => void): void
|
|
488
|
+
zorder(type: 'forward' | 'backward' | 'front' | string): void
|
|
380
489
|
|
|
381
490
|
data: object
|
|
382
491
|
|