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,83 @@
1
+ ; SPDX-License-Identifier: MIT
2
+ ; Native wall-clock bench for EvgBitmapTracer (meant for -l=cpp).
3
+ Import "../EvgBitmapTracer.rgr"
4
+
5
+ class EvgTraceCppBench {
6
+ sfn makeChecker:EvgBinaryBitmap (n:int cell:int) {
7
+ def bm:EvgBinaryBitmap (EvgBinaryBitmap.create(n n))
8
+ def y:int 0
9
+ while (y < n) {
10
+ def x:int 0
11
+ while (x < n) {
12
+ def cellSum:int ((idiv x cell) + (idiv y cell))
13
+ if (((cellSum - ((idiv cellSum 2) * 2)) == 0)) {
14
+ bm.setBit(x y true)
15
+ }
16
+ x = (x + 1)
17
+ }
18
+ y = (y + 1)
19
+ }
20
+ return bm
21
+ }
22
+
23
+ sfn makeRect:EvgBinaryBitmap (n:int) {
24
+ def m:int (idiv n 8)
25
+ def bm:EvgBinaryBitmap (EvgBinaryBitmap.create(n n))
26
+ def y:int m
27
+ while (y < (n - m)) {
28
+ def x:int m
29
+ while (x < (n - m)) {
30
+ bm.setBit(x y true)
31
+ x = (x + 1)
32
+ }
33
+ y = (y + 1)
34
+ }
35
+ return bm
36
+ }
37
+
38
+ sfn makeRing:EvgBinaryBitmap (n:int) {
39
+ def bm:EvgBinaryBitmap (EvgTraceCppBench.makeRect(n))
40
+ def m:int (idiv n 4)
41
+ def y:int m
42
+ while (y < (n - m)) {
43
+ def x:int m
44
+ while (x < (n - m)) {
45
+ bm.setBit(x y false)
46
+ x = (x + 1)
47
+ }
48
+ y = (y + 1)
49
+ }
50
+ return bm
51
+ }
52
+
53
+ sfn run:void (name:string bm:EvgBinaryBitmap iters:int) {
54
+ def opts:EvgTraceOptions (EvgTraceOptions.defaults())
55
+ opts.turdsize = 2
56
+ opts.optcurve = true
57
+ opts.alphamax = 1.0
58
+ opts.opttolerance = 0.2
59
+ def warm:EvgBitmapTracer (EvgBitmapTracer.fromBinary(bm opts))
60
+ warm.trace()
61
+ def t0:double (wall_clock_ms)
62
+ def i:int 0
63
+ def last:EvgBitmapTracer warm
64
+ while (i < iters) {
65
+ def tr:EvgBitmapTracer (EvgBitmapTracer.fromBinary(bm opts))
66
+ tr.trace()
67
+ last = tr
68
+ i = (i + 1)
69
+ }
70
+ def t1:double (wall_clock_ms)
71
+ def total:double (t1 - t0)
72
+ def per:double (total / (to_double iters))
73
+ def d:string (last.getPathData())
74
+ print ("CPP_BENCH name=" + name + " iters=" + (to_string iters) + " total_ms=" + (to_string total) + " per_ms=" + (to_string per) + " rings=" + (to_string (last.ringCount())) + " pathChars=" + (to_string (strlen d)))
75
+ }
76
+
77
+ sfn m@(main):void () {
78
+ EvgTraceCppBench.run("rect_256" (EvgTraceCppBench.makeRect(256)) 80)
79
+ EvgTraceCppBench.run("checker_128" (EvgTraceCppBench.makeChecker(128 8)) 50)
80
+ EvgTraceCppBench.run("ring_128" (EvgTraceCppBench.makeRing(128)) 80)
81
+ print "CPP_BENCH_DONE"
82
+ }
83
+ }
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env bash
2
+ # ==============================================================================
3
+ # run_trace_bench.sh — unit tests + timing vs npm/CLI potrace
4
+ # ==============================================================================
5
+ set -u
6
+ ROOT="$(cd "$(dirname "$0")/../../.." && pwd)"
7
+ cd "$ROOT"
8
+ OUT=".evg_trace_out"
9
+ mkdir -p "$OUT"
10
+
11
+ status=0
12
+
13
+ echo "### evg/bitmap_tracer (unit)"
14
+ if ! RANGER_LIB=./compiler/Lang.rgr:./lib/stdops.rgr \
15
+ node dist/rgrc.js -es6 lib/evg/EvgBitmapTracerTest.rgr \
16
+ -d="$OUT" -o=EvgBitmapTracerTest.js -nodecli >"$OUT/test_compile.log" 2>&1; then
17
+ echo " COMPILE FAIL EvgBitmapTracerTest"
18
+ tail -40 "$OUT/test_compile.log"
19
+ exit 1
20
+ fi
21
+ # The compiler prints [FAIL] and still exits 0, so the exit code above is not
22
+ # enough: without this the script happily runs the PREVIOUS build and reports a
23
+ # pass for code that never compiled.
24
+ if grep -q '\[FAIL\]' "$OUT/test_compile.log"; then
25
+ echo " COMPILE FAIL EvgBitmapTracerTest (compiler reported [FAIL])"
26
+ grep -m 20 '\[FAIL\]' "$OUT/test_compile.log"
27
+ exit 1
28
+ fi
29
+ test_out="$(node "$OUT/EvgBitmapTracerTest.js" 2>&1)"
30
+ echo "$test_out" | grep -E "FAIL |PASS |passed=" || true
31
+ if ! echo "$test_out" | grep -q "ALL PASS"; then
32
+ echo "$test_out"
33
+ status=1
34
+ fi
35
+
36
+ echo
37
+ echo "### evg/bitmap_tracer (bench cases)"
38
+ if ! RANGER_LIB=./compiler/Lang.rgr:./lib/stdops.rgr \
39
+ node dist/rgrc.js -es6 lib/evg/tools/evg_trace_bench.rgr \
40
+ -d="$OUT" -o=evg_trace_bench.js -nodecli >"$OUT/bench_compile.log" 2>&1; then
41
+ echo " COMPILE FAIL evg_trace_bench"
42
+ tail -40 "$OUT/bench_compile.log"
43
+ exit 1
44
+ fi
45
+ if [ ! -f "$OUT/evg_trace_bench.js" ]; then
46
+ echo " COMPILE FAIL evg_trace_bench (no output file)"
47
+ tail -40 "$OUT/bench_compile.log"
48
+ exit 1
49
+ fi
50
+
51
+ t0="$(node -e 'process.stdout.write(String(process.hrtime.bigint()))')"
52
+ bench_out="$(node "$OUT/evg_trace_bench.js" 2>&1)"
53
+ t1="$(node -e 'process.stdout.write(String(process.hrtime.bigint()))')"
54
+ echo "$bench_out" | tee "$OUT/bench_ranger.log"
55
+ ms="$(node -e "const a=BigInt(process.argv[1]); const b=BigInt(process.argv[2]); console.log(((Number(b-a))/1e6).toFixed(2))" "$t0" "$t1")"
56
+ echo "BENCH_RANGER_WALL_MS $ms" | tee -a "$OUT/bench_ranger.log"
57
+ if ! echo "$bench_out" | grep -q "BENCH_DONE"; then
58
+ status=1
59
+ fi
60
+
61
+ echo
62
+ echo "### comparison vs potrace (optional)"
63
+ if ! node lib/evg/tools/bench_vs_potrace.mjs "$OUT"; then
64
+ echo " FAIL quality/topology vs CLI potrace"
65
+ status=1
66
+ fi
67
+
68
+ echo "=============================================================="
69
+ if [ "$status" -eq 0 ]; then
70
+ echo "evg bitmap tracer ALL GREEN"
71
+ else
72
+ echo "evg bitmap tracer FAILURES"
73
+ fi
74
+ exit "$status"
@@ -0,0 +1,128 @@
1
+ #!/usr/bin/env bash
2
+ # ==============================================================================
3
+ # run_trace_cli_smoke.sh — build evg-trace for every target and check they agree
4
+ # ==============================================================================
5
+ #
6
+ # The point of compiling one tracer to four runtimes is that it is one tracer.
7
+ # This asserts that: the same input through the Node, Python, C++ and Rust
8
+ # builds has to come out byte for byte the same SVG. A target-specific
9
+ # difference in integer division, string formatting or float printing shows up
10
+ # here as a differing file rather than as a picture somebody notices months
11
+ # later.
12
+ #
13
+ # npm run evg:trace:cli:smoke
14
+ #
15
+ # Python, C++ and Rust are skipped (not failed) when their toolchain is absent.
16
+ set -u
17
+ ROOT="$(cd "$(dirname "$0")/../../.." && pwd)"
18
+ cd "$ROOT"
19
+ OUT=".evg_trace_out/cli"
20
+ mkdir -p "$OUT"
21
+ SAMPLE="lib/evg/web/tracer/sample.png"
22
+ ARGS=(--preset broken)
23
+ status=0
24
+ export RANGER_LIB=./compiler/Lang.rgr:./lib/stdops.rgr
25
+
26
+ compile () { # lang outfile
27
+ node dist/rgrc.js "-l=$1" lib/evg/tools/evg_trace_cli.rgr \
28
+ -d=lib/evg/bin "-o=$2" -nodecli >"$OUT/compile_$1.log" 2>&1
29
+ if grep -q '\[FAIL\]' "$OUT/compile_$1.log"; then
30
+ echo " COMPILE FAIL ($1)"; grep -m 10 '\[FAIL\]' "$OUT/compile_$1.log"; return 1
31
+ fi
32
+ }
33
+
34
+ echo "### evg-trace (node)"
35
+ if ! compile es6 evg_trace_cli.js; then exit 1; fi
36
+ node lib/evg/bin/evg_trace_cli.js "$SAMPLE" "$OUT/node.svg" "${ARGS[@]}" | sed 's/^/ /'
37
+ [ -s "$OUT/node.svg" ] || { echo " no output"; exit 1; }
38
+
39
+ echo
40
+ echo "### evg-trace (python)"
41
+ if command -v python3 >/dev/null 2>&1; then
42
+ if compile python evg_trace_cli.py; then
43
+ python3 lib/evg/bin/evg_trace_cli.py "$SAMPLE" "$OUT/python.svg" "${ARGS[@]}" | sed 's/^/ /'
44
+ if cmp -s "$OUT/node.svg" "$OUT/python.svg"; then
45
+ echo " identical to the node build"
46
+ else
47
+ echo " DIFFERS from the node build"; status=1
48
+ fi
49
+ else status=1; fi
50
+ else
51
+ echo " skip (no python3)"
52
+ fi
53
+
54
+ echo
55
+ echo "### evg-trace (c++)"
56
+ if command -v g++ >/dev/null 2>&1; then
57
+ if compile cpp evg_trace_cli.cpp; then
58
+ if g++ -O2 -std=c++17 -o lib/evg/bin/evg_trace_cli \
59
+ lib/evg/bin/evg_trace_cli.cpp 2>"$OUT/gxx.log"; then
60
+ ./lib/evg/bin/evg_trace_cli "$SAMPLE" "$OUT/cpp.svg" "${ARGS[@]}" | sed 's/^/ /'
61
+ if cmp -s "$OUT/node.svg" "$OUT/cpp.svg"; then
62
+ echo " identical to the node build"
63
+ else
64
+ echo " DIFFERS from the node build"; status=1
65
+ fi
66
+ else
67
+ echo " g++ FAILED"; tail -20 "$OUT/gxx.log"; status=1
68
+ fi
69
+ else status=1; fi
70
+ else
71
+ echo " skip (no g++)"
72
+ fi
73
+
74
+ echo
75
+ echo "### evg-trace (rust)"
76
+ if command -v rustc >/dev/null 2>&1; then
77
+ if compile rust evg_trace_cli.rs; then
78
+ if rustc --edition 2021 -O -o lib/evg/bin/evg_trace_cli_rust \
79
+ lib/evg/bin/evg_trace_cli.rs 2>"$OUT/rustc.log"; then
80
+ ./lib/evg/bin/evg_trace_cli_rust "$SAMPLE" "$OUT/rust.svg" "${ARGS[@]}" | sed 's/^/ /'
81
+ if cmp -s "$OUT/node.svg" "$OUT/rust.svg"; then
82
+ echo " identical to the node build"
83
+ else
84
+ echo " DIFFERS from the node build"; status=1
85
+ fi
86
+ else
87
+ echo " rustc FAILED"; grep -m 20 -E "^error" "$OUT/rustc.log"; status=1
88
+ fi
89
+ else status=1; fi
90
+ else
91
+ echo " skip (no rustc)"
92
+ fi
93
+
94
+ echo
95
+ echo "### argument order"
96
+ # The two paths have to be accepted wherever they fall among the options.
97
+ # `in.png --colorCount 4 out.svg` reading --colorCount as the output path is
98
+ # what this is here to stop coming back.
99
+ for form in "SRC --colorCount 4 DST" "SRC DST --colorCount 4" "--colorCount 4 SRC DST" "SRC DST --colorCount=4"; do
100
+ args=${form//SRC/$SAMPLE}
101
+ out="$OUT/order.svg"
102
+ args=${args//DST/$out}
103
+ rm -f "$out"
104
+ if ! node lib/evg/bin/evg_trace_cli.js $args >/dev/null 2>&1 || [ ! -s "$out" ]; then
105
+ echo " FAILED: $form"; status=1; continue
106
+ fi
107
+ if [ -n "${orderRef:-}" ]; then
108
+ cmp -s "$orderRef" "$out" || { echo " DIFFERS: $form"; status=1; }
109
+ else
110
+ orderRef="$OUT/order_ref.svg"; cp "$out" "$orderRef"
111
+ fi
112
+ done
113
+ [ "$status" -eq 0 ] && echo " every order gives the same file"
114
+
115
+ echo "### bad input"
116
+ if node lib/evg/bin/evg_trace_cli.js "$OUT/no-such-file.png" "$OUT/x.svg" 2>&1 | grep -q "no such file"; then
117
+ echo " a missing input is one line, not a stack trace"
118
+ else
119
+ echo " a missing input did not report cleanly"; status=1
120
+ fi
121
+
122
+ echo
123
+ if [ "$status" -eq 0 ]; then
124
+ echo "evg-trace CLI ALL GREEN"
125
+ else
126
+ echo "evg-trace CLI FAILED"
127
+ fi
128
+ exit "$status"
@@ -0,0 +1,271 @@
1
+ ; SPDX-License-Identifier: MIT
2
+
3
+ ; ==============================================================================
4
+ ; EvgResponsiveCheck — the responsive page, laid out at four widths, no browser
5
+ ; ==============================================================================
6
+ ;
7
+ ; npm run evg:responsive:check
8
+ ;
9
+ ; The page in `EvgResponsiveDemo.rgr` is meant to be dragged, and a layout that
10
+ ; is only ever checked by dragging it is a layout nobody checks. So this runs
11
+ ; the same `render()` the browser calls, at four widths chosen to sit either
12
+ ; side of the three breakpoints, and asserts the things the `@media` blocks are
13
+ ; supposed to do:
14
+ ;
15
+ ; 1280px four cards across, sidebar beside the content
16
+ ; 1000px three across
17
+ ; 760px two across, and the sidebar has moved above the content
18
+ ; 420px one across
19
+ ;
20
+ ; It counts CARD COLUMNS by grouping the laid-out cards by their `y`, which is
21
+ ; the only definition that does not just restate the stylesheet: however the
22
+ ; grid decided to place them, the cards sharing the top row ARE the columns.
23
+ ;
24
+ ; The sidebar test is the same kind: at 1280 the sidebar and the content start
25
+ ; on the same line and the sidebar is the narrower of the two; at 760 the
26
+ ; sidebar is above and as wide as the content. Neither reads a CSS property
27
+ ; back — they read where the boxes ended up.
28
+ ; ==============================================================================
29
+
30
+ Import "EvgResponsiveDemo.rgr"
31
+ Import "../../EVGElement.rgr"
32
+ Import "../../EVGLayout.rgr"
33
+ Import "../../EVGStyleSheet.rgr"
34
+
35
+ class EvgResponsiveCheck {
36
+
37
+ def passed:int 0
38
+ def failed:int 0
39
+
40
+ Constructor () {
41
+ }
42
+
43
+ fn ok:void (name:string cond:boolean) {
44
+ if cond {
45
+ passed = (passed + 1)
46
+ print (" PASS " + name)
47
+ } {
48
+ failed = (failed + 1)
49
+ print (" FAIL " + name)
50
+ }
51
+ }
52
+
53
+ fn eqInt:void (name:string got:int want:int) {
54
+ def good:boolean (got == want)
55
+ if (good == false) {
56
+ print (((" got " + (to_string got)) + " want ") + (to_string want))
57
+ }
58
+ this.ok(name good)
59
+ }
60
+
61
+ ; `className` is a space-separated list, so "chip" must not match
62
+ ; "chip-wide". Padding both sides is the whole-token test, and it is two
63
+ ; lines rather than a split.
64
+ fn hasClass:boolean (el:EVGElement cls:string) {
65
+ def haystack:string ((" " + el.className) + " ")
66
+ def needle:string ((" " + cls) + " ")
67
+ return ((indexOf haystack needle) >= 0)
68
+ }
69
+
70
+ ; Every element in the tree carrying `cls` among its classes.
71
+ fn collect:void (el:EVGElement cls:string out:[EVGElement]) {
72
+ if (this.hasClass(el cls)) {
73
+ push out el
74
+ }
75
+ def c:int 0
76
+ def n:int (el.getChildCount())
77
+ while (c < n) {
78
+ this.collect((el.getChild(c)) cls out)
79
+ c = (c + 1)
80
+ }
81
+ }
82
+
83
+ fn find:[EVGElement] (root:EVGElement cls:string) {
84
+ def out:[EVGElement]
85
+ this.collect(root cls out)
86
+ return out
87
+ }
88
+
89
+ ; How many boxes share the topmost row. A grid column count, derived from
90
+ ; the geometry rather than from the declaration that produced it.
91
+ fn topRowCount:int (els:[EVGElement]) {
92
+ if ((array_length els) == 0) {
93
+ return 0
94
+ }
95
+ def top:double 999999.0
96
+ def i:int 0
97
+ while (i < (array_length els)) {
98
+ def e:EVGElement (itemAt els i)
99
+ if (e.calculatedY < top) {
100
+ top = e.calculatedY
101
+ }
102
+ i = (i + 1)
103
+ }
104
+ def count:int 0
105
+ def j:int 0
106
+ while (j < (array_length els)) {
107
+ def e2:EVGElement (itemAt els j)
108
+ if ((e2.calculatedY - top) < 1.0) {
109
+ count = (count + 1)
110
+ }
111
+ j = (j + 1)
112
+ }
113
+ return count
114
+ }
115
+
116
+ ; The tree as the browser would get it at this width: built, styled against
117
+ ; the stated viewport, and laid out.
118
+ fn layoutAt:EVGElement (w:double h:double coarse:boolean) {
119
+ def demo (new EvgResponsiveDemo())
120
+ demo.setViewport(w h coarse)
121
+ def root:EVGElement (demo.build())
122
+ def sheet (new EVGStyleSheet())
123
+ sheet.parse((demo.stylesheet()))
124
+ sheet.setViewport(w h coarse)
125
+ sheet.applyTree(root "")
126
+ def lay (new EVGLayout())
127
+ lay.setPageSize(w h)
128
+ lay.layout(root)
129
+ return root
130
+ }
131
+
132
+ fn columnsAt:int (w:double) {
133
+ def root:EVGElement (this.layoutAt(w 900.0 false))
134
+ def cards:[EVGElement] (this.find(root "card"))
135
+ return (this.topRowCount(cards))
136
+ }
137
+
138
+ fn run:void () {
139
+ print "EvgResponsiveCheck"
140
+
141
+ ; --- the stylesheet parses at all -------------------------------------
142
+ def sheet (new EVGStyleSheet())
143
+ sheet.parse((EvgResponsiveDemo.defaultCss()))
144
+ this.eqInt("stylesheet parses with no errors" (array_length sheet.errors) 0)
145
+
146
+ ; --- the grid changes how many columns it has -------------------------
147
+ this.eqInt("1280px -> four cards across" (this.columnsAt(1280.0)) 4)
148
+ this.eqInt("1000px -> three across" (this.columnsAt(1000.0)) 3)
149
+ this.eqInt("760px -> two across" (this.columnsAt(760.0)) 2)
150
+ this.eqInt("420px -> one across" (this.columnsAt(420.0)) 1)
151
+
152
+ ; --- a page with no viewport is a page with no @media -----------------
153
+ ;
154
+ ; The sheet refuses to guess: with the viewport left at zero, every
155
+ ; conditional rule is inert and the page is its wide self. This is the
156
+ ; rule `EVGStyleSheet`'s header states, checked rather than trusted.
157
+ def bare (new EvgResponsiveDemo())
158
+ def bareRoot:EVGElement (bare.build())
159
+ def bareSheet (new EVGStyleSheet())
160
+ bareSheet.parse((bare.stylesheet()))
161
+ bareSheet.applyTree(bareRoot "")
162
+ def bareLay (new EVGLayout())
163
+ bareLay.setPageSize(420.0 900.0)
164
+ bareLay.layout(bareRoot)
165
+ def bareCards:[EVGElement] (this.find(bareRoot "card"))
166
+ this.eqInt("no viewport stated -> no @media block applies"
167
+ (this.topRowCount(bareCards)) 4)
168
+
169
+ ; --- the sidebar moves ------------------------------------------------
170
+ def wide:EVGElement (this.layoutAt(1280.0 900.0 false))
171
+ def wSide:[EVGElement] (this.find(wide "side"))
172
+ def wMain:[EVGElement] (this.find(wide "main"))
173
+ def ws:EVGElement (itemAt wSide 0)
174
+ def wm:EVGElement (itemAt wMain 0)
175
+ this.ok("1280px: sidebar beside the content"
176
+ (((ws.calculatedY - wm.calculatedY) < 1.0)
177
+ && ((wm.calculatedY - ws.calculatedY) < 1.0)))
178
+ this.ok("1280px: sidebar is the narrow one"
179
+ (ws.calculatedWidth < wm.calculatedWidth))
180
+
181
+ def narrow:EVGElement (this.layoutAt(760.0 900.0 false))
182
+ def nSide:[EVGElement] (this.find(narrow "side"))
183
+ def nMain:[EVGElement] (this.find(narrow "main"))
184
+ def ns:EVGElement (itemAt nSide 0)
185
+ def nm:EVGElement (itemAt nMain 0)
186
+ this.ok("760px: sidebar above the content"
187
+ ((ns.calculatedY + ns.calculatedHeight) <= (nm.calculatedY + 1.0)))
188
+ this.ok("760px: sidebar as wide as the content"
189
+ ((ns.calculatedWidth - nm.calculatedWidth) < 1.0))
190
+
191
+ ; --- 4vw is a share of the PAGE, not of the parent ---------------------
192
+ ;
193
+ ; The hero's left padding is declared once, in `vw`, and is a different
194
+ ; number of pixels at every width. A percentage could not do this: the
195
+ ; hero's parent is as wide as the page, so `4%` would agree here by
196
+ ; accident — and stop agreeing the moment anything was nested.
197
+ def heroWide:[EVGElement] (this.find(wide "hero"))
198
+ def heroNarrow:[EVGElement] (this.find(narrow "hero"))
199
+ def hw:EVGElement (itemAt heroWide 0)
200
+ def hn:EVGElement (itemAt heroNarrow 0)
201
+ this.eqInt("1280px: hero padding-left is 4vw" (to_int hw.box.paddingLeftPx) 51)
202
+ this.eqInt("760px: hero padding-left is 4vw" (to_int hn.box.paddingLeftPx) 30)
203
+
204
+ ; --- (pointer: coarse) --------------------------------------------------
205
+ def mouse:EVGElement (this.layoutAt(1280.0 900.0 false))
206
+ def finger:EVGElement (this.layoutAt(1280.0 900.0 true))
207
+ def mItems:[EVGElement] (this.find(mouse "nav-item"))
208
+ def fItems:[EVGElement] (this.find(finger "nav-item"))
209
+ def mi:EVGElement (itemAt mItems 0)
210
+ def fi:EVGElement (itemAt fItems 0)
211
+ this.ok("a finger gets taller nav rows than a mouse"
212
+ (fi.calculatedHeight > mi.calculatedHeight))
213
+
214
+ ; --- the page is STABLE across widths, not just correct at four -------
215
+ ;
216
+ ; The defect this exists for was invisible at any single width: the
217
+ ; sidebar and the content are a flex row, `.main` is `flex: 1`, and its
218
+ ; width is computed out of the same line it is then measured against.
219
+ ; Adding the parts back up could land one ulp over the whole, so the row
220
+ ; wrapped — at 127 of the 680 integer widths between 821 and 1500,
221
+ ; scattered, which on a dragged window edge is a flicker rather than a
222
+ ; layout. `EVGLayout`'s wrap test now has a sub-pixel tolerance and
223
+ ; `lib/evg/EVGFlexWrapTest.rgr` guards it in the engine; this is the
224
+ ; same question asked of THIS page, at quarter-pixel steps because a
225
+ ; `4vw` padding and a device pixel ratio both produce fractional widths.
226
+ def flickers:int 0
227
+ def sw:double 830.0
228
+ while (sw <= 1600.0) {
229
+ def r:EVGElement (this.layoutAt(sw 900.0 false))
230
+ def sSide:[EVGElement] (this.find(r "side"))
231
+ def sMain:[EVGElement] (this.find(r "main"))
232
+ def s1:EVGElement (itemAt sSide 0)
233
+ def m1:EVGElement (itemAt sMain 0)
234
+ def dy:double (m1.calculatedY - s1.calculatedY)
235
+ if (dy < 0.0) {
236
+ dy = (0.0 - dy)
237
+ }
238
+ if (dy >= 1.0) {
239
+ flickers = (flickers + 1)
240
+ if (flickers < 6) {
241
+ print (" sidebar wrapped at width " + (to_string sw))
242
+ }
243
+ }
244
+ sw = (sw + 0.25)
245
+ }
246
+ this.eqInt("above 820px the sidebar never wraps below the content" flickers 0)
247
+
248
+ ; --- the page still renders -------------------------------------------
249
+ def demo (new EvgResponsiveDemo())
250
+ demo.setViewport(420.0 900.0 false)
251
+ def json:string (demo.render())
252
+ this.ok("420px: the display list is not empty" ((demo.commandCount()) > 40))
253
+ this.ok("420px: the page is taller than the window"
254
+ ((demo.contentHeight()) > 900.0))
255
+ this.ok("420px: JSON carries the measured height"
256
+ ((indexOf json "\"height\":") > 0))
257
+
258
+ print ""
259
+ print ((("Passed: " + (to_string passed)) + " Failed: ") + (to_string failed))
260
+ if (failed > 0) {
261
+ print "FAILED"
262
+ } {
263
+ print "OK"
264
+ }
265
+ }
266
+
267
+ sfn m@(main):void () {
268
+ def c (new EvgResponsiveCheck())
269
+ c.run()
270
+ }
271
+ }