lecodes-sdk 0.19.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 (367) hide show
  1. package/README.md +114 -0
  2. package/dist/global.d.ts +503 -0
  3. package/dist/host.d.ts +61 -0
  4. package/dist/inject.js +4730 -0
  5. package/dist/types/animate/animate.d.ts +20 -0
  6. package/dist/types/animate/bezier.d.ts +2 -0
  7. package/dist/types/animate/easings.d.ts +21 -0
  8. package/dist/types/canvas/Canvas.d.ts +168 -0
  9. package/dist/types/core/Aspect.d.ts +171 -0
  10. package/dist/types/core/InspectorUI.d.ts +88 -0
  11. package/dist/types/core/StateMachine.d.ts +81 -0
  12. package/dist/types/core/color.d.ts +13 -0
  13. package/dist/types/core/compWrite.d.ts +11 -0
  14. package/dist/types/core/events.d.ts +11 -0
  15. package/dist/types/core/fields.d.ts +58 -0
  16. package/dist/types/core/registry.d.ts +7 -0
  17. package/dist/types/core/signals.d.ts +29 -0
  18. package/dist/types/core/time.d.ts +31 -0
  19. package/dist/types/g2/Camera2D.d.ts +19 -0
  20. package/dist/types/g2/CharacterController2D.d.ts +134 -0
  21. package/dist/types/g2/Node2D.d.ts +91 -0
  22. package/dist/types/g2/OneWay2D.d.ts +24 -0
  23. package/dist/types/g2/Physics2D.d.ts +147 -0
  24. package/dist/types/g2/Scene2D.d.ts +72 -0
  25. package/dist/types/g2/Shape2D.d.ts +58 -0
  26. package/dist/types/g2/Sprite.d.ts +51 -0
  27. package/dist/types/g2/SpriteAnimation.d.ts +50 -0
  28. package/dist/types/g2/SpriteSheet.d.ts +69 -0
  29. package/dist/types/g2/Texture2D.d.ts +16 -0
  30. package/dist/types/g2/Tilemap.d.ts +20 -0
  31. package/dist/types/g2/Tileset.d.ts +32 -0
  32. package/dist/types/g2/Trigger2D.d.ts +20 -0
  33. package/dist/types/g2/autotile.d.ts +133 -0
  34. package/dist/types/g2/cells.d.ts +14 -0
  35. package/dist/types/g2/defineScene2d.d.ts +141 -0
  36. package/dist/types/g2/groups2d.d.ts +16 -0
  37. package/dist/types/g2/loop.d.ts +4 -0
  38. package/dist/types/g2/scenarios2d.d.ts +30 -0
  39. package/dist/types/g2/touch.d.ts +2 -0
  40. package/dist/types/gl/Camera.d.ts +79 -0
  41. package/dist/types/gl/CameraPlace.d.ts +26 -0
  42. package/dist/types/gl/CharacterController.d.ts +98 -0
  43. package/dist/types/gl/Gearbox.d.ts +86 -0
  44. package/dist/types/gl/Geometry.d.ts +39 -0
  45. package/dist/types/gl/IK.d.ts +53 -0
  46. package/dist/types/gl/InstancedMesh.d.ts +46 -0
  47. package/dist/types/gl/Light.d.ts +73 -0
  48. package/dist/types/gl/Lightmap.d.ts +85 -0
  49. package/dist/types/gl/Locomotion.d.ts +279 -0
  50. package/dist/types/gl/Material.d.ts +100 -0
  51. package/dist/types/gl/Mesh.d.ts +33 -0
  52. package/dist/types/gl/Model.d.ts +53 -0
  53. package/dist/types/gl/NavAgent.d.ts +99 -0
  54. package/dist/types/gl/NavMesh.d.ts +169 -0
  55. package/dist/types/gl/Node.d.ts +99 -0
  56. package/dist/types/gl/Noise.d.ts +20 -0
  57. package/dist/types/gl/Particles.d.ts +277 -0
  58. package/dist/types/gl/Physics.d.ts +91 -0
  59. package/dist/types/gl/Plane.d.ts +19 -0
  60. package/dist/types/gl/Ragdoll.d.ts +86 -0
  61. package/dist/types/gl/Ray.d.ts +8 -0
  62. package/dist/types/gl/Scene.d.ts +221 -0
  63. package/dist/types/gl/Shape.d.ts +122 -0
  64. package/dist/types/gl/Terrain.d.ts +280 -0
  65. package/dist/types/gl/Texture.d.ts +27 -0
  66. package/dist/types/gl/Trigger.d.ts +10 -0
  67. package/dist/types/gl/Vehicle.d.ts +191 -0
  68. package/dist/types/gl/Wheel.d.ts +95 -0
  69. package/dist/types/gl/animation/AnimationClip.d.ts +60 -0
  70. package/dist/types/gl/animation/Animator.d.ts +219 -0
  71. package/dist/types/gl/animation/Layer.d.ts +31 -0
  72. package/dist/types/gl/animation/Loop.d.ts +17 -0
  73. package/dist/types/gl/animation/Playback.d.ts +36 -0
  74. package/dist/types/gl/animation/core.d.ts +367 -0
  75. package/dist/types/gl/controls.d.ts +19 -0
  76. package/dist/types/gl/physicsEvents.d.ts +1 -0
  77. package/dist/types/gl/scenarios.d.ts +98 -0
  78. package/dist/types/gl/state.d.ts +5 -0
  79. package/dist/types/gl/terrainMesh.d.ts +46 -0
  80. package/dist/types/gl/touch.d.ts +2 -0
  81. package/dist/types/inject.d.ts +123 -0
  82. package/dist/types/math/Mathf.d.ts +39 -0
  83. package/dist/types/math/mat4.d.ts +66 -0
  84. package/dist/types/math/quat.d.ts +53 -0
  85. package/dist/types/math/vec.d.ts +129 -0
  86. package/dist/types/net/codec.d.ts +25 -0
  87. package/dist/types/net/core.d.ts +106 -0
  88. package/dist/types/net/index.d.ts +80 -0
  89. package/dist/types/net/replication.d.ts +101 -0
  90. package/dist/types/plugins/camera.d.ts +25 -0
  91. package/dist/types/plugins/geolocation.d.ts +39 -0
  92. package/dist/types/plugins/oauth.d.ts +25 -0
  93. package/dist/types/plugins/permission.d.ts +1 -0
  94. package/dist/types/plugins/push.d.ts +46 -0
  95. package/dist/types/plugins/qr.d.ts +21 -0
  96. package/dist/types/plugins/service.d.ts +33 -0
  97. package/dist/types/runtime/app.d.ts +67 -0
  98. package/dist/types/runtime/appEvents.d.ts +7 -0
  99. package/dist/types/runtime/channel.d.ts +1 -0
  100. package/dist/types/runtime/clipboard.d.ts +7 -0
  101. package/dist/types/runtime/datetime.d.ts +80 -0
  102. package/dist/types/runtime/device.d.ts +126 -0
  103. package/dist/types/runtime/fetch.d.ts +31 -0
  104. package/dist/types/runtime/files.d.ts +33 -0
  105. package/dist/types/runtime/input.d.ts +121 -0
  106. package/dist/types/runtime/media.d.ts +46 -0
  107. package/dist/types/runtime/misc.d.ts +11 -0
  108. package/dist/types/runtime/net.d.ts +15 -0
  109. package/dist/types/runtime/rpc.d.ts +44 -0
  110. package/dist/types/runtime/service.d.ts +1 -0
  111. package/dist/types/runtime/share.d.ts +2 -0
  112. package/dist/types/runtime/storage.d.ts +5 -0
  113. package/dist/types/runtime/touch.d.ts +56 -0
  114. package/dist/types/scene/defineScene.d.ts +296 -0
  115. package/dist/types/scene/editorPlugins.d.ts +82 -0
  116. package/dist/types/scene/gizmos.d.ts +56 -0
  117. package/dist/types/scene/grammar.d.ts +56 -0
  118. package/dist/types/scene/level.d.ts +98 -0
  119. package/dist/types/scene/material.d.ts +76 -0
  120. package/dist/types/server/auth/appConfig.d.ts +16 -0
  121. package/dist/types/server/auth/global.d.ts +56 -0
  122. package/dist/types/server/auth/models.d.ts +164 -0
  123. package/dist/types/server/auth/types.d.ts +56 -0
  124. package/dist/types/server/channel.d.ts +28 -0
  125. package/dist/types/server/context.d.ts +27 -0
  126. package/dist/types/server/db/defineDb.d.ts +36 -0
  127. package/dist/types/server/db/fields.d.ts +146 -0
  128. package/dist/types/server/db/index.d.ts +6 -0
  129. package/dist/types/server/db/marci/query.d.ts +326 -0
  130. package/dist/types/server/db/types.d.ts +163 -0
  131. package/dist/types/server/errors.d.ts +8 -0
  132. package/dist/types/server/inject.d.ts +5 -0
  133. package/dist/types/ui/NativeView.d.ts +38 -0
  134. package/dist/types/ui/UI.d.ts +27 -0
  135. package/dist/types/ui/UIBottomSheet.d.ts +71 -0
  136. package/dist/types/ui/UIButton.d.ts +30 -0
  137. package/dist/types/ui/UIContainer.d.ts +33 -0
  138. package/dist/types/ui/UIImage.d.ts +35 -0
  139. package/dist/types/ui/UIInput.d.ts +110 -0
  140. package/dist/types/ui/UIModal.d.ts +70 -0
  141. package/dist/types/ui/UINode.d.ts +363 -0
  142. package/dist/types/ui/UIPager.d.ts +123 -0
  143. package/dist/types/ui/UIPopover.d.ts +39 -0
  144. package/dist/types/ui/UIScreen.d.ts +57 -0
  145. package/dist/types/ui/UIScrollable.d.ts +40 -0
  146. package/dist/types/ui/UISpacer.d.ts +9 -0
  147. package/dist/types/ui/UITabs.d.ts +96 -0
  148. package/dist/types/ui/UIText.d.ts +19 -0
  149. package/dist/types/ui/UIVideo.d.ts +28 -0
  150. package/dist/types/ui/UIVirtualizedList.d.ts +97 -0
  151. package/dist/types/ui/UIWidget.d.ts +65 -0
  152. package/dist/types/ui/fonts.d.ts +9 -0
  153. package/dist/types/ui/presentable.d.ts +68 -0
  154. package/dist/types/ui/router.d.ts +40 -0
  155. package/dist/types/ui/theme.d.ts +26 -0
  156. package/dist/types.json +1 -0
  157. package/package.json +46 -0
  158. package/prompts/2d.md +395 -0
  159. package/prompts/3d-scene-files.md +113 -0
  160. package/prompts/3d-scene.md +119 -0
  161. package/prompts/3d.md +303 -0
  162. package/prompts/README.md +142 -0
  163. package/prompts/ar.md +109 -0
  164. package/prompts/canvas.md +27 -0
  165. package/prompts/compose.ts +46 -0
  166. package/prompts/concept.md +49 -0
  167. package/prompts/core-design.md +75 -0
  168. package/prompts/core.md +264 -0
  169. package/prompts/design.md +218 -0
  170. package/prompts/dist/2d-game.md +1530 -0
  171. package/prompts/dist/3d-app.md +1672 -0
  172. package/prompts/dist/ar-app.md +1548 -0
  173. package/prompts/dist/concept.md +49 -0
  174. package/prompts/dist/design.md +498 -0
  175. package/prompts/dist/ui-app.md +1134 -0
  176. package/prompts/index.md +37 -0
  177. package/prompts/intake-prompt.md +33 -0
  178. package/prompts/namer-prompt.md +12 -0
  179. package/prompts/router-prompt.md +50 -0
  180. package/prompts/select.ts +111 -0
  181. package/prompts/ui-design.md +203 -0
  182. package/prompts/ui.md +803 -0
  183. package/src/animate/animate.ts +238 -0
  184. package/src/animate/bezier.ts +138 -0
  185. package/src/animate/easings.ts +126 -0
  186. package/src/bridges.d.ts +1345 -0
  187. package/src/canvas/Canvas.ts +305 -0
  188. package/src/compile/__tests__/assetIconMacro.test.ts +219 -0
  189. package/src/compile/__tests__/assetMacro.test.ts +74 -0
  190. package/src/compile/__tests__/assetName.test.ts +55 -0
  191. package/src/compile/__tests__/compile.test.ts +287 -0
  192. package/src/compile/__tests__/detectEntry.test.ts +132 -0
  193. package/src/compile/__tests__/fontMacro.test.ts +199 -0
  194. package/src/compile/aspectMacro.ts +86 -0
  195. package/src/compile/assetIconMacro.ts +384 -0
  196. package/src/compile/assetMacro.ts +146 -0
  197. package/src/compile/assetName.ts +50 -0
  198. package/src/compile/bundler.ts +287 -0
  199. package/src/compile/compileProject.ts +127 -0
  200. package/src/compile/detectEntry.ts +128 -0
  201. package/src/compile/fontMacro.ts +459 -0
  202. package/src/compile/fontRegistry.ts +78 -0
  203. package/src/compile/header.ts +67 -0
  204. package/src/compile/index.ts +100 -0
  205. package/src/compile/libraryImports.ts +52 -0
  206. package/src/compile/liteMaterial.ts +247 -0
  207. package/src/compile/sceneEditor.ts +88 -0
  208. package/src/compile/serverSplit.ts +233 -0
  209. package/src/compile/serverTypes.ts +227 -0
  210. package/src/compile/sfnt.ts +98 -0
  211. package/src/compile/shaderSchema.ts +202 -0
  212. package/src/compile/shaderTargets.ts +77 -0
  213. package/src/compile/sourcemap.ts +25 -0
  214. package/src/core/Aspect.ts +568 -0
  215. package/src/core/InspectorUI.ts +212 -0
  216. package/src/core/StateMachine.ts +308 -0
  217. package/src/core/__tests__/stateMachine.test.ts +132 -0
  218. package/src/core/color.ts +66 -0
  219. package/src/core/compWrite.ts +42 -0
  220. package/src/core/events.ts +38 -0
  221. package/src/core/fields.ts +120 -0
  222. package/src/core/registry.ts +23 -0
  223. package/src/core/signals.ts +277 -0
  224. package/src/core/time.ts +84 -0
  225. package/src/g2/Camera2D.ts +40 -0
  226. package/src/g2/CharacterController2D.ts +276 -0
  227. package/src/g2/Node2D.ts +267 -0
  228. package/src/g2/OneWay2D.ts +66 -0
  229. package/src/g2/Physics2D.ts +346 -0
  230. package/src/g2/Scene2D.ts +209 -0
  231. package/src/g2/Shape2D.ts +259 -0
  232. package/src/g2/Sprite.ts +89 -0
  233. package/src/g2/SpriteAnimation.ts +171 -0
  234. package/src/g2/SpriteSheet.ts +166 -0
  235. package/src/g2/Texture2D.ts +47 -0
  236. package/src/g2/Tilemap.ts +41 -0
  237. package/src/g2/Tileset.ts +71 -0
  238. package/src/g2/Trigger2D.ts +77 -0
  239. package/src/g2/autotile.ts +433 -0
  240. package/src/g2/cells.ts +91 -0
  241. package/src/g2/defineScene2d.ts +381 -0
  242. package/src/g2/groups2d.ts +106 -0
  243. package/src/g2/loop.ts +50 -0
  244. package/src/g2/scenarios2d.ts +69 -0
  245. package/src/g2/touch.ts +83 -0
  246. package/src/gl/Camera.ts +160 -0
  247. package/src/gl/CameraPlace.ts +52 -0
  248. package/src/gl/CharacterController.ts +238 -0
  249. package/src/gl/Gearbox.ts +212 -0
  250. package/src/gl/Geometry.ts +279 -0
  251. package/src/gl/IK.ts +193 -0
  252. package/src/gl/InstancedMesh.ts +132 -0
  253. package/src/gl/Light.ts +135 -0
  254. package/src/gl/Lightmap.ts +402 -0
  255. package/src/gl/Locomotion.ts +498 -0
  256. package/src/gl/Material.ts +279 -0
  257. package/src/gl/Mesh.ts +83 -0
  258. package/src/gl/Model.ts +124 -0
  259. package/src/gl/NavAgent.ts +337 -0
  260. package/src/gl/NavMesh.ts +397 -0
  261. package/src/gl/Node.ts +350 -0
  262. package/src/gl/Noise.ts +30 -0
  263. package/src/gl/Particles.ts +676 -0
  264. package/src/gl/Physics.ts +222 -0
  265. package/src/gl/Plane.ts +53 -0
  266. package/src/gl/Ragdoll.ts +270 -0
  267. package/src/gl/Ray.ts +16 -0
  268. package/src/gl/Scene.ts +505 -0
  269. package/src/gl/Shape.ts +409 -0
  270. package/src/gl/Terrain.ts +1092 -0
  271. package/src/gl/Texture.ts +63 -0
  272. package/src/gl/Trigger.ts +45 -0
  273. package/src/gl/Vehicle.ts +473 -0
  274. package/src/gl/Wheel.ts +240 -0
  275. package/src/gl/animation/AnimationClip.ts +204 -0
  276. package/src/gl/animation/Animator.ts +329 -0
  277. package/src/gl/animation/Layer.ts +39 -0
  278. package/src/gl/animation/Loop.ts +31 -0
  279. package/src/gl/animation/Playback.ts +52 -0
  280. package/src/gl/animation/core.ts +670 -0
  281. package/src/gl/controls.ts +95 -0
  282. package/src/gl/physicsEvents.ts +20 -0
  283. package/src/gl/scenarios.ts +291 -0
  284. package/src/gl/state.ts +6 -0
  285. package/src/gl/terrainMesh.ts +219 -0
  286. package/src/gl/touch.ts +68 -0
  287. package/src/host.d.ts +61 -0
  288. package/src/inject.ts +203 -0
  289. package/src/math/Mathf.ts +118 -0
  290. package/src/math/mat4.ts +278 -0
  291. package/src/math/quat.ts +232 -0
  292. package/src/math/vec.ts +255 -0
  293. package/src/net/codec.ts +119 -0
  294. package/src/net/core.ts +384 -0
  295. package/src/net/index.ts +181 -0
  296. package/src/net/replication.ts +622 -0
  297. package/src/plugins/camera.ts +81 -0
  298. package/src/plugins/geolocation.ts +123 -0
  299. package/src/plugins/oauth.ts +61 -0
  300. package/src/plugins/permission.ts +7 -0
  301. package/src/plugins/push.ts +132 -0
  302. package/src/plugins/qr.ts +73 -0
  303. package/src/plugins/service.ts +47 -0
  304. package/src/runtime/app.ts +101 -0
  305. package/src/runtime/appEvents.ts +54 -0
  306. package/src/runtime/channel.ts +61 -0
  307. package/src/runtime/clipboard.ts +20 -0
  308. package/src/runtime/datetime.ts +329 -0
  309. package/src/runtime/device.ts +293 -0
  310. package/src/runtime/fetch.ts +77 -0
  311. package/src/runtime/files.ts +108 -0
  312. package/src/runtime/input.ts +175 -0
  313. package/src/runtime/media.ts +111 -0
  314. package/src/runtime/misc.ts +16 -0
  315. package/src/runtime/net.ts +36 -0
  316. package/src/runtime/rpc.ts +218 -0
  317. package/src/runtime/service.ts +83 -0
  318. package/src/runtime/share.ts +9 -0
  319. package/src/runtime/storage.ts +13 -0
  320. package/src/runtime/touch.ts +76 -0
  321. package/src/scene/defineScene.ts +1396 -0
  322. package/src/scene/editorPlugins.ts +110 -0
  323. package/src/scene/gizmos.ts +148 -0
  324. package/src/scene/grammar.ts +120 -0
  325. package/src/scene/level.ts +296 -0
  326. package/src/scene/material.ts +188 -0
  327. package/src/server/auth/appConfig.ts +12 -0
  328. package/src/server/auth/global.ts +80 -0
  329. package/src/server/auth/host.ts +318 -0
  330. package/src/server/auth/models.ts +83 -0
  331. package/src/server/auth/types.ts +50 -0
  332. package/src/server/channel.ts +56 -0
  333. package/src/server/context.ts +36 -0
  334. package/src/server/db/defineDb.ts +237 -0
  335. package/src/server/db/fields.ts +132 -0
  336. package/src/server/db/httpTransport.ts +93 -0
  337. package/src/server/db/index.ts +7 -0
  338. package/src/server/db/marci/query.ts +412 -0
  339. package/src/server/db/types.ts +202 -0
  340. package/src/server/errors.ts +12 -0
  341. package/src/server/host.ts +74 -0
  342. package/src/server/inject.ts +13 -0
  343. package/src/server/runtime.ts +133 -0
  344. package/src/server/validate.ts +87 -0
  345. package/src/ui/NativeView.ts +142 -0
  346. package/src/ui/UI.ts +39 -0
  347. package/src/ui/UIBottomSheet.ts +139 -0
  348. package/src/ui/UIButton.ts +101 -0
  349. package/src/ui/UIContainer.ts +60 -0
  350. package/src/ui/UIImage.ts +83 -0
  351. package/src/ui/UIInput.ts +185 -0
  352. package/src/ui/UIModal.ts +139 -0
  353. package/src/ui/UINode.ts +830 -0
  354. package/src/ui/UIPager.ts +362 -0
  355. package/src/ui/UIPopover.ts +100 -0
  356. package/src/ui/UIScreen.ts +123 -0
  357. package/src/ui/UIScrollable.ts +87 -0
  358. package/src/ui/UISpacer.ts +14 -0
  359. package/src/ui/UITabs.ts +236 -0
  360. package/src/ui/UIText.ts +51 -0
  361. package/src/ui/UIVideo.ts +88 -0
  362. package/src/ui/UIVirtualizedList.ts +241 -0
  363. package/src/ui/UIWidget.ts +127 -0
  364. package/src/ui/fonts.ts +13 -0
  365. package/src/ui/presentable.ts +117 -0
  366. package/src/ui/router.ts +132 -0
  367. package/src/ui/theme.ts +84 -0
