web-stylebook-mcp 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/LICENSE +21 -0
- package/README.md +100 -0
- package/dist/catalog/repository.d.ts +72 -0
- package/dist/catalog/repository.js +111 -0
- package/dist/catalog/repository.js.map +1 -0
- package/dist/catalog/validate.d.ts +7 -0
- package/dist/catalog/validate.js +49 -0
- package/dist/catalog/validate.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +59 -0
- package/dist/cli.js.map +1 -0
- package/dist/localization.d.ts +5 -0
- package/dist/localization.js +10 -0
- package/dist/localization.js.map +1 -0
- package/dist/protocol/errors.d.ts +20 -0
- package/dist/protocol/errors.js +46 -0
- package/dist/protocol/errors.js.map +1 -0
- package/dist/protocol/register-prompts.d.ts +2 -0
- package/dist/protocol/register-prompts.js +76 -0
- package/dist/protocol/register-prompts.js.map +1 -0
- package/dist/protocol/register-resources.d.ts +3 -0
- package/dist/protocol/register-resources.js +85 -0
- package/dist/protocol/register-resources.js.map +1 -0
- package/dist/protocol/register-tools.d.ts +3 -0
- package/dist/protocol/register-tools.js +184 -0
- package/dist/protocol/register-tools.js.map +1 -0
- package/dist/protocol/result.d.ts +5 -0
- package/dist/protocol/result.js +26 -0
- package/dist/protocol/result.js.map +1 -0
- package/dist/recommendation/compare.d.ts +35 -0
- package/dist/recommendation/compare.js +118 -0
- package/dist/recommendation/compare.js.map +1 -0
- package/dist/recommendation/explain.d.ts +5 -0
- package/dist/recommendation/explain.js +88 -0
- package/dist/recommendation/explain.js.map +1 -0
- package/dist/recommendation/index.d.ts +4 -0
- package/dist/recommendation/index.js +11 -0
- package/dist/recommendation/index.js.map +1 -0
- package/dist/recommendation/normalize-context.d.ts +3 -0
- package/dist/recommendation/normalize-context.js +177 -0
- package/dist/recommendation/normalize-context.js.map +1 -0
- package/dist/recommendation/scoring.d.ts +8 -0
- package/dist/recommendation/scoring.js +370 -0
- package/dist/recommendation/scoring.js.map +1 -0
- package/dist/recommendation/types.d.ts +72 -0
- package/dist/recommendation/types.js +3 -0
- package/dist/recommendation/types.js.map +1 -0
- package/dist/server-info.d.ts +4 -0
- package/dist/server-info.js +16 -0
- package/dist/server-info.js.map +1 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.js +25 -0
- package/dist/server.js.map +1 -0
- package/dist/state-atlas/planner.d.ts +42 -0
- package/dist/state-atlas/planner.js +82 -0
- package/dist/state-atlas/planner.js.map +1 -0
- package/dist/tokens/compile.d.ts +27 -0
- package/dist/tokens/compile.js +304 -0
- package/dist/tokens/compile.js.map +1 -0
- package/dist/tokens/contrast.d.ts +18 -0
- package/dist/tokens/contrast.js +51 -0
- package/dist/tokens/contrast.js.map +1 -0
- package/dist/types.d.ts +287 -0
- package/dist/types.js +36 -0
- package/dist/types.js.map +1 -0
- package/generated/catalog.v1.json +18533 -0
- package/generated/manifest.v1.json +27 -0
- package/package.json +47 -0
- package/skill/CLAUDE.md +36 -0
- package/skill/web-stylebook-design/SKILL.md +95 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface Rgb {
|
|
2
|
+
r: number;
|
|
3
|
+
g: number;
|
|
4
|
+
b: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function parseHex(hex: string): Rgb | null;
|
|
7
|
+
export declare function relativeLuminance(rgb: Rgb): number;
|
|
8
|
+
/** WCAG contrast ratio (1..21). Returns 0 if either color is unparseable. */
|
|
9
|
+
export declare function contrastRatio(a: string, b: string): number;
|
|
10
|
+
export declare function luminanceOf(hex: string): number;
|
|
11
|
+
export interface ContrastWarning {
|
|
12
|
+
pair: string;
|
|
13
|
+
ratio: number;
|
|
14
|
+
threshold: number;
|
|
15
|
+
message: string;
|
|
16
|
+
}
|
|
17
|
+
/** AA: 4.5 for body text, 3.0 for large text / UI / focus. */
|
|
18
|
+
export declare function checkContrast(fg: string, bg: string, label: string, threshold?: number): ContrastWarning | null;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// WCAG contrast math (08 token compiler §8.4). No dependencies.
|
|
2
|
+
export function parseHex(hex) {
|
|
3
|
+
let h = hex.trim().replace(/^#/, '');
|
|
4
|
+
if (h.length === 3)
|
|
5
|
+
h = h.split('').map((c) => c + c).join('');
|
|
6
|
+
if (h.length === 8)
|
|
7
|
+
h = h.slice(0, 6);
|
|
8
|
+
if (h.length !== 6 || /[^0-9a-fA-F]/.test(h))
|
|
9
|
+
return null;
|
|
10
|
+
return {
|
|
11
|
+
r: parseInt(h.slice(0, 2), 16),
|
|
12
|
+
g: parseInt(h.slice(2, 4), 16),
|
|
13
|
+
b: parseInt(h.slice(4, 6), 16),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function channel(c) {
|
|
17
|
+
const s = c / 255;
|
|
18
|
+
return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
|
|
19
|
+
}
|
|
20
|
+
export function relativeLuminance(rgb) {
|
|
21
|
+
return 0.2126 * channel(rgb.r) + 0.7152 * channel(rgb.g) + 0.0722 * channel(rgb.b);
|
|
22
|
+
}
|
|
23
|
+
/** WCAG contrast ratio (1..21). Returns 0 if either color is unparseable. */
|
|
24
|
+
export function contrastRatio(a, b) {
|
|
25
|
+
const ra = parseHex(a);
|
|
26
|
+
const rb = parseHex(b);
|
|
27
|
+
if (!ra || !rb)
|
|
28
|
+
return 0;
|
|
29
|
+
const la = relativeLuminance(ra);
|
|
30
|
+
const lb = relativeLuminance(rb);
|
|
31
|
+
const hi = Math.max(la, lb);
|
|
32
|
+
const lo = Math.min(la, lb);
|
|
33
|
+
return (hi + 0.05) / (lo + 0.05);
|
|
34
|
+
}
|
|
35
|
+
export function luminanceOf(hex) {
|
|
36
|
+
const rgb = parseHex(hex);
|
|
37
|
+
return rgb ? relativeLuminance(rgb) : 0;
|
|
38
|
+
}
|
|
39
|
+
/** AA: 4.5 for body text, 3.0 for large text / UI / focus. */
|
|
40
|
+
export function checkContrast(fg, bg, label, threshold = 4.5) {
|
|
41
|
+
const ratio = Math.round(contrastRatio(fg, bg) * 100) / 100;
|
|
42
|
+
if (ratio >= threshold)
|
|
43
|
+
return null;
|
|
44
|
+
return {
|
|
45
|
+
pair: label,
|
|
46
|
+
ratio,
|
|
47
|
+
threshold,
|
|
48
|
+
message: `${label} contrast ${ratio}:1 is below WCAG AA ${threshold}:1 — verify or adjust.`,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=contrast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contrast.js","sourceRoot":"","sources":["../../src/tokens/contrast.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAIhE,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,IAAI,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACrC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/D,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1D,OAAO;QACL,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;QAC9B,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;QAC9B,CAAC,EAAE,QAAQ,CAAC,CAAC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AC,GAAG,CAAC,CAAC;IAC1B,OAAO,GAAG,CAAC,CAAC,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1C,CAAC;AASD,8DAA8D;AAC9D,MAAM,UAAU,aAAa,CAAC,EAAU,EAAE,EAAU,EAAE,KAAa,EAAE,SAAS,GAAG,GAAG;IAClF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IAC5D,IAAI,KAAK,IAAI,SAAS;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO;QACL,IAAI,EAAE,KAAK;QACX,KAAK;QACL,SAAS;QACT,OAAO,EAAE,GAAG,KAAK,aAAa,KAAK,uBAAuB,SAAS,wBAAwB;KAC5F,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
export type Lang = 'en' | 'ko' | 'ja';
|
|
2
|
+
export type LocalizedText = Record<Lang, string>;
|
|
3
|
+
export declare const LANGS: readonly Lang[];
|
|
4
|
+
export declare const DEFAULT_LANG: Lang;
|
|
5
|
+
export declare const PRODUCT_TYPES: readonly ["operational-saas", "developer-tool", "documentation", "data-analytics", "security-console", "finance-admin", "healthcare-portal", "commerce", "ai-chat", "content-editorial", "knowledge-base", "portfolio", "campaign", "consumer-app", "other"];
|
|
6
|
+
export type ProductType = (typeof PRODUCT_TYPES)[number];
|
|
7
|
+
export declare const TONES: readonly ["calm", "technical", "trustworthy", "premium", "editorial", "playful", "bold", "experimental"];
|
|
8
|
+
export type Tone = (typeof TONES)[number];
|
|
9
|
+
export declare const DENSITY_LEVELS: readonly ["low", "medium", "high"];
|
|
10
|
+
export type Density = (typeof DENSITY_LEVELS)[number];
|
|
11
|
+
export declare const USAGE_FREQUENCIES: readonly ["one-off", "occasional", "daily"];
|
|
12
|
+
export type UsageFrequency = (typeof USAGE_FREQUENCIES)[number];
|
|
13
|
+
export declare const TRUST_LEVELS: readonly ["low", "medium", "high"];
|
|
14
|
+
export type TrustLevel = (typeof TRUST_LEVELS)[number];
|
|
15
|
+
export declare const INTENSITY_LEVELS: readonly ["low", "medium", "high"];
|
|
16
|
+
export type Intensity = (typeof INTENSITY_LEVELS)[number];
|
|
17
|
+
export declare const STATE_CATEGORIES: readonly ["data", "network", "permission", "interaction", "content", "environment", "time"];
|
|
18
|
+
export type StateCategory = (typeof STATE_CATEGORIES)[number];
|
|
19
|
+
export declare const STATE_CRITICALITIES: readonly ["required", "recommended", "domain-specific"];
|
|
20
|
+
export type StateCriticality = (typeof STATE_CRITICALITIES)[number];
|
|
21
|
+
export declare const COMPONENT_CATEGORIES: readonly ["states", "controls", "navigation", "feedback", "layout"];
|
|
22
|
+
export type ComponentCategory = (typeof COMPONENT_CATEGORIES)[number];
|
|
23
|
+
export declare const MOTION_CATEGORIES: readonly ["entrance", "attention", "interaction", "state", "loading", "scroll", "ambient"];
|
|
24
|
+
export type MotionCategory = (typeof MOTION_CATEGORIES)[number];
|
|
25
|
+
export declare const TASK_TAGS: readonly ["monitor", "triage", "configure", "analyze", "audit", "author", "read", "search", "browse", "compare", "purchase", "checkout", "communicate", "onboard", "navigate", "manage", "review", "upload", "schedule"];
|
|
26
|
+
export type TaskTag = (typeof TASK_TAGS)[number];
|
|
27
|
+
export interface OntologyTerm {
|
|
28
|
+
value: string;
|
|
29
|
+
label: LocalizedText;
|
|
30
|
+
aliases: string[];
|
|
31
|
+
}
|
|
32
|
+
export interface ConstraintMapping {
|
|
33
|
+
constraint: string;
|
|
34
|
+
matchesRisks: string[];
|
|
35
|
+
hardReject?: 'ACCESSIBILITY_CONFLICT';
|
|
36
|
+
}
|
|
37
|
+
export interface Ontology {
|
|
38
|
+
productTypes: OntologyTerm[];
|
|
39
|
+
tones: OntologyTerm[];
|
|
40
|
+
densityLevels: OntologyTerm[];
|
|
41
|
+
usageFrequencies: OntologyTerm[];
|
|
42
|
+
trustLevels: OntologyTerm[];
|
|
43
|
+
taskTags: OntologyTerm[];
|
|
44
|
+
stateCategories: OntologyTerm[];
|
|
45
|
+
productAdjacency: Record<string, ProductType[]>;
|
|
46
|
+
constraintMappings: ConstraintMapping[];
|
|
47
|
+
}
|
|
48
|
+
export interface RecommendationFacets {
|
|
49
|
+
productTypes: ProductType[];
|
|
50
|
+
tones: Tone[];
|
|
51
|
+
antiTones: Tone[];
|
|
52
|
+
density: Density[];
|
|
53
|
+
usageFrequency: UsageFrequency[];
|
|
54
|
+
trust: TrustLevel[];
|
|
55
|
+
strengths: string[];
|
|
56
|
+
risks: string[];
|
|
57
|
+
motionIntensity: Intensity;
|
|
58
|
+
continuousSpectacle: boolean;
|
|
59
|
+
maintenanceComplexity: Intensity;
|
|
60
|
+
}
|
|
61
|
+
export type NotIdealMap = Record<string, ProductType[]>;
|
|
62
|
+
export interface CatalogStyle {
|
|
63
|
+
id: string;
|
|
64
|
+
kind: 'style' | 'fusion';
|
|
65
|
+
name: LocalizedText;
|
|
66
|
+
description: LocalizedText;
|
|
67
|
+
summary: LocalizedText;
|
|
68
|
+
tags: string[];
|
|
69
|
+
palette: string[];
|
|
70
|
+
accent: string;
|
|
71
|
+
typography: string;
|
|
72
|
+
layout: string;
|
|
73
|
+
motion: string;
|
|
74
|
+
bestFor: string[];
|
|
75
|
+
constraints: string[];
|
|
76
|
+
notIdealFor: string[];
|
|
77
|
+
visualProfile: {
|
|
78
|
+
headline: string;
|
|
79
|
+
surface: string;
|
|
80
|
+
rhythm: string;
|
|
81
|
+
};
|
|
82
|
+
recommendationFacets: RecommendationFacets;
|
|
83
|
+
fusionOf?: string[];
|
|
84
|
+
styleFamilyId?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface DesignTokenColor {
|
|
87
|
+
canvas: string;
|
|
88
|
+
surface: string;
|
|
89
|
+
surfaceRaised: string;
|
|
90
|
+
surfaceMuted: string;
|
|
91
|
+
text: string;
|
|
92
|
+
textMuted: string;
|
|
93
|
+
textInverse: string;
|
|
94
|
+
border: string;
|
|
95
|
+
borderStrong: string;
|
|
96
|
+
accent: string;
|
|
97
|
+
accentText: string;
|
|
98
|
+
/** Secondary style's accent for secondary surfaces (only when a secondaryStyleId is given). */
|
|
99
|
+
accentSecondary?: string;
|
|
100
|
+
accentSecondaryText?: string;
|
|
101
|
+
positive: string;
|
|
102
|
+
caution: string;
|
|
103
|
+
critical: string;
|
|
104
|
+
info: string;
|
|
105
|
+
focus: string;
|
|
106
|
+
}
|
|
107
|
+
export interface DesignTokenTypography {
|
|
108
|
+
displayFamily: string;
|
|
109
|
+
bodyFamily: string;
|
|
110
|
+
monoFamily: string;
|
|
111
|
+
scale: Record<string, string>;
|
|
112
|
+
lineHeight: Record<string, number>;
|
|
113
|
+
}
|
|
114
|
+
export interface DesignTokens {
|
|
115
|
+
color: DesignTokenColor;
|
|
116
|
+
typography: DesignTokenTypography;
|
|
117
|
+
spacing: Record<string, string>;
|
|
118
|
+
radius: Record<string, string>;
|
|
119
|
+
shadow: Record<string, string>;
|
|
120
|
+
motion: Record<string, string>;
|
|
121
|
+
density: Record<string, string>;
|
|
122
|
+
}
|
|
123
|
+
export interface StyleFamily {
|
|
124
|
+
id: string;
|
|
125
|
+
name: LocalizedText;
|
|
126
|
+
memberStyleIds: string[];
|
|
127
|
+
tokenDefaults: {
|
|
128
|
+
color: Partial<DesignTokenColor>;
|
|
129
|
+
typography: Partial<DesignTokenTypography>;
|
|
130
|
+
radius?: Record<string, string>;
|
|
131
|
+
motion?: Record<string, string>;
|
|
132
|
+
density?: Record<string, string>;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
export interface MotionCategoryDef {
|
|
136
|
+
id: MotionCategory;
|
|
137
|
+
label: LocalizedText;
|
|
138
|
+
description: LocalizedText;
|
|
139
|
+
}
|
|
140
|
+
export interface MotionPattern {
|
|
141
|
+
id: string;
|
|
142
|
+
category: MotionCategory;
|
|
143
|
+
name: LocalizedText;
|
|
144
|
+
aliases: string[];
|
|
145
|
+
summary: LocalizedText;
|
|
146
|
+
useWhen: LocalizedText;
|
|
147
|
+
avoidWhen: LocalizedText;
|
|
148
|
+
prompt: LocalizedText;
|
|
149
|
+
intensity: Intensity;
|
|
150
|
+
continuous: boolean;
|
|
151
|
+
reducedMotionFallback: LocalizedText;
|
|
152
|
+
previewKind?: string;
|
|
153
|
+
}
|
|
154
|
+
export interface ComponentCategoryDef {
|
|
155
|
+
id: ComponentCategory;
|
|
156
|
+
title: LocalizedText;
|
|
157
|
+
description: LocalizedText;
|
|
158
|
+
}
|
|
159
|
+
export interface ComponentTerm {
|
|
160
|
+
id: string;
|
|
161
|
+
category: ComponentCategory;
|
|
162
|
+
name: LocalizedText;
|
|
163
|
+
aliases: string[];
|
|
164
|
+
plain: LocalizedText;
|
|
165
|
+
useWhen: LocalizedText;
|
|
166
|
+
avoidWhen: LocalizedText;
|
|
167
|
+
semanticRoles: string[];
|
|
168
|
+
relatedStateIds: string[];
|
|
169
|
+
example?: string;
|
|
170
|
+
}
|
|
171
|
+
export interface ProductArchetype {
|
|
172
|
+
id: string;
|
|
173
|
+
name: LocalizedText;
|
|
174
|
+
description: LocalizedText;
|
|
175
|
+
signals: string[];
|
|
176
|
+
primaryTasks: TaskTag[];
|
|
177
|
+
commonScreens: string[];
|
|
178
|
+
recommendedPrimaryStyleIds: string[];
|
|
179
|
+
recommendedSecondaryStyleIds: string[];
|
|
180
|
+
avoidStyleIds: string[];
|
|
181
|
+
defaultDensity: Density;
|
|
182
|
+
defaultUsageFrequency: UsageFrequency;
|
|
183
|
+
defaultTrust: TrustLevel;
|
|
184
|
+
stateSurfaceIds: string[];
|
|
185
|
+
}
|
|
186
|
+
export interface StateSurface {
|
|
187
|
+
id: string;
|
|
188
|
+
name: LocalizedText;
|
|
189
|
+
description: LocalizedText;
|
|
190
|
+
requiredStateIds: string[];
|
|
191
|
+
recommendedStateIds: string[];
|
|
192
|
+
domainSignals: string[];
|
|
193
|
+
}
|
|
194
|
+
export interface StateAccessibility {
|
|
195
|
+
announcement?: LocalizedText;
|
|
196
|
+
focus?: LocalizedText;
|
|
197
|
+
keyboard?: LocalizedText[];
|
|
198
|
+
contrast?: LocalizedText[];
|
|
199
|
+
}
|
|
200
|
+
export interface StateMotionGuidance {
|
|
201
|
+
guidance: LocalizedText[];
|
|
202
|
+
reducedMotion: LocalizedText[];
|
|
203
|
+
}
|
|
204
|
+
export interface StateRecipe {
|
|
205
|
+
id: string;
|
|
206
|
+
surfaceIds: string[];
|
|
207
|
+
category: StateCategory;
|
|
208
|
+
criticality: StateCriticality;
|
|
209
|
+
name: LocalizedText;
|
|
210
|
+
summary: LocalizedText;
|
|
211
|
+
aliases: string[];
|
|
212
|
+
domainSignals: string[];
|
|
213
|
+
triggers: LocalizedText[];
|
|
214
|
+
userQuestions: LocalizedText[];
|
|
215
|
+
mustShow: LocalizedText[];
|
|
216
|
+
mustPreserve: LocalizedText[];
|
|
217
|
+
primaryActions: LocalizedText[];
|
|
218
|
+
secondaryActions: LocalizedText[];
|
|
219
|
+
mustNot: LocalizedText[];
|
|
220
|
+
accessibility: StateAccessibility;
|
|
221
|
+
motion: StateMotionGuidance;
|
|
222
|
+
}
|
|
223
|
+
export interface PreflightCheck {
|
|
224
|
+
id: string;
|
|
225
|
+
label: LocalizedText;
|
|
226
|
+
detail: LocalizedText;
|
|
227
|
+
}
|
|
228
|
+
export interface VerificationGroup {
|
|
229
|
+
id: string;
|
|
230
|
+
title: LocalizedText;
|
|
231
|
+
items: LocalizedText[];
|
|
232
|
+
}
|
|
233
|
+
export interface AntiPattern {
|
|
234
|
+
id: string;
|
|
235
|
+
pattern: LocalizedText;
|
|
236
|
+
why: LocalizedText;
|
|
237
|
+
fix: LocalizedText;
|
|
238
|
+
}
|
|
239
|
+
export interface DecisionExample {
|
|
240
|
+
id: string;
|
|
241
|
+
product: LocalizedText;
|
|
242
|
+
chosenPrimary: string;
|
|
243
|
+
chosenSecondary?: string;
|
|
244
|
+
reasoning: LocalizedText;
|
|
245
|
+
wouldNotPick: {
|
|
246
|
+
id: string;
|
|
247
|
+
reason: LocalizedText;
|
|
248
|
+
}[];
|
|
249
|
+
}
|
|
250
|
+
export interface Policies {
|
|
251
|
+
preflight: PreflightCheck[];
|
|
252
|
+
verification: VerificationGroup[];
|
|
253
|
+
antiPatterns: AntiPattern[];
|
|
254
|
+
decisionExamples: DecisionExample[];
|
|
255
|
+
}
|
|
256
|
+
export interface CatalogOntologyEnums {
|
|
257
|
+
productTypes: string[];
|
|
258
|
+
tones: string[];
|
|
259
|
+
densityLevels: string[];
|
|
260
|
+
usageFrequencies: string[];
|
|
261
|
+
trustLevels: string[];
|
|
262
|
+
stateCategories: string[];
|
|
263
|
+
taskTags: string[];
|
|
264
|
+
}
|
|
265
|
+
export interface WebStylebookCatalogV1 {
|
|
266
|
+
ontology: Ontology;
|
|
267
|
+
ontologyEnums: CatalogOntologyEnums;
|
|
268
|
+
styles: CatalogStyle[];
|
|
269
|
+
styleFamilies: StyleFamily[];
|
|
270
|
+
notIdealMap: NotIdealMap;
|
|
271
|
+
motionCategories: MotionCategoryDef[];
|
|
272
|
+
motionPatterns: MotionPattern[];
|
|
273
|
+
componentCategories: ComponentCategoryDef[];
|
|
274
|
+
components: ComponentTerm[];
|
|
275
|
+
productArchetypes: ProductArchetype[];
|
|
276
|
+
stateSurfaces: StateSurface[];
|
|
277
|
+
stateRecipes: StateRecipe[];
|
|
278
|
+
policies: Policies;
|
|
279
|
+
}
|
|
280
|
+
export interface CatalogEnvelope {
|
|
281
|
+
schema: 'webstylebook.catalog.v1';
|
|
282
|
+
catalogVersion: string;
|
|
283
|
+
contentHash: string;
|
|
284
|
+
sourceRevision?: string;
|
|
285
|
+
languages: ['en', 'ko', 'ja'];
|
|
286
|
+
data: WebStylebookCatalogV1;
|
|
287
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Catalog types for the MCP runtime. Self-contained copy of the canonical
|
|
2
|
+
// src/catalog/types.ts (ADR-003: the package never imports src/ at runtime).
|
|
3
|
+
// The loaded catalog JSON is validated against catalog-schema.ts at load time,
|
|
4
|
+
// and the contract/golden tests guard against drift from the source-of-truth.
|
|
5
|
+
export const LANGS = ['en', 'ko', 'ja'];
|
|
6
|
+
export const DEFAULT_LANG = 'en';
|
|
7
|
+
export const PRODUCT_TYPES = [
|
|
8
|
+
'operational-saas', 'developer-tool', 'documentation', 'data-analytics',
|
|
9
|
+
'security-console', 'finance-admin', 'healthcare-portal', 'commerce',
|
|
10
|
+
'ai-chat', 'content-editorial', 'knowledge-base', 'portfolio',
|
|
11
|
+
'campaign', 'consumer-app', 'other',
|
|
12
|
+
];
|
|
13
|
+
export const TONES = [
|
|
14
|
+
'calm', 'technical', 'trustworthy', 'premium',
|
|
15
|
+
'editorial', 'playful', 'bold', 'experimental',
|
|
16
|
+
];
|
|
17
|
+
export const DENSITY_LEVELS = ['low', 'medium', 'high'];
|
|
18
|
+
export const USAGE_FREQUENCIES = ['one-off', 'occasional', 'daily'];
|
|
19
|
+
export const TRUST_LEVELS = ['low', 'medium', 'high'];
|
|
20
|
+
export const INTENSITY_LEVELS = ['low', 'medium', 'high'];
|
|
21
|
+
export const STATE_CATEGORIES = [
|
|
22
|
+
'data', 'network', 'permission', 'interaction', 'content', 'environment', 'time',
|
|
23
|
+
];
|
|
24
|
+
export const STATE_CRITICALITIES = ['required', 'recommended', 'domain-specific'];
|
|
25
|
+
export const COMPONENT_CATEGORIES = [
|
|
26
|
+
'states', 'controls', 'navigation', 'feedback', 'layout',
|
|
27
|
+
];
|
|
28
|
+
export const MOTION_CATEGORIES = [
|
|
29
|
+
'entrance', 'attention', 'interaction', 'state', 'loading', 'scroll', 'ambient',
|
|
30
|
+
];
|
|
31
|
+
export const TASK_TAGS = [
|
|
32
|
+
'monitor', 'triage', 'configure', 'analyze', 'audit', 'author', 'read', 'search',
|
|
33
|
+
'browse', 'compare', 'purchase', 'checkout', 'communicate', 'onboard', 'navigate',
|
|
34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