From e03b20b282e27c4cfc8b7af7368220b3ba0e54ac Mon Sep 17 00:00:00 2001 From: Everett Summer <55684557+EverettSummer@users.noreply.github.com> Date: Sun, 28 Jul 2024 17:23:22 +0100 Subject: [PATCH 1/2] fix window not available in server environment --- package.json | 5 +++-- projects/irohalab/deneb-ui/src/dark-theme.service.ts | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 3a3017f..5d30abe 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,9 @@ "version": "4.0.1", "scripts": { "ng": "ng", - "start": "ng serve", - "build": "ng build", + "start": "ng serve --project Deneb-UI-Demo", + "build": "npm run build:deneb-ui", + "build:deneb-ui": "ng build --project @irohalab/Deneb-UI", "watch": "ng build --watch --configuration development", "test": "ng test" }, diff --git a/projects/irohalab/deneb-ui/src/dark-theme.service.ts b/projects/irohalab/deneb-ui/src/dark-theme.service.ts index 2e0fa9b..45fbf89 100644 --- a/projects/irohalab/deneb-ui/src/dark-theme.service.ts +++ b/projects/irohalab/deneb-ui/src/dark-theme.service.ts @@ -1,5 +1,6 @@ -import { Injectable, OnDestroy } from '@angular/core'; +import { Inject, Injectable, OnDestroy, PLATFORM_ID } from '@angular/core'; import { BehaviorSubject, Observable } from 'rxjs'; +import { isPlatformBrowser } from '@angular/common'; export const DARK_THEME = 'dark_theme'; export const LIGHT_THEME = 'light_theme'; @@ -17,9 +18,11 @@ export class DarkThemeService implements OnDestroy { return this._themeChangeSubject.asObservable(); } - constructor() { - this.checkTheme(); - this.initGlobalListener(); + constructor(@Inject(PLATFORM_ID) platformId: object) { + if (isPlatformBrowser(platformId)) { + this.checkTheme(); + this.initGlobalListener(); + } } public changeTheme(theme: ThemeName): void { From 623d95791e9668f833f89e48cc354474d6d7d25c Mon Sep 17 00:00:00 2001 From: Everett Summer <55684557+EverettSummer@users.noreply.github.com> Date: Sun, 28 Jul 2024 17:24:04 +0100 Subject: [PATCH 2/2] bump version to 4.1.0 --- package.json | 2 +- projects/irohalab/deneb-ui/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5d30abe..b0c062c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "deneb-ui", - "version": "4.0.1", + "version": "4.1.0", "scripts": { "ng": "ng", "start": "ng serve --project Deneb-UI-Demo", diff --git a/projects/irohalab/deneb-ui/package.json b/projects/irohalab/deneb-ui/package.json index fb825e2..a3439f5 100644 --- a/projects/irohalab/deneb-ui/package.json +++ b/projects/irohalab/deneb-ui/package.json @@ -1,6 +1,6 @@ { "name": "@irohalab/deneb-ui", - "version": "4.0.1", + "version": "4.1.0", "description": "Building blocks for mira-ui", "author": "Everett Summer", "license": "Apache-2.0",