@sprucelabs/spruce-heartwood-utils 29.2.53 → 29.2.55
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.
@@ -21,9 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
21
21
|
export class ThemeManagerImpl {
|
22
22
|
constructor(theme) {
|
23
23
|
this.themeCount = 0;
|
24
|
-
this.currentTheme = theme;
|
25
24
|
void this.setTheme(theme, false);
|
26
|
-
this.themeCount = 0;
|
27
25
|
}
|
28
26
|
static getInstance() {
|
29
27
|
if (!this.instance) {
|
@@ -48,21 +46,21 @@ export class ThemeManagerImpl {
|
|
48
46
|
}
|
49
47
|
setTheme(theme_1) {
|
50
48
|
return __awaiter(this, arguments, void 0, function* (theme, shouldAnimate = true) {
|
51
|
-
var _a, _b;
|
52
|
-
if (this.currentTheme.name === theme.name) {
|
49
|
+
var _a, _b, _c;
|
50
|
+
if (((_a = this.currentTheme) === null || _a === void 0 ? void 0 : _a.name) === theme.name) {
|
53
51
|
return;
|
54
52
|
}
|
55
53
|
this.themeCount++;
|
56
54
|
this.currentTheme = theme;
|
57
|
-
const
|
55
|
+
const _d = theme.props, { calendarEvents, borderRadius } = _d, rest = __rest(_d, ["calendarEvents", "borderRadius"]);
|
58
56
|
this.applyBorderRadius(borderRadius);
|
59
57
|
//@ts-ignore
|
60
58
|
yield this.setProps(Object.entries(rest), shouldAnimate);
|
61
59
|
if (calendarEvents) {
|
62
60
|
yield this.setProps(Object.entries(calendarEvents), shouldAnimate);
|
63
61
|
}
|
64
|
-
(
|
65
|
-
.querySelector('meta[name="theme-color"]')) === null ||
|
62
|
+
(_b = document
|
63
|
+
.querySelector('meta[name="theme-color"]')) === null || _b === void 0 ? void 0 : _b.setAttribute('content', (_c = theme.props.color1Inverse) !== null && _c !== void 0 ? _c : 'white');
|
66
64
|
});
|
67
65
|
}
|
68
66
|
applyBorderRadius(borderRadius) {
|
@@ -15,9 +15,7 @@ exports.heartwoodTheme = exports.ThemeManagerImpl = void 0;
|
|
15
15
|
class ThemeManagerImpl {
|
16
16
|
constructor(theme) {
|
17
17
|
this.themeCount = 0;
|
18
|
-
this.currentTheme = theme;
|
19
18
|
void this.setTheme(theme, false);
|
20
|
-
this.themeCount = 0;
|
21
19
|
}
|
22
20
|
static getInstance() {
|
23
21
|
if (!this.instance) {
|
@@ -41,21 +39,21 @@ class ThemeManagerImpl {
|
|
41
39
|
this.themeCount = 0;
|
42
40
|
}
|
43
41
|
async setTheme(theme, shouldAnimate = true) {
|
44
|
-
var _a, _b;
|
45
|
-
if (this.currentTheme.name === theme.name) {
|
42
|
+
var _a, _b, _c;
|
43
|
+
if (((_a = this.currentTheme) === null || _a === void 0 ? void 0 : _a.name) === theme.name) {
|
46
44
|
return;
|
47
45
|
}
|
48
46
|
this.themeCount++;
|
49
47
|
this.currentTheme = theme;
|
50
|
-
const
|
48
|
+
const _d = theme.props, { calendarEvents, borderRadius } = _d, rest = __rest(_d, ["calendarEvents", "borderRadius"]);
|
51
49
|
this.applyBorderRadius(borderRadius);
|
52
50
|
//@ts-ignore
|
53
51
|
await this.setProps(Object.entries(rest), shouldAnimate);
|
54
52
|
if (calendarEvents) {
|
55
53
|
await this.setProps(Object.entries(calendarEvents), shouldAnimate);
|
56
54
|
}
|
57
|
-
(
|
58
|
-
.querySelector('meta[name="theme-color"]')) === null ||
|
55
|
+
(_b = document
|
56
|
+
.querySelector('meta[name="theme-color"]')) === null || _b === void 0 ? void 0 : _b.setAttribute('content', (_c = theme.props.color1Inverse) !== null && _c !== void 0 ? _c : 'white');
|
59
57
|
}
|
60
58
|
applyBorderRadius(borderRadius) {
|
61
59
|
if (!borderRadius || borderRadius === 'rounded') {
|