lecodes-sdk 0.20.2 → 1.1.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 (129) hide show
  1. package/dist/global.d.ts +35 -9
  2. package/dist/types/animate/tween/Animation.d.ts +69 -0
  3. package/dist/types/animate/tween/Timeline.d.ts +55 -0
  4. package/dist/types/animate/tween/animateValue.d.ts +27 -0
  5. package/dist/types/animate/tween/easing.d.ts +29 -0
  6. package/dist/types/animate/tween/spec.d.ts +178 -0
  7. package/dist/types/canvas/Canvas.d.ts +2 -0
  8. package/dist/types/g2/Node2D.d.ts +16 -0
  9. package/dist/types/g2/Sprite.d.ts +11 -1
  10. package/dist/types/gl/Camera.d.ts +15 -1
  11. package/dist/types/gl/DecalSet.d.ts +48 -3
  12. package/dist/types/gl/Foliage.d.ts +47 -0
  13. package/dist/types/gl/Geometry.d.ts +36 -0
  14. package/dist/types/gl/Light.d.ts +25 -7
  15. package/dist/types/gl/Lightmap.d.ts +90 -51
  16. package/dist/types/gl/Material.d.ts +32 -20
  17. package/dist/types/gl/Mesh.d.ts +7 -1
  18. package/dist/types/gl/Model.d.ts +41 -5
  19. package/dist/types/gl/Node.d.ts +18 -0
  20. package/dist/types/gl/Particles.d.ts +53 -1
  21. package/dist/types/gl/Scene.d.ts +21 -1
  22. package/dist/types/gl/animation/AnimationClip.d.ts +19 -0
  23. package/dist/types/gl/animation/Animator.d.ts +27 -0
  24. package/dist/types/gl/animation/DynamicBone.d.ts +184 -0
  25. package/dist/types/gl/animation/IK.d.ts +109 -0
  26. package/dist/types/gl/{Locomotion.d.ts → animation/Locomotion.d.ts} +6 -6
  27. package/dist/types/gl/animation/Warp.d.ts +2 -1
  28. package/dist/types/gl/animation/core.d.ts +35 -4
  29. package/dist/types/gl/{AudioSource.d.ts → audio/AudioSource.d.ts} +6 -6
  30. package/dist/types/gl/{AudioZone.d.ts → audio/AudioZone.d.ts} +4 -4
  31. package/dist/types/gl/{SceneAudio.d.ts → audio/SceneAudio.d.ts} +1 -1
  32. package/dist/types/gl/{NavAgent.d.ts → nav/NavAgent.d.ts} +4 -4
  33. package/dist/types/gl/{NavMesh.d.ts → nav/NavMesh.d.ts} +4 -4
  34. package/dist/types/gl/{CharacterController.d.ts → physics/CharacterController.d.ts} +5 -5
  35. package/dist/types/gl/{Physics.d.ts → physics/Physics.d.ts} +6 -5
  36. package/dist/types/gl/physics/Ragdoll.d.ts +161 -0
  37. package/dist/types/gl/{Shape.d.ts → physics/Shape.d.ts} +3 -3
  38. package/dist/types/gl/{Trigger.d.ts → physics/Trigger.d.ts} +2 -2
  39. package/dist/types/gl/{Terrain.d.ts → terrain/Terrain.d.ts} +10 -8
  40. package/dist/types/gl/{terrainMesh.d.ts → terrain/terrainMesh.d.ts} +1 -1
  41. package/dist/types/gl/vehicle/Vehicle.d.ts +300 -0
  42. package/dist/types/gl/vehicle/Wheel.d.ts +147 -0
  43. package/dist/types/inject.d.ts +35 -27
  44. package/dist/types/runtime/files.d.ts +24 -1
  45. package/dist/types/scene/defineScene.d.ts +50 -31
  46. package/dist/types/ui/UIButton.d.ts +3 -1
  47. package/dist/types/ui/UIInput.d.ts +5 -1
  48. package/dist/types/ui/UINode.d.ts +24 -24
  49. package/dist/types.json +1 -1
  50. package/package.json +1 -1
  51. package/prompts/README.md +142 -142
  52. package/prompts/core-design.md +27 -4
  53. package/prompts/core.md +35 -6
  54. package/prompts/select.ts +19 -4
  55. package/src/animate/tween/Animation.ts +378 -0
  56. package/src/animate/tween/Timeline.ts +175 -0
  57. package/src/animate/tween/animateValue.ts +100 -0
  58. package/src/animate/tween/easing.ts +172 -0
  59. package/src/animate/tween/spec.ts +479 -0
  60. package/src/bridges.d.ts +1760 -1481
  61. package/src/canvas/Canvas.ts +21 -0
  62. package/src/compile/__tests__/assetMacro.test.ts +26 -0
  63. package/src/compile/__tests__/compile.test.ts +11 -0
  64. package/src/compile/__tests__/detectEntry.test.ts +19 -0
  65. package/src/compile/__tests__/serverSplit.test.ts +27 -0
  66. package/src/compile/bundler.ts +34 -4
  67. package/src/compile/compileProject.ts +31 -1
  68. package/src/compile/detectEntry.ts +8 -3
  69. package/src/compile/header.ts +6 -3
  70. package/src/compile/index.ts +3 -0
  71. package/src/compile/sceneEditor.ts +42 -1
  72. package/src/compile/serverSplit.ts +9 -3
  73. package/src/g2/Node2D.ts +38 -0
  74. package/src/g2/Sprite.ts +20 -1
  75. package/src/gl/Camera.ts +34 -1
  76. package/src/gl/DecalSet.ts +132 -5
  77. package/src/gl/Foliage.ts +102 -0
  78. package/src/gl/Geometry.ts +109 -0
  79. package/src/gl/Light.ts +46 -16
  80. package/src/gl/Lightmap.ts +440 -249
  81. package/src/gl/Material.ts +69 -36
  82. package/src/gl/Mesh.ts +120 -102
  83. package/src/gl/Model.ts +167 -124
  84. package/src/gl/Node.ts +40 -1
  85. package/src/gl/Particles.ts +82 -5
  86. package/src/gl/Scene.ts +35 -2
  87. package/src/gl/animation/AnimationClip.ts +52 -0
  88. package/src/gl/animation/Animator.ts +42 -2
  89. package/src/gl/animation/DynamicBone.ts +482 -0
  90. package/src/gl/animation/IK.ts +214 -0
  91. package/src/gl/{Locomotion.ts → animation/Locomotion.ts} +7 -7
  92. package/src/gl/animation/Playback.ts +5 -4
  93. package/src/gl/animation/Warp.ts +5 -2
  94. package/src/gl/animation/core.ts +65 -4
  95. package/src/gl/{AudioSource.ts → audio/AudioSource.ts} +7 -7
  96. package/src/gl/{AudioZone.ts → audio/AudioZone.ts} +75 -75
  97. package/src/gl/{SceneAudio.ts → audio/SceneAudio.ts} +2 -2
  98. package/src/gl/{NavAgent.ts → nav/NavAgent.ts} +5 -5
  99. package/src/gl/{NavMesh.ts → nav/NavMesh.ts} +8 -8
  100. package/src/gl/{CharacterController.ts → physics/CharacterController.ts} +5 -5
  101. package/src/gl/{Physics.ts → physics/Physics.ts} +12 -5
  102. package/src/gl/physics/Ragdoll.ts +451 -0
  103. package/src/gl/{Shape.ts → physics/Shape.ts} +3 -3
  104. package/src/gl/{Trigger.ts → physics/Trigger.ts} +45 -45
  105. package/src/gl/{physicsEvents.ts → physics/physicsEvents.ts} +1 -1
  106. package/src/gl/{Terrain.ts → terrain/Terrain.ts} +14 -12
  107. package/src/gl/{terrainMesh.ts → terrain/terrainMesh.ts} +1 -1
  108. package/src/gl/vehicle/Vehicle.ts +666 -0
  109. package/src/gl/vehicle/Wheel.ts +290 -0
  110. package/src/inject.ts +236 -224
  111. package/src/runtime/files.ts +32 -2
  112. package/src/scene/defineScene.ts +92 -66
  113. package/src/scene/level.ts +2 -2
  114. package/src/ui/UIButton.ts +2 -2
  115. package/src/ui/UIInput.ts +3 -3
  116. package/src/ui/UINode.ts +61 -36
  117. package/dist/types/animate/animate.d.ts +0 -20
  118. package/dist/types/gl/Gearbox.d.ts +0 -86
  119. package/dist/types/gl/IK.d.ts +0 -53
  120. package/dist/types/gl/Ragdoll.d.ts +0 -86
  121. package/dist/types/gl/Vehicle.d.ts +0 -191
  122. package/dist/types/gl/Wheel.d.ts +0 -95
  123. package/src/animate/animate.ts +0 -238
  124. package/src/gl/Gearbox.ts +0 -212
  125. package/src/gl/IK.ts +0 -193
  126. package/src/gl/Ragdoll.ts +0 -270
  127. package/src/gl/Vehicle.ts +0 -473
  128. package/src/gl/Wheel.ts +0 -240
  129. /package/dist/types/gl/{physicsEvents.d.ts → physics/physicsEvents.d.ts} +0 -0
package/src/inject.ts CHANGED
@@ -1,224 +1,236 @@
1
- // THE aggregation point. Every public global the SDK provides is re-exported here under the exact
2
- // name user code uses it as. The bundler passes this file to esbuild's `inject:` option, so user
3
- // code references `Scene`, `Sprite`, `toast`, … with no imports; esbuild tree-shakes away whatever
4
- // a given project does not use (so a pure-2D project drops all 3D classes, and vice versa).
5
- //
6
- // Rule: this is the ONLY file that `export`s public names. Everything else is internal and imported
7
- // by it. Host-provided globals (setLoop, console, setTimeout, DEG2RAD, asset, …) are NOT here —
8
- // they live in src/host.d.ts as declarations and stay as free references at runtime.
9
-
10
- // ---- math ----
11
- export { Mathf } from "./math/Mathf"
12
- export { Vec2, Vec3 } from "./math/vec"
13
- export { Quat } from "./math/quat"
14
- export { Mat4 } from "./math/mat4"
15
- export { Color } from "./core/color"
16
-
17
- // ---- aspects (attachable node capabilities) ----
18
- export { Aspect, System, type With, type SystemHost } from "./core/Aspect"
19
- export { type EventMap } from "./core/events"
20
- export { Time } from "./core/time"
21
- export { StateMachine, defineStates, type StateDef, type StatesDef, type StateGuard, type StateHandler, type StateMachineEvents } from "./core/StateMachine"
22
- export { InspectorUI } from "./core/InspectorUI"
23
-
24
- // ---- reactivity (signals; UI text/style props also accept `() => value` bindings) ----
25
- export { signal, computed, effect, type Signal, type Computed } from "./core/signals"
26
- export { __compWrite, __compOp, type CompAxis, type CompWriter } from "./core/compWrite"
27
-
28
- // ---- canvas (core 2D drawing that bakes to a texture; shared by 2D/3D/UI) ----
29
- export { Canvas, Bitmap } from "./canvas/Canvas"
30
-
31
- // ---- platform runtime (injected globals; the host provides the lower-level _creator* bridges) ----
32
- export { toast, openURL, SvgSource } from "./runtime/misc"
33
- export { app, type AppState, type OrientationLock } from "./runtime/app"
34
- export { clipboard } from "./runtime/clipboard"
35
- export { date, type DateValue, type DateInput, type Unit, type Locale } from "./runtime/datetime"
36
- export { fetch, fetchLocal, FormData, File, type FetchResponse } from "./runtime/fetch"
37
- export { localStorage } from "./runtime/storage"
38
- export { device, type HapticStyle, type MotionOptions } from "./runtime/device"
39
- export { Input, InputChannel, type InputKeyEvent, type InputGamepadEvent, type InputEventName, type GamepadState, type GamepadAxisName } from "./runtime/input"
40
- export { WebSocket } from "./runtime/net"
41
- // Multiplayer (docs/multiplayer-plan.md): roles, players, JSON messages over the _creatorNet transport.
42
- export { Net, NetPlayer, Replicated, NetEntity, type NetMessage, type NetRole, type NetStatus, type NetEvents, type NetLaunch, type NetInput, type NetKind, type NetTransform } from "./net"
43
- // App-backend transport: the compiler-generated stubs of `*.server.ts` modules call these; user code
44
- // only ever imports its server functions (docs/backend-plan.md §4).
45
- export { __rpc, __channel, __serverOnly, RpcError, type ClientChannel } from "./runtime/rpc"
46
- export { AudioPlayer, VideoPlayer } from "./runtime/media"
47
- // Game audio (docs/audio-plan.md): decoded clips, a voice pool, buses with effects; 3D through the
48
- // AudioSource / AudioZone aspects (gl/) and scene.audio.
49
- export { Sound, type SoundOptions } from "./audio/Sound"
50
- export { Voice, type VoiceEvents } from "./audio/Voice"
51
- export { Bus, REVERB_PRESETS, type ReverbPreset, type ReverbParams, type EchoParams } from "./audio/Bus"
52
- export { audio, type PlaySoundOptions, type SpatialOptions, type Rolloff, type AudioStats } from "./audio/audio"
53
- export { openFilePicker, files, type FileData } from "./runtime/files"
54
- export { share } from "./runtime/share"
55
- export { ClickEvent, TouchStartEvent, LongPressEvent } from "./runtime/touch"
56
-
57
- // ---- 2D engine (creator-2d) ----
58
- export { Scene2D } from "./g2/Scene2D"
59
- export { Node2D } from "./g2/Node2D"
60
- export { Camera2D } from "./g2/Camera2D"
61
- export { Sprite } from "./g2/Sprite"
62
- export { SpriteAnimation } from "./g2/SpriteAnimation"
63
- export { Shape2D } from "./g2/Shape2D"
64
- export { Physics2D } from "./g2/Physics2D"
65
- export { Trigger2D } from "./g2/Trigger2D"
66
- export { CharacterController2D } from "./g2/CharacterController2D"
67
- export { OneWay2D } from "./g2/OneWay2D"
68
- export { PhysicsGroup2D } from "./g2/groups2d"
69
- export { Tilemap } from "./g2/Tilemap"
70
- export { Texture2D } from "./g2/Texture2D"
71
- // sprite sheets as data (.sprite.ts files — see src/g2/SpriteSheet.ts)
72
- export { SpriteSheet, defineSpriteSheet } from "./g2/SpriteSheet"
73
- export type { SpriteSheetDef, SheetSprite, SpriteMakeOptions } from "./g2/SpriteSheet"
74
- // tilesets as data (.tiles.ts files — autotile materials, see src/g2/Tileset.ts + autotile.ts)
75
- export { Tileset, defineTileset, Autotile2D } from "./g2/Tileset"
76
- export { rawCell, isRawCell, rawIndex } from "./g2/autotile"
77
- export { rot90, rot180, rot270, flipX, packTile, tileIndex, tileTurns, tileFlip, tileOriented } from "./g2/autotile"
78
- export type {
79
- TilesetDef, TileMaterial, PatchMaterial, PathMaterial, PatchSlots, EdgeSlot, FillBlock, BlockEntry,
80
- TileBlock, TilePart,
81
- } from "./g2/autotile"
82
- // 2D scenes as data (.scene2d.ts files — see src/g2/defineScene2d.ts) + the cells('…') payload
83
- export { defineScene2d, Scene2dHandle } from "./g2/defineScene2d"
84
- export type { Scene2dDef, Scene2dNodeDef, Scene2dEnv, SpriteSourceDef, TilemapSourceDef, Camera2dNodeDef, LoadedScene2d } from "./g2/defineScene2d"
85
- export { cells, encodeCells, type CellsData } from "./g2/cells"
86
- // no-code 2D scenario aspects (attachable in scene files — see src/g2/scenarios2d.ts)
87
- export { CameraFollow } from "./g2/scenarios2d"
88
-
89
- // ---- UI (creator-ui) ----
90
- export {
91
- UIScreen, type UIScreenStyle,
92
- UIRow, UIColumn, UIBox, type UIContainerStyle,
93
- UIText, type UITextStyle,
94
- UIButton, type UIButtonStyle,
95
- UIImage, type UIImageStyle,
96
- UIVideo, type UIVideoStyle,
97
- UIInput, UITextArea, type UIInputStyle,
98
- UIScrollable, type UIScrollableStyle,
99
- UIPager, type UIPagerStyle,
100
- UITabs, type UITabDef,
101
- defineTabs, type TabDef, type TabsHandle,
102
- UIWidget, type UIWidgetStyle,
103
- UIModal, type UIModalStyle,
104
- UIBottomSheet, type UIBottomSheetStyle,
105
- UIPopover, type UIPopoverStyle,
106
- UISpacer, type UISpacerStyle,
107
- UIVirtualizedList,
108
- Router,
109
- NativeView, type UINativeViewStyle,
110
- registerFont,
111
- __uiMap,
112
- __UIColumn, __UIRow, __UIBox, __UIButton, __UIScreen, __UIScrollable, __UIWidget,
113
- } from "./ui/UI"
114
- // The Presentable navigation contract (docs/navigation-presentable-plan.md). `Presentable` is
115
- // interface + runtime companion (declaration merging): `Presentable.current` = what's on screen.
116
- export { Presentable } from "./ui/UI"
117
- export type { PresentOptions, Transition, TransitionName, TransitionSpec, TransitionTransform } from "./ui/UI"
118
- // The base node type + the union a container accepts as children — documented as the signature of
119
- // UIColumn/UIRow/append/etc., so they must be global (type-only; erased at runtime).
120
- export type { UINode, UINodeChild } from "./ui/UINode"
121
- // App theme variables (docs/ui-theme-plan.md): theme({...}) merges + returns typed var()
122
- // accessors; system vars are static props (theme.primaryColor, theme["comfort-top"], …).
123
- export { theme, type ThemeValues, type ThemeAccessors } from "./ui/theme"
124
-
125
- // ---- animate ----
126
- export { animate, animateMat4, stopAnimation, pauseAnimation, resumeAnimation } from "./animate/animate"
127
- export { cubicBezier } from "./animate/bezier"
128
- export { easeIn, easeOut, easeInOut } from "./animate/easings"
129
-
130
- // ---- plugins (optional, host-provided capabilities — typed NativeView/service wrappers, see src/plugins/) ----
131
- export { QRScanner } from "./plugins/qr"
132
- export { CameraView, type CameraFacing } from "./plugins/camera"
133
- export { Geolocation, type GeoPosition, type GeoOptions, type GeoWatch } from "./plugins/geolocation"
134
- export {
135
- MapView, type MapOptions, type MapStyle, type MapStyleName, type MapCamera, type MapTap, type LngLat, type CameraMove, type FitOptions,
136
- type MapPaddingValues, type MarkerItem, type MarkerTap, type MarkerLayer, type MarkerLayerOptions,
137
- type LineLayer, type LineLayerOptions, type UserLocationOptions,
138
- } from "./plugins/map"
139
- export { Push, type PushPayload, type PushStatus, type PushRegisterOptions, type PushEvent } from "./plugins/push"
140
- export { OAuth, type OAuthCredential, type OAuthProviderName } from "./plugins/oauth"
141
- export { Service } from "./plugins/service"
142
-
143
- // ---- scenes as data (.scene.ts files — see src/scene/defineScene.ts) ----
144
- export { defineScene, use, ref, make, SceneHandle, applyEditorPose as __applyEditorPose } from "./scene/defineScene"
145
- export {
146
- defineMaterial, MaterialHandle,
147
- // editor-harness helpers (the scene editor's live material paths — not app API)
148
- assignMaterialDef as __assignMaterialDef, applyMaterialParam as __applyMaterialParam,
149
- } from "./scene/material"
150
- export type { MaterialData, MaterialParamValue, ShaderMaterialDef, LitMaterialDef, UnlitMaterialDef } from "./scene/material"
151
- export type { SceneDef, SceneNodeDef, MeshDef, LightDef, MaterialDef, CameraNodeDef, AspectEntry, MakeEntry, LoadedScene, SceneInstance } from "./scene/defineScene"
152
- export { CameraPlace } from "./gl/CameraPlace"
153
- // Procedural placement for large maps (line/grid/ring/scatter/place) — built for make() factories.
154
- export { Level } from "./scene/level"
155
- export type { LevelSpot, LevelBuild, LevelCollider, LevelLineOptions, LevelGridOptions, LevelRingOptions, LevelScatterOptions, LevelPlaceOptions } from "./scene/level"
156
- export type { FieldMeta } from "./core/fields"
157
- // Editor-only line drawing from generator rebuild() / make() factories / tool hooks — drawn by the
158
- // scene editor's viewport overlay, a no-op everywhere else (see src/scene/gizmos.ts).
159
- export { Gizmos, GizmoBuffer as __GizmoBuffer, withGizmoScope as __withGizmoScope } from "./scene/gizmos"
160
- export type { GizmoStyle, GizmoAnchor } from "./scene/gizmos"
161
-
162
- // ---- no-code scenario aspects (attachable in the scene editor — see src/gl/scenarios.ts) ----
163
- export { MoveTo, FollowPath, Spin, LookAt, PlayAnimation } from "./gl/scenarios"
164
-
165
- // ---- editor plugins (called from `*.editor.ts` files — editor bundles only; DCE'd from apps) ----
166
- export { registerEditorWindow, registerEditorTool, __editorPlugins } from "./scene/editorPlugins"
167
- export type { EditorApi, EditorRayHit, EditorToolHooks, EditorWindowFn } from "./scene/editorPlugins"
168
-
169
- // ---- 3D engine (creator-gl) ----
170
- export { Scene, ARScene, VRScene } from "./gl/Scene"
171
- export { Node } from "./gl/Node"
172
- export { Mesh } from "./gl/Mesh"
173
- export { Model } from "./gl/Model"
174
- export { Shape } from "./gl/Shape"
175
- export { Physics } from "./gl/Physics"
176
- export { Trigger } from "./gl/Trigger"
177
- export { AudioSource, type AudioCone } from "./gl/AudioSource"
178
- export { AudioZone } from "./gl/AudioZone"
179
- export { SceneAudio } from "./gl/SceneAudio"
180
- export { CharacterController } from "./gl/CharacterController"
181
- export { Vehicle } from "./gl/Vehicle"
182
- export type { DriveLayout, DifferentialMode, EngineConfig, SteeringConfig, AeroConfig } from "./gl/Vehicle"
183
- export { Wheel } from "./gl/Wheel"
184
- export { Ragdoll } from "./gl/Ragdoll"
185
- export type { RagdollPart, RagdollHinge } from "./gl/Ragdoll"
186
- export type { TireCurve, WheelSuspension, WheelTire, WheelVisual } from "./gl/Wheel"
187
- export { Gearbox } from "./gl/Gearbox"
188
- export { AnimationClip } from "./gl/animation/AnimationClip"
189
- export type { ClipDef, ClipTrackDef, ClipKey } from "./gl/animation/AnimationClip"
190
- export { Animator } from "./gl/animation/Animator"
191
- export type { LodMode } from "./gl/animation/Animator"
192
- export { Feet } from "./gl/animation/Feet"
193
- export type { FeetOptions, FootState } from "./gl/animation/Feet"
194
- export { Warp } from "./gl/animation/Warp"
195
- export type { WarpOptions, StepWarpOptions } from "./gl/animation/Warp"
196
- export { Playback } from "./gl/animation/Playback"
197
- export { Loop } from "./gl/animation/Loop"
198
- export { Layer } from "./gl/animation/Layer"
199
- export type { PlayOptions, StopOptions, LayerOptions, LoopOptions, LoopDef, BlendPosition, BlendMember, ActiveClip, ClipInfo, ClipCycle, ClipAlign, KneeAxisReport, StepHandler, ClipEventHandler } from "./gl/animation/core"
200
- export { IK } from "./gl/IK"
201
- export type { IKTwoBone, IKLookAt } from "./gl/IK"
202
- export { Light } from "./gl/Light"
203
- export { Lightmap } from "./gl/Lightmap"
204
- export { Terrain } from "./gl/Terrain"
205
- export type { TerrainOptions, TerrainLayer, TerrainRegion, ConformOptions, RibbonOptions, AutoPaintRules, SculptOptions, TerrainHit, TerrainSnapshot } from "./gl/Terrain"
206
- export { NavMesh, NavCrowd } from "./gl/NavMesh"
207
- export type { NavMeshLoadOptions, NavMeshInfo, NavPath, NavQueryOptions, NavRaycastHit, NavAgentSize } from "./gl/NavMesh"
208
- export { NavAgent } from "./gl/NavAgent"
209
- export type { NavAgentState, NavAgentAvoidance, NavAgentDrive, NavAgentEvents } from "./gl/NavAgent"
210
- export { Locomotion } from "./gl/Locomotion"
211
- export type { LocomotionSet, LocomotionClip, LocomotionTuning, LocomotionState, LocomotionEvents, Displacement, Gait } from "./gl/Locomotion"
212
- export { Material } from "./gl/Material"
213
- export { Geometry } from "./gl/Geometry"
214
- export { InstancedMesh } from "./gl/InstancedMesh"
215
- export type { InstanceTransform } from "./gl/InstancedMesh"
216
- export { Texture } from "./gl/Texture"
217
- export type { TextureLoadOptions } from "./gl/Texture"
218
- export { Camera } from "./gl/Camera"
219
- export { Ray } from "./gl/Ray"
220
- export { Plane } from "./gl/Plane"
221
- export { Noise } from "./gl/Noise"
222
- export { Particles, Trail, curve, colorCurve } from "./gl/Particles"
223
- export { DecalSet } from "./gl/DecalSet"
224
- export type { DecalOptions, DecalSetOptions, DecalSpawnOptions, DecalPlacement } from "./gl/DecalSet"
1
+ // THE aggregation point. Every public global the SDK provides is re-exported here under the exact
2
+ // name user code uses it as. The bundler passes this file to esbuild's `inject:` option, so user
3
+ // code references `Scene`, `Sprite`, `toast`, … with no imports; esbuild tree-shakes away whatever
4
+ // a given project does not use (so a pure-2D project drops all 3D classes, and vice versa).
5
+ //
6
+ // Rule: this is the ONLY file that `export`s public names. Everything else is internal and imported
7
+ // by it. Host-provided globals (setLoop, console, setTimeout, DEG2RAD, asset, …) are NOT here —
8
+ // they live in src/host.d.ts as declarations and stay as free references at runtime.
9
+
10
+ // ---- math ----
11
+ export { Mathf } from "./math/Mathf"
12
+ export { Vec2, Vec3 } from "./math/vec"
13
+ export { Quat } from "./math/quat"
14
+ export { Mat4 } from "./math/mat4"
15
+ export { Color } from "./core/color"
16
+
17
+ // ---- aspects (attachable node capabilities) ----
18
+ export { Aspect, System, type With, type SystemHost } from "./core/Aspect"
19
+ export { type EventMap } from "./core/events"
20
+ export { Time } from "./core/time"
21
+ export { StateMachine, defineStates, type StateDef, type StatesDef, type StateGuard, type StateHandler, type StateMachineEvents } from "./core/StateMachine"
22
+ export { InspectorUI } from "./core/InspectorUI"
23
+
24
+ // ---- reactivity (signals; UI text/style props also accept `() => value` bindings) ----
25
+ export { signal, computed, effect, type Signal, type Computed } from "./core/signals"
26
+ export { __compWrite, __compOp, type CompAxis, type CompWriter } from "./core/compWrite"
27
+
28
+ // ---- canvas (core 2D drawing that bakes to a texture; shared by 2D/3D/UI) ----
29
+ export { Canvas, Bitmap } from "./canvas/Canvas"
30
+
31
+ // ---- platform runtime (injected globals; the host provides the lower-level _creator* bridges) ----
32
+ export { toast, openURL, SvgSource } from "./runtime/misc"
33
+ export { app, type AppState, type OrientationLock } from "./runtime/app"
34
+ export { clipboard } from "./runtime/clipboard"
35
+ export { date, type DateValue, type DateInput, type Unit, type Locale } from "./runtime/datetime"
36
+ export { fetch, fetchLocal, FormData, File, type FetchResponse } from "./runtime/fetch"
37
+ export { localStorage } from "./runtime/storage"
38
+ export { device, type HapticStyle, type MotionOptions } from "./runtime/device"
39
+ export { Input, InputChannel, type InputKeyEvent, type InputGamepadEvent, type InputEventName, type GamepadState, type GamepadAxisName } from "./runtime/input"
40
+ export { WebSocket } from "./runtime/net"
41
+ // Multiplayer (docs/multiplayer-plan.md): roles, players, JSON messages over the _creatorNet transport.
42
+ export { Net, NetPlayer, Replicated, NetEntity, type NetMessage, type NetRole, type NetStatus, type NetEvents, type NetLaunch, type NetInput, type NetKind, type NetTransform } from "./net"
43
+ // App-backend transport: the compiler-generated stubs of `*.server.ts` modules call these; user code
44
+ // only ever imports its server functions (docs/backend-plan.md §4).
45
+ export { __rpc, __channel, __serverOnly, RpcError, type ClientChannel } from "./runtime/rpc"
46
+ export { AudioPlayer, VideoPlayer } from "./runtime/media"
47
+ // Game audio (docs/audio-plan.md): decoded clips, a voice pool, buses with effects; 3D through the
48
+ // AudioSource / AudioZone aspects (gl/) and scene.audio.
49
+ export { Sound, type SoundOptions } from "./audio/Sound"
50
+ export { Voice, type VoiceEvents } from "./audio/Voice"
51
+ export { Bus, REVERB_PRESETS, type ReverbPreset, type ReverbParams, type EchoParams } from "./audio/Bus"
52
+ export { audio, type PlaySoundOptions, type SpatialOptions, type Rolloff, type AudioStats } from "./audio/audio"
53
+ export { openFilePicker, files, type FileData } from "./runtime/files"
54
+ export { share } from "./runtime/share"
55
+ export { ClickEvent, TouchStartEvent, LongPressEvent } from "./runtime/touch"
56
+
57
+ // ---- 2D engine (creator-2d) ----
58
+ export { Scene2D } from "./g2/Scene2D"
59
+ export { Node2D } from "./g2/Node2D"
60
+ export { Camera2D } from "./g2/Camera2D"
61
+ export { Sprite } from "./g2/Sprite"
62
+ export { SpriteAnimation } from "./g2/SpriteAnimation"
63
+ export { Shape2D } from "./g2/Shape2D"
64
+ export { Physics2D } from "./g2/Physics2D"
65
+ export { Trigger2D } from "./g2/Trigger2D"
66
+ export { CharacterController2D } from "./g2/CharacterController2D"
67
+ export { OneWay2D } from "./g2/OneWay2D"
68
+ export { PhysicsGroup2D } from "./g2/groups2d"
69
+ export { Tilemap } from "./g2/Tilemap"
70
+ export { Texture2D } from "./g2/Texture2D"
71
+ // sprite sheets as data (.sprite.ts files — see src/g2/SpriteSheet.ts)
72
+ export { SpriteSheet, defineSpriteSheet } from "./g2/SpriteSheet"
73
+ export type { SpriteSheetDef, SheetSprite, SpriteMakeOptions } from "./g2/SpriteSheet"
74
+ // tilesets as data (.tiles.ts files — autotile materials, see src/g2/Tileset.ts + autotile.ts)
75
+ export { Tileset, defineTileset, Autotile2D } from "./g2/Tileset"
76
+ export { rawCell, isRawCell, rawIndex } from "./g2/autotile"
77
+ export { rot90, rot180, rot270, flipX, packTile, tileIndex, tileTurns, tileFlip, tileOriented } from "./g2/autotile"
78
+ export type {
79
+ TilesetDef, TileMaterial, PatchMaterial, PathMaterial, PatchSlots, EdgeSlot, FillBlock, BlockEntry,
80
+ TileBlock, TilePart,
81
+ } from "./g2/autotile"
82
+ // 2D scenes as data (.scene2d.ts files — see src/g2/defineScene2d.ts) + the cells('…') payload
83
+ export { defineScene2d, Scene2dHandle } from "./g2/defineScene2d"
84
+ export type { Scene2dDef, Scene2dNodeDef, Scene2dEnv, SpriteSourceDef, TilemapSourceDef, Camera2dNodeDef, LoadedScene2d } from "./g2/defineScene2d"
85
+ export { cells, encodeCells, type CellsData } from "./g2/cells"
86
+ // no-code 2D scenario aspects (attachable in scene files — see src/g2/scenarios2d.ts)
87
+ export { CameraFollow } from "./g2/scenarios2d"
88
+
89
+ // ---- UI (creator-ui) ----
90
+ export {
91
+ UIScreen, type UIScreenStyle,
92
+ UIRow, UIColumn, UIBox, type UIContainerStyle,
93
+ UIText, type UITextStyle,
94
+ UIButton, type UIButtonStyle,
95
+ UIImage, type UIImageStyle,
96
+ UIVideo, type UIVideoStyle,
97
+ UIInput, UITextArea, type UIInputStyle,
98
+ UIScrollable, type UIScrollableStyle,
99
+ UIPager, type UIPagerStyle,
100
+ UITabs, type UITabDef,
101
+ defineTabs, type TabDef, type TabsHandle,
102
+ UIWidget, type UIWidgetStyle,
103
+ UIModal, type UIModalStyle,
104
+ UIBottomSheet, type UIBottomSheetStyle,
105
+ UIPopover, type UIPopoverStyle,
106
+ UISpacer, type UISpacerStyle,
107
+ UIVirtualizedList,
108
+ Router,
109
+ NativeView, type UINativeViewStyle,
110
+ registerFont,
111
+ __uiMap,
112
+ __UIColumn, __UIRow, __UIBox, __UIButton, __UIScreen, __UIScrollable, __UIWidget,
113
+ } from "./ui/UI"
114
+ // The Presentable navigation contract (docs/navigation-presentable-plan.md). `Presentable` is
115
+ // interface + runtime companion (declaration merging): `Presentable.current` = what's on screen.
116
+ export { Presentable } from "./ui/UI"
117
+ export type { PresentOptions, Transition, TransitionName, TransitionSpec, TransitionTransform } from "./ui/UI"
118
+ // The base node type + the union a container accepts as children — documented as the signature of
119
+ // UIColumn/UIRow/append/etc., so they must be global (type-only; erased at runtime).
120
+ export type { UINode, UINodeChild } from "./ui/UINode"
121
+ // App theme variables (docs/ui-theme-plan.md): theme({...}) merges + returns typed var()
122
+ // accessors; system vars are static props (theme.primaryColor, theme["comfort-top"], …).
123
+ export { theme, type ThemeValues, type ThemeAccessors } from "./ui/theme"
124
+
125
+ // ---- animate ----
126
+ // animate() runs on the keyframe core (a VALUE track) since 2026-09-14: same handle, easing and clocks
127
+ // as animateTo; stop / pause / resume are the handle's methods, a matrix is just a value kind.
128
+ export { animate, type AnimateOptions, type AnimateValue, type AnimateOut } from "./animate/tween/animateValue"
129
+ export { cubicBezier } from "./animate/bezier"
130
+ // Keyframe animation core (docs/timeline-plan.md): the handle `animateTo` / `animateFrom` return,
131
+ // and `Timeline()` — choreography over UI elements, 3D / 2D nodes, lights and cameras.
132
+ export { Timeline, type TimelineOptions, type TimelineAddOptions, type TimelinePosition } from "./animate/tween/Timeline"
133
+ export { type Animation } from "./animate/tween/Animation"
134
+ export { type TweenMeta } from "./animate/tween/spec"
135
+ export { type EasingInput } from "./animate/tween/easing"
136
+ export { easeIn, easeOut, easeInOut } from "./animate/easings"
137
+
138
+ // ---- plugins (optional, host-provided capabilities — typed NativeView/service wrappers, see src/plugins/) ----
139
+ export { QRScanner } from "./plugins/qr"
140
+ export { CameraView, type CameraFacing } from "./plugins/camera"
141
+ export { Geolocation, type GeoPosition, type GeoOptions, type GeoWatch } from "./plugins/geolocation"
142
+ export {
143
+ MapView, type MapOptions, type MapStyle, type MapStyleName, type MapCamera, type MapTap, type LngLat, type CameraMove, type FitOptions,
144
+ type MapPaddingValues, type MarkerItem, type MarkerTap, type MarkerLayer, type MarkerLayerOptions,
145
+ type LineLayer, type LineLayerOptions, type UserLocationOptions,
146
+ } from "./plugins/map"
147
+ export { Push, type PushPayload, type PushStatus, type PushRegisterOptions, type PushEvent } from "./plugins/push"
148
+ export { OAuth, type OAuthCredential, type OAuthProviderName } from "./plugins/oauth"
149
+ export { Service } from "./plugins/service"
150
+
151
+ // ---- scenes as data (.scene.ts files — see src/scene/defineScene.ts) ----
152
+ export { defineScene, use, ref, make, SceneHandle, applyEditorPose as __applyEditorPose } from "./scene/defineScene"
153
+ export {
154
+ defineMaterial, MaterialHandle,
155
+ // editor-harness helpers (the scene editor's live material paths — not app API)
156
+ assignMaterialDef as __assignMaterialDef, applyMaterialParam as __applyMaterialParam,
157
+ } from "./scene/material"
158
+ export type { MaterialData, MaterialParamValue, ShaderMaterialDef, LitMaterialDef, UnlitMaterialDef } from "./scene/material"
159
+ export type { SceneDef, SceneNodeDef, MeshDef, LightDef, MaterialDef, CameraNodeDef, AspectEntry, MakeEntry, LoadedScene, SceneInstance } from "./scene/defineScene"
160
+ export { CameraPlace } from "./gl/CameraPlace"
161
+ // Procedural placement for large maps (line/grid/ring/scatter/place) — built for make() factories.
162
+ export { Level } from "./scene/level"
163
+ export type { LevelSpot, LevelBuild, LevelCollider, LevelLineOptions, LevelGridOptions, LevelRingOptions, LevelScatterOptions, LevelPlaceOptions } from "./scene/level"
164
+ export type { FieldMeta } from "./core/fields"
165
+ // Editor-only line drawing from generator rebuild() / make() factories / tool hooks — drawn by the
166
+ // scene editor's viewport overlay, a no-op everywhere else (see src/scene/gizmos.ts).
167
+ export { Gizmos, GizmoBuffer as __GizmoBuffer, withGizmoScope as __withGizmoScope } from "./scene/gizmos"
168
+ export type { GizmoStyle, GizmoAnchor } from "./scene/gizmos"
169
+
170
+ // ---- no-code scenario aspects (attachable in the scene editor — see src/gl/scenarios.ts) ----
171
+ export { MoveTo, FollowPath, Spin, LookAt, PlayAnimation } from "./gl/scenarios"
172
+
173
+ // ---- editor plugins (called from `*.editor.ts` files — editor bundles only; DCE'd from apps) ----
174
+ export { registerEditorWindow, registerEditorTool, __editorPlugins } from "./scene/editorPlugins"
175
+ export type { EditorApi, EditorRayHit, EditorToolHooks, EditorWindowFn } from "./scene/editorPlugins"
176
+
177
+ // ---- 3D engine (creator-gl) ----
178
+ export { Scene, ARScene, VRScene } from "./gl/Scene"
179
+ export { Node } from "./gl/Node"
180
+ export { Mesh } from "./gl/Mesh"
181
+ export { Model } from "./gl/Model"
182
+ export { Shape } from "./gl/physics/Shape"
183
+ export { Physics } from "./gl/physics/Physics"
184
+ export { Trigger } from "./gl/physics/Trigger"
185
+ export { AudioSource, type AudioCone } from "./gl/audio/AudioSource"
186
+ export { AudioZone } from "./gl/audio/AudioZone"
187
+ export { SceneAudio } from "./gl/audio/SceneAudio"
188
+ export { CharacterController } from "./gl/physics/CharacterController"
189
+ export { Vehicle } from "./gl/vehicle/Vehicle"
190
+ export type { DriveLayout, DifferentialMode, EngineConfig, SteeringConfig, SteeringFeedback, SteeringDriver, AeroConfig } from "./gl/vehicle/Vehicle"
191
+ export { Wheel, Tire, resolveTire } from "./gl/vehicle/Wheel"
192
+ export { Ragdoll } from "./gl/physics/Ragdoll"
193
+ export type { RagdollPart, RagdollHinge, RagdollFacing, RagdollActivateOptions, RagdollDeactivateOptions, RagdollHitOptions } from "./gl/physics/Ragdoll"
194
+ export type { Point, WheelSuspension } from "./gl/vehicle/Wheel"
195
+ export { AnimationClip } from "./gl/animation/AnimationClip"
196
+ export type { ClipDef, ClipTrackDef, ClipKey } from "./gl/animation/AnimationClip"
197
+ export { Animator } from "./gl/animation/Animator"
198
+ export type { LodMode } from "./gl/animation/Animator"
199
+ export type { TrianglePick } from "./gl/Model"
200
+ export { Feet } from "./gl/animation/Feet"
201
+ export type { FeetOptions, FootState } from "./gl/animation/Feet"
202
+ export { Warp } from "./gl/animation/Warp"
203
+ export type { WarpOptions, StepWarpOptions } from "./gl/animation/Warp"
204
+ export { Playback } from "./gl/animation/Playback"
205
+ export { Loop } from "./gl/animation/Loop"
206
+ export { Layer } from "./gl/animation/Layer"
207
+ export type { PlayOptions, StopOptions, LayerOptions, LoopOptions, LoopDef, BlendPosition, BlendMember, ActiveClip, ClipInfo, ClipCycle, ClipAlign, KneeAxisReport, StepHandler, ClipEventHandler } from "./gl/animation/core"
208
+ export { IK } from "./gl/animation/IK"
209
+ export { DynamicBone, DynamicBoneCollider } from "./gl/animation/DynamicBone"
210
+ export type { DynamicBoneCurve, DynamicBoneFloor, DynamicBoneColliders } from "./gl/animation/DynamicBone"
211
+ export type { IKTwoBone, IKLookAt } from "./gl/animation/IK"
212
+ export { Light } from "./gl/Light"
213
+ export { Lightmap } from "./gl/Lightmap"
214
+ export { Foliage } from "./gl/Foliage"
215
+ export type { FoliageOptions, FoliageWind } from "./gl/Foliage"
216
+ export { Terrain } from "./gl/terrain/Terrain"
217
+ export type { TerrainOptions, TerrainLayer, TerrainRegion, ConformOptions, RibbonOptions, AutoPaintRules, SculptOptions, TerrainHit, TerrainSnapshot } from "./gl/terrain/Terrain"
218
+ export { NavMesh, NavCrowd } from "./gl/nav/NavMesh"
219
+ export type { NavMeshLoadOptions, NavMeshInfo, NavPath, NavQueryOptions, NavRaycastHit, NavAgentSize } from "./gl/nav/NavMesh"
220
+ export { NavAgent } from "./gl/nav/NavAgent"
221
+ export type { NavAgentState, NavAgentAvoidance, NavAgentDrive, NavAgentEvents } from "./gl/nav/NavAgent"
222
+ export { Locomotion } from "./gl/animation/Locomotion"
223
+ export type { LocomotionSet, LocomotionClip, LocomotionTuning, LocomotionState, LocomotionEvents, Displacement, Gait } from "./gl/animation/Locomotion"
224
+ export { Material } from "./gl/Material"
225
+ export { Geometry } from "./gl/Geometry"
226
+ export { InstancedMesh } from "./gl/InstancedMesh"
227
+ export type { InstanceTransform } from "./gl/InstancedMesh"
228
+ export { Texture } from "./gl/Texture"
229
+ export type { TextureLoadOptions } from "./gl/Texture"
230
+ export { Camera } from "./gl/Camera"
231
+ export { Ray } from "./gl/Ray"
232
+ export { Plane } from "./gl/Plane"
233
+ export { Noise } from "./gl/Noise"
234
+ export { Particles, Trail, curve, colorCurve } from "./gl/Particles"
235
+ export { DecalSet, DecalTrail } from "./gl/DecalSet"
236
+ export type { DecalOptions, DecalSetOptions, DecalSpawnOptions, DecalPlacement, DecalTrailOptions } from "./gl/DecalSet"
@@ -47,6 +47,20 @@ export function openFilePicker(
47
47
  * (a picked `File`, a `FetchResponse`, a `Canvas.toFile()` snapshot). */
48
48
  export type FileData = string | Uint8Array | ArrayBuffer | File | FetchResponse
49
49
 
50
+ /** One directory entry, as `files.ls` / `files.stat` report it. */
51
+ export type FileEntry = {
52
+ /** The last path segment. */
53
+ name: string
54
+ /** Relative to the listed directory, `/`-separated — equal to `name` unless the listing was
55
+ * recursive. Join it onto the directory you listed to read the file. */
56
+ path: string
57
+ kind: "file" | "dir"
58
+ /** Bytes; 0 for a directory. */
59
+ size: number
60
+ /** Last modification, ms since the epoch (a `Date` value). */
61
+ modified: number
62
+ }
63
+
50
64
  const supported = () =>
51
65
  typeof _creatorUtils !== "undefined" && typeof _creatorUtils.writeLocal === "function"
52
66
 
@@ -95,8 +109,8 @@ export const files = {
95
109
 
96
110
  /** Delete a file, or a directory (empty, or any directory with `{ recursive: true }`). Deleting
97
111
  * something already gone is success — what's promised is that the path is free afterwards. */
98
- delete(path: string, options: { recursive?: boolean } = {}): Promise<void> {
99
- return run<void>("delete", path, (resolve, reject) =>
112
+ rm(path: string, options: { recursive?: boolean } = {}): Promise<void> {
113
+ return run<void>("rm", path, (resolve, reject) =>
100
114
  _creatorUtils.deleteLocal!(path, !!options.recursive, () => resolve(), reject))
101
115
  },
102
116
 
@@ -105,4 +119,20 @@ export const files = {
105
119
  return run<void>("mkdir", path, (resolve, reject) =>
106
120
  _creatorUtils.mkdirLocal!(path, () => resolve(), reject))
107
121
  },
122
+
123
+ /** The entries of a directory, sorted by path — null when there is no such directory (an empty
124
+ * one is `[]`, so `(await files.ls("saves")) ?? []` covers both). `{ recursive: true }` walks
125
+ * the subfolders too; each entry's `path` is then relative to the directory listed. A path that
126
+ * is a file, not a directory, rejects. Filter in JS — `entries.filter(e => e.name.endsWith(".json"))`. */
127
+ ls(path: string, options: { recursive?: boolean } = {}): Promise<FileEntry[] | null> {
128
+ return run<FileEntry[] | null>("ls", path, (resolve, reject) =>
129
+ _creatorUtils.listLocal!(path, !!options.recursive, resolve, reject))
130
+ },
131
+
132
+ /** What is at `path`: a file or a directory entry (`path` equal to `name`), or null when nothing
133
+ * is there — `(await files.stat(p)) !== null` is the exists check. */
134
+ stat(path: string): Promise<FileEntry | null> {
135
+ return run<FileEntry | null>("stat", path, (resolve, reject) =>
136
+ _creatorUtils.statLocal!(path, (e) => resolve(e ? { ...e, path: e.name } : null), reject))
137
+ },
108
138
  }