diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7e5cfe5fa..78e931a0d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,7 +13,6 @@ on: - lib.rs - Cargo.toml - Makefile.toml - - playwright-tests/** pull_request: types: [opened, synchronize, reopened, ready_for_review] @@ -172,19 +171,19 @@ jobs: - name: Install dependencies run: npm ci - working-directory: ./playwright-tests + working-directory: ./packages/playwright-tests - name: Install Playwright run: npm install -D @playwright/test - working-directory: ./playwright-tests + working-directory: ./packages/playwright-tests - name: Install Playwright Browsers run: npx playwright install --with-deps - working-directory: ./playwright-tests + working-directory: ./packages/playwright-tests - name: Run Playwright tests run: npx playwright test - working-directory: ./playwright-tests + working-directory: ./packages/playwright-tests - uses: actions/upload-artifact@v4 if: always() diff --git a/Cargo.toml b/Cargo.toml index d0585be1e..bbf8c1642 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,9 +45,9 @@ members = [ "examples/PWA-example", # "examples/openid_connect_demo", # Playwright tests - "playwright-tests/liveview", - "playwright-tests/web", - "playwright-tests/fullstack", + "packages/playwright-tests/liveview", + "packages/playwright-tests/web", + "packages/playwright-tests/fullstack", ] exclude = ["examples/mobile_demo", "examples/openid_connect_demo",] diff --git a/playwright-tests/fullstack.spec.js b/packages/playwright-tests/fullstack.spec.js similarity index 100% rename from playwright-tests/fullstack.spec.js rename to packages/playwright-tests/fullstack.spec.js diff --git a/playwright-tests/fullstack/.gitignore b/packages/playwright-tests/fullstack/.gitignore similarity index 100% rename from playwright-tests/fullstack/.gitignore rename to packages/playwright-tests/fullstack/.gitignore diff --git a/playwright-tests/fullstack/Cargo.toml b/packages/playwright-tests/fullstack/Cargo.toml similarity index 100% rename from playwright-tests/fullstack/Cargo.toml rename to packages/playwright-tests/fullstack/Cargo.toml diff --git a/playwright-tests/fullstack/src/main.rs b/packages/playwright-tests/fullstack/src/main.rs similarity index 100% rename from playwright-tests/fullstack/src/main.rs rename to packages/playwright-tests/fullstack/src/main.rs diff --git a/playwright-tests/liveview.spec.js b/packages/playwright-tests/liveview.spec.js similarity index 100% rename from playwright-tests/liveview.spec.js rename to packages/playwright-tests/liveview.spec.js diff --git a/playwright-tests/liveview/Cargo.toml b/packages/playwright-tests/liveview/Cargo.toml similarity index 71% rename from playwright-tests/liveview/Cargo.toml rename to packages/playwright-tests/liveview/Cargo.toml index ea9f3eb24..851bed97d 100644 --- a/playwright-tests/liveview/Cargo.toml +++ b/packages/playwright-tests/liveview/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" publish = false [dependencies] -dioxus = { path = "../../packages/dioxus" } -dioxus-liveview = { path = "../../packages/liveview", features = ["axum"] } +dioxus = { workspace = true } +dioxus-liveview = { workspace = true, features = ["axum"] } tokio = { version = "1.19.2", features = ["full"] } axum = { version = "0.6.1", features = ["ws"] } diff --git a/playwright-tests/liveview/src/main.rs b/packages/playwright-tests/liveview/src/main.rs similarity index 100% rename from playwright-tests/liveview/src/main.rs rename to packages/playwright-tests/liveview/src/main.rs diff --git a/playwright-tests/package-lock.json b/packages/playwright-tests/package-lock.json similarity index 100% rename from playwright-tests/package-lock.json rename to packages/playwright-tests/package-lock.json diff --git a/playwright-tests/package.json b/packages/playwright-tests/package.json similarity index 100% rename from playwright-tests/package.json rename to packages/playwright-tests/package.json diff --git a/playwright-tests/playwright-report/index.html b/packages/playwright-tests/playwright-report/index.html similarity index 100% rename from playwright-tests/playwright-report/index.html rename to packages/playwright-tests/playwright-report/index.html diff --git a/playwright-tests/playwright.config.js b/packages/playwright-tests/playwright.config.js similarity index 100% rename from playwright-tests/playwright.config.js rename to packages/playwright-tests/playwright.config.js diff --git a/playwright-tests/web.spec.js b/packages/playwright-tests/web.spec.js similarity index 100% rename from playwright-tests/web.spec.js rename to packages/playwright-tests/web.spec.js diff --git a/playwright-tests/web/Cargo.toml b/packages/playwright-tests/web/Cargo.toml similarity index 77% rename from playwright-tests/web/Cargo.toml rename to packages/playwright-tests/web/Cargo.toml index 268be52fa..368174e9a 100644 --- a/playwright-tests/web/Cargo.toml +++ b/packages/playwright-tests/web/Cargo.toml @@ -7,5 +7,5 @@ license = "MIT OR Apache-2.0" publish = false [dependencies] -dioxus = { path = "../../packages/dioxus", features = ["web"]} +dioxus = { workspace = true, features = ["web"]} serde_json = "1.0.96" diff --git a/packages/playwright-tests/web/dist/assets/dioxus/name.js b/packages/playwright-tests/web/dist/assets/dioxus/name.js new file mode 100644 index 000000000..3905127d1 --- /dev/null +++ b/packages/playwright-tests/web/dist/assets/dioxus/name.js @@ -0,0 +1,1410 @@ +import { create, update_memory, save_template, get_node, initialize } from './snippets/dioxus-interpreter-js-85a0a2f8acce2e86/inline0.js'; +import { setAttributeInner } from './snippets/dioxus-interpreter-js-85a0a2f8acce2e86/src/common.js'; +import { get_form_data } from './snippets/dioxus-web-a95d8cc6c91ff8eb/inline0.js'; +import { Dioxus } from './snippets/dioxus-web-a95d8cc6c91ff8eb/src/eval.js'; +import * as __wbg_star0 from './snippets/dioxus-interpreter-js-85a0a2f8acce2e86/inline0.js'; + +let wasm; + +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; + +let cachedUint8Memory0 = null; + +function getUint8Memory0() { + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8Memory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); +} + +const heap = new Array(128).fill(undefined); + +heap.push(undefined, null, true, false); + +let heap_next = heap.length; + +function addHeapObject(obj) { + if (heap_next === heap.length) heap.push(heap.length + 1); + const idx = heap_next; + heap_next = heap[idx]; + + if (typeof(heap_next) !== 'number') throw new Error('corrupt heap'); + + heap[idx] = obj; + return idx; +} + +function getObject(idx) { return heap[idx]; } + +function _assertBoolean(n) { + if (typeof(n) !== 'boolean') { + throw new Error('expected a boolean argument'); + } +} + +function isLikeNone(x) { + return x === undefined || x === null; +} + +function _assertNum(n) { + if (typeof(n) !== 'number') throw new Error('expected a number argument'); +} + +let cachedFloat64Memory0 = null; + +function getFloat64Memory0() { + if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { + cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); + } + return cachedFloat64Memory0; +} + +let cachedInt32Memory0 = null; + +function getInt32Memory0() { + if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { + cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); + } + return cachedInt32Memory0; +} + +let WASM_VECTOR_LEN = 0; + +const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } ); + +const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' + ? function (arg, view) { + return cachedTextEncoder.encodeInto(arg, view); +} + : function (arg, view) { + const buf = cachedTextEncoder.encode(arg); + view.set(buf); + return { + read: arg.length, + written: buf.length + }; +}); + +function passStringToWasm0(arg, malloc, realloc) { + + if (typeof(arg) !== 'string') throw new Error('expected a string argument'); + + if (realloc === undefined) { + const buf = cachedTextEncoder.encode(arg); + const ptr = malloc(buf.length, 1) >>> 0; + getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr; + } + + let len = arg.length; + let ptr = malloc(len, 1) >>> 0; + + const mem = getUint8Memory0(); + + let offset = 0; + + for (; offset < len; offset++) { + const code = arg.charCodeAt(offset); + if (code > 0x7F) break; + mem[ptr + offset] = code; + } + + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; + const view = getUint8Memory0().subarray(ptr + offset, ptr + len); + const ret = encodeString(arg, view); + if (ret.read !== arg.length) throw new Error('failed to pass whole string'); + offset += ret.written; + } + + WASM_VECTOR_LEN = offset; + return ptr; +} + +function dropObject(idx) { + if (idx < 132) return; + heap[idx] = heap_next; + heap_next = idx; +} + +function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; +} + +function debugString(val) { + // primitive types + const type = typeof val; + if (type == 'number' || type == 'boolean' || val == null) { + return `${val}`; + } + if (type == 'string') { + return `"${val}"`; + } + if (type == 'symbol') { + const description = val.description; + if (description == null) { + return 'Symbol'; + } else { + return `Symbol(${description})`; + } + } + if (type == 'function') { + const name = val.name; + if (typeof name == 'string' && name.length > 0) { + return `Function(${name})`; + } else { + return 'Function'; + } + } + // objects + if (Array.isArray(val)) { + const length = val.length; + let debug = '['; + if (length > 0) { + debug += debugString(val[0]); + } + for(let i = 1; i < length; i++) { + debug += ', ' + debugString(val[i]); + } + debug += ']'; + return debug; + } + // Test for built-in + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); + let className; + if (builtInMatches.length > 1) { + className = builtInMatches[1]; + } else { + // Failed to match the standard '[object ClassName]' + return toString.call(val); + } + if (className == 'Object') { + // we're a user defined class or Object + // JSON.stringify avoids problems with cycles, and is generally much + // easier than looping through ownProperties of `val`. + try { + return 'Object(' + JSON.stringify(val) + ')'; + } catch (_) { + return 'Object'; + } + } + // errors + if (val instanceof Error) { + return `${val.name}: ${val.message}\n${val.stack}`; + } + // TODO we could test for more things here, like `Set`s and `Map`s. + return className; +} + +function _assertBigInt(n) { + if (typeof(n) !== 'bigint') throw new Error('expected a bigint argument'); +} + +let cachedBigInt64Memory0 = null; + +function getBigInt64Memory0() { + if (cachedBigInt64Memory0 === null || cachedBigInt64Memory0.byteLength === 0) { + cachedBigInt64Memory0 = new BigInt64Array(wasm.memory.buffer); + } + return cachedBigInt64Memory0; +} + +function makeMutClosure(arg0, arg1, dtor, f) { + const state = { a: arg0, b: arg1, cnt: 1, dtor }; + const real = (...args) => { + // First up with a closure we increment the internal reference + // count. This ensures that the Rust closure environment won't + // be deallocated while we're invoking it. + state.cnt++; + const a = state.a; + state.a = 0; + try { + return f(a, state.b, ...args); + } finally { + if (--state.cnt === 0) { + wasm.__wbindgen_export_2.get(state.dtor)(a, state.b); + + } else { + state.a = a; + } + } + }; + real.original = state; + + return real; +} + +function logError(f, args) { + try { + return f.apply(this, args); + } catch (e) { + let error = (function () { + try { + return e instanceof Error ? `${e.message}\n\nStack:\n${e.stack}` : e.toString(); + } catch(_) { + return ""; + } + }()); + console.error("wasm-bindgen: imported JS function that was not marked as `catch` threw an error:", error); + throw e; + } +} + +let stack_pointer = 128; + +function addBorrowedObject(obj) { + if (stack_pointer == 1) throw new Error('out of js stack'); + heap[--stack_pointer] = obj; + return stack_pointer; +} +function __wbg_adapter_48(arg0, arg1, arg2) { + try { + _assertNum(arg0); + _assertNum(arg1); + wasm._dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h52e53ead8a125baf(arg0, arg1, addBorrowedObject(arg2)); + } finally { + heap[stack_pointer++] = undefined; + } +} + +function __wbg_adapter_51(arg0, arg1) { + _assertNum(arg0); + _assertNum(arg1); + wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h6eae0c7214fc2620(arg0, arg1); +} + +function __wbg_adapter_54(arg0, arg1, arg2) { + _assertNum(arg0); + _assertNum(arg1); + wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4791a9f11a1d9d64(arg0, arg1, addHeapObject(arg2)); +} + +function __wbg_adapter_57(arg0, arg1, arg2) { + _assertNum(arg0); + _assertNum(arg1); + wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h346242f0a77793cd(arg0, arg1, addHeapObject(arg2)); +} + +function getCachedStringFromWasm0(ptr, len) { + if (ptr === 0) { + return getObject(len); + } else { + return getStringFromWasm0(ptr, len); + } +} + +let cachedUint32Memory0 = null; + +function getUint32Memory0() { + if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) { + cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer); + } + return cachedUint32Memory0; +} + +function getArrayJsValueFromWasm0(ptr, len) { + ptr = ptr >>> 0; + const mem = getUint32Memory0(); + const slice = mem.subarray(ptr / 4, ptr / 4 + len); + const result = []; + for (let i = 0; i < slice.length; i++) { + result.push(takeObject(slice[i])); + } + return result; +} + +function handleError(f, args) { + try { + return f.apply(this, args); + } catch (e) { + wasm.__wbindgen_exn_store(addHeapObject(e)); + } +} + +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } + } +} + +function __wbg_get_imports() { + const imports = {}; + imports.wbg = {}; + imports.wbg.__wbg_getformdata_7206b99ef44b788e = function() { return logError(function (arg0) { + const ret = get_form_data(getObject(arg0)); + return addHeapObject(ret); + }, arguments) }; + imports.wbg.__wbg_new_abd8a48ffd951779 = function() { return logError(function (arg0) { + const ret = new Dioxus(getObject(arg0)); + return addHeapObject(ret); + }, arguments) }; + imports.wbg.__wbg_rustSend_6175a678357f46b1 = function() { return logError(function (arg0, arg1) { + getObject(arg0).rustSend(takeObject(arg1)); + }, arguments) }; + imports.wbg.__wbindgen_error_new = function(arg0, arg1) { + const ret = new Error(getStringFromWasm0(arg0, arg1)); + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_is_undefined = function(arg0) { + const ret = getObject(arg0) === undefined; + _assertBoolean(ret); + return ret; + }; + imports.wbg.__wbindgen_in = function(arg0, arg1) { + const ret = getObject(arg0) in getObject(arg1); + _assertBoolean(ret); + return ret; + }; + imports.wbg.__wbindgen_number_get = function(arg0, arg1) { + const obj = getObject(arg1); + const ret = typeof(obj) === 'number' ? obj : undefined; + if (!isLikeNone(ret)) { + _assertNum(ret); + } + getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret; + getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret); + }; + imports.wbg.__wbindgen_boolean_get = function(arg0) { + const v = getObject(arg0); + const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2; + _assertNum(ret); + return ret; + }; + imports.wbg.__wbindgen_string_new = function(arg0, arg1) { + const ret = getStringFromWasm0(arg0, arg1); + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_string_get = function(arg0, arg1) { + const obj = getObject(arg1); + const ret = typeof(obj) === 'string' ? obj : undefined; + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; + }; + imports.wbg.__wbindgen_is_bigint = function(arg0) { + const ret = typeof(getObject(arg0)) === 'bigint'; + _assertBoolean(ret); + return ret; + }; + imports.wbg.__wbindgen_is_object = function(arg0) { + const val = getObject(arg0); + const ret = typeof(val) === 'object' && val !== null; + _assertBoolean(ret); + return ret; + }; + imports.wbg.__wbindgen_object_clone_ref = function(arg0) { + const ret = getObject(arg0); + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) { + const ret = getObject(arg0) === getObject(arg1); + _assertBoolean(ret); + return ret; + }; + imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) { + const ret = arg0; + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) { + const ret = BigInt.asUintN(64, arg0); + return addHeapObject(ret); + }; + imports.wbg.__wbg_error_f851667af71bcfc6 = function() { return logError(function (arg0, arg1) { + var v0 = getCachedStringFromWasm0(arg0, arg1); + if (arg0 !== 0) { wasm.__wbindgen_free(arg0, arg1, 1); } + console.error(v0); +}, arguments) }; +imports.wbg.__wbg_new_abda76e883ba8a5f = function() { return logError(function () { + const ret = new Error(); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_stack_658279fe44541cf6 = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg1).stack; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbindgen_is_function = function(arg0) { + const ret = typeof(getObject(arg0)) === 'function'; + _assertBoolean(ret); + return ret; +}; +imports.wbg.__wbindgen_cb_drop = function(arg0) { + const obj = takeObject(arg0).original; + if (obj.cnt-- == 1) { + obj.a = 0; + return true; + } + const ret = false; + _assertBoolean(ret); + return ret; +}; +imports.wbg.__wbg_queueMicrotask_4d890031a6a5a50c = function() { return logError(function (arg0) { + queueMicrotask(getObject(arg0)); +}, arguments) }; +imports.wbg.__wbg_queueMicrotask_adae4bc085237231 = function() { return logError(function (arg0) { + const ret = getObject(arg0).queueMicrotask; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbindgen_number_new = function(arg0) { + const ret = arg0; + return addHeapObject(ret); +}; +imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) { + const ret = getObject(arg0) == getObject(arg1); + _assertBoolean(ret); + return ret; +}; +imports.wbg.__wbg_String_88810dfeb4021902 = function() { return logError(function (arg0, arg1) { + const ret = String(getObject(arg1)); + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbg_set_841ac57cff3d672b = function() { return logError(function (arg0, arg1, arg2) { + getObject(arg0)[takeObject(arg1)] = takeObject(arg2); +}, arguments) }; +imports.wbg.__wbg_setAttributeInner_605314ec1c8cafdf = function() { return logError(function (arg0, arg1, arg2, arg3, arg4, arg5) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + var v1 = getCachedStringFromWasm0(arg4, arg5); + setAttributeInner(takeObject(arg0), v0, takeObject(arg3), v1); +}, arguments) }; +imports.wbg.__wbg_create_e7a4871bd307ada9 = function() { return logError(function (arg0) { + create(arg0 >>> 0); +}, arguments) }; +imports.wbg.__wbg_updatememory_acd4e8342aa8de4a = function() { return logError(function (arg0) { + update_memory(takeObject(arg0)); +}, arguments) }; +imports.wbg.__wbg_savetemplate_c4cab19a5b168471 = function() { return logError(function (arg0, arg1, arg2) { + var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice(); + wasm.__wbindgen_free(arg0, arg1 * 4, 4); + save_template(v0, arg2); +}, arguments) }; +imports.wbg.__wbg_getnode_f20ae005be1aee22 = function() { return logError(function (arg0) { + const ret = get_node(arg0 >>> 0); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_initialize_7b63c0e09bcd0c37 = function() { return logError(function (arg0, arg1) { + initialize(takeObject(arg0), getObject(arg1)); +}, arguments) }; +imports.wbg.__wbg_instanceof_Window_3e5cd1f48c152d01 = function() { return logError(function (arg0) { + let result; + try { + result = getObject(arg0) instanceof Window; + } catch (_) { + result = false; + } + const ret = result; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_document_d609202d16c38224 = function() { return logError(function (arg0) { + const ret = getObject(arg0).document; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_location_176c34e89c2c9d80 = function() { return logError(function (arg0) { + const ret = getObject(arg0).location; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_createElement_fdd5c113cb84539e = function() { return handleError(function (arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + const ret = getObject(arg0).createElement(v0); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_createElementNS_524b05a6070757b6 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + var v1 = getCachedStringFromWasm0(arg3, arg4); + const ret = getObject(arg0).createElementNS(v0, v1); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_createTextNode_7ff0c034b2855f66 = function() { return logError(function (arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + const ret = getObject(arg0).createTextNode(v0); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_getElementById_65b9547a428b5eb4 = function() { return logError(function (arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + const ret = getObject(arg0).getElementById(v0); + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_instanceof_Element_3f326a19cc457941 = function() { return logError(function (arg0) { + let result; + try { + result = getObject(arg0) instanceof Element; + } catch (_) { + result = false; + } + const ret = result; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_getAttribute_bff489553dd803cc = function() { return logError(function (arg0, arg1, arg2, arg3) { + var v0 = getCachedStringFromWasm0(arg2, arg3); + const ret = getObject(arg1).getAttribute(v0); + var ptr2 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len2 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len2; + getInt32Memory0()[arg0 / 4 + 0] = ptr2; +}, arguments) }; +imports.wbg.__wbg_getBoundingClientRect_4167ccfa40cf88fc = function() { return logError(function (arg0) { + const ret = getObject(arg0).getBoundingClientRect(); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_scrollIntoView_d55385b7b1c1b7af = function() { return logError(function (arg0, arg1) { + getObject(arg0).scrollIntoView(getObject(arg1)); +}, arguments) }; +imports.wbg.__wbg_toggleAttribute_9013602d6b410309 = function() { return handleError(function (arg0, arg1, arg2) { + var v0 = getCachedStringFromWasm0(arg1, arg2); + const ret = getObject(arg0).toggleAttribute(v0); + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_instanceof_HtmlElement_55a0f0f0f0f0118e = function() { return logError(function (arg0) { + let result; + try { + result = getObject(arg0) instanceof HTMLElement; + } catch (_) { + result = false; + } + const ret = result; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_blur_0f6854a1635dce70 = function() { return handleError(function (arg0) { + getObject(arg0).blur(); +}, arguments) }; +imports.wbg.__wbg_focus_6d3d2b6776d06f7f = function() { return handleError(function (arg0) { + getObject(arg0).focus(); +}, arguments) }; +imports.wbg.__wbg_error_e60eff06f24ab7a4 = function() { return logError(function (arg0) { + console.error(getObject(arg0)); +}, arguments) }; +imports.wbg.__wbg_type_7728453479ee70f4 = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg1).type; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbg_target_52ddf6955f636bf5 = function() { return logError(function (arg0) { + const ret = getObject(arg0).target; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_preventDefault_7f821f72e7c6b5d4 = function() { return logError(function (arg0) { + getObject(arg0).preventDefault(); +}, arguments) }; +imports.wbg.__wbg_instanceof_HtmlInputElement_e7869aaef9cbb0e6 = function() { return logError(function (arg0) { + let result; + try { + result = getObject(arg0) instanceof HTMLInputElement; + } catch (_) { + result = false; + } + const ret = result; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_checked_f46acdc11342a4bd = function() { return logError(function (arg0) { + const ret = getObject(arg0).checked; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_files_84acf164900adf19 = function() { return logError(function (arg0) { + const ret = getObject(arg0).files; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_type_2a81047eef6840e7 = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg1).type; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbg_value_e024243a9dae20bc = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg1).value; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbg_name_bbf9c43b9611377a = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg1).name; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbg_result_d1e1134585be8336 = function() { return handleError(function (arg0) { + const ret = getObject(arg0).result; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_setonload_7edf3cf67d18c0a2 = function() { return logError(function (arg0, arg1) { + getObject(arg0).onload = getObject(arg1); +}, arguments) }; +imports.wbg.__wbg_new_d881a9e329b0c6bb = function() { return handleError(function () { + const ret = new FileReader(); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_readAsArrayBuffer_a3d6ef46725fe135 = function() { return handleError(function (arg0, arg1) { + getObject(arg0).readAsArrayBuffer(getObject(arg1)); +}, arguments) }; +imports.wbg.__wbg_readAsText_612cb8cf6ffd9437 = function() { return handleError(function (arg0, arg1) { + getObject(arg0).readAsText(getObject(arg1)); +}, arguments) }; +imports.wbg.__wbg_instanceof_HtmlSelectElement_2d43d9e14dd8e866 = function() { return logError(function (arg0) { + let result; + try { + result = getObject(arg0) instanceof HTMLSelectElement; + } catch (_) { + result = false; + } + const ret = result; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_value_30ed7fed7e3a14ba = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg1).value; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbg_instanceof_Node_b3f418be312abe25 = function() { return logError(function (arg0) { + let result; + try { + result = getObject(arg0) instanceof Node; + } catch (_) { + result = false; + } + const ret = result; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_parentElement_72e144c2e8d9e0b5 = function() { return logError(function (arg0) { + const ret = getObject(arg0).parentElement; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_textContent_2f37235e13f8484b = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg1).textContent; + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbg_appendChild_d30e6b83791d04c0 = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg0).appendChild(getObject(arg1)); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_pointerId_32f8345c9e0f0ed8 = function() { return logError(function (arg0) { + const ret = getObject(arg0).pointerId; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_width_d81f90f418b10094 = function() { return logError(function (arg0) { + const ret = getObject(arg0).width; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_height_1f0aec13040a28d6 = function() { return logError(function (arg0) { + const ret = getObject(arg0).height; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_pressure_b9f7c7decc59eb11 = function() { return logError(function (arg0) { + const ret = getObject(arg0).pressure; + return ret; +}, arguments) }; +imports.wbg.__wbg_tangentialPressure_75648627b43ce0cb = function() { return logError(function (arg0) { + const ret = getObject(arg0).tangentialPressure; + return ret; +}, arguments) }; +imports.wbg.__wbg_tiltX_eaf660d62564dce8 = function() { return logError(function (arg0) { + const ret = getObject(arg0).tiltX; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_tiltY_dc18659a75a06a1f = function() { return logError(function (arg0) { + const ret = getObject(arg0).tiltY; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_twist_2e3841b5ebc7e59f = function() { return logError(function (arg0) { + const ret = getObject(arg0).twist; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_pointerType_07ad77393049c448 = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg1).pointerType; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbg_isPrimary_19f3516f3a2a6fa0 = function() { return logError(function (arg0) { + const ret = getObject(arg0).isPrimary; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_propertyName_77de8558dcc64081 = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg1).propertyName; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbg_elapsedTime_882bd08fe9dac23e = function() { return logError(function (arg0) { + const ret = getObject(arg0).elapsedTime; + return ret; +}, arguments) }; +imports.wbg.__wbg_pseudoElement_a7506243b6b8f12a = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg1).pseudoElement; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbg_setonmessage_46f324ad82067922 = function() { return logError(function (arg0, arg1) { + getObject(arg0).onmessage = getObject(arg1); +}, arguments) }; +imports.wbg.__wbg_new_2575c598b4006174 = function() { return handleError(function (arg0, arg1) { + var v0 = getCachedStringFromWasm0(arg0, arg1); + const ret = new WebSocket(v0); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_animationName_c19e2ad610c32d6d = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg1).animationName; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbg_elapsedTime_9063a1f5267069fd = function() { return logError(function (arg0) { + const ret = getObject(arg0).elapsedTime; + return ret; +}, arguments) }; +imports.wbg.__wbg_pseudoElement_5940ef718db987d8 = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg1).pseudoElement; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbg_width_1ccae8ab185a4192 = function() { return logError(function (arg0) { + const ret = getObject(arg0).width; + return ret; +}, arguments) }; +imports.wbg.__wbg_height_415b4e67932f43c9 = function() { return logError(function (arg0) { + const ret = getObject(arg0).height; + return ret; +}, arguments) }; +imports.wbg.__wbg_instanceof_HtmlFormElement_7d89e65c39841f5c = function() { return logError(function (arg0) { + let result; + try { + result = getObject(arg0) instanceof HTMLFormElement; + } catch (_) { + result = false; + } + const ret = result; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_instanceof_HtmlTextAreaElement_ce81e455dc21bc93 = function() { return logError(function (arg0) { + let result; + try { + result = getObject(arg0) instanceof HTMLTextAreaElement; + } catch (_) { + result = false; + } + const ret = result; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_value_57e57170f6952449 = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg1).value; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbg_length_9c0dd0075317fa21 = function() { return logError(function (arg0) { + const ret = getObject(arg0).length; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_get_7398eda896ed301e = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg0)[arg1 >>> 0]; + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_pageX_58e43d6529844f55 = function() { return logError(function (arg0) { + const ret = getObject(arg0).pageX; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_pageY_f3752d96ecd2a291 = function() { return logError(function (arg0) { + const ret = getObject(arg0).pageY; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_top_da9f6cf2fb5b9968 = function() { return logError(function (arg0) { + const ret = getObject(arg0).top; + return ret; +}, arguments) }; +imports.wbg.__wbg_left_253905e6c5050382 = function() { return logError(function (arg0) { + const ret = getObject(arg0).left; + return ret; +}, arguments) }; +imports.wbg.__wbg_length_c8f895dad5ec94df = function() { return logError(function (arg0) { + const ret = getObject(arg0).length; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_item_312a88e5ba8832a5 = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg0).item(arg1 >>> 0); + return isLikeNone(ret) ? 0 : addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_protocol_51a4e630fff75abb = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg1).protocol; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbg_host_793ff88f2063bc10 = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg1).host; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbg_screenX_89d33e900365d853 = function() { return logError(function (arg0) { + const ret = getObject(arg0).screenX; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_screenY_92594aac0d2666d8 = function() { return logError(function (arg0) { + const ret = getObject(arg0).screenY; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_clientX_1a01963cb1caa614 = function() { return logError(function (arg0) { + const ret = getObject(arg0).clientX; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_clientY_c370190d4150fba9 = function() { return logError(function (arg0) { + const ret = getObject(arg0).clientY; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_offsetX_e8c2e5379a90ae29 = function() { return logError(function (arg0) { + const ret = getObject(arg0).offsetX; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_offsetY_b8587366f6d36a25 = function() { return logError(function (arg0) { + const ret = getObject(arg0).offsetY; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_ctrlKey_643b17aaac67db50 = function() { return logError(function (arg0) { + const ret = getObject(arg0).ctrlKey; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_shiftKey_8fb7301f56e7e01c = function() { return logError(function (arg0) { + const ret = getObject(arg0).shiftKey; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_altKey_c6c2a7e797d9a669 = function() { return logError(function (arg0) { + const ret = getObject(arg0).altKey; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_metaKey_2a8dbd51a3f59e9c = function() { return logError(function (arg0) { + const ret = getObject(arg0).metaKey; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_button_cd87b6dabbde9631 = function() { return logError(function (arg0) { + const ret = getObject(arg0).button; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_buttons_45faa2de9fb9d23b = function() { return logError(function (arg0) { + const ret = getObject(arg0).buttons; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_data_5d89389455680c67 = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg1).data; + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbg_altKey_bf16cace6fb79198 = function() { return logError(function (arg0) { + const ret = getObject(arg0).altKey; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_ctrlKey_977280484bcead08 = function() { return logError(function (arg0) { + const ret = getObject(arg0).ctrlKey; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_shiftKey_55894418ec38c771 = function() { return logError(function (arg0) { + const ret = getObject(arg0).shiftKey; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_metaKey_16606958d932a374 = function() { return logError(function (arg0) { + const ret = getObject(arg0).metaKey; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_location_6b0f1184627d67d8 = function() { return logError(function (arg0) { + const ret = getObject(arg0).location; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_repeat_2ffa2628836d8009 = function() { return logError(function (arg0) { + const ret = getObject(arg0).repeat; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_key_cf8022c18f47869e = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg1).key; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbg_code_878e76a4ddb70157 = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg1).code; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}, arguments) }; +imports.wbg.__wbg_data_ba3ea616b5392abf = function() { return logError(function (arg0) { + const ret = getObject(arg0).data; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_identifier_8939f89f50c8fa6b = function() { return logError(function (arg0) { + const ret = getObject(arg0).identifier; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_screenX_3704cc75a997d687 = function() { return logError(function (arg0) { + const ret = getObject(arg0).screenX; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_screenY_5011aab29e6f85f4 = function() { return logError(function (arg0) { + const ret = getObject(arg0).screenY; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_clientX_fefe056975b5921c = function() { return logError(function (arg0) { + const ret = getObject(arg0).clientX; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_clientY_811d2153b4dbd9f9 = function() { return logError(function (arg0) { + const ret = getObject(arg0).clientY; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_pageX_5b1c068609f43d64 = function() { return logError(function (arg0) { + const ret = getObject(arg0).pageX; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_pageY_b06b85e2cba2d3f7 = function() { return logError(function (arg0) { + const ret = getObject(arg0).pageY; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_radiusX_2ae2789650866571 = function() { return logError(function (arg0) { + const ret = getObject(arg0).radiusX; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_radiusY_fc5efde646cb6b2a = function() { return logError(function (arg0) { + const ret = getObject(arg0).radiusY; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_rotationAngle_1ab6c6fa9c0f4d83 = function() { return logError(function (arg0) { + const ret = getObject(arg0).rotationAngle; + return ret; +}, arguments) }; +imports.wbg.__wbg_force_c9599f2fa4a04bc2 = function() { return logError(function (arg0) { + const ret = getObject(arg0).force; + return ret; +}, arguments) }; +imports.wbg.__wbg_touches_87a0bcfa4c2fa447 = function() { return logError(function (arg0) { + const ret = getObject(arg0).touches; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_targetTouches_5920937f9d327278 = function() { return logError(function (arg0) { + const ret = getObject(arg0).targetTouches; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_changedTouches_1032f6aefa8e23a6 = function() { return logError(function (arg0) { + const ret = getObject(arg0).changedTouches; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_altKey_aed9fd1b4e7c811a = function() { return logError(function (arg0) { + const ret = getObject(arg0).altKey; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_metaKey_cff45cd01eb1e457 = function() { return logError(function (arg0) { + const ret = getObject(arg0).metaKey; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_ctrlKey_3429fc09f6022470 = function() { return logError(function (arg0) { + const ret = getObject(arg0).ctrlKey; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_shiftKey_d1fad7fd5ce30d9f = function() { return logError(function (arg0) { + const ret = getObject(arg0).shiftKey; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_deltaX_03d8f6dcd2e14b63 = function() { return logError(function (arg0) { + const ret = getObject(arg0).deltaX; + return ret; +}, arguments) }; +imports.wbg.__wbg_deltaY_7d9a7eb25f83e193 = function() { return logError(function (arg0) { + const ret = getObject(arg0).deltaY; + return ret; +}, arguments) }; +imports.wbg.__wbg_deltaZ_3556e726737898b1 = function() { return logError(function (arg0) { + const ret = getObject(arg0).deltaZ; + return ret; +}, arguments) }; +imports.wbg.__wbg_deltaMode_5f43eb63f3077df7 = function() { return logError(function (arg0) { + const ret = getObject(arg0).deltaMode; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_new_ffc6d4d085022169 = function() { return logError(function () { + const ret = new Array(); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_get_f01601b5a68d10e3 = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg0)[arg1 >>> 0]; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_set_f2740edb12e318cd = function() { return logError(function (arg0, arg1, arg2) { + getObject(arg0)[arg1 >>> 0] = takeObject(arg2); +}, arguments) }; +imports.wbg.__wbg_isArray_74fb723e24f76012 = function() { return logError(function (arg0) { + const ret = Array.isArray(getObject(arg0)); + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_length_1009b1af0c481d7b = function() { return logError(function (arg0) { + const ret = getObject(arg0).length; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_instanceof_ArrayBuffer_e7d53d51371448e2 = function() { return logError(function (arg0) { + let result; + try { + result = getObject(arg0) instanceof ArrayBuffer; + } catch (_) { + result = false; + } + const ret = result; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_newwithargs_7224eea6ed10c1a3 = function() { return logError(function (arg0, arg1, arg2, arg3) { + var v0 = getCachedStringFromWasm0(arg0, arg1); + var v1 = getCachedStringFromWasm0(arg2, arg3); + const ret = new Function(v0, v1); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_newnoargs_c62ea9419c21fbac = function() { return logError(function (arg0, arg1) { + var v0 = getCachedStringFromWasm0(arg0, arg1); + const ret = new Function(v0); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_call_90c26b09837aba1c = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg0).call(getObject(arg1)); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_call_5da1969d7cd31ccd = function() { return handleError(function (arg0, arg1, arg2) { + const ret = getObject(arg0).call(getObject(arg1), getObject(arg2)); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_new_bfd4534b584a9593 = function() { return logError(function () { + const ret = new Map(); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_set_d257c6f2da008627 = function() { return logError(function (arg0, arg1, arg2) { + const ret = getObject(arg0).set(getObject(arg1), getObject(arg2)); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_entries_eae7e542df1a4316 = function() { return logError(function (arg0) { + const ret = getObject(arg0).entries(); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_next_6529ee0cca8d57ed = function() { return handleError(function (arg0) { + const ret = getObject(arg0).next(); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_next_9b877f231f476d01 = function() { return logError(function (arg0) { + const ret = getObject(arg0).next; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_done_5fe336b092d60cf2 = function() { return logError(function (arg0) { + const ret = getObject(arg0).done; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_value_0c248a78fdc8e19f = function() { return logError(function (arg0) { + const ret = getObject(arg0).value; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_isSafeInteger_f93fde0dca9820f8 = function() { return logError(function (arg0) { + const ret = Number.isSafeInteger(getObject(arg0)); + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_entries_9e2e2aa45aa5094a = function() { return logError(function (arg0) { + const ret = Object.entries(getObject(arg0)); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_new_9fb8d994e1c0aaac = function() { return logError(function () { + const ret = new Object(); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_length_36658cb09b6ec34a = function() { return logError(function (arg0) { + const ret = getObject(arg0).length; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_charCodeAt_ae37a5e09da14dab = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg0).charCodeAt(arg1 >>> 0); + return ret; +}, arguments) }; +imports.wbg.__wbg_iterator_db7ca081358d4fb2 = function() { return logError(function () { + const ret = Symbol.iterator; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_resolve_6e1c6553a82f85b7 = function() { return logError(function (arg0) { + const ret = Promise.resolve(getObject(arg0)); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_then_3ab08cd4fbb91ae9 = function() { return logError(function (arg0, arg1) { + const ret = getObject(arg0).then(getObject(arg1)); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_globalThis_9caa27ff917c6860 = function() { return handleError(function () { + const ret = globalThis.globalThis; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_self_f0e34d89f33b99fd = function() { return handleError(function () { + const ret = self.self; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_window_d3b084224f4774d7 = function() { return handleError(function () { + const ret = window.window; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_global_35dfdd59a4da3e74 = function() { return handleError(function () { + const ret = global.global; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_instanceof_Uint8Array_bced6f43aed8c1aa = function() { return logError(function (arg0) { + let result; + try { + result = getObject(arg0) instanceof Uint8Array; + } catch (_) { + result = false; + } + const ret = result; + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_new_8f67e318f15d7254 = function() { return logError(function (arg0) { + const ret = new Uint8Array(getObject(arg0)); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_length_1d25fa9e4ac21ce7 = function() { return logError(function (arg0) { + const ret = getObject(arg0).length; + _assertNum(ret); + return ret; +}, arguments) }; +imports.wbg.__wbg_set_2357bf09366ee480 = function() { return logError(function (arg0, arg1, arg2) { + getObject(arg0).set(getObject(arg1), arg2 >>> 0); +}, arguments) }; +imports.wbg.__wbg_buffer_a448f833075b71ba = function() { return logError(function (arg0) { + const ret = getObject(arg0).buffer; + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_stringify_e1b19966d964d242 = function() { return handleError(function (arg0) { + const ret = JSON.stringify(getObject(arg0)); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbindgen_is_string = function(arg0) { + const ret = typeof(getObject(arg0)) === 'string'; + _assertBoolean(ret); + return ret; +}; +imports.wbg.__wbg_get_7b48513de5dc5ea4 = function() { return handleError(function (arg0, arg1) { + const ret = Reflect.get(getObject(arg0), getObject(arg1)); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbg_set_759f75cd92b612d2 = function() { return handleError(function (arg0, arg1, arg2) { + const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2)); + _assertBoolean(ret); + return ret; +}, arguments) }; +imports.wbg.__wbindgen_debug_string = function(arg0, arg1) { + const ret = debugString(getObject(arg1)); + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; +}; +imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) { + const v = getObject(arg1); + const ret = typeof(v) === 'bigint' ? v : undefined; + if (!isLikeNone(ret)) { + _assertBigInt(ret); + } + getBigInt64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? BigInt(0) : ret; + getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret); +}; +imports.wbg.__wbindgen_object_drop_ref = function(arg0) { + takeObject(arg0); +}; +imports.wbg.__wbindgen_throw = function(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; +imports.wbg.__wbindgen_memory = function() { + const ret = wasm.memory; + return addHeapObject(ret); +}; +imports.wbg.__wbindgen_closure_wrapper1405 = function() { return logError(function (arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 129, __wbg_adapter_48); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbindgen_closure_wrapper1407 = function() { return logError(function (arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 125, __wbg_adapter_51); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbindgen_closure_wrapper1409 = function() { return logError(function (arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 127, __wbg_adapter_54); + return addHeapObject(ret); +}, arguments) }; +imports.wbg.__wbindgen_closure_wrapper3284 = function() { return logError(function (arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 358, __wbg_adapter_57); + return addHeapObject(ret); +}, arguments) }; +imports['./snippets/dioxus-interpreter-js-85a0a2f8acce2e86/inline0.js'] = __wbg_star0; + +return imports; +} + +function __wbg_init_memory(imports, maybe_memory) { + +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedBigInt64Memory0 = null; + cachedFloat64Memory0 = null; + cachedInt32Memory0 = null; + cachedUint32Memory0 = null; + cachedUint8Memory0 = null; + + wasm.__wbindgen_start(); + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); + } + + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); +} + +async function __wbg_init(input) { + if (wasm !== undefined) return wasm; + + + const imports = __wbg_get_imports(); + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await input, imports); + + return __wbg_finalize_init(instance, module); +} + +export { initSync } +export default __wbg_init; diff --git a/packages/playwright-tests/web/dist/assets/dioxus/name_bg.wasm b/packages/playwright-tests/web/dist/assets/dioxus/name_bg.wasm new file mode 100644 index 000000000..3909b0e12 Binary files /dev/null and b/packages/playwright-tests/web/dist/assets/dioxus/name_bg.wasm differ diff --git a/packages/playwright-tests/web/dist/assets/dioxus/snippets/dioxus-interpreter-js-85a0a2f8acce2e86/inline0.js b/packages/playwright-tests/web/dist/assets/dioxus/snippets/dioxus-interpreter-js-85a0a2f8acce2e86/inline0.js new file mode 100644 index 000000000..65a9d22d2 --- /dev/null +++ b/packages/playwright-tests/web/dist/assets/dioxus/snippets/dioxus-interpreter-js-85a0a2f8acce2e86/inline0.js @@ -0,0 +1,349 @@ +let m,p,ls,d,t,op,i,e,z,metaflags; + export function setAttributeInner(node, field, value, ns) { + const name = field; + if (ns === "style") { + // ????? why do we need to do this + if (node.style === undefined) { + node.style = {}; + } + node.style[name] = value; + } else if (!!ns) { + node.setAttributeNS(ns, name, value); + } else { + switch (name) { + case "value": + if (value !== node.value) { + node.value = value; + } + break; + case "initial_value": + node.defaultValue = value; + break; + case "checked": + node.checked = truthy(value); + break; + case "initial_checked": + node.defaultChecked = truthy(value); + break; + case "selected": + node.selected = truthy(value); + break; + case "initial_selected": + node.defaultSelected = truthy(value); + break; + case "dangerous_inner_html": + node.innerHTML = value; + break; + default: + // https://github.com/facebook/react/blob/8b88ac2592c5f555f315f9440cbb665dd1e7457a/packages/react-dom/src/shared/DOMProperty.js#L352-L364 + if (!truthy(value) && bool_attrs.hasOwnProperty(name)) { + node.removeAttribute(name); + } else { + node.setAttribute(name, value); + } + } + } +} + +const bool_attrs = { + allowfullscreen: true, + allowpaymentrequest: true, + async: true, + autofocus: true, + autoplay: true, + checked: true, + controls: true, + default: true, + defer: true, + disabled: true, + formnovalidate: true, + hidden: true, + ismap: true, + itemscope: true, + loop: true, + multiple: true, + muted: true, + nomodule: true, + novalidate: true, + open: true, + playsinline: true, + readonly: true, + required: true, + reversed: true, + selected: true, + truespeed: true, + webkitdirectory: true, +}; + +function truthy(val) { + return val === "true" || val === true; +} + + class ListenerMap { + constructor(root) { + // bubbling events can listen at the root element + this.global = {}; + // non bubbling events listen at the element the listener was created at + this.local = {}; + this.root = null; + this.handler = null; + } + + create(event_name, element, bubbles) { + if (bubbles) { + if (this.global[event_name] === undefined) { + this.global[event_name] = {}; + this.global[event_name].active = 1; + this.root.addEventListener(event_name, this.handler); + } else { + this.global[event_name].active++; + } + } + else { + const id = element.getAttribute("data-dioxus-id"); + if (!this.local[id]) { + this.local[id] = {}; + } + element.addEventListener(event_name, this.handler); + } + } + + remove(element, event_name, bubbles) { + if (bubbles) { + this.global[event_name].active--; + if (this.global[event_name].active === 0) { + this.root.removeEventListener(event_name, this.global[event_name].callback); + delete this.global[event_name]; + } + } + else { + const id = element.getAttribute("data-dioxus-id"); + delete this.local[id][event_name]; + if (this.local[id].length === 0) { + delete this.local[id]; + } + element.removeEventListener(event_name, this.handler); + } + } + + removeAllNonBubbling(element) { + const id = element.getAttribute("data-dioxus-id"); + delete this.local[id]; + } + } + function LoadChild(ptr, len) { + // iterate through each number and get that child + node = stack[stack.length - 1]; + ptr_end = ptr + len; + for (; ptr < ptr_end; ptr++) { + end = m.getUint8(ptr); + for (node = node.firstChild; end > 0; end--) { + node = node.nextSibling; + } + } + return node; + } + const listeners = new ListenerMap(); + let nodes = []; + let stack = []; + let root; + const templates = {}; + let node, els, end, ptr_end, k; + export function save_template(nodes, tmpl_id) { + templates[tmpl_id] = nodes; + } + export function hydrate(ids) { + console.log("hydrating", ids); + const hydrateNodes = document.querySelectorAll('[data-node-hydration]'); + for (let i = 0; i < hydrateNodes.length; i++) { + const hydrateNode = hydrateNodes[i]; + const hydration = hydrateNode.getAttribute('data-node-hydration'); + const split = hydration.split(','); + const id = ids[parseInt(split[0])]; + nodes[id] = hydrateNode; + console.log("hydrating node", hydrateNode, id); + if (split.length > 1) { + hydrateNode.listening = split.length - 1; + hydrateNode.setAttribute('data-dioxus-id', id); + for (let j = 1; j < split.length; j++) { + const listener = split[j]; + const split2 = listener.split(':'); + const event_name = split2[0]; + const bubbles = split2[1] === '1'; + console.log("hydrating listener", event_name, bubbles); + listeners.create(event_name, hydrateNode, bubbles); + } + } + } + const treeWalker = document.createTreeWalker( + document.body, + NodeFilter.SHOW_COMMENT, + ); + let currentNode = treeWalker.nextNode(); + while (currentNode) { + const id = currentNode.textContent; + const split = id.split('node-id'); + if (split.length > 1) { + console.log("hydrating text", currentNode.nextSibling, id); + nodes[ids[parseInt(split[1])]] = currentNode.nextSibling; + } + currentNode = treeWalker.nextNode(); + } + } + export function get_node(id) { + return nodes[id]; + } + export function initialize(root, handler) { + listeners.handler = handler; + nodes = [root]; + stack = [root]; + listeners.root = root; + } + function AppendChildren(id, many){ + root = nodes[id]; + els = stack.splice(stack.length-many); + for (k = 0; k < many; k++) { + root.appendChild(els[k]); + } + } + let u8buf,u8bufp;let u32buf,u32bufp;let s = "";let lsp,sp,sl; let c = new TextDecoder();const ns_cache = []; + let ns_cache_cache_hit, ns_cache_cache_idx; + function get_ns_cache() { + ns_cache_cache_idx = u8buf[u8bufp++]; + if(ns_cache_cache_idx & 128){ + ns_cache_cache_hit=s.substring(sp,sp+=u8buf[u8bufp++]); + ns_cache[ns_cache_cache_idx&4294967167]=ns_cache_cache_hit; + return ns_cache_cache_hit; + } + else{ + return ns_cache[ns_cache_cache_idx&4294967167]; + } + }const evt = []; + let evt_cache_hit, evt_cache_idx; + function get_evt() { + evt_cache_idx = u8buf[u8bufp++]; + if(evt_cache_idx & 128){ + evt_cache_hit=s.substring(sp,sp+=u8buf[u8bufp++]); + evt[evt_cache_idx&4294967167]=evt_cache_hit; + return evt_cache_hit; + } + else{ + return evt[evt_cache_idx&4294967167]; + } + }let u16buf,u16bufp;const attr = []; + let attr_cache_hit, attr_cache_idx; + function get_attr() { + attr_cache_idx = u8buf[u8bufp++]; + if(attr_cache_idx & 128){ + attr_cache_hit=s.substring(sp,sp+=u8buf[u8bufp++]); + attr[attr_cache_idx&4294967167]=attr_cache_hit; + return attr_cache_hit; + } + else{ + return attr[attr_cache_idx&4294967167]; + } + } + let bubbles,ns,len,event_name,ptr,id,field,value; + export function create(r){ + d=r; + } + export function update_memory(b){ + m=new DataView(b.buffer) + } + export function run(){ + metaflags=m.getUint32(d,true); + if((metaflags>>>6)&1){ + ls=m.getUint32(d+6*4,true); + } + p=ls; + if ((metaflags>>>5)&1){ + t = m.getUint32(d+5*4,true); + u8buf=new Uint8Array(m.buffer,t,((m.buffer.byteLength-t)-(m.buffer.byteLength-t)%1)/1); + } + u8bufp=0;if ((metaflags>>>3)&1){ + t = m.getUint32(d+3*4,true); + u32buf=new Uint32Array(m.buffer,t,((m.buffer.byteLength-t)-(m.buffer.byteLength-t)%4)/4); + } + u32bufp=0;if (metaflags&1){ + lsp = m.getUint32(d+1*4,true); + } + if ((metaflags>>>2)&1) { + sl = m.getUint32(d+2*4,true); + if ((metaflags>>>1)&1) { + sp = lsp; + s = ""; + e = sp + ((sl / 4) | 0) * 4; + while (sp < e) { + t = m.getUint32(sp, true); + s += String.fromCharCode( + t & 255, + (t & 65280) >> 8, + (t & 16711680) >> 16, + t >> 24 + ); + sp += 4; + } + while (sp < lsp + sl) { + s += String.fromCharCode(m.getUint8(sp++)); + } + } else { + s = c.decode(new DataView(m.buffer, lsp, sl)); + } + } + sp=0;if ((metaflags>>>4)&1){ + t = m.getUint32(d+4*4,true); + u16buf=new Uint16Array(m.buffer,t,((m.buffer.byteLength-t)-(m.buffer.byteLength-t)%2)/2); + } + u16bufp=0; + for(;;){ + op=m.getUint32(p,true); + p+=4; + z=0; + while(z++<4){ + switch(op&255){ + case 0:{AppendChildren(root, stack.length-1);}break;case 1:{stack.push(nodes[u32buf[u32bufp++]]);}break;case 2:{AppendChildren(u32buf[u32bufp++], u16buf[u16bufp++]);}break;case 3:{stack.pop();}break;case 4:{root = nodes[u32buf[u32bufp++]]; els = stack.splice(stack.length-u16buf[u16bufp++]); if (root.listening) { listeners.removeAllNonBubbling(root); } root.replaceWith(...els);}break;case 5:{nodes[u32buf[u32bufp++]].after(...stack.splice(stack.length-u16buf[u16bufp++]));}break;case 6:{nodes[u32buf[u32bufp++]].before(...stack.splice(stack.length-u16buf[u16bufp++]));}break;case 7:{node = nodes[u32buf[u32bufp++]]; if (node !== undefined) { if (node.listening) { listeners.removeAllNonBubbling(node); } node.remove(); }}break;case 8:{stack.push(document.createTextNode(s.substring(sp,sp+=u32buf[u32bufp++])));}break;case 9:{node = document.createTextNode(s.substring(sp,sp+=u32buf[u32bufp++])); nodes[u32buf[u32bufp++]] = node; stack.push(node);}break;case 10:{node = document.createElement('pre'); node.hidden = true; stack.push(node); nodes[u32buf[u32bufp++]] = node;}break;case 11:event_name=get_evt();id=u32buf[u32bufp++];bubbles=u8buf[u8bufp++];node = nodes[id]; if(node.listening){node.listening += 1;}else{node.listening = 1;} node.setAttribute('data-dioxus-id', `${id}`); listeners.create(event_name, node, bubbles);break;case 12:{node = nodes[u32buf[u32bufp++]]; node.listening -= 1; node.removeAttribute('data-dioxus-id'); listeners.remove(node, get_evt(), u8buf[u8bufp++]);}break;case 13:{nodes[u32buf[u32bufp++]].textContent = s.substring(sp,sp+=u32buf[u32bufp++]);}break;case 14:{node = nodes[u32buf[u32bufp++]]; setAttributeInner(node, get_attr(), s.substring(sp,sp+=u32buf[u32bufp++]), get_ns_cache());}break;case 15:id=u32buf[u32bufp++];field=get_attr();ns=get_ns_cache();{ + node = nodes[id]; + if (!ns) { + switch (field) { + case "value": + node.value = ""; + break; + case "checked": + node.checked = false; + break; + case "selected": + node.selected = false; + break; + case "dangerous_inner_html": + node.innerHTML = ""; + break; + default: + node.removeAttribute(field); + break; + } + } else if (ns == "style") { + node.style.removeProperty(name); + } else { + node.removeAttributeNS(ns, field); + } + }break;case 16:{nodes[u32buf[u32bufp++]] = LoadChild(u32buf[u32bufp++], u8buf[u8bufp++]);}break;case 17:ptr=u32buf[u32bufp++];len=u8buf[u8bufp++];value=s.substring(sp,sp+=u32buf[u32bufp++]);id=u32buf[u32bufp++];{ + node = LoadChild(ptr, len); + if (node.nodeType == Node.TEXT_NODE) { + node.textContent = value; + } else { + let text = document.createTextNode(value); + node.replaceWith(text); + node = text; + } + nodes[id] = node; + }break;case 18:{els = stack.splice(stack.length - u16buf[u16bufp++]); node = LoadChild(u32buf[u32bufp++], u8buf[u8bufp++]); node.replaceWith(...els);}break;case 19:{node = templates[u16buf[u16bufp++]][u16buf[u16bufp++]].cloneNode(true); nodes[u32buf[u32bufp++]] = node; stack.push(node);}break;case 20:return true; + } + op>>>=8; + } + } + } + export function run_from_bytes(bytes){ + d = 0; + update_memory(new Uint8Array(bytes)) + run() + } \ No newline at end of file diff --git a/packages/playwright-tests/web/dist/assets/dioxus/snippets/dioxus-interpreter-js-85a0a2f8acce2e86/src/common.js b/packages/playwright-tests/web/dist/assets/dioxus/snippets/dioxus-interpreter-js-85a0a2f8acce2e86/src/common.js new file mode 100644 index 000000000..0c64085f9 --- /dev/null +++ b/packages/playwright-tests/web/dist/assets/dioxus/snippets/dioxus-interpreter-js-85a0a2f8acce2e86/src/common.js @@ -0,0 +1,79 @@ +export function setAttributeInner(node, field, value, ns) { + const name = field; + if (ns === "style") { + // ????? why do we need to do this + if (node.style === undefined) { + node.style = {}; + } + node.style[name] = value; + } else if (!!ns) { + node.setAttributeNS(ns, name, value); + } else { + switch (name) { + case "value": + if (value !== node.value) { + node.value = value; + } + break; + case "initial_value": + node.defaultValue = value; + break; + case "checked": + node.checked = truthy(value); + break; + case "initial_checked": + node.defaultChecked = truthy(value); + break; + case "selected": + node.selected = truthy(value); + break; + case "initial_selected": + node.defaultSelected = truthy(value); + break; + case "dangerous_inner_html": + node.innerHTML = value; + break; + default: + // https://github.com/facebook/react/blob/8b88ac2592c5f555f315f9440cbb665dd1e7457a/packages/react-dom/src/shared/DOMProperty.js#L352-L364 + if (!truthy(value) && bool_attrs.hasOwnProperty(name)) { + node.removeAttribute(name); + } else { + node.setAttribute(name, value); + } + } + } +} + +const bool_attrs = { + allowfullscreen: true, + allowpaymentrequest: true, + async: true, + autofocus: true, + autoplay: true, + checked: true, + controls: true, + default: true, + defer: true, + disabled: true, + formnovalidate: true, + hidden: true, + ismap: true, + itemscope: true, + loop: true, + multiple: true, + muted: true, + nomodule: true, + novalidate: true, + open: true, + playsinline: true, + readonly: true, + required: true, + reversed: true, + selected: true, + truespeed: true, + webkitdirectory: true, +}; + +function truthy(val) { + return val === "true" || val === true; +} diff --git a/packages/playwright-tests/web/dist/assets/dioxus/snippets/dioxus-web-a95d8cc6c91ff8eb/inline0.js b/packages/playwright-tests/web/dist/assets/dioxus/snippets/dioxus-web-a95d8cc6c91ff8eb/inline0.js new file mode 100644 index 000000000..1bcaeedb8 --- /dev/null +++ b/packages/playwright-tests/web/dist/assets/dioxus/snippets/dioxus-web-a95d8cc6c91ff8eb/inline0.js @@ -0,0 +1,22 @@ + +export function get_form_data(form) { + let values = new Map(); + const formData = new FormData(form); + + for (let name of formData.keys()) { + const fieldType = target.elements[name].type; + + switch (fieldType) { + case "select-multiple": + contents.values[name] = formData.getAll(name); + break; + + // add cases for fieldTypes that can hold multiple values here + default: + contents.values[name] = formData.get(name); + break; + } + } + + return values; +} diff --git a/packages/playwright-tests/web/dist/assets/dioxus/snippets/dioxus-web-a95d8cc6c91ff8eb/src/eval.js b/packages/playwright-tests/web/dist/assets/dioxus/snippets/dioxus-web-a95d8cc6c91ff8eb/src/eval.js new file mode 100644 index 000000000..959d422eb --- /dev/null +++ b/packages/playwright-tests/web/dist/assets/dioxus/snippets/dioxus-web-a95d8cc6c91ff8eb/src/eval.js @@ -0,0 +1,41 @@ +export class Dioxus { + constructor(sendCallback, returnCallback) { + this.sendCallback = sendCallback; + this.returnCallback = returnCallback; + this.promiseResolve = null; + this.received = []; + } + + // Receive message from Rust + recv() { + return new Promise((resolve, _reject) => { + // If data already exists, resolve immediately + let data = this.received.shift(); + if (data) { + resolve(data); + return; + } + + // Otherwise set a resolve callback + this.promiseResolve = resolve; + }); + } + + // Send message to rust. + send(data) { + this.sendCallback(data); + } + + // Internal rust send + rustSend(data) { + // If a promise is waiting for data, resolve it, and clear the resolve callback + if (this.promiseResolve) { + this.promiseResolve(data); + this.promiseResolve = null; + return; + } + + // Otherwise add the data to a queue + this.received.push(data); + } +} \ No newline at end of file diff --git a/packages/playwright-tests/web/dist/index.html b/packages/playwright-tests/web/dist/index.html new file mode 100644 index 000000000..f7830275d --- /dev/null +++ b/packages/playwright-tests/web/dist/index.html @@ -0,0 +1,47 @@ + + + + dioxus | ⛺ + + + + + + +
+ + + + \ No newline at end of file diff --git a/playwright-tests/web/src/main.rs b/packages/playwright-tests/web/src/main.rs similarity index 100% rename from playwright-tests/web/src/main.rs rename to packages/playwright-tests/web/src/main.rs