Skip to content

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.

refactor(ui): fold ui2/ into ui/ as canonical layout

esenginea7c5364ff2c2
diff --git a/sdk/src/sceneManager.ts b/sdk/src/sceneManager.ts
index 8de79321a..46fee7fbc 100644
--- a/sdk/src/sceneManager.ts
+++ b/sdk/src/sceneManager.ts
@@ -21,7 +21,7 @@ import {
ShapeRenderer, ParticleEmitter,
type AnyComponentDef,
} from './component';
-import { UIRenderer } from './ui/UIRenderer';
+import { UIRenderer } from './ui/core/ui-renderer';
import { Assets } from './asset/AssetPlugin';
import { RuntimeConfig } from './defaults';
diff --git a/sdk/src/ui/DragPlugin.ts b/sdk/src/ui/DragPlugin.ts
index 682466c33..1b722e088 100644
--- a/sdk/src/ui/DragPlugin.ts
+++ b/sdk/src/ui/DragPlugin.ts
@@ -1,18 +1,18 @@
import type { App, Plugin } from '../app';
import { registerComponent, Transform, Parent, Sprite } from '../component';
import type { TransformData, ParentData, SpriteData } from '../component';
-import { UIRect } from './UIRect';
-import type { UIRectData } from './UIRect';
+import { UIRect } from './core/ui-rect';
+import type { UIRectData } from './core/ui-rect';
import { defineSystem, Schedule } from '../system';
import { Res } from '../resource';
import { Input } from '../input';
import type { InputState } from '../input';
import type { Entity } from '../types';
import type { World } from '../world';
-import { Draggable, DragState } from './Draggable';
-import type { DraggableData, DragStateData } from './Draggable';
-import { UIInteraction } from './UIInteraction';
-import type { UIInteractionData } from './UIInteraction';
+import { Draggable, DragState } from './behavior/draggable';
+import type { DraggableData, DragStateData } from './behavior/draggable';
+import { UIInteraction } from './behavior/interactable';
+import type { UIInteractionData } from './behavior/interactable';
import { UIEvents, UIEventQueue } from './UIEvents';
import { UICameraInfo } from './UICameraInfo';
import type { UICameraData } from './UICameraInfo';
diff --git a/sdk/src/ui/Draggable.ts b/sdk/src/ui/Draggable.ts
deleted file mode 100644
index eff408685..000000000
--- a/sdk/src/ui/Draggable.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-export {
- Draggable,
- DragState,
- type DraggableData,
- type DragStateData,
-} from '../ui2/behavior/draggable';
diff --git a/sdk/src/ui/FlexContainer.ts b/sdk/src/ui/FlexContainer.ts
deleted file mode 100644
index e3ec70587..000000000
--- a/sdk/src/ui/FlexContainer.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-export {
- FlexContainer,
- FlexDirection,
- FlexWrap,
- JustifyContent,
- AlignItems,
- AlignContent,
- type FlexContainerData,
-} from '../ui2/layout/flex';
diff --git a/sdk/src/ui/FlexItem.ts b/sdk/src/ui/FlexItem.ts
deleted file mode 100644
index e5bbceff3..000000000
--- a/sdk/src/ui/FlexItem.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export {
- FlexItem,
- AlignSelf,
- type FlexItemData,
-} from '../ui2/layout/flex';
diff --git a/sdk/src/ui/FocusPlugin.ts b/sdk/src/ui/FocusPlugin.ts
index 594756a86..f6c6ad963 100644
--- a/sdk/src/ui/FocusPlugin.ts
+++ b/sdk/src/ui/FocusPlugin.ts
@@ -5,12 +5,12 @@ import { Res } from '../resource';
import { Input } from '../input';
import type { InputState } from '../input';
import type { Entity } from '../types';
-import { Focusable, FocusManager, FocusManagerState } from './Focusable';
-import type { FocusableData } from './Focusable';
-import { Interactable } from './Interactable';
-import type { InteractableData } from './Interactable';
-import { UIInteraction } from './UIInteraction';
-import type { UIInteractionData } from './UIInteraction';
+import { Focusable, FocusManager, FocusManagerState } from './behavior/focusable';
+import type { FocusableData } from './behavior/focusable';
+import { Interactable } from './behavior/interactable';
+import type { InteractableData } from './behavior/interactable';
+import { UIInteraction } from './behavior/interactable';
+import type { UIInteractionData } from './behavior/interactable';
import { playModeOnly } from '../env';
import { UIEvents, UIEventQueue } from './UIEvents';
import { PluginName } from '../systemLabels';
diff --git a/sdk/src/ui/Focusable.ts b/sdk/src/ui/Focusable.ts
deleted file mode 100644
index 6c1d564ec..000000000
--- a/sdk/src/ui/Focusable.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-export {
- Focusable,
- FocusManager,
- FocusManagerState,
- type FocusableData,
-} from '../ui2/behavior/focusable';
diff --git a/sdk/src/ui/Image.ts b/sdk/src/ui/Image.ts
deleted file mode 100644
index fecd07139..000000000
--- a/sdk/src/ui/Image.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export {
- Image,
- ImageType,
- FillMethod,
- FillOrigin,
- type ImageData,
-} from '../ui2/core/image';
diff --git a/sdk/src/ui/ImagePlugin.ts b/sdk/src/ui/ImagePlugin.ts
index c5dd6daa0..4e290b579 100644
--- a/sdk/src/ui/ImagePlugin.ts
+++ b/sdk/src/ui/ImagePlugin.ts
@@ -2,12 +2,12 @@ import type { App, Plugin } from '../app';
import type { Entity } from '../types';
import { registerComponent } from '../component';
import { defineSystem, Schedule } from '../system';
-import { Image, ImageType, FillMethod, FillOrigin } from './Image';
-import type { ImageData } from './Image';
-import { UIRect } from './UIRect';
-import type { UIRectData } from './UIRect';
-import { UIRenderer, UIVisualType } from './UIRenderer';
-import type { UIRendererData } from './UIRenderer';
+import { Image, ImageType, FillMethod, FillOrigin } from './core/image';
+import type { ImageData } from './core/image';
+import { UIRect } from './core/ui-rect';
+import type { UIRectData } from './core/ui-rect';
+import { UIRenderer, UIVisualType } from './core/ui-renderer';
+import type { UIRendererData } from './core/ui-renderer';
import { getEffectiveWidth, getEffectiveHeight, ensureUIRenderer } from './uiHelpers';
import { SystemLabel, PluginName } from '../systemLabels';
diff --git a/sdk/src/ui/Interactable.ts b/sdk/src/ui/Interactable.ts
deleted file mode 100644
index fbba1084f..000000000
--- a/sdk/src/ui/Interactable.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { Interactable, type InteractableData } from '../ui2/behavior/interactable';
diff --git a/sdk/src/ui/SafeAreaPlugin.ts b/sdk/src/ui/SafeAreaPlugin.ts
index 661a2f7f1..102f0cb30 100644
--- a/sdk/src/ui/SafeAreaPlugin.ts
+++ b/sdk/src/ui/SafeAreaPlugin.ts
@@ -7,8 +7,8 @@ import { SafeArea } from './SafeArea';
import type { SafeAreaData } from './SafeArea';
import { UICameraInfo } from './UICameraInfo';
import type { UICameraData } from './UICameraInfo';
-import { UIRect } from './UIRect';
-import type { UIRectData } from './UIRect';
+import { UIRect } from './core/ui-rect';
+import type { UIRectData } from './core/ui-rect';
import { SystemLabel, PluginName } from '../systemLabels';
export interface SafeAreaInsets {
diff --git a/sdk/src/ui/ScrollViewPlugin.ts b/sdk/src/ui/ScrollViewPlugin.ts
index db8f72e42..9ee429aab 100644
--- a/sdk/src/ui/ScrollViewPlugin.ts
+++ b/sdk/src/ui/ScrollViewPlugin.ts
@@ -9,12 +9,12 @@ import type { InputState } from '../input';
import type { Entity } from '../types';
import { ScrollView } from './ScrollView';
import type { ScrollViewData } from './ScrollView';
-import { UIRect } from './UIRect';
-import type { UIRectData } from './UIRect';
-import { Interactable } from './Interactable';
-import { UIMask, MaskMode } from './UIMask';
-import { UIInteraction } from './UIInteraction';
-import type { UIInteractionData } from './UIInteraction';
+import { UIRect } from './core/ui-rect';
+import type { UIRectData } from './core/ui-rect';
+import { Interactable } from './behavior/interactable';
+import { UIMask, MaskMode } from './core/ui-mask';
+import { UIInteraction } from './behavior/interactable';
+import type { UIInteractionData } from './behavior/interactable';
import { UICameraInfo } from './UICameraInfo';
import type { UICameraData } from './UICameraInfo';
import { isEditor, isPlayMode } from '../env';
diff --git a/sdk/src/ui/TextInputPlugin.ts b/sdk/src/ui/TextInputPlugin.ts
index 1feb5f633..58934f7bf 100644
--- a/sdk/src/ui/TextInputPlugin.ts
+++ b/sdk/src/ui/TextInputPlugin.ts
@@ -4,12 +4,12 @@ import { RuntimeConfig } from '../defaults';
import { defineSystem, Schedule } from '../system';
import { registerComponent } from '../component';
import { TextInput, type TextInputData } from './TextInput';
-import { UIRect, type UIRectData } from './UIRect';
-import { UIRenderer, UIVisualType } from './UIRenderer';
-import type { UIRendererData } from './UIRenderer';
-import { Interactable } from './Interactable';
-import { Focusable } from './Focusable';
-import { FocusManager, FocusManagerState } from './Focusable';
+import { UIRect, type UIRectData } from './core/ui-rect';
+import { UIRenderer, UIVisualType } from './core/ui-renderer';
+import type { UIRendererData } from './core/ui-renderer';
+import { Interactable } from './behavior/interactable';
+import { Focusable } from './behavior/focusable';
+import { FocusManager, FocusManagerState } from './behavior/focusable';
import { UIEvents, UIEventQueue } from './UIEvents';
import { Res } from '../resource';
import { platformCreateCanvas } from '../platform';
diff --git a/sdk/src/ui/TextPlugin.ts b/sdk/src/ui/TextPlugin.ts
index b210a9c6f..0707a6b23 100644
--- a/sdk/src/ui/TextPlugin.ts
+++ b/sdk/src/ui/TextPlugin.ts
@@ -2,11 +2,11 @@ import type { App, Plugin } from '../app';
import { type Entity } from '../types';
import { defineSystem, Schedule } from '../system';
import { registerComponent } from '../component';
-import { Text, type TextData } from './text';
+import { Text, type TextData } from './core/text';
import { TextRenderer } from './TextRenderer';
-import { UIRect, type UIRectData } from './UIRect';
-import { UIRenderer, UIVisualType } from './UIRenderer';
-import type { UIRendererData } from './UIRenderer';
+import { UIRect, type UIRectData } from './core/ui-rect';
+import { UIRenderer, UIVisualType } from './core/ui-renderer';
+import type { UIRendererData } from './core/ui-renderer';
import { getEffectiveWidth, getEffectiveHeight, setUIRectSizeNative, ensureUIRenderer } from './uiHelpers';
import { getImageResolver, type DefaultImageResolver } from './ImageResolver';
import { parseRichText } from './RichTextParser';
diff --git a/sdk/src/ui/TextRenderer.ts b/sdk/src/ui/TextRenderer.ts
index 054af2240..245ece993 100644
--- a/sdk/src/ui/TextRenderer.ts
+++ b/sdk/src/ui/TextRenderer.ts
@@ -6,7 +6,7 @@
import type { Entity } from '../types';
import { RuntimeConfig } from '../defaults';
import type { ESEngineModule } from '../wasm';
-import { TextAlign, TextVerticalAlign, TextOverflow, type TextData } from './text';
+import { TextAlign, TextVerticalAlign, TextOverflow, type TextData } from './core/text';
import { platformCreateCanvas } from '../platform';
import { requireResourceManager } from '../resourceManager';
import { wrapText, nextPowerOf2, colorToRgba } from './uiHelpers';
diff --git a/sdk/src/ui/UIInteraction.ts b/sdk/src/ui/UIInteraction.ts
deleted file mode 100644
index 5c1cac33f..000000000
--- a/sdk/src/ui/UIInteraction.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { UIInteraction, type UIInteractionData } from '../ui2/behavior/interactable';
diff --git a/sdk/src/ui/UIInteractionPlugin.ts b/sdk/src/ui/UIInteractionPlugin.ts
index be26779e0..a1c64d341 100644
--- a/sdk/src/ui/UIInteractionPlugin.ts
+++ b/sdk/src/ui/UIInteractionPlugin.ts
@@ -7,14 +7,14 @@ import type { InputState } from '../input';
import type { Entity } from '../types';
import type { World } from '../world';
import { playModeOnly } from '../env';
-import { Interactable } from './Interactable';
-import { UIInteraction } from './UIInteraction';
-import type { UIInteractionData } from './UIInteraction';
+import { Interactable } from './behavior/interactable';
+import { UIInteraction } from './behavior/interactable';
+import type { UIInteractionData } from './behavior/interactable';
import { UIEvents, UIEventQueue } from './UIEvents';
import type { UIEventType } from './UIEvents';
import { UICameraInfo } from './UICameraInfo';
import type { UICameraData } from './UICameraInfo';
-import type { InteractableData } from './Interactable';
+import type { InteractableData } from './behavior/interactable';
import { screenToWorld, createInvVPCache } from './uiMath';
import { platformDevicePixelRatio } from '../platform';
import { ensureComponent, walkParentChain } from './uiHelpers';
diff --git a/sdk/src/ui/UILayoutPlugin.ts b/sdk/src/ui/UILayoutPlugin.ts
index b300e0d66..27ced05fb 100644
--- a/sdk/src/ui/UILayoutPlugin.ts
+++ b/sdk/src/ui/UILayoutPlugin.ts
@@ -3,8 +3,8 @@ import { registerComponent } from '../component';
import { defineSystem, Schedule } from '../system';
import { SystemLabel } from '../systemLabels';
import { Res } from '../resource';
-import { UIRect } from './UIRect';
-import { UIRenderer } from './UIRenderer';
+import { UIRect } from './core/ui-rect';
+import { UIRenderer } from './core/ui-renderer';
import { UICameraInfo } from './UICameraInfo';
import type { UICameraData } from './UICameraInfo';
import { UILayoutGeneration } from './UILayoutGeneration';
diff --git a/sdk/src/ui/UIMask.ts b/sdk/src/ui/UIMask.ts
deleted file mode 100644
index 655b67306..000000000
--- a/sdk/src/ui/UIMask.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { UIMask, MaskMode, type UIMaskData } from '../ui2/core/ui-mask';
diff --git a/sdk/src/ui/UIMaskPlugin.ts b/sdk/src/ui/UIMaskPlugin.ts
index e31d803f7..78062d8ff 100644
--- a/sdk/src/ui/UIMaskPlugin.ts
+++ b/sdk/src/ui/UIMaskPlugin.ts
@@ -1,6 +1,6 @@
import type { App, Plugin } from '../app';
import { registerComponent } from '../component';
-import { UIMask } from './UIMask';
+import { UIMask } from './core/ui-mask';
import { PluginName } from '../systemLabels';
export class UIMaskPlugin implements Plugin {
diff --git a/sdk/src/ui/UIRect.ts b/sdk/src/ui/UIRect.ts
deleted file mode 100644
index e79247157..000000000
--- a/sdk/src/ui/UIRect.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { UIRect, type UIRectData } from '../ui2/core/ui-rect';
diff --git a/sdk/src/ui/UIRenderer.ts b/sdk/src/ui/UIRenderer.ts
deleted file mode 100644
index 8b015c3ce..000000000
--- a/sdk/src/ui/UIRenderer.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { UIRenderer, UIVisualType, type UIRendererData } from '../ui2/core/ui-renderer';
diff --git a/sdk/src/ui2/behavior/draggable.ts b/sdk/src/ui/behavior/draggable.ts
similarity index 100%
rename from sdk/src/ui2/behavior/draggable.ts
rename to sdk/src/ui/behavior/draggable.ts
diff --git a/sdk/src/ui2/behavior/focusable.ts b/sdk/src/ui/behavior/focusable.ts
similarity index 100%
rename from sdk/src/ui2/behavior/focusable.ts
rename to sdk/src/ui/behavior/focusable.ts
diff --git a/sdk/src/ui2/behavior/interactable.ts b/sdk/src/ui/behavior/interactable.ts
similarity index 100%
rename from sdk/src/ui2/behavior/interactable.ts
rename to sdk/src/ui/behavior/interactable.ts
diff --git a/sdk/src/ui2/behavior/state-machine.ts b/sdk/src/ui/behavior/state-machine.ts
similarity index 100%
rename from sdk/src/ui2/behavior/state-machine.ts
rename to sdk/src/ui/behavior/state-machine.ts
diff --git a/sdk/src/ui2/behavior/state-visuals.ts b/sdk/src/ui/behavior/state-visuals.ts
similarity index 100%
rename from sdk/src/ui2/behavior/state-visuals.ts
rename to sdk/src/ui/behavior/state-visuals.ts
diff --git a/sdk/src/ui2/behavior/systems.ts b/sdk/src/ui/behavior/systems.ts
similarity index 100%
rename from sdk/src/ui2/behavior/systems.ts
rename to sdk/src/ui/behavior/systems.ts
diff --git a/sdk/src/ui2/collection/data-source.ts b/sdk/src/ui/collection/data-source.ts
similarity index 100%
rename from sdk/src/ui2/collection/data-source.ts
rename to sdk/src/ui/collection/data-source.ts
diff --git a/sdk/src/ui2/collection/layout-provider.ts b/sdk/src/ui/collection/layout-provider.ts
similarity index 100%
rename from sdk/src/ui2/collection/layout-provider.ts
rename to sdk/src/ui/collection/layout-provider.ts
diff --git a/sdk/src/ui2/collection/list-view.ts b/sdk/src/ui/collection/list-view.ts
similarity index 100%
rename from sdk/src/ui2/collection/list-view.ts
rename to sdk/src/ui/collection/list-view.ts
diff --git a/sdk/src/ui2/collection/scroll-container.ts b/sdk/src/ui/collection/scroll-container.ts
similarity index 100%
rename from sdk/src/ui2/collection/scroll-container.ts
rename to sdk/src/ui/collection/scroll-container.ts
diff --git a/sdk/src/ui2/collection/view-pool.ts b/sdk/src/ui/collection/view-pool.ts
similarity index 100%
rename from sdk/src/ui2/collection/view-pool.ts
rename to sdk/src/ui/collection/view-pool.ts
diff --git a/sdk/src/ui2/core/events.ts b/sdk/src/ui/core/events.ts
similarity index 100%
rename from sdk/src/ui2/core/events.ts
rename to sdk/src/ui/core/events.ts
diff --git a/sdk/src/ui2/core/image.ts b/sdk/src/ui/core/image.ts
similarity index 100%
rename from sdk/src/ui2/core/image.ts
rename to sdk/src/ui/core/image.ts
diff --git a/sdk/src/ui2/core/text.ts b/sdk/src/ui/core/text.ts
similarity index 100%
rename from sdk/src/ui2/core/text.ts
rename to sdk/src/ui/core/text.ts
diff --git a/sdk/src/ui2/core/ui-mask.ts b/sdk/src/ui/core/ui-mask.ts
similarity index 100%
rename from sdk/src/ui2/core/ui-mask.ts
rename to sdk/src/ui/core/ui-mask.ts
diff --git a/sdk/src/ui2/core/ui-rect.ts b/sdk/src/ui/core/ui-rect.ts
similarity index 100%
rename from sdk/src/ui2/core/ui-rect.ts
rename to sdk/src/ui/core/ui-rect.ts
diff --git a/sdk/src/ui2/core/ui-renderer.ts b/sdk/src/ui/core/ui-renderer.ts
similarity index 100%
rename from sdk/src/ui2/core/ui-renderer.ts
rename to sdk/src/ui/core/ui-renderer.ts
diff --git a/sdk/src/ui/index.ts b/sdk/src/ui/index.ts
index 5e56139b3..d92f2be22 100644
--- a/sdk/src/ui/index.ts
+++ b/sdk/src/ui/index.ts
@@ -1,6 +1,6 @@
/**
* @file ui/index.ts
- * @brief UI module exports
+ * @brief UI module — public barrel.
*/
// Shared Types
@@ -51,52 +51,211 @@ export {
DROPDOWN_HIGHLIGHT_COLOR,
} from './uiConstants';
-// Text Component
+// ─── Layer 0: Events ────────────────────────────────────────────────────────
+
+export {
+ UIEventQueue,
+ UIEventType,
+ UIEventBus,
+ type UIEvent,
+ type UIEventHandler,
+ type Unsubscribe,
+} from './core/events';
+
+// Legacy UIEvents resource (still used by UIInteractionPlugin / DragPlugin /
+// FocusPlugin / TextInputPlugin until those migrate to UIEventBus).
+export { UIEvents } from './UIEvents';
+
+// ─── Layer 1: Primitives ────────────────────────────────────────────────────
+
+export { UIRect, type UIRectData } from './core/ui-rect';
+
+export {
+ UIRenderer,
+ UIVisualType,
+ type UIRendererData,
+} from './core/ui-renderer';
+
+export { UIMask, MaskMode, type UIMaskData } from './core/ui-mask';
+
export {
Text,
TextAlign,
TextVerticalAlign,
TextOverflow,
type TextData,
-} from './text';
+} from './core/text';
-// UIRect Component
export {
- UIRect,
- type UIRectData,
-} from './UIRect';
+ Image,
+ ImageType,
+ FillMethod,
+ FillOrigin,
+ type ImageData,
+} from './core/image';
-// UIRenderer Component
export {
- UIRenderer,
- UIVisualType,
- type UIRendererData,
-} from './UIRenderer';
+ FlexContainer,
+ FlexDirection,
+ FlexWrap,
+ JustifyContent,
+ AlignItems,
+ AlignContent,
+ type FlexContainerData,
+ FlexItem,
+ AlignSelf,
+ type FlexItemData,
+} from './layout/flex';
-// Text Renderer
export {
- TextRenderer,
- type TextRenderResult,
-} from './TextRenderer';
+ GridLayout,
+ GridLayoutDirection,
+ type GridLayoutData,
+} from './layout/grid';
+
+// ─── Layer 2: Behaviors ─────────────────────────────────────────────────────
+
+export {
+ Interactable,
+ UIInteraction,
+ type InteractableData,
+ type UIInteractionData,
+} from './behavior/interactable';
+
+export {
+ StateMachine,
+ type StateMachineData,
+} from './behavior/state-machine';
+
+export {
+ StateVisuals,
+ TransitionFlag,
+ STATE_VISUALS_SLOT_COUNT,
+ type StateVisualsData,
+} from './behavior/state-visuals';
+
+export {
+ Focusable,
+ FocusManager,
+ FocusManagerState,
+ type FocusableData,
+} from './behavior/focusable';
+
+export {
+ Draggable,
+ DragState,
+ type DraggableData,
+ type DragStateData,
+} from './behavior/draggable';
+
+export {
+ driverStateFor,
+ findStateSlot,
+ createInteractableDriverSystem,
+ createStateMachineDiffSystem,
+ createStateVisualsApplySystem,
+} from './behavior/systems';
+
+export { UIBehaviorPlugin, uiBehaviorPlugin } from './plugin';
+
+// ─── Collection ─────────────────────────────────────────────────────────────
+
+export {
+ ViewPool,
+ type ViewPoolOptions,
+ type ViewPoolTemplate,
+} from './collection/view-pool';
+
+export {
+ type DataSource,
+ type DataSourceChange,
+ ArrayDataSource,
+ arrayDataSource,
+} from './collection/data-source';
+
+export {
+ type LayoutProvider,
+ type Rect,
+ type LinearLayoutOptions,
+ type GridLayoutOptions,
+ LinearLayoutProvider,
+ GridLayoutProvider,
+} from './collection/layout-provider';
+
+export {
+ ListView,
+ ListViewRegistry,
+ type ListViewOptions,
+ type ListViewItemTemplate,
+} from './collection/list-view';
+
+export {
+ ScrollContainer,
+ ScrollContainerRegistry,
+ type ScrollContainerOptions,
+ type ScrollListener,
+} from './collection/scroll-container';
+
+// ─── Widgets (Layer 3 factories) ────────────────────────────────────────────
+
+export {
+ identityTransform,
+ buildUIRect,
+ buildUIRenderer,
+ buildText,
+ spawnUIEntity,
+ setUIVisible,
+ type UIRectInit,
+ type UIRendererInit,
+ type TextInit,
+ type UIEntityInit,
+} from './widgets/helpers';
+
+export {
+ createButton,
+ setButtonState,
+ type ButtonOptions,
+ type ButtonStateVisual,
+} from './widgets/button';
+
+export {
+ createToggle,
+ type ToggleOptions,
+ type ToggleHandle,
+} from './widgets/toggle';
+
+export {
+ createProgress,
+ type ProgressOptions,
+ type ProgressHandle,
+} from './widgets/progress';
+
+export {
+ createDialog,
+ type DialogOptions,
+ type DialogHandle,
+} from './widgets/dialog';
-// Text Plugin
export {
- TextPlugin,
- textPlugin,
-} from './TextPlugin';
+ createSlider,
+ type SliderOptions,
+ type SliderHandle,
+} from './widgets/slider';
-// UIMask Component
export {
- UIMask,
- MaskMode,
- type UIMaskData,
-} from './UIMask';
+ createDropdown,
+ type DropdownOptions,
+ type DropdownHandle,
+} from './widgets/dropdown';
+
+// ─── Rendering / text helpers ───────────────────────────────────────────────
-// UIMask Plugin
export {
- UIMaskPlugin,
- uiMaskPlugin,
-} from './UIMaskPlugin';
+ TextRenderer,
+ type TextRenderResult,
+} from './TextRenderer';
+
+export { TextPlugin, textPlugin } from './TextPlugin';
// UI Math Utilities
export {
@@ -111,159 +270,58 @@ export {
type ScreenRect,
} from './uiMath';
-// Interactable Component
-export {
- Interactable,
- type InteractableData,
-} from './Interactable';
+// ─── Legacy plugins / resources still in ui/ ────────────────────────────────
-// UIInteraction Component
-export {
- UIInteraction,
- type UIInteractionData,
-} from './UIInteraction';
-
-// UI Events
-export {
- UIEvents,
- UIEventQueue,
- type UIEvent,
- type UIEventType,
- type UIEventHandler,
- type Unsubscribe,
-} from './UIEvents';
+export { UIMaskPlugin, uiMaskPlugin } from './UIMaskPlugin';
-// UI Camera Info Resource
export {
UICameraInfo,
type UICameraData,
} from './UICameraInfo';
-// UI Layout Calculation
export {
computeUIRectLayout,
type LayoutRect,
type LayoutResult,
} from './uiHelpers';
-// UI Layout Generation Resource
export {
UILayoutGeneration,
type UILayoutGenerationData,
} from './UILayoutGeneration';
-// UI Layout Plugin
-export {
- UILayoutPlugin,
- uiLayoutPlugin,
-} from './UILayoutPlugin';
+export { UILayoutPlugin, uiLayoutPlugin } from './UILayoutPlugin';
-// UI Interaction Plugin
-export {
- UIInteractionPlugin,
- uiInteractionPlugin,
-} from './UIInteractionPlugin';
+export { UIInteractionPlugin, uiInteractionPlugin } from './UIInteractionPlugin';
-// TextInput Component
export {
TextInput,
type TextInputData,
} from './TextInput';
-// TextInput Plugin
-export {
- TextInputPlugin,
- textInputPlugin,
-} from './TextInputPlugin';
+export { TextInputPlugin, textInputPlugin } from './TextInputPlugin';
-// Image Component
-export {
- Image,
- ImageType,
- FillMethod,
- FillOrigin,
- type ImageData,
-} from './Image';
+export { ImagePlugin, imagePlugin } from './ImagePlugin';
-// Image Plugin
-export {
- ImagePlugin,
- imagePlugin,
-} from './ImagePlugin';
+export { DragPlugin, dragPlugin } from './DragPlugin';
-// Draggable Component
-export {
- Draggable,
- DragState,
- type DraggableData,
- type DragStateData,
-} from './Draggable';
-
-// Drag Plugin
-export {
- DragPlugin,
- dragPlugin,
-} from './DragPlugin';
-
-// ScrollView Component
export {
ScrollView,
type ScrollViewData,
} from './ScrollView';
-// ScrollView Plugin
-export {
- ScrollViewPlugin,
- scrollViewPlugin,
-} from './ScrollViewPlugin';
+export { ScrollViewPlugin, scrollViewPlugin } from './ScrollViewPlugin';
-// Focusable Component
-export {
- Focusable,
- FocusManager,
- FocusManagerState,
- type FocusableData,
-} from './Focusable';
-
-// Focus Plugin
-export {
- FocusPlugin,
- focusPlugin,
-} from './FocusPlugin';
+export { FocusPlugin, focusPlugin } from './FocusPlugin';
-// SafeArea Component
export {
SafeArea,
type SafeAreaData,
} from './SafeArea';
-// SafeArea Plugin
-export {
- SafeAreaPlugin,
- safeAreaPlugin,
-} from './SafeAreaPlugin';
-
-// FlexContainer Component
-export {
- FlexContainer,
- FlexDirection,
- FlexWrap,
- JustifyContent,
- AlignItems,
- type FlexContainerData,
-} from './FlexContainer';
-
-// FlexItem Component
-export {
- FlexItem,
- type FlexItemData,
-} from './FlexItem';
+export { SafeAreaPlugin, safeAreaPlugin } from './SafeAreaPlugin';
-// UIRenderOrder Plugin
-export {
- UIRenderOrderPlugin,
- uiRenderOrderPlugin,
-} from './UIRenderOrderPlugin';
+export { UIRenderOrderPlugin, uiRenderOrderPlugin } from './UIRenderOrderPlugin';
// UI Theme
export {
@@ -272,12 +330,6 @@ export {
type UITheme,
} from './UITheme';
-// StateMachine (C++-backed) — canonical in ui2
-export {
- StateMachine,
- type StateMachineData,
-} from '../ui2/behavior/state-machine';
-
// Property Path Utilities
export {
getNestedProperty,
@@ -317,13 +369,6 @@ export {
type ResolvedImage,
} from './ImageResolver';
-// GridLayout (C++-backed ECS component) — canonical in ui2
-export {
- GridLayout,
- GridLayoutDirection,
- type GridLayoutData,
-} from '../ui2/layout/grid';
-
export const AnimOverride = {
POS_X: 1,
POS_Y: 2,
diff --git a/sdk/src/ui2/layout/flex.ts b/sdk/src/ui/layout/flex.ts
similarity index 100%
rename from sdk/src/ui2/layout/flex.ts
rename to sdk/src/ui/layout/flex.ts
diff --git a/sdk/src/ui2/layout/grid.ts b/sdk/src/ui/layout/grid.ts
similarity index 100%
rename from sdk/src/ui2/layout/grid.ts
rename to sdk/src/ui/layout/grid.ts
diff --git a/sdk/src/ui2/plugin.ts b/sdk/src/ui/plugin.ts
similarity index 100%
rename from sdk/src/ui2/plugin.ts
rename to sdk/src/ui/plugin.ts
diff --git a/sdk/src/ui/text.ts b/sdk/src/ui/text.ts
deleted file mode 100644
index b7b4de038..000000000
--- a/sdk/src/ui/text.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export {
- Text,
- TextAlign,
- TextVerticalAlign,
- TextOverflow,
- type TextData,
-} from '../ui2/core/text';
diff --git a/sdk/src/ui/uiHelpers.ts b/sdk/src/ui/uiHelpers.ts
index 79995f893..5f5fdb962 100644
--- a/sdk/src/ui/uiHelpers.ts
+++ b/sdk/src/ui/uiHelpers.ts
@@ -1,17 +1,17 @@
import { Sprite, Parent, Transform } from '../component';
import type { ParentData, SpriteData, TransformData, AnyComponentDef } from '../component';
-import { Image } from './Image';
-import type { ImageData } from './Image';
+import { Image } from './core/image';
+import type { ImageData } from './core/image';
import type { Entity, Color } from '../types';
import type { World } from '../world';
-import { UIRect } from './UIRect';
-import type { UIRectData } from './UIRect';
-import { UIRenderer, UIVisualType } from './UIRenderer';
-import type { UIRendererData } from './UIRenderer';
+import { UIRect } from './core/ui-rect';
+import type { UIRectData } from './core/ui-rect';
+import { UIRenderer, UIVisualType } from './core/ui-renderer';
+import type { UIRendererData } from './core/ui-renderer';
import { FillDirection } from './uiTypes';
import type { ColorTransition } from './uiTypes';
import type { ESEngineModule, CppRegistry } from '../wasm';
-import { Interactable } from './Interactable';
+import { Interactable } from './behavior/interactable';
export interface LayoutRect {
left: number;
diff --git a/sdk/src/ui2/widgets/button.ts b/sdk/src/ui/widgets/button.ts
similarity index 100%
rename from sdk/src/ui2/widgets/button.ts
rename to sdk/src/ui/widgets/button.ts
diff --git a/sdk/src/ui2/widgets/dialog.ts b/sdk/src/ui/widgets/dialog.ts
similarity index 100%
rename from sdk/src/ui2/widgets/dialog.ts
rename to sdk/src/ui/widgets/dialog.ts
diff --git a/sdk/src/ui2/widgets/dropdown.ts b/sdk/src/ui/widgets/dropdown.ts
similarity index 100%
rename from sdk/src/ui2/widgets/dropdown.ts
rename to sdk/src/ui/widgets/dropdown.ts
diff --git a/sdk/src/ui2/widgets/helpers.ts b/sdk/src/ui/widgets/helpers.ts
similarity index 100%
rename from sdk/src/ui2/widgets/helpers.ts
rename to sdk/src/ui/widgets/helpers.ts
diff --git a/sdk/src/ui2/widgets/progress.ts b/sdk/src/ui/widgets/progress.ts
similarity index 100%
rename from sdk/src/ui2/widgets/progress.ts
rename to sdk/src/ui/widgets/progress.ts
diff --git a/sdk/src/ui2/widgets/slider.ts b/sdk/src/ui/widgets/slider.ts
similarity index 100%
rename from sdk/src/ui2/widgets/slider.ts
rename to sdk/src/ui/widgets/slider.ts
diff --git a/sdk/src/ui2/widgets/toggle.ts b/sdk/src/ui/widgets/toggle.ts
similarity index 100%
rename from sdk/src/ui2/widgets/toggle.ts
rename to sdk/src/ui/widgets/toggle.ts
diff --git a/sdk/src/ui2/index.ts b/sdk/src/ui2/index.ts
deleted file mode 100644
index a1993fe74..000000000
--- a/sdk/src/ui2/index.ts
+++ /dev/null
@@ -1,192 +0,0 @@
-// Layer 0 — Infrastructure
-
-export {
- UIEventQueue,
- UIEventType,
- UIEventBus,
- type UIEvent,
- type UIEventHandler,
- type Unsubscribe,
-} from './core/events';
-
-export {
- ViewPool,
- type ViewPoolOptions,
- type ViewPoolTemplate,
-} from './collection/view-pool';
-
-// Layer 1 — Primitives
-
-export { UIRect, type UIRectData } from './core/ui-rect';
-
-export {
- UIRenderer,
- UIVisualType,
- type UIRendererData,
-} from './core/ui-renderer';
-
-export { UIMask, MaskMode, type UIMaskData } from './core/ui-mask';
-
-export {
- Text,
- TextAlign,
- TextVerticalAlign,
- TextOverflow,
- type TextData,
-} from './core/text';
-
-export {
- Image,
- ImageType,
- FillMethod,
- FillOrigin,
- type ImageData,
-} from './core/image';
-
-export {
- FlexContainer,
- FlexDirection,
- FlexWrap,
- JustifyContent,
- AlignItems,
- AlignContent,
- type FlexContainerData,
- FlexItem,
- AlignSelf,
- type FlexItemData,
-} from './layout/flex';
-
-export {
- GridLayout,
- GridLayoutDirection,
- type GridLayoutData,
-} from './layout/grid';
-
-// Layer 2 — Behaviors
-
-export {
- Interactable,
- UIInteraction,
- type InteractableData,
- type UIInteractionData,
-} from './behavior/interactable';
-
-export {
- StateMachine,
- type StateMachineData,
-} from './behavior/state-machine';
-
-export {
- StateVisuals,
- TransitionFlag,
- STATE_VISUALS_SLOT_COUNT,
- type StateVisualsData,
-} from './behavior/state-visuals';
-
-export {
- Focusable,
- FocusManager,
- FocusManagerState,
- type FocusableData,
-} from './behavior/focusable';
-
-export {
- Draggable,
- DragState,
- type DraggableData,
- type DragStateData,
-} from './behavior/draggable';
-
-export {
- driverStateFor,
- findStateSlot,
- createInteractableDriverSystem,
- createStateMachineDiffSystem,
- createStateVisualsApplySystem,
-} from './behavior/systems';
-
-export { UIBehaviorPlugin, uiBehaviorPlugin } from './plugin';
-
-// Collection
-
-export {
- type DataSource,
- type DataSourceChange,
- ArrayDataSource,
- arrayDataSource,
-} from './collection/data-source';
-
-export {
- type LayoutProvider,
- type Rect,
- type LinearLayoutOptions,
- type GridLayoutOptions,
- LinearLayoutProvider,
- GridLayoutProvider,
-} from './collection/layout-provider';
-
-export {
- ListView,
- ListViewRegistry,
- type ListViewOptions,
- type ListViewItemTemplate,
-} from './collection/list-view';
-
-export {
- ScrollContainer,
- ScrollContainerRegistry,
- type ScrollContainerOptions,
- type ScrollListener,
-} from './collection/scroll-container';
-
-// Widgets
-
-export {
- identityTransform,
- buildUIRect,
- buildUIRenderer,
- buildText,
- spawnUIEntity,
- setUIVisible,
- type UIRectInit,
- type UIRendererInit,
- type TextInit,
- type UIEntityInit,
-} from './widgets/helpers';
-
-export {
- createButton,
- setButtonState,
- type ButtonOptions,
- type ButtonStateVisual,
-} from './widgets/button';
-
-export {
- createToggle,
- type ToggleOptions,
- type ToggleHandle,
-} from './widgets/toggle';
-
-export {
- createProgress,
- type ProgressOptions,
- type ProgressHandle,
-} from './widgets/progress';
-
-export {
- createDialog,
- type DialogOptions,
- type DialogHandle,
-} from './widgets/dialog';
-
-export {
- createSlider,
- type SliderOptions,
- type SliderHandle,
-} from './widgets/slider';
-
-export {
- createDropdown,
- type DropdownOptions,
- type DropdownHandle,
-} from './widgets/dropdown';
diff --git a/sdk/tests/emscripten-wrapper.test.ts b/sdk/tests/emscripten-wrapper.test.ts
index fc713d522..3107b6632 100644
--- a/sdk/tests/emscripten-wrapper.test.ts
+++ b/sdk/tests/emscripten-wrapper.test.ts
@@ -6,8 +6,8 @@ import { existsSync } from 'fs';
import { resolve } from 'path';
import { App } from '../src/app';
import { Transform } from '../src/component';
-import { UIRect } from '../src/ui/UIRect';
-import type { UIRectData } from '../src/ui/UIRect';
+import { UIRect } from '../src/ui/core/ui-rect';
+import type { UIRectData } from '../src/ui/core/ui-rect';
import type { ESEngineModule, CppRegistry } from '../src/wasm';
import { loadWasmModule } from './helpers/loadWasm';
diff --git a/sdk/tests/nested-text.test.ts b/sdk/tests/nested-text.test.ts
index 72b0377ee..eccafd24f 100644
--- a/sdk/tests/nested-text.test.ts
+++ b/sdk/tests/nested-text.test.ts
@@ -11,15 +11,15 @@ import { resolve } from 'path';
import { App } from '../src/app';
import { Transform, Sprite, Canvas } from '../src/component';
import type { SpriteData } from '../src/component';
-import { UIRect } from '../src/ui/UIRect';
-import type { UIRectData } from '../src/ui/UIRect';
+import { UIRect } from '../src/ui/core/ui-rect';
+import type { UIRectData } from '../src/ui/core/ui-rect';
import { UICameraInfo } from '../src/ui/UICameraInfo';
import { Input, InputState } from '../src/input';
import { UIEvents, UIEventQueue } from '../src/ui/UIEvents';
import { uiLayoutPlugin } from '../src/ui/UILayoutPlugin';
import { uiRenderOrderPlugin } from '../src/ui/UIRenderOrderPlugin';
-import { Text } from '../src/ui/text';
-import type { TextData } from '../src/ui/text';
+import { Text } from '../src/ui/core/text';
+import type { TextData } from '../src/ui/core/text';
import { textPlugin } from '../src/ui/TextPlugin';
import { INVALID_TEXTURE } from '../src/types';
import type { ESEngineModule, CppRegistry } from '../src/wasm';
diff --git a/sdk/tests/scrollview.test.ts b/sdk/tests/scrollview.test.ts
index a2e765671..9f50b3dba 100644
--- a/sdk/tests/scrollview.test.ts
+++ b/sdk/tests/scrollview.test.ts
@@ -4,7 +4,7 @@ import { resolve } from 'path';
import { App } from '../src/app';
import { Transform, Sprite, Canvas } from '../src/component';
import type { TransformData } from '../src/component';
-import { UIRect } from '../src/ui/UIRect';
+import { UIRect } from '../src/ui/core/ui-rect';
import { UICameraInfo } from '../src/ui/UICameraInfo';
import { Input, InputState } from '../src/input';
import { UIEvents, UIEventQueue } from '../src/ui/UIEvents';
@@ -14,8 +14,8 @@ import { scrollViewPlugin } from '../src/ui/ScrollViewPlugin';
import { uiInteractionPlugin } from '../src/ui/UIInteractionPlugin';
import { ScrollView } from '../src/ui/ScrollView';
import type { ScrollViewData } from '../src/ui/ScrollView';
-import { UIInteraction } from '../src/ui/UIInteraction';
-import { Interactable } from '../src/ui/Interactable';
+import { UIInteraction } from '../src/ui/behavior/interactable';
+import { Interactable } from '../src/ui/behavior/interactable';
import type { ESEngineModule, CppRegistry } from '../src/wasm';
import { loadWasmModule } from './helpers/loadWasm';
diff --git a/sdk/tests/text-bold-italic.test.ts b/sdk/tests/text-bold-italic.test.ts
index d984bd465..5828f5278 100644
--- a/sdk/tests/text-bold-italic.test.ts
+++ b/sdk/tests/text-bold-italic.test.ts
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
-import { Text, type TextData } from '../src/ui/text';
+import { Text, type TextData } from '../src/ui/core/text';
describe('Text bold/italic', () => {
it('defaults to false', () => {
diff --git a/sdk/tests/text-multi-render.test.ts b/sdk/tests/text-multi-render.test.ts
index 29a6478f8..ac204eb3d 100644
--- a/sdk/tests/text-multi-render.test.ts
+++ b/sdk/tests/text-multi-render.test.ts
@@ -9,14 +9,14 @@ import { resolve } from 'path';
import { App } from '../src/app';
import { Transform, Sprite, Canvas } from '../src/component';
import type { SpriteData } from '../src/component';
-import { UIRect } from '../src/ui/UIRect';
+import { UIRect } from '../src/ui/core/ui-rect';
import { UICameraInfo } from '../src/ui/UICameraInfo';
import { Input, InputState } from '../src/input';
import { UIEvents, UIEventQueue } from '../src/ui/UIEvents';
import { uiLayoutPlugin } from '../src/ui/UILayoutPlugin';
import { uiRenderOrderPlugin } from '../src/ui/UIRenderOrderPlugin';
import { textPlugin } from '../src/ui/TextPlugin';
-import { Text } from '../src/ui/text';
+import { Text } from '../src/ui/core/text';
import { INVALID_TEXTURE } from '../src/types';
import type { ESEngineModule, CppRegistry } from '../src/wasm';
import { loadWasmModule } from './helpers/loadWasm';
diff --git a/sdk/tests/timeline-wasm-integration.test.ts b/sdk/tests/timeline-wasm-integration.test.ts
index ccecb83c8..45c400a02 100644
--- a/sdk/tests/timeline-wasm-integration.test.ts
+++ b/sdk/tests/timeline-wasm-integration.test.ts
@@ -9,7 +9,7 @@ import { existsSync } from 'fs';
import { resolve } from 'path';
import { World } from '../src/world';
import { Transform, Children, Name, getComponent } from '../src/component';
-import { UIRect, type UIRectData } from '../src/ui/UIRect';
+import { UIRect, type UIRectData } from '../src/ui/core/ui-rect';
import type { ESEngineModule, CppRegistry } from '../src/wasm';
import { loadWasmModule } from './helpers/loadWasm';
import {
diff --git a/sdk/tests/ui2-behavior.test.ts b/sdk/tests/ui-behavior.test.ts
similarity index 99%
rename from sdk/tests/ui2-behavior.test.ts
rename to sdk/tests/ui-behavior.test.ts
index 72972a414..f3a00a9cf 100644
--- a/sdk/tests/ui2-behavior.test.ts
+++ b/sdk/tests/ui-behavior.test.ts
@@ -8,7 +8,7 @@ import {
UIInteraction,
Focusable,
Draggable,
-} from '../src/ui2';
+} from '../src/ui';
describe('ui2 behavior components', () => {
describe('StateMachine', () => {
diff --git a/sdk/tests/ui-components.test.ts b/sdk/tests/ui-components.test.ts
index c2151dd88..bdcdbe6f8 100644
--- a/sdk/tests/ui-components.test.ts
+++ b/sdk/tests/ui-components.test.ts
@@ -11,12 +11,12 @@ import { resolve } from 'path';
import { App } from '../src/app';
import { World } from '../src/world';
import { Transform, Sprite, Canvas } from '../src/component';
-import { UIRect } from '../src/ui/UIRect';
-import { UIMask, MaskMode } from '../src/ui/UIMask';
-import { FlexContainer, FlexDirection, JustifyContent, AlignItems } from '../src/ui/FlexContainer';
-import { FlexItem } from '../src/ui/FlexItem';
-import { Interactable } from '../src/ui/Interactable';
-import { UIInteraction } from '../src/ui/UIInteraction';
+import { UIRect } from '../src/ui/core/ui-rect';
+import { UIMask, MaskMode } from '../src/ui/core/ui-mask';
+import { FlexContainer, FlexDirection, JustifyContent, AlignItems } from '../src/ui/layout/flex';
+import { FlexItem } from '../src/ui/layout/flex';
+import { Interactable } from '../src/ui/behavior/interactable';
+import { UIInteraction } from '../src/ui/behavior/interactable';
import { UICameraInfo, type UICameraData } from '../src/ui/UICameraInfo';
import { uiLayoutPlugin } from '../src/ui/UILayoutPlugin';
import { uiRenderOrderPlugin } from '../src/ui/UIRenderOrderPlugin';
diff --git a/sdk/tests/ui2-events.test.ts b/sdk/tests/ui-core-events.test.ts
similarity index 99%
rename from sdk/tests/ui2-events.test.ts
rename to sdk/tests/ui-core-events.test.ts
index 9c417e378..04671ebeb 100644
--- a/sdk/tests/ui2-events.test.ts
+++ b/sdk/tests/ui-core-events.test.ts
@@ -3,7 +3,7 @@
* Pure TS; no WASM / World required.
*/
import { describe, it, expect, beforeEach, vi } from 'vitest';
-import { UIEventQueue, UIEventType, type UIEvent } from '../src/ui2/core/events';
+import { UIEventQueue, UIEventType, type UIEvent } from '../src/ui/core/events';
import type { Entity } from '../src/types';
const E1 = 1 as Entity;
diff --git a/sdk/tests/ui2-data-source.test.ts b/sdk/tests/ui-data-source.test.ts
similarity index 99%
rename from sdk/tests/ui2-data-source.test.ts
rename to sdk/tests/ui-data-source.test.ts
index 4ebe5657d..cf688a413 100644
--- a/sdk/tests/ui2-data-source.test.ts
+++ b/sdk/tests/ui-data-source.test.ts
@@ -1,5 +1,5 @@
import { describe, it, expect, vi } from 'vitest';
-import { ArrayDataSource, arrayDataSource, type DataSourceChange } from '../src/ui2';
+import { ArrayDataSource, arrayDataSource, type DataSourceChange } from '../src/ui';
describe('ArrayDataSource', () => {
it('reports count and items from initial array', () => {
diff --git a/sdk/tests/ui-layout-integration.test.ts b/sdk/tests/ui-layout-integration.test.ts
index 8cac70a36..dcde04611 100644
--- a/sdk/tests/ui-layout-integration.test.ts
+++ b/sdk/tests/ui-layout-integration.test.ts
@@ -9,7 +9,7 @@ import { existsSync } from 'fs';
import { resolve } from 'path';
import { App } from '../src/app';
import { World } from '../src/world';
-import { UIRect, type UIRectData } from '../src/ui/UIRect';
+import { UIRect, type UIRectData } from '../src/ui/core/ui-rect';
import { Canvas } from '../src/component';
import { UICameraInfo, type UICameraData } from '../src/ui/UICameraInfo';
import { uiLayoutPlugin } from '../src/ui/UILayoutPlugin';
diff --git a/sdk/tests/ui2-layout-provider.test.ts b/sdk/tests/ui-layout-provider.test.ts
similarity index 99%
rename from sdk/tests/ui2-layout-provider.test.ts
rename to sdk/tests/ui-layout-provider.test.ts
index dda3101ea..eefa47d03 100644
--- a/sdk/tests/ui2-layout-provider.test.ts
+++ b/sdk/tests/ui-layout-provider.test.ts
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
-import { LinearLayoutProvider, GridLayoutProvider, type Rect } from '../src/ui2';
+import { LinearLayoutProvider, GridLayoutProvider, type Rect } from '../src/ui';
const VIEWPORT = (x: number, y: number, w: number, h: number): Rect =>
({ x, y, width: w, height: h });
diff --git a/sdk/tests/ui2-list-view.test.ts b/sdk/tests/ui-list-view.test.ts
similarity index 99%
rename from sdk/tests/ui2-list-view.test.ts
rename to sdk/tests/ui-list-view.test.ts
index e982c399c..dded49f1b 100644
--- a/sdk/tests/ui2-list-view.test.ts
+++ b/sdk/tests/ui-list-view.test.ts
@@ -4,7 +4,7 @@ import {
LinearLayoutProvider,
arrayDataSource,
type DataSource,
-} from '../src/ui2';
+} from '../src/ui';
import type { Entity } from '../src/types';
import type { World } from '../src/world';
diff --git a/sdk/tests/ui2-scroll-container.test.ts b/sdk/tests/ui-scroll-container.test.ts
similarity index 99%
rename from sdk/tests/ui2-scroll-container.test.ts
rename to sdk/tests/ui-scroll-container.test.ts
index dd180bcd7..76dcc4e91 100644
--- a/sdk/tests/ui2-scroll-container.test.ts
+++ b/sdk/tests/ui-scroll-container.test.ts
@@ -1,5 +1,5 @@
import { describe, it, expect, vi } from 'vitest';
-import { ScrollContainer, ScrollContainerRegistry } from '../src/ui2';
+import { ScrollContainer, ScrollContainerRegistry } from '../src/ui';
describe('ScrollContainer', () => {
it('clamps initial offset to [0, max]', () => {
diff --git a/sdk/tests/ui2-slider-dropdown.test.ts b/sdk/tests/ui-slider-dropdown.test.ts
similarity index 99%
rename from sdk/tests/ui2-slider-dropdown.test.ts
rename to sdk/tests/ui-slider-dropdown.test.ts
index bc01afded..f798ce283 100644
--- a/sdk/tests/ui2-slider-dropdown.test.ts
+++ b/sdk/tests/ui-slider-dropdown.test.ts
@@ -6,7 +6,7 @@ import {
UIEventType,
UIRect,
Text,
-} from '../src/ui2';
+} from '../src/ui';
import type { Entity } from '../src/types';
import type { World } from '../src/world';
diff --git a/sdk/tests/ui2-systems.test.ts b/sdk/tests/ui-systems.test.ts
similarity index 99%
rename from sdk/tests/ui2-systems.test.ts
rename to sdk/tests/ui-systems.test.ts
index ead0e28cf..357db91fa 100644
--- a/sdk/tests/ui2-systems.test.ts
+++ b/sdk/tests/ui-systems.test.ts
@@ -5,7 +5,7 @@ import {
TransitionFlag,
type StateVisualsData,
type UIInteractionData,
-} from '../src/ui2';
+} from '../src/ui';
const sv = (overrides: Partial<StateVisualsData> = {}): StateVisualsData => ({
targetGraphic: 0 as never,
diff --git a/sdk/tests/ui2-view-pool.test.ts b/sdk/tests/ui-view-pool.test.ts
similarity index 99%
rename from sdk/tests/ui2-view-pool.test.ts
rename to sdk/tests/ui-view-pool.test.ts
index f1184cd87..adf75861f 100644
--- a/sdk/tests/ui2-view-pool.test.ts
+++ b/sdk/tests/ui-view-pool.test.ts
@@ -3,7 +3,7 @@
* Uses a minimal mock World — enough to exercise onDespawn + valid.
*/
import { describe, it, expect, beforeEach, vi } from 'vitest';
-import { ViewPool } from '../src/ui2/collection/view-pool';
+import { ViewPool } from '../src/ui/collection/view-pool';
import type { Entity } from '../src/types';
import type { World } from '../src/world';
diff --git a/sdk/tests/ui2-widgets.test.ts b/sdk/tests/ui-widgets.test.ts
similarity index 99%
rename from sdk/tests/ui2-widgets.test.ts
rename to sdk/tests/ui-widgets.test.ts
index e9eafdb01..6525f994c 100644
--- a/sdk/tests/ui2-widgets.test.ts
+++ b/sdk/tests/ui-widgets.test.ts
@@ -13,7 +13,7 @@ import {
UIEventQueue,
UIEventType,
TransitionFlag,
-} from '../src/ui2';
+} from '../src/ui';
import type { Entity } from '../src/types';
import type { World } from '../src/world';