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,preloadImage,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= the bar for design mockups — pager.md; the system's own tab bar (iOS 26 Liquid Glass) is the native UI plugin's host nodeUIGlassTabBarNode— native-plugins.mdUIWidget— floating overlays (+UIModaldialogs,UIPopoveranchored menus,UIBottomSheet) — widget.mdUIVirtualizedList— windowed lists for long data — virtualized-list.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— 3D physics 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, groups, draw order (renderPriority,z, Y-sort), picking, the HUD's touch rule, systems,UIImage(scene)— scene2d.mdNode2D— base node: transform, draw order, hierarchy, events,animateTo— node2d.mdCamera2D— position, zoom, screen↔world (viascene.camera) — camera2d.mdSprite— textured node; frames, tint, flip — sprite.mdText2D,Font2D— SDF text in the world: labels in world units or screen px, wrap, line cap with "…", outline,bounds; fonts loaded once — text2d.mdPath2D— lines, polygons, rects, circles, rounded rects, arcs and Bézier curves (Path2D.shape), px-wide strokes, holes — path2d.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/path/text/particles/camera/make nodes, draw order, aspects, the follow camera — scene-files.mdShape2D,Physics2D,Trigger2D,OneWay2D,CharacterController2D,PhysicsGroup2D— 2D physics 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 (desktop on macOS, an XDR screen) — 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, notifications):querythe state,requestthe dialog where the user expects it,openSettingsfor a denied one — permissions.mdnotifications— local notifications:scheduleone at a time / daily / weekly / now,onTap(the cold-start tap too),cancel,pending; iOS and Android — notifications.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,trackGesture— pointer events,ev.track()drags and hovers, pinch / twist / pan as one gesture — 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,secureStorage— persistent key/value strings; secrets (a token, a PIN) encrypted by the OS: Keychain on iOS, Keystore on Android — 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,online— server functions:*.server.tsendpoints, channels and computeds on the le.codes app backend;online= does the app reach it now — 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 ai(server code:AiErrortoo) — the project's language model, no key in the code:ai.send(text, a typed object, pictures),ai.tool(functions the model calls, questions the person answers), chats (ai.createChat) — and in the appai.messagesResource(id), a chat's messages live while the answer is written — ai.mdenv— the project's keys (tokens, client secrets, maps keys) kept out of the code: the.envfile locally, Project Settings → Keys on le.codes; the app sees onlyPUBLIC_…keys — keys.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/
Service— raw channel to host-registered headless services (app-local / third-party) — service.mdNativeView— a host-registered platform view shown full screen (map, camera, …): the channel under every view plugin — native-view.md- plugin nodes — a plugin's live control as a box of a screen's layout (
UIMapNode,UICameraNode,UIWebViewNode,UIRTCVideoNode): sizing,supported, settings, events — host-node.md CameraView,UICameraNode— device camera preview + photo (a JPEGFile), front / back, the flash and the torch;UICameraNodeis the preview inside a screen's layout (iOS, Android) — camera-view.mdQRScanner— host-optional QR scanning — qrscanner.mdGeolocation— device position (one-shot + watch) — geolocation.mdBackgroundAudio— one audio record that plays on in the background and on the lock screen (an audio guide, a podcast): state, length, position — background-audio.mdAudioRecorder— the microphone: a recording to a file (voice messages, music): start / pause / stop, a duration limit; the volume (level) and the note that is played or sung (pitch,AudioRecorder.note) live — a tuner, a singing game, with or without a file — audio-recorder.mdSpeechRecognizer— speech to text, live (the platform's recognizer): partial and final results, one utterance or continuous — speech.mdTorch— the phone's flashlight: on / off, brightness, whether there is one, changes by the system or another app; no permission (iOS, Android) — torch.mdContacts— the phone's address book: the system's contact picker (no permission), the contacts list with phones / emails / photos behind the contacts permission, a new contact or an edit through the system's own editor (iOS, Android; the picker in Chrome on Android) — contacts.mdCalendar— the device's calendars: "add to calendar" through the system's event editor (no permission), the user's events for a date range and the calendars behind the calendar permission, an event's card to edit it (iOS, Android) — calendar.mdMapView,UIMapNode— vector map (maplibre-native; maplibre-gl in the web player): a style (free ready-made by default), marker/line layers, camera, user puck;UIMapNodeis the map inside a screen's layout (iOS, Android) — map-view.mdpushChannel(server) +Push— push notifications: a server export sent to a signed-in user (groupByUser), a group (groupBy) or everyone subscribed, heard in the app withonTap;Pushfor a project without a backend — push.mdBrowser,UIWebViewNode,WebView— web content inside the app: the system browser sheet for pages, OAuth sign-in and hosted checkouts;UIWebViewNodeis a web page inside a screen's layout (iOS, Android),WebViewone full screen — browser.mdRtcConnection,RtcMedia,RtcTrack,RtcDataChannel,UIRTCVideoNode,RTCVideoView— calls between phones and browsers over one fixed profile (Opus, H.264, data channels): video and voice calls, a group as a connection per participant, peer-to-peer messages; signaling is the app's;UIRTCVideoNodedraws a track inside a screen's layout (iOS, Android, the web),RTCVideoViewfull screen — rtc.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 (→ docs/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): docs/AUTHORING.md, "Verifying examples".
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).
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).
Generating images or audio with AI
No; the project's model (ai) answers text and typed objects and looks at pictures, it makes none —
another provider's image API is a fetch from server code, its key in env (runtime/keys.md).
AI embeddings and vector search
No embeddings API and no vector index; ai.send with tools that query the database is the nearest
route (runtime/ai.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.
Changing contacts or calendar events without the user
No API creates, edits or deletes a contact or an event silently: Contacts.openEditor /
Contacts.openCard and Calendar.openEditor / Calendar.openEvent open the system's own screens
and the user saves
(contacts.md, calendar.md).
Reminders and to-do lists
No API for the system's reminders; a reminder of the app's own is a local notification (notifications.md).
Call history and text messages
No API to read the call log or SMS.
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.
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.
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).
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).