@xui/node-graph 2.0.0-alpha.19 → 2.0.0-alpha.21

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.
@@ -752,9 +752,12 @@ class XuiGraphControls {
752
752
  step = this.config.zoomStep;
753
753
  buttonClass = 'text-foreground-muted hover:bg-hover-overlay hover:text-foreground focus-visible:ring-focus flex h-7 w-7 ' +
754
754
  'cursor-pointer items-center justify-center rounded transition-colors focus-visible:ring-2 focus-visible:outline-none';
755
+ /** Extra classes, merged into the component's own rather than replacing them. */
755
756
  class = input('', /* @ts-ignore */
756
757
  ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
758
+ /** Show the fit-to-view button. */
757
759
  showFit = input(true, { ...(ngDevMode ? { debugName: "showFit" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
760
+ /** Show the current zoom as a percentage between the zoom buttons. */
758
761
  showZoomLevel = input(true, { ...(ngDevMode ? { debugName: "showZoomLevel" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
759
762
  /** Lay the buttons out in a column (default) or a row. */
760
763
  orientation = input('vertical', /* @ts-ignore */
@@ -878,8 +881,13 @@ class XuiGraphGroup {
878
881
  /** Matches the `group` input on the nodes that belong to this frame. */
879
882
  groupId = input.required(/* @ts-ignore */
880
883
  ...(ngDevMode ? [{ debugName: "groupId" }] : /* istanbul ignore next */ []));
884
+ /** Extra classes, merged into the component's own rather than replacing them. */
881
885
  class = input('', /* @ts-ignore */
882
886
  ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
887
+ /**
888
+ * The group's caption. An empty label drops the header entirely, and with it the vertical offset it adds to the
889
+ * group's contents.
890
+ */
883
891
  label = input('', /* @ts-ignore */
884
892
  ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
885
893
  /** Border and title colour; a tint of it fills the frame. Any CSS colour. */
@@ -887,7 +895,11 @@ class XuiGraphGroup {
887
895
  ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
888
896
  /** Blank margin between the members' bounding box and the frame. */
889
897
  padding = input(24, { ...(ngDevMode ? { debugName: "padding" } : /* istanbul ignore next */ {}), transform: numberAttribute });
898
+ /** Let the group be selected by clicking it or by a marquee. */
890
899
  selectable = input(true, { ...(ngDevMode ? { debugName: "selectable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
900
+ /**
901
+ * Let the group be dragged, taking the nodes inside it along. A locked group, or a locked graph, overrides this.
902
+ */
891
903
  draggable = input(true, { ...(ngDevMode ? { debugName: "draggable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
892
904
  /** Pins the frame and everything in it. */
893
905
  locked = input(false, { ...(ngDevMode ? { debugName: "locked" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
@@ -1058,6 +1070,7 @@ class XuiGraphMinimap {
1058
1070
  store = inject(XuiNodeGraphStore);
1059
1071
  element = inject(ElementRef).nativeElement;
1060
1072
  dragging = false;
1073
+ /** Extra classes, merged into the component's own rather than replacing them. */
1061
1074
  class = input('', /* @ts-ignore */
1062
1075
  ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
1063
1076
  /** Blank margin around the content, in graph units. */
@@ -1278,6 +1291,7 @@ class XuiGraphPort {
1278
1291
  /** Unique within the owning node — the node id supplies the rest of the identity. */
1279
1292
  portId = input.required(/* @ts-ignore */
1280
1293
  ...(ngDevMode ? [{ debugName: "portId" }] : /* istanbul ignore next */ []));
1294
+ /** Extra classes, merged into the component's own rather than replacing them. */
1281
1295
  class = input('', /* @ts-ignore */
1282
1296
  ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
1283
1297
  /**
@@ -1287,6 +1301,7 @@ class XuiGraphPort {
1287
1301
  */
1288
1302
  direction = input('input', /* @ts-ignore */
1289
1303
  ...(ngDevMode ? [{ debugName: "direction" }] : /* istanbul ignore next */ []));
1304
+ /** The port's caption. Also its accessible name, falling back to the port id when empty. */
1290
1305
  label = input('', /* @ts-ignore */
1291
1306
  ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
1292
1307
  /**
@@ -1300,6 +1315,7 @@ class XuiGraphPort {
1300
1315
  /** Overrides the colour inherited from {@link dataType}. */
1301
1316
  color = input(/* @ts-ignore */
1302
1317
  ...(ngDevMode ? [undefined, { debugName: "color" }] : /* istanbul ignore next */ []));
1318
+ /** Block connections to and from this port. It stays visible and keeps its existing edges. */
1303
1319
  disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
1304
1320
  /**
1305
1321
  * Which node edge the connector sits on. Leave unset to take it from
@@ -1307,6 +1323,7 @@ class XuiGraphPort {
1307
1323
  */
1308
1324
  side = input(/* @ts-ignore */
1309
1325
  ...(ngDevMode ? [undefined, { debugName: "side" }] : /* istanbul ignore next */ []));
1326
+ /** Override the port's glyph. Falls back to the shape declared for its type, then to the graph's default. */
1310
1327
  shape = input(/* @ts-ignore */
1311
1328
  ...(ngDevMode ? [undefined, { debugName: "shape" }] : /* istanbul ignore next */ []));
1312
1329
  /**
@@ -1638,11 +1655,13 @@ class XuiGraphNode {
1638
1655
  /** Identifies the node to edges and to the selection. Must be stable and unique. */
1639
1656
  nodeId = input.required(/* @ts-ignore */
1640
1657
  ...(ngDevMode ? [{ debugName: "nodeId" }] : /* istanbul ignore next */ []));
1658
+ /** Extra classes, merged into the component's own rather than replacing them. */
1641
1659
  class = input('', /* @ts-ignore */
1642
1660
  ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
1643
1661
  /** Top-left corner in graph space. Two-way bound so the host owns the value. */
1644
1662
  position = model({ x: 0, y: 0 }, /* @ts-ignore */
1645
1663
  ...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
1664
+ /** The node's caption, shown in its header. */
1646
1665
  label = input('', /* @ts-ignore */
1647
1666
  ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
1648
1667
  /** Fixed width in graph units. Leave unset to size to content. */
@@ -1669,8 +1688,14 @@ class XuiGraphNode {
1669
1688
  */
1670
1689
  collapsed = model(false, /* @ts-ignore */
1671
1690
  ...(ngDevMode ? [{ debugName: "collapsed" }] : /* istanbul ignore next */ []));
1691
+ /** Add a header toggle that folds the node's body away, leaving its ports and edges intact. */
1672
1692
  collapsible = input(false, { ...(ngDevMode ? { debugName: "collapsible" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
1693
+ /**
1694
+ * Let the node be selected. Also what gives it `role="option"` and `aria-selected`; an unselectable node has
1695
+ * neither.
1696
+ */
1673
1697
  selectable = input(true, { ...(ngDevMode ? { debugName: "selectable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
1698
+ /** Let the node be dragged. A locked node, or a locked graph, overrides this. */
1674
1699
  draggable = input(true, { ...(ngDevMode ? { debugName: "draggable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
1675
1700
  /** Pins the node in place while leaving it selectable. */
1676
1701
  locked = input(false, { ...(ngDevMode ? { debugName: "locked" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
@@ -1945,6 +1970,7 @@ const NON_DRAGGABLE = '[data-xui-graph-port], [data-xui-graph-no-drag], input, t
1945
1970
  * ```
1946
1971
  */
1947
1972
  class XuiGraphNodeHeader {
1973
+ /** Extra classes, merged into the component's own rather than replacing them. */
1948
1974
  class = input('', /* @ts-ignore */
1949
1975
  ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
1950
1976
  computedClass = computed(() => xui('flex min-w-0 flex-1 items-center gap-2 truncate', this.class()), /* @ts-ignore */
@@ -1964,6 +1990,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
1964
1990
  }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
1965
1991
  /** Trailing controls in a node header — a menu button, a toggle, a status dot. */
1966
1992
  class XuiGraphNodeActions {
1993
+ /** Extra classes, merged into the component's own rather than replacing them. */
1967
1994
  class = input('', /* @ts-ignore */
1968
1995
  ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
1969
1996
  computedClass = computed(() => xui('flex shrink-0 items-center gap-1', this.class()), /* @ts-ignore */
@@ -1986,6 +2013,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
1986
2013
  * render, a waveform. Sits above the port rows, as it does in a VFX graph.
1987
2014
  */
1988
2015
  class XuiGraphNodePreview {
2016
+ /** Extra classes, merged into the component's own rather than replacing them. */
1989
2017
  class = input('', /* @ts-ignore */
1990
2018
  ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
1991
2019
  computedClass = computed(() => xui('border-border-muted block overflow-hidden border-b', this.class()), /* @ts-ignore */
@@ -2028,6 +2056,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
2028
2056
  * ```
2029
2057
  */
2030
2058
  class XuiGraphOverlay {
2059
+ /** Extra classes, merged into the component's own rather than replacing them. */
2031
2060
  class = input('', /* @ts-ignore */
2032
2061
  ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
2033
2062
  // eslint-disable-next-line local/no-hand-z-index -- slots overlay their own node inside the graph’s stacking context
@@ -2321,6 +2350,7 @@ class XuiNodeGraph {
2321
2350
  ...(ngDevMode ? [{ debugName: "marqueeState" }] : /* istanbul ignore next */ []));
2322
2351
  /** The store for this canvas. Use it to drive the view from a host component. */
2323
2352
  store = inject(XuiNodeGraphStore);
2353
+ /** Extra classes, merged into the component's own rather than replacing them. */
2324
2354
  class = input('', /* @ts-ignore */
2325
2355
  ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
2326
2356
  /** The wires to draw. Never mutated — see `connect`. */
@@ -2329,26 +2359,48 @@ class XuiNodeGraph {
2329
2359
  /** Pan and zoom. Two-way bindable, so a host can save and restore the view. */
2330
2360
  viewport = model({ x: 0, y: 0, zoom: 1 }, /* @ts-ignore */
2331
2361
  ...(ngDevMode ? [{ debugName: "viewport" }] : /* istanbul ignore next */ []));
2362
+ /**
2363
+ * How edges are drawn between ports: curved (`bezier`), right-angled (`orthogonal`), rounded right angles
2364
+ * (`smoothstep`), or direct (`straight`).
2365
+ */
2332
2366
  routing = input(this.config.routing, /* @ts-ignore */
2333
2367
  ...(ngDevMode ? [{ debugName: "routing" }] : /* istanbul ignore next */ []));
2368
+ /** The canvas pattern behind the graph, which scales with the zoom. */
2334
2369
  background = input(this.config.background, /* @ts-ignore */
2335
2370
  ...(ngDevMode ? [{ debugName: "background" }] : /* istanbul ignore next */ []));
2371
+ /** Default end marker on an edge. An edge may override it. */
2336
2372
  marker = input(this.config.marker, /* @ts-ignore */
2337
2373
  ...(ngDevMode ? [{ debugName: "marker" }] : /* istanbul ignore next */ []));
2374
+ /** Spacing of the background pattern, and the step nodes snap to when `snapToGrid` is on. */
2338
2375
  gridSize = input(this.config.gridSize, { ...(ngDevMode ? { debugName: "gridSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
2376
+ /**
2377
+ * Round node positions to `gridSize` as they are dragged. Holding Shift while nudging with the arrow keys does the
2378
+ * same.
2379
+ */
2339
2380
  snapToGrid = input(this.config.snapToGrid, { ...(ngDevMode ? { debugName: "snapToGrid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
2381
+ /** How far the canvas can zoom out, as a scale factor. */
2340
2382
  minZoom = input(this.config.minZoom, { ...(ngDevMode ? { debugName: "minZoom" } : /* istanbul ignore next */ {}), transform: numberAttribute });
2383
+ /** How far the canvas can zoom in, as a scale factor. */
2341
2384
  maxZoom = input(this.config.maxZoom, { ...(ngDevMode ? { debugName: "maxZoom" } : /* istanbul ignore next */ {}), transform: numberAttribute });
2385
+ /** Default stroke width for edges, in graph units. An edge may override it. */
2342
2386
  edgeWidth = input(this.config.edgeWidth, { ...(ngDevMode ? { debugName: "edgeWidth" } : /* istanbul ignore next */ {}), transform: numberAttribute });
2387
+ /** Default port glyph size, in graph units. */
2343
2388
  portSize = input(this.config.portSize, { ...(ngDevMode ? { debugName: "portSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
2389
+ /** Default port glyph. A port type, or the port itself, may override it. */
2344
2390
  portShape = input(this.config.portShape, /* @ts-ignore */
2345
2391
  ...(ngDevMode ? [{ debugName: "portShape" }] : /* istanbul ignore next */ []));
2392
+ /** Default port colour. A port type, or the port itself, may override it. */
2346
2393
  portColor = input(this.config.portColor, /* @ts-ignore */
2347
2394
  ...(ngDevMode ? [{ debugName: "portColor" }] : /* istanbul ignore next */ []));
2348
2395
  /** Data-type registry: colour, glyph and label per `dataType`. */
2349
2396
  portTypes = input(this.config.portTypes, /* @ts-ignore */
2350
2397
  ...(ngDevMode ? [{ debugName: "portTypes" }] : /* istanbul ignore next */ []));
2398
+ /** Let an edge run from a node back to itself. */
2351
2399
  allowSelfConnection = input(this.config.allowSelfConnection, { ...(ngDevMode ? { debugName: "allowSelfConnection" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
2400
+ /**
2401
+ * Refuse a connection between ports whose declared types do not match. Off by default, which leaves validation to
2402
+ * the host.
2403
+ */
2352
2404
  enforcePortTypes = input(this.config.enforcePortTypes, { ...(ngDevMode ? { debugName: "enforcePortTypes" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
2353
2405
  /** Last say on whether a connection may be made. Runs after the built-in rules. */
2354
2406
  isValidConnection = input(/* @ts-ignore */
@@ -2363,17 +2415,26 @@ class XuiNodeGraph {
2363
2415
  */
2364
2416
  zoomActivation = input('wheel', /* @ts-ignore */
2365
2417
  ...(ngDevMode ? [{ debugName: "zoomActivation" }] : /* istanbul ignore next */ []));
2418
+ /**
2419
+ * Zoom on wheel. Turn it off inside a scrolling page, where the wheel should scroll past the graph rather than into
2420
+ * it.
2421
+ */
2366
2422
  zoomOnScroll = input(true, { ...(ngDevMode ? { debugName: "zoomOnScroll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
2367
2423
  /** A connection that passed every rule. The host decides whether to add it. */
2368
2424
  connect = output();
2369
2425
  /** A wire dropped on empty canvas — the hook for "drag out to create a node". */
2370
2426
  connectionDrop = output();
2427
+ /** Emits the edge that was clicked. */
2371
2428
  edgeClick = output();
2372
2429
  /** Fired once per drag, when the pointer is released. */
2373
2430
  nodeMove = output();
2431
+ /** Emits the selected node and edge ids whenever the selection changes. */
2374
2432
  selectionChange = output();
2375
2433
  /** Delete or Backspace over the canvas. The host performs the removal. */
2376
2434
  deleteSelection = output();
2435
+ /**
2436
+ * Emits a right-click on empty canvas, with the position in graph coordinates — the hook for a "new node here" menu.
2437
+ */
2377
2438
  canvasContextMenu = output();
2378
2439
  Math = Math;
2379
2440
  arrowId = `xui-graph-arrow-${this.uid}`;