@arsedizioni/ars-utils 22.0.52 → 22.0.54

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.
@@ -1037,10 +1037,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImpor
1037
1037
  * • calc() support (flex-grow/shrink/basis split, operator padding)
1038
1038
  * • wrap-container basis rewrite (ngx issue 660)
1039
1039
  *
1040
- * Extensions beyond ngx-layout (documented, opt-in by syntax):
1041
- * • fxFlex="*" → fills the remaining space like fxFlex="grow" (1 1 100%)
1042
- * fxFlex="" + a SIBLING with fxFlex="*" this element gets 0 0 auto
1043
- * (static-attribute detection only; property bindings are not seen)
1040
+ * Extensions beyond ngx-layout (documented):
1041
+ * • fxFlex="*" → fills like fxFlex="grow" (1 1 100%).
1042
+ * A bare fxFlex keeps the ngx default: 1 1 0%.
1043
+ * • addFlexToParent if the direct parent is not a flex container, this directive
1044
+ * sets display:flex on it so children work without fxLayout
1044
1045
  *
1045
1046
  * Breakpoint suffixes: canonical + lt-* + gt-* + *-up + *-down
1046
1047
  */
@@ -1175,66 +1176,42 @@ function buildFlexStyles(value, direction, hasWrap) {
1175
1176
  out[k] = v === null ? null : String(v);
1176
1177
  return out;
1177
1178
  }
1178
- /** Extension: true when a sibling element declares fxFlex="*" (static attribute). */
1179
- function parentHasStar(el) {
1180
- const parent = el.parentElement;
1181
- if (!parent)
1182
- return false;
1183
- return Array.from(parent.children).some(c => c !== el && (c.getAttribute('fxflex') === '*' || c.getAttribute('fxFlex') === '*'));
1184
- }
1185
1179
  /**
1186
- * Resolves the non-ngx fxFlex extensions to a value `buildFlexStyles` understands.
1187
- * '*' → 'grow' (fill the remaining space `flex: 1 1 100%`, max-* 100%)
1188
- * '' with a `*` sibling → 'none' (`0 0 auto`)
1189
- * • anything else → returned unchanged
1180
+ * Resolves the non-ngx `fxFlex="*"` extension to `grow` (`flex: 1 1 100%`, max-* 100%).
1181
+ * Every other value including a bare `fxFlex` ('') is returned unchanged, so a bare
1182
+ * fxFlex keeps the ngx-layout default (`1 1 0%` in row, `1 1 0.000000001px` in column).
1190
1183
  * @param raw - The resolved fxFlex value for the active breakpoint.
1191
- * @param hasStarSibling - Whether a sibling element declares `fxFlex="*"`.
1192
1184
  * @returns The value to pass to `buildFlexStyles`.
1193
1185
  */
