Completes the runtime-builder quartet (color, type, depth, shape). buildShape (pure) + ActiveEidos.applyShape/clearShape: dial `smoothing` (live continuity / squircle intensity) + `nestGap`, or override/add `families`, written as a managed block that wins over the foundation. Exported from $uix/eidos. Verified: check 0 errors; eidos config 56/56. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>active-uix
parent
7255a52a0a
commit
51571c869b
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Runtime shape retune — the shape analogue of `build-scheme.ts` (color),
|
||||
* `build-type-scale.ts` (typography) and `build-depth.ts` (depth). Pure + isomorphic, DOM-free.
|
||||
*
|
||||
* Given a seed it emits the shape overrides for a managed block: `--shape-smoothing` (live
|
||||
* continuity / squircle intensity) + `--shape-nest-gap` as `:root` variables, and any
|
||||
* `families` as `[data-shape='{family}']` rules that win over the foundation. The jaula-abierta
|
||||
* runtime of the shape channel — dial the corner continuity from a theme editor, no rebuild.
|
||||
*
|
||||
* `ActiveEidos.applyShape(seed)` writes the result as a managed block; the composition is here,
|
||||
* the DOM application lives on ActiveEidos, matching the other three builders.
|
||||
*/
|
||||
|
||||
export interface ShapeSeed {
|
||||
/** Superellipse exponent for the `continuous` family (1 = arc, 2 = squircle). */
|
||||
readonly smoothing?: string | number;
|
||||
/** Concentric nesting gap (`--shape-nest-gap`). */
|
||||
readonly nestGap?: string;
|
||||
/** `data-shape='{family}'` → `corner-shape` value — override or add families at runtime. */
|
||||
readonly families?: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface BuildShapeResult {
|
||||
/** `:root` variable declarations (`--shape-smoothing` / `--shape-nest-gap`). */
|
||||
readonly variables: readonly string[];
|
||||
/** Full `[data-shape='{family}'] { corner-shape: … }` rule strings. */
|
||||
readonly families: readonly string[];
|
||||
}
|
||||
|
||||
/** Build the shape override declarations + family rules from a runtime seed. */
|
||||
export function buildShape(seed: ShapeSeed): BuildShapeResult {
|
||||
const variables: string[] = [];
|
||||
if (seed.smoothing !== undefined) variables.push(`--shape-smoothing: ${seed.smoothing};`);
|
||||
if (seed.nestGap !== undefined) variables.push(`--shape-nest-gap: ${seed.nestGap};`);
|
||||
|
||||
const families: string[] = [];
|
||||
for (const [family, value] of Object.entries(seed.families ?? {})) {
|
||||
families.push(`[data-shape='${family}'] { corner-shape: ${value}; }`);
|
||||
}
|
||||
|
||||
return { variables, families };
|
||||
}
|
||||
Loading…
Reference in new issue