lecodes-sdk 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/dist/editor.d.ts +12 -0
- package/dist/global.d.ts +4 -8
- package/dist/host.d.ts +2 -3
- package/dist/types/animate/tween/Animation.d.ts +0 -3
- package/dist/types/animate/tween/animateValue.d.ts +4 -2
- package/dist/types/animate/tween/easing.d.ts +8 -0
- package/dist/types/animate/tween/spec.d.ts +15 -7
- package/dist/types/audio/audio.d.ts +2 -1
- package/dist/types/canvas/Canvas.d.ts +40 -108
- package/dist/types/canvas/gen/cssColor.d.ts +17 -0
- package/dist/types/canvas/gen/recorder.d.ts +118 -0
- package/dist/types/canvas/gen/spec.d.ts +144 -0
- package/dist/types/core/color.d.ts +3 -1
- package/dist/types/core/pins.d.ts +18 -0
- package/dist/types/g2/Node2D.d.ts +5 -8
- package/dist/types/g2/Scene2D.d.ts +6 -2
- package/dist/types/gl/Foliage.d.ts +30 -7
- package/dist/types/gl/Light.d.ts +8 -0
- package/dist/types/gl/Lightmap.d.ts +13 -2
- package/dist/types/gl/Material.d.ts +17 -3
- package/dist/types/gl/Model.d.ts +6 -2
- package/dist/types/gl/Node.d.ts +3 -6
- package/dist/types/gl/Scene.d.ts +41 -13
- package/dist/types/gl/Texture.d.ts +1 -1
- package/dist/types/gl/animation/Locomotion.d.ts +8 -1
- package/dist/types/inject.d.ts +11 -11
- package/dist/types/inject.editor.d.ts +1 -0
- package/dist/types/net/core.d.ts +7 -0
- package/dist/types/plugin.d.ts +76 -0
- package/dist/types/plugins/gen/camera/sdk/camera.d.ts +24 -0
- package/dist/types/plugins/gen/camera/sdk/camera.gen.d.ts +25 -0
- package/dist/types/plugins/{geolocation.d.ts → gen/geolocation/sdk/geolocation.d.ts} +2 -20
- package/dist/types/plugins/gen/geolocation/sdk/geolocation.gen.d.ts +31 -0
- package/dist/types/plugins/{map.d.ts → gen/map/sdk/map.d.ts} +9 -50
- package/dist/types/plugins/gen/map/sdk/map.gen.d.ts +53 -0
- package/dist/types/plugins/gen/push/sdk/push.d.ts +23 -0
- package/dist/types/plugins/gen/push/sdk/push.gen.d.ts +35 -0
- package/dist/types/plugins/{qr.d.ts → gen/qr-scanner/sdk/qr-scanner.d.ts} +2 -3
- package/dist/types/plugins/gen/qr-scanner/sdk/qr-scanner.gen.d.ts +15 -0
- package/dist/types/runtime/app.d.ts +9 -2
- package/dist/types/runtime/fetch.d.ts +2 -0
- package/dist/types/runtime/input.d.ts +1 -1
- package/dist/types/runtime/media.d.ts +6 -10
- package/dist/types/runtime/misc.d.ts +4 -1
- package/dist/types/runtime/net.d.ts +3 -2
- package/dist/types/runtime/touch.d.ts +32 -0
- package/dist/types/scene/defineScene.d.ts +43 -2
- package/dist/types/scene/editor.d.ts +52 -0
- package/dist/types/scene/gizmos.d.ts +7 -4
- package/dist/types/ui/NativeView.d.ts +6 -4
- package/dist/types/ui/UI.d.ts +1 -1
- package/dist/types/ui/UIBottomSheet.d.ts +6 -12
- package/dist/types/ui/UIButton.d.ts +12 -14
- package/dist/types/ui/UIContainer.d.ts +0 -6
- package/dist/types/ui/UIImage.d.ts +1 -4
- package/dist/types/ui/UIInput.d.ts +8 -24
- package/dist/types/ui/UIModal.d.ts +0 -2
- package/dist/types/ui/UINode.d.ts +70 -56
- package/dist/types/ui/UIPager.d.ts +28 -27
- package/dist/types/ui/UIPopover.d.ts +0 -2
- package/dist/types/ui/UIScreen.d.ts +12 -17
- package/dist/types/ui/UIScrollable.d.ts +1 -4
- package/dist/types/ui/UIText.d.ts +0 -2
- package/dist/types/ui/UIVideo.d.ts +3 -5
- package/dist/types/ui/UIVirtualizedList.d.ts +14 -16
- package/dist/types/ui/UIWidget.d.ts +10 -9
- package/dist/types/ui/colorKeys.gen.d.ts +9 -0
- package/dist/types/ui/presentable.d.ts +46 -32
- package/dist/types/ui/router.d.ts +18 -7
- package/dist/types/ui/styleColor.d.ts +1 -0
- package/dist/types/ui/transitions.d.ts +18 -0
- package/dist/types/ui/tree.d.ts +75 -0
- package/dist/types/version.d.ts +10 -0
- package/dist/types.json +1 -1
- package/package.json +12 -3
- package/prompts/2d.md +2 -6
- package/prompts/3d.md +1 -5
- package/prompts/README.md +1 -1
- package/prompts/canvas.md +9 -8
- package/prompts/compose.ts +1 -1
- package/prompts/core.md +3 -3
- package/prompts/design.md +1 -1
- package/prompts/dist/2d-game.md +473 -239
- package/prompts/dist/3d-app.md +553 -205
- package/prompts/dist/ar-app.md +435 -202
- package/prompts/dist/design.md +113 -95
- package/prompts/dist/ui-app.md +386 -170
- package/prompts/ui-design.md +2 -3
- package/prompts/ui.md +45 -37
- package/src/animate/tween/Animation.ts +34 -150
- package/src/animate/tween/Timeline.ts +175 -175
- package/src/animate/tween/animateValue.ts +6 -3
- package/src/animate/tween/easing.ts +10 -3
- package/src/animate/tween/spec.ts +41 -15
- package/src/audio/Sound.ts +3 -3
- package/src/audio/audio.ts +2 -1
- package/src/bridges/2d.d.ts +317 -0
- package/src/bridges/app.d.ts +91 -0
- package/src/bridges/audio.d.ts +97 -0
- package/src/bridges/canvas.d.ts +79 -0
- package/src/bridges/device.d.ts +72 -0
- package/src/bridges/fetch.d.ts +80 -0
- package/src/bridges/files.d.ts +70 -0
- package/src/bridges/gl.d.ts +1133 -0
- package/src/bridges/input.d.ts +72 -0
- package/src/bridges/media.d.ts +55 -0
- package/src/bridges/nav.d.ts +71 -0
- package/src/bridges/net.d.ts +52 -0
- package/src/bridges/service.d.ts +52 -0
- package/src/bridges/socket.d.ts +31 -0
- package/src/bridges/storage.d.ts +33 -0
- package/src/bridges/tree.d.ts +301 -0
- package/src/bridges/types.d.ts +49 -0
- package/src/canvas/Canvas.ts +114 -159
- package/src/canvas/gen/cssColor.ts +224 -0
- package/src/canvas/gen/recorder.ts +212 -0
- package/src/canvas/gen/spec.ts +201 -0
- package/src/chisel.ts +193 -0
- package/src/compile/assetMacro.ts +1 -1
- package/src/compile/bundler.ts +11 -2
- package/src/compile/compileProject.ts +43 -4
- package/src/compile/fontMacro.ts +3 -4
- package/src/compile/header.ts +26 -5
- package/src/compile/index.ts +3 -1
- package/src/compile/liteMaterial.ts +1 -1
- package/src/compile/sceneEditor.ts +11 -26
- package/src/core/color.ts +73 -30
- package/src/core/pins.ts +51 -0
- package/src/core/signals.ts +8 -1
- package/src/g2/CharacterController2D.ts +3 -3
- package/src/g2/Node2D.ts +57 -39
- package/src/g2/Physics2D.ts +2 -2
- package/src/g2/Scene2D.ts +35 -23
- package/src/g2/Texture2D.ts +1 -1
- package/src/g2/loop.ts +4 -4
- package/src/gl/CameraPlace.ts +52 -52
- package/src/gl/Foliage.ts +72 -17
- package/src/gl/Geometry.ts +1 -2
- package/src/gl/Light.ts +10 -0
- package/src/gl/Lightmap.ts +45 -29
- package/src/gl/Material.ts +95 -51
- package/src/gl/Mesh.ts +120 -120
- package/src/gl/Model.ts +21 -16
- package/src/gl/Node.ts +91 -24
- package/src/gl/Particles.ts +1 -1
- package/src/gl/Scene.ts +100 -44
- package/src/gl/Texture.ts +8 -7
- package/src/gl/animation/AnimationClip.ts +1 -1
- package/src/gl/animation/DynamicBone.ts +482 -482
- package/src/gl/animation/Locomotion.ts +8 -3
- package/src/gl/nav/NavMesh.ts +3 -4
- package/src/gl/physics/Physics.ts +2 -2
- package/src/gl/physics/physicsEvents.ts +3 -3
- package/src/gl/scenarios.ts +291 -291
- package/src/gl/terrain/Terrain.ts +4 -5
- package/src/gl/touch.ts +14 -15
- package/src/host.d.ts +2 -3
- package/src/inject.editor.ts +7 -0
- package/src/inject.ts +13 -16
- package/src/net/core.ts +6 -5
- package/src/net/index.ts +1 -1
- package/src/net/replication.ts +1 -1
- package/src/plugin.ts +191 -0
- package/src/plugins/gen/camera/contract.d.ts +27 -0
- package/src/plugins/gen/camera/sdk/camera.gen.ts +46 -0
- package/src/plugins/gen/camera/sdk/camera.ts +57 -0
- package/src/plugins/gen/geolocation/contract.d.ts +50 -0
- package/src/plugins/gen/geolocation/sdk/geolocation.gen.ts +54 -0
- package/src/plugins/{geolocation.ts → gen/geolocation/sdk/geolocation.ts} +22 -43
- package/src/plugins/gen/map/contract.d.ts +144 -0
- package/src/plugins/gen/map/sdk/map.gen.ts +88 -0
- package/src/plugins/{map.ts → gen/map/sdk/map.ts} +68 -102
- package/src/plugins/gen/push/contract.d.ts +61 -0
- package/src/plugins/gen/push/sdk/push.gen.ts +60 -0
- package/src/plugins/gen/push/sdk/push.ts +105 -0
- package/src/plugins/gen/qr-scanner/contract.d.ts +16 -0
- package/src/plugins/gen/qr-scanner/sdk/qr-scanner.gen.ts +29 -0
- package/src/plugins/gen/qr-scanner/sdk/qr-scanner.ts +52 -0
- package/src/plugins/permission.ts +5 -4
- package/src/runtime/app.ts +20 -9
- package/src/runtime/appEvents.ts +5 -4
- package/src/runtime/channel.ts +18 -15
- package/src/runtime/clipboard.ts +4 -3
- package/src/runtime/datetime.ts +2 -1
- package/src/runtime/device.ts +17 -15
- package/src/runtime/fetch.ts +30 -20
- package/src/runtime/files.ts +16 -15
- package/src/runtime/input.ts +12 -10
- package/src/runtime/media.ts +50 -46
- package/src/runtime/misc.ts +7 -3
- package/src/runtime/net.ts +8 -7
- package/src/runtime/rpc.ts +1 -3
- package/src/runtime/service.ts +19 -14
- package/src/runtime/share.ts +4 -3
- package/src/runtime/storage.ts +6 -4
- package/src/runtime/touch.ts +32 -0
- package/src/scene/defineScene.ts +61 -365
- package/src/scene/editor.ts +408 -0
- package/src/scene/editorPlugins.ts +3 -3
- package/src/scene/gizmos.ts +15 -9
- package/src/server/db/marci/query.ts +1 -1
- package/src/server/host.ts +1 -1
- package/src/server/runtime.ts +1 -1
- package/src/ui/NativeView.ts +72 -25
- package/src/ui/UI.ts +3 -3
- package/src/ui/UIBottomSheet.ts +16 -17
- package/src/ui/UIButton.ts +54 -16
- package/src/ui/UIContainer.ts +0 -6
- package/src/ui/UIImage.ts +34 -30
- package/src/ui/UIInput.ts +29 -37
- package/src/ui/UIModal.ts +1 -3
- package/src/ui/UINode.ts +347 -297
- package/src/ui/UIPager.ts +93 -78
- package/src/ui/UIPopover.ts +0 -2
- package/src/ui/UIScreen.ts +41 -36
- package/src/ui/UIScrollable.ts +19 -13
- package/src/ui/UISpacer.ts +1 -1
- package/src/ui/UITabs.ts +8 -6
- package/src/ui/UIText.ts +7 -17
- package/src/ui/UIVideo.ts +30 -27
- package/src/ui/UIVirtualizedList.ts +58 -59
- package/src/ui/UIWidget.ts +38 -18
- package/src/ui/colorKeys.gen.ts +37 -0
- package/src/ui/fonts.ts +2 -2
- package/src/ui/presentable.ts +59 -42
- package/src/ui/router.ts +52 -35
- package/src/ui/styleColor.ts +56 -0
- package/src/ui/theme.ts +7 -6
- package/src/ui/transitions.ts +249 -0
- package/src/ui/tree.ts +346 -0
- package/src/version.ts +24 -0
- package/tests/helpers/engineWorld.ts +11 -0
- package/tests/helpers/fakeTree.ts +353 -0
- package/tests/helpers/hostStubs.ts +31 -0
- package/tests/helpers/index.ts +14 -0
- package/tests/helpers/memoryMarci.ts +124 -0
- package/tests/helpers/phases.ts +23 -0
- package/tests/helpers/preload.ts +18 -0
- package/tests/helpers/stubApp.ts +2 -0
- package/tests/helpers/stubDevice.ts +2 -0
- package/tests/helpers/stubFetch.ts +2 -0
- package/tests/helpers/stubInput.ts +2 -0
- package/dist/inject.js +0 -4629
- package/dist/types/core/registry.d.ts +0 -7
- package/dist/types/plugins/camera.d.ts +0 -25
- package/dist/types/plugins/push.d.ts +0 -46
- package/src/bridges.d.ts +0 -1769
- package/src/compile/__tests__/assetIconMacro.test.ts +0 -219
- package/src/compile/__tests__/assetMacro.test.ts +0 -100
- package/src/compile/__tests__/assetName.test.ts +0 -55
- package/src/compile/__tests__/compile.test.ts +0 -310
- package/src/compile/__tests__/detectEntry.test.ts +0 -151
- package/src/compile/__tests__/fontMacro.test.ts +0 -199
- package/src/compile/__tests__/serverSplit.test.ts +0 -27
- package/src/core/__tests__/stateMachine.test.ts +0 -132
- package/src/core/registry.ts +0 -23
- package/src/plugins/camera.ts +0 -81
- package/src/plugins/push.ts +0 -132
- package/src/plugins/qr.ts +0 -73
|
@@ -54,3 +54,35 @@ export declare class LongPressEvent<T = any> {
|
|
|
54
54
|
/** Capture subsequent moves/end for this pointer — drag the element after the hold. */
|
|
55
55
|
track(handler: TrackHandler): void;
|
|
56
56
|
}
|
|
57
|
+
/** What a hover `track()` takes: the cursor's moves inside the element (only delivered when
|
|
58
|
+
* `onMove` is present — otherwise the host never crosses into JS for them), `onEnd` when it
|
|
59
|
+
* leaves (with the last position), `onCancel` when the element went away underneath it. No
|
|
60
|
+
* `claim`: a hover competes with nothing. */
|
|
61
|
+
export interface HoverTrackHandler {
|
|
62
|
+
onMove?(pos: {
|
|
63
|
+
clientX: number;
|
|
64
|
+
clientY: number;
|
|
65
|
+
deltaX: number;
|
|
66
|
+
deltaY: number;
|
|
67
|
+
}): void;
|
|
68
|
+
onEnd?(pos: {
|
|
69
|
+
clientX: number;
|
|
70
|
+
clientY: number;
|
|
71
|
+
deltaX: number;
|
|
72
|
+
deltaY: number;
|
|
73
|
+
}): void;
|
|
74
|
+
onCancel?(): void;
|
|
75
|
+
}
|
|
76
|
+
/** Delivered to a `UIButton` `onMouseEnter` handler when a mouse cursor (no button) enters the
|
|
77
|
+
* button. There is no separate leave event: `ev.track({ onEnd })` follows this hover to its end,
|
|
78
|
+
* `onMove` follows the cursor inside — the visual state itself is the reserved `$hovered` class.
|
|
79
|
+
* Touch never produces one. */
|
|
80
|
+
export declare class MouseEnterEvent<T = any> {
|
|
81
|
+
readonly type = "mouseenter";
|
|
82
|
+
readonly clientX: number;
|
|
83
|
+
readonly clientY: number;
|
|
84
|
+
target: T;
|
|
85
|
+
constructor(clientX: number, clientY: number);
|
|
86
|
+
/** Follow this hover: moves inside the element, its end (the cursor left), its cancel. */
|
|
87
|
+
track(handler: HoverTrackHandler): void;
|
|
88
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type With } from "../core/Aspect";
|
|
2
1
|
import { use, ref, make, type AspectEntry, type MakeEntry as SharedMakeEntry } from "./grammar";
|
|
3
2
|
import type { Vec3Like } from "../math/vec";
|
|
4
3
|
import { Scene, type SceneOptions } from "../gl/Scene";
|
|
@@ -11,6 +10,7 @@ import { type TerrainLayer, type TerrainRegion, type TerrainOptions } from "../g
|
|
|
11
10
|
import { Light, type SunOptions } from "../gl/Light";
|
|
12
11
|
import { type MaterialDef } from "./material";
|
|
13
12
|
import type { CapsuleOptions, CylinderOptions, PlaneOptions, SphereOptions } from "../gl/Geometry";
|
|
13
|
+
import { GizmoBuffer } from "./gizmos";
|
|
14
14
|
export type MeshDef = {
|
|
15
15
|
kind: "box";
|
|
16
16
|
size?: Vec3Like | number;
|
|
@@ -152,7 +152,7 @@ export type SceneCameraDef = CameraProjectionDef & {
|
|
|
152
152
|
/** Point the camera looks at. */
|
|
153
153
|
target?: Vec3Like;
|
|
154
154
|
};
|
|
155
|
-
/** `env.lightmap` — the level's baked lighting (
|
|
155
|
+
/** `env.lightmap` — the level's baked lighting (engines/bake): the files `lecodes lightmap bake`
|
|
156
156
|
* writes. Absent = real-time only. */
|
|
157
157
|
export type SceneLightmapDef = {
|
|
158
158
|
/** `asset('./assets/lightmap/level.bake')` */
|
|
@@ -274,6 +274,8 @@ export type ModelPartRow = {
|
|
|
274
274
|
* not parts, skipped. Filtering BEFORE segment math keeps `name[i]` indices stable no matter
|
|
275
275
|
* what defs are parented in. */
|
|
276
276
|
export declare const modelPartRows: (root: Node) => ModelPartRow[];
|
|
277
|
+
/** Where a def node attaches: its `mount` part when it resolves, else the parent itself. */
|
|
278
|
+
export declare const attachHost: (parent: Node, def: SceneNodeDef, path: string) => Node;
|
|
277
279
|
/** The static verdict for one node def (the editor's "Baked lighting" switch shows the same rule).
|
|
278
280
|
* Children of a mover are movers too — buildNodes carries that down, this is the node's own verdict. */
|
|
279
281
|
export declare const isLightmapStatic: (def: SceneNodeDef) => boolean;
|
|
@@ -283,6 +285,45 @@ export declare const applyEditorPose: (node: Node, pose: {
|
|
|
283
285
|
clip?: string;
|
|
284
286
|
time?: number;
|
|
285
287
|
} | undefined) => void;
|
|
288
|
+
/** Edit mode: otherwise-invisible nodes (empties, `camera:` nodes) get an ANCHORED gizmo marker —
|
|
289
|
+
* an axis cross / a frustum in the node's local frame (scene/gizmos.ts) — so they show and pick
|
|
290
|
+
* in the viewport. Never scene content: nothing renders in Filament, nothing outlines, and the
|
|
291
|
+
* engine follows the node live, so the buffer is filled once and lives on the node
|
|
292
|
+
* (`_editorMarker`) — `sceneEditor.gizmos()` reads it off the handle's own def nodes, so a removed
|
|
293
|
+
* node's marker goes with its record and prefab / instance internals (not selectable) draw none. */
|
|
294
|
+
export declare const addEditorMarker: (node: Node, def: SceneNodeDef) => void;
|
|
295
|
+
/** fov / near / far from a camera block onto the live camera. The build path leaves an empty block
|
|
296
|
+
* alone (a host may run with its own configured fov); `reset` — the editor's live patch — fills
|
|
297
|
+
* omitted keys with the defaults instead, so clearing a field in the inspector takes effect. */
|
|
298
|
+
export declare const applyCameraProjection: (scene: Scene, def: CameraProjectionDef, reset?: boolean) => void;
|
|
299
|
+
export declare const foreignRuns: Map<Node, EditorRun[]>;
|
|
300
|
+
/** One live editor-run aspect instance (edit mode only). */
|
|
301
|
+
export type EditorRun = {
|
|
302
|
+
/** Absolute path of the host def node (re-keyed on rename/reparent). */
|
|
303
|
+
hostPath: string;
|
|
304
|
+
node: Node;
|
|
305
|
+
/** Index within the def's `aspects` array — the doc's aspect index addresses it. */
|
|
306
|
+
index: number;
|
|
307
|
+
inst: {
|
|
308
|
+
rebuild?(): void | Promise<void>;
|
|
309
|
+
};
|
|
310
|
+
/** Async rebuild() supersession counter (see safeRebuild). */
|
|
311
|
+
generation: number;
|
|
312
|
+
/** Mutable props snapshot — `sceneEditor.setProp` updates it and re-derives `deps`. Holds the
|
|
313
|
+
* DOC-LITERAL `$ref` strings (never resolved paths): the inspector's doc-sync compares these
|
|
314
|
+
* against the file's props, so rewriting them would re-fire on every render. */
|
|
315
|
+
props: Record<string, unknown>;
|
|
316
|
+
/** ABSOLUTE paths the ref() props resolved to — a change to any of them (or anything inside
|
|
317
|
+
* their subtrees) re-runs rebuild(). Re-derived after every structural change. */
|
|
318
|
+
deps: Set<string>;
|
|
319
|
+
/** Editor lines drawn by the last rebuild() (`Gizmos.*` calls — see scene/gizmos.ts). */
|
|
320
|
+
gizmos: GizmoBuffer;
|
|
321
|
+
};
|
|
322
|
+
/** Re-assign every ref-carrying prop from the CURRENT nodes map — a live patch replaces node
|
|
323
|
+
* instances, so a generator's resolved fields would otherwise point at destroyed nodes. */
|
|
324
|
+
export declare const assignRefProps: (run: EditorRun, nodes: Record<string, Node>) => void;
|
|
325
|
+
/** EditorRun.index for a node's make() run (aspect runs use their array index, always >= 0). */
|
|
326
|
+
export declare const MAKE_INDEX = -1;
|
|
286
327
|
export declare class SceneHandle<D extends SceneDef = SceneDef> {
|
|
287
328
|
readonly def: D;
|
|
288
329
|
private _loading?;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type AspectClassInfo } from "../core/fields";
|
|
2
|
+
import { InspectorUI, type InspectorEvent, type InspectorWidget } from "../core/InspectorUI";
|
|
3
|
+
import type { Material } from "../gl/Material";
|
|
4
|
+
import type { Node } from "../gl/Node";
|
|
5
|
+
import { type ModelPartRow, type SceneHandle, type SceneNodeDef } from "./defineScene";
|
|
6
|
+
import { GizmoBuffer, type GizmoBatch } from "./gizmos";
|
|
7
|
+
type Handle = SceneHandle<any>;
|
|
8
|
+
export declare const sceneEditor: {
|
|
9
|
+
patchNode: (handle: Handle, path: string, def: SceneNodeDef | null) => Promise<Node | null>;
|
|
10
|
+
renameNode: (handle: Handle, path: string, newName: string) => string | null;
|
|
11
|
+
reparentNode: (handle: Handle, path: string, newParentPath: string | null) => string | null;
|
|
12
|
+
nodeChanged: (handle: Handle, path: string) => void;
|
|
13
|
+
modelParts: (handle: Handle, path: string) => Promise<ModelPartRow[]>;
|
|
14
|
+
describeAspects: (handle: Handle) => AspectClassInfo[];
|
|
15
|
+
setProp: (handle: Handle, hostPath: string, index: number, key: string, value: unknown) => boolean;
|
|
16
|
+
setMakeArg: (handle: Handle, hostPath: string, key: string, value: unknown) => boolean;
|
|
17
|
+
gizmos: (handle: Handle) => {
|
|
18
|
+
version: number;
|
|
19
|
+
batches: GizmoBatch[];
|
|
20
|
+
};
|
|
21
|
+
inspectorRender: (handle: Handle, hostPath: string, index: number, props: Record<string, unknown>, event?: InspectorEvent) => InspectorWidget[] | null;
|
|
22
|
+
/** The preview pose of a model node (`editor: { clip, time }`) — idempotent; no clip = the rest pose. */
|
|
23
|
+
applyPose: (node: Node, pose: {
|
|
24
|
+
clip?: string;
|
|
25
|
+
time?: number;
|
|
26
|
+
} | undefined) => void;
|
|
27
|
+
isLocked: (node: Node) => boolean;
|
|
28
|
+
setLocked: (node: Node, locked: boolean) => void;
|
|
29
|
+
/** Assign a material def to one slot of a node (a material asset handle, an inline def, a shader). */
|
|
30
|
+
assignMaterial: (node: Node, slot: number, def: import("./material").MaterialDef) => Promise<Material>;
|
|
31
|
+
/** One parameter into a live material: a value, or a texture URL that loads in. */
|
|
32
|
+
setMaterialParam: (material: Material, name: string, value: import("./material").MaterialParamValue | null) => Promise<void>;
|
|
33
|
+
isBuiltinMaterial: (material: Material) => boolean;
|
|
34
|
+
forgetMaterial: (node: Node, slot: number) => void;
|
|
35
|
+
GizmoBuffer: typeof GizmoBuffer;
|
|
36
|
+
withGizmoScope: <T>(buffer: GizmoBuffer, fn: () => T) => T;
|
|
37
|
+
runCard: (ui: InspectorUI, render: (ui: InspectorUI) => void, event?: InspectorEvent) => InspectorWidget[];
|
|
38
|
+
/** The registry `registerEditorWindow` / `registerEditorTool` fill (`*.editor.ts` files). */
|
|
39
|
+
plugins: {
|
|
40
|
+
windows: {
|
|
41
|
+
title: string;
|
|
42
|
+
render: import("./editorPlugins").EditorWindowFn;
|
|
43
|
+
}[];
|
|
44
|
+
tools: {
|
|
45
|
+
name: string;
|
|
46
|
+
hooks: import("./editorPlugins").EditorToolHooks;
|
|
47
|
+
}[];
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
/** The contract of an editor's in-world half with the SDK — the type of the `__sceneEditor` global. */
|
|
51
|
+
export type SceneEditorApi = typeof sceneEditor;
|
|
52
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ColorInput } from "../core/color";
|
|
1
2
|
import { type Mat4Like } from "../math/mat4";
|
|
2
3
|
import type { Vec3Like } from "../math/vec";
|
|
3
4
|
/** The anchor of a gizmo call: any object with an engine entity id (a `Node`). */
|
|
@@ -5,8 +6,9 @@ export type GizmoAnchor = {
|
|
|
5
6
|
readonly id: number;
|
|
6
7
|
};
|
|
7
8
|
export type GizmoStyle = {
|
|
8
|
-
/**
|
|
9
|
-
|
|
9
|
+
/** Any color (a CSS color string, `0xRRGGBB`, `[r, g, b(, a)]`; its alpha multiplies `alpha`);
|
|
10
|
+
* default a neutral light gray. */
|
|
11
|
+
color?: ColorInput;
|
|
10
12
|
/** 0..1, default 1. */
|
|
11
13
|
alpha?: number;
|
|
12
14
|
/** Anchor: points are in this node's LOCAL frame (scale ignored); the lines follow the node
|
|
@@ -14,8 +16,9 @@ export type GizmoStyle = {
|
|
|
14
16
|
* selected. Omit for world-space lines (not pickable). */
|
|
15
17
|
node?: GizmoAnchor | null;
|
|
16
18
|
};
|
|
17
|
-
/** One color batch of LINES (flat `[x,y,z, x,y,z]` per segment) — what a host hands the engine
|
|
18
|
-
* With `entityId` the segments are in that
|
|
19
|
+
/** One color batch of LINES (flat `[x,y,z, x,y,z]` per segment) — what a host hands the engine
|
|
20
|
+
* (`color` a CSS color string, '#rrggbbaa' from here). With `entityId` the segments are in that
|
|
21
|
+
* entity's local frame (see GizmoStyle.node). */
|
|
19
22
|
export type GizmoBatch = {
|
|
20
23
|
color: string;
|
|
21
24
|
alpha: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PresentOptions } from "./presentable";
|
|
1
|
+
import { type DismissOptions, type PresentOptions } from "./presentable";
|
|
2
2
|
import { type BaseStyle, type DrawableStyle, type ElementStyle, type UIElementBase } from "./UINode";
|
|
3
3
|
export type UINativeViewStyle = ElementStyle & DrawableStyle;
|
|
4
4
|
/** An instance of a host-registered platform view (map, QR scanner, camera preview, …) —
|
|
@@ -13,15 +13,15 @@ export interface NativeView extends UIElementBase<UINativeViewStyle, DrawableSty
|
|
|
13
13
|
/** Show fullscreen as the current destination (see Presentable). */
|
|
14
14
|
open(options?: PresentOptions): void;
|
|
15
15
|
/** Dismiss if this is the visible destination. */
|
|
16
|
-
close(): void;
|
|
16
|
+
close(options?: DismissOptions): void;
|
|
17
17
|
/** Became the visible destination. */
|
|
18
18
|
onOpen(callback: () => void): this;
|
|
19
19
|
/** Stopped being the visible destination. */
|
|
20
20
|
onClose(callback: () => void): this;
|
|
21
21
|
/** Hardware/system back while current. */
|
|
22
|
-
|
|
22
|
+
onBack(callback: () => void): this;
|
|
23
23
|
/** Invoke a method on the native view (`map.call("setCenter", [lng, lat])`). Args and the
|
|
24
|
-
* result are
|
|
24
|
+
* result are plain data (and Uint8Array). Rejects if the host has no such view/method. */
|
|
25
25
|
call(method: string, ...args: any[]): Promise<any>;
|
|
26
26
|
/** Subscribe to an event the native view emits (`map.on("markerTap", cb)`). */
|
|
27
27
|
on(event: string, callback: (data?: any) => void): this;
|
|
@@ -35,4 +35,6 @@ export declare const NativeView: {
|
|
|
35
35
|
(name: string, params?: object): NativeView;
|
|
36
36
|
/** Whether this host registered a `registerView` factory under `name`. */
|
|
37
37
|
isSupported(name: string): boolean;
|
|
38
|
+
/** The contract version of the host's view `name`: 0 when it has none, 1 for one written by hand. */
|
|
39
|
+
version(name: string): number;
|
|
38
40
|
};
|
package/dist/types/ui/UI.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export { UIVirtualizedList } from './UIVirtualizedList';
|
|
|
18
18
|
export { Router } from './router';
|
|
19
19
|
export { NativeView, type UINativeViewStyle } from './NativeView';
|
|
20
20
|
export { Presentable } from './presentable';
|
|
21
|
-
export type { PresentOptions, Transition, TransitionName,
|
|
21
|
+
export type { DismissOptions, PresentOptions, Transition, TransitionName, TransitionPose, TransitionSpec } from './presentable';
|
|
22
22
|
export { __uiMap } from './UINode';
|
|
23
23
|
export { __UIColumn, __UIRow, __UIBox } from './UIContainer';
|
|
24
24
|
export { __UIButton } from './UIButton';
|
|
@@ -14,11 +14,11 @@ export type UIBottomSheetStyle = UIModalStyle;
|
|
|
14
14
|
* modal machinery.
|
|
15
15
|
*
|
|
16
16
|
* ```ts
|
|
17
|
-
* const actions = UIBottomSheet({ bgColor: "#1c1c1e", borderRadius: 16 }
|
|
17
|
+
* const actions = UIBottomSheet(rows).style({ bgColor: "#1c1c1e", borderRadius: 16 }) // content-sized
|
|
18
18
|
*
|
|
19
|
-
* const mapSheet = UIBottomSheet({ bgColor: "#1c1c1e", borderRadius: 16 }
|
|
19
|
+
* const mapSheet = UIBottomSheet(results).style({ bgColor: "#1c1c1e", borderRadius: 16 })
|
|
20
20
|
* .detents([0.3, 0.6, 1])
|
|
21
|
-
* .
|
|
21
|
+
* .onDetent(i => map.setPadding(...))
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
24
|
export interface UIBottomSheet extends UIWidget {
|
|
@@ -26,12 +26,12 @@ export interface UIBottomSheet extends UIWidget {
|
|
|
26
26
|
* the last (highest) detent; set this before `show()`. Without a `detents()` call the sheet
|
|
27
27
|
* is CONTENT-SIZED instead — one position, as tall as its children (up to the screen). */
|
|
28
28
|
detents(list: number[]): this;
|
|
29
|
-
/** Snap to a detent (animated). Clamped to the detents range; fires `
|
|
29
|
+
/** Snap to a detent (animated). Clamped to the detents range; fires `onDetent`. */
|
|
30
30
|
setDetent(index: number): void;
|
|
31
31
|
/** Current detent index. */
|
|
32
32
|
readonly detent: number;
|
|
33
33
|
/** Fires on every settle: a finger snap on native hosts, or a `setDetent()` call. */
|
|
34
|
-
|
|
34
|
+
onDetent(callback: (index: number) => void): this;
|
|
35
35
|
/** Mount and slide in to the current detent. No-op while already open. */
|
|
36
36
|
show(): void;
|
|
37
37
|
/** Slide out, fade the scrim, then unmount. No-op while closed. */
|
|
@@ -49,16 +49,12 @@ export interface UIBottomSheet extends UIWidget {
|
|
|
49
49
|
export declare class BottomSheetElement extends ModalElement {
|
|
50
50
|
_detents: number[];
|
|
51
51
|
_detent: number;
|
|
52
|
-
/** Host-facing (the `sl`/`otl` contract): hosts read `dtl` at mount and call it with the
|
|
53
|
-
* settled detent index for GESTURE settles only — programmatic `setDetent` fires JS-side.
|
|
54
|
-
* `-1` = dragged below the lowest detent while dismissible. */
|
|
55
|
-
readonly dtl: any[];
|
|
56
52
|
readonly _detentListeners: ((index: number) => void)[];
|
|
57
53
|
constructor(style: UIBottomSheetStyle, children: UINodeChild[] | ChildrenFn);
|
|
58
54
|
detents(list: number[]): this;
|
|
59
55
|
get detent(): number;
|
|
60
56
|
setDetent(index: number): void;
|
|
61
|
-
|
|
57
|
+
onDetent(callback: (index: number) => void): this;
|
|
62
58
|
show(): void;
|
|
63
59
|
hide(): void;
|
|
64
60
|
dismissible(enabled: boolean): this;
|
|
@@ -67,5 +63,3 @@ export declare class BottomSheetElement extends ModalElement {
|
|
|
67
63
|
* `.detents([...])` for snap positions. Same argument forms as `UIColumn`. */
|
|
68
64
|
export declare function UIBottomSheet(...children: UIChildArg[]): UIBottomSheet;
|
|
69
65
|
export declare function UIBottomSheet(children: UINodeChild[] | ChildrenFn): UIBottomSheet;
|
|
70
|
-
/** @deprecated Style as the first argument is legacy — use chained `.style({...})`. */
|
|
71
|
-
export declare function UIBottomSheet(style: UIBottomSheetStyle, children?: UINodeChild[] | ChildrenFn): UIBottomSheet;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import type { ClickEvent as ClickEventType, TouchStartEvent as TouchStartEventType, LongPressEvent as LongPressEventType } from "../runtime/touch";
|
|
2
|
-
import { type ElementStyle, type ContainerStyle, type DrawableStyle, type UIChildArg, type UIContainerBase, type UINodeChild, type ChildrenFn, type BaseStyle, type Color
|
|
1
|
+
import type { ClickEvent as ClickEventType, TouchStartEvent as TouchStartEventType, LongPressEvent as LongPressEventType, MouseEnterEvent as MouseEnterEventType } from "../runtime/touch";
|
|
2
|
+
import { type ElementStyle, type ContainerStyle, type DrawableStyle, type UIChildArg, type UIContainerBase, type UINodeChild, type ChildrenFn, type BaseStyle, type Color } from "./UINode";
|
|
3
3
|
export type UIButtonStyle = ElementStyle & DrawableStyle & ContainerStyle & {
|
|
4
4
|
rippleColor?: Color | "default";
|
|
5
5
|
};
|
|
6
|
-
/** A tappable container — row + centered children by default. Press feedback via the `
|
|
7
|
-
*
|
|
8
|
-
export interface UIButton extends UIContainerBase<UIButtonStyle & {
|
|
9
|
-
onPressed?: UIButtonStyle & {
|
|
10
|
-
duration?: number;
|
|
11
|
-
delay?: number;
|
|
12
|
-
easing?: LayerEasing;
|
|
13
|
-
};
|
|
14
|
-
}, DrawableStyle & BaseStyle> {
|
|
6
|
+
/** A tappable container — row + centered children by default. Press feedback via the `$pressed`
|
|
7
|
+
* class block or `rippleColor`. */
|
|
8
|
+
export interface UIButton extends UIContainerBase<UIButtonStyle, DrawableStyle & BaseStyle> {
|
|
15
9
|
readonly type: "button";
|
|
16
10
|
/** Fired on a completed tap/click. */
|
|
17
11
|
onClick(callback: (ev: ClickEventType<UIButton>) => void): this;
|
|
@@ -21,12 +15,16 @@ export interface UIButton extends UIContainerBase<UIButtonStyle & {
|
|
|
21
15
|
* `ev.track(...)` the rest of the gesture (like `onTouchStart`), so a hold can flow straight into
|
|
22
16
|
* dragging the element. A handled long-press suppresses the click that would follow the release. */
|
|
23
17
|
onLongPress(callback: (ev: LongPressEventType<UIButton>) => void): this;
|
|
18
|
+
/** Fired when a mouse cursor (no button) enters the button — desktop / web; touch never fires it.
|
|
19
|
+
* There is no leave event: `ev.track({ onMove, onEnd, onCancel })` follows the hover to its
|
|
20
|
+
* end. The visual state is the reserved `$hovered` class (cascades like `$pressed`). */
|
|
21
|
+
onMouseEnter(callback: (ev: MouseEnterEventType<UIButton>) => void): this;
|
|
24
22
|
/** Is a finger currently down on the button? */
|
|
25
|
-
isPressed
|
|
23
|
+
readonly isPressed: boolean;
|
|
24
|
+
/** Is a mouse cursor currently over the button (the topmost interactive node under it)? */
|
|
25
|
+
readonly isHovered: boolean;
|
|
26
26
|
}
|
|
27
27
|
/** Create a button (row + centered by default — the icon+label shape). Same argument forms as
|
|
28
28
|
* `UIColumn`; attach behavior with `.onClick(...)`. */
|
|
29
29
|
export declare function UIButton(...children: UIChildArg[]): UIButton;
|
|
30
30
|
export declare function UIButton(children: UINodeChild[] | ChildrenFn): UIButton;
|
|
31
|
-
/** @deprecated Style as the first argument is legacy — use chained `.style({...})`. */
|
|
32
|
-
export declare function UIButton(style: UIButtonStyle, children?: UINodeChild[] | ChildrenFn): UIButton;
|
|
@@ -10,8 +10,6 @@ export declare const __UIBox: (children: UINodeChild[] | ChildrenFn) => UIBox;
|
|
|
10
10
|
* entries are skipped; a lone function makes the children reactive. */
|
|
11
11
|
export declare function UIColumn(...children: UIChildArg[]): UIColumn;
|
|
12
12
|
export declare function UIColumn(children: UINodeChild[] | ChildrenFn): UIColumn;
|
|
13
|
-
/** @deprecated Style as the first argument is legacy — use chained `.style({...})`. */
|
|
14
|
-
export declare function UIColumn(style: UIContainerStyle, children?: UINodeChild[] | ChildrenFn): UIColumn;
|
|
15
13
|
/** A horizontal flex container — children flow left to right. */
|
|
16
14
|
export interface UIRow extends UIContainerBase<UIContainerStyle> {
|
|
17
15
|
readonly type: "row";
|
|
@@ -19,8 +17,6 @@ export interface UIRow extends UIContainerBase<UIContainerStyle> {
|
|
|
19
17
|
/** Create a horizontal flex container (same argument forms as `UIColumn`). */
|
|
20
18
|
export declare function UIRow(...children: UIChildArg[]): UIRow;
|
|
21
19
|
export declare function UIRow(children: UINodeChild[] | ChildrenFn): UIRow;
|
|
22
|
-
/** @deprecated Style as the first argument is legacy — use chained `.style({...})`. */
|
|
23
|
-
export declare function UIRow(style: UIContainerStyle, children?: UINodeChild[] | ChildrenFn): UIRow;
|
|
24
20
|
/** A centering container — `justifyContent`/`alignItems` default to center. */
|
|
25
21
|
export interface UIBox extends UIContainerBase<UIContainerStyle> {
|
|
26
22
|
readonly type: "box";
|
|
@@ -29,5 +25,3 @@ export interface UIBox extends UIContainerBase<UIContainerStyle> {
|
|
|
29
25
|
* avatars, empty states). Same argument forms as `UIColumn`. */
|
|
30
26
|
export declare function UIBox(...children: UIChildArg[]): UIBox;
|
|
31
27
|
export declare function UIBox(children: UINodeChild[] | ChildrenFn): UIBox;
|
|
32
|
-
/** @deprecated Style as the first argument is legacy — use chained `.style({...})`. */
|
|
33
|
-
export declare function UIBox(style: UIContainerStyle, children?: UINodeChild[] | ChildrenFn): UIBox;
|
|
@@ -9,8 +9,7 @@ export type UIImageStyle = ElementStyle & {
|
|
|
9
9
|
objectFit?: "cover" | "contain" | "fill";
|
|
10
10
|
tintColor?: Color;
|
|
11
11
|
};
|
|
12
|
-
/** A baked Canvas surface as an image source. The UI backend resolves it to a UI texture
|
|
13
|
-
* docs/canvas-contract.md ("Pending"). */
|
|
12
|
+
/** A baked Canvas surface as an image source. The UI backend resolves it to a UI texture. */
|
|
14
13
|
export type CanvasImageSource = {
|
|
15
14
|
canvasSurface: number;
|
|
16
15
|
};
|
|
@@ -41,5 +40,3 @@ export interface UIImage extends UIElementBase<UIImageStyle> {
|
|
|
41
40
|
}
|
|
42
41
|
/** Create an image element from a source (see {@link ImageSource}). */
|
|
43
42
|
export declare function UIImage(src: ImageSource): UIImage;
|
|
44
|
-
/** @deprecated Style as the first argument is legacy — use chained `.style({...})`. */
|
|
45
|
-
export declare function UIImage(style: UIImageStyle, src: ImageSource): UIImage;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ElementStyle, type DrawableStyle, type TextStyle, type Color, type BaseStyle, type UIElementBase
|
|
1
|
+
import { type ElementStyle, type DrawableStyle, type TextStyle, type Color, type BaseStyle, type UIElementBase } from "./UINode";
|
|
2
2
|
type InputStyle = {
|
|
3
3
|
placeholder?: string;
|
|
4
4
|
placeholderColor?: Color;
|
|
@@ -47,20 +47,10 @@ type SubmitStyle = {
|
|
|
47
47
|
};
|
|
48
48
|
/** A single-line text input. Keyboard/picker kind via the `type` style, return-key behavior via
|
|
49
49
|
* `enterKey` + `onSubmit`; keyboard policy on `keyboardShrink`/`keyboardDismiss`. */
|
|
50
|
-
export interface UIInput extends UIElementBase<UIInputStyle & SubmitStyle & {
|
|
51
|
-
onFocused?: UIInputStyle & {
|
|
52
|
-
duration?: number;
|
|
53
|
-
delay?: number;
|
|
54
|
-
easing?: LayerEasing;
|
|
55
|
-
};
|
|
56
|
-
}, DrawableStyle & BaseStyle> {
|
|
50
|
+
export interface UIInput extends UIElementBase<UIInputStyle & SubmitStyle, DrawableStyle & BaseStyle> {
|
|
57
51
|
readonly type: "input";
|
|
58
|
-
/**
|
|
59
|
-
*
|
|
60
|
-
* (settings, edit-profile); the value is stashed on the node and applied when the host builds
|
|
61
|
-
* it. Reads return the live text while the screen is open, and the last value you set while it
|
|
62
|
-
* isn't. The user's typing is not preserved across close/open (use `keepAlive()` for that).
|
|
63
|
-
*/
|
|
52
|
+
/** The field's text. Writable at any time; reads return the live text (the host owns the field
|
|
53
|
+
* while the user types — IME composition, paste, the maxLength clamp, date/time canonicalization). */
|
|
64
54
|
value: string;
|
|
65
55
|
/** The text changed — fires on every user edit. */
|
|
66
56
|
onChange(callback: (value: string) => void): UIInput;
|
|
@@ -70,21 +60,15 @@ export interface UIInput extends UIElementBase<UIInputStyle & SubmitStyle & {
|
|
|
70
60
|
onBlur(callback: () => void): UIInput;
|
|
71
61
|
/** The keyboard's return key was pressed. `value` is the current text. See `enterKey`. */
|
|
72
62
|
onSubmit(callback: (value: string) => void): UIInput;
|
|
73
|
-
/** Focus the input (opens the keyboard).
|
|
63
|
+
/** Focus the input (opens the keyboard). */
|
|
74
64
|
focus(): void;
|
|
75
65
|
/** Release focus (dismisses the keyboard when this input held it). */
|
|
76
66
|
blur(): void;
|
|
77
67
|
}
|
|
78
68
|
/** A multi-line text field — see the {@link UITextArea} factory for the auto-grow contract. */
|
|
79
|
-
export interface UITextArea extends UIElementBase<UIInputStyle & {
|
|
80
|
-
onFocused?: UIInputStyle & {
|
|
81
|
-
duration?: number;
|
|
82
|
-
delay?: number;
|
|
83
|
-
easing?: LayerEasing;
|
|
84
|
-
};
|
|
85
|
-
}, DrawableStyle & BaseStyle> {
|
|
69
|
+
export interface UITextArea extends UIElementBase<UIInputStyle, DrawableStyle & BaseStyle> {
|
|
86
70
|
readonly type: "textarea";
|
|
87
|
-
/** The field's text — same contract as {@link UIInput.value}
|
|
71
|
+
/** The field's text — same contract as {@link UIInput.value}. */
|
|
88
72
|
value: string;
|
|
89
73
|
/** The text changed — fires on every user edit. */
|
|
90
74
|
onChange(callback: (value: string) => void): UITextArea;
|
|
@@ -92,7 +76,7 @@ export interface UITextArea extends UIElementBase<UIInputStyle & {
|
|
|
92
76
|
onFocus(callback: () => void): UITextArea;
|
|
93
77
|
/** Lost focus. */
|
|
94
78
|
onBlur(callback: () => void): UITextArea;
|
|
95
|
-
/** Focus the text area (opens the keyboard).
|
|
79
|
+
/** Focus the text area (opens the keyboard). */
|
|
96
80
|
focus(): void;
|
|
97
81
|
/** Release focus (dismisses the keyboard when this text area held it). */
|
|
98
82
|
blur(): void;
|
|
@@ -66,5 +66,3 @@ export declare class ModalElement extends WidgetElement {
|
|
|
66
66
|
* `show()`/`hide()`. Same argument forms as `UIColumn`. */
|
|
67
67
|
export declare function UIModal(...children: UIChildArg[]): UIModal;
|
|
68
68
|
export declare function UIModal(children: UINodeChild[] | ChildrenFn): UIModal;
|
|
69
|
-
/** @deprecated Style as the first argument is legacy — use chained `.style({...})`. */
|
|
70
|
-
export declare function UIModal(style: UIModalStyle, children?: UINodeChild[] | ChildrenFn): UIModal;
|