@su-labs/font-size 19.2.0 → 20.2.0
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.
|
@@ -13,21 +13,21 @@ class FontSizeService {
|
|
|
13
13
|
controller = new SuFontSizeController();
|
|
14
14
|
initialLimits = this.controller.limits.get();
|
|
15
15
|
/** Default font size in pixels. Change it with {@link configure}. */
|
|
16
|
-
defaultSize = signal(this.initialLimits.defaultSize);
|
|
16
|
+
defaultSize = signal(this.initialLimits.defaultSize, ...(ngDevMode ? [{ debugName: "defaultSize" }] : []));
|
|
17
17
|
/** Minimum font size in pixels. Change it with {@link configure}. */
|
|
18
|
-
minSize = signal(this.initialLimits.minSize);
|
|
18
|
+
minSize = signal(this.initialLimits.minSize, ...(ngDevMode ? [{ debugName: "minSize" }] : []));
|
|
19
19
|
/** Maximum font size in pixels. Change it with {@link configure}. */
|
|
20
|
-
maxSize = signal(this.initialLimits.maxSize);
|
|
20
|
+
maxSize = signal(this.initialLimits.maxSize, ...(ngDevMode ? [{ debugName: "maxSize" }] : []));
|
|
21
21
|
/** Default step in pixels for {@link increase} / {@link decrease}. Change it with {@link configure}. */
|
|
22
|
-
step = signal(this.initialLimits.step);
|
|
22
|
+
step = signal(this.initialLimits.step, ...(ngDevMode ? [{ debugName: "step" }] : []));
|
|
23
23
|
/** Current font size in pixels */
|
|
24
|
-
fontSize = signal(this.controller.fontSize.get());
|
|
24
|
+
fontSize = signal(this.controller.fontSize.get(), ...(ngDevMode ? [{ debugName: "fontSize" }] : []));
|
|
25
25
|
/** True if the current size equals the default size */
|
|
26
|
-
isDefault = computed(() => this.fontSize() === this.defaultSize());
|
|
26
|
+
isDefault = computed(() => this.fontSize() === this.defaultSize(), ...(ngDevMode ? [{ debugName: "isDefault" }] : []));
|
|
27
27
|
/** True if the current size equals the maximum size */
|
|
28
|
-
isMax = computed(() => this.fontSize() === this.maxSize());
|
|
28
|
+
isMax = computed(() => this.fontSize() === this.maxSize(), ...(ngDevMode ? [{ debugName: "isMax" }] : []));
|
|
29
29
|
/** True if the current size equals the minimum size */
|
|
30
|
-
isMin = computed(() => this.fontSize() === this.minSize());
|
|
30
|
+
isMin = computed(() => this.fontSize() === this.minSize(), ...(ngDevMode ? [{ debugName: "isMin" }] : []));
|
|
31
31
|
/** Stop syncing the controller's stores into the signals */
|
|
32
32
|
unsubscribers = [
|
|
33
33
|
this.controller.fontSize.subscribe((size) => this.fontSize.set(size)),
|
|
@@ -81,10 +81,10 @@ class FontSizeService {
|
|
|
81
81
|
ngOnDestroy() {
|
|
82
82
|
this.unsubscribers.forEach((unsubscribe) => unsubscribe());
|
|
83
83
|
}
|
|
84
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
85
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
84
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: FontSizeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
85
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: FontSizeService, providedIn: 'root' });
|
|
86
86
|
}
|
|
87
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
87
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: FontSizeService, decorators: [{
|
|
88
88
|
type: Injectable,
|
|
89
89
|
args: [{ providedIn: 'root' }]
|
|
90
90
|
}] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"su-labs-font-size.mjs","sources":["../../../../compat/angular-
|
|
1
|
+
{"version":3,"file":"su-labs-font-size.mjs","sources":["../../../../compat/angular-20/build/font-size/src/lib/font-size.service.ts","../../../../compat/angular-20/build/font-size/src/su-labs-font-size.ts"],"sourcesContent":["import { computed, Injectable, OnDestroy, signal } from '@angular/core';\nimport { SuFontSizeController, SuFontSizeLimits } from '@su-labs/core/font-size';\nimport { FontSizeConfig } from './font-size-config.interface';\n\n/**\n * Angular service for managing the font size.\n *\n * Thin wrapper around the framework-agnostic `SuFontSizeController` from\n * `@su-labs/core/font-size` that exposes the size and limits as Angular signals.\n */\n@Injectable({ providedIn: 'root' })\nexport class FontSizeService implements OnDestroy {\n /** Framework-agnostic font size logic */\n private readonly controller = new SuFontSizeController();\n\n private readonly initialLimits: SuFontSizeLimits = this.controller.limits.get();\n\n /** Default font size in pixels. Change it with {@link configure}. */\n defaultSize = signal(this.initialLimits.defaultSize);\n\n /** Minimum font size in pixels. Change it with {@link configure}. */\n minSize = signal(this.initialLimits.minSize);\n\n /** Maximum font size in pixels. Change it with {@link configure}. */\n maxSize = signal(this.initialLimits.maxSize);\n\n /** Default step in pixels for {@link increase} / {@link decrease}. Change it with {@link configure}. */\n step = signal(this.initialLimits.step);\n\n /** Current font size in pixels */\n fontSize = signal<number>(this.controller.fontSize.get());\n\n /** True if the current size equals the default size */\n isDefault = computed(() => this.fontSize() === this.defaultSize());\n\n /** True if the current size equals the maximum size */\n isMax = computed(() => this.fontSize() === this.maxSize());\n\n /** True if the current size equals the minimum size */\n isMin = computed(() => this.fontSize() === this.minSize());\n\n /** Stop syncing the controller's stores into the signals */\n private readonly unsubscribers = [\n this.controller.fontSize.subscribe((size) => this.fontSize.set(size)),\n this.controller.limits.subscribe((limits) => {\n this.defaultSize.set(limits.defaultSize);\n this.minSize.set(limits.minSize);\n this.maxSize.set(limits.maxSize);\n this.step.set(limits.step);\n }),\n ];\n\n /**\n * Update the configuration. Omitted values keep their current setting.\n * @param cfg Partial configuration (limits, step, storage key, CSS variable name).\n */\n configure(cfg: Partial<FontSizeConfig> = {}): void {\n this.controller.configure(cfg);\n }\n\n /**\n * Load the saved size (or the default), clamp it and apply it to the document.\n * Call once at application startup, after {@link configure}.\n */\n init(): void {\n this.controller.init();\n }\n\n /**\n * Set, apply and persist a font size, clamped to the allowed range.\n * @param size Desired font size in pixels.\n */\n setFontSize(size: number): void {\n this.controller.setFontSize(size);\n }\n\n /**\n * Increase the font size.\n * @param step Pixels to add. Defaults to {@link step}.\n */\n increase(step?: number): void {\n this.setFontSize(this.fontSize() + (step ?? this.step()));\n }\n\n /**\n * Decrease the font size.\n * @param step Pixels to remove. Defaults to {@link step}.\n */\n decrease(step?: number): void {\n this.setFontSize(this.fontSize() - (step ?? this.step()));\n }\n\n /** Return to the default size and remove the saved value from localStorage */\n reset(): void {\n this.controller.reset();\n }\n\n /** Angular lifecycle hook for service destruction */\n ngOnDestroy(): void {\n this.unsubscribers.forEach((unsubscribe) => unsubscribe());\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAIA;;;;;AAKG;MAEU,eAAe,CAAA;;AAET,IAAA,UAAU,GAAG,IAAI,oBAAoB,EAAE;IAEvC,aAAa,GAAqB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,EAAE;;IAG/E,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,aAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAC;;IAGpD,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAC;;IAG5C,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAC;;IAG5C,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,GAA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AAI,EAAE;IACxB;AAEA;;;AAGG;AACH,IAAA,WAAW,CAAC,IAAY,EAAA;AACtB,QAAA,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC;IACnC;AAEA;;;AAGG;AACH,IAAA,QAAQ,CAAC,IAAa,EAAA;AACpB,QAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3D;AAEA;;;AAGG;AACH,IAAA,QAAQ,CAAC,IAAa,EAAA;AACpB,QAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3D;;IAGA,KAAK,GAAA;AACH,QAAA,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;IACzB;;IAGA,WAAW,GAAA;AACT,QAAA,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;IAC5D;wGAzFW,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAf,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,cADF,MAAM,EAAA,CAAA;;4FACnB,eAAe,EAAA,UAAA,EAAA,CAAA;kBAD3B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACVlC;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,70 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { OnDestroy } from '@angular/core';
|
|
3
|
+
import { SuFontSizeLimits, SuFontSizeConfig } from '@su-labs/core/font-size';
|
|
4
|
+
|
|
5
|
+
/** Font size configuration: limits and step in pixels, plus optional storage, storage key and CSS variable name */
|
|
6
|
+
type FontSizeConfig = SuFontSizeLimits & Pick<SuFontSizeConfig, 'storage' | 'storageKey' | 'cssVarName'>;
|
|
7
|
+
|
|
1
8
|
/**
|
|
2
|
-
*
|
|
9
|
+
* Angular service for managing the font size.
|
|
10
|
+
*
|
|
11
|
+
* Thin wrapper around the framework-agnostic `SuFontSizeController` from
|
|
12
|
+
* `@su-labs/core/font-size` that exposes the size and limits as Angular signals.
|
|
3
13
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
14
|
+
declare class FontSizeService implements OnDestroy {
|
|
15
|
+
/** Framework-agnostic font size logic */
|
|
16
|
+
private readonly controller;
|
|
17
|
+
private readonly initialLimits;
|
|
18
|
+
/** Default font size in pixels. Change it with {@link configure}. */
|
|
19
|
+
defaultSize: _angular_core.WritableSignal<number>;
|
|
20
|
+
/** Minimum font size in pixels. Change it with {@link configure}. */
|
|
21
|
+
minSize: _angular_core.WritableSignal<number>;
|
|
22
|
+
/** Maximum font size in pixels. Change it with {@link configure}. */
|
|
23
|
+
maxSize: _angular_core.WritableSignal<number>;
|
|
24
|
+
/** Default step in pixels for {@link increase} / {@link decrease}. Change it with {@link configure}. */
|
|
25
|
+
step: _angular_core.WritableSignal<number>;
|
|
26
|
+
/** Current font size in pixels */
|
|
27
|
+
fontSize: _angular_core.WritableSignal<number>;
|
|
28
|
+
/** True if the current size equals the default size */
|
|
29
|
+
isDefault: _angular_core.Signal<boolean>;
|
|
30
|
+
/** True if the current size equals the maximum size */
|
|
31
|
+
isMax: _angular_core.Signal<boolean>;
|
|
32
|
+
/** True if the current size equals the minimum size */
|
|
33
|
+
isMin: _angular_core.Signal<boolean>;
|
|
34
|
+
/** Stop syncing the controller's stores into the signals */
|
|
35
|
+
private readonly unsubscribers;
|
|
36
|
+
/**
|
|
37
|
+
* Update the configuration. Omitted values keep their current setting.
|
|
38
|
+
* @param cfg Partial configuration (limits, step, storage key, CSS variable name).
|
|
39
|
+
*/
|
|
40
|
+
configure(cfg?: Partial<FontSizeConfig>): void;
|
|
41
|
+
/**
|
|
42
|
+
* Load the saved size (or the default), clamp it and apply it to the document.
|
|
43
|
+
* Call once at application startup, after {@link configure}.
|
|
44
|
+
*/
|
|
45
|
+
init(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Set, apply and persist a font size, clamped to the allowed range.
|
|
48
|
+
* @param size Desired font size in pixels.
|
|
49
|
+
*/
|
|
50
|
+
setFontSize(size: number): void;
|
|
51
|
+
/**
|
|
52
|
+
* Increase the font size.
|
|
53
|
+
* @param step Pixels to add. Defaults to {@link step}.
|
|
54
|
+
*/
|
|
55
|
+
increase(step?: number): void;
|
|
56
|
+
/**
|
|
57
|
+
* Decrease the font size.
|
|
58
|
+
* @param step Pixels to remove. Defaults to {@link step}.
|
|
59
|
+
*/
|
|
60
|
+
decrease(step?: number): void;
|
|
61
|
+
/** Return to the default size and remove the saved value from localStorage */
|
|
62
|
+
reset(): void;
|
|
63
|
+
/** Angular lifecycle hook for service destruction */
|
|
64
|
+
ngOnDestroy(): void;
|
|
65
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FontSizeService, never>;
|
|
66
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<FontSizeService>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { FontSizeService };
|
|
70
|
+
export type { FontSizeConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@su-labs/font-size",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.2.0",
|
|
4
4
|
"description": "A lightweight Angular service for dynamic font size management.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"url": "https://github.com/Greezaaa"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@angular/common": "^
|
|
29
|
-
"@angular/core": "^
|
|
28
|
+
"@angular/common": "^20.0.0",
|
|
29
|
+
"@angular/core": "^20.0.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@su-labs/core": "^1.1.0",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { SuFontSizeConfig, SuFontSizeLimits } from '@su-labs/core/font-size';
|
|
2
|
-
/** Font size configuration: limits and step in pixels, plus optional storage, storage key and CSS variable name */
|
|
3
|
-
export type FontSizeConfig = SuFontSizeLimits & Pick<SuFontSizeConfig, 'storage' | 'storageKey' | 'cssVarName'>;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { OnDestroy } from '@angular/core';
|
|
2
|
-
import { FontSizeConfig } from './font-size-config.interface';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
/**
|
|
5
|
-
* Angular service for managing the font size.
|
|
6
|
-
*
|
|
7
|
-
* Thin wrapper around the framework-agnostic `SuFontSizeController` from
|
|
8
|
-
* `@su-labs/core/font-size` that exposes the size and limits as Angular signals.
|
|
9
|
-
*/
|
|
10
|
-
export declare class FontSizeService implements OnDestroy {
|
|
11
|
-
/** Framework-agnostic font size logic */
|
|
12
|
-
private readonly controller;
|
|
13
|
-
private readonly initialLimits;
|
|
14
|
-
/** Default font size in pixels. Change it with {@link configure}. */
|
|
15
|
-
defaultSize: import("@angular/core").WritableSignal<number>;
|
|
16
|
-
/** Minimum font size in pixels. Change it with {@link configure}. */
|
|
17
|
-
minSize: import("@angular/core").WritableSignal<number>;
|
|
18
|
-
/** Maximum font size in pixels. Change it with {@link configure}. */
|
|
19
|
-
maxSize: import("@angular/core").WritableSignal<number>;
|
|
20
|
-
/** Default step in pixels for {@link increase} / {@link decrease}. Change it with {@link configure}. */
|
|
21
|
-
step: import("@angular/core").WritableSignal<number>;
|
|
22
|
-
/** Current font size in pixels */
|
|
23
|
-
fontSize: import("@angular/core").WritableSignal<number>;
|
|
24
|
-
/** True if the current size equals the default size */
|
|
25
|
-
isDefault: import("@angular/core").Signal<boolean>;
|
|
26
|
-
/** True if the current size equals the maximum size */
|
|
27
|
-
isMax: import("@angular/core").Signal<boolean>;
|
|
28
|
-
/** True if the current size equals the minimum size */
|
|
29
|
-
isMin: import("@angular/core").Signal<boolean>;
|
|
30
|
-
/** Stop syncing the controller's stores into the signals */
|
|
31
|
-
private readonly unsubscribers;
|
|
32
|
-
/**
|
|
33
|
-
* Update the configuration. Omitted values keep their current setting.
|
|
34
|
-
* @param cfg Partial configuration (limits, step, storage key, CSS variable name).
|
|
35
|
-
*/
|
|
36
|
-
configure(cfg?: Partial<FontSizeConfig>): void;
|
|
37
|
-
/**
|
|
38
|
-
* Load the saved size (or the default), clamp it and apply it to the document.
|
|
39
|
-
* Call once at application startup, after {@link configure}.
|
|
40
|
-
*/
|
|
41
|
-
init(): void;
|
|
42
|
-
/**
|
|
43
|
-
* Set, apply and persist a font size, clamped to the allowed range.
|
|
44
|
-
* @param size Desired font size in pixels.
|
|
45
|
-
*/
|
|
46
|
-
setFontSize(size: number): void;
|
|
47
|
-
/**
|
|
48
|
-
* Increase the font size.
|
|
49
|
-
* @param step Pixels to add. Defaults to {@link step}.
|
|
50
|
-
*/
|
|
51
|
-
increase(step?: number): void;
|
|
52
|
-
/**
|
|
53
|
-
* Decrease the font size.
|
|
54
|
-
* @param step Pixels to remove. Defaults to {@link step}.
|
|
55
|
-
*/
|
|
56
|
-
decrease(step?: number): void;
|
|
57
|
-
/** Return to the default size and remove the saved value from localStorage */
|
|
58
|
-
reset(): void;
|
|
59
|
-
/** Angular lifecycle hook for service destruction */
|
|
60
|
-
ngOnDestroy(): void;
|
|
61
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<FontSizeService, never>;
|
|
62
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<FontSizeService>;
|
|
63
|
-
}
|
package/public-api.d.ts
DELETED