├── .eslintrc.js ├── .gitattributes ├── .gitignore ├── .travis.yml ├── .vscode └── settings.json ├── README.md ├── common ├── changes │ └── @egret │ │ ├── texture-merger-core │ │ └── main_2021-02-26-07-30.json │ │ └── ts-minify-transformer │ │ └── main_2021-03-10-03-31.json ├── config │ └── rush │ │ ├── .npmrc │ │ ├── command-line.json │ │ ├── common-versions.json │ │ ├── experiments.json │ │ ├── pnpm-lock.yaml │ │ ├── pnpmfile.js │ │ ├── repo-state.json │ │ └── version-policies.json └── scripts │ ├── install-run-rush.js │ ├── install-run-rushx.js │ └── install-run.js ├── examples ├── classic-project │ ├── .gitignore │ ├── egretProperties.json │ ├── favicon.ico │ ├── index.html │ ├── resource │ │ ├── assets │ │ │ ├── Button │ │ │ │ ├── button_down.png │ │ │ │ └── button_up.png │ │ │ ├── CheckBox │ │ │ │ ├── checkbox_select_disabled.png │ │ │ │ ├── checkbox_select_down.png │ │ │ │ ├── checkbox_select_up.png │ │ │ │ └── checkbox_unselect.png │ │ │ ├── ItemRenderer │ │ │ │ └── selected.png │ │ │ ├── Panel │ │ │ │ ├── border.png │ │ │ │ └── header.png │ │ │ ├── ProgressBar │ │ │ │ ├── thumb_pb.png │ │ │ │ └── track_pb.png │ │ │ ├── RadioButton │ │ │ │ ├── radiobutton_select_disabled.png │ │ │ │ ├── radiobutton_select_down.png │ │ │ │ ├── radiobutton_select_up.png │ │ │ │ └── radiobutton_unselect.png │ │ │ ├── ScrollBar │ │ │ │ ├── roundthumb.png │ │ │ │ └── track_sb.png │ │ │ ├── Slider │ │ │ │ ├── thumb.png │ │ │ │ ├── track.png │ │ │ │ └── tracklight.png │ │ │ ├── ToggleSwitch │ │ │ │ ├── handle.png │ │ │ │ ├── off.png │ │ │ │ └── on.png │ │ │ ├── bg.jpg │ │ │ ├── egret_icon.png │ │ │ └── texture-merger.yaml │ │ ├── config │ │ │ └── description.json │ │ ├── default.res.json │ │ ├── default.thm.json │ │ └── eui_skins │ │ │ ├── ButtonSkin.exml │ │ │ ├── CheckBoxSkin.exml │ │ │ ├── HScrollBarSkin.exml │ │ │ ├── HSliderSkin.exml │ │ │ ├── ItemRendererSkin.exml │ │ │ ├── PanelSkin.exml │ │ │ ├── ProgressBarSkin.exml │ │ │ ├── RadioButtonSkin.exml │ │ │ ├── ScrollerSkin.exml │ │ │ ├── TextInputSkin.exml │ │ │ ├── ToggleSwitchSkin.exml │ │ │ ├── VScrollBarSkin.exml │ │ │ └── VSliderSkin.exml │ ├── scripts │ │ ├── api.d.ts │ │ ├── config.ts │ │ ├── config.wxgame.ts │ │ ├── myplugin.ts │ │ ├── node.d.ts │ │ ├── plugins │ │ │ ├── eui-compiler-plugin.ts │ │ │ ├── npm.ts │ │ │ ├── package.json │ │ │ ├── templates │ │ │ │ └── index.ejs │ │ │ └── webpack-plugin.ts │ │ ├── tsconfig.json │ │ └── wxgame │ │ │ └── wxgame.ts │ ├── src │ │ ├── AssetAdapter.ts │ │ ├── LoadingUI.ts │ │ ├── Main.ts │ │ ├── Platform.ts │ │ └── ThemeAdapter.ts │ ├── template │ │ └── web │ │ │ └── index.html │ ├── tsconfig.json │ └── wingProperties.json └── webpack-project │ ├── .gitignore │ ├── egretProperties.json │ ├── package.json │ ├── resource │ ├── assets │ │ └── bg.jpg │ ├── default.res.json │ ├── default.thm.json │ └── skins │ │ └── TestSkin.exml │ ├── scripts │ └── dev-config.js │ ├── src │ ├── ClassA.ts │ ├── ClassB.ts │ ├── ClasssC.ts │ ├── Main.ts │ ├── components │ │ └── MyComponent.ts │ └── i18n │ │ ├── cn │ │ └── text.ts │ │ └── en │ │ └── text.ts │ ├── templates │ └── index.ejs │ ├── tsconfig.json │ └── wingProperties.json ├── package-lock.json ├── package.json ├── packages ├── assetsmanager │ ├── package.json │ ├── src │ │ ├── egret.d.ts │ │ ├── index.ts │ │ ├── legacy.ts │ │ ├── processors.ts │ │ ├── processors │ │ │ └── audio.ts │ │ ├── store.ts │ │ └── typings.ts │ ├── test │ │ ├── egret-mock.ts │ │ ├── index.spec.ts │ │ ├── legacy.spec.ts │ │ ├── server-hit-check.ts │ │ └── static │ │ │ ├── 1.jpg │ │ │ ├── 1.json │ │ │ ├── default.res.json │ │ │ ├── num2.fnt │ │ │ ├── num2.png │ │ │ ├── spritesheet.json │ │ │ └── spritesheet.png │ ├── tsconfig.json │ └── tsconfig.release.json ├── audio │ ├── package.json │ ├── src │ │ ├── AbstractAudioInstance.ts │ │ ├── AudioFactory.ts │ │ ├── AudioManager.ts │ │ ├── HTMLAudioInstance.ts │ │ ├── SimpleHTMLAudioLoader.ts │ │ ├── WebAudioInstance.ts │ │ └── index.ts │ ├── tests │ │ └── index.spec.ts │ ├── tsconfig.json │ └── tsconfig.release.json ├── egret │ ├── package.json │ ├── src │ │ ├── 3d │ │ │ └── EgretPro.ts │ │ ├── Defines.debug.ts │ │ ├── display │ │ │ ├── Bitmap.ts │ │ │ ├── BitmapData.ts │ │ │ ├── BitmapFillMode.ts │ │ │ ├── BlendMode.ts │ │ │ ├── CapsStyle.ts │ │ │ ├── DisplayObject.ts │ │ │ ├── DisplayObjectContainer.ts │ │ │ ├── GradientType.ts │ │ │ ├── Graphics.ts │ │ │ ├── JointStyle.ts │ │ │ ├── KTXContainer.ts │ │ │ ├── Mesh.ts │ │ │ ├── OrientationMode.ts │ │ │ ├── RenderTexture.ts │ │ │ ├── Shape.ts │ │ │ ├── Sprite.ts │ │ │ ├── SpriteSheet.ts │ │ │ ├── Stage.ts │ │ │ ├── Texture.ts │ │ │ └── native │ │ │ │ └── ChildrenSortMode.ts │ │ ├── events │ │ │ ├── Event.ts │ │ │ ├── EventDispatcher.ts │ │ │ ├── EventPhase.ts │ │ │ ├── FocusEvent.ts │ │ │ ├── GeolocationEvent.ts │ │ │ ├── HTTPStatusEvent.ts │ │ │ ├── IEventDispatcher.ts │ │ │ ├── IOErrorEvent.ts │ │ │ ├── MotionEvent.ts │ │ │ ├── OrientationEvent.ts │ │ │ ├── ProgressEvent.ts │ │ │ ├── StageOrientationEvent.ts │ │ │ ├── TextEvent.ts │ │ │ ├── TimerEvent.ts │ │ │ └── TouchEvent.ts │ │ ├── external │ │ │ └── ExternalInterface.ts │ │ ├── filters │ │ │ ├── BitmapFilterQuality.ts │ │ │ ├── BlurFilter.ts │ │ │ ├── ColorMatrixFilter.ts │ │ │ ├── CustomFilter.ts │ │ │ ├── DropShadowFilter.ts │ │ │ ├── Filter.ts │ │ │ └── GlowFilter.ts │ │ ├── geom │ │ │ ├── Matrix.ts │ │ │ ├── Point.ts │ │ │ └── Rectangle.ts │ │ ├── i18n │ │ │ ├── en_US.ts │ │ │ ├── tr.ts │ │ │ └── zh_CN.ts │ │ ├── libs │ │ │ └── pro-library.d.ts │ │ ├── localStorage │ │ │ └── localStorage.ts │ │ ├── media │ │ │ ├── Sound.ts │ │ │ ├── SoundChannel.ts │ │ │ └── Video.ts │ │ ├── net │ │ │ ├── HttpMethod.ts │ │ │ ├── HttpRequest.ts │ │ │ ├── HttpResponseType.ts │ │ │ └── ImageLoader.ts │ │ ├── player │ │ │ ├── DisplayList.ts │ │ │ ├── EgretEntry.ts │ │ │ ├── FPSDisplay.ts │ │ │ ├── Player.ts │ │ │ ├── PlayerOption.ts │ │ │ ├── RenderBuffer.ts │ │ │ ├── Screen.ts │ │ │ ├── ScreenAdapter.ts │ │ │ ├── StageScaleMode.ts │ │ │ ├── SystemRenderer.ts │ │ │ ├── SystemTicker.ts │ │ │ ├── TouchHandler.ts │ │ │ ├── nodes │ │ │ │ ├── BitmapNode.ts │ │ │ │ ├── GraphicsNode.ts │ │ │ │ ├── GroupNode.ts │ │ │ │ ├── MeshNode.ts │ │ │ │ ├── NormalBitmapNode.ts │ │ │ │ ├── RenderNode.ts │ │ │ │ ├── TextFormat.ts │ │ │ │ └── TextNode.ts │ │ │ ├── paths │ │ │ │ ├── FillPath.ts │ │ │ │ ├── GradientFillPath.ts │ │ │ │ ├── Path2D.ts │ │ │ │ └── StrokePath.ts │ │ │ └── rendering │ │ │ │ └── CanvasRenderer.ts │ │ ├── sensor │ │ │ ├── DeviceOrientation.ts │ │ │ ├── Geolocation.ts │ │ │ └── Motion.ts │ │ ├── system │ │ │ ├── Capabilities.ts │ │ │ ├── Console.ts │ │ │ ├── Implementation.ts │ │ │ └── NativeContext.ts │ │ ├── text │ │ │ ├── BitmapFont.ts │ │ │ ├── BitmapText.ts │ │ │ ├── Font.ts │ │ │ ├── HorizontalAlign.ts │ │ │ ├── HtmlTextParser.ts │ │ │ ├── ITextElement.ts │ │ │ ├── InputController.ts │ │ │ ├── StageText.ts │ │ │ ├── TextField.ts │ │ │ ├── TextFieldInputType.ts │ │ │ ├── TextFieldType.ts │ │ │ ├── TextFieldUtils.ts │ │ │ ├── TextMeasurer.ts │ │ │ └── VerticalAlign.ts │ │ ├── utils │ │ │ ├── Base64Util.ts │ │ │ ├── ByteArray.ts │ │ │ ├── DataStructure.ts │ │ │ ├── HashObject.ts │ │ │ ├── Logger.ts │ │ │ ├── NumberUtils.ts │ │ │ ├── Timer.ts │ │ │ ├── XML.ts │ │ │ ├── callLater.ts │ │ │ ├── extends.ts │ │ │ ├── getDefinitionByName.ts │ │ │ ├── getOption.ts │ │ │ ├── getQualifiedClassName.ts │ │ │ ├── getQualifiedSuperclassName.ts │ │ │ ├── getTimer.ts │ │ │ ├── hasDefinition.ts │ │ │ ├── is.ts │ │ │ ├── registerClass.ts │ │ │ ├── startTick.ts │ │ │ ├── stopTick.ts │ │ │ └── toColorString.ts │ │ └── web │ │ │ └── rendering │ │ │ └── webgl │ │ │ └── WebGLUtils.ts │ ├── test │ │ ├── Factory.ts │ │ ├── index.spec.ts │ │ └── index2.spec.ts │ └── tsconfig.json ├── eui │ ├── egret.d.ts │ ├── package.json │ ├── src │ │ ├── binding │ │ │ ├── Binding.ts │ │ │ └── Watcher.ts │ │ ├── collections │ │ │ ├── ArrayCollection.ts │ │ │ └── ICollection.ts │ │ ├── components │ │ │ ├── BitmapLabel.ts │ │ │ ├── Button.ts │ │ │ ├── CheckBox.ts │ │ │ ├── Component.ts │ │ │ ├── DataGroup.ts │ │ │ ├── EditableText.ts │ │ │ ├── Group.ts │ │ │ ├── HScrollBar.ts │ │ │ ├── HSlider.ts │ │ │ ├── Image.ts │ │ │ ├── ItemRenderer.ts │ │ │ ├── Label.ts │ │ │ ├── List.ts │ │ │ ├── Panel.ts │ │ │ ├── ProgressBar.ts │ │ │ ├── RadioButton.ts │ │ │ ├── RadioButtonGroup.ts │ │ │ ├── Rect.ts │ │ │ ├── Scroller.ts │ │ │ ├── Skin.ts │ │ │ ├── TabBar.ts │ │ │ ├── TextInput.ts │ │ │ ├── ToggleButton.ts │ │ │ ├── ToggleSwitch.ts │ │ │ ├── UILayer.ts │ │ │ ├── VScrollBar.ts │ │ │ ├── VSlider.ts │ │ │ ├── ViewStack.ts │ │ │ └── supportClasses │ │ │ │ ├── Animation.ts │ │ │ │ ├── ListBase.ts │ │ │ │ ├── Range.ts │ │ │ │ ├── ScrollBarBase.ts │ │ │ │ ├── SliderBase.ts │ │ │ │ └── TouchScroll.ts │ │ ├── core │ │ │ ├── Context.ts │ │ │ ├── Direction.ts │ │ │ ├── EXML.ts │ │ │ ├── IDisplayText.ts │ │ │ ├── IItemRenderer.ts │ │ │ ├── IViewport.ts │ │ │ ├── ScrollPolicy.ts │ │ │ ├── UIComponent.ts │ │ │ └── Validator.ts │ │ ├── events │ │ │ ├── CollectionEvent.ts │ │ │ ├── CollectionEventKind.ts │ │ │ ├── ItemTapEvent.ts │ │ │ ├── PropertyEvent.ts │ │ │ ├── ScrollerThrowEvent.ts │ │ │ └── UIEvent.ts │ │ ├── i18n │ │ │ └── zh_CN.ts │ │ ├── index.ts │ │ ├── layouts │ │ │ ├── BasicLayout.ts │ │ │ ├── ColumnAlign.ts │ │ │ ├── HorizontalLayout.ts │ │ │ ├── JustifyAlign.ts │ │ │ ├── RowAlign.ts │ │ │ ├── TileLayout.ts │ │ │ ├── TileOrientation.ts │ │ │ ├── VerticalLayout.ts │ │ │ └── supportClasses │ │ │ │ ├── LayoutBase.ts │ │ │ │ └── LinearLayoutBase.ts │ │ ├── states │ │ │ ├── AddItems.ts │ │ │ ├── IOverride.ts │ │ │ ├── SetProperty.ts │ │ │ ├── SetStateProperty.ts │ │ │ └── State.ts │ │ └── utils │ │ │ ├── MatrixUtil.ts │ │ │ ├── registerBindable.ts │ │ │ └── registerProperty.ts │ ├── tsconfig.json │ └── tsconfig.release.json └── tween │ ├── package.json │ ├── src │ ├── Ease.ts │ ├── Tween.ts │ ├── TweenWrapper.ts │ ├── WorldClock.ts │ ├── egret.d.ts │ └── index.ts │ ├── tsconfig.json │ └── tsconfig.release.json ├── rush.json ├── scripts ├── index.js ├── package-lock.json └── package.json └── toolchains ├── egret-webpack-bundler ├── .gitignore ├── .npmignore ├── CHANGELOG.json ├── CHANGELOG.md ├── bin │ └── cli.js ├── package.json ├── src │ ├── assets │ │ ├── AssetsFileSystem.ts │ │ ├── ResourceConfigFactory.ts │ │ ├── Transaction.ts │ │ ├── TransactionManager.ts │ │ ├── transactions │ │ │ ├── CopyFileTransaction.ts │ │ │ ├── EgretPropertyTransaction.ts │ │ │ ├── ResourceConfigTransaction.ts │ │ │ └── TextureMergerTransaction.ts │ │ └── utils.ts │ ├── egretproject │ │ ├── EgretProject.ts │ │ ├── api │ │ │ ├── index.ts │ │ │ ├── installer-proxy.ts │ │ │ └── launcher-proxy.ts │ │ ├── egret-properties-schema.json │ │ └── typings.ts │ ├── generateConfig.ts │ ├── helper.ts │ ├── index.ts │ ├── loaders │ │ ├── exml.ts │ │ ├── inline-loader │ │ │ ├── AbstractInlinePlugin.ts │ │ │ └── index.ts │ │ ├── src-loader │ │ │ ├── Factory.ts │ │ │ ├── TypeScriptLegacyPlugin.ts │ │ │ └── parse.ts │ │ ├── theme.ts │ │ ├── typings.ts │ │ └── utils.ts │ ├── open.ts │ ├── options │ │ ├── schema.json │ │ └── typings.ts │ ├── plugins │ │ └── ResourceTransactionPlugin.ts │ ├── scripts-pipeline-polyfill.ts │ └── utils.ts ├── test │ ├── assets.spec.ts │ ├── index.spec.ts │ ├── options.spec.ts │ ├── simple-project │ │ ├── egretProperties.json │ │ ├── resource │ │ │ ├── default.res.json │ │ │ ├── error-url.res.json │ │ │ ├── error.res.json │ │ │ ├── invalid.res.json │ │ │ └── spritesheet │ │ │ │ ├── 1.json │ │ │ │ ├── 1.png │ │ │ │ ├── rank_no1.png │ │ │ │ ├── rank_no2.png │ │ │ │ ├── rank_no3.png │ │ │ │ ├── texture-merger.yaml │ │ │ │ └── x.png │ │ ├── src │ │ │ ├── Main.ts │ │ │ └── testcore │ │ │ │ ├── CheckNode.ts │ │ │ │ └── Node.ts │ │ ├── template │ │ │ └── web │ │ │ │ └── index.html │ │ └── tsconfig.json │ ├── test-bundler.ts │ ├── transaction.spec.ts │ └── tsconfig.json └── tsconfig.json ├── eui-compiler ├── .gitignore ├── .npmignore ├── CHANGELOG.json ├── CHANGELOG.md ├── README.md ├── bin │ └── cli.js ├── esprima-test │ ├── ast.json │ ├── code.js │ └── index.js ├── examples │ └── tests-helloworld │ │ ├── egretProperties.json │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── manifest.json │ │ ├── resource │ │ ├── assets │ │ │ ├── Button │ │ │ │ ├── button_down.png │ │ │ │ └── button_up.png │ │ │ ├── CheckBox │ │ │ │ ├── checkbox_select_disabled.png │ │ │ │ ├── checkbox_select_down.png │ │ │ │ ├── checkbox_select_up.png │ │ │ │ └── checkbox_unselect.png │ │ │ ├── ItemRenderer │ │ │ │ └── selected.png │ │ │ ├── Panel │ │ │ │ ├── border.png │ │ │ │ └── header.png │ │ │ ├── ProgressBar │ │ │ │ ├── thumb_pb.png │ │ │ │ └── track_pb.png │ │ │ ├── RadioButton │ │ │ │ ├── radiobutton_select_disabled.png │ │ │ │ ├── radiobutton_select_down.png │ │ │ │ ├── radiobutton_select_up.png │ │ │ │ └── radiobutton_unselect.png │ │ │ ├── ScrollBar │ │ │ │ ├── roundthumb.png │ │ │ │ └── track_sb.png │ │ │ ├── Slider │ │ │ │ ├── thumb.png │ │ │ │ ├── track.png │ │ │ │ └── tracklight.png │ │ │ ├── ToggleSwitch │ │ │ │ ├── handle.png │ │ │ │ ├── off.png │ │ │ │ └── on.png │ │ │ ├── bg.jpg │ │ │ └── egret_icon.png │ │ ├── config │ │ │ └── description.json │ │ ├── default.res.json │ │ ├── default.thm.json │ │ └── eui_skins │ │ │ ├── ButtonSkin.exml │ │ │ ├── CheckBoxSkin.exml │ │ │ ├── HScrollBarSkin.exml │ │ │ ├── HSliderSkin.exml │ │ │ ├── ItemRendererSkin.exml │ │ │ ├── PanelSkin.exml │ │ │ ├── ProgressBarSkin.exml │ │ │ ├── RadioButtonSkin.exml │ │ │ ├── ScrollerSkin.exml │ │ │ ├── TextInputSkin.exml │ │ │ ├── ToggleSwitchSkin.exml │ │ │ ├── VScrollBarSkin.exml │ │ │ ├── VSliderSkin.exml │ │ │ ├── test.exml │ │ │ └── test2.exml │ │ ├── scripts │ │ ├── api.d.ts │ │ ├── config.ts │ │ ├── config.wxgame.ts │ │ ├── node.d.ts │ │ ├── tsconfig.json │ │ └── wxgame │ │ │ └── wxgame.ts │ │ ├── src │ │ ├── AssetAdapter.ts │ │ ├── LoadingUI.ts │ │ ├── Main.ts │ │ ├── Platform.ts │ │ └── ThemeAdapter.ts │ │ ├── template │ │ └── web │ │ │ └── index.html │ │ └── tsconfig.json ├── package.json ├── property.json ├── src │ ├── emitter │ │ ├── declaration-emitter.ts │ │ ├── host.ts │ │ ├── index.ts │ │ ├── javascript-emitter.ts │ │ └── json-emitter.ts │ ├── eui-config.ts │ ├── exml-ast.ts │ ├── index.ts │ ├── parser │ │ ├── ast-type.ts │ │ ├── generator.ts │ │ ├── index.ts │ │ ├── lexer.ts │ │ ├── printError.ts │ │ └── type.ts │ ├── theme │ │ └── index.ts │ └── util │ │ ├── parser.ts │ │ └── typings.ts ├── tests │ ├── benchmark.js │ ├── emitter │ │ ├── baselines │ │ │ ├── MyComponent1$Skin │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── expected-output-js.txt │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── input.exml │ │ │ ├── animation │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── expected-output-js.txt │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── input.exml │ │ │ ├── button │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── expected-output-js.txt │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── input.exml │ │ │ ├── data-binding-and-nested-skin │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── expected-output-js.txt │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── input.exml │ │ │ ├── data-binding │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── expected-output-js.txt │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── input.exml │ │ │ ├── ignore │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── expected-output-js.txt │ │ │ │ └── input.exml │ │ │ ├── layout │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── expected-output-js.txt │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── input.exml │ │ │ ├── negative-number │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── expected-output-js.txt │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── input.exml │ │ │ ├── nested-skin │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── expected-output-js.txt │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── input.exml │ │ │ ├── scroller │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── expected-output-js.txt │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── input.exml │ │ │ ├── simple │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── expected-output-js.txt │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── input.exml │ │ │ ├── skinParts │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── expected-output-js.txt │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── input.exml │ │ │ ├── states │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── expected-output-js.txt │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── input.exml │ │ │ ├── top-bottom-left-right │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── expected-output-js.txt │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── input.exml │ │ │ ├── xmlns-1 │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── expected-output-js.txt │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── input.exml │ │ │ └── xmlns-2 │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── expected-output-js.txt │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── input.exml │ │ └── index.js │ ├── error │ │ ├── baselines │ │ │ ├── Invalid-character-in-tag-name │ │ │ │ ├── expect.txt │ │ │ │ └── input.exml │ │ │ ├── Invalid-characters-in-closing-tag │ │ │ │ ├── expect.txt │ │ │ │ └── input.exml │ │ │ ├── classname-lack │ │ │ │ ├── expect.txt │ │ │ │ └── input.exml │ │ │ ├── duplicated-attribute │ │ │ │ ├── expect.txt │ │ │ │ └── input.exml │ │ │ ├── malformed-comment │ │ │ │ ├── expect.txt │ │ │ │ └── input.exml │ │ │ ├── scroller-childrens │ │ │ │ ├── expect.txt │ │ │ │ └── input.exml │ │ │ ├── scroller-notGroup │ │ │ │ ├── expect.txt │ │ │ │ └── input.exml │ │ │ ├── tag-not-closed │ │ │ │ ├── expect.txt │ │ │ │ └── input.exml │ │ │ ├── text-outside-of-rootnode │ │ │ │ ├── expect.txt │ │ │ │ └── input.exml │ │ │ └── unquoted-attribute-value │ │ │ │ ├── expect.txt │ │ │ │ └── input.exml │ │ └── index.js │ ├── errors │ │ ├── baselines │ │ │ ├── 1 │ │ │ │ ├── errors.json │ │ │ │ └── input.exml │ │ │ ├── 2 │ │ │ │ ├── errors.json │ │ │ │ └── input.exml │ │ │ ├── 3 │ │ │ │ ├── errors.json │ │ │ │ └── input.exml │ │ │ ├── 4 │ │ │ │ ├── errors.json │ │ │ │ └── input.exml │ │ │ ├── 5 │ │ │ │ ├── errors.json │ │ │ │ └── input.exml │ │ │ └── 6 │ │ │ │ ├── errors.json │ │ │ │ └── input.exml │ │ └── index.js │ ├── index.js │ ├── json-validator │ │ └── index.js │ ├── parser │ │ └── lexer │ │ │ ├── baselines │ │ │ ├── layout │ │ │ │ ├── input.exml │ │ │ │ └── token.json │ │ │ └── simple │ │ │ │ ├── input.exml │ │ │ │ └── token.json │ │ │ └── index.js │ ├── project │ │ └── index.js │ └── sort-exml │ │ ├── case │ │ ├── exmls-sort.thm.json │ │ ├── exmls.thm.json │ │ └── exmls.txt │ │ └── index.js ├── tsconfig.json └── typings │ └── api.d.ts ├── link-node-modules ├── CHANGELOG.json ├── CHANGELOG.md ├── bin │ └── cli.js ├── package.json ├── src │ └── index.ts └── tsconfig.json ├── package-bundler ├── bin │ └── cli.js ├── package.json ├── src │ └── index.ts └── tsconfig.json ├── texture-merger-core ├── .gitignore ├── CHANGELOG.json ├── CHANGELOG.md ├── package.json ├── src │ └── index.ts └── tsconfig.json └── ts-minify-transformer ├── .gitignore ├── .npmignore ├── CHANGELOG.json ├── CHANGELOG.md ├── package.json ├── src ├── emitClassName.ts ├── emitDefine.ts ├── index.ts └── properties-minifier.ts ├── tests ├── emitClassName │ ├── baselines │ │ ├── namespace-complex │ │ │ ├── expect-output.js │ │ │ └── input.ts │ │ ├── namespace-nested │ │ │ ├── expect-output.js │ │ │ └── input.ts │ │ ├── namespace │ │ │ ├── expect-output.js │ │ │ └── input.ts │ │ ├── reflect │ │ │ ├── expect-output.js │ │ │ └── input.ts │ │ └── simple-class │ │ │ ├── expect-output.js │ │ │ └── input.ts │ └── index.ts └── minifier │ ├── baselines │ ├── case-1 │ │ ├── expect-output.js │ │ └── input.ts │ ├── case-2 │ │ ├── expect-output.js │ │ └── input.ts │ └── simple │ │ ├── expect-output.js │ │ └── input.ts │ └── index.ts ├── tsconfig.json └── tsconfig.release.json /.gitattributes: -------------------------------------------------------------------------------- 1 | # Don't allow people to merge changes to these generated files, because the result 2 | # may be invalid. You need to run "rush update" again. 3 | pnpm-lock.yaml merge=binary 4 | shrinkwrap.yaml merge=binary 5 | npm-shrinkwrap.json merge=binary 6 | yarn.lock merge=binary 7 | 8 | # Rush's JSON config files use JavaScript-style code comments. The rule below prevents pedantic 9 | # syntax highlighters such as GitHub's from highlighting these comments as errors. Your text editor 10 | # may also require a special configuration to allow comments in JSON. 11 | # 12 | # For more information, see this issue: https://github.com/microsoft/rushstack/issues/1088 13 | # 14 | *.json linguist-language=JSON-with-Comments 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | packages/egret/test/libs 2 | TODO 3 | dist 4 | # Logs 5 | *.log 6 | npm-debug.log* 7 | yarn-debug.log* 8 | yarn-error.log* 9 | 10 | # Runtime data 11 | *.pid 12 | *.seed 13 | *.pid.lock 14 | 15 | # Directory for instrumented libs generated by jscoverage/JSCover 16 | lib-cov 17 | 18 | # Coverage directory used by tools like istanbul 19 | coverage 20 | 21 | # nyc test coverage 22 | .nyc_output 23 | 24 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 25 | .grunt 26 | 27 | # Bower dependency directory (https://bower.io/) 28 | bower_components 29 | 30 | # node-waf configuration 31 | .lock-wscript 32 | 33 | # Compiled binary addons (https://nodejs.org/api/addons.html) 34 | build/Release 35 | 36 | # Dependency directories 37 | node_modules/ 38 | jspm_packages/ 39 | 40 | # Optional npm cache directory 41 | .npm 42 | 43 | # Optional eslint cache 44 | .eslintcache 45 | 46 | # Optional REPL history 47 | .node_repl_history 48 | 49 | # Output of 'npm pack' 50 | *.tgz 51 | 52 | # Yarn Integrity file 53 | .yarn-integrity 54 | 55 | # dotenv environment variables file 56 | .env 57 | 58 | # next.js build output 59 | .next 60 | 61 | # OS X temporary files 62 | .DS_Store 63 | 64 | # Rush temporary files 65 | common/temp/ 66 | **/.rush/temp/ 67 | 68 | # vscode 69 | .vscode 70 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '8.9.4' 4 | script: 5 | - set -e 6 | 7 | - echo 'Checking for missing change logs...' && echo -en 'travis_fold:start:change\\r' 8 | - git fetch origin master:refs/remotes/origin/master -a 9 | - node common/scripts/install-run-rush.js change -v 10 | - echo -en 'travis_fold:end:change\\r' 11 | 12 | - echo 'Installing...' && echo -en 'travis_fold:start:install\\r' 13 | - node common/scripts/install-run-rush.js install 14 | - echo -en 'travis_fold:end:install\\r' 15 | 16 | - echo 'Building...' && echo -en 'travis_fold:start:build\\r' 17 | - node common/scripts/install-run-rush.js rebuild --verbose 18 | - echo -en 'travis_fold:end:build\\r' 19 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "eslint.workingDirectories": [ 3 | { 4 | "pattern": "./packages/*/" 5 | } 6 | ], 7 | "files.eol": "\n", 8 | "editor.formatOnSave": true 9 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Egret 2 | 3 | 面向现代 JavaScript 技术的白鹭引擎v6.0 4 | 5 | # 如何构建 6 | 7 | 8 | 9 | 1. 安装 NodeJS 14.x 版本及 npm 10 | 2. 推荐使用 Visual Studio Code 作为代码编辑器 11 | 3. 执行 ```npm install @microsoft/rush -g``` 全局安装 rush 12 | 4. 执行 ```rush update``` 更新代码依赖项 13 | 5. 执行 ```rush build```构建代码 -------------------------------------------------------------------------------- /common/changes/@egret/texture-merger-core/main_2021-02-26-07-30.json: -------------------------------------------------------------------------------- 1 | { 2 | "changes": [ 3 | { 4 | "packageName": "@egret/texture-merger-core", 5 | "comment": "", 6 | "type": "none" 7 | } 8 | ], 9 | "packageName": "@egret/texture-merger-core", 10 | "email": "wangze@egret.com" 11 | } -------------------------------------------------------------------------------- /common/changes/@egret/ts-minify-transformer/main_2021-03-10-03-31.json: -------------------------------------------------------------------------------- 1 | { 2 | "changes": [ 3 | { 4 | "packageName": "@egret/ts-minify-transformer", 5 | "comment": "", 6 | "type": "none" 7 | } 8 | ], 9 | "packageName": "@egret/ts-minify-transformer", 10 | "email": "wangze@egret.com" 11 | } -------------------------------------------------------------------------------- /common/config/rush/.npmrc: -------------------------------------------------------------------------------- 1 | # Rush uses this file to configure the package registry, regardless of whether the 2 | # package manager is PNPM, NPM, or Yarn. Prior to invoking the package manager, 3 | # Rush will always copy this file to the folder where installation is performed. 4 | # When NPM is the package manager, Rush works around NPM's processing of 5 | # undefined environment variables by deleting any lines that reference undefined 6 | # environment variables. 7 | # 8 | # DO NOT SPECIFY AUTHENTICATION CREDENTIALS IN THIS FILE. It should only be used 9 | # to configure registry sources. 10 | 11 | registry=https://registry.npmjs.org/ 12 | # registry=http://localhost:4873/ 13 | always-auth=false 14 | -------------------------------------------------------------------------------- /common/config/rush/experiments.json: -------------------------------------------------------------------------------- 1 | /** 2 | * This configuration file allows repo maintainers to enable and disable experimental 3 | * Rush features. For full documentation, please see https://rushjs.io 4 | */ 5 | { 6 | "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/experiments.schema.json", 7 | 8 | /** 9 | * Rush 5.14.0 improved incremental builds to ignore spurious changes in the pnpm-lock.json file. 10 | * This optimization is enabled by default. If you encounter a problem where "rush build" is neglecting 11 | * to build some projects, please open a GitHub issue. As a workaround you can uncomment this line 12 | * to temporarily restore the old behavior where everything must be rebuilt whenever pnpm-lock.json 13 | * is modified. 14 | */ 15 | // "legacyIncrementalBuildDependencyDetection": true 16 | } 17 | -------------------------------------------------------------------------------- /common/config/rush/pnpmfile.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | /** 4 | * When using the PNPM package manager, you can use pnpmfile.js to workaround 5 | * dependencies that have mistakes in their package.json file. (This feature is 6 | * functionally similar to Yarn's "resolutions".) 7 | * 8 | * For details, see the PNPM documentation: 9 | * https://pnpm.js.org/docs/en/hooks.html 10 | * 11 | * IMPORTANT: SINCE THIS FILE CONTAINS EXECUTABLE CODE, MODIFYING IT IS LIKELY TO INVALIDATE 12 | * ANY CACHED DEPENDENCY ANALYSIS. After any modification to pnpmfile.js, it's recommended to run 13 | * "rush update --full" so that PNPM will recalculate all version selections. 14 | */ 15 | module.exports = { 16 | hooks: { 17 | readPackage 18 | } 19 | }; 20 | 21 | /** 22 | * This hook is invoked during installation before a package's dependencies 23 | * are selected. 24 | * The `packageJson` parameter is the deserialized package.json 25 | * contents for the package that is about to be installed. 26 | * The `context` parameter provides a log() function. 27 | * The return value is the updated object. 28 | */ 29 | function readPackage(packageJson, context) { 30 | 31 | // // The karma types have a missing dependency on typings from the log4js package. 32 | // if (packageJson.name === '@types/karma') { 33 | // context.log('Fixed up dependencies for @types/karma'); 34 | // packageJson.dependencies['log4js'] = '0.6.38'; 35 | // } 36 | 37 | return packageJson; 38 | } 39 | -------------------------------------------------------------------------------- /common/config/rush/repo-state.json: -------------------------------------------------------------------------------- 1 | // DO NOT MODIFY THIS FILE. It is generated and used by Rush. 2 | { 3 | "preferredVersionsHash": "bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f" 4 | } 5 | -------------------------------------------------------------------------------- /common/scripts/install-run-rushx.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. 3 | // See the @microsoft/rush package's LICENSE file for license information. 4 | Object.defineProperty(exports, "__esModule", { value: true }); 5 | // THIS FILE WAS GENERATED BY A TOOL. ANY MANUAL MODIFICATIONS WILL GET OVERWRITTEN WHENEVER RUSH IS UPGRADED. 6 | // 7 | // This script is intended for usage in an automated build environment where the Rush command may not have 8 | // been preinstalled, or may have an unpredictable version. This script will automatically install the version of Rush 9 | // specified in the rush.json configuration file (if not already installed), and then pass a command-line to the 10 | // rushx command. 11 | // 12 | // An example usage would be: 13 | // 14 | // node common/scripts/install-run-rushx.js custom-command 15 | // 16 | // For more information, see: https://rushjs.io/pages/maintainer/setup_new_repo/ 17 | require("./install-run-rush"); 18 | //# sourceMappingURL=install-run-rushx.js.map -------------------------------------------------------------------------------- /examples/classic-project/.gitignore: -------------------------------------------------------------------------------- 1 | bin-debug 2 | bin-release 3 | libs -------------------------------------------------------------------------------- /examples/classic-project/egretProperties.json: -------------------------------------------------------------------------------- 1 | { 2 | "engineVersion": "5.3.8", 3 | "compilerVersion": "5.3.8", 4 | "template": {}, 5 | "target": { 6 | "current": "web" 7 | }, 8 | "modules": [ 9 | { 10 | "name": "egret" 11 | }, 12 | { 13 | "name": "eui" 14 | }, 15 | { 16 | "name": "assetsmanager" 17 | }, 18 | { 19 | "name": "tween" 20 | }, 21 | { 22 | "name": "promise" 23 | } 24 | ], 25 | "eui": { 26 | "exmlRoot": [ 27 | "resource/eui_skins" 28 | ], 29 | "themes": [ 30 | "resource/default.thm.json" 31 | ] 32 | } 33 | } -------------------------------------------------------------------------------- /examples/classic-project/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/favicon.ico -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/Button/button_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/Button/button_down.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/Button/button_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/Button/button_up.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/CheckBox/checkbox_select_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/CheckBox/checkbox_select_disabled.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/CheckBox/checkbox_select_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/CheckBox/checkbox_select_down.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/CheckBox/checkbox_select_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/CheckBox/checkbox_select_up.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/CheckBox/checkbox_unselect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/CheckBox/checkbox_unselect.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/ItemRenderer/selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/ItemRenderer/selected.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/Panel/border.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/Panel/border.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/Panel/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/Panel/header.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/ProgressBar/thumb_pb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/ProgressBar/thumb_pb.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/ProgressBar/track_pb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/ProgressBar/track_pb.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/RadioButton/radiobutton_select_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/RadioButton/radiobutton_select_disabled.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/RadioButton/radiobutton_select_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/RadioButton/radiobutton_select_down.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/RadioButton/radiobutton_select_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/RadioButton/radiobutton_select_up.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/RadioButton/radiobutton_unselect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/RadioButton/radiobutton_unselect.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/ScrollBar/roundthumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/ScrollBar/roundthumb.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/ScrollBar/track_sb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/ScrollBar/track_sb.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/Slider/thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/Slider/thumb.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/Slider/track.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/Slider/track.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/Slider/tracklight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/Slider/tracklight.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/ToggleSwitch/handle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/ToggleSwitch/handle.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/ToggleSwitch/off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/ToggleSwitch/off.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/ToggleSwitch/on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/ToggleSwitch/on.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/bg.jpg -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/egret_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/classic-project/resource/assets/egret_icon.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/texture-merger.yaml: -------------------------------------------------------------------------------- 1 | files: 2 | - Button/button_down.png 3 | - Button/button_up.png 4 | - CheckBox/checkbox_select_disabled.png 5 | - CheckBox/checkbox_select_down.png 6 | - CheckBox/checkbox_select_up.png 7 | - CheckBox/checkbox_unselect.png 8 | - ItemRenderer/selected.png 9 | - Panel/border.png 10 | - Panel/header.png 11 | - ProgressBar/thumb_pb.png 12 | - ProgressBar/track_pb.png 13 | - RadioButton/radiobutton_select_disabled.png 14 | - RadioButton/radiobutton_select_down.png 15 | - RadioButton/radiobutton_select_up.png 16 | - RadioButton/radiobutton_unselect.png 17 | - ScrollBar/roundthumb.png 18 | - ScrollBar/track_sb.png 19 | - Slider/thumb.png 20 | - Slider/track.png 21 | - Slider/tracklight.png 22 | - ToggleSwitch/handle.png 23 | - ToggleSwitch/off.png 24 | - ToggleSwitch/on.png 25 | root: ./ 26 | outputName: spritesheet 27 | -------------------------------------------------------------------------------- /examples/classic-project/resource/config/description.json: -------------------------------------------------------------------------------- 1 | [ 2 | "Open-source,Free,Multi-platform", 3 | "Push Game Forward", 4 | "HTML5 Game Engine" 5 | ] -------------------------------------------------------------------------------- /examples/classic-project/resource/default.thm.json: -------------------------------------------------------------------------------- 1 | { 2 | "skins": { 3 | "eui.Button": "resource/eui_skins/ButtonSkin.exml", 4 | "eui.CheckBox": "resource/eui_skins/CheckBoxSkin.exml", 5 | "eui.HScrollBar": "resource/eui_skins/HScrollBarSkin.exml", 6 | "eui.HSlider": "resource/eui_skins/HSliderSkin.exml", 7 | "eui.Panel": "resource/eui_skins/PanelSkin.exml", 8 | "eui.TextInput": "resource/eui_skins/TextInputSkin.exml", 9 | "eui.ProgressBar": "resource/eui_skins/ProgressBarSkin.exml", 10 | "eui.RadioButton": "resource/eui_skins/RadioButtonSkin.exml", 11 | "eui.Scroller": "resource/eui_skins/ScrollerSkin.exml", 12 | "eui.ToggleSwitch": "resource/eui_skins/ToggleSwitchSkin.exml", 13 | "eui.VScrollBar": "resource/eui_skins/VScrollBarSkin.exml", 14 | "eui.VSlider": "resource/eui_skins/VSliderSkin.exml", 15 | "eui.ItemRenderer": "resource/eui_skins/ItemRendererSkin.exml" 16 | }, 17 | "autoGenerateExmlsList": false, 18 | "exmls": [ 19 | "resource/eui_skins/ButtonSkin.exml", 20 | "resource/eui_skins/CheckBoxSkin.exml", 21 | "resource/eui_skins/HScrollBarSkin.exml", 22 | "resource/eui_skins/HSliderSkin.exml", 23 | "resource/eui_skins/ItemRendererSkin.exml", 24 | "resource/eui_skins/PanelSkin.exml", 25 | "resource/eui_skins/ProgressBarSkin.exml", 26 | "resource/eui_skins/RadioButtonSkin.exml", 27 | "resource/eui_skins/ScrollerSkin.exml", 28 | "resource/eui_skins/TextInputSkin.exml", 29 | "resource/eui_skins/ToggleSwitchSkin.exml", 30 | "resource/eui_skins/VScrollBarSkin.exml", 31 | "resource/eui_skins/VSliderSkin.exml" 32 | ], 33 | "path": "resource/default.thm.json" 34 | } -------------------------------------------------------------------------------- /examples/classic-project/resource/eui_skins/ButtonSkin.exml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/classic-project/resource/eui_skins/CheckBoxSkin.exml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 12 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/classic-project/resource/eui_skins/HScrollBarSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /examples/classic-project/resource/eui_skins/HSliderSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/classic-project/resource/eui_skins/ItemRendererSkin.exml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /examples/classic-project/resource/eui_skins/PanelSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/classic-project/resource/eui_skins/ProgressBarSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /examples/classic-project/resource/eui_skins/RadioButtonSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/classic-project/resource/eui_skins/ScrollerSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /examples/classic-project/resource/eui_skins/TextInputSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 9 | -------------------------------------------------------------------------------- /examples/classic-project/resource/eui_skins/ToggleSwitchSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 13 | 14 | -------------------------------------------------------------------------------- /examples/classic-project/resource/eui_skins/VScrollBarSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /examples/classic-project/resource/eui_skins/VSliderSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /examples/classic-project/scripts/myplugin.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 示例自定义插件,您可以查阅 http://developer.egret.com/cn/github/egret-docs/Engine2D/projectConfig/cmdExtensionPlugin/index.html 3 | * 了解如何开发一个自定义插件 4 | */ 5 | export class CustomPlugin implements plugins.Command { 6 | 7 | constructor() { 8 | } 9 | 10 | async onFile(file: plugins.File) { 11 | return file; 12 | } 13 | 14 | async onFinish(commandContext: plugins.CommandContext) { 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /examples/classic-project/scripts/plugins/eui-compiler-plugin.ts: -------------------------------------------------------------------------------- 1 | // require('./npm').installFromLauncher(["@egret/eui-compiler"]); 2 | // require('./npm').installDependencies(["@egret/eui-compiler"]); 3 | 4 | import * as eui from '@egret/eui-compiler'; 5 | 6 | /** 7 | * EuiCompiler 插件 8 | * 该插件为 EXMLPlugin 的替代品 9 | */ 10 | export class EuiCompilerPlugin implements plugins.Command { 11 | 12 | constructor(private mode: string) { 13 | } 14 | 15 | async onFile(file: plugins.File) { 16 | if (file.extname === '.exml') { 17 | return null; 18 | } 19 | else { 20 | return file; 21 | } 22 | 23 | } 24 | 25 | async onFinish(commandContext: plugins.CommandContext) { 26 | const compiler = new eui.EuiCompiler(commandContext.projectRoot, this.mode); 27 | compiler.setCustomTransformers([ 28 | transformer 29 | ]) 30 | const emitResult = compiler.emit(); 31 | for (let emitInfo of emitResult) { 32 | commandContext.createFile(emitInfo.filename, new Buffer(emitInfo.content)) 33 | } 34 | } 35 | } 36 | 37 | 38 | const transformer: eui.EuiAstTransformer = (ast) => { 39 | return ast; 40 | } 41 | -------------------------------------------------------------------------------- /examples/classic-project/scripts/plugins/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@egret/classic-project-build-scripts", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "build": "echo helloworld" 8 | }, 9 | "devDependencies": { 10 | "@egret/eui-compiler": "workspace:*", 11 | "@egret/egret-webpack-bundler": "workspace:*" 12 | }, 13 | "author": "", 14 | "license": "ISC" 15 | } 16 | -------------------------------------------------------------------------------- /examples/classic-project/scripts/plugins/webpack-plugin.ts: -------------------------------------------------------------------------------- 1 | // require('./npm').installFromLauncher(['@egret/egret-webpack-bundler']); 2 | // require('./npm').installDependencies(["@egret/egret-webpack-bundler"]); 3 | 4 | 5 | import { EgretWebpackBundler, WebpackBundleOptions } from '@egret/egret-webpack-bundler'; 6 | 7 | /** 8 | * Webpack 插件 9 | * 允许在白鹭引擎中使用 webpack 10 | */ 11 | export class WebpackDevServerPlugin implements plugins.Command { 12 | 13 | constructor(private options: WebpackBundleOptions) { 14 | } 15 | 16 | async onFile(file: plugins.File) { 17 | return file; 18 | } 19 | 20 | onFinish(commandContext: plugins.CommandContext) { 21 | return new Promise((resolve, reject) => { 22 | const bundler = new EgretWebpackBundler(commandContext.projectRoot, commandContext.buildConfig.target); 23 | bundler.startDevServer(this.options) 24 | }) 25 | } 26 | } 27 | 28 | 29 | export class WebpackBundlePlugin implements plugins.Command { 30 | 31 | constructor(private options: WebpackBundleOptions) { 32 | } 33 | 34 | async onFile(file: plugins.File) { 35 | return file; 36 | } 37 | 38 | onFinish(commandContext: plugins.CommandContext) { 39 | 40 | const bundler = new EgretWebpackBundler(commandContext.projectRoot, commandContext.buildConfig.target); 41 | bundler.emitter = (filename, content) => { 42 | commandContext.createFile(filename, content); 43 | } 44 | return bundler.build(this.options); 45 | } 46 | } -------------------------------------------------------------------------------- /examples/classic-project/src/Platform.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 平台数据接口。 3 | * 由于每款游戏通常需要发布到多个平台上,所以提取出一个统一的接口用于开发者获取平台数据信息 4 | * 推荐开发者通过这种方式封装平台逻辑,以保证整体结构的稳定 5 | * 由于不同平台的接口形式各有不同,白鹭推荐开发者将所有接口封装为基于 Promise 的异步形式 6 | */ 7 | declare interface Platform { 8 | 9 | getUserInfo(): Promise; 10 | 11 | login(): Promise 12 | 13 | } 14 | 15 | class DebugPlatform implements Platform { 16 | async getUserInfo() { 17 | return { nickName: "username" } 18 | } 19 | async login() { 20 | 21 | } 22 | } 23 | 24 | 25 | if (!window.platform) { 26 | window.platform = new DebugPlatform(); 27 | } 28 | 29 | 30 | 31 | declare let platform: Platform; 32 | 33 | declare interface Window { 34 | 35 | platform: Platform 36 | } 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /examples/classic-project/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "outDir": "bin-debug", 5 | "experimentalDecorators": true, 6 | "lib": [ 7 | "es5", 8 | "dom", 9 | "es2015.promise" 10 | ], 11 | "types": [] 12 | }, 13 | "include": [ 14 | "src", 15 | "libs" 16 | ] 17 | } -------------------------------------------------------------------------------- /examples/classic-project/wingProperties.json: -------------------------------------------------------------------------------- 1 | { 2 | "theme": "resource/default.thm.json", 3 | "resourcePlugin": { 4 | "configs": [ 5 | { 6 | "configPath": "resource/default.res.json", 7 | "relativePath": "resource/" 8 | } 9 | ] 10 | } 11 | } -------------------------------------------------------------------------------- /examples/webpack-project/.gitignore: -------------------------------------------------------------------------------- 1 | libs -------------------------------------------------------------------------------- /examples/webpack-project/egretProperties.json: -------------------------------------------------------------------------------- 1 | { 2 | "engineVersion": "5.4.1", 3 | "compilerVersion": "5.4.1", 4 | "template": {}, 5 | "target": { 6 | "current": "web" 7 | }, 8 | "modules": [ 9 | { 10 | "name": "egret" 11 | } 12 | ], 13 | "packages": [ 14 | { 15 | "name": "assetsmanager" 16 | }, 17 | { 18 | "name": "audio" 19 | }, 20 | { 21 | "name": "tween" 22 | }, 23 | { 24 | "name": "eui" 25 | } 26 | ], 27 | "eui": { 28 | "exmlRoot": [ 29 | "resource/skins", 30 | "resource/eui_skins" 31 | ], 32 | "themes": [ 33 | "resource/default.thm.json" 34 | ] 35 | } 36 | } -------------------------------------------------------------------------------- /examples/webpack-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@egret/example-webpack-project", 3 | "version": "1.0.0", 4 | "description": "", 5 | "scripts": { 6 | "start": "egret-compiler run --config scripts/dev-config.js", 7 | "build": "egret-compiler prepare", 8 | "postinstall": "npx @egret/link-node-modules@1.0.6 ../../toolchains/egret-webpack-bundler" 9 | }, 10 | "author": "", 11 | "license": "ISC" 12 | } -------------------------------------------------------------------------------- /examples/webpack-project/resource/assets/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/examples/webpack-project/resource/assets/bg.jpg -------------------------------------------------------------------------------- /examples/webpack-project/resource/default.res.json: -------------------------------------------------------------------------------- 1 | { 2 | "groups": [ 3 | { 4 | "name": "preload", 5 | "keys": "bg_jpg" 6 | } 7 | ], 8 | "resources": [ 9 | { 10 | "url": "assets/bg.jpg", 11 | "type": "image", 12 | "name": "bg_jpg" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /examples/webpack-project/resource/default.thm.json: -------------------------------------------------------------------------------- 1 | { 2 | "skins": { 3 | "eui.Button": "resource/eui_skins/ButtonSkin.exml", 4 | "eui.CheckBox": "resource/eui_skins/CheckBoxSkin.exml", 5 | "eui.HScrollBar": "resource/eui_skins/HScrollBarSkin.exml", 6 | "eui.HSlider": "resource/eui_skins/HSliderSkin.exml", 7 | "eui.Panel": "resource/eui_skins/PanelSkin.exml", 8 | "eui.TextInput": "resource/eui_skins/TextInputSkin.exml", 9 | "eui.ProgressBar": "resource/eui_skins/ProgressBarSkin.exml", 10 | "eui.RadioButton": "resource/eui_skins/RadioButtonSkin.exml", 11 | "eui.Scroller": "resource/eui_skins/ScrollerSkin.exml", 12 | "eui.ToggleSwitch": "resource/eui_skins/ToggleSwitchSkin.exml", 13 | "eui.VScrollBar": "resource/eui_skins/VScrollBarSkin.exml", 14 | "eui.VSlider": "resource/eui_skins/VSliderSkin.exml", 15 | "eui.ItemRenderer": "resource/eui_skins/ItemRendererSkin.exml" 16 | }, 17 | "autoGenerateExmlsList": true, 18 | "exmls": [ 19 | "resource/skins/TestSkin.exml" 20 | ], 21 | "path": "resource/default.thm.json" 22 | } -------------------------------------------------------------------------------- /examples/webpack-project/resource/skins/TestSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /examples/webpack-project/scripts/dev-config.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | /** 3 | * @type import('@egret/egret-webpack-bundler').WebpackBundleOptions 4 | */ 5 | const config = { 6 | libraryType: 'debug', 7 | defines: { DEBUG: true, RELEASE: false, version: 1111 }, 8 | typescript: { mode: 'legacy' }, 9 | exml: { 10 | watch: true 11 | }, 12 | html: { 13 | templateFilePath: './templates/index.ejs' 14 | }, 15 | devServer: { 16 | open: true 17 | }, 18 | parseEgretProperty: true 19 | }; 20 | module.exports = config; -------------------------------------------------------------------------------- /examples/webpack-project/src/ClassA.ts: -------------------------------------------------------------------------------- 1 | class A { 2 | 3 | } 4 | console.log("A") -------------------------------------------------------------------------------- /examples/webpack-project/src/ClassB.ts: -------------------------------------------------------------------------------- 1 | class B { 2 | 3 | } 4 | 5 | console.log('B') -------------------------------------------------------------------------------- /examples/webpack-project/src/ClasssC.ts: -------------------------------------------------------------------------------- 1 | console.log('C') -------------------------------------------------------------------------------- /examples/webpack-project/src/components/MyComponent.ts: -------------------------------------------------------------------------------- 1 | // class MyComponent extends eui.Component { 2 | 3 | // customProperty = 1; 4 | 5 | // createChildren() { 6 | // super.createChildren(); 7 | // console.log(this.customProperty); 8 | // } 9 | // } -------------------------------------------------------------------------------- /examples/webpack-project/src/i18n/cn/text.ts: -------------------------------------------------------------------------------- 1 | namespace i18n { 2 | 3 | export const name = '白鹭引擎'; 4 | } -------------------------------------------------------------------------------- /examples/webpack-project/src/i18n/en/text.ts: -------------------------------------------------------------------------------- 1 | namespace i18n { 2 | 3 | export const name = 'egret-engine'; 4 | } -------------------------------------------------------------------------------- /examples/webpack-project/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "outDir": "bin-debug", 5 | "experimentalDecorators": true, 6 | "lib": [ 7 | "dom", 8 | "ESNext" 9 | ], 10 | "types": [] 11 | }, 12 | "include": [ 13 | "src/Main.ts", 14 | "src/classA.ts", 15 | "src/classB.ts", 16 | "src/i18n/cn/*", 17 | "libs", 18 | "src/components/*", 19 | "src/eui-support/*" 20 | ] 21 | } -------------------------------------------------------------------------------- /examples/webpack-project/wingProperties.json: -------------------------------------------------------------------------------- 1 | { 2 | "theme": "resource/default.thm.json", 3 | "resourcePlugin": { 4 | "configs": [ 5 | { 6 | "configPath": "resource/default.res.json", 7 | "relativePath": "resource/" 8 | } 9 | ] 10 | } 11 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egret-monorepo", 3 | "devDependencies": { 4 | "@typescript-eslint/eslint-plugin": "^4.10.0", 5 | "@typescript-eslint/parser": "^4.10.0", 6 | "eslint": "^7.15.0", 7 | "typescript": "^4.1.3" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/assetsmanager/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@egret/assetsmanager", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "dist/index.js", 6 | "typings": "dist/index.d.ts", 7 | "scripts": { 8 | "build": "tsc --p tsconfig.release.json", 9 | "test": "jest" 10 | }, 11 | "jest": { 12 | "moduleFileExtensions": [ 13 | "ts", 14 | "tsx", 15 | "js" 16 | ], 17 | "transform": { 18 | "\\.(ts|tsx)$": "ts-jest" 19 | }, 20 | "testRegex": "/test/.*.spec\\.(ts|tsx)$" 21 | }, 22 | "author": "", 23 | "license": "ISC", 24 | "dependencies": { 25 | "@egret/audio": "workspace:*", 26 | "rxjs": "~6.6.3" 27 | }, 28 | "devDependencies": { 29 | "@types/jest": "~26.0.19", 30 | "@types/koa": "~2.11.6", 31 | "@types/node": "~14.14.13", 32 | "jest": "~26.6.3", 33 | "koa": "~2.13.0", 34 | "koa-simple-static": "~4.0.10", 35 | "ts-jest": "~26.4.4", 36 | "ts-node": "~9.1.1", 37 | "typescript": "3.9.9", 38 | "xmlhttprequest": "~1.8.0" 39 | } 40 | } -------------------------------------------------------------------------------- /packages/assetsmanager/src/egret.d.ts: -------------------------------------------------------------------------------- 1 | declare namespace egret { 2 | 3 | export class ImageLoader { 4 | load(url: string): void; 5 | addEventListener(type: string, listener: Function, thisObject: any); 6 | data: BitmapData 7 | } 8 | 9 | export class Texture { 10 | _setBitmapData(bitmapData: BitmapData): void; 11 | } 12 | 13 | export interface BitmapData { 14 | width: number, 15 | height: number, 16 | source: any 17 | } 18 | 19 | export class BitmapFont { 20 | 21 | constructor(texture: Texture, config: any) 22 | } 23 | 24 | export class SpriteSheet { 25 | 26 | constructor(texture: Texture) 27 | 28 | createTexture(subkey: string, x: number, y: number, w: number, height: number, offX: number, offY: number, sourceW: number, sourceH: number) 29 | 30 | getTexture(subkey): Texture 31 | 32 | $resourceInfo: any; 33 | } 34 | 35 | export class Event { 36 | 37 | type: string; 38 | 39 | constructor(type: string) 40 | } 41 | 42 | export class EventDispatcher { 43 | 44 | addEventListener(type: string, listener: Function, thisObject: any): void; 45 | removeEventListener(type: string, listener: Function, thisObject: any): void 46 | dispatch(event: Event): void; 47 | } 48 | } -------------------------------------------------------------------------------- /packages/assetsmanager/src/store.ts: -------------------------------------------------------------------------------- 1 | import { Store } from './typings'; 2 | 3 | let store: Store = { 4 | config: { resources: {}, groups: {}, alias: {} } 5 | }; 6 | 7 | let cache: { [name: string]: any } = {}; 8 | 9 | export function getStore() { 10 | return store; 11 | } 12 | 13 | export function getCache() { 14 | return cache; 15 | } 16 | 17 | export function initStore() { 18 | store = { config: { resources: {}, groups: {}, alias: {} } }; 19 | cache = {}; 20 | } -------------------------------------------------------------------------------- /packages/assetsmanager/src/typings.ts: -------------------------------------------------------------------------------- 1 | 2 | export type ResourceInfo = { url: string, type: string, name: string, subkeys?: string } 3 | 4 | export type ResourceConfigFile = { 5 | groups: { name: string, keys: string }[], 6 | resources: ResourceInfo[] 7 | } 8 | 9 | export type ResourceConfig = { 10 | resources: { 11 | [name: string]: ResourceInfo 12 | }, 13 | groups: { 14 | [name: string]: string[] 15 | }, 16 | alias: { 17 | [name: string]: string 18 | } 19 | } 20 | 21 | export type Store = { 22 | config: ResourceConfig 23 | } -------------------------------------------------------------------------------- /packages/assetsmanager/test/server-hit-check.ts: -------------------------------------------------------------------------------- 1 | import Koa from 'koa'; 2 | 3 | let counts: { [name: string]: number } = {}; 4 | 5 | export function clearHitCheck() { 6 | counts = {}; 7 | } 8 | 9 | export function getCount(name: string) { 10 | return counts[name] || 0; 11 | } 12 | 13 | export function apply(app: Koa) { 14 | app.use(async (ctx, next) => { 15 | const { path } = ctx; 16 | if (!counts[path]) { 17 | counts[path] = 0; 18 | } 19 | counts[path]++; 20 | await next(); 21 | }); 22 | } 23 | 24 | -------------------------------------------------------------------------------- /packages/assetsmanager/test/static/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/packages/assetsmanager/test/static/1.jpg -------------------------------------------------------------------------------- /packages/assetsmanager/test/static/1.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egret" 3 | } -------------------------------------------------------------------------------- /packages/assetsmanager/test/static/default.res.json: -------------------------------------------------------------------------------- 1 | { 2 | "groups": [ 3 | { 4 | "name": "preload", 5 | "keys": "1_jpg,1_json" 6 | }, 7 | { 8 | "name": "errorgroup", 9 | "keys": "error_jpg" 10 | } 11 | ], 12 | "resources": [ 13 | { 14 | "url": "1.jpg", 15 | "type": "image", 16 | "name": "1_jpg" 17 | }, 18 | { 19 | "url": "1.json", 20 | "type": "json", 21 | "name": "1_json" 22 | }, 23 | { 24 | "url": "1.json", 25 | "type": "text", 26 | "name": "1_txt" 27 | }, 28 | { 29 | "url": "num2.fnt", 30 | "type": "font", 31 | "name": "num2_fnt" 32 | }, 33 | { 34 | "url": "spritesheet.json", 35 | "type": "sheet", 36 | "name": "spritesheet_json", 37 | "subkeys": "rank_no1_png,rank_no2_png,rank_no3_png,x_png" 38 | } 39 | ] 40 | } -------------------------------------------------------------------------------- /packages/assetsmanager/test/static/num2.fnt: -------------------------------------------------------------------------------- 1 | {"file":"num2.png","frames":{ 2 | "0":{"x":109,"y":1,"w":16,"h":37,"offX":0,"offY":0,"sourceW":16,"sourceH":37}, 3 | "1":{"x":37,"y":40,"w":15,"h":37,"offX":0,"offY":0,"sourceW":15,"sourceH":37}, 4 | "2":{"x":73,"y":1,"w":16,"h":37,"offX":0,"offY":0,"sourceW":16,"sourceH":37}, 5 | "3":{"x":19,"y":1,"w":16,"h":37,"offX":0,"offY":0,"sourceW":16,"sourceH":37}, 6 | "4":{"x":91,"y":1,"w":16,"h":37,"offX":0,"offY":0,"sourceW":16,"sourceH":37}, 7 | "5":{"x":55,"y":1,"w":16,"h":37,"offX":0,"offY":0,"sourceW":16,"sourceH":37}, 8 | "6":{"x":19,"y":40,"w":16,"h":37,"offX":0,"offY":0,"sourceW":16,"sourceH":37}, 9 | "7":{"x":37,"y":1,"w":16,"h":37,"offX":0,"offY":0,"sourceW":16,"sourceH":37}, 10 | "8":{"x":1,"y":40,"w":16,"h":37,"offX":0,"offY":0,"sourceW":16,"sourceH":37}, 11 | "9":{"x":1,"y":1,"w":16,"h":37,"offX":0,"offY":0,"sourceW":16,"sourceH":37}}} -------------------------------------------------------------------------------- /packages/assetsmanager/test/static/num2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/packages/assetsmanager/test/static/num2.png -------------------------------------------------------------------------------- /packages/assetsmanager/test/static/spritesheet.json: -------------------------------------------------------------------------------- 1 | { 2 | "file": "spritesheet.png", 3 | "frames": { 4 | "rank_no1_png": { 5 | "x": 1, 6 | "y": 64, 7 | "w": 44, 8 | "h": 61, 9 | "offX": 0, 10 | "offY": 0, 11 | "sourceW": 44, 12 | "sourceH": 61 13 | }, 14 | "rank_no2_png": { 15 | "x": 47, 16 | "y": 1, 17 | "w": 44, 18 | "h": 61, 19 | "offX": 0, 20 | "offY": 0, 21 | "sourceW": 44, 22 | "sourceH": 61 23 | }, 24 | "rank_no3_png": { 25 | "x": 1, 26 | "y": 1, 27 | "w": 44, 28 | "h": 61, 29 | "offX": 0, 30 | "offY": 0, 31 | "sourceW": 44, 32 | "sourceH": 61 33 | }, 34 | "x_png": { 35 | "x": 93, 36 | "y": 1, 37 | "w": 28, 38 | "h": 31, 39 | "offX": 0, 40 | "offY": 0, 41 | "sourceW": 28, 42 | "sourceH": 31 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /packages/assetsmanager/test/static/spritesheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/packages/assetsmanager/test/static/spritesheet.png -------------------------------------------------------------------------------- /packages/assetsmanager/tsconfig.release.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "ES2015" 5 | }, 6 | "include": [ 7 | "./src" 8 | ] 9 | } -------------------------------------------------------------------------------- /packages/audio/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@egret/audio", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "dist/index.js", 6 | "typings": "dist/index.d.ts", 7 | "scripts": { 8 | "build": "tsc --p tsconfig.release.json", 9 | "watch": "tsc --p tsconfig.release.json -w", 10 | "test": "jest" 11 | }, 12 | "jest": { 13 | "moduleFileExtensions": [ 14 | "ts", 15 | "tsx", 16 | "js" 17 | ], 18 | "transform": { 19 | "\\.(ts|tsx)$": "ts-jest" 20 | }, 21 | "testRegex": "/tests/index.spec\\.(ts|tsx)$" 22 | }, 23 | "devDependencies": { 24 | "@types/jest": "~26.0.19", 25 | "jest": "~26.6.3", 26 | "ts-jest": "~26.4.4" 27 | }, 28 | "author": "", 29 | "license": "ISC" 30 | } -------------------------------------------------------------------------------- /packages/audio/src/AbstractAudioInstance.ts: -------------------------------------------------------------------------------- 1 | export abstract class AbstractAudioInstance { 2 | 3 | protected loader: any; 4 | 5 | play() { 6 | } 7 | 8 | stop() { 9 | 10 | } 11 | 12 | mute(value: boolean) { 13 | } 14 | 15 | loop(value: boolean) { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/audio/src/AudioFactory.ts: -------------------------------------------------------------------------------- 1 | import { InternalAudioConfig } from './index'; 2 | import { AbstractAudioInstance } from "./AbstractAudioInstance"; 3 | 4 | export class AudioFactory { 5 | 6 | private config: InternalAudioConfig; 7 | private instances: AbstractAudioInstance[] = []; 8 | 9 | constructor(config: InternalAudioConfig) { 10 | this.config = config; 11 | } 12 | 13 | load() { 14 | const loader = new this.config.loaderClass; 15 | return loader.load(this.config.url).then((value) => { 16 | this.config.data = value; 17 | }); 18 | } 19 | 20 | mute(value: boolean) { 21 | for (const instance of this.instances) { 22 | instance.mute(value); 23 | } 24 | } 25 | 26 | create(): T { 27 | const instance = new this.config.loaderClass.instanceClass(this.config.data); 28 | this.instances.push(instance); 29 | return instance; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /packages/audio/src/HTMLAudioInstance.ts: -------------------------------------------------------------------------------- 1 | import { AbstractAudioInstance } from './AbstractAudioInstance'; 2 | 3 | export class HTMLAudioInstance extends AbstractAudioInstance { 4 | 5 | private audio: HTMLAudioElement; 6 | 7 | constructor(audio: HTMLAudioElement) { 8 | super(); 9 | this.audio = audio; 10 | } 11 | 12 | play() { 13 | const audio = this.audio; 14 | audio.volume = 1; 15 | audio.currentTime = 0; 16 | audio.play(); 17 | } 18 | 19 | stop() { 20 | const audio = this.audio; 21 | audio.pause(); 22 | try { 23 | audio.currentTime = 0; 24 | } catch (e) { 25 | } 26 | } 27 | 28 | mute(value: boolean) { 29 | this.audio.muted = value; 30 | } 31 | 32 | loop(value: boolean) { 33 | this.audio.loop = value; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /packages/audio/src/SimpleHTMLAudioLoader.ts: -------------------------------------------------------------------------------- 1 | import { HTMLAudioInstance } from './HTMLAudioInstance'; 2 | import { AbstractAudioLoader } from './index'; 3 | 4 | export class SimpleHTMLAudioLoader extends AbstractAudioLoader { 5 | 6 | static instanceClass = HTMLAudioInstance; 7 | 8 | load(url: string) { 9 | return new Promise((resolve, reject) => { 10 | const audio = new Audio(); 11 | audio.src = url; 12 | const canplaythroughFunc = () => { 13 | audio.removeEventListener('canplaythrough', canplaythroughFunc); 14 | resolve(audio); 15 | } 16 | audio.addEventListener('canplaythrough', canplaythroughFunc); 17 | audio.load(); 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/audio/src/WebAudioInstance.ts: -------------------------------------------------------------------------------- 1 | import { AudioManager } from './AudioManager'; 2 | import { AbstractAudioInstance } from './AbstractAudioInstance'; 3 | 4 | export class WebAudioInstance extends AbstractAudioInstance { 5 | 6 | private gainNode: GainNode; 7 | 8 | private source: AudioBufferSourceNode; 9 | 10 | private $loop: boolean = false; 11 | 12 | constructor(buffer: AudioBuffer) { 13 | super(); 14 | const context = AudioManager.context; 15 | this.gainNode = context.createGain(); 16 | const source = context.createBufferSource(); 17 | source.buffer = buffer; 18 | source.connect(this.gainNode); 19 | this.source = source; 20 | } 21 | 22 | play() { 23 | const context = AudioManager.context; 24 | this.source.connect(this.gainNode); 25 | this.gainNode.connect(context.destination); 26 | this.source.start(); 27 | this.source.onended = this.onPlayEnded; 28 | } 29 | 30 | mute(value: boolean) { 31 | this.gainNode.gain.value = value ? 0 : 1; 32 | } 33 | 34 | 35 | loop(value: boolean) { 36 | if (this.$loop !== value) { 37 | this.$loop = value; 38 | } 39 | } 40 | 41 | 42 | stop() { 43 | if (this.source) { 44 | this.source.stop(0); 45 | this.source.onended = null; 46 | this.source.disconnect(); 47 | } 48 | } 49 | 50 | 51 | private onPlayEnded() { 52 | if (this.$loop) { 53 | this.play(); 54 | } else { 55 | this.stop(); 56 | } 57 | } 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /packages/audio/src/index.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface AudioConfig { 3 | 4 | name: string, 5 | type: string, 6 | url: string 7 | } 8 | 9 | export interface InternalAudioConfig extends AudioConfig { 10 | 11 | data?: any; 12 | 13 | loaderClass: LoaderClass 14 | } 15 | 16 | export type LoaderClass = { new(): AbstractAudioLoader } & { instanceClass: any } 17 | 18 | export abstract class AbstractAudioLoader { 19 | 20 | abstract load(url: string): Promise 21 | 22 | } 23 | 24 | export * from './AbstractAudioInstance'; 25 | export * from './AudioFactory'; 26 | export * from './AudioManager'; 27 | export * from './HTMLAudioInstance'; 28 | export * from './SimpleHTMLAudioLoader'; 29 | export * from './WebAudioInstance'; 30 | -------------------------------------------------------------------------------- /packages/audio/tsconfig.release.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": [ 4 | "src" 5 | ] 6 | } -------------------------------------------------------------------------------- /packages/egret/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@egret/egret", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "jest" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "devDependencies": { 12 | "@types/jest": "~26.0.19", 13 | "jest": "~26.6.3", 14 | "ts-jest": "~26.4.4", 15 | "typescript": "3.9.9", 16 | "jest-webgl-canvas-mock": "~0.2.3", 17 | "webgl-mock": "~0.1.7", 18 | "@types/node": "~14.14.33" 19 | }, 20 | "jest": { 21 | "moduleFileExtensions": [ 22 | "ts", 23 | "tsx", 24 | "js" 25 | ], 26 | "setupFiles": [ 27 | "jest-webgl-canvas-mock" 28 | ], 29 | "transform": { 30 | "\\.(ts|tsx)$": "ts-jest" 31 | }, 32 | "testRegex": "/test/.*.spec\\.(ts|tsx)$" 33 | } 34 | } -------------------------------------------------------------------------------- /packages/egret/src/display/GradientType.ts: -------------------------------------------------------------------------------- 1 | namespace egret { 2 | /** 3 | * The GradientType class provides values for the type parameter in the beginGradientFill() methods of the egret.Graphics class. 4 | * 5 | * @see egret.Graphics#beginGradientFill() 6 | * @language en_US 7 | */ 8 | /** 9 | * GradientType 类为 egret.Graphics 类的 beginGradientFill() 方法中的 type 参数提供值。 10 | * 11 | * @see egret.Graphics#beginGradientFill() 12 | * @language zh_CN 13 | */ 14 | export class GradientType { 15 | /** 16 | * Value used to specify a linear gradient fill. 17 | * @language en_US 18 | */ 19 | /** 20 | * 用于指定线性渐变填充的值 21 | * @language zh_CN 22 | */ 23 | public static LINEAR:string = "linear"; 24 | /** 25 | * Value used to specify a radial gradient fill. 26 | * @language en_US 27 | */ 28 | /** 29 | * 用于指定放射状渐变填充的值 30 | * @language zh_CN 31 | */ 32 | public static RADIAL:string = "radial"; 33 | } 34 | } -------------------------------------------------------------------------------- /packages/egret/src/libs/pro-library.d.ts: -------------------------------------------------------------------------------- 1 | declare class Application { 2 | static instance: Application; 3 | egretProUtil: EgretProUtil; 4 | } 5 | 6 | declare class EgretProUtil { 7 | /** 8 | * 执行方法 9 | * 通过传入命令的字符串,获取已注册的方法并执行,参数为可变参数 10 | * 执行方法可获取到方法的返回值 11 | * 若找到注册该方法,会报出警告并返回 null 12 | * @param command 13 | * @param thisObject 14 | * @param args 15 | */ 16 | execute(command: string, ...args: any[]): any; 17 | 18 | /** 19 | * 注册方法 20 | * 根据传入字符串名称,注册方法 21 | * 同一个名称的方法只能注册一次,相同名称会报出警告 22 | * @param command 23 | * @param func 24 | * @param thisObject 25 | */ 26 | register(command: string, func: (...args: any[]) => any, thisObject: any): void; 27 | 28 | /** 29 | * 注册事件 30 | * @param eventType 31 | * @param target 32 | * @param func 33 | * @param thisObject 34 | */ 35 | addEventListener(eventType: string, target: any, func: (...args: any[]) => void, thisObject: any): void; 36 | 37 | /** 38 | * 移除事件 39 | * @param eventType 40 | * @param target 41 | * @param func 42 | */ 43 | removeEventListener(eventType: string, target: any, func: (...args: any[]) => void): void; 44 | /** 45 | * 派发事件 46 | * @param command 47 | * @param target 48 | * @param args 49 | */ 50 | dispatch(command: string, target: any, ...args: any[]): void; 51 | } -------------------------------------------------------------------------------- /packages/egret/src/sensor/DeviceOrientation.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | namespace egret { 4 | 5 | /** 6 | * Orientation monitor the orientation of the device, send CHANGE event when the orientation is changed 7 | * 8 | * @event egret.Event.CHANGE device's orientation is changed 9 | * @includeExample egret/sensor/DeviceOrientation.ts 10 | * @see http://edn.egret.com/cn/docs/page/661 获取设备旋转角度 11 | * @language en_US 12 | */ 13 | /** 14 | * Orientation 监听设备方向的变化,当方向变化时派发 CHANGE 事件 15 | * @event egret.Event.CHANGE 设备方向改变时派发 16 | * @includeExample egret/sensor/DeviceOrientation.ts 17 | * @see http://edn.egret.com/cn/docs/page/661 获取设备旋转角度 18 | * @language zh_CN 19 | */ 20 | export interface DeviceOrientation extends EventDispatcher { 21 | /** 22 | * Start to monitor the device's orientation 23 | * @language en_US 24 | */ 25 | /** 26 | * 开始监听设备方向变化 27 | * @language zh_CN 28 | */ 29 | start(): void; 30 | /** 31 | * Stop monitor the device's orientation 32 | * @language en_US 33 | */ 34 | /** 35 | * 停止监听设备方向变化 36 | * @language zh_CN 37 | */ 38 | stop(): void; 39 | } 40 | 41 | /** 42 | * @copy egret.Orientation 43 | */ 44 | export let DeviceOrientation: { new (): DeviceOrientation } = null; 45 | 46 | } -------------------------------------------------------------------------------- /packages/egret/src/system/Implementation.ts: -------------------------------------------------------------------------------- 1 | namespace egret { 2 | /** 3 | * @private 4 | */ 5 | let implMap: any = {}; 6 | 7 | /** 8 | * Adds an interface-name-to-implementation-class mapping to the registry. 9 | * @param interfaceName the interface name to register. For example:"eui.IAssetAdapter","eui.Theme" 10 | * @param instance the instance to register. 11 | * @language en_US 12 | */ 13 | /** 14 | * 注册一个接口实现。 15 | * @param interfaceName 注入的接口名称。例如:"eui.IAssetAdapter","eui.Theme" 16 | * @param instance 实现此接口的实例。 17 | * @language zh_CN 18 | */ 19 | export function registerImplementation(interfaceName: string, instance: any): void { 20 | implMap[interfaceName] = instance; 21 | } 22 | 23 | /** 24 | * Returns the singleton instance of the implementation class that was registered for the specified interface. 25 | * This method is usually called by egret framework. 26 | * @param interfaceName The interface name to identify. For example:"eui.IAssetAdapter","eui.Theme" 27 | * @returns the singleton instance of the implementation class 28 | * @language en_US 29 | */ 30 | /** 31 | * 获取一个接口实现。此方法通常由框架内部调用。获取项目注入的自定义实现实例。 32 | * @param interfaceName 要获取的接口名称。例如:"eui.IAssetAdapter","eui.Theme" 33 | * @returns 返回实现此接口的实例。 34 | * @language zh_CN 35 | */ 36 | export function getImplementation(interfaceName: string): any { 37 | return implMap[interfaceName]; 38 | } 39 | } -------------------------------------------------------------------------------- /packages/egret/src/utils/DataStructure.ts: -------------------------------------------------------------------------------- 1 | namespace egret { 2 | 3 | /** 4 | * @private 5 | */ 6 | export interface MapLike { 7 | 8 | [key: string]: T 9 | 10 | [key: number]: T 11 | 12 | } 13 | 14 | /** 15 | * @private 16 | */ 17 | export function createMap(): MapLike { 18 | 19 | let obj: any = Object.create(null); 20 | obj.__v8__ = undefined; 21 | delete obj.__v8__; 22 | return obj; 23 | 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /packages/egret/test/Factory.ts: -------------------------------------------------------------------------------- 1 | export async function createEgretEnverionment(mainClz: any) { 2 | const div = document.createElement('div'); 3 | div.className = 'egret-player'; 4 | div.setAttribute('data-entry-class', 'Main'); 5 | if (document.body.firstChild) { 6 | document.body.removeChild(document.body.firstChild); 7 | } 8 | document.body.appendChild(div); 9 | global.Main = mainClz; 10 | global.egret.runEgret({ renderMode: 'canvas' }); 11 | const canvas = document.querySelector('canvas'); 12 | const context = canvas.getContext('2d'); 13 | await sleepFrame(); 14 | return context; 15 | } 16 | 17 | function sleepFrame() { 18 | return new Promise((resolve, reject) => { 19 | requestAnimationFrame(resolve); 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /packages/egret/test/index.spec.ts: -------------------------------------------------------------------------------- 1 | import 'jest-webgl-canvas-mock'; 2 | import { createEgretEnverionment } from './Factory'; 3 | global.egret = {}; 4 | require('./libs/modules/egret/egret.js'); 5 | require('./libs/modules/egret/egret.web.js'); 6 | 7 | describe('TextField', function () { 8 | 9 | it('.text1', async function () { 10 | 11 | class Main extends global.egret.DisplayObjectContainer { 12 | 13 | constructor() { 14 | super(); 15 | const text = new egret.TextField(); 16 | this.addChild(text); 17 | text.text = 'helloworld'; 18 | } 19 | } 20 | const context = await createEgretEnverionment(Main); 21 | console.log(context.__getDrawCalls()); 22 | 23 | }); 24 | }); -------------------------------------------------------------------------------- /packages/egret/test/index2.spec.ts: -------------------------------------------------------------------------------- 1 | import 'jest-webgl-canvas-mock'; 2 | import { createEgretEnverionment } from './Factory'; 3 | global.egret = {}; 4 | require('./libs/modules/egret/egret.js'); 5 | require('./libs/modules/egret/egret.web.js'); 6 | 7 | describe('TextField', function () { 8 | 9 | it('.text1', async function () { 10 | 11 | class Main extends global.egret.DisplayObjectContainer { 12 | 13 | constructor() { 14 | super(); 15 | const text = new egret.TextField(); 16 | this.addChild(text); 17 | text.text = 'Wangze'; 18 | } 19 | } 20 | const context = await createEgretEnverionment(Main); 21 | console.log(context.__getDrawCalls()); 22 | 23 | }); 24 | }); -------------------------------------------------------------------------------- /packages/egret/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "sourceMap": false, 5 | "declaration": true, 6 | "allowUnreachableCode": true, 7 | "newLine": "LF", 8 | "lib": [ 9 | "dom", 10 | "es2015" 11 | ] 12 | }, 13 | "exclude": [ 14 | "node_modules" 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/eui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@egret/eui", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "dist/index.js", 6 | "typings": "dist/index.d.ts", 7 | "scripts": { 8 | "build": "package-bundler --p tsconfig.release.json", 9 | "watch": "package-bundler --p tsconfig.release.json -w", 10 | "test": "package-bundler --noEmit" 11 | }, 12 | "author": "", 13 | "license": "ISC", 14 | "devDependencies": { 15 | "@egret/package-bundler": "workspace:*" 16 | } 17 | } -------------------------------------------------------------------------------- /packages/eui/src/events/ScrollerThrowEvent.ts: -------------------------------------------------------------------------------- 1 | 2 | export class ScrollerThrowEvent extends egret.Event { 3 | 4 | public static THROW:string = "throw"; 5 | 6 | /** 7 | * 滚动区域当前滚动位置 8 | */ 9 | public currentPos:number; 10 | 11 | /** 12 | * 要滚动到的位置 13 | * 修改当前值会修改要滚动到得位置,但是当 moveFlag 为 false 时修改此值依然不会滚动,若此时依然要调整滚动区域的位置可以自己设置 14 | */ 15 | public toPos:number; 16 | 17 | /** 18 | * 动画信息,可调节或修改 19 | */ 20 | //public tween; 21 | 22 | 23 | public constructor(type:string, bubbles?:boolean, cancelable?:boolean,currentPos?:number,toPos?:number) { 24 | super(type, bubbles, cancelable); 25 | currentPos = +currentPos; 26 | toPos = +toPos; 27 | this.currentPos = currentPos; 28 | this.toPos = toPos; 29 | } 30 | } -------------------------------------------------------------------------------- /packages/eui/tsconfig.release.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": [ 4 | "src", 5 | "egret.d.ts" 6 | ] 7 | } -------------------------------------------------------------------------------- /packages/tween/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@egret/tween", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "dist/index.js", 6 | "typings": "dist/index.d.ts", 7 | "scripts": { 8 | "build": "tsc --p tsconfig.release.json", 9 | "test": "jest" 10 | }, 11 | "author": "", 12 | "license": "ISC", 13 | "devDependencies": { 14 | "typescript": "3.9.9" 15 | } 16 | } -------------------------------------------------------------------------------- /packages/tween/src/WorldClock.ts: -------------------------------------------------------------------------------- 1 | export interface TweenContext { 2 | 3 | tick(timeStamp: number): void; 4 | } 5 | 6 | export class DefaultWorldClock { 7 | 8 | register(context: TweenContext) { 9 | egret.ticker.$startTick(context.tick, null); 10 | return egret.getTimer(); 11 | } 12 | } -------------------------------------------------------------------------------- /packages/tween/src/egret.d.ts: -------------------------------------------------------------------------------- 1 | declare namespace egret { 2 | 3 | export class EventDispatcher { 4 | 5 | addEventListener(type: string, listener: Function, thisObject: any): void; 6 | removeEventListener(type: string, listener: Function, thisObject: any): void 7 | dispatch(event: Event): void; 8 | dispatchEventWith(eventName: string, capture?: boolean, data?: any): void; 9 | } 10 | 11 | export const ticker: { 12 | $startTick: (callback: Function, obj: any) => void; 13 | }; 14 | 15 | export function getTimer(): number; 16 | } -------------------------------------------------------------------------------- /packages/tween/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Ease'; 2 | export * from './Tween'; 3 | export * from './TweenWrapper'; 4 | -------------------------------------------------------------------------------- /packages/tween/tsconfig.release.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "ES2015" 5 | }, 6 | "include": [ 7 | "./src" 8 | ] 9 | } -------------------------------------------------------------------------------- /scripts/index.js: -------------------------------------------------------------------------------- 1 | const eol = require('eol'); 2 | const fs = require('fs-extra'); 3 | const path = require('path'); 4 | 5 | // 从目录开始 6 | function convertEol(path) { 7 | const filesList = []; 8 | readFile(path, filesList); 9 | // return filesList; 10 | } 11 | 12 | // 遍历读取文件 13 | function readFile(_path, filesList) { 14 | files = fs.readdirSync(_path); // 需要用到同步读取 15 | files.forEach((file) => { 16 | 17 | states = fs.statSync(_path + '/' + file); 18 | // ❤❤❤ 判断是否是目录,是就继续递归 19 | if (states.isDirectory()) { 20 | if (file == 'node_modules' || 21 | file == '.git') { 22 | return; 23 | } 24 | readFile(_path + '/' + file, filesList); 25 | } else { 26 | // 不是就将文件push进数组,此处可以正则匹配是否是 .js 先忽略 27 | // filesList.push(file); 28 | const arr = file.split('.'); 29 | if (['ts', 'js', 'json', 'exml', 'md', 'txt'].includes(arr[arr.length - 1])) { 30 | // console.log(path.join(_path, file)) 31 | const url = path.join(_path, file); 32 | const text = fs.readFileSync(url, 'utf-8'); 33 | fs.writeFileSync(url, eol.lf(text)); 34 | } 35 | } 36 | }); 37 | } 38 | 39 | convertEol(path.resolve(__dirname, '../packages/egret')); // __dirname是当前路径,可以修改 -------------------------------------------------------------------------------- /scripts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "scripts", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "eol": "^0.9.1", 13 | "fs-extra": "^9.0.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | lib 3 | node_modules 4 | TODO 5 | *.log -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/.npmignore: -------------------------------------------------------------------------------- 1 | .rush 2 | src 3 | test -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/bin/cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | //@ts-check 3 | const lib = require('../lib/index'); 4 | const args = require('args'); 5 | const path = require('path'); 6 | args.option('config', 'config-file', '', (value) => { 7 | if (!value) { 8 | return null; 9 | } 10 | else { 11 | const p = path.join(process.cwd(), value); 12 | // eslint-disable-next-line global-require 13 | return require(p); 14 | } 15 | 16 | }); 17 | args.command('build', 'build-project', (name, sub, options) => { 18 | // @ts-ignore 19 | const config = options.config; 20 | const bundler = new lib.EgretWebpackBundler(process.cwd(), 'web'); 21 | bundler.build(config); 22 | }); 23 | args.command('prepare', 'prepare-build-project', (name, sub, options) => { 24 | // @ts-ignore 25 | const bundler = new lib.EgretWebpackBundler(process.cwd(), 'web'); 26 | bundler.install(); 27 | }); 28 | args.command('run', 'run-project', (name, sub, options) => { 29 | // @ts-ignore 30 | const config = options.config; 31 | const bundler = new lib.EgretWebpackBundler(process.cwd(), 'web'); 32 | bundler.startDevServer(config); 33 | }); 34 | args.command('publish', 'run-project', (name, sub, options) => { 35 | // @ts-ignore 36 | const config = options.config; 37 | const bundler = new lib.EgretWebpackBundler(process.cwd(), 'web'); 38 | bundler.build(config); 39 | }); 40 | args.parse(process.argv); -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/src/assets/Transaction.ts: -------------------------------------------------------------------------------- 1 | import { TransactionManager } from './TransactionManager'; 2 | 3 | type TransactionPreparedResult = { fileDependencies: string[] } 4 | 5 | export class Transaction { 6 | 7 | // eslint-disable-next-line no-useless-constructor 8 | constructor(readonly source: string) { 9 | } 10 | 11 | private preparedResult!: TransactionPreparedResult; 12 | 13 | get fileDependencies() { 14 | return this.preparedResult.fileDependencies; 15 | } 16 | 17 | async prepare(manager: TransactionManager) { 18 | this.preparedResult = await this.onPrepare(manager); 19 | } 20 | 21 | protected async onPrepare(manager: TransactionManager): Promise { 22 | return { fileDependencies: [] }; 23 | } 24 | 25 | async onExecute(manager: TransactionManager) { 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/src/assets/transactions/CopyFileTransaction.ts: -------------------------------------------------------------------------------- 1 | import { Transaction } from '../Transaction'; 2 | import { TransactionManager } from '../TransactionManager'; 3 | 4 | export class CopyFileTransaction extends Transaction { 5 | 6 | constructor(private filename: string) { 7 | super(filename); 8 | } 9 | 10 | async onExecute(manager: TransactionManager) { 11 | const content = await manager.inputFileSystem.readFileAsync(this.source); 12 | manager.outputFileSystem.emitAsset(this.source, content); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/src/assets/transactions/ResourceConfigTransaction.ts: -------------------------------------------------------------------------------- 1 | import { ResourceConfig } from '../ResourceConfigFactory'; 2 | import { Transaction } from '../Transaction'; 3 | import { TransactionManager } from '../TransactionManager'; 4 | import { CopyFileTransaction } from './CopyFileTransaction'; 5 | export type ResourceConfigFilePluginOption = { file: string, executeBundle?: boolean }; 6 | 7 | export class ResourceConfigTransaction extends Transaction { 8 | 9 | async onPrepare(manager: TransactionManager) { 10 | 11 | const factory = manager.factory; 12 | const config = factory.config; 13 | for (const x of config.resources as ResourceConfig[]) { 14 | if (!x.isEmitted) { 15 | manager.create(CopyFileTransaction, 'resource/' + x.url); 16 | } 17 | 18 | } 19 | return { fileDependencies: [] }; 20 | } 21 | 22 | async onExecute(manager: TransactionManager) { 23 | 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/src/egretproject/api/index.ts: -------------------------------------------------------------------------------- 1 | import { createInstallerLibrary } from './installer-proxy'; 2 | import { createLauncherLibrary } from './launcher-proxy'; 3 | 4 | export type LauncherAPI = { 5 | 6 | getAllEngineVersions(): { [version: string]: { version: string, root: string } }; 7 | 8 | getInstalledTools(): { name: string, version: string, path: string }[]; 9 | 10 | getTarget(targetName: string): string 11 | 12 | getUserID(): string; 13 | 14 | sign(templatePath: string, uid: string): void; 15 | 16 | } 17 | 18 | let api: LauncherAPI; 19 | 20 | export function getApi(): LauncherAPI { 21 | if (!api) { 22 | api = createAPI(); 23 | } 24 | return api; 25 | } 26 | 27 | function createAPI() { 28 | try { 29 | return createLauncherLibrary(); 30 | } 31 | catch (e) { 32 | return createInstallerLibrary(); 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/src/egretproject/api/installer-proxy.ts: -------------------------------------------------------------------------------- 1 | import * as cp from 'child_process'; 2 | import * as path from 'path'; 3 | import { LauncherAPI } from '.'; 4 | export function createInstallerLibrary(): LauncherAPI { 5 | const result = cp.execSync('npm root -g').toString().replace('\n', ''); 6 | const libraryPath = path.join(result, '@egret/egret-library-installer'); 7 | // eslint-disable-next-line global-require 8 | const x = require(libraryPath); 9 | return x.launcherapi; 10 | } -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/src/egretproject/typings.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /** 3 | * This file was automatically generated by json-schema-to-typescript. 4 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, 5 | * and run json-schema-to-typescript to regenerate this file. 6 | */ 7 | 8 | export interface EgretProperties { 9 | packages?: { 10 | name: string; 11 | }[]; 12 | modules: { 13 | name: string; 14 | version?: string; 15 | path?: string; 16 | }[]; 17 | engineVersion: string; 18 | compilerVersion: string; 19 | eui?: { 20 | exmlRoot?: string[]; 21 | themes?: string[]; 22 | }; 23 | [k: string]: unknown; 24 | } 25 | -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/src/helper.ts: -------------------------------------------------------------------------------- 1 | export const __reflect = (p: any, c: any, t: any) => { 2 | p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t; 3 | }; -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/src/loaders/src-loader/TypeScriptLegacyPlugin.ts: -------------------------------------------------------------------------------- 1 | 2 | import * as path from 'path'; 3 | import * as webpack from 'webpack'; 4 | import { LineEmitter } from '../inline-loader'; 5 | import { AbstractInlinePlugin } from '../inline-loader/AbstractInlinePlugin'; 6 | import * as utils from '../utils'; 7 | import { Factory } from './Factory'; 8 | 9 | 10 | export class TypeScriptLegacyPlugin extends AbstractInlinePlugin { 11 | 12 | private factory!: Factory; 13 | 14 | createLineEmitter(compiler: webpack.Compiler) { 15 | this.addContextDependency(path.join(compiler.context, 'src')); 16 | this.factory = new Factory({ context: compiler.context }); 17 | 18 | const emitter: LineEmitter = { 19 | emitLines: () => { 20 | const d = this.factory.sortUnmodules(); 21 | const dependenciesRequires: string[] = []; 22 | d.forEach((fileName) => { 23 | const resourcePath = path.join(compiler.context, this.entryFilePath); 24 | if (fileName !== resourcePath) { 25 | const relative = utils.relative(resourcePath, fileName); 26 | dependenciesRequires.push(`require('${relative}');`); 27 | } 28 | }); 29 | return dependenciesRequires; 30 | } 31 | } 32 | return emitter; 33 | } 34 | 35 | onChange(compilation: webpack.Compilation) { 36 | this.factory.fs = compilation.compiler.inputFileSystem as any; 37 | this.factory.update(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/src/loaders/typings.ts: -------------------------------------------------------------------------------- 1 | import * as webpack from 'webpack'; 2 | export type CustomLoader = (this: LoaderContext, content: string, sourcemap?: any) => void; 3 | 4 | export type LoaderContext = { 5 | 6 | rootContext: string, 7 | 8 | resourcePath: string 9 | 10 | emitError: (value: any) => void 11 | 12 | loaders: any; 13 | 14 | loaderIndex: number 15 | 16 | async: () => (error: any, content: string, sourcemap?: any) => void; 17 | 18 | sourceMap: boolean 19 | 20 | _compiler: import('webpack').Compiler 21 | 22 | _module: webpack.Module; 23 | 24 | } -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/src/open.ts: -------------------------------------------------------------------------------- 1 | import * as cp from 'child_process'; 2 | import * as path from 'path'; 3 | 4 | export function openUrl(url: string, browserName?: string) { 5 | let command; 6 | 7 | switch (process.platform) { 8 | case 'darwin': 9 | if (browserName) { 10 | command = 'open -a "' + escape(browserName) + '"'; 11 | } else { 12 | command = 'open'; 13 | } 14 | break; 15 | case 'win32': 16 | // if the first parameter to start is quoted, it uses that as the title 17 | // so we pass a blank title so we can quote the file we are opening 18 | if (browserName) { 19 | command = 'start "" "' + escape(browserName) + '"'; 20 | } else { 21 | command = 'start ""'; 22 | } 23 | break; 24 | default: 25 | if (browserName) { 26 | command = escape(browserName); 27 | } else { 28 | // use Portlands xdg-open everywhere else 29 | command = path.join(__dirname, '../vendor/xdg-open'); 30 | } 31 | break; 32 | } 33 | executeCommand(command + ' "' + url + '"'); 34 | } 35 | 36 | export async function executeCommand(command: string, options = {}) { 37 | return new Promise((resolve, reject) => { 38 | cp.exec(command, options, (error, stdout, stderr) => { 39 | resolve(); 40 | }); 41 | }); 42 | } 43 | -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/src/scripts-pipeline-polyfill.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import { Compiler, Configuration } from 'webpack'; 3 | export function scriptsPipelinePolyfill(compiler: Compiler, webpackConfig: Configuration, emitter: (p: string, c: Buffer) => void) { 4 | compiler.options.output.compareBeforeEmit = false; 5 | compiler.outputFileSystem = { 6 | 7 | writeFile: ( 8 | filepath: string, 9 | content: string | Buffer, 10 | callback: (err?: NodeJS.ErrnoException) => void 11 | ) => { 12 | const relativePath = path.relative(webpackConfig.output?.path!, filepath).split('\\').join('/'); 13 | emitter!(relativePath, content as Buffer); 14 | callback(); 15 | }, 16 | mkdir: (dirpath: string, callback: (arg0?: NodeJS.ErrnoException) => void) => { 17 | callback(); 18 | }, 19 | stat: ( 20 | filepath: string, 21 | callback: (err?: NodeJS.ErrnoException, stats?: any) => void 22 | ) => { 23 | callback(); 24 | }, 25 | readFile: ( 26 | filepath: string, 27 | callback: (err?: NodeJS.ErrnoException, content?: string | Buffer) => void 28 | ) => { 29 | 30 | } 31 | }; 32 | } -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/src/utils.ts: -------------------------------------------------------------------------------- 1 | import * as os from 'os'; 2 | import { walk } from '@nodelib/fs.walk'; 3 | import * as path from 'path'; 4 | 5 | export function getNetworkAddress(): string { 6 | 7 | const ifaces = os.networkInterfaces(); 8 | const ips: string[] = []; 9 | Object.keys(ifaces).forEach(function (ifname) { 10 | const alias = 0; 11 | ifaces[ifname].forEach(function (iface) { 12 | if ('IPv4' !== iface.family || iface.internal !== false) { 13 | // skip over internal (i.e. 127.0.0.1) and non-ipv4 addresses 14 | return; 15 | } 16 | ips.push(iface.address); 17 | }); 18 | }); 19 | return ips[0]; 20 | } 21 | 22 | type Entity = { 23 | name: string; 24 | path: string; 25 | } 26 | 27 | export function walkDir(root: string) { 28 | return new Promise((resolve, reject) => { 29 | walk(root, (error, entities) => { 30 | if (error) { 31 | reject(error); 32 | } 33 | else { 34 | entities.forEach((e) => e.path = path.relative(root, e.path).split('\\').join('/')); 35 | resolve(entities); 36 | } 37 | 38 | }); 39 | }); 40 | 41 | } -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/options.spec.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | const projectRoot = path.join(__dirname, 'simple-project'); 3 | import * as lib from '../lib/index'; 4 | 5 | describe('测试错误的配置项', () => { 6 | 7 | it('空配置', () => { 8 | const options = {} as any; 9 | lib.generateConfig(projectRoot, options, 'web', false); 10 | }); 11 | 12 | }); 13 | -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/egretProperties.json: -------------------------------------------------------------------------------- 1 | { 2 | "engineVersion": "5.4.0", 3 | "compilerVersion": "5.4.0", 4 | "template": {}, 5 | "eui": { 6 | "themes": [ 7 | "resource/default.thm.json" 8 | ] 9 | }, 10 | "target": { 11 | "current": "web" 12 | }, 13 | "modules": [ 14 | { 15 | "name": "egret" 16 | }, 17 | { 18 | "name": "eui" 19 | }, 20 | { 21 | "name": "assetsmanager" 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/resource/default.res.json: -------------------------------------------------------------------------------- 1 | { 2 | "groups": [ 3 | { 4 | "name": "preload", 5 | "keys": "rank_no1_png,rank_no2_png,rank_no3_png" 6 | } 7 | ], 8 | "resources": [ 9 | { 10 | "url": "spritesheet/rank_no1.png", 11 | "type": "image", 12 | "name": "rank_no1_png" 13 | }, 14 | { 15 | "url": "spritesheet/rank_no2.png", 16 | "type": "image", 17 | "name": "rank_no2_png" 18 | }, 19 | { 20 | "url": "spritesheet/rank_no3.png", 21 | "type": "image", 22 | "name": "rank_no3_png" 23 | } 24 | ] 25 | } -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/resource/error-url.res.json: -------------------------------------------------------------------------------- 1 | { 2 | "groups": [ 3 | { 4 | "name": "preload", 5 | "keys": "1_jpg" 6 | } 7 | ], 8 | "resources": [ 9 | { 10 | "url": "error-url.jpg", 11 | "type": "image", 12 | "name": "1_jpg" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/resource/error.res.json: -------------------------------------------------------------------------------- 1 | { 2 | "groups": [ 3 | { 4 | "name": "preload", 5 | "keys": "missing_key" 6 | } 7 | ], 8 | "resources": [ 9 | { 10 | "url": "1.jpg", 11 | "type": "image", 12 | "name": "1_jpg" 13 | }, 14 | { 15 | "url": "1.json", 16 | "type": "json", 17 | "name": "1_json" 18 | }, 19 | { 20 | "url": "1.json", 21 | "type": "text", 22 | "name": "1_txt" 23 | }, 24 | { 25 | "url": "num2.fnt", 26 | "type": "font", 27 | "name": "num2_fnt" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/resource/invalid.res.json: -------------------------------------------------------------------------------- 1 | { 2 | "groups": [ 3 | { 4 | "name": "invalid-json-file", 5 | -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/resource/spritesheet/1.json: -------------------------------------------------------------------------------- 1 | { 2 | "file": "rank.png", 3 | "frames": { 4 | "rank_no1": { 5 | "x": 1, 6 | "y": 64, 7 | "w": 44, 8 | "h": 61, 9 | "offX": 0, 10 | "offY": 0, 11 | "sourceW": 44, 12 | "sourceH": 61 13 | }, 14 | "rank_no2": { 15 | "x": 47, 16 | "y": 1, 17 | "w": 44, 18 | "h": 61, 19 | "offX": 0, 20 | "offY": 0, 21 | "sourceW": 44, 22 | "sourceH": 61 23 | }, 24 | "rank_no3": { 25 | "x": 1, 26 | "y": 1, 27 | "w": 44, 28 | "h": 61, 29 | "offX": 0, 30 | "offY": 0, 31 | "sourceW": 44, 32 | "sourceH": 61 33 | }, 34 | "x": { 35 | "x": 93, 36 | "y": 1, 37 | "w": 28, 38 | "h": 31, 39 | "offX": 0, 40 | "offY": 0, 41 | "sourceW": 28, 42 | "sourceH": 31 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/resource/spritesheet/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/egret-webpack-bundler/test/simple-project/resource/spritesheet/1.png -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/resource/spritesheet/rank_no1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/egret-webpack-bundler/test/simple-project/resource/spritesheet/rank_no1.png -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/resource/spritesheet/rank_no2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/egret-webpack-bundler/test/simple-project/resource/spritesheet/rank_no2.png -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/resource/spritesheet/rank_no3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/egret-webpack-bundler/test/simple-project/resource/spritesheet/rank_no3.png -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/resource/spritesheet/texture-merger.yaml: -------------------------------------------------------------------------------- 1 | files: 2 | - "rank_no1.png" 3 | - "rank_no2.png" 4 | - "rank_no3.png" 5 | - "x.png" 6 | root: ./resource 7 | outputName: spritesheet 8 | -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/resource/spritesheet/x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/egret-webpack-bundler/test/simple-project/resource/spritesheet/x.png -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/src/Main.ts: -------------------------------------------------------------------------------- 1 | class Main { 2 | 3 | } 4 | 5 | interface InterfaceA { 6 | 7 | } 8 | 9 | namespace m { 10 | 11 | export interface InterfaceB extends InterfaceC { 12 | 13 | } 14 | 15 | interface InterfaceC { 16 | 17 | } 18 | 19 | class B { 20 | 21 | } 22 | } 23 | 24 | function doSomething() { 25 | 26 | } 27 | 28 | class MyComponent implements InterfaceA, m.InterfaceB { 29 | 30 | } -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/src/testcore/CheckNode.ts: -------------------------------------------------------------------------------- 1 | namespace core { 2 | 3 | export abstract class ConditionCheckNode extends core.BaseNode { 4 | 5 | } 6 | } -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/src/testcore/Node.ts: -------------------------------------------------------------------------------- 1 | namespace core { 2 | 3 | export abstract class BaseNode { 4 | 5 | } 6 | } -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/template/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "outDir": "bin-debug", 5 | "experimentalDecorators": true, 6 | "lib": [ 7 | "es5", 8 | "dom", 9 | "es2015.promise" 10 | ], 11 | "types": [] 12 | }, 13 | "include": [ 14 | "src", 15 | "libs" 16 | ] 17 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/.gitignore: -------------------------------------------------------------------------------- 1 | bin-debug 2 | bin-release 3 | libs 4 | node_modules 5 | TODO 6 | *.log 7 | default.thm.js 8 | theme.js 9 | lib 10 | test-egret-project -------------------------------------------------------------------------------- /toolchains/eui-compiler/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | node_modules 3 | tests 4 | examples 5 | TODO 6 | tsconfig.json 7 | test-egret-project -------------------------------------------------------------------------------- /toolchains/eui-compiler/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log - @egret/eui-compiler 2 | 3 | This log was last generated on Wed, 05 Aug 2020 06:34:17 GMT and should not be manually modified. 4 | 5 | ## 1.4.9 6 | Wed, 05 Aug 2020 06:34:17 GMT 7 | 8 | ### Patches 9 | 10 | - update version 11 | 12 | ## 1.4.8 13 | Mon, 27 Jul 2020 02:50:03 GMT 14 | 15 | ### Patches 16 | 17 | - 添加 data-binding 支持 18 | 19 | ## 1.4.7 20 | Tue, 21 Jul 2020 06:20:28 GMT 21 | 22 | ### Patches 23 | 24 | - update testcase 25 | 26 | ## 1.4.6 27 | Mon, 06 Jul 2020 09:37:01 GMT 28 | 29 | ### Patches 30 | 31 | - 添加 javascript 输出负数报错的bug 32 | 33 | ## 1.4.5 34 | Sun, 21 Jun 2020 09:40:22 GMT 35 | 36 | ### Patches 37 | 38 | - 支持发布到 debug / commonjs2 两种模式 39 | 40 | ## 1.4.4 41 | Tue, 09 Jun 2020 08:03:17 GMT 42 | 43 | ### Patches 44 | 45 | - 重构代码,为多 emitter 做准备 46 | - 重构 theme 相关代码 47 | 48 | ## 1.4.3 49 | Wed, 03 Jun 2020 08:01:19 GMT 50 | 51 | ### Patches 52 | 53 | - eui-compiler不再生成log文件 54 | 55 | ## 1.4.2 56 | Tue, 02 Jun 2020 07:40:46 GMT 57 | 58 | ### Patches 59 | 60 | - 改善报错信息的可读性 61 | 62 | ## 1.4.1 63 | Tue, 02 Jun 2020 06:25:28 GMT 64 | 65 | ### Patches 66 | 67 | - 修复 emit state 相关问题 68 | - 优化测试用例 69 | - 添加 includeIn 属性支持 70 | 71 | ## 1.4.0 72 | Mon, 01 Jun 2020 09:54:27 GMT 73 | 74 | ### Minor changes 75 | 76 | - 更新AST与状态有关的数据结构 77 | 78 | ## 1.3.5 79 | Mon, 01 Jun 2020 08:38:02 GMT 80 | 81 | ### Patches 82 | 83 | - 修复textColor属性解析错误的bug 84 | 85 | ## 1.3.4 86 | Mon, 01 Jun 2020 07:33:02 GMT 87 | 88 | ### Patches 89 | 90 | - 添加对状态的支持 91 | 92 | ## 1.3.3 93 | Mon, 01 Jun 2020 06:15:48 GMT 94 | 95 | ### Patches 96 | 97 | - 修复生成的皮肤文件报错的问题 98 | 99 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/README.md: -------------------------------------------------------------------------------- 1 | # @egret/eui-compiler 2 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/bin/cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | const lib = require('../lib/index'); 3 | const fs = require('fs'); 4 | const args = require('args'); 5 | args.option('theme', 'theme file path'); 6 | args.option('mode', 'mode'); 7 | const params = args.parse(process.argv); 8 | // const mode = params.mode; 9 | lib.initilize('.'); 10 | lib.emitDts(); 11 | lib.emitJs(); -------------------------------------------------------------------------------- /toolchains/eui-compiler/esprima-test/ast.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "Program", 3 | "body": [ 4 | { 5 | "type": "ExpressionStatement", 6 | "expression": { 7 | "type": "AssignmentExpression", 8 | "operator": "=", 9 | "left": { 10 | "type": "MemberExpression", 11 | "computed": false, 12 | "object": { 13 | "type": "ThisExpression" 14 | }, 15 | "property": { 16 | "type": "Identifier", 17 | "name": "element" 18 | } 19 | }, 20 | "right": { 21 | "type": "ArrayExpression", 22 | "elements": [ 23 | { 24 | "type": "Identifier", 25 | "name": "a" 26 | } 27 | ] 28 | } 29 | } 30 | } 31 | ], 32 | "sourceType": "script" 33 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/esprima-test/code.js: -------------------------------------------------------------------------------- 1 | this.element = [a] -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/egretProperties.json: -------------------------------------------------------------------------------- 1 | { 2 | "engineVersion": "5.2.25", 3 | "compilerVersion": "5.2.25", 4 | "template": {}, 5 | "eui": { 6 | "themes": [ 7 | "resource/default.thm.json" 8 | ] 9 | }, 10 | "target": { 11 | "current": "web" 12 | }, 13 | "modules": [ 14 | { 15 | "name": "egret" 16 | }, 17 | { 18 | "name": "eui" 19 | }, 20 | { 21 | "name": "assetsmanager" 22 | }, 23 | { 24 | "name": "tween" 25 | }, 26 | { 27 | "name": "promise" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/favicon.ico -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "initial": [ 3 | "libs/modules/egret/egret.js", 4 | "libs/modules/egret/egret.web.js", 5 | "libs/modules/eui/eui.js", 6 | "libs/modules/assetsmanager/assetsmanager.js", 7 | "libs/modules/tween/tween.js", 8 | "libs/modules/promise/promise.js" 9 | ], 10 | "game": [ 11 | "bin-debug/AssetAdapter.js", 12 | "bin-debug/LoadingUI.js", 13 | "bin-debug/Main.js", 14 | "bin-debug/Platform.js", 15 | "bin-debug/ThemeAdapter.js" 16 | ] 17 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/Button/button_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/Button/button_down.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/Button/button_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/Button/button_up.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/CheckBox/checkbox_select_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/CheckBox/checkbox_select_disabled.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/CheckBox/checkbox_select_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/CheckBox/checkbox_select_down.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/CheckBox/checkbox_select_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/CheckBox/checkbox_select_up.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/CheckBox/checkbox_unselect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/CheckBox/checkbox_unselect.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/ItemRenderer/selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/ItemRenderer/selected.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/Panel/border.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/Panel/border.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/Panel/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/Panel/header.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/ProgressBar/thumb_pb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/ProgressBar/thumb_pb.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/ProgressBar/track_pb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/ProgressBar/track_pb.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/RadioButton/radiobutton_select_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/RadioButton/radiobutton_select_disabled.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/RadioButton/radiobutton_select_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/RadioButton/radiobutton_select_down.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/RadioButton/radiobutton_select_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/RadioButton/radiobutton_select_up.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/RadioButton/radiobutton_unselect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/RadioButton/radiobutton_unselect.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/ScrollBar/roundthumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/ScrollBar/roundthumb.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/ScrollBar/track_sb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/ScrollBar/track_sb.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/Slider/thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/Slider/thumb.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/Slider/track.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/Slider/track.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/Slider/tracklight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/Slider/tracklight.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/ToggleSwitch/handle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/ToggleSwitch/handle.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/ToggleSwitch/off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/ToggleSwitch/off.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/ToggleSwitch/on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/ToggleSwitch/on.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/bg.jpg -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/assets/egret_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/4506859859199584918aa31fa20a2c847e336da8/toolchains/eui-compiler/examples/tests-helloworld/resource/assets/egret_icon.png -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/config/description.json: -------------------------------------------------------------------------------- 1 | [ 2 | "Open-source,Free,Multi-platform", 3 | "Push Game Forward", 4 | "HTML5 Game Engine" 5 | ] -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/eui_skins/ButtonSkin.exml: -------------------------------------------------------------------------------- 1 |  2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/eui_skins/CheckBoxSkin.exml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 12 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/eui_skins/HScrollBarSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/eui_skins/HSliderSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/eui_skins/ItemRendererSkin.exml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/eui_skins/PanelSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/eui_skins/ProgressBarSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/eui_skins/RadioButtonSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/eui_skins/ScrollerSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/eui_skins/TextInputSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 9 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/eui_skins/ToggleSwitchSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 13 | 14 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/eui_skins/VScrollBarSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/eui_skins/VSliderSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/eui_skins/test.exml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/eui_skins/test2.exml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/src/Platform.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 平台数据接口。 3 | * 由于每款游戏通常需要发布到多个平台上,所以提取出一个统一的接口用于开发者获取平台数据信息 4 | * 推荐开发者通过这种方式封装平台逻辑,以保证整体结构的稳定 5 | * 由于不同平台的接口形式各有不同,白鹭推荐开发者将所有接口封装为基于 Promise 的异步形式 6 | */ 7 | declare interface Platform { 8 | 9 | getUserInfo(): Promise; 10 | 11 | login(): Promise 12 | 13 | } 14 | 15 | class DebugPlatform implements Platform { 16 | async getUserInfo() { 17 | return { nickName: "username" } 18 | } 19 | async login() { 20 | 21 | } 22 | } 23 | 24 | 25 | if (!window.platform) { 26 | window.platform = new DebugPlatform(); 27 | } 28 | 29 | 30 | 31 | declare let platform: Platform; 32 | 33 | declare interface Window { 34 | 35 | platform: Platform 36 | } 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "outDir": "bin-debug", 5 | "experimentalDecorators": true, 6 | "lib": [ 7 | "es5", 8 | "dom", 9 | "es2015.promise" 10 | ], 11 | "types": [] 12 | }, 13 | "include": [ 14 | "src", 15 | "libs" 16 | ] 17 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@egret/eui-compiler", 3 | "version": "2.0.0", 4 | "description": "", 5 | "main": "./lib/index.js", 6 | "bin": { 7 | "eui": "./bin/cli.js" 8 | }, 9 | "scripts": { 10 | "build": "tsc", 11 | "watch": "tsc -w", 12 | "test": "mocha -t 5000 ./tests/emitter/index.js", 13 | "test:project": "mocha -t 5000 ./tests/project/index.js", 14 | "test:error": "mocha -t 5000 ./tests/error/index.js", 15 | "test:lexer": "mocha -t 5000 ./tests/parser/lexer/index.js", 16 | "test:errors": "mocha -t 5000 ./tests/errors/index.js" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "git+https://github.com/WanderWang/eui-compiler.git" 21 | }, 22 | "author": "", 23 | "license": "ISC", 24 | "bugs": { 25 | "url": "https://github.com/WanderWang/eui-compiler/issues" 26 | }, 27 | "homepage": "https://github.com/WanderWang/eui-compiler#readme", 28 | "typings": "lib/index.d.ts", 29 | "devDependencies": { 30 | "@types/ajv": "^1.0.0", 31 | "@types/mocha": "^7.0.2", 32 | "@types/node": "^11.11.3", 33 | "mocha": "^6.2.2", 34 | "mock-fs": "^4.10.2", 35 | "@types/glob": "~7.1.2" 36 | }, 37 | "dependencies": { 38 | "ajv": "^6.12.0", 39 | "ajv-i18n": "^3.5.0", 40 | "args": "^5.0.1", 41 | "egret-node-utils": "0.0.7", 42 | "escodegen": "^1.14.1", 43 | "esprima": "^4.0.1", 44 | "glob": "7.1.6", 45 | "trim-lines": "^1.1.2", 46 | "typescript": "3.9.9" 47 | } 48 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/src/emitter/declaration-emitter.ts: -------------------------------------------------------------------------------- 1 | import { BaseEmitter } from '.'; 2 | import { AST_Skin } from '../exml-ast'; 3 | 4 | export class DeclarationEmitter extends BaseEmitter { 5 | 6 | private declaration: string = ''; 7 | 8 | getResult(): string { 9 | return this.declaration; 10 | } 11 | emitHeader(themeData: any): void { 12 | 13 | } 14 | emitSkinNode(filename: string, skinNode: AST_Skin): void { 15 | const text = this.generateText(skinNode.classname, skinNode.namespace); 16 | this.declaration += text; 17 | } 18 | 19 | generateText(className: string, moduleName: string) { 20 | let text = ''; 21 | if (moduleName) { 22 | text = `declare module ${moduleName} { 23 | class ${className} extends eui.Skin { 24 | } 25 | } 26 | `; 27 | } 28 | else { 29 | text = `class ${className} extends eui.Skin { 30 | } 31 | `; 32 | } 33 | return text; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/src/emitter/host.ts: -------------------------------------------------------------------------------- 1 | export class EmitterHost { 2 | 3 | list: any[] = []; 4 | 5 | insertClassDeclaration(x: any) { 6 | this.list.push(x); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/src/emitter/index.ts: -------------------------------------------------------------------------------- 1 | import { AST_Skin } from '../exml-ast'; 2 | 3 | export abstract class BaseEmitter { 4 | 5 | abstract getResult(): string 6 | 7 | abstract emitHeader(themeData: any): void 8 | 9 | abstract emitSkinNode(filename: string, skinNode: AST_Skin): void 10 | 11 | } 12 | 13 | export * from './javascript-emitter'; 14 | export * from './declaration-emitter'; 15 | export * from './json-emitter'; -------------------------------------------------------------------------------- /toolchains/eui-compiler/src/parser/index.ts: -------------------------------------------------------------------------------- 1 | import { Lexer } from './lexer'; 2 | import { Generator } from './generator'; 3 | 4 | export function xml2js(filecontent: string, printer: Function) { 5 | const lexer = new Lexer(filecontent, printer); 6 | const tokens = lexer.analysis(); 7 | const generator = new Generator(tokens, printer); 8 | const tree = generator.generate(); 9 | return tree; 10 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/src/parser/type.ts: -------------------------------------------------------------------------------- 1 | export enum CharacterType { 2 | Delimiters, // 界符 0 3 | Identifier, // 标识符 1 4 | Word, // 字符 2 5 | Equal, // = 3 6 | }; 7 | 8 | export const CloseDelimiterMapping = { 9 | '>': '<', 10 | '>_': '': '<', 12 | '?>': '': '', 20 | '', 21 | '<_': '/>', 22 | '', 23 | '', 24 | '"': '"', 25 | '\'': '\'' 26 | }; 27 | 28 | export const AttributeDelimiter = [ 29 | '"', 30 | "'" 31 | ]; 32 | 33 | export const space = [ 34 | ' ', 35 | '\r', 36 | '\n' 37 | ]; 38 | 39 | export const Delimiters = [ 40 | '<', 41 | '', 45 | '/>', 46 | '?>', 47 | '-->', 48 | '"', 49 | '\'' 50 | ]; 51 | 52 | export const Equal = '='; 53 | 54 | export const Quotation = ['"', "'"]; -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/benchmark.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const assert = require('assert'); 3 | const lib = require('../'); 4 | const mock = require('mock-fs'); 5 | const path = require('path'); 6 | 7 | // const compiler = new lib.EuiCompiler('./test-egret-project', 'commonjs2'); 8 | // const result = compiler.emit(); 9 | // const content = result[0].content; 10 | // fs.writeFileSync("./test-egret-project/a.json", content, ''); -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/MyComponent1$Skin/expected-output-d-ts.txt: -------------------------------------------------------------------------------- 1 | declare module skins { 2 | class Test extends eui.Skin { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/MyComponent1$Skin/expected-output-json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "skins.Test": { 3 | "$sC": "$eSk", 4 | "$path": "input.exml", 5 | "$bs": { 6 | "width": 400, 7 | "$eleC": [ 8 | "_Group1" 9 | ] 10 | }, 11 | "_Group1": { 12 | "$t": "$eG", 13 | "$eleC": [ 14 | "_Button1" 15 | ] 16 | }, 17 | "_Button1": { 18 | "skinName": "skins.Test$Skin1", 19 | "$t": "$eB" 20 | } 21 | }, 22 | "skins.Test$Skin1": { 23 | "$sC": "$eSk", 24 | "$bs": { 25 | "width": 400, 26 | "height": 300, 27 | "$eleC": [ 28 | "_Button1" 29 | ] 30 | }, 31 | "_Button1": { 32 | "height": 0, 33 | "width": 0, 34 | "$t": "$eB", 35 | "label": "" 36 | }, 37 | "$b": [ 38 | { 39 | "$bd": [ 40 | "hostComponent.test" 41 | ], 42 | "$bt": "_Button1", 43 | "$bp": "label" 44 | } 45 | ] 46 | } 47 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/MyComponent1$Skin/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/animation/expected-output-d-ts.txt: -------------------------------------------------------------------------------- 1 | class TweenTestSkin extends eui.Skin { 2 | } 3 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/animation/expected-output-js.txt: -------------------------------------------------------------------------------- 1 | var TweenTestSkin = function (_super) { 2 | __extends(TweenTestSkin, _super); 3 | function TweenTestSkin() { 4 | var _this = _super.call(this) || this; 5 | _this.skinParts = ['rect']; 6 | _this.width = 400; 7 | _this.height = 300; 8 | var a2 = new tween.TweenGroup(); 9 | var a3 = new tween.TweenItem(); 10 | var a4 = new tween.Set(); 11 | var a5 = new tween.To(); 12 | a5.duration = 1250; 13 | var a6 = new eui.Object(); 14 | a5.props = a6; 15 | a3.paths = [ 16 | a4, 17 | a5 18 | ]; 19 | a2.items = [a3]; 20 | var a7 = new eui.Rect(); 21 | _this.rect = a7; 22 | a7.width = 87; 23 | a7.height = 66; 24 | a7.x = 29; 25 | a7.y = 20; 26 | a7.anchorOffsetX = 0; 27 | a7.anchorOffsetY = 0; 28 | a7.fillColor = 16711680; 29 | _this.elementsContent = [a7]; 30 | eui.Binding.$bindProperties(this, ['rect'], [0], a3, 'target'); 31 | eui.Binding.$bindProperties(this, [231], [], a6, 'x'); 32 | eui.Binding.$bindProperties(this, [155], [], a6, 'y'); 33 | return _this; 34 | } 35 | return TweenTestSkin; 36 | }(eui.Skin); -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/animation/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/button/expected-output-d-ts.txt: -------------------------------------------------------------------------------- 1 | declare module skins { 2 | class MyComponent extends eui.Skin { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/button/expected-output-js.txt: -------------------------------------------------------------------------------- 1 | skins.MyComponent = function (_super) { 2 | __extends(MyComponent, _super); 3 | function MyComponent() { 4 | var _this = _super.call(this) || this; 5 | _this.skinParts = ["labelDisplay"]; 6 | var a1 = new eui.Label(); 7 | _this.labelDisplay = a1; 8 | a1.top = 8; 9 | a1.bottom = 8; 10 | a1.left = 8; 11 | a1.right = 8; 12 | a1.size = 20; 13 | a1.textColor = 16777215; 14 | a1.verticalAlign = "middle"; 15 | a1.textAlign = "center"; 16 | _this.elementsContent = [a1]; 17 | return _this; 18 | } 19 | return MyComponent; 20 | }(eui.Skin); -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/button/expected-output-json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "skins.MyComponent": { 3 | "$path": "input.exml", 4 | "$bs": { 5 | "$eleC": [ 6 | "labelDisplay" 7 | ] 8 | }, 9 | "labelDisplay": { 10 | "bottom": 8, 11 | "left": 8, 12 | "right": 8, 13 | "size": 20, 14 | "textAlign": "center", 15 | "textColor": 16777215, 16 | "top": 8, 17 | "verticalAlign": "middle", 18 | "$t": "$eL" 19 | }, 20 | "$sP": [ 21 | "labelDisplay" 22 | ], 23 | "$sC": "$eSk" 24 | } 25 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/button/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/data-binding-and-nested-skin/expected-output-d-ts.txt: -------------------------------------------------------------------------------- 1 | declare module skins { 2 | class MyComponent1 extends eui.Skin { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/data-binding-and-nested-skin/expected-output-js.txt: -------------------------------------------------------------------------------- 1 | skins.MyComponent1 = function (_super) { 2 | __extends(MyComponent1, _super); 3 | skins.MyComponent333333 = function (_super) { 4 | __extends(MyComponent333333, _super); 5 | function MyComponent333333() { 6 | var _this = _super.call(this) || this; 7 | _this.skinParts = []; 8 | _this.width = 400; 9 | _this.height = 300; 10 | var a1 = new eui.Button(); 11 | a1.height = 0; 12 | a1.width = 0; 13 | _this.elementsContent = [a1]; 14 | eui.Binding.$bindProperties(this, ['hostComponent.test'], [0], a1, 'label'); 15 | return _this; 16 | } 17 | return MyComponent333333; 18 | }(eui.Skin); 19 | function MyComponent1() { 20 | var _this = _super.call(this) || this; 21 | _this.skinParts = []; 22 | _this.width = 400; 23 | var a1 = new eui.Group(); 24 | var a2 = new eui.Button(); 25 | a2.skinName = skins.MyComponent333333; 26 | a1.elementsContent = [a2]; 27 | _this.elementsContent = [a1]; 28 | return _this; 29 | } 30 | return MyComponent1; 31 | }(eui.Skin); -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/data-binding-and-nested-skin/expected-output-json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "skins.MyComponent1": { 3 | "$sC": "$eSk", 4 | "$path": "input.exml", 5 | "$bs": { 6 | "width": 400, 7 | "$eleC": [ 8 | "_Group1" 9 | ] 10 | }, 11 | "_Group1": { 12 | "$t": "$eG", 13 | "$eleC": [ 14 | "_Button1" 15 | ] 16 | }, 17 | "_Button1": { 18 | "skinName": "skins.MyComponent333333", 19 | "$t": "$eB" 20 | } 21 | }, 22 | "skins.MyComponent333333": { 23 | "$sC": "$eSk", 24 | "$bs": { 25 | "width": 400, 26 | "height": 300, 27 | "$eleC": [ 28 | "_Button1" 29 | ] 30 | }, 31 | "_Button1": { 32 | "height": 0, 33 | "width": 0, 34 | "$t": "$eB", 35 | "label": "" 36 | }, 37 | "$b": [ 38 | { 39 | "$bd": [ 40 | "hostComponent.test" 41 | ], 42 | "$bt": "_Button1", 43 | "$bp": "label" 44 | } 45 | ] 46 | } 47 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/data-binding-and-nested-skin/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/data-binding/expected-output-d-ts.txt: -------------------------------------------------------------------------------- 1 | declare module skins { 2 | class MyComponent1 extends eui.Skin { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/data-binding/expected-output-js.txt: -------------------------------------------------------------------------------- 1 | skins.MyComponent1 = (function (_super) { 2 | __extends(MyComponent1, _super); 3 | 4 | function MyComponent1() { 5 | var _this = _super.call(this) || this; 6 | _this.skinParts = []; 7 | _this.width = 400; 8 | _this.height = 300; 9 | var a1 = new eui.Button(); 10 | a1.height = 0; 11 | var a2 = new eui.Button(); 12 | a2.height = 0; 13 | a2.width = 0; 14 | var a3 = new eui.Button(); 15 | a3.height = 0; 16 | _this.elementsContent = [ 17 | a1, 18 | a2, 19 | a3 20 | ]; 21 | eui.Binding.$bindProperties(this, ['hostComponent.test'], [0], a1, 'label'); 22 | eui.Binding.$bindProperties(this, ['hostComponent.test'], [0], a2, 'label'); 23 | return _this; 24 | } 25 | return MyComponent1; 26 | })(eui.Skin); -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/data-binding/expected-output-json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "skins.MyComponent1": { 3 | "$path": "input.exml", 4 | "$bs": { 5 | "height": 300, 6 | "width": 400, 7 | "$eleC": [ 8 | "_Button1", 9 | "_Button2", 10 | "_Button3" 11 | ] 12 | }, 13 | "_Button1": { 14 | "height": 0, 15 | "label": "", 16 | "$t": "$eB" 17 | }, 18 | "_Button2": { 19 | "height": 0, 20 | "label": "", 21 | "width": 0, 22 | "$t": "$eB" 23 | }, 24 | "_Button3": { 25 | "height": 0, 26 | "$t": "$eB" 27 | }, 28 | "$b": [ 29 | { 30 | "$bd": [ 31 | "hostComponent.test" 32 | ], 33 | "$bt": "_Button1", 34 | "$bp": "label" 35 | }, 36 | { 37 | "$bd": [ 38 | "hostComponent.test" 39 | ], 40 | "$bt": "_Button2", 41 | "$bp": "label" 42 | } 43 | ], 44 | "$sC": "$eSk" 45 | } 46 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/data-binding/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 16 | 24 | 25 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/ignore/expected-output-d-ts.txt: -------------------------------------------------------------------------------- 1 | declare module skins { 2 | class MyComponent1 extends eui.Skin { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/ignore/expected-output-js.txt: -------------------------------------------------------------------------------- 1 | skins.MyComponent1 = (function (_super) { 2 | __extends(MyComponent1, _super); 3 | function MyComponent1() { 4 | var _this = _super.call(this) || this; 5 | _this.skinParts = []; 6 | _this.width = 400; 7 | _this.height = 300; 8 | var a1 = new eui.Group(); 9 | var a2 = new eui.Label(); 10 | a2.text = "Label"; 11 | a1.elementsContent = [a2]; 12 | _this.elementsContent = [a1]; 13 | return _this; 14 | } 15 | return MyComponent1; 16 | })(eui.Skin); -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/ignore/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/layout/expected-output-d-ts.txt: -------------------------------------------------------------------------------- 1 | declare module skins { 2 | class MyComponent extends eui.Skin { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/layout/expected-output-js.txt: -------------------------------------------------------------------------------- 1 | skins.MyComponent = function (_super) { 2 | __extends(MyComponent, _super); 3 | function MyComponent() { 4 | var _this = _super.call(this) || this; 5 | _this.skinParts = []; 6 | var a1 = new eui.Group(); 7 | var a2 = new eui.HorizontalLayout(); 8 | a2.verticalAlign = "middle"; 9 | a2.gap = 10; 10 | a2.paddingLeft = 2; 11 | a1.layout = a2; 12 | _this.elementsContent = [a1]; 13 | return _this; 14 | } 15 | return MyComponent; 16 | }(eui.Skin); -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/layout/expected-output-json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "skins.MyComponent": { 3 | "$path": "input.exml", 4 | "$bs": { 5 | "$eleC": [ 6 | "_Group1" 7 | ] 8 | }, 9 | "_Group1": { 10 | "$t": "$eG", 11 | "layout": "_HorizontalLayout1" 12 | }, 13 | "_HorizontalLayout1": { 14 | "gap": 10, 15 | "paddingLeft": 2, 16 | "verticalAlign": "middle", 17 | "$t": "$eHL" 18 | }, 19 | "$sC": "$eSk" 20 | } 21 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/layout/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/negative-number/expected-output-d-ts.txt: -------------------------------------------------------------------------------- 1 | declare module skins { 2 | class MyComponent1 extends eui.Skin { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/negative-number/expected-output-js.txt: -------------------------------------------------------------------------------- 1 | skins.MyComponent1 = function (_super) { 2 | __extends(MyComponent1, _super); 3 | function MyComponent1() { 4 | var _this = _super.call(this) || this; 5 | _this.skinParts = ["image"]; 6 | _this.width = 400; 7 | var a1 = new eui.Group(); 8 | var a2 = new eui.Image(); 9 | _this.image = a2; 10 | a2.x = -100; 11 | a2.width = 100; 12 | a2.source = "a_png"; 13 | a2.includeInLayout = true; 14 | a2.scale9Grid = new egret.Rectangle(1, 1, 1, 1); 15 | a1.elementsContent = [a2]; 16 | _this.elementsContent = [a1]; 17 | return _this; 18 | } 19 | return MyComponent1; 20 | }(eui.Skin); -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/negative-number/expected-output-json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "skins.MyComponent1": { 3 | "$path": "input.exml", 4 | "$bs": { 5 | "width": 400, 6 | "$eleC": [ 7 | "_Group1" 8 | ] 9 | }, 10 | "_Group1": { 11 | "$t": "$eG", 12 | "$eleC": [ 13 | "image" 14 | ] 15 | }, 16 | "image": { 17 | "x":-100, 18 | "includeInLayout": true, 19 | "scale9Grid": "1,1,1,1", 20 | "source": "a_png", 21 | "width": 100, 22 | "$t": "$eI" 23 | }, 24 | "$sP": [ 25 | "image" 26 | ], 27 | "$sC": "$eSk" 28 | } 29 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/negative-number/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/nested-skin/expected-output-d-ts.txt: -------------------------------------------------------------------------------- 1 | declare module skins { 2 | class MyComponent1 extends eui.Skin { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/nested-skin/expected-output-js.txt: -------------------------------------------------------------------------------- 1 | skins.MyComponent1 = function (_super) { 2 | __extends(MyComponent1, _super); 3 | skins.MyComponent1$Skin1 = function (_super) { 4 | __extends(MyComponent1$Skin1, _super); 5 | function MyComponent1$Skin1() { 6 | var _this = _super.call(this) || this; 7 | _this.skinParts = []; 8 | var a1 = new eui.Image(); 9 | _this.a1 = a1; 10 | a1.percentHeight = 100; 11 | a1.percentWidth = 100; 12 | _this.elementsContent = [a1]; 13 | _this.states = [ 14 | new eui.State('up', [new eui.SetProperty('a1', 'percentWidth', 90)]), 15 | new eui.State('down', [new eui.SetProperty('a1', 'percentWidth', 100)]) 16 | ]; 17 | return _this; 18 | } 19 | return MyComponent1$Skin1; 20 | }(eui.Skin); 21 | 22 | function MyComponent1() { 23 | var _this = _super.call(this) || this; 24 | _this.skinParts = []; 25 | _this.width = 400; 26 | var a1 = new eui.Group(); 27 | var a2 = new eui.Button(); 28 | a2.skinName = skins.MyComponent1$Skin1; 29 | a1.elementsContent = [a2]; 30 | _this.elementsContent = [a1]; 31 | return _this; 32 | } 33 | return MyComponent1; 34 | }(eui.Skin); -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/nested-skin/expected-output-json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "skins.MyComponent1": { 3 | "$path": "input.exml", 4 | "$bs": { 5 | "width": 400, 6 | "$eleC": [ 7 | "_Group1" 8 | ] 9 | }, 10 | "_Group1": { 11 | "$t": "$eG", 12 | "$eleC": [ 13 | "_Button1" 14 | ] 15 | }, 16 | "_Button1": { 17 | "$t": "$eB", 18 | "skinName": "skins.MyComponent1$Skin1" 19 | }, 20 | "$sC": "$eSk" 21 | }, 22 | "skins.MyComponent1$Skin1": { 23 | "$bs": { 24 | "$eleC": [ 25 | "_Image1" 26 | ] 27 | }, 28 | "_Image1": { 29 | "percentHeight": 100, 30 | "percentWidth": 100, 31 | "$t": "$eI" 32 | }, 33 | "$sC": "$eSk" 34 | } 35 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/nested-skin/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/scroller/expected-output-d-ts.txt: -------------------------------------------------------------------------------- 1 | declare module skins { 2 | class MyComponent2 extends eui.Skin { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/scroller/expected-output-js.txt: -------------------------------------------------------------------------------- 1 | skins.MyComponent2 = function (_super) { 2 | __extends(MyComponent2, _super); 3 | function MyComponent2() { 4 | var _this = _super.call(this) || this; 5 | _this.skinParts = []; 6 | var a1 = new eui.Scroller(); 7 | a1.width = 500; 8 | a1.height = 148; 9 | a1.anchorOffsetX = 0; 10 | a1.anchorOffsetY = 0; 11 | a1.scrollPolicyV = "false"; 12 | a1.visible = true; 13 | a1.x = 70; 14 | a1.y = 11; 15 | var a2 = new eui.List(); 16 | a2.width = 500; 17 | a2.itemRendererSkinName = "skins.GamePetItemRendererSkin"; 18 | a2.x = 70; 19 | a2.y = 0; 20 | a2.anchorOffsetY = 0; 21 | var a3 = new eui.HorizontalLayout(); 22 | a3.verticalAlign = "middle"; 23 | a3.gap = 10; 24 | a3.paddingLeft = 2; 25 | a2.layout = a3; 26 | a1.viewport = a2; 27 | _this.elementsContent = [a1]; 28 | return _this; 29 | } 30 | return MyComponent2; 31 | }(eui.Skin); -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/scroller/expected-output-json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "skins.MyComponent2": { 3 | "$path": "input.exml", 4 | "$bs": { 5 | "$eleC": [ 6 | "_Scroller1" 7 | ] 8 | }, 9 | "_Scroller1": { 10 | "anchorOffsetX": 0, 11 | "anchorOffsetY": 0, 12 | "height": 148, 13 | "scrollPolicyV": "false", 14 | "visible": true, 15 | "width": 500, 16 | "x": 70, 17 | "y": 11, 18 | "$t": "$eS", 19 | "viewport": "_List1" 20 | }, 21 | "_List1": { 22 | "anchorOffsetY": 0, 23 | "itemRendererSkinName": "skins.GamePetItemRendererSkin", 24 | "width": 500, 25 | "x": 70, 26 | "y": 0, 27 | "$t": "$eLs", 28 | "layout": "_HorizontalLayout1" 29 | }, 30 | "_HorizontalLayout1": { 31 | "gap": 10, 32 | "paddingLeft": 2, 33 | "verticalAlign": "middle", 34 | "$t": "$eHL" 35 | }, 36 | "$sC": "$eSk" 37 | } 38 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/scroller/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/simple/expected-output-d-ts.txt: -------------------------------------------------------------------------------- 1 | declare module skins { 2 | class MyComponent1 extends eui.Skin { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/simple/expected-output-js.txt: -------------------------------------------------------------------------------- 1 | skins.MyComponent1 = function (_super) { 2 | __extends(MyComponent1, _super); 3 | function MyComponent1() { 4 | var _this = _super.call(this) || this; 5 | _this.skinParts = ["image"]; 6 | _this.width = 400; 7 | var a1 = new eui.Group(); 8 | var a2 = new eui.Image(); 9 | _this.image = a2; 10 | a2.width = 100; 11 | a2.source = "a_png"; 12 | a2.includeInLayout = true; 13 | a2.scale9Grid = new egret.Rectangle(1, 1, 1, 1); 14 | a1.elementsContent = [a2]; 15 | _this.elementsContent = [a1]; 16 | return _this; 17 | } 18 | return MyComponent1; 19 | }(eui.Skin); -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/simple/expected-output-json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "skins.MyComponent1": { 3 | "$path": "input.exml", 4 | "$bs": { 5 | "width": 400, 6 | "$eleC": [ 7 | "_Group1" 8 | ] 9 | }, 10 | "_Group1": { 11 | "$t": "$eG", 12 | "$eleC": [ 13 | "image" 14 | ] 15 | }, 16 | "image": { 17 | "includeInLayout": true, 18 | "scale9Grid": "1,1,1,1", 19 | "source": "a_png", 20 | "width": 100, 21 | "$t": "$eI" 22 | }, 23 | "$sP": [ 24 | "image" 25 | ], 26 | "$sC": "$eSk" 27 | } 28 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/simple/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/skinParts/expected-output-d-ts.txt: -------------------------------------------------------------------------------- 1 | declare module skins { 2 | class ExchangeRegionSelecterSkin extends eui.Skin { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/skinParts/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/states/expected-output-d-ts.txt: -------------------------------------------------------------------------------- 1 | declare module skins { 2 | class MyComponent2 extends eui.Skin { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/states/expected-output-js.txt: -------------------------------------------------------------------------------- 1 | skins.MyComponent2 = function (_super) { 2 | __extends(MyComponent2, _super); 3 | function MyComponent2() { 4 | var _this = _super.call(this) || this; 5 | _this.skinParts = ["promptDisplay"]; 6 | _this.width = 400; 7 | var a1 = new eui.Image(); 8 | _this.a1 = a1; 9 | a1.width = 100; 10 | a1.source = "a_png"; 11 | var a2 = new eui.Label(); 12 | _this.promptDisplay = a2; 13 | _this.a2 = a2; 14 | _this.elementsContent = [ 15 | a1, 16 | a2 17 | ]; 18 | _this.states = [ 19 | new eui.State("up", []), 20 | new eui.State("down", [ 21 | new eui.SetProperty("a1", "source", "button_down_png") 22 | ]), 23 | new eui.State("disabled", [ 24 | new eui.SetProperty("a1", "alpha", 0.5), 25 | new eui.AddItems("a2", "", 1, "") 26 | ]) 27 | ]; 28 | return _this; 29 | } 30 | return MyComponent2; 31 | }(eui.Skin); -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/states/expected-output-json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "skins.MyComponent2": { 3 | "$path": "input.exml", 4 | "$bs": { 5 | "width": 400, 6 | "$eleC": [ 7 | "_Image1" 8 | ], 9 | "$sId": [ 10 | "promptDisplay" 11 | ] 12 | }, 13 | "_Image1": { 14 | "source": "a_png", 15 | "width": 100, 16 | "$t": "$eI" 17 | }, 18 | "promptDisplay": { 19 | "$t": "$eL" 20 | }, 21 | "$sP": [ 22 | "promptDisplay" 23 | ], 24 | "$s": { 25 | "up": {}, 26 | "down": { 27 | "$ssP": [ 28 | { 29 | "target": "_Image1", 30 | "name": "source", 31 | "value": "button_down_png" 32 | } 33 | ] 34 | }, 35 | "disabled": { 36 | "$ssP": [ 37 | { 38 | "target": "_Image1", 39 | "name": "alpha", 40 | "value": 0.5 41 | } 42 | ], 43 | "$saI": [ 44 | { 45 | "target": "promptDisplay", 46 | "property": "", 47 | "position": 1, 48 | "relativeTo": "" 49 | } 50 | ] 51 | } 52 | }, 53 | "$sC": "$eSk" 54 | } 55 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/states/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/top-bottom-left-right/expected-output-d-ts.txt: -------------------------------------------------------------------------------- 1 | declare module skins { 2 | class RestaurantAISkin extends eui.Skin { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/top-bottom-left-right/expected-output-js.txt: -------------------------------------------------------------------------------- 1 | skins.RestaurantAISkin = function (_super) { 2 | __extends(RestaurantAISkin, _super); 3 | function RestaurantAISkin() { 4 | var _this = _super.call(this) || this; 5 | _this.skinParts = []; 6 | var a1 = new eui.Button(); 7 | a1.top = -1; 8 | a1.bottom = -1; 9 | a1.left = -1; 10 | a1.right = -1; 11 | _this.elementsContent = [a1]; 12 | return _this; 13 | } 14 | return RestaurantAISkin; 15 | }(eui.Skin); -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/top-bottom-left-right/expected-output-json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "skins.RestaurantAISkin": { 3 | "$bs": { 4 | "$eleC": [ 5 | "_Button1" 6 | ] 7 | }, 8 | "$path": "input.exml", 9 | "$sC": "$eSk", 10 | "_Button1": { 11 | "$t": "$eB", 12 | "bottom": -1, 13 | "left": -1, 14 | "right": -1, 15 | "top": -1 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/top-bottom-left-right/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/xmlns-1/expected-output-d-ts.txt: -------------------------------------------------------------------------------- 1 | declare module skins { 2 | class RestaurantAISkin extends eui.Skin { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/xmlns-1/expected-output-js.txt: -------------------------------------------------------------------------------- 1 | skins.RestaurantAISkin = function (_super) { 2 | __extends(RestaurantAISkin, _super); 3 | function RestaurantAISkin() { 4 | var _this = _super.call(this) || this; 5 | _this.skinParts = []; 6 | _this.width = 640; 7 | _this.height = 350; 8 | var a1 = new eui.Group(); 9 | var a2 = new abc.TableYuanLiao(); 10 | a2.skinName = 'skins.TableYuanLiaoSkin'; 11 | var a3 = new TableYuanLiao(); 12 | a3.skinName = 'skins.TableYuanLiaoSkin'; 13 | a1.elementsContent = [ 14 | a2, 15 | a3 16 | ]; 17 | _this.elementsContent = [a1]; 18 | return _this; 19 | } 20 | return RestaurantAISkin; 21 | }(eui.Skin); -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/xmlns-1/expected-output-json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "skins.RestaurantAISkin": { 3 | "$sC": "$eSk", 4 | "$path": "input.exml", 5 | "$bs": { 6 | "width": 640, 7 | "height": 350, 8 | "$eleC": [ 9 | "_Group1" 10 | ] 11 | }, 12 | "_Group1": { 13 | "$t": "$eG", 14 | "$eleC": [ 15 | "_TableYuanLiao1", 16 | "_TableYuanLiao2" 17 | ] 18 | }, 19 | "_TableYuanLiao1": { 20 | "skinName": "skins.TableYuanLiaoSkin", 21 | "$t": "$eSk" 22 | }, 23 | "_TableYuanLiao2": { 24 | "skinName": "skins.TableYuanLiaoSkin", 25 | "$t": "$eSk" 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/xmlns-1/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/xmlns-2/expected-output-d-ts.txt: -------------------------------------------------------------------------------- 1 | declare module skins { 2 | class RestaurantAISkin extends eui.Skin { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/xmlns-2/expected-output-js.txt: -------------------------------------------------------------------------------- 1 | skins.RestaurantAISkin = function (_super) { 2 | __extends(RestaurantAISkin, _super); 3 | function RestaurantAISkin() { 4 | var _this = _super.call(this) || this; 5 | _this.skinParts = []; 6 | _this.width = 640; 7 | _this.height = 350; 8 | var a1 = new eui.Group(); 9 | var a2 = new abc.TableYuanLiao(); 10 | a2.skinName = 'skins.TableYuanLiaoSkin'; 11 | var a3 = new dfg.TableYuanLiao(); 12 | a3.skinName = 'skins.TableYuanLiaoSkin'; 13 | a1.elementsContent = [ 14 | a2, 15 | a3 16 | ]; 17 | _this.elementsContent = [a1]; 18 | return _this; 19 | } 20 | return RestaurantAISkin; 21 | }(eui.Skin); -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/xmlns-2/expected-output-json.txt: -------------------------------------------------------------------------------- 1 | { 2 | "skins.RestaurantAISkin": { 3 | "$sC": "$eSk", 4 | "$path": "input.exml", 5 | "$bs": { 6 | "width": 640, 7 | "height": 350, 8 | "$eleC": [ 9 | "_Group1" 10 | ] 11 | }, 12 | "_Group1": { 13 | "$t": "$eG", 14 | "$eleC": [ 15 | "_TableYuanLiao1", 16 | "_TableYuanLiao2" 17 | ] 18 | }, 19 | "_TableYuanLiao1": { 20 | "skinName": "skins.TableYuanLiaoSkin", 21 | "$t": "$eSk" 22 | }, 23 | "_TableYuanLiao2": { 24 | "skinName": "skins.TableYuanLiaoSkin", 25 | "$t": "$eSk" 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/xmlns-2/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/error/baselines/Invalid-character-in-tag-name/expect.txt: -------------------------------------------------------------------------------- 1 | Error: Invalid character in tag name 2 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/error/baselines/Invalid-characters-in-closing-tag/expect.txt: -------------------------------------------------------------------------------- 1 | Error: Invalid characters in closing tag 2 | 3 | ^ 4 | at line: 6, column: 10 5 | at file: -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/error/baselines/Invalid-characters-in-closing-tag/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/error/baselines/classname-lack/expect.txt: -------------------------------------------------------------------------------- 1 | Error: Exml Error: classname should start with `skins.`, which value is `RestaurantAISkin` 2 | 3 | ^ 4 | at line: 2, column: 16 5 | at file: -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/error/baselines/classname-lack/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/error/baselines/duplicated-attribute/expect.txt: -------------------------------------------------------------------------------- 1 | Error: `skins.GameMainSkin` has duplicated attribute: `height` 2 | height="1136" > 3 | ^ 4 | at line: 4, column: 9 5 | at file: -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/error/baselines/duplicated-attribute/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/error/baselines/malformed-comment/expect.txt: -------------------------------------------------------------------------------- 1 | Error: malformed comment 2 |