// THE aggregation point. Every public global the SDK provides is re-exported here under the exact
// name user code uses it as. The bundler passes this file to esbuild's `inject:` option, so user
// code references `Scene`, `Sprite`, `toast`, … with no imports; esbuild tree-shakes away whatever
// a given project does not use (so a pure-2D project drops all 3D classes, and vice versa).
//
// Rule: this is the ONLY file that `export`s public names. Everything else is internal and imported
// by it. Host-provided globals (setLoop, console, setTimeout, DEG2RAD, asset, …) are NOT here —
// they live in src/host.d.ts as declarations and stay as free references at runtime.

// ---- math ----
export { Mathf } from "./math/Mathf"
export { Vec2, Vec3 } from "./math/vec"
export { Quat } from "./math/quat"
export { Mat4 } from "./math/mat4"
export { Color } from "./core/color"

// ---- aspects (attachable node capabilities) ----
export { Aspect, type With } from "./core/Aspect"
export { InspectorUI } from "./core/InspectorUI"

// ---- reactivity (signals; UI text/style props also accept `() => value` bindings) ----
export { signal, computed, effect, type Signal, type Computed } from "./core/signals"

// ---- canvas (core 2D drawing that bakes to a texture; shared by 2D/3D/UI) ----
export { Canvas, Bitmap } from "./canvas/Canvas"

// ---- platform runtime (injected globals; the host provides the lower-level _creator* bridges) ----
export { toast, openURL, SvgSource } from "./runtime/misc"
export { app, type AppState } from "./runtime/app"
export { clipboard } from "./runtime/clipboard"
export { date, type DateValue, type DateInput, type Unit, type Locale } from "./runtime/datetime"
export { fetch, fetchLocal, FormData, File, type FetchResponse } from "./runtime/fetch"
export { localStorage } from "./runtime/storage"
export { device, type HapticStyle, type MotionOptions } from "./runtime/device"
export { Input } from "./runtime/input"
export { WebSocket } from "./runtime/net"
export { AudioPlayer, VideoPlayer } from "./runtime/media"
export { openFilePicker } from "./runtime/files"
export { share } from "./runtime/share"
export { ClickEvent, TouchStartEvent, LongPressEvent } from "./runtime/touch"

// ---- 2D engine (creator-2d) ----
export { Scene2D } from "./g2/Scene2D"
export { Node2D } from "./g2/Node2D"
export { Camera2D } from "./g2/Camera2D"
export { Sprite } from "./g2/Sprite"
export { SpriteAnimation } from "./g2/SpriteAnimation"
export { Shape2D } from "./g2/Shape2D"
export { Physics2D } from "./g2/Physics2D"
export { Trigger2D } from "./g2/Trigger2D"
export { CharacterController2D } from "./g2/CharacterController2D"
export { Tilemap } from "./g2/Tilemap"
export { Texture2D } from "./g2/Texture2D"
// sprite sheets as data (.sprite.ts files — see src/g2/SpriteSheet.ts)
export { SpriteSheet, defineSpriteSheet } from "./g2/SpriteSheet"
export type { SpriteSheetDef, SheetSprite, SpriteMakeOptions } from "./g2/SpriteSheet"
// tilesets as data (.tiles.ts files — autotile materials, see src/g2/Tileset.ts + autotile.ts)
export { Tileset, defineTileset, Autotile2D } from "./g2/Tileset"
export { rawCell, isRawCell, rawIndex } from "./g2/autotile"
export { rot90, rot180, rot270, flipX, packTile, tileIndex, tileTurns, tileFlip, tileOriented } from "./g2/autotile"
export type {
  TilesetDef, TileMaterial, PatchMaterial, PathMaterial, PatchSlots, EdgeSlot, FillBlock, BlockEntry,
  TileBlock, TilePart,
} from "./g2/autotile"
// 2D scenes as data (.scene2d.ts files — see src/g2/defineScene2d.ts) + the cells('…') payload
export { defineScene2d, Scene2dHandle } from "./g2/defineScene2d"
export type { Scene2dDef, Scene2dNodeDef, Scene2dEnv, SpriteSourceDef, TilemapSourceDef, Camera2dNodeDef, LoadedScene2d } from "./g2/defineScene2d"
export { cells, encodeCells, type CellsData } from "./g2/cells"
// no-code 2D scenario aspects (attachable in scene files — see src/g2/scenarios2d.ts)
export { CameraFollow } from "./g2/scenarios2d"

