Compare commits
21
Commits
c9d8f0ae59
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ccaf032db5 | ||
|
|
9f4b74a6d3 | ||
|
|
5d56f5fe21 | ||
|
|
ff90b633d9 | ||
|
|
944b88f30f | ||
|
|
cf204a73dd | ||
|
|
f0949f5e75 | ||
|
|
5ea737318b | ||
|
|
d86be605a8 | ||
|
|
be8ebe43e7 | ||
|
|
7f25f59d3e | ||
|
|
b208b83d4f | ||
|
|
164499f0bb | ||
|
|
99b9222735 | ||
|
|
aff551e4d4 | ||
|
|
10c2d6a70d | ||
|
|
73bf4639a2 | ||
|
|
8a17013579 | ||
|
|
e9093da9b2 | ||
|
|
4369f0a0cb | ||
|
|
02318ab668 |
@@ -14,3 +14,5 @@ projects/*.publish.log.jsonl
|
||||
|
||||
# Persistent independent site workspaces are runtime data.
|
||||
projects/sites/
|
||||
|
||||
projects/*.publish-state.json*
|
||||
|
||||
+1
-3179
File diff suppressed because one or more lines are too long
+411
-6207
File diff suppressed because one or more lines are too long
+41
-103
File diff suppressed because one or more lines are too long
@@ -0,0 +1,143 @@
|
||||
# CMS and NODE.DC Design Guideline
|
||||
|
||||
CMS consumes the canonical packages from `SILVER/NODEDC_DESIGN_GUIDELINE`.
|
||||
The exact source commit and SHA-256 of each immutable npm package are recorded
|
||||
in `ui/design-system.lock.json`; npm integrity and transitive versions are in
|
||||
`ui/package-lock.json`. The packages in `ui/vendor` are npm distributions, not
|
||||
locally maintained component forks. Update them from the canonical repository.
|
||||
|
||||
## Build and deployment
|
||||
|
||||
```sh
|
||||
npm ci --ignore-scripts --prefix ui
|
||||
node ui/build.mjs
|
||||
node ui/build.mjs --check
|
||||
```
|
||||
|
||||
Edit `ui/`, not generated `admin/index.html`, `admin/admin.js` or `admin/admin.css`.
|
||||
The release qualification repeats the frozen UI install and rejects generated
|
||||
files that differ from the pinned source build. Only the existing flat `admin/`
|
||||
assets enter the canonical CMS release. Root runtime dependencies, Dockerfile,
|
||||
Compose and server behavior are unchanged. A qualified master commit continues
|
||||
through the existing Gitea / NAS autodeploy route.
|
||||
|
||||
## Component ownership
|
||||
|
||||
- AppHeader, HeaderNavigation, HeaderProfile, HeaderAvatar, ApplicationShell,
|
||||
AdminNavigationPanel and ApplicationPanel are rendered directly from ui-react
|
||||
by the build. The optional duplicate workspace mark has been removed.
|
||||
- Select, Switch, RangeControl, ProgressBar, StatusBadge and action Dropdowns
|
||||
run as controlled React islands, using the actual package implementations.
|
||||
- Existing CMS inputs remain hidden form/model bindings. Islands dispatch the
|
||||
original input/change/click events. No storage, upload, publication, SEO or
|
||||
knowledge model is reimplemented in the design adapter.
|
||||
- FieldFrame, Button, IconButton, Icon and SettingsCard anatomy is generated
|
||||
from package exports at build time. Dynamic DOM fields/cards adopt that
|
||||
anatomy while retaining their existing controls and event listeners.
|
||||
- MediaSourceField uses the package's DOM/CSS contract with the existing CMS
|
||||
media-browser callback. The CMS file manager supplies its domain-specific
|
||||
folder columns, usage data, upload and trash operations.
|
||||
- Windows use ui-dom's modal controller and canonical window/glass classes.
|
||||
Application workspace state uses its controller with an explicit application
|
||||
binding for the string-valued shell data attributes.
|
||||
- `ui/src/app.css` owns only CMS content grids, file columns, collection layout,
|
||||
and application action grouping. Tokens and component materials come from
|
||||
ui-core; AppHeader / profile / navigation geometry has no local overrides.
|
||||
|
||||
The compatibility adapter lives in `ui/src/design-system.mjs`. The original
|
||||
business module was moved byte-for-byte to `ui/src/admin.mjs`. Adapters are
|
||||
removed when a domain renderer is migrated to direct React composition; shared
|
||||
component behavior must be changed in Design Guideline, never forked here.
|
||||
|
||||
## Interface organization
|
||||
|
||||
A single site selector and separate settings / preview actions replace the
|
||||
nested workspace card. Content, SEO and knowledge retain separate modes.
|
||||
Technical type badges no longer appear as form controls. Block metadata and
|
||||
reorder/copy/delete actions are in a disclosure above the content editor.
|
||||
Knowledge row actions use the shared Dropdown; the mobile editor uses the same
|
||||
menu for secondary actions and a shared status indicator. Native model inputs
|
||||
remain in forms, preserving IDs, names, validation and model serialization.
|
||||
|
||||
## Verification
|
||||
|
||||
- Frozen deterministic UI build (`--check`) and package SHA-256 checks.
|
||||
- Existing multisite integration suite: 14 passing checks, including isolated
|
||||
edits/rendering/uploads, archive import, encrypted credential transfer,
|
||||
publication target exclusivity, restart persistence and authentication.
|
||||
- Existing release contract suite: 3 passing tests.
|
||||
- Local browser verification on independent fixture copies at 1663px and 390px:
|
||||
site settings, switches, SEO selection/save, knowledge editor, file browser,
|
||||
shared dropdowns, nested dialog Escape, and responsive panel navigation.
|
||||
- Production acceptance is recorded separately after Git deployment.
|
||||
|
||||
## Visual corrections — 2026-11-05
|
||||
|
||||
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 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.
|
||||
|
||||
The site selector uses shared split/pill presentation and short display labels;
|
||||
its separate toggle, preview and settings remain independent controls. The
|
||||
existing Add Block node moves beside Static after each domain navigation render.
|
||||
All drag listeners stay on their original nodes; only the shared DragHandle SVG
|
||||
is adopted. Local content surfaces have no decorative outlines. React-owned
|
||||
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.
|
||||
|
||||
Forms follow the running Mission Core environment settings: SettingsCard owns
|
||||
the group and fields sit directly in its transparent layout grid. A standalone
|
||||
collection entry or native JSON disclosure adopts GlassSurface tone="group",
|
||||
which uses the same neutral material. The content overview is layout rather
|
||||
than another surrounding card. Native details, drag nodes and input bindings
|
||||
stay intact; no CMS-specific colors or component overrides are added.
|
||||
|
||||
|
||||
## Mission Core foundation — 2026-11-05
|
||||
|
||||
Pinned Design Guideline: `189bb7037740f577cc65e72f2b7c07651201ef19`.
|
||||
CMS applies `missionDarkTheme` / `missionLightTheme` at documentElement, so menus
|
||||
and settings portals share the same profile. The library owns all palette values;
|
||||
reset clears a custom accent and returns to the preset. Existing explicit user
|
||||
accent preferences remain supported. The static HTML declares Mission/flat before
|
||||
JavaScript to avoid a flash of the legacy appearance.
|
||||
|
||||
Forms use the same SettingsCard → fields and optional GlassSurface group
|
||||
collection composition as the living catalog. Media-stage and dropdown materials now reference shared
|
||||
tokens. No business module, site data, deployment settings or server API changed.
|
||||
|
||||
Validation: deterministic generated build, multisite and release-contract tests;
|
||||
local browser checks of the reported navigation-link fields, dark/light, settings
|
||||
through the profile menu, custom accent, reset, and Escape focus restoration.
|
||||
|
||||
## Full-width boolean setting rows
|
||||
|
||||
A boolean editable field can declare `layout: "row"` and an optional `title`.
|
||||
The editor uses the shared SettingsCard (title left, Switch right) and Switch,
|
||||
above the following field in schema order. Values continue through the standard
|
||||
model save/render/publish flow; no carousel-specific CMS state or new CSS is
|
||||
introduced. Mission Core uses this for its per-carousel image-opening setting.
|
||||
Local UI acceptance: toggle on → Save → reload retains true, toggle off → Save
|
||||
removes the image links while preserving the other carousels.
|
||||
|
||||
## File manager window and navigation
|
||||
|
||||
The ui-dom package is pinned separately at `1326ec6` (`modal.2` archive) in
|
||||
`ui/design-system.lock.json`; the existing Mission Core palette and other
|
||||
packages keep their original pinned versions. CMS consumes the shared
|
||||
`createModalSizeController` and `renderPathBar` exports, including the package's
|
||||
path-bar stylesheet. The application adapter supplies site paths, standard
|
||||
Icon templates and navigation callbacks. It does not copy either component.
|
||||
Window geometry and appearance persist in the authenticated user's server-side
|
||||
GUI metadata. File type controls reuse IconButton, support combined selection,
|
||||
and switch between the site's flat asset index and existing folder browser.
|
||||
|
||||
Acceptance: mixed image/video/3D filtering, deep-folder search and path navigation,
|
||||
isolation between two sites, 390 px layout, resize/reopen/reload and theme
|
||||
persistence. Source tests cover the flat index's site boundary and exclusions.
|
||||
+79
-1
@@ -6,7 +6,65 @@
|
||||
|
||||
Перенос деплоя сначала отключает исходный проект, затем переносит зашифрованный секрет и параметры хостинга. Получатель остаётся отключённым до явного включения. Два проекта не могут одновременно публиковать в одну или вложенную папку на одном SFTP-аккаунте. После прерывания возможны два отключённых проекта, но не два включённых публикационных направления.
|
||||
|
||||
Сохранение и пересборка отделены от публикации. Автоматическая публикация после пересборки требует двух флагов: `enabled` и `deployOnRender`. Старые настройки без второго флага переходят в ручной режим публикации.
|
||||
«Сохранить» записывает контент или SEO/базу знаний и запускает пересборку. Когда включены `deploy.enabled` и «Публиковать при сохранении» (`deployOnRender`), CMS ставит фоновое задание: собирает главную и базу знаний, фиксирует копию публичных файлов и отправляет её по SFTP. Прогресс и ошибки доступны в редакторе и настройках проекта. Сохранение во время передачи ставит ещё один проход с последней версией; изменения не теряются. Без этих флагов обновляется только предпросмотр.
|
||||
|
||||
«Опубликовать» также сначала собирает обе части сайта. Файлы пропускаются только при совпадении SHA-256 с последней успешной публикацией и метаданных на хостинге; размер и время сами по себе недостаточны для сравнения. Частный файл `projects/<id>.publish-state.json` привязан к конкретному SFTP-направлению, не попадает в сайт и не содержит паролей. Первая публикация после обновления передаёт все файлы, следующие — только изменения. Ошибку передачи можно повторить кнопкой «Опубликовать».
|
||||
|
||||
ZIP нужен для обновления кода и шаблонов локально. Для обычного редактирования текста и изображений повторный импорт не нужен. Новые изображения получают уникальный URL, поэтому кеш браузера не скрывает замену.
|
||||
|
||||
## Скачать бэкап
|
||||
|
||||
В настройках каждого сайта рядом с публикацией доступна кнопка «Скачать бэкап».
|
||||
Она скачивает текущую **сохранённую** копию выбранного сайта: модели контента,
|
||||
SEO и базы знаний, шаблоны, инструменты рендера, готовые страницы и медиа.
|
||||
Несохранённые изменения редактора в архив не входят; скачивание ничего не
|
||||
сохраняет и не публикует. Архив можно вернуть через существующий импорт ZIP.
|
||||
|
||||
Маршрут `POST /s/<id>/api/project/backup` готовит снимок; одноразовый GET
|
||||
по возвращённой ссылке передаёт ZIP штатному загрузчику браузера без Blob в JS.
|
||||
Оба маршрута закрыты общей авторизацией CMS и не принимают произвольный путь
|
||||
к файлам. Невостребованный архив удаляется через 10 минут. Имя содержит ID сайта, дату по Москве
|
||||
и суффикс TECH: `NODEDC_SITE_2026-11-05_MISSION_CORE_TECH.zip`.
|
||||
Это бэкап сайта, а не инсталляции CMS: реквизиты публикации, учётные записи
|
||||
и реестр сайтов находятся отдельно. `.env*`, `*.secrets.json`, `.git`,
|
||||
старые бэкапы, корзина и зависимости исключены; символические ссылки отклоняются.
|
||||
|
||||
Подготовка блокирует одновременную запись, импорт и публикацию этого сайта.
|
||||
Файлы и их состав проверяются повторно: при внешнем изменении скачивание
|
||||
возвращает ошибку с предложением повторить. Готовый ZIP передаётся из приватной
|
||||
временной папки, которая удаляется после передачи или отключения клиента.
|
||||
ZIP собирается потоково методом STORE, без полной копии медиа в памяти и новых
|
||||
runtime-зависимостей. Лимит — 2 ГБ и 60 000 файлов. После подготовки снимка
|
||||
обычное редактирование снова доступно, пока браузер скачивает архив.
|
||||
|
||||
Проверки: `test/backup.test.mjs` сверяет ZIP/CRC, UTF-8 имена, медиа, исключения,
|
||||
ссылки и отмену; `test/multisite.test.mjs` скачивает оба сайта, проверяет
|
||||
изоляцию и авторизацию и импортирует полученный ZIP обратно в тестовый сайт.
|
||||
|
||||
## Файлы сайта
|
||||
|
||||
Кнопка «Файлы» в верхней навигации открывает существующий файловый менеджер
|
||||
для выбранного сайта. В заголовке указано имя сайта; список, загрузки, корзина,
|
||||
скачивание и запомненная папка изолированы по `/s/<site-id>/`. Просмотр и загрузка
|
||||
в этом режиме не подставляют файл в открытое поле и не меняют черновик страницы.
|
||||
Загрузки без привязки к полю сохраняются в `assets/uploads/media/library`.
|
||||
|
||||
Менеджер из шапки открывается общей сеткой файлов из всех вложенных каталогов
|
||||
`assets`. Фильтры-иконки изображений, видео и 3D можно сочетать; «Все» сбрасывает
|
||||
выбор типов. Поиск проверяет имя и полный путь. Справа переключается общий
|
||||
список и просмотр папок. Нижняя строка пути использует общий `renderPathBar`:
|
||||
нейтральные иконки папок, компактные названия и переход по любому каталогу.
|
||||
Выбор файла показывает его полный путь, исходное имя и кнопку скачивания.
|
||||
Индекс исключает скрытые/служебные каталоги и символические ссылки, не выходит
|
||||
за пределы выбранного сайта. Обычный picker сохраняет ограничение типа поля.
|
||||
|
||||
После выбора файла кнопка «Скачать» передаёт его исходные байты и имя через
|
||||
авторизованный `GET /s/<site-id>/api/media/download?path=assets/...`.
|
||||
Видео передаются потоком без сборки ZIP и без загрузки целого файла в память
|
||||
браузера. Доступны публичные файлы `assets`; директории, скрытые/служебные
|
||||
пути и символические ссылки запрещены. Для удалённого файла сначала требуется
|
||||
восстановление из корзины. Кнопка скачивания доступна также в обычном выборе
|
||||
изображения, включая Open Graph. Публикация сайта остаётся отдельным действием.
|
||||
|
||||
## Git
|
||||
|
||||
@@ -14,8 +72,28 @@ Workflow `.gitea/workflows/ci.yml` квалифицирует точный commi
|
||||
|
||||
Отдельный исходящий контроллер NAS читает успешные Actions-запуски только репозитория SILVER/DC_CMS (33), проверяет предков и неизменность артефакта. Канонический root-runner обновляет только cms-app, сохраняет остальные контейнеры и данные и при ошибке восстанавливает прежний образ без сборки. Первый запуск требует отдельной регистрации серверного компонента; наличие workflow в Git само по себе не означает включённый автоматический деплой.
|
||||
|
||||
Серверная регистрация выполнена 04.11.2026: отдельный `synology-cms-build` квалифицирует сборки, а исходящий таймер NAS забирает результат без новых входящих портов. Для обычного релиза достаточно отправить новый коммит в `master`. Успешный Actions означает готовность пакета; завершение установки подтверждает запись `dc-cms-release` в каноническом журнале NAS, затем проверяется пользовательский сценарий в CMS.
|
||||
|
||||
Неудачный запуск r39 сохранён в истории и не подлежит повтору. Каноническое восстановление `dc-cms-r39-runtime-reconciliation-v2-20261104-001` подтвердило исходные файлы и образ, а также точное совпадение прежнего runtime с учётом порядка bind-mount и двух представлений пустых DNS-массивов. Контроллер снял блокировку только после успешной записи восстановления. Следующий релиз получает новый commit, run ID и пакет; архив r39 остаётся неизменным.
|
||||
|
||||
Запуск r40 прошёл квалификацию, но новый образ изменил `config.Env`; штатный откат полностью восстановил прежнюю CMS. Повтор r40 запрещён. Следующий выпуск требует исправленного серверного сборщика: точная локальная база Node определяется по слоям и конфигурации принятого образа, временный Dockerfile закрепляет её immutable ID, а окружение нового образа проверяется до пересоздания сервиса. Исходный Dockerfile, Compose, секреты и проверки runtime сохраняются. Обновление самой базы Node требует отдельного контракта, обычный коммит CMS его не выполняет.
|
||||
|
||||
Если автоматическая установка откатилась успешно, исправление выпускается новым коммитом. Если восстановление не подтверждено, очередь останавливается для проверки канонического журнала. Не следует вручную перезапускать контейнеры, менять production-файлы или повторно применять прежний пакет. Образ, постоянные данные, настройки и секреты проверяет серверный runner; эти данные не передаются в CI.
|
||||
|
||||
Обычный релиз содержит файлы admin/server, дескриптор и два файла зависимостей с заранее зарегистрированными SHA-256. Первый переход обновляет adm-zip с уязвимой версии 0.5.x до 0.6.1; дальнейшие релизы обязаны сохранять этот lockfile. Изменения Dockerfile, зависимостей и Compose требуют отдельного пересмотра серверного контракта. Сборочный контекст содержит пустой projects: настройки, пароли и содержимое сайтов не попадают в образ.
|
||||
|
||||
05.11.2026 в 07:18:18 UTC выпуск r41 (`4369f0a`) установлен автоматически: канонический applied receipt, SHA архива и backup совпали. Серверный runner `1c7bd863fe39` восстановил точную зарегистрированную Node-базу по immutable digest после проверки слоёв и конфигурации. При наличии подходящей локальной базы сеть не нужна; preflight сам ничего не скачивает. Релиз меняет только CMS, публикация сайтов остаётся отдельным действием.
|
||||
|
||||
Первый пользовательский сценарий выявил отличие Node 24.18 от Node 22 в CI: `cp` с `errorOnExist` отклоняет уже зарезервированную директорию назначения. Копирование выполняется по дочерним элементам, сохраняя эксклюзивную резервацию корня и запрет перезаписи. Проверены существующий чужой каталог, очистка собственной незавершённой копии, запрет symlink и повтор создания после исправления источника. Этот forward fix проходит обычный маршрут через новый Git commit, без замены root-runner.
|
||||
|
||||
## Проверка
|
||||
|
||||
`node --test test/multisite.test.mjs` проверяет изоляцию контента, медиа, рендера и ссылок предпросмотра, секреты, конфликт направлений, перезапуск и авторизацию. `python3 -m unittest discover -s infra/ci -p 'test_*.py'` проверяет формат пакета и запрет runtime-файлов.
|
||||
|
||||
## Пользовательские настройки интерфейса
|
||||
|
||||
`GET/PATCH /api/user/preferences` использует текущую авторизованную сессию; идентификатор пользователя не принимается из запроса. Файл: `<CMS_PROJECTS_ROOT>/.user-meta/<sha256(principal)>.json`, права 0600. Каталог находится в существующем persistent mount, вне корней сайтов, публикации и ZIP-бэкапов. В режиме без авторизации используется отдельный локальный профиль.
|
||||
|
||||
Схема: `schemaVersion: 1`, `appearance: {theme, accent}`, `gui: {modals: {"media-library": {width, height}}}`. PATCH объединяет независимые поля последовательно на пользователя; запись атомарная. `null` у ключа модального окна сбрасывает его размер. Тема из прежнего localStorage импортируется один раз при отсутствии серверного профиля.
|
||||
|
||||
Файловый менеджер использует общий `createModalSizeController`: края/углы мышью, Shift + стрелки при фокусе на шапке. Сохраняется завершённый resize. Подгонка под меньший экран не перезаписывает предпочтительный размер. Геометрия общая для сайтов текущего пользователя; контент менеджера по-прежнему изолирован по сайту. Ошибка записи отображается с повтором, закрытие окна не блокируется.
|
||||
|
||||
+4
-1
@@ -55,10 +55,13 @@ def main():
|
||||
dirty=subprocess.check_output(['git','status','--porcelain','--untracked-files=no'],cwd=ROOT)
|
||||
if head!=args.commit or dirty: raise ValueError('qualification requires exact clean commit')
|
||||
run(['npm','ci','--ignore-scripts'])
|
||||
# UI build dependencies never enter the production package foundation.
|
||||
run(['npm','ci','--ignore-scripts','--prefix','ui'])
|
||||
run(['node','ui/build.mjs','--check'])
|
||||
files=tracked_payload()
|
||||
for name in files:
|
||||
if name.endswith(('.js','.mjs')): run(['node','--check',name])
|
||||
run(['node','--test','test/multisite.test.mjs'])
|
||||
run(['node','--test','test/multisite.test.mjs','test/publication.test.mjs','test/backup.test.mjs','test/user-preferences.test.mjs'])
|
||||
run(['python3','-m','unittest','discover','-s','infra/ci','-p','test_*.py'])
|
||||
# The ordinary release cannot change its build, dependency or deployment foundation.
|
||||
foundation={name:digest((ROOT/name).read_bytes()) for name in ['Dockerfile','package.json','package-lock.json','infra/docker-compose.yml']}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import { constants } from "node:fs";
|
||||
import { lstat, open } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
|
||||
// Downloads belong to one site and contain only its public assets. In particular,
|
||||
// never follow a symlink into another site's files, CMS settings or credentials.
|
||||
export async function openMediaDownload(siteRoot, path) {
|
||||
const segments = String(path || "").split("/");
|
||||
if (segments.length < 2 || segments[0] !== "assets" || segments.some(segment =>
|
||||
!segment || segment.startsWith(".") || segment === "node_modules" || /[\\\x00-\x1f\x7f]/.test(segment)
|
||||
)) {
|
||||
throw Object.assign(new Error("Скачивание доступно только для файлов медиатеки текущего сайта"), { status: 403 });
|
||||
}
|
||||
|
||||
let absolutePath = siteRoot;
|
||||
for (const segment of segments) {
|
||||
absolutePath = join(absolutePath, segment);
|
||||
const info = await lstat(absolutePath);
|
||||
if (info.isSymbolicLink()) {
|
||||
throw Object.assign(new Error("Скачивание по символической ссылке запрещено"), { status: 403 });
|
||||
}
|
||||
if (!info.isDirectory() && !info.isFile()) throw Object.assign(new Error("Выберите файл для скачивания"), { status: 400 });
|
||||
}
|
||||
const handle = await open(absolutePath, constants.O_RDONLY | constants.O_NOFOLLOW);
|
||||
try {
|
||||
const info = await handle.stat();
|
||||
if (!info.isFile()) throw Object.assign(new Error("Выберите файл для скачивания"), { status: 400 });
|
||||
const name = segments.at(-1);
|
||||
const fallback = name.replace(/[^a-zA-Z0-9._-]/g, "_");
|
||||
const encoded = encodeURIComponent(name).replace(/[!'()*]/g, char => `%${char.charCodeAt(0).toString(16).toUpperCase()}`);
|
||||
return {
|
||||
handle,
|
||||
headers: {
|
||||
"content-type": "application/octet-stream",
|
||||
"content-disposition": `attachment; filename="${fallback}"; filename*=UTF-8''${encoded}`,
|
||||
"content-length": info.size,
|
||||
"cache-control": "no-store",
|
||||
"x-content-type-options": "nosniff",
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
await handle.close();
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import { dirname, join, resolve, posix, relative } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { randomBytes } from "node:crypto";
|
||||
import { createSiteApplication } from "./site-app.mjs";
|
||||
import { UserPreferencesStore } from "./user-preferences.mjs";
|
||||
|
||||
const cmsRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const projectsRoot = resolve(process.env.CMS_PROJECTS_ROOT || join(cmsRoot, "projects"));
|
||||
@@ -87,7 +88,10 @@ async function createSite(payload) {
|
||||
await mkdir(root); // Reservation: never overwrite an existing tree.
|
||||
source.writes++;
|
||||
try {
|
||||
await cp(source.root, root, {
|
||||
if ((await lstat(source.root)).isSymbolicLink()) throw fail("Копирование сайта с символическими ссылками не поддерживается");
|
||||
// The destination root is our reservation. Node 24 rejects cp onto an
|
||||
// existing directory with errorOnExist, so copy its children separately.
|
||||
for (const entry of await readdir(source.root)) await cp(join(source.root, entry), join(root, entry), {
|
||||
recursive: true, force: false, errorOnExist: true,
|
||||
filter: async path => {
|
||||
const parts = relative(source.root, path).split(/[\\/]/);
|
||||
@@ -147,6 +151,7 @@ function json(res, status, payload) {
|
||||
}
|
||||
await mkdir(projectsRoot, { recursive: true });
|
||||
const auth = await application(defaultId);
|
||||
const userPreferences = new UserPreferencesStore(projectsRoot);
|
||||
const server = createServer(async (req, res) => {
|
||||
try {
|
||||
const url = new URL(req.url, "http://cms.local");
|
||||
@@ -157,6 +162,12 @@ const server = createServer(async (req, res) => {
|
||||
const expected = new URL(process.env.CMS_BASE_URL || `http://${req.headers.host}`).origin;
|
||||
if (req.headers["sec-fetch-site"] === "cross-site" || (origin && origin !== expected)) throw fail("Недопустимый источник запроса", 403);
|
||||
}
|
||||
if (url.pathname === "/api/user/preferences") {
|
||||
const principal = auth.authEnabled ? (req.cmsUser?.sub ? `oidc:${req.cmsUser.sub}` : null) : 'local:no-auth';
|
||||
if (req.method === 'GET') return json(res, 200, { ok: true, ...await userPreferences.read(principal) });
|
||||
if (req.method === 'PATCH') return json(res, 200, { ok: true, ...await userPreferences.patch(principal, await body(req), { ifAbsent: req.headers['if-none-match'] === '*' }) });
|
||||
throw fail('Метод не поддерживается', 405);
|
||||
}
|
||||
if (url.pathname === "/api/sites") {
|
||||
if (req.method === "GET") return json(res, 200, { ok: true, sites: await siteList() });
|
||||
if (req.method === "POST") return json(res, 201, { ok: true, project: await createSite(await body(req)) });
|
||||
|
||||
+163
-60
@@ -1,5 +1,6 @@
|
||||
import { createReadStream, statSync } from "node:fs";
|
||||
import { appendFile, copyFile, cp, mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
||||
import { appendFile, copyFile, cp, lstat, mkdir, mkdtemp, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { extname, join, normalize, relative, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { spawn } from "node:child_process";
|
||||
@@ -8,6 +9,9 @@ import { createCipheriv, createDecipheriv, createHash, createHmac, randomBytes,
|
||||
import { createLocalJWKSet, jwtVerify } from "jose";
|
||||
import SftpClient from "ssh2-sftp-client";
|
||||
import AdmZip from "adm-zip";
|
||||
import { pipeline } from "node:stream/promises";
|
||||
import { createSiteBackup, siteBackupFilename } from "./site-backup.mjs";
|
||||
import { openMediaDownload } from "./media-download.mjs";
|
||||
|
||||
const cmsRoot = join(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const port = Number(process.env.PORT || 8090);
|
||||
@@ -17,7 +21,10 @@ const activeProjectId = projectId;
|
||||
const projectConfigPath = join(projectsRoot, `${activeProjectId}.json`);
|
||||
const projectSecretsPath = join(projectsRoot, `${activeProjectId}.secrets.json`);
|
||||
const publishLogPath = join(projectsRoot, `${activeProjectId}.publish.log.jsonl`);
|
||||
const publishStatePath = join(projectsRoot, `${activeProjectId}.publish-state.json`);
|
||||
const publishJobs = new Map();
|
||||
let backupRunning = false;
|
||||
let preparedBackup = null;
|
||||
const PUBLISH_JOB_RETENTION_MS = 24 * 60 * 60 * 1000;
|
||||
|
||||
async function loadProjectConfig() {
|
||||
@@ -57,36 +64,7 @@ const trashStores = [
|
||||
displayPrefix: "assets/uploads/.trash",
|
||||
},
|
||||
];
|
||||
const mediaRoots = [
|
||||
{
|
||||
id: "uploads",
|
||||
label: "Uploads",
|
||||
rootPath: uploadRoot,
|
||||
urlPrefix: "./assets/uploads",
|
||||
writable: true,
|
||||
},
|
||||
{
|
||||
id: "media",
|
||||
label: "Legacy media",
|
||||
rootPath: join(repoRoot, "assets", "media"),
|
||||
urlPrefix: "./assets/media",
|
||||
writable: true,
|
||||
},
|
||||
{
|
||||
id: "site-images",
|
||||
label: "Site images",
|
||||
rootPath: join(repoRoot, "assets", "site", "images"),
|
||||
urlPrefix: "./assets/site/images",
|
||||
writable: true,
|
||||
},
|
||||
{
|
||||
id: "custom-assets",
|
||||
label: "Custom assets",
|
||||
rootPath: join(repoRoot, "assets", "custom"),
|
||||
urlPrefix: "./assets/custom",
|
||||
writable: true,
|
||||
},
|
||||
];
|
||||
const mediaRoots = [{ id: "assets", label: "Файлы сайта", rootPath: join(repoRoot, "assets"), urlPrefix: "./assets", writable: true }];
|
||||
const MEDIA_EXTENSIONS = new Set([
|
||||
".avif",
|
||||
".gif",
|
||||
@@ -1357,16 +1335,19 @@ async function scanMediaRoot(root) {
|
||||
let entries = [];
|
||||
|
||||
try {
|
||||
const directoryStat = await lstat(directory);
|
||||
if (!directoryStat.isDirectory() || directoryStat.isSymbolicLink()) return;
|
||||
entries = await readdir(directory, { withFileTypes: true });
|
||||
} catch {
|
||||
return;
|
||||
} catch (error) {
|
||||
if (error.code === "ENOENT") return;
|
||||
throw error;
|
||||
}
|
||||
|
||||
for (const entry of entries) {
|
||||
const filePath = join(directory, entry.name);
|
||||
const relativePath = relative(root.rootPath, filePath).replace(/\\/g, "/");
|
||||
|
||||
if (!relativePath || relativePath.split("/").includes(".trash")) continue;
|
||||
if (!relativePath || relativePath.split("/").some(part => part.startsWith(".") || BROWSER_EXCLUDED_DIRS.has(part))) continue;
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
await walk(filePath);
|
||||
@@ -1384,6 +1365,9 @@ async function scanMediaRoot(root) {
|
||||
|
||||
files.push({
|
||||
id: `${root.id}:${relativePath}`,
|
||||
type: "file",
|
||||
path: relative(repoRoot, filePath).replace(/\\/g, "/"),
|
||||
selectable: true,
|
||||
rootId: root.id,
|
||||
rootLabel: root.label,
|
||||
writable: root.writable,
|
||||
@@ -1778,17 +1762,29 @@ async function ensureRemoteDirectory(client, path, cache) {
|
||||
cache.add(normalized);
|
||||
}
|
||||
|
||||
async function shouldSkipRemoteFile(client, localFile, remotePath) {
|
||||
async function fileDigest(path) {
|
||||
const hash = createHash("sha256");
|
||||
for await (const chunk of createReadStream(path)) hash.update(chunk);
|
||||
return hash.digest("hex");
|
||||
}
|
||||
|
||||
async function shouldSkipRemoteFile(client, localFile, remotePath, previous) {
|
||||
// SFTP timestamps have second precision: equal size + mtime loses one-letter edits.
|
||||
if (previous?.sha256 !== localFile.sha256) return false;
|
||||
try {
|
||||
const remoteStat = await client.stat(remotePath);
|
||||
if (!remoteStat || Number(remoteStat.size) !== localFile.size) return false;
|
||||
const remoteMtime = Number(remoteStat.modifyTime || remoteStat.mtime || 0);
|
||||
return remoteMtime && remoteMtime >= localFile.mtimeMs - 1000;
|
||||
return Number(remoteStat.size) === localFile.size
|
||||
&& Number(remoteStat.modifyTime || remoteStat.mtime || 0) === previous.remoteMtime;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function buildPublicSite() {
|
||||
await runNodeScript("render-home.mjs");
|
||||
await runNodeScript("render-knowledge.mjs");
|
||||
}
|
||||
|
||||
function publishJobPercent(job) {
|
||||
if (job.state === "completed") return 100;
|
||||
if (!job.totalBytes) return 0;
|
||||
@@ -1801,6 +1797,7 @@ function publicPublishJob(job) {
|
||||
id: job.id,
|
||||
state: job.state,
|
||||
rendered: job.rendered,
|
||||
pendingChanges: Boolean(job.rerunRequested),
|
||||
host: job.host,
|
||||
remoteRoot: job.remoteRoot,
|
||||
totalFiles: job.totalFiles,
|
||||
@@ -1865,7 +1862,9 @@ async function publishProject(options = {}) {
|
||||
publishing = true;
|
||||
try {
|
||||
await hooks.validateDeploy(activeProjectId, projectConfig);
|
||||
return await performPublish(options);
|
||||
if (options.job) touchPublishJob(options.job, { state: "building" });
|
||||
await buildPublicSite();
|
||||
return await performPublish({ ...options, rendered: true });
|
||||
} finally { publishing = false; }
|
||||
}
|
||||
|
||||
@@ -1874,7 +1873,17 @@ async function performPublish({ rendered = false, job = null } = {}) {
|
||||
const files = await collectPublicDeployFiles();
|
||||
if (!files.length) throw new Error("Нет публичных файлов для публикации");
|
||||
|
||||
const client = new SftpClient();
|
||||
const client = hooks.createSftpClient ? hooks.createSftpClient() : new SftpClient();
|
||||
const destination = createHash("sha256").update(JSON.stringify([
|
||||
deployConfig.host, deployConfig.port, deployConfig.username, deployConfig.remoteRoot,
|
||||
])).digest("hex");
|
||||
const savedState = await readFile(publishStatePath, "utf8").then(JSON.parse).catch((error) => {
|
||||
if (error.code === "ENOENT" || error instanceof SyntaxError) return {};
|
||||
throw error;
|
||||
});
|
||||
const previousFiles = savedState.destination === destination ? savedState.files || {} : {};
|
||||
const nextFiles = {};
|
||||
const snapshotRoot = await mkdtemp(join(tmpdir(), "dc-cms-publish-"));
|
||||
const directoryCache = new Set();
|
||||
const report = {
|
||||
ok: true,
|
||||
@@ -1903,6 +1912,18 @@ async function performPublish({ rendered = false, job = null } = {}) {
|
||||
}
|
||||
|
||||
try {
|
||||
// Freeze bytes for this pass. Edits arriving during transfer schedule a new pass.
|
||||
if (job) touchPublishJob(job, { state: "scanning", rendered: true });
|
||||
for (const file of files) {
|
||||
const snapshotPath = join(snapshotRoot, file.relativePath);
|
||||
await mkdir(dirname(snapshotPath), { recursive: true });
|
||||
await copyFile(file.absolutePath, snapshotPath);
|
||||
file.absolutePath = snapshotPath;
|
||||
file.size = (await stat(snapshotPath)).size;
|
||||
file.sha256 = await fileDigest(snapshotPath);
|
||||
}
|
||||
report.totalBytes = files.reduce((sum, file) => sum + file.size, 0);
|
||||
if (job) touchPublishJob(job, { state: "connecting", totalBytes: report.totalBytes });
|
||||
await client.connect({
|
||||
host: deployConfig.host,
|
||||
port: deployConfig.port,
|
||||
@@ -1927,7 +1948,8 @@ async function performPublish({ rendered = false, job = null } = {}) {
|
||||
}
|
||||
await ensureRemoteDirectory(client, remoteParent(remotePath), directoryCache);
|
||||
|
||||
if (await shouldSkipRemoteFile(client, file, remotePath)) {
|
||||
if (await shouldSkipRemoteFile(client, file, remotePath, previousFiles[file.relativePath])) {
|
||||
nextFiles[file.relativePath] = previousFiles[file.relativePath];
|
||||
report.skippedFiles += 1;
|
||||
report.skippedBytes += file.size;
|
||||
report.processedFiles += 1;
|
||||
@@ -1954,6 +1976,12 @@ async function performPublish({ rendered = false, job = null } = {}) {
|
||||
});
|
||||
},
|
||||
});
|
||||
const remoteStat = await client.stat(remotePath);
|
||||
if (Number(remoteStat.size) !== file.size) throw new Error(`Неполная передача: ${file.relativePath}`);
|
||||
nextFiles[file.relativePath] = {
|
||||
sha256: file.sha256,
|
||||
remoteMtime: Number(remoteStat.modifyTime || remoteStat.mtime || 0),
|
||||
};
|
||||
report.uploadedFiles += 1;
|
||||
report.uploadedBytes += file.size;
|
||||
report.processedFiles += 1;
|
||||
@@ -1969,19 +1997,26 @@ async function performPublish({ rendered = false, job = null } = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
const nextStatePath = `${publishStatePath}.tmp`;
|
||||
await writeFile(nextStatePath, JSON.stringify({ destination, files: nextFiles }), { mode: 0o600 });
|
||||
await rename(nextStatePath, publishStatePath);
|
||||
report.totalLabel = formatProjectSize(report.totalBytes);
|
||||
report.uploadedLabel = formatProjectSize(report.uploadedBytes);
|
||||
report.skippedLabel = formatProjectSize(report.skippedBytes);
|
||||
return report;
|
||||
} finally {
|
||||
await client.end().catch(() => {});
|
||||
await rm(snapshotRoot, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
|
||||
function startPublishJob({ rendered = false } = {}) {
|
||||
cleanupPublishJobs();
|
||||
const activeJob = activePublishJob();
|
||||
if (activeJob) return { job: publicPublishJob(activeJob), reused: true };
|
||||
if (activeJob) {
|
||||
touchPublishJob(activeJob, { rerunRequested: true });
|
||||
return { job: publicPublishJob(activeJob), reused: true };
|
||||
}
|
||||
|
||||
const now = new Date().toISOString();
|
||||
const job = {
|
||||
@@ -2011,8 +2046,16 @@ function startPublishJob({ rendered = false } = {}) {
|
||||
|
||||
void (async () => {
|
||||
try {
|
||||
touchPublishJob(job, { state: "scanning" });
|
||||
const report = await publishProject({ rendered, job });
|
||||
let report;
|
||||
do {
|
||||
touchPublishJob(job, {
|
||||
state: "building", rerunRequested: false,
|
||||
processedFiles: 0, processedBytes: 0, uploadedFiles: 0, uploadedBytes: 0,
|
||||
skippedFiles: 0, skippedBytes: 0, totalFiles: 0, totalBytes: 0,
|
||||
currentFile: "", currentFileBytes: 0, currentFileSize: 0,
|
||||
});
|
||||
report = await publishProject({ rendered, job });
|
||||
} while (job.rerunRequested);
|
||||
touchPublishJob(job, {
|
||||
state: "completed",
|
||||
processedFiles: report.totalFiles,
|
||||
@@ -2061,19 +2104,11 @@ async function recentPublishLog(limit = 20) {
|
||||
.reverse();
|
||||
}
|
||||
|
||||
async function maybePublishAfterRender(renderResult) {
|
||||
if (!projectConfig.deploy?.enabled || !projectConfig.deploy?.deployOnRender) {
|
||||
return {
|
||||
publish: null,
|
||||
...renderResult,
|
||||
};
|
||||
async function renderAndMaybePublish(scriptName) {
|
||||
if (projectConfig.deploy?.enabled && projectConfig.deploy?.deployOnRender) {
|
||||
return { publish: null, publishJob: startPublishJob().job };
|
||||
}
|
||||
|
||||
const publish = await publishProject({ rendered: true });
|
||||
return {
|
||||
publish,
|
||||
...renderResult,
|
||||
};
|
||||
return { publish: null, ...(await runNodeScript(scriptName)) };
|
||||
}
|
||||
|
||||
function resolveBrowserEntry(value) {
|
||||
@@ -2846,6 +2881,60 @@ async function handle(req, res) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (req.method === "POST" && url.pathname === "/api/project/backup") {
|
||||
if (!ensureSiteReady(res)) return;
|
||||
if (backupRunning) {
|
||||
sendJson(res, 409, { ok: false, error: "Бэкап этого сайта уже готовится или скачивается" });
|
||||
return;
|
||||
}
|
||||
backupRunning = true;
|
||||
const abort = new AbortController();
|
||||
const onClose = () => abort.abort();
|
||||
res.once("close", onClose);
|
||||
try {
|
||||
const backup = await createSiteBackup(repoRoot, { required: REQUIRED_SITE_FILES.map(file => file.label), signal: abort.signal });
|
||||
res.off("close", onClose);
|
||||
if (res.destroyed) { await backup.cleanup(); backupRunning = false; return; }
|
||||
const token = randomBytes(24).toString("hex");
|
||||
const fileName = siteBackupFilename(activeProjectId);
|
||||
const release = async () => {
|
||||
if (preparedBackup?.token === token) preparedBackup = null;
|
||||
try { await backup.cleanup(); } finally { backupRunning = false; }
|
||||
};
|
||||
const timer = setTimeout(() => release().catch(error => console.error("Backup cleanup failed", error)), 10 * 60 * 1000);
|
||||
timer.unref();
|
||||
preparedBackup = { ...backup, token, fileName, timer, release, claimed: false };
|
||||
sendJson(res, 200, { ok: true, fileName, files: backup.files, bytes: backup.size, downloadUrl: `/api/project/backup?token=${token}` });
|
||||
} catch (error) {
|
||||
res.off("close", onClose); backupRunning = false;
|
||||
if (!res.destroyed) throw error;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (req.method === "GET" && url.pathname === "/api/project/backup") {
|
||||
const backup = preparedBackup;
|
||||
if (!backup || backup.claimed || url.searchParams.get("token") !== backup.token) {
|
||||
sendJson(res, 404, { ok: false, error: "Бэкап недоступен. Нажмите «Скачать бэкап» ещё раз" });
|
||||
return;
|
||||
}
|
||||
backup.claimed = true; clearTimeout(backup.timer);
|
||||
res.writeHead(200, {
|
||||
"content-type": "application/zip",
|
||||
"content-disposition": `attachment; filename="${backup.fileName}"`,
|
||||
"content-length": backup.size,
|
||||
"cache-control": "no-store",
|
||||
"x-content-type-options": "nosniff",
|
||||
"referrer-policy": "no-referrer",
|
||||
});
|
||||
// Native browser download streams an immutable ZIP without a JS Blob.
|
||||
pipeline(createReadStream(backup.path), res)
|
||||
.catch(() => {})
|
||||
.finally(backup.release)
|
||||
.catch(error => console.error("Backup cleanup failed", error));
|
||||
return;
|
||||
}
|
||||
|
||||
if (req.method === "POST" && url.pathname === "/api/project/publish") {
|
||||
if (!ensureSiteReady(res)) return;
|
||||
const publish = await publishProject();
|
||||
@@ -2923,6 +3012,21 @@ async function handle(req, res) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (req.method === "GET" && url.pathname === "/api/media/download") {
|
||||
let download;
|
||||
try {
|
||||
download = await openMediaDownload(repoRoot, url.searchParams.get("path"));
|
||||
} catch (error) {
|
||||
const status = error.status || (["ENOENT", "ENOTDIR"].includes(error.code) ? 404 : 500);
|
||||
sendJson(res, status, { ok: false, error: status === 404 ? "Файл не найден" : status === 500 ? "Не удалось скачать файл" : error.message });
|
||||
return;
|
||||
}
|
||||
res.writeHead(200, download.headers);
|
||||
// Stream large videos directly to the browser; do not hold a Blob in memory.
|
||||
pipeline(download.handle.createReadStream(), res).catch(() => {});
|
||||
return;
|
||||
}
|
||||
|
||||
if (req.method === "GET" && url.pathname === "/api/media/site-size") {
|
||||
sendJson(res, 200, await calculateProjectSize());
|
||||
return;
|
||||
@@ -2954,15 +3058,13 @@ async function handle(req, res) {
|
||||
|
||||
if (req.method === "POST" && url.pathname === "/api/render/home") {
|
||||
if (!ensureSiteReady(res)) return;
|
||||
const result = await runNodeScript("render-home.mjs");
|
||||
sendJson(res, 200, { ok: true, ...(await maybePublishAfterRender(result)) });
|
||||
sendJson(res, 200, { ok: true, ...(await renderAndMaybePublish("render-home.mjs")) });
|
||||
return;
|
||||
}
|
||||
|
||||
if (req.method === "POST" && url.pathname === "/api/render/knowledge") {
|
||||
if (!ensureSiteReady(res)) return;
|
||||
const result = await runNodeScript("render-knowledge.mjs");
|
||||
sendJson(res, 200, { ok: true, ...(await maybePublishAfterRender(result)) });
|
||||
sendJson(res, 200, { ok: true, ...(await renderAndMaybePublish("render-knowledge.mjs")) });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3041,6 +3143,7 @@ async function handle(req, res) {
|
||||
}
|
||||
return {
|
||||
handle, handleAuthRoute, authorizeRequest,
|
||||
authEnabled: authConfig.enabled,
|
||||
config: () => structuredClone(projectConfig),
|
||||
publicConfig: publicProjectConfig,
|
||||
root: repoRoot,
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
import { constants } from 'node:fs';
|
||||
import { lstat, mkdtemp, open, readdir, rm } from 'node:fs/promises';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
import { crc32 } from 'node:zlib';
|
||||
|
||||
const excluded = new Set(['.git', '.cms-backups', '.trash', 'node_modules', '.DS_Store', '__MACOSX']);
|
||||
const skip = name => excluded.has(name) || name.startsWith('._') || name === '.env' || name.startsWith('.env.') || name.endsWith('.secrets.json');
|
||||
const fail = (message, status = 409) => Object.assign(new Error(message), { status });
|
||||
const signature = s => `${s.dev}:${s.ino}:${s.size}:${s.mtimeNs}:${s.ctimeNs}`;
|
||||
const MAX_BYTES = 2 * 1024 ** 3;
|
||||
|
||||
// STORE is intentional: site media is already compressed. Write in bounded
|
||||
// chunks rather than loading hundreds of MB into the CMS process or blocking it.
|
||||
export async function createSiteBackup(root, { required = [], signal } = {}) {
|
||||
async function scan(directory = root, prefix = '') {
|
||||
signal?.throwIfAborted();
|
||||
const directoryStat = await lstat(directory);
|
||||
if (!directoryStat.isDirectory() || directoryStat.isSymbolicLink()) throw fail('Бэкап сайта с символическими ссылками не поддерживается');
|
||||
const result = [];
|
||||
for (const entry of (await readdir(directory, { withFileTypes: true })).sort((a, b) => a.name.localeCompare(b.name, 'en'))) {
|
||||
if (skip(entry.name)) continue;
|
||||
const path = join(directory, entry.name), name = prefix + entry.name;
|
||||
if (entry.name.includes('\\') || Buffer.byteLength(name) > 65535) throw fail('Недопустимый путь в сайте');
|
||||
if (entry.isSymbolicLink()) throw fail('Бэкап сайта с символическими ссылками не поддерживается');
|
||||
if (entry.isDirectory()) result.push(...await scan(path, name + '/'));
|
||||
else if (entry.isFile()) {
|
||||
const info = await lstat(path, { bigint: true });
|
||||
result.push({ name, path, size: Number(info.size), stamp: signature(info), modified: new Date(Number(info.mtimeMs)) });
|
||||
} else throw fail('Бэкап поддерживает только обычные файлы и папки');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
const files = await scan();
|
||||
if (!files.length || files.length > 60000 || files.reduce((n, f) => n + f.size, 0) > MAX_BYTES) throw fail('Бэкап поддерживает сайты до 2 ГБ и 60 000 файлов', 413);
|
||||
if (required.some(name => !files.some(file => file.name === name))) throw fail('Сайт неполный: отсутствуют файлы для восстановления');
|
||||
const temp = await mkdtemp(join(tmpdir(), 'dc-cms-backup-'));
|
||||
const cleanup = () => rm(temp, { recursive: true, force: true });
|
||||
const path = join(temp, 'site.zip');
|
||||
let output;
|
||||
try {
|
||||
output = await open(path, 'wx', 0o600);
|
||||
let offset = 0;
|
||||
const directory = [];
|
||||
async function write(data, position = offset) {
|
||||
let written = 0;
|
||||
while (written < data.length) {
|
||||
signal?.throwIfAborted();
|
||||
const result = await output.write(data, written, data.length - written, position + written);
|
||||
if (!result.bytesWritten) throw fail('Не удалось записать бэкап', 500);
|
||||
written += result.bytesWritten;
|
||||
}
|
||||
offset = Math.max(offset, position + written);
|
||||
}
|
||||
for (const file of files) {
|
||||
signal?.throwIfAborted();
|
||||
const input = await open(file.path, constants.O_RDONLY | constants.O_NOFOLLOW);
|
||||
try {
|
||||
if (signature(await input.stat({ bigint: true })) !== file.stamp) throw fail('Сайт изменился во время бэкапа. Повторите скачивание');
|
||||
const name = Buffer.from(file.name), start = offset, date = file.modified;
|
||||
const dosTime = (date.getHours() << 11) | (date.getMinutes() << 5) | (date.getSeconds() >> 1);
|
||||
const dosDate = ((Math.min(2107, Math.max(1980, date.getFullYear())) - 1980) << 9) | ((date.getMonth() + 1) << 5) | date.getDate();
|
||||
const header = Buffer.alloc(30);
|
||||
header.writeUInt32LE(0x04034b50, 0); header.writeUInt16LE(20, 4); header.writeUInt16LE(0x800, 6);
|
||||
header.writeUInt16LE(dosTime, 10); header.writeUInt16LE(dosDate, 12);
|
||||
header.writeUInt32LE(file.size, 18); header.writeUInt32LE(file.size, 22); header.writeUInt16LE(name.length, 26);
|
||||
await write(header); await write(name);
|
||||
let checksum = 0, bytes = 0;
|
||||
for await (const chunk of input.createReadStream({ autoClose: false, highWaterMark: 256 * 1024 })) {
|
||||
bytes += chunk.length;
|
||||
if (bytes > file.size) throw fail('Сайт изменился во время бэкапа. Повторите скачивание');
|
||||
checksum = crc32(chunk, checksum); await write(chunk);
|
||||
}
|
||||
if (bytes !== file.size || signature(await input.stat({ bigint: true })) !== file.stamp) throw fail('Сайт изменился во время бэкапа. Повторите скачивание');
|
||||
header.writeUInt32LE(checksum, 14); await write(header, start);
|
||||
const central = Buffer.alloc(46);
|
||||
central.writeUInt32LE(0x02014b50, 0); central.writeUInt16LE(20, 4); central.writeUInt16LE(20, 6);
|
||||
header.copy(central, 8, 6, 28); central.writeUInt32LE(start, 42);
|
||||
directory.push(central, name);
|
||||
} finally { await input.close(); }
|
||||
}
|
||||
const after = await scan();
|
||||
if (JSON.stringify(after.map(f => [f.name, f.stamp])) !== JSON.stringify(files.map(f => [f.name, f.stamp]))) throw fail('Сайт изменился во время бэкапа. Повторите скачивание');
|
||||
const directoryStart = offset;
|
||||
for (const data of directory) await write(data);
|
||||
const end = Buffer.alloc(22);
|
||||
end.writeUInt32LE(0x06054b50, 0); end.writeUInt16LE(files.length, 8); end.writeUInt16LE(files.length, 10);
|
||||
end.writeUInt32LE(offset - directoryStart, 12); end.writeUInt32LE(directoryStart, 16);
|
||||
await write(end);
|
||||
await output.close(); output = null;
|
||||
return { path, size: offset, files: files.length, cleanup };
|
||||
} catch (error) {
|
||||
await output?.close(); await cleanup(); throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export function siteBackupFilename(projectId, now = new Date()) {
|
||||
const date = new Intl.DateTimeFormat('en-CA', { timeZone: 'Europe/Moscow', year: 'numeric', month: '2-digit', day: '2-digit' }).format(now);
|
||||
const id = String(projectId).replace(/[^a-zA-Z0-9-]/g, '').replace(/-/g, '_').toUpperCase() || 'SITE';
|
||||
return `NODEDC_SITE_${date}_${id}_TECH.zip`;
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import { createHash, randomBytes } from 'node:crypto';
|
||||
import { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
|
||||
import { join } from 'node:path';
|
||||
|
||||
const fail = () => Object.assign(new Error('Некорректные настройки интерфейса'), { status: 400 });
|
||||
const object = value => value && typeof value === 'object' && !Array.isArray(value);
|
||||
const defaults = () => ({ schemaVersion: 1, appearance: { theme: 'dark', accent: null }, gui: { modals: {} } });
|
||||
export function validatePreferencesPatch(patch) {
|
||||
if (!object(patch) || Object.keys(patch).some(k => !['appearance', 'gui'].includes(k))) throw fail();
|
||||
if (patch.appearance !== undefined) {
|
||||
const a = patch.appearance;
|
||||
if (!object(a) || Object.keys(a).some(k => !['theme', 'accent'].includes(k))) throw fail();
|
||||
if (a.theme !== undefined && !['dark', 'light'].includes(a.theme)) throw fail();
|
||||
if (a.accent !== undefined && a.accent !== null && (typeof a.accent !== 'string' || !/^#[a-f\d]{6}$/i.test(a.accent))) throw fail();
|
||||
}
|
||||
if (patch.gui !== undefined) {
|
||||
if (!object(patch.gui) || Object.keys(patch.gui).some(k => k !== 'modals') || !object(patch.gui.modals)) throw fail();
|
||||
for (const [key, size] of Object.entries(patch.gui.modals)) {
|
||||
if (!/^[a-z][a-z0-9-]{0,63}$/.test(key) || ['constructor', 'prototype'].includes(key)) throw fail();
|
||||
if (size === null) continue;
|
||||
if (!object(size) || Object.keys(size).length !== 2 || !Number.isInteger(size.width) || !Number.isInteger(size.height) || size.width < 100 || size.height < 100 || size.width > 10000 || size.height > 10000) throw fail();
|
||||
}
|
||||
}
|
||||
return patch;
|
||||
}
|
||||
|
||||
/** Private per-principal metadata, outside all sites, exports and publish roots. */
|
||||
export class UserPreferencesStore {
|
||||
#root; #queues = new Map();
|
||||
constructor(projectsRoot) { this.#root = join(projectsRoot, '.user-meta'); }
|
||||
#key(principal) {
|
||||
if (typeof principal !== 'string' || !principal) throw Object.assign(new Error('Требуется вход'), { status: 401 });
|
||||
return createHash('sha256').update(principal).digest('hex');
|
||||
}
|
||||
async read(principal) {
|
||||
const key = this.#key(principal);
|
||||
try {
|
||||
const document = JSON.parse(await readFile(join(this.#root, `${key}.json`), 'utf8'));
|
||||
if (document.schemaVersion !== 1) throw new Error('Unsupported GUI metadata version');
|
||||
validatePreferencesPatch({ appearance: document.appearance, gui: document.gui });
|
||||
return { preferences: document, exists: true };
|
||||
} catch (error) { if (error.code === 'ENOENT') return { preferences: defaults(), exists: false }; throw error; }
|
||||
}
|
||||
async patch(principal, patch, { ifAbsent = false } = {}) {
|
||||
validatePreferencesPatch(patch);
|
||||
const key = this.#key(principal);
|
||||
const pending = (this.#queues.get(key) || Promise.resolve()).then(async () => {
|
||||
const current = await this.read(principal);
|
||||
if (ifAbsent && current.exists) return current;
|
||||
const next = current.preferences;
|
||||
Object.assign(next.appearance, patch.appearance);
|
||||
if (next.appearance.accent) next.appearance.accent = next.appearance.accent.toLowerCase();
|
||||
for (const [id, size] of Object.entries(patch.gui?.modals || {})) {
|
||||
if (size === null) delete next.gui.modals[id]; else next.gui.modals[id] = size;
|
||||
}
|
||||
if (Object.keys(next.gui.modals).length > 64) throw fail();
|
||||
await mkdir(this.#root, { recursive: true, mode: 0o700 });
|
||||
const path = join(this.#root, `${key}.json`), temporary = `${path}.${randomBytes(8).toString('hex')}.tmp`;
|
||||
try { await writeFile(temporary, JSON.stringify(next, null, 2) + '\n', { flag: 'wx', mode: 0o600 }); await rename(temporary, path); }
|
||||
finally { await rm(temporary, { force: true }); }
|
||||
return { preferences: next, exists: true };
|
||||
});
|
||||
const settled = pending.catch(() => {});
|
||||
this.#queues.set(key, settled);
|
||||
try { return await pending; } finally { if (this.#queues.get(key) === settled) this.#queues.delete(key); }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { mkdtemp, mkdir, writeFile, readFile, rm, symlink, stat } from 'node:fs/promises';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join, dirname } from 'node:path';
|
||||
import AdmZip from 'adm-zip';
|
||||
import { createSiteBackup, siteBackupFilename } from '../server/site-backup.mjs';
|
||||
|
||||
test('backup is a portable current workspace, with UTF-8 paths and exact media bytes', async t => {
|
||||
const root = await mkdtemp(join(tmpdir(), 'backup-fixture-'));
|
||||
t.after(() => rm(root, { recursive: true, force: true }));
|
||||
const files = {
|
||||
'content/pages/home.json': Buffer.from('{"title":"Current"}'),
|
||||
'templates/pages/home/shell.html': Buffer.from('<html>current</html>'),
|
||||
'assets/фото ровера.bin': Buffer.from(Array.from({ length: 700000 }, (_, i) => i % 251)),
|
||||
'.htaccess': Buffer.from('DirectoryIndex index.html'),
|
||||
'empty.txt': Buffer.alloc(0),
|
||||
};
|
||||
const privateFiles = ['.cms-backups/old.zip', '.git/config', '.env', '.env.local', 'demo.secrets.json', 'assets/.trash/old.png', 'assets/._photo', 'node_modules/package/a.js'];
|
||||
for (const [name, value] of [...Object.entries(files), ...privateFiles.map(name => [name, Buffer.from('private')])]) {
|
||||
await mkdir(dirname(join(root, name)), { recursive: true }); await writeFile(join(root, name), value);
|
||||
}
|
||||
const backup = await createSiteBackup(root, { required: ['content/pages/home.json'] });
|
||||
try {
|
||||
const zip = new AdmZip(await readFile(backup.path));
|
||||
assert.equal(zip.test(), true);
|
||||
assert.deepEqual(zip.getEntries().map(e => e.entryName).sort(), Object.keys(files).sort());
|
||||
for (const [name, value] of Object.entries(files)) assert.deepEqual(zip.readFile(name), value, name);
|
||||
assert.equal(backup.size, (await stat(backup.path)).size);
|
||||
assert.equal((await stat(backup.path)).mode & 0o777, 0o600);
|
||||
} finally { await backup.cleanup(); }
|
||||
await assert.rejects(stat(backup.path));
|
||||
assert.equal(await readFile(join(root, '.env'), 'utf8'), 'private');
|
||||
await assert.rejects(createSiteBackup(root, { required: ['missing.json'] }), /неполный/);
|
||||
await symlink(join(root, '.env'), join(root, 'linked-secret'));
|
||||
await assert.rejects(createSiteBackup(root), /символическими/);
|
||||
await rm(join(root, 'linked-secret'));
|
||||
const abort = new AbortController(); abort.abort();
|
||||
await assert.rejects(createSiteBackup(root, { signal: abort.signal }), { name: 'AbortError' });
|
||||
});
|
||||
|
||||
test('backup filename identifies the selected site and Moscow calendar date', () => {
|
||||
assert.equal(siteBackupFilename('mission-core', new Date('2026-11-05T20:59:00Z')), 'NODEDC_SITE_2026-11-05_MISSION_CORE_TECH.zip');
|
||||
assert.equal(siteBackupFilename('nodedc', new Date('2026-11-05T21:01:00Z')), 'NODEDC_SITE_2026-11-06_NODEDC_TECH.zip');
|
||||
});
|
||||
+95
-2
@@ -1,6 +1,6 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { mkdtemp, mkdir, readFile, writeFile, rm, stat } from 'node:fs/promises';
|
||||
import { mkdtemp, mkdir, readFile, writeFile, rm, stat, symlink } from 'node:fs/promises';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join, resolve } from 'node:path';
|
||||
import { spawn } from 'node:child_process';
|
||||
@@ -42,6 +42,22 @@ test('independent sites, rendering, secrets and publication ownership', async t
|
||||
const response=await fetch(base+path,{method,headers:payload?{'content-type':'application/json'}:{},body:payload?JSON.stringify(payload):undefined});
|
||||
const data=await response.json(); assert.equal(response.status,expected,JSON.stringify(data));return data;
|
||||
}
|
||||
await t.test('existing destination is never overwritten or removed',async()=>{
|
||||
const occupied=join(projects,'sites/occupied');
|
||||
await mkdir(occupied,{recursive:true});await writeFile(join(occupied,'keep.txt'),'keep');
|
||||
await api('/api/sites','POST',{id:'occupied',copyFrom:'nodedc'},500);
|
||||
assert.equal(await readFile(join(occupied,'keep.txt'),'utf8'),'keep');
|
||||
assert.equal((await api('/api/sites')).sites.length,1);
|
||||
});
|
||||
await t.test('copy rejection cleans only its reservation and permits retry',async()=>{
|
||||
await symlink(join(original,'index.html'),join(original,'unsafe-link'));
|
||||
await api('/api/sites','POST',{id:'mission-core',copyFrom:'nodedc'},400);
|
||||
await assert.rejects(stat(join(projects,'sites/mission-core')));
|
||||
await assert.rejects(stat(join(projects,'mission-core.json')));
|
||||
assert.equal((await api('/api/sites')).sites.length,1);
|
||||
assert.equal(await readFile(join(original,'index.html'),'utf8'),'<h1>Original</h1>');
|
||||
await rm(join(original,'unsafe-link'));
|
||||
});
|
||||
await t.test('create clone without credentials or backups',async()=>{
|
||||
const config=await api('/s/nodedc/api/project/config');
|
||||
config.deploy={enabled:false,method:'sftp',host:'host.invalid',username:'user',port:22,remotePath:'httpdocs',password:'test-password'};
|
||||
@@ -65,6 +81,48 @@ test('independent sites, rendering, secrets and publication ownership', async t
|
||||
assert.equal(await readFile(join(original,'index.html'),'utf8'),'<h1>Original</h1>');
|
||||
assert.equal(await (await fetch(base+'/s/mission-core/index.html')).text(),'<h1>Mission edited</h1>');
|
||||
});
|
||||
await t.test('flat media spans deep asset folders and remains site-scoped', async () => {
|
||||
const mission = join(projects, 'sites/mission-core');
|
||||
for (const name of ['assets/top.svg','assets/arbitrary/a/b/deep.webp','assets/other/video.mp4','assets/models/rover.glb','assets/.private/hidden.png','assets/.trash/deleted.png']) {
|
||||
const path = join(mission, name); await mkdir(join(path,'..'),{recursive:true}); await writeFile(path,'fixture');
|
||||
}
|
||||
await symlink(join(original,'index.html'),join(mission,'assets/linked.png'));
|
||||
const files=(await api('/s/mission-core/api/media/assets')).files;
|
||||
assert.deepEqual(files.map(f=>f.path).sort(),['assets/arbitrary/a/b/deep.webp','assets/models/rover.glb','assets/other/video.mp4','assets/top.svg']);
|
||||
assert.ok(files.every(f=>f.type==='file' && f.selectable && f.writable));
|
||||
assert.deepEqual(new Set(files.map(f=>f.kind)),new Set(['image','video','model']));
|
||||
assert.equal((await api('/s/nodedc/api/media/assets')).files.length,0);
|
||||
for (const name of ['top.svg','arbitrary','other','models','.private','.trash','linked.png']) await rm(join(mission,'assets',name),{recursive:true,force:true});
|
||||
});
|
||||
await t.test('media downloads keep original bytes, filename and selected-site ownership',async()=>{
|
||||
for (const [site,expected] of [['nodedc','original-asset'],['mission-core','mission-asset']]) {
|
||||
const response=await fetch(`${base}/s/${site}/api/media/download?path=assets%2Fproof.txt`);
|
||||
assert.equal(response.status,200);
|
||||
assert.match(response.headers.get('content-disposition'),/^attachment; filename="proof.txt"/);
|
||||
assert.equal(response.headers.get('cache-control'),'no-store');
|
||||
assert.equal(Number(response.headers.get('content-length')),Buffer.byteLength(expected));
|
||||
assert.equal(await response.text(),expected);
|
||||
}
|
||||
const name='Сессия 1 (оригинал).mp4',bytes=Buffer.from([0,1,2,255,128,0]);
|
||||
const missionRoot=join(projects,'sites/mission-core');
|
||||
await writeFile(join(missionRoot,'assets',name),bytes);
|
||||
const response=await fetch(`${base}/s/mission-core/api/media/download?path=${encodeURIComponent('assets/'+name)}`);
|
||||
assert.equal(response.status,200);
|
||||
assert.equal(decodeURIComponent(response.headers.get('content-disposition').split("filename*=UTF-8''")[1]),name);
|
||||
assert.deepEqual(Buffer.from(await response.arrayBuffer()),bytes);
|
||||
assert.equal((await fetch(`${base}/s/nodedc/api/media/download?path=${encodeURIComponent('assets/'+name)}`)).status,404);
|
||||
for (const path of ['../nodedc.json','assets/../../nodedc.json','content/pages/home.json','assets/.trash/private','assets/.env','/assets/proof.txt']) {
|
||||
assert.equal((await fetch(`${base}/s/mission-core/api/media/download?path=${encodeURIComponent(path)}`)).status,403,path);
|
||||
}
|
||||
await symlink(original,join(missionRoot,'assets/other-site'));
|
||||
await symlink(join(original,'assets/proof.txt'),join(missionRoot,'assets/linked.txt'));
|
||||
for (const path of ['assets/other-site/assets/proof.txt','assets/linked.txt']) {
|
||||
assert.equal((await fetch(`${base}/s/mission-core/api/media/download?path=${encodeURIComponent(path)}`)).status,403,path);
|
||||
}
|
||||
assert.equal((await fetch(`${base}/s/mission-core/api/media/download?path=assets/missing.jpg`)).status,404);
|
||||
assert.equal((await fetch(`${base}/s/mission-core/api/media/download?path=assets`)).status,403);
|
||||
for (const path of ['assets/other-site','assets/linked.txt','assets/'+name]) await rm(join(missionRoot,path));
|
||||
});
|
||||
await t.test('preview root links stay within their selected site',async()=>{
|
||||
const page=await (await fetch(base+'/s/mission-core/knowledge/')).text();
|
||||
assert.match(page,/href="\/s\/mission-core\/knowledge\/fleet\/"/);
|
||||
@@ -94,6 +152,31 @@ test('independent sites, rendering, secrets and publication ownership', async t
|
||||
assert.equal((await fetch(base+'/s/mission-core/api/project/upload-site',{method:'POST',body:invalid})).status,500);
|
||||
assert.equal((await api('/s/mission-core/api/page/home')).title,'Mission edited');
|
||||
});
|
||||
await t.test('downloaded backup is current, isolated and can be imported unchanged',async()=>{
|
||||
const beforePage=await api('/s/mission-core/api/page/home');
|
||||
const prepared=await api('/s/mission-core/api/project/backup','POST');
|
||||
await api('/s/mission-core/api/project/backup','POST',undefined,409);
|
||||
const response=await fetch(base+'/s/mission-core'+prepared.downloadUrl);
|
||||
assert.equal(response.status,200);assert.equal(response.headers.get('content-type'),'application/zip');
|
||||
assert.match(response.headers.get('content-disposition'),/MISSION_CORE_TECH\.zip/);
|
||||
assert.equal(response.headers.get('cache-control'),'no-store');
|
||||
const bytes=Buffer.from(await response.arrayBuffer());const zip=new AdmZip(bytes);
|
||||
assert.equal(bytes.length,Number(response.headers.get('content-length')));assert.equal(zip.test(),true);
|
||||
assert.equal((await fetch(base+'/s/mission-core'+prepared.downloadUrl)).status,404);
|
||||
assert.deepEqual(JSON.parse(zip.readAsText('content/pages/home.json')),beforePage);
|
||||
assert.ok(zip.getEntry('tools/render-home.mjs'));assert.ok(zip.getEntry('templates/pages/home/shell.html'));
|
||||
assert.ok(!zip.getEntries().some(e=>/\.cms-backups|\.git\/|secrets|publish-state/.test(e.entryName)));
|
||||
const preparedAgent=await api('/s/nodedc/api/project/backup','POST');
|
||||
assert.equal((await fetch(base+'/s/mission-core'+preparedAgent.downloadUrl)).status,404);
|
||||
const agentResponse=await fetch(base+'/s/nodedc'+preparedAgent.downloadUrl);assert.equal(agentResponse.status,200);
|
||||
const agentZip=new AdmZip(Buffer.from(await agentResponse.arrayBuffer()));
|
||||
assert.equal(JSON.parse(agentZip.readAsText('content/pages/home.json')).title,'Agent edited');
|
||||
const form=new FormData();form.append('file',new Blob([bytes],{type:'application/zip'}),'restored.zip');
|
||||
const restored=await fetch(base+'/s/mission-core/api/project/upload-site',{method:'POST',body:form});
|
||||
assert.equal(restored.status,200);assert.equal((await restored.json()).site.ready,true);
|
||||
assert.deepEqual(await api('/s/mission-core/api/page/home'),beforePage);
|
||||
assert.equal((await api('/s/nodedc/api/page/home')).title,'Agent edited');
|
||||
});
|
||||
await t.test('encrypted credentials transfer with source disabled',async()=>{
|
||||
const config=await api('/s/nodedc/api/project/config');
|
||||
await api('/s/nodedc/api/project/config','PUT',{...config,deploy:{...config.deploy,enabled:true}});
|
||||
@@ -117,13 +200,23 @@ test('independent sites, rendering, secrets and publication ownership', async t
|
||||
await t.test('cross-origin registry mutations are refused',async()=>{
|
||||
const response=await fetch(base+'/api/sites',{method:'POST',headers:{origin:'https://untrusted.invalid','content-type':'application/json'},body:JSON.stringify({id:'attack',copyFrom:'nodedc'})});assert.equal(response.status,403);
|
||||
});
|
||||
await t.test('GUI preferences persist outside sites and reject cross-origin writes', async () => {
|
||||
assert.equal((await api('/api/user/preferences')).exists, false);
|
||||
await api('/api/user/preferences','PATCH',{gui:{modals:{'media-library':{width:1200,height:800}}}});
|
||||
await api('/api/user/preferences','PATCH',{appearance:{theme:'light'}});
|
||||
const response = await fetch(base+'/api/user/preferences',{method:'PATCH',headers:{origin:'https://untrusted.invalid','content-type':'application/json'},body:'{}'});
|
||||
assert.equal(response.status,403);
|
||||
assert.equal((await api('/api/sites')).sites.length,2);
|
||||
});
|
||||
await stop(); await start();
|
||||
await t.test('registry and edits survive server restart',async()=>{
|
||||
assert.equal((await api('/api/user/preferences')).preferences.gui.modals['media-library'].width,1200);
|
||||
assert.equal((await api('/api/sites')).sites.length,2);assert.equal((await api('/s/mission-core/api/page/home')).title,'Mission edited');assert.equal((await api('/s/nodedc/api/page/home')).title,'Agent edited');
|
||||
});
|
||||
await stop();await start(true);
|
||||
await t.test('registry, scoped content and preview retain authentication',async()=>{
|
||||
for(const path of ['/api/sites','/s/mission-core/api/page/home']){const response=await fetch(base+path,{redirect:'manual'});assert.equal(response.status,401,path);assert.match(response.headers.get('content-type'),/json/);}
|
||||
for(const path of ['/api/user/preferences','/api/sites','/s/mission-core/api/page/home','/s/mission-core/api/project/backup','/s/mission-core/api/media/download?path=assets/proof.txt']){const response=await fetch(base+path,{redirect:'manual'});assert.equal(response.status,401,path);assert.match(response.headers.get('content-type'),/json/);}
|
||||
assert.equal((await fetch(base+'/s/mission-core/api/project/backup',{method:'POST',redirect:'manual'})).status,401);
|
||||
assert.equal((await fetch(base+'/s/mission-core/index.html',{redirect:'manual'})).status,302);
|
||||
assert.equal((await fetch(base+'/healthz')).status,200);
|
||||
});
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { createServer } from 'node:http';
|
||||
import { once } from 'node:events';
|
||||
import { mkdtemp, mkdir, readFile, writeFile, rm } from 'node:fs/promises';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join, dirname } from 'node:path';
|
||||
import { createSiteApplication } from '../server/site-app.mjs';
|
||||
|
||||
const deferred = () => { let resolve; const promise = new Promise(r => resolve = r); return { promise, resolve }; };
|
||||
|
||||
test('save/render publication builds current content and reliably sends changes', async t => {
|
||||
const root = await mkdtemp(join(tmpdir(), 'cms-publication-test-'));
|
||||
const site = join(root, 'site');
|
||||
const configPath = join(root, 'mission.json');
|
||||
const fixtures = {
|
||||
'content/pages/home.json': JSON.stringify({ title: 'Alpha', seo: 'SEO A', regions: [] }),
|
||||
'content/knowledge.json': JSON.stringify({ title: 'Knowledge A' }),
|
||||
'content/block-templates/home.json': '[]',
|
||||
'templates/pages/home/shell.html': '<html></html>',
|
||||
'tools/render-home.mjs': 'import {readFile,writeFile} from "node:fs/promises";const p=JSON.parse(await readFile("content/pages/home.json"));await writeFile("index.html",`<title>${p.seo}</title><h1>${p.title}</h1><img src="assets/photo.png">`);',
|
||||
'tools/render-knowledge.mjs': 'import {readFile,writeFile,mkdir} from "node:fs/promises";const k=JSON.parse(await readFile("content/knowledge.json"));await mkdir("knowledge",{recursive:true});await writeFile("knowledge/index.html",`<h1>${k.title}</h1>`);',
|
||||
'index.html': 'stale HTML',
|
||||
'assets/photo.png': 'image-a',
|
||||
};
|
||||
for (const [path, value] of Object.entries(fixtures)) {
|
||||
await mkdir(dirname(join(site, path)), { recursive: true });
|
||||
await writeFile(join(site, path), value);
|
||||
}
|
||||
await writeFile(configPath, JSON.stringify({ id: 'mission', name: 'Mission', siteRoot: site, deploy: { enabled: false } }));
|
||||
const remote = new Map(); const uploads = [];
|
||||
let connectCount = 0, failTransfer = false, gate = null;
|
||||
const app = await createSiteApplication({ projectId: 'mission', projectRoot: site, projectsRoot: root, hooks: {
|
||||
transaction: fn => fn(), validateDeploy: async () => {},
|
||||
writeConfig: async (_id, value) => writeFile(configPath, JSON.stringify(value)),
|
||||
createSftpClient: () => ({
|
||||
connect: async () => { connectCount++; }, mkdir: async () => {}, end: async () => {},
|
||||
stat: async path => { if (!remote.has(path)) throw new Error('missing'); return { size: remote.get(path).length, modifyTime: 1000 }; },
|
||||
fastPut: async (local, path, options) => {
|
||||
if (failTransfer) throw new Error('fixture SFTP rejected transfer');
|
||||
if (gate) { const current = gate; gate = null; current.entered.resolve(); await current.release.promise; }
|
||||
const data = await readFile(local); remote.set(path, data); uploads.push(path); options.step(data.length);
|
||||
},
|
||||
}),
|
||||
} });
|
||||
const server = createServer(app.handle); server.listen(0, '127.0.0.1'); await once(server, 'listening');
|
||||
t.after(async () => { await new Promise(resolve => server.close(resolve)); await rm(root, { recursive: true, force: true }); });
|
||||
const base = `http://127.0.0.1:${server.address().port}`;
|
||||
async function api(path, method = 'GET', body) {
|
||||
const response = await fetch(base + path, { method, headers: { 'content-type': 'application/json' }, body: body === undefined ? undefined : JSON.stringify(body) });
|
||||
const payload = await response.json(); assert.ok(response.ok, JSON.stringify(payload)); return payload;
|
||||
}
|
||||
async function configure(enabled = true, automatic = true) {
|
||||
const config = await api('/api/project/config');
|
||||
return api('/api/project/config', 'PUT', { ...config, deploy: { ...config.deploy, enabled, deployOnRender: automatic, method: 'sftp', host: 'fixture.invalid', port: 22, username: 'test', password: 'test-only', remotePath: 'httpdocs' } });
|
||||
}
|
||||
async function finished(id) {
|
||||
const deadline = Date.now() + 10000;
|
||||
while (Date.now() < deadline) {
|
||||
const { job } = await api(`/api/project/publish/status?jobId=${id}`);
|
||||
if (['completed', 'failed'].includes(job.state)) return job;
|
||||
await new Promise(resolve => setTimeout(resolve, 15));
|
||||
}
|
||||
throw new Error('publication timeout');
|
||||
}
|
||||
const text = path => remote.get(`httpdocs/${path}`)?.toString();
|
||||
await configure();
|
||||
await t.test('manual Publish builds both pages instead of uploading stale HTML', async () => {
|
||||
const { job } = await api('/api/project/publish/start', 'POST');
|
||||
assert.equal((await finished(job.id)).state, 'completed');
|
||||
assert.match(text('index.html'), /Alpha/); assert.equal(text('knowledge/index.html'), '<h1>Knowledge A</h1>');
|
||||
assert.equal(text('assets/photo.png'), 'image-a');
|
||||
assert.ok(![...remote.keys()].some(path => /content|secrets|publish-state/.test(path)));
|
||||
});
|
||||
await t.test('one-letter content/SEO and same-size image edits are not skipped; unchanged files are', async () => {
|
||||
const before = uploads.length;
|
||||
await api('/api/page/home', 'PUT', { title: 'Alphb', seo: 'SEO B', regions: [] });
|
||||
await writeFile(join(site, 'assets/photo.png'), 'image-b');
|
||||
const result = await api('/api/render/home', 'POST');
|
||||
assert.ok(result.publishJob.id); const job = await finished(result.publishJob.id);
|
||||
assert.equal(job.state, 'completed'); assert.equal(job.uploadedFiles, 2); assert.equal(job.skippedFiles, 1);
|
||||
assert.match(text('index.html'), /Alphb/); assert.match(text('index.html'), /SEO B/);
|
||||
assert.equal(text('assets/photo.png'), 'image-b'); assert.equal(uploads.length - before, 2);
|
||||
});
|
||||
await t.test('knowledge Save/render publishes its updated page', async () => {
|
||||
await api('/api/knowledge', 'PUT', { title: 'Knowledge B' });
|
||||
const result = await api('/api/render/knowledge', 'POST'); const job = await finished(result.publishJob.id);
|
||||
assert.equal(job.state, 'completed'); assert.equal(job.uploadedFiles, 1);
|
||||
assert.equal(text('knowledge/index.html'), '<h1>Knowledge B</h1>');
|
||||
});
|
||||
await t.test('edits saved during an active transfer trigger another pass and preserve newest revision', async () => {
|
||||
await api('/api/page/home', 'PUT', { title: 'First', seo: 'SEO C', regions: [] });
|
||||
const blocked = { entered: deferred(), release: deferred() }; gate = blocked;
|
||||
const first = await api('/api/render/home', 'POST');
|
||||
await blocked.entered.promise;
|
||||
await api('/api/page/home', 'PUT', { title: 'Latest', seo: 'SEO D', regions: [] });
|
||||
await writeFile(join(site, 'assets/photo.png'), 'image-c');
|
||||
const second = await api('/api/render/home', 'POST');
|
||||
assert.equal(first.publishJob.id, second.publishJob.id); assert.equal(second.publishJob.pendingChanges, true);
|
||||
blocked.release.resolve();
|
||||
assert.equal((await finished(first.publishJob.id)).state, 'completed');
|
||||
assert.match(text('index.html'), /Latest/); assert.match(text('index.html'), /SEO D/); assert.equal(text('assets/photo.png'), 'image-c');
|
||||
});
|
||||
await t.test('SFTP failure is terminal and visible; retry rebuilds and sends pending changes', async () => {
|
||||
await api('/api/knowledge', 'PUT', { title: 'Knowledge C' }); failTransfer = true;
|
||||
const result = await api('/api/render/knowledge', 'POST'); const failed = await finished(result.publishJob.id);
|
||||
assert.equal(failed.state, 'failed'); assert.match(failed.error, /SFTP rejected/);
|
||||
assert.equal(text('knowledge/index.html'), '<h1>Knowledge B</h1>');
|
||||
failTransfer = false;
|
||||
const retry = await api('/api/project/publish/start', 'POST'); assert.equal((await finished(retry.job.id)).state, 'completed');
|
||||
assert.equal(text('knowledge/index.html'), '<h1>Knowledge C</h1>');
|
||||
});
|
||||
await t.test('build failure never transfers stale pages', async () => {
|
||||
const before = connectCount; await writeFile(join(site, 'tools/render-home.mjs'), 'throw new Error("broken template")');
|
||||
const { job } = await api('/api/project/publish/start', 'POST');
|
||||
assert.equal((await finished(job.id)).state, 'failed'); assert.equal(connectCount, before);
|
||||
await writeFile(join(site, 'tools/render-home.mjs'), fixtures['tools/render-home.mjs']);
|
||||
});
|
||||
await t.test('disabled Agent-style deployment only rebuilds preview', async () => {
|
||||
await configure(false); const before = connectCount;
|
||||
await api('/api/page/home', 'PUT', { title: 'Local', seo: '', regions: [] });
|
||||
const result = await api('/api/render/home', 'POST');
|
||||
assert.equal(result.publish, null); assert.equal(result.publishJob, undefined); assert.equal(connectCount, before);
|
||||
assert.match(await readFile(join(site, 'index.html'), 'utf8'), /Local/); assert.match(text('index.html'), /Latest/);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,33 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { mkdtemp, readdir, readFile, rm, stat } from 'node:fs/promises';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
import { UserPreferencesStore } from '../server/user-preferences.mjs';
|
||||
test('user GUI metadata is isolated, durable, private and merges independent writes', async t => {
|
||||
const root = await mkdtemp(join(tmpdir(), 'cms-user-meta-')); t.after(() => rm(root, { recursive: true, force: true }));
|
||||
const store = new UserPreferencesStore(root);
|
||||
assert.equal((await store.read('alice')).exists, false);
|
||||
await Promise.all([
|
||||
store.patch('alice', { appearance: { theme: 'light', accent: '#AABBCC' } }),
|
||||
store.patch('alice', { gui: { modals: { 'media-library': { width: 1250, height: 800 } } } }),
|
||||
store.patch('bob', { gui: { modals: { 'media-library': { width: 640, height: 480 } } } }),
|
||||
]);
|
||||
const restarted = new UserPreferencesStore(root);
|
||||
const alice = (await restarted.read('alice')).preferences;
|
||||
assert.equal(alice.appearance.theme, 'light'); assert.equal(alice.appearance.accent, '#aabbcc');
|
||||
assert.deepEqual(alice.gui.modals['media-library'], {width:1250,height:800});
|
||||
assert.equal((await restarted.read('bob')).preferences.gui.modals['media-library'].width, 640);
|
||||
assert.deepEqual((await restarted.patch('alice', { appearance: { theme: 'dark' } }, { ifAbsent: true })).preferences, alice);
|
||||
const files = await readdir(join(root,'.user-meta')); assert.equal(files.length, 2);
|
||||
for (const file of files) {
|
||||
assert.match(file, /^[a-f\d]{64}\.json$/);
|
||||
assert.equal((await stat(join(root,'.user-meta',file))).mode & 0o777, 0o600);
|
||||
assert.ok(JSON.parse(await readFile(join(root,'.user-meta',file))).gui);
|
||||
}
|
||||
for (const patch of [{ user: 'bob' }, { gui: { modals: { '../evil': {width:900,height:600} } } }, { gui: {modals: {'media-library': {width:1e7,height:800}}} }, {appearance:{accent:'red'}}, JSON.parse('{"gui":{"modals":{"__proto__":null}}}')]) {
|
||||
await assert.rejects(store.patch('alice', patch), {status:400});
|
||||
}
|
||||
await assert.rejects(store.read(''), { status: 401 });
|
||||
assert.deepEqual((await store.read('alice')).preferences, alice);
|
||||
});
|
||||
@@ -0,0 +1,54 @@
|
||||
// CMS application adapter. Shared component implementation belongs to @nodedc packages.
|
||||
import React from "react";
|
||||
import { renderToStaticMarkup as html } from "react-dom/server";
|
||||
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, 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");
|
||||
const lock = JSON.parse(await read("design-system.lock.json"));
|
||||
for (const [name, hash] of Object.entries(lock.packages)) {
|
||||
if (createHash("sha256").update(await readFile(new URL(`vendor/${name}`, import.meta.url))).digest("hex") !== hash) throw Error(`Design package mismatch: ${name}`);
|
||||
}
|
||||
const icon = (name) => h(Icon, { name });
|
||||
const btn = (id, label, variant = "secondary") => h(Button, { id, variant, tone: "neutral" }, label);
|
||||
const ib = (id, label, name) => h(IconButton, { id, label }, icon(name));
|
||||
const header = h(AppHeader, {
|
||||
brand: h("img", { src: "./nodedc-logo.svg", alt: "NODE.DC" }),
|
||||
brandMonochrome: true,
|
||||
left: ib("toggle-navigation", "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0440\u0430\u0437\u0434\u0435\u043B\u044B", "panel"),
|
||||
center: h(HeaderNavigation, { label: "\u0420\u0430\u0437\u0434\u0435\u043B\u044B CMS", value: "content", onChange: noop, items: [["content", "\u041A\u043E\u043D\u0442\u0435\u043D\u0442"], ["seo", "SEO"], ["knowledge", "\u0411\u0430\u0437\u0430 \u0437\u043D\u0430\u043D\u0438\u0439"], ["files", "Файлы"]].map(([value, label]) => ({ value, label: h("span", { "data-cms-mode": value }, label) })) }),
|
||||
right: h("span", { id: "cms-profile", className: "cms-ui-island" })
|
||||
});
|
||||
const siteContext = h("div", { className: "cms-site-context" },
|
||||
h("select", { id: "site-selector", "aria-label": "Выбрать сайт" }),
|
||||
h("a", { id: "site-preview", className: "nodedc-icon-button", "aria-label": "Открыть сайт", title: "Открыть сайт", target: "_blank", rel: "noopener" }, icon("external")),
|
||||
ib("project-settings", "Настройки сайта", "settings"),
|
||||
h("span", { id: "workspace-name", hidden: true }, "NODE.DC"),
|
||||
h("span", { id: "workspace-role", hidden: true }, "Администратор сайта"),
|
||||
h("span", { id: "cms-add-block-parking", hidden: true }, ib("add-block", "Добавить блок", "plus"))
|
||||
);
|
||||
const nav = h(AdminNavigationPanel, { eyebrow: "NODE.DC / CMS", title: h("span", { id: "sidebar-title" }, "\u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435"), headerActions: ib("add-project", "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0441\u0430\u0439\u0442", "plus"), contextSlot: siteContext, items: [], onClose: noop, onItemChange: noop });
|
||||
const actions = h("div", { className: "cms-editor-actions" }, h(StatusBadge, { id: "dirty-state", "data-dirty": "false" }, "\u0421\u0438\u043D\u0445\u0440\u043E\u043D\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u043D\u043E"), ib("reload", "\u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435", "refresh"), btn("save", "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u043C\u043E\u0434\u0435\u043B\u044C", "primary"), btn("render", "\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u0441\u0430\u0439\u0442"), h(Button, { id: "publish", className: "hidden", tone: "neutral" }, "\u041E\u043F\u0443\u0431\u043B\u0438\u043A\u043E\u0432\u0430\u0442\u044C"), h(Button, {id: "download-backup", variant: "secondary", tone: "neutral", className: "hidden"}, "Скачать бэкап"));
|
||||
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", "grid"];
|
||||
const templates = Object.entries({ settingRow: h(SettingsCard, { title: "Настройка", actions: h("span", { "data-slot": "control" }) }), nestedSurface: h(GlassSurface, {tone:"group", 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" data-nodedc-appearance="mission" data-nodedc-edges="flat"><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")}
|
||||
${templates}
|
||||
<script type="module" src="./admin.js"><\/script></body></html>
|
||||
`;
|
||||
const js = await build({ absWorkingDir: root, entryPoints: ["ui/src/entry.mjs"], bundle: true, write: false, format: "esm", target: ["es2022"], minify: true, legalComments: "inline", define: { "process.env.NODE_ENV": '"production"' } });
|
||||
const css = await build({ absWorkingDir: root, entryPoints: ["ui/src/app.css"], bundle: true, write: false, minify: true, loader: { ".woff2": "dataurl", ".woff": "dataurl" }, logLevel: "warning" });
|
||||
const outputs = { "admin/index.html": page, "admin/admin.js": js.outputFiles[0].text, "admin/admin.css": css.outputFiles[0].text };
|
||||
for (const [path, data] of Object.entries(outputs)) {
|
||||
if (process.argv.includes("--check")) {
|
||||
if (await readFile(root + path, "utf8") !== data) throw Error(`Stale generated UI: ${path}`);
|
||||
} else await writeFile(root + path, data);
|
||||
}
|
||||
console.log(`CMS UI ${process.argv.includes("--check") ? "verified" : "built"} from Design Guidelines ${lock.sourceCommit}`);
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"repository": "https://git.dcserve.ru/SILVER/NODEDC_DESIGN_GUIDELINE.git",
|
||||
"sourceCommit": "189bb7037740f577cc65e72f2b7c07651201ef19",
|
||||
"distribution": "immutable npm pack artifacts; no copied component sources",
|
||||
"packages": {
|
||||
"nodedc-tokens-0.6.0-mission.2.tgz": "11386a46868f8e7dafa2743770d15dc201e1df46d036921f03475c15a7351b9c",
|
||||
"nodedc-ui-core-0.7.0-mission.2.tgz": "6360deed064a7c3c5af9538fac38a31f9937d4521153705375c431e7afd56fe8",
|
||||
"nodedc-ui-react-0.7.0-mission.2.tgz": "cecf33a767e4c998e8c5cbcc70b20936844460424790d0a81aefa847c45f662e",
|
||||
"nodedc-ui-dom-0.7.0-modal.2.tgz": "85667985b73fd88855c64e446905e6bf24f7143fdf8c08920f5776940af3607e"
|
||||
},
|
||||
"packageSourceCommits": {
|
||||
"nodedc-ui-dom-0.7.0-modal.2.tgz": "1326ec6cc9ee0a2f4f3e75eaf4e22250c3fbafe5"
|
||||
}
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
<div id="empty-state" class="empty-state">
|
||||
<div class="empty-icon">ND</div>
|
||||
<div>
|
||||
<h3>Выберите блок слева</h3>
|
||||
<p>Откройте раздел сайта, чтобы изменить текст, медиа и настройки отображения.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form id="block-form" class="block-form hidden">
|
||||
<details class="json-details cms-block-options"><summary>Параметры и операции с блоком</summary><div class="cms-block-options-body"><section class="settings-card block-meta-card">
|
||||
<div class="card-head">
|
||||
<div>
|
||||
<div class="section-kicker">Идентификатор</div>
|
||||
<h3>Служебные параметры</h3>
|
||||
</div>
|
||||
<label class="toggle-row">
|
||||
<input id="block-enabled" name="enabled" type="checkbox" />
|
||||
<span>Отображение</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="field-grid">
|
||||
<label class="field-control">
|
||||
<span>ID блока</span>
|
||||
<input id="block-id" name="id" type="text" autocomplete="off" />
|
||||
</label>
|
||||
<label class="field-control">
|
||||
<span>Название в админке</span>
|
||||
<input id="block-label" name="adminLabel" type="text" autocomplete="off" />
|
||||
</label>
|
||||
<label class="field-control">
|
||||
<span>Шаблон / тип</span>
|
||||
<input id="block-template" name="template" type="text" autocomplete="off" readonly />
|
||||
</label>
|
||||
<label class="field-control">
|
||||
<span>Target</span>
|
||||
<input id="block-anchor" name="target" type="text" autocomplete="off" list="block-target-options" />
|
||||
<datalist id="block-target-options"></datalist>
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="settings-card structure-card">
|
||||
<div class="card-head structure-head">
|
||||
<div>
|
||||
<div class="section-kicker">Порядок блока</div>
|
||||
<h3>Операции с блоком</h3>
|
||||
</div>
|
||||
<div class="button-row icon-action-row">
|
||||
<button id="move-up" class="icon-action-btn" type="button" title="Поднять блок" aria-label="Поднять блок">
|
||||
<span aria-hidden="true">↑</span>
|
||||
</button>
|
||||
<button id="move-down" class="icon-action-btn" type="button" title="Опустить блок" aria-label="Опустить блок">
|
||||
<span aria-hidden="true">↓</span>
|
||||
</button>
|
||||
<button id="duplicate" class="icon-action-btn" type="button" title="Дублировать блок" aria-label="Дублировать блок">
|
||||
<span aria-hidden="true">⧉</span>
|
||||
</button>
|
||||
<button id="copy" class="icon-action-btn operation-extra" type="button" title="Копировать блок" aria-label="Копировать блок">
|
||||
<span aria-hidden="true">□</span>
|
||||
</button>
|
||||
<button id="paste-after" class="icon-action-btn operation-extra" type="button" title="Вставить после" aria-label="Вставить после">
|
||||
<span aria-hidden="true">▣</span>
|
||||
</button>
|
||||
<button id="delete-block" class="icon-action-btn danger-action-btn" type="button" title="Удалить блок" aria-label="Удалить блок">
|
||||
<svg class="trash-can-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
||||
<path d="M3.75 6.75h16.5" />
|
||||
<path d="M8.25 6.75V4.9c0-.64.51-1.15 1.15-1.15h5.2c.64 0 1.15.51 1.15 1.15v1.85" />
|
||||
<path d="M6.25 6.75l.7 12.15c.06.78.7 1.35 1.47 1.35h7.16c.77 0 1.41-.57 1.47-1.35l.7-12.15" />
|
||||
<path d="M10 10.75v5.5" />
|
||||
<path d="M14 10.75v5.5" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div></details>
|
||||
<section class="content-panel">
|
||||
<div class="panel-head">
|
||||
<div>
|
||||
<div id="content-panel-kicker" class="section-kicker">Контент</div>
|
||||
<h3 id="content-panel-title">Редактируемые поля</h3>
|
||||
</div>
|
||||
<span id="content-panel-note" class="panel-note">Поля сгруппированы по смысловым подблокам верстки.</span>
|
||||
</div>
|
||||
<div id="content-fields" class="content-fields"></div>
|
||||
</section>
|
||||
|
||||
<details class="json-details">
|
||||
<summary>JSON выбранного блока</summary>
|
||||
<label class="json-field">
|
||||
<span>Техническое представление</span>
|
||||
<textarea id="block-json" spellcheck="false"></textarea>
|
||||
</label>
|
||||
</details>
|
||||
</form>
|
||||
|
||||
<div id="knowledge-form" class="knowledge-editor hidden"></div>
|
||||
<div id="project-settings-form" class="project-settings-editor hidden"></div>
|
||||
|
||||
<pre id="status" class="status"></pre>
|
||||
+179
@@ -0,0 +1,179 @@
|
||||
<div id="template-modal" class="template-modal-layer hidden" role="dialog" aria-modal="true" aria-labelledby="template-modal-title">
|
||||
<article class="template-modal">
|
||||
<header class="template-modal-head">
|
||||
<div>
|
||||
<div class="section-kicker">Библиотека блоков</div>
|
||||
<h2 id="template-modal-title">Добавить блок</h2>
|
||||
<p>Выберите шаблон. Новый блок появится в конце соответствующего списка.</p>
|
||||
</div>
|
||||
<button id="template-modal-close" class="admin-panel-close modal-close-button" type="button" aria-label="Закрыть">×</button>
|
||||
</header>
|
||||
<div id="template-list" class="template-list"></div>
|
||||
<footer class="template-modal-foot">
|
||||
<button id="template-modal-cancel" class="ghost-btn" type="button">Отмена</button>
|
||||
</footer>
|
||||
</article>
|
||||
</div>
|
||||
<div id="delete-modal" class="template-modal-layer delete-modal-layer hidden" role="dialog" aria-modal="true" aria-labelledby="delete-modal-title" aria-describedby="delete-modal-body">
|
||||
<article class="template-modal delete-modal">
|
||||
<header class="template-modal-head delete-modal-head">
|
||||
<div>
|
||||
<div class="section-kicker">Удаление</div>
|
||||
<h2 id="delete-modal-title">Подтвердите действие</h2>
|
||||
<p id="delete-modal-body">Вы действительно подтвердить удаление элемента?</p>
|
||||
</div>
|
||||
</header>
|
||||
<footer class="template-modal-foot delete-modal-foot">
|
||||
<button id="delete-modal-cancel" class="ghost-btn" type="button">Отмена</button>
|
||||
<button id="delete-modal-confirm" class="danger-btn delete-confirm-btn" type="button">Да</button>
|
||||
</footer>
|
||||
</article>
|
||||
</div>
|
||||
<div id="media-modal" class="template-modal-layer media-modal-layer hidden" role="dialog" aria-modal="true" aria-labelledby="media-modal-title">
|
||||
<article class="template-modal media-modal">
|
||||
<header class="template-modal-head media-modal-head">
|
||||
<div>
|
||||
<div class="section-kicker">Медиатека</div>
|
||||
<h2 id="media-modal-title">Выбрать файл</h2>
|
||||
<p id="media-modal-subtitle">Существующие файлы на сервере и загрузки для текущего поля.</p>
|
||||
</div>
|
||||
<div class="media-modal-actions">
|
||||
<span id="media-site-size" class="media-site-size">Сайт: считаем...</span>
|
||||
<button id="media-trash-toggle" class="admin-panel-close media-header-action media-trash-toggle" type="button" aria-label="Недавно удалённые" title="Недавно удалённые">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M3.75 6.75h16.5" />
|
||||
<path d="M8.25 6.75V4.9c0-.64.51-1.15 1.15-1.15h5.2c.64 0 1.15.51 1.15 1.15v1.85" />
|
||||
<path d="M6.25 6.75l.7 12.15c.06.78.7 1.35 1.47 1.35h7.16c.77 0 1.41-.57 1.47-1.35l.7-12.15" />
|
||||
<path d="M10 10.75v5.5" />
|
||||
<path d="M14 10.75v5.5" />
|
||||
</svg>
|
||||
</button>
|
||||
<button id="media-modal-close" class="admin-panel-close modal-close-button media-header-action" type="button" aria-label="Закрыть">×</button>
|
||||
</div>
|
||||
</header>
|
||||
<div class="media-toolbar">
|
||||
<label class="media-search">
|
||||
<span>Поиск</span>
|
||||
<input id="media-search" type="search" autocomplete="off" placeholder="Имя, папка, путь" />
|
||||
</label>
|
||||
<div class="media-kind-row"><div id="media-kind-filters" class="media-filter-row" role="group" aria-label="Типы файлов"></div><span id="media-results" class="nodedc-description" role="status"></span><button id="media-flat-toggle" class="nodedc-icon-button" type="button" aria-label="Все файлы без папок" aria-pressed="false"></button></div>
|
||||
<div id="media-root-filters" class="media-filter-row media-root-row" aria-label="Корень файлов"></div>
|
||||
<button id="media-upload" class="primary-btn media-upload-btn" type="button">+ Загрузить</button>
|
||||
</div>
|
||||
<div id="media-drop-zone" class="media-browser media-browser-columns">
|
||||
<section class="media-main">
|
||||
<div id="media-list" class="media-columns"></div>
|
||||
<div id="media-empty" class="media-empty hidden">Папка пуста.</div>
|
||||
</section>
|
||||
<aside class="media-preview-panel">
|
||||
<div id="media-preview" class="media-preview">
|
||||
<span>FILE</span>
|
||||
</div>
|
||||
<div class="media-preview-copy">
|
||||
<div id="media-preview-name" class="media-preview-name">Выберите файл</div>
|
||||
<div id="media-preview-path" class="media-preview-path"></div>
|
||||
<div id="media-preview-meta" class="media-preview-meta"></div>
|
||||
</div>
|
||||
<div id="media-preview-usage" class="media-usage-pill" data-status="idle">
|
||||
<span class="media-usage-dot"></span>
|
||||
<span>Нет выбора</span>
|
||||
</div>
|
||||
<div class="media-preview-actions">
|
||||
<button id="media-select" class="primary-btn" type="button" disabled>Выбрать</button>
|
||||
<button id="media-download" class="ghost-btn" type="button" disabled>Скачать</button>
|
||||
<button id="media-delete" class="danger-btn media-delete-btn" type="button" aria-label="Удалить файл" title="Удалить файл" disabled>
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M3.75 6.75h16.5" />
|
||||
<path d="M8.25 6.75V4.9c0-.64.51-1.15 1.15-1.15h5.2c.64 0 1.15.51 1.15 1.15v1.85" />
|
||||
<path d="M6.25 6.75l.7 12.15c.06.78.7 1.35 1.47 1.35h7.16c.77 0 1.41-.57 1.47-1.35l.7-12.15" />
|
||||
<path d="M10 10.75v5.5" />
|
||||
<path d="M14 10.75v5.5" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
<nav id="media-breadcrumbs"></nav>
|
||||
<footer class="template-modal-foot media-modal-foot">
|
||||
<span id="media-size-status" class="nodedc-description" role="status">Размер окна сохраняется в профиле</span>
|
||||
<button id="media-size-retry" class="ghost-btn" type="button" hidden>Повторить</button>
|
||||
<button id="media-refresh" class="ghost-btn" type="button">Обновить список</button>
|
||||
<button id="media-modal-cancel" class="ghost-btn" type="button">Отмена</button>
|
||||
</footer>
|
||||
</article>
|
||||
</div>
|
||||
<div id="media-context-menu" class="media-context-menu hidden" role="menu"></div>
|
||||
<div id="media-action-modal" class="template-modal-layer media-action-modal-layer hidden" role="dialog" aria-modal="true" aria-labelledby="media-action-title">
|
||||
<article class="template-modal media-action-modal">
|
||||
<header class="template-modal-head media-action-head">
|
||||
<div>
|
||||
<div class="section-kicker">Файл-менеджер</div>
|
||||
<h2 id="media-action-title">Действие</h2>
|
||||
<p id="media-action-body">Введите имя.</p>
|
||||
</div>
|
||||
</header>
|
||||
<div class="media-action-body">
|
||||
<label class="field-control">
|
||||
<span id="media-action-label">Имя</span>
|
||||
<input id="media-action-input" type="text" autocomplete="off" />
|
||||
</label>
|
||||
</div>
|
||||
<footer class="template-modal-foot media-action-foot">
|
||||
<button id="media-action-cancel" class="ghost-btn" type="button">Отмена</button>
|
||||
<button id="media-action-confirm" class="primary-btn" type="button">Подтвердить</button>
|
||||
</footer>
|
||||
</article>
|
||||
</div>
|
||||
<div id="knowledge-button-modal" class="template-modal-layer knowledge-button-modal-layer hidden" role="dialog" aria-modal="true" aria-labelledby="knowledge-button-title">
|
||||
<article class="template-modal knowledge-button-modal">
|
||||
<header class="template-modal-head knowledge-button-head">
|
||||
<div>
|
||||
<div class="section-kicker">База знаний</div>
|
||||
<h2 id="knowledge-button-title">Кнопка в статье</h2>
|
||||
<p>Ссылка ведёт на лендинг или внешний адрес. Target открывает нужный блок лендинга.</p>
|
||||
</div>
|
||||
<button id="knowledge-button-close" class="admin-panel-close modal-close-button" type="button" aria-label="Закрыть">×</button>
|
||||
</header>
|
||||
<div class="knowledge-button-body">
|
||||
<label class="field-control">
|
||||
<span>Название</span>
|
||||
<input id="knowledge-button-name" type="text" autocomplete="off" placeholder="Посмотреть демо" />
|
||||
</label>
|
||||
<label class="field-control">
|
||||
<span>Ссылка</span>
|
||||
<input id="knowledge-button-link" type="text" autocomplete="off" placeholder="/" />
|
||||
</label>
|
||||
<label class="field-control">
|
||||
<span>Target / блок лендинга</span>
|
||||
<input id="knowledge-button-target" type="text" autocomplete="off" list="knowledge-button-target-options" placeholder="hub-video" />
|
||||
<datalist id="knowledge-button-target-options"></datalist>
|
||||
</label>
|
||||
<p class="knowledge-button-hint">Можно выбрать target из списка или ввести ID блока лендинга. Если target пустой, ссылка откроет первый экран.</p>
|
||||
<p id="knowledge-button-error" class="knowledge-button-error" aria-live="polite"></p>
|
||||
</div>
|
||||
<footer class="template-modal-foot knowledge-button-foot">
|
||||
<button id="knowledge-button-cancel" class="ghost-btn" type="button">Отмена</button>
|
||||
<button id="knowledge-button-confirm" class="primary-btn" type="button">Добавить кнопку</button>
|
||||
</footer>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<dialog id="new-site-dialog" class="site-dialog">
|
||||
<form id="new-site-form">
|
||||
<h2>Добавить сайт</h2><p>Содержимое и медиа будут скопированы в отдельный проект. Публикация изначально отключена.</p>
|
||||
<label>Название<input name="name" required maxlength="160" placeholder="NODE.DC — Mission Core"></label>
|
||||
<label>ID сайта<input name="id" required pattern="[a-z][a-z0-9-]{0,47}" maxlength="48" placeholder="mission-core"></label>
|
||||
<label>Копировать из<select id="new-site-source" name="copyFrom" required></select></label>
|
||||
<label>Публичный адрес<input name="publicUrl" type="url" placeholder="https://nodedc.ru/"></label>
|
||||
<p id="new-site-error" role="alert"></p>
|
||||
<div class="site-dialog-actions"><button type="button" data-close-dialog>Отмена</button><button type="submit">Создать независимую копию</button></div>
|
||||
</form>
|
||||
</dialog>
|
||||
<dialog id="transfer-site-dialog" class="site-dialog">
|
||||
<form id="transfer-site-form">
|
||||
<h2>Перенос настроек публикации</h2><p>Деплой исходного сайта будет отключён. Адрес сервера, папка и сохранённый пароль будут перенесены в текущий проект. Файлы на хостинге сейчас не меняются.</p>
|
||||
<label>Исходный сайт<select id="transfer-site-source" required></select></label>
|
||||
<p id="transfer-site-error" role="alert"></p>
|
||||
<div class="site-dialog-actions"><button type="button" data-close-dialog>Отмена</button><button type="submit">Перенести настройки</button></div>
|
||||
</form>
|
||||
</dialog>
|
||||
Generated
+608
@@ -0,0 +1,608 @@
|
||||
{
|
||||
"name": "dc-cms-ui-build",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "dc-cms-ui-build",
|
||||
"dependencies": {
|
||||
"@nodedc/tokens": "file:vendor/nodedc-tokens-0.6.0-mission.2.tgz",
|
||||
"@nodedc/ui-core": "file:vendor/nodedc-ui-core-0.7.0-mission.2.tgz",
|
||||
"@nodedc/ui-dom": "file:vendor/nodedc-ui-dom-0.7.0-modal.2.tgz",
|
||||
"@nodedc/ui-react": "file:vendor/nodedc-ui-react-0.7.0-mission.2.tgz",
|
||||
"esbuild": "0.28.1",
|
||||
"react": "19.2.7",
|
||||
"react-dom": "19.2.7"
|
||||
}
|
||||
},
|
||||
"node_modules/@dnd-kit/accessibility": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@dnd-kit/accessibility/-/accessibility-3.1.1.tgz",
|
||||
"integrity": "sha512-2P+YgaXF+gRsIihwwY1gCsQSYnu9Zyj2py8kY5fFvUM1qm2WA2u639R6YNVfU4GWr+ZM5mqEsfHZZLoRONbemw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@dnd-kit/core": {
|
||||
"version": "6.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@dnd-kit/core/-/core-6.3.1.tgz",
|
||||
"integrity": "sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@dnd-kit/accessibility": "^3.1.1",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"tslib": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@dnd-kit/sortable": {
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@dnd-kit/sortable/-/sortable-10.0.0.tgz",
|
||||
"integrity": "sha512-+xqhmIIzvAYMGfBYYnbKuNicfSsk4RksY2XdmJhT+HAC01nix6fHCztU68jooFiMUB01Ky3F0FyOvhG/BZrWkg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"tslib": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@dnd-kit/core": "^6.3.0",
|
||||
"react": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@dnd-kit/utilities": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@dnd-kit/utilities/-/utilities-3.2.2.tgz",
|
||||
"integrity": "sha512-+MKAJEOfaBe5SmV6t34p80MMKhjvUz0vRrvVJbPT0WElzaOJ/1xs+D+KDv+tD/NE5ujfrChEcshd4fLn0wpiqg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/aix-ppc64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz",
|
||||
"integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"aix"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-arm": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz",
|
||||
"integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-arm64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz",
|
||||
"integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-x64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz",
|
||||
"integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-arm64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz",
|
||||
"integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-x64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz",
|
||||
"integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/freebsd-arm64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz",
|
||||
"integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/freebsd-x64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz",
|
||||
"integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-arm": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz",
|
||||
"integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-arm64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz",
|
||||
"integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-ia32": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz",
|
||||
"integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-loong64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz",
|
||||
"integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==",
|
||||
"cpu": [
|
||||
"loong64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-mips64el": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz",
|
||||
"integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==",
|
||||
"cpu": [
|
||||
"mips64el"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-ppc64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz",
|
||||
"integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-riscv64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz",
|
||||
"integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-s390x": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz",
|
||||
"integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-x64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz",
|
||||
"integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/netbsd-arm64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz",
|
||||
"integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"netbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/netbsd-x64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz",
|
||||
"integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"netbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openbsd-arm64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz",
|
||||
"integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openbsd-x64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz",
|
||||
"integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openharmony-arm64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz",
|
||||
"integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openharmony"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/sunos-x64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz",
|
||||
"integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"sunos"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-arm64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz",
|
||||
"integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-ia32": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz",
|
||||
"integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-x64": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz",
|
||||
"integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@nodedc/tokens": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "file:vendor/nodedc-tokens-0.6.0-mission.2.tgz",
|
||||
"integrity": "sha512-rLi+Ft8rewkfSPycnDXwHePv4cDvX91ALLmauHNrxmkmBqQWdqpEsTmnm7stLkASoEfavKVcuCdNNjMiTL9POA=="
|
||||
},
|
||||
"node_modules/@nodedc/ui-core": {
|
||||
"version": "0.7.0",
|
||||
"resolved": "file:vendor/nodedc-ui-core-0.7.0-mission.2.tgz",
|
||||
"integrity": "sha512-CzCdx1sUngTqhZLX4AUHh754csEiqiOp9le4hhrGI6s4ovFXd+RF4WH2vbkkanQifRJlpTl29Zfu4J40x2a6bA==",
|
||||
"dependencies": {
|
||||
"@nodedc/tokens": "0.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@nodedc/ui-dom": {
|
||||
"version": "0.7.0",
|
||||
"resolved": "file:vendor/nodedc-ui-dom-0.7.0-modal.2.tgz",
|
||||
"integrity": "sha512-2uR0Ufk+Ocv5t1phemMPtMub+ogSfqEp70emVKDILOJ62XxZqHQL9Seuug32AWf6AMsEjD3U7y0BoAp+XuD5lw==",
|
||||
"dependencies": {
|
||||
"@nodedc/ui-core": "0.7.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@nodedc/ui-react": {
|
||||
"version": "0.7.0",
|
||||
"resolved": "file:vendor/nodedc-ui-react-0.7.0-mission.2.tgz",
|
||||
"integrity": "sha512-br7JmWo1NHnUrSdW1rApJU4HSBx2evVTjeTqKWZJMRlmasfhGg+OPx/mNgjEksYfNzMchfUj0NZNQwaf+7Uv4w==",
|
||||
"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",
|
||||
"lucide-react": "^0.468.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=18",
|
||||
"react-dom": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild": {
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.1.tgz",
|
||||
"integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"esbuild": "bin/esbuild"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/aix-ppc64": "0.28.1",
|
||||
"@esbuild/android-arm": "0.28.1",
|
||||
"@esbuild/android-arm64": "0.28.1",
|
||||
"@esbuild/android-x64": "0.28.1",
|
||||
"@esbuild/darwin-arm64": "0.28.1",
|
||||
"@esbuild/darwin-x64": "0.28.1",
|
||||
"@esbuild/freebsd-arm64": "0.28.1",
|
||||
"@esbuild/freebsd-x64": "0.28.1",
|
||||
"@esbuild/linux-arm": "0.28.1",
|
||||
"@esbuild/linux-arm64": "0.28.1",
|
||||
"@esbuild/linux-ia32": "0.28.1",
|
||||
"@esbuild/linux-loong64": "0.28.1",
|
||||
"@esbuild/linux-mips64el": "0.28.1",
|
||||
"@esbuild/linux-ppc64": "0.28.1",
|
||||
"@esbuild/linux-riscv64": "0.28.1",
|
||||
"@esbuild/linux-s390x": "0.28.1",
|
||||
"@esbuild/linux-x64": "0.28.1",
|
||||
"@esbuild/netbsd-arm64": "0.28.1",
|
||||
"@esbuild/netbsd-x64": "0.28.1",
|
||||
"@esbuild/openbsd-arm64": "0.28.1",
|
||||
"@esbuild/openbsd-x64": "0.28.1",
|
||||
"@esbuild/openharmony-arm64": "0.28.1",
|
||||
"@esbuild/sunos-x64": "0.28.1",
|
||||
"@esbuild/win32-arm64": "0.28.1",
|
||||
"@esbuild/win32-ia32": "0.28.1",
|
||||
"@esbuild/win32-x64": "0.28.1"
|
||||
}
|
||||
},
|
||||
"node_modules/lucide-react": {
|
||||
"version": "0.468.0",
|
||||
"resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.468.0.tgz",
|
||||
"integrity": "sha512-6koYRhnM2N0GGZIdXzSeiNwguv1gt/FAjZOiPl76roBi3xKEXa4WmfpxgQwTTL4KipXjefrnf3oV4IsYhi4JFA==",
|
||||
"license": "ISC",
|
||||
"peerDependencies": {
|
||||
"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0-rc"
|
||||
}
|
||||
},
|
||||
"node_modules/react": {
|
||||
"version": "19.2.7",
|
||||
"resolved": "https://registry.npmjs.org/react/-/react-19.2.7.tgz",
|
||||
"integrity": "sha512-HNe9WslTbXmFK8o8cmwgAeJFSBvt1bPdHCVKtaaV+WlAN36mpT4hcRpwbf3fY56ar2oIXzsBpOAiIRHAdY0OlQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/react-dom": {
|
||||
"version": "19.2.7",
|
||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.7.tgz",
|
||||
"integrity": "sha512-t0BRVXvbiE/o20Hfw669rLbMCDWtYZLvmJigy2f0MxsXF+71pxhR3xOkspmsO8h3ZlNzyibAmtCa3l4lYKk6gQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"scheduler": "^0.27.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^19.2.7"
|
||||
}
|
||||
},
|
||||
"node_modules/scheduler": {
|
||||
"version": "0.27.0",
|
||||
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz",
|
||||
"integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.9.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz",
|
||||
"integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==",
|
||||
"license": "0BSD"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "dc-cms-ui-build",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "node build.mjs",
|
||||
"check": "node build.mjs --check"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nodedc/tokens": "file:vendor/nodedc-tokens-0.6.0-mission.2.tgz",
|
||||
"@nodedc/ui-core": "file:vendor/nodedc-ui-core-0.7.0-mission.2.tgz",
|
||||
"@nodedc/ui-dom": "file:vendor/nodedc-ui-dom-0.7.0-modal.2.tgz",
|
||||
"@nodedc/ui-react": "file:vendor/nodedc-ui-react-0.7.0-mission.2.tgz",
|
||||
"react": "19.2.7",
|
||||
"react-dom": "19.2.7",
|
||||
"esbuild": "0.28.1"
|
||||
}
|
||||
}
|
||||
+6361
File diff suppressed because it is too large
Load Diff
+794
@@ -0,0 +1,794 @@
|
||||
@import "@nodedc/ui-dom/styles.css";
|
||||
/* CMS domain layout; component geometry and materials belong to @nodedc/ui-core. */
|
||||
@import "@nodedc/ui-core/styles.css";
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
background: var(--nodedc-canvas);
|
||||
color: var(--nodedc-text-primary);
|
||||
}
|
||||
button,
|
||||
input,
|
||||
textarea,
|
||||
select {
|
||||
font: inherit;
|
||||
}
|
||||
button {
|
||||
cursor: pointer;
|
||||
}
|
||||
a {
|
||||
color: inherit;
|
||||
}
|
||||
h2,
|
||||
h3,
|
||||
p {
|
||||
margin-top: 0;
|
||||
}
|
||||
[hidden],
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
.cms-stage {
|
||||
display: grid;
|
||||
place-content: center;
|
||||
justify-items: center;
|
||||
gap: var(--nodedc-space-4);
|
||||
height: 100%;
|
||||
color: var(--nodedc-text-muted);
|
||||
}
|
||||
.cms-site-context {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto auto;
|
||||
align-items: center;
|
||||
gap: var(--nodedc-space-1);
|
||||
}
|
||||
.cms-site-context > a { text-decoration: none; }
|
||||
.cms-static-row { display: flex; align-items: center; gap: var(--nodedc-space-1); }
|
||||
.cms-static-row > .block-btn { flex: 1; min-width: 0; }
|
||||
.cms-preference-controls { width: 14rem; max-width: 100%; }
|
||||
.cms-preferences-fields { display: grid; gap: var(--nodedc-space-4); }
|
||||
@media (max-width: 760px) {
|
||||
.cms-preferences-fields .nodedc-settings-card__head { flex-direction: column; }
|
||||
.cms-preference-controls { width: 100%; }
|
||||
}
|
||||
.cms-ui-island {
|
||||
display: block;
|
||||
min-width: 0;
|
||||
}
|
||||
.cms-switch-binding {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
}
|
||||
.cms-editor,
|
||||
.cms-content-section,
|
||||
.block-form,
|
||||
.knowledge-editor,
|
||||
.project-settings-editor,
|
||||
.content-fields {
|
||||
display: grid;
|
||||
gap: var(--nodedc-space-4);
|
||||
min-width: 0;
|
||||
}
|
||||
.field-grid,
|
||||
.group-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: var(--nodedc-space-5) var(--nodedc-space-4);
|
||||
align-items: start;
|
||||
}
|
||||
.wide,
|
||||
.collection-field,
|
||||
.project-archive-field {
|
||||
grid-column: 1/-1;
|
||||
}
|
||||
.field-control {
|
||||
min-width: 0;
|
||||
}
|
||||
.seo-media-controls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--nodedc-space-2);
|
||||
}
|
||||
.seo-media-controls input {
|
||||
flex: 1 1 16rem;
|
||||
min-width: 0;
|
||||
}
|
||||
.seo-media-controls button {
|
||||
max-width: 100%;
|
||||
}
|
||||
.field-kind,
|
||||
.field-path,
|
||||
.block-meta {
|
||||
display: none;
|
||||
}
|
||||
.nodedc-field__label-row {
|
||||
min-width: 0;
|
||||
}
|
||||
.field-hint,
|
||||
.media-upload-hint,
|
||||
.group-desc,
|
||||
.panel-note,
|
||||
.empty-note,
|
||||
.knowledge-button-hint {
|
||||
color: var(--nodedc-text-muted);
|
||||
font-size: var(--nodedc-font-size-xs);
|
||||
line-height: 1.5;
|
||||
}
|
||||
.section-kicker {
|
||||
color: var(--nodedc-text-muted);
|
||||
font-size: var(--nodedc-font-size-xs);
|
||||
font-weight: var(--nodedc-font-weight-strong);
|
||||
}
|
||||
.secret-input-wrap {
|
||||
position: relative;
|
||||
}
|
||||
.secret-input-wrap input {
|
||||
padding-inline-end: calc(var(--nodedc-control-height) + var(--nodedc-space-2));
|
||||
}
|
||||
.secret-toggle-button {
|
||||
position: absolute;
|
||||
inset-inline-end: var(--nodedc-space-1);
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
.secret-toggle-button svg {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
.project-archive-control,
|
||||
.button-row,
|
||||
.project-settings-actions,
|
||||
.media-modal-actions,
|
||||
.collection-item-actions,
|
||||
.knowledge-tree-actions,
|
||||
.knowledge-rich-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--nodedc-space-2);
|
||||
}
|
||||
.project-archive-field {
|
||||
display: grid;
|
||||
gap: var(--nodedc-space-3);
|
||||
}
|
||||
.project-settings-runtime {
|
||||
display: grid;
|
||||
gap: var(--nodedc-space-3);
|
||||
}
|
||||
.project-settings-runtime > div {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
gap: var(--nodedc-space-2);
|
||||
font-size: var(--nodedc-font-size-sm);
|
||||
}
|
||||
.project-settings-runtime > div > span:first-child {
|
||||
color: var(--nodedc-text-muted);
|
||||
}
|
||||
.project-settings-runtime code {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.status {
|
||||
margin: 0;
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
font-size: var(--nodedc-font-size-xs);
|
||||
line-height: 1.5;
|
||||
color: var(--nodedc-text-secondary);
|
||||
}
|
||||
.status:empty {
|
||||
display: none;
|
||||
}
|
||||
.empty-state {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--nodedc-space-4);
|
||||
padding: var(--nodedc-space-5);
|
||||
}
|
||||
.empty-state h3 {
|
||||
font-size: var(--nodedc-font-size-title);
|
||||
}
|
||||
.empty-state p {
|
||||
color: var(--nodedc-text-secondary);
|
||||
line-height: 1.6;
|
||||
}
|
||||
.empty-icon {
|
||||
color: var(--nodedc-text-muted);
|
||||
}
|
||||
.region-group,
|
||||
.block-list {
|
||||
display: grid;
|
||||
gap: var(--nodedc-space-1);
|
||||
min-width: 0;
|
||||
}
|
||||
.region-title {
|
||||
padding: var(--nodedc-space-3) var(--nodedc-space-5) var(--nodedc-space-2);
|
||||
}
|
||||
.block-copy,
|
||||
.knowledge-tree-copy {
|
||||
display: grid;
|
||||
gap: var(--nodedc-space-1);
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
.block-name,
|
||||
.knowledge-tree-title {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.block-drag-handle {
|
||||
flex: none;
|
||||
touch-action: none;
|
||||
}
|
||||
.block-btn.disabled .block-copy {
|
||||
opacity: .5;
|
||||
}
|
||||
.sorting-source {
|
||||
opacity: .35;
|
||||
}
|
||||
.sortable-placeholder {
|
||||
border: 0;
|
||||
background: var(--nodedc-panel-item-active-bg);
|
||||
border-radius: var(--nodedc-radius-card);
|
||||
}
|
||||
.sortable-ghost {
|
||||
position: fixed;
|
||||
pointer-events: none;
|
||||
z-index: 2000;
|
||||
opacity: .85;
|
||||
}
|
||||
.drag-over {
|
||||
background: var(--nodedc-panel-item-active-bg);
|
||||
}
|
||||
.block-btn.has-drag-handle {
|
||||
user-select: none;
|
||||
}
|
||||
.collection-field,
|
||||
.collection-list,
|
||||
.collection-item-body {
|
||||
display: grid;
|
||||
gap: var(--nodedc-space-3);
|
||||
}
|
||||
.collection-head,
|
||||
.collection-summary {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--nodedc-space-3);
|
||||
}
|
||||
.collection-head {
|
||||
margin-block-end: var(--nodedc-space-2);
|
||||
}
|
||||
.collection-title,
|
||||
.collection-summary-title {
|
||||
font-size: var(--nodedc-font-size-sm);
|
||||
font-weight: var(--nodedc-font-weight-strong);
|
||||
}
|
||||
.collection-summary,
|
||||
.json-details > summary {
|
||||
cursor: pointer;
|
||||
}
|
||||
.collection-item-body {
|
||||
padding-top: var(--nodedc-space-4);
|
||||
}
|
||||
.collection-item-actions {
|
||||
margin-left: auto;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
.collection-drag-handle {
|
||||
touch-action: none;
|
||||
}
|
||||
.json-details > summary {
|
||||
font-size: var(--nodedc-font-size-sm);
|
||||
color: var(--nodedc-text-secondary);
|
||||
}
|
||||
.json-field {
|
||||
margin-top: var(--nodedc-space-3);
|
||||
}
|
||||
.json-field textarea {
|
||||
min-height: 18rem;
|
||||
font-family: monospace;
|
||||
font-size: var(--nodedc-font-size-xs);
|
||||
}
|
||||
.number-control,
|
||||
.range-control {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--nodedc-space-2);
|
||||
}
|
||||
input[type=range] {
|
||||
flex: 1;
|
||||
accent-color: rgb(var(--nodedc-accent-rgb));
|
||||
}
|
||||
.range-value,
|
||||
.number-suffix {
|
||||
font-size: var(--nodedc-font-size-xs);
|
||||
color: var(--nodedc-text-secondary);
|
||||
}
|
||||
.link-mode-grid {
|
||||
display: grid;
|
||||
gap: var(--nodedc-space-3);
|
||||
}
|
||||
.link-mode-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(8rem, 1fr) minmax(0, 2fr);
|
||||
gap: var(--nodedc-space-3);
|
||||
}
|
||||
.service-media-file-button {
|
||||
border: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.service-media-preview {
|
||||
overflow: hidden;
|
||||
}
|
||||
.service-media-preview img,
|
||||
.service-media-preview video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
.media-upload-error,
|
||||
.knowledge-button-error,
|
||||
[role=alert] {
|
||||
color: rgb(var(--nodedc-danger-rgb));
|
||||
font-size: var(--nodedc-font-size-sm);
|
||||
}
|
||||
.service-media-preview.is-solid-dark {
|
||||
background: var(--nodedc-stage);
|
||||
}
|
||||
.media-upload-error:empty,
|
||||
.media-upload-hint:empty {
|
||||
display: none;
|
||||
}
|
||||
.template-modal-head p {
|
||||
margin-block: var(--nodedc-space-2) 0;
|
||||
color: var(--nodedc-text-muted);
|
||||
font-size: var(--nodedc-font-size-sm);
|
||||
line-height: 1.5;
|
||||
}
|
||||
.template-modal-foot {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.template-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: var(--nodedc-space-3);
|
||||
}
|
||||
.template-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--nodedc-space-3);
|
||||
padding: var(--nodedc-space-4);
|
||||
border: 0;
|
||||
border-radius: var(--nodedc-radius-card);
|
||||
background: var(--nodedc-panel-item-bg);
|
||||
color: var(--nodedc-text-primary);
|
||||
text-align: left;
|
||||
}
|
||||
.template-card:hover {
|
||||
background: var(--nodedc-panel-item-hover-bg);
|
||||
}
|
||||
.template-card-copy {
|
||||
display: grid;
|
||||
gap: var(--nodedc-space-1);
|
||||
}
|
||||
.template-card-title {
|
||||
font-size: var(--nodedc-font-size-sm);
|
||||
font-weight: var(--nodedc-font-weight-strong);
|
||||
}
|
||||
.template-card-meta,
|
||||
.template-card-region {
|
||||
font-size: var(--nodedc-font-size-xs);
|
||||
color: var(--nodedc-text-muted);
|
||||
}
|
||||
.template-card-icon {
|
||||
color: var(--nodedc-text-secondary);
|
||||
}
|
||||
dialog.site-dialog {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: var(--nodedc-text-primary);
|
||||
}
|
||||
dialog.site-dialog > form {
|
||||
display: grid;
|
||||
grid-template-rows: auto minmax(0, 1fr) auto;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
}
|
||||
dialog.site-dialog .nodedc-window__body {
|
||||
display: grid;
|
||||
gap: var(--nodedc-space-4);
|
||||
}
|
||||
dialog.site-dialog p {
|
||||
font-size: var(--nodedc-font-size-sm);
|
||||
line-height: 1.5;
|
||||
color: var(--nodedc-text-secondary);
|
||||
}
|
||||
.media-action-body,
|
||||
.knowledge-button-body {
|
||||
display: grid;
|
||||
gap: var(--nodedc-space-4);
|
||||
}
|
||||
.media-toolbar {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: var(--nodedc-space-3);
|
||||
align-items: end;
|
||||
margin-block-end: var(--nodedc-space-3);
|
||||
}
|
||||
.media-filter-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--nodedc-space-1);
|
||||
}
|
||||
.media-kind-row {
|
||||
grid-column: 1/-1;
|
||||
display: flex; align-items: center; gap: var(--nodedc-space-2);
|
||||
}
|
||||
#media-flat-toggle { margin-inline-start: auto; }
|
||||
.media-root-row {
|
||||
grid-column: 1;
|
||||
}
|
||||
.media-upload-btn {
|
||||
grid-column: 2;
|
||||
grid-row: 1;
|
||||
}
|
||||
.media-site-size {
|
||||
font-size: var(--nodedc-font-size-xs);
|
||||
color: var(--nodedc-text-muted);
|
||||
}
|
||||
.media-filter-button[data-active=true] {
|
||||
color: var(--nodedc-text-primary);
|
||||
background: var(--nodedc-panel-item-active-bg);
|
||||
}
|
||||
.media-browser {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(12rem, .4fr);
|
||||
gap: var(--nodedc-space-4);
|
||||
min-height: 20rem;
|
||||
}
|
||||
.media-modal > .nodedc-window__body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
}
|
||||
.media-modal .media-browser { flex: 1; min-height: 12rem; }
|
||||
.media-modal .media-main { display: flex; flex-direction: column; min-height: 0; }
|
||||
.media-modal .media-columns { flex: 1; min-height: 0; }
|
||||
.media-modal .media-column { max-height: none; }
|
||||
.media-modal .media-preview-panel { overflow: auto; }
|
||||
.media-modal-foot { flex-wrap: wrap; }
|
||||
#media-size-status { margin-inline-end: auto; }
|
||||
.media-main {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.media-breadcrumbs {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--nodedc-space-1);
|
||||
overflow: auto;
|
||||
margin-bottom: var(--nodedc-space-2);
|
||||
}
|
||||
.media-breadcrumb-button {
|
||||
border: 0;
|
||||
background: none;
|
||||
color: var(--nodedc-text-secondary);
|
||||
white-space: nowrap;
|
||||
padding: var(--nodedc-space-2);
|
||||
font-size: var(--nodedc-font-size-xs);
|
||||
}
|
||||
.media-columns {
|
||||
display: flex;
|
||||
overflow: auto;
|
||||
min-height: 18rem;
|
||||
border: 0;
|
||||
border-radius: var(--nodedc-radius-card);
|
||||
}
|
||||
.media-column {
|
||||
flex: 1 0 13rem;
|
||||
min-width: 13rem;
|
||||
max-height: 25rem;
|
||||
overflow: auto;
|
||||
}
|
||||
.media-column + .media-column {
|
||||
border-left: 0;
|
||||
}
|
||||
.media-column-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: var(--nodedc-space-2);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background: var(--nodedc-canvas);
|
||||
padding: var(--nodedc-space-3);
|
||||
font-size: var(--nodedc-font-size-xs);
|
||||
color: var(--nodedc-text-muted);
|
||||
}
|
||||
.media-entry {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
gap: var(--nodedc-space-2);
|
||||
padding: var(--nodedc-space-2);
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--nodedc-text-secondary);
|
||||
text-align: left;
|
||||
}
|
||||
.media-entry:hover,
|
||||
.media-entry[data-selected=true],
|
||||
.media-entry[data-active=true] {
|
||||
background: var(--nodedc-panel-item-active-bg);
|
||||
color: var(--nodedc-text-primary);
|
||||
}
|
||||
.media-entry-icon {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
flex: none;
|
||||
font-size: var(--nodedc-font-size-xs);
|
||||
}
|
||||
.media-entry-icon img,
|
||||
.media-entry-icon video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
border-radius: var(--nodedc-radius-control-compact);
|
||||
}
|
||||
.media-entry-copy {
|
||||
display: grid;
|
||||
gap: 2px;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
.media-entry-name {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: var(--nodedc-font-size-sm);
|
||||
}
|
||||
.media-entry-meta,
|
||||
.media-preview-meta,
|
||||
.media-preview-path,
|
||||
.media-usage-pill {
|
||||
font-size: var(--nodedc-font-size-xs);
|
||||
color: var(--nodedc-text-muted);
|
||||
}
|
||||
.media-preview-panel {
|
||||
display: grid;
|
||||
align-content: start;
|
||||
gap: var(--nodedc-space-3);
|
||||
min-width: 0;
|
||||
}
|
||||
.media-preview {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
min-height: 10rem;
|
||||
aspect-ratio: 4/3;
|
||||
background: var(--nodedc-panel-item-bg);
|
||||
border-radius: var(--nodedc-radius-card);
|
||||
overflow: hidden;
|
||||
}
|
||||
.media-preview img,
|
||||
.media-preview video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
.media-preview-copy {
|
||||
display: grid;
|
||||
gap: var(--nodedc-space-1);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.media-preview-name {
|
||||
font-size: var(--nodedc-font-size-sm);
|
||||
font-weight: var(--nodedc-font-weight-strong);
|
||||
}
|
||||
.media-preview-actions {
|
||||
display: flex;
|
||||
gap: var(--nodedc-space-2);
|
||||
}
|
||||
.media-column-empty,
|
||||
.media-empty {
|
||||
padding: var(--nodedc-space-4);
|
||||
color: var(--nodedc-text-muted);
|
||||
font-size: var(--nodedc-font-size-sm);
|
||||
}
|
||||
.media-context-menu {
|
||||
position: fixed;
|
||||
z-index: 1600;
|
||||
display: grid;
|
||||
gap: var(--nodedc-space-1);
|
||||
min-width: 13rem;
|
||||
padding: var(--nodedc-space-2);
|
||||
border-radius: var(--nodedc-radius-card);
|
||||
background: var(--nodedc-canvas);
|
||||
box-shadow: var(--nodedc-glass-dropdown-shadow);
|
||||
}
|
||||
.media-context-menu button {
|
||||
text-align: left;
|
||||
}
|
||||
.media-drop-zone.drag-over {
|
||||
background: var(--nodedc-panel-item-active-bg);
|
||||
}
|
||||
.admin-file-picker-input {
|
||||
display: none;
|
||||
}
|
||||
.knowledge-tree,
|
||||
.knowledge-tree-children {
|
||||
display: grid;
|
||||
gap: var(--nodedc-space-1);
|
||||
}
|
||||
.knowledge-tree-children {
|
||||
padding-left: var(--nodedc-space-3);
|
||||
}
|
||||
.knowledge-tree-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--nodedc-space-1);
|
||||
min-width: 0;
|
||||
}
|
||||
.knowledge-tree-select {
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
.knowledge-tree-actions {
|
||||
gap: 2px;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
.knowledge-tree-meta {
|
||||
font-size: var(--nodedc-font-size-xs);
|
||||
color: var(--nodedc-text-muted);
|
||||
}
|
||||
.knowledge-rich-toolbar {
|
||||
margin-block-end: var(--nodedc-space-3);
|
||||
}
|
||||
.knowledge-rich-editor {
|
||||
min-height: 22rem;
|
||||
padding: var(--nodedc-space-4);
|
||||
border-radius: var(--nodedc-radius-card);
|
||||
background: var(--nodedc-field-bg);
|
||||
color: var(--nodedc-text-primary);
|
||||
line-height: 1.65;
|
||||
outline: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.knowledge-rich-editor:focus {
|
||||
background: var(--nodedc-panel-item-active-bg);
|
||||
}
|
||||
.knowledge-rich-editor img {
|
||||
max-width: 100%;
|
||||
}
|
||||
.knowledge-rich-editor h2 {
|
||||
margin-block: 1em .5em;
|
||||
}
|
||||
.seo-metric-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
|
||||
gap: var(--nodedc-space-3);
|
||||
}
|
||||
.seo-metric {
|
||||
display: grid;
|
||||
gap: var(--nodedc-space-1);
|
||||
padding: var(--nodedc-space-3);
|
||||
border-radius: var(--nodedc-radius-card);
|
||||
background: var(--nodedc-panel-item-bg);
|
||||
font-size: var(--nodedc-font-size-sm);
|
||||
}
|
||||
.seo-field-meter {
|
||||
font-size: var(--nodedc-font-size-xs);
|
||||
color: var(--nodedc-text-muted);
|
||||
}
|
||||
.publish-progress-track {
|
||||
height: var(--nodedc-space-2);
|
||||
border-radius: var(--nodedc-radius-circle);
|
||||
background: var(--nodedc-panel-item-bg);
|
||||
overflow: hidden;
|
||||
}
|
||||
.publish-progress-fill {
|
||||
height: 100%;
|
||||
background: var(--nodedc-text-primary);
|
||||
transition: width .2s;
|
||||
}
|
||||
.publish-progress-summary,
|
||||
.publish-progress-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
gap: var(--nodedc-space-2);
|
||||
font-size: var(--nodedc-font-size-sm);
|
||||
}
|
||||
@media (max-width: 1100px) {
|
||||
.field-grid,
|
||||
.group-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.template-list {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.media-browser {
|
||||
grid-template-columns: minmax(0, 1fr) 12rem;
|
||||
}
|
||||
}
|
||||
@media (max-width: 760px) {
|
||||
.media-browser {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.media-preview-panel {
|
||||
display: none;
|
||||
}
|
||||
.template-list {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.link-mode-row {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.collection-summary {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.collection-item-actions {
|
||||
margin-left: 0;
|
||||
}
|
||||
.media-toolbar {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.media-upload-btn {
|
||||
grid-column: 1;
|
||||
grid-row: auto;
|
||||
}
|
||||
.media-modal-actions {
|
||||
gap: var(--nodedc-space-1);
|
||||
}
|
||||
.media-site-size {
|
||||
display: none;
|
||||
}
|
||||
.knowledge-tree-actions {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
.cms-site-context {
|
||||
padding-inline: var(--nodedc-space-4);
|
||||
}
|
||||
.cms-block-options-body {
|
||||
display: grid;
|
||||
gap: var(--nodedc-space-3);
|
||||
padding-top: var(--nodedc-space-3);
|
||||
}
|
||||
.range-control > .cms-ui-island {
|
||||
flex: 1;
|
||||
}
|
||||
.publish-progress-stats {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--nodedc-space-3);
|
||||
font-size: var(--nodedc-font-size-sm);
|
||||
color: var(--nodedc-text-secondary);
|
||||
}
|
||||
.cms-editor-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--nodedc-space-2);
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.media-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--nodedc-space-3); overflow: auto; min-height: 0; flex: 1; align-content: start; }
|
||||
.media-gallery .media-entry { display: flex; flex-direction: column; align-items: stretch; position: relative; border-radius: var(--nodedc-radius-card); min-width: 0; }
|
||||
.media-gallery .media-entry-icon { width: 100%; height: 8rem; border-radius: var(--nodedc-radius-control-compact); background: var(--nodedc-surface-group); }
|
||||
.media-gallery .media-entry-icon img { width: 100%; height: 100%; min-height: 0; max-height: 8rem; object-fit: contain; }
|
||||
.media-gallery .media-entry-icon > svg { width: 2rem; height: 2rem; }
|
||||
.media-gallery .media-entry-copy { flex: none; }
|
||||
.media-gallery .media-entry-path { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; order: 3; }
|
||||
.media-gallery .media-entry-status { position: absolute; top: var(--nodedc-space-3); right: var(--nodedc-space-3); }
|
||||
.media-gallery .media-entry-arrow { display: none; }
|
||||
.media-modal .media-gallery { min-height: 0; }
|
||||
.media-modal #media-breadcrumbs { margin-block-start: var(--nodedc-space-2); }
|
||||
@@ -0,0 +1,491 @@
|
||||
// CMS application adapter. Shared component implementation belongs to @nodedc packages.
|
||||
import React from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { flushSync } from "react-dom";
|
||||
import { Select, Switch, ColorField, RangeControl, ProgressBar, Dropdown, IconButton, Icon, StatusBadge } from "@nodedc/ui-react";
|
||||
import { installPreferences } from "./preferences.mjs";
|
||||
import { createApplicationWorkspaceController, createModalController, createModalSizeController } from "@nodedc/ui-dom";
|
||||
import { guiPreferences } from './gui-preferences.mjs';
|
||||
const h = React.createElement, $ = (s, r = document) => r.querySelector(s), all = (s, r = document) => [...r.querySelectorAll(s)];
|
||||
const clone = (name) => $(`#ds-${name}`).content.firstElementChild.cloneNode(true);
|
||||
function addClass(node, name) {
|
||||
if (node) node.classList.add(...name.split(" "));
|
||||
}
|
||||
const islands = /* @__PURE__ */ new Map();
|
||||
const modalBindings = [];
|
||||
let queued = false, observer, fieldNumber = 0, addBlockButton;
|
||||
function schedule() {
|
||||
if (!queued) {
|
||||
queued = true;
|
||||
queueMicrotask(() => {
|
||||
queued = false;
|
||||
refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
function island(control) {
|
||||
let item = islands.get(control);
|
||||
if (!item) {
|
||||
const host = document.createElement("span");
|
||||
host.className = "cms-ui-island";
|
||||
control.after(host);
|
||||
control.hidden = true;
|
||||
control.tabIndex = -1;
|
||||
control.setAttribute("aria-hidden", "true");
|
||||
item = { host, root: createRoot(host), signature: "" };
|
||||
islands.set(control, item);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
function selects() {
|
||||
for (const control of all("select")) {
|
||||
const item = island(control), options = [...control.options].map((o) => ({ value: o.value, label: control.id === "site-selector" ? o.textContent.replace(/^NODE\.?DC\s*[—–-]\s*/i, "") : o.textContent, disabled: o.disabled }));
|
||||
const label = control.getAttribute("aria-label") || control.closest("label")?.querySelector(".nodedc-field__label")?.textContent || "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435";
|
||||
const signature = JSON.stringify([control.value, options, control.disabled, label]);
|
||||
if (signature === item.signature) continue;
|
||||
item.signature = signature;
|
||||
flushSync(() => item.root.render(h(Select, { variant: control.id === "site-selector" ? "split" : "integrated", shape: control.id === "site-selector" ? "pill" : "default", value: control.value, options, label, disabled: control.disabled, onChange: (value) => {
|
||||
control.value = value;
|
||||
control.dispatchEvent(new Event("input", { bubbles: true }));
|
||||
control.dispatchEvent(new Event("change", { bubbles: true }));
|
||||
schedule();
|
||||
} })));
|
||||
if (control.id) control.closest("label")?.setAttribute("for", control.id + "-trigger");
|
||||
const trigger = $("button", item.host);
|
||||
if (trigger && control.id) trigger.id = control.id + "-trigger";
|
||||
}
|
||||
}
|
||||
function switches() {
|
||||
for (const input of all("input[type=checkbox]")) {
|
||||
const parent = input.closest("label") || input.parentElement;
|
||||
let item = islands.get(input);
|
||||
if (!item) {
|
||||
const label = parent.querySelector(".field-label-text")?.textContent || [...parent.childNodes].filter((n) => n !== input).map((n) => n.textContent).join(" ").trim() || input.getAttribute("aria-label") || "\u0412\u043A\u043B\u044E\u0447\u0435\u043D\u043E";
|
||||
item = island(input);
|
||||
item.label = label.replace(/\s+/g, " ").trim();
|
||||
for (const child of [...parent.childNodes]) if (child !== input && child !== item.host && !(child.nodeType === 1 && child.matches("input,select,textarea"))) {
|
||||
if (child.nodeType === 1) child.hidden = true;
|
||||
else if (child.nodeType === 3) child.textContent = "";
|
||||
}
|
||||
if (!parent.classList.contains("link-mode-row")) parent.classList.add("cms-switch-binding");
|
||||
for (const control of all("input:not([type=checkbox])", parent)) control.setAttribute("aria-label", item.label);
|
||||
parent.addEventListener("click", (event) => {
|
||||
if (event.target.closest("button")) event.preventDefault();
|
||||
});
|
||||
}
|
||||
const signature = JSON.stringify([input.checked, input.disabled]);
|
||||
if (signature === item.signature) continue;
|
||||
item.signature = signature;
|
||||
flushSync(() => item.root.render(h(Switch, { checked: input.checked, disabled: input.disabled, label: item.label, onChange: (checked) => {
|
||||
input.checked = checked;
|
||||
input.dispatchEvent(new Event("input", { bubbles: true }));
|
||||
input.dispatchEvent(new Event("change", { bubbles: true }));
|
||||
schedule();
|
||||
} })));
|
||||
}
|
||||
}
|
||||
function ranges() {
|
||||
for (const input of all("input[type=range]")) {
|
||||
if (input.closest(".cms-ui-island,.nodedc-color-palette-surface")) continue;
|
||||
const item = island(input), field = input.closest(".range-field"), output = field?.querySelector(".range-value");
|
||||
if (output) output.hidden = true;
|
||||
const label = field?.querySelector(".field-label-text")?.textContent || "\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435";
|
||||
const signature = JSON.stringify([input.value, input.min, input.max, input.step, input.disabled]);
|
||||
if (signature === item.signature) continue;
|
||||
item.signature = signature;
|
||||
const min = Number(input.min), max = Number(input.max);
|
||||
flushSync(() => item.root.render(h(RangeControl, { label, value: Number(input.value), min, max, step: input.step, exactValueBounds: { min, max }, disabled: input.disabled, onChange: (value) => {
|
||||
input.value = String(value);
|
||||
input.dispatchEvent(new Event("input", { bubbles: true }));
|
||||
schedule();
|
||||
} })));
|
||||
}
|
||||
}
|
||||
function colors() {
|
||||
for (const input of all("input[data-color-field]")) {
|
||||
const item = island(input);
|
||||
const label = input.dataset.colorField;
|
||||
const signature = JSON.stringify([label, input.value]);
|
||||
if (item.signature === signature) continue;
|
||||
item.signature = signature;
|
||||
flushSync(() => item.root.render(h(ColorField, {
|
||||
label,
|
||||
value: input.value,
|
||||
onChange: value => {
|
||||
input.value = value;
|
||||
input.dispatchEvent(new Event("input", { bubbles: true }));
|
||||
schedule();
|
||||
},
|
||||
})));
|
||||
}
|
||||
}
|
||||
function progress() {
|
||||
for (const track of all(".publish-progress-track")) {
|
||||
const item = island(track), value = Number(track.getAttribute("aria-valuenow") || 0);
|
||||
if (item.signature === String(value)) continue;
|
||||
item.signature = String(value);
|
||||
flushSync(() => item.root.render(h(ProgressBar, { label: "\u041F\u0440\u043E\u0433\u0440\u0435\u0441\u0441 \u043F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u0438", value: value / 100 })));
|
||||
}
|
||||
}
|
||||
function fields() {
|
||||
for (const field of all(".field-control:not(.boolean-field):not(.service-media-field),.json-field,.media-search,.site-dialog label")) {
|
||||
if (field.dataset.dsField) continue;
|
||||
field.dataset.dsField = "true";
|
||||
addClass(field, "nodedc-field");
|
||||
let row = $(":scope > .field-label-row", field), label = row?.querySelector(".field-label-text") || $(":scope > span:not(.field-kind):not(.field-path):not(.field-hint)", field);
|
||||
if (!row) {
|
||||
row = clone("field").querySelector(".nodedc-field__label-row");
|
||||
if (label) {
|
||||
row.querySelector(".nodedc-field__label").replaceWith(label);
|
||||
} else {
|
||||
label = row.querySelector(".nodedc-field__label");
|
||||
label.textContent = [...field.childNodes].filter((n) => n.nodeType === 3).map((n) => n.textContent).join(" ").trim();
|
||||
for (const n of [...field.childNodes]) if (n.nodeType === 3) n.textContent = "";
|
||||
}
|
||||
field.prepend(row);
|
||||
}
|
||||
addClass(row, "nodedc-field__label-row");
|
||||
addClass(label || $(".field-label-text", row), "nodedc-field__label");
|
||||
const input = $("input:not([type=hidden]):not([type=checkbox]),textarea,select", field);
|
||||
if (input && !input.id) input.id = "cms-field-" + ++fieldNumber;
|
||||
if (input && field.tagName === "LABEL") field.htmlFor = input.id;
|
||||
for (const hint of all(".field-hint,.group-desc", field)) addClass(hint, "nodedc-field__description");
|
||||
}
|
||||
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() {
|
||||
// As in Mission Core, fields sit directly in SettingsCard. Only independent
|
||||
// collection entries and disclosures own another shared neutral group.
|
||||
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";
|
||||
// The content overview is layout, not a third card around semantic groups.
|
||||
addClass(card, card.querySelector(":scope > #content-fields") ? "cms-content-section" : "nodedc-settings-card");
|
||||
const oldHead = $(":scope > .card-head,:scope > .group-head,:scope > .panel-head,:scope > .publish-progress-head", card);
|
||||
const template = clone("card"), head = $(".nodedc-settings-card__head", template), titles = $(".nodedc-settings-card__titles", template), body = $(".nodedc-settings-card__body", template);
|
||||
head.replaceChildren(titles);
|
||||
titles.replaceChildren();
|
||||
body.replaceChildren();
|
||||
if (oldHead) {
|
||||
const title = $("h3,h2", oldHead) || oldHead;
|
||||
const kicker = $(".section-kicker", oldHead);
|
||||
if (kicker) titles.append(kicker);
|
||||
if (title?.hasAttribute("data-publish-title")) {
|
||||
titles.append(title);
|
||||
} else if (title === oldHead) {
|
||||
const text = document.createElement("h2");
|
||||
for (const n of [...title.childNodes]) {
|
||||
if (n.nodeType === 3 || n.nodeType === 1 && !n.matches("label,button")) text.append(n);
|
||||
}
|
||||
titles.append(text);
|
||||
for (const n of [...title.children]) head.append(n);
|
||||
} else if (title) {
|
||||
const next = document.createElement("h2");
|
||||
for (const attr of title.attributes) next.setAttribute(attr.name, attr.value);
|
||||
next.append(...title.childNodes);
|
||||
titles.append(next);
|
||||
}
|
||||
const desc = $(".project-settings-hint,.panel-note,.group-desc", oldHead) || $(":scope > .group-desc", card);
|
||||
if (desc) {
|
||||
const paragraph = document.createElement("p");
|
||||
for (const attr of desc.attributes) paragraph.setAttribute(attr.name, attr.value);
|
||||
paragraph.classList.add("nodedc-description");
|
||||
paragraph.append(...desc.childNodes);
|
||||
desc.remove();
|
||||
titles.append(paragraph);
|
||||
}
|
||||
for (const action of all(":scope > .toggle-row,:scope > .button-row,:scope > .group-head-toggle,:scope > [data-publish-percent]", oldHead)) head.append(action);
|
||||
oldHead.remove();
|
||||
} else head.remove();
|
||||
body.append(...card.childNodes);
|
||||
card.append(...template.childNodes);
|
||||
}
|
||||
}
|
||||
const iconById = { "move-up": "chevron-up", "move-down": "chevron-down", duplicate: "copy", copy: "copy", "paste-after": "clipboard", "delete-block": "trash", "template-modal-close": "close", "media-modal-close": "close", "media-trash-toggle": "trash", "media-delete": "trash" };
|
||||
function buttons() {
|
||||
for (const button of all("button")) {
|
||||
if (button.closest(".cms-ui-island,.nodedc-color-palette-surface") || button.className.includes("nodedc-") || button.matches(".media-entry,.knowledge-tree-select,.service-media-source-button,.service-media-file-button,.media-breadcrumb-button,.template-card")) continue;
|
||||
const iconLike = button.matches(".icon-action-btn,.collection-icon-btn,.knowledge-tree-action,.secret-toggle-button,.collection-drag-handle,.modal-close-button,.media-header-action");
|
||||
const model = clone(iconLike ? "iconButton" : "button");
|
||||
addClass(button, model.className);
|
||||
if (iconLike) {
|
||||
const title = button.getAttribute("aria-label") || button.title || button.textContent;
|
||||
button.setAttribute("aria-label", title);
|
||||
button.title = title;
|
||||
const icon = iconById[button.id] || (button.classList.contains("secret-toggle-button") ? "eye" : /удал/i.test(title) ? "trash" : /добав/i.test(title) ? "plus" : /выше|вверх|поднять/i.test(title) ? "chevron-up" : /ниже|вниз|опустить/i.test(title) ? "chevron-down" : /коп|дублир/i.test(title) ? "copy" : "move");
|
||||
button.replaceChildren(button.matches(".collection-drag-handle") ? clone("dragHandle").firstElementChild : clone("icon-" + icon));
|
||||
} else {
|
||||
button.dataset.variant = button.matches(".primary-btn,[type=submit]") ? "primary" : button.matches(".danger-btn") ? "danger" : "secondary";
|
||||
button.dataset.tone = "neutral";
|
||||
const content = model.firstElementChild;
|
||||
content.replaceChildren(...button.childNodes);
|
||||
button.append(content);
|
||||
}
|
||||
}
|
||||
}
|
||||
function navItems() {
|
||||
for (const item of all(".block-btn,.knowledge-tree-select")) {
|
||||
addClass(item, "nodedc-admin-panel__nav-item");
|
||||
item.dataset.active = String(item.classList.contains("active") || item.closest(".knowledge-tree-row")?.dataset.active === "true");
|
||||
const title = $(".block-name,.knowledge-tree-title", item);
|
||||
if (title) item.title = title.textContent;
|
||||
const icon = $(".block-icon,.knowledge-tree-icon", item);
|
||||
if (icon && !icon.dataset.dsIcon) {
|
||||
icon.dataset.dsIcon = "true";
|
||||
addClass(icon, "nodedc-admin-panel__nav-icon");
|
||||
icon.replaceChildren(clone("icon-" + (item.classList.contains("knowledge-tree-select") ? "file" : "layers")));
|
||||
}
|
||||
const handle = $(".block-drag-handle", item);
|
||||
if (handle) {
|
||||
addClass(handle, "nodedc-drag-handle");
|
||||
if (!handle.dataset.dsIcon) {
|
||||
handle.dataset.dsIcon = "true";
|
||||
handle.replaceChildren(clone("dragHandle").firstElementChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const label of all(".region-title")) addClass(label, "nodedc-admin-panel__group-label");
|
||||
}
|
||||
function actionMenus() {
|
||||
for (const actions of all(".knowledge-tree-actions")) {
|
||||
const buttons2 = all(":scope > button", actions);
|
||||
if (buttons2.length < 2) continue;
|
||||
const item = island(actions), title = actions.closest(".knowledge-tree-row")?.querySelector(".knowledge-tree-title")?.textContent || "\u041C\u0430\u0442\u0435\u0440\u0438\u0430\u043B";
|
||||
const options = buttons2.map((button) => ({ label: button.title || button.getAttribute("aria-label"), disabled: button.disabled }));
|
||||
const signature = JSON.stringify([title, options]);
|
||||
if (signature === item.signature) continue;
|
||||
item.signature = signature;
|
||||
flushSync(() => item.root.render(h(Dropdown, { minWidth: 240, placement: "bottom-end", trigger: (api) => h(IconButton, { label: "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044F: " + title, ref: (node) => {
|
||||
api.setAnchorRef(node);
|
||||
api.setTriggerRef(node);
|
||||
}, onClick: api.toggle, "aria-expanded": api.open, "aria-controls": api.surfaceId, "aria-haspopup": "menu" }, h(Icon, { name: "chevron-down" })) }, ({ close }) => buttons2.map((button, index) => h("button", { key: index, type: "button", role: "menuitem", className: "nodedc-dropdown-option", disabled: button.disabled, onClick: () => {
|
||||
close();
|
||||
button.click();
|
||||
} }, h("span", null), h("span", { className: "nodedc-dropdown-option__body" }, h("span", { className: "nodedc-dropdown-option__label" }, options[index].label)))))));
|
||||
}
|
||||
}
|
||||
function editorActions() {
|
||||
const mobile = matchMedia("(max-width:760px)").matches, dirty = $("#dirty-state"), badge = island(dirty);
|
||||
const tone = dirty.dataset.dirty === "true" ? "warning" : "neutral", text = dirty.textContent;
|
||||
const signature = JSON.stringify([tone, text, mobile]);
|
||||
if (badge.signature !== signature) {
|
||||
badge.signature = signature;
|
||||
flushSync(() => badge.root.render(h(StatusBadge, { tone, variant: mobile ? "indicator" : "badge", title: text, "aria-label": text, role: "status" }, mobile ? null : text)));
|
||||
}
|
||||
let binding = $("#cms-mobile-actions-binding");
|
||||
if (!binding) {
|
||||
binding = document.createElement("span");
|
||||
binding.id = "cms-mobile-actions-binding";
|
||||
$(".cms-editor-actions").append(binding);
|
||||
}
|
||||
const item = island(binding), buttons2 = ["reload", "render", "publish"].map((id) => $("#" + id));
|
||||
for (const button of buttons2) button.hidden = mobile;
|
||||
item.host.hidden = !mobile;
|
||||
if (!mobile) return;
|
||||
const options = buttons2.filter((button) => !button.classList.contains("hidden")).map((button) => ({ button, label: button.id === "reload" ? "\u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435" : button.textContent, disabled: button.disabled }));
|
||||
const key = JSON.stringify(options.map(({ label, disabled }) => [label, disabled]));
|
||||
if (item.signature === key) return;
|
||||
item.signature = key;
|
||||
flushSync(() => item.root.render(h(Dropdown, { minWidth: 240, placement: "bottom-end", trigger: (api) => h(IconButton, { label: "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044F \u0441 \u0441\u0430\u0439\u0442\u043E\u043C", ref: (node) => {
|
||||
api.setAnchorRef(node);
|
||||
api.setTriggerRef(node);
|
||||
}, onClick: api.toggle, "aria-expanded": api.open, "aria-controls": api.surfaceId, "aria-haspopup": "menu" }, h(Icon, { name: "chevron-down" })) }, ({ close }) => options.map(({ button, label, disabled }) => h("button", { key: button.id, type: "button", role: "menuitem", className: "nodedc-dropdown-option", disabled, onClick: () => {
|
||||
close();
|
||||
button.click();
|
||||
} }, h("span", null), h("span", { className: "nodedc-dropdown-option__body" }, h("span", { className: "nodedc-dropdown-option__label" }, label)))))));
|
||||
}
|
||||
function mediaFields() {
|
||||
const map = { ".service-media-field": "nodedc-media-field", ".field-label-row": "nodedc-media-field__label-row", ".field-label-text": "nodedc-media-field__label", ".service-media-control": "nodedc-media-control", ".service-media-file-control": "nodedc-media-file", ".service-media-file-button": "nodedc-media-file__button", ".service-media-file-name": "nodedc-media-file__name", ".service-media-url-input": "nodedc-media-url", ".service-media-source-switch": "nodedc-media-source-switch", ".service-media-source-button": "nodedc-media-source-button", ".service-media-preview": "nodedc-media-preview", ".media-upload-hint": "nodedc-media-field__hint", ".media-upload-error": "nodedc-media-field__error" };
|
||||
for (const field of all(".service-media-field")) {
|
||||
for (const [selector, classes] of Object.entries(map)) for (const node of field.matches(selector) ? [field] : all(selector, field)) addClass(node, classes);
|
||||
for (const button of all(".service-media-source-button", field)) button.setAttribute("aria-pressed", button.dataset.active);
|
||||
const control = $(".service-media-control", field);
|
||||
if (control) control.dataset.source = $(".service-media-url-input", field).hidden ? "file" : "url";
|
||||
}
|
||||
}
|
||||
function initModals() {
|
||||
for (const overlay of all(".template-modal-layer")) {
|
||||
const dialog = $(":scope > article", overlay), head = $(":scope > header", dialog), foot = $(":scope > footer", dialog), body = document.createElement("div");
|
||||
body.className = "nodedc-window__body";
|
||||
for (const child of [...dialog.children]) if (child !== head && child !== foot) body.append(child);
|
||||
if (head) {
|
||||
addClass(head, "nodedc-window__head");
|
||||
addClass($("h2", head), "nodedc-window__title");
|
||||
}
|
||||
if (foot) addClass(foot, "nodedc-window__footer");
|
||||
dialog.replaceChildren(...[head, body, foot].filter(Boolean));
|
||||
dialog.dataset.size = overlay.id === "media-modal" || overlay.id === "template-modal" ? "lg" : "sm";
|
||||
addClass(dialog, "nodedc-glass nodedc-material-rim");
|
||||
dialog.dataset.tone = "strong";
|
||||
const labelled = overlay.getAttribute("aria-labelledby");
|
||||
if (labelled) dialog.setAttribute("aria-labelledby", labelled);
|
||||
overlay.removeAttribute("role");
|
||||
overlay.removeAttribute("aria-modal");
|
||||
const controller = createModalController({ overlay, dialog, closeOnBackdrop: false, closeOnEscape: false, lockBodyScroll: false });
|
||||
let sizeController;
|
||||
if (overlay.id === 'media-modal') {
|
||||
sizeController = createModalSizeController({ dialog, initialSize: guiPreferences.modalSize('media-library') || { width: 1280, height: 820 }, minimum: { width: 640, height: 480 }, onSizeCommit: size => guiPreferences.setModalSize('media-library', size) });
|
||||
guiPreferences.subscribe((document, status) => {
|
||||
const size = document.gui.modals['media-library'];
|
||||
if (size) sizeController.setSize(size);
|
||||
const message = $('#media-size-status');
|
||||
message.textContent = status === 'error' ? 'Не удалось сохранить размер окна.' : status === 'saving' ? 'Сохранение размера…' : 'Размер окна сохраняется в профиле';
|
||||
$('#media-size-retry').hidden = status !== 'error';
|
||||
});
|
||||
$('#media-size-retry').addEventListener('click', () => guiPreferences.pending.length ? guiPreferences.flush() : guiPreferences.load());
|
||||
}
|
||||
modalBindings.push({ overlay, dialog, controller, sizeController });
|
||||
}
|
||||
for (const dialog of all("dialog.site-dialog")) {
|
||||
const overlay = document.createElement("div");
|
||||
overlay.className = "hidden";
|
||||
dialog.before(overlay);
|
||||
overlay.append(dialog);
|
||||
dialog.setAttribute("open", "");
|
||||
dialog.dataset.size = "sm";
|
||||
addClass(dialog, "nodedc-glass nodedc-material-rim");
|
||||
dialog.dataset.tone = "strong";
|
||||
const form = $("form", dialog), head = document.createElement("header"), body = document.createElement("div"), foot = $(".site-dialog-actions", form);
|
||||
head.className = "nodedc-window__head";
|
||||
body.className = "nodedc-window__body";
|
||||
const titles = document.createElement("div");
|
||||
titles.className = "nodedc-window__titles";
|
||||
head.append(titles);
|
||||
const title = $("h2", form);
|
||||
title.id = dialog.id + "-title";
|
||||
dialog.setAttribute("aria-labelledby", title.id);
|
||||
title.className = "nodedc-window__title";
|
||||
titles.append(title);
|
||||
body.append(...[...form.childNodes].filter((n) => n !== foot));
|
||||
foot.classList.add("nodedc-window__footer");
|
||||
form.replaceChildren(head, body, foot);
|
||||
let returnFocus;
|
||||
const controller = createModalController({ overlay, dialog, closeOnEscape: true, lockBodyScroll: false, onOpenChange: (open) => {
|
||||
overlay.classList.toggle("hidden", !open);
|
||||
if (!open) requestAnimationFrame(() => returnFocus?.focus());
|
||||
} });
|
||||
dialog.showModal = () => {
|
||||
returnFocus = document.activeElement;
|
||||
document.body.append(overlay);
|
||||
overlay.classList.remove("hidden");
|
||||
controller.open();
|
||||
};
|
||||
dialog.close = () => {
|
||||
overlay.classList.add("hidden");
|
||||
controller.close();
|
||||
};
|
||||
modalBindings.push({ overlay, dialog, controller });
|
||||
}
|
||||
}
|
||||
function refresh() {
|
||||
observer?.disconnect();
|
||||
try {
|
||||
for (const [control, item] of islands) if (!control.isConnected) {
|
||||
item.root.unmount();
|
||||
item.host.remove();
|
||||
islands.delete(control);
|
||||
}
|
||||
cards();
|
||||
fields();
|
||||
switches();
|
||||
selects();
|
||||
ranges();
|
||||
colors();
|
||||
progress();
|
||||
buttons();
|
||||
navItems();
|
||||
actionMenus();
|
||||
editorActions();
|
||||
mediaFields();
|
||||
$('#cms-shell').inert = false;
|
||||
for (const binding of modalBindings) binding.dialog.inert = false;
|
||||
for (const binding of modalBindings) {
|
||||
const open = !binding.overlay.classList.contains("hidden");
|
||||
if (open && !binding.controller.isOpen()) {
|
||||
document.body.append(binding.overlay);
|
||||
binding.controller.open();
|
||||
binding.sizeController?.refresh();
|
||||
}
|
||||
else if (!open && binding.controller.isOpen()) binding.controller.close();
|
||||
}
|
||||
const topModal = all('.nodedc-overlay:not(.hidden):not([hidden])').at(-1);
|
||||
$('#cms-shell').inert = Boolean(topModal);
|
||||
for (const binding of modalBindings) binding.dialog.inert = Boolean(topModal && binding.overlay !== topModal);
|
||||
if ($('#delete-modal-body').textContent === 'Вы действительно подтвердить удаление элемента?') $('#delete-modal-body').textContent = 'Удалить выбранный элемент?';
|
||||
if ($('#delete-modal-confirm').textContent.trim() === 'Да') $('#delete-modal-confirm').textContent = 'Удалить';
|
||||
const staticItem = $("#regions > section:first-child .block-btn");
|
||||
if (staticItem) {
|
||||
let row = staticItem.closest(".cms-static-row");
|
||||
if (!row) { row = document.createElement("div"); row.className = "cms-static-row"; staticItem.before(row); row.append(staticItem); }
|
||||
row.append(addBlockButton);
|
||||
} else if (addBlockButton) $("#cms-add-block-parking").append(addBlockButton);
|
||||
const dirty = $("#dirty-state");
|
||||
dirty.dataset.tone = dirty.dataset.dirty === "true" ? "warning" : "neutral";
|
||||
for (const button of all(".nodedc-header__nav-item")) {
|
||||
if (button.dataset.active === "true") button.setAttribute("aria-current", "page");
|
||||
else button.removeAttribute("aria-current");
|
||||
}
|
||||
} finally {
|
||||
observer?.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ["class", "disabled", "data-dirty", "data-active", "hidden", "aria-valuenow"] });
|
||||
}
|
||||
}
|
||||
function installDesignSystem() {
|
||||
installPreferences();
|
||||
addBlockButton = $("#add-block");
|
||||
for (const marker of all("[data-cms-mode]")) marker.closest("button").id = "admin-mode-" + marker.dataset.cmsMode;
|
||||
$(".nodedc-header-navigation").classList.add("nodedc-expanded-nav-group");
|
||||
$(".nodedc-admin-panel__nav").id = "regions";
|
||||
$(".nodedc-application-panel__titles h1").id = "selected-title";
|
||||
$(".nodedc-application-panel__titles p").id = "selected-region";
|
||||
$("#status").setAttribute("role", "status");
|
||||
$("#status").setAttribute("aria-live", "polite");
|
||||
const shell = $("#cms-shell");
|
||||
const workspace = createApplicationWorkspaceController({ navigationOpen: true, activeView: "cms", contentExpanded: true, onChange: (state) => {
|
||||
$(".cms-stage").hidden = state.navigationOpen || state.contentOpen;
|
||||
shell.dataset.navigationOpen = String(state.navigationOpen);
|
||||
shell.dataset.contentOpen = String(state.contentOpen);
|
||||
shell.dataset.contentExpanded = String(state.contentExpanded);
|
||||
$(".nodedc-app-shell__navigation").hidden = !state.navigationOpen;
|
||||
$(".nodedc-app-shell__navigation").inert = matchMedia("(max-width:760px)").matches && state.contentOpen;
|
||||
$(".nodedc-app-shell__content").hidden = !state.contentOpen;
|
||||
} });
|
||||
matchMedia("(max-width:760px)").addEventListener("change", (e) => {
|
||||
$(".nodedc-app-shell__navigation").inert = e.matches && workspace.getState().contentOpen;
|
||||
schedule();
|
||||
});
|
||||
$("#toggle-navigation").onclick = () => {
|
||||
if (matchMedia("(max-width:760px)").matches && workspace.getState().contentOpen) workspace.closeView();
|
||||
workspace.openNavigation();
|
||||
};
|
||||
$("#open-navigation").onclick = () => workspace.openNavigation();
|
||||
$(".nodedc-admin-panel__close").onclick = () => workspace.closeNavigation();
|
||||
$(".nodedc-application-panel [data-action=close]").onclick = () => {
|
||||
workspace.closeView();
|
||||
workspace.openNavigation();
|
||||
};
|
||||
document.addEventListener("click", (e) => {
|
||||
if (e.target.closest(".block-btn,.knowledge-tree-select,#project-settings,#admin-mode-content,#admin-mode-seo,#admin-mode-knowledge")) {
|
||||
workspace.openView("cms");
|
||||
queueMicrotask(() => $(".nodedc-application-panel__body").scrollTop = 0);
|
||||
}
|
||||
schedule();
|
||||
});
|
||||
document.addEventListener("input", schedule);
|
||||
document.addEventListener("change", schedule);
|
||||
initModals();
|
||||
refresh();
|
||||
observer = new MutationObserver(schedule);
|
||||
refresh();
|
||||
}
|
||||
export {
|
||||
installDesignSystem
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
import { installDesignSystem } from './design-system.mjs';
|
||||
installDesignSystem();
|
||||
await import('./admin.mjs');
|
||||
@@ -0,0 +1,58 @@
|
||||
const defaults = () => ({ schemaVersion: 1, appearance: { theme: 'dark', accent: null }, gui: { modals: {} } });
|
||||
function merge(document, patch) {
|
||||
const next = structuredClone(document);
|
||||
Object.assign(next.appearance, patch.appearance);
|
||||
for (const [id, size] of Object.entries(patch.gui?.modals || {})) {
|
||||
if (size === null) delete next.gui.modals[id]; else next.gui.modals[id] = size;
|
||||
}
|
||||
return next;
|
||||
}
|
||||
/** Application-owned GUI metadata. The server derives identity from the session. */
|
||||
export class UserGuiPreferences {
|
||||
value = defaults(); status = 'loading'; listeners = new Set(); pending = []; running = false;
|
||||
constructor() { this.ready = this.load(); }
|
||||
subscribe(listener) { this.listeners.add(listener); listener(this.value, this.status); return () => this.listeners.delete(listener); }
|
||||
notify() { for (const listener of this.listeners) listener(this.value, this.status); }
|
||||
async request(method = 'GET', patch, headers = {}) {
|
||||
const response = await fetch('/api/user/preferences', { method, credentials: 'same-origin', headers: { 'content-type': 'application/json', ...headers }, body: patch ? JSON.stringify(patch) : undefined });
|
||||
if (!response.ok) throw new Error('Не удалось сохранить настройки интерфейса');
|
||||
return response.json();
|
||||
}
|
||||
async load() {
|
||||
try {
|
||||
let result = await this.request();
|
||||
// One-time import of the previous browser-only appearance. Atomic create
|
||||
// prevents a second browser from replacing existing account preferences.
|
||||
let legacy;
|
||||
try { legacy = JSON.parse(localStorage.getItem('dc-cms.ui-preferences.v1')); } catch {}
|
||||
if (!result.exists && legacy) {
|
||||
const appearance = { theme: legacy.theme === 'light' ? 'light' : 'dark', accent: /^#[a-f\d]{6}$/i.test(legacy.accent || '') ? legacy.accent : null };
|
||||
result = await this.request('PATCH', { appearance }, { 'if-none-match': '*' });
|
||||
}
|
||||
try { localStorage.removeItem('dc-cms.ui-preferences.v1'); } catch {}
|
||||
this.value = this.pending.reduce(merge, result.preferences); this.status = 'saved';
|
||||
} catch { this.status = 'error'; }
|
||||
this.notify();
|
||||
}
|
||||
update(patch) {
|
||||
this.pending.push(structuredClone(patch)); this.value = merge(this.value, patch); this.status = 'saving'; this.notify();
|
||||
void this.flush();
|
||||
}
|
||||
async flush() {
|
||||
await this.ready;
|
||||
if (this.running) return;
|
||||
this.running = true;
|
||||
try {
|
||||
while (this.pending.length) {
|
||||
this.status = 'saving'; this.notify();
|
||||
const result = await this.request('PATCH', this.pending[0]);
|
||||
this.pending.shift(); this.value = this.pending.reduce(merge, result.preferences);
|
||||
}
|
||||
this.status = 'saved';
|
||||
} catch { this.status = 'error'; }
|
||||
finally { this.running = false; this.notify(); }
|
||||
}
|
||||
modalSize(id) { return this.value.gui.modals[id]; }
|
||||
setModalSize(id, size) { this.update({ gui: { modals: { [id]: { width: Math.round(size.width), height: Math.round(size.height) } } } }); }
|
||||
}
|
||||
export const guiPreferences = new UserGuiPreferences();
|
||||
@@ -0,0 +1,53 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { flushSync } from "react-dom";
|
||||
import { applyNodedcTheme, missionDarkTheme, missionLightTheme, clearNodedcAccent } from "@nodedc/ui-dom";
|
||||
import { UserProfileMenu, FeatureSettingsWindow, SettingsCard, Select, ColorField, Button } from "@nodedc/ui-react";
|
||||
import { guiPreferences } from './gui-preferences.mjs';
|
||||
const h = React.createElement;
|
||||
const defaults = { theme: "dark", accent: null };
|
||||
function normalize(value) {
|
||||
return { theme: value?.theme === "light" ? "light" : "dark", accent: /^#[\da-f]{6}$/i.test(value?.accent || "") ? value.accent.toLowerCase() : null };
|
||||
}
|
||||
function apply(preferences) {
|
||||
const accent = preferences.accent?.match(/[\da-f]{2}/gi).map(v => parseInt(v, 16));
|
||||
clearNodedcAccent(document.documentElement);
|
||||
applyNodedcTheme(document.documentElement, { ...(preferences.theme === "light" ? missionLightTheme : missionDarkTheme), accent });
|
||||
}
|
||||
function themeAccent() {
|
||||
return "#" + getComputedStyle(document.documentElement).getPropertyValue("--nodedc-accent-rgb").trim().split(/\s+/).map(v => Number(v).toString(16).padStart(2, "0")).join("");
|
||||
}
|
||||
function Preferences({ initial }) {
|
||||
const [preferences, setPreferences] = useState(initial);
|
||||
const [open, setOpen] = useState(false);
|
||||
const [session, setSession] = useState(null);
|
||||
const [storageStatus, setStorageStatus] = useState(guiPreferences.status);
|
||||
useEffect(() => {
|
||||
const controller = new AbortController();
|
||||
fetch("/api/me", { credentials: "same-origin", signal: controller.signal }).then(r => r.ok ? r.json() : null).then(setSession).catch(() => {});
|
||||
const unsubscribe = guiPreferences.subscribe((document, status) => { const value = normalize(document.appearance); apply(value); setPreferences(value); setStorageStatus(status); });
|
||||
return () => { controller.abort(); unsubscribe(); };
|
||||
}, []);
|
||||
function update(patch) {
|
||||
guiPreferences.update({ appearance: patch });
|
||||
}
|
||||
const user = session?.user;
|
||||
const name = user?.name || user?.username || "Профиль";
|
||||
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(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 }) })) }),
|
||||
h(SettingsCard, { title: "Акцентный цвет", description: "Цвет активных элементов", actions: h("div", { className: "cms-preference-controls" }, h(ColorField, { label: "Акцентный цвет", value: preferences.accent || themeAccent(), onChange: accent => update({ accent }) })) })),
|
||||
h("p", { className: "nodedc-description", role: "status" }, storageStatus === 'error' ? "Не удалось сохранить настройки на сервере. Изменения остаются в этой вкладке." : storageStatus === 'saved' ? "Оформление и размеры окон сохраняются в профиле пользователя." : "Синхронизация настроек…"),
|
||||
storageStatus === 'error' ? h(Button, { onClick: () => guiPreferences.pending.length ? guiPreferences.flush() : guiPreferences.load() }, "Повторить") : null
|
||||
)
|
||||
);
|
||||
}
|
||||
export function installPreferences() {
|
||||
const preferences = guiPreferences.value.appearance;
|
||||
apply(preferences);
|
||||
flushSync(() => createRoot(document.querySelector("#cms-profile")).render(h(Preferences, { initial: preferences })));
|
||||
}
|
||||
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Reference in New Issue
Block a user