lecodes-sdk 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/README.md +5 -2
  2. package/dist/editor.d.ts +12 -0
  3. package/dist/global.d.ts +4 -8
  4. package/dist/host.d.ts +2 -3
  5. package/dist/types/animate/tween/Animation.d.ts +0 -3
  6. package/dist/types/animate/tween/animateValue.d.ts +4 -2
  7. package/dist/types/animate/tween/easing.d.ts +8 -0
  8. package/dist/types/animate/tween/spec.d.ts +15 -7
  9. package/dist/types/audio/audio.d.ts +2 -1
  10. package/dist/types/canvas/Canvas.d.ts +40 -108
  11. package/dist/types/canvas/gen/cssColor.d.ts +17 -0
  12. package/dist/types/canvas/gen/recorder.d.ts +118 -0
  13. package/dist/types/canvas/gen/spec.d.ts +144 -0
  14. package/dist/types/core/color.d.ts +3 -1
  15. package/dist/types/core/pins.d.ts +18 -0
  16. package/dist/types/g2/Node2D.d.ts +5 -8
  17. package/dist/types/g2/Scene2D.d.ts +6 -2
  18. package/dist/types/gl/Foliage.d.ts +30 -7
  19. package/dist/types/gl/Light.d.ts +11 -0
  20. package/dist/types/gl/Lightmap.d.ts +13 -2
  21. package/dist/types/gl/Material.d.ts +17 -3
  22. package/dist/types/gl/Model.d.ts +6 -2
  23. package/dist/types/gl/Node.d.ts +3 -6
  24. package/dist/types/gl/Particles.d.ts +15 -0
  25. package/dist/types/gl/Scene.d.ts +41 -13
  26. package/dist/types/gl/Texture.d.ts +1 -1
  27. package/dist/types/gl/animation/Locomotion.d.ts +59 -3
  28. package/dist/types/gl/terrain/Terrain.d.ts +8 -0
  29. package/dist/types/inject.d.ts +11 -11
  30. package/dist/types/inject.editor.d.ts +1 -0
  31. package/dist/types/net/core.d.ts +7 -0
  32. package/dist/types/plugin.d.ts +76 -0
  33. package/dist/types/plugins/gen/camera/sdk/camera.d.ts +24 -0
  34. package/dist/types/plugins/gen/camera/sdk/camera.gen.d.ts +25 -0
  35. package/dist/types/plugins/{geolocation.d.ts → gen/geolocation/sdk/geolocation.d.ts} +2 -20
  36. package/dist/types/plugins/gen/geolocation/sdk/geolocation.gen.d.ts +31 -0
  37. package/dist/types/plugins/{map.d.ts → gen/map/sdk/map.d.ts} +9 -50
  38. package/dist/types/plugins/gen/map/sdk/map.gen.d.ts +53 -0
  39. package/dist/types/plugins/gen/push/sdk/push.d.ts +23 -0
  40. package/dist/types/plugins/gen/push/sdk/push.gen.d.ts +35 -0
  41. package/dist/types/plugins/{qr.d.ts → gen/qr-scanner/sdk/qr-scanner.d.ts} +2 -3
  42. package/dist/types/plugins/gen/qr-scanner/sdk/qr-scanner.gen.d.ts +15 -0
  43. package/dist/types/runtime/app.d.ts +9 -2
  44. package/dist/types/runtime/fetch.d.ts +2 -0
  45. package/dist/types/runtime/input.d.ts +8 -1
  46. package/dist/types/runtime/media.d.ts +6 -10
  47. package/dist/types/runtime/misc.d.ts +4 -1
  48. package/dist/types/runtime/net.d.ts +3 -2
  49. package/dist/types/runtime/touch.d.ts +32 -0
  50. package/dist/types/scene/defineScene.d.ts +43 -2
  51. package/dist/types/scene/editor.d.ts +52 -0
  52. package/dist/types/scene/gizmos.d.ts +7 -4
  53. package/dist/types/ui/NativeView.d.ts +6 -4
  54. package/dist/types/ui/UI.d.ts +1 -1
  55. package/dist/types/ui/UIBottomSheet.d.ts +6 -12
  56. package/dist/types/ui/UIButton.d.ts +12 -14
  57. package/dist/types/ui/UIContainer.d.ts +0 -6
  58. package/dist/types/ui/UIImage.d.ts +1 -4
  59. package/dist/types/ui/UIInput.d.ts +8 -24
  60. package/dist/types/ui/UIModal.d.ts +0 -2
  61. package/dist/types/ui/UINode.d.ts +70 -56
  62. package/dist/types/ui/UIPager.d.ts +28 -27
  63. package/dist/types/ui/UIPopover.d.ts +0 -2
  64. package/dist/types/ui/UIScreen.d.ts +12 -17
  65. package/dist/types/ui/UIScrollable.d.ts +1 -4
  66. package/dist/types/ui/UIText.d.ts +0 -2
  67. package/dist/types/ui/UIVideo.d.ts +3 -5
  68. package/dist/types/ui/UIVirtualizedList.d.ts +14 -16
  69. package/dist/types/ui/UIWidget.d.ts +10 -9
  70. package/dist/types/ui/colorKeys.gen.d.ts +9 -0
  71. package/dist/types/ui/presentable.d.ts +46 -32
  72. package/dist/types/ui/router.d.ts +18 -7
  73. package/dist/types/ui/styleColor.d.ts +1 -0
  74. package/dist/types/ui/transitions.d.ts +18 -0
  75. package/dist/types/ui/tree.d.ts +75 -0
  76. package/dist/types/version.d.ts +10 -0
  77. package/dist/types.json +1 -1
  78. package/package.json +12 -3
  79. package/prompts/2d.md +2 -6
  80. package/prompts/3d.md +1 -5
  81. package/prompts/README.md +142 -142
  82. package/prompts/canvas.md +9 -8
  83. package/prompts/compose.ts +1 -1
  84. package/prompts/core.md +3 -3
  85. package/prompts/design.md +1 -1
  86. package/prompts/dist/2d-game.md +77 -54
  87. package/prompts/dist/3d-app.md +75 -52
  88. package/prompts/dist/ar-app.md +74 -51
  89. package/prompts/dist/design.md +30 -8
  90. package/prompts/dist/ui-app.md +73 -46
  91. package/prompts/ui-design.md +2 -3
  92. package/prompts/ui.md +45 -37
  93. package/src/animate/tween/Animation.ts +262 -378
  94. package/src/animate/tween/animateValue.ts +103 -100
  95. package/src/animate/tween/easing.ts +10 -3
  96. package/src/animate/tween/spec.ts +505 -479
  97. package/src/audio/Sound.ts +3 -3
  98. package/src/audio/audio.ts +162 -161
  99. package/src/bridges/2d.d.ts +317 -0
  100. package/src/bridges/app.d.ts +91 -0
  101. package/src/bridges/audio.d.ts +97 -0
  102. package/src/bridges/canvas.d.ts +79 -0
  103. package/src/bridges/device.d.ts +72 -0
  104. package/src/bridges/fetch.d.ts +80 -0
  105. package/src/bridges/files.d.ts +70 -0
  106. package/src/bridges/gl.d.ts +1133 -0
  107. package/src/bridges/input.d.ts +72 -0
  108. package/src/bridges/media.d.ts +55 -0
  109. package/src/bridges/nav.d.ts +71 -0
  110. package/src/bridges/net.d.ts +52 -0
  111. package/src/bridges/service.d.ts +52 -0
  112. package/src/bridges/socket.d.ts +31 -0
  113. package/src/bridges/storage.d.ts +33 -0
  114. package/src/bridges/tree.d.ts +301 -0
  115. package/src/bridges/types.d.ts +49 -0
  116. package/src/canvas/Canvas.ts +114 -159
  117. package/src/canvas/gen/cssColor.ts +224 -0
  118. package/src/canvas/gen/recorder.ts +212 -0
  119. package/src/canvas/gen/spec.ts +201 -0
  120. package/src/chisel.ts +193 -0
  121. package/src/compile/assetMacro.ts +1 -1
  122. package/src/compile/bundler.ts +11 -2
  123. package/src/compile/compileProject.ts +43 -4
  124. package/src/compile/fontMacro.ts +3 -4
  125. package/src/compile/header.ts +26 -5
  126. package/src/compile/index.ts +3 -1
  127. package/src/compile/liteMaterial.ts +1 -1
  128. package/src/compile/sceneEditor.ts +11 -26
  129. package/src/core/color.ts +73 -30
  130. package/src/core/pins.ts +51 -0
  131. package/src/core/signals.ts +8 -1
  132. package/src/g2/CharacterController2D.ts +3 -3
  133. package/src/g2/Node2D.ts +57 -39
  134. package/src/g2/Physics2D.ts +2 -2
  135. package/src/g2/Scene2D.ts +35 -23
  136. package/src/g2/Texture2D.ts +1 -1
  137. package/src/g2/loop.ts +4 -4
  138. package/src/gl/Foliage.ts +72 -17
  139. package/src/gl/Geometry.ts +1 -2
  140. package/src/gl/Light.ts +13 -0
  141. package/src/gl/Lightmap.ts +45 -29
  142. package/src/gl/Material.ts +95 -51
  143. package/src/gl/Model.ts +172 -167
  144. package/src/gl/Node.ts +91 -24
  145. package/src/gl/Particles.ts +20 -1
  146. package/src/gl/Scene.ts +100 -44
  147. package/src/gl/Texture.ts +8 -7
  148. package/src/gl/animation/AnimationClip.ts +1 -1
  149. package/src/gl/animation/Locomotion.ts +77 -8
  150. package/src/gl/nav/NavMesh.ts +3 -4
  151. package/src/gl/physics/Physics.ts +2 -2
  152. package/src/gl/physics/physicsEvents.ts +3 -3
  153. package/src/gl/terrain/Terrain.ts +33 -5
  154. package/src/gl/touch.ts +14 -15
  155. package/src/host.d.ts +2 -3
  156. package/src/inject.editor.ts +7 -0
  157. package/src/inject.ts +233 -236
  158. package/src/net/core.ts +6 -5
  159. package/src/net/index.ts +1 -1
  160. package/src/net/replication.ts +1 -1
  161. package/src/plugin.ts +191 -0
  162. package/src/plugins/gen/camera/contract.d.ts +27 -0
  163. package/src/plugins/gen/camera/sdk/camera.gen.ts +46 -0
  164. package/src/plugins/gen/camera/sdk/camera.ts +57 -0
  165. package/src/plugins/gen/geolocation/contract.d.ts +50 -0
  166. package/src/plugins/gen/geolocation/sdk/geolocation.gen.ts +54 -0
  167. package/src/plugins/{geolocation.ts → gen/geolocation/sdk/geolocation.ts} +22 -43
  168. package/src/plugins/gen/map/contract.d.ts +144 -0
  169. package/src/plugins/gen/map/sdk/map.gen.ts +88 -0
  170. package/src/plugins/{map.ts → gen/map/sdk/map.ts} +68 -102
  171. package/src/plugins/gen/push/contract.d.ts +61 -0
  172. package/src/plugins/gen/push/sdk/push.gen.ts +60 -0
  173. package/src/plugins/gen/push/sdk/push.ts +105 -0
  174. package/src/plugins/gen/qr-scanner/contract.d.ts +16 -0
  175. package/src/plugins/gen/qr-scanner/sdk/qr-scanner.gen.ts +29 -0
  176. package/src/plugins/gen/qr-scanner/sdk/qr-scanner.ts +52 -0
  177. package/src/plugins/permission.ts +5 -4
  178. package/src/runtime/app.ts +20 -9
  179. package/src/runtime/appEvents.ts +5 -4
  180. package/src/runtime/channel.ts +18 -15
  181. package/src/runtime/clipboard.ts +4 -3
  182. package/src/runtime/datetime.ts +2 -1
  183. package/src/runtime/device.ts +17 -15
  184. package/src/runtime/fetch.ts +30 -20
  185. package/src/runtime/files.ts +16 -15
  186. package/src/runtime/input.ts +21 -8
  187. package/src/runtime/media.ts +50 -46
  188. package/src/runtime/misc.ts +7 -3
  189. package/src/runtime/net.ts +8 -7
  190. package/src/runtime/rpc.ts +1 -3
  191. package/src/runtime/service.ts +19 -14
  192. package/src/runtime/share.ts +4 -3
  193. package/src/runtime/storage.ts +6 -4
  194. package/src/runtime/touch.ts +32 -0
  195. package/src/scene/defineScene.ts +61 -365
  196. package/src/scene/editor.ts +408 -0
  197. package/src/scene/editorPlugins.ts +3 -3
  198. package/src/scene/gizmos.ts +154 -148
  199. package/src/server/db/marci/query.ts +1 -1
  200. package/src/server/host.ts +1 -1
  201. package/src/server/runtime.ts +1 -1
  202. package/src/ui/NativeView.ts +72 -25
  203. package/src/ui/UI.ts +3 -3
  204. package/src/ui/UIBottomSheet.ts +16 -17
  205. package/src/ui/UIButton.ts +54 -16
  206. package/src/ui/UIContainer.ts +0 -6
  207. package/src/ui/UIImage.ts +34 -30
  208. package/src/ui/UIInput.ts +29 -37
  209. package/src/ui/UIModal.ts +1 -3
  210. package/src/ui/UINode.ts +347 -297
  211. package/src/ui/UIPager.ts +93 -78
  212. package/src/ui/UIPopover.ts +0 -2
  213. package/src/ui/UIScreen.ts +41 -36
  214. package/src/ui/UIScrollable.ts +19 -13
  215. package/src/ui/UISpacer.ts +1 -1
  216. package/src/ui/UITabs.ts +8 -6
  217. package/src/ui/UIText.ts +7 -17
  218. package/src/ui/UIVideo.ts +30 -27
  219. package/src/ui/UIVirtualizedList.ts +58 -59
  220. package/src/ui/UIWidget.ts +38 -18
  221. package/src/ui/colorKeys.gen.ts +37 -0
  222. package/src/ui/fonts.ts +2 -2
  223. package/src/ui/presentable.ts +59 -42
  224. package/src/ui/router.ts +52 -35
  225. package/src/ui/styleColor.ts +56 -0
  226. package/src/ui/theme.ts +7 -6
  227. package/src/ui/transitions.ts +249 -0
  228. package/src/ui/tree.ts +346 -0
  229. package/src/version.ts +24 -0
  230. package/tests/helpers/engineWorld.ts +11 -0
  231. package/tests/helpers/fakeTree.ts +353 -0
  232. package/tests/helpers/hostStubs.ts +31 -0
  233. package/tests/helpers/index.ts +14 -0
  234. package/tests/helpers/memoryMarci.ts +124 -0
  235. package/tests/helpers/phases.ts +23 -0
  236. package/tests/helpers/preload.ts +18 -0
  237. package/tests/helpers/stubApp.ts +2 -0
  238. package/tests/helpers/stubDevice.ts +2 -0
  239. package/tests/helpers/stubFetch.ts +2 -0
  240. package/tests/helpers/stubInput.ts +2 -0
  241. package/dist/inject.js +0 -4730
  242. package/dist/types/core/registry.d.ts +0 -7
  243. package/dist/types/plugins/camera.d.ts +0 -25
  244. package/dist/types/plugins/push.d.ts +0 -46
  245. package/src/bridges.d.ts +0 -1760
  246. package/src/compile/__tests__/assetIconMacro.test.ts +0 -219
  247. package/src/compile/__tests__/assetMacro.test.ts +0 -100
  248. package/src/compile/__tests__/assetName.test.ts +0 -55
  249. package/src/compile/__tests__/compile.test.ts +0 -310
  250. package/src/compile/__tests__/detectEntry.test.ts +0 -151
  251. package/src/compile/__tests__/fontMacro.test.ts +0 -199
  252. package/src/compile/__tests__/serverSplit.test.ts +0 -27
  253. package/src/core/__tests__/stateMachine.test.ts +0 -132
  254. package/src/core/registry.ts +0 -23
  255. package/src/plugins/camera.ts +0 -81
  256. package/src/plugins/push.ts +0 -132
  257. package/src/plugins/qr.ts +0 -73
