@vectoriox/iox-builder 1.7.4 → 1.7.6

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.7.4",
3
+ "version": "1.7.6",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=20.0.0",
6
6
  "@angular/core": ">=20.0.0",
@@ -538,9 +538,12 @@ declare class OverlayService {
538
538
  setIntersectionRoot(el: HTMLElement | null): void;
539
539
  getIntersectionRoot(): HTMLElement | null;
540
540
  /**
541
- * Resolve the inner styled element.
542
- * Builder components apply [ngStyle] on their first child element,
543
- * so computed styles (padding, margin) live there — not on the host.
541
+ * Resolve the styled element (the one carrying `.iox-node-{id}` — where padding/margin/size live).
542
+ * Directive-host components (Image/Heading/Container/Section/…) put `iox-node-{id}` on the HOST
543
+ * itself, so the host IS the styled element. Legacy wrapper components (Card/Repeater/Slider) put
544
+ * it on the first child. Prefer the host when it's the styled element; fall back to the first
545
+ * child otherwise. (Before this, directive-host containers outlined their first child — e.g. a
546
+ * container's outline landed on the image inside it, desyncing from Moveable's resize handles.)
544
547
  */
545
548
  getStyledElement(host: HTMLElement): HTMLElement;
546
549
  registerNode(node: ComponentNode, element: HTMLElement, componentRef: ComponentRef<any>): void;
@@ -740,6 +743,77 @@ declare class DragEngineService {
740
743
  static ɵprov: i0.ɵɵInjectableDeclaration<DragEngineService>;
741
744
  }
742
745
 
746
+ /**
747
+ * StyleRegistryService — manages a single <style> tag for the builder canvas.
748
+ *
749
+ * Each builder component gets two CSS classes:
750
+ * .iox-node-{id} — applied to the inner element; handles layout/visual props
751
+ * (display, flex, background, border, padding, etc.)
752
+ * .iox-outer-{id} — applied to the host element by RenderDirective; handles
753
+ * properties that participate in the PARENT flow (margin,
754
+ * align-self, flex-grow/shrink/basis, order).
755
+ *
756
+ * This split is necessary because margin on an inner wrapper only adds internal
757
+ * space — it does not push sibling elements. Applying margin to the host element
758
+ * (which IS the flex/block child in the parent container) makes it work correctly.
759
+ *
760
+ * State styles (hover/active/focus) are stored under key `${nodeId}:${state}`
761
+ * and compiled to `.iox-node-{id}:hover { … }` selectors.
762
+ *
763
+ * Design token variables are stored under the reserved key `__tokens__` and
764
+ * compiled to a `:root { … }` block prepended to all other rules.
765
+ *
766
+ * Scoped to PageUiComponent.providers[] — one stylesheet per builder instance.
767
+ */
768
+ declare class StyleRegistryService {
769
+ readonly changes$: Subject<void>;
770
+ private rules;
771
+ private styleEl;
772
+ /**
773
+ * Properties that must live on the OUTER wrapper (.iox-outer-{id}) because they
774
+ * affect how the element participates in its PARENT layout (flex/block flow).
775
+ * Everything else goes to the INNER element (.iox-node-{id}).
776
+ *
777
+ * Exception — out-of-flow positioning (position:fixed/absolute):
778
+ * When position is fixed or absolute, width is redirected to the inner element
779
+ * (the positioned one) and a default width:100% is added if none is set, so the
780
+ * element stays visible. top/right/bottom/left/zIndex are always inner because
781
+ * they are co-ordinates of the positioned element, not the flow wrapper.
782
+ * position itself goes to inner with `!important` to beat component-scoped CSS.
783
+ */
784
+ private static readonly OUTER_PROPS;
785
+ /** Properties that need !important on the inner element to beat Angular's scoped-CSS specificity boost. */
786
+ private static readonly IMPORTANT_PROPS;
787
+ init(): void;
788
+ /**
789
+ * Write or update the base styles for a node, or a pseudo-class state override.
790
+ *
791
+ * @param nodeId The node's CSS id (used in `.iox-node-{nodeId}`)
792
+ * @param styles Flat CSS property map (camelCase keys)
793
+ * @param state Optional pseudo-class state ('hover' | 'active' | 'focus' | …).
794
+ * When provided, compiles to `.iox-node-{id}:{state} { … }`.
795
+ * State rules are NOT partitioned into inner/outer.
796
+ * @param relativeToId Ancestor css id, required for RELATIONAL states
797
+ * (e.g. 'parent-hover'). Compiles to
798
+ * `.iox-node-{relativeToId}:{base} .iox-node-{nodeId} { … }`.
799
+ */
800
+ upsert(nodeId: string, styles: Record<string, any>, state?: ElementState, relativeToId?: string): void;
801
+ /**
802
+ * Write the org-level design token variables as a `:root { … }` block.
803
+ * Token names should be CSS custom property names without the `--` prefix
804
+ * (e.g., `{ 'iox-primary-color': '#cb9090' }`).
805
+ * Pass an empty object to clear all tokens.
806
+ */
807
+ upsertTokens(tokens: Record<string, string>): void;
808
+ remove(nodeId: string): void;
809
+ destroy(): void;
810
+ private compile;
811
+ private _flushPending;
812
+ private flush;
813
+ static ɵfac: i0.ɵɵFactoryDeclaration<StyleRegistryService, never>;
814
+ static ɵprov: i0.ɵɵInjectableDeclaration<StyleRegistryService>;
815
+ }
816
+
743
817
  /**
744
818
  * MoveableCanvasService — Phase 1 of the Moveable + Selecto migration
745
819
  * (see iox-ai-guidance/architecture/builder/moveable-migration.md).
@@ -757,6 +831,7 @@ declare class DragEngineService {
757
831
  */
758
832
  declare class MoveableCanvasService {
759
833
  private dragEngine;
834
+ private styleRegistry;
760
835
  private moveable;
761
836
  private container;
762
837
  private scaleGetter;
@@ -765,7 +840,9 @@ declare class MoveableCanvasService {
765
840
  private sourceId;
766
841
  /** Called after a successful reorder so the host can emit LAYOUT_CHANGED / refresh selection. */
767
842
  onReorder: (() => void) | null;
768
- constructor(dragEngine: DragEngineService);
843
+ /** Called after a geometry commit (resize) so the host can emit LAYOUT_CHANGED (undo/save). */
844
+ onLayoutChanged: (() => void) | null;
845
+ constructor(dragEngine: DragEngineService, styleRegistry: StyleRegistryService);
769
846
  /** Wire the Moveable control box into `container`; `scaleGetter` returns the live canvas zoom. */
770
847
  init(container: HTMLElement, scaleGetter: () => number): void;
771
848
  /** Point Moveable at the selected element (skips inline-edit + preview-clone targets). */
@@ -776,6 +853,10 @@ declare class MoveableCanvasService {
776
853
  private ensureMoveable;
777
854
  private destroyMoveable;
778
855
  private commitDrag;
856
+ private commitResize;
857
+ /** Write geometry changes into the node's styleTraits (the serialized source of truth) and the
858
+ * central stylesheet, so the style panel, save (self-describing), and SSR engine all agree. */
859
+ private applyStyle;
779
860
  /** Final pointer position from the Moveable end event (client/viewport px). */
780
861
  private lastPointer;
781
862
  /** Walk up from an element to the nearest registered dropzone id (el.id is stamped by DragEngine). */
@@ -1167,77 +1248,6 @@ declare class BuilderComponent implements OnInit, AfterViewInit, OnChanges, OnDe
1167
1248
  static ɵcmp: i0.ɵɵComponentDeclaration<BuilderComponent, "app-builder", never, { "layout": { "alias": "layout"; "required": false; }; "dataSources": { "alias": "dataSources"; "required": false; }; "orgId": { "alias": "orgId"; "required": false; }; "routeParams": { "alias": "routeParams"; "required": false; }; "pageName": { "alias": "pageName"; "required": false; }; "isSaving": { "alias": "isSaving"; "required": false; }; "pageStatus": { "alias": "pageStatus"; "required": false; }; "pageSettings": { "alias": "pageSettings"; "required": false; }; "globalElements": { "alias": "globalElements"; "required": false; }; "canUndo": { "alias": "canUndo"; "required": false; }; "canRedo": { "alias": "canRedo"; "required": false; }; "moveableMode": { "alias": "moveableMode"; "required": false; }; }, { "save": "save"; "undo": "undo"; "redo": "redo"; "back": "back"; "preview": "preview"; "publishToggle": "publishToggle"; "pageSettingsChange": "pageSettingsChange"; "applyAnimationToAll": "applyAnimationToAll"; "saveBlock": "saveBlock"; "globalElementsChange": "globalElementsChange"; }, never, ["[builderComponents]", "[builderTokens]", "[builderPanel]"], false, never>;
1168
1249
  }
1169
1250
 
1170
- /**
1171
- * StyleRegistryService — manages a single <style> tag for the builder canvas.
1172
- *
1173
- * Each builder component gets two CSS classes:
1174
- * .iox-node-{id} — applied to the inner element; handles layout/visual props
1175
- * (display, flex, background, border, padding, etc.)
1176
- * .iox-outer-{id} — applied to the host element by RenderDirective; handles
1177
- * properties that participate in the PARENT flow (margin,
1178
- * align-self, flex-grow/shrink/basis, order).
1179
- *
1180
- * This split is necessary because margin on an inner wrapper only adds internal
1181
- * space — it does not push sibling elements. Applying margin to the host element
1182
- * (which IS the flex/block child in the parent container) makes it work correctly.
1183
- *
1184
- * State styles (hover/active/focus) are stored under key `${nodeId}:${state}`
1185
- * and compiled to `.iox-node-{id}:hover { … }` selectors.
1186
- *
1187
- * Design token variables are stored under the reserved key `__tokens__` and
1188
- * compiled to a `:root { … }` block prepended to all other rules.
1189
- *
1190
- * Scoped to PageUiComponent.providers[] — one stylesheet per builder instance.
1191
- */
1192
- declare class StyleRegistryService {
1193
- readonly changes$: Subject<void>;
1194
- private rules;
1195
- private styleEl;
1196
- /**
1197
- * Properties that must live on the OUTER wrapper (.iox-outer-{id}) because they
1198
- * affect how the element participates in its PARENT layout (flex/block flow).
1199
- * Everything else goes to the INNER element (.iox-node-{id}).
1200
- *
1201
- * Exception — out-of-flow positioning (position:fixed/absolute):
1202
- * When position is fixed or absolute, width is redirected to the inner element
1203
- * (the positioned one) and a default width:100% is added if none is set, so the
1204
- * element stays visible. top/right/bottom/left/zIndex are always inner because
1205
- * they are co-ordinates of the positioned element, not the flow wrapper.
1206
- * position itself goes to inner with `!important` to beat component-scoped CSS.
1207
- */
1208
- private static readonly OUTER_PROPS;
1209
- /** Properties that need !important on the inner element to beat Angular's scoped-CSS specificity boost. */
1210
- private static readonly IMPORTANT_PROPS;
1211
- init(): void;
1212
- /**
1213
- * Write or update the base styles for a node, or a pseudo-class state override.
1214
- *
1215
- * @param nodeId The node's CSS id (used in `.iox-node-{nodeId}`)
1216
- * @param styles Flat CSS property map (camelCase keys)
1217
- * @param state Optional pseudo-class state ('hover' | 'active' | 'focus' | …).
1218
- * When provided, compiles to `.iox-node-{id}:{state} { … }`.
1219
- * State rules are NOT partitioned into inner/outer.
1220
- * @param relativeToId Ancestor css id, required for RELATIONAL states
1221
- * (e.g. 'parent-hover'). Compiles to
1222
- * `.iox-node-{relativeToId}:{base} .iox-node-{nodeId} { … }`.
1223
- */
1224
- upsert(nodeId: string, styles: Record<string, any>, state?: ElementState, relativeToId?: string): void;
1225
- /**
1226
- * Write the org-level design token variables as a `:root { … }` block.
1227
- * Token names should be CSS custom property names without the `--` prefix
1228
- * (e.g., `{ 'iox-primary-color': '#cb9090' }`).
1229
- * Pass an empty object to clear all tokens.
1230
- */
1231
- upsertTokens(tokens: Record<string, string>): void;
1232
- remove(nodeId: string): void;
1233
- destroy(): void;
1234
- private compile;
1235
- private _flushPending;
1236
- private flush;
1237
- static ɵfac: i0.ɵɵFactoryDeclaration<StyleRegistryService, never>;
1238
- static ɵprov: i0.ɵɵInjectableDeclaration<StyleRegistryService>;
1239
- }
1240
-
1241
1251
  /**
1242
1252
  * RenderDirective — applied to <ng-container> to dynamically instantiate a
1243
1253
  * builder component with zero wrapper elements in the DOM.