@ng-vagabond-lab/ng-dsv 0.0.6 → 0.0.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.
|
@@ -86,7 +86,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.7", ngImpor
|
|
|
86
86
|
args: [{ selector: 'dsv-theme-switch', standalone: true, imports: [CommonModule, DsvButtonComponent], template: "<dsv-button\n width=\"large\"\n color=\"inherit\"\n size=\"medium\"\n (callback)=\"switchTheme()\"\n [icon]=\"isLightMode() ? 'ri-contrast-2-line' : 'ri-contrast-2-fill'\"\n>\n</dsv-button>\n" }]
|
|
87
87
|
}], ctorParameters: () => [{ type: ThemeService }] });
|
|
88
88
|
|
|
89
|
-
console.log('default theme :', localStorage.getItem('theme'));
|
|
90
89
|
class ThemeService {
|
|
91
90
|
themeMode = signal(localStorage.getItem('theme') ?? 'light');
|
|
92
91
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-vagabond-lab-ng-dsv-ds-theme.mjs","sources":["../../../projects/ng-dsv/ds/theme/component/dsv.theme.component.ts","../../../projects/ng-dsv/ds/theme/component/dsv.theme.component.html","../../../projects/ng-dsv/ds/theme/component/switch/dsv.theme.switch.component.ts","../../../projects/ng-dsv/ds/theme/component/switch/dsv.theme.switch.component.html","../../../projects/ng-dsv/ds/theme/service/dsv.theme.service.ts","../../../projects/ng-dsv/ds/theme/ng-vagabond-lab-ng-dsv-ds-theme.ts"],"sourcesContent":["import { Component, HostBinding, Input } from '@angular/core';\n\nexport type ThemeType = {\n background?: string;\n backgroundDark?: string;\n text?: string;\n textDark?: string;\n primary?: string;\n secondary?: string;\n success?: string;\n info?: string;\n warning?: string;\n error?: string;\n};\n\n@Component({\n selector: 'dsv-theme',\n standalone: true,\n imports: [],\n templateUrl: './dsv.theme.component.html',\n styleUrls: ['./dsv.theme.component.scss'],\n})\nexport class DsvThemeComponent {\n @Input()\n theme: ThemeType = {};\n\n @HostBinding('style.--background')\n background!: string;\n\n @HostBinding('style.--background-dark')\n backgroundDark!: string;\n\n @HostBinding('style.--text')\n text!: string;\n\n @HostBinding('style.--text-dark')\n textDark!: string;\n\n @HostBinding('style.--primary')\n primary!: string;\n\n @HostBinding('style.--secondary')\n secondary!: string;\n\n @HostBinding('style.--success')\n success!: string;\n\n @HostBinding('style.--info')\n info!: string;\n\n @HostBinding('style.--warning')\n warning!: string;\n\n @HostBinding('style.--error')\n error!: string;\n\n ngOnInit() {\n this.background = this.theme.background ?? 'rgb(220, 220, 220)';\n this.backgroundDark = this.theme.backgroundDark ?? 'rgb(31, 31, 31)';\n this.text = this.theme.text ?? '#000';\n this.textDark = this.theme.textDark ?? '#fff';\n this.primary = this.theme.primary ?? '#AAA';\n this.secondary = this.theme.secondary ?? '#AAA';\n this.success = this.theme.success ?? '#439746';\n this.info = this.theme.info ?? '#1b78c4';\n this.warning = this.theme.warning ?? '#dca603';\n this.error = this.theme.error ?? '#da1709';\n }\n}\n","<ng-content></ng-content>\n<div id=\"collapse\"></div>\n","import { CommonModule } from '@angular/common';\nimport { Component } from '@angular/core';\nimport { DsvButtonComponent } from '@ng-vagabond-lab/ng-dsv/ds/button';\nimport { ThemeService } from '../../public-api';\n\nexport type Theme = {\n primary: string;\n text: string;\n};\n\n@Component({\n selector: 'dsv-theme-switch',\n standalone: true,\n imports: [CommonModule, DsvButtonComponent],\n templateUrl: `./dsv.theme.switch.component.html`,\n})\nexport class DsvThemeSwitchComponent {\n constructor(private themeService: ThemeService) {}\n\n switchTheme() {\n this.themeService.switchTheme();\n }\n\n isLightMode() {\n return this.themeService.themeMode() === 'light';\n }\n}\n","<dsv-button\n width=\"large\"\n color=\"inherit\"\n size=\"medium\"\n (callback)=\"switchTheme()\"\n [icon]=\"isLightMode() ? 'ri-contrast-2-line' : 'ri-contrast-2-fill'\"\n>\n</dsv-button>\n","import { Injectable, signal, WritableSignal } from '@angular/core';\n\nexport type ThemeMode = 'dark' | 'light';\n\
|
|
1
|
+
{"version":3,"file":"ng-vagabond-lab-ng-dsv-ds-theme.mjs","sources":["../../../projects/ng-dsv/ds/theme/component/dsv.theme.component.ts","../../../projects/ng-dsv/ds/theme/component/dsv.theme.component.html","../../../projects/ng-dsv/ds/theme/component/switch/dsv.theme.switch.component.ts","../../../projects/ng-dsv/ds/theme/component/switch/dsv.theme.switch.component.html","../../../projects/ng-dsv/ds/theme/service/dsv.theme.service.ts","../../../projects/ng-dsv/ds/theme/ng-vagabond-lab-ng-dsv-ds-theme.ts"],"sourcesContent":["import { Component, HostBinding, Input } from '@angular/core';\n\nexport type ThemeType = {\n background?: string;\n backgroundDark?: string;\n text?: string;\n textDark?: string;\n primary?: string;\n secondary?: string;\n success?: string;\n info?: string;\n warning?: string;\n error?: string;\n};\n\n@Component({\n selector: 'dsv-theme',\n standalone: true,\n imports: [],\n templateUrl: './dsv.theme.component.html',\n styleUrls: ['./dsv.theme.component.scss'],\n})\nexport class DsvThemeComponent {\n @Input()\n theme: ThemeType = {};\n\n @HostBinding('style.--background')\n background!: string;\n\n @HostBinding('style.--background-dark')\n backgroundDark!: string;\n\n @HostBinding('style.--text')\n text!: string;\n\n @HostBinding('style.--text-dark')\n textDark!: string;\n\n @HostBinding('style.--primary')\n primary!: string;\n\n @HostBinding('style.--secondary')\n secondary!: string;\n\n @HostBinding('style.--success')\n success!: string;\n\n @HostBinding('style.--info')\n info!: string;\n\n @HostBinding('style.--warning')\n warning!: string;\n\n @HostBinding('style.--error')\n error!: string;\n\n ngOnInit() {\n this.background = this.theme.background ?? 'rgb(220, 220, 220)';\n this.backgroundDark = this.theme.backgroundDark ?? 'rgb(31, 31, 31)';\n this.text = this.theme.text ?? '#000';\n this.textDark = this.theme.textDark ?? '#fff';\n this.primary = this.theme.primary ?? '#AAA';\n this.secondary = this.theme.secondary ?? '#AAA';\n this.success = this.theme.success ?? '#439746';\n this.info = this.theme.info ?? '#1b78c4';\n this.warning = this.theme.warning ?? '#dca603';\n this.error = this.theme.error ?? '#da1709';\n }\n}\n","<ng-content></ng-content>\n<div id=\"collapse\"></div>\n","import { CommonModule } from '@angular/common';\nimport { Component } from '@angular/core';\nimport { DsvButtonComponent } from '@ng-vagabond-lab/ng-dsv/ds/button';\nimport { ThemeService } from '../../public-api';\n\nexport type Theme = {\n primary: string;\n text: string;\n};\n\n@Component({\n selector: 'dsv-theme-switch',\n standalone: true,\n imports: [CommonModule, DsvButtonComponent],\n templateUrl: `./dsv.theme.switch.component.html`,\n})\nexport class DsvThemeSwitchComponent {\n constructor(private themeService: ThemeService) {}\n\n switchTheme() {\n this.themeService.switchTheme();\n }\n\n isLightMode() {\n return this.themeService.themeMode() === 'light';\n }\n}\n","<dsv-button\n width=\"large\"\n color=\"inherit\"\n size=\"medium\"\n (callback)=\"switchTheme()\"\n [icon]=\"isLightMode() ? 'ri-contrast-2-line' : 'ri-contrast-2-fill'\"\n>\n</dsv-button>\n","import { Injectable, signal, WritableSignal } from '@angular/core';\n\nexport type ThemeMode = 'dark' | 'light';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ThemeService {\n themeMode: WritableSignal<ThemeMode> = signal(\n (localStorage.getItem('theme') as ThemeMode) ?? 'light'\n );\n\n constructor() {\n let html = document.getElementsByTagName('body')[0];\n html.classList.add(this.themeMode());\n }\n\n switchTheme() {\n let html = document.getElementsByTagName('body')[0];\n html.classList.remove(this.themeMode());\n\n let newMode: ThemeMode = this.themeMode() === 'dark' ? 'light' : 'dark';\n this.themeMode.set(newMode);\n localStorage.setItem('theme', newMode);\n html.classList.add(newMode);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.ThemeService"],"mappings":";;;;;MAsBa,iBAAiB,CAAA;IAE5B,KAAK,GAAc,EAAE;AAGrB,IAAA,UAAU;AAGV,IAAA,cAAc;AAGd,IAAA,IAAI;AAGJ,IAAA,QAAQ;AAGR,IAAA,OAAO;AAGP,IAAA,SAAS;AAGT,IAAA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