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.
- package/README.md +114 -0
- package/dist/global.d.ts +503 -0
- package/dist/host.d.ts +61 -0
- package/dist/inject.js +4730 -0
- package/dist/types/animate/animate.d.ts +20 -0
- package/dist/types/animate/bezier.d.ts +2 -0
- package/dist/types/animate/easings.d.ts +21 -0
- package/dist/types/canvas/Canvas.d.ts +168 -0
- package/dist/types/core/Aspect.d.ts +171 -0
- package/dist/types/core/InspectorUI.d.ts +88 -0
- package/dist/types/core/StateMachine.d.ts +81 -0
- package/dist/types/core/color.d.ts +13 -0
- package/dist/types/core/compWrite.d.ts +11 -0
- package/dist/types/core/events.d.ts +11 -0
- package/dist/types/core/fields.d.ts +58 -0
- package/dist/types/core/registry.d.ts +7 -0
- package/dist/types/core/signals.d.ts +29 -0
- package/dist/types/core/time.d.ts +31 -0
- package/dist/types/g2/Camera2D.d.ts +19 -0
- package/dist/types/g2/CharacterController2D.d.ts +134 -0
- package/dist/types/g2/Node2D.d.ts +91 -0
- package/dist/types/g2/OneWay2D.d.ts +24 -0
- package/dist/types/g2/Physics2D.d.ts +147 -0
- package/dist/types/g2/Scene2D.d.ts +72 -0
- package/dist/types/g2/Shape2D.d.ts +58 -0
- package/dist/types/g2/Sprite.d.ts +51 -0
- package/dist/types/g2/SpriteAnimation.d.ts +50 -0
- package/dist/types/g2/SpriteSheet.d.ts +69 -0
- package/dist/types/g2/Texture2D.d.ts +16 -0
- package/dist/types/g2/Tilemap.d.ts +20 -0
- package/dist/types/g2/Tileset.d.ts +32 -0
- package/dist/types/g2/Trigger2D.d.ts +20 -0
- package/dist/types/g2/autotile.d.ts +133 -0
- package/dist/types/g2/cells.d.ts +14 -0
- package/dist/types/g2/defineScene2d.d.ts +141 -0
- package/dist/types/g2/groups2d.d.ts +16 -0
- package/dist/types/g2/loop.d.ts +4 -0
- package/dist/types/g2/scenarios2d.d.ts +30 -0
- package/dist/types/g2/touch.d.ts +2 -0
- package/dist/types/gl/Camera.d.ts +79 -0
- package/dist/types/gl/CameraPlace.d.ts +26 -0
- package/dist/types/gl/CharacterController.d.ts +98 -0
- package/dist/types/gl/Gearbox.d.ts +86 -0
- package/dist/types/gl/Geometry.d.ts +39 -0
- package/dist/types/gl/IK.d.ts +53 -0
- package/dist/types/gl/InstancedMesh.d.ts +46 -0
- package/dist/types/gl/Light.d.ts +73 -0
- package/dist/types/gl/Lightmap.d.ts +85 -0
- package/dist/types/gl/Locomotion.d.ts +279 -0
- package/dist/types/gl/Material.d.ts +100 -0
- package/dist/types/gl/Mesh.d.ts +33 -0
- package/dist/types/gl/Model.d.ts +53 -0
- package/dist/types/gl/NavAgent.d.ts +99 -0
- package/dist/types/gl/NavMesh.d.ts +169 -0
- package/dist/types/gl/Node.d.ts +99 -0
- package/dist/types/gl/Noise.d.ts +20 -0
- package/dist/types/gl/Particles.d.ts +277 -0
- package/dist/types/gl/Physics.d.ts +91 -0
- package/dist/types/gl/Plane.d.ts +19 -0
- package/dist/types/gl/Ragdoll.d.ts +86 -0
- package/dist/types/gl/Ray.d.ts +8 -0
- package/dist/types/gl/Scene.d.ts +221 -0
- package/dist/types/gl/Shape.d.ts +122 -0
- package/dist/types/gl/Terrain.d.ts +280 -0
- package/dist/types/gl/Texture.d.ts +27 -0
- package/dist/types/gl/Trigger.d.ts +10 -0
- package/dist/types/gl/Vehicle.d.ts +191 -0
- package/dist/types/gl/Wheel.d.ts +95 -0
- package/dist/types/gl/animation/AnimationClip.d.ts +60 -0
- package/dist/types/gl/animation/Animator.d.ts +219 -0
- package/dist/types/gl/animation/Layer.d.ts +31 -0
- package/dist/types/gl/animation/Loop.d.ts +17 -0
- package/dist/types/gl/animation/Playback.d.ts +36 -0
- package/dist/types/gl/animation/core.d.ts +367 -0
- package/dist/types/gl/controls.d.ts +19 -0
- package/dist/types/gl/physicsEvents.d.ts +1 -0
- package/dist/types/gl/scenarios.d.ts +98 -0
- package/dist/types/gl/state.d.ts +5 -0
- package/dist/types/gl/terrainMesh.d.ts +46 -0
- package/dist/types/gl/touch.d.ts +2 -0
- package/dist/types/inject.d.ts +123 -0
- package/dist/types/math/Mathf.d.ts +39 -0
- package/dist/types/math/mat4.d.ts +66 -0
- package/dist/types/math/quat.d.ts +53 -0
- package/dist/types/math/vec.d.ts +129 -0
- package/dist/types/net/codec.d.ts +25 -0
- package/dist/types/net/core.d.ts +106 -0
- package/dist/types/net/index.d.ts +80 -0
- package/dist/types/net/replication.d.ts +101 -0
- package/dist/types/plugins/camera.d.ts +25 -0
- package/dist/types/plugins/geolocation.d.ts +39 -0
- package/dist/types/plugins/oauth.d.ts +25 -0
- package/dist/types/plugins/permission.d.ts +1 -0
- package/dist/types/plugins/push.d.ts +46 -0
- package/dist/types/plugins/qr.d.ts +21 -0
- package/dist/types/plugins/service.d.ts +33 -0
- package/dist/types/runtime/app.d.ts +67 -0
- package/dist/types/runtime/appEvents.d.ts +7 -0
- package/dist/types/runtime/channel.d.ts +1 -0
- package/dist/types/runtime/clipboard.d.ts +7 -0
- package/dist/types/runtime/datetime.d.ts +80 -0
- package/dist/types/runtime/device.d.ts +126 -0
- package/dist/types/runtime/fetch.d.ts +31 -0
- package/dist/types/runtime/files.d.ts +33 -0
- package/dist/types/runtime/input.d.ts +121 -0
- package/dist/types/runtime/media.d.ts +46 -0
- package/dist/types/runtime/misc.d.ts +11 -0
- package/dist/types/runtime/net.d.ts +15 -0
- package/dist/types/runtime/rpc.d.ts +44 -0
- package/dist/types/runtime/service.d.ts +1 -0
- package/dist/types/runtime/share.d.ts +2 -0
- package/dist/types/runtime/storage.d.ts +5 -0
- package/dist/types/runtime/touch.d.ts +56 -0
- package/dist/types/scene/defineScene.d.ts +296 -0
- package/dist/types/scene/editorPlugins.d.ts +82 -0
- package/dist/types/scene/gizmos.d.ts +56 -0
- package/dist/types/scene/grammar.d.ts +56 -0
- package/dist/types/scene/level.d.ts +98 -0
- package/dist/types/scene/material.d.ts +76 -0
- package/dist/types/server/auth/appConfig.d.ts +16 -0
- package/dist/types/server/auth/global.d.ts +56 -0
- package/dist/types/server/auth/models.d.ts +164 -0
- package/dist/types/server/auth/types.d.ts +56 -0
- package/dist/types/server/channel.d.ts +28 -0
- package/dist/types/server/context.d.ts +27 -0
- package/dist/types/server/db/defineDb.d.ts +36 -0
- package/dist/types/server/db/fields.d.ts +146 -0
- package/dist/types/server/db/index.d.ts +6 -0
- package/dist/types/server/db/marci/query.d.ts +326 -0
- package/dist/types/server/db/types.d.ts +163 -0
- package/dist/types/server/errors.d.ts +8 -0
- package/dist/types/server/inject.d.ts +5 -0
- package/dist/types/ui/NativeView.d.ts +38 -0
- package/dist/types/ui/UI.d.ts +27 -0
- package/dist/types/ui/UIBottomSheet.d.ts +71 -0
- package/dist/types/ui/UIButton.d.ts +30 -0
- package/dist/types/ui/UIContainer.d.ts +33 -0
- package/dist/types/ui/UIImage.d.ts +35 -0
- package/dist/types/ui/UIInput.d.ts +110 -0
- package/dist/types/ui/UIModal.d.ts +70 -0
- package/dist/types/ui/UINode.d.ts +363 -0
- package/dist/types/ui/UIPager.d.ts +123 -0
- package/dist/types/ui/UIPopover.d.ts +39 -0
- package/dist/types/ui/UIScreen.d.ts +57 -0
- package/dist/types/ui/UIScrollable.d.ts +40 -0
- package/dist/types/ui/UISpacer.d.ts +9 -0
- package/dist/types/ui/UITabs.d.ts +96 -0
- package/dist/types/ui/UIText.d.ts +19 -0
- package/dist/types/ui/UIVideo.d.ts +28 -0
- package/dist/types/ui/UIVirtualizedList.d.ts +97 -0
- package/dist/types/ui/UIWidget.d.ts +65 -0
- package/dist/types/ui/fonts.d.ts +9 -0
- package/dist/types/ui/presentable.d.ts +68 -0
- package/dist/types/ui/router.d.ts +40 -0
- package/dist/types/ui/theme.d.ts +26 -0
- package/dist/types.json +1 -0
- package/package.json +46 -0
- package/prompts/2d.md +395 -0
- package/prompts/3d-scene-files.md +113 -0
- package/prompts/3d-scene.md +119 -0
- package/prompts/3d.md +303 -0
- package/prompts/README.md +142 -0
- package/prompts/ar.md +109 -0
- package/prompts/canvas.md +27 -0
- package/prompts/compose.ts +46 -0
- package/prompts/concept.md +49 -0
- package/prompts/core-design.md +75 -0
- package/prompts/core.md +264 -0
- package/prompts/design.md +218 -0
- package/prompts/dist/2d-game.md +1530 -0
- package/prompts/dist/3d-app.md +1672 -0
- package/prompts/dist/ar-app.md +1548 -0
- package/prompts/dist/concept.md +49 -0
- package/prompts/dist/design.md +498 -0
- package/prompts/dist/ui-app.md +1134 -0
- package/prompts/index.md +37 -0
- package/prompts/intake-prompt.md +33 -0
- package/prompts/namer-prompt.md +12 -0
- package/prompts/router-prompt.md +50 -0
- package/prompts/select.ts +111 -0
- package/prompts/ui-design.md +203 -0
- package/prompts/ui.md +803 -0
- package/src/animate/animate.ts +238 -0
- package/src/animate/bezier.ts +138 -0
- package/src/animate/easings.ts +126 -0
- package/src/bridges.d.ts +1345 -0
- package/src/canvas/Canvas.ts +305 -0
- package/src/compile/__tests__/assetIconMacro.test.ts +219 -0
- package/src/compile/__tests__/assetMacro.test.ts +74 -0
- package/src/compile/__tests__/assetName.test.ts +55 -0
- package/src/compile/__tests__/compile.test.ts +287 -0
- package/src/compile/__tests__/detectEntry.test.ts +132 -0
- package/src/compile/__tests__/fontMacro.test.ts +199 -0
- package/src/compile/aspectMacro.ts +86 -0
- package/src/compile/assetIconMacro.ts +384 -0
- package/src/compile/assetMacro.ts +146 -0
- package/src/compile/assetName.ts +50 -0
- package/src/compile/bundler.ts +287 -0
- package/src/compile/compileProject.ts +127 -0
- package/src/compile/detectEntry.ts +128 -0
- package/src/compile/fontMacro.ts +459 -0
- package/src/compile/fontRegistry.ts +78 -0
- package/src/compile/header.ts +67 -0
- package/src/compile/index.ts +100 -0
- package/src/compile/libraryImports.ts +52 -0
- package/src/compile/liteMaterial.ts +247 -0
- package/src/compile/sceneEditor.ts +88 -0
- package/src/compile/serverSplit.ts +233 -0
- package/src/compile/serverTypes.ts +227 -0
- package/src/compile/sfnt.ts +98 -0
- package/src/compile/shaderSchema.ts +202 -0
- package/src/compile/shaderTargets.ts +77 -0
- package/src/compile/sourcemap.ts +25 -0
- package/src/core/Aspect.ts +568 -0
- package/src/core/InspectorUI.ts +212 -0
- package/src/core/StateMachine.ts +308 -0
- package/src/core/__tests__/stateMachine.test.ts +132 -0
- package/src/core/color.ts +66 -0
- package/src/core/compWrite.ts +42 -0
- package/src/core/events.ts +38 -0
- package/src/core/fields.ts +120 -0
- package/src/core/registry.ts +23 -0
- package/src/core/signals.ts +277 -0
- package/src/core/time.ts +84 -0
- package/src/g2/Camera2D.ts +40 -0
- package/src/g2/CharacterController2D.ts +276 -0
- package/src/g2/Node2D.ts +267 -0
- package/src/g2/OneWay2D.ts +66 -0
- package/src/g2/Physics2D.ts +346 -0
- package/src/g2/Scene2D.ts +209 -0
- package/src/g2/Shape2D.ts +259 -0
- package/src/g2/Sprite.ts +89 -0
- package/src/g2/SpriteAnimation.ts +171 -0
- package/src/g2/SpriteSheet.ts +166 -0
- package/src/g2/Texture2D.ts +47 -0
- package/src/g2/Tilemap.ts +41 -0
- package/src/g2/Tileset.ts +71 -0
- package/src/g2/Trigger2D.ts +77 -0
- package/src/g2/autotile.ts +433 -0
- package/src/g2/cells.ts +91 -0
- package/src/g2/defineScene2d.ts +381 -0
- package/src/g2/groups2d.ts +106 -0
- package/src/g2/loop.ts +50 -0
- package/src/g2/scenarios2d.ts +69 -0
- package/src/g2/touch.ts +83 -0
- package/src/gl/Camera.ts +160 -0
- package/src/gl/CameraPlace.ts +52 -0
- package/src/gl/CharacterController.ts +238 -0
- package/src/gl/Gearbox.ts +212 -0
- package/src/gl/Geometry.ts +279 -0
- package/src/gl/IK.ts +193 -0
- package/src/gl/InstancedMesh.ts +132 -0
- package/src/gl/Light.ts +135 -0
- package/src/gl/Lightmap.ts +402 -0
- package/src/gl/Locomotion.ts +498 -0
- package/src/gl/Material.ts +279 -0
- package/src/gl/Mesh.ts +83 -0
- package/src/gl/Model.ts +124 -0
- package/src/gl/NavAgent.ts +337 -0
- package/src/gl/NavMesh.ts +397 -0
- package/src/gl/Node.ts +350 -0
- package/src/gl/Noise.ts +30 -0
- package/src/gl/Particles.ts +676 -0
- package/src/gl/Physics.ts +222 -0
- package/src/gl/Plane.ts +53 -0
- package/src/gl/Ragdoll.ts +270 -0
- package/src/gl/Ray.ts +16 -0
- package/src/gl/Scene.ts +505 -0
- package/src/gl/Shape.ts +409 -0
- package/src/gl/Terrain.ts +1092 -0
- package/src/gl/Texture.ts +63 -0
- package/src/gl/Trigger.ts +45 -0
- package/src/gl/Vehicle.ts +473 -0
- package/src/gl/Wheel.ts +240 -0
- package/src/gl/animation/AnimationClip.ts +204 -0
- package/src/gl/animation/Animator.ts +329 -0
- package/src/gl/animation/Layer.ts +39 -0
- package/src/gl/animation/Loop.ts +31 -0
- package/src/gl/animation/Playback.ts +52 -0
- package/src/gl/animation/core.ts +670 -0
- package/src/gl/controls.ts +95 -0
- package/src/gl/physicsEvents.ts +20 -0
- package/src/gl/scenarios.ts +291 -0
- package/src/gl/state.ts +6 -0
- package/src/gl/terrainMesh.ts +219 -0
- package/src/gl/touch.ts +68 -0
- package/src/host.d.ts +61 -0
- package/src/inject.ts +203 -0
- package/src/math/Mathf.ts +118 -0
- package/src/math/mat4.ts +278 -0
- package/src/math/quat.ts +232 -0
- package/src/math/vec.ts +255 -0
- package/src/net/codec.ts +119 -0
- package/src/net/core.ts +384 -0
- package/src/net/index.ts +181 -0
- package/src/net/replication.ts +622 -0
- package/src/plugins/camera.ts +81 -0
- package/src/plugins/geolocation.ts +123 -0
- package/src/plugins/oauth.ts +61 -0
- package/src/plugins/permission.ts +7 -0
- package/src/plugins/push.ts +132 -0
- package/src/plugins/qr.ts +73 -0
- package/src/plugins/service.ts +47 -0
- package/src/runtime/app.ts +101 -0
- package/src/runtime/appEvents.ts +54 -0
- package/src/runtime/channel.ts +61 -0
- package/src/runtime/clipboard.ts +20 -0
- package/src/runtime/datetime.ts +329 -0
- package/src/runtime/device.ts +293 -0
- package/src/runtime/fetch.ts +77 -0
- package/src/runtime/files.ts +108 -0
- package/src/runtime/input.ts +175 -0
- package/src/runtime/media.ts +111 -0
- package/src/runtime/misc.ts +16 -0
- package/src/runtime/net.ts +36 -0
- package/src/runtime/rpc.ts +218 -0
- package/src/runtime/service.ts +83 -0
- package/src/runtime/share.ts +9 -0
- package/src/runtime/storage.ts +13 -0
- package/src/runtime/touch.ts +76 -0
- package/src/scene/defineScene.ts +1396 -0
- package/src/scene/editorPlugins.ts +110 -0
- package/src/scene/gizmos.ts +148 -0
- package/src/scene/grammar.ts +120 -0
- package/src/scene/level.ts +296 -0
- package/src/scene/material.ts +188 -0
- package/src/server/auth/appConfig.ts +12 -0
- package/src/server/auth/global.ts +80 -0
- package/src/server/auth/host.ts +318 -0
- package/src/server/auth/models.ts +83 -0
- package/src/server/auth/types.ts +50 -0
- package/src/server/channel.ts +56 -0
- package/src/server/context.ts +36 -0
- package/src/server/db/defineDb.ts +237 -0
- package/src/server/db/fields.ts +132 -0
- package/src/server/db/httpTransport.ts +93 -0
- package/src/server/db/index.ts +7 -0
- package/src/server/db/marci/query.ts +412 -0
- package/src/server/db/types.ts +202 -0
- package/src/server/errors.ts +12 -0
- package/src/server/host.ts +74 -0
- package/src/server/inject.ts +13 -0
- package/src/server/runtime.ts +133 -0
- package/src/server/validate.ts +87 -0
- package/src/ui/NativeView.ts +142 -0
- package/src/ui/UI.ts +39 -0
- package/src/ui/UIBottomSheet.ts +139 -0
- package/src/ui/UIButton.ts +101 -0
- package/src/ui/UIContainer.ts +60 -0
- package/src/ui/UIImage.ts +83 -0
- package/src/ui/UIInput.ts +185 -0
- package/src/ui/UIModal.ts +139 -0
- package/src/ui/UINode.ts +830 -0
- package/src/ui/UIPager.ts +362 -0
- package/src/ui/UIPopover.ts +100 -0
- package/src/ui/UIScreen.ts +123 -0
- package/src/ui/UIScrollable.ts +87 -0
- package/src/ui/UISpacer.ts +14 -0
- package/src/ui/UITabs.ts +236 -0
- package/src/ui/UIText.ts +51 -0
- package/src/ui/UIVideo.ts +88 -0
- package/src/ui/UIVirtualizedList.ts +241 -0
- package/src/ui/UIWidget.ts +127 -0
- package/src/ui/fonts.ts +13 -0
- package/src/ui/presentable.ts +117 -0
- package/src/ui/router.ts +132 -0
- package/src/ui/theme.ts +84 -0
package/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# sdk — the unified, import-free scripting API
|
|
2
|
+
|
|
3
|
+
One coherent, **import-free** syntax for le.codes projects across **2D** (creator-2d), **3D**
|
|
4
|
+
(creator-gl), **UI** (creator-ui), and the platform runtime. The whole library is delivered through
|
|
5
|
+
esbuild's `inject()`, so user code uses globals (`Scene`, `Sprite`, `Mesh`, `UIScreen`, `setLoop`, …)
|
|
6
|
+
with **no imports**; tree-shaking drops whatever a project doesn't use.
|
|
7
|
+
|
|
8
|
+
Replaces the `worker` package. See [PLAN.md](./PLAN.md) for the full design and build log.
|
|
9
|
+
|
|
10
|
+
**API reference:** the complete, curated docs live in [docs/](./docs/index.md) — every global, every
|
|
11
|
+
method, example-first. Run `bun run docs:check` to verify coverage + links.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// 2D — no imports
|
|
15
|
+
const scene = new Scene2D({ background: '#10131a' })
|
|
16
|
+
const player = new Sprite({ texture: await Texture2D.load(asset('hero.png')), anchor: [0.5, 1] })
|
|
17
|
+
.clips({ size: [32, 48], idle: [0, 1, 2, 3], walk: [4, 5, 6, 7] })
|
|
18
|
+
player.play('idle')
|
|
19
|
+
scene.add(player); scene.open()
|
|
20
|
+
scene.camera.follow(player, { smooth: 0.15 })
|
|
21
|
+
setLoop(dt => { if (Input.key('ArrowRight')) { player.x += 120 * dt; player.play('walk') } })
|
|
22
|
+
|
|
23
|
+
// 3D — no imports
|
|
24
|
+
const world = new Scene({ bloom: true })
|
|
25
|
+
const ball = Mesh.sphere({ radius: 0.5, material: Material.lit({ color: '#e33' }), position: [0, 5, 0] })
|
|
26
|
+
.physics({ motion: 'dynamic', shape: { type: 'sphere', radius: 0.5 } })
|
|
27
|
+
world.add(ball, Light.sun({ castShadows: true }))
|
|
28
|
+
world.camera.position = [0, 6, 12]; world.camera.lookAt([0, 0, 0])
|
|
29
|
+
world.open()
|
|
30
|
+
setLoop(() => { if (Input.key('Space')) ball.body.applyImpulse([0, 6, 0]) })
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Fluent math (`Vec2` / `Vec3` / `Quat` / `Mat4`)
|
|
34
|
+
|
|
35
|
+
Per-frame math reads like the formula — no imports, no out-params. Vectors are *mutable structs with
|
|
36
|
+
pure methods*: fields are settable (`v.x = 3`, `v.set(…)`), but every method returns a NEW value and
|
|
37
|
+
never mutates its source. They're iterable and accept raw tuples anywhere, so `[0, 1, 0]` works wherever
|
|
38
|
+
a vector does.
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
const dir = target.position.sub(self.position).normalize()
|
|
42
|
+
self.position = self.position.add(dir.scale(speed * dt))
|
|
43
|
+
if (a.distanceTo(b) < 2) explode()
|
|
44
|
+
node.quaternion = node.quaternion.mul(Quat.fromAxisAngle(Vec3.up, turn))
|
|
45
|
+
|
|
46
|
+
// the node API returns fresh copies (value semantics, like Unity):
|
|
47
|
+
node.x = 3 // loud single-axis nudge
|
|
48
|
+
const p = node.position; p.y = 5; node.position = p // local-mutate, then assign back
|
|
49
|
+
// node.position.x = 3 ← a no-op (mutates a discarded copy); use node.x instead
|
|
50
|
+
|
|
51
|
+
// Mat4 keeps the metal exposed (public .m) for low-level surgery:
|
|
52
|
+
let m = node.matrix.translate(pivot).rotateY(yaw * dt).translate(pivot.negate())
|
|
53
|
+
m.m[12] += vx * dt
|
|
54
|
+
node.matrix = m
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`Quat`/`Mat4` cover the rest: `Quat.fromEuler/lookRotation/slerp`, `Mat4.compose/decompose/lookAt/
|
|
58
|
+
perspective`. All of it is fuzz-tested against gl-matrix (dev-only oracle) in `tests/math.oracle.test.ts`.
|
|
59
|
+
|
|
60
|
+
## Design rules
|
|
61
|
+
|
|
62
|
+
- **No ECS / no components.** Built-in behaviors are chainable node methods (`.physics()`,
|
|
63
|
+
`.collider()`, `.clips()/.play()`); reuse is a factory function. Per-frame logic is `setLoop(dt => …)`.
|
|
64
|
+
- **Few globals.** Variants are static factory methods (`Mesh.box()`, `Material.lit()`,
|
|
65
|
+
`Texture2D.load()`), not free functions.
|
|
66
|
+
- **Pure re-skin.** Calls the existing `_creator` / `_creator2d` / `_creatorUI` / `_creatorUtils`
|
|
67
|
+
host bridges — no native engine changes.
|
|
68
|
+
|
|
69
|
+
## Layout
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
src/
|
|
73
|
+
inject.ts # THE aggregation point — the only file that exports public globals
|
|
74
|
+
bridges.d.ts # ambient host ABI (_creator*, declared, never bundled)
|
|
75
|
+
host.d.ts # ambient host runtime globals (setLoop, console, DEG2RAD, asset)
|
|
76
|
+
core/ # handle registry, color, event Emitter
|
|
77
|
+
math/ # Mathf (scalar) + fluent Vec2/Vec3 (vec), Quat (quat), Mat4 (mat4) — no gl-matrix shipped
|
|
78
|
+
runtime/ # fetch, storage, device, input, media, net, files, touch, misc
|
|
79
|
+
g2/ # 2D: Scene2D, Node2D, Sprite, Tilemap, Texture2D, Camera2D
|
|
80
|
+
gl/ # 3D: Scene, ARScene, Node, Mesh, Light, Material, Geometry, Texture,
|
|
81
|
+
# Camera, Ray, Plane, Noise, Particles
|
|
82
|
+
ui/ # UIScreen/Row/Column/Text/Button/… + Router + registerFont
|
|
83
|
+
animate/ # animate, cubicBezier, easings
|
|
84
|
+
plugins/ # optional, host-provided capabilities (QRScanner, CameraView) — gated on host support
|
|
85
|
+
compile/ # the user-project compiler (bundler + header + compileProject) — backend/CLI use it
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Build & test
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
bun run build # → dist/inject.js (runtime), dist/global.d.ts + host.d.ts + types.json (editor types)
|
|
92
|
+
bun test # compile/parity + math/color + 2D + 3D-runtime + UI tests
|
|
93
|
+
bun run typecheck # tsc --noEmit
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`tests/headless/` holds live WebGL2 render harnesses (manual; need chrome-headless-shell). The 2D
|
|
97
|
+
harness is green: a project compiled through the real `compileProject` renders correct pixels.
|
|
98
|
+
|
|
99
|
+
## How it integrates
|
|
100
|
+
|
|
101
|
+
The backend (`backend/src/utils/compileProject.ts`) and CLI (`lecodes-cli`) compile **every** user
|
|
102
|
+
project through this SDK (`sdk/compile`) — the legacy `worker` path was removed from user-project
|
|
103
|
+
compilation. A bare `import` from a runtime module (`creator`/`ui`/`animate`/`utils`/`2d`) is no longer
|
|
104
|
+
special-cased; it's just an unresolved import, so the build fails loudly and points at the file. The
|
|
105
|
+
`worker` package still exists for internal tooling (scene-viewer / model-preview), not for user code.
|
|
106
|
+
|
|
107
|
+
## Deferred (API present, native pending)
|
|
108
|
+
|
|
109
|
+
- 2D physics / collider triggers (`.collider()` is a no-op stub; `Node2D.add()` hierarchy).
|
|
110
|
+
- Live 2D↔3D engine switching is wired in the viewer host (two canvases) but pending a real dual
|
|
111
|
+
project to verify.
|
|
112
|
+
|
|
113
|
+
`ARScene.addControls(target, options?)` ports the AR object-placement gesture recipe (one-finger drag,
|
|
114
|
+
two-finger pinch-scale + twist-rotate) onto the fluent math; returns a `{ remove() }` handle.
|
package/dist/global.d.ts
ADDED
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
// AUTO-GENERATED by build-types.ts. The import-free type surface for le.codes projects:
|
|
2
|
+
// every SDK global declared ambiently, so user code uses Scene / Sprite / UIScreen / …
|
|
3
|
+
// with no imports and full editor autocomplete.
|
|
4
|
+
|
|
5
|
+
import type * as SDK from "./types/inject"
|
|
6
|
+
import type * as SERVER from "./types/server/inject"
|
|
7
|
+
|
|
8
|
+
declare global {
|
|
9
|
+
const ARScene: typeof SDK.ARScene
|
|
10
|
+
const AnimationClip: typeof SDK.AnimationClip
|
|
11
|
+
const Animator: typeof SDK.Animator
|
|
12
|
+
const Aspect: typeof SDK.Aspect
|
|
13
|
+
const AudioPlayer: typeof SDK.AudioPlayer
|
|
14
|
+
const Autotile2D: typeof SDK.Autotile2D
|
|
15
|
+
const Bitmap: typeof SDK.Bitmap
|
|
16
|
+
const Camera: typeof SDK.Camera
|
|
17
|
+
const Camera2D: typeof SDK.Camera2D
|
|
18
|
+
const CameraFollow: typeof SDK.CameraFollow
|
|
19
|
+
const CameraPlace: typeof SDK.CameraPlace
|
|
20
|
+
const CameraView: typeof SDK.CameraView
|
|
21
|
+
const Canvas: typeof SDK.Canvas
|
|
22
|
+
const CharacterController: typeof SDK.CharacterController
|
|
23
|
+
const CharacterController2D: typeof SDK.CharacterController2D
|
|
24
|
+
const ClickEvent: typeof SDK.ClickEvent
|
|
25
|
+
const Color: typeof SDK.Color
|
|
26
|
+
const DateValue: typeof SDK.DateValue
|
|
27
|
+
const File: typeof SDK.File
|
|
28
|
+
const FollowPath: typeof SDK.FollowPath
|
|
29
|
+
const FormData: typeof SDK.FormData
|
|
30
|
+
const Gearbox: typeof SDK.Gearbox
|
|
31
|
+
const Geolocation: typeof SDK.Geolocation
|
|
32
|
+
const Geometry: typeof SDK.Geometry
|
|
33
|
+
const Gizmos: typeof SDK.Gizmos
|
|
34
|
+
const IK: typeof SDK.IK
|
|
35
|
+
const Input: typeof SDK.Input
|
|
36
|
+
const InputChannel: typeof SDK.InputChannel
|
|
37
|
+
const InspectorUI: typeof SDK.InspectorUI
|
|
38
|
+
const InstancedMesh: typeof SDK.InstancedMesh
|
|
39
|
+
const Layer: typeof SDK.Layer
|
|
40
|
+
const Level: typeof SDK.Level
|
|
41
|
+
const Light: typeof SDK.Light
|
|
42
|
+
const Lightmap: typeof SDK.Lightmap
|
|
43
|
+
const Locomotion: typeof SDK.Locomotion
|
|
44
|
+
const LongPressEvent: typeof SDK.LongPressEvent
|
|
45
|
+
const LookAt: typeof SDK.LookAt
|
|
46
|
+
const Loop: typeof SDK.Loop
|
|
47
|
+
const Mat4: typeof SDK.Mat4
|
|
48
|
+
const Material: typeof SDK.Material
|
|
49
|
+
const MaterialHandle: typeof SDK.MaterialHandle
|
|
50
|
+
const Mathf: typeof SDK.Mathf
|
|
51
|
+
const Mesh: typeof SDK.Mesh
|
|
52
|
+
const Model: typeof SDK.Model
|
|
53
|
+
const MoveTo: typeof SDK.MoveTo
|
|
54
|
+
const NativeView: typeof SDK.NativeView
|
|
55
|
+
const NavAgent: typeof SDK.NavAgent
|
|
56
|
+
const NavCrowd: typeof SDK.NavCrowd
|
|
57
|
+
const NavMesh: typeof SDK.NavMesh
|
|
58
|
+
const Net: typeof SDK.Net
|
|
59
|
+
const NetEntity: typeof SDK.NetEntity
|
|
60
|
+
const NetPlayer: typeof SDK.NetPlayer
|
|
61
|
+
const Node: typeof SDK.Node
|
|
62
|
+
const Node2D: typeof SDK.Node2D
|
|
63
|
+
const Noise: typeof SDK.Noise
|
|
64
|
+
const OAuth: typeof SDK.OAuth
|
|
65
|
+
const OneWay2D: typeof SDK.OneWay2D
|
|
66
|
+
const Particles: typeof SDK.Particles
|
|
67
|
+
const Physics: typeof SDK.Physics
|
|
68
|
+
const Physics2D: typeof SDK.Physics2D
|
|
69
|
+
const PhysicsGroup2D: typeof SDK.PhysicsGroup2D
|
|
70
|
+
const Plane: typeof SDK.Plane
|
|
71
|
+
const PlayAnimation: typeof SDK.PlayAnimation
|
|
72
|
+
const Playback: typeof SDK.Playback
|
|
73
|
+
const Presentable: typeof SDK.Presentable
|
|
74
|
+
const Push: typeof SDK.Push
|
|
75
|
+
const QRScanner: typeof SDK.QRScanner
|
|
76
|
+
const Quat: typeof SDK.Quat
|
|
77
|
+
const Ragdoll: typeof SDK.Ragdoll
|
|
78
|
+
const Ray: typeof SDK.Ray
|
|
79
|
+
const Replicated: typeof SDK.Replicated
|
|
80
|
+
const Router: typeof SDK.Router
|
|
81
|
+
const RpcError: typeof SDK.RpcError
|
|
82
|
+
const Scene: typeof SDK.Scene
|
|
83
|
+
const Scene2D: typeof SDK.Scene2D
|
|
84
|
+
const Scene2dHandle: typeof SDK.Scene2dHandle
|
|
85
|
+
const SceneHandle: typeof SDK.SceneHandle
|
|
86
|
+
const Service: typeof SDK.Service
|
|
87
|
+
const Shape: typeof SDK.Shape
|
|
88
|
+
const Shape2D: typeof SDK.Shape2D
|
|
89
|
+
const Spin: typeof SDK.Spin
|
|
90
|
+
const Sprite: typeof SDK.Sprite
|
|
91
|
+
const SpriteAnimation: typeof SDK.SpriteAnimation
|
|
92
|
+
const SpriteSheet: typeof SDK.SpriteSheet
|
|
93
|
+
const StateMachine: typeof SDK.StateMachine
|
|
94
|
+
const SvgSource: typeof SDK.SvgSource
|
|
95
|
+
const System: typeof SDK.System
|
|
96
|
+
const Terrain: typeof SDK.Terrain
|
|
97
|
+
const Texture: typeof SDK.Texture
|
|
98
|
+
const Texture2D: typeof SDK.Texture2D
|
|
99
|
+
const Tilemap: typeof SDK.Tilemap
|
|
100
|
+
const Tileset: typeof SDK.Tileset
|
|
101
|
+
const Time: typeof SDK.Time
|
|
102
|
+
const TouchStartEvent: typeof SDK.TouchStartEvent
|
|
103
|
+
const Trail: typeof SDK.Trail
|
|
104
|
+
const Trigger: typeof SDK.Trigger
|
|
105
|
+
const Trigger2D: typeof SDK.Trigger2D
|
|
106
|
+
const UIBottomSheet: typeof SDK.UIBottomSheet
|
|
107
|
+
const UIBox: typeof SDK.UIBox
|
|
108
|
+
const UIButton: typeof SDK.UIButton
|
|
109
|
+
const UIColumn: typeof SDK.UIColumn
|
|
110
|
+
const UIImage: typeof SDK.UIImage
|
|
111
|
+
const UIInput: typeof SDK.UIInput
|
|
112
|
+
const UIModal: typeof SDK.UIModal
|
|
113
|
+
const UIPager: typeof SDK.UIPager
|
|
114
|
+
const UIPopover: typeof SDK.UIPopover
|
|
115
|
+
const UIRow: typeof SDK.UIRow
|
|
116
|
+
const UIScreen: typeof SDK.UIScreen
|
|
117
|
+
const UIScrollable: typeof SDK.UIScrollable
|
|
118
|
+
const UISpacer: typeof SDK.UISpacer
|
|
119
|
+
const UITabs: typeof SDK.UITabs
|
|
120
|
+
const UIText: typeof SDK.UIText
|
|
121
|
+
const UITextArea: typeof SDK.UITextArea
|
|
122
|
+
const UIVideo: typeof SDK.UIVideo
|
|
123
|
+
const UIVirtualizedList: typeof SDK.UIVirtualizedList
|
|
124
|
+
const UIWidget: typeof SDK.UIWidget
|
|
125
|
+
const VRScene: typeof SDK.VRScene
|
|
126
|
+
const Vec2: typeof SDK.Vec2
|
|
127
|
+
const Vec3: typeof SDK.Vec3
|
|
128
|
+
const Vehicle: typeof SDK.Vehicle
|
|
129
|
+
const VideoPlayer: typeof SDK.VideoPlayer
|
|
130
|
+
const WebSocket: typeof SDK.WebSocket
|
|
131
|
+
const Wheel: typeof SDK.Wheel
|
|
132
|
+
const __GizmoBuffer: typeof SDK.__GizmoBuffer
|
|
133
|
+
const __UIBox: typeof SDK.__UIBox
|
|
134
|
+
const __UIButton: typeof SDK.__UIButton
|
|
135
|
+
const __UIColumn: typeof SDK.__UIColumn
|
|
136
|
+
const __UIRow: typeof SDK.__UIRow
|
|
137
|
+
const __UIScreen: typeof SDK.__UIScreen
|
|
138
|
+
const __UIScrollable: typeof SDK.__UIScrollable
|
|
139
|
+
const __UIWidget: typeof SDK.__UIWidget
|
|
140
|
+
const __applyEditorPose: typeof SDK.__applyEditorPose
|
|
141
|
+
const __applyMaterialParam: typeof SDK.__applyMaterialParam
|
|
142
|
+
const __assignMaterialDef: typeof SDK.__assignMaterialDef
|
|
143
|
+
const __channel: typeof SDK.__channel
|
|
144
|
+
const __compOp: typeof SDK.__compOp
|
|
145
|
+
const __compWrite: typeof SDK.__compWrite
|
|
146
|
+
const __editorPlugins: typeof SDK.__editorPlugins
|
|
147
|
+
const __rpc: typeof SDK.__rpc
|
|
148
|
+
const __serverOnly: typeof SDK.__serverOnly
|
|
149
|
+
const __uiMap: typeof SDK.__uiMap
|
|
150
|
+
const __withGizmoScope: typeof SDK.__withGizmoScope
|
|
151
|
+
const animate: typeof SDK.animate
|
|
152
|
+
const animateMat4: typeof SDK.animateMat4
|
|
153
|
+
const app: typeof SDK.app
|
|
154
|
+
const cells: typeof SDK.cells
|
|
155
|
+
const clipboard: typeof SDK.clipboard
|
|
156
|
+
const colorCurve: typeof SDK.colorCurve
|
|
157
|
+
const computed: typeof SDK.computed
|
|
158
|
+
const cubicBezier: typeof SDK.cubicBezier
|
|
159
|
+
const curve: typeof SDK.curve
|
|
160
|
+
const date: typeof SDK.date
|
|
161
|
+
const defineMaterial: typeof SDK.defineMaterial
|
|
162
|
+
const defineScene: typeof SDK.defineScene
|
|
163
|
+
const defineScene2d: typeof SDK.defineScene2d
|
|
164
|
+
const defineSpriteSheet: typeof SDK.defineSpriteSheet
|
|
165
|
+
const defineStates: typeof SDK.defineStates
|
|
166
|
+
const defineTabs: typeof SDK.defineTabs
|
|
167
|
+
const defineTileset: typeof SDK.defineTileset
|
|
168
|
+
const device: typeof SDK.device
|
|
169
|
+
const easeIn: typeof SDK.easeIn
|
|
170
|
+
const easeInOut: typeof SDK.easeInOut
|
|
171
|
+
const easeOut: typeof SDK.easeOut
|
|
172
|
+
const effect: typeof SDK.effect
|
|
173
|
+
const encodeCells: typeof SDK.encodeCells
|
|
174
|
+
const fetch: typeof SDK.fetch
|
|
175
|
+
const fetchLocal: typeof SDK.fetchLocal
|
|
176
|
+
const files: typeof SDK.files
|
|
177
|
+
const flipX: typeof SDK.flipX
|
|
178
|
+
const isRawCell: typeof SDK.isRawCell
|
|
179
|
+
const localStorage: typeof SDK.localStorage
|
|
180
|
+
const make: typeof SDK.make
|
|
181
|
+
const openFilePicker: typeof SDK.openFilePicker
|
|
182
|
+
const openURL: typeof SDK.openURL
|
|
183
|
+
const packTile: typeof SDK.packTile
|
|
184
|
+
const pauseAnimation: typeof SDK.pauseAnimation
|
|
185
|
+
const rawCell: typeof SDK.rawCell
|
|
186
|
+
const rawIndex: typeof SDK.rawIndex
|
|
187
|
+
const ref: typeof SDK.ref
|
|
188
|
+
const registerEditorTool: typeof SDK.registerEditorTool
|
|
189
|
+
const registerEditorWindow: typeof SDK.registerEditorWindow
|
|
190
|
+
const registerFont: typeof SDK.registerFont
|
|
191
|
+
const resumeAnimation: typeof SDK.resumeAnimation
|
|
192
|
+
const rot180: typeof SDK.rot180
|
|
193
|
+
const rot270: typeof SDK.rot270
|
|
194
|
+
const rot90: typeof SDK.rot90
|
|
195
|
+
const share: typeof SDK.share
|
|
196
|
+
const signal: typeof SDK.signal
|
|
197
|
+
const stopAnimation: typeof SDK.stopAnimation
|
|
198
|
+
const theme: typeof SDK.theme
|
|
199
|
+
const tileFlip: typeof SDK.tileFlip
|
|
200
|
+
const tileIndex: typeof SDK.tileIndex
|
|
201
|
+
const tileOriented: typeof SDK.tileOriented
|
|
202
|
+
const tileTurns: typeof SDK.tileTurns
|
|
203
|
+
const toast: typeof SDK.toast
|
|
204
|
+
const use: typeof SDK.use
|
|
205
|
+
type ARScene<T extends ARMode = "default"> = SDK.ARScene<T>
|
|
206
|
+
type ActiveClip = SDK.ActiveClip
|
|
207
|
+
type AeroConfig = SDK.AeroConfig
|
|
208
|
+
type AnimationClip = SDK.AnimationClip
|
|
209
|
+
type Animator = SDK.Animator
|
|
210
|
+
type AppState = SDK.AppState
|
|
211
|
+
type Aspect<K extends string, P = Node, E extends EventMap = {}> = SDK.Aspect<K, P, E>
|
|
212
|
+
type AspectEntry<A extends Aspect<any, any> = Aspect<any, any>> = SDK.AspectEntry<A>
|
|
213
|
+
type AudioPlayer = SDK.AudioPlayer
|
|
214
|
+
type AutoPaintRules = SDK.AutoPaintRules
|
|
215
|
+
type Autotile2D = SDK.Autotile2D
|
|
216
|
+
type Bitmap = SDK.Bitmap
|
|
217
|
+
type BlendPosition = SDK.BlendPosition
|
|
218
|
+
type BlockEntry = SDK.BlockEntry
|
|
219
|
+
type Camera = SDK.Camera
|
|
220
|
+
type Camera2D = SDK.Camera2D
|
|
221
|
+
type Camera2dNodeDef = SDK.Camera2dNodeDef
|
|
222
|
+
type CameraFacing = SDK.CameraFacing
|
|
223
|
+
type CameraFollow = SDK.CameraFollow
|
|
224
|
+
type CameraNodeDef = SDK.CameraNodeDef
|
|
225
|
+
type CameraPlace = SDK.CameraPlace
|
|
226
|
+
type CameraView = SDK.CameraView
|
|
227
|
+
type Canvas = SDK.Canvas
|
|
228
|
+
type CellsData = SDK.CellsData
|
|
229
|
+
type CharacterController = SDK.CharacterController
|
|
230
|
+
type CharacterController2D = SDK.CharacterController2D
|
|
231
|
+
type ClickEvent<T = any> = SDK.ClickEvent<T>
|
|
232
|
+
type ClientChannel<E extends Record<string, unknown> = Record<string, unknown>> = SDK.ClientChannel<E>
|
|
233
|
+
type ClipDef = SDK.ClipDef
|
|
234
|
+
type ClipKey<V> = SDK.ClipKey<V>
|
|
235
|
+
type ClipTrackDef = SDK.ClipTrackDef
|
|
236
|
+
type CompAxis = SDK.CompAxis
|
|
237
|
+
type CompWriter = SDK.CompWriter
|
|
238
|
+
type Computed<T> = SDK.Computed<T>
|
|
239
|
+
type ConformOptions = SDK.ConformOptions
|
|
240
|
+
type DateInput = SDK.DateInput
|
|
241
|
+
type DateValue = SDK.DateValue
|
|
242
|
+
type DifferentialMode = SDK.DifferentialMode
|
|
243
|
+
type Displacement = SDK.Displacement
|
|
244
|
+
type DriveLayout = SDK.DriveLayout
|
|
245
|
+
type EdgeSlot = SDK.EdgeSlot
|
|
246
|
+
type EditorApi = SDK.EditorApi
|
|
247
|
+
type EditorRayHit = SDK.EditorRayHit
|
|
248
|
+
type EditorToolHooks = SDK.EditorToolHooks
|
|
249
|
+
type EditorWindowFn = SDK.EditorWindowFn
|
|
250
|
+
type EngineConfig = SDK.EngineConfig
|
|
251
|
+
type EventMap = SDK.EventMap
|
|
252
|
+
type FeetOptions = SDK.FeetOptions
|
|
253
|
+
type FetchResponse = SDK.FetchResponse
|
|
254
|
+
type FieldMeta<T = unknown> = SDK.FieldMeta<T>
|
|
255
|
+
type File = SDK.File
|
|
256
|
+
type FileData = SDK.FileData
|
|
257
|
+
type FillBlock = SDK.FillBlock
|
|
258
|
+
type FollowPath = SDK.FollowPath
|
|
259
|
+
type FootState = SDK.FootState
|
|
260
|
+
type FormData = SDK.FormData
|
|
261
|
+
type Gait = SDK.Gait
|
|
262
|
+
type GamepadAxisName = SDK.GamepadAxisName
|
|
263
|
+
type GamepadState = SDK.GamepadState
|
|
264
|
+
type Gearbox = SDK.Gearbox
|
|
265
|
+
type GeoOptions = SDK.GeoOptions
|
|
266
|
+
type GeoPosition = SDK.GeoPosition
|
|
267
|
+
type GeoWatch = SDK.GeoWatch
|
|
268
|
+
type Geometry = SDK.Geometry
|
|
269
|
+
type GizmoAnchor = SDK.GizmoAnchor
|
|
270
|
+
type GizmoStyle = SDK.GizmoStyle
|
|
271
|
+
type HapticStyle = SDK.HapticStyle
|
|
272
|
+
type IKLookAt = SDK.IKLookAt
|
|
273
|
+
type IKTwoBone = SDK.IKTwoBone
|
|
274
|
+
type InputEventName = SDK.InputEventName
|
|
275
|
+
type InputGamepadEvent = SDK.InputGamepadEvent
|
|
276
|
+
type InputKeyEvent = SDK.InputKeyEvent
|
|
277
|
+
type InspectorUI = SDK.InspectorUI
|
|
278
|
+
type InstanceTransform = SDK.InstanceTransform
|
|
279
|
+
type InstancedMesh = SDK.InstancedMesh
|
|
280
|
+
type Layer = SDK.Layer
|
|
281
|
+
type LayerOptions = SDK.LayerOptions
|
|
282
|
+
type LevelBuild = SDK.LevelBuild
|
|
283
|
+
type LevelCollider = SDK.LevelCollider
|
|
284
|
+
type LevelGridOptions = SDK.LevelGridOptions
|
|
285
|
+
type LevelLineOptions = SDK.LevelLineOptions
|
|
286
|
+
type LevelPlaceOptions = SDK.LevelPlaceOptions
|
|
287
|
+
type LevelRingOptions = SDK.LevelRingOptions
|
|
288
|
+
type LevelScatterOptions = SDK.LevelScatterOptions
|
|
289
|
+
type LevelSpot = SDK.LevelSpot
|
|
290
|
+
type Light = SDK.Light
|
|
291
|
+
type LightDef = SDK.LightDef
|
|
292
|
+
type Lightmap = SDK.Lightmap
|
|
293
|
+
type LitMaterialDef = SDK.LitMaterialDef
|
|
294
|
+
type LoadedScene<D extends SceneDef> = SDK.LoadedScene<D>
|
|
295
|
+
type LoadedScene2d<D extends Scene2dDef> = SDK.LoadedScene2d<D>
|
|
296
|
+
type Locale = SDK.Locale
|
|
297
|
+
type Locomotion = SDK.Locomotion
|
|
298
|
+
type LocomotionClip = SDK.LocomotionClip
|
|
299
|
+
type LocomotionEvents = SDK.LocomotionEvents
|
|
300
|
+
type LocomotionSet = SDK.LocomotionSet
|
|
301
|
+
type LocomotionState = SDK.LocomotionState
|
|
302
|
+
type LocomotionTuning = SDK.LocomotionTuning
|
|
303
|
+
type LongPressEvent<T = any> = SDK.LongPressEvent<T>
|
|
304
|
+
type LookAt = SDK.LookAt
|
|
305
|
+
type Loop = SDK.Loop
|
|
306
|
+
type LoopDef = SDK.LoopDef
|
|
307
|
+
type LoopOptions = SDK.LoopOptions
|
|
308
|
+
type MakeEntry<A extends Record<string, unknown> = Record<string, unknown>> = SDK.MakeEntry<A>
|
|
309
|
+
type Mat4 = SDK.Mat4
|
|
310
|
+
type Material = SDK.Material
|
|
311
|
+
type MaterialData = SDK.MaterialData
|
|
312
|
+
type MaterialDef = SDK.MaterialDef
|
|
313
|
+
type MaterialHandle = SDK.MaterialHandle
|
|
314
|
+
type MaterialParamValue = SDK.MaterialParamValue
|
|
315
|
+
type Mesh = SDK.Mesh
|
|
316
|
+
type MeshDef = SDK.MeshDef
|
|
317
|
+
type Model = SDK.Model
|
|
318
|
+
type MotionOptions = SDK.MotionOptions
|
|
319
|
+
type MoveTo = SDK.MoveTo
|
|
320
|
+
type NativeView = SDK.NativeView
|
|
321
|
+
type NavAgent = SDK.NavAgent
|
|
322
|
+
type NavAgentAvoidance = SDK.NavAgentAvoidance
|
|
323
|
+
type NavAgentDrive = SDK.NavAgentDrive
|
|
324
|
+
type NavAgentEvents = SDK.NavAgentEvents
|
|
325
|
+
type NavAgentSize = SDK.NavAgentSize
|
|
326
|
+
type NavAgentState = SDK.NavAgentState
|
|
327
|
+
type NavCrowd = SDK.NavCrowd
|
|
328
|
+
type NavMesh = SDK.NavMesh
|
|
329
|
+
type NavMeshInfo = SDK.NavMeshInfo
|
|
330
|
+
type NavMeshLoadOptions = SDK.NavMeshLoadOptions
|
|
331
|
+
type NavPath = SDK.NavPath
|
|
332
|
+
type NavQueryOptions = SDK.NavQueryOptions
|
|
333
|
+
type NavRaycastHit = SDK.NavRaycastHit
|
|
334
|
+
type NetEntity<S extends object = any> = SDK.NetEntity<S>
|
|
335
|
+
type NetEvents = SDK.NetEvents
|
|
336
|
+
type NetInput<T extends object = any> = SDK.NetInput<T>
|
|
337
|
+
type NetKind<S extends object = any> = SDK.NetKind<S>
|
|
338
|
+
type NetLaunch = SDK.NetLaunch
|
|
339
|
+
type NetMessage<T = unknown> = SDK.NetMessage<T>
|
|
340
|
+
type NetPlayer = SDK.NetPlayer
|
|
341
|
+
type NetRole = SDK.NetRole
|
|
342
|
+
type NetStatus = SDK.NetStatus
|
|
343
|
+
type NetTransform = SDK.NetTransform
|
|
344
|
+
type Node = SDK.Node
|
|
345
|
+
type Node2D = SDK.Node2D
|
|
346
|
+
type Noise = SDK.Noise
|
|
347
|
+
type OAuthCredential = SDK.OAuthCredential
|
|
348
|
+
type OAuthProviderName = SDK.OAuthProviderName
|
|
349
|
+
type OneWay2D = SDK.OneWay2D
|
|
350
|
+
type OrientationLock = SDK.OrientationLock
|
|
351
|
+
type Particles = SDK.Particles
|
|
352
|
+
type PatchMaterial = SDK.PatchMaterial
|
|
353
|
+
type PatchSlots = SDK.PatchSlots
|
|
354
|
+
type PathMaterial = SDK.PathMaterial
|
|
355
|
+
type Physics = SDK.Physics
|
|
356
|
+
type Physics2D = SDK.Physics2D
|
|
357
|
+
type PhysicsGroup2D = SDK.PhysicsGroup2D
|
|
358
|
+
type Plane = SDK.Plane
|
|
359
|
+
type PlayAnimation = SDK.PlayAnimation
|
|
360
|
+
type PlayOptions = SDK.PlayOptions
|
|
361
|
+
type Playback = SDK.Playback
|
|
362
|
+
type PresentOptions = SDK.PresentOptions
|
|
363
|
+
type Presentable = SDK.Presentable
|
|
364
|
+
type PushEvent = SDK.PushEvent
|
|
365
|
+
type PushPayload = SDK.PushPayload
|
|
366
|
+
type PushRegisterOptions = SDK.PushRegisterOptions
|
|
367
|
+
type PushStatus = SDK.PushStatus
|
|
368
|
+
type QRScanner = SDK.QRScanner
|
|
369
|
+
type Quat = SDK.Quat
|
|
370
|
+
type Ragdoll = SDK.Ragdoll
|
|
371
|
+
type RagdollHinge = SDK.RagdollHinge
|
|
372
|
+
type RagdollPart = SDK.RagdollPart
|
|
373
|
+
type Ray = SDK.Ray
|
|
374
|
+
type Replicated = SDK.Replicated
|
|
375
|
+
type RibbonOptions = SDK.RibbonOptions
|
|
376
|
+
type RpcError = SDK.RpcError
|
|
377
|
+
type Scene = SDK.Scene
|
|
378
|
+
type Scene2D = SDK.Scene2D
|
|
379
|
+
type Scene2dDef = SDK.Scene2dDef
|
|
380
|
+
type Scene2dEnv = SDK.Scene2dEnv
|
|
381
|
+
type Scene2dHandle<D extends Scene2dDef = Scene2dDef> = SDK.Scene2dHandle<D>
|
|
382
|
+
type Scene2dNodeDef = SDK.Scene2dNodeDef
|
|
383
|
+
type SceneDef = SDK.SceneDef
|
|
384
|
+
type SceneHandle<D extends SceneDef = SceneDef> = SDK.SceneHandle<D>
|
|
385
|
+
type SceneInstance<D extends SceneDef> = SDK.SceneInstance<D>
|
|
386
|
+
type SceneNodeDef = SDK.SceneNodeDef
|
|
387
|
+
type SculptOptions = SDK.SculptOptions
|
|
388
|
+
type Service = SDK.Service
|
|
389
|
+
type ShaderMaterialDef = SDK.ShaderMaterialDef
|
|
390
|
+
type Shape = SDK.Shape
|
|
391
|
+
type Shape2D = SDK.Shape2D
|
|
392
|
+
type SheetSprite = SDK.SheetSprite
|
|
393
|
+
type Signal<T> = SDK.Signal<T>
|
|
394
|
+
type Spin = SDK.Spin
|
|
395
|
+
type Sprite = SDK.Sprite
|
|
396
|
+
type SpriteAnimation = SDK.SpriteAnimation
|
|
397
|
+
type SpriteMakeOptions = SDK.SpriteMakeOptions
|
|
398
|
+
type SpriteSheet = SDK.SpriteSheet
|
|
399
|
+
type SpriteSheetDef = SDK.SpriteSheetDef
|
|
400
|
+
type SpriteSourceDef = SDK.SpriteSourceDef
|
|
401
|
+
type StateDef<C> = SDK.StateDef<C>
|
|
402
|
+
type StateGuard<C> = SDK.StateGuard<C>
|
|
403
|
+
type StateHandler<C> = SDK.StateHandler<C>
|
|
404
|
+
type StateMachine<C> = SDK.StateMachine<C>
|
|
405
|
+
type StateMachineEvents = SDK.StateMachineEvents
|
|
406
|
+
type StatesDef<C> = SDK.StatesDef<C>
|
|
407
|
+
type SteeringConfig = SDK.SteeringConfig
|
|
408
|
+
type StopOptions = SDK.StopOptions
|
|
409
|
+
type System<K extends string, S extends SystemHost = Scene, E extends EventMap = {}> = SDK.System<K, S, E>
|
|
410
|
+
type SystemHost = SDK.SystemHost
|
|
411
|
+
type TabDef = SDK.TabDef
|
|
412
|
+
type TabsHandle<T extends Record<string, TabDef>> = SDK.TabsHandle<T>
|
|
413
|
+
type Terrain = SDK.Terrain
|
|
414
|
+
type TerrainHit = SDK.TerrainHit
|
|
415
|
+
type TerrainLayer = SDK.TerrainLayer
|
|
416
|
+
type TerrainOptions = SDK.TerrainOptions
|
|
417
|
+
type TerrainRegion = SDK.TerrainRegion
|
|
418
|
+
type TerrainSnapshot = SDK.TerrainSnapshot
|
|
419
|
+
type Texture = SDK.Texture
|
|
420
|
+
type Texture2D = SDK.Texture2D
|
|
421
|
+
type ThemeAccessors<T> = SDK.ThemeAccessors<T>
|
|
422
|
+
type ThemeValues = SDK.ThemeValues
|
|
423
|
+
type TileBlock = SDK.TileBlock
|
|
424
|
+
type TileMaterial = SDK.TileMaterial
|
|
425
|
+
type TilePart = SDK.TilePart
|
|
426
|
+
type Tilemap = SDK.Tilemap
|
|
427
|
+
type TilemapSourceDef = SDK.TilemapSourceDef
|
|
428
|
+
type Tileset = SDK.Tileset
|
|
429
|
+
type TilesetDef = SDK.TilesetDef
|
|
430
|
+
type TireCurve = SDK.TireCurve
|
|
431
|
+
type TouchStartEvent<T = any> = SDK.TouchStartEvent<T>
|
|
432
|
+
type Trail = SDK.Trail
|
|
433
|
+
type Transition = SDK.Transition
|
|
434
|
+
type TransitionName = SDK.TransitionName
|
|
435
|
+
type TransitionSpec = SDK.TransitionSpec
|
|
436
|
+
type TransitionTransform = SDK.TransitionTransform
|
|
437
|
+
type Trigger = SDK.Trigger
|
|
438
|
+
type Trigger2D = SDK.Trigger2D
|
|
439
|
+
type UIBottomSheet = SDK.UIBottomSheet
|
|
440
|
+
type UIBottomSheetStyle = SDK.UIBottomSheetStyle
|
|
441
|
+
type UIBox = SDK.UIBox
|
|
442
|
+
type UIButton = SDK.UIButton
|
|
443
|
+
type UIButtonStyle = SDK.UIButtonStyle
|
|
444
|
+
type UIColumn = SDK.UIColumn
|
|
445
|
+
type UIContainerStyle = SDK.UIContainerStyle
|
|
446
|
+
type UIImage = SDK.UIImage
|
|
447
|
+
type UIImageStyle = SDK.UIImageStyle
|
|
448
|
+
type UIInput = SDK.UIInput
|
|
449
|
+
type UIInputStyle = SDK.UIInputStyle
|
|
450
|
+
type UIModal = SDK.UIModal
|
|
451
|
+
type UIModalStyle = SDK.UIModalStyle
|
|
452
|
+
type UINativeViewStyle = SDK.UINativeViewStyle
|
|
453
|
+
type UINode = SDK.UINode
|
|
454
|
+
type UINodeChild = SDK.UINodeChild
|
|
455
|
+
type UIPager = SDK.UIPager
|
|
456
|
+
type UIPagerStyle = SDK.UIPagerStyle
|
|
457
|
+
type UIPopover = SDK.UIPopover
|
|
458
|
+
type UIPopoverStyle = SDK.UIPopoverStyle
|
|
459
|
+
type UIRow = SDK.UIRow
|
|
460
|
+
type UIScreen = SDK.UIScreen
|
|
461
|
+
type UIScreenStyle = SDK.UIScreenStyle
|
|
462
|
+
type UIScrollable = SDK.UIScrollable
|
|
463
|
+
type UIScrollableStyle = SDK.UIScrollableStyle
|
|
464
|
+
type UISpacer = SDK.UISpacer
|
|
465
|
+
type UISpacerStyle = SDK.UISpacerStyle
|
|
466
|
+
type UITabDef = SDK.UITabDef
|
|
467
|
+
type UITabs = SDK.UITabs
|
|
468
|
+
type UIText = SDK.UIText
|
|
469
|
+
type UITextArea = SDK.UITextArea
|
|
470
|
+
type UITextStyle = SDK.UITextStyle
|
|
471
|
+
type UIVideo = SDK.UIVideo
|
|
472
|
+
type UIVideoStyle = SDK.UIVideoStyle
|
|
473
|
+
type UIVirtualizedList<T = unknown> = SDK.UIVirtualizedList<T>
|
|
474
|
+
type UIWidget = SDK.UIWidget
|
|
475
|
+
type UIWidgetStyle = SDK.UIWidgetStyle
|
|
476
|
+
type Unit = SDK.Unit
|
|
477
|
+
type UnlitMaterialDef = SDK.UnlitMaterialDef
|
|
478
|
+
type VRScene = SDK.VRScene
|
|
479
|
+
type Vec2 = SDK.Vec2
|
|
480
|
+
type Vec3 = SDK.Vec3
|
|
481
|
+
type Vehicle = SDK.Vehicle
|
|
482
|
+
type VideoPlayer = SDK.VideoPlayer
|
|
483
|
+
type WarpOptions = SDK.WarpOptions
|
|
484
|
+
type WebSocket = SDK.WebSocket
|
|
485
|
+
type Wheel = SDK.Wheel
|
|
486
|
+
type WheelSuspension = SDK.WheelSuspension
|
|
487
|
+
type WheelTire = SDK.WheelTire
|
|
488
|
+
type WheelVisual = SDK.WheelVisual
|
|
489
|
+
type With<N, A extends Aspect<any, any, any>> = SDK.With<N, A>
|
|
490
|
+
type __GizmoBuffer = SDK.__GizmoBuffer
|
|
491
|
+
// ---- server globals (available in *.server.ts; using them in client code is a build error) ----
|
|
492
|
+
const ApiError: typeof SERVER.ApiError
|
|
493
|
+
const auth: typeof SERVER.auth
|
|
494
|
+
const channel: typeof SERVER.channel
|
|
495
|
+
const defineDb: typeof SERVER.defineDb
|
|
496
|
+
const model: typeof SERVER.model
|
|
497
|
+
const ref: typeof SERVER.ref
|
|
498
|
+
const request: typeof SERVER.request
|
|
499
|
+
const t: typeof SERVER.t
|
|
500
|
+
type ApiError = SERVER.ApiError
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
export {}
|
package/dist/host.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
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.
|
|
4
|
+
|
|
5
|
+
declare global {
|
|
6
|
+
function setTimeout(handler: (...args: any[]) => void, timeout?: number): number
|
|
7
|
+
function setInterval(handler: (...args: any[]) => void, timeout?: number): number
|
|
8
|
+
function clearTimeout(id: number): void
|
|
9
|
+
function clearInterval(id: number): void
|
|
10
|
+
/** Per-frame loop, driven by the host (viewer RAF / desktop runTick). `dt` is **seconds** since
|
|
11
|
+
* the previous frame. */
|
|
12
|
+
function setLoop(handler: (dt: number) => void): number
|
|
13
|
+
function clearLoop(id: number): void
|
|
14
|
+
|
|
15
|
+
/** π/180 — substituted at compile time (bundler `define`). */
|
|
16
|
+
var DEG2RAD: number
|
|
17
|
+
/** 180/π — substituted at compile time (bundler `define`). */
|
|
18
|
+
var RAD2DEG: number
|
|
19
|
+
|
|
20
|
+
/** Compile-time boolean: `true` in scene-editor bundles, `false` (const-folded + DCE'd) in
|
|
21
|
+
* shipped ones — `if (EDITOR) { … }` costs zero bytes in production. `*.editor.ts` files are
|
|
22
|
+
* the file-level form. */
|
|
23
|
+
var EDITOR: boolean
|
|
24
|
+
|
|
25
|
+
var console: {
|
|
26
|
+
log(...data: any[]): void
|
|
27
|
+
warn(...data: any[]): void
|
|
28
|
+
info(...data: any[]): void
|
|
29
|
+
error(...data: any[]): void
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Compile-time macro: `asset('./hero.png')` is desugared by the bundler into the module import
|
|
33
|
+
* for that resource. The file must exist — a path that resolves to nothing fails the compile
|
|
34
|
+
* (`asset not found: ./hero.png (main.ts:3)`); there is no runtime fallback. Calls inside
|
|
35
|
+
* comments and string literals are text, not macros. */
|
|
36
|
+
function asset(path: string): string
|
|
37
|
+
|
|
38
|
+
/** Compile-time macro: installs a font and returns its family name — using a font IS declaring
|
|
39
|
+
* it. A registry id (`font("manrope")`) resolves against the font registry; a project path
|
|
40
|
+
* (`font("./fonts/Brand.ttf")`) reads family/weight/italic from the file itself. `opts`
|
|
41
|
+
* narrows/extends the face set (default: the family's standard weights). String-literal
|
|
42
|
+
* argument only. No awaiting — faces load with app boot and the host holds first paint for
|
|
43
|
+
* them. */
|
|
44
|
+
function font(id: string, opts?: { weights?: number[], italic?: boolean }): string
|
|
45
|
+
|
|
46
|
+
/** Compile-time macro: resolves one icon from the icon registry at build time and inlines it as
|
|
47
|
+
* an image source for `UIImage(...)` — offline, identical on every host. `id` is `"pack:name"`
|
|
48
|
+
* (e.g. `"lucide:bell"`), string literal only. Recolor via `{ color }`: a hex LITERAL is baked
|
|
49
|
+
* into the SVG at compile time, a token/expression is applied as a tint (as is the `tintColor`
|
|
50
|
+
* style prop). */
|
|
51
|
+
function assetIcon(id: string, opts?: { color?: string }): { readonly svg: string, tintColor: string | null }
|
|
52
|
+
|
|
53
|
+
/** Type-only editor convenience: the style object type of a UI element. `Style<UIButton>` (or
|
|
54
|
+
* `Style<typeof myButton>`) is what you'd pass to `el.style(...)` — for typing reusable style
|
|
55
|
+
* presets. Deliberately no `Partial<>` wrapper: every style prop is already optional, and
|
|
56
|
+
* Partial over ClassStyles' `$`-index signature adds `| undefined`, breaking assignability back
|
|
57
|
+
* into `.style(...)`. Round-trip guarded by sdk/tests/ui-types.test.ts. */
|
|
58
|
+
type Style<T> = T extends { style: (s: infer S) => any } ? S : never
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export {}
|