@notmrabhi/flowforge 0.1.14 → 0.1.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/dist/canvas.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./templateSkeletons-DT30F9Rm.js"),t=require("./messages-O9Tw_XXR.js"),r=require("./bpmn-CcuE2X_Q.js"),e=require("./GatewayBranchEdge-CrDMz9RP.js");exports.FlowForgeCanvas=o.FlowForgeCanvas;exports.SubWorkflowPreviewDrawer=o.SubWorkflowPreviewDrawer;exports.WorkflowCanvas=o.FlowForgeCanvas;exports.WorkflowExecutionHistory=o.WorkflowExecutionHistory;exports.WorkflowTemplateLibrary=o.WorkflowTemplateLibrary;exports.accessRequestSkeleton=o.accessRequestSkeleton;exports.offboardingSkeleton=o.offboardingSkeleton;exports.userOnboardingSkeleton=o.userOnboardingSkeleton;exports.webhookIntegrationSkeleton=o.webhookIntegrationSkeleton;exports.defaultFlowForgeMessages=t.defaultFlowForgeMessages;exports.loadWorkflowFromBpmn=r.loadWorkflowFromBpmn;exports.saveWorkflowToBpmn=r.saveWorkflowToBpmn;exports.ActionNode=e.ActionNode;exports.ApprovalNode=e.ApprovalNode;exports.EdgeWithPlusLabel=e.EdgeWithPlusLabel;exports.EndNode=e.EndNode;exports.FilterNode=e.FilterNode;exports.RestApiNode=e.RestApiNode;exports.StartNode=e.StartNode;exports.TriggerNode=e.TriggerNode;exports.WebhookTriggerNode=e.WebhookTriggerNode;exports.builtInNodeTypes=e.builtInNodeTypes;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./templateSkeletons-BKaXZuM9.js"),t=require("./messages-O9Tw_XXR.js"),r=require("./bpmn-CcuE2X_Q.js"),e=require("./GatewayBranchEdge-CFre76ne.js");exports.FlowForgeCanvas=o.FlowForgeCanvas;exports.SubWorkflowPreviewDrawer=o.SubWorkflowPreviewDrawer;exports.WorkflowCanvas=o.FlowForgeCanvas;exports.WorkflowExecutionHistory=o.WorkflowExecutionHistory;exports.WorkflowTemplateLibrary=o.WorkflowTemplateLibrary;exports.accessRequestSkeleton=o.accessRequestSkeleton;exports.offboardingSkeleton=o.offboardingSkeleton;exports.userOnboardingSkeleton=o.userOnboardingSkeleton;exports.webhookIntegrationSkeleton=o.webhookIntegrationSkeleton;exports.defaultFlowForgeMessages=t.defaultFlowForgeMessages;exports.loadWorkflowFromBpmn=r.loadWorkflowFromBpmn;exports.saveWorkflowToBpmn=r.saveWorkflowToBpmn;exports.ActionNode=e.ActionNode;exports.ApprovalNode=e.ApprovalNode;exports.EdgeWithPlusLabel=e.EdgeWithPlusLabel;exports.EndNode=e.EndNode;exports.FilterNode=e.FilterNode;exports.RestApiNode=e.RestApiNode;exports.StartNode=e.StartNode;exports.TriggerNode=e.TriggerNode;exports.WebhookTriggerNode=e.WebhookTriggerNode;exports.builtInNodeTypes=e.builtInNodeTypes;
package/dist/canvas.d.ts CHANGED
@@ -45,11 +45,13 @@ export declare interface BpmnSaveOptions {
45
45
 
46
46
  declare type BranchChain = CanvasSlot_2[];
47
47
 
48
- declare type BranchChain_2 = CanvasSlot[];
48
+ declare type BranchChain_2 = CanvasSlot_3[];
49
+
50
+ declare type BranchChain_3 = CanvasSlot[];
49
51
 
50
52
  export declare interface BranchMap {
51
53
  [filterId: string]: {
52
- [branchKey: string]: BranchChain_2;
54
+ [branchKey: string]: BranchChain_3;
53
55
  };
54
56
  }
55
57
 
@@ -59,11 +61,17 @@ declare interface BranchMap_2 {
59
61
  };
60
62
  }
61
63
 
64
+ declare interface BranchMap_3 {
65
+ [filterId: string]: {
66
+ [branchKey: string]: BranchChain_2;
67
+ };
68
+ }
69
+
62
70
  export declare const builtInNodeTypes: NodeTypes;
63
71
 
