@wardic/three 0.0.0-stage → 1.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/LICENSE +21 -0
- package/README.md +84 -2
- package/THIRD_PARTY_NOTICES.md +145 -0
- package/dist/TestStage.d.ts +45 -0
- package/dist/TestStage.d.ts.map +1 -0
- package/dist/TestStage.js +140 -0
- package/dist/TestStage.js.map +1 -0
- package/dist/ThreeColours.d.ts +52 -0
- package/dist/ThreeColours.d.ts.map +1 -0
- package/dist/ThreeColours.js +237 -0
- package/dist/ThreeColours.js.map +1 -0
- package/dist/ThreeDrag.d.ts +82 -0
- package/dist/ThreeDrag.d.ts.map +1 -0
- package/dist/ThreeDrag.js +243 -0
- package/dist/ThreeDrag.js.map +1 -0
- package/dist/ThreeInput.d.ts +69 -0
- package/dist/ThreeInput.d.ts.map +1 -0
- package/dist/ThreeInput.js +592 -0
- package/dist/ThreeInput.js.map +1 -0
- package/dist/ThreeInstances.d.ts +47 -0
- package/dist/ThreeInstances.d.ts.map +1 -0
- package/dist/ThreeInstances.js +392 -0
- package/dist/ThreeInstances.js.map +1 -0
- package/dist/ThreeRenderer.d.ts +45 -0
- package/dist/ThreeRenderer.d.ts.map +1 -0
- package/dist/ThreeRenderer.js +121 -0
- package/dist/ThreeRenderer.js.map +1 -0
- package/dist/ThreeValues.d.ts +15 -0
- package/dist/ThreeValues.d.ts.map +1 -0
- package/dist/ThreeValues.js +61 -0
- package/dist/ThreeValues.js.map +1 -0
- package/dist/WardicThree.d.ts +194 -0
- package/dist/WardicThree.d.ts.map +1 -0
- package/dist/WardicThree.js +162 -0
- package/dist/WardicThree.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/dev.d.ts +10 -0
- package/dist/internal/dev.d.ts.map +1 -0
- package/dist/internal/dev.js +11 -0
- package/dist/internal/dev.js.map +1 -0
- package/dist/internal/dev.production.d.ts +8 -0
- package/dist/internal/dev.production.d.ts.map +1 -0
- package/dist/internal/dev.production.js +8 -0
- package/dist/internal/dev.production.js.map +1 -0
- package/dist/internal/lookup.d.ts +29 -0
- package/dist/internal/lookup.d.ts.map +1 -0
- package/dist/internal/lookup.js +245 -0
- package/dist/internal/lookup.js.map +1 -0
- package/dist/internal/shared-material.d.ts +8 -0
- package/dist/internal/shared-material.d.ts.map +1 -0
- package/dist/internal/shared-material.js +95 -0
- package/dist/internal/shared-material.js.map +1 -0
- package/dist/solid/feature.d.ts +42 -0
- package/dist/solid/feature.d.ts.map +1 -0
- package/dist/solid/feature.js +2 -0
- package/dist/solid/feature.js.map +1 -0
- package/dist/solid/scene-batch.d.ts +10 -0
- package/dist/solid/scene-batch.d.ts.map +1 -0
- package/dist/solid/scene-batch.js +436 -0
- package/dist/solid/scene-batch.js.map +1 -0
- package/dist/solid/scene-object.d.ts +27 -0
- package/dist/solid/scene-object.d.ts.map +1 -0
- package/dist/solid/scene-object.js +111 -0
- package/dist/solid/scene-object.js.map +1 -0
- package/dist/solid/stage-batches.d.ts +10 -0
- package/dist/solid/stage-batches.d.ts.map +1 -0
- package/dist/solid/stage-batches.js +6 -0
- package/dist/solid/stage-batches.js.map +1 -0
- package/dist/solid/stage-drag.d.ts +4 -0
- package/dist/solid/stage-drag.d.ts.map +1 -0
- package/dist/solid/stage-drag.js +19 -0
- package/dist/solid/stage-drag.js.map +1 -0
- package/dist/solid/stage.d.ts +107 -0
- package/dist/solid/stage.d.ts.map +1 -0
- package/dist/solid/stage.js +320 -0
- package/dist/solid/stage.js.map +1 -0
- package/dist/solid/test-stage.d.ts +29 -0
- package/dist/solid/test-stage.d.ts.map +1 -0
- package/dist/solid/test-stage.js +16 -0
- package/dist/solid/test-stage.js.map +1 -0
- package/dist/solid.d.ts +55 -0
- package/dist/solid.d.ts.map +1 -0
- package/dist/solid.js +9 -0
- package/dist/solid.js.map +1 -0
- package/package.json +99 -4
- package/src/TestStage.ts +177 -0
- package/src/ThreeColours.ts +247 -0
- package/src/ThreeDrag.ts +341 -0
- package/src/ThreeInput.ts +744 -0
- package/src/ThreeInstances.ts +481 -0
- package/src/ThreeRenderer.ts +159 -0
- package/src/ThreeValues.ts +69 -0
- package/src/WardicThree.ts +347 -0
- package/src/index.ts +26 -0
- package/src/internal/dev.production.ts +7 -0
- package/src/internal/dev.ts +10 -0
- package/src/internal/lookup.ts +247 -0
- package/src/internal/shared-material.ts +101 -0
- package/src/solid/feature.ts +38 -0
- package/src/solid/scene-batch.ts +490 -0
- package/src/solid/scene-object.ts +145 -0
- package/src/solid/stage-batches.ts +13 -0
- package/src/solid/stage-drag.ts +26 -0
- package/src/solid/stage.ts +409 -0
- package/src/solid/test-stage.ts +40 -0
- package/src/solid.ts +111 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage-batches.d.ts","sourceRoot":"","sources":["../../src/solid/stage-batches.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAGhD,6GAA6G;AAC7G,eAAO,MAAM,YAAY,EAAE,YAE1B,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { bindSceneBatch } from "./scene-batch.js";
|
|
2
|
+
/** A scene's Batches: give it to `createStage`'s `features` for `createBatch({ object | instances, … })`. */
|
|
3
|
+
export const stageBatches = {
|
|
4
|
+
batch: ({ scene }, environment) => (config, hooks) => bindSceneBatch({ environment, scene }, config, hooks),
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=stage-batches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage-batches.js","sourceRoot":"","sources":["../../src/solid/stage-batches.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,6GAA6G;AAC7G,MAAM,CAAC,MAAM,YAAY,GAAiB;IACxC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC;CAC5G,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage-drag.d.ts","sourceRoot":"","sources":["../../src/solid/stage-drag.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAEhD,oFAAoF;AACpF,eAAO,MAAM,SAAS,EAAE,YAYvB,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `stageDrag` (#885's PR 5): drag in 3D as a Stage's feature, `@wardic/three`'s `ThreeDrag` on the Stage's
|
|
3
|
+
* camera and canvas. A Stage adopting a runtime has neither, and drags nothing.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import * as Spine from "@wardic/core/unstable/Spine";
|
|
8
|
+
import * as UndefinedOr from "effect/UndefinedOr";
|
|
9
|
+
import * as ThreeDrag from "../ThreeDrag.js";
|
|
10
|
+
/** Drag in 3D: give it to `createStage`'s `features` for `ward(mesh, { drag })`. */
|
|
11
|
+
export const stageDrag = {
|
|
12
|
+
drag: ({ runtime, view }) => UndefinedOr.map(view, (given) => ThreeDrag.make({
|
|
13
|
+
animate: runtime.animate,
|
|
14
|
+
camera: given.camera,
|
|
15
|
+
canvas: given.canvas,
|
|
16
|
+
unitScale: Spine.unitScaleOf(runtime.stageEnvironment.runtime),
|
|
17
|
+
})),
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=stage-drag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage-drag.js","sourceRoot":"","sources":["../../src/solid/stage-drag.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,KAAK,MAAM,6BAA6B,CAAA;AAEpD,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAA;AACjD,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAA;AAG5C,oFAAoF;AACpF,MAAM,CAAC,MAAM,SAAS,GAAiB;IACrC,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAC1B,WAAW,CAAC,GAAG,CACb,IAAI,EACJ,CAAC,KAAK,EAAa,EAAE,CACnB,SAAS,CAAC,IAAI,CAAC;QACb,OAAO,EAAE,OAAO,CAAC,OAAkD;QACnE,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,SAAS,EAAE,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC;KAC/D,CAAyB,CAC7B;CACJ,CAAA"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type * as InputSource from "@wardic/core/InputSource";
|
|
2
|
+
import { type Stage, type StageGraph, type StageWard, type StageWardEnvironment } from "@wardic/solid";
|
|
3
|
+
import type { Camera, Object3D } from "three";
|
|
4
|
+
import type { StageFeature, StageView } from "./feature.ts";
|
|
5
|
+
import * as WardicThree from "../WardicThree.ts";
|
|
6
|
+
/** What a Stage needs of a renderer: three's `WebGLRenderer` and `WebGPURenderer` both have it. */
|
|
7
|
+
export interface RendererLike {
|
|
8
|
+
readonly domElement: HTMLCanvasElement;
|
|
9
|
+
readonly setSize: (width: number, height: number, updateStyle?: boolean) => void;
|
|
10
|
+
readonly setAnimationLoop: (callback: ((time: number) => void) | null) => unknown;
|
|
11
|
+
readonly render: (scene: Object3D, camera: Camera) => unknown;
|
|
12
|
+
}
|
|
13
|
+
/** A Stage's options: the scene it draws, its camera, its renderer, and the runtime's own options. */
|
|
14
|
+
export interface StageOptions extends Omit<WardicThree.Options, "canvas" | "camera" | "scene" | "now"> {
|
|
15
|
+
/** The scene it draws and a pointer hits. */
|
|
16
|
+
readonly scene: Object3D;
|
|
17
|
+
/** The camera it draws with, or a function giving the one active now. */
|
|
18
|
+
readonly camera: Camera | (() => Camera);
|
|
19
|
+
/** The renderer, or a function making it, which the browser calls once the page has settled. */
|
|
20
|
+
readonly renderer: RendererLike | (() => RendererLike);
|
|
21
|
+
/** `"always"` renders every frame; `"demand"`, only when something moves, or after `invalidate()`. */
|
|
22
|
+
readonly frameloop?: "always" | "demand" | undefined;
|
|
23
|
+
/** `false` leaves the canvas's size to the app. */
|
|
24
|
+
readonly resize?: boolean | undefined;
|
|
25
|
+
/** What it does beyond a ward's motion, each its code only where it's given: `stageDrag`, `stageBatches`. */
|
|
26
|
+
readonly features?: ReadonlyArray<StageFeature> | undefined;
|
|
27
|
+
}
|
|
28
|
+
/** A Stage over a runtime made outside Solid: its maker pumps its frames and draws. */
|
|
29
|
+
export interface AdoptOptions {
|
|
30
|
+
readonly wardic: WardicThree.WardicThree;
|
|
31
|
+
/** Its features: `stageBatches`; `stageDrag` drags nothing with no view of its own. */
|
|
32
|
+
readonly features?: ReadonlyArray<StageFeature> | undefined;
|
|
33
|
+
}
|
|
34
|
+
/** A three.js Stage: the `Stage` the hooks find, the ref that mounts its canvas, and its own calls. */
|
|
35
|
+
export interface ThreeStage extends Stage {
|
|
36
|
+
/** Mount the renderer's canvas in `element`, kept sized: give the Stage to an element's `ref`. */
|
|
37
|
+
(element: HTMLElement): void;
|
|
38
|
+
/** Draw a frame under `frameloop: "demand"`: the scene changed in a way Wardic didn't. */
|
|
39
|
+
readonly invalidate: () => void;
|
|
40
|
+
/** The runtime, for code outside Solid: `stage.wardic.batch(…)`, `stage.wardic.hover(…)`. */
|
|
41
|
+
readonly wardic: WardicThree.WardicThree | undefined;
|
|
42
|
+
}
|
|
43
|
+
/** Whether `value` is one of a scene's Subjects: an `Object3D` or a `Material`, by three's flags. */
|
|
44
|
+
export declare const isThreeSubject: (value: unknown) => boolean;
|
|
45
|
+
/**
|
|
46
|
+
* An `InputSource` the Stage's hooks can watch before its canvas is made (a renderer made once the page
|
|
47
|
+
* has settled): each feed connects to the scene's input as it's attached. Internal; exported for its test.
|
|
48
|
+
*/
|
|
49
|
+
export declare const lateInput: () => {
|
|
50
|
+
readonly source: InputSource.InputSource["Service"];
|
|
51
|
+
readonly attach: (source: InputSource.InputSource["Service"]) => void;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* three.js's graph, as a Stage ward reads it (#885's PR 3; ADR-0073 decision 17): an object's parent,
|
|
55
|
+
* its `added` and `removed` events, its branch's index among an ancestor's `children`, and its descendants.
|
|
56
|
+
*/
|
|
57
|
+
export declare const THREE_GRAPH: StageGraph;
|
|
58
|
+
/** Where a three.js Stage keeps what `createSceneObject` needs of it: not the `Stage` interface's. */
|
|
59
|
+
export declare const SCENE: unique symbol;
|
|
60
|
+
/**
|
|
61
|
+
* What `createSceneObject` needs of a Stage (#885): what its wards run on, its scene, and its exits in
|
|
62
|
+
* flight. `createSceneObject` makes its own ward on it, so a Stage app that never calls it carries none.
|
|
63
|
+
*/
|
|
64
|
+
export interface SceneOf {
|
|
65
|
+
/** What its wards run on. */
|
|
66
|
+
readonly environment: StageWardEnvironment;
|
|
67
|
+
/** A config's colours split into their channels on `subject`, as the Stage's ward splits them. */
|
|
68
|
+
readonly split: <C>(subject: unknown, config: C) => C;
|
|
69
|
+
/** The scene a Scene object with no parent joins: none on a Stage adopting a runtime. */
|
|
70
|
+
readonly scene: Object3D | undefined;
|
|
71
|
+
/** Each exit in flight, by what lands it now: the Stage lands them as it ends. */
|
|
72
|
+
readonly exits: Set<() => void>;
|
|
73
|
+
}
|
|
74
|
+
/** A three.js Stage, with what `createSceneObject` needs of it. */
|
|
75
|
+
export type SceneStage = Stage & {
|
|
76
|
+
readonly [SCENE]: SceneOf;
|
|
77
|
+
};
|
|
78
|
+
/** Every exit still in flight landed: its Subject taken out, as the Stage ends (*Amendment (#885)* Q5). */
|
|
79
|
+
export declare const landExits: (stage: {
|
|
80
|
+
readonly [SCENE]: SceneOf;
|
|
81
|
+
}) => void;
|
|
82
|
+
/**
|
|
83
|
+
* The Stage over `runtime`: its Subjects three's, its ward the Stage ward on the runtime, each colour of
|
|
84
|
+
* its config split into its channels in linear light as three's `animate` splits a call's, its input
|
|
85
|
+
* `input`. `scene` is what a Scene object with no parent joins. Its drag and its Batches are its
|
|
86
|
+
* `features`' (#885's PR 5): `stageDrag` drags on `view`'s camera and canvas.
|
|
87
|
+
*/
|
|
88
|
+
export declare const stageOver: (runtime: WardicThree.WardicThree, input: InputSource.InputSource["Service"], scene: Object3D | undefined, view: StageView | undefined, features?: ReadonlyArray<StageFeature>) => SceneStage;
|
|
89
|
+
/**
|
|
90
|
+
* A ward on `given` that does nothing: a server's, and a server's Scene object's. Its `read` gives its
|
|
91
|
+
* Subject's own value, as a ward's does before it moves a key (#939): what a scene's object holds as it's made.
|
|
92
|
+
*/
|
|
93
|
+
export declare const inertWardOn: (given: unknown) => StageWard;
|
|
94
|
+
/** A Stage on a server: its ref renders nothing, its hooks animate nothing, and it runs no loop. */
|
|
95
|
+
export declare const inertStage: () => ThreeStage;
|
|
96
|
+
/**
|
|
97
|
+
* A Stage that runs `options.scene` for its owner: its Host loop, its pointer input, and its canvas's size.
|
|
98
|
+
* Make it in a component's body; it ends with its owner. Given `{ wardic }`, it adopts that runtime.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* const stage = createStage({ renderer: () => new WebGLRenderer({ antialias: true }), scene, camera })
|
|
102
|
+
* <WardicStage value={stage}>
|
|
103
|
+
* <div class="viewport" ref={stage} />
|
|
104
|
+
* </WardicStage>
|
|
105
|
+
*/
|
|
106
|
+
export declare const createStage: (options: StageOptions | AdoptOptions) => ThreeStage;
|
|
107
|
+
//# sourceMappingURL=stage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../src/solid/stage.ts"],"names":[],"mappings":"AA4BA,OAA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C,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,CAAA;IACrD,yFAAyF;IACzF,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAA;IACpC,kFAAkF;IAClF,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,CAAA;CAChC;AAED,mEAAmE;AACnE,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG;IAAE,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAE9D,2GAA2G;AAC3G,eAAO,MAAM,SAAS,UAAW;IAAE,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,KAAG,IACI,CAAA;AAMrE;;;;;GAKG;AACH,eAAO,MAAM,SAAS,YACX,WAAW,CAAC,WAAW,SACzB,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,SAClC,QAAQ,GAAG,SAAS,QACrB,SAAS,GAAG,SAAS,aACjB,aAAa,CAAC,YAAY,CAAC,KACpC,UAqBF,CAAA;AAsBD;;;GAGG;AACH,eAAO,MAAM,WAAW,UAAW,OAAO,KAAG,SAQ3C,CAAA;AAKF,oGAAoG;AAEpG,eAAO,MAAM,UAAU,QAAO,UAWZ,CAAA;AAqBlB;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,YAAa,YAAY,GAAG,YAAY,KAAG,UAkFlE,CAAA"}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `createStage` (ADR-0073 decisions 11–13): a Stage that runs a three.js scene for its owner. It's the
|
|
3
|
+
* `Stage` the hooks under a `<WardicStage>` find (`ward(mesh, config)`, `createFrameEffect`, the sensors),
|
|
4
|
+
* and the ref that mounts and sizes the renderer's canvas:
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* const stage = createStage({ renderer: () => new WebGLRenderer({ antialias: true }), scene, camera })
|
|
8
|
+
* <WardicStage value={stage}>
|
|
9
|
+
* <div class="viewport" ref={stage} />
|
|
10
|
+
* <Crate />
|
|
11
|
+
* </WardicStage>
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* - **Its Host loop:** `renderer.setAnimationLoop`, the scene's raycast, then Wardic's frame, then the
|
|
15
|
+
* render. With `frameloop: "demand"`, it renders only when something moves, or after `invalidate()`.
|
|
16
|
+
* - **Given as a ref,** an element mounts `renderer.domElement` and keeps it sized: `setSize`, and a
|
|
17
|
+
* perspective camera's `aspect`. `resize: false` leaves the size to the app.
|
|
18
|
+
* - **`renderer`** is an instance, in client-only code, or a factory the browser calls once the page has
|
|
19
|
+
* settled. `{ wardic: made }` adopts a runtime made outside Solid, whose maker pumps its frames.
|
|
20
|
+
* - **On a server** it does nothing: its ref renders nothing, and the hooks under it animate nothing.
|
|
21
|
+
* - **It ends with its owner:** the loop, the input and the runtime stop; the renderer, scene and camera
|
|
22
|
+
* stay the app's.
|
|
23
|
+
*
|
|
24
|
+
* @module
|
|
25
|
+
*/
|
|
26
|
+
// #885's PR 1 (ADR-0073, *Amendment (#885)*, Q2–Q4).
|
|
27
|
+
import { isServer } from "@solidjs/web";
|
|
28
|
+
import * as InputFeed from "@wardic/core/InputFeed";
|
|
29
|
+
import { stageWard } from "@wardic/solid";
|
|
30
|
+
import * as Arr from "effect/Array";
|
|
31
|
+
import * as Bool from "effect/Boolean";
|
|
32
|
+
import { constUndefined, constVoid } from "effect/Function";
|
|
33
|
+
import * as Option from "effect/Option";
|
|
34
|
+
import * as Predicate from "effect/Predicate";
|
|
35
|
+
import * as Atom from "effect/reactivity/Atom";
|
|
36
|
+
import * as UndefinedOr from "effect/UndefinedOr";
|
|
37
|
+
import { onCleanup, onSettled, untrack } from "solid-js";
|
|
38
|
+
import * as ThreeColours from "../ThreeColours.js";
|
|
39
|
+
import * as ThreeInput from "../ThreeInput.js";
|
|
40
|
+
import * as ThreeValues from "../ThreeValues.js";
|
|
41
|
+
import * as WardicThree from "../WardicThree.js";
|
|
42
|
+
/** Whether `value` is one of a scene's Subjects: an `Object3D` or a `Material`, by three's flags. */
|
|
43
|
+
export const isThreeSubject = (value) => Predicate.isObject(value) && (value.isObject3D === true || value.isMaterial === true);
|
|
44
|
+
/**
|
|
45
|
+
* An `InputSource` the Stage's hooks can watch before its canvas is made (a renderer made once the page
|
|
46
|
+
* has settled): each feed connects to the scene's input as it's attached. Internal; exported for its test.
|
|
47
|
+
*/
|
|
48
|
+
export const lateInput = () => {
|
|
49
|
+
let real;
|
|
50
|
+
const waiting = new Set();
|
|
51
|
+
const later = (feedOf) => (emit, end) => {
|
|
52
|
+
if (Predicate.isNotUndefined(real))
|
|
53
|
+
return feedOf(real)(emit, end);
|
|
54
|
+
let cancel = constVoid;
|
|
55
|
+
const connect = (given) => {
|
|
56
|
+
cancel = feedOf(given)(emit, end);
|
|
57
|
+
};
|
|
58
|
+
waiting.add(connect);
|
|
59
|
+
return () => {
|
|
60
|
+
waiting.delete(connect);
|
|
61
|
+
cancel();
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
const source = {
|
|
65
|
+
pointer: (target) => later((given) => given.pointer(target)),
|
|
66
|
+
keyboard: () => InputFeed.empty,
|
|
67
|
+
focus: () => InputFeed.empty,
|
|
68
|
+
adoptPointer: () => Option.none(),
|
|
69
|
+
pointerAmong: (memberOf) => later((given) => UndefinedOr.match(given.pointerAmong, { onUndefined: () => InputFeed.empty, onDefined: (among) => among(memberOf) })),
|
|
70
|
+
};
|
|
71
|
+
const attach = (given) => {
|
|
72
|
+
real = given;
|
|
73
|
+
const connecting = Arr.fromIterable(waiting);
|
|
74
|
+
waiting.clear();
|
|
75
|
+
Arr.forEach(connecting, (connect) => connect(given));
|
|
76
|
+
};
|
|
77
|
+
return { source, attach };
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* `subject`, a Subject or an accessor of one, as the Subject now: an accessor read untracked, since the
|
|
81
|
+
* colour split only looks up which keys are a colour on it, often in the component's body, and the ward
|
|
82
|
+
* follows the Subject itself.
|
|
83
|
+
*/
|
|
84
|
+
const subjectNowOf = (subject) => {
|
|
85
|
+
if (Predicate.isFunction(subject))
|
|
86
|
+
return () => untrack(subject);
|
|
87
|
+
return () => subject;
|
|
88
|
+
};
|
|
89
|
+
/** A Subject's parent in three's graph: an object's, none for a material or at the root. */
|
|
90
|
+
const graphParentOf = (subject) => {
|
|
91
|
+
const parent = subject.parent;
|
|
92
|
+
if (Predicate.isNullish(parent))
|
|
93
|
+
return undefined;
|
|
94
|
+
return parent;
|
|
95
|
+
};
|
|
96
|
+
/** The object directly below `ancestor` on `descendant`'s path up: none when `ancestor` isn't above it. */
|
|
97
|
+
const branchOf = (descendant, ancestor) => {
|
|
98
|
+
const parent = descendant.parent;
|
|
99
|
+
if (Predicate.isNull(parent))
|
|
100
|
+
return undefined;
|
|
101
|
+
if (parent === ancestor)
|
|
102
|
+
return descendant;
|
|
103
|
+
return branchOf(parent, ancestor);
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* three.js's graph, as a Stage ward reads it (#885's PR 3; ADR-0073 decision 17): an object's parent,
|
|
107
|
+
* its `added` and `removed` events, its branch's index among an ancestor's `children`, and its descendants.
|
|
108
|
+
*/
|
|
109
|
+
export const THREE_GRAPH = {
|
|
110
|
+
parentOf: graphParentOf,
|
|
111
|
+
onMoved: (subject, moved) => {
|
|
112
|
+
if (Bool.not(isThreeSubject(subject)) || Predicate.isUndefined(subject.isObject3D))
|
|
113
|
+
return constVoid;
|
|
114
|
+
const object = subject;
|
|
115
|
+
object.addEventListener("added", moved);
|
|
116
|
+
object.addEventListener("removed", moved);
|
|
117
|
+
return () => {
|
|
118
|
+
object.removeEventListener("added", moved);
|
|
119
|
+
object.removeEventListener("removed", moved);
|
|
120
|
+
};
|
|
121
|
+
},
|
|
122
|
+
orderOf: (descendant, ancestor) => UndefinedOr.match(branchOf(descendant, ancestor), {
|
|
123
|
+
onUndefined: () => Number.MAX_SAFE_INTEGER,
|
|
124
|
+
onDefined: (branch) => ancestor.children.indexOf(branch),
|
|
125
|
+
}),
|
|
126
|
+
below: (subject, visit) => {
|
|
127
|
+
if (Predicate.isUndefined(subject.isObject3D))
|
|
128
|
+
return;
|
|
129
|
+
subject.traverse((descendant) => {
|
|
130
|
+
if (descendant !== subject)
|
|
131
|
+
visit(descendant);
|
|
132
|
+
});
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
/** Where a three.js Stage keeps what `createSceneObject` needs of it: not the `Stage` interface's. */
|
|
136
|
+
export const SCENE = Symbol.for("@wardic/three/solid/scene");
|
|
137
|
+
/** Every exit still in flight landed: its Subject taken out, as the Stage ends (*Amendment (#885)* Q5). */
|
|
138
|
+
export const landExits = (stage) => Arr.forEach(Arr.fromIterable(stage[SCENE].exits), (land) => land());
|
|
139
|
+
/** The first of `features` that gives `pick`'s. */
|
|
140
|
+
const firstOf = (features, pick) => Option.getOrUndefined(Option.flatMap(Arr.findFirst(features, (feature) => Predicate.isNotUndefined(pick(feature))), (feature) => Option.fromUndefinedOr(pick(feature))));
|
|
141
|
+
/**
|
|
142
|
+
* The Stage over `runtime`: its Subjects three's, its ward the Stage ward on the runtime, each colour of
|
|
143
|
+
* its config split into its channels in linear light as three's `animate` splits a call's, its input
|
|
144
|
+
* `input`. `scene` is what a Scene object with no parent joins. Its drag and its Batches are its
|
|
145
|
+
* `features`' (#885's PR 5): `stageDrag` drags on `view`'s camera and canvas.
|
|
146
|
+
*/
|
|
147
|
+
export const stageOver = (runtime, input, scene, view, features = []) => {
|
|
148
|
+
const parts = { runtime, view, scene };
|
|
149
|
+
const drag = UndefinedOr.match(firstOf(features, (feature) => feature.drag), { onUndefined: () => undefined, onDefined: (make) => make(parts) });
|
|
150
|
+
const environment = { ...runtime.stageEnvironment, input, graph: THREE_GRAPH, drag };
|
|
151
|
+
const ward = stageWard(environment);
|
|
152
|
+
const split = (subject, config) => ThreeColours.splitConfig(subjectNowOf(subject), config);
|
|
153
|
+
return {
|
|
154
|
+
isSubject: isThreeSubject,
|
|
155
|
+
ward: (subject, config, options) => ward(subject, split(subject, config), options),
|
|
156
|
+
animate: runtime.animate,
|
|
157
|
+
frameEffects: runtime.stageEnvironment.frameEffects,
|
|
158
|
+
input,
|
|
159
|
+
drag,
|
|
160
|
+
batch: UndefinedOr.map(firstOf(features, (feature) => feature.batch), (make) => make(parts, environment)),
|
|
161
|
+
[SCENE]: {
|
|
162
|
+
environment,
|
|
163
|
+
split,
|
|
164
|
+
scene,
|
|
165
|
+
exits: new Set(),
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
/** No input: a runtime made with no canvas, on a server. */
|
|
170
|
+
const NO_INPUT = {
|
|
171
|
+
pointer: () => InputFeed.empty,
|
|
172
|
+
keyboard: () => InputFeed.empty,
|
|
173
|
+
focus: () => InputFeed.empty,
|
|
174
|
+
adoptPointer: () => Option.none(),
|
|
175
|
+
};
|
|
176
|
+
/** A ward that does nothing, reading nothing. */
|
|
177
|
+
const INERT_WARD = {
|
|
178
|
+
held: undefined,
|
|
179
|
+
settled: constUndefined,
|
|
180
|
+
tapped: constUndefined,
|
|
181
|
+
next: () => new Promise(() => { }),
|
|
182
|
+
each: () => ({ [Symbol.asyncIterator]: () => ({ next: () => new Promise(() => { }) }) }),
|
|
183
|
+
when: () => constUndefined,
|
|
184
|
+
read: (() => constUndefined),
|
|
185
|
+
atom: () => Atom.make(undefined),
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* A ward on `given` that does nothing: a server's, and a server's Scene object's. Its `read` gives its
|
|
189
|
+
* Subject's own value, as a ward's does before it moves a key (#939): what a scene's object holds as it's made.
|
|
190
|
+
*/
|
|
191
|
+
export const inertWardOn = (given) => ({
|
|
192
|
+
...INERT_WARD,
|
|
193
|
+
read: ((key) => () => Option.getOrUndefined(Option.flatMap(Option.liftPredicate(subjectNow(given), Predicate.isObject), (subject) => Option.flatten(Option.liftThrowable(() => ThreeValues.startLinksOf(subject).ownValue(key))())))),
|
|
194
|
+
});
|
|
195
|
+
/** The Subject `given` is now: itself, or what its accessor gives. */
|
|
196
|
+
const subjectNow = (given) => Bool.match(Predicate.isFunction(given), { onTrue: () => given(), onFalse: () => given });
|
|
197
|
+
/** A Stage on a server: its ref renders nothing, its hooks animate nothing, and it runs no loop. */
|
|
198
|
+
// ADR-0073 decision 13: the host `<div>` renders empty, so hydration matches.
|
|
199
|
+
export const inertStage = () => Object.assign((_element) => undefined, {
|
|
200
|
+
isSubject: isThreeSubject,
|
|
201
|
+
ward: inertWardOn,
|
|
202
|
+
animate: () => {
|
|
203
|
+
throw new Error("A Stage animates nothing on a server: call animate in the browser, in an event or once the page has settled.");
|
|
204
|
+
},
|
|
205
|
+
frameEffects: { add: () => constVoid, request: constVoid },
|
|
206
|
+
input: NO_INPUT,
|
|
207
|
+
invalidate: constVoid,
|
|
208
|
+
wardic: undefined,
|
|
209
|
+
});
|
|
210
|
+
/** `options.renderer`'s renderer, made: a factory is called, an instance is itself. */
|
|
211
|
+
const rendererOf = (renderer) => {
|
|
212
|
+
if (Predicate.isFunction(renderer))
|
|
213
|
+
return renderer();
|
|
214
|
+
return renderer;
|
|
215
|
+
};
|
|
216
|
+
/** The camera now: one given, or the one a function gives. */
|
|
217
|
+
const cameraOf = (camera) => {
|
|
218
|
+
if (Predicate.isFunction(camera))
|
|
219
|
+
return camera();
|
|
220
|
+
return camera;
|
|
221
|
+
};
|
|
222
|
+
/** A Stage over `made`, a runtime made outside Solid: its maker pumps its frames and draws; it adopts no loop. */
|
|
223
|
+
const adopted = (made, features) => Object.assign((_element) => undefined, stageOver(made, UndefinedOr.match(made.input, { onUndefined: () => NO_INPUT, onDefined: (given) => given }), undefined, undefined, features), {
|
|
224
|
+
invalidate: constVoid,
|
|
225
|
+
wardic: made,
|
|
226
|
+
});
|
|
227
|
+
/**
|
|
228
|
+
* A Stage that runs `options.scene` for its owner: its Host loop, its pointer input, and its canvas's size.
|
|
229
|
+
* Make it in a component's body; it ends with its owner. Given `{ wardic }`, it adopts that runtime.
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* const stage = createStage({ renderer: () => new WebGLRenderer({ antialias: true }), scene, camera })
|
|
233
|
+
* <WardicStage value={stage}>
|
|
234
|
+
* <div class="viewport" ref={stage} />
|
|
235
|
+
* </WardicStage>
|
|
236
|
+
*/
|
|
237
|
+
export const createStage = (options) => {
|
|
238
|
+
if (isServer)
|
|
239
|
+
return inertStage();
|
|
240
|
+
if ("wardic" in options)
|
|
241
|
+
return adopted(options.wardic, options.features);
|
|
242
|
+
const { scene, camera, frameloop = "always", resize = true, renderer: given, features, ...rest } = options;
|
|
243
|
+
const runtime = WardicThree.make({ ...rest, scene, camera });
|
|
244
|
+
const late = lateInput();
|
|
245
|
+
let renderer;
|
|
246
|
+
let input;
|
|
247
|
+
let host;
|
|
248
|
+
let observer;
|
|
249
|
+
// The first frame draws, as does each one after `invalidate()`.
|
|
250
|
+
let invalidated = true;
|
|
251
|
+
/** The canvas in `element`, kept sized to it: the renderer's size, and a perspective camera's aspect. */
|
|
252
|
+
const mount = (element, made) => {
|
|
253
|
+
if (made.domElement.parentElement !== element)
|
|
254
|
+
element.append(made.domElement);
|
|
255
|
+
if (Bool.not(resize))
|
|
256
|
+
return;
|
|
257
|
+
UndefinedOr.map(observer, (last) => last.disconnect());
|
|
258
|
+
const sized = new ResizeObserver(() => {
|
|
259
|
+
const width = Math.max(1, element.clientWidth);
|
|
260
|
+
const height = Math.max(1, element.clientHeight);
|
|
261
|
+
made.setSize(width, height);
|
|
262
|
+
const now = cameraOf(camera);
|
|
263
|
+
if (now.isPerspectiveCamera === true) {
|
|
264
|
+
now.aspect = width / height;
|
|
265
|
+
UndefinedOr.map(now.updateProjectionMatrix, (update) => update.call(now));
|
|
266
|
+
}
|
|
267
|
+
invalidated = true;
|
|
268
|
+
});
|
|
269
|
+
sized.observe(element);
|
|
270
|
+
observer = sized;
|
|
271
|
+
};
|
|
272
|
+
/** The renderer made: its input attached, its canvas mounted, and its loop started. */
|
|
273
|
+
const start = (made) => {
|
|
274
|
+
renderer = made;
|
|
275
|
+
const madeInput = ThreeInput.make({ canvas: made.domElement, camera, scene, hitTest: rest.hitTest, window: rest.window });
|
|
276
|
+
input = madeInput;
|
|
277
|
+
late.attach(madeInput.source);
|
|
278
|
+
UndefinedOr.map(host, (element) => mount(element, made));
|
|
279
|
+
made.setAnimationLoop((time) => {
|
|
280
|
+
// A frame asked for before it runs draws: a Frame effect's apply can move the scene with nothing
|
|
281
|
+
// animating, and its request is spent by the frame that runs it (#885's PR 6, CS9).
|
|
282
|
+
const asked = runtime.wantsFrame();
|
|
283
|
+
// The raycast first, against what was last drawn; then Wardic's writes; then the render.
|
|
284
|
+
madeInput.frame();
|
|
285
|
+
runtime.frame(time);
|
|
286
|
+
if (frameloop === "demand" && Bool.not(Bool.some([invalidated, asked, runtime.wantsFrame(), madeInput.wantsFrame()])))
|
|
287
|
+
return;
|
|
288
|
+
invalidated = false;
|
|
289
|
+
made.render(scene, cameraOf(camera));
|
|
290
|
+
});
|
|
291
|
+
};
|
|
292
|
+
// A factory waits for the page to settle, so a server never calls it and hydration makes no canvas.
|
|
293
|
+
Bool.match(Predicate.isFunction(given), {
|
|
294
|
+
onTrue: () => onSettled(() => start(rendererOf(given))),
|
|
295
|
+
onFalse: () => start(given),
|
|
296
|
+
});
|
|
297
|
+
const over = stageOver(runtime, late.source, scene, { camera, canvas: () => UndefinedOr.map(renderer, (made) => made.domElement) }, features);
|
|
298
|
+
onCleanup(() => {
|
|
299
|
+
// Exits still in flight land first: their Subjects leave the scene, which stays the app's.
|
|
300
|
+
landExits(over);
|
|
301
|
+
UndefinedOr.map(renderer, (made) => {
|
|
302
|
+
made.setAnimationLoop(null);
|
|
303
|
+
made.domElement.remove();
|
|
304
|
+
});
|
|
305
|
+
UndefinedOr.map(observer, (sized) => sized.disconnect());
|
|
306
|
+
UndefinedOr.map(input, (madeInput) => madeInput.dispose());
|
|
307
|
+
runtime.dispose();
|
|
308
|
+
});
|
|
309
|
+
const ref = (element) => {
|
|
310
|
+
host = element;
|
|
311
|
+
UndefinedOr.map(renderer, (made) => mount(element, made));
|
|
312
|
+
};
|
|
313
|
+
return Object.assign(ref, over, {
|
|
314
|
+
invalidate: () => {
|
|
315
|
+
invalidated = true;
|
|
316
|
+
},
|
|
317
|
+
wardic: runtime,
|
|
318
|
+
});
|
|
319
|
+
};
|
|
320
|
+
//# sourceMappingURL=stage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage.js","sourceRoot":"","sources":["../../src/solid/stage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qDAAqD;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAA;AAEnD,OAAO,EAA+D,SAAS,EAA6B,MAAM,eAAe,CAAA;AACjI,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAA;AAC9C,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAExD,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAA;AAElD,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAA;AA2ChD,qGAAqG;AACrG,MAAM,CAAC,MAAM,cAAc,GAAG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hooks find. A test mounts its tree under it and
|
|
4
|
+
* drives the scene through it:
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* const stage = TestStage.make({ scene, camera, size: { width: 800, height: 600 } })
|
|
8
|
+
* render(() => <WardicStage value={stage}><Crate mesh={crate} /></WardicStage>)
|
|
9
|
+
* stage.pointer.over(crate)
|
|
10
|
+
* stage.frame()
|
|
11
|
+
* expect(crate.scale.x).toBeCloseTo(1.08)
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
import type { Stage } from "@wardic/solid";
|
|
17
|
+
import * as Plain from "../TestStage.ts";
|
|
18
|
+
import type { StageFeature } from "./feature.ts";
|
|
19
|
+
import { SCENE, type SceneOf } from "./stage.ts";
|
|
20
|
+
export type { Options, TestPointer } from "../TestStage.ts";
|
|
21
|
+
/** A test's scene that's also a Stage: `@wardic/three/TestStage`'s, with the `Stage` the hooks under it find. */
|
|
22
|
+
export type TestStage = Plain.TestStage & Stage & {
|
|
23
|
+
readonly [SCENE]: SceneOf;
|
|
24
|
+
};
|
|
25
|
+
/** A test's scene, on a stand-in canvas of `options.size`, that's also a Stage. */
|
|
26
|
+
export declare const make: (options: Plain.Options & {
|
|
27
|
+
readonly features?: ReadonlyArray<StageFeature> | undefined;
|
|
28
|
+
}) => TestStage;
|
|
29
|
+
//# sourceMappingURL=test-stage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-stage.d.ts","sourceRoot":"","sources":["../../src/solid/test-stage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,KAAK,KAAK,MAAM,iBAAiB,CAAA;AAExC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAa,KAAK,EAAE,KAAK,OAAO,EAAa,MAAM,YAAY,CAAA;AAEtE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE3D,iHAAiH;AACjH,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,GAAG,KAAK,GAAG;IAAE,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAE/E,mFAAmF;AACnF,eAAO,MAAM,IAAI,YAAa,KAAK,CAAC,OAAO,GAAG;IAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,GAAG,SAAS,CAAA;CAAE,KAAG,SAU/G,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as UndefinedOr from "effect/UndefinedOr";
|
|
2
|
+
import * as Plain from "../TestStage.js";
|
|
3
|
+
import { landExits, SCENE, stageOver } from "./stage.js";
|
|
4
|
+
/** A test's scene, on a stand-in canvas of `options.size`, that's also a Stage. */
|
|
5
|
+
export const make = (options) => {
|
|
6
|
+
const plain = Plain.make(options);
|
|
7
|
+
// A TestStage is made with its stand-in canvas, so it always has its input.
|
|
8
|
+
const over = stageOver(plain, UndefinedOr.getOrThrow(plain.input), options.scene, { camera: options.camera, canvas: () => plain.canvas }, options.features);
|
|
9
|
+
// Its end lands the exits still in flight, as `createStage`'s does.
|
|
10
|
+
const dispose = () => {
|
|
11
|
+
landExits(over);
|
|
12
|
+
plain.dispose();
|
|
13
|
+
};
|
|
14
|
+
return { ...plain, ...over, dispose };
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=test-stage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-stage.js","sourceRoot":"","sources":["../../src/solid/test-stage.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAA;AACjD,OAAO,KAAK,KAAK,MAAM,iBAAiB,CAAA;AAGxC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,SAAS,EAAE,MAAM,YAAY,CAAA;AAOtE,mFAAmF;AACnF,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,OAAwF,EAAa,EAAE;IAC1H,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACjC,4EAA4E;IAC5E,MAAM,IAAI,GAAG,SAAS,CAAC,KAAc,EAAE,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,MAA+B,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC7L,oEAAoE;IACpE,MAAM,OAAO,GAAG,GAAS,EAAE;QACzB,SAAS,CAAC,IAAI,CAAC,CAAA;QACf,KAAK,CAAC,OAAO,EAAE,CAAA;IACjB,CAAC,CAAA;IACD,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,EAAE,OAAO,EAAe,CAAA;AACpD,CAAC,CAAA"}
|
package/dist/solid.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@wardic/three/solid` (ADR-0073 decision 20): a three.js scene for Solid 2's hooks. `createStage` makes
|
|
3
|
+
* the Stage that runs a scene for its owner; under `<WardicStage value={stage}>`, `ward`, `createBatch`,
|
|
4
|
+
* `createFrameEffect` and the sensors run in that scene, and `createSceneObject` adds an object to it,
|
|
5
|
+
* with an exit as it leaves. Its hooks are a scene's alone, with none of the page's code (#927):
|
|
6
|
+
* `@wardic/solid`'s own take a mesh too, for a page that has both. Importing it types three's objects as
|
|
7
|
+
* a Stage's Subjects, so `ward(mesh, config)` and `ward(material, config)` typecheck.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import { createStage, ward, WardicStage } from "@wardic/three/solid"
|
|
11
|
+
*
|
|
12
|
+
* const stage = createStage({ renderer: () => new WebGLRenderer({ antialias: true }), scene, camera })
|
|
13
|
+
* <WardicStage value={stage}>
|
|
14
|
+
* <div class="viewport" ref={stage} />
|
|
15
|
+
* <Crate />
|
|
16
|
+
* </WardicStage>
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import type { AmbientLight, BufferGeometry, DirectionalLight, HemisphereLight, Line, LineDashedMaterial, Material, Mesh, MeshLambertMaterial, MeshMatcapMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshToonMaterial, Object3D, OrthographicCamera, PerspectiveCamera, Plane, PointLight, Points, PointsMaterial, RectAreaLight, SpotLight, Sprite } from "three";
|
|
21
|
+
import type { ColourKey, SceneKey } from "./WardicThree.ts";
|
|
22
|
+
/**
|
|
23
|
+
* The Subjects whose keys a scene's ward takes: a mesh of each of three's materials (the physical one's
|
|
24
|
+
* keys hold the standard's), points, a dashed line, a sprite, the cameras and the lights. A union of
|
|
25
|
+
* meshes, not a mesh of a union of materials, whose keys would be the materials' common ones alone.
|
|
26
|
+
*/
|
|
27
|
+
type SceneSubject = Mesh<BufferGeometry, MeshPhysicalMaterial> | Mesh<BufferGeometry, MeshPhongMaterial> | Mesh<BufferGeometry, MeshLambertMaterial> | Mesh<BufferGeometry, MeshToonMaterial> | Mesh<BufferGeometry, MeshMatcapMaterial> | Points<BufferGeometry, PointsMaterial> | Line<BufferGeometry, LineDashedMaterial> | Sprite | PerspectiveCamera | OrthographicCamera | AmbientLight | DirectionalLight | HemisphereLight | PointLight | SpotLight | RectAreaLight;
|
|
28
|
+
/** Every key three's `animate` takes on them, numbers and colours: what a ward's config on a Stage's Subject can name. */
|
|
29
|
+
type SceneValueKey = SceneKey<SceneSubject> | ColourKey<SceneSubject>;
|
|
30
|
+
/** What a three Subject's keys read as (#939): its own numbers, its vectors' axes and its material's, each a number. A colour animates by its channels, which read as numbers. */
|
|
31
|
+
type SceneReads<S> = {
|
|
32
|
+
readonly [K in SceneKey<S>]: number;
|
|
33
|
+
};
|
|
34
|
+
export { createBatchOnStage as createBatch, createDragOnStage as createDrag, createFrameEffect, createHoverOnStage as createHover, createPressOnStage as createPress, wardOnStage as ward, WardicStage, } from "@wardic/solid";
|
|
35
|
+
export type { StageFeature, StageParts, StageView } from "./solid/feature.ts";
|
|
36
|
+
export { createSceneObject, type SceneObject, type SceneObjectConfig } from "./solid/scene-object.ts";
|
|
37
|
+
export { stageBatches } from "./solid/stage-batches.ts";
|
|
38
|
+
export { stageDrag } from "./solid/stage-drag.ts";
|
|
39
|
+
export { type AdoptOptions, createStage, isThreeSubject, type RendererLike, type StageOptions, type ThreeStage } from "./solid/stage.ts";
|
|
40
|
+
export * as TestStage from "./solid/test-stage.ts";
|
|
41
|
+
declare module "@wardic/solid" {
|
|
42
|
+
interface StageSubjects {
|
|
43
|
+
readonly three: Object3D | Material;
|
|
44
|
+
}
|
|
45
|
+
interface StageValues extends Record<SceneValueKey, unknown> {
|
|
46
|
+
}
|
|
47
|
+
interface StageReads<S> {
|
|
48
|
+
readonly three: SceneReads<S>;
|
|
49
|
+
}
|
|
50
|
+
interface StageDragConfig {
|
|
51
|
+
/** A fixed plane, in world space, to drag on: the ground's, `new Plane(new Vector3(0, 1, 0), 0)`. */
|
|
52
|
+
readonly dragPlane?: Plane | undefined;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=solid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solid.d.ts","sourceRoot":"","sources":["../src/solid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,IAAI,EACJ,kBAAkB,EAClB,QAAQ,EACR,IAAI,EACJ,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,EACL,U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E,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxI,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAA;AAIlD,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,aAAa;QACrB,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAAA;KACpC;IAED,UAAU,WAAY,SAAQ,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC;KAAG;IAE/D,UAAU,UAAU,CAAC,CAAC;QACpB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAA;KAC9B;IACD,UAAU,eAAe;QACvB,qGAAqG;QACrG,QAAQ,CAAC,SAAS,CAAC,EAAE,KAAK,GAAG,SAAS,CAAA;KACvC;CACF"}
|
package/dist/solid.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// A scene's hooks alone (#927): `@wardic/solid`'s Stage halves under the hooks' own names, so a scene with
|
|
2
|
+
// no page wards carries none of the page's ward, Batch or gesture Features (57.6 KB gzipped for `ward`).
|
|
3
|
+
export { createBatchOnStage as createBatch, createDragOnStage as createDrag, createFrameEffect, createHoverOnStage as createHover, createPressOnStage as createPress, wardOnStage as ward, WardicStage, } from "@wardic/solid";
|
|
4
|
+
export { createSceneObject } from "./solid/scene-object.js";
|
|
5
|
+
export { stageBatches } from "./solid/stage-batches.js";
|
|
6
|
+
export { stageDrag } from "./solid/stage-drag.js";
|
|
7
|
+
export { createStage, isThreeSubject } from "./solid/stage.js";
|
|
8
|
+
export * as TestStage from "./solid/test-stage.js";
|
|
9
|
+
//# sourceMappingURL=solid.js.map
|