@open-artifact/wasm-wb-geom 0.0.0-stage → 0.2.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/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +5 -2
- package/generated/bytes.d.ts +3 -0
- package/generated/bytes.js +2 -0
- package/generated/open_artifact_wb_geom.d.ts +569 -0
- package/generated/open_artifact_wb_geom.js +2166 -0
- package/package.json +34 -4
- package/src/index.d.ts +9 -0
- package/src/index.js +23 -0
package/package.json
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-artifact/wasm-wb-geom",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Whiteboard geometry compiled from crates/open-artifact-wb-geom to WebAssembly (generated/, built by scripts/build-wasm.mjs), loaded synchronously.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./src/index.d.ts",
|
|
9
|
+
"default": "./src/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"src",
|
|
15
|
+
"generated",
|
|
16
|
+
"LICENSE",
|
|
17
|
+
"NOTICE"
|
|
18
|
+
],
|
|
19
|
+
"license": "Apache-2.0",
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "Jim Liu 宝玉",
|
|
22
|
+
"url": "https://github.com/JimLiu"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/JimLiu/open-artifact#readme",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/JimLiu/open-artifact.git",
|
|
28
|
+
"directory": "packages/wasm-wb-geom"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/JimLiu/open-artifact/issues"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Whiteboard geometry module (`crates/open-artifact-wb-geom`), instantiated on
|
|
3
|
+
* first use. The bytes are embedded, so this works the same in Node, in the
|
|
4
|
+
* bundled CLI and in the editor page, and callers keep synchronous APIs.
|
|
5
|
+
*/
|
|
6
|
+
import * as glue from '../generated/open_artifact_wb_geom.js';
|
|
7
|
+
export type WbGeom = Omit<typeof glue, 'default' | 'initSync'>;
|
|
8
|
+
/** The module's exports, instantiating it on the first call. */
|
|
9
|
+
export declare function wbGeom(): WbGeom;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Whiteboard geometry module (`crates/open-artifact-wb-geom`), instantiated on
|
|
3
|
+
* first use. The bytes are embedded, so this works the same in Node, in the
|
|
4
|
+
* bundled CLI and in the editor page, and callers keep synchronous APIs.
|
|
5
|
+
*/
|
|
6
|
+
import * as glue from '../generated/open_artifact_wb_geom.js';
|
|
7
|
+
import { WASM_BASE64 } from '../generated/bytes.js';
|
|
8
|
+
let ready = false;
|
|
9
|
+
function decode(base64) {
|
|
10
|
+
const binary = atob(base64);
|
|
11
|
+
const bytes = new Uint8Array(binary.length);
|
|
12
|
+
for (let index = 0; index < binary.length; index++)
|
|
13
|
+
bytes[index] = binary.charCodeAt(index);
|
|
14
|
+
return bytes;
|
|
15
|
+
}
|
|
16
|
+
/** The module's exports, instantiating it on the first call. */
|
|
17
|
+
export function wbGeom() {
|
|
18
|
+
if (!ready) {
|
|
19
|
+
glue.initSync({ module: decode(WASM_BASE64) });
|
|
20
|
+
ready = true;
|
|
21
|
+
}
|
|
22
|
+
return glue;
|
|
23
|
+
}
|