1194
- function resolveFlexInput(raw, hasStarSibling) {
1195
- if (raw === '*')
1196
- return 'grow';
1197
- if (raw === '' && hasStarSibling)
1198
- return 'none';
1199
- return raw;
1200
- }
1201
- /**
1202
- * Coerces an fxFlex binding value to the string form the builder expects.
1203
- * Accepts numbers (e.g. `[fxFlex]="32"` or `[fxFlex]="cond ? 24 : 32"`) and
1204
- * normalises them to a string; keeps `''` (bare attribute) as-is; maps
1205
- * null/undefined to "not set".
1206
- * @param v - The bound value: a string, a number, null, or undefined.
1207
- * @returns The trimmed string value, or undefined when not set.
1208
- */
1209
- function coerceFlex(v) {
1210
- return v === null || v === undefined ? undefined : String(v).trim();
1186
+ function resolveFlexInput(raw) {
1187
+ return raw === '*' ? 'grow' : raw;
1211
1188
  }
1212
1189
  class FxFlexDirective extends ResponsiveBaseDirective {
1213
1190
  constructor() {
1214
1191
  super();
1215
1192
  /** Direct ancestor FxLayout (any level); matched to the direct parent in the effect. */
1216
1193
  this.parentLayout = inject(FxLayoutDirective, { skipSelf: true, optional: true });
1217
- this.fxFlex = input(undefined, { ...(ngDevMode ? { debugName: "fxFlex" } : /* istanbul ignore next */ {}), alias: 'fxFlex', transform: coerceFlex });
1218
- this.xs = input(undefined, { ...(ngDevMode ? { debugName: "xs" } : /* istanbul ignore next */ {}), alias: 'fxFlex.xs', transform: coerceFlex });
1219
- this.sm = input(undefined, { ...(ngDevMode ? { debugName: "sm" } : /* istanbul ignore next */ {}), alias: 'fxFlex.sm', transform: coerceFlex });
1220
- this.md = input(undefined, { ...(ngDevMode ? { debugName: "md" } : /* istanbul ignore next */ {}), alias: 'fxFlex.md', transform: coerceFlex });
1221
- this.lg = input(undefined, { ...(ngDevMode ? { debugName: "lg" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lg', transform: coerceFlex });
1222
- this.xl = input(undefined, { ...(ngDevMode ? { debugName: "xl" } : /* istanbul ignore next */ {}), alias: 'fxFlex.xl', transform: coerceFlex });
1223
- this.ltSm = input(undefined, { ...(ngDevMode ? { debugName: "ltSm" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lt-sm', transform: coerceFlex });
1224
- this.ltMd = input(undefined, { ...(ngDevMode ? { debugName: "ltMd" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lt-md', transform: coerceFlex });
1225
- this.ltLg = input(undefined, { ...(ngDevMode ? { debugName: "ltLg" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lt-lg', transform: coerceFlex });
1226
- this.ltXl = input(undefined, { ...(ngDevMode ? { debugName: "ltXl" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lt-xl', transform: coerceFlex });
1227
- this.gtXs = input(undefined, { ...(ngDevMode ? { debugName: "gtXs" } : /* istanbul ignore next */ {}), alias: 'fxFlex.gt-xs', transform: coerceFlex });
1228
- this.gtSm = input(undefined, { ...(ngDevMode ? { debugName: "gtSm" } : /* istanbul ignore next */ {}), alias: 'fxFlex.gt-sm', transform: coerceFlex });
1229
- this.gtMd = input(undefined, { ...(ngDevMode ? { debugName: "gtMd" } : /* istanbul ignore next */ {}), alias: 'fxFlex.gt-md', transform: coerceFlex });
1230
- this.gtLg = input(undefined, { ...(ngDevMode ? { debugName: "gtLg" } : /* istanbul ignore next */ {}), alias: 'fxFlex.gt-lg', transform: coerceFlex });
1231
- this.smUp = input(undefined, { ...(ngDevMode ? { debugName: "smUp" } : /* istanbul ignore next */ {}), alias: 'fxFlex.sm-up', transform: coerceFlex });
1232
- this.mdUp = input(undefined, { ...(ngDevMode ? { debugName: "mdUp" } : /* istanbul ignore next */ {}), alias: 'fxFlex.md-up', transform: coerceFlex });
1233
- this.lgUp = input(undefined, { ...(ngDevMode ? { debugName: "lgUp" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lg-up', transform: coerceFlex });
1234
- this.xlUp = input(undefined, { ...(ngDevMode ? { debugName: "xlUp" } : /* istanbul ignore next */ {}), alias: 'fxFlex.xl-up', transform: coerceFlex });
1235
- this.smDown = input(undefined, { ...(ngDevMode ? { debugName: "smDown" } : /* istanbul ignore next */ {}), alias: 'fxFlex.sm-down', transform: coerceFlex });
1236
- this.mdDown = input(undefined, { ...(ngDevMode ? { debugName: "mdDown" } : /* istanbul ignore next */ {}), alias: 'fxFlex.md-down', transform: coerceFlex });
1237
- this.lgDown = input(undefined, { ...(ngDevMode ? { debugName: "lgDown" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lg-down', transform: coerceFlex });
1194
+ this.fxFlex = input(undefined, { ...(ngDevMode ? { debugName: "fxFlex" } : /* istanbul ignore next */ {}), alias: 'fxFlex' });
1195
+ this.xs = input(undefined, { ...(ngDevMode ? { debugName: "xs" } : /* istanbul ignore next */ {}), alias: 'fxFlex.xs' });
1196
+ this.sm = input(undefined, { ...(ngDevMode ? { debugName: "sm" } : /* istanbul ignore next */ {}), alias: 'fxFlex.sm' });
1197
+ this.md = input(undefined, { ...(ngDevMode ? { debugName: "md" } : /* istanbul ignore next */ {}), alias: 'fxFlex.md' });
1198
+ this.lg = input(undefined, { ...(ngDevMode ? { debugName: "lg" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lg' });
1199
+ this.xl = input(undefined, { ...(ngDevMode ? { debugName: "xl" } : /* istanbul ignore next */ {}), alias: 'fxFlex.xl' });
1200
+ this.ltSm = input(undefined, { ...(ngDevMode ? { debugName: "ltSm" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lt-sm' });
1201
+ this.ltMd = input(undefined, { ...(ngDevMode ? { debugName: "ltMd" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lt-md' });
1202
+ this.ltLg = input(undefined, { ...(ngDevMode ? { debugName: "ltLg" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lt-lg' });
1203
+ this.ltXl = input(undefined, { ...(ngDevMode ? { debugName: "ltXl" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lt-xl' });
1204
+ this.gtXs = input(undefined, { ...(ngDevMode ? { debugName: "gtXs" } : /* istanbul ignore next */ {}), alias: 'fxFlex.gt-xs' });
1205
+ this.gtSm = input(undefined, { ...(ngDevMode ? { debugName: "gtSm" } : /* istanbul ignore next */ {}), alias: 'fxFlex.gt-sm' });
1206
+ this.gtMd = input(undefined, { ...(ngDevMode ? { debugName: "gtMd" } : /* istanbul ignore next */ {}), alias: 'fxFlex.gt-md' });
1207
+ this.gtLg = input(undefined, { ...(ngDevMode ? { debugName: "gtLg" } : /* istanbul ignore next */ {}), alias: 'fxFlex.gt-lg' });
1208
+ this.smUp = input(undefined, { ...(ngDevMode ? { debugName: "smUp" } : /* istanbul ignore next */ {}), alias: 'fxFlex.sm-up' });
1209
+ this.mdUp = input(undefined, { ...(ngDevMode ? { debugName: "mdUp" } : /* istanbul ignore next */ {}), alias: 'fxFlex.md-up' });
1210
+ this.lgUp = input(undefined, { ...(ngDevMode ? { debugName: "lgUp" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lg-up' });
1211
+ this.xlUp = input(undefined, { ...(ngDevMode ? { debugName: "xlUp" } : /* istanbul ignore next */ {}), alias: 'fxFlex.xl-up' });
1212
+ this.smDown = input(undefined, { ...(ngDevMode ? { debugName: "smDown" } : /* istanbul ignore next */ {}), alias: 'fxFlex.sm-down' });
1213
+ this.mdDown = input(undefined, { ...(ngDevMode ? { debugName: "mdDown" } : /* istanbul ignore next */ {}), alias: 'fxFlex.md-down' });
1214
+ this.lgDown = input(undefined, { ...(ngDevMode ? { debugName: "lgDown" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lg-down' });
1238
1215
  this._rawFlex = computed(() => resolveAll({ default: this.fxFlex(), xs: this.xs(), sm: this.sm(), md: this.md(),
1239
1216
  lg: this.lg(), xl: this.xl() }, { 'lt-sm': this.ltSm(), 'lt-md': this.ltMd(), 'lt-lg': this.ltLg(),
1240
1217
  'lt-xl': this.ltXl(), 'gt-xs': this.gtXs(), 'gt-sm': this.gtSm(), 'gt-md': this.gtMd(),
@@ -1254,11 +1231,17 @@ class FxFlexDirective extends ResponsiveBaseDirective {
1254
1231
  this._applied.clear();
1255
1232
  return;
1256
1233
  }
1257
- // Extensions (documented in the header). `*` fills like fxFlex="grow" (=> flex: 1 1 100%);
1258
- // a bare fxFlex next to a `*` sibling collapses to `0 0 auto`. The sibling DOM read is
1259
- // performed lazily, only for the bare-'' case in the browser.
1260
- const hasStarSibling = raw === '' && this.isBrowser ? parentHasStar(el) : false;
1261
- raw = resolveFlexInput(raw, hasStarSibling);
1234
+ // addFlexToParent (ngx-layout parity): when the direct parent is not a flex
1235
+ // container, make it one so fxFlex children behave even without an explicit fxLayout.
1236
+ const directParentHasLayout = !!this.parentLayout && this.parentLayout.hostElement === el.parentElement;
1237
+ if (this.isBrowser && el.parentElement && !directParentHasLayout) {
1238
+ const pdisplay = getComputedStyle(el.parentElement).display;
1239
+ if (pdisplay !== 'flex' && pdisplay !== 'inline-flex') {
1240
+ this.r2.setStyle(el.parentElement, 'display', 'flex');
1241
+ }
1242
+ }
1243
+ // `*` => grow (1 1 100%); a bare fxFlex keeps the ngx default (1 1 0%).
1244
+ raw = resolveFlexInput(raw);
1262
1245
  // Parent flow: reactive via FxLayoutDirective signals when it is the
1263
1246
  // direct parent; getComputedStyle fallback for plain-CSS flex parents.
1264
1247
  const { direction, hasWrap } = resolveParentFlow(el, this.parentLayout, this.isBrowser);
@@ -3576,5 +3559,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImpor
3576
3559
  * Generated bundle index. Do not edit.
3577
3560
  */
3578
3561
 
3579
- 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, coerceFlex, normalizeGap, normalizeStyle, resolve, resolveAll, resolveFlexInput, resolveNonCanonical, resolveParentFlow, toBool, toClassSet, validateBasis, validateLayoutValue, validateWrapValue };
3562
+ 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, normalizeGap, normalizeStyle, resolve, resolveAll, resolveFlexInput, resolveNonCanonical, resolveParentFlow, toBool, toClassSet, validateBasis, validateLayoutValue, validateWrapValue };
3580
3563
  //# sourceMappingURL=arsedizioni-ars-utils-ui.mjs.map