@hatiolab/things-scene 3.0.30 → 3.0.32

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/things-scene.d.ts CHANGED
@@ -1,3 +1,5 @@
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 }
@@ -155,24 +157,31 @@ declare module '@hatiolab/things-scene' {
155
157
  static load(scripts: string | Array<string>, styles?: string | Array<string>): Promise<void>
156
158
  }
157
159
 
158
- class Anchor {
159
- constructor({ component, anchor, position }: { component: Component; anchor: string; position: POSITION })
160
-
161
- component?: Component
160
+ type Anchor = {
162
161
  name: string
163
162
  position: POSITION
164
163
  bounds?: BOUNDS
165
- type?: 'in' | 'out' | 'inout'
164
+ inout?: 'in' | 'out' | 'inout'
165
+ type?: string
166
166
  multiplicity?: boolean
167
- draw?: (context: CanvasRenderingContext2D, component: Component) => void
167
+ draw?: (this: Anchor, context: CanvasRenderingContext2D, component: Component) => void
168
+ filter?: (this: Anchor, linkEnd?: LinkEnd) => boolean
169
+ template?: any
170
+ [prop: string]: any
168
171
  }
169
172
 
170
- class LinkEnd {
173
+ type LinkEndConfig = {
171
174
  component: string /** end component refid */
172
175
  anchor: string /** end anchor name of end component */
173
176
  position: POSITION /** position of the link end */
174
177
  }
175
178
 
179
+ class LinkEnd {
180
+ component: Component
181
+ anchor: Anchor
182
+ position: POSITION
183
+ }
184
+
176
185
  class Model {
177
186
  static compile(model: Model, context?: any): Component
178
187
 
@@ -391,10 +400,10 @@ declare module '@hatiolab/things-scene' {
391
400
  class Ellipse extends Shape {}
392
401
  class Polygon extends Shape {}
393
402
  class Line extends Component {
394
- get fromAnchor(): Anchor | undefined
395
- get toAnchor(): Anchor | undefined
396
- get from(): LinkEnd
397
- get to(): LinkEnd
403
+ get fromEnd(): LinkEnd | undefined
404
+ get toEnd(): LinkEnd | undefined
405
+ get from(): LinkEndConfig
406
+ get to(): LinkEndConfig
398
407
  }
399
408
  class OrthoLine extends Line {}
400
409
  class Donut extends Ellipse {}