@gjsify/dom-elements 0.4.29 → 0.4.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,12 +13,12 @@ export declare class HTMLCanvasElement extends HTMLElement {
13
13
  * Register a rendering context factory for a given context type.
14
14
  * Called by packages like @gjsify/canvas2d and @gjsify/webgl to plug in their implementations.
15
15
  */
16
- static registerContextFactory(contextId: string, factory: (canvas: HTMLCanvasElement, options?: any) => any): void;
17
- oncontextlost: ((ev: Event) => any) | null;
18
- oncontextrestored: ((ev: Event) => any) | null;
19
- onwebglcontextcreationerror: ((ev: Event) => any) | null;
20
- onwebglcontextlost: ((ev: Event) => any) | null;
21
- onwebglcontextrestored: ((ev: Event) => any) | null;
16
+ static registerContextFactory(contextId: string, factory: (canvas: HTMLCanvasElement, options?: unknown) => unknown): void;
17
+ oncontextlost: ((ev: Event) => unknown) | null;
18
+ oncontextrestored: ((ev: Event) => unknown) | null;
19
+ onwebglcontextcreationerror: ((ev: Event) => unknown) | null;
20
+ onwebglcontextlost: ((ev: Event) => unknown) | null;
21
+ onwebglcontextrestored: ((ev: Event) => unknown) | null;
22
22
  /** Returns the width of the canvas element. Default: 300. */
23
23
  get width(): number;
24
24
  set width(value: number);
@@ -30,11 +30,11 @@ export declare class HTMLCanvasElement extends HTMLElement {
30
30
  * Checks the static context factory registry for a matching factory.
31
31
  * Subclasses (e.g. @gjsify/webgl) may override and fall through via super.getContext().
32
32
  */
33
- getContext(contextId: string, options?: any): any;
33
+ getContext(contextId: string, options?: unknown): unknown;
34
34
  /** Returns a data URL representing the canvas image. Delegates to the active 2D context if available. */
35
- toDataURL(type?: string, quality?: any): string;
35
+ toDataURL(type?: string, quality?: unknown): string;
36
36
  /** Converts the canvas to a Blob and passes it to the callback. Delegates to the active 2D context if available. */
37
- toBlob(callback: (blob: Blob | null) => void, type?: string, quality?: any): void;
37
+ toBlob(callback: (blob: Blob | null) => void, type?: string, quality?: unknown): void;
38
38
  /** Returns a MediaStream capturing the canvas. Stub — returns empty object. */
39
- captureStream(_frameRequestRate?: number): any;
39
+ captureStream(_frameRequestRate?: number): Record<string, never>;
40
40
  }
@@ -8,6 +8,21 @@ export declare const NETWORK_EMPTY = 0;
8
8
  export declare const NETWORK_IDLE = 1;
9
9
  export declare const NETWORK_LOADING = 2;
10
10
  export declare const NETWORK_NO_SOURCE = 3;
11
+ /**
12
+ * Source object accepted by {@link HTMLMediaElement.srcObject}.
13
+ *
14
+ * In the DOM spec this is `MediaProvider = MediaStream | MediaSource | Blob`
15
+ * (plus `null`). `@gjsify/dom-elements` is built without the DOM lib, so we
16
+ * model the structural surface that bridge consumers (e.g. `@gjsify/video`'s
17
+ * `VideoBridge`) rely on — the `getVideoTracks`/`getAudioTracks` accessors of a
18
+ * MediaStream — while still allowing any concrete `MediaStream`/`MediaSource`/
19
+ * `Blob` (which structurally satisfy this when DOM types are in scope).
20
+ */
21
+ export interface MediaProvider {
22
+ getVideoTracks?(): unknown[];
23
+ getAudioTracks?(): unknown[];
24
+ getTracks?(): unknown[];
25
+ }
11
26
  /**
12
27
  * Base class for media elements (video, audio).
13
28
  *
@@ -48,8 +63,8 @@ export declare class HTMLMediaElement extends HTMLElement {
48
63
  };
49
64
  get src(): string;
50
65
  set src(value: string);
51
- get srcObject(): any;
52
- set srcObject(stream: any);
66
+ get srcObject(): MediaProvider | null;
67
+ set srcObject(stream: MediaProvider | null);
53
68
  play(): Promise<void>;
54
69
  pause(): void;
55
70
  load(): void;
@@ -50,7 +50,7 @@ export declare class Node extends EventTarget {
50
50
  set textContent(_value: string | null);
51
51
  get nodeValue(): string | null;
52
52
  set nodeValue(_value: string | null);
53
- get ownerDocument(): any;
53
+ get ownerDocument(): unknown;
54
54
  get isConnected(): boolean;
55
55
  hasChildNodes(): boolean;
56
56
  contains(other: Node | null): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/dom-elements",
3
- "version": "0.4.29",
3
+ "version": "0.4.30",
4
4
  "description": "DOM element hierarchy (Node, Element, HTMLElement, HTMLImageElement) for GJS",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -68,15 +68,15 @@
68
68
  "@girs/gdkpixbuf-2.0": "2.0.0-4.0.1",
69
69
  "@girs/gjs": "4.0.1",
70
70
  "@girs/glib-2.0": "2.88.0-4.0.1",
71
- "@gjsify/abort-controller": "^0.4.29",
72
- "@gjsify/canvas2d-core": "^0.4.29",
73
- "@gjsify/dom-events": "^0.4.29",
74
- "@gjsify/fetch": "^0.4.29"
71
+ "@gjsify/abort-controller": "^0.4.30",
72
+ "@gjsify/canvas2d-core": "^0.4.30",
73
+ "@gjsify/dom-events": "^0.4.30",
74
+ "@gjsify/fetch": "^0.4.30"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@girs/gst-1.0": "1.28.1-4.0.1",
78
- "@gjsify/cli": "^0.4.29",
79
- "@gjsify/unit": "^0.4.29",
78
+ "@gjsify/cli": "^0.4.30",
79
+ "@gjsify/unit": "^0.4.30",
80
80
  "@types/node": "^25.9.1",
81
81
  "typescript": "^6.0.3"
82
82
  }