@kya-os/consent 0.1.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/dist/constants/auth-modes.d.ts +54 -0
- package/dist/constants/auth-modes.d.ts.map +1 -0
- package/dist/constants/auth-modes.js +128 -0
- package/dist/constants/auth-modes.js.map +1 -0
- package/dist/constants/colors.d.ts +38 -0
- package/dist/constants/colors.d.ts.map +1 -0
- package/dist/constants/colors.js +40 -0
- package/dist/constants/colors.js.map +1 -0
- package/dist/constants/defaults.d.ts +112 -0
- package/dist/constants/defaults.d.ts.map +1 -0
- package/dist/constants/defaults.js +146 -0
- package/dist/constants/defaults.js.map +1 -0
- package/dist/constants/index.d.ts +11 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +37 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/resolution/index.d.ts +12 -0
- package/dist/resolution/index.d.ts.map +1 -0
- package/dist/resolution/index.js +28 -0
- package/dist/resolution/index.js.map +1 -0
- package/dist/resolution/resolve-branding.d.ts +70 -0
- package/dist/resolution/resolve-branding.d.ts.map +1 -0
- package/dist/resolution/resolve-branding.js +159 -0
- package/dist/resolution/resolve-branding.js.map +1 -0
- package/dist/resolution/resolve-config.d.ts +81 -0
- package/dist/resolution/resolve-config.d.ts.map +1 -0
- package/dist/resolution/resolve-config.js +254 -0
- package/dist/resolution/resolve-config.js.map +1 -0
- package/dist/resolution/resolve-copy.d.ts +53 -0
- package/dist/resolution/resolve-copy.d.ts.map +1 -0
- package/dist/resolution/resolve-copy.js +136 -0
- package/dist/resolution/resolve-copy.js.map +1 -0
- package/dist/schemas/api.schemas.d.ts +984 -0
- package/dist/schemas/api.schemas.d.ts.map +1 -0
- package/dist/schemas/api.schemas.js +153 -0
- package/dist/schemas/api.schemas.js.map +1 -0
- package/dist/schemas/branding.schemas.d.ts +100 -0
- package/dist/schemas/branding.schemas.d.ts.map +1 -0
- package/dist/schemas/branding.schemas.js +57 -0
- package/dist/schemas/branding.schemas.js.map +1 -0
- package/dist/schemas/config.schemas.d.ts +1182 -0
- package/dist/schemas/config.schemas.d.ts.map +1 -0
- package/dist/schemas/config.schemas.js +147 -0
- package/dist/schemas/config.schemas.js.map +1 -0
- package/dist/schemas/index.d.ts +13 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +29 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/modes.schemas.d.ts +406 -0
- package/dist/schemas/modes.schemas.d.ts.map +1 -0
- package/dist/schemas/modes.schemas.js +107 -0
- package/dist/schemas/modes.schemas.js.map +1 -0
- package/dist/security/escape.d.ts +114 -0
- package/dist/security/escape.d.ts.map +1 -0
- package/dist/security/escape.js +202 -0
- package/dist/security/escape.js.map +1 -0
- package/dist/security/index.d.ts +10 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +26 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/validators.d.ts +98 -0
- package/dist/security/validators.d.ts.map +1 -0
- package/dist/security/validators.js +210 -0
- package/dist/security/validators.js.map +1 -0
- package/dist/styles/css-variables.d.ts +78 -0
- package/dist/styles/css-variables.d.ts.map +1 -0
- package/dist/styles/css-variables.js +129 -0
- package/dist/styles/css-variables.js.map +1 -0
- package/dist/styles/index.d.ts +12 -0
- package/dist/styles/index.d.ts.map +1 -0
- package/dist/styles/index.js +28 -0
- package/dist/styles/index.js.map +1 -0
- package/dist/styles/stylesheet.d.ts +57 -0
- package/dist/styles/stylesheet.d.ts.map +1 -0
- package/dist/styles/stylesheet.js +204 -0
- package/dist/styles/stylesheet.js.map +1 -0
- package/dist/styles/tokens.d.ts +141 -0
- package/dist/styles/tokens.d.ts.map +1 -0
- package/dist/styles/tokens.js +183 -0
- package/dist/styles/tokens.js.map +1 -0
- package/dist/templates/base/base-template.d.ts +81 -0
- package/dist/templates/base/base-template.d.ts.map +1 -0
- package/dist/templates/base/base-template.js +282 -0
- package/dist/templates/base/base-template.js.map +1 -0
- package/dist/templates/base/components.d.ts +120 -0
- package/dist/templates/base/components.d.ts.map +1 -0
- package/dist/templates/base/components.js +295 -0
- package/dist/templates/base/components.js.map +1 -0
- package/dist/templates/base/index.d.ts +8 -0
- package/dist/templates/base/index.d.ts.map +1 -0
- package/dist/templates/base/index.js +26 -0
- package/dist/templates/base/index.js.map +1 -0
- package/dist/templates/index.d.ts +18 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +34 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/modes/consent-only.template.d.ts +36 -0
- package/dist/templates/modes/consent-only.template.d.ts.map +1 -0
- package/dist/templates/modes/consent-only.template.js +74 -0
- package/dist/templates/modes/consent-only.template.js.map +1 -0
- package/dist/templates/modes/credentials.template.d.ts +65 -0
- package/dist/templates/modes/credentials.template.d.ts.map +1 -0
- package/dist/templates/modes/credentials.template.js +414 -0
- package/dist/templates/modes/credentials.template.js.map +1 -0
- package/dist/templates/modes/index.d.ts +14 -0
- package/dist/templates/modes/index.d.ts.map +1 -0
- package/dist/templates/modes/index.js +24 -0
- package/dist/templates/modes/index.js.map +1 -0
- package/dist/templates/modes/magic-link.template.d.ts +33 -0
- package/dist/templates/modes/magic-link.template.d.ts.map +1 -0
- package/dist/templates/modes/magic-link.template.js +196 -0
- package/dist/templates/modes/magic-link.template.js.map +1 -0
- package/dist/templates/modes/oauth.template.d.ts +40 -0
- package/dist/templates/modes/oauth.template.d.ts.map +1 -0
- package/dist/templates/modes/oauth.template.js +153 -0
- package/dist/templates/modes/oauth.template.js.map +1 -0
- package/dist/templates/modes/otp.template.d.ts +35 -0
- package/dist/templates/modes/otp.template.d.ts.map +1 -0
- package/dist/templates/modes/otp.template.js +316 -0
- package/dist/templates/modes/otp.template.js.map +1 -0
- package/dist/templates/modes/success.template.d.ts +41 -0
- package/dist/templates/modes/success.template.d.ts.map +1 -0
- package/dist/templates/modes/success.template.js +140 -0
- package/dist/templates/modes/success.template.js.map +1 -0
- package/dist/templates/registry.d.ts +62 -0
- package/dist/templates/registry.d.ts.map +1 -0
- package/dist/templates/registry.js +135 -0
- package/dist/templates/registry.js.map +1 -0
- package/dist/types/api.types.d.ts +134 -0
- package/dist/types/api.types.d.ts.map +1 -0
- package/dist/types/api.types.js +10 -0
- package/dist/types/api.types.js.map +1 -0
- package/dist/types/branding.types.d.ts +53 -0
- package/dist/types/branding.types.d.ts.map +1 -0
- package/dist/types/branding.types.js +10 -0
- package/dist/types/branding.types.js.map +1 -0
- package/dist/types/config.types.d.ts +201 -0
- package/dist/types/config.types.d.ts.map +1 -0
- package/dist/types/config.types.js +10 -0
- package/dist/types/config.types.js.map +1 -0
- package/dist/types/copy.types.d.ts +109 -0
- package/dist/types/copy.types.d.ts.map +1 -0
- package/dist/types/copy.types.js +10 -0
- package/dist/types/copy.types.js.map +1 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +31 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/modes.types.d.ts +197 -0
- package/dist/types/modes.types.d.ts.map +1 -0
- package/dist/types/modes.types.js +35 -0
- package/dist/types/modes.types.js.map +1 -0
- package/dist/types/page.types.d.ts +120 -0
- package/dist/types/page.types.d.ts.map +1 -0
- package/dist/types/page.types.js +10 -0
- package/dist/types/page.types.js.map +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Security Validators
|
|
4
|
+
*
|
|
5
|
+
* Input validation utilities for secure rendering.
|
|
6
|
+
*
|
|
7
|
+
* @module @kya-os/consent/security/validators
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.validateColor = validateColor;
|
|
11
|
+
exports.validateUrl = validateUrl;
|
|
12
|
+
exports.validateEmail = validateEmail;
|
|
13
|
+
exports.validateDid = validateDid;
|
|
14
|
+
exports.validateNoControlChars = validateNoControlChars;
|
|
15
|
+
exports.sanitizeDisplayText = sanitizeDisplayText;
|
|
16
|
+
exports.validateIdentifier = validateIdentifier;
|
|
17
|
+
exports.isValidInteger = isValidInteger;
|
|
18
|
+
exports.validateCSRFToken = validateCSRFToken;
|
|
19
|
+
/**
|
|
20
|
+
* Validate that a string is a valid hex color
|
|
21
|
+
*
|
|
22
|
+
* Only accepts 6-digit hex colors with # prefix.
|
|
23
|
+
*
|
|
24
|
+
* @param color - Color string to validate
|
|
25
|
+
* @returns The color if valid, undefined otherwise
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* validateColor('#2563EB') // Returns '#2563EB'
|
|
30
|
+
* validateColor('2563EB') // Returns undefined
|
|
31
|
+
* validateColor('#fff') // Returns undefined (3-digit not allowed)
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
function validateColor(color) {
|
|
35
|
+
if (!color)
|
|
36
|
+
return undefined;
|
|
37
|
+
const hex6Pattern = /^#[0-9A-Fa-f]{6}$/;
|
|
38
|
+
if (hex6Pattern.test(color)) {
|
|
39
|
+
return color;
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Validate that a string is a valid URL
|
|
45
|
+
*
|
|
46
|
+
* Only accepts http and https protocols.
|
|
47
|
+
*
|
|
48
|
+
* @param url - URL string to validate
|
|
49
|
+
* @returns The URL if valid, undefined otherwise
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* validateUrl('https://example.com') // Returns 'https://example.com'
|
|
54
|
+
* validateUrl('javascript:alert(1)') // Returns undefined
|
|
55
|
+
* validateUrl('ftp://files.example.com') // Returns undefined
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
function validateUrl(url) {
|
|
59
|
+
if (!url)
|
|
60
|
+
return undefined;
|
|
61
|
+
try {
|
|
62
|
+
const parsed = new URL(url);
|
|
63
|
+
if (parsed.protocol === "http:" || parsed.protocol === "https:") {
|
|
64
|
+
return url;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// Invalid URL
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Validate that a string is a valid email address
|
|
74
|
+
*
|
|
75
|
+
* Uses a simple but effective email pattern.
|
|
76
|
+
*
|
|
77
|
+
* @param email - Email string to validate
|
|
78
|
+
* @returns The email if valid, undefined otherwise
|
|
79
|
+
*/
|
|
80
|
+
function validateEmail(email) {
|
|
81
|
+
if (!email)
|
|
82
|
+
return undefined;
|
|
83
|
+
// Simple email pattern - not exhaustive but catches most issues
|
|
84
|
+
const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
85
|
+
if (emailPattern.test(email) && email.length <= 255) {
|
|
86
|
+
return email;
|
|
87
|
+
}
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Validate that a string is a valid DID
|
|
92
|
+
*
|
|
93
|
+
* @param did - DID string to validate
|
|
94
|
+
* @returns The DID if valid, undefined otherwise
|
|
95
|
+
*/
|
|
96
|
+
function validateDid(did) {
|
|
97
|
+
if (!did)
|
|
98
|
+
return undefined;
|
|
99
|
+
// DID must start with did:
|
|
100
|
+
if (!did.startsWith("did:")) {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
// Must have at least method and identifier (did:method:identifier)
|
|
104
|
+
const parts = did.split(":");
|
|
105
|
+
if (parts.length < 3) {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
// Method must be alphanumeric
|
|
109
|
+
const method = parts[1];
|
|
110
|
+
if (!method || !/^[a-z0-9]+$/.test(method)) {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
// Reasonable length limit
|
|
114
|
+
if (did.length > 500) {
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
return did;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Validate that a string contains no control characters
|
|
121
|
+
*
|
|
122
|
+
* @param text - Text to validate
|
|
123
|
+
* @returns The text if valid, undefined otherwise
|
|
124
|
+
*/
|
|
125
|
+
function validateNoControlChars(text) {
|
|
126
|
+
if (!text)
|
|
127
|
+
return undefined;
|
|
128
|
+
// Allow only printable ASCII and common whitespace
|
|
129
|
+
// eslint-disable-next-line no-control-regex
|
|
130
|
+
const controlPattern = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/;
|
|
131
|
+
if (controlPattern.test(text)) {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
return text;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Validate and sanitize a string for display
|
|
138
|
+
*
|
|
139
|
+
* Removes control characters and trims whitespace.
|
|
140
|
+
*
|
|
141
|
+
* @param text - Text to sanitize
|
|
142
|
+
* @param maxLength - Maximum allowed length
|
|
143
|
+
* @returns Sanitized text or undefined if invalid
|
|
144
|
+
*/
|
|
145
|
+
function sanitizeDisplayText(text, maxLength = 500) {
|
|
146
|
+
if (!text)
|
|
147
|
+
return undefined;
|
|
148
|
+
// Remove control characters
|
|
149
|
+
// eslint-disable-next-line no-control-regex
|
|
150
|
+
const cleaned = text.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g, "");
|
|
151
|
+
// Trim and check length
|
|
152
|
+
const trimmed = cleaned.trim();
|
|
153
|
+
if (trimmed.length === 0 || trimmed.length > maxLength) {
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
156
|
+
return trimmed;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Validate that a string is alphanumeric with underscores only
|
|
160
|
+
*
|
|
161
|
+
* Useful for field names and identifiers.
|
|
162
|
+
*
|
|
163
|
+
* @param text - Text to validate
|
|
164
|
+
* @returns The text if valid, undefined otherwise
|
|
165
|
+
*/
|
|
166
|
+
function validateIdentifier(text) {
|
|
167
|
+
if (!text)
|
|
168
|
+
return undefined;
|
|
169
|
+
if (/^[a-zA-Z0-9_]+$/.test(text)) {
|
|
170
|
+
return text;
|
|
171
|
+
}
|
|
172
|
+
return undefined;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Check if a value is a safe integer within range
|
|
176
|
+
*
|
|
177
|
+
* @param value - Value to check
|
|
178
|
+
* @param min - Minimum value (inclusive)
|
|
179
|
+
* @param max - Maximum value (inclusive)
|
|
180
|
+
* @returns True if valid
|
|
181
|
+
*/
|
|
182
|
+
function isValidInteger(value, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) {
|
|
183
|
+
if (typeof value !== "number")
|
|
184
|
+
return false;
|
|
185
|
+
if (!Number.isFinite(value))
|
|
186
|
+
return false;
|
|
187
|
+
if (!Number.isInteger(value))
|
|
188
|
+
return false;
|
|
189
|
+
return value >= min && value <= max;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Validate a CSRF token format
|
|
193
|
+
*
|
|
194
|
+
* @param token - Token to validate
|
|
195
|
+
* @returns The token if valid, undefined otherwise
|
|
196
|
+
*/
|
|
197
|
+
function validateCSRFToken(token) {
|
|
198
|
+
if (!token)
|
|
199
|
+
return undefined;
|
|
200
|
+
// CSRF tokens should be reasonably long random strings
|
|
201
|
+
if (token.length < 16 || token.length > 256) {
|
|
202
|
+
return undefined;
|
|
203
|
+
}
|
|
204
|
+
// Should only contain safe characters
|
|
205
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(token)) {
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
return token;
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/security/validators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
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS Variable Generation
|
|
3
|
+
*
|
|
4
|
+
* Generates CSS custom properties for theming consent pages.
|
|
5
|
+
*
|
|
6
|
+
* @module @kya-os/consent/styles/css-variables
|
|
7
|
+
*/
|
|
8
|
+
import type { ConsentBranding, ConsentCSSVars } from "../types/branding.types";
|
|
9
|
+
/**
|
|
10
|
+
* CSS variable names used in consent pages
|
|
11
|
+
*/
|
|
12
|
+
export declare const CSS_VAR_NAMES: {
|
|
13
|
+
readonly PRIMARY: "--consent-primary";
|
|
14
|
+
readonly SECONDARY: "--consent-secondary";
|
|
15
|
+
readonly PRIMARY_RGB: "--consent-primary-rgb";
|
|
16
|
+
readonly SECONDARY_RGB: "--consent-secondary-rgb";
|
|
17
|
+
readonly BACKGROUND: "--consent-background";
|
|
18
|
+
readonly TEXT_PRIMARY: "--consent-text-primary";
|
|
19
|
+
readonly TEXT_SECONDARY: "--consent-text-secondary";
|
|
20
|
+
readonly BORDER: "--consent-border";
|
|
21
|
+
};
|
|
22
|
+
export type CSSVarName = (typeof CSS_VAR_NAMES)[keyof typeof CSS_VAR_NAMES];
|
|
23
|
+
/**
|
|
24
|
+
* Convert hex color to RGB string
|
|
25
|
+
*
|
|
26
|
+
* @param hex - Hex color string (e.g., '#2563EB')
|
|
27
|
+
* @returns RGB string (e.g., '37, 99, 235')
|
|
28
|
+
*/
|
|
29
|
+
export declare function hexToRgb(hex: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Generate CSS variables from branding configuration
|
|
32
|
+
*
|
|
33
|
+
* @param branding - Branding config (optional fields)
|
|
34
|
+
* @returns CSS variable object with resolved values
|
|
35
|
+
*/
|
|
36
|
+
export declare function generateCSSVariables(branding?: ConsentBranding): ConsentCSSVars;
|
|
37
|
+
/**
|
|
38
|
+
* Generate CSS variable declarations as a style string
|
|
39
|
+
*
|
|
40
|
+
* @param branding - Branding config
|
|
41
|
+
* @returns CSS style string (e.g., "--consent-primary: #2563EB;")
|
|
42
|
+
*/
|
|
43
|
+
export declare function generateCSSVariableString(branding?: ConsentBranding): string;
|
|
44
|
+
/**
|
|
45
|
+
* Generate CSS variable declarations with all theme colors
|
|
46
|
+
*
|
|
47
|
+
* @param branding - Branding config
|
|
48
|
+
* @returns Complete CSS variable declarations including derived colors
|
|
49
|
+
*/
|
|
50
|
+
export declare function generateFullCSSVariables(branding?: ConsentBranding): Record<string, string>;
|
|
51
|
+
/**
|
|
52
|
+
* Generate a style attribute value with CSS variables
|
|
53
|
+
*
|
|
54
|
+
* @param branding - Branding config
|
|
55
|
+
* @returns Style attribute value for inline styling
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```html
|
|
59
|
+
* <div style="${generateStyleAttribute(branding)}">...</div>
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare function generateStyleAttribute(branding?: ConsentBranding): string;
|
|
63
|
+
/**
|
|
64
|
+
* Generate a :root CSS block with all variables
|
|
65
|
+
*
|
|
66
|
+
* @param branding - Branding config
|
|
67
|
+
* @returns CSS :root block
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```css
|
|
71
|
+
* :root {
|
|
72
|
+
* --consent-primary: #2563EB;
|
|
73
|
+
* --consent-secondary: #DBEAFE;
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export declare function generateRootCSSBlock(branding?: ConsentBranding): string;
|
|
78
|
+
//# sourceMappingURL=css-variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-variables.d.ts","sourceRoot":"","sources":["../../src/styles/css-variables.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;CAShB,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;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,cAAc,CAU/E;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,MAAM,CAK5E;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAc3F;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"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* CSS Variable Generation
|
|
4
|
+
*
|
|
5
|
+
* Generates CSS custom properties for theming consent pages.
|
|
6
|
+
*
|
|
7
|
+
* @module @kya-os/consent/styles/css-variables
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.CSS_VAR_NAMES = void 0;
|
|
11
|
+
exports.hexToRgb = hexToRgb;
|
|
12
|
+
exports.generateCSSVariables = generateCSSVariables;
|
|
13
|
+
exports.generateCSSVariableString = generateCSSVariableString;
|
|
14
|
+
exports.generateFullCSSVariables = generateFullCSSVariables;
|
|
15
|
+
exports.generateStyleAttribute = generateStyleAttribute;
|
|
16
|
+
exports.generateRootCSSBlock = generateRootCSSBlock;
|
|
17
|
+
const colors_1 = require("../constants/colors");
|
|
18
|
+
/**
|
|
19
|
+
* CSS variable names used in consent pages
|
|
20
|
+
*/
|
|
21
|
+
exports.CSS_VAR_NAMES = {
|
|
22
|
+
PRIMARY: "--consent-primary",
|
|
23
|
+
SECONDARY: "--consent-secondary",
|
|
24
|
+
PRIMARY_RGB: "--consent-primary-rgb",
|
|
25
|
+
SECONDARY_RGB: "--consent-secondary-rgb",
|
|
26
|
+
BACKGROUND: "--consent-background",
|
|
27
|
+
TEXT_PRIMARY: "--consent-text-primary",
|
|
28
|
+
TEXT_SECONDARY: "--consent-text-secondary",
|
|
29
|
+
BORDER: "--consent-border",
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Convert hex color to RGB string
|
|
33
|
+
*
|
|
34
|
+
* @param hex - Hex color string (e.g., '#2563EB')
|
|
35
|
+
* @returns RGB string (e.g., '37, 99, 235')
|
|
36
|
+
*/
|
|
37
|
+
function hexToRgb(hex) {
|
|
38
|
+
// Remove # if present
|
|
39
|
+
const cleanHex = hex.replace(/^#/, '');
|
|
40
|
+
// Parse hex to RGB
|
|
41
|
+
const r = parseInt(cleanHex.slice(0, 2), 16);
|
|
42
|
+
const g = parseInt(cleanHex.slice(2, 4), 16);
|
|
43
|
+
const b = parseInt(cleanHex.slice(4, 6), 16);
|
|
44
|
+
return `${r}, ${g}, ${b}`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Generate CSS variables from branding configuration
|
|
48
|
+
*
|
|
49
|
+
* @param branding - Branding config (optional fields)
|
|
50
|
+
* @returns CSS variable object with resolved values
|
|
51
|
+
*/
|
|
52
|
+
function generateCSSVariables(branding) {
|
|
53
|
+
const primary = branding?.primaryColor ?? colors_1.DEFAULT_COLORS.PRIMARY;
|
|
54
|
+
const secondary = branding?.secondaryColor ?? colors_1.DEFAULT_COLORS.SECONDARY;
|
|
55
|
+
return {
|
|
56
|
+
"--consent-primary": primary,
|
|
57
|
+
"--consent-secondary": secondary,
|
|
58
|
+
"--consent-primary-rgb": hexToRgb(primary),
|
|
59
|
+
"--consent-secondary-rgb": hexToRgb(secondary),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Generate CSS variable declarations as a style string
|
|
64
|
+
*
|
|
65
|
+
* @param branding - Branding config
|
|
66
|
+
* @returns CSS style string (e.g., "--consent-primary: #2563EB;")
|
|
67
|
+
*/
|
|
68
|
+
function generateCSSVariableString(branding) {
|
|
69
|
+
const vars = generateCSSVariables(branding);
|
|
70
|
+
return Object.entries(vars)
|
|
71
|
+
.map(([name, value]) => `${name}: ${value};`)
|
|
72
|
+
.join(" ");
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Generate CSS variable declarations with all theme colors
|
|
76
|
+
*
|
|
77
|
+
* @param branding - Branding config
|
|
78
|
+
* @returns Complete CSS variable declarations including derived colors
|
|
79
|
+
*/
|
|
80
|
+
function generateFullCSSVariables(branding) {
|
|
81
|
+
const primary = branding?.primaryColor ?? colors_1.DEFAULT_COLORS.PRIMARY;
|
|
82
|
+
const secondary = branding?.secondaryColor ?? colors_1.DEFAULT_COLORS.SECONDARY;
|
|
83
|
+
return {
|
|
84
|
+
// Core branding colors
|
|
85
|
+
[exports.CSS_VAR_NAMES.PRIMARY]: primary,
|
|
86
|
+
[exports.CSS_VAR_NAMES.SECONDARY]: secondary,
|
|
87
|
+
// Additional theme colors
|
|
88
|
+
[exports.CSS_VAR_NAMES.BACKGROUND]: colors_1.DEFAULT_COLORS.BACKGROUND,
|
|
89
|
+
[exports.CSS_VAR_NAMES.TEXT_PRIMARY]: colors_1.DEFAULT_COLORS.TEXT_PRIMARY,
|
|
90
|
+
[exports.CSS_VAR_NAMES.TEXT_SECONDARY]: colors_1.DEFAULT_COLORS.TEXT_SECONDARY,
|
|
91
|
+
[exports.CSS_VAR_NAMES.BORDER]: colors_1.DEFAULT_COLORS.BORDER,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Generate a style attribute value with CSS variables
|
|
96
|
+
*
|
|
97
|
+
* @param branding - Branding config
|
|
98
|
+
* @returns Style attribute value for inline styling
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```html
|
|
102
|
+
* <div style="${generateStyleAttribute(branding)}">...</div>
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
function generateStyleAttribute(branding) {
|
|
106
|
+
return generateCSSVariableString(branding);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Generate a :root CSS block with all variables
|
|
110
|
+
*
|
|
111
|
+
* @param branding - Branding config
|
|
112
|
+
* @returns CSS :root block
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```css
|
|
116
|
+
* :root {
|
|
117
|
+
* --consent-primary: #2563EB;
|
|
118
|
+
* --consent-secondary: #DBEAFE;
|
|
119
|
+
* }
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
function generateRootCSSBlock(branding) {
|
|
123
|
+
const vars = generateFullCSSVariables(branding);
|
|
124
|
+
const declarations = Object.entries(vars)
|
|
125
|
+
.map(([name, value]) => ` ${name}: ${value};`)
|
|
126
|
+
.join("\n");
|
|
127
|
+
return `:root {\n${declarations}\n}`;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=css-variables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-variables.js","sourceRoot":"","sources":["../../src/styles/css-variables.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AA2BH,4BAUC;AAQD,oDAUC;AAQD,8DAKC;AAQD,4DAcC;AAaD,wDAEC;AAgBD,oDAOC;AA9HD,gDAAqD;AAGrD;;GAEG;AACU,QAAA,aAAa,GAAG;IAC3B,OAAO,EAAE,mBAAmB;IAC5B,SAAS,EAAE,qBAAqB;IAChC,WAAW,EAAE,uBAAuB;IACpC,aAAa,EAAE,yBAAyB;IACxC,UAAU,EAAE,sBAAsB;IAClC,YAAY,EAAE,wBAAwB;IACtC,cAAc,EAAE,0BAA0B;IAC1C,MAAM,EAAE,k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*
|
|
4
|
+
* CSS tokens and generators for consent page styling.
|
|
5
|
+
* Matches AgentShield preview components exactly for pixel-perfect parity.
|
|
6
|
+
*
|
|
7
|
+
* @module @kya-os/consent/styles
|
|
8
|
+
*/
|
|
9
|
+
export * from "./tokens";
|
|
10
|
+
export * from "./css-variables";
|
|
11
|
+
export * from "./stylesheet";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/styles/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Consent Styles
|
|
4
|
+
*
|
|
5
|
+
* CSS tokens and generators for consent page styling.
|
|
6
|
+
* Matches AgentShield preview components exactly for pixel-perfect parity.
|
|
7
|
+
*
|
|
8
|
+
* @module @kya-os/consent/styles
|
|
9
|
+
*/
|
|
10
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}) : (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
o[k2] = m[k];
|
|
20
|
+
}));
|
|
21
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
22
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
__exportStar(require("./tokens"), exports);
|
|
26
|
+
__exportStar(require("./css-variables"), exports);
|
|
27
|
+
__exportStar(require("./stylesheet"), exports);
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/styles/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;AAEH,2CAAyB;AACzB,kDAAgC;AAChC,+CAA6B"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stylesheet Generation
|
|
3
|
+
*
|
|
4
|
+
* Generates complete CSS stylesheets for consent pages.
|
|
5
|
+
*
|
|
6
|
+
* @module @kya-os/consent/styles/stylesheet
|
|
7
|
+
*/
|
|
8
|
+
import type { ConsentBranding } from "../types/branding.types";
|
|
9
|
+
/**
|
|
10
|
+
* Custom checkbox styles that work with Tailwind's appearance-none
|
|
11
|
+
*
|
|
12
|
+
* Creates a checkmark using CSS that appears when checked.
|
|
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";
|
|
15
|
+
/**
|
|
16
|
+
* Form input focus styles
|
|
17
|
+
*/
|
|
18
|
+
export declare const INPUT_STYLES = "\n/* Input focus states */\ninput:focus,\nselect:focus,\ntextarea:focus {\n outline: none;\n ring: 2px;\n ring-color: var(--consent-primary);\n border-color: transparent;\n}\n\n/* Password visibility toggle button */\n.password-toggle {\n position: absolute;\n right: 12px;\n top: 50%;\n transform: translateY(-50%);\n background: none;\n border: none;\n padding: 4px;\n cursor: pointer;\n color: #6B7280;\n}\n\n.password-toggle:hover {\n color: #374151;\n}\n";
|
|
19
|
+
/**
|
|
20
|
+
* Loading spinner animation
|
|
21
|
+
*/
|
|
22
|
+
export declare const SPINNER_STYLES = "\n/* Loading spinner */\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.animate-spin {\n animation: spin 1s linear infinite;\n}\n";
|
|
23
|
+
/**
|
|
24
|
+
* Smooth transitions
|
|
25
|
+
*/
|
|
26
|
+
export declare const TRANSITION_STYLES = "\n/* Smooth transitions */\n.transition-opacity {\n transition-property: opacity;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.transition-colors {\n transition-property: color, background-color, border-color;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.transition-shadow {\n transition-property: box-shadow;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n";
|
|
27
|
+
/**
|
|
28
|
+
* Generate a complete stylesheet for consent pages
|
|
29
|
+
*
|
|
30
|
+
* @param branding - Branding configuration
|
|
31
|
+
* @returns Complete CSS stylesheet string
|
|
32
|
+
*/
|
|
33
|
+
export declare function generateStylesheet(branding?: ConsentBranding): string;
|
|
34
|
+
/**
|
|
35
|
+
* Generate minimal inline styles (for embedding in HTML)
|
|
36
|
+
*
|
|
37
|
+
* @param branding - Branding configuration
|
|
38
|
+
* @returns Minimal CSS for inline <style> tag
|
|
39
|
+
*/
|
|
40
|
+
export declare function generateInlineStyles(branding?: ConsentBranding): string;
|
|
41
|
+
/**
|
|
42
|
+
* Generate styles for a specific component
|
|
43
|
+
*
|
|
44
|
+
* @param component - Component name
|
|
45
|
+
* @returns Component-specific CSS
|
|
46
|
+
*/
|
|
47
|
+
export declare function generateComponentStyles(component: "checkbox" | "input" | "spinner" | "all"): string;
|
|
48
|
+
/**
|
|
49
|
+
* Generate styles for the <head> section of consent pages
|
|
50
|
+
*
|
|
51
|
+
* This is an alias for generateStylesheet for compatibility with templates.
|
|
52
|
+
*
|
|
53
|
+
* @param branding - Branding configuration
|
|
54
|
+
* @returns CSS styles for <style> tag in <head>
|
|
55
|
+
*/
|
|
56
|
+
export declare function generateHeadStyles(branding?: ConsentBranding): string;
|
|
57
|
+
//# sourceMappingURL=stylesheet.d.ts.map
|
|
@@ -0,0 +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,yBAAyB,CAAC;AAG/D;;;;GAIG;AACH,eAAO,MAAM,eAAe,0bAmB3B,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,CAWR;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,MAAM,CAErE"}
|