@awayfl/awayfl-player 0.2.26 → 0.2.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +1,33 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
3
  var fs = require("fs");
4
+ var path = require("path");
4
5
 
5
6
 
6
- // read in the /index.ts
7
+ // read in the ts-file at filePath
7
8
 
8
9
  // use regex to find a console log for printing the version and update it for the new version
9
10
 
10
- // update /index.ts with the new content
11
+ // update ts-file at filePath with the new content
11
12
 
12
- console.log("update src/index.ts with version:", process.env.npm_package_version);
13
+ //console.log(process.env.npm_package_version);
14
+ //console.log(process.env.INIT_CWD);
15
+ const args = process.argv.slice(2);
16
+ if (!args[0]) {
17
+ console.log("copyVersionToIndex - no path was provided")
18
+ }
19
+ let filePath = path.join(process.env.INIT_CWD, args[0]);
13
20
 
14
- fs.readFile("./index.ts", 'utf8', function(err, data) {
15
- if (err) throw err;
16
- var re = /(.*[a-zA-Z]\s\-\s)(.*)(\"\)\;.*)/;
17
- //console.log("before", data)
18
- data = data.replace(re, "$1"+process.env.npm_package_version+"$3");//#BUILD_VIA_NPM_VERSION_PATCH_TO_DISPLAY_VERSION_HERE#", process.env.npm_package_version);
19
- //console.log("after", data)
20
- fs.writeFile("./index.ts", data, function(err) {
21
- if (err) throw err;
22
- console.log("Updated ./index.ts with inserted version ", process.env.npm_package_version);
23
- });
24
- });
21
+ console.log("update ", filePath, " with version:", process.env.npm_package_version);
22
+
23
+ fs.readFile(filePath, 'utf8', function (err, data) {
24
+ if (err) throw err;
25
+ var re = /(.*[a-zA-Z0-9]\s\-\s)(.*)(\"\)\;.*)/;
26
+ //console.log("before", data)
27
+ data = data.replace(re, "$1" + process.env.npm_package_version + "$3");//#BUILD_VIA_NPM_VERSION_PATCH_TO_DISPLAY_VERSION_HERE#", process.env.npm_package_version);
28
+ //console.log("after", data)
29
+ fs.writeFile(filePath, data, function (err) {
30
+ if (err) throw err;
31
+ console.log("Updated ", filePath, " with inserted version ", process.env.npm_package_version);
32
+ });
33
+ });
package/dist/index.d.ts CHANGED
@@ -5,4 +5,5 @@ export { LoaderEvent } from "@awayjs/core";
5
5
  export { EventBase } from "@awayjs/core";
6
6
  export { StageManager } from "@awayjs/stage";
7
7
  export { Settings as AVM2Settings } from "@awayfl/avm2";
8
+ export { PlayerGlobal } from "@awayfl/playerglobal";
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AACzC,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAC,QAAQ,IAAI,YAAY,EAAC,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AACzC,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAC,QAAQ,IAAI,YAAY,EAAC,MAAM,cAAc,CAAC;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- console.debug("AwayFL - AwayFL-Player - 0.2.26");
1
+ console.debug("AwayFL-Player - 0.2.31");
2
2
  export { AVMPlayer } from "./lib/AVMPlayer";
3
3
  export { AVM1Player } from "./lib/AVM1Player";
4
4
  export { AVM2Player } from "./lib/AVM2Player";
@@ -6,3 +6,4 @@ export { LoaderEvent } from "@awayjs/core";
6
6
  export { EventBase } from "@awayjs/core";
7
7
  export { StageManager } from "@awayjs/stage";
8
8
  export { Settings as AVM2Settings } from "@awayfl/avm2";
9
+ export { PlayerGlobal } from "@awayfl/playerglobal";
@@ -1,8 +1,14 @@
1
1
  import { AVMStage } from "@awayfl/swf-loader";
2
2
  export declare class AVMDebug {
3
3
  player: AVMStage;
4
+ private _rafState;
5
+ private _defaultRaf;
6
+ private _requestedCallbacks;
4
7
  constructor(player: AVMStage);
5
8
  onAvmInit(version: number): void;
9
+ private _mokedRaf;
10
+ private _setRAFState;
11
+ private _getRAFState;
6
12
  private _selectNode;
7
13
  private _getStageCanvas;
8
14
  private _dirObjectByIds;
@@ -1 +1 @@
1
- {"version":3,"file":"AVMDebugInterface.d.ts","sourceRoot":"","sources":["../../lib/AVMDebugInterface.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAwB,MAAM,oBAAoB,CAAC;AAuBpE,qBAAa,QAAQ;IACE,MAAM,EAAE,QAAQ;gBAAhB,MAAM,EAAE,QAAQ;IA+C5B,SAAS,CAAC,OAAO,EAAE,MAAM;IAMhC,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,cAAc;IAiCtB,OAAO,CAAC,SAAS;IAqCjB,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,aAAa;IAyCxB,OAAO,CAAC,QAAQ;CAoChB"}
1
+ {"version":3,"file":"AVMDebugInterface.d.ts","sourceRoot":"","sources":["../../lib/AVMDebugInterface.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAwB,MAAM,oBAAoB,CAAC;AAuBpE,qBAAa,QAAQ;IAKD,MAAM,EAAE,QAAQ;IAJnC,OAAO,CAAC,SAAS,CAAoC;IACrD,OAAO,CAAC,WAAW,CAAmC;IACtD,OAAO,CAAC,mBAAmB,CAA+B;gBAEvC,MAAM,EAAE,QAAQ;IAmE5B,SAAS,CAAC,OAAO,EAAE,MAAM;IAMhC,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,YAAY;IAuCpB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,cAAc;IAiCtB,OAAO,CAAC,SAAS;IAqCjB,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,aAAa;IAyCrB,OAAO,CAAC,QAAQ;CAoChB"}
@@ -19,6 +19,9 @@ var OBJECT_FIELDS = ['id', 'visible', 'index', 'assetType:type', 'name'];
19
19
  var AVMDebug = /** @class */ (function () {
20
20
  function AVMDebug(player) {
21
21
  this.player = player;
22
+ this._rafState = 'play';
23
+ this._defaultRaf = self.requestAnimationFrame;
24
+ this._requestedCallbacks = [];
22
25
  registerDebugMethod(this._dirObjectByIds.bind(this), {
23
26
  name: "dirObjectByIds",
24
27
  description: "Export selected object to console",
@@ -54,6 +57,23 @@ var AVMDebug = /** @class */ (function () {
54
57
  description: "Get canvas attahed to stage",
55
58
  declaration: []
56
59
  });
60
+ registerDebugMethod(this._setRAFState.bind(this), {
61
+ name: "setRAFState",
62
+ description: "Changed RAF state",
63
+ declaration: [
64
+ { name: 'return', type: 'string' },
65
+ { name: 'state', type: 'string' }
66
+ ]
67
+ });
68
+ registerDebugMethod(this._getRAFState.bind(this), {
69
+ name: "getRAFState",
70
+ description: "Changed RAF state",
71
+ declaration: [
72
+ { name: 'return', type: 'string' },
73
+ { name: 'state', type: 'string' }
74
+ ]
75
+ });
76
+ this._mokedRaf = this._mokedRaf.bind(this);
57
77
  //@ts-ignore
58
78
  window._AWAY_DEBUG_PLAYER_ = this;
59
79
  }
@@ -61,6 +81,43 @@ var AVMDebug = /** @class */ (function () {
61
81
  //@ts-ignore
62
82
  window._AWAY_DEBUG_STORAGE = version === 1 ? SOavm1 : SOavm2;
63
83
  };
84
+ AVMDebug.prototype._mokedRaf = function (callback) {
85
+ if (this._requestedCallbacks.indexOf(callback) !== -1)
86
+ return;
87
+ this._requestedCallbacks.push(callback);
88
+ return 0;
89
+ };
90
+ AVMDebug.prototype._setRAFState = function (state) {
91
+ if (!state)
92
+ return this._rafState;
93
+ if (state === this._rafState)
94
+ return;
95
+ if (state === 'next' && this._rafState === 'stop') {
96
+ var time_1 = performance.now();
97
+ var callbacks = this._requestedCallbacks.slice();
98
+ this._rafState = 'next';
99
+ this._requestedCallbacks.length = 0;
100
+ callbacks.forEach(function (e) { return e && e(time_1); });
101
+ return this._rafState = 'stop';
102
+ }
103
+ if (state === 'stop') {
104
+ this._requestedCallbacks.length = 0;
105
+ self.requestAnimationFrame = this._mokedRaf;
106
+ return this._rafState = 'stop';
107
+ }
108
+ if (state === 'play') {
109
+ var time_2 = performance.now();
110
+ var callbacks = this._requestedCallbacks.slice();
111
+ this._rafState = 'play';
112
+ this._requestedCallbacks.length = 0;
113
+ self.requestAnimationFrame = this._defaultRaf;
114
+ callbacks.forEach(function (e) { return e && e(time_2); });
115
+ }
116
+ return this._rafState;
117
+ };
118
+ AVMDebug.prototype._getRAFState = function () {
119
+ return this._rafState;
120
+ };
64
121
  AVMDebug.prototype._selectNode = function (ids) {
65
122
  var node = this.player.root;
66
123
  var _loop_1 = function (i) {
@@ -84,7 +141,14 @@ var AVMDebug = /** @class */ (function () {
84
141
  return this.player.view.stage.container;
85
142
  };
86
143
  AVMDebug.prototype._dirObjectByIds = function (ids) {
87
- console.dir(this._selectNode(ids));
144
+ var node = this._selectNode(ids);
145
+ //@ts-ignore
146
+ var exposeID = window._lastTempNode = window._lastTempNode || 1;
147
+ //@ts-ignore
148
+ window._lastTempNode++;
149
+ window['tempNode' + exposeID] = node;
150
+ console.log('tempNode' + exposeID, '=');
151
+ console.dir(node);
88
152
  };
89
153
  AVMDebug.prototype._getNodeBounds = function (node) {
90
154
  var view = this.player.view;
@@ -93,13 +157,13 @@ var AVMDebug = /** @class */ (function () {
93
157
  if (pool) {
94
158
  //@ts-ignore
95
159
  var partition = pool.getNode(node).partition;
96
- var picker = PickGroup.getInstance(view).getBoundsPicker(partition);
160
+ var picker = PickGroup.getInstance().getBoundsPicker(partition);
97
161
  //@ts-ignore
98
- box = picker.getBoxBounds(pool.getNode(this.player.root, true, true));
162
+ box = picker.getBoxBounds(pool.getNode(this.player.root), true, true);
99
163
  }
100
164
  else {
101
165
  //@ts-ignore
102
- box = PickGroup.getInstance(view).getBoundsPicker(node.partition).getBoxBounds(this.player.root);
166
+ box = PickGroup.getInstance().getBoundsPicker(node.partition).getBoxBounds(this.player.root);
103
167
  }
104
168
  if (!box)
105
169
  return null;
@@ -1,5 +1,5 @@
1
1
  import { __extends } from "tslib";
2
- import { AVMStage, AVMEvent } from "@awayfl/swf-loader";
2
+ import { AVMStage, AVMEvent, AVMVERSION } from "@awayfl/swf-loader";
3
3
  import { AVMDebug } from "./AVMDebugInterface";
4
4
  import { AVM1Handler } from '@awayfl/avm1';
5
5
  import { AVM2Handler } from '@awayfl/avm2';
@@ -19,7 +19,7 @@ var AVMPlayer = /** @class */ (function (_super) {
19
19
  }
20
20
  AVMPlayer.prototype.onAVMAvailable = function (event) {
21
21
  if (this._debug) {
22
- this._debug.onAvmInit(event.avmVersion === "AVM1" /* AVM1 */ ? 1 : 2);
22
+ this._debug.onAvmInit(event.avmVersion === AVMVERSION.AVM1 ? 1 : 2);
23
23
  }
24
24
  };
25
25
  return AVMPlayer;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Main.d.ts","sourceRoot":"","sources":["../../src/Main.ts"],"names":[],"mappings":""}
package/index.ts CHANGED
@@ -1,6 +1,4 @@
1
-
2
-
3
- console.debug("AwayFL - AwayFL-Player - 0.2.26");
1
+ console.debug("AwayFL-Player - 0.2.31");
4
2
 
5
3
  export {AVMPlayer} from "./lib/AVMPlayer";
6
4
  export {AVM1Player} from "./lib/AVM1Player";
@@ -8,4 +6,5 @@ export {AVM2Player} from "./lib/AVM2Player";
8
6
  export {LoaderEvent} from "@awayjs/core";
9
7
  export {EventBase} from "@awayjs/core";
10
8
  export {StageManager} from "@awayjs/stage";
11
- export {Settings as AVM2Settings} from "@awayfl/avm2";
9
+ export {Settings as AVM2Settings} from "@awayfl/avm2";
10
+ export {PlayerGlobal} from "@awayfl/playerglobal";