fast-mesh-wasm 0.1.0 → 0.3.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/README.md +493 -23
- package/dist/api-BUy7FRx7.js +64 -0
- package/dist/client-Bp9FRd70.js +2278 -0
- package/dist/client-m2zSdFlu.d.ts +305 -0
- package/dist/colormap-D_xH5hI5.js +303 -0
- package/dist/core-Cke_kZ2e.js +113 -0
- package/dist/core-D2X9GPfK.d.ts +15 -0
- package/dist/engine-B-ZEzR1c.js +1818 -0
- package/dist/mesh-B16gV3oX.d.ts +130 -0
- package/dist/mesh-B8pae8WA.js +428 -0
- package/dist/node.d.ts +6 -4
- package/dist/node.js +9 -5
- package/dist/protocol-CAUYm1gd.js +68 -0
- package/dist/protocol-W9R-iGl5.d.ts +293 -0
- package/dist/r3f.d.ts +59 -0
- package/dist/r3f.js +165 -0
- package/dist/react-CTADh3NN.js +124 -0
- package/dist/react.d.ts +65 -0
- package/dist/react.js +1 -0
- package/dist/scene-BG3EEyfw.js +1243 -0
- package/dist/scene-like-B_3qm0u6.d.ts +925 -0
- package/dist/snapshot-Cf6NgDl7.js +104 -0
- package/dist/store-D3ErV6o-.js +1379 -0
- package/dist/store-DNnHN33A.d.ts +285 -0
- package/dist/store.d.ts +61 -0
- package/dist/store.js +105 -0
- package/dist/three.d.ts +118 -0
- package/dist/three.js +390 -0
- package/dist/views-BaZqBxlX.js +189 -0
- package/dist/wasm/fast_mesh_wasm.d.ts +450 -31
- package/dist/wasm/fast_mesh_wasm.js +1122 -49
- package/dist/wasm/fast_mesh_wasm_bg.wasm +0 -0
- package/dist/wasm/fast_mesh_wasm_bg.wasm.d.ts +76 -7
- package/dist/wasm-threads/fast_mesh_wasm.d.ts +540 -0
- package/dist/wasm-threads/fast_mesh_wasm.js +1513 -0
- package/dist/wasm-threads/fast_mesh_wasm_bg.wasm +0 -0
- package/dist/wasm-threads/fast_mesh_wasm_bg.wasm.d.ts +93 -0
- package/dist/wasm-threads/package.json +7 -0
- package/dist/wasm-threads/snippets/fast-mesh-wasm-ae14781a92c2789e/inline0.js +16 -0
- package/dist/wasm-threads/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.js +107 -0
- package/dist/web.d.ts +3 -2
- package/dist/web.js +6 -3
- package/dist/worker-engine.d.ts +248 -0
- package/dist/worker-engine.js +1 -0
- package/dist/worker-entry.d.ts +1 -0
- package/dist/worker-entry.js +11 -0
- package/dist/worker.d.ts +2 -0
- package/dist/worker.js +1 -0
- package/package.json +55 -4
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { G as SectionHandle, W as MeshHandle } from "./scene-like-B_3qm0u6.js";
|
|
2
|
+
import { t as FastMeshError } from "./core-D2X9GPfK.js";
|
|
3
|
+
import { a as DisplayState, c as MeshState, d as SceneSnapshot, n as SectionPatch, p as SectionState, t as SceneStore } from "./store-DNnHN33A.js";
|
|
4
|
+
import { ReactElement, ReactNode } from "react";
|
|
5
|
+
//#region src/react/index.d.ts
|
|
6
|
+
/** Provides `store` to the hooks below it. */
|
|
7
|
+
export declare function SceneProvider(props: {
|
|
8
|
+
store: SceneStore;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}): ReactElement;
|
|
11
|
+
/**
|
|
12
|
+
* The store of the nearest {@link SceneProvider}.
|
|
13
|
+
*
|
|
14
|
+
* @throws `INVALID_ARGUMENT` outside a provider.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useScene(): SceneStore;
|
|
17
|
+
/**
|
|
18
|
+
* Selects a slice of the store's snapshot; the component re-renders only when
|
|
19
|
+
* the slice changes (by `isEqual`, `Object.is` by default). The selection is
|
|
20
|
+
* cached per snapshot and selector, and a new selection equal to the
|
|
21
|
+
* previous one keeps the previous value, so a selector may build new objects
|
|
22
|
+
* and may be an inline function. The server renders `EMPTY_SNAPSHOT`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useStoreSelector<T>(selector: (s: SceneSnapshot) => T, isEqual?: (a: T, b: T) => boolean): T;
|
|
25
|
+
/**
|
|
26
|
+
* A mesh's state merged with its applied display: `opacity`, `visible` and
|
|
27
|
+
* `coloring` are what is shown, `desired` what was last requested.
|
|
28
|
+
*/
|
|
29
|
+
export type MeshDisplay = MeshState & DisplayState;
|
|
30
|
+
/**
|
|
31
|
+
* A mesh's display and its setter (`store.setDisplay`). The toggle-button
|
|
32
|
+
* pattern is `pressed = state.desired.coloring !== null`, with
|
|
33
|
+
* `busy = state.status === "computing"`. A mesh not in the store (removed,
|
|
34
|
+
* or rendered on the server) reads as `REMOVED_MESH_STATE`: `"idle"`,
|
|
35
|
+
* default display. The setter throws `UNKNOWN_MESH` for such a mesh.
|
|
36
|
+
*/
|
|
37
|
+
export declare function useMeshDisplay(mesh: MeshHandle): [MeshDisplay, (patch: Partial<DisplayState>) => void];
|
|
38
|
+
/** Whether undo and redo are available, and the actions. */
|
|
39
|
+
export interface HistoryControls {
|
|
40
|
+
canUndo: boolean;
|
|
41
|
+
canRedo: boolean;
|
|
42
|
+
undo(): void;
|
|
43
|
+
redo(): void;
|
|
44
|
+
}
|
|
45
|
+
/** Undo and redo, with whether each is available. The object and its actions keep their identity while history is unchanged; the actions are stable per store. */
|
|
46
|
+
export declare function useHistory(): HistoryControls;
|
|
47
|
+
/** A change to a section: its plane, meshes or fill. */
|
|
48
|
+
export type SectionUpdate = SectionPatch;
|
|
49
|
+
/**
|
|
50
|
+
* A section's state (the applied plane, meshes and fill, `desired` and
|
|
51
|
+
* `status`) and its setter (`store.setSection`). A section not in the store
|
|
52
|
+
* reads as `REMOVED_SECTION_STATE` (`"idle"`, no meshes); the setter throws
|
|
53
|
+
* `UNKNOWN_SECTION` for it.
|
|
54
|
+
*/
|
|
55
|
+
export declare function useSection(section: SectionHandle): [SectionState, (patch: SectionUpdate) => void];
|
|
56
|
+
/** The scene's overall status. */
|
|
57
|
+
export interface SceneStatus {
|
|
58
|
+
status: "idle" | "computing" | "error";
|
|
59
|
+
error?: FastMeshError;
|
|
60
|
+
}
|
|
61
|
+
/** The overall status: `"error"` (with the first error) when anything failed, else `"computing"` while anything is pending. */
|
|
62
|
+
export declare function useSceneStatus(): SceneStatus;
|
|
63
|
+
/** The selected mesh (or `null`) and the function that selects one (`store.select`). */
|
|
64
|
+
export declare function useSelection(): [MeshHandle | null, (mesh: MeshHandle | null) => void];
|
|
65
|
+
//#endregion
|
package/dist/react.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as SceneProvider, n as useHistory, r as useMeshDisplay, i as useScene, a as useSceneStatus, o as useSection, s as useSelection, c as useStoreSelector } from "./react-CTADh3NN.js";
|