@elurjs/universal 0.1.16 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (558) hide show
  1. package/README.md +24 -8
  2. package/cli/add-platform.mjs +121 -0
  3. package/cli/commands.mjs +11 -6
  4. package/cli/create-app.mjs +110 -190
  5. package/cli/dev.mjs +17 -21
  6. package/cli/doctor.mjs +144 -122
  7. package/cli/elur.mjs +112 -34
  8. package/cli/gen-es5.mjs +4 -2
  9. package/cli/gen-hbc.mjs +3 -5
  10. package/cli/gen-host-integration.mjs +26 -11
  11. package/cli/gen-signals.mjs +3 -2
  12. package/cli/gen-worklet-src.mjs +9 -1
  13. package/cli/lib-platforms.d.mts +18 -0
  14. package/cli/lib-platforms.mjs +338 -0
  15. package/cli/package-linux.mjs +8 -4
  16. package/cli/sync-platform-packages.mjs +153 -0
  17. package/docs/INSTALACION-Y-DEV.md +77 -102
  18. package/docs/doc-data.json +34 -14
  19. package/package.json +14 -33
  20. package/docs/AUDITORIA-STATE-OF-THE-ART-2026-11.md +0 -981
  21. package/docs/PENDIENTES.md +0 -1511
  22. package/docs/adr/0013-transiciones-navegacion.md +0 -169
  23. package/docs/adr/0014-list-renderitem-factory.md +0 -41
  24. package/docs/adr/0015-dl-header-versionado.md +0 -57
  25. package/docs/adr/0016-hermes-v1-runtime.md +0 -78
  26. package/docs/adr/0017-encoder-nativo-dl.md +0 -62
  27. package/docs/adr/0018-yoga-tree-nativo.md +0 -78
  28. package/docs/adr/0019-ssr-universal-hidratacion.md +0 -245
  29. package/docs/adr/0020-canvas-draw-list.md +0 -65
  30. package/docs/adr/0021-text-input-props.md +0 -55
  31. package/docs/adr/0022-deep-links.md +0 -49
  32. package/docs/adr/0023-animacion-declarativa.md +0 -130
  33. package/docs/adr/0024-estilos-reactivos-vocabulario.md +0 -100
  34. package/docs/adr/0025-worklets-contrato-runner.md +0 -181
  35. package/docs/adr/0026-threading-js-dedicado.md +0 -94
  36. package/docs/adr/0027-ui-array-children-y-scope-por-fila.md +0 -58
  37. package/docs/adr/0028-commit-por-frame-en-host-embebido.md +0 -93
  38. package/docs/adr/0029-render-commit-latest-wins-screenhost.md +0 -62
  39. package/docs/adr/0030-destruccion-recursiva-ids-monotonicos.md +0 -79
  40. package/docs/adr/0031-scopes-formales-pool-filas.md +0 -76
  41. package/docs/adr/0032-nav-commit-autoritativo.md +0 -64
  42. package/docs/adr/0033-lista-virtual-ventana.md +0 -80
  43. package/docs/adr/0034-attach-event-class-strict-styles.md +0 -89
  44. package/docs/adr/0035-pipeline-imagenes-acotado.md +0 -133
  45. package/docs/adr/0036-data-por-entry-spa.md +0 -91
  46. package/docs/adr/0037-ir-serializable-factories-por-id.md +0 -73
  47. package/docs/adr/0038-transform-keys-compositor.md +0 -79
  48. package/docs/adr/0039-destroy-postorder-scope-ownership.md +0 -86
  49. package/docs/adr/0040-outbound-barriers-overflow-ack.md +0 -60
  50. package/docs/adr/0041-diff-treap-ir-version-strict.md +0 -65
  51. package/docs/adr/0042-data-endpoint-seguridad-hasloader.md +0 -67
  52. package/docs/adr/0043-aplicador-dom-unico.md +0 -70
  53. package/docs/adr/0044-descriptor-runtime-explicito.md +0 -80
  54. package/docs/adr/0045-navstate-versionado-scroll-settle.md +0 -72
  55. package/docs/adr/0046-harness-build-fail-closed.md +0 -99
  56. package/docs/adr/0047-envelope-evento-normalizado.md +0 -110
  57. package/docs/adr/0048-sesion-embebida-estados.md +0 -91
  58. package/docs/adr/0049-strict-styles-valores-portables.md +0 -78
  59. package/docs/adr/0050-update-style-tipado-abi-v5.md +0 -66
  60. package/docs/adr/0051-plugin-sdk-comandos.md +0 -65
  61. package/docs/adr/0052-benchmarks-reproducibles.md +0 -50
  62. package/docs/adr/0053-fling-target-pool-estructural.md +0 -105
  63. package/docs/adr/0054-lista-nativa-render-policy.md +0 -130
  64. package/docs/adr/0055-cesm-core.md +0 -143
  65. package/docs/adr/0056-dos-ejes-superficie-vs-propietario-de-ventana.md +0 -112
  66. package/docs/adr/0057-reset-node-y-firma-de-reciclaje.md +0 -95
  67. package/docs/adr/0058-rollback-de-montaje.md +0 -83
  68. package/docs/adr/0059-traza-on-device-u01-y-scroll-unico-productor.md +0 -89
  69. package/docs/adr/0060-list-update-patch-por-campo.md +0 -73
  70. package/docs/adr/0061-elegibilidad-de-plantilla-nativa.md +0 -70
  71. package/docs/adr/0062-invalidacion-adapter-lista-nativa.md +0 -77
  72. package/docs/adr/0063-autoridad-eventos-y-scroll.md +0 -66
  73. package/docs/adr/0064-admision-unica-de-commits.md +0 -66
  74. package/docs/adr/0065-runtime-de-sesion-u11.md +0 -97
  75. package/docs/adr/0066-perfil-layout-y-safe-area.md +0 -78
  76. package/docs/adr/0067-sesion-robusta-y-procedencia-de-build.md +0 -121
  77. package/docs/adr/0068-metodologia-de-benchmark-y-carril-verificable.md +0 -94
  78. package/docs/adr/0069-schema-de-wire-y-corpus-comun-de-codecs.md +0 -126
  79. package/docs/adr/0070-modelo-publico-de-aplicacion-y-mount.md +0 -91
  80. package/docs/adr/0071-image-service-y-tck-de-plataforma.md +0 -133
  81. package/docs/adr/0072-par-compilador-runtime-hermes.md +0 -62
  82. package/docs/adr/0073-corpus-de-semantica-y-lowering-por-motor.md +0 -67
  83. package/docs/adr/0074-perfil-i18n-formateo-dom-free.md +0 -85
  84. package/docs/adr/0075-back-predictivo-restore-y-layout-adaptativo.md +0 -126
  85. package/docs/adr/0076-contrato-de-modulos-capa-1.md +0 -159
  86. package/docs/adr/0077-manifest-de-plugin-y-plugin-sync.md +0 -109
  87. package/docs/adr/0078-extraccion-de-i18n-a-paquete-propio.md +0 -114
  88. package/docs/adr/0079-handles-de-host-objects-por-epoch.md +0 -96
  89. package/docs/adr/0080-platform-views-por-contrato.md +0 -93
  90. package/docs/adr/0081-codegen-del-dsl-de-modulos.md +0 -118
  91. package/docs/adr/0082-variante-web-de-modulos-nativos.md +0 -126
  92. package/docs/adr/0083-perfiles-dev-release.md +0 -92
  93. package/docs/adr/0084-instrumentacion-acotada-exportable.md +0 -126
  94. package/docs/adr/0085-medicion-agrupada-en-main.md +0 -125
  95. package/docs/adr/0086-matriz-capacidades-props-eventos.md +0 -75
  96. package/docs/adr/0087-uithread-runner-android.md +0 -271
  97. package/docs/adr/0088-worklet-src-estatico.md +0 -82
  98. package/docs/adr/0089-composicion-animaciones-settle-drag.md +0 -122
  99. package/docs/adr/0090-linter-capturas-build.md +0 -94
  100. package/docs/adr/0091-router-core-vs-universal.md +0 -74
  101. package/docs/adr/0092-sharedregion-type-strings.md +0 -59
  102. package/docs/adr/0093-permission-request-estandar.md +0 -52
  103. package/docs/adr/0094-dispatch-worker-timeoutms.md +0 -51
  104. package/docs/adr/0095-tck-modulos.md +0 -65
  105. package/docs/adr/0096-cesm-ring-deferral.md +0 -47
  106. package/docs/adr/0097-tooling-diferido.md +0 -51
  107. package/docs/adr/0098-handshake-moduleabi.md +0 -46
  108. package/docs/adr/0099-modulos-ambient.md +0 -58
  109. package/docs/adr/0100-auto-declaracion-modulos.md +0 -43
  110. package/docs/adr/0101-plataforma-build.md +0 -49
  111. package/docs/adr/0102-permisos-manifest-build.md +0 -38
  112. package/docs/adr/0103-registrant-ownership.md +0 -45
  113. package/docs/adr/0104-toolchain-release.md +0 -125
  114. package/docs/adr/0105-cesm-ring-mode.md +0 -71
  115. package/docs/adr/0106-module-observabilidad.md +0 -100
  116. package/docs/adr/0107-layout-l1-oraculo.md +0 -67
  117. package/docs/adr/0108-semantica-como-ops.md +0 -69
  118. package/docs/adr/0109-text-input-composition.md +0 -64
  119. package/docs/adr/0110-yoga-3-2.md +0 -63
  120. package/docs/adr/0111-hot-reload-con-estado.md +0 -92
  121. package/docs/adr/0112-metricas-nativas-reales.md +0 -65
  122. package/docs/adr/0113-cesm-proyeccion-ampliada.md +0 -80
  123. package/docs/adr/0114-androidx-deps.md +0 -72
  124. package/docs/adr/0115-coil-imagenes.md +0 -57
  125. package/docs/adr/0116-precomputed-text-off-ui.md +0 -49
  126. package/docs/adr/0117-a11y-state-hint-foco.md +0 -54
  127. package/docs/adr/0118-yoga-3-2-vocabulario.md +0 -98
  128. package/docs/adr/0119-codecs-wire-desde-esquema.md +0 -86
  129. package/docs/adr/0120-unidades-logicas-pointscalefactor.md +0 -73
  130. package/docs/adr/0121-yoga-filas-lista.md +0 -100
  131. package/docs/adr/0122-delegado-layout-subarbol.md +0 -140
  132. package/docs/adr/0123-canvas-sobre-skia-raster.md +0 -101
  133. package/docs/adr/0124-evaluacion-taffy-css-grid.md +0 -52
  134. package/docs/adr/0125-paridad-visual-android.md +0 -89
  135. package/docs/adr/0126-documento-web-metadata-enlaces.md +0 -52
  136. package/docs/adr/0127-perfil-l1-shorthand-flex-herencia-texto.md +0 -70
  137. package/docs/adr/0128-pantalla-llena-fragmentos-transparentes.md +0 -56
  138. package/docs/adr/0129-content-visibility-canvas-unidades-logicas.md +0 -37
  139. package/docs/adr/0130-expresiones-reactivas-ui.md +0 -55
  140. package/docs/adr/0131-state-style.md +0 -59
  141. package/docs/adr/0132-create-theme-system-color-scheme.md +0 -58
  142. package/docs/adr/0133-navegacion-rutas-href-chrome.md +0 -59
  143. package/docs/adr/0134-servicios-ambient-modulos-timers.md +0 -63
  144. package/docs/adr/0135-registro-fuentes.md +0 -67
  145. package/docs/adr/0136-i18n-zonas-dst-locale-reactivo.md +0 -70
  146. package/docs/adr/0137-ssg-universal.md +0 -78
  147. package/docs/adr/0138-plantillas-fila-ui-rowref.md +0 -54
  148. package/docs/adr/0139-paridad-geometrica-e-inspector.md +0 -63
  149. package/docs/adr/0140-medida-line-height-css.md +0 -78
  150. package/docs/adr/0141-build-ssr-autocontenido.md +0 -37
  151. package/docs/adr/0142-tema-ssr-cookie-client-hint.md +0 -42
  152. package/docs/adr/0143-paridad-visual-ci.md +0 -51
  153. package/docs/adr/0144-oraculo-layout-chromium.md +0 -45
  154. package/docs/adr/0145-admision-opcodes-wire.md +0 -89
  155. package/docs/adr/0146-presupuesto-divergencias.md +0 -82
  156. package/docs/adr/0147-spans-texto-enriquecido.md +0 -113
  157. package/docs/adr/0148-scroll-restore.md +0 -92
  158. package/docs/adr/0149-gestion-foco.md +0 -94
  159. package/docs/adr/0150-sticky.md +0 -89
  160. package/docs/adr/0151-politica-migracion-snapshots.md +0 -83
  161. package/docs/adr/0152-vocabulario-semantico-v3.md +0 -112
  162. package/docs/adr/0153-puerta-doc-codigo.md +0 -59
  163. package/docs/adr/0154-matriz-paridad.md +0 -79
  164. package/docs/adr/0155-rtl-ambiente.md +0 -73
  165. package/docs/adr/0156-quickjs-ng-0170.md +0 -55
  166. package/docs/adr/0157-qjsc-bytecode-android.md +0 -73
  167. package/docs/adr/0158-abi-host-explicita.md +0 -62
  168. package/docs/adr/0159-entrada-desktop.md +0 -59
  169. package/docs/adr/0160-port-linux-hallazgos-plataforma.md +0 -91
  170. package/docs/adr/0161-paridad-deeplink-alineacion-estructural.md +0 -76
  171. package/docs/adr/0162-fontscale-linux-fuentes.md +0 -63
  172. package/docs/adr/0163-overflow-hidden-linux-clip.md +0 -67
  173. package/docs/adr/0164-nav-transitions-linux.md +0 -126
  174. package/docs/adr/0165-transiciones-declarativas.md +0 -147
  175. package/docs/adr/0166-ime-composition-linux.md +0 -68
  176. package/docs/adr/0167-spans-pango-linux.md +0 -80
  177. package/docs/adr/0168-statestyle-linux.md +0 -65
  178. package/docs/adr/0169-animate-linux.md +0 -114
  179. package/docs/adr/0170-image-service-linux.md +0 -54
  180. package/docs/adr/0171-semantics-atspi-linux.md +0 -80
  181. package/docs/adr/0172-conformidad-de-host-por-terceros.md +0 -159
  182. package/docs/adr/0173-licencias-espec-y-codigo.md +0 -95
  183. package/docs/adr/0174-tabla-estilo-yoga-compartida.md +0 -67
  184. package/docs/adr/0175-easings-normativos-cubic-bezier.md +0 -68
  185. package/docs/adr/0176-harness-plataforma-linux-y-locale-decimal.md +0 -80
  186. package/docs/adr/0177-gaps-linux-dir-as-navstate.md +0 -84
  187. package/docs/adr/0178-matriz-linux-y-tablas-normativas-generadas.md +0 -104
  188. package/docs/adr/0179-eventos-gesto-y-teclado.md +0 -132
  189. package/docs/adr/0180-desktop-nativo-linux-windows-macos-chromeos.md +0 -58
  190. package/docs/adr/0181-linux-platform-views-uiworklet-y-gaps-certificados.md +0 -101
  191. package/docs/adr/0182-sdui-envelope-dialecto-rico-y-lowering.md +0 -452
  192. package/docs/adr/0183-hermes-es6-block-scoping-en-source-eval.md +0 -99
  193. package/docs/adr/0184-sdui-consumidor-de-referencia-y-modulo-http.md +0 -72
  194. package/docs/adr/0185-sdui-modelo-de-seguridad-del-envelope.md +0 -160
  195. package/docs/adr/0186-linux-packaging-deb-rpm-flatpak.md +0 -61
  196. package/docs/adr/0187-modelo-de-hilos-ejecutores-logicos.md +0 -163
  197. package/docs/adr/0188-sdui-seguridad-hardening.md +0 -214
  198. package/docs/adr/0189-worklets-web-worker-y-egreso-pinning.md +0 -235
  199. package/docs/adr/0190-semantics-actions-linux-via-gaction-muxer.md +0 -102
  200. package/docs/adr/0191-reporte-de-errores-en-produccion.md +0 -126
  201. package/docs/adr/0192-source-maps-y-simbolizacion-de-stacks.md +0 -107
  202. package/docs/adr/0193-renderer-skia-opt-in-en-linux.md +0 -143
  203. package/docs/adr/0194-superficie-declarada-y-carril-skia-tree.md +0 -96
  204. package/docs/adr/0195-bundles-embebidos-subpaths-core.md +0 -66
  205. package/docs/adr/0196-matriz-capacidades-verdad.md +0 -84
  206. package/docs/adr/0197-entorno-reactivo-cableado.md +0 -67
  207. package/docs/adr/0198-csprng-host-wintertc.md +0 -57
  208. package/docs/adr/0199-testing-harness-dom-free.md +0 -59
  209. package/docs/adr/0200-overlays-back-foco.md +0 -84
  210. package/docs/adr/0201-paridad-nativa-props-texto-fase1.md +0 -79
  211. package/docs/adr/0202-node-ref-measure-web.md +0 -61
  212. package/docs/adr/0203-primitivas-headless.md +0 -54
  213. package/docs/adr/0204-imagen-load-error-fallback.md +0 -123
  214. package/docs/adr/0205-primitivas-controls-fase2.md +0 -79
  215. package/docs/adr/0206-a2ui-catalogo-tabs-modal-choicepicker-icon.md +0 -110
  216. package/docs/adr/0207-a2ui-superficie-viva.md +0 -104
  217. package/docs/adr/0208-a2ui-checks-validacion.md +0 -94
  218. package/docs/adr/0209-loaddata-nativo-default.md +0 -56
  219. package/docs/adr/0210-primitivas-navegacion-fase3.md +0 -69
  220. package/docs/adr/0211-a2ui-formato-localizado.md +0 -113
  221. package/docs/adr/0212-red-fuera-del-core.md +0 -67
  222. package/docs/adr/0213-dev-fast-y-rutas-automaticas.md +0 -68
  223. package/docs/adr/0214-dev-web-server-reload.md +0 -55
  224. package/docs/adr/0215-ui-host-noderef-back-http-linux.md +0 -77
  225. package/docs/adr/0216-paridad-nativa-switch-scroll-lista.md +0 -53
  226. package/docs/adr/0217-overlays-drag-y-popover-anclado.md +0 -64
  227. package/docs/adr/0218-sdui-gateway-live-mcp-y-scaffold.md +0 -32
  228. package/docs/adr/0219-event-ref-envelope-y-oracle-scroll-aware.md +0 -82
  229. package/docs/adr/0220-target-windows-winui3.md +0 -331
  230. package/docs/adr/0221-shell-tabs-desktop-normativa.md +0 -45
  231. package/docs/adr/0222-a2ui-v1-dialecto-por-superficie.md +0 -109
  232. package/docs/adr/README.md +0 -230
  233. package/docs/deuda/i18n-libreria-separada.md +0 -50
  234. package/docs/propuestas/dx-y-paridad.md +0 -684
  235. package/docs/propuestas/investigacion-apps-completas/PENDIENTES-CORE-APPS-COMPLETAS.md +0 -226
  236. package/docs/propuestas/investigacion-apps-completas/arquitectura-motor-videojuegos-elur.md +0 -254
  237. package/docs/propuestas/investigacion-apps-completas/auditoria-paridad-frameworks-y-sdui.md +0 -295
  238. package/docs/propuestas/investigacion-apps-completas/ciclo-de-vida-dx-y-apps-completas.md +0 -394
  239. package/docs/propuestas/investigacion-apps-completas/crear-proyecto-desde-npm-y-agentes.md +0 -477
  240. package/docs/propuestas/investigacion-apps-completas/especificacion-arquitectura-capacidades-faltantes.md +0 -407
  241. package/docs/propuestas/investigacion-apps-completas/identidad-y-nombre-elur-universal.md +0 -133
  242. package/docs/propuestas/investigacion-apps-completas/migracion-elur-core-4.md +0 -266
  243. package/docs/propuestas/investigacion-apps-completas/sdui-a2ui-aplicaciones-completas.md +0 -255
  244. package/docs/propuestas/investigacion-apps-completas/verificacion-mejoras-y-brechas-nuevas.md +0 -228
  245. package/docs/propuestas/modelo-de-consumo.md +0 -287
  246. package/docs/propuestas/modulos-nativos.md +0 -1062
  247. package/docs/propuestas/palabras-clave-normativas.md +0 -69
  248. package/docs/propuestas/sdui-seguridad-hardening.md +0 -322
  249. package/docs/propuestas/skia-graphite.md +0 -167
  250. package/docs/propuestas/skia-renderer-arbol.md +0 -603
  251. package/docs/propuestas/targets-nativos-nuevos.md +0 -359
  252. package/docs/propuestas/toolchain-y-distribucion.md +0 -311
  253. package/docs/propuestas/ui-worklet-capacidades-exclusivas.md +0 -114
  254. package/examples/a11ylive/elur.app.json +0 -8
  255. package/examples/a11ylive/entry.ts +0 -22
  256. package/examples/a11ysem/elur.app.json +0 -8
  257. package/examples/a11ysem/entry.ts +0 -24
  258. package/examples/anim/elur.app.json +0 -8
  259. package/examples/anim/entry.ts +0 -50
  260. package/examples/app.ts +0 -10
  261. package/examples/cliprad/elur.app.json +0 -8
  262. package/examples/cliprad/entry.ts +0 -16
  263. package/examples/controls/app.ts +0 -32
  264. package/examples/controls/elur.app.json +0 -8
  265. package/examples/counter/app.ts +0 -21
  266. package/examples/counter/elur.app.json +0 -8
  267. package/examples/counter/entry.ts +0 -7
  268. package/examples/entry.ts +0 -11
  269. package/examples/feedstress/app.ts +0 -334
  270. package/examples/feedstress/elur.app.json +0 -8
  271. package/examples/feedstress/entry.ts +0 -7
  272. package/examples/i18n/app.ts +0 -86
  273. package/examples/i18n/elur.app.json +0 -8
  274. package/examples/i18n/entry.ts +0 -22
  275. package/examples/imecomp/elur.app.json +0 -8
  276. package/examples/imecomp/entry.ts +0 -41
  277. package/examples/imgtest/elur.app.json +0 -8
  278. package/examples/imgtest/entry.ts +0 -18
  279. package/examples/mareas/app/ajustes/page.ts +0 -54
  280. package/examples/mareas/app/page.ts +0 -91
  281. package/examples/mareas/app/puerto/[id]/page.ts +0 -106
  282. package/examples/mareas/app.ts +0 -12
  283. package/examples/mareas/elur.app.json +0 -35
  284. package/examples/mareas/entry.ts +0 -11
  285. package/examples/mareas/fonts/DejaVuSansMono-Bold.ttf +0 -0
  286. package/examples/mareas/fonts/DejaVuSansMono.ttf +0 -0
  287. package/examples/mareas/fonts/DejaVuSerif-Bold.ttf +0 -0
  288. package/examples/mareas/fonts/DejaVuSerif-Italic.ttf +0 -0
  289. package/examples/mareas/fonts/DejaVuSerif.ttf +0 -0
  290. package/examples/mareas/fonts/LICENSE-DejaVu.txt +0 -187
  291. package/examples/mareas/fonts.ts +0 -6
  292. package/examples/mareas/head.ts +0 -12
  293. package/examples/mareas/i18n.ts +0 -163
  294. package/examples/mareas/ports.ts +0 -131
  295. package/examples/mareas/routes.gen.ts +0 -44
  296. package/examples/mareas/serve.ts +0 -70
  297. package/examples/mareas/services.ts +0 -5
  298. package/examples/mareas/services.web.ts +0 -6
  299. package/examples/mareas/state.ts +0 -64
  300. package/examples/mareas/theme.ts +0 -56
  301. package/examples/mareas/ui/controls.ts +0 -42
  302. package/examples/mareas/ui/frame.ts +0 -63
  303. package/examples/mareas/ui/marigram.ts +0 -52
  304. package/examples/masonry/app.ts +0 -32
  305. package/examples/masonry/elur.app.json +0 -8
  306. package/examples/masonry/entry.ts +0 -4
  307. package/examples/natprobe/elur.app.json +0 -8
  308. package/examples/natprobe/entry-a11y.ts +0 -52
  309. package/examples/natprobe/entry-tinput.ts +0 -73
  310. package/examples/natprobe/entry-tml.ts +0 -46
  311. package/examples/natprobe/entry.ts +0 -285
  312. package/examples/navdemo/app.ts +0 -109
  313. package/examples/navdemo/elur.app.json +0 -8
  314. package/examples/navdemo/entry.ts +0 -7
  315. package/examples/navtrans/elur.app.json +0 -8
  316. package/examples/navtrans/entry.ts +0 -53
  317. package/examples/platformview/app.ts +0 -26
  318. package/examples/platformview/elur.app.json +0 -8
  319. package/examples/sdui-demo/docs/home.envelope.json +0 -588
  320. package/examples/sdui-demo/docs/home.iife.json +0 -582
  321. package/examples/sdui-demo/elur.app.json +0 -8
  322. package/examples/sdui-demo/entry.ts +0 -346
  323. package/examples/select/elur.app.json +0 -8
  324. package/examples/select/entry.ts +0 -20
  325. package/examples/skiacanvas/app.ts +0 -34
  326. package/examples/skiacanvas/elur.app.json +0 -8
  327. package/examples/skiacanvas/entry.ts +0 -4
  328. package/examples/spans/elur.app.json +0 -8
  329. package/examples/spans/entry.ts +0 -28
  330. package/examples/ssr/app/about/page.ts +0 -18
  331. package/examples/ssr/app/items/[id]/page.ts +0 -16
  332. package/examples/ssr/app/layout.ts +0 -21
  333. package/examples/ssr/app/page.action.ts +0 -10
  334. package/examples/ssr/app/page.data.ts +0 -5
  335. package/examples/ssr/app/page.ts +0 -95
  336. package/examples/ssr/app/slow/loading.ts +0 -10
  337. package/examples/ssr/app/slow/page.data.ts +0 -4
  338. package/examples/ssr/app/slow/page.ts +0 -16
  339. package/examples/ssr/app/store.ts +0 -3
  340. package/examples/ssr/serve.ts +0 -53
  341. package/examples/statestyle/elur.app.json +0 -8
  342. package/examples/statestyle/entry.ts +0 -25
  343. package/examples/swipe/elur.app.json +0 -8
  344. package/examples/swipe/entry.ts +0 -39
  345. package/examples/tasks/app.ts +0 -145
  346. package/examples/tasks/elur.app.json +0 -8
  347. package/examples/uiprops/elur.app.json +0 -8
  348. package/examples/uiprops/entry.ts +0 -65
  349. package/examples/uiwk/app.ts +0 -288
  350. package/examples/uiwk/elur.app.json +0 -8
  351. package/examples/uiwk/entry.ts +0 -7
  352. package/examples/vertical/app.ts +0 -275
  353. package/examples/vertical/elur.app.json +0 -8
  354. package/examples/vertical/entry.ts +0 -31
  355. package/examples/yogafeatures/app.ts +0 -55
  356. package/examples/yogafeatures/elur.app.json +0 -8
  357. package/examples/yogafeatures/entry.ts +0 -4
  358. package/native/cesm/tests/CMakeLists.txt +0 -50
  359. package/native/cesm/tests/README.md +0 -89
  360. package/native/cesm/tests/compile_check_hermes.cpp +0 -23
  361. package/native/cesm/tests/test_core.cpp +0 -101
  362. package/native/cesm/tests/test_main.cpp +0 -13
  363. package/native/cesm/tests/test_quickjs_adapter.cpp +0 -252
  364. package/native/cesm/tests/test_ring.cpp +0 -131
  365. package/native/cesm/tests/test_slots.cpp +0 -81
  366. package/native/cesm/tests/test_sync.cpp +0 -157
  367. package/native/cesm/tests/test_util.h +0 -24
  368. package/targets/android/app/build.gradle.kts +0 -192
  369. package/targets/android/app/proguard-rules-elur.pro +0 -12
  370. package/targets/android/app/proguard-rules.pro +0 -3
  371. package/targets/android/app/src/main/AndroidManifest.xml +0 -81
  372. package/targets/android/app/src/main/cpp/CMakeLists.txt +0 -117
  373. package/targets/android/app/src/main/cpp/dlEncoder.h +0 -117
  374. package/targets/android/app/src/main/cpp/dlEncoderJsi.cpp +0 -315
  375. package/targets/android/app/src/main/cpp/dlEncoderQjs.cpp +0 -394
  376. package/targets/android/app/src/main/cpp/dlOps.inc +0 -145
  377. package/targets/android/app/src/main/cpp/elurBridge.cpp +0 -1350
  378. package/targets/android/app/src/main/cpp/elurBridgeHermes.cpp +0 -1294
  379. package/targets/android/app/src/main/cpp/elurSkia.cpp +0 -287
  380. package/targets/android/app/src/main/cpp/elurSkiaTree.cpp +0 -448
  381. package/targets/android/app/src/main/cpp/elurUiWorklet.cpp +0 -1233
  382. package/targets/android/app/src/main/cpp/elurYoga.cpp +0 -1060
  383. package/targets/android/app/src/main/cpp/elurYoga.h +0 -82
  384. package/targets/android/app/src/main/cpp/hermes-libs/LICENSE +0 -21
  385. package/targets/android/app/src/main/cpp/hermes-libs/arm64-v8a/libhermesvm.so +0 -0
  386. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/AsyncDebuggerAPI.h +0 -276
  387. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/CompileJS.h +0 -97
  388. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/DebuggerAPI.h +0 -502
  389. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/Public/CrashManager.h +0 -107
  390. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/Public/CtorConfig.h +0 -145
  391. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/Public/DebuggerTypes.h +0 -193
  392. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/Public/GCConfig.h +0 -211
  393. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/Public/GCTripwireContext.h +0 -40
  394. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/Public/HermesExport.h +0 -14
  395. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/Public/JSOutOfMemoryError.h +0 -27
  396. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/Public/RuntimeConfig.h +0 -141
  397. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/Public/SamplingProfiler.h +0 -270
  398. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/RuntimeTaskRunner.h +0 -64
  399. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/SynthTrace.h +0 -1566
  400. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/SynthTraceParser.h +0 -37
  401. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/ThreadSafetyAnalysis.h +0 -75
  402. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/TimerStats.h +0 -23
  403. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/TraceInterpreter.h +0 -334
  404. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/TracingRuntime.h +0 -328
  405. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/cdp/CDPAgent.h +0 -131
  406. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/cdp/CDPDebugAPI.h +0 -73
  407. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/cdp/CallbackOStream.h +0 -89
  408. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/cdp/ConsoleMessage.h +0 -135
  409. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/cdp/DebuggerDomainAgent.h +0 -280
  410. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/cdp/DebuggerDomainCoordinator.h +0 -137
  411. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/cdp/DomainAgent.h +0 -107
  412. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/cdp/DomainState.h +0 -140
  413. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/cdp/HeapProfilerDomainAgent.h +0 -71
  414. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/cdp/JSONValueInterfaces.h +0 -40
  415. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/cdp/MessageConverters.h +0 -82
  416. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/cdp/MessageInterfaces.h +0 -72
  417. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/cdp/MessageTypes.h +0 -1279
  418. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/cdp/MessageTypesInlines.h +0 -313
  419. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/cdp/ProfilerDomainAgent.h +0 -38
  420. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/cdp/RemoteObjectConverters.h +0 -77
  421. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/cdp/RemoteObjectsTable.h +0 -127
  422. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/cdp/RuntimeDomainAgent.h +0 -138
  423. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/extensions/Dummy.h +0 -24
  424. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/extensions/Extensions.h +0 -20
  425. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/extensions/ExtensionsBytecode.h +0 -23
  426. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/extensions/Intrinsics.h +0 -44
  427. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/extensions/JSIUtils.h +0 -123
  428. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/extensions/TextEncoder.h +0 -29
  429. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/extensions/contrib/ContribDummy.h +0 -24
  430. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/extensions/contrib/ContribExtensions.h +0 -23
  431. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/extensions/contrib/TextDecoder.h +0 -30
  432. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/extensions/contrib/TextDecoderUtils.h +0 -113
  433. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/hermes.h +0 -242
  434. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes/hermes_tracing.h +0 -52
  435. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes_abi/HermesABIHelpers.h +0 -295
  436. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes_abi/HermesABIRuntimeWrapper.h +0 -25
  437. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes_abi/hermes_abi.h +0 -642
  438. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes_abi/hermes_vtable.h +0 -29
  439. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes_sandbox/HermesSandboxRuntime.h +0 -41
  440. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes_sandbox/external/hermes_sandbox_impl_compiled.h +0 -12
  441. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes_sandbox/external/hermes_sandbox_impl_dbg_compiled-impl.h +0 -8516
  442. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes_sandbox/external/hermes_sandbox_impl_dbg_compiled.h +0 -137
  443. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes_sandbox/external/hermes_sandbox_impl_opt_compiled-impl.h +0 -3945
  444. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes_sandbox/external/hermes_sandbox_impl_opt_compiled.h +0 -119
  445. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes_sandbox/external/wasm-rt-fb.h +0 -124
  446. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes_sandbox/external/wasm-rt-impl.h +0 -66
  447. package/targets/android/app/src/main/cpp/hermes-libs/include/hermes_sandbox/external/wasm-rt.h +0 -456
  448. package/targets/android/app/src/main/cpp/hermes-libs/include/jsi/JSIDynamic.h +0 -26
  449. package/targets/android/app/src/main/cpp/hermes-libs/include/jsi/decorator.h +0 -1157
  450. package/targets/android/app/src/main/cpp/hermes-libs/include/jsi/hermes-interfaces.h +0 -242
  451. package/targets/android/app/src/main/cpp/hermes-libs/include/jsi/instrumentation.h +0 -132
  452. package/targets/android/app/src/main/cpp/hermes-libs/include/jsi/jsi-inl.h +0 -434
  453. package/targets/android/app/src/main/cpp/hermes-libs/include/jsi/jsi.h +0 -2266
  454. package/targets/android/app/src/main/cpp/hermes-libs/include/jsi/jsilib.h +0 -59
  455. package/targets/android/app/src/main/cpp/hermes-libs/include/jsi/threadsafe.h +0 -79
  456. package/targets/android/app/src/main/cpp/hermes-libs/jsi-impl/jsi.cpp +0 -1111
  457. package/targets/android/app/src/main/cpp/hermes-libs/x86_64/libhermesvm.so +0 -0
  458. package/targets/android/app/src/main/java/com/elur/universal/BinaryCodec.kt +0 -121
  459. package/targets/android/app/src/main/java/com/elur/universal/DlDecoder.kt +0 -260
  460. package/targets/android/app/src/main/java/com/elur/universal/DlOpsDecode.kt +0 -158
  461. package/targets/android/app/src/main/java/com/elur/universal/ElurBoxDrawable.kt +0 -161
  462. package/targets/android/app/src/main/java/com/elur/universal/ElurBridge.kt +0 -238
  463. package/targets/android/app/src/main/java/com/elur/universal/ElurBridgeHermes.kt +0 -223
  464. package/targets/android/app/src/main/java/com/elur/universal/ElurCanvasView.kt +0 -202
  465. package/targets/android/app/src/main/java/com/elur/universal/ElurCryptoModule.kt +0 -206
  466. package/targets/android/app/src/main/java/com/elur/universal/ElurCustomLayout.kt +0 -185
  467. package/targets/android/app/src/main/java/com/elur/universal/ElurEditText.kt +0 -17
  468. package/targets/android/app/src/main/java/com/elur/universal/ElurFontRegistry.kt +0 -190
  469. package/targets/android/app/src/main/java/com/elur/universal/ElurHttpModule.kt +0 -306
  470. package/targets/android/app/src/main/java/com/elur/universal/ElurImageService.kt +0 -348
  471. package/targets/android/app/src/main/java/com/elur/universal/ElurLicensesActivity.kt +0 -84
  472. package/targets/android/app/src/main/java/com/elur/universal/ElurListView.kt +0 -954
  473. package/targets/android/app/src/main/java/com/elur/universal/ElurManifest.kt +0 -117
  474. package/targets/android/app/src/main/java/com/elur/universal/ElurMetrics.kt +0 -325
  475. package/targets/android/app/src/main/java/com/elur/universal/ElurModuleRegistrar.kt +0 -14
  476. package/targets/android/app/src/main/java/com/elur/universal/ElurPermissionGate.kt +0 -36
  477. package/targets/android/app/src/main/java/com/elur/universal/ElurRenderer.kt +0 -6164
  478. package/targets/android/app/src/main/java/com/elur/universal/ElurRowYoga.kt +0 -130
  479. package/targets/android/app/src/main/java/com/elur/universal/ElurScrollView.kt +0 -240
  480. package/targets/android/app/src/main/java/com/elur/universal/ElurShellView.kt +0 -117
  481. package/targets/android/app/src/main/java/com/elur/universal/ElurSkiaCanvasView.kt +0 -162
  482. package/targets/android/app/src/main/java/com/elur/universal/ElurSkiaTreeRenderer.kt +0 -968
  483. package/targets/android/app/src/main/java/com/elur/universal/ElurStateModule.kt +0 -69
  484. package/targets/android/app/src/main/java/com/elur/universal/ElurSwipeDriver.kt +0 -34
  485. package/targets/android/app/src/main/java/com/elur/universal/ElurTckModule.kt +0 -99
  486. package/targets/android/app/src/main/java/com/elur/universal/ElurTextMeasure.kt +0 -16
  487. package/targets/android/app/src/main/java/com/elur/universal/ElurTrace.kt +0 -24
  488. package/targets/android/app/src/main/java/com/elur/universal/ElurUiModule.kt +0 -48
  489. package/targets/android/app/src/main/java/com/elur/universal/ElurUiWorklet.kt +0 -305
  490. package/targets/android/app/src/main/java/com/elur/universal/JsBridge.kt +0 -67
  491. package/targets/android/app/src/main/java/com/elur/universal/JsThread.kt +0 -189
  492. package/targets/android/app/src/main/java/com/elur/universal/MainActivity.kt +0 -844
  493. package/targets/android/app/src/main/java/com/elur/universal/ModuleRegistry.kt +0 -701
  494. package/targets/android/app/src/main/java/com/elur/universal/YogaRowScope.kt +0 -97
  495. package/targets/android/app/src/main/res/values/ids.xml +0 -10
  496. package/targets/android/app/src/main/res/values/strings.xml +0 -8
  497. package/targets/android/app/src/main/res/values-es/strings.xml +0 -5
  498. package/targets/android/app/src/main/res/xml/network_security_config.xml +0 -10
  499. package/targets/android/build.gradle.kts +0 -5
  500. package/targets/android/gradle/libs.versions.toml +0 -12
  501. package/targets/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  502. package/targets/android/gradle/wrapper/gradle-wrapper.properties +0 -8
  503. package/targets/android/gradle.properties +0 -23
  504. package/targets/android/gradlew +0 -251
  505. package/targets/android/gradlew.bat +0 -94
  506. package/targets/android/settings.gradle.kts +0 -32
  507. package/targets/linux/CMakeLists.txt +0 -196
  508. package/targets/linux/README.md +0 -422
  509. package/targets/linux/ci/tsan.supp +0 -15
  510. package/targets/linux/generated/elur_module_registrar.cpp +0 -18
  511. package/targets/linux/generated/module_sources.cmake +0 -7
  512. package/targets/linux/src/elur_applicator.cpp +0 -5073
  513. package/targets/linux/src/elur_applicator.h +0 -387
  514. package/targets/linux/src/elur_clip.cpp +0 -76
  515. package/targets/linux/src/elur_clip.h +0 -23
  516. package/targets/linux/src/elur_crypto_module.cpp +0 -121
  517. package/targets/linux/src/elur_events.h +0 -57
  518. package/targets/linux/src/elur_fonts.cpp +0 -106
  519. package/targets/linux/src/elur_fonts.h +0 -31
  520. package/targets/linux/src/elur_host.cpp +0 -1041
  521. package/targets/linux/src/elur_host.h +0 -66
  522. package/targets/linux/src/elur_http_module.cpp +0 -437
  523. package/targets/linux/src/elur_js.h +0 -40
  524. package/targets/linux/src/elur_modules.cpp +0 -453
  525. package/targets/linux/src/elur_modules.h +0 -159
  526. package/targets/linux/src/elur_renderer.h +0 -46
  527. package/targets/linux/src/elur_shot.cpp +0 -64
  528. package/targets/linux/src/elur_shot.h +0 -17
  529. package/targets/linux/src/elur_skia_a11y.cpp +0 -987
  530. package/targets/linux/src/elur_skia_a11y.h +0 -146
  531. package/targets/linux/src/elur_skia_app.cpp +0 -1770
  532. package/targets/linux/src/elur_skia_app.h +0 -18
  533. package/targets/linux/src/elur_state_module.cpp +0 -99
  534. package/targets/linux/src/elur_tck_module.cpp +0 -186
  535. package/targets/linux/src/elur_ui_module.cpp +0 -84
  536. package/targets/linux/src/elur_yoga.cpp +0 -452
  537. package/targets/linux/src/elur_yoga.h +0 -95
  538. package/targets/linux/src/main.cpp +0 -294
  539. package/targets/windows/Package.appxmanifest +0 -28
  540. package/targets/windows/README.md +0 -44
  541. package/targets/windows/elur-windows.vcxproj +0 -133
  542. package/targets/windows/packages.config +0 -10
  543. package/targets/windows/src/elur_crypto_module_win.cpp +0 -110
  544. package/targets/windows/src/elur_events.h +0 -58
  545. package/targets/windows/src/elur_host_win.cpp +0 -645
  546. package/targets/windows/src/elur_host_win.h +0 -75
  547. package/targets/windows/src/elur_http_module_win.cpp +0 -333
  548. package/targets/windows/src/elur_js.h +0 -40
  549. package/targets/windows/src/elur_modules.cpp +0 -460
  550. package/targets/windows/src/elur_modules.h +0 -159
  551. package/targets/windows/src/elur_state_module.cpp +0 -99
  552. package/targets/windows/src/elur_ui_module_win.cpp +0 -75
  553. package/targets/windows/src/elur_uia_host.h +0 -129
  554. package/targets/windows/src/elur_win_applicator.cpp +0 -3242
  555. package/targets/windows/src/elur_win_applicator.h +0 -187
  556. package/targets/windows/src/elur_yoga.cpp +0 -453
  557. package/targets/windows/src/elur_yoga.h +0 -95
  558. package/targets/windows/src/main.cpp +0 -321
