From 601ca62e9a746621b3e2aae88f1f030e2dfa632e Mon Sep 17 00:00:00 2001 From: Codex Date: Tue, 10 Nov 2026 01:04:24 +0300 Subject: [PATCH] feat(ui): support storage settings, pinned copies and contextual window actions --- apps/catalog/src/CatalogApp.tsx | 5 ++++- apps/catalog/src/EnvironmentCatalogDemo.tsx | 1 + docs/COMPONENTS.md | 5 +++++ docs/ENVIRONMENT_SETTINGS.md | 13 +++++++++++++ docs/PROGRESS_BAR.md | 3 +++ packages/ui-core/styles.css | 4 ++-- .../src/EnvironmentSettingsWindow.tsx | 19 +++++++++++++------ packages/ui-react/src/Icon.tsx | 2 ++ packages/ui-react/src/Window.tsx | 6 +++++- registry/components.json | 6 ++++-- registry/icons.json | 1 + scripts/settings-surfaces.test.mjs | 2 +- 12 files changed, 54 insertions(+), 13 deletions(-) diff --git a/apps/catalog/src/CatalogApp.tsx b/apps/catalog/src/CatalogApp.tsx index 0715ebd..77117d3 100644 --- a/apps/catalog/src/CatalogApp.tsx +++ b/apps/catalog/src/CatalogApp.tsx @@ -236,7 +236,7 @@ const iconGroups: Array<{ title: string; note: string; icons: IconName[] }> = [ { title: "Сущности", note: "Общий словарь", - icons: ["profile", "users", "building", "globe", "target", "database", "network", "inbox", "mail"], + icons: ["profile", "users", "building", "globe", "target", "database", "pin", "network", "inbox", "mail"], }, { title: "Контент", @@ -264,6 +264,7 @@ const iconLabels: Record = { close: "Закрыть", copy: "Копировать", database: "База данных", + pin: "Закрепить", download: "Скачать", edit: "Редактировать", eye: "Показать", @@ -2365,6 +2366,8 @@ export function CatalogApp() { {setCreateModuleName("");setCreateModuleSlug("");}}>} subtitle="Свободное окно · шапка: перемещение · края: размер" size="sm" onClose={() => setCreateModuleOpen(false)} diff --git a/apps/catalog/src/EnvironmentCatalogDemo.tsx b/apps/catalog/src/EnvironmentCatalogDemo.tsx index a554711..bd3e3b6 100644 --- a/apps/catalog/src/EnvironmentCatalogDemo.tsx +++ b/apps/catalog/src/EnvironmentCatalogDemo.tsx @@ -22,6 +22,7 @@ export function EnvironmentCatalogDemo() {
setOpen(false)} productName="Продукт" + additionalSections={[{ id: "storage", label: "Хранилище", icon: "database", content:

Настройки хранения продукта используют общий каркас окна.

}]} surfaces={[{ id: "home", home: true, description: "Главная страница продукта", actions: [] }]} settings={settings} state="ready" error={null} onSave={async draft => { const next = { ...draft, revision: draft.revision + 1 }; setSettings(next); return next; }} diff --git a/docs/COMPONENTS.md b/docs/COMPONENTS.md index b6a3595..35f763c 100644 --- a/docs/COMPONENTS.md +++ b/docs/COMPONENTS.md @@ -524,3 +524,8 @@ Exact `RangeControl` editors synchronize external controlled-value changes while Window: `rect` / `onRectCommit` — восстановление и фиксация геометрии инструментов; см. WINDOWS_AND_LAYERS.md. Иконка `minus` дополняет `plus` для управления масштабом содержимого. `EditorDockLayout` / `EditorWorkspace`: переносимый редактор с закреплённым основным видом, четырьмя зонами стыковки, разделителями и отрываемыми панелями. Управляемый `EditorDockState` хранится в документе приложения. Шапка редактора не участвует в стыковке; возврат восстанавливает исходный вид. Контракт, keyboard и минимумы — в WINDOWS_AND_LAYERS.md. + +Размер поясняющего текста `Description` можно задать через +`--nodedc-description-font-size`; по умолчанию используется `--nodedc-font-size-sm`. + +Window header actions default to before the move toggle. `headerActionsPlacement="before-close"` places supplied canonical IconButtons between move and close, preserving DOM/Tab order. Deletion confirmation remains application-owned content in the same mounted Window. diff --git a/docs/ENVIRONMENT_SETTINGS.md b/docs/ENVIRONMENT_SETTINGS.md index 158b72c..7e1a729 100644 --- a/docs/ENVIRONMENT_SETTINGS.md +++ b/docs/ENVIRONMENT_SETTINGS.md @@ -17,3 +17,16 @@ The application validates URLs/media bytes, persists uploads and document revisi Mission Core passes all existing page definitions and its current operator-environment API. Mission Core Node passes home only and authenticated local presentation storage. Device control never depends on this document. The catalog EnvironmentCatalogDemo exercises the same exported components with an explicitly in-memory save/upload adapter; it is not a persistence service. Validate the source migration, TypeScript builds, playlist functions, neutral enabled/disabled DOM contract, dark/light and multiple accents, modal Escape, media order/timing and both consumer persistence adapters. Long-running or physical device acceptance remains application-owned. + +## Product sections (2026-11-08) + +`additionalSections` accepts `{ id, label, icon, group?, content, footer? }`. +Use unique IDs other than `environment`. Content and footer are product-owned; +the shared shell retains navigation, focus, dragging, Escape and geometry. +Environment drafts remain intact when switching sections. Each section owns its +loading/error/saving states. No product API is called by the shared library. +Mission Core uses this extension for the owner-requested Storage section. + +The canonical `pin` icon is the Lucide Pin glyph. Pair it with IconButton and +`aria-pressed` for pinned state; use a busy/disabled state during preparation. +An absent local copy and an unpinned copy are separate states. diff --git a/docs/PROGRESS_BAR.md b/docs/PROGRESS_BAR.md index 1825927..27f2f1c 100644 --- a/docs/PROGRESS_BAR.md +++ b/docs/PROGRESS_BAR.md @@ -13,3 +13,6 @@ aria-valuenow отсутствует. `label` обязателен; `valueText` ResourceRow.progress занимает свободное место между текстом и actions, скрывает status, на узком экране переносится ниже текста. Готовность не вычисляется компонентом. Каталог содержит завершённый, определённый и неизвестный прогресс. + +Размер полосы задаётся опциональным `--nodedc-progress-height`; по умолчанию +используется `--nodedc-space-2`. Плотность не меняет поведение и ARIA-состояния. diff --git a/packages/ui-core/styles.css b/packages/ui-core/styles.css index 25ebdb1..0476e1c 100644 --- a/packages/ui-core/styles.css +++ b/packages/ui-core/styles.css @@ -693,7 +693,7 @@ textarea.nodedc-field__control { font-family: inherit; font-weight: 400; color: var(--nodedc-text-muted); - font-size: var(--nodedc-font-size-sm); + font-size: var(--nodedc-description-font-size, var(--nodedc-font-size-sm)); line-height: 1.4; } @@ -4006,7 +4006,7 @@ textarea.nodedc-field__control { [data-nodedc-theme="light"] :is(.nodedc-header__brand, .nodedc-header__workspace)[data-monochrome="true"] img { filter: brightness(0); } /* Owner-admitted linear progress in the shared resource row. */ -.nodedc-progress-bar { min-width: 3rem; height: var(--nodedc-space-2); overflow: hidden; border-radius: var(--nodedc-radius-circle); background: var(--nodedc-glass-control-bg); } +.nodedc-progress-bar { min-width: 3rem; height: var(--nodedc-progress-height, var(--nodedc-space-2)); overflow: hidden; border-radius: var(--nodedc-radius-circle); background: var(--nodedc-glass-control-bg); } .nodedc-progress-bar__fill { display: block; width: 100%; height: 100%; background: var(--nodedc-text-secondary); border-radius: inherit; transform: scaleX(var(--nodedc-progress-fraction)); transform-origin: left; transition: transform var(--nodedc-duration-normal) var(--nodedc-ease-standard); } .nodedc-progress-bar[data-indeterminate] > .nodedc-progress-bar__fill { width: 35%; animation: nodedc-progress-travel 1.5s ease-in-out infinite alternate; } @keyframes nodedc-progress-travel { from { transform: translateX(-100%); } to { transform: translateX(285%); } } diff --git a/packages/ui-react/src/EnvironmentSettingsWindow.tsx b/packages/ui-react/src/EnvironmentSettingsWindow.tsx index c795591..d1bd642 100644 --- a/packages/ui-react/src/EnvironmentSettingsWindow.tsx +++ b/packages/ui-react/src/EnvironmentSettingsWindow.tsx @@ -1,4 +1,4 @@ -import { useEffect, useMemo, useState } from "react"; +import { useEffect, useMemo, useState, type ReactNode } from "react"; import { Button, FeatureSettingsWindow, @@ -18,9 +18,12 @@ import { type EnvironmentSurface, type UploadedEnvironmentMedia, } from "@nodedc/ui-core"; +import type { FeatureSettingsSection } from "./FeatureSettingsWindow.js"; import { EnvironmentMediaPlaylistEditor } from "./EnvironmentMediaPlaylistEditor.js"; export interface EnvironmentSettingsWindowProps { + /** Product-owned sections reuse this shell; each owns its content and save lifecycle. */ + additionalSections?: readonly (FeatureSettingsSection & { content: ReactNode; footer?: ReactNode })[]; productName: string; surfaces: readonly EnvironmentSurface[]; initialSurfaceId?: string; @@ -70,6 +73,7 @@ function patchBackground( export function EnvironmentSettingsWindow({ productName, + additionalSections = [], surfaces, initialSurfaceId, open, @@ -80,6 +84,8 @@ export function EnvironmentSettingsWindow({ onSave, onUpload, }: EnvironmentSettingsWindowProps) { + const [activeSection, setActiveSection] = useState("environment"); + const extension = additionalSections.find(section => section.id === activeSection); const [draft, setDraft] = useState(() => cloneEnvironmentSettings(settings)); const [surfaceId, setSurfaceId] = useState(initialSurfaceId ?? surfaces[0]?.id ?? "home"); const [uploading, setUploading] = useState(false); @@ -196,11 +202,12 @@ export function EnvironmentSettingsWindow({ group: productName.toUpperCase(), icon: "settings", }, + ...additionalSections, ]} - activeSection="environment" - onSectionChange={() => undefined} + activeSection={extension ? activeSection : "environment"} + onSectionChange={setActiveSection} onClose={onClose} - footer={( + footer={extension ? extension.footer : ( diff --git a/registry/components.json b/registry/components.json index cbf03b2..8dcb36f 100644 --- a/registry/components.json +++ b/registry/components.json @@ -416,6 +416,7 @@ "Escape and Tab belong to the focused or topmost visible modal; parent windows do not dismiss behind nested settings." ], "rules": [ + "headerActionsPlacement=before-close places context actions between the move toggle and close in both visual and keyboard order; the default preserves existing consumers.", "WindowFooterActions aligns modal actions to the trailing edge, including a footer with only one action group; actions wrap within narrow windows.", "Centered windows at narrow widths subtract both overlay gutters from their maximum width and height.", "Open state belongs to the application; focus/layer behavior belongs to the component.", @@ -1112,14 +1113,15 @@ "nodedc-environment-settings", "nodedc-environment-media-playlist" ], - "summary": "Shared avatar Settings → Environment composition for product/home copy, quick actions and image/video playlists.", + "summary": "Shared avatar Settings composition with Environment editing and optional consumer-owned settings sections.", "behavior": [ "product-configured page list", "draft/reset/save", "upload adapter", "ordered media playlist", "image timing", - "parent save/upload disabled state" + "parent save/upload disabled state", + "additionalSections extends shared navigation with consumer-owned content and footer while preserving the Environment draft" ], "rules": [ "Reuse FeatureSettingsWindow and existing form primitives; never fork an application-specific settings form.", diff --git a/registry/icons.json b/registry/icons.json index be98452..246952f 100644 --- a/registry/icons.json +++ b/registry/icons.json @@ -116,6 +116,7 @@ "building", "globe", "database", + "pin", "network", "inbox", "mail" diff --git a/scripts/settings-surfaces.test.mjs b/scripts/settings-surfaces.test.mjs index cc3beb7..1436bb6 100644 --- a/scripts/settings-surfaces.test.mjs +++ b/scripts/settings-surfaces.test.mjs @@ -31,7 +31,7 @@ test('legacy card paragraphs and live descriptions share small muted typography, assert.ok(copy); assert.match(copy.selectors,/\.nodedc-settings-card__titles p/); assert.match(copy.selectors,/\.nodedc-settings-card__body :where\(p:not\(\[class\]\)\)/); - for(const declaration of ['font-family: inherit','font-weight: 400','color: var(--nodedc-text-muted)','font-size: var(--nodedc-font-size-sm)','line-height: 1.4'])assert.ok(copy.body.includes(declaration),declaration); + for(const declaration of ['font-family: inherit','font-weight: 400','color: var(--nodedc-text-muted)','font-size: var(--nodedc-description-font-size, var(--nodedc-font-size-sm))','line-height: 1.4'])assert.ok(copy.body.includes(declaration),declaration); assert.doesNotMatch(copy.selectors,/h[1-6]|button|input|select/); const markup=renderToStaticMarkup(h(Description,{role:'status','aria-live':'polite'},'Waiting for device')); assert.match(markup,/role="status"/);assert.match(markup,/aria-live="polite"/);assert.match(markup,/class="nodedc-description"/);