64
72
  export declare interface CanvasSlot {
65
73
  id: string;
66
- kind: SlotKind_2;
74
+ kind: SlotKind_3;
67
75
  reactFlowType: string;
68
76
  descriptorType?: string;
69
77
  formData?: Record<string, unknown>;
@@ -87,6 +95,19 @@ declare interface CanvasSlot_2 {
87
95
  branchLabels?: Record<string, string>;
88
96
  }
89
97
 
98
+ declare interface CanvasSlot_3 {
99
+ id: string;
100
+ kind: SlotKind_2;
101
+ reactFlowType: string;
102
+ descriptorType?: string;
103
+ formData?: Record<string, unknown>;
104
+ nodeData?: Record<string, unknown>;
105
+ deletable?: boolean;
106
+ label?: string;
107
+ /** Maps branch key → display label. e.g. { pass: 'Pass', fail: 'Fail' } */
108
+ branchLabels?: Record<string, string>;
109
+ }
110
+
90
111
  /** One column in a per-field condition row */
91
112
  declare interface ConditionFieldDef {
92
113
  /** Key used to store this column's value in ConditionEntry */
@@ -309,6 +330,12 @@ declare interface FixedEdge_2 {
309
330
  target: string;
310
331
  }
311
332
 
333
+ declare interface FixedEdge_3 {
334
+ id: string;
335
+ source: string;
336
+ target: string;
337
+ }
338
+
312
339
  declare interface FixedNode {
313
340
  id: string;
314
341
  type: string;
@@ -323,7 +350,14 @@ declare interface FixedNode_2 {
323
350
  deletable?: false;
324
351
  }
325
352
 
326
- declare const FlowForgeCanvas: ({ nodeRegistry, templateRegistry, initialValue, nodeTypes: consumerNodeTypes, edgeTypes: consumerEdgeTypes, onSave, readOnly, theme, messages: messageOverrides, canvasOptions, renderTriggerSelector, renderNodePicker, renderNodeConfig, onNodeClick: onNodeClickProp, maxNodes, layoutDirection, executionRecord, onFetchWorkflow, }: FlowForgeCanvasProps) => JSX_2.Element;
353
+ declare interface FixedNode_3 {
354
+ id: string;
355
+ type: string;
356
+ data?: Record<string, unknown>;
357
+ deletable?: false;
358
+ }
359
+
360
+ declare const FlowForgeCanvas: ({ nodeRegistry, templateRegistry, initialValue, nodeTypes: consumerNodeTypes, edgeTypes: consumerEdgeTypes, onSave, readOnly, theme, messages: messageOverrides, canvasOptions, renderTriggerSelector, loadTriggerSources, renderNodePicker, renderNodeConfig, onNodeClick: onNodeClickProp, maxNodes, layoutDirection, executionRecord, onFetchWorkflow, }: FlowForgeCanvasProps) => JSX_2.Element;
327
361
  export { FlowForgeCanvas }
328
362
  export { FlowForgeCanvas as WorkflowCanvas }
329
363
 
@@ -377,6 +411,20 @@ export declare interface FlowForgeCanvasProps {
377
411
  canvasOptions?: FlowForgeCanvasOptions;
378
412
  /** Replace the trigger selector UI entirely */
379
413
  renderTriggerSelector?: (templates: WorkflowTemplate[], onSelect: (t: WorkflowTemplate) => void, onClose: () => void) => default_2.ReactNode;
414
+ /**
415
+ * Optional async loader for trigger sources. When provided, the default
416
+ * trigger selector goes to a second stage after the user picks a trigger:
417
+ * the loader is called with the trigger's key, and if it returns a non-empty
418
+ * list, the user picks one or more sources before the canvas is seeded.
419
+ * Picked sources are merged into the trigger node's `nodeData.sources` so
420
+ * TriggerNode can render the "via [chip] [chip]" line.
421
+ *
422
+ * Return `[]` for triggers that have no sources — stage 2 is skipped.
423
+ */
424
+ loadTriggerSources?: (triggerKey: string) => Promise<Array<{
425
+ label: string;
426
+ value: string;
427
+ }>>;
380
428
  /** Replace the node picker UI entirely */
381
429
  renderNodePicker?: (descriptors: NodeDescriptor[], onSelect: (d: NodeDescriptor) => void, onClose: () => void) => default_2.ReactNode;
382
430
  /** Replace the node config drawer entirely */
@@ -432,6 +480,50 @@ export declare interface FlowForgeTheme {
432
480
  backgroundColor?: string;
433
481
  }
434
482
 
483
+ /**
484
+ * Context passed to `NodeDescriptor.canInsert(ctx)` describing where on the
485
+ * canvas the user clicked "+ Add step". Used by position-aware insertion rules.
486
+ */
487
+ declare interface InsertContext {
488
+ /** The slot the user clicked under (the one whose "+" edge was clicked). */
489
+ insertAfterSlot: CanvasSlot_2 | null;
490
+ /** Every slot before the insertion point, including the click slot.
491
+ * When inside a branch: spine up to + including the branching parent, then
492
+ * the branch's own slots up to the insertion point. */
493
+ upstreamSlots: CanvasSlot_2[];
494
+ /** Every slot after the insertion point in the same chain. */
495
+ downstreamSlots: CanvasSlot_2[];
496
+ /** Branch context, if the insertion is happening inside a branch. */
497
+ branch: {
498
+ filterId: string;
499
+ branch: string;
500
+ } | null;
501
+ /** The currently active template (the one whose trigger is in use). */
502
+ template: WorkflowTemplate_2 | null;
503
+ }
504
+
505
+ /**
506
+ * Context passed to `NodeDescriptor.canInsert(ctx)` describing where on the
507
+ * canvas the user clicked "+ Add step". Used by position-aware insertion rules.
508
+ */
509
+ declare interface InsertContext_2 {
510
+ /** The slot the user clicked under (the one whose "+" edge was clicked). */
511
+ insertAfterSlot: CanvasSlot | null;
512
+ /** Every slot before the insertion point, including the click slot.
513
+ * When inside a branch: spine up to + including the branching parent, then
514
+ * the branch's own slots up to the insertion point. */
515
+ upstreamSlots: CanvasSlot[];
516
+ /** Every slot after the insertion point in the same chain. */
517
+ downstreamSlots: CanvasSlot[];
518
+ /** Branch context, if the insertion is happening inside a branch. */
519
+ branch: {
520
+ filterId: string;
521
+ branch: string;
522
+ } | null;
523
+ /** The currently active template (the one whose trigger is in use). */
524
+ template: WorkflowTemplate | null;
525
+ }
526
+
435
527
  export declare function loadWorkflowFromBpmn(xml: string): WorkflowState;
436
528
 
437
529
  export declare interface NodeDescriptor {
@@ -465,6 +557,25 @@ export declare interface NodeDescriptor {
465
557
  * Receives the node's saved formData.
466
558
  */
467
559
  renderNode?: (nodeData: Record<string, unknown>) => ReactNode;
560
+ /**
561
+ * Position constraint — this descriptor can be inserted only if at least ONE
562
+ * of the listed tokens appears in the upstream chain of the click site.
563
+ * Tokens can be a descriptorType (e.g. 'createUserTask'), a slot id
564
+ * (e.g. 'event-userCreated'), or a slot kind (e.g. 'triggerFixed').
565
+ * Ignored when `canInsert` is set.
566
+ */
567
+ insertAfter?: string[];
568
+ /**
569
+ * Symmetric — must appear DOWNSTREAM of the click site. Same token rules
570
+ * as `insertAfter`. Ignored when `canInsert` is set.
571
+ */
572
+ insertBefore?: string[];
573
+ /**
574
+ * Full custom rule. Overrides `insertAfter` / `insertBefore`. Receives the
575
+ * click context (upstream/downstream slots, branch info, active template);
576
+ * returns `true` to allow the descriptor at this insertion point.
577
+ */
578
+ canInsert?: (ctx: InsertContext_2) => boolean;
468
579
  /** Maps branch key → display label. e.g. { pass: 'Pass', fail: 'Fail' }. Only applies to branching nodes (filterNode, approvalNode). */
469
580
  branchLabels?: Record<string, string>;
470
581
  formSchema: FieldDescriptor_2[] | ((nodeId: string) => Promise<FieldDescriptor_2[]>);
@@ -503,6 +614,25 @@ declare interface NodeDescriptor_2 {
503
614
  * Receives the node's saved formData.
504
615
  */
505
616
  renderNode?: (nodeData: Record<string, unknown>) => ReactNode;
617
+ /**
618
+ * Position constraint — this descriptor can be inserted only if at least ONE
619
+ * of the listed tokens appears in the upstream chain of the click site.
620
+ * Tokens can be a descriptorType (e.g. 'createUserTask'), a slot id
621
+ * (e.g. 'event-userCreated'), or a slot kind (e.g. 'triggerFixed').
622
+ * Ignored when `canInsert` is set.
623
+ */
624
+ insertAfter?: string[];
625
+ /**
626
+ * Symmetric — must appear DOWNSTREAM of the click site. Same token rules
627
+ * as `insertAfter`. Ignored when `canInsert` is set.
628
+ */
629
+ insertBefore?: string[];
630
+ /**
631
+ * Full custom rule. Overrides `insertAfter` / `insertBefore`. Receives the
632
+ * click context (upstream/downstream slots, branch info, active template);
633
+ * returns `true` to allow the descriptor at this insertion point.
634
+ */
635
+ canInsert?: (ctx: InsertContext) => boolean;
506
636
  /** Maps branch key → display label. e.g. { pass: 'Pass', fail: 'Fail' }. Only applies to branching nodes (filterNode, approvalNode). */
507
637
  branchLabels?: Record<string, string>;
508
638
  formSchema: FieldDescriptor[] | ((nodeId: string) => Promise<FieldDescriptor[]>);
@@ -528,6 +658,8 @@ declare type SlotKind = 'start' | 'end' | 'addTrigger' | 'triggerFixed' | 'userT
528
658
 
529
659
  declare type SlotKind_2 = 'start' | 'end' | 'addTrigger' | 'triggerFixed' | 'userTask' | 'addStep' | 'filter' | 'approval';
530
660
 
661
+ declare type SlotKind_3 = 'start' | 'end' | 'addTrigger' | 'triggerFixed' | 'userTask' | 'addStep' | 'filter' | 'approval';
662
+
531
663
  export declare const StartNode: () => JSX_2.Element;
532
664
 
533
665
  export declare type StepStatus = 'pending' | 'running' | 'success' | 'failed' | 'skipped';
@@ -545,12 +677,12 @@ declare interface SubWorkflowPreviewDrawerProps {
545
677
 
546
678
  declare class TemplateRegistry {
547
679
  private templates;
548
- register(template: WorkflowTemplate_2): this;
549
- lookup(triggerKey: string): WorkflowTemplate_2 | undefined;
550
- list(): WorkflowTemplate_2[];
551
- listByCategory(category: string): WorkflowTemplate_2[];
552
- listByTag(tag: string): WorkflowTemplate_2[];
553
- search(query: string): WorkflowTemplate_2[];
680
+ register(template: WorkflowTemplate_3): this;
681
+ lookup(triggerKey: string): WorkflowTemplate_3 | undefined;
682
+ list(): WorkflowTemplate_3[];
683
+ listByCategory(category: string): WorkflowTemplate_3[];
684
+ listByTag(tag: string): WorkflowTemplate_3[];
685
+ search(query: string): WorkflowTemplate_3[];
554
686
  categories(): string[];
555
687
  }
556
688
 
@@ -583,6 +715,11 @@ declare interface WorkflowState_2 {
583
715
  branches: BranchMap_2;
584
716
  }
585
717
 
718
+ declare interface WorkflowState_3 {
719
+ slots: CanvasSlot_3[];
720
+ branches: BranchMap_3;
721
+ }
722
+
586
723
  export declare interface WorkflowTemplate {
587
724
  triggerKey: string;
588
725
  label: string;
@@ -592,8 +729,8 @@ export declare interface WorkflowTemplate {
592
729
  availableTasks?: string[];
593
730
  maxTasks?: number;
594
731
  taskLabels?: Record<string, string>;
595
- fixedNodes?: FixedNode_2[];
596
- fixedEdges?: FixedEdge_2[];
732
+ fixedNodes?: FixedNode_3[];
733
+ fixedEdges?: FixedEdge_3[];
597
734
  insertionPoints?: string[];
598
735
  source?: string;
599
736
  product?: string;
@@ -635,6 +772,32 @@ declare interface WorkflowTemplate_2 {
635
772
  popularity?: number;
636
773
  }
637
774
 
775
+ declare interface WorkflowTemplate_3 {
776
+ triggerKey: string;
777
+ label: string;
778
+ description?: string;
779
+ icon?: ReactNode;
780
+ triggerCategory?: 'event' | 'scheduler' | 'webhook' | string;
781
+ availableTasks?: string[];
782
+ maxTasks?: number;
783
+ taskLabels?: Record<string, string>;
784
+ fixedNodes?: FixedNode_2[];
785
+ fixedEdges?: FixedEdge_2[];
786
+ insertionPoints?: string[];
787
+ source?: string;
788
+ product?: string;
789
+ /** Pre-built workflow state to clone when user selects this template */
790
+ skeletonState?: WorkflowState_3;
791
+ /** Tags for filtering in the template library */
792
+ tags?: string[];
793
+ /** Category grouping in the library */
794
+ category?: string;
795
+ /** Team or author that owns this template */
796
+ author?: string;
797
+ /** Relative popularity score (higher = shown first in library) */
798
+ popularity?: number;
799
+ }
800
+
638
801
  export declare const WorkflowTemplateLibrary: default_2.FC<WorkflowTemplateLibraryProps>;
639
802
 
640
803
  declare interface WorkflowTemplateLibraryProps {
package/dist/canvas.js CHANGED
@@ -1,7 +1,7 @@
1
- import { F as a, S as s, F as r, W as t, a as l, b as n, o as d, u as i, w as f } from "./templateSkeletons-CCXJ0W5L.js";
1
+ import { F as a, S as s, F as r, W as t, a as l, b as n, o as d, u as i, w as f } from "./templateSkeletons-Bx-hGzdq.js";
2
2
  import { d as w } from "./messages-CO299wPN.js";
3
3
  import { l as p, s as b } from "./bpmn-CtfWDaOY.js";
4
- import { A as F, b as N, E as m, c as u, F as S, R as T, S as c, T as v, W as x, e as A } from "./GatewayBranchEdge-DH-aHDPm.js";
4
+ import { A as F, b as N, E as m, c as u, F as S, R as T, S as c, T as v, W as x, e as A } from "./GatewayBranchEdge-CwL3jMdK.js";
5
5
  export {
6
6
  F as ActionNode,
7
7
  N as ApprovalNode,
package/dist/core.d.ts CHANGED
@@ -187,6 +187,28 @@ export declare interface FlowForgeMessages {
187
187
  cancel: string;
188
188
  }
189
189
 
190
+ /**
191
+ * Context passed to `NodeDescriptor.canInsert(ctx)` describing where on the
192
+ * canvas the user clicked "+ Add step". Used by position-aware insertion rules.
193
+ */
194
+ declare interface InsertContext {
195
+ /** The slot the user clicked under (the one whose "+" edge was clicked). */
196
+ insertAfterSlot: CanvasSlot | null;
197
+ /** Every slot before the insertion point, including the click slot.
198
+ * When inside a branch: spine up to + including the branching parent, then
199
+ * the branch's own slots up to the insertion point. */
200
+ upstreamSlots: CanvasSlot[];
201
+ /** Every slot after the insertion point in the same chain. */
202
+ downstreamSlots: CanvasSlot[];
203
+ /** Branch context, if the insertion is happening inside a branch. */
204
+ branch: {
205
+ filterId: string;
206
+ branch: string;
207
+ } | null;
208
+ /** The currently active template (the one whose trigger is in use). */
209
+ template: WorkflowTemplate | null;
210
+ }
211
+
190
212
  export declare function loadWorkflowFromBpmn(xml: string): WorkflowState;
191
213
 
192
214
  export declare function makeSubWorkflowDescriptor(opts?: SubWorkflowDescriptorOptions): NodeDescriptor;
@@ -222,6 +244,25 @@ export declare interface NodeDescriptor {
222
244
  * Receives the node's saved formData.
223
245
  */
224
246
  renderNode?: (nodeData: Record<string, unknown>) => ReactNode;
247
+ /**
248
+ * Position constraint — this descriptor can be inserted only if at least ONE
249
+ * of the listed tokens appears in the upstream chain of the click site.
250
+ * Tokens can be a descriptorType (e.g. 'createUserTask'), a slot id
251
+ * (e.g. 'event-userCreated'), or a slot kind (e.g. 'triggerFixed').
252
+ * Ignored when `canInsert` is set.
253
+ */
254
+ insertAfter?: string[];
255
+ /**
256
+ * Symmetric — must appear DOWNSTREAM of the click site. Same token rules
257
+ * as `insertAfter`. Ignored when `canInsert` is set.
258
+ */
259
+ insertBefore?: string[];
260
+ /**
261
+ * Full custom rule. Overrides `insertAfter` / `insertBefore`. Receives the
262
+ * click context (upstream/downstream slots, branch info, active template);
263
+ * returns `true` to allow the descriptor at this insertion point.
264
+ */
265
+ canInsert?: (ctx: InsertContext) => boolean;
225
266
  /** Maps branch key → display label. e.g. { pass: 'Pass', fail: 'Fail' }. Only applies to branching nodes (filterNode, approvalNode). */
226
267
  branchLabels?: Record<string, string>;
227
268
  formSchema: FieldDescriptor[] | ((nodeId: string) => Promise<FieldDescriptor[]>);
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./GatewayBranchEdge-CrDMz9RP.js");exports.ActionNode=e.ActionNode;exports.AddTriggerNode=e.AddTriggerNode;exports.ApprovalNode=e.ApprovalNode;exports.DelayNode=e.DelayNode;exports.EdgeWithPlusLabel=e.EdgeWithPlusLabel;exports.EndNode=e.EndNode;exports.FilterNode=e.FilterNode;exports.GatewayBranchEdge=e.GatewayBranchEdge;exports.LabelPlusEdge=e.LabelPlusEdge;exports.NotificationNode=e.NotificationNode;exports.PlainEdge=e.PlainEdge;exports.PlusEdge=e.PlusEdge;exports.StartNode=e.StartNode;exports.TriggerNode=e.TriggerNode;exports.builtInNodeTypes=e.builtInNodeTypes;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./GatewayBranchEdge-CFre76ne.js");exports.ActionNode=e.ActionNode;exports.AddTriggerNode=e.AddTriggerNode;exports.ApprovalNode=e.ApprovalNode;exports.DelayNode=e.DelayNode;exports.EdgeWithPlusLabel=e.EdgeWithPlusLabel;exports.EndNode=e.EndNode;exports.FilterNode=e.FilterNode;exports.GatewayBranchEdge=e.GatewayBranchEdge;exports.LabelPlusEdge=e.LabelPlusEdge;exports.NotificationNode=e.NotificationNode;exports.PlainEdge=e.PlainEdge;exports.PlusEdge=e.PlusEdge;exports.StartNode=e.StartNode;exports.TriggerNode=e.TriggerNode;exports.builtInNodeTypes=e.builtInNodeTypes;
package/dist/defaultUi.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as d, a as s, b as o, D as N, E as i, c as l, F as r, G as t, L as g, N as E, P as n, d as P, S as b, T as c, e as p } from "./GatewayBranchEdge-DH-aHDPm.js";
1
+ import { A as d, a as s, b as o, D as N, E as i, c as l, F as r, G as t, L as g, N as E, P as n, d as P, S as b, T as c, e as p } from "./GatewayBranchEdge-CwL3jMdK.js";
2
2
  export {
3
3
  d as ActionNode,
4
4
  s as AddTriggerNode,
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DNZlQp9z.js"),a=require("./SchemaBuilderDrawer-jbSe-O-O.js");require("react/jsx-runtime");require("react");require("@mui/material");require("react-icons/md");const r=require("./nodeRegistry.cjs"),l=require("./templateRegistry.cjs"),i=require("./templateSkeletons-DT30F9Rm.js"),d=require("./messages-O9Tw_XXR.js"),n=require("./bpmn-CcuE2X_Q.js"),o=require("./GatewayBranchEdge-CrDMz9RP.js");class u{constructor(){this.channels=new Map}register(t,s){this.channels.set(t,s)}get(t){return this.channels.get(t)}list(){return Array.from(this.channels.entries()).map(([t,s])=>({key:t,...s}))}has(t){return this.channels.has(t)}}const c=new u;exports.DynamicFormRenderer=e.DynamicFormRenderer;exports.FF=e.FF;exports.FlowForgeRegistry=e.FlowForgeRegistry;exports.FlowForm=e.FlowForm;exports.FormulaInput=e.FormulaInput;exports.InfiniteSelectField=e.InfiniteSelectField;exports.TablePickerField=e.TablePickerField;exports.VariablePicker=e.VariablePicker;exports.VariablePickerProvider=e.VariablePickerProvider;exports.astHasRefs=e.astHasRefs;exports.astToTokens=e.astToTokens;exports.buildEvaluationPayload=e.buildEvaluationPayload;exports.buildFieldConfig=e.buildFieldConfig;exports.buildFormulaPath=e.buildFormulaPath;exports.buildSelectStyles=e.buildSelectStyles;exports.buildValidationSchema=e.buildValidationSchema;exports.dataSourceRegistry=e.dataSourceRegistry;exports.errorTextStyle=e.errorTextStyle;exports.extractLabel=e.extractLabel;exports.fieldRegistry=e.fieldRegistry;exports.hasFormulaTokens=e.hasFormulaTokens;exports.helperTextStyle=e.helperTextStyle;exports.inputStyle=e.inputStyle;exports.isFormula=e.isFormula;exports.parseToAST=e.parseToAST;exports.serializeAST=e.serializeAST;exports.serializeASTAsConfig=e.serializeASTAsConfig;exports.serializeConditionExpressions=e.serializeConditionExpressions;exports.stripFormulaTokens=e.stripFormulaTokens;exports.tokenize=e.tokenize;exports.unwrapFormula=e.unwrapFormula;exports.useVariablePickerContext=e.useVariablePickerContext;exports.wrapFormula=e.wrapFormula;exports.FIELD_TYPE_OPTIONS=a.FIELD_TYPE_OPTIONS;exports.SchemaBuilder=a.SchemaBuilder;exports.SchemaBuilderDrawer=a.SchemaBuilderDrawer;exports.useFlowForm=a.useFlowForm;exports.NodeTypeRegistry=r.NodeTypeRegistry;exports.baseNodeDefaults=r.baseNodeDefaults;exports.conditionBranchDescriptor=r.conditionBranchDescriptor;exports.defineNode=r.defineNode;exports.endEventDescriptor=r.endEventDescriptor;exports.makeSubWorkflowDescriptor=r.makeSubWorkflowDescriptor;exports.nodeTypeRegistry=r.nodeTypeRegistry;exports.notificationDescriptor=r.notificationDescriptor;exports.restApiDescriptor=r.restApiDescriptor;exports.startEventDescriptor=r.startEventDescriptor;exports.subWorkflowDescriptor=r.subWorkflowDescriptor;exports.webhookTriggerDescriptor=r.webhookTriggerDescriptor;exports.webhookTriggerTemplate=r.webhookTriggerTemplate;exports.TemplateRegistry=l.TemplateRegistry;exports.templateRegistry=l.templateRegistry;exports.FlowForgeCanvas=i.FlowForgeCanvas;exports.SubWorkflowPreviewDrawer=i.SubWorkflowPreviewDrawer;exports.WorkflowCanvas=i.FlowForgeCanvas;exports.WorkflowExecutionHistory=i.WorkflowExecutionHistory;exports.WorkflowTemplateLibrary=i.WorkflowTemplateLibrary;exports.accessRequestSkeleton=i.accessRequestSkeleton;exports.offboardingSkeleton=i.offboardingSkeleton;exports.userOnboardingSkeleton=i.userOnboardingSkeleton;exports.webhookIntegrationSkeleton=i.webhookIntegrationSkeleton;exports.defaultFlowForgeMessages=d.defaultFlowForgeMessages;exports.loadWorkflowFromBpmn=n.loadWorkflowFromBpmn;exports.saveWorkflowToBpmn=n.saveWorkflowToBpmn;exports.ActionNode=o.ActionNode;exports.ApprovalNode=o.ApprovalNode;exports.EdgeWithPlusLabel=o.EdgeWithPlusLabel;exports.EndNode=o.EndNode;exports.FilterNode=o.FilterNode;exports.RestApiNode=o.RestApiNode;exports.StartNode=o.StartNode;exports.TriggerNode=o.TriggerNode;exports.WebhookTriggerNode=o.WebhookTriggerNode;exports.builtInNodeTypes=o.builtInNodeTypes;exports.notificationChannelRegistry=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DNZlQp9z.js"),a=require("./SchemaBuilderDrawer-jbSe-O-O.js");require("react/jsx-runtime");require("react");require("@mui/material");require("react-icons/md");const r=require("./nodeRegistry.cjs"),l=require("./templateRegistry.cjs"),i=require("./templateSkeletons-BKaXZuM9.js"),d=require("./messages-O9Tw_XXR.js"),n=require("./bpmn-CcuE2X_Q.js"),o=require("./GatewayBranchEdge-CFre76ne.js");class u{constructor(){this.channels=new Map}register(t,s){this.channels.set(t,s)}get(t){return this.channels.get(t)}list(){return Array.from(this.channels.entries()).map(([t,s])=>({key:t,...s}))}has(t){return this.channels.has(t)}}const c=new u;exports.DynamicFormRenderer=e.DynamicFormRenderer;exports.FF=e.FF;exports.FlowForgeRegistry=e.FlowForgeRegistry;exports.FlowForm=e.FlowForm;exports.FormulaInput=e.FormulaInput;exports.InfiniteSelectField=e.InfiniteSelectField;exports.TablePickerField=e.TablePickerField;exports.VariablePicker=e.VariablePicker;exports.VariablePickerProvider=e.VariablePickerProvider;exports.astHasRefs=e.astHasRefs;exports.astToTokens=e.astToTokens;exports.buildEvaluationPayload=e.buildEvaluationPayload;exports.buildFieldConfig=e.buildFieldConfig;exports.buildFormulaPath=e.buildFormulaPath;exports.buildSelectStyles=e.buildSelectStyles;exports.buildValidationSchema=e.buildValidationSchema;exports.dataSourceRegistry=e.dataSourceRegistry;exports.errorTextStyle=e.errorTextStyle;exports.extractLabel=e.extractLabel;exports.fieldRegistry=e.fieldRegistry;exports.hasFormulaTokens=e.hasFormulaTokens;exports.helperTextStyle=e.helperTextStyle;exports.inputStyle=e.inputStyle;exports.isFormula=e.isFormula;exports.parseToAST=e.parseToAST;exports.serializeAST=e.serializeAST;exports.serializeASTAsConfig=e.serializeASTAsConfig;exports.serializeConditionExpressions=e.serializeConditionExpressions;exports.stripFormulaTokens=e.stripFormulaTokens;exports.tokenize=e.tokenize;exports.unwrapFormula=e.unwrapFormula;exports.useVariablePickerContext=e.useVariablePickerContext;exports.wrapFormula=e.wrapFormula;exports.FIELD_TYPE_OPTIONS=a.FIELD_TYPE_OPTIONS;exports.SchemaBuilder=a.SchemaBuilder;exports.SchemaBuilderDrawer=a.SchemaBuilderDrawer;exports.useFlowForm=a.useFlowForm;exports.NodeTypeRegistry=r.NodeTypeRegistry;exports.baseNodeDefaults=r.baseNodeDefaults;exports.conditionBranchDescriptor=r.conditionBranchDescriptor;exports.defineNode=r.defineNode;exports.endEventDescriptor=r.endEventDescriptor;exports.makeSubWorkflowDescriptor=r.makeSubWorkflowDescriptor;exports.nodeTypeRegistry=r.nodeTypeRegistry;exports.notificationDescriptor=r.notificationDescriptor;exports.restApiDescriptor=r.restApiDescriptor;exports.startEventDescriptor=r.startEventDescriptor;exports.subWorkflowDescriptor=r.subWorkflowDescriptor;exports.webhookTriggerDescriptor=r.webhookTriggerDescriptor;exports.webhookTriggerTemplate=r.webhookTriggerTemplate;exports.TemplateRegistry=l.TemplateRegistry;exports.templateRegistry=l.templateRegistry;exports.FlowForgeCanvas=i.FlowForgeCanvas;exports.SubWorkflowPreviewDrawer=i.SubWorkflowPreviewDrawer;exports.WorkflowCanvas=i.FlowForgeCanvas;exports.WorkflowExecutionHistory=i.WorkflowExecutionHistory;exports.WorkflowTemplateLibrary=i.WorkflowTemplateLibrary;exports.accessRequestSkeleton=i.accessRequestSkeleton;exports.offboardingSkeleton=i.offboardingSkeleton;exports.userOnboardingSkeleton=i.userOnboardingSkeleton;exports.webhookIntegrationSkeleton=i.webhookIntegrationSkeleton;exports.defaultFlowForgeMessages=d.defaultFlowForgeMessages;exports.loadWorkflowFromBpmn=n.loadWorkflowFromBpmn;exports.saveWorkflowToBpmn=n.saveWorkflowToBpmn;exports.ActionNode=o.ActionNode;exports.ApprovalNode=o.ApprovalNode;exports.EdgeWithPlusLabel=o.EdgeWithPlusLabel;exports.EndNode=o.EndNode;exports.FilterNode=o.FilterNode;exports.RestApiNode=o.RestApiNode;exports.StartNode=o.StartNode;exports.TriggerNode=o.TriggerNode;exports.WebhookTriggerNode=o.WebhookTriggerNode;exports.builtInNodeTypes=o.builtInNodeTypes;exports.notificationChannelRegistry=c;
package/dist/index.d.ts CHANGED
@@ -532,7 +532,7 @@ declare interface FixedNode {
532
532
  deletable?: false;
533
533
  }
534
534
 
535
- declare const FlowForgeCanvas: ({ nodeRegistry, templateRegistry, initialValue, nodeTypes: consumerNodeTypes, edgeTypes: consumerEdgeTypes, onSave, readOnly, theme, messages: messageOverrides, canvasOptions, renderTriggerSelector, renderNodePicker, renderNodeConfig, onNodeClick: onNodeClickProp, maxNodes, layoutDirection, executionRecord, onFetchWorkflow, }: FlowForgeCanvasProps) => JSX_2.Element;
535
+ declare const FlowForgeCanvas: ({ nodeRegistry, templateRegistry, initialValue, nodeTypes: consumerNodeTypes, edgeTypes: consumerEdgeTypes, onSave, readOnly, theme, messages: messageOverrides, canvasOptions, renderTriggerSelector, loadTriggerSources, renderNodePicker, renderNodeConfig, onNodeClick: onNodeClickProp, maxNodes, layoutDirection, executionRecord, onFetchWorkflow, }: FlowForgeCanvasProps) => JSX_2.Element;
536
536
  export { FlowForgeCanvas }
537
537
  export { FlowForgeCanvas as WorkflowCanvas }
538
538
 
@@ -586,6 +586,20 @@ export declare interface FlowForgeCanvasProps {
586
586
  canvasOptions?: FlowForgeCanvasOptions;
587
587
  /** Replace the trigger selector UI entirely */
588
588
  renderTriggerSelector?: (templates: WorkflowTemplate[], onSelect: (t: WorkflowTemplate) => void, onClose: () => void) => default_2.ReactNode;
589
+ /**
590
+ * Optional async loader for trigger sources. When provided, the default
591
+ * trigger selector goes to a second stage after the user picks a trigger:
592
+ * the loader is called with the trigger's key, and if it returns a non-empty
593
+ * list, the user picks one or more sources before the canvas is seeded.
594
+ * Picked sources are merged into the trigger node's `nodeData.sources` so
595
+ * TriggerNode can render the "via [chip] [chip]" line.
596
+ *
597
+ * Return `[]` for triggers that have no sources — stage 2 is skipped.
598
+ */
599
+ loadTriggerSources?: (triggerKey: string) => Promise<Array<{
600
+ label: string;
601
+ value: string;
602
+ }>>;
589
603
  /** Replace the node picker UI entirely */
590
604
  renderNodePicker?: (descriptors: NodeDescriptor[], onSelect: (d: NodeDescriptor) => void, onClose: () => void) => default_2.ReactNode;
591
605
  /** Replace the node config drawer entirely */
@@ -810,6 +824,28 @@ export declare function inputStyle(opts: {
810
824
  extraStyle?: React.CSSProperties;
811
825
  }): React.CSSProperties;
812
826
 
827
+ /**
828
+ * Context passed to `NodeDescriptor.canInsert(ctx)` describing where on the
829
+ * canvas the user clicked "+ Add step". Used by position-aware insertion rules.
830
+ */
831
+ declare interface InsertContext {
832
+ /** The slot the user clicked under (the one whose "+" edge was clicked). */
833
+ insertAfterSlot: CanvasSlot | null;
834
+ /** Every slot before the insertion point, including the click slot.
835
+ * When inside a branch: spine up to + including the branching parent, then
836
+ * the branch's own slots up to the insertion point. */
837
+ upstreamSlots: CanvasSlot[];
838
+ /** Every slot after the insertion point in the same chain. */
839
+ downstreamSlots: CanvasSlot[];
840
+ /** Branch context, if the insertion is happening inside a branch. */
841
+ branch: {
842
+ filterId: string;
843
+ branch: string;
844
+ } | null;
845
+ /** The currently active template (the one whose trigger is in use). */
846
+ template: WorkflowTemplate | null;
847
+ }
848
+
813
849
  export declare function isFormula(value: unknown): value is string;
814
850
 
815
851
  export declare interface LoadPageParams {
@@ -858,6 +894,25 @@ export declare interface NodeDescriptor {
858
894
  * Receives the node's saved formData.
859
895
  */
860
896
  renderNode?: (nodeData: Record<string, unknown>) => ReactNode;
897
+ /**
898
+ * Position constraint — this descriptor can be inserted only if at least ONE
899
+ * of the listed tokens appears in the upstream chain of the click site.
900
+ * Tokens can be a descriptorType (e.g. 'createUserTask'), a slot id
901
+ * (e.g. 'event-userCreated'), or a slot kind (e.g. 'triggerFixed').
902
+ * Ignored when `canInsert` is set.
903
+ */
904
+ insertAfter?: string[];
905
+ /**
906
+ * Symmetric — must appear DOWNSTREAM of the click site. Same token rules
907
+ * as `insertAfter`. Ignored when `canInsert` is set.
908
+ */
909
+ insertBefore?: string[];
910
+ /**
911
+ * Full custom rule. Overrides `insertAfter` / `insertBefore`. Receives the
912
+ * click context (upstream/downstream slots, branch info, active template);
913
+ * returns `true` to allow the descriptor at this insertion point.
914
+ */
915
+ canInsert?: (ctx: InsertContext) => boolean;
861
916
  /** Maps branch key → display label. e.g. { pass: 'Pass', fail: 'Fail' }. Only applies to branching nodes (filterNode, approvalNode). */
862
917
  branchLabels?: Record<string, string>;
863
918
  formSchema: FieldDescriptor[] | ((nodeId: string) => Promise<FieldDescriptor[]>);
package/dist/index.js CHANGED
@@ -6,10 +6,10 @@ import "@mui/material";
6
6
  import "react-icons/md";
7
7
  import { NodeTypeRegistry as U, baseNodeDefaults as X, conditionBranchDescriptor as Z, defineNode as $, endEventDescriptor as ee, makeSubWorkflowDescriptor as ae, nodeTypeRegistry as se, notificationDescriptor as re, restApiDescriptor as oe, startEventDescriptor as te, subWorkflowDescriptor as ie, webhookTriggerDescriptor as le, webhookTriggerTemplate as ne } from "./nodeRegistry.js";
8
8
  import { TemplateRegistry as de, templateRegistry as ce } from "./templateRegistry.js";
9
- import { F as me, S as fe, F as ge, W as Fe, a as he, b as be, o as ke, u as Te, w as we } from "./templateSkeletons-CCXJ0W5L.js";
9
+ import { F as me, S as fe, F as ge, W as Fe, a as he, b as be, o as ke, u as Te, w as we } from "./templateSkeletons-Bx-hGzdq.js";
10
10
  import { d as ye } from "./messages-CO299wPN.js";
11
11
  import { l as De, s as Ne } from "./bpmn-CtfWDaOY.js";
12
- import { A as We, b as Ae, E as Pe, c as ve, F as Ee, R as Ce, S as Ie, T as Be, W as ze, e as Ve } from "./GatewayBranchEdge-DH-aHDPm.js";
12
+ import { A as We, b as Ae, E as Pe, c as ve, F as Ee, R as Ce, S as Ie, T as Be, W as ze, e as Ve } from "./GatewayBranchEdge-CwL3jMdK.js";
13
13
  class s {
14
14
  constructor() {
15
15
  this.channels = /* @__PURE__ */ new Map();
@@ -164,6 +164,28 @@ declare interface FixedNode {
164
164
  deletable?: false;
165
165
  }
166
166
 
167
+ /**
168
+ * Context passed to `NodeDescriptor.canInsert(ctx)` describing where on the
169
+ * canvas the user clicked "+ Add step". Used by position-aware insertion rules.
170
+ */
171
+ declare interface InsertContext {
172
+ /** The slot the user clicked under (the one whose "+" edge was clicked). */
173
+ insertAfterSlot: CanvasSlot | null;
174
+ /** Every slot before the insertion point, including the click slot.
175
+ * When inside a branch: spine up to + including the branching parent, then
176
+ * the branch's own slots up to the insertion point. */
177
+ upstreamSlots: CanvasSlot[];
178
+ /** Every slot after the insertion point in the same chain. */
179
+ downstreamSlots: CanvasSlot[];
180
+ /** Branch context, if the insertion is happening inside a branch. */
181
+ branch: {
182
+ filterId: string;
183
+ branch: string;
184
+ } | null;
185
+ /** The currently active template (the one whose trigger is in use). */
186
+ template: WorkflowTemplate | null;
187
+ }
188
+
167
189
  export declare function makeSubWorkflowDescriptor(opts?: SubWorkflowDescriptorOptions): NodeDescriptor;
168
190
 
169
191
  export declare interface NodeDescriptor {
@@ -197,6 +219,25 @@ export declare interface NodeDescriptor {
197
219
  * Receives the node's saved formData.
198
220
  */
199
221
  renderNode?: (nodeData: Record<string, unknown>) => ReactNode;
222
+ /**
223
+ * Position constraint — this descriptor can be inserted only if at least ONE
224
+ * of the listed tokens appears in the upstream chain of the click site.
225
+ * Tokens can be a descriptorType (e.g. 'createUserTask'), a slot id
226
+ * (e.g. 'event-userCreated'), or a slot kind (e.g. 'triggerFixed').
227
+ * Ignored when `canInsert` is set.
228
+ */
229
+ insertAfter?: string[];
230
+ /**
231
+ * Symmetric — must appear DOWNSTREAM of the click site. Same token rules
232
+ * as `insertAfter`. Ignored when `canInsert` is set.
233
+ */
234
+ insertBefore?: string[];
235
+ /**
236
+ * Full custom rule. Overrides `insertAfter` / `insertBefore`. Receives the
237
+ * click context (upstream/downstream slots, branch info, active template);
238
+ * returns `true` to allow the descriptor at this insertion point.
239
+ */
240
+ canInsert?: (ctx: InsertContext) => boolean;
200
241
  /** Maps branch key → display label. e.g. { pass: 'Pass', fail: 'Fail' }. Only applies to branching nodes (filterNode, approvalNode). */
201
242
  branchLabels?: Record<string, string>;
202
243
  formSchema: FieldDescriptor[] | ((nodeId: string) => Promise<FieldDescriptor[]>);