@sprucelabs/spruce-heartwood-utils 5.11.4 → 5.13.2

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.
@@ -0,0 +1,18 @@
1
+ import { SpruceSchemas } from '@sprucelabs/spruce-core-schemas';
2
+ declare type Theme = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Theme;
3
+ export declare type SkillTheme = Theme & {
4
+ name: string;
5
+ namespace: string;
6
+ };
7
+ export declare const heartwoodTheme: SkillTheme;
8
+ export declare class ThemeManager {
9
+ private static instance;
10
+ private currentTheme;
11
+ private constructor();
12
+ static getInstance(): ThemeManager;
13
+ static Manager(): ThemeManager;
14
+ getCurrentTheme(): SkillTheme;
15
+ setCurrentTheme(theme: SkillTheme, shouldAnimate?: boolean): Promise<void>;
16
+ reset(): Promise<void>;
17
+ }
18
+ export {};
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ThemeManager = exports.heartwoodTheme = void 0;
4
+ exports.heartwoodTheme = {
5
+ name: 'Heartwood',
6
+ namespace: 'heartwood',
7
+ props: {
8
+ color1: '#ffffff',
9
+ color1Inverse: '#0f4c8a',
10
+ color1InverseGradient: 'linear-gradient(to left, #24c6dc, #514a9d)',
11
+ color2: '#757575',
12
+ color2Transparent: 'rgba(0,0,0,0.2)',
13
+ color2Inverse: 'white',
14
+ color2InverseTransparent: 'rgba(255,255,255,0.9)',
15
+ color3: '#303030',
16
+ color3Inverse: 'transparent',
17
+ color3Compliment: '#a7a7a7',
18
+ color4: '#626262',
19
+ color4Compliment: 'white',
20
+ color4ComplimentTransparent: 'rgba(0,0,0,0.1)',
21
+ color4Inverse: 'white',
22
+ color4InverseCompliment: '#c7c7c7',
23
+ controlBarColor1: 'black',
24
+ controlBarColor2: 'white',
25
+ toolBeltColor2: '#f1f1f1',
26
+ errorColor1: '#fff',
27
+ errorColor1Inverse: '#FF3326',
28
+ },
29
+ };
30
+ class ThemeManager {
31
+ constructor(theme) {
32
+ this.currentTheme = theme;
33
+ void this.setCurrentTheme(theme, false);
34
+ }
35
+ static getInstance() {
36
+ if (!this.instance) {
37
+ this.instance = this.Manager();
38
+ }
39
+ return this.instance;
40
+ }
41
+ static Manager() {
42
+ return new this(exports.heartwoodTheme);
43
+ }
44
+ getCurrentTheme() {
45
+ return this.currentTheme;
46
+ }
47
+ async setCurrentTheme(theme, shouldAnimate = true) {
48
+ var _a, _b;
49
+ this.currentTheme = theme;
50
+ const props = Object.entries(theme.props);
51
+ for (const prop of props) {
52
+ if (shouldAnimate) {
53
+ await new Promise((resolve) => setTimeout(resolve, 50));
54
+ }
55
+ document.documentElement.style.setProperty(`--${prop[0]}`, prop[1]);
56
+ }
57
+ (_a = document
58
+ .querySelector('meta[name="theme-color"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('content', (_b = theme.props.color1Inverse) !== null && _b !== void 0 ? _b : 'white');
59
+ }
60
+ async reset() {
61
+ if (this.currentTheme.namespace !== 'heartwood') {
62
+ await this.setCurrentTheme(exports.heartwoodTheme);
63
+ }
64
+ }
65
+ }
66
+ exports.ThemeManager = ThemeManager;
67
+ //# sourceMappingURL=ThemeManager.js.map
@@ -0,0 +1,18 @@
1
+ import { SpruceSchemas } from '@sprucelabs/spruce-core-schemas';
2
+ declare type Theme = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Theme;
3
+ export declare type SkillTheme = Theme & {
4
+ name: string;
5
+ namespace: string;
6
+ };
7
+ export declare const heartwoodTheme: SkillTheme;
8
+ export declare class ThemeManager {
9
+ private static instance;
10
+ private currentTheme;
11
+ private constructor();
12
+ static getInstance(): ThemeManager;
13
+ static Manager(): ThemeManager;
14
+ getCurrentTheme(): SkillTheme;
15
+ setCurrentTheme(theme: SkillTheme, shouldAnimate?: boolean): Promise<void>;
16
+ reset(): Promise<void>;
17
+ }
18
+ export {};
@@ -0,0 +1,75 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ export const heartwoodTheme = {
11
+ name: 'Heartwood',
12
+ namespace: 'heartwood',
13
+ props: {
14
+ color1: '#ffffff',
15
+ color1Inverse: '#0f4c8a',
16
+ color1InverseGradient: 'linear-gradient(to left, #24c6dc, #514a9d)',
17
+ color2: '#757575',
18
+ color2Transparent: 'rgba(0,0,0,0.2)',
19
+ color2Inverse: 'white',
20
+ color2InverseTransparent: 'rgba(255,255,255,0.9)',
21
+ color3: '#303030',
22
+ color3Inverse: 'transparent',
23
+ color3Compliment: '#a7a7a7',
24
+ color4: '#626262',
25
+ color4Compliment: 'white',
26
+ color4ComplimentTransparent: 'rgba(0,0,0,0.1)',
27
+ color4Inverse: 'white',
28
+ color4InverseCompliment: '#c7c7c7',
29
+ controlBarColor1: 'black',
30
+ controlBarColor2: 'white',
31
+ toolBeltColor2: '#f1f1f1',
32
+ errorColor1: '#fff',
33
+ errorColor1Inverse: '#FF3326',
34
+ },
35
+ };
36
+ export class ThemeManager {
37
+ constructor(theme) {
38
+ this.currentTheme = theme;
39
+ void this.setCurrentTheme(theme, false);
40
+ }
41
+ static getInstance() {
42
+ if (!this.instance) {
43
+ this.instance = this.Manager();
44
+ }
45
+ return this.instance;
46
+ }
47
+ static Manager() {
48
+ return new this(heartwoodTheme);
49
+ }
50
+ getCurrentTheme() {
51
+ return this.currentTheme;
52
+ }
53
+ setCurrentTheme(theme, shouldAnimate = true) {
54
+ var _a, _b;
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ this.currentTheme = theme;
57
+ const props = Object.entries(theme.props);
58
+ for (const prop of props) {
59
+ if (shouldAnimate) {
60
+ yield new Promise((resolve) => setTimeout(resolve, 50));
61
+ }
62
+ document.documentElement.style.setProperty(`--${prop[0]}`, prop[1]);
63
+ }
64
+ (_a = document
65
+ .querySelector('meta[name="theme-color"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('content', (_b = theme.props.color1Inverse) !== null && _b !== void 0 ? _b : 'white');
66
+ });
67
+ }
68
+ reset() {
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ if (this.currentTheme.namespace !== 'heartwood') {
71
+ yield this.setCurrentTheme(heartwoodTheme);
72
+ }
73
+ });
74
+ }
75
+ }
@@ -0,0 +1 @@
1
+ export { default as RemoteViewControllerFactory } from './RemoteViewControllerFactory';
@@ -1 +1 @@
1
- "use strict";
1
+ export { default as RemoteViewControllerFactory } from './RemoteViewControllerFactory.js';
@@ -0,0 +1 @@
1
+ export { default as RemoteViewControllerFactory } from './RemoteViewControllerFactory';
@@ -1,2 +1,9 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RemoteViewControllerFactory = void 0;
7
+ var RemoteViewControllerFactory_1 = require("./RemoteViewControllerFactory");
8
+ Object.defineProperty(exports, "RemoteViewControllerFactory", { enumerable: true, get: function () { return __importDefault(RemoteViewControllerFactory_1).default; } });
2
9
  //# sourceMappingURL=index-module.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-heartwood-utils",
