fix(cms): reuse canonical profile and nested form surfaces
DC CMS qualification / qualify (push) Successful in 1m39s

This commit is contained in:
DCCONSTRUCTIONS
2026-11-05 13:09:58 +03:00
parent 73bf4639a2
commit 10c2d6a70d
13 changed files with 48 additions and 39 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+16 -16
View File
File diff suppressed because one or more lines are too long
+2 -1
View File
File diff suppressed because one or more lines are too long
+8 -1
View File
@@ -75,7 +75,8 @@ remain in forms, preserving IDs, names, validation and model serialization.
CMS opts into shared `edges: flat`, with a white accent by default. The header
uses UserProfileMenu with the name/avatar from the existing `/api/me` session
and an adjacent settings action. FeatureSettingsWindow contains the shared
and the complete canonical header: profile label, menu icon, avatar. Settings
open from the menu; there is no separate settings action beside the avatar. FeatureSettingsWindow contains the shared
Select and ColorField; validated preferences persist in browser-local storage
under `dc-cms.ui-preferences.v1`, independently of either site's content.
@@ -89,3 +90,9 @@ color-picker controls are excluded from the legacy DOM adapter.
Verified: dark/light, accent change and reload persistence, reset to white,
nested palette Escape, 390px modal, plus/template picker, pointer drag/reorder
(discarded), switching independent sites, and the shared component/type checks.
Collection entries and JSON disclosures consume `GlassSurface tone="soft"`
with its shared padding/radius/material. The former app-local translucent
item background accumulated across nested cards and converged with TextField
fill; using the canonical opaque nested surface preserves visible field zones
in both themes without adding borders or changing input tokens.
+2 -2
View File
@@ -5,7 +5,7 @@ import { readFile, writeFile } from "node:fs/promises";
import { createHash } from "node:crypto";
import { fileURLToPath } from "node:url";
import { build } from "esbuild";
import { AppHeader, HeaderNavigation, HeaderProfile, HeaderAvatar, ApplicationShell, ApplicationPanel, AdminNavigationPanel, Button, IconButton, Icon, StatusBadge, FieldFrame, TextField, Switch, SettingsCard, MediaSourceField, DragHandle } from "@nodedc/ui-react";
import { AppHeader, HeaderNavigation, HeaderProfile, HeaderAvatar, ApplicationShell, ApplicationPanel, AdminNavigationPanel, Button, IconButton, Icon, StatusBadge, FieldFrame, TextField, Switch, SettingsCard, GlassSurface, MediaSourceField, DragHandle } from "@nodedc/ui-react";
const h = React.createElement, noop = () => {
}, root = fileURLToPath(new URL("../", import.meta.url));
const read = (p) => readFile(new URL(p, import.meta.url), "utf8");
@@ -36,7 +36,7 @@ const actions = h("div", { className: "cms-editor-actions" }, h(StatusBadge, { i
const content = h(ApplicationPanel, { eyebrow: h("span", { id: "editor-heading" }, "\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0441\u0430\u0439\u0442\u0430"), title: "\u041A\u043E\u043D\u0442\u0435\u043D\u0442", description: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0430\u0437\u0434\u0435\u043B", headerTools: actions, expanded: true, onClose: noop }, h("div", { className: "cms-editor", dangerouslySetInnerHTML: { __html: await read("editor.html") } }));
const shell = html(h(ApplicationShell, { id: "cms-shell", header, stage: h("div", { className: "cms-stage" }, h("p", null, "\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0441\u0430\u0439\u0442\u0430\u043C\u0438 NODE.DC"), btn("open-navigation", "\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0440\u0430\u0437\u0434\u0435\u043B\u044B")), navigation: nav, content, navigationOpen: true, contentOpen: true, contentExpanded: true }));
const icons = ["close", "plus", "chevron-up", "chevron-down", "copy", "clipboard", "trash", "eye", "eye-off", "layers", "panel", "file", "settings", "folder", "image", "video", "refresh", "move", "edit"];
const templates = Object.entries({ dragHandle: h(DragHandle, {label:"Перетащить блок"}), button: h(Button, null, "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435"), iconButton: h(IconButton, { label: "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435" }, icon("plus")), field: h(FieldFrame, { label: "\u041F\u043E\u043B\u0435" }, h("span", { "data-slot": "control" })), text: h(TextField, { id: "template-field", label: "\u041F\u043E\u043B\u0435" }), card: h(SettingsCard, { eyebrow: "\u0420\u0430\u0437\u0434\u0435\u043B", title: "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435", description: "\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435" }, h("div", { "data-slot": "body" })), media: h(MediaSourceField, { label: "\u041C\u0435\u0434\u0438\u0430", source: "file", url: "", onSourceChange: noop, onUrlChange: noop, onFileChange: noop }), ...Object.fromEntries(icons.map((name) => ["icon-" + name, icon(name)])) }).map(([name, node]) => `<template id="ds-${name}">${html(node)}</template>`).join("\n");
const templates = Object.entries({ nestedSurface: h(GlassSurface, {tone:"soft", padding:"md", materialRim:false}, h("span")), dragHandle: h(DragHandle, {label:"Перетащить блок"}), button: h(Button, null, "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435"), iconButton: h(IconButton, { label: "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435" }, icon("plus")), field: h(FieldFrame, { label: "\u041F\u043E\u043B\u0435" }, h("span", { "data-slot": "control" })), text: h(TextField, { id: "template-field", label: "\u041F\u043E\u043B\u0435" }), card: h(SettingsCard, { eyebrow: "\u0420\u0430\u0437\u0434\u0435\u043B", title: "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435", description: "\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435" }, h("div", { "data-slot": "body" })), media: h(MediaSourceField, { label: "\u041C\u0435\u0434\u0438\u0430", source: "file", url: "", onSourceChange: noop, onUrlChange: noop, onFileChange: noop }), ...Object.fromEntries(icons.map((name) => ["icon-" + name, icon(name)])) }).map(([name, node]) => `<template id="ds-${name}">${html(node)}</template>`).join("\n");
const page = `<!doctype html>
<html lang="ru" data-nodedc-ui="true" data-nodedc-theme="dark"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="design-system-commit" content="${lock.sourceCommit}"><title>NODE.DC \u2014 CMS</title><link rel="stylesheet" href="./admin.css"></head><body>${shell}
${await read("modals.html")}
+2 -2
View File
@@ -1,11 +1,11 @@
{
"repository": "https://git.dcserve.ru/SILVER/NODEDC_DESIGN_GUIDELINE.git",
"sourceCommit": "8addef187b316c98751a7d080a7fc37927f9e001",
"sourceCommit": "55fa5fa6bc9db6701acb7c18dd6b998b89d15154",
"distribution": "immutable npm pack artifacts; no copied component sources",
"packages": {
"nodedc-tokens-0.6.0.tgz": "3cfbcec8a10d367688eb1d6e93b774cf2c06b360f465cef6f9866719e5db4616",
"nodedc-ui-dom-0.7.0.tgz": "9a5b01a9e2ee42d52ed94184db0297c047c19783fccd44618cc0dc7ac5f9d6df",
"nodedc-ui-core-0.7.0-flat.2.tgz": "28942cdc7d5b5adaf45985c96fdddebed7b1cbd57b88b3e0b7cda4328a5f2eaf",
"nodedc-ui-react-0.7.0-flat.2.tgz": "8e6e3e577054954265df3c076b173a343e9db39ae704d8266e6a9a0e55b11829"
"nodedc-ui-react-0.7.0-header.2.tgz": "75663592cfc1cb4fab77454801a6d9e053a8f4a30b52c5ad24e6b100c231fc6c"
}
}
+3 -3
View File
@@ -9,7 +9,7 @@
"@nodedc/tokens": "file:vendor/nodedc-tokens-0.6.0.tgz",
"@nodedc/ui-core": "file:vendor/nodedc-ui-core-0.7.0-flat.2.tgz",
"@nodedc/ui-dom": "file:vendor/nodedc-ui-dom-0.7.0.tgz",
"@nodedc/ui-react": "file:vendor/nodedc-ui-react-0.7.0-flat.2.tgz",
"@nodedc/ui-react": "file:vendor/nodedc-ui-react-0.7.0-header.2.tgz",
"esbuild": "0.28.1",
"react": "19.2.7",
"react-dom": "19.2.7"
@@ -507,8 +507,8 @@
},
"node_modules/@nodedc/ui-react": {
"version": "0.7.0",
"resolved": "file:vendor/nodedc-ui-react-0.7.0-flat.2.tgz",
"integrity": "sha512-EsbhCy6VAlSs80TlCow+t7tyHPSME+rd7TZGmtGIBiqSh9t+xKJ5aBwmESsolyP4VyrlhsOsyq2fULhcfXpA2w==",
"resolved": "file:vendor/nodedc-ui-react-0.7.0-header.2.tgz",
"integrity": "sha512-aJ/5dq7Yoghk9GP3+uJRxPnCQHTdhU8lgE0p/+/8OZiE+5GnT71ElFZyCwtTgFcysunM4xcnVThzfY2UXkEOmw==",
"dependencies": {
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
+1 -1
View File
@@ -10,7 +10,7 @@
"@nodedc/tokens": "file:vendor/nodedc-tokens-0.6.0.tgz",
"@nodedc/ui-core": "file:vendor/nodedc-ui-core-0.7.0-flat.2.tgz",
"@nodedc/ui-dom": "file:vendor/nodedc-ui-dom-0.7.0.tgz",
"@nodedc/ui-react": "file:vendor/nodedc-ui-react-0.7.0-flat.2.tgz",
"@nodedc/ui-react": "file:vendor/nodedc-ui-react-0.7.0-header.2.tgz",
"react": "19.2.7",
"react-dom": "19.2.7",
"esbuild": "0.28.1"
-7
View File
@@ -254,13 +254,6 @@ p {
font-size: var(--nodedc-font-size-sm);
font-weight: var(--nodedc-font-weight-strong);
}
.collection-item-card,
.json-details {
border: 0;
border-radius: var(--nodedc-radius-card);
padding: var(--nodedc-space-4);
background: var(--nodedc-panel-item-bg);
}
.collection-summary,
.json-details > summary {
cursor: pointer;
+11
View File
@@ -135,6 +135,17 @@ function fields() {
for (const input of all("input:not([type=hidden]):not([type=checkbox]):not([type=file]):not([type=range]),textarea")) if (!input.closest(".cms-ui-island")) addClass(input, "nodedc-field__control");
}
function cards() {
// Use the library's opaque nested surface: translucent local layers made
// collection backgrounds converge with the field material at greater depth.
for (const region of all(".collection-item-card,.json-details")) {
if (region.dataset.dsSurface) continue;
const surface = clone("nestedSurface");
for (const attribute of surface.attributes) {
if (attribute.name === "class") addClass(region, attribute.value);
else region.setAttribute(attribute.name, attribute.value);
}
region.dataset.dsSurface = "true";
}
for (const card of all(".settings-card,.content-group,.content-panel")) {
if (card.dataset.dsCard) continue;
card.dataset.dsCard = "true";
+2 -5
View File
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react";
import { createRoot } from "react-dom/client";
import { flushSync } from "react-dom";
import { applyNodedcTheme } from "@nodedc/ui-dom";
import { HeaderProfile, UserProfileMenu, IconButton, Icon, FeatureSettingsWindow, SettingsCard, Select, ColorField, Button } from "@nodedc/ui-react";
import { UserProfileMenu, FeatureSettingsWindow, SettingsCard, Select, ColorField, Button } from "@nodedc/ui-react";
const h = React.createElement;
const storageKey = "dc-cms.ui-preferences.v1";
const defaults = { theme: "dark", accent: "#ffffff" };
@@ -39,10 +39,7 @@ function Preferences({ initial }) {
const actions = [{ id: "appearance", label: "Настройки интерфейса", icon: "settings", onSelect: () => setOpen(true) }];
if (session?.authEnabled) actions.push({ id: "logout", label: "Выйти", icon: "external", href: "/auth/logout" });
return h(React.Fragment, null,
h(HeaderProfile, null,
h(UserProfileMenu, { displayName: name, subtitle: user?.email || undefined, avatarUrl: user?.picture || undefined, triggerLabel: "Профиль", triggerIcon: "inbox", actions }),
h(IconButton, { label: "Настройки интерфейса", onClick: () => setOpen(true) }, h(Icon, { name: "settings" }))
),
h(UserProfileMenu, { displayName: name, subtitle: user?.email || undefined, avatarUrl: user?.picture || undefined, triggerLabel: "Профиль", triggerIcon: "inbox", actions }),
h(FeatureSettingsWindow, { open, title: "Настройки", subtitle: "Интерфейс CMS", identity: { title: name, subtitle: "NODE.DC CMS", avatarLabel: name, avatarUrl: user?.picture || undefined }, sections: [{ id: "appearance", label: "Оформление", icon: "settings", group: "Общие" }], activeSection: "appearance", onSectionChange: () => {}, onClose: () => setOpen(false),
footer: h(Button, { onClick: () => update(defaults), tone: "neutral" }, "Сбросить оформление") },
h("div", {className:"cms-preferences-fields"}, h(SettingsCard, { title: "Тема", description: "Светлый или тёмный интерфейс", actions: h("div", { className: "cms-preference-controls" }, h(Select, { label: "Тема интерфейса", value: preferences.theme, options: [{ value: "dark", label: "Тёмная" }, { value: "light", label: "Светлая" }], onChange: theme => update({ theme }) })) }),
Binary file not shown.
Binary file not shown.