├── examples ├── webpack-project │ ├── .gitignore │ ├── src │ │ ├── ClasssC.ts │ │ ├── ClassA.ts │ │ ├── ClassB.ts │ │ ├── i18n │ │ │ ├── cn │ │ │ │ └── text.ts │ │ │ └── en │ │ │ │ └── text.ts │ │ └── components │ │ │ └── MyComponent.ts │ ├── resource │ │ ├── assets │ │ │ └── bg.jpg │ │ ├── skins │ │ │ └── TestSkin.exml │ │ ├── default.res.json │ │ └── default.thm.json │ ├── wingProperties.json │ ├── package.json │ ├── tsconfig.json │ ├── scripts │ │ └── dev-config.js │ └── egretProperties.json └── classic-project │ ├── .gitignore │ ├── favicon.ico │ ├── resource │ ├── assets │ │ ├── bg.jpg │ │ ├── egret_icon.png │ │ ├── Panel │ │ │ ├── border.png │ │ │ └── header.png │ │ ├── Slider │ │ │ ├── thumb.png │ │ │ ├── track.png │ │ │ └── tracklight.png │ │ ├── ToggleSwitch │ │ │ ├── on.png │ │ │ ├── off.png │ │ │ └── handle.png │ │ ├── Button │ │ │ ├── button_down.png │ │ │ └── button_up.png │ │ ├── ScrollBar │ │ │ ├── track_sb.png │ │ │ └── roundthumb.png │ │ ├── ProgressBar │ │ │ ├── thumb_pb.png │ │ │ └── track_pb.png │ │ ├── ItemRenderer │ │ │ └── selected.png │ │ ├── CheckBox │ │ │ ├── checkbox_select_up.png │ │ │ ├── checkbox_unselect.png │ │ │ ├── checkbox_select_down.png │ │ │ └── checkbox_select_disabled.png │ │ ├── RadioButton │ │ │ ├── radiobutton_select_up.png │ │ │ ├── radiobutton_unselect.png │ │ │ ├── radiobutton_select_down.png │ │ │ └── radiobutton_select_disabled.png │ │ └── texture-merger.yaml │ ├── config │ │ └── description.json │ ├── eui_skins │ │ ├── HScrollBarSkin.exml │ │ ├── VScrollBarSkin.exml │ │ ├── ScrollerSkin.exml │ │ ├── VSliderSkin.exml │ │ ├── HSliderSkin.exml │ │ ├── ProgressBarSkin.exml │ │ ├── ItemRendererSkin.exml │ │ ├── ButtonSkin.exml │ │ ├── ToggleSwitchSkin.exml │ │ ├── PanelSkin.exml │ │ ├── TextInputSkin.exml │ │ ├── CheckBoxSkin.exml │ │ └── RadioButtonSkin.exml │ └── default.thm.json │ ├── wingProperties.json │ ├── tsconfig.json │ ├── scripts │ ├── plugins │ │ ├── package.json │ │ ├── eui-compiler-plugin.ts │ │ └── webpack-plugin.ts │ └── myplugin.ts │ ├── egretProperties.json │ └── src │ └── Platform.ts ├── toolchains ├── texture-merger-core │ ├── .gitignore │ ├── CHANGELOG.md │ ├── CHANGELOG.json │ └── package.json ├── ts-minify-transformer │ ├── .gitignore │ ├── .npmignore │ ├── tests │ │ ├── emitClassName │ │ │ └── baselines │ │ │ │ ├── simple-class │ │ │ │ ├── input.ts │ │ │ │ └── expect-output.js │ │ │ │ ├── namespace │ │ │ │ ├── input.ts │ │ │ │ └── expect-output.js │ │ │ │ ├── namespace-complex │ │ │ │ ├── input.ts │ │ │ │ └── expect-output.js │ │ │ │ ├── namespace-nested │ │ │ │ ├── input.ts │ │ │ │ └── expect-output.js │ │ │ │ └── reflect │ │ │ │ ├── expect-output.js │ │ │ │ └── input.ts │ │ └── minifier │ │ │ └── baselines │ │ │ ├── simple │ │ │ ├── input.ts │ │ │ └── expect-output.js │ │ │ ├── case-1 │ │ │ ├── input.ts │ │ │ └── expect-output.js │ │ │ └── case-2 │ │ │ ├── expect-output.js │ │ │ └── input.ts │ ├── tsconfig.release.json │ ├── CHANGELOG.md │ ├── src │ │ ├── index.ts │ │ └── emitDefine.ts │ ├── CHANGELOG.json │ └── package.json ├── eui-compiler │ ├── README.md │ ├── esprima-test │ │ ├── code.js │ │ └── ast.json │ ├── .npmignore │ ├── tests │ │ ├── emitter │ │ │ └── baselines │ │ │ │ ├── animation │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── input.exml │ │ │ │ └── expected-output-js.txt │ │ │ │ ├── button │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── input.exml │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── expected-output-js.txt │ │ │ │ ├── ignore │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── input.exml │ │ │ │ └── expected-output-js.txt │ │ │ │ ├── layout │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── input.exml │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── expected-output-js.txt │ │ │ │ ├── simple │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── input.exml │ │ │ │ ├── expected-output-js.txt │ │ │ │ └── expected-output-json.txt │ │ │ │ ├── states │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── input.exml │ │ │ │ ├── expected-output-js.txt │ │ │ │ └── expected-output-json.txt │ │ │ │ ├── MyComponent1$Skin │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── input.exml │ │ │ │ └── expected-output-json.txt │ │ │ │ ├── nested-skin │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── input.exml │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── expected-output-js.txt │ │ │ │ ├── scroller │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── input.exml │ │ │ │ ├── expected-output-js.txt │ │ │ │ └── expected-output-json.txt │ │ │ │ ├── xmlns-1 │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── input.exml │ │ │ │ ├── expected-output-js.txt │ │ │ │ └── expected-output-json.txt │ │ │ │ ├── xmlns-2 │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── input.exml │ │ │ │ ├── expected-output-js.txt │ │ │ │ └── expected-output-json.txt │ │ │ │ ├── data-binding │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── expected-output-js.txt │ │ │ │ ├── input.exml │ │ │ │ └── expected-output-json.txt │ │ │ │ ├── negative-number │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── input.exml │ │ │ │ ├── expected-output-js.txt │ │ │ │ └── expected-output-json.txt │ │ │ │ ├── skinParts │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ └── input.exml │ │ │ │ ├── top-bottom-left-right │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── input.exml │ │ │ │ ├── expected-output-json.txt │ │ │ │ └── expected-output-js.txt │ │ │ │ └── data-binding-and-nested-skin │ │ │ │ ├── expected-output-d-ts.txt │ │ │ │ ├── input.exml │ │ │ │ ├── expected-output-js.txt │ │ │ │ └── expected-output-json.txt │ │ ├── error │ │ │ ├── baselines │ │ │ │ ├── tag-not-closed │ │ │ │ │ ├── expect.txt │ │ │ │ │ └── input.exml │ │ │ │ ├── unquoted-attribute-value │ │ │ │ │ ├── expect.txt │ │ │ │ │ └── input.exml │ │ │ │ ├── malformed-comment │ │ │ │ │ ├── expect.txt │ │ │ │ │ └── input.exml │ │ │ │ ├── Invalid-characters-in-closing-tag │ │ │ │ │ ├── expect.txt │ │ │ │ │ └── input.exml │ │ │ │ ├── Invalid-character-in-tag-name │ │ │ │ │ ├── expect.txt │ │ │ │ │ └── input.exml │ │ │ │ ├── text-outside-of-rootnode │ │ │ │ │ ├── input.exml │ │ │ │ │ └── expect.txt │ │ │ │ ├── duplicated-attribute │ │ │ │ │ ├── input.exml │ │ │ │ │ └── expect.txt │ │ │ │ ├── scroller-childrens │ │ │ │ │ ├── expect.txt │ │ │ │ │ └── input.exml │ │ │ │ ├── scroller-notGroup │ │ │ │ │ ├── expect.txt │ │ │ │ │ └── input.exml │ │ │ │ └── classname-lack │ │ │ │ │ ├── input.exml │ │ │ │ │ └── expect.txt │ │ │ └── index.js │ │ ├── parser │ │ │ └── lexer │ │ │ │ ├── baselines │ │ │ │ ├── simple │ │ │ │ │ └── input.exml │ │ │ │ └── layout │ │ │ │ │ └── input.exml │ │ │ │ └── index.js │ │ ├── errors │ │ │ ├── baselines │ │ │ │ ├── 1 │ │ │ │ │ ├── input.exml │ │ │ │ │ └── errors.json │ │ │ │ ├── 2 │ │ │ │ │ ├── input.exml │ │ │ │ │ └── errors.json │ │ │ │ ├── 3 │ │ │ │ │ ├── errors.json │ │ │ │ │ └── input.exml │ │ │ │ ├── 4 │ │ │ │ │ ├── input.exml │ │ │ │ │ └── errors.json │ │ │ │ ├── 5 │ │ │ │ │ ├── input.exml │ │ │ │ │ └── errors.json │ │ │ │ └── 6 │ │ │ │ │ ├── input.exml │ │ │ │ │ └── errors.json │ │ │ └── index.js │ │ ├── index.js │ │ ├── benchmark.js │ │ ├── json-validator │ │ │ └── index.js │ │ └── sort-exml │ │ │ ├── index.js │ │ │ └── case │ │ │ ├── exmls.thm.json │ │ │ └── exmls-sort.thm.json │ ├── .gitignore │ ├── examples │ │ └── tests-helloworld │ │ │ ├── favicon.ico │ │ │ ├── resource │ │ │ ├── assets │ │ │ │ ├── bg.jpg │ │ │ │ ├── egret_icon.png │ │ │ │ ├── Panel │ │ │ │ │ ├── border.png │ │ │ │ │ └── header.png │ │ │ │ ├── Slider │ │ │ │ │ ├── thumb.png │ │ │ │ │ ├── track.png │ │ │ │ │ └── tracklight.png │ │ │ │ ├── ToggleSwitch │ │ │ │ │ ├── on.png │ │ │ │ │ ├── off.png │ │ │ │ │ └── handle.png │ │ │ │ ├── Button │ │ │ │ │ ├── button_down.png │ │ │ │ │ └── button_up.png │ │ │ │ ├── ScrollBar │ │ │ │ │ ├── track_sb.png │ │ │ │ │ └── roundthumb.png │ │ │ │ ├── ProgressBar │ │ │ │ │ ├── thumb_pb.png │ │ │ │ │ └── track_pb.png │ │ │ │ ├── ItemRenderer │ │ │ │ │ └── selected.png │ │ │ │ ├── CheckBox │ │ │ │ │ ├── checkbox_select_up.png │ │ │ │ │ ├── checkbox_unselect.png │ │ │ │ │ ├── checkbox_select_down.png │ │ │ │ │ └── checkbox_select_disabled.png │ │ │ │ └── RadioButton │ │ │ │ │ ├── radiobutton_select_up.png │ │ │ │ │ ├── radiobutton_unselect.png │ │ │ │ │ ├── radiobutton_select_down.png │ │ │ │ │ └── radiobutton_select_disabled.png │ │ │ ├── config │ │ │ │ └── description.json │ │ │ └── eui_skins │ │ │ │ ├── HScrollBarSkin.exml │ │ │ │ ├── VScrollBarSkin.exml │ │ │ │ ├── ScrollerSkin.exml │ │ │ │ ├── VSliderSkin.exml │ │ │ │ ├── HSliderSkin.exml │ │ │ │ ├── ProgressBarSkin.exml │ │ │ │ ├── ItemRendererSkin.exml │ │ │ │ ├── test2.exml │ │ │ │ ├── ButtonSkin.exml │ │ │ │ ├── ToggleSwitchSkin.exml │ │ │ │ ├── test.exml │ │ │ │ ├── PanelSkin.exml │ │ │ │ ├── TextInputSkin.exml │ │ │ │ ├── CheckBoxSkin.exml │ │ │ │ └── RadioButtonSkin.exml │ │ │ ├── tsconfig.json │ │ │ ├── manifest.json │ │ │ ├── egretProperties.json │ │ │ └── src │ │ │ └── Platform.ts │ ├── src │ │ ├── emitter │ │ │ ├── host.ts │ │ │ ├── index.ts │ │ │ └── declaration-emitter.ts │ │ └── parser │ │ │ ├── index.ts │ │ │ └── type.ts │ ├── bin │ │ └── cli.js │ ├── package.json │ └── CHANGELOG.md ├── egret-webpack-bundler │ ├── .npmignore │ ├── .gitignore │ ├── test │ │ ├── simple-project │ │ │ ├── template │ │ │ │ └── web │ │ │ │ │ └── index.html │ │ │ ├── src │ │ │ │ ├── testcore │ │ │ │ │ ├── Node.ts │ │ │ │ │ └── CheckNode.ts │ │ │ │ └── Main.ts │ │ │ ├── resource │ │ │ │ ├── invalid.res.json │ │ │ │ ├── spritesheet │ │ │ │ │ ├── 1.png │ │ │ │ │ ├── x.png │ │ │ │ │ ├── rank_no1.png │ │ │ │ │ ├── rank_no2.png │ │ │ │ │ ├── rank_no3.png │ │ │ │ │ ├── texture-merger.yaml │ │ │ │ │ └── 1.json │ │ │ │ ├── error-url.res.json │ │ │ │ ├── default.res.json │ │ │ │ └── error.res.json │ │ │ ├── tsconfig.json │ │ │ └── egretProperties.json │ │ └── options.spec.ts │ ├── src │ │ ├── helper.ts │ │ ├── egretproject │ │ │ ├── api │ │ │ │ ├── installer-proxy.ts │ │ │ │ └── index.ts │ │ │ └── typings.ts │ │ ├── assets │ │ │ ├── transactions │ │ │ │ ├── CopyFileTransaction.ts │ │ │ │ └── ResourceConfigTransaction.ts │ │ │ └── Transaction.ts │ │ ├── loaders │ │ │ ├── typings.ts │ │ │ └── src-loader │ │ │ │ └── TypeScriptLegacyPlugin.ts │ │ ├── utils.ts │ │ ├── scripts-pipeline-polyfill.ts │ │ └── open.ts │ └── bin │ │ └── cli.js ├── package-bundler │ ├── bin │ │ └── cli.js │ ├── package.json │ └── src │ │ └── index.ts └── link-node-modules │ ├── bin │ └── cli.js │ ├── package.json │ ├── CHANGELOG.md │ └── src │ └── index.ts ├── packages ├── assetsmanager │ ├── test │ │ ├── static │ │ │ ├── 1.json │ │ │ ├── 1.jpg │ │ │ ├── num2.png │ │ │ ├── spritesheet.png │ │ │ ├── num2.fnt │ │ │ ├── default.res.json │ │ │ └── spritesheet.json │ │ └── server-hit-check.ts │ ├── tsconfig.release.json │ ├── src │ │ ├── store.ts │ │ ├── typings.ts │ │ └── egret.d.ts │ └── package.json ├── audio │ ├── tsconfig.release.json │ ├── src │ │ ├── AbstractAudioInstance.ts │ │ ├── index.ts │ │ ├── SimpleHTMLAudioLoader.ts │ │ ├── HTMLAudioInstance.ts │ │ ├── AudioFactory.ts │ │ └── WebAudioInstance.ts │ └── package.json ├── tween │ ├── src │ │ ├── index.ts │ │ ├── WorldClock.ts │ │ └── egret.d.ts │ ├── tsconfig.release.json │ └── package.json ├── eui │ ├── tsconfig.release.json │ ├── package.json │ └── src │ │ └── events │ │ └── ScrollerThrowEvent.ts └── egret │ ├── tsconfig.json │ ├── src │ ├── utils │ │ └── DataStructure.ts │ ├── display │ │ └── GradientType.ts │ ├── sensor │ │ └── DeviceOrientation.ts │ ├── libs │ │ └── pro-library.d.ts │ └── system │ │ └── Implementation.ts │ ├── test │ ├── index.spec.ts │ ├── index2.spec.ts │ └── Factory.ts │ └── package.json ├── common ├── config │ └── rush │ │ ├── repo-state.json │ │ ├── .npmrc │ │ ├── experiments.json │ │ └── pnpmfile.js ├── changes │ └── @egret │ │ ├── texture-merger-core │ │ └── main_2021-02-26-07-30.json │ │ └── ts-minify-transformer │ │ └── main_2021-03-10-03-31.json └── scripts │ └── install-run-rushx.js ├── .vscode └── settings.json ├── package.json ├── README.md ├── scripts ├── package.json └── index.js ├── .travis.yml ├── .gitattributes └── .gitignore /examples/webpack-project/.gitignore: -------------------------------------------------------------------------------- 1 | libs -------------------------------------------------------------------------------- /toolchains/texture-merger-core/.gitignore: -------------------------------------------------------------------------------- 1 | tests -------------------------------------------------------------------------------- /toolchains/ts-minify-transformer/.gitignore: -------------------------------------------------------------------------------- 1 | dist -------------------------------------------------------------------------------- /examples/webpack-project/src/ClasssC.ts: -------------------------------------------------------------------------------- 1 | console.log('C') -------------------------------------------------------------------------------- /toolchains/eui-compiler/README.md: -------------------------------------------------------------------------------- 1 | # @egret/eui-compiler 2 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/esprima-test/code.js: -------------------------------------------------------------------------------- 1 | this.element = [a] -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/.npmignore: -------------------------------------------------------------------------------- 1 | .rush 2 | src 3 | test -------------------------------------------------------------------------------- /toolchains/ts-minify-transformer/.npmignore: -------------------------------------------------------------------------------- 1 | .rush 2 | src 3 | test -------------------------------------------------------------------------------- /examples/classic-project/.gitignore: -------------------------------------------------------------------------------- 1 | bin-debug 2 | bin-release 3 | libs -------------------------------------------------------------------------------- /packages/assetsmanager/test/static/1.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egret" 3 | } -------------------------------------------------------------------------------- /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') -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | lib 3 | node_modules 4 | TODO 5 | *.log -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /packages/audio/tsconfig.release.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": [ 4 | "src" 5 | ] 6 | } -------------------------------------------------------------------------------- /packages/tween/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Ease'; 2 | export * from './Tween'; 3 | export * from './TweenWrapper'; 4 | -------------------------------------------------------------------------------- /toolchains/ts-minify-transformer/tests/emitClassName/baselines/simple-class/input.ts: -------------------------------------------------------------------------------- 1 | class A { 2 | 3 | 4 | } 5 | 6 | -------------------------------------------------------------------------------- /examples/classic-project/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/HEAD/examples/classic-project/favicon.ico -------------------------------------------------------------------------------- /toolchains/eui-compiler/.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | node_modules 3 | tests 4 | examples 5 | TODO 6 | tsconfig.json 7 | test-egret-project -------------------------------------------------------------------------------- /packages/assetsmanager/test/static/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/HEAD/packages/assetsmanager/test/static/1.jpg -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/emitter/baselines/animation/expected-output-d-ts.txt: -------------------------------------------------------------------------------- 1 | class TweenTestSkin extends eui.Skin { 2 | } 3 | -------------------------------------------------------------------------------- /packages/assetsmanager/test/static/num2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/HEAD/packages/assetsmanager/test/static/num2.png -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/template/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /toolchains/ts-minify-transformer/tsconfig.release.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": [ 4 | "src" 5 | ] 6 | } -------------------------------------------------------------------------------- /packages/eui/tsconfig.release.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": [ 4 | "src", 5 | "egret.d.ts" 6 | ] 7 | } -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/HEAD/examples/classic-project/resource/assets/bg.jpg -------------------------------------------------------------------------------- /examples/webpack-project/resource/assets/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/HEAD/examples/webpack-project/resource/assets/bg.jpg -------------------------------------------------------------------------------- /toolchains/package-bundler/bin/cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | const lib = require('../dist'); 3 | const command = process.argv[2]; 4 | lib.build(); -------------------------------------------------------------------------------- /toolchains/ts-minify-transformer/tests/emitClassName/baselines/namespace/input.ts: -------------------------------------------------------------------------------- 1 | namespace a { 2 | 3 | export class B { 4 | 5 | } 6 | } -------------------------------------------------------------------------------- /toolchains/ts-minify-transformer/tests/minifier/baselines/simple/input.ts: -------------------------------------------------------------------------------- 1 | class AAAAA { 2 | public aaa = 1; 3 | private bbb = 2; 4 | } 5 | -------------------------------------------------------------------------------- /packages/assetsmanager/test/static/spritesheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/HEAD/packages/assetsmanager/test/static/spritesheet.png -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/src/testcore/Node.ts: -------------------------------------------------------------------------------- 1 | namespace core { 2 | 3 | export abstract class BaseNode { 4 | 5 | } 6 | } -------------------------------------------------------------------------------- /toolchains/ts-minify-transformer/tests/emitClassName/baselines/namespace-complex/input.ts: -------------------------------------------------------------------------------- 1 | namespace a.b { 2 | 3 | export class D { 4 | 5 | } 6 | } -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/egret_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/HEAD/examples/classic-project/resource/assets/egret_icon.png -------------------------------------------------------------------------------- /toolchains/egret-webpack-bundler/test/simple-project/resource/invalid.res.json: -------------------------------------------------------------------------------- 1 | { 2 | "groups": [ 3 | { 4 | "name": "invalid-json-file", 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/error/baselines/tag-not-closed/expect.txt: -------------------------------------------------------------------------------- 1 | Error: tag not closed propertly 2 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/Button/button_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/HEAD/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/HEAD/examples/classic-project/resource/assets/Button/button_up.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/ScrollBar/track_sb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/HEAD/examples/classic-project/resource/assets/ScrollBar/track_sb.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/Slider/tracklight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/HEAD/examples/classic-project/resource/assets/Slider/tracklight.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/ToggleSwitch/off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/HEAD/examples/classic-project/resource/assets/ToggleSwitch/off.png -------------------------------------------------------------------------------- /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/examples/tests-helloworld/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/HEAD/toolchains/eui-compiler/examples/tests-helloworld/favicon.ico -------------------------------------------------------------------------------- /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/negative-number/expected-output-d-ts.txt: -------------------------------------------------------------------------------- 1 | declare module skins { 2 | class MyComponent1 extends eui.Skin { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/errors/baselines/2/input.exml: -------------------------------------------------------------------------------- 1 | sdf 2 | 4 | 5 | -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/ProgressBar/thumb_pb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/HEAD/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/HEAD/examples/classic-project/resource/assets/ProgressBar/track_pb.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/ScrollBar/roundthumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/HEAD/examples/classic-project/resource/assets/ScrollBar/roundthumb.png -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/ToggleSwitch/handle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/HEAD/examples/classic-project/resource/assets/ToggleSwitch/handle.png -------------------------------------------------------------------------------- /toolchains/ts-minify-transformer/tests/emitClassName/baselines/simple-class/expect-output.js: -------------------------------------------------------------------------------- 1 | class A { 2 | 3 | 4 | } 5 | window["A"] = A; 6 | __reflect(A.prototype, "A", []) 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /examples/classic-project/resource/assets/ItemRenderer/selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egret-labs/egret/HEAD/examples/classic-project/resource/assets/ItemRenderer/selected.png -------------------------------------------------------------------------------- /packages/tween/tsconfig.release.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "ES2015" 5 | }, 6 | "include": [ 7 | "./src" 8 | ] 9 | } -------------------------------------------------------------------------------- /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/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/error/baselines/tag-not-closed/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 3 | ^ 4 | at line: 3, column: 9 5 | at file: -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/index.js: -------------------------------------------------------------------------------- 1 | //@ts-check 2 | require('./json-validator'); 3 | require('./emitter'); 4 | require('./project'); 5 | require('./sort-exml'); 6 | require('./error'); -------------------------------------------------------------------------------- /packages/assetsmanager/tsconfig.release.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "ES2015" 5 | }, 6 | "include": [ 7 | "./src" 8 | ] 9 | } -------------------------------------------------------------------------------- /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/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/error/baselines/malformed-comment/expect.txt: -------------------------------------------------------------------------------- 1 | Error: malformed comment 2 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/eui_skins/ToggleSwitchSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 13 | 14 | -------------------------------------------------------------------------------- /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-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); -------------------------------------------------------------------------------- /examples/classic-project/resource/eui_skins/PanelSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /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/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/eui-compiler/examples/tests-helloworld/resource/eui_skins/test.exml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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); -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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/examples/tests-helloworld/resource/eui_skins/PanelSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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); -------------------------------------------------------------------------------- /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 | }); -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /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/link-node-modules/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log - @egret/link-node-modules 2 | 3 | This log was last generated on Wed, 10 Mar 2021 03:31:27 GMT and should not be manually modified. 4 | 5 | ## 1.0.6 6 | Wed, 10 Mar 2021 03:31:27 GMT 7 | 8 | ### Patches 9 | 10 | - fix issue 11 | 12 | ## 1.0.5 13 | Wed, 10 Mar 2021 03:29:24 GMT 14 | 15 | ### Patches 16 | 17 | - 修复link在有org时会报错的问题 18 | 19 | ## 1.0.4 20 | Mon, 01 Mar 2021 06:25:30 GMT 21 | 22 | ### Patches 23 | 24 | - fix issue 25 | 26 | ## 1.0.3 27 | Fri, 26 Feb 2021 10:52:45 GMT 28 | 29 | ### Patches 30 | 31 | - 添加 cmd-shim 32 | 33 | ## 1.0.2 34 | Fri, 26 Feb 2021 07:34:00 GMT 35 | 36 | ### Patches 37 | 38 | - add cli 39 | 40 | ## 1.0.1 41 | Fri, 26 Feb 2021 07:30:25 GMT 42 | 43 | ### Patches 44 | 45 | - initial commit 46 | 47 | -------------------------------------------------------------------------------- /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/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/errors/baselines/3/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/classic-project/resource/eui_skins/TextInputSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 9 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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-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/error/baselines/scroller-notGroup/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/eui_skins/TextInputSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 9 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/errors/baselines/6/errors.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "message": "Error: attribute without value\n\n ^\nat line: 2, column: 9\nat file: \n\n", 4 | "startColumn": 9, 5 | "startLine": 2, 6 | "endColumn": 10, 7 | "endLine": 2 8 | }, 9 | { 10 | "message": "Error: attribute key `a` not found in `eui.Skin`\n\n ^\nat line: 2, column: 9\nat file: \n\n", 11 | "startColumn": 9, 12 | "startLine": 2, 13 | "endColumn": 10, 14 | "endLine": 2 15 | } 16 | ] -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/error/baselines/scroller-childrens/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/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 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/errors/baselines/1/errors.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "message": "Error: Invalid character in tag name\n\n ^\nat line: 4, column: 9\nat file: \n\n", 18 | "startColumn": 9, 19 | "startLine": 4, 20 | "endColumn": 15, 21 | "endLine": 4 22 | } 23 | ] -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/errors/baselines/5/errors.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "message": "Error: Invalid character in tag name\n\n ^\nat line: 4, column: 9\nat file: \n\n", 18 | "startColumn": 9, 19 | "startLine": 4, 20 | "endColumn": 15, 21 | "endLine": 4 22 | } 23 | ] -------------------------------------------------------------------------------- /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/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/ts-minify-transformer/CHANGELOG.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@egret/ts-minify-transformer", 3 | "entries": [ 4 | { 5 | "version": "1.0.2", 6 | "tag": "@egret/ts-minify-transformer_v1.0.2", 7 | "date": "Wed, 10 Mar 2021 03:29:25 GMT", 8 | "comments": { 9 | "patch": [ 10 | { 11 | "comment": "添加 emitReflect方法并修复 Interface没有递归查找的问题" 12 | }, 13 | { 14 | "comment": "修复 emitReflect 的接口包含 namespace 时输出错误的 BUG" 15 | } 16 | ] 17 | } 18 | }, 19 | { 20 | "version": "1.0.1", 21 | "tag": "@egret/ts-minify-transformer_v1.0.1", 22 | "date": "Fri, 05 Feb 2021 03:02:34 GMT", 23 | "comments": { 24 | "patch": [ 25 | { 26 | "comment": "add emitClassName & emitDefine" 27 | } 28 | ] 29 | } 30 | } 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /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/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/ts-minify-transformer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@egret/ts-minify-transformer", 3 | "version": "1.0.2", 4 | "description": "", 5 | "main": "./dist/index.js", 6 | "typings": "./dist/index.d.ts", 7 | "dependencies": { 8 | "fs-extra-plus": "^0.5.18" 9 | }, 10 | "devDependencies": { 11 | "typescript": "3.9.9 ", 12 | "jest": "~26.6.3", 13 | "ts-jest": "~26.4.4", 14 | "@types/jest": "~26.0.19", 15 | "@types/node": "~14.14.20" 16 | }, 17 | "scripts": { 18 | "build": "tsc --p tsconfig.release.json", 19 | "watch": "tsc --p tsconfig.release.json -w", 20 | "test": "jest" 21 | }, 22 | "jest": { 23 | "moduleFileExtensions": [ 24 | "ts", 25 | "tsx", 26 | "js" 27 | ], 28 | "transform": { 29 | "\\.(ts|tsx)$": "ts-jest" 30 | }, 31 | "testRegex": "/tests/emitClassName/index.ts" 32 | }, 33 | "author": "", 34 | "license": "ISC" 35 | } 36 | -------------------------------------------------------------------------------- /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/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); -------------------------------------------------------------------------------- /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/eui_skins/CheckBoxSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/classic-project/resource/eui_skins/RadioButtonSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/examples/tests-helloworld/resource/eui_skins/CheckBoxSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /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/eui-compiler/examples/tests-helloworld/resource/eui_skins/RadioButtonSkin.exml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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/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 | } -------------------------------------------------------------------------------- /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/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); -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/errors/index.js: -------------------------------------------------------------------------------- 1 | //@ts-check 2 | const assert = require('assert'); 3 | const fs = require('fs'); 4 | const path = require('path'); 5 | const { describe, it, afterEach } = require('mocha'); 6 | const parser = require('../../lib/util/parser') 7 | const typings = require('../../lib/util/typings'); 8 | 9 | 10 | 11 | describe('parser-errors', () => { 12 | 13 | 14 | const baselineDir = path.join(__dirname, 'baselines') 15 | const dirs = fs.readdirSync(baselineDir) 16 | const cwd = process.cwd(); 17 | afterEach(function () { 18 | process.chdir(cwd); 19 | }); 20 | for (const dir of dirs) { 21 | 22 | it(`parser-errors-${dir}`, () => { 23 | process.chdir(path.join(baselineDir, dir)); 24 | const content = fs.readFileSync('input.exml', 'utf-8'); 25 | const expect = fs.readFileSync('errors.json', 'utf-8'); 26 | typings.initTypings(); 27 | const skinNode = parser.generateAST(content, ''); 28 | const err = skinNode.errors; 29 | assert.deepEqual(JSON.stringify(err, null, 4), expect); 30 | }) 31 | 32 | } 33 | 34 | }) -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/parser/lexer/index.js: -------------------------------------------------------------------------------- 1 | //@ts-check 2 | const assert = require('assert'); 3 | const fs = require('fs'); 4 | const path = require('path'); 5 | const { describe, it, afterEach } = require('mocha'); 6 | const { Lexer } = require('../../../lib/parser/lexer'); 7 | 8 | 9 | 10 | describe('parser-lexer', () => { 11 | 12 | 13 | const baselineDir = path.join(__dirname, 'baselines') 14 | const dirs = fs.readdirSync(baselineDir) 15 | const cwd = process.cwd(); 16 | afterEach(function () { 17 | process.chdir(cwd); 18 | }); 19 | for (const dir of dirs) { 20 | 21 | it(`parser-lexer-${dir}`, () => { 22 | process.chdir(path.join(baselineDir, dir)); 23 | const content = fs.readFileSync('input.exml', 'utf-8'); 24 | const lexer = new Lexer(content + '\n'); 25 | const result = lexer.analysis(); 26 | const expect = fs.readFileSync('token.json', 'utf-8'); 27 | // fs.writeFileSync('output.json',JSON.stringify(result,null,4)) 28 | assert.deepEqual(JSON.stringify(result, null, 4), expect); 29 | 30 | }) 31 | 32 | } 33 | 34 | }) -------------------------------------------------------------------------------- /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/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/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/error/index.js: -------------------------------------------------------------------------------- 1 | //@ts-check 2 | const assert = require('assert'); 3 | const fs = require('fs'); 4 | const path = require('path'); 5 | const { describe, it, afterEach } = require('mocha'); 6 | const parser = require('../../lib/util/parser') 7 | const typings = require('../../lib/util/typings'); 8 | 9 | 10 | 11 | describe('parser-error', () => { 12 | 13 | 14 | const baselineDir = path.join(__dirname, 'baselines') 15 | const dirs = fs.readdirSync(baselineDir) 16 | const cwd = process.cwd(); 17 | afterEach(function () { 18 | process.chdir(cwd); 19 | }); 20 | for (const dir of dirs) { 21 | 22 | it(`parser-error-${dir}`, () => { 23 | process.chdir(path.join(baselineDir, dir)); 24 | const content = fs.readFileSync('input.exml', 'utf-8'); 25 | const result = fs.readFileSync('expect.txt', 'utf-8'); 26 | typings.initTypings(); 27 | const skinNode = parser.generateAST(content, ''); 28 | const err = skinNode.errors.shift(); 29 | assert.deepEqual(err.message.replace(/\t/g, ' ').trim(), result.trim()); 30 | }) 31 | 32 | } 33 | 34 | }) -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/json-validator/index.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const assert = require('assert'); 3 | const lib = require('../../lib/eui-config'); 4 | const mock = require('mock-fs'); 5 | 6 | 7 | const standardEgretProperties = {"eui":{"themes":['resource/default.thm.json']}} 8 | 9 | describe('验证 egretproperties.json', () => { 10 | 11 | it('路径错误', () => { 12 | mock({ 13 | "./a/egretProperties.json":'not a json' 14 | }); 15 | assert.throws(()=>{ 16 | lib.initilize('.') 17 | },'应该抛出异常') 18 | mock.restore(); 19 | }); 20 | 21 | it('不是合法JSON文件', () => { 22 | mock({ 23 | "./egretProperties.json":'not a json' 24 | }); 25 | assert.throws(()=>{ 26 | lib.initilize('.') 27 | },'应该抛出异常') 28 | mock.restore(); 29 | }); 30 | 31 | 32 | it('路径正确', () => { 33 | mock({ 34 | "./a/egretProperties.json":JSON.stringify(standardEgretProperties) 35 | }); 36 | assert.doesNotThrow(()=>{ 37 | lib.initilize('a') 38 | },'不应抛出异常') 39 | mock.restore(); 40 | }); 41 | }) 42 | 43 | -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/sort-exml/index.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | const { describe, it, afterEach } = require('mocha'); 3 | const path = require('path'); 4 | const fs = require('fs'); 5 | const assert = require('assert'); 6 | const { ThemeFile } = require("../../lib/theme"); 7 | 8 | describe('sort-exml', () => { 9 | const caseDir = path.join(__dirname, 'case') 10 | const cwd = process.cwd(); 11 | afterEach(function () { 12 | process.chdir(cwd); 13 | }); 14 | it('sort-exml', () => { 15 | process.chdir(caseDir); 16 | const exmls = JSON.parse(fs.readFileSync('exmls.txt', 'utf-8')); 17 | const themeFile = new ThemeFile(caseDir, 'exmls.thm.json'); 18 | themeFile.sort(exmls); 19 | const targetThemeFile = new ThemeFile(caseDir, 'exmls-sort.thm.json'); 20 | const themeData = themeFile.data; 21 | const targetThemeData = targetThemeFile.data; 22 | assert.doesNotThrow(() => { 23 | for (let i = 0; i < themeData.exmls.length; i++) { 24 | if (themeData.exmls[i] !== targetThemeData.exmls[i]) { 25 | throw new Error(); 26 | } 27 | } 28 | }) 29 | }) 30 | }) -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/data-binding/input.exml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 16 | 24 | 25 | -------------------------------------------------------------------------------- /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/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/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/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 | } -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /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); -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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是当前路径,可以修改 -------------------------------------------------------------------------------- /toolchains/link-node-modules/src/index.ts: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | import * as path from 'path'; 3 | 4 | interface PKG_JSON { 5 | name: string; 6 | 7 | bin?: { 8 | [index: string]: string 9 | } 10 | } 11 | 12 | export async function linkNodeModules(packageDir: string, projectDir: string) { 13 | const pkgFilePath = path.join(packageDir, 'package.json'); 14 | const packageContent = await fs.promises.readFile(pkgFilePath, 'utf-8'); 15 | const pkgInfo = JSON.parse(packageContent) as PKG_JSON; 16 | const packageName = pkgInfo.name; 17 | const linkDir = path.join(projectDir, 'node_modules', packageName); 18 | // await fs.promises.rmdir(linkDir, { recursive: true }); 19 | if (!fs.existsSync(linkDir)) { 20 | await fs.promises.mkdir(path.resolve(linkDir, '../'), { recursive: true }); 21 | await fs.promises.symlink(packageDir, linkDir, 'junction'); 22 | }; 23 | 24 | if (pkgInfo.bin) { 25 | // eslint-disable-next-line global-require 26 | const cmdShim = require('cmd-shim'); 27 | 28 | for (const key in pkgInfo.bin) { 29 | const value = pkgInfo.bin[key]; 30 | const cliPath = path.join(packageDir, value); 31 | const cmd = path.join(projectDir, 'node_modules', '.bin', key); 32 | await cmdShim(cliPath, cmd); 33 | } 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /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/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 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/sort-exml/case/exmls.thm.json: -------------------------------------------------------------------------------- 1 | { 2 | "skins": { 3 | "eui.Button": "exmls/ButtonSkin.exml", 4 | "eui.CheckBox": "exmls/CheckBoxSkin.exml", 5 | "eui.HScrollBar": "exmls/HScrollBarSkin.exml", 6 | "eui.HSlider": "exmls/HSliderSkin.exml", 7 | "eui.Panel": "exmls/PanelSkin.exml", 8 | "eui.TextInput": "exmls/TextInputSkin.exml", 9 | "eui.ProgressBar": "exmls/ProgressBarSkin.exml", 10 | "eui.RadioButton": "exmls/RadioButtonSkin.exml", 11 | "eui.Scroller": "exmls/ScrollerSkin.exml", 12 | "eui.ToggleSwitch": "exmls/ToggleSwitchSkin.exml", 13 | "eui.VScrollBar": "exmls/VScrollBarSkin.exml", 14 | "eui.VSlider": "exmls/VSliderSkin.exml", 15 | "eui.ItemRenderer": "exmls/ItemRendererSkin.exml" 16 | }, 17 | "autoGenerateExmlsList": true, 18 | "exmls": [ 19 | "exmls/ScrollerSkin.exml", 20 | "exmls/CheckBoxSkin.exml", 21 | "exmls/HScrollBarSkin.exml", 22 | "exmls/HSliderSkin.exml", 23 | "exmls/ItemRendererSkin.exml", 24 | "exmls/PanelSkin.exml", 25 | "exmls/ProgressBarSkin.exml", 26 | "exmls/ButtonSkin.exml", 27 | "exmls/RadioButtonSkin.exml", 28 | "exmls/TextInputSkin.exml", 29 | "exmls/ToggleSwitchSkin.exml", 30 | "exmls/VScrollBarSkin.exml", 31 | "exmls/VSliderSkin.exml" 32 | ], 33 | "path": "exmls.thm.json" 34 | } -------------------------------------------------------------------------------- /toolchains/eui-compiler/tests/sort-exml/case/exmls-sort.thm.json: -------------------------------------------------------------------------------- 1 | { 2 | "skins": { 3 | "eui.Button": "exmls/ButtonSkin.exml", 4 | "eui.CheckBox": "exmls/CheckBoxSkin.exml", 5 | "eui.HScrollBar": "exmls/HScrollBarSkin.exml", 6 | "eui.HSlider": "exmls/HSliderSkin.exml", 7 | "eui.Panel": "exmls/PanelSkin.exml", 8 | "eui.TextInput": "exmls/TextInputSkin.exml", 9 | "eui.ProgressBar": "exmls/ProgressBarSkin.exml", 10 | "eui.RadioButton": "exmls/RadioButtonSkin.exml", 11 | "eui.Scroller": "exmls/ScrollerSkin.exml", 12 | "eui.ToggleSwitch": "exmls/ToggleSwitchSkin.exml", 13 | "eui.VScrollBar": "exmls/VScrollBarSkin.exml", 14 | "eui.VSlider": "exmls/VSliderSkin.exml", 15 | "eui.ItemRenderer": "exmls/ItemRendererSkin.exml" 16 | }, 17 | "autoGenerateExmlsList": true, 18 | "exmls": [ 19 | "exmls/ButtonSkin.exml", 20 | "exmls/CheckBoxSkin.exml", 21 | "exmls/HScrollBarSkin.exml", 22 | "exmls/HSliderSkin.exml", 23 | "exmls/ItemRendererSkin.exml", 24 | "exmls/PanelSkin.exml", 25 | "exmls/ProgressBarSkin.exml", 26 | "exmls/RadioButtonSkin.exml", 27 | "exmls/VScrollBarSkin.exml", 28 | "exmls/ScrollerSkin.exml", 29 | "exmls/TextInputSkin.exml", 30 | "exmls/ToggleSwitchSkin.exml", 31 | "exmls/VSliderSkin.exml" 32 | ], 33 | "path": "exmls.thm.json" 34 | } -------------------------------------------------------------------------------- /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); -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | } -------------------------------------------------------------------------------- /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/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/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 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /toolchains/package-bundler/src/index.ts: -------------------------------------------------------------------------------- 1 | import * as transformer from '@egret/ts-minify-transformer'; 2 | import * as fs from 'fs'; 3 | import * as ts from 'typescript'; 4 | 5 | export function build() { 6 | const x = ts.parseCommandLine(process.argv.slice(2)); 7 | const content = fs.readFileSync(x.options.project!, 'utf-8'); 8 | const options = ts.parseJsonConfigFileContent(JSON.parse(content), ts.sys, process.cwd()); 9 | const program = ts.createProgram(options.fileNames, options.options); 10 | const emitResult = program.emit(undefined, (filename, data) => { 11 | ts.sys.writeFile(filename, data); 12 | }, undefined, undefined, { 13 | before: [transformer.emitReflect('eui', program)], 14 | after: [] 15 | }); 16 | 17 | const allDiagnostics = ts 18 | .getPreEmitDiagnostics(program) 19 | .concat(emitResult.diagnostics); 20 | 21 | allDiagnostics.forEach((diagnostic) => { 22 | if (diagnostic.file) { 23 | const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start!); 24 | const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); 25 | console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); 26 | } else { 27 | console.log(ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n')); 28 | } 29 | }); 30 | const exitCode = emitResult.emitSkipped ? 1 : 0; 31 | console.log(`Process exiting with code '${exitCode}'.`); 32 | // eslint-disable-next-line no-process-exit 33 | process.exit(exitCode); 34 | } 35 | 36 | export function watch() { 37 | 38 | } -------------------------------------------------------------------------------- /toolchains/ts-minify-transformer/src/emitDefine.ts: -------------------------------------------------------------------------------- 1 | 2 | import * as ts from 'typescript'; 3 | 4 | 5 | 6 | /** 7 | * 添加编译的 DEFINE 参数 8 | */ 9 | type Defines = { 10 | [key: string]: string | number | boolean 11 | }; 12 | export function emitDefine(define: Defines) { 13 | 14 | return (ctx: ts.TransformationContext) => { 15 | const visitor = (node: ts.Node): ts.VisitResult => { 16 | if (node.kind === ts.SyntaxKind.Identifier) { 17 | const identifier = node as ts.Identifier; 18 | const key = identifier.text; 19 | if (define.hasOwnProperty(key)) { 20 | const value = define[identifier.text]; 21 | if (typeof value === 'string') { 22 | return ts.createStringLiteral(value); 23 | } 24 | else if (typeof value === 'number') { 25 | return ts.createNumericLiteral(value.toString()); 26 | } 27 | else if (typeof value === 'boolean') { 28 | return value ? ts.createTrue() : ts.createFalse(); 29 | } 30 | else { 31 | console.error(`非法的 Define 值 : ${identifier.text}`); 32 | return ts.visitEachChild(node, visitor, ctx); 33 | } 34 | } 35 | return ts.visitEachChild(node, visitor, ctx); 36 | } 37 | else { 38 | return ts.visitEachChild(node, visitor, ctx); 39 | } 40 | 41 | }; 42 | return (sf: any) => ts.visitNode(sf, visitor); 43 | }; 44 | 45 | } --------------------------------------------------------------------------------