@vectoriox/iox-builder 1.4.14 → 1.4.15

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";
@@ -1973,13 +2071,14 @@ class RenderDirective {
1973
2071
  const cssId = node.styleId ?? node.id;
1974
2072
  // Register CSS rules in the central stylesheet (inner + outer split).
1975
2073
  if (cssId) {
1976
- this.styleRegistry.upsert(cssId, initialStyle);
2074
+ const composedBase = composeVirtualTraits(initialStyle);
2075
+ this.styleRegistry.upsert(cssId, composedBase);
1977
2076
  // Restore per-state overrides saved from a previous session.
1978
2077
  if (node.stateStyles) {
1979
2078
  for (const state of Object.keys(node.stateStyles)) {
1980
2079
  const stateMap = node.stateStyles[state];
1981
2080
  if (stateMap && Object.keys(stateMap).length) {
1982
- this.styleRegistry.upsert(cssId, stateMap, state);
2081
+ this.styleRegistry.upsert(cssId, composeVirtualTraits(stateMap, initialStyle), state);
1983
2082
  }
1984
2083
  }
1985
2084
  }
@@ -4913,5 +5012,5 @@ class TextBlockComponentConfig extends ComponentConfig {
4913
5012
  * Generated bundle index. Do not edit.
4914
5013
  */
4915
5014
 
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 };
5015
+ 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
5016
  //# sourceMappingURL=vectoriox-iox-builder.mjs.map