@arsedizioni/ars-utils 22.0.51 → 22.0.53

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.
@@ -983,11 +983,6 @@ class FxFlexFillDirective extends ResponsiveBaseDirective {
983
983
  const active = this._active();
984
984
  const v = active ? '100%' : null;
985
985
  this.safeSetStyle('margin', active ? '0' : null);
986
- // align-self: stretch ensures this element fills the parent's cross axis even
987
- // when the parent flex container has align-items: center (e.g. mat-toolbar).
988
- // Without this, height: 100% collapses to content height and align-items on
989
- // this container has no visible centering space.
990
- this.safeSetStyle('align-self', active ? 'stretch' : null);
991
986
  this.safeSetStyle('width', v);
992
987
  this.safeSetStyle('height', v);
993
988
  this.safeSetStyle('min-width', v);
@@ -1042,10 +1037,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImpor
1042
1037
  * • calc() support (flex-grow/shrink/basis split, operator padding)
1043
1038
  * • wrap-container basis rewrite (ngx issue 660)
1044
1039
  *
1045
- * Extensions beyond ngx-layout (documented, opt-in by syntax):
1046
- * • fxFlex="*" fills the remaining space like fxFlex="grow" (1 1 100%)
1047
- * fxFlex="" + a SIBLING with fxFlex="*" → this element gets 0 0 auto
1048
- * (static-attribute detection only; property bindings are not seen)
1040
+ * Extensions beyond ngx-layout (documented):
1041
+ * • fxFlex="*" and bare fxFlex both "fill the remaining space" (grow, 1 1 100%).
1042
+ * For content-sized siblings use a plain element (no fxFlex):
1043
+ * it defaults to `0 1 auto`.
1044
+ * • addFlexToParent → if the direct parent is not a flex container, this directive
1045
+ * sets display:flex on it so children work without fxLayout
1049
1046
  *
1050
1047
  * Breakpoint suffixes: canonical + lt-* + gt-* + *-up + *-down
1051
1048
  */
@@ -1180,66 +1177,42 @@ function buildFlexStyles(value, direction, hasWrap) {
1180
1177
  out[k] = v === null ? null : String(v);
1181
1178
  return out;
1182
1179
  }
1183
- /** Extension: true when a sibling element declares fxFlex="*" (static attribute). */
1184
- function parentHasStar(el) {
1185
- const parent = el.parentElement;
1186
- if (!parent)
1187
- return false;
1188
- return Array.from(parent.children).some(c => c !== el && (c.getAttribute('fxflex') === '*' || c.getAttribute('fxFlex') === '*'));
1189
- }
1190
1180
  /**
1191
- * Resolves the non-ngx fxFlex extensions to a value `buildFlexStyles` understands.
1192
- * '*' → 'grow' (fill the remaining space → `flex: 1 1 100%`, max-* 100%)
1193
- * '' with a `*` sibling → 'none' (`0 0 auto`)
1194
- * • anything else → returned unchanged
1181
+ * Resolves the fxFlex "fill" inputs to a value `buildFlexStyles` understands.
1182
+ * Both `fxFlex="*"` and a bare `fxFlex` mean "fill the remaining space" → `grow`
1183
+ * (`flex: 1 1 100%`, max-* 100%); every other value is returned unchanged.
1195
1184
  * @param raw - The resolved fxFlex value for the active breakpoint.
1196
- * @param hasStarSibling - Whether a sibling element declares `fxFlex="*"`.
1197
1185
  * @returns The value to pass to `buildFlexStyles`.
1198
1186
  */
1199
- function resolveFlexInput(raw, hasStarSibling) {
1200
- if (raw === '*')
1201
- return 'grow';
1202
- if (raw === '' && hasStarSibling)
1203
- return 'none';
1204
- return raw;
1205
- }
1206
- /**
1207
- * Coerces an fxFlex binding value to the string form the builder expects.
1208
- * Accepts numbers (e.g. `[fxFlex]="32"` or `[fxFlex]="cond ? 24 : 32"`) and
1209
- * normalises them to a string; keeps `''` (bare attribute) as-is; maps
1210
- * null/undefined to "not set".
1211
- * @param v - The bound value: a string, a number, null, or undefined.
1212
- * @returns The trimmed string value, or undefined when not set.
1213
- */
1214
- function coerceFlex(v) {
1215
- return v === null || v === undefined ? undefined : String(v).trim();
1187
+ function resolveFlexInput(raw) {
1188
+ return (raw === '*' || raw === '') ? 'grow' : raw;
1216
1189
  }
1217
1190
  class FxFlexDirective extends ResponsiveBaseDirective {
1218
1191
  constructor() {
1219
1192
  super();
1220
1193
  /** Direct ancestor FxLayout (any level); matched to the direct parent in the effect. */
1221
1194
  this.parentLayout = inject(FxLayoutDirective, { skipSelf: true, optional: true });
1222
- this.fxFlex = input(undefined, { ...(ngDevMode ? { debugName: "fxFlex" } : /* istanbul ignore next */ {}), alias: 'fxFlex', transform: coerceFlex });
1223
- this.xs = input(undefined, { ...(ngDevMode ? { debugName: "xs" } : /* istanbul ignore next */ {}), alias: 'fxFlex.xs', transform: coerceFlex });
1224
- this.sm = input(undefined, { ...(ngDevMode ? { debugName: "sm" } : /* istanbul ignore next */ {}), alias: 'fxFlex.sm', transform: coerceFlex });
1225
- this.md = input(undefined, { ...(ngDevMode ? { debugName: "md" } : /* istanbul ignore next */ {}), alias: 'fxFlex.md', transform: coerceFlex });
1226
- this.lg = input(undefined, { ...(ngDevMode ? { debugName: "lg" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lg', transform: coerceFlex });
1227
- this.xl = input(undefined, { ...(ngDevMode ? { debugName: "xl" } : /* istanbul ignore next */ {}), alias: 'fxFlex.xl', transform: coerceFlex });
1228
- this.ltSm = input(undefined, { ...(ngDevMode ? { debugName: "ltSm" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lt-sm', transform: coerceFlex });
1229
- this.ltMd = input(undefined, { ...(ngDevMode ? { debugName: "ltMd" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lt-md', transform: coerceFlex });
1230
- this.ltLg = input(undefined, { ...(ngDevMode ? { debugName: "ltLg" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lt-lg', transform: coerceFlex });
1231
- this.ltXl = input(undefined, { ...(ngDevMode ? { debugName: "ltXl" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lt-xl', transform: coerceFlex });
1232
- this.gtXs = input(undefined, { ...(ngDevMode ? { debugName: "gtXs" } : /* istanbul ignore next */ {}), alias: 'fxFlex.gt-xs', transform: coerceFlex });
1233
- this.gtSm = input(undefined, { ...(ngDevMode ? { debugName: "gtSm" } : /* istanbul ignore next */ {}), alias: 'fxFlex.gt-sm', transform: coerceFlex });
1234
- this.gtMd = input(undefined, { ...(ngDevMode ? { debugName: "gtMd" } : /* istanbul ignore next */ {}), alias: 'fxFlex.gt-md', transform: coerceFlex });
1235
- this.gtLg = input(undefined, { ...(ngDevMode ? { debugName: "gtLg" } : /* istanbul ignore next */ {}), alias: 'fxFlex.gt-lg', transform: coerceFlex });
1236
- this.smUp = input(undefined, { ...(ngDevMode ? { debugName: "smUp" } : /* istanbul ignore next */ {}), alias: 'fxFlex.sm-up', transform: coerceFlex });
1237
- this.mdUp = input(undefined, { ...(ngDevMode ? { debugName: "mdUp" } : /* istanbul ignore next */ {}), alias: 'fxFlex.md-up', transform: coerceFlex });
1238
- this.lgUp = input(undefined, { ...(ngDevMode ? { debugName: "lgUp" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lg-up', transform: coerceFlex });
1239
- this.xlUp = input(undefined, { ...(ngDevMode ? { debugName: "xlUp" } : /* istanbul ignore next */ {}), alias: 'fxFlex.xl-up', transform: coerceFlex });
1240
- this.smDown = input(undefined, { ...(ngDevMode ? { debugName: "smDown" } : /* istanbul ignore next */ {}), alias: 'fxFlex.sm-down', transform: coerceFlex });
1241
- this.mdDown = input(undefined, { ...(ngDevMode ? { debugName: "mdDown" } : /* istanbul ignore next */ {}), alias: 'fxFlex.md-down', transform: coerceFlex });
1242
- this.lgDown = input(undefined, { ...(ngDevMode ? { debugName: "lgDown" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lg-down', transform: coerceFlex });
1195
+ this.fxFlex = input(undefined, { ...(ngDevMode ? { debugName: "fxFlex" } : /* istanbul ignore next */ {}), alias: 'fxFlex' });
1196
+ this.xs = input(undefined, { ...(ngDevMode ? { debugName: "xs" } : /* istanbul ignore next */ {}), alias: 'fxFlex.xs' });
1197
+ this.sm = input(undefined, { ...(ngDevMode ? { debugName: "sm" } : /* istanbul ignore next */ {}), alias: 'fxFlex.sm' });
1198
+ this.md = input(undefined, { ...(ngDevMode ? { debugName: "md" } : /* istanbul ignore next */ {}), alias: 'fxFlex.md' });
1199
+ this.lg = input(undefined, { ...(ngDevMode ? { debugName: "lg" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lg' });
1200
+ this.xl = input(undefined, { ...(ngDevMode ? { debugName: "xl" } : /* istanbul ignore next */ {}), alias: 'fxFlex.xl' });
1201
+ this.ltSm = input(undefined, { ...(ngDevMode ? { debugName: "ltSm" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lt-sm' });
1202
+ this.ltMd = input(undefined, { ...(ngDevMode ? { debugName: "ltMd" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lt-md' });
1203
+ this.ltLg = input(undefined, { ...(ngDevMode ? { debugName: "ltLg" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lt-lg' });
1204
+ this.ltXl = input(undefined, { ...(ngDevMode ? { debugName: "ltXl" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lt-xl' });
1205
+ this.gtXs = input(undefined, { ...(ngDevMode ? { debugName: "gtXs" } : /* istanbul ignore next */ {}), alias: 'fxFlex.gt-xs' });
1206
+ this.gtSm = input(undefined, { ...(ngDevMode ? { debugName: "gtSm" } : /* istanbul ignore next */ {}), alias: 'fxFlex.gt-sm' });
1207
+ this.gtMd = input(undefined, { ...(ngDevMode ? { debugName: "gtMd" } : /* istanbul ignore next */ {}), alias: 'fxFlex.gt-md' });
1208
+ this.gtLg = input(undefined, { ...(ngDevMode ? { debugName: "gtLg" } : /* istanbul ignore next */ {}), alias: 'fxFlex.gt-lg' });
1209
+ this.smUp = input(undefined, { ...(ngDevMode ? { debugName: "smUp" } : /* istanbul ignore next */ {}), alias: 'fxFlex.sm-up' });
1210
+ this.mdUp = input(undefined, { ...(ngDevMode ? { debugName: "mdUp" } : /* istanbul ignore next */ {}), alias: 'fxFlex.md-up' });
1211
+ this.lgUp = input(undefined, { ...(ngDevMode ? { debugName: "lgUp" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lg-up' });
1212
+ this.xlUp = input(undefined, { ...(ngDevMode ? { debugName: "xlUp" } : /* istanbul ignore next */ {}), alias: 'fxFlex.xl-up' });
1213
+ this.smDown = input(undefined, { ...(ngDevMode ? { debugName: "smDown" } : /* istanbul ignore next */ {}), alias: 'fxFlex.sm-down' });
1214
+ this.mdDown = input(undefined, { ...(ngDevMode ? { debugName: "mdDown" } : /* istanbul ignore next */ {}), alias: 'fxFlex.md-down' });
1215
+ this.lgDown = input(undefined, { ...(ngDevMode ? { debugName: "lgDown" } : /* istanbul ignore next */ {}), alias: 'fxFlex.lg-down' });
1243
1216
  this._rawFlex = computed(() => resolveAll({ default: this.fxFlex(), xs: this.xs(), sm: this.sm(), md: this.md(),
1244
1217
  lg: this.lg(), xl: this.xl() }, { 'lt-sm': this.ltSm(), 'lt-md': this.ltMd(), 'lt-lg': this.ltLg(),
1245
1218
  'lt-xl': this.ltXl(), 'gt-xs': this.gtXs(), 'gt-sm': this.gtSm(), 'gt-md': this.gtMd(),
@@ -1259,11 +1232,18 @@ class FxFlexDirective extends ResponsiveBaseDirective {
1259
1232
  this._applied.clear();
1260
1233
  return;
1261
1234
  }
1262
- // Extensions (documented in the header). `*` fills like fxFlex="grow" (=> flex: 1 1 100%);
1263
- // a bare fxFlex next to a `*` sibling collapses to `0 0 auto`. The sibling DOM read is
1264
- // performed lazily, only for the bare-'' case in the browser.
1265
- const hasStarSibling = raw === '' && this.isBrowser ? parentHasStar(el) : false;
1266
- raw = resolveFlexInput(raw, hasStarSibling);
1235
+ // addFlexToParent (ngx-layout parity): when the direct parent is not a flex
1236
+ // container, make it one so fxFlex children behave even without an explicit fxLayout.
1237
+ const directParentHasLayout = !!this.parentLayout && this.parentLayout.hostElement === el.parentElement;
1238
+ if (this.isBrowser && el.parentElement && !directParentHasLayout) {
1239
+ const pdisplay = getComputedStyle(el.parentElement).display;
1240
+ if (pdisplay !== 'flex' && pdisplay !== 'inline-flex') {
1241
+ this.r2.setStyle(el.parentElement, 'display', 'flex');
1242
+ }
1243
+ }
1244
+ // `*` and a bare fxFlex both mean "fill" => grow (1 1 100%). For content-sized
1245
+ // siblings use a plain element (no fxFlex) — it defaults to `0 1 auto`.
1246
+ raw = resolveFlexInput(raw);
1267
1247
  // Parent flow: reactive via FxLayoutDirective signals when it is the
1268
1248
  // direct parent; getComputedStyle fallback for plain-CSS flex parents.
1269
1249
  const { direction, hasWrap } = resolveParentFlow(el, this.parentLayout, this.isBrowser);
@@ -3581,5 +3561,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImpor
3581
3561
  * Generated bundle index. Do not edit.
3582
3562
  */
3583
3563
 
3584
- 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 };
3564
+ 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 };
3585
3565
  //# sourceMappingURL=arsedizioni-ars-utils-ui.mjs.map