@swf2es/web 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +43 -2
- package/dist/air-files.d.ts +40 -0
- package/dist/air-files.d.ts.map +1 -0
- package/dist/air-files.js +304 -0
- package/dist/air-files.js.map +1 -0
- package/dist/air-items.d.ts +28 -0
- package/dist/air-items.d.ts.map +1 -0
- package/dist/air-items.js +186 -0
- package/dist/air-items.js.map +1 -0
- package/dist/air.d.ts +81 -0
- package/dist/air.d.ts.map +1 -0
- package/dist/air.js +409 -0
- package/dist/air.js.map +1 -0
- package/dist/config.d.ts +123 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +127 -0
- package/dist/config.js.map +1 -0
- package/dist/element.d.ts +80 -0
- package/dist/element.d.ts.map +1 -0
- package/dist/element.js +725 -0
- package/dist/element.js.map +1 -0
- package/dist/external.d.ts +49 -0
- package/dist/external.d.ts.map +1 -0
- package/dist/external.js +268 -0
- package/dist/external.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/layout.d.ts +47 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +75 -0
- package/dist/layout.js.map +1 -0
- package/dist/playback.d.ts +107 -0
- package/dist/playback.d.ts.map +1 -0
- package/dist/playback.js +308 -0
- package/dist/playback.js.map +1 -0
- package/dist/replace.d.ts +22 -0
- package/dist/replace.d.ts.map +1 -0
- package/dist/replace.js +141 -0
- package/dist/replace.js.map +1 -0
- package/dist/stage3d.d.ts +25 -0
- package/dist/stage3d.d.ts.map +1 -0
- package/dist/stage3d.js +90 -0
- package/dist/stage3d.js.map +1 -0
- package/package.json +38 -3
- package/src/air-files.ts +371 -0
- package/src/air-items.ts +217 -0
- package/src/air.ts +497 -0
- package/src/config.ts +244 -0
- package/src/element.ts +902 -0
- package/src/external.ts +338 -0
- package/src/index.ts +33 -0
- package/src/layout.ts +127 -0
- package/src/playback.ts +388 -0
- package/src/replace.ts +166 -0
- package/src/stage3d.ts +112 -0
package/dist/air.js
ADDED
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
// An AIR application a page plays: its files held in memory, from an AIR
|
|
2
|
+
// package (`.air`), a ZIP of its folder, or the files of one the page was
|
|
3
|
+
// given. Its descriptor names the content SWF the element plays, as adl
|
|
4
|
+
// does, under AIR's API and its application sandbox. File sees the files
|
|
5
|
+
// under the application's directory, which it does not write, as an
|
|
6
|
+
// installed application's; the rest of the file system, its storage and
|
|
7
|
+
// the user's directories among them, is what it writes (air-files.ts).
|
|
8
|
+
// app:, app-storage: and file: URLs load from memory, and any other goes
|
|
9
|
+
// to the network as the page's would.
|
|
10
|
+
import { abcReferences, readAirDescriptor, readDoAbc, readZip, tags, } from "@swf2es/format";
|
|
11
|
+
import { AIR_DEFINITIONS, } from "@swf2es/player";
|
|
12
|
+
import { AirFiles } from "./air-files.js";
|
|
13
|
+
/** Where AIR's directories are on the file system File sees. */
|
|
14
|
+
const DIRECTORIES = {
|
|
15
|
+
application: "/app",
|
|
16
|
+
applicationStorage: "/app-storage",
|
|
17
|
+
user: "/user",
|
|
18
|
+
documents: "/user/Documents",
|
|
19
|
+
desktop: "/user/Desktop",
|
|
20
|
+
cache: "/cache",
|
|
21
|
+
};
|
|
22
|
+
/** AIR's directories but the application's, there before it writes, as paths from the root. */
|
|
23
|
+
export const AIR_DIRECTORIES = [
|
|
24
|
+
DIRECTORIES.applicationStorage,
|
|
25
|
+
DIRECTORIES.documents,
|
|
26
|
+
DIRECTORIES.desktop,
|
|
27
|
+
DIRECTORIES.cache,
|
|
28
|
+
].map((d) => d.slice(1));
|
|
29
|
+
/** Where an AIR package keeps its descriptor; its root is the application's directory. */
|
|
30
|
+
const PACKAGE_DESCRIPTOR = "META-INF/AIR/application.xml";
|
|
31
|
+
/** Where the application's directory and its storage are, as paths from the root. */
|
|
32
|
+
const ROOT_APP = DIRECTORIES.application.slice(1);
|
|
33
|
+
const ROOT_STORAGE = DIRECTORIES.applicationStorage.slice(1);
|
|
34
|
+
/** An AIR application opened from its files; `Swf2esPlayerElement.loadAir` plays it. */
|
|
35
|
+
export class AirApp {
|
|
36
|
+
/** The descriptor as written, which NativeApplication.applicationDescriptor gives. */
|
|
37
|
+
xml;
|
|
38
|
+
descriptor;
|
|
39
|
+
/** The application's files, by their path under its directory. */
|
|
40
|
+
#files;
|
|
41
|
+
/** Every directory the files are in, the application's own ("") among them. */
|
|
42
|
+
#directories;
|
|
43
|
+
#opened = Date.now();
|
|
44
|
+
/**
|
|
45
|
+
* Where the files not in memory are on the network, the directory a SWF
|
|
46
|
+
* played alone came from (`airAppForSwf`): an app: URL loads from there
|
|
47
|
+
* what the application does not hold, as its folder on a server is.
|
|
48
|
+
*/
|
|
49
|
+
base;
|
|
50
|
+
constructor(xml, files, base = null) {
|
|
51
|
+
this.xml = xml;
|
|
52
|
+
this.base = base;
|
|
53
|
+
this.descriptor = readAirDescriptor(xml);
|
|
54
|
+
this.#files = files;
|
|
55
|
+
this.#directories = new Set([""]);
|
|
56
|
+
for (const path of files.keys()) {
|
|
57
|
+
for (let at = path.indexOf("/"); at >= 0; at = path.indexOf("/", at + 1)) {
|
|
58
|
+
this.#directories.add(path.slice(0, at));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (!files.has(this.descriptor.content)) {
|
|
62
|
+
throw new Error(`the application has no ${this.descriptor.content}, its descriptor's content`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** The bytes of the file at `path` under the application's directory; null where none is. */
|
|
66
|
+
read(path) {
|
|
67
|
+
return this.#files.get(path)?.bytes() ?? null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The file system File sees: the application's files under its
|
|
71
|
+
* directory, which it does not write, and `files` for the rest, by
|
|
72
|
+
* default its own, in memory.
|
|
73
|
+
*/
|
|
74
|
+
fileSystem(files = new AirFiles(this.descriptor.id, AIR_DIRECTORIES, null)) {
|
|
75
|
+
// A native path's place: under the application's directory, or else in `files`; null for neither.
|
|
76
|
+
const place = (native) => {
|
|
77
|
+
const path = normalize(native);
|
|
78
|
+
if (path === null) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
const inApp = under(path, DIRECTORIES.application);
|
|
82
|
+
return inApp === null ? { files: path } : { app: inApp };
|
|
83
|
+
};
|
|
84
|
+
const writable = (native) => {
|
|
85
|
+
const at = place(native);
|
|
86
|
+
return at && "files" in at ? at.files : null;
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
separator: "/",
|
|
90
|
+
directories: DIRECTORIES,
|
|
91
|
+
stat: (native) => {
|
|
92
|
+
const at = place(native);
|
|
93
|
+
if (!at) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
return "app" in at ? this.#stat(at.app) : files.stat(at.files);
|
|
97
|
+
},
|
|
98
|
+
list: (native) => {
|
|
99
|
+
const at = place(native);
|
|
100
|
+
if (!at) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
if ("app" in at) {
|
|
104
|
+
return this.#list(at.app);
|
|
105
|
+
}
|
|
106
|
+
const names = files.list(at.files);
|
|
107
|
+
// The root holds the application's directory too.
|
|
108
|
+
return names && at.files === "" ? [...new Set([...names, ROOT_APP])].sort() : names;
|
|
109
|
+
},
|
|
110
|
+
read: (native) => {
|
|
111
|
+
const at = place(native);
|
|
112
|
+
if (!at) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
return "app" in at ? this.read(at.app) : files.read(at.files);
|
|
116
|
+
},
|
|
117
|
+
write: (native, bytes, offset, length) => {
|
|
118
|
+
const path = writable(native);
|
|
119
|
+
return path !== null && files.write(path, bytes, offset, length);
|
|
120
|
+
},
|
|
121
|
+
createDirectory: (native) => {
|
|
122
|
+
const path = writable(native);
|
|
123
|
+
return path !== null && files.createDirectory(path);
|
|
124
|
+
},
|
|
125
|
+
remove: (native) => {
|
|
126
|
+
const path = writable(native);
|
|
127
|
+
return path !== null && files.remove(path);
|
|
128
|
+
},
|
|
129
|
+
move: (from, to) => {
|
|
130
|
+
const a = writable(from);
|
|
131
|
+
const b = writable(to);
|
|
132
|
+
return a !== null && b !== null && files.move(a, b);
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* NativeApplication's view: the descriptor, `args` as the launch's
|
|
138
|
+
* arguments, and `window`, the element playing it. Its exit is `exit`.
|
|
139
|
+
*/
|
|
140
|
+
application(window, args, exit) {
|
|
141
|
+
return {
|
|
142
|
+
descriptor: this.xml,
|
|
143
|
+
id: this.descriptor.id,
|
|
144
|
+
arguments: args,
|
|
145
|
+
currentDirectory: DIRECTORIES.application,
|
|
146
|
+
window,
|
|
147
|
+
exit,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* What the application's SWFs load from it: an app: URL, or a file: URL
|
|
152
|
+
* under its directory, from memory, and an app-storage: URL or a file:
|
|
153
|
+
* URL elsewhere from `files`, if given, a missing one as a 404 is. Null
|
|
154
|
+
* for any other URL, which the page's fetch loads.
|
|
155
|
+
*/
|
|
156
|
+
fetch(request, files) {
|
|
157
|
+
const path = this.#pathOf(request.url);
|
|
158
|
+
if (path === undefined) {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
const inApp = path === null ? null : under(path, DIRECTORIES.application);
|
|
162
|
+
const bytes = path === null ? null : inApp !== null ? this.read(inApp) : (files?.read(path) ?? null);
|
|
163
|
+
return { bytes, status: bytes ? 200 : 404, headers: [] };
|
|
164
|
+
}
|
|
165
|
+
/** Where on the network `url`, an app: URL of a file not in memory, is under `base`; null for none. */
|
|
166
|
+
remote(url) {
|
|
167
|
+
const path = this.#pathOf(url);
|
|
168
|
+
const inApp = path ? under(path, DIRECTORIES.application) : null;
|
|
169
|
+
if (this.base === null || inApp === null || this.#files.has(inApp)) {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
return /^app:/i.test(url)
|
|
173
|
+
? new URL(inApp.split("/").map(encodeURIComponent).join("/"), this.base).href
|
|
174
|
+
: null;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The path `url` names on the file system File sees, "/"-separated with
|
|
178
|
+
* no leading separator; null for a local URL that names none; undefined
|
|
179
|
+
* for a URL that is not local.
|
|
180
|
+
*/
|
|
181
|
+
#pathOf(url) {
|
|
182
|
+
const m = /^(app|app-storage|file):(.*)$/i.exec(url);
|
|
183
|
+
if (!m) {
|
|
184
|
+
return undefined;
|
|
185
|
+
}
|
|
186
|
+
let rest;
|
|
187
|
+
try {
|
|
188
|
+
// A query or a fragment is no part of the file's name.
|
|
189
|
+
rest = decodeURIComponent(m[2].replace(/[?#].*$/, ""));
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
switch (m[1].toLowerCase()) {
|
|
195
|
+
case "app":
|
|
196
|
+
case "app-storage": {
|
|
197
|
+
// Never above the directory the URL starts from.
|
|
198
|
+
const path = normalize(rest);
|
|
199
|
+
const root = m[1].toLowerCase() === "app" ? ROOT_APP : ROOT_STORAGE;
|
|
200
|
+
return path === null ? null : path === "" ? root : `${root}/${path}`;
|
|
201
|
+
}
|
|
202
|
+
default:
|
|
203
|
+
return normalize(rest.replace(/^\/\/[^/]*/, ""));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/** What is at `path` under the application's directory. */
|
|
207
|
+
#stat(path) {
|
|
208
|
+
const file = this.#files.get(path);
|
|
209
|
+
if (file) {
|
|
210
|
+
return {
|
|
211
|
+
directory: false,
|
|
212
|
+
size: file.size,
|
|
213
|
+
modified: file.modified,
|
|
214
|
+
created: file.modified,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
return this.#directories.has(path) ? this.#directory() : null;
|
|
218
|
+
}
|
|
219
|
+
/** The names in the directory at `path` under the application's directory. */
|
|
220
|
+
#list(path) {
|
|
221
|
+
if (this.#stat(path)?.directory !== true) {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
const names = new Set();
|
|
225
|
+
const prefix = path === "" ? "" : `${path}/`;
|
|
226
|
+
for (const name of [...this.#files.keys(), ...this.#directories]) {
|
|
227
|
+
if (name.startsWith(prefix) && name.length > prefix.length) {
|
|
228
|
+
names.add(name.slice(prefix.length).split("/")[0]);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return [...names].sort();
|
|
232
|
+
}
|
|
233
|
+
#directory() {
|
|
234
|
+
return { directory: true, size: 0, modified: this.#opened, created: this.#opened };
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* The application in `source`: an AIR package's or a ZIP's bytes, or the
|
|
239
|
+
* files of its folder. Its descriptor is the package's, or else the
|
|
240
|
+
* shallowest `*-app.xml` or `application.xml`, whose folder is the
|
|
241
|
+
* application's directory. An Error says what it lacks.
|
|
242
|
+
*/
|
|
243
|
+
export function openAirApp(source) {
|
|
244
|
+
const opened = Date.now();
|
|
245
|
+
const all = new Map();
|
|
246
|
+
if (source instanceof Uint8Array || source instanceof ArrayBuffer) {
|
|
247
|
+
for (const entry of readZip(source instanceof Uint8Array ? source : new Uint8Array(source))) {
|
|
248
|
+
const path = normalize(entry.name);
|
|
249
|
+
if (path && !entry.name.endsWith("/")) {
|
|
250
|
+
all.set(path, entry);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
for (const file of source) {
|
|
256
|
+
const path = normalize(file.path);
|
|
257
|
+
if (path) {
|
|
258
|
+
const bytes = file.bytes;
|
|
259
|
+
all.set(path, {
|
|
260
|
+
size: bytes.length,
|
|
261
|
+
modified: file.modified ?? opened,
|
|
262
|
+
bytes: () => bytes,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
const descriptor = all.has(PACKAGE_DESCRIPTOR) ? PACKAGE_DESCRIPTOR : descriptorIn(all);
|
|
268
|
+
if (descriptor === null) {
|
|
269
|
+
throw new Error("no AIR application descriptor (META-INF/AIR/application.xml or *-app.xml)");
|
|
270
|
+
}
|
|
271
|
+
const root = descriptor === PACKAGE_DESCRIPTOR ? "" : descriptor.slice(0, descriptor.lastIndexOf("/") + 1);
|
|
272
|
+
const files = new Map();
|
|
273
|
+
for (const [path, entry] of all) {
|
|
274
|
+
if (path.startsWith(root)) {
|
|
275
|
+
files.set(path.slice(root.length), entry);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
const xml = new TextDecoder().decode(all.get(descriptor)?.bytes());
|
|
279
|
+
return new AirApp(xml, files);
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Whether `swf` is an AIR application's, though it came alone: its
|
|
283
|
+
* ActionScript names a definition only AIR has (AIR_DEFINITIONS), which a
|
|
284
|
+
* browser's Flash Player would refuse it for.
|
|
285
|
+
*/
|
|
286
|
+
export function namesAir(swf) {
|
|
287
|
+
for (const tag of swf.tags) {
|
|
288
|
+
if (tag.code === tags.DoABC || tag.code === tags.DoABC2) {
|
|
289
|
+
for (const name of abcReferences(readDoAbc(swf.bytes, tag).abc)) {
|
|
290
|
+
if (AIR_DEFINITIONS.has(name)) {
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* The AIR application of `bytes`, a SWF played alone from `url`, as adl
|
|
300
|
+
* runs one from a descriptor that names only it: its id and title from
|
|
301
|
+
* its file's name, its directory holding it alone, and the directory it
|
|
302
|
+
* came from, if from a server, where its app: URLs load what else it has.
|
|
303
|
+
*/
|
|
304
|
+
export function airAppForSwf(bytes, url) {
|
|
305
|
+
let name = "Main.swf";
|
|
306
|
+
let base = null;
|
|
307
|
+
try {
|
|
308
|
+
const at = new URL(url);
|
|
309
|
+
const last = decodeURIComponent(at.pathname.slice(at.pathname.lastIndexOf("/") + 1));
|
|
310
|
+
if (last) {
|
|
311
|
+
name = last;
|
|
312
|
+
}
|
|
313
|
+
if (at.protocol === "http:" || at.protocol === "https:") {
|
|
314
|
+
base = new URL(".", at).href;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
catch {
|
|
318
|
+
// A page's own bytes, of no URL: the defaults.
|
|
319
|
+
}
|
|
320
|
+
const stem = name.replace(/\.[^.]*$/, "") || "Main";
|
|
321
|
+
const xmlText = (text) => text.replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]);
|
|
322
|
+
const id = `swf2es.${stem.replace(/[^A-Za-z0-9.-]/g, "-")}`;
|
|
323
|
+
const xml = `<?xml version="1.0" encoding="utf-8" ?>
|
|
324
|
+
<application xmlns="http://ns.adobe.com/air/application/51.3">
|
|
325
|
+
<id>${xmlText(id)}</id>
|
|
326
|
+
<filename>${xmlText(stem)}</filename>
|
|
327
|
+
<versionNumber>1.0</versionNumber>
|
|
328
|
+
<initialWindow><content>${xmlText(name)}</content><title>${xmlText(stem)}</title></initialWindow>
|
|
329
|
+
</application>`;
|
|
330
|
+
const files = new Map([
|
|
331
|
+
[name, { size: bytes.length, modified: Date.now(), bytes: () => bytes }],
|
|
332
|
+
]);
|
|
333
|
+
return new AirApp(xml, files, base);
|
|
334
|
+
}
|
|
335
|
+
/** The shallowest `*-app.xml` or `application.xml` among `files`, outside META-INF; null for none. */
|
|
336
|
+
function descriptorIn(files) {
|
|
337
|
+
let best = null;
|
|
338
|
+
for (const path of files.keys()) {
|
|
339
|
+
const name = path.slice(path.lastIndexOf("/") + 1).toLowerCase();
|
|
340
|
+
if ((name.endsWith("-app.xml") || name === "application.xml") &&
|
|
341
|
+
!path.startsWith("META-INF/") &&
|
|
342
|
+
(best === null || depth(path) < depth(best))) {
|
|
343
|
+
best = path;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return best;
|
|
347
|
+
}
|
|
348
|
+
function depth(path) {
|
|
349
|
+
return path.split("/").length;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* `path`'s segments, "/"-joined, without its leading separator, "." and
|
|
353
|
+
* empty segments, each ".." taking the one before it; null where one
|
|
354
|
+
* climbs above the start.
|
|
355
|
+
*/
|
|
356
|
+
function normalize(path) {
|
|
357
|
+
const segments = [];
|
|
358
|
+
for (const segment of path.replaceAll("\\", "/").split("/")) {
|
|
359
|
+
if (segment === "" || segment === ".") {
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
if (segment === "..") {
|
|
363
|
+
if (segments.length === 0) {
|
|
364
|
+
return null;
|
|
365
|
+
}
|
|
366
|
+
segments.pop();
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
segments.push(segment);
|
|
370
|
+
}
|
|
371
|
+
return segments.join("/");
|
|
372
|
+
}
|
|
373
|
+
/** `path` relative to the directory `directory` ("/"-rooted) if it is in it or is it; null otherwise. */
|
|
374
|
+
function under(path, directory) {
|
|
375
|
+
const root = directory.slice(1);
|
|
376
|
+
if (path === root) {
|
|
377
|
+
return "";
|
|
378
|
+
}
|
|
379
|
+
return path.startsWith(`${root}/`) ? path.slice(root.length + 1) : null;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* The window an application sees, the element playing it: where it is on
|
|
383
|
+
* the page, the descriptor's title until the application sets another, in
|
|
384
|
+
* the normal state and shown, active while it has the focus.
|
|
385
|
+
*/
|
|
386
|
+
export function elementWindow(element, title) {
|
|
387
|
+
let current = title ?? "";
|
|
388
|
+
return {
|
|
389
|
+
bounds: () => {
|
|
390
|
+
const r = element.getBoundingClientRect();
|
|
391
|
+
return {
|
|
392
|
+
x: Math.round(r.left),
|
|
393
|
+
y: Math.round(r.top),
|
|
394
|
+
width: Math.round(r.width),
|
|
395
|
+
height: Math.round(r.height),
|
|
396
|
+
};
|
|
397
|
+
},
|
|
398
|
+
title: () => current,
|
|
399
|
+
setTitle: (value) => {
|
|
400
|
+
current = value;
|
|
401
|
+
},
|
|
402
|
+
displayState: () => "normal",
|
|
403
|
+
active: () => document.hasFocus() && document.activeElement === element,
|
|
404
|
+
activate: () => element.focus(),
|
|
405
|
+
visible: () => true,
|
|
406
|
+
stageOffset: () => ({ x: 0, y: 0 }),
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
//# sourceMappingURL=air.js.map
|
package/dist/air.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"air.js","sourceRoot":"","sources":["../src/air.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,0EAA0E;AAC1E,wEAAwE;AACxE,yEAAyE;AACzE,oEAAoE;AACpE,wEAAwE;AACxE,uEAAuE;AACvE,yEAAyE;AACzE,sCAAsC;AACtC,OAAO,EAEL,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,OAAO,EAEP,IAAI,GACL,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,GAOhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAU1C,gEAAgE;AAChE,MAAM,WAAW,GAAG;IAClB,WAAW,EAAE,MAAM;IACnB,kBAAkB,EAAE,cAAc;IAClC,IAAI,EAAE,OAAO;IACb,SAAS,EAAE,iBAAiB;IAC5B,OAAO,EAAE,eAAe;IACxB,KAAK,EAAE,QAAQ;CAChB,CAAC;AAEF,+FAA+F;AAC/F,MAAM,CAAC,MAAM,eAAe,GAAsB;IAChD,WAAW,CAAC,kBAAkB;IAC9B,WAAW,CAAC,SAAS;IACrB,WAAW,CAAC,OAAO;IACnB,WAAW,CAAC,KAAK;CAClB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzB,0FAA0F;AAC1F,MAAM,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CAAC;gBACrB,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;gBACpB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;gBAC1B,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;aAC7B,CAAC;QACJ,CAAC;QACD,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO;QACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;YAClB,OAAO,GAAG,KAAK,CAAC;QAClB,CAAC;QACD,YAAY,EAAE,GAAG,EAAE,CAAC,QAAQ;QAC5B,MAAM,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,QAAQ,CAAC,aAAa,KAAK,OAAO;QACvE,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE;QAC/B,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI;QACnB,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;KACpC,CAAC;AACJ,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { type Codegen } from "@swf2es/codegen";
|
|
2
|
+
import { type AirApplication, type EncryptedStoreHost, type FetchRequest, type FetchResult, type FileHost, type FileSystemHost, type ModuleCache, type SocketHost } from "@swf2es/player";
|
|
3
|
+
import type { WebWorkerHost } from "@swf2es/player-hosts/workers";
|
|
4
|
+
import type { Stage3DSurfaceFactory } from "./stage3d.js";
|
|
5
|
+
/** A flash.net.Socket's host and port, and the WebSocket relay that reaches it, as Ruffle's socketProxy lists them. */
|
|
6
|
+
export interface SocketProxy {
|
|
7
|
+
host: string;
|
|
8
|
+
port: number;
|
|
9
|
+
proxyUrl: string;
|
|
10
|
+
}
|
|
11
|
+
export interface Configuration {
|
|
12
|
+
/**
|
|
13
|
+
* The ABCs a SWF's ActionScript 3 links against, by URL, each in place
|
|
14
|
+
* of the one swf2es ships: avmplus' builtin.abc (builtinLibrary) and a
|
|
15
|
+
* playerglobal (playerglobalLibrary). Either left out is the shipped one.
|
|
16
|
+
*/
|
|
17
|
+
libraries?: {
|
|
18
|
+
builtin?: string;
|
|
19
|
+
playerglobal?: string;
|
|
20
|
+
};
|
|
21
|
+
/** codegen.wasm's URL: by default what the page's import map gives `@swf2es/codegen/codegen.wasm`. */
|
|
22
|
+
codegen?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Where flash.net.Socket connects: a function from the host and port it
|
|
25
|
+
* asks for to a WebSocket relay's URL, null for none, or a list. A
|
|
26
|
+
* socket with no relay fails as one refused (IOErrorEvent #2031).
|
|
27
|
+
*/
|
|
28
|
+
socketProxy?: ((host: string, port: number) => string | null) | SocketProxy[];
|
|
29
|
+
/**
|
|
30
|
+
* A host of the embedder's own for flash.net.Socket, in place of
|
|
31
|
+
* socketProxy's relays: a desktop app's, which reaches TCP itself.
|
|
32
|
+
*/
|
|
33
|
+
sockets?: SocketHost;
|
|
34
|
+
fileHost?: FileHost | null;
|
|
35
|
+
/**
|
|
36
|
+
* A fetch of the embedder's own for what the SWFs load, the SWF the
|
|
37
|
+
* element plays among it (its purpose "movie"), in place of the
|
|
38
|
+
* browser's: a desktop app's, which judges each request by Flash's
|
|
39
|
+
* sandboxes and policy files rather than CORS.
|
|
40
|
+
*/
|
|
41
|
+
fetch?: (request: FetchRequest, signal: AbortSignal) => Promise<FetchResult>;
|
|
42
|
+
/** Takes the policy files a SWF names with Security.loadPolicyFile, for such a fetch. */
|
|
43
|
+
loadPolicyFile?: (url: string) => void;
|
|
44
|
+
/** Security.sandboxType of the SWFs the element plays next: "remote" by default. */
|
|
45
|
+
sandboxType?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Whether the modules the compiler writes are kept in IndexedDB for the
|
|
48
|
+
* page's next visit, which then links them without compiling: off by
|
|
49
|
+
* default, as a first visit is some 9% slower for the writes.
|
|
50
|
+
*/
|
|
51
|
+
cache?: boolean;
|
|
52
|
+
/** Experimental AVM2 compilation on first method-factory use; off by default. */
|
|
53
|
+
lazyCompilation?: boolean;
|
|
54
|
+
/** Experimental Stage3D surface factory; absent/null keeps ErrorEvent #3702. */
|
|
55
|
+
stage3D?: Stage3DSurfaceFactory | null;
|
|
56
|
+
/**
|
|
57
|
+
* Whether flash.system.Worker runs a SWF's background workers, each on
|
|
58
|
+
* a Web Worker: on by default, as in Flash; an element's `workers`
|
|
59
|
+
* attribute decides for its own SWFs. Off, Worker.isSupported is false.
|
|
60
|
+
* A shareable ByteArray, a Mutex or a Condition crosses to another
|
|
61
|
+
* worker only on a cross-origin isolated page (docs/workers.md).
|
|
62
|
+
*/
|
|
63
|
+
workers?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* The Web Workers' script: by default @swf2es/player-hosts'
|
|
66
|
+
* dist/thread/player-hosts/web-worker.js beside the module the page
|
|
67
|
+
* loaded @swf2es/player-hosts/workers from, which resolves its imports
|
|
68
|
+
* without the page's import map. One of another origin, as a CDN's,
|
|
69
|
+
* starts through a `blob:` module that imports it.
|
|
70
|
+
*/
|
|
71
|
+
workerUrl?: string | URL;
|
|
72
|
+
/** The page's build, a short commit or a version, which the context menu's About item names. */
|
|
73
|
+
build?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Play the SWFs the element plays next as an AIR application's, as a
|
|
76
|
+
* desktop app runs one: AIR's library loaded after playerglobal, its API
|
|
77
|
+
* and its application sandbox, with the application the host runs and
|
|
78
|
+
* the file system its File reads, and where its EncryptedLocalStore
|
|
79
|
+
* keeps its items, in memory if not given. Null or absent: as Flash Player's
|
|
80
|
+
* plugin, AIR's API not defined.
|
|
81
|
+
*/
|
|
82
|
+
air?: {
|
|
83
|
+
application: AirApplication;
|
|
84
|
+
fileSystem?: FileSystemHost | null;
|
|
85
|
+
encryptedStore?: EncryptedStoreHost | null;
|
|
86
|
+
} | null;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Set the page's configuration, once, before the first player loads: what
|
|
90
|
+
* is fetched is fetched once with the configuration of then. A second call
|
|
91
|
+
* merges into the first, for a page whose parts each set their own; what
|
|
92
|
+
* was already fetched stays.
|
|
93
|
+
*/
|
|
94
|
+
export declare function configure(options: Configuration): void;
|
|
95
|
+
/** The configuration in force. */
|
|
96
|
+
export declare function configuration(): Readonly<Configuration>;
|
|
97
|
+
/**
|
|
98
|
+
* A compiler for one player. The page fetches and compiles codegen.wasm
|
|
99
|
+
* once and every player instantiates that module: a Codegen holds one
|
|
100
|
+
* player's domains, which a second player's reset would take over.
|
|
101
|
+
*/
|
|
102
|
+
export declare function codegenForPlayer(): Promise<Codegen>;
|
|
103
|
+
/**
|
|
104
|
+
* The Web Workers of one player, whose release (as the player goes) lets
|
|
105
|
+
* the page's workers started ahead go once no player uses them. `ahead`
|
|
106
|
+
* starts some ahead, for a SWF that may start a worker and wait for it at
|
|
107
|
+
* once, as Crossbridge's do; others start one when the SWF asks.
|
|
108
|
+
*/
|
|
109
|
+
export declare function workerHostForPlayer(ahead: boolean): Promise<WebWorkerHost>;
|
|
110
|
+
/** The libraries a player loads: builtin and playerglobal, and AIR's after them for an AIR application (`air`). */
|
|
111
|
+
export declare function playerLibraries(air: boolean): Promise<Uint8Array[]>;
|
|
112
|
+
/**
|
|
113
|
+
* builtin.abc and playerglobal: the shipped ones, or those configured,
|
|
114
|
+
* fetched once a page; every player reads the same bytes.
|
|
115
|
+
*/
|
|
116
|
+
export declare function libraries(): Promise<Uint8Array[]>;
|
|
117
|
+
/** flash.net.Socket's host: the embedder's, through the configured relays, or none. */
|
|
118
|
+
export declare function socketHost(): SocketHost | undefined;
|
|
119
|
+
/** What Scripting is given for `cache`: one IndexedDB module cache, shared by every player on the page. */
|
|
120
|
+
export declare function moduleCacheOptions(): {
|
|
121
|
+
moduleCache?: ModuleCache;
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=config.d.ts.map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