sequential-workflow-designer 0.20.0 → 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,9 +273,11 @@ declare class ComponentContext {
272
273
  readonly iconProvider: IconProvider;
273
274
  readonly placeholderController: PlaceholderController;
274
275
  readonly stepComponentFactory: StepComponentFactory;
275
- readonly i18n: I18n;
276
+ readonly definitionWalker: DefinitionWalker;
276
277
  readonly services: Services;
277
- static create(stepsConfiguration: StepsConfiguration, validatorConfiguration: ValidatorConfiguration | undefined, state: DesignerState, stepExtensionResolver: StepExtensionResolver, i18n: I18n, 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;
278
281
  private constructor();
279
282
  }
280
283
 
@@ -508,7 +511,7 @@ declare class ValidationErrorBadgeExtension implements BadgeExtension {
508
511
  static create(configuration?: ValidationErrorBadgeExtensionConfiguration): ValidationErrorBadgeExtension;
509
512
  readonly id = "validationError";
510
513
  private constructor();
511
- createForStep(parentElement: SVGElement, stepContext: StepContext<Step>, componentContext: ComponentContext): Badge;
514
+ createForStep(parentElement: SVGElement, view: StepComponentView, stepContext: StepContext<Step>, componentContext: ComponentContext): Badge;
512
515
  createForRoot(parentElement: SVGElement, componentContext: ComponentContext): Badge;
513
516
  readonly createStartValue: () => boolean;
514
517
  }
@@ -552,17 +555,6 @@ declare class OutputView {
552
555
  setIsHidden(isHidden: boolean): void;
553
556
  }
554
557
 
555
- declare class RegionView {
556
- private readonly lines;
557
- private readonly width;
558
- private readonly height;
559
- static create(parent: SVGElement, widths: number[], height: number): RegionView;
560
- constructor(lines: SVGLineElement[], width: number, height: number);
561
- getClientPosition(): Vector;
562
- resolveClick(click: ClickDetails): boolean;
563
- setIsSelected(isSelected: boolean): void;
564
- }
565
-
566
558
  declare class DefaultSequenceComponentView implements ComponentView {
567
559
  readonly g: SVGGElement;
568
560
  readonly width: number;
@@ -706,6 +698,21 @@ declare class RectPlaceholder implements Placeholder {
706
698
  resolveClick(): null;
707
699
  }
708
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
+
709
716
  interface DesignerExtension {
710
717
  steps?: StepExtension[];
711
718
  stepComponentViewWrapper?: StepComponentViewWrapperExtension;
@@ -716,6 +723,7 @@ interface DesignerExtension {
716
723
  viewportController?: ViewportControllerExtension;
717
724
  placeholderController?: PlaceholderControllerExtension;
718
725
  placeholder?: PlaceholderExtension;
726
+ regionComponentView?: RegionComponentViewExtension;
719
727
  grid?: GridExtension;
720
728
  rootComponent?: RootComponentExtension;
721
729
  sequenceComponent?: SequenceComponentExtension;
@@ -728,11 +736,14 @@ interface StepExtension<S extends Step = Step> {
728
736
  }
729
737
  type StepComponentViewFactory = StepExtension['createComponentView'];
730
738
  interface StepComponentViewContext {
739
+ i18n: I18n;
731
740
  getStepName(): string;
732
741
  getStepIconUrl(): string | null;
733
742
  createSequenceComponent(parentElement: SVGElement, sequence: Sequence): SequenceComponent;
734
743
  createPlaceholderForArea(parentElement: SVGElement, size: Vector, direction: PlaceholderDirection, sequence: Sequence, index: number): Placeholder;
735
- i18n: I18n;
744
+ createRegionComponentView(parentElement: SVGElement, componentClassName: string, contentFactory: RegionComponentViewContentFactory): StepComponentView;
745
+ getPreference(key: string): string | null;
746
+ setPreference(key: string, value: string): void;
736
747
  }
737
748
  interface StepContext<S extends Step = Step> {
738
749
  parentSequence: Sequence;
@@ -753,7 +764,7 @@ interface StepComponentViewWrapperExtension {
753
764
  }
754
765
  interface BadgeExtension {
755
766
  id: string;
756
- createForStep(parentElement: SVGElement, stepContext: StepContext, componentContext: ComponentContext): Badge;
767
+ createForStep(parentElement: SVGElement, view: StepComponentView, stepContext: StepContext, componentContext: ComponentContext): Badge;
757
768
  createForRoot?: (parentElement: SVGElement, componentContext: ComponentContext) => Badge;
758
769
  createStartValue(): unknown;
759
770
  }
@@ -834,6 +845,19 @@ interface DaemonExtension {
834
845
  }
835
846
  interface Daemon {
836
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;
837
861
  }
838
862
 
839
863
  interface DesignerConfiguration<TDefinition extends Definition = Definition> {
@@ -894,6 +918,10 @@ interface DesignerConfiguration<TDefinition extends Definition = Definition> {
894
918
  * @description Custom definition walker.
895
919
  */
896
920
  definitionWalker?: DefinitionWalker;
921
+ /**
922
+ * @description Custom preference storage. By default, all preferences are stored in the memory.
923
+ */
924
+ preferenceStorage?: PreferenceStorage;
897
925
  /**
898
926
  * @description Custom generator of unique identifiers.
899
927
  */
@@ -949,6 +977,10 @@ interface ToolboxGroupConfiguration {
949
977
  name: string;
950
978
  steps: StepDefinition[];
951
979
  }
980
+ interface PreferenceStorage {
981
+ setItem(key: string, value: string): void;
982
+ getItem(key: string): string | null;
983
+ }
952
984
  interface StepsConfiguration {
953
985
  isSelectable?: (step: Step, parentSequence: Sequence) => boolean;
954
986
  canInsertStep?: (step: Step, targetSequence: Sequence, targetIndex: number) => boolean;
@@ -1225,4 +1257,4 @@ declare class StepsDesignerExtension implements DesignerExtension {
1225
1257
  protected constructor(steps: StepExtension<Step>[]);
1226
1258
  }
1227
1259
 
1228
- 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, I18n, 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.20.0",
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",