SDK reference
The complete API reference for le.codes projects. Everything here is an import-free global —
user code references UIScreen, Scene, Sprite, fetch, … directly; the build injects the
implementation and tree-shakes what a project doesn't use.
Start with conventions.md — units, coordinate systems, value semantics, and the
lifecycle rules every page assumes. Most apps are UI apps: the entry point for the UI layer is
ui/overview.md (the element model plus the shape of a typical app —
tokens/theme() module, screens, tab shell).
Guides and worked examples are a separate, future section; this reference documents the API surface only.
The whole surface at a glance
One line per global. Bold = the page that documents it.
UI — ui/
- element model: factories, chaining, refs, conditional children, the shape of an app — overview.md
.style()model: properties, units, safe areas, responsive, animateTo — styling.mdtheme— app-wide style variables (var()), system defaults, live re-theming — theme.md- style classes:
$namestate blocks,el.class, cascade,$pressed/$focused— classes.md UIRow,UIColumn,UIBox(deprecated),UIScrollable,UISpacer— containers.mdUIText,UIImage,UIVideo,assetIcon— content.mdUIButton,UIInput,UITextArea— interactive.mdUIScreen,Router— screens & navigation — screen-router.mdUIPager,UITabs— screen navigation: swipeable tabs + a native stack per tab;UITabs= the standard bottom-tab shell — pager.mdUIWidget— floating overlays (+UIModaldialogs,UIPopoveranchored menus,UIBottomSheet) — widget.mdUIVirtualizedList— windowed lists for long data — virtualized-list.mdNativeView— host-registered platform views (map, camera, …) — native-view.mdfont,registerFont— fonts — fonts.md
3D engine — 3d/
Scene— 3D world: IBL, bloom, skybox, overlays — scene.mdARScene— AR session: anchors, placement controls — arscene.mdNode— base node: transform, hierarchy, events — node.mdCamera— fov, rays, view direction (viascene.camera) — camera.mdMesh— box/sphere/cylinder/plane factories + custom geometry — mesh.mdModel,ModelAnimation— GLB loading; clip playback (model.anim) — model.mdGeometry— raw vertex data — geometry.mdMaterial— lit/unlit/custom shader materials — material.mdTexture— 3D material image (not interchangeable withTexture2D) — texture.mdLight—Light.sun()directional light + shadows (ambient comes from scene IBL) — light.mdShape,Physics,Trigger,CharacterController— Jolt bodies, sensors, raycasts — physics.mdParticles,dynamic,dynamicColor— GPU particle systems — particles.mdRay,Plane,Noise— picking & procedural helpers — ray-plane-noise.mddefineScene,use— scenes as data (.scene.tsfiles, the scene-editor format) — scene-files.mdMoveTo,FollowPath,Spin,LookAt,PlayAnimation— ready-made no-code behaviors — scenario-aspects.mdregisterEditorWindow,registerEditorTool— scene-editor plugins (*.editor.ts) — editor-plugins.md
2D engine — 2d/
Scene2D— 2D world: background, layers, Y-sort, picking — scene2d.mdNode2D— base node: transform, hierarchy, events — node2d.mdCamera2D— position, zoom, screen↔world (viascene.camera) — camera2d.mdSprite— textured node; frames, tint, flip — sprite.mdSpriteAnimation— sprite-sheet clips aspect (node.anim) — sprite-animation.mddefineSpriteSheet,SpriteSheet—.sprite.tssheets: named regions, slice grids, clips,make()— sprite-sheets.mddefineScene2d,cells,CameraFollow—.scene2d.tsscenes: sprite/tilemap/camera nodes, layers, aspects — scene-files.mdShape2D,Physics2D,Trigger2D,CharacterController2D— Box2D bodies, sensors, queries — physics2d.mdTilemap— atlas tile grid, natively culled — tilemap.mdTexture2D— 2D image loading — texture2d.md
Core — core/
signal,computed,effect— reactive state;() => valuebindings in UI text/styles — signals.mdAspect— attachable node capabilities;node.aspect(Class, opts), update phases — aspects.mdCanvas,Bitmap— retained 2D drawing that bakes to textures (2D/3D/UI) — canvas.md- event emitter pattern (
addEventListener) shared by scenes/nodes/players — events.md
Runtime — runtime/
device— platform, language, size, pixelRatio, resize event, connectivity, precise touch — device.mdapp,clipboard,openURL— lifecycle (pause/resume), deep links, system clipboard, external URLs — app.mdInput— keyboard polling (Input.key(code)) — input.mdClickEvent,TouchStartEvent— pointer events +ev.track()drags — touch.mdfetch,fetchLocal,FormData,File— HTTP over the host; sync body reads — network.mdWebSocket— browser-like sockets + custom headers — network.mdlocalStorage— persistent key/value strings — storage.mdAudioPlayer,VideoPlayer— media playback; video-as-texture — media.mdopenFilePicker,share— file picking, native share sheet — files-share.mdtoast,SvgSource— native toast; SVG-as-image-source — misc.mddate— dayjs-style dates: format, relative time, arithmetic, comparison (English + Russian) — datetime.md
Animation — animate/
animate,animateMat4,stopAnimation,pauseAnimation,resumeAnimation— value tweens (duration in ms) — animate.mdeaseIn,easeOut,easeInOut,cubicBezier— easing functions — easings.md
Math — math/
Mathf— scalar helpers: clamp, lerp, damp, remap, random — mathf.mdVec2,Vec3— fluent vectors; mutable fields, pure methods, tuple-interop — vectors.mdQuat— rotations: fromEuler, fromAxisAngle, slerp, lookRotation — quat.mdMat4— 4×4 matrix: compose/decompose, lookAt, perspective; raw.mexposed — mat4.mdColor— parse/convert anyColorInputform — color.md
Plugins — plugins/
CameraView— device camera preview + photo — camera-view.mdQRScanner— host-optional QR scanning — qrscanner.mdGeolocation— device position (one-shot + watch) — geolocation.mdPush— remote push notifications (register + payload events; le.codes relays the sends) — push.mdService— raw channel to host-registered headless services (app-local / third-party) — service.md
Host globals — globals.md
setLoop/clearLoop— per-frame loop;dtin secondssetTimeout/setInterval/clearTimeout/clearInterval— timers (ms)console— log / warn / info / errorasset()— compile-time macro: project file path → bundled resource URLDEG2RAD/RAD2DEG— compile-time angle constantsStyle<T>— editor-only helper type for reusable UI style objects
Coverage tooling
bun run docs:check (→ check.mjs) verifies that every global exported from
src/inject.ts (+ host globals) has exactly one canonical page, that sources: paths exist, and
that relative links resolve.