30 changed files with 616 additions and 132 deletions
+3 -3
View File
@@ -11,9 +11,9 @@
},
"dependencies": {
"@nodedc/page-patterns": "0.1.0",
"@nodedc/ui-core": "0.7.0",
"@nodedc/ui-react": "0.7.0",
"cesium": "^1.143.0",
"@nodedc/ui-core": "0.7.1",
"@nodedc/ui-react": "0.7.1",
"cesium": "1.147.0",
"react": "^19.1.0",
"react-dom": "^19.1.0"
},
+5 -1
View File
@@ -1480,8 +1480,10 @@ export function CatalogApp() {
<KeyButton label="Клавиша S недоступна" disabled>S</KeyButton>
</div>
</Preview>
<Preview title="Подсказки" note="hover / focus / touch" className="catalog-preview--compact">
<Preview title="Подсказки" note="Скруглённое стекло без обводки · hover / focus / touch" className="catalog-preview--compact">
<div className="catalog-inline catalog-inline--wrap">
<IconButton label="Инспектор"><Icon name="network" /></IconButton>
<Button title="Общая подсказка для существующего title">Подсказка приложения</Button>
<Tooltip content="Короткое пояснение. Escape закрывает только подсказку."><Button>Подробнее</Button></Tooltip>
<Tooltip focusable label="Текущий уровень" content="Доступно мышью, клавиатурой и касанием."><StatusBadge tone="neutral">Нормальный уровень</StatusBadge></Tooltip>
<Tooltip disabled content="Эта подсказка отключена"><Button disabled>Недоступно</Button></Tooltip>
@@ -2222,6 +2224,8 @@ export function CatalogApp() {
eyebrow="NODE.DC"
title={studioContext === "applications" ? "Applications" : studioContext === "pages" ? "Page Library" : "Visual Library"}
closeLabel="Закрыть Module Foundry"
collapseLabel="Свернуть панель навигации"
expandLabel="Развернуть панель навигации"
navigationLabel={studioContext === "applications" ? "Application Drafts" : studioContext === "pages" ? "Page Templates" : "Разделы Visual Library"}
onClose={closeGuideline}
headerActions={studioContext === "applications" ? (
+2 -1
View File
@@ -2,11 +2,12 @@ import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "@nodedc/ui-core/styles.css";
import "./styles.css";
import { TooltipProvider } from "@nodedc/ui-react";
import { CatalogApp } from "./CatalogApp";
createRoot(document.getElementById("root")!).render(
<StrictMode>
<CatalogApp />
<TooltipProvider><CatalogApp /></TooltipProvider>
</StrictMode>,
);
+4
View File
@@ -160,3 +160,7 @@ immutable archive `nodedc-ui-dom-0.7.0-modal.2.tgz`. Адаптер переда
Сетка файлов, поиск и фильтрация по нескольким типам остаются доменной логикой
CMS; переключатели используют общий IconButton. Проверены выбор глубокого
пути, переход в каталог, dark/light и узкое окно 390 px.
## Общие подсказки · 2026-11-16
Mission Core подключает `TooltipProvider` из ui-react 0.7.1 один раз над приложением. BIM Mod 0.2.45 подключает его в переносимом workspace и переиспользует provider хоста. Существующие HTML `title` обрабатываются через общий портал, SVG-подсказки — через `data-nodedc-tooltip` с доступным именем `aria-label`. Богатый контент использует `Tooltip`. Вложенные приложения не создают второй слой подсказок. Общий материал: скруглённое стекло без border, outline и декоративного rim; keyboard focus самих контролов сохраняется.
+21
View File
@@ -320,6 +320,25 @@ setup-команды, сохранение, API и права принадлеж
`AdminNavigationPanel` поддерживает сортируемые route-items через общий Drag & Drop contract. Приложение передаёт новый порядок id, а панель использует каноническую шеститочечную ручку Engine. Порядок не хранится отдельно внутри navigation-компонента.
### Сворачивание левой навигации — общий стандарт
Все левые `AdminNavigationPanel` имеют круглую стрелку рядом с крестиком.
В компактном состоянии остаются круги с иконками и стрелка вправо: заголовок,
подписи, крестик и вторичные действия скрыты, в том числе от клавиатурного фокуса.
Иконки сохраняют доступные имена, выбранный маршрут и Tooltip при наведении/фокусе.
Раскрытие возвращает контекстные селекторы, сортировку и дополнительные действия.
`ApplicationShell` синхронно сжимает колонку до `4.55rem` и расширяет рабочую область
на канонической кривой анимации оболочки; содержимое workspace не перемонтируется.
Состояние общее для переходов между разделами и открытия/закрытия рабочих поверхностей.
Для управляемого состояния: `navigationCollapsed`, `onNavigationCollapsedChange`;
начальное — `defaultNavigationCollapsed`. Без shell панель поддерживает `collapsed`,
`defaultCollapsed`, `onCollapsedChange`. Приоритет внутри shell принадлежит shell.
Библиотека не пишет в localStorage: долговременная персонализация принадлежит приложению.
`collapseLabel`/`expandLabel` локализуют подписи. Footer с каноническим
`nodedc-admin-panel__nav-icon` сохраняет только этот круг. Right/end panel не сужается.
Reduced motion отключает анимацию. На узком экране сохраняется один активный экран.
## ApplicationSidePanel
`ApplicationSidePanel` — правая application-level пара к `AdminNavigationPanel`.
@@ -549,6 +568,8 @@ Window header actions default to before the move toggle. `headerActionsPlacement
## Tooltip
Общий стандарт: скруглённое стекло Scene Glass без декоративной рамки, outline и обводки. `TooltipProvider` подключается один раз на корне приложения и заменяет браузерные квадратные подсказки `title`, в том числе в старых экранах. Вложенный переносимый модуль использует уже установленный provider. Rich-content `Tooltip` сохраняет собственный триггер; две подсказки одновременно не появляются. `aria-describedby`, клавиатурный фокус, Escape, fullscreen и положение у границ окна сохраняются.
Нейтральная подсказка с `content`, `children`, необязательными `label`, `focusable`, `disabled` и `placement`. Оборачивает триггер; `focusable` делает читаемую графику доступной клавиатуре, обычная кнопка сохраняет собственный фокус. Hover, focus и touch показывают один общий portal над окном; Escape закрывает подсказку, не родительское окно. Можно перевести курсор в подсказку. Позиция пересчитывается при scroll/resize, с общим clamp/flip. Не содержит действий: для меню используется Dropdown. Нет рамки, акцентных цветов или анимации при reduced motion.
Принят для запрошенных владельцем пояснений шкал сигнала,10.11.2026; приложение владеет диапазонами и текстом, общий компонент — формой и взаимодействием.
+3 -3
View File
@@ -1,7 +1,7 @@
# Shared Cesium React adapter
`@nodedc/map-cesium-react 0.1.0` is the shared renderer boundary for the
canonical `Map Page 0.1.0` and CesiumJS `1.143.0`.
`@nodedc/map-cesium-react 0.1.2` is the shared renderer boundary for the
canonical `Map Page 0.1.0` and CesiumJS `1.147.0`.
It is not a Foundry application component and does not own product navigation,
Inspector fields, tokens, provider allowlists, TileCache storage or admin
@@ -25,7 +25,7 @@ must not be used as a substitute for the `DC Default` treatment.
- The browser receives only same-origin BFF paths.
- Runtime config must use `missioncore.map-runtime/v1`, Map Page `0.1.0` and
Cesium `1.143.0`.
Cesium `1.147.0`.
- Canonical assets are fixed to imagery `2`, terrain `1` and buildings
`96188`.
- Provider endpoint documents must declare `credentialMode=gateway`.
+19 -2
View File
@@ -231,9 +231,9 @@ Page/Visual/Application previews не содержат shipped domain fixtures.
Во внутренней sandbox-сборке Map Page временно скрывает визуальный credit overlay renderer, потому что он перекрывает рабочую композицию во время настройки шаблона. Метаданные provider attribution не удаляются из runtime. Перед любым внешним, пользовательским или коммерческим развёртыванием overlay должен быть возвращён в соответствии с условиями выбранного provider. Это зафиксированный технический долг, а не правило production-интерфейса.
## Cesium adapter 1.143
## Cesium adapter 1.147
Текущий reference adapter использует CesiumJS `1.143.0`. Он загружается отдельным lazy chunk только при открытии Map Page и преобразует только declared Application bindings в реальные Cesium entities. Пустая Map Page не содержит domain entities.
Текущий reference adapter использует CesiumJS `1.147.0`. Он загружается отдельным lazy chunk только при открытии Map Page и преобразует только declared Application bindings в реальные Cesium entities. Пустая Map Page не содержит domain entities.
Server-side runtime contract:
@@ -319,3 +319,20 @@ Data Plane, а не Map Template.
факте для quality/diagnostics, но не образуют дополнительные UI-фильтры. Цвет,
геометрия таргета, label и порядок фильтров остаются в Foundry presentation
profile.
## Domain geometry in the existing renderer
`@nodedc/map-cesium-react` 0.1.1 adds optional `onSceneReady(context)`;
Version 0.1.2 pins CesiumJS to **1.147.0**, retaining this callback contract. Existing consumers need no changes.
`context` contains the existing `Cesium` namespace, renderer-owned `viewer`,
and an abort `signal`. A consumer can attach ready domain geometry, pick
objects and move the camera, returning synchronous cleanup for its own
entities, primitives and listeners. Cleanup runs after abort and before
viewer destruction, including provider toggles and renderer recovery.
Asynchronous work must check the signal before attaching anything.
The callback must not create another Viewer, replace providers, introduce
upstream credentials, or bypass the same-origin runtime/Map Gateway. Prepared
BIM mesh residency, product leases, geometry budgets and project placement
belong to the portable BIM consumer. The shared adapter retains sole ownership
of imagery, terrain, buildings, network/cache intent and render recovery.
+90 -58
View File
@@ -1,12 +1,12 @@
{
"name": "nodedc-design-guideline",
"version": "0.7.0",
"version": "0.7.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "nodedc-design-guideline",
"version": "0.7.0",
"version": "0.7.1",
"workspaces": [
"packages/*",
"apps/*"
@@ -28,9 +28,9 @@
"version": "0.7.0",
"dependencies": {
"@nodedc/page-patterns": "0.1.0",
"@nodedc/ui-core": "0.7.0",
"@nodedc/ui-react": "0.7.0",
"cesium": "^1.143.0",
"@nodedc/ui-core": "0.7.1",
"@nodedc/ui-react": "0.7.1",
"cesium": "1.147.0",
"react": "^19.1.0",
"react-dom": "^19.1.0"
},
@@ -325,36 +325,63 @@
"node": ">=6.9.0"
}
},
"node_modules/@cesium/engine": {
"version": "26.1.0",
"resolved": "https://registry.npmjs.org/@cesium/engine/-/engine-26.1.0.tgz",
"integrity": "sha512-WzeJEcmGD7/htBJ8JEZt95OgZjErPwUHqyAlJY/mCzmDm7hfwpuucLBSUhiynWW3khqBT1C7dhibjb7tdic7oA==",
"node_modules/@cesium/core": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@cesium/core/-/core-0.1.1.tgz",
"integrity": "sha512-2twC6bAYWdrJ4YVS2UPCpgkE7EZWHl+GVuh5n9IT6gVL9W9OYPas29Vh+wrUVI/9Hs8TeiNtis+Du2U9b+ce6A==",
"license": "Apache-2.0",
"dependencies": {
"earcut": "3.0.2",
"mersenne-twister": "^1.1.0",
"urijs": "^1.19.7"
},
"engines": {
"node": ">=22.17.0"
}
},
"node_modules/@cesium/engine": {
"version": "26.5.0",
"resolved": "https://registry.npmjs.org/@cesium/engine/-/engine-26.5.0.tgz",
"integrity": "sha512-vpMuIOQ7QXNVrVTCCPWQ9y0zyfR+lhKLUOWt8XRCrDibtsASVpXGRFKQEdONf2D2EznIAQZ09sGOC8LwhvOeIQ==",
"license": "Apache-2.0",
"dependencies": {
"@cesium/core": "^0.1.1",
"@cesium/gltf": "^0.1.1",
"@cesium/wasm-splats": "^0.1.0-alpha.2",
"@spz-loader/core": "0.3.1",
"@tweenjs/tween.js": "^25.0.0",
"@zip.js/zip.js": "^2.8.1",
"@zip.js/zip.js": "^2.9.0",
"autolinker": "^4.0.0",
"bitmap-sdf": "^1.0.3",
"dompurify": "^3.3.0",
"draco3d": "^1.5.1",
"earcut": "3.0.2",
"dompurify": "^3.4.14",
"draco3d": "1.5.7",
"grapheme-splitter": "^1.0.4",
"jsep": "^1.3.8",
"kdbush": "^4.0.1",
"ktx-parse": "^1.0.0",
"kdbush": "^4.1.0",
"ktx-parse": "^2.0.0",
"lerc": "^2.0.0",
"mersenne-twister": "^1.1.0",
"meshoptimizer": "^1.0.1",
"meshoptimizer": "^1.2.0",
"pako": "^3.0.0",
"protobufjs": "^8.6.5",
"protobufjs": "^8.8.0",
"rbush": "^4.0.1",
"topojson-client": "^3.1.0",
"urijs": "^1.19.7"
},
"engines": {
"node": ">=22.0.0"
"node": ">=22.17.0"
}
},
"node_modules/@cesium/gltf": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@cesium/gltf/-/gltf-0.1.1.tgz",
"integrity": "sha512-tACM+dBXm+hXU4iyMynEK11ymce6GqUaB8TjF7jbtqBfxVYh45C2zBjNnv3ElpwhlwjLjwbc25zKZrO8oGYegw==",
"license": "Apache-2.0",
"dependencies": {
"@cesium/core": "^0.1.1"
},
"engines": {
"node": ">=22.17.0"
}
},
"node_modules/@cesium/wasm-splats": {
@@ -364,16 +391,17 @@
"license": "Apache-2.0"
},
"node_modules/@cesium/widgets": {
"version": "16.1.0",
"resolved": "https://registry.npmjs.org/@cesium/widgets/-/widgets-16.1.0.tgz",
"integrity": "sha512-c+jt8F3YIZs2x6+X+HS4q0S9nd2jVcbPVShUmlrDK1s+C7IlEvXceDGrkjivHRElAVCzfaWEEwY1g7Lg5HCGmA==",
"version": "16.3.1",
"resolved": "https://registry.npmjs.org/@cesium/widgets/-/widgets-16.3.1.tgz",
"integrity": "sha512-eyAGPYYL4v/WeLasmphRwxFcCl/qeTcRhncbBlOzMTSTLjgjZSea0IcEDCKC2ip/mHPeGe887X84xi1SV8mcEQ==",
"license": "Apache-2.0",
"dependencies": {
"@cesium/engine": "^26.1.0",
"@cesium/core": "^0.1.1",
"@cesium/engine": "^26.5.0",
"nosleep.js": "^0.12.0"
},
"engines": {
"node": ">=22.0.0"
"node": ">=22.17.0"
}
},
"node_modules/@dnd-kit/accessibility": {
@@ -1433,9 +1461,9 @@
}
},
"node_modules/@zip.js/zip.js": {
"version": "2.8.26",
"resolved": "https://registry.npmjs.org/@zip.js/zip.js/-/zip.js-2.8.26.tgz",
"integrity": "sha512-RQ4h9F6DOiHxpdocUDrOl6xBM+yOtz+LkUol47AVWcfebGBDpZ7w7Xvz9PS24JgXvLGiXXzSAfdCdVy1tPlaFA==",
"version": "2.25.0",
"resolved": "https://registry.npmjs.org/@zip.js/zip.js/-/zip.js-2.25.0.tgz",
"integrity": "sha512-oNRqUuU1XFu6G5d7Z0jufJ9dS9WteO0xiU/PNxsUrb4itZCsSbn191jpJzU00Gmc6S680X3DPZeF5EV4zAEMAg==",
"license": "BSD-3-Clause",
"engines": {
"bun": ">=0.7.0",
@@ -1583,22 +1611,26 @@
"license": "CC-BY-4.0"
},
"node_modules/cesium": {
"version": "1.143.0",
"resolved": "https://registry.npmjs.org/cesium/-/cesium-1.143.0.tgz",
"integrity": "sha512-EHz61NBp/2UPYE4iWCZ+YK9Jcb0d2hzRfqkj4DRaUM3cJmA9hE2FTmcPPZ2iL7w+W0YUScI0gc9XeSTXlPIQtA==",
"version": "1.147.0",
"resolved": "https://registry.npmjs.org/cesium/-/cesium-1.147.0.tgz",
"integrity": "sha512-gY5TF0rSyIMtnSIFHUuiHnrCuhdKaHUzLWFcjxytsdheKfKtYYOWicIWMypGjwYfnmJrgPgNF7HNjO9SK/JIkw==",
"license": "Apache-2.0",
"workspaces": [
"packages/core",
"packages/gltf",
"packages/engine",
"packages/widgets",
"packages/sandcastle"
],
"dependencies": {
"@cesium/engine": "^26.1.0",
"@cesium/widgets": "^16.1.0",
"protobufjs": "^8.6.5"
"@cesium/core": "^0.1.1",
"@cesium/engine": "^26.5.0",
"@cesium/gltf": "^0.1.1",
"@cesium/widgets": "^16.3.1",
"protobufjs": "^8.8.0"
},
"engines": {
"node": ">=22.0.0"
"node": ">=22.17.0"
}
},
"node_modules/chokidar": {
@@ -1665,9 +1697,9 @@
}
},
"node_modules/dompurify": {
"version": "3.4.12",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.12.tgz",
"integrity": "sha512-zQvGet8Z2sWbQhCmfFz/T5QWH2oBmjnqK3qvOjaqaNLrLEF912WamU+ohnTp0TCep/MFVHpdJuCZEdFOdTnEFg==",
"version": "3.4.18",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.18.tgz",
"integrity": "sha512-ofe3wI/uNm68HInABYFJYqQxRw1EaKAjNdrFVKqjUY+UZurvNd2L/HuQe097s/4RivWiZyP6tT7aoT8atjfhwg==",
"license": "(MPL-2.0 OR Apache-2.0)",
"optionalDependencies": {
"@types/trusted-types": "^2.0.7"
@@ -1873,12 +1905,12 @@
"license": "MIT"
},
"node_modules/jsep": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/jsep/-/jsep-1.4.0.tgz",
"integrity": "sha512-B7qPcEVE3NVkmSJbaYxvv4cHkVW7DQsZz13pUMrfS8z8Q/BuShN+gcTXrUlPiGqM2/t/EEaI030bpxMqY8gMlw==",
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/jsep/-/jsep-1.6.0.tgz",
"integrity": "sha512-Y8Tr54CX7B5YGAwo7/n8eumidEX3Opx98RyyQVnlHqUaZcPA8uUzL2v1rshr9ypW9Q6hNjfJtg3sL+8kaNE7TA==",
"license": "MIT",
"engines": {
"node": ">= 10.16.0"
"node": ">= 20.16.0"
}
},
"node_modules/jsesc": {
@@ -1914,9 +1946,9 @@
"license": "ISC"
},
"node_modules/ktx-parse": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/ktx-parse/-/ktx-parse-1.1.0.tgz",
"integrity": "sha512-mKp3y+FaYgR7mXWAbyyzpa/r1zDWeaunH+INJO4fou3hb45XuNSwar+7llrRyvpMWafxSIi99RNFJ05MHedaJQ==",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ktx-parse/-/ktx-parse-2.0.0.tgz",
"integrity": "sha512-PW38i6SBZagE7c4yCYru636ICCkhJ8FNjOzAdjGkC65BZ0gElQJvFenSGc62SHFj5Fg0ft+U38PPhMZsWYQLCg==",
"license": "MIT"
},
"node_modules/lerc": {
@@ -1957,9 +1989,9 @@
"license": "MIT"
},
"node_modules/meshoptimizer": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/meshoptimizer/-/meshoptimizer-1.2.0.tgz",
"integrity": "sha512-davRZeIJbxJrE24cwQle7ZDsxjdk/OphNOV83oX+efQinyoHY9Jcyz3MHbaoG0qySZajldGztNZ1RN/T19PZsg==",
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/meshoptimizer/-/meshoptimizer-1.3.0.tgz",
"integrity": "sha512-2oZqMAcEEiCtXWUjIGtZ71oPx1B0ZxYGTqIKsXB1wzWFhleNsCFxQuUJzgCV706bRcwPWtMGf1odmQvAcqKkIw==",
"license": "MIT"
},
"node_modules/ms": {
@@ -2028,9 +2060,9 @@
}
},
"node_modules/pako": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/pako/-/pako-3.0.1.tgz",
"integrity": "sha512-GupotUUI0mlhugKjUs4bjOwLt3nrehy9Ys2dxC0GtgVef5cnKggkDMmf2bq2poCCuVXopWPmqsc9VDT2iJUy+w==",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/pako/-/pako-3.0.3.tgz",
"integrity": "sha512-tmrebBBYI5FOw8QICGwJNqE8fotC8R+gwcxOvoFNv+GKehOI6Lc6YBolNcQNnC4v96l1wt7rh102ifD4kVeZAQ==",
"funding": [
{
"type": "github",
@@ -2093,9 +2125,9 @@
}
},
"node_modules/protobufjs": {
"version": "8.7.0",
"resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-8.7.0.tgz",
"integrity": "sha512-uu52JNxLh3vsL7tXU/h0gDaywufvuUCTbGSi0NKQKBZ2ZopkmrWQJSQO/EFqzu/5YhiwgVM8rq/a/iVpx4eZ0g==",
"version": "8.8.1",
"resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-8.8.1.tgz",
"integrity": "sha512-d9e9179bjXSJdpJ3+R9fP8hzXsnKLyxTjHLG1dUzje8a27pPyXCe6PrcRtgx2rjoM3IZzHd2vAs+6J/BsO1k7Q==",
"license": "BSD-3-Clause",
"dependencies": {
"long": "^5.3.2"
@@ -2462,9 +2494,9 @@
},
"packages/map-cesium-react": {
"name": "@nodedc/map-cesium-react",
"version": "0.1.0",
"version": "0.1.2",
"dependencies": {
"cesium": "1.143.0"
"cesium": "1.147.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
@@ -2484,7 +2516,7 @@
},
"packages/ui-core": {
"name": "@nodedc/ui-core",
"version": "0.7.0",
"version": "0.7.1",
"dependencies": {
"@nodedc/tokens": "0.6.0"
}
@@ -2493,17 +2525,17 @@
"name": "@nodedc/ui-dom",
"version": "0.7.0",
"dependencies": {
"@nodedc/ui-core": "0.7.0"
"@nodedc/ui-core": "0.7.1"
}
},
"packages/ui-react": {
"name": "@nodedc/ui-react",
"version": "0.7.0",
"version": "0.7.1",
"dependencies": {
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@nodedc/ui-core": "0.7.0",
"@nodedc/ui-core": "0.7.1",
"lucide-react": "^0.468.0"
},
"devDependencies": {
+4 -3
View File
@@ -1,6 +1,6 @@
{
"name": "nodedc-design-guideline",
"version": "0.7.0",
"version": "0.7.1",
"private": true,
"description": "Canonical NODE.DC design system, reusable UI packages and living component catalog.",
"type": "module",
@@ -11,7 +11,7 @@
"scripts": {
"build": "npm run build --workspace @nodedc/ui-core && npm run build --workspace @nodedc/ui-dom && npm run build --workspace @nodedc/ui-react && npm run build --workspace @nodedc/page-patterns && npm run build --workspace @nodedc/map-cesium-react && npm run build --workspace @nodedc/ui-catalog",
"build:packages": "npm run build --workspace @nodedc/ui-core && npm run build --workspace @nodedc/ui-dom && npm run build --workspace @nodedc/ui-react && npm run build --workspace @nodedc/page-patterns && npm run build --workspace @nodedc/map-cesium-react",
"check": "npm run test:typography && npm run build:packages && npm run typecheck --workspaces --if-present && npm run validate:registry && npm run test:spark-governance && npm run test:analysis-controls && npm run test:activity-indicator && npm run test:control-density && npm run test:icon-contract && npm run test:toast-contract && npm run test:floating-position && npm run test:inspector-select && npm run test:range-control && npm run test:split-pane && npm run test:dock-layout && npm run test:hgeozone-projection && npm run test:map-grid-lod && npm run test:map-filters && npm run test:map-object-layers && npm run test:map-inspector-overlay-state && npm run test:map-reference-stations && npm run test:map-search && npm run test:map-subject-card && npm run test:map-subject-detail-profile && npm run test:environment-settings && npm run test:settings-surfaces && npm run test:window-geometry && npm run test:editor-dock && npm run test:flat-theme && npm run test:mission-theme && npm run test:modal-size",
"check": "npm run test:typography && npm run build:packages && npm run typecheck --workspaces --if-present && npm run validate:registry && npm run test:spark-governance && npm run test:analysis-controls && npm run test:activity-indicator && npm run test:control-density && npm run test:icon-contract && npm run test:toast-contract && npm run test:floating-position && npm run test:tooltip && npm run test:inspector-select && npm run test:range-control && npm run test:split-pane && npm run test:dock-layout && npm run test:hgeozone-projection && npm run test:map-grid-lod && npm run test:map-filters && npm run test:map-object-layers && npm run test:map-inspector-overlay-state && npm run test:map-reference-stations && npm run test:map-search && npm run test:map-subject-card && npm run test:map-subject-detail-profile && npm run test:environment-settings && npm run test:settings-surfaces && npm run test:window-geometry && npm run test:editor-dock && npm run test:flat-theme && npm run test:mission-theme && npm run test:modal-size",
"dev": "npm run build:packages && npm run dev --workspace @nodedc/ui-catalog",
"serve": "node server/catalog-server.mjs",
"validate:registry": "node scripts/validate-registry.mjs",
@@ -50,7 +50,8 @@
"prebuild": "npm run test:typography",
"test:flat-theme": "node --test scripts/flat-theme.test.mjs",
"test:mission-theme": "node --test scripts/mission-theme.test.mjs",
"test:modal-size": "node --test scripts/modal-size.test.mjs"
"test:modal-size": "node --test scripts/modal-size.test.mjs",
"test:tooltip": "node --test scripts/tooltip-titles.test.mjs"
},
"engines": {
"node": ">=20"
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@nodedc/map-cesium-react",
"version": "0.1.0",
"version": "0.1.2",
"description": "Shared credential-free Cesium adapter for NODE.DC Map Page consumers.",
"type": "module",
"main": "./dist/index.js",
@@ -21,7 +21,7 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
"cesium": "1.143.0"
"cesium": "1.147.0"
},
"peerDependencies": {
"react": ">=18"
@@ -60,10 +60,13 @@ export const CesiumMapRenderer = forwardRef<
className,
onRuntimeStateChange,
onCameraChange,
onSceneReady,
}, forwardedRef) {
const containerRef = useRef<HTMLDivElement | null>(null);
const stateCallbackRef = useRef(onRuntimeStateChange);
const cameraCallbackRef = useRef(onCameraChange);
const sceneCallbackRef = useRef(onSceneReady);
sceneCallbackRef.current = onSceneReady;
const runtimeRef = useRef<RendererRuntime | null>(null);
const settingsRef = useRef(settings);
const layersRef = useRef(layers);
@@ -116,6 +119,7 @@ export const CesiumMapRenderer = forwardRef<
const abortController = new AbortController();
let disposed = false;
let viewer: CesiumModule.Viewer | null = null;
let disposeConsumer: (() => void) | void;
let removeCameraListener: (() => void) | undefined;
let removeRenderListener: (() => void) | undefined;
let runtimeState = initialMapRuntimeState();
@@ -191,6 +195,8 @@ export const CesiumMapRenderer = forwardRef<
);
removeRenderListener = bindRenderRecovery(viewer, publish);
disposeConsumer = sceneCallbackRef.current?.({Cesium, viewer, signal: abortController.signal});
const providerJobs = (["imagery", "terrain", "buildings"] as const).map(
async (providerId) => {
const visible = layers[providerId];
@@ -265,6 +271,7 @@ export const CesiumMapRenderer = forwardRef<
return () => {
disposed = true;
abortController.abort();
try { disposeConsumer?.(); } finally {
removeCameraListener?.();
removeRenderListener?.();
runtimeRef.current?.stopGhostPinAnimation?.();
@@ -272,6 +279,7 @@ export const CesiumMapRenderer = forwardRef<
viewer?.destroy();
viewer = null;
container.replaceChildren();
}
};
}, [
runtimeConfigUrl,
+11 -1
View File
@@ -1,6 +1,7 @@
import type * as Cesium from "cesium";
export const MAP_RUNTIME_SCHEMA_VERSION = "missioncore.map-runtime/v1" as const;
export const MAP_PAGE_VERSION = "0.1.0" as const;
export const CESIUM_RENDERER_VERSION = "1.143.0" as const;
export const CESIUM_RENDERER_VERSION = "1.147.0" as const;
export type MapProviderId = "imagery" | "terrain" | "buildings";
export type MapProviderPhase = "idle" | "loading" | "ready" | "disabled" | "error";
@@ -159,7 +160,16 @@ export type MapCacheIntent = {
no_overwrite: boolean;
};
/** A consumer may attach domain objects to this renderer-owned scene. It must
* remove its objects/listeners in the returned synchronous cleanup. Pending
* work must observe signal; it may never destroy the viewer or change providers. */
export type MapSceneContext = {
Cesium: typeof Cesium;
viewer: Cesium.Viewer;
signal: AbortSignal;
};
export type CesiumMapRendererProps = {
onSceneReady?: (context: MapSceneContext) => (() => void) | void;
runtimeConfigUrl: string;
camera: MapCamera | null;
layers: MapLayerVisibility;
+1
View File
@@ -7,6 +7,7 @@ export {
export type {
CesiumMapRendererHandle,
CesiumMapRendererProps,
MapSceneContext,
MapCacheIntent,
MapCamera,
MapGeoPoint,
@@ -0,0 +1,80 @@
import assert from "node:assert/strict";
import test from "node:test";
import { DefaultProxy, Resource, VERSION } from "cesium";
import { CESIUM_RENDERER_VERSION } from "../dist/contracts.js";
import { applyCacheIntent, fetchMapRuntimeConfiguration } from "../dist/runtime.js";
test("installed Cesium and the runtime contract agree", () => {
assert.equal(VERSION, CESIUM_RENDERER_VERSION);
});
test("Cesium derived terrain and building resources retain the existing cache route", () => {
for (const [root, child] of [
["https://assets.ion.cesium.com/1/", "12/124/113.terrain?v=1"],
["https://assets.ion.cesium.com/96188/tileset.json", "12/124/113.b3dm"],
]) {
const resource = new Resource({
url: applyCacheIntent(root, { enabled: true, no_overwrite: true }, false),
proxy: new DefaultProxy("/api/v1/map/gateway/cache?url="),
});
const derived = resource.getDerivedResource({ url: child });
const proxied = new URL(derived.getUrlComponent(true, true), "http://127.0.0.1:8000");
assert.equal(proxied.pathname, "/api/v1/map/gateway/cache");
const upstream = new URL(proxied.searchParams.get("url"));
assert.equal(upstream.searchParams.get("nodedc_cache_profile"), "live");
assert.equal(upstream.searchParams.has("nodedc_cache_refresh"), false);
assert.equal(upstream.searchParams.has("access_token"), false);
assert.equal(upstream.pathname, new URL(child, root).pathname);
}
});
test("a mismatched renderer cannot silently start against another runtime release", async (t) => {
const originalWindow = globalThis.window;
globalThis.window = { location: { origin: "http://127.0.0.1:8000" } };
t.after(() => {
if (originalWindow === undefined) delete globalThis.window;
else globalThis.window = originalWindow;
});
const configuration = {
schema_version: "missioncore.map-runtime/v1",
map_page_version: "0.1.0",
renderer: { id: "cesium", version: CESIUM_RENDERER_VERSION },
gateway: {
configured: true,
health_url: "/api/v1/map/gateway/health",
asset_endpoint_template: "/api/v1/map/gateway/ion/assets/{asset_id}/endpoint",
cache_proxy_prefix: "/api/v1/map/gateway/cache?url=",
},
assets: { imagery: 2, terrain: 1, buildings: 96188 },
};
t.mock.method(globalThis, "fetch", async () => Response.json(configuration));
assert.equal((await fetchMapRuntimeConfiguration("/api/v1/map/runtime-config", new AbortController().signal)).renderer.version, CESIUM_RENDERER_VERSION);
configuration.renderer.version = "1.143.0";
await assert.rejects(fetchMapRuntimeConfiguration("/api/v1/map/runtime-config", new AbortController().signal), { code: "map_runtime_contract_mismatch" });
});
test("project focus keeps its range and survives the persisted camera round trip", async () => {
const C = await import("cesium");
const scene = {
drawingBufferWidth: 840, drawingBufferHeight: 461,
mapProjection: new C.GeographicProjection(), ellipsoid: C.Ellipsoid.WGS84,
mode: C.SceneMode.SCENE3D,
screenSpaceCameraController: { minimumZoomDistance: 1, maximumZoomDistance: Infinity },
};
const camera = new C.Camera(scene);
scene.camera = camera;
camera.update(C.SceneMode.SCENE3D);
for (const [lon, lat, height] of [[3.711, 51.065, 10], [37.58, 55.75, 160], [-97.736, 30.287, 180]]) {
const target = C.Cartesian3.fromDegrees(lon, lat, height);
camera.flyToBoundingSphere(new C.BoundingSphere(target, 160), {
duration: 0, offset: new C.HeadingPitchRange(0, -Math.PI / 4, 600),
});
assert.ok(Math.abs(C.Cartesian3.distance(camera.positionWC, target) - 600) < 1e-5);
const position = C.Cartographic.clone(camera.positionCartographic);
const orientation = { heading: camera.heading, pitch: camera.pitch, roll: camera.roll };
camera.setView({ destination: C.Cartesian3.fromRadians(position.longitude, position.latitude, position.height), orientation });
const toward = C.Cartesian3.normalize(C.Cartesian3.subtract(target, camera.positionWC, new C.Cartesian3()), new C.Cartesian3());
assert.ok(C.Cartesian3.dot(camera.directionWC, toward) > 0.999999);
assert.ok(Math.abs(C.Cartesian3.distance(camera.positionWC, target) - 600) < 1e-5);
}
});
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@nodedc/ui-core",
"version": "0.7.0",
"version": "0.7.1",
"type": "module",
"files": [
"dist",
+91 -9
View File
@@ -1570,14 +1570,21 @@ textarea.nodedc-field__control {
--nodedc-app-page-pad: 1.25rem;
--nodedc-app-panel-gap: 1.25rem;
--nodedc-app-nav-width: clamp(20.75rem, 19.5vw, 22rem);
--nodedc-app-nav-current-width: var(--nodedc-app-nav-width);
--nodedc-app-nav-rail-width: 4.55rem;
--nodedc-app-navigation-motion: 440ms cubic-bezier(0.22, 1, 0.36, 1);
--nodedc-app-content-width: calc(
100vw - (var(--nodedc-app-page-pad) * 2) - (var(--nodedc-app-panel-gap) * 2) - (var(--nodedc-app-nav-width) * 2)
100vw - (var(--nodedc-app-page-pad) * 2) - (var(--nodedc-app-panel-gap) * 2) - var(--nodedc-app-nav-current-width) - var(--nodedc-app-nav-width)
);
min-height: 100vh;
overflow: hidden;
background: var(--nodedc-canvas);
}
.nodedc-app-shell[data-navigation-collapsed="true"] {
--nodedc-app-nav-current-width: var(--nodedc-app-nav-rail-width);
}
.nodedc-app-shell__main {
position: relative;
height: calc(100vh - var(--nodedc-app-header-height));
@@ -1612,13 +1619,14 @@ textarea.nodedc-field__control {
.nodedc-app-shell__navigation {
left: var(--nodedc-app-page-pad);
width: var(--nodedc-app-nav-width);
width: var(--nodedc-app-nav-current-width);
transition: width var(--nodedc-app-navigation-motion);
}
.nodedc-app-shell__content {
left: calc(var(--nodedc-app-page-pad) + var(--nodedc-app-nav-width) + var(--nodedc-app-panel-gap));
left: calc(var(--nodedc-app-page-pad) + var(--nodedc-app-nav-current-width) + var(--nodedc-app-panel-gap));
width: max(32rem, var(--nodedc-app-content-width));
transition: width 500ms cubic-bezier(0.22, 1, 0.36, 1), right 500ms cubic-bezier(0.22, 1, 0.36, 1);
transition: left var(--nodedc-app-navigation-motion), width var(--nodedc-app-navigation-motion), right var(--nodedc-app-navigation-motion);
}
.nodedc-app-shell__end-panel {
@@ -1643,12 +1651,12 @@ textarea.nodedc-field__control {
}
.nodedc-app-shell[data-navigation-open="true"] .nodedc-app-shell__stage {
padding-left: calc(var(--nodedc-app-page-pad) + var(--nodedc-app-nav-width) + var(--nodedc-app-panel-gap));
padding-left: calc(var(--nodedc-app-page-pad) + var(--nodedc-app-nav-current-width) + var(--nodedc-app-panel-gap));
}
.nodedc-app-shell[data-content-open="true"]:not([data-content-expanded="true"]) .nodedc-app-shell__stage {
padding-left: calc(
var(--nodedc-app-page-pad) + var(--nodedc-app-nav-width) + var(--nodedc-app-panel-gap) +
var(--nodedc-app-page-pad) + var(--nodedc-app-nav-current-width) + var(--nodedc-app-panel-gap) +
max(32rem, var(--nodedc-app-content-width)) + var(--nodedc-app-panel-gap)
);
}
@@ -2130,7 +2138,7 @@ textarea.nodedc-field__control {
padding-right: 3rem;
}
.nodedc-admin-panel__sortable-row > .nodedc-drag-handle {
.nodedc-admin-panel__sortable-row > span > .nodedc-drag-handle {
position: absolute;
top: 50%;
right: 0.72rem;
@@ -2167,6 +2175,72 @@ textarea.nodedc-field__control {
opacity: 0.82;
}
/* Shared collapsible left navigation; the right application panel is independent. */
.nodedc-admin-panel--navigation {
--nodedc-app-nav-rail-width: 4.55rem;
transition: width var(--nodedc-app-navigation-motion, 440ms cubic-bezier(0.22, 1, 0.36, 1));
}
.nodedc-admin-panel--navigation .nodedc-admin-panel__head { min-height: 3.55rem; }
.nodedc-admin-panel__titles { min-width: 0; padding-right: 4.5rem; }
.nodedc-admin-panel__titles,
.nodedc-admin-panel__item-label,
.nodedc-admin-panel--navigation .nodedc-admin-context__body,
.nodedc-admin-panel--navigation .nodedc-admin-panel__footer > :not(.nodedc-admin-panel__nav-icon) {
transition: opacity 160ms ease;
}
.nodedc-admin-panel__item-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nodedc-admin-panel__extra-actions { display: contents; }
.nodedc-admin-panel__extra-actions:empty { display: none; }
.nodedc-admin-panel__extra-actions > .nodedc-icon-button { width: 2.92rem; height: 2.92rem; flex-basis: 2.92rem; }
.nodedc-admin-panel__context-area { display: grid; gap: .48rem; }
.nodedc-admin-panel--navigation .nodedc-admin-panel__item-tooltip { display: block; width: 100%; min-width: 0; }
.nodedc-admin-panel--navigation [hidden] { display: none; }
.nodedc-admin-panel--navigation[data-collapsed="true"] { width: var(--nodedc-app-nav-rail-width); }
.nodedc-admin-panel--navigation .nodedc-admin-context__main { width: 100%; }
.nodedc-admin-panel--navigation[data-collapsed="true"] .nodedc-admin-panel__titles { height: 0; }
.nodedc-admin-panel--navigation[data-collapsed="true"] .nodedc-admin-panel__titles,
.nodedc-admin-panel--navigation[data-collapsed="true"] .nodedc-admin-panel__item-label,
.nodedc-admin-panel--navigation[data-collapsed="true"] .nodedc-admin-context__body,
.nodedc-admin-panel--navigation[data-collapsed="true"] .nodedc-admin-panel__footer > :not(.nodedc-admin-panel__nav-icon) {
opacity: 0;
pointer-events: none;
width: 0;
overflow: hidden;
padding: 0;
}
.nodedc-admin-panel--navigation[data-collapsed="true"] .nodedc-admin-panel__head-actions {
left: 0; right: 0; justify-content: center;
}
.nodedc-admin-panel--navigation[data-collapsed="true"] :is(.nodedc-admin-panel__nav-item, .nodedc-admin-panel__footer, .nodedc-admin-context__main) {
justify-content: center; gap: 0; padding-inline: 0;
}
.nodedc-admin-panel--navigation[data-collapsed="true"] :is(.nodedc-admin-panel__nav-item, .nodedc-admin-panel__footer, .nodedc-admin-context) {
background: transparent; box-shadow: none;
}
.nodedc-admin-panel--navigation[data-collapsed="true"] .nodedc-admin-context { grid-template-columns: minmax(0, 1fr); }
.nodedc-admin-panel--navigation[data-collapsed="true"] .nodedc-admin-panel__nav-icon {
position: static; transform: none;
}
.nodedc-admin-panel--navigation[data-collapsed="true"] .nodedc-admin-panel__nav-item:focus-visible .nodedc-admin-panel__nav-icon,
.nodedc-admin-panel--navigation .nodedc-admin-context__main:focus-visible .nodedc-admin-context__icon {
background: var(--nodedc-glass-control-hover); color: var(--nodedc-text-primary);
}
.nodedc-admin-panel--navigation[data-collapsed="true"] :is(.nodedc-admin-panel__nav-item, .nodedc-admin-context__main):focus-visible {
background: transparent; box-shadow: none;
}
.nodedc-admin-panel--navigation[data-collapsed="true"] .nodedc-admin-panel__nav-item:focus-visible .nodedc-admin-panel__nav-icon,
.nodedc-admin-panel--navigation[data-collapsed="true"] .nodedc-admin-context__main:focus-visible .nodedc-admin-context__icon {
background: var(--nodedc-text-primary); color: var(--nodedc-canvas);
}
.nodedc-admin-panel--navigation[data-collapsed="true"] .nodedc-admin-panel__nav-item:focus-visible .nodedc-admin-panel__nav-icon > svg { color: inherit; }
@media (prefers-reduced-motion: reduce) {
.nodedc-admin-panel--navigation,
.nodedc-admin-panel--navigation *,
.nodedc-app-shell__navigation,
.nodedc-app-shell__content,
.nodedc-app-shell__stage { transition: none; animation: none; }
}
.nodedc-dropdown-anchor {
display: inline-flex;
}
@@ -3876,6 +3950,11 @@ textarea.nodedc-field__control {
width: auto;
}
.nodedc-app-shell[data-navigation-collapsed="true"] .nodedc-app-shell__navigation {
right: auto;
width: var(--nodedc-app-nav-rail-width);
}
.nodedc-app-shell[data-end-panel-open="true"] .nodedc-app-shell__content {
opacity: 0;
pointer-events: none;
@@ -4705,8 +4784,11 @@ textarea.nodedc-field__control {
width: max-content; max-width: min(280px, calc(100vw - 16px)); overflow: auto;
padding: var(--nodedc-space-3) var(--nodedc-space-4);
border-radius: var(--nodedc-radius-control-compact);
background: var(--nodedc-floating-surface); color: var(--nodedc-text-primary);
box-shadow: var(--nodedc-glass-dropdown-shadow); font-family: var(--nodedc-font-family);
border: 0; outline: 0;
background: rgb(var(--nodedc-modal-glass-tint-rgb) / var(--nodedc-scene-glass-opacity));
backdrop-filter: blur(var(--nodedc-scene-glass-blur)) saturate(var(--nodedc-modal-glass-saturation));
-webkit-backdrop-filter: blur(var(--nodedc-scene-glass-blur)) saturate(var(--nodedc-modal-glass-saturation)); color: var(--nodedc-text-primary);
box-shadow: none; font-family: var(--nodedc-font-family);
font-size: var(--nodedc-font-size-sm); font-weight: var(--nodedc-font-weight-regular); line-height: 1.4;
animation: nodedc-tooltip-in var(--nodedc-duration-fast) var(--nodedc-ease-standard);
}
+1 -1
View File
@@ -20,6 +20,6 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
"@nodedc/ui-core": "0.7.0"
"@nodedc/ui-core": "0.7.1"
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@nodedc/ui-react",
"version": "0.7.0",
"version": "0.7.1",
"type": "module",
"files": [
"dist"
@@ -21,7 +21,7 @@
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@nodedc/ui-core": "0.7.0",
"@nodedc/ui-core": "0.7.1",
"lucide-react": "^0.468.0"
},
"peerDependencies": {
+56 -34
View File
@@ -1,4 +1,7 @@
import type { HTMLAttributes, ReactNode } from "react";
import {useContext, useState, type HTMLAttributes, type ReactNode} from "react";
import {IconButton} from "./Button.js";
import {NavigationPanelState} from "./NavigationPanelState.js";
import {Tooltip} from "./Tooltip.js";
import { cn } from "./cn.js";
import { SortableList } from "./DragDrop.js";
import { Icon } from "./Icon.js";
@@ -31,6 +34,12 @@ export interface AdminNavigationPanelProps extends Omit<HTMLAttributes<HTMLEleme
activeId?: string;
footer?: ReactNode;
closeLabel?: string;
collapseLabel?: string;
expandLabel?: string;
/** Standalone state. Inside ApplicationShell, use its navigationCollapsed API. */
collapsed?: boolean;
defaultCollapsed?: boolean;
onCollapsedChange?: (collapsed: boolean) => void;
navigationLabel?: string;
onClose: () => void;
onItemChange: (id: string) => void;
@@ -47,6 +56,11 @@ export function AdminNavigationPanel({
activeId,
footer,
closeLabel = "Закрыть администрирование",
collapseLabel = "Свернуть панель навигации",
expandLabel = "Развернуть панель навигации",
collapsed: controlledCollapsed,
defaultCollapsed = false,
onCollapsedChange,
navigationLabel = "Разделы администрирования",
onClose,
onItemChange,
@@ -54,40 +68,66 @@ export function AdminNavigationPanel({
className,
...props
}: AdminNavigationPanelProps) {
const shell = useContext(NavigationPanelState);
const [localCollapsed, setLocalCollapsed] = useState(defaultCollapsed);
const collapsed = shell?.collapsed ?? controlledCollapsed ?? localCollapsed;
const toggleCollapsed = () => {
const next = !collapsed;
if (shell) shell.onCollapsedChange(next);
else if (controlledCollapsed === undefined) setLocalCollapsed(next);
onCollapsedChange?.(next);
};
const renderItem = (item: AdminNavigationItem) => (
<Tooltip content={item.label} disabled={!collapsed} placement="right-start" className="nodedc-admin-panel__item-tooltip">
<button type="button" className="nodedc-admin-panel__nav-item"
aria-label={item.label} aria-current={activeId === item.id ? "page" : undefined}
data-active={activeId === item.id ? "true" : undefined} onClick={() => onItemChange(item.id)}>
<span className="nodedc-admin-panel__nav-icon" aria-hidden="true">{item.icon ?? <Icon name="grid" />}</span>
<span className="nodedc-admin-panel__item-label" aria-hidden={collapsed || undefined}>{item.label}</span>
</button>
</Tooltip>
);
return (
<aside className={cn("nodedc-admin-panel", className)} data-has-contexts={contexts.length > 0 || contextSlot ? "true" : undefined} {...props}>
<aside className={cn("nodedc-admin-panel", "nodedc-admin-panel--navigation", className)} data-collapsed={collapsed ? "true" : undefined} data-has-contexts={contexts.length > 0 || contextSlot ? "true" : undefined} {...props}>
<header className="nodedc-admin-panel__head">
<div>
<div className="nodedc-admin-panel__titles" aria-hidden={collapsed || undefined}>
<p>{eyebrow}</p>
<h2>{title}</h2>
</div>
<div className="nodedc-admin-panel__head-actions">
{headerActions}
<button type="button" className="nodedc-admin-panel__close" aria-label={closeLabel} onClick={onClose}>
<span className="nodedc-admin-panel__extra-actions" hidden={collapsed}>{headerActions}</span>
<IconButton label={collapsed ? expandLabel : collapseLabel} aria-expanded={!collapsed}
className="nodedc-admin-panel__collapse" onClick={toggleCollapsed}>
<Icon name={collapsed ? "chevron-right" : "chevron-left"} />
</IconButton>
<button hidden={collapsed} type="button" className="nodedc-admin-panel__close" aria-label={closeLabel} onClick={onClose}>
<Icon name="close" size={16} strokeWidth={1.6} />
</button>
</div>
</header>
{contextSlot ? <div className="nodedc-admin-panel__context-slot">{contextSlot}</div> : null}
{contexts.length > 0 || contextSlot ? <div className="nodedc-admin-panel__context-area">
{contextSlot ? <div className="nodedc-admin-panel__context-slot" hidden={collapsed}>{contextSlot}</div> : null}
{contexts.length > 0 ? <div className="nodedc-admin-panel__contexts">
{contexts.map((context) => (
<div className="nodedc-admin-panel__context-group" key={context.id}>
{context.groupLabel ? <span className="nodedc-admin-panel__group-label">{context.groupLabel}</span> : null}
{context.groupLabel ? <span className="nodedc-admin-panel__group-label" hidden={collapsed}>{context.groupLabel}</span> : null}
<div
className={cn("nodedc-admin-context", context.onToggle && "nodedc-admin-context--split")}
data-active={context.active ? "true" : undefined}
>
<button type="button" className="nodedc-admin-context__main" onClick={context.onSelect}>
<span className="nodedc-admin-context__icon" aria-hidden="true">{context.icon}</span>
<span className="nodedc-admin-context__body">
<Tooltip content={context.label} disabled={!collapsed} placement="right-start" className="nodedc-admin-panel__item-tooltip">
<button type="button" className="nodedc-admin-context__main" aria-label={context.label} onClick={context.onSelect ?? context.onToggle}>
<span className="nodedc-admin-context__icon" aria-hidden="true">{context.icon ?? <Icon name="grid" />}</span>
<span className="nodedc-admin-context__body" aria-hidden={collapsed || undefined}>
<strong>{context.label}</strong>
{context.description ? <small>{context.description}</small> : null}
</span>
</button>
</Tooltip>
{context.onToggle ? (
<button type="button" className="nodedc-admin-context__toggle" aria-label={`Выбрать: ${context.label}`} onClick={context.onToggle}>
<button hidden={collapsed} type="button" className="nodedc-admin-context__toggle" aria-label={`Выбрать: ${context.label}`} onClick={context.onToggle}>
<span className="nodedc-select-trigger__chevron" aria-hidden="true" />
</button>
) : null}
@@ -95,20 +135,10 @@ export function AdminNavigationPanel({
</div>
))}
</div> : null}
</div> : null}
<nav className="nodedc-admin-panel__nav" aria-label={navigationLabel}>
{items.filter((item) => !item.sortable).map((item) => (
<button
key={item.id}
type="button"
className="nodedc-admin-panel__nav-item"
data-active={activeId === item.id ? "true" : undefined}
onClick={() => onItemChange(item.id)}
>
<span className="nodedc-admin-panel__nav-icon" aria-hidden="true">{item.icon}</span>
<span>{item.label}</span>
</button>
))}
{items.filter((item) => !item.sortable).map((item) => <div key={item.id}>{renderItem(item)}</div>)}
{items.some((item) => item.sortable) ? (
<SortableList
className="nodedc-admin-panel__sortable-nav"
@@ -118,23 +148,15 @@ export function AdminNavigationPanel({
>
{(item, { handle }) => (
<div className="nodedc-admin-panel__sortable-row">
<button
type="button"
className="nodedc-admin-panel__nav-item"
data-active={activeId === item.id ? "true" : undefined}
onClick={() => onItemChange(item.id)}
>
<span className="nodedc-admin-panel__nav-icon" aria-hidden="true">{item.icon}</span>
<span>{item.label}</span>
</button>
{handle}
{renderItem(item)}
<span hidden={collapsed}>{handle}</span>
</div>
)}
</SortableList>
) : null}
</nav>
{footer ? <footer className="nodedc-admin-panel__footer">{footer}</footer> : null}
{footer ? <footer className="nodedc-admin-panel__footer" aria-hidden={collapsed || undefined}>{footer}</footer> : null}
</aside>
);
}
+18 -2
View File
@@ -1,4 +1,5 @@
import type { HTMLAttributes, ReactNode } from "react";
import {useCallback, useMemo, useState, type HTMLAttributes, type ReactNode} from "react";
import {NavigationPanelState} from "./NavigationPanelState.js";
import { cn } from "./cn.js";
import {ApplicationPanelFullscreen} from "./ApplicationPanelFullscreen.js";
import { Icon, type IconName } from "./Icon.js";
@@ -10,6 +11,10 @@ export interface ApplicationShellProps extends Omit<HTMLAttributes<HTMLDivElemen
content?: ReactNode;
endPanel?: ReactNode;
navigationOpen?: boolean;
/** Shared across navigation routes; closing a workspace does not reset it. */
navigationCollapsed?: boolean;
defaultNavigationCollapsed?: boolean;
onNavigationCollapsedChange?: (collapsed: boolean) => void;
contentOpen?: boolean;
contentExpanded?: boolean;
endPanelOpen?: boolean;
@@ -22,16 +27,27 @@ export function ApplicationShell({
content,
endPanel,
navigationOpen = false,
navigationCollapsed,
defaultNavigationCollapsed = false,
onNavigationCollapsedChange,
contentOpen = false,
contentExpanded = false,
endPanelOpen = false,
className,
...props
}: ApplicationShellProps) {
const [localCollapsed, setLocalCollapsed] = useState(defaultNavigationCollapsed);
const collapsed = navigationCollapsed ?? localCollapsed;
const onCollapsedChange = useCallback((next: boolean) => {
if (navigationCollapsed === undefined) setLocalCollapsed(next);
onNavigationCollapsedChange?.(next);
}, [navigationCollapsed, onNavigationCollapsedChange]);
const navigationState = useMemo(() => ({collapsed, onCollapsedChange}), [collapsed, onCollapsedChange]);
return (
<div
className={cn("nodedc-app-shell", className)}
data-navigation-open={navigationOpen ? "true" : undefined}
data-navigation-collapsed={collapsed ? "true" : undefined}
data-content-open={contentOpen ? "true" : undefined}
data-content-expanded={contentOpen && contentExpanded ? "true" : undefined}
data-end-panel-open={endPanelOpen ? "true" : undefined}
@@ -40,7 +56,7 @@ export function ApplicationShell({
{header}
<main className="nodedc-app-shell__main">
<div className="nodedc-app-shell__stage">{stage}</div>
{navigationOpen && navigation ? <div className="nodedc-app-shell__navigation">{navigation}</div> : null}
{navigationOpen && navigation ? <div className="nodedc-app-shell__navigation"><NavigationPanelState.Provider value={navigationState}>{navigation}</NavigationPanelState.Provider></div> : null}
{contentOpen && content ? <div className="nodedc-app-shell__content">{content}</div> : null}
{endPanel ? <div className="nodedc-app-shell__end-panel">{endPanel}</div> : null}
</main>
@@ -0,0 +1,7 @@
import {createContext} from "react";
/** The shell owns rail width and panel presentation as one state. */
export const NavigationPanelState = createContext<{
collapsed: boolean;
onCollapsedChange: (collapsed: boolean) => void;
} | null>(null);
+1 -1
View File
@@ -62,7 +62,7 @@ export function Tooltip({children,content,label,focusable=false,disabled=false,p
aria-describedby={open?id:undefined} onPointerEnter={e=>{if(e.pointerType!=='touch')show();}}
onPointerLeave={leave} onFocus={show} onBlur={e=>{if(!e.currentTarget.contains(e.relatedTarget)&&!e.currentTarget.matches(':hover'))close();}}
onPointerDown={e=>{if(e.pointerType==='touch'){if(open)close();else show();}}}>
{focusable||!isValidElement(children)?children:cloneElement(children as ReactElement<{'aria-describedby'?:string}>,{'aria-describedby':[children.props && (children.props as {'aria-describedby'?:string})['aria-describedby'],open?id:undefined].filter(Boolean).join(' ')||undefined})}
{focusable||!isValidElement(children)?children:cloneElement(children as ReactElement<{'aria-describedby'?:string;title?:string}>,{title:undefined,'aria-describedby':[children.props && (children.props as {'aria-describedby'?:string})['aria-describedby'],open?id:undefined].filter(Boolean).join(' ')||undefined})}
{open&&typeof document!=='undefined'&&createPortal(<div ref={surface} id={id} role="tooltip"
className="nodedc-tooltip" style={style} onPointerEnter={clear} onPointerLeave={leave}>{content}</div>,document.fullscreenElement??document.body)}
</span>;
+73
View File
@@ -0,0 +1,73 @@
import {createContext,useContext,useEffect,useId,useLayoutEffect,useRef,useState,type CSSProperties,type ReactNode} from 'react';
import {createPortal} from 'react-dom';
import {computeFloatingPosition} from '@nodedc/ui-core';
import {TooltipTitles} from './tooltipTitles.js';
const Installed=createContext(false);
/** One application-wide bridge for native title hints. Nested modules reuse the host. */
export function TooltipProvider({children}:{children?:ReactNode}){
const installed=useContext(Installed);
return installed?<>{children}</>:<Installed.Provider value={true}><TitleTooltips/>{children}</Installed.Provider>;
}
function TitleTooltips(){
const id=`tooltip-layer-${useId().replaceAll(':','')}`;
const [target,setTarget]=useState<{element:Element;text:string}|null>(null);
const [style,setStyle]=useState<CSSProperties>({visibility:'hidden'});
const surface=useRef<HTMLDivElement>(null),titles=useRef(new TooltipTitles());
const hide=useRef(()=>{});
useEffect(()=>{
let anchor:Element|null=null,timer:ReturnType<typeof setTimeout>|undefined,leaving:ReturnType<typeof setTimeout>|undefined,observer:MutationObserver|null=null;
const clear=()=>{clearTimeout(timer);clearTimeout(leaving);};
const close=()=>{clear();observer?.disconnect();observer=null;anchor=null;titles.current.restore();setTarget(null);};hide.current=close;
const show=(element:Element,text:string)=>{
titles.current.describe(element,id);setTarget({element,text});
window.dispatchEvent(new CustomEvent('nodedc-tooltip-open',{detail:id}));
};
const enter=(node:EventTarget|null,keyboard=false)=>{
if(!(node instanceof Element))return;
if(surface.current?.contains(node)){clear();return;}
if(anchor?.contains(node)){clearTimeout(leaving);if(keyboard){const text=titles.current.text(anchor);if(text)show(anchor,text);}return;}
close();
// Explicit Tooltip already owns rich content and its accessible description.
if(node.closest('.nodedc-tooltip-anchor,[data-nodedc-tooltip="off"]'))return;
const found=titles.current.find(node);if(!found)return;
anchor=found.element;titles.current.suppress(anchor);
observer=new MutationObserver(()=>{
if(!anchor)return;
const updated=anchor.getAttribute('data-nodedc-tooltip')??anchor.getAttribute('title');if(updated===null)return;
titles.current.suppress(anchor);if(updated.trim())show(anchor,updated);else close();
});observer.observe(anchor,{attributes:true,attributeFilter:['title','data-nodedc-tooltip']});
if(keyboard)show(anchor,found.text);else timer=setTimeout(()=>{if(anchor)show(anchor,found.text);},220);
};
const leave=(related:EventTarget|null)=>{
if(related instanceof Node&&(anchor?.contains(related)||surface.current?.contains(related)))return;
if(anchor?.contains(document.activeElement))return;
clearTimeout(leaving);leaving=setTimeout(close,140);
};
const over=(event:PointerEvent)=>{if(event.pointerType!=='touch')enter(event.composedPath()[0]??event.target);};
const out=(event:PointerEvent)=>leave(event.relatedTarget);
const focus=(event:FocusEvent)=>enter(event.composedPath()[0]??event.target,true);
const blur=(event:FocusEvent)=>{if(!(event.relatedTarget instanceof Node)||!anchor?.contains(event.relatedTarget))close();};
const down=()=>{clear();setTarget(null);};
const key=(event:KeyboardEvent)=>{if(event.key==='Escape'&&anchor){close();event.preventDefault();event.stopImmediatePropagation();}};
const other=(event:Event)=>{if((event as CustomEvent<string>).detail!==id)close();};
document.addEventListener('pointerover',over,true);document.addEventListener('pointerout',out,true);
document.addEventListener('focusin',focus,true);document.addEventListener('focusout',blur,true);
document.addEventListener('pointerdown',down,true);document.addEventListener('keydown',key,true);
document.addEventListener('fullscreenchange',close);window.addEventListener('blur',close);window.addEventListener('nodedc-tooltip-open',other);
return()=>{close();document.removeEventListener('pointerover',over,true);document.removeEventListener('pointerout',out,true);document.removeEventListener('focusin',focus,true);document.removeEventListener('focusout',blur,true);document.removeEventListener('pointerdown',down,true);document.removeEventListener('keydown',key,true);document.removeEventListener('fullscreenchange',close);window.removeEventListener('blur',close);window.removeEventListener('nodedc-tooltip-open',other);};
},[id]);
useLayoutEffect(()=>{
if(!target)return;
const position=()=>{
if(!surface.current||!target.element.isConnected){hide.current();return;}
const rect=target.element.getBoundingClientRect();if(rect.bottom<=0||rect.top>=window.innerHeight||rect.right<=0||rect.left>=window.innerWidth){hide.current();return;}
const size=surface.current.getBoundingClientRect(),p=computeFloatingPosition({anchor:rect,surfaceWidth:size.width,surfaceHeight:size.height,placement:'bottom-start',offset:8});
setStyle({left:p.left,top:p.top,maxHeight:p.maxHeight,visibility:'visible'});
};
position();const observer=new ResizeObserver(position);observer.observe(target.element);if(surface.current)observer.observe(surface.current);
window.addEventListener('resize',position);window.addEventListener('scroll',position,true);
return()=>{observer.disconnect();window.removeEventListener('resize',position);window.removeEventListener('scroll',position,true);};
},[target]);
return target&&typeof document!=='undefined'?createPortal(<div ref={surface} id={id} role="tooltip" className="nodedc-tooltip" style={style}>{target.text}</div>,document.fullscreenElement??document.body):null;
}
+2
View File
@@ -58,3 +58,5 @@ export {SceneAnnotation} from "./SceneAnnotation.js";
export {LevelButton,type LevelButtonProps} from "./LevelButton.js";
export {Tooltip,type TooltipProps} from "./Tooltip.js";
export {TooltipProvider} from "./TooltipProvider.js";
+20
View File
@@ -0,0 +1,20 @@
/** Suppress native tooltips only during interaction; preserve changing titles and ARIA. */
export class TooltipTitles {
private titles=new Map<Element,string>();
private description:{element:Element;id:string;label?:string}|null=null;
text(element:Element){return element.getAttribute('data-nodedc-tooltip')??this.titles.get(element)??element.getAttribute('title');}
find(start:Element){for(let element:Element|null=start;element;element=element.parentElement){const text=element.getAttribute('data-nodedc-tooltip')??element.getAttribute('title');if(text!==null)return text.trim()?{element,text}:null;}return null;}
suppress(start:Element){for(let element:Element|null=start;element;element=element.parentElement){const text=element.getAttribute('title');if(text!==null){this.titles.set(element,text);element.removeAttribute('title');}}}
describe(element:Element,id:string){
const ids=new Set((element.getAttribute('aria-describedby')??'').split(/\s+/).filter(Boolean));ids.add(id);element.setAttribute('aria-describedby',[...ids].join(' '));
let label=this.description?.label;
if(!element.hasAttribute('aria-label')&&!element.hasAttribute('aria-labelledby')&&!element.textContent?.trim()){
label=this.text(element)??undefined;if(label)element.setAttribute('aria-label',label);
}
this.description={element,id,label};
}
restore(){
for(const [element,text] of this.titles)if(!element.hasAttribute('title'))element.setAttribute('title',text);this.titles.clear();
if(this.description){const {element,id,label}=this.description;const ids=(element.getAttribute('aria-describedby')??'').split(/\s+/).filter(value=>value&&value!==id);if(ids.length)element.setAttribute('aria-describedby',ids.join(' '));else element.removeAttribute('aria-describedby');if(label&&element.getAttribute('aria-label')===label)element.removeAttribute('aria-label');this.description=null;}
}
}
+12 -5
View File
@@ -779,6 +779,7 @@
"rules": [
"The bottom Launcher service rail is product-specific and is not part of the general application template.",
"Desktop page gap is 20 px and navigation width follows the Launcher 332–352 px range.",
"Shared navigationCollapsed state contracts the left column to a 4.55rem icon rail, preserves workspace identity and leaves the end column full-width. Width and content offset animate together with reduced-motion support.",
"Applications supply routes, profile data, stage media and panel content without changing shell geometry.",
"Light panels use the SEO white surface and shadow tokens rather than a dark shell with inverted text.",
"A layout-level save action belongs to ApplicationPanel.utilityActions and is never duplicated inside individual content cards.",
@@ -867,10 +868,10 @@
"domContract": [
"nodedc-admin-panel"
],
"summary": "Hub-derived left administration panel with context selectors, route navigation, close action and footer identity.",
"summary": "Shared collapsible left administration panel with context selectors, accessible icon rail, route navigation and footer identity.",
"anatomy": [
"eyebrow and title",
"close action",
"collapse/expand and close actions",
"workspace context",
"company context",
"route items",
@@ -879,7 +880,10 @@
"rules": [
"The panel shell, full-bleed pills and icon circles are library geometry; routes and identity data remain application-owned.",
"The desktop panel follows the Launcher 332–352 px width range with a 21.6 px shell radius and a 20 px page gap.",
"Active route state uses the active surface and icon contrast from the theme."
"Active route state uses the active surface and icon contrast from the theme.",
"All left navigation panels collapse to the shared 4.55rem icon rail; title, labels, close and secondary actions disappear. Icon names and hover/focus tooltips remain.",
"ApplicationShell owns synchronized rail/content width and route-independent collapse state without remounting the workspace. Right panels retain their width.",
"Use shell navigationCollapsed/onNavigationCollapsedChange for controlled state; standalone panels accept collapsed/onCollapsedChange. Respect reduced motion."
]
},
{
@@ -1448,7 +1452,8 @@
"package": "@nodedc/ui-react",
"exports": [
"Tooltip",
"TooltipProps"
"TooltipProps",
"TooltipProvider"
],
"domContract": [
"nodedc-tooltip-anchor",
@@ -1467,7 +1472,9 @@
"rules": [
"Use focusable for read-only graphics; action triggers own their focus.",
"Content is descriptive, never a menu or interactive form.",
"No new app-local tooltip geometry or layer management."
"No new app-local tooltip geometry or layer management.",
"All tooltip surfaces use rounded scene glass without decorative border, outline or rim.",
"Mount TooltipProvider once at the application root to present legacy native title hints through the same accessible portal. Nested reusable modules reuse the host provider."
]
},
{
+2 -2
View File
@@ -1,6 +1,6 @@
{
"schemaVersion": "1.0.0",
"libraryVersion": "0.7.0",
"libraryVersion": "0.7.1",
"name": "NODE.DC Design System",
"purpose": "Canonical code-level UI system for current and future NODE.DC applications.",
"packages": [
@@ -32,7 +32,7 @@
{
"name": "@nodedc/map-cesium-react",
"path": "packages/map-cesium-react",
"role": "credential-free Cesium renderer adapter for the canonical Map Page and same-origin Platform Map Gateway BFFs"
"role": "credential-free Cesium 1.147.0 renderer adapter for canonical Map Page and same-origin Map Gateway BFFs; optional lifetime-scoped ready-domain geometry hook"
}
],
"sourceRegistry": "sources.json",
+48
View File
@@ -0,0 +1,48 @@
const fs = require('node:fs'), path = require('node:path'), os = require('node:os'), assert = require('node:assert/strict');
const root = process.env.DG_ROOT || path.resolve(__dirname, '..');
const {JSDOM} = require('jsdom'), React = require(root + '/node_modules/react'), {act} = React;
const {createRoot} = require(root + '/node_modules/react-dom/client');
const dom = new JSDOM('<div id="app"></div>', {pretendToBeVisual: true});
for (const name of ['window','document','HTMLElement','Element','Node','Event','MouseEvent','KeyboardEvent','CustomEvent']) global[name] = dom.window[name];
global.ResizeObserver = class {observe() {} disconnect() {}};
global.IS_REACT_ACT_ENVIRONMENT = true;
HTMLElement.prototype.getBoundingClientRect = () => ({top: 20, bottom: 60, left: 20, right: 80, width: 60, height: 40});
const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'nodedc-sidebar-'));
require(root + '/node_modules/esbuild').buildSync({stdin: {contents: `export {AdminNavigationPanel} from './AdminNavigationPanel.tsx'; export {ApplicationShell} from './ApplicationShell.tsx';`, resolveDir: root + '/packages/ui-react/src'}, outfile: scratch + '/sidebar.cjs', bundle: true, platform: 'node', format: 'cjs', external: ['react','react/*','react-dom','react-dom/*'], jsx: 'automatic'});
const {ApplicationShell, AdminNavigationPanel} = require(scratch + '/sidebar.cjs');
const ui = createRoot(document.getElementById('app')), h = React.createElement;
let selected = 'one', section = 'Data', open = true, mounts = 0, closes = 0, notified = [];
function Workspace() {React.useEffect(() => {mounts++;}, []); return h('input', {defaultValue: 'keep draft', 'aria-label': 'Draft'});}
const panel = () => h(AdminNavigationPanel, {key: section, title: section, onClose: () => closes++, closeLabel: 'Close navigation', activeId: selected, onItemChange: id => selected = id, contexts: [{id: 'context', label: 'Context', onToggle: () => {}, icon: 'C'}], headerActions: h('button', null, 'Extra'), items: [{id: 'one', label: 'One', icon: '1'}, {id: 'two', label: 'Two', icon: '2', sortable: true}], onItemsReorder: () => {}});
const render = (extra = {}) => act(async () => ui.render(h(ApplicationShell, {header: null, stage: null, navigation: panel(), navigationOpen: open, contentOpen: true, contentExpanded: true, content: h(Workspace), endPanel: h('div', {'data-testid': 'right'}, 'Right'), onNavigationCollapsedChange: value => notified.push(value), ...extra})));
const button = label => [...document.querySelectorAll('button')].find(b => b.getAttribute('aria-label') === label);
const click = el => act(async () => el.dispatchEvent(new MouseEvent('click', {bubbles: true})));
const shell = () => document.querySelector('.nodedc-app-shell');
(async () => {
await render(); const draft = document.querySelector('input'); draft.value = 'unsaved text';
await click(button('Свернуть панель навигации'));
assert.equal(shell().dataset.navigationCollapsed, 'true');
assert.equal(document.querySelector('aside').dataset.collapsed, 'true');
assert.equal(button('Развернуть панель навигации').getAttribute('aria-expanded'), 'false');
assert(button('Close navigation').hidden); assert.equal(closes, 0);
assert(button('Выбрать: Context').hidden); assert(document.querySelector('.nodedc-admin-panel__extra-actions').hidden);
assert.equal(button('One').getAttribute('aria-current'), 'page');
await click(button('Two')); assert.equal(selected, 'two');
section = 'System'; await render(); assert.equal(document.querySelector('aside').dataset.collapsed, 'true', 'new root uses retained shell state');
open = false; await render(); open = true; await render(); assert.equal(document.querySelector('aside').dataset.collapsed, 'true', 'close/reopen preserves rail');
await act(async () => button('Two').focus()); assert.equal(document.querySelector('[role=tooltip]').textContent, 'Two');
await act(async () => document.dispatchEvent(new KeyboardEvent('keydown', {key: 'Escape', bubbles: true})));
assert.equal(document.querySelector('[role=tooltip]'), null); assert.equal(closes, 0, 'Escape closes tooltip only');
await click(button('Развернуть панель навигации')); assert.equal(shell().dataset.navigationCollapsed, undefined);
assert.equal(button('Close navigation').hidden, false);
assert.equal(mounts, 1); assert.equal(document.querySelector('input'), draft); assert.equal(draft.value, 'unsaved text');
assert.deepEqual(notified, [true, false]);
await render({navigationCollapsed: false}); await click(button('Свернуть панель навигации'));
assert.equal(shell().dataset.navigationCollapsed, undefined, 'controlled shell awaits owner acceptance');
await render({navigationCollapsed: true}); assert.equal(document.querySelector('aside').dataset.collapsed, 'true');
assert.equal(document.querySelector('[data-testid=right]').textContent, 'Right');
await act(async () => ui.render(h(AdminNavigationPanel, {title: 'Standalone', items: [], onClose: () => {}, onItemChange: () => {}, defaultCollapsed: true})));
assert(button('Развернуть панель навигации')); await click(button('Развернуть панель навигации')); assert(button('Свернуть панель навигации'));
await act(async () => ui.unmount());
console.log('PASS: shared/standalone/controlled collapse, root and reopen persistence, hidden actions, icon navigation, accessible names and Escape tooltip, workspace remains mounted with its draft.');
})().catch(e => {console.error(e); process.exitCode = 1;}).finally(() => {fs.rmSync(scratch, {recursive: true, force: true}); dom.window.close();});
+28
View File
@@ -0,0 +1,28 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {TooltipTitles} from '../packages/ui-react/dist/tooltipTitles.js';
class Node {
constructor(attributes={},parentElement=null){this.attributes=new Map(Object.entries(attributes));this.parentElement=parentElement;this.textContent='';}
getAttribute(name){return this.attributes.get(name)??null;}
hasAttribute(name){return this.attributes.has(name);}
setAttribute(name,value){this.attributes.set(name,value);}
removeAttribute(name){this.attributes.delete(name);}
}
test('native titles are suppressed through ancestor chain and restored without a duplicate bubble',()=>{
const parent=new Node({title:'Parent'}),button=new Node({title:'Inspector','aria-label':'Inspector','aria-describedby':'help'},parent),svg=new Node({},button),titles=new TooltipTitles();
assert.deepEqual(titles.find(svg),{element:button,text:'Inspector'});titles.suppress(button);titles.describe(button,'tip');
assert.equal(button.getAttribute('title'),null);assert.equal(parent.getAttribute('title'),null);assert.equal(button.getAttribute('aria-describedby'),'help tip');
titles.restore();assert.equal(button.getAttribute('title'),'Inspector');assert.equal(parent.getAttribute('title'),'Parent');assert.equal(button.getAttribute('aria-label'),'Inspector');assert.equal(button.getAttribute('aria-describedby'),'help');
});
test('new titles and external ARIA changes survive cleanup; empty title blocks inherited hints',()=>{
const parent=new Node({title:'Parent'}),button=new Node({title:''},parent),titles=new TooltipTitles();assert.equal(titles.find(button),null);
button.setAttribute('title','Before');titles.suppress(button);titles.describe(button,'tip');assert.equal(button.getAttribute('aria-label'),'Before');
button.setAttribute('title','After');titles.suppress(button);button.setAttribute('aria-label','External');button.setAttribute('aria-describedby','tip extra');
titles.restore();assert.equal(button.getAttribute('title'),'After');assert.equal(button.getAttribute('aria-label'),'External');assert.equal(button.getAttribute('aria-describedby'),'extra');
});
test('SVG controls use the same tooltip channel without a native title element',()=>{
const control=new Node({'data-nodedc-tooltip':'Повернуть элемент'}),shape=new Node({},control),titles=new TooltipTitles();
assert.deepEqual(titles.find(shape),{element:control,text:'Повернуть элемент'});
titles.suppress(control);titles.describe(control,'tip');assert.equal(control.getAttribute('aria-label'),'Повернуть элемент');
titles.restore();assert.equal(control.getAttribute('data-nodedc-tooltip'),'Повернуть элемент');assert.equal(control.getAttribute('aria-label'),null);
});
+1 -1
View File
@@ -3157,7 +3157,7 @@ const server = createServer(async (request, response) => {
const gatewayReady = Boolean(mapGatewayInternalUrl);
const gaussianAssetId = String(process.env.CESIUM_GAUSSIAN_SPLAT_ASSET_ID || "").trim();
json(response, 200, {
cesiumVersion: "1.143.0",
cesiumVersion: "1.147.0",
provider: gatewayReady ? "nodedc-map-gateway" : "gateway-required",
ionReady: gatewayReady,
gatewayReady,