@atom.io/spa 0.0.9 → 0.0.10

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 (86) hide show
  1. package/README.md +30 -10
  2. package/README.mdx +16 -5
  3. package/dist/BrandMarkScene-CBYk-RJ2.js +140 -0
  4. package/dist/BrandMarkScene-CBYk-RJ2.js.map +1 -0
  5. package/dist/astro-client.js +1 -1
  6. package/dist/astro-server.js +1 -1
  7. package/dist/brand-css.d.ts +2 -0
  8. package/dist/brand-model.d.ts +32 -0
  9. package/dist/brand-model.d.ts.map +1 -0
  10. package/dist/brand-model.js +120 -0
  11. package/dist/brand-model.js.map +1 -0
  12. package/dist/brand.css +37 -0
  13. package/dist/brand.d.ts +13 -0
  14. package/dist/brand.d.ts.map +1 -0
  15. package/dist/brand.js +94 -0
  16. package/dist/brand.js.map +1 -0
  17. package/dist/client.min.js +1 -1
  18. package/dist/development/BrandMarkScene-BDdC7K5M.js +140 -0
  19. package/dist/development/BrandMarkScene-BDdC7K5M.js.map +1 -0
  20. package/dist/development/astro-client.js +1 -1
  21. package/dist/development/astro-server.js +1 -1
  22. package/dist/development/brand-model.js +120 -0
  23. package/dist/development/brand-model.js.map +1 -0
  24. package/dist/development/brand.css +37 -0
  25. package/dist/development/brand.js +94 -0
  26. package/dist/development/brand.js.map +1 -0
  27. package/dist/development/{dom-BRFv7FP_.js → dom-CEVtlaav.js} +4 -3
  28. package/dist/development/dom-CEVtlaav.js.map +1 -0
  29. package/dist/development/floating.js.map +1 -1
  30. package/dist/development/hot.js +2 -2
  31. package/dist/development/hot.js.map +1 -1
  32. package/dist/development/{identity-DwB8MTM1.js → identity-B8wTFkyW.js} +2 -2
  33. package/dist/development/{identity-DwB8MTM1.js.map → identity-B8wTFkyW.js.map} +1 -1
  34. package/dist/development/index.js +1 -1
  35. package/dist/development/konva.js +1 -1
  36. package/dist/development/motion.js +38 -19
  37. package/dist/development/motion.js.map +1 -1
  38. package/dist/development/renderer.js +1 -1
  39. package/dist/development/{server-renderer-u1-c5PGd.js → server-renderer-zAqEL1g1.js} +2 -2
  40. package/dist/development/{server-renderer-u1-c5PGd.js.map → server-renderer-zAqEL1g1.js.map} +1 -1
  41. package/dist/development/server.js +1 -1
  42. package/dist/development/three-CsZ6Od1C.js +527 -0
  43. package/dist/development/three-CsZ6Od1C.js.map +1 -0
  44. package/dist/development/three.js +1 -509
  45. package/dist/{dom--HZvmgqd.js → dom-DUpa3Sj2.js} +4 -3
  46. package/dist/dom-DUpa3Sj2.js.map +1 -0
  47. package/dist/floating.js.map +1 -1
  48. package/dist/hot.d.ts.map +1 -1
  49. package/dist/hot.js.map +1 -1
  50. package/dist/{identity-oFU5p-Qj.js → identity-ByJswZtF.js} +2 -2
  51. package/dist/{identity-oFU5p-Qj.js.map → identity-ByJswZtF.js.map} +1 -1
  52. package/dist/index-DdA39aMv.d.ts.map +1 -1
  53. package/dist/index.js +1 -1
  54. package/dist/konva.js +1 -1
  55. package/dist/motion.d.ts +2 -0
  56. package/dist/motion.d.ts.map +1 -1
  57. package/dist/motion.js +38 -19
  58. package/dist/motion.js.map +1 -1
  59. package/dist/renderer.js +1 -1
  60. package/dist/{server-renderer-BYFDmqnM.js → server-renderer-D7CdyOMo.js} +2 -2
  61. package/dist/{server-renderer-BYFDmqnM.js.map → server-renderer-D7CdyOMo.js.map} +1 -1
  62. package/dist/server.js +1 -1
  63. package/dist/size.json +12 -12
  64. package/dist/three-DcYxRXPW.js +527 -0
  65. package/dist/three-DcYxRXPW.js.map +1 -0
  66. package/dist/three.d.ts +21 -0
  67. package/dist/three.d.ts.map +1 -1
  68. package/dist/three.js +1 -509
  69. package/package.json +39 -19
  70. package/src/BrandMark.module.css +25 -0
  71. package/src/BrandMark.tsx +106 -0
  72. package/src/BrandMarkScene.module.css +10 -0
  73. package/src/BrandMarkScene.tsx +116 -0
  74. package/src/brand-css.d.ts +2 -0
  75. package/src/brand-model.ts +177 -0
  76. package/src/brand.ts +3 -0
  77. package/src/dom.ts +8 -1
  78. package/src/hot.ts +3 -2
  79. package/src/lasertag.d.ts +1 -0
  80. package/src/motion-layout.ts +55 -26
  81. package/src/motion.ts +3 -0
  82. package/src/three.ts +69 -22
  83. package/dist/development/dom-BRFv7FP_.js.map +0 -1
  84. package/dist/development/three.js.map +0 -1
  85. package/dist/dom--HZvmgqd.js.map +0 -1
  86. package/dist/three.js.map +0 -1
package/README.md CHANGED
@@ -318,6 +318,8 @@ Non-null value and checked props control form state: rejected edits are restored
318
318
 
319
319
  Keys accept the same Canonical values as atom.io families, including nested tuples, booleans, and null. Sibling keys must be unique by canonical serialization. A fresh tuple with the same contents preserves the instance, and a number and its string representation identify separate instances. Only undefined uses positional identity. Reordering preserves keyed instances and nodes. Changing a key replaces the instance in both DOM and scene trees, including when the element stands alone.
320
320
 
321
+ Freezing both a JSX element object and its props opts into reuse in DOM collections without refreshing unchanged descendant props. Its tracked getters remain reactive. Create a new JSX element object when replacing frozen props; the key still preserves the mounted instance. Mutable descriptors continue to refresh when their collection updates.
322
+
321
323
  A component can declare a required, narrowed key in its props. The instance receives the original key by reference and can read props.key during setup, rendering, mount, and cleanup. Spreading the props forwards the key to an inner component or element. A spread follows normal JSX precedence, so forwarding the same key to multiple siblings reports a duplicate key.
322
324
 
323
325
  Direct DOM component and root output opt into key tracking when they first mount. Include the key property initially when a direct spread needs later identity changes. An explicit key attribute or a spread containing key with an initial undefined value enables that tracking. Keyless spreads keep their data props live as the instance updates.
@@ -722,11 +724,11 @@ Sizes are exact minified and level-9 gzip JavaScript byte counts. Declarations,
722
724
 
723
725
  | Recipe | Entry | Minified JS | Gzip JS |
724
726
  | -------------------------------- | --------------------------------- | ----------: | -------: |
