@vectoriox/iox-builder 1.4.14 → 1.4.16

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.
@@ -1312,6 +1312,104 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
1312
1312
  type: Injectable
1313
1313
  }], ctorParameters: () => [{ type: OverlayService }] });
1314
1314
 
1315
+ // Virtual trait → composed CSS property helpers.
1316
+ //
1317
+ // Several style traits are "virtual" — they don't map 1:1 to a CSS property but
1318
+ // are components of a multi-function CSS value. composeVirtualTraits() strips
1319
+ // these virtual keys from the style map and replaces them with the correctly
1320
+ // composed CSS properties (filter, backdrop-filter, transform, transition).
1321
+ //
1322
+ // The same function is used by the render directive (initial mount + state
1323
+ // restore) and by the style panel's onUpdate / setStateOverride paths, so
1324
+ // the CSS output is always consistent regardless of how styles are applied.
1325
+ // ─── Filter ──────────────────────────────────────────────────────────────────
1326
+ const FILTER_FUNS = [
1327
+ ['filterBlur', 'blur', '0px'],
1328
+ ['filterBrightness', 'brightness', '1'],
1329
+ ['filterContrast', 'contrast', '1'],
1330
+ ['filterGrayscale', 'grayscale', '0'],
1331
+ ['filterSaturate', 'saturate', '1'],
1332
+ ['filterHueRotate', 'hue-rotate', '0deg'],
1333
+ ['filterSepia', 'sepia', '0'],
1334
+ ['filterInvert', 'invert', '0'],
1335
+ ];
1336
+ // ─── Backdrop-filter ─────────────────────────────────────────────────────────
1337
+ const BACKDROP_FUNS = [
1338
+ ['backdropBlur', 'blur', '0px'],
1339
+ ['backdropBrightness', 'brightness', '1'],
1340
+ ['backdropContrast', 'contrast', '1'],
1341
+ ['backdropSaturate', 'saturate', '1'],
1342
+ ];
1343
+ // ─── Transform ───────────────────────────────────────────────────────────────
1344
+ const TRANSFORM_FUNS = [
1345
+ ['translateX', 'translateX', '0px'],
1346
+ ['translateY', 'translateY', '0px'],
1347
+ ['scaleX', 'scaleX', '1'],
1348
+ ['scaleY', 'scaleY', '1'],
1349
+ ['rotate', 'rotate', '0deg'],
1350
+ ['skewX', 'skewX', '0deg'],
1351
+ ['skewY', 'skewY', '0deg'],
1352
+ ];
1353
+ // ─── All virtual trait names ──────────────────────────────────────────────────
1354
+ const VIRTUAL_TRAIT_KEYS = new Set([
1355
+ ...FILTER_FUNS.map(([t]) => t),
1356
+ ...BACKDROP_FUNS.map(([t]) => t),
1357
+ ...TRANSFORM_FUNS.map(([t]) => t),
1358
+ 'transitionDuration', 'transitionTimingFunction', 'transitionDelay',
1359
+ ]);
1360
+ // ─── Helpers ─────────────────────────────────────────────────────────────────
1361
+ function buildFns(funs, src) {
1362
+ return funs
1363
+ .filter(([t, , d]) => src[t] != null && src[t] !== '' && src[t] !== d)
1364
+ .map(([t, fn]) => `${fn}(${src[t]})`)
1365
+ .join(' ');
1366
+ }
1367
+ // ─── Public API ───────────────────────────────────────────────────────────────
1368
+ /**
1369
+ * Strip virtual trait keys from `raw` and emit their composed CSS equivalents.
1370
+ *
1371
+ * When composing a partial state-override map (hover, active…), pass the full
1372
+ * base style map as `base` so non-overridden components (e.g. filterBrightness
1373
+ * when only filterBlur is overridden) are preserved in the composed output.
1374
+ * When operating on a complete style map, omit `base` — it defaults to `raw`.
1375
+ */
1376
+ function composeVirtualTraits(raw, base = raw) {
1377
+ // Copy all non-virtual properties as-is
1378
+ const result = {};
1379
+ for (const [k, v] of Object.entries(raw)) {
1380
+ if (!VIRTUAL_TRAIT_KEYS.has(k))
1381
+ result[k] = v;
1382
+ }
1383
+ // Merge base values for any virtual key absent from the partial override map
1384
+ const merged = (funs) => {
1385
+ const m = {};
1386
+ for (const [t] of funs)
1387
+ m[t] = raw[t] ?? base[t];
1388
+ return m;
1389
+ };
1390
+ // filter
1391
+ const filterStr = buildFns(FILTER_FUNS, merged(FILTER_FUNS));
1392
+ if (filterStr)
1393
+ result['filter'] = filterStr;
1394
+ // backdrop-filter
1395
+ const backdropStr = buildFns(BACKDROP_FUNS, merged(BACKDROP_FUNS));
1396
+ if (backdropStr)
1397
+ result['backdropFilter'] = backdropStr;
1398
+ // transform
1399
+ const transformStr = buildFns(TRANSFORM_FUNS, merged(TRANSFORM_FUNS));
1400
+ if (transformStr)
1401
+ result['transform'] = transformStr;
1402
+ // transition — only emit when duration is non-zero
1403
+ const dur = raw['transitionDuration'] ?? base['transitionDuration'];
1404
+ const ease = raw['transitionTimingFunction'] ?? base['transitionTimingFunction'];
1405
+ const del = raw['transitionDelay'] ?? base['transitionDelay'];
1406
+ if (dur && ease && dur !== '0ms' && dur !== '0s') {
1407
+ const delPart = del && del !== '0ms' && del !== '0s' ? ` ${del}` : '';
1408
+ result['transition'] = `all ${dur} ${ease}${delPart}`;
1409
+ }
1410
+ return result;
1411
+ }
1412
+
1315
1413
  var StyleCategory;
