@arsedizioni/ars-utils 22.0.43 → 22.0.47

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.
@@ -2086,7 +2086,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImpor
2086
2086
  /**
2087
2087
  * @file fx-style-class.directives.ts (Angular 21 — signals)
2088
2088
  *
2089
- * [fxStyle] — responsive inline style binding (Record<string,string>)
2089
+ * [fxStyle] — responsive inline style binding (NgStyle-compatible)
2090
2090
  * [fxClass] — responsive CSS class binding (string | string[] | Record<string,boolean>)
2091
2091
  *
2092
2092
  * Angular 21 changes:
@@ -2101,6 +2101,55 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImpor
2101
2101
  *
2102
2102
  * Breakpoint suffixes: canonical + lt-* + gt-* + *-up + *-down
2103
2103
  */
2104
+ /**
2105
+ * Flattens any {@link StyleInput} into a plain `{ property: cssValue }` map,
2106
+ * resolving `'prop.unit': value` keys (e.g. `'max-width.px': 30` → `max-width: '30px'`)
2107
+ * and stringifying numeric values. `null` / `undefined` / `''` values are skipped.
2108
+ * @param v - The raw style input (or undefined).
2109
+ * @returns A normalised `{ property: value }` map ready for `Renderer2.setStyle`.
2110
+ */
2111
+ function normalizeStyle(v) {
2112
+ const out = {};
2113
+ const addRecord = (rec) => {
2114
+ for (const [rawKey, rawVal] of Object.entries(rec)) {
2115
+ if (rawVal === null || rawVal === undefined || rawVal === '')
2116
+ continue;
2117
+ const dot = rawKey.indexOf('.');
2118
+ if (dot > -1) {
2119
+ const prop = rawKey.slice(0, dot).trim();
2120
+ const unit = rawKey.slice(dot + 1).trim();
2121
+ if (prop)
2122
+ out[prop] = `${rawVal}${unit}`;
2123
+ }
2124
+ else {
2125
+ out[rawKey.trim()] = String(rawVal);
2126
+ }
2127
+ }
2128
+ };
2129
+ const addString = (s) => {
2130
+ for (const decl of s.split(';')) {
2131
+ const i = decl.indexOf(':');
2132
+ if (i === -1)
2133
+ continue;
2134
+ const prop = decl.slice(0, i).trim();
2135
+ const val = decl.slice(i + 1).trim();
2136
+ if (prop)
2137
+ out[prop] = val;
2138
+ }
2139
+ };
2140
+ if (!v)
2141
+ return out;
2142
+ if (typeof v === 'string')
2143
+ addString(v);
2144
+ else if (Array.isArray(v)) {
2145
+ for (const item of v)
2146
+ typeof item === 'string' ? addString(item) : addRecord(item);
2147
+ }
2148
+ else {
2149
+ addRecord(v);
2150
+ }
2151
+ return out;
2152
+ }
2104
2153
  class FxStyleDirective extends ResponsiveBaseDirective {
2105
2154
  constructor() {
2106
2155
  super();
@@ -2125,12 +2174,12 @@ class FxStyleDirective extends ResponsiveBaseDirective {
2125
2174
  this.smDown = input(undefined, { ...(ngDevMode ? { debugName: "smDown" } : /* istanbul ignore next */ {}), alias: 'fxStyle.sm-down' });
2126
2175
  this.mdDown = input(undefined, { ...(ngDevMode ? { debugName: "mdDown" } : /* istanbul ignore next */ {}), alias: 'fxStyle.md-down' });
2127
2176
  this.lgDown = input(undefined, { ...(ngDevMode ? { debugName: "lgDown" } : /* istanbul ignore next */ {}), alias: 'fxStyle.lg-down' });
2128
- this._resolved = computed(() => (resolveAll({ default: this.fxStyle(), xs: this.xs(), sm: this.sm(),
2177
+ this._resolved = computed(() => normalizeStyle(resolveAll({ default: this.fxStyle(), xs: this.xs(), sm: this.sm(),
2129
2178
  md: this.md(), lg: this.lg(), xl: this.xl() }, { 'lt-sm': this.ltSm(), 'lt-md': this.ltMd(), 'lt-lg': this.ltLg(),
2130
2179
  'lt-xl': this.ltXl(), 'gt-xs': this.gtXs(), 'gt-sm': this.gtSm(), 'gt-md': this.gtMd(),
2131
2180
  'gt-lg': this.gtLg(), 'sm-up': this.smUp(), 'md-up': this.mdUp(), 'lg-up': this.lgUp(),
2132
2181
  'xl-up': this.xlUp(), 'sm-down': this.smDown(), 'md-down': this.mdDown(),
2133
- 'lg-down': this.lgDown() }, this.media.currentBp(), a => this.media.isActive(a)) ?? {}), /* @ts-ignore */
2182
+ 'lg-down': this.lgDown() }, this.media.currentBp(), a => this.media.isActive(a))), /* @ts-ignore */
2134
2183
  ...(ngDevMode ? [{ debugName: "_resolved" }] : /* istanbul ignore next */ []));
2135
2184
  /** Tracks which CSS properties were last applied — plain field, not a signal. */
2136
2185
  this._appliedProps = new Set();
@@ -2181,6 +2230,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImpor
2181
2230
  standalone: true
2182
2231
  }]
2183
2232
  }], ctorParameters: () => [], propDecorators: { fxStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle", required: false }] }], xs: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.xs", required: false }] }], sm: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.sm", required: false }] }], md: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.md", required: false }] }], lg: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.lg", required: false }] }], xl: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.xl", required: false }] }], ltSm: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.lt-sm", required: false }] }], ltMd: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.lt-md", required: false }] }], ltLg: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.lt-lg", required: false }] }], ltXl: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.lt-xl", required: false }] }], gtXs: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.gt-xs", required: false }] }], gtSm: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.gt-sm", required: false }] }], gtMd: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.gt-md", required: false }] }], gtLg: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.gt-lg", required: false }] }], smUp: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.sm-up", required: false }] }], mdUp: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.md-up", required: false }] }], lgUp: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.lg-up", required: false }] }], xlUp: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.xl-up", required: false }] }], smDown: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.sm-down", required: false }] }], mdDown: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.md-down", required: false }] }], lgDown: [{ type: i0.Input, args: [{ isSignal: true, alias: "fxStyle.lg-down", required: false }] }] } });