725
- | Family app with refs and history | `tonnage-recipes/family-app.ts` | 68,795 B | 20,876 B |
726
- | Async interactive client app | `tonnage-recipes/async-app.ts` | 47,231 B | 15,111 B |
727
- | Interactive client app | `tonnage-recipes/client-app.ts` | 46,904 B | 14,961 B |
728
- | Hydrated interactive app | `tonnage-recipes/hydrated-app.ts` | 46,905 B | 14,959 B |
729
- | Interactive Astro island | `tonnage-recipes/astro-island.ts` | 53,443 B | 17,026 B |
727
+ | Family app with refs and history | `tonnage-recipes/family-app.ts` | 68,896 B | 20,908 B |
728
+ | Async interactive client app | `tonnage-recipes/async-app.ts` | 47,332 B | 15,151 B |
729
+ | Interactive client app | `tonnage-recipes/client-app.ts` | 47,004 B | 15,001 B |
730
+ | Hydrated interactive app | `tonnage-recipes/hydrated-app.ts` | 47,005 B | 14,999 B |
731
+ | Interactive Astro island | `tonnage-recipes/astro-island.ts` | 53,544 B | 17,059 B |
730
732
 
731
733
  Report maintained with [tonnage](https://github.com/jeremybanka/tonnage).
732
734
 
@@ -779,7 +781,7 @@ Konva owns hit testing, dragging, and draw batching. Write drag results back int
779
781
 
780
782
  ### Three.js
781
783
 
782
- Import Canvas, Group, Mesh, PerspectiveCamera, AmbientLight, DirectionalLight, BoxGeometry, SphereGeometry, PlaneGeometry, MeshStandardMaterial, MeshBasicMaterial, and MeshNormalMaterial from @atom.io/spa/three. Canvas creates a WebGL renderer after browser mounting. Geometry and material children attach to their Mesh, with one of each supported. Position and rotation accept three-number tuples; scale also accepts a scalar.
784
+ Import Canvas, Group, Mesh, PerspectiveCamera, AmbientLight, DirectionalLight, PointLight, BoxGeometry, SphereGeometry, PlaneGeometry, MeshStandardMaterial, MeshBasicMaterial, MeshNormalMaterial, LineSegments, BufferGeometry, and LineBasicMaterial from @atom.io/spa/three. Canvas creates a WebGL renderer after browser mounting. Geometry and material children attach to their Mesh or LineSegments, with one of each supported. Position and rotation accept three-number tuples; scale also accepts a scalar. Point lights expose color, intensity, distance and decay.
783
785
 
784
786
  ```tsx
785
787
  import type { SpaElement } from "@atom.io/spa"
@@ -811,11 +813,11 @@ export function Scene(): SpaElement {
811
813
 
812
814
  ```
813
815
 
814
- Mesh accepts optional constructor args typed from Three.js, including custom BufferGeometry and a Material or material array. Resources supplied in args are borrowed: their application owner disposes them after all consumers finish. JSX geometry/material children and implicit Mesh defaults remain renderer-owned. Constructor args are fixed for the mounted instance; use a new reconciliation key to replace them.
816
+ Mesh and LineSegments accept optional constructor args typed from Three.js, including custom BufferGeometry and a Material or material array. Resources supplied in args are borrowed: their application owner disposes them after all consumers finish. JSX geometry/material children and implicit drawable defaults remain renderer-owned. Constructor args are fixed for the mounted instance; use a new reconciliation key to replace them.
815
817
 
816
818
  Constructor args are fixed for an instance. Change the resource's key to replace it with new constructor args. Refs expose native objects. Owned geometries and materials are disposed on removal; textures passed through material properties remain borrowed. Canvas stops drawing and disposes its renderer on removal. The exported threeRenderer renders into a borrowed parent dedicated to its children without creating a WebGL renderer.
817
819
 
818
- Canvas accepts rendererOptions for constructor-time settings such as alpha and powerPreference, or createRenderer to construct the renderer with the supplied canvas. Both paths are exclusively owned by Canvas: it disposes the renderer on removal or setup failure, and the factory must return a renderer using that canvas. Shared/borrowed renderers are not supported by this boundary; use threeRenderer for a separately owned renderer. Options and the factory are captured at mount; replace the keyed Canvas to reconstruct its context.
820
+ Canvas accepts rendererOptions for constructor-time settings such as alpha and powerPreference, or createRenderer to construct the renderer with the supplied canvas. Both paths are exclusively owned by Canvas: it disposes the renderer on removal or setup failure, and the factory must return a renderer using that canvas. Shared/borrowed renderers are not supported by this boundary; use threeRenderer for a separately owned renderer. An optional onError callback handles renderer creation failures locally so an application can offer a fallback; later setup or frame errors still reach the owning error boundary. Options and the factory are captured at mount; replace the keyed Canvas to reconstruct its context.
819
821
 
820
822
  Use onCreated to configure tone mapping, output color space, scene background, or controls after the scene mounts and sizes, before the first draw. Return a cleanup callback for controls or other acquired resources. Numeric dpr selects a fixed positive ratio; a min/max tuple clamps devicePixelRatio and follows window resize events. The default remains 1. Width and height remain reactive positive CSS-pixel dimensions. Canvas updates its default perspective camera projection; supplied cameras are borrowed and retain their own projection. Use onResize to update an external perspective/orthographic camera explicitly. onFrame and pointer routing always use the current camera prop, with one frame loop using the installed Motion clock or requestAnimationFrame.
821
823
 
@@ -847,7 +849,25 @@ export function BoardCanvas(): SpaElement {
847
849
 
848
850
  ```
849
851
 
850
- Canvas defaults to a perspective camera at z = 5. Its optional camera prop borrows an external camera; a PerspectiveCamera child does not automatically become active. Width and height update the renderer and default camera. Canvas renders continuously and accepts an onFrame callback with scene, camera, renderer, delta seconds, and timestamp seconds. Controls, asset loading, and drawing on demand are outside this initial API.
852
+ Canvas defaults to a perspective camera at z = 5. Its optional camera prop borrows an external camera; a PerspectiveCamera child does not automatically become active. Width and height update the renderer and default camera. Canvas renders continuously by default. A renderWhen predicate can skip idle GPU draws while frame callbacks and pointer updates continue; the caller makes it true when drawing is needed, and Canvas checks it before onFrame. Canvas accepts an onFrame callback with scene, camera, renderer, delta seconds, and timestamp seconds. Controls and asset loading remain application-owned.
853
+
854
+ ### Shared brand mark
855
+
856
+ Import BrandMark from @atom.io/spa/brand and its stylesheet from @atom.io/spa/brand/css. The compact mark defaults to 22 CSS pixels; size sets its width and height. Use variant="splash" for the viewport backdrop used on atom.io.fyi. Both variants share the same orbital model and honor reduced motion. Three.js loads after browser mounting; server rendering, unavailable WebGL and failed graphics imports retain the static mark. Install the optional three peer to animate it. The base SPA entrypoint does not include branding or its stylesheet.
857
+
858
+ ```tsx
859
+ import "@atom.io/spa/brand/css"
860
+
861
+ import type { SpaElement } from "@atom.io/spa"
862
+ import { BrandMark } from "@atom.io/spa/brand"
863
+
864
+ export function AppBrand(): SpaElement {
865
+ return <BrandMark size={32} />
866
+ }
867
+
868
+ ```
869
+
870
+ Contributor tools can import the canonical geometry, camera and lighting helpers from @atom.io/spa/brand/model without importing the component or CSS.
851
871
 
852
872
  ### Three.js pointer events
853
873
 
@@ -1088,7 +1108,7 @@ export function ReadinessBoard(): SpaElement {
1088
1108
 
1089
1109
  motion:layout enables position and size projection; position or size restricts the animated dimensions. motion:layoutId enables layout animation implicitly and carries a visual identity between outgoing/incoming nodes, while reconciliation keys continue to own component instances. Shared identities are isolated by root and by an explicit motion:layoutGroup on each shared node; group is not inherited. Use distinct group values for separate boards in one root. Reusing an ID within a group coordinates a shared transition, with the latest mounted member leading.
1090
1110
 
1091
- SPA snapshots registered targets before each synchronous update batch and projects after the DOM commits. Per-target ResizeObserver subscriptions also handle external size changes; no document-wide mutation observer or consumer measurement loop is needed. Mark scrolling layout ancestors with motion:layoutScroll. Nested projections preserve authored transforms and transform origins; Floating UI retains its independent translate positioning. Avoid multiple layout/projection owners or direct writes to a projected element's transform while the capability is active.
1111
+ SPA snapshots registered targets before each synchronous update batch and projects after the DOM commits. Per-target ResizeObserver subscriptions also handle external size changes; no document-wide mutation observer or consumer measurement loop is needed. Mark scrolling layout ancestors with motion:layoutScroll. Mark a movable window or fixed layout ancestor with motion:layoutRoot so it moves immediately while its descendants animate relative to it. Nested projections preserve authored transforms and transform origins; Floating UI retains its independent translate positioning. Avoid multiple layout/projection owners or direct writes to a projected element's transform while the capability is active.
1092
1112
 
1093
1113
  The default transition is a 0.3-second tween; the capability option layoutTransition sets defaults and motion:layoutTransition replaces them for a target. Use finite duration/delay values or settling spring parameters. Retargeting uses the current projection. Outgoing nodes remain available for shared handoff until replacements mount in the same batch. With Motion exits, layout follows the retained node's lifetime; keyed re-entry resumes the existing instance. Shared identity transfers appearance, not component state or DOM ownership, and nodes are not automatically reparented.
1094
1114
 
package/README.mdx CHANGED
@@ -33,6 +33,7 @@ import CreateAstroTemplate from "./exhibits/create-astro-template.sh" with {
33
33
  };
34
34
  import Verify from "./exhibits/verify.sh" with { type: "code" };
35
35
  import KonvaExample from "./exhibits/konva.tsx" with { type: "code" };
36
+ import BrandExample from "./exhibits/brand.tsx" with { type: "code" };
36
37
  import ThreeExample from "./exhibits/three.tsx" with { type: "code" };
37
38
  import MotionPanel from "./exhibits/motion.tsx" with { type: "code" };
38
39
  import MotionMain from "./exhibits/motion-main.tsx" with { type: "code" };
@@ -157,6 +158,8 @@ Non-null value and checked props control form state: rejected edits are restored
157
158
 
158
159
  Keys accept the same Canonical values as atom.io families, including nested tuples, booleans, and null. Sibling keys must be unique by canonical serialization. A fresh tuple with the same contents preserves the instance, and a number and its string representation identify separate instances. Only undefined uses positional identity. Reordering preserves keyed instances and nodes. Changing a key replaces the instance in both DOM and scene trees, including when the element stands alone.
159
160
 
161
+ Freezing both a JSX element object and its props opts into reuse in DOM collections without refreshing unchanged descendant props. Its tracked getters remain reactive. Create a new JSX element object when replacing frozen props; the key still preserves the mounted instance. Mutable descriptors continue to refresh when their collection updates.
162
+
160
163
  A component can declare a required, narrowed key in its props. The instance receives the original key by reference and can read props.key during setup, rendering, mount, and cleanup. Spreading the props forwards the key to an inner component or element. A spread follows normal JSX precedence, so forwarding the same key to multiple siblings reports a duplicate key.
161
164
 
162
165
  Direct DOM component and root output opt into key tracking when they first mount. Include the key property initially when a direct spread needs later identity changes. An explicit key attribute or a spread containing key with an initial undefined value enables that tracking. Keyless spreads keep their data props live as the instance updates.
@@ -287,21 +290,29 @@ Konva owns hit testing, dragging, and draw batching. Write drag results back int
287
290
 
288
291
  ### Three.js
289
292
 
290
- Import Canvas, Group, Mesh, PerspectiveCamera, AmbientLight, DirectionalLight, BoxGeometry, SphereGeometry, PlaneGeometry, MeshStandardMaterial, MeshBasicMaterial, and MeshNormalMaterial from @atom.io/spa/three. Canvas creates a WebGL renderer after browser mounting. Geometry and material children attach to their Mesh, with one of each supported. Position and rotation accept three-number tuples; scale also accepts a scalar.
293
+ Import Canvas, Group, Mesh, PerspectiveCamera, AmbientLight, DirectionalLight, PointLight, BoxGeometry, SphereGeometry, PlaneGeometry, MeshStandardMaterial, MeshBasicMaterial, MeshNormalMaterial, LineSegments, BufferGeometry, and LineBasicMaterial from @atom.io/spa/three. Canvas creates a WebGL renderer after browser mounting. Geometry and material children attach to their Mesh or LineSegments, with one of each supported. Position and rotation accept three-number tuples; scale also accepts a scalar. Point lights expose color, intensity, distance and decay.
291
294
 
292
295
  <ThreeExample />
293
296
 
294
- Mesh accepts optional constructor args typed from Three.js, including custom BufferGeometry and a Material or material array. Resources supplied in args are borrowed: their application owner disposes them after all consumers finish. JSX geometry/material children and implicit Mesh defaults remain renderer-owned. Constructor args are fixed for the mounted instance; use a new reconciliation key to replace them.
297
+ Mesh and LineSegments accept optional constructor args typed from Three.js, including custom BufferGeometry and a Material or material array. Resources supplied in args are borrowed: their application owner disposes them after all consumers finish. JSX geometry/material children and implicit drawable defaults remain renderer-owned. Constructor args are fixed for the mounted instance; use a new reconciliation key to replace them.
295
298
 
296
299
  Constructor args are fixed for an instance. Change the resource's key to replace it with new constructor args. Refs expose native objects. Owned geometries and materials are disposed on removal; textures passed through material properties remain borrowed. Canvas stops drawing and disposes its renderer on removal. The exported threeRenderer renders into a borrowed parent dedicated to its children without creating a WebGL renderer.
297
300
 
298
- Canvas accepts rendererOptions for constructor-time settings such as alpha and powerPreference, or createRenderer to construct the renderer with the supplied canvas. Both paths are exclusively owned by Canvas: it disposes the renderer on removal or setup failure, and the factory must return a renderer using that canvas. Shared/borrowed renderers are not supported by this boundary; use threeRenderer for a separately owned renderer. Options and the factory are captured at mount; replace the keyed Canvas to reconstruct its context.
301
+ Canvas accepts rendererOptions for constructor-time settings such as alpha and powerPreference, or createRenderer to construct the renderer with the supplied canvas. Both paths are exclusively owned by Canvas: it disposes the renderer on removal or setup failure, and the factory must return a renderer using that canvas. Shared/borrowed renderers are not supported by this boundary; use threeRenderer for a separately owned renderer. An optional onError callback handles renderer creation failures locally so an application can offer a fallback; later setup or frame errors still reach the owning error boundary. Options and the factory are captured at mount; replace the keyed Canvas to reconstruct its context.
299
302
 
300
303
  Use onCreated to configure tone mapping, output color space, scene background, or controls after the scene mounts and sizes, before the first draw. Return a cleanup callback for controls or other acquired resources. Numeric dpr selects a fixed positive ratio; a min/max tuple clamps devicePixelRatio and follows window resize events. The default remains 1. Width and height remain reactive positive CSS-pixel dimensions. Canvas updates its default perspective camera projection; supplied cameras are borrowed and retain their own projection. Use onResize to update an external perspective/orthographic camera explicitly. onFrame and pointer routing always use the current camera prop, with one frame loop using the installed Motion clock or requestAnimationFrame.
301
304
 
302
305
  <ConfigurableCanvas />
303
306
 
304
- Canvas defaults to a perspective camera at z = 5. Its optional camera prop borrows an external camera; a PerspectiveCamera child does not automatically become active. Width and height update the renderer and default camera. Canvas renders continuously and accepts an onFrame callback with scene, camera, renderer, delta seconds, and timestamp seconds. Controls, asset loading, and drawing on demand are outside this initial API.
307
+ Canvas defaults to a perspective camera at z = 5. Its optional camera prop borrows an external camera; a PerspectiveCamera child does not automatically become active. Width and height update the renderer and default camera. Canvas renders continuously by default. A renderWhen predicate can skip idle GPU draws while frame callbacks and pointer updates continue; the caller makes it true when drawing is needed, and Canvas checks it before onFrame. Canvas accepts an onFrame callback with scene, camera, renderer, delta seconds, and timestamp seconds. Controls and asset loading remain application-owned.
308
+
309
+ ### Shared brand mark
310
+
311
+ Import BrandMark from @atom.io/spa/brand and its stylesheet from @atom.io/spa/brand/css. The compact mark defaults to 22 CSS pixels; size sets its width and height. Use variant="splash" for the viewport backdrop used on atom.io.fyi. Both variants share the same orbital model and honor reduced motion. Three.js loads after browser mounting; server rendering, unavailable WebGL and failed graphics imports retain the static mark. Install the optional three peer to animate it. The base SPA entrypoint does not include branding or its stylesheet.
312
+
313
+ <BrandExample />
314
+
315
+ Contributor tools can import the canonical geometry, camera and lighting helpers from @atom.io/spa/brand/model without importing the component or CSS.
305
316
 
306
317
  ### Three.js pointer events
307
318
 
@@ -363,7 +374,7 @@ Register motionCapability from @atom.io/spa/motion once to enable animated prope
363
374
 
364
375
  motion:layout enables position and size projection; position or size restricts the animated dimensions. motion:layoutId enables layout animation implicitly and carries a visual identity between outgoing/incoming nodes, while reconciliation keys continue to own component instances. Shared identities are isolated by root and by an explicit motion:layoutGroup on each shared node; group is not inherited. Use distinct group values for separate boards in one root. Reusing an ID within a group coordinates a shared transition, with the latest mounted member leading.
365
376
 
366
- SPA snapshots registered targets before each synchronous update batch and projects after the DOM commits. Per-target ResizeObserver subscriptions also handle external size changes; no document-wide mutation observer or consumer measurement loop is needed. Mark scrolling layout ancestors with motion:layoutScroll. Nested projections preserve authored transforms and transform origins; Floating UI retains its independent translate positioning. Avoid multiple layout/projection owners or direct writes to a projected element's transform while the capability is active.
377
+ SPA snapshots registered targets before each synchronous update batch and projects after the DOM commits. Per-target ResizeObserver subscriptions also handle external size changes; no document-wide mutation observer or consumer measurement loop is needed. Mark scrolling layout ancestors with motion:layoutScroll. Mark a movable window or fixed layout ancestor with motion:layoutRoot so it moves immediately while its descendants animate relative to it. Nested projections preserve authored transforms and transform origins; Floating UI retains its independent translate positioning. Avoid multiple layout/projection owners or direct writes to a projected element's transform while the capability is active.
367
378
 
368
379
  The default transition is a 0.3-second tween; the capability option layoutTransition sets defaults and motion:layoutTransition replaces them for a target. Use finite duration/delay values or settling spring parameters. Retargeting uses the current projection. Outgoing nodes remain available for shared handoff until replacements mount in the same batch. With Motion exits, layout follows the retained node's lifetime; keyed re-entry resumes the existing instance. Shared identity transfers appearance, not component state or DOM ownership, and nodes are not automatically reparented.
369
380
 
@@ -0,0 +1,140 @@
1
+ import { DZ2_ORBITAL_LIGHTS, DZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND, createDz2OrbitalCamera, createDz2OrbitalModel, disposeDz2OrbitalModel } from "./brand-model.js";
2
+ import { f as onMount, u as onCleanup } from "./core-DD2giR6E.js";
3
+ import { h as PointLight, i as Canvas, l as Mesh, o as Group, t as AmbientLight } from "./three-DcYxRXPW.js";
4
+ import { jsx } from "@atom.io/spa/jsx-runtime";
5
+ // src/BrandMarkScene.module.css
6
+ var BrandMarkScene_module_default = { "class": "atom-io-spa-BrandMarkScene-module-class" };
7
+ // src/BrandMarkScene.tsx
8
+ const canvas = { Canvas };
9
+ function BrandMarkScene(props) {
10
+ const view = props.view;
11
+ const camera = createDz2OrbitalCamera();
12
+ const model = createDz2OrbitalModel();
13
+ const mark = () => props.variant === `mark`;
14
+ const narrow = () => view.innerWidth < 680;
15
+ let orbital = null;
16
+ let dirty = true;
17
+ const preference = view.matchMedia(`(prefers-reduced-motion: reduce)`);
18
+ const invalidate = () => {
19
+ dirty = true;
20
+ };
21
+ onMount(() => {
22
+ preference.addEventListener(`change`, invalidate);
23
+ view.document.addEventListener(`visibilitychange`, invalidate);
24
+ onCleanup(() => {
25
+ preference.removeEventListener(`change`, invalidate);
26
+ view.document.removeEventListener(`visibilitychange`, invalidate);
27
+ });
28
+ });
29
+ onCleanup(() => {
30
+ disposeDz2OrbitalModel(model);
31
+ });
32
+ return jsx("brand-mark-scene", {
33
+ get "class"() {
34
+ return BrandMarkScene_module_default[`class`];
35
+ },
36
+ children: jsx(canvas.Canvas, {
37
+ get "camera"() {
38
+ return camera;
39
+ },
40
+ get "width"() {
41
+ return props.width;
42
+ },
43
+ get "height"() {
44
+ return props.height;
45
+ },
46
+ get "dpr"() {
47
+ return Math.min(view.devicePixelRatio || 1, mark() ? 2 : 1.35, mark() ? 1e400 : Math.sqrt(16e6 / (props.width * props.height)));
48
+ },
49
+ get "rendererOptions"() {
50
+ return {
51
+ alpha: true,
52
+ antialias: true,
53
+ powerPreference: mark() ? `low-power` : `high-performance`
54
+ };
55
+ },
56
+ get "onError"() {
57
+ return props.onError;
58
+ },
59
+ "onCreated": (({ scene, renderer }) => {
60
+ renderer.render(scene, camera);
61
+ props.onReady();
62
+ }),
63
+ "onResize": (({ width, height }) => {
64
+ camera.aspect = width / height;
65
+ camera.updateProjectionMatrix();
66
+ invalidate();
67
+ }),
68
+ "renderWhen": (() => !view.document.hidden && (dirty || !preference.matches)),
69
+ "onFrame": (({ delta }) => {
70
+ if (view.document.hidden) return;
71
+ if (!preference.matches) orbital.rotation.y += Math.min(delta, .1) * DZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND;
72
+ dirty = false;
73
+ }),
74
+ children: [
75
+ jsx(AmbientLight, {
76
+ get "color"() {
77
+ return DZ2_ORBITAL_LIGHTS.ambient.color;
78
+ },
79
+ get "intensity"() {
80
+ return DZ2_ORBITAL_LIGHTS.ambient.intensity;
81
+ }
82
+ }),
83
+ jsx(PointLight, {
84
+ get "color"() {
85
+ return DZ2_ORBITAL_LIGHTS.core.color;
86
+ },
87
+ get "intensity"() {
88
+ return DZ2_ORBITAL_LIGHTS.core.intensity;
89
+ },
90
+ get "distance"() {
91
+ return DZ2_ORBITAL_LIGHTS.core.distance;
92
+ },
93
+ get "position"() {
94
+ return DZ2_ORBITAL_LIGHTS.core.position;
95
+ }
96
+ }),
97
+ jsx(Group, {
98
+ get "scale"() {
99
+ return mark() ? 1.25 : narrow() ? .52 : .72;
100
+ },
101
+ get "position"() {
102
+ return [
103
+ 0,
104
+ !mark() && narrow() ? -.08 : 0,
105
+ 0
106
+ ];
107
+ },
108
+ "ref": ((node) => {
109
+ orbital = node;
110
+ if (node) node.rotation.copy(model.orbital.rotation);
111
+ }),
112
+ get children() {
113
+ return model.meshes.map((mesh, index) => jsx(Mesh, {
114
+ get "key"() {
115
+ return index;
116
+ },
117
+ get "args"() {
118
+ return [mesh.geometry, mesh.material];
119
+ },
120
+ get "position"() {
121
+ return mesh.position.toArray();
122
+ },
123
+ get "rotation"() {
124
+ return [
125
+ mesh.rotation.x,
126
+ mesh.rotation.y,
127
+ mesh.rotation.z
128
+ ];
129
+ }
130
+ }));
131
+ }
132
+ })
133
+ ]
134
+ })
135
+ });
136
+ }
137
+ BrandMarkScene.spa = true;
138
+ export { BrandMarkScene };
139
+
140
+ //# sourceMappingURL=BrandMarkScene-CBYk-RJ2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrandMarkScene-CBYk-RJ2.js","names":["_spa","css"],"sources":["../src/BrandMarkScene.tsx"],"sourcesContent":["/** @jsxImportSource @atom.io/spa */\nimport type * as THREE from \"three\"\n\nimport {\n\tcreateDz2OrbitalCamera,\n\tcreateDz2OrbitalModel,\n\tdisposeDz2OrbitalModel,\n\tDZ2_ORBITAL_LIGHTS,\n\tDZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND,\n} from \"./brand-model.ts\"\nimport css from \"./BrandMarkScene.module.css\"\nimport type { SpaElement } from \"./core.ts\"\nimport { onCleanup, onMount } from \"./core.ts\"\nimport { AmbientLight, Canvas, Group, Mesh, PointLight } from \"./three.ts\"\n\nconst canvas = { Canvas }\nexport function BrandMarkScene(props: {\n\tvariant: `mark` | `splash`\n\twidth: number\n\theight: number\n\tview: Window\n\tonReady(): void\n\tonError(error: unknown): void\n}): SpaElement {\n\tconst view = props.view\n\tconst camera = createDz2OrbitalCamera()\n\tconst model = createDz2OrbitalModel()\n\tconst mark = () => props.variant === `mark`\n\tconst narrow = () => view.innerWidth < 680\n\tlet orbital: THREE.Object3D | null = null\n\tlet dirty = true\n\tconst preference = view.matchMedia(`(prefers-reduced-motion: reduce)`)\n\tconst invalidate = () => {\n\t\tdirty = true\n\t}\n\tonMount(() => {\n\t\tpreference.addEventListener(`change`, invalidate)\n\t\tview.document.addEventListener(`visibilitychange`, invalidate)\n\t\tonCleanup(() => {\n\t\t\tpreference.removeEventListener(`change`, invalidate)\n\t\t\tview.document.removeEventListener(`visibilitychange`, invalidate)\n\t\t})\n\t})\n\tonCleanup(() => {\n\t\tdisposeDz2OrbitalModel(model)\n\t})\n\treturn (\n\t\t<brand-mark-scene class={css[`class`]}>\n\t\t\t<canvas.Canvas\n\t\t\t\tcamera={camera}\n\t\t\t\twidth={props.width}\n\t\t\t\theight={props.height}\n\t\t\t\tdpr={Math.min(\n\t\t\t\t\tview.devicePixelRatio || 1,\n\t\t\t\t\tmark() ? 2 : 1.35,\n\t\t\t\t\tmark()\n\t\t\t\t\t\t? Infinity\n\t\t\t\t\t\t: Math.sqrt(16_000_000 / (props.width * props.height)),\n\t\t\t\t)}\n\t\t\t\trendererOptions={{\n\t\t\t\t\talpha: true,\n\t\t\t\t\tantialias: true,\n\t\t\t\t\tpowerPreference: mark() ? `low-power` : `high-performance`,\n\t\t\t\t}}\n\t\t\t\tonError={props.onError}\n\t\t\t\tonCreated={({ scene, renderer }) => {\n\t\t\t\t\trenderer.render(scene, camera)\n\t\t\t\t\tprops.onReady()\n\t\t\t\t}}\n\t\t\t\tonResize={({ width, height }) => {\n\t\t\t\t\tcamera.aspect = width / height\n\t\t\t\t\tcamera.updateProjectionMatrix()\n\t\t\t\t\tinvalidate()\n\t\t\t\t}}\n\t\t\t\trenderWhen={() =>\n\t\t\t\t\t!view.document.hidden && (dirty || !preference.matches)\n\t\t\t\t}\n\t\t\t\tonFrame={({ delta }) => {\n\t\t\t\t\tif (view.document.hidden) return\n\t\t\t\t\tif (!preference.matches)\n\t\t\t\t\t\torbital!.rotation.y +=\n\t\t\t\t\t\t\tMath.min(delta, 0.1) * DZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND\n\t\t\t\t\tdirty = false\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<AmbientLight\n\t\t\t\t\tcolor={DZ2_ORBITAL_LIGHTS.ambient.color}\n\t\t\t\t\tintensity={DZ2_ORBITAL_LIGHTS.ambient.intensity}\n\t\t\t\t/>\n\t\t\t\t<PointLight\n\t\t\t\t\tcolor={DZ2_ORBITAL_LIGHTS.core.color}\n\t\t\t\t\tintensity={DZ2_ORBITAL_LIGHTS.core.intensity}\n\t\t\t\t\tdistance={DZ2_ORBITAL_LIGHTS.core.distance}\n\t\t\t\t\tposition={DZ2_ORBITAL_LIGHTS.core.position}\n\t\t\t\t/>\n\t\t\t\t<Group\n\t\t\t\t\tscale={mark() ? 1.25 : narrow() ? 0.52 : 0.72}\n\t\t\t\t\tposition={[0, !mark() && narrow() ? -0.08 : 0, 0]}\n\t\t\t\t\tref={(node) => {\n\t\t\t\t\t\torbital = node\n\t\t\t\t\t\tif (node) node.rotation.copy(model.orbital.rotation)\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{model.meshes.map((mesh, index) => (\n\t\t\t\t\t\t<Mesh\n\t\t\t\t\t\t\tkey={index}\n\t\t\t\t\t\t\targs={[mesh.geometry, mesh.material]}\n\t\t\t\t\t\t\tposition={mesh.position.toArray()}\n\t\t\t\t\t\t\trotation={[mesh.rotation.x, m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C1B,KAAK,SAAS,QAAQ;OAAC;OAAA,IAAA,aAAA;QAAA,OACvB;SAAC,KAAK,SAAS;SAAG,KAAK,SAAS;SAAG,KAAK,SAAS;QAAC;OAAC;MAAA,CAAA,CAE9D;KAAC;IAAA,CAAA;GACK;EAAA,CAAA;CACO,CAAA;AAGnB"}
@@ -2,7 +2,7 @@ import { browserApplication } from "./astro-application.js";
2
2
  import { n as failPreparation, r as storeContext } from "./astro-context-OdlexHR4.js";
3
3
  import { n as islandStore, t as island } from "./astro-shared-DBwINQav.js";
4
4
  import { b as useGetter } from "./core-DD2giR6E.js";
5
- import { n as render, t as hydrate } from "./dom--HZvmgqd.js";
5
+ import { n as render, t as hydrate } from "./dom-DUpa3Sj2.js";
6
6
  import { onRootDispose } from "./hot.js";
7
7
  import { IMPLICIT, createRegularAtomFamily, disposeFromStore, findInStore, getFromStore, setIntoStore } from "atom.io/internal";
8
8
  // src/astro-client.ts
@@ -1,7 +1,7 @@
1
1
  import { n as failPreparation, r as storeContext } from "./astro-context-OdlexHR4.js";
2
2
  import { t as requestApplication } from "./astro-request-DRKvDjsO.js";
3
3
  import { n as islandStore, t as island } from "./astro-shared-DBwINQav.js";
4
- import { t as renderToStringWithReads } from "./server-renderer-BYFDmqnM.js";
4
+ import { t as renderToStringWithReads } from "./server-renderer-D7CdyOMo.js";
5
5
  // src/astro-server.ts
6
6
  const createRenderer = (awaitState = false) => ({
7
7
  name: `spa`,
@@ -0,0 +1,2 @@
1
+ // TypeScript entrypoint for the separately imported brand stylesheet.
2
+ export {}
@@ -0,0 +1,32 @@
1
+ import * as THREE from "three";
2
+ export declare const DZ2_ORBITAL_FINAL_SPIN_RADIANS = 1.1;
3
+ export declare const DZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND: number;
4
+ /** @internal Used by contributor tools or implementation tests. */
5
+ export declare const DZ2_ORBITAL_LIGHTS: {
6
+ core: {
7
+ color: number;
8
+ intensity: number;
9
+ distance: number;
10
+ position: [number, number, number];
11
+ };
12
+ ambient: {
13
+ color: number;
14
+ intensity: number;
15
+ };
16
+ };
17
+ type Dz2OrbitalMesh = THREE.Mesh<THREE.BufferGeometry, THREE.MeshToonMaterial>;
18
+ export type Dz2OrbitalModel = {
19
+ orbital: THREE.Group;
20
+ meshes: Dz2OrbitalMesh[];
21
+ materials: {
22
+ lobe: THREE.MeshToonMaterial;
23
+ torus: THREE.MeshToonMaterial;
24
+ };
25
+ };
26
+ export declare function createDz2OrbitalCamera(aspect?: number): THREE.PerspectiveCamera;
27
+ export declare function addDz2OrbitalLights(scene: THREE.Scene): void;
28
+ export declare function setDz2OrbitalRotation(orbital: THREE.Object3D, y?: number): void;
29
+ export declare function createDz2OrbitalModel(): Dz2OrbitalModel;
30
+ export declare function disposeDz2OrbitalModel(model: Dz2OrbitalModel): void;
31
+ export {};
32
+ //# sourceMappingURL=brand-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand-model.d.ts","names":[],"sources":["../src/brand-model.ts"],"mappings":";qBAEa;qBAGA;;qBAkBA;;IAEX;IACA;IACA;IACA;;;IAGA;IACA;;;KAeG,iBAAiB,MAAM,KAAK,MAAM,gBAAgB,MAAM;YAEjD;EACX,SAAS,MAAM;EACf,QAAQ;EACR;IACC,MAAM,MAAM;IACZ,OAAO,MAAM;;;wBA8BC,uBAAuB,kBAAa,MAAM;wBAY1C,oBAAoB,OAAO,MAAM;wBAgBjC,sBACf,SAAS,MAAM,UACf;wBASe,yBAAyB;wBA+CzB,uBAAuB,OAAO"}
@@ -0,0 +1,120 @@
1
+ import * as THREE from "three";
2
+ // src/brand-model.ts
3
+ const DZ2_ORBITAL_FINAL_SPIN_RADIANS = 1.1;
4
+ const DZ2_ORBITAL_SETTLED_ROTATION_X = 1.4;
5
+ const DZ2_ORBITAL_SETTLED_ROTATION_Z = -1.4;
6
+ const DZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND = Math.PI / 128;
7
+ const DZ2_ORBITAL_LOBE_CENTER_OFFSET = .05;
8
+ const DZ2_ORBITAL_CAMERA = {
9
+ fov: 34,
10
+ near: .1,
11
+ far: 100,
12
+ position: [
13
+ 4.2,
14
+ 2.4,
15
+ 6.6
16
+ ],
17
+ lookAt: [
18
+ 0,
19
+ 0,
20
+ 0
21
+ ]
22
+ };
23
+ /** @internal Used by contributor tools or implementation tests. */
24
+ const DZ2_ORBITAL_LIGHTS = {
25
+ core: {
26
+ color: 16777215,
27
+ intensity: 28,
28
+ distance: 9,
29
+ position: [
30
+ 1.8,
31
+ 1.7,
32
+ 3.5
33
+ ]
34
+ },
35
+ ambient: {
36
+ color: 10475263,
37
+ intensity: 1.4
38
+ }
39
+ };
40
+ function makeLobeGeometry(direction) {
41
+ const points = [];
42
+ const height = 1.5;
43
+ const radius = .75;
44
+ for (let index = 0; index <= 44; index++) {
45
+ const progress = index / 45;
46
+ const easedRadius = radius * Math.sin(Math.PI * progress) ** .58 * (.5 + progress * .6);
47
+ points.push(new THREE.Vector2(easedRadius, direction * progress * height));
48
+ }
49
+ for (let index = 440; index <= 450; index++) {
50
+ const progress = index / 450;
51
+ const easedRadius = radius * Math.sin(Math.PI * progress) ** .58 * (.5 + progress * .6);
52
+ points.push(new THREE.Vector2(easedRadius, direction * progress * height));
53
+ }
54
+ const lastPoint = points[points.length - 1];
55
+ const nextToLastPoint = points[points.length - 2];
56
+ lastPoint.setY(nextToLastPoint.y);
57
+ points[0].setY(points[1].y);
58
+ return new THREE.LatheGeometry(points, 96);
59
+ }
60
+ function createDz2OrbitalCamera(aspect = 1) {
61
+ const camera = new THREE.PerspectiveCamera(DZ2_ORBITAL_CAMERA.fov, aspect, DZ2_ORBITAL_CAMERA.near, DZ2_ORBITAL_CAMERA.far);
62
+ camera.position.set(...DZ2_ORBITAL_CAMERA.position);
63
+ camera.lookAt(...DZ2_ORBITAL_CAMERA.lookAt);
64
+ return camera;
65
+ }
66
+ function addDz2OrbitalLights(scene) {
67
+ const coreLight = new THREE.PointLight(DZ2_ORBITAL_LIGHTS.core.color, DZ2_ORBITAL_LIGHTS.core.intensity, DZ2_ORBITAL_LIGHTS.core.distance);
68
+ coreLight.position.set(...DZ2_ORBITAL_LIGHTS.core.position);
69
+ scene.add(coreLight);
70
+ scene.add(new THREE.AmbientLight(DZ2_ORBITAL_LIGHTS.ambient.color, DZ2_ORBITAL_LIGHTS.ambient.intensity));
71
+ }
72
+ function setDz2OrbitalRotation(orbital, y = DZ2_ORBITAL_FINAL_SPIN_RADIANS) {
73
+ orbital.rotation.set(DZ2_ORBITAL_SETTLED_ROTATION_X, y, DZ2_ORBITAL_SETTLED_ROTATION_Z);
74
+ }
75
+ function createDz2OrbitalModel() {
76
+ const orbital = new THREE.Group();
77
+ setDz2OrbitalRotation(orbital);
78
+ const lobeMaterial = new THREE.MeshToonMaterial({
79
+ color: 16724838,
80
+ emissive: 16724838,
81
+ emissiveIntensity: .22,
82
+ opacity: .82,
83
+ side: THREE.DoubleSide
84
+ });
85
+ const torusMaterial = new THREE.MeshToonMaterial({
86
+ color: 39423,
87
+ emissive: 39423,
88
+ emissiveIntensity: .17,
89
+ opacity: .72,
90
+ side: THREE.DoubleSide
91
+ });
92
+ const topLobe = new THREE.Mesh(makeLobeGeometry(1), lobeMaterial);
93
+ const bottomLobe = new THREE.Mesh(makeLobeGeometry(-1), lobeMaterial);
94
+ topLobe.position.y = DZ2_ORBITAL_LOBE_CENTER_OFFSET;
95
+ bottomLobe.position.y = -.05;
96
+ const torus = new THREE.Mesh(new THREE.TorusGeometry(1.2, .3, 36, 144), torusMaterial);
97
+ torus.rotation.x = Math.PI / 2;
98
+ const meshes = [
99
+ topLobe,
100
+ bottomLobe,
101
+ torus
102
+ ];
103
+ orbital.add(...meshes);
104
+ return {
105
+ orbital,
106
+ meshes,
107
+ materials: {
108
+ lobe: lobeMaterial,
109
+ torus: torusMaterial
110
+ }
111
+ };
112
+ }
113
+ function disposeDz2OrbitalModel(model) {
114
+ for (const mesh of model.meshes) mesh.geometry.dispose();
115
+ model.materials.lobe.dispose();
116
+ model.materials.torus.dispose();
117
+ }
118
+ export { DZ2_ORBITAL_FINAL_SPIN_RADIANS, DZ2_ORBITAL_LIGHTS, DZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND, addDz2OrbitalLights, createDz2OrbitalCamera, createDz2OrbitalModel, disposeDz2OrbitalModel, setDz2OrbitalRotation };
119
+
120
+ //# sourceMappingURL=brand-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand-model.js","names":[],"sources":["../src/brand-model.ts"],"sourcesContent":["import * as THREE from \"three\"\n\nexport const DZ2_ORBITAL_FINAL_SPIN_RADIANS = 1.1\nconst DZ2_ORBITAL_SETTLED_ROTATION_X = 1.4\nconst DZ2_ORBITAL_SETTLED_ROTATION_Z = -1.4\nexport const DZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND = Math.PI / 128\nconst DZ2_ORBITAL_LOBE_CENTER_OFFSET = 0.05\n\nconst DZ2_ORBITAL_CAMERA = {\n\tfov: 34,\n\tnear: 0.1,\n\tfar: 100,\n\tposition: [4.2, 2.4, 6.6],\n\tlookAt: [0, 0, 0],\n} satisfies {\n\tfov: number\n\tnear: number\n\tfar: number\n\tposition: [number, number, number]\n\tlookAt: [number, number, number]\n}\n\n/** @internal Used by contributor tools or implementation tests. */\nexport const DZ2_ORBITAL_LIGHTS = {\n\tcore: {\n\t\tcolor: 0xffffff,\n\t\tintensity: 28,\n\t\tdistance: 9,\n\t\tposition: [1.8, 1.7, 3.5],\n\t},\n\tambient: {\n\t\tcolor: 0x9fd6ff,\n\t\tintensity: 1.4,\n\t},\n} satisfies {\n\tcore: {\n\t\tcolor: number\n\t\tintensity: number\n\t\tdistance: number\n\t\tposition: [number, number, number]\n\t}\n\tambient: {\n\t\tcolor: number\n\t\tintensity: number\n\t}\n}\n\ntype Dz2OrbitalMesh = THREE.Mesh<THREE.BufferGeometry, THREE.MeshToonMaterial>\n\nexport type Dz2OrbitalModel = {\n\torbital: THREE.Group\n\tmeshes: Dz2OrbitalMesh[]\n\tmaterials: {\n\t\tlobe: THREE.MeshToonMaterial\n\t\ttorus: THREE.MeshToonMaterial\n\t}\n}\n\nfunction makeLobeGeometry(direction: 1 | -1): THREE.LatheGeometry {\n\tconst points: THREE.Vector2[] = []\n\tconst height = 1.5\n\tconst radius = 0.75\n\tfor (let index = 0; index <= 44; index++) {\n\t\tconst progress = index / 45\n\t\tconst easedRadius =\n\t\t\tradius * Math.sin(Math.PI * progress) ** 0.58 * (0.5 + progress * 0.6)\n\n\t\tpoints.push(new THREE.Vector2(easedRadius, direction * progress * height))\n\t}\n\n\tfor (let index = 440; index <= 450; index++) {\n\t\tconst progress = index / 450\n\t\tconst easedRadius =\n\t\t\tradius * Math.sin(Math.PI * progress) ** 0.58 * (0.5 + progress * 0.6)\n\t\tpoints.push(new THREE.Vector2(easedRadius, direction * progress * height))\n\t}\n\n\tconst lastPoint = points[points.length - 1]\n\tconst nextToLastPoint = points[points.length - 2]\n\tlastPoint.setY(nextToLastPoint.y)\n\tpoints[0].setY(points[1].y)\n\treturn new THREE.LatheGeometry(points, 96)\n}\n\nexport function createDz2OrbitalCamera(aspect = 1): THREE.PerspectiveCamera {\n\tconst camera = new THREE.PerspectiveCamera(\n\t\tDZ2_ORBITAL_CAMERA.fov,\n\t\taspect,\n\t\tDZ2_ORBITAL_CAMERA.near,\n\t\tDZ2_ORBITAL_CAMERA.far,\n\t)\n\tcamera.position.set(...DZ2_ORBITAL_CAMERA.position)\n\tcamera.lookAt(...DZ2_ORBITAL_CAMERA.lookAt)\n\treturn camera\n}\n\nexport function addDz2OrbitalLights(scene: THREE.Scene): void {\n\tconst coreLight = new THREE.PointLight(\n\t\tDZ2_ORBITAL_LIGHTS.core.color,\n\t\tDZ2_ORBITAL_LIGHTS.core.intensity,\n\t\tDZ2_ORBITAL_LIGHTS.core.distance,\n\t)\n\tcoreLight.position.set(...DZ2_ORBITAL_LIGHTS.core.position)\n\tscene.add(coreLight)\n\tscene.add(\n\t\tnew THREE.AmbientLight(\n\t\t\tDZ2_ORBITAL_LIGHTS.ambient.color,\n\t\t\tDZ2_ORBITAL_LIGHTS.ambient.intensity,\n\t\t),\n\t)\n}\n\nexport function setDz2OrbitalRotation(\n\torbital: THREE.Object3D,\n\ty = DZ2_ORBITAL_FINAL_SPIN_RADIANS,\n): void {\n\torbital.rotation.set(\n\t\tDZ2_ORBITAL_SETTLED_ROTATION_X,\n\t\ty,\n\t\tDZ2_ORBITAL_SETTLED_ROTATION_Z,\n\t)\n}\n\nexport function createDz2OrbitalModel(): Dz2OrbitalModel {\n\tconst orbital = new THREE.Group()\n\tsetDz2OrbitalRotation(orbital)\n\n\tconst lobeMaterial = new THREE.MeshToonMaterial({\n\t\tcolor: 0xff3366,\n\t\temissive: 0xff3366,\n\t\temissiveIntensity: 0.22,\n\t\topacity: 0.82,\n\t\tside: THREE.DoubleSide,\n\t})\n\tconst torusMaterial = new THREE.MeshToonMaterial({\n\t\tcolor: 0x0099ff,\n\t\temissive: 0x0099ff,\n\t\temissiveIntensity: 0.17,\n\t\topacity: 0.72,\n\t\tside: THREE.DoubleSide,\n\t})\n\n\tconst topLobe: Dz2OrbitalMesh = new THREE.Mesh(\n\t\tmakeLobeGeometry(1),\n\t\tlobeMaterial,\n\t)\n\tconst bottomLobe: Dz2OrbitalMesh = new THREE.Mesh(\n\t\tmakeLobeGeometry(-1),\n\t\tlobeMaterial,\n\t)\n\ttopLobe.position.y = DZ2_ORBITAL_LOBE_CENTER_OFFSET\n\tbottomLobe.position.y = -DZ2_ORBITAL_LOBE_CENTER_OFFSET\n\tconst torus: Dz2OrbitalMesh = new THREE.Mesh(\n\t\tnew THREE.TorusGeometry(1.2, 0.3, 36, 144),\n\t\ttorusMaterial,\n\t)\n\ttorus.rotation.x = Math.PI / 2\n\tconst meshes = [topLobe, bottomLobe, torus]\n\torbital.add(...meshes)\n\n\treturn {\n\t\torbital,\n\t\tmeshes,\n\t\tmaterials: {\n\t\t\tlobe: lobeMaterial,\n\t\t\ttorus: torusMaterial,\n\t\t},\n\t}\n}\n\nexport function disposeDz2OrbitalModel(model: Dz2OrbitalModel): void {\n\tfor (const mesh of model.meshes) {\n\t\tmesh.geometry.dispose()\n\t}\n\tmodel.materials.lobe.dispose()\n\tmodel.materials.torus.dispose()\n}\n"],"mappings":";;AAEA,MAAa,iCAAiC;AAC9C,MAAM,iCAAiC;AACvC,MAAM,iCAAiC;AACvC,MAAa,4CAA4C,KAAK,KAAK;AACnE,MAAM,iCAAiC;AAEvC,MAAM,qBAAqB;CAC1B,KAAK;CACL,MAAM;CACN,KAAK;CACL,UAAU;EAAC;EAAK;EAAK;CAAG;CACxB,QAAQ;EAAC;EAAG;EAAG;CAAC;AACjB;;AASA,MAAa,qBAAqB;CACjC,MAAM;EACL,OAAO;EACP,WAAW;EACX,UAAU;EACV,UAAU;GAAC;GAAK;GAAK;EAAG;CACzB;CACA,SAAS;EACR,OAAO;EACP,WAAW;CACZ;AACD;AAwBA,SAAS,iBAAiB,WAAwC;CACjE,MAAM,SAA0B,CAAC;CACjC,MAAM,SAAS;CACf,MAAM,SAAS;CACf,KAAK,IAAI,QAAQ,GAAG,SAAS,IAAI,SAAS;EACzC,MAAM,WAAW,QAAQ;EACzB,MAAM,cACL,SAAS,KAAK,IAAI,KAAK,KAAK,QAAQ,KAAK,OAAQ,KAAM,WAAW;EAEnE,OAAO,KAAK,IAAI,MAAM,QAAQ,aAAa,YAAY,WAAW,MAAM,CAAC;CAC1E;CAEA,KAAK,IAAI,QAAQ,KAAK,SAAS,KAAK,SAAS;EAC5C,MAAM,WAAW,QAAQ;EACzB,MAAM,cACL,SAAS,KAAK,IAAI,KAAK,KAAK,QAAQ,KAAK,OAAQ,KAAM,WAAW;EACnE,OAAO,KAAK,IAAI,MAAM,QAAQ,aAAa,YAAY,WAAW,MAAM,CAAC;CAC1E;CAEA,MAAM,YAAY,OAAO,OAAO,SAAS;CACzC,MAAM,kBAAkB,OAAO,OAAO,SAAS;CAC/C,UAAU,KAAK,gBAAgB,CA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