@hatiolab/things-scene 2.7.13 → 2.7.17

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 (186) hide show
  1. package/db.sqlite +0 -0
  2. package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +8 -3
  3. package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +3 -23
  4. package/logs/application-2021-11-30-22.log +4 -0
  5. package/logs/application-2021-11-30-23.log +1 -0
  6. package/logs/connections-2021-11-30-22.log +32 -0
  7. package/package.json +6 -6
  8. package/things-scene-ie.js +1 -1
  9. package/things-scene-min.js +1 -1
  10. package/things-scene.d.ts +361 -0
  11. package/things-scene.mjs +1 -1
  12. package/logs/application-2021-11-15-23.log +0 -4
  13. package/logs/connections-2021-11-08-22.log +0 -32
  14. package/logs/connections-2021-11-09-19.log +0 -32
  15. package/logs/connections-2021-11-10-23.log +0 -32
  16. package/logs/connections-2021-11-13-21.log +0 -32
  17. package/logs/connections-2021-11-15-23.log +0 -32
  18. package/types/animation/animate.d.ts +0 -4
  19. package/types/animation/animations/animation.d.ts +0 -14
  20. package/types/animation/animations/fade.d.ts +0 -4
  21. package/types/animation/animations/heartbeat.d.ts +0 -4
  22. package/types/animation/animations/moving.d.ts +0 -4
  23. package/types/animation/animations/outline.d.ts +0 -10
  24. package/types/animation/animations/rotation.d.ts +0 -4
  25. package/types/animation/animations/vibration.d.ts +0 -4
  26. package/types/animation/compile.d.ts +0 -1
  27. package/types/animation/delta.d.ts +0 -19
  28. package/types/animation/index.d.ts +0 -1
  29. package/types/command/command-change.d.ts +0 -7
  30. package/types/command/command-migrate.d.ts +0 -4
  31. package/types/command/command.d.ts +0 -5
  32. package/types/command/snapshot-commander.d.ts +0 -15
  33. package/types/components/audio.d.ts +0 -44
  34. package/types/components/cloud.d.ts +0 -3
  35. package/types/components/component.d.ts +0 -213
  36. package/types/components/container-abstract.d.ts +0 -48
  37. package/types/components/container.d.ts +0 -37
  38. package/types/components/data/data-mapping.d.ts +0 -15
  39. package/types/components/data/data.d.ts +0 -8
  40. package/types/components/data/evaluator.d.ts +0 -1
  41. package/types/components/donut.d.ts +0 -3
  42. package/types/components/drawer/draw-image-pendable.d.ts +0 -1
  43. package/types/components/drawer/effect.d.ts +0 -1
  44. package/types/components/drawer/fill.d.ts +0 -14
  45. package/types/components/drawer/format.d.ts +0 -1
  46. package/types/components/drawer/line.d.ts +0 -3
  47. package/types/components/drawer/stroke.d.ts +0 -1
  48. package/types/components/drawer/text-wrapper.d.ts +0 -10
  49. package/types/components/drawer/text.d.ts +0 -3
  50. package/types/components/ellipse.d.ts +0 -3
  51. package/types/components/file/ondropfile.d.ts +0 -1
  52. package/types/components/fit/fit.d.ts +0 -15
  53. package/types/components/geometry/transcoord.d.ts +0 -37
  54. package/types/components/geometry/union.d.ts +0 -6
  55. package/types/components/gif/super-gif.d.ts +0 -18
  56. package/types/components/gif-view.d.ts +0 -25
  57. package/types/components/global-ref.d.ts +0 -34
  58. package/types/components/group.d.ts +0 -15
  59. package/types/components/html/elements.d.ts +0 -2
  60. package/types/components/html/fill.d.ts +0 -1
  61. package/types/components/html/reposition.d.ts +0 -1
  62. package/types/components/html/shadow.d.ts +0 -1
  63. package/types/components/html-overlay-container.d.ts +0 -27
  64. package/types/components/html-overlay-element.d.ts +0 -25
  65. package/types/components/image-view.d.ts +0 -66
  66. package/types/components/index.d.ts +0 -31
  67. package/types/components/info-window.d.ts +0 -40
  68. package/types/components/line.d.ts +0 -16
  69. package/types/components/local-ref.d.ts +0 -46
  70. package/types/components/mixins/data-source.d.ts +0 -9
  71. package/types/components/mixins/html-element.d.ts +0 -23
  72. package/types/components/mixins/move-handle.d.ts +0 -11
  73. package/types/components/mixins/rect-path.d.ts +0 -12
  74. package/types/components/mixins/value-holder.d.ts +0 -18
  75. package/types/components/mutater/bounds.d.ts +0 -10
  76. package/types/components/mutater/path.d.ts +0 -5
  77. package/types/components/outline/ellipse-outline.d.ts +0 -1
  78. package/types/components/outline/path-outline.d.ts +0 -1
  79. package/types/components/path.d.ts +0 -3
  80. package/types/components/polygon.d.ts +0 -4
  81. package/types/components/polyline.d.ts +0 -4
  82. package/types/components/popup.d.ts +0 -47
  83. package/types/components/rect.d.ts +0 -35
  84. package/types/components/retention/retention-manager.d.ts +0 -8
  85. package/types/components/root-container.d.ts +0 -76
  86. package/types/components/ruler.d.ts +0 -15
  87. package/types/components/shape.d.ts +0 -22
  88. package/types/components/star.d.ts +0 -3
  89. package/types/components/text/substitutor.d.ts +0 -3
  90. package/types/components/text.d.ts +0 -15
  91. package/types/components/triangle.d.ts +0 -3
  92. package/types/components/variable.d.ts +0 -24
  93. package/types/const.d.ts +0 -31
  94. package/types/core/collection.d.ts +0 -8
  95. package/types/core/debug.d.ts +0 -1
  96. package/types/core/deep-equals.d.ts +0 -1
  97. package/types/core/dom-to-image.d.ts +0 -127
  98. package/types/core/event.d.ts +0 -181
  99. package/types/core/index.d.ts +0 -2
  100. package/types/core/list.d.ts +0 -32
  101. package/types/core/logger.d.ts +0 -3
  102. package/types/core/memoize.d.ts +0 -6
  103. package/types/core/mixin.d.ts +0 -1
  104. package/types/core/obj-accessor.d.ts +0 -1
  105. package/types/core/reference-map.d.ts +0 -14
  106. package/types/core/script-loader.d.ts +0 -3
  107. package/types/core/snapshot-taker.d.ts +0 -12
  108. package/types/core/stack.d.ts +0 -2
  109. package/types/core/timecapsule.d.ts +0 -18
  110. package/types/core/utils.d.ts +0 -4
  111. package/types/effect/gradation.d.ts +0 -1
  112. package/types/effect/index.d.ts +0 -1
  113. package/types/effect/shadow.d.ts +0 -2
  114. package/types/effect/turn.d.ts +0 -1
  115. package/types/event/event-engine.d.ts +0 -12
  116. package/types/event/event-pump.d.ts +0 -11
  117. package/types/event/event-tracker.d.ts +0 -21
  118. package/types/event/index.d.ts +0 -2
  119. package/types/event/ua-event-handler.d.ts +0 -32
  120. package/types/event-map/event-map.d.ts +0 -9
  121. package/types/event-map/index.d.ts +0 -1
  122. package/types/event-map/move-handler.d.ts +0 -1
  123. package/types/event-map/text-editor-lite.d.ts +0 -1
  124. package/types/index.d.ts +0 -1
  125. package/types/layer/action/emphasize.d.ts +0 -2
  126. package/types/layer/action/popup.d.ts +0 -2
  127. package/types/layer/action/pressed.d.ts +0 -2
  128. package/types/layer/guide-layer.d.ts +0 -44
  129. package/types/layer/index.d.ts +0 -6
  130. package/types/layer/layer.d.ts +0 -29
  131. package/types/layer/model-layer.d.ts +0 -39
  132. package/types/layer/modeler/control-handler.d.ts +0 -18
  133. package/types/layer/modeler/focus-outline.d.ts +0 -5
  134. package/types/layer/modeler/group-outline.d.ts +0 -5
  135. package/types/layer/modeler/index.d.ts +0 -6
  136. package/types/layer/modeler/path-handler.d.ts +0 -17
  137. package/types/layer/modeler/resizer.d.ts +0 -16
  138. package/types/layer/modeler/rotator.d.ts +0 -15
  139. package/types/layer/modeling-layer.d.ts +0 -47
  140. package/types/layer/selection-layer.d.ts +0 -42
  141. package/types/layer/shift-layer.d.ts +0 -18
  142. package/types/layer/tag-layer.d.ts +0 -28
  143. package/types/layout/absolute.d.ts +0 -8
  144. package/types/layout/card.d.ts +0 -7
  145. package/types/layout/html-absolute.d.ts +0 -8
  146. package/types/layout/index.d.ts +0 -7
  147. package/types/layout/layout.d.ts +0 -11
  148. package/types/layout/linear-horizontal.d.ts +0 -7
  149. package/types/layout/linear-vertical.d.ts +0 -7
  150. package/types/layout/table.d.ts +0 -9
  151. package/types/license/license.d.ts +0 -18
  152. package/types/link/arrow_straight.d.ts +0 -3
  153. package/types/link/curve.d.ts +0 -3
  154. package/types/link/index.d.ts +0 -4
  155. package/types/link/link.d.ts +0 -7
  156. package/types/link/right_angle_straight.d.ts +0 -3
  157. package/types/link/straight.d.ts +0 -3
  158. package/types/model/compile.d.ts +0 -1
  159. package/types/model/duplicate.d.ts +0 -1
  160. package/types/model/index.d.ts +0 -3
  161. package/types/model/selector.d.ts +0 -2
  162. package/types/style/compile.d.ts +0 -1
  163. package/types/style/index.d.ts +0 -1
  164. package/types/things-scene/api/add.d.ts +0 -5
  165. package/types/things-scene/api/align.d.ts +0 -1
  166. package/types/things-scene/api/change.d.ts +0 -2
  167. package/types/things-scene/api/clipboard.d.ts +0 -3
  168. package/types/things-scene/api/distribute.d.ts +0 -1
  169. package/types/things-scene/api/duplicate.d.ts +0 -4
  170. package/types/things-scene/api/fullscreen.d.ts +0 -1
  171. package/types/things-scene/api/group.d.ts +0 -8
  172. package/types/things-scene/api/index.d.ts +0 -14
  173. package/types/things-scene/api/listener.d.ts +0 -3
  174. package/types/things-scene/api/remove.d.ts +0 -4
  175. package/types/things-scene/api/symmetry.d.ts +0 -2
  176. package/types/things-scene/api/to-data-url.d.ts +0 -1
  177. package/types/things-scene/api/variables.d.ts +0 -13
  178. package/types/things-scene/api/zorder.d.ts +0 -2
  179. package/types/things-scene/application-context.d.ts +0 -33
  180. package/types/things-scene/config.d.ts +0 -4
  181. package/types/things-scene/create.d.ts +0 -12
  182. package/types/things-scene/fps.d.ts +0 -1
  183. package/types/things-scene/index.d.ts +0 -16
  184. package/types/things-scene/polyfill.d.ts +0 -2
  185. package/types/things-scene/scene.d.ts +0 -146
  186. package/types/things-scene/version.d.ts +0 -2
