@gjsify/webgl 0.0.2 → 0.0.4

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.
Files changed (40) hide show
  1. package/lib/cjs/extensions/ext-blend-minmax.js +4 -23
  2. package/lib/cjs/extensions/ext-texture-filter-anisotropic.js +4 -23
  3. package/lib/cjs/extensions/oes-element-index-unit.js +4 -23
  4. package/lib/cjs/extensions/oes-standard-derivatives.js +4 -23
  5. package/lib/cjs/extensions/oes-texture-float-linear.js +4 -23
  6. package/lib/cjs/extensions/oes-texture-float.js +4 -23
  7. package/lib/cjs/extensions/stackgl-destroy-context.js +4 -23
  8. package/lib/cjs/extensions/stackgl-resize-drawing-buffer.js +4 -23
  9. package/lib/cjs/html-canvas-element.js +15 -34
  10. package/lib/cjs/index.js +18 -34
  11. package/lib/cjs/index.spec.js +51 -80
  12. package/lib/cjs/linkable.js +3 -22
  13. package/lib/cjs/test.js +3 -25
  14. package/lib/cjs/types/constructor.js +0 -15
  15. package/lib/cjs/types/extension.js +0 -15
  16. package/lib/cjs/types/index.js +5 -21
  17. package/lib/cjs/types/typed-array.js +0 -15
  18. package/lib/cjs/types/webgl-constants.js +0 -15
  19. package/lib/cjs/types/webgl-context-attribute-options.js +0 -15
  20. package/lib/cjs/utils.js +24 -53
  21. package/lib/cjs/webgl-active-info.js +3 -22
  22. package/lib/cjs/webgl-buffer.js +6 -25
  23. package/lib/cjs/webgl-context-attributes.js +4 -23
  24. package/lib/cjs/webgl-drawing-buffer-wrapper.js +3 -22
  25. package/lib/cjs/webgl-framebuffer.js +6 -25
  26. package/lib/cjs/webgl-program.js +6 -25
  27. package/lib/cjs/webgl-renderbuffer.js +6 -25
  28. package/lib/cjs/webgl-rendering-context.js +204 -216
  29. package/lib/cjs/webgl-shader-precision-format.js +4 -23
  30. package/lib/cjs/webgl-shader.js +6 -25
  31. package/lib/cjs/webgl-texture-unit.js +3 -22
  32. package/lib/cjs/webgl-texture.js +6 -25
  33. package/lib/cjs/webgl-uniform-location.js +4 -23
  34. package/lib/cjs/webgl-vertex-attribute.js +9 -28
  35. package/lib/types/html-canvas-element.d.ts +1 -0
  36. package/lib/types/webgl-rendering-context.d.ts +1 -0
  37. package/package.json +11 -11
  38. package/test.gjs.js +524 -559
  39. package/tmp/.tsbuildinfo +1 -1
  40. package/tsconfig.json +1 -1
