@udixio/theme 1.3.0 → 2.0.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/CHANGELOG.md +15 -0
- package/dist/API.d.ts +7 -4
- package/dist/API.d.ts.map +1 -1
- package/dist/app.container.d.ts +1 -2
- package/dist/app.container.d.ts.map +1 -1
- package/dist/bin.cjs +1 -1
- package/dist/bin.js +1 -1
- package/dist/browser.cjs +22 -18
- package/dist/browser.js +32 -28
- package/dist/color/color.api.d.ts +11 -30
- package/dist/color/color.api.d.ts.map +1 -1
- package/dist/color/color.d.ts +99 -0
- package/dist/color/color.d.ts.map +1 -0
- package/dist/color/color.manager.d.ts +9 -17
- package/dist/color/color.manager.d.ts.map +1 -1
- package/dist/color/color.utils.d.ts +14 -3
- package/dist/color/color.utils.d.ts.map +1 -1
- package/dist/color/default-color.d.ts.map +1 -1
- package/dist/color/index.d.ts +1 -1
- package/dist/color/index.d.ts.map +1 -1
- package/dist/config/config.interface.d.ts +4 -4
- package/dist/config/config.interface.d.ts.map +1 -1
- package/dist/context/context.d.ts +41 -0
- package/dist/context/context.d.ts.map +1 -0
- package/dist/context/context.module.d.ts +3 -0
- package/dist/context/context.module.d.ts.map +1 -0
- package/dist/context/index.d.ts +3 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/font.plugin-BZ-TTeTo.cjs +227 -0
- package/dist/font.plugin-DZtMajJV.js +228 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/{load-from-path-BuN8RpOs.cjs → load-from-path-DZ35yiXK.cjs} +2 -2
- package/dist/{load-from-path-BSrT4DOj.js → load-from-path-Dobe0beV.js} +1 -1
- package/dist/loader/loader.d.ts +1 -1
- package/dist/loader/loader.d.ts.map +1 -1
- package/dist/{loader-Bc0bstAD.js → loader-BS_Esfwg.js} +1408 -905
- package/dist/{loader-YNN5hAF3.cjs → loader-C8LnOoqg.cjs} +1392 -889
- package/dist/material-color-utilities/dynamic_color.d.ts +0 -22
- package/dist/material-color-utilities/dynamic_color.d.ts.map +1 -1
- package/dist/material-color-utilities/toneDeltaPair.d.ts +8 -8
- package/dist/material-color-utilities/toneDeltaPair.d.ts.map +1 -1
- package/dist/node.cjs +23 -19
- package/dist/node.js +34 -30
- package/dist/palette/index.d.ts +4 -0
- package/dist/palette/index.d.ts.map +1 -0
- package/dist/palette/palette.api.d.ts +13 -0
- package/dist/palette/palette.api.d.ts.map +1 -0
- package/dist/palette/palette.d.ts +33 -0
- package/dist/palette/palette.d.ts.map +1 -0
- package/dist/palette/palette.manager.d.ts +20 -0
- package/dist/palette/palette.manager.d.ts.map +1 -0
- package/dist/palette/palette.module.d.ts +3 -0
- package/dist/palette/palette.module.d.ts.map +1 -0
- package/dist/plugins/font/font.plugin.d.ts +1 -1
- package/dist/plugins/font/font.plugin.d.ts.map +1 -1
- package/dist/variant/index.d.ts +3 -0
- package/dist/variant/index.d.ts.map +1 -0
- package/dist/variant/variant.d.ts +29 -0
- package/dist/variant/variant.d.ts.map +1 -0
- package/dist/variant/variants/expressive.variant.d.ts +2 -0
- package/dist/variant/variants/expressive.variant.d.ts.map +1 -0
- package/dist/variant/variants/fidelity.variant.d.ts.map +1 -0
- package/dist/variant/variants/index.d.ts.map +1 -0
- package/dist/variant/variants/neutral.variant.d.ts.map +1 -0
- package/dist/variant/variants/tonal-spot.variant.d.ts.map +1 -0
- package/dist/variant/variants/vibrant.variant.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/API.ts +12 -5
- package/src/app.container.ts +22 -11
- package/src/bootstrap.ts +1 -1
- package/src/color/color.api.ts +168 -47
- package/src/color/color.manager.ts +38 -181
- package/src/color/color.ts +291 -0
- package/src/color/color.utils.ts +48 -3
- package/src/color/default-color.ts +395 -396
- package/src/color/index.ts +1 -1
- package/src/config/config.interface.ts +5 -4
- package/src/context/context.module.ts +7 -0
- package/src/context/context.ts +169 -0
- package/src/context/index.ts +2 -0
- package/src/index.ts +6 -4
- package/src/loader/loader.ts +14 -23
- package/src/material-color-utilities/dynamic_color.ts +25 -34
- package/src/material-color-utilities/toneDeltaPair.ts +44 -41
- package/src/palette/index.ts +3 -0
- package/src/palette/palette.api.ts +43 -0
- package/src/palette/palette.manager.ts +74 -0
- package/src/palette/palette.module.ts +9 -0
- package/src/palette/palette.ts +207 -0
- package/src/plugins/font/font.plugin.ts +1 -1
- package/src/variant/index.ts +2 -0
- package/src/variant/variant.ts +81 -0
- package/src/{theme → variant}/variants/expressive.variant.ts +31 -29
- package/src/variant/variants/fidelity.variant.ts +46 -0
- package/src/{theme → variant}/variants/neutral.variant.ts +18 -18
- package/src/variant/variants/tonal-spot.variant.ts +35 -0
- package/src/{theme → variant}/variants/vibrant.variant.ts +21 -22
- package/dist/color/configurable-color.d.ts +0 -31
- package/dist/color/configurable-color.d.ts.map +0 -1
- package/dist/define-config-B1QPKKY_.js +0 -430
- package/dist/define-config-BGgVazsr.cjs +0 -429
- package/dist/theme/index.d.ts +0 -8
- package/dist/theme/index.d.ts.map +0 -1
- package/dist/theme/scheme.d.ts +0 -20
- package/dist/theme/scheme.d.ts.map +0 -1
- package/dist/theme/scheme.manager.d.ts +0 -31
- package/dist/theme/scheme.manager.d.ts.map +0 -1
- package/dist/theme/theme.api.d.ts +0 -23
- package/dist/theme/theme.api.d.ts.map +0 -1
- package/dist/theme/theme.module.d.ts +0 -3
- package/dist/theme/theme.module.d.ts.map +0 -1
- package/dist/theme/variant.d.ts +0 -36
- package/dist/theme/variant.d.ts.map +0 -1
- package/dist/theme/variant.manager.d.ts +0 -14
- package/dist/theme/variant.manager.d.ts.map +0 -1
- package/dist/theme/variants/expressive.variant.d.ts +0 -3
- package/dist/theme/variants/expressive.variant.d.ts.map +0 -1
- package/dist/theme/variants/fidelity.variant.d.ts.map +0 -1
- package/dist/theme/variants/index.d.ts.map +0 -1
- package/dist/theme/variants/neutral.variant.d.ts.map +0 -1
- package/dist/theme/variants/tonal-spot.variant.d.ts.map +0 -1
- package/dist/theme/variants/vibrant.variant.d.ts.map +0 -1
- package/src/color/configurable-color.ts +0 -67
- package/src/theme/index.ts +0 -7
- package/src/theme/scheme.manager.ts +0 -100
- package/src/theme/scheme.ts +0 -66
- package/src/theme/theme.api.ts +0 -78
- package/src/theme/theme.module.ts +0 -11
- package/src/theme/variant.manager.ts +0 -58
- package/src/theme/variant.ts +0 -53
- package/src/theme/variants/fidelity.variant.ts +0 -38
- package/src/theme/variants/tonal-spot.variant.ts +0 -35
- /package/dist/{theme → variant}/variants/fidelity.variant.d.ts +0 -0
- /package/dist/{theme → variant}/variants/index.d.ts +0 -0
- /package/dist/{theme → variant}/variants/neutral.variant.d.ts +0 -0
- /package/dist/{theme → variant}/variants/tonal-spot.variant.d.ts +0 -0
- /package/dist/{theme → variant}/variants/vibrant.variant.d.ts +0 -0
- /package/src/{theme → variant}/variants/index.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# 2.0.0 (2025-10-15)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **theme:** add tone adjustment calculation and improve contrast handling ([3546f05](https://github.com/Udixio/UI/commit/3546f05))
|
|
6
|
+
- **theme:** enhance TokenGallery with palette integration and improved color grouping ([fdce7c7](https://github.com/Udixio/UI/commit/fdce7c7))
|
|
7
|
+
- **theme:** modularize and refactor TokenGallery with new components ([9312297](https://github.com/Udixio/UI/commit/9312297))
|
|
8
|
+
- **theme:** add success color tokens and extend color configuration ([852cd6c](https://github.com/Udixio/UI/commit/852cd6c))
|
|
9
|
+
- **theme:** refactor color utilities and update configuration ([177e68d](https://github.com/Udixio/UI/commit/177e68d))
|
|
10
|
+
- **theme:** streamline color management and refactor configuration ([b1b1211](https://github.com/Udixio/UI/commit/b1b1211))
|
|
11
|
+
|
|
12
|
+
### ❤️ Thank You
|
|
13
|
+
|
|
14
|
+
- Joël VIGREUX
|
|
15
|
+
|
|
1
16
|
## 1.3.0 (2025-09-04)
|
|
2
17
|
|
|
3
18
|
### 🚀 Features
|
package/dist/API.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { ColorApi } from './color';
|
|
2
|
-
import { ThemeApi } from './theme';
|
|
3
2
|
import { PluginApi } from './plugin';
|
|
3
|
+
import { Context } from './context';
|
|
4
|
+
import { PaletteApi } from './palette/palette.api';
|
|
4
5
|
export declare class API {
|
|
5
6
|
colors: ColorApi;
|
|
6
|
-
themes: ThemeApi;
|
|
7
7
|
plugins: PluginApi;
|
|
8
|
-
|
|
8
|
+
context: Context;
|
|
9
|
+
palettes: PaletteApi;
|
|
10
|
+
constructor({ colorApi, pluginApi, context, paletteApi, }: {
|
|
9
11
|
colorApi: ColorApi;
|
|
10
|
-
themeApi: ThemeApi;
|
|
11
12
|
pluginApi: PluginApi;
|
|
13
|
+
paletteApi: PaletteApi;
|
|
14
|
+
context: Context;
|
|
12
15
|
});
|
|
13
16
|
load(): Promise<void>;
|
|
14
17
|
}
|
package/dist/API.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"API.d.ts","sourceRoot":"","sources":["../src/API.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"API.d.ts","sourceRoot":"","sources":["../src/API.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,qBAAa,GAAG;IACP,MAAM,EAAE,QAAQ,CAAC;IACjB,OAAO,EAAE,SAAS,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,UAAU,CAAC;gBAEhB,EACV,QAAQ,EACR,SAAS,EACT,OAAO,EACP,UAAU,GACX,EAAE;QACD,QAAQ,EAAE,QAAQ,CAAC;QACnB,SAAS,EAAE,SAAS,CAAC;QACrB,UAAU,EAAE,UAAU,CAAC;QACvB,OAAO,EAAE,OAAO,CAAC;KAClB;IASK,IAAI;CAGX"}
|
package/dist/app.container.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Resolver } from 'awilix';
|
|
2
2
|
export type Module = Record<string, Resolver<any>>;
|
|
3
|
-
export declare
|
|
4
|
-
export declare const AppContainer: import('awilix').AwilixContainer<any>;
|
|
3
|
+
export declare const AppContainer: () => import('awilix').AwilixContainer<any>;
|
|
5
4
|
//# sourceMappingURL=app.container.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.container.d.ts","sourceRoot":"","sources":["../src/app.container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,QAAQ,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"app.container.d.ts","sourceRoot":"","sources":["../src/app.container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAOlE,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AAEnD,eAAO,MAAM,YAAY,6CAuBxB,CAAC"}
|
package/dist/bin.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const commander = require("commander");
|
|
3
3
|
const chokidar = require("chokidar");
|
|
4
4
|
const chalk = require("chalk");
|
|
5
|
-
const loadFromPath = require("./load-from-path-
|
|
5
|
+
const loadFromPath = require("./load-from-path-DZ35yiXK.cjs");
|
|
6
6
|
const program = new commander.Command();
|
|
7
7
|
async function runOnce(configPath) {
|
|
8
8
|
try {
|
package/dist/bin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import chokidar from "chokidar";
|
|
3
3
|
import chalk from "chalk";
|
|
4
|
-
import { l as loadFromPath } from "./load-from-path-
|
|
4
|
+
import { l as loadFromPath } from "./load-from-path-Dobe0beV.js";
|
|
5
5
|
const program = new Command();
|
|
6
6
|
async function runOnce(configPath) {
|
|
7
7
|
try {
|
package/dist/browser.cjs
CHANGED
|
@@ -1,39 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const loader = require("./loader-
|
|
4
|
-
const
|
|
3
|
+
const loader = require("./loader-C8LnOoqg.cjs");
|
|
4
|
+
const font_plugin = require("./font.plugin-BZ-TTeTo.cjs");
|
|
5
5
|
exports.API = loader.API;
|
|
6
6
|
exports.AppContainer = loader.AppContainer;
|
|
7
7
|
exports.AppModule = loader.AppModule;
|
|
8
|
+
exports.Color = loader.Color;
|
|
9
|
+
exports.ColorAlias = loader.ColorAlias;
|
|
8
10
|
exports.ColorApi = loader.ColorApi;
|
|
11
|
+
exports.ColorFromHex = loader.ColorFromHex;
|
|
12
|
+
exports.ColorFromPalette = loader.ColorFromPalette;
|
|
9
13
|
exports.ColorManager = loader.ColorManager;
|
|
10
14
|
exports.ColorModule = loader.ColorModule;
|
|
11
|
-
exports.
|
|
15
|
+
exports.Context = loader.Context;
|
|
16
|
+
exports.ContextModule = loader.ContextModule;
|
|
12
17
|
exports.ContrastCurve = loader.ContrastCurve;
|
|
13
18
|
exports.DynamicColor = loader.DynamicColor;
|
|
19
|
+
exports.Palette = loader.Palette;
|
|
20
|
+
exports.PaletteApi = loader.PaletteApi;
|
|
21
|
+
exports.PaletteModule = loader.PaletteModule;
|
|
14
22
|
exports.PluginApi = loader.PluginApi;
|
|
15
23
|
exports.PluginModule = loader.PluginModule;
|
|
16
|
-
exports.Scheme = loader.Scheme;
|
|
17
|
-
exports.SchemeManager = loader.SchemeManager;
|
|
18
|
-
exports.ThemeApi = loader.ThemeApi;
|
|
19
|
-
exports.ThemeModule = loader.ThemeModule;
|
|
20
24
|
exports.Variant = loader.Variant;
|
|
21
|
-
exports.
|
|
25
|
+
exports.Variants = loader.Variants;
|
|
22
26
|
exports.bootstrap = loader.bootstrap;
|
|
23
27
|
exports.defaultColors = loader.defaultColors;
|
|
28
|
+
exports.expressiveVariant = loader.expressiveVariant;
|
|
29
|
+
exports.getInitialToneFromBackground = loader.getInitialToneFromBackground;
|
|
24
30
|
exports.getPiecewiseHue = loader.getPiecewiseHue;
|
|
25
31
|
exports.getRotatedHue = loader.getRotatedHue;
|
|
26
32
|
exports.highestSurface = loader.highestSurface;
|
|
27
33
|
exports.loader = loader.loader;
|
|
28
|
-
exports.
|
|
34
|
+
exports.neutralVariant = loader.neutralVariant;
|
|
29
35
|
exports.tonalSpotVariant = loader.tonalSpotVariant;
|
|
30
36
|
exports.toneDeltaPair = loader.toneDeltaPair;
|
|
31
|
-
exports.
|
|
32
|
-
exports.
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
exports.neutralVariant = defineConfig.neutralVariant;
|
|
39
|
-
exports.vibrantVariant = defineConfig.vibrantVariant;
|
|
37
|
+
exports.variant = loader.variant;
|
|
38
|
+
exports.vibrantVariant = loader.vibrantVariant;
|
|
39
|
+
exports.FontFamily = font_plugin.FontFamily;
|
|
40
|
+
exports.FontPlugin = font_plugin.FontPlugin;
|
|
41
|
+
exports.PluginAbstract = font_plugin.PluginAbstract;
|
|
42
|
+
exports.PluginImplAbstract = font_plugin.PluginImplAbstract;
|
|
43
|
+
exports.defineConfig = font_plugin.defineConfig;
|
package/dist/browser.js
CHANGED
|
@@ -1,39 +1,43 @@
|
|
|
1
|
-
import { b,
|
|
2
|
-
import { F, b as b2, P as P2, a as a2,
|
|
1
|
+
import { A, a, b, f, i, C, j, k, d, e, n, m, p, D, P, q, r, u, s, V, y, c, l, E, g, v, w, h, o, F, z, t, x, B } from "./loader-BS_Esfwg.js";
|
|
2
|
+
import { F as F2, b as b2, P as P2, a as a2, d as d2 } from "./font.plugin-DZtMajJV.js";
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
A as API,
|
|
5
|
+
a as AppContainer,
|
|
6
|
+
b as AppModule,
|
|
7
|
+
f as Color,
|
|
8
|
+
i as ColorAlias,
|
|
7
9
|
C as ColorApi,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
j as ColorFromHex,
|
|
11
|
+
k as ColorFromPalette,
|
|
12
|
+
d as ColorManager,
|
|
13
|
+
e as ColorModule,
|
|
14
|
+
n as Context,
|
|
15
|
+
m as ContextModule,
|
|
16
|
+
p as ContrastCurve,
|
|
12
17
|
D as DynamicColor,
|
|
13
|
-
|
|
18
|
+
F2 as FontFamily,
|
|
14
19
|
b2 as FontPlugin,
|
|
20
|
+
P as Palette,
|
|
21
|
+
q as PaletteApi,
|
|
22
|
+
r as PaletteModule,
|
|
15
23
|
P2 as PluginAbstract,
|
|
16
|
-
|
|
24
|
+
u as PluginApi,
|
|
17
25
|
a2 as PluginImplAbstract,
|
|
18
|
-
|
|
19
|
-
m as Scheme,
|
|
20
|
-
S as SchemeManager,
|
|
21
|
-
n as ThemeApi,
|
|
22
|
-
T as ThemeModule,
|
|
26
|
+
s as PluginModule,
|
|
23
27
|
V as Variant,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
f as defaultColors,
|
|
28
|
+
y as Variants,
|
|
29
|
+
c as bootstrap,
|
|
30
|
+
l as defaultColors,
|
|
28
31
|
d2 as defineConfig,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
E as expressiveVariant,
|
|
33
|
+
g as getInitialToneFromBackground,
|
|
34
|
+
v as getPiecewiseHue,
|
|
35
|
+
w as getRotatedHue,
|
|
32
36
|
h as highestSurface,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
k as tonalSpotVariant,
|
|
37
|
+
o as loader,
|
|
38
|
+
F as neutralVariant,
|
|
39
|
+
z as tonalSpotVariant,
|
|
37
40
|
t as toneDeltaPair,
|
|
38
|
-
|
|
41
|
+
x as variant,
|
|
42
|
+
B as vibrantVariant
|
|
39
43
|
};
|
|
@@ -1,39 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Color, ColorOptions } from './color';
|
|
2
2
|
import { ColorManager } from './color.manager';
|
|
3
3
|
import { DynamicColorKey } from './color.utils';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
alias?: never;
|
|
7
|
-
}) | {
|
|
8
|
-
alias: string;
|
|
9
|
-
palette?: never;
|
|
10
|
-
tone?: never;
|
|
11
|
-
}>;
|
|
12
|
-
fromPalettes?: string[] | string;
|
|
13
|
-
};
|
|
14
|
-
export type AddColorsOptions = AddColors | ((colorService: ColorApi) => AddColors);
|
|
4
|
+
import { API } from '../API';
|
|
5
|
+
export type AddColorsOptions = ((args: API) => Record<string, ColorOptions>) | Record<string, ColorOptions>;
|
|
15
6
|
export declare class ColorApi {
|
|
16
7
|
private readonly colorManager;
|
|
8
|
+
api?: API;
|
|
17
9
|
constructor({ colorManager }: {
|
|
18
10
|
colorManager: ColorManager;
|
|
19
11
|
});
|
|
20
|
-
|
|
21
|
-
addColor(key: string, color:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}): ConfigurableColor;
|
|
28
|
-
addColors(args: AddColorsOptions | AddColorsOptions[]): void;
|
|
29
|
-
getColor(key: DynamicColorKey | string): ConfigurableColor;
|
|
30
|
-
removeColor(key: string): boolean;
|
|
31
|
-
updateColor(key: string, newColor: (Partial<ColorOptions> & {
|
|
32
|
-
alias?: never;
|
|
33
|
-
}) | {
|
|
34
|
-
alias: string;
|
|
35
|
-
palette?: never;
|
|
36
|
-
tone?: never;
|
|
37
|
-
}): ConfigurableColor;
|
|
12
|
+
getAll(): ReadonlyMap<string, Color>;
|
|
13
|
+
addColor(key: string, color: ColorOptions): Color;
|
|
14
|
+
addColors(args: AddColorsOptions): void;
|
|
15
|
+
get(key: DynamicColorKey | string): Color;
|
|
16
|
+
remove(key: string): boolean;
|
|
17
|
+
update(key: string, newColor: ColorOptions): Color;
|
|
18
|
+
addFromCustomPalette(key: string): void;
|
|
38
19
|
}
|
|
39
20
|
//# sourceMappingURL=color.api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.api.d.ts","sourceRoot":"","sources":["../../src/color/color.api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"color.api.d.ts","sourceRoot":"","sources":["../../src/color/color.api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAkB,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAA0B,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAO7B,MAAM,MAAM,gBAAgB,GACxB,CAAC,CAAC,IAAI,EAAE,GAAG,KAAK,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,GAC7C,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAEjC,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IACrC,GAAG,CAAC,EAAE,GAAG,CAAC;gBAEL,EAAE,YAAY,EAAE,EAAE;QAAE,YAAY,EAAE,YAAY,CAAA;KAAE;IAI5D,MAAM;IAIN,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,KAAK;IAIjD,SAAS,CAAC,IAAI,EAAE,gBAAgB;IAgBhC,GAAG,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,GAAG,KAAK;IAIzC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI5B,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,KAAK;IAIlD,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAyIxC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ContrastCurve } from '../material-color-utilities';
|
|
2
|
+
import { Hct } from '../material-color-utilities/htc';
|
|
3
|
+
import { ColorManager } from './color.manager';
|
|
4
|
+
import { Palette } from '../palette/palette';
|
|
5
|
+
import { Context } from 'src/context';
|
|
6
|
+
export type ColorOptions = FromPaletteOptions | {
|
|
7
|
+
hex: string;
|
|
8
|
+
} | {
|
|
9
|
+
alias: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function getInitialToneFromBackground(background?: Color): number;
|
|
12
|
+
export declare abstract class Color {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
abstract getHct(): Hct;
|
|
15
|
+
protected constructor(name: string);
|
|
16
|
+
getHex(): string;
|
|
17
|
+
getArgb(): number;
|
|
18
|
+
getRgb(): {
|
|
19
|
+
r: number;
|
|
20
|
+
g: number;
|
|
21
|
+
b: number;
|
|
22
|
+
};
|
|
23
|
+
getTone(): number;
|
|
24
|
+
}
|
|
25
|
+
export declare class ColorAlias extends Color {
|
|
26
|
+
as: string;
|
|
27
|
+
colorService: ColorManager;
|
|
28
|
+
getHct(): Hct;
|
|
29
|
+
constructor(name: string, as: string, colorService: ColorManager);
|
|
30
|
+
color(): ColorFromPalette;
|
|
31
|
+
}
|
|
32
|
+
export declare class ColorFromHex extends Color {
|
|
33
|
+
private _hex;
|
|
34
|
+
getHct(): Hct;
|
|
35
|
+
getHex(): string;
|
|
36
|
+
setHex(hex: string): void;
|
|
37
|
+
constructor(name: string, _hex: string);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @param name The name of the dynamic color. Defaults to empty.
|
|
41
|
+
* @param palette Function that provides a TonalPalette given DynamicScheme. A
|
|
42
|
+
* TonalPalette is defined by a hue and chroma, so this replaces the need to
|
|
43
|
+
* specify hue/chroma. By providing a tonal palette, when contrast
|
|
44
|
+
* adjustments are made, intended chroma can be preserved.
|
|
45
|
+
* @param tone Function that provides a tone given DynamicScheme. When not
|
|
46
|
+
* provided, the tone is same as the background tone or 50, when no
|
|
47
|
+
* background is provided.
|
|
48
|
+
* @param chromaMultiplier A factor that multiplies the chroma for this color.
|
|
49
|
+
* Default to 1.
|
|
50
|
+
* @param isBackground Whether this dynamic color is a background, with some
|
|
51
|
+
* other color as the foreground. Defaults to false.
|
|
52
|
+
* @param background The background of the dynamic color (as a function of a
|
|
53
|
+
* `DynamicScheme`), if it exists.
|
|
54
|
+
* @param secondBackground A second background of the dynamic color (as a
|
|
55
|
+
* function of a `DynamicScheme`), if it exists.
|
|
56
|
+
* @param contrastCurve A `ContrastCurve` object specifying how its contrast
|
|
57
|
+
* against its background should behave in various contrast levels options.
|
|
58
|
+
* Must used together with `background`. When not provided or resolved as
|
|
59
|
+
* undefined, the contrast curve is calculated based on other constraints.
|
|
60
|
+
* @param adjustTone A `AdjustTone` object specifying a tone delta
|
|
61
|
+
* constraint between two colors. One of them must be the color being
|
|
62
|
+
* constructed. When not provided or resolved as undefined, the tone is
|
|
63
|
+
* calculated based on other constraints.
|
|
64
|
+
*/
|
|
65
|
+
export type FromPaletteOptions = {
|
|
66
|
+
palette: () => Palette;
|
|
67
|
+
tone?: () => number;
|
|
68
|
+
chromaMultiplier?: () => number | undefined;
|
|
69
|
+
isBackground?: boolean;
|
|
70
|
+
background?: () => Color | undefined;
|
|
71
|
+
secondBackground?: () => Color | undefined;
|
|
72
|
+
contrastCurve?: () => ContrastCurve | undefined;
|
|
73
|
+
adjustTone?: () => AdjustTone | undefined;
|
|
74
|
+
};
|
|
75
|
+
export type FromPalette = {
|
|
76
|
+
palette: Palette;
|
|
77
|
+
tone: number;
|
|
78
|
+
chromaMultiplier: number;
|
|
79
|
+
isBackground?: boolean;
|
|
80
|
+
background?: Color;
|
|
81
|
+
secondBackground?: Color;
|
|
82
|
+
contrastCurve?: ContrastCurve;
|
|
83
|
+
adjustTone?: AdjustTone;
|
|
84
|
+
};
|
|
85
|
+
export type AdjustTone = (args: {
|
|
86
|
+
context: Context;
|
|
87
|
+
color: Color;
|
|
88
|
+
}) => number;
|
|
89
|
+
export declare class ColorFromPalette extends Color {
|
|
90
|
+
private _options;
|
|
91
|
+
private context;
|
|
92
|
+
get options(): FromPalette;
|
|
93
|
+
constructor(name: string, _options: FromPaletteOptions, context: Context);
|
|
94
|
+
update(args: Partial<ColorOptions>): void;
|
|
95
|
+
validateOption(): void;
|
|
96
|
+
getHct(): Hct;
|
|
97
|
+
getTone(): number;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/color/color.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAgB,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,MAAM,YAAY,GACpB,kBAAkB,GAClB;IACE,GAAG,EAAE,MAAM,CAAC;CACb,GACD;IACE,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAUN,wBAAgB,4BAA4B,CAAC,UAAU,CAAC,EAAE,KAAK,GAAG,MAAM,CAKvE;AAED,8BAAsB,KAAK;aAGa,IAAI,EAAE,MAAM;IAFlD,QAAQ,CAAC,MAAM,IAAI,GAAG;IAEtB,SAAS,aAA6B,IAAI,EAAE,MAAM;IAElD,MAAM,IAAI,MAAM;IAIhB,OAAO;IAIP,MAAM;WA5B+B,MAAM;WAAK,MAAM;WAAK,MAAM;;IA+BjE,OAAO,IAAI,MAAM;CAGlB;AAED,qBAAa,UAAW,SAAQ,KAAK;IAO1B,EAAE,EAAE,MAAM;IACV,YAAY,EAAE,YAAY;IAPnC,MAAM,IAAI,GAAG;gBAKX,IAAI,EAAE,MAAM,EACL,EAAE,EAAE,MAAM,EACV,YAAY,EAAE,YAAY;IAKnC,KAAK,IACsC,gBAAgB;CAE5D;AAED,qBAAa,YAAa,SAAQ,KAAK;IAenC,OAAO,CAAC,IAAI;IAdd,MAAM,IAAI,GAAG;IAIJ,MAAM,IAAI,MAAM;IAIzB,MAAM,CAAC,GAAG,EAAE,MAAM;gBAKhB,IAAI,EAAE,MAAM,EACJ,IAAI,EAAE,MAAM;CAKvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAC5C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,KAAK,GAAG,SAAS,CAAC;IACrC,gBAAgB,CAAC,EAAE,MAAM,KAAK,GAAG,SAAS,CAAC;IAC3C,aAAa,CAAC,EAAE,MAAM,aAAa,GAAG,SAAS,CAAC;IAChD,UAAU,CAAC,EAAE,MAAM,UAAU,GAAG,SAAS,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,gBAAgB,CAAC,EAAE,KAAK,CAAC;IACzB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,KAAK,MAAM,CAAC;AAE9E,qBAAa,gBAAiB,SAAQ,KAAK;IAsBvC,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,OAAO;IAtBjB,IAAI,OAAO,IAAI,WAAW,CAiBzB;gBAGC,IAAI,EAAE,MAAM,EACJ,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,OAAO;IAM1B,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC;IAKlC,cAAc;IAwBd,MAAM,IAAI,GAAG;IAUJ,OAAO,IAAI,MAAM;CA2E3B"}
|
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Scheme, SchemeManager } from '../theme';
|
|
3
|
-
import { ColorOptions, ConfigurableColor } from './configurable-color';
|
|
1
|
+
import { Color, ColorOptions } from './color';
|
|
4
2
|
import { ColorApi } from './color.api';
|
|
5
|
-
|
|
3
|
+
import { Context } from '../context';
|
|
4
|
+
export declare const highestSurface: (context: Context, colorService: ColorManager | ColorApi) => Color;
|
|
6
5
|
export declare class ColorManager {
|
|
7
6
|
private colorMap;
|
|
8
|
-
private readonly
|
|
9
|
-
constructor(
|
|
10
|
-
|
|
7
|
+
private readonly context;
|
|
8
|
+
constructor(args: {
|
|
9
|
+
context: Context;
|
|
11
10
|
});
|
|
12
|
-
createOrUpdate(key: string, args:
|
|
13
|
-
alias?: never;
|
|
14
|
-
}) | {
|
|
15
|
-
alias: string;
|
|
16
|
-
palette?: never;
|
|
17
|
-
tone?: never;
|
|
18
|
-
}): ConfigurableColor;
|
|
11
|
+
createOrUpdate(key: string, args: ColorOptions): Color;
|
|
19
12
|
remove(key: string): boolean;
|
|
20
|
-
get(key: string):
|
|
21
|
-
getAll(): ReadonlyMap<string,
|
|
22
|
-
addFromPalette(key: string): void;
|
|
13
|
+
get(key: string): Color;
|
|
14
|
+
getAll(): ReadonlyMap<string, Color>;
|
|
23
15
|
}
|
|
24
16
|
//# sourceMappingURL=color.manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.manager.d.ts","sourceRoot":"","sources":["../../src/color/color.manager.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"color.manager.d.ts","sourceRoot":"","sources":["../../src/color/color.manager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAIL,YAAY,EACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,eAAO,MAAM,cAAc,GACzB,SAAS,OAAO,EAChB,cAAc,YAAY,GAAG,QAAQ,KACpC,KAUF,CAAC;AAEF,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;gBAEtB,IAAI,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE;IAItC,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,KAAK;IAsB/C,MAAM,CAAC,GAAG,EAAE,MAAM;IAIlB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK;IASvB,MAAM,IAAI,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC;CAG5C"}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import { TonalPalette } from '@material/material-color-utilities';
|
|
2
1
|
import { ContrastCurve } from '../material-color-utilities/contrastCurve';
|
|
2
|
+
import { Palette } from '../palette/palette';
|
|
3
3
|
export type DynamicColorKey = 'background' | 'onBackground' | 'surface' | 'surfaceDim' | 'surfaceBright' | 'surfaceContainerLowest' | 'surfaceContainerLow' | 'surfaceContainer' | 'surfaceContainerHigh' | 'surfaceContainerHighest' | 'onSurface' | 'surfaceVariant' | 'onSurfaceVariant' | 'inverseSurface' | 'inverseOnSurface' | 'outline' | 'outlineVariant' | 'surfaceTint' | 'primary' | 'primaryDim' | 'onPrimary' | 'primaryContainer' | 'onPrimaryContainer' | 'inversePrimary' | 'secondary' | 'secondaryDim' | 'onSecondary' | 'secondaryContainer' | 'onSecondaryContainer' | 'tertiary' | 'tertiaryDim' | 'onTertiary' | 'tertiaryContainer' | 'onTertiaryContainer' | 'error' | 'errorDim' | 'onError' | 'errorContainer' | 'onErrorContainer' | 'primaryFixed' | 'primaryFixedDim' | 'onPrimaryFixed' | 'onPrimaryFixedVariant' | 'secondaryFixed' | 'secondaryFixedDim' | 'onSecondaryFixed' | 'onSecondaryFixedVariant' | 'tertiaryFixed' | 'tertiaryFixedDim' | 'onTertiaryFixed' | 'onTertiaryFixedVariant';
|
|
4
4
|
export declare function getCurve(defaultContrast: number): ContrastCurve;
|
|
5
|
-
export declare function tMaxC(palette:
|
|
6
|
-
export declare function tMinC(palette:
|
|
5
|
+
export declare function tMaxC(palette: Palette, lowerBound?: number, upperBound?: number, chromaMultiplier?: number): number;
|
|
6
|
+
export declare function tMinC(palette: Palette, lowerBound?: number, upperBound?: number): number;
|
|
7
7
|
export declare function findBestToneForChroma(hue: number, chroma: number, tone: number, byDecreasingTone: boolean): number;
|
|
8
|
+
/**
|
|
9
|
+
* Calcule le pourcentage des tons à ajuster pour atteindre un ratio de contraste.
|
|
10
|
+
*
|
|
11
|
+
* @param toneA Le premier ton (par exemple, tone de surface).
|
|
12
|
+
* @param toneB Le ton cible à ajuster.
|
|
13
|
+
* @param desiredRatio Le ratio de contraste requis (ex : 3, 4.5, 7).
|
|
14
|
+
* @returns Un pourcentage (entre 0 et 100) indiquant l'effort nécessaire :
|
|
15
|
+
* - 0% si `toneB` est au bon ratio.
|
|
16
|
+
* - Un pourcentage positif ou négatif en fonction de la distance à ajuster.
|
|
17
|
+
*/
|
|
18
|
+
export declare function calculateToneAdjustmentPercentage(toneA: number, toneB: number, desiredRatio: number): number;
|
|
8
19
|
//# sourceMappingURL=color.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.utils.d.ts","sourceRoot":"","sources":["../../src/color/color.utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"color.utils.d.ts","sourceRoot":"","sources":["../../src/color/color.utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,MAAM,eAAe,GACvB,YAAY,GACZ,cAAc,GACd,SAAS,GACT,YAAY,GACZ,eAAe,GACf,wBAAwB,GACxB,qBAAqB,GACrB,kBAAkB,GAClB,sBAAsB,GACtB,yBAAyB,GACzB,WAAW,GACX,gBAAgB,GAChB,kBAAkB,GAClB,gBAAgB,GAChB,kBAAkB,GAClB,SAAS,GACT,gBAAgB,GAChB,aAAa,GACb,SAAS,GACT,YAAY,GACZ,WAAW,GACX,kBAAkB,GAClB,oBAAoB,GACpB,gBAAgB,GAChB,WAAW,GACX,cAAc,GACd,aAAa,GACb,oBAAoB,GACpB,sBAAsB,GACtB,UAAU,GACV,aAAa,GACb,YAAY,GACZ,mBAAmB,GACnB,qBAAqB,GACrB,OAAO,GACP,UAAU,GACV,SAAS,GACT,gBAAgB,GAChB,kBAAkB,GAClB,cAAc,GACd,iBAAiB,GACjB,gBAAgB,GAChB,uBAAuB,GACvB,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,yBAAyB,GACzB,eAAe,GACf,kBAAkB,GAClB,iBAAiB,GACjB,wBAAwB,CAAC;AAE7B,wBAAgB,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,aAAa,CAqB/D;AAED,wBAAgB,KAAK,CACnB,OAAO,EAAE,OAAO,EAChB,UAAU,SAAI,EACd,UAAU,SAAM,EAChB,gBAAgB,SAAI,GACnB,MAAM,CAQR;AAED,wBAAgB,KAAK,CACnB,OAAO,EAAE,OAAO,EAChB,UAAU,SAAI,EACd,UAAU,SAAM,GACf,MAAM,CAGR;AAED,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,OAAO,GACxB,MAAM,CAgBR;AAED;;;;;;;;;GASG;AACH,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,GACnB,MAAM,CA4BR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-color.d.ts","sourceRoot":"","sources":["../../src/color/default-color.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default-color.d.ts","sourceRoot":"","sources":["../../src/color/default-color.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAiB/C,eAAO,MAAM,aAAa,EAAE,gBA21B3B,CAAC"}
|
package/dist/color/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/color/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/color/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { AddColorsOptions } from '../color';
|
|
2
|
-
import { Variant } from '../theme';
|
|
3
2
|
import { PluginAbstract } from '../plugin';
|
|
3
|
+
import { Variant } from '../variant/variant';
|
|
4
|
+
import { PaletteCallback } from '../palette/palette';
|
|
4
5
|
export interface ConfigInterface {
|
|
5
6
|
sourceColor: string;
|
|
6
7
|
contrastLevel?: number;
|
|
7
8
|
isDark?: boolean;
|
|
8
9
|
variant?: Variant;
|
|
9
|
-
colors?: AddColorsOptions
|
|
10
|
-
|
|
11
|
-
palettes?: Record<string, string>;
|
|
10
|
+
colors?: AddColorsOptions;
|
|
11
|
+
palettes?: Record<string, PaletteCallback | string>;
|
|
12
12
|
plugins?: PluginAbstract<any, any>[];
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=config.interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.interface.d.ts","sourceRoot":"","sources":["../../src/config/config.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"config.interface.d.ts","sourceRoot":"","sources":["../../src/config/config.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAAC,CAAC;IACpD,OAAO,CAAC,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;CACtC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Hct } from '../material-color-utilities/htc';
|
|
2
|
+
import { Variant } from '../variant/variant';
|
|
3
|
+
export interface ContextOptions {
|
|
4
|
+
sourceColor: string | Hct;
|
|
5
|
+
contrastLevel: number;
|
|
6
|
+
isDark: boolean;
|
|
7
|
+
variant: Variant;
|
|
8
|
+
}
|
|
9
|
+
export declare class Context {
|
|
10
|
+
private _options?;
|
|
11
|
+
private _temOptions;
|
|
12
|
+
private readonly updateCallbacks;
|
|
13
|
+
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Runs the provided callback with a proxied Context and records which Context
|
|
16
|
+
* properties (getters) were accessed during its execution.
|
|
17
|
+
*
|
|
18
|
+
* This helps determine dependencies of the callback on the Context.
|
|
19
|
+
*
|
|
20
|
+
* Example usage:
|
|
21
|
+
* const { result, dependencies } = Context.trackDependencies(ctx, (c) => cb(c));
|
|
22
|
+
*/
|
|
23
|
+
static trackDependencies<T>(context: Context, callback: (ctx: Context) => T): {
|
|
24
|
+
result: T;
|
|
25
|
+
dependencies: (keyof Context)[];
|
|
26
|
+
};
|
|
27
|
+
set(options: ContextOptions): void;
|
|
28
|
+
update(args: Partial<ContextOptions>): void;
|
|
29
|
+
private getOptions;
|
|
30
|
+
set darkMode(isDark: boolean);
|
|
31
|
+
get isDark(): boolean;
|
|
32
|
+
set contrastLevel(contrastLevel: number);
|
|
33
|
+
get contrastLevel(): number;
|
|
34
|
+
set sourceColor(sourceColor: string);
|
|
35
|
+
get sourceColor(): Hct;
|
|
36
|
+
set variant(variant: Variant);
|
|
37
|
+
get variant(): Variant;
|
|
38
|
+
temp<T>(args: Partial<ContextOptions>, callback: () => T): T;
|
|
39
|
+
onUpdate(callback: (changed: (keyof Context)[]) => void): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,GAAG,GAAG,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAC,CAAiB;IAClC,OAAO,CAAC,WAAW,CAA+B;IAClD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAEzB;;IAUP;;;;;;;;OAQG;IACH,MAAM,CAAC,iBAAiB,CAAC,CAAC,EACxB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,CAAC,GAC5B;QAAE,MAAM,EAAE,CAAC,CAAC;QAAC,YAAY,EAAE,CAAC,MAAM,OAAO,CAAC,EAAE,CAAA;KAAE;IAsBjD,GAAG,CAAC,OAAO,EAAE,cAAc;IAqBpB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC;IA4B3C,OAAO,CAAC,UAAU;IAalB,IAAI,QAAQ,CAAC,MAAM,EAAE,OAAO,EAE3B;IACD,IAAI,MAAM,YAET;IAED,IAAI,aAAa,CAAC,aAAa,EAAE,MAAM,EAEtC;IACD,IAAI,aAAa,IAHgB,MAAM,CAKtC;IAED,IAAI,WAAW,CAAC,WAAW,EAAE,MAAM,EAElC;IACD,IAAI,WAAW,IAAI,GAAG,CAMrB;IAED,IAAI,OAAO,CAAC,OAAO,EAAE,OAAO,EAE3B;IACD,IAAI,OAAO,IAHU,OAAO,CAK3B;IAED,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC;IAW5D,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,OAAO,CAAC,EAAE,KAAK,IAAI,GAAG,IAAI;CAG/D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.module.d.ts","sourceRoot":"","sources":["../../src/context/context.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,eAAO,MAAM,aAAa,EAAE,MAE3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC"}
|