@newtonedev/configurator 0.1.0 → 0.1.2
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/dist/Configurator.d.ts.map +1 -1
- package/dist/bridge/toCSS.d.ts.map +1 -1
- package/dist/bridge/toThemeConfig.d.ts.map +1 -1
- package/dist/hex-conversion.d.ts +25 -0
- package/dist/hex-conversion.d.ts.map +1 -0
- package/dist/hooks/useWcagValidation.d.ts +20 -0
- package/dist/hooks/useWcagValidation.d.ts.map +1 -0
- package/dist/index.cjs +690 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +676 -39
- package/dist/index.js.map +1 -1
- package/dist/panels/DesignPanel.d.ts +10 -0
- package/dist/panels/DesignPanel.d.ts.map +1 -0
- package/dist/panels/PalettePanel.d.ts +3 -2
- package/dist/panels/PalettePanel.d.ts.map +1 -1
- package/dist/state/actions.d.ts +57 -1
- package/dist/state/actions.d.ts.map +1 -1
- package/dist/state/defaults.d.ts.map +1 -1
- package/dist/state/reducer.d.ts.map +1 -1
- package/dist/types.d.ts +33 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Configurator.tsx +10 -0
- package/src/bridge/toCSS.ts +4 -0
- package/src/bridge/toThemeConfig.ts +113 -3
- package/src/hex-conversion.ts +99 -0
- package/src/hooks/useWcagValidation.ts +111 -0
- package/src/index.ts +9 -2
- package/src/panels/DesignPanel.tsx +149 -0
- package/src/panels/PalettePanel.tsx +182 -6
- package/src/state/actions.ts +21 -1
- package/src/state/defaults.ts +31 -0
- package/src/state/reducer.ts +181 -0
- package/src/types.ts +35 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Configurator.d.ts","sourceRoot":"","sources":["../src/Configurator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAI3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"Configurator.d.ts","sourceRoot":"","sources":["../src/Configurator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAI3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAS9D;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,EAC3B,YAAY,EACZ,QAAQ,EACR,UAAiB,EACjB,WAAkB,GACnB,EAAE,iBAAiB,qBAwHnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toCSS.d.ts","sourceRoot":"","sources":["../../src/bridge/toCSS.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAMlD;;;GAGG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"toCSS.d.ts","sourceRoot":"","sources":["../../src/bridge/toCSS.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAMlD;;;GAGG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAoCtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toThemeConfig.d.ts","sourceRoot":"","sources":["../../src/bridge/toThemeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"toThemeConfig.d.ts","sourceRoot":"","sources":["../../src/bridge/toThemeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,UAAU,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAc,MAAM,wBAAwB,CAAC;AAoE7E;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB,CA8F1E"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DynamicRange } from 'newtone';
|
|
2
|
+
/** Result of decomposing a hex color into palette parameters */
|
|
3
|
+
export interface HexPaletteParams {
|
|
4
|
+
/** Traditional HSL hue [0, 359] */
|
|
5
|
+
readonly hue: number;
|
|
6
|
+
/** Saturation as % of max in-gamut chroma [0, 100] */
|
|
7
|
+
readonly saturation: number;
|
|
8
|
+
/** Position on the luminosity scale [0, 1] */
|
|
9
|
+
readonly normalizedValue: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Convert an OKLCH hue back to the nearest traditional HSL hue.
|
|
13
|
+
* Uses a precomputed lookup table with 1° resolution.
|
|
14
|
+
*/
|
|
15
|
+
export declare function oklchHueToTraditional(oklchHue: number): number;
|
|
16
|
+
/**
|
|
17
|
+
* Decompose a hex color string into palette parameters (hue, saturation, luminosity).
|
|
18
|
+
*
|
|
19
|
+
* Returns null if the hex string is invalid.
|
|
20
|
+
*
|
|
21
|
+
* @param hex - Hex color string (e.g., "#FF0000", "#f00", "FF0000")
|
|
22
|
+
* @param dynamicRange - Current dynamic range for normalizedValue mapping
|
|
23
|
+
*/
|
|
24
|
+
export declare function hexToPaletteParams(hex: string, dynamicRange: DynamicRange): HexPaletteParams | null;
|
|
25
|
+
//# sourceMappingURL=hex-conversion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hex-conversion.d.ts","sourceRoot":"","sources":["../src/hex-conversion.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C,gEAAgE;AAChE,MAAM,WAAW,gBAAgB;IAC/B,mCAAmC;IACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,8CAA8C;IAC9C,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAgBD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAoB9D;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,YAAY,GACzB,gBAAgB,GAAG,IAAI,CA4BzB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ConfiguratorState } from '../types';
|
|
2
|
+
export interface WcagValidation {
|
|
3
|
+
/** WCAG contrast ratio at the key color position (null if no keyColor set) */
|
|
4
|
+
readonly keyColorContrast: number | null;
|
|
5
|
+
/** Whether the key color passes WCAG AA for normal text (>= 4.5:1) */
|
|
6
|
+
readonly passesAA: boolean;
|
|
7
|
+
/** Whether the key color passes WCAG AA for large text (>= 3:1) */
|
|
8
|
+
readonly passesAALargeText: boolean;
|
|
9
|
+
/** The normalizedValue where auto contrast search would place the key color */
|
|
10
|
+
readonly autoNormalizedValue: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Compute WCAG validation info for a non-neutral palette's key color.
|
|
14
|
+
*
|
|
15
|
+
* Validates the palette's key color against the neutral background
|
|
16
|
+
* in the current preview mode. Also computes where the auto contrast
|
|
17
|
+
* search would place the key color (for showing the default position).
|
|
18
|
+
*/
|
|
19
|
+
export declare function useWcagValidation(state: ConfiguratorState, paletteIndex: number): WcagValidation;
|
|
20
|
+
//# sourceMappingURL=useWcagValidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWcagValidation.d.ts","sourceRoot":"","sources":["../../src/hooks/useWcagValidation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD,MAAM,WAAW,cAAc;IAC7B,8EAA8E;IAC9E,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,mEAAmE;IACnE,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,+EAA+E;IAC/E,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;CACtC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,iBAAiB,EACxB,YAAY,EAAE,MAAM,GACnB,cAAc,CA8EhB"}
|