@vectoriox/iox-builder 4.10.0 → 4.11.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/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { ComponentRef, Type, ChangeDetectorRef, OnInit, AfterViewInit, OnChanges, OnDestroy, EventEmitter, ElementRef, ApplicationRef, SimpleChanges, ViewContainerRef, Injector, EnvironmentInjector, InjectionToken, TemplateRef, AfterContentInit, QueryList } from '@angular/core';
3
3
  import * as i29 from '@vectoriox/iox-ui';
4
- import { ResponsiveOverrides, RelativeSourceSpec, Breakpoint, DataSourceEndpoints } from '@vectoriox/iox-ui';
4
+ import { ResponsiveOverrides, RelativeSourceSpec, Breakpoint, FormRenderState, DataSourceEndpoints } from '@vectoriox/iox-ui';
5
5
  export { ComponentInstanceRegistryService, IoxContextSlot, SetContextParams, VIRTUAL_TRAIT_KEYS, composeVirtualTraits } from '@vectoriox/iox-ui';
6
6
  import * as rxjs from 'rxjs';
7
7
  import { Subject, Subscription, BehaviorSubject, Observable } from 'rxjs';
@@ -1707,6 +1707,12 @@ declare class BuilderComponent implements OnInit, AfterViewInit, OnChanges, OnDe
1707
1707
  private canvasContentHeight;
1708
1708
  handleToolbarModeChange(mode: BuilderMode): void;
1709
1709
  handleToolbarBreakpointChange(bp: Breakpoint): void;
1710
+ /** The form the selection sits inside, or null. Drives the toolbar's contextual switcher. */
1711
+ activeFormState: FormRenderState;
1712
+ get formStateTarget(): string | null;
1713
+ handleToolbarFormStateChange(state: FormRenderState): void;
1714
+ /** The nearest Form ancestor of the selection (or the selection itself). */
1715
+ private selectedFormNode;
1710
1716
  handleToolbarZoomChange(value: number | 'fit'): void;
1711
1717
  handleToolbarScreenWidthChange(width: number): void;
1712
1718
  get globalElementsBefore(): ComponentNode[];