package/src/gl/touch.ts CHANGED
@@ -2,17 +2,18 @@
2
2
  // the struck Node and to the active scene's listeners. Ported from worker/src/TouchEventSystem.ts.
3
3
 
4
4
  import { ClickEvent, TouchStartEvent, type TrackHandler } from "../runtime/touch"
5
- import { nodeRegistry } from "./Node"
5
+ import { ensureEmitter, setSceneTouchHandlers } from "../ui/tree"
6
+ import { nodes } from "./Node"
6
7
  import { glState } from "./state"
7
8
 
8
9
  // Hits inside a loaded model (GLB) land on sub-entities the user never created a Node for — walk up
9
10
  // the transform hierarchy to the nearest entity someone actually holds (the model's Node).
10
11
  const resolveHitNode = (entityId: number) => {
11
- let node = nodeRegistry.get(entityId)
12
+ let node = nodes.get(entityId)
12
13
  for (let id = entityId, i = 0; !node && i < 32; i++) {
13
14
  id = _creator.getParent(id)
14
15
  if (id === 0) break
15
- node = nodeRegistry.get(id)
16
+ node = nodes.get(id)
16
17
  }
17
18
  return node ?? null
18
19
  }
@@ -53,16 +54,14 @@ const onTouchStart = (pointerId: number, clientX: number, clientY: number, entit
53
54
  return null
54
55
  }
