@vectoriox/iox-ui 5.56.1 → 5.57.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/fesm2022/vectoriox-iox-ui-generation-core.mjs +33 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +21 -7
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/generation-core/index.d.ts +38 -2
- package/harness-core/index.d.ts +18 -3
- package/package.json +1 -1
- package/src/generation-core/ai-run.ts +21 -0
- package/src/generation-core/audit-site.ts +32 -0
- package/src/harness-core/public-api.ts +1 -0
- package/src/harness-core/reference-colour.ts +15 -3
- package/src/harness-core/site-audit-view.ts +10 -0
- package/src/harness-core/starting-design.ts +8 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MOOD_IDS, MOOD_LABELS, STYLE_PRESETS, flavorPackById, parseFontFamilies, SPEC_AXES, parseHexColor, rgbToOklab, presetChoices, toHexColor, stylePresetById,
|
|
1
|
+
import { MOOD_IDS, MOOD_LABELS, STYLE_PRESETS, flavorPackById, parseFontFamilies, SPEC_AXES, parseHexColor, rgbToOklab, presetChoices, toHexColor, stylePresetById, resolveTokenValues, designTokenRows, wcagContrastRatio, auditDesignContrast } from '@vectoriox/iox-ui/design-core';
|
|
2
2
|
import { shapeKeys, requiredShapeKeys, PathIssueCollector, isPlainObject, pathAt, FACT_KEYS, jsonText, jsonOneOf, jsonListOf, jsonShapedObject, jsonClosedObject, describeShapeKey, SPEC_SITE_LIBRARY, patternById, SITE_FACT_LABELS, SITE_TEMPLATES, STUDIO_TEMPLATE, jsonInteger } from '@vectoriox/iox-ui/generation-core';
|
|
3
3
|
|
|
4
4
|
// GENERATED from iox-ai-guidance flavor-spec.v1.json — do not edit; re-run scripts/gen-flavor-spec.mjs
|
|
@@ -4518,6 +4518,15 @@ function readPalette(samples) {
|
|
|
4518
4518
|
return { palette, ground: paletteGround(palette), ...(brand ? { brand } : {}) };
|
|
4519
4519
|
}
|
|
4520
4520
|
|
|
4521
|
+
/** The raw colour's ratio against the preset's own page ground, in its first mode — shown, never decisive. */
|
|
4522
|
+
function rawRatioOf(presetId, hex) {
|
|
4523
|
+
const preset = stylePresetById(presetId);
|
|
4524
|
+
const choices = preset ? presetChoices(preset.id, preset.modes[0]) : null;
|
|
4525
|
+
if (!preset || !choices)
|
|
4526
|
+
return null;
|
|
4527
|
+
const ground = resolveTokenValues(designTokenRows(choices), preset.modes[0])['page-bg'];
|
|
4528
|
+
return ground && parseHexColor(ground) ? Math.round(wcagContrastRatio(hex, ground) * 100) / 100 : null;
|
|
4529
|
+
}
|
|
4521
4530
|
/** Every mode `presetId` offers passes the audit with `seed`. */
|
|
4522
4531
|
function seedPassesPreset(presetId, seed) {
|
|
4523
4532
|
const preset = stylePresetById(presetId);
|
|
@@ -4536,9 +4545,10 @@ function referenceSeed(read, presetId) {
|
|
|
4536
4545
|
return null;
|
|
4537
4546
|
const reference = read?.brand && parseHexColor(read.brand) ? read.brand : null;
|
|
4538
4547
|
if (!reference)
|
|
4539
|
-
return { seed: preset.seed, reference: null, used: false, failsIn: [] };
|
|
4548
|
+
return { seed: preset.seed, reference: null, used: false, failsIn: [], rawRatio: null };
|
|
4540
4549
|
const { passes, failsIn } = seedPassesPreset(preset.id, reference);
|
|
4541
|
-
|
|
4550
|
+
const rawRatio = rawRatioOf(preset.id, reference);
|
|
4551
|
+
return passes ? { seed: reference, reference, used: true, failsIn: [], rawRatio } : { seed: preset.seed, reference, used: false, failsIn, rawRatio };
|
|
4542
4552
|
}
|
|
4543
4553
|
|
|
4544
4554
|
/**
|
|
@@ -4795,14 +4805,19 @@ const GENERATION_LIMITS = {
|
|
|
4795
4805
|
* references — the best-ranked style with the reference colour as its seed when that colour passes AA in every mode
|
|
4796
4806
|
* the style offers (`referenceSeed`). Pure.
|
|
4797
4807
|
*/
|
|
4798
|
-
/**
|
|
4808
|
+
/**
|
|
4809
|
+
* A preset for this business: its choices, Motion from the business (`motionFor`), the references' colour as its seed
|
|
4810
|
+
* when that colour passes AA in every mode the preset offers (`referenceSeed` — judged as used), and what the owner
|
|
4811
|
+
* already set kept. The ONE rule for a Look pick and for Build with these.
|
|
4812
|
+
*/
|
|
4799
4813
|
function presetDesign(presetId, input, kept = {}, read = null) {
|
|
4800
4814
|
const base = presetChoices(presetId);
|
|
4801
4815
|
if (!base)
|
|
4802
4816
|
return null;
|
|
4803
4817
|
const motionInput = typeof input === 'object' && input !== null ? input : { businessType: input };
|
|
4804
4818
|
const start = motionFor(motionInput, presetId, read);
|
|
4805
|
-
|
|
4819
|
+
const seed = referenceSeed(read, presetId);
|
|
4820
|
+
return { ...base, ...(seed?.used ? { seed: seed.seed } : {}), scroll: start.scroll, animate: start.animate, between: start.between, ...kept };
|
|
4806
4821
|
}
|
|
4807
4822
|
/** The look a business starts from: its best-ranked style (with the references' boost), at its defaults. */
|
|
4808
4823
|
function startingDesign(input, read = null) {
|
|
@@ -4811,8 +4826,7 @@ function startingDesign(input, read = null) {
|
|
|
4811
4826
|
const design = top ? presetDesign(top.id, rankInput, {}, read) : null;
|
|
4812
4827
|
if (!top || !design)
|
|
4813
4828
|
return null;
|
|
4814
|
-
|
|
4815
|
-
return seed?.used ? { presetId: top.id, design: { ...design, seed: seed.seed }, referenceColour: true } : { presetId: top.id, design, referenceColour: false };
|
|
4829
|
+
return { presetId: top.id, design, referenceColour: !!referenceSeed(read, top.id)?.used };
|
|
4816
4830
|
}
|
|
4817
4831
|
|
|
4818
4832
|
/**
|