@thi.ng/wasm-api-webgl 0.1.71 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2025-08-04T09:13:01Z
3
+ - **Last updated**: 2025-09-01T16:38:35Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -11,6 +11,15 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
11
11
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
12
12
  and/or version bumps of transitive dependencies.
13
13
 
14
+ # [1.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api-webgl@1.0.0) (2025-09-01)
15
+
16
+ #### 🛑 Breaking changes
17
+
18
+ - internal restructure of generated types ([76a1592](https://github.com/thi-ng/umbrella/commit/76a1592))
19
+ - BREAKING CHANGE: internal restructure due to breaking Zig 0.15.1 changes
20
+ - `usenamespace` syntax deprecated in Zig 0.15.1, so earlier struct/namespace merging not possible anymore
21
+ - instead, generated types exposed via `types` (e.g. `gl.ShaderSpec` => `gl.types.ShaderSpec`)
22
+
14
23
  ### [0.1.16](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api-webgl@0.1.16) (2024-11-10)
15
24
 
16
25
  #### ♻️ Refactoring
package/api.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { WasmExports } from "@thi.ng/wasm-api";
2
2
  import type { WasmDomExports } from "@thi.ng/wasm-api-dom";
3
- export * from "./generated/api.js";
3
+ export * from "./generated/types.js";
4
4
  export interface WasmWebGLImports extends WebAssembly.ModuleImports {
5
5
  canvasGLContext(canvasID: number, opts: number): number;
6
6
  createShader(ctxID: number, shaderSpec: number): number;
package/api.js CHANGED
@@ -1 +1 @@
1
- export * from "./generated/api.js";
1
+ export * from "./generated/types.js";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generated by @thi.ng/wasm-api-bindgen at 2024-11-10T16:53:44.121Z
2
+ * Generated by @thi.ng/wasm-api-bindgen at 2025-09-01T11:06:15.183Z
3
3
  * DO NOT EDIT!
4
4
  */
5
5
  import { WasmStringPtr, type WasmTypeBase } from "@thi.ng/wasm-api";
@@ -277,4 +277,4 @@ export declare enum UniformType {
277
277
  sampler3D = 10,
278
278
  samplerCube = 11
279
279
  }
280
- //# sourceMappingURL=api.d.ts.map
280
+ //# sourceMappingURL=types.d.ts.map
package/gl.d.ts CHANGED
@@ -3,7 +3,7 @@ import { type WasmDom } from "@thi.ng/wasm-api-dom";
3
3
  import { ObjectIndex } from "@thi.ng/wasm-api/object-index";
4
4
  import type { ITexture, Shader, ModelSpec as WEBGL_ModelSpec } from "@thi.ng/webgl";
5
5
  import type { AttribUpdateSpec, WasmWebGLExports, WasmWebGLImports, WebGLContextOpts } from "./api.js";
6
- import { type ModelSpec, type ShaderSpec, type TextureSpec, type UniformValue } from "./generated/api.js";
6
+ import { type ModelSpec, type ShaderSpec, type TextureSpec, type UniformValue } from "./generated/types.js";
7
7
  /**
8
8
  * WASM module descriptor for use as dependency object in other module
9
9
  * definitions or for direct use with
package/gl.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  ShaderAttribType,
19
19
  UniformType,
20
20
  WebGLPowerPreference
21
- } from "./generated/api.js";
21
+ } from "./generated/types.js";
22
22
  const WasmWebGLModule = {
23
23
  id: "webgl",
24
24
  deps: [WasmDomModule],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/wasm-api-webgl",
3
- "version": "0.1.71",
3
+ "version": "1.0.0",
4
4
  "description": "WebGL bridge API for hybrid TypeScript & WASM (Zig) applications",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -31,7 +31,7 @@
31
31
  "build": "yarn build:esbuild && yarn build:decl",
32
32
  "build:decl": "tsc --declaration --emitDeclarationOnly",
33
33
  "build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
34
- "build:types": "npx wasm-api-bindgen -a analytics.json --config src/typedefs-config.json --lang ts -o src/generated/api.ts --lang zig -o zig/api.zig src/typedefs.json",
34
+ "build:types": "npx wasm-api-bindgen -a analytics.json --config src/typedefs-config.json --lang ts -o src/generated/types.ts --lang zig -o zig/types.zig src/typedefs.json",
35
35
  "clean": "bun ../../tools/src/clean-package.ts",
36
36
  "doc": "typedoc --options ../../typedoc.json --out doc src/index.ts",
37
37
  "doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
@@ -40,16 +40,16 @@
40
40
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
41
41
  },
42
42
  "dependencies": {
43
- "@thi.ng/api": "^8.12.1",
44
- "@thi.ng/errors": "^2.5.41",
45
- "@thi.ng/wasm-api": "^2.3.31",
46
- "@thi.ng/wasm-api-dom": "^1.0.48",
47
- "@thi.ng/webgl": "^6.9.75"
43
+ "@thi.ng/api": "^8.12.2",
44
+ "@thi.ng/errors": "^2.5.42",
45
+ "@thi.ng/wasm-api": "^2.4.0",
46
+ "@thi.ng/wasm-api-dom": "^2.0.0",
47
+ "@thi.ng/webgl": "^6.9.76"
48
48
  },
49
49
  "devDependencies": {
50
- "@thi.ng/wasm-api-bindgen": "^1.2.38",
51
- "esbuild": "^0.25.8",
52
- "typedoc": "^0.28.9",
50
+ "@thi.ng/wasm-api-bindgen": "^1.2.39",
51
+ "esbuild": "^0.25.9",
52
+ "typedoc": "^0.28.12",
53
53
  "typescript": "^5.9.2"
54
54
  },
55
55
  "keywords": [
@@ -99,5 +99,5 @@
99
99
  "tag": "wasm",
100
100
  "year": 2024
101
101
  },
102
- "gitHead": "f6ebc1302dc9211d588293aa0897173c6e54f4e5\n"
102
+ "gitHead": "e215a3e8de3809736ba0042c93bd8703a5a1a337\n"
103
103
  }
package/zig/lib.zig CHANGED
@@ -1,18 +1,17 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  const std = @import("std");
3
- const api = @import("api.zig");
4
3
 
5
- pub usingnamespace api;
4
+ pub const types = @import("types.zig");
6
5
 
7
- pub extern "webgl" fn canvasGLContext(canvasID: i32, opts: *const api.WebGLContextOpts) i32;
6
+ pub extern "webgl" fn canvasGLContext(canvasID: i32, opts: *const types.WebGLContextOpts) i32;
8
7
 
9
- pub extern "webgl" fn createShader(ctxID: i32, spec: *const api.ShaderSpec) i32;
8
+ pub extern "webgl" fn createShader(ctxID: i32, spec: *const types.ShaderSpec) i32;
10
9
 
11
- pub extern "webgl" fn createModel(ctxID: i32, spec: *const api.ModelSpec) i32;
10
+ pub extern "webgl" fn createModel(ctxID: i32, spec: *const types.ModelSpec) i32;
12
11
 
13
- pub extern "webgl" fn createTexture(ctxID: i32, spec: *const api.TextureSpec) i32;
12
+ pub extern "webgl" fn createTexture(ctxID: i32, spec: *const types.TextureSpec) i32;
14
13
 
15
- pub extern "webgl" fn updateAttrib(modelID: i32, name: [*:0]const u8, spec: *const api.AttribUpdateSpec) void;
14
+ pub extern "webgl" fn updateAttrib(modelID: i32, name: [*:0]const u8, spec: *const types.AttribUpdateSpec) void;
16
15
 
17
16
  pub extern "webgl" fn uniformVec(modelID: i32, name: [*:0]const u8, value: [*]const f32, size: u32) void;
18
17
 
@@ -30,6 +29,13 @@ pub extern "webgl" fn draw(modelID: i32) void;
30
29
 
31
30
  pub extern "webgl" fn clear(ctxID: i32, r: f32, g: f32, b: f32, a: f32) void;
32
31
 
32
+ // hoist generated helpers
33
+ pub const modelAttribs = types.modelAttribs;
34
+ pub const modelUniforms = types.modelUniforms;
35
+ pub const shaderAttribs = types.shaderAttribs;
36
+ pub const shaderUniforms = types.shaderUniforms;
37
+ pub const shaderVaryings = types.shaderVaryings;
38
+
33
39
  // Syntax sugar for `uniformVec()` and vec2 values
34
40
  pub fn uniformVec2(modelID: i32, name: [*:0]const u8, value: *const [2]f32) void {
35
41
  uniformVec(modelID, name, value, 2);
@@ -67,7 +73,7 @@ pub fn modelAttribF32(
67
73
  size: usize,
68
74
  stride: usize,
69
75
  offset: usize,
70
- ) api.ModelAttribSpec {
76
+ ) types.ModelAttribSpec {
71
77
  return .{
72
78
  .name = name,
73
79
  .data = attribDataF32(data),
@@ -85,7 +91,7 @@ pub fn modelAttribI32(
85
91
  size: usize,
86
92
  stride: usize,
87
93
  offset: usize,
88
- ) api.ModelAttribSpec {
94
+ ) types.ModelAttribSpec {
89
95
  return .{
90
96
  .name = name,
91
97
  .data = attribDataI32(data),
@@ -103,7 +109,7 @@ pub fn modelAttribU32(
103
109
  size: usize,
104
110
  stride: usize,
105
111
  offset: usize,
106
- ) api.ModelAttribSpec {
112
+ ) types.ModelAttribSpec {
107
113
  return .{
108
114
  .name = name,
109
115
  .data = attribDataU32(data),
@@ -126,19 +132,19 @@ pub fn updateAttribU32(modelID: i32, name: [*:0]const u8, data: []const u32, off
126
132
  updateAttrib(modelID, name, &.{ .data = attribDataU32(data), .offset = offset });
127
133
  }
128
134
 
129
- pub inline fn attribDataF32(data: []const f32) api.ModelAttribData {
130
- return .{ .f32 = api.ConstF32Slice.wrap(data) };
135
+ pub inline fn attribDataF32(data: []const f32) types.ModelAttribData {
136
+ return .{ .f32 = types.ConstF32Slice.wrap(data) };
131
137
  }
132
138
 
133
- pub inline fn attribDataI32(data: []const i32) api.ModelAttribData {
134
- return .{ .i32 = api.ConstI32Slice.wrap(data) };
139
+ pub inline fn attribDataI32(data: []const i32) types.ModelAttribData {
140
+ return .{ .i32 = types.ConstI32Slice.wrap(data) };
135
141
  }
136
142
 
137
- pub inline fn attribDataU32(data: []const u32) api.ModelAttribData {
138
- return .{ .u32 = api.ConstI32Slice.wrap(data) };
143
+ pub inline fn attribDataU32(data: []const u32) types.ModelAttribData {
144
+ return .{ .u32 = types.ConstI32Slice.wrap(data) };
139
145
  }
140
146
 
141
147
  /// Syntax sugar for defining u8 based `ImageData` from ABGR u32 source data
142
- pub inline fn textureDataU32(data: []const u32) api.ImageData {
143
- return .{ .u8 = api.ConstU8Slice.wrap(std.mem.sliceAsBytes(data)) };
148
+ pub inline fn textureDataU32(data: []const u32) types.ImageData {
149
+ return .{ .u8 = types.ConstU8Slice.wrap(std.mem.sliceAsBytes(data)) };
144
150
  }
@@ -1,4 +1,5 @@
1
- //! Generated by @thi.ng/wasm-api-bindgen at 2024-08-17T16:17:33.290Z
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ //! Generated by @thi.ng/wasm-api-bindgen at 2025-09-01T11:06:15.190Z
2
3
  //! DO NOT EDIT!
3
4
 
4
5
  const std = @import("std");
File without changes