@newtone-dev/ui-react-web 0.44.0 → 0.46.1
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 +5 -3
- package/dist/app-frame/app-frame.css +77 -25
- package/dist/app-frame/app-frame.d.ts +2 -1
- package/dist/app-frame/app-frame.d.ts.map +1 -1
- package/dist/app-frame/app-frame.js +2 -1
- package/dist/app-frame/app-frame.js.map +1 -1
- package/dist/app-frame/index.d.ts +1 -1
- package/dist/app-frame/index.d.ts.map +1 -1
- package/dist/app-frame/launcher/launcher.d.ts.map +1 -1
- package/dist/app-frame/launcher/launcher.js +5 -3
- package/dist/app-frame/launcher/launcher.js.map +1 -1
- package/dist/app-frame/main-menu/main-menu.js +5 -1
- package/dist/app-frame/main-menu/main-menu.js.map +1 -1
- package/dist/app-frame/parts.d.ts +26 -1
- package/dist/app-frame/parts.d.ts.map +1 -1
- package/dist/app-frame/parts.js +17 -3
- package/dist/app-frame/parts.js.map +1 -1
- package/dist/ask-button/ask-button.css +7 -1
- package/dist/beside/beside.css +4 -0
- package/dist/button/button.css +14 -4
- package/dist/button/button.d.ts +12 -1
- package/dist/button/button.d.ts.map +1 -1
- package/dist/button/button.js +49 -3
- package/dist/button/button.js.map +1 -1
- package/dist/canvas/canvas.css +20 -5
- package/dist/canvas/cells/cells.d.ts +12 -1
- package/dist/canvas/cells/cells.d.ts.map +1 -1
- package/dist/canvas/cells/cells.js +16 -2
- package/dist/canvas/cells/cells.js.map +1 -1
- package/dist/canvas/cells/grid.d.ts +8 -2
- package/dist/canvas/cells/grid.d.ts.map +1 -1
- package/dist/canvas/cells/grid.js +8 -5
- package/dist/canvas/cells/grid.js.map +1 -1
- package/dist/canvas/dock/dock.d.ts +2 -2
- package/dist/canvas/dock/dock.js +2 -2
- package/dist/canvas/dock/dock.js.map +1 -1
- package/dist/card-box/card-box.css +8 -2
- package/dist/card-box/card-box.d.ts.map +1 -1
- package/dist/card-box/card-box.js +1 -1
- package/dist/card-box/card-box.js.map +1 -1
- package/dist/color/index.d.ts +4 -4
- package/dist/color/index.d.ts.map +1 -1
- package/dist/color/index.js +17 -15
- package/dist/color/index.js.map +1 -1
- package/dist/color/oklch.d.ts +6 -27
- package/dist/color/oklch.d.ts.map +1 -1
- package/dist/color/oklch.js +23 -61
- package/dist/color/oklch.js.map +1 -1
- package/dist/color/scale.d.ts +3 -18
- package/dist/color/scale.d.ts.map +1 -1
- package/dist/color/scale.js +13 -70
- package/dist/color/scale.js.map +1 -1
- package/dist/color/seeds.d.ts +51 -11
- package/dist/color/seeds.d.ts.map +1 -1
- package/dist/color/seeds.js +127 -41
- package/dist/color/seeds.js.map +1 -1
- package/dist/curve-field/curve-field.css +280 -0
- package/dist/curve-field/curve-field.d.ts +105 -0
- package/dist/curve-field/curve-field.d.ts.map +1 -0
- package/dist/curve-field/curve-field.js +532 -0
- package/dist/curve-field/curve-field.js.map +1 -0
- package/dist/curve-field/index.d.ts +3 -0
- package/dist/curve-field/index.d.ts.map +1 -0
- package/dist/curve-field/index.js +2 -0
- package/dist/curve-field/index.js.map +1 -0
- package/dist/diagram/diagram.css +63 -0
- package/dist/diagram/diagram.d.ts +63 -0
- package/dist/diagram/diagram.d.ts.map +1 -0
- package/dist/diagram/diagram.js +73 -0
- package/dist/diagram/diagram.js.map +1 -0
- package/dist/diagram/geometry.d.ts +60 -0
- package/dist/diagram/geometry.d.ts.map +1 -0
- package/dist/diagram/geometry.js +93 -0
- package/dist/diagram/geometry.js.map +1 -0
- package/dist/diagram/index.d.ts +7 -0
- package/dist/diagram/index.d.ts.map +1 -0
- package/dist/diagram/index.js +4 -0
- package/dist/diagram/index.js.map +1 -0
- package/dist/diagram/layout.d.ts +41 -0
- package/dist/diagram/layout.d.ts.map +1 -0
- package/dist/diagram/layout.js +157 -0
- package/dist/diagram/layout.js.map +1 -0
- package/dist/document/document.d.ts +7 -2
- package/dist/document/document.d.ts.map +1 -1
- package/dist/document/document.js +22 -4
- package/dist/document/document.js.map +1 -1
- package/dist/dynamic-range/dynamic-range.css +100 -0
- package/dist/dynamic-range/dynamic-range.d.ts +27 -0
- package/dist/dynamic-range/dynamic-range.d.ts.map +1 -0
- package/dist/dynamic-range/dynamic-range.js +20 -0
- package/dist/dynamic-range/dynamic-range.js.map +1 -0
- package/dist/dynamic-range/index.d.ts +3 -0
- package/dist/dynamic-range/index.d.ts.map +1 -0
- package/dist/dynamic-range/index.js +2 -0
- package/dist/dynamic-range/index.js.map +1 -0
- package/dist/file-grid/file-grid.css +65 -0
- package/dist/file-grid/file-grid.d.ts +35 -2
- package/dist/file-grid/file-grid.d.ts.map +1 -1
- package/dist/file-grid/file-grid.js +64 -3
- package/dist/file-grid/file-grid.js.map +1 -1
- package/dist/file-grid/index.d.ts +2 -2
- package/dist/file-grid/index.d.ts.map +1 -1
- package/dist/file-grid/index.js +1 -1
- package/dist/file-grid/index.js.map +1 -1
- package/dist/floating-bar/floating-bar.css +122 -32
- package/dist/floating-bar/floating-bar.d.ts +21 -2
- package/dist/floating-bar/floating-bar.d.ts.map +1 -1
- package/dist/floating-bar/floating-bar.js +64 -20
- package/dist/floating-bar/floating-bar.js.map +1 -1
- package/dist/floating-bar/index.d.ts +1 -1
- package/dist/floating-bar/index.d.ts.map +1 -1
- package/dist/font-picker/font-picker.css +4 -2
- package/dist/font-picker/font-picker.d.ts +34 -4
- package/dist/font-picker/font-picker.d.ts.map +1 -1
- package/dist/font-picker/font-picker.js +45 -9
- package/dist/font-picker/font-picker.js.map +1 -1
- package/dist/font-picker/index.d.ts +2 -2
- package/dist/font-picker/index.d.ts.map +1 -1
- package/dist/font-picker/index.js +1 -1
- package/dist/font-picker/index.js.map +1 -1
- package/dist/hint/hint.css +2 -6
- package/dist/icon/glyphs.d.ts +18 -0
- package/dist/icon/glyphs.d.ts.map +1 -0
- package/dist/icon/glyphs.js +17 -0
- package/dist/icon/glyphs.js.map +1 -0
- package/dist/icon/index.d.ts +2 -0
- package/dist/icon/index.d.ts.map +1 -1
- package/dist/icon/index.js +1 -0
- package/dist/icon/index.js.map +1 -1
- package/dist/identity/identity.d.ts +11 -3
- package/dist/identity/identity.d.ts.map +1 -1
- package/dist/identity/identity.js +8 -4
- package/dist/identity/identity.js.map +1 -1
- package/dist/index.d.ts +33 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/inspector/index.d.ts +1 -1
- package/dist/inspector/index.d.ts.map +1 -1
- package/dist/inspector/inspector.css +368 -7
- package/dist/inspector/inspector.d.ts +182 -5
- package/dist/inspector/inspector.d.ts.map +1 -1
- package/dist/inspector/inspector.js +85 -7
- package/dist/inspector/inspector.js.map +1 -1
- package/dist/look-picker/look-picker.css +62 -2
- package/dist/look-picker/look-picker.d.ts +34 -2
- package/dist/look-picker/look-picker.d.ts.map +1 -1
- package/dist/look-picker/look-picker.js +51 -42
- package/dist/look-picker/look-picker.js.map +1 -1
- package/dist/material/material.css +128 -57
- package/dist/number-field/number-field.css +34 -0
- package/dist/number-field/number-field.d.ts +29 -3
- package/dist/number-field/number-field.d.ts.map +1 -1
- package/dist/number-field/number-field.js +61 -10
- package/dist/number-field/number-field.js.map +1 -1
- package/dist/page-editor/page-editor.css +2 -6
- package/dist/picker/picker.css +42 -0
- package/dist/picker/picker.d.ts +10 -1
- package/dist/picker/picker.d.ts.map +1 -1
- package/dist/picker/picker.js +40 -5
- package/dist/picker/picker.js.map +1 -1
- package/dist/pop-menu/index.d.ts +7 -0
- package/dist/pop-menu/index.d.ts.map +1 -0
- package/dist/pop-menu/index.js +6 -0
- package/dist/pop-menu/index.js.map +1 -0
- package/dist/{floating-bar/menu.d.ts → pop-menu/pop-menu.d.ts} +10 -2
- package/dist/pop-menu/pop-menu.d.ts.map +1 -0
- package/dist/{floating-bar/menu.js → pop-menu/pop-menu.js} +35 -12
- package/dist/pop-menu/pop-menu.js.map +1 -0
- package/dist/prompt-field/prompt-field.css +3 -3
- package/dist/prompt-field/prompt-field.d.ts +3 -3
- package/dist/prompt-field/prompt-field.d.ts.map +1 -1
- package/dist/prompt-field/prompt-field.js +10 -4
- package/dist/prompt-field/prompt-field.js.map +1 -1
- package/dist/quick-action/quick-action.css +1 -1
- package/dist/seed-color-field/seed-color-field.css +8 -10
- package/dist/seed-color-field/seed-color-field.d.ts +9 -0
- package/dist/seed-color-field/seed-color-field.d.ts.map +1 -1
- package/dist/seed-color-field/seed-color-field.js +37 -10
- package/dist/seed-color-field/seed-color-field.js.map +1 -1
- package/dist/seed-contrast-field/index.d.ts +5 -0
- package/dist/seed-contrast-field/index.d.ts.map +1 -0
- package/dist/seed-contrast-field/index.js +3 -0
- package/dist/seed-contrast-field/index.js.map +1 -0
- package/dist/seed-contrast-field/seed-contrast-field.css +11 -0
- package/dist/seed-contrast-field/seed-contrast-field.d.ts +36 -0
- package/dist/seed-contrast-field/seed-contrast-field.d.ts.map +1 -0
- package/dist/seed-contrast-field/seed-contrast-field.js +18 -0
- package/dist/seed-contrast-field/seed-contrast-field.js.map +1 -0
- package/dist/seed-contrast-field/seed-contrast-slider.css +112 -0
- package/dist/seed-contrast-field/seed-contrast-slider.d.ts +22 -0
- package/dist/seed-contrast-field/seed-contrast-slider.d.ts.map +1 -0
- package/dist/seed-contrast-field/seed-contrast-slider.js +75 -0
- package/dist/seed-contrast-field/seed-contrast-slider.js.map +1 -0
- package/dist/seed-roundness-field/index.d.ts +3 -0
- package/dist/seed-roundness-field/index.d.ts.map +1 -0
- package/dist/seed-roundness-field/index.js +2 -0
- package/dist/seed-roundness-field/index.js.map +1 -0
- package/dist/seed-roundness-field/seed-roundness-field.css +23 -0
- package/dist/seed-roundness-field/seed-roundness-field.d.ts +39 -0
- package/dist/seed-roundness-field/seed-roundness-field.d.ts.map +1 -0
- package/dist/seed-roundness-field/seed-roundness-field.js +15 -0
- package/dist/seed-roundness-field/seed-roundness-field.js.map +1 -0
- package/dist/seed-steps/index.d.ts +8 -0
- package/dist/seed-steps/index.d.ts.map +1 -0
- package/dist/seed-steps/index.js +7 -0
- package/dist/seed-steps/index.js.map +1 -0
- package/dist/seed-steps/reset-focus.d.ts +16 -0
- package/dist/seed-steps/reset-focus.d.ts.map +1 -0
- package/dist/seed-steps/reset-focus.js +53 -0
- package/dist/seed-steps/reset-focus.js.map +1 -0
- package/dist/seed-steps/seed-steps.css +83 -0
- package/dist/seed-steps/seed-steps.d.ts +47 -0
- package/dist/seed-steps/seed-steps.d.ts.map +1 -0
- package/dist/seed-steps/seed-steps.js +95 -0
- package/dist/seed-steps/seed-steps.js.map +1 -0
- package/dist/shell/shell.css +31 -33
- package/dist/slide-list/slide-list.css +23 -2
- package/dist/slide-list/slide-list.d.ts +11 -2
- package/dist/slide-list/slide-list.d.ts.map +1 -1
- package/dist/slide-list/slide-list.js +6 -6
- package/dist/slide-list/slide-list.js.map +1 -1
- package/dist/split/split.css +11 -8
- package/dist/split/split.d.ts +2 -0
- package/dist/split/split.d.ts.map +1 -1
- package/dist/split/split.js +21 -3
- package/dist/split/split.js.map +1 -1
- package/dist/stage/stage.d.ts +11 -4
- package/dist/stage/stage.d.ts.map +1 -1
- package/dist/stage/stage.js +30 -9
- package/dist/stage/stage.js.map +1 -1
- package/dist/step-list/index.d.ts +3 -0
- package/dist/step-list/index.d.ts.map +1 -0
- package/dist/step-list/index.js +2 -0
- package/dist/step-list/index.js.map +1 -0
- package/dist/step-list/step-list.css +224 -0
- package/dist/step-list/step-list.d.ts +211 -0
- package/dist/step-list/step-list.d.ts.map +1 -0
- package/dist/step-list/step-list.js +242 -0
- package/dist/step-list/step-list.js.map +1 -0
- package/dist/step-strip/index.d.ts +3 -0
- package/dist/step-strip/index.d.ts.map +1 -0
- package/dist/step-strip/index.js +2 -0
- package/dist/step-strip/index.js.map +1 -0
- package/dist/step-strip/step-strip.css +118 -0
- package/dist/step-strip/step-strip.d.ts +52 -0
- package/dist/step-strip/step-strip.d.ts.map +1 -0
- package/dist/step-strip/step-strip.js +47 -0
- package/dist/step-strip/step-strip.js.map +1 -0
- package/dist/suggestion/index.d.ts +3 -0
- package/dist/suggestion/index.d.ts.map +1 -0
- package/dist/suggestion/index.js +2 -0
- package/dist/suggestion/index.js.map +1 -0
- package/dist/suggestion/suggestion.css +45 -0
- package/dist/suggestion/suggestion.d.ts +23 -0
- package/dist/suggestion/suggestion.d.ts.map +1 -0
- package/dist/suggestion/suggestion.js +45 -0
- package/dist/suggestion/suggestion.js.map +1 -0
- package/dist/surface/surface.css +112 -0
- package/dist/switch/switch.css +1 -6
- package/dist/text-field/text-field.css +11 -2
- package/dist/thread/thread.css +2 -10
- package/dist/thread/thread.js +1 -1
- package/dist/thread/thread.js.map +1 -1
- package/dist/tile-picker/index.d.ts +1 -1
- package/dist/tile-picker/index.d.ts.map +1 -1
- package/dist/tile-picker/tile-picker.css +56 -10
- package/dist/tile-picker/tile-picker.d.ts +64 -7
- package/dist/tile-picker/tile-picker.d.ts.map +1 -1
- package/dist/tile-picker/tile-picker.js +79 -47
- package/dist/tile-picker/tile-picker.js.map +1 -1
- package/dist/tile-search/index.d.ts +7 -0
- package/dist/tile-search/index.d.ts.map +1 -0
- package/dist/tile-search/index.js +7 -0
- package/dist/tile-search/index.js.map +1 -0
- package/dist/tile-search/narrow.d.ts +22 -0
- package/dist/tile-search/narrow.d.ts.map +1 -0
- package/dist/tile-search/narrow.js +62 -0
- package/dist/tile-search/narrow.js.map +1 -0
- package/dist/tile-search/search-box.d.ts +19 -0
- package/dist/tile-search/search-box.d.ts.map +1 -0
- package/dist/tile-search/search-box.js +47 -0
- package/dist/tile-search/search-box.js.map +1 -0
- package/dist/tooltip/tooltip.css +13 -20
- package/dist/tooltip/tooltip.d.ts +2 -2
- package/dist/tooltip/tooltip.d.ts.map +1 -1
- package/dist/tooltip/tooltip.js +15 -2
- package/dist/tooltip/tooltip.js.map +1 -1
- package/dist/workbench/workbench.css +128 -4
- package/dist/workbench/workbench.d.ts +28 -1
- package/dist/workbench/workbench.d.ts.map +1 -1
- package/dist/workbench/workbench.js +13 -4
- package/dist/workbench/workbench.js.map +1 -1
- package/package.json +43 -1
- package/dist/color/gamut.d.ts +0 -20
- package/dist/color/gamut.d.ts.map +0 -1
- package/dist/color/gamut.js +0 -72
- package/dist/color/gamut.js.map +0 -1
- package/dist/floating-bar/menu.d.ts.map +0 -1
- package/dist/floating-bar/menu.js.map +0 -1
package/dist/color/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/color/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/color/index.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,EAAE;AACF,2GAA2G;AAC3G,6GAA6G;AAC7G,oHAAoH;AACpH,sHAAsH;AACtH,EAAE;AACF,qHAAqH;AACrH,kHAAkH;AAClH,oHAAoH;AACpH,oHAAoH;AACpH,wGAAwG;AACxG,EAAE;AACF,iGAAiG;AACjG,gHAAgH;AAChH,uEAAuE;AACvE,qFAAqF;AACrF,6EAA6E;AAE7E,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEtE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAE/C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/color/oklch.d.ts
CHANGED
|
@@ -1,35 +1,14 @@
|
|
|
1
|
+
import type { Oklch } from '@newtone-dev/ui-tokens/engine';
|
|
2
|
+
export type { Oklch } from '@newtone-dev/ui-tokens/engine';
|
|
3
|
+
export type { Gamut } from '@newtone-dev/ui-tokens/engine/vector';
|
|
1
4
|
export declare const LMS_FROM_LRGB: readonly [readonly [0.4122214708, 0.5363325363, 0.0514459929], readonly [0.2119034982, 0.6806995451, 0.1073969566], readonly [0.0883024619, 0.2817188376, 0.6299787005]];
|
|
2
5
|
export declare const LAB_FROM_LMSP: readonly [readonly [0.2104542553, 0.793617785, -0.0040720468], readonly [1.9779984951, -2.428592205, 0.4505937099], readonly [0.0259040371, 0.7827717662, -0.808675766]];
|
|
3
|
-
export declare const SRGB_R: readonly [4.0765379686154635, -3.3070962248908753, 0.2308224615351424];
|
|
4
|
-
export declare const SRGB_G: readonly [-1.2686058016641382, 2.60974741090216, -0.3411636310115355];
|
|
5
|
-
export declare const SRGB_B: readonly [-0.004199535952631, -0.7035140435404212, 1.7072021573980527];
|
|
6
|
-
export declare const P3_R: readonly [3.128110529032312, -2.257075018354871, 0.1293047884378317];
|
|
7
|
-
export declare const P3_G: readonly [-1.0911281609083134, 2.4132667617599557, -0.3221681708589348];
|
|
8
|
-
export declare const P3_B: readonly [-0.0260136497064853, -0.5080276489512767, 1.5333166822296191];
|
|
9
|
-
export declare const EPSILON = 0.000001;
|
|
10
|
-
export declare const DEG_TO_RAD: number;
|
|
11
6
|
export type M = readonly (readonly number[])[];
|
|
12
7
|
export type V = readonly [number, number, number];
|
|
13
|
-
export declare const clamp01: (x: number) => number;
|
|
14
|
-
export interface Oklch {
|
|
15
|
-
l: number;
|
|
16
|
-
c: number;
|
|
17
|
-
h: number;
|
|
18
|
-
}
|
|
19
|
-
export type Gamut = 'srgb' | 'p3';
|
|
20
8
|
/** Measure a colour picked by eye. Its `c` is an ABSOLUTE chroma, not a seed's ratio. */
|
|
21
9
|
export declare function hexToOklch(hex: string): Oklch;
|
|
10
|
+
/** OKLCH to linear sRGB, unclamped: the engine's three channels, as the `[r, g, b]` tuple this library returns. */
|
|
22
11
|
export declare function oklchToLinearSrgb(l: number, c: number, h: number): V;
|
|
23
|
-
/** Section 6.7, the sRGB half
|
|
24
|
-
export declare function oklchToHex(
|
|
25
|
-
/**
|
|
26
|
-
* A number as CSS, rounded to 6 places and NEVER in exponent notation.
|
|
27
|
-
*
|
|
28
|
-
* The second half is load-bearing and is a workaround for somebody else's bug. esbuild --
|
|
29
|
-
* what Vite runs over a production stylesheet -- strips trailing zeros from a number token
|
|
30
|
-
* without first separating the mantissa from the exponent, so `4.656612873077393e-10`
|
|
31
|
-
* comes out of a minified build as `4.656612873077393e-1`. That is the difference between
|
|
32
|
-
* black and a mid grey, it happens only in a production build, and nothing warns.
|
|
33
|
-
*/
|
|
34
|
-
export declare function cssNumber(value: number): string;
|
|
12
|
+
/** Section 6.7, the sRGB half: the engine's hex, uppercase, to match everything the tokens repo emits. */
|
|
13
|
+
export declare function oklchToHex(color: Oklch): string;
|
|
35
14
|
//# sourceMappingURL=oklch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oklch.d.ts","sourceRoot":"","sources":["../../src/color/oklch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oklch.d.ts","sourceRoot":"","sources":["../../src/color/oklch.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAA;AAE1D,YAAY,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAA;AAC1D,YAAY,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAA;AAKjE,eAAO,MAAM,aAAa,sBACrB,YAAY,EAAE,YAAY,EAAE,YAAY,aACxC,YAAY,EAAE,YAAY,EAAE,YAAY,aACxC,YAAY,EAAE,YAAY,EAAE,YAAY,EACnC,CAAA;AACV,eAAO,MAAM,aAAa,sBACrB,YAAY,EAAE,WAAW,EAAE,CAAC,YAAY,aACxC,YAAY,EAAE,CAAC,WAAW,EAAE,YAAY,aACxC,YAAY,EAAE,YAAY,EAAE,CAAC,WAAW,EACnC,CAAA;AAEV,MAAM,MAAM,CAAC,GAAG,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAA;AAC9C,MAAM,MAAM,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAgBjD,yFAAyF;AACzF,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAW7C;AAED,mHAAmH;AACnH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,CAGpE;AAED,0GAA0G;AAC1G,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAE/C"}
|
package/dist/color/oklch.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
// The OKLCH colour space
|
|
2
|
-
//
|
|
1
|
+
// The OKLCH colour space where it is not the engine's: a hex measured in, and the two conversions this library has
|
|
2
|
+
// always published, kept to their call shapes over the engine's own.
|
|
3
3
|
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
4
|
+
// **The forward matrices, the transfer function and the gamut live in one place since 2026-11-14**: Newtone's palette
|
|
5
|
+
// engine, `@newtone-dev/ui-tokens/engine/vector` (newtone_ui_tokens/compute/vector.mjs), which this library imports
|
|
6
|
+
// live -- Joshua's decision, the HuevOS Core, page palette-engine. Until then this file carried its own full-precision
|
|
7
|
+
// copy of them (contract section 6.1's product, not Ottosson's rounding), held to the engine's bytes by a conformance
|
|
8
|
+
// runner. What is left here is what the engine does not do, and two adapters whose shapes differ from the engine's:
|
|
9
|
+
//
|
|
10
|
+
// hexToOklch section 6.3, the tooling path, with the OTHER matrix pair (below). Not the engine's.
|
|
11
|
+
// oklchToLinearSrgb the engine's channels, as the `[r, g, b]` tuple this library returned; the engine returns
|
|
12
|
+
// `{ r, g, b }`. The same three numbers, checked over 26,775 colours on 2026-11-14.
|
|
13
|
+
// oklchToHex the engine's hex, uppercase, as section 6.7 and everything the tokens repo emits are. The
|
|
14
|
+
// engine's own `oklchToHex` is lowercase and its `createScale` uppercases it, as this does.
|
|
8
15
|
//
|
|
9
16
|
// Private to `color/`. What leaves the folder is decided by index.ts.
|
|
17
|
+
import { oklchToHex as engineHex, oklchToLinearSrgb as engineLinearSrgb, } from '@newtone-dev/ui-tokens/engine/vector';
|
|
10
18
|
// Linear sRGB -> LMS, and LMS' -> OKLab. Section 6.3 only, OFF the derivation path.
|
|
11
|
-
// These are Ottosson's published values and are deliberately not the forward pair
|
|
19
|
+
// These are Ottosson's published values and are deliberately not the engine's forward pair:
|
|
12
20
|
// they serve `hexToOklch`, which measures a colour someone picked by eye.
|
|
13
21
|
export const LMS_FROM_LRGB = [
|
|
14
22
|
[0.4122214708, 0.5363325363, 0.0514459929],
|
|
@@ -20,28 +28,14 @@ export const LAB_FROM_LMSP = [
|
|
|
20
28
|
[1.9779984951, -2.428592205, 0.4505937099],
|
|
21
29
|
[0.0259040371, 0.7827717662, -0.808675766],
|
|
22
30
|
];
|
|
23
|
-
// ON the derivation path. The two forward matrices are the products of
|
|
24
|
-
// (XYZ -> RGB) x (LMS -> XYZ) carried at full double precision, NOT Ottosson's pre-rounded
|
|
25
|
-
// publication. About 4% of hexes move by one unit in one channel between the two; nothing
|
|
26
|
-
// is visible, and every byte is nonetheless different. Using the published rounding here
|
|
27
|
-
// breaks CHARTER.md non-negotiable 4 the moment this is compared with the tokens build.
|
|
28
|
-
export const SRGB_R = [4.0765379686154635, -3.3070962248908753, 0.2308224615351424];
|
|
29
|
-
export const SRGB_G = [-1.2686058016641382, 2.6097474109021599, -0.3411636310115355];
|
|
30
|
-
export const SRGB_B = [-0.004199535952631, -0.7035140435404212, 1.7072021573980527];
|
|
31
|
-
export const P3_R = [3.1281105290323121, -2.2570750183548709, 0.1293047884378317];
|
|
32
|
-
export const P3_G = [-1.0911281609083134, 2.4132667617599557, -0.3221681708589348];
|
|
33
|
-
export const P3_B = [-0.0260136497064853, -0.5080276489512767, 1.5333166822296191];
|
|
34
|
-
export const EPSILON = 1e-6;
|
|
35
|
-
export const DEG_TO_RAD = Math.PI / 180;
|
|
36
31
|
const mul = (m, v) => [
|
|
37
32
|
m[0][0] * v[0] + m[0][1] * v[1] + m[0][2] * v[2],
|
|
38
33
|
m[1][0] * v[0] + m[1][1] * v[1] + m[1][2] * v[2],
|
|
39
34
|
m[2][0] * v[0] + m[2][1] * v[1] + m[2][2] * v[2],
|
|
40
35
|
];
|
|
41
|
-
// Section 6.2
|
|
36
|
+
// Section 6.2's decode, for a hex coming in. Its encode, for a hex going out, is the engine's (inside oklchToHex).
|
|
37
|
+
// Two different thresholds; using one for both is the classic bug.
|
|
42
38
|
const decode = (x) => (x <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4));
|
|
43
|
-
const encode = (x) => (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
|
|
44
|
-
export const clamp01 = (x) => Math.max(0, Math.min(1, x));
|
|
45
39
|
// ---------------------------------------------------------------------------
|
|
46
40
|
// Section 6.3 -- hex to OKLCH. Tooling only; a seed no longer carries a hex.
|
|
47
41
|
// ---------------------------------------------------------------------------
|
|
@@ -59,45 +53,13 @@ export function hexToOklch(hex) {
|
|
|
59
53
|
h += 360;
|
|
60
54
|
return { l, c: Math.hypot(a, b), h };
|
|
61
55
|
}
|
|
56
|
+
/** OKLCH to linear sRGB, unclamped: the engine's three channels, as the `[r, g, b]` tuple this library returns. */
|
|
62
57
|
export function oklchToLinearSrgb(l, c, h) {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
const b = c * Math.sin(rad);
|
|
66
|
-
const l_ = l + 0.3963377774 * a + 0.2158037573 * b;
|
|
67
|
-
const m_ = l - 0.1055613458 * a - 0.0638541728 * b;
|
|
68
|
-
const s_ = l - 0.0894841775 * a - 1.291485548 * b;
|
|
69
|
-
const lc = l_ * l_ * l_;
|
|
70
|
-
const mc = m_ * m_ * m_;
|
|
71
|
-
const sc = s_ * s_ * s_;
|
|
72
|
-
return [
|
|
73
|
-
SRGB_R[0] * lc + SRGB_R[1] * mc + SRGB_R[2] * sc,
|
|
74
|
-
SRGB_G[0] * lc + SRGB_G[1] * mc + SRGB_G[2] * sc,
|
|
75
|
-
SRGB_B[0] * lc + SRGB_B[1] * mc + SRGB_B[2] * sc,
|
|
76
|
-
];
|
|
77
|
-
}
|
|
78
|
-
/** Section 6.7, the sRGB half. Uppercase, to match everything the tokens repo emits. */
|
|
79
|
-
export function oklchToHex({ l, c, h }) {
|
|
80
|
-
return ('#' +
|
|
81
|
-
oklchToLinearSrgb(l, c, h)
|
|
82
|
-
.map((x) => Math.round(encode(clamp01(x)) * 255))
|
|
83
|
-
.map((x) => x.toString(16).padStart(2, '0'))
|
|
84
|
-
.join('')
|
|
85
|
-
.toUpperCase());
|
|
58
|
+
const { r, g, b } = engineLinearSrgb(l, c, h);
|
|
59
|
+
return [r, g, b];
|
|
86
60
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* A number as CSS, rounded to 6 places and NEVER in exponent notation.
|
|
92
|
-
*
|
|
93
|
-
* The second half is load-bearing and is a workaround for somebody else's bug. esbuild --
|
|
94
|
-
* what Vite runs over a production stylesheet -- strips trailing zeros from a number token
|
|
95
|
-
* without first separating the mantissa from the exponent, so `4.656612873077393e-10`
|
|
96
|
-
* comes out of a minified build as `4.656612873077393e-1`. That is the difference between
|
|
97
|
-
* black and a mid grey, it happens only in a production build, and nothing warns.
|
|
98
|
-
*/
|
|
99
|
-
export function cssNumber(value) {
|
|
100
|
-
const trimmed = value.toFixed(6).replace(/\.?0+$/, '');
|
|
101
|
-
return trimmed === '-0' || trimmed === '' ? '0' : trimmed;
|
|
61
|
+
/** Section 6.7, the sRGB half: the engine's hex, uppercase, to match everything the tokens repo emits. */
|
|
62
|
+
export function oklchToHex(color) {
|
|
63
|
+
return engineHex(color).toUpperCase();
|
|
102
64
|
}
|
|
103
65
|
//# sourceMappingURL=oklch.js.map
|
package/dist/color/oklch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oklch.js","sourceRoot":"","sources":["../../src/color/oklch.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"oklch.js","sourceRoot":"","sources":["../../src/color/oklch.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,qEAAqE;AACrE,EAAE;AACF,sHAAsH;AACtH,oHAAoH;AACpH,uHAAuH;AACvH,sHAAsH;AACtH,oHAAoH;AACpH,EAAE;AACF,4GAA4G;AAC5G,iHAAiH;AACjH,yGAAyG;AACzG,iHAAiH;AACjH,iHAAiH;AACjH,EAAE;AACF,sEAAsE;AAEtE,OAAO,EACH,UAAU,IAAI,SAAS,EACvB,iBAAiB,IAAI,gBAAgB,GACxC,MAAM,sCAAsC,CAAA;AAM7C,oFAAoF;AACpF,4FAA4F;AAC5F,0EAA0E;AAC1E,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC;IAC1C,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC;IAC1C,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC;CACpC,CAAA;AACV,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,CAAC,YAAY,EAAE,WAAW,EAAE,CAAC,YAAY,CAAC;IAC1C,CAAC,YAAY,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC;IAC1C,CAAC,YAAY,EAAE,YAAY,EAAE,CAAC,WAAW,CAAC;CACpC,CAAA;AAKV,MAAM,GAAG,GAAG,CAAC,CAAI,EAAE,CAAI,EAAK,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACnD,CAAA;AAED,mHAAmH;AACnH,mEAAmE;AACnE,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,EAAE,GAAG,CAAC,CAAC,CAAA;AAE7F,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAE9E,yFAAyF;AACzF,MAAM,UAAU,UAAU,CAAC,GAAW;IAClC,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;IAC5C,MAAM,GAAG,GAAG,GAAG,CAAC,aAAa,EAAE;QAC3B,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;QAC/B,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;QAC9B,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;KAC1B,CAAC,CAAA;IACF,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAiB,CAAC,CAAA;IACxE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAA;IAC1C,IAAI,CAAC,GAAG,CAAC;QAAE,CAAC,IAAI,GAAG,CAAA;IACnB,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;AACxC,CAAC;AAED,mHAAmH;AACnH,MAAM,UAAU,iBAAiB,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS;IAC7D,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAC7C,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;AACpB,CAAC;AAED,0GAA0G;AAC1G,MAAM,UAAU,UAAU,CAAC,KAAY;IACnC,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAA;AACzC,CAAC"}
|
package/dist/color/scale.d.ts
CHANGED
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export { createScale as deriveScale } from '@newtone-dev/ui-tokens/engine';
|
|
2
|
+
export type { PaletteStep, SeedValue } from '@newtone-dev/ui-tokens/engine';
|
|
3
|
+
/** Fifty-one steps, index 0 to 50, at every Contrast: the HuevOS Core, newtone-color rule 2. */
|
|
3
4
|
export declare const STEPS = 51;
|
|
4
|
-
export interface PaletteStep {
|
|
5
|
-
oklch: Oklch;
|
|
6
|
-
srgb: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* One palette's fifty-one steps, from a hue and a saturation ratio.
|
|
10
|
-
*
|
|
11
|
-
* Derived TWICE, not encoded twice: the hex comes off a vector clamped to the sRGB
|
|
12
|
-
* ceiling and the OKLCH channels off one at the P3 ceiling. Where a colour fits inside
|
|
13
|
-
* sRGB the two agree; where it does not they do not round-trip, and that is section 6.7
|
|
14
|
-
* rather than a rounding artefact.
|
|
15
|
-
*
|
|
16
|
-
* Quantised at 6 places for `l` and `c` -- which is what makes the L* = 0 endpoint round
|
|
17
|
-
* to exactly 0 rather than to 4.66e-10 -- and 2 for `h`, a seed input never searched for.
|
|
18
|
-
*/
|
|
19
|
-
export declare function deriveScale(hue: number, chroma: number): PaletteStep[];
|
|
20
5
|
//# sourceMappingURL=scale.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scale.d.ts","sourceRoot":"","sources":["../../src/color/scale.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scale.d.ts","sourceRoot":"","sources":["../../src/color/scale.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,WAAW,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAC1E,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAE3E,gGAAgG;AAChG,eAAO,MAAM,KAAK,KAAK,CAAA"}
|
package/dist/color/scale.js
CHANGED
|
@@ -1,75 +1,18 @@
|
|
|
1
|
-
//
|
|
1
|
+
// The fifty-one steps: Newtone's palette engine itself, not a copy of it.
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
3
|
+
// `deriveScale` IS `createScale` from `@newtone-dev/ui-tokens/engine` (newtone_ui_tokens/compute/scale.mjs), the
|
|
4
|
+
// module the tokens build runs, imported live since 2026-11-14 -- Joshua's decision, the HuevOS Core, page
|
|
5
|
+
// palette-engine. So what a seed may be here is what it may be there: a hue and a chroma, each one number or a curve
|
|
6
|
+
// `{ start, end, curve? }` across the steps (the HuevOS Core, page newtone-color), and `floor` and `ceiling` the two
|
|
7
|
+
// L* ends a seed's Contrast sets (newtone-color rule 4). Left out, they are 0 and 100: the absolute ladder.
|
|
8
|
+
//
|
|
9
|
+
// **This file held the port's lightness search until 2026-11-14, and `gamut.ts` its gamut maths.** Both were deleted
|
|
10
|
+
// that day, after the old `deriveScale(h, c)` and the engine's `createScale(h, c)` gave the same `{ oklch, srgb }`,
|
|
11
|
+
// byte for byte, at every step of 525 seeds (hues every 15 degrees, c from 0 to 1 by 0.05); the hex was uppercase on
|
|
12
|
+
// both sides. The engine changes only when Joshua asks (palette-engine rule 1), and never from here.
|
|
5
13
|
//
|
|
6
14
|
// Private to `color/`. What leaves the folder is decided by index.ts.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
|
-
// Section 6.5 -- CIE L*, and the lightness search
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
|
-
const DELTA = 6 / 29;
|
|
13
|
-
const DELTA_SQ = DELTA * DELTA;
|
|
14
|
-
const DELTA_CU = DELTA * DELTA * DELTA;
|
|
15
|
-
function cieLstar({ l, c, h }) {
|
|
16
|
-
const [r, g, b] = oklchToLinearSrgb(l, c, h);
|
|
17
|
-
const y = 0.2126 * clamp01(r) + 0.7152 * clamp01(g) + 0.0722 * clamp01(b);
|
|
18
|
-
// The linear branch is not decoration: without it the curve has infinite slope at zero
|
|
19
|
-
// and the search below cannot converge on the last step.
|
|
20
|
-
const f = y > DELTA_CU ? Math.cbrt(y) : y / (3 * DELTA_SQ) + 4 / 29;
|
|
21
|
-
return 116 * f - 16;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* The colour whose CIE L* is `target`, found by bisection on OKLCH lightness.
|
|
25
|
-
*
|
|
26
|
-
* The colour is rebuilt at every probe, CHROMA INCLUDED: chroma depends on lightness
|
|
27
|
-
* through the ceiling, and luminance depends on chroma. Searching on lightness while
|
|
28
|
-
* holding chroma fixed converges on the wrong L.
|
|
29
|
-
*/
|
|
30
|
-
function atLstar(hue, chroma, gamut, target) {
|
|
31
|
-
let lo = 0;
|
|
32
|
-
let hi = 1;
|
|
33
|
-
for (let i = 0; i < 30; i++) {
|
|
34
|
-
const mid = (lo + hi) / 2;
|
|
35
|
-
if (cieLstar(colorAt(hue, chroma, gamut, mid)) < target)
|
|
36
|
-
lo = mid;
|
|
37
|
-
else
|
|
38
|
-
hi = mid;
|
|
39
|
-
}
|
|
40
|
-
return colorAt(hue, chroma, gamut, (lo + hi) / 2);
|
|
41
|
-
}
|
|
42
|
-
// ---------------------------------------------------------------------------
|
|
43
|
-
// Section 3 -- the palette
|
|
44
|
-
// ---------------------------------------------------------------------------
|
|
45
|
-
/** Fifty-one steps, index 0 to 50. Fixed by section 5.1, not by the colour maths. */
|
|
15
|
+
export { createScale as deriveScale } from '@newtone-dev/ui-tokens/engine';
|
|
16
|
+
/** Fifty-one steps, index 0 to 50, at every Contrast: the HuevOS Core, newtone-color rule 2. */
|
|
46
17
|
export const STEPS = 51;
|
|
47
|
-
/**
|
|
48
|
-
* One palette's fifty-one steps, from a hue and a saturation ratio.
|
|
49
|
-
*
|
|
50
|
-
* Derived TWICE, not encoded twice: the hex comes off a vector clamped to the sRGB
|
|
51
|
-
* ceiling and the OKLCH channels off one at the P3 ceiling. Where a colour fits inside
|
|
52
|
-
* sRGB the two agree; where it does not they do not round-trip, and that is section 6.7
|
|
53
|
-
* rather than a rounding artefact.
|
|
54
|
-
*
|
|
55
|
-
* Quantised at 6 places for `l` and `c` -- which is what makes the L* = 0 endpoint round
|
|
56
|
-
* to exactly 0 rather than to 4.66e-10 -- and 2 for `h`, a seed input never searched for.
|
|
57
|
-
*/
|
|
58
|
-
export function deriveScale(hue, chroma) {
|
|
59
|
-
const out = [];
|
|
60
|
-
for (let step = 0; step < STEPS; step++) {
|
|
61
|
-
const target = Math.max(0, 100 - step * 2);
|
|
62
|
-
const p3 = atLstar(hue, chroma, 'p3', target);
|
|
63
|
-
const srgb = atLstar(hue, chroma, 'srgb', target);
|
|
64
|
-
out.push({
|
|
65
|
-
oklch: {
|
|
66
|
-
l: Number(p3.l.toFixed(6)),
|
|
67
|
-
c: Number(p3.c.toFixed(6)),
|
|
68
|
-
h: Number(p3.h.toFixed(2)),
|
|
69
|
-
},
|
|
70
|
-
srgb: oklchToHex(srgb),
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
return out;
|
|
74
|
-
}
|
|
75
18
|
//# sourceMappingURL=scale.js.map
|
package/dist/color/scale.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scale.js","sourceRoot":"","sources":["../../src/color/scale.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"scale.js","sourceRoot":"","sources":["../../src/color/scale.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,iHAAiH;AACjH,2GAA2G;AAC3G,qHAAqH;AACrH,qHAAqH;AACrH,4GAA4G;AAC5G,EAAE;AACF,qHAAqH;AACrH,oHAAoH;AACpH,qHAAqH;AACrH,qGAAqG;AACrG,EAAE;AACF,sEAAsE;AAEtE,OAAO,EAAE,WAAW,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAG1E,gGAAgG;AAChG,MAAM,CAAC,MAAM,KAAK,GAAG,EAAE,CAAA"}
|
package/dist/color/seeds.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SeedValue } from './scale.js';
|
|
1
2
|
/**
|
|
2
3
|
* One palette's seed: a hue and a saturation. Shaped exactly like `seed.json`.
|
|
3
4
|
*
|
|
@@ -5,36 +6,75 @@
|
|
|
5
6
|
* hue -- not an amount of chroma. It is therefore comparable across palettes, and `c = 1`
|
|
6
7
|
* is the gamut boundary rather than an error. See contracts/seeds.md section 1.
|
|
7
8
|
*
|
|
9
|
+
* **Each is one number, the same at every step, or a curve across the steps** (since 2026-11-14; the HuevOS Core,
|
|
10
|
+
* page newtone-color): `{ start, end, curve? }`, the value at step 0 and at step 50, travelling between them in a
|
|
11
|
+
* straight line, or with `curve: [x1, x2]` along the Bézier whose handles sit on its two caps. The type is the
|
|
12
|
+
* engine's own, `SeedValue`, because the engine is what reads it.
|
|
13
|
+
*
|
|
8
14
|
* There is no lightness, because lightness is a property of the job a colour is doing and
|
|
9
15
|
* the job is not known until a role asks for it. There is no `key` either: a key selects
|
|
10
16
|
* which step a role reads, and roles are references resolved at build time.
|
|
11
17
|
*
|
|
12
|
-
* **`h` and `c` are both narrower than
|
|
13
|
-
* section 1.1: a hue is a whole number of degrees and a saturation carries at most two decimal
|
|
14
|
-
*
|
|
15
|
-
* be erased the moment a seed arrives through `JSON.parse` or an identity API -- which is how every
|
|
18
|
+
* **`h` and `c` are both narrower than their types, and the narrowing is not here.** contracts/seeds.md
|
|
19
|
+
* section 1.1: a hue is a whole number of degrees and a saturation carries at most two decimal places, and a curve's
|
|
20
|
+
* `start` and `end` are held to the same. TypeScript cannot say either of those about a `number`, and anything it
|
|
21
|
+
* could say would be erased the moment a seed arrives through `JSON.parse` or an identity API -- which is how every
|
|
16
22
|
* seed in this house arrives. **So `validateSeeds` below is the type**, and asked to "fix the type"
|
|
17
23
|
* this is the honest answer: the interface names the fields, the validator names the values.
|
|
18
24
|
*/
|
|
19
25
|
export interface Seed {
|
|
20
|
-
h:
|
|
21
|
-
c:
|
|
26
|
+
h: SeedValue;
|
|
27
|
+
c: SeedValue;
|
|
22
28
|
}
|
|
23
29
|
export type SeedGroup = 'system' | 'custom';
|
|
24
30
|
/** Group, then palette, then the seed. Any subset; what is absent is inherited. */
|
|
25
31
|
export type Seeds = Partial<Record<SeedGroup, Record<string, Seed>>>;
|
|
32
|
+
/**
|
|
33
|
+
* A seed's Contrast, `contrast: { light, dark }` in seed.json: how far each end of the ladder pulls in from pure white and
|
|
34
|
+
* pure black, each a level from -2 to +2, 0 where left out (the HuevOS Core, newtone-color rule 4). Both read the
|
|
35
|
+
* same way (Joshua 2026-11-14): +2 brighter, -2 darker. The light end's L* is 96 + 2 x light and the dark end's
|
|
36
|
+
* 8 + 4 x dark, so 0 and 0 run from L* 96 to L* 8, and light +2 with dark -2 is the absolute ladder itself, L* 100 to 0.
|
|
37
|
+
*/
|
|
38
|
+
export interface SeedContrast {
|
|
39
|
+
light?: number;
|
|
40
|
+
dark?: number;
|
|
41
|
+
}
|
|
26
42
|
/**
|
|
27
43
|
* Every way this seed set breaks the contract, as the build's own message strings.
|
|
28
44
|
*
|
|
29
45
|
* **Every violation, not the first.** Somebody who has just edited six numbers should not have
|
|
30
46
|
* to run six times to find six mistakes -- contracts/seeds.md section 7.
|
|
31
47
|
*
|
|
32
|
-
*
|
|
48
|
+
* **A curve is checked as the build checks it** (since 2026-11-14): a system palette's `h` and `c`, and a custom
|
|
49
|
+
* palette's `h`, may each be one, and its refusals are the build's seven curve messages, word for word.
|
|
50
|
+
*
|
|
51
|
+
* Four differences from the build, all deliberate. A palette may be ABSENT here: a runtime seed
|
|
33
52
|
* is a partial override and what it does not name inherits, where seed.json must name
|
|
34
|
-
* everything.
|
|
35
|
-
* whatever accepts runtime seeds, because seed.json is the authored
|
|
36
|
-
* saturation is ours and belongs.
|
|
53
|
+
* everything. A `custom` saturation is REJECTED here, a curve as much as a number: section 7
|
|
54
|
+
* delegates that one rule to whatever accepts runtime seeds, because seed.json is the authored
|
|
55
|
+
* default where the saturation is ours and belongs. A `custom` hue is held to its palette's
|
|
56
|
+
* range here and to the circle in the build: section 7 says so, and issue 184 is where the
|
|
57
|
+
* runtime catches up. And a `custom` palette is refused BY NAME when it comes without its
|
|
58
|
+
* saturation, so that no custom palette is ever accepted (since 2026-11-14): the saturation it
|
|
59
|
+
* needs is seed.json's, which no runtime seed carries, so there is nothing to derive it from.
|
|
60
|
+
* Until then the engine itself threw a TypeError on the missing `c`, past a validator that had
|
|
61
|
+
* said yes -- and this function is the type (`Seed` above), so what it accepts must derive.
|
|
37
62
|
*/
|
|
38
63
|
export declare function validateSeeds(seeds: Seeds): string[];
|
|
39
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Turn a set of seeds into the custom properties that re-derive those palettes.
|
|
66
|
+
*
|
|
67
|
+
* Derivation is atomic: a palette named here has all fifty-one steps recomputed, and one
|
|
68
|
+
* not named is untouched, so it inherits from the enclosing scope. That inheritance is
|
|
69
|
+
* CSS's, not ours -- which is why nesting works to any depth for free.
|
|
70
|
+
*
|
|
71
|
+
* **Two ladders per palette, as the build emits them** (since 2026-11-14): the absolute one, L* 100 to 0, as
|
|
72
|
+
* `--newtone-color-<group>-<name>-<step>`, which `fixed()` and ink() reads; and the one `contrast` sets, from its
|
|
73
|
+
* light end down to its dark end, as `--newtone-color-contrast-<group>-<name>-<step>`, which every role reads. `contrast` is
|
|
74
|
+
* the seed's Contrast, 0 and 0 where left out (L* 96 to 8). With light +2 and dark -2 the pulled-in ladder IS the absolute
|
|
75
|
+
* one, the build emits no second group and its roles read the absolute ladder, so nothing more is written here
|
|
76
|
+
* either. Until 2026-11-14 a preview wrote the absolute ladder alone, which the roles no longer read since Range (now Contrast)
|
|
77
|
+
* arrived, so a Style Book or Appearance preview moved a button's ink and not the roles around it.
|
|
78
|
+
*/
|
|
79
|
+
export declare function seedProperties(seeds: Seeds, wide?: boolean, contrast?: SeedContrast): Record<string, string>;
|
|
40
80
|
//# sourceMappingURL=seeds.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seeds.d.ts","sourceRoot":"","sources":["../../src/color/seeds.ts"],"names":[],"mappings":"AAcA
|
|
1
|
+
{"version":3,"file":"seeds.d.ts","sourceRoot":"","sources":["../../src/color/seeds.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,YAAY,CAAA;AAMxD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,IAAI;IACjB,CAAC,EAAE,SAAS,CAAA;IACZ,CAAC,EAAE,SAAS,CAAA;CACf;AAED,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAE3C,mFAAmF;AACnF,MAAM,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;AAEpE;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB;AAyID;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE,CA6BpD;AA2BD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC1B,KAAK,EAAE,KAAK,EACZ,IAAI,UAAiB,EACrB,QAAQ,GAAE,YAAiB,GAC5B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA+BxB"}
|