ranger-compiler 3.5.0 → 3.5.2

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 (338) hide show
  1. package/CHANGELOG.md +1160 -19
  2. package/LICENSE +3 -1
  3. package/README.md +124 -29
  4. package/dist/Lang.rgr +1188 -290
  5. package/dist/api.d.ts +2343 -879
  6. package/dist/api.js +79924 -56922
  7. package/dist/lib/JSON.rgr +102 -91
  8. package/dist/lib/Shell.rgr +4 -4
  9. package/dist/lib/apple/AppleToolchain.rgr +4 -4
  10. package/dist/lib/apple/README.md +5 -4
  11. package/dist/lib/apple/apple_test.rgr +1 -1
  12. package/dist/lib/core/README.md +1 -1
  13. package/dist/lib/evg/EVG.rgr +12 -0
  14. package/dist/lib/evg/EVGA11yFromTree.rgr +302 -0
  15. package/dist/lib/evg/EVGA11yTree.rgr +894 -0
  16. package/dist/lib/evg/EVGBox.rgr +267 -0
  17. package/dist/lib/evg/EVGBoxShorthandTest.rgr +220 -0
  18. package/dist/lib/evg/EVGCodepoint.rgr +316 -0
  19. package/dist/lib/evg/EVGColor.rgr +700 -0
  20. package/dist/lib/evg/EVGCommands.rgr +177 -0
  21. package/dist/lib/evg/EVGComponent.rgr +331 -0
  22. package/dist/lib/evg/EVGComponentTest.rgr +387 -0
  23. package/dist/lib/evg/EVGConnector.rgr +541 -0
  24. package/dist/lib/evg/EVGConnectorTest.rgr +306 -0
  25. package/dist/lib/evg/EVGDisplayList.rgr +4186 -0
  26. package/dist/lib/evg/EVGEasing.rgr +370 -0
  27. package/dist/lib/evg/EVGEffectTest.rgr +253 -0
  28. package/dist/lib/evg/EVGElement.rgr +4914 -0
  29. package/dist/lib/evg/EVGFixedTest.rgr +289 -0
  30. package/dist/lib/evg/EVGFlexRulesTest.rgr +317 -0
  31. package/dist/lib/evg/EVGFlexWrapTest.rgr +246 -0
  32. package/dist/lib/evg/EVGFling.rgr +244 -0
  33. package/dist/lib/evg/EVGFocus.rgr +400 -0
  34. package/dist/lib/evg/EVGFocusTest.rgr +399 -0
  35. package/dist/lib/evg/EVGGradient.rgr +322 -0
  36. package/dist/lib/evg/EVGGrapheme.rgr +190 -0
  37. package/dist/lib/evg/EVGGrid.rgr +975 -0
  38. package/dist/lib/evg/EVGHitTest.rgr +208 -0
  39. package/dist/lib/evg/EVGHoles.rgr +294 -0
  40. package/dist/lib/evg/EVGHostMeasurerTest.rgr +281 -0
  41. package/dist/lib/evg/EVGHostTextMeasurer.rgr +331 -0
  42. package/dist/lib/evg/EVGHostTree.rgr +834 -0
  43. package/dist/lib/evg/EVGHostTreeTest.rgr +447 -0
  44. package/dist/lib/evg/EVGImageDecode.rgr +117 -0
  45. package/dist/lib/evg/EVGImageMeasurer.rgr +86 -0
  46. package/dist/lib/evg/EVGInspect.rgr +883 -0
  47. package/dist/lib/evg/EVGInvalidateTest.rgr +432 -0
  48. package/dist/lib/evg/EVGJsonTest.rgr +535 -0
  49. package/dist/lib/evg/EVGLayout.rgr +4220 -0
  50. package/dist/lib/evg/EVGMeasure.rgr +1267 -0
  51. package/dist/lib/evg/EVGOverlayTest.rgr +626 -0
  52. package/dist/lib/evg/EVGPatch.rgr +1721 -0
  53. package/dist/lib/evg/EVGPatchTest.rgr +692 -0
  54. package/dist/lib/evg/EVGPopoverTest.rgr +395 -0
  55. package/dist/lib/evg/EVGReconcile.rgr +226 -0
  56. package/dist/lib/evg/EVGReconcileTest.rgr +421 -0
  57. package/dist/lib/evg/EVGReject.rgr +126 -0
  58. package/dist/lib/evg/EVGRelayoutTest.rgr +375 -0
  59. package/dist/lib/evg/EVGRtlLayoutTest.rgr +319 -0
  60. package/dist/lib/evg/EVGRuler.rgr +232 -0
  61. package/dist/lib/evg/EVGRulerTest.rgr +172 -0
  62. package/dist/lib/evg/EVGSelectChrome.rgr +178 -0
  63. package/dist/lib/evg/EVGStyleCacheTest.rgr +419 -0
  64. package/dist/lib/evg/EVGStyleSheet.rgr +2148 -0
  65. package/dist/lib/evg/EVGStyleStateTest.rgr +407 -0
  66. package/dist/lib/evg/EVGStyleVarTest.rgr +471 -0
  67. package/dist/lib/evg/EVGText.rgr +105 -0
  68. package/dist/lib/evg/EVGTextEngine.rgr +536 -0
  69. package/dist/lib/evg/EVGTextMeasurer.rgr +720 -0
  70. package/dist/lib/evg/EVGTimingTest.rgr +1417 -0
  71. package/dist/lib/evg/EVGToolbar.rgr +1369 -0
  72. package/dist/lib/evg/EVGTransition.rgr +728 -0
  73. package/dist/lib/evg/EVGTreeJson.rgr +721 -0
  74. package/dist/lib/evg/EVGUnit.rgr +554 -0
  75. package/dist/lib/evg/EVGViewportUnitTest.rgr +236 -0
  76. package/dist/lib/evg/EvgApp.rgr +189 -0
  77. package/dist/lib/evg/EvgBitmapTracer.rgr +4277 -0
  78. package/dist/lib/evg/EvgBitmapTracerTest.rgr +2119 -0
  79. package/dist/lib/evg/EvgHost.rgr +451 -0
  80. package/dist/lib/evg/EvgTest.rgr +91 -0
  81. package/dist/lib/evg/EvgTraceColor.rgr +236 -0
  82. package/dist/lib/evg/EvgTraceCurve.rgr +648 -0
  83. package/dist/lib/evg/EvgTraceFit.rgr +767 -0
  84. package/dist/lib/evg/EvgTracePath.rgr +435 -0
  85. package/dist/lib/evg/EvgTraceTypes.rgr +559 -0
  86. package/dist/lib/evg/EvgViewport.rgr +313 -0
  87. package/dist/lib/evg/FxDemoDoc.rgr +185 -0
  88. package/dist/lib/evg/HOSTS.md +227 -0
  89. package/dist/lib/evg/ISSUES.md +835 -0
  90. package/dist/lib/evg/PLAN_ACCESSIBILITY.md +650 -0
  91. package/dist/lib/evg/PLAN_CSS_LAYOUT_AND_FONTS.md +1124 -0
  92. package/dist/lib/evg/PLAN_EFFECTS.md +431 -0
  93. package/dist/lib/evg/PLAN_EVG.md +518 -0
  94. package/dist/lib/evg/PLAN_EVG_RENDERER.md +1674 -0
  95. package/dist/lib/evg/PLAN_INSPECTOR.md +788 -0
  96. package/dist/lib/evg/PLAN_LINKS_AND_FORMS.md +157 -0
  97. package/dist/lib/evg/PLAN_NATIVE_HOSTS.md +671 -0
  98. package/dist/lib/evg/PLAN_VECTOR_IR.md +664 -0
  99. package/dist/lib/evg/PLAN_VIEW_TRANSFORM.md +322 -0
  100. package/dist/lib/evg/PathBuilder.rgr +333 -0
  101. package/dist/lib/evg/README.md +1236 -0
  102. package/dist/lib/evg/SPEC.md +1252 -0
  103. package/dist/lib/evg/SVGPathParser.rgr +1199 -0
  104. package/dist/lib/evg/SvgParser.rgr +1736 -0
  105. package/dist/lib/evg/TODO_EVG_RENDERER.md +595 -0
  106. package/dist/lib/evg/VectorShapes.rgr +331 -0
  107. package/dist/lib/evg/VectorStroke.rgr +107 -0
  108. package/dist/lib/evg/VectorViewBox.rgr +380 -0
  109. package/dist/lib/evg/agent/README.md +290 -0
  110. package/dist/lib/evg/agent/evg_agent.rgr +899 -0
  111. package/dist/lib/evg/agent/fixtures/broken.evg.json +7 -0
  112. package/dist/lib/evg/agent/fixtures/card.evg.json +9 -0
  113. package/dist/lib/evg/agent/fixtures/connector.css +63 -0
  114. package/dist/lib/evg/agent/fixtures/connector.evg.json +14 -0
  115. package/dist/lib/evg/agent/fixtures/drawn.evg.json +129 -0
  116. package/dist/lib/evg/agent/fixtures/gradient.evg.json +4 -0
  117. package/dist/lib/evg/agent/fixtures/popover.css +99 -0
  118. package/dist/lib/evg/agent/fixtures/popover.evg.json +30 -0
  119. package/dist/lib/evg/agent/roundtrip.sh +74 -0
  120. package/dist/lib/evg/agent/smoke.sh +230 -0
  121. package/dist/lib/evg/android/README.md +97 -0
  122. package/dist/lib/evg/android/androidstubs/AndroidStubs.kt +175 -0
  123. package/dist/lib/evg/android/androidstubs/Annotation.kt +10 -0
  124. package/dist/lib/evg/android/androidstubs/App.kt +30 -0
  125. package/dist/lib/evg/android/androidstubs/Content.kt +41 -0
  126. package/dist/lib/evg/android/androidstubs/ContentRes.kt +12 -0
  127. package/dist/lib/evg/android/androidstubs/InputMethod.kt +46 -0
  128. package/dist/lib/evg/android/androidstubs/Net.kt +6 -0
  129. package/dist/lib/evg/android/androidstubs/Os.kt +30 -0
  130. package/dist/lib/evg/android/androidstubs/Util.kt +15 -0
  131. package/dist/lib/evg/android/androidstubs/View.kt +113 -0
  132. package/dist/lib/evg/android/androidstubs/Widget.kt +16 -0
  133. package/dist/lib/evg/android/src/android/kotlin/fi/ranger/evg/AndroidEvgSurface.kt +323 -0
  134. package/dist/lib/evg/android/src/android/kotlin/fi/ranger/evg/AndroidTextMeasurer.kt +56 -0
  135. package/dist/lib/evg/android/src/android/kotlin/fi/ranger/evg/RippleEffect.kt +262 -0
  136. package/dist/lib/evg/android/src/awt/kotlin/fi/ranger/evg/AwtEvgSurface.kt +238 -0
  137. package/dist/lib/evg/android/src/awt/kotlin/fi/ranger/evg/AwtTextMeasurer.kt +85 -0
  138. package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/EvgEngineThread.kt +115 -0
  139. package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/EvgPainter.kt +231 -0
  140. package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/EvgSurface.kt +117 -0
  141. package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/RecordingSurface.kt +94 -0
  142. package/dist/lib/evg/apple/README.md +128 -0
  143. package/dist/lib/evg/apple/Sources/CoreGraphicsEvgSurface.swift +329 -0
  144. package/dist/lib/evg/apple/Sources/CoreTextMeasurer.swift +70 -0
  145. package/dist/lib/evg/apple/Sources/EvgEngineQueue.swift +105 -0
  146. package/dist/lib/evg/apple/Sources/EvgPainter.swift +225 -0
  147. package/dist/lib/evg/apple/Sources/EvgSurface.swift +163 -0
  148. package/dist/lib/evg/apple/Sources/RecordingSurface.swift +110 -0
  149. package/dist/lib/evg/bench/EvgLayoutBench.rgr +34 -0
  150. package/dist/lib/evg/bench/README.md +64 -0
  151. package/dist/lib/evg/bench/layout-bench.mjs +316 -0
  152. package/dist/lib/evg/bench/layout-cases.mjs +510 -0
  153. package/dist/lib/evg/bench/layout-conformance.mjs +254 -0
  154. package/dist/lib/evg/bin/.gitignore +17 -0
  155. package/dist/lib/evg/evg_test.rgr +313 -0
  156. package/dist/lib/evg/gl/README.md +198 -0
  157. package/dist/lib/evg/gl/a11y-paint-check.mjs +73 -0
  158. package/dist/lib/evg/gl/blur-check.mjs +399 -0
  159. package/dist/lib/evg/gl/boxmodel.json +1 -0
  160. package/dist/lib/evg/gl/demo.html +46 -0
  161. package/dist/lib/evg/gl/effect-presets.css +285 -0
  162. package/dist/lib/evg/gl/effect-presets.js +63 -0
  163. package/dist/lib/evg/gl/effect-shots.mjs +135 -0
  164. package/dist/lib/evg/gl/evg-a11y.js +566 -0
  165. package/dist/lib/evg/gl/evg-binary.js +160 -0
  166. package/dist/lib/evg/gl/evg-engine.js +296 -0
  167. package/dist/lib/evg/gl/evg-fx.js +237 -0
  168. package/dist/lib/evg/gl/evg-gestures.js +209 -0
  169. package/dist/lib/evg/gl/evg-list.js +167 -0
  170. package/dist/lib/evg/gl/evg-measure.js +186 -0
  171. package/dist/lib/evg/gl/evg-textinput.js +303 -0
  172. package/dist/lib/evg/gl/evg-view.js +144 -0
  173. package/dist/lib/evg/gl/evg-webgl.js +3942 -0
  174. package/dist/lib/evg/gl/fx-check.mjs +998 -0
  175. package/dist/lib/evg/gl/fx-demo.html +166 -0
  176. package/dist/lib/evg/gl/fx-demo.js +2 -0
  177. package/dist/lib/evg/gl/fx-serve.mjs +47 -0
  178. package/dist/lib/evg/gl/gestures-check.mjs +189 -0
  179. package/dist/lib/evg/gl/list-binary-check.mjs +152 -0
  180. package/dist/lib/evg/gl/measure-check.mjs +135 -0
  181. package/dist/lib/evg/gl/rotation-check.mjs +207 -0
  182. package/dist/lib/evg/gl/shift-check.mjs +113 -0
  183. package/dist/lib/evg/gl/stroke-check.mjs +168 -0
  184. package/dist/lib/evg/gl/text-snap-check.mjs +139 -0
  185. package/dist/lib/evg/gl/view-check.mjs +343 -0
  186. package/dist/lib/evg/gl/view-policy-check.mjs +184 -0
  187. package/dist/lib/evg/html/evg-dom.js +318 -0
  188. package/dist/lib/evg/html/evg-html.js +600 -0
  189. package/dist/lib/evg/inspect/README.md +415 -0
  190. package/dist/lib/evg/inspect/browser-smoke.mjs +115 -0
  191. package/dist/lib/evg/inspect/evg-inspect.js +947 -0
  192. package/dist/lib/evg/inspect/shots/css.png +0 -0
  193. package/dist/lib/evg/inspect/shots/dashboard.png +0 -0
  194. package/dist/lib/evg/inspect/shots/pptx-slide.png +0 -0
  195. package/dist/lib/evg/inspect/shots/state.png +0 -0
  196. package/dist/lib/evg/inspect/shots.mjs +226 -0
  197. package/dist/lib/evg/oracle/css-blur.json +576 -0
  198. package/dist/lib/evg/oracle/css-box.json +157 -0
  199. package/dist/lib/evg/oracle/css-timing.json +709 -0
  200. package/dist/lib/evg/oracle/css_blur_oracle.mjs +529 -0
  201. package/dist/lib/evg/oracle/css_box_oracle.mjs +106 -0
  202. package/dist/lib/evg/oracle/css_timing_oracle.mjs +389 -0
  203. package/dist/lib/evg/original/EVGColor.clj +310 -0
  204. package/dist/lib/evg/original/EVGColorContext.rgr +178 -0
  205. package/dist/lib/evg/original/SVGPath.rgr +627 -0
  206. package/dist/lib/evg/original/Vec2.crgr +103 -0
  207. package/dist/lib/evg/ranger.json +9 -0
  208. package/dist/lib/evg/showcase/README.md +246 -0
  209. package/dist/lib/evg/showcase/assets/emblem.svg +30 -0
  210. package/dist/lib/evg/showcase/assets/rosette.svg +22 -0
  211. package/dist/lib/evg/showcase/build.mjs +651 -0
  212. package/dist/lib/evg/showcase/pages/album.tsx +30 -0
  213. package/dist/lib/evg/showcase/pages/boxmodel.tsx +37 -0
  214. package/dist/lib/evg/showcase/pages/cards.tsx +41 -0
  215. package/dist/lib/evg/showcase/pages/chart_api.tsx +170 -0
  216. package/dist/lib/evg/showcase/pages/charts.tsx +219 -0
  217. package/dist/lib/evg/showcase/pages/drawing.tsx +160 -0
  218. package/dist/lib/evg/showcase/pages/emoji.tsx +91 -0
  219. package/dist/lib/evg/showcase/pages/flex.tsx +46 -0
  220. package/dist/lib/evg/showcase/pages/more.tsx +332 -0
  221. package/dist/lib/evg/showcase/pages/plots.tsx +262 -0
  222. package/dist/lib/evg/showcase/pages/svg.tsx +63 -0
  223. package/dist/lib/evg/showcase/pages/tables.tsx +209 -0
  224. package/dist/lib/evg/showcase/pages/typography.tsx +43 -0
  225. package/dist/lib/evg/showcase/pages/units.tsx +35 -0
  226. package/dist/lib/evg/showcase/pages/variants.tsx +233 -0
  227. package/dist/lib/evg/showcase/pages/vector.tsx +75 -0
  228. package/dist/lib/evg/showcase/pages/views.tsx +223 -0
  229. package/dist/lib/evg/showcase/tests/chart_api_smoke.mjs +339 -0
  230. package/dist/lib/evg/showcase/tests/gl_smoke.mjs +125 -0
  231. package/dist/lib/evg/showcase/themes/chart_api-default.css +15 -0
  232. package/dist/lib/evg/showcase/themes/charts-default.css +29 -0
  233. package/dist/lib/evg/showcase/themes/drawing-default.css +35 -0
  234. package/dist/lib/evg/showcase/themes/more-default.css +128 -0
  235. package/dist/lib/evg/showcase/themes/plots-default.css +18 -0
  236. package/dist/lib/evg/showcase/themes/showcase.css +508 -0
  237. package/dist/lib/evg/showcase/themes/tables-default.css +123 -0
  238. package/dist/lib/evg/showcase/themes/variants-default.css +15 -0
  239. package/dist/lib/evg/showcase/themes/views-default.css +15 -0
  240. package/dist/lib/evg/tools/bench_vs_potrace.mjs +290 -0
  241. package/dist/lib/evg/tools/evg_image_tool.rgr +488 -0
  242. package/dist/lib/evg/tools/evg_trace_bench.rgr +114 -0
  243. package/dist/lib/evg/tools/evg_trace_cli.rgr +662 -0
  244. package/dist/lib/evg/tools/evg_trace_cpp_bench.rgr +83 -0
  245. package/dist/lib/evg/tools/run_trace_bench.sh +74 -0
  246. package/dist/lib/evg/tools/run_trace_cli_smoke.sh +128 -0
  247. package/dist/lib/evg/web/responsive/EvgResponsiveCheck.rgr +271 -0
  248. package/dist/lib/evg/web/responsive/EvgResponsiveDemo.rgr +531 -0
  249. package/dist/lib/evg/web/responsive/README.md +97 -0
  250. package/dist/lib/evg/web/responsive/build.mjs +90 -0
  251. package/dist/lib/evg/web/responsive/dom-check.mjs +169 -0
  252. package/dist/lib/evg/web/responsive/index.html +177 -0
  253. package/dist/lib/evg/web/responsive/smoke.mjs +221 -0
  254. package/dist/lib/evg/web/tools/assets-client.mjs +95 -0
  255. package/dist/lib/evg/web/tools/boot-bench.mjs +189 -0
  256. package/dist/lib/evg/web/tools/inline-assets.mjs +119 -0
  257. package/dist/lib/evg/web/tools/minify.mjs +60 -0
  258. package/dist/lib/evg/web/tracer/build.mjs +87 -0
  259. package/dist/lib/evg/web/tracer/index.html +2805 -0
  260. package/dist/lib/evg/web/tracer/sample.png +0 -0
  261. package/dist/lib/evg/web/tracer/smoke.mjs +1162 -0
  262. package/dist/lib/evgr/Cargo.lock +21 -0
  263. package/dist/lib/evgr/Cargo.toml +19 -0
  264. package/dist/lib/evgr/README.md +140 -0
  265. package/dist/lib/evgr/bench/NativeBench.rgr +246 -0
  266. package/dist/lib/evgr/bench/compare.mjs +252 -0
  267. package/dist/lib/evgr/bench/speed.mjs +277 -0
  268. package/dist/lib/evgr/bin/.gitignore +3 -0
  269. package/dist/lib/evgr/src/bin/bench.rs +106 -0
  270. package/dist/lib/evgr/src/bin/smoke.rs +13 -0
  271. package/dist/lib/evgr/src/grid.rs +730 -0
  272. package/dist/lib/evgr/src/lib.rs +1003 -0
  273. package/dist/lib/evgr/src/style.rs +468 -0
  274. package/dist/lib/evgr/src/text.rs +83 -0
  275. package/dist/lib/image/BitReader.rgr +171 -0
  276. package/dist/lib/image/Buffer.rgr +173 -0
  277. package/dist/lib/image/DCT.rgr +283 -0
  278. package/dist/lib/image/Deflate.rgr +339 -0
  279. package/dist/lib/image/HuffmanDecoder.rgr +181 -0
  280. package/dist/lib/image/ImageBuffer.rgr +706 -0
  281. package/dist/lib/image/JPEGDecoder.rgr +808 -0
  282. package/dist/lib/image/PNGDecoder.rgr +544 -0
  283. package/dist/lib/image/PNGEncoder.rgr +388 -0
  284. package/dist/lib/image/PPMImage.rgr +224 -0
  285. package/dist/lib/image/ProgressiveJPEGDecoder.rgr +1154 -0
  286. package/dist/lib/image/README.md +33 -0
  287. package/dist/lib/image/RasterBuffer.rgr +294 -0
  288. package/dist/lib/image/VP8BoolDecoder.rgr +163 -0
  289. package/dist/lib/image/WebPDecoder.rgr +433 -0
  290. package/dist/lib/image/WebPLossless.rgr +1035 -0
  291. package/dist/lib/image/WebPLossy.rgr +1929 -0
  292. package/dist/lib/image/ranger.json +9 -0
  293. package/dist/lib/image/testdata/webp/anim_2f_24x16.webp +0 -0
  294. package/dist/lib/image/testdata/webp/fixtures.txt +33 -0
  295. package/dist/lib/image/testdata/webp/gen_fixtures.py +261 -0
  296. package/dist/lib/image/testdata/webp/ll_1x1.webp +0 -0
  297. package/dist/lib/image/testdata/webp/ll_alpha_29x21.webp +0 -0
  298. package/dist/lib/image/testdata/webp/ll_gradient_64x64.webp +0 -0
  299. package/dist/lib/image/testdata/webp/ll_meta_32x32.webp +0 -0
  300. package/dist/lib/image/testdata/webp/ll_noise_17x9.webp +0 -0
  301. package/dist/lib/image/testdata/webp/ll_pal11_23x11.webp +0 -0
  302. package/dist/lib/image/testdata/webp/ll_pal2_19x7.webp +0 -0
  303. package/dist/lib/image/testdata/webp/ll_pal40_16x16.webp +0 -0
  304. package/dist/lib/image/testdata/webp/ll_pal4_13x5.webp +0 -0
  305. package/dist/lib/image/testdata/webp/ll_photo_40x30.webp +0 -0
  306. package/dist/lib/image/testdata/webp/ll_predictors_64x32.webp +0 -0
  307. package/dist/lib/image/testdata/webp/ly_1x1.webp +0 -0
  308. package/dist/lib/image/testdata/webp/ly_alph_raw_f0_21x13.webp +0 -0
  309. package/dist/lib/image/testdata/webp/ly_alph_raw_f1_21x13.webp +0 -0
  310. package/dist/lib/image/testdata/webp/ly_alph_raw_f2_21x13.webp +0 -0
  311. package/dist/lib/image/testdata/webp/ly_alph_raw_f3_21x13.webp +0 -0
  312. package/dist/lib/image/testdata/webp/ly_alph_vp8l_f0_21x13.webp +0 -0
  313. package/dist/lib/image/testdata/webp/ly_alph_vp8l_f1_21x13.webp +0 -0
  314. package/dist/lib/image/testdata/webp/ly_alph_vp8l_f2_21x13.webp +0 -0
  315. package/dist/lib/image/testdata/webp/ly_alph_vp8l_f3_21x13.webp +0 -0
  316. package/dist/lib/image/testdata/webp/ly_alpha_33x17.webp +0 -0
  317. package/dist/lib/image/testdata/webp/ly_exif_15x11.webp +0 -0
  318. package/dist/lib/image/testdata/webp/ly_i16_96x80.webp +0 -0
  319. package/dist/lib/image/testdata/webp/ly_nofilter_24x20.webp +0 -0
  320. package/dist/lib/image/testdata/webp/ly_odd_17x9.webp +0 -0
  321. package/dist/lib/image/testdata/webp/ly_photo_48x40.webp +0 -0
  322. package/dist/lib/image/testdata/webp/ly_q100_20x18.webp +0 -0
  323. package/dist/lib/image/testdata/webp/ly_sharp_40x36.webp +0 -0
  324. package/dist/lib/image/testdata/webp/ly_simple_filter_33x31.webp +0 -0
  325. package/dist/lib/image/testdata/webp/ly_vpx_parts8_37x45.webp +0 -0
  326. package/dist/lib/image/testdata/webp/ly_vpx_skip_96x80.webp +0 -0
  327. package/dist/lib/image/tests/WebPDecodeTool.rgr +81 -0
  328. package/dist/lib/image/tests/WebPDecoderTest.rgr +1162 -0
  329. package/dist/lib/image/tests/run_webp_tests.sh +39 -0
  330. package/dist/lib/rust/RsJson.rgr +468 -0
  331. package/dist/lib/rust/RsPrelude.rgr +1663 -0
  332. package/dist/lib/shell_test.rgr +7 -7
  333. package/dist/lib/stdlib.rgr +21 -5
  334. package/dist/lib/zip/ranger.json +6 -0
  335. package/dist/rgrc.js +87318 -67610
  336. package/package.json +1010 -1040
  337. package/dist/README.md +0 -117
  338. package/dist/package.json +0 -47
