Skip to content

feat(solid-adapter): add @vanelsas/baredom-solid Solid 1.x adapter#246

Merged
avanelsas merged 1 commit into
mainfrom
feature/solid-adapter
May 25, 2026
Merged

feat(solid-adapter): add @vanelsas/baredom-solid Solid 1.x adapter#246
avanelsas merged 1 commit into
mainfrom
feature/solid-adapter

Conversation

@avanelsas
Copy link
Copy Markdown
Owner

Summary

Adds a fifth framework adapter — @vanelsas/baredom-solid — wired into the existing four-adapter codegen pipeline. Targets SolidJS for reach (largest unserved audience among current top-10 JS frameworks).

Like the other adapters, every BareDOM custom element gets a typed wrapper component generated from shared metadata (model.cljs + form-control-metadata.bb + codegen_shared.bb). Adding a new BareDOM component automatically updates Solid alongside React/Vue/Angular/Svelte via the pre-commit hook.

Architecture

  • Function components — no defineComponent, no @Directive, no .svelte. Events bind via addEventListener inside onMount with onCleanup; refs are direct via a setRef callback; controlled inputs use createEffect to sync the control prop to the DOM attribute. Closest analog among the four existing adapters is React (JSX, function-shaped). Solid is structurally simpler: no synthetic events, no virtual DOM, no forwardRef.
  • TypeScript compile: jsx: "preserve" + jsxImportSource: "solid-js". The package ships .jsx alongside .d.ts so consumers' Solid bundler (vite-plugin-solid / babel-preset-solid / esbuild-plugin-solid) handles the JSX → DOM compilation. This is the prevailing Solid-library convention (solid-primitives, @solid-aria).
  • splitProps preserves reactivity — props are never destructured in generated wrappers.
  • Form-control reuse — the controlled-components map derives from scripts/form-control-metadata.bb identically to React (post-PR-refactor(adapter-codegen): share helpers across the four generators #245), so the silent drift trap stays closed for Solid too.

Pre-commit hook (scripts/pre-commit-react-adapter.sh)

  • Trigger regex widened to include generate_solid.bb and codegen_shared.bb
  • Added a fifth regeneration block for the Solid adapter

Test plan

  • bb scripts/generate_solid.bb → 104 wrappers + index.ts + custom-elements.d.ts
  • npm --prefix adapters/solid run buildtsc clean, dist/ emitted (.jsx per-component, .js for barrel + composables)
  • npm --prefix adapters/solid/test-app run buildvite build clean (22 modules, 73 KB gzip) — all imports resolved, JSX compiled, Solid runtime wired
  • Existing four adapter generators produce byte-identical output (git status adapters/{react,vue,angular,svelte} clean after regenerating)
  • clj-kondo --lint src test → 0 errors, 0 warnings
  • npx shadow-cljs release lib → 480 files, 0 warnings (Closure Advanced gate)
  • All four existing adapter builds remain clean:
    • React tsc
    • Vue tsc
    • Angular ngc ✓ (CEM-drift-sensitive)
    • Svelte svelte-check → 373 FILES 0 ERRORS 0 WARNINGS ✓
  • Pre-commit hook regenerated all five adapters on commit; existing four produced no source diff
  • Manual visual smoke (reviewer): cd adapters/solid/test-app && npm run dev — verify five-component demo (button event, controlled boolean checkbox, controlled string slider, uncontrolled select, modal via signal)

Version

0.1.0 — matches the initial-release version of the Svelte and Vue adapters.

🤖 Generated with Claude Code

Wires Solid into the existing four-adapter codegen pipeline. Like the
other adapters, every BareDOM custom element gets a typed wrapper
component generated from the shared metadata (model.cljs +
form-control-metadata.bb + codegen_shared.bb). Adding a new BareDOM
component automatically updates Solid alongside React/Vue/Angular/Svelte
via the pre-commit hook.

Adapter architecture:
- Function components (no defineComponent, no @directive, no .svelte).
  Events bind via addEventListener inside onMount with onCleanup; refs
  are direct via setRef callback; controlled inputs use createEffect to
  sync the control prop to the DOM attribute. Closest analog among the
  four is React (JSX, function-shaped). Solid is structurally simpler:
  no synthetic events, no virtual DOM, no forwardRef.
- TypeScript compile: jsx: preserve + jsxImportSource: solid-js. The
  package ships .jsx alongside .d.ts so consumers' Solid bundler
  (vite-plugin-solid / babel-preset-solid / esbuild-plugin-solid)
  handles the JSX -> DOM compilation. This is the prevailing Solid-
  library convention (solid-primitives, @solid-aria).
- splitProps preserves reactivity — props are never destructured in the
  generated wrappers.

Form-control reuse: the controlled-components map is derived from
scripts/form-control-metadata.bb identically to React (post-PR-#245),
so the silent drift trap stays closed for Solid too.

Pre-commit hook (scripts/pre-commit-react-adapter.sh):
- Trigger regex widened to include generate_solid.bb and codegen_shared.bb
- Added a fifth regeneration block for the Solid adapter

Verification:
- bb scripts/generate_solid.bb -> 104 wrappers + index.ts + custom-elements.d.ts
- npm --prefix adapters/solid run build -> tsc clean, dist/ emitted (.jsx per-component, .js for barrel + composables)
- npm --prefix adapters/solid/test-app run build -> vite build clean (22 modules, 73 KB gzip), all imports resolved, JSX compiled, Solid runtime wired
- Existing four adapter generators produce byte-identical output (git status adapters/{react,vue,angular,svelte} clean after regenerating)
- clj-kondo --lint src test -> 0 errors, 0 warnings
- npx shadow-cljs release lib -> 480 files, 0 warnings (Closure Advanced gate)
- All four existing adapter builds remain clean (React/Vue tsc, Angular ngc, Svelte svelte-check 373 files 0 errors 0 warnings)

Test app smoke target (adapters/solid/test-app) renders five
representative components covering the event prop, controlled boolean,
controlled string, uncontrolled default-value, and imperative-ref
paths.

Initial version 0.1.0, matching the Svelte and Vue adapter initial
releases.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@avanelsas avanelsas merged commit d5dc315 into main May 25, 2026
1 check passed
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