@sprucelabs/spruce-heartwood-utils 12.6.25 → 12.6.26
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/build/esm/theming/ThemeManager.d.ts +1 -0
- package/build/esm/theming/ThemeManager.js +47 -5
- package/build/esm/theming/loadActiveThemeForOrg.js +1 -0
- package/build/theming/ThemeManager.d.ts +1 -0
- package/build/theming/ThemeManager.js +45 -5
- package/build/theming/loadActiveThemeForOrg.js +1 -0
- package/package.json +1 -1
|
@@ -7,6 +7,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
10
21
|
export const heartwoodTheme = {
|
|
11
22
|
name: 'Heartwood',
|
|
12
23
|
slug: 'heartwood',
|
|
@@ -19,8 +30,8 @@ export const heartwoodTheme = {
|
|
|
19
30
|
color2Inverse: 'white',
|
|
20
31
|
color2InverseTransparent: 'rgba(255,255,255,0.9)',
|
|
21
32
|
color3: '#303030',
|
|
22
|
-
color3Inverse: '#fafafa',
|
|
23
33
|
color3Compliment: '#a7a7a7',
|
|
34
|
+
color3Inverse: '#fafafa',
|
|
24
35
|
color4: '#626262',
|
|
25
36
|
color4Compliment: 'rgba(15,76,138,0.1)',
|
|
26
37
|
color4ComplimentTransparent: 'rgba(0,0,0,0.1)',
|
|
@@ -33,6 +44,26 @@ export const heartwoodTheme = {
|
|
|
33
44
|
errorColor1Inverse: '#FF3326',
|
|
34
45
|
warningColor1: '#A16B14',
|
|
35
46
|
warningColor1Inverse: '#F7D352',
|
|
47
|
+
calendarEvents: {
|
|
48
|
+
draftForegroundColor: '#fafafa',
|
|
49
|
+
draftBackgroundColor: '#798fb9',
|
|
50
|
+
tentativeForegroundColor: '#757575',
|
|
51
|
+
tentativeBackgroundColor: '#97a5d3',
|
|
52
|
+
upcomingForegroundColor: '#fafafa',
|
|
53
|
+
upcomingBackgroundColor: '#4296f5',
|
|
54
|
+
unavailableForegroundColor: '#757575',
|
|
55
|
+
unavailableBackgroundColor: '#a3a3a3',
|
|
56
|
+
blockedForegroundColor: '#fafafa',
|
|
57
|
+
blockedBackgroundColor: '#383f4d',
|
|
58
|
+
activeForegroundColor: '#3c3b3b',
|
|
59
|
+
activeBackgroundColor: '#20d994',
|
|
60
|
+
pastForegroundColor: '#fafafa',
|
|
61
|
+
pastBackgroundColor: '#525252',
|
|
62
|
+
warnForegroundColor: '#757575',
|
|
63
|
+
warnBackgroundColor: '#f5d142',
|
|
64
|
+
criticalForegroundColor: '#fafafa',
|
|
65
|
+
criticalBackgroundColor: '#f54242',
|
|
66
|
+
},
|
|
36
67
|
},
|
|
37
68
|
};
|
|
38
69
|
export class ThemeManagerImpl {
|
|
@@ -68,15 +99,26 @@ export class ThemeManagerImpl {
|
|
|
68
99
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
100
|
this.themeCount++;
|
|
70
101
|
this.currentTheme = theme;
|
|
71
|
-
const
|
|
102
|
+
const _c = theme.props, { calendarEvents } = _c, rest = __rest(_c, ["calendarEvents"]);
|
|
103
|
+
//@ts-ignore
|
|
104
|
+
yield this.setProps(Object.entries(rest), shouldAnimate);
|
|
105
|
+
if (calendarEvents) {
|
|
106
|
+
yield this.setProps(Object.entries(calendarEvents), shouldAnimate);
|
|
107
|
+
}
|
|
108
|
+
(_a = document
|
|
109
|
+
.querySelector('meta[name="theme-color"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('content', (_b = theme.props.color1Inverse) !== null && _b !== void 0 ? _b : 'white');
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
setProps(props, shouldAnimate) {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
114
|
for (const prop of props) {
|
|
73
115
|
if (shouldAnimate) {
|
|
74
116
|
yield new Promise((resolve) => setTimeout(resolve, 50));
|
|
75
117
|
}
|
|
76
|
-
|
|
118
|
+
if (typeof prop[0] === 'string') {
|
|
119
|
+
document.documentElement.style.setProperty(`--${prop[0]}`, prop[1]);
|
|
120
|
+
}
|
|
77
121
|
}
|
|
78
|
-
(_a = document
|
|
79
|
-
.querySelector('meta[name="theme-color"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('content', (_b = theme.props.color1Inverse) !== null && _b !== void 0 ? _b : 'white');
|
|
80
122
|
});
|
|
81
123
|
}
|
|
82
124
|
reset() {
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.ThemeManagerImpl = exports.heartwoodTheme = void 0;
|
|
4
15
|
exports.heartwoodTheme = {
|
|
@@ -13,8 +24,8 @@ exports.heartwoodTheme = {
|
|
|
13
24
|
color2Inverse: 'white',
|
|
14
25
|
color2InverseTransparent: 'rgba(255,255,255,0.9)',
|
|
15
26
|
color3: '#303030',
|
|
16
|
-
color3Inverse: '#fafafa',
|
|
17
27
|
color3Compliment: '#a7a7a7',
|
|
28
|
+
color3Inverse: '#fafafa',
|
|
18
29
|
color4: '#626262',
|
|
19
30
|
color4Compliment: 'rgba(15,76,138,0.1)',
|
|
20
31
|
color4ComplimentTransparent: 'rgba(0,0,0,0.1)',
|
|
@@ -27,6 +38,26 @@ exports.heartwoodTheme = {
|
|
|
27
38
|
errorColor1Inverse: '#FF3326',
|
|
28
39
|
warningColor1: '#A16B14',
|
|
29
40
|
warningColor1Inverse: '#F7D352',
|
|
41
|
+
calendarEvents: {
|
|
42
|
+
draftForegroundColor: '#fafafa',
|
|
43
|
+
draftBackgroundColor: '#798fb9',
|
|
44
|
+
tentativeForegroundColor: '#757575',
|
|
45
|
+
tentativeBackgroundColor: '#97a5d3',
|
|
46
|
+
upcomingForegroundColor: '#fafafa',
|
|
47
|
+
upcomingBackgroundColor: '#4296f5',
|
|
48
|
+
unavailableForegroundColor: '#757575',
|
|
49
|
+
unavailableBackgroundColor: '#a3a3a3',
|
|
50
|
+
blockedForegroundColor: '#fafafa',
|
|
51
|
+
blockedBackgroundColor: '#383f4d',
|
|
52
|
+
activeForegroundColor: '#3c3b3b',
|
|
53
|
+
activeBackgroundColor: '#20d994',
|
|
54
|
+
pastForegroundColor: '#fafafa',
|
|
55
|
+
pastBackgroundColor: '#525252',
|
|
56
|
+
warnForegroundColor: '#757575',
|
|
57
|
+
warnBackgroundColor: '#f5d142',
|
|
58
|
+
criticalForegroundColor: '#fafafa',
|
|
59
|
+
criticalBackgroundColor: '#f54242',
|
|
60
|
+
},
|
|
30
61
|
},
|
|
31
62
|
};
|
|
32
63
|
class ThemeManagerImpl {
|
|
@@ -61,15 +92,24 @@ class ThemeManagerImpl {
|
|
|
61
92
|
var _a, _b;
|
|
62
93
|
this.themeCount++;
|
|
63
94
|
this.currentTheme = theme;
|
|
64
|
-
const
|
|
95
|
+
const _c = theme.props, { calendarEvents } = _c, rest = __rest(_c, ["calendarEvents"]);
|
|
96
|
+
//@ts-ignore
|
|
97
|
+
await this.setProps(Object.entries(rest), shouldAnimate);
|
|
98
|
+
if (calendarEvents) {
|
|
99
|
+
await this.setProps(Object.entries(calendarEvents), shouldAnimate);
|
|
100
|
+
}
|
|
101
|
+
(_a = document
|
|
102
|
+
.querySelector('meta[name="theme-color"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('content', (_b = theme.props.color1Inverse) !== null && _b !== void 0 ? _b : 'white');
|
|
103
|
+
}
|
|
104
|
+
async setProps(props, shouldAnimate) {
|
|
65
105
|
for (const prop of props) {
|
|
66
106
|
if (shouldAnimate) {
|
|
67
107
|
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
68
108
|
}
|
|
69
|
-
|
|
109
|
+
if (typeof prop[0] === 'string') {
|
|
110
|
+
document.documentElement.style.setProperty(`--${prop[0]}`, prop[1]);
|
|
111
|
+
}
|
|
70
112
|
}
|
|
71
|
-
(_a = document
|
|
72
|
-
.querySelector('meta[name="theme-color"]')) === null || _a === void 0 ? void 0 : _a.setAttribute('content', (_b = theme.props.color1Inverse) !== null && _b !== void 0 ? _b : 'white');
|
|
73
113
|
}
|
|
74
114
|
async reset() {
|
|
75
115
|
if (this.currentTheme.slug !== 'heartwood') {
|