fast-mesh-wasm 0.2.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.
Files changed (50) hide show
  1. package/README.md +488 -1
  2. package/dist/{api-D0o2HjaU.js → api-BUy7FRx7.js} +11 -11
  3. package/dist/client-Bp9FRd70.js +2278 -0
  4. package/dist/client-m2zSdFlu.d.ts +305 -0
  5. package/dist/colormap-D_xH5hI5.js +303 -0
  6. package/dist/core-Cke_kZ2e.js +113 -0
  7. package/dist/core-D2X9GPfK.d.ts +15 -0
  8. package/dist/engine-B-ZEzR1c.js +1818 -0
  9. package/dist/mesh-B16gV3oX.d.ts +130 -0
  10. package/dist/mesh-B8pae8WA.js +428 -0
  11. package/dist/node.d.ts +3 -2
  12. package/dist/node.js +5 -4
  13. package/dist/protocol-CAUYm1gd.js +68 -0
  14. package/dist/protocol-W9R-iGl5.d.ts +293 -0
  15. package/dist/r3f.d.ts +59 -0
  16. package/dist/r3f.js +165 -0
  17. package/dist/react-CTADh3NN.js +124 -0
  18. package/dist/react.d.ts +65 -0
  19. package/dist/react.js +1 -0
  20. package/dist/scene-BG3EEyfw.js +1243 -0
  21. package/dist/scene-like-B_3qm0u6.d.ts +925 -0
  22. package/dist/snapshot-Cf6NgDl7.js +104 -0
  23. package/dist/store-D3ErV6o-.js +1379 -0
  24. package/dist/store-DNnHN33A.d.ts +285 -0
  25. package/dist/store.d.ts +61 -0
  26. package/dist/store.js +105 -0
  27. package/dist/three.d.ts +118 -0
  28. package/dist/three.js +390 -0
  29. package/dist/views-BaZqBxlX.js +189 -0
  30. package/dist/wasm/fast_mesh_wasm.d.ts +458 -0
  31. package/dist/wasm/fast_mesh_wasm.js +1150 -0
  32. package/dist/wasm/fast_mesh_wasm_bg.wasm +0 -0
  33. package/dist/wasm/fast_mesh_wasm_bg.wasm.d.ts +74 -0
  34. package/dist/wasm-threads/fast_mesh_wasm.d.ts +540 -0
  35. package/dist/wasm-threads/fast_mesh_wasm.js +1513 -0
  36. package/dist/wasm-threads/fast_mesh_wasm_bg.wasm +0 -0
  37. package/dist/wasm-threads/fast_mesh_wasm_bg.wasm.d.ts +93 -0
  38. package/dist/wasm-threads/package.json +7 -0
  39. package/dist/wasm-threads/snippets/fast-mesh-wasm-ae14781a92c2789e/inline0.js +16 -0
  40. package/dist/wasm-threads/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.js +107 -0
  41. package/dist/web.d.ts +3 -2
  42. package/dist/web.js +4 -2
  43. package/dist/worker-engine.d.ts +248 -0
  44. package/dist/worker-engine.js +1 -0
  45. package/dist/worker-entry.d.ts +1 -0
  46. package/dist/worker-entry.js +11 -0
  47. package/dist/worker.d.ts +2 -0
  48. package/dist/worker.js +1 -0
  49. package/package.json +53 -4
  50. package/dist/api-HcskOwd7.d.ts +0 -43
@@ -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";