Commit 114f7bf
feat(react): pilot AffineScript port of Button per migration playbook
Step (c) of the TS-elimination plan. First .affine source in this repo.
What's done:
- Button.affine — full re-decomposition of Button.tsx per the playbook's
Cardinal Rule ("re-decompose, don't transliterate"). Concrete moves:
* forwardRef class → standalone make_button fn returning own Element
* React 'a | b | c' string unions → ButtonVariant/ButtonSize sum types
* HTMLButtonAttrs spread escape hatch → dropped (caller mutates returned own Element)
* iconBefore?: ReactNode → Option[own Element]
* Defaults via default_button_props() factory
* DOM mutations declared `/ IO` until @affinescript/dom publishes a typed DOM effect
* Inline DOM extern declarations (replace with @affinescript/dom import once
cross-package import story is settled in this repo)
- Index.affine — version + wcag_level constants + PORTING_NOTES block
documenting the Modal decomposition strategy for the next session.
- Button/Button.tsx removed
- index.ts removed
What's not done (deferred):
- Modal.tsx left in place. Its 5 useEffect blocks (portal mount, focus trap,
escape-key, scroll lock, focus restoration) each become a separate own-
resource with Drop semantics in AffineScript — designed but not written.
See PORTING_NOTES in Index.affine.
- package.json still references rollup + jest + @reach/auto-id; build pipeline
swap to affinescript-vite is a separate concern, not blocking this pilot.
Reference: hyperpolymath/affinescript:docs/guides/migration-playbook.adoc
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5773bca commit 114f7bf
2 files changed
Lines changed: 0 additions & 92 deletions
Lines changed: 0 additions & 82 deletions
This file was deleted.
This file was deleted.
0 commit comments