feat(ui): support storage settings, pinned copies and contextual window actions

This commit is contained in:
Codex
2026-11-10 01:04:24 +03:00
parent be929f9d8e
commit 601ca62e9a
12 changed files with 54 additions and 13 deletions
+4 -1
View File
@@ -236,7 +236,7 @@ const iconGroups: Array<{ title: string; note: string; icons: IconName[] }> = [
{ {
title: "Сущности", title: "Сущности",
note: "Общий словарь", note: "Общий словарь",
icons: ["profile", "users", "building", "globe", "target", "database", "network", "inbox", "mail"], icons: ["profile", "users", "building", "globe", "target", "database", "pin", "network", "inbox", "mail"],
}, },
{ {
title: "Контент", title: "Контент",
@@ -264,6 +264,7 @@ const iconLabels: Record<IconName, string> = {
close: "Закрыть", close: "Закрыть",
copy: "Копировать", copy: "Копировать",
database: "База данных", database: "База данных",
pin: "Закрепить",
download: "Скачать", download: "Скачать",
edit: "Редактировать", edit: "Редактировать",
eye: "Показать", eye: "Показать",
@@ -2365,6 +2366,8 @@ export function CatalogApp() {
<Window <Window
open={createModuleOpen} open={createModuleOpen}
title="Создать модуль" title="Создать модуль"
headerActionsPlacement="before-close"
headerActions={<IconButton label="Очистить форму" onClick={() => {setCreateModuleName("");setCreateModuleSlug("");}}><Icon name="trash"/></IconButton>}
subtitle="Свободное окно · шапка: перемещение · края: размер" subtitle="Свободное окно · шапка: перемещение · края: размер"
size="sm" size="sm"
onClose={() => setCreateModuleOpen(false)} onClose={() => setCreateModuleOpen(false)}
@@ -22,6 +22,7 @@ export function EnvironmentCatalogDemo() {
</div> </div>
<div className="catalog-environment-stage"><LandingStage page={settings.pages.home} /></div> <div className="catalog-environment-stage"><LandingStage page={settings.pages.home} /></div>
<EnvironmentSettingsWindow open={open} onClose={() => setOpen(false)} productName="Продукт" <EnvironmentSettingsWindow open={open} onClose={() => setOpen(false)} productName="Продукт"
additionalSections={[{ id: "storage", label: "Хранилище", icon: "database", content: <p>Настройки хранения продукта используют общий каркас окна.</p> }]}
surfaces={[{ id: "home", home: true, description: "Главная страница продукта", actions: [] }]} surfaces={[{ id: "home", home: true, description: "Главная страница продукта", actions: [] }]}
settings={settings} state="ready" error={null} settings={settings} state="ready" error={null}
onSave={async draft => { const next = { ...draft, revision: draft.revision + 1 }; setSettings(next); return next; }} onSave={async draft => { const next = { ...draft, revision: draft.revision + 1 }; setSettings(next); return next; }}
+5
View File
@@ -524,3 +524,8 @@ Exact `RangeControl` editors synchronize external controlled-value changes while
Window: `rect` / `onRectCommit` — восстановление и фиксация геометрии инструментов; см. WINDOWS_AND_LAYERS.md. Иконка `minus` дополняет `plus` для управления масштабом содержимого. Window: `rect` / `onRectCommit` — восстановление и фиксация геометрии инструментов; см. WINDOWS_AND_LAYERS.md. Иконка `minus` дополняет `plus` для управления масштабом содержимого.
`EditorDockLayout` / `EditorWorkspace`: переносимый редактор с закреплённым основным видом, четырьмя зонами стыковки, разделителями и отрываемыми панелями. Управляемый `EditorDockState` хранится в документе приложения. Шапка редактора не участвует в стыковке; возврат восстанавливает исходный вид. Контракт, keyboard и минимумы — в WINDOWS_AND_LAYERS.md. `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.
+13
View File
@@ -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. 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. 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.
+3
View File
@@ -13,3 +13,6 @@ aria-valuenow отсутствует. `label` обязателен; `valueText`
ResourceRow.progress занимает свободное место между текстом и actions, скрывает ResourceRow.progress занимает свободное место между текстом и actions, скрывает
status, на узком экране переносится ниже текста. Готовность не вычисляется status, на узком экране переносится ниже текста. Готовность не вычисляется
компонентом. Каталог содержит завершённый, определённый и неизвестный прогресс. компонентом. Каталог содержит завершённый, определённый и неизвестный прогресс.
Размер полосы задаётся опциональным `--nodedc-progress-height`; по умолчанию
используется `--nodedc-space-2`. Плотность не меняет поведение и ARIA-состояния.
+2 -2
View File
@@ -693,7 +693,7 @@ textarea.nodedc-field__control {
font-family: inherit; font-family: inherit;
font-weight: 400; font-weight: 400;
color: var(--nodedc-text-muted); 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; 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); } [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. */ /* 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__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; } .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%); } } @keyframes nodedc-progress-travel { from { transform: translateX(-100%); } to { transform: translateX(285%); } }
@@ -1,4 +1,4 @@
import { useEffect, useMemo, useState } from "react"; import { useEffect, useMemo, useState, type ReactNode } from "react";
import { import {
Button, Button,
FeatureSettingsWindow, FeatureSettingsWindow,
@@ -18,9 +18,12 @@ import {
type EnvironmentSurface, type EnvironmentSurface,
type UploadedEnvironmentMedia, type UploadedEnvironmentMedia,
} from "@nodedc/ui-core"; } from "@nodedc/ui-core";
import type { FeatureSettingsSection } from "./FeatureSettingsWindow.js";
import { EnvironmentMediaPlaylistEditor } from "./EnvironmentMediaPlaylistEditor.js"; import { EnvironmentMediaPlaylistEditor } from "./EnvironmentMediaPlaylistEditor.js";
export interface EnvironmentSettingsWindowProps { 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; productName: string;
surfaces: readonly EnvironmentSurface[]; surfaces: readonly EnvironmentSurface[];
initialSurfaceId?: string; initialSurfaceId?: string;
@@ -70,6 +73,7 @@ function patchBackground(
export function EnvironmentSettingsWindow({ export function EnvironmentSettingsWindow({
productName, productName,
additionalSections = [],
surfaces, surfaces,
initialSurfaceId, initialSurfaceId,
open, open,
@@ -80,6 +84,8 @@ export function EnvironmentSettingsWindow({
onSave, onSave,
onUpload, onUpload,
}: EnvironmentSettingsWindowProps) { }: EnvironmentSettingsWindowProps) {
const [activeSection, setActiveSection] = useState("environment");
const extension = additionalSections.find(section => section.id === activeSection);
const [draft, setDraft] = useState(() => cloneEnvironmentSettings(settings)); const [draft, setDraft] = useState(() => cloneEnvironmentSettings(settings));
const [surfaceId, setSurfaceId] = useState(initialSurfaceId ?? surfaces[0]?.id ?? "home"); const [surfaceId, setSurfaceId] = useState(initialSurfaceId ?? surfaces[0]?.id ?? "home");
const [uploading, setUploading] = useState(false); const [uploading, setUploading] = useState(false);
@@ -196,11 +202,12 @@ export function EnvironmentSettingsWindow({
group: productName.toUpperCase(), group: productName.toUpperCase(),
icon: "settings", icon: "settings",
}, },
...additionalSections,
]} ]}
activeSection="environment" activeSection={extension ? activeSection : "environment"}
onSectionChange={() => undefined} onSectionChange={setActiveSection}
onClose={onClose} onClose={onClose}
footer={( footer={extension ? extension.footer : (
<WindowFooterActions> <WindowFooterActions>
<Button <Button
variant="secondary" variant="secondary"
@@ -223,7 +230,7 @@ export function EnvironmentSettingsWindow({
</WindowFooterActions> </WindowFooterActions>
)} )}
> >
<div className="nodedc-environment-settings"> {extension ? extension.content : <div className="nodedc-environment-settings">
<SettingsCard <SettingsCard
eyebrow="ОКРУЖЕНИЕ" eyebrow="ОКРУЖЕНИЕ"
title="Основные элементы управления" title="Основные элементы управления"
@@ -349,7 +356,7 @@ export function EnvironmentSettingsWindow({
/> />
</div> </div>
</SettingsCard> </SettingsCard>
</div> </div>}
</FeatureSettingsWindow> </FeatureSettingsWindow>
); );
} }
+2
View File
@@ -47,6 +47,7 @@ import {
PanelTop, PanelTop,
Pencil, Pencil,
Play, Play,
Pin,
Power, Power,
Plus, Plus,
Minus, Minus,
@@ -95,6 +96,7 @@ const icons = {
close: X, close: X,
copy: Copy, copy: Copy,
database: Database, database: Database,
pin: Pin,
download: Download, download: Download,
edit: Pencil, edit: Pencil,
eye: Eye, eye: Eye,
+5 -1
View File
@@ -39,6 +39,8 @@ export interface WindowProps extends Omit<HTMLAttributes<HTMLDivElement>, "title
footer?: ReactNode; footer?: ReactNode;
/** Context actions beside close, using canonical IconButton controls. */ /** Context actions beside close, using canonical IconButton controls. */
headerActions?: ReactNode; headerActions?: ReactNode;
/** Keep contextual actions immediately before close when requested. */
headerActionsPlacement?: "before-move" | "before-close";
size?: WindowSize; size?: WindowSize;
placement?: WindowPlacement; placement?: WindowPlacement;
closeLabel?: string; closeLabel?: string;
@@ -66,6 +68,7 @@ export function Window({
children, children,
footer, footer,
headerActions, headerActions,
headerActionsPlacement = "before-move",
size = "md", size = "md",
placement = "center", placement = "center",
closeLabel = "Закрыть", closeLabel = "Закрыть",
@@ -286,7 +289,7 @@ export function Window({
{subtitle ? <p id={descriptionId} className="nodedc-window__subtitle">{subtitle}</p> : null} {subtitle ? <p id={descriptionId} className="nodedc-window__subtitle">{subtitle}</p> : null}
</div> </div>
<div className="nodedc-window__actions"> <div className="nodedc-window__actions">
{headerActions} {headerActionsPlacement === "before-move" && headerActions}
{allowFloating && placement === "center" && <IconButton label={isFloating ? "Вернуть модальный режим" : "Свободное окно"} aria-pressed={isFloating} onClick={() => { {allowFloating && placement === "center" && <IconButton label={isFloating ? "Вернуть модальный режим" : "Свободное окно"} aria-pressed={isFloating} onClick={() => {
dragRef.current = null; resizeRef.current = null; dragRef.current = null; resizeRef.current = null;
if (!isFloating) { if (!isFloating) {
@@ -295,6 +298,7 @@ export function Window({
} }
setFloating(!isFloating); setFloating(!isFloating);
}}><Icon name="move" /></IconButton>} }}><Icon name="move" /></IconButton>}
{headerActionsPlacement === "before-close" && headerActions}
<button type="button" className="nodedc-window__close" aria-label={closeLabel} onClick={onClose}> <button type="button" className="nodedc-window__close" aria-label={closeLabel} onClick={onClose}>
<Icon name="close" size={16} strokeWidth={1.6} /> <Icon name="close" size={16} strokeWidth={1.6} />
</button> </button>
+4 -2
View File
@@ -416,6 +416,7 @@
"Escape and Tab belong to the focused or topmost visible modal; parent windows do not dismiss behind nested settings." "Escape and Tab belong to the focused or topmost visible modal; parent windows do not dismiss behind nested settings."
], ],
"rules": [ "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.", "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.", "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.", "Open state belongs to the application; focus/layer behavior belongs to the component.",
@@ -1112,14 +1113,15 @@
"nodedc-environment-settings", "nodedc-environment-settings",
"nodedc-environment-media-playlist" "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": [ "behavior": [
"product-configured page list", "product-configured page list",
"draft/reset/save", "draft/reset/save",
"upload adapter", "upload adapter",
"ordered media playlist", "ordered media playlist",
"image timing", "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": [ "rules": [
"Reuse FeatureSettingsWindow and existing form primitives; never fork an application-specific settings form.", "Reuse FeatureSettingsWindow and existing form primitives; never fork an application-specific settings form.",
+1
View File
@@ -116,6 +116,7 @@
"building", "building",
"globe", "globe",
"database", "database",
"pin",
"network", "network",
"inbox", "inbox",
"mail" "mail"
+1 -1
View File
@@ -31,7 +31,7 @@ test('legacy card paragraphs and live descriptions share small muted typography,
assert.ok(copy); assert.ok(copy);
assert.match(copy.selectors,/\.nodedc-settings-card__titles p/); assert.match(copy.selectors,/\.nodedc-settings-card__titles p/);
assert.match(copy.selectors,/\.nodedc-settings-card__body :where\(p:not\(\[class\]\)\)/); 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/); assert.doesNotMatch(copy.selectors,/h[1-6]|button|input|select/);
const markup=renderToStaticMarkup(h(Description,{role:'status','aria-live':'polite'},'Waiting for device')); 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"/); assert.match(markup,/role="status"/);assert.match(markup,/aria-live="polite"/);assert.match(markup,/class="nodedc-description"/);