@vectoriox/iox-builder 1.6.8 → 1.6.10

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.
@@ -17,7 +17,7 @@ import { SelectModule } from 'primeng/select';
17
17
  import { TooltipModule } from 'primeng/tooltip';
18
18
  import { DialogModule } from 'primeng/dialog';
19
19
  import * as i14 from '@vectoriox/iox-ui';
20
- import { ComponentInstanceRegistryService, IS_PREVIEW, IoxPageModule } from '@vectoriox/iox-ui';
20
+ import { ComponentInstanceRegistryService, DEFAULT_WIDTH_BY_TYPE, compileDeclarations, IS_PREVIEW, IoxPageModule } from '@vectoriox/iox-ui';
21
21
  export { ComponentInstanceRegistryService } from '@vectoriox/iox-ui';
22
22
  import Lenis from 'lenis';
23
23
  import { Subject, BehaviorSubject } from 'rxjs';
@@ -2086,6 +2086,12 @@ class ComponentConfig {
2086
2086
  /** Override specific trait defaults after styleTraits are set.
2087
2087
  * Call this at the end of each subclass constructor. */
2088
2088
  applyStyleDefaults(defaults) {
2089
+ // Single source of truth for container-type width defaults: when a subclass does
2090
+ // not set width explicitly, fill it from the shared DEFAULT_WIDTH_BY_TYPE map — the
2091
+ // same map the SSR engine resolves from. See render-parity.md.
2092
+ if (defaults['width'] === undefined && DEFAULT_WIDTH_BY_TYPE[this.type] !== undefined) {
2093
+ defaults = { ...defaults, width: DEFAULT_WIDTH_BY_TYPE[this.type] };
2094
+ }
2089
2095
  for (const group of this.styleTraits) {
2090
2096
  for (const trait of group.traits) {
2091
2097
  if (defaults[trait.name] !== undefined) {
@@ -2618,32 +2624,14 @@ class StyleRegistryService {
2618
2624
  }
2619
2625
  }
2620
2626
  compile(className, styles) {
2621
- const entries = Object.entries(styles)
2622
- .filter(([, v]) => v !== undefined && v !== null && v !== '')
2623
- .map(([k, v]) => {
2624
- const val = this.rewriteVh(String(v));
2625
- const bang = StyleRegistryService.IMPORTANT_PROPS.has(k) ? ' !important' : '';
2626
- return ` ${this.toKebabCase(k)}: ${val}${bang};`;
2627
- });
2628
- if (!entries.length)
2627
+ // Declaration compilation (kebab-case, viewport-unit rewrite, !important) lives in
2628
+ // the shared style-compiler so the SSR engine produces byte-identical output.
2629
+ // The inner/outer partition + selector emission stay here (builder-only concern).
2630
+ const decls = compileDeclarations(styles, StyleRegistryService.IMPORTANT_PROPS);
2631
+ if (!decls.length)
2629
2632
  return '';
2630
- return `.${className} {\n${entries.join('\n')}\n}`;
2631
- }
2632
- /**
2633
- * Rewrite viewport-relative units so they resolve to the simulated canvas
2634
- * dimensions rather than the real browser viewport.
2635
- *
2636
- * --preview-vh / --preview-vw are set by BuilderComponent via ResizeObserver
2637
- * and viewport-state subscription. In production (no variables defined) the
2638
- * fallbacks `1vh` / `1vw` restore the original browser behaviour.
2639
- */
2640
- rewriteVh(value) {
2641
- return value
2642
- .replace(/(-?\d*\.?\d+)vh/g, 'calc($1 * var(--preview-vh, 1vh))')
2643
- .replace(/(-?\d*\.?\d+)vw/g, 'calc($1 * var(--preview-vw, 1vw))');
2644
- }
2645
- toKebabCase(str) {
2646
- return str.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`);
2633
+ const body = decls.map(d => ` ${d};`).join('\n');
2634
+ return `.${className} {\n${body}\n}`;
2647
2635
  }
2648
2636
  flush() {
2649
2637
  if (!this.styleEl || this._flushPending)
@@ -7111,7 +7099,6 @@ class BuilderContainerComponentConfig extends ComponentConfig {
7111
7099
  ];
7112
7100
  this.styleTraits = buildFullStyleTraits();
7113
7101
  this.applyStyleDefaults({
7114
- width: '100%',
7115
7102
  height: 'auto',
7116
7103
  minHeight: '200px',
7117
7104
  display: 'block',
@@ -7126,7 +7113,6 @@ class BuilderDividerComponentConfig extends ComponentConfig {
7126
7113
  this.traits = [];
7127
7114
  this.styleTraits = buildFullStyleTraits();
7128
7115
  this.applyStyleDefaults({
7129
- width: '100%',
7130
7116
  height: '1px',
7131
7117
  backgroundColor: '#cccccc',
7132
7118
  margin: '8px 0px 8px 0px',
@@ -7251,7 +7237,6 @@ class BuilderListItemComponentConfig extends ComponentConfig {
7251
7237
  this.styleTraits = buildFullStyleTraits();
7252
7238
  this.children = [];
7253
7239
  this.applyStyleDefaults({
7254
- width: '100%',
7255
7240
  display: 'block',
7256
7241
  backgroundColor: 'transparent',
7257
7242
  });
@@ -7272,7 +7257,6 @@ class TextBlockComponentConfig extends ComponentConfig {
7272
7257
  this.styleTraits = buildFullStyleTraits();
7273
7258
  this.applyStyleDefaults({
7274
7259
  display: 'block',
7275
- width: '100%',
7276
7260
  height: 'auto',
7277
7261
  minHeight: '20px',
7278
7262
  padding: '10px',
@@ -7305,7 +7289,6 @@ class BuilderListComponentConfig extends ComponentConfig {
7305
7289
  this.makeListItem(),
7306
7290
  ];
7307
7291
  this.applyStyleDefaults({
7308
- width: '100%',
7309
7292
  display: 'block',
7310
7293
  backgroundColor: 'transparent',
7311
7294
  padding: '0px 0px 0px 24px',
@@ -7343,7 +7326,6 @@ class RepeaterComponentConfig extends ComponentConfig {
7343
7326
  ];
7344
7327
  this.styleTraits = buildFullStyleTraits();
7345
7328
  this.applyStyleDefaults({
7346
- width: '100%',
7347
7329
  height: 'auto',
7348
7330
  });
7349
7331
  }
@@ -7512,9 +7494,7 @@ class SliderContainerConfig extends ComponentConfig {
7512
7494
  new BackgroundGroupStyleConfig(),
7513
7495
  new EffectsGroupStyleConfig(),
7514
7496
  ];
7515
- this.applyStyleDefaults({
7516
- width: '100%',
7517
- });
7497
+ this.applyStyleDefaults({});
7518
7498
  }
7519
7499
  }
7520
7500
 
@@ -7524,7 +7504,6 @@ class BuilderSpacerComponentConfig extends ComponentConfig {
7524
7504
  this.traits = [];
7525
7505
  this.styleTraits = buildFullStyleTraits();
7526
7506
  this.applyStyleDefaults({
7527
- width: '100%',
7528
7507
  height: '40px',
7529
7508
  });
7530
7509
  }