vizcraft 0.2.2 → 1.0.0

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/dist/shapes.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import type { NodeShape, Vec2, VizNode } from './types';
1
+ import type { NodePort, NodeShape, Vec2, VizNode } from './types';
2
2
  export type AnchorMode = 'center' | 'boundary';
3
3
  export interface ShapeBehavior<K extends NodeShape['kind']> {
4
4
  kind: K;
5
- tagName: 'circle' | 'rect' | 'polygon';
5
+ tagName: 'circle' | 'rect' | 'polygon' | 'g' | 'ellipse' | 'path';
6
6
  applyGeometry(el: SVGElement, shape: Extract<NodeShape, {
7
7
  kind: K;
8
8
  }>, pos: Vec2): void;
@@ -14,7 +14,29 @@ export interface ShapeBehavior<K extends NodeShape['kind']> {
14
14
  }>): Vec2;
15
15
  }
16
16
  export declare function effectivePos(node: VizNode): Vec2;
17
- export declare function getShapeBehavior(shape: NodeShape): ShapeBehavior<"circle"> | ShapeBehavior<"rect"> | ShapeBehavior<"diamond">;
17
+ export declare function getShapeBehavior(shape: NodeShape): ShapeBehavior<"circle"> | ShapeBehavior<"rect"> | ShapeBehavior<"diamond"> | ShapeBehavior<"cylinder"> | ShapeBehavior<"hexagon"> | ShapeBehavior<"ellipse"> | ShapeBehavior<"arc"> | ShapeBehavior<"blockArrow"> | ShapeBehavior<"callout"> | ShapeBehavior<"cloud"> | ShapeBehavior<"cross"> | ShapeBehavior<"cube"> | ShapeBehavior<"path"> | ShapeBehavior<"document"> | ShapeBehavior<"note"> | ShapeBehavior<"parallelogram"> | ShapeBehavior<"star"> | ShapeBehavior<"trapezoid"> | ShapeBehavior<"triangle">;
18
18
  export declare function applyShapeGeometry(el: SVGElement, shape: NodeShape, pos: Vec2): void;
19
19
  export declare function shapeSvgMarkup(shape: NodeShape, pos: Vec2, attrs: string): string;
20
20
  export declare function computeNodeAnchor(node: VizNode, target: Vec2, anchor: AnchorMode): Vec2;
21
+ /**
22
+ * Return the default (implicit) ports for a node shape.
23
+ *
24
+ * Every shape provides at least `top`, `right`, `bottom`, `left`.
25
+ * Hexagons also include diagonal vertices.
26
+ * Default ports are **offsets relative to the node center**.
27
+ */
28
+ export declare function getDefaultPorts(shape: NodeShape): NodePort[];
29
+ /**
30
+ * Get the effective ports for a node: explicit `node.ports` if set,
31
+ * otherwise the shape's default ports.
32
+ */
33
+ export declare function getNodePorts(node: VizNode): NodePort[];
34
+ /**
35
+ * Find a port on a node by its id. Returns `undefined` if not found.
36
+ */
37
+ export declare function findPort(node: VizNode, portId: string): NodePort | undefined;
38
+ /**
39
+ * Resolve a port to an absolute position (node center + port offset).
40
+ * Returns `undefined` if the port id is not found.
41
+ */
42
+ export declare function resolvePortPosition(node: VizNode, portId: string): Vec2 | undefined;