@opsydyn/effect-three-foldkit 0.4.0 → 1.0.0-next.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 (118) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +29 -23
  3. package/dist/boxSelect.d.ts +91 -117
  4. package/dist/boxSelect.d.ts.map +1 -1
  5. package/dist/browser.d.ts +3 -0
  6. package/dist/browser.d.ts.map +1 -0
  7. package/dist/browser.js +32 -0
  8. package/dist/browser.js.map +10 -0
  9. package/dist/element.d.ts +13 -869
  10. package/dist/element.d.ts.map +1 -1
  11. package/dist/index.d.ts +17 -17
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +173 -2383
  14. package/dist/index.js.map +14 -38
  15. package/dist/inspector.d.ts +4 -21
  16. package/dist/inspector.d.ts.map +1 -1
  17. package/dist/measuringTape.d.ts +39 -46
  18. package/dist/measuringTape.d.ts.map +1 -1
  19. package/dist/mount.d.ts +17 -11
  20. package/dist/mount.d.ts.map +1 -1
  21. package/dist/overlayView.d.ts +7 -18
  22. package/dist/overlayView.d.ts.map +1 -1
  23. package/dist/pivotControls.d.ts +64 -76
  24. package/dist/pivotControls.d.ts.map +1 -1
  25. package/dist/transformGizmo.d.ts +113 -125
  26. package/dist/transformGizmo.d.ts.map +1 -1
  27. package/dist/view.d.ts +37 -4
  28. package/dist/view.d.ts.map +1 -1
  29. package/dist/viewportGizmo.d.ts +107 -119
  30. package/dist/viewportGizmo.d.ts.map +1 -1
  31. package/package.json +15 -10
  32. package/src/boxSelect.ts +12 -133
  33. package/src/browser.ts +16 -0
  34. package/src/element.ts +19 -106
  35. package/src/index.ts +35 -16
  36. package/src/inspector.ts +70 -93
  37. package/src/measuringTape.ts +28 -92
  38. package/src/mount.ts +53 -286
  39. package/src/overlayView.ts +36 -57
  40. package/src/pivotControls.ts +8 -94
  41. package/src/transformGizmo.ts +8 -108
  42. package/src/view.ts +89 -51
  43. package/src/viewportGizmo.ts +8 -97
  44. package/dist/assets.d.ts +0 -53
  45. package/dist/assets.d.ts.map +0 -1
  46. package/dist/dom/animationFrames.d.ts +0 -12
  47. package/dist/dom/animationFrames.d.ts.map +0 -1
  48. package/dist/dom/canvas.d.ts +0 -26
  49. package/dist/dom/canvas.d.ts.map +0 -1
  50. package/dist/dom/latch.d.ts +0 -15
  51. package/dist/dom/latch.d.ts.map +0 -1
  52. package/dist/dom/models.d.ts +0 -10
  53. package/dist/dom/models.d.ts.map +0 -1
  54. package/dist/dom/overlays.d.ts +0 -24
  55. package/dist/dom/overlays.d.ts.map +0 -1
  56. package/dist/dom/pointer.d.ts +0 -49
  57. package/dist/dom/pointer.d.ts.map +0 -1
  58. package/dist/dom/postprocessing.d.ts +0 -22
  59. package/dist/dom/postprocessing.d.ts.map +0 -1
  60. package/dist/dom/property.d.ts +0 -15
  61. package/dist/dom/property.d.ts.map +0 -1
  62. package/dist/dom/reconciled.d.ts +0 -10
  63. package/dist/dom/reconciled.d.ts.map +0 -1
  64. package/dist/dom/renderSettings.d.ts +0 -58
  65. package/dist/dom/renderSettings.d.ts.map +0 -1
  66. package/dist/dom/typedScenes.d.ts +0 -14
  67. package/dist/dom/typedScenes.d.ts.map +0 -1
  68. package/dist/dom/updates.d.ts +0 -8
  69. package/dist/dom/updates.d.ts.map +0 -1
  70. package/dist/dom/viewport.d.ts +0 -40
  71. package/dist/dom/viewport.d.ts.map +0 -1
  72. package/dist/dom/webgl.d.ts +0 -12
  73. package/dist/dom/webgl.d.ts.map +0 -1
  74. package/dist/dom/webgpu.d.ts +0 -24
  75. package/dist/dom/webgpu.d.ts.map +0 -1
  76. package/dist/dom/webgpuPostprocessing.d.ts +0 -4
  77. package/dist/dom/webgpuPostprocessing.d.ts.map +0 -1
  78. package/dist/dom/xr.d.ts +0 -53
  79. package/dist/dom/xr.d.ts.map +0 -1
  80. package/dist/dom/xrGlide.d.ts +0 -49
  81. package/dist/dom/xrGlide.d.ts.map +0 -1
  82. package/dist/dom/xrHub.d.ts +0 -45
  83. package/dist/dom/xrHub.d.ts.map +0 -1
  84. package/dist/dom/xrInputs.d.ts +0 -40
  85. package/dist/dom/xrInputs.d.ts.map +0 -1
  86. package/dist/dom/xrSpaces.d.ts +0 -33
  87. package/dist/dom/xrSpaces.d.ts.map +0 -1
  88. package/dist/dom/xrTarget.d.ts +0 -36
  89. package/dist/dom/xrTarget.d.ts.map +0 -1
  90. package/dist/environment.d.ts +0 -64
  91. package/dist/environment.d.ts.map +0 -1
  92. package/dist/xr.d.ts +0 -34
  93. package/dist/xr.d.ts.map +0 -1
  94. package/src/assets.ts +0 -151
  95. package/src/dom/animationFrames.ts +0 -32
  96. package/src/dom/canvas.ts +0 -54
  97. package/src/dom/latch.ts +0 -36
  98. package/src/dom/models.ts +0 -37
  99. package/src/dom/overlays.ts +0 -63
  100. package/src/dom/pointer.ts +0 -163
  101. package/src/dom/postprocessing.ts +0 -116
  102. package/src/dom/property.ts +0 -43
  103. package/src/dom/reconciled.ts +0 -51
  104. package/src/dom/renderSettings.ts +0 -117
  105. package/src/dom/typedScenes.ts +0 -21
  106. package/src/dom/updates.ts +0 -14
  107. package/src/dom/viewport.ts +0 -97
  108. package/src/dom/webgl.ts +0 -231
  109. package/src/dom/webgpu.ts +0 -220
  110. package/src/dom/webgpuPostprocessing.ts +0 -102
  111. package/src/dom/xr.ts +0 -211
  112. package/src/dom/xrGlide.ts +0 -114
  113. package/src/dom/xrHub.ts +0 -118
  114. package/src/dom/xrInputs.ts +0 -309
  115. package/src/dom/xrSpaces.ts +0 -287
  116. package/src/dom/xrTarget.ts +0 -71
  117. package/src/environment.ts +0 -78
  118. package/src/xr.ts +0 -36
