@bitblit/ngx-acute-common 5.1.642-alpha → 5.1.644-alpha

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/lib/index.d.ts CHANGED
@@ -17,6 +17,7 @@ export * from './pipes/timing.pipe';
17
17
  export * from './services/google-analytics.service';
18
18
  export * from './services/graphql-query.service';
19
19
  export * from './services/local-storage.service';
20
+ export * from './services/css-theme.service.ts';
20
21
  export * from './services/window-ref.service';
21
22
  export * from './services/process-monitor/process-monitor-service';
22
23
  export * from './services/process-monitor/process-holder';
package/lib/index.js CHANGED
@@ -17,6 +17,7 @@ export * from './pipes/timing.pipe';
17
17
  export * from './services/google-analytics.service';
18
18
  export * from './services/graphql-query.service';
19
19
  export * from './services/local-storage.service';
20
+ export * from "./services/css-theme.service.js";
20
21
  export * from './services/window-ref.service';
21
22
  export * from './services/process-monitor/process-monitor-service';
22
23
  export * from './services/process-monitor/process-holder';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAE9C,cAAc,gDAAgD,CAAC;AAE/D,cAAc,4CAA4C,CAAC;AAE3D,cAAc,wDAAwD,CAAC;AAEvE,cAAc,aAAa,CAAC;AAE5B,cAAc,iCAAiC,CAAC;AAEhD,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AAEpC,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAE9C,cAAc,oDAAoD,CAAC;AACnE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,kDAAkD,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAE9C,cAAc,gDAAgD,CAAC;AAE/D,cAAc,4CAA4C,CAAC;AAE3D,cAAc,wDAAwD,CAAC;AAEvE,cAAc,aAAa,CAAC;AAE5B,cAAc,iCAAiC,CAAC;AAEhD,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AAEpC,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAE9C,cAAc,oDAAoD,CAAC;AACnE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,kDAAkD,CAAC"}