@@ -0,0 +1,834 @@
1
+ ; SPDX-License-Identifier: MIT
2
+
3
+ ; ==============================================================================
4
+ ; EVGHostTree — the fifth list: what CHANGED, for a host that keeps nodes
5
+ ; ==============================================================================
6
+ ;
7
+ ; PLAN_NATIVE_HOSTS.md, decision D2 and stage S2. Four descriptions already
8
+ ; come out of one laid-out tree, on the same pass and by the same rule —
9
+ ; derived, never a second opinion:
10
+ ;
11
+ ; EVGDisplayList what to draw EVGHitTest what is under here
12
+ ; EVGA11yFromTree what it means EVGInspect what it is
13
+ ;
14
+ ; None of them lets a host KEEP anything. A draw command carries no
15
+ ; identity, so a DOM painter rebuilds every node every frame and a CSS
16
+ ; transition, a focus ring, a caret or a native <input> has nothing to
17
+ ; attach to — `html/evg-html.js` says so in its own header, and says it is
18
+ ; a property of the seam, not of that file. This is the seam beside it.
19
+ ;
20
+ ; `build(root)` walks the laid-out tree and emits OPS against the tree it
21
+ ; described last time:
22
+ ;
23
+ ; CREATE path parentPath index a node, with everything a host needs
24
+ ; UPDATE path bits what changed on a node that exists
25
+ ; MOVE path parentPath index the same node, under another parent
26
+ ; or at another index
27
+ ; REMOVE path gone
28
+ ;
29
+ ; The path is the address, not the identity: an element of another type,
30
+ ; tag, id, or clipping at an address the last build described is a REMOVE
31
+ ; of the old node and a CREATE of the new one, its subtree with it — a host
32
+ ; that kept a node per address would otherwise be asked to turn a box into
33
+ ; a scroller in place.
34
+ ;
35
+ ; `bits` say which of five things moved, so a host writes only those:
36
+ ;
37
+ ; GEOMETRY 1 the rectangle PAINT 2 colours, radii, opacity, …
38
+ ; TEXT 4 the lines A11Y 8 role, name, states
39
+ ; SCROLL 16 the offset of a scroll container
40
+ ;
41
+ ; THE IDENTITY is `EVGInspect`'s path — `0/3/k:share` — and for the same
42
+ ; reason: a keyed child keeps its path across a reorder, so a list the app
43
+ ; reorders by key MOVES nodes rather than remaking them, and an unkeyed
44
+ ; child's path is structural, which is honest about what a host can keep.
45
+ ; `EVGReconcile` decides what "the same element" is; this reads the answer.
46
+ ;
47
+ ; THE GEOMETRY IS PARENT-RELATIVE AND UNSCROLLED. `EVGLayout` translates a
48
+ ; scroll container's children by -scrollTop, so their page rectangles change
49
+ ; on every scroll frame. A host that positions children inside their parent
50
+ ; wants coordinates that do not: `x - parent.x + parent.scrollLeft`, the
51
+ ; place the child would be at scroll 0. A scroll is then one SCROLL bit on
52
+ ; the container, which a DOM host turns into one transform on a layer and a
53
+ ; CoreAnimation or Compose host into one offset — the compositor moves the
54
+ ; children and the engine never touches them. The page rectangle is still
55
+ ; on the op (`pageX`, `pageY`), for a host that wants it.
56
+ ;
57
+ ; THE TEXT IS THE ENGINE'S LINES. One run per line, at the offsets the
58
+ ; display list would draw them, from the same `EVGTextEngine` — so a DOM
59
+ ; host sets `white-space: pre` on each and the browser breaks nothing
60
+ ; itself. That is what keeps a PDF and the screen breaking in the same
61
+ ; place, and it is the whole of D3.
62
+ ;
63
+ ; WHAT THIS DOES NOT DO. It does not flatten paths: a host that has a path
64
+ ; renderer (`<path d>`, `CGPath`, Compose's `Path`) wants the source, and
65
+ ; a host that has none reads the display list. It does not emit the
66
+ ; accessibility tree: `EVGA11yFromTree` is that, and this carries the few
67
+ ; fields a host writes on the node itself. And it changes nothing below the
68
+ ; display list; a host that reads that keeps reading it.
69
+ ;
70
+ ; COST. A hash string per element per build, compared against the shadow.
71
+ ; That is the honest first version — measurable, and the style cache's
72
+ ; `nothingChanged()` and the element's `paintStamp` are where a second
73
+ ; version skips the walk. The bits are exact whatever the cost.
74
+ ; ==============================================================================
75
+
76
+ Import "EVGElement.rgr"
77
+ Import "EVGColor.rgr"
78
+ Import "EVGTextEngine.rgr"
79
+ Import "EVGDisplayList.rgr"
80
+
81
+ ; What the tree said about a node last time, so this time can say what moved.
82
+ class EVGHostShadow {
83
+ def path:string ""
84
+ def parentPath:string ""
85
+ def index:int 0
86
+ def geom:string ""
87
+ def paint:string ""
88
+ def text:string ""
89
+ def a11y:string ""
90
+ def scroll:string ""
91
+ ; What kind of element sat at this address: type, tag, id, clipping.
92
+ ; Another one there is another node, not an update of this one.
93
+ def identity:string ""
94
+ def seen:boolean false
95
+
96
+ Constructor () {
97
+ }
98
+ }
99
+
100
+ ; One op. A CREATE carries every field; an UPDATE carries every field too and
101
+ ; `bits` says which a host has to read; a MOVE carries the new place; a
102
+ ; REMOVE carries the path.
103
+ class EVGHostOp {
104
+ def kind:int 0
105
+ def path:string ""
106
+ def parentPath:string ""
107
+ def index:int 0
108
+ def bits:int 0
109
+ def elementType:int 0
110
+ def tagName:string ""
111
+ def id:string ""
112
+ def key:string ""
113
+ ; The class list, for a host whose own stylesheet may style or
114
+ ; transition the node by it.
115
+ def className:string ""
116
+
117
+ ; --- geometry, parent-relative and unscrolled; and on the page -----------
118
+ def x:double 0.0
119
+ def y:double 0.0
120
+ def w:double 0.0
121
+ def h:double 0.0
122
+ def pageX:double 0.0
123
+ def pageY:double 0.0
124
+
125
+ ; --- paint ------------------------------------------------------------------
126
+ def hasBg:boolean false
127
+ def bgR:int 0
128
+ def bgG:int 0
129
+ def bgB:int 0
130
+ def bgA:double 1.0
131
+ def hasGrad:boolean false
132
+ def gradDir:int 0
133
+ def g2R:int 0
134
+ def g2G:int 0
135
+ def g2B:int 0
136
+ def g2A:double 1.0
137
+ def borderW:double 0.0
138
+ def brR:int 0
139
+ def brG:int 0
140
+ def brB:int 0
141
+ def brA:double 1.0
142
+ def rTL:double 0.0
143
+ def rTR:double 0.0
144
+ def rBR:double 0.0
145
+ def rBL:double 0.0
146
+ def opacity:double 1.0
147
+ def clips:boolean false
148
+ def rotate:double 0.0
149
+ def transformSpec:string ""
150
+ ; The transform's origin inside the box, and its scale and shift — what
151
+ ; the display list turns the commands about. A host writes them as one
152
+ ; `transform` and one `transform-origin`.
153
+ def originX:double 0.0
154
+ def originY:double 0.0
155
+ def scale:double 1.0
156
+ def translateX:double 0.0
157
+ def translateY:double 0.0
158
+ def cursor:string ""
159
+ def backdropBlur:double 0.0
160
+ def hasShadow:boolean false
161
+ def shX:double 0.0
162
+ def shY:double 0.0
163
+ def shBlur:double 0.0
164
+ def shR:int 0
165
+ def shG:int 0
166
+ def shB:int 0
167
+ def shA:double 0.0
168
+ def isOverlay:boolean false
169
+
170
+ ; --- text ---------------------------------------------------------------------
171
+ def lines:[string]
172
+ def lineX:[double]
173
+ def lineY:[double]
174
+ def lineH:double 0.0
175
+ def fontFamily:string ""
176
+ def fontSize:double 0.0
177
+ def fontWeight:string ""
178
+ def textAlign:string ""
179
+ def textR:int 0
180
+ def textG:int 0
181
+ def textB:int 0
182
+ def textA:double 1.0
183
+
184
+ ; --- image ---------------------------------------------------------------------
185
+ def src:string ""
186
+ def objectFit:string ""
187
+
188
+ ; --- path -----------------------------------------------------------------------
189
+ def d:string ""
190
+ def svgSource:string ""
191
+ def viewBox:string ""
192
+ def hasFill:boolean false
193
+ def fillR:int 0
194
+ def fillG:int 0
195
+ def fillB:int 0
196
+ def fillA:double 1.0
197
+ def hasStroke:boolean false
198
+ def stR:int 0
199
+ def stG:int 0
200
+ def stB:int 0
201
+ def stA:double 1.0
202
+ def strokeWidth:double 0.0
203
+ def fillRule:string ""
204
+ def dash:string ""
205
+
206
+ ; --- meaning ---------------------------------------------------------------------
207
+ def role:string ""
208
+ def label:string ""
209
+ def a11yState:string ""
210
+
211
+ ; --- scroll -----------------------------------------------------------------------
212
+ def scrollable:boolean false
213
+ def scrollTop:double 0.0
214
+ def scrollLeft:double 0.0
215
+
216
+ Constructor () {
217
+ }
218
+
219
+ fn kindName:string () {
220
+ if (kind == 0) { return "create" }
221
+ if (kind == 1) { return "update" }
222
+ if (kind == 2) { return "move" }
223
+ return "remove"
224
+ }
225
+ }
226
+
227
+ class EVGHostTree {
228
+ sfn CREATE:int () { return 0 }
229
+ sfn UPDATE:int () { return 1 }
230
+ sfn MOVE:int () { return 2 }
231
+ sfn REMOVE:int () { return 3 }
232
+
233
+ sfn GEOMETRY:int () { return 1 }
234
+ sfn PAINT:int () { return 2 }
235
+ sfn TEXT:int () { return 4 }
236
+ sfn A11Y:int () { return 8 }
237
+ sfn SCROLL:int () { return 16 }
238
+
239
+ def textEngine:EVGTextEngine (new EVGTextEngine())
240
+ ; The shadow: what was said last build, by path.
241
+ def shadowIndex:[string:int]
242
+ def shadows:[EVGHostShadow]
243
+ ; What this build said.
244
+ def ops:[EVGHostOp]
245
+ ; How many nodes the tree has, and the tally of this build.
246
+ def count:int 0
247
+ def created:int 0
248
+ def updated:int 0
249
+ def moved:int 0
250
+ def removed:int 0
251
+ def builds:int 0
252
+ ; What the walk is building into, replaced whole at the end.
253
+ def nextIndex:[string:int]
254
+ def nextShadows:[EVGHostShadow]
255
+
256
+ Constructor () {
257
+ }
258
+
259
+ ; The same engine the layout used, so the lines are the layout's lines.
260
+ fn setTextEngine:void (e:EVGTextEngine) {
261
+ textEngine = e
262
+ }
263
+
264
+ ; Forget the shadow: the next build creates everything again. For a host
265
+ ; that threw its nodes away.
266
+ fn reset:void () {
267
+ def si:[string:int]
268
+ shadowIndex = si
269
+ def ss:[EVGHostShadow]
270
+ shadows = ss
271
+ }
272
+
273
+ fn opCount:int () {
274
+ return (array_length ops)
275
+ }
276
+
277
+ fn opAt:EVGHostOp (i:int) {
278
+ return (itemAt ops i)
279
+ }
280
+
281
+ ; --- the walk -------------------------------------------------------------
282
+
283
+ fn build:void (root:EVGElement) {
284
+ def o:[EVGHostOp]
285
+ ops = o
286
+ def ni:[string:int]
287
+ nextIndex = ni
288
+ def ns:[EVGHostShadow]
289
+ nextShadows = ns
290
+ created = 0
291
+ updated = 0
292
+ moved = 0
293
+ removed = 0
294
+ count = 0
295
+ def i:int 0
296
+ while (i < (array_length shadows)) {
297
+ def s:EVGHostShadow (itemAt shadows i)
298
+ s.seen = false
299
+ i = (i + 1)
300
+ }
301
+ def none@(optional):EVGElement
302
+ this.visit(root none "0" "" 0 false)
303
+ ; Whatever the walk did not reach is gone. Deepest first, so a host
304
+ ; that removes a parent before its children is never asked for a
305
+ ; child of a node it dropped.
306
+ def j:int ((array_length shadows) - 1)
307
+ while (j >= 0) {
308
+ def s2:EVGHostShadow (itemAt shadows j)
309
+ if (s2.seen == false) {
310
+ def op (new EVGHostOp())
311
+ op.kind = 3
312
+ op.path = s2.path
313
+ op.parentPath = s2.parentPath
314
+ push ops op
315
+ removed = (removed + 1)
316
+ }
317
+ j = (j - 1)
318
+ }
319
+ shadowIndex = nextIndex
320
+ shadows = nextShadows
321
+ builds = (builds + 1)
322
+ }
323
+
324
+ ; `fresh`: the parent was just made, so this node is made too whatever
325
+ ; the last build said at its address — the old subtree went with the
326
+ ; old parent.
327
+ fn visit:void (el:EVGElement parent@(optional):EVGElement path:string parentPath:string index:int fresh:boolean) {
328
+ if (el.isHidden()) {
329
+ return
330
+ }
331
+ count = (count + 1)
332
+ def op:EVGHostOp (this.describe(el parent path parentPath index))
333
+ def geom:string (EVGHostTree.geomKey(op))
334
+ def paint:string (EVGHostTree.paintKey(op))
335
+ def text:string (EVGHostTree.textKey(op))
336
+ def a11y:string (EVGHostTree.a11yKey(op))
337
+ def scroll:string (EVGHostTree.scrollKey(op))
338
+ def identity:string (EVGHostTree.identityKey(op))
339
+ def hit@(optional):int (get shadowIndex path)
340
+ def shadow (new EVGHostShadow())
341
+ def make:boolean fresh
342
+ if (null? hit) {
343
+ make = true
344
+ } {
345
+ def old:EVGHostShadow (itemAt shadows (unwrap hit))
346
+ old.seen = true
347
+ if (old.identity != identity) {
348
+ ; Another element at this address: the old node goes, with
349
+ ; its subtree, before the new one is made. What the old
350
+ ; subtree had that the new one does not is unseen and is
351
+ ; removed at the end — a no-op for a host that dropped it
352
+ ; with the parent.
353
+ if (fresh == false) {
354
+ def rm (new EVGHostOp())
355
+ rm.kind = 3
356
+ rm.path = path
357
+ rm.parentPath = old.parentPath
358
+ push ops rm
359
+ removed = (removed + 1)
360
+ }
361
+ make = true
362
+ }
363
+ }
364
+ if make {
365
+ op.kind = 0
366
+ op.bits = 31
367
+ push ops op
368
+ created = (created + 1)
369
+ } {
370
+ def old:EVGHostShadow (itemAt shadows (unwrap hit))
371
+ if ((old.parentPath != parentPath) || (old.index != index)) {
372
+ def mv (new EVGHostOp())
373
+ mv.kind = 2
374
+ mv.path = path
375
+ mv.parentPath = parentPath
376
+ mv.index = index
377
+ push ops mv
378
+ moved = (moved + 1)
379
+ }
380
+ def bits:int 0
381
+ if (old.geom != geom) { bits = (bits + 1) }
382
+ if (old.paint != paint) { bits = (bits + 2) }
383
+ if (old.text != text) { bits = (bits + 4) }
384
+ if (old.a11y != a11y) { bits = (bits + 8) }
385
+ if (old.scroll != scroll) { bits = (bits + 16) }
386
+ if (bits > 0) {
387
+ op.kind = 1
388
+ op.bits = bits
389
+ push ops op
390
+ updated = (updated + 1)
391
+ }
392
+ }
393
+ shadow.path = path
394
+ shadow.parentPath = parentPath
395
+ shadow.index = index
396
+ shadow.geom = geom
397
+ shadow.paint = paint
398
+ shadow.text = text
399
+ shadow.a11y = a11y
400
+ shadow.scroll = scroll
401
+ shadow.identity = identity
402
+ shadow.seen = true
403
+ push nextShadows shadow
404
+ set nextIndex path ((array_length nextShadows) - 1)
405
+
406
+ def i:int 0
407
+ def n:int (el.getChildCount())
408
+ while (i < n) {
409
+ def kid:EVGElement (el.getChild(i))
410
+ def seg:string (to_string i)
411
+ if ((strlen kid.key) > 0) {
412
+ seg = ("k:" + kid.key)
413
+ }
414
+ def kidPath:string ((path + "/") + seg)
415
+ def me@(optional):EVGElement el
416
+ this.visit(kid me kidPath path i make)
417
+ i = (i + 1)
418
+ }
419
+ }
420
+
421
+ ; --- describing a node ------------------------------------------------------
422
+
423
+ fn describe:EVGHostOp (el:EVGElement parent@(optional):EVGElement path:string parentPath:string index:int) {
424
+ def op (new EVGHostOp())
425
+ op.path = path
426
+ op.parentPath = parentPath
427
+ op.index = index
428
+ op.elementType = el.elementType
429
+ op.tagName = el.tagName
430
+ op.id = el.id
431
+ op.key = el.key
432
+ op.className = el.className
433
+
434
+ ; Geometry: on the page, and inside the parent at scroll 0.
435
+ def x:double el.calculatedX
436
+ def y:double el.calculatedY
437
+ def w:double el.calculatedWidth
438
+ def h:double el.calculatedHeight
439
+ op.pageX = x
440
+ op.pageY = y
441
+ op.w = w
442
+ op.h = h
443
+ if parent {
444
+ def p:EVGElement (unwrap parent)
445
+ op.x = ((x - p.calculatedX) + p.scrollLeft)
446
+ op.y = ((y - p.calculatedY) + p.scrollTop)
447
+ } {
448
+ op.x = x
449
+ op.y = y
450
+ }
451
+
452
+ ; Radii, resolved the way the display list resolves them — against the
453
+ ; box's own width, and scaled down together when they would overlap.
454
+ def bx:EVGBox el.box
455
+ def uTL:EVGUnit bx.borderRadiusTL
456
+ def uTR:EVGUnit bx.borderRadiusTR
457
+ def uBR:EVGUnit bx.borderRadiusBR
458
+ def uBL:EVGUnit bx.borderRadiusBL
459
+ def uAll:EVGUnit bx.borderRadius
460
+ def rTL:double (EVGDisplayList.radiusPx((uTL.isSet && (uTL.isPercent())) uTL.value bx.borderRadiusTLPx w))
461
+ def rTR:double (EVGDisplayList.radiusPx((uTR.isSet && (uTR.isPercent())) uTR.value bx.borderRadiusTRPx w))
462
+ def rBR:double (EVGDisplayList.radiusPx((uBR.isSet && (uBR.isPercent())) uBR.value bx.borderRadiusBRPx w))
463
+ def rBL:double (EVGDisplayList.radiusPx((uBL.isSet && (uBL.isPercent())) uBL.value bx.borderRadiusBLPx w))
464
+ if ((bx.hasPerCornerRadius()) == false) {
465
+ def uni:double (EVGDisplayList.radiusPx((uAll.isSet && (uAll.isPercent())) uAll.value bx.borderRadiusPx w))
466
+ rTL = uni
467
+ rTR = uni
468
+ rBR = uni
469
+ rBL = uni
470
+ }
471
+ def f:double 1.0
472
+ f = (EVGDisplayList.sideFactor(f w (rTL + rTR)))
473
+ f = (EVGDisplayList.sideFactor(f h (rTR + rBR)))
474
+ f = (EVGDisplayList.sideFactor(f w (rBL + rBR)))
475
+ f = (EVGDisplayList.sideFactor(f h (rTL + rBL)))
476
+ if (f < 1.0) {
477
+ rTL = (rTL * f)
478
+ rTR = (rTR * f)
479
+ rBR = (rBR * f)
480
+ rBL = (rBL * f)
481
+ }
482
+ op.rTL = rTL
483
+ op.rTR = rTR
484
+ op.rBR = rBR
485
+ op.rBL = rBL
486
+
487
+ ; Background and gradient, through the display list's own readers.
488
+ if el.backgroundColor {
489
+ def b0:EVGColor (unwrap el.backgroundColor)
490
+ if b0.isSet {
491
+ op.hasBg = true
492
+ op.bgR = (b0.red())
493
+ op.bgG = (b0.green())
494
+ op.bgB = (b0.blue())
495
+ op.bgA = (b0.alpha())
496
+ }
497
+ }
498
+ if (EVGDisplayList.hasLinearGradient(el)) {
499
+ def gc (new EVGDrawCmd())
500
+ EVGDisplayList.applyGradient(gc el)
501
+ op.hasGrad = true
502
+ op.hasBg = true
503
+ op.gradDir = gc.gradDir
504
+ op.bgR = gc.r
505
+ op.bgG = gc.g
506
+ op.bgB = gc.b
507
+ op.bgA = gc.a
508
+ op.g2R = gc.r2
509
+ op.g2G = gc.g2
510
+ op.g2B = gc.b2
511
+ op.g2A = gc.a2
512
+ }
513
+ op.borderW = (el.effectiveBorderWidthPx())
514
+ if (op.borderW > 0.0) {
515
+ def bc:EVGColor (el.effectiveBorderColor())
516
+ op.brR = (bc.red())
517
+ op.brG = (bc.green())
518
+ op.brB = (bc.blue())
519
+ op.brA = (bc.alpha())
520
+ }
521
+ op.opacity = el.opacity
522
+ op.clips = (el.clipsContent())
523
+ op.rotate = el.rotate
524
+ op.transformSpec = el.transformSpec
525
+ op.originX = (EVGElement.resolveOrigin(el.transformOriginX w))
526
+ op.originY = (EVGElement.resolveOrigin(el.transformOriginY h))
527
+ op.scale = el.scale
528
+ op.translateX = el.translateX
529
+ op.translateY = el.translateY
530
+ op.cursor = el.cursor
531
+ op.backdropBlur = el.backdropBlur
532
+ op.isOverlay = (el.isSurface())
533
+ if el.shadowColor {
534
+ def sc:EVGColor (unwrap el.shadowColor)
535
+ if sc.isSet {
536
+ op.hasShadow = true
537
+ op.shR = (sc.red())
538
+ op.shG = (sc.green())
539
+ op.shB = (sc.blue())
540
+ op.shA = (sc.alpha())
541
+ if el.shadowRadius.isSet { op.shBlur = el.shadowRadius.pixels }
542
+ if el.shadowOffsetX.isSet { op.shX = el.shadowOffsetX.pixels }
543
+ if el.shadowOffsetY.isSet { op.shY = el.shadowOffsetY.pixels }
544
+ }
545
+ }
546
+
547
+ ; Text: the engine's lines, at the display list's offsets.
548
+ if ((strlen el.textContent) > 0) {
549
+ def face:string (el.effectiveFontFamily())
550
+ def fs:double el.inheritedFontSize
551
+ if el.fontSize.isSet {
552
+ fs = el.fontSize.pixels
553
+ }
554
+ if (fs <= 0.0) {
555
+ fs = 14.0
556
+ }
557
+ def lh:double el.lineHeight
558
+ if (lh <= 0.0) {
559
+ lh = ((textEngine.lineHeightFor(face fs)) / fs)
560
+ }
561
+ if (lh <= 0.0) {
562
+ lh = 1.2
563
+ }
564
+ def avail:double (el.box.getInnerWidth(w))
565
+ def lines:[string] (textEngine.breakToStrings(el.textContent face fs avail))
566
+ op.lines = lines
567
+ def lx:[double]
568
+ def ly:[double]
569
+ def li:int 0
570
+ while (li < (array_length lines)) {
571
+ def indent:double 0.0
572
+ if ((el.textAlign == "center") || (el.textAlign == "right")) {
573
+ def m:EVGTextMetrics (textEngine.measureRun((itemAt lines li) face fs))
574
+ def slack:double (avail - m.width)
575
+ if (slack > 0.0) {
576
+ if (el.textAlign == "center") {
577
+ indent = (slack / 2.0)
578
+ } {
579
+ indent = slack
580
+ }
581
+ }
582
+ }
583
+ push lx (el.box.paddingLeftPx + indent)
584
+ push ly (el.box.paddingTopPx + ((to_double li) * (fs * lh)))
585
+ li = (li + 1)
586
+ }
587
+ op.lineX = lx
588
+ op.lineY = ly
589
+ op.lineH = (fs * lh)
590
+ op.fontFamily = face
591
+ op.fontSize = fs
592
+ if ((strlen el.fontWeight) > 0) {
593
+ if (el.fontWeight != "normal") {
594
+ op.fontWeight = el.fontWeight
595
+ }
596
+ }
597
+ op.textAlign = el.textAlign
598
+ if el.color {
599
+ def tc:EVGColor (unwrap el.color)
600
+ op.textR = (tc.red())
601
+ op.textG = (tc.green())
602
+ op.textB = (tc.blue())
603
+ op.textA = (tc.alpha())
604
+ }
605
+ }
606
+
607
+ ; Image
608
+ op.src = el.src
609
+ op.objectFit = el.objectFit
610
+
611
+ ; Path: the source, for a host with a path renderer.
612
+ if (el.drawsPath()) {
613
+ op.d = el.svgPath
614
+ op.svgSource = el.svgSource
615
+ op.viewBox = el.viewBox
616
+ op.fillRule = el.fillRule
617
+ op.strokeWidth = el.strokeWidth
618
+ op.dash = el.strokeDashArray
619
+ if el.fillColor {
620
+ def fc:EVGColor (unwrap el.fillColor)
621
+ if fc.isSet {
622
+ op.hasFill = true
623
+ op.fillR = (fc.red())
624
+ op.fillG = (fc.green())
625
+ op.fillB = (fc.blue())
626
+ op.fillA = (fc.alpha())
627
+ }
628
+ }
629
+ if el.strokeColor {
630
+ def stc:EVGColor (unwrap el.strokeColor)
631
+ if stc.isSet {
632
+ op.hasStroke = true
633
+ op.stR = (stc.red())
634
+ op.stG = (stc.green())
635
+ op.stB = (stc.blue())
636
+ op.stA = (stc.alpha())
637
+ }
638
+ }
639
+ }
640
+
641
+ ; Meaning: what a host writes on the node itself. The accessibility
642
+ ; TREE stays `EVGA11yFromTree`'s.
643
+ op.role = el.role
644
+ op.label = el.a11yLabel
645
+ op.a11yState = (EVGHostTree.stateOf(el))
646
+
647
+ ; Scroll
648
+ op.scrollable = (el.clipsContent())
649
+ op.scrollTop = el.scrollTop
650
+ op.scrollLeft = el.scrollLeft
651
+ return op
652
+ }
653
+
654
+ sfn stateOf:string (el:EVGElement) {
655
+ def s@(mutable):string ""
656
+ if el.a11yDisabled { s = (s + "d") }
657
+ if el.a11yHidden { s = (s + "h") }
658
+ if el.a11yFocusable { s = (s + "f") }
659
+ if el.isFocused { s = (s + "F") }
660
+ if el.isHovered { s = (s + "H") }
661
+ if el.isPressed { s = (s + "P") }
662
+ s = (s + ":" + (to_string el.a11yChecked) + ":" + (to_string el.a11yExpanded))
663
+ s = (s + ":" + (to_string el.a11yPressed) + ":" + (to_string el.a11ySelected))
664
+ s = (s + ":" + el.a11yValue + ":" + el.a11yDescription)
665
+ return s
666
+ }
667
+
668
+ ; --- the keys a shadow keeps ------------------------------------------------------
669
+
670
+ sfn geomKey:string (op:EVGHostOp) {
671
+ return ((EVGDisplayList.num(op.x)) + "," + (EVGDisplayList.num(op.y)) + ","
672
+ + (EVGDisplayList.num(op.w)) + "," + (EVGDisplayList.num(op.h)))
673
+ }
674
+
675
+ sfn colorKey:string (r:int g:int b:int a:double) {
676
+ return ((to_string r) + "." + (to_string g) + "." + (to_string b) + "." + (EVGDisplayList.num(a)))
677
+ }
678
+
679
+ sfn paintKey:string (op:EVGHostOp) {
680
+ def s@(mutable):string ""
681
+ if op.hasBg { s = (s + "bg" + (EVGHostTree.colorKey(op.bgR op.bgG op.bgB op.bgA))) }
682
+ if op.hasGrad { s = (s + "gr" + (to_string op.gradDir) + (EVGHostTree.colorKey(op.g2R op.g2G op.g2B op.g2A))) }
683
+ if (op.borderW > 0.0) { s = (s + "b" + (EVGDisplayList.num(op.borderW)) + (EVGHostTree.colorKey(op.brR op.brG op.brB op.brA))) }
684
+ s = (s + "r" + (EVGDisplayList.num(op.rTL)) + "," + (EVGDisplayList.num(op.rTR)) + "," + (EVGDisplayList.num(op.rBR)) + "," + (EVGDisplayList.num(op.rBL)))
685
+ s = (s + "o" + (EVGDisplayList.num(op.opacity)))
686
+ if op.clips { s = (s + "c") }
687
+ if op.isOverlay { s = (s + "O") }
688
+ if (op.rotate != 0.0) { s = (s + "rot" + (EVGDisplayList.num(op.rotate))) }
689
+ if (op.scale != 1.0) { s = (s + "sc" + (EVGDisplayList.num(op.scale))) }
690
+ if ((op.translateX != 0.0) || (op.translateY != 0.0)) { s = (s + "tr" + (EVGDisplayList.num(op.translateX)) + "," + (EVGDisplayList.num(op.translateY))) }
691
+ s = (s + "o" + (EVGDisplayList.num(op.originX)) + "," + (EVGDisplayList.num(op.originY)))
692
+ s = (s + op.transformSpec + "|" + op.cursor)
693
+ if (op.backdropBlur > 0.0) { s = (s + "bb" + (EVGDisplayList.num(op.backdropBlur))) }
694
+ if op.hasShadow { s = (s + "sh" + (EVGDisplayList.num(op.shX)) + "," + (EVGDisplayList.num(op.shY)) + "," + (EVGDisplayList.num(op.shBlur)) + (EVGHostTree.colorKey(op.shR op.shG op.shB op.shA))) }
695
+ if ((strlen op.src) > 0) { s = (s + "img" + op.src + op.objectFit) }
696
+ if ((strlen op.d) > 0) { s = (s + "d" + op.d) }
697
+ if ((strlen op.svgSource) > 0) { s = (s + "svg" + (to_string (strlen op.svgSource))) }
698
+ if ((strlen op.viewBox) > 0) { s = (s + "vb" + op.viewBox) }
699
+ if op.hasFill { s = (s + "f" + (EVGHostTree.colorKey(op.fillR op.fillG op.fillB op.fillA))) }
700
+ if op.hasStroke { s = (s + "s" + (EVGHostTree.colorKey(op.stR op.stG op.stB op.stA)) + (EVGDisplayList.num(op.strokeWidth)) + op.dash) }
701
+ s = (s + op.fillRule + "|" + op.className)
702
+ return s
703
+ }
704
+
705
+ sfn textKey:string (op:EVGHostOp) {
706
+ def s@(mutable):string ""
707
+ def i:int 0
708
+ while (i < (array_length op.lines)) {
709
+ s = (s + (itemAt op.lines i) + "\n" + (EVGDisplayList.num((itemAt op.lineX i))) + "," + (EVGDisplayList.num((itemAt op.lineY i))) + "\n")
710
+ i = (i + 1)
711
+ }
712
+ if (i > 0) {
713
+ s = (s + op.fontFamily + "|" + (EVGDisplayList.num(op.fontSize)) + "|" + op.fontWeight + "|" + op.textAlign
714
+ + "|" + (EVGDisplayList.num(op.lineH)) + "|" + (EVGHostTree.colorKey(op.textR op.textG op.textB op.textA)))
715
+ }
716
+ return s
717
+ }
718
+
719
+ sfn a11yKey:string (op:EVGHostOp) {
720
+ return (op.id + "|" + op.role + "|" + op.label + "|" + op.a11yState)
721
+ }
722
+
723
+ ; What makes a node the node it is at its address. The path says where;
724
+ ; this says what, and a change of it is a remake, not an update.
725
+ sfn identityKey:string (op:EVGHostOp) {
726
+ def s:string ((to_string op.elementType) + "|" + op.tagName + "|" + op.id)
727
+ if op.clips { s = (s + "|c") }
728
+ return s
729
+ }
730
+
731
+ sfn scrollKey:string (op:EVGHostOp) {
732
+ if (op.scrollable == false) {
733
+ return ""
734
+ }
735
+ return ((EVGDisplayList.num(op.scrollTop)) + "," + (EVGDisplayList.num(op.scrollLeft)))
736
+ }
737
+
738
+ ; --- JSON -------------------------------------------------------------------------
739
+ ;
740
+ ; What a DOM host reads. Every op is written whole on CREATE and UPDATE;
741
+ ; `bits` says what a host has to look at, and a host that looks at all of
742
+ ; it is merely slower.
743
+
744
+ sfn q:string (v:string) {
745
+ return (EVGDisplayList.jsonString(v))
746
+ }
747
+
748
+ sfn color:string (r:int g:int b:int a:double) {
749
+ return ("[" + (to_string r) + "," + (to_string g) + "," + (to_string b) + "," + (EVGDisplayList.num(a)) + "]")
750
+ }
751
+
752
+ fn toJson:string () {
753
+ def out@(mutable):string ("{\"evghost\":1,\"build\":" + (to_string builds) + ",\"count\":" + (to_string count))
754
+ out = (out + ",\"created\":" + (to_string created) + ",\"updated\":" + (to_string updated))
755
+ out = (out + ",\"moved\":" + (to_string moved) + ",\"removed\":" + (to_string removed) + ",\"ops\":[")
756
+ def i:int 0
757
+ while (i < (array_length ops)) {
758
+ def op:EVGHostOp (itemAt ops i)
759
+ if (i > 0) {
760
+ out = (out + ",")
761
+ }
762
+ out = (out + (this.opJson(op)))
763
+ i = (i + 1)
764
+ }
765
+ out = (out + "]}")
766
+ return out
767
+ }
768
+
769
+ fn opJson:string (op:EVGHostOp) {
770
+ def s@(mutable):string ("{\"op\":\"" + (op.kindName()) + "\",\"path\":" + (EVGHostTree.q(op.path)))
771
+ if (op.kind == 3) {
772
+ return (s + "}")
773
+ }
774
+ s = (s + ",\"parent\":" + (EVGHostTree.q(op.parentPath)) + ",\"index\":" + (to_string op.index))
775
+ if (op.kind == 2) {
776
+ return (s + "}")
777
+ }
778
+ s = (s + ",\"bits\":" + (to_string op.bits) + ",\"type\":" + (to_string op.elementType) + ",\"tag\":" + (EVGHostTree.q(op.tagName)))
779
+ if ((strlen op.id) > 0) { s = (s + ",\"id\":" + (EVGHostTree.q(op.id))) }
780
+ if ((strlen op.key) > 0) { s = (s + ",\"key\":" + (EVGHostTree.q(op.key))) }
781
+ if ((strlen op.className) > 0) { s = (s + ",\"cls\":" + (EVGHostTree.q(op.className))) }
782
+ s = (s + ",\"x\":" + (EVGDisplayList.num(op.x)) + ",\"y\":" + (EVGDisplayList.num(op.y)))
783
+ s = (s + ",\"w\":" + (EVGDisplayList.num(op.w)) + ",\"h\":" + (EVGDisplayList.num(op.h)))
784
+ s = (s + ",\"px\":" + (EVGDisplayList.num(op.pageX)) + ",\"py\":" + (EVGDisplayList.num(op.pageY)))
785
+ if op.hasBg { s = (s + ",\"bg\":" + (EVGHostTree.color(op.bgR op.bgG op.bgB op.bgA))) }
786
+ if op.hasGrad { s = (s + ",\"gd\":" + (to_string op.gradDir) + ",\"bg2\":" + (EVGHostTree.color(op.g2R op.g2G op.g2B op.g2A))) }
787
+ if (op.borderW > 0.0) { s = (s + ",\"bw\":" + (EVGDisplayList.num(op.borderW)) + ",\"bc\":" + (EVGHostTree.color(op.brR op.brG op.brB op.brA))) }
788
+ if (((op.rTL > 0.0) || (op.rTR > 0.0)) || ((op.rBR > 0.0) || (op.rBL > 0.0))) {
789
+ s = (s + ",\"rc\":[" + (EVGDisplayList.num(op.rTL)) + "," + (EVGDisplayList.num(op.rTR)) + "," + (EVGDisplayList.num(op.rBR)) + "," + (EVGDisplayList.num(op.rBL)) + "]")
790
+ }
791
+ if (op.opacity < 1.0) { s = (s + ",\"opacity\":" + (EVGDisplayList.num(op.opacity))) }
792
+ if op.clips { s = (s + ",\"clip\":true") }
793
+ if op.isOverlay { s = (s + ",\"overlay\":true") }
794
+ if (op.rotate != 0.0) { s = (s + ",\"rot\":" + (EVGDisplayList.num(op.rotate))) }
795
+ if (op.scale != 1.0) { s = (s + ",\"scale\":" + (EVGDisplayList.num(op.scale))) }
796
+ if ((op.translateX != 0.0) || (op.translateY != 0.0)) { s = (s + ",\"tx\":" + (EVGDisplayList.num(op.translateX)) + ",\"ty\":" + (EVGDisplayList.num(op.translateY))) }
797
+ if (((op.rotate != 0.0) || (op.scale != 1.0)) || ((op.translateX != 0.0) || (op.translateY != 0.0))) { s = (s + ",\"origin\":[" + (EVGDisplayList.num(op.originX)) + "," + (EVGDisplayList.num(op.originY)) + "]") }
798
+ if ((strlen op.transformSpec) > 0) { s = (s + ",\"transform\":" + (EVGHostTree.q(op.transformSpec))) }
799
+ if ((strlen op.cursor) > 0) { s = (s + ",\"cursor\":" + (EVGHostTree.q(op.cursor))) }
800
+ if (op.backdropBlur > 0.0) { s = (s + ",\"bb\":" + (EVGDisplayList.num(op.backdropBlur))) }
801
+ if op.hasShadow {
802
+ s = (s + ",\"sh\":{\"x\":" + (EVGDisplayList.num(op.shX)) + ",\"y\":" + (EVGDisplayList.num(op.shY)) + ",\"blur\":" + (EVGDisplayList.num(op.shBlur)) + ",\"c\":" + (EVGHostTree.color(op.shR op.shG op.shB op.shA)) + "}")
803
+ }
804
+ if ((array_length op.lines) > 0) {
805
+ s = (s + ",\"text\":{\"lines\":[")
806
+ def i:int 0
807
+ while (i < (array_length op.lines)) {
808
+ if (i > 0) { s = (s + ",") }
809
+ s = (s + "[" + (EVGHostTree.q((itemAt op.lines i))) + "," + (EVGDisplayList.num((itemAt op.lineX i))) + "," + (EVGDisplayList.num((itemAt op.lineY i))) + "]")
810
+ i = (i + 1)
811
+ }
812
+ s = (s + "],\"lh\":" + (EVGDisplayList.num(op.lineH)) + ",\"font\":" + (EVGHostTree.q(op.fontFamily)) + ",\"size\":" + (EVGDisplayList.num(op.fontSize)))
813
+ if ((strlen op.fontWeight) > 0) { s = (s + ",\"weight\":" + (EVGHostTree.q(op.fontWeight))) }
814
+ s = (s + ",\"align\":" + (EVGHostTree.q(op.textAlign)) + ",\"c\":" + (EVGHostTree.color(op.textR op.textG op.textB op.textA)) + "}")
815
+ }
816
+ if ((strlen op.src) > 0) { s = (s + ",\"src\":" + (EVGHostTree.q(op.src)) + ",\"fit\":" + (EVGHostTree.q(op.objectFit))) }
817
+ if ((op.tagName == "path") || (op.tagName == "connector")) {
818
+ s = (s + ",\"shape\":{\"d\":" + (EVGHostTree.q(op.d)) + ",\"viewBox\":" + (EVGHostTree.q(op.viewBox)) + ",\"rule\":" + (EVGHostTree.q(op.fillRule)))
819
+ if ((strlen op.svgSource) > 0) { s = (s + ",\"svg\":" + (EVGHostTree.q(op.svgSource))) }
820
+ if op.hasFill { s = (s + ",\"fill\":" + (EVGHostTree.color(op.fillR op.fillG op.fillB op.fillA))) }
821
+ if op.hasStroke { s = (s + ",\"stroke\":" + (EVGHostTree.color(op.stR op.stG op.stB op.stA)) + ",\"sw\":" + (EVGDisplayList.num(op.strokeWidth))) }
822
+ if ((strlen op.dash) > 0) { s = (s + ",\"dash\":" + (EVGHostTree.q(op.dash))) }
823
+ s = (s + "}")
824
+ }
825
+ if (((strlen op.role) > 0) || ((strlen op.label) > 0)) {
826
+ s = (s + ",\"role\":" + (EVGHostTree.q(op.role)) + ",\"label\":" + (EVGHostTree.q(op.label)))
827
+ }
828
+ s = (s + ",\"state\":" + (EVGHostTree.q(op.a11yState)))
829
+ if op.scrollable {
830
+ s = (s + ",\"scroll\":[" + (EVGDisplayList.num(op.scrollLeft)) + "," + (EVGDisplayList.num(op.scrollTop)) + "]")
831
+ }
832
+ return (s + "}")
833
+ }
834
+ }