You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add contributor placement guide for SuperDoc layers (#3278)
A central routing map for "where do I put my change?" so contributors and
agents land in the right layer without learning the boundaries by trial.
Root CLAUDE.md (which root AGENTS.md follows via symlink):
- Rewrite the rendering-flow arrow to include super-converter as the entry
(.docx -> super-converter -> hidden PM -> pm-adapter+style-engine -> ...).
- Replace the 3-row "Where visual changes go" table with an 11-row "Where
To Put Your Change" routing table covering: DOCX import/export, style
cascade, static visuals, direction-aware properties, editing behavior,
ephemeral editor UI, interaction mapping, geometry/pagination, final
DOM rendering, presentation state bridge, document-API operations,
consumer SDK/CLI surface.
- Add a "Quick Boundary Checks" section with rg commands that surface the
three most common layer-leak patterns (painter upstream imports,
pm-adapter DOM work, importer baking style cascade).
packages/layout-engine/AGENTS.md (CLAUDE.md follows via symlink):
- Rename the "Key Insight" header to "DomPainter Receives Paint-Ready
Data" (the existing 'dumb' wording was a tone choice the new copy
drops).
- Replace the "Rendering Ownership" block with a "Layer Ownership"
section that cross-references root CLAUDE.md and adds direction-axes
+ bidiVisual single-mirror reminders local to the package.
packages/superdoc/AGENTS.md is intentionally untouched: it is consumer-
facing and ships with the npm package.
No behavior change. Docs only.
| DOCX import/export |`super-editor/src/editors/v1/core/super-converter/`| Parse and preserve OOXML, style refs, and inline properties. Do not bake inherited or style-resolved formatting into direct attrs. |
30
+
| Style cascade |`layout-engine/style-engine/`| Own defaults, styles, conditional formatting, and inline override resolution. |
31
+
| Static document visuals |`pm-adapter/` data + `layout-engine/painters/dom/` rendering | Feed typed data into DomPainter. Do not style static document content with PM decorations. |
32
+
| Direction-aware properties | One layer makes the flip; pm-adapter stores logical sides LTR-default | For `w:bidiVisual` table-visual properties, DomPainter mirrors once at paint time. Pre-mirroring upstream is a double-swap. Full taxonomy: `pm-adapter/src/direction/README.md`. |
33
+
| Editing behavior |`super-editor/src/editors/v1/extensions/`| Commands, keybindings, editor plugins, and active interaction state live here. Do not duplicate cascade logic or render document visuals here. |
34
+
| Ephemeral editor UI |`PresentationEditor` post-paint pipeline + overlay components | Selections, active comments, proofing marks, search highlights, resize handles, and other overlays. PM decorations are bridged to painted DOM only for eligible plugins; comments use `CommentHighlightDecorator` (painter metadata), search is excluded from the bridge, resize handles are Vue overlay components. When adding a plugin that emits decorations, decide whether to bridge (default) or stay PM-side (add a prefix to `EXCLUDED_PLUGIN_KEY_PREFIXES` in `DecorationBridge.ts`). |
35
+
| Interaction mapping |`layout-engine/layout-bridge/`| Map clicks, selections, resize handles, and visual coordinates back to document positions. RTL-aware as an inverse mapping (visual → logical), not a pre-mirror. |
36
+
| Geometry and pagination |`layout-engine/layout-engine/`| Compute layout from `FlowBlock[]`; do not read rendered DOM to recover missing data. |
37
+
| Final DOM rendering |`layout-engine/painters/dom/`| Render `ResolvedLayout`. Paint-time visual transforms, such as the `w:bidiVisual` mirror, belong here. |
38
+
| Presentation state bridge |`PresentationEditor.ts`| Bridge editor events into layout and paint state. Do not resolve OOXML semantics here. |
39
+
| New document-API operation |`packages/document-api/src/contract/operation-definitions.ts`| Contract-first; touches 4 files — see `packages/document-api/README.md`. |
40
+
| New consumer SDK / CLI surface |`apps/cli/src/` + regenerate SDK | Run `pnpm run generate:all` after. |
**The importer stores raw OOXML properties. The style-engine resolves them at render time.**
78
107
79
-
- The converter (`super-converter/`) should only parse and store what is explicitly in the XML (inline properties, style references). It must NOT resolve style cascades, conditional formatting, or inherited properties.
108
+
- The converter (`super-converter/`) should only parse and store what is explicitly in the XML (inline properties, style references). It must not resolve style cascades, conditional formatting, or inherited properties.
80
109
- The style-engine (`layout-engine/style-engine/`) is the single source of truth for cascade logic. All style resolution (defaults → table style → conditional formatting → inline overrides) happens here.
81
110
- Both rendering systems call the style-engine to compute final visual properties.
82
111
@@ -99,7 +128,7 @@ The `packages/document-api/` package uses a contract-first pattern with a single
99
128
100
129
Adding a new operation touches 4 files: `operation-definitions.ts`, `operation-registry.ts`, `invoke.ts` (dispatch table), and the implementation. See `packages/document-api/README.md` for the full guide.
101
130
102
-
Do NOT hand-edit `COMMAND_CATALOG`, `OPERATION_MEMBER_PATH_MAP`, `OPERATION_REFERENCE_DOC_PATH_MAP`, or `REFERENCE_OPERATION_GROUPS` — they are derived from `OPERATION_DEFINITIONS`.
131
+
Do not hand-edit `COMMAND_CATALOG`, `OPERATION_MEMBER_PATH_MAP`, `OPERATION_REFERENCE_DOC_PATH_MAP`, or `REFERENCE_OPERATION_GROUPS` — they are derived from `OPERATION_DEFINITIONS`.
0 commit comments