@@ -2116,8 +2122,16 @@ declare class ToolbarComponent {
2116
2122
  canRedo: boolean;
2117
2123
  isSaving: boolean;
2118
2124
  pageStatus: string;
2125
+ /**
2126
+ * The form the selection sits inside, or null. CONTEXTUAL: the state switcher only appears when
2127
+ * there is a form to switch, because a permanently-present control for a rarely-present element
2128
+ * is exactly the toolbar clutter `builder-usability-plan.md` warns about.
2129
+ */
2130
+ formStateTarget: string | null;
2131
+ activeFormState: FormRenderState;
2119
2132
  modeChange: EventEmitter<BuilderMode>;
2120
2133
  breakpointChange: EventEmitter<Breakpoint>;
2134
+ formStateChange: EventEmitter<FormRenderState>;
2121
2135
  auditToggle: EventEmitter<void>;
2122
2136
  zoomChange: EventEmitter<number | "fit">;
2123
2137
  screenWidthChange: EventEmitter<number>;
@@ -2150,13 +2164,20 @@ declare class ToolbarComponent {
2150
2164
  toggleModePopover(event: Event): void;
2151
2165
  selectMode(mode: BuilderMode): void;
2152
2166
  selectBreakpoint(bp: Breakpoint): void;
2167
+ /** The four states, in the order a submission moves through them. */
2168
+ readonly formStates: {
2169
+ id: FormRenderState;
2170
+ label: string;
2171
+ icon: string;
2172
+ }[];
2173
+ selectFormState(state: FormRenderState): void;
2153
2174
  onSliderChange(event: Event): void;
2154
2175
  toggleWidthPopover(event: Event): void;
2155
2176
  selectScreenWidth(width: number): void;
2156
2177
  toggleZoomPopover(event: Event): void;
2157
2178
  selectZoom(value: number | 'fit'): void;
2158
2179
  static ɵfac: i0.ɵɵFactoryDeclaration<ToolbarComponent, never>;
2159
- static ɵcmp: i0.ɵɵComponentDeclaration<ToolbarComponent, "app-toolbar", never, { "activeMode": { "alias": "activeMode"; "required": false; }; "activeBreakpoint": { "alias": "activeBreakpoint"; "required": false; }; "breakpointCounts": { "alias": "breakpointCounts"; "required": false; }; "auditCount": { "alias": "auditCount"; "required": false; }; "auditOpen": { "alias": "auditOpen"; "required": false; }; "activeZoom": { "alias": "activeZoom"; "required": false; }; "activeScreenWidth": { "alias": "activeScreenWidth"; "required": false; }; "canUndo": { "alias": "canUndo"; "required": false; }; "canRedo": { "alias": "canRedo"; "required": false; }; "isSaving": { "alias": "isSaving"; "required": false; }; "pageStatus": { "alias": "pageStatus"; "required": false; }; }, { "modeChange": "modeChange"; "breakpointChange": "breakpointChange"; "auditToggle": "auditToggle"; "zoomChange": "zoomChange"; "screenWidthChange": "screenWidthChange"; "undo": "undo"; "redo": "redo"; "save": "save"; "preview": "preview"; "publishToggle": "publishToggle"; }, never, never, false, never>;
2180
+ static ɵcmp: i0.ɵɵComponentDeclaration<ToolbarComponent, "app-toolbar", never, { "activeMode": { "alias": "activeMode"; "required": false; }; "activeBreakpoint": { "alias": "activeBreakpoint"; "required": false; }; "breakpointCounts": { "alias": "breakpointCounts"; "required": false; }; "auditCount": { "alias": "auditCount"; "required": false; }; "auditOpen": { "alias": "auditOpen"; "required": false; }; "activeZoom": { "alias": "activeZoom"; "required": false; }; "activeScreenWidth": { "alias": "activeScreenWidth"; "required": false; }; "canUndo": { "alias": "canUndo"; "required": false; }; "canRedo": { "alias": "canRedo"; "required": false; }; "isSaving": { "alias": "isSaving"; "required": false; }; "pageStatus": { "alias": "pageStatus"; "required": false; }; "formStateTarget": { "alias": "formStateTarget"; "required": false; }; "activeFormState": { "alias": "activeFormState"; "required": false; }; }, { "modeChange": "modeChange"; "breakpointChange": "breakpointChange"; "formStateChange": "formStateChange"; "auditToggle": "auditToggle"; "zoomChange": "zoomChange"; "screenWidthChange": "screenWidthChange"; "undo": "undo"; "redo": "redo"; "save": "save"; "preview": "preview"; "publishToggle": "publishToggle"; }, never, never, false, never>;
2160
2181
  }
2161
2182
 
2162
2183
  /**
@@ -2852,6 +2873,68 @@ declare function essentialTraitsFor(type: string | null | undefined): readonly s
2852
2873
  */
2853
2874
  declare function matchesControlSearch(name: string, label: string, term: string): boolean;
2854
2875
 
2876
+ /**
2877
+ * FORM PRESETS — a complete, working form as one insert.
2878
+ *
2879
+ * This is the piece that makes the whole feature feel simple. Dropping a preset gives a form that
2880
+ * already validates, already stores, and already has designed Success and Error blocks — so the
2881
+ * author's first action is editing copy, not wiring plumbing. Nothing here is a new component type:
2882
+ * what lands on the canvas is ordinary nodes, editable and take-apart-able afterwards.
2883
+ *
2884
+ * Mirrors `layout-presets.ts` deliberately: same shape, same build-from-configs approach, so there
2885
+ * is one way to express "a preset" in this codebase rather than two.
2886
+ */
2887
+ interface FormPresetField {
2888
+ label: string;
2889
+ control: string;
2890
+ required?: boolean;
2891
+ help?: string;
2892
+ placeholder?: string;
2893
+ /** Choices for select/radio, `value|Label` per line — the Field's `optionsText` trait. */
2894
+ optionsText?: string;
2895
+ rows?: number;
2896
+ }
2897
+ interface FormPresetDef {
2898
+ id: string;
2899
+ name: string;
2900
+ icon: string;
2901
+ /** One line in the panel: what it collects and where it goes. */
2902
+ description: string;
2903
+ /** The form's author-facing name, which the submissions inbox groups by. */
2904
+ formName: string;
2905
+ fields: FormPresetField[];
2906
+ submitLabel: string;
2907
+ successText: string;
2908
+ errorText: string;
2909
+ }
2910
+ declare const FORM_PRESETS: readonly FormPresetDef[];
2911
+ /** How a config is produced. The caller owns the registry, so this file stays pure. */
2912
+ type CreateConfig = (type: string) => ComponentNode | null | undefined;
2913
+ /**
2914
+ * Build a preset's node tree.
2915
+ *
2916
+ * The Form config already auto-creates its children (two fields, a submit, and the two state
2917
+ * blocks), so this REPLACES them wholesale rather than appending — otherwise every preset would
2918
+ * carry the default Name/Email pair as well as its own fields.
2919
+ *
2920
+ * Returns null when a type is missing from the registry, so a half-built tree never reaches a page.
2921
+ */
2922
+ declare function buildFormPreset(def: FormPresetDef, createConfig: CreateConfig): ComponentNode | null;
2923
+
2924
+ /** The node type that scopes a form. Kept here so the rule has one name, not a scattered literal. */
2925
+ declare const FORM_TYPE = "Form";
2926
+ /**
2927
+ * The form the current selection belongs to — the NEAREST Form ancestor, or the selection itself
2928
+ * when a Form is selected.
2929
+ *
2930
+ * This is the selection-side expression of decision D1: a field belongs to its nearest ancestor
2931
+ * form. Searching the path from the deepest node outward is what makes "nearest" true, and it is
2932
+ * why a nested form (were one ever allowed) could not capture an outer form's toolbar.
2933
+ *
2934
+ * @param path Ancestor chain from the root down to the selected node, as `selectedPath` holds it.
2935
+ */
2936
+ declare function nearestFormNode(path: readonly ComponentNode[] | null | undefined): ComponentNode | null;
2937
+
2855
2938
  /**
2856
2939
  * The text on the drop indicator's chip — "into Card grid · position 2 of 3" (B2).
2857
2940
  *
@@ -2994,5 +3077,5 @@ declare class TextBlockComponentConfig extends ComponentConfig {
2994
3077
  constructor();
2995
3078
  }
2996
3079
 
2997
- export { ACTION_TYPE_OPTIONS, AuditCode, AuditPanelComponent, AuditSeverity, BREAKPOINT_PRESENTATION, BUILDER_CANVAS_CONTAINER, BackgroundGroupStyleConfig, BorderGroupStyleConfig, BreadcrumbBarComponent, BuilderButtonBlockComponent, BuilderButtonComponentConfig, BuilderClipboardService, BuilderComponent, BuilderContainerComponent, BuilderContainerComponentConfig, BuilderDataSourceService, BuilderDividerComponentConfig, BuilderHeadingComponentConfig, BuilderHistoryService, BuilderIconComponentConfig, BuilderImageComponentConfig, BuilderLinkComponentConfig, BuilderLinkedContainerComponent, BuilderLinkedContainerConfig, BuilderListComponentConfig, BuilderListItemComponentConfig, BuilderMode, BuilderRepeaterComponent, BuilderSpacerComponentConfig, ButtonBlockComponentConfig, CardComponentConfig, ChildLayoutGroupStyleConfig, ComponentConfig, ComponentRegistryService, DEFAULT_ESSENTIAL_TRAITS, DRAG_HANDLE_ATTR, DataSourceRegistryService, DataSourceType, DimensionsGroupStyleConfig, DragEngineService, EASING_OPTIONS, ESSENTIAL_TRAITS_BY_TYPE, EffectsGroupStyleConfig, FieldComponentConfig, FieldGroupComponentConfig, FormComponentConfig, FormErrorComponentConfig, FormSuccessComponentConfig, GalleryConfig, GroupStyleConfig, INTERACTION_STATES, INVERSE_ACTION, IOX_DATA_SOURCE_ENDPOINTS, IOX_FONT_MANAGER, InteractionEngineService, InteractionPresetRegistryService, IoxBuilderModule, IoxDraggableDirective, IoxDropzoneDirective, LAYOUT_PRESETS, LayerTreeComponent, LayoutGroupStyleConfig, ListGroupStyleConfig, NodeAction, OverlayComponent, OverlayService, PanelChildComponent, PanelComponent, PanelEventService, PanelEventTypes, PanelTypes, PositionGroupStyleConfig, PresetRegistryService, RELATIONAL_STATES, RELATIONAL_STATE_BASE, ROUTE_ANIMATION_OPTIONS, RenderDirective, RepeaterComponentConfig, SCREEN_WIDTH_OPTIONS, STRUCTURAL_STATES, SUPPORTED_STATES, SectionComponent, SectionComponentConfig, SizeGroupStyleConfig, SliderContainerComponent, SliderContainerConfig, SliderSlideComponent, SliderSlideConfig, SpacingGroupStyleConfig, StyleCategory, StyleRegistryService, TraitConfig as StyleTraitConfig, SubmitButtonComponentConfig, SymbolRegistryService, TARGETED_STATES, TARGETED_STATE_BASE, TRIGGER_OPTIONS, TextBlockComponentConfig, ToolbarAction, ToolbarComponent, TraitConfig, TraitInputType, TypographyGroupStyleConfig, UNITS_ALL, UNITS_DEG, UNITS_FIXED, UNITS_NO_VW, ViewportService, ZOOM_OPTIONS, arrayItemSchemaFields, arraySchemaFields, auditNodes, buildFullStyleTraits, buildLayoutPreset, buildPresetStyleTraits, canFluidise, collapseColumnsProps, columnCountOf, defaultPageSettings, dropTargetLabel, essentialTraitsFor, findNodeLocation, findParentOf, flattenSchemaFields, fluidiseProps, generateNodeId, isHiddenAt, matchesControlSearch, nodeAncestorPath, nodeAncestorPathInEither, reorderProps, resolveInsertTarget, resolveTraitControllerType, resolveTraitOptions, setStyleTrait, stackChildrenProps, summarise, visibilityProps, wrapNode };
2998
- export type { AuditFinding, AuditNode, BreakpointPresentation, BuilderClipboard, ComponentEventDef, ComponentMethodDef, ComponentNode, ComponentTrait, Crumb, DragPayload, DsFilterByQueryParam, DsFilterByRouteParam, ElementState, HistoryEntry, InsertTarget, InteractionAction, InteractionActionType, InteractionPreset, InteractionTrigger, IoxBinding, IoxDataSource, IoxDropEvent, IoxFontManager, IoxInteraction, IoxSymbol, LayoutPresetChildStyles, LayoutPresetDef, NodeRef, OverlayBoxModel, OverlayBoxSpacing, OverlayEntry, PageRouteAnimationSettings, PageScrollSettings, PageSettings, PageStyleSettings, PanelEvent, QuadSizeSegment, RouteAnimationPreset, ScreenWidthOption, SelectionBadge, StyleMap, StylePreset, StyleTrait, StyleTraitGroup, TraitOptionMap, TraitSelectOption, TraitShowCondition, TreePathNode, ViewportState, ZoomOption };
3080
+ export { ACTION_TYPE_OPTIONS, AuditCode, AuditPanelComponent, AuditSeverity, BREAKPOINT_PRESENTATION, BUILDER_CANVAS_CONTAINER, BackgroundGroupStyleConfig, BorderGroupStyleConfig, BreadcrumbBarComponent, BuilderButtonBlockComponent, BuilderButtonComponentConfig, BuilderClipboardService, BuilderComponent, BuilderContainerComponent, BuilderContainerComponentConfig, BuilderDataSourceService, BuilderDividerComponentConfig, BuilderHeadingComponentConfig, BuilderHistoryService, BuilderIconComponentConfig, BuilderImageComponentConfig, BuilderLinkComponentConfig, BuilderLinkedContainerComponent, BuilderLinkedContainerConfig, BuilderListComponentConfig, BuilderListItemComponentConfig, BuilderMode, BuilderRepeaterComponent, BuilderSpacerComponentConfig, ButtonBlockComponentConfig, CardComponentConfig, ChildLayoutGroupStyleConfig, ComponentConfig, ComponentRegistryService, DEFAULT_ESSENTIAL_TRAITS, DRAG_HANDLE_ATTR, DataSourceRegistryService, DataSourceType, DimensionsGroupStyleConfig, DragEngineService, EASING_OPTIONS, ESSENTIAL_TRAITS_BY_TYPE, EffectsGroupStyleConfig, FORM_PRESETS, FORM_TYPE, FieldComponentConfig, FieldGroupComponentConfig, FormComponentConfig, FormErrorComponentConfig, FormSuccessComponentConfig, GalleryConfig, GroupStyleConfig, INTERACTION_STATES, INVERSE_ACTION, IOX_DATA_SOURCE_ENDPOINTS, IOX_FONT_MANAGER, InteractionEngineService, InteractionPresetRegistryService, IoxBuilderModule, IoxDraggableDirective, IoxDropzoneDirective, LAYOUT_PRESETS, LayerTreeComponent, LayoutGroupStyleConfig, ListGroupStyleConfig, NodeAction, OverlayComponent, OverlayService, PanelChildComponent, PanelComponent, PanelEventService, PanelEventTypes, PanelTypes, PositionGroupStyleConfig, PresetRegistryService, RELATIONAL_STATES, RELATIONAL_STATE_BASE, ROUTE_ANIMATION_OPTIONS, RenderDirective, RepeaterComponentConfig, SCREEN_WIDTH_OPTIONS, STRUCTURAL_STATES, SUPPORTED_STATES, SectionComponent, SectionComponentConfig, SizeGroupStyleConfig, SliderContainerComponent, SliderContainerConfig, SliderSlideComponent, SliderSlideConfig, SpacingGroupStyleConfig, StyleCategory, StyleRegistryService, TraitConfig as StyleTraitConfig, SubmitButtonComponentConfig, SymbolRegistryService, TARGETED_STATES, TARGETED_STATE_BASE, TRIGGER_OPTIONS, TextBlockComponentConfig, ToolbarAction, ToolbarComponent, TraitConfig, TraitInputType, TypographyGroupStyleConfig, UNITS_ALL, UNITS_DEG, UNITS_FIXED, UNITS_NO_VW, ViewportService, ZOOM_OPTIONS, arrayItemSchemaFields, arraySchemaFields, auditNodes, buildFormPreset, buildFullStyleTraits, buildLayoutPreset, buildPresetStyleTraits, canFluidise, collapseColumnsProps, columnCountOf, defaultPageSettings, dropTargetLabel, essentialTraitsFor, findNodeLocation, findParentOf, flattenSchemaFields, fluidiseProps, generateNodeId, isHiddenAt, matchesControlSearch, nearestFormNode, nodeAncestorPath, nodeAncestorPathInEither, reorderProps, resolveInsertTarget, resolveTraitControllerType, resolveTraitOptions, setStyleTrait, stackChildrenProps, summarise, visibilityProps, wrapNode };
3081
+ export type { AuditFinding, AuditNode, BreakpointPresentation, BuilderClipboard, ComponentEventDef, ComponentMethodDef, ComponentNode, ComponentTrait, CreateConfig, Crumb, DragPayload, DsFilterByQueryParam, DsFilterByRouteParam, ElementState, FormPresetDef, FormPresetField, HistoryEntry, InsertTarget, InteractionAction, InteractionActionType, InteractionPreset, InteractionTrigger, IoxBinding, IoxDataSource, IoxDropEvent, IoxFontManager, IoxInteraction, IoxSymbol, LayoutPresetChildStyles, LayoutPresetDef, NodeRef, OverlayBoxModel, OverlayBoxSpacing, OverlayEntry, PageRouteAnimationSettings, PageScrollSettings, PageSettings, PageStyleSettings, PanelEvent, QuadSizeSegment, RouteAnimationPreset, ScreenWidthOption, SelectionBadge, StyleMap, StylePreset, StyleTrait, StyleTraitGroup, TraitOptionMap, TraitSelectOption, TraitShowCondition, TreePathNode, ViewportState, ZoomOption };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectoriox/iox-builder",
3
- "version": "4.10.0",
3
+ "version": "4.11.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=20.0.0",
6
6
  "@angular/core": ">=20.0.0",