1316
1414
  (function (StyleCategory) {
1317
1415
  StyleCategory["Layout"] = "Layout";
@@ -1646,6 +1744,7 @@ class TypographyGroupStyleConfig extends GroupStyleConfig {
1646
1744
  class EffectsGroupStyleConfig extends GroupStyleConfig {
1647
1745
  constructor() {
1648
1746
  super(StyleCategory.Effects, [
1747
+ // ── Visibility ────────────────────────────────────────
1649
1748
  new TraitConfig('opacity', 'Opacity', TraitInputType.Scrub, { min: 0, max: 1, step: 0.01, units: [''] }, '1'),
1650
1749
  new TraitConfig('mixBlendMode', 'Blend Mode', TraitInputType.Select, [
1651
1750
  'normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten',
@@ -1656,6 +1755,37 @@ class EffectsGroupStyleConfig extends GroupStyleConfig {
1656
1755
  'auto', 'default', 'pointer', 'text', 'move', 'not-allowed',
1657
1756
  'grab', 'grabbing', 'crosshair', 'zoom-in', 'zoom-out', 'none',
1658
1757
  ], 'auto'),
1758
+ // ── Shadow ────────────────────────────────────────────
1759
+ new TraitConfig('boxShadow', 'Box Shadow', TraitInputType.Text, undefined, ''),
1760
+ new TraitConfig('textShadow', 'Text Shadow', TraitInputType.Text, undefined, ''),
1761
+ // ── Transform (virtual — composed to CSS transform: …) ─
1762
+ new TraitConfig('translateX', 'TX', TraitInputType.Scrub, { min: -2000, max: 2000, step: 1, units: UNITS_ALL }, '0px', true),
1763
+ new TraitConfig('translateY', 'TY', TraitInputType.Scrub, { min: -2000, max: 2000, step: 1, units: UNITS_ALL }, '0px', true),
1764
+ new TraitConfig('scaleX', 'SX', TraitInputType.Scrub, { min: 0, max: 5, step: 0.01, units: [''] }, '1', true),
1765
+ new TraitConfig('scaleY', 'SY', TraitInputType.Scrub, { min: 0, max: 5, step: 0.01, units: [''] }, '1', true),
1766
+ new TraitConfig('rotate', 'Rot', TraitInputType.Scrub, { min: -360, max: 360, step: 1, units: UNITS_DEG }, '0deg', true),
1767
+ new TraitConfig('skewX', 'SkX', TraitInputType.Scrub, { min: -180, max: 180, step: 1, units: UNITS_DEG }, '0deg', true),
1768
+ new TraitConfig('skewY', 'SkY', TraitInputType.Scrub, { min: -180, max: 180, step: 1, units: UNITS_DEG }, '0deg', true),
1769
+ // ── Filter (virtual — composed to CSS filter: …) ──────
1770
+ new TraitConfig('filterBlur', 'Blur', TraitInputType.Scrub, { min: 0, max: 50, step: 1, units: ['px'] }, '0px', true),
1771
+ new TraitConfig('filterBrightness', 'Bright', TraitInputType.Scrub, { min: 0, max: 3, step: 0.05, units: [''] }, '1', true),
1772
+ new TraitConfig('filterContrast', 'Contr', TraitInputType.Scrub, { min: 0, max: 3, step: 0.05, units: [''] }, '1', true),
1773
+ new TraitConfig('filterGrayscale', 'Gray', TraitInputType.Scrub, { min: 0, max: 1, step: 0.05, units: [''] }, '0', true),
1774
+ new TraitConfig('filterSaturate', 'Sat', TraitInputType.Scrub, { min: 0, max: 3, step: 0.05, units: [''] }, '1', true),
1775
+ new TraitConfig('filterHueRotate', 'Hue', TraitInputType.Scrub, { min: 0, max: 360, step: 1, units: UNITS_DEG }, '0deg', true),
1776
+ new TraitConfig('filterSepia', 'Sepia', TraitInputType.Scrub, { min: 0, max: 1, step: 0.05, units: [''] }, '0', true),
1777
+ new TraitConfig('filterInvert', 'Invert', TraitInputType.Scrub, { min: 0, max: 1, step: 0.05, units: [''] }, '0', true),
1778
+ // ── Backdrop filter (virtual — composed to CSS backdrop-filter: …)
1779
+ new TraitConfig('backdropBlur', 'B.Blur', TraitInputType.Scrub, { min: 0, max: 50, step: 1, units: ['px'] }, '0px', true),
1780
+ new TraitConfig('backdropBrightness', 'B.Bri', TraitInputType.Scrub, { min: 0, max: 3, step: 0.05, units: [''] }, '1', true),
1781
+ new TraitConfig('backdropContrast', 'B.Con', TraitInputType.Scrub, { min: 0, max: 3, step: 0.05, units: [''] }, '1', true),
1782
+ new TraitConfig('backdropSaturate', 'B.Sat', TraitInputType.Scrub, { min: 0, max: 3, step: 0.05, units: [''] }, '1', true),
1783
+ // ── Transition (virtual — composed to CSS transition: all …) ──
1784
+ new TraitConfig('transitionDuration', 'Duration', TraitInputType.Scrub, { min: 0, max: 3000, step: 50, units: ['ms'] }, '0ms'),
1785
+ new TraitConfig('transitionTimingFunction', 'Easing', TraitInputType.Select, [
1786
+ 'ease', 'linear', 'ease-in', 'ease-out', 'ease-in-out',
1787
+ ], 'ease'),
1788
+ new TraitConfig('transitionDelay', 'Delay', TraitInputType.Scrub, { min: 0, max: 2000, step: 50, units: ['ms'] }, '0ms'),
1659
1789
  ]);
1660
1790
  }
1661
1791
  }
@@ -1973,13 +2103,14 @@ class RenderDirective {
1973
2103
  const cssId = node.styleId ?? node.id;
1974
2104
  // Register CSS rules in the central stylesheet (inner + outer split).
1975
2105
  if (cssId) {
1976
- this.styleRegistry.upsert(cssId, initialStyle);
2106
+ const composedBase = composeVirtualTraits(initialStyle);
2107
+ this.styleRegistry.upsert(cssId, composedBase);
1977
2108
  // Restore per-state overrides saved from a previous session.
1978
2109
  if (node.stateStyles) {
1979
2110
  for (const state of Object.keys(node.stateStyles)) {
1980
2111
  const stateMap = node.stateStyles[state];
1981
2112
  if (stateMap && Object.keys(stateMap).length) {
1982
- this.styleRegistry.upsert(cssId, stateMap, state);
2113
+ this.styleRegistry.upsert(cssId, composeVirtualTraits(stateMap, initialStyle), state);
1983
2114
  }
1984
2115
  }
1985
2116
  }
@@ -4913,5 +5044,5 @@ class TextBlockComponentConfig extends ComponentConfig {
4913
5044
  * Generated bundle index. Do not edit.
4914
5045
  */
4915
5046
 
4916
- export { ACTION_TYPE_OPTIONS, BuilderButtonBlockComponent, BuilderButtonComponentConfig, BuilderComponent, BuilderContainerComponent, BuilderContainerComponentConfig, BuilderDividerComponentConfig, BuilderHeadingComponentConfig, BuilderIconComponentConfig, BuilderImageComponentConfig, BuilderLinkComponentConfig, BuilderLinkedContainerComponent, BuilderLinkedContainerConfig, BuilderMode, BuilderRepeaterComponent, BuilderSpacerComponentConfig, ButtonBlockComponentConfig, CardComponentConfig, ComponentConfig, ComponentRegistryService, DEVICE_OPTIONS, DataSourceRegistryService, DeviceMode, DragEngineService, EASING_OPTIONS$1 as EASING_OPTIONS, GroupStyleConfig, INTERACTION_STATES, 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, STRUCTURAL_STATES, SUPPORTED_STATES, 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, buildFullStyleTraits, buildPresetStyleTraits, defaultPageSettings, generateNodeId, resolveTraitControllerType, resolveTraitOptions };
5047
+ export { ACTION_TYPE_OPTIONS, BuilderButtonBlockComponent, BuilderButtonComponentConfig, BuilderComponent, BuilderContainerComponent, BuilderContainerComponentConfig, BuilderDividerComponentConfig, BuilderHeadingComponentConfig, BuilderIconComponentConfig, BuilderImageComponentConfig, BuilderLinkComponentConfig, BuilderLinkedContainerComponent, BuilderLinkedContainerConfig, BuilderMode, BuilderRepeaterComponent, BuilderSpacerComponentConfig, ButtonBlockComponentConfig, CardComponentConfig, ComponentConfig, ComponentRegistryService, DEVICE_OPTIONS, DataSourceRegistryService, DeviceMode, DragEngineService, EASING_OPTIONS$1 as EASING_OPTIONS, GroupStyleConfig, INTERACTION_STATES, 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, STRUCTURAL_STATES, SUPPORTED_STATES, SectionComponent, SectionComponentConfig, StyleCategory, StyleRegistryService, TraitConfig as StyleTraitConfig, TRIGGER_OPTIONS, TextBlockComponentConfig, ToolbarAction, ToolbarComponent, TraitConfig, TraitInputType, UNITS_ALL, UNITS_DEG, UNITS_FIXED, UNITS_NO_VW, VIRTUAL_TRAIT_KEYS, ViewportService, ZOOM_OPTIONS, buildFullStyleTraits, buildPresetStyleTraits, composeVirtualTraits, defaultPageSettings, generateNodeId, resolveTraitControllerType, resolveTraitOptions };
4917
5048
  //# sourceMappingURL=vectoriox-iox-builder.mjs.map