@vectoriox/iox-builder 1.0.8 → 1.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectoriox/iox-builder",
3
- "version": "1.0.8",
3
+ "version": "1.1.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=20.0.0",
6
6
  "@angular/core": ">=20.0.0",
@@ -107,6 +107,17 @@ declare const ACTION_TYPE_OPTIONS: {
107
107
  value: InteractionActionType;
108
108
  label: string;
109
109
  }[];
110
+ /**
111
+ * A named, reusable collection of CSS style properties stored at the org level.
112
+ * Elements reference a preset by `stylePresetId`. At render time the engine
113
+ * merges `preset.styleProps → element.styleOverrides` so local overrides win.
114
+ */
115
+ interface StylePreset {
116
+ id: string;
117
+ name: string;
118
+ /** Flat CSS property map — same shape as IoxLayoutNode.styleProps. */
119
+ styleProps: Record<string, any>;
120
+ }
110
121
  interface ComponentNode {
111
122
  id?: string;
112
123
  /**
@@ -125,7 +136,21 @@ interface ComponentNode {
125
136
  children?: ComponentNode[];
126
137
  isGlobal?: boolean;
127
138
  globalPosition?: 'before' | 'after';
139
+ /** ID of the org-level StylePreset applied to this node. */
140
+ stylePresetId?: string;
141
+ /**
142
+ * CSS properties explicitly overridden by the user after a preset was applied.
143
+ * Serialized to `styleProps` in the page layout JSON when a preset is active.
144
+ * Absent when no preset is applied (full styles stored in styleTraits instead).
145
+ */
146
+ styleOverrides?: Record<string, any>;
128
147
  }
