osl-base-extended 0.1.15 → 0.1.17
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, Inject, inject, Injector, Injectable, InjectionToken, PLATFORM_ID, Input, Directive, EventEmitter, Output, HostListener, ViewChild, NgModule } from '@angular/core';
|
|
2
|
+
import { Component, Inject, inject, Injector, Injectable, InjectionToken, PLATFORM_ID, Input, Optional, Directive, EventEmitter, Output, HostListener, ViewChild, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/material/dialog';
|
|
4
4
|
import { MAT_DIALOG_DATA, MatDialogModule, MatDialog } from '@angular/material/dialog';
|
|
5
5
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
@@ -11,7 +11,7 @@ import { MatIconButton, MatButtonModule } from '@angular/material/button';
|
|
|
11
11
|
import * as i2 from '@angular/material/icon';
|
|
12
12
|
import { MatIconModule } from '@angular/material/icon';
|
|
13
13
|
import { HttpHeaders, HttpParams, HttpClient } from '@angular/common/http';
|
|
14
|
-
import { firstValueFrom, timeout, debounceTime, distinctUntilChanged } from 'rxjs';
|
|
14
|
+
import { firstValueFrom, timeout, BehaviorSubject, debounceTime, distinctUntilChanged } from 'rxjs';
|
|
15
15
|
import * as i1$1 from '@angular/forms';
|
|
16
16
|
import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
17
17
|
import * as i2$1 from '@angular/material/form-field';
|
|
@@ -297,13 +297,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
297
297
|
args: [{ providedIn: 'root' }]
|
|
298
298
|
}] });
|
|
299
299
|
|
|
300
|
+
class OslSkeletonThemeService {
|
|
301
|
+
_theme$ = new BehaviorSubject('light');
|
|
302
|
+
/** Subscribe to react to global theme changes */
|
|
303
|
+
theme$ = this._theme$.asObservable();
|
|
304
|
+
get current() {
|
|
305
|
+
return this._theme$.getValue();
|
|
306
|
+
}
|
|
307
|
+
setTheme(theme) {
|
|
308
|
+
this._theme$.next(theme);
|
|
309
|
+
}
|
|
310
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: OslSkeletonThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
311
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: OslSkeletonThemeService, providedIn: 'root' });
|
|
312
|
+
}
|
|
313
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: OslSkeletonThemeService, decorators: [{
|
|
314
|
+
type: Injectable,
|
|
315
|
+
args: [{ providedIn: 'root' }]
|
|
316
|
+
}] });
|
|
317
|
+
|
|
300
318
|
// Injected once per app lifetime — static flag avoids duplicate <style> tags.
|
|
301
319
|
let _osl_sk_injected = false;
|
|
302
320
|
// CSS is minified inline: zero runtime SCSS processing, one GPU-composited
|
|
303
321
|
// keyframe (translateX uses the compositor thread, no layout/paint on each frame).
|
|
304
322
|
const SKELETON_CSS = `
|
|
305
323
|
.osl-sk-host{position:relative!important}
|
|
306
|
-
.osl-sk-overlay{position:absolute;inset:0;pointer-events:none;overflow:hidden;
|
|
324
|
+
.osl-sk-overlay{position:absolute;inset:0;pointer-events:none;overflow:hidden;}
|
|
307
325
|
.osl-sk-bone{position:absolute;background:var(--osl-sk-color,#e2e8f0);border-radius:var(--osl-sk-r,4px);overflow:hidden;will-change:transform,opacity}
|
|
308
326
|
.osl-sk-bone::after{content:'';position:absolute;inset:0;background:linear-gradient(90deg,transparent 0%,var(--osl-sk-hl,rgba(255,255,255,.6)) 50%,transparent 100%);transform:translateX(-100%);will-change:transform}
|
|
309
327
|
.osl-sk-shimmer .osl-sk-bone::after{animation:_osl-sk-shimmer var(--osl-sk-dur,1.5s) ease-in-out infinite}
|
|
@@ -332,6 +350,7 @@ class OslSkeletonDirective {
|
|
|
332
350
|
renderer;
|
|
333
351
|
zone;
|
|
334
352
|
platformId;
|
|
353
|
+
themeService;
|
|
335
354
|
// ── Inputs ────────────────────────────────────────────────────────────────
|
|
336
355
|
/** Primary toggle — set true while data is loading */
|
|
337
356
|
loading = false;
|
|
@@ -339,8 +358,10 @@ class OslSkeletonDirective {
|
|
|
339
358
|
type = 'auto';
|
|
340
359
|
/** Animation style (default: shimmer) */
|
|
341
360
|
animation = 'shimmer';
|
|
342
|
-
/** Colour preset — overridden by oslSkeletonColor & oslSkeletonHighlight
|
|
343
|
-
|
|
361
|
+
/** Colour preset — overridden by oslSkeletonColor & oslSkeletonHighlight.
|
|
362
|
+
* When omitted, the global OslSkeletonThemeService value is used. */
|
|
363
|
+
set theme(value) { this._themeOverride = value; }
|
|
364
|
+
get theme() { return this._themeOverride ?? this._serviceTheme; }
|
|
344
365
|
/** Override bone background colour (e.g. '#cbd5e1') */
|
|
345
366
|
color;
|
|
346
367
|
/** Override shimmer highlight colour (e.g. 'rgba(255,255,255,0.8)') */
|
|
@@ -378,16 +399,32 @@ class OslSkeletonDirective {
|
|
|
378
399
|
cachedBones = null;
|
|
379
400
|
delayTimer = null;
|
|
380
401
|
rafId = 0;
|
|
402
|
+
_themeOverride;
|
|
403
|
+
_serviceTheme = 'light';
|
|
404
|
+
_themeSub;
|
|
381
405
|
// ── Lifecycle ─────────────────────────────────────────────────────────────
|
|
382
|
-
constructor(el, renderer, zone, platformId) {
|
|
406
|
+
constructor(el, renderer, zone, platformId, themeService) {
|
|
383
407
|
this.el = el;
|
|
384
408
|
this.renderer = renderer;
|
|
385
409
|
this.zone = zone;
|
|
386
410
|
this.platformId = platformId;
|
|
411
|
+
this.themeService = themeService;
|
|
387
412
|
if (isPlatformBrowser(this.platformId)) {
|
|
388
413
|
OslSkeletonDirective.injectStyles();
|
|
389
414
|
}
|
|
390
415
|
}
|
|
416
|
+
ngOnInit() {
|
|
417
|
+
if (!isPlatformBrowser(this.platformId) || !this.themeService)
|
|
418
|
+
return;
|
|
419
|
+
this._themeSub = this.themeService.theme$.subscribe(theme => {
|
|
420
|
+
if (this._themeOverride !== undefined)
|
|
421
|
+
return;
|
|
422
|
+
this._serviceTheme = theme;
|
|
423
|
+
if (this.loading && this.overlay?.parentNode) {
|
|
424
|
+
this.zone.runOutsideAngular(() => this.applyConfig());
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
}
|
|
391
428
|
ngOnChanges(changes) {
|
|
392
429
|
if (!isPlatformBrowser(this.platformId))
|
|
393
430
|
return;
|
|
@@ -699,7 +736,7 @@ class OslSkeletonDirective {
|
|
|
699
736
|
style.textContent = SKELETON_CSS;
|
|
700
737
|
document.head.appendChild(style);
|
|
701
738
|
}
|
|
702
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: OslSkeletonDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Directive });
|
|
739
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: OslSkeletonDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: OslSkeletonThemeService, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
703
740
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: OslSkeletonDirective, isStandalone: false, selector: "[oslSkeleton]", inputs: { loading: ["oslSkeleton", "loading"], type: ["oslSkeletonType", "type"], animation: ["oslSkeletonAnimation", "animation"], theme: ["oslSkeletonTheme", "theme"], color: ["oslSkeletonColor", "color"], highlight: ["oslSkeletonHighlight", "highlight"], radius: ["oslSkeletonRadius", "radius"], rows: ["oslSkeletonRows", "rows"], rowGap: ["oslSkeletonRowGap", "rowGap"], zIndex: ["oslSkeletonZIndex", "zIndex"], delay: ["oslSkeletonDelay", "delay"], duration: ["oslSkeletonDuration", "duration"], minHeight: ["oslSkeletonMinHeight", "minHeight"], forceReread: ["oslSkeletonForceReread", "forceReread"], circleSize: ["oslSkeletonCircleSize", "circleSize"], listItems: ["oslSkeletonListItems", "listItems"], tableRows: ["oslSkeletonTableRows", "tableRows"], tableCols: ["oslSkeletonTableCols", "tableCols"], cardLines: ["oslSkeletonCardLines", "cardLines"], bgColor: ["oslSkeletonBgColor", "bgColor"] }, usesOnChanges: true, ngImport: i0 });
|
|
704
741
|
}
|
|
705
742
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: OslSkeletonDirective, decorators: [{
|
|
@@ -711,6 +748,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
711
748
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: undefined, decorators: [{
|
|
712
749
|
type: Inject,
|
|
713
750
|
args: [PLATFORM_ID]
|
|
751
|
+
}] }, { type: OslSkeletonThemeService, decorators: [{
|
|
752
|
+
type: Optional
|
|
714
753
|
}] }], propDecorators: { loading: [{
|
|
715
754
|
type: Input,
|
|
716
755
|
args: ['oslSkeleton']
|
|
@@ -2447,5 +2486,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
2447
2486
|
* Generated bundle index. Do not edit.
|
|
2448
2487
|
*/
|
|
2449
2488
|
|
|
2450
|
-
export { DeleteConfirmation, DeleteConfirmationData, Dialog, DialogWrapper, DynamicForm, FormStructureModule, Httpbase, OslAutocomplete, OslAutocompleteLister, OslBaseExtended, OslButton, OslCheckbox, OslDatepicker, OslFileUpload, OslFormGrid, OslGrid, OslRadio, OslSearchbar, OslSelect, OslSetup, OslSkeletonDirective, OslSkeletonModule, OslSlideToggle, Oslinput, Osltextarea, baseComponent };
|
|
2489
|
+
export { DeleteConfirmation, DeleteConfirmationData, Dialog, DialogWrapper, DynamicForm, FormStructureModule, Httpbase, OslAutocomplete, OslAutocompleteLister, OslBaseExtended, OslButton, OslCheckbox, OslDatepicker, OslFileUpload, OslFormGrid, OslGrid, OslRadio, OslSearchbar, OslSelect, OslSetup, OslSkeletonDirective, OslSkeletonModule, OslSkeletonThemeService, OslSlideToggle, Oslinput, Osltextarea, baseComponent };
|
|
2451
2490
|
//# sourceMappingURL=osl-base-extended.mjs.map
|