@axiom-lattice/protocols 7.4.0 → 7.5.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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +18 -0
- package/dist/index.d.mts +1143 -3
- package/dist/index.d.ts +1143 -3
- package/dist/index.js +1519 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1489 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/AuthCssContract.ts +49 -0
- package/src/PlatformBrandingFields.ts +1562 -0
- package/src/PlatformSettingsProtocol.ts +98 -0
- package/src/__tests__/PlatformBrandingFields.test.ts +178 -0
- package/src/index.ts +1 -0
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AuthFontFamilyId,
|
|
3
|
+
LoginLayoutId,
|
|
4
|
+
} from "./PlatformBrandingFields";
|
|
5
|
+
import { DEFAULT_LOGIN_LAYOUT } from "./PlatformBrandingFields";
|
|
6
|
+
|
|
1
7
|
/** Source that produced an effective platform setting value. */
|
|
2
8
|
export type PlatformSettingSource = "default" | "env" | "platform";
|
|
3
9
|
|
|
@@ -10,7 +16,68 @@ export interface PlatformBranding {
|
|
|
10
16
|
backgroundColor?: string;
|
|
11
17
|
loginTitle?: string;
|
|
12
18
|
loginSubtitle?: string;
|
|
19
|
+
footerNote?: string;
|
|
13
20
|
customCss?: string;
|
|
21
|
+
|
|
22
|
+
loginLayout?: LoginLayoutId;
|
|
23
|
+
cardStyle?: "card" | "plain" | "glass" | "outline";
|
|
24
|
+
cardPosition?: "center" | "left" | "right";
|
|
25
|
+
surfaceColor?: string;
|
|
26
|
+
textColor?: string;
|
|
27
|
+
textSecondaryColor?: string;
|
|
28
|
+
borderColor?: string;
|
|
29
|
+
radius?: number;
|
|
30
|
+
fontFamily?: AuthFontFamilyId;
|
|
31
|
+
fieldStyle?: "soft" | "outline" | "filled" | "underline" | "none";
|
|
32
|
+
logoSize?: number;
|
|
33
|
+
titleSize?: number;
|
|
34
|
+
bodySize?: number;
|
|
35
|
+
pagePadding?: number;
|
|
36
|
+
cardPadding?: number;
|
|
37
|
+
cardWidth?: number;
|
|
38
|
+
cardShadow?: "none" | "soft" | "floating" | "hard";
|
|
39
|
+
cardEffect?: "none" | "gradient-border" | "inner-glow";
|
|
40
|
+
backgroundPattern?: "none" | "grid" | "dots" | "aurora";
|
|
41
|
+
backgroundTreatment?: "none" | "vignette" | "grain" | "duotone";
|
|
42
|
+
imageFit?: "cover" | "contain";
|
|
43
|
+
imagePosition?: "center" | "top" | "bottom" | "left" | "right";
|
|
44
|
+
imageTreatment?: "none" | "grayscale" | "duotone";
|
|
45
|
+
logoStyle?: "plain" | "badge";
|
|
46
|
+
formDensity?: "compact" | "comfortable" | "airy";
|
|
47
|
+
ssoLayout?: "stack" | "inline";
|
|
48
|
+
|
|
49
|
+
panelPosition?: "left" | "right";
|
|
50
|
+
panelContentAlign?: "left" | "center";
|
|
51
|
+
panelVisual?: "orbit" | "mesh" | "waves" | "aurora" | "topography" | "none";
|
|
52
|
+
panelTitle?: string;
|
|
53
|
+
panelDescription?: string;
|
|
54
|
+
panelPoint1?: string;
|
|
55
|
+
panelPoint2?: string;
|
|
56
|
+
panelPoint3?: string;
|
|
57
|
+
panelImageUrl?: string;
|
|
58
|
+
panelVideoUrl?: string;
|
|
59
|
+
panelProductImageUrl?: string;
|
|
60
|
+
panelProductImageAlt?: string;
|
|
61
|
+
|
|
62
|
+
panelEyebrow?: string;
|
|
63
|
+
panelStat1Value?: string;
|
|
64
|
+
panelStat1Label?: string;
|
|
65
|
+
panelStat2Value?: string;
|
|
66
|
+
panelStat2Label?: string;
|
|
67
|
+
panelStat3Value?: string;
|
|
68
|
+
panelStat3Label?: string;
|
|
69
|
+
panelQuote?: string;
|
|
70
|
+
panelQuoteAuthor?: string;
|
|
71
|
+
panelQuoteRole?: string;
|
|
72
|
+
panelTrustLogo1?: string;
|
|
73
|
+
panelTrustLogo2?: string;
|
|
74
|
+
panelTrustLogo3?: string;
|
|
75
|
+
panelTrustLogo4?: string;
|
|
76
|
+
|
|
77
|
+
backgroundImageUrl?: string;
|
|
78
|
+
backgroundVideoUrl?: string;
|
|
79
|
+
backgroundOverlayColor?: string;
|
|
80
|
+
backgroundOverlayOpacity?: number;
|
|
14
81
|
}
|
|
15
82
|
|
|
16
83
|
/** Host-scoped branding and public endpoint overrides. */
|
|
@@ -142,6 +209,37 @@ export const DEFAULT_PLATFORM_BRANDING: PlatformBranding = {
|
|
|
142
209
|
logoUrl: "/logo.png",
|
|
143
210
|
primaryColor: "#5b50c6",
|
|
144
211
|
backgroundColor: "#ffffff",
|
|
212
|
+
loginLayout: DEFAULT_LOGIN_LAYOUT,
|
|
213
|
+
cardStyle: "card",
|
|
214
|
+
cardPosition: "center",
|
|
215
|
+
surfaceColor: "#ffffff",
|
|
216
|
+
textColor: "#101828",
|
|
217
|
+
textSecondaryColor: "#667085",
|
|
218
|
+
borderColor: "#e4e7ec",
|
|
219
|
+
radius: 12,
|
|
220
|
+
fontFamily: "system",
|
|
221
|
+
fieldStyle: "soft",
|
|
222
|
+
logoSize: 64,
|
|
223
|
+
titleSize: 24,
|
|
224
|
+
bodySize: 16,
|
|
225
|
+
pagePadding: 16,
|
|
226
|
+
cardPadding: 24,
|
|
227
|
+
cardWidth: 400,
|
|
228
|
+
cardShadow: "soft",
|
|
229
|
+
cardEffect: "none",
|
|
230
|
+
backgroundPattern: "none",
|
|
231
|
+
backgroundTreatment: "none",
|
|
232
|
+
imageFit: "cover",
|
|
233
|
+
imagePosition: "center",
|
|
234
|
+
imageTreatment: "none",
|
|
235
|
+
logoStyle: "plain",
|
|
236
|
+
formDensity: "comfortable",
|
|
237
|
+
ssoLayout: "stack",
|
|
238
|
+
panelPosition: "left",
|
|
239
|
+
panelContentAlign: "left",
|
|
240
|
+
panelVisual: "orbit",
|
|
241
|
+
backgroundOverlayColor: "#000000",
|
|
242
|
+
backgroundOverlayOpacity: 40,
|
|
145
243
|
};
|
|
146
244
|
|
|
147
245
|
/**
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_PLATFORM_BRANDING,
|
|
3
|
+
type PlatformBranding,
|
|
4
|
+
} from "../PlatformSettingsProtocol";
|
|
5
|
+
import {
|
|
6
|
+
AUTH_BRANDING_CASES,
|
|
7
|
+
AUTH_BRANDING_PRESETS,
|
|
8
|
+
AUTH_BRANDING_PRESET_IDS,
|
|
9
|
+
AUTH_FONT_FAMILIES,
|
|
10
|
+
AUTH_SLOT_REGISTRY,
|
|
11
|
+
AUTH_SURFACE_KINDS,
|
|
12
|
+
DEFAULT_LOGIN_LAYOUT,
|
|
13
|
+
LOGIN_LAYOUTS,
|
|
14
|
+
PLATFORM_BRANDING_FIELDS,
|
|
15
|
+
PLATFORM_BRANDING_FIELD_KEYS,
|
|
16
|
+
isLoginLayoutId,
|
|
17
|
+
layoutSpecificFields,
|
|
18
|
+
layoutSupportsSurface,
|
|
19
|
+
resolveLoginLayout,
|
|
20
|
+
} from "../PlatformBrandingFields";
|
|
21
|
+
|
|
22
|
+
describe("PlatformBrandingFields", () => {
|
|
23
|
+
it("covers every PlatformBranding key exactly once", () => {
|
|
24
|
+
const typed: Array<keyof PlatformBranding> = [
|
|
25
|
+
...PLATFORM_BRANDING_FIELD_KEYS,
|
|
26
|
+
];
|
|
27
|
+
expect(new Set(typed).size).toBe(PLATFORM_BRANDING_FIELD_KEYS.length);
|
|
28
|
+
expect(typed.sort()).toEqual(
|
|
29
|
+
(Object.keys(PLATFORM_BRANDING_FIELDS) as Array<keyof PlatformBranding>).sort(),
|
|
30
|
+
);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("registers every layout field in the field registry", () => {
|
|
34
|
+
for (const layout of Object.values(LOGIN_LAYOUTS)) {
|
|
35
|
+
for (const field of layout.fields) {
|
|
36
|
+
expect(PLATFORM_BRANDING_FIELDS[field]).toBeDefined();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("keeps centered available on every surface", () => {
|
|
42
|
+
for (const surface of AUTH_SURFACE_KINDS) {
|
|
43
|
+
expect(layoutSupportsSurface("centered", surface)).toBe(true);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("assigns background fields to centered and full-bleed", () => {
|
|
48
|
+
expect(layoutSpecificFields("centered")).toEqual(
|
|
49
|
+
expect.arrayContaining([
|
|
50
|
+
"backgroundImageUrl",
|
|
51
|
+
"backgroundOverlayColor",
|
|
52
|
+
"backgroundOverlayOpacity",
|
|
53
|
+
]),
|
|
54
|
+
);
|
|
55
|
+
expect(layoutSpecificFields("full-bleed")).toEqual(
|
|
56
|
+
expect.arrayContaining([
|
|
57
|
+
"cardPosition",
|
|
58
|
+
"backgroundImageUrl",
|
|
59
|
+
"backgroundVideoUrl",
|
|
60
|
+
]),
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("falls back to centered for unknown or unsupported layouts", () => {
|
|
65
|
+
expect(resolveLoginLayout("unknown", "login")).toBe(DEFAULT_LOGIN_LAYOUT);
|
|
66
|
+
expect(resolveLoginLayout("split-brand", "invite")).toBe(
|
|
67
|
+
DEFAULT_LOGIN_LAYOUT,
|
|
68
|
+
);
|
|
69
|
+
expect(resolveLoginLayout("split-brand", "login")).toBe("split-brand");
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("exposes a non-empty font stack for every preset", () => {
|
|
73
|
+
for (const family of Object.values(AUTH_FONT_FAMILIES)) {
|
|
74
|
+
expect(family.stack.length).toBeGreaterThan(0);
|
|
75
|
+
expect(family.labelKey.length).toBeGreaterThan(0);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("keeps presets visually distinct beyond color", () => {
|
|
80
|
+
const axes = [
|
|
81
|
+
"loginLayout",
|
|
82
|
+
"cardStyle",
|
|
83
|
+
"cardPosition",
|
|
84
|
+
"panelPosition",
|
|
85
|
+
"panelContentAlign",
|
|
86
|
+
"panelVisual",
|
|
87
|
+
"backgroundPattern",
|
|
88
|
+
"backgroundTreatment",
|
|
89
|
+
"fontFamily",
|
|
90
|
+
"fieldStyle",
|
|
91
|
+
"cardEffect",
|
|
92
|
+
"logoStyle",
|
|
93
|
+
"formDensity",
|
|
94
|
+
"ssoLayout",
|
|
95
|
+
"cardShadow",
|
|
96
|
+
] as const;
|
|
97
|
+
|
|
98
|
+
const presets = Object.values(AUTH_BRANDING_PRESETS);
|
|
99
|
+
const signatures = presets.map((preset) => {
|
|
100
|
+
const branding = preset.branding as Partial<PlatformBranding>;
|
|
101
|
+
return axes.map((axis) =>
|
|
102
|
+
String(branding[axis] ?? DEFAULT_PLATFORM_BRANDING[axis] ?? ""),
|
|
103
|
+
);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
expect(new Set(signatures.map((signature) => signature.join("|"))).size).toBe(
|
|
107
|
+
presets.length,
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
for (let i = 0; i < signatures.length; i += 1) {
|
|
111
|
+
for (let j = i + 1; j < signatures.length; j += 1) {
|
|
112
|
+
const distance = signatures[i].filter(
|
|
113
|
+
(value, index) => value !== signatures[j][index],
|
|
114
|
+
).length;
|
|
115
|
+
expect(distance).toBeGreaterThanOrEqual(3);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it("keeps layout slots and the slot registry in sync", () => {
|
|
121
|
+
for (const layout of Object.values(LOGIN_LAYOUTS)) {
|
|
122
|
+
for (const slot of layout.slots) {
|
|
123
|
+
expect(AUTH_SLOT_REGISTRY[slot]).toBeDefined();
|
|
124
|
+
expect(AUTH_SLOT_REGISTRY[slot].layouts).toContain(layout.id);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
for (const slot of Object.values(AUTH_SLOT_REGISTRY)) {
|
|
129
|
+
expect(slot.renderer.length).toBeGreaterThan(0);
|
|
130
|
+
for (const field of slot.fields) {
|
|
131
|
+
expect(PLATFORM_BRANDING_FIELDS[field]).toBeDefined();
|
|
132
|
+
}
|
|
133
|
+
for (const layout of slot.layouts) {
|
|
134
|
+
expect(LOGIN_LAYOUTS[layout]).toBeDefined();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it("defines valid first-party cases", () => {
|
|
140
|
+
for (const entry of Object.values(AUTH_BRANDING_CASES)) {
|
|
141
|
+
expect(AUTH_BRANDING_PRESETS[entry.presetId]).toBeDefined();
|
|
142
|
+
for (const [key, value] of Object.entries(entry.branding)) {
|
|
143
|
+
expect(PLATFORM_BRANDING_FIELDS[key as keyof typeof PLATFORM_BRANDING_FIELDS]).toBeDefined();
|
|
144
|
+
if (key.endsWith("Url")) {
|
|
145
|
+
expect(typeof value).toBe("string");
|
|
146
|
+
expect(String(value)).toMatch(/^(https?:|\/)/);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it("defines valid structured style presets", () => {
|
|
153
|
+
expect(AUTH_BRANDING_PRESET_IDS.length).toBeGreaterThanOrEqual(6);
|
|
154
|
+
|
|
155
|
+
for (const preset of Object.values(AUTH_BRANDING_PRESETS)) {
|
|
156
|
+
expect(preset.id.length).toBeGreaterThan(0);
|
|
157
|
+
expect(preset.labelKey.length).toBeGreaterThan(0);
|
|
158
|
+
expect(preset.descriptionKey.length).toBeGreaterThan(0);
|
|
159
|
+
if (preset.branding.loginLayout !== undefined) {
|
|
160
|
+
expect(isLoginLayoutId(preset.branding.loginLayout)).toBe(true);
|
|
161
|
+
}
|
|
162
|
+
if (preset.branding.fontFamily !== undefined) {
|
|
163
|
+
expect(
|
|
164
|
+
(AUTH_FONT_FAMILIES as Record<string, unknown>)[
|
|
165
|
+
preset.branding.fontFamily
|
|
166
|
+
],
|
|
167
|
+
).toBeDefined();
|
|
168
|
+
}
|
|
169
|
+
if (preset.branding.radius !== undefined) {
|
|
170
|
+
expect(preset.branding.radius).toBeGreaterThanOrEqual(0);
|
|
171
|
+
expect(preset.branding.radius).toBeLessThanOrEqual(40);
|
|
172
|
+
}
|
|
173
|
+
for (const key of Object.keys(preset.branding)) {
|
|
174
|
+
expect(PLATFORM_BRANDING_FIELDS[key as keyof typeof PLATFORM_BRANDING_FIELDS]).toBeDefined();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
});
|
package/src/index.ts
CHANGED
|
@@ -116,6 +116,7 @@ export * from "./OpenProtocol";
|
|
|
116
116
|
export * from "./McpUiProtocol";
|
|
117
117
|
export * from "./ObservabilityDashboardProtocol";
|
|
118
118
|
export * from "./PlatformSettingsProtocol";
|
|
119
|
+
export * from "./PlatformBrandingFields";
|
|
119
120
|
export * from "./PlatformBrandingCss";
|
|
120
121
|
export * from "./AuthCssContract";
|
|
121
122
|
export * from "./PlatformAuditProtocol";
|