feat: lossless HTML-node roundtrip (hybrid DOM-native nodes)#194
Open
Zen0-99 wants to merge 6 commits into
Open
feat: lossless HTML-node roundtrip (hybrid DOM-native nodes)#194Zen0-99 wants to merge 6 commits into
Zen0-99 wants to merge 6 commits into
Conversation
Implement lossless roundtrip between authored HTML and the DOM-native node model so imported markup is preserved exactly through edit and publish. - Phase 0/1: all base modules declare htmlContract; DOM-native node model and canvas renderers introduced. - Phase 2: publisher serializes from HTML fields via a unified render path. - Complete migration (phases 0-7): rules, walk/map importer, attribute sanitization, and publisher wired end-to-end. - Apply upstream attribute sanitization to the DOM-native-first importer.
e307896 to
806d21a
Compare
Adopt upstream changes: - scripts/e2e-dev.ts: use viteCommand from bunCommand - src/core/publisher/renderLoop.ts: pass config.mediaAssets to injectNodeInlineStyles - src/core/publisher/renderNode.ts: pass config.mediaAssets to injectNodeInlineStyles in both standard and unified node paths Preserve hybrid DOM-native node rendering logic and cleanMode guard.
- Map ImportBodyAttributes.attributes (new upstream shape) through assetPlan normalization and applyAssetRewrites rewriting instead of the removed .props - Apply imported body attributes to rootNode.props.htmlAttributes in site helpers - Fix prefer-const lint in renderUnifiedNode - Guard undefined render/preview in pluginModuleComponentFactory - Fix no-unsafe-finally lint in createDbClient.test.ts
- Break NodeRenderer <-> DomNodeRenderer import cycle by passing ChildRenderer as prop - Break forms index.ts <-> htmlContracts.ts cycle by moving prop schemas/types to forms/types.ts - Fix no-css-var-fallbacks violation in DomNodeProperties.module.css - Extract createDomNode/syncModuleOverlayHtmlFields to page-tree/domMutations.ts and ratchet mutations.ts module-size cap down to 766 - Grandfather agent executor.ts (734 lines) with note to extract DOM-native tool runners - Fix Windows path bug in error-boundary-coverage test - Sync plugin bootstrap artifacts via bootstrap:sync - Use @core/page-tree barrel import in hybrid-dom-native-nodes architecture test
- parseVCNode: reject VC nodes with empty moduleId so structurally invalid VC nodes are dropped again - migrateOldFormatNodes: exclude Visual Component trees from DOM-native migration; VCs are module-based by design - migrateOldFormatNodes: only migrate modules whose htmlContract resolves to a real HTML tag, preserving base.visual-component-ref and base.slot-instance as module nodes - Update stale htmlPagePlan.test.ts to match Phase 3 claim semantics (raw <form> becomes DOM-native; label and button submit get overlays)
Contributor
Author
|
This being a big PR, I will not be resolving conflicts until this is reviewed, as I do not want to spend time keeping something up to date if it will not be considered. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Imported HTML is now preserved exactly through the full edit-and-publish round-trip — when you bring real-world HTML into the builder and publish it back out, no markup, attributes, classes, inline styles, or structure is lost.
Behind that user-facing guarantee, this introduces the DOM-native node model and wires the importer and publisher through a single, unified render path:
htmlContract.walkAndMap/ rules) and the publisher (renderNodeand the unified render path) share one serialization contract, so what comes in is what goes out.Why
import → edit → publishwithout silently dropping structure, attributes, or styling. This closes that gap.Test
Automated
bun test src/__tests__/architecture/hybrid-dom-native-nodes.test.ts— architecture/round-trip contract.bun test src/__tests__/htmlImport—mapping,structurePreservation,svgMapping,textNormalize.bun test— full unit suite.bun test tests/e2e/visual-builder.e2e.ts— end-to-end visual builder (orbun run test:e2e).Manual