// ---- UI (creator-ui) ----
export {
  UIScreen, type UIScreenStyle,
  UIRow, UIColumn, UIBox, type UIContainerStyle,
  UIText, type UITextStyle,
  UIButton, type UIButtonStyle,
  UIImage, type UIImageStyle,
  UIVideo, type UIVideoStyle,
  UIInput, UITextArea, type UIInputStyle,
  UIScrollable, type UIScrollableStyle,
  UIPager, type UIPagerStyle,
  UITabs, type UITabDef,
  defineTabs, type TabDef, type TabsHandle,
  UIWidget, type UIWidgetStyle,
  UIModal, type UIModalStyle,
  UIBottomSheet, type UIBottomSheetStyle,
  UIPopover, type UIPopoverStyle,
  UISpacer, type UISpacerStyle,
  UIVirtualizedList,
  Router,
  NativeView, type UINativeViewStyle,
  registerFont,
  __uiMap,
  __UIColumn, __UIRow, __UIBox, __UIButton, __UIScreen, __UIScrollable, __UIWidget,
} from "./ui/UI"
// The Presentable navigation contract (docs/navigation-presentable-plan.md). `Presentable` is
// interface + runtime companion (declaration merging): `Presentable.current` = what's on screen.
export { Presentable } from "./ui/UI"
export type { PresentOptions, Transition, TransitionName, TransitionSpec, TransitionTransform } from "./ui/UI"
// The base node type + the union a container accepts as children — documented as the signature of
// UIColumn/UIRow/append/etc., so they must be global (type-only; erased at runtime).
export type { UINode, UINodeChild } from "./ui/UINode"
// App theme variables (docs/ui-theme-plan.md): theme({...}) merges + returns typed var()
// accessors; system vars are static props (theme.primaryColor, theme["comfort-top"], …).
export { theme, type ThemeValues, type ThemeAccessors } from "./ui/theme"

// ---- animate ----
export { animate, animateMat4, stopAnimation, pauseAnimation, resumeAnimation } from "./animate/animate"
export { cubicBezier } from "./animate/bezier"
export { easeIn, easeOut, easeInOut } from "./animate/easings"

// ---- plugins (optional, host-provided capabilities — typed NativeView/service wrappers, see src/plugins/) ----
export { QRScanner } from "./plugins/qr"
export { CameraView, type CameraFacing } from "./plugins/camera"
export { Geolocation, type GeoPosition, type GeoOptions, type GeoWatch } from "./plugins/geolocation"
export { Push, type PushPayload, type PushStatus, type PushRegisterOptions, type PushEvent } from "./plugins/push"
export { Service } from "./plugins/service"

// ---- scenes as data (.scene.ts files — see src/scene/defineScene.ts) ----
export { defineScene, use, ref, make, SceneHandle } from "./scene/defineScene"
export type { SceneDef, SceneNodeDef, MeshDef, LightDef, MaterialDef, CameraNodeDef, AspectEntry, MakeEntry, LoadedScene } from "./scene/defineScene"
export type { FieldMeta } from "./core/fields"

// ---- no-code scenario aspects (attachable in the scene editor — see src/gl/scenarios.ts) ----
export { MoveTo, FollowPath, Spin, LookAt, PlayAnimation } from "./gl/scenarios"

// ---- editor plugins (called from `*.editor.ts` files — editor bundles only; DCE'd from apps) ----
export { registerEditorWindow, registerEditorTool, __editorPlugins } from "./scene/editorPlugins"
export type { EditorApi, EditorRayHit, EditorToolHooks, EditorWindowFn } from "./scene/editorPlugins"

// ---- 3D engine (creator-gl) ----
export { Scene, ARScene, VRScene } from "./gl/Scene"
export { Node } from "./gl/Node"
export { Mesh } from "./gl/Mesh"
export { Model } from "./gl/Model"
export { Shape } from "./gl/Shape"
export { Physics } from "./gl/Physics"
export { Trigger } from "./gl/Trigger"
export { CharacterController } from "./gl/CharacterController"
export { ModelAnimation } from "./gl/ModelAnimation"
export { Light } from "./gl/Light"
export { Material } from "./gl/Material"
export { Geometry } from "./gl/Geometry"
export { Texture } from "./gl/Texture"
export { Camera } from "./gl/Camera"
export { Ray } from "./gl/Ray"
export { Plane } from "./gl/Plane"
export { Noise } from "./gl/Noise"
export { Particles, Trail, curve, colorCurve } from "./gl/Particles"
