sequential-workflow-designer 0.19.4 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -167,7 +167,8 @@ interface ComponentView {
167
167
  interface StepComponentView extends ComponentView {
168
168
  sequenceComponents: SequenceComponent[] | null;
169
169
  placeholders: Placeholder[] | null;
170
- hasOutput(): boolean;
170
+ hasOutput: boolean;
171
+ haveCollapsedChildren?: boolean;
171
172
  /**
172
173
  * @param click Details about the click.
173
174
  * @returns `true` if selected a step, a click command if clicked a specific action, `null` if not clicked at this view.
@@ -272,8 +273,11 @@ declare class ComponentContext {
272
273
  readonly iconProvider: IconProvider;
273
274
  readonly placeholderController: PlaceholderController;
274
275
  readonly stepComponentFactory: StepComponentFactory;
276
+ readonly definitionWalker: DefinitionWalker;
275
277
  readonly services: Services;
276
- static create(stepsConfiguration: StepsConfiguration, validatorConfiguration: ValidatorConfiguration | undefined, state: DesignerState, stepExtensionResolver: StepExtensionResolver, services: Services): ComponentContext;
278
+ readonly preferenceStorage: PreferenceStorage;
279
+ readonly i18n: I18n;
280
+ static create(configuration: DesignerConfiguration, state: DesignerState, stepExtensionResolver: StepExtensionResolver, definitionWalker: DefinitionWalker, preferenceStorage: PreferenceStorage, i18n: I18n, services: Services): ComponentContext;
277
281
  private constructor();
278
282
  }
279
283
 
@@ -342,6 +346,7 @@ declare class DesignerContext {
342
346
  readonly services: Services;
343
347
  readonly componentContext: ComponentContext;
344
348
  readonly definitionWalker: DefinitionWalker;
349
+ readonly i18n: I18n;
345
350
  readonly stateModifier: StateModifier;
346
351
  readonly layoutController: LayoutController;
347
352
  readonly workspaceController: WorkspaceControllerWrapper;
@@ -349,7 +354,7 @@ declare class DesignerContext {
349
354
  readonly customActionController: CustomActionController;
350
355
  readonly historyController: HistoryController | undefined;
351
356
  static create(parent: HTMLElement, startDefinition: Definition, configuration: DesignerConfiguration, services: Services): DesignerContext;
352
- constructor(theme: string, state: DesignerState, configuration: DesignerConfiguration, services: Services, componentContext: ComponentContext, definitionWalker: DefinitionWalker, stateModifier: StateModifier, layoutController: LayoutController, workspaceController: WorkspaceControllerWrapper, behaviorController: BehaviorController, customActionController: CustomActionController, historyController: HistoryController | undefined);
357
+ constructor(theme: string, state: DesignerState, configuration: DesignerConfiguration, services: Services, componentContext: ComponentContext, definitionWalker: DefinitionWalker, i18n: I18n, stateModifier: StateModifier, layoutController: LayoutController, workspaceController: WorkspaceControllerWrapper, behaviorController: BehaviorController, customActionController: CustomActionController, historyController: HistoryController | undefined);
353
358
  setWorkspaceController(controller: WorkspaceController): void;
354
359
  }
355
360
 
@@ -405,8 +410,9 @@ declare class PathBarApi {
405
410
 
406
411
  declare class ToolboxDataProvider {
407
412
  private readonly iconProvider;
413
+ private readonly i18n;
408
414
  private readonly configuration;
409
- constructor(iconProvider: IconProvider, configuration: ToolboxConfiguration | false);
415
+ constructor(iconProvider: IconProvider, i18n: I18n, configuration: ToolboxConfiguration | false);
410
416
  getAllGroups(): ToolboxGroupData[];
411
417
  private readonly createItemData;
412
418
  applyFilter(allGroups: ToolboxGroupData[], filter: string | undefined): ToolboxGroupData[];
@@ -475,6 +481,7 @@ declare class DesignerApi {
475
481
  readonly viewport: ViewportApi;
476
482
  readonly pathBar: PathBarApi;
477
483
  readonly definitionWalker: DefinitionWalker;
484
+ readonly i18n: I18n;
478
485
  static create(context: DesignerContext): DesignerApi;
479
486
  private constructor();
480
487
  }
@@ -504,7 +511,7 @@ declare class ValidationErrorBadgeExtension implements BadgeExtension {
504
511
  static create(configuration?: ValidationErrorBadgeExtensionConfiguration): ValidationErrorBadgeExtension;
505
512
  readonly id = "validationError";
506
513
  private constructor();
507
- createForStep(parentElement: SVGElement, stepContext: StepContext<Step>, componentContext: ComponentContext): Badge;
514
+ createForStep(parentElement: SVGElement, view: StepComponentView, stepContext: StepContext<Step>, componentContext: ComponentContext): Badge;
508
515
  createForRoot(parentElement: SVGElement, componentContext: ComponentContext): Badge;
509
516
  readonly createStartValue: () => boolean;
510
517
  }
@@ -548,17 +555,6 @@ declare class OutputView {
548
555
  setIsHidden(isHidden: boolean): void;
549
556
  }
550
557
 
551
- declare class RegionView {
552
- private readonly lines;
553
- private readonly width;
554
- private readonly height;
555
- static create(parent: SVGElement, widths: number[], height: number): RegionView;
556
- constructor(lines: SVGLineElement[], width: number, height: number);
557
- getClientPosition(): Vector;
558
- resolveClick(click: ClickDetails): boolean;
559
- setIsSelected(isSelected: boolean): void;
560
- }
561
-
562
558
  declare class DefaultSequenceComponentView implements ComponentView {
563
559
  readonly g: SVGGElement;
564
560
  readonly width: number;
@@ -702,6 +698,21 @@ declare class RectPlaceholder implements Placeholder {
702
698
  resolveClick(): null;
703
699
  }
704
700
 
701
+ declare class DefaultRegionView implements RegionView {
702
+ private readonly lines;
703
+ private readonly width;
704
+ private readonly height;
705
+ static create(parent: SVGElement, widths: number[], height: number): DefaultRegionView;
706
+ constructor(lines: SVGLineElement[], width: number, height: number);
707
+ getClientPosition(): Vector;
708
+ resolveClick(click: ClickDetails): true | null;
709
+ setIsSelected(isSelected: boolean): void;
710
+ }
711
+
712
+ declare class DefaultRegionComponentViewExtension implements RegionComponentViewExtension {
713
+ create(parentElement: SVGElement, componentClassName: string, stepContext: StepContext, _: StepComponentViewContext, contentFactory: RegionComponentViewContentFactory): StepComponentView;
714
+ }
715
+
705
716
  interface DesignerExtension {
706
717
  steps?: StepExtension[];
707
718
  stepComponentViewWrapper?: StepComponentViewWrapperExtension;
@@ -712,6 +723,7 @@ interface DesignerExtension {
712
723
  viewportController?: ViewportControllerExtension;
713
724
  placeholderController?: PlaceholderControllerExtension;
714
725
  placeholder?: PlaceholderExtension;
726
+ regionComponentView?: RegionComponentViewExtension;
715
727
  grid?: GridExtension;
716
728
  rootComponent?: RootComponentExtension;
717
729
  sequenceComponent?: SequenceComponentExtension;
@@ -724,9 +736,14 @@ interface StepExtension<S extends Step = Step> {
724
736
  }
725
737
  type StepComponentViewFactory = StepExtension['createComponentView'];
726
738
  interface StepComponentViewContext {
739
+ i18n: I18n;
740
+ getStepName(): string;
727
741
  getStepIconUrl(): string | null;
728
742
  createSequenceComponent(parentElement: SVGElement, sequence: Sequence): SequenceComponent;
729
743
  createPlaceholderForArea(parentElement: SVGElement, size: Vector, direction: PlaceholderDirection, sequence: Sequence, index: number): Placeholder;
744
+ createRegionComponentView(parentElement: SVGElement, componentClassName: string, contentFactory: RegionComponentViewContentFactory): StepComponentView;
745
+ getPreference(key: string): string | null;
746
+ setPreference(key: string, value: string): void;
730
747
  }
731
748
  interface StepContext<S extends Step = Step> {
732
749
  parentSequence: Sequence;
@@ -747,7 +764,7 @@ interface StepComponentViewWrapperExtension {
747
764
  }
748
765
  interface BadgeExtension {
749
766
  id: string;
750
- createForStep(parentElement: SVGElement, stepContext: StepContext, componentContext: ComponentContext): Badge;
767
+ createForStep(parentElement: SVGElement, view: StepComponentView, stepContext: StepContext, componentContext: ComponentContext): Badge;
751
768
  createForRoot?: (parentElement: SVGElement, componentContext: ComponentContext) => Badge;
752
769
  createStartValue(): unknown;
753
770
  }
@@ -828,6 +845,19 @@ interface DaemonExtension {
828
845
  }
829
846
  interface Daemon {
830
847
  destroy(): void;
848
+ }
849
+ interface RegionView {
850
+ getClientPosition(): Vector;
851
+ /**
852
+ * @returns `true` if the click is inside the region, `null` if it's outside. The view may return a command to be executed.
853
+ */
854
+ resolveClick(click: ClickDetails): true | ClickCommand | null;
855
+ setIsSelected(isSelected: boolean): void;
856
+ }
857
+ type RegionViewFactory = (parent: SVGElement, widths: number[], height: number) => RegionView;
858
+ type RegionComponentViewContentFactory = (g: SVGGElement, regionViewFactory: RegionViewFactory) => StepComponentView;
859
+ interface RegionComponentViewExtension {
860
+ create(parentElement: SVGElement, componentClassName: string, stepContext: StepContext, viewContext: StepComponentViewContext, contentFactory: RegionComponentViewContentFactory): StepComponentView;
831
861
  }
832
862
 
833
863
  interface DesignerConfiguration<TDefinition extends Definition = Definition> {
@@ -888,12 +918,21 @@ interface DesignerConfiguration<TDefinition extends Definition = Definition> {
888
918
  * @description Custom definition walker.
889
919
  */
890
920
  definitionWalker?: DefinitionWalker;
921
+ /**
922
+ * @description Custom preference storage. By default, all preferences are stored in the memory.
923
+ */
924
+ preferenceStorage?: PreferenceStorage;
891
925
  /**
892
926
  * @description Custom generator of unique identifiers.
893
927
  */
894
928
  uidGenerator?: UidGenerator;
929
+ /**
930
+ * @description Custom translation function.
931
+ */
932
+ i18n?: I18n;
895
933
  }
896
934
  type UidGenerator = () => string;
935
+ type I18n = (key: string, defaultValue: string) => string;
897
936
  type CustomActionHandler = (action: CustomAction, step: Step | null, sequence: Sequence, context: CustomActionHandlerContext) => void;
898
937
  interface CustomAction {
899
938
  type: string;
@@ -938,6 +977,10 @@ interface ToolboxGroupConfiguration {
938
977
  name: string;
939
978
  steps: StepDefinition[];
940
979
  }
980
+ interface PreferenceStorage {
981
+ setItem(key: string, value: string): void;
982
+ getItem(key: string): string | null;
983
+ }
941
984
  interface StepsConfiguration {
942
985
  isSelectable?: (step: Step, parentSequence: Sequence) => boolean;
943
986
  canInsertStep?: (step: Step, targetSequence: Sequence, targetIndex: number) => boolean;
@@ -1214,4 +1257,4 @@ declare class StepsDesignerExtension implements DesignerExtension {
1214
1257
  protected constructor(steps: StepExtension<Step>[]);
1215
1258
  }
1216
1259
 
1217
- export { Attributes, Badge, BadgeExtension, BadgeView, Badges, BadgesResult, BaseClickCommand, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommand, ClickCommandType, ClickDetails, Component, ComponentContext, ComponentDom, ComponentView, ContainerStepComponentViewConfiguration, ContainerStepExtensionConfiguration, ContextMenuExtension, ContextMenuItem, ContextMenuItemsProvider, ControlBarApi, CustomAction, CustomActionController, CustomActionHandler, CustomActionHandlerContext, Daemon, DaemonExtension, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, DefinitionChangedEvent, Designer, DesignerApi, DesignerConfiguration, DesignerContext, DesignerExtension, DesignerState, Dom, DraggedComponent, DraggedComponentExtension, Editor, EditorApi, EditorsConfiguration, Grid, GridExtension, Icons, InputView, JoinView, KeyboardAction, KeyboardConfiguration, LabelView, LineGridConfiguration, LineGridDesignerExtension, ObjectCloner, OpenFolderClickCommand, OutputView, PathBarApi, Placeholder, PlaceholderController, PlaceholderControllerExtension, PlaceholderDirection, PlaceholderExtension, PlaceholderView, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderConfiguration, RectPlaceholderView, RegionView, RerenderStepClickCommand, RootComponentExtension, RootEditorContext, RootEditorProvider, RootValidator, SelectStepClickCommand, SelectedStepIdProvider, SequenceComponent, SequenceComponentExtension, SequenceContext, SequencePlaceIndicator, Services, ServicesResolver, SimpleEvent, SimpleEventListener, StateModifierDependency, StepComponent, StepComponentView, StepComponentViewContext, StepComponentViewFactory, StepComponentViewWrapperExtension, StepContext, StepDefinition, StepDescriptionProvider, StepEditorContext, StepEditorProvider, StepExtension, StepExtensionResolver, StepIconUrlProvider, StepLabelProvider, StepValidator, StepsConfiguration, StepsDesignerExtension, StepsDesignerExtensionConfiguration, SwitchStepComponentViewConfiguration, SwitchStepExtensionConfiguration, TaskStepComponentViewConfiguration, TaskStepExtensionConfiguration, ToolboxApi, ToolboxConfiguration, ToolboxGroupConfiguration, TriggerCustomActionClickCommand, UiComponent, UiComponentExtension, Uid, UidGenerator, UndoStack, UndoStackItem, ValidationErrorBadgeExtension, ValidationErrorBadgeExtensionConfiguration, ValidationErrorBadgeViewConfiguration, ValidatorConfiguration, Vector, Viewport, ViewportController, ViewportControllerExtension, WheelController, WheelControllerExtension, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };
1260
+ export { Attributes, Badge, BadgeExtension, BadgeView, Badges, BadgesResult, BaseClickCommand, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommand, ClickCommandType, ClickDetails, Component, ComponentContext, ComponentDom, ComponentView, ContainerStepComponentViewConfiguration, ContainerStepExtensionConfiguration, ContextMenuExtension, ContextMenuItem, ContextMenuItemsProvider, ControlBarApi, CustomAction, CustomActionController, CustomActionHandler, CustomActionHandlerContext, Daemon, DaemonExtension, DefaultRegionComponentViewExtension, DefaultRegionView, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, DefinitionChangedEvent, Designer, DesignerApi, DesignerConfiguration, DesignerContext, DesignerExtension, DesignerState, Dom, DraggedComponent, DraggedComponentExtension, Editor, EditorApi, EditorsConfiguration, Grid, GridExtension, I18n, Icons, InputView, JoinView, KeyboardAction, KeyboardConfiguration, LabelView, LineGridConfiguration, LineGridDesignerExtension, ObjectCloner, OpenFolderClickCommand, OutputView, PathBarApi, Placeholder, PlaceholderController, PlaceholderControllerExtension, PlaceholderDirection, PlaceholderExtension, PlaceholderView, PreferenceStorage, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderConfiguration, RectPlaceholderView, RegionComponentViewContentFactory, RegionComponentViewExtension, RegionView, RegionViewFactory, RerenderStepClickCommand, RootComponentExtension, RootEditorContext, RootEditorProvider, RootValidator, SelectStepClickCommand, SelectedStepIdProvider, SequenceComponent, SequenceComponentExtension, SequenceContext, SequencePlaceIndicator, Services, ServicesResolver, SimpleEvent, SimpleEventListener, StateModifierDependency, StepComponent, StepComponentView, StepComponentViewContext, StepComponentViewFactory, StepComponentViewWrapperExtension, StepContext, StepDefinition, StepDescriptionProvider, StepEditorContext, StepEditorProvider, StepExtension, StepExtensionResolver, StepIconUrlProvider, StepLabelProvider, StepValidator, StepsConfiguration, StepsDesignerExtension, StepsDesignerExtensionConfiguration, SwitchStepComponentViewConfiguration, SwitchStepExtensionConfiguration, TaskStepComponentViewConfiguration, TaskStepExtensionConfiguration, ToolboxApi, ToolboxConfiguration, ToolboxGroupConfiguration, TriggerCustomActionClickCommand, UiComponent, UiComponentExtension, Uid, UidGenerator, UndoStack, UndoStackItem, ValidationErrorBadgeExtension, ValidationErrorBadgeExtensionConfiguration, ValidationErrorBadgeViewConfiguration, ValidatorConfiguration, Vector, Viewport, ViewportController, ViewportControllerExtension, WheelController, WheelControllerExtension, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sequential-workflow-designer",
3
3
  "description": "Customizable no-code component for building flow-based programming applications.",
4
- "version": "0.19.4",
4
+ "version": "0.21.0",
5
5
  "type": "module",
6
6
  "main": "./lib/esm/index.js",
7
7
  "types": "./lib/index.d.ts",
@@ -89,7 +89,7 @@
89
89
  "karma-spec-reporter": "^0.0.36",
90
90
  "karma-typescript": "^5.5.3",
91
91
  "karma-typescript-es6-transform": "^5.5.3",
92
- "prettier": "^2.8.2",
92
+ "prettier": "^3.2.5",
93
93
  "rollup": "^3.18.0",
94
94
  "rollup-plugin-dts": "^5.2.0",
95
95
  "rollup-plugin-typescript2": "^0.34.1",