package/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.4](https://github.com/opsydyn/fold-kit-experiments/compare/effect-three-foldkit-v0.6.3...effect-three-foldkit-v0.6.4) (2026-10-30)
4
+
5
+ ### Miscellaneous Chores
6
+
7
+ - **effect-three-foldkit:** Synchronize effect-three versions
8
+
9
+ ## [0.6.3](https://github.com/opsydyn/fold-kit-experiments/compare/effect-three-foldkit-v0.6.2...effect-three-foldkit-v0.6.3) (2026-10-29)
10
+
11
+ ### Bug Fixes
12
+
13
+ - **deps:** move to FoldKit 0.170 and Effect 4.1 with one Effect throughout ([ef2f8c2](https://github.com/opsydyn/fold-kit-experiments/commit/ef2f8c28215cf4d497b6483e3e3acc12f7a33496))
14
+
15
+ ## [0.6.2](https://github.com/opsydyn/fold-kit-experiments/compare/effect-three-foldkit-v0.6.1...effect-three-foldkit-v0.6.2) (2026-10-28)
16
+
17
+ ### Bug Fixes
18
+
19
+ - **deps:** accept FoldKit 0.169 and move the workspace to it ([b5e40b0](https://github.com/opsydyn/fold-kit-experiments/commit/b5e40b0317e594f38c0596aac49f79cccae4a974))
20
+ - **deps:** accept FoldKit 0.169 and move the workspace to it ([fc82d5d](https://github.com/opsydyn/fold-kit-experiments/commit/fc82d5de50151053514e9e7a0ab676a55141e755))
21
+
22
+ ## [0.6.1](https://github.com/opsydyn/fold-kit-experiments/compare/effect-three-foldkit-v0.6.0...effect-three-foldkit-v0.6.1) (2026-10-27)
23
+
24
+ ### Bug Fixes
25
+
26
+ - **effect-three:** let a finger's tap on nothing wander a little ([db9e070](https://github.com/opsydyn/fold-kit-experiments/commit/db9e07046baed1f3e61ba0730e085497d52ba0e1))
27
+
28
+ ## [0.6.0](https://github.com/opsydyn/fold-kit-experiments/compare/effect-three-foldkit-v0.5.0...effect-three-foldkit-v0.6.0) (2026-10-21)
29
+
30
+ ### Features
31
+
32
+ - **effect-three:** snapshot a world on until, and start a run from one ([881d520](https://github.com/opsydyn/fold-kit-experiments/commit/881d5206531c8f0a42fce1e1428034a41e558656))
33
+
34
+ ## [0.5.0](https://github.com/opsydyn/fold-kit-experiments/compare/effect-three-foldkit-v0.4.0...effect-three-foldkit-v0.5.0) (2026-10-20)
35
+
36
+ ### Features
37
+
38
+ - **effect-three-foldkit:** load, share, cancel and free the assets scenes ask for ([eca8f9f](https://github.com/opsydyn/fold-kit-experiments/commit/eca8f9fad2637f7fb5896fb832981c5258be1cdb))
39
+ - **effect-three-foldkit:** stream an asset's levels of detail ([ec5840c](https://github.com/opsydyn/fold-kit-experiments/commit/ec5840c299b7f20d02ffe556f26c7c5fc1293bb4))
40
+ - **effect-three:** physics on the Model's clock, for worlds that must agree ([e91612c](https://github.com/opsydyn/fold-kit-experiments/commit/e91612c50b20be408df2e6e287203456ae45fe1b))
41
+
3
42
  ## [0.4.0](https://github.com/opsydyn/fold-kit-experiments/compare/effect-three-foldkit-v0.3.0...effect-three-foldkit-v0.4.0) (2026-10-20)
4
43
 
5
44
  ### Features
package/README.md CHANGED
@@ -1,32 +1,37 @@
1
1
  # @opsydyn/effect-three-foldkit
2
2
 
3
- A thin Foldkit adapter for [`@opsydyn/effect-three`](../effect-three/README.md): derive a Three.js scene from your Model, get pointer interaction back as your own typed Messages, and let Foldkit's runtime own the scene's lifetime.
3
+ An Effect UI adapter for [`@opsydyn/effect-three`](../effect-three/README.md). Derive the scene from your component model, handle typed scene events, and let Effect UI scope the renderer to its element.
4
4
 
5
- > Status: `0.x`, released with the core at one version ([Stability](../effect-three/README.md#stability), [Limits](../effect-three/README.md#limits)). The API is documented in [`etc/effect-three-foldkit.api.md`](etc/effect-three-foldkit.api.md). Live samples are in `apps/web` at `/effect-three` and on the effect-three promo site (`apps/three-promo`); their source is in [`packages/effect-three-samples`](../effect-three-samples/).
5
+ > Releases use the same version as the core ([Stability](../effect-three/README.md#stability), [Limits](../effect-three/README.md#limits)). The API is documented in [`etc/effect-three-foldkit.api.md`](etc/effect-three-foldkit.api.md). Live samples are in `apps/web` at `/effect-three` and on the effect-three promo site (`apps/three-promo`); their source is in [`packages/effect-three-samples`](../effect-three-samples/).
6
6
 
7
7
  ```sh
8
- npm install @opsydyn/effect-three-foldkit @opsydyn/effect-three effect foldkit three
8
+ npm install ./opsydyn-effect-three-foldkit-1.0.0-next.0.tgz ./opsydyn-effect-three-1.0.0-next.0.tgz effect@4.1.6 three https://pkg.pr.new/Effect-TS/ui/@effect/ui@77dcd92
9
9
  ```
10
10
 
11
+ The command uses the coordinated local prerelease archives. For a FoldKit runtime, use the previous `0.x` release and its corresponding documentation.
12
+
11
13
  ## Use it
12
14
 
13
15
  ```ts
14
16
  // entry: once per application
15
- import * as EffectThreeFoldkit from '@opsydyn/effect-three-foldkit';
17
+ import * as EffectThreeUi from '@opsydyn/effect-three-foldkit';
16
18
 
17
- export const environment = EffectThreeFoldkit.makeEnvironment(window);
18
- export const sceneMount = EffectThreeFoldkit.makeSceneMount(environment);
19
+ export const environment = EffectThreeUi.makeEnvironment(window);
20
+ export const sceneMount = EffectThreeUi.makeSceneMount(environment);
19
21
  ```
20
22
 
21
23
  ```ts
22
24
  // message.ts
23
- export const Message = defineMessageUnion({
25
+ import { UiSchema } from '@effect/ui';
26
+ import { Schema } from 'effect';
27
+
28
+ export const Message = UiSchema.TaggedEnum({
24
29
  ClickedCube: { key: Schema.String },
25
- ReceivedSceneLifecycle: { lifecycle: EffectThreeFoldkit.SceneLifecycle },
30
+ ReceivedSceneLifecycle: { lifecycle: EffectThreeUi.SceneLifecycle },
26
31
  });
27
32
 
28
33
  // view.ts
29
- EffectThreeFoldkit.view(
34
+ EffectThreeUi.view(
30
35
  {
31
36
  scene: sceneFor(model), // plain data derived from the Model
32
37
  mount: sceneMount,
@@ -38,33 +43,34 @@ EffectThreeFoldkit.view(
38
43
  );
39
44
  ```
40
45
 
41
- - **Updates are in place.** Foldkit hands the element a new scene on every render, and the core diffs it, so unchanged scenes cost no host changes and changed ones reuse their three.js objects.
42
- - **Animation never touches the Model.** Behaviours such as `spin` run in the frame loop, outside Foldkit's `update`.
43
- - **Events are typed and opt-in:** `onClick`, `onDoubleClick`, `onContextMenu`, `onPointerDown`, `onPointerUp`, `onPointerEnter`, `onPointerMove`, `onPointerLeave`, `onPointerMissed`, `onWheel`, `onDrag`, `onDragEnd`, `onGesture`, `onGestureEnd`, `onAutoRotated`, `onCollision`, `onContactForce`, `onMeasured`, `onLabelMeasured`, `onXRSession`, `onXRStick`, `onXRButton`, `onXRSurface`, `onXRMoved`, `onXRPlanes`, `onXRMeshes`, `onPerformanceChange`, `onError` and `onReconciled`. Only the handlers you pass are bound. Hits carry the mesh key (and instance), world-space point, distance, face normal and uv.
46
+ - **Updates are in place.** Effect UI delivers changed mount arguments and the core reconciles each new scene, so unchanged scenes cost no host changes and changed ones reuse their three.js objects.
47
+ - **Animation never touches the Model.** Behaviours such as `spin` run in the frame loop, outside the component's `update`.
48
+ - **Events are typed and opt-in:** `onClick`, `onDoubleClick`, `onContextMenu`, `onPointerDown`, `onPointerUp`, `onPointerEnter`, `onPointerMove`, `onPointerLeave`, `onPointerMissed`, `onWheel`, `onDrag`, `onDragEnd`, `onGesture`, `onGestureEnd`, `onAutoRotated`, `onCollision`, `onContactForce`, `onPhysicsReached`, `onMeasured`, `onLabelMeasured`, `onXRSession`, `onXRStick`, `onXRButton`, `onXRSurface`, `onXRMoved`, `onXRPlanes`, `onXRMeshes`, `onPerformanceChange`, `onError`, `onReconciled`, `onAssetLoaded` and `onAssetFailed`. Only the handlers you pass are bound. Hits carry the mesh key (and instance), world-space point, distance, face normal and uv.
44
49
  - **Controls:** with `scene({ gestures: 'scene' })`, `onGesture` reports drags, the wheel and pinches; `orbit(model.camera, gesture)` moves a camera kept in the Model ([ADR-006](../../docs/effect-three/adr/006-controls-as-data.md)).
45
50
  - **Editing widgets as submodels:** `TransformGizmo` (three's `TransformControls`), `PivotControls` (Drei's), `BoxSelect` (three's `SelectionBox`, from shift-drags), `ViewportGizmo` (Drei's `GizmoHelper`, in a scene's `hud`) and `MeasuringTape` each keep a Model, take Messages from the scene's events and report OutMessages (`Moved`, `Finished`, `Selected`, `Turned`, `Measured`) for the parent to apply; `inspectorView` draws the fields `Inspector.fields` reads from a schema as a form. The core keeps the maths pure and checked against three's and Drei's own ([ADR-006](../../docs/effect-three/adr/006-controls-as-data.md)).
46
51
  - **HTML overlays:** `overlays: [{ overlay, content }]` places Model-rendered HTML at points in the scene every drawn frame, as Drei's `Html`.
47
52
  - **Groups and drags:** hits carry their ancestor `path`, and an `interactive` group makes every mesh inside it pickable. A press on a mesh captures the pointer, so `onDrag` keeps firing off the mesh and off the canvas; pair its `ray` with `pointOnPlane` to drag along a plane.
48
53
  - **Pixel ratio:** `makeEnvironment(window, { pixelRatio: [1, 2] })` takes a fixed ratio or a `[min, max]` range around the device's (the default is `[1, 2]`, as React Three Fiber's `dpr`), and re-measures when the device ratio changes.
49
- - **Assets:** `environment.assets.loadModel(id, url)`, `loadTexture(id, url)`, `loadFont(id, url)` and `loadEnvironment(id, url)` load glTF models, textures, typeface fonts and HDR panoramas as Effects for Commands (settle them into `AsyncData`), lend them to the store, and own them: loading an id again replaces and disposes the old asset, and `unload(id)` frees it. Show a model with `borrowed({ id, animation: play('wave') })`; use a texture with `map: id`, a font with `text({ font: id })`, a panorama with `environment({ map: id })` (Drei's presets: `environmentPresetUrl('city')`).
54
+ - **Assets a scene asks for:** list them in the description, `scene({ assets: [modelAsset({ id: 'robot', url: 'robot.glb' }), textureAsset({ id: 'floor', url: 'tiles.png' })] })`. The environment loads each once however many scenes ask, aborts a load no scene asks for any more, and withdraws and disposes an asset when the last scene stops asking; each scene hears `onAssetLoaded` (a model's parts and clips with it) and `onAssetFailed`. An asset with coarser `levels` shows each as it arrives, finer replacing coarser, and `onAssetLoaded` says the `level` and whether it is `final`. Settle them into `AsyncData` by id; to unload, stop asking ([ADR-015](../../docs/effect-three/adr/015-assets-a-scene-asks-for.md)).
55
+ - **Assets from Commands:** `environment.assets.loadModel(id, url)`, `loadTexture(id, url)`, `loadFont(id, url)` and `loadEnvironment(id, url)` load glTF models, textures, typeface fonts and HDR panoramas as Effects for Commands (settle them into `AsyncData`), lend them to the store, and own them: loading an id again replaces and disposes the old asset, and `unload(id)` frees it. Show a model with `borrowed({ id, animation: play('wave') })`; use a texture with `map: id`, a font with `text({ font: id })`, a panorama with `environment({ map: id })` (Drei's presets: `environmentPresetUrl('city')`).
50
56
  - **Engines:** `makeEnvironment(window, { physics: loadRapier(), labels: troikaLabels() })` adds the Rapier physics engine ([`effect-three-rapier`](../effect-three-rapier/README.md); scenes wait for it to load) and the troika label engine ([`effect-three-troika`](../effect-three-troika/README.md)). Without them, bodies stay put and labels are empty.
51
57
  - **XR:** `environment.xr.supported(mode)`, `enter(mode)` and `exit` are Effects for Commands; `enter` (from a click) presents the mounted scene that describes `xr`, in VR or AR. Controllers and hands hover, click and drag; sticks, buttons and AR surfaces arrive through `onXRStick`, `onXRButton` and `onXRSurface` ([ADR-008](../../docs/effect-three/adr/008-immersive-sessions.md)).
52
58
  - **Browser defaults:** a context menu over an interactive mesh keeps the browser's menu shut; elsewhere it opens as usual. Wheel listening is passive, so the page still scrolls.
53
59
  - **Update telemetry:** `onReconciled` reports what each update did (created, updated, moved, removed, replaced, reordered) and the GPU resources held afterwards. It fires at startup and after updates that changed something, never for no-ops, so storing it in the Model can't loop.
54
- - **Lifecycle:** `StartedScene` once the scene is running, or `FailedScene { reason }` (malformed or invalid scene, or no WebGL2).
60
+ - **Lifecycle:** `StartedScene` once the scene is running, or `FailedScene { reason }` (invalid scene, unavailable renderer, or unavailable physics).
55
61
 
56
62
  ## What the Mount handles
57
63
 
58
- | Concern | Behaviour |
59
- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
60
- | Unmount | Releases the renderer, the WebGL context (`forceContextLoss`), GPU resources, pointer listeners, observers and the frame subscription. |
61
- | Resize | `ResizeObserver` updates the camera aspect and drawing buffer; device pixel ratio is capped at 2. |
62
- | Off-screen | `IntersectionObserver` pauses frames while the element isn't visible. |
63
- | Reduced motion | `prefers-reduced-motion: reduce` freezes behaviours; frames still render. |
64
- | DevTools time travel | While Foldkit reports the view as `Paused`, pointer input and scene events are dropped. |
65
- | Validation | Scenes passed through `view` are type-checked at compile time and skip runtime validation. Any other value assigned to the element is Schema-decoded, and failures arrive as `onError` with `MalformedScene`. |
64
+ | Concern | Behaviour |
65
+ | -------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
66
+ | Unmount | Releases the renderer, the WebGL context (`forceContextLoss`), GPU resources, pointer listeners, observers and the frame subscription. |
67
+ | Resize | `ResizeObserver` updates the camera aspect and drawing buffer; device pixel ratio is capped at 2. |
68
+ | Off-screen | `IntersectionObserver` pauses frames while the element isn't visible. |
69
+ | Reduced motion | `prefers-reduced-motion: reduce` freezes behaviours; frames still render. |
70
+ | Input gate | Set `live: false` to drop pointer and scene events while showing the scene. |
71
+ | Scene updates | A rejected description reports `onError`; the renderer keeps its last valid scene. |
66
72
 
67
- `<effect-three-scene>` is never registered with `customElements`, so there's nothing to re-register under HMR or guard during SSR. See [ADR-002](../../docs/effect-three/adr/002-foldkit-adapter-seam.md).
73
+ The mount receives the description as an Effect UI argument. The browser host reconciles later arguments and releases the canvas and GPU resources with the element's scope. Scene events are Schema-decoded by `sceneElement`. For a server-rendered component, use `defineScopedSceneMount` with an Effect that acquires the browser environment when the mount runs.
68
74
 
69
75
  ## Options
70
76
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Box selection as a Foldkit submodel (roadmap, "Beyond parity" 5), after Drei's `Select`
2
+ * Box selection as an Effect UI submodel (roadmap, "Beyond parity" 5), after Drei's `Select`
3
3
  * over three.js's `SelectionBox`: a shift-drag that begins on nothing draws a box, and
4
4
  * its release selects what the box holds, through the core's pure `boxSelect`. The parent
5
5
  * owns what is selected; the submodel owns only the box:
@@ -17,134 +17,108 @@
17
17
  *
18
18
  * @module
19
19
  */
20
- import { type Camera, type Gesture } from '@opsydyn/effect-three';
21
- import { Option, Schema } from 'effect';
22
- import type { ReturnWithOutMessage } from 'foldkit/update';
23
- /** Something the box can select: its key, and the point that must fall inside. */
24
- declare const Selectable: Schema.Struct<{
25
- readonly key: Schema.String;
26
- readonly at: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
27
- }>;
28
- /** A box being drawn: its corners in the canvas's normalised coordinates, −1 to 1, y up. */
29
- export declare const Box: Schema.Struct<{
30
- readonly from: Schema.Struct<{
31
- readonly x: Schema.Finite;
32
- readonly y: Schema.Finite;
20
+ import { UiSchema } from '@effect/ui';
21
+ import { BoxSelect as Controller } from '@opsydyn/effect-three/browser';
22
+ export declare const Box: import("effect/Schema").Struct<{
23
+ readonly from: import("effect/Schema").Struct<{
24
+ readonly x: import("effect/Schema").Finite;
25
+ readonly y: import("effect/Schema").Finite;
33
26
  }>;
34
- readonly to: Schema.Struct<{
35
- readonly x: Schema.Finite;
36
- readonly y: Schema.Finite;
27
+ readonly to: import("effect/Schema").Struct<{
28
+ readonly x: import("effect/Schema").Finite;
29
+ readonly y: import("effect/Schema").Finite;
37
30
  }>;
38
- readonly width: Schema.Finite;
39
- readonly height: Schema.Finite;
40
- }>;
41
- export type Box = typeof Box.Type;
42
- export declare const Model: Schema.Struct<{
43
- readonly box: Schema.Option<Schema.Struct<{
44
- readonly from: Schema.Struct<{
45
- readonly x: Schema.Finite;
46
- readonly y: Schema.Finite;
31
+ readonly width: import("effect/Schema").Finite;
32
+ readonly height: import("effect/Schema").Finite;
33
+ }>, Model: import("effect/Schema").Struct<{
34
+ readonly box: import("effect/Schema").Option<import("effect/Schema").Struct<{
35
+ readonly from: import("effect/Schema").Struct<{
36
+ readonly x: import("effect/Schema").Finite;
37
+ readonly y: import("effect/Schema").Finite;
47
38
  }>;
48
- readonly to: Schema.Struct<{
49
- readonly x: Schema.Finite;
50
- readonly y: Schema.Finite;
39
+ readonly to: import("effect/Schema").Struct<{
40
+ readonly x: import("effect/Schema").Finite;
41
+ readonly y: import("effect/Schema").Finite;
51
42
  }>;
52
- readonly width: Schema.Finite;
53
- readonly height: Schema.Finite;
43
+ readonly width: import("effect/Schema").Finite;
44
+ readonly height: import("effect/Schema").Finite;
54
45
  }>>;
55
- }>;
56
- export type Model = typeof Model.Type;
57
- export declare const Message: import("foldkit/message").MessageUnion<{
58
- readonly Dragged: {
59
- x: Schema.Finite;
60
- y: Schema.Finite;
61
- deltaX: Schema.Finite;
62
- deltaY: Schema.Finite;
63
- width: Schema.Finite;
64
- height: Schema.Finite;
65
- };
66
- readonly Ended: {
67
- camera: Schema.Union<readonly [Schema.TaggedStruct<"Perspective", {
68
- readonly fov: Schema.Finite;
69
- readonly near: Schema.Finite;
70
- readonly far: Schema.Finite;
71
- readonly position: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
72
- readonly lookAt: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
73
- readonly damping: Schema.Finite;
74
- readonly autoRotate: Schema.Finite;
75
- readonly shake: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Struct<{
76
- readonly intensity: Schema.Finite;
77
- readonly decay: Schema.Boolean;
78
- readonly decayRate: Schema.Finite;
79
- readonly maxYaw: Schema.Finite;
80
- readonly maxPitch: Schema.Finite;
81
- readonly maxRoll: Schema.Finite;
82
- readonly yawFrequency: Schema.Finite;
83
- readonly pitchFrequency: Schema.Finite;
84
- readonly rollFrequency: Schema.Finite;
85
- readonly trigger: Schema.Finite;
46
+ }>, init: () => Controller.Model, drawing: (model: Controller.Model) => boolean, claims: (model: Controller.Model, drag: Controller.DragGesture) => boolean, inside: (model: Controller.Model, camera: import("@opsydyn/effect-three").Camera, selectable: readonly {
47
+ readonly key: string;
48
+ readonly at: readonly [number, number, number];
49
+ }[]) => ReadonlyArray<string>, rectangle: (model: Controller.Model) => import("effect/Option").Option<Controller.Rectangle>;
50
+ export type Model = Controller.Model;
51
+ export type DragGesture = Controller.DragGesture;
52
+ export type Rectangle = Controller.Rectangle;
53
+ export declare const Message: UiSchema.TaggedEnum<{
54
+ readonly Cancelled: import("effect/Schema").TaggedStruct<"Cancelled", {}>;
55
+ readonly Dragged: import("effect/Schema").TaggedStruct<"Dragged", {
56
+ readonly x: import("effect/Schema").Finite;
57
+ readonly y: import("effect/Schema").Finite;
58
+ readonly deltaX: import("effect/Schema").Finite;
59
+ readonly deltaY: import("effect/Schema").Finite;
60
+ readonly width: import("effect/Schema").Finite;
61
+ readonly height: import("effect/Schema").Finite;
62
+ }>;
63
+ readonly Ended: import("effect/Schema").TaggedStruct<"Ended", {
64
+ readonly camera: import("effect/Schema").Union<readonly [import("effect/Schema").TaggedStruct<"Perspective", {
65
+ readonly fov: import("effect/Schema").Finite;
66
+ readonly near: import("effect/Schema").Finite;
67
+ readonly far: import("effect/Schema").Finite;
68
+ readonly position: import("effect/Schema").Tuple<readonly [import("effect/Schema").Finite, import("effect/Schema").Finite, import("effect/Schema").Finite]>;
69
+ readonly lookAt: import("effect/Schema").Tuple<readonly [import("effect/Schema").Finite, import("effect/Schema").Finite, import("effect/Schema").Finite]>;
70
+ readonly damping: import("effect/Schema").Finite;
71
+ readonly autoRotate: import("effect/Schema").Finite;
72
+ readonly shake: import("effect/Schema").withDecodingDefaultKey<import("effect/Schema").NullOr<import("effect/Schema").Struct<{
73
+ readonly intensity: import("effect/Schema").Finite;
74
+ readonly decay: import("effect/Schema").Boolean;
75
+ readonly decayRate: import("effect/Schema").Finite;
76
+ readonly maxYaw: import("effect/Schema").Finite;
77
+ readonly maxPitch: import("effect/Schema").Finite;
78
+ readonly maxRoll: import("effect/Schema").Finite;
79
+ readonly yawFrequency: import("effect/Schema").Finite;
80
+ readonly pitchFrequency: import("effect/Schema").Finite;
81
+ readonly rollFrequency: import("effect/Schema").Finite;
82
+ readonly trigger: import("effect/Schema").Finite;
86
83
  }>>, never>;
87
- }>, Schema.TaggedStruct<"Orthographic", {
88
- readonly zoom: Schema.Finite;
89
- readonly near: Schema.Finite;
90
- readonly far: Schema.Finite;
91
- readonly position: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
92
- readonly lookAt: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
93
- readonly damping: Schema.Finite;
94
- readonly autoRotate: Schema.Finite;
95
- readonly shake: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Struct<{
96
- readonly intensity: Schema.Finite;
97
- readonly decay: Schema.Boolean;
98
- readonly decayRate: Schema.Finite;
99
- readonly maxYaw: Schema.Finite;
100
- readonly maxPitch: Schema.Finite;
101
- readonly maxRoll: Schema.Finite;
102
- readonly yawFrequency: Schema.Finite;
103
- readonly pitchFrequency: Schema.Finite;
104
- readonly rollFrequency: Schema.Finite;
105
- readonly trigger: Schema.Finite;
84
+ }>, import("effect/Schema").TaggedStruct<"Orthographic", {
85
+ readonly zoom: import("effect/Schema").Finite;
86
+ readonly near: import("effect/Schema").Finite;
87
+ readonly far: import("effect/Schema").Finite;
88
+ readonly position: import("effect/Schema").Tuple<readonly [import("effect/Schema").Finite, import("effect/Schema").Finite, import("effect/Schema").Finite]>;
89
+ readonly lookAt: import("effect/Schema").Tuple<readonly [import("effect/Schema").Finite, import("effect/Schema").Finite, import("effect/Schema").Finite]>;
90
+ readonly damping: import("effect/Schema").Finite;
91
+ readonly autoRotate: import("effect/Schema").Finite;
92
+ readonly shake: import("effect/Schema").withDecodingDefaultKey<import("effect/Schema").NullOr<import("effect/Schema").Struct<{
93
+ readonly intensity: import("effect/Schema").Finite;
94
+ readonly decay: import("effect/Schema").Boolean;
95
+ readonly decayRate: import("effect/Schema").Finite;
96
+ readonly maxYaw: import("effect/Schema").Finite;
97
+ readonly maxPitch: import("effect/Schema").Finite;
98
+ readonly maxRoll: import("effect/Schema").Finite;
99
+ readonly yawFrequency: import("effect/Schema").Finite;
100
+ readonly pitchFrequency: import("effect/Schema").Finite;
101
+ readonly rollFrequency: import("effect/Schema").Finite;
102
+ readonly trigger: import("effect/Schema").Finite;
106
103
  }>>, never>;
107
104
  }>]>;
108
- selectable: Schema.$Array<Schema.Struct<{
109
- readonly key: Schema.String;
110
- readonly at: Schema.Tuple<readonly [Schema.Finite, Schema.Finite, Schema.Finite]>;
105
+ readonly selectable: import("effect/Schema").$Array<import("effect/Schema").Struct<{
106
+ readonly key: import("effect/Schema").String;
107
+ readonly at: import("effect/Schema").Tuple<readonly [import("effect/Schema").Finite, import("effect/Schema").Finite, import("effect/Schema").Finite]>;
111
108
  }>>;
112
- };
113
- readonly Cancelled: {};
109
+ }>;
114
110
  }>;
115
111
  export type Message = typeof Message.Type;
116
- export declare const OutMessage: import("foldkit/message").MessageUnion<{
117
- /** The box was let go: the keys inside it, for the new selection. */
118
- readonly Selected: {
119
- keys: Schema.$Array<Schema.String>;
120
- };
112
+ export declare const OutMessage: UiSchema.TaggedEnum<{
113
+ readonly Selected: import("effect/Schema").TaggedStruct<"Selected", {
114
+ readonly keys: import("effect/Schema").$Array<import("effect/Schema").String>;
115
+ }>;
121
116
  }>;
122
117
  export type OutMessage = typeof OutMessage.Type;
123
- /** No box drawn. */
124
- export declare const init: () => Model;
125
- type Return = ReturnWithOutMessage<Model, Message, OutMessage>;
126
- type Selectables = ReadonlyArray<typeof Selectable.Type>;
127
- export declare const update: (model: Model, message: Message) => Return;
128
- /** Whether a box is being drawn: the parent leaves the camera alone while it is. */
129
- export declare const drawing: (model: Model) => boolean;
130
- /** A scene `Drag` gesture: the only kind a box takes. */
131
- export type DragGesture = Extract<Gesture, {
132
- readonly _tag: 'Drag';
133
- }>;
134
- /** Whether the box takes `drag`: every drag while one is drawn, and one that starts it. */
135
- export declare const claims: (model: Model, drag: DragGesture) => boolean;
136
- /** The `Dragged` Message for a drag the box claims. */
137
- export declare const dragOf: (gesture: DragGesture) => Message;
138
- /** What the box holds so far, seen through `camera`: none while no box is drawn. */
139
- export declare const inside: (model: Model, camera: Camera, selectable: Selectables) => ReadonlyArray<string>;
140
- /** A box on the canvas, in CSS pixels from its top left. */
141
- export type Rectangle = {
142
- readonly left: number;
143
- readonly top: number;
144
- readonly width: number;
145
- readonly height: number;
118
+ export declare const update: (model: Controller.Model, message: Controller.Message) => {
119
+ readonly model: Controller.Model;
120
+ readonly outMessage?: Controller.OutMessage;
146
121
  };
147
- /** Where the box sits on the canvas, while one is drawn. */
148
- export declare const rectangle: (model: Model) => Option.Option<Rectangle>;
149
- export {};
122
+ /** Turns the scene's drag gesture into the box selection's message. */
123
+ export declare const dragOf: (gesture: DragGesture) => Message;
150
124
  //# sourceMappingURL=boxSelect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"boxSelect.d.ts","sourceRoot":"","sources":["../src/boxSelect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAa,KAAK,MAAM,EAAE,KAAK,OAAO,EAAe,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAI3D,kFAAkF;AAClF,QAAA,MAAM,UAAU;;;EAA8D,CAAC;AAE/E,4FAA4F;AAC5F,eAAO,MAAM,GAAG;;;;;;;;;;;EAKd,CAAC;AACH,MAAM,MAAM,GAAG,GAAG,OAAO,GAAG,CAAC,IAAI,CAAC;AAElC,eAAO,MAAM,KAAK;;;;;;;;;;;;;EAA6C,CAAC;AAChE,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAC;AAEtC,eAAO,MAAM,OAAO;;QAEhB,CAAC;QACD,CAAC;QACD,MAAM;QACN,MAAM;QACN,KAAK;QACL,MAAM;;;QAEC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAAsB,UAAU;;;;;;EAE/C,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAC;AAE1C,eAAO,MAAM,UAAU;IACrB,qEAAqE;;QACzD,IAAI;;EAChB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC;AAEhD,oBAAoB;AACpB,eAAO,MAAM,IAAI,QAAO,KAAiC,CAAC;AAE1D,KAAK,MAAM,GAAG,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;AAe/D,KAAK,WAAW,GAAG,aAAa,CAAC,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;AAczD,eAAO,MAAM,MAAM,UAAW,KAAK,WAAW,OAAO,KAAG,MAKpD,CAAC;AAEL,oFAAoF;AACpF,eAAO,MAAM,OAAO,UAAW,KAAK,KAAG,OAAmC,CAAC;AAE3E,yDAAyD;AACzD,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAStE,2FAA2F;AAC3F,eAAO,MAAM,MAAM,UAAW,KAAK,QAAQ,WAAW,KAAG,OACtB,CAAC;AAEpC,uDAAuD;AACvD,eAAO,MAAM,MAAM,YAAa,WAAW,KAAG,OAQ1C,CAAC;AAEL,oFAAoF;AACpF,eAAO,MAAM,MAAM,UACV,KAAK,UACJ,MAAM,cACF,WAAW,KACtB,aAAa,CAAC,MAAM,CAInB,CAAC;AAEL,4DAA4D;AAC5D,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAUF,4DAA4D;AAC5D,eAAO,MAAM,SAAS,UAAW,KAAK,KAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAC/B,CAAC"}
1
+ {"version":3,"file":"boxSelect.d.ts","sourceRoot":"","sources":["../src/boxSelect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAExE,eAAO,MAAQ,GAAG;;;;;;;;;;;IAAE,KAAK;;;;;;;;;;;;;IAAE,IAAI,0BAAE,OAAO,wCAAE,MAAM,sEAAE,MAAM;;;+BAAE,SAAS,mFAAe,CAAC;AACnF,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;AACrC,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;AACjD,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;AAE7C,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAgD,CAAC;AACrE,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAC;AAC1C,eAAO,MAAM,UAAU;;;;EAAmD,CAAC;AAC3E,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC;AAEhD,eAAO,MAAM,MAAM;;;CAAoB,CAAC;AAExC,uEAAuE;AACvE,eAAO,MAAM,MAAM,YAAa,WAAW,KAAG,OAAqC,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** @deprecated Use @opsydyn/effect-three/browser. */
2
+ export { BoxSelect, type Environment, makeEnvironment, MeasuringTape, mountSceneHost, overlayData, PivotControls, ReconciledDetail, sceneEventSchemas, TransformGizmo, ViewportGizmo, webglRendererFactory, webgpuRendererFactory, } from '@opsydyn/effect-three/browser';
3
+ //# sourceMappingURL=browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EACL,SAAS,EACT,KAAK,WAAW,EAChB,eAAe,EACf,aAAa,EACb,cAAc,EACd,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,32 @@
1
+ // src/browser.ts
2
+ import {
3
+ BoxSelect,
4
+ makeEnvironment,
5
+ MeasuringTape,
6
+ mountSceneHost,
7
+ overlayData,
8
+ PivotControls,
9
+ ReconciledDetail,
10
+ sceneEventSchemas,
11
+ TransformGizmo,
12
+ ViewportGizmo,
13
+ webglRendererFactory,
14
+ webgpuRendererFactory
15
+ } from "@opsydyn/effect-three/browser";
16
+ export {
17
+ BoxSelect,
18
+ MeasuringTape,
19
+ PivotControls,
20
+ ReconciledDetail,
21
+ TransformGizmo,
22
+ ViewportGizmo,
23
+ makeEnvironment,
24
+ mountSceneHost,
25
+ overlayData,
26
+ sceneEventSchemas,
27
+ webglRendererFactory,
28
+ webgpuRendererFactory
29
+ };
30
+
31
+ //# debugId=2B6D5EA924DBBEC264756E2164756E21
32
+ //# sourceMappingURL=browser.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/browser.ts"],
4
+ "sourcesContent": [
5
+ "/** @deprecated Use @opsydyn/effect-three/browser. */\nexport {\n BoxSelect,\n type Environment,\n makeEnvironment,\n MeasuringTape,\n mountSceneHost,\n overlayData,\n PivotControls,\n ReconciledDetail,\n sceneEventSchemas,\n TransformGizmo,\n ViewportGizmo,\n webglRendererFactory,\n webgpuRendererFactory,\n} from '@opsydyn/effect-three/browser';\n"
6
+ ],
7
+ "mappings": ";AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
8
+ "debugId": "2B6D5EA924DBBEC264756E2164756E21",
9
+ "names": []
10
+ }