@storm-software/config-tools 1.190.119 → 1.190.121
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/README.md +1 -1
- package/bin/config.cjs +1213 -1558
- package/bin/config.mjs +1271 -0
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/config-file/get-config-file.cjs +67 -28
- package/dist/config-file/get-config-file.d.cts +5 -5
- package/dist/config-file/{get-config-file.d.ts → get-config-file.d.mts} +7 -5
- package/dist/config-file/get-config-file.mjs +66 -0
- package/dist/config-file/index.cjs +4 -29
- package/dist/config-file/index.d.cts +2 -3
- package/dist/config-file/index.d.mts +4 -0
- package/dist/config-file/index.mjs +5 -0
- package/dist/create-storm-config.cjs +115 -34
- package/dist/create-storm-config.d.cts +5 -5
- package/dist/{create-storm-config.d.ts → create-storm-config.d.mts} +7 -5
- package/dist/create-storm-config.mjs +113 -0
- package/dist/env/get-env.cjs +202 -11
- package/dist/env/get-env.d.cts +5 -5
- package/dist/env/{get-env.d.ts → get-env.d.mts} +7 -5
- package/dist/env/get-env.mjs +203 -0
- package/dist/env/index.cjs +7 -18
- package/dist/env/index.d.cts +3 -4
- package/dist/env/index.d.mts +5 -0
- package/dist/env/index.mjs +6 -0
- package/dist/env/set-env.cjs +230 -11
- package/dist/env/set-env.d.cts +8 -8
- package/dist/env/{set-env.d.ts → set-env.d.mts} +10 -8
- package/dist/env/set-env.mjs +231 -0
- package/dist/get-config.cjs +46 -34
- package/dist/get-config.d.cts +18 -18
- package/dist/{get-config.d.ts → get-config.d.mts} +20 -18
- package/dist/get-config.mjs +46 -0
- package/dist/index.cjs +98 -201
- package/dist/index.d.cts +27 -28
- package/dist/index.d.mts +29 -0
- package/dist/index.mjs +26 -0
- package/dist/logger/chalk.cjs +43 -6
- package/dist/logger/chalk.d.cts +18 -17
- package/dist/logger/chalk.d.mts +37 -0
- package/dist/logger/chalk.mjs +43 -0
- package/dist/logger/console-icons.cjs +18 -8
- package/dist/logger/console-icons.d.cts +5 -8
- package/dist/logger/console-icons.d.mts +7 -0
- package/dist/logger/console-icons.mjs +20 -0
- package/dist/logger/console.cjs +195 -37
- package/dist/logger/console.d.cts +25 -25
- package/dist/logger/{console.d.ts → console.d.mts} +27 -25
- package/dist/logger/console.mjs +185 -0
- package/dist/logger/create-logger.cjs +34 -14
- package/dist/logger/create-logger.d.cts +5 -6
- package/dist/logger/{create-logger.d.ts → create-logger.d.mts} +7 -6
- package/dist/logger/create-logger.mjs +34 -0
- package/dist/logger/format-timestamp.cjs +14 -6
- package/dist/logger/format-timestamp.d.cts +3 -2
- package/dist/logger/{format-timestamp.d.ts → format-timestamp.d.mts} +5 -2
- package/dist/logger/format-timestamp.mjs +16 -0
- package/dist/logger/get-log-level.cjs +54 -11
- package/dist/logger/get-log-level.d.cts +4 -5
- package/dist/logger/{get-log-level.d.ts → get-log-level.d.mts} +6 -5
- package/dist/logger/get-log-level.mjs +54 -0
- package/dist/logger/index.cjs +29 -61
- package/dist/logger/index.d.cts +8 -10
- package/dist/logger/index.d.mts +10 -0
- package/dist/logger/index.mjs +11 -0
- package/dist/logger/is-unicode-supported.cjs +8 -6
- package/dist/logger/is-unicode-supported.d.cts +3 -2
- package/dist/logger/is-unicode-supported.d.mts +6 -0
- package/dist/logger/is-unicode-supported.mjs +10 -0
- package/dist/types.cjs +29 -8
- package/dist/types.d.cts +39 -41
- package/dist/types.d.mts +53 -0
- package/dist/types.mjs +30 -0
- package/dist/utilities/apply-workspace-tokens.cjs +37 -13
- package/dist/utilities/apply-workspace-tokens.d.cts +4 -5
- package/dist/utilities/{apply-workspace-tokens.d.ts → apply-workspace-tokens.d.mts} +6 -5
- package/dist/utilities/apply-workspace-tokens.mjs +37 -0
- package/dist/utilities/colors.cjs +98 -12
- package/dist/utilities/colors.d.cts +4 -4
- package/dist/utilities/{colors.d.ts → colors.d.mts} +6 -4
- package/dist/utilities/colors.mjs +97 -0
- package/dist/utilities/correct-paths.cjs +201 -32
- package/dist/utilities/correct-paths.d.cts +4 -4
- package/dist/utilities/{correct-paths.d.ts → correct-paths.d.mts} +6 -4
- package/dist/utilities/correct-paths.mjs +190 -0
- package/dist/utilities/file-path-utils.cjs +48 -11
- package/dist/utilities/file-path-utils.d.cts +15 -14
- package/dist/utilities/{file-path-utils.d.ts → file-path-utils.d.mts} +17 -14
- package/dist/utilities/file-path-utils.mjs +48 -0
- package/dist/utilities/find-up.cjs +17 -6
- package/dist/utilities/find-up.d.cts +3 -2
- package/dist/utilities/{find-up.d.ts → find-up.d.mts} +5 -2
- package/dist/utilities/find-up.mjs +19 -0
- package/dist/utilities/find-workspace-root.cjs +72 -10
- package/dist/utilities/find-workspace-root.d.cts +3 -2
- package/dist/utilities/{find-workspace-root.d.ts → find-workspace-root.d.mts} +5 -2
- package/dist/utilities/find-workspace-root.mjs +73 -0
- package/dist/utilities/get-default-config.cjs +73 -11
- package/dist/utilities/get-default-config.d.cts +4 -4
- package/dist/utilities/{get-default-config.d.ts → get-default-config.d.mts} +6 -4
- package/dist/utilities/get-default-config.mjs +74 -0
- package/dist/utilities/index.cjs +49 -109
- package/dist/utilities/index.d.cts +10 -14
- package/dist/utilities/index.d.mts +12 -0
- package/dist/utilities/index.mjs +13 -0
- package/dist/utilities/process-handler.cjs +38 -18
- package/dist/utilities/process-handler.d.cts +4 -4
- package/dist/utilities/process-handler.d.mts +9 -0
- package/dist/utilities/process-handler.mjs +38 -0
- package/dist/utilities/run.cjs +64 -10
- package/dist/utilities/run.d.cts +5 -6
- package/dist/utilities/{run.d.ts → run.d.mts} +7 -6
- package/dist/utilities/run.mjs +64 -0
- package/dist/utilities/toml.cjs +37 -24
- package/dist/utilities/toml.d.cts +148 -147
- package/dist/utilities/toml.d.mts +192 -0
- package/dist/utilities/toml.mjs +33 -0
- package/package.json +106 -158
- package/bin/config.js +0 -1616
- package/dist/chunk-24B36RDB.cjs +0 -81
- package/dist/chunk-27N3QEX5.js +0 -40
- package/dist/chunk-2AVLCXLT.js +0 -0
- package/dist/chunk-2RLMTBVZ.js +0 -233
- package/dist/chunk-2WBD2G3E.cjs +0 -38
- package/dist/chunk-3COHMHPU.cjs +0 -1
- package/dist/chunk-4Q45WJYQ.js +0 -165
- package/dist/chunk-5C7PIENF.js +0 -92
- package/dist/chunk-5J2SS4QU.js +0 -83
- package/dist/chunk-65SWKEHV.cjs +0 -1
- package/dist/chunk-6Y623TCS.cjs +0 -40
- package/dist/chunk-7PV6L7I7.cjs +0 -1
- package/dist/chunk-7QBTVNMR.cjs +0 -30
- package/dist/chunk-BDATZ3UB.cjs +0 -233
- package/dist/chunk-BZRTSWH4.cjs +0 -395
- package/dist/chunk-D3FRXXDE.js +0 -947
- package/dist/chunk-DTGT4OI3.cjs +0 -14
- package/dist/chunk-EC2KPWRG.cjs +0 -24
- package/dist/chunk-EENQN6N2.js +0 -40
- package/dist/chunk-ENI4UUSK.cjs +0 -35
- package/dist/chunk-FJNXECWU.js +0 -395
- package/dist/chunk-FMDVBSP6.cjs +0 -83
- package/dist/chunk-G2MK47WL.js +0 -14
- package/dist/chunk-HFS7WJVW.js +0 -81
- package/dist/chunk-HVVJHTFS.js +0 -36
- package/dist/chunk-IWD6YQKX.cjs +0 -1
- package/dist/chunk-IWQRXQ4N.cjs +0 -84
- package/dist/chunk-JK4TT5IV.js +0 -35
- package/dist/chunk-JWLDCEBZ.cjs +0 -70
- package/dist/chunk-JZAYHDV3.js +0 -8
- package/dist/chunk-KSMN3HSC.js +0 -38
- package/dist/chunk-L6UNTUC4.js +0 -0
- package/dist/chunk-LOY6ICHZ.cjs +0 -36
- package/dist/chunk-MBG2FTBL.cjs +0 -47
- package/dist/chunk-MQG74XF7.js +0 -102
- package/dist/chunk-MSAQEGBK.cjs +0 -92
- package/dist/chunk-NJFLUTGH.cjs +0 -25
- package/dist/chunk-PCYB64MB.cjs +0 -40
- package/dist/chunk-RALMUN5C.js +0 -30
- package/dist/chunk-RRKB32OH.js +0 -0
- package/dist/chunk-RUKM6FCF.js +0 -25
- package/dist/chunk-SIW7AXUG.js +0 -56
- package/dist/chunk-SLICWTO2.cjs +0 -165
- package/dist/chunk-SO3FWVXC.js +0 -84
- package/dist/chunk-SXPH7ILL.js +0 -70
- package/dist/chunk-T7YISGRS.cjs +0 -102
- package/dist/chunk-TZZRLM5J.cjs +0 -947
- package/dist/chunk-UJ77IBHD.cjs +0 -233
- package/dist/chunk-UKGRDKIH.js +0 -0
- package/dist/chunk-V3GMJ4TX.js +0 -233
- package/dist/chunk-WQJYIPSL.cjs +0 -8
- package/dist/chunk-YBVOKYAM.cjs +0 -56
- package/dist/chunk-YX4736HU.js +0 -47
- package/dist/chunk-ZFNAUMQS.js +0 -24
- package/dist/config-file/get-config-file.js +0 -28
- package/dist/config-file/index.d.ts +0 -3
- package/dist/config-file/index.js +0 -29
- package/dist/create-storm-config.js +0 -35
- package/dist/env/get-env.js +0 -11
- package/dist/env/index.d.ts +0 -4
- package/dist/env/index.js +0 -18
- package/dist/env/set-env.js +0 -11
- package/dist/get-config.js +0 -34
- package/dist/index.d.ts +0 -28
- package/dist/index.js +0 -201
- package/dist/logger/chalk.d.ts +0 -34
- package/dist/logger/chalk.js +0 -6
- package/dist/logger/console-icons.d.ts +0 -8
- package/dist/logger/console-icons.js +0 -8
- package/dist/logger/console.js +0 -37
- package/dist/logger/create-logger.js +0 -14
- package/dist/logger/format-timestamp.js +0 -6
- package/dist/logger/get-log-level.js +0 -11
- package/dist/logger/index.d.ts +0 -10
- package/dist/logger/index.js +0 -61
- package/dist/logger/is-unicode-supported.d.ts +0 -3
- package/dist/logger/is-unicode-supported.js +0 -6
- package/dist/types.d.ts +0 -53
- package/dist/types.js +0 -8
- package/dist/utilities/apply-workspace-tokens.js +0 -13
- package/dist/utilities/colors.js +0 -12
- package/dist/utilities/correct-paths.js +0 -32
- package/dist/utilities/file-path-utils.js +0 -11
- package/dist/utilities/find-up.js +0 -6
- package/dist/utilities/find-workspace-root.js +0 -10
- package/dist/utilities/get-default-config.js +0 -11
- package/dist/utilities/index.d.ts +0 -14
- package/dist/utilities/index.js +0 -109
- package/dist/utilities/process-handler.d.ts +0 -7
- package/dist/utilities/process-handler.js +0 -18
- package/dist/utilities/run.js +0 -10
- package/dist/utilities/toml.d.ts +0 -189
- package/dist/utilities/toml.js +0 -24
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { GetChalkReturn, getChalk } from "./chalk.mjs";
|
|
4
|
+
import { FormatLogMessageOptions, GetLogFnOptions, brandIcon, formatLogMessage, getLogFn, getStopwatch, writeDebug, writeError, writeFatal, writeInfo, writePerformance, writeSuccess, writeSystem, writeTrace, writeWarning } from "./console.mjs";
|
|
5
|
+
import { CONSOLE_ICONS } from "./console-icons.mjs";
|
|
6
|
+
import { createLogger } from "./create-logger.mjs";
|
|
7
|
+
import { formatTimestamp } from "./format-timestamp.mjs";
|
|
8
|
+
import { getLogLevel, getLogLevelLabel, isVerbose } from "./get-log-level.mjs";
|
|
9
|
+
import { isUnicodeSupported } from "./is-unicode-supported.mjs";
|
|
10
|
+
export { CONSOLE_ICONS, FormatLogMessageOptions, GetChalkReturn, GetLogFnOptions, brandIcon, createLogger, formatLogMessage, formatTimestamp, getChalk, getLogFn, getLogLevel, getLogLevelLabel, getStopwatch, isUnicodeSupported, isVerbose, writeDebug, writeError, writeFatal, writeInfo, writePerformance, writeSuccess, writeSystem, writeTrace, writeWarning };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { getChalk } from "./chalk.mjs";
|
|
5
|
+
import { isUnicodeSupported } from "./is-unicode-supported.mjs";
|
|
6
|
+
import { CONSOLE_ICONS } from "./console-icons.mjs";
|
|
7
|
+
import { formatTimestamp } from "./format-timestamp.mjs";
|
|
8
|
+
import { getLogLevel, getLogLevelLabel, isVerbose } from "./get-log-level.mjs";
|
|
9
|
+
import { brandIcon, formatLogMessage, getLogFn, getStopwatch, writeDebug, writeError, writeFatal, writeInfo, writePerformance, writeSuccess, writeSystem, writeTrace, writeWarning } from "./console.mjs";
|
|
10
|
+
import { createLogger } from "./create-logger.mjs";
|
|
11
|
+
export { CONSOLE_ICONS, brandIcon, createLogger, formatLogMessage, formatTimestamp, getChalk, getLogFn, getLogLevel, getLogLevelLabel, getStopwatch, isUnicodeSupported, isVerbose, writeDebug, writeError, writeFatal, writeInfo, writePerformance, writeSuccess, writeSystem, writeTrace, writeWarning };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/logger/is-unicode-supported.ts
|
|
3
|
+
function isUnicodeSupported() {
|
|
4
|
+
if (process.platform !== "win32") return process.env.TERM !== "linux";
|
|
5
|
+
return Boolean(process.env.WT_SESSION) || Boolean(process.env.TERMINUS_SUBLIME) || process.env.ConEmuTask === "{cmd::Cmder}" || process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
exports.isUnicodeSupported = isUnicodeSupported;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
//#region src/logger/is-unicode-supported.ts
|
|
5
|
+
function isUnicodeSupported() {
|
|
6
|
+
if (process.platform !== "win32") return process.env.TERM !== "linux";
|
|
7
|
+
return Boolean(process.env.WT_SESSION) || Boolean(process.env.TERMINUS_SUBLIME) || process.env.ConEmuTask === "{cmd::Cmder}" || process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { isUnicodeSupported };
|
package/dist/types.cjs
CHANGED
|
@@ -1,8 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/types.ts
|
|
3
|
+
const LogLevel = {
|
|
4
|
+
SILENT: 0,
|
|
5
|
+
FATAL: 10,
|
|
6
|
+
ERROR: 20,
|
|
7
|
+
WARN: 30,
|
|
8
|
+
SUCCESS: 35,
|
|
9
|
+
INFO: 40,
|
|
10
|
+
PERFORMANCE: 50,
|
|
11
|
+
DEBUG: 60,
|
|
12
|
+
TRACE: 70,
|
|
13
|
+
ALL: 100
|
|
14
|
+
};
|
|
15
|
+
const LogLevelLabel = {
|
|
16
|
+
SILENT: "silent",
|
|
17
|
+
FATAL: "fatal",
|
|
18
|
+
ERROR: "error",
|
|
19
|
+
WARN: "warn",
|
|
20
|
+
SUCCESS: "success",
|
|
21
|
+
INFO: "info",
|
|
22
|
+
PERFORMANCE: "performance",
|
|
23
|
+
DEBUG: "debug",
|
|
24
|
+
TRACE: "trace",
|
|
25
|
+
ALL: "all"
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.LogLevel = LogLevel;
|
|
29
|
+
exports.LogLevelLabel = LogLevelLabel;
|
package/dist/types.d.cts
CHANGED
|
@@ -1,53 +1,51 @@
|
|
|
1
|
-
import { StormWorkspaceConfig } from
|
|
2
|
-
|
|
1
|
+
import { StormWorkspaceConfig } from "@storm-software/config";
|
|
2
|
+
//#region src/types.d.ts
|
|
3
3
|
type LogLevel = 0 | 10 | 20 | 30 | 35 | 40 | 50 | 60 | 70 | 100;
|
|
4
4
|
declare const LogLevel: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
readonly SILENT: LogLevel;
|
|
6
|
+
readonly FATAL: LogLevel;
|
|
7
|
+
readonly ERROR: LogLevel;
|
|
8
|
+
readonly WARN: LogLevel;
|
|
9
|
+
readonly SUCCESS: LogLevel;
|
|
10
|
+
readonly INFO: LogLevel;
|
|
11
|
+
readonly PERFORMANCE: LogLevel;
|
|
12
|
+
readonly DEBUG: LogLevel;
|
|
13
|
+
readonly TRACE: LogLevel;
|
|
14
|
+
readonly ALL: LogLevel;
|
|
15
15
|
};
|
|
16
16
|
type LogLevelLabel = "silent" | "fatal" | "error" | "warn" | "success" | "info" | "performance" | "debug" | "trace" | "all";
|
|
17
17
|
declare const LogLevelLabel: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
readonly SILENT: LogLevelLabel;
|
|
19
|
+
readonly FATAL: LogLevelLabel;
|
|
20
|
+
readonly ERROR: LogLevelLabel;
|
|
21
|
+
readonly WARN: LogLevelLabel;
|
|
22
|
+
readonly SUCCESS: LogLevelLabel;
|
|
23
|
+
readonly INFO: LogLevelLabel;
|
|
24
|
+
readonly PERFORMANCE: LogLevelLabel;
|
|
25
|
+
readonly DEBUG: LogLevelLabel;
|
|
26
|
+
readonly TRACE: LogLevelLabel;
|
|
27
|
+
readonly ALL: LogLevelLabel;
|
|
28
28
|
};
|
|
29
29
|
type Logger = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
fatal: (message?: any) => void;
|
|
31
|
+
error: (message?: any) => void;
|
|
32
|
+
warning: (message?: any) => void;
|
|
33
|
+
info: (message?: any) => void;
|
|
34
|
+
success: (message?: any) => void;
|
|
35
|
+
performance: (message?: any) => void;
|
|
36
|
+
debug: (message?: any) => void;
|
|
37
|
+
trace: (message?: any) => void;
|
|
38
|
+
getStopwatch: (name: string) => () => void;
|
|
39
39
|
};
|
|
40
40
|
interface BaseTokenizerOptions {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
workspaceRoot?: string;
|
|
42
|
+
config?: StormWorkspaceConfig;
|
|
43
43
|
}
|
|
44
44
|
interface ProjectTokenizerOptions extends BaseTokenizerOptions {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
projectRoot?: string;
|
|
46
|
+
projectName?: string;
|
|
47
|
+
sourceRoot?: string;
|
|
48
48
|
}
|
|
49
|
-
type DeepPartial<T> = {
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export { type BaseTokenizerOptions, type DeepPartial, LogLevel, LogLevelLabel, type Logger, type ProjectTokenizerOptions };
|
|
49
|
+
type DeepPartial<T> = { [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]; };
|
|
50
|
+
//#endregion
|
|
51
|
+
export { BaseTokenizerOptions, DeepPartial, LogLevel, LogLevelLabel, Logger, ProjectTokenizerOptions };
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { StormWorkspaceConfig } from "@storm-software/config";
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
type LogLevel = 0 | 10 | 20 | 30 | 35 | 40 | 50 | 60 | 70 | 100;
|
|
6
|
+
declare const LogLevel: {
|
|
7
|
+
readonly SILENT: LogLevel;
|
|
8
|
+
readonly FATAL: LogLevel;
|
|
9
|
+
readonly ERROR: LogLevel;
|
|
10
|
+
readonly WARN: LogLevel;
|
|
11
|
+
readonly SUCCESS: LogLevel;
|
|
12
|
+
readonly INFO: LogLevel;
|
|
13
|
+
readonly PERFORMANCE: LogLevel;
|
|
14
|
+
readonly DEBUG: LogLevel;
|
|
15
|
+
readonly TRACE: LogLevel;
|
|
16
|
+
readonly ALL: LogLevel;
|
|
17
|
+
};
|
|
18
|
+
type LogLevelLabel = "silent" | "fatal" | "error" | "warn" | "success" | "info" | "performance" | "debug" | "trace" | "all";
|
|
19
|
+
declare const LogLevelLabel: {
|
|
20
|
+
readonly SILENT: LogLevelLabel;
|
|
21
|
+
readonly FATAL: LogLevelLabel;
|
|
22
|
+
readonly ERROR: LogLevelLabel;
|
|
23
|
+
readonly WARN: LogLevelLabel;
|
|
24
|
+
readonly SUCCESS: LogLevelLabel;
|
|
25
|
+
readonly INFO: LogLevelLabel;
|
|
26
|
+
readonly PERFORMANCE: LogLevelLabel;
|
|
27
|
+
readonly DEBUG: LogLevelLabel;
|
|
28
|
+
readonly TRACE: LogLevelLabel;
|
|
29
|
+
readonly ALL: LogLevelLabel;
|
|
30
|
+
};
|
|
31
|
+
type Logger = {
|
|
32
|
+
fatal: (message?: any) => void;
|
|
33
|
+
error: (message?: any) => void;
|
|
34
|
+
warning: (message?: any) => void;
|
|
35
|
+
info: (message?: any) => void;
|
|
36
|
+
success: (message?: any) => void;
|
|
37
|
+
performance: (message?: any) => void;
|
|
38
|
+
debug: (message?: any) => void;
|
|
39
|
+
trace: (message?: any) => void;
|
|
40
|
+
getStopwatch: (name: string) => () => void;
|
|
41
|
+
};
|
|
42
|
+
interface BaseTokenizerOptions {
|
|
43
|
+
workspaceRoot?: string;
|
|
44
|
+
config?: StormWorkspaceConfig;
|
|
45
|
+
}
|
|
46
|
+
interface ProjectTokenizerOptions extends BaseTokenizerOptions {
|
|
47
|
+
projectRoot?: string;
|
|
48
|
+
projectName?: string;
|
|
49
|
+
sourceRoot?: string;
|
|
50
|
+
}
|
|
51
|
+
type DeepPartial<T> = { [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]; };
|
|
52
|
+
//#endregion
|
|
53
|
+
export { BaseTokenizerOptions, DeepPartial, LogLevel, LogLevelLabel, Logger, ProjectTokenizerOptions };
|
package/dist/types.mjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
//#region src/types.ts
|
|
5
|
+
const LogLevel = {
|
|
6
|
+
SILENT: 0,
|
|
7
|
+
FATAL: 10,
|
|
8
|
+
ERROR: 20,
|
|
9
|
+
WARN: 30,
|
|
10
|
+
SUCCESS: 35,
|
|
11
|
+
INFO: 40,
|
|
12
|
+
PERFORMANCE: 50,
|
|
13
|
+
DEBUG: 60,
|
|
14
|
+
TRACE: 70,
|
|
15
|
+
ALL: 100
|
|
16
|
+
};
|
|
17
|
+
const LogLevelLabel = {
|
|
18
|
+
SILENT: "silent",
|
|
19
|
+
FATAL: "fatal",
|
|
20
|
+
ERROR: "error",
|
|
21
|
+
WARN: "warn",
|
|
22
|
+
SUCCESS: "success",
|
|
23
|
+
INFO: "info",
|
|
24
|
+
PERFORMANCE: "performance",
|
|
25
|
+
DEBUG: "debug",
|
|
26
|
+
TRACE: "trace",
|
|
27
|
+
ALL: "all"
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { LogLevel, LogLevelLabel };
|
|
@@ -1,13 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_utilities_find_workspace_root = require("./find-workspace-root.cjs");
|
|
3
|
+
//#region src/utilities/apply-workspace-tokens.ts
|
|
4
|
+
const applyWorkspaceBaseTokens = async (option, tokenParams) => {
|
|
5
|
+
let result = option;
|
|
6
|
+
if (!result) return result;
|
|
7
|
+
if (tokenParams) {
|
|
8
|
+
const optionKeys = Object.keys(tokenParams);
|
|
9
|
+
if (optionKeys.some((optionKey) => result.includes(`{${optionKey}}`))) {
|
|
10
|
+
for (const optionKey of optionKeys) if (result.includes(`{${optionKey}}`)) result = result.replaceAll(`{${optionKey}}`, tokenParams?.[optionKey] || "");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (tokenParams.config) {
|
|
14
|
+
const configKeys = Object.keys(tokenParams.config);
|
|
15
|
+
if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
|
|
16
|
+
for (const configKey of configKeys) if (result.includes(`{${configKey}}`)) result = result.replaceAll(`{${configKey}}`, tokenParams.config[configKey] || "");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (result.includes("{workspaceRoot}")) result = result.replaceAll("{workspaceRoot}", tokenParams.workspaceRoot ?? tokenParams.config?.workspaceRoot ?? require_utilities_find_workspace_root.findWorkspaceRoot());
|
|
20
|
+
return result;
|
|
21
|
+
};
|
|
22
|
+
const applyWorkspaceProjectTokens = (option, tokenParams) => {
|
|
23
|
+
return applyWorkspaceBaseTokens(option, tokenParams);
|
|
24
|
+
};
|
|
25
|
+
const applyWorkspaceTokens = async (options, tokenParams, tokenizerFn) => {
|
|
26
|
+
if (!options) return {};
|
|
27
|
+
const result = {};
|
|
28
|
+
for (const option of Object.keys(options)) if (typeof options[option] === "string") result[option] = await Promise.resolve(tokenizerFn(options[option], tokenParams));
|
|
29
|
+
else if (Array.isArray(options[option])) result[option] = await Promise.all(options[option].map(async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, tokenParams)) : item));
|
|
30
|
+
else if (typeof options[option] === "object") result[option] = await applyWorkspaceTokens(options[option], tokenParams, tokenizerFn);
|
|
31
|
+
else result[option] = options[option];
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
exports.applyWorkspaceBaseTokens = applyWorkspaceBaseTokens;
|
|
36
|
+
exports.applyWorkspaceProjectTokens = applyWorkspaceProjectTokens;
|
|
37
|
+
exports.applyWorkspaceTokens = applyWorkspaceTokens;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { BaseTokenizerOptions, ProjectTokenizerOptions } from
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { BaseTokenizerOptions, ProjectTokenizerOptions } from "../types.cjs";
|
|
2
|
+
//#region src/utilities/apply-workspace-tokens.d.ts
|
|
4
3
|
declare const applyWorkspaceBaseTokens: <TTokenizerOptions extends BaseTokenizerOptions = BaseTokenizerOptions>(option: string, tokenParams: TTokenizerOptions) => Promise<string>;
|
|
5
4
|
declare const applyWorkspaceProjectTokens: <TTokenizerOptions extends ProjectTokenizerOptions = ProjectTokenizerOptions>(option: string, tokenParams: TTokenizerOptions) => Promise<string>;
|
|
6
5
|
declare const applyWorkspaceTokens: <TTokenizerOptions extends BaseTokenizerOptions = BaseTokenizerOptions>(options: Record<string, any>, tokenParams: TTokenizerOptions, tokenizerFn: (option: string, tokenParams: TTokenizerOptions) => string | Promise<string>) => Promise<Record<string, any>>;
|
|
7
|
-
|
|
8
|
-
export { applyWorkspaceBaseTokens, applyWorkspaceProjectTokens, applyWorkspaceTokens };
|
|
6
|
+
//#endregion
|
|
7
|
+
export { applyWorkspaceBaseTokens, applyWorkspaceProjectTokens, applyWorkspaceTokens };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import '
|
|
3
|
-
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { BaseTokenizerOptions, ProjectTokenizerOptions } from "../types.mjs";
|
|
4
|
+
//#region src/utilities/apply-workspace-tokens.d.ts
|
|
4
5
|
declare const applyWorkspaceBaseTokens: <TTokenizerOptions extends BaseTokenizerOptions = BaseTokenizerOptions>(option: string, tokenParams: TTokenizerOptions) => Promise<string>;
|
|
5
6
|
declare const applyWorkspaceProjectTokens: <TTokenizerOptions extends ProjectTokenizerOptions = ProjectTokenizerOptions>(option: string, tokenParams: TTokenizerOptions) => Promise<string>;
|
|
6
7
|
declare const applyWorkspaceTokens: <TTokenizerOptions extends BaseTokenizerOptions = BaseTokenizerOptions>(options: Record<string, any>, tokenParams: TTokenizerOptions, tokenizerFn: (option: string, tokenParams: TTokenizerOptions) => string | Promise<string>) => Promise<Record<string, any>>;
|
|
7
|
-
|
|
8
|
-
export { applyWorkspaceBaseTokens, applyWorkspaceProjectTokens, applyWorkspaceTokens };
|
|
8
|
+
//#endregion
|
|
9
|
+
export { applyWorkspaceBaseTokens, applyWorkspaceProjectTokens, applyWorkspaceTokens };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { findWorkspaceRoot } from "./find-workspace-root.mjs";
|
|
5
|
+
//#region src/utilities/apply-workspace-tokens.ts
|
|
6
|
+
const applyWorkspaceBaseTokens = async (option, tokenParams) => {
|
|
7
|
+
let result = option;
|
|
8
|
+
if (!result) return result;
|
|
9
|
+
if (tokenParams) {
|
|
10
|
+
const optionKeys = Object.keys(tokenParams);
|
|
11
|
+
if (optionKeys.some((optionKey) => result.includes(`{${optionKey}}`))) {
|
|
12
|
+
for (const optionKey of optionKeys) if (result.includes(`{${optionKey}}`)) result = result.replaceAll(`{${optionKey}}`, tokenParams?.[optionKey] || "");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
if (tokenParams.config) {
|
|
16
|
+
const configKeys = Object.keys(tokenParams.config);
|
|
17
|
+
if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
|
|
18
|
+
for (const configKey of configKeys) if (result.includes(`{${configKey}}`)) result = result.replaceAll(`{${configKey}}`, tokenParams.config[configKey] || "");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (result.includes("{workspaceRoot}")) result = result.replaceAll("{workspaceRoot}", tokenParams.workspaceRoot ?? tokenParams.config?.workspaceRoot ?? findWorkspaceRoot());
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
const applyWorkspaceProjectTokens = (option, tokenParams) => {
|
|
25
|
+
return applyWorkspaceBaseTokens(option, tokenParams);
|
|
26
|
+
};
|
|
27
|
+
const applyWorkspaceTokens = async (options, tokenParams, tokenizerFn) => {
|
|
28
|
+
if (!options) return {};
|
|
29
|
+
const result = {};
|
|
30
|
+
for (const option of Object.keys(options)) if (typeof options[option] === "string") result[option] = await Promise.resolve(tokenizerFn(options[option], tokenParams));
|
|
31
|
+
else if (Array.isArray(options[option])) result[option] = await Promise.all(options[option].map(async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, tokenParams)) : item));
|
|
32
|
+
else if (typeof options[option] === "object") result[option] = await applyWorkspaceTokens(options[option], tokenParams, tokenizerFn);
|
|
33
|
+
else result[option] = options[option];
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { applyWorkspaceBaseTokens, applyWorkspaceProjectTokens, applyWorkspaceTokens };
|
|
@@ -1,12 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/utilities/colors.ts
|
|
3
|
+
/**
|
|
4
|
+
* Storm theme config values used for styling various workspace elements
|
|
5
|
+
*/
|
|
6
|
+
const DEFAULT_COLOR_CONFIG = {
|
|
7
|
+
light: {
|
|
8
|
+
background: "#fafafa",
|
|
9
|
+
foreground: "#1d1e22",
|
|
10
|
+
brand: "#1fb2a6",
|
|
11
|
+
alternate: "#db2777",
|
|
12
|
+
discovery: "#5C4EE5",
|
|
13
|
+
success: "#087f5b",
|
|
14
|
+
info: "#0550ae",
|
|
15
|
+
debug: "#8afafc",
|
|
16
|
+
warning: "#e3b341",
|
|
17
|
+
danger: "#D8314A",
|
|
18
|
+
fatal: "#51070f",
|
|
19
|
+
performance: "#13c302",
|
|
20
|
+
link: "#3fa6ff",
|
|
21
|
+
positive: "#22c55e",
|
|
22
|
+
negative: "#dc2626",
|
|
23
|
+
gradient: [
|
|
24
|
+
"#1fb2a6",
|
|
25
|
+
"#db2777",
|
|
26
|
+
"#5C4EE5"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
dark: {
|
|
30
|
+
background: "#1e2124",
|
|
31
|
+
foreground: "#cbd5e1",
|
|
32
|
+
brand: "#2dd4bf",
|
|
33
|
+
alternate: "#db2777",
|
|
34
|
+
discovery: "#818cf8",
|
|
35
|
+
success: "#10b981",
|
|
36
|
+
info: "#58a6ff",
|
|
37
|
+
debug: "#8afafc",
|
|
38
|
+
warning: "#f3d371",
|
|
39
|
+
danger: "#D8314A",
|
|
40
|
+
fatal: "#a40e26",
|
|
41
|
+
performance: "#80fd74",
|
|
42
|
+
link: "#3fa6ff",
|
|
43
|
+
positive: "#22c55e",
|
|
44
|
+
negative: "#dc2626",
|
|
45
|
+
gradient: [
|
|
46
|
+
"#1fb2a6",
|
|
47
|
+
"#db2777",
|
|
48
|
+
"#818cf8"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Get the color configuration from the Storm workspace configuration.
|
|
54
|
+
*
|
|
55
|
+
* @param config - An optional, partial color configuration for the Storm workspace.
|
|
56
|
+
* @returns The color configuration, or the default color configuration if not defined.
|
|
57
|
+
*/
|
|
58
|
+
function getColors(config) {
|
|
59
|
+
if (!config?.colors || typeof config.colors !== "object" || !config.colors["dark"] && (!config.colors["base"] || typeof config.colors !== "object" || !config.colors["base"]?.["dark"])) return DEFAULT_COLOR_CONFIG;
|
|
60
|
+
if (config.colors["base"]) {
|
|
61
|
+
if (typeof config.colors["base"]["dark"] === "object") return config.colors["base"]["dark"];
|
|
62
|
+
else if (config.colors["base"]["dark"] === "string") return config.colors["base"];
|
|
63
|
+
}
|
|
64
|
+
if (typeof config.colors["dark"] === "object") return config.colors["dark"];
|
|
65
|
+
return config.colors ?? DEFAULT_COLOR_CONFIG;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get a specific color from the Storm workspace configuration.
|
|
69
|
+
*
|
|
70
|
+
* @param key - The key of the color to retrieve.
|
|
71
|
+
* @param config - An optional, partial color configuration for the Storm workspace.
|
|
72
|
+
* @returns The color value for the specified key, or a default value if not defined.
|
|
73
|
+
*/
|
|
74
|
+
function getColor(key, config) {
|
|
75
|
+
const colors = getColors(config);
|
|
76
|
+
const result = (typeof colors["dark"] === "object" ? colors["dark"][key] : colors[key]) || DEFAULT_COLOR_CONFIG["dark"][key] || DEFAULT_COLOR_CONFIG[key];
|
|
77
|
+
if (result) return result;
|
|
78
|
+
if (key === "link" || key === "debug") return getColor("info", config);
|
|
79
|
+
else if (key === "fatal") return getColor("danger", config);
|
|
80
|
+
return getColor("brand", config);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Get a specific color from the Storm workspace configuration.
|
|
84
|
+
*
|
|
85
|
+
* @param key - The key of the color to retrieve.
|
|
86
|
+
* @param config - An optional, partial color configuration for the Storm workspace.
|
|
87
|
+
* @returns The color value for the specified key, or a default value if not defined.
|
|
88
|
+
*/
|
|
89
|
+
function getGradient(config) {
|
|
90
|
+
const colors = getColors(config);
|
|
91
|
+
const result = (typeof colors["dark"] === "object" ? colors["dark"].gradient : colors.gradient) || DEFAULT_COLOR_CONFIG["dark"].gradient;
|
|
92
|
+
if (result && Array.isArray(result) && result.length > 0) return result;
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
exports.DEFAULT_COLOR_CONFIG = DEFAULT_COLOR_CONFIG;
|
|
96
|
+
exports.getColor = getColor;
|
|
97
|
+
exports.getColors = getColors;
|
|
98
|
+
exports.getGradient = getGradient;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MultiThemeColors, StormWorkspaceConfig
|
|
2
|
-
|
|
1
|
+
import { Colors, MultiThemeColors, StormWorkspaceConfig } from "@storm-software/config/types";
|
|
2
|
+
//#region src/utilities/colors.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Storm theme config values used for styling various workspace elements
|
|
5
5
|
*/
|
|
@@ -27,5 +27,5 @@ declare function getColor(key: "background" | "foreground" | "brand" | "discover
|
|
|
27
27
|
* @returns The color value for the specified key, or a default value if not defined.
|
|
28
28
|
*/
|
|
29
29
|
declare function getGradient(config?: Partial<Pick<StormWorkspaceConfig, "colors">>): string[] | undefined;
|
|
30
|
-
|
|
31
|
-
export { DEFAULT_COLOR_CONFIG, getColor, getColors, getGradient };
|
|
30
|
+
//#endregion
|
|
31
|
+
export { DEFAULT_COLOR_CONFIG, getColor, getColors, getGradient };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { Colors, MultiThemeColors, StormWorkspaceConfig } from "@storm-software/config/types";
|
|
4
|
+
//#region src/utilities/colors.d.ts
|
|
3
5
|
/**
|
|
4
6
|
* Storm theme config values used for styling various workspace elements
|
|
5
7
|
*/
|
|
@@ -27,5 +29,5 @@ declare function getColor(key: "background" | "foreground" | "brand" | "discover
|
|
|
27
29
|
* @returns The color value for the specified key, or a default value if not defined.
|
|
28
30
|
*/
|
|
29
31
|
declare function getGradient(config?: Partial<Pick<StormWorkspaceConfig, "colors">>): string[] | undefined;
|
|
30
|
-
|
|
31
|
-
export { DEFAULT_COLOR_CONFIG, getColor, getColors, getGradient };
|
|
32
|
+
//#endregion
|
|
33
|
+
export { DEFAULT_COLOR_CONFIG, getColor, getColors, getGradient };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
//#region src/utilities/colors.ts
|
|
5
|
+
/**
|
|
6
|
+
* Storm theme config values used for styling various workspace elements
|
|
7
|
+
*/
|
|
8
|
+
const DEFAULT_COLOR_CONFIG = {
|
|
9
|
+
light: {
|
|
10
|
+
background: "#fafafa",
|
|
11
|
+
foreground: "#1d1e22",
|
|
12
|
+
brand: "#1fb2a6",
|
|
13
|
+
alternate: "#db2777",
|
|
14
|
+
discovery: "#5C4EE5",
|
|
15
|
+
success: "#087f5b",
|
|
16
|
+
info: "#0550ae",
|
|
17
|
+
debug: "#8afafc",
|
|
18
|
+
warning: "#e3b341",
|
|
19
|
+
danger: "#D8314A",
|
|
20
|
+
fatal: "#51070f",
|
|
21
|
+
performance: "#13c302",
|
|
22
|
+
link: "#3fa6ff",
|
|
23
|
+
positive: "#22c55e",
|
|
24
|
+
negative: "#dc2626",
|
|
25
|
+
gradient: [
|
|
26
|
+
"#1fb2a6",
|
|
27
|
+
"#db2777",
|
|
28
|
+
"#5C4EE5"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
dark: {
|
|
32
|
+
background: "#1e2124",
|
|
33
|
+
foreground: "#cbd5e1",
|
|
34
|
+
brand: "#2dd4bf",
|
|
35
|
+
alternate: "#db2777",
|
|
36
|
+
discovery: "#818cf8",
|
|
37
|
+
success: "#10b981",
|
|
38
|
+
info: "#58a6ff",
|
|
39
|
+
debug: "#8afafc",
|
|
40
|
+
warning: "#f3d371",
|
|
41
|
+
danger: "#D8314A",
|
|
42
|
+
fatal: "#a40e26",
|
|
43
|
+
performance: "#80fd74",
|
|
44
|
+
link: "#3fa6ff",
|
|
45
|
+
positive: "#22c55e",
|
|
46
|
+
negative: "#dc2626",
|
|
47
|
+
gradient: [
|
|
48
|
+
"#1fb2a6",
|
|
49
|
+
"#db2777",
|
|
50
|
+
"#818cf8"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Get the color configuration from the Storm workspace configuration.
|
|
56
|
+
*
|
|
57
|
+
* @param config - An optional, partial color configuration for the Storm workspace.
|
|
58
|
+
* @returns The color configuration, or the default color configuration if not defined.
|
|
59
|
+
*/
|
|
60
|
+
function getColors(config) {
|
|
61
|
+
if (!config?.colors || typeof config.colors !== "object" || !config.colors["dark"] && (!config.colors["base"] || typeof config.colors !== "object" || !config.colors["base"]?.["dark"])) return DEFAULT_COLOR_CONFIG;
|
|
62
|
+
if (config.colors["base"]) {
|
|
63
|
+
if (typeof config.colors["base"]["dark"] === "object") return config.colors["base"]["dark"];
|
|
64
|
+
else if (config.colors["base"]["dark"] === "string") return config.colors["base"];
|
|
65
|
+
}
|
|
66
|
+
if (typeof config.colors["dark"] === "object") return config.colors["dark"];
|
|
67
|
+
return config.colors ?? DEFAULT_COLOR_CONFIG;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Get a specific color from the Storm workspace configuration.
|
|
71
|
+
*
|
|
72
|
+
* @param key - The key of the color to retrieve.
|
|
73
|
+
* @param config - An optional, partial color configuration for the Storm workspace.
|
|
74
|
+
* @returns The color value for the specified key, or a default value if not defined.
|
|
75
|
+
*/
|
|
76
|
+
function getColor(key, config) {
|
|
77
|
+
const colors = getColors(config);
|
|
78
|
+
const result = (typeof colors["dark"] === "object" ? colors["dark"][key] : colors[key]) || DEFAULT_COLOR_CONFIG["dark"][key] || DEFAULT_COLOR_CONFIG[key];
|
|
79
|
+
if (result) return result;
|
|
80
|
+
if (key === "link" || key === "debug") return getColor("info", config);
|
|
81
|
+
else if (key === "fatal") return getColor("danger", config);
|
|
82
|
+
return getColor("brand", config);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Get a specific color from the Storm workspace configuration.
|
|
86
|
+
*
|
|
87
|
+
* @param key - The key of the color to retrieve.
|
|
88
|
+
* @param config - An optional, partial color configuration for the Storm workspace.
|
|
89
|
+
* @returns The color value for the specified key, or a default value if not defined.
|
|
90
|
+
*/
|
|
91
|
+
function getGradient(config) {
|
|
92
|
+
const colors = getColors(config);
|
|
93
|
+
const result = (typeof colors["dark"] === "object" ? colors["dark"].gradient : colors.gradient) || DEFAULT_COLOR_CONFIG["dark"].gradient;
|
|
94
|
+
if (result && Array.isArray(result) && result.length > 0) return result;
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
export { DEFAULT_COLOR_CONFIG, getColor, getColors, getGradient };
|