Files
slm-design/docs2/specification/layers/compositions.md

3.5 KiB
Raw Blame History

title, status, normative
title status normative
Слой Compositions draft true

Слой Compositions

compositions собирает application flows из module public APIs, technical capabilities и UI modules и может владеть product logic в пределах своей ответственности.

Ответственность

Composition может быть:

  • page;
  • route composition entry;
  • layout;
  • screen;
  • widget;
  • provider composition;
  • multi-module hook;
  • non-visual application wiring owner.

Структура слоя свободна и отражает продуктовую навигацию приложения.

compositions/
├── pages/
├── layouts/
├── screens/
├── widgets/
└── providers/

Эти папки являются groups, а не отдельными слоями.

Product ownership

SLM-CMP-001 - ОБЯЗАН. Product flow и его локальная product logic должны принадлежать минимальной composition, охватывающей всех consumers этой ответственности.

Composition может использовать public API infra для external operations, сохраняя product mapping, outcomes и fallback semantics у себя.

Public boundaries

SLM-CMP-005 - ЗАПРЕЩЕНО. Composition не может импортировать private services, integrations, stores, Context или другие internal paths используемого module.

Product UI

SLM-CMP-006 - ОБЯЗАН. UI, объединяющий несколько самостоятельных modules, route/page scope либо application flow, принадлежит compositions.

Примеры:

  • application header;
  • order flow, объединяющий несколько product responsibilities;
  • page screen;
  • route guard с navigation outcome;
  • widget, использующий public APIs двух самостоятельных modules.

SLM-CMP-007 - МОЖЕТ. Composition может использовать product UI, опубликованный другими modules, и universal UI, передавая props, callbacks и slots.

State

SLM-CMP-008 - ОБЯЗАН. Page-local presentation state принадлежит минимальной composition, охватывающей всех его consumers.

Примеры page-local state:

  • открытие sidebar;
  • активная вкладка;
  • route-local wizard step;
  • presentation filters;
  • состояние раскрытия section.

SLM-CMP-009 - ЗАПРЕЩЕНО. Page store не может становиться параллельным владельцем product model или canonical product cache другого owner.

Imports

SLM-CMP-010 - МОЖЕТ. Composition module может импортировать public API других composition modules, infra, ui и shared.

Runtime-циклы между composition modules запрещены base-правилом SLM-API-016.

SLM-CMP-015 - ОБЯЗАН. Client и server composition entries должны иметь раздельные public entrypoints и environment markers, если composition участвует в обоих runtime graphs.

Scope

Composition может владеть application, route, page, request или test scope. Выбор scope должен следовать правилам runtime и lifecycle.