codexly-ui 0.4.5 → 0.4.7
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.
package/fesm2022/codexly-ui.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, computed, ChangeDetectionStrategy, ViewEncapsulation, Component, InjectionToken, inject, PLATFORM_ID, signal, effect, Injectable, ElementRef, output, Directive, contentChild, forwardRef, Renderer2, ApplicationRef, EnvironmentInjector, DestroyRef, createComponent, untracked, HostListener, viewChild, ViewChild, Injector, ChangeDetectorRef, NgZone, model, contentChildren, ContentChildren, ViewChildren, Input, numberAttribute, booleanAttribute } from '@angular/core';
|
|
2
|
+
import { input, computed, ChangeDetectionStrategy, ViewEncapsulation, Component, InjectionToken, inject, PLATFORM_ID, signal, effect, Injectable, ElementRef, HostAttributeToken, output, Directive, contentChild, forwardRef, Renderer2, ApplicationRef, EnvironmentInjector, DestroyRef, createComponent, untracked, HostListener, viewChild, ViewChild, Injector, ChangeDetectorRef, NgZone, model, contentChildren, ContentChildren, ViewChildren, Input, numberAttribute, booleanAttribute } from '@angular/core';
|
|
3
3
|
import { isPlatformBrowser, NgTemplateOutlet, DOCUMENT, NgStyle, CurrencyPipe, DecimalPipe } from '@angular/common';
|
|
4
4
|
import * as i1$1 from '@angular/forms';
|
|
5
5
|
import { NG_VALUE_ACCESSOR, FormControl, NgControl, ReactiveFormsModule, FormGroup, Validators, FormsModule } from '@angular/forms';
|
|
@@ -782,10 +782,12 @@ class ClxButtonComponent {
|
|
|
782
782
|
_ripples = signal([], ...(ngDevMode ? [{ debugName: "_ripples" }] : /* istanbul ignore next */ []));
|
|
783
783
|
_nextId = 0;
|
|
784
784
|
_el = inject((ElementRef));
|
|
785
|
-
/** Static `class="..."` written by the consumer template
|
|
786
|
-
*
|
|
787
|
-
*
|
|
788
|
-
|
|
785
|
+
/** Static `class="..."` written by the consumer template. Read via `HostAttributeToken`
|
|
786
|
+
* (resolved from the template's static attribute at DI time) rather than
|
|
787
|
+
* `ElementRef.nativeElement.getAttribute`, since the `[class]` host binding below hasn't
|
|
788
|
+
* necessarily painted yet when the constructor runs — otherwise any consumer-supplied
|
|
789
|
+
* classes (e.g. positioning utilities like `absolute`/`top-1`) would be silently lost. */
|
|
790
|
+
_consumerClass = inject(new HostAttributeToken('class'), { optional: true }) ?? '';
|
|
789
791
|
_inactive = computed(() => this.loading() || this.disabled(), ...(ngDevMode ? [{ debugName: "_inactive" }] : /* istanbul ignore next */ []));
|
|
790
792
|
_badgeClass = computed(() => {
|
|
791
793
|
const t = resolveColor(this.badgeColor());
|
|
@@ -848,7 +850,13 @@ class ClxButtonComponent {
|
|
|
848
850
|
? resolveRadius(this._themeSvc.config().borderRadius)
|
|
849
851
|
: BUTTON_SHAPE_FIXED[s];
|
|
850
852
|
const overflowClass = (this.badge() !== undefined && this.badge() !== null) ? 'overflow-visible' : 'overflow-hidden';
|
|
851
|
-
|
|
853
|
+
// If the consumer already positions the button (absolute/fixed/sticky), don't force
|
|
854
|
+
// `relative` — same-specificity utility classes are resolved by CSS source order, not
|
|
855
|
+
// template order, so `relative` from the base class can silently win over a consumer's
|
|
856
|
+
// `absolute`, leaving the button positioned in-flow instead of where it was placed.
|
|
857
|
+
const isPositioned = /(^|\s)(absolute|fixed|sticky)(\s|$)/.test(this._consumerClass);
|
|
858
|
+
const base = (isPositioned ? BUTTON_BASE_CLASS.replace(/^relative\s/, '') : BUTTON_BASE_CLASS)
|
|
859
|
+
.replace('overflow-hidden', overflowClass);
|
|
852
860
|
const consumer = this._consumerClass ? ` ${this._consumerClass}` : '';
|
|
853
861
|
return `${base} ${colorClass} ${sizeClass} ${shapeClass}${this.block() ? ' w-full' : ''}${consumer}`.trimEnd();
|
|
854
862
|
}, ...(ngDevMode ? [{ debugName: "_hostClass" }] : /* istanbul ignore next */ []));
|