xbintsc 0.5.36 → 0.5.38
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/dist/src/cli/help.d.ts +1 -1
- package/dist/src/codegen/generator/state.js +1 -0
- package/dist/src/codegen/generator/state.js.map +1 -1
- package/dist/src/codegen/generator/tables.js +1 -0
- package/dist/src/codegen/generator/tables.js.map +1 -1
- package/dist/src/driver/bundler/deferred.d.ts +63 -0
- package/dist/src/driver/bundler/deferred.js +279 -0
- package/dist/src/driver/bundler/deferred.js.map +1 -0
- package/dist/src/driver/bundler/merge.js +214 -2
- package/dist/src/driver/bundler/merge.js.map +1 -1
- package/dist/src/driver/runtime-objects.d.ts +1 -1
- package/dist/src/driver/runtime-objects.js +1 -0
- package/dist/src/driver/runtime-objects.js.map +1 -1
- package/dist/src/driver/version.d.ts +1 -1
- package/dist/src/driver/version.js +1 -1
- package/dist/src/extensions/gui/html.js +89 -13
- package/dist/src/extensions/gui/html.js.map +1 -1
- package/dist/src/extensions/gui/index.js +13 -0
- package/dist/src/extensions/gui/index.js.map +1 -1
- package/dist/src/extensions/gui/three.d.ts +4 -3
- package/dist/src/extensions/gui/three.js +4 -3
- package/dist/src/extensions/gui/three.js.map +1 -1
- package/dist/tests/e2e/gui-browser.test.js +65 -0
- package/dist/tests/e2e/gui-browser.test.js.map +1 -1
- package/dist/tests/e2e/gui-canvas-args.test.d.ts +6 -0
- package/dist/tests/e2e/gui-canvas-args.test.js +217 -0
- package/dist/tests/e2e/gui-canvas-args.test.js.map +1 -0
- package/dist/tests/e2e/gui-canvas.test.js.map +1 -1
- package/dist/tests/e2e/gui-dom.test.js +215 -0
- package/dist/tests/e2e/gui-dom.test.js.map +1 -1
- package/dist/tests/e2e/gui-events.test.js +112 -0
- package/dist/tests/e2e/gui-events.test.js.map +1 -1
- package/dist/tests/e2e/gui-script-import-order.test.d.ts +10 -0
- package/dist/tests/e2e/gui-script-import-order.test.js +161 -0
- package/dist/tests/e2e/gui-script-import-order.test.js.map +1 -0
- package/dist/tests/e2e/gui-webgl2-shadow.test.d.ts +10 -0
- package/dist/tests/e2e/gui-webgl2-shadow.test.js +108 -0
- package/dist/tests/e2e/gui-webgl2-shadow.test.js.map +1 -0
- package/dist/tests/e2e/url.test.d.ts +6 -0
- package/dist/tests/e2e/url.test.js +114 -0
- package/dist/tests/e2e/url.test.js.map +1 -0
- package/dist/tests/extensions/gui.test.js +22 -10
- package/dist/tests/extensions/gui.test.js.map +1 -1
- package/doc/gui/api.md +38 -9
- package/doc/gui/canvas.md +49 -18
- package/doc/gui/dom.md +51 -4
- package/doc/gui/webgl.md +20 -10
- package/doc/gui-scripts.md +19 -19
- package/doc/gui.md +10 -8
- package/doc/implemented/fetch.md +5 -0
- package/doc/implemented/modules.md +13 -0
- package/doc/implemented/stdlib.md +17 -0
- package/doc/unimplemented/deviations.md +1 -0
- package/doc/zh-CN/gui/api.md +33 -4
- package/doc/zh-CN/gui/canvas.md +44 -19
- package/doc/zh-CN/gui/dom.md +45 -3
- package/doc/zh-CN/gui/webgl.md +3 -3
- package/doc/zh-CN/gui-scripts.md +14 -13
- package/doc/zh-CN/gui.md +7 -6
- package/doc/zh-CN/implemented/fetch.md +4 -0
- package/doc/zh-CN/implemented/modules.md +10 -0
- package/doc/zh-CN/implemented/stdlib.md +15 -0
- package/doc/zh-CN/unimplemented/deviations.md +1 -0
- package/package.json +7 -7
- package/runtime/ext_gui/browser.cpp +34 -49
- package/runtime/ext_gui/browser_abort.cpp +249 -0
- package/runtime/ext_gui/browser_dialogs.cpp +76 -0
- package/runtime/ext_gui/browser_media.cpp +176 -0
- package/runtime/ext_gui/browser_navigation.cpp +130 -0
- package/runtime/ext_gui/canvas.cpp +88 -30
- package/runtime/ext_gui/canvas.h +74 -9
- package/runtime/ext_gui/canvas_image_data.cpp +143 -0
- package/runtime/ext_gui/canvas_internal.h +8 -5
- package/runtime/ext_gui/canvas_pattern.cpp +90 -0
- package/runtime/ext_gui/canvas_raster.cpp +31 -9
- package/runtime/ext_gui/canvas_style.cpp +4 -2
- package/runtime/ext_gui/dom.h +4 -0
- package/runtime/ext_gui/dom_api.cpp +1 -0
- package/runtime/ext_gui/dom_api_canvas.cpp +120 -114
- package/runtime/ext_gui/dom_api_canvas_extra.cpp +57 -2
- package/runtime/ext_gui/dom_api_canvas_image.cpp +239 -0
- package/runtime/ext_gui/dom_api_canvas_paths.cpp +179 -0
- package/runtime/ext_gui/dom_api_computed_style.cpp +124 -0
- package/runtime/ext_gui/dom_api_dataset.cpp +154 -0
- package/runtime/ext_gui/dom_api_document.cpp +58 -5
- package/runtime/ext_gui/dom_api_events.cpp +93 -17
- package/runtime/ext_gui/dom_api_internal.h +55 -2
- package/runtime/ext_gui/dom_api_mutation.cpp +159 -0
- package/runtime/ext_gui/dom_api_node.cpp +40 -19
- package/runtime/ext_gui/dom_api_node_read.cpp +37 -1
- package/runtime/ext_gui/dom_api_path2d.cpp +358 -0
- package/runtime/ext_gui/dom_api_proto.cpp +35 -0
- package/runtime/ext_gui/dom_api_style.cpp +223 -13
- package/runtime/ext_gui/dom_api_webgl.cpp +10 -0
- package/runtime/ext_gui/dom_api_webgl2.cpp +33 -1
- package/runtime/ext_gui/gui.cpp +59 -5
- package/runtime/ext_gui/gui_engine.h +49 -0
- package/runtime/ext_gui/gui_events.cpp +80 -9
- package/runtime/ext_gui/listener_options.h +43 -0
- package/runtime/ext_gui/paint.cpp +28 -0
- package/runtime/ext_gui/paint.h +4 -0
- package/runtime/ext_gui/script.cpp +31 -0
- package/runtime/ext_gui/webgl_glsl.h +3 -0
- package/runtime/ext_gui/webgl_glsl_unroll.cpp +283 -0
- package/runtime/ext_gui/webgl_msl.cpp +4 -0
- package/runtime/ext_gui/webgl_shader.cpp +12 -6
- package/runtime/ext_gui/window.cpp +14 -65
- package/runtime/ext_gui/window_events.cpp +125 -0
- package/runtime/rt.h +29 -0
- package/runtime/rt_internal.h +4 -0
- package/runtime/xt_builtins.c +0 -21
- package/runtime/xt_containers/access.inc +94 -2
- package/runtime/xt_containers/objects.inc +29 -31
- package/runtime/xt_fetch/async.inc +60 -0
- package/runtime/xt_url_object.c +463 -0
- package/src/codegen/generator/state.ts +1 -0
- package/src/codegen/generator/tables.ts +1 -0
- package/src/driver/bundler/deferred.ts +351 -0
- package/src/driver/bundler/merge.ts +219 -2
- package/src/driver/runtime-objects.ts +1 -0
- package/src/driver/version.ts +1 -1
- package/src/extensions/gui/html.ts +91 -15
- package/src/extensions/gui/index.ts +13 -0
- package/src/extensions/gui/three.ts +4 -3
|
@@ -98,5 +98,220 @@ describe.skipIf(!guiAvailable)("gui extension — dom", () => {
|
|
|
98
98
|
expect(value("winCompat")).toBe("win:div#inner.warm");
|
|
99
99
|
expect(value("stopped")).toBe("inner");
|
|
100
100
|
});
|
|
101
|
+
it("mutates the tree with append/prepend/replaceChildren/insertAdjacentHTML and namespaces", () => {
|
|
102
|
+
const { value } = harness.compileAndRun("dom-mutation", `
|
|
103
|
+
import { createWindow, run } from "gui";
|
|
104
|
+
|
|
105
|
+
const HTML = \`
|
|
106
|
+
<html><body style="margin:0">
|
|
107
|
+
<div id="host"></div>
|
|
108
|
+
</body></html>\`;
|
|
109
|
+
|
|
110
|
+
const SVG_NS = "http://www.w3.org/2000/svg";
|
|
111
|
+
const win = createWindow({ title: "dom-mutation", width: 400, height: 300 });
|
|
112
|
+
win.on("ready", () => {
|
|
113
|
+
const doc = win.document;
|
|
114
|
+
const host: any = doc.getElementById("host");
|
|
115
|
+
|
|
116
|
+
// append/prepend mix nodes and strings, like the DOM.
|
|
117
|
+
host.append("a", doc.createElement("b"));
|
|
118
|
+
console.log("append=" + host.textContent + ":" + host.children.length + ":" +
|
|
119
|
+
host.lastElementChild.tagName);
|
|
120
|
+
host.prepend("z", doc.createElement("i"));
|
|
121
|
+
console.log("prepend=" + host.textContent + ":" + host.firstElementChild.tagName);
|
|
122
|
+
|
|
123
|
+
// insertAdjacentHTML at all four positions.
|
|
124
|
+
host.insertAdjacentHTML("beforebegin", "<p id='pre'>pre</p>");
|
|
125
|
+
host.insertAdjacentHTML("afterbegin", "<b>head</b>");
|
|
126
|
+
host.insertAdjacentHTML("beforeend", "<u>tail</u>");
|
|
127
|
+
host.insertAdjacentHTML("afterend", "<p id='post'>post</p>");
|
|
128
|
+
console.log("adjacent=" + doc.getElementById("pre").textContent + ":" +
|
|
129
|
+
doc.getElementById("post").textContent + ":" +
|
|
130
|
+
host.firstElementChild.tagName + ":" + host.lastElementChild.tagName);
|
|
131
|
+
|
|
132
|
+
// replaceChildren keeps a node argument that used to be a child.
|
|
133
|
+
const keep: any = doc.createElement("em");
|
|
134
|
+
keep.textContent = "keep";
|
|
135
|
+
host.append(keep);
|
|
136
|
+
host.replaceChildren("t", keep);
|
|
137
|
+
console.log("replace=" + host.textContent + ":" + host.children.length + ":" +
|
|
138
|
+
host.firstElementChild.tagName);
|
|
139
|
+
|
|
140
|
+
// createElementNS records the namespace and preserves SVG's case.
|
|
141
|
+
const gradient: any = doc.createElementNS(SVG_NS, "svg:linearGradient");
|
|
142
|
+
console.log("ns=" + gradient.namespaceURI + ":" + gradient.localName + ":" +
|
|
143
|
+
gradient.prefix + ":" + gradient.tagName);
|
|
144
|
+
const rect: any = doc.createElementNS(SVG_NS, "rect");
|
|
145
|
+
console.log("svg-case=" + rect.tagName + ":" + rect.localName + ":" + rect.prefix);
|
|
146
|
+
const html: any = doc.createElementNS("http://www.w3.org/1999/xhtml", "DIV");
|
|
147
|
+
console.log("html-ns=" + html.localName + ":" + html.namespaceURI + ":" + html.tagName);
|
|
148
|
+
win.close();
|
|
149
|
+
});
|
|
150
|
+
win.loadHTML(HTML);
|
|
151
|
+
run();
|
|
152
|
+
`);
|
|
153
|
+
expect(value("append")).toBe("a:1:B");
|
|
154
|
+
expect(value("prepend")).toBe("za:I");
|
|
155
|
+
expect(value("adjacent")).toBe("pre:post:B:U");
|
|
156
|
+
expect(value("replace")).toBe("tkeep:1:EM");
|
|
157
|
+
expect(value("ns")).toBe("http://www.w3.org/2000/svg:linearGradient:svg:linearGradient");
|
|
158
|
+
expect(value("svg-case")).toBe("rect:rect:null");
|
|
159
|
+
expect(value("html-ns")).toBe("div:http://www.w3.org/1999/xhtml:DIV");
|
|
160
|
+
});
|
|
161
|
+
it("honours the style object, computed style and geometry arguments", () => {
|
|
162
|
+
const { value } = harness.compileAndRun("dom-style-args", `
|
|
163
|
+
import { createWindow, run } from "gui";
|
|
164
|
+
|
|
165
|
+
const HTML = \`
|
|
166
|
+
<html><head><style>
|
|
167
|
+
body { margin: 0; }
|
|
168
|
+
#box { width: 100px; height: 40px; margin-top: 10px; }
|
|
169
|
+
#box::before { content: "hi"; color: #123456; }
|
|
170
|
+
</style></head><body>
|
|
171
|
+
<div id="box">x</div>
|
|
172
|
+
</body></html>\`;
|
|
173
|
+
|
|
174
|
+
const win = createWindow({ title: "dom-style-args", width: 400, height: 300 });
|
|
175
|
+
win.on("ready", () => {
|
|
176
|
+
const doc = win.document;
|
|
177
|
+
const box: any = doc.getElementById("box");
|
|
178
|
+
const cl = box.classList;
|
|
179
|
+
|
|
180
|
+
// toggle(name, force) is idempotent; toggle(name) still flips.
|
|
181
|
+
console.log("t1=" + cl.toggle("on", true) + ":" + box.className);
|
|
182
|
+
console.log("t2=" + cl.toggle("on", true) + ":" + box.className);
|
|
183
|
+
console.log("t3=" + cl.toggle("on", false) + ":" + box.className);
|
|
184
|
+
console.log("t4=" + cl.toggle("on", false) + ":" + box.className);
|
|
185
|
+
console.log("t5=" + cl.toggle("on") + ":" + box.className);
|
|
186
|
+
|
|
187
|
+
box.style.setProperty("color", "#ff0000", "important");
|
|
188
|
+
console.log("p1=" + box.style.getPropertyValue("color") + ":" + box.style.getPropertyPriority("color"));
|
|
189
|
+
box.style.setProperty("color", "#0000ff");
|
|
190
|
+
console.log("p2=" + box.style.getPropertyPriority("color") + ":" + getComputedStyle(box).getPropertyValue("color"));
|
|
191
|
+
// An invalid priority makes the call a no-op, as in the CSSOM.
|
|
192
|
+
box.style.setProperty("color", "#00ff00", "urgent");
|
|
193
|
+
console.log("p3=" + box.style.getPropertyValue("color"));
|
|
194
|
+
console.log("rm=" + box.style.removeProperty("color") + ":" + box.style.getPropertyValue("color"));
|
|
195
|
+
|
|
196
|
+
box.style.cssText = "background-color: #010203; width: 55px";
|
|
197
|
+
console.log("ct=" + box.style.getPropertyValue("width") + ":" + box.style.getPropertyValue("background-color"));
|
|
198
|
+
|
|
199
|
+
const cs: any = getComputedStyle(box);
|
|
200
|
+
console.log("cs=" + cs.getPropertyValue("display") + ":" + cs.getPropertyValue("width") +
|
|
201
|
+
":" + cs.getPropertyPriority("width") + ":" + cs.getPropertyValue("margin-top"));
|
|
202
|
+
const before: any = getComputedStyle(box, "::before");
|
|
203
|
+
console.log("before=" + before.getPropertyValue("content") + ":" + before.getPropertyValue("color"));
|
|
204
|
+
console.log("unsupported-pseudo=" + getComputedStyle(box, "::marker").getPropertyValue("color"));
|
|
205
|
+
|
|
206
|
+
doc.title = "changed";
|
|
207
|
+
console.log("title=" + doc.title);
|
|
208
|
+
|
|
209
|
+
const rect: any = box.getBoundingClientRect();
|
|
210
|
+
console.log("rect=" + rect.x + "," + rect.y + "," + rect.top + "," + rect.right + "," +
|
|
211
|
+
rect.bottom + "," + rect.left + "," + rect.width);
|
|
212
|
+
win.close();
|
|
213
|
+
});
|
|
214
|
+
win.loadHTML(HTML);
|
|
215
|
+
run();
|
|
216
|
+
`);
|
|
217
|
+
expect(value("t1")).toBe("true:on");
|
|
218
|
+
expect(value("t2")).toBe("true:on");
|
|
219
|
+
expect(value("t3")).toBe("false:");
|
|
220
|
+
expect(value("t4")).toBe("false:");
|
|
221
|
+
expect(value("t5")).toBe("true:on");
|
|
222
|
+
expect(value("p1")).toBe("#ff0000:important");
|
|
223
|
+
expect(value("p2")).toBe(":rgb(0, 0, 255)");
|
|
224
|
+
expect(value("p3")).toBe("#0000ff");
|
|
225
|
+
expect(value("rm")).toBe("#0000ff:");
|
|
226
|
+
expect(value("ct")).toBe("55px:#010203");
|
|
227
|
+
expect(value("cs")).toBe("block:55px::10px");
|
|
228
|
+
expect(value("before")).toBe('"hi":rgb(18, 52, 86)');
|
|
229
|
+
expect(value("unsupported-pseudo")).toBe("");
|
|
230
|
+
expect(value("title")).toBe("changed");
|
|
231
|
+
expect(value("rect")).toBe("0,10,10,55,50,0,55");
|
|
232
|
+
});
|
|
233
|
+
it("writes style and dataset properties through named access", () => {
|
|
234
|
+
const { value } = harness.compileAndRun("dom-properties", `
|
|
235
|
+
import { createWindow, run } from "gui";
|
|
236
|
+
|
|
237
|
+
const HTML = \`
|
|
238
|
+
<html><head><style>
|
|
239
|
+
body { margin: 0; }
|
|
240
|
+
#box { width: 100px; height: 40px; margin-top: 10px; }
|
|
241
|
+
#box::before { content: "hi"; color: #123456; }
|
|
242
|
+
</style></head><body>
|
|
243
|
+
<div id="box" data-role="lead" data-user-id="7">x</div>
|
|
244
|
+
</body></html>\`;
|
|
245
|
+
|
|
246
|
+
const win = createWindow({ title: "dom-properties", width: 400, height: 300 });
|
|
247
|
+
win.on("ready", () => {
|
|
248
|
+
const doc = win.document;
|
|
249
|
+
const box: any = doc.getElementById("box");
|
|
250
|
+
|
|
251
|
+
// Property assignment used to park a dead field on the JS object.
|
|
252
|
+
box.style.width = "50%";
|
|
253
|
+
box.style.height = "30px";
|
|
254
|
+
console.log("width=" + box.style.width + ":" + win.computedStyle("#box", "width"));
|
|
255
|
+
console.log("rect=" + box.getBoundingClientRect().width + "x" + box.getBoundingClientRect().height);
|
|
256
|
+
box.style.backgroundColor = "#ff0000";
|
|
257
|
+
console.log("bg=" + box.style.backgroundColor + ":" + win.computedStyle("#box", "background-color"));
|
|
258
|
+
box.style.display = "none";
|
|
259
|
+
console.log("hidden=" + win.computedStyle("#box", "display"));
|
|
260
|
+
box.style.display = "";
|
|
261
|
+
console.log("shown=" + win.computedStyle("#box", "display"));
|
|
262
|
+
box.style.zIndex = "5";
|
|
263
|
+
console.log("z=" + win.computedStyle("#box", "z-index"));
|
|
264
|
+
|
|
265
|
+
// setProperty and named access address the same declaration block.
|
|
266
|
+
box.style.setProperty("color", "#00ff00");
|
|
267
|
+
console.log("color=" + box.style.color + ":" + box.style.getPropertyValue("color") +
|
|
268
|
+
":" + win.computedStyle("#box", "color"));
|
|
269
|
+
box.style.setProperty("--accent", "#abcdef");
|
|
270
|
+
console.log("custom=" + box.style.getPropertyValue("--accent") + ":" + box.style["--accent"]);
|
|
271
|
+
console.log("decl=" + box.style.length + ":" + box.style.item(0) + ":" + box.style.item(5));
|
|
272
|
+
box.style.removeProperty("z-index");
|
|
273
|
+
console.log("removed=" + ("zIndex" in box.style) + ":" + box.style.zIndex);
|
|
274
|
+
|
|
275
|
+
// dataset maps camelCase keys to data-* attributes, both ways.
|
|
276
|
+
console.log("dataset=" + box.dataset.role + ":" + box.dataset.userId);
|
|
277
|
+
box.dataset.count = "3";
|
|
278
|
+
console.log("data-set=" + box.getAttribute("data-count") + ":" + ("count" in box.dataset) +
|
|
279
|
+
":" + box.dataset.hasOwnProperty("count"));
|
|
280
|
+
box.dataset.role = "hero";
|
|
281
|
+
console.log("data-write=" + box.getAttribute("data-role"));
|
|
282
|
+
delete box.dataset.count;
|
|
283
|
+
console.log("data-delete=" + box.hasAttribute("data-count") + ":" + (box.dataset.count === undefined));
|
|
284
|
+
console.log("data-keys=" + Object.keys(box.dataset).join(","));
|
|
285
|
+
|
|
286
|
+
// getComputedStyle answers named properties from the cascade too.
|
|
287
|
+
const cs: any = getComputedStyle(box);
|
|
288
|
+
console.log("cs=" + cs.width + ":" + cs.height + ":" + cs.backgroundColor + ":" +
|
|
289
|
+
cs.marginTop + ":" + cs.getPropertyValue("background-color") +
|
|
290
|
+
":" + cs.getPropertyValue("--accent"));
|
|
291
|
+
const before: any = getComputedStyle(box, "::before");
|
|
292
|
+
console.log("before=" + before.content + ":" + before.color);
|
|
293
|
+
win.close();
|
|
294
|
+
});
|
|
295
|
+
win.loadHTML(HTML);
|
|
296
|
+
run();
|
|
297
|
+
`);
|
|
298
|
+
expect(value("width")).toBe("50%:50%");
|
|
299
|
+
expect(value("rect")).toBe("200x30");
|
|
300
|
+
expect(value("bg")).toBe("#ff0000:rgb(255, 0, 0)");
|
|
301
|
+
expect(value("hidden")).toBe("none");
|
|
302
|
+
expect(value("shown")).toBe("block");
|
|
303
|
+
expect(value("z")).toBe("5");
|
|
304
|
+
expect(value("color")).toBe("#00ff00:#00ff00:rgb(0, 255, 0)");
|
|
305
|
+
expect(value("custom")).toBe("#abcdef:#abcdef");
|
|
306
|
+
expect(value("decl")).toBe("6:width:--accent");
|
|
307
|
+
expect(value("removed")).toBe("false:");
|
|
308
|
+
expect(value("dataset")).toBe("lead:7");
|
|
309
|
+
expect(value("data-set")).toBe("3:true:true");
|
|
310
|
+
expect(value("data-write")).toBe("hero");
|
|
311
|
+
expect(value("data-delete")).toBe("false:true");
|
|
312
|
+
expect(value("data-keys")).toBe("role,userId");
|
|
313
|
+
expect(value("cs")).toBe("50%:30px:rgb(255, 0, 0):10px:rgb(255, 0, 0):#abcdef");
|
|
314
|
+
expect(value("before")).toBe('"hi":rgb(18, 52, 86)');
|
|
315
|
+
});
|
|
101
316
|
});
|
|
102
317
|
//# sourceMappingURL=gui-dom.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gui-dom.test.js","sourceRoot":"","sources":["../../../tests/e2e/gui-dom.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAElE,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;AAEnC,QAAQ,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACzD,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,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;IACvD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -88,5 +88,117 @@ describe.skipIf(!guiAvailable)("gui extension — events", () => {
|
|
|
88
88
|
expect(stdout).not.toContain("web-event=click:");
|
|
89
89
|
expect(stdout).toContain("web-event=key:a");
|
|
90
90
|
});
|
|
91
|
+
it("honours listener options, event init fields and dispatch identity", () => {
|
|
92
|
+
const { value } = harness.compileAndRun("event-options", `
|
|
93
|
+
import { createWindow, run } from "gui";
|
|
94
|
+
|
|
95
|
+
const HTML = \`
|
|
96
|
+
<html><body style="margin:0">
|
|
97
|
+
<div id="outer"><div id="inner">x</div></div>
|
|
98
|
+
</body></html>\`;
|
|
99
|
+
|
|
100
|
+
const win = createWindow({ title: "event-options", width: 300, height: 200 });
|
|
101
|
+
win.on("ready", () => {
|
|
102
|
+
const doc = win.document;
|
|
103
|
+
const outer: any = doc.getElementById("outer");
|
|
104
|
+
const inner: any = doc.getElementById("inner");
|
|
105
|
+
|
|
106
|
+
// once
|
|
107
|
+
let once = 0;
|
|
108
|
+
inner.addEventListener("click", () => { once++; }, { once: true });
|
|
109
|
+
inner.click();
|
|
110
|
+
inner.click();
|
|
111
|
+
console.log("once=" + once);
|
|
112
|
+
|
|
113
|
+
// passive: preventDefault is ignored, a normal listener still cancels
|
|
114
|
+
let passive = false;
|
|
115
|
+
inner.addEventListener("click", (e: any) => {
|
|
116
|
+
e.preventDefault();
|
|
117
|
+
passive = e.defaultPrevented;
|
|
118
|
+
}, { passive: true });
|
|
119
|
+
inner.click();
|
|
120
|
+
console.log("passive=" + passive);
|
|
121
|
+
let active = false;
|
|
122
|
+
inner.addEventListener("click", (e: any) => {
|
|
123
|
+
e.preventDefault();
|
|
124
|
+
active = e.defaultPrevented;
|
|
125
|
+
});
|
|
126
|
+
inner.click();
|
|
127
|
+
console.log("active=" + active);
|
|
128
|
+
|
|
129
|
+
// signal removes the listener, including an already-aborted one
|
|
130
|
+
const controller = new AbortController();
|
|
131
|
+
let signaled = 0;
|
|
132
|
+
inner.addEventListener("click", () => { signaled++; }, { signal: controller.signal });
|
|
133
|
+
inner.click();
|
|
134
|
+
controller.abort();
|
|
135
|
+
inner.click();
|
|
136
|
+
console.log("signal=" + signaled + ":" + controller.signal.aborted);
|
|
137
|
+
const abortEvent = new AbortController();
|
|
138
|
+
let onAbort = 0;
|
|
139
|
+
abortEvent.signal.addEventListener("abort", () => { onAbort++; });
|
|
140
|
+
abortEvent.abort();
|
|
141
|
+
console.log("abort-event=" + onAbort + ":" + abortEvent.signal.aborted +
|
|
142
|
+
":" + (abortEvent.signal.reason instanceof Error));
|
|
143
|
+
const pre = new AbortController();
|
|
144
|
+
pre.abort();
|
|
145
|
+
let never = 0;
|
|
146
|
+
inner.addEventListener("click", () => { never++; }, { signal: pre.signal });
|
|
147
|
+
inner.click();
|
|
148
|
+
console.log("pre-aborted=" + never);
|
|
149
|
+
|
|
150
|
+
// window listeners take the same options
|
|
151
|
+
let winOnce = 0;
|
|
152
|
+
win.addEventListener("custom", () => { winOnce++; }, { once: true });
|
|
153
|
+
win.sendEvent("custom", {});
|
|
154
|
+
win.sendEvent("custom", {});
|
|
155
|
+
console.log("win-once=" + winOnce);
|
|
156
|
+
const winAbort = new AbortController();
|
|
157
|
+
let winSignaled = 0;
|
|
158
|
+
win.addEventListener("custom2", () => { winSignaled++; }, { signal: winAbort.signal });
|
|
159
|
+
win.sendEvent("custom2", {});
|
|
160
|
+
winAbort.abort();
|
|
161
|
+
win.sendEvent("custom2", {});
|
|
162
|
+
console.log("win-signal=" + winSignaled);
|
|
163
|
+
|
|
164
|
+
// EventInit fields survive construction
|
|
165
|
+
const custom: any = new CustomEvent("ping", { detail: 42, bubbles: true, composed: true });
|
|
166
|
+
console.log("event=" + custom.type + ":" + custom.detail + ":" + custom.bubbles +
|
|
167
|
+
":" + custom.composed + ":" + custom.isTrusted + ":" + custom.eventPhase);
|
|
168
|
+
const mouse: any = new MouseEvent("click", { clientX: 7, clientY: 8, button: 2, bubbles: true });
|
|
169
|
+
console.log("mouse=" + mouse.clientX + "," + mouse.clientY + "," + mouse.button);
|
|
170
|
+
|
|
171
|
+
// dispatchEvent keeps the event identity and exposes the path/phases
|
|
172
|
+
const phases: string[] = [];
|
|
173
|
+
outer.addEventListener("click", (e: any) => {
|
|
174
|
+
phases.push("capture" + e.eventPhase + ":" + (e.composedPath()[0] === inner));
|
|
175
|
+
}, true);
|
|
176
|
+
inner.addEventListener("click", (e: any) => {
|
|
177
|
+
phases.push("target" + e.eventPhase + ":" + (e.composedPath().length > 1));
|
|
178
|
+
});
|
|
179
|
+
const dispatched: any = new CustomEvent("click", { bubbles: true });
|
|
180
|
+
let seen = false;
|
|
181
|
+
inner.addEventListener("click", (e: any) => { seen = e === dispatched; });
|
|
182
|
+
inner.dispatchEvent(dispatched);
|
|
183
|
+
console.log("path=" + phases.join("|") + ":identity=" + seen + ":target=" + (dispatched.target === inner));
|
|
184
|
+
win.close();
|
|
185
|
+
});
|
|
186
|
+
win.loadHTML(HTML);
|
|
187
|
+
run();
|
|
188
|
+
`);
|
|
189
|
+
expect(value("once")).toBe("1");
|
|
190
|
+
expect(value("passive")).toBe("false");
|
|
191
|
+
expect(value("active")).toBe("true");
|
|
192
|
+
expect(value("signal")).toBe("1:true");
|
|
193
|
+
expect(value("abort-event")).toBe("1:true:true");
|
|
194
|
+
expect(value("pre-aborted")).toBe("0");
|
|
195
|
+
expect(value("win-once")).toBe("1");
|
|
196
|
+
expect(value("win-signal")).toBe("1");
|
|
197
|
+
expect(value("event")).toBe("ping:42:true:true:false:0");
|
|
198
|
+
expect(value("mouse")).toBe("7,8,2");
|
|
199
|
+
// Capture runs ancestor-first (phase 1), the target runs at phase 2, the
|
|
200
|
+
// dispatched object keeps its identity and gains its target.
|
|
201
|
+
expect(value("path")).toBe("capture1:true|target2:true:identity=true:target=true");
|
|
202
|
+
});
|
|
91
203
|
});
|
|
92
204
|
//# sourceMappingURL=gui-events.test.js.map
|
|
@@ -1 +1 @@
|
|
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AAI,CAAC,GAAG,CAAC,CAAC;QAChC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACjD,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACvC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QACzD,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrC,yEAAyE;QACzE,6DAA6D;QAC7D,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;IACrF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GUI e2e: `<script src>` module imports run after `loadHTML`.
|
|
3
|
+
*
|
|
4
|
+
* A browser evaluates a module script's import graph after the document has
|
|
5
|
+
* been parsed, so the imported modules already see real elements (and any DOM
|
|
6
|
+
* work at their top level is not wasted on an empty document). The `.html`
|
|
7
|
+
* loader marks relative imports as deferred; the bundler wraps the module and
|
|
8
|
+
* the registered script invokes it at `loadHTML` time.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GUI e2e: `<script src>` module imports run after `loadHTML`.
|
|
3
|
+
*
|
|
4
|
+
* A browser evaluates a module script's import graph after the document has
|
|
5
|
+
* been parsed, so the imported modules already see real elements (and any DOM
|
|
6
|
+
* work at their top level is not wasted on an empty document). The `.html`
|
|
7
|
+
* loader marks relative imports as deferred; the bundler wraps the module and
|
|
8
|
+
* the registered script invokes it at `loadHTML` time.
|
|
9
|
+
*/
|
|
10
|
+
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
11
|
+
import { createGuiHarness, guiAvailable } from "./gui-helpers.js";
|
|
12
|
+
import { nodeExtension } from "../../src/extensions/node/index.js";
|
|
13
|
+
const harness = createGuiHarness();
|
|
14
|
+
const PROBE_PAGE = `<html><body>
|
|
15
|
+
<div class="touch"></div><div class="touch"></div><div class="touch"></div>
|
|
16
|
+
<canvas id="probe-canvas" width="120" height="80"></canvas>
|
|
17
|
+
<script src="./probe.ts"></script>
|
|
18
|
+
</body></html>`;
|
|
19
|
+
const PAGE = `<html><body>
|
|
20
|
+
<div id="box">hi</div>
|
|
21
|
+
<script src="./app.ts"></script>
|
|
22
|
+
<script src="./app2.ts"></script>
|
|
23
|
+
<script src="./app3.ts"></script>
|
|
24
|
+
<script src="./app4.ts"></script>
|
|
25
|
+
<script src="./app6.ts"></script>
|
|
26
|
+
<script src="./app7.ts"></script>
|
|
27
|
+
<script src="./app8.ts"></script>
|
|
28
|
+
<script src="./app9.ts"></script>
|
|
29
|
+
<script src="./app10.ts"></script>
|
|
30
|
+
<script src="./app11.ts"></script>
|
|
31
|
+
</body></html>`;
|
|
32
|
+
describe.skipIf(!guiAvailable)("gui extension — deferred <script src> imports", () => {
|
|
33
|
+
beforeAll(() => harness.setup());
|
|
34
|
+
afterAll(() => harness.cleanup());
|
|
35
|
+
it("evaluates the import graph after loadHTML and shares module state", () => {
|
|
36
|
+
const { value, stdout } = harness.compileAndRun("script-import-order", `
|
|
37
|
+
import { createWindow } from "gui";
|
|
38
|
+
import page from "./page.html";
|
|
39
|
+
import { shared } from "./shared";
|
|
40
|
+
|
|
41
|
+
const win = createWindow({ title: "deferred", width: 320, height: 240 });
|
|
42
|
+
console.log("shared-main=" + shared);
|
|
43
|
+
const label = (name: string, value: any): void => console.log(name + "=" + value);
|
|
44
|
+
label("before", (win as any).imported === undefined ? "undefined" : "set");
|
|
45
|
+
label("before-deep", (win as any).deep === undefined ? "undefined" : "set");
|
|
46
|
+
win.loadHTML(page);
|
|
47
|
+
label("after", (win as any).imported);
|
|
48
|
+
label("after-deep", (win as any).deep);
|
|
49
|
+
label("body", (win as any).scriptBody);
|
|
50
|
+
win.close();
|
|
51
|
+
`, {
|
|
52
|
+
extensions: [nodeExtension],
|
|
53
|
+
files: {
|
|
54
|
+
"page.html": PAGE,
|
|
55
|
+
"app.ts": `
|
|
56
|
+
import { probe } from "./helper";
|
|
57
|
+
const box = document.getElementById("box");
|
|
58
|
+
console.log("app=" + box.textContent);
|
|
59
|
+
( window as any ).scriptBody = probe() + ":" + box.textContent;
|
|
60
|
+
`,
|
|
61
|
+
"app2.ts": `
|
|
62
|
+
import { bump } from "./counter";
|
|
63
|
+
console.log("app2=" + bump());
|
|
64
|
+
`,
|
|
65
|
+
"helper.ts": `
|
|
66
|
+
import "./deep";
|
|
67
|
+
const box = document.getElementById("box");
|
|
68
|
+
( window as any ).imported = "yes:" + box.textContent;
|
|
69
|
+
console.log("helper=" + box.textContent);
|
|
70
|
+
export function probe(): string { return "probe"; }
|
|
71
|
+
`,
|
|
72
|
+
"deep.ts": `
|
|
73
|
+
( window as any ).deep = "yes";
|
|
74
|
+
console.log("deep");
|
|
75
|
+
`,
|
|
76
|
+
"counter.ts": `
|
|
77
|
+
import { seed } from "./seed";
|
|
78
|
+
let n = 0;
|
|
79
|
+
export function bump(): number { n += seed; return n; }
|
|
80
|
+
`,
|
|
81
|
+
"seed.ts": "export const seed = 1;",
|
|
82
|
+
"app3.ts": 'import { value } from "./reexport"; console.log("app3=" + value);',
|
|
83
|
+
"reexport.ts": 'import { value } from "./value"; export { value };',
|
|
84
|
+
"app6.ts": 'import { shared } from "./shared"; console.log("app6=" + shared);',
|
|
85
|
+
"shared.ts": 'export const shared = "s"; console.log("shared-eager");',
|
|
86
|
+
"app7.ts": 'import { A, E } from "./klass"; console.log("app7=" + new A().x + ":" + E.One);',
|
|
87
|
+
"klass.ts": 'export class A { x = 1; } export enum E { One }',
|
|
88
|
+
"app8.ts": 'import make from "./anon"; console.log("app8=" + make());',
|
|
89
|
+
"anon.ts": 'export default function () { return 5; }',
|
|
90
|
+
"app9.ts": 'import Shape from "./anonclass"; console.log("app9=" + new Shape().x);',
|
|
91
|
+
"anonclass.ts": 'export default class { x = 3; }',
|
|
92
|
+
"app10.ts": 'import * as math from "./mathmod"; console.log("app10=" + math.add(2, 3) + math.tag);',
|
|
93
|
+
"mathmod.ts": 'export function add(a: number, b: number): number { return a + b; } export const tag = "m";',
|
|
94
|
+
"app11.ts": 'import { readEmpty } from "./guilib"; console.log("app11=" + (readEmpty() === ""));',
|
|
95
|
+
"guilib.ts": 'import { readFileSync } from "fs"; export function readEmpty(): string { return readFileSync("/dev/null", "utf8"); }',
|
|
96
|
+
"value.ts": 'export const value = "v";',
|
|
97
|
+
"app4.ts": 'import { value } from "./wide"; console.log("app4=" + value);',
|
|
98
|
+
"wide.ts": 'export * from "./value";',
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
/* Module top-level code runs while the script functions run (during
|
|
102
|
+
* loadHTML), not at program start. */
|
|
103
|
+
expect(value("before")).toBe("undefined");
|
|
104
|
+
expect(value("before-deep")).toBe("undefined");
|
|
105
|
+
expect(value("after")).toBe("yes:hi");
|
|
106
|
+
expect(value("after-deep")).toBe("yes");
|
|
107
|
+
expect(value("body")).toBe("probe:hi");
|
|
108
|
+
expect(stdout).toContain("helper=hi");
|
|
109
|
+
expect(stdout).toContain("deep");
|
|
110
|
+
/* The script order is document order, and the shared module was evaluated
|
|
111
|
+
* once, so the second script sees the incremented state. */
|
|
112
|
+
expect(stdout.indexOf("helper=hi")).toBeLessThan(stdout.indexOf("app="));
|
|
113
|
+
expect(stdout).toContain("app2=1");
|
|
114
|
+
expect(stdout).toContain("app3=v");
|
|
115
|
+
expect(stdout).toContain("app4=v");
|
|
116
|
+
expect(stdout).toContain("app6=s");
|
|
117
|
+
expect(stdout).toContain("app7=1:0");
|
|
118
|
+
expect(stdout).toContain("app8=5");
|
|
119
|
+
expect(stdout).toContain("app9=3");
|
|
120
|
+
expect(stdout).toContain("app10=5m");
|
|
121
|
+
expect(stdout).toContain("app11=true");
|
|
122
|
+
expect(stdout).toContain("shared-main=s");
|
|
123
|
+
/* The shared module was already reachable eagerly and must not run twice. */
|
|
124
|
+
expect(stdout.match(/shared-eager/g)?.length).toBe(1);
|
|
125
|
+
});
|
|
126
|
+
it("gives imported modules the real window, document and canvas", () => {
|
|
127
|
+
const { value } = harness.compileAndRun("script-import-probe", `
|
|
128
|
+
import { createWindow } from "gui";
|
|
129
|
+
import page from "./probe.html";
|
|
130
|
+
|
|
131
|
+
const win = createWindow({ title: "probe", width: 1280, height: 720 });
|
|
132
|
+
const label = (name: string, value: any): void => console.log(name + "=" + value);
|
|
133
|
+
label("before", (win as any).probe === undefined ? "undefined" : "set");
|
|
134
|
+
win.loadHTML(page);
|
|
135
|
+
label("probe", (win as any).probe);
|
|
136
|
+
win.close();
|
|
137
|
+
`, {
|
|
138
|
+
files: {
|
|
139
|
+
"probe.html": PROBE_PAGE,
|
|
140
|
+
"probe.ts": `
|
|
141
|
+
const canvas: any = document.getElementById("probe-canvas");
|
|
142
|
+
const gl: any = canvas.getContext("webgl2");
|
|
143
|
+
const span: any = document.createElement("span");
|
|
144
|
+
span.dataset.touch = "ok";
|
|
145
|
+
const touches = document.querySelectorAll(".touch");
|
|
146
|
+
( window as any ).probe = [
|
|
147
|
+
window.innerWidth + "x" + window.innerHeight,
|
|
148
|
+
touches.length,
|
|
149
|
+
span.tagName + ":" + span.dataset.touch,
|
|
150
|
+
canvas.width + "x" + canvas.height,
|
|
151
|
+
gl != null
|
|
152
|
+
].join(",");
|
|
153
|
+
console.log("probe-module=" + ( window as any ).probe);
|
|
154
|
+
`,
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
expect(value("before")).toBe("undefined");
|
|
158
|
+
expect(value("probe")).toBe("1280x720,3,SPAN:ok,120x80,true");
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
//# sourceMappingURL=gui-script-import-order.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gui-script-import-order.test.js","sourceRoot":"","sources":["../../../tests/e2e/gui-script-import-order.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAEnE,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;AAEnC,MAAM,UAAU,GAAG;;;;eAIJ,CAAC;AAEhB,MAAM,IAAI,GAAG;;;;;;;;;;;;eAYE,CAAC;AAEhB,QAAQ,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,+CAA+C,EAAE,GAAG,EAAE;IACnF,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAElC,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;QAC3E,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,a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;;;OAUC,EACD;YACE,KAAK,EAAE;gBACL,YAAY,EAAE,UAAU;gBACxB,UAAU,EAAE;;;;;;;;;;;;;;CAcrB;aACQ;SACF,CACF,CAAC;QAEF,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC1C,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GUI e2e: WebGL 2 identity and three.js-style sampler arrays.
|
|
3
|
+
*
|
|
4
|
+
* A browser reports a WebGL 2 context as `WebGL2RenderingContext` (and *not* as
|
|
5
|
+
* `WebGLRenderingContext`), which is how three.js decides whether to use its
|
|
6
|
+
* WebGL 2 path. Its shadow-map chunks also index sampler arrays with a loop
|
|
7
|
+
* variable; Vulkan GLSL only accepts a constant index, so the rewriter has to
|
|
8
|
+
* expand the pragma-marked loop before compiling.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|