Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd08ac46f5 | ||
|
|
bcc121e7b2 | ||
|
|
13309f3209 | ||
|
|
d96eba824a | ||
|
|
6bf22988c5 | ||
|
|
3473cd9ef1 | ||
|
|
753d4d6edc | ||
|
|
533723883d | ||
|
|
8539a211ed | ||
|
|
872f01cd27 | ||
|
|
f4e7369eec | ||
|
|
f8aa8022f1 | ||
|
|
ae82c01049 |
@@ -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.4",
|
||||
"@nodedc/ui-react": "0.7.10",
|
||||
"cesium": "1.147.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0"
|
||||
},
|
||||
|
||||
@@ -57,6 +57,7 @@ import {
|
||||
ShareLinkModal,
|
||||
SplitPane,
|
||||
SortableItem,
|
||||
SortableList,
|
||||
SortableScope,
|
||||
SettingsCard,
|
||||
Switch,
|
||||
@@ -64,6 +65,7 @@ import {
|
||||
TextField,
|
||||
ToastCard,
|
||||
ToastStack,
|
||||
ToastObserver,
|
||||
Toolbar,
|
||||
NavigationCube,
|
||||
UserProfileMenu,
|
||||
@@ -235,7 +237,7 @@ const iconGroups: Array<{ title: string; note: string; icons: IconName[] }> = [
|
||||
{
|
||||
title: "Состояние и доступ",
|
||||
note: "Вся платформа",
|
||||
icons: ["check", "alert", "info", "info-plain", "activity", "lock", "key", "shield", "circle", "eye", "eye-off"],
|
||||
icons: ["check", "alert", "info", "info-plain", "activity", "lock", "unlock", "key", "shield", "circle", "eye", "eye-off", "star"],
|
||||
},
|
||||
{
|
||||
title: "Сущности",
|
||||
@@ -250,6 +252,7 @@ const iconGroups: Array<{ title: string; note: string; icons: IconName[] }> = [
|
||||
];
|
||||
|
||||
const iconLabels: Record<IconName, string> = {
|
||||
star: "Избранное",
|
||||
pipette: "Пипетка",
|
||||
ruler: "Линейка", section: "Секущая плоскость", isolate: "Изолировать элемент",
|
||||
power: "Питание",
|
||||
@@ -290,6 +293,7 @@ const iconLabels: Record<IconName, string> = {
|
||||
layers: "Слои",
|
||||
list: "Список задач",
|
||||
lock: "Закрыто",
|
||||
unlock: "Открыто",
|
||||
mail: "Приглашение",
|
||||
minimize: "Свернуть",
|
||||
network: "Связи",
|
||||
@@ -359,6 +363,7 @@ export function CatalogApp() {
|
||||
const [applicationSaveState, setApplicationSaveState] = useState<ApplicationDraftSaveState>("idle");
|
||||
const [applicationError, setApplicationError] = useState("");
|
||||
const [toasts, setToasts] = useState<ToastItem[]>([]);
|
||||
const [observedToasts, setObservedToasts] = useState<ToastItem[]>([]);
|
||||
const toastSequenceRef = useRef(0);
|
||||
const [sessionProfile, setSessionProfile] = useState<FoundrySessionProfile | null>(null);
|
||||
const [foundrySettingsOpen, setFoundrySettingsOpen] = useState(false);
|
||||
@@ -404,6 +409,9 @@ export function CatalogApp() {
|
||||
const [strokeColor, setStrokeColor] = useState("#2b2b36");
|
||||
const [strokeOpacity, setStrokeOpacity] = useState(100);
|
||||
const [treeDemoOpen,setTreeDemoOpen]=useState(false);
|
||||
const [gridOrder,setGridOrder]=useState(["Первое изображение","Второе изображение","Третье изображение"]);
|
||||
const [detailFloating,setDetailFloating]=useState(false);
|
||||
const [detailRect,setDetailRect]=useState<import("@nodedc/ui-react").WindowRect>();
|
||||
const [treeDemoRect,setTreeDemoRect]=useState({left:32,top:96,width:380,height:480});
|
||||
const [treeSelected,setTreeSelected]=useState<string|null>('cells');
|
||||
const [treeVisible,setTreeVisible]=useState(true);
|
||||
@@ -1466,6 +1474,7 @@ export function CatalogApp() {
|
||||
<div className="catalog-form">
|
||||
<TextField label="Название проекта" hint="обязательно" value={projectName} onChange={(event) => setProjectName(event.target.value)} />
|
||||
<TextAreaField label="Описание" value={notes} onChange={(event) => setNotes(event.target.value)} />
|
||||
<TextAreaField appearance="plain" label="" aria-label="Текст заметки" value={notes} onChange={(event) => setNotes(event.target.value)} />
|
||||
</div>
|
||||
</Preview>
|
||||
<Preview title="Действия" note="общая геометрия" className="catalog-preview--compact">
|
||||
@@ -1480,8 +1489,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>
|
||||
@@ -1545,6 +1556,7 @@ export function CatalogApp() {
|
||||
</ResourceList>
|
||||
<Button onClick={()=>setTreeDemoOpen(true)}>Дерево объектов · изменяемый размер</Button>
|
||||
<DragDropRoot onDragEnd={()=>{}}><DraggableItem id="whole-material-tile">{({activator})=><Button {...activator.attributes} {...activator.listeners}>Перенос за всю плитку</Button>}</DraggableItem></DragDropRoot>
|
||||
<SortableList handleSurface="control" layout="grid" className="catalog-sortable-grid" items={gridOrder} getId={item=>item} onReorder={setGridOrder}>{(item,{handle})=><GlassSurface padding="sm">{handle}<Icon name="image"/><Description>{item}</Description></GlassSurface>}</SortableList>
|
||||
<SettingsCard title="Устройства не обнаружены" description="Подключите устройство, чтобы оно появилось в списке." />
|
||||
<SettingsCard align="center" role="status" title="Настройки применены" description="Проверьте подключение устройства." />
|
||||
</Preview>
|
||||
@@ -1647,6 +1659,7 @@ export function CatalogApp() {
|
||||
eyebrow="MAP / SETTINGS"
|
||||
title="Настройки карты"
|
||||
description="Theme-aware application panel"
|
||||
headerActions={<IconButton label="Настройки панели" onClick={() => setInspectorOpen(true)}><Icon name="settings" /></IconButton>}
|
||||
onClose={() => setSidePanelDemoOpen(false)}
|
||||
>
|
||||
<Inspector variant="panel" sections={environmentSections.slice(0, 3).map(section=>({...section,action:{label:`Действие секции ${section.label}`,icon:<Icon name="edit"/>,onAction:()=>setInspectorOpen(true)}}))} defaultOpen={[environmentSections[0]?.id ?? ""]} singleOpen />
|
||||
@@ -1791,6 +1804,7 @@ export function CatalogApp() {
|
||||
</div>
|
||||
</SettingsCard>
|
||||
<SettingsCard eyebrow="LIVE STATES" title="Проверка стека" description="Кнопки используют тот же bottom-right viewport, что и реальные save/update flows.">
|
||||
<Description>Последняя передача приложению: {observedToasts.map(item => item.title).join(', ') || 'нет уведомлений'}</Description>
|
||||
<div className="catalog-inline catalog-inline--wrap">
|
||||
<Button onClick={() => pushToast("success", "Изменения сохранены", "Статус автоматически исчезнет.")}>Success</Button>
|
||||
<Button onClick={() => pushToast("info", "Профиль применён", "Application использует выбранную версию.")}>Info</Button>
|
||||
@@ -1856,6 +1870,8 @@ export function CatalogApp() {
|
||||
<div className="catalog-icon-catalog">
|
||||
<Preview title="Размеры и поверхности" note="glyph 16 px" className="catalog-preview--wide">
|
||||
<div className="catalog-window-actions-demo">
|
||||
<IconButton surface="none" label="В избранное" aria-pressed="false"><Icon name="star" /></IconButton>
|
||||
<IconButton surface="none" label="Убрать из избранного" aria-pressed="true"><Icon name="star" fill="currentColor" /></IconButton>
|
||||
<IconButton label="Камера включена" aria-pressed="true"><Icon name="camera" /></IconButton>
|
||||
<IconButton label="План"><Icon name="plan" /></IconButton>
|
||||
<IconButton label="Добавить"><Icon name="plus" /></IconButton>
|
||||
@@ -2192,6 +2208,7 @@ export function CatalogApp() {
|
||||
<UserProfileMenu
|
||||
triggerLabel="Профиль"
|
||||
triggerIcon="inbox"
|
||||
headerAction={{label: 'Правая панель', pressed: sidePanelDemoOpen, onSelect: () => setSidePanelDemoOpen(open => !open)}}
|
||||
displayName={sessionProfile?.user?.displayName || "Профиль"}
|
||||
subtitle={sessionProfile?.user?.email || "NODE.DC Foundry"}
|
||||
avatarUrl={sessionProfile?.user?.avatarUrl || undefined}
|
||||
@@ -2222,6 +2239,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" ? (
|
||||
@@ -2376,6 +2395,7 @@ export function CatalogApp() {
|
||||
) : null}
|
||||
|
||||
<Window open={treeDemoOpen} title="Объекты сцены" placement="end" resizable draggable rect={treeDemoRect} onRectCommit={setTreeDemoRect} onClose={()=>setTreeDemoOpen(false)}>
|
||||
<div className="nodedc-viewport-surface" data-glass-context="scene"><IconButton label="Проверить fullscreen внутри окна" onClick={event=>{const viewport=event.currentTarget.parentElement!;void (document.fullscreenElement===viewport?document.exitFullscreen():viewport.requestFullscreen());}}><Icon name="expand"/></IconButton><Description>Окно и дерево сохраняются при развороте этого viewport и возврате.</Description></div>
|
||||
<Tree defaultExpandedDepth={2} renderActions={node=><Dropdown width={320} trigger={({setTriggerRef,show,open})=><IconButton ref={setTriggerRef} label={`Информация: ${node.label}`} aria-expanded={open} onMouseEnter={show} onClick={show}><Icon name="info-plain" size={14}/></IconButton>}><Description>{node.label}</Description></Dropdown>} label="Пример дерева объектов: стрелка раскрывает, глазик меняет видимость без прокрутки" selected={treeSelected} selectedIds={treeSelectedIds} onSelect={(id,gesture)=>{setTreeSelected(id);setTreeSelectedIds(old=>gesture.shiftKey?gesture.rangeIds:gesture.metaKey?(old.includes(id)?old.filter(key=>key!==id):[...old,id]):gesture.ctrlKey?[...new Set([...old,id])]:[id]);}} onVisibilityChange={(_,visible)=>setTreeVisible(visible)} nodes={[{id:'scene',label:'Сцена',children:[{id:'model',label:'Модель',children:[{id:'cells',label:'Ячейки / внутренний блок',visible:treeVisible},{id:'panel',label:'Боковая панель корпуса / длинное название детали'}]}]}]}/>
|
||||
</Window>
|
||||
<Window
|
||||
@@ -2392,6 +2412,8 @@ export function CatalogApp() {
|
||||
|
||||
<Window
|
||||
open={createModuleOpen}
|
||||
floating={detailFloating} onFloatingChange={setDetailFloating}
|
||||
rect={detailRect} onRectCommit={setDetailRect}
|
||||
title="Создать модуль"
|
||||
headerActionsPlacement="before-close"
|
||||
headerActions={<IconButton label="Очистить форму" onClick={() => {setCreateModuleName("");setCreateModuleSlug("");}}><Icon name="trash"/></IconButton>}
|
||||
@@ -2489,7 +2511,7 @@ export function CatalogApp() {
|
||||
|
||||
<FoundrySettingsModal open={foundrySettingsOpen} isAdmin={isFoundryAdmin} onClose={() => setFoundrySettingsOpen(false)} />
|
||||
|
||||
<FeatureSettingsWindow open={featureSettingsDemoOpen} title="Настройки модуля" subtitle="Настройки и меню доступны также в полноэкранном просмотре"
|
||||
<FeatureSettingsWindow open={featureSettingsDemoOpen} title="Настройки модуля" subtitle="При откреплении окно использует стекло viewport; настройки доступны в полноэкранном просмотре"
|
||||
identity={{ title: 'Модуль', subtitle: 'Пример общего компонента', avatarLabel: 'DC' }}
|
||||
sections={[{ id: 'general', label: 'Основное', icon: 'settings' }, ...Array.from({length:16}, (_,i)=>({id:`details-${i}`,label:`Раздел ${i+1}`,group:'Сведения'}))]}
|
||||
activeSection={featureSettingsDemoSection} onSectionChange={setFeatureSettingsDemoSection}
|
||||
@@ -2628,7 +2650,9 @@ export function CatalogApp() {
|
||||
onClose={() => setConfirmOpen(false)}
|
||||
onConfirm={() => setConfirmOpen(false)}
|
||||
/>
|
||||
<ToastStack items={toasts} onDismiss={dismissToast} />
|
||||
<ToastObserver onPresent={setObservedToasts}>
|
||||
<ToastStack items={toasts} onDismiss={dismissToast} />
|
||||
</ToastObserver>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ export function EditorDockExample({inWindow=false}:{inWindow?:boolean}){
|
||||
return <>{!inWindow&&<><Button onClick={()=>setModal(true)}>Сцена в модальном окне</Button><Window open={modal} title="Просмотр сцены" onClose={()=>setModal(false)}><EditorDockExample inWindow/></Window></>}<Button onClick={()=>{setPurpose('edit');setOpen({objects:true,materials:true});setEditing(true);}}>Открыть редактор сцены</Button><Button onClick={()=>{setPurpose('view');setEditing(true);}}>Отдельное окно просмотра</Button><div style={{height:480}}>
|
||||
<EditorWorkspace editing={editing} purpose={purpose} title={purpose==='view'?'Просмотр сцены':'Редактор сцены'} subtitle="Общая оконная система" onBack={()=>setEditing(false)} headerActions={purpose==='view'?<Button onClick={()=>setOpen({objects:true,materials:true})}>Показать инструменты</Button>:undefined}>
|
||||
<EditorDockLayout value={layout} onChange={setLayout} enabled={editing} primary={<div style={{display:'grid',height:'100%',placeContent:'center'}}><Description>Закреплённая сцена · откреплённые инструменты используют scene Glass V4</Description><Button onClick={()=>setOpen({objects:true,materials:true})}>Показать инструменты</Button></div>}
|
||||
tools={[{id:'objects',title:'Объекты',label:'Объекты',open:open.objects,onClose:()=>setOpen(v=>({...v,objects:false})),content:<Description>Сцена → Модель → Детали</Description>},
|
||||
tools={[{id:'objects',title:'Объекты',label:'Объекты',open:open.objects,onClose:()=>setOpen(v=>({...v,objects:false})),content:<Description>Сцена → Модель → Детали. Захват шапки — без рамки; Tab и стрелки — клавиатурное управление.</Description>},
|
||||
{id:'materials',title:'Материалы',label:'Материалы',minimumSize:{width:380,height:280},footer:<Button width="full" onClick={()=>setColor('#292929')}>Сбросить настройки</Button>,open:open.materials,onClose:()=>setOpen(v=>({...v,materials:false})),content:<Inspector sections={[{id:"color",label:"Цвет без обводки и пипетка",content:<ControlRow label="Цвет"><ColorField label="Цвет материала" value={color} onChange={setColor}/></ControlRow>}]} defaultOpen={["color"]} header={<Description>Минимум 380 × 280. Пипетка берёт цвет с экрана после нажатия; Escape отменяет выбор. Нижняя кнопка не прокручивается.</Description>}/>}]}/>
|
||||
</EditorWorkspace>
|
||||
</div></>;
|
||||
|
||||
@@ -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>,
|
||||
);
|
||||
|
||||
|
||||
@@ -2307,3 +2307,5 @@ textarea {
|
||||
.catalog-theme-fields { display: grid; gap: var(--nodedc-space-4); }
|
||||
|
||||
.catalog-viewport-actions {position:absolute;top:var(--nodedc-space-3);right:var(--nodedc-space-3);display:flex;gap:var(--nodedc-space-2);padding:var(--nodedc-space-2);}
|
||||
|
||||
.catalog-sortable-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--nodedc-space-3,12px)}
|
||||
|
||||
@@ -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 самих контролов сохраняется.
|
||||
|
||||
+46
-1
@@ -46,7 +46,7 @@ Icon-only action по умолчанию круглый. Квадратная к
|
||||
|
||||
## Field
|
||||
|
||||
FieldFrame объединяет label, control, hint и description. `labelPlacement="below"` ставит компактную приглушённую подпись под контролом в заголовке; доступное имя контрола остаётся прежним. TextField/TextAreaField реализуют стандартные текстовые поля. Автозаполнение браузера сохраняет материал поля, цвет текста и каретки текущей темы; синяя системная заливка не используется. Клавиатурный фокус остаётся видимым.
|
||||
FieldFrame объединяет label, control, hint и description. `labelPlacement="below"` ставит компактную приглушённую подпись под контролом в заголовке; доступное имя контрола остаётся прежним. TextField/TextAreaField реализуют стандартные текстовые поля. `appearance="plain"` сохраняет вид обычного текста без подложки и позволяет сразу поставить каретку; при пустой подписи нужен `aria-label`. TextAreaField в этом режиме растёт по содержимому и ширине окна, нативные выделение, вставка и undo сохраняются. Автозаполнение браузера сохраняет материал поля, цвет текста и каретки текущей темы; синяя системная заливка не используется. Клавиатурный фокус остаётся видимым.
|
||||
|
||||
Приложение не должно вручную собирать label и input, если подходит Field. Ошибка и validation state будут расширением этого контракта, а не локальным классом приложения.
|
||||
|
||||
@@ -129,6 +129,8 @@ Window — единая механика открытия modal и правой
|
||||
|
||||
Содержание, сохранение и запросы принадлежат приложению.
|
||||
|
||||
Отсоединённое центральное окно автоматически получает `data-glass-context="scene"` и каноническое стекло viewport. Подтверждение несохранённого профиля использует `allowFloating={false}` и отдельные действия отмены, отказа и сохранения.
|
||||
|
||||
`WindowFooterActions` размещает группу действий справа, в том числе когда это единственная группа в footer. На узком экране действия переносятся внутри окна. Вспомогательный текст footer может оставаться слева.
|
||||
|
||||
Modeless Inspector закрывается независимо от результата автосохранения. Приложение сначала закрывает controlled `Window`, затем завершает сохранение асинхронно; сбой сообщает через компактный `ToastStack` с tone `error`, сохраняя draft текущего просмотра. Нельзя удерживать окно открытым, выводить внутри него browser-default `p`/heading или увеличивать текст ошибки до title-размера.
|
||||
@@ -294,6 +296,13 @@ setup-команды, сохранение, API и права принадлеж
|
||||
|
||||
## SettingsCard и Switch
|
||||
|
||||
В `UserProfileMenu` необязательный `headerAction={{label, onSelect}}` отделяет
|
||||
действие средней иконки от меню профиля. Аватар и текст профиля сохраняют меню.
|
||||
`ToastObserver onPresent` сообщает приложению новые и изменённые завершённые
|
||||
уведомления из вложенных `ToastStack`; хранение, даты и история принадлежат
|
||||
приложению. `ToastStack observe={false}` исключает повторную регистрацию
|
||||
сообщений, уже записанных сервером. Отображение и таймеры не изменяются.
|
||||
|
||||
`SettingsCard` фиксирует нейтральную структуру админской группы: eyebrow/title/description/actions/body. `Switch` покрывает компактное включение/видимость внутри таких групп. Данные секции, сохранение и права остаются в consumer.
|
||||
|
||||
Промежуточный loading-контейнер не должен обнулять вертикальный ритм тела
|
||||
@@ -320,8 +329,29 @@ 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
|
||||
|
||||
Перед кнопкой закрытия можно разместить действия через `headerActions`. Кнопка `UserProfileMenu.headerAction` принимает `pressed` и `controls` для связи с выдвижной панелью.
|
||||
|
||||
`ApplicationSidePanel` — правая application-level пара к `AdminNavigationPanel`.
|
||||
Она использует ту же ширину `332–352 px`, радиус, theme-aware surface, тень и
|
||||
круглые действия, но появляется справа налево. `ApplicationShell` размещает её
|
||||
@@ -432,6 +462,8 @@ StatusBadge `variant="indicator"` отображает только одну л
|
||||
|
||||
React `Window` (including `FeatureSettingsWindow`) and `Dropdown` (including Select and ColorField) mount into the active native fullscreen element, falling back to document.body. Menu geometry remains viewport-fixed. Consumers must let an open dialog/menu handle Escape before restoring the fullscreen viewer.
|
||||
|
||||
A window containing the fullscreen viewport keeps its original portal host and mounted content. Escape restores that viewport first; Tab stays within its visible controls. Newly opened child windows and menus still mount inside fullscreen.
|
||||
|
||||
### Scene window and accordion actions
|
||||
|
||||
`WorkspaceWindow resizeIndicator={false}` скрывает только видимый уголок. Размер по-прежнему меняется перетаскиванием правого нижнего угла или стрелками при фокусе на ручке; фокус остаётся видимым.
|
||||
@@ -549,6 +581,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; приложение владеет диапазонами и текстом, общий компонент — формой и взаимодействием.
|
||||
@@ -592,3 +626,14 @@ ColorField screen sampling (owner direction, 2026-11-14): the shared palette inc
|
||||
Floating EditorDockLayout tools honor minimumSize on restore, all eight resize edges and keyboard resize. If the available viewport is smaller, they fit that viewport; Inspector fields stack below a 330px content width instead of clipping. Tool footer is separate from the scrolling body; a Button width="full" is the canonical adaptive bottom action. The catalog's scene editor example demonstrates minimum size, a ColorField and fixed reset footer.
|
||||
|
||||
EditorDockLayout: every floating or actively detached tool uses context="scene" Glass V4 (shared scene tint/blur); docking removes that context and retains tiled surface/corner rules. Applies to hierarchy, layers, settings and any other editor tool. No application tint/blur overrides.
|
||||
|
||||
### Remembered detail windows and sortable image grids
|
||||
|
||||
`Window.floating/onFloatingChange` lets the host persist modal/floating mode by
|
||||
window kind alongside `rect/onRectCommit`. See WINDOWS_AND_LAYERS.md.
|
||||
`SortableList` and `SortableScope` accept `layout="grid"`; rectangular sorting
|
||||
keeps the shared drag handle and activation threshold. The default stays vertical.
|
||||
|
||||
Для ручки поверх фотографии используйте `DragHandle surface="control"` или `SortableList handleSurface="control"`: видимый круг с общим стеклом внутри `nodedc-viewport-controls`. Bare-ручка остаётся вариантом по умолчанию для обычных строк.
|
||||
|
||||
Window `headerLayout="adaptive"` keeps contextual actions on one trailing row. The complete title moves below actions before clipping. The measured action width sets the minimum for all resize edges, keyboard resizing and restored layout; only an undersized device viewport allows horizontal action scrolling. `expanded` temporarily opens media at a moderate viewport-fitted size while retaining modal/floating presentation. Users can resize the expanded window; restoration returns the previous geometry without changing the regular rectangle. `expandedRect` / `onExpandedRectCommit` persist the user’s separate expanded position and dimensions; first expansion uses a moderate 960×800 ceiling within 80%/82% of the viewport.
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# Favorites
|
||||
|
||||
Use the registered `star` icon in an IconButton with `aria-pressed`. The unset state is outline-only; the selected glyph uses `fill="currentColor"`. Keep the same hit target in both states. Place a card favorite action in its upper trailing corner, independent of opening the card. Persist the domain value at its owner; filtering favorites must not change it.
|
||||
|
||||
For a star without a surrounding disc, use `IconButton surface="none"`. The shared component owns the transparent surface and foreground; applications only position it. Keyboard focus and the hit target remain unchanged.
|
||||
@@ -55,3 +55,11 @@ hover, focus, disabled и pending принадлежат кнопке. `activity
|
||||
BIM controls use `ruler` (dimension line with extension lines/arrows), `section` (model intersected by a plane), `isolate` (temporary visibility/glasses), `perspective`/`orthographic` (projection cubes), and `fit-view` (frame extents). `info-plain` is an unframed i for compact tree actions next to the visibility eye; use 14 px for both glyphs. They share the canonical stroke and accessible control behavior.
|
||||
|
||||
Semantic references: [Revit measurement](https://help.autodesk.com/cloudhelp/2024/ENU/Revit-Model/files/GUID-65EA44EC-C777-4C97-8718-5783C3A80B0A.htm), [temporary hide/isolate](https://help.autodesk.com/cloudhelp/2014/ENU/Revit-LT/files/GUID-A5E51D5E-8E18-4834-8A2F-8B4E3E6379A1.htm), [section box](https://help.autodesk.com/cloudhelp/2024/ENU/Revit-GetStarted/files/GUID-C9EA51CB-3214-4BD8-AD55-3BEB1CCD15B6.htm). Glyphs are original monochrome NODE.DC vectors; this does not claim copied Autodesk artwork or full Section Box functionality.
|
||||
|
||||
|
||||
### Блокировка в дереве
|
||||
|
||||
`lock` / `unlock` показывают закрытый / открытый замок. Компактное действие
|
||||
дерева использует прозрачную кнопку без `aria-pressed` и без белой активной
|
||||
подложки; доступное имя описывает действие «Разблокировать» / «Заблокировать».
|
||||
Состояние передаётся формой замка. Уменьшение glyph не уменьшает область нажатия.
|
||||
|
||||
@@ -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`.
|
||||
@@ -95,3 +95,11 @@ height must not leave a visible head with its stem hidden below terrain.
|
||||
|
||||
Motion never recreates the Cesium viewer or any provider. A renderer teardown
|
||||
stops its single animation frame loop.
|
||||
|
||||
## Визуальные настройки и профили · 17.11.2026
|
||||
|
||||
`MapVisualSettings` дополнен необязательными полями `MapSceneEffects`: небо/солнце/луна, цвет света и тени, детализация рельефа, разрешение, FXAA, HDR/exposure/tonemapper, Bloom и HBAO. `DEFAULT_MAP_SCENE_EFFECTS` соответствует исходным значениям Cesium 1.147. Отсутствующие поля не меняют поведение других потребителей. Применение обновляет живую сцену; viewer, camera, providers, тайловые маршруты и доменные объекты не пересоздаются. HBAO включается только при поддержке графического контекста.
|
||||
|
||||
Для большого набора настроек используется `FeatureSettingsWindow`, слева разделы; контролы — `Checker`, `RangeControl` с exactValueBounds, `ColorField`, `Select`. Настройки спутниковой подложки не являются цветокоррекцией BIM/гауссов; OSM style не меняет их материалы. HDR exposure/tonemapper действует только при включённом HDR. Нативные API сверены с исходниками 1.147 и [Cesium PostProcessStageCollection](https://cesium.com/learn/cesiumjs/ref-doc/PostProcessStageCollection.html).
|
||||
|
||||
Профили сохраняет host через revision/atomic JSON. Снимок содержит только визуальные настройки и слои; не копирует камеру, размещение, токены, routing или cache intent. Применение профиля не меняет пространственный контекст. Выбор доступен в модалке и в стеклянном меню слоёв (`Dropdown surfaceClassName="nodedc-viewport-surface"`).
|
||||
|
||||
+19
-2
@@ -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.
|
||||
|
||||
@@ -17,3 +17,5 @@
|
||||
Миграция начинается с BIM-карты/viewer и Центра наблюдения. Общий action scope охватывает существующие scene/map/replay controls; оставшиеся собственные подложки переводятся на тот же surface contract. Не создавать глобальную непрозрачную плашку вокруг всех viewports.
|
||||
|
||||
Уточнение 15.11.2026: все откреплённые панели `EditorDockLayout` (иерархия, слои, настройки и другие инструменты) автоматически получают `data-glass-context="scene"`. Материал действует уже во время отрыва/перетаскивания и после восстановления плавающего положения. Повторная стыковка возвращает материал и наружные углы tiled-панелей. Приложение не задаёт свои tint/blur/opacity.
|
||||
|
||||
Уточнение 17.11.2026: `Dropdown surfaceClassName="nodedc-viewport-surface"` получает тот же scene Glass V4 на самой portal-поверхности. Это применяется к меню слоёв карт; не добавлять под ним непрозрачную карточку. Настройки большого объёма открываются через `FeatureSettingsWindow` с навигацией слева, а не через отдельный draggable inspector.
|
||||
|
||||
@@ -171,3 +171,17 @@ Tool minimumSize governs floating and docked geometry alike, including restored
|
||||
The primary scene owns an isolated stacking context so its toolbars stay behind floating tools. A tool outer shell clips without scrolling; only its body scrolls, keeping header/footer fixed even when a field receives focus.
|
||||
|
||||
ColorField spectrum has no decorative perimeter stroke; retain its visible sampling marker and keyboard focus. UserProfileMenu variant=header owns its HeaderProfile surface; consumers must not wrap it in another HeaderProfile.
|
||||
|
||||
## Focus of movable headers
|
||||
|
||||
Window, WorkspaceWindow and EditorDockLayout share the same drag-header focus contract. A pointer grab never inherits a keyboard focus ring or filled header from the previously focused input. Headers have no perimeter outline in any theme; keyboard focus uses the canonical contrasting surface. Pointer capture, focus ownership, Arrow/Shift+Arrow movement/resizing, Enter/Space docking and Escape cancellation remain unchanged. Check both direct grabbing and input → Tab → grabbing, in docked/floating and fullscreen contexts.
|
||||
|
||||
## Remembered presentation
|
||||
|
||||
Entity/detail windows persist presentation **by window kind**, not title or entity ID.
|
||||
The application stores `floating` and `rect` in its durable user preferences;
|
||||
`Window` consumes `floating`/`onFloatingChange` and `rect`/`onRectCommit`.
|
||||
Opening the next entity restores the same mode, position and size. Return to modal
|
||||
keeps the last floating rectangle for the next detachment. Viewport fitting does
|
||||
not overwrite saved geometry. Switching view/edit keeps the same mounted Window.
|
||||
Confirmation dialogs remain modal (`allowFloating=false`) and never inherit it.
|
||||
|
||||
Generated
+90
-58
@@ -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.4",
|
||||
"@nodedc/ui-react": "0.7.10",
|
||||
"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.4",
|
||||
"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.4",
|
||||
"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.4"
|
||||
}
|
||||
},
|
||||
"packages/ui-react": {
|
||||
"name": "@nodedc/ui-react",
|
||||
"version": "0.7.0",
|
||||
"version": "0.7.10",
|
||||
"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.4",
|
||||
"lucide-react": "^0.468.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
+4
-3
@@ -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"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nodedc/map-cesium-react",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.4",
|
||||
"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"
|
||||
|
||||
@@ -15,6 +15,7 @@ import type {
|
||||
MapProviderId,
|
||||
MapRuntimeState,
|
||||
} from "./contracts.js";
|
||||
import {applyMapSceneEffects} from "./sceneEffects.js";
|
||||
import { advanceGhostPins } from "./ghostPins.js";
|
||||
import {
|
||||
parseProviderEndpoint,
|
||||
@@ -60,10 +61,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 +120,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 +196,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 +272,7 @@ export const CesiumMapRenderer = forwardRef<
|
||||
return () => {
|
||||
disposed = true;
|
||||
abortController.abort();
|
||||
try { disposeConsumer?.(); } finally {
|
||||
removeCameraListener?.();
|
||||
removeRenderListener?.();
|
||||
runtimeRef.current?.stopGhostPinAnimation?.();
|
||||
@@ -272,6 +280,7 @@ export const CesiumMapRenderer = forwardRef<
|
||||
viewer?.destroy();
|
||||
viewer = null;
|
||||
container.replaceChildren();
|
||||
}
|
||||
};
|
||||
}, [
|
||||
runtimeConfigUrl,
|
||||
@@ -487,7 +496,9 @@ function applyPresentation(
|
||||
buildings.maximumScreenSpaceError =
|
||||
settings.buildings_maximum_screen_space_error;
|
||||
buildings.style = new Cesium.Cesium3DTileStyle({
|
||||
color: `color('${settings.buildings_color}', ${settings.buildings_opacity})`,
|
||||
color: settings.buildings_style_default
|
||||
? `Boolean(\${feature['cesium#color']}) ? color(\${feature['cesium#color']}, ${settings.buildings_opacity}) : color('#ffffff', ${settings.buildings_opacity})`
|
||||
: `color('${settings.buildings_color}', ${settings.buildings_opacity})`,
|
||||
});
|
||||
}
|
||||
runtime.ghostPins.show = layers.targets;
|
||||
@@ -533,9 +544,9 @@ function applyPresentation(
|
||||
}
|
||||
viewer.shadows = settings.shadows_enabled;
|
||||
const sunDate = Cesium.JulianDate.toDate(Cesium.JulianDate.now());
|
||||
sunDate.setUTCHours(
|
||||
clamp(Math.round(settings.sun_hour), 0, 24),
|
||||
0,
|
||||
if (!settings.sun_time_current) sunDate.setUTCHours(
|
||||
Math.floor(clamp(settings.sun_hour, 0, 24)),
|
||||
Math.round((settings.sun_hour % 1) * 60),
|
||||
0,
|
||||
0,
|
||||
);
|
||||
@@ -548,6 +559,7 @@ function applyPresentation(
|
||||
2,
|
||||
);
|
||||
viewer.scene.light = sun;
|
||||
applyMapSceneEffects(runtime, settings);
|
||||
viewer.scene.requestRender();
|
||||
}
|
||||
|
||||
|
||||
@@ -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";
|
||||
@@ -111,7 +112,7 @@ export type MapLayerVisibility = {
|
||||
targets: boolean;
|
||||
};
|
||||
|
||||
export type MapVisualSettings = {
|
||||
export type MapVisualSettings = Partial<MapSceneEffects> & {
|
||||
atmosphere_enabled: boolean;
|
||||
atmosphere_hue: number;
|
||||
atmosphere_saturation: number;
|
||||
@@ -119,6 +120,7 @@ export type MapVisualSettings = {
|
||||
fog_enabled: boolean;
|
||||
fog_density: number;
|
||||
sun_enabled: boolean;
|
||||
sun_time_current?: boolean;
|
||||
sun_hour: number;
|
||||
sun_intensity: number;
|
||||
shadows_enabled: boolean;
|
||||
@@ -133,6 +135,7 @@ export type MapVisualSettings = {
|
||||
globe_color: string;
|
||||
background_color: string;
|
||||
terrain_exaggeration: number;
|
||||
buildings_style_default?: boolean;
|
||||
buildings_color: string;
|
||||
buildings_opacity: number;
|
||||
buildings_maximum_screen_space_error: number;
|
||||
@@ -154,12 +157,47 @@ export type MapVisualSettings = {
|
||||
camera_animation_enabled: boolean;
|
||||
};
|
||||
|
||||
/** Optional controls preserve presentation in existing hosts until explicitly supplied. */
|
||||
export type MapSceneEffects = {
|
||||
skybox_enabled: boolean;
|
||||
sun_visible: boolean;
|
||||
moon_visible: boolean;
|
||||
ground_atmosphere_enabled: boolean;
|
||||
sun_color: string;
|
||||
shadow_darkness: number;
|
||||
shadow_soft: boolean;
|
||||
terrain_maximum_screen_space_error: number;
|
||||
resolution_scale: number;
|
||||
fxaa_enabled: boolean;
|
||||
hdr_enabled: boolean;
|
||||
exposure: number;
|
||||
tonemapper: "PBR_NEUTRAL" | "ACES" | "FILMIC" | "REINHARD" | "MODIFIED_REINHARD";
|
||||
bloom_enabled: boolean;
|
||||
bloom_contrast: number;
|
||||
bloom_brightness: number;
|
||||
bloom_sigma: number;
|
||||
bloom_step_size: number;
|
||||
ao_enabled: boolean;
|
||||
ao_intensity: number;
|
||||
ao_bias: number;
|
||||
ao_length_cap: number;
|
||||
};
|
||||
|
||||
export type MapCacheIntent = {
|
||||
enabled: boolean;
|
||||
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;
|
||||
|
||||
@@ -7,6 +7,7 @@ export {
|
||||
export type {
|
||||
CesiumMapRendererHandle,
|
||||
CesiumMapRendererProps,
|
||||
MapSceneContext,
|
||||
MapCacheIntent,
|
||||
MapCamera,
|
||||
MapGeoPoint,
|
||||
@@ -22,6 +23,7 @@ export type {
|
||||
MapRuntimeConfiguration,
|
||||
MapRuntimeState,
|
||||
MapVisualSettings,
|
||||
MapSceneEffects,
|
||||
} from "./contracts.js";
|
||||
export {
|
||||
advanceGhostPins,
|
||||
@@ -37,3 +39,5 @@ export {
|
||||
readSafeErrorCode,
|
||||
withProviderState,
|
||||
} from "./runtime.js";
|
||||
|
||||
export {DEFAULT_MAP_SCENE_EFFECTS} from "./sceneEffects.js";
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
import type {MapSceneContext, MapSceneEffects, MapVisualSettings} from './contracts.js';
|
||||
|
||||
/** Native Cesium 1.147 defaults; adding a settings window does not change the scene. */
|
||||
export const DEFAULT_MAP_SCENE_EFFECTS: Readonly<MapSceneEffects> = Object.freeze({
|
||||
skybox_enabled:true, sun_visible:true, moon_visible:true, ground_atmosphere_enabled:true,
|
||||
sun_color:'#ffffff', shadow_darkness:0.3, shadow_soft:false,
|
||||
terrain_maximum_screen_space_error:2, resolution_scale:1, fxaa_enabled:false,
|
||||
hdr_enabled:false, exposure:1, tonemapper:'PBR_NEUTRAL',
|
||||
bloom_enabled:false, bloom_contrast:128, bloom_brightness:-0.3, bloom_sigma:2, bloom_step_size:1,
|
||||
ao_enabled:false, ao_intensity:3, ao_bias:0.1, ao_length_cap:0.26,
|
||||
});
|
||||
|
||||
/** Mutates visual properties only: never touches sources, camera, cache or domain objects. */
|
||||
export function applyMapSceneEffects({Cesium,viewer}:Pick<MapSceneContext,'Cesium'|'viewer'>,s:MapVisualSettings):void {
|
||||
const scene=viewer.scene, stages=scene.postProcessStages;
|
||||
if(s.skybox_enabled!==undefined && scene.skyBox)scene.skyBox.show=s.skybox_enabled;
|
||||
if(s.sun_visible!==undefined && scene.sun)scene.sun.show=s.sun_visible;
|
||||
if(s.moon_visible!==undefined && scene.moon)scene.moon.show=s.moon_visible;
|
||||
if(s.ground_atmosphere_enabled!==undefined)scene.globe.showGroundAtmosphere=s.ground_atmosphere_enabled;
|
||||
if(s.sun_color!==undefined)scene.light.color=Cesium.Color.fromCssColorString(s.sun_color)??Cesium.Color.WHITE;
|
||||
if(s.shadow_darkness!==undefined)viewer.shadowMap.darkness=s.shadow_darkness;
|
||||
if(s.shadow_soft!==undefined)viewer.shadowMap.softShadows=s.shadow_soft;
|
||||
if(s.terrain_maximum_screen_space_error!==undefined)scene.globe.maximumScreenSpaceError=s.terrain_maximum_screen_space_error;
|
||||
if(s.resolution_scale!==undefined)viewer.resolutionScale=s.resolution_scale;
|
||||
if(s.fxaa_enabled!==undefined)stages.fxaa.enabled=s.fxaa_enabled;
|
||||
if(s.hdr_enabled!==undefined)scene.highDynamicRange=s.hdr_enabled;
|
||||
if(s.exposure!==undefined)stages.exposure=s.exposure;
|
||||
if(s.tonemapper!==undefined)stages.tonemapper=Cesium.Tonemapper[s.tonemapper];
|
||||
if(s.bloom_enabled!==undefined)stages.bloom.enabled=s.bloom_enabled;
|
||||
if(s.bloom_contrast!==undefined)stages.bloom.uniforms.contrast=s.bloom_contrast;
|
||||
if(s.bloom_brightness!==undefined)stages.bloom.uniforms.brightness=s.bloom_brightness;
|
||||
if(s.bloom_sigma!==undefined)stages.bloom.uniforms.sigma=s.bloom_sigma;
|
||||
if(s.bloom_step_size!==undefined)stages.bloom.uniforms.stepSize=s.bloom_step_size;
|
||||
if(s.ao_enabled!==undefined)stages.ambientOcclusion.enabled=s.ao_enabled && Cesium.PostProcessStageLibrary.isAmbientOcclusionSupported(scene);
|
||||
if(s.ao_intensity!==undefined)stages.ambientOcclusion.uniforms.intensity=s.ao_intensity;
|
||||
if(s.ao_bias!==undefined)stages.ambientOcclusion.uniforms.bias=s.ao_bias;
|
||||
if(s.ao_length_cap!==undefined)stages.ambientOcclusion.uniforms.lengthCap=s.ao_length_cap;
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {applyMapSceneEffects,DEFAULT_MAP_SCENE_EFFECTS} from '../dist/sceneEffects.js';
|
||||
|
||||
function context(supported=true){
|
||||
const viewer={resolutionScale:1,shadowMap:{},scene:{skyBox:{},sun:{},moon:{},globe:{},light:{},postProcessStages:{fxaa:{},bloom:{uniforms:{}},ambientOcclusion:{uniforms:{}}}}};
|
||||
const Cesium={Color:{fromCssColorString:value=>value,WHITE:'white'},Tonemapper:{ACES:'ACES',PBR_NEUTRAL:'PBR_NEUTRAL'},PostProcessStageLibrary:{isAmbientOcclusionSupported:()=>supported}};
|
||||
return {viewer,Cesium};
|
||||
}
|
||||
test('optional effects leave legacy consumers unchanged',()=>{
|
||||
const c=context(),before=structuredClone(c.viewer);applyMapSceneEffects(c,{});assert.deepEqual(c.viewer,before);
|
||||
});
|
||||
test('effects apply live and reset without changing camera or providers',()=>{
|
||||
const c=context();c.viewer.camera={position:'unchanged'};c.viewer.terrainProvider={id:'cache'};
|
||||
applyMapSceneEffects(c,{...DEFAULT_MAP_SCENE_EFFECTS,bloom_enabled:true,bloom_contrast:64,hdr_enabled:true,exposure:2,tonemapper:'ACES',ao_enabled:true,ao_intensity:6,sun_visible:false,resolution_scale:.7});
|
||||
const {scene}=c.viewer;
|
||||
assert.equal(scene.postProcessStages.bloom.enabled,true);assert.equal(scene.postProcessStages.bloom.uniforms.contrast,64);
|
||||
assert.equal(scene.postProcessStages.ambientOcclusion.uniforms.intensity,6);assert.equal(scene.postProcessStages.ambientOcclusion.enabled,true);
|
||||
assert.equal(scene.highDynamicRange,true);assert.equal(scene.postProcessStages.exposure,2);assert.equal(scene.postProcessStages.tonemapper,'ACES');
|
||||
assert.equal(scene.sun.show,false);assert.equal(c.viewer.resolutionScale,.7);
|
||||
applyMapSceneEffects(c,DEFAULT_MAP_SCENE_EFFECTS);
|
||||
assert.equal(scene.postProcessStages.bloom.enabled,false);assert.equal(scene.highDynamicRange,false);assert.equal(scene.sun.show,true);
|
||||
assert.deepEqual(c.viewer.camera,{position:'unchanged'});assert.deepEqual(c.viewer.terrainProvider,{id:'cache'});
|
||||
});
|
||||
test('unsupported ambient occlusion stays off',()=>{
|
||||
const c=context(false);applyMapSceneEffects(c,{ao_enabled:true});assert.equal(c.viewer.scene.postProcessStages.ambientOcclusion.enabled,false);
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nodedc/ui-core",
|
||||
"version": "0.7.0",
|
||||
"version": "0.7.4",
|
||||
"type": "module",
|
||||
"files": [
|
||||
"dist",
|
||||
|
||||
+155
-12
@@ -364,7 +364,8 @@
|
||||
color: var(--nodedc-text-primary);
|
||||
}
|
||||
|
||||
.nodedc-icon-button[aria-pressed="true"] {
|
||||
.nodedc-icon-button[aria-pressed="true"],
|
||||
.nodedc-header__profile .nodedc-icon-button[aria-pressed="true"] {
|
||||
background: var(--nodedc-glass-control-active);
|
||||
color: var(--nodedc-glass-control-active-text);
|
||||
}
|
||||
@@ -1570,14 +1571,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,18 +1620,21 @@ 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 {
|
||||
right: var(--nodedc-app-page-pad);
|
||||
width: var(--nodedc-app-nav-width);
|
||||
transform: translateX(calc(100% + var(--nodedc-app-page-pad)));
|
||||
transition: transform var(--nodedc-app-navigation-motion), visibility 0s linear 440ms;
|
||||
visibility: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
@@ -1634,6 +1645,8 @@ textarea.nodedc-field__control {
|
||||
}
|
||||
|
||||
.nodedc-app-shell[data-end-panel-open="true"] .nodedc-app-shell__end-panel {
|
||||
transform: translateX(0);
|
||||
transition-delay: 0s;
|
||||
visibility: visible;
|
||||
pointer-events: auto;
|
||||
}
|
||||
@@ -1643,12 +1656,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 +2143,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 +2180,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;
|
||||
}
|
||||
@@ -2928,7 +3007,7 @@ textarea.nodedc-field__control {
|
||||
|
||||
.nodedc-workspace-window__head:focus-visible {
|
||||
background: var(--nodedc-focus-surface);
|
||||
box-shadow: inset 0 0 0 1px rgb(var(--nodedc-accent-rgb) / 0.22);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.nodedc-workspace-window[data-maximized="true"] .nodedc-workspace-window__head {
|
||||
@@ -3876,6 +3955,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;
|
||||
@@ -4558,7 +4642,7 @@ textarea.nodedc-field__control {
|
||||
.nodedc-editor-dock :is(.nodedc-editor-dock__tool,.nodedc-editor-dock__primary)[data-dock-corners~="bottom-left"] {border-bottom-left-radius:var(--nodedc-radius-panel);}
|
||||
.nodedc-editor-dock__tool>.nodedc-window__head {flex:none;cursor:grab;touch-action:none;user-select:none;}
|
||||
.nodedc-editor-dock__tool>.nodedc-window__head:active {cursor:grabbing;}
|
||||
.nodedc-editor-dock__tool>.nodedc-window__head:focus-visible {outline:2px solid var(--nodedc-text-primary);outline-offset:-3px;}
|
||||
|
||||
.nodedc-editor-dock__tool>.nodedc-window__head:focus-visible :is(.nodedc-window__title,.nodedc-window__subtitle,.nodedc-window__actions,.nodedc-window__close,.nodedc-icon-button) {color:inherit;}
|
||||
.nodedc-editor-dock__body {flex:1;min-height:0;min-width:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;padding:0 var(--nodedc-space-3) var(--nodedc-space-3);}
|
||||
.nodedc-editor-dock__tool .nodedc-inspector {width:100%;max-width:none;}
|
||||
@@ -4705,8 +4789,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);
|
||||
}
|
||||
@@ -4746,6 +4833,7 @@ textarea.nodedc-field__control {
|
||||
The DOM surface class is for existing semantic overlays, never the renderer. */
|
||||
.nodedc-toolbar-wrap[data-scope="viewport"] .nodedc-toolbar__button:not([data-active="true"]),
|
||||
.nodedc-viewport-surface[data-glass-context="scene"],
|
||||
.nodedc-dropdown-surface.nodedc-viewport-surface,
|
||||
:is(.nodedc-viewport-controls, .nodedc-scene-controls) :is(.nodedc-icon-button:not([aria-pressed="true"]), .nodedc-button:is([data-variant="secondary"], [data-variant="ghost"]):not([aria-pressed="true"]), .nodedc-select__toggle, .nodedc-segmented, .nodedc-workspace-window__action:not([aria-pressed="true"])) {
|
||||
background: rgb(var(--nodedc-modal-glass-tint-rgb) / var(--nodedc-scene-glass-opacity));
|
||||
color: var(--nodedc-text-primary);
|
||||
@@ -4776,3 +4864,58 @@ textarea.nodedc-field__control {
|
||||
.nodedc-range[data-variant="rail"] input[type="range"] { top: 50%; height: max(100%, 24px); transform: translateY(-50%); }
|
||||
.nodedc-range-rail:has(input:focus-visible) .nodedc-range-rail__value { text-decoration: underline; text-underline-offset: 2px; }
|
||||
.nodedc-range-rail[data-disabled] { opacity: var(--nodedc-disabled-opacity, 0.5); }
|
||||
|
||||
/* Shared move handles: no browser perimeter or pointer-inherited focus flash.
|
||||
Keyboard navigation retains the canonical focus surface in every window. */
|
||||
:is(.nodedc-window__head, .nodedc-workspace-window__head)[tabindex] {
|
||||
outline: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
:is(.nodedc-window__head, .nodedc-workspace-window__head)[tabindex]:focus-visible {
|
||||
outline: 0;
|
||||
box-shadow: none;
|
||||
background: var(--nodedc-focus-surface);
|
||||
}
|
||||
[data-nodedc-edges="flat"] :is(.nodedc-window__head, .nodedc-workspace-window__head)[tabindex]:focus-visible {
|
||||
background: var(--nodedc-text-primary);
|
||||
color: var(--nodedc-canvas);
|
||||
}
|
||||
:is(.nodedc-window__head, .nodedc-workspace-window__head)[tabindex]:focus-visible :is(.nodedc-window__title, .nodedc-window__subtitle, .nodedc-workspace-window__title, .nodedc-workspace-window__subtitle) {
|
||||
color: inherit;
|
||||
}
|
||||
[data-nodedc-edges] :is(.nodedc-window__head, .nodedc-workspace-window__head)[tabindex][data-pointer-focus="true"],
|
||||
:is(.nodedc-window__head, .nodedc-workspace-window__head)[tabindex][data-pointer-focus="true"] {
|
||||
outline: 0;
|
||||
box-shadow: none;
|
||||
background: transparent;
|
||||
color: var(--nodedc-text-primary);
|
||||
}
|
||||
|
||||
/* Directly editable detail copy: no permanent field plate. */
|
||||
.nodedc-field--unlabelled > .nodedc-field__label-row {display:none;}
|
||||
.nodedc-field--plain {gap:0;}
|
||||
.nodedc-field--plain .nodedc-field__control {
|
||||
min-height:0; padding:0; border-radius:var(--nodedc-radius-control-compact);
|
||||
background:transparent; box-shadow:none; color:inherit; font:inherit; line-height:inherit;
|
||||
}
|
||||
.nodedc-field--plain .nodedc-field__control:focus-visible {background:var(--nodedc-focus-surface);}
|
||||
.nodedc-field--plain textarea.nodedc-field__control {resize:none;overflow:hidden;}
|
||||
.nodedc-drag-handle[data-surface="control"] {background:var(--nodedc-glass-control-bg);color:var(--nodedc-text-primary);}
|
||||
:is(.nodedc-viewport-controls,.nodedc-scene-controls) .nodedc-drag-handle[data-surface="control"] {
|
||||
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));
|
||||
}
|
||||
.nodedc-drag-handle[data-surface="control"]:hover {background:var(--nodedc-glass-control-hover);}
|
||||
|
||||
/* An adaptive action row defines the minimum resizable width. */
|
||||
.nodedc-window[data-header-layout="adaptive"]>.nodedc-window__head>.nodedc-window__actions{flex-wrap:nowrap;width:max-content;max-width:100%;justify-self:end;overflow-x:auto}
|
||||
.nodedc-window[data-header-stacked="true"]>.nodedc-window__head{grid-template-columns:minmax(0,1fr)}
|
||||
.nodedc-window[data-header-stacked="true"]>.nodedc-window__head>.nodedc-window__actions{grid-row:1}
|
||||
.nodedc-window[data-header-stacked="true"]>.nodedc-window__head>.nodedc-window__titles{grid-row:2}
|
||||
|
||||
.nodedc-window[data-header-layout="adaptive"]>.nodedc-window__head>.nodedc-window__actions>*{flex-shrink:0}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.nodedc-app-shell__end-panel { transition: none; }
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@
|
||||
"typecheck": "tsc -p tsconfig.json --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nodedc/ui-core": "0.7.0"
|
||||
"@nodedc/ui-core": "0.7.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nodedc/ui-react",
|
||||
"version": "0.7.0",
|
||||
"version": "0.7.10",
|
||||
"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.4",
|
||||
"lucide-react": "^0.468.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface ApplicationSidePanelProps extends Omit<HTMLAttributes<HTMLEleme
|
||||
title: ReactNode;
|
||||
description?: ReactNode;
|
||||
closeLabel?: string;
|
||||
headerActions?: ReactNode;
|
||||
footer?: ReactNode;
|
||||
onClose: () => void;
|
||||
children: ReactNode;
|
||||
@@ -23,6 +24,7 @@ export function ApplicationSidePanel({
|
||||
title,
|
||||
description,
|
||||
closeLabel = "Закрыть панель",
|
||||
headerActions,
|
||||
footer,
|
||||
onClose,
|
||||
children,
|
||||
@@ -42,6 +44,7 @@ export function ApplicationSidePanel({
|
||||
{description ? <span className="nodedc-application-side-panel__description">{description}</span> : null}
|
||||
</div>
|
||||
<div className="nodedc-admin-panel__head-actions">
|
||||
{headerActions}
|
||||
<button type="button" className="nodedc-admin-panel__close" aria-label={closeLabel} onClick={onClose}>
|
||||
<Icon name="close" size={16} strokeWidth={1.6} />
|
||||
</button>
|
||||
|
||||
@@ -65,12 +65,16 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button
|
||||
export interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
label: string;
|
||||
shape?: "circle" | "rounded";
|
||||
/** Glyph-only action; keeps the normal hit target and keyboard focus. */
|
||||
surface?: "default" | "none";
|
||||
loading?: boolean;
|
||||
}
|
||||
|
||||
export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton({
|
||||
label,
|
||||
shape = "circle",
|
||||
surface = "default",
|
||||
style,
|
||||
className,
|
||||
children,
|
||||
type = "button",
|
||||
@@ -84,6 +88,7 @@ export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(functio
|
||||
type={type}
|
||||
className={cn("nodedc-icon-button", className)}
|
||||
data-shape={shape === "circle" ? undefined : shape}
|
||||
style={surface === "none" ? { ...style, background: "transparent", boxShadow: "none", color: "var(--nodedc-text-primary)" } : style}
|
||||
aria-label={label}
|
||||
title={label}
|
||||
{...props}
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
arrayMove,
|
||||
useSortable,
|
||||
verticalListSortingStrategy,
|
||||
rectSortingStrategy,
|
||||
} from "@dnd-kit/sortable";
|
||||
import { CSS } from "@dnd-kit/utilities";
|
||||
import { cn } from "./cn.js";
|
||||
@@ -51,8 +52,9 @@ const copyRect = (rect: DragRect | null | undefined): DragRect | undefined => re
|
||||
height: rect.height,
|
||||
}) : undefined;
|
||||
|
||||
export function DragHandle({ label = "Перетащить", listeners, attributes, className }: {
|
||||
export function DragHandle({ label = "Перетащить", listeners, attributes, className, surface="none" }: {
|
||||
label?: string;
|
||||
surface?: "none" | "control";
|
||||
listeners?: ReturnType<typeof useDraggable>["listeners"];
|
||||
attributes?: ReturnType<typeof useDraggable>["attributes"];
|
||||
className?: string;
|
||||
@@ -61,6 +63,7 @@ export function DragHandle({ label = "Перетащить", listeners, attribut
|
||||
<button
|
||||
type="button"
|
||||
className={cn("nodedc-drag-handle", className)}
|
||||
data-surface={surface}
|
||||
aria-label={label}
|
||||
{...attributes}
|
||||
{...listeners}
|
||||
@@ -120,31 +123,36 @@ export function DropZone({ id, data, className, children }: { id: string; data?:
|
||||
return <div ref={setNodeRef} className={cn(className, isOver && "is-drag-over")}>{children}</div>;
|
||||
}
|
||||
|
||||
export function SortableScope({ ids, children }: { ids: string[]; children: ReactNode }) {
|
||||
return <SortableContext items={ids} strategy={verticalListSortingStrategy}>{children}</SortableContext>;
|
||||
const SortableLayoutContext=createContext<"list"|"grid">("list");
|
||||
export function SortableScope({ ids, children, layout="list" }: { ids: string[]; children: ReactNode; layout?:"list"|"grid" }) {
|
||||
return <SortableLayoutContext.Provider value={layout}><SortableContext items={ids} strategy={layout==="grid"?rectSortingStrategy:verticalListSortingStrategy}>{children}</SortableContext></SortableLayoutContext.Provider>;
|
||||
}
|
||||
|
||||
export function SortableItem({ id, data, className, children }: {
|
||||
export function SortableItem({ id, data, className, children, handleSurface="none" }: {
|
||||
id: string;
|
||||
handleSurface?: "none" | "control";
|
||||
data?: NodedcDragData;
|
||||
className?: string;
|
||||
children: (state: { handle: ReactNode; isDragging: boolean }) => ReactNode;
|
||||
}) {
|
||||
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id, data });
|
||||
const verticalTransform = transform ? { ...transform, x: 0 } : null;
|
||||
const layout=useContext(SortableLayoutContext);
|
||||
const verticalTransform = transform && layout!=="grid" ? { ...transform, x: 0 } : transform;
|
||||
return (
|
||||
<div
|
||||
ref={setNodeRef}
|
||||
className={cn(className, isDragging && "is-dragging")}
|
||||
style={{ transform: CSS.Transform.toString(verticalTransform), transition, opacity: isDragging ? 0.65 : undefined }}
|
||||
>
|
||||
{children({ handle: <DragHandle listeners={listeners} attributes={attributes} />, isDragging })}
|
||||
{children({ handle: <DragHandle surface={handleSurface} listeners={listeners} attributes={attributes} />, isDragging })}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function SortableList<T>({ items, getId, className, onReorder, children }: {
|
||||
export function SortableList<T>({ items, getId, className, onReorder, children, layout="list", handleSurface="none" }: {
|
||||
items: T[];
|
||||
handleSurface?: "none" | "control";
|
||||
layout?: "list" | "grid";
|
||||
getId: (item: T) => string;
|
||||
className?: string;
|
||||
onReorder: (items: T[]) => void;
|
||||
@@ -158,10 +166,10 @@ export function SortableList<T>({ items, getId, className, onReorder, children }
|
||||
const to = ids.indexOf(overId);
|
||||
if (from >= 0 && to >= 0) onReorder(arrayMove(items, from, to));
|
||||
}}>
|
||||
<SortableScope ids={ids}>
|
||||
<SortableScope ids={ids} layout={layout}>
|
||||
<div className={className}>
|
||||
{items.map((item) => (
|
||||
<SortableItem key={getId(item)} id={getId(item)}>
|
||||
<SortableItem key={getId(item)} id={getId(item)} handleSurface={handleSurface}>
|
||||
{(state) => children(item, state)}
|
||||
</SortableItem>
|
||||
))}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import {dragHandleFocus} from './dragHandleFocus.js';
|
||||
import {useEffect,useLayoutEffect,useRef,useState,type KeyboardEvent,type PointerEvent,type ReactNode} from 'react';
|
||||
import {constrainDockTree,dockIds,dockMinimum,dockRects,dockEditorTool,editorDockTarget,mergeEditorDockRatios,pruneDockTree,resizeDockSplit,type DockMinimum,type DockMove,type DockRect,type DockTree,type EditorDockState} from '@nodedc/ui-core';
|
||||
import {IconButton} from './Button.js';
|
||||
@@ -105,7 +106,7 @@ export function EditorDockLayout({value,onChange,primary,primaryId='viewport',pr
|
||||
return <div key={tool.id} className={cn('nodedc-editor-dock__tool nodedc-glass-material nodedc-ui-root',tool.className)} data-editor-tool={tool.id} data-floating={free||undefined} data-glass-context={free?'scene':undefined} data-dock-corners={free?undefined:editorDockCorners(rect,area)} data-active={order.at(-1)===tool.id||undefined}
|
||||
role="region" aria-label={tool.label} hidden={!enabled||!tool.open} style={{...rect,zIndex:moving?40:free?10+Math.max(0,order.indexOf(tool.id)):1}}
|
||||
onPointerDownCapture={()=>activate(tool.id)} onFocusCapture={()=>activate(tool.id)}>
|
||||
<header className="nodedc-window__head" tabIndex={0} aria-label={`Переместить · ${tool.label}`} aria-roledescription="Перемещаемая панель" onPointerDown={e=>begin(tool.id,e)} onKeyDown={e=>key(tool.id,e)}>
|
||||
<header {...dragHandleFocus} className="nodedc-window__head" tabIndex={0} aria-label={`Переместить · ${tool.label}`} aria-roledescription="Перемещаемая панель" onPointerDown={e=>begin(tool.id,e)} onKeyDown={e=>key(tool.id,e)}>
|
||||
<div className="nodedc-window__titles"><h2 className="nodedc-window__title">{tool.title}</h2>{tool.subtitle&&<p className="nodedc-window__subtitle">{tool.subtitle}</p>}</div>
|
||||
<div className="nodedc-window__actions">{tool.actions}<IconButton label={`Закрыть · ${tool.label}`} onClick={tool.onClose}><Icon name="close"/></IconButton></div>
|
||||
</header>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useId, type InputHTMLAttributes, type ReactNode, type TextareaHTMLAttributes } from "react";
|
||||
import { useId, useLayoutEffect, useRef, type InputHTMLAttributes, type ReactNode, type TextareaHTMLAttributes } from "react";
|
||||
import { cn } from "./cn.js";
|
||||
|
||||
export interface FieldFrameProps {
|
||||
@@ -29,6 +29,8 @@ export interface TextFieldProps extends InputHTMLAttributes<HTMLInputElement> {
|
||||
hint?: string;
|
||||
description?: string;
|
||||
fieldClassName?: string;
|
||||
/** Plain text appearance for directly editable detail content. Keep an accessible name. */
|
||||
appearance?: "default" | "plain";
|
||||
}
|
||||
|
||||
export function TextField({
|
||||
@@ -36,6 +38,7 @@ export function TextField({
|
||||
hint,
|
||||
description,
|
||||
fieldClassName,
|
||||
appearance = "default",
|
||||
className,
|
||||
id,
|
||||
...props
|
||||
@@ -43,7 +46,7 @@ export function TextField({
|
||||
const generatedId = useId();
|
||||
const controlId = id ?? generatedId;
|
||||
return (
|
||||
<FieldFrame label={label} hint={hint} description={description} htmlFor={controlId} className={fieldClassName}>
|
||||
<FieldFrame label={label} hint={hint} description={description} htmlFor={controlId} className={cn(fieldClassName, appearance === "plain" && "nodedc-field--plain", !label && "nodedc-field--unlabelled")}>
|
||||
<input id={controlId} className={cn("nodedc-field__control", className)} {...props} />
|
||||
</FieldFrame>
|
||||
);
|
||||
@@ -54,6 +57,8 @@ export interface TextAreaFieldProps extends TextareaHTMLAttributes<HTMLTextAreaE
|
||||
hint?: string;
|
||||
description?: string;
|
||||
fieldClassName?: string;
|
||||
/** Plain text appearance for directly editable detail content. Keep an accessible name. */
|
||||
appearance?: "default" | "plain";
|
||||
}
|
||||
|
||||
export function TextAreaField({
|
||||
@@ -61,15 +66,29 @@ export function TextAreaField({
|
||||
hint,
|
||||
description,
|
||||
fieldClassName,
|
||||
appearance = "default",
|
||||
className,
|
||||
id,
|
||||
...props
|
||||
}: TextAreaFieldProps) {
|
||||
const generatedId = useId();
|
||||
const controlId = id ?? generatedId;
|
||||
const area = useRef<HTMLTextAreaElement>(null);
|
||||
useLayoutEffect(() => {
|
||||
const el = area.current;
|
||||
if (!el || appearance !== "plain") return;
|
||||
const resize = () => { el.style.height = "auto"; el.style.height = el.scrollHeight + "px"; };
|
||||
resize();
|
||||
let width = el.clientWidth;
|
||||
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(() => {
|
||||
if (el.clientWidth !== width) { width = el.clientWidth; resize(); }
|
||||
});
|
||||
observer?.observe(el);
|
||||
return () => observer?.disconnect();
|
||||
}, [appearance, props.value]);
|
||||
return (
|
||||
<FieldFrame label={label} hint={hint} description={description} htmlFor={controlId} className={fieldClassName}>
|
||||
<textarea id={controlId} className={cn("nodedc-field__control", className)} {...props} />
|
||||
<FieldFrame label={label} hint={hint} description={description} htmlFor={controlId} className={cn(fieldClassName, appearance === "plain" && "nodedc-field--plain", !label && "nodedc-field--unlabelled")}>
|
||||
<textarea ref={area} id={controlId} className={cn("nodedc-field__control", className)} {...props} />
|
||||
</FieldFrame>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import {
|
||||
ListChecks,
|
||||
LocateFixed,
|
||||
LockKeyhole,
|
||||
LockKeyholeOpen,
|
||||
MailPlus,
|
||||
Map,
|
||||
Maximize2,
|
||||
@@ -63,6 +64,7 @@ import {
|
||||
ShieldCheck,
|
||||
SlidersHorizontal,
|
||||
Square,
|
||||
Star,
|
||||
Terminal,
|
||||
Trash2,
|
||||
UploadCloud,
|
||||
@@ -136,6 +138,7 @@ const icons = {
|
||||
list: ListChecks,
|
||||
target: LocateFixed,
|
||||
lock: LockKeyhole,
|
||||
unlock: LockKeyholeOpen,
|
||||
mail: MailPlus,
|
||||
minimize: Minimize2,
|
||||
network: Network,
|
||||
@@ -154,6 +157,7 @@ const icons = {
|
||||
shield: ShieldCheck,
|
||||
sliders: SlidersHorizontal,
|
||||
stop: Square,
|
||||
star: Star,
|
||||
terminal: Terminal,
|
||||
trash: Trash2,
|
||||
upload: UploadCloud,
|
||||
|
||||
@@ -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,4 +1,4 @@
|
||||
import { useEffect, useRef, type HTMLAttributes } from "react";
|
||||
import { createContext, useContext, useEffect, useRef, type HTMLAttributes, type ReactNode } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { cn } from "./cn.js";
|
||||
import { Icon, type IconName } from "./Icon.js";
|
||||
@@ -13,6 +13,13 @@ export type ToastItem = {
|
||||
durationMs?: number | null;
|
||||
};
|
||||
|
||||
const ToastObservation = createContext<((items: ToastItem[]) => void) | null>(null);
|
||||
|
||||
/** The application owns history/storage; this only reports terminal presentations. */
|
||||
export function ToastObserver({onPresent, children}: {onPresent: (items: ToastItem[]) => void; children: ReactNode}) {
|
||||
return <ToastObservation.Provider value={onPresent}>{children}</ToastObservation.Provider>;
|
||||
}
|
||||
|
||||
const toastIcons: Record<ToastTone, IconName> = {
|
||||
success: "check",
|
||||
error: "alert",
|
||||
@@ -69,7 +76,21 @@ function TimedToastCard({ item, onDismiss }: { item: ToastItem; onDismiss: (id:
|
||||
return <ToastCard item={item} onDismiss={onDismiss} />;
|
||||
}
|
||||
|
||||
export function ToastStack({ items, onDismiss }: { items: ToastItem[]; onDismiss: (id: string) => void }) {
|
||||
export function ToastStack({ items, onDismiss, observe = true }: { items: ToastItem[]; onDismiss: (id: string) => void; observe?: boolean }) {
|
||||
const observer = useContext(ToastObservation);
|
||||
const presented = useRef(new Map<string, string>());
|
||||
useEffect(() => {
|
||||
const next = new Map<string, string>();
|
||||
const fresh: ToastItem[] = [];
|
||||
for (const item of items) {
|
||||
if (item.tone === 'loading') continue;
|
||||
const identity = JSON.stringify([item.tone, item.title, item.description]);
|
||||
next.set(item.id, identity);
|
||||
if (presented.current.get(item.id) !== identity) fresh.push(item);
|
||||
}
|
||||
presented.current = next;
|
||||
if (observe && fresh.length) observer?.(fresh);
|
||||
}, [items, observer, observe]);
|
||||
if (typeof document === "undefined" || items.length === 0) return null;
|
||||
return createPortal(
|
||||
<div className="nodedc-toast-viewport nodedc-ui-root" aria-live="polite" aria-relevant="additions removals">
|
||||
|
||||
@@ -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>;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -24,6 +24,8 @@ export interface UserProfileMenuProps {
|
||||
triggerLabel?: ReactNode;
|
||||
/** Optional status glyph between the label and avatar. */
|
||||
triggerIcon?: IconName;
|
||||
/** Independent header action; the avatar still opens the profile menu. */
|
||||
headerAction?: { label: string; pressed?: boolean; controls?: string; onSelect: () => void };
|
||||
actions: readonly UserProfileMenuAction[];
|
||||
}
|
||||
|
||||
@@ -35,6 +37,7 @@ export function UserProfileMenu({
|
||||
coverImageUrl,
|
||||
triggerLabel,
|
||||
triggerIcon,
|
||||
headerAction,
|
||||
actions,
|
||||
}: UserProfileMenuProps) {
|
||||
const label = displayName || "NODE.DC";
|
||||
@@ -51,11 +54,15 @@ export function UserProfileMenu({
|
||||
</HeaderProfileButton>
|
||||
<IconButton
|
||||
ref={setTriggerRef}
|
||||
label={`Меню пользователя ${label}`}
|
||||
aria-haspopup="menu"
|
||||
aria-expanded={open}
|
||||
aria-controls={surfaceId}
|
||||
onClick={(event) => { setTriggerRef(event.currentTarget); toggle(); }}
|
||||
label={headerAction?.label ?? `Меню пользователя ${label}`}
|
||||
aria-haspopup={headerAction ? undefined : "menu"}
|
||||
aria-pressed={headerAction?.pressed}
|
||||
aria-expanded={headerAction ? headerAction.pressed : open}
|
||||
aria-controls={headerAction ? headerAction.controls : surfaceId}
|
||||
onClick={(event) => {
|
||||
if (headerAction) { if (open) toggle(); headerAction.onSelect(); }
|
||||
else { setTriggerRef(event.currentTarget); toggle(); }
|
||||
}}
|
||||
><Icon name={triggerIcon ?? "inbox"} size={20} strokeWidth={1.7} /></IconButton>
|
||||
<button type="button" className="nodedc-user-profile-menu__trigger" aria-label={`Профиль ${label}`} aria-haspopup="menu" aria-expanded={open} aria-controls={surfaceId}
|
||||
onClick={(event) => { setTriggerRef(event.currentTarget); toggle(); }}>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import {dragHandleFocus} from './dragHandleFocus.js';
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
@@ -39,6 +40,13 @@ export interface WindowProps extends Omit<HTMLAttributes<HTMLDivElement>, "title
|
||||
footer?: ReactNode;
|
||||
/** Context actions beside close, using canonical IconButton controls. */
|
||||
headerActions?: ReactNode;
|
||||
/** Keep actions on one line; place title below them when space is limited. */
|
||||
headerLayout?: "inline" | "adaptive";
|
||||
/** Temporarily enlarge within the viewport; restoring retains prior geometry and presentation. */
|
||||
expanded?: boolean;
|
||||
/** Separate durable layout for expanded media, committed only after a user gesture. */
|
||||
expandedRect?: WindowRect;
|
||||
onExpandedRectCommit?: (rect: WindowRect) => void;
|
||||
/** Keep contextual actions immediately before close when requested. */
|
||||
headerActionsPlacement?: "before-move" | "before-close";
|
||||
size?: WindowSize;
|
||||
@@ -58,6 +66,9 @@ export interface WindowProps extends Omit<HTMLAttributes<HTMLDivElement>, "title
|
||||
onRectCommit?: (rect: WindowRect) => void;
|
||||
/** Centered windows can become modeless without remounting their contents. */
|
||||
allowFloating?: boolean;
|
||||
/** App-owned presentation, persisted by window kind alongside rect. */
|
||||
floating?: boolean;
|
||||
onFloatingChange?: (floating: boolean) => void;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
@@ -68,6 +79,10 @@ export function Window({
|
||||
children,
|
||||
footer,
|
||||
headerActions,
|
||||
headerLayout = "inline",
|
||||
expanded = false,
|
||||
expandedRect,
|
||||
onExpandedRectCommit,
|
||||
headerActionsPlacement = "before-move",
|
||||
size = "md",
|
||||
placement = "center",
|
||||
@@ -82,6 +97,8 @@ export function Window({
|
||||
rect,
|
||||
onRectCommit,
|
||||
allowFloating = true,
|
||||
floating: controlledFloating,
|
||||
onFloatingChange,
|
||||
onClose,
|
||||
className,
|
||||
style,
|
||||
@@ -93,6 +110,10 @@ export function Window({
|
||||
const titleId = useId();
|
||||
const descriptionId = useId();
|
||||
const dialogRef = useRef<HTMLDivElement>(null);
|
||||
const minimumRef = useRef({width:320,height:200});
|
||||
const [headerMinimum,setHeaderMinimum]=useState(320);
|
||||
const [stackedTitle,setStackedTitle]=useState(false);
|
||||
const portalHostRef = useRef<Element | null>(null);
|
||||
const onCloseRef = useRef(onClose);
|
||||
const dragRef = useRef<{ pointerId: number; offsetX: number; offsetY: number } | null>(null);
|
||||
const [dragPosition, setDragPosition] = useState<{ left: number; top: number } | null>(null);
|
||||
@@ -100,13 +121,15 @@ export function Window({
|
||||
const [floatingRect, setFloatingRect] = useState<WindowRect | null>(null);
|
||||
const rectRef = useRef<WindowRect | null>(null);
|
||||
const initialRectRef = useRef<WindowRect | null>(null);
|
||||
const expansionRestoreRef = useRef<WindowRect | null>(null);
|
||||
const commitRef = useRef(onRectCommit);
|
||||
commitRef.current = onRectCommit;
|
||||
// Temporary media expansion never replaces the application-owned window layout.
|
||||
commitRef.current = expanded ? onExpandedRectCommit : onRectCommit;
|
||||
const changeRect = (next: WindowRect | null) => { rectRef.current = next; setFloatingRect(next); };
|
||||
const gestureChanged = useRef(false);
|
||||
const resizeRef = useRef<{ pointerId: number; x: number; y: number; rect: WindowRect; edge: ResizeEdge } | null>(null);
|
||||
const isFloating = floating && allowFloating && placement === "center";
|
||||
const freeGeometry = isFloating || (resizable && placement === "end");
|
||||
const isFloating = (controlledFloating ?? floating) && allowFloating && placement === "center";
|
||||
const freeGeometry = expanded || isFloating || (resizable && placement === "end");
|
||||
const canDrag = draggable || freeGeometry;
|
||||
const shouldLockBodyScroll = !suspended && !isFloating && (lockBodyScroll ?? placement === "center");
|
||||
const shouldTrapFocus = !suspended && !isFloating && (trapFocus ?? placement === "center");
|
||||
@@ -114,6 +137,31 @@ export function Window({
|
||||
modeRef.current = { shouldTrapFocus, isFloating, suspended };
|
||||
onCloseRef.current = onClose;
|
||||
|
||||
useLayoutEffect(()=>{
|
||||
if(!open || headerLayout!=="adaptive")return;
|
||||
const dialog=dialogRef.current,head=dialog?.querySelector<HTMLElement>(".nodedc-window__head"),actions=head?.querySelector<HTMLElement>(".nodedc-window__actions"),heading=head?.querySelector<HTMLElement>(".nodedc-window__title");
|
||||
if(!dialog||!head||!actions||!heading)return;
|
||||
const measure=()=>{
|
||||
const headStyle=window.getComputedStyle(head),input=heading.querySelector<HTMLInputElement>("input"),copyStyle=window.getComputedStyle(input??heading);
|
||||
const sample=document.createElement("span");
|
||||
Object.assign(sample.style,{position:"fixed",visibility:"hidden",pointerEvents:"none",whiteSpace:"pre",font:copyStyle.font,letterSpacing:copyStyle.letterSpacing});
|
||||
sample.textContent=input?.value??heading.textContent??"";head.appendChild(sample);
|
||||
const titleWidth=sample.getBoundingClientRect().width+(parseFloat(copyStyle.paddingLeft)||0)+(parseFloat(copyStyle.paddingRight)||0);sample.remove();
|
||||
const padding=(parseFloat(headStyle.paddingLeft)||0)+(parseFloat(headStyle.paddingRight)||0),actionWidth=actions.scrollWidth;
|
||||
const minimum=Math.max(320,Math.ceil(actionWidth+padding+2));
|
||||
minimumRef.current={width:minimum,height:200};setHeaderMinimum(minimum);
|
||||
setStackedTitle(head.clientWidth < padding+actionWidth+titleWidth+(parseFloat(headStyle.columnGap)||0)+2);
|
||||
if(freeGeometry&&rectRef.current){
|
||||
const fitted=fitWindow(rectRef.current,{width:window.innerWidth,height:window.innerHeight},minimumRef.current);
|
||||
if(fitted.left!==rectRef.current.left||fitted.top!==rectRef.current.top||fitted.width!==rectRef.current.width||fitted.height!==rectRef.current.height){changeRect(fitted);if(!resizeRef.current&&!dragRef.current)commitRef.current?.(fitted);}
|
||||
}
|
||||
};
|
||||
measure();
|
||||
const observer=typeof ResizeObserver!=="undefined"?new ResizeObserver(measure):null;
|
||||
observer?.observe(head);observer?.observe(actions);window.addEventListener("resize",measure);
|
||||
return()=>{observer?.disconnect();window.removeEventListener("resize",measure);};
|
||||
},[open,headerLayout,title,headerActions,freeGeometry]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open || typeof document === "undefined") return;
|
||||
const previousActiveElement = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
||||
@@ -133,13 +181,17 @@ export function Window({
|
||||
const topModal = Array.from(document.querySelectorAll<HTMLElement>('[role="dialog"][aria-modal="true"]')).filter(dialog => dialog.getClientRects().length > 0).at(-1);
|
||||
if (topModal && topModal !== dialogRef.current) return;
|
||||
}
|
||||
const ownedFullscreen = document.fullscreenElement && dialogRef.current?.contains(document.fullscreenElement);
|
||||
// Escape restores the embedded viewport, never closes its owning form.
|
||||
if (event.key === "Escape" && ownedFullscreen) return;
|
||||
if (event.key === "Escape" && closeOnEscape && (!modeRef.current.isFloating || dialogRef.current?.contains(document.activeElement))) {
|
||||
event.preventDefault();
|
||||
onCloseRef.current();
|
||||
return;
|
||||
}
|
||||
if (event.key !== "Tab" || !modeRef.current.shouldTrapFocus || !dialogRef.current) return;
|
||||
const focusable = Array.from(dialogRef.current.querySelectorAll<HTMLElement>(focusableSelector)).filter(element => element.getClientRects().length > 0);
|
||||
const focusScope = ownedFullscreen ? document.fullscreenElement! : dialogRef.current;
|
||||
const focusable = Array.from(focusScope.querySelectorAll<HTMLElement>(focusableSelector)).filter(element => element.getClientRects().length > 0);
|
||||
if (focusable.length === 0) {
|
||||
event.preventDefault();
|
||||
dialogRef.current.focus();
|
||||
@@ -172,20 +224,39 @@ export function Window({
|
||||
}, [open, shouldLockBodyScroll]);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (open && freeGeometry && !dragRef.current && !resizeRef.current) {
|
||||
if (!open) return;
|
||||
const viewport={width:window.innerWidth,height:window.innerHeight};
|
||||
if(expanded){
|
||||
if(!expansionRestoreRef.current){
|
||||
const bounds=dialogRef.current?.getBoundingClientRect();
|
||||
if(bounds){
|
||||
expansionRestoreRef.current=rectRef.current??{left:bounds.left,top:bounds.top,width:bounds.width,height:bounds.height};
|
||||
const width=Math.min(960,viewport.width*0.8),height=Math.min(800,viewport.height*0.82);
|
||||
const prior=expansionRestoreRef.current;
|
||||
changeRect(fitWindow(expandedRect??{left:prior.left+(prior.width-width)/2,top:prior.top+(prior.height-height)/2,width,height},viewport,minimumRef.current));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(expansionRestoreRef.current){
|
||||
changeRect(fitWindow(expansionRestoreRef.current,viewport,minimumRef.current));
|
||||
expansionRestoreRef.current=null;
|
||||
return;
|
||||
}
|
||||
if (freeGeometry && !dragRef.current && !resizeRef.current) {
|
||||
// The modal move toggle already restores its local rectangle. An
|
||||
// uncontrolled floating window must retain it when toggled twice.
|
||||
if (placement === "center" && !onRectCommit && !rect && rectRef.current) return;
|
||||
const bounds=dialogRef.current?.getBoundingClientRect();
|
||||
if(bounds){
|
||||
initialRectRef.current ??= initialRect??{left:bounds.left,top:bounds.top,width:bounds.width,height:bounds.height};
|
||||
changeRect(fitWindow(rect??initialRectRef.current,{width:window.innerWidth,height:window.innerHeight}));
|
||||
changeRect(fitWindow(rect??initialRectRef.current,{width:window.innerWidth,height:window.innerHeight},minimumRef.current));
|
||||
}
|
||||
}
|
||||
},[open,freeGeometry,rect?.left,rect?.top,rect?.width,rect?.height]);
|
||||
},[open,expanded,freeGeometry,rect?.left,rect?.top,rect?.width,rect?.height]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) { setDragPosition(null); setFloating(false); changeRect(null); initialRectRef.current = null; dragRef.current = null; resizeRef.current = null; }
|
||||
if (!open) { setDragPosition(null); setFloating(false); changeRect(null); initialRectRef.current = null; expansionRestoreRef.current = null; dragRef.current = null; resizeRef.current = null; }
|
||||
}, [open]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -194,7 +265,7 @@ export function Window({
|
||||
const resizing = resizeRef.current;
|
||||
if (resizing && event.pointerId === resizing.pointerId) {
|
||||
gestureChanged.current = true;
|
||||
changeRect(resizeWindow(resizing.rect, resizing.edge, event.clientX - resizing.x, event.clientY - resizing.y, { width: window.innerWidth, height: window.innerHeight }));
|
||||
changeRect(resizeWindow(resizing.rect, resizing.edge, event.clientX - resizing.x, event.clientY - resizing.y, { width: window.innerWidth, height: window.innerHeight },minimumRef.current));
|
||||
return;
|
||||
}
|
||||
const drag = dragRef.current;
|
||||
@@ -203,7 +274,7 @@ export function Window({
|
||||
const bounds = dialog.getBoundingClientRect();
|
||||
if (freeGeometry) {
|
||||
gestureChanged.current = true;
|
||||
changeRect(fitWindow({ left: event.clientX - drag.offsetX, top: event.clientY - drag.offsetY, width: bounds.width, height: bounds.height }, { width: window.innerWidth, height: window.innerHeight }));
|
||||
changeRect(fitWindow({ left: event.clientX - drag.offsetX, top: event.clientY - drag.offsetY, width: bounds.width, height: bounds.height }, { width: window.innerWidth, height: window.innerHeight },minimumRef.current));
|
||||
return;
|
||||
}
|
||||
const left = Math.max(8, Math.min(window.innerWidth - bounds.width - 8, event.clientX - drag.offsetX));
|
||||
@@ -228,10 +299,10 @@ export function Window({
|
||||
|
||||
useEffect(() => {
|
||||
if (!freeGeometry || !open) return;
|
||||
const fit = () => { if(rectRef.current) changeRect(fitWindow(rect ?? rectRef.current, { width: window.innerWidth, height: window.innerHeight })); };
|
||||
const fit = () => { if(rectRef.current) changeRect(fitWindow((expanded ? expandedRect : rect) ?? rectRef.current, { width: window.innerWidth, height: window.innerHeight },minimumRef.current)); };
|
||||
window.addEventListener("resize", fit);
|
||||
return () => window.removeEventListener("resize", fit);
|
||||
}, [freeGeometry, open, rect]);
|
||||
}, [freeGeometry, open, rect, expanded, expandedRect]);
|
||||
|
||||
if (!open || typeof document === "undefined") return null;
|
||||
|
||||
@@ -241,13 +312,24 @@ export function Window({
|
||||
if (allowBackdropClose && event.target === event.currentTarget) onClose();
|
||||
};
|
||||
|
||||
// Keep an owning window in its existing portal while its child is fullscreen.
|
||||
// Reparenting it into that child would form a DOM cycle and remount the renderer.
|
||||
const fullscreen = document.fullscreenElement;
|
||||
if (!portalHostRef.current || !fullscreen || !dialogRef.current?.contains(fullscreen)) {
|
||||
portalHostRef.current = fullscreen ?? document.body;
|
||||
}
|
||||
const baseStyle={...style,...(headerLayout==="adaptive"?{minWidth:Math.min(headerMinimum,Math.max(1,window.innerWidth-16))}:{})};
|
||||
return createPortal(
|
||||
<LoadingContext.Provider value={null}><InspectorSelectPolicyContext.Provider value={false}>
|
||||
<WindowSuspensionContext.Provider value={suspend}><div className="nodedc-overlay nodedc-ui-root" style={suspended ? {display:"none"} : undefined} data-placement={placement} data-floating={isFloating || undefined} onPointerDown={handleBackdropPointerDown}>
|
||||
<div
|
||||
ref={dialogRef}
|
||||
className={cn("nodedc-window nodedc-glass-material nodedc-material-rim", className)}
|
||||
data-expanded={expanded||undefined}
|
||||
data-header-layout={headerLayout}
|
||||
data-header-stacked={stackedTitle||undefined}
|
||||
data-material="glass-v4"
|
||||
data-glass-context={isFloating ? "scene" : undefined}
|
||||
data-size={size === "md" ? undefined : size}
|
||||
data-placement={placement}
|
||||
data-draggable={canDrag ? "true" : undefined}
|
||||
@@ -258,10 +340,11 @@ export function Window({
|
||||
aria-labelledby={titleId}
|
||||
aria-describedby={subtitle ? descriptionId : undefined}
|
||||
tabIndex={-1}
|
||||
style={freeGeometry && floatingRect ? { ...style, position: "fixed", ...floatingRect, right: "auto", bottom: "auto", maxWidth: "none", maxHeight: "none" } : dragPosition ? { ...style, position: "fixed", left: dragPosition.left, top: dragPosition.top, right: "auto", bottom: "auto" } : style}
|
||||
style={freeGeometry && floatingRect ? { ...baseStyle, position: "fixed", ...floatingRect, right: "auto", bottom: "auto", maxWidth: "none", maxHeight: "none" } : dragPosition ? { ...baseStyle, position: "fixed", left: dragPosition.left, top: dragPosition.top, right: "auto", bottom: "auto" } : baseStyle}
|
||||
{...props}
|
||||
>
|
||||
<header
|
||||
{...dragHandleFocus}
|
||||
className="nodedc-window__head"
|
||||
tabIndex={freeGeometry ? 0 : undefined}
|
||||
aria-label={freeGeometry ? "Перемещение окна: стрелки; изменение размера: Shift и стрелки" : undefined}
|
||||
@@ -271,7 +354,7 @@ export function Window({
|
||||
const dx = event.key === "ArrowLeft" ? -10 : event.key === "ArrowRight" ? 10 : 0;
|
||||
const dy = event.key === "ArrowUp" ? -10 : event.key === "ArrowDown" ? 10 : 0;
|
||||
const bounds = { width: window.innerWidth, height: window.innerHeight };
|
||||
const next = event.shiftKey ? resizeWindow(floatingRect, "se", dx, dy, bounds) : fitWindow({ ...floatingRect, left: floatingRect.left + dx, top: floatingRect.top + dy }, bounds);
|
||||
const next = event.shiftKey ? resizeWindow(floatingRect, "se", dx, dy, bounds,minimumRef.current) : fitWindow({ ...floatingRect, left: floatingRect.left + dx, top: floatingRect.top + dy }, bounds,minimumRef.current);
|
||||
changeRect(next); commitRef.current?.(next);
|
||||
}}
|
||||
onPointerDown={(event) => {
|
||||
@@ -294,9 +377,11 @@ export function Window({
|
||||
dragRef.current = null; resizeRef.current = null;
|
||||
if (!isFloating) {
|
||||
const rect = dialogRef.current?.getBoundingClientRect();
|
||||
if (rect) changeRect(fitWindow(rectRef.current ?? { left: rect.left, top: rect.top, width: rect.width, height: rect.height }, { width: window.innerWidth, height: window.innerHeight }));
|
||||
if (rect) changeRect(fitWindow(rectRef.current ?? { left: rect.left, top: rect.top, width: rect.width, height: rect.height }, { width: window.innerWidth, height: window.innerHeight },minimumRef.current));
|
||||
}
|
||||
if (rectRef.current) commitRef.current?.({...rectRef.current});
|
||||
setFloating(!isFloating);
|
||||
onFloatingChange?.(!isFloating);
|
||||
}}><Icon name="move" /></IconButton>}
|
||||
{headerActionsPlacement === "before-close" && headerActions}
|
||||
<button type="button" className="nodedc-window__close" aria-label={closeLabel} onClick={onClose}>
|
||||
@@ -316,7 +401,7 @@ export function Window({
|
||||
</div>
|
||||
</div>
|
||||
</WindowSuspensionContext.Provider></InspectorSelectPolicyContext.Provider></LoadingContext.Provider>,
|
||||
document.fullscreenElement ?? document.body,
|
||||
portalHostRef.current,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import {dragHandleFocus} from './dragHandleFocus.js';
|
||||
import {
|
||||
useEffect,
|
||||
useId,
|
||||
@@ -397,6 +398,7 @@ export function WorkspaceWindow({
|
||||
}}
|
||||
>
|
||||
<header
|
||||
{...dragHandleFocus}
|
||||
ref={headRef}
|
||||
className="nodedc-workspace-window__head"
|
||||
tabIndex={maximized ? -1 : 0}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import type {FocusEvent, KeyboardEvent, PointerEvent} from 'react';
|
||||
|
||||
/** A pointer grab must not inherit the previous input's keyboard focus ring. */
|
||||
export const dragHandleFocus = {
|
||||
onPointerDownCapture(event: PointerEvent<HTMLElement>) {
|
||||
if (event.button !== 0 || (event.target as HTMLElement).closest('button,input,select,textarea,a,[role=slider]')) return;
|
||||
event.currentTarget.dataset.pointerFocus = 'true';
|
||||
},
|
||||
onKeyDownCapture(event: KeyboardEvent<HTMLElement>) {
|
||||
if (event.target === event.currentTarget) delete event.currentTarget.dataset.pointerFocus;
|
||||
},
|
||||
onBlur(event: FocusEvent<HTMLElement>) {
|
||||
if (event.target === event.currentTarget) delete event.currentTarget.dataset.pointerFocus;
|
||||
},
|
||||
};
|
||||
@@ -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";
|
||||
|
||||
@@ -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;}
|
||||
}
|
||||
}
|
||||
+40
-16
@@ -176,6 +176,7 @@
|
||||
],
|
||||
"rules": [
|
||||
"Icon-only actions are circular by default.",
|
||||
"IconButton surface=none keeps the normal hit target and focus while removing the disc. Favorite stars use outline/filled glyph states; see docs/FAVORITES.md.",
|
||||
"Groups over rendered imagery use nodedc-scene-controls: Button, IconButton, Select and SegmentedControl share the opaque field surface and interaction states; all viewport controls use the same 70-percent geometry, and rails must not inherit the translucent header background.",
|
||||
"Controlled toggle actions expose aria-pressed and use the canonical active surface without changing geometry.",
|
||||
"Filled accent actions derive foreground contrast from the actual accent.",
|
||||
@@ -256,7 +257,8 @@
|
||||
"Labels and validation copy are part of the field contract.",
|
||||
"Keyboard focus changes the surface and remains visible without a browser-blue outline.",
|
||||
"Browser autofill retains the canonical field material, text and caret; keyboard focus remains visible.",
|
||||
"FieldFrame labelPlacement=below is the compact muted caption variant for header selectors; above remains the default."
|
||||
"FieldFrame labelPlacement=below is the compact muted caption variant for header selectors; above remains the default.",
|
||||
"appearance=plain renders immediately editable detail copy without a permanent plate; empty labels require aria-label, textarea grows to content, keyboard focus remains visible."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -356,12 +358,14 @@
|
||||
],
|
||||
"domContract": [
|
||||
"nodedc-dropdown-surface",
|
||||
"nodedc-dropdown-option"
|
||||
"nodedc-dropdown-option",
|
||||
"nodedc-viewport-surface"
|
||||
],
|
||||
"summary": "Shared portal/fixed floating layer for action and selection menus.",
|
||||
"behavior": [
|
||||
"portal to active fullscreen element or document body",
|
||||
"viewport clamp",
|
||||
"scene Glass V4 via surfaceClassName nodedc-viewport-surface",
|
||||
"content resize repositions an open dropdown within viewport bounds",
|
||||
"vertical flip",
|
||||
"capture-phase outside pointer close before scene tool interception",
|
||||
@@ -448,6 +452,7 @@
|
||||
"optional bounded dragging for modeless inspectors",
|
||||
"move toggle: preserve mounted contents and current size; remove dimming, backdrop close, scroll lock and focus trap; header drag and eight invisible resize regions",
|
||||
"Escape and Tab belong to the focused or topmost visible modal; parent windows do not dismiss behind nested settings.",
|
||||
"An embedded fullscreen viewport keeps its owning window mounted at the existing portal host; Escape restores the viewport and Tab stays inside its visible controls.",
|
||||
"DOM modal resizing shares eight canonical edge handles, centered viewport bounds and keyboard Shift+arrow control; onSizeCommit runs only for completed user changes."
|
||||
],
|
||||
"rules": [
|
||||
@@ -460,12 +465,16 @@
|
||||
"A draggable inspector moves by its header and remains clamped to the viewport.",
|
||||
"Closing a modeless inspector is never gated by autosave; preserve the draft, close immediately and report persistence failure through ToastStack.",
|
||||
"Operational copy inside Window uses component typography tokens; browser-default paragraph or heading sizes are forbidden.",
|
||||
"Centered windows expose the move toggle by default; allowFloating opts a workflow out. Returning to modal restores canonical centered geometry; closing clears floating geometry.",
|
||||
"Centered windows expose the move toggle by default; allowFloating opts a workflow out. Returning to modal restores canonical centered geometry; uncontrolled windows clear floating geometry on close.",
|
||||
"Floating header supports arrow-key movement and Shift+arrow resizing. Bounds stay inside the viewport. Resize affordances have no hover decoration.",
|
||||
"Inspectors inside a Window use its full available content width.",
|
||||
"End inspectors opt into resizable with an optional initialRect; existing eight edge geometry and keyboard resize are shared with floating windows.",
|
||||
"Application-owned rect restores modeless window geometry on reopen and external undo/import. onRectCommit reports one completed drag/resize or keyboard step; viewport fitting never overwrites saved geometry.",
|
||||
"Enforced operational typography: independent md/13px base for UI roots and portals; section/value text md, Description/status/error copy sm/12px, only canonical page/window titles use title/18px. Shared build-time typography contract and catalog example prevent browser-default size regressions."
|
||||
"Enforced operational typography: independent md/13px base for UI roots and portals; section/value text md, Description/status/error copy sm/12px, only canonical page/window titles use title/18px. Shared build-time typography contract and catalog example prevent browser-default size regressions.",
|
||||
"Drag headers never draw perimeter outlines or inherit keyboard-focus fill on pointer grab. Keyboard focus remains visible through the canonical surface; arrows, Shift+arrows and docking shortcuts remain available.",
|
||||
"Detached center windows automatically use scene Glass V4; fixed confirmations opt out of detachment with allowFloating=false. Unsaved profile confirmation is owned by the application.",
|
||||
"floating/onFloatingChange and rect/onRectCommit allow durable application-owned presentation by window kind, independent of the currently displayed entity. Reopening restores mode and fitted geometry. Fixed confirmations do not inherit this state.",
|
||||
"Adaptive headers keep actions on one row, place the full title below before clipping, and derive the resize minimum from actual actions. Expanded media opens at a moderate size and remains resizable. Separate expandedRect/onExpandedRectCommit preferences restore its user-chosen position and dimensions; returning restores regular geometry."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -504,7 +513,8 @@
|
||||
"resizeIndicator=false hides only the corner glyph; pointer hit area, cursor and keyboard resizing remain available.",
|
||||
"Use WorkspaceWindow for auxiliary views inside a stage; modal workflows and viewport inspectors continue to use Window.",
|
||||
"Dragging and resizing remain clamped when the workspace changes size, including when it becomes smaller than the requested minimum.",
|
||||
"Enforced operational typography: independent md/13px base for UI roots and portals; section/value text md, Description/status/error copy sm/12px, only canonical page/window titles use title/18px. Shared build-time typography contract and catalog example prevent browser-default size regressions."
|
||||
"Enforced operational typography: independent md/13px base for UI roots and portals; section/value text md, Description/status/error copy sm/12px, only canonical page/window titles use title/18px. Shared build-time typography contract and catalog example prevent browser-default size regressions.",
|
||||
"Drag headers never draw perimeter outlines or inherit keyboard-focus fill on pointer grab. Keyboard focus remains visible through the canonical surface; arrows, Shift+arrows and docking shortcuts remain available."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -698,6 +708,7 @@
|
||||
"behavior": [
|
||||
"portal dropdown",
|
||||
"profile identity card",
|
||||
"optional pressed state and controlled region on independent header action; its selected circle and glyph use the active IconButton colors, including on hover",
|
||||
"theme-independent cover",
|
||||
"action links and callbacks",
|
||||
"outside pointer and Escape close",
|
||||
@@ -707,7 +718,8 @@
|
||||
"The component owns menu geometry and profile presentation; the application owns settings, profile and logout actions.",
|
||||
"Use the existing Dropdown engine so the menu is never clipped by the fixed application header.",
|
||||
"Do not embed product permissions or sharing rules in the visual menu.",
|
||||
"The default header composes HeaderProfileButton, an independent menu IconButton and HeaderAvatar using the existing header geometry. Application settings belong inside this menu; do not add an adjacent settings button or another HeaderProfile wrapper."
|
||||
"The default header composes HeaderProfileButton, an independent menu IconButton and HeaderAvatar using the existing header geometry. Application settings belong inside this menu; do not add an adjacent settings button or another HeaderProfile wrapper.",
|
||||
"Optional headerAction separates the middle icon action from the avatar/profile trigger; without it legacy behavior is preserved."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -779,6 +791,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 +880,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 +892,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."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -894,7 +910,7 @@
|
||||
"nodedc-application-side-panel",
|
||||
"nodedc-app-shell__end-panel"
|
||||
],
|
||||
"summary": "Theme-aware trailing application panel paired with AdminNavigationPanel and hosted in a separate ApplicationShell end column.",
|
||||
"summary": "Theme-aware trailing application panel with optional header actions before close, hosted in a separate ApplicationShell end column.",
|
||||
"anatomy": [
|
||||
"eyebrow and title",
|
||||
"optional description",
|
||||
@@ -999,7 +1015,8 @@
|
||||
"ToastCard",
|
||||
"ToastStack",
|
||||
"ToastItem",
|
||||
"ToastTone"
|
||||
"ToastTone",
|
||||
"ToastObserver"
|
||||
],
|
||||
"domContract": [
|
||||
"nodedc-toast-viewport",
|
||||
@@ -1027,7 +1044,8 @@
|
||||
"Errors and status copy use the compact Toast typography; consumers do not substitute browser-default paragraphs or title-sized text.",
|
||||
"Adding or updating another notification never restarts the lifetime of an existing item; each item owns its timer by stable id.",
|
||||
"Loading notifications remain until the operation updates or dismisses them.",
|
||||
"Status notifications never replace a blocking confirmation modal."
|
||||
"Status notifications never replace a blocking confirmation modal.",
|
||||
"ToastObserver reports new or changed terminal presentations to the consumer; storage and history belong to the application. Set observe=false for server-originated items already recorded in history."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1115,7 +1133,9 @@
|
||||
"A reordered application page array is the single source of truth for both composition and navigation order.",
|
||||
"Optional renderOverlay portals the drag preview above scroll clipping without moving source layout; cancellation clears it.",
|
||||
"Pointer drops report client coordinates for consumer-owned canvas hit testing; dropping on empty space never implies an object target.",
|
||||
"DraggableItem exposes activator attributes/listeners for whole-tile dragging without a separate handle; the same activation threshold distinguishes clicks from drags."
|
||||
"DraggableItem exposes activator attributes/listeners for whole-tile dragging without a separate handle; the same activation threshold distinguishes clicks from drags.",
|
||||
"SortableList/SortableScope layout=grid uses rectangular sorting and two-axis movement with the same handle-only interaction; list remains vertical by default.",
|
||||
"DragHandle surface=control and SortableList handleSurface=control put the grip in a visible circle; viewport contexts use the shared glass material."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1418,7 +1438,8 @@
|
||||
"The fixed editor header is outside docking bounds. Back, edit completion and close return to the original view.",
|
||||
"When opened inside Window, the editor suspends that overlay, backdrop and focus trap without unmounting; returning restores the same window.",
|
||||
"EditorWorkspace purpose=view uses the same mounted host, return/fullscreen behavior and optional fixed headerActions; purpose=edit remains the compatible default.",
|
||||
"Tool minimumSize applies to floating restore, pointer and keyboard resize as well as docked splits; small screens clamp to available space. Footer remains outside the body scroller."
|
||||
"Tool minimumSize applies to floating restore, pointer and keyboard resize as well as docked splits; small screens clamp to available space. Footer remains outside the body scroller.",
|
||||
"Drag headers never draw perimeter outlines or inherit keyboard-focus fill on pointer grab. Keyboard focus remains visible through the canonical surface; arrows, Shift+arrows and docking shortcuts remain available."
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1448,7 +1469,8 @@
|
||||
"package": "@nodedc/ui-react",
|
||||
"exports": [
|
||||
"Tooltip",
|
||||
"TooltipProps"
|
||||
"TooltipProps",
|
||||
"TooltipProvider"
|
||||
],
|
||||
"domContract": [
|
||||
"nodedc-tooltip-anchor",
|
||||
@@ -1467,7 +1489,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."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -102,11 +102,13 @@
|
||||
"info-plain",
|
||||
"activity",
|
||||
"lock",
|
||||
"unlock",
|
||||
"key",
|
||||
"shield",
|
||||
"circle",
|
||||
"eye",
|
||||
"eye-off"
|
||||
"eye-off",
|
||||
"star"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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();});
|
||||
@@ -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);
|
||||
});
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user