ranger-compiler 3.5.1 → 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 +1064 -20
  2. package/LICENSE +3 -1
  3. package/README.md +123 -28
  4. package/dist/Lang.rgr +1188 -290
  5. package/dist/api.d.ts +2343 -879
  6. package/dist/api.js +79923 -56921
  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,554 @@
1
+ ; SPDX-License-Identifier: MIT
2
+
3
+ ; EVGUnit.rgr - Unit parsing and resolution for EVG layout
4
+ ; Supports: px, %, em, rem, hp (height percent), vw / vh, fill, and the
5
+ ; absolute print units pt / pc / in / mm / cm, which are folded into px at
6
+ ; parse time.
7
+ ;
8
+ ; `vw` and `vh` are the VIEWPORT, which is a different thing from the parent —
9
+ ; and the reason they are worth having at all: `height: 100%` needs a chain of
10
+ ; ancestors that all have a definite height, so a page that wants to be as tall
11
+ ; as the screen has to be handed that number by its host. `100vh` asks the
12
+ ; layout, which already knows: `EVGLayout.pageWidth` / `pageHeight`.
13
+ ;
14
+ ; ON PAPER that is the PAGE AREA — the sheet less its margins — which is what
15
+ ; CSS says viewport-percentage lengths mean in paged media, and what the print
16
+ ; renderers already give the layout as its page size (`EVGPDFRenderer` and
17
+ ; `EVGHTMLRenderer` both set `layout.pageWidth` to the section width less two
18
+ ; margins before laying a page out). So `100vh` is the text column on A4 and
19
+ ; the window on a screen, with nothing to configure in either.
20
+ ;
21
+ ; A unit cannot reach the layout on its own, so whoever resolves it calls
22
+ ; `setContext` first, the same way `rem` gets the root font size. With no
23
+ ; viewport handed over — an element resolved outside a layout — a viewport
24
+ ; length comes out ZERO rather than falling back to the parent's size: one of
25
+ ; those is a visible mistake and the other is `100vh` quietly meaning two
26
+ ; different things depending on where the element sits.
27
+ ;
28
+ ; Not supported, deliberately: vmin / vmax (nothing has asked, and they are two
29
+ ; more lines the day something does), ch/ex (they need font metrics the unit
30
+ ; layer has no access to), and calc().
31
+ ; An unrecognised suffix leaves the unit UNSET — i.e. auto, the way a browser
32
+ ; drops a declaration it cannot parse. It must not fall through to the bare
33
+ ; number path, because to_double("10ch") is 10 and the length would silently
34
+ ; become 10px.
35
+
36
+ ; Unit type constants
37
+ ; 0 = PIXELS (default)
38
+ ; 1 = PERCENT (% of parent width)
39
+ ; 2 = EM (relative to font size)
40
+ ; 3 = HEIGHT_PERCENT (% of parent height)
41
+ ; 4 = FILL (expand to fill available space)
42
+ ; 5 = REM (relative to the ROOT font size)
43
+ ; 6 = FIT_CONTENT (as wide as the children turn out to be)
44
+ ; 7 = VIEWPORT_WIDTH (vw, % of the layout's page width)
45
+ ; 8 = VIEWPORT_HEIGHT (vh, % of the layout's page height)
46
+
47
+ ; The one unset unit every element shares.
48
+ ;
49
+ ; An element has 39 unit-valued fields and a fresh box 14 more, and nearly all
50
+ ; of them are "nothing was said". Allocating a separate object to say nothing
51
+ ; 53 times per element was, measured, most of the element's memory (6.7 kB of
52
+ ; which 4.4 kB was sub-objects) and most of its construction time. So there is
53
+ ; ONE unset unit, and `EVGUnit.unset()` hands it out.
54
+ ;
55
+ ; That is only sound if nobody writes into it, and the unit has exactly two
56
+ ; in-place mutators: `setContext` and the `resolve` family. Both now do
57
+ ; nothing for an unset unit — an unset unit resolves to 0 whatever its
58
+ ; context is, so there was never anything to write. A caller that wants to
59
+ ; SET a unit assigns a new one to the field (`el.width = EVGUnit.px(..)`);
60
+ ; it must not flip `isSet` on the object it found there, because that object
61
+ ; may be this one.
62
+ class EVGUnitDefaults @singleton(true) {
63
+ def unset:EVGUnit (new EVGUnit())
64
+ }
65
+
66
+ class EVGUnit {
67
+ def value:double 0.0
68
+ def unitType:int 0
69
+ def isSet:boolean false
70
+ def pixels:double 0.0
71
+ ; What `rem` resolves against. A unit has no way to reach the root of the
72
+ ; tree, so whoever resolves it (EVGElement/EVGBox.resolveUnits) sets this
73
+ ; first. Ignored by every other unit type.
74
+ def rootFontSize:double 14.0
75
+ ; And what `vw` / `vh` resolve against: the layout's page size, which on
76
+ ; paper is the page area rather than the sheet. Zero means nobody said, and
77
+ ; a viewport length then comes out zero — see the note at the top.
78
+ def viewportW:double 0.0
79
+ def viewportH:double 0.0
80
+
81
+ Constructor () {
82
+ value = 0.0
83
+ unitType = 0
84
+ isSet = false
85
+ pixels = 0.0
86
+ }
87
+
88
+ ; Everything a relative length needs beyond its parent's size: the root
89
+ ; font size for `rem`, the viewport for `vw` and `vh`. One call rather than
90
+ ; three assignments at every site, because the three travel together and a
91
+ ; site that set two of them would be a bug nothing announces.
92
+ fn setContext:void (rfs:double vw:double vh:double) {
93
+ ; An unset unit resolves to 0 in any context, and it may be the
94
+ ; shared one: nothing to record.
95
+ if (isSet == false) {
96
+ return
97
+ }
98
+ rootFontSize = rfs
99
+ viewportW = vw
100
+ viewportH = vh
101
+ }
102
+
103
+ ; The part before a suffix, and whether it is a NUMBER — digits, one dot,
104
+ ; a sign. `to_double` stops at the first character it cannot use, so a
105
+ ; suffix test on its own is not enough to know a length was written the way
106
+ ; the parser thinks it was: "10vmin" ends in "in", inches are one of the
107
+ ; absolute units, and it parsed as 10 inches — 960 pixels — for a unit this
108
+ ; layer deliberately does not support. Every branch below asks this first.
109
+ sfn isNumeric:boolean (str:string) {
110
+ def n:int (strlen str)
111
+ if (n == 0) {
112
+ return false
113
+ }
114
+ def i:int 0
115
+ def digits:int 0
116
+ while (i < n) {
117
+ def c:int (charAt str i)
118
+ def isDigit:boolean ((c >= 48) && (c <= 57))
119
+ if isDigit {
120
+ digits = (digits + 1)
121
+ } {
122
+ ; A sign only at the front, a dot anywhere, nothing else.
123
+ if (c == 46) {
124
+ } {
125
+ if ((c == 43) || (c == 45)) {
126
+ if (i > 0) {
127
+ return false
128
+ }
129
+ } {
130
+ return false
131
+ }
132
+ }
133
+ }
134
+ i = (i + 1)
135
+ }
136
+ return (digits > 0)
137
+ }
138
+
139
+ sfn isAlpha:boolean (c:int) {
140
+ if ((c >= 65) && (c <= 90)) {
141
+ return true
142
+ }
143
+ return ((c >= 97) && (c <= 122))
144
+ }
145
+
146
+ ; CSS defines the absolute units against the reference pixel: 1in = 96px.
147
+ sfn pxPerUnit:double (suffix:string) {
148
+ if (suffix == "pt") {
149
+ return (96.0 / 72.0)
150
+ }
151
+ if (suffix == "pc") {
152
+ return 16.0
153
+ }
154
+ if (suffix == "in") {
155
+ return 96.0
156
+ }
157
+ if (suffix == "mm") {
158
+ return (96.0 / 25.4)
159
+ }
160
+ if (suffix == "cm") {
161
+ return (96.0 / 2.54)
162
+ }
163
+ return 0.0
164
+ }
165
+
166
+ sfn create:EVGUnit (val:double uType:int) {
167
+ def unit (new EVGUnit())
168
+ unit.value = val
169
+ unit.unitType = uType
170
+ unit.isSet = true
171
+ return unit
172
+ }
173
+
174
+ sfn px:EVGUnit (val:double) {
175
+ def unit:EVGUnit (EVGUnit.create(val 0))
176
+ ; A pixel length is already in pixels. parse("14px") fills this in
177
+ ; eagerly and callers read .pixels without resolving first, so px()
178
+ ; has to as well.
179
+ unit.pixels = val
180
+ return unit
181
+ }
182
+
183
+ sfn percent:EVGUnit (val:double) {
184
+ return (EVGUnit.create(val 1))
185
+ }
186
+
187
+ sfn em:EVGUnit (val:double) {
188
+ return (EVGUnit.create(val 2))
189
+ }
190
+
191
+ sfn rem:EVGUnit (val:double) {
192
+ return (EVGUnit.create(val 5))
193
+ }
194
+
195
+ sfn heightPercent:EVGUnit (val:double) {
196
+ return (EVGUnit.create(val 3))
197
+ }
198
+
199
+ sfn fill:EVGUnit () {
200
+ return (EVGUnit.create(100.0 4))
201
+ }
202
+
203
+ ; The shared unset unit. Read-only by convention — see EVGUnitDefaults.
204
+ sfn unset:EVGUnit () {
205
+ return ((EVGUnitDefaults.__singleton()).unset)
206
+ }
207
+
208
+ sfn parse:EVGUnit (str:string) {
209
+ ; Parse unit string like "100px", "50%", "2em", "30hp", "fill", "auto"
210
+ def unit (new EVGUnit())
211
+ def trimmed:string (trim str)
212
+ def len:int (strlen trimmed)
213
+
214
+ if (len == 0) {
215
+ return unit
216
+ }
217
+
218
+ ; Check for "fill"
219
+ if (trimmed == "fill") {
220
+ unit.value = 100.0
221
+ unit.unitType = 4
222
+ unit.isSet = true
223
+ return unit
224
+ }
225
+
226
+ ; Check for "auto" - return unset unit (auto sizing)
227
+ if (trimmed == "auto") {
228
+ return unit
229
+ }
230
+
231
+ ; fit-content: the box is as wide as what it holds. Not the same as
232
+ ; leaving the width off, which in EVG means "as wide as the parent" —
233
+ ; that difference is why a row of containers stacked vertically instead
234
+ ; of sitting side by side, every one of them filling the row.
235
+ if (trimmed == "fit-content") {
236
+ unit.value = 0.0
237
+ unit.unitType = 6
238
+ unit.isSet = false
239
+ return unit
240
+ }
241
+
242
+ ; Check for percentage
243
+ def lastChar:int (charAt trimmed (len - 1))
244
+ if (lastChar == 37) { ; '%'
245
+ def numStr:string (substring trimmed 0 (len - 1))
246
+ if (EVGUnit.isNumeric(numStr) == false) {
247
+ return unit
248
+ }
249
+ def numVal@(optional):double (to_double numStr)
250
+ if numVal {
251
+ unit.value = (unwrap numVal)
252
+ unit.unitType = 1
253
+ unit.isSet = true
254
+ }
255
+ return unit
256
+ }
257
+
258
+ ; "rem" has to be tested before "em", or a 3-character suffix gets
259
+ ; chopped to "2r" — which to_double happily reads as 2, so "2rem"
260
+ ; silently became "2em".
261
+ if (len >= 3) {
262
+ def suffix3:string (substring trimmed (len - 3) len)
263
+ if (suffix3 == "rem") {
264
+ def numStr3:string (substring trimmed 0 (len - 3))
265
+ if (EVGUnit.isNumeric(numStr3) == false) {
266
+ return unit
267
+ }
268
+ def numVal3@(optional):double (to_double numStr3)
269
+ if numVal3 {
270
+ unit.value = (unwrap numVal3)
271
+ unit.unitType = 5
272
+ unit.isSet = true
273
+ }
274
+ return unit
275
+ }
276
+ }
277
+
278
+ ; Check for "em"
279
+ if (len >= 2) {
280
+ def suffix:string (substring trimmed (len - 2) len)
281
+ ; Absolute print units. These have a fixed pixel value, so they are
282
+ ; folded to px here and never need resolving again.
283
+ def perUnit:double (EVGUnit.pxPerUnit(suffix))
284
+ if (perUnit > 0.0) {
285
+ def numStrA:string (substring trimmed 0 (len - 2))
286
+ if (EVGUnit.isNumeric(numStrA) == false) {
287
+ return unit
288
+ }
289
+ def numValA@(optional):double (to_double numStrA)
290
+ if numValA {
291
+ unit.value = ((unwrap numValA) * perUnit)
292
+ unit.pixels = unit.value
293
+ unit.unitType = 0
294
+ unit.isSet = true
295
+ }
296
+ return unit
297
+ }
298
+ if (suffix == "em") {
299
+ def numStr:string (substring trimmed 0 (len - 2))
300
+ if (EVGUnit.isNumeric(numStr) == false) {
301
+ return unit
302
+ }
303
+ def numVal@(optional):double (to_double numStr)
304
+ if numVal {
305
+ unit.value = (unwrap numVal)
306
+ unit.unitType = 2
307
+ unit.isSet = true
308
+ }
309
+ return unit
310
+ }
311
+ if (suffix == "px") {
312
+ def numStr:string (substring trimmed 0 (len - 2))
313
+ if (EVGUnit.isNumeric(numStr) == false) {
314
+ return unit
315
+ }
316
+ def numVal@(optional):double (to_double numStr)
317
+ if numVal {
318
+ unit.value = (unwrap numVal)
319
+ unit.pixels = unit.value ; For pixels, set pixels immediately
320
+ unit.unitType = 0
321
+ unit.isSet = true
322
+ }
323
+ return unit
324
+ }
325
+ if (suffix == "hp") {
326
+ def numStr:string (substring trimmed 0 (len - 2))
327
+ if (EVGUnit.isNumeric(numStr) == false) {
328
+ return unit
329
+ }
330
+ def numVal@(optional):double (to_double numStr)
331
+ if numVal {
332
+ unit.value = (unwrap numVal)
333
+ unit.unitType = 3
334
+ unit.isSet = true
335
+ }
336
+ return unit
337
+ }
338
+ ; The viewport, which is the layout's page size — and on paper the
339
+ ; page AREA, because that is the page size the print renderers set.
340
+ if (suffix == "vw") {
341
+ def numStrVW:string (substring trimmed 0 (len - 2))
342
+ if (EVGUnit.isNumeric(numStrVW) == false) {
343
+ return unit
344
+ }
345
+ def numValVW@(optional):double (to_double numStrVW)
346
+ if numValVW {
347
+ unit.value = (unwrap numValVW)
348
+ unit.unitType = 7
349
+ unit.isSet = true
350
+ }
351
+ return unit
352
+ }
353
+ if (suffix == "vh") {
354
+ def numStrVH:string (substring trimmed 0 (len - 2))
355
+ if (EVGUnit.isNumeric(numStrVH) == false) {
356
+ return unit
357
+ }
358
+ def numValVH@(optional):double (to_double numStrVH)
359
+ if numValVH {
360
+ unit.value = (unwrap numValVH)
361
+ unit.unitType = 8
362
+ unit.isSet = true
363
+ }
364
+ return unit
365
+ }
366
+ }
367
+
368
+ ; Default: treat as pixels — but only for something that really is a
369
+ ; bare number. to_double stops at the first character it cannot use, so
370
+ ; without this guard every unit the parser does not know ("10vw",
371
+ ; "4ch") would quietly turn into that many pixels.
372
+ if ((EVGUnit.isAlpha(lastChar)) || (lastChar == 41)) {
373
+ return unit
374
+ }
375
+ def numVal@(optional):double (to_double trimmed)
376
+ if numVal {
377
+ unit.value = (unwrap numVal)
378
+ unit.pixels = unit.value ; For pixels, set pixels immediately
379
+ unit.unitType = 0
380
+ unit.isSet = true
381
+ }
382
+ return unit
383
+ }
384
+
385
+ fn resolve:void (parentSize:double fontSize:double) {
386
+ ; Resolve unit to actual pixel value
387
+ if (isSet == false) {
388
+ ; Only a unit that WAS set and was then unset in place can have a
389
+ ; stale pixel value; the shared unset unit never does, and is not
390
+ ; written to.
391
+ if (pixels != 0.0) {
392
+ pixels = 0.0
393
+ }
394
+ return
395
+ }
396
+
397
+ ; PIXELS
398
+ if (unitType == 0) {
399
+ pixels = value
400
+ return
401
+ }
402
+
403
+ ; PERCENT
404
+ if (unitType == 1) {
405
+ pixels = ((parentSize * value) / 100.0)
406
+ return
407
+ }
408
+
409
+ ; EM
410
+ if (unitType == 2) {
411
+ pixels = (fontSize * value)
412
+ return
413
+ }
414
+
415
+ ; REM - against the root font size, not this element's
416
+ if (unitType == 5) {
417
+ pixels = (rootFontSize * value)
418
+ return
419
+ }
420
+
421
+ ; HEIGHT_PERCENT (resolved separately with height)
422
+ if (unitType == 3) {
423
+ pixels = ((parentSize * value) / 100.0)
424
+ return
425
+ }
426
+
427
+ ; VIEWPORT_WIDTH / VIEWPORT_HEIGHT. The parent is not consulted: that
428
+ ; is the whole point of the unit, and it is what makes `100vh` on a
429
+ ; nested box mean the screen rather than whatever box it happens to be
430
+ ; sitting in.
431
+ if (unitType == 7) {
432
+ pixels = ((viewportW * value) / 100.0)
433
+ return
434
+ }
435
+ if (unitType == 8) {
436
+ pixels = ((viewportH * value) / 100.0)
437
+ return
438
+ }
439
+
440
+ ; FILL - resolved by layout engine
441
+ if (unitType == 4) {
442
+ pixels = parentSize
443
+ return
444
+ }
445
+
446
+ pixels = value
447
+ }
448
+
449
+ fn resolveForHeight:void (parentWidth:double parentHeight:double fontSize:double) {
450
+ ; Resolve unit for HEIGHT property - percent uses parentHeight
451
+ if (isSet == false) {
452
+ if (pixels != 0.0) {
453
+ pixels = 0.0
454
+ }
455
+ return
456
+ }
457
+
458
+ if (unitType == 3) {
459
+ ; HEIGHT_PERCENT uses parent height
460
+ pixels = ((parentHeight * value) / 100.0)
461
+ return
462
+ }
463
+
464
+ ; For percentage on height property, use parentHeight
465
+ if (unitType == 1) {
466
+ pixels = ((parentHeight * value) / 100.0)
467
+ return
468
+ }
469
+
470
+ ; For other types (px, em), use normal resolve
471
+ this.resolve(parentWidth fontSize)
472
+ }
473
+
474
+ fn resolveWithHeight:void (parentWidth:double parentHeight:double fontSize:double) {
475
+ ; Resolve unit using width as primary (for width property)
476
+ if (isSet == false) {
477
+ if (pixels != 0.0) {
478
+ pixels = 0.0
479
+ }
480
+ return
481
+ }
482
+
483
+ if (unitType == 3) {
484
+ ; HEIGHT_PERCENT uses parent height
485
+ pixels = ((parentHeight * value) / 100.0)
486
+ return
487
+ }
488
+
489
+ ; For other types, use width
490
+ this.resolve(parentWidth fontSize)
491
+ }
492
+
493
+ fn isPixels:boolean () {
494
+ return (unitType == 0)
495
+ }
496
+
497
+ fn isPercent:boolean () {
498
+ return (unitType == 1)
499
+ }
500
+
501
+ fn isEm:boolean () {
502
+ return (unitType == 2)
503
+ }
504
+
505
+ fn isRem:boolean () {
506
+ return (unitType == 5)
507
+ }
508
+
509
+ fn isHeightPercent:boolean () {
510
+ return (unitType == 3)
511
+ }
512
+
513
+ fn isFill:boolean () {
514
+ return (unitType == 4)
515
+ }
516
+
517
+ fn isViewport:boolean () {
518
+ if (unitType == 7) {
519
+ return true
520
+ }
521
+ return (unitType == 8)
522
+ }
523
+
524
+ fn toString:string () {
525
+ if (isSet == false) {
526
+ return "unset"
527
+ }
528
+ if (unitType == 0) {
529
+ return ((to_string value) + "px")
530
+ }
531
+ if (unitType == 1) {
532
+ return ((to_string value) + "%")
533
+ }
534
+ if (unitType == 2) {
535
+ return ((to_string value) + "em")
536
+ }
537
+ if (unitType == 3) {
538
+ return ((to_string value) + "hp")
539
+ }
540
+ if (unitType == 4) {
541
+ return "fill"
542
+ }
543
+ if (unitType == 5) {
544
+ return ((to_string value) + "rem")
545
+ }
546
+ if (unitType == 7) {
547
+ return ((to_string value) + "vw")
548
+ }
549
+ if (unitType == 8) {
550
+ return ((to_string value) + "vh")
551
+ }
552
+ return (to_string value)
553
+ }
554
+ }