@@ -0,0 +1,33 @@
1
+ import { File, type FetchResponse } from "./fetch";
2
+ type OpenFilePickerOptions = {
3
+ accept?: string;
4
+ };
5
+ export declare function openFilePicker(options?: OpenFilePickerOptions & {
6
+ multiple?: false;
7
+ }): Promise<File | null>;
8
+ export declare function openFilePicker(options: OpenFilePickerOptions & {
9
+ multiple: true;
10
+ }): Promise<File[]>;
11
+ /** Anything writable as-is: text, raw bytes, or a buffer the host already holds
12
+ * (a picked `File`, a `FetchResponse`, a `Canvas.toFile()` snapshot). */
13
+ export type FileData = string | Uint8Array | ArrayBuffer | File | FetchResponse;
14
+ export declare const files: {
15
+ /** Is there a filesystem here (desktop)? False on web/mobile, where every other call rejects. */
16
+ readonly supported: boolean;
17
+ /** Replace the file's contents, creating the parent folders on the way. */
18
+ write(path: string, data: FileData): Promise<void>;
19
+ /** Add to the end of the file, creating it (and the parent folders) when it isn't there yet. */
20
+ append(path: string, data: FileData): Promise<void>;
21
+ /** The whole file as UTF-8 text — null when there is no such file. */
22
+ readText(path: string): Promise<string | null>;
23
+ /** The whole file as bytes — null when there is no such file. */
24
+ readBytes(path: string): Promise<Uint8Array | null>;
25
+ /** Delete a file, or a directory (empty, or any directory with `{ recursive: true }`). Deleting
26
+ * something already gone is success — what's promised is that the path is free afterwards. */
27
+ delete(path: string, options?: {
28
+ recursive?: boolean;
29
+ }): Promise<void>;
30
+ /** Create a directory and any missing parents. An existing directory is fine. */
31
+ mkdir(path: string): Promise<void>;
32
+ };
33
+ export {};
@@ -0,0 +1,121 @@
1
+ /** Continuous channel ids — the `_creatorUtils.inputRead` contract (bridges.d.ts). */
2
+ export declare const InputChannel: {
3
+ readonly MouseX: 0;
4
+ readonly MouseY: 1;
5
+ readonly MouseDX: 2;
6
+ readonly MouseDY: 3;
7
+ readonly WheelX: 4;
8
+ readonly WheelY: 5;
9
+ readonly PointerLocked: 6;
10
+ readonly GamepadCount: 7;
11
+ readonly GamepadBase: 16;
12
+ readonly GamepadStride: 16;
13
+ readonly PadConnected: 0;
14
+ readonly PadLeftX: 1;
15
+ readonly PadLeftY: 2;
16
+ readonly PadRightX: 3;
17
+ readonly PadRightY: 4;
18
+ readonly PadLeftTrigger: 5;
19
+ readonly PadRightTrigger: 6;
20
+ };
21
+ export type InputEventName = "keydown" | "keyup" | "gamepadconnected" | "gamepaddisconnected";
22
+ /** `keydown` / `keyup` payload. `code` is the same string `Input.key()` takes. */
23
+ export interface InputKeyEvent {
24
+ readonly type: "keydown" | "keyup";
25
+ /** Button code: KeyboardEvent.code ('KeyW', 'Space'), 'MouseLeft|Right|Middle|Back|Forward', or
26
+ * 'GamepadSouth|East|West|North|L1|R1|L2|R2|Select|Start|L3|R3|Up|Down|Left|Right'. */
27
+ readonly code: string;
28
+ /** Which device: 'keyboard' | 'mouse' | 'gamepad'. */
29
+ readonly source: "keyboard" | "mouse" | "gamepad";
30
+ /** Pad index (0..3) for gamepad buttons, undefined otherwise. */
31
+ readonly gamepad?: number;
32
+ /** OS auto-repeat keydown (key still held) — ignore for one-shot actions. */
33
+ readonly repeat: boolean;
34
+ }
35
+ export interface InputGamepadEvent {
36
+ readonly type: "gamepadconnected" | "gamepaddisconnected";
37
+ readonly gamepad: number;
38
+ }
39
+ type Listener<E> = (e: E) => void;
40
+ type InputEventMap = {
41
+ keydown: InputKeyEvent;
42
+ keyup: InputKeyEvent;
43
+ gamepadconnected: InputGamepadEvent;
44
+ gamepaddisconnected: InputGamepadEvent;
45
+ };
46
+ /** Mouse state — polled. Position is the cursor inside the viewport in logical px; `delta` is the
47
+ * motion during the previous frame (raw where the OS offers it) and keeps counting while locked —
48
+ * that's FPS look. Hosts without a mouse report zeros. */
49
+ export declare const mouse: {
50
+ readonly position: {
51
+ x: number;
52
+ y: number;
53
+ };
54
+ readonly delta: {
55
+ x: number;
56
+ y: number;
57
+ };
58
+ /** Wheel notches during the previous frame (+y = wheel toward you / scroll down). */
59
+ readonly wheel: {
60
+ x: number;
61
+ y: number;
62
+ };
63
+ /** Pointer lock: cursor hidden + confined, `delta` keeps flowing. Web grants it only from a user
64
+ * gesture (call it in a 'keydown' handler for MouseLeft); hosts drop it on focus loss and
65
+ * re-acquire on focus. Escape does NOT unlock by itself on native hosts — call `unlock()`. */
66
+ readonly locked: boolean;
67
+ lock(): boolean;
68
+ unlock(): void;
69
+ };
70
+ export type GamepadAxisName = "leftX" | "leftY" | "rightX" | "rightY" | "leftTrigger" | "rightTrigger";
71
+ export interface GamepadState {
72
+ readonly index: number;
73
+ readonly connected: boolean;
74
+ /** Stick axes −1..1 (+Y = down, like the web Gamepad API), triggers 0..1. `deadzone` (default
75
+ * 0.15) zeroes small stick drift — pass 0 for the raw value. */
76
+ axis(name: GamepadAxisName, deadzone?: number): number;
77
+ /** Held? Same as `Input.key(code, index)`. */
78
+ button(code: string): boolean;
79
+ }
80
+ export declare const Input: {
81
+ /**
82
+ * Is a button held? `code` is the physical key (`KeyboardEvent.code`: 'ArrowRight', 'KeyW',
83
+ * 'Space'), a mouse button ('MouseLeft', 'MouseRight', 'MouseMiddle') or a gamepad button
84
+ * ('GamepadSouth' = A/Cross, 'GamepadR2' = right trigger as a button …). Poll inside setLoop for
85
+ * frame-independent movement. `gamepad` scopes a Gamepad* code to one pad; omitted = any pad.
86
+ */
87
+ key(code: string, gamepad?: number): boolean;
88
+ /** Listen for a discrete input moment. `keydown`/`keyup` cover EVERY button — keyboard, mouse,
89
+ * gamepad — filter on `e.code`. Use these for one-shot actions (jump, shoot, charge-release);
90
+ * `Input.key` for continuous ones (walk). */
91
+ on<K extends InputEventName>(name: K, listener: Listener<InputEventMap[K]>): void;
92
+ off<K extends InputEventName>(name: K, listener: Listener<InputEventMap[K]>): void;
93
+ mouse: {
94
+ readonly position: {
95
+ x: number;
96
+ y: number;
97
+ };
98
+ readonly delta: {
99
+ x: number;
100
+ y: number;
101
+ };
102
+ /** Wheel notches during the previous frame (+y = wheel toward you / scroll down). */
103
+ readonly wheel: {
104
+ x: number;
105
+ y: number;
106
+ };
107
+ /** Pointer lock: cursor hidden + confined, `delta` keeps flowing. Web grants it only from a user
108
+ * gesture (call it in a 'keydown' handler for MouseLeft); hosts drop it on focus loss and
109
+ * re-acquire on focus. Escape does NOT unlock by itself on native hosts — call `unlock()`. */
110
+ readonly locked: boolean;
111
+ lock(): boolean;
112
+ unlock(): void;
113
+ };
114
+ /** Gamepad `index` (0..3). Always returns an object — check `.connected`. */
115
+ gamepad(index?: number): GamepadState;
116
+ /** Indices of the currently connected gamepads. */
117
+ gamepads(): number[];
118
+ /** @internal — hosts/tests: deliver an event exactly as the host listener would. */
119
+ _emit(kind: number, code: string, gamepad: number, repeat: number): void;
120
+ };
121
+ export {};
@@ -0,0 +1,46 @@
1
+ import { Emitter } from "../core/events";
2
+ import { Texture } from "../gl/Texture";
3
+ type MediaEvents = {
4
+ /** Fired at each loop boundary while `loop` is true. */
5
+ loopReached: () => void;
6
+ /** Fired once when playback reaches the end while `loop` is false. */
7
+ completed: () => void;
8
+ };
9
+ declare abstract class MediaPlayer extends Emitter<MediaEvents> {
10
+ protected _id: number;
11
+ protected _src: string;
12
+ private _playing;
13
+ private _loop;
14
+ private _volume;
15
+ private _disposed;
16
+ private _assertAlive;
17
+ play(): void;
18
+ pause(): void;
19
+ get playing(): boolean;
20
+ set playing(value: boolean);
21
+ get volume(): number;
22
+ set volume(value: number);
23
+ get loop(): boolean;
24
+ set loop(value: boolean);
25
+ /** Current playback position, in seconds. Settable to seek. */
26
+ get time(): number;
27
+ set time(value: number);
28
+ /** Total media length in seconds (0 until metadata has loaded). */
29
+ get duration(): number;
30
+ /** True once {@link dispose} has been called; the player is unusable afterwards. */
31
+ get disposed(): boolean;
32
+ /**
33
+ * Release the underlying host media resource (decoder, network, buffers) immediately and detach
34
+ * all listeners. Idempotent. Any further use of the player throws.
35
+ */
36
+ dispose(): void;
37
+ }
38
+ export declare class AudioPlayer extends MediaPlayer {
39
+ constructor(src?: string);
40
+ }
41
+ export declare class VideoPlayer extends MediaPlayer {
42
+ constructor(src?: string);
43
+ /** A 3D Texture that samples this video (e.g. for a Material.video()). */
44
+ get texture(): Texture;
45
+ }
46
+ export {};
@@ -0,0 +1,11 @@
1
+ /** Show a transient toast notification. */
2
+ export declare const toast: (msg: string) => void;
3
+ /** Open `url` in the system browser / external handler (fire-and-forget, like `share`). Silent
4
+ * no-op on hosts without one (headless). */
5
+ export declare const openURL: (url: string) => void;
6
+ export type SvgSourceValue = {
7
+ readonly svg: string;
8
+ tintColor: string | null;
9
+ };
10
+ /** Wrap raw SVG XML so it can be used as an image source. */
11
+ export declare const SvgSource: (svg: string) => SvgSourceValue;
@@ -0,0 +1,15 @@
1
+ import { Emitter } from "../core/events";
2
+ type SocketEvents = {
3
+ open: () => void;
4
+ message: (data: any) => void;
5
+ close: (code?: number) => void;
6
+ error: () => void;
7
+ };
8
+ export declare class WebSocket extends Emitter<SocketEvents> {
9
+ private _id;
10
+ constructor(url: string, headers?: Record<string, string>);
11
+ send(message: string | ArrayBuffer): void;
12
+ close(): void;
13
+ private _onMessage;
14
+ }
15
+ export {};
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Client transport for the app backend (docs/backend-plan.md §3.2 / §3.3). The compiler replaces
3
+ * every `*.server.ts` module in the client bundle with a stub whose exports are built by the three
4
+ * globals below — user code never calls them; it imports the server function and calls it.
5
+ *
6
+ * export const listNotes = __rpc("<serverUrl>", "notes.server.ts#listNotes")
7
+ * export const chat = __channel("<serverUrl>", "chat.server.ts#chat")
8
+ * export const db = __serverOnly("schema.server.ts#db")
9
+ *
10
+ * Wire (implemented by the runner):
11
+ * POST <serverUrl>/api/<id> body {"args":[…]}, `authorization: Bearer <session>` when known
12
+ * → 200 {"ok":true,"result":…,"session"?:"…"} | {"ok":false,"status":n,"message":"…","session"?:"…"}
13
+ * WS <serverUrl>/ws frames: → {t:"hello",session} {t:"sub",id,ch,topic} {t:"unsub",id}
14
+ * ← {t:"session",session} {t:"ok",id} {t:"err",id,status,message} {t:"ev",ch,topic,event,data}
15
+ * (`ev` is addressed by channel + topic, not by subscription id, so the server can fan one publish out
16
+ * to every socket of a topic natively; the client delivers it to each matching subscription.)
17
+ *
18
+ * The session token is transport-owned (cookie-like): stored under `lecodes.session:<serverUrl>` in
19
+ * localStorage, sent on every call and on the socket, replaced whenever a response carries `session`.
20
+ * User code never sees it — "am I logged in" is an endpoint (`me()`), see the plan.
21
+ */
22
+ /** Rejection value of a failed endpoint call: `status` mirrors the server's `ApiError`
23
+ * (0 = the request itself failed: no network / no server). */
24
+ export declare class RpcError extends Error {
25
+ readonly status: number;
26
+ constructor(status: number, message: string);
27
+ }
28
+ /** Build the client proxy of endpoint `id`. Positional args travel as a JSON array. */
29
+ export declare const __rpc: (serverUrl: string, id: string) => (...args: unknown[]) => Promise<any>;
30
+ /** A server-only export (db, models, helpers) referenced from client code: any use throws. */
31
+ export declare const __serverOnly: (id: string) => any;
32
+ export interface ClientChannel<E extends Record<string, unknown> = Record<string, unknown>> {
33
+ /** Subscribe to `topic`; handlers are keyed by event name (+ `reconnect`/`error`). Returns `{ close }`. */
34
+ subscribe(topic: string, handlers: {
35
+ [K in keyof E]?: (payload: E[K]) => void;
36
+ } & {
37
+ reconnect?: () => void;
38
+ error?: (e: RpcError) => void;
39
+ }): {
40
+ close(): void;
41
+ };
42
+ }
43
+ /** Build the client proxy of channel `id`. */
44
+ export declare const __channel: (serverUrl: string, id: string) => ClientChannel<any>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { File, FetchResponse } from "./fetch";
2
+ export declare function share(media: File | FetchResponse, text?: string): void;
@@ -0,0 +1,5 @@
1
+ export declare const localStorage: {
2
+ getItem(key: string): string | null;
3
+ setItem(key: string, value: string): void;
4
+ removeItem(key: string): void;
5
+ };
@@ -0,0 +1,56 @@
1
+ export declare class ClickEvent<T = any> {
2
+ readonly type = "click";
3
+ readonly pointerId: number;
4
+ readonly clientX: number;
5
+ readonly clientY: number;
6
+ /** World-space hit position (2D scenes only; undefined in 3D). */
7
+ worldX?: number;
8
+ worldY?: number;
9
+ target: T;
10
+ constructor(clientX: number, clientY: number, pointerId: number);
11
+ }
12
+ export interface TrackHandler {
13
+ onMove?(pos: {
14
+ clientX: number;
15
+ clientY: number;
16
+ deltaX: number;
17
+ deltaY: number;
18
+ }): void;
19
+ onEnd?(pos: {
20
+ clientX: number;
21
+ clientY: number;
22
+ deltaX: number;
23
+ deltaY: number;
24
+ }): void;
25
+ onCancel?(): void;
26
+ claim?: boolean | "pan-x" | "pan-y" | "pan-down" | "pan-up" | "pan-left" | "pan-right";
27
+ }
28
+ export declare class TouchStartEvent<T = any> {
29
+ readonly type = "touchstart";
30
+ readonly pointerId: number;
31
+ readonly clientX: number;
32
+ readonly clientY: number;
33
+ /** World-space hit position (2D scenes only; undefined in 3D). */
34
+ worldX?: number;
35
+ worldY?: number;
36
+ target: T;
37
+ constructor(clientX: number, clientY: number, pointerId: number);
38
+ /** Capture subsequent moves/end for this pointer (drag/pan gestures). */
39
+ track(handler: TrackHandler): void;
40
+ }
41
+ /** Delivered to a `UIButton` `onLongPress` handler when a finger is held on the button past the
42
+ * host's long-press threshold. Like `TouchStartEvent` it can `track(...)` the rest of the gesture —
43
+ * so the common "press-and-hold, then drag to move" flow is one handler: start the drag from here. */
44
+ export declare class LongPressEvent<T = any> {
45
+ readonly type = "longpress";
46
+ readonly pointerId: number;
47
+ readonly clientX: number;
48
+ readonly clientY: number;
49
+ /** World-space hit position (2D scenes only; undefined in 3D). */
50
+ worldX?: number;
51
+ worldY?: number;
52
+ target: T;
53
+ constructor(clientX: number, clientY: number, pointerId: number);
54
+ /** Capture subsequent moves/end for this pointer — drag the element after the hold. */
55
+ track(handler: TrackHandler): void;
56
+ }
@@ -0,0 +1,296 @@
1
+ import { type With } from "../core/Aspect";
2
+ import { use, ref, make, type AspectEntry, type MakeEntry as SharedMakeEntry } from "./grammar";
3
+ import type { Vec3Like } from "../math/vec";
4
+ import { Scene, type SceneOptions } from "../gl/Scene";
5
+ import { Node } from "../gl/Node";
6
+ import { Mesh } from "../gl/Mesh";
7
+ import { Model } from "../gl/Model";
8
+ import { type TerrainLayer, type TerrainRegion, type TerrainOptions } from "../gl/Terrain";
9
+ import { Light, type SunOptions } from "../gl/Light";
10
+ import { type MaterialDef } from "./material";
11
+ import type { CylinderOptions, PlaneOptions, SphereOptions } from "../gl/Geometry";
12
+ export type MeshDef = {
13
+ kind: "box";
14
+ size?: Vec3Like | number;
15
+ } | ({
16
+ kind: "sphere";
17
+ } & SphereOptions) | ({
18
+ kind: "cylinder";
19
+ } & CylinderOptions) | ({
20
+ kind: "plane";
21
+ } & PlaneOptions);
22
+ export type LightDef = {
23
+ kind: "sun";
24
+ } & SunOptions;
25
+ /** A stamp: the terrain conforms to another node of this file (a road) at load — see Terrain.conform. */
26
+ export type TerrainStampDef = {
27
+ /** Path of the node (a Mesh, a Model, or a node holding them) the ground hugs. */
28
+ node: string;
29
+ offset?: number;
30
+ falloff?: number;
31
+ mode?: "both" | "lower" | "raise";
32
+ };
33
+ /** The `terrain: {}` source block (docs/terrain-plan.md §3.3): a `.terrain` file OR a flat grid to
34
+ * generate from, its layers, and the stamps / holes applied at load (in order, after every node of the
35
+ * file exists — a road built by `make()` is a valid target). Add `Shape { heightfield: true }` +
36
+ * `Physics { motion: 'static' }` in `aspects` for collision. */
37
+ export type TerrainNodeDef = {
38
+ /** `asset('./assets/terrain/valley.terrain')` — heights / holes / control from a file. */
39
+ data?: string;
40
+ size?: number;
41
+ sizeX?: number;
42
+ sizeZ?: number;
43
+ cellSize?: number;
44
+ chunk?: number;
45
+ layers?: TerrainLayer[];
46
+ normals?: TerrainOptions["normals"];
47
+ tint?: TerrainOptions["tint"];
48
+ stamps?: TerrainStampDef[];
49
+ holes?: TerrainRegion[];
50
+ };
51
+ export type { MaterialDef };
52
+ export { use, ref, make };
53
+ export type { AspectEntry };
54
+ /** A `make(fn, args)` source entry whose factory returns a 3D {@link Node}. */
55
+ export type MakeEntry<A extends Record<string, unknown> = Record<string, unknown>> = SharedMakeEntry<A, Node>;
56
+ /** Transform overrides for one INTERNAL node of a GLB model or a prefab instance
57
+ * (`overrides` on a model/prefab node, keyed by part path). */
58
+ export type ModelOverrideDef = {
59
+ position?: Vec3Like;
60
+ eulerAngles?: Vec3Like;
61
+ scale?: Vec3Like | number;
62
+ visible?: boolean;
63
+ /** Materials by primitive SLOT of this part (`0` for a single-material mesh; the editor lists
64
+ * the slots with their glTF material names): a material asset, an inline def, or a custom
65
+ * shader. Slots left out keep the glTF material. */
66
+ materials?: Record<number | string, MaterialDef>;
67
+ };
68
+ /** Camera projection settings, shared by the `camera:` source block and the top-level `camera:`
69
+ * block. All optional — an omitted key keeps the host default (60° / 0.01 / 1000). */
70
+ export type CameraProjectionDef = {
71
+ /** Vertical field of view in degrees (default 60) — smaller is a longer lens. */
72
+ fov?: number;
73
+ /** Near clip distance (default 0.01). */
74
+ near?: number;
75
+ /** Far clip distance = view range (default 1000); geometry past it is culled. */
76
+ far?: number;
77
+ };
78
+ /** The `camera: {}` source block — projection settings for the node that drives the view. */
79
+ export type CameraNodeDef = CameraProjectionDef;
80
+ export type SceneNodeDef = {
81
+ mesh?: MeshDef;
82
+ /** GLB url — `asset('./hero.glb')`. */
83
+ model?: string;
84
+ light?: LightDef;
85
+ /** A heightmap ground — see {@link TerrainNodeDef}. */
86
+ terrain?: TerrainNodeDef;
87
+ /** The scene camera as a NODE: in play mode `scene.camera` follows this node's world transform
88
+ * every frame (so movement aspects on it are camera flythroughs); the editor shows a frustum
89
+ * marker and refuses to delete the last camera node. The first camera node in file order wins;
90
+ * cameras inside prefabs are ignored (like a prefab's `camera:` block). */
91
+ camera?: CameraNodeDef;
92
+ /** A code-built subtree — `make(factoryFn, { ...literal args })`. */
93
+ make?: MakeEntry<any>;
94
+ /** Another scene file used as a reusable composition — the imported handle:
95
+ * `import streetlamp from './streetlamp.scene'` … `lamp: { prefab: streetlamp }`. Its nodes
96
+ * instantiate under this node per instance (env/camera are the instancing file's business and
97
+ * are ignored); `ref()`s inside the prefab resolve file-locally, per instance. */
98
+ prefab?: SceneHandle<any>;
99
+ /** Material for a `mesh` source. */
100
+ material?: MaterialDef;
101
+ /** Model/prefab sources: transform overrides for the INTERNAL nodes, keyed by part path
102
+ * (see the part-path grammar above `modelPartRows`). Unresolved paths are ignored. */
103
+ overrides?: Record<string, ModelOverrideDef>;
104
+ /** On a CHILD of a model/prefab node: parent this node to that INTERNAL part of the parent's
105
+ * asset at build time (part path — the same grammar `overrides` keys use), e.g. a flashlight
106
+ * in a hand. The transform stays local to the part. A stale path (asset changed) falls back
107
+ * to the parent root with a console warning. */
108
+ mount?: string;
109
+ position?: Vec3Like;
110
+ eulerAngles?: Vec3Like;
111
+ scale?: Vec3Like | number;
112
+ visible?: boolean;
113
+ /** Editor-only: viewport manipulation won't target this node (fields still edit). No runtime effect. */
114
+ locked?: boolean;
115
+ /** Editor-only, `model` nodes: the POSE the scene editor shows — a clip looped while editing
116
+ * (`time` freezes it at that second instead), so attachments / sight lines / a first-person eye
117
+ * are placed against the animated pose, not the rest pose. Never applied when the scene runs. */
118
+ editor?: {
119
+ clip?: string;
120
+ time?: number;
121
+ };
122
+ /** `mesh` / `model` nodes: real-time shadow flags. On a `model` they reach every renderable of
123
+ * the GLB instance, so `castShadows: false` on a first-person viewmodel covers the whole gun. */
124
+ castShadows?: boolean;
125
+ receiveShadows?: boolean;
126
+ /** Baked lighting (a scene with `env.lightmap`): is this model/mesh node a lightmap STATIC — a
127
+ * receiver and an occluder in the bake, real-time shadow casting off once the bake applies?
128
+ * Default: static unless a `Physics` aspect moves the node (`dynamic` — Physics' default — or
129
+ * `kinematic`). Set it only to override that rule; prefab subtrees inherit the verdict. */
130
+ lightmap?: boolean;
131
+ /** Navigation (a scene with `env.navmesh`, see navmesh.md): every STATIC body is walkable by
132
+ * default. `false` leaves this one out of the bake; `'unwalkable'` cuts its footprint out
133
+ * (nobody stands on or crosses it). */
134
+ nav?: false | "unwalkable";
135
+ /** The named navmesh area this static body's surface belongs to (a key of `env.navmesh.areas`). */
136
+ navArea?: string;
137
+ aspects?: readonly AspectEntry<any>[];
138
+ children?: Record<string, SceneNodeDef>;
139
+ };
140
+ export type SceneCameraDef = CameraProjectionDef & {
141
+ position?: Vec3Like;
142
+ /** Point the camera looks at. */
143
+ target?: Vec3Like;
144
+ };
145
+ /** `env.lightmap` — the level's baked lighting (see lightmap.md): the two files
146
+ * `lecodes lightmap bake` writes, plus how the bake is applied. Absent = real-time only. */
147
+ export type SceneLightmapDef = {
148
+ /** `asset('./assets/lightmap/lightmap.bake')` */
149
+ data: string;
150
+ /** `asset('./assets/lightmap/lightmap.ktx2')` — or, for a bake that took more than one atlas PAGE
151
+ * (`lecodes lightmap bake --pages`), every page in order: `[asset('x.ktx2'), asset('x_1.ktx2')]`. */
152
+ texture: string | string[];
153
+ /** `asset('./assets/lightmap/lightmap-light.ktx2')` (pages like `texture`) — the point lights' baked
154
+ * irradiance the bake writes when the level holds point lights; the real-time lights it carries are
155
+ * switched off once it applies. Absent = the lamps stay real-time. */
156
+ light?: string | string[];
157
+ /** `asset('./assets/lightmap/lightmap.volume')` — the light VOLUME for everything that moves (the
158
+ * same bake writes it): dynamic nodes, and every model loaded in code while the level runs, read
159
+ * the baked sun/ambient at their own position. Absent = movers stay real-time only. */
160
+ volume?: string;
161
+ /** 1 = baked sun shadows at full strength, 0 = ambient occlusion only. Default 1. */
162
+ sunStrength?: number;
163
+ /** Multiplier on the ambient share in the shadow math (1 = filament's own darkness). Default 1. */
164
+ ambientScale?: number;
165
+ /** How much of the baked ambient occlusion applies: 1 = all of it, 0 = none. An interior lit by its
166
+ * ambient probe alone can want less than the geometric truth. Default 1. */
167
+ aoStrength?: number;
168
+ /** Multiplier on the baked point lights' irradiance (default 1) - dial the lamps up or down
169
+ * without a re-bake, since their irradiance lives in the atlas. Scales the light volume with the
170
+ * atlas, so movers match the statics. See `LightmapLoadOptions.lightBoost`. */
171
+ lightBoost?: number;
172
+ /** Multiplier on the light VOLUME's irradiance alone (default = `lightBoost`). Since the volume is an
173
+ * ambient cube (2026-08-31) movers shade like the statics and the default is right; it stays as a
174
+ * trim. See `LightmapLoadOptions.volumeBoost`. */
175
+ volumeBoost?: number;
176
+ };
177
+ /** `env.navmesh` — the level's navigation mesh (see navmesh.md): the file `lecodes navmesh bake`
178
+ * writes, the agent size it is built for, and the named areas. Absent = no navigation. */
179
+ export type SceneNavmeshDef = {
180
+ /** `asset('./assets/nav/<scene>.navmesh')` */
181
+ data: string;
182
+ /** The agent the mesh is built for (radius 0.4 · height 1.8 · climb 0.4 · slope 50 by default). */
183
+ agent?: {
184
+ radius?: number;
185
+ height?: number;
186
+ climb?: number;
187
+ slope?: number;
188
+ };
189
+ /** Named areas → traversal cost (1 = plain ground); nodes join one with `navArea`. */
190
+ areas?: Record<string, number>;
191
+ };
192
+ export type SceneDef = {
193
+ env?: SceneOptions & {
194
+ lightmap?: SceneLightmapDef;
195
+ navmesh?: SceneNavmeshDef;
196
+ };
197
+ camera?: SceneCameraDef;
198
+ nodes?: Record<string, SceneNodeDef>;
199
+ };
200
+ type SourceNodeOf<N extends SceneNodeDef> = N extends {
201
+ model: string;
202
+ } ? Model : N extends {
203
+ mesh: MeshDef;
204
+ } ? Mesh : N extends {
205
+ light: LightDef;
206
+ } ? Light : Node;
207
+ type AspectsOf<N extends SceneNodeDef> = N extends {
208
+ aspects: readonly AspectEntry<infer A>[];
209
+ } ? A : never;
210
+ type NodeOf<N extends SceneNodeDef> = [
211
+ AspectsOf<N>
212
+ ] extends [never] ? SourceNodeOf<N> : With<SourceNodeOf<N>, AspectsOf<N>>;
213
+ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
214
+ type ChildMapsOf<T extends Record<string, SceneNodeDef>, P extends string> = {
215
+ [K in keyof T & string]: T[K] extends {
216
+ children: infer C extends Record<string, SceneNodeDef>;
217
+ } ? NodesOf<C, `${P}${K}/`> : never;
218
+ }[keyof T & string];
219
+ type NodesOf<T extends Record<string, SceneNodeDef>, P extends string = ""> = {
220
+ [K in keyof T & string as `${P}${K}`]: NodeOf<T[K]>;
221
+ } & ([ChildMapsOf<T, P>] extends [never] ? unknown : UnionToIntersection<ChildMapsOf<T, P>>);
222
+ export type SceneNodes<D extends SceneDef> = D["nodes"] extends Record<string, SceneNodeDef> ? NodesOf<D["nodes"]> : Record<string, Node>;
223
+ export type LoadedScene<D extends SceneDef> = {
224
+ scene: Scene;
225
+ nodes: SceneNodes<D>;
226
+ /** Path lookup — typed for this scene's literal paths, `Node | null` for arbitrary strings. */
227
+ get: {
228
+ <P extends keyof SceneNodes<D> & string>(path: P): SceneNodes<D>[P];
229
+ (path: string): Node | null;
230
+ };
231
+ };
232
+ /** One instance of a scene file built as a subtree (`handle.instantiate`). */
233
+ export type SceneInstance<D extends SceneDef> = {
234
+ /** The wrapper node the file's nodes build under — position it, parent it, hide it. */
235
+ root: Node;
236
+ nodes: SceneNodes<D>;
237
+ /** Anchor the instance on one of its own nodes: `root`'s local transform is set so that
238
+ * `inner` coincides with the frame `root` is parented to (its origin and axes). One-shot,
239
+ * from the CURRENT pose of `inner` — a rig's attachment frame (the eye place of a
240
+ * first-person arms scene, the grip of a held prop). */
241
+ alignTo(inner: Node): void;
242
+ get: LoadedScene<D>["get"];
243
+ /** Remove the subtree from the scene and destroy it. */
244
+ dispose(): void;
245
+ };
246
+ /** One INTERNAL node of a loaded GLB (editor introspection). */
247
+ export type ModelPartRow = {
248
+ path: string;
249
+ name: string;
250
+ depth: number;
251
+ node: Node;
252
+ };
253
+ /** Flatten a model's (or prefab instance's) internal hierarchy to rows (depth-first, the root
254
+ * excluded). `__generated` containers are derived output, and def-built nodes (`_sceneDef` —
255
+ * plain or `mount`ed children of the model) are addressed by their own def paths — both are
256
+ * not parts, skipped. Filtering BEFORE segment math keeps `name[i]` indices stable no matter
257
+ * what defs are parented in. */
258
+ export declare const modelPartRows: (root: Node) => ModelPartRow[];
259
+ /** The static verdict for one node def (the editor's "Baked lighting" switch shows the same rule). */
260
+ export declare const isLightmapStatic: (def: SceneNodeDef) => boolean;
261
+ /** Edit mode: play the preview pose on a model node (`editor: { clip, time }`) — idempotent, the
262
+ * harness re-applies it on inspector edits. No clip = back to the rest pose. */
263
+ export declare const applyEditorPose: (node: Node, pose: {
264
+ clip?: string;
265
+ time?: number;
266
+ } | undefined) => void;
267
+ export declare class SceneHandle<D extends SceneDef = SceneDef> {
268
+ readonly def: D;
269
+ private _loading?;
270
+ constructor(def: D);
271
+ /** Instantiate the scene (idempotent — subsequent calls return the same instance). Does not open. */
272
+ load(): Promise<LoadedScene<D>>;
273
+ /** Load and make active. */
274
+ open(): Promise<LoadedScene<D>>;
275
+ /**
276
+ * Build this scene file as a reusable SUBTREE inside an existing scene — a weapon under a hand
277
+ * bone, a streetlamp per street corner — as many times as you like (unlike `load()`, which is
278
+ * the one-instance "scene as a level" path). The nodes build under a fresh wrapper node (`root`)
279
+ * parented to `parent` (or left unparented); `env` / `camera` are ignored like a prefab's. The
280
+ * file's transforms are local to the wrapper, so author it with the wrapper as the attachment
281
+ * point. `ref()`s resolve per instance; aspects attach per instance. `dispose()` removes the
282
+ * subtree from the scene and destroys it.
283
+ */
284
+ instantiate(opts: {
285
+ scene: Scene;
286
+ parent?: Node | null;
287
+ name?: string;
288
+ }): Promise<SceneInstance<D>>;
289
+ }
290
+ /**
291
+ * Define a scene as data — the default export of a `.scene.ts` file. Returns a typed handle:
292
+ * `const { scene, nodes, get } = await handle.open()` gives `nodes[path]` typed by its source
293
+ * block (Mesh / Model / Light / Node) with its `use(...)`d aspects attached — root nodes read as
294
+ * plain properties (`nodes.hero`), nested ones by path (`nodes['hero/halo']` / `get('hero/halo')`).
295
+ */
296
+ export declare const defineScene: <const D extends SceneDef>(def: D) => SceneHandle<D>;