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,289 @@
1
+ ; SPDX-License-Identifier: MIT
2
+
3
+ ; ==============================================================================
4
+ ; EVGFixedTest — `position: fixed`
5
+ ; ==============================================================================
6
+ ;
7
+ ; `fixed` used to be read from a stylesheet and turned into `absolute`, because
8
+ ; nothing modelled a viewport separate from the root. Two things make the real
9
+ ; mode cheap: `viewportW`/`viewportH` are already inherited down every element,
10
+ ; so the containing block is a field away; and a scroll is ONE translation over
11
+ ; a subtree, so leaving a box out of it is one branch.
12
+ ;
13
+ ; What is asserted, in order of how badly each one bites when it is wrong:
14
+ ;
15
+ ; * it takes no space in its parent's flow, the way an absolute box does not;
16
+ ; * `top`/`left` are measured from the PAGE, not from the parent — a bar 64
17
+ ; tall with `bottom: 0` sits on the bottom of the viewport whatever box it
18
+ ; was written inside;
19
+ ; * a percentage inside it resolves against the page, not against the parent;
20
+ ; * and A SCROLL DOES NOT MOVE IT. That is the whole mode: the content slides
21
+ ; under the furniture. Both scroll paths are checked — the full layout's
22
+ ; `applyScroll` and the incremental `scrollOnlyFrom` — because a rule kept
23
+ ; in one of the two holds until the frame after the first one.
24
+ ; ==============================================================================
25
+
26
+ Import "EVGElement.rgr"
27
+ Import "EVGUnit.rgr"
28
+ Import "EVGLayout.rgr"
29
+
30
+ class FixedCheck {
31
+ def passed:int 0
32
+ def failed:int 0
33
+
34
+ fn ok:void (name:string cond:boolean) {
35
+ if cond {
36
+ passed = (passed + 1)
37
+ print (" PASS " + name)
38
+ } {
39
+ failed = (failed + 1)
40
+ print (" FAIL " + name)
41
+ }
42
+ }
43
+
44
+ fn eqInt:void (name:string got:int want:int) {
45
+ def good:boolean (got == want)
46
+ if (good == false) {
47
+ print (" got " + (to_string got) + " want " + (to_string want))
48
+ }
49
+ this.ok(name good)
50
+ }
51
+ }
52
+
53
+ class EVGFixedTest {
54
+
55
+ sfn box:EVGElement (id:string w:double h:double) {
56
+ def el (EVGElement.createDiv())
57
+ el.id = id
58
+ el.setAttribute("width" ((to_string (to_int w)) + "px"))
59
+ el.setAttribute("height" ((to_string (to_int h)) + "px"))
60
+ return el
61
+ }
62
+
63
+ sfn laidOut:EVGLayout (root:EVGElement) {
64
+ def lay (new EVGLayout())
65
+ lay.setPageSize(400.0 800.0)
66
+ lay.layout(root)
67
+ return lay
68
+ }
69
+
70
+ ; A page with a column in it, the column holding two rows and a bar that
71
+ ; is fixed to the bottom of the PAGE — not of the column, which is what
72
+ ; makes the mode worth having.
73
+ sfn buildPage:EVGElement () {
74
+ def page:EVGElement (EVGFixedTest.box("page" 400.0 800.0))
75
+ page.setAttribute("flex-direction" "column")
76
+ def col:EVGElement (EVGFixedTest.box("col" 300.0 500.0))
77
+ col.setAttribute("flex-direction" "column")
78
+ col.setAttribute("margin-left" "50px")
79
+ col.setAttribute("margin-top" "100px")
80
+ col.addChild((EVGFixedTest.box("row1" 300.0 60.0)))
81
+ col.addChild((EVGFixedTest.box("row2" 300.0 60.0)))
82
+ def bar:EVGElement (EVGFixedTest.box("bar" 400.0 64.0))
83
+ bar.setAttribute("position" "fixed")
84
+ bar.setAttribute("left" "0px")
85
+ bar.setAttribute("bottom" "0px")
86
+ col.addChild(bar)
87
+ page.addChild(col)
88
+ return page
89
+ }
90
+
91
+ sfn testOutOfFlow:void (c:FixedCheck) {
92
+ print ""
93
+ print "--- out of flow ---"
94
+ def page:EVGElement (EVGFixedTest.buildPage())
95
+ def lay:EVGLayout (EVGFixedTest.laidOut(page))
96
+ def col:EVGElement (page.getChild(0))
97
+ def row2:EVGElement (col.getChild(1))
98
+ c.ok("a fixed box is out of flow" ((col.getChild(2)).isAbsolute))
99
+ ; Two 60-tall rows, so the second ends 120 below the column's content
100
+ ; top. A bar that took space would have pushed nothing, but a bar that
101
+ ; was IN flow would have taken the 64 after it — this is the assertion
102
+ ; that says the rows are the only things the column stacked.
103
+ c.eqInt("the rows stack as if it were not there"
104
+ (to_int ((row2.calculatedY + row2.calculatedHeight) - col.calculatedY)) 120)
105
+ }
106
+
107
+ sfn testAgainstViewport:void (c:FixedCheck) {
108
+ print ""
109
+ print "--- positioned against the page ---"
110
+ def page:EVGElement (EVGFixedTest.buildPage())
111
+ def lay:EVGLayout (EVGFixedTest.laidOut(page))
112
+ def col:EVGElement (page.getChild(0))
113
+ def bar:EVGElement (col.getChild(2))
114
+ ; The column starts at x=50, y=100. An ABSOLUTE bar with left:0 would
115
+ ; be at the column's content corner; a fixed one is at the page's.
116
+ c.eqInt("left is the page's left" (to_int bar.calculatedX) 0)
117
+ c.eqInt("bottom is the page's bottom" (to_int bar.calculatedY) 736)
118
+ c.eqInt("and it is as wide as it asked" (to_int bar.calculatedWidth) 400)
119
+ }
120
+
121
+ sfn testPercentAgainstViewport:void (c:FixedCheck) {
122
+ print ""
123
+ print "--- a percentage inside it ---"
124
+ def page:EVGElement (EVGFixedTest.box("page" 400.0 800.0))
125
+ page.setAttribute("flex-direction" "column")
126
+ def col:EVGElement (EVGFixedTest.box("col" 200.0 400.0))
127
+ def bar (EVGElement.createDiv())
128
+ bar.id = "bar"
129
+ bar.setAttribute("position" "fixed")
130
+ bar.setAttribute("left" "0px")
131
+ bar.setAttribute("top" "0px")
132
+ bar.setAttribute("width" "50%")
133
+ bar.setAttribute("height" "40px")
134
+ col.addChild(bar)
135
+ page.addChild(col)
136
+ def lay:EVGLayout (EVGFixedTest.laidOut(page))
137
+ ; Half the PAGE, not half the 200-wide column it was written in.
138
+ c.eqInt("50% is half the page" (to_int bar.calculatedWidth) 200)
139
+ }
140
+
141
+ ; A scrolling panel with a fixed bar inside it. The rows move; the bar does
142
+ ; not. Both scroll paths, because there are two.
143
+ sfn buildScroller:EVGElement () {
144
+ def page:EVGElement (EVGFixedTest.box("page" 400.0 800.0))
145
+ page.setAttribute("flex-direction" "column")
146
+ def panel:EVGElement (EVGFixedTest.box("panel" 400.0 300.0))
147
+ panel.setAttribute("flex-direction" "column")
148
+ panel.setAttribute("overflow" "hidden")
149
+ def i:int 0
150
+ while (i < 10) {
151
+ panel.addChild((EVGFixedTest.box(("row" + (to_string i)) 400.0 60.0)))
152
+ i = (i + 1)
153
+ }
154
+ def bar:EVGElement (EVGFixedTest.box("bar" 400.0 64.0))
155
+ bar.setAttribute("position" "fixed")
156
+ bar.setAttribute("left" "0px")
157
+ bar.setAttribute("bottom" "0px")
158
+ panel.addChild(bar)
159
+ page.addChild(panel)
160
+ return page
161
+ }
162
+
163
+ sfn testStretch:void (c:FixedCheck) {
164
+ print ""
165
+ print "--- both edges and no size ---"
166
+ def page:EVGElement (EVGFixedTest.box("page" 400.0 800.0))
167
+ page.setAttribute("flex-direction" "column")
168
+ def col:EVGElement (EVGFixedTest.box("col" 200.0 400.0))
169
+ def bar (EVGElement.createDiv())
170
+ bar.id = "bar"
171
+ bar.setAttribute("position" "fixed")
172
+ bar.setAttribute("left" "16px")
173
+ bar.setAttribute("right" "16px")
174
+ bar.setAttribute("bottom" "16px")
175
+ bar.setAttribute("height" "64px")
176
+ col.addChild(bar)
177
+ page.addChild(col)
178
+ def lay:EVGLayout (EVGFixedTest.laidOut(page))
179
+ ; CSS 2.1 10.3.7: what is left of the containing block between them.
180
+ c.eqInt("it stretches between them" (to_int bar.calculatedWidth) 368)
181
+ c.eqInt("and starts at the left edge" (to_int bar.calculatedX) 16)
182
+ c.eqInt("and sits above the bottom" (to_int bar.calculatedY) 720)
183
+ }
184
+
185
+ sfn testScrollLeavesItAlone:void (c:FixedCheck) {
186
+ print ""
187
+ print "--- a scroll moves the content, not the furniture ---"
188
+ def page:EVGElement (EVGFixedTest.buildScroller())
189
+ def panel:EVGElement (page.getChild(0))
190
+ panel.scrollTop = 120.0
191
+ def lay:EVGLayout (EVGFixedTest.laidOut(page))
192
+ def row0:EVGElement (panel.getChild(0))
193
+ def bar:EVGElement (panel.getChild(10))
194
+ c.eqInt("the first row went up by the scroll" (to_int row0.calculatedY) (0 - 120))
195
+ c.eqInt("the bar stayed on the bottom" (to_int bar.calculatedY) 736)
196
+ }
197
+
198
+ sfn testScrollOnlyLeavesItAlone:void (c:FixedCheck) {
199
+ print ""
200
+ print "--- and the incremental path leaves it alone too ---"
201
+ def page:EVGElement (EVGFixedTest.buildScroller())
202
+ def panel:EVGElement (page.getChild(0))
203
+ def lay:EVGLayout (EVGFixedTest.laidOut(page))
204
+ def row0:EVGElement (panel.getChild(0))
205
+ def bar:EVGElement (panel.getChild(10))
206
+ def wasRow:double row0.calculatedY
207
+ def wasBar:double bar.calculatedY
208
+ panel.scrollTop = 90.0
209
+ lay.scrollOnlyFrom(panel)
210
+ c.eqInt("the row moved by the delta" (to_int (row0.calculatedY - wasRow)) (0 - 90))
211
+ c.eqInt("the bar did not move at all" (to_int (bar.calculatedY - wasBar)) 0)
212
+ }
213
+
214
+ ; --- a frame that is a viewport of its own -------------------------------------
215
+ ; Two frames side by side in one scene, each one a viewport root, each
216
+ ; holding a bar fixed to its bottom. Before this the two bars landed on
217
+ ; top of each other at the scene's own bottom-left, because there was one
218
+ ; viewport per layout and it was the page.
219
+ sfn buildStage:EVGElement () {
220
+ def scene:EVGElement (EVGFixedTest.box("scene" 1000.0 800.0))
221
+ scene.setAttribute("position" "relative")
222
+ def one:EVGElement (EVGFixedTest.box("one" 400.0 600.0))
223
+ one.setAttribute("position" "absolute")
224
+ one.setAttribute("left" "0px")
225
+ one.setAttribute("top" "0px")
226
+ one.viewportRoot = true
227
+ one.viewportW = 400.0
228
+ one.viewportH = 600.0
229
+ def bar1:EVGElement (EVGFixedTest.box("bar1" 400.0 50.0))
230
+ bar1.setAttribute("position" "fixed")
231
+ bar1.setAttribute("left" "0px")
232
+ bar1.setAttribute("bottom" "0px")
233
+ one.addChild(bar1)
234
+ def two:EVGElement (EVGFixedTest.box("two" 300.0 500.0))
235
+ two.setAttribute("position" "absolute")
236
+ two.setAttribute("left" "500px")
237
+ two.setAttribute("top" "40px")
238
+ two.viewportRoot = true
239
+ two.viewportW = 300.0
240
+ two.viewportH = 500.0
241
+ two.viewportX = 500.0
242
+ two.viewportY = 40.0
243
+ def bar2:EVGElement (EVGFixedTest.box("bar2" 300.0 50.0))
244
+ bar2.setAttribute("position" "fixed")
245
+ bar2.setAttribute("left" "0px")
246
+ bar2.setAttribute("bottom" "0px")
247
+ two.addChild(bar2)
248
+ scene.addChild(one)
249
+ scene.addChild(two)
250
+ return scene
251
+ }
252
+
253
+ sfn testViewportRoot:void (c:FixedCheck) {
254
+ print ""
255
+ print "--- a frame is a viewport of its own ---"
256
+ def scene:EVGElement (EVGFixedTest.buildStage())
257
+ def lay (new EVGLayout())
258
+ lay.setPageSize(1000.0 800.0)
259
+ lay.layout(scene)
260
+ def one:EVGElement (scene.getChild(0))
261
+ def two:EVGElement (scene.getChild(1))
262
+ def bar1:EVGElement (one.getChild(0))
263
+ def bar2:EVGElement (two.getChild(0))
264
+ c.eqInt("the first frame's bar starts at the scene's own left" (to_int bar1.calculatedX) 0)
265
+ c.eqInt("the second frame's bar starts at the second frame" (to_int bar2.calculatedX) 500)
266
+ c.eqInt("…and is as wide as that frame" (to_int bar2.calculatedWidth) 300)
267
+ c.eqInt("the first frame's bar is on ITS bottom" (to_int bar1.calculatedY) 550)
268
+ c.eqInt("…and the second frame's on its own, well above the scene's" (to_int bar2.calculatedY) 490)
269
+ }
270
+
271
+ sfn main:void () {
272
+ def c (new FixedCheck())
273
+ print "=== EVG position: fixed ==="
274
+ EVGFixedTest.testOutOfFlow(c)
275
+ EVGFixedTest.testAgainstViewport(c)
276
+ EVGFixedTest.testPercentAgainstViewport(c)
277
+ EVGFixedTest.testStretch(c)
278
+ EVGFixedTest.testScrollLeavesItAlone(c)
279
+ EVGFixedTest.testScrollOnlyLeavesItAlone(c)
280
+ EVGFixedTest.testViewportRoot(c)
281
+ print ""
282
+ print ("passed=" + (to_string c.passed) + " failed=" + (to_string c.failed))
283
+ if (c.failed > 0) {
284
+ print "FAILURES"
285
+ } {
286
+ print "ALL PASS"
287
+ }
288
+ }
289
+ }
@@ -0,0 +1,317 @@
1
+ ; SPDX-License-Identifier: MIT
2
+
3
+ ; ==============================================================================
4
+ ; EVGFlexRulesTest — the five flexbox rules the engine used to get wrong
5
+ ; ==============================================================================
6
+ ;
7
+ ; Each of these was found by laying the same CSS out twice — once here and once
8
+ ; in Chromium — and reading the two sets of boxes side by side
9
+ ; (`bench/layout-conformance.mjs`). They are kept here rather than only there
10
+ ; because the browser comparison needs a browser and this does not, and because
11
+ ; a number in a diff is not a statement of what the rule IS.
12
+ ;
13
+ ; 1. A `flex-basis` on an item that does not grow is still its size.
14
+ ; `flex-basis: 120px` fell past every branch of the row pass, the item was
15
+ ; laid out with no width and so filled the line, and the `flex: 1` sibling
16
+ ; beside it got nothing: 600 | 0 where a browser says 120 | 480.
17
+ ;
18
+ ; 2. min beats max. `width: 50; min-width: 200; max-width: 100` is 200 in
19
+ ; every browser, because the maximum is applied first and the minimum
20
+ ; second. This engine had the order the other way round and answered 100.
21
+ ;
22
+ ; 3. Shrinking freezes and repeats. Two 300px items in a 300px row, the first
23
+ ; with `min-width: 200px`: the first stops at 200 and the SECOND has to
24
+ ; absorb what it would not give up. The old pass clamped without
25
+ ; redistributing and produced 200 | 150 — 350 pixels in a 300 pixel row.
26
+ ;
27
+ ; 4. `align-self` exists. An item may opt out of its container's
28
+ ; `align-items`; the property parsed nowhere and did nothing.
29
+ ;
30
+ ; 5. `row-gap` / `column-gap` are the axes, and lines have a gap too. Both
31
+ ; longhands parsed and neither was ever read, and the shorthand spaced the
32
+ ; items on a wrapped row without spacing the rows.
33
+ ;
34
+ ; And the rule under all of them: a declaration this engine cannot use is
35
+ ; REPORTED. `EVGReject` collects them and `EVGLayout` drains them into the
36
+ ; warnings a build already fails on.
37
+ ; ==============================================================================
38
+
39
+ Import "EVGElement.rgr"
40
+ Import "EVGUnit.rgr"
41
+ Import "EVGLayout.rgr"
42
+ Import "EVGReject.rgr"
43
+
44
+ class FlexRulesCheck {
45
+ def passed:int 0
46
+ def failed:int 0
47
+
48
+ Constructor () {
49
+ }
50
+
51
+ fn ok:void (name:string cond:boolean) {
52
+ if cond {
53
+ passed = (passed + 1)
54
+ print (" PASS " + name)
55
+ } {
56
+ failed = (failed + 1)
57
+ print (" FAIL " + name)
58
+ }
59
+ }
60
+
61
+ fn near:void (name:string got:double want:double) {
62
+ def d:double (got - want)
63
+ if (d < 0.0) {
64
+ d = (0.0 - d)
65
+ }
66
+ if (d < 0.05) {
67
+ passed = (passed + 1)
68
+ print (" PASS " + name)
69
+ } {
70
+ failed = (failed + 1)
71
+ print (((((" FAIL " + name) + " — got ") + (to_string got)) + ", want ") + (to_string want))
72
+ }
73
+ }
74
+
75
+ ; A row of the given width, with the declarations applied to it.
76
+ fn row:EVGElement (w:string decls:[string]) {
77
+ def r (EVGElement.createDiv())
78
+ r.setAttribute("display" "flex")
79
+ r.setAttribute("flex-direction" "row")
80
+ r.setAttribute("flex-wrap" "nowrap")
81
+ r.setAttribute("width" w)
82
+ r.setAttribute("height" "100px")
83
+ def i:int 0
84
+ while (i < (array_length decls)) {
85
+ def kid (EVGElement.createDiv())
86
+ this.applyDecls(kid (itemAt decls i))
87
+ r.addChild(kid)
88
+ i = (i + 1)
89
+ }
90
+ return r
91
+ }
92
+
93
+ ; "width:100px;height:40px" onto one element, the way a sheet would.
94
+ fn applyDecls:void (el:EVGElement decls:string) {
95
+ def parts:[string] (EVGElement.splitOnChar(decls 59))
96
+ def i:int 0
97
+ while (i < (array_length parts)) {
98
+ def one:string (itemAt parts i)
99
+ def kv:[string] (EVGElement.splitOnChar(one 58))
100
+ if ((array_length kv) == 2) {
101
+ el.setAttribute((itemAt kv 0) (itemAt kv 1))
102
+ }
103
+ i = (i + 1)
104
+ }
105
+ }
106
+
107
+ fn lay:EVGLayout (root:EVGElement) {
108
+ def l (new EVGLayout())
109
+ l.setPageSize(1200.0 900.0)
110
+ l.layout(root)
111
+ return l
112
+ }
113
+
114
+ fn widthOf:double (root:EVGElement i:int) {
115
+ def kid:EVGElement (root.getChild(i))
116
+ return kid.calculatedWidth
117
+ }
118
+
119
+ fn run:void () {
120
+ print "=== EVG flex rules ==="
121
+ print ""
122
+
123
+ ; --- 1. a basis without a grow ---------------------------------------
124
+ print "-- flex-basis is a size, not only a starting point for growing"
125
+ def basis:[string]
126
+ push basis "flex-basis:120px;height:40px"
127
+ push basis "flex-grow:1;height:40px"
128
+ def r1 (this.row("600px" basis))
129
+ def l1 (this.lay(r1))
130
+ this.near("the basis item is its basis wide" (this.widthOf(r1 0)) 120.0)
131
+ this.near("and its sibling takes the rest" (this.widthOf(r1 1)) 480.0)
132
+
133
+ def sh:[string]
134
+ push sh "flex:0 0 120px;height:40px"
135
+ push sh "flex:1;height:40px"
136
+ def r2 (this.row("600px" sh))
137
+ def l2 (this.lay(r2))
138
+ this.near("`flex: 0 0 120px` means the same thing" (this.widthOf(r2 0)) 120.0)
139
+ this.near("and so does the sibling" (this.widthOf(r2 1)) 480.0)
140
+
141
+ def grown:[string]
142
+ push grown "flex-basis:100px;flex-grow:1;height:40px"
143
+ push grown "flex-basis:200px;flex-grow:1;height:40px"
144
+ def r3 (this.row("600px" grown))
145
+ def l3 (this.lay(r3))
146
+ this.near("a basis that DOES grow still grows from it" (this.widthOf(r3 0)) 250.0)
147
+ this.near("both of them" (this.widthOf(r3 1)) 350.0)
148
+
149
+ ; --- 2. min beats max --------------------------------------------------
150
+ print ""
151
+ print "-- when min and max disagree, min wins"
152
+ def mm:[string]
153
+ push mm "width:50px;min-width:200px;max-width:100px;height:40px"
154
+ def r4 (this.row("600px" mm))
155
+ def l4 (this.lay(r4))
156
+ this.near("the minimum is the answer" (this.widthOf(r4 0)) 200.0)
157
+
158
+ def cap:[string]
159
+ push cap "flex-grow:1;max-width:120px;height:40px"
160
+ push cap "flex-grow:1;height:40px"
161
+ def r5 (this.row("600px" cap))
162
+ def l5 (this.lay(r5))
163
+ this.near("a maximum still caps a growing item" (this.widthOf(r5 0)) 120.0)
164
+ this.near("and the space it refused goes to its sibling" (this.widthOf(r5 1)) 480.0)
165
+
166
+ ; --- 3. shrink freezes and repeats -------------------------------------
167
+ print ""
168
+ print "-- shrinking redistributes what a floored item would not give up"
169
+ def sk:[string]
170
+ push sk "width:300px;min-width:200px;height:40px"
171
+ push sk "width:300px;height:40px"
172
+ def r6 (this.row("300px" sk))
173
+ def l6 (this.lay(r6))
174
+ this.near("the floored item stops at its minimum" (this.widthOf(r6 0)) 200.0)
175
+ this.near("and the other absorbs the whole remainder" (this.widthOf(r6 1)) 100.0)
176
+
177
+ def wt:[string]
178
+ push wt "width:300px;flex-shrink:1;height:40px"
179
+ push wt "width:300px;flex-shrink:2;height:40px"
180
+ def r7 (this.row("400px" wt))
181
+ def l7 (this.lay(r7))
182
+ this.near("weighted by flex-shrink x size, the lighter one" (this.widthOf(r7 0)) 233.3333)
183
+ this.near("and the heavier one" (this.widthOf(r7 1)) 166.6667)
184
+
185
+ def z:[string]
186
+ push z "width:300px;flex-shrink:0;height:40px"
187
+ push z "width:300px;flex-shrink:1;height:40px"
188
+ def r8 (this.row("400px" z))
189
+ def l8 (this.lay(r8))
190
+ this.near("flex-shrink: 0 keeps its size" (this.widthOf(r8 0)) 300.0)
191
+ this.near("and its sibling takes all of the overflow" (this.widthOf(r8 1)) 100.0)
192
+
193
+ ; --- 4. align-self ------------------------------------------------------
194
+ print ""
195
+ print "-- an item may opt out of its container's align-items"
196
+ def r9 (EVGElement.createDiv())
197
+ r9.setAttribute("display" "flex")
198
+ r9.setAttribute("flex-direction" "row")
199
+ r9.setAttribute("flex-wrap" "nowrap")
200
+ r9.setAttribute("align-items" "flex-start")
201
+ r9.setAttribute("width" "600px")
202
+ r9.setAttribute("height" "200px")
203
+ def a1 (EVGElement.createDiv())
204
+ this.applyDecls(a1 "width:80px;height:40px")
205
+ def a2 (EVGElement.createDiv())
206
+ this.applyDecls(a2 "width:80px;height:40px;align-self:flex-end")
207
+ def a3 (EVGElement.createDiv())
208
+ this.applyDecls(a3 "width:80px;height:40px;align-self:center")
209
+ r9.addChild(a1)
210
+ r9.addChild(a2)
211
+ r9.addChild(a3)
212
+ def l9 (this.lay(r9))
213
+ this.near("the item that said nothing stays at the top" a1.calculatedY 0.0)
214
+ this.near("align-self: flex-end goes to the bottom" a2.calculatedY 160.0)
215
+ this.near("align-self: center goes to the middle" a3.calculatedY 80.0)
216
+
217
+ def c1 (EVGElement.createDiv())
218
+ c1.setAttribute("display" "flex")
219
+ c1.setAttribute("flex-direction" "column")
220
+ c1.setAttribute("flex-wrap" "nowrap")
221
+ c1.setAttribute("align-items" "flex-start")
222
+ c1.setAttribute("width" "400px")
223
+ c1.setAttribute("height" "300px")
224
+ def b1 (EVGElement.createDiv())
225
+ this.applyDecls(b1 "width:80px;height:40px")
226
+ def b2 (EVGElement.createDiv())
227
+ this.applyDecls(b2 "width:80px;height:40px;align-self:center")
228
+ c1.addChild(b1)
229
+ c1.addChild(b2)
230
+ def l10 (this.lay(c1))
231
+ this.near("in a column the cross axis is the horizontal one" b1.calculatedX 0.0)
232
+ this.near("and align-self centres across it" b2.calculatedX 160.0)
233
+
234
+ ; --- 5. the two gaps ----------------------------------------------------
235
+ print ""
236
+ print "-- row-gap and column-gap are axes, and wrapped lines have a gap"
237
+ def g1 (EVGElement.createDiv())
238
+ g1.setAttribute("display" "flex")
239
+ g1.setAttribute("flex-direction" "row")
240
+ g1.setAttribute("flex-wrap" "wrap")
241
+ g1.setAttribute("align-content" "flex-start")
242
+ g1.setAttribute("row-gap" "30px")
243
+ g1.setAttribute("column-gap" "5px")
244
+ g1.setAttribute("width" "300px")
245
+ g1.setAttribute("height" "300px")
246
+ def q:int 0
247
+ while (q < 4) {
248
+ def kid (EVGElement.createDiv())
249
+ this.applyDecls(kid "width:140px;height:30px")
250
+ g1.addChild(kid)
251
+ q = (q + 1)
252
+ }
253
+ def l11 (this.lay(g1))
254
+ def k0:EVGElement (g1.getChild(0))
255
+ def k1:EVGElement (g1.getChild(1))
256
+ def k2:EVGElement (g1.getChild(2))
257
+ this.near("column-gap spaces the items along the line" k1.calculatedX 145.0)
258
+ this.near("row-gap spaces the lines" k2.calculatedY 60.0)
259
+
260
+ def g2 (EVGElement.createDiv())
261
+ g2.setAttribute("display" "flex")
262
+ g2.setAttribute("flex-direction" "row")
263
+ g2.setAttribute("flex-wrap" "wrap")
264
+ g2.setAttribute("align-content" "flex-start")
265
+ g2.setAttribute("gap" "10px")
266
+ g2.setAttribute("width" "300px")
267
+ g2.setAttribute("height" "300px")
268
+ def q2:int 0
269
+ while (q2 < 3) {
270
+ def kid (EVGElement.createDiv())
271
+ this.applyDecls(kid "width:120px;height:40px")
272
+ g2.addChild(kid)
273
+ q2 = (q2 + 1)
274
+ }
275
+ def l12 (this.lay(g2))
276
+ def m2:EVGElement (g2.getChild(2))
277
+ this.near("the shorthand spaces the lines too" m2.calculatedY 50.0)
278
+
279
+ ; --- and the silence ----------------------------------------------------
280
+ print ""
281
+ print "-- a declaration the engine cannot use is reported, not swallowed"
282
+ EVGReject.clearNotes()
283
+ def bad:[string]
284
+ push bad "width:calc(100% - 40px);height:40px"
285
+ def r13 (this.row("600px" bad))
286
+ def l13 (this.lay(r13))
287
+ this.ok("calc() is a warning" ((l13.warningCount()) > 0))
288
+
289
+ EVGReject.clearNotes()
290
+ def ar:[string]
291
+ push ar "width:200px;aspect-ratio:2/1"
292
+ def r14 (this.row("600px" ar))
293
+ def l14 (this.lay(r14))
294
+ this.ok("an unimplemented property is a warning" ((l14.warningCount()) > 0))
295
+
296
+ EVGReject.clearNotes()
297
+ def fine:[string]
298
+ push fine "width:100px;height:40px"
299
+ push fine "flex-grow:1;height:40px"
300
+ def r15 (this.row("600px" fine))
301
+ def l15 (this.lay(r15))
302
+ this.ok("and a document it understands says nothing" ((l15.warningCount()) == 0))
303
+
304
+ print ""
305
+ print ((("Passed: " + (to_string passed)) + " Failed: ") + (to_string failed))
306
+ if (failed > 0) {
307
+ print "FAILED"
308
+ } {
309
+ print "OK"
310
+ }
311
+ }
312
+
313
+ sfn m@(main):void () {
314
+ def c (new FlexRulesCheck())
315
+ c.run()
316
+ }
317
+ }