@@ -1,40 +1,8 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var index_spec_exports = {};
29
- __export(index_spec_exports, {
30
- default: () => index_spec_default
31
- });
32
- module.exports = __toCommonJS(index_spec_exports);
33
- var import_unit = require("@gjsify/unit");
34
- var import_webgl = require("@gjsify/webgl");
35
- var import_glib_2 = __toESM(require("@girs/glib-2.0"), 1);
36
- var import_gtk_4 = __toESM(require("@girs/gtk-4.0"), 1);
37
- var import_gio_2 = __toESM(require("@girs/gio-2.0"), 1);
1
+ import { describe, it, expect } from "@gjsify/unit";
2
+ import { HTMLCanvasElement } from "@gjsify/webgl";
3
+ import GLib from "@girs/glib-2.0";
4
+ import Gtk from "@girs/gtk-4.0";
5
+ import Gio from "@girs/gio-2.0";
38
6
  const GL_CONSTANT_NAMES = ["ACTIVE_ATTRIBUTES", "ACTIVE_TEXTURE", "ACTIVE_UNIFORMS", "ALIASED_LINE_WIDTH_RANGE", "ALIASED_POINT_SIZE_RANGE", "ALPHA", "ALPHA_BITS", "ALWAYS", "ARRAY_BUFFER", "ARRAY_BUFFER_BINDING", "ATTACHED_SHADERS", "BACK", "BLEND", "BLEND_COLOR", "BLEND_DST_ALPHA", "BLEND_DST_RGB", "BLEND_EQUATION", "BLEND_EQUATION_ALPHA", "BLEND_EQUATION_RGB", "BLEND_SRC_ALPHA", "BLEND_SRC_RGB", "BLUE_BITS", "BOOL", "BOOL_VEC2", "BOOL_VEC3", "BOOL_VEC4", "BROWSER_DEFAULT_WEBGL", "BUFFER_SIZE", "BUFFER_USAGE", "BYTE", "CCW", "CLAMP_TO_EDGE", "COLOR_ATTACHMENT0", "COLOR_BUFFER_BIT", "COLOR_CLEAR_VALUE", "COLOR_WRITEMASK", "COMPILE_STATUS", "COMPRESSED_TEXTURE_FORMATS", "CONSTANT_ALPHA", "CONSTANT_COLOR", "CONTEXT_LOST_WEBGL", "CULL_FACE", "CULL_FACE_MODE", "CURRENT_PROGRAM", "CURRENT_VERTEX_ATTRIB", "CW", "DECR", "DECR_WRAP", "DELETE_STATUS", "DEPTH_ATTACHMENT", "DEPTH_BITS", "DEPTH_BUFFER_BIT", "DEPTH_CLEAR_VALUE", "DEPTH_COMPONENT", "DEPTH_COMPONENT16", "DEPTH_FUNC", "DEPTH_RANGE", "DEPTH_STENCIL", "DEPTH_STENCIL_ATTACHMENT", "DEPTH_TEST", "DEPTH_WRITEMASK", "DITHER", "DONT_CARE", "DST_ALPHA", "DST_COLOR", "DYNAMIC_DRAW", "ELEMENT_ARRAY_BUFFER", "ELEMENT_ARRAY_BUFFER_BINDING", "EQUAL", "FASTEST", "FLOAT", "FLOAT_MAT2", "FLOAT_MAT3", "FLOAT_MAT4", "FLOAT_VEC2", "FLOAT_VEC3", "FLOAT_VEC4", "FRAGMENT_SHADER", "FRAMEBUFFER", "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME", "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE", "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE", "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL", "FRAMEBUFFER_BINDING", "FRAMEBUFFER_COMPLETE", "FRAMEBUFFER_INCOMPLETE_ATTACHMENT", "FRAMEBUFFER_INCOMPLETE_DIMENSIONS", "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT", "FRAMEBUFFER_UNSUPPORTED", "FRONT", "FRONT_AND_BACK", "FRONT_FACE", "FUNC_ADD", "FUNC_REVERSE_SUBTRACT", "FUNC_SUBTRACT", "GENERATE_MIPMAP_HINT", "GEQUAL", "GREATER", "GREEN_BITS", "HIGH_FLOAT", "HIGH_INT", "IMPLEMENTATION_COLOR_READ_FORMAT", "IMPLEMENTATION_COLOR_READ_TYPE", "INCR", "INCR_WRAP", "INT", "INT_VEC2", "INT_VEC3", "INT_VEC4", "INVALID_ENUM", "INVALID_FRAMEBUFFER_OPERATION", "INVALID_OPERATION", "INVALID_VALUE", "INVERT", "KEEP", "LEQUAL", "LESS", "LINEAR", "LINEAR_MIPMAP_LINEAR", "LINEAR_MIPMAP_NEAREST", "LINES", "LINE_LOOP", "LINE_STRIP", "LINE_WIDTH", "LINK_STATUS", "LOW_FLOAT", "LOW_INT", "LUMINANCE", "LUMINANCE_ALPHA", "MAX_COMBINED_TEXTURE_IMAGE_UNITS", "MAX_CUBE_MAP_TEXTURE_SIZE", "MAX_FRAGMENT_UNIFORM_VECTORS", "MAX_RENDERBUFFER_SIZE", "MAX_TEXTURE_IMAGE_UNITS", "MAX_TEXTURE_SIZE", "MAX_VARYING_VECTORS", "MAX_VERTEX_ATTRIBS", "MAX_VERTEX_TEXTURE_IMAGE_UNITS", "MAX_VERTEX_UNIFORM_VECTORS", "MAX_VIEWPORT_DIMS", "MEDIUM_FLOAT", "MEDIUM_INT", "MIRRORED_REPEAT", "NEAREST", "NEAREST_MIPMAP_LINEAR", "NEAREST_MIPMAP_NEAREST", "NEVER", "NICEST", "NONE", "NOTEQUAL", "NO_ERROR", "ONE", "ONE_MINUS_CONSTANT_ALPHA", "ONE_MINUS_CONSTANT_COLOR", "ONE_MINUS_DST_ALPHA", "ONE_MINUS_DST_COLOR", "ONE_MINUS_SRC_ALPHA", "ONE_MINUS_SRC_COLOR", "OUT_OF_MEMORY", "PACK_ALIGNMENT", "POINTS", "POLYGON_OFFSET_FACTOR", "POLYGON_OFFSET_FILL", "POLYGON_OFFSET_UNITS", "RED_BITS", "RENDERBUFFER", "RENDERBUFFER_ALPHA_SIZE", "RENDERBUFFER_BINDING", "RENDERBUFFER_BLUE_SIZE", "RENDERBUFFER_DEPTH_SIZE", "RENDERBUFFER_GREEN_SIZE", "RENDERBUFFER_HEIGHT", "RENDERBUFFER_INTERNAL_FORMAT", "RENDERBUFFER_RED_SIZE", "RENDERBUFFER_STENCIL_SIZE", "RENDERBUFFER_WIDTH", "RENDERER", "REPEAT", "REPLACE", "RGB", "RGB565", "RGB5_A1", "RGBA", "RGBA4", "SAMPLER_2D", "SAMPLER_CUBE", "SAMPLES", "SAMPLE_ALPHA_TO_COVERAGE", "SAMPLE_BUFFERS", "SAMPLE_COVERAGE", "SAMPLE_COVERAGE_INVERT", "SAMPLE_COVERAGE_VALUE", "SCISSOR_BOX", "SCISSOR_TEST", "SHADER_TYPE", "SHADING_LANGUAGE_VERSION", "SHORT", "SRC_ALPHA", "SRC_ALPHA_SATURATE", "SRC_COLOR", "STATIC_DRAW", "STENCIL_ATTACHMENT", "STENCIL_BACK_FAIL", "STENCIL_BACK_FUNC", "STENCIL_BACK_PASS_DEPTH_FAIL", "STENCIL_BACK_PASS_DEPTH_PASS", "STENCIL_BACK_REF", "STENCIL_BACK_VALUE_MASK", "STENCIL_BACK_WRITEMASK", "STENCIL_BITS", "STENCIL_BUFFER_BIT", "STENCIL_CLEAR_VALUE", "STENCIL_FAIL", "STENCIL_FUNC", "STENCIL_INDEX8", "STENCIL_PASS_DEPTH_FAIL", "STENCIL_PASS_DEPTH_PASS", "STENCIL_REF", "STENCIL_TEST", "STENCIL_VALUE_MASK", "STENCIL_WRITEMASK", "STREAM_DRAW", "SUBPIXEL_BITS", "TEXTURE", "TEXTURE0", "TEXTURE1", "TEXTURE10", "TEXTURE11", "TEXTURE12", "TEXTURE13", "TEXTURE14", "TEXTURE15", "TEXTURE16", "TEXTURE17", "TEXTURE18", "TEXTURE19", "TEXTURE2", "TEXTURE20", "TEXTURE21", "TEXTURE22", "TEXTURE23", "TEXTURE24", "TEXTURE25", "TEXTURE26", "TEXTURE27", "TEXTURE28", "TEXTURE29", "TEXTURE3", "TEXTURE30", "TEXTURE31", "TEXTURE4", "TEXTURE5", "TEXTURE6", "TEXTURE7", "TEXTURE8", "TEXTURE9", "TEXTURE_2D", "TEXTURE_BINDING_2D", "TEXTURE_BINDING_CUBE_MAP", "TEXTURE_CUBE_MAP", "TEXTURE_CUBE_MAP_NEGATIVE_X", "TEXTURE_CUBE_MAP_NEGATIVE_Y", "TEXTURE_CUBE_MAP_NEGATIVE_Z", "TEXTURE_CUBE_MAP_POSITIVE_X", "TEXTURE_CUBE_MAP_POSITIVE_Y", "TEXTURE_CUBE_MAP_POSITIVE_Z", "TEXTURE_MAG_FILTER", "TEXTURE_MIN_FILTER", "TEXTURE_WRAP_S", "TEXTURE_WRAP_T", "TRIANGLES", "TRIANGLE_FAN", "TRIANGLE_STRIP", "UNPACK_ALIGNMENT", "UNPACK_COLORSPACE_CONVERSION_WEBGL", "UNPACK_FLIP_Y_WEBGL", "UNPACK_PREMULTIPLY_ALPHA_WEBGL", "UNSIGNED_BYTE", "UNSIGNED_INT", "UNSIGNED_SHORT", "UNSIGNED_SHORT_4_4_4_4", "UNSIGNED_SHORT_5_5_5_1", "UNSIGNED_SHORT_5_6_5", "VALIDATE_STATUS", "VENDOR", "VERSION", "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", "VERTEX_ATTRIB_ARRAY_ENABLED", "VERTEX_ATTRIB_ARRAY_NORMALIZED", "VERTEX_ATTRIB_ARRAY_POINTER", "VERTEX_ATTRIB_ARRAY_SIZE", "VERTEX_ATTRIB_ARRAY_STRIDE", "VERTEX_ATTRIB_ARRAY_TYPE", "VERTEX_SHADER", "VIEWPORT", "ZERO"];
