Skip to content

feat(vue): add @denvelop/vue adapter package#2

Merged
hi-reeve merged 75 commits into
mainfrom
feat/blocks-phase2
Jun 5, 2026
Merged

feat(vue): add @denvelop/vue adapter package#2
hi-reeve merged 75 commits into
mainfrom
feat/blocks-phase2

Conversation

@hi-reeve

@hi-reeve hi-reeve commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Scaffolds packages/vue (@denvelop/vue) — a thin Vue 3 adapter over @denvelop/core
  • useDenvelop(el: MaybeRef<HTMLElement | null>, options?) composable: creates builder in onMounted, tears down in onUnmounted, exposes reactive template / canUndo / canRedo and imperative delegates (importTemplate, exportTemplate, undo, redo, checkAccessibility)
  • <Denvelop /> SFC component: single <div> root, all BuilderOptions fields as props, 5 emits (change, blockAdd, blockDelete, export, ready), defineExpose for builder methods
  • Full test suite: 21 tests across 2 files (composable + component), all passing

Test Plan

  • cd packages/vue && vp test — 21/21 pass
  • cd packages/vue && vp check — no TypeScript errors
  • cd packages/vue && vp pack — produces dist/index.mjs, dist/index.cjs, dist/index.d.mts, dist/index.d.cts
  • Generated index.d.mts correctly types props, emits, and exposed methods

🤖 Generated with Claude Code

hi-reeve and others added 30 commits June 4, 2026 15:07
Remove placeholder packages (utils and website) that came from Vite+ scaffold
and are not part of the Denvelop project scope.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Sets up the real @denvelop/core package with directory structure, package.json,
vite.config.ts (with inline pack config per Vite+ docs), and tsconfig.json.
Uses @dnd-kit/dom ^0.4.0 (^0.1.0 not available) and drops tsdown.config.ts
per Vite+ pack guidance.
Implements builder.ts with createBuilder/createIsolatedBuilder, wires
state/history/events/UI together, adds SSR fallback, and adds 10
integration tests (jsdom) covering mount, import/export, undo/redo,
sections, accessibility, and destroy. Also fixes mountEditor to append
a child .dnv-editor element (rather than mutating the host el) and
widens tsconfig rootDir to include tests/.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Pure recursive helpers for BlockNode[] tree manipulation: findBlock,
updateBlockInTree, deleteFromTree, addToCol, moveInTree, makeColNode,
makeColsFromLayout. All 21 tests pass, no TypeScript errors.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Implements text and heading block types with Zod schema validation,
MJML rendering, and editor UI controls for Phase 2 block system.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Implements four simple block types with full schema validation and MJML rendering support. Avatar supports image display with sizing and linking. Divider allows customizable separators. Spacer provides vertical spacing control. HTML block enables raw markup embedding.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Implement video.ts, video.test.ts, social.ts, and social.test.ts with
full schema validation, MJML rendering, and editor controls. All 218
tests passing including new video and social block tests.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Implements menu and product blocks with full test coverage. Menu block supports up to 4 configurable links with customizable color and font size. Product block includes image, title, description, price, and button with full MJML rendering.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
hi-reeve and others added 28 commits June 5, 2026 11:58
Replace raw string literals ("1col", "2col-50-50", etc.) with computed
ColumnsLayout const keys in LAYOUT_WIDTHS and fallback expressions.
Change type-only imports to value imports where needed.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…tate.ts

Replace hardcoded string literals with const-object constants from types.ts
for all editor action types and preview device settings. This improves type
safety and maintainability while preserving identical behavior.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
… sanitize, toolbar

Replace all hardcoded string literals for action types, event names, export formats, severity levels,
and control types with their corresponding const-object constants (EditorActionType, EditorEvent,
ExportFormat, IssueSeverity, ControlType) imported as values from types.ts.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Replace all 7 string case literals with ControlType enum-like constants
in the renderControl function's switch statement. This completes the
const-object refactoring pattern for all constant objects across the core
package.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Adds applyMergeTags() with {{key}} interpolation, HTML escaping, immutability, recursive children support, and metadata (subject/previewText) substitution. Also fixes @denvelop/core package.json exports to use correct nested .d.mts/.d.cts conditions for moduleResolution: nodenext compatibility.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…rgeTags

Replaces truthy checks with explicit !== undefined checks for metadata.subject
and metadata.previewText to preserve empty string values. Adds test to verify
empty string metadata is preserved through merge tag substitution.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Add render.ts with full RenderResult (html/mjml/plaintext/json/warnings), exportAs() dispatcher, and wire index.ts exports. Add zod devDependency required by tests.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…er.ts to renderer + types

Also fixed renderer package.json exports to match built .mjs/.d.mts artifacts.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
… and wrong test runner

- Remove peerDependency of @denvelop/renderer on @denvelop/core (kept devDependency only); peerDependency caused vp run -r test to abort with cycle detection error
- Replace runtime ExportFormat import from @denvelop/core in render.test.ts with string literals, eliminating the value import that required core at runtime in renderer tests
- Update root package.json: replace vp run -r test with pnpm -r test in the ready script, and add a test script; vp run -r does not support circular devDependencies while pnpm -r test correctly runs each package from its own directory with its own vite.config.ts

All 278 tests now pass: core 252, renderer 26.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
….Json constant

- Wrap the public render() export to sanitize template blocks before rendering,
  preventing block props like <script> from bypassing sanitization
- Replace string literal "json" with ExportFormat.Json constant in exportTemplate
- Add ExportFormat as a value import from types.js

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Replace manual `type XxxProps = {...}` + `as BlockDefinition<P>` pattern
with the `defineBlock()` identity helper across all 14 block files.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
TDD implementation: 8 tests cover raw HTMLElement and Ref<HTMLElement> inputs,
reactive template/canUndo/canRedo updates via change events, imperative
importTemplate/exportTemplate delegation, and builder.destroy on unmount.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…r, store unsubscribe, add tests

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
TDD: wrote failing tests first, implemented the component wiring useDenvelop
composable to Vue emits and defineExpose. Adds vue.d.ts shim for .vue
module resolution. 17/17 tests pass (10 composable + 7 component).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Replaces the index.ts stub with Denvelop + useDenvelop + UseDenvelopReturn
exports; adds vue-tsc and @vitejs/plugin-vue to the pack config so that
vp pack can compile the SFC and generate .d.mts/.d.cts declarations.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
… Change invariant, add redo test

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@hi-reeve hi-reeve merged commit 37329f2 into main Jun 5, 2026
@hi-reeve hi-reeve deleted the feat/blocks-phase2 branch June 5, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant