feat(ui): add docking, viewport controls and composed settings

Add shared dock layouts, navigation cube, range bands, progress actions and comparison surfaces. Extend toolbar menus and loading composition, and align tokens, registry entries, documentation and the living catalog.
This commit is contained in:
Codex
2026-10-29 09:38:25 +03:00
parent a6e6c8f2d9
commit cb534dbe39
51 changed files with 2273 additions and 336 deletions
+51 -36
View File
@@ -23,47 +23,33 @@ test("RangeControl keeps native drag semantics and exposes one persistent exact-
assert.doesNotMatch(markup, /nodedc-range__value-hit/);
});
test("vertical scale keeps endpoints outside and the label/value centered at every fill level", () => {
test("vertical scale exposes retained bounds without center text and follows every value", () => {
for (const [value, progress] of [[-1.2, 0], [25.15, 50], [51.5, 100]]) {
const markup = renderToStaticMarkup(createElement(RangeControl, {
label: "Срез", orientation: "vertical", value, min: -1.2, max: 51.5, step: "any",
formatValue: (n) => `${n.toFixed(1).replace('.', ',')} м`,
formatLimit: (n) => n.toFixed(1).replace('.', ','), onChange: () => {},
}));
const renderedProgress = Number(markup.match(/--nodedc-range-progress:([\d.]+)%/)?.[1]);
assert.ok(Math.abs(renderedProgress - progress) < 1e-9);
assert.match(markup, /aria-label="Срез" aria-orientation="vertical"/);
assert.match(markup, /min="-1.2" max="51.5" step="any"/);
assert.equal((markup.match(/nodedc-range-scale__limit--max">51,5<\/span>/g) ?? []).length, 1);
assert.equal((markup.match(/nodedc-range-scale__limit--min">-1,2<\/span>/g) ?? []).length, 1);
assert.match(markup, /<\/span><\/span><\/div><span class="nodedc-range-scale__limit/);
assert.equal((markup.match(/nodedc-range__label">Срез · /g) ?? []).length, 2);
assert.match(markup, /nodedc-range__fill-text" aria-hidden="true"/);
assert.doesNotMatch(markup, /nodedc-range__value|nodedc-range__editor|formatLimit=/);
for (const limitSide of ["left", "right"]) {
const markup = renderToStaticMarkup(createElement(RangeControl, {
label: "Срез", orientation: "vertical", limitSide, value, min: -1.2, max: 51.5, step: "any",
formatValue: n => `${n.toFixed(1)} м`, formatLimit: n => n.toFixed(1), onChange: () => {},
}));
const renderedProgress = Number(markup.match(/--nodedc-range-progress:([\d.]+)%/)?.[1]);
assert.ok(Math.abs(renderedProgress - progress) < 1e-9);
assert.ok(markup.includes(`data-limit-side="${limitSide}"`));
assert.ok(markup.includes(`nodedc-range-scale__limit--max">${value.toFixed(1)}</span>`));
assert.match(markup, /nodedc-range-scale__limit--min">-1.2<\/span>/);
assert.match(markup, /aria-label="Срез" aria-orientation="vertical"/);
assert.ok(markup.includes(`aria-valuetext="${value.toFixed(1)} м"`));
assert.match(markup, /min="-1.2" max="51.5" step="any"/);
assert.doesNotMatch(markup, /nodedc-range__label|nodedc-range__fill-text|nodedc-range__editor|formatLimit=/);
}
}
});
test("vertical scale mirrors only endpoint labels for the opposite scene edge", () => {
const markup = renderToStaticMarkup(createElement(RangeControl, {
label: "Срез", orientation: "vertical", limitSide: "left", value: 25.15, min: -1.2, max: 51.5,
step: "any", formatLimit: (n) => n.toFixed(1).replace('.', ','), onChange: () => {},
}));
assert.match(markup, /class="nodedc-range-scale" data-limit-side="left"/);
assert.match(markup, /nodedc-range-scale__limit--max">51,5<\/span>/);
assert.match(markup, /nodedc-range-scale__limit--min">-1,2<\/span>/);
});
test("vertical contrast clips both glyph layers and visible focus has no perimeter", async () => {
test("thin vertical rail retains a usable pointer target and boundary focus", async () => {
const styles = await readFile(new URL("../packages/ui-core/styles.css", import.meta.url), "utf8");
assert.match(styles, /\.nodedc-range\[data-orientation="vertical"\] \.nodedc-range__fill-text \{ clip-path: inset\(calc\(100% - var\(--nodedc-range-progress\)\) 0 0 round var\(--nodedc-radius-circle\)\)/);
assert.match(styles, /\.nodedc-range-scale \{[^}]*width: calc\(var\(--nodedc-control-height\) \* 0\.4\)/);
assert.match(styles, /\.nodedc-range-scale__limit \{[^}]*left: calc\(100% \+ 0\.4rem\);[^}]*color: var\(--nodedc-text-primary\);[^}]*font-size: calc\(var\(--nodedc-font-size-xs\) \* 0\.9\)/);
assert.match(styles, /\.nodedc-range-scale\[data-limit-side="left"\] \.nodedc-range-scale__limit \{[^}]*right: calc\(100% \+ 0\.4rem\);[^}]*left: auto;[^}]*text-align: right/);
assert.match(styles, /\.nodedc-range\[data-orientation="vertical"\] \.nodedc-range__label \{[^}]*font-size: calc\(var\(--nodedc-font-size-sm\) \* 0\.9\)/);
assert.match(styles, /\.nodedc-range\[data-orientation="vertical"\] \{[^}]*border: 0; outline: 0; box-shadow: none;/);
assert.match(styles, /\.nodedc-range\[data-orientation="vertical"\]:has\(input:focus-visible\) \.nodedc-range__label \{ text-decoration: underline; text-decoration-thickness: 2px;/);
assert.doesNotMatch(styles, /\.nodedc-range\[data-orientation="vertical"\]:has\(input:focus-visible\) \{/);
assert.doesNotMatch(styles, /\.nodedc-range\[data-orientation="vertical"\]:focus-within/);
assert.match(styles, /width: calc\(var\(--nodedc-control-height\) \* 0\.2\)/);
assert.match(styles, /width: max\(100%, 24px\)/);
assert.match(styles, /limit--max \{ bottom: clamp\(/);
assert.match(styles, /range-scale:has\(input:focus-visible\) \.nodedc-range-scale__limit--max \{ text-decoration: underline/);
assert.match(styles, /data-orientation="vertical"\] \{[^}]*border: 0; outline: 0; box-shadow: none;/);
});
test("exact editing is a stable native caret field without remount, forced selection or a dark editor box", async () => {
@@ -102,3 +88,32 @@ test("exact editing is a stable native caret field without remount, forced selec
assert.match(windowComponent, /onCloseRef\.current\(\)/);
assert.doesNotMatch(windowComponent, /\[closeOnEscape, onClose, open, shouldLockBodyScroll, shouldTrapFocus\]/);
});
test("vertical band exposes two independent accessible boundaries", () => {
for (const value of [[-52, 500], [10, 35], [20, 20]]) {
const markup = renderToStaticMarkup(createElement(RangeControl, {
label: "Срез", orientation: "vertical", value, min: -52, max: 500, step: "any",
formatValue: n => `${n} м`, onChange: () => {},
}));
assert.equal((markup.match(/type="range"/g) ?? []).length, 2);
assert.match(markup, /aria-label="Срез: нижняя граница"/);
assert.match(markup, /aria-label="Срез: верхняя граница"/);
assert.ok(markup.includes(`aria-valuemax="${value[1]}"`));
assert.ok(markup.includes(`aria-valuemin="${value[0]}"`));
assert.doesNotMatch(markup, /nodedc-range__label|nodedc-range__editor/);
}
});
test("both boundaries move, clamp independently, separate after coincidence and restore endpoints", async () => {
const {moveRangeBoundary: move, nearestRangeBoundary: nearest} = await import("../packages/ui-react/dist/rangeBand.js");
let band = [-52, 500];
assert.equal(nearest(band, -40), 0); assert.equal(nearest(band, 450), 1);
band = move(band, 0, 10, -52, 500, "any"); assert.deepEqual(band, [10, 500]);
band = move(band, 1, 30, -52, 500, "any"); assert.deepEqual(band, [10, 30]);
band = move(band, 0, 50, -52, 500, "any"); assert.deepEqual(band, [30, 30]);
assert.equal(nearest(band, 20), 0); assert.equal(nearest(band, 40), 1);
band = move(band, 0, -100, -52, 500, "any");
band = move(band, 1, 600, -52, 500, "any"); assert.deepEqual(band, [-52, 500]);
assert.deepEqual(move([0, 10], 1, 7.3, 0, 10, .5), [0, 7.5]);
assert.deepEqual(move([0, 9], 1, 10.1, 0, 10.1, 3), [0, 10.1]);
});