148
+ /**
149
+ * Build a full StyleTraitGroup[] schema populated with values from a flat
150
+ * styleProps map. Used when editing a preset in the Style panel — the panel
151
+ * receives the same `StyleTraitGroup[]` shape regardless of context.
152
+ */
153
+ declare function buildPresetStyleTraits(styleProps: Record<string, any>): StyleTraitGroup[];
129
154
  declare enum TraitInputType {
130
155
  Text = "text",
131
156
  Number = "number",
@@ -266,7 +291,8 @@ declare enum ToolbarAction {
266
291
  Play = "play",
267
292
  SaveAsBlock = "save-as-block",
268
293
  MakeGlobal = "make-global",
269
- RemoveGlobal = "remove-global"
294
+ RemoveGlobal = "remove-global",
295
+ EditPreset = "edit-preset"
270
296
  }
271
297
  declare enum NodeAction {
272
298
  Delete = "delete",
@@ -373,7 +399,11 @@ declare enum PanelEventTypes {
373
399
  PANEL_OPEN = "panelopen",
374
400
  PANEL_CLOSE = "panelclose",
375
401
  BINDING_CHANGED = "bindingchanged",
376
- NODE_RENDERED = "noderendered"
402
+ NODE_RENDERED = "noderendered",
403
+ /** Open the Style panel in preset-edit mode for the given preset ID. */
404
+ PRESET_EDIT = "presetedit",
405
+ /** Fired after a preset is created, updated, or deleted so panels refresh their list. */
406
+ PRESETS_CHANGED = "presetschanged"
377
407
  }
378
408
  interface PanelEvent {
379
409
  type: PanelEventTypes;
@@ -579,6 +609,9 @@ declare class ViewportService {
579
609
  x: number;
580
610
  y: number;
581
611
  };
612
+ private update;
613
+ private saveToStorage;
614
+ private loadFromStorage;
582
615
  static ɵfac: i0.ɵɵFactoryDeclaration<ViewportService, never>;
583
616
  static ɵprov: i0.ɵɵInjectableDeclaration<ViewportService>;
584
617
  }
@@ -830,9 +863,39 @@ declare class IoxDropzoneDirective implements OnInit, OnDestroy {
830
863
  static ɵdir: i0.ɵɵDirectiveDeclaration<IoxDropzoneDirective, "[ioxDropzone]", never, { "ioxDropzoneId": { "alias": "ioxDropzoneId"; "required": false; }; "ioxDropzoneData": { "alias": "ioxDropzoneData"; "required": false; }; "ioxDropzonePostDrop": { "alias": "ioxDropzonePostDrop"; "required": false; }; }, { "ioxDrop": "ioxDrop"; }, never, never, false, never>;
831
864
  }
832
865
 
866
+ /**
867
+ * PresetRegistryService — in-memory store for org-level style presets.
868
+ *
869
+ * Loaded once per page by PageUiComponent (alongside the page layout) and
870
+ * injected into the overlay (for badge labels) and style panel (for apply /
871
+ * create / edit / detach flows).
872
+ *
873
+ * Scoped to PageUiComponent.providers[] — one registry per builder instance.
874
+ */
875
+ declare class PresetRegistryService {
876
+ private presets;
877
+ setPresets(presets: StylePreset[]): void;
878
+ getPreset(id: string): StylePreset | undefined;
879
+ getAll(): StylePreset[];
880
+ upsert(preset: StylePreset): void;
881
+ remove(id: string): void;
882
+ /**
883
+ * Resolve the effective style map for a node that references a preset.
884
+ * Merges preset base styles with the node's local overrides so that
885
+ * element-level values always win.
886
+ *
887
+ * @param presetId ID of the applied preset.
888
+ * @param overrides The node's `styleOverrides` record (may be empty).
889
+ */
890
+ resolveStyles(presetId: string, overrides: Record<string, any>): Record<string, any>;
891
+ static ɵfac: i0.ɵɵFactoryDeclaration<PresetRegistryService, never>;
892
+ static ɵprov: i0.ɵɵInjectableDeclaration<PresetRegistryService>;
893
+ }
894
+
833
895
  declare class OverlayComponent implements OnInit, OnDestroy {
834
896
  private overlayService;
835
897
  private viewportService;
898
+ private presetRegistry;
836
899
  private cdr;
837
900
  toolbarAction: EventEmitter<{
838
901
  action: ToolbarAction;
@@ -854,7 +917,7 @@ declare class OverlayComponent implements OnInit, OnDestroy {
854
917
  private mutationObserver?;
855
918
  private boundUpdate;
856
919
  private activeScrollContainer;
857
- constructor(overlayService: OverlayService, viewportService: ViewportService, cdr: ChangeDetectorRef);
920
+ constructor(overlayService: OverlayService, viewportService: ViewportService, presetRegistry: PresetRegistryService, cdr: ChangeDetectorRef);
858
921
  ngOnInit(): void;
859
922
  ngOnDestroy(): void;
860
923
  onSelectParent(event: MouseEvent): void;
@@ -871,6 +934,8 @@ declare class OverlayComponent implements OnInit, OnDestroy {
871
934
  closeContextMenu(): void;
872
935
  get hasInteractions(): boolean;
873
936
  get selectedNodeIsGlobal(): boolean;
937
+ get selectedPresetName(): string | null;
938
+ onEditPreset(event: MouseEvent): void;
874
939
  private observeSelectElement;
875
940
  private updateAll;
876
941
  private updateHover;
@@ -1239,5 +1304,5 @@ declare class TextBlockComponentConfig extends ComponentConfig {
1239
1304
  constructor();
1240
1305
  }
1241
1306
 
1242
- export { ACTION_TYPE_OPTIONS, BuilderButtonComponentConfig, BuilderComponent, BuilderContainerComponent, BuilderContainerComponentConfig, BuilderDividerComponentConfig, BuilderHeadingComponentConfig, BuilderIconComponentConfig, BuilderImageComponentConfig, BuilderLinkComponentConfig, BuilderLinkedContainerComponent, BuilderLinkedContainerConfig, BuilderMode, BuilderRepeaterComponent, BuilderSpacerComponentConfig, CardComponentConfig, ComponentConfig, ComponentRegistryService, DEVICE_OPTIONS, DataSourceRegistryService, DeviceMode, DragEngineService, EASING_OPTIONS, GroupStyleConfig, IOX_CONTENT_SERVICE, IOX_FONT_MANAGER, InteractionEngineService, InteractionsPanelComponent, IoxBuilderModule, IoxDraggableDirective, IoxDropzoneDirective, LayerTreeComponent, NodeAction, OverlayComponent, OverlayService, PanelChildComponent, PanelComponent, PanelEventService, PanelEventTypes, PanelTypes, ROUTE_ANIMATION_OPTIONS, RenderDirective, RepeaterComponentConfig, SCREEN_WIDTH_OPTIONS, SectionComponent, SectionComponentConfig, StyleCategory, StyleRegistryService, TraitConfig as StyleTraitConfig, TRIGGER_OPTIONS, TextBlockComponentConfig, ToolbarAction, ToolbarComponent, TraitConfig, TraitInputType, UNITS_ALL, UNITS_DEG, UNITS_FIXED, UNITS_NO_VW, ViewportService, ZOOM_OPTIONS, defaultPageSettings, generateNodeId, resolveTraitControllerType, resolveTraitOptions };
1243
- export type { ComponentNode, ComponentTrait, DeviceOption, DragPayload, DsFilterByQueryParam, DsFilterByRouteParam, InteractionAction, InteractionActionType, InteractionTrigger, IoxBinding, IoxContentService, IoxDataSource, IoxDropEvent, IoxFontManager, IoxInteraction, NodeRef, OverlayBoxModel, OverlayBoxSpacing, OverlayEntry, PageRouteAnimationSettings, PageScrollSettings, PageSettings, PageStyleSettings, PanelEvent, QuadSizeSegment, RouteAnimationPreset, ScreenWidthOption, StyleTrait, StyleTraitGroup, TraitOptionMap, TraitSelectOption, TraitShowCondition, ViewportState, ZoomOption };
1307
+ export { ACTION_TYPE_OPTIONS, BuilderButtonComponentConfig, BuilderComponent, BuilderContainerComponent, BuilderContainerComponentConfig, BuilderDividerComponentConfig, BuilderHeadingComponentConfig, BuilderIconComponentConfig, BuilderImageComponentConfig, BuilderLinkComponentConfig, BuilderLinkedContainerComponent, BuilderLinkedContainerConfig, BuilderMode, BuilderRepeaterComponent, BuilderSpacerComponentConfig, CardComponentConfig, ComponentConfig, ComponentRegistryService, DEVICE_OPTIONS, DataSourceRegistryService, DeviceMode, DragEngineService, EASING_OPTIONS, GroupStyleConfig, IOX_CONTENT_SERVICE, IOX_FONT_MANAGER, InteractionEngineService, InteractionsPanelComponent, IoxBuilderModule, IoxDraggableDirective, IoxDropzoneDirective, LayerTreeComponent, NodeAction, OverlayComponent, OverlayService, PanelChildComponent, PanelComponent, PanelEventService, PanelEventTypes, PanelTypes, PresetRegistryService, ROUTE_ANIMATION_OPTIONS, RenderDirective, RepeaterComponentConfig, SCREEN_WIDTH_OPTIONS, SectionComponent, SectionComponentConfig, StyleCategory, StyleRegistryService, TraitConfig as StyleTraitConfig, TRIGGER_OPTIONS, TextBlockComponentConfig, ToolbarAction, ToolbarComponent, TraitConfig, TraitInputType, UNITS_ALL, UNITS_DEG, UNITS_FIXED, UNITS_NO_VW, ViewportService, ZOOM_OPTIONS, buildPresetStyleTraits, defaultPageSettings, generateNodeId, resolveTraitControllerType, resolveTraitOptions };
1308
+ export type { ComponentNode, ComponentTrait, DeviceOption, DragPayload, DsFilterByQueryParam, DsFilterByRouteParam, InteractionAction, InteractionActionType, InteractionTrigger, IoxBinding, IoxContentService, IoxDataSource, IoxDropEvent, IoxFontManager, IoxInteraction, NodeRef, OverlayBoxModel, OverlayBoxSpacing, OverlayEntry, PageRouteAnimationSettings, PageScrollSettings, PageSettings, PageStyleSettings, PanelEvent, QuadSizeSegment, RouteAnimationPreset, ScreenWidthOption, StylePreset, StyleTrait, StyleTraitGroup, TraitOptionMap, TraitSelectOption, TraitShowCondition, ViewportState, ZoomOption };