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.
- package/CHANGELOG.md +1064 -20
- package/LICENSE +3 -1
- package/README.md +123 -28
- package/dist/Lang.rgr +1188 -290
- package/dist/api.d.ts +2343 -879
- package/dist/api.js +79923 -56921
- package/dist/lib/JSON.rgr +102 -91
- package/dist/lib/Shell.rgr +4 -4
- package/dist/lib/apple/AppleToolchain.rgr +4 -4
- package/dist/lib/apple/README.md +5 -4
- package/dist/lib/apple/apple_test.rgr +1 -1
- package/dist/lib/core/README.md +1 -1
- package/dist/lib/evg/EVG.rgr +12 -0
- package/dist/lib/evg/EVGA11yFromTree.rgr +302 -0
- package/dist/lib/evg/EVGA11yTree.rgr +894 -0
- package/dist/lib/evg/EVGBox.rgr +267 -0
- package/dist/lib/evg/EVGBoxShorthandTest.rgr +220 -0
- package/dist/lib/evg/EVGCodepoint.rgr +316 -0
- package/dist/lib/evg/EVGColor.rgr +700 -0
- package/dist/lib/evg/EVGCommands.rgr +177 -0
- package/dist/lib/evg/EVGComponent.rgr +331 -0
- package/dist/lib/evg/EVGComponentTest.rgr +387 -0
- package/dist/lib/evg/EVGConnector.rgr +541 -0
- package/dist/lib/evg/EVGConnectorTest.rgr +306 -0
- package/dist/lib/evg/EVGDisplayList.rgr +4186 -0
- package/dist/lib/evg/EVGEasing.rgr +370 -0
- package/dist/lib/evg/EVGEffectTest.rgr +253 -0
- package/dist/lib/evg/EVGElement.rgr +4914 -0
- package/dist/lib/evg/EVGFixedTest.rgr +289 -0
- package/dist/lib/evg/EVGFlexRulesTest.rgr +317 -0
- package/dist/lib/evg/EVGFlexWrapTest.rgr +246 -0
- package/dist/lib/evg/EVGFling.rgr +244 -0
- package/dist/lib/evg/EVGFocus.rgr +400 -0
- package/dist/lib/evg/EVGFocusTest.rgr +399 -0
- package/dist/lib/evg/EVGGradient.rgr +322 -0
- package/dist/lib/evg/EVGGrapheme.rgr +190 -0
- package/dist/lib/evg/EVGGrid.rgr +975 -0
- package/dist/lib/evg/EVGHitTest.rgr +208 -0
- package/dist/lib/evg/EVGHoles.rgr +294 -0
- package/dist/lib/evg/EVGHostMeasurerTest.rgr +281 -0
- package/dist/lib/evg/EVGHostTextMeasurer.rgr +331 -0
- package/dist/lib/evg/EVGHostTree.rgr +834 -0
- package/dist/lib/evg/EVGHostTreeTest.rgr +447 -0
- package/dist/lib/evg/EVGImageDecode.rgr +117 -0
- package/dist/lib/evg/EVGImageMeasurer.rgr +86 -0
- package/dist/lib/evg/EVGInspect.rgr +883 -0
- package/dist/lib/evg/EVGInvalidateTest.rgr +432 -0
- package/dist/lib/evg/EVGJsonTest.rgr +535 -0
- package/dist/lib/evg/EVGLayout.rgr +4220 -0
- package/dist/lib/evg/EVGMeasure.rgr +1267 -0
- package/dist/lib/evg/EVGOverlayTest.rgr +626 -0
- package/dist/lib/evg/EVGPatch.rgr +1721 -0
- package/dist/lib/evg/EVGPatchTest.rgr +692 -0
- package/dist/lib/evg/EVGPopoverTest.rgr +395 -0
- package/dist/lib/evg/EVGReconcile.rgr +226 -0
- package/dist/lib/evg/EVGReconcileTest.rgr +421 -0
- package/dist/lib/evg/EVGReject.rgr +126 -0
- package/dist/lib/evg/EVGRelayoutTest.rgr +375 -0
- package/dist/lib/evg/EVGRtlLayoutTest.rgr +319 -0
- package/dist/lib/evg/EVGRuler.rgr +232 -0
- package/dist/lib/evg/EVGRulerTest.rgr +172 -0
- package/dist/lib/evg/EVGSelectChrome.rgr +178 -0
- package/dist/lib/evg/EVGStyleCacheTest.rgr +419 -0
- package/dist/lib/evg/EVGStyleSheet.rgr +2148 -0
- package/dist/lib/evg/EVGStyleStateTest.rgr +407 -0
- package/dist/lib/evg/EVGStyleVarTest.rgr +471 -0
- package/dist/lib/evg/EVGText.rgr +105 -0
- package/dist/lib/evg/EVGTextEngine.rgr +536 -0
- package/dist/lib/evg/EVGTextMeasurer.rgr +720 -0
- package/dist/lib/evg/EVGTimingTest.rgr +1417 -0
- package/dist/lib/evg/EVGToolbar.rgr +1369 -0
- package/dist/lib/evg/EVGTransition.rgr +728 -0
- package/dist/lib/evg/EVGTreeJson.rgr +721 -0
- package/dist/lib/evg/EVGUnit.rgr +554 -0
- package/dist/lib/evg/EVGViewportUnitTest.rgr +236 -0
- package/dist/lib/evg/EvgApp.rgr +189 -0
- package/dist/lib/evg/EvgBitmapTracer.rgr +4277 -0
- package/dist/lib/evg/EvgBitmapTracerTest.rgr +2119 -0
- package/dist/lib/evg/EvgHost.rgr +451 -0
- package/dist/lib/evg/EvgTest.rgr +91 -0
- package/dist/lib/evg/EvgTraceColor.rgr +236 -0
- package/dist/lib/evg/EvgTraceCurve.rgr +648 -0
- package/dist/lib/evg/EvgTraceFit.rgr +767 -0
- package/dist/lib/evg/EvgTracePath.rgr +435 -0
- package/dist/lib/evg/EvgTraceTypes.rgr +559 -0
- package/dist/lib/evg/EvgViewport.rgr +313 -0
- package/dist/lib/evg/FxDemoDoc.rgr +185 -0
- package/dist/lib/evg/HOSTS.md +227 -0
- package/dist/lib/evg/ISSUES.md +835 -0
- package/dist/lib/evg/PLAN_ACCESSIBILITY.md +650 -0
- package/dist/lib/evg/PLAN_CSS_LAYOUT_AND_FONTS.md +1124 -0
- package/dist/lib/evg/PLAN_EFFECTS.md +431 -0
- package/dist/lib/evg/PLAN_EVG.md +518 -0
- package/dist/lib/evg/PLAN_EVG_RENDERER.md +1674 -0
- package/dist/lib/evg/PLAN_INSPECTOR.md +788 -0
- package/dist/lib/evg/PLAN_LINKS_AND_FORMS.md +157 -0
- package/dist/lib/evg/PLAN_NATIVE_HOSTS.md +671 -0
- package/dist/lib/evg/PLAN_VECTOR_IR.md +664 -0
- package/dist/lib/evg/PLAN_VIEW_TRANSFORM.md +322 -0
- package/dist/lib/evg/PathBuilder.rgr +333 -0
- package/dist/lib/evg/README.md +1236 -0
- package/dist/lib/evg/SPEC.md +1252 -0
- package/dist/lib/evg/SVGPathParser.rgr +1199 -0
- package/dist/lib/evg/SvgParser.rgr +1736 -0
- package/dist/lib/evg/TODO_EVG_RENDERER.md +595 -0
- package/dist/lib/evg/VectorShapes.rgr +331 -0
- package/dist/lib/evg/VectorStroke.rgr +107 -0
- package/dist/lib/evg/VectorViewBox.rgr +380 -0
- package/dist/lib/evg/agent/README.md +290 -0
- package/dist/lib/evg/agent/evg_agent.rgr +899 -0
- package/dist/lib/evg/agent/fixtures/broken.evg.json +7 -0
- package/dist/lib/evg/agent/fixtures/card.evg.json +9 -0
- package/dist/lib/evg/agent/fixtures/connector.css +63 -0
- package/dist/lib/evg/agent/fixtures/connector.evg.json +14 -0
- package/dist/lib/evg/agent/fixtures/drawn.evg.json +129 -0
- package/dist/lib/evg/agent/fixtures/gradient.evg.json +4 -0
- package/dist/lib/evg/agent/fixtures/popover.css +99 -0
- package/dist/lib/evg/agent/fixtures/popover.evg.json +30 -0
- package/dist/lib/evg/agent/roundtrip.sh +74 -0
- package/dist/lib/evg/agent/smoke.sh +230 -0
- package/dist/lib/evg/android/README.md +97 -0
- package/dist/lib/evg/android/androidstubs/AndroidStubs.kt +175 -0
- package/dist/lib/evg/android/androidstubs/Annotation.kt +10 -0
- package/dist/lib/evg/android/androidstubs/App.kt +30 -0
- package/dist/lib/evg/android/androidstubs/Content.kt +41 -0
- package/dist/lib/evg/android/androidstubs/ContentRes.kt +12 -0
- package/dist/lib/evg/android/androidstubs/InputMethod.kt +46 -0
- package/dist/lib/evg/android/androidstubs/Net.kt +6 -0
- package/dist/lib/evg/android/androidstubs/Os.kt +30 -0
- package/dist/lib/evg/android/androidstubs/Util.kt +15 -0
- package/dist/lib/evg/android/androidstubs/View.kt +113 -0
- package/dist/lib/evg/android/androidstubs/Widget.kt +16 -0
- package/dist/lib/evg/android/src/android/kotlin/fi/ranger/evg/AndroidEvgSurface.kt +323 -0
- package/dist/lib/evg/android/src/android/kotlin/fi/ranger/evg/AndroidTextMeasurer.kt +56 -0
- package/dist/lib/evg/android/src/android/kotlin/fi/ranger/evg/RippleEffect.kt +262 -0
- package/dist/lib/evg/android/src/awt/kotlin/fi/ranger/evg/AwtEvgSurface.kt +238 -0
- package/dist/lib/evg/android/src/awt/kotlin/fi/ranger/evg/AwtTextMeasurer.kt +85 -0
- package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/EvgEngineThread.kt +115 -0
- package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/EvgPainter.kt +231 -0
- package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/EvgSurface.kt +117 -0
- package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/RecordingSurface.kt +94 -0
- package/dist/lib/evg/apple/README.md +128 -0
- package/dist/lib/evg/apple/Sources/CoreGraphicsEvgSurface.swift +329 -0
- package/dist/lib/evg/apple/Sources/CoreTextMeasurer.swift +70 -0
- package/dist/lib/evg/apple/Sources/EvgEngineQueue.swift +105 -0
- package/dist/lib/evg/apple/Sources/EvgPainter.swift +225 -0
- package/dist/lib/evg/apple/Sources/EvgSurface.swift +163 -0
- package/dist/lib/evg/apple/Sources/RecordingSurface.swift +110 -0
- package/dist/lib/evg/bench/EvgLayoutBench.rgr +34 -0
- package/dist/lib/evg/bench/README.md +64 -0
- package/dist/lib/evg/bench/layout-bench.mjs +316 -0
- package/dist/lib/evg/bench/layout-cases.mjs +510 -0
- package/dist/lib/evg/bench/layout-conformance.mjs +254 -0
- package/dist/lib/evg/bin/.gitignore +17 -0
- package/dist/lib/evg/evg_test.rgr +313 -0
- package/dist/lib/evg/gl/README.md +198 -0
- package/dist/lib/evg/gl/a11y-paint-check.mjs +73 -0
- package/dist/lib/evg/gl/blur-check.mjs +399 -0
- package/dist/lib/evg/gl/boxmodel.json +1 -0
- package/dist/lib/evg/gl/demo.html +46 -0
- package/dist/lib/evg/gl/effect-presets.css +285 -0
- package/dist/lib/evg/gl/effect-presets.js +63 -0
- package/dist/lib/evg/gl/effect-shots.mjs +135 -0
- package/dist/lib/evg/gl/evg-a11y.js +566 -0
- package/dist/lib/evg/gl/evg-binary.js +160 -0
- package/dist/lib/evg/gl/evg-engine.js +296 -0
- package/dist/lib/evg/gl/evg-fx.js +237 -0
- package/dist/lib/evg/gl/evg-gestures.js +209 -0
- package/dist/lib/evg/gl/evg-list.js +167 -0
- package/dist/lib/evg/gl/evg-measure.js +186 -0
- package/dist/lib/evg/gl/evg-textinput.js +303 -0
- package/dist/lib/evg/gl/evg-view.js +144 -0
- package/dist/lib/evg/gl/evg-webgl.js +3942 -0
- package/dist/lib/evg/gl/fx-check.mjs +998 -0
- package/dist/lib/evg/gl/fx-demo.html +166 -0
- package/dist/lib/evg/gl/fx-demo.js +2 -0
- package/dist/lib/evg/gl/fx-serve.mjs +47 -0
- package/dist/lib/evg/gl/gestures-check.mjs +189 -0
- package/dist/lib/evg/gl/list-binary-check.mjs +152 -0
- package/dist/lib/evg/gl/measure-check.mjs +135 -0
- package/dist/lib/evg/gl/rotation-check.mjs +207 -0
- package/dist/lib/evg/gl/shift-check.mjs +113 -0
- package/dist/lib/evg/gl/stroke-check.mjs +168 -0
- package/dist/lib/evg/gl/text-snap-check.mjs +139 -0
- package/dist/lib/evg/gl/view-check.mjs +343 -0
- package/dist/lib/evg/gl/view-policy-check.mjs +184 -0
- package/dist/lib/evg/html/evg-dom.js +318 -0
- package/dist/lib/evg/html/evg-html.js +600 -0
- package/dist/lib/evg/inspect/README.md +415 -0
- package/dist/lib/evg/inspect/browser-smoke.mjs +115 -0
- package/dist/lib/evg/inspect/evg-inspect.js +947 -0
- package/dist/lib/evg/inspect/shots/css.png +0 -0
- package/dist/lib/evg/inspect/shots/dashboard.png +0 -0
- package/dist/lib/evg/inspect/shots/pptx-slide.png +0 -0
- package/dist/lib/evg/inspect/shots/state.png +0 -0
- package/dist/lib/evg/inspect/shots.mjs +226 -0
- package/dist/lib/evg/oracle/css-blur.json +576 -0
- package/dist/lib/evg/oracle/css-box.json +157 -0
- package/dist/lib/evg/oracle/css-timing.json +709 -0
- package/dist/lib/evg/oracle/css_blur_oracle.mjs +529 -0
- package/dist/lib/evg/oracle/css_box_oracle.mjs +106 -0
- package/dist/lib/evg/oracle/css_timing_oracle.mjs +389 -0
- package/dist/lib/evg/original/EVGColor.clj +310 -0
- package/dist/lib/evg/original/EVGColorContext.rgr +178 -0
- package/dist/lib/evg/original/SVGPath.rgr +627 -0
- package/dist/lib/evg/original/Vec2.crgr +103 -0
- package/dist/lib/evg/ranger.json +9 -0
- package/dist/lib/evg/showcase/README.md +246 -0
- package/dist/lib/evg/showcase/assets/emblem.svg +30 -0
- package/dist/lib/evg/showcase/assets/rosette.svg +22 -0
- package/dist/lib/evg/showcase/build.mjs +651 -0
- package/dist/lib/evg/showcase/pages/album.tsx +30 -0
- package/dist/lib/evg/showcase/pages/boxmodel.tsx +37 -0
- package/dist/lib/evg/showcase/pages/cards.tsx +41 -0
- package/dist/lib/evg/showcase/pages/chart_api.tsx +170 -0
- package/dist/lib/evg/showcase/pages/charts.tsx +219 -0
- package/dist/lib/evg/showcase/pages/drawing.tsx +160 -0
- package/dist/lib/evg/showcase/pages/emoji.tsx +91 -0
- package/dist/lib/evg/showcase/pages/flex.tsx +46 -0
- package/dist/lib/evg/showcase/pages/more.tsx +332 -0
- package/dist/lib/evg/showcase/pages/plots.tsx +262 -0
- package/dist/lib/evg/showcase/pages/svg.tsx +63 -0
- package/dist/lib/evg/showcase/pages/tables.tsx +209 -0
- package/dist/lib/evg/showcase/pages/typography.tsx +43 -0
- package/dist/lib/evg/showcase/pages/units.tsx +35 -0
- package/dist/lib/evg/showcase/pages/variants.tsx +233 -0
- package/dist/lib/evg/showcase/pages/vector.tsx +75 -0
- package/dist/lib/evg/showcase/pages/views.tsx +223 -0
- package/dist/lib/evg/showcase/tests/chart_api_smoke.mjs +339 -0
- package/dist/lib/evg/showcase/tests/gl_smoke.mjs +125 -0
- package/dist/lib/evg/showcase/themes/chart_api-default.css +15 -0
- package/dist/lib/evg/showcase/themes/charts-default.css +29 -0
- package/dist/lib/evg/showcase/themes/drawing-default.css +35 -0
- package/dist/lib/evg/showcase/themes/more-default.css +128 -0
- package/dist/lib/evg/showcase/themes/plots-default.css +18 -0
- package/dist/lib/evg/showcase/themes/showcase.css +508 -0
- package/dist/lib/evg/showcase/themes/tables-default.css +123 -0
- package/dist/lib/evg/showcase/themes/variants-default.css +15 -0
- package/dist/lib/evg/showcase/themes/views-default.css +15 -0
- package/dist/lib/evg/tools/bench_vs_potrace.mjs +290 -0
- package/dist/lib/evg/tools/evg_image_tool.rgr +488 -0
- package/dist/lib/evg/tools/evg_trace_bench.rgr +114 -0
- package/dist/lib/evg/tools/evg_trace_cli.rgr +662 -0
- package/dist/lib/evg/tools/evg_trace_cpp_bench.rgr +83 -0
- package/dist/lib/evg/tools/run_trace_bench.sh +74 -0
- package/dist/lib/evg/tools/run_trace_cli_smoke.sh +128 -0
- package/dist/lib/evg/web/responsive/EvgResponsiveCheck.rgr +271 -0
- package/dist/lib/evg/web/responsive/EvgResponsiveDemo.rgr +531 -0
- package/dist/lib/evg/web/responsive/README.md +97 -0
- package/dist/lib/evg/web/responsive/build.mjs +90 -0
- package/dist/lib/evg/web/responsive/dom-check.mjs +169 -0
- package/dist/lib/evg/web/responsive/index.html +177 -0
- package/dist/lib/evg/web/responsive/smoke.mjs +221 -0
- package/dist/lib/evg/web/tools/assets-client.mjs +95 -0
- package/dist/lib/evg/web/tools/boot-bench.mjs +189 -0
- package/dist/lib/evg/web/tools/inline-assets.mjs +119 -0
- package/dist/lib/evg/web/tools/minify.mjs +60 -0
- package/dist/lib/evg/web/tracer/build.mjs +87 -0
- package/dist/lib/evg/web/tracer/index.html +2805 -0
- package/dist/lib/evg/web/tracer/sample.png +0 -0
- package/dist/lib/evg/web/tracer/smoke.mjs +1162 -0
- package/dist/lib/evgr/Cargo.lock +21 -0
- package/dist/lib/evgr/Cargo.toml +19 -0
- package/dist/lib/evgr/README.md +140 -0
- package/dist/lib/evgr/bench/NativeBench.rgr +246 -0
- package/dist/lib/evgr/bench/compare.mjs +252 -0
- package/dist/lib/evgr/bench/speed.mjs +277 -0
- package/dist/lib/evgr/bin/.gitignore +3 -0
- package/dist/lib/evgr/src/bin/bench.rs +106 -0
- package/dist/lib/evgr/src/bin/smoke.rs +13 -0
- package/dist/lib/evgr/src/grid.rs +730 -0
- package/dist/lib/evgr/src/lib.rs +1003 -0
- package/dist/lib/evgr/src/style.rs +468 -0
- package/dist/lib/evgr/src/text.rs +83 -0
- package/dist/lib/image/BitReader.rgr +171 -0
- package/dist/lib/image/Buffer.rgr +173 -0
- package/dist/lib/image/DCT.rgr +283 -0
- package/dist/lib/image/Deflate.rgr +339 -0
- package/dist/lib/image/HuffmanDecoder.rgr +181 -0
- package/dist/lib/image/ImageBuffer.rgr +706 -0
- package/dist/lib/image/JPEGDecoder.rgr +808 -0
- package/dist/lib/image/PNGDecoder.rgr +544 -0
- package/dist/lib/image/PNGEncoder.rgr +388 -0
- package/dist/lib/image/PPMImage.rgr +224 -0
- package/dist/lib/image/ProgressiveJPEGDecoder.rgr +1154 -0
- package/dist/lib/image/README.md +33 -0
- package/dist/lib/image/RasterBuffer.rgr +294 -0
- package/dist/lib/image/VP8BoolDecoder.rgr +163 -0
- package/dist/lib/image/WebPDecoder.rgr +433 -0
- package/dist/lib/image/WebPLossless.rgr +1035 -0
- package/dist/lib/image/WebPLossy.rgr +1929 -0
- package/dist/lib/image/ranger.json +9 -0
- package/dist/lib/image/testdata/webp/anim_2f_24x16.webp +0 -0
- package/dist/lib/image/testdata/webp/fixtures.txt +33 -0
- package/dist/lib/image/testdata/webp/gen_fixtures.py +261 -0
- package/dist/lib/image/testdata/webp/ll_1x1.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_alpha_29x21.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_gradient_64x64.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_meta_32x32.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_noise_17x9.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_pal11_23x11.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_pal2_19x7.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_pal40_16x16.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_pal4_13x5.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_photo_40x30.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_predictors_64x32.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_1x1.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_raw_f0_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_raw_f1_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_raw_f2_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_raw_f3_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_vp8l_f0_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_vp8l_f1_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_vp8l_f2_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_vp8l_f3_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alpha_33x17.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_exif_15x11.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_i16_96x80.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_nofilter_24x20.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_odd_17x9.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_photo_48x40.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_q100_20x18.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_sharp_40x36.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_simple_filter_33x31.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_vpx_parts8_37x45.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_vpx_skip_96x80.webp +0 -0
- package/dist/lib/image/tests/WebPDecodeTool.rgr +81 -0
- package/dist/lib/image/tests/WebPDecoderTest.rgr +1162 -0
- package/dist/lib/image/tests/run_webp_tests.sh +39 -0
- package/dist/lib/rust/RsJson.rgr +468 -0
- package/dist/lib/rust/RsPrelude.rgr +1663 -0
- package/dist/lib/shell_test.rgr +7 -7
- package/dist/lib/stdlib.rgr +21 -5
- package/dist/lib/zip/ranger.json +6 -0
- package/dist/rgrc.js +87318 -67610
- package/package.json +1010 -1040
- package/dist/README.md +0 -117
- package/dist/package.json +0 -47
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
; SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
; EVGCodepoint.rgr — iterate text by codepoint, not by UTF-16 code unit
|
|
4
|
+
;
|
|
5
|
+
; `charAt` returns a UTF-16 code unit. Everything outside the Basic
|
|
6
|
+
; Multilingual Plane — emoji, CJK extensions, historic scripts, most maths
|
|
7
|
+
; symbols — is stored as a SURROGATE PAIR of two units, so a loop written with
|
|
8
|
+
; `charAt` sees one character as two, and neither half is a real codepoint.
|
|
9
|
+
;
|
|
10
|
+
; What that cost before this module existed:
|
|
11
|
+
;
|
|
12
|
+
; "a😀b" measured 47.53px instead of ~25px, because the emoji contributed
|
|
13
|
+
; two .notdef advances rather than one glyph;
|
|
14
|
+
; the JSON display list came out as CESU-8 (ed a0 bd ed b8 80) rather than
|
|
15
|
+
; UTF-8 (f0 9f 98 80), which is not valid UTF-8 and no strict parser
|
|
16
|
+
; will read;
|
|
17
|
+
; the PDF encoder reported two unencodable characters at U+D83D and U+DE00,
|
|
18
|
+
; which are not characters at all — they are halves.
|
|
19
|
+
;
|
|
20
|
+
; So: one place that knows how to step through a string properly, used by
|
|
21
|
+
; measurement, line breaking, the rasterizer and the encoders alike.
|
|
22
|
+
;
|
|
23
|
+
; Since docs/plans/PLAN_STRING_INDEXING.md stage 2 the language has the
|
|
24
|
+
; primitive this module was hand-rolling: `(to_chars s)` gives the code
|
|
25
|
+
; points as an `[int]`, the same sequence on every target, in one pass.
|
|
26
|
+
; `toArray`, `charCount` and `count` are that now, and a caller that wants
|
|
27
|
+
; the whole string as codepoints should reach for `to_chars` directly.
|
|
28
|
+
;
|
|
29
|
+
; What stays here is the part `to_chars` cannot express: `codeAt`,
|
|
30
|
+
; `unitsAt`, `utf8CodeAt`, `utf8UnitsAt` and `stringIsBytes` all take or
|
|
31
|
+
; return a STORAGE index -- a caret column, a substring boundary, a position
|
|
32
|
+
; a caller is holding in the target's own unit. Those callers index the
|
|
33
|
+
; string itself, so they need to know how far the next character reaches in
|
|
34
|
+
; that unit, which is a different question from "what are the code points".
|
|
35
|
+
;
|
|
36
|
+
; Note this is about STORAGE, not about what a reader perceives as a character.
|
|
37
|
+
; A grapheme cluster — a flag, a skin-toned emoji, a ZWJ family — is several
|
|
38
|
+
; codepoints and still needs clustering on top of this. This module is the
|
|
39
|
+
; layer below that, and the layer everything else was missing.
|
|
40
|
+
|
|
41
|
+
class EVGCodepoint {
|
|
42
|
+
|
|
43
|
+
; --- where a line may be broken ---------------------------------------------
|
|
44
|
+
;
|
|
45
|
+
; A space is the obvious opportunity and was the only one any wrapper here
|
|
46
|
+
; knew. It is not the only one, and the gap shows on the commonest kind of
|
|
47
|
+
; text there is: a hyphenated compound. "Liiketoiminta-logiikka" is ONE
|
|
48
|
+
; word to a space-only wrapper, so a box too narrow for the whole of it has
|
|
49
|
+
; nothing to break at and falls through to breaking between letters —
|
|
50
|
+
; "Liiketoimint" / "a-logiikka", where every other program gives
|
|
51
|
+
; "Liiketoiminta-" / "logiikka".
|
|
52
|
+
;
|
|
53
|
+
; The break goes AFTER the character, so the hyphen stays on the line it
|
|
54
|
+
; belongs to. That is the whole difference between a compound that reads
|
|
55
|
+
; and one that looks like a typo.
|
|
56
|
+
;
|
|
57
|
+
; This is the small, uncontroversial part of UAX #14 — the part every
|
|
58
|
+
; implementation agrees on — and deliberately not the rest of it: no line
|
|
59
|
+
; breaking around CJK, no numeric-range rules, no soft hyphen. Those want
|
|
60
|
+
; a property table, and a wrapper that gets hyphens right is most of the
|
|
61
|
+
; distance for the documents these editors open.
|
|
62
|
+
sfn breaksAfter:boolean (c:int) {
|
|
63
|
+
; - hyphen-minus, and the real hyphen nobody types
|
|
64
|
+
if ((c == 45) || (c == 8208)) {
|
|
65
|
+
return true
|
|
66
|
+
}
|
|
67
|
+
; – en dash, — em dash
|
|
68
|
+
if ((c == 8211) || (c == 8212)) {
|
|
69
|
+
return true
|
|
70
|
+
}
|
|
71
|
+
; / solidus: a path or a date breaks after it, not before
|
|
72
|
+
if (c == 47) {
|
|
73
|
+
return true
|
|
74
|
+
}
|
|
75
|
+
return false
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
; A space, a tab — where a break costs nothing because the character it
|
|
79
|
+
; breaks at is invisible.
|
|
80
|
+
sfn isSpace:boolean (c:int) {
|
|
81
|
+
if (c == 32) {
|
|
82
|
+
return true
|
|
83
|
+
}
|
|
84
|
+
if (c == 9) {
|
|
85
|
+
return true
|
|
86
|
+
}
|
|
87
|
+
return false
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
; Is a string BYTES here, or UTF-16 code units?
|
|
91
|
+
;
|
|
92
|
+
; Ranger's `string` does not mean the same thing on every target it
|
|
93
|
+
; compiles to. In JavaScript it is UTF-16 code units, so "ä" is one of them
|
|
94
|
+
; and `charAt` hands back 228. In C++ it is a `std::string` of bytes, so
|
|
95
|
+
; "ä" is the two bytes UTF-8 spells it with and `charAt` hands back 195.
|
|
96
|
+
;
|
|
97
|
+
; This module's whole job is to say where one character ends and the next
|
|
98
|
+
; begins, so it is the one place that has to know — and it asks the
|
|
99
|
+
; language rather than the build, which cannot be got wrong by a compiler
|
|
100
|
+
; flag. Everything above it — measurement, wrapping, kerning, the
|
|
101
|
+
; rasterizer — then walks real characters on both.
|
|
102
|
+
sfn stringIsBytes:boolean () {
|
|
103
|
+
return ((strlen "ä") > 1)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
sfn isHighSurrogate:boolean (u:int) {
|
|
107
|
+
return ((u >= 55296) && (u <= 56319))
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
sfn isLowSurrogate:boolean (u:int) {
|
|
111
|
+
return ((u >= 56320) && (u <= 57343))
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
; The codepoint starting at UTF-16 index `i`.
|
|
115
|
+
;
|
|
116
|
+
; An unpaired surrogate is returned as-is rather than replaced: text that
|
|
117
|
+
; is already damaged should stay recognisable instead of turning into a
|
|
118
|
+
; different kind of damage.
|
|
119
|
+
sfn codeAt:int (s:string i:int) {
|
|
120
|
+
def u:int (charAt s i)
|
|
121
|
+
if (EVGCodepoint.stringIsBytes()) {
|
|
122
|
+
return (EVGCodepoint.utf8CodeAt(s i u))
|
|
123
|
+
}
|
|
124
|
+
if (EVGCodepoint.isHighSurrogate(u)) {
|
|
125
|
+
if ((i + 1) < (strlen s)) {
|
|
126
|
+
def lo:int (charAt s (i + 1))
|
|
127
|
+
if (EVGCodepoint.isLowSurrogate(lo)) {
|
|
128
|
+
return ((((u - 55296) * 1024) + (lo - 56320)) + 65536)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return u
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
; The codepoint whose UTF-8 lead byte `u` sits at `i`.
|
|
136
|
+
;
|
|
137
|
+
; A byte that is not a valid lead, or a sequence that runs off the end, is
|
|
138
|
+
; returned as itself: text that is already damaged should stay
|
|
139
|
+
; recognisable rather than turn into a different kind of damage.
|
|
140
|
+
sfn utf8CodeAt:int (s:string i:int u:int) {
|
|
141
|
+
def n:int (strlen s)
|
|
142
|
+
if (u < 128) {
|
|
143
|
+
return u
|
|
144
|
+
}
|
|
145
|
+
if ((u >= 192) && (u < 224)) {
|
|
146
|
+
if ((i + 1) < n) {
|
|
147
|
+
def b1:int (charAt s (i + 1))
|
|
148
|
+
if (EVGCodepoint.isUtf8Cont(b1)) {
|
|
149
|
+
return (((u - 192) * 64) + (b1 - 128))
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return u
|
|
153
|
+
}
|
|
154
|
+
if ((u >= 224) && (u < 240)) {
|
|
155
|
+
if ((i + 2) < n) {
|
|
156
|
+
def c1:int (charAt s (i + 1))
|
|
157
|
+
def c2:int (charAt s (i + 2))
|
|
158
|
+
if ((EVGCodepoint.isUtf8Cont(c1)) && (EVGCodepoint.isUtf8Cont(c2))) {
|
|
159
|
+
return ((((u - 224) * 4096) + ((c1 - 128) * 64)) + (c2 - 128))
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return u
|
|
163
|
+
}
|
|
164
|
+
if ((u >= 240) && (u < 248)) {
|
|
165
|
+
if ((i + 3) < n) {
|
|
166
|
+
def d1:int (charAt s (i + 1))
|
|
167
|
+
def d2:int (charAt s (i + 2))
|
|
168
|
+
def d3:int (charAt s (i + 3))
|
|
169
|
+
if (((EVGCodepoint.isUtf8Cont(d1)) && (EVGCodepoint.isUtf8Cont(d2))) && (EVGCodepoint.isUtf8Cont(d3))) {
|
|
170
|
+
return (((((u - 240) * 262144) + ((d1 - 128) * 4096)) + ((d2 - 128) * 64)) + (d3 - 128))
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return u
|
|
174
|
+
}
|
|
175
|
+
return u
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
sfn isUtf8Cont:boolean (b:int) {
|
|
179
|
+
return ((b >= 128) && (b < 192))
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
; How many storage units the character at `i` occupies — bytes where a
|
|
183
|
+
; string is bytes, UTF-16 units where it is units.
|
|
184
|
+
sfn utf8UnitsAt:int (s:string i:int) {
|
|
185
|
+
def u:int (charAt s i)
|
|
186
|
+
def n:int (strlen s)
|
|
187
|
+
if (u < 128) {
|
|
188
|
+
return 1
|
|
189
|
+
}
|
|
190
|
+
if ((u >= 192) && (u < 224)) {
|
|
191
|
+
if ((i + 1) < n) {
|
|
192
|
+
if (EVGCodepoint.isUtf8Cont((charAt s (i + 1)))) {
|
|
193
|
+
return 2
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return 1
|
|
197
|
+
}
|
|
198
|
+
if ((u >= 224) && (u < 240)) {
|
|
199
|
+
if ((i + 2) < n) {
|
|
200
|
+
if ((EVGCodepoint.isUtf8Cont((charAt s (i + 1)))) && (EVGCodepoint.isUtf8Cont((charAt s (i + 2))))) {
|
|
201
|
+
return 3
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return 1
|
|
205
|
+
}
|
|
206
|
+
if ((u >= 240) && (u < 248)) {
|
|
207
|
+
if ((i + 3) < n) {
|
|
208
|
+
def e1:boolean (EVGCodepoint.isUtf8Cont((charAt s (i + 1))))
|
|
209
|
+
def e2:boolean (EVGCodepoint.isUtf8Cont((charAt s (i + 2))))
|
|
210
|
+
def e3:boolean (EVGCodepoint.isUtf8Cont((charAt s (i + 3))))
|
|
211
|
+
if ((e1 && e2) && e3) {
|
|
212
|
+
return 4
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return 1
|
|
216
|
+
}
|
|
217
|
+
return 1
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
; How many UTF-16 units the codepoint at `i` occupies: 1, or 2 for a pair.
|
|
221
|
+
sfn unitsAt:int (s:string i:int) {
|
|
222
|
+
if (EVGCodepoint.stringIsBytes()) {
|
|
223
|
+
return (EVGCodepoint.utf8UnitsAt(s i))
|
|
224
|
+
}
|
|
225
|
+
def u:int (charAt s i)
|
|
226
|
+
if (EVGCodepoint.isHighSurrogate(u)) {
|
|
227
|
+
if ((i + 1) < (strlen s)) {
|
|
228
|
+
if (EVGCodepoint.isLowSurrogate((charAt s (i + 1)))) {
|
|
229
|
+
return 2
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return 1
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
; Number of codepoints, which is what "how long is this text" should mean
|
|
237
|
+
; anywhere a glyph is about to be looked up.
|
|
238
|
+
; `count` is a name the compiler keeps for itself at a call site, so the
|
|
239
|
+
; one callers use is `charCount`; both answer the same question.
|
|
240
|
+
sfn charCount:int (s:string) {
|
|
241
|
+
return (array_length (to_chars s))
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
sfn count:int (s:string) {
|
|
245
|
+
return (array_length (to_chars s))
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
; The string as a codepoint array — convenient where a loop wants random
|
|
249
|
+
; access, e.g. a kerning pass that needs the previous codepoint.
|
|
250
|
+
;
|
|
251
|
+
; This is `to_chars`, and was this module's own decoder until the language
|
|
252
|
+
; grew one. The difference is not only tidiness: the old version stepped
|
|
253
|
+
; by storage index, and a storage index costs O(n) on Rust and Go, so
|
|
254
|
+
; walking a string was quadratic there. `to_chars` is one pass.
|
|
255
|
+
sfn toArray:[int] (s:string) {
|
|
256
|
+
return (to_chars s)
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
; A single codepoint back to a string, re-splitting into a surrogate pair
|
|
260
|
+
; when it is above the BMP.
|
|
261
|
+
sfn toStr:string (cp:int) {
|
|
262
|
+
if (EVGCodepoint.stringIsBytes()) {
|
|
263
|
+
; `strfromcode` writes the whole codepoint as UTF-8 here, including
|
|
264
|
+
; the four-byte form. Splitting it into a surrogate pair first and
|
|
265
|
+
; encoding each half would produce CESU-8, which is not UTF-8.
|
|
266
|
+
return (strfromcode cp)
|
|
267
|
+
}
|
|
268
|
+
if (cp < 65536) {
|
|
269
|
+
return (strfromcode cp)
|
|
270
|
+
}
|
|
271
|
+
def rel:int (cp - 65536)
|
|
272
|
+
def hi:int (55296 + (to_int (rel / 1024)))
|
|
273
|
+
def lo:int (56320 + (rel % 1024))
|
|
274
|
+
return ((strfromcode hi) + (strfromcode lo))
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
; Encode to UTF-8 BYTES, one byte per character of the returned string.
|
|
278
|
+
;
|
|
279
|
+
; This is what has to be written to a file: `buffer_from_string` stores one
|
|
280
|
+
; byte per character, so anything else lands on disk mis-encoded. Astral
|
|
281
|
+
; codepoints become the proper four-byte form rather than two three-byte
|
|
282
|
+
; sequences (CESU-8), which is the bug this replaced.
|
|
283
|
+
sfn encodeUtf8:string (s:string) {
|
|
284
|
+
; Where a string is already bytes, it is already UTF-8.
|
|
285
|
+
if (EVGCodepoint.stringIsBytes()) {
|
|
286
|
+
return s
|
|
287
|
+
}
|
|
288
|
+
def out:string ""
|
|
289
|
+
def i:int 0
|
|
290
|
+
while (i < (strlen s)) {
|
|
291
|
+
def cp:int (EVGCodepoint.codeAt(s i))
|
|
292
|
+
i = (i + (EVGCodepoint.unitsAt(s i)))
|
|
293
|
+
if (cp < 128) {
|
|
294
|
+
out = out + (strfromcode cp)
|
|
295
|
+
} {
|
|
296
|
+
if (cp < 2048) {
|
|
297
|
+
out = out + (strfromcode (192 + (to_int (cp / 64))))
|
|
298
|
+
out = out + (strfromcode (128 + (cp % 64)))
|
|
299
|
+
} {
|
|
300
|
+
if (cp < 65536) {
|
|
301
|
+
out = out + (strfromcode (224 + (to_int (cp / 4096))))
|
|
302
|
+
out = out + (strfromcode (128 + ((to_int (cp / 64)) % 64)))
|
|
303
|
+
out = out + (strfromcode (128 + (cp % 64)))
|
|
304
|
+
} {
|
|
305
|
+
out = out + (strfromcode (240 + (to_int (cp / 262144))))
|
|
306
|
+
out = out + (strfromcode (128 + ((to_int (cp / 4096)) % 64)))
|
|
307
|
+
out = out + (strfromcode (128 + ((to_int (cp / 64)) % 64)))
|
|
308
|
+
out = out + (strfromcode (128 + (cp % 64)))
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
continue
|
|
313
|
+
}
|
|
314
|
+
return out
|
|
315
|
+
}
|
|
316
|
+
}
|