@kya-os/consent 0.1.49 → 0.2.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 +75 -9
- package/dist/bundle/browser.d.ts +18 -0
- package/dist/bundle/browser.d.ts.map +1 -0
- package/dist/bundle/browser.js +18 -0
- package/dist/bundle/browser.js.map +1 -0
- package/dist/bundle/inline.d.ts.map +1 -1
- package/dist/bundle/inline.js +4 -4
- package/dist/bundle/inline.js.map +1 -1
- package/dist/bundle/shell.d.ts +4 -2
- package/dist/bundle/shell.d.ts.map +1 -1
- package/dist/bundle/shell.js +16 -43
- package/dist/bundle/shell.js.map +1 -1
- package/dist/cjs/bundle/inline.js +4 -4
- package/dist/cjs/bundle/inline.js.map +1 -1
- package/dist/cjs/bundle/shell.js +16 -43
- package/dist/cjs/bundle/shell.js.map +1 -1
- package/dist/cjs/components/consent-agent-header.js +81 -21
- package/dist/cjs/components/consent-agent-header.js.map +1 -1
- package/dist/cjs/components/consent-button.js +16 -13
- package/dist/cjs/components/consent-button.js.map +1 -1
- package/dist/cjs/components/consent-capabilities-screen.js +15 -5
- package/dist/cjs/components/consent-capabilities-screen.js.map +1 -1
- package/dist/cjs/components/consent-checkbox.js +21 -17
- package/dist/cjs/components/consent-checkbox.js.map +1 -1
- package/dist/cjs/components/consent-connector-header.js +14 -3
- package/dist/cjs/components/consent-connector-header.js.map +1 -1
- package/dist/cjs/components/consent-permissions.js +16 -15
- package/dist/cjs/components/consent-permissions.js.map +1 -1
- package/dist/cjs/components/consent-revocation-notice.js +23 -5
- package/dist/cjs/components/consent-revocation-notice.js.map +1 -1
- package/dist/cjs/components/consent-shell.js +35 -17
- package/dist/cjs/components/consent-shell.js.map +1 -1
- package/dist/cjs/components/consent-terms.js +27 -23
- package/dist/cjs/components/consent-terms.js.map +1 -1
- package/dist/cjs/components/mcp-consent.js +222 -45
- package/dist/cjs/components/mcp-consent.js.map +1 -1
- package/dist/cjs/constants/auth-modes.js +1 -1
- package/dist/cjs/constants/auth-modes.js.map +1 -1
- package/dist/cjs/constants/colors.js +7 -2
- package/dist/cjs/constants/colors.js.map +1 -1
- package/dist/cjs/constants/defaults.js +1 -1
- package/dist/cjs/copy/tokens.js +45 -1
- package/dist/cjs/copy/tokens.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/mcp-app/inline.js +2 -2
- package/dist/cjs/mcp-app/inline.js.map +1 -1
- package/dist/cjs/react/index.js +1 -1
- package/dist/cjs/resolution/resolve-branding.js +3 -1
- package/dist/cjs/resolution/resolve-branding.js.map +1 -1
- package/dist/cjs/resolution/resolve-config.js +3 -0
- package/dist/cjs/resolution/resolve-config.js.map +1 -1
- package/dist/cjs/schemas/api.schemas.js +1 -1
- package/dist/cjs/schemas/branding.schemas.js +3 -0
- package/dist/cjs/schemas/branding.schemas.js.map +1 -1
- package/dist/cjs/schemas/capabilities.schemas.js +48 -3
- package/dist/cjs/schemas/capabilities.schemas.js.map +1 -1
- package/dist/cjs/schemas/config.schemas.js +1 -0
- package/dist/cjs/schemas/config.schemas.js.map +1 -1
- package/dist/cjs/schemas/modes.schemas.js +1 -0
- package/dist/cjs/schemas/modes.schemas.js.map +1 -1
- package/dist/cjs/styles/contrast.js +100 -0
- package/dist/cjs/styles/contrast.js.map +1 -0
- package/dist/cjs/styles/css-variables.js +36 -1
- package/dist/cjs/styles/css-variables.js.map +1 -1
- package/dist/cjs/styles/index.js +2 -1
- package/dist/cjs/styles/index.js.map +1 -1
- package/dist/cjs/styles/stylesheet.js +10 -5
- package/dist/cjs/styles/stylesheet.js.map +1 -1
- package/dist/cjs/styles/theme.js +29 -1
- package/dist/cjs/styles/theme.js.map +1 -1
- package/dist/cjs/styles/tokens.js +8 -8
- package/dist/cjs/styles/tokens.js.map +1 -1
- package/dist/cjs/templates/base/components.js +1 -1
- package/dist/cjs/templates/index.js +1 -0
- package/dist/cjs/templates/index.js.map +1 -1
- package/dist/cjs/templates/modes/credentials.template.js +15 -13
- package/dist/cjs/templates/modes/credentials.template.js.map +1 -1
- package/dist/cjs/templates/modes/index.js +3 -1
- package/dist/cjs/templates/modes/index.js.map +1 -1
- package/dist/cjs/templates/modes/passkey.template.js +178 -0
- package/dist/cjs/templates/modes/passkey.template.js.map +1 -0
- package/dist/cjs/templates/modes/success.template.js +2 -7
- package/dist/cjs/templates/modes/success.template.js.map +1 -1
- package/dist/cjs/templates/registry.js +4 -3
- package/dist/cjs/templates/registry.js.map +1 -1
- package/dist/cjs/types/capabilities.types.js +27 -2
- package/dist/cjs/types/capabilities.types.js.map +1 -1
- package/dist/cjs/types/index.js +1 -1
- package/dist/cjs/types/modes.types.js +11 -4
- package/dist/cjs/types/modes.types.js.map +1 -1
- package/dist/components/consent-agent-header.d.ts +16 -3
- package/dist/components/consent-agent-header.d.ts.map +1 -1
- package/dist/components/consent-agent-header.js +81 -21
- package/dist/components/consent-agent-header.js.map +1 -1
- package/dist/components/consent-button.d.ts +6 -5
- package/dist/components/consent-button.d.ts.map +1 -1
- package/dist/components/consent-button.js +18 -15
- package/dist/components/consent-button.js.map +1 -1
- package/dist/components/consent-capabilities-screen.d.ts +3 -1
- package/dist/components/consent-capabilities-screen.d.ts.map +1 -1
- package/dist/components/consent-capabilities-screen.js +15 -5
- package/dist/components/consent-capabilities-screen.js.map +1 -1
- package/dist/components/consent-checkbox.d.ts +4 -2
- package/dist/components/consent-checkbox.d.ts.map +1 -1
- package/dist/components/consent-checkbox.js +23 -19
- package/dist/components/consent-checkbox.js.map +1 -1
- package/dist/components/consent-connector-header.d.ts.map +1 -1
- package/dist/components/consent-connector-header.js +14 -3
- package/dist/components/consent-connector-header.js.map +1 -1
- package/dist/components/consent-passkey.d.ts +128 -0
- package/dist/components/consent-passkey.d.ts.map +1 -0
- package/dist/components/consent-passkey.js +408 -0
- package/dist/components/consent-passkey.js.map +1 -0
- package/dist/components/consent-permissions.d.ts +4 -3
- package/dist/components/consent-permissions.d.ts.map +1 -1
- package/dist/components/consent-permissions.js +18 -17
- package/dist/components/consent-permissions.js.map +1 -1
- package/dist/components/consent-revocation-notice.d.ts +8 -0
- package/dist/components/consent-revocation-notice.d.ts.map +1 -1
- package/dist/components/consent-revocation-notice.js +23 -5
- package/dist/components/consent-revocation-notice.js.map +1 -1
- package/dist/components/consent-shell.d.ts +2 -2
- package/dist/components/consent-shell.d.ts.map +1 -1
- package/dist/components/consent-shell.js +37 -19
- package/dist/components/consent-shell.js.map +1 -1
- package/dist/components/consent-terms.d.ts +4 -2
- package/dist/components/consent-terms.d.ts.map +1 -1
- package/dist/components/consent-terms.js +29 -25
- package/dist/components/consent-terms.js.map +1 -1
- package/dist/components/mcp-consent.d.ts +11 -3
- package/dist/components/mcp-consent.d.ts.map +1 -1
- package/dist/components/mcp-consent.js +222 -45
- package/dist/components/mcp-consent.js.map +1 -1
- package/dist/consent.js +1102 -140
- package/dist/consent.min.js +481 -228
- package/dist/constants/auth-modes.js +1 -1
- package/dist/constants/auth-modes.js.map +1 -1
- package/dist/constants/colors.d.ts +7 -2
- package/dist/constants/colors.d.ts.map +1 -1
- package/dist/constants/colors.js +7 -2
- package/dist/constants/colors.js.map +1 -1
- package/dist/constants/defaults.d.ts +1 -1
- package/dist/constants/defaults.js +1 -1
- package/dist/copy/tokens.d.ts +45 -1
- package/dist/copy/tokens.d.ts.map +1 -1
- package/dist/copy/tokens.js +45 -1
- package/dist/copy/tokens.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp-app/inline.d.ts.map +1 -1
- package/dist/mcp-app/inline.js +2 -2
- package/dist/mcp-app/inline.js.map +1 -1
- package/dist/passkey/index.d.ts +19 -0
- package/dist/passkey/index.d.ts.map +1 -0
- package/dist/passkey/index.js +18 -0
- package/dist/passkey/index.js.map +1 -0
- package/dist/passkey/react.d.ts +34 -0
- package/dist/passkey/react.d.ts.map +1 -0
- package/dist/passkey/react.js +39 -0
- package/dist/passkey/react.js.map +1 -0
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/dist/resolution/resolve-branding.d.ts.map +1 -1
- package/dist/resolution/resolve-branding.js +3 -1
- package/dist/resolution/resolve-branding.js.map +1 -1
- package/dist/resolution/resolve-config.d.ts.map +1 -1
- package/dist/resolution/resolve-config.js +3 -0
- package/dist/resolution/resolve-config.js.map +1 -1
- package/dist/schemas/api.schemas.d.ts +55 -9
- package/dist/schemas/api.schemas.d.ts.map +1 -1
- package/dist/schemas/api.schemas.js +1 -1
- package/dist/schemas/branding.schemas.d.ts +24 -0
- package/dist/schemas/branding.schemas.d.ts.map +1 -1
- package/dist/schemas/branding.schemas.js +3 -0
- package/dist/schemas/branding.schemas.js.map +1 -1
- package/dist/schemas/capabilities.schemas.d.ts +38 -4
- package/dist/schemas/capabilities.schemas.d.ts.map +1 -1
- package/dist/schemas/capabilities.schemas.js +47 -2
- package/dist/schemas/capabilities.schemas.js.map +1 -1
- package/dist/schemas/config.schemas.d.ts +88 -12
- package/dist/schemas/config.schemas.d.ts.map +1 -1
- package/dist/schemas/config.schemas.js +1 -0
- package/dist/schemas/config.schemas.js.map +1 -1
- package/dist/schemas/modes.schemas.d.ts +8 -0
- package/dist/schemas/modes.schemas.d.ts.map +1 -1
- package/dist/schemas/modes.schemas.js +1 -0
- package/dist/schemas/modes.schemas.js.map +1 -1
- package/dist/styles/contrast.d.ts +33 -0
- package/dist/styles/contrast.d.ts.map +1 -0
- package/dist/styles/contrast.js +92 -0
- package/dist/styles/contrast.js.map +1 -0
- package/dist/styles/css-variables.d.ts +20 -0
- package/dist/styles/css-variables.d.ts.map +1 -1
- package/dist/styles/css-variables.js +35 -1
- package/dist/styles/css-variables.js.map +1 -1
- package/dist/styles/index.d.ts +2 -1
- package/dist/styles/index.d.ts.map +1 -1
- package/dist/styles/index.js +2 -1
- package/dist/styles/index.js.map +1 -1
- package/dist/styles/stylesheet.d.ts +1 -1
- package/dist/styles/stylesheet.d.ts.map +1 -1
- package/dist/styles/stylesheet.js +10 -5
- package/dist/styles/stylesheet.js.map +1 -1
- package/dist/styles/theme.d.ts +32 -1
- package/dist/styles/theme.d.ts.map +1 -1
- package/dist/styles/theme.js +29 -1
- package/dist/styles/theme.js.map +1 -1
- package/dist/styles/tokens.d.ts +5 -5
- package/dist/styles/tokens.js +8 -8
- package/dist/styles/tokens.js.map +1 -1
- package/dist/templates/base/components.d.ts +1 -1
- package/dist/templates/base/components.js +1 -1
- package/dist/templates/index.d.ts +1 -0
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +1 -0
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/modes/credentials.template.d.ts +5 -5
- package/dist/templates/modes/credentials.template.d.ts.map +1 -1
- package/dist/templates/modes/credentials.template.js +15 -13
- package/dist/templates/modes/credentials.template.js.map +1 -1
- package/dist/templates/modes/index.d.ts +1 -0
- package/dist/templates/modes/index.d.ts.map +1 -1
- package/dist/templates/modes/index.js +1 -0
- package/dist/templates/modes/index.js.map +1 -1
- package/dist/templates/modes/passkey.template.d.ts +62 -0
- package/dist/templates/modes/passkey.template.d.ts.map +1 -0
- package/dist/templates/modes/passkey.template.js +174 -0
- package/dist/templates/modes/passkey.template.js.map +1 -0
- package/dist/templates/modes/success.template.d.ts.map +1 -1
- package/dist/templates/modes/success.template.js +2 -7
- package/dist/templates/modes/success.template.js.map +1 -1
- package/dist/templates/registry.d.ts +3 -3
- package/dist/templates/registry.d.ts.map +1 -1
- package/dist/templates/registry.js +6 -5
- package/dist/templates/registry.js.map +1 -1
- package/dist/types/api.types.d.ts +1 -1
- package/dist/types/branding.types.d.ts +6 -0
- package/dist/types/branding.types.d.ts.map +1 -1
- package/dist/types/capabilities.types.d.ts +44 -7
- package/dist/types/capabilities.types.d.ts.map +1 -1
- package/dist/types/capabilities.types.js +26 -2
- package/dist/types/capabilities.types.js.map +1 -1
- package/dist/types/config.types.d.ts +11 -2
- package/dist/types/config.types.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/modes.types.d.ts +31 -4
- package/dist/types/modes.types.d.ts.map +1 -1
- package/dist/types/modes.types.js +10 -3
- package/dist/types/modes.types.js.map +1 -1
- package/dist/types/page.types.d.ts +8 -2
- package/dist/types/page.types.d.ts.map +1 -1
- package/package.json +29 -5
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color Contrast
|
|
3
|
+
*
|
|
4
|
+
* A brand color is operator data, so nothing drawn on it, or in it, can be a
|
|
5
|
+
* fixed color: white text fails WCAG AA (4.5:1) on a yellow, green or orange
|
|
6
|
+
* brand, and brand-colored link text fails on the white card for the same
|
|
7
|
+
* brands. These pick text colors from the brand color instead, with the
|
|
8
|
+
* WCAG 2.x contrast formula.
|
|
9
|
+
*
|
|
10
|
+
* @module @kya-os/consent/styles/contrast
|
|
11
|
+
*/
|
|
12
|
+
/** WCAG 2.x AA contrast for body text. */
|
|
13
|
+
export const AA_TEXT_CONTRAST = 4.5;
|
|
14
|
+
const WHITE = "#FFFFFF";
|
|
15
|
+
const BLACK = "#000000";
|
|
16
|
+
const HEX_COLOR = /^#[0-9A-Fa-f]{6}$/;
|
|
17
|
+
/** Whether `value` is a `#rrggbb` color, the only form these functions take. */
|
|
18
|
+
export function isHexColor(value) {
|
|
19
|
+
return typeof value === "string" && HEX_COLOR.test(value);
|
|
20
|
+
}
|
|
21
|
+
function channels(hex) {
|
|
22
|
+
if (!isHexColor(hex)) {
|
|
23
|
+
throw new RangeError(`Expected a #rrggbb color, got ${JSON.stringify(hex)}`);
|
|
24
|
+
}
|
|
25
|
+
return [1, 3, 5].map((at) => parseInt(hex.slice(at, at + 2), 16));
|
|
26
|
+
}
|
|
27
|
+
function toHex(rgb) {
|
|
28
|
+
return `#${rgb.map((c) => c.toString(16).padStart(2, "0")).join("")}`.toUpperCase();
|
|
29
|
+
}
|
|
30
|
+
function linear(value) {
|
|
31
|
+
const c = value / 255;
|
|
32
|
+
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
33
|
+
}
|
|
34
|
+
/** The WCAG 2.x relative luminance of a `#rrggbb` color: 0 for black, 1 for white. */
|
|
35
|
+
export function relativeLuminance(hex) {
|
|
36
|
+
const [r, g, b] = channels(hex);
|
|
37
|
+
return 0.2126 * linear(r) + 0.7152 * linear(g) + 0.0722 * linear(b);
|
|
38
|
+
}
|
|
39
|
+
/** The WCAG 2.x contrast ratio of two `#rrggbb` colors, from 1 to 21. */
|
|
40
|
+
export function contrastRatio(a, b) {
|
|
41
|
+
const la = relativeLuminance(a);
|
|
42
|
+
const lb = relativeLuminance(b);
|
|
43
|
+
return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The text color for a `background` fill: `preferred` when it reaches AA on
|
|
47
|
+
* it, otherwise black or white, whichever contrasts more (a tie goes to
|
|
48
|
+
* black). One of black and white always reaches 4.58:1, so the result always
|
|
49
|
+
* reaches AA.
|
|
50
|
+
*/
|
|
51
|
+
export function readableTextOn(background, preferred) {
|
|
52
|
+
if (preferred !== undefined &&
|
|
53
|
+
contrastRatio(preferred, background) >= AA_TEXT_CONTRAST) {
|
|
54
|
+
return preferred;
|
|
55
|
+
}
|
|
56
|
+
return contrastRatio(BLACK, background) >= contrastRatio(WHITE, background)
|
|
57
|
+
? BLACK
|
|
58
|
+
: WHITE;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* `color` as text on `surface`: unchanged when it reaches AA there, otherwise
|
|
62
|
+
* mixed toward black (toward white on a dark surface) only as far as it takes
|
|
63
|
+
* to reach AA, so a link keeps the brand's hue where it can.
|
|
64
|
+
*/
|
|
65
|
+
export function readableTextColor(color, surface = WHITE) {
|
|
66
|
+
if (contrastRatio(color, surface) >= AA_TEXT_CONTRAST)
|
|
67
|
+
return color;
|
|
68
|
+
const [r, g, b] = channels(color);
|
|
69
|
+
const [tr, tg, tb] = channels(readableTextOn(surface));
|
|
70
|
+
// Each channel rounds toward the target, so a rounded mix never sits closer
|
|
71
|
+
// to the surface than the exact one, and contrast only grows with `amount`.
|
|
72
|
+
const toward = (c, target, amount) => {
|
|
73
|
+
const exact = c + (target - c) * amount;
|
|
74
|
+
return target > c ? Math.ceil(exact) : Math.floor(exact);
|
|
75
|
+
};
|
|
76
|
+
const mix = (amount) => toHex([
|
|
77
|
+
toward(r, tr, amount),
|
|
78
|
+
toward(g, tg, amount),
|
|
79
|
+
toward(b, tb, amount),
|
|
80
|
+
]);
|
|
81
|
+
let low = 0;
|
|
82
|
+
let high = 1;
|
|
83
|
+
for (let step = 0; step < 16; step++) {
|
|
84
|
+
const middle = (low + high) / 2;
|
|
85
|
+
if (contrastRatio(mix(middle), surface) >= AA_TEXT_CONTRAST)
|
|
86
|
+
high = middle;
|
|
87
|
+
else
|
|
88
|
+
low = middle;
|
|
89
|
+
}
|
|
90
|
+
return mix(high);
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=contrast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contrast.js","sourceRoot":"","sources":["../../src/styles/contrast.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0CAA0C;AAC1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAEpC,MAAM,KAAK,GAAG,SAAS,CAAC;AACxB,MAAM,KAAK,GAAG,SAAS,CAAC;AACxB,MAAM,SAAS,GAAG,mBAAmB,CAAC;AAItC,gFAAgF;AAChF,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED,SAAS,QAAQ,CAAC,GAAW;IAC3B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,UAAU,CAClB,iCAAiC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CACvD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MAAM,GAAG,GAAG,CAAC,MAAc,EAAU,EAAE,CACrC,KAAK,CAAC;QACJ,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;IACL,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,IAAI,gBAAgB;YAAE,IAAI,GAAG,MAAM,CAAC;;YACtE,GAAG,GAAG,MAAM,CAAC;IACpB,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;AACnB,CAAC"}
|
|
@@ -14,6 +14,9 @@ export declare const CSS_VAR_NAMES: {
|
|
|
14
14
|
readonly SECONDARY: "--consent-secondary";
|
|
15
15
|
readonly PRIMARY_RGB: "--consent-primary-rgb";
|
|
16
16
|
readonly SECONDARY_RGB: "--consent-secondary-rgb";
|
|
17
|
+
readonly ON_PRIMARY: "--consent-on-primary";
|
|
18
|
+
readonly ON_SECONDARY: "--consent-on-secondary";
|
|
19
|
+
readonly LINK: "--consent-link";
|
|
17
20
|
readonly BACKGROUND: "--consent-background";
|
|
18
21
|
readonly TEXT_PRIMARY: "--consent-text-primary";
|
|
19
22
|
readonly TEXT_SECONDARY: "--consent-text-secondary";
|
|
@@ -27,6 +30,23 @@ export type CSSVarName = (typeof CSS_VAR_NAMES)[keyof typeof CSS_VAR_NAMES];
|
|
|
27
30
|
* @returns RGB string (e.g., '37, 99, 235')
|
|
28
31
|
*/
|
|
29
32
|
export declare function hexToRgb(hex: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Text colors derived from the brand colors, each reaching WCAG AA (4.5:1):
|
|
35
|
+
*
|
|
36
|
+
* - `--consent-on-primary`: text and checkmarks on a primary fill, black or
|
|
37
|
+
* white, whichever reads better.
|
|
38
|
+
* - `--consent-on-secondary`: text on a secondary fill (the scope badges),
|
|
39
|
+
* the default navy where it reads, otherwise black or white.
|
|
40
|
+
* - `--consent-link`: primary-colored text (links) on the white card, the
|
|
41
|
+
* primary itself where it reads, otherwise darkened just enough.
|
|
42
|
+
*
|
|
43
|
+
* A color that is not `#rrggbb` yields none of its variables, so the
|
|
44
|
+
* elements keep their own fallbacks for it.
|
|
45
|
+
*
|
|
46
|
+
* @param primary - Primary brand color
|
|
47
|
+
* @param secondary - Secondary brand color
|
|
48
|
+
*/
|
|
49
|
+
export declare function generateContrastCSSVariables(primary: string, secondary: string): Pick<ConsentCSSVars, "--consent-on-primary" | "--consent-on-secondary" | "--consent-link">;
|
|
30
50
|
/**
|
|
31
51
|
* Generate CSS variables from branding configuration
|
|
32
52
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-variables.d.ts","sourceRoot":"","sources":["../../src/styles/css-variables.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"css-variables.d.ts","sourceRoot":"","sources":["../../src/styles/css-variables.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACf,MAAM,4BAA4B,CAAC;AAGpC;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;CAYhB,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE5E;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAU5C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,IAAI,CACL,cAAc,EACd,sBAAsB,GAAG,wBAAwB,GAAG,gBAAgB,CACrE,CAaA;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,CAAC,EAAE,eAAe,GACzB,cAAc,CAWhB;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,MAAM,CAK5E;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,CAAC,EAAE,eAAe,GACzB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgBxB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,MAAM,CAEzE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,MAAM,CAOvE"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* @module @kya-os/consent/styles/css-variables
|
|
7
7
|
*/
|
|
8
8
|
import { DEFAULT_COLORS } from "../constants/colors.js";
|
|
9
|
+
import { isHexColor, readableTextColor, readableTextOn } from "./contrast.js";
|
|
9
10
|
/**
|
|
10
11
|
* CSS variable names used in consent pages
|
|
11
12
|
*/
|
|
@@ -14,6 +15,9 @@ export const CSS_VAR_NAMES = {
|
|
|
14
15
|
SECONDARY: "--consent-secondary",
|
|
15
16
|
PRIMARY_RGB: "--consent-primary-rgb",
|
|
16
17
|
SECONDARY_RGB: "--consent-secondary-rgb",
|
|
18
|
+
ON_PRIMARY: "--consent-on-primary",
|
|
19
|
+
ON_SECONDARY: "--consent-on-secondary",
|
|
20
|
+
LINK: "--consent-link",
|
|
17
21
|
BACKGROUND: "--consent-background",
|
|
18
22
|
TEXT_PRIMARY: "--consent-text-primary",
|
|
19
23
|
TEXT_SECONDARY: "--consent-text-secondary",
|
|
@@ -27,13 +31,40 @@ export const CSS_VAR_NAMES = {
|
|
|
27
31
|
*/
|
|
28
32
|
export function hexToRgb(hex) {
|
|
29
33
|
// Remove # if present
|
|
30
|
-
const cleanHex = hex.replace(/^#/,
|
|
34
|
+
const cleanHex = hex.replace(/^#/, "");
|
|
31
35
|
// Parse hex to RGB
|
|
32
36
|
const r = parseInt(cleanHex.slice(0, 2), 16);
|
|
33
37
|
const g = parseInt(cleanHex.slice(2, 4), 16);
|
|
34
38
|
const b = parseInt(cleanHex.slice(4, 6), 16);
|
|
35
39
|
return `${r}, ${g}, ${b}`;
|
|
36
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Text colors derived from the brand colors, each reaching WCAG AA (4.5:1):
|
|
43
|
+
*
|
|
44
|
+
* - `--consent-on-primary`: text and checkmarks on a primary fill, black or
|
|
45
|
+
* white, whichever reads better.
|
|
46
|
+
* - `--consent-on-secondary`: text on a secondary fill (the scope badges),
|
|
47
|
+
* the default navy where it reads, otherwise black or white.
|
|
48
|
+
* - `--consent-link`: primary-colored text (links) on the white card, the
|
|
49
|
+
* primary itself where it reads, otherwise darkened just enough.
|
|
50
|
+
*
|
|
51
|
+
* A color that is not `#rrggbb` yields none of its variables, so the
|
|
52
|
+
* elements keep their own fallbacks for it.
|
|
53
|
+
*
|
|
54
|
+
* @param primary - Primary brand color
|
|
55
|
+
* @param secondary - Secondary brand color
|
|
56
|
+
*/
|
|
57
|
+
export function generateContrastCSSVariables(primary, secondary) {
|
|
58
|
+
return {
|
|
59
|
+
...(isHexColor(primary) && {
|
|
60
|
+
"--consent-on-primary": readableTextOn(primary),
|
|
61
|
+
"--consent-link": readableTextColor(primary),
|
|
62
|
+
}),
|
|
63
|
+
...(isHexColor(secondary) && {
|
|
64
|
+
"--consent-on-secondary": readableTextOn(secondary, DEFAULT_COLORS.ON_SECONDARY),
|
|
65
|
+
}),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
37
68
|
/**
|
|
38
69
|
* Generate CSS variables from branding configuration
|
|
39
70
|
*
|
|
@@ -48,6 +79,7 @@ export function generateCSSVariables(branding) {
|
|
|
48
79
|
"--consent-secondary": secondary,
|
|
49
80
|
"--consent-primary-rgb": hexToRgb(primary),
|
|
50
81
|
"--consent-secondary-rgb": hexToRgb(secondary),
|
|
82
|
+
...generateContrastCSSVariables(primary, secondary),
|
|
51
83
|
};
|
|
52
84
|
}
|
|
53
85
|
/**
|
|
@@ -75,6 +107,8 @@ export function generateFullCSSVariables(branding) {
|
|
|
75
107
|
// Core branding colors
|
|
76
108
|
[CSS_VAR_NAMES.PRIMARY]: primary,
|
|
77
109
|
[CSS_VAR_NAMES.SECONDARY]: secondary,
|
|
110
|
+
// Text colors that read on them
|
|
111
|
+
...generateContrastCSSVariables(primary, secondary),
|
|
78
112
|
// Additional theme colors
|
|
79
113
|
[CSS_VAR_NAMES.BACKGROUND]: DEFAULT_COLORS.BACKGROUND,
|
|
80
114
|
[CSS_VAR_NAMES.TEXT_PRIMARY]: DEFAULT_COLORS.TEXT_PRIMARY,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-variables.js","sourceRoot":"","sources":["../../src/styles/css-variables.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"css-variables.js","sourceRoot":"","sources":["../../src/styles/css-variables.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAKxD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE9E;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,mBAAmB;IAC5B,SAAS,EAAE,qBAAqB;IAChC,WAAW,EAAE,uBAAuB;IACpC,aAAa,EAA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AC,aAAa,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC,cAAc;QAC7D,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,MAAM;KAC9C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAA0B;IAC/D,OAAO,yBAAyB,CAAC,QAAQ,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAA0B;IAC7D,MAAM,IAAI,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;SACtC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC;SAC9C,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO,YAAY,YAAY,KAAK,CAAC;AACvC,CAAC"}
|
package/dist/styles/index.d.ts
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
* Consent Styles
|
|
3
3
|
*
|
|
4
4
|
* CSS tokens and generators for consent page styling.
|
|
5
|
-
* Matches
|
|
5
|
+
* Matches Checkpoint preview components exactly for pixel-perfect parity.
|
|
6
6
|
*
|
|
7
7
|
* @module @kya-os/consent/styles
|
|
8
8
|
*/
|
|
9
9
|
export * from "./tokens.js";
|
|
10
|
+
export * from "./contrast.js";
|
|
10
11
|
export * from "./css-variables.js";
|
|
11
12
|
export * from "./stylesheet.js";
|
|
12
13
|
export * from "./theme.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/styles/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/styles/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC"}
|
package/dist/styles/index.js
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
* Consent Styles
|
|
3
3
|
*
|
|
4
4
|
* CSS tokens and generators for consent page styling.
|
|
5
|
-
* Matches
|
|
5
|
+
* Matches Checkpoint preview components exactly for pixel-perfect parity.
|
|
6
6
|
*
|
|
7
7
|
* @module @kya-os/consent/styles
|
|
8
8
|
*/
|
|
9
9
|
export * from "./tokens.js";
|
|
10
|
+
export * from "./contrast.js";
|
|
10
11
|
export * from "./css-variables.js";
|
|
11
12
|
export * from "./stylesheet.js";
|
|
12
13
|
export * from "./theme.js";
|
package/dist/styles/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/styles/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/styles/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC"}
|
|
@@ -11,7 +11,7 @@ import type { ConsentBranding } from "../types/branding.types.js";
|
|
|
11
11
|
*
|
|
12
12
|
* Creates a checkmark using CSS that appears when checked.
|
|
13
13
|
*/
|
|
14
|
-
export declare const CHECKBOX_STYLES = "\n/* Custom checkbox checkmark */\ninput[type=\"checkbox\"]:checked::before {\n content: '';\n position: absolute;\n left: 50%;\n top: 50%;\n width: 5px;\n height: 9px;\n border: solid white;\n border-width: 0 2px 2px 0;\n transform: translate(-50%, -60%) rotate(45deg);\n}\n\n/* Focus ring for accessibility */\ninput[type=\"checkbox\"]:focus-visible {\n outline: 2px solid var(--consent-primary);\n outline-offset: 2px;\n}\n";
|
|
14
|
+
export declare const CHECKBOX_STYLES = "\n/* Custom checkbox checkmark */\ninput[type=\"checkbox\"]:checked::before {\n content: '';\n position: absolute;\n left: 50%;\n top: 50%;\n width: 5px;\n height: 9px;\n border: solid var(--consent-on-primary, white);\n border-width: 0 2px 2px 0;\n transform: translate(-50%, -60%) rotate(45deg);\n}\n\n/* Focus ring for accessibility */\ninput[type=\"checkbox\"]:focus-visible {\n outline: 2px solid var(--consent-primary);\n outline-offset: 2px;\n}\n";
|
|
15
15
|
/**
|
|
16
16
|
* Form input focus styles
|
|
17
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stylesheet.d.ts","sourceRoot":"","sources":["../../src/styles/stylesheet.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGlE;;;;GAIG;AACH,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"stylesheet.d.ts","sourceRoot":"","sources":["../../src/styles/stylesheet.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGlE;;;;GAIG;AACH,eAAO,MAAM,eAAe,qdAmB3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,8dA2BxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,8JAW1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,ygBAmB7B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,MAAM,CA6CrE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,MAAM,CAQvE;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,KAAK,GAClD,MAAM,CAgBR;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,MAAM,CAErE"}
|
|
@@ -20,7 +20,7 @@ input[type="checkbox"]:checked::before {
|
|
|
20
20
|
top: 50%;
|
|
21
21
|
width: 5px;
|
|
22
22
|
height: 9px;
|
|
23
|
-
border: solid white;
|
|
23
|
+
border: solid var(--consent-on-primary, white);
|
|
24
24
|
border-width: 0 2px 2px 0;
|
|
25
25
|
transform: translate(-50%, -60%) rotate(45deg);
|
|
26
26
|
}
|
|
@@ -134,9 +134,9 @@ input:disabled {
|
|
|
134
134
|
cursor: not-allowed;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
/* Link
|
|
137
|
+
/* Link in the primary color, darkened where it would not read on white */
|
|
138
138
|
a.consent-link {
|
|
139
|
-
color: var(--consent-primary);
|
|
139
|
+
color: var(--consent-link, var(--consent-primary));
|
|
140
140
|
text-decoration: none;
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -147,7 +147,7 @@ a.consent-link:hover {
|
|
|
147
147
|
/* Scope badge with derived colors */
|
|
148
148
|
.scope-badge {
|
|
149
149
|
background-color: var(--consent-secondary);
|
|
150
|
-
color: var(--consent-primary);
|
|
150
|
+
color: var(--consent-on-secondary, var(--consent-primary));
|
|
151
151
|
}
|
|
152
152
|
`.trim();
|
|
153
153
|
}
|
|
@@ -180,7 +180,12 @@ export function generateComponentStyles(component) {
|
|
|
180
180
|
case "spinner":
|
|
181
181
|
return SPINNER_STYLES;
|
|
182
182
|
case "all":
|
|
183
|
-
return [
|
|
183
|
+
return [
|
|
184
|
+
CHECKBOX_STYLES,
|
|
185
|
+
INPUT_STYLES,
|
|
186
|
+
SPINNER_STYLES,
|
|
187
|
+
TRANSITION_STYLES,
|
|
188
|
+
].join("\n");
|
|
184
189
|
}
|
|
185
190
|
}
|
|
186
191
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stylesheet.js","sourceRoot":"","sources":["../../src/styles/stylesheet.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;CAmB9B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2B3B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;CAW7B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;CAmBhC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAA0B;IAC3D,MAAM,QAAQ,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAEhD,OAAO;;;EAGP,QAAQ;;EAER,eAAe;;EAEf,YAAY;;EAEZ,cAAc;;EAEd,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BlB,CAAC,IAAI,EAAE,CAAC;AACT,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAA0B;IAC7D,MAAM,QAAQ,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAEhD,OAAO;EACP,QAAQ;EACR,eAAe;;CAEhB,CAAC,IAAI,EAAE,CAAC;AACT,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAA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IAEnD,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,UAAU;YACb,OAAO,eAAe,CAAC;QACzB,KAAK,OAAO;YACV,OAAO,YAAY,CAAC;QACtB,KAAK,SAAS;YACZ,OAAO,cAAc,CAAC;QACxB,KAAK,KAAK;YACR,OAAO;gBACL,eAAe;gBACf,YAAY;gBACZ,cAAc;gBACd,iBAAiB;aAClB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAA0B;IAC3D,OAAO,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AACtC,CAAC"}
|
package/dist/styles/theme.d.ts
CHANGED
|
@@ -16,11 +16,19 @@
|
|
|
16
16
|
* The amber `HIGHER RISK` chip token is fixed across themes so the visual
|
|
17
17
|
* stays recognizable regardless of org branding.
|
|
18
18
|
*
|
|
19
|
+
* The agent logo tile tokens are fixed across themes too: agent artwork is
|
|
20
|
+
* drawn on a white tile with a light border in both themes, so a logo never
|
|
21
|
+
* sits on a dark surface and the brandable `surfaceAccent` stays free for the
|
|
22
|
+
* primary action. They are optional on `ConsentThemeTokens` so themes written
|
|
23
|
+
* before they existed still compile; `themeToCssVariables` fills in the fixed
|
|
24
|
+
* values for any that are missing.
|
|
25
|
+
*
|
|
19
26
|
* @module @kya-os/consent/styles/theme
|
|
20
27
|
*/
|
|
21
28
|
import type { ConsentTheme } from "../types/capabilities.types.js";
|
|
22
29
|
/**
|
|
23
|
-
* Shape of a complete theme token set. Every key must be set on every theme
|
|
30
|
+
* Shape of a complete theme token set. Every key must be set on every theme,
|
|
31
|
+
* except the optional agent tile keys, which default to the fixed white tile.
|
|
24
32
|
*/
|
|
25
33
|
export interface ConsentThemeTokens {
|
|
26
34
|
/** Page-level background behind the modal/card. */
|
|
@@ -57,6 +65,23 @@ export interface ConsentThemeTokens {
|
|
|
57
65
|
focusRing: string;
|
|
58
66
|
/** Shadow on the consent card. */
|
|
59
67
|
cardShadow: string;
|
|
68
|
+
/**
|
|
69
|
+
* Agent logo tile background (top connector tile and agent row tile).
|
|
70
|
+
* Fixed white across themes so agent artwork never sits on a dark surface.
|
|
71
|
+
* Optional: defaults to `#FFFFFF` when a theme omits it.
|
|
72
|
+
*/
|
|
73
|
+
agentTileBg?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Agent logo tile border color. Fixed across themes.
|
|
76
|
+
* Optional: defaults to `rgba(15, 23, 42, 0.08)` when a theme omits it.
|
|
77
|
+
*/
|
|
78
|
+
agentTileBorder?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Agent monogram / initial color, shown on the agent tile when there is no
|
|
81
|
+
* logo. Fixed across themes to stay readable on the white tile.
|
|
82
|
+
* Optional: defaults to `#0F172A` when a theme omits it.
|
|
83
|
+
*/
|
|
84
|
+
agentTileText?: string;
|
|
60
85
|
}
|
|
61
86
|
export declare const lightTheme: ConsentThemeTokens;
|
|
62
87
|
export declare const darkTheme: ConsentThemeTokens;
|
|
@@ -67,6 +92,12 @@ export declare function getConsentTheme(theme: ConsentTheme | undefined): Consen
|
|
|
67
92
|
/**
|
|
68
93
|
* Render a theme as a CSS string suitable for injecting into a `<style>` block
|
|
69
94
|
* or `:host { ... }` rule. Each token becomes a `--cs-{kebab}` custom property.
|
|
95
|
+
* Agent tile tokens a theme omits (or sets to undefined) are emitted with the
|
|
96
|
+
* fixed white tile values, so the output never contains "undefined".
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* themeToCssVariables(lightTheme);
|
|
100
|
+
* // " --cs-surface-bg: #F4F1EA;\n ... \n --cs-agent-tile-bg: #FFFFFF;\n ..."
|
|
70
101
|
*/
|
|
71
102
|
export declare function themeToCssVariables(tokens: ConsentThemeTokens): string;
|
|
72
103
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/styles/theme.ts"],"names":[],"m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,MAAM,SAAS,EAAE,kBAqBvB,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,kBAAkB,CAEnF;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAYtE"}
|
package/dist/styles/theme.js
CHANGED
|
@@ -16,10 +16,20 @@
|
|
|
16
16
|
* The amber `HIGHER RISK` chip token is fixed across themes so the visual
|
|
17
17
|
* stays recognizable regardless of org branding.
|
|
18
18
|
*
|
|
19
|
+
* The agent logo tile tokens are fixed across themes too: agent artwork is
|
|
20
|
+
* drawn on a white tile with a light border in both themes, so a logo never
|
|
21
|
+
* sits on a dark surface and the brandable `surfaceAccent` stays free for the
|
|
22
|
+
* primary action. They are optional on `ConsentThemeTokens` so themes written
|
|
23
|
+
* before they existed still compile; `themeToCssVariables` fills in the fixed
|
|
24
|
+
* values for any that are missing.
|
|
25
|
+
*
|
|
19
26
|
* @module @kya-os/consent/styles/theme
|
|
20
27
|
*/
|
|
21
28
|
const FIXED_RISK_CHIP_BG = "#FCE7B6";
|
|
22
29
|
const FIXED_RISK_CHIP_TEXT = "#7A4F00";
|
|
30
|
+
const FIXED_AGENT_TILE_BG = "#FFFFFF";
|
|
31
|
+
const FIXED_AGENT_TILE_BORDER = "rgba(15, 23, 42, 0.08)";
|
|
32
|
+
const FIXED_AGENT_TILE_TEXT = "#0F172A";
|
|
23
33
|
export const lightTheme = {
|
|
24
34
|
surfaceBg: "#F4F1EA",
|
|
25
35
|
surfaceCard: "#FFFFFF",
|
|
@@ -38,6 +48,9 @@ export const lightTheme = {
|
|
|
38
48
|
chipRiskText: FIXED_RISK_CHIP_TEXT,
|
|
39
49
|
focusRing: "rgba(15, 23, 42, 0.35)",
|
|
40
50
|
cardShadow: "0 30px 80px -40px rgba(15, 23, 42, 0.40)",
|
|
51
|
+
agentTileBg: FIXED_AGENT_TILE_BG,
|
|
52
|
+
agentTileBorder: FIXED_AGENT_TILE_BORDER,
|
|
53
|
+
agentTileText: FIXED_AGENT_TILE_TEXT,
|
|
41
54
|
};
|
|
42
55
|
export const darkTheme = {
|
|
43
56
|
surfaceBg: "#0B0808",
|
|
@@ -57,6 +70,9 @@ export const darkTheme = {
|
|
|
57
70
|
chipRiskText: FIXED_RISK_CHIP_TEXT,
|
|
58
71
|
focusRing: "rgba(248, 250, 252, 0.55)",
|
|
59
72
|
cardShadow: "0 40px 90px -40px rgba(0, 0, 0, 0.85)",
|
|
73
|
+
agentTileBg: FIXED_AGENT_TILE_BG,
|
|
74
|
+
agentTileBorder: FIXED_AGENT_TILE_BORDER,
|
|
75
|
+
agentTileText: FIXED_AGENT_TILE_TEXT,
|
|
60
76
|
};
|
|
61
77
|
/**
|
|
62
78
|
* Resolve a theme by name. Defaults to `light` for any unknown value.
|
|
@@ -67,10 +83,22 @@ export function getConsentTheme(theme) {
|
|
|
67
83
|
/**
|
|
68
84
|
* Render a theme as a CSS string suitable for injecting into a `<style>` block
|
|
69
85
|
* or `:host { ... }` rule. Each token becomes a `--cs-{kebab}` custom property.
|
|
86
|
+
* Agent tile tokens a theme omits (or sets to undefined) are emitted with the
|
|
87
|
+
* fixed white tile values, so the output never contains "undefined".
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* themeToCssVariables(lightTheme);
|
|
91
|
+
* // " --cs-surface-bg: #F4F1EA;\n ... \n --cs-agent-tile-bg: #FFFFFF;\n ..."
|
|
70
92
|
*/
|
|
71
93
|
export function themeToCssVariables(tokens) {
|
|
94
|
+
const resolved = {
|
|
95
|
+
...tokens,
|
|
96
|
+
agentTileBg: tokens.agentTileBg ?? FIXED_AGENT_TILE_BG,
|
|
97
|
+
agentTileBorder: tokens.agentTileBorder ?? FIXED_AGENT_TILE_BORDER,
|
|
98
|
+
agentTileText: tokens.agentTileText ?? FIXED_AGENT_TILE_TEXT,
|
|
99
|
+
};
|
|
72
100
|
const declarations = [];
|
|
73
|
-
for (const [key, value] of Object.entries(
|
|
101
|
+
for (const [key, value] of Object.entries(resolved)) {
|
|
74
102
|
declarations.push(` --cs-${camelToKebab(key)}: ${value};`);
|
|
75
103
|
}
|
|
76
104
|
return declarations.join("\n");
|
package/dist/styles/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/styles/theme.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/styles/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAiFH,MAAM,kBAAkB,GAAG,SAAS,CAAC;AACrC,MAAM,oBAAoB,GAAG,SAAS,CAAC;AACvC,MAAM,mBAAmB,GAAG,SAAS,CAAC;AACtC,MAAM,uBAAuB,GAAG,wBAAwB,CAAC;AACzD,MAAM,qBAAqB,GAAG,SAAS,CAAC;AAExC,MAAM,CAAC,MAAM,UAAU,GAAuB;IAC5C,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,SAAS;IACtB,aAAa,EAAE,wBAAwB;IACvC,YAAY,EAAE,SAAS;IACvB,WAAW,EAAE,SAAS;IACtB,aAAa,EAAE,SAAS;IACxB,YAAY,EAAE,SAAS;IACvB,aAAa,EAAE,SAAS;IACxB,iBAAiB,EAAE,SAAS;IAC5B,cAAc,EAAE,SAAS;IACzB,gBAAgB,EAAE,SAAS;IAC3B,gBAAgB,EAAE,SAAS;IAC3B,kBAAkB,EAAE,SAAS;IAC7B,UAAU,EAAE,kBAAkB;IAC9B,YAAY,EAAE,oBAAoB;IAClC,SAAS,EAAE,wBAAwB;IACnC,UAAU,EAAE,0CAA0C;IACtD,WAAW,EAAE,mBAAmB;IAChC,eAAe,EAAE,uBAAuB;IACxC,aAAa,EAAE,qBAAqB;CACrC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAuB;IAC3C,SAAS,EAAE,SAAS;IACpB,WAAW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AS,YAAY,CAAC,KAAa;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AAC/D,CAAC"}
|
package/dist/styles/tokens.d.ts
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
* Consent CSS Class Tokens
|
|
3
3
|
*
|
|
4
4
|
* Single source of truth for all Tailwind classes used in consent pages.
|
|
5
|
-
* CRITICAL: These MUST match
|
|
5
|
+
* CRITICAL: These MUST match Checkpoint preview components exactly.
|
|
6
6
|
*
|
|
7
7
|
* Divergences identified and fixed:
|
|
8
|
-
* - Button: py-2 → py-3, rounded-md → rounded-lg (match
|
|
9
|
-
* - Checkbox: w-5 h-5 → w-4 h-4 (match
|
|
10
|
-
* - Container: max-w-md → max-w-[512px] (match
|
|
8
|
+
* - Button: py-2 → py-3, rounded-md → rounded-lg (match Checkpoint)
|
|
9
|
+
* - Checkbox: w-5 h-5 → w-4 h-4 (match Checkpoint)
|
|
10
|
+
* - Container: max-w-md → max-w-[512px] (match Checkpoint)
|
|
11
11
|
*
|
|
12
12
|
* @module @kya-os/consent/styles/tokens
|
|
13
13
|
*/
|
|
14
14
|
/**
|
|
15
15
|
* CONSENT_CLASSES - Canonical CSS classes for consent UI components
|
|
16
16
|
*
|
|
17
|
-
* All classes are Tailwind CSS utilities that match
|
|
17
|
+
* All classes are Tailwind CSS utilities that match Checkpoint exactly.
|
|
18
18
|
*/
|
|
19
19
|
export declare const CONSENT_CLASSES: {
|
|
20
20
|
/** Main container wrapper - background with centered content */
|
package/dist/styles/tokens.js
CHANGED
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
* Consent CSS Class Tokens
|
|
3
3
|
*
|
|
4
4
|
* Single source of truth for all Tailwind classes used in consent pages.
|
|
5
|
-
* CRITICAL: These MUST match
|
|
5
|
+
* CRITICAL: These MUST match Checkpoint preview components exactly.
|
|
6
6
|
*
|
|
7
7
|
* Divergences identified and fixed:
|
|
8
|
-
* - Button: py-2 → py-3, rounded-md → rounded-lg (match
|
|
9
|
-
* - Checkbox: w-5 h-5 → w-4 h-4 (match
|
|
10
|
-
* - Container: max-w-md → max-w-[512px] (match
|
|
8
|
+
* - Button: py-2 → py-3, rounded-md → rounded-lg (match Checkpoint)
|
|
9
|
+
* - Checkbox: w-5 h-5 → w-4 h-4 (match Checkpoint)
|
|
10
|
+
* - Container: max-w-md → max-w-[512px] (match Checkpoint)
|
|
11
11
|
*
|
|
12
12
|
* @module @kya-os/consent/styles/tokens
|
|
13
13
|
*/
|
|
14
14
|
/**
|
|
15
15
|
* CONSENT_CLASSES - Canonical CSS classes for consent UI components
|
|
16
16
|
*
|
|
17
|
-
* All classes are Tailwind CSS utilities that match
|
|
17
|
+
* All classes are Tailwind CSS utilities that match Checkpoint exactly.
|
|
18
18
|
*/
|
|
19
19
|
export const CONSENT_CLASSES = {
|
|
20
20
|
// =========================================================================
|
|
21
|
-
// Container / Shell - Matches
|
|
21
|
+
// Container / Shell - Matches Checkpoint PreviewShell.tsx
|
|
22
22
|
// =========================================================================
|
|
23
23
|
/** Main container wrapper - background with centered content */
|
|
24
24
|
wrapper: "bg-gray-50 min-h-screen flex items-center justify-center p-4",
|
|
@@ -31,7 +31,7 @@ export const CONSENT_CLASSES = {
|
|
|
31
31
|
/** Footer with buttons */
|
|
32
32
|
footer: "p-6 pt-0 flex gap-3",
|
|
33
33
|
// =========================================================================
|
|
34
|
-
// Buttons - Matches
|
|
34
|
+
// Buttons - Matches Checkpoint PreviewButton.tsx
|
|
35
35
|
// CRITICAL: h-11, py-3, rounded-lg (NOT py-2, rounded-md)
|
|
36
36
|
// =========================================================================
|
|
37
37
|
/** Primary action button (Allow access) */
|
|
@@ -47,7 +47,7 @@ export const CONSENT_CLASSES = {
|
|
|
47
47
|
/** Button group container (for multiple buttons) */
|
|
48
48
|
buttonGroup: "flex gap-3 mt-6",
|
|
49
49
|
// =========================================================================
|
|
50
|
-
// Checkbox - Matches
|
|
50
|
+
// Checkbox - Matches Checkpoint PreviewCheckbox.tsx
|
|
51
51
|
// CRITICAL: w-4 h-4 (NOT w-5 h-5)
|
|
52
52
|
// =========================================================================
|
|
53
53
|
/** Checkbox input - custom styled */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/styles/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,4EAA4E;IAC5E,
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/styles/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,4EAA4E;IAC5E,0DAA0D;IAC1D,4EAA4E;IAC5E,gEAAgE;IAChE,OAAO,EAAE,8DAA8D;IAEvE,kEAAkE;IAClE,SAAS,EACP,+FAA+F;IAEjG,8CAA8C;IAC9C,MAAM,EAAE,UAAU;IAElB,wBAAwB;IACxB,OAAO,EAAE,oBAAoB;IAE7B,0BAA0B;IAC1B,MAAM,EAAE,qBAAqB;IAE7B,4EAA4E;IAC5E,iDAAiD;IACjD,0DAA0D;IAC1D,4EAA4E;IAC5E,2CAA2C;IAC3C,aAAa,EACX,sIAAsI;IAExI,uCAAuC;IACvC,eAAe,EACb,+GAA+G;IAEjH,gCAAgC;IAChC,UAAU,EACR,6IAA6I;IAE/I,gCAAgC;IAChC,WAAW,EACT,6JAA6J;IAE/J,0BAA0B;IAC1B,UAAU,EAAE,oDAAoD;IAEhE,oDAAoD;IACpD,WAAW,EAAE,iBAAiB;IAE9B,4EAA4E;IAC5E,oDAAoD;IACpD,kCAAkC;IAClC,4EAA4E;IAC5E,qCAAqC;IACrC,QAAQ,EACN,mLAAmL;IAErL,oCAAoC;IACpC,iBAAiB,EAAE,uCA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* Reusable HTML Components
|
|
3
3
|
*
|
|
4
|
-
* Each function corresponds to an
|
|
4
|
+
* Each function corresponds to an Checkpoint preview component:
|
|
5
5
|
* - renderLogo() -> PreviewAgentInfo logo
|
|
6
6
|
* - renderHeader() -> PreviewHeader
|
|
7
7
|
* - renderButton() -> PreviewButton
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Reusable HTML Components
|
|
3
3
|
*
|
|
4
|
-
* Each function corresponds to an
|
|
4
|
+
* Each function corresponds to an Checkpoint preview component:
|
|
5
5
|
* - renderLogo() -> PreviewAgentInfo logo
|
|
6
6
|
* - renderHeader() -> PreviewHeader
|
|
7
7
|
* - renderButton() -> PreviewButton
|
|
@@ -13,6 +13,7 @@ export * from "./modes/credentials.template.js";
|
|
|
13
13
|
export * from "./modes/oauth.template.js";
|
|
14
14
|
export * from "./modes/magic-link.template.js";
|
|
15
15
|
export * from "./modes/otp.template.js";
|
|
16
|
+
export * from "./modes/passkey.template.js";
|
|
16
17
|
export * from "./modes/success.template.js";
|
|
17
18
|
export * from "./registry.js";
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC"}
|
package/dist/templates/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./modes/credentials.template.js";
|
|
|
13
13
|
export * from "./modes/oauth.template.js";
|
|
14
14
|
export * from "./modes/magic-link.template.js";
|
|
15
15
|
export * from "./modes/otp.template.js";
|
|
16
|
+
export * from "./modes/passkey.template.js";
|
|
16
17
|
export * from "./modes/success.template.js";
|
|
17
18
|
export * from "./registry.js";
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC"}
|