@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,79 @@
|
|
|
1
|
+
// flash.display.Loader: a container whose one child is the root of the SWF
|
|
2
|
+
// it loaded. Its loads complete in a later frame (Loads.completeLoads),
|
|
3
|
+
// but an AVM1 SWF's from bytes, at the end of the frame (Loads.requestLoad).
|
|
4
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
5
|
+
import { uncaughtErrorEvents } from "./LoaderInfo.js";
|
|
6
|
+
/** A copy of a ByteArray's bytes, as they are now. */
|
|
7
|
+
function copyOf(s, v) {
|
|
8
|
+
if (!v) {
|
|
9
|
+
throw s.rt.error("TypeError", 2007, "bytes");
|
|
10
|
+
}
|
|
11
|
+
const b = avm2.bytesOf(s.rt, v);
|
|
12
|
+
return new Uint8Array(b.buffer.subarray(0, b.length));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A LoaderContext's parameters, which take the place of the content's URL
|
|
16
|
+
* query in its loaderInfo.parameters: null when none were set. Flash
|
|
17
|
+
* refuses any value that is not a String, null and undefined among them,
|
|
18
|
+
* with Error #2196 at the call; an object that is not one, such as a
|
|
19
|
+
* String, has no names and gives none.
|
|
20
|
+
*/
|
|
21
|
+
function contextParameters(s, v) {
|
|
22
|
+
if (v === null || v === undefined) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const parameters = new Map();
|
|
26
|
+
for (let i = s.rt.hasNext(v, 0); i !== 0; i = s.rt.hasNext(v, i)) {
|
|
27
|
+
const value = s.rt.nextValue(v, i);
|
|
28
|
+
if (typeof value !== "string") {
|
|
29
|
+
throw s.rt.error("flash.errors::IllegalOperationError", 2196, "LoaderContext.parameters");
|
|
30
|
+
}
|
|
31
|
+
parameters.set(String(s.rt.nextName(v, i)), value);
|
|
32
|
+
}
|
|
33
|
+
return parameters;
|
|
34
|
+
}
|
|
35
|
+
export function loaderNatives(s) {
|
|
36
|
+
const natives = {};
|
|
37
|
+
class LoaderNatives {
|
|
38
|
+
get content() {
|
|
39
|
+
return this.$content ?? null;
|
|
40
|
+
}
|
|
41
|
+
get contentLoaderInfo() {
|
|
42
|
+
if (!this.$loaderInfo) {
|
|
43
|
+
this.$loaderInfo = s.loads.loaderInfo(this);
|
|
44
|
+
}
|
|
45
|
+
return this.$loaderInfo;
|
|
46
|
+
}
|
|
47
|
+
// Both take the LoaderContext's fields after the source: checkPolicyFile,
|
|
48
|
+
// applicationDomain, securityDomain, requestedContentParent, parameters,
|
|
49
|
+
// the JPEG deblocking, allowCodeImport and imageDecodingPolicy. Only
|
|
50
|
+
// applicationDomain, for where the content's code loads, and parameters
|
|
51
|
+
// are read.
|
|
52
|
+
"flash.display:Loader::_loadBytes"(bytes, _checkPolicyFile, applicationDomain, _securityDomain, _requestedContentParent, parameters) {
|
|
53
|
+
const copy = copyOf(s, bytes);
|
|
54
|
+
const given = contextParameters(s, parameters);
|
|
55
|
+
s.loads.requestLoad(this, copy, s.loads.loadDomain(applicationDomain), given);
|
|
56
|
+
}
|
|
57
|
+
"flash.display:Loader::_load"(request, _checkPolicyFile, applicationDomain, _securityDomain, _requestedContentParent, parameters) {
|
|
58
|
+
const given = contextParameters(s, parameters);
|
|
59
|
+
s.loads.requestLoadUrl(this, request, s.loads.loadDomain(applicationDomain), given);
|
|
60
|
+
}
|
|
61
|
+
"flash.display:Loader::_unload"(stopAllMovieClips, _gc) {
|
|
62
|
+
s.loads.unload(this, !!stopAllMovieClips);
|
|
63
|
+
}
|
|
64
|
+
"flash.display:Loader::_getJPEGLoaderContextdeblockingfilter"(_context) {
|
|
65
|
+
return 0;
|
|
66
|
+
}
|
|
67
|
+
"flash.display:Loader::_close"() {
|
|
68
|
+
s.loads.closeLoad(this);
|
|
69
|
+
}
|
|
70
|
+
"flash.display:Loader::_getUncaughtErrorEvents"() {
|
|
71
|
+
return uncaughtErrorEvents(s, this);
|
|
72
|
+
}
|
|
73
|
+
"flash.display:Loader::_setUncaughtErrorEvents"(v) {
|
|
74
|
+
this.$uncaught = v;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
avm2.registerNativeClass(natives, "flash.display::Loader", LoaderNatives);
|
|
78
|
+
return natives;
|
|
79
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// flash.display.LoaderInfo: what is known of a SWF or image, the main one's or a
|
|
2
|
+
// Loader's; Loads.loaderInfo makes one and keeps its facts on it.
|
|
3
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
4
|
+
/** A LoaderInfo's facts about its SWF, which Flash refuses to tell before the SWF is loaded: Error #2099. */
|
|
5
|
+
function factsOf(s, info) {
|
|
6
|
+
if (info.$image) {
|
|
7
|
+
throw s.rt.error("Error", 2098);
|
|
8
|
+
}
|
|
9
|
+
if (!info.$swf) {
|
|
10
|
+
throw s.rt.error("Error", 2099);
|
|
11
|
+
}
|
|
12
|
+
return info.$swf;
|
|
13
|
+
}
|
|
14
|
+
/** The UncaughtErrorEvents of `owner`, a Loader or the main SWF's LoaderInfo, made when first asked for. */
|
|
15
|
+
export function uncaughtErrorEvents(s, owner) {
|
|
16
|
+
if (!owner.$uncaught) {
|
|
17
|
+
owner.$uncaught = s.rt.construct(s.rt.classNamed("flash.events::UncaughtErrorEvents"));
|
|
18
|
+
}
|
|
19
|
+
return owner.$uncaught;
|
|
20
|
+
}
|
|
21
|
+
export function loaderInfoNatives(s) {
|
|
22
|
+
const natives = {};
|
|
23
|
+
class LoaderInfoNatives {
|
|
24
|
+
get loader() {
|
|
25
|
+
return this.$loader;
|
|
26
|
+
}
|
|
27
|
+
get content() {
|
|
28
|
+
return this.$content;
|
|
29
|
+
}
|
|
30
|
+
get url() {
|
|
31
|
+
return this.$url;
|
|
32
|
+
}
|
|
33
|
+
get loaderURL() {
|
|
34
|
+
return this.$loaderURL;
|
|
35
|
+
}
|
|
36
|
+
get isURLInaccessible() {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
get bytesLoaded() {
|
|
40
|
+
return this.$loaded;
|
|
41
|
+
}
|
|
42
|
+
get bytesTotal() {
|
|
43
|
+
return this.$total;
|
|
44
|
+
}
|
|
45
|
+
// The domain its load chose (Loads.loadDomain), or the main SWF's.
|
|
46
|
+
get applicationDomain() {
|
|
47
|
+
return this.$domain || this.$swf
|
|
48
|
+
? s.code.applicationDomainOf(this.$domain ?? s.mainDomain)
|
|
49
|
+
: null;
|
|
50
|
+
}
|
|
51
|
+
get swfVersion() {
|
|
52
|
+
return factsOf(s, this).version;
|
|
53
|
+
}
|
|
54
|
+
get actionScriptVersion() {
|
|
55
|
+
return factsOf(s, this).as3 ? 3 : 2;
|
|
56
|
+
}
|
|
57
|
+
get frameRate() {
|
|
58
|
+
return factsOf(s, this).frameRate;
|
|
59
|
+
}
|
|
60
|
+
get width() {
|
|
61
|
+
return (this.$image ?? factsOf(s, this)).width;
|
|
62
|
+
}
|
|
63
|
+
get height() {
|
|
64
|
+
return (this.$image ?? factsOf(s, this)).height;
|
|
65
|
+
}
|
|
66
|
+
get contentType() {
|
|
67
|
+
return this.$image?.contentType ?? (this.$swf ? "application/x-shockwave-flash" : null);
|
|
68
|
+
}
|
|
69
|
+
get sharedEvents() {
|
|
70
|
+
if (!this.$shared) {
|
|
71
|
+
this.$shared = s.rt.construct(s.rt.classNamed("flash.events::EventDispatcher"));
|
|
72
|
+
}
|
|
73
|
+
return this.$shared;
|
|
74
|
+
}
|
|
75
|
+
get sameDomain() {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
get childAllowsParent() {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
get parentAllowsChild() {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
get parentSandboxBridge() {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
set parentSandboxBridge(_v) {
|
|
88
|
+
// One sandbox.
|
|
89
|
+
}
|
|
90
|
+
get childSandboxBridge() {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
set childSandboxBridge(_v) {
|
|
94
|
+
// One sandbox.
|
|
95
|
+
}
|
|
96
|
+
/** The SWF's bytes as a ByteArray, when they are known. */
|
|
97
|
+
get bytes() {
|
|
98
|
+
if (!this.$bytes) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
const array = s.rt.construct(s.rt.classNamed("flash.utils::ByteArray"));
|
|
102
|
+
const b = avm2.bytesOf(s.rt, array);
|
|
103
|
+
b.write(this.$bytes);
|
|
104
|
+
b.position = 0;
|
|
105
|
+
return array;
|
|
106
|
+
}
|
|
107
|
+
// A new object at each ask, as Flash's: a script that changes one changes no other.
|
|
108
|
+
"flash.display:LoaderInfo::_getArgs"() {
|
|
109
|
+
const args = s.rt.objectTraits.instance();
|
|
110
|
+
for (const [name, value] of this.$params) {
|
|
111
|
+
s.rt.setProperty(args, s.rt.publicName(name), value);
|
|
112
|
+
}
|
|
113
|
+
return args;
|
|
114
|
+
}
|
|
115
|
+
/** The Loader's and its LoaderInfo's uncaughtErrorEvents are one dispatcher. */
|
|
116
|
+
"flash.display:LoaderInfo::_getUncaughtErrorEvents"() {
|
|
117
|
+
return uncaughtErrorEvents(s, this.$loader ?? this);
|
|
118
|
+
}
|
|
119
|
+
"flash.display:LoaderInfo::_setUncaughtErrorEvents"(v) {
|
|
120
|
+
(this.$loader ?? this).$uncaught = v;
|
|
121
|
+
}
|
|
122
|
+
static getLoaderInfoByDefinition(_object) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
avm2.registerNativeClass(natives, "flash.display::LoaderInfo", LoaderInfoNatives);
|
|
127
|
+
return natives;
|
|
128
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
// flash.display.MovieClip and FrameLabel: the timeline from a script, its
|
|
2
|
+
// scenes and labels. Frame scripts registered with addFrameScript run when
|
|
3
|
+
// their frame is entered, in the frame's script phase; a goto takes the
|
|
4
|
+
// next phase there.
|
|
5
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
6
|
+
export function movieClipNatives(s) {
|
|
7
|
+
const natives = {};
|
|
8
|
+
// s.rt at call time: the natives are made before the runtime that holds them is.
|
|
9
|
+
/** The scene the clip's frame is in, by its index in the timeline's scenes. */
|
|
10
|
+
const sceneIndex = (clip) => {
|
|
11
|
+
const scenes = clip.timeline.scenes;
|
|
12
|
+
const frame = Math.max(1, clip.currentFrame);
|
|
13
|
+
let i = 0;
|
|
14
|
+
while (i + 1 < scenes.length && scenes[i + 1].frame <= frame) {
|
|
15
|
+
i++;
|
|
16
|
+
}
|
|
17
|
+
return i;
|
|
18
|
+
};
|
|
19
|
+
/** A scene's first frame, and the first after it. */
|
|
20
|
+
const sceneFrames = (clip, i) => {
|
|
21
|
+
const scenes = clip.timeline.scenes;
|
|
22
|
+
return [scenes[i].frame, i + 1 < scenes.length ? scenes[i + 1].frame : clip.totalFrames + 1];
|
|
23
|
+
};
|
|
24
|
+
/** Labels in a scene; the last scene's run on past the last frame, as a label after it may. */
|
|
25
|
+
const inScene = (clip, i, labels) => {
|
|
26
|
+
const [first, after] = sceneFrames(clip, i);
|
|
27
|
+
const last = i + 1 === clip.timeline.scenes.length;
|
|
28
|
+
return labels.filter((l) => l.frame >= first && (last || l.frame < after));
|
|
29
|
+
};
|
|
30
|
+
/** A flash.display.Scene, made anew on each read as Flash does: its labels' frames count from its first. */
|
|
31
|
+
const sceneObject = (clip, i) => {
|
|
32
|
+
const [first, after] = sceneFrames(clip, i);
|
|
33
|
+
const labelClass = s.rt.classNamed("flash.display::FrameLabel");
|
|
34
|
+
const labels = inScene(clip, i, clip.timeline.labels).map((l) => s.rt.construct(labelClass, l.name, l.frame - first + 1));
|
|
35
|
+
return s.rt.construct(s.rt.classNamed("flash.display::Scene"), clip.timeline.scenes[i].name, s.rt.array(labels), after - first);
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The frame a goto names, on the whole timeline: a number counts from the
|
|
39
|
+
* scene's first frame, the named scene's or the clip's own, and a label is
|
|
40
|
+
* looked for in that scene alone. A scene of that name must exist (2108),
|
|
41
|
+
* and in a named scene, or one of several, as only scene data makes, a
|
|
42
|
+
* label in it (2109); in a timeline's one unnamed scene an unknown label
|
|
43
|
+
* is a number, 0, which takes Flash to frame 1.
|
|
44
|
+
*/
|
|
45
|
+
const frameOf = (clip, frame, scene) => {
|
|
46
|
+
const scenes = clip.timeline.scenes;
|
|
47
|
+
let i = sceneIndex(clip);
|
|
48
|
+
if (scene !== null && scene !== undefined) {
|
|
49
|
+
const name = s.rt.toString(scene);
|
|
50
|
+
i = scenes.findIndex((x) => x.name === name);
|
|
51
|
+
if (i < 0) {
|
|
52
|
+
throw s.rt.error("ArgumentError", 2108, name);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const first = sceneFrames(clip, i)[0];
|
|
56
|
+
if (typeof frame === "string" && !/^\d+$/.test(frame)) {
|
|
57
|
+
const label = inScene(clip, i, clip.timeline.gotoLabels).find((l) => l.name === frame);
|
|
58
|
+
if (label) {
|
|
59
|
+
return label.frame;
|
|
60
|
+
}
|
|
61
|
+
if (scenes[i].name !== "" || scenes.length > 1) {
|
|
62
|
+
throw s.rt.error("ArgumentError", 2109, frame, scenes[i].name);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return first + s.rt.toInt(frame) - 1;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Jump to `frame`, playing or stopped: at once, or when the frame script
|
|
69
|
+
* asking returns, as Flash defers a goto from one. The clip plays or stops
|
|
70
|
+
* as the goto happens, before the landing frame's script runs, so a
|
|
71
|
+
* stop() or play() there has the last word, and one the asking script
|
|
72
|
+
* calls after a deferred goto has none (`goto-stops`).
|
|
73
|
+
*/
|
|
74
|
+
const goto = (clip, frame, play) => {
|
|
75
|
+
if ((clip.library.version ?? 10) <= 9) {
|
|
76
|
+
clip.skipsAfter = s.frames;
|
|
77
|
+
}
|
|
78
|
+
if (s.inFrameScript === clip) {
|
|
79
|
+
clip.queuedGoto = frame;
|
|
80
|
+
clip.queuedPlay = play;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
clip.playing = play;
|
|
84
|
+
clip.gotoFrame(frame);
|
|
85
|
+
s.gotoCycle(clip);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
class MovieClipNatives {
|
|
89
|
+
addFrameScript(...args) {
|
|
90
|
+
const clip = this.$display;
|
|
91
|
+
for (let i = 0; i + 1 < args.length; i += 2) {
|
|
92
|
+
clip.setFrameScript(s.rt.toInt(args[i]) + 1, args[i + 1]);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/** The frame in its scene, 1 the scene's first. */
|
|
96
|
+
get currentFrame() {
|
|
97
|
+
const clip = this.$display;
|
|
98
|
+
return Math.max(1, clip.currentFrame) - sceneFrames(clip, sceneIndex(clip))[0] + 1;
|
|
99
|
+
}
|
|
100
|
+
get totalFrames() {
|
|
101
|
+
return this.$display.totalFrames;
|
|
102
|
+
}
|
|
103
|
+
get framesLoaded() {
|
|
104
|
+
return this.$display.totalFrames;
|
|
105
|
+
}
|
|
106
|
+
/** The nearest label at or before the frame, whatever scene it is in. */
|
|
107
|
+
get currentLabel() {
|
|
108
|
+
const clip = this.$display;
|
|
109
|
+
let label = null;
|
|
110
|
+
for (const l of clip.timeline.labels) {
|
|
111
|
+
if (l.frame > clip.currentFrame) {
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
label = l.name;
|
|
115
|
+
}
|
|
116
|
+
return label;
|
|
117
|
+
}
|
|
118
|
+
/** A FrameLabel tag on this very frame, which Flash reads even where the scene data has none. */
|
|
119
|
+
get currentFrameLabel() {
|
|
120
|
+
return this.$display.timeline.frameLabels.get(this.$display.currentFrame) ?? null;
|
|
121
|
+
}
|
|
122
|
+
get scenes() {
|
|
123
|
+
const clip = this.$display;
|
|
124
|
+
return s.rt.array(clip.timeline.scenes.map((_, i) => sceneObject(clip, i)));
|
|
125
|
+
}
|
|
126
|
+
get currentScene() {
|
|
127
|
+
const clip = this.$display;
|
|
128
|
+
return sceneObject(clip, sceneIndex(clip));
|
|
129
|
+
}
|
|
130
|
+
/** The scene before's first frame, playing; in the first scene, its own. */
|
|
131
|
+
prevScene() {
|
|
132
|
+
const clip = this.$display;
|
|
133
|
+
goto(clip, sceneFrames(clip, Math.max(0, sceneIndex(clip) - 1))[0], true);
|
|
134
|
+
}
|
|
135
|
+
/** The next scene's first frame, playing; in the last scene, its own. */
|
|
136
|
+
nextScene() {
|
|
137
|
+
const clip = this.$display;
|
|
138
|
+
const i = sceneIndex(clip);
|
|
139
|
+
goto(clip, sceneFrames(clip, Math.min(clip.timeline.scenes.length - 1, i + 1))[0], true);
|
|
140
|
+
}
|
|
141
|
+
get isPlaying() {
|
|
142
|
+
return this.$display.playing;
|
|
143
|
+
}
|
|
144
|
+
play() {
|
|
145
|
+
this.$display.playing = true;
|
|
146
|
+
}
|
|
147
|
+
stop() {
|
|
148
|
+
this.$display.playing = false;
|
|
149
|
+
}
|
|
150
|
+
nextFrame() {
|
|
151
|
+
const clip = this.$display;
|
|
152
|
+
goto(clip, clip.currentFrame + 1, false);
|
|
153
|
+
}
|
|
154
|
+
prevFrame() {
|
|
155
|
+
const clip = this.$display;
|
|
156
|
+
goto(clip, clip.currentFrame - 1, false);
|
|
157
|
+
}
|
|
158
|
+
gotoAndPlay(frame, scene = null) {
|
|
159
|
+
const clip = this.$display;
|
|
160
|
+
goto(clip, frameOf(clip, frame, scene), true);
|
|
161
|
+
}
|
|
162
|
+
gotoAndStop(frame, scene = null) {
|
|
163
|
+
const clip = this.$display;
|
|
164
|
+
goto(clip, frameOf(clip, frame, scene), false);
|
|
165
|
+
}
|
|
166
|
+
get enabled() {
|
|
167
|
+
return this.$enabled ?? true;
|
|
168
|
+
}
|
|
169
|
+
set enabled(v) {
|
|
170
|
+
this.$enabled = !!v;
|
|
171
|
+
}
|
|
172
|
+
get trackAsMenu() {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
set trackAsMenu(_v) {
|
|
176
|
+
// No menus.
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
avm2.registerNativeClass(natives, "flash.display::MovieClip", MovieClipNatives);
|
|
180
|
+
class FrameLabelNatives {
|
|
181
|
+
"flash.display:FrameLabel::ctor"(name, frame) {
|
|
182
|
+
this.$name = s.rt.toString(name);
|
|
183
|
+
this.$frame = s.rt.toInt(frame);
|
|
184
|
+
}
|
|
185
|
+
get name() {
|
|
186
|
+
return this.$name;
|
|
187
|
+
}
|
|
188
|
+
get frame() {
|
|
189
|
+
return this.$frame;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
avm2.registerNativeClass(natives, "flash.display::FrameLabel", FrameLabelNatives);
|
|
193
|
+
return natives;
|
|
194
|
+
}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
// flash.display.NativeWindow: an AIR application's window, as
|
|
2
|
+
// Stage.nativeWindow gives it, over the host's AirWindow (hosts.ts). Its
|
|
3
|
+
// bounds are the window's on the screen, its frame included, as AIR's are;
|
|
4
|
+
// the stage keeps the size its scale mode gives it. A window a script opens
|
|
5
|
+
// itself is not supported. Where the host does not say: adl's values
|
|
6
|
+
// (AIR 51.3), but for the system's sizes, a browser's window having no
|
|
7
|
+
// least size of its own.
|
|
8
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
9
|
+
/** The window each player's stage is in, made as a script first asks for it. */
|
|
10
|
+
const windows = new WeakMap();
|
|
11
|
+
/** The application's window, Stage.nativeWindow's, or null where the host has none. */
|
|
12
|
+
export function nativeWindowOf(s) {
|
|
13
|
+
if (!s.application?.window) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
let window = windows.get(s);
|
|
17
|
+
if (!window) {
|
|
18
|
+
window = s.rt.construct(s.rt.classNamed("flash.display::NativeWindow"), null);
|
|
19
|
+
windows.set(s, window);
|
|
20
|
+
}
|
|
21
|
+
return window;
|
|
22
|
+
}
|
|
23
|
+
/** AIR's largest window, either way. */
|
|
24
|
+
const MAX_SIDE = 107374182;
|
|
25
|
+
export function nativeWindowNatives(s) {
|
|
26
|
+
const natives = {};
|
|
27
|
+
const prop = (o, name) => Number(s.rt.getProperty(o, avm2.qname(avm2.publicNs, name)));
|
|
28
|
+
const point = (x, y) => s.rt.construct(s.rt.classNamed("flash.geom::Point"), x, y);
|
|
29
|
+
let closed = false;
|
|
30
|
+
let alwaysInFront = false;
|
|
31
|
+
let minSize = null;
|
|
32
|
+
let maxSize = null;
|
|
33
|
+
/** The host's window behind `o`, which only the application's window has. */
|
|
34
|
+
const hostOf = (o) => {
|
|
35
|
+
const window = s.application?.window;
|
|
36
|
+
if (!window || o !== windows.get(s)) {
|
|
37
|
+
throw s.rt.unsupported("a NativeWindow a script opens");
|
|
38
|
+
}
|
|
39
|
+
return window;
|
|
40
|
+
};
|
|
41
|
+
const bounds = (o) => hostOf(o).bounds();
|
|
42
|
+
const move = (o, change) => {
|
|
43
|
+
const window = hostOf(o);
|
|
44
|
+
window.setBounds?.({ ...window.bounds(), ...change });
|
|
45
|
+
};
|
|
46
|
+
class NativeWindowNatives {
|
|
47
|
+
static get isSupported() {
|
|
48
|
+
return s.air;
|
|
49
|
+
}
|
|
50
|
+
static get supportsMenu() {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
static get supportsNotification() {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
static get supportsTransparency() {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
static get systemMinSize() {
|
|
60
|
+
return point(1, 1);
|
|
61
|
+
}
|
|
62
|
+
static get systemMaxSize() {
|
|
63
|
+
return point(MAX_SIDE, MAX_SIDE);
|
|
64
|
+
}
|
|
65
|
+
get stage() {
|
|
66
|
+
hostOf(this);
|
|
67
|
+
return s.stage?.object ?? null;
|
|
68
|
+
}
|
|
69
|
+
get title() {
|
|
70
|
+
return hostOf(this).title();
|
|
71
|
+
}
|
|
72
|
+
set title(v) {
|
|
73
|
+
hostOf(this).setTitle?.(String(v));
|
|
74
|
+
}
|
|
75
|
+
get bounds() {
|
|
76
|
+
const b = bounds(this);
|
|
77
|
+
return s.rt.construct(s.rt.classNamed("flash.geom::Rectangle"), b.x, b.y, b.width, b.height);
|
|
78
|
+
}
|
|
79
|
+
set bounds(v) {
|
|
80
|
+
if (v === null) {
|
|
81
|
+
throw s.rt.error("TypeError", 2007, "bounds");
|
|
82
|
+
}
|
|
83
|
+
move(this, {
|
|
84
|
+
x: prop(v, "x"),
|
|
85
|
+
y: prop(v, "y"),
|
|
86
|
+
width: prop(v, "width"),
|
|
87
|
+
height: prop(v, "height"),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
get x() {
|
|
91
|
+
return bounds(this).x;
|
|
92
|
+
}
|
|
93
|
+
set x(v) {
|
|
94
|
+
move(this, { x: Number(v) });
|
|
95
|
+
}
|
|
96
|
+
get y() {
|
|
97
|
+
return bounds(this).y;
|
|
98
|
+
}
|
|
99
|
+
set y(v) {
|
|
100
|
+
move(this, { y: Number(v) });
|
|
101
|
+
}
|
|
102
|
+
get width() {
|
|
103
|
+
return bounds(this).width;
|
|
104
|
+
}
|
|
105
|
+
set width(v) {
|
|
106
|
+
move(this, { width: Number(v) });
|
|
107
|
+
}
|
|
108
|
+
get height() {
|
|
109
|
+
return bounds(this).height;
|
|
110
|
+
}
|
|
111
|
+
set height(v) {
|
|
112
|
+
move(this, { height: Number(v) });
|
|
113
|
+
}
|
|
114
|
+
get displayState() {
|
|
115
|
+
return hostOf(this).displayState();
|
|
116
|
+
}
|
|
117
|
+
minimize() {
|
|
118
|
+
hostOf(this).minimize?.();
|
|
119
|
+
}
|
|
120
|
+
maximize() {
|
|
121
|
+
hostOf(this).maximize?.();
|
|
122
|
+
}
|
|
123
|
+
restore() {
|
|
124
|
+
hostOf(this).restore?.();
|
|
125
|
+
}
|
|
126
|
+
close() {
|
|
127
|
+
const window = hostOf(this);
|
|
128
|
+
if (!closed) {
|
|
129
|
+
closed = true;
|
|
130
|
+
window.close?.();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
get closed() {
|
|
134
|
+
hostOf(this);
|
|
135
|
+
return closed;
|
|
136
|
+
}
|
|
137
|
+
get visible() {
|
|
138
|
+
return hostOf(this).visible();
|
|
139
|
+
}
|
|
140
|
+
set visible(v) {
|
|
141
|
+
hostOf(this).setVisible?.(!!v);
|
|
142
|
+
}
|
|
143
|
+
get active() {
|
|
144
|
+
return hostOf(this).active();
|
|
145
|
+
}
|
|
146
|
+
activate() {
|
|
147
|
+
hostOf(this).activate?.();
|
|
148
|
+
}
|
|
149
|
+
get systemChrome() {
|
|
150
|
+
hostOf(this);
|
|
151
|
+
return "standard";
|
|
152
|
+
}
|
|
153
|
+
get transparent() {
|
|
154
|
+
hostOf(this);
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
get type() {
|
|
158
|
+
hostOf(this);
|
|
159
|
+
return "normal";
|
|
160
|
+
}
|
|
161
|
+
get minimizable() {
|
|
162
|
+
hostOf(this);
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
get maximizable() {
|
|
166
|
+
hostOf(this);
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
get resizable() {
|
|
170
|
+
hostOf(this);
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
// Moving and resizing by the mouse are the window manager's.
|
|
174
|
+
startMove() {
|
|
175
|
+
hostOf(this);
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
startResize() {
|
|
179
|
+
hostOf(this);
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
get minSize() {
|
|
183
|
+
hostOf(this);
|
|
184
|
+
minSize ??= point(1, 1);
|
|
185
|
+
return minSize;
|
|
186
|
+
}
|
|
187
|
+
set minSize(v) {
|
|
188
|
+
hostOf(this);
|
|
189
|
+
minSize = v;
|
|
190
|
+
}
|
|
191
|
+
get maxSize() {
|
|
192
|
+
hostOf(this);
|
|
193
|
+
maxSize ??= point(MAX_SIDE, MAX_SIDE);
|
|
194
|
+
return maxSize;
|
|
195
|
+
}
|
|
196
|
+
set maxSize(v) {
|
|
197
|
+
hostOf(this);
|
|
198
|
+
maxSize = v;
|
|
199
|
+
}
|
|
200
|
+
get alwaysInFront() {
|
|
201
|
+
hostOf(this);
|
|
202
|
+
return alwaysInFront;
|
|
203
|
+
}
|
|
204
|
+
set alwaysInFront(v) {
|
|
205
|
+
hostOf(this);
|
|
206
|
+
alwaysInFront = !!v;
|
|
207
|
+
}
|
|
208
|
+
// One window: nothing to order it among.
|
|
209
|
+
orderToFront() {
|
|
210
|
+
hostOf(this);
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
orderToBack() {
|
|
214
|
+
hostOf(this);
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
orderInFrontOf(_window) {
|
|
218
|
+
hostOf(this);
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
orderInBackOf(_window) {
|
|
222
|
+
hostOf(this);
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
/** A point of the stage's on the screen: past the window's corner and its frame's border and title bar. */
|
|
226
|
+
globalToScreen(p) {
|
|
227
|
+
const window = hostOf(this);
|
|
228
|
+
const b = window.bounds();
|
|
229
|
+
const offset = window.stageOffset();
|
|
230
|
+
return point(b.x + offset.x + prop(p, "x"), b.y + offset.y + prop(p, "y"));
|
|
231
|
+
}
|
|
232
|
+
get menu() {
|
|
233
|
+
hostOf(this);
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
set menu(_v) {
|
|
237
|
+
hostOf(this);
|
|
238
|
+
}
|
|
239
|
+
notifyUser(_type) {
|
|
240
|
+
hostOf(this);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
avm2.registerNativeClass(natives, "flash.display::NativeWindow", NativeWindowNatives);
|
|
244
|
+
return natives;
|
|
245
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// flash.display.Shader: its ShaderData, which byteCode's AS3 setter makes,
|
|
2
|
+
// and the precision hint, "full" or "fast": the CPU runs every kernel in full.
|
|
3
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
4
|
+
export function shaderNatives(s) {
|
|
5
|
+
const natives = {};
|
|
6
|
+
class ShaderNatives {
|
|
7
|
+
get data() {
|
|
8
|
+
return this.$data ?? null;
|
|
9
|
+
}
|
|
10
|
+
set data(v) {
|
|
11
|
+
this.$data = v ?? null;
|
|
12
|
+
}
|
|
13
|
+
get precisionHint() {
|
|
14
|
+
return this.$precision ?? "full";
|
|
15
|
+
}
|
|
16
|
+
set precisionHint(v) {
|
|
17
|
+
const hint = v === null || v === undefined ? null : s.rt.toString(v);
|
|
18
|
+
if (hint !== "full" && hint !== "fast") {
|
|
19
|
+
throw s.rt.error("ArgumentError", 2004);
|
|
20
|
+
}
|
|
21
|
+
this.$precision = hint;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
avm2.registerNativeClass(natives, "flash.display::Shader", ShaderNatives);
|
|
25
|
+
return natives;
|
|
26
|
+
}
|