@memberjunction/theme-engine 0.0.0 → 5.49.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/README.md +50 -43
- package/dist/color.d.ts +37 -0
- package/dist/color.d.ts.map +1 -0
- package/dist/color.js +130 -0
- package/dist/color.js.map +1 -0
- package/dist/contrast.d.ts +49 -0
- package/dist/contrast.d.ts.map +1 -0
- package/dist/contrast.js +67 -0
- package/dist/contrast.js.map +1 -0
- package/dist/derive.d.ts +68 -0
- package/dist/derive.d.ts.map +1 -0
- package/dist/derive.js +238 -0
- package/dist/derive.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/logo.d.ts +74 -0
- package/dist/logo.d.ts.map +1 -0
- package/dist/logo.js +137 -0
- package/dist/logo.js.map +1 -0
- package/dist/ramps.d.ts +39 -0
- package/dist/ramps.d.ts.map +1 -0
- package/dist/ramps.js +103 -0
- package/dist/ramps.js.map +1 -0
- package/dist/seeds.d.ts +53 -0
- package/dist/seeds.d.ts.map +1 -0
- package/dist/seeds.js +41 -0
- package/dist/seeds.js.map +1 -0
- package/package.json +28 -7
package/dist/ramps.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Perceptual ramp generation (audit G5). Each brand family carries a
|
|
3
|
+
* measured OKLCH "shape" (per-step lightness + chroma) lifted from MJ's own default
|
|
4
|
+
* ramps. A seed supplies the HUE (and a chroma scale relative to the family anchor);
|
|
5
|
+
* we re-hue the shape and rescale its chroma. Feeding MJ's own seeds back therefore
|
|
6
|
+
* reproduces MJ's ramps within rounding tolerance, while any other hue inherits MJ's
|
|
7
|
+
* proven, perceptually-uniform lightness structure.
|
|
8
|
+
* @module @memberjunction/theme-engine
|
|
9
|
+
*/
|
|
10
|
+
import { hexToOKLCH, oklchToHex } from './color.js';
|
|
11
|
+
/** Measured shape of MJ's primary blue ramp. `anchor` is the step the seed maps to. */
|
|
12
|
+
export const BRAND_SHAPE = [
|
|
13
|
+
{ step: 50, L: 0.9562, C: 0.016 },
|
|
14
|
+
{ step: 100, L: 0.8687, C: 0.0488 },
|
|
15
|
+
{ step: 200, L: 0.7832, C: 0.0801 },
|
|
16
|
+
{ step: 300, L: 0.7017, C: 0.1074 },
|
|
17
|
+
{ step: 350, L: 0.6361, C: 0.117 },
|
|
18
|
+
{ step: 400, L: 0.6447, C: 0.1229 },
|
|
19
|
+
{ step: 450, L: 0.5952, C: 0.1237 },
|
|
20
|
+
{ step: 500, L: 0.544, C: 0.1322 },
|
|
21
|
+
{ step: 600, L: 0.5033, C: 0.1211 },
|
|
22
|
+
{ step: 700, L: 0.448, C: 0.1064 },
|
|
23
|
+
{ step: 800, L: 0.391, C: 0.0911 },
|
|
24
|
+
{ step: 900, L: 0.254, C: 0.0633 },
|
|
25
|
+
];
|
|
26
|
+
/** Measured shape of MJ's accent ramp. Accent seed maps to the 400 slot. */
|
|
27
|
+
export const ACCENT_SHAPE = [
|
|
28
|
+
{ step: 50, L: 0.9791, C: 0.0125 },
|
|
29
|
+
{ step: 100, L: 0.9554, C: 0.025 },
|
|
30
|
+
{ step: 200, L: 0.9055, C: 0.0555 },
|
|
31
|
+
{ step: 300, L: 0.894, C: 0.0686 },
|
|
32
|
+
{ step: 400, L: 0.7656, C: 0.1131 },
|
|
33
|
+
{ step: 500, L: 0.6927, C: 0.1209 },
|
|
34
|
+
{ step: 600, L: 0.6167, C: 0.1171 },
|
|
35
|
+
{ step: 700, L: 0.5217, C: 0.0983 },
|
|
36
|
+
{ step: 800, L: 0.4533, C: 0.0822 },
|
|
37
|
+
{ step: 900, L: 0.3998, C: 0.0696 },
|
|
38
|
+
];
|
|
39
|
+
/** Measured shape of MJ's tertiary cyan ramp. Tertiary seed maps to the 500 slot. */
|
|
40
|
+
export const TERTIARY_SHAPE = [
|
|
41
|
+
{ step: 50, L: 0.9841, C: 0.0189 },
|
|
42
|
+
{ step: 100, L: 0.9563, C: 0.0443 },
|
|
43
|
+
{ step: 200, L: 0.9167, C: 0.0772 },
|
|
44
|
+
{ step: 300, L: 0.8651, C: 0.1153 },
|
|
45
|
+
{ step: 400, L: 0.7971, C: 0.1339 },
|
|
46
|
+
{ step: 500, L: 0.7148, C: 0.1257 },
|
|
47
|
+
{ step: 600, L: 0.6089, C: 0.1109 },
|
|
48
|
+
{ step: 700, L: 0.5198, C: 0.0936 },
|
|
49
|
+
{ step: 800, L: 0.45, C: 0.0771 },
|
|
50
|
+
{ step: 900, L: 0.3982, C: 0.0664 },
|
|
51
|
+
];
|
|
52
|
+
/** Measured shape of MJ's slate neutral ramp. Chroma is driven by the `neutralChroma` seed. */
|
|
53
|
+
export const NEUTRAL_SHAPE = [
|
|
54
|
+
{ step: 0, L: 1, C: 0 },
|
|
55
|
+
{ step: 50, L: 0.9842, C: 0.0034 },
|
|
56
|
+
{ step: 100, L: 0.9683, C: 0.0069 },
|
|
57
|
+
{ step: 200, L: 0.9288, C: 0.0126 },
|
|
58
|
+
{ step: 300, L: 0.869, C: 0.0198 },
|
|
59
|
+
{ step: 400, L: 0.7107, C: 0.0351 },
|
|
60
|
+
{ step: 500, L: 0.5544, C: 0.0407 },
|
|
61
|
+
{ step: 600, L: 0.4455, C: 0.0374 },
|
|
62
|
+
{ step: 700, L: 0.3717, C: 0.0392 },
|
|
63
|
+
{ step: 800, L: 0.2795, C: 0.0368 },
|
|
64
|
+
{ step: 900, L: 0.2077, C: 0.0398 },
|
|
65
|
+
{ step: 950, L: 0.1288, C: 0.0406 },
|
|
66
|
+
];
|
|
67
|
+
/** Chroma of the neutral shape at its mid step, i.e. the `neutralChroma` reference point. */
|
|
68
|
+
export const NEUTRAL_REFERENCE_CHROMA = 0.0407;
|
|
69
|
+
/** The step in each brand family that its seed color represents. */
|
|
70
|
+
export const FAMILY_ANCHOR = {
|
|
71
|
+
brand: 500,
|
|
72
|
+
accent: 400,
|
|
73
|
+
tertiary: 500,
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Re-hue and re-scale a family shape from a seed color. Every step keeps the shape's
|
|
77
|
+
* lightness; its hue becomes the seed's hue; its chroma is the shape chroma scaled so
|
|
78
|
+
* the anchor step matches the seed's chroma, times `vibrancy`.
|
|
79
|
+
*/
|
|
80
|
+
export function generateBrandRamp(shape, anchorStep, seedHex, vibrancy) {
|
|
81
|
+
const seed = hexToOKLCH(seedHex);
|
|
82
|
+
const anchorC = shape.find((s) => s.step === anchorStep)?.C ?? 1;
|
|
83
|
+
const chromaScale = (anchorC > 0 ? seed.c / anchorC : 1) * vibrancy;
|
|
84
|
+
const out = {};
|
|
85
|
+
for (const stop of shape) {
|
|
86
|
+
const color = { l: stop.L, c: stop.C * chromaScale, h: seed.h };
|
|
87
|
+
out[stop.step] = oklchToHex(color);
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The neutral ramp: shape lightness preserved, hue bled from the brand (G2), chroma
|
|
93
|
+
* scaled to the requested `neutralChroma` mid-target.
|
|
94
|
+
*/
|
|
95
|
+
export function generateNeutralRamp(brandHueDeg, neutralChroma) {
|
|
96
|
+
const chromaScale = neutralChroma / NEUTRAL_REFERENCE_CHROMA;
|
|
97
|
+
const out = {};
|
|
98
|
+
for (const stop of NEUTRAL_SHAPE) {
|
|
99
|
+
out[stop.step] = oklchToHex({ l: stop.L, c: stop.C * chromaScale, h: brandHueDeg });
|
|
100
|
+
}
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=ramps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ramps.js","sourceRoot":"","sources":["../src/ramps.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAS,MAAM,YAAY,CAAC;AAS3D,uFAAuF;AACvF,MAAM,CAAC,MAAM,W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;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAAmB,EAAE,aAAqB;IAC5E,MAAM,WAAW,GAAG,aAAa,GAAG,wBAAwB,CAAC;IAC7D,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;QACjC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;IACtF,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/seeds.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The brand "seed" set (org theming decision #2 / proposal 16.5):
|
|
3
|
+
* a theme stores ~8 seeds, NOT tokens. The full --mj-* contract is derived from
|
|
4
|
+
* these at load. A theme is a *brand*; light/dark is the user's mode layered under
|
|
5
|
+
* it, so seeds carry no per-mode values.
|
|
6
|
+
* @module @memberjunction/theme-engine
|
|
7
|
+
*/
|
|
8
|
+
/** The small set of brand inputs an org actually authors. Only `primary` is required. */
|
|
9
|
+
export interface ThemeSeeds {
|
|
10
|
+
/** Primary brand hue anchor (hex). Placed at the brand-500 slot. */
|
|
11
|
+
primary: string;
|
|
12
|
+
/** Accent hue anchor (hex) — light highlights/emphasis. Defaults to `primary`. */
|
|
13
|
+
accent?: string;
|
|
14
|
+
/** Optional tertiary hue anchor (hex) — secondary actions/info. Defaults to `accent`. */
|
|
15
|
+
tertiary?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Neutral character (audit G2): OKLCH chroma of the mid-neutral, i.e. how much
|
|
18
|
+
* brand hue bleeds into the gray stack. 0 = pure gray, ~0.08 = strongly tinted.
|
|
19
|
+
* Default 0.037 reproduces MJ's slate neutrals.
|
|
20
|
+
*/
|
|
21
|
+
neutralChroma?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Vibrancy: global saturation multiplier for the brand/accent/tertiary ramps.
|
|
24
|
+
* 1 = as-seeded; <1 muted, >1 punchier. Default 1.
|
|
25
|
+
*/
|
|
26
|
+
vibrancy?: number;
|
|
27
|
+
/** Shape: base corner radius in px, mapped to --mj-radius-md. Default 8. */
|
|
28
|
+
radius?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Depth (audit G3): elevation intensity 0..1 driving brand-tinted shadow
|
|
31
|
+
* strength. 1 reproduces MJ's brand shadows. Default 1.
|
|
32
|
+
*/
|
|
33
|
+
depth?: number;
|
|
34
|
+
/** Type (audit G1): body font stack -> --mj-font-family. Default MJ Inter stack. */
|
|
35
|
+
fontFamily?: string;
|
|
36
|
+
/** Monospace font stack -> --mj-font-family-mono. */
|
|
37
|
+
fontFamilyMono?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Viz (audit G4): explicit categorical chart palette override. When omitted the
|
|
40
|
+
* palette is derived by rotating hue around the brand.
|
|
41
|
+
*/
|
|
42
|
+
vizPalette?: string[];
|
|
43
|
+
}
|
|
44
|
+
/** Seeds with every optional field resolved to its default. */
|
|
45
|
+
export type ResolvedSeeds = Required<Omit<ThemeSeeds, 'vizPalette'>> & Pick<ThemeSeeds, 'vizPalette'>;
|
|
46
|
+
/**
|
|
47
|
+
* Seeds that, when derived, reproduce MJ's own default theme within tolerance.
|
|
48
|
+
* Used as the fixture for the reproduction test and as the fallback theme.
|
|
49
|
+
*/
|
|
50
|
+
export declare const MJ_DEFAULT_SEEDS: ThemeSeeds;
|
|
51
|
+
/** Fill in seed defaults. */
|
|
52
|
+
export declare function resolveSeeds(seeds: ThemeSeeds): ResolvedSeeds;
|
|
53
|
+
//# sourceMappingURL=seeds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seeds.d.ts","sourceRoot":"","sources":["../src/seeds.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,yFAAyF;AACzF,MAAM,WAAW,UAAU;IACzB,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yFAAyF;IACzF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,+DAA+D;AAC/D,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAKtG;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,UAU9B,CAAC;AAEF,6BAA6B;AAC7B,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,aAAa,CAc7D"}
|
package/dist/seeds.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The brand "seed" set (org theming decision #2 / proposal 16.5):
|
|
3
|
+
* a theme stores ~8 seeds, NOT tokens. The full --mj-* contract is derived from
|
|
4
|
+
* these at load. A theme is a *brand*; light/dark is the user's mode layered under
|
|
5
|
+
* it, so seeds carry no per-mode values.
|
|
6
|
+
* @module @memberjunction/theme-engine
|
|
7
|
+
*/
|
|
8
|
+
const MJ_FONT = "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif";
|
|
9
|
+
const MJ_FONT_MONO = "'JetBrains Mono', 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace";
|
|
10
|
+
/**
|
|
11
|
+
* Seeds that, when derived, reproduce MJ's own default theme within tolerance.
|
|
12
|
+
* Used as the fixture for the reproduction test and as the fallback theme.
|
|
13
|
+
*/
|
|
14
|
+
export const MJ_DEFAULT_SEEDS = {
|
|
15
|
+
primary: '#0076b6',
|
|
16
|
+
accent: '#5cc0ed',
|
|
17
|
+
tertiary: '#06b6d4',
|
|
18
|
+
neutralChroma: 0.037,
|
|
19
|
+
vibrancy: 1,
|
|
20
|
+
radius: 8,
|
|
21
|
+
depth: 1,
|
|
22
|
+
fontFamily: MJ_FONT,
|
|
23
|
+
fontFamilyMono: MJ_FONT_MONO,
|
|
24
|
+
};
|
|
25
|
+
/** Fill in seed defaults. */
|
|
26
|
+
export function resolveSeeds(seeds) {
|
|
27
|
+
const accent = seeds.accent ?? seeds.primary;
|
|
28
|
+
return {
|
|
29
|
+
primary: seeds.primary,
|
|
30
|
+
accent,
|
|
31
|
+
tertiary: seeds.tertiary ?? accent,
|
|
32
|
+
neutralChroma: seeds.neutralChroma ?? 0.037,
|
|
33
|
+
vibrancy: seeds.vibrancy ?? 1,
|
|
34
|
+
radius: seeds.radius ?? 8,
|
|
35
|
+
depth: seeds.depth ?? 1,
|
|
36
|
+
fontFamily: seeds.fontFamily ?? MJ_FONT,
|
|
37
|
+
fontFamilyMono: seeds.fontFamilyMono ?? MJ_FONT_MONO,
|
|
38
|
+
vizPalette: seeds.vizPalette,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=seeds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seeds.js","sourceRoot":"","sources":["../src/seeds.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA0CH,MAAM,OAAO,GAAG,qGAAqG,CAAC;AACtH,MAAM,YAAY,GAAG,4EAA4E,CAAC;AAElG;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAe;IAC1C,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE,SAAS;IACnB,aAAa,EAAE,KAAK;IACpB,QAAQ,EAAE,CAAC;IACX,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,UAAU,EAAE,OAAO;IACnB,cAAc,EAAE,YAAY;CAC7B,CAAC;AAEF,6BAA6B;AAC7B,MAAM,UAAU,YAAY,CAAC,KAAiB;IAC5C,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC;IAC7C,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,MAAM;QACN,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,MAAM;QAClC,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,KAAK;QAC3C,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,CAAC;QAC7B,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC;QACzB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,CAAC;QACvB,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,OAAO;QACvC,cAAc,EAAE,KAAK,CAAC,cAAc,IAAI,YAAY;QACpD,UAAU,EAAE,KAAK,CAAC,UAAU;KAC7B,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/theme-engine",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "5.49.0",
|
|
5
|
+
"description": "MemberJunction: Theme Engine - framework-agnostic derivation of the full --mj-* token contract from a small set of brand seeds (OKLCH ramps, state families, dark re-point, viz palette, shadows, a11y contrast report). Shared by the Angular theme builder and future server overlay endpoint.",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"/dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc && tsc-alias -f",
|
|
20
|
+
"test": "vitest run"
|
|
21
|
+
},
|
|
22
|
+
"author": "MemberJunction.com",
|
|
23
|
+
"license": "ISC",
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"typescript": "^5.9.3"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/MemberJunction/MJ"
|
|
30
|
+
}
|
|
10
31
|
}
|