@sprucelabs/spruce-heartwood-utils 9.2.10 → 9.3.0
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/index-module.d.ts +1 -0
- package/build/esm/index-module.js +1 -0
- package/build/esm/theming/ThemeManager.d.ts +5 -1
- package/build/esm/theming/ThemeManager.js +12 -0
- package/build/esm/theming/loadActiveThemeForOrg.d.ts +2 -0
- package/build/esm/theming/loadActiveThemeForOrg.js +19 -0
- package/build/index-module.d.ts +1 -0
- package/build/index-module.js +3 -1
- package/build/theming/ThemeManager.d.ts +5 -1
- package/build/theming/ThemeManager.js +12 -0
- package/build/theming/loadActiveThemeForOrg.d.ts +2 -0
- package/build/theming/loadActiveThemeForOrg.js +12 -0
- package/package.json +6 -2
|
@@ -2,3 +2,4 @@ export { default as RemoteViewControllerFactory } from './skillViews/RemoteViewC
|
|
|
2
2
|
export { default as CardRegistrar } from './skillViews/CardRegistrar';
|
|
3
3
|
export { default as remoteVcAssert } from './__tests__/support/remoteVcAssert';
|
|
4
4
|
export * from './types/heartwood-module.types';
|
|
5
|
+
export { default as loadActiveThemeForOrg } from './theming/loadActiveThemeForOrg';
|
|
@@ -2,3 +2,4 @@ export { default as RemoteViewControllerFactory } from './skillViews/RemoteViewC
|
|
|
2
2
|
export { default as CardRegistrar } from './skillViews/CardRegistrar.js';
|
|
3
3
|
export { default as remoteVcAssert } from './__tests__/support/remoteVcAssert.js';
|
|
4
4
|
export * from './types/heartwood-module.types.js';
|
|
5
|
+
export { default as loadActiveThemeForOrg } from './theming/loadActiveThemeForOrg.js';
|
|
@@ -7,12 +7,16 @@ export declare type SkillTheme = Theme & {
|
|
|
7
7
|
};
|
|
8
8
|
export declare const heartwoodTheme: SkillTheme;
|
|
9
9
|
export declare class ThemeManagerImpl implements ThemeManager {
|
|
10
|
-
private static instance
|
|
10
|
+
private static instance?;
|
|
11
11
|
private currentTheme;
|
|
12
|
+
private themeCount;
|
|
12
13
|
private constructor();
|
|
13
14
|
static getInstance(): ThemeManagerImpl;
|
|
15
|
+
static reset(): void;
|
|
14
16
|
static Manager(): ThemeManagerImpl;
|
|
15
17
|
getTheme(): SkillTheme;
|
|
18
|
+
getThemeSetCount(): number;
|
|
19
|
+
resetThemeCount(): void;
|
|
16
20
|
setTheme(theme: SkillTheme, shouldAnimate?: boolean): Promise<void>;
|
|
17
21
|
reset(): Promise<void>;
|
|
18
22
|
}
|
|
@@ -37,8 +37,10 @@ export const heartwoodTheme = {
|
|
|
37
37
|
};
|
|
38
38
|
export class ThemeManagerImpl {
|
|
39
39
|
constructor(theme) {
|
|
40
|
+
this.themeCount = 0;
|
|
40
41
|
this.currentTheme = theme;
|
|
41
42
|
void this.setTheme(theme, false);
|
|
43
|
+
this.themeCount = 0;
|
|
42
44
|
}
|
|
43
45
|
static getInstance() {
|
|
44
46
|
if (!this.instance) {
|
|
@@ -46,15 +48,25 @@ export class ThemeManagerImpl {
|
|
|
46
48
|
}
|
|
47
49
|
return this.instance;
|
|
48
50
|
}
|
|
51
|
+
static reset() {
|
|
52
|
+
this.instance = undefined;
|
|
53
|
+
}
|
|
49
54
|
static Manager() {
|
|
50
55
|
return new this(heartwoodTheme);
|
|
51
56
|
}
|
|
52
57
|
getTheme() {
|
|
53
58
|
return this.currentTheme;
|
|
54
59
|
}
|
|
60
|
+
getThemeSetCount() {
|
|
61
|
+
return this.themeCount;
|
|
62
|
+
}
|
|
63
|
+
resetThemeCount() {
|
|
64
|
+
this.themeCount = 0;
|
|
65
|
+
}
|
|
55
66
|
setTheme(theme, shouldAnimate = true) {
|
|
56
67
|
var _a, _b;
|
|
57
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
this.themeCount++;
|
|
58
70
|
this.currentTheme = theme;
|
|
59
71
|
const props = Object.entries(theme.props);
|
|
60
72
|
for (const prop of props) {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { MercuryClient } from '@sprucelabs/mercury-client';
|
|
2
|
+
export default function loadActiveThemeForOrg(client: MercuryClient, organizationId: string): Promise<import("@sprucelabs/schema").SchemaStaticValues<import("@sprucelabs/spruce-core-schemas").SpruceSchemas.Heartwood.v2021_02_11.ThemeSchema, false, never, import("@sprucelabs/schema").StaticSchemaAllValues<import("@sprucelabs/spruce-core-schemas").SpruceSchemas.Heartwood.v2021_02_11.ThemeSchema, false>> | null | undefined>;
|
|
@@ -0,0 +1,19 @@
|
|
|
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 default function loadActiveThemeForOrg(client, organizationId) {
|
|
11
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
12
|
+
const [{ theme }] = yield client.emitAndFlattenResponses('heartwood.get-active-theme::v2021_02_11', {
|
|
13
|
+
target: {
|
|
14
|
+
organizationId,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
return theme;
|
|
18
|
+
});
|
|
19
|
+
}
|
package/build/index-module.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export { default as RemoteViewControllerFactory } from './skillViews/RemoteViewC
|
|
|
2
2
|
export { default as CardRegistrar } from './skillViews/CardRegistrar';
|
|
3
3
|
export { default as remoteVcAssert } from './__tests__/support/remoteVcAssert';
|
|
4
4
|
export * from './types/heartwood-module.types';
|
|
5
|
+
export { default as loadActiveThemeForOrg } from './theming/loadActiveThemeForOrg';
|
package/build/index-module.js
CHANGED
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.remoteVcAssert = exports.CardRegistrar = exports.RemoteViewControllerFactory = void 0;
|
|
20
|
+
exports.loadActiveThemeForOrg = exports.remoteVcAssert = exports.CardRegistrar = exports.RemoteViewControllerFactory = void 0;
|
|
21
21
|
var RemoteViewControllerFactory_1 = require("./skillViews/RemoteViewControllerFactory");
|
|
22
22
|
Object.defineProperty(exports, "RemoteViewControllerFactory", { enumerable: true, get: function () { return __importDefault(RemoteViewControllerFactory_1).default; } });
|
|
23
23
|
var CardRegistrar_1 = require("./skillViews/CardRegistrar");
|
|
@@ -25,4 +25,6 @@ Object.defineProperty(exports, "CardRegistrar", { enumerable: true, get: functio
|
|
|
25
25
|
var remoteVcAssert_1 = require("./__tests__/support/remoteVcAssert");
|
|
26
26
|
Object.defineProperty(exports, "remoteVcAssert", { enumerable: true, get: function () { return __importDefault(remoteVcAssert_1).default; } });
|
|
27
27
|
__exportStar(require("./types/heartwood-module.types"), exports);
|
|
28
|
+
var loadActiveThemeForOrg_1 = require("./theming/loadActiveThemeForOrg");
|
|
29
|
+
Object.defineProperty(exports, "loadActiveThemeForOrg", { enumerable: true, get: function () { return __importDefault(loadActiveThemeForOrg_1).default; } });
|
|
28
30
|
//# sourceMappingURL=index-module.js.map
|
|
@@ -7,12 +7,16 @@ export declare type SkillTheme = Theme & {
|
|
|
7
7
|
};
|
|
8
8
|
export declare const heartwoodTheme: SkillTheme;
|
|
9
9
|
export declare class ThemeManagerImpl implements ThemeManager {
|
|
10
|
-
private static instance
|
|
10
|
+
private static instance?;
|
|
11
11
|
private currentTheme;
|
|
12
|
+
private themeCount;
|
|
12
13
|
private constructor();
|
|
13
14
|
static getInstance(): ThemeManagerImpl;
|
|
15
|
+
static reset(): void;
|
|
14
16
|
static Manager(): ThemeManagerImpl;
|
|
15
17
|
getTheme(): SkillTheme;
|
|
18
|
+
getThemeSetCount(): number;
|
|
19
|
+
resetThemeCount(): void;
|
|
16
20
|
setTheme(theme: SkillTheme, shouldAnimate?: boolean): Promise<void>;
|
|
17
21
|
reset(): Promise<void>;
|
|
18
22
|
}
|
|
@@ -31,8 +31,10 @@ exports.heartwoodTheme = {
|
|
|
31
31
|
};
|
|
32
32
|
class ThemeManagerImpl {
|
|
33
33
|
constructor(theme) {
|
|
34
|
+
this.themeCount = 0;
|
|
34
35
|
this.currentTheme = theme;
|
|
35
36
|
void this.setTheme(theme, false);
|
|
37
|
+
this.themeCount = 0;
|
|
36
38
|
}
|
|
37
39
|
static getInstance() {
|
|
38
40
|
if (!this.instance) {
|
|
@@ -40,14 +42,24 @@ class ThemeManagerImpl {
|
|
|
40
42
|
}
|
|
41
43
|
return this.instance;
|
|
42
44
|
}
|
|
45
|
+
static reset() {
|
|
46
|
+
this.instance = undefined;
|
|
47
|
+
}
|
|
43
48
|
static Manager() {
|
|
44
49
|
return new this(exports.heartwoodTheme);
|
|
45
50
|
}
|
|
46
51
|
getTheme() {
|
|
47
52
|
return this.currentTheme;
|
|
48
53
|
}
|
|
54
|
+
getThemeSetCount() {
|
|
55
|
+
return this.themeCount;
|
|
56
|
+
}
|
|
57
|
+
resetThemeCount() {
|
|
58
|
+
this.themeCount = 0;
|
|
59
|
+
}
|
|
49
60
|
async setTheme(theme, shouldAnimate = true) {
|
|
50
61
|
var _a, _b;
|
|
62
|
+
this.themeCount++;
|
|
51
63
|
this.currentTheme = theme;
|
|
52
64
|
const props = Object.entries(theme.props);
|
|
53
65
|
for (const prop of props) {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { MercuryClient } from '@sprucelabs/mercury-client';
|
|
2
|
+
export default function loadActiveThemeForOrg(client: MercuryClient, organizationId: string): Promise<import("@sprucelabs/schema").SchemaStaticValues<import("@sprucelabs/spruce-core-schemas").SpruceSchemas.Heartwood.v2021_02_11.ThemeSchema, false, never, import("@sprucelabs/schema").StaticSchemaAllValues<import("@sprucelabs/spruce-core-schemas").SpruceSchemas.Heartwood.v2021_02_11.ThemeSchema, false>> | null | undefined>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
async function loadActiveThemeForOrg(client, organizationId) {
|
|
4
|
+
const [{ theme }] = await client.emitAndFlattenResponses('heartwood.get-active-theme::v2021_02_11', {
|
|
5
|
+
target: {
|
|
6
|
+
organizationId,
|
|
7
|
+
},
|
|
8
|
+
});
|
|
9
|
+
return theme;
|
|
10
|
+
}
|
|
11
|
+
exports.default = loadActiveThemeForOrg;
|
|
12
|
+
//# sourceMappingURL=loadActiveThemeForOrg.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": "9.
|
|
4
|
+
"version": "9.3.0",
|
|
5
5
|
"skill": {
|
|
6
6
|
"namespace": "heartwood"
|
|
7
7
|
},
|
|
@@ -41,7 +41,11 @@
|
|
|
41
41
|
"build/types/heartwood-module.types.js",
|
|
42
42
|
"build/types/heartwood-module.types.d.ts",
|
|
43
43
|
"build/esm/types/heartwood-module.types.js",
|
|
44
|
-
"build/esm/types/heartwood-module.types.d.ts"
|
|
44
|
+
"build/esm/types/heartwood-module.types.d.ts",
|
|
45
|
+
"build/theming/loadActiveThemeForOrg.js",
|
|
46
|
+
"build/theming/loadActiveThemeForOrg.d.ts",
|
|
47
|
+
"build/esm/theming/loadActiveThemeForOrg.js",
|
|
48
|
+
"build/esm/theming/loadActiveThemeForOrg.d.ts"
|
|
45
49
|
],
|
|
46
50
|
"keywords": [],
|
|
47
51
|
"scripts": {
|