@arsedizioni/ars-utils 22.0.52 → 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.
@@ -1037,10 +1037,12 @@ 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="*" 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
1044
1046
  *
1045
1047
  * Breakpoint suffixes: canonical + lt-* + gt-* + *-up + *-down
1046
1048
  */
@@ -1175,66 +1177,42 @@ function buildFlexStyles(value, direction, hasWrap) {
1175
1177
  out[k] = v === null ? null : String(v);
1176
1178
  return out;
1177
1179
  }
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
1180
  /**
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
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.
1190
1184
  * @param raw - The resolved fxFlex value for the active breakpoint.
1191
- * @param hasStarSibling - Whether a sibling element declares `fxFlex="*"`.
1192
1185
  * @returns The value to pass to `buildFlexStyles`.
1193
1186
  */
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();
1187
+ function resolveFlexInput(raw) {
1188
+ return (raw === '*' || raw === '') ? 'grow' : raw;
1211
1189
  }
1212
1190
  class FxFlexDirective extends ResponsiveBaseDirective {
1213
1191
  constructor() {
1214
1192
  super();
1215
1193
  /** Direct ancestor FxLayout (any level); matched to the direct parent in the effect. */
1216
1194
  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 });
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' });
1238
1216
  this._rawFlex = computed(() => resolveAll({ default: this.fxFlex(), xs: this.xs(), sm: this.sm(), md: this.md(),
1239
1217
  lg: this.lg(), xl: this.xl() }, { 'lt-sm': this.ltSm(), 'lt-md': this.ltMd(), 'lt-lg': this.ltLg(),
1240
1218
  'lt-xl': this.ltXl(), 'gt-xs': this.gtXs(), 'gt-sm': this.gtSm(), 'gt-md': this.gtMd(),
@@ -1254,11 +1232,18 @@ class FxFlexDirective extends ResponsiveBaseDirective {
1254
1232
  this._applied.clear();
1255
1233
  return;
1256
1234
  }
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);
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);
1262
1247
  // Parent flow: reactive via FxLayoutDirective signals when it is the
1263
1248
  // direct parent; getComputedStyle fallback for plain-CSS flex parents.
1264
1249
  const { direction, hasWrap } = resolveParentFlow(el, this.parentLayout, this.isBrowser);
@@ -3576,5 +3561,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImpor
3576
3561
  * Generated bundle index. Do not edit.
3577
3562
  */
3578
3563
 
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 };
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 };
3580
3565
  //# sourceMappingURL=arsedizioni-ars-utils-ui.mjs.map