@udixio/theme 2.1.16 → 2.1.17
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 +10 -0
- package/dist/bin.cjs +1 -1
- package/dist/bin.js +1 -1
- package/dist/browser.cjs +2 -2
- package/dist/browser.js +2 -2
- package/dist/{font.plugin-BXjaZrFM.js → font.plugin-CE1jX3iF.js} +1 -1
- package/dist/{font.plugin-CCt54Tnx.cjs → font.plugin-DKvzB0yr.cjs} +1 -1
- package/dist/{load-from-path-CewyV1N6.cjs → load-from-path-CuZeSC9R.cjs} +2 -2
- package/dist/{load-from-path-Cctfzaw6.js → load-from-path-IJo3DMek.js} +1 -1
- package/dist/{loader-DKt7MGAX.cjs → loader-COk_13QK.cjs} +9 -4
- package/dist/{loader-DnW57GzE.js → loader-DPnknsVo.js} +9 -4
- package/dist/node.cjs +3 -3
- package/dist/node.js +4 -4
- package/dist/variant/variants/udixio.variant.d.ts +1 -1
- package/dist/variant/variants/udixio.variant.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/variant/variants/udixio.variant.ts +21 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 2.1.17 (2026-03-20)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- **variant:** normalize contrast levels and adjust tone inversion logic ([cc369c3](https://github.com/Udixio/UI/commit/cc369c3))
|
|
6
|
+
|
|
7
|
+
### ❤️ Thank You
|
|
8
|
+
|
|
9
|
+
- Joël VIGREUX
|
|
10
|
+
|
|
1
11
|
## 2.1.16 (2026-02-15)
|
|
2
12
|
|
|
3
13
|
This was a version bump only for @udixio/theme to align it with other projects, there were no code changes.
|
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-CuZeSC9R.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-IJo3DMek.js";
|
|
5
5
|
const program = new Command();
|
|
6
6
|
async function runOnce(configPath) {
|
|
7
7
|
try {
|
package/dist/browser.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const loader = require("./loader-
|
|
4
|
-
const font_plugin = require("./font.plugin-
|
|
3
|
+
const loader = require("./loader-COk_13QK.cjs");
|
|
4
|
+
const font_plugin = require("./font.plugin-DKvzB0yr.cjs");
|
|
5
5
|
exports.API = loader.API;
|
|
6
6
|
exports.AppContainer = loader.AppContainer;
|
|
7
7
|
exports.AppModule = loader.AppModule;
|
package/dist/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A, a, b, C, c, d, e, f, g, h, i, j, k, D, P, l, m, n, o, V, p, q, r, s, t, u, v, w, x, y, z, B, E, F, G } from "./loader-
|
|
2
|
-
import { F as F2, a as a2, P as P2, b as b2, d as d2 } from "./font.plugin-
|
|
1
|
+
import { A, a, b, C, c, d, e, f, g, h, i, j, k, D, P, l, m, n, o, V, p, q, r, s, t, u, v, w, x, y, z, B, E, F, G } from "./loader-DPnknsVo.js";
|
|
2
|
+
import { F as F2, a as a2, P as P2, b as b2, d as d2 } from "./font.plugin-CE1jX3iF.js";
|
|
3
3
|
export {
|
|
4
4
|
A as API,
|
|
5
5
|
a as AppContainer,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import "./loader-
|
|
4
|
+
import "./loader-DPnknsVo.js";
|
|
5
5
|
class PluginAbstract {
|
|
6
6
|
constructor(options) {
|
|
7
7
|
__publicField(this, "options");
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
require("./loader-
|
|
5
|
+
require("./loader-COk_13QK.cjs");
|
|
6
6
|
class PluginAbstract {
|
|
7
7
|
constructor(options) {
|
|
8
8
|
__publicField(this, "options");
|
|
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
22
|
mod
|
|
23
23
|
));
|
|
24
|
-
const loader = require("./loader-
|
|
24
|
+
const loader = require("./loader-COk_13QK.cjs");
|
|
25
25
|
const fs = require("node:fs");
|
|
26
26
|
var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
|
|
27
27
|
function _interopNamespaceDefault(e) {
|
|
@@ -44,7 +44,7 @@ const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
|
44
44
|
async function resolveConfig(configPath = "./theme.config") {
|
|
45
45
|
const { createJiti } = await import("jiti");
|
|
46
46
|
const { resolve } = await import("pathe");
|
|
47
|
-
const jiti = createJiti(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("load-from-path-
|
|
47
|
+
const jiti = createJiti(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("load-from-path-CuZeSC9R.cjs", document.baseURI).href, {
|
|
48
48
|
debug: process.env.NODE_ENV === "development",
|
|
49
49
|
fsCache: true,
|
|
50
50
|
interopDefault: true
|
|
@@ -3074,8 +3074,12 @@ const vibrantVariant = variant({
|
|
|
3074
3074
|
colors: defaultColors
|
|
3075
3075
|
});
|
|
3076
3076
|
const surfaceContainerToneDelta = 2.5;
|
|
3077
|
-
const
|
|
3078
|
-
|
|
3077
|
+
const normalize = (value, inputRange, outputRange = [0, 1]) => {
|
|
3078
|
+
const [inputMin, inputMax] = inputRange;
|
|
3079
|
+
const [outputMin, outputMax] = outputRange;
|
|
3080
|
+
const clampedValue = Math.max(inputMin, Math.min(value, inputMax));
|
|
3081
|
+
const normalizedValue = (clampedValue - inputMin) / (inputMax - inputMin);
|
|
3082
|
+
return outputMin + normalizedValue * (outputMax - outputMin);
|
|
3079
3083
|
};
|
|
3080
3084
|
const surfaceContainerTone = (layer, api) => {
|
|
3081
3085
|
const t = surfaceContainerToneDelta * layer * (1 + api.context.contrastLevel);
|
|
@@ -3096,7 +3100,8 @@ const highestSurface = (context, colorService) => {
|
|
|
3096
3100
|
}
|
|
3097
3101
|
};
|
|
3098
3102
|
const createMinContrastToneAdjuster = (ctx, colors, options) => {
|
|
3099
|
-
const { selfKey, referenceKey
|
|
3103
|
+
const { selfKey, referenceKey } = options;
|
|
3104
|
+
const minContrast = ctx.contrastLevel >= 0 ? normalize(ctx.contrastLevel, [0, 1], [4.5, 7]) : normalize(ctx.contrastLevel, [-1, 0], [0, 4.5]);
|
|
3100
3105
|
const referenceTone = referenceKey ? colors.get(referenceKey).getTone() : highestSurface(ctx, colors).getTone();
|
|
3101
3106
|
const baseTone = colors.get(selfKey).options.tone;
|
|
3102
3107
|
let selfTone = baseTone;
|
|
@@ -3106,7 +3111,7 @@ const createMinContrastToneAdjuster = (ctx, colors, options) => {
|
|
|
3106
3111
|
selfTone,
|
|
3107
3112
|
minContrast
|
|
3108
3113
|
);
|
|
3109
|
-
const inverseT =
|
|
3114
|
+
const inverseT = ctx.isDark ? 100 : 0;
|
|
3110
3115
|
selfTone = selfTone + (inverseT - selfTone) * ratio;
|
|
3111
3116
|
}
|
|
3112
3117
|
return selfTone;
|
|
@@ -3073,8 +3073,12 @@ const vibrantVariant = variant({
|
|
|
3073
3073
|
colors: defaultColors
|
|
3074
3074
|
});
|
|
3075
3075
|
const surfaceContainerToneDelta = 2.5;
|
|
3076
|
-
const
|
|
3077
|
-
|
|
3076
|
+
const normalize = (value, inputRange, outputRange = [0, 1]) => {
|
|
3077
|
+
const [inputMin, inputMax] = inputRange;
|
|
3078
|
+
const [outputMin, outputMax] = outputRange;
|
|
3079
|
+
const clampedValue = Math.max(inputMin, Math.min(value, inputMax));
|
|
3080
|
+
const normalizedValue = (clampedValue - inputMin) / (inputMax - inputMin);
|
|
3081
|
+
return outputMin + normalizedValue * (outputMax - outputMin);
|
|
3078
3082
|
};
|
|
3079
3083
|
const surfaceContainerTone = (layer, api) => {
|
|
3080
3084
|
const t = surfaceContainerToneDelta * layer * (1 + api.context.contrastLevel);
|
|
@@ -3095,7 +3099,8 @@ const highestSurface = (context, colorService) => {
|
|
|
3095
3099
|
}
|
|
3096
3100
|
};
|
|
3097
3101
|
const createMinContrastToneAdjuster = (ctx, colors, options) => {
|
|
3098
|
-
const { selfKey, referenceKey
|
|
3102
|
+
const { selfKey, referenceKey } = options;
|
|
3103
|
+
const minContrast = ctx.contrastLevel >= 0 ? normalize(ctx.contrastLevel, [0, 1], [4.5, 7]) : normalize(ctx.contrastLevel, [-1, 0], [0, 4.5]);
|
|
3099
3104
|
const referenceTone = referenceKey ? colors.get(referenceKey).getTone() : highestSurface(ctx, colors).getTone();
|
|
3100
3105
|
const baseTone = colors.get(selfKey).options.tone;
|
|
3101
3106
|
let selfTone = baseTone;
|
|
@@ -3105,7 +3110,7 @@ const createMinContrastToneAdjuster = (ctx, colors, options) => {
|
|
|
3105
3110
|
selfTone,
|
|
3106
3111
|
minContrast
|
|
3107
3112
|
);
|
|
3108
|
-
const inverseT =
|
|
3113
|
+
const inverseT = ctx.isDark ? 100 : 0;
|
|
3109
3114
|
selfTone = selfTone + (inverseT - selfTone) * ratio;
|
|
3110
3115
|
}
|
|
3111
3116
|
return selfTone;
|
package/dist/node.cjs
CHANGED
|
@@ -22,9 +22,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
mod
|
|
23
23
|
));
|
|
24
24
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
25
|
-
const loader = require("./loader-
|
|
26
|
-
const font_plugin = require("./font.plugin-
|
|
27
|
-
const loadFromPath = require("./load-from-path-
|
|
25
|
+
const loader = require("./loader-COk_13QK.cjs");
|
|
26
|
+
const font_plugin = require("./font.plugin-DKvzB0yr.cjs");
|
|
27
|
+
const loadFromPath = require("./load-from-path-CuZeSC9R.cjs");
|
|
28
28
|
let unpluginInstance = null;
|
|
29
29
|
const createUnpluginTheme = async () => {
|
|
30
30
|
if (unpluginInstance) {
|
package/dist/node.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A, a, b, C, c, d, e, f, g, h, i, j, k, D, P, l, m, n, o, V, p, q, r, s, t, u, v, w, x, y, z, B, E, F, G } from "./loader-
|
|
2
|
-
import { F as F2, a as a2, P as P2, b as b2, d as d2 } from "./font.plugin-
|
|
3
|
-
import { l as loadFromPath } from "./load-from-path-
|
|
4
|
-
import { r as r2 } from "./load-from-path-
|
|
1
|
+
import { A, a, b, C, c, d, e, f, g, h, i, j, k, D, P, l, m, n, o, V, p, q, r, s, t, u, v, w, x, y, z, B, E, F, G } from "./loader-DPnknsVo.js";
|
|
2
|
+
import { F as F2, a as a2, P as P2, b as b2, d as d2 } from "./font.plugin-CE1jX3iF.js";
|
|
3
|
+
import { l as loadFromPath } from "./load-from-path-IJo3DMek.js";
|
|
4
|
+
import { r as r2 } from "./load-from-path-IJo3DMek.js";
|
|
5
5
|
let unpluginInstance = null;
|
|
6
6
|
const createUnpluginTheme = async () => {
|
|
7
7
|
if (unpluginInstance) {
|
|
@@ -2,10 +2,10 @@ import { Variant } from '../variant';
|
|
|
2
2
|
import { DynamicColorKey } from '../../color/color.utils';
|
|
3
3
|
import { ColorApi, ColorManager } from '../../color';
|
|
4
4
|
import { Context } from '../../context';
|
|
5
|
+
export declare const normalize: (value: number, inputRange: [number, number], outputRange?: [number, number]) => number;
|
|
5
6
|
export declare const createMinContrastToneAdjuster: (ctx: Context, colors: ColorManager | ColorApi, options: {
|
|
6
7
|
selfKey: DynamicColorKey;
|
|
7
8
|
referenceKey?: DynamicColorKey;
|
|
8
|
-
minContrast?: number;
|
|
9
9
|
}) => number;
|
|
10
10
|
export declare const udixioVariant: Variant;
|
|
11
11
|
//# sourceMappingURL=udixio.variant.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"udixio.variant.d.ts","sourceRoot":"","sources":["../../../src/variant/variants/udixio.variant.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,OAAO,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,EAEL,eAAe,EAIhB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAIL,QAAQ,EAER,YAAY,EAEb,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"udixio.variant.d.ts","sourceRoot":"","sources":["../../../src/variant/variants/udixio.variant.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,OAAO,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,EAEL,eAAe,EAIhB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAIL,QAAQ,EAER,YAAY,EAEb,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AASxC,eAAO,MAAM,SAAS,GACpB,OAAO,MAAM,EACb,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,cAAa,CAAC,MAAM,EAAE,MAAM,CAAU,KACrC,MASF,CAAC;AAkCF,eAAO,MAAM,6BAA6B,GACxC,KAAK,OAAO,EACZ,QAAQ,YAAY,GAAG,QAAQ,EAC/B,SAAS;IACP,OAAO,EAAE,eAAe,CAAC;IACzB,YAAY,CAAC,EAAE,eAAe,CAAC;CAChC,WA2BF,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,OA6vB1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -27,6 +27,21 @@ const inverseTone = (tone: number) => {
|
|
|
27
27
|
return 100 - tone;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
export const normalize = (
|
|
31
|
+
value: number,
|
|
32
|
+
inputRange: [number, number],
|
|
33
|
+
outputRange: [number, number] = [0, 1],
|
|
34
|
+
): number => {
|
|
35
|
+
const [inputMin, inputMax] = inputRange;
|
|
36
|
+
const [outputMin, outputMax] = outputRange;
|
|
37
|
+
|
|
38
|
+
const clampedValue = Math.max(inputMin, Math.min(value, inputMax));
|
|
39
|
+
|
|
40
|
+
const normalizedValue = (clampedValue - inputMin) / (inputMax - inputMin);
|
|
41
|
+
|
|
42
|
+
return outputMin + normalizedValue * (outputMax - outputMin);
|
|
43
|
+
};
|
|
44
|
+
|
|
30
45
|
const surfaceContainerTone = (
|
|
31
46
|
layer: number,
|
|
32
47
|
api: Pick<API, 'palettes' | 'context'>,
|
|
@@ -65,10 +80,13 @@ export const createMinContrastToneAdjuster = (
|
|
|
65
80
|
options: {
|
|
66
81
|
selfKey: DynamicColorKey;
|
|
67
82
|
referenceKey?: DynamicColorKey; // par défaut: la surface la plus "haute"
|
|
68
|
-
minContrast?: number; // par défaut: 3
|
|
69
83
|
},
|
|
70
84
|
) => {
|
|
71
|
-
const { selfKey, referenceKey
|
|
85
|
+
const { selfKey, referenceKey } = options;
|
|
86
|
+
const minContrast =
|
|
87
|
+
ctx.contrastLevel >= 0
|
|
88
|
+
? normalize(ctx.contrastLevel, [0, 1], [4.5, 7])
|
|
89
|
+
: normalize(ctx.contrastLevel, [-1, 0], [0, 4.5]);
|
|
72
90
|
|
|
73
91
|
const referenceTone = referenceKey
|
|
74
92
|
? colors.get(referenceKey).getTone()
|
|
@@ -84,7 +102,7 @@ export const createMinContrastToneAdjuster = (
|
|
|
84
102
|
selfTone,
|
|
85
103
|
minContrast,
|
|
86
104
|
);
|
|
87
|
-
const inverseT =
|
|
105
|
+
const inverseT = ctx.isDark ? 100 : 0;
|
|
88
106
|
selfTone = selfTone + (inverseT - selfTone) * ratio;
|
|
89
107
|
}
|
|
90
108
|
|