@@ -0,0 +1,361 @@
1
+ declare module '@hatiolab/things-scene' {
2
+ type Constructor<T = {}> = new (...args: any[]) => T
3
+
4
+ enum SCENE_MODE {
5
+ MODE_VIEW = 0,
6
+ MODE_EDIT = 1,
7
+ MODE_SHIFT = 2
8
+ }
9
+
10
+ type FITMODE = 'both' | 'ratio' | 'width' | 'height' | 'center' | 'none'
11
+ type DIMENSION = { x: number; y: number }
12
+ type SCALE = DIMENSION
13
+ type TRANSLATE = DIMENSION
14
+ type POSITION = DIMENSION
15
+
16
+ type Properties = { [key: string]: any }
17
+
18
+ type ControlHandler = {
19
+ ondragstart?(point: POSITION, index: number, component: Component): void
20
+ ondragmove?(point: POSITION, index: number, component: Component): void
21
+ ondragend?(point: POSITION, index: number, component: Component): void
22
+ }
23
+
24
+ interface Control extends DIMENSION {
25
+ handler: ControlHandler
26
+ }
27
+
28
+ function create({
29
+ target,
30
+ model,
31
+ style,
32
+ layers,
33
+ handlers,
34
+ mode,
35
+ refProvider,
36
+ baseUrl,
37
+ fitMode
38
+ }: {
39
+ target?: HTMLElement
40
+ model: Object
41
+ style?: any
42
+ layers?: Array<any>
43
+ handlers?: Array<any>
44
+ mode?: SCENE_MODE
45
+ refProvider?: any
46
+ baseUrl?: string | undefined
47
+ fitMode?: FITMODE
48
+ }): Scene
49
+
50
+ function error(...args: any[]): void
51
+ function warn(...args: any[]): void
52
+ function debug(...args: any[]): void
53
+
54
+ class ScriptLoader {
55
+ static load(scripts: string | Array<string>, styles?: string | Array<string>): Promise<void>
56
+ }
57
+
58
+ class Anchor {
59
+ constructor({ component, anchor, position }: { component: Component; anchor: string; position: POSITION })
60
+
61
+ position: POSITION
62
+ }
63
+
64
+ class Model {
65
+ static compile(model: Model, context: any): Component
66
+
67
+ type: string;
68
+ [key: string]: any
69
+ }
70
+
71
+ class ApplicationContext {
72
+ readonly refProvider: any
73
+ readonly isViewMode: boolean
74
+
75
+ mode: SCENE_MODE
76
+ baseUrl: string
77
+
78
+ dispose(): void
79
+ }
80
+
81
+ /* mixins */
82
+
83
+ function RectPath<TBase extends Constructor>(Base: TBase): TBase
84
+
85
+ function ValueHolder<TBase extends Constructor>(
86
+ Base: TBase
87
+ ): {
88
+ new (...args: any[]): {
89
+ value: number
90
+ animValue: number
91
+ animOnValueChange(value: number, animFromBase: boolean, base: number): void
92
+ }
93
+ } & TBase
94
+
95
+ function DataSource<TBase extends Constructor>(
96
+ Base: TBase
97
+ ): {
98
+ new (...args: any[]): {
99
+ isDataSource(): boolean
100
+ }
101
+ } & TBase
102
+
103
+ function MoveHandle<TBase extends Constructor>(Base: TBase): TBase
104
+
105
+ function MixinHTMLElement<TBase extends Constructor>(
106
+ Base: TBase
107
+ ): {
108
+ new (...args: any[]): {
109
+ get tagName(): string
110
+ element: HTMLElement
111
+
112
+ createElement(): void
113
+ userInputEventHandler(e: Event): void
114
+ reposition(): void
115
+ disposeElement(): void
116
+ }
117
+ } & TBase
118
+
119
+ function MixinEvent<TBase extends Constructor>(
120
+ Base: TBase
121
+ ): {
122
+ new (...args: any[]): {
123
+ on(name: string, callback: Function, context?: any): void
124
+ off(name: string, callback: Function, context?: any): void
125
+ once(name: string, callback: Function, context?: any): void
126
+ trigger(name: string): void
127
+ }
128
+ } & TBase
129
+
130
+ /* components */
131
+
132
+ class Component extends MixinEvent(Object) {
133
+ static register(type: string, Clazz: typeof Component): void
134
+
135
+ state: Properties
136
+ bounds: { top: number; left: number; width: number; height: number }
137
+ root: RootContainer
138
+ rootModel: ModelLayer
139
+ parent: Container
140
+ app: ApplicationContext /* application context */
141
+ model: Model
142
+ hierarchy: Model
143
+ path: Array<DIMENSION>
144
+ anchors: Array<Anchor>
145
+ data: any
146
+
147
+ get controls(): Array<Control> | undefined
148
+ get hasTextProperty(): boolean
149
+
150
+ ready(): void
151
+ dispose(): void
152
+ getState(prop: string): any
153
+ setState(props: Properties | any, value?: any): void
154
+ get(prop: string): any
155
+ set(props: Properties | string, value?: any): void
156
+ reposition(): void
157
+ transcoordP2S(x: number, y: number): POSITION
158
+ render(context: CanvasRenderingContext2D): void
159
+ executeMappings(force?: boolean): void
160
+
161
+ onchange(after: Properties, before: Properties): void
162
+
163
+ drawImage(
164
+ context: CanvasRenderingContext2D,
165
+ image: HTMLImageElement,
166
+ left: number,
167
+ top: number,
168
+ width: number,
169
+ height: number
170
+ ): void
171
+ drawStroke(context: CanvasRenderingContext2D): void
172
+ drawFill(context: CanvasRenderingContext2D): void
173
+ drawText(context: CanvasRenderingContext2D): void
174
+
175
+ ondblclick(e: MouseEvent): void
176
+ }
177
+
178
+ class ContainerAbstract extends MoveHandle(RectPath(Component)) {}
179
+ class Container extends MixinHTMLElement(ContainerAbstract) {
180
+ indexOf(component: Component): number
181
+ insertComponentAt(target: Component, idx: number): void
182
+ findById(id: string): Component
183
+ }
184
+ class RootContainer extends Container {}
185
+
186
+ class Layer extends ContainerAbstract {
187
+ target: HTMLElement
188
+ canvas: HTMLCanvasElement
189
+
190
+ getContext(): CanvasRenderingContext2D
191
+ invalidate(): void
192
+ }
193
+
194
+ class ModelLayer extends Layer {
195
+ overlay: HTMLDivElement
196
+ }
197
+
198
+ class Shape extends Component {}
199
+ class Ellipse extends Shape {}
200
+ class Rect extends RectPath(Shape) {}
201
+ class HTMLOverlayElement extends MixinHTMLElement(RectPath(Component)) {}
202
+
203
+ class HTMLOverlayContainer extends Container {
204
+ readonly layout: any
205
+ }
206
+
207
+ /* Scene API */
208
+
209
+ class Scene {
210
+ static readonly residents: WeakSet<Scene>
211
+
212
+ /**
213
+ * scene에 컴포넌트를 추가한다.
214
+ * @param models {object} - Component Model Object
215
+ * @param boundsOrOffset {object} - x, y, cx, cy, ...
216
+ * @param onto {string} - onto
217
+ */
218
+ add({ models, boundsOrOffset, onto }: { models: object; boundsOrOffset: object; onto: string }): Component
219
+
220
+ /**
221
+ * scene의 컴포넌트를 복제한다.
222
+ * 현재 선택되어있는 컴포넌트가 복제되므로, 컴포넌트를 복제하기 위해서는
223
+ * 먼저 복제하고자하는 컴포넌트를 선택된 상태로 만든 후에(참조. {@link select} 메쏘드) 이 메쏘드를 호출한다.
224
+ */
225
+ duplicate(): void
226
+
227
+ /**
228
+ * scene의 컴포넌트를 삭제한다.
229
+ * 현재 선택되어있는 컴포넌트가 삭제되므로, 컴포넌트를 삭제하기 위해서는
230
+ * 먼저 삭제하고자하는 컴포넌트를 선택된 상태로 만든 후에(참조. {@link select} 메쏘드) 이 메쏘드를 호출한다.
231
+ */
232
+ remove(): void
233
+
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
+ }): {
251
+ start: Function /* start function */
252
+ stop: Function /* stop function */
253
+ }
254
+
255
+ /**
256
+ * scene이 그려지고 있는 컨테이너를 전체화면 모드에서 표시되도록 한다.
257
+ */
258
+ fullscreen(): void
259
+
260
+ /**
261
+ * 파라미터로 주어지는 id를 가진 컴포넌트의 data 값을 변경한다.
262
+ * @param id {string} - component id
263
+ * @param value {any} - data value
264
+ */
265
+ variable(id: string, value: any): any
266
+
267
+ target: HTMLElement
268
+ scale: SCALE
269
+ translate: TRANSLATE
270
+
271
+ readonly unit: string /* 'px' */
272
+ readonly PPM: number
273
+ readonly PPI: number
274
+ readonly DPPX: number
275
+
276
+ /**
277
+ * Scene 모델의 단위(unit)을 감안한 기본 Scale 값을 제공한다.
278
+ * 통산 'mm', 'cm' 단위의 Scene은 각 값에 10배를 곱한 수치로 모델링된다.(값을 10으로 나눈값이 실제 단위와 일치한다.)
279
+ * unitScale의 의미는 scene에 unitScale값으로 scale하면, 각 단위값이 화면과 일치한다는 의미이다.
280
+ *
281
+ * 모델링의 수치단위가 픽셀이 아니고, mm, cm, inch 등의 단위인 경우에,
282
+ * 화면에서의 크기가 실물과 유사하게 보이는 수준의 기본 스케일을 제공하는 기능이다.
283
+ * 이 값은 내부적으로는, Ruler에서 눈금을 실제 자의 눈금과 일치시키기 위해서 사용한다.
284
+ */
285
+ readonly unitScale: string
286
+
287
+ /**
288
+ * scene이 그려질 모니터 화면의 크기정보 (inch)
289
+ * 예시) 17, 20, 24, 27, 30, ...
290
+ * @type {number}
291
+ */
292
+ screen: number
293
+
294
+ /**
295
+ * 컨테이너의 크기에 맞게 크기를 조정한다.
296
+ */
297
+ resize(): void
298
+
299
+ dispose(): void
300
+
301
+ /* Selection Based API - Modeling APIs */
302
+
303
+ /**
304
+ * scene 내에서 선택된 컴포넌트의 리스트
305
+ * @type {object-array}
306
+ */
307
+ selected: Array<Component>
308
+
309
+ /**
310
+ * scene이 그리고 있는 컴포넌트 모델정보
311
+ * @type {object}
312
+ */
313
+ model: Component
314
+
315
+ /*
316
+ * root는 모델의 최상위 컨테이너인 모델레이어를 의미한다.
317
+ */
318
+ readonly root: Container
319
+
320
+ /*
321
+ * selector에 해당하는 모든 컴포넌트들을 찾는다.
322
+ * @params selector {string}
323
+ */
324
+ findAll(selector: string): Array<Component>
325
+
326
+ /*
327
+ * selector에 해당하는 첫번째 컴포넌트를 찾는다.
328
+ * @params selector {string}
329
+ */
330
+ findFirst(selector: string): Component
331
+
332
+ /*
333
+ * id를 갖는 컴포넌트를 찾는다.
334
+ * @params id {string}
335
+ */
336
+ findById(id: string): Component
337
+
338
+ /*
339
+ * scene이 그리는 모델 오브젝트를 JSON 텍스트로 리턴한다.
340
+ */
341
+ serialize(): string
342
+
343
+ on(event: string, listener: Function, context?: any): void
344
+ once(event: string, listener: Function, context?: any): void
345
+ off(event: string, listener: Function, context?: any): void
346
+
347
+ toDataURL(): string
348
+
349
+ fit(type: FITMODE): void
350
+
351
+ readonly fitMode: FITMODE
352
+ readonly ids: string[]
353
+
354
+ data: object
355
+
356
+ // @deprecated
357
+ variables: object
358
+
359
+ baseUrl: string
360
+ }
361
+ }