style(types): format P1.1-P1.5 changes with oxfmt (no logic change)

This commit is contained in:
Fini 2026-04-29 09:50:11 +08:00
parent 8ab607bc9d
commit cfabfe8a3d
3 changed files with 17 additions and 8 deletions

View file

@ -33,8 +33,8 @@ describe('getSemanticPalette', () => {
it('every light/dark color variable is type="color"', () => {
const p = getSemanticPalette();
// All color variables (light/dark or single) must have type "color"
const colorVars = Object.entries(p.variables).filter(([, def]) =>
(def as VariableDefinition).type === 'color'
const colorVars = Object.entries(p.variables).filter(
([, def]) => (def as VariableDefinition).type === 'color',
);
expect(colorVars.length).toBeGreaterThanOrEqual(28);
});
@ -97,7 +97,10 @@ describe('getSemanticPalette', () => {
const arr = d.value as ThemedValue[];
for (const v of arr) {
expect(typeof v.value).toBe('string');
expect((v.value as string).match(hexRe), `${name} ${JSON.stringify(v.theme)}`).toBeTruthy();
expect(
(v.value as string).match(hexRe),
`${name} ${JSON.stringify(v.theme)}`,
).toBeTruthy();
}
} else {
// single-value color
@ -337,8 +340,7 @@ describe('alert tokens (8 light/dark pairs)', () => {
it('color-warning-text: light=#92400E dark=#FDE68A', () => {
const p = getSemanticPalette();
const arr = (p.variables['color-warning-text'] as VariableDefinition)
.value as ThemedValue[];
const arr = (p.variables['color-warning-text'] as VariableDefinition).value as ThemedValue[];
expect(arr[0].value).toBe('#92400E');
expect(arr[1].value).toBe('#FDE68A');
});
@ -421,7 +423,9 @@ describe('palette count snapshot (color additions complete)', () => {
it('applySemanticPalette seeds all palette variables on an empty document', () => {
const doc: PenDocument = createEmptyDocument();
const out = applySemanticPalette(doc);
expect(Object.keys(out.variables ?? {}).length).toBe(Object.keys(getSemanticPalette().variables).length);
expect(Object.keys(out.variables ?? {}).length).toBe(
Object.keys(getSemanticPalette().variables).length,
);
});
});

View file

@ -225,7 +225,10 @@ const PALETTE: Record<string, PaletteEntry> = {
'type-body-line-height': { single: 1.5, description: 'Body text — line height multiplier' },
'type-caption-size': { single: 12, description: 'Caption / helper text — font size (px)' },
'type-caption-weight': { single: 400, description: 'Caption / helper text — font weight' },
'type-caption-line-height': { single: 1.4, description: 'Caption / helper text — line height multiplier' },
'type-caption-line-height': {
single: 1.4,
description: 'Caption / helper text — line height multiplier',
},
// ── Border radius (3 numeric) ─────────────────────────────────────────────
'radius-sm': { single: 4, description: 'Border radius small — 4 px (chip, badge, input)' },

View file

@ -95,7 +95,9 @@ function main() {
}
if (coverRate < 0.95) {
console.error(`\n❌ HARD GATE FAILED: semantic cover rate ${(coverRate * 100).toFixed(1)}% < 95%`);
console.error(
`\n❌ HARD GATE FAILED: semantic cover rate ${(coverRate * 100).toFixed(1)}% < 95%`,
);
console.error('Per spec §7.4, must pause and revisit D2 namespace boundary before P2.');
process.exit(1);
}