@thi.ng/wasm-api-dom
Advanced tools
Comparing version 1.0.8 to 1.0.9
# Change Log | ||
- **Last updated**: 2024-11-09T16:30:54Z | ||
- **Last updated**: 2024-11-10T17:11:51Z | ||
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub) | ||
@@ -12,2 +12,9 @@ | ||
### [1.0.9](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api-dom@1.0.9) (2024-11-10) | ||
#### ♻️ Refactoring | ||
- regenerate typescript bindings ([07e939a](https://github.com/thi-ng/umbrella/commit/07e939a)) | ||
- regenerate TS bindings ([c540cb4](https://github.com/thi-ng/umbrella/commit/c540cb4)) | ||
### [1.0.8](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api-dom@1.0.8) (2024-11-09) | ||
@@ -14,0 +21,0 @@ |
@@ -48,3 +48,3 @@ import type { NumOrString } from "@thi.ng/api"; | ||
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; | ||
} | NodeListOf<ChildNode> | ((other: Node | null) => boolean) | ((options?: GetRootNodeOptions) => Node) | (<T extends Node>(node: T, child: Node | null) => T) | ((...nodes: (Node | string)[]) => void) | ((keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions) => Animation) | ((options?: GetAnimationsOptions) => Animation[]) | HTMLCollection | null; | ||
} | NodeListOf<ChildNode> | ((other: Node | null) => boolean) | ((options?: GetRootNodeOptions) => Node) | (<T extends Node>(node: T, child: Node | null) => T) | ((...nodes: (Node | string)[]) => void) | HTMLCollection | ((keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions) => Animation) | ((options?: GetAnimationsOptions) => Animation[]) | null; | ||
protected setAttrib(elementID: number, nameAddr: number, value: NumOrString): void | NumOrString; | ||
@@ -51,0 +51,0 @@ protected removeListener(ctx: Window | Element, listenerID: number): void; |
/** | ||
* Generated by @thi.ng/wasm-api-bindgen at 2024-11-09T16:15:11.536Z | ||
* Generated by @thi.ng/wasm-api-bindgen at 2024-11-10T16:53:43.244Z | ||
* DO NOT EDIT! | ||
*/ | ||
import { WasmStringPtr, type MemorySlice, type WasmTypeBase, type WasmTypeConstructor } from "@thi.ng/wasm-api"; | ||
import { WasmStringPtr, type MemorySlice, type WasmTypeBase } from "@thi.ng/wasm-api"; | ||
export declare enum EventType { | ||
@@ -83,3 +83,3 @@ UNKOWN = -1, | ||
} | ||
export declare const $WindowInfo: WasmTypeConstructor<WindowInfo>; | ||
export declare const $WindowInfo: import("@thi.ng/wasm-api").WasmTypeConstructor<WindowInfo>; | ||
export interface DragEvent extends WasmTypeBase { | ||
@@ -130,3 +130,3 @@ /** | ||
} | ||
export declare const $DragEvent: WasmTypeConstructor<DragEvent>; | ||
export declare const $DragEvent: import("@thi.ng/wasm-api").WasmTypeConstructor<DragEvent>; | ||
export interface InputEvent extends WasmTypeBase { | ||
@@ -155,3 +155,3 @@ /** | ||
} | ||
export declare const $InputEvent: WasmTypeConstructor<InputEvent>; | ||
export declare const $InputEvent: import("@thi.ng/wasm-api").WasmTypeConstructor<InputEvent>; | ||
export interface KeyEvent extends WasmTypeBase { | ||
@@ -189,3 +189,3 @@ /** | ||
} | ||
export declare const $KeyEvent: WasmTypeConstructor<KeyEvent>; | ||
export declare const $KeyEvent: import("@thi.ng/wasm-api").WasmTypeConstructor<KeyEvent>; | ||
export interface MouseEvent extends WasmTypeBase { | ||
@@ -227,3 +227,3 @@ /** | ||
} | ||
export declare const $MouseEvent: WasmTypeConstructor<MouseEvent>; | ||
export declare const $MouseEvent: import("@thi.ng/wasm-api").WasmTypeConstructor<MouseEvent>; | ||
export interface PointerEvent extends WasmTypeBase { | ||
@@ -313,3 +313,3 @@ /** | ||
} | ||
export declare const $PointerEvent: WasmTypeConstructor<PointerEvent>; | ||
export declare const $PointerEvent: import("@thi.ng/wasm-api").WasmTypeConstructor<PointerEvent>; | ||
export interface ScrollEvent extends WasmTypeBase { | ||
@@ -332,3 +332,3 @@ /** | ||
} | ||
export declare const $ScrollEvent: WasmTypeConstructor<ScrollEvent>; | ||
export declare const $ScrollEvent: import("@thi.ng/wasm-api").WasmTypeConstructor<ScrollEvent>; | ||
export interface TouchEvent extends WasmTypeBase { | ||
@@ -358,3 +358,3 @@ /** | ||
} | ||
export declare const $TouchEvent: WasmTypeConstructor<TouchEvent>; | ||
export declare const $TouchEvent: import("@thi.ng/wasm-api").WasmTypeConstructor<TouchEvent>; | ||
export interface WheelEvent extends WasmTypeBase { | ||
@@ -402,3 +402,3 @@ /** | ||
} | ||
export declare const $WheelEvent: WasmTypeConstructor<WheelEvent>; | ||
export declare const $WheelEvent: import("@thi.ng/wasm-api").WasmTypeConstructor<WheelEvent>; | ||
export interface EventBody extends WasmTypeBase { | ||
@@ -414,3 +414,3 @@ readonly drag: DragEvent; | ||
} | ||
export declare const $EventBody: WasmTypeConstructor<EventBody>; | ||
export declare const $EventBody: import("@thi.ng/wasm-api").WasmTypeConstructor<EventBody>; | ||
export interface Event extends WasmTypeBase { | ||
@@ -445,3 +445,3 @@ id: EventType; | ||
} | ||
export declare const $Event: WasmTypeConstructor<Event>; | ||
export declare const $Event: import("@thi.ng/wasm-api").WasmTypeConstructor<Event>; | ||
/** | ||
@@ -452,3 +452,3 @@ * DOM event listener | ||
} | ||
export declare const $EventListener: WasmTypeConstructor<EventListener>; | ||
export declare const $EventListener: import("@thi.ng/wasm-api").WasmTypeConstructor<EventListener>; | ||
/** | ||
@@ -510,3 +510,3 @@ * Data structure used for declarative creation of DOM elements / trees (passed | ||
} | ||
export declare const $CreateElementOpts: WasmTypeConstructor<CreateElementOpts>; | ||
export declare const $CreateElementOpts: import("@thi.ng/wasm-api").WasmTypeConstructor<CreateElementOpts>; | ||
/** | ||
@@ -567,3 +567,3 @@ * Data structure used for declarative creation of canvas elements (passed to | ||
} | ||
export declare const $CreateCanvasOpts: WasmTypeConstructor<CreateCanvasOpts>; | ||
export declare const $CreateCanvasOpts: import("@thi.ng/wasm-api").WasmTypeConstructor<CreateCanvasOpts>; | ||
/** | ||
@@ -577,3 +577,3 @@ * DOM element attribute definition given as part of `CreateElementOpts` | ||
} | ||
export declare const $Attrib: WasmTypeConstructor<Attrib>; | ||
export declare const $Attrib: import("@thi.ng/wasm-api").WasmTypeConstructor<Attrib>; | ||
export interface AttribValue extends WasmTypeBase { | ||
@@ -591,3 +591,3 @@ readonly event: EventListener; | ||
} | ||
export declare const $AttribValue: WasmTypeConstructor<AttribValue>; | ||
export declare const $AttribValue: import("@thi.ng/wasm-api").WasmTypeConstructor<AttribValue>; | ||
export declare enum AttribType { | ||
@@ -594,0 +594,0 @@ EVENT = 0, |
1275
generated/api.js
@@ -1,2 +0,2 @@ | ||
import { Pointer, WasmStringPtr } from "@thi.ng/wasm-api"; | ||
import { defType, Pointer, WasmStringPtr } from "@thi.ng/wasm-api"; | ||
import { __array, __instanceArray, __slice32, __primslice32 } from "@thi.ng/wasm-api/memory"; | ||
@@ -43,793 +43,514 @@ const __str = (mem, base, isConst = true) => new WasmStringPtr(mem, base, isConst); | ||
})(KeyModifier || {}); | ||
const $WindowInfo = (mem) => ({ | ||
get align() { | ||
return 4; | ||
}, | ||
get size() { | ||
return 16; | ||
}, | ||
instanceArray(base, num) { | ||
return __instanceArray(this, base, num); | ||
}, | ||
instance: (base) => { | ||
return { | ||
get __base() { | ||
return base; | ||
}, | ||
get __bytes() { | ||
return mem.u8.subarray(base, base + 16); | ||
}, | ||
get innerWidth() { | ||
return mem.u16[base >>> 1]; | ||
}, | ||
set innerWidth(x) { | ||
mem.u16[base >>> 1] = x; | ||
}, | ||
get innerHeight() { | ||
return mem.u16[base + 2 >>> 1]; | ||
}, | ||
set innerHeight(x) { | ||
mem.u16[base + 2 >>> 1] = x; | ||
}, | ||
get scrollX() { | ||
return mem.f32[base + 4 >>> 2]; | ||
}, | ||
set scrollX(x) { | ||
mem.f32[base + 4 >>> 2] = x; | ||
}, | ||
get scrollY() { | ||
return mem.f32[base + 8 >>> 2]; | ||
}, | ||
set scrollY(x) { | ||
mem.f32[base + 8 >>> 2] = x; | ||
}, | ||
get dpr() { | ||
return mem.u8[base + 12]; | ||
}, | ||
set dpr(x) { | ||
mem.u8[base + 12] = x; | ||
}, | ||
get fullscreen() { | ||
return mem.u8[base + 13]; | ||
}, | ||
set fullscreen(x) { | ||
mem.u8[base + 13] = x; | ||
} | ||
}; | ||
} | ||
const $WindowInfo = defType(4, 16, (mem, base) => { | ||
return { | ||
get innerWidth() { | ||
return mem.u16[base >>> 1]; | ||
}, | ||
set innerWidth(x) { | ||
mem.u16[base >>> 1] = x; | ||
}, | ||
get innerHeight() { | ||
return mem.u16[base + 2 >>> 1]; | ||
}, | ||
set innerHeight(x) { | ||
mem.u16[base + 2 >>> 1] = x; | ||
}, | ||
get scrollX() { | ||
return mem.f32[base + 4 >>> 2]; | ||
}, | ||
set scrollX(x) { | ||
mem.f32[base + 4 >>> 2] = x; | ||
}, | ||
get scrollY() { | ||
return mem.f32[base + 8 >>> 2]; | ||
}, | ||
set scrollY(x) { | ||
mem.f32[base + 8 >>> 2] = x; | ||
}, | ||
get dpr() { | ||
return mem.u8[base + 12]; | ||
}, | ||
set dpr(x) { | ||
mem.u8[base + 12] = x; | ||
}, | ||
get fullscreen() { | ||
return mem.u8[base + 13]; | ||
}, | ||
set fullscreen(x) { | ||
mem.u8[base + 13] = x; | ||
} | ||
}; | ||
}); | ||
const $DragEvent = (mem) => ({ | ||
get align() { | ||
return 2; | ||
}, | ||
get size() { | ||
return 8; | ||
}, | ||
instanceArray(base, num) { | ||
return __instanceArray(this, base, num); | ||
}, | ||
instance: (base) => { | ||
return { | ||
get __base() { | ||
return base; | ||
}, | ||
get __bytes() { | ||
return mem.u8.subarray(base, base + 8); | ||
}, | ||
get clientX() { | ||
return mem.i16[base >>> 1]; | ||
}, | ||
set clientX(x) { | ||
mem.i16[base >>> 1] = x; | ||
}, | ||
get clientY() { | ||
return mem.i16[base + 2 >>> 1]; | ||
}, | ||
set clientY(x) { | ||
mem.i16[base + 2 >>> 1] = x; | ||
}, | ||
get isDataTransfer() { | ||
return mem.u8[base + 4]; | ||
}, | ||
set isDataTransfer(x) { | ||
mem.u8[base + 4] = x; | ||
}, | ||
get modifiers() { | ||
return mem.u8[base + 5]; | ||
}, | ||
set modifiers(x) { | ||
mem.u8[base + 5] = x; | ||
}, | ||
get buttons() { | ||
return mem.u8[base + 6]; | ||
}, | ||
set buttons(x) { | ||
mem.u8[base + 6] = x; | ||
}, | ||
get button() { | ||
return mem.u8[base + 7]; | ||
}, | ||
set button(x) { | ||
mem.u8[base + 7] = x; | ||
}, | ||
fromEvent(e) { | ||
const bounds = e.target.getBoundingClientRect(); | ||
this.clientX = e.clientX - bounds.left; | ||
this.clientY = e.clientY - bounds.top; | ||
this.buttons = e.buttons; | ||
this.button = e.button; | ||
this.isDataTransfer = e.dataTransfer ? 1 : 0; | ||
} | ||
}; | ||
} | ||
const $DragEvent = defType(2, 8, (mem, base) => { | ||
return { | ||
get clientX() { | ||
return mem.i16[base >>> 1]; | ||
}, | ||
set clientX(x) { | ||
mem.i16[base >>> 1] = x; | ||
}, | ||
get clientY() { | ||
return mem.i16[base + 2 >>> 1]; | ||
}, | ||
set clientY(x) { | ||
mem.i16[base + 2 >>> 1] = x; | ||
}, | ||
get isDataTransfer() { | ||
return mem.u8[base + 4]; | ||
}, | ||
set isDataTransfer(x) { | ||
mem.u8[base + 4] = x; | ||
}, | ||
get modifiers() { | ||
return mem.u8[base + 5]; | ||
}, | ||
set modifiers(x) { | ||
mem.u8[base + 5] = x; | ||
}, | ||
get buttons() { | ||
return mem.u8[base + 6]; | ||
}, | ||
set buttons(x) { | ||
mem.u8[base + 6] = x; | ||
}, | ||
get button() { | ||
return mem.u8[base + 7]; | ||
}, | ||
set button(x) { | ||
mem.u8[base + 7] = x; | ||
}, | ||
fromEvent(e) { | ||
const bounds = e.target.getBoundingClientRect(); | ||
this.clientX = e.clientX - bounds.left; | ||
this.clientY = e.clientY - bounds.top; | ||
this.buttons = e.buttons; | ||
this.button = e.button; | ||
this.isDataTransfer = e.dataTransfer ? 1 : 0; | ||
} | ||
}; | ||
}); | ||
const $InputEvent = (mem) => ({ | ||
get align() { | ||
return 4; | ||
}, | ||
get size() { | ||
return 12; | ||
}, | ||
instanceArray(base, num) { | ||
return __instanceArray(this, base, num); | ||
}, | ||
instance: (base) => { | ||
let $value = null; | ||
return { | ||
get __base() { | ||
return base; | ||
}, | ||
get __bytes() { | ||
return mem.u8.subarray(base, base + 12); | ||
}, | ||
get value() { | ||
return $value || ($value = __str(mem, base)); | ||
}, | ||
get len() { | ||
return mem.u32[base + 4 >>> 2]; | ||
}, | ||
set len(x) { | ||
mem.u32[base + 4 >>> 2] = x; | ||
}, | ||
get modifiers() { | ||
return mem.u8[base + 8]; | ||
}, | ||
set modifiers(x) { | ||
mem.u8[base + 8] = x; | ||
}, | ||
fromEvent(e) { | ||
const el = e.target; | ||
const value = el.type === "checkbox" ? el.checked ? "on" : "off" : el.value; | ||
const slice = this.value.setAlloc(value); | ||
this.len = slice[1] - 1; | ||
return slice; | ||
} | ||
}; | ||
} | ||
const $InputEvent = defType(4, 12, (mem, base) => { | ||
let $value; | ||
return { | ||
get value() { | ||
return $value || ($value = __str(mem, base)); | ||
}, | ||
get len() { | ||
return mem.u32[base + 4 >>> 2]; | ||
}, | ||
set len(x) { | ||
mem.u32[base + 4 >>> 2] = x; | ||
}, | ||
get modifiers() { | ||
return mem.u8[base + 8]; | ||
}, | ||
set modifiers(x) { | ||
mem.u8[base + 8] = x; | ||
}, | ||
fromEvent(e) { | ||
const el = e.target; | ||
const value = el.type === "checkbox" ? el.checked ? "on" : "off" : el.value; | ||
const slice = this.value.setAlloc(value); | ||
this.len = slice[1] - 1; | ||
return slice; | ||
} | ||
}; | ||
}); | ||
const $KeyEvent = (mem) => ({ | ||
get align() { | ||
return 1; | ||
}, | ||
get size() { | ||
return 19; | ||
}, | ||
instanceArray(base, num) { | ||
return __instanceArray(this, base, num); | ||
}, | ||
instance: (base) => { | ||
return { | ||
get __base() { | ||
return base; | ||
}, | ||
get __bytes() { | ||
return mem.u8.subarray(base, base + 19); | ||
}, | ||
get key() { | ||
const addr = base; | ||
return mem.u8.subarray(addr, addr + 15); | ||
}, | ||
get len() { | ||
return mem.u8[base + 16]; | ||
}, | ||
set len(x) { | ||
mem.u8[base + 16] = x; | ||
}, | ||
get modifiers() { | ||
return mem.u8[base + 17]; | ||
}, | ||
set modifiers(x) { | ||
mem.u8[base + 17] = x; | ||
}, | ||
get repeat() { | ||
return mem.u8[base + 18]; | ||
}, | ||
set repeat(x) { | ||
mem.u8[base + 18] = x; | ||
}, | ||
fromEvent(e) { | ||
this.len = mem.setString(e.key, this.key.byteOffset, 16, true); | ||
} | ||
}; | ||
} | ||
const $KeyEvent = defType(1, 19, (mem, base) => { | ||
return { | ||
get key() { | ||
const addr = base; | ||
return mem.u8.subarray(addr, addr + 15); | ||
}, | ||
get len() { | ||
return mem.u8[base + 16]; | ||
}, | ||
set len(x) { | ||
mem.u8[base + 16] = x; | ||
}, | ||
get modifiers() { | ||
return mem.u8[base + 17]; | ||
}, | ||
set modifiers(x) { | ||
mem.u8[base + 17] = x; | ||
}, | ||
get repeat() { | ||
return mem.u8[base + 18]; | ||
}, | ||
set repeat(x) { | ||
mem.u8[base + 18] = x; | ||
}, | ||
fromEvent(e) { | ||
this.len = mem.setString(e.key, this.key.byteOffset, 16, true); | ||
} | ||
}; | ||
}); | ||
const $MouseEvent = (mem) => ({ | ||
get align() { | ||
return 2; | ||
}, | ||
get size() { | ||
return 8; | ||
}, | ||
instanceArray(base, num) { | ||
return __instanceArray(this, base, num); | ||
}, | ||
instance: (base) => { | ||
return { | ||
get __base() { | ||
return base; | ||
}, | ||
get __bytes() { | ||
return mem.u8.subarray(base, base + 8); | ||
}, | ||
get clientX() { | ||
return mem.i16[base >>> 1]; | ||
}, | ||
set clientX(x) { | ||
mem.i16[base >>> 1] = x; | ||
}, | ||
get clientY() { | ||
return mem.i16[base + 2 >>> 1]; | ||
}, | ||
set clientY(x) { | ||
mem.i16[base + 2 >>> 1] = x; | ||
}, | ||
get modifiers() { | ||
return mem.u8[base + 4]; | ||
}, | ||
set modifiers(x) { | ||
mem.u8[base + 4] = x; | ||
}, | ||
get buttons() { | ||
return mem.u8[base + 5]; | ||
}, | ||
set buttons(x) { | ||
mem.u8[base + 5] = x; | ||
}, | ||
get button() { | ||
return mem.u8[base + 6]; | ||
}, | ||
set button(x) { | ||
mem.u8[base + 6] = x; | ||
}, | ||
fromEvent(e) { | ||
const bounds = e.target.getBoundingClientRect(); | ||
this.clientX = e.clientX - bounds.left; | ||
this.clientY = e.clientY - bounds.top; | ||
this.buttons = e.buttons; | ||
this.button = e.button; | ||
} | ||
}; | ||
} | ||
const $MouseEvent = defType(2, 8, (mem, base) => { | ||
return { | ||
get clientX() { | ||
return mem.i16[base >>> 1]; | ||
}, | ||
set clientX(x) { | ||
mem.i16[base >>> 1] = x; | ||
}, | ||
get clientY() { | ||
return mem.i16[base + 2 >>> 1]; | ||
}, | ||
set clientY(x) { | ||
mem.i16[base + 2 >>> 1] = x; | ||
}, | ||
get modifiers() { | ||
return mem.u8[base + 4]; | ||
}, | ||
set modifiers(x) { | ||
mem.u8[base + 4] = x; | ||
}, | ||
get buttons() { | ||
return mem.u8[base + 5]; | ||
}, | ||
set buttons(x) { | ||
mem.u8[base + 5] = x; | ||
}, | ||
get button() { | ||
return mem.u8[base + 6]; | ||
}, | ||
set button(x) { | ||
mem.u8[base + 6] = x; | ||
}, | ||
fromEvent(e) { | ||
const bounds = e.target.getBoundingClientRect(); | ||
this.clientX = e.clientX - bounds.left; | ||
this.clientY = e.clientY - bounds.top; | ||
this.buttons = e.buttons; | ||
this.button = e.button; | ||
} | ||
}; | ||
}); | ||
const $PointerEvent = (mem) => ({ | ||
get align() { | ||
return 4; | ||
}, | ||
get size() { | ||
return 24; | ||
}, | ||
instanceArray(base, num) { | ||
return __instanceArray(this, base, num); | ||
}, | ||
instance: (base) => { | ||
return { | ||
get __base() { | ||
return base; | ||
}, | ||
get __bytes() { | ||
return mem.u8.subarray(base, base + 24); | ||
}, | ||
get clientX() { | ||
return mem.i16[base >>> 1]; | ||
}, | ||
set clientX(x) { | ||
mem.i16[base >>> 1] = x; | ||
}, | ||
get clientY() { | ||
return mem.i16[base + 2 >>> 1]; | ||
}, | ||
set clientY(x) { | ||
mem.i16[base + 2 >>> 1] = x; | ||
}, | ||
get id() { | ||
return mem.u32[base + 4 >>> 2]; | ||
}, | ||
set id(x) { | ||
mem.u32[base + 4 >>> 2] = x; | ||
}, | ||
get pressure() { | ||
return mem.f32[base + 8 >>> 2]; | ||
}, | ||
set pressure(x) { | ||
mem.f32[base + 8 >>> 2] = x; | ||
}, | ||
get tiltX() { | ||
return mem.i8[base + 12]; | ||
}, | ||
set tiltX(x) { | ||
mem.i8[base + 12] = x; | ||
}, | ||
get tiltY() { | ||
return mem.i8[base + 13]; | ||
}, | ||
set tiltY(x) { | ||
mem.i8[base + 13] = x; | ||
}, | ||
get twist() { | ||
return mem.u16[base + 14 >>> 1]; | ||
}, | ||
set twist(x) { | ||
mem.u16[base + 14 >>> 1] = x; | ||
}, | ||
get pointerType() { | ||
return mem.u8[base + 16]; | ||
}, | ||
set pointerType(x) { | ||
mem.u8[base + 16] = x; | ||
}, | ||
get isPrimary() { | ||
return mem.u8[base + 17]; | ||
}, | ||
set isPrimary(x) { | ||
mem.u8[base + 17] = x; | ||
}, | ||
get modifiers() { | ||
return mem.u8[base + 18]; | ||
}, | ||
set modifiers(x) { | ||
mem.u8[base + 18] = x; | ||
}, | ||
get buttons() { | ||
return mem.u8[base + 19]; | ||
}, | ||
set buttons(x) { | ||
mem.u8[base + 19] = x; | ||
}, | ||
get button() { | ||
return mem.u8[base + 20]; | ||
}, | ||
set button(x) { | ||
mem.u8[base + 20] = x; | ||
}, | ||
fromEvent(e) { | ||
const bounds = e.target.getBoundingClientRect(); | ||
this.clientX = e.clientX - bounds.left; | ||
this.clientY = e.clientY - bounds.top; | ||
this.tiltX = e.tiltX; | ||
this.tiltY = e.tiltY; | ||
this.twist = e.twist; | ||
this.isPrimary = ~~e.isPrimary; | ||
this.pointerType = PointerType[e.pointerType.toUpperCase()]; | ||
this.buttons = e.buttons; | ||
this.button = e.button; | ||
} | ||
}; | ||
} | ||
const $PointerEvent = defType(4, 24, (mem, base) => { | ||
return { | ||
get clientX() { | ||
return mem.i16[base >>> 1]; | ||
}, | ||
set clientX(x) { | ||
mem.i16[base >>> 1] = x; | ||
}, | ||
get clientY() { | ||
return mem.i16[base + 2 >>> 1]; | ||
}, | ||
set clientY(x) { | ||
mem.i16[base + 2 >>> 1] = x; | ||
}, | ||
get id() { | ||
return mem.u32[base + 4 >>> 2]; | ||
}, | ||
set id(x) { | ||
mem.u32[base + 4 >>> 2] = x; | ||
}, | ||
get pressure() { | ||
return mem.f32[base + 8 >>> 2]; | ||
}, | ||
set pressure(x) { | ||
mem.f32[base + 8 >>> 2] = x; | ||
}, | ||
get tiltX() { | ||
return mem.i8[base + 12]; | ||
}, | ||
set tiltX(x) { | ||
mem.i8[base + 12] = x; | ||
}, | ||
get tiltY() { | ||
return mem.i8[base + 13]; | ||
}, | ||
set tiltY(x) { | ||
mem.i8[base + 13] = x; | ||
}, | ||
get twist() { | ||
return mem.u16[base + 14 >>> 1]; | ||
}, | ||
set twist(x) { | ||
mem.u16[base + 14 >>> 1] = x; | ||
}, | ||
get pointerType() { | ||
return mem.u8[base + 16]; | ||
}, | ||
set pointerType(x) { | ||
mem.u8[base + 16] = x; | ||
}, | ||
get isPrimary() { | ||
return mem.u8[base + 17]; | ||
}, | ||
set isPrimary(x) { | ||
mem.u8[base + 17] = x; | ||
}, | ||
get modifiers() { | ||
return mem.u8[base + 18]; | ||
}, | ||
set modifiers(x) { | ||
mem.u8[base + 18] = x; | ||
}, | ||
get buttons() { | ||
return mem.u8[base + 19]; | ||
}, | ||
set buttons(x) { | ||
mem.u8[base + 19] = x; | ||
}, | ||
get button() { | ||
return mem.u8[base + 20]; | ||
}, | ||
set button(x) { | ||
mem.u8[base + 20] = x; | ||
}, | ||
fromEvent(e) { | ||
const bounds = e.target.getBoundingClientRect(); | ||
this.clientX = e.clientX - bounds.left; | ||
this.clientY = e.clientY - bounds.top; | ||
this.tiltX = e.tiltX; | ||
this.tiltY = e.tiltY; | ||
this.twist = e.twist; | ||
this.isPrimary = ~~e.isPrimary; | ||
this.pointerType = PointerType[e.pointerType.toUpperCase()]; | ||
this.buttons = e.buttons; | ||
this.button = e.button; | ||
} | ||
}; | ||
}); | ||
const $ScrollEvent = (mem) => ({ | ||
get align() { | ||
return 4; | ||
}, | ||
get size() { | ||
return 8; | ||
}, | ||
instanceArray(base, num) { | ||
return __instanceArray(this, base, num); | ||
}, | ||
instance: (base) => { | ||
return { | ||
get __base() { | ||
return base; | ||
}, | ||
get __bytes() { | ||
return mem.u8.subarray(base, base + 8); | ||
}, | ||
get scrollX() { | ||
return mem.f32[base >>> 2]; | ||
}, | ||
set scrollX(x) { | ||
mem.f32[base >>> 2] = x; | ||
}, | ||
get scrollY() { | ||
return mem.f32[base + 4 >>> 2]; | ||
}, | ||
set scrollY(x) { | ||
mem.f32[base + 4 >>> 2] = x; | ||
}, | ||
fromEvent(e) { | ||
const target = e.target.scrollTop != null ? e.target : document.scrollingElement; | ||
this.scrollX = target.scrollLeft || 0; | ||
this.scrollY = target.scrollTop || 0; | ||
} | ||
}; | ||
} | ||
const $ScrollEvent = defType(4, 8, (mem, base) => { | ||
return { | ||
get scrollX() { | ||
return mem.f32[base >>> 2]; | ||
}, | ||
set scrollX(x) { | ||
mem.f32[base >>> 2] = x; | ||
}, | ||
get scrollY() { | ||
return mem.f32[base + 4 >>> 2]; | ||
}, | ||
set scrollY(x) { | ||
mem.f32[base + 4 >>> 2] = x; | ||
}, | ||
fromEvent(e) { | ||
const target = e.target.scrollTop != null ? e.target : document.scrollingElement; | ||
this.scrollX = target.scrollLeft || 0; | ||
this.scrollY = target.scrollTop || 0; | ||
} | ||
}; | ||
}); | ||
const $TouchEvent = (mem) => ({ | ||
get align() { | ||
return 2; | ||
}, | ||
get size() { | ||
return 6; | ||
}, | ||
instanceArray(base, num) { | ||
return __instanceArray(this, base, num); | ||
}, | ||
instance: (base) => { | ||
return { | ||
get __base() { | ||
return base; | ||
}, | ||
get __bytes() { | ||
return mem.u8.subarray(base, base + 6); | ||
}, | ||
get clientX() { | ||
return mem.i16[base >>> 1]; | ||
}, | ||
set clientX(x) { | ||
mem.i16[base >>> 1] = x; | ||
}, | ||
get clientY() { | ||
return mem.i16[base + 2 >>> 1]; | ||
}, | ||
set clientY(x) { | ||
mem.i16[base + 2 >>> 1] = x; | ||
}, | ||
get modifiers() { | ||
return mem.u8[base + 4]; | ||
}, | ||
set modifiers(x) { | ||
mem.u8[base + 4] = x; | ||
}, | ||
fromEvent(e) { | ||
const bounds = e.target.getBoundingClientRect(); | ||
this.clientX = e.touches[0].clientX - bounds.left; | ||
this.clientY = e.touches[0].clientY - bounds.top; | ||
} | ||
}; | ||
} | ||
const $TouchEvent = defType(2, 6, (mem, base) => { | ||
return { | ||
get clientX() { | ||
return mem.i16[base >>> 1]; | ||
}, | ||
set clientX(x) { | ||
mem.i16[base >>> 1] = x; | ||
}, | ||
get clientY() { | ||
return mem.i16[base + 2 >>> 1]; | ||
}, | ||
set clientY(x) { | ||
mem.i16[base + 2 >>> 1] = x; | ||
}, | ||
get modifiers() { | ||
return mem.u8[base + 4]; | ||
}, | ||
set modifiers(x) { | ||
mem.u8[base + 4] = x; | ||
}, | ||
fromEvent(e) { | ||
const bounds = e.target.getBoundingClientRect(); | ||
this.clientX = e.touches[0].clientX - bounds.left; | ||
this.clientY = e.touches[0].clientY - bounds.top; | ||
} | ||
}; | ||
}); | ||
const $WheelEvent = (mem) => ({ | ||
get align() { | ||
return 2; | ||
}, | ||
get size() { | ||
return 10; | ||
}, | ||
instanceArray(base, num) { | ||
return __instanceArray(this, base, num); | ||
}, | ||
instance: (base) => { | ||
return { | ||
get __base() { | ||
return base; | ||
}, | ||
get __bytes() { | ||
return mem.u8.subarray(base, base + 10); | ||
}, | ||
get deltaX() { | ||
return mem.i16[base >>> 1]; | ||
}, | ||
set deltaX(x) { | ||
mem.i16[base >>> 1] = x; | ||
}, | ||
get deltaY() { | ||
return mem.i16[base + 2 >>> 1]; | ||
}, | ||
set deltaY(x) { | ||
mem.i16[base + 2 >>> 1] = x; | ||
}, | ||
get deltaZ() { | ||
return mem.i16[base + 4 >>> 1]; | ||
}, | ||
set deltaZ(x) { | ||
mem.i16[base + 4 >>> 1] = x; | ||
}, | ||
get mode() { | ||
return mem.u8[base + 6]; | ||
}, | ||
set mode(x) { | ||
mem.u8[base + 6] = x; | ||
}, | ||
get modifiers() { | ||
return mem.u8[base + 7]; | ||
}, | ||
set modifiers(x) { | ||
mem.u8[base + 7] = x; | ||
}, | ||
get buttons() { | ||
return mem.u8[base + 8]; | ||
}, | ||
set buttons(x) { | ||
mem.u8[base + 8] = x; | ||
}, | ||
fromEvent(e) { | ||
this.deltaX = e.deltaX; | ||
this.deltaY = e.deltaY; | ||
this.deltaZ = e.deltaZ; | ||
this.mode = e.deltaMode; | ||
this.buttons = e.buttons; | ||
} | ||
}; | ||
} | ||
const $WheelEvent = defType(2, 10, (mem, base) => { | ||
return { | ||
get deltaX() { | ||
return mem.i16[base >>> 1]; | ||
}, | ||
set deltaX(x) { | ||
mem.i16[base >>> 1] = x; | ||
}, | ||
get deltaY() { | ||
return mem.i16[base + 2 >>> 1]; | ||
}, | ||
set deltaY(x) { | ||
mem.i16[base + 2 >>> 1] = x; | ||
}, | ||
get deltaZ() { | ||
return mem.i16[base + 4 >>> 1]; | ||
}, | ||
set deltaZ(x) { | ||
mem.i16[base + 4 >>> 1] = x; | ||
}, | ||
get mode() { | ||
return mem.u8[base + 6]; | ||
}, | ||
set mode(x) { | ||
mem.u8[base + 6] = x; | ||
}, | ||
get modifiers() { | ||
return mem.u8[base + 7]; | ||
}, | ||
set modifiers(x) { | ||
mem.u8[base + 7] = x; | ||
}, | ||
get buttons() { | ||
return mem.u8[base + 8]; | ||
}, | ||
set buttons(x) { | ||
mem.u8[base + 8] = x; | ||
}, | ||
fromEvent(e) { | ||
this.deltaX = e.deltaX; | ||
this.deltaY = e.deltaY; | ||
this.deltaZ = e.deltaZ; | ||
this.mode = e.deltaMode; | ||
this.buttons = e.buttons; | ||
} | ||
}; | ||
}); | ||
const $EventBody = (mem) => ({ | ||
get align() { | ||
return 4; | ||
}, | ||
get size() { | ||
return 24; | ||
}, | ||
instanceArray(base, num) { | ||
return __instanceArray(this, base, num); | ||
}, | ||
instance: (base) => { | ||
return { | ||
get __base() { | ||
return base; | ||
}, | ||
get __bytes() { | ||
return mem.u8.subarray(base, base + 24); | ||
}, | ||
get drag() { | ||
return $DragEvent(mem).instance(base); | ||
}, | ||
get input() { | ||
return $InputEvent(mem).instance(base); | ||
}, | ||
get key() { | ||
return $KeyEvent(mem).instance(base); | ||
}, | ||
get mouse() { | ||
return $MouseEvent(mem).instance(base); | ||
}, | ||
get pointer() { | ||
return $PointerEvent(mem).instance(base); | ||
}, | ||
get scroll() { | ||
return $ScrollEvent(mem).instance(base); | ||
}, | ||
get touch() { | ||
return $TouchEvent(mem).instance(base); | ||
}, | ||
get wheel() { | ||
return $WheelEvent(mem).instance(base); | ||
} | ||
}; | ||
} | ||
const $EventBody = defType(4, 24, (mem, base) => { | ||
return { | ||
get drag() { | ||
return $DragEvent(mem).instance(base); | ||
}, | ||
get input() { | ||
return $InputEvent(mem).instance(base); | ||
}, | ||
get key() { | ||
return $KeyEvent(mem).instance(base); | ||
}, | ||
get mouse() { | ||
return $MouseEvent(mem).instance(base); | ||
}, | ||
get pointer() { | ||
return $PointerEvent(mem).instance(base); | ||
}, | ||
get scroll() { | ||
return $ScrollEvent(mem).instance(base); | ||
}, | ||
get touch() { | ||
return $TouchEvent(mem).instance(base); | ||
}, | ||
get wheel() { | ||
return $WheelEvent(mem).instance(base); | ||
} | ||
}; | ||
}); | ||
const $Event = (mem) => ({ | ||
get align() { | ||
return 4; | ||
}, | ||
get size() { | ||
return 32; | ||
}, | ||
instanceArray(base, num) { | ||
return __instanceArray(this, base, num); | ||
}, | ||
instance: (base) => { | ||
return { | ||
get __base() { | ||
return base; | ||
}, | ||
get __bytes() { | ||
return mem.u8.subarray(base, base + 32); | ||
}, | ||
get id() { | ||
return mem.i32[base >>> 2]; | ||
}, | ||
set id(x) { | ||
mem.i32[base >>> 2] = x; | ||
}, | ||
get target() { | ||
return mem.i32[base + 4 >>> 2]; | ||
}, | ||
set target(x) { | ||
mem.i32[base + 4 >>> 2] = x; | ||
}, | ||
get body() { | ||
return $EventBody(mem).instance(base + 8); | ||
} | ||
}; | ||
} | ||
const $Event = defType(4, 32, (mem, base) => { | ||
return { | ||
get id() { | ||
return mem.i32[base >>> 2]; | ||
}, | ||
set id(x) { | ||
mem.i32[base >>> 2] = x; | ||
}, | ||
get target() { | ||
return mem.i32[base + 4 >>> 2]; | ||
}, | ||
set target(x) { | ||
mem.i32[base + 4 >>> 2] = x; | ||
}, | ||
get body() { | ||
return $EventBody(mem).instance(base + 8); | ||
} | ||
}; | ||
}); | ||
const $EventListener = (mem) => ({ | ||
get align() { | ||
return 4; | ||
}, | ||
get size() { | ||
return 8; | ||
}, | ||
instanceArray(base, num) { | ||
return __instanceArray(this, base, num); | ||
}, | ||
instance: (base) => { | ||
return { | ||
get __base() { | ||
return base; | ||
}, | ||
get __bytes() { | ||
return mem.u8.subarray(base, base + 8); | ||
} | ||
}; | ||
} | ||
const $EventListener = defType(4, 8, (mem, base) => { | ||
return {}; | ||
}); | ||
const $CreateElementOpts = (mem) => ({ | ||
get align() { | ||
return 4; | ||
}, | ||
get size() { | ||
return 48; | ||
}, | ||
instanceArray(base, num) { | ||
return __instanceArray(this, base, num); | ||
}, | ||
instance: (base) => { | ||
let $tag = null; | ||
let $ns = null; | ||
let $id = null; | ||
let $class = null; | ||
let $text = null; | ||
let $html = null; | ||
return { | ||
get __base() { | ||
return base; | ||
}, | ||
get __bytes() { | ||
return mem.u8.subarray(base, base + 48); | ||
}, | ||
get tag() { | ||
return $tag || ($tag = __str(mem, base)); | ||
}, | ||
get ns() { | ||
return $ns || ($ns = __str(mem, base + 4)); | ||
}, | ||
get id() { | ||
return $id || ($id = __str(mem, base + 8)); | ||
}, | ||
get class() { | ||
return $class || ($class = __str(mem, base + 12)); | ||
}, | ||
get text() { | ||
return $text || ($text = __str(mem, base + 16)); | ||
}, | ||
get html() { | ||
return $html || ($html = __str(mem, base + 20)); | ||
}, | ||
get parent() { | ||
return mem.i32[base + 24 >>> 2]; | ||
}, | ||
get index() { | ||
return mem.i32[base + 28 >>> 2]; | ||
}, | ||
get children() { | ||
return __slice32(mem, $CreateElementOpts, base + 32); | ||
}, | ||
get attribs() { | ||
return __slice32(mem, $Attrib, base + 40); | ||
} | ||
}; | ||
} | ||
const $CreateElementOpts = defType(4, 48, (mem, base) => { | ||
let $tag, $ns, $id, $class, $text, $html; | ||
return { | ||
get tag() { | ||
return $tag || ($tag = __str(mem, base)); | ||
}, | ||
get ns() { | ||
return $ns || ($ns = __str(mem, base + 4)); | ||
}, | ||
get id() { | ||
return $id || ($id = __str(mem, base + 8)); | ||
}, | ||
get class() { | ||
return $class || ($class = __str(mem, base + 12)); | ||
}, | ||
get text() { | ||
return $text || ($text = __str(mem, base + 16)); | ||
}, | ||
get html() { | ||
return $html || ($html = __str(mem, base + 20)); | ||
}, | ||
get parent() { | ||
return mem.i32[base + 24 >>> 2]; | ||
}, | ||
get index() { | ||
return mem.i32[base + 28 >>> 2]; | ||
}, | ||
get children() { | ||
return __slice32(mem, $CreateElementOpts, base + 32); | ||
}, | ||
get attribs() { | ||
return __slice32(mem, $Attrib, base + 40); | ||
} | ||
}; | ||
}); | ||
const $CreateCanvasOpts = (mem) => ({ | ||
get align() { | ||
return 4; | ||
}, | ||
get size() { | ||
return 32; | ||
}, | ||
instanceArray(base, num) { | ||
return __instanceArray(this, base, num); | ||
}, | ||
instance: (base) => { | ||
let $id = null; | ||
let $class = null; | ||
return { | ||
get __base() { | ||
return base; | ||
}, | ||
get __bytes() { | ||
return mem.u8.subarray(base, base + 32); | ||
}, | ||
get width() { | ||
return mem.u16[base >>> 1]; | ||
}, | ||
get height() { | ||
return mem.u16[base + 2 >>> 1]; | ||
}, | ||
get id() { | ||
return $id || ($id = __str(mem, base + 4)); | ||
}, | ||
get class() { | ||
return $class || ($class = __str(mem, base + 8)); | ||
}, | ||
get parent() { | ||
return mem.i32[base + 12 >>> 2]; | ||
}, | ||
get index() { | ||
return mem.i32[base + 16 >>> 2]; | ||
}, | ||
get dpr() { | ||
return mem.u8[base + 20]; | ||
}, | ||
get attribs() { | ||
return __slice32(mem, $Attrib, base + 24); | ||
} | ||
}; | ||
} | ||
const $CreateCanvasOpts = defType(4, 32, (mem, base) => { | ||
let $id, $class; | ||
return { | ||
get width() { | ||
return mem.u16[base >>> 1]; | ||
}, | ||
get height() { | ||
return mem.u16[base + 2 >>> 1]; | ||
}, | ||
get id() { | ||
return $id || ($id = __str(mem, base + 4)); | ||
}, | ||
get class() { | ||
return $class || ($class = __str(mem, base + 8)); | ||
}, | ||
get parent() { | ||
return mem.i32[base + 12 >>> 2]; | ||
}, | ||
get index() { | ||
return mem.i32[base + 16 >>> 2]; | ||
}, | ||
get dpr() { | ||
return mem.u8[base + 20]; | ||
}, | ||
get attribs() { | ||
return __slice32(mem, $Attrib, base + 24); | ||
} | ||
}; | ||
}); | ||
const $Attrib = (mem) => ({ | ||
get align() { | ||
return 8; | ||
}, | ||
get size() { | ||
return 24; | ||
}, | ||
instanceArray(base, num) { | ||
return __instanceArray(this, base, num); | ||
}, | ||
instance: (base) => { | ||
let $name = null; | ||
return { | ||
get __base() { | ||
return base; | ||
}, | ||
get __bytes() { | ||
return mem.u8.subarray(base, base + 24); | ||
}, | ||
get name() { | ||
return $name || ($name = __str(mem, base)); | ||
}, | ||
get value() { | ||
return $AttribValue(mem).instance(base + 8); | ||
}, | ||
get kind() { | ||
return mem.u8[base + 16]; | ||
} | ||
}; | ||
} | ||
const $Attrib = defType(8, 24, (mem, base) => { | ||
let $name; | ||
return { | ||
get name() { | ||
return $name || ($name = __str(mem, base)); | ||
}, | ||
get value() { | ||
return $AttribValue(mem).instance(base + 8); | ||
}, | ||
get kind() { | ||
return mem.u8[base + 16]; | ||
} | ||
}; | ||
}); | ||
const $AttribValue = (mem) => ({ | ||
get align() { | ||
return 8; | ||
}, | ||
get size() { | ||
return 8; | ||
}, | ||
instanceArray(base, num) { | ||
return __instanceArray(this, base, num); | ||
}, | ||
instance: (base) => { | ||
let $str = null; | ||
return { | ||
get __base() { | ||
return base; | ||
}, | ||
get __bytes() { | ||
return mem.u8.subarray(base, base + 8); | ||
}, | ||
get event() { | ||
return $EventListener(mem).instance(base); | ||
}, | ||
get flag() { | ||
return mem.u8[base]; | ||
}, | ||
get num() { | ||
return mem.f64[base >>> 3]; | ||
}, | ||
get str() { | ||
return $str || ($str = __str(mem, base)); | ||
} | ||
}; | ||
} | ||
const $AttribValue = defType(8, 8, (mem, base) => { | ||
let $str; | ||
return { | ||
get event() { | ||
return $EventListener(mem).instance(base); | ||
}, | ||
get flag() { | ||
return mem.u8[base]; | ||
}, | ||
get num() { | ||
return mem.f64[base >>> 3]; | ||
}, | ||
get str() { | ||
return $str || ($str = __str(mem, base)); | ||
} | ||
}; | ||
}); | ||
@@ -836,0 +557,0 @@ var AttribType = /* @__PURE__ */ ((AttribType2) => { |
{ | ||
"name": "@thi.ng/wasm-api-dom", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "Browser DOM bridge API for hybrid TypeScript & WASM (Zig) applications", | ||
@@ -35,3 +35,3 @@ "type": "module", | ||
"clean": "bun ../../tools/src/clean-package.ts", | ||
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts", | ||
"doc": "typedoc --options ../../typedoc.json --out doc src/index.ts", | ||
"doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose", | ||
@@ -44,11 +44,11 @@ "doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts", | ||
"dependencies": { | ||
"@thi.ng/api": "^8.11.11", | ||
"@thi.ng/canvas": "^0.5.4", | ||
"@thi.ng/errors": "^2.5.17", | ||
"@thi.ng/prefixes": "^2.3.28", | ||
"@thi.ng/wasm-api": "^2.1.0" | ||
"@thi.ng/api": "^8.11.12", | ||
"@thi.ng/canvas": "^0.5.5", | ||
"@thi.ng/errors": "^2.5.18", | ||
"@thi.ng/prefixes": "^2.3.29", | ||
"@thi.ng/wasm-api": "^2.2.0" | ||
}, | ||
"devDependencies": { | ||
"@microsoft/api-extractor": "^7.47.9", | ||
"@thi.ng/wasm-api-bindgen": "^0.7.9", | ||
"@thi.ng/wasm-api-bindgen": "^0.8.0", | ||
"esbuild": "^0.24.0", | ||
@@ -104,3 +104,3 @@ "typedoc": "^0.26.7", | ||
}, | ||
"gitHead": "e84096f55842a5a028d5c5e7b776ddd49b79ea17\n" | ||
"gitHead": "ef89090bb19fc5bca23be5da8cfce05b82ff4ad1\n" | ||
} |
@@ -313,3 +313,3 @@ <!-- This file is generated - DO NOT EDIT! --> | ||
Package sizes (brotli'd, pre-treeshake): ESM: 4.04 KB | ||
Package sizes (brotli'd, pre-treeshake): ESM: 3.95 KB | ||
@@ -316,0 +316,0 @@ ## Dependencies |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110778
1754
Updated@thi.ng/api@^8.11.12
Updated@thi.ng/canvas@^0.5.5
Updated@thi.ng/errors@^2.5.18
Updated@thi.ng/prefixes@^2.3.29
Updated@thi.ng/wasm-api@^2.2.0