Skip to content

feat: Add native platform backends (Win32, Cocoa) and sync from sigil-lang#5

Closed
paraphilic-ecchymosis wants to merge 8 commits intomainfrom
feature/native-platforms
Closed

feat: Add native platform backends (Win32, Cocoa) and sync from sigil-lang#5
paraphilic-ecchymosis wants to merge 8 commits intomainfrom
feature/native-platforms

Conversation

@paraphilic-ecchymosis
Copy link
Copy Markdown
Contributor

Summary

  • Win32 native platform backend (1,780 lines, 22 tests)
  • Cocoa native platform backend (1,519 lines, 32 tests)
  • GTK4 reference implementation (689 lines)
  • a11y/ accessibility module - announcer, focus, keyboard, hooks
  • animation/ module - spring physics, keyframes, gestures
  • Sync all updated files from sigil-lang migration

Native Platform Support

Platform Status Lines Tests
Browser (WASM) ✅ Complete existing existing
Linux (GTK4) ✅ Complete 689 2
Windows (Win32) ✅ Complete 1,780 22
macOS (Cocoa) ✅ Complete 1,519 32

Win32 Implementation

  • FFI declarations for 35+ Win32 API functions
  • Window class registration (WNDCLASSEXW) and message loop
  • Custom layout manager (Win32 has no auto-layout)
  • All NativeApp, NativeWidgetBuilder, NativeLayout trait methods
  • 17 widget types: Button, Label, Entry, TextView, ListBox, ProgressBar, Scale, etc.

Cocoa Implementation

  • Objective-C runtime bridge (objc_msgSend, selectors)
  • ObjC helper struct for message passing patterns
  • NSApplication lifecycle and NSWindow management
  • NSStackView-based layout with Auto Layout integration
  • Target-action pattern for event handling

Migration from sigil-lang

This PR also syncs all content that was in sigil-lang/qliphoth/ before the repo split:

  • a11y/ - Screen reader announcements, focus management, keyboard navigation
  • animation/ - Spring physics, keyframe animations, gesture handling
  • app.sigil - Application wrapper component
  • Updated hooks/mod.sigil (+840 lines)
  • Updated dom/mod.sigil, lib.sigil, and 14 other files

Test Plan

  • Verify Win32 builds on Windows
  • Verify Cocoa builds on macOS
  • Run existing WASM tests
  • Manual testing of native platform widgets

🤖 Generated with Claude Code

paraphilic-ecchymosis and others added 8 commits January 19, 2026 21:09
Implement native GUI backends for Windows and macOS:

Win32 (1,780 lines):
- FFI declarations for 35+ Win32 API functions
- Window class registration and message loop
- Custom layout manager (Win32 has no auto-layout)
- All NativeApp, NativeWidgetBuilder, NativeLayout trait methods
- 22 unit tests covering structures, constants, string conversion

Cocoa (1,519 lines):
- Objective-C runtime bridge (objc_msgSend, selectors, etc.)
- ObjC helper struct for message passing
- NSApplication lifecycle and NSWindow management
- NSStackView-based layout with Auto Layout integration
- 32 unit tests covering NSRect, NSPoint, NSSize, constants

Also includes:
- GTK4 reference implementation (690 lines)
- Shared types and traits in mod.sigil

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Rescued content that was only in sigil-lang/qliphoth:

a11y/ (accessibility module):
- announcer.sigil - Screen reader announcements
- focus.sigil - Focus management
- hooks.sigil - Accessibility hooks
- keyboard.sigil - Keyboard navigation
- mod.sigil - Module exports

animation/ (animation module):
- components.sigil - Animation components
- gestures.sigil - Gesture handling
- hooks.sigil - Animation hooks
- mod.sigil - Spring physics, keyframes, transitions

Also:
- app.sigil - Application wrapper component
- components/a11y.sigil - Accessibility components

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updated 16 files with newer versions from sigil-lang/qliphoth:

Major updates:
- hooks/mod.sigil: +840 lines (858 → 1698) - new hooks
- dom/mod.sigil: significant DOM improvements
- lib.sigil: +54 lines - new exports

Core modules synced:
- core/events.sigil, core/mod.sigil, core/vdom.sigil
- components/mod.sigil
- router/mod.sigil
- state/mod.sigil
- platform/mod.sigil

Legacy modules synced:
- legacy/component.sigil, legacy/events.sigil
- legacy/hooks.sigil, legacy/runtime.sigil
- legacy/signals.sigil, legacy/vdom.sigil

Total: +3,149 insertions, -2,233 deletions (net +916 lines)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Expanded GTK4 test suite from 2 to 22 tests:

- Platform creation and default values
- Alignment conversion (all 5 Align variants)
- GTK align/orientation constants
- Policy and selection mode constants
- Event handler storage
- CSS provider initialization
- Orientation mapping
- Boolean conversion patterns
- Default window size

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix Win32 control ID extraction bug: use HWND→control ID mapping
  instead of incorrect bitwise AND on pointer
- Fix Cocoa action target double-lookup bug: remove useless conditional
- Add null checks after all GTK4 FFI widget allocations
- Add proper widget destruction in remove() for all platforms:
  - Win32: clean up hwnd_to_control_id and control_id_to_handler maps
  - Cocoa: release object to prevent memory leak
  - GTK4: disconnect signals before removal
- Fix hardcoded Win32 grid dimensions: track actual grid size dynamically
- Add SAFETY documentation to critical unsafe blocks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Migrates Qliphoth UI components from sigil-lang/qliphoth to standalone repo.

Components added:
- Core: button, card, input, badge, spinner, dialog, select
- Form: checkbox, radio, switch, textarea
- Navigation: link, tabs, nav
- Display: icon, avatar, tooltip
- Layout: header, footer, hero

Each component:
- Implements the Component trait with render() method
- Uses VNodeBuilder pattern (h("tag").class().attr().build())
- Supports variants, sizes, and accessibility attributes
- Includes proper ARIA attributes and semantic HTML

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements testing infrastructure and improves native platform support
following the TDD Production Roadmap.

Platform Improvements:
- GTK4: Enhanced event handling, timer support, widget management
- Win32: WinHTTP fetch, improved message pump, animation frames
- Cocoa: NSTimer integration, NSURLSession fetch, NSString memory fixes

New Infrastructure:
- src/platform/mock.sigil: Mock platform for unit testing
- src/core/error.sigil: PlatformError enum with context

Testing:
- tests/platform/: 13 test modules (callbacks, timers, fetch, DOM, etc.)
- e2e/: Playwright specs (platform, performance, simulacra)
- e2e/simulacra/: User archetype test definitions

Documentation:
- docs/PARSER-EXTENSION-PLAN.md: Parser modification guidelines

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@paraphilic-ecchymosis paraphilic-ecchymosis deleted the feature/native-platforms branch February 1, 2026 12:13
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