@kubex/zinc 1.1.22 → 1.1.24
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/custom-elements-manifest.config.js +2 -4
- package/dist/custom-elements.json +1172 -78
- package/dist/vscode.html-custom-data.json +34 -13
- package/dist/web-types.json +135 -26
- package/dist/zn.d.ts +867 -1
- package/dist/zn.min.js +893 -481
- package/docs/_includes/default.njk +1 -0
- package/docs/_includes/full-page.njk +38 -0
- package/docs/pages/components/flow-builder-demo.njk +194 -0
- package/docs/pages/components/flow-builder-troubleshooter-demo.njk +282 -0
- package/docs/pages/components/flow-builder.md +377 -0
- package/package.json +1 -1
- package/src/components/button/button.component.ts +1 -2
- package/src/components/button/button.scss +6 -16
- package/src/components/collapsible/collapsible.component.ts +11 -6
- package/src/components/data-table/data-table.component.ts +12 -12
- package/src/components/flow-builder/flow-builder.component.ts +1171 -0
- package/src/components/flow-builder/flow-builder.scss +489 -0
- package/src/components/flow-builder/flow-builder.test.ts +59 -0
- package/src/components/flow-builder/flow-layout.ts +139 -0
- package/src/components/flow-builder/flow-registry.ts +52 -0
- package/src/components/flow-builder/flow.types.ts +407 -0
- package/src/components/flow-builder/index.ts +14 -0
- package/src/components/flow-builder/modules/flow-canvas/flow-canvas.component.ts +1086 -0
- package/src/components/flow-builder/modules/flow-canvas/flow-canvas.scss +371 -0
- package/src/components/flow-builder/modules/flow-canvas/flow-canvas.test.ts +39 -0
- package/src/components/flow-builder/modules/flow-canvas/index.ts +12 -0
- package/src/components/flow-builder/modules/flow-node/flow-node.component.ts +174 -0
- package/src/components/flow-builder/modules/flow-node/flow-node.scss +180 -0
- package/src/components/flow-builder/modules/flow-node/flow-node.test.ts +50 -0
- package/src/components/flow-builder/modules/flow-node/index.ts +12 -0
- package/src/components/flow-builder/modules/flow-step/flow-step.component.ts +88 -0
- package/src/components/flow-builder/modules/flow-step/flow-step.scss +52 -0
- package/src/components/flow-builder/modules/flow-step/flow-step.test.ts +21 -0
- package/src/components/flow-builder/modules/flow-step/index.ts +12 -0
- package/src/components/flow-builder/modules/flow-step-group/flow-step-group.component.ts +35 -0
- package/src/components/flow-builder/modules/flow-step-group/flow-step-group.scss +28 -0
- package/src/components/flow-builder/modules/flow-step-group/flow-step-group.test.ts +20 -0
- package/src/components/flow-builder/modules/flow-step-group/index.ts +12 -0
- package/src/components/flow-builder/modules/flow-steps/flow-steps.component.ts +88 -0
- package/src/components/flow-builder/modules/flow-steps/flow-steps.scss +24 -0
- package/src/components/flow-builder/modules/flow-steps/flow-steps.test.ts +17 -0
- package/src/components/flow-builder/modules/flow-steps/index.ts +12 -0
- package/src/events/events.ts +3 -0
- package/src/events/zn-flow-change.ts +9 -0
- package/src/events/zn-flow-connect.ts +9 -0
- package/src/events/zn-flow-selection-change.ts +7 -0
- package/src/zinc.ts +4 -0
package/dist/zn.d.ts
CHANGED
|
@@ -1169,7 +1169,7 @@ declare module "components/button/button.component" {
|
|
|
1169
1169
|
private _loadingState;
|
|
1170
1170
|
button: HTMLButtonElement;
|
|
1171
1171
|
countdownContainer: HTMLElement[];
|
|
1172
|
-
color: 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | 'transparent' | 'star' |
|
|
1172
|
+
color: 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | 'transparent' | 'star' | (string & Record<never, never>);
|
|
1173
1173
|
hoverColor: string;
|
|
1174
1174
|
text: boolean;
|
|
1175
1175
|
outline: boolean;
|
|
@@ -1377,6 +1377,8 @@ declare module "components/collapsible/collapsible.component" {
|
|
|
1377
1377
|
*
|
|
1378
1378
|
* @slot header - Clicking will toggle the show state of the data
|
|
1379
1379
|
*
|
|
1380
|
+
* @csspart header - The header row (toggle).
|
|
1381
|
+
* @csspart caption - The caption text.
|
|
1380
1382
|
*/
|
|
1381
1383
|
export default class ZnCollapsible extends ZincElement {
|
|
1382
1384
|
static styles: CSSResultGroup;
|
|
@@ -8428,6 +8430,831 @@ declare module "components/markdown-editor/index" {
|
|
|
8428
8430
|
}
|
|
8429
8431
|
}
|
|
8430
8432
|
}
|
|
8433
|
+
declare module "components/flow-builder/flow.types" {
|
|
8434
|
+
import type { TemplateResult } from 'lit';
|
|
8435
|
+
/** Which steps-panel tab a node type appears under. */
|
|
8436
|
+
export type FlowGroup = 'entrypoint' | 'trigger' | 'action' | 'rule';
|
|
8437
|
+
/** A single connection point on a node (input or output). */
|
|
8438
|
+
export interface FlowPort {
|
|
8439
|
+
id: string;
|
|
8440
|
+
/** Branch name shown on the wire pill (outputs). */
|
|
8441
|
+
label?: string;
|
|
8442
|
+
/** Branch configuration (filters / conditions for taking this path), edited via the branch editor. */
|
|
8443
|
+
data?: Record<string, unknown>;
|
|
8444
|
+
}
|
|
8445
|
+
/**
|
|
8446
|
+
* Describes a kind of node that can be placed on the canvas. Consumers register
|
|
8447
|
+
* these with the builder to extend it — the steps panel and inspector are driven
|
|
8448
|
+
* entirely by the registered types, so no library changes are needed to add a
|
|
8449
|
+
* new custom component.
|
|
8450
|
+
*/
|
|
8451
|
+
export interface FlowNodeType {
|
|
8452
|
+
/** Unique key, persisted on every placed node. */
|
|
8453
|
+
type: string;
|
|
8454
|
+
label: string;
|
|
8455
|
+
/** Steps-panel tab the type is listed under. */
|
|
8456
|
+
group: FlowGroup;
|
|
8457
|
+
/** Collapsible category within the tab (e.g. "Contacts"). */
|
|
8458
|
+
category?: string;
|
|
8459
|
+
/** zn-icon `src` (e.g. "mail" or "mail@lu"). */
|
|
8460
|
+
icon?: string;
|
|
8461
|
+
/** zn-icon `library`, when not encoded in `icon`. */
|
|
8462
|
+
iconLibrary?: string;
|
|
8463
|
+
/** Accent color for the icon tile / ports — any CSS color. */
|
|
8464
|
+
color?: string;
|
|
8465
|
+
description?: string;
|
|
8466
|
+
/** Input ports. Defaults to a single unlabelled input. Pass `[]` for a trigger. */
|
|
8467
|
+
inputs?: FlowPort[];
|
|
8468
|
+
/** Output ports. Defaults to a single unlabelled output. e.g. TRUE/FALSE for a split. */
|
|
8469
|
+
outputs?: FlowPort[];
|
|
8470
|
+
/** Initial `data` for a freshly placed node. */
|
|
8471
|
+
defaultData?: Record<string, unknown>;
|
|
8472
|
+
/** Renders the inspector body for a selected node of this type. */
|
|
8473
|
+
renderConfig?: (node: FlowNodeInstance, update: (data: Record<string, unknown>) => void) => TemplateResult;
|
|
8474
|
+
/** Renders the branch editor body (filters / conditions) for one of this type's output branches. */
|
|
8475
|
+
renderBranchConfig?: (node: FlowNodeInstance, port: FlowPort, update: (patch: Partial<FlowPort>) => void) => TemplateResult;
|
|
8476
|
+
}
|
|
8477
|
+
/** A node placed on the canvas. */
|
|
8478
|
+
export interface FlowNodeInstance {
|
|
8479
|
+
id: string;
|
|
8480
|
+
type: string;
|
|
8481
|
+
x: number;
|
|
8482
|
+
y: number;
|
|
8483
|
+
/** Overrides the type label when set. */
|
|
8484
|
+
label?: string;
|
|
8485
|
+
/** Per-instance input ports; overrides the type's when set (user-configurable). */
|
|
8486
|
+
inputs?: FlowPort[];
|
|
8487
|
+
/** Per-instance output ports; overrides the type's when set (user-configurable). */
|
|
8488
|
+
outputs?: FlowPort[];
|
|
8489
|
+
data: Record<string, unknown>;
|
|
8490
|
+
}
|
|
8491
|
+
export interface FlowEndpoint {
|
|
8492
|
+
node: string;
|
|
8493
|
+
port: string;
|
|
8494
|
+
}
|
|
8495
|
+
export interface FlowConnection {
|
|
8496
|
+
id: string;
|
|
8497
|
+
source: FlowEndpoint;
|
|
8498
|
+
target: FlowEndpoint;
|
|
8499
|
+
}
|
|
8500
|
+
export interface FlowNote {
|
|
8501
|
+
id: string;
|
|
8502
|
+
x: number;
|
|
8503
|
+
y: number;
|
|
8504
|
+
text: string;
|
|
8505
|
+
width?: number;
|
|
8506
|
+
height?: number;
|
|
8507
|
+
}
|
|
8508
|
+
/** The complete serialisable state of a flow. */
|
|
8509
|
+
export interface FlowState {
|
|
8510
|
+
nodes: FlowNodeInstance[];
|
|
8511
|
+
connections: FlowConnection[];
|
|
8512
|
+
notes: FlowNote[];
|
|
8513
|
+
}
|
|
8514
|
+
export const DEFAULT_INPUT: FlowPort;
|
|
8515
|
+
export const DEFAULT_OUTPUT: FlowPort;
|
|
8516
|
+
/**
|
|
8517
|
+
* Sentinel port id for the extra "+" a fully-connected node always offers.
|
|
8518
|
+
* Using it (attaching a stray branch, dropping a step, or moving a node onto it)
|
|
8519
|
+
* materialises a real output port on the node first.
|
|
8520
|
+
*/
|
|
8521
|
+
export const NEW_OUTPUT_PORT = "__new__";
|
|
8522
|
+
/** Drag-and-drop MIME used to carry a node type id from the steps panel to the canvas. */
|
|
8523
|
+
export const FLOW_TYPE_MIME = "application/x-zn-flow-type";
|
|
8524
|
+
/**
|
|
8525
|
+
* A cached 1×1 transparent image. Pass it to `dataTransfer.setDragImage()` to
|
|
8526
|
+
* suppress the browser's default drag image — the builder renders its own
|
|
8527
|
+
* in-canvas drop preview instead.
|
|
8528
|
+
*/
|
|
8529
|
+
export function emptyDragImage(): HTMLImageElement;
|
|
8530
|
+
/**
|
|
8531
|
+
* Fixed node geometry. Cards are a uniform size so the canvas can compute exact
|
|
8532
|
+
* port coordinates from a node's position alone — no DOM measurement, which
|
|
8533
|
+
* keeps connection rendering and hit-testing reliable under pan/zoom.
|
|
8534
|
+
*/
|
|
8535
|
+
export const NODE_WIDTH = 240;
|
|
8536
|
+
export const NODE_HEIGHT = 60;
|
|
8537
|
+
/** Horizontal spacing between the branches of a multi-output node. */
|
|
8538
|
+
export const BRANCH_SPREAD = 200;
|
|
8539
|
+
export const BUS_OFFSET = 40;
|
|
8540
|
+
export const PILL_DROP = 40;
|
|
8541
|
+
export const PILL_HEIGHT = 40;
|
|
8542
|
+
export const PILL_MAX_WIDTH = 240;
|
|
8543
|
+
/** Extra pill height per wrapped line (matches the pill's CSS line-height). */
|
|
8544
|
+
export const PILL_LINE_HEIGHT = 20;
|
|
8545
|
+
/**
|
|
8546
|
+
* Estimated pill box for a branch name: sizes to the text up to the max width,
|
|
8547
|
+
* then hard-wraps — the height grows a grid unit per extra line. The pill DOM
|
|
8548
|
+
* sizes itself from its content (fixed padding); this estimate drives the wire
|
|
8549
|
+
* geometry and collision footprints, so it uses the same ~7.2px/char metric.
|
|
8550
|
+
*/
|
|
8551
|
+
export function pillSize(label: string): {
|
|
8552
|
+
w: number;
|
|
8553
|
+
h: number;
|
|
8554
|
+
};
|
|
8555
|
+
/** The grid everything on the canvas snaps to (matches the dotted background). */
|
|
8556
|
+
export const GRID_SIZE = 20;
|
|
8557
|
+
export function snapToGrid(v: number): number;
|
|
8558
|
+
interface Rect {
|
|
8559
|
+
x: number;
|
|
8560
|
+
y: number;
|
|
8561
|
+
w: number;
|
|
8562
|
+
h: number;
|
|
8563
|
+
/** Clearance this rect claims around itself. */
|
|
8564
|
+
m: number;
|
|
8565
|
+
}
|
|
8566
|
+
/** A function resolving a node type key to its registered type. */
|
|
8567
|
+
export type FlowTypeOf = (type: string) => FlowNodeType | undefined;
|
|
8568
|
+
/**
|
|
8569
|
+
* Canvas x for each of a node's branch drops. A connected branch pulls straight
|
|
8570
|
+
* above its child's input — a bend-free wire — when it's the only wire into that
|
|
8571
|
+
* input, the child is within the branch's natural fan range, and the position
|
|
8572
|
+
* keeps clear of sibling branches; otherwise it fans out source-side.
|
|
8573
|
+
*/
|
|
8574
|
+
export function branchDropXs(node: FlowNodeInstance, typeOf: FlowTypeOf, nodes: FlowNodeInstance[], connections: FlowConnection[]): number[];
|
|
8575
|
+
/**
|
|
8576
|
+
* The rects a node occupies on the canvas: its card plus each branch-name pill,
|
|
8577
|
+
* at the exact positions the canvas draws them.
|
|
8578
|
+
*/
|
|
8579
|
+
export function nodeObstacles(node: FlowNodeInstance, typeOf: FlowTypeOf, nodes: FlowNodeInstance[], connections: FlowConnection[]): Rect[];
|
|
8580
|
+
/** Whether two nodes' footprints (cards and branch pills) would overlap. */
|
|
8581
|
+
export function nodesCollide(a: FlowNodeInstance, b: FlowNodeInstance, typeOf: FlowTypeOf, nodes: FlowNodeInstance[], connections: FlowConnection[]): boolean;
|
|
8582
|
+
/** Whether a bare card placed at `pos` would hit any of `node`'s footprint. */
|
|
8583
|
+
export function cardCollides(pos: {
|
|
8584
|
+
x: number;
|
|
8585
|
+
y: number;
|
|
8586
|
+
}, node: FlowNodeInstance, typeOf: FlowTypeOf, nodes: FlowNodeInstance[], connections: FlowConnection[]): boolean;
|
|
8587
|
+
export const NOTE_WIDTH = 200;
|
|
8588
|
+
export const NOTE_HEIGHT = 120;
|
|
8589
|
+
export const NOTE_MIN_WIDTH = 120;
|
|
8590
|
+
export const NOTE_MIN_HEIGHT = 80;
|
|
8591
|
+
/** Canvas-space coordinate of a port anchor on a node of the given size. */
|
|
8592
|
+
export function portAnchor(node: Pick<FlowNodeInstance, 'x' | 'y'>, side: 'in' | 'out', index: number, count: number): {
|
|
8593
|
+
x: number;
|
|
8594
|
+
y: number;
|
|
8595
|
+
};
|
|
8596
|
+
export function emptyFlowState(): FlowState;
|
|
8597
|
+
/** Resolve a type's inputs, falling back to a single default input. */
|
|
8598
|
+
export function typeInputs(type: FlowNodeType | undefined): FlowPort[];
|
|
8599
|
+
/** Resolve a type's outputs, falling back to a single default output. */
|
|
8600
|
+
export function typeOutputs(type: FlowNodeType | undefined): FlowPort[];
|
|
8601
|
+
/** A node's effective inputs — its per-instance override, else the type's. */
|
|
8602
|
+
export function nodeInputs(node: FlowNodeInstance, type: FlowNodeType | undefined): FlowPort[];
|
|
8603
|
+
/** A node's effective outputs — its per-instance override, else the type's. */
|
|
8604
|
+
export function nodeOutputs(node: FlowNodeInstance, type: FlowNodeType | undefined): FlowPort[];
|
|
8605
|
+
/** A node's first input id, or null when it accepts no inputs (an entrypoint). */
|
|
8606
|
+
export function firstInputId(node: FlowNodeInstance, type: FlowNodeType | undefined): string | null;
|
|
8607
|
+
/** The connection occupying a given output port, if any. */
|
|
8608
|
+
export function connectionAt(state: FlowState, nodeId: string, port: string): FlowConnection | undefined;
|
|
8609
|
+
/** Whether an output port has no downstream connection (shows a "+"). */
|
|
8610
|
+
export function isOpenOutput(state: FlowState, nodeId: string, port: string): boolean;
|
|
8611
|
+
/** All node ids reachable downstream from a node (excluding the node itself). */
|
|
8612
|
+
export function descendantIds(state: FlowState, nodeId: string): Set<string>;
|
|
8613
|
+
/**
|
|
8614
|
+
* Whether connecting `sourceNode`'s output to `targetNode` would create a cycle —
|
|
8615
|
+
* i.e. the target is the source itself or already downstream of it. The builder
|
|
8616
|
+
* allows loops, but consumers can use this to validate flows that must stay acyclic.
|
|
8617
|
+
*/
|
|
8618
|
+
export function wouldCreateCycle(state: FlowState, sourceNode: string, targetNode: string): boolean;
|
|
8619
|
+
/**
|
|
8620
|
+
* The connections that close loops: each cycle's back-edge in a DFS forest
|
|
8621
|
+
* grown from the roots (every cycle contains exactly one such edge). Used to
|
|
8622
|
+
* render loop wires distinctly and to keep the untangle layering acyclic.
|
|
8623
|
+
*/
|
|
8624
|
+
export function loopConnections(nodes: FlowNodeInstance[], connections: FlowConnection[]): Set<FlowConnection>;
|
|
8625
|
+
}
|
|
8626
|
+
declare module "components/flow-builder/modules/flow-node/flow-node.component" {
|
|
8627
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
8628
|
+
import ZincElement from "internal/zinc-element";
|
|
8629
|
+
import ZnButton from "components/button/index";
|
|
8630
|
+
import ZnDropdown from "components/dropdown/index";
|
|
8631
|
+
import ZnIcon from "components/icon/index";
|
|
8632
|
+
import ZnMenu from "components/menu/index";
|
|
8633
|
+
import ZnMenuItem from "components/menu-item/index";
|
|
8634
|
+
import { type FlowNodeInstance, type FlowNodeType } from "components/flow-builder/flow.types";
|
|
8635
|
+
/**
|
|
8636
|
+
* @summary A single node tile on the flow canvas, with input/output ports and a context menu.
|
|
8637
|
+
* @documentation https://zinc.style/components/flow-node
|
|
8638
|
+
* @status experimental
|
|
8639
|
+
* @since 1.0
|
|
8640
|
+
*
|
|
8641
|
+
* @dependency zn-icon
|
|
8642
|
+
* @dependency zn-button
|
|
8643
|
+
* @dependency zn-dropdown
|
|
8644
|
+
* @dependency zn-menu
|
|
8645
|
+
* @dependency zn-menu-item
|
|
8646
|
+
*
|
|
8647
|
+
* @event flow-node-select - Emitted when the node body is clicked.
|
|
8648
|
+
* @event flow-node-grab - Emitted on pointerdown of the node body to begin a move (handled by the canvas).
|
|
8649
|
+
* @event flow-node-action - Emitted when a context-menu action (delete/duplicate/move) is chosen.
|
|
8650
|
+
* @event flow-port-click - An output port was clicked; the canvas starts (or attaches) a branch.
|
|
8651
|
+
*
|
|
8652
|
+
* @csspart base - The node card wrapper.
|
|
8653
|
+
*/
|
|
8654
|
+
export default class ZnFlowNode extends ZincElement {
|
|
8655
|
+
static styles: CSSResultGroup;
|
|
8656
|
+
static dependencies: {
|
|
8657
|
+
'zn-icon': typeof ZnIcon;
|
|
8658
|
+
'zn-button': typeof ZnButton;
|
|
8659
|
+
'zn-dropdown': typeof ZnDropdown;
|
|
8660
|
+
'zn-menu': typeof ZnMenu;
|
|
8661
|
+
'zn-menu-item': typeof ZnMenuItem;
|
|
8662
|
+
};
|
|
8663
|
+
node: FlowNodeInstance;
|
|
8664
|
+
type: FlowNodeType;
|
|
8665
|
+
selected: boolean;
|
|
8666
|
+
error: boolean;
|
|
8667
|
+
dragging: boolean;
|
|
8668
|
+
/** A stray branch is snapped onto this node — highlight it as the drop target. */
|
|
8669
|
+
linkTarget: boolean;
|
|
8670
|
+
protected updated(changed: PropertyValues): void;
|
|
8671
|
+
private get nodeTitle();
|
|
8672
|
+
private get nodeSubtitle();
|
|
8673
|
+
private _emit;
|
|
8674
|
+
private _onBodyPointerDown;
|
|
8675
|
+
private _action;
|
|
8676
|
+
private _renderPorts;
|
|
8677
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
8678
|
+
}
|
|
8679
|
+
}
|
|
8680
|
+
declare module "components/flow-builder/modules/flow-node/index" {
|
|
8681
|
+
import ZnFlowNode from "components/flow-builder/modules/flow-node/flow-node.component";
|
|
8682
|
+
export * from "components/flow-builder/modules/flow-node/flow-node.component";
|
|
8683
|
+
export default ZnFlowNode;
|
|
8684
|
+
global {
|
|
8685
|
+
interface HTMLElementTagNameMap {
|
|
8686
|
+
'zn-flow-node': ZnFlowNode;
|
|
8687
|
+
}
|
|
8688
|
+
}
|
|
8689
|
+
}
|
|
8690
|
+
declare module "components/flow-builder/flow-registry" {
|
|
8691
|
+
import type { FlowGroup, FlowNodeType } from "components/flow-builder/flow.types";
|
|
8692
|
+
/**
|
|
8693
|
+
* Holds the set of {@link FlowNodeType}s available to a flow builder. This is
|
|
8694
|
+
* the modular extension point: register custom node types here and the steps panel
|
|
8695
|
+
* and inspector pick them up automatically.
|
|
8696
|
+
*/
|
|
8697
|
+
export class FlowRegistry {
|
|
8698
|
+
private types;
|
|
8699
|
+
register(type: FlowNodeType): this;
|
|
8700
|
+
registerAll(types: FlowNodeType[]): this;
|
|
8701
|
+
get(type: string): FlowNodeType | undefined;
|
|
8702
|
+
has(type: string): boolean;
|
|
8703
|
+
all(): FlowNodeType[];
|
|
8704
|
+
byGroup(group: FlowGroup): FlowNodeType[];
|
|
8705
|
+
/** Map of category name -> types, preserving insertion order, for one group. */
|
|
8706
|
+
categories(group: FlowGroup): Map<string, FlowNodeType[]>;
|
|
8707
|
+
clear(): void;
|
|
8708
|
+
}
|
|
8709
|
+
}
|
|
8710
|
+
declare module "components/flow-builder/modules/flow-canvas/flow-canvas.component" {
|
|
8711
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
8712
|
+
import ZincElement from "internal/zinc-element";
|
|
8713
|
+
import ZnButton from "components/button/index";
|
|
8714
|
+
import ZnFlowNode from "components/flow-builder/modules/flow-node/index";
|
|
8715
|
+
import ZnIcon from "components/icon/index";
|
|
8716
|
+
import { type FlowConnection, type FlowNodeInstance, type FlowNote } from "components/flow-builder/flow.types";
|
|
8717
|
+
import type { FlowRegistry } from "components/flow-builder/flow-registry";
|
|
8718
|
+
/**
|
|
8719
|
+
* @summary The pannable, zoomable surface that renders flow nodes and the connections between them.
|
|
8720
|
+
* @documentation https://zinc.style/components/flow-canvas
|
|
8721
|
+
* @status experimental
|
|
8722
|
+
* @since 1.0
|
|
8723
|
+
*
|
|
8724
|
+
* @dependency zn-button
|
|
8725
|
+
* @dependency zn-icon
|
|
8726
|
+
* @dependency zn-flow-node
|
|
8727
|
+
*
|
|
8728
|
+
* @event flow-interaction-start - A drag (node/note move or resize) has begun; the builder snapshots for undo.
|
|
8729
|
+
* @event flow-change-commit - A drag or operation finished and the state should be persisted/emitted.
|
|
8730
|
+
* @event flow-output-assign - A step was dropped on an open output's "+".
|
|
8731
|
+
* @event flow-output-move-target - An open output's "+" was chosen as the destination while moving a node.
|
|
8732
|
+
* @event flow-link-assign - A stray branch (started from an output's "+") was attached to an existing node.
|
|
8733
|
+
* @event flow-wire-pick - An existing wire's "+" was clicked; the builder opens the step picker to insert.
|
|
8734
|
+
* @event flow-wire-assign - A step was dropped on a wire's "+" to insert a step.
|
|
8735
|
+
* @event flow-branch-pick - A branch pill was clicked; the builder opens the branch editor.
|
|
8736
|
+
* @event flow-branch-delete - A branch pill's delete button was clicked; the builder removes the branch.
|
|
8737
|
+
* @event flow-undo - The undo toolbar button was pressed.
|
|
8738
|
+
* @event flow-redo - The redo toolbar button was pressed.
|
|
8739
|
+
* @event flow-add-note - The add-note toolbar button was pressed.
|
|
8740
|
+
* @event flow-untangle - The untangle toolbar button was pressed; the builder auto-arranges the nodes.
|
|
8741
|
+
* @event flow-note-change - A note's text was edited.
|
|
8742
|
+
* @event flow-note-delete - A note was removed.
|
|
8743
|
+
*
|
|
8744
|
+
* @csspart base - The canvas viewport.
|
|
8745
|
+
* @csspart toolbar - The floating toolbar.
|
|
8746
|
+
*/
|
|
8747
|
+
export default class ZnFlowCanvas extends ZincElement {
|
|
8748
|
+
static styles: CSSResultGroup;
|
|
8749
|
+
static dependencies: {
|
|
8750
|
+
'zn-button': typeof ZnButton;
|
|
8751
|
+
'zn-icon': typeof ZnIcon;
|
|
8752
|
+
'zn-flow-node': typeof ZnFlowNode;
|
|
8753
|
+
};
|
|
8754
|
+
nodes: FlowNodeInstance[];
|
|
8755
|
+
connections: FlowConnection[];
|
|
8756
|
+
notes: FlowNote[];
|
|
8757
|
+
registry: FlowRegistry;
|
|
8758
|
+
selectedNodeId: string | null;
|
|
8759
|
+
errorNodes: Set<string>;
|
|
8760
|
+
/** When set, the canvas is in "move" mode: open "+" slots act as drop targets for this node. */
|
|
8761
|
+
movingNodeId: string | null;
|
|
8762
|
+
/** The node type being dragged from the steps panel, used to render the drop preview. */
|
|
8763
|
+
dragType: string | null;
|
|
8764
|
+
/** The branch being edited, as `nodeId:portId` — highlights its pill. */
|
|
8765
|
+
selectedBranch: string | null;
|
|
8766
|
+
private zoom;
|
|
8767
|
+
private panX;
|
|
8768
|
+
private panY;
|
|
8769
|
+
private drag;
|
|
8770
|
+
/** Canvas-space top-left where a step, if dropped now, would be placed. */
|
|
8771
|
+
private _dropGhost;
|
|
8772
|
+
/** The stray branch being drawn from an output port until it attaches or cancels. */
|
|
8773
|
+
private _linking;
|
|
8774
|
+
private _linkPos;
|
|
8775
|
+
/** The valid node under the cursor while linking — the preview snaps to its input. */
|
|
8776
|
+
private _linkTarget;
|
|
8777
|
+
private _dragMoved;
|
|
8778
|
+
/** Centre the flow when it first arrives; any earlier user interaction opts out. */
|
|
8779
|
+
private _viewInitialised;
|
|
8780
|
+
connectedCallback(): void;
|
|
8781
|
+
disconnectedCallback(): void;
|
|
8782
|
+
/**
|
|
8783
|
+
* Wheel navigation: scroll pans vertically, side-scroll (or Shift+scroll)
|
|
8784
|
+
* pans horizontally, and Ctrl/Cmd+scroll — including trackpad pinch — zooms
|
|
8785
|
+
* toward the cursor.
|
|
8786
|
+
*/
|
|
8787
|
+
private _onWheel;
|
|
8788
|
+
protected updated(changed: PropertyValues): void;
|
|
8789
|
+
private _emit;
|
|
8790
|
+
/** Convert a client (screen) coordinate to canvas space, accounting for pan/zoom. */
|
|
8791
|
+
screenToCanvas(clientX: number, clientY: number): {
|
|
8792
|
+
x: number;
|
|
8793
|
+
y: number;
|
|
8794
|
+
};
|
|
8795
|
+
private _typeFor;
|
|
8796
|
+
private _setupWindow;
|
|
8797
|
+
private _teardownWindow;
|
|
8798
|
+
private _onBackgroundPointerDown;
|
|
8799
|
+
private _onNodeGrab;
|
|
8800
|
+
/** While linking, a node click attaches the branch — swallow the selection. */
|
|
8801
|
+
private _onNodeSelect;
|
|
8802
|
+
/**
|
|
8803
|
+
* A node's output stem port was clicked. If a branch is already in flight from
|
|
8804
|
+
* another node, attach it here; otherwise start one — from the node's first
|
|
8805
|
+
* open output if it has one, else as a brand-new branch (materialised by the
|
|
8806
|
+
* builder on attach).
|
|
8807
|
+
*/
|
|
8808
|
+
private _onPortClick;
|
|
8809
|
+
private _startLink;
|
|
8810
|
+
private _onLinkPointerMove;
|
|
8811
|
+
private _onLinkKeyDown;
|
|
8812
|
+
private _cancelLink;
|
|
8813
|
+
private _onPointerMove;
|
|
8814
|
+
private _onPointerUp;
|
|
8815
|
+
private _beginMove;
|
|
8816
|
+
/**
|
|
8817
|
+
* A node's outputs all leave from a single bottom-centre stem and fan out along a
|
|
8818
|
+
* shared horizontal bus — one branch per output. Each branch drops on the source's
|
|
8819
|
+
* own side (so fan-in branches from different nodes never stack their pills), then
|
|
8820
|
+
* routes to its connected child or ends in a "+" add-point (open).
|
|
8821
|
+
*/
|
|
8822
|
+
private _outputLayout;
|
|
8823
|
+
/** Canvas-space anchor of a node's input port for an incoming connection. */
|
|
8824
|
+
private _inputAnchor;
|
|
8825
|
+
/**
|
|
8826
|
+
* Per-connection nudges for elbow horizontals. An elbow runs at the exact
|
|
8827
|
+
* midpoint of its gap (equal drop and approach) unless wires to *different*
|
|
8828
|
+
* targets would share the same line — those read as a merge, so each
|
|
8829
|
+
* conflicting target gets its own grid-step offset. Wires fanning in to the
|
|
8830
|
+
* same input keep sharing a line: their join is real.
|
|
8831
|
+
*/
|
|
8832
|
+
private _elbowMidOffsets;
|
|
8833
|
+
/** Whether an orthogonal segment passes through any node card (with margin). */
|
|
8834
|
+
private _segmentBlocked;
|
|
8835
|
+
private _routeClear;
|
|
8836
|
+
/**
|
|
8837
|
+
* Orthogonal waypoints from a branch exit to a child's input. The wire always
|
|
8838
|
+
* enters the input from above (arrow pointing down), and never passes through
|
|
8839
|
+
* a node card: each candidate route is checked against every card, scanning
|
|
8840
|
+
* alternative lanes / side-steps / detours until one is clear.
|
|
8841
|
+
*/
|
|
8842
|
+
private _routePoints;
|
|
8843
|
+
private static _pathFrom;
|
|
8844
|
+
/**
|
|
8845
|
+
* Open output slots ("+" add-points) across all nodes — only rendered while
|
|
8846
|
+
* they're meaningful targets (dragging a step in, or moving a node). Idle
|
|
8847
|
+
* canvases show no stray stubs; branches start from the node's output port.
|
|
8848
|
+
*/
|
|
8849
|
+
private _addPoints;
|
|
8850
|
+
/** Midpoint "+" insert-points on each connected branch (hidden while moving). */
|
|
8851
|
+
private _wirePoints;
|
|
8852
|
+
/** Convert a canvas-space point to screen coordinates (for anchoring popovers). */
|
|
8853
|
+
private _screenFromCanvas;
|
|
8854
|
+
private _onAddClick;
|
|
8855
|
+
private _onWireAddClick;
|
|
8856
|
+
private _onViewportDragOver;
|
|
8857
|
+
private _onViewportDragLeave;
|
|
8858
|
+
private _clearDropGhost;
|
|
8859
|
+
private _onAddPointDragOver;
|
|
8860
|
+
private _onAddDrop;
|
|
8861
|
+
private _onWireDrop;
|
|
8862
|
+
private _zoomBy;
|
|
8863
|
+
/** Canvas-space bounding box of the whole flow: nodes, branch drops, and notes. */
|
|
8864
|
+
private _contentBounds;
|
|
8865
|
+
/** Reset zoom and centre the flow in the viewport, zooming out to fit if needed. */
|
|
8866
|
+
private _resetView;
|
|
8867
|
+
private _viewportCursorClass;
|
|
8868
|
+
private _renderConnections;
|
|
8869
|
+
/**
|
|
8870
|
+
* Output labels (branch names) render as a clickable pill on their branch;
|
|
8871
|
+
* hovering slides out a delete button that removes the branch (and its wire).
|
|
8872
|
+
* Keyed by node+port so deleting one never hands its DOM (with its hovered,
|
|
8873
|
+
* visible delete button) to a different pill — which flickered on screen.
|
|
8874
|
+
*/
|
|
8875
|
+
private _renderBranchPills;
|
|
8876
|
+
private _renderAddPoints;
|
|
8877
|
+
private _renderWireAddPoints;
|
|
8878
|
+
private _renderDropGhost;
|
|
8879
|
+
private _startNoteGrab;
|
|
8880
|
+
private _startNoteResize;
|
|
8881
|
+
private _renderNotes;
|
|
8882
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
8883
|
+
}
|
|
8884
|
+
}
|
|
8885
|
+
declare module "components/flow-builder/modules/flow-canvas/index" {
|
|
8886
|
+
import ZnFlowCanvas from "components/flow-builder/modules/flow-canvas/flow-canvas.component";
|
|
8887
|
+
export * from "components/flow-builder/modules/flow-canvas/flow-canvas.component";
|
|
8888
|
+
export default ZnFlowCanvas;
|
|
8889
|
+
global {
|
|
8890
|
+
interface HTMLElementTagNameMap {
|
|
8891
|
+
'zn-flow-canvas': ZnFlowCanvas;
|
|
8892
|
+
}
|
|
8893
|
+
}
|
|
8894
|
+
}
|
|
8895
|
+
declare module "components/flow-builder/modules/flow-step-group/flow-step-group.component" {
|
|
8896
|
+
import { type CSSResultGroup } from 'lit';
|
|
8897
|
+
import ZincElement from "internal/zinc-element";
|
|
8898
|
+
import ZnCollapsible from "components/collapsible/index";
|
|
8899
|
+
/**
|
|
8900
|
+
* @summary A collapsible category of `<zn-flow-step>`s inside a `<zn-flow-steps>` (typically a `<zn-tabs>` panel).
|
|
8901
|
+
* Wraps `<zn-collapsible>` for the standard expand/collapse behaviour and spacing.
|
|
8902
|
+
* @documentation https://zinc.style/components/flow-step-group
|
|
8903
|
+
* @status experimental
|
|
8904
|
+
* @since 1.0
|
|
8905
|
+
*
|
|
8906
|
+
* @dependency zn-collapsible
|
|
8907
|
+
*
|
|
8908
|
+
* @slot - The group's `<zn-flow-step>`s.
|
|
8909
|
+
*/
|
|
8910
|
+
export default class ZnFlowStepGroup extends ZincElement {
|
|
8911
|
+
static styles: CSSResultGroup;
|
|
8912
|
+
static dependencies: {
|
|
8913
|
+
'zn-collapsible': typeof ZnCollapsible;
|
|
8914
|
+
};
|
|
8915
|
+
caption: string;
|
|
8916
|
+
/** Start collapsed. Defaults to open. */
|
|
8917
|
+
collapsed: boolean;
|
|
8918
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
8919
|
+
}
|
|
8920
|
+
}
|
|
8921
|
+
declare module "components/flow-builder/modules/flow-step-group/index" {
|
|
8922
|
+
import ZnFlowStepGroup from "components/flow-builder/modules/flow-step-group/flow-step-group.component";
|
|
8923
|
+
export * from "components/flow-builder/modules/flow-step-group/flow-step-group.component";
|
|
8924
|
+
export default ZnFlowStepGroup;
|
|
8925
|
+
global {
|
|
8926
|
+
interface HTMLElementTagNameMap {
|
|
8927
|
+
'zn-flow-step-group': ZnFlowStepGroup;
|
|
8928
|
+
}
|
|
8929
|
+
}
|
|
8930
|
+
}
|
|
8931
|
+
declare module "components/flow-builder/flow-layout" {
|
|
8932
|
+
import { type FlowNodeType, type FlowState } from "components/flow-builder/flow.types";
|
|
8933
|
+
/** Horizontal gap between node origins within a layer. */
|
|
8934
|
+
export const LAYOUT_H_GAP: number;
|
|
8935
|
+
/** Vertical gap between layers — clears the bus, a branch pill, and the wire run-in. */
|
|
8936
|
+
export const LAYOUT_V_GAP = 300;
|
|
8937
|
+
/**
|
|
8938
|
+
* "Untangle" auto-layout: assigns every node a position in a layered, top-down
|
|
8939
|
+
* flow. Layers come from the longest path back to a root (the graph is a DAG —
|
|
8940
|
+
* connects are cycle-guarded), ordering within a layer follows where each node's
|
|
8941
|
+
* parents sit (barycenter, respecting the parents' output-port order), and the
|
|
8942
|
+
* coordinate passes centre children under the branch anchors they hang from.
|
|
8943
|
+
* Returns the new positions; the caller applies them.
|
|
8944
|
+
*/
|
|
8945
|
+
export function untangledPositions(state: FlowState, typeOf: (type: string) => FlowNodeType | undefined): Map<string, {
|
|
8946
|
+
x: number;
|
|
8947
|
+
y: number;
|
|
8948
|
+
}>;
|
|
8949
|
+
}
|
|
8950
|
+
declare module "components/flow-builder/flow-builder.component" {
|
|
8951
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
8952
|
+
import ZincElement from "internal/zinc-element";
|
|
8953
|
+
import ZnFlowCanvas from "components/flow-builder/modules/flow-canvas/index";
|
|
8954
|
+
import ZnFlowStepGroup from "components/flow-builder/modules/flow-step-group/index";
|
|
8955
|
+
import ZnIcon from "components/icon/index";
|
|
8956
|
+
import ZnInput from "components/input/index";
|
|
8957
|
+
import ZnNavbar from "components/navbar/index";
|
|
8958
|
+
import ZnTabs from "components/tabs/index";
|
|
8959
|
+
import { type FlowNodeType, type FlowState } from "components/flow-builder/flow.types";
|
|
8960
|
+
/**
|
|
8961
|
+
* @summary A drag-and-drop visual flow builder: steps panel, pan/zoom canvas, and a config inspector.
|
|
8962
|
+
* @documentation https://zinc.style/components/flow-builder
|
|
8963
|
+
* @status experimental
|
|
8964
|
+
* @since 1.0
|
|
8965
|
+
*
|
|
8966
|
+
* @dependency zn-icon
|
|
8967
|
+
* @dependency zn-input
|
|
8968
|
+
* @dependency zn-tabs
|
|
8969
|
+
* @dependency zn-navbar
|
|
8970
|
+
* @dependency zn-flow-canvas
|
|
8971
|
+
* @dependency zn-flow-node
|
|
8972
|
+
*
|
|
8973
|
+
* @event zn-flow-change - Emitted whenever the flow state changes. `event.detail.state` is the new FlowState.
|
|
8974
|
+
* @event zn-flow-selection-change - Emitted when the selected node changes. `event.detail.nodeId`.
|
|
8975
|
+
* @event zn-flow-connect - Emitted when a connection is created. `event.detail.connection`.
|
|
8976
|
+
*
|
|
8977
|
+
* @slot - `<zn-flow-step>` type declarations; never displayed, each `group`/`category` routes the
|
|
8978
|
+
* step into the right tab and collapsible grouping of the rendered panel.
|
|
8979
|
+
* @slot header-left - Actions shown on the left of the header bar (e.g. Close / Undo All Changes).
|
|
8980
|
+
* @slot header-right - Actions shown on the right of the header bar (e.g. Apply Changes).
|
|
8981
|
+
* @slot sidebar - Extra right-panel content (status, version history), below the configuration errors.
|
|
8982
|
+
*
|
|
8983
|
+
* @csspart base - The grid wrapper.
|
|
8984
|
+
* @csspart header - The full-width header action bar (only rendered when header slots are filled).
|
|
8985
|
+
* @csspart steps - The left steps panel.
|
|
8986
|
+
* @csspart inspector - The right panel while a node or branch is selected.
|
|
8987
|
+
*/
|
|
8988
|
+
export default class ZnFlowBuilder extends ZincElement {
|
|
8989
|
+
static styles: CSSResultGroup;
|
|
8990
|
+
static dependencies: {
|
|
8991
|
+
'zn-icon': typeof ZnIcon;
|
|
8992
|
+
'zn-input': typeof ZnInput;
|
|
8993
|
+
'zn-tabs': typeof ZnTabs;
|
|
8994
|
+
'zn-navbar': typeof ZnNavbar;
|
|
8995
|
+
'zn-flow-canvas': typeof ZnFlowCanvas;
|
|
8996
|
+
'zn-flow-step-group': typeof ZnFlowStepGroup;
|
|
8997
|
+
};
|
|
8998
|
+
/** Node types to make available, registered into the internal registry. */
|
|
8999
|
+
nodeTypes: FlowNodeType[];
|
|
9000
|
+
heading: string;
|
|
9001
|
+
subheading: string;
|
|
9002
|
+
/** Node ids flagged as having configuration errors (drives the red node styling). */
|
|
9003
|
+
errorNodes: string[];
|
|
9004
|
+
/** Optional hint shown beneath each steps-panel tab. */
|
|
9005
|
+
entrypointsHint: string;
|
|
9006
|
+
triggersHint: string;
|
|
9007
|
+
actionsHint: string;
|
|
9008
|
+
rulesHint: string;
|
|
9009
|
+
private registry;
|
|
9010
|
+
private _state;
|
|
9011
|
+
private _selectedNodeId;
|
|
9012
|
+
/** The output branch open in the branch editor, if any. */
|
|
9013
|
+
private _selectedBranch;
|
|
9014
|
+
private _search;
|
|
9015
|
+
/** The steps-panel tab currently shown; the search only filters this tab. */
|
|
9016
|
+
private _activeGroup;
|
|
9017
|
+
private readonly _hasSlot;
|
|
9018
|
+
/** The node being relocated via the MOVE menu action, if any. */
|
|
9019
|
+
private _movingNodeId;
|
|
9020
|
+
/** The "+" picker popover target (an open output, or a wire to insert into), if open. */
|
|
9021
|
+
private _picker;
|
|
9022
|
+
/** The node type currently being dragged from the steps panel, for the canvas drop preview. */
|
|
9023
|
+
private _draggingType;
|
|
9024
|
+
private _history;
|
|
9025
|
+
private _redo;
|
|
9026
|
+
private _seq;
|
|
9027
|
+
private _untangleRaf;
|
|
9028
|
+
/** Applies the in-flight untangle's final positions; used when it's cut short. */
|
|
9029
|
+
private _untangleSettle;
|
|
9030
|
+
/**
|
|
9031
|
+
* Bumped whenever the state is replaced wholesale (undo / redo / setState) so the
|
|
9032
|
+
* guarded renderConfig / renderBranchConfig bodies rebuild against the fresh node
|
|
9033
|
+
* objects. Value edits don't bump it — the consumer's config DOM stays in place,
|
|
9034
|
+
* which is what lets its inputs commit live without losing focus.
|
|
9035
|
+
*/
|
|
9036
|
+
private _configRevision;
|
|
9037
|
+
private get _listeners();
|
|
9038
|
+
connectedCallback(): void;
|
|
9039
|
+
disconnectedCallback(): void;
|
|
9040
|
+
private _onKeyDown;
|
|
9041
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
9042
|
+
protected firstUpdated(changed: PropertyValues): void;
|
|
9043
|
+
private static _parsePorts;
|
|
9044
|
+
private _typeFromStep;
|
|
9045
|
+
/** Register a FlowNodeType for every slotted <zn-flow-step>. */
|
|
9046
|
+
private _registerSlottedTypes;
|
|
9047
|
+
registerNodeType(type: FlowNodeType): this;
|
|
9048
|
+
registerNodeTypes(types: FlowNodeType[]): this;
|
|
9049
|
+
getState(): FlowState;
|
|
9050
|
+
setState(next: FlowState): void;
|
|
9051
|
+
get value(): string;
|
|
9052
|
+
set value(json: string);
|
|
9053
|
+
undo: () => void;
|
|
9054
|
+
redo: () => void;
|
|
9055
|
+
/**
|
|
9056
|
+
* Auto-arrange the nodes into evenly spaced layers that follow the flow,
|
|
9057
|
+
* animating them into place (wires and pills track them since everything is
|
|
9058
|
+
* derived from the node coordinates). Undoable as a single step.
|
|
9059
|
+
*/
|
|
9060
|
+
untangle: () => void;
|
|
9061
|
+
private _cancelUntangle;
|
|
9062
|
+
private _clone;
|
|
9063
|
+
private _pushHistory;
|
|
9064
|
+
private _commit;
|
|
9065
|
+
/**
|
|
9066
|
+
* Drop connections whose endpoints reference ports that no longer exist — e.g.
|
|
9067
|
+
* after a user removes a node's output (branch) via its config.
|
|
9068
|
+
*/
|
|
9069
|
+
private _pruneConnections;
|
|
9070
|
+
private _syncSelection;
|
|
9071
|
+
/** The node + output port of the branch open in the editor, if both still exist. */
|
|
9072
|
+
private _branchSelection;
|
|
9073
|
+
private _id;
|
|
9074
|
+
/**
|
|
9075
|
+
* Snap to the grid and, if another node's footprint (card or branch pills)
|
|
9076
|
+
* occupies the spot, walk outward in grid-step rings to the nearest free one.
|
|
9077
|
+
*/
|
|
9078
|
+
private _freePosition;
|
|
9079
|
+
private _addNode;
|
|
9080
|
+
private _deleteNode;
|
|
9081
|
+
private _duplicateNode;
|
|
9082
|
+
/** Canvas position for a node newly placed off a source node's output. */
|
|
9083
|
+
private _positionBelowOutput;
|
|
9084
|
+
/**
|
|
9085
|
+
* Resolve an output port id on a node: the "new branch" sentinel materialises a
|
|
9086
|
+
* fresh, labelled output port (per-instance), so it exists before connecting.
|
|
9087
|
+
*/
|
|
9088
|
+
private _ensureOutput;
|
|
9089
|
+
/**
|
|
9090
|
+
* Every connected output is a configurable branch — default its name so the
|
|
9091
|
+
* pill renders, however the connection was made (arrow, drop, or move).
|
|
9092
|
+
*/
|
|
9093
|
+
private _ensureBranchLabel;
|
|
9094
|
+
/** Create a node and attach it to an open output slot of an existing node. */
|
|
9095
|
+
private _addNodeAtOutput;
|
|
9096
|
+
/**
|
|
9097
|
+
* Wire an open output to an existing node — targets its first input. Fan-in
|
|
9098
|
+
* and loops (a branch pointing back to an earlier step) are both allowed;
|
|
9099
|
+
* only wiring a node directly to itself is refused.
|
|
9100
|
+
*/
|
|
9101
|
+
private _linkNodeAtOutput;
|
|
9102
|
+
/** Insert a new node in the middle of an existing connection (split the wire). */
|
|
9103
|
+
private _insertNodeOnWire;
|
|
9104
|
+
private _select;
|
|
9105
|
+
private _onBranchPick;
|
|
9106
|
+
/** Remove an output branch and its wire. Undoable. */
|
|
9107
|
+
private _onBranchDelete;
|
|
9108
|
+
private _onSelect;
|
|
9109
|
+
private _onNodeAction;
|
|
9110
|
+
private _onInteractionStart;
|
|
9111
|
+
private _onOutputAssign;
|
|
9112
|
+
/** A stray branch was attached to an existing node (fan-in). */
|
|
9113
|
+
private _onLinkAssign;
|
|
9114
|
+
private _onWirePick;
|
|
9115
|
+
private _onWireAssign;
|
|
9116
|
+
/** Re-attach the node being moved to the chosen open output slot. */
|
|
9117
|
+
private _onOutputMoveTarget;
|
|
9118
|
+
private _onAddNote;
|
|
9119
|
+
private _onNoteChange;
|
|
9120
|
+
private _onNoteDelete;
|
|
9121
|
+
private _onDragStart;
|
|
9122
|
+
private _onDragEnd;
|
|
9123
|
+
private _onStepDrag;
|
|
9124
|
+
private _onCanvasDragOver;
|
|
9125
|
+
private _onCanvasDrop;
|
|
9126
|
+
private _renderSteps;
|
|
9127
|
+
private _hintFor;
|
|
9128
|
+
private _renderStep;
|
|
9129
|
+
private _renderStepsContent;
|
|
9130
|
+
private _renderStepsPanel;
|
|
9131
|
+
private _renderInspector;
|
|
9132
|
+
/** Replace one of the node's output ports (per-instance override), keeping its id. */
|
|
9133
|
+
private _updateBranch;
|
|
9134
|
+
private _renderBranchEditor;
|
|
9135
|
+
private _renderRightPanel;
|
|
9136
|
+
private _renderHeader;
|
|
9137
|
+
private _renderSidebar;
|
|
9138
|
+
private _renderPicker;
|
|
9139
|
+
private _pickType;
|
|
9140
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
9141
|
+
}
|
|
9142
|
+
}
|
|
9143
|
+
declare module "components/flow-builder/index" {
|
|
9144
|
+
import ZnFlowBuilder from "components/flow-builder/flow-builder.component";
|
|
9145
|
+
export * from "components/flow-builder/flow-builder.component";
|
|
9146
|
+
export * from "components/flow-builder/flow.types";
|
|
9147
|
+
export * from "components/flow-builder/flow-registry";
|
|
9148
|
+
export default ZnFlowBuilder;
|
|
9149
|
+
global {
|
|
9150
|
+
interface HTMLElementTagNameMap {
|
|
9151
|
+
'zn-flow-builder': ZnFlowBuilder;
|
|
9152
|
+
}
|
|
9153
|
+
}
|
|
9154
|
+
}
|
|
9155
|
+
declare module "components/flow-builder/modules/flow-steps/flow-steps.component" {
|
|
9156
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
9157
|
+
import ZincElement from "internal/zinc-element";
|
|
9158
|
+
import ZnInput from "components/input/index";
|
|
9159
|
+
/**
|
|
9160
|
+
* @summary A search + scroll wrapper for building a standalone steps panel. Place a standard
|
|
9161
|
+
* `<zn-tabs>` (with a `<zn-navbar slot="top">` and panels of `<zn-flow-step-group>` /
|
|
9162
|
+
* `<zn-flow-step>`) inside it; the search box filters the slotted items.
|
|
9163
|
+
* @documentation https://zinc.style/components/flow-steps
|
|
9164
|
+
* @status experimental
|
|
9165
|
+
* @since 1.0
|
|
9166
|
+
*
|
|
9167
|
+
* @dependency zn-input
|
|
9168
|
+
*
|
|
9169
|
+
* @slot - The steps panel content, typically a `<zn-tabs>`.
|
|
9170
|
+
*
|
|
9171
|
+
* @csspart search - The search input.
|
|
9172
|
+
*/
|
|
9173
|
+
export default class ZnFlowSteps extends ZincElement {
|
|
9174
|
+
static styles: CSSResultGroup;
|
|
9175
|
+
static dependencies: {
|
|
9176
|
+
'zn-input': typeof ZnInput;
|
|
9177
|
+
};
|
|
9178
|
+
searchable: boolean;
|
|
9179
|
+
searchPlaceholder: string;
|
|
9180
|
+
private _search;
|
|
9181
|
+
/** Re-applies the filter when zn-tabs moves `selected` to another panel. */
|
|
9182
|
+
private _tabObserver;
|
|
9183
|
+
connectedCallback(): void;
|
|
9184
|
+
disconnectedCallback(): void;
|
|
9185
|
+
protected updated(changed: PropertyValues): void;
|
|
9186
|
+
/** True when the element isn't tabbed, or sits in the active (selected) tab panel. */
|
|
9187
|
+
private _inActiveTab;
|
|
9188
|
+
/** Filter the slotted items (and hide emptied groups) by the search term — active tab only. */
|
|
9189
|
+
private _applyFilter;
|
|
9190
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
9191
|
+
}
|
|
9192
|
+
}
|
|
9193
|
+
declare module "components/flow-builder/modules/flow-steps/index" {
|
|
9194
|
+
import ZnFlowSteps from "components/flow-builder/modules/flow-steps/flow-steps.component";
|
|
9195
|
+
export * from "components/flow-builder/modules/flow-steps/flow-steps.component";
|
|
9196
|
+
export default ZnFlowSteps;
|
|
9197
|
+
global {
|
|
9198
|
+
interface HTMLElementTagNameMap {
|
|
9199
|
+
'zn-flow-steps': ZnFlowSteps;
|
|
9200
|
+
}
|
|
9201
|
+
}
|
|
9202
|
+
}
|
|
9203
|
+
declare module "components/flow-builder/modules/flow-step/flow-step.component" {
|
|
9204
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
9205
|
+
import ZincElement from "internal/zinc-element";
|
|
9206
|
+
import ZnIcon from "components/icon/index";
|
|
9207
|
+
/**
|
|
9208
|
+
* @summary A draggable step in the `<zn-flow-steps>`, representing a registered node type. Drag
|
|
9209
|
+
* it onto the canvas (or a "+" slot) of a `<zn-flow-builder>` to add that step.
|
|
9210
|
+
* @documentation https://zinc.style/components/flow-step
|
|
9211
|
+
* @status experimental
|
|
9212
|
+
* @since 1.0
|
|
9213
|
+
*
|
|
9214
|
+
* @dependency zn-icon
|
|
9215
|
+
*
|
|
9216
|
+
* @event flow-step-drag - Emitted on dragstart with `detail.type`, so the builder can preview the drop.
|
|
9217
|
+
* @event flow-step-drag-end - Emitted on dragend.
|
|
9218
|
+
*
|
|
9219
|
+
* @slot - The step's label.
|
|
9220
|
+
*
|
|
9221
|
+
* @csspart base - The row.
|
|
9222
|
+
*/
|
|
9223
|
+
export default class ZnFlowStep extends ZincElement {
|
|
9224
|
+
static styles: CSSResultGroup;
|
|
9225
|
+
static dependencies: {
|
|
9226
|
+
'zn-icon': typeof ZnIcon;
|
|
9227
|
+
};
|
|
9228
|
+
/** The node type id this item creates when dropped. */
|
|
9229
|
+
type: string;
|
|
9230
|
+
/** Display label; falls back to the slotted text. Also used as the node's label. */
|
|
9231
|
+
label: string;
|
|
9232
|
+
icon: string;
|
|
9233
|
+
iconLibrary: string;
|
|
9234
|
+
color: string;
|
|
9235
|
+
description: string;
|
|
9236
|
+
/** JSON array of input ports — `""` for a trigger (no input), omit for a single default input. */
|
|
9237
|
+
inputs: string;
|
|
9238
|
+
/** JSON array of outputs (`"a"` or `{"id","label"}`), e.g. `'[{"id":"true","label":"TRUE"}]'`. Omit for one default output. */
|
|
9239
|
+
outputs: string;
|
|
9240
|
+
connectedCallback(): void;
|
|
9241
|
+
disconnectedCallback(): void;
|
|
9242
|
+
protected updated(changed: PropertyValues): void;
|
|
9243
|
+
private _onDragStart;
|
|
9244
|
+
private _onDragEnd;
|
|
9245
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
9246
|
+
}
|
|
9247
|
+
}
|
|
9248
|
+
declare module "components/flow-builder/modules/flow-step/index" {
|
|
9249
|
+
import ZnFlowStep from "components/flow-builder/modules/flow-step/flow-step.component";
|
|
9250
|
+
export * from "components/flow-builder/modules/flow-step/flow-step.component";
|
|
9251
|
+
export default ZnFlowStep;
|
|
9252
|
+
global {
|
|
9253
|
+
interface HTMLElementTagNameMap {
|
|
9254
|
+
'zn-flow-step': ZnFlowStep;
|
|
9255
|
+
}
|
|
9256
|
+
}
|
|
9257
|
+
}
|
|
8431
9258
|
declare module "utilities/form" {
|
|
8432
9259
|
export { clearFormStoreValues } from "internal/form";
|
|
8433
9260
|
}
|
|
@@ -8541,6 +9368,38 @@ declare module "events/zn-reject" {
|
|
|
8541
9368
|
}
|
|
8542
9369
|
}
|
|
8543
9370
|
}
|
|
9371
|
+
declare module "events/zn-flow-change" {
|
|
9372
|
+
import type { FlowState } from "components/flow-builder/flow.types";
|
|
9373
|
+
export type ZnFlowChangeEvent = CustomEvent<{
|
|
9374
|
+
state: FlowState;
|
|
9375
|
+
}>;
|
|
9376
|
+
global {
|
|
9377
|
+
interface GlobalEventHandlersEventMap {
|
|
9378
|
+
'zn-flow-change': ZnFlowChangeEvent;
|
|
9379
|
+
}
|
|
9380
|
+
}
|
|
9381
|
+
}
|
|
9382
|
+
declare module "events/zn-flow-selection-change" {
|
|
9383
|
+
export type ZnFlowSelectionChangeEvent = CustomEvent<{
|
|
9384
|
+
nodeId: string | null;
|
|
9385
|
+
}>;
|
|
9386
|
+
global {
|
|
9387
|
+
interface GlobalEventHandlersEventMap {
|
|
9388
|
+
'zn-flow-selection-change': ZnFlowSelectionChangeEvent;
|
|
9389
|
+
}
|
|
9390
|
+
}
|
|
9391
|
+
}
|
|
9392
|
+
declare module "events/zn-flow-connect" {
|
|
9393
|
+
import type { FlowConnection } from "components/flow-builder/flow.types";
|
|
9394
|
+
export type ZnFlowConnectEvent = CustomEvent<{
|
|
9395
|
+
connection: FlowConnection;
|
|
9396
|
+
}>;
|
|
9397
|
+
global {
|
|
9398
|
+
interface GlobalEventHandlersEventMap {
|
|
9399
|
+
'zn-flow-connect': ZnFlowConnectEvent;
|
|
9400
|
+
}
|
|
9401
|
+
}
|
|
9402
|
+
}
|
|
8544
9403
|
declare module "events/events" {
|
|
8545
9404
|
export type { ZnAfterHideEvent } from "events/zn-after-hide";
|
|
8546
9405
|
export type { ZnAfterShowEvent } from "events/zn-after-show";
|
|
@@ -8556,6 +9415,9 @@ declare module "events/events" {
|
|
|
8556
9415
|
export type { ZnReorderEvent } from "events/zn-reorder";
|
|
8557
9416
|
export type { ZnAcceptEvent } from "events/zn-accept";
|
|
8558
9417
|
export type { ZnRejectEvent } from "events/zn-reject";
|
|
9418
|
+
export type { ZnFlowChangeEvent } from "events/zn-flow-change";
|
|
9419
|
+
export type { ZnFlowSelectionChangeEvent } from "events/zn-flow-selection-change";
|
|
9420
|
+
export type { ZnFlowConnectEvent } from "events/zn-flow-connect";
|
|
8559
9421
|
}
|
|
8560
9422
|
declare module "zinc" {
|
|
8561
9423
|
export { default as Button } from "components/button/index";
|
|
@@ -8659,6 +9521,10 @@ declare module "zinc" {
|
|
|
8659
9521
|
export { default as OptGroup } from "components/opt-group/index";
|
|
8660
9522
|
export { default as PriorityList } from "components/priority-list/index";
|
|
8661
9523
|
export { default as MarkdownEditor } from "components/markdown-editor/index";
|
|
9524
|
+
export { default as FlowBuilder } from "components/flow-builder/index";
|
|
9525
|
+
export { default as FlowSteps } from "components/flow-builder/modules/flow-steps/index";
|
|
9526
|
+
export { default as FlowStepGroup } from "components/flow-builder/modules/flow-step-group/index";
|
|
9527
|
+
export { default as FlowStep } from "components/flow-builder/modules/flow-step/index";
|
|
8662
9528
|
export { default as ZincElement } from "internal/zinc-element";
|
|
8663
9529
|
export * from "utilities/on";
|
|
8664
9530
|
export * from "utilities/query";
|