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, host
gating, no top-level await, 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).
This reference documents the API surface only. How to BUILD a whole thing out of it (enemy AI, a squad, a game mode) is the cookbook — recipes anchored to reference projects. What the platform does NOT have, with the nearest route, is listed at the end under Not available.
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, animateTo — styling.mdtheme— app-wide style variables (var()), kit keys, live re-theming — theme.md- style classes:
$namestate blocks,el.class, cascade, the reserved$hovered/$pressed/$focused/$landscape/$portrait— classes.md UIRow,UIColumn,UIBox(centering),UIScrollable,UISpacer— containers.mdUIText,UIImage,UIVideo,assetIcon— content.mdUIButton,UIInput,UITextArea— interactive.mdUIScreen,Router,Presentable— screens, the navigation stack, screen transitions, the back-press chain — screen-router.mdUIPager,UITabs,defineTabs— tabs with a stack each;UITabs= the standard bottom-tab shell,defineTabs= its bar for design mockups — 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,VRScene— 3D world: IBL / sky / fog / TAA, runtime graphics knobs, overlays, warm-up;VRScenefor a headset — scene.mdscene.postProcessing— the look: tone mapping, colour grading, a.cubeLUT, bloom, vignette, ambient occlusion, screen-space reflections, depth of field;apply()/reset()— post-processing.mdARScene,Anchor,ImageAnchor,ARPlane— AR over the device camera (thearplugin: ARKit, ARCore, the browser's camera + sensors): tracking, planes, hit test, anchors, image targets, light, placement controls — arscene.mdNode— base node: transform, hierarchy, events, tweens, ownership — node.mdCamera— lens, exposure, screen rays,follow, world→screen (viascene.camera) — camera.mdMesh,InstancedMesh— box / sphere / cylinder / capsule / plane factories, custom geometry, one geometry drawn N times — mesh.mdModel— GLB loading; clip playback via the pre-attached Animator (model.anim) — model.mdAnimationClip,Animator,Playback,Loop,Layer— the animation system: clips from other files / curves / derived (window, mirror), loops and 1D/2D blends, one-shots with hand-over promises, layers (masks, additive), clip events, root motion,clipInfomeasurements — animation.mdIK,Feet— two-bone / look-at chains on bones (sockets, anchored hands),anim.feet: foot lock, ground IK, footstep events — ik.mdLocomotion,Warp— character movement from an intent (starts, stops, turns, gait blend, actions) +anim.warpstride / orientation warping — locomotion.mdDynamicBone,DynamicBoneCollider— secondary motion: tails, ears, hair, ropes, cloaks — dynamic-bones.mdGeometry— raw vertex data, primitive builders, geometry files (Geometry.load) — geometry.mdMaterial,defineMaterial,MaterialHandle— built-in materials by name (lit / unlit / shadow / video …), project.matshaders, material assets (*.material.ts) — material.mdTexture— 3D material image: PNG / JPG / KTX2, raw pixels, engine-wide anisotropy and size cap (not interchangeable withTexture2D) — texture.mdLight—Light.sun()directional light + shadows,Light.point()lamps,Light.spot()cones (ambient comes from scene IBL) — light.mdLightmap— baked lighting (sun, sky, lamps, bounces) for static geometry + a light grid for movers (lecodes lightmap bake) — lightmap.mdFoliage— vegetation: wind, plants that lean away from the hero, distance fade, per-copy tint (Model.load { foliage }) — foliage.mdTerrain— heightfield ground: four splat layers (roughness per pixel in the albedo alpha), sculpt / paint / roads / holes,.terrainfiles, theheightfieldcollider — terrain.mdShape,Physics,Trigger,CharacterController— Jolt bodies, sensors, raycasts, the character mover — physics.mdVehicle,Wheel,Tire,resolveTire— car physics as hardware: engine, clutch, steering column, per-wheel suspension and tire curves, inputs + readouts (gearbox and wheel posing are the game's) — vehicle.mdRagdoll— a skinned model's skeleton handed to physics: falls, powered hit reactions, hand-back to the animator — ragdoll.mdNavMesh,NavAgent,NavCrowd— baked navigation mesh (lecodes navmesh bake), path queries, areas, crowd agents — navmesh.mdParticles,Trail,curve,colorCurve— GPU particle systems, ribbon trails, curves over a particle's life — particles.mdDecalSet,DecalTrail— projected decals: bullet holes, footprints, skid marks — decals.mdAudioSource,AudioZone,SceneAudio— 3D sound: emitters on nodes (distance, cone, doppler, occlusion),audio.playAt, reverb zones, the listener (scene.audio), HRTF — audio.mdRay,Plane,Noise— picking & procedural helpers — ray-plane-noise.mddefineScene,use,ref,make,SceneHandle,CameraPlace,Gizmos,InspectorUI,EDITOR— scenes as data (.scene.ts, the scene-editor format): nodes, prefabs,instantiate, the camera place, generator aspects, inspector cards — scene-files.mdLevel— procedural placement formake()factories: line / grid / ring / scatter / place, seeded — level.mdMoveTo,FollowPath,Spin,LookAt,PlayAnimation— ready-made no-code behaviors — scenario-aspects.mdregisterEditorWindow,registerEditorTool— scene-editor plugins (*.editor.ts): windows, click / drag / hover tools — editor-plugins.md
2D engine — 2d/
Scene2D— 2D world: background, layers, Y-sort, picking, systems,UIImage(scene)— scene2d.mdNode2D— base node: transform, hierarchy, events,animateTo— 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,Scene2dHandle,cells,encodeCells,CameraFollow—.scene2d.tsscenes: sprite/tilemap/camera/make nodes, layers, aspects, the follow camera — scene-files.mdShape2D,Physics2D,Trigger2D,OneWay2D,CharacterController2D,PhysicsGroup2D— Box2D bodies, sensors, one-way ledges, the character mover, collision groups, queries — physics2d.mdTilemap— atlas tile grid, natively culled — tilemap.mddefineTileset,Tileset,Autotile2D,rawCell/isRawCell/rawIndex,rot90/rot180/rot270/flipX/packTile/tileIndex/tileTurns/tileFlip/tileOriented—.tiles.tsautotile materials, raw and oriented tile values — tilesets.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),updateBefore/updateFixed/updatephases,static after/updateOrderordering, events,Aspect.all— aspects.mdSystem— an aspect of the scene (input, FX pools, HUD, game mode):scene.system(Class)— systems.mdTime— the game clock:Time.scale,Time.paused,Time.dt/unscaledDt/fixedDt,now,frame— time.mdStateMachine,defineStates— hierarchical state machine as one declarative table: guards, timed transitions, events,$back; brains, weapons, game modes — state-machine.mdCanvas,Bitmap— retained 2D drawing that bakes to textures (2D/3D/UI);loadImage(SVG / image bytes),toBitmap,toFile— canvas.md- the
addEventListenerpattern shared by scenes, nodes,device,app,Router, players, voices and sockets — events.md
Runtime — runtime/
device— platform (input model: web / ios / android / desktop), language and localization (the app's strings per language), size, pixelRatio, resize, connectivity, precise touch, haptics, motion sensor, HDR (not implemented yet) — device.mdapp,clipboard,openURL— lifecycle (pause/resume), deep links, orientation lock, back-press fallback (app.onBack), restart / quit, keyboard inset,sdkVersion, system clipboard, external URLs — app.mdpermissions— the OS permissions (camera, microphone, location, speech):querythe state,requestthe dialog where the user expects it,openSettingsfor a denied one — permissions.mdInput,InputChannel— keyboard / mouse / gamepad:Input.key(code)polling (mouse + gamepad buttons are keys),Input.on('keydown')events,Input.mouse.delta+ pointer lock +onUI,Input.gamepad(i).axis()/.rumble();InputChannel= the host's channel ids — input.mdClickEvent,TouchStartEvent,LongPressEvent,MouseEnterEvent— pointer events,ev.track()drags and hovers — touch.mdfetch,fetchLocal,FormData,File— HTTP over the host; sync body reads;fetchLocal= a host file by name — network.mdWebSocket— browser-like text sockets — network.mdlocalStorage— persistent key/value strings — storage.mdAudioPlayer,VideoPlayer— the platform's streaming players (music, voice-over, video); video-as-texture — media.mdSound,Voice,Bus,REVERB_PRESETS,audio— game audio: clips decoded up front, a voice pool (audio.play, loops, pitch, variants), buses with low-pass / echo / reverb; host-gated (audio.supported) — audio.mdopenFilePicker,share,files— file picking, native share sheet, the app's own files (desktop, iOS) — files-share.mdtoast,SvgSource— native toast; SVG-as-image-source — misc.mddate— dayjs-style dates: format, relative time, arithmetic, comparison (English + Russian) — datetime.mdNet,NetPlayer,Replicated,NetEntity— server-authoritative multiplayer: roles (offline / host / client / dedicated server), players, JSON messages, per-tick input, replicated entities with prediction and interpolation — multiplayer.mdRpcError— server functions:*.server.tsendpoints and channels on the le.codes app backend — server-functions.md- server code only:
model,t,defineDb,ref— the backend's database: models, queries, writes, transactions — database.md - server code only:
t.file(),t.image(), aFileparameter — files the app uploads and the backend keeps: photos, avatars, attachments — stored-files.md - server code only:
db.auth— accounts: passwords, email codes, your own sign-in, guests, devices — sign-in.md
Animation — animate/
animate— free-value tween (ms): numbers, CSS colors, vectors, quaternions, matrices →onUpdate; returns theAnimationhandle — animate.mdTimeline— choreography on one clock: tracks on UI elements, 3D / 2D nodes, lights, the camera; labels, calls, holds, stagger — timeline.mdeaseIn,easeOut,easeInOut,cubicBezier— easing functions + the curve names every tween takes ('outCubic',[x1,y1,x2,y2],'steps(n)') — 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 (a JPEGFile) — camera-view.mdQRScanner— host-optional QR scanning — qrscanner.mdGeolocation— device position (one-shot + watch) — geolocation.mdAudioRecorder— the microphone to a file (voice messages): start / pause / stop, a level meter, a duration limit — audio-recorder.mdSpeechRecognizer— speech to text, live (the platform's recognizer): partial and final results, one utterance or continuous — speech.mdMapView— vector map (maplibre-native; maplibre-gl in the web player): a style (free ready-made by default), marker/line layers, camera, user puck — map-view.mdPush— remote push notifications (register + payload events; le.codes relays the sends) — push.mdBrowser,WebView— web content inside the app: the system browser sheet for pages, OAuth sign-in and hosted checkouts, and an embedded web view — browser.mdRTCPeerConnection,mediaDevices,RTCVideoView(+MediaStream,MediaStreamTrack,RTCDataChannel, …) — the browser's WebRTC API: calls, video, data channels; signaling is the app's — webrtc.mdService— raw channel to host-registered headless services (app-local / third-party) — service.md
Host globals — globals.md
setLoop/clearLoop— per-frame host loop;dtin seconds, unscaled (game logic →Aspect/System)setTimeout/setInterval/clearTimeout/clearInterval— timers (ms; one-frame resolution and a required delay on the native runtime)console— log / warn / info / errorasset()— compile-time macro: project file path → bundled resource reference (.json→ its data,.svg→ anSvgSource)DEG2RAD/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. How a page's examples are checked (type-check, headless, the
windowless native host): AUTHORING.md.
Not available
What the platform does not have. When a search lands here, tell the person it cannot be done in a LeCodes app (and offer the nearest route named), instead of inventing an API.
Keeping the screen awake
No API; the screen dims and locks when the OS decides, even while a timer runs (a playing video keeps it on only where the system player does: iOS and the browsers, not Android).
Local and scheduled notifications
No API; a reminder at a set time can only be a remote push that your own server sends at that time
(Push, iOS and Android — plugins/push.md).
Saving to the photo library
No direct API; share(file) opens the OS share sheet — iOS offers "Save Image" for an image,
Android also writes an image or an MP4 to the gallery, the web shares or downloads the file
(runtime/files-share.md).
Text-to-speech
No API (SpeechRecognizer only listens); play recorded or server-generated speech with
AudioPlayer (runtime/media.md).
Translations and string tables
None built in; keep a table of strings per language and pick it by device.language
(runtime/device.md).
Number and currency formatting for a locale
No API, and Intl does not exist on Android or on Windows and Linux (toLocaleString prints plain
digits there); format numbers and money in your own code.
Dates in other languages, time zones
date().format() and timeAgo() know English and Russian only (any other device language gets
English), and there is no time-zone API: every date is the device's local time
(runtime/datetime.md).
Right-to-left layout
No; layouts are always left-to-right (mirror a row with flexDirection: 'row-reverse'), and on desktop
Arabic and Hebrew text itself is drawn unshaped, left to right.
Bluetooth and BLE devices
No API.
NFC
No API for reading or writing tags.
Contacts
No API to read the contacts or let the user pick one.
The calendar
No API to read or add calendar events (UIInput type 'date' is a date field, not the calendar).
Health data: steps, heart rate, workouts
No API to read or write Apple Health / Health Connect data or the step counter.
Face ID, Touch ID and fingerprint unlock
No API; a web sign-in with passkeys opened with Browser.open is the nearest
(plugins/browser.md).
In-app purchases and subscriptions
No App Store or Google Play billing; take payments on a hosted checkout page opened with
Browser.open (plugins/browser.md).
Apple Pay and Google Pay buttons
No native API; a hosted checkout page in Browser.open (the system browser sheet) can offer them.
Ads from an ad network (AdMob and others)
No API; no ad network SDK is part of the platform.
Sign in with Apple or Google buttons
No native sign-in; open the provider's OAuth page with Browser.open(url, { returnUrl }) and sign
the user in on your server with db.auth.signIn(userId) (runtime/sign-in.md).
Running code in the background
No; on iOS and Android the app's code pauses when it leaves the foreground — stop work on pause
and save data as it changes (runtime/app.md).
Location in the background
No; Geolocation works while the app is in the foreground.
Audio in the background or on the lock screen
No background audio mode; on iOS the sound stops when the app leaves the foreground.
Downloads that continue in the background
No; fetch() runs while the app is open and holds the whole file in memory.
Home-screen widgets
No (UIWidget is an overlay inside the app — ui/widget.md).
Recording video
No API; CameraView takes still photos, AudioRecorder records sound, and
openFilePicker({ accept: 'video/*' }) picks an existing video.
Flashlight / torch
No API.
Barcodes other than QR
No; QRScanner reads QR codes only (EAN, UPC, Code 128 … are not decoded).
SQLite or another SQL engine on the phone
No SQLite on the device; small values go to localStorage or stored signals, files to files
(desktop, iOS) (runtime/storage.md).
Secure storage for secrets (Keychain / Keystore)
No; localStorage is a plain file in the app's sandbox.
Screenshots of the UI, screen recording
No API; scene.capture() returns a 3D scene's frame (without the UI over it) and
Canvas.toFile() a canvas drawing.
Images on the clipboard
No; a picture cannot go on the clipboard — send it with share(file).
Printing
No API; share() an image, or open a page with openURL and print from the system.
The store's rating and review prompt
No API; link to the app's store page with openURL.
App icon shortcuts
No (the long-press menu on the app's icon).
Receiving shared items from other apps
No; only links reach the app, through its urlScheme (app.launchUrl, the "url" event —
runtime/app.md).
Screen brightness and the system volume
No API; AudioPlayer.volume sets the app's own sound.
Setting the app icon's badge
No API from the app; a push sent with a badge number sets it (plugins/push.md).
Showing or reading a PDF
No PDF API; open its URL with Browser.open (shown in the app on iOS and in browsers with a PDF
viewer, not by Android's WebView) or with openURL.
Drag and drop between apps
No; inside the app a drag is touch tracking (ev.track — runtime/touch.md).