@hatiolab/things-scene 2.7.25 → 2.7.29
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 +6 -26
- package/logs/application-2021-12-17-00.log +4 -0
- package/logs/connections-2021-12-11-15.log +32 -0
- package/logs/connections-2021-12-17-00.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 +114 -20
- 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'
|
|
@@ -18,22 +25,54 @@ declare module '@hatiolab/things-scene' {
|
|
|
18
25
|
type TRANSLATE = DIMENSION
|
|
19
26
|
type POSITION = DIMENSION
|
|
20
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
|
+
}
|
|
21
51
|
|
|
22
|
-
|
|
52
|
+
interface LAYOUT {
|
|
23
53
|
reflow: (container: Container) => void
|
|
24
|
-
capturables?: (container: Container) =>
|
|
25
|
-
drawables?: (container: Container) =>
|
|
54
|
+
capturables?: (container: Container) => Component[]
|
|
55
|
+
drawables?: (container: Container) => Component[]
|
|
26
56
|
isStuck?: (component: Container) => boolean
|
|
27
|
-
keyNavigate?: (container: Container, component: Component, e: KeyboardEvent) => Component
|
|
57
|
+
keyNavigate?: (container: Container, component: Component, e: KeyboardEvent) => Component | undefined
|
|
28
58
|
joinType?: boolean
|
|
29
59
|
}
|
|
30
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
|
+
|
|
31
70
|
const AbsoluteLayout: LAYOUT & { ABSOLUTE: boolean }
|
|
32
71
|
const TableLayout: LAYOUT
|
|
33
72
|
const CardLayout: LAYOUT
|
|
34
73
|
const HTMLAbsoluteLayout: LAYOUT
|
|
35
|
-
const
|
|
36
|
-
const
|
|
74
|
+
const LinearHorizontalLayout: LAYOUT
|
|
75
|
+
const LinearVerticalLayout: LAYOUT
|
|
37
76
|
|
|
38
77
|
type AnimationConfig = {
|
|
39
78
|
duration?: number
|
|
@@ -94,13 +133,14 @@ declare module '@hatiolab/things-scene' {
|
|
|
94
133
|
class Model {
|
|
95
134
|
static compile(model: Model, context?: any): Component
|
|
96
135
|
|
|
97
|
-
type
|
|
136
|
+
type?: string;
|
|
98
137
|
[key: string]: any
|
|
99
138
|
}
|
|
100
139
|
|
|
101
140
|
class ApplicationContext {
|
|
102
141
|
readonly refProvider: any
|
|
103
142
|
readonly isViewMode: boolean
|
|
143
|
+
readonly isEditMode: boolean
|
|
104
144
|
|
|
105
145
|
mode: SCENE_MODE
|
|
106
146
|
baseUrl: string
|
|
@@ -153,7 +193,7 @@ declare module '@hatiolab/things-scene' {
|
|
|
153
193
|
on(name: string, callback: Function, context?: any): void
|
|
154
194
|
off(name: string, callback: Function, context?: any): void
|
|
155
195
|
once(name: string, callback: Function, context?: any): void
|
|
156
|
-
trigger(name: string): void
|
|
196
|
+
trigger(name: string, ...others: any[]): void
|
|
157
197
|
}
|
|
158
198
|
} & TBase
|
|
159
199
|
|
|
@@ -162,9 +202,11 @@ declare module '@hatiolab/things-scene' {
|
|
|
162
202
|
class Component extends MixinEvent(Object) {
|
|
163
203
|
static register(type: string, Clazz: typeof Component): void
|
|
164
204
|
static memoize(base: any, property: string, needClone: boolean): void
|
|
205
|
+
static drawStroke(context: CanvasRenderingContext2D, style: Style): void
|
|
165
206
|
|
|
166
207
|
state: Properties
|
|
167
|
-
bounds:
|
|
208
|
+
bounds: BOUNDS
|
|
209
|
+
textBounds: BOUNDS
|
|
168
210
|
root: RootContainer
|
|
169
211
|
rootModel: ModelLayer
|
|
170
212
|
parent: Container
|
|
@@ -173,6 +215,9 @@ declare module '@hatiolab/things-scene' {
|
|
|
173
215
|
hierarchy: Model
|
|
174
216
|
path: Array<DIMENSION>
|
|
175
217
|
anchors: Array<Anchor>
|
|
218
|
+
hidden: boolean
|
|
219
|
+
|
|
220
|
+
get nature(): ComponentNature
|
|
176
221
|
|
|
177
222
|
get data(): any
|
|
178
223
|
set data(data: any)
|
|
@@ -183,6 +228,12 @@ declare module '@hatiolab/things-scene' {
|
|
|
183
228
|
get controls(): Array<Control> | undefined
|
|
184
229
|
get hasTextProperty(): boolean
|
|
185
230
|
|
|
231
|
+
isRootModel(): boolean
|
|
232
|
+
isContainer(): boolean
|
|
233
|
+
isLine(): boolean
|
|
234
|
+
isLayer(): boolean
|
|
235
|
+
is3dish(): boolean
|
|
236
|
+
|
|
186
237
|
ready(): void
|
|
187
238
|
dispose(): void
|
|
188
239
|
getState(prop: string): any
|
|
@@ -191,6 +242,7 @@ declare module '@hatiolab/things-scene' {
|
|
|
191
242
|
contains(x: number, y: number): boolean
|
|
192
243
|
set(props: Properties | string, value?: any): void
|
|
193
244
|
reposition(): void
|
|
245
|
+
clearCache(): void
|
|
194
246
|
|
|
195
247
|
transcoordP2S(x: number, y: number): POSITION
|
|
196
248
|
transcoordC2S(x: number, y: number, top?: RootContainer): POSITION
|
|
@@ -229,7 +281,10 @@ declare module '@hatiolab/things-scene' {
|
|
|
229
281
|
addComponent(target: Component): void
|
|
230
282
|
removeComponent(target: Component): void
|
|
231
283
|
insertComponentAt(target: Component, idx: number): void
|
|
232
|
-
findById(id: string): Component
|
|
284
|
+
findById(id: string): Component | undefined
|
|
285
|
+
getAt(at: number): Component | undefined
|
|
286
|
+
|
|
287
|
+
reflow(): void
|
|
233
288
|
|
|
234
289
|
add(components: Component[] | Component): Container
|
|
235
290
|
remove(components: Component[] | Component): Container
|
|
@@ -237,11 +292,14 @@ declare module '@hatiolab/things-scene' {
|
|
|
237
292
|
components: Component[]
|
|
238
293
|
}
|
|
239
294
|
class Container extends MixinHTMLElement(ContainerAbstract) {}
|
|
240
|
-
class RootContainer extends Container {
|
|
295
|
+
class RootContainer extends Container {
|
|
296
|
+
get selected(): Component[]
|
|
297
|
+
set selected(selected: Component[])
|
|
298
|
+
}
|
|
241
299
|
|
|
242
300
|
class Layer extends ContainerAbstract {
|
|
243
|
-
target: HTMLElement
|
|
244
|
-
canvas: HTMLCanvasElement
|
|
301
|
+
target: HTMLElement | null
|
|
302
|
+
canvas: HTMLCanvasElement | null
|
|
245
303
|
|
|
246
304
|
getContext(): CanvasRenderingContext2D
|
|
247
305
|
}
|
|
@@ -273,7 +331,20 @@ declare module '@hatiolab/things-scene' {
|
|
|
273
331
|
* @param boundsOrOffset {object} - x, y, cx, cy, ...
|
|
274
332
|
* @param onto {string} - onto
|
|
275
333
|
*/
|
|
276
|
-
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
|
|
277
348
|
|
|
278
349
|
/**
|
|
279
350
|
* scene의 컴포넌트를 복제한다.
|
|
@@ -306,7 +377,7 @@ declare module '@hatiolab/things-scene' {
|
|
|
306
377
|
*/
|
|
307
378
|
variable(id: string, value: any): any
|
|
308
379
|
|
|
309
|
-
target: HTMLElement
|
|
380
|
+
target: HTMLElement | null
|
|
310
381
|
scale: SCALE
|
|
311
382
|
translate: TRANSLATE
|
|
312
383
|
|
|
@@ -315,6 +386,8 @@ declare module '@hatiolab/things-scene' {
|
|
|
315
386
|
readonly PPI: number
|
|
316
387
|
readonly DPPX: number
|
|
317
388
|
|
|
389
|
+
mode: SCENE_MODE
|
|
390
|
+
|
|
318
391
|
/**
|
|
319
392
|
* Scene 모델의 단위(unit)을 감안한 기본 Scale 값을 제공한다.
|
|
320
393
|
* 통산 'mm', 'cm' 단위의 Scene은 각 값에 10배를 곱한 수치로 모델링된다.(값을 10으로 나눈값이 실제 단위와 일치한다.)
|
|
@@ -338,6 +411,7 @@ declare module '@hatiolab/things-scene' {
|
|
|
338
411
|
*/
|
|
339
412
|
resize(): void
|
|
340
413
|
|
|
414
|
+
release(): void
|
|
341
415
|
dispose(): void
|
|
342
416
|
|
|
343
417
|
/* Selection Based API - Modeling APIs */
|
|
@@ -363,13 +437,13 @@ declare module '@hatiolab/things-scene' {
|
|
|
363
437
|
* selector에 해당하는 모든 컴포넌트들을 찾는다.
|
|
364
438
|
* @params selector {string}
|
|
365
439
|
*/
|
|
366
|
-
findAll(selector: string): Array<Component>
|
|
440
|
+
findAll(selector: string, component?: Component): Array<Component>
|
|
367
441
|
|
|
368
442
|
/*
|
|
369
443
|
* selector에 해당하는 첫번째 컴포넌트를 찾는다.
|
|
370
444
|
* @params selector {string}
|
|
371
445
|
*/
|
|
372
|
-
findFirst(selector: string): Component
|
|
446
|
+
findFirst(selector: string, ...others: any[]): Component
|
|
373
447
|
|
|
374
448
|
/*
|
|
375
449
|
* id를 갖는 컴포넌트를 찾는다.
|
|
@@ -384,14 +458,34 @@ declare module '@hatiolab/things-scene' {
|
|
|
384
458
|
|
|
385
459
|
on(event: string, listener: Function, context?: any): void
|
|
386
460
|
once(event: string, listener: Function, context?: any): void
|
|
387
|
-
off(event: string, listener
|
|
461
|
+
off(event: string, listener?: Function, context?: any): void
|
|
388
462
|
|
|
389
463
|
toDataURL(): string
|
|
390
464
|
|
|
391
465
|
fit(type: FITMODE): void
|
|
392
466
|
|
|
393
467
|
readonly fitMode: FITMODE
|
|
394
|
-
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
|
|
395
489
|
|
|
396
490
|
data: object
|
|
397
491
|
|