55
56
 
56
- let touchStartRegistered = false
57
- export const registerTouchStartEvent = (): void => {
58
- if (touchStartRegistered) return
59
- touchStartRegistered = true
60
- _creatorUI.registerTouchStartEvent(onTouchStart)
61
- }
62
-
63
- let touchEndRegistered = false
64
- export const registerTouchEndEvent = (): void => {
65
- if (touchEndRegistered) return
66
- touchEndRegistered = true
67
- _creatorUI.registerTouchEndEvent(onTouchEnd)
57
+ // The scene-level pointer dispatch rides the tree emitter (TREE_EVENT_SCENE_TOUCH_START / SCENE_CLICK):
58
+ // installed once, on the first listener.
59
+ let registered = false
60
+ const register = (): void => {
61
+ if (registered) return
62
+ registered = true
63
+ ensureEmitter()
64
+ setSceneTouchHandlers(onTouchStart, onTouchEnd)
68
65
  }
66
+ export const registerTouchStartEvent = register
67
+ export const registerTouchEndEvent = register
package/src/host.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  // JS-runtime globals provided by the host engine (web viewer / desktop / iOS), NOT by the SDK.
2
- // Declared only so SDK and user code type-check — never bundled or injected. Mirrors
3
- // packages/projects/src/global.d.ts.
2
+ // Declared only so SDK and user code type-check — never bundled or injected.
4
3
 
5
4
  declare global {
6
5
  function setTimeout(handler: (...args: any[]) => void, timeout?: number): number
@@ -57,7 +56,7 @@ declare global {
57
56
  * `Style<typeof myButton>`) is what you'd pass to `el.style(...)` — for typing reusable style
58
57
  * presets. Deliberately no `Partial<>` wrapper: every style prop is already optional, and
59
58
  * Partial over ClassStyles' `$`-index signature adds `| undefined`, breaking assignability back
60
- * into `.style(...)`. Round-trip guarded by sdk/tests/ui-types.test.ts. */
59
+ * into `.style(...)`. Round-trip guarded by sdk/tests/ui/types.test.ts. */
61
60
  type Style<T> = T extends { style: (s: infer S) => any } ? S : never
62
61
  }
63
62
 
@@ -0,0 +1,7 @@
1
+ // The SECOND inject module of an editor bundle (a compile with `editor: true` — bundler.ts adds it
2
+ // after inject.ts): what a scene editor's in-world half may name and an app may not. A shipped
3
+ // bundle is compiled without it, so nothing here can reach one.
4
+ //
5
+ // Same rule as inject.ts: the only file that exports these names.
6
+
7
+ export { sceneEditor as __sceneEditor, type SceneEditorApi } from "./scene/editor"
package/src/inject.ts CHANGED
@@ -1,236 +1,233 @@
1
- // THE aggregation point. Every public global the SDK provides is re-exported here under the exact
2
- // name user code uses it as. The bundler passes this file to esbuild's `inject:` option, so user
3
- // code references `Scene`, `Sprite`, `toast`, … with no imports; esbuild tree-shakes away whatever
4
- // a given project does not use (so a pure-2D project drops all 3D classes, and vice versa).
5
- //
6
- // Rule: this is the ONLY file that `export`s public names. Everything else is internal and imported
7
- // by it. Host-provided globals (setLoop, console, setTimeout, DEG2RAD, asset, …) are NOT here —
8
- // they live in src/host.d.ts as declarations and stay as free references at runtime.
9
-
10
- // ---- math ----
11
- export { Mathf } from "./math/Mathf"
12
- export { Vec2, Vec3 } from "./math/vec"
13
- export { Quat } from "./math/quat"
14
- export { Mat4 } from "./math/mat4"
15
- export { Color } from "./core/color"
16
-
17
- // ---- aspects (attachable node capabilities) ----
18
- export { Aspect, System, type With, type SystemHost } from "./core/Aspect"
19
- export { type EventMap } from "./core/events"
20
- export { Time } from "./core/time"
21
- export { StateMachine, defineStates, type StateDef, type StatesDef, type StateGuard, type StateHandler, type StateMachineEvents } from "./core/StateMachine"
22
- export { InspectorUI } from "./core/InspectorUI"
23
-
24
- // ---- reactivity (signals; UI text/style props also accept `() => value` bindings) ----
25
- export { signal, computed, effect, type Signal, type Computed } from "./core/signals"
26
- export { __compWrite, __compOp, type CompAxis, type CompWriter } from "./core/compWrite"
27
-
28
- // ---- canvas (core 2D drawing that bakes to a texture; shared by 2D/3D/UI) ----
29
- export { Canvas, Bitmap } from "./canvas/Canvas"
30
-
31
- // ---- platform runtime (injected globals; the host provides the lower-level _creator* bridges) ----
32
- export { toast, openURL, SvgSource } from "./runtime/misc"
33
- export { app, type AppState, type OrientationLock } from "./runtime/app"
34
- export { clipboard } from "./runtime/clipboard"
35
- export { date, type DateValue, type DateInput, type Unit, type Locale } from "./runtime/datetime"
36
- export { fetch, fetchLocal, FormData, File, type FetchResponse } from "./runtime/fetch"
37
- export { localStorage } from "./runtime/storage"
38
- export { device, type HapticStyle, type MotionOptions } from "./runtime/device"
39
- export { Input, InputChannel, type InputKeyEvent, type InputGamepadEvent, type InputEventName, type GamepadState, type GamepadAxisName } from "./runtime/input"
40
- export { WebSocket } from "./runtime/net"
41
- // Multiplayer (docs/multiplayer-plan.md): roles, players, JSON messages over the _creatorNet transport.
42
- export { Net, NetPlayer, Replicated, NetEntity, type NetMessage, type NetRole, type NetStatus, type NetEvents, type NetLaunch, type NetInput, type NetKind, type NetTransform } from "./net"
43
- // App-backend transport: the compiler-generated stubs of `*.server.ts` modules call these; user code
44
- // only ever imports its server functions (docs/backend-plan.md §4).
45
- export { __rpc, __channel, __serverOnly, RpcError, type ClientChannel } from "./runtime/rpc"
46
- export { AudioPlayer, VideoPlayer } from "./runtime/media"
47
- // Game audio (docs/audio-plan.md): decoded clips, a voice pool, buses with effects; 3D through the
48
- // AudioSource / AudioZone aspects (gl/) and scene.audio.
49
- export { Sound, type SoundOptions } from "./audio/Sound"
50
- export { Voice, type VoiceEvents } from "./audio/Voice"
51
- export { Bus, REVERB_PRESETS, type ReverbPreset, type ReverbParams, type EchoParams } from "./audio/Bus"
52
- export { audio, type PlaySoundOptions, type SpatialOptions, type Rolloff, type AudioStats } from "./audio/audio"
53
- export { openFilePicker, files, type FileData } from "./runtime/files"
54
- export { share } from "./runtime/share"
55
- export { ClickEvent, TouchStartEvent, LongPressEvent } from "./runtime/touch"
56
-
57
- // ---- 2D engine (creator-2d) ----
58
- export { Scene2D } from "./g2/Scene2D"
59
- export { Node2D } from "./g2/Node2D"
60
- export { Camera2D } from "./g2/Camera2D"
61
- export { Sprite } from "./g2/Sprite"
62
- export { SpriteAnimation } from "./g2/SpriteAnimation"
63
- export { Shape2D } from "./g2/Shape2D"
64
- export { Physics2D } from "./g2/Physics2D"
65
- export { Trigger2D } from "./g2/Trigger2D"
66
- export { CharacterController2D } from "./g2/CharacterController2D"
67
- export { OneWay2D } from "./g2/OneWay2D"
68
- export { PhysicsGroup2D } from "./g2/groups2d"
69
- export { Tilemap } from "./g2/Tilemap"
70
- export { Texture2D } from "./g2/Texture2D"
71
- // sprite sheets as data (.sprite.ts files — see src/g2/SpriteSheet.ts)
72
- export { SpriteSheet, defineSpriteSheet } from "./g2/SpriteSheet"
73
- export type { SpriteSheetDef, SheetSprite, SpriteMakeOptions } from "./g2/SpriteSheet"
74
- // tilesets as data (.tiles.ts files — autotile materials, see src/g2/Tileset.ts + autotile.ts)
75
- export { Tileset, defineTileset, Autotile2D } from "./g2/Tileset"
76
- export { rawCell, isRawCell, rawIndex } from "./g2/autotile"
77
- export { rot90, rot180, rot270, flipX, packTile, tileIndex, tileTurns, tileFlip, tileOriented } from "./g2/autotile"
78
- export type {
79
- TilesetDef, TileMaterial, PatchMaterial, PathMaterial, PatchSlots, EdgeSlot, FillBlock, BlockEntry,
80
- TileBlock, TilePart,
81
- } from "./g2/autotile"
82
- // 2D scenes as data (.scene2d.ts files — see src/g2/defineScene2d.ts) + the cells('…') payload
83
- export { defineScene2d, Scene2dHandle } from "./g2/defineScene2d"
84
- export type { Scene2dDef, Scene2dNodeDef, Scene2dEnv, SpriteSourceDef, TilemapSourceDef, Camera2dNodeDef, LoadedScene2d } from "./g2/defineScene2d"
85
- export { cells, encodeCells, type CellsData } from "./g2/cells"
86
- // no-code 2D scenario aspects (attachable in scene files — see src/g2/scenarios2d.ts)
87
- export { CameraFollow } from "./g2/scenarios2d"
88
-
89
- // ---- UI (creator-ui) ----
90
- export {
91
- UIScreen, type UIScreenStyle,
92
- UIRow, UIColumn, UIBox, type UIContainerStyle,
93
- UIText, type UITextStyle,
94
- UIButton, type UIButtonStyle,
95
- UIImage, type UIImageStyle,
96
- UIVideo, type UIVideoStyle,
97
- UIInput, UITextArea, type UIInputStyle,
98
- UIScrollable, type UIScrollableStyle,
99
- UIPager, type UIPagerStyle,
100
- UITabs, type UITabDef,
101
- defineTabs, type TabDef, type TabsHandle,
102
- UIWidget, type UIWidgetStyle,
103
- UIModal, type UIModalStyle,
104
- UIBottomSheet, type UIBottomSheetStyle,
105
- UIPopover, type UIPopoverStyle,
106
- UISpacer, type UISpacerStyle,
107
- UIVirtualizedList,
108
- Router,
109
- NativeView, type UINativeViewStyle,
110
- registerFont,
111
- __uiMap,
112
- __UIColumn, __UIRow, __UIBox, __UIButton, __UIScreen, __UIScrollable, __UIWidget,
113
- } from "./ui/UI"
114
- // The Presentable navigation contract (docs/navigation-presentable-plan.md). `Presentable` is
115
- // interface + runtime companion (declaration merging): `Presentable.current` = what's on screen.
116
- export { Presentable } from "./ui/UI"
117
- export type { PresentOptions, Transition, TransitionName, TransitionSpec, TransitionTransform } from "./ui/UI"
118
- // The base node type + the union a container accepts as children — documented as the signature of
119
- // UIColumn/UIRow/append/etc., so they must be global (type-only; erased at runtime).
120
- export type { UINode, UINodeChild } from "./ui/UINode"
121
- // App theme variables (docs/ui-theme-plan.md): theme({...}) merges + returns typed var()
122
- // accessors; system vars are static props (theme.primaryColor, theme["comfort-top"], …).
123
- export { theme, type ThemeValues, type ThemeAccessors } from "./ui/theme"
124
-
125
- // ---- animate ----
126
- // animate() runs on the keyframe core (a VALUE track) since 2026-09-14: same handle, easing and clocks
127
- // as animateTo; stop / pause / resume are the handle's methods, a matrix is just a value kind.
128
- export { animate, type AnimateOptions, type AnimateValue, type AnimateOut } from "./animate/tween/animateValue"
129
- export { cubicBezier } from "./animate/bezier"
130
- // Keyframe animation core (docs/timeline-plan.md): the handle `animateTo` / `animateFrom` return,
131
- // and `Timeline()` — choreography over UI elements, 3D / 2D nodes, lights and cameras.
132
- export { Timeline, type TimelineOptions, type TimelineAddOptions, type TimelinePosition } from "./animate/tween/Timeline"
133
- export { type Animation } from "./animate/tween/Animation"
134
- export { type TweenMeta } from "./animate/tween/spec"
135
- export { type EasingInput } from "./animate/tween/easing"
136
- export { easeIn, easeOut, easeInOut } from "./animate/easings"
137
-
138
- // ---- plugins (optional, host-provided capabilities — typed NativeView/service wrappers, see src/plugins/) ----
139
- export { QRScanner } from "./plugins/qr"
140
- export { CameraView, type CameraFacing } from "./plugins/camera"
141
- export { Geolocation, type GeoPosition, type GeoOptions, type GeoWatch } from "./plugins/geolocation"
142
- export {
143
- MapView, type MapOptions, type MapStyle, type MapStyleName, type MapCamera, type MapTap, type LngLat, type CameraMove, type FitOptions,
144
- type MapPaddingValues, type MarkerItem, type MarkerTap, type MarkerLayer, type MarkerLayerOptions,
145
- type LineLayer, type LineLayerOptions, type UserLocationOptions,
146
- } from "./plugins/map"
147
- export { Push, type PushPayload, type PushStatus, type PushRegisterOptions, type PushEvent } from "./plugins/push"
148
- export { OAuth, type OAuthCredential, type OAuthProviderName } from "./plugins/oauth"
149
- export { Service } from "./plugins/service"
150
-
151
- // ---- scenes as data (.scene.ts files — see src/scene/defineScene.ts) ----
152
- export { defineScene, use, ref, make, SceneHandle, applyEditorPose as __applyEditorPose } from "./scene/defineScene"
153
- export {
154
- defineMaterial, MaterialHandle,
155
- // editor-harness helpers (the scene editor's live material paths — not app API)
156
- assignMaterialDef as __assignMaterialDef, applyMaterialParam as __applyMaterialParam,
157
- } from "./scene/material"
158
- export type { MaterialData, MaterialParamValue, ShaderMaterialDef, LitMaterialDef, UnlitMaterialDef } from "./scene/material"
159
- export type { SceneDef, SceneNodeDef, MeshDef, LightDef, MaterialDef, CameraNodeDef, AspectEntry, MakeEntry, LoadedScene, SceneInstance } from "./scene/defineScene"
160
- export { CameraPlace } from "./gl/CameraPlace"
161
- // Procedural placement for large maps (line/grid/ring/scatter/place) — built for make() factories.
162
- export { Level } from "./scene/level"
163
- export type { LevelSpot, LevelBuild, LevelCollider, LevelLineOptions, LevelGridOptions, LevelRingOptions, LevelScatterOptions, LevelPlaceOptions } from "./scene/level"
164
- export type { FieldMeta } from "./core/fields"
165
- // Editor-only line drawing from generator rebuild() / make() factories / tool hooks — drawn by the
166
- // scene editor's viewport overlay, a no-op everywhere else (see src/scene/gizmos.ts).
167
- export { Gizmos, GizmoBuffer as __GizmoBuffer, withGizmoScope as __withGizmoScope } from "./scene/gizmos"
168
- export type { GizmoStyle, GizmoAnchor } from "./scene/gizmos"
169
-
170
- // ---- no-code scenario aspects (attachable in the scene editor — see src/gl/scenarios.ts) ----
171
- export { MoveTo, FollowPath, Spin, LookAt, PlayAnimation } from "./gl/scenarios"
172
-
173
- // ---- editor plugins (called from `*.editor.ts` files — editor bundles only; DCE'd from apps) ----
174
- export { registerEditorWindow, registerEditorTool, __editorPlugins } from "./scene/editorPlugins"
175
- export type { EditorApi, EditorRayHit, EditorToolHooks, EditorWindowFn } from "./scene/editorPlugins"
176
-
177
- // ---- 3D engine (creator-gl) ----
178
- export { Scene, ARScene, VRScene } from "./gl/Scene"
179
- export { Node } from "./gl/Node"
180
- export { Mesh } from "./gl/Mesh"
181
- export { Model } from "./gl/Model"
182
- export { Shape } from "./gl/physics/Shape"
183
- export { Physics } from "./gl/physics/Physics"
184
- export { Trigger } from "./gl/physics/Trigger"
185
- export { AudioSource, type AudioCone } from "./gl/audio/AudioSource"
186
- export { AudioZone } from "./gl/audio/AudioZone"
187
- export { SceneAudio } from "./gl/audio/SceneAudio"
188
- export { CharacterController } from "./gl/physics/CharacterController"
189
- export { Vehicle } from "./gl/vehicle/Vehicle"
190
- export type { DriveLayout, DifferentialMode, EngineConfig, SteeringConfig, SteeringFeedback, SteeringDriver, AeroConfig } from "./gl/vehicle/Vehicle"
191
- export { Wheel, Tire, resolveTire } from "./gl/vehicle/Wheel"
192
- export { Ragdoll } from "./gl/physics/Ragdoll"
193
- export type { RagdollPart, RagdollHinge, RagdollFacing, RagdollActivateOptions, RagdollDeactivateOptions, RagdollHitOptions } from "./gl/physics/Ragdoll"
194
- export type { Point, WheelSuspension } from "./gl/vehicle/Wheel"
195
- export { AnimationClip } from "./gl/animation/AnimationClip"
196
- export type { ClipDef, ClipTrackDef, ClipKey } from "./gl/animation/AnimationClip"
197
- export { Animator } from "./gl/animation/Animator"
198
- export type { LodMode } from "./gl/animation/Animator"
199
- export type { TrianglePick } from "./gl/Model"
200
- export { Feet } from "./gl/animation/Feet"
201
- export type { FeetOptions, FootState } from "./gl/animation/Feet"
202
- export { Warp } from "./gl/animation/Warp"
203
- export type { WarpOptions, StepWarpOptions } from "./gl/animation/Warp"
204
- export { Playback } from "./gl/animation/Playback"
205
- export { Loop } from "./gl/animation/Loop"
206
- export { Layer } from "./gl/animation/Layer"
207
- export type { PlayOptions, StopOptions, LayerOptions, LoopOptions, LoopDef, BlendPosition, BlendMember, ActiveClip, ClipInfo, ClipCycle, ClipAlign, KneeAxisReport, StepHandler, ClipEventHandler } from "./gl/animation/core"
208
- export { IK } from "./gl/animation/IK"
209
- export { DynamicBone, DynamicBoneCollider } from "./gl/animation/DynamicBone"
210
- export type { DynamicBoneCurve, DynamicBoneFloor, DynamicBoneColliders } from "./gl/animation/DynamicBone"
211
- export type { IKTwoBone, IKLookAt } from "./gl/animation/IK"
212
- export { Light } from "./gl/Light"
213
- export { Lightmap } from "./gl/Lightmap"
214
- export { Foliage } from "./gl/Foliage"
215
- export type { FoliageOptions, FoliageWind } from "./gl/Foliage"
216
- export { Terrain } from "./gl/terrain/Terrain"
217
- export type { TerrainOptions, TerrainLayer, TerrainRegion, ConformOptions, RibbonOptions, AutoPaintRules, SculptOptions, TerrainHit, TerrainSnapshot } from "./gl/terrain/Terrain"
218
- export { NavMesh, NavCrowd } from "./gl/nav/NavMesh"
219
- export type { NavMeshLoadOptions, NavMeshInfo, NavPath, NavQueryOptions, NavRaycastHit, NavAgentSize } from "./gl/nav/NavMesh"
220
- export { NavAgent } from "./gl/nav/NavAgent"
221
- export type { NavAgentState, NavAgentAvoidance, NavAgentDrive, NavAgentEvents } from "./gl/nav/NavAgent"
222
- export { Locomotion } from "./gl/animation/Locomotion"
223
- export type { LocomotionSet, LocomotionClip, LocomotionTuning, LocomotionState, LocomotionEvents, Displacement, Gait } from "./gl/animation/Locomotion"
224
- export { Material } from "./gl/Material"
225
- export { Geometry } from "./gl/Geometry"
226
- export { InstancedMesh } from "./gl/InstancedMesh"
227
- export type { InstanceTransform } from "./gl/InstancedMesh"
228
- export { Texture } from "./gl/Texture"
229
- export type { TextureLoadOptions } from "./gl/Texture"
230
- export { Camera } from "./gl/Camera"
231
- export { Ray } from "./gl/Ray"
232
- export { Plane } from "./gl/Plane"
233
- export { Noise } from "./gl/Noise"
234
- export { Particles, Trail, curve, colorCurve } from "./gl/Particles"
235
- export { DecalSet, DecalTrail } from "./gl/DecalSet"
236
- export type { DecalOptions, DecalSetOptions, DecalSpawnOptions, DecalPlacement, DecalTrailOptions } from "./gl/DecalSet"
1
+ // THE aggregation point. Every public global the SDK provides is re-exported here under the exact
2
+ // name user code uses it as. The bundler passes this file to esbuild's `inject:` option, so user
3
+ // code references `Scene`, `Sprite`, `toast`, … with no imports; esbuild tree-shakes away whatever
4
+ // a given project does not use (so a pure-2D project drops all 3D classes, and vice versa).
5
+ //
6
+ // Rule: this is the ONLY file that `export`s public names. Everything else is internal and imported
7
+ // by it. Host-provided globals (setLoop, console, setTimeout, DEG2RAD, asset, …) are NOT here —
8
+ // they live in src/host.d.ts as declarations and stay as free references at runtime.
9
+
10
+ // ---- math ----
11
+ export { Mathf } from "./math/Mathf"
12
+ export { Vec2, Vec3 } from "./math/vec"
13
+ export { Quat } from "./math/quat"
14
+ export { Mat4 } from "./math/mat4"
15
+ export { Color } from "./core/color"
16
+
17
+ // ---- aspects (attachable node capabilities) ----
18
+ export { Aspect, System, type With, type SystemHost } from "./core/Aspect"
19
+ export { type EventMap } from "./core/events"
20
+ export { Time } from "./core/time"
21
+ export { StateMachine, defineStates, type StateDef, type StatesDef, type StateGuard, type StateHandler, type StateMachineEvents } from "./core/StateMachine"
22
+ export { InspectorUI } from "./core/InspectorUI"
23
+
24
+ // ---- reactivity (signals; UI text/style props also accept `() => value` bindings) ----
25
+ export { signal, computed, effect, type Signal, type Computed } from "./core/signals"
26
+ export { __compWrite, __compOp, type CompAxis, type CompWriter } from "./core/compWrite"
27
+
28
+ // ---- canvas (core 2D drawing that bakes to a texture; shared by 2D/3D/UI) ----
29
+ export { Canvas, Bitmap } from "./canvas/Canvas"
30
+
31
+ // ---- platform runtime (injected globals; the host provides the lower-level _creator* bridges) ----
32
+ export { toast, openURL, SvgSource } from "./runtime/misc"
33
+ export { app, type AppState, type OrientationLock } from "./runtime/app"
34
+ export { clipboard } from "./runtime/clipboard"
35
+ export { date, type DateValue, type DateInput, type Unit, type Locale } from "./runtime/datetime"
36
+ export { fetch, fetchLocal, FormData, File, type FetchResponse } from "./runtime/fetch"
37
+ export { localStorage } from "./runtime/storage"
38
+ export { device, type HapticStyle, type MotionOptions } from "./runtime/device"
39
+ export { Input, InputChannel, type InputKeyEvent, type InputGamepadEvent, type InputEventName, type GamepadState, type GamepadAxisName } from "./runtime/input"
40
+ export { WebSocket } from "./runtime/net"
41
+ // Multiplayer (docs/multiplayer-plan.md): roles, players, JSON messages over the _creatorNet transport.
42
+ export { Net, NetPlayer, Replicated, NetEntity, type NetMessage, type NetRole, type NetStatus, type NetEvents, type NetLaunch, type NetInput, type NetKind, type NetTransform } from "./net"
43
+ // App-backend transport: the compiler-generated stubs of `*.server.ts` modules call these; user code
44
+ // only ever imports its server functions (docs/backend-plan.md §4).
45
+ export { __rpc, __channel, __serverOnly, RpcError, type ClientChannel } from "./runtime/rpc"
46
+ export { AudioPlayer, VideoPlayer } from "./runtime/media"
47
+ // Game audio (docs/audio-plan.md): decoded clips, a voice pool, buses with effects; 3D through the
48
+ // AudioSource / AudioZone aspects (gl/) and scene.audio.
49
+ export { Sound, type SoundOptions } from "./audio/Sound"
50
+ export { Voice, type VoiceEvents } from "./audio/Voice"
51
+ export { Bus, REVERB_PRESETS, type ReverbPreset, type ReverbParams, type EchoParams } from "./audio/Bus"
52
+ export { audio, type PlaySoundOptions, type SpatialOptions, type Rolloff, type AudioStats } from "./audio/audio"
53
+ export { openFilePicker, files, type FileData } from "./runtime/files"
54
+ export { share } from "./runtime/share"
55
+ export { ClickEvent, TouchStartEvent, LongPressEvent, MouseEnterEvent } from "./runtime/touch"
56
+
57
+ // ---- 2D engine (creator-2d) ----
58
+ export { Scene2D } from "./g2/Scene2D"
59
+ export { Node2D } from "./g2/Node2D"
60
+ export { Camera2D } from "./g2/Camera2D"
61
+ export { Sprite } from "./g2/Sprite"
62
+ export { SpriteAnimation } from "./g2/SpriteAnimation"
63
+ export { Shape2D } from "./g2/Shape2D"
64
+ export { Physics2D } from "./g2/Physics2D"
65
+ export { Trigger2D } from "./g2/Trigger2D"
66
+ export { CharacterController2D } from "./g2/CharacterController2D"
67
+ export { OneWay2D } from "./g2/OneWay2D"
68
+ export { PhysicsGroup2D } from "./g2/groups2d"
69
+ export { Tilemap } from "./g2/Tilemap"
70
+ export { Texture2D } from "./g2/Texture2D"
71
+ // sprite sheets as data (.sprite.ts files — see src/g2/SpriteSheet.ts)
72
+ export { SpriteSheet, defineSpriteSheet } from "./g2/SpriteSheet"
73
+ export type { SpriteSheetDef, SheetSprite, SpriteMakeOptions } from "./g2/SpriteSheet"
74
+ // tilesets as data (.tiles.ts files — autotile materials, see src/g2/Tileset.ts + autotile.ts)
75
+ export { Tileset, defineTileset, Autotile2D } from "./g2/Tileset"
76
+ export { rawCell, isRawCell, rawIndex } from "./g2/autotile"
77
+ export { rot90, rot180, rot270, flipX, packTile, tileIndex, tileTurns, tileFlip, tileOriented } from "./g2/autotile"
78
+ export type {
79
+ TilesetDef, TileMaterial, PatchMaterial, PathMaterial, PatchSlots, EdgeSlot, FillBlock, BlockEntry,
80
+ TileBlock, TilePart,
81
+ } from "./g2/autotile"
82
+ // 2D scenes as data (.scene2d.ts files — see src/g2/defineScene2d.ts) + the cells('…') payload
83
+ export { defineScene2d, Scene2dHandle } from "./g2/defineScene2d"
84
+ export type { Scene2dDef, Scene2dNodeDef, Scene2dEnv, SpriteSourceDef, TilemapSourceDef, Camera2dNodeDef, LoadedScene2d } from "./g2/defineScene2d"
85
+ export { cells, encodeCells, type CellsData } from "./g2/cells"
86
+ // no-code 2D scenario aspects (attachable in scene files — see src/g2/scenarios2d.ts)
87
+ export { CameraFollow } from "./g2/scenarios2d"
88
+
89
+ // ---- UI (creator-ui) ----
90
+ export {
91
+ UIScreen, type UIScreenStyle,
92
+ UIRow, UIColumn, UIBox, type UIContainerStyle,
93
+ UIText, type UITextStyle,
94
+ UIButton, type UIButtonStyle,
95
+ UIImage, type UIImageStyle,
96
+ UIVideo, type UIVideoStyle,
97
+ UIInput, UITextArea, type UIInputStyle,
98
+ UIScrollable, type UIScrollableStyle,
99
+ UIPager, type UIPagerStyle,
100
+ UITabs, type UITabDef,
101
+ defineTabs, type TabDef, type TabsHandle,
102
+ UIWidget, type UIWidgetStyle,
103
+ UIModal, type UIModalStyle,
104
+ UIBottomSheet, type UIBottomSheetStyle,
105
+ UIPopover, type UIPopoverStyle,
106
+ UISpacer, type UISpacerStyle,
107
+ UIVirtualizedList,
108
+ Router,
109
+ NativeView, type UINativeViewStyle,
110
+ registerFont,
111
+ __uiMap,
112
+ __UIColumn, __UIRow, __UIBox, __UIButton, __UIScreen, __UIScrollable, __UIWidget,
113
+ } from "./ui/UI"
114
+ // The Presentable navigation contract (docs/navigation-presentable-plan.md). `Presentable` is
115
+ // interface + runtime companion (declaration merging): `Presentable.current` = what's on screen.
116
+ export { Presentable } from "./ui/UI"
117
+ export type { DismissOptions, PresentOptions, Transition, TransitionName, TransitionPose, TransitionSpec } from "./ui/UI"
118
+ // The base node type + the union a container accepts as children — documented as the signature of
119
+ // UIColumn/UIRow/append/etc., so they must be global (type-only; erased at runtime).
120
+ export type { UINode, UINodeChild } from "./ui/UINode"
121
+ // App theme variables (docs/ui-theme-plan.md): theme({...}) merges + returns typed var()
122
+ // accessors; system vars are static props (theme.primaryColor, theme["comfort-top"], …).
123
+ export { theme, type ThemeValues, type ThemeAccessors } from "./ui/theme"
124
+
125
+ // ---- animate ----
126
+ // animate() runs on the keyframe core (a VALUE track) since 2026-09-14: same handle, easing and clocks
127
+ // as animateTo; stop / pause / resume are the handle's methods, a matrix is just a value kind.
128
+ export { animate, type AnimateOptions, type AnimateValue, type AnimateOut } from "./animate/tween/animateValue"
129
+ export { cubicBezier } from "./animate/bezier"
130
+ // Keyframe animation core (docs/timeline-plan.md): the handle `animateTo` / `animateFrom` return,
131
+ // and `Timeline()` — choreography over UI elements, 3D / 2D nodes, lights and cameras.
132
+ export { Timeline, type TimelineOptions, type TimelineAddOptions, type TimelinePosition } from "./animate/tween/Timeline"
133
+ export { type Animation } from "./animate/tween/Animation"
134
+ export { type TweenMeta } from "./animate/tween/spec"
135
+ export { type EasingInput } from "./animate/tween/easing"
136
+ export { easeIn, easeOut, easeInOut } from "./animate/easings"
137
+
138
+ // ---- plugins (optional, host-provided capabilities — typed NativeView/service wrappers). The first-party
139
+ // ones are VENDORED from the plugin repo (src/plugins/gen, `bun run vendor:plugins`); oauth / service are the SDK's. ----
140
+ export { QRScanner } from "./plugins/gen/qr-scanner/sdk/qr-scanner"
141
+ export { CameraView, type CameraFacing } from "./plugins/gen/camera/sdk/camera"
142
+ export { Geolocation, type GeoPosition, type GeoOptions, type GeoWatch } from "./plugins/gen/geolocation/sdk/geolocation"
143
+ export {
144
+ MapView, type MapOptions, type MapStyle, type MapStyleName, type MapCamera, type MapTap, type LngLat, type CameraMove, type FitOptions,
145
+ type MapPaddingValues, type MarkerItem, type MarkerTap, type MarkerLayer, type MarkerLayerOptions,
146
+ type LineLayer, type LineLayerOptions, type UserLocationOptions,
147
+ } from "./plugins/gen/map/sdk/map"
148
+ export { Push, type PushPayload, type PushStatus, type PushRegisterOptions, type PushEvent } from "./plugins/gen/push/sdk/push"
149
+ export { OAuth, type OAuthCredential, type OAuthProviderName } from "./plugins/oauth"
150
+ export { Service } from "./plugins/service"
151
+
152
+ // ---- scenes as data (.scene.ts files — see src/scene/defineScene.ts) ----
153
+ export { defineScene, use, ref, make, SceneHandle } from "./scene/defineScene"
154
+ export { defineMaterial, MaterialHandle } from "./scene/material"
155
+ export type { MaterialData, MaterialParamValue, ShaderMaterialDef, LitMaterialDef, UnlitMaterialDef } from "./scene/material"
156
+ export type { SceneDef, SceneNodeDef, MeshDef, LightDef, MaterialDef, CameraNodeDef, AspectEntry, MakeEntry, LoadedScene, SceneInstance } from "./scene/defineScene"
157
+ export { CameraPlace } from "./gl/CameraPlace"
158
+ // Procedural placement for large maps (line/grid/ring/scatter/place) — built for make() factories.
159
+ export { Level } from "./scene/level"
160
+ export type { LevelSpot, LevelBuild, LevelCollider, LevelLineOptions, LevelGridOptions, LevelRingOptions, LevelScatterOptions, LevelPlaceOptions } from "./scene/level"
161
+ export type { FieldMeta } from "./core/fields"
162
+ // Editor-only line drawing from generator rebuild() / make() factories / tool hooks — drawn by the
163
+ // scene editor's viewport overlay, a no-op everywhere else (see src/scene/gizmos.ts).
164
+ export { Gizmos } from "./scene/gizmos"
165
+ export type { GizmoStyle, GizmoAnchor } from "./scene/gizmos"
166
+
167
+ // ---- no-code scenario aspects (attachable in the scene editor — see src/gl/scenarios.ts) ----
168
+ export { MoveTo, FollowPath, Spin, LookAt, PlayAnimation } from "./gl/scenarios"
169
+
170
+ // ---- editor plugins (called from `*.editor.ts` files — editor bundles only; DCE'd from apps) ----
171
+ export { registerEditorWindow, registerEditorTool } from "./scene/editorPlugins"
172
+ export type { EditorApi, EditorRayHit, EditorToolHooks, EditorWindowFn } from "./scene/editorPlugins"
173
+
174
+ // ---- 3D engine (creator-gl) ----
175
+ export { Scene, ARScene, VRScene } from "./gl/Scene"
176
+ export { Node } from "./gl/Node"
177
+ export { Mesh } from "./gl/Mesh"
178
+ export { Model } from "./gl/Model"
179
+ export { Shape } from "./gl/physics/Shape"
180
+ export { Physics } from "./gl/physics/Physics"
181
+ export { Trigger } from "./gl/physics/Trigger"
182
+ export { AudioSource, type AudioCone } from "./gl/audio/AudioSource"
183
+ export { AudioZone } from "./gl/audio/AudioZone"
184
+ export { SceneAudio } from "./gl/audio/SceneAudio"
185
+ export { CharacterController } from "./gl/physics/CharacterController"
186
+ export { Vehicle } from "./gl/vehicle/Vehicle"
187
+ export type { DriveLayout, DifferentialMode, EngineConfig, SteeringConfig, SteeringFeedback, SteeringDriver, AeroConfig } from "./gl/vehicle/Vehicle"
188
+ export { Wheel, Tire, resolveTire } from "./gl/vehicle/Wheel"
189
+ export { Ragdoll } from "./gl/physics/Ragdoll"
190
+ export type { RagdollPart, RagdollHinge, RagdollFacing, RagdollActivateOptions, RagdollDeactivateOptions, RagdollHitOptions } from "./gl/physics/Ragdoll"
191
+ export type { Point, WheelSuspension } from "./gl/vehicle/Wheel"
192
+ export { AnimationClip } from "./gl/animation/AnimationClip"
193
+ export type { ClipDef, ClipTrackDef, ClipKey } from "./gl/animation/AnimationClip"
194
+ export { Animator } from "./gl/animation/Animator"
195
+ export type { LodMode } from "./gl/animation/Animator"
196
+ export type { TrianglePick } from "./gl/Model"
197
+ export { Feet } from "./gl/animation/Feet"
198
+ export type { FeetOptions, FootState } from "./gl/animation/Feet"
199
+ export { Warp } from "./gl/animation/Warp"
200
+ export type { WarpOptions, StepWarpOptions } from "./gl/animation/Warp"
201
+ export { Playback } from "./gl/animation/Playback"
202
+ export { Loop } from "./gl/animation/Loop"
203
+ export { Layer } from "./gl/animation/Layer"
204
+ export type { PlayOptions, StopOptions, LayerOptions, LoopOptions, LoopDef, BlendPosition, BlendMember, ActiveClip, ClipInfo, ClipCycle, ClipAlign, KneeAxisReport, StepHandler, ClipEventHandler } from "./gl/animation/core"
205
+ export { IK } from "./gl/animation/IK"
206
+ export { DynamicBone, DynamicBoneCollider } from "./gl/animation/DynamicBone"
207
+ export type { DynamicBoneCurve, DynamicBoneFloor, DynamicBoneColliders } from "./gl/animation/DynamicBone"
208
+ export type { IKTwoBone, IKLookAt } from "./gl/animation/IK"
209
+ export { Light } from "./gl/Light"
210
+ export { Lightmap } from "./gl/Lightmap"
211
+ export { Foliage } from "./gl/Foliage"
212
+ export type { FoliageOptions, FoliageWind } from "./gl/Foliage"
213
+ export { Terrain } from "./gl/terrain/Terrain"
214
+ export type { TerrainOptions, TerrainLayer, TerrainRegion, ConformOptions, RibbonOptions, AutoPaintRules, SculptOptions, TerrainHit, TerrainSnapshot } from "./gl/terrain/Terrain"
215
+ export { NavMesh, NavCrowd } from "./gl/nav/NavMesh"
216
+ export type { NavMeshLoadOptions, NavMeshInfo, NavPath, NavQueryOptions, NavRaycastHit, NavAgentSize } from "./gl/nav/NavMesh"
217
+ export { NavAgent } from "./gl/nav/NavAgent"
218
+ export type { NavAgentState, NavAgentAvoidance, NavAgentDrive, NavAgentEvents } from "./gl/nav/NavAgent"
219
+ export { Locomotion } from "./gl/animation/Locomotion"
220
+ export type { LocomotionSet, LocomotionClip, LocomotionTuning, LocomotionState, LocomotionEvents, Displacement, Gait } from "./gl/animation/Locomotion"
221
+ export { Material } from "./gl/Material"
222
+ export { Geometry } from "./gl/Geometry"
223
+ export { InstancedMesh } from "./gl/InstancedMesh"
224
+ export type { InstanceTransform } from "./gl/InstancedMesh"
225
+ export { Texture } from "./gl/Texture"
226
+ export type { TextureLoadOptions } from "./gl/Texture"
227
+ export { Camera } from "./gl/Camera"
228
+ export { Ray } from "./gl/Ray"
229
+ export { Plane } from "./gl/Plane"
230
+ export { Noise } from "./gl/Noise"
231
+ export { Particles, Trail, curve, colorCurve } from "./gl/Particles"
232
+ export { DecalSet, DecalTrail } from "./gl/DecalSet"
233
+ export type { DecalOptions, DecalSetOptions, DecalSpawnOptions, DecalPlacement, DecalTrailOptions } from "./gl/DecalSet"
package/src/net/core.ts CHANGED
@@ -43,6 +43,8 @@ export type NetEvents = {
43
43
  }
44
44
 
45
45
  export type NetLaunch = { role: "server" | "client"; address: string; port: number; maxClients: number }
46
+ /** Link statistics (`player.rtt` / `player.loss` read them): the bridge's `NetStats`. */
47
+ export type NetStats = { rtt: number; loss: number; sentKbps: number; receivedKbps: number }
46
48
 
47
49
  export const CH_RELIABLE = 0
48
50
  export const CH_UNRELIABLE = 1
@@ -80,8 +82,8 @@ export class NetPlayer {
80
82
 
81
83
  get isMe(): boolean { return state.me === this }
82
84
  /** Round trip to this player in ms (server side) or to the server (our own player on a client). */
83
- get rtt(): number { return infoOf(this)[1] }
84
- get loss(): number { return infoOf(this)[2] }
85
+ get rtt(): number { return infoOf(this)?.rtt ?? 0 }
86
+ get loss(): number { return infoOf(this)?.loss ?? 0 }
85
87
 
86
88
  /** Server → this player. */
87
89
  send<T>(msg: NetMessage<T>, data: T): void {
@@ -162,10 +164,9 @@ export const emit = (event: keyof NetEvents, ...args: any[]): void => {
162
164
  for (const fn of list.slice()) fn(...args)
163
165
  }
164
166
 
165
- const EMPTY_INFO = new Float32Array(5)
166
- const infoOf = (p: NetPlayer): Float32Array => {
167
+ const infoOf = (p: NetPlayer): NetStats | null => {
167
168
  const b = bridge()
168
- if (!b || p._slot === LOCAL_SLOT && state.role !== "client") return EMPTY_INFO
169
+ if (!b || p._slot === LOCAL_SLOT && state.role !== "client") return null
169
170
  return b.clientInfo(p._slot)
170
171
  }
171
172
 
package/src/net/index.ts CHANGED
@@ -30,7 +30,7 @@ class NetImpl {
30
30
  get players(): readonly NetPlayer[] { if (state.role !== "server") ensureMe(); return state.players }
31
31
  player(id: number): NetPlayer | undefined { return state.players.find((p) => p.id === id) }
32
32
  /** Our round trip to the server (client), 0 otherwise. */
33
- get rtt(): number { return state.role === "client" ? (bridge()?.clientInfo(0)[1] ?? 0) : 0 }
33
+ get rtt(): number { return state.role === "client" ? (bridge()?.clientInfo(0)?.rtt ?? 0) : 0 }
34
34
  /** The simulation tick — one per fixed step (`updateFixed`). The server's is THE tick; a client
35
35
  * runs a few ticks ahead so its inputs arrive in time. */
36
36
  get tick(): number { return currentTick() }