@erathen/theme 1.0.1 → 1.0.3
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/erathen-theme.mjs +7 -2
- package/fesm2022/erathen-theme.mjs.map +1 -1
- package/package.json +1 -1
- package/styles/dark.sass +3 -0
- package/styles/light.sass +6 -0
- package/types/erathen-theme.d.ts +5 -1
- package/styles/base.css +0 -8
- package/styles/dark.css +0 -4
- package/styles/light.css +0 -4
|
@@ -2,10 +2,10 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { signal, Injectable, makeEnvironmentProviders, provideAppInitializer } from '@angular/core';
|
|
3
3
|
|
|
4
4
|
class EraThemeService {
|
|
5
|
-
theme = signal('
|
|
5
|
+
theme = signal('', ...(ngDevMode ? [{ debugName: "theme" }] : []));
|
|
6
6
|
setTheme(theme) {
|
|
7
7
|
this.theme.set(theme);
|
|
8
|
-
document.documentElement.setAttribute('
|
|
8
|
+
document.documentElement.setAttribute('class', theme);
|
|
9
9
|
}
|
|
10
10
|
getTheme() {
|
|
11
11
|
return this.theme();
|
|
@@ -19,6 +19,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
|
|
|
19
19
|
}] });
|
|
20
20
|
|
|
21
21
|
// theme.provider.ts
|
|
22
|
+
var EraTheme;
|
|
23
|
+
(function (EraTheme) {
|
|
24
|
+
EraTheme["LIGHT"] = "e-light";
|
|
25
|
+
EraTheme["DARK"] = "e-dark";
|
|
26
|
+
})(EraTheme || (EraTheme = {}));
|
|
22
27
|
function provideEraTheme(config = {}) {
|
|
23
28
|
return makeEnvironmentProviders([
|
|
24
29
|
provideAppInitializer(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erathen-theme.mjs","sources":["../../../projects/theme/src/lib/theme/theme.service.ts","../../../projects/theme/src/lib/theme/theme.provider.ts","../../../projects/theme/src/lib/theme/index.ts","../../../projects/theme/src/public-api.ts","../../../projects/theme/src/erathen-theme.ts"],"sourcesContent":["import { Injectable, signal } from '@angular/core';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class EraThemeService {\r\n private theme = signal<string>('
|
|
1
|
+
{"version":3,"file":"erathen-theme.mjs","sources":["../../../projects/theme/src/lib/theme/theme.service.ts","../../../projects/theme/src/lib/theme/theme.provider.ts","../../../projects/theme/src/lib/theme/index.ts","../../../projects/theme/src/public-api.ts","../../../projects/theme/src/erathen-theme.ts"],"sourcesContent":["import { Injectable, signal } from '@angular/core';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class EraThemeService {\r\n private theme = signal<string>('');\r\n\r\n setTheme(theme: string): void {\r\n this.theme.set(theme);\r\n document.documentElement.setAttribute('class', theme);\r\n }\r\n\r\n getTheme(): string {\r\n return this.theme();\r\n }\r\n}\r\n","// theme.provider.ts\r\nimport {\r\n EnvironmentProviders,\r\n makeEnvironmentProviders,\r\n provideAppInitializer\r\n} from '@angular/core';\r\n\r\nenum EraTheme {\r\n LIGHT = 'e-light',\r\n DARK = 'e-dark'\r\n}\r\n\r\nexport interface EraThemeConfig {\r\n defaultTheme?: EraTheme;\r\n}\r\n\r\nexport function provideEraTheme(\r\n config: EraThemeConfig = {}\r\n): EnvironmentProviders {\r\n return makeEnvironmentProviders([\r\n provideAppInitializer(() => {\r\n document.documentElement.setAttribute(\r\n 'class',\r\n config.defaultTheme ?? ''\r\n );\r\n })\r\n ]);\r\n}\r\n","// index.ts\r\nexport * from './theme.service';\r\nexport * from './theme.provider';\r\n","/*\r\n * Public API Surface of theme\r\n */\r\n\r\nexport * from './lib/theme';\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAGa,eAAe,CAAA;AAClB,IAAA,KAAK,GAAG,MAAM,CAAS,EAAE,iDAAC;AAElC,IAAA,QAAQ,CAAC,KAAa,EAAA;AACpB,QAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;QACrB,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC;IACvD;IAEA,QAAQ,GAAA;AACN,QAAA,OAAO,IAAI,CAAC,KAAK,EAAE;IACrB;uGAVW,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,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,cADF,MAAM,EAAA,CAAA;;2FACnB,eAAe,EAAA,UAAA,EAAA,CAAA;kBAD3B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACFlC;AAOA,IAAK,QAGJ;AAHD,CAAA,UAAK,QAAQ,EAAA;AACX,IAAA,QAAA,CAAA,OAAA,CAAA,GAAA,SAAiB;AACjB,IAAA,QAAA,CAAA,MAAA,CAAA,GAAA,QAAe;AACjB,CAAC,EAHI,QAAQ,KAAR,QAAQ,GAAA,EAAA,CAAA,CAAA;AASP,SAAU,eAAe,CAC7B,MAAA,GAAyB,EAAE,EAAA;AAE3B,IAAA,OAAO,wBAAwB,CAAC;QAC9B,qBAAqB,CAAC,MAAK;AACzB,YAAA,QAAQ,CAAC,eAAe,CAAC,YAAY,CACnC,OAAO,EACP,MAAM,CAAC,YAAY,IAAI,EAAE,CAC1B;AACH,QAAA,CAAC;AACF,KAAA,CAAC;AACJ;;AC3BA;;ACAA;;AAEG;;ACFH;;AAEG;;;;"}
|
package/package.json
CHANGED
package/styles/dark.sass
ADDED
package/types/erathen-theme.d.ts
CHANGED
|
@@ -9,8 +9,12 @@ declare class EraThemeService {
|
|
|
9
9
|
static ɵprov: i0.ɵɵInjectableDeclaration<EraThemeService>;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
declare enum EraTheme {
|
|
13
|
+
LIGHT = "e-light",
|
|
14
|
+
DARK = "e-dark"
|
|
15
|
+
}
|
|
12
16
|
interface EraThemeConfig {
|
|
13
|
-
defaultTheme?:
|
|
17
|
+
defaultTheme?: EraTheme;
|
|
14
18
|
}
|
|
15
19
|
declare function provideEraTheme(config?: EraThemeConfig): EnvironmentProviders;
|
|
16
20
|
|
package/styles/base.css
DELETED
package/styles/dark.css
DELETED
package/styles/light.css
DELETED