A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
export { canvasRootEntities } from './ui/core/canvas-roots';
/**
* @file core-ui.ts
* @brief The stable UI surface promoted into the top-level `esengine`
* namespace (text, UINode box visuals, interaction, layout, theme).
*
* This is the curated *public* UI API. The complete UI module surface — which
* also includes low-level text/atlas internals and engine-internal composition
* glue (e.g. `EntityStateMap`, `ensureComponent`) — lives in
* `./ui` and is imported module-directly by the SDK code that needs it. Those
* internals are intentionally NOT re-exported here, so the public `esengine`
* namespace stays a stable, intentional surface.
*
* Re-exported wholesale by `core.ts`.
*/
export {
Text,
TextAlign,
TextVerticalAlign,
TextOverflow,
TextRenderMode,
UINode,
UIVisual,
UIVisualType,
UIVisualFit,
UILayoutGeneration,
UIMask,
UIWorldAnchor,
placeOnScreen,
type UIWorldAnchorData,
measureText,
preloadGlyphs,
type GlyphPreload,
type GlyphPreloadOptions,
inspectTextLayout,
type TextInspection,
type TextInspectionOptions,
type MeasureTextOptions,
type TextMetrics,
parseRichText,
type RichTextRun,
type TextSegment,
type ImageSegment,
intersectRects,
invertMatrix4,
screenToWorld,
screenRay,
rayPlaneHit,
type WorldRay,
pointInWorldRect,
pointInOBB,
quaternionToAngle2D,
Interactable,
UIInteraction,
UIEvents,
UIEventQueue,
// The value too, not just the union type: the editor's event picker and
// authored data both need the canonical type strings.
UIEventType,
UITabView, type UITabViewData, createTabView, type TabViewOptions, type TabViewHandle,
UITreeView, type UITreeViewData, type TreeViewNode, TreeViewModel,
type TreeDataSource, type TreeItemId, type TreeRow, type TreeDropRequest,
createTreeView, setTreeViewData, type TreeViewOptions, type TreeViewHandle,
UIColorPicker, type UIColorPickerData, createColorPicker, type ColorPickerOptions, type ColorPickerHandle,
UITooltip, type UITooltipData, attachTooltip, createTooltip,
type TooltipOptions, type TooltipHandle,
applyTabViewSelection, previewTooltip,
UICameraInfo,
ScreenOverlay, type ScreenOverlayData,
screenToUiLayout, uiLayoutToScreen, isScreenEntity,
screenToUiWorld,
uiWorldToScreen,
uiHitTestWorld,
uiHitAtScreen,
isPointerBlockedInTree,
uiPickWorld,
uiPickAllWorld,
type PickableWorld,
TextInput,
TextInputFilter,
FillMethod,
FillOrigin,
Draggable,
DragState,
inspectFocusTraversal,
type FocusTraversalInspection, type FocusInspectionWorld,
type FocusTraversalEntry,
type FocusSkipReason,
Focusable,
FocusManager,
FocusManagerState,
SafeArea,
type TextData,
type UIMaskData,
MaskMode,
type ScreenRect,
type InteractableData,
type UIInteractionData,
type UIEvent,
type UIEventHandler,
type Unsubscribe,
type UICameraData,
type TextInputData,
type UIVisualData,
type UILayoutGenerationData,
type DraggableData,
type DragStateData,
type FocusableData,
type SafeAreaData,
// Theme design tokens
DARK_TOKENS,
LIGHT_TOKENS,
getTheme,
setTheme,
themeColors,
themeType,
resolveThemeTokens,
parseThemeOverrides,
THEME_COLOR_ROLES,
type ThemeTokens,
type ThemeColors,
type ThemeType,
type ThemeOverrides,
// Live re-theming
ThemeStyle,
markThemed,
applyThemeToWorld,
switchTheme,
type ThemeStyleData,
type ColorRole,
// Reactive data binding
signal,
derived,
bind,
bindWidgetValue,
type Signal,
type ReadonlySignal,
} from './ui';
// ─── Controllers + Gears (shared UI state) ───────────────────────────────────
// A UIController is a named enum of pages scoped to a UI root; UIGears bind a
// component field to per-page values (snap or tween). The curated authoring
// surface — components, the page-control helpers, and the gear builder.
export {
UIController,
UIGear,
interactionController,
controllerState,
INTERACTION_CONTROLLER,
INTERACTION_PAGES,
gearBinding,
setControllerPage,
getControllerPage,
findControllerOwner,
bindControllerPage,
readFieldPath,
writeFieldPath,
type UIControllerData,
type ControllerState,
type UIGearData,
type GearBinding,
type GearValue,
type GearTween,
} from './ui';
// ─── UI code-composition surface ─────────────────────────────────────────────
// Promoted so UI can be built in code, not just authored in the editor:
// flexbox config, dimension helpers, node/visual/text builders, and the widget
// factories.
export {
// Dimensions
px,
percent,
auto,
isAuto,
DimensionUnit,
type Dimension,
// UINode layout enums
UIPositionType,
UIDisplay,
UIPointerEvents,
AlignSelf,
// Flex container
FlexContainer,
FlexDirection,
FlexWrap,
JustifyContent,
AlignItems,
AlignContent,
type FlexContainerData,
// Anchor presets (authoring shortcuts over the box fields)
AnchorAxis,
ANCHOR_AXES,
anchorPresetFields,
detectAnchor,
detectAnchorAxes,
type AnchorPreset,
type AnchorFields,
// Builders
buildUINode,
buildUIVisual,
buildText,
spawnUIEntity,
setUIVisible,
FILL_AXIS,
type LinearFillDirection,
type UINodeInit,
type UIVisualInit,
type TextInit,
type UIEntityInit,
// Widget factories
createButton,
setButtonState,
themeButtonStates,
makeWidgetInteractable,
type WidgetInteractionInit,
type ButtonOptions,
type ButtonHandle,
type ButtonStateVisual,
createToggle,
type ToggleOptions,
type ToggleHandle,
createSlider,
UISlider,
type UISliderData,
type SliderOptions,
type SliderHandle,
UIToggle,
UIToggleGroup,
type UIToggleData,
type UIToggleGroupData,
UIDropdown,
isDropdownOpen,
openDropdown,
closeDropdown,
type UIDropdownData,
createProgress,
type ProgressOptions,
type ProgressHandle,
createDialog,
UIDialog,
isDialogOpen,
openDialog,
closeDialog,
type UIDialogData,
type DialogOptions,
type DialogHandle,
createDropdown,
type DropdownOptions,
type DropdownHandle,
// Data-driven virtualized list / grid: the ergonomic factory plus the
// collection primitives it composes, as escape hatches.
createListView,
type CreateListViewOptions,
type ListViewHandle,
type ListViewHost,
type ListItemTemplate,
type ListLayoutSpec,
createTextInput,
type TextInputOptions,
type TextInputHandle,
createScrollView,
type ScrollViewOptions,
type ScrollViewHandle,
ListView,
type ListViewOptions,
ScrollContainer,
KineticScroll,
ArrayDataSource,
arrayDataSource,
type DataSource,
type DataSourceChange,
LinearLayoutProvider,
MeasuredLinearLayoutProvider,
GridLayoutProvider,
type LayoutProvider,
widgetToPrefab,
BUILTIN_UI_PREFABS,
BUILTIN_UI_WIDGET_NAMES,
UIPages,
type PageDef,
type PageHandle,
} from './ui';
export { RectAnchors, AnchorFlag, AnchorMode, alignRectAnchorsNow, type RectAnchorsData } from './ui';
export { VirtualJoystick, VirtualButton, VirtualJoystickMode, createVirtualJoystick, createVirtualButton, type VirtualJoystickData, type VirtualButtonData, type VirtualJoystickOptions, type VirtualButtonOptions } from './ui';
export { deferredEntities, deferredRecord } from './scene/deferredInstances';
export type { DeferredRecord } from './prefab/deferred';