@@ -1,1060 +0,0 @@
1
- // elurYoga.cpp — árbol Yoga único en C++ (P1-TREE)
2
- // Reemplaza el árbol Yoga Java de ElurRenderer: un YGNodeRef por id,
3
- // medición de hojas via JNI a Kotlin (view.measure), layout fuera del
4
- // UI thread. Emite ops `layout` (ABI 17) — Kotlin las aplica como
5
- // LayoutParams absolutos; el path Skia los consumirá directo nativo.
6
-
7
- #include "elurYoga.h"
8
- #include "yoga/Yoga.h"
9
- #include <android/log.h>
10
- #include <array>
11
- #include <cmath>
12
- #include <layout/elur_layout_style.h>
13
- #include <unordered_map>
14
- #include <vector>
15
-
16
- #define LOG_TAG "elur-yoga"
17
- #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
18
-
19
- namespace elur {
20
-
21
- namespace {
22
-
23
- struct Entry {
24
- YGNodeRef node;
25
- std::string type;
26
- // Último layout emitido por wire — el DFS re-corre el árbol entero
27
- // cada frame dirty; sin este cache cada flush enviaría ~N ops layout
28
- // (medido: ~30ms/flush con ~2700 nodos, stress 2026-09-11). Emitir
29
- // solo el delta → O(cambio) en vez de O(árbol).
30
- bool emitted = false;
31
- float lastL = 0, lastT = 0, lastW = -1, lastH = -1;
32
- // ADR-0122: nodo con delegado de layout — sus dims auto las fija el
33
- // delegado y los rects de sus hijos llegan vía g_customRects.
34
- bool custom = false;
35
- };
36
-
37
- std::unordered_map<int, Entry> g_nodes;
38
- YGNodeRef g_root = nullptr;
39
- YGConfigRef g_config = nullptr;
40
- JavaVM *g_jvm = nullptr;
41
- jobject g_renderer = nullptr;
42
- jmethodID g_measureMid = nullptr;
43
- jmethodID g_baselineMid = nullptr;
44
- jmethodID g_deferMid = nullptr;
45
- jmethodID g_drainMid = nullptr;
46
- jmethodID g_customMeasureMid = nullptr;
47
- jmethodID g_customLayoutMid = nullptr;
48
- float g_vpW = 0, g_vpH = 0, g_density = 1;
49
- // Dirección ambiente del layout (force_rtl / locale RTL). Los nodos con
50
- // direction:Inherit la heredan desde el root — ADR-0118, mismo rol que
51
- // dir=rtl en <html> en web.
52
- YGDirection g_direction = YGDirectionLTR;
53
- bool g_dirty = false;
54
- bool g_hasViewport = false;
55
- // Hijos text absorbidos por un button (caso label): su nodo queda
56
- // huérfano del árbol — el button es la hoja real que mide. Redirige
57
- // update-text del hijo → dirty del button.
58
- std::unordered_map<int, int> g_absorbedByButton;
59
-
60
- // ADR-0122: rects delegados [l,t,w,h] en unidades lógicas — hijos
61
- // directos de nodos `custom` (su posición la decide el delegado, no
62
- // Yoga). Se reconstruye en cada pasada de layout antes de emitir.
63
- std::unordered_map<int, std::array<float, 4>> g_customRects;
64
-
65
- // ── ADR-0121: árboles Yoga de fila (ElurListView) ───────────────────
66
- // Un árbol por view-holder: la plantilla se registra al inflar y los
67
- // binds de estilo parchean el mismo nodo. El contexto del nodo marca
68
- // fila con el bit 62 para que measureLeaf enrute a measureRowNode en
69
- // vez de al renderer principal.
70
- constexpr int64_t ROW_CTX_MARK = 1LL << 62;
71
-
72
- struct RowTree {
73
- YGNodeRef root;
74
- std::unordered_map<int, YGNodeRef> nodes;
75
- };
76
- std::unordered_map<int, RowTree> g_rowTrees;
77
- int g_nextRowTreeId = 1;
78
- jobject g_rowYoga = nullptr; // singleton ElurRowYoga (global ref)
79
- jmethodID g_rowMeasureMid = nullptr;
80
-
81
- int64_t rowCtx(int treeId, int key) {
82
- return ROW_CTX_MARK | ((int64_t)(treeId & 0x3fffffff) << 32) | (uint32_t)key;
83
- }
84
-
85
- bool isRowContainer(const std::string &type) {
86
- return type == "row" || type == "column" || type == "list";
87
- }
88
-
89
- JNIEnv *getEnv(bool &attached) {
90
- attached = false;
91
- JNIEnv *env = nullptr;
92
- if (g_jvm->GetEnv(reinterpret_cast<void **>(&env), JNI_VERSION_1_6) !=
93
- JNI_OK) {
94
- g_jvm->AttachCurrentThread(&env, nullptr);
95
- attached = true;
96
- }
97
- return env;
98
- }
99
-
100
- // Medida de hojas de fila (contexto marcado ROW_CTX_MARK): delega en
101
- // ElurRowYoga.measureRowNode(treeId, key, w, wMode, h, hMode) — la View
102
- // reciclada real se mide en el mismo thread que CalculateLayout (UI).
103
- bool rowMeasure(int64_t ctx, float w, YGMeasureMode wMode, float h,
104
- YGMeasureMode hMode, YGSize &out) {
105
- if (!g_rowYoga || !g_rowMeasureMid)
106
- return false;
107
- int treeId = static_cast<int>((ctx >> 32) & 0x3fffffff);
108
- int key = static_cast<int>(static_cast<uint32_t>(ctx & 0xffffffff));
109
- bool attached;
110
- JNIEnv *env = getEnv(attached);
111
- jlong packed = env->CallLongMethod(g_rowYoga, g_rowMeasureMid, treeId, key,
112
- w * g_density, static_cast<jint>(wMode),
113
- h * g_density, static_cast<jint>(hMode));
114
- if (env->ExceptionCheck()) {
115
- env->ExceptionClear();
116
- if (attached)
117
- g_jvm->DetachCurrentThread();
118
- return false;
119
- }
120
- if (attached)
121
- g_jvm->DetachCurrentThread();
122
- out.width =
123
- static_cast<float>(static_cast<int32_t>(packed >> 32)) / g_density;
124
- out.height = static_cast<float>(static_cast<int32_t>(packed & 0xffffffffLL)) /
125
- g_density;
126
- return true;
127
- }
128
-
129
- // MeasureFunc de hojas → Kotlin measureNode(id, w, wMode, h, hMode) → long
130
- // (width<<32 | height en bits de int). Corre en el hilo JS durante
131
- // calculateLayout — view.measure() no exige UI thread.
132
- // Yoga 3.x (ADR-0110): el callback recibe YGNodeConstRef.
133
- YGSize measureLeaf(YGNodeConstRef node, float w, YGMeasureMode wMode, float h,
134
- YGMeasureMode hMode) {
135
- int64_t ctx =
136
- static_cast<int64_t>(reinterpret_cast<intptr_t>(YGNodeGetContext(node)));
137
- if (ctx == 0)
138
- return {0, 0};
139
- // ADR-0121: hojas de árbol de fila — su contexto va marcado y mide la
140
- // View reciclada real vía ElurRowYoga.measureRowNode.
141
- if (ctx & ROW_CTX_MARK) {
142
- YGSize out{0, 0};
143
- rowMeasure(ctx, w, wMode, h, hMode, out);
144
- return out;
145
- }
146
- if (!g_renderer || !g_measureMid)
147
- return {0, 0};
148
- int id = static_cast<int>(ctx);
149
-
150
- bool attached;
151
- JNIEnv *env = getEnv(attached);
152
- // ADR-0120: el contrato JNI de medida sigue en px (Android mide px);
153
- // el árbol corre en unidades lógicas — conversión en el borde.
154
- jlong packed = env->CallLongMethod(g_renderer, g_measureMid, id,
155
- w * g_density, static_cast<jint>(wMode),
156
- h * g_density, static_cast<jint>(hMode));
157
- if (env->ExceptionCheck()) {
158
- env->ExceptionClear();
159
- if (attached)
160
- g_jvm->DetachCurrentThread();
161
- return {0, 0};
162
- }
163
- if (attached)
164
- g_jvm->DetachCurrentThread();
165
- YGSize out;
166
- out.width =
167
- static_cast<float>(static_cast<int32_t>(packed >> 32)) / g_density;
168
- out.height = static_cast<float>(static_cast<int32_t>(packed & 0xffffffffLL)) /
169
- g_density;
170
- return out;
171
- }
172
-
173
- // ADR-0122: la medida delegada NO es una measure func de Yoga — 3.2.1
174
- // prohíbe hijos en nodos con measure func (assertFatal). En su lugar el
175
- // nodo custom queda contenedor normal: post-pasada, customMeasure fija
176
- // las dims auto vía SetWidth/Height y customLayout sustituye los rects
177
- // de los hijos (ver yogaLayoutIfDirty).
178
-
179
- // BaselineFunc de hojas → Kotlin baselineNode(id, w, h) — corre en el
180
- // hilo JS durante calculateLayout, igual que measureLeaf. Yoga llama a
181
- // la baseline solo si algún hermano usa align baseline. Fallback h =
182
- // borde inferior, la semántica por defecto de Yoga sin baseline func.
183
- float baselineLeaf(YGNodeConstRef node, float w, float h) {
184
- int64_t ctx =
185
- static_cast<int64_t>(reinterpret_cast<intptr_t>(YGNodeGetContext(node)));
186
- // Las hojas de fila no llevan baseline func (baseline=bottom por
187
- // defecto) — el check es defensivo por si se habilitara.
188
- if (ctx == 0 || (ctx & ROW_CTX_MARK))
189
- return h;
190
- if (!g_renderer || !g_baselineMid)
191
- return h;
192
- int id = static_cast<int>(ctx);
193
- bool attached;
194
- JNIEnv *env = getEnv(attached);
195
- // ADR-0120: w/h llegan en unidades lógicas; baselineNode devuelve px.
196
- jfloat b = env->CallFloatMethod(g_renderer, g_baselineMid, id, w * g_density,
197
- h * g_density);
198
- if (env->ExceptionCheck()) {
199
- env->ExceptionClear();
200
- if (attached)
201
- g_jvm->DetachCurrentThread();
202
- return h;
203
- }
204
- if (attached)
205
- g_jvm->DetachCurrentThread();
206
- return b <= 0 ? h : b / g_density;
207
- }
208
-
209
- bool isLeafType(const std::string &type) {
210
- return type == "text" || type == "image" || type == "text-input" ||
211
- type == "switch" || type == "slider";
212
- }
213
-
214
- void clearPadding(YGNodeRef node) {
215
- for (int e = YGEdgeLeft; e <= YGEdgeAll; e++)
216
- YGNodeStyleSetPadding(node, static_cast<YGEdge>(e), YGUndefined);
217
- }
218
-
219
- // ADR-0118: edges físicos + lógicos (Start/End resuelven por direction
220
- // del nodo — RTL flex) + shorthands Horizontal/Vertical. Sufijos
221
- // "InlineStart"/"InlineEnd" (nombres CSS lógicos) equivalen a Start/End.
222
- bool sameLayout(float a, float b) {
223
- // NaN (nodo aún no medido) debe comparar igual — si no, cada frame
224
- // re-emitiría los nodos sin layout.
225
- return a == b || (a != a && b != b);
226
- }
227
-
228
- // DFS: emite ops layout SOLO de nodos cuyo rect cambió (delta vs el
229
- // último emitido — Entry.emitted/lastL…). Las coords son relativas al
230
- // padre: si el padre se movió, el hijo no re-emite — la View ya viaja
231
- // con él (LayoutParams margins en Kotlin).
232
- void emitLayout(YGNodeRef node, int id, DLBuf &out, int &count) {
233
- float l = YGNodeLayoutGetLeft(node);
234
- float t = YGNodeLayoutGetTop(node);
235
- float w = YGNodeLayoutGetWidth(node);
236
- float h = YGNodeLayoutGetHeight(node);
237
- // ADR-0122: hijo directo de un nodo `custom` — su rect lo decidió
238
- // el delegado, no el flex de la pasada principal.
239
- auto cr = g_customRects.find(id);
240
- if (cr != g_customRects.end()) {
241
- l = cr->second[0];
242
- t = cr->second[1];
243
- w = cr->second[2];
244
- h = cr->second[3];
245
- }
246
- // Contenedores lógicos (list): hijas absolutas no aportan altura al
247
- // padre → Yoga da 0 y View.draw() early-return las haría invisibles.
248
- // FrameLayout sin layout-op wrappea contenido: replicarlo aquí —
249
- // bounds del padre cubren el bbox de sus hijas. ADR-0118: el mismo
250
- // caso aplica a display:contents — Yoga la deja 0x0 y sus hijas
251
- // vienen en coords del abuelo; la View contents a 0,0 expandida al
252
- // bbox deja a las hijas dentro de sus bounds para que HWUI las
253
- // despache (sin la expansión una View 0x0 no dibuja descendientes).
254
- // La View no pinta caja propia: Kotlin omite su background/borde.
255
- const bool needH = h <= 0 && cr == g_customRects.end();
256
- const bool needW = w <= 0 && cr == g_customRects.end();
257
- if (needH || needW) {
258
- for (uint32_t i = 0; i < YGNodeGetChildCount(node); i++) {
259
- YGNodeRef c = YGNodeGetChild(node, i);
260
- if (needH) {
261
- const float cb = YGNodeLayoutGetTop(c) + YGNodeLayoutGetHeight(c);
262
- if (cb > h)
263
- h = cb;
264
- }
265
- if (needW) {
266
- const float cr = YGNodeLayoutGetLeft(c) + YGNodeLayoutGetWidth(c);
267
- if (cr > w)
268
- w = cr;
269
- }
270
- }
271
- }
272
- auto it = g_nodes.find(id);
273
- Entry *e = it != g_nodes.end() ? &it->second : nullptr;
274
- if (!e || !e->emitted || !sameLayout(e->lastL, l) ||
275
- !sameLayout(e->lastT, t) || !sameLayout(e->lastW, w) ||
276
- !sameLayout(e->lastH, h)) {
277
- out.u8(static_cast<uint8_t>(DLOp::Layout));
278
- out.i32(id);
279
- out.f32(l);
280
- out.f32(t);
281
- out.f32(w);
282
- out.f32(h);
283
- count++;
284
- if (e) {
285
- e->emitted = true;
286
- e->lastL = l;
287
- e->lastT = t;
288
- e->lastW = w;
289
- e->lastH = h;
290
- }
291
- }
292
- for (uint32_t i = 0; i < YGNodeGetChildCount(node); i++) {
293
- YGNodeRef child = YGNodeGetChild(node, i);
294
- int cid =
295
- static_cast<int>(reinterpret_cast<intptr_t>(YGNodeGetContext(child)));
296
- emitLayout(child, cid, out, count);
297
- }
298
- }
299
-
300
- // ADR-0122: DFS pre-orden sobre el árbol — ids de nodos con delegado
301
- // de layout (un custom dentro del hijo de otro queda después de su
302
- // ancestro: al procesarlo ya tiene rect delegado).
303
- void collectCustom(YGNodeRef node, std::vector<int> &out) {
304
- int id = static_cast<int>(reinterpret_cast<intptr_t>(YGNodeGetContext(node)));
305
- auto it = g_nodes.find(id);
306
- if (it != g_nodes.end() && it->second.custom)
307
- out.push_back(id);
308
- for (uint32_t i = 0; i < YGNodeGetChildCount(node); i++) {
309
- collectCustom(YGNodeGetChild(node, i), out);
310
- }
311
- }
312
-
313
- } // namespace
314
-
315
- void yogaInit(JavaVM *jvm, jobject renderer) {
316
- g_jvm = jvm;
317
- yogaReset();
318
- bool attached;
319
- JNIEnv *env = getEnv(attached);
320
- if (g_renderer)
321
- env->DeleteGlobalRef(g_renderer);
322
- g_renderer = env->NewGlobalRef(renderer);
323
- jclass cls = env->GetObjectClass(g_renderer);
324
- g_measureMid = env->GetMethodID(cls, "measureNode", "(IFIFI)J");
325
- g_baselineMid = env->GetMethodID(cls, "baselineNode", "(IFF)F");
326
- // Sondas opcionales (defer/drain/ADR-0122): un renderer sin el
327
- // método (ElurSkiaTreeRenderer) deja NoSuchMethodError pendiente y
328
- // la SIGUIENTE llamada JNI aborta — cada sonda limpia al salir.
329
- auto optMid = [&](const char *n, const char *sig) {
330
- jmethodID m = env->GetMethodID(cls, n, sig);
331
- if (env->ExceptionCheck())
332
- env->ExceptionClear();
333
- return m;
334
- };
335
- g_deferMid = optMid("setMeasureDefer", "(Z)V");
336
- g_drainMid = optMid("drainMeasureBatch", "()[I");
337
- // ADR-0122: delegados de layout — dims auto (customMeasure) y rects
338
- // de hijos (customLayout) resueltos por el registro de Kotlin.
339
- g_customMeasureMid = optMid("customMeasure", "(IFF)J");
340
- g_customLayoutMid = optMid("customLayout", "(IFF)[I");
341
- env->DeleteLocalRef(cls);
342
- if (attached)
343
- g_jvm->DetachCurrentThread();
344
-
345
- if (!g_config) {
346
- g_config = YGConfigNew();
347
- // ADR-0110 / decisión de stack §1: errata None explícita — Yoga 3.2
348
- // default ya es W3C-conforme (main activaba MinSizeUndefinedInsteadOfAuto
349
- // |FlexFirstPassUsesRunningTotals); fijarlo explícito blinda el contrato
350
- // si el default upstream cambia.
351
- YGConfigSetErrata(g_config, YGErrataNone);
352
- }
353
- }
354
-
355
- void yogaReset() {
356
- // El container persistente se desarma primero: sus hijos viven en
357
- // g_nodes y se liberan en el loop — un free del padre con hijos
358
- // colgando dejaría refs muertas dentro de g_root.
359
- if (g_root) {
360
- while (YGNodeGetChildCount(g_root) > 0)
361
- YGNodeRemoveChild(g_root, YGNodeGetChild(g_root, 0));
362
- YGNodeFree(g_root);
363
- g_root = nullptr;
364
- }
365
- for (auto &[id, e] : g_nodes)
366
- YGNodeFree(e.node);
367
- g_nodes.clear();
368
- g_absorbedByButton.clear();
369
- g_customRects.clear();
370
- g_root = nullptr;
371
- g_dirty = false;
372
- // ADR-0121: los árboles de fila mueren con el renderer — las listas
373
- // que los poseían quedan destruidas con el resto del árbol.
374
- for (auto &[tid, t] : g_rowTrees) {
375
- for (auto &[key, node] : t.nodes)
376
- YGNodeFree(node);
377
- if (t.root)
378
- YGNodeFree(t.root);
379
- }
380
- g_rowTrees.clear();
381
- if (g_renderer && g_jvm) {
382
- bool attached;
383
- JNIEnv *env = getEnv(attached);
384
- env->DeleteGlobalRef(g_renderer);
385
- g_renderer = nullptr;
386
- if (attached)
387
- g_jvm->DetachCurrentThread();
388
- }
389
- }
390
-
391
- // Métrica del registro real — JsThread-confined (ver elurYoga.h).
392
- int yogaNodeCount() { return static_cast<int>(g_nodes.size()); }
393
-
394
- // Container persistente: modela el ViewGroup del host (parentId 0 del
395
- // wire). Vive fuera de g_nodes — no es direccionable ni borrable por
396
- // stream; solo es padre de las raíces documentales insertadas. Las
397
- // raíces coexisten (swap de documento, overlays) — antes el primer
398
- // nodo creado era la raíz y un segundo árbol nunca entraba al layout.
399
- void ensureRoot() {
400
- if (!g_root)
401
- g_root = g_config ? YGNodeNewWithConfig(g_config) : YGNodeNew();
402
- }
403
-
404
- void yogaCreateNode(int id, const std::string &type) {
405
- YGNodeRef node = YGNodeNewWithConfig(g_config);
406
- if (type == "column")
407
- YGNodeStyleSetFlexDirection(node, YGFlexDirectionColumn);
408
- else if (type == "row")
409
- YGNodeStyleSetFlexDirection(node, YGFlexDirectionRow);
410
- else if (type == "scroll-view")
411
- // ADR-0128: contenedor de scroll — los hijos se miden sin límite en
412
- // el eje principal (mismo efecto que el bloque con overflow:auto web).
413
- YGNodeStyleSetOverflow(node, YGOverflowScroll);
414
- if (isLeafType(type)) {
415
- YGNodeSetMeasureFunc(node, measureLeaf);
416
- YGNodeSetBaselineFunc(node, baselineLeaf);
417
- }
418
- g_nodes[id] = {node, type};
419
- YGNodeSetContext(node, reinterpret_cast<void *>(static_cast<intptr_t>(id)));
420
- ensureRoot();
421
- g_dirty = true;
422
- }
423
-
424
- void yogaInsertChild(int parentId, int childId, int index) {
425
- auto c = g_nodes.find(childId);
426
- if (c == g_nodes.end())
427
- return;
428
- // parentId 0 = container del host: en el mirror es g_root, el nodo
429
- // persistente creado en yogaInit. Antes la raíz era "el primer nodo
430
- // creado" y este insert era no-op — un segundo mount (swap de
431
- // documento SDUI) quedaba fuera del árbol de layout: vistas creadas
432
- // sin rect, invisibles.
433
- YGNodeRef parent = nullptr;
434
- if (parentId == 0) {
435
- ensureRoot();
436
- parent = g_root;
437
- } else {
438
- auto p = g_nodes.find(parentId);
439
- if (p == g_nodes.end())
440
- return;
441
- // button absorbe el hijo text como label (mismo caso que Kotlin):
442
- // no entra al árbol; el padre pasa a medirse como hoja.
443
- if (p->second.type == "button") {
444
- YGNodeSetMeasureFunc(p->second.node, measureLeaf);
445
- YGNodeSetBaselineFunc(p->second.node, baselineLeaf);
446
- g_absorbedByButton[childId] = parentId;
447
- // Pasa a hoja medida: el padding que llegó antes vive ya en la View.
448
- clearPadding(p->second.node);
449
- return;
450
- }
451
- parent = p->second.node;
452
- }
453
- // Re-parenting/reorder: el reconciler puede re-insertar un hijo ya
454
- // montado (popPreview del swipe-back, move-child). YGNodeInsertChild
455
- // aborta si el hijo ya tiene owner → detach primero.
456
- if (YGNodeRef owner = YGNodeGetOwner(c->second.node)) {
457
- YGNodeRemoveChild(owner, c->second.node);
458
- }
459
- uint32_t count = YGNodeGetChildCount(parent);
460
- YGNodeInsertChild(parent, c->second.node,
461
- static_cast<uint32_t>(index) > count
462
- ? count
463
- : static_cast<uint32_t>(index));
464
- g_dirty = true;
465
- }
466
-
467
- void yogaRemoveChild(int parentId, int childId) {
468
- auto c = g_nodes.find(childId);
469
- if (c == g_nodes.end())
470
- return;
471
- // Hijo absorbido: nunca se insertó en el árbol — solo limpiar la
472
- // redirección o un markLeafDirty futuro caería en el padre equivocado.
473
- auto absorbed = g_absorbedByButton.find(childId);
474
- if (absorbed != g_absorbedByButton.end() && absorbed->second == parentId) {
475
- g_absorbedByButton.erase(absorbed);
476
- auto p = g_nodes.find(parentId);
477
- if (p != g_nodes.end() && YGNodeHasMeasureFunc(p->second.node))
478
- YGNodeMarkDirty(p->second.node);
479
- g_dirty = true;
480
- return;
481
- }
482
- YGNodeRef parent;
483
- if (parentId == 0) {
484
- if (!g_root)
485
- return;
486
- parent = g_root;
487
- } else {
488
- auto p = g_nodes.find(parentId);
489
- if (p == g_nodes.end())
490
- return;
491
- parent = p->second.node;
492
- }
493
- YGNodeRemoveChild(parent, c->second.node);
494
- g_dirty = true;
495
- }
496
-
497
- void yogaMoveChild(int parentId, int childId, int index) {
498
- yogaRemoveChild(parentId, childId);
499
- yogaInsertChild(parentId, childId, index);
500
- }
501
-
502
- // Re-medida post-apply: Kotlin llama tras aplicar update-text/props.
503
- // YGNodeMarkDirty solo aplica a nodos con measureFunc — el check es por
504
- // la función real, no por el tipo: el reconciler recicla ids y el set
505
- // `measuredIds` de Kotlin puede apuntar a un nodo recreado de otro tipo
506
- // (un button sin hijo absorbido no tiene measureFunc — aborta Yoga).
507
- void yogaMarkLeafDirty(int id) {
508
- // Texto absorbido por un button → la hoja real es el button.
509
- auto redir = g_absorbedByButton.find(id);
510
- if (redir != g_absorbedByButton.end())
511
- id = redir->second;
512
- auto it = g_nodes.find(id);
513
- if (it == g_nodes.end())
514
- return;
515
- // ADR-0122: contenedor con delegado — MarkDirty solo sirve en
516
- // measure-funcs; basta re-correr la pasada (los delegados vuelven
517
- // a resolver en collectCustom).
518
- if (it->second.custom) {
519
- g_dirty = true;
520
- return;
521
- }
522
- if (YGNodeHasMeasureFunc(it->second.node)) {
523
- YGNodeMarkDirty(it->second.node);
524
- g_dirty = true;
525
- }
526
- }
527
-
528
- void yogaDeleteNode(int id) {
529
- auto it = g_nodes.find(id);
530
- if (it == g_nodes.end())
531
- return;
532
- YGNodeRef node = it->second.node;
533
- if (YGNodeRef owner = YGNodeGetOwner(node))
534
- YGNodeRemoveChild(owner, node);
535
- // destroy libera el nodo (detach no). Hijos: detach primero, luego free.
536
- while (YGNodeGetChildCount(node) > 0) {
537
- YGNodeRemoveChild(node, YGNodeGetChild(node, 0));
538
- }
539
- YGNodeFree(node);
540
- g_nodes.erase(it);
541
- g_absorbedByButton.erase(id);
542
- g_customRects.erase(id);
543
- // Si el borrado es un Button padre, sus hijos absorbidos quedan huérfanos
544
- // de redirección — purgar los que apuntaban a él.
545
- for (auto ab = g_absorbedByButton.begin(); ab != g_absorbedByButton.end();) {
546
- ab = (ab->second == id) ? g_absorbedByButton.erase(ab) : std::next(ab);
547
- }
548
- g_dirty = true;
549
- }
550
-
551
- // ADR-0122: marca un nodo con delegado de layout. No instala measure
552
- // func — Yoga 3.2.1 prohíbe hijos en nodos con measure (assertFatal);
553
- // el delegado se resuelve post-pasada en yogaLayoutIfDirty.
554
- void yogaSetCustomLayout(int id, bool on) {
555
- auto it = g_nodes.find(id);
556
- if (it == g_nodes.end())
557
- return;
558
- Entry &e = it->second;
559
- if (e.custom == on)
560
- return;
561
- e.custom = on;
562
- g_dirty = true;
563
- }
564
-
565
- // ADR-0122: re-medida de un hijo al ancho/alto que el delegado ofrece —
566
- // corre CalculateLayout standalone de su subárbol (adjunto: re-deriva
567
- // sus coords internas al ancho del delegado; su rect propio lo sustituye
568
- // g_customRects). h<0 = YGUndefined. Devuelve el tamaño en px.
569
- bool yogaMeasureChild(int id, float wPx, float hPx, float out[2]) {
570
- auto it = g_nodes.find(id);
571
- if (it == g_nodes.end())
572
- return false;
573
- YGNodeRef n = it->second.node;
574
- YGNodeCalculateLayout(n, wPx / g_density,
575
- hPx >= 0 ? hPx / g_density : YGUndefined, g_direction);
576
- out[0] = YGNodeLayoutGetWidth(n) * g_density;
577
- out[1] = YGNodeLayoutGetHeight(n) * g_density;
578
- return true;
579
- }
580
-
581
- void yogaSetStyle(int id, const std::string &key, double num,
582
- const std::string &str, bool isNum) {
583
- auto it = g_nodes.find(id);
584
- if (it == g_nodes.end())
585
- return;
586
- // ADR-0122: `layout` activa el delegado del nodo — va por el canal
587
- // de estilo (JsThread) porque el árbol es JsThread-confined.
588
- if (key == "layout") {
589
- yogaSetCustomLayout(id, !str.empty());
590
- return;
591
- }
592
- // Hoja medida: el padding lo lleva la View (Kotlin applyLeafPadding) y
593
- // la medida de texto ya lo incluye — aplicarlo también aquí lo contaría
594
- // dos veces en la caja.
595
- if (key.rfind("padding", 0) == 0 && YGNodeHasMeasureFunc(it->second.node))
596
- return;
597
- if (elur::layout::applyStyleProp(it->second.node, key, num, str, isNum))
598
- g_dirty = true;
599
- }
600
-
601
- // ── ADR-0121: API pública de los árboles de fila — el estado vive en
602
- // el namespace anónimo junto a ROW_CTX_MARK (ver arriba). Los rects se
603
- // devuelven en px (la conversión vive aquí — Kotlin solo posiciona).
604
- int yogaRowTreeCreate(JNIEnv *env, jobject rowYoga) {
605
- if (!g_rowYoga) {
606
- g_rowYoga = env->NewGlobalRef(rowYoga);
607
- jclass cls = env->GetObjectClass(rowYoga);
608
- g_rowMeasureMid = env->GetMethodID(cls, "measureRowNode", "(IIFIFI)J");
609
- env->DeleteLocalRef(cls);
610
- }
611
- int id = g_nextRowTreeId++;
612
- RowTree t;
613
- t.root = g_config ? YGNodeNewWithConfig(g_config) : YGNodeNew();
614
- g_rowTrees[id] = t;
615
- return id;
616
- }
617
-
618
- void yogaRowNode(int treeId, int key, int parentKey, const std::string &type) {
619
- auto t = g_rowTrees.find(treeId);
620
- if (t == g_rowTrees.end())
621
- return;
622
- YGNodeRef n = g_config ? YGNodeNewWithConfig(g_config) : YGNodeNew();
623
- t->second.nodes[key] = n;
624
- // La dirección por defecto viene del tipo, igual que en yogaCreateNode
625
- // del árbol principal — un flexDirection de estilo la sobrescribe.
626
- if (type == "column")
627
- YGNodeStyleSetFlexDirection(n, YGFlexDirectionColumn);
628
- else if (type == "row")
629
- YGNodeStyleSetFlexDirection(n, YGFlexDirectionRow);
630
- // Hojas: medida intrínseca vía measureRowNode (la View real). El
631
- // contexto marcado enruta measureLeaf al mid de fila. Sin baseline
632
- // func en filas — Yoga aplica baseline=bottom por defecto.
633
- if (!isRowContainer(type)) {
634
- YGNodeSetMeasureFunc(n, measureLeaf);
635
- YGNodeSetContext(n, reinterpret_cast<void *>(
636
- static_cast<intptr_t>(rowCtx(treeId, key))));
637
- }
638
- YGNodeRef parent = parentKey == 0 ? t->second.root
639
- : t->second.nodes.count(parentKey)
640
- ? t->second.nodes[parentKey]
641
- : t->second.root;
642
- YGNodeInsertChild(parent, n, YGNodeGetChildCount(parent));
643
- }
644
-
645
- void yogaRowStyle(int treeId, int key, const std::string &name, bool isNum,
646
- double num, const std::string &str) {
647
- auto t = g_rowTrees.find(treeId);
648
- if (t == g_rowTrees.end())
649
- return;
650
- auto n = t->second.nodes.find(key);
651
- if (n == t->second.nodes.end())
652
- return;
653
- // ADR-0122: los delegados no aplican dentro de filas (la medida
654
- // delegada es del árbol principal) — `layout` se ignora aquí.
655
- if (name == "layout")
656
- return;
657
- if (name.rfind("padding", 0) == 0 && YGNodeHasMeasureFunc(n->second))
658
- return;
659
- elur::layout::applyStyleProp(n->second, name, num, str, isNum);
660
- }
661
-
662
- // Reset de una propiedad bound: el campo resolvió a null → Undefined
663
- // (o su default numérico/enum). Cobertura = keys de layout que pueden
664
- // venir por bind; el resto no se resetea porque nunca llegó por esta
665
- // vía.
666
- void yogaRowStyleReset(int treeId, int key, const std::string &name) {
667
- auto t = g_rowTrees.find(treeId);
668
- if (t == g_rowTrees.end())
669
- return;
670
- auto n = t->second.nodes.find(key);
671
- if (n == t->second.nodes.end())
672
- return;
673
- YGNodeRef node = n->second;
674
- if (name == "width")
675
- YGNodeStyleSetWidth(node, YGUndefined);
676
- else if (name == "height")
677
- YGNodeStyleSetHeight(node, YGUndefined);
678
- else if (name == "minWidth")
679
- YGNodeStyleSetMinWidth(node, YGUndefined);
680
- else if (name == "minHeight")
681
- YGNodeStyleSetMinHeight(node, YGUndefined);
682
- else if (name == "maxWidth")
683
- YGNodeStyleSetMaxWidth(node, YGUndefined);
684
- else if (name == "maxHeight")
685
- YGNodeStyleSetMaxHeight(node, YGUndefined);
686
- else if (name == "flexGrow")
687
- YGNodeStyleSetFlexGrow(node, 0);
688
- else if (name == "flexShrink")
689
- YGNodeStyleSetFlexShrink(node, 0);
690
- else if (name == "aspectRatio")
691
- YGNodeStyleSetAspectRatio(node, YGUndefined);
692
- else if (name.rfind("margin", 0) == 0)
693
- YGNodeStyleSetMargin(node, elur::layout::edgeOf(name.substr(6)),
694
- YGUndefined);
695
- else if (name.rfind("padding", 0) == 0)
696
- YGNodeStyleSetPadding(node, elur::layout::edgeOf(name.substr(7)),
697
- YGUndefined);
698
- else if (name == "gap" || name == "rowGap" || name == "columnGap")
699
- YGNodeStyleSetGap(node, YGGutterAll, YGUndefined);
700
- else if (name == "position")
701
- YGNodeStyleSetPositionType(node, YGPositionTypeRelative);
702
- else if (name.rfind("inset", 0) == 0 || name == "left" || name == "top" ||
703
- name == "right" || name == "bottom" || name == "start" ||
704
- name == "end")
705
- YGNodeStyleSetPosition(node, elur::layout::edgeOf(name.substr(5)),
706
- YGUndefined);
707
- }
708
-
709
- jintArray yogaRowLayout(JNIEnv *env, int treeId, float wPx, bool forceWidth) {
710
- auto t = g_rowTrees.find(treeId);
711
- if (t == g_rowTrees.end())
712
- return nullptr;
713
- // ADR-0121 — el ancho raíz solo se fuerza con spec EXACTLY (fila
714
- // MATCH_PARENT). Con AT_MOST/UNSPECIFIED (WRAP_CONTENT horizontal) el
715
- // ancho lo decide el estilo del template; wPx<0 = ancho libre.
716
- const float wLogical = wPx >= 0 ? wPx / g_density : YGUndefined;
717
- if (forceWidth)
718
- YGNodeStyleSetWidth(t->second.root, wLogical);
719
- YGNodeCalculateLayout(t->second.root, wLogical, YGUndefined, g_direction);
720
- // [key, l, t, w, h] en px — mismo rounding que applyLayout (ADR-0120).
721
- jintArray out = env->NewIntArray(t->second.nodes.size() * 5);
722
- std::vector<jint> buf;
723
- buf.reserve(t->second.nodes.size() * 5);
724
- for (auto &[key, node] : t->second.nodes) {
725
- buf.push_back(key);
726
- buf.push_back(
727
- static_cast<jint>(lroundf(YGNodeLayoutGetLeft(node) * g_density)));
728
- buf.push_back(
729
- static_cast<jint>(lroundf(YGNodeLayoutGetTop(node) * g_density)));
730
- buf.push_back(
731
- static_cast<jint>(lroundf(YGNodeLayoutGetWidth(node) * g_density)));
732
- buf.push_back(
733
- static_cast<jint>(lroundf(YGNodeLayoutGetHeight(node) * g_density)));
734
- }
735
- env->SetIntArrayRegion(out, 0, buf.size(), buf.data());
736
- return out;
737
- }
738
-
739
- void yogaRowFree(int treeId) {
740
- auto t = g_rowTrees.find(treeId);
741
- if (t == g_rowTrees.end())
742
- return;
743
- for (auto &[key, node] : t->second.nodes)
744
- YGNodeFree(node);
745
- if (t->second.root)
746
- YGNodeFree(t->second.root);
747
- g_rowTrees.erase(t);
748
- }
749
-
750
- void yogaSetViewport(float w, float h, float density, bool rtl) {
751
- // ADR-0120: el viewport entra en px físicos; el árbol corre en
752
- // unidades lógicas (px/density) y PointScaleFactor redondea el
753
- // resultado al grid de px en el borde absoluto de cada nodo.
754
- g_density = density > 0 ? density : 1;
755
- g_vpW = w / g_density;
756
- g_vpH = h / g_density;
757
- // RTL ambiente: el parámetro direction de CalculateLayout resuelve los
758
- // nodos con direction:Inherit — el equivalente de dir=rtl en <html>.
759
- g_direction = rtl ? YGDirectionRTL : YGDirectionLTR;
760
- if (g_config)
761
- YGConfigSetPointScaleFactor(g_config, g_density);
762
- g_hasViewport = true;
763
- g_dirty = true;
764
- // resize del viewport: la app puede no tener ops pendientes —
765
- // el árbol es nativo, emitimos el frame de layout directo.
766
- yogaFlushLayoutFrame(0);
767
- }
768
-
769
- int yogaLayoutIfDirty(DLBuf &out) {
770
- if (!g_dirty || !g_hasViewport || !g_root)
771
- return 0;
772
- g_dirty = false;
773
- YGNodeStyleSetWidth(g_root, g_vpW);
774
- YGNodeStyleSetHeight(g_root, g_vpH);
775
- // Las raíces documentales (hijas del container) llenan el viewport —
776
- // mismo forzado que antes se hacía sobre el único root: un segundo
777
- // mount coexistiendo (swap SDUI/overlay) recibe el mismo tamaño.
778
- for (uint32_t i = 0; i < YGNodeGetChildCount(g_root); i++) {
779
- YGNodeRef child = YGNodeGetChild(g_root, i);
780
- YGNodeStyleSetWidth(child, g_vpW);
781
- YGNodeStyleSetHeight(child, g_vpH);
782
- }
783
- // R4.3/ADR-0085: medición agrupada — rondas collect→drain→re-dirty.
784
- // En la pasada collect measureNode encola lo no cacheado y devuelve
785
- // la última medida sin bloquear; drainMeasureBatch mide el lote en
786
- // main (un latch por pasada, no uno por hoja) y devuelve los ids
787
- // resueltos → se re-marcan dirty y el layout recorre con medidas
788
- // exactas. Converge cuando una pasada no pide nada nuevo; cota 3
789
- // rondas + pasada final sin defer (latch por hoja) para residuales.
790
- bool attached = false;
791
- JNIEnv *env = g_renderer ? getEnv(attached) : nullptr;
792
- bool needFinal = false;
793
- if (env && g_deferMid && g_drainMid) {
794
- for (int round = 0; round < 3; round++) {
795
- env->CallVoidMethod(g_renderer, g_deferMid, JNI_TRUE);
796
- YGNodeCalculateLayout(g_root, g_vpW, g_vpH, g_direction);
797
- jobject idsObj = env->CallObjectMethod(g_renderer, g_drainMid);
798
- env->CallVoidMethod(g_renderer, g_deferMid, JNI_FALSE);
799
- if (env->ExceptionCheck()) {
800
- env->ExceptionClear();
801
- needFinal = true;
802
- if (idsObj)
803
- env->DeleteLocalRef(idsObj);
804
- break;
805
- }
806
- if (!idsObj) { // drain falló (post/timeout) → pasada bloqueante
807
- needFinal = true;
808
- break;
809
- }
810
- jintArray ids = static_cast<jintArray>(idsObj);
811
- jsize n = env->GetArrayLength(ids);
812
- if (n == 0) { // convergió — las medidas exactas ya están en cache
813
- env->DeleteLocalRef(idsObj);
814
- break;
815
- }
816
- jint *elems = env->GetIntArrayElements(ids, nullptr);
817
- for (jsize i = 0; i < n; i++) {
818
- auto it = g_nodes.find(elems[i]);
819
- if (it != g_nodes.end() && YGNodeHasMeasureFunc(it->second.node))
820
- YGNodeMarkDirty(it->second.node);
821
- }
822
- env->ReleaseIntArrayElements(ids, elems, JNI_ABORT);
823
- env->DeleteLocalRef(idsObj);
824
- if (round == 2)
825
- needFinal = true;
826
- }
827
- if (needFinal)
828
- YGNodeCalculateLayout(g_root, g_vpW, g_vpH, g_direction);
829
- } else {
830
- YGNodeCalculateLayout(g_root, g_vpW, g_vpH, g_direction);
831
- }
832
- if (attached)
833
- g_jvm->DetachCurrentThread();
834
- // ADR-0122: nodos `custom` — dos fases post-pasada.
835
- // A) medida: el delegado responde customMeasure(w,h computados) y las
836
- // dims cuyo estilo es auto se fijan con SetWidth/Height → un
837
- // recálculo las materializa. Se salta si el padre también es
838
- // custom: entonces su rect lo decide el delegado del padre.
839
- // B) rects: customLayout devuelve los rects de los hijos
840
- // (measureChild dentro corre el CalculateLayout del subárbol).
841
- // DFS pre-orden ⇒ un custom anidado dentro del hijo de otro ya
842
- // tiene su rect en g_customRects cuando le toca.
843
- g_customRects.clear();
844
- {
845
- std::vector<int> customIds;
846
- collectCustom(g_root, customIds);
847
- if (!customIds.empty()) {
848
- bool envAttached = false;
849
- JNIEnv *env = g_renderer ? getEnv(envAttached) : nullptr;
850
- // Fase A — dims auto las decide el delegado.
851
- bool dimsChanged = false;
852
- for (int id : customIds) {
853
- auto it = g_nodes.find(id);
854
- if (it == g_nodes.end())
855
- continue;
856
- YGNodeRef node = it->second.node;
857
- if (YGNodeRef owner = YGNodeGetOwner(node)) {
858
- int oid = static_cast<int>(
859
- reinterpret_cast<intptr_t>(YGNodeGetContext(owner)));
860
- auto oe = g_nodes.find(oid);
861
- if (oe != g_nodes.end() && oe->second.custom)
862
- continue; // el delegado del padre decide su rect
863
- }
864
- if (!env || !g_customMeasureMid)
865
- break;
866
- jlong packed =
867
- env->CallLongMethod(g_renderer, g_customMeasureMid, id,
868
- YGNodeLayoutGetWidth(node) * g_density,
869
- YGNodeLayoutGetHeight(node) * g_density);
870
- if (env->ExceptionCheck()) {
871
- env->ExceptionClear();
872
- break;
873
- }
874
- const float mw =
875
- static_cast<float>(static_cast<int32_t>(packed >> 32)) / g_density;
876
- const float mh =
877
- static_cast<float>(static_cast<int32_t>(packed & 0xffffffffLL)) /
878
- g_density;
879
- const auto sw = YGNodeStyleGetWidth(node);
880
- const auto sh = YGNodeStyleGetHeight(node);
881
- if ((sw.unit == YGUnitUndefined || sw.unit == YGUnitAuto) && mw > 0 &&
882
- mw != sw.value) {
883
- YGNodeStyleSetWidth(node, mw);
884
- dimsChanged = true;
885
- }
886
- if ((sh.unit == YGUnitUndefined || sh.unit == YGUnitAuto) && mh > 0 &&
887
- mh != sh.value) {
888
- YGNodeStyleSetHeight(node, mh);
889
- dimsChanged = true;
890
- }
891
- }
892
- if (dimsChanged)
893
- YGNodeCalculateLayout(g_root, g_vpW, g_vpH, g_direction);
894
- // Fase B — rects de hijos directos por delegado.
895
- for (int id : customIds) {
896
- auto it = g_nodes.find(id);
897
- if (it == g_nodes.end())
898
- continue;
899
- float wLog, hLog;
900
- auto cr = g_customRects.find(id);
901
- if (cr != g_customRects.end()) {
902
- wLog = cr->second[2];
903
- hLog = cr->second[3];
904
- } else {
905
- wLog = YGNodeLayoutGetWidth(it->second.node);
906
- hLog = YGNodeLayoutGetHeight(it->second.node);
907
- }
908
- if (!env || !g_customLayoutMid)
909
- break;
910
- jobject res = env->CallObjectMethod(g_renderer, g_customLayoutMid, id,
911
- wLog * g_density, hLog * g_density);
912
- if (env->ExceptionCheck()) {
913
- env->ExceptionClear();
914
- break;
915
- }
916
- if (!res)
917
- continue;
918
- jintArray flat = static_cast<jintArray>(res);
919
- jsize n = env->GetArrayLength(flat);
920
- jint *elems = env->GetIntArrayElements(flat, nullptr);
921
- for (jsize i = 0; i + 4 < n; i += 5) {
922
- g_customRects[elems[i]] = {
923
- elems[i + 1] / g_density, elems[i + 2] / g_density,
924
- elems[i + 3] / g_density, elems[i + 4] / g_density};
925
- }
926
- env->ReleaseIntArrayElements(flat, elems, JNI_ABORT);
927
- env->DeleteLocalRef(res);
928
- }
929
- if (envAttached)
930
- g_jvm->DetachCurrentThread();
931
- }
932
- }
933
- int count = 0;
934
- for (uint32_t i = 0; i < YGNodeGetChildCount(g_root); i++) {
935
- YGNodeRef child = YGNodeGetChild(g_root, i);
936
- int cid =
937
- static_cast<int>(reinterpret_cast<intptr_t>(YGNodeGetContext(child)));
938
- emitLayout(child, cid, out, count);
939
- }
940
- return count;
941
- }
942
-
943
- void yogaFlushLayoutFrame(int reqSeq) {
944
- if (!g_dirty)
945
- return;
946
- DLBuf w;
947
- int layoutOps = yogaLayoutIfDirty(w);
948
- if (layoutOps == 0)
949
- return;
950
- // V12 + R4.4/ADR-0085: id negativo monotónico — frame host-initiated,
951
- // distinguible de los commits JS (positivos): el renderer los aplica
952
- // pero nunca los ack-ea. reqSeq > 0: la respuesta lleva -reqSeq y
953
- // queda ligada al requestLeafRemeasure que la originó (el renderer
954
- // descarta respuestas con seq superado = geometría de contenido ya
955
- // obsoleto). reqSeq <= 0: sin request (resize) — contador interno
956
- // con base 1e6 para no colisionar con los seq del renderer.
957
- static int g_internalLayoutSeq = 0;
958
- const int seq = reqSeq > 0 ? reqSeq : (1000000 + ++g_internalLayoutSeq);
959
- DLBuf frame;
960
- frame.header(-seq, layoutOps);
961
- frame.bytes.insert(frame.bytes.end(), w.bytes.begin(), w.bytes.end());
962
-
963
- if (!g_renderer)
964
- return;
965
- bool attached;
966
- JNIEnv *env = getEnv(attached);
967
- jclass cls = env->GetObjectClass(g_renderer);
968
- jmethodID mid = env->GetMethodID(cls, "applyDisplayListBinary", "([B)V");
969
- if (mid) {
970
- jbyteArray jarr = env->NewByteArray(frame.bytes.size());
971
- env->SetByteArrayRegion(
972
- jarr, 0, frame.bytes.size(),
973
- reinterpret_cast<const jbyte *>(frame.bytes.data()));
974
- env->CallVoidMethod(g_renderer, mid, jarr);
975
- env->DeleteLocalRef(jarr);
976
- }
977
- env->DeleteLocalRef(cls);
978
- if (attached)
979
- g_jvm->DetachCurrentThread();
980
- }
981
-
982
- } // namespace elur
983
-
984
- // ── ADR-0121: exports JNI de árboles de fila ────────────────────────
985
- // Los símbolos viven en ambas variantes del bridge (elurYoga.cpp se
986
- // compila en elur-bridge y elur-bridge-hermes): ElurRowYoga no carga
987
- // librería propia — los nombres se resuelven contra la lib del engine
988
- // activo, ya cargada antes de que exista ninguna lista.
989
- extern "C" JNIEXPORT jint JNICALL
990
- Java_com_elur_universal_ElurRowYoga_nativeTreeCreate(JNIEnv *env,
991
- jobject thiz) {
992
- return elur::yogaRowTreeCreate(env, thiz);
993
- }
994
-
995
- extern "C" JNIEXPORT void JNICALL
996
- Java_com_elur_universal_ElurRowYoga_nativeRowNode(JNIEnv *env, jobject thiz,
997
- jint treeId, jint key,
998
- jint parentKey,
999
- jstring type) {
1000
- const char *c = env->GetStringUTFChars(type, nullptr);
1001
- elur::yogaRowNode(treeId, key, parentKey, c ? c : "");
1002
- if (c)
1003
- env->ReleaseStringUTFChars(type, c);
1004
- }
1005
-
1006
- extern "C" JNIEXPORT void JNICALL
1007
- Java_com_elur_universal_ElurRowYoga_nativeRowStyle(JNIEnv *env, jobject thiz,
1008
- jint treeId, jint key,
1009
- jstring name, jboolean isNum,
1010
- jdouble num, jstring str) {
1011
- const char *n = env->GetStringUTFChars(name, nullptr);
1012
- const char *s = str ? env->GetStringUTFChars(str, nullptr) : nullptr;
1013
- elur::yogaRowStyle(treeId, key, n ? n : "", isNum, num, s ? s : "");
1014
- if (n)
1015
- env->ReleaseStringUTFChars(name, n);
1016
- if (s)
1017
- env->ReleaseStringUTFChars(str, s);
1018
- }
1019
-
1020
- extern "C" JNIEXPORT void JNICALL
1021
- Java_com_elur_universal_ElurRowYoga_nativeRowStyleReset(JNIEnv *env,
1022
- jobject thiz,
1023
- jint treeId, jint key,
1024
- jstring name) {
1025
- const char *n = env->GetStringUTFChars(name, nullptr);
1026
- elur::yogaRowStyleReset(treeId, key, n ? n : "");
1027
- if (n)
1028
- env->ReleaseStringUTFChars(name, n);
1029
- }
1030
-
1031
- extern "C" JNIEXPORT jintArray JNICALL
1032
- Java_com_elur_universal_ElurRowYoga_nativeRowLayout(JNIEnv *env, jobject thiz,
1033
- jint treeId, jfloat wPx,
1034
- jboolean forceWidth) {
1035
- return elur::yogaRowLayout(env, treeId, wPx, forceWidth == JNI_TRUE);
1036
- }
1037
-
1038
- extern "C" JNIEXPORT void JNICALL
1039
- Java_com_elur_universal_ElurRowYoga_nativeRowFree(JNIEnv *env, jobject thiz,
1040
- jint treeId) {
1041
- elur::yogaRowFree(treeId);
1042
- }
1043
-
1044
- // ── ADR-0122: delegados de layout por subárbol ──────────────────────
1045
- // Mismo patrón que ElurRowYoga: símbolos en ambas variantes del bridge,
1046
- // resolución lazy contra la lib del engine activo.
1047
- extern "C" JNIEXPORT jintArray JNICALL
1048
- Java_com_elur_universal_ElurCustomLayout_nativeMeasureChild(JNIEnv *env,
1049
- jobject thiz,
1050
- jint id, jfloat wPx,
1051
- jfloat hPx) {
1052
- float out[2];
1053
- if (!elur::yogaMeasureChild(id, wPx, hPx, out))
1054
- return nullptr;
1055
- jintArray r = env->NewIntArray(2);
1056
- jint buf[2] = {static_cast<jint>(lroundf(out[0])),
1057
- static_cast<jint>(lroundf(out[1]))};
1058
- env->SetIntArrayRegion(r, 0, 2, buf);
1059
- return r;
1060
- }