@hatiolab/things-scene 2.7.15 → 2.7.16

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hatiolab/things-scene",
3
- "version": "2.7.15",
3
+ "version": "2.7.16",
4
4
  "description": "2D graphic library",
5
5
  "main": "src/index.js",
6
6
  "module": "things-scene.mjs",
package/things-scene.d.ts CHANGED
@@ -13,6 +13,8 @@ declare module '@hatiolab/things-scene' {
13
13
  type TRANSLATE = DIMENSION
14
14
  type POSITION = DIMENSION
15
15
 
16
+ type Properties = { [key: string]: any }
17
+
16
18
  type ControlHandler = {
17
19
  ondragstart?(point: POSITION, index: number, component: Component): void
18
20
  ondragmove?(point: POSITION, index: number, component: Component): void
@@ -86,11 +88,18 @@ declare module '@hatiolab/things-scene' {
86
88
  animOnValueChange(value: number, animFromBase: boolean, base: number): void
87
89
  }
88
90
  } & TBase
91
+ function DataSource<TBase extends Constructor>(
92
+ Base: TBase
93
+ ): {
94
+ new (...args: any[]): {
95
+ isDataSource(): boolean
96
+ }
97
+ } & TBase
89
98
 
90
99
  class Component {
91
100
  static register(type: string, Clazz: typeof Component): void
92
101
 
93
- state: { [key: string]: any }
102
+ state: Properties
94
103
  bounds: { top: number; left: number; width: number; height: number }
95
104
  root: RootContainer
96
105
  parent: Container
@@ -105,9 +114,15 @@ declare module '@hatiolab/things-scene' {
105
114
 
106
115
  ready(): void
107
116
  dispose(): void
108
- setState(state: any): void
109
- get(state: string): any
117
+ getState(prop: string): any
118
+ setState(props: Properties | any, value?: any): void
119
+ get(prop: string): any
120
+ set(props: Properties | string, value?: any): void
110
121
  reposition(): void
122
+ transcoordP2S(x: number, y: number): POSITION
123
+ render(context: CanvasRenderingContext2D): void
124
+
125
+ onchange(after: Properties, before: Properties): void
111
126
 
112
127
  drawImage(
113
128
  context: CanvasRenderingContext2D,
@@ -133,8 +148,11 @@ declare module '@hatiolab/things-scene' {
133
148
 
134
149
  class Shape extends Component {}
135
150
  class Ellipse extends Shape {}
151
+ class Rect extends RectPath(Shape) {}
136
152
  class HTMLOverlayElement extends Component {
137
153
  element: HTMLElement
154
+
155
+ createElement(): void
138
156
  }
139
157
 
140
158
  class HTMLOverlayContainer extends Container {