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.

feat(ui): add Layer 1 primitive re-exports in ui2/

esengineaf35fffd1989
diff --git a/sdk/src/ui2/core/events.ts b/sdk/src/ui2/core/events.ts
index ea7ad23a0..cf29e4971 100644
--- a/sdk/src/ui2/core/events.ts
+++ b/sdk/src/ui2/core/events.ts
@@ -1,13 +1,3 @@
-/**
- * @file events.ts
- * @brief UI event queue with bubbling, per-entity/global handlers, and
- * pending-event queue (drain).
- *
- * v4 redesign: entity subscription is owned by the plugin, which wires
- * `world.onDespawn(e => queue.removeAll(e))` to guarantee cleanup on
- * entity destruction — UIEventQueue itself has no World dependency.
- */
-
import type { Entity } from '../../types';
/**
diff --git a/sdk/src/ui2/core/image.ts b/sdk/src/ui2/core/image.ts
new file mode 100644
index 000000000..be31ecfd9
--- /dev/null
+++ b/sdk/src/ui2/core/image.ts
@@ -0,0 +1,7 @@
+export {
+ Image,
+ ImageType,
+ FillMethod,
+ FillOrigin,
+ type ImageData,
+} from '../../ui/Image';
diff --git a/sdk/src/ui2/core/text.ts b/sdk/src/ui2/core/text.ts
new file mode 100644
index 000000000..ba02f45b1
--- /dev/null
+++ b/sdk/src/ui2/core/text.ts
@@ -0,0 +1,7 @@
+export {
+ Text,
+ TextAlign,
+ TextVerticalAlign,
+ TextOverflow,
+ type TextData,
+} from '../../ui/text';
diff --git a/sdk/src/ui2/core/ui-mask.ts b/sdk/src/ui2/core/ui-mask.ts
new file mode 100644
index 000000000..a92b39631
--- /dev/null
+++ b/sdk/src/ui2/core/ui-mask.ts
@@ -0,0 +1,5 @@
+export {
+ UIMask,
+ MaskMode,
+ type UIMaskData,
+} from '../../ui/UIMask';
diff --git a/sdk/src/ui2/core/ui-rect.ts b/sdk/src/ui2/core/ui-rect.ts
new file mode 100644
index 000000000..52b744544
--- /dev/null
+++ b/sdk/src/ui2/core/ui-rect.ts
@@ -0,0 +1,4 @@
+export {
+ UIRect,
+ type UIRectData,
+} from '../../ui/UIRect';
diff --git a/sdk/src/ui2/core/ui-renderer.ts b/sdk/src/ui2/core/ui-renderer.ts
new file mode 100644
index 000000000..509857ea6
--- /dev/null
+++ b/sdk/src/ui2/core/ui-renderer.ts
@@ -0,0 +1,5 @@
+export {
+ UIRenderer,
+ UIVisualType,
+ type UIRendererData,
+} from '../../ui/UIRenderer';
diff --git a/sdk/src/ui2/index.ts b/sdk/src/ui2/index.ts
index b242c9335..77a8d561d 100644
--- a/sdk/src/ui2/index.ts
+++ b/sdk/src/ui2/index.ts
@@ -1,11 +1,4 @@
-/**
- * @file ui2/index.ts
- * @brief Barrel for the v4 UI framework (WIP).
- *
- * This folder holds the rewritten UI system (see docs/ui-redesign.md).
- * It lives alongside the legacy `src/ui/` until P7, at which point the
- * old folder is removed and this one is renamed back to `ui/`.
- */
+// Layer 0 — Infrastructure
export {
UIEventQueue,
@@ -20,3 +13,50 @@ export {
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';
diff --git a/sdk/src/ui2/layout/flex.ts b/sdk/src/ui2/layout/flex.ts
new file mode 100644
index 000000000..d9f9a3ba8
--- /dev/null
+++ b/sdk/src/ui2/layout/flex.ts
@@ -0,0 +1,15 @@
+export {
+ FlexContainer,
+ FlexDirection,
+ FlexWrap,
+ JustifyContent,
+ AlignItems,
+ AlignContent,
+ type FlexContainerData,
+} from '../../ui/FlexContainer';
+
+export {
+ FlexItem,
+ AlignSelf,
+ type FlexItemData,
+} from '../../ui/FlexItem';
diff --git a/sdk/src/ui2/layout/grid.ts b/sdk/src/ui2/layout/grid.ts
new file mode 100644
index 000000000..e94648231
--- /dev/null
+++ b/sdk/src/ui2/layout/grid.ts
@@ -0,0 +1,5 @@
+export {
+ GridLayout,
+ GridLayoutDirection,
+ type GridLayoutData,
+} from '../../ui/layouts/GridLayout';