3
3
  "description": "Heartwood Utilities",
4
- "version": "5.11.4",
4
+ "version": "5.13.2",
5
5
  "skill": {
6
6
  "namespace": "heartwood"
7
7
  },
@@ -17,13 +17,24 @@
17
17
  "build/index-module.js",
18
18
  "build/index-module.d.ts",
19
19
  "build/esm/index-module.js",
20
- "build/esm/index-module.d.ts"
20
+ "build/esm/index-module.d.ts",
21
+ "build/RemoteViewContorllerFactory.js",
22
+ "build/RemoteViewContorllerFactory.d.ts",
23
+ "build/esm/RemoteViewContorllerFactory.js",
24
+ "build/esm/RemoteViewContorllerFactory.d.ts",
25
+ "build/ThemeManager.js",
26
+ "build/ThemeManager.d.ts",
27
+ "build/esm/ThemeManager.js",
28
+ "build/esm/ThemeManager.d.ts"
21
29
  ],
22
30
  "keywords": [],
23
31
  "scripts": {
24
32
  "release": "npm publish"
25
33
  },
26
34
  "dependencies": {
35
+ "@sprucelabs/heartwood-view-controllers": "^53.8.1",
36
+ "@sprucelabs/mercury-client": "^19.2.74",
37
+ "@sprucelabs/spruce-event-utils": "^17.1.453"
27
38
  },
28
39
  "engines": {
29
40
  "node": "16.x",