Repository navigation
feat(linker): RmlUI DOM bridge — RmlUi 6.2 + SDL3 reales (v1.7.0) - #25
Open
AndyTechnologies wants to merge 35 commits into
Open
AndyTechnologies wants to merge 35 commits into
AndyTechnologies wants to merge 35 commits into
Conversation
…strategy -> generateCCode -> renderTemplate)
- rmlui-abi.h: extern "C" declarations for all 44 ABI functions with opaque handles (Rml_ContextId, Rml_ElementId, etc.) and error enum (Rml_Error) - rmlui.hh: RAII wrappers RmlContext, RmlElement, and free functions over the C ABI; includes callback registry for std::function-based event listeners C ABI covers: context lifecycle, document loading, element tree construction, attributes and content, style properties, event system, class list, font/texture loading, render loop, query selectors, document body/head access, and debugger toggle.
Template restructuring: - Create _rmlui-state.c.njk: file-scope shared state (element map, callback registry, context registry, SDL/GL variables) plus all 44 extern "C" ABI function implementations with _writeString WASM string writer - Fix setup include order: move _rmlui-setup into main() scope before host function definitions - Update _rmlui-event-loop, _rmlui-render, _rmlui-cleanup to use file-scope statics via C ABI calls Plugin restructuring: - Replace all placeholder host function bodies with real C++ code that bridges WASM calls to the file-scope C ABI implementations - Add helpers for common patterns: scalarI32I32, string1I32, handleStringI32, handleStringStringReturn, etc. - Register all 44 host functions from the ABI spec - Binary data functions (Rml_LoadFontFromBuffer, Rml_LoadTextureFromBuffer) read WASM memory directly
…ns, fix event serialization
… template Adds extern C function bodies to _rmlui-state.c.njk for: Rml_LoadDocumentFromBuffer, Rml_QuerySelectorAll, Rml_FreeNodeList, Rml_GetTextureDimensions, Rml_SetResourcePath, Rml_RegisterResourceProvider Also fixes Rml_SetResourcePath to not reference undeclared variable.
…plugin W3: SDL_GL_MakeCurrent in init sequence (main.c.njk) W4: Reentrancy guard in event dispatch (_rmlui-state.c.njk) W5: Separate RmlUI_Update() from ProcessSdlEvents (main.c.njk + _rmlui-state.c.njk) W6: RmlStyle RAII class in rmlui.hh (keeps style methods on RmlElement) W7: Element + Document class with browser-like DOM API in AS bindings W8: Default font configurable via rmlui.resources.defaultFont W9: Texture loading stubs improved (WASI-aware documentation) W10: Elements survive removeChild for re-append to different parent S1: Download URLs with proper source-build fallback handling S2: Rust crate structure with build.rs + bindgen scaffold S3: _embedded-resources.c.njk template for embedded resource arrays S4: querySelectorAll in Element class + raw FFI imports S5: WASM function table dispatch documentation in callback system
- MountEntry interface: host path + guest WASI virtual path - PermissionDecision enum: AllowOnce, AllowForever, Deny - mounts field in NativeAppOptions and WappConfig
- fs-runtime.h: header-only C++ runtime for filesystem access control (SHA-256 permission IDs, isPathAllowed, requestPath, promptUser) - compileCpp() copies fs-runtime.h to build dir before compilation - generateCCode() accepts optional mounts parameter - Template main.c.njk: unconditional fs-runtime.h include, preopen_dir and _fs_allowed_roots from mounts config - Updated golden files to include fs-runtime.h header - Codegen tests: SHA-256 test vectors, mount validation
… linker - BuildManifestOptions: optional mountsHash field - isBuildUpToDate: returns false when mountsHash differs - saveBuildManifest: persists mountsHash in manifest - NativeAppBuilder.setMounts() with computeMountsHash() - createNativeApp() passes mounts to generateCCode and build cache - Tests: mountsHash mismatch/match/save scenarios
…dd integration tests - builtin-host-functions: register 'request-path' env import generator that calls FsRuntime::requestPath with _fs_allowed_roots - host-function-registry.test: verify request-path C++ body generation - CLI: reads config.mounts from wapp.json into NativeAppOptions - filesystem-access.integration.test: full pipeline integration tests (codegen + cache + mounts)
- Move working change spec/design/tasks to archive/2026-07-25-filesystem-access/ - Add verify-report.md (8/8 checks, 373 tests) - Copy finalized specs to openspec/specs/ (static-mounts, permission-manager, dynamic-fs-access)
Template renderer tests (8 new): - Renders interactive RmlUI loop with MakeCurrent (W3) - Excludes RmlUI code when disabled - Respects debugger flag - Consumes configured defaultFont (W8) - Includes all 51+ C ABI functions in generated code - W10: elements survive removeChild (no erase) - S3: embedded resource accessor present - W4: reentrancy guard in event dispatch Examples (3 new files + 3 updated): - rmlui-basic: rewritten to use Element/Document classes - rmlui-dom-api: comprehensive example with all DOM features - rmlui-rust: ui/ assets and README Also: - Copied _preamble.c.njk to templates-rmlui for template isolation - Fixed template-context.ts type to include defaultFont
# Conflicts: # .github/workflows/release.yml # examples/precompiled/src/main.wasm # packages/linker/src/build-cache.ts # packages/linker/src/codegen.ts # packages/linker/src/index.ts # packages/linker/src/template-context.ts # packages/linker/templates/main.c.njk # packages/types/src/index.ts
…funcs) - ABI: LoadDocumentFromString → LoadDocumentFromMemory(ctx, rml, url), +GetNumDocuments/GetDocument(index), clase class_list → SetClass/ IsClassSet/SetClassNames, docs de ownership AppendChild/RemoveChild - rmlui.hh: sync RAII con el ABI migrado (setClass/isClassSet/ setClassNames, getDocument(index)/getNumDocuments, loadDocumentFromMemory; addClass/removeClass/toggleClass/hasClass como wrappers de conveniencia) - Bindings regenerados con bindgen (52 funciones): Rust FFI y AssemblyScript; clases Element/Document actualizadas al ABI nuevo - rmlui-plugin.ts: +7 host functions (LoadDocumentFromMemory, GetNumDocuments, GetDocument, SetClass, IsClassSet, SetClassNames), −4 legacy −LoadDocumentFromString - Census automatizado 4 capas: rs/ts/plugin espejo completo del ABI, rmlui.hh subset válido + símbolos 6.2; gate grep legacy en 0 hits - Tests: 42/42 verdes, pnpm -r build verde
- rmlui-plugin: getRmluiConfig (templatePath propio), _readAsString para strings UCS2, bodies custom de QuerySelectorAll/FreeNodeList, extraLibs con sources de backends SDL/GL3 + defines de versión + orden de libs (rmlui_debugger antes que rmlui) + freetype en linux - main.c.njk: SDL3 + defines RMLUI_SDL_VERSION_* antes de backends, SetViewport explícito (FBO 8cd6), fonts con ruta absoluta del cache, entry point una sola vez antes del loop, SystemInterface_SDL() + SetWindow - _rmlui-state.c.njk: include rmlui-abi.h, API 6.2 (SetInnerRML/GetInnerRML, InstanceElement #text + ElementText::SetText, GetNumDocuments/GetDocument, _rmluiFindById, Style::FontStyle/FontWeight, LoadFontFace 6 args), reuso de contexto por nombre, helpers _rmluiQuerySelectorAllIds + _writeI32List - compiler.ts: copia rmlui-abi.h al build, add_compile_definitions y fuentes extra en CMake; rmlui-setup: fallback a source-build de SDL3 en 404 - index.ts: templatePath del plugin rmlui si no viene configurado - codegen/template-context/types: fontsDir en resources, ExtraLib.sources/defines - ejemplos rmlui: href de RCSS relativo al documento, RCSS 6.2 sin border shorthand, family LatoLatin; bindings TS sin comentar @external - tests: template-renderer-rmlui S-002/S-007/S-008 al ABI nuevo, setup/extract con source-build y extracción real - .prettierignore: rmlui-bindings.ts (decoradores AS)
- scripts/rmlui-smoke.mjs: corre cada binario RmlUI ~4s y valida stderr (filtra logs de fonts); requiere display en Linux, directo en macOS/Windows - test-examples.mjs: documenta skip de runtime por display (T-030) - examples/rmlui-rust/wapp.json: habilita rmlui-plugin (antes se linkeaba con el template genérico, sin ventana ni loop)
- ci.yml: xvfb en deps Linux; steps de smoke tras test:integration (Linux: xvfb-run + llvmpipe GL3; macOS: ventana cocoa directa) - docs/reference/config.md: sección plugins.rmlui-plugin (window, debugger, resources, enabled:false default) - docs/how-to/manage-cache.md: caché de deps RmlUI (~/.wasm-linker/rmlui, markers, pins 6.2/3.2.4, fallback source-build) - docs/how-to/run-integration-tests.md: smoke local + cobertura por SO (Windows: sin ICD GL3, solo build manual)
… plataforma-aware - .gitattributes: eol=lf en fuentes; el checkout Windows (autocrlf) rompía el type stripping de Node (import .ts desde index.mjs) con SyntaxError (reproducido local con CRLF) - rmlui-setup.test.ts: en win32 SDL3 usa el VC.zip (0 cmake), RmlUi hace 2; en linux/macOS se compila desde fuente (≥4)
- rmlui-bindgen.test.ts: fixture tar con cwd relativo (bsdtar de Windows interpreta '-C C:\...' como host remoto) - rmlui-setup.test.ts: assert de --install solo en linux/macOS (win32 usa el VC.zip precompilado, sin cmake --install)
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.
Resumen
rmlui-basic,rmlui-dom-api,rmlui-rust) generan binarios nativos con ventana SDL3 + GL3 y corren limpios.Cambios
packages/linker/templates-rmlui/*.c.njkpackages/linker/src/rmlui-plugin.tspackages/linker/src/compiler.tspackages/linker/src/rmlui-setup.tspackages/types/src/rmlui-abi.h/ bindingsexamples/rmlui-*scripts/rmlui-smoke.mjs.github/workflows/ci.ymldocs/Test Plan
pnpm vitest run→ 459 passed (43 files)pnpm -r buildverdenode scripts/test-examples.mjs→ 3 ejemplos rmlui build+linknode scripts/rmlui-smoke.mjs→ 3/3 PASS localxvfb-run -a node scripts/rmlui-smoke.mjssin display → 3/3 PASS (CI Linux)Nota
La rama
feature/rmlui-dom-bridgeacumula S1–S5 del cambio SDDrmlui-bridge(release v1.7.0): pins 6.2, migración ABI, bindings, descarga real con checksum y ahora el template funcional end-to-end. No hay issue linkeado: el repo no usa issues para este flujo.