39
7
  var index_spec_default = async () => {
40
8
  let app;
@@ -42,28 +10,28 @@ var index_spec_default = async () => {
42
10
  let glArea;
43
11
  let canvas;
44
12
  let ctx;
45
- if (import_glib_2.default.getenv("CI") || import_glib_2.default.getenv("GITHUB_ACTIONS") || import_glib_2.default.getenv("TRAVIS") || import_glib_2.default.getenv("CIRCLECI") || import_glib_2.default.getenv("GITLAB_CI")) {
13
+ if (GLib.getenv("CI") || GLib.getenv("GITHUB_ACTIONS") || GLib.getenv("TRAVIS") || GLib.getenv("CIRCLECI") || GLib.getenv("GITLAB_CI")) {
46
14
  console.info("Skipping webgl tests on CI");
47
15
  return;
48
16
  }
49
17
  const initApp = async () => {
50
- import_gtk_4.default.init();
51
- app = new import_gtk_4.default.Application({
18
+ Gtk.init();
19
+ app = new Gtk.Application({
52
20
  application_id: "gjsify.webgl.index.spec.ts",
53
- flags: import_gio_2.default.ApplicationFlags.FLAGS_NONE
21
+ flags: Gio.ApplicationFlags.FLAGS_NONE
54
22
  });
55
23
  const p = new Promise((resolve) => {
56
24
  app.connect("activate", () => {
57
25
  resolve(app);
58
26
  });
59
27
  });
60
- win = new import_gtk_4.default.ApplicationWindow(app);
28
+ win = new Gtk.ApplicationWindow(app);
61
29
  win.set_default_size(800, 600);
62
30
  app.run([]);
63
31
  return p;
64
32
  };
65
33
  const initGLArea = async () => {
66
- glArea = new import_gtk_4.default.GLArea({});
34
+ glArea = new Gtk.GLArea({});
67
35
  const p = new Promise((resolve, reject) => {
68
36
  glArea.connect("realize", () => {
69
37
  glArea.make_current();
@@ -82,94 +50,97 @@ var index_spec_default = async () => {
82
50
  win.present();
83
51
  return p;
84
52
  };
85
- await (0, import_unit.describe)("Gtk.ApplicationWindow", async () => {
86
- await (0, import_unit.it)("should be able to create a new instance", async () => {
53
+ await describe("Gtk.ApplicationWindow", async () => {
54
+ await it("should be able to create a new instance", async () => {
87
55
  app = await initApp();
88
- (0, import_unit.expect)(app).toBeDefined();
56
+ expect(app).toBeDefined();
89
57
  });
90
58
  });
91
- await (0, import_unit.describe)("Gtk.GLArea", async () => {
92
- await (0, import_unit.it)("should be able to create a new instance", async () => {
59
+ await describe("Gtk.GLArea", async () => {
60
+ await it("should be able to create a new instance", async () => {
93
61
  glArea = await initGLArea();
94
- (0, import_unit.expect)(glArea).toBeDefined();
62
+ expect(glArea).toBeDefined();
95
63
  });
96
64
  });
97
- await (0, import_unit.describe)("HTMLCanvasElement", async () => {
98
- await (0, import_unit.it)("should be defined", async () => {
99
- (0, import_unit.expect)(import_webgl.HTMLCanvasElement).toBeDefined();
65
+ await describe("HTMLCanvasElement", async () => {
66
+ await it("should be defined", async () => {
67
+ expect(HTMLCanvasElement).toBeDefined();
100
68
  });
101
- await (0, import_unit.it)("should be able to create a new instance", async () => {
102
- (0, import_unit.expect)(() => {
103
- canvas = new import_webgl.HTMLCanvasElement(glArea);
69
+ await it("should be able to create a new instance", async () => {
70
+ expect(() => {
71
+ canvas = new HTMLCanvasElement(glArea);
104
72
  }).not.toThrow();
105
- (0, import_unit.expect)(canvas).toBeDefined();
73
+ expect(canvas).toBeDefined();
106
74
  });
107
- await (0, import_unit.it)("should be able to get a webgl context", async () => {
108
- (0, import_unit.expect)(() => {
75
+ await it("should be able to get a webgl context", async () => {
76
+ expect(() => {
109
77
  ctx = canvas.getContext("webgl");
110
78
  }).not.toThrow();
111
- (0, import_unit.expect)(ctx).toBeDefined();
79
+ expect(ctx).toBeDefined();
112
80
  });
113
81
  });
114
- await (0, import_unit.describe)("WebGLRenderingContext", async () => {
115
- await (0, import_unit.it)("should have defined WebGL constants", async () => {
82
+ await describe("WebGLRenderingContext", async () => {
83
+ await it("should have defined WebGL constants", async () => {
116
84
  for (const GL_CONSTANT_NAME of GL_CONSTANT_NAMES) {
117
85
  const constant = ctx?.[GL_CONSTANT_NAME];
118
86
  console.log(GL_CONSTANT_NAME, constant);
119
- (0, import_unit.expect)(typeof constant).toBe("number");
87
+ expect(typeof constant).toBe("number");
120
88
  if (GL_CONSTANT_NAME === "NONE" || GL_CONSTANT_NAME === "ZERO" || GL_CONSTANT_NAME === "NO_ERROR" || GL_CONSTANT_NAME === "POINTS") {
121
- (0, import_unit.expect)(constant === 0).toBeTruthy();
89
+ expect(constant === 0).toBeTruthy();
122
90
  } else {
123
- (0, import_unit.expect)(constant > 0).toBeTruthy();
91
+ expect(constant > 0).toBeTruthy();
124
92
  }
125
93
  }
126
94
  });
127
95
  });
128
- await (0, import_unit.describe)("Gwebgl.WebGLRenderingContext", async () => {
129
- await (0, import_unit.it)("getParameterb should return a boolean", async () => {
96
+ await describe("Gwebgl.WebGLRenderingContext", async () => {
97
+ await it("getParameterb should return a boolean", async () => {
130
98
  const res = ctx?._native.getParameterb(ctx?.BLEND);
131
99
  console.log("res", res);
132
- (0, import_unit.expect)(typeof res).toBe("boolean");
100
+ expect(typeof res).toBe("boolean");
133
101
  });
134
- await (0, import_unit.it)("getParameterbv should return an array of boolean", async () => {
102
+ await it("getParameterbv should return an array of boolean", async () => {
135
103
  const results = ctx?._native.getParameterbv(ctx?.COLOR_WRITEMASK, 16);
136
104
  console.log("results", results);
137
- (0, import_unit.expect)(Array.isArray(results)).toBeTruthy();
105
+ expect(Array.isArray(results)).toBeTruthy();
138
106
  if (Array.isArray(results)) {
139
107
  for (const res of results) {
140
- (0, import_unit.expect)(typeof res).toBe("boolean");
108
+ expect(typeof res).toBe("boolean");
141
109
  }
142
110
  }
143
111
  });
144
- await (0, import_unit.it)("getParameterf should return a float number", async () => {
112
+ await it("getParameterf should return a float number", async () => {
145
113
  const result = ctx?._native.getParameterf(ctx?.SAMPLE_COVERAGE_VALUE);
146
114
  console.log("result", result);
147
- (0, import_unit.expect)(typeof result).toBe("number");
115
+ expect(typeof result).toBe("number");
148
116
  });
149
- await (0, import_unit.it)("getParameterfv should return an array of float numbers", async () => {
117
+ await it("getParameterfv should return an array of float numbers", async () => {
150
118
  const results = ctx?._native.getParameterfv(ctx?.DEPTH_RANGE, 8);
151
119
  console.log("results", results);
152
- (0, import_unit.expect)(Array.isArray(results)).toBeTruthy();
120
+ expect(Array.isArray(results)).toBeTruthy();
153
121
  if (Array.isArray(results)) {
154
122
  for (const res of results) {
155
- (0, import_unit.expect)(typeof res).toBe("number");
123
+ expect(typeof res).toBe("number");
156
124
  }
157
125
  }
158
126
  });
159
- await (0, import_unit.it)("getParameteri should return a integer number", async () => {
127
+ await it("getParameteri should return a integer number", async () => {
160
128
  const result = ctx?._native.getParameteri(ctx?.ARRAY_BUFFER_BINDING);
161
129
  console.log("result", result);
162
- (0, import_unit.expect)(typeof result).toBe("number");
130
+ expect(typeof result).toBe("number");
163
131
  });
164
- await (0, import_unit.it)("getParameteriv should return an array of integer numbers", async () => {
132
+ await it("getParameteriv should return an array of integer numbers", async () => {
165
133
  const results = ctx?._native.getParameteriv(ctx?.MAX_VIEWPORT_DIMS, 8);
166
134
  console.log("results", results, typeof results);
167
- (0, import_unit.expect)(Array.isArray(results)).toBeTruthy();
135
+ expect(Array.isArray(results)).toBeTruthy();
168
136
  if (Array.isArray(results)) {
169
137
  for (const res of results) {
170
- (0, import_unit.expect)(typeof res).toBe("number");
138
+ expect(typeof res).toBe("number");
171
139
  }
172
140
  }
173
141
  });
174
142
  });
175
143
  };
144
+ export {
145
+ index_spec_default as default
146
+ };
@@ -1,25 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var linkable_exports = {};
19
- __export(linkable_exports, {
20
- Linkable: () => Linkable
21
- });
22
- module.exports = __toCommonJS(linkable_exports);
23
1
  class Linkable {
24
2
  constructor(_) {
25
3
  this._ = 0;
@@ -67,3 +45,6 @@ class Linkable {
67
45
  _performDelete() {
68
46
  }
69
47
  }
48
+ export {
49
+ Linkable
50
+ };
package/lib/cjs/test.js CHANGED
@@ -1,25 +1,3 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from === "object" || typeof from === "function") {
9
- for (let key of __getOwnPropNames(from))
10
- if (!__hasOwnProp.call(to, key) && key !== except)
11
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
- }
13
- return to;
14
- };
15
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
- // If the importer is in node compatibility mode or this is not an ESM
17
- // file that has been converted to a CommonJS file using a Babel-
18
- // compatible transform (i.e. "__esModule" has not been set), then set
19
- // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
- mod
22
- ));
23
- var import_unit = require("@gjsify/unit");
24
- var import_index_spec = __toESM(require("./index.spec.js"), 1);
25
- (0, import_unit.run)({ testSuite: import_index_spec.default });
1
+ import { run } from "@gjsify/unit";
2
+ import testSuite from "./index.spec.js";
3
+ run({ testSuite });
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var constructor_exports = {};
15
- module.exports = __toCommonJS(constructor_exports);
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var extension_exports = {};
15
- module.exports = __toCommonJS(extension_exports);
@@ -1,21 +1,5 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var types_exports = {};
16
- module.exports = __toCommonJS(types_exports);
17
- __reExport(types_exports, require("./constructor.js"), module.exports);
18
- __reExport(types_exports, require("./extension.js"), module.exports);
19
- __reExport(types_exports, require("./typed-array.js"), module.exports);
20
- __reExport(types_exports, require("./webgl-constants.js"), module.exports);
21
- __reExport(types_exports, require("./webgl-context-attribute-options.js"), module.exports);
1
+ export * from "./constructor.js";
2
+ export * from "./extension.js";
3
+ export * from "./typed-array.js";
4
+ export * from "./webgl-constants.js";
5
+ export * from "./webgl-context-attribute-options.js";
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var typed_array_exports = {};
15
- module.exports = __toCommonJS(typed_array_exports);
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var webgl_constants_exports = {};
15
- module.exports = __toCommonJS(webgl_constants_exports);
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var webgl_context_attribute_options_exports = {};
15
- module.exports = __toCommonJS(webgl_context_attribute_options_exports);
package/lib/cjs/utils.js CHANGED
@@ -1,54 +1,5 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var utils_exports = {};
29
- __export(utils_exports, {
30
- Uint8ArrayToVariant: () => Uint8ArrayToVariant,
31
- arrayToUint8Array: () => arrayToUint8Array,
32
- bindPublics: () => bindPublics,
33
- boolArray: () => boolArray,
34
- checkFormat: () => checkFormat,
35
- checkObject: () => checkObject,
36
- checkUniform: () => checkUniform,
37
- convertPixels: () => convertPixels,
38
- extractImageData: () => extractImageData,
39
- flag: () => flag,
40
- formatSize: () => formatSize,
41
- isTypedArray: () => isTypedArray,
42
- isValidString: () => isValidString,
43
- listToArray: () => listToArray,
44
- typeSize: () => typeSize,
45
- uniformTypeSize: () => uniformTypeSize,
46
- validCubeTarget: () => validCubeTarget,
47
- vertexCount: () => vertexCount
48
- });
49
- module.exports = __toCommonJS(utils_exports);
50
- var import_webgl_uniform_location = require("./webgl-uniform-location.js");
51
- var import_glib_2 = __toESM(require("@girs/glib-2.0"), 1);
1
+ import { WebGLUniformLocation } from "./webgl-uniform-location.js";
2
+ import GLib from "@girs/glib-2.0";
52
3
  function bindPublics(props, wrapper, privateInstance, privateMethods) {
53
4
  for (let i = 0; i < props.length; i++) {
54
5
  const prop = props[i];
@@ -69,7 +20,7 @@ function checkObject(object) {
69
20
  return typeof object === "object" || object === void 0;
70
21
  }
71
22
  function checkUniform(program, location) {
72
- return location instanceof import_webgl_uniform_location.WebGLUniformLocation && location._program === program && location._linkCount === program._linkCount;
23
+ return location instanceof WebGLUniformLocation && location._program === program && location._linkCount === program._linkCount;
73
24
  }
74
25
  function isTypedArray(data) {
75
26
  return data instanceof Uint8Array || data instanceof Uint8ClampedArray || data instanceof Int8Array || data instanceof Uint16Array || data instanceof Int16Array || data instanceof Uint32Array || data instanceof Int32Array || data instanceof Float32Array || data instanceof Float64Array;
@@ -164,7 +115,7 @@ function arrayToUint8Array(array) {
164
115
  throw new Error("Can't unpack typed array!");
165
116
  }
166
117
  function Uint8ArrayToVariant(array) {
167
- const variant = new import_glib_2.default.Variant("ay", Array.from(array || []));
118
+ const variant = new GLib.Variant("ay", Array.from(array || []));
168
119
  return variant;
169
120
  }
170
121
  function boolArray(array) {
@@ -239,3 +190,23 @@ function flag(options, name, dflt) {
239
190
  }
240
191
  return !!options[name];
241
192
  }
193
+ export {
194
+ Uint8ArrayToVariant,
195
+ arrayToUint8Array,
196
+ bindPublics,
197
+ boolArray,
198
+ checkFormat,
199
+ checkObject,
200
+ checkUniform,
201
+ convertPixels,
202
+ extractImageData,
203
+ flag,
204
+ formatSize,
205
+ isTypedArray,
206
+ isValidString,
207
+ listToArray,
208
+ typeSize,
209
+ uniformTypeSize,
210
+ validCubeTarget,
211
+ vertexCount
212
+ };
@@ -1,25 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var webgl_active_info_exports = {};
19
- __export(webgl_active_info_exports, {
20
- WebGLActiveInfo: () => GjsifyWebGLActiveInfo
21
- });
22
- module.exports = __toCommonJS(webgl_active_info_exports);
23
1
  class GjsifyWebGLActiveInfo {
24
2
  constructor(_) {
25
3
  this.size = _.size;
@@ -27,3 +5,6 @@ class GjsifyWebGLActiveInfo {
27
5
  this.name = _.name;
28
6
  }
29
7
  }
8
+ export {
9
+ GjsifyWebGLActiveInfo as WebGLActiveInfo
10
+ };
@@ -1,28 +1,5 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var webgl_buffer_exports = {};
19
- __export(webgl_buffer_exports, {
20
- GjsifyWebGLBuffer: () => GjsifyWebGLBuffer,
21
- WebGLBuffer: () => GjsifyWebGLBuffer
22
- });
23
- module.exports = __toCommonJS(webgl_buffer_exports);
24
- var import_linkable = require("./linkable.js");
25
- class GjsifyWebGLBuffer extends import_linkable.Linkable {
1
+ import { Linkable } from "./linkable.js";
2
+ class GjsifyWebGLBuffer extends Linkable {
26
3
  constructor(_, ctx) {
27
4
  super(_);
28
5
  this._size = 0;
@@ -35,3 +12,7 @@ class GjsifyWebGLBuffer extends import_linkable.Linkable {
35
12
  ctx._native.deleteBuffer(this._);
36
13
  }
37
14
  }
15
+ export {
16
+ GjsifyWebGLBuffer,
17
+ GjsifyWebGLBuffer as WebGLBuffer
18
+ };
@@ -1,26 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var webgl_context_attributes_exports = {};
19
- __export(webgl_context_attributes_exports, {
20
- GjsifyWebGLContextAttributes: () => GjsifyWebGLContextAttributes,
21
- WebGLContextAttributes: () => GjsifyWebGLContextAttributes
22
- });
23
- module.exports = __toCommonJS(webgl_context_attributes_exports);
24
1
  class GjsifyWebGLContextAttributes {
25
2
  constructor(alpha, depth, stencil, antialias, premultipliedAlpha, preserveDrawingBuffer, preferLowPowerToHighPerformance, failIfMajorPerformanceCaveat) {
26
3
  this.alpha = alpha;
@@ -41,3 +18,7 @@ class GjsifyWebGLContextAttributes {
41
18
  this.failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveat;
42
19
  }
43
20
  }
21
+ export {
22
+ GjsifyWebGLContextAttributes,
23
+ GjsifyWebGLContextAttributes as WebGLContextAttributes
24
+ };
@@ -1,25 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var webgl_drawing_buffer_wrapper_exports = {};
19
- __export(webgl_drawing_buffer_wrapper_exports, {
20
- WebGLDrawingBufferWrapper: () => WebGLDrawingBufferWrapper
21
- });
22
- module.exports = __toCommonJS(webgl_drawing_buffer_wrapper_exports);
23
1
  class WebGLDrawingBufferWrapper {
24
2
  constructor(framebuffer, color, depthStencil) {
25
3
  this._framebuffer = framebuffer;
@@ -27,3 +5,6 @@ class WebGLDrawingBufferWrapper {
27
5
  this._depthStencil = depthStencil;
28
6
  }
29
7
  }
8
+ export {
9
+ WebGLDrawingBufferWrapper
10
+ };