@swf2es/player-hosts 0.0.0-stage → 0.1.0
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,85 @@
|
|
|
1
|
+
// flash.display.ShaderData: a Pixel Bender kernel read from its bytecode
|
|
2
|
+
// (format's readPbj), and as dynamic properties what adl gives a script of
|
|
3
|
+
// it: the kernel's metadata of the first opcode, an int or a string, its
|
|
4
|
+
// name, a ShaderParameter for each parameter but the outputs and
|
|
5
|
+
// _OutCoord, and a ShaderInput for each input.
|
|
6
|
+
import { PBJ_STRING, PBJ_TYPES, PbjError, readPbj } from "../../../../format/index.js";
|
|
7
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
8
|
+
import { OUT_COORD, PixelBender } from "../../../bitmap/pixel-bender.js";
|
|
9
|
+
/** A kernel's program, compiled when a job first runs it. */
|
|
10
|
+
const programs = new WeakMap();
|
|
11
|
+
export function programOf(kernel) {
|
|
12
|
+
let program = programs.get(kernel);
|
|
13
|
+
if (!program) {
|
|
14
|
+
program = new PixelBender(kernel);
|
|
15
|
+
programs.set(kernel, program);
|
|
16
|
+
}
|
|
17
|
+
return program;
|
|
18
|
+
}
|
|
19
|
+
/** A metadata value as adl gives it: a string, else a new Array of its numbers. */
|
|
20
|
+
function metadataValue(s, value) {
|
|
21
|
+
return typeof value === "string" ? value : s.rt.array([...value]);
|
|
22
|
+
}
|
|
23
|
+
export function shaderDataNatives(s) {
|
|
24
|
+
const natives = {};
|
|
25
|
+
class ShaderDataNatives {
|
|
26
|
+
"flash.display:ShaderData::_setByteCode"(code) {
|
|
27
|
+
if (code === null || code === undefined) {
|
|
28
|
+
throw s.rt.error("TypeError", 2007, "byteCode");
|
|
29
|
+
}
|
|
30
|
+
// The whole ByteArray, whatever its position, which is left at its end.
|
|
31
|
+
const bytes = avm2.bytesOf(s.rt, code);
|
|
32
|
+
let kernel;
|
|
33
|
+
try {
|
|
34
|
+
kernel = readPbj(bytes.buffer.subarray(0, bytes.length));
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
if (!(e instanceof PbjError)) {
|
|
38
|
+
throw e;
|
|
39
|
+
}
|
|
40
|
+
throw e.errorID === 2030
|
|
41
|
+
? s.rt.error("flash.errors::EOFError", 2030)
|
|
42
|
+
: s.rt.error("ArgumentError", 2004);
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
bytes.position = bytes.length;
|
|
46
|
+
}
|
|
47
|
+
this.$kernel = kernel;
|
|
48
|
+
const own = this.$d;
|
|
49
|
+
for (const m of kernel.metadata) {
|
|
50
|
+
// An int of the kernel's is an int, not an Array of one.
|
|
51
|
+
own.set(m.key, typeof m.value === "string" ? m.value : m.value[0]);
|
|
52
|
+
}
|
|
53
|
+
if (kernel.name !== null) {
|
|
54
|
+
own.set("name", kernel.name);
|
|
55
|
+
}
|
|
56
|
+
let index = 0;
|
|
57
|
+
for (const p of kernel.parameters) {
|
|
58
|
+
if (p.output || p.name === OUT_COORD) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const o = s.rt.construct(s.rt.classNamed("flash.display::ShaderParameter"));
|
|
62
|
+
o.$type = PBJ_TYPES[p.type] ?? null;
|
|
63
|
+
o.$index = index++;
|
|
64
|
+
o.$value = null;
|
|
65
|
+
for (const m of p.metadata) {
|
|
66
|
+
o.$d.set(m.key, metadataValue(s, m.value));
|
|
67
|
+
if (m.key === "defaultValue") {
|
|
68
|
+
o.$value = m.type === PBJ_STRING ? null : metadataValue(s, m.value);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
o.$d.set("name", p.name);
|
|
72
|
+
own.set(p.name, o);
|
|
73
|
+
}
|
|
74
|
+
for (const input of kernel.inputs) {
|
|
75
|
+
const o = s.rt.construct(s.rt.classNamed("flash.display::ShaderInput"));
|
|
76
|
+
o.$channels = input.channels;
|
|
77
|
+
o.$index = input.index;
|
|
78
|
+
o.$d.set("name", input.name);
|
|
79
|
+
own.set(input.name, o);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
avm2.registerNativeClass(natives, "flash.display::ShaderData", ShaderDataNatives);
|
|
84
|
+
return natives;
|
|
85
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// flash.display.ShaderInput: an image a kernel samples, a BitmapData or
|
|
2
|
+
// floats in a ByteArray or a Vector.<Number>, which then need the width and
|
|
3
|
+
// height set; its channels and index are the kernel's.
|
|
4
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
5
|
+
const resolved = new WeakMap();
|
|
6
|
+
/** The classes, looked up at the first call, once playerglobal is loaded. */
|
|
7
|
+
export function shaderClasses(s) {
|
|
8
|
+
let classes = resolved.get(s);
|
|
9
|
+
if (!classes) {
|
|
10
|
+
classes = {
|
|
11
|
+
array: s.rt.classNamed("Array"),
|
|
12
|
+
bitmapData: s.rt.classNamed("flash.display::BitmapData"),
|
|
13
|
+
byteArray: s.rt.classNamed("flash.utils::ByteArray"),
|
|
14
|
+
vector: s.rt.resolve(s.rt.vector("Number")),
|
|
15
|
+
shaderParameter: s.rt.classNamed("flash.display::ShaderParameter"),
|
|
16
|
+
shaderInput: s.rt.classNamed("flash.display::ShaderInput"),
|
|
17
|
+
shaderEvent: s.rt.classNamed("flash.events::ShaderEvent"),
|
|
18
|
+
};
|
|
19
|
+
resolved.set(s, classes);
|
|
20
|
+
}
|
|
21
|
+
return classes;
|
|
22
|
+
}
|
|
23
|
+
/** Whether `v` is what a ShaderInput takes, and a ShaderJob writes: a BitmapData, a ByteArray or a Vector.<Number>. */
|
|
24
|
+
export function isShaderImage(s, v) {
|
|
25
|
+
const c = shaderClasses(s);
|
|
26
|
+
return (s.rt.isInstance(v, c.bitmapData) ||
|
|
27
|
+
s.rt.isInstance(v, c.byteArray) ||
|
|
28
|
+
s.rt.isInstance(v, c.vector));
|
|
29
|
+
}
|
|
30
|
+
export function shaderInputNatives(s) {
|
|
31
|
+
const natives = {};
|
|
32
|
+
class ShaderInputNatives {
|
|
33
|
+
get input() {
|
|
34
|
+
return this.$input ?? null;
|
|
35
|
+
}
|
|
36
|
+
// null too is refused, as adl refuses it.
|
|
37
|
+
set input(v) {
|
|
38
|
+
if (!isShaderImage(s, v)) {
|
|
39
|
+
throw s.rt.error("ArgumentError", 2004);
|
|
40
|
+
}
|
|
41
|
+
this.$input = v;
|
|
42
|
+
}
|
|
43
|
+
get width() {
|
|
44
|
+
return this.$width ?? 0;
|
|
45
|
+
}
|
|
46
|
+
set width(v) {
|
|
47
|
+
this.$width = s.rt.toInt(v);
|
|
48
|
+
}
|
|
49
|
+
get height() {
|
|
50
|
+
return this.$height ?? 0;
|
|
51
|
+
}
|
|
52
|
+
set height(v) {
|
|
53
|
+
this.$height = s.rt.toInt(v);
|
|
54
|
+
}
|
|
55
|
+
get channels() {
|
|
56
|
+
return this.$channels ?? 0;
|
|
57
|
+
}
|
|
58
|
+
get index() {
|
|
59
|
+
return this.$index ?? 0;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
avm2.registerNativeClass(natives, "flash.display::ShaderInput", ShaderInputNatives);
|
|
63
|
+
return natives;
|
|
64
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// flash.display.ShaderJob: a kernel run over a BitmapData, a ByteArray or
|
|
2
|
+
// a Vector.<Number> (bitmap/pixel-bender.ts), as adl runs one. A job runs
|
|
3
|
+
// once; start() checks everything and runs the kernel then, its
|
|
4
|
+
// parameters and inputs read as they stand, and an asynchronous job's
|
|
5
|
+
// result reaches the target, with ShaderEvent.COMPLETE, after the frame's
|
|
6
|
+
// EXIT_FRAME (Scripting.afterExitFrame).
|
|
7
|
+
// adl runs those jobs on a thread of its own and drops some, one started
|
|
8
|
+
// while another runs among them; here each job completes.
|
|
9
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
10
|
+
import { outputPixel } from "../../../bitmap/pixel-bender.js";
|
|
11
|
+
import { dispatchEvent } from "../../../scripting/events.js";
|
|
12
|
+
import { programOf } from "./ShaderData.js";
|
|
13
|
+
import { isShaderImage, shaderClasses } from "./ShaderInput.js";
|
|
14
|
+
import { inputImage, kernelValues } from "./shaders.js";
|
|
15
|
+
const IDLE = 0;
|
|
16
|
+
const RUNNING = 1;
|
|
17
|
+
const DONE = 2;
|
|
18
|
+
export function shaderJobNatives(s) {
|
|
19
|
+
const natives = {};
|
|
20
|
+
const classes = () => shaderClasses(s);
|
|
21
|
+
const isBitmapData = (v) => s.rt.isInstance(v, classes().bitmapData);
|
|
22
|
+
const isVector = (v) => s.rt.isInstance(v, classes().vector);
|
|
23
|
+
const refuse = (id, ...args) => {
|
|
24
|
+
throw s.rt.error("ArgumentError", id, ...args);
|
|
25
|
+
};
|
|
26
|
+
/** Write the output, `channels` floats a pixel, to the target. */
|
|
27
|
+
const deliver = (target, out, channels) => {
|
|
28
|
+
if (isBitmapData(target)) {
|
|
29
|
+
const store = target.$store;
|
|
30
|
+
if (store.disposed) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
// Premultiplied as they come, each colour at most its alpha; three channels are opaque.
|
|
34
|
+
const pixels = new Uint32Array(store.width * store.height);
|
|
35
|
+
for (let i = 0, at = 0; i < pixels.length; i++, at += channels) {
|
|
36
|
+
pixels[i] = outputPixel(out, at, channels, store.transparent);
|
|
37
|
+
}
|
|
38
|
+
store.pixels = pixels;
|
|
39
|
+
store.changed();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (isVector(target)) {
|
|
43
|
+
// A Vector made fixed since start, at another length: adl crashes; refused here.
|
|
44
|
+
if (target.$fixed && target.$a.length !== out.length) {
|
|
45
|
+
throw s.rt.error("RangeError", 1126);
|
|
46
|
+
}
|
|
47
|
+
target.$a = Array.from(out);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const bytes = avm2.bytesOf(s.rt, target);
|
|
51
|
+
const data = new Uint8Array(out.length * 4);
|
|
52
|
+
const view = new DataView(data.buffer);
|
|
53
|
+
for (let i = 0; i < out.length; i++) {
|
|
54
|
+
view.setFloat32(i * 4, out[i], bytes.littleEndian);
|
|
55
|
+
}
|
|
56
|
+
bytes.setLength(0);
|
|
57
|
+
bytes.position = 0;
|
|
58
|
+
bytes.write(data);
|
|
59
|
+
};
|
|
60
|
+
class ShaderJobNatives {
|
|
61
|
+
get shader() {
|
|
62
|
+
return this.$jobShader ?? null;
|
|
63
|
+
}
|
|
64
|
+
set shader(v) {
|
|
65
|
+
this.$jobShader = v ?? null;
|
|
66
|
+
}
|
|
67
|
+
get target() {
|
|
68
|
+
return this.$jobTarget ?? null;
|
|
69
|
+
}
|
|
70
|
+
set target(v) {
|
|
71
|
+
this.$jobTarget = v ?? null;
|
|
72
|
+
}
|
|
73
|
+
get width() {
|
|
74
|
+
return this.$jobWidth ?? 0;
|
|
75
|
+
}
|
|
76
|
+
set width(v) {
|
|
77
|
+
this.$jobWidth = s.rt.toInt(v);
|
|
78
|
+
}
|
|
79
|
+
get height() {
|
|
80
|
+
return this.$jobHeight ?? 0;
|
|
81
|
+
}
|
|
82
|
+
set height(v) {
|
|
83
|
+
this.$jobHeight = s.rt.toInt(v);
|
|
84
|
+
}
|
|
85
|
+
get progress() {
|
|
86
|
+
return this.$jobProgress ?? Number.NaN;
|
|
87
|
+
}
|
|
88
|
+
start(waitForCompletion) {
|
|
89
|
+
if ((this.$jobState ?? IDLE) !== IDLE) {
|
|
90
|
+
refuse(2172);
|
|
91
|
+
}
|
|
92
|
+
const shader = this.$jobShader ?? null;
|
|
93
|
+
if (shader === null) {
|
|
94
|
+
throw s.rt.error("TypeError", 2007, "shader");
|
|
95
|
+
}
|
|
96
|
+
const data = shader.$data ?? null;
|
|
97
|
+
if (data === null || !data.$kernel) {
|
|
98
|
+
refuse(2171);
|
|
99
|
+
}
|
|
100
|
+
const program = programOf(data.$kernel);
|
|
101
|
+
const target = this.$jobTarget ?? null;
|
|
102
|
+
let width = this.$jobWidth ?? 0;
|
|
103
|
+
let height = this.$jobHeight ?? 0;
|
|
104
|
+
if (isBitmapData(target)) {
|
|
105
|
+
// A BitmapData is written whole, whatever the job's size; a disposed one is
|
|
106
|
+
// an output adl cannot write.
|
|
107
|
+
const store = target.$store;
|
|
108
|
+
const type = program.output.type;
|
|
109
|
+
if (!store || store.disposed || (type !== 0x3 && type !== 0x4)) {
|
|
110
|
+
refuse(2162);
|
|
111
|
+
}
|
|
112
|
+
width = store.width;
|
|
113
|
+
height = store.height;
|
|
114
|
+
}
|
|
115
|
+
else if (!isShaderImage(s, target) || width <= 0 || height <= 0) {
|
|
116
|
+
refuse(2004);
|
|
117
|
+
}
|
|
118
|
+
const kernel = program.kernel;
|
|
119
|
+
const images = new Map();
|
|
120
|
+
const read = [];
|
|
121
|
+
for (const input of kernel.inputs) {
|
|
122
|
+
const image = inputImage(s, data, input.name, input.channels, read);
|
|
123
|
+
images.set(input.index, image);
|
|
124
|
+
}
|
|
125
|
+
for (const texture of program.sampled) {
|
|
126
|
+
if (!images.has(texture)) {
|
|
127
|
+
refuse(2167);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const values = kernelValues(s, data, kernel);
|
|
131
|
+
// Read: adl moves the positions before it refuses a fixed Vector (1126).
|
|
132
|
+
for (const move of read) {
|
|
133
|
+
move();
|
|
134
|
+
}
|
|
135
|
+
// A ByteArray or a Vector the browser cannot allocate is refused, not the player ended.
|
|
136
|
+
let out;
|
|
137
|
+
try {
|
|
138
|
+
out = new Float32Array(width * height * program.channels);
|
|
139
|
+
}
|
|
140
|
+
catch (e) {
|
|
141
|
+
if (e instanceof RangeError) {
|
|
142
|
+
refuse(2004);
|
|
143
|
+
}
|
|
144
|
+
throw e;
|
|
145
|
+
}
|
|
146
|
+
const vector = isVector(target) ? target : null;
|
|
147
|
+
if (vector?.$fixed && vector.$a.length !== out.length) {
|
|
148
|
+
throw s.rt.error("RangeError", 1126);
|
|
149
|
+
}
|
|
150
|
+
program.run(values, images, width, height, out);
|
|
151
|
+
if (waitForCompletion) {
|
|
152
|
+
deliver(target, out, program.channels);
|
|
153
|
+
this.$jobState = DONE;
|
|
154
|
+
this.$jobProgress = 1;
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
// Done already, as adl's thread nearly is by the time start returns; the target waits.
|
|
158
|
+
this.$jobState = RUNNING;
|
|
159
|
+
this.$jobProgress = 1;
|
|
160
|
+
s.afterExitFrame.push(() => {
|
|
161
|
+
if (this.$jobState !== RUNNING) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
this.$jobState = DONE;
|
|
165
|
+
deliver(target, out, program.channels);
|
|
166
|
+
const o = target;
|
|
167
|
+
const event = s.rt.construct(classes().shaderEvent, "complete", false, false, isBitmapData(o) ? o : null, s.rt.isInstance(o, classes().byteArray) ? o : null, vector);
|
|
168
|
+
dispatchEvent(s, this, event);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/** A running job's result is dropped, its progress 0 again; before start, or after, nothing happens. */
|
|
172
|
+
cancel() {
|
|
173
|
+
if (this.$jobState === RUNNING) {
|
|
174
|
+
this.$jobState = DONE;
|
|
175
|
+
this.$jobProgress = 0;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
avm2.registerNativeClass(natives, "flash.display::ShaderJob", ShaderJobNatives);
|
|
180
|
+
return natives;
|
|
181
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// flash.display.ShaderParameter: a kernel parameter's value, its type's
|
|
2
|
+
// name and its index among the kernel's parameters, set by ShaderData; its
|
|
3
|
+
// metadata are dynamic properties.
|
|
4
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
5
|
+
export function shaderParameterNatives(_s) {
|
|
6
|
+
const natives = {};
|
|
7
|
+
class ShaderParameterNatives {
|
|
8
|
+
get value() {
|
|
9
|
+
return this.$value ?? null;
|
|
10
|
+
}
|
|
11
|
+
set value(v) {
|
|
12
|
+
this.$value = v ?? null;
|
|
13
|
+
}
|
|
14
|
+
get type() {
|
|
15
|
+
return this.$type ?? null;
|
|
16
|
+
}
|
|
17
|
+
get index() {
|
|
18
|
+
return this.$index ?? 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
avm2.registerNativeClass(natives, "flash.display::ShaderParameter", ShaderParameterNatives);
|
|
22
|
+
return natives;
|
|
23
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// flash.display.Shape: a display object with a Graphics and nothing else.
|
|
2
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
3
|
+
import { graphicsOf } from "./Graphics.js";
|
|
4
|
+
export function shapeNatives(s) {
|
|
5
|
+
const natives = {};
|
|
6
|
+
class ShapeNatives {
|
|
7
|
+
get graphics() {
|
|
8
|
+
return graphicsOf(s, this);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
avm2.registerNativeClass(natives, "flash.display::Shape", ShapeNatives);
|
|
12
|
+
return natives;
|
|
13
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// flash.display.SimpleButton: a button's four states and its flags, on the
|
|
2
|
+
// player's ButtonObject. The state it shows is the up one until the pointer
|
|
3
|
+
// moves it (input/pointer.ts); a state set while shown takes its place at once.
|
|
4
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
5
|
+
import { pickWork } from "../../../display/display.js";
|
|
6
|
+
import { mixerTransform, setMixerTransform } from "../media/Sound.js";
|
|
7
|
+
import { displayOf } from "./DisplayObject.js";
|
|
8
|
+
/** The ButtonObject a SimpleButton is the face of. */
|
|
9
|
+
function buttonOf(o) {
|
|
10
|
+
return displayOf(o);
|
|
11
|
+
}
|
|
12
|
+
export function simpleButtonNatives(s) {
|
|
13
|
+
const natives = {};
|
|
14
|
+
const get = (o, state) => {
|
|
15
|
+
const b = buttonOf(o);
|
|
16
|
+
const d = state === "hitTest" ? b.hitTestState : b.stateObject(state);
|
|
17
|
+
return d?.object ?? null;
|
|
18
|
+
};
|
|
19
|
+
const set = (o, state, v) => {
|
|
20
|
+
const b = buttonOf(o);
|
|
21
|
+
const d = v === null || v === undefined ? null : displayOf(v);
|
|
22
|
+
// A state is the button's own: out of the container it was in. One that holds the button
|
|
23
|
+
// stays where it is: it cannot be the button's child (show).
|
|
24
|
+
if (d?.parent && d.parent !== b && !d.encloses(b)) {
|
|
25
|
+
d.parent.removeChild(d);
|
|
26
|
+
}
|
|
27
|
+
if (state === "up") {
|
|
28
|
+
b.upState = d;
|
|
29
|
+
}
|
|
30
|
+
else if (state === "over") {
|
|
31
|
+
b.overState = d;
|
|
32
|
+
}
|
|
33
|
+
else if (state === "down") {
|
|
34
|
+
b.downState = d;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
b.hitTestState = d;
|
|
38
|
+
}
|
|
39
|
+
b.show();
|
|
40
|
+
// adl reports #2150 as an error nothing caught, from the setter of the state the button
|
|
41
|
+
// shows, and the script goes on with the state set (`button-cycle`).
|
|
42
|
+
if (d?.encloses(b) && state === b.state) {
|
|
43
|
+
s.reportUncaught(s.rt.error("ArgumentError", 2150));
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
class SimpleButtonNatives {
|
|
47
|
+
"flash.display:SimpleButton::_updateButton"() {
|
|
48
|
+
buttonOf(this).show();
|
|
49
|
+
}
|
|
50
|
+
get upState() {
|
|
51
|
+
return get(this, "up");
|
|
52
|
+
}
|
|
53
|
+
set upState(v) {
|
|
54
|
+
set(this, "up", v);
|
|
55
|
+
}
|
|
56
|
+
get overState() {
|
|
57
|
+
return get(this, "over");
|
|
58
|
+
}
|
|
59
|
+
set overState(v) {
|
|
60
|
+
set(this, "over", v);
|
|
61
|
+
}
|
|
62
|
+
get downState() {
|
|
63
|
+
return get(this, "down");
|
|
64
|
+
}
|
|
65
|
+
set downState(v) {
|
|
66
|
+
set(this, "down", v);
|
|
67
|
+
}
|
|
68
|
+
get hitTestState() {
|
|
69
|
+
return get(this, "hitTest");
|
|
70
|
+
}
|
|
71
|
+
set hitTestState(v) {
|
|
72
|
+
set(this, "hitTest", v);
|
|
73
|
+
}
|
|
74
|
+
get enabled() {
|
|
75
|
+
return buttonOf(this).enabled;
|
|
76
|
+
}
|
|
77
|
+
set enabled(v) {
|
|
78
|
+
buttonOf(this).enabled = !!v;
|
|
79
|
+
pickWork.changes++;
|
|
80
|
+
}
|
|
81
|
+
get useHandCursor() {
|
|
82
|
+
return buttonOf(this).useHandCursor;
|
|
83
|
+
}
|
|
84
|
+
set useHandCursor(v) {
|
|
85
|
+
buttonOf(this).useHandCursor = !!v;
|
|
86
|
+
}
|
|
87
|
+
get trackAsMenu() {
|
|
88
|
+
return buttonOf(this).trackAsMenu;
|
|
89
|
+
}
|
|
90
|
+
set trackAsMenu(v) {
|
|
91
|
+
buttonOf(this).trackAsMenu = !!v;
|
|
92
|
+
}
|
|
93
|
+
// SoundMixer's, as Flash has it, not the button's own (the sound-mixer case).
|
|
94
|
+
get soundTransform() {
|
|
95
|
+
return mixerTransform(s);
|
|
96
|
+
}
|
|
97
|
+
set soundTransform(v) {
|
|
98
|
+
setMixerTransform(s, v);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
avm2.registerNativeClass(natives, "flash.display::SimpleButton", SimpleButtonNatives);
|
|
102
|
+
return natives;
|
|
103
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// flash.display.Sprite: its constructor's private native constructChildren
|
|
2
|
+
// makes a symbol's first frame alive, placed before the constructor for a
|
|
3
|
+
// timeline's child and here for a script's, so that the subclass's
|
|
4
|
+
// constructor finds the children by name; a Sprite a script makes has none.
|
|
5
|
+
// Its soundTransform is kept, in whole percents as a channel's, and read
|
|
6
|
+
// back as a copy; it mixes the timeline sounds of the sprite and all in it.
|
|
7
|
+
import { avm2 } from "../../../../runtime/index.js";
|
|
8
|
+
import { MovieClip } from "../../../display/display.js";
|
|
9
|
+
import { dropTargetOf, hitAreaOf, setHitArea } from "../../../input/pointer.js";
|
|
10
|
+
import { mixOf, updateTimelineMixes } from "../../../media/sounds.js";
|
|
11
|
+
import { channelMix, transformOf } from "../media/Sound.js";
|
|
12
|
+
import { graphicsOf } from "./Graphics.js";
|
|
13
|
+
export function spriteNatives(s) {
|
|
14
|
+
const natives = {};
|
|
15
|
+
class SpriteNatives {
|
|
16
|
+
get graphics() {
|
|
17
|
+
return graphicsOf(s, this);
|
|
18
|
+
}
|
|
19
|
+
"flash.display:Sprite::constructChildren"() {
|
|
20
|
+
const d = this.$display;
|
|
21
|
+
if (d instanceof MovieClip) {
|
|
22
|
+
d.enterFirstFrame();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
get soundTransform() {
|
|
26
|
+
return transformOf(s, this.$soundMix ?? mixOf(null));
|
|
27
|
+
}
|
|
28
|
+
set soundTransform(v) {
|
|
29
|
+
// Named so in Sprite's error, where SimpleButton's and SoundMixer's say sndTransform.
|
|
30
|
+
if (v === null || v === undefined) {
|
|
31
|
+
throw s.rt.error("TypeError", 2007, "soundTransform");
|
|
32
|
+
}
|
|
33
|
+
this.$soundMix = channelMix(mixOf(v));
|
|
34
|
+
updateTimelineMixes(s);
|
|
35
|
+
}
|
|
36
|
+
/** Kept for Tab, which visits a sprite in button mode, and the pointer, which shows a hand over it. */
|
|
37
|
+
get buttonMode() {
|
|
38
|
+
return this.$buttonMode ?? false;
|
|
39
|
+
}
|
|
40
|
+
set buttonMode(v) {
|
|
41
|
+
this.$buttonMode = !!v;
|
|
42
|
+
}
|
|
43
|
+
get useHandCursor() {
|
|
44
|
+
return this.$useHandCursor ?? true;
|
|
45
|
+
}
|
|
46
|
+
set useHandCursor(v) {
|
|
47
|
+
this.$useHandCursor = !!v;
|
|
48
|
+
}
|
|
49
|
+
/** Another sprite whose drawing the pointer hits this one by (input/pointer.ts). */
|
|
50
|
+
get hitArea() {
|
|
51
|
+
return hitAreaOf(this.$display)?.object ?? null;
|
|
52
|
+
}
|
|
53
|
+
set hitArea(v) {
|
|
54
|
+
setHitArea(this.$display, v?.$display ?? null);
|
|
55
|
+
}
|
|
56
|
+
/** The object the sprite was last dragged over, kept once it is dropped. */
|
|
57
|
+
get dropTarget() {
|
|
58
|
+
return dropTargetOf(this.$display)?.object ?? null;
|
|
59
|
+
}
|
|
60
|
+
startDrag(lockCenter, bounds) {
|
|
61
|
+
let rect = null;
|
|
62
|
+
if (bounds !== null && bounds !== undefined) {
|
|
63
|
+
const o = bounds;
|
|
64
|
+
const get = (key) => s.rt.toNumber(s.rt.getProperty(o, avm2.qname(avm2.publicNs, key)));
|
|
65
|
+
const x = get("x");
|
|
66
|
+
const y = get("y");
|
|
67
|
+
const right = x + get("width");
|
|
68
|
+
const bottom = y + get("height");
|
|
69
|
+
rect = {
|
|
70
|
+
xMin: Math.min(x, right),
|
|
71
|
+
yMin: Math.min(y, bottom),
|
|
72
|
+
xMax: Math.max(x, right),
|
|
73
|
+
yMax: Math.max(y, bottom),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
s.pointer?.startDrag(this.$display, !!lockCenter, rect);
|
|
77
|
+
}
|
|
78
|
+
stopDrag() {
|
|
79
|
+
s.pointer?.stopDrag();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
avm2.registerNativeClass(natives, "flash.display::Sprite", SpriteNatives);
|
|
83
|
+
return natives;
|
|
84
|
+
}
|