@@ -0,0 +1,11 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class CssThemeService<ThemeObject> {
3
+ setCssVariable(name: string, value: string, scope?: HTMLElement, prefix?: string): void;
4
+ getCssVariable(name: string, scope?: HTMLElement, prefix?: string): string | null;
5
+ applyTheme(rec: ThemeObject): void;
6
+ setNumericVariable(name: string, value: number, suffix: string, scope?: HTMLElement, prefix?: string): void;
7
+ setNumericVariableBetweenBounds(name: string, value: number, minInclusive: number, maxExclusive: number, suffix: string, scope?: HTMLElement, prefix?: string): boolean;
8
+ modifyNumericVariableBetweenBounds(name: string, delta: number, min: number, max: number, suffix: string, scope?: HTMLElement, prefix?: string): boolean;
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<CssThemeService<any>, never>;
10
+ static ɵprov: i0.ɵɵInjectableDeclaration<CssThemeService<any>>;
11
+ }
@@ -0,0 +1,49 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { Logger } from '@bitblit/ratchet-common/logger/logger';
3
+ import { StringRatchet } from "@bitblit/ratchet-common/lang/string-ratchet";
4
+ import * as i0 from "@angular/core";
5
+ export class CssThemeService {
6
+ setCssVariable(name, value, scope = document.documentElement, prefix = '--') {
7
+ scope.style.setProperty(prefix + name, value);
8
+ }
9
+ getCssVariable(name, scope = document.documentElement, prefix = '--') {
10
+ return StringRatchet.trimToNull(getComputedStyle(scope).getPropertyValue(prefix + name));
11
+ }
12
+ applyTheme(rec) {
13
+ Object.keys(rec).forEach(k => {
14
+ this.setCssVariable('--' + k, rec[k]);
15
+ });
16
+ }
17
+ setNumericVariable(name, value, suffix, scope = document.documentElement, prefix = '--') {
18
+ this.setCssVariable(name, value + suffix, scope, prefix);
19
+ }
20
+ setNumericVariableBetweenBounds(name, value, minInclusive, maxExclusive, suffix, scope = document.documentElement, prefix = '--') {
21
+ if (value <= minInclusive && value >= maxExclusive) {
22
+ this.setCssVariable(name, value + suffix, scope, prefix);
23
+ return true;
24
+ }
25
+ else {
26
+ Logger.info('Ignoring out of bounds value %d', value);
27
+ return false;
28
+ }
29
+ }
30
+ modifyNumericVariableBetweenBounds(name, delta, min, max, suffix, scope = document.documentElement, prefix = '--') {
31
+ const curValString = this.getCssVariable(name, scope, prefix);
32
+ if (curValString) {
33
+ const curVal = parseInt(curValString.substring(0, curValString.length - suffix.length));
34
+ const newVal = curVal + delta;
35
+ return this.setNumericVariableBetweenBounds(name, newVal, min, max, suffix, scope, prefix);
36
+ }
37
+ else {
38
+ Logger.info('No current value for %s', name);
39
+ return false;
40
+ }
41
+ }
42
+ static ɵfac = function CssThemeService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CssThemeService)(); };
43
+ static ɵprov = i0.ɵɵdefineInjectable({ token: CssThemeService, factory: CssThemeService.ɵfac, providedIn: 'root' });
44
+ }
45
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CssThemeService, [{
46
+ type: Injectable,
47
+ args: [{ providedIn: 'root' }]
48
+ }], null, null); })();
49
+ //# sourceMappingURL=css-theme.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css-theme.service.js","sourceRoot":"","sources":["../../src/services/css-theme.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;;AAmC5E,MAAM,OAAO,eAAe;IAEnB,cAAc,CAAC,IAAY,EAAE,KAAa,EAAE,QAAqB,QAAQ,CAAC,eAAe,EAAE,SAAe,IAAI;QACnH,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,GAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAEM,cAAc,CAAC,IAAY,EAAE,QAAqB,QAAQ,CAAC,eAAe,EAAE,SAAe,IAAI;QACpG,OAAO,aAAa,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAAC,MAAM,GAAC,IAAI,CAAC,CAAC,CAAC;IACzF,CAAC;IAGM,UAAU,CAAC,GAAgB;QAChC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YAC3B,IAAI,CAAC,cAAc,CAAC,IAAI,GAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACtC,CAAC,CAAC,CAAA;IACJ,CAAC;IAEM,kBAAkB,CAAC,IAAY,EAAE,KAAa,EAAE,MAAc,EAAE,QAAqB,QAAQ,CAAC,eAAe,EAAE,SAAe,IAAI;QACrI,IAAI,CAAC,cAAc,CAAC,IAAI,EAA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AAe,WAAf,eAAe,mBADH,MAAM;;iFAClB,eAAe;cAD3B,UAAU;eAAC,EAAC,UAAU,EAAE,MAAM,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitblit/ngx-acute-common",
3
- "version": "5.1.642-alpha",
3
+ "version": "5.1.644-alpha",
4
4
  "description": "Library for using angular",
5
5
  "module": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -44,8 +44,8 @@
44
44
  "@angular/platform-browser": "19.2.9",
45
45
  "@angular/platform-browser-dynamic": "19.2.9",
46
46
  "@angular/router": "19.2.9",
47
- "@bitblit/ratchet-common": "5.1.642-alpha",
48
- "@bitblit/ratchet-graphql": "5.1.642-alpha",
47
+ "@bitblit/ratchet-common": "5.1.644-alpha",
48
+ "@bitblit/ratchet-graphql": "5.1.644-alpha",
49
49
  "primeflex": "4.0.0",
50
50
  "primeicons": "7.0.0",
51
51
  "primeng": "19.1.2",
@@ -62,8 +62,8 @@
62
62
  "@angular/platform-browser": "^19.2.9",
63
63
  "@angular/platform-browser-dynamic": "^19.2.9",
64
64
  "@angular/router": "^19.2.9",
65
- "@bitblit/ratchet-common": "5.1.642-alpha",
66
- "@bitblit/ratchet-graphql": "5.1.642-alpha",
65
+ "@bitblit/ratchet-common": "5.1.644-alpha",
66
+ "@bitblit/ratchet-graphql": "5.1.644-alpha",
67
67
  "primeflex": "4.0.0",
68
68
  "primeicons": "7.0.0",
69
69
  "primeng": "19.1.2",
@@ -72,6 +72,6 @@
72
72
  },
73
73
  "devDependencies": {
74
74
  "@angular/compiler-cli": "19.2.9",
75
- "@bitblit/ratchet-node-only": "5.1.642-alpha"
75
+ "@bitblit/ratchet-node-only": "5.1.644-alpha"
76
76
  }
77
77
  }