2233
+ /**
2234
+ * Converts any {@link ClassInput} into a flat set of active class names.
2235
+ * @param v - The class input (string, array, or `{ class: enabled }` map), or undefined.
2236
+ * @returns A `Set` of the class names that should be applied.
2237
+ */
2184
2238
  function toClassSet(v) {
2185
2239
  if (!v)
2186
2240
  return new Set();
@@ -3503,5 +3557,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImpor
3503
3557
  * Generated bundle index. Do not edit.
3504
3558
  */
3505
3559
 
3506
- export { ALIAS_FAMILIES, ALIAS_INDEX, BS5_BREAKPOINTS, BusyDialogComponent, BusyTimer, CANONICAL_ALIASES, ConfirmDialogComponent, CredentialsDialogComponent, DeleteDialogComponent, DeleteDialogConfirmMode, DialogService, FlexLayoutModule, FxClassDirective, FxFlexAlignDirective, FxFlexDirective, FxFlexFillDirective, FxFlexOffsetDirective, FxFlexOrderDirective, FxGridAreaDirective, FxGridColumnDirective, FxGridDirective, FxLayoutAlignDirective, FxLayoutDirective, FxLayoutGapDirective, FxLayoutWrapDirective, FxShowHideDirective, FxStyleDirective, IfBpDirective, InfoDialogComponent, LAYOUT_BREAKPOINTS, LAYOUT_VALUES, MediaObserver, NON_CANONICAL_PRIORITY, OtpInputComponent, PaginatorIntl, PasswordStrengthComponent, RecoverPasswordDialogComponent, ResetPasswordDialogComponent, ResponsiveBaseDirective, ToastComponent, UIService, applyVisibility, buildAlignStyles, buildFlexStyles, buildLayoutCSS, resolve, resolveAll, resolveFlexInput, resolveNonCanonical, resolveParentFlow, validateBasis, validateLayoutValue, validateWrapValue };
3560
+ export { ALIAS_FAMILIES, ALIAS_INDEX, BS5_BREAKPOINTS, BusyDialogComponent, BusyTimer, CANONICAL_ALIASES, ConfirmDialogComponent, CredentialsDialogComponent, DeleteDialogComponent, DeleteDialogConfirmMode, DialogService, FlexLayoutModule, FxClassDirective, FxFlexAlignDirective, FxFlexDirective, FxFlexFillDirective, FxFlexOffsetDirective, FxFlexOrderDirective, FxGridAreaDirective, FxGridColumnDirective, FxGridDirective, FxLayoutAlignDirective, FxLayoutDirective, FxLayoutGapDirective, FxLayoutWrapDirective, FxShowHideDirective, FxStyleDirective, IfBpDirective, InfoDialogComponent, LAYOUT_BREAKPOINTS, LAYOUT_VALUES, MediaObserver, NON_CANONICAL_PRIORITY, OtpInputComponent, PaginatorIntl, PasswordStrengthComponent, RecoverPasswordDialogComponent, ResetPasswordDialogComponent, ResponsiveBaseDirective, ToastComponent, UIService, applyVisibility, buildAlignStyles, buildFlexStyles, buildLayoutCSS, normalizeStyle, resolve, resolveAll, resolveFlexInput, resolveNonCanonical, resolveParentFlow, toBool, toClassSet, validateBasis, validateLayoutValue, validateWrapValue };
3507
3561
  //# sourceMappingURL=arsedizioni-ars-utils-ui.mjs.map