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