@swf2es/player-hosts 0.0.0-stage → 0.1.1
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/LICENSE +202 -0
- package/LICENSE.third-party +759 -0
- package/README.md +43 -2
- package/dist/indexeddb.d.ts +27 -0
- package/dist/indexeddb.d.ts.map +1 -0
- package/dist/indexeddb.js +170 -0
- package/dist/indexeddb.js.map +1 -0
- package/dist/node-worker.d.ts +2 -0
- package/dist/node-worker.d.ts.map +1 -0
- package/dist/node-worker.js +12 -0
- package/dist/node-worker.js.map +1 -0
- package/dist/node.d.ts +8 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +43 -0
- package/dist/node.js.map +1 -0
- package/dist/precompiled.d.ts +31 -0
- package/dist/precompiled.d.ts.map +1 -0
- package/dist/precompiled.js +125 -0
- package/dist/precompiled.js.map +1 -0
- package/dist/stage3d.d.ts +13 -0
- package/dist/stage3d.d.ts.map +1 -0
- package/dist/stage3d.js +61 -0
- package/dist/stage3d.js.map +1 -0
- package/dist/thread/codegen/codegen.js +308 -0
- package/dist/thread/codegen/index.js +405 -0
- package/dist/thread/format/abc-names.js +126 -0
- package/dist/thread/format/actions.js +222 -0
- package/dist/thread/format/air-descriptor.js +63 -0
- package/dist/thread/format/api-versions.js +22 -0
- package/dist/thread/format/bitmap.js +199 -0
- package/dist/thread/format/button.js +60 -0
- package/dist/thread/format/compression.js +200 -0
- package/dist/thread/format/display.js +305 -0
- package/dist/thread/format/filters.js +136 -0
- package/dist/thread/format/font.js +168 -0
- package/dist/thread/format/index.js +26 -0
- package/dist/thread/format/pbj.js +484 -0
- package/dist/thread/format/shape.js +411 -0
- package/dist/thread/format/sound.js +91 -0
- package/dist/thread/format/swf.js +163 -0
- package/dist/thread/format/tags.js +58 -0
- package/dist/thread/format/text.js +135 -0
- package/dist/thread/format/zip.js +91 -0
- package/dist/thread/native/audio/binary.js +3 -0
- package/dist/thread/native/audio/index.js +72 -0
- package/dist/thread/native/base64.js +9 -0
- package/dist/thread/native/compress/binary.js +3 -0
- package/dist/thread/native/compress/index.js +145 -0
- package/dist/thread/native/instance.js +49 -0
- package/dist/thread/native/mp3/binary.js +3 -0
- package/dist/thread/native/mp3/index.js +48 -0
- package/dist/thread/native/render/binary.js +3 -0
- package/dist/thread/native/render/bitmap-kernel.js +591 -0
- package/dist/thread/native/render/draw-kernel.js +204 -0
- package/dist/thread/native/render/dxt-encoder.js +94 -0
- package/dist/thread/native/render/index.js +10 -0
- package/dist/thread/native/render/lines.js +122 -0
- package/dist/thread/native/render/module.js +26 -0
- package/dist/thread/native/render/pixel-ops.js +235 -0
- package/dist/thread/native/render/tessellator.js +250 -0
- package/dist/thread/player/avm1/amf.js +507 -0
- package/dist/thread/player/avm1/avm1.js +1304 -0
- package/dist/thread/player/avm1/bindings.js +214 -0
- package/dist/thread/player/avm1/classes.js +75 -0
- package/dist/thread/player/avm1/clips.js +229 -0
- package/dist/thread/player/avm1/compile.js +140 -0
- package/dist/thread/player/avm1/external.js +79 -0
- package/dist/thread/player/avm1/focus.js +278 -0
- package/dist/thread/player/avm1/globals/BitmapData.js +542 -0
- package/dist/thread/player/avm1/globals/Button.js +31 -0
- package/dist/thread/player/avm1/globals/Color.js +115 -0
- package/dist/thread/player/avm1/globals/ExternalInterface.js +310 -0
- package/dist/thread/player/avm1/globals/FileReference.js +217 -0
- package/dist/thread/player/avm1/globals/Key.js +60 -0
- package/dist/thread/player/avm1/globals/LoadVars.js +208 -0
- package/dist/thread/player/avm1/globals/LocalConnection.js +92 -0
- package/dist/thread/player/avm1/globals/MovieClip.js +1070 -0
- package/dist/thread/player/avm1/globals/MovieClipLoader.js +90 -0
- package/dist/thread/player/avm1/globals/NetConnection.js +261 -0
- package/dist/thread/player/avm1/globals/PrintJob.js +37 -0
- package/dist/thread/player/avm1/globals/Selection.js +62 -0
- package/dist/thread/player/avm1/globals/SharedObject.js +245 -0
- package/dist/thread/player/avm1/globals/Sound.js +238 -0
- package/dist/thread/player/avm1/globals/Stage.js +12 -0
- package/dist/thread/player/avm1/globals/StyleSheet.js +205 -0
- package/dist/thread/player/avm1/globals/TextField.js +396 -0
- package/dist/thread/player/avm1/globals/TextFormat.js +194 -0
- package/dist/thread/player/avm1/globals/TextSnapshot.js +88 -0
- package/dist/thread/player/avm1/globals/XML.js +396 -0
- package/dist/thread/player/avm1/globals/XMLNode.js +413 -0
- package/dist/thread/player/avm1/globals/XMLSocket.js +205 -0
- package/dist/thread/player/avm1/globals/drawing.js +202 -0
- package/dist/thread/player/avm1/globals/filters.js +635 -0
- package/dist/thread/player/avm1/globals/geom.js +600 -0
- package/dist/thread/player/avm1/input.js +483 -0
- package/dist/thread/player/avm1/keyboard.js +113 -0
- package/dist/thread/player/avm1/loads.js +352 -0
- package/dist/thread/player/avm1/net.js +219 -0
- package/dist/thread/player/avm1/paths.js +104 -0
- package/dist/thread/player/avm1/pointer.js +512 -0
- package/dist/thread/player/avm1/queue.js +303 -0
- package/dist/thread/player/avm1/sound.js +106 -0
- package/dist/thread/player/avm1/swf.js +141 -0
- package/dist/thread/player/avm1/timers.js +113 -0
- package/dist/thread/player/bitmap/bitmap.js +627 -0
- package/dist/thread/player/bitmap/draw.js +68 -0
- package/dist/thread/player/bitmap/dxt.js +11 -0
- package/dist/thread/player/bitmap/filters.js +656 -0
- package/dist/thread/player/bitmap/images.js +240 -0
- package/dist/thread/player/bitmap/kernel.js +65 -0
- package/dist/thread/player/bitmap/ops.js +1239 -0
- package/dist/thread/player/bitmap/pixel-bender.js +911 -0
- package/dist/thread/player/bitmap/png.js +139 -0
- package/dist/thread/player/bitmap/turbulence.js +89 -0
- package/dist/thread/player/clock.js +182 -0
- package/dist/thread/player/display/bitmapobject.js +25 -0
- package/dist/thread/player/display/bounds.js +520 -0
- package/dist/thread/player/display/buttonobject.js +305 -0
- package/dist/thread/player/display/color.js +40 -0
- package/dist/thread/player/display/container.js +150 -0
- package/dist/thread/player/display/display.js +14 -0
- package/dist/thread/player/display/displayobject.js +664 -0
- package/dist/thread/player/display/drawing.js +613 -0
- package/dist/thread/player/display/filters.js +285 -0
- package/dist/thread/player/display/geometry.js +189 -0
- package/dist/thread/player/display/gradients.js +117 -0
- package/dist/thread/player/display/graphicsdata.js +592 -0
- package/dist/thread/player/display/instantiate.js +71 -0
- package/dist/thread/player/display/matrix3d.js +373 -0
- package/dist/thread/player/display/morph.js +226 -0
- package/dist/thread/player/display/movieclip.js +680 -0
- package/dist/thread/player/display/perspective.js +193 -0
- package/dist/thread/player/display/scale9.js +236 -0
- package/dist/thread/player/display/shapeobject.js +131 -0
- package/dist/thread/player/display/shapes.js +407 -0
- package/dist/thread/player/display/textobjects.js +222 -0
- package/dist/thread/player/display/timeline.js +471 -0
- package/dist/thread/player/display/value-lists.js +40 -0
- package/dist/thread/player/display/videoobject.js +6 -0
- package/dist/thread/player/display/walk.js +127 -0
- package/dist/thread/player/files.js +334 -0
- package/dist/thread/player/hosts.js +207 -0
- package/dist/thread/player/input/avm1.js +82 -0
- package/dist/thread/player/input/context-menu.js +63 -0
- package/dist/thread/player/input/keyboard.js +458 -0
- package/dist/thread/player/input/pointer.js +863 -0
- package/dist/thread/player/input/text-editor.js +319 -0
- package/dist/thread/player/input/touch.js +209 -0
- package/dist/thread/player/localconnection.js +90 -0
- package/dist/thread/player/media/audio.js +376 -0
- package/dist/thread/player/media/dynamic-sound.js +90 -0
- package/dist/thread/player/media/extract.js +135 -0
- package/dist/thread/player/media/mp3.js +152 -0
- package/dist/thread/player/media/sounds.js +507 -0
- package/dist/thread/player/media/streaming-audio.js +133 -0
- package/dist/thread/player/player.js +616 -0
- package/dist/thread/player/playerglobal/air/net/WebSocket.js +250 -0
- package/dist/thread/player/playerglobal/air-library.js +8 -0
- package/dist/thread/player/playerglobal/flash/accessibility/Accessibility.js +21 -0
- package/dist/thread/player/playerglobal/flash/crypto/generateRandomBytes.js +32 -0
- package/dist/thread/player/playerglobal/flash/data/EncryptedLocalStore.js +61 -0
- package/dist/thread/player/playerglobal/flash/desktop/Clipboard.js +173 -0
- package/dist/thread/player/playerglobal/flash/desktop/NativeApplication.js +179 -0
- package/dist/thread/player/playerglobal/flash/display/AVM1Movie.js +19 -0
- package/dist/thread/player/playerglobal/flash/display/Bitmap.js +58 -0
- package/dist/thread/player/playerglobal/flash/display/BitmapData.js +633 -0
- package/dist/thread/player/playerglobal/flash/display/DisplayObject.js +614 -0
- package/dist/thread/player/playerglobal/flash/display/DisplayObjectContainer.js +224 -0
- package/dist/thread/player/playerglobal/flash/display/Graphics.js +345 -0
- package/dist/thread/player/playerglobal/flash/display/InteractiveObject.js +87 -0
- package/dist/thread/player/playerglobal/flash/display/Loader.js +79 -0
- package/dist/thread/player/playerglobal/flash/display/LoaderInfo.js +128 -0
- package/dist/thread/player/playerglobal/flash/display/MovieClip.js +194 -0
- package/dist/thread/player/playerglobal/flash/display/NativeWindow.js +245 -0
- package/dist/thread/player/playerglobal/flash/display/Shader.js +26 -0
- package/dist/thread/player/playerglobal/flash/display/ShaderData.js +85 -0
- package/dist/thread/player/playerglobal/flash/display/ShaderInput.js +64 -0
- package/dist/thread/player/playerglobal/flash/display/ShaderJob.js +181 -0
- package/dist/thread/player/playerglobal/flash/display/ShaderParameter.js +23 -0
- package/dist/thread/player/playerglobal/flash/display/Shape.js +13 -0
- package/dist/thread/player/playerglobal/flash/display/SimpleButton.js +103 -0
- package/dist/thread/player/playerglobal/flash/display/Sprite.js +84 -0
- package/dist/thread/player/playerglobal/flash/display/Stage.js +231 -0
- package/dist/thread/player/playerglobal/flash/display/Stage3D.js +54 -0
- package/dist/thread/player/playerglobal/flash/display/shaders.js +228 -0
- package/dist/thread/player/playerglobal/flash/events/Event.js +58 -0
- package/dist/thread/player/playerglobal/flash/events/EventDispatcher.js +103 -0
- package/dist/thread/player/playerglobal/flash/events/GestureEvent.js +34 -0
- package/dist/thread/player/playerglobal/flash/events/HTTPStatusEvent.js +8 -0
- package/dist/thread/player/playerglobal/flash/events/KeyboardEvent.js +51 -0
- package/dist/thread/player/playerglobal/flash/events/MouseEvent.js +59 -0
- package/dist/thread/player/playerglobal/flash/events/PressAndTapGestureEvent.js +30 -0
- package/dist/thread/player/playerglobal/flash/events/TimerEvent.js +16 -0
- package/dist/thread/player/playerglobal/flash/events/TouchEvent.js +45 -0
- package/dist/thread/player/playerglobal/flash/external/ExternalInterface.js +73 -0
- package/dist/thread/player/playerglobal/flash/filesystem/File.js +340 -0
- package/dist/thread/player/playerglobal/flash/filesystem/FileStream.js +453 -0
- package/dist/thread/player/playerglobal/flash/filesystem/paths.js +156 -0
- package/dist/thread/player/playerglobal/flash/filesystem/writes.js +143 -0
- package/dist/thread/player/playerglobal/flash/filters/BevelFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/BitmapFilter.js +205 -0
- package/dist/thread/player/playerglobal/flash/filters/BlurFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/ColorMatrixFilter.js +11 -0
- package/dist/thread/player/playerglobal/flash/filters/ConvolutionFilter.js +26 -0
- package/dist/thread/player/playerglobal/flash/filters/DisplacementMapFilter.js +51 -0
- package/dist/thread/player/playerglobal/flash/filters/DropShadowFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/GlowFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/GradientBevelFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/GradientGlowFilter.js +4 -0
- package/dist/thread/player/playerglobal/flash/filters/ShaderFilter.js +53 -0
- package/dist/thread/player/playerglobal/flash/geom/Matrix3D.js +361 -0
- package/dist/thread/player/playerglobal/flash/geom/PerspectiveProjection.js +122 -0
- package/dist/thread/player/playerglobal/flash/geom/Transform.js +245 -0
- package/dist/thread/player/playerglobal/flash/geom/Utils3D.js +85 -0
- package/dist/thread/player/playerglobal/flash/globalization/Collator.js +149 -0
- package/dist/thread/player/playerglobal/flash/globalization/CurrencyFormatter.js +272 -0
- package/dist/thread/player/playerglobal/flash/globalization/CurrencyParseResult.js +21 -0
- package/dist/thread/player/playerglobal/flash/globalization/DateTimeFormatter.js +463 -0
- package/dist/thread/player/playerglobal/flash/globalization/LocaleID.js +144 -0
- package/dist/thread/player/playerglobal/flash/globalization/NumberFormatter.js +444 -0
- package/dist/thread/player/playerglobal/flash/globalization/NumberParseResult.js +22 -0
- package/dist/thread/player/playerglobal/flash/globalization/StringTools.js +59 -0
- package/dist/thread/player/playerglobal/flash/globalization/locale.js +190 -0
- package/dist/thread/player/playerglobal/flash/media/Camera.js +89 -0
- package/dist/thread/player/playerglobal/flash/media/Microphone.js +126 -0
- package/dist/thread/player/playerglobal/flash/media/Sound.js +543 -0
- package/dist/thread/player/playerglobal/flash/media/SoundMixer.js +74 -0
- package/dist/thread/player/playerglobal/flash/media/SoundTransform.js +40 -0
- package/dist/thread/player/playerglobal/flash/media/Video.js +43 -0
- package/dist/thread/player/playerglobal/flash/net/FileFilter.js +27 -0
- package/dist/thread/player/playerglobal/flash/net/FileReference.js +197 -0
- package/dist/thread/player/playerglobal/flash/net/LocalConnection.js +167 -0
- package/dist/thread/player/playerglobal/flash/net/NetConnection.js +155 -0
- package/dist/thread/player/playerglobal/flash/net/SharedObject.js +299 -0
- package/dist/thread/player/playerglobal/flash/net/Socket.js +282 -0
- package/dist/thread/player/playerglobal/flash/net/URLRequest.js +93 -0
- package/dist/thread/player/playerglobal/flash/net/URLStream.js +146 -0
- package/dist/thread/player/playerglobal/flash/net/XMLSocket.js +14 -0
- package/dist/thread/player/playerglobal/flash/net/local-modern.js +142 -0
- package/dist/thread/player/playerglobal/flash/net/local-values.js +217 -0
- package/dist/thread/player/playerglobal/flash/net/navigateToURL.js +29 -0
- package/dist/thread/player/playerglobal/flash/profiler/Telemetry.js +25 -0
- package/dist/thread/player/playerglobal/flash/sensors/Accelerometer.js +12 -0
- package/dist/thread/player/playerglobal/flash/system/ApplicationDomain.js +69 -0
- package/dist/thread/player/playerglobal/flash/system/Capabilities.js +163 -0
- package/dist/thread/player/playerglobal/flash/system/FSCommandHost.js +17 -0
- package/dist/thread/player/playerglobal/flash/system/Security.js +46 -0
- package/dist/thread/player/playerglobal/flash/system/SecurityDomain.js +21 -0
- package/dist/thread/player/playerglobal/flash/system/System.js +73 -0
- package/dist/thread/player/playerglobal/flash/system/Worker.js +112 -0
- package/dist/thread/player/playerglobal/flash/text/Font.js +95 -0
- package/dist/thread/player/playerglobal/flash/text/StaticText.js +16 -0
- package/dist/thread/player/playerglobal/flash/text/StyleSheet.js +65 -0
- package/dist/thread/player/playerglobal/flash/text/TextField.js +707 -0
- package/dist/thread/player/playerglobal/flash/text/TextRenderer.js +77 -0
- package/dist/thread/player/playerglobal/flash/text/engine/FontDescription.js +141 -0
- package/dist/thread/player/playerglobal/flash/text/engine/TabStop.js +46 -0
- package/dist/thread/player/playerglobal/flash/trace/Trace.js +17 -0
- package/dist/thread/player/playerglobal/flash/ui/ContextMenu.js +17 -0
- package/dist/thread/player/playerglobal/flash/ui/GameInput.js +19 -0
- package/dist/thread/player/playerglobal/flash/ui/Keyboard.js +27 -0
- package/dist/thread/player/playerglobal/flash/ui/Mouse.js +127 -0
- package/dist/thread/player/playerglobal/flash/ui/Multitouch.js +46 -0
- package/dist/thread/player/playerglobal/flash/utils/ByteArray.js +155 -0
- package/dist/thread/player/playerglobal/flash/utils/Timer.js +25 -0
- package/dist/thread/player/playerglobal/flash/xml/XMLDocument.js +74 -0
- package/dist/thread/player/playerglobal/index.js +224 -0
- package/dist/thread/player/playerglobal/libraries.js +10 -0
- package/dist/thread/player/playerglobal/playerglobal-library.js +22 -0
- package/dist/thread/player/playerglobal/toplevel.js +122 -0
- package/dist/thread/player/scripting/clipboard.js +146 -0
- package/dist/thread/player/scripting/code.js +900 -0
- package/dist/thread/player/scripting/evaluate.js +144 -0
- package/dist/thread/player/scripting/events.js +172 -0
- package/dist/thread/player/scripting/handover.js +182 -0
- package/dist/thread/player/scripting/lazy.js +38 -0
- package/dist/thread/player/scripting/lifecycle.js +272 -0
- package/dist/thread/player/scripting/loads.js +860 -0
- package/dist/thread/player/scripting/sha256.js +95 -0
- package/dist/thread/player/scripting/symbols.js +348 -0
- package/dist/thread/player/scripting/timers.js +434 -0
- package/dist/thread/player/scripting/workers.js +923 -0
- package/dist/thread/player/scripting.js +1018 -0
- package/dist/thread/player/stage.js +4 -0
- package/dist/thread/player/text/csm.js +113 -0
- package/dist/thread/player/text/css.js +167 -0
- package/dist/thread/player/text/fonts.js +97 -0
- package/dist/thread/player/text/layout.js +393 -0
- package/dist/thread/player/text/static.js +109 -0
- package/dist/thread/player/text/text.js +431 -0
- package/dist/thread/player/workers/thread.js +159 -0
- package/dist/thread/player/workers/wire.js +198 -0
- package/dist/thread/player-hosts/web-worker.js +19 -0
- package/dist/thread/runtime/avm1/activation.js +89 -0
- package/dist/thread/runtime/avm1/case.js +249 -0
- package/dist/thread/runtime/avm1/clips.js +334 -0
- package/dist/thread/runtime/avm1/control.js +280 -0
- package/dist/thread/runtime/avm1/errors.js +50 -0
- package/dist/thread/runtime/avm1/functions.js +249 -0
- package/dist/thread/runtime/avm1/globals/array.js +549 -0
- package/dist/thread/runtime/avm1/globals/broadcaster.js +131 -0
- package/dist/thread/runtime/avm1/globals/date.js +436 -0
- package/dist/thread/runtime/avm1/globals/global.js +344 -0
- package/dist/thread/runtime/avm1/globals/math.js +139 -0
- package/dist/thread/runtime/avm1/globals/number.js +93 -0
- package/dist/thread/runtime/avm1/globals/string.js +201 -0
- package/dist/thread/runtime/avm1/globals/timers.js +129 -0
- package/dist/thread/runtime/avm1/host.js +5 -0
- package/dist/thread/runtime/avm1/index.js +14 -0
- package/dist/thread/runtime/avm1/inheritance.js +132 -0
- package/dist/thread/runtime/avm1/numbers.js +298 -0
- package/dist/thread/runtime/avm1/objects.js +896 -0
- package/dist/thread/runtime/avm1/operators.js +170 -0
- package/dist/thread/runtime/avm1/realm.js +529 -0
- package/dist/thread/runtime/avm1/runtime.js +882 -0
- package/dist/thread/runtime/avm1/scope.js +385 -0
- package/dist/thread/runtime/avm1/urls.js +180 -0
- package/dist/thread/runtime/avm1/values.js +97 -0
- package/dist/thread/runtime/avm2/amf-classes.js +66 -0
- package/dist/thread/runtime/avm2/amf.js +801 -0
- package/dist/thread/runtime/avm2/array-conversion.js +100 -0
- package/dist/thread/runtime/avm2/builtin-library.js +21 -0
- package/dist/thread/runtime/avm2/cache-fill.js +86 -0
- package/dist/thread/runtime/avm2/classes.js +211 -0
- package/dist/thread/runtime/avm2/definitions.js +69 -0
- package/dist/thread/runtime/avm2/descriptors.js +5 -0
- package/dist/thread/runtime/avm2/dictionary-keys.js +295 -0
- package/dist/thread/runtime/avm2/domain-memory.js +75 -0
- package/dist/thread/runtime/avm2/domain.js +280 -0
- package/dist/thread/runtime/avm2/dynamic-properties.js +182 -0
- package/dist/thread/runtime/avm2/enumeration.js +393 -0
- package/dist/thread/runtime/avm2/errors.js +45 -0
- package/dist/thread/runtime/avm2/float-library.js +66 -0
- package/dist/thread/runtime/avm2/float.js +26 -0
- package/dist/thread/runtime/avm2/hooks.js +19 -0
- package/dist/thread/runtime/avm2/index.js +38 -0
- package/dist/thread/runtime/avm2/messages.js +177 -0
- package/dist/thread/runtime/avm2/method-factories.js +95 -0
- package/dist/thread/runtime/avm2/modules.js +105 -0
- package/dist/thread/runtime/avm2/names.js +248 -0
- package/dist/thread/runtime/avm2/natives/aliases.js +47 -0
- package/dist/thread/runtime/avm2/natives/array.js +390 -0
- package/dist/thread/runtime/avm2/natives/bytearray.js +1227 -0
- package/dist/thread/runtime/avm2/natives/case.js +88 -0
- package/dist/thread/runtime/avm2/natives/concurrent.js +199 -0
- package/dist/thread/runtime/avm2/natives/date.js +581 -0
- package/dist/thread/runtime/avm2/natives/define.js +130 -0
- package/dist/thread/runtime/avm2/natives/describe.js +351 -0
- package/dist/thread/runtime/avm2/natives/dictionary.js +12 -0
- package/dist/thread/runtime/avm2/natives/float-vector.js +81 -0
- package/dist/thread/runtime/avm2/natives/float.js +96 -0
- package/dist/thread/runtime/avm2/natives/index.js +64 -0
- package/dist/thread/runtime/avm2/natives/json.js +514 -0
- package/dist/thread/runtime/avm2/natives/number.js +162 -0
- package/dist/thread/runtime/avm2/natives/object.js +237 -0
- package/dist/thread/runtime/avm2/natives/proxy.js +75 -0
- package/dist/thread/runtime/avm2/natives/regexp.js +485 -0
- package/dist/thread/runtime/avm2/natives/shell-workers.js +404 -0
- package/dist/thread/runtime/avm2/natives/shell.js +557 -0
- package/dist/thread/runtime/avm2/natives/sort.js +377 -0
- package/dist/thread/runtime/avm2/natives/string.js +132 -0
- package/dist/thread/runtime/avm2/natives/sync.js +821 -0
- package/dist/thread/runtime/avm2/natives/toplevel.js +139 -0
- package/dist/thread/runtime/avm2/natives/vector-elements.js +46 -0
- package/dist/thread/runtime/avm2/natives/vector.js +406 -0
- package/dist/thread/runtime/avm2/natives/xml/access.js +633 -0
- package/dist/thread/runtime/avm2/natives/xml/build.js +291 -0
- package/dist/thread/runtime/avm2/natives/xml/chars.js +112 -0
- package/dist/thread/runtime/avm2/natives/xml/escape.js +38 -0
- package/dist/thread/runtime/avm2/natives/xml/names.js +204 -0
- package/dist/thread/runtime/avm2/natives/xml/node.js +272 -0
- package/dist/thread/runtime/avm2/natives/xml/operators.js +69 -0
- package/dist/thread/runtime/avm2/natives/xml/parser.js +356 -0
- package/dist/thread/runtime/avm2/natives/xml/strings.js +191 -0
- package/dist/thread/runtime/avm2/natives/xml/values.js +122 -0
- package/dist/thread/runtime/avm2/natives/xml/xml.js +645 -0
- package/dist/thread/runtime/avm2/number-strings.js +110 -0
- package/dist/thread/runtime/avm2/numbers.js +558 -0
- package/dist/thread/runtime/avm2/options.js +16 -0
- package/dist/thread/runtime/avm2/player-messages.js +550 -0
- package/dist/thread/runtime/avm2/property-cache.js +135 -0
- package/dist/thread/runtime/avm2/runtime.js +2644 -0
- package/dist/thread/runtime/avm2/traits.js +509 -0
- package/dist/thread/runtime/index.js +7 -0
- package/dist/web-worker.d.ts +2 -0
- package/dist/web-worker.d.ts.map +1 -0
- package/dist/web-worker.js +20 -0
- package/dist/web-worker.js.map +1 -0
- package/dist/websocket.d.ts +4 -0
- package/dist/websocket.d.ts.map +1 -0
- package/dist/websocket.js +27 -0
- package/dist/websocket.js.map +1 -0
- package/dist/workers.d.ts +35 -0
- package/dist/workers.d.ts.map +1 -0
- package/dist/workers.js +171 -0
- package/dist/workers.js.map +1 -0
- package/package.json +62 -3
- package/src/indexeddb.ts +227 -0
- package/src/node-worker.ts +13 -0
- package/src/node.ts +49 -0
- package/src/precompiled.ts +166 -0
- package/src/stage3d.ts +76 -0
- package/src/web-worker.ts +24 -0
- package/src/websocket.ts +32 -0
- package/src/workers.ts +255 -0
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
// flash.globalization.NumberFormatter, and the number formatting and
|
|
2
|
+
// parsing it shares with CurrencyFormatter. Flash on Windows formats with
|
|
3
|
+
// its own rules from the locale's settings, which a script may change one
|
|
4
|
+
// by one, so only those settings come from Intl: the digits, separators and
|
|
5
|
+
// patterns are applied here as Flash applies them.
|
|
6
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
7
|
+
import { availableLocales, ILLEGAL_ARGUMENT_ERROR, INVALID_ATTR_VALUE, NO_ERROR, nonNull, PARSE_ERROR, resolveLocale, UNSUPPORTED_ERROR, } from "./locale.js";
|
|
8
|
+
// NumberFormatter's negativeNumberFormat: where the negative symbol goes, "n" the number.
|
|
9
|
+
const NEGATIVE_NUMBER = ["(n)", "-n", "- n", "n-", "n -"];
|
|
10
|
+
// The bidi marks ICU sets around signs and symbols, which Windows has not.
|
|
11
|
+
const BIDI = /[\u061c\u200e\u200f]/g;
|
|
12
|
+
/** The pattern of Intl's parts: the number as "n", its sign as "-", the currency as "$". */
|
|
13
|
+
export function partsPattern(parts) {
|
|
14
|
+
let pattern = "";
|
|
15
|
+
for (const { type, value } of parts) {
|
|
16
|
+
let token;
|
|
17
|
+
switch (type) {
|
|
18
|
+
case "literal":
|
|
19
|
+
token = value
|
|
20
|
+
.replace(BIDI, "")
|
|
21
|
+
.replace(/\s+/g, " ")
|
|
22
|
+
.replace(/[^() ]/g, "");
|
|
23
|
+
break;
|
|
24
|
+
case "minusSign":
|
|
25
|
+
token = "-";
|
|
26
|
+
break;
|
|
27
|
+
case "currency":
|
|
28
|
+
token = "$";
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
token = pattern.endsWith("n") ? "" : "n";
|
|
32
|
+
}
|
|
33
|
+
pattern += token;
|
|
34
|
+
}
|
|
35
|
+
return pattern;
|
|
36
|
+
}
|
|
37
|
+
// Group sizes, the last repeated with a "*": five fields at most.
|
|
38
|
+
const GROUPING = /^(?=.{1,9}$)([1-9](;[1-9])*(;\*)?|\*)$/;
|
|
39
|
+
// Separators longer than three characters Windows refuses.
|
|
40
|
+
const SEPARATOR_MAX = 3;
|
|
41
|
+
// adl crashes formatting a thousand fractional digits; none are padded past that.
|
|
42
|
+
const FRACTION_MAX = 1000;
|
|
43
|
+
const numberData = new Map();
|
|
44
|
+
function localeNumbers(locale) {
|
|
45
|
+
let data = numberData.get(locale);
|
|
46
|
+
if (data) {
|
|
47
|
+
return data;
|
|
48
|
+
}
|
|
49
|
+
const nf = new Intl.NumberFormat(locale);
|
|
50
|
+
const parts = nf.formatToParts(-1234567890.5);
|
|
51
|
+
const value = (type, otherwise) => parts.find((p) => p.type === type)?.value.replace(BIDI, "") ?? otherwise;
|
|
52
|
+
const groups = parts.filter((p) => p.type === "integer").map((p) => p.value.length);
|
|
53
|
+
const primary = groups[groups.length - 1];
|
|
54
|
+
const secondary = groups[groups.length - 2] ?? primary;
|
|
55
|
+
data = {
|
|
56
|
+
decimal: value("decimal", "."),
|
|
57
|
+
group: value("group", ","),
|
|
58
|
+
// Flash's negative symbol is one character; ICU gives some locales U+2212 where Windows has "-".
|
|
59
|
+
minus: value("minusSign", "-").replace("\u2212", "-"),
|
|
60
|
+
digits: nf.format(0).codePointAt(0) ?? 48,
|
|
61
|
+
grouping: secondary === primary ? `${primary};*` : `${primary};${secondary};*`,
|
|
62
|
+
negative: Math.max(0, NEGATIVE_NUMBER.indexOf(partsPattern(parts))),
|
|
63
|
+
};
|
|
64
|
+
numberData.set(locale, data);
|
|
65
|
+
return data;
|
|
66
|
+
}
|
|
67
|
+
/** A locale's number settings, as a NumberFormatter or CurrencyFormatter holds them, and its status. */
|
|
68
|
+
export class NumberSettings {
|
|
69
|
+
status;
|
|
70
|
+
locale;
|
|
71
|
+
fractionalDigits = 2;
|
|
72
|
+
useGrouping = true;
|
|
73
|
+
groupingPattern;
|
|
74
|
+
digitsType;
|
|
75
|
+
decimalSeparator;
|
|
76
|
+
groupingSeparator;
|
|
77
|
+
negativeSymbol;
|
|
78
|
+
negativeFormat;
|
|
79
|
+
leadingZero = true;
|
|
80
|
+
trailingZeros = true;
|
|
81
|
+
constructor(locale) {
|
|
82
|
+
this.locale = locale;
|
|
83
|
+
this.status = locale.status;
|
|
84
|
+
const data = localeNumbers(locale.actual);
|
|
85
|
+
this.decimalSeparator = data.decimal;
|
|
86
|
+
this.groupingSeparator = data.group;
|
|
87
|
+
this.negativeSymbol = data.minus;
|
|
88
|
+
this.digitsType = data.digits;
|
|
89
|
+
this.groupingPattern = data.grouping;
|
|
90
|
+
this.negativeFormat = data.negative;
|
|
91
|
+
}
|
|
92
|
+
/** A setting's new value kept if valid; Flash's status says which. */
|
|
93
|
+
set(key, value, valid = true) {
|
|
94
|
+
if (valid) {
|
|
95
|
+
this[key] = value;
|
|
96
|
+
}
|
|
97
|
+
this.status = valid ? NO_ERROR : ILLEGAL_ARGUMENT_ERROR;
|
|
98
|
+
}
|
|
99
|
+
setFractionalDigits(n) {
|
|
100
|
+
this.set("fractionalDigits", n, n >= 0);
|
|
101
|
+
}
|
|
102
|
+
setGroupingPattern(pattern) {
|
|
103
|
+
this.set("groupingPattern", pattern, GROUPING.test(pattern));
|
|
104
|
+
}
|
|
105
|
+
// Flash's strings are C strings: a NUL ends a separator.
|
|
106
|
+
setDecimalSeparator(given) {
|
|
107
|
+
const separator = given.split("\0")[0];
|
|
108
|
+
this.set("decimalSeparator", separator, separator !== "" && separator.length <= SEPARATOR_MAX);
|
|
109
|
+
}
|
|
110
|
+
setGroupingSeparator(given) {
|
|
111
|
+
const separator = given.split("\0")[0];
|
|
112
|
+
this.set("groupingSeparator", separator, separator.length <= SEPARATOR_MAX);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Digits from a zero: past int's range an illegal argument; past Unicode's
|
|
116
|
+
* last nine, a surrogate or a noncharacter invalid.
|
|
117
|
+
*/
|
|
118
|
+
setDigitsType(zero) {
|
|
119
|
+
const invalid = zero + 9 > 0x10ffff || (zero >= 0xd800 && zero <= 0xdfff) || (zero & 0xfffe) === 0xfffe;
|
|
120
|
+
if (zero <= 0x7fffffff && invalid) {
|
|
121
|
+
this.status = INVALID_ATTR_VALUE;
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
this.set("digitsType", zero, zero <= 0x7fffffff);
|
|
125
|
+
}
|
|
126
|
+
/** A format among `count`: above them invalid, past int's range an illegal argument. */
|
|
127
|
+
setFormat(n, count) {
|
|
128
|
+
this.status =
|
|
129
|
+
n > 0x7fffffff ? ILLEGAL_ARGUMENT_ERROR : n >= count ? INVALID_ATTR_VALUE : NO_ERROR;
|
|
130
|
+
return this.status === NO_ERROR;
|
|
131
|
+
}
|
|
132
|
+
setNegativeFormat(n) {
|
|
133
|
+
if (this.setFormat(n, NEGATIVE_NUMBER.length)) {
|
|
134
|
+
this.negativeFormat = n;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The digits of a number's magnitude, grouped. Flash prints the number
|
|
139
|
+
* with nine decimals and rounds that half up to the digits asked for.
|
|
140
|
+
*/
|
|
141
|
+
digits(magnitude) {
|
|
142
|
+
const fractionalDigits = Math.min(this.fractionalDigits, FRACTION_MAX);
|
|
143
|
+
const fixed = magnitude < 1e21 ? magnitude.toFixed(9) : `${BigInt(magnitude)}.000000000`;
|
|
144
|
+
let [whole, fraction] = fixed.split(".");
|
|
145
|
+
if (fractionalDigits < 9) {
|
|
146
|
+
const up = fraction.charCodeAt(fractionalDigits) >= 53;
|
|
147
|
+
fraction = fraction.slice(0, fractionalDigits);
|
|
148
|
+
if (up) {
|
|
149
|
+
const sum = (BigInt(whole + fraction) + 1n)
|
|
150
|
+
.toString()
|
|
151
|
+
.padStart(whole.length + fraction.length, "0");
|
|
152
|
+
whole = sum.slice(0, sum.length - fraction.length);
|
|
153
|
+
fraction = sum.slice(whole.length);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
fraction = fraction.padEnd(fractionalDigits, "0");
|
|
158
|
+
}
|
|
159
|
+
if (!this.trailingZeros) {
|
|
160
|
+
fraction = fraction.replace(/0+$/, "");
|
|
161
|
+
}
|
|
162
|
+
if (!this.leadingZero && whole === "0") {
|
|
163
|
+
whole = "";
|
|
164
|
+
}
|
|
165
|
+
const grouped = this.useGrouping ? this.group(whole) : whole;
|
|
166
|
+
const text = fraction === "" ? grouped : grouped + this.decimalSeparator + fraction;
|
|
167
|
+
return this.digitsType === 48 ? text : this.localDigits(text);
|
|
168
|
+
}
|
|
169
|
+
group(whole) {
|
|
170
|
+
const pattern = this.groupingPattern.split(";");
|
|
171
|
+
const repeat = pattern[pattern.length - 1] === "*";
|
|
172
|
+
const sizes = (repeat ? pattern.slice(0, -1) : pattern).map(Number);
|
|
173
|
+
const chunks = [];
|
|
174
|
+
let end = whole.length;
|
|
175
|
+
for (let i = 0; end > 0; i++) {
|
|
176
|
+
const size = i < sizes.length ? sizes[i] : repeat && sizes.length > 0 ? sizes[sizes.length - 1] : end;
|
|
177
|
+
chunks.unshift(whole.slice(Math.max(0, end - size), end));
|
|
178
|
+
end -= size;
|
|
179
|
+
}
|
|
180
|
+
return chunks.join(this.groupingSeparator);
|
|
181
|
+
}
|
|
182
|
+
localDigits(text) {
|
|
183
|
+
return text.replace(/[0-9]/g, (d) => String.fromCodePoint(this.digitsType + Number(d)));
|
|
184
|
+
}
|
|
185
|
+
/** A number formatted, `pattern` placing its sign and digits: Flash's infinities and NaN keep none. */
|
|
186
|
+
format(value, pattern, symbol = "") {
|
|
187
|
+
this.status = NO_ERROR;
|
|
188
|
+
if (Number.isNaN(value)) {
|
|
189
|
+
return "NaN";
|
|
190
|
+
}
|
|
191
|
+
if (!Number.isFinite(value)) {
|
|
192
|
+
return value > 0 ? "\u221e" : `${this.negativeSymbol}\u221e`;
|
|
193
|
+
}
|
|
194
|
+
const negative = value < 0 || Object.is(value, -0);
|
|
195
|
+
let out = "";
|
|
196
|
+
for (const c of pattern(negative)) {
|
|
197
|
+
switch (c) {
|
|
198
|
+
case "n":
|
|
199
|
+
out += this.digits(Math.abs(value));
|
|
200
|
+
break;
|
|
201
|
+
case "-":
|
|
202
|
+
out += this.negativeSymbol;
|
|
203
|
+
break;
|
|
204
|
+
case "$":
|
|
205
|
+
out += symbol;
|
|
206
|
+
break;
|
|
207
|
+
default:
|
|
208
|
+
out += c;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
// Flash's strings are C strings: digits from zero end it at a NUL.
|
|
212
|
+
const nul = out.indexOf("\0");
|
|
213
|
+
return nul < 0 ? out : out.slice(0, nul);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* The first number in `text` as Flash finds it: digits of any script,
|
|
217
|
+
* group separators between digits, one decimal separator; its sign by
|
|
218
|
+
* the negative format around it. Null where there is none.
|
|
219
|
+
*/
|
|
220
|
+
findNumber(text) {
|
|
221
|
+
let start = -1;
|
|
222
|
+
for (let i = 0; i < text.length; i++) {
|
|
223
|
+
if (digit(text, i) >= 0 ||
|
|
224
|
+
(text.startsWith(this.decimalSeparator, i) &&
|
|
225
|
+
digit(text, i + this.decimalSeparator.length) >= 0)) {
|
|
226
|
+
start = i;
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (start < 0) {
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
let number = "";
|
|
234
|
+
let i = start;
|
|
235
|
+
for (;;) {
|
|
236
|
+
const d = digit(text, i);
|
|
237
|
+
if (d >= 0) {
|
|
238
|
+
number += d;
|
|
239
|
+
i += 1;
|
|
240
|
+
}
|
|
241
|
+
else if (this.groupingSeparator !== "" &&
|
|
242
|
+
!number.includes(".") &&
|
|
243
|
+
number !== "" &&
|
|
244
|
+
text.startsWith(this.groupingSeparator, i) &&
|
|
245
|
+
digit(text, i + this.groupingSeparator.length) >= 0) {
|
|
246
|
+
i += this.groupingSeparator.length;
|
|
247
|
+
}
|
|
248
|
+
else if (!number.includes(".") && text.startsWith(this.decimalSeparator, i)) {
|
|
249
|
+
number += ".";
|
|
250
|
+
i += this.decimalSeparator.length;
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
let value = Number(number);
|
|
257
|
+
let end = i;
|
|
258
|
+
// A sign or parenthesis stands at most a space from the number; U+2212 is a minus too.
|
|
259
|
+
const signs = this.negativeSymbol === "-" ? ["-", "\u2212"] : [this.negativeSymbol];
|
|
260
|
+
const before = skipSpace(text, start, -1);
|
|
261
|
+
const after = skipSpace(text, end, 1);
|
|
262
|
+
switch (this.negativeFormat) {
|
|
263
|
+
case 0:
|
|
264
|
+
if (text[before - 1] === "(" && text[after] === ")") {
|
|
265
|
+
value = -value;
|
|
266
|
+
start = before - 1;
|
|
267
|
+
end = after + 1;
|
|
268
|
+
}
|
|
269
|
+
break;
|
|
270
|
+
case 1:
|
|
271
|
+
case 2: {
|
|
272
|
+
const sign = signs.find((sign) => text.slice(0, before).endsWith(sign));
|
|
273
|
+
if (sign) {
|
|
274
|
+
value = -value;
|
|
275
|
+
start = before - sign.length;
|
|
276
|
+
}
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
default: {
|
|
280
|
+
const sign = signs.find((sign) => text.startsWith(sign, after));
|
|
281
|
+
if (sign) {
|
|
282
|
+
value = -value;
|
|
283
|
+
end = after + sign.length;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return { value, start, end };
|
|
288
|
+
}
|
|
289
|
+
parse(text) {
|
|
290
|
+
if (text === "") {
|
|
291
|
+
this.status = ILLEGAL_ARGUMENT_ERROR;
|
|
292
|
+
return { value: Number.NaN, start: 0x7fffffff, end: 0x7fffffff };
|
|
293
|
+
}
|
|
294
|
+
const found = this.findNumber(text);
|
|
295
|
+
this.status = found ? NO_ERROR : PARSE_ERROR;
|
|
296
|
+
return found ?? { value: Number.NaN, start: 0x7fffffff, end: 0x7fffffff };
|
|
297
|
+
}
|
|
298
|
+
/** A number filling `text` but for spaces; NaN otherwise. */
|
|
299
|
+
parseNumber(text) {
|
|
300
|
+
const { value, start, end } = this.parse(text);
|
|
301
|
+
if (this.status !== NO_ERROR) {
|
|
302
|
+
return value;
|
|
303
|
+
}
|
|
304
|
+
if (skipSpaces(text, start, -1) > 0 || skipSpaces(text, end, 1) < text.length) {
|
|
305
|
+
this.status = PARSE_ERROR;
|
|
306
|
+
return Number.NaN;
|
|
307
|
+
}
|
|
308
|
+
return value;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
/** The value of the decimal digit at `i`, of any script, or -1. */
|
|
312
|
+
export function digit(text, i) {
|
|
313
|
+
const c = text.codePointAt(i);
|
|
314
|
+
if (c === undefined || !/\p{Nd}/u.test(String.fromCodePoint(c))) {
|
|
315
|
+
return -1;
|
|
316
|
+
}
|
|
317
|
+
// Unicode's decimal digits come in runs of ten from zero.
|
|
318
|
+
let zero = c;
|
|
319
|
+
while (zero > 0 && /\p{Nd}/u.test(String.fromCodePoint(zero - 1))) {
|
|
320
|
+
zero--;
|
|
321
|
+
}
|
|
322
|
+
return (c - zero) % 10;
|
|
323
|
+
}
|
|
324
|
+
const isSpace = (c) => c !== undefined && /\p{Zs}/u.test(c);
|
|
325
|
+
// The spaces that may stand between a sign and its number: plain, no-break, narrow and ideographic.
|
|
326
|
+
const SIGN_SPACES = " \u00a0\u202f\u3000";
|
|
327
|
+
/** The index past one space at `i` in direction `step`, if there is one. */
|
|
328
|
+
function skipSpace(text, i, step) {
|
|
329
|
+
const c = step > 0 ? text[i] : text[i - 1];
|
|
330
|
+
return c !== undefined && SIGN_SPACES.includes(c) ? i + step : i;
|
|
331
|
+
}
|
|
332
|
+
/** The index past the spaces from `i` on in direction `step`: Flash's spaces are Unicode's space separators. */
|
|
333
|
+
function skipSpaces(text, i, step) {
|
|
334
|
+
const at = step > 0 ? (j) => text[j] : (j) => text[j - 1];
|
|
335
|
+
while (isSpace(at(i))) {
|
|
336
|
+
i += step;
|
|
337
|
+
}
|
|
338
|
+
return i;
|
|
339
|
+
}
|
|
340
|
+
export function numberFormatterNatives(s) {
|
|
341
|
+
const natives = {};
|
|
342
|
+
const settings = (o) => o.$settings;
|
|
343
|
+
const format = (o, value) => {
|
|
344
|
+
const f = settings(o);
|
|
345
|
+
return f.format(value, (negative) => (negative ? NEGATIVE_NUMBER[f.negativeFormat] : "n"));
|
|
346
|
+
};
|
|
347
|
+
class NumberFormatterNatives {
|
|
348
|
+
static getAvailableLocaleIDNames() {
|
|
349
|
+
return availableLocales(s);
|
|
350
|
+
}
|
|
351
|
+
"flash.globalization:NumberFormatter::ctor"(name) {
|
|
352
|
+
this.$settings = new NumberSettings(resolveLocale(s, nonNull(s, name, "requestedLocaleIDName")));
|
|
353
|
+
}
|
|
354
|
+
get lastOperationStatus() {
|
|
355
|
+
return settings(this).status;
|
|
356
|
+
}
|
|
357
|
+
get requestedLocaleIDName() {
|
|
358
|
+
return settings(this).locale.requested;
|
|
359
|
+
}
|
|
360
|
+
get actualLocaleIDName() {
|
|
361
|
+
return settings(this).locale.actual;
|
|
362
|
+
}
|
|
363
|
+
get fractionalDigits() {
|
|
364
|
+
return settings(this).fractionalDigits;
|
|
365
|
+
}
|
|
366
|
+
set fractionalDigits(n) {
|
|
367
|
+
settings(this).setFractionalDigits(n);
|
|
368
|
+
}
|
|
369
|
+
get useGrouping() {
|
|
370
|
+
return settings(this).useGrouping;
|
|
371
|
+
}
|
|
372
|
+
set useGrouping(v) {
|
|
373
|
+
settings(this).set("useGrouping", v);
|
|
374
|
+
}
|
|
375
|
+
get groupingPattern() {
|
|
376
|
+
return settings(this).groupingPattern;
|
|
377
|
+
}
|
|
378
|
+
set groupingPattern(v) {
|
|
379
|
+
settings(this).setGroupingPattern(nonNull(s, v, "value"));
|
|
380
|
+
}
|
|
381
|
+
get digitsType() {
|
|
382
|
+
return settings(this).digitsType;
|
|
383
|
+
}
|
|
384
|
+
set digitsType(v) {
|
|
385
|
+
settings(this).setDigitsType(v);
|
|
386
|
+
}
|
|
387
|
+
get decimalSeparator() {
|
|
388
|
+
return settings(this).decimalSeparator;
|
|
389
|
+
}
|
|
390
|
+
set decimalSeparator(v) {
|
|
391
|
+
settings(this).setDecimalSeparator(nonNull(s, v, "value"));
|
|
392
|
+
}
|
|
393
|
+
get groupingSeparator() {
|
|
394
|
+
return settings(this).groupingSeparator;
|
|
395
|
+
}
|
|
396
|
+
set groupingSeparator(v) {
|
|
397
|
+
settings(this).setGroupingSeparator(nonNull(s, v, "value"));
|
|
398
|
+
}
|
|
399
|
+
get negativeSymbol() {
|
|
400
|
+
return settings(this).negativeSymbol;
|
|
401
|
+
}
|
|
402
|
+
// Windows keeps the locale's.
|
|
403
|
+
set negativeSymbol(v) {
|
|
404
|
+
nonNull(s, v, "value");
|
|
405
|
+
settings(this).status = UNSUPPORTED_ERROR;
|
|
406
|
+
}
|
|
407
|
+
get negativeNumberFormat() {
|
|
408
|
+
return settings(this).negativeFormat;
|
|
409
|
+
}
|
|
410
|
+
set negativeNumberFormat(n) {
|
|
411
|
+
settings(this).setNegativeFormat(n);
|
|
412
|
+
}
|
|
413
|
+
get leadingZero() {
|
|
414
|
+
return settings(this).leadingZero;
|
|
415
|
+
}
|
|
416
|
+
set leadingZero(v) {
|
|
417
|
+
settings(this).set("leadingZero", v);
|
|
418
|
+
}
|
|
419
|
+
get trailingZeros() {
|
|
420
|
+
return settings(this).trailingZeros;
|
|
421
|
+
}
|
|
422
|
+
set trailingZeros(v) {
|
|
423
|
+
settings(this).set("trailingZeros", v);
|
|
424
|
+
}
|
|
425
|
+
formatInt(value) {
|
|
426
|
+
return format(this, value);
|
|
427
|
+
}
|
|
428
|
+
formatUint(value) {
|
|
429
|
+
return format(this, value);
|
|
430
|
+
}
|
|
431
|
+
formatNumber(value) {
|
|
432
|
+
return format(this, value);
|
|
433
|
+
}
|
|
434
|
+
parse(text) {
|
|
435
|
+
const { value, start, end } = settings(this).parse(nonNull(s, text, "parseString"));
|
|
436
|
+
return s.rt.construct(s.rt.classNamed("flash.globalization::NumberParseResult"), value, start, end);
|
|
437
|
+
}
|
|
438
|
+
parseNumber(text) {
|
|
439
|
+
return settings(this).parseNumber(nonNull(s, text, "parseString"));
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
avm2.registerNativeClass(natives, "flash.globalization::NumberFormatter", NumberFormatterNatives);
|
|
443
|
+
return natives;
|
|
444
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
2
|
+
export function numberParseResultNatives() {
|
|
3
|
+
const natives = {};
|
|
4
|
+
class NumberParseResultNatives {
|
|
5
|
+
"flash.globalization:NumberParseResult::ctor"(value, startIndex, endIndex) {
|
|
6
|
+
this.$numberValue = value;
|
|
7
|
+
this.$startIndex = startIndex;
|
|
8
|
+
this.$endIndex = endIndex;
|
|
9
|
+
}
|
|
10
|
+
get value() {
|
|
11
|
+
return this.$numberValue;
|
|
12
|
+
}
|
|
13
|
+
get startIndex() {
|
|
14
|
+
return this.$startIndex;
|
|
15
|
+
}
|
|
16
|
+
get endIndex() {
|
|
17
|
+
return this.$endIndex;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
avm2.registerNativeClass(natives, "flash.globalization::NumberParseResult", NumberParseResultNatives);
|
|
21
|
+
return natives;
|
|
22
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// flash.globalization.StringTools: case mapping character by character, as
|
|
2
|
+
// Windows maps case: no context, as a final sigma's, and no locale's rules
|
|
3
|
+
// but Turkish, Azerbaijani and Lithuanian ones, so Greek keeps its accents.
|
|
4
|
+
// A character whose full mapping expands takes its simple one where its
|
|
5
|
+
// decomposition gives one (ᾳ to ᾼ) and stays as it is otherwise (fi, ʼn),
|
|
6
|
+
// but for ß, which Flash makes SS, and İ, which it lowers to i.
|
|
7
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
8
|
+
import { availableLocales, NO_ERROR, nonNull, resolveLocale } from "./locale.js";
|
|
9
|
+
const CASED_LOCALES = /^(tr|az|lt)\b/;
|
|
10
|
+
function mapCase(text, locale, lower) {
|
|
11
|
+
const rules = CASED_LOCALES.test(locale) ? locale : "und";
|
|
12
|
+
const map = (c) => (lower ? c.toLocaleLowerCase(rules) : c.toLocaleUpperCase(rules));
|
|
13
|
+
let out = "";
|
|
14
|
+
for (const c of text) {
|
|
15
|
+
const mapped = [...map(c)];
|
|
16
|
+
if (mapped.length === 1 || c === "\u00df") {
|
|
17
|
+
out += mapped.join("");
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
// The base letter mapped, its marks kept: the simple mapping, if it is one character
|
|
21
|
+
// (Lithuanian's Ì lowers to ì); else a lower case keeps its first character, the dotted
|
|
22
|
+
// I's i, and an upper case the character as it is.
|
|
23
|
+
const [base, ...marks] = [...c.normalize("NFD")];
|
|
24
|
+
const simple = [...(map(base) + marks.join("")).normalize("NFC")];
|
|
25
|
+
out += simple.length === 1 ? simple[0] : lower ? mapped[0] : c;
|
|
26
|
+
}
|
|
27
|
+
return out;
|
|
28
|
+
}
|
|
29
|
+
export function stringToolsNatives(s) {
|
|
30
|
+
const natives = {};
|
|
31
|
+
class StringToolsNatives {
|
|
32
|
+
static getAvailableLocaleIDNames() {
|
|
33
|
+
return availableLocales(s);
|
|
34
|
+
}
|
|
35
|
+
"flash.globalization:StringTools::ctor"(name) {
|
|
36
|
+
this.$locale = resolveLocale(s, nonNull(s, name, "requestedLocaleIDName"));
|
|
37
|
+
this.$status = this.$locale.status;
|
|
38
|
+
}
|
|
39
|
+
get lastOperationStatus() {
|
|
40
|
+
return this.$status;
|
|
41
|
+
}
|
|
42
|
+
get requestedLocaleIDName() {
|
|
43
|
+
return this.$locale.requested;
|
|
44
|
+
}
|
|
45
|
+
get actualLocaleIDName() {
|
|
46
|
+
return this.$locale.actual;
|
|
47
|
+
}
|
|
48
|
+
toLowerCase(text) {
|
|
49
|
+
this.$status = NO_ERROR;
|
|
50
|
+
return mapCase(nonNull(s, text, "s"), this.$locale.actual, true);
|
|
51
|
+
}
|
|
52
|
+
toUpperCase(text) {
|
|
53
|
+
this.$status = NO_ERROR;
|
|
54
|
+
return mapCase(nonNull(s, text, "s"), this.$locale.actual, false);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
avm2.registerNativeClass(natives, "flash.globalization::StringTools", StringToolsNatives);
|
|
58
|
+
return natives;
|
|
59
|
+
}
|