lecodes-sdk 0.19.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 +114 -0
- package/dist/global.d.ts +503 -0
- package/dist/host.d.ts +61 -0
- package/dist/inject.js +4730 -0
- package/dist/types/animate/animate.d.ts +20 -0
- package/dist/types/animate/bezier.d.ts +2 -0
- package/dist/types/animate/easings.d.ts +21 -0
- package/dist/types/canvas/Canvas.d.ts +168 -0
- package/dist/types/core/Aspect.d.ts +171 -0
- package/dist/types/core/InspectorUI.d.ts +88 -0
- package/dist/types/core/StateMachine.d.ts +81 -0
- package/dist/types/core/color.d.ts +13 -0
- package/dist/types/core/compWrite.d.ts +11 -0
- package/dist/types/core/events.d.ts +11 -0
- package/dist/types/core/fields.d.ts +58 -0
- package/dist/types/core/registry.d.ts +7 -0
- package/dist/types/core/signals.d.ts +29 -0
- package/dist/types/core/time.d.ts +31 -0
- package/dist/types/g2/Camera2D.d.ts +19 -0
- package/dist/types/g2/CharacterController2D.d.ts +134 -0
- package/dist/types/g2/Node2D.d.ts +91 -0
- package/dist/types/g2/OneWay2D.d.ts +24 -0
- package/dist/types/g2/Physics2D.d.ts +147 -0
- package/dist/types/g2/Scene2D.d.ts +72 -0
- package/dist/types/g2/Shape2D.d.ts +58 -0
- package/dist/types/g2/Sprite.d.ts +51 -0
- package/dist/types/g2/SpriteAnimation.d.ts +50 -0
- package/dist/types/g2/SpriteSheet.d.ts +69 -0
- package/dist/types/g2/Texture2D.d.ts +16 -0
- package/dist/types/g2/Tilemap.d.ts +20 -0
- package/dist/types/g2/Tileset.d.ts +32 -0
- package/dist/types/g2/Trigger2D.d.ts +20 -0
- package/dist/types/g2/autotile.d.ts +133 -0
- package/dist/types/g2/cells.d.ts +14 -0
- package/dist/types/g2/defineScene2d.d.ts +141 -0
- package/dist/types/g2/groups2d.d.ts +16 -0
- package/dist/types/g2/loop.d.ts +4 -0
- package/dist/types/g2/scenarios2d.d.ts +30 -0
- package/dist/types/g2/touch.d.ts +2 -0
- package/dist/types/gl/Camera.d.ts +79 -0
- package/dist/types/gl/CameraPlace.d.ts +26 -0
- package/dist/types/gl/CharacterController.d.ts +98 -0
- package/dist/types/gl/Gearbox.d.ts +86 -0
- package/dist/types/gl/Geometry.d.ts +39 -0
- package/dist/types/gl/IK.d.ts +53 -0
- package/dist/types/gl/InstancedMesh.d.ts +46 -0
- package/dist/types/gl/Light.d.ts +73 -0
- package/dist/types/gl/Lightmap.d.ts +85 -0
- package/dist/types/gl/Locomotion.d.ts +279 -0
- package/dist/types/gl/Material.d.ts +100 -0
- package/dist/types/gl/Mesh.d.ts +33 -0
- package/dist/types/gl/Model.d.ts +53 -0
- package/dist/types/gl/NavAgent.d.ts +99 -0
- package/dist/types/gl/NavMesh.d.ts +169 -0
- package/dist/types/gl/Node.d.ts +99 -0
- package/dist/types/gl/Noise.d.ts +20 -0
- package/dist/types/gl/Particles.d.ts +277 -0
- package/dist/types/gl/Physics.d.ts +91 -0
- package/dist/types/gl/Plane.d.ts +19 -0
- package/dist/types/gl/Ragdoll.d.ts +86 -0
- package/dist/types/gl/Ray.d.ts +8 -0
- package/dist/types/gl/Scene.d.ts +221 -0
- package/dist/types/gl/Shape.d.ts +122 -0
- package/dist/types/gl/Terrain.d.ts +280 -0
- package/dist/types/gl/Texture.d.ts +27 -0
- package/dist/types/gl/Trigger.d.ts +10 -0
- package/dist/types/gl/Vehicle.d.ts +191 -0
- package/dist/types/gl/Wheel.d.ts +95 -0
- package/dist/types/gl/animation/AnimationClip.d.ts +60 -0
- package/dist/types/gl/animation/Animator.d.ts +219 -0
- package/dist/types/gl/animation/Layer.d.ts +31 -0
- package/dist/types/gl/animation/Loop.d.ts +17 -0
- package/dist/types/gl/animation/Playback.d.ts +36 -0
- package/dist/types/gl/animation/core.d.ts +367 -0
- package/dist/types/gl/controls.d.ts +19 -0
- package/dist/types/gl/physicsEvents.d.ts +1 -0
- package/dist/types/gl/scenarios.d.ts +98 -0
- package/dist/types/gl/state.d.ts +5 -0
- package/dist/types/gl/terrainMesh.d.ts +46 -0
- package/dist/types/gl/touch.d.ts +2 -0
- package/dist/types/inject.d.ts +123 -0
- package/dist/types/math/Mathf.d.ts +39 -0
- package/dist/types/math/mat4.d.ts +66 -0
- package/dist/types/math/quat.d.ts +53 -0
- package/dist/types/math/vec.d.ts +129 -0
- package/dist/types/net/codec.d.ts +25 -0
- package/dist/types/net/core.d.ts +106 -0
- package/dist/types/net/index.d.ts +80 -0
- package/dist/types/net/replication.d.ts +101 -0
- package/dist/types/plugins/camera.d.ts +25 -0
- package/dist/types/plugins/geolocation.d.ts +39 -0
- package/dist/types/plugins/oauth.d.ts +25 -0
- package/dist/types/plugins/permission.d.ts +1 -0
- package/dist/types/plugins/push.d.ts +46 -0
- package/dist/types/plugins/qr.d.ts +21 -0
- package/dist/types/plugins/service.d.ts +33 -0
- package/dist/types/runtime/app.d.ts +67 -0
- package/dist/types/runtime/appEvents.d.ts +7 -0
- package/dist/types/runtime/channel.d.ts +1 -0
- package/dist/types/runtime/clipboard.d.ts +7 -0
- package/dist/types/runtime/datetime.d.ts +80 -0
- package/dist/types/runtime/device.d.ts +126 -0
- package/dist/types/runtime/fetch.d.ts +31 -0
- package/dist/types/runtime/files.d.ts +33 -0
- package/dist/types/runtime/input.d.ts +121 -0
- package/dist/types/runtime/media.d.ts +46 -0
- package/dist/types/runtime/misc.d.ts +11 -0
- package/dist/types/runtime/net.d.ts +15 -0
- package/dist/types/runtime/rpc.d.ts +44 -0
- package/dist/types/runtime/service.d.ts +1 -0
- package/dist/types/runtime/share.d.ts +2 -0
- package/dist/types/runtime/storage.d.ts +5 -0
- package/dist/types/runtime/touch.d.ts +56 -0
- package/dist/types/scene/defineScene.d.ts +296 -0
- package/dist/types/scene/editorPlugins.d.ts +82 -0
- package/dist/types/scene/gizmos.d.ts +56 -0
- package/dist/types/scene/grammar.d.ts +56 -0
- package/dist/types/scene/level.d.ts +98 -0
- package/dist/types/scene/material.d.ts +76 -0
- package/dist/types/server/auth/appConfig.d.ts +16 -0
- package/dist/types/server/auth/global.d.ts +56 -0
- package/dist/types/server/auth/models.d.ts +164 -0
- package/dist/types/server/auth/types.d.ts +56 -0
- package/dist/types/server/channel.d.ts +28 -0
- package/dist/types/server/context.d.ts +27 -0
- package/dist/types/server/db/defineDb.d.ts +36 -0
- package/dist/types/server/db/fields.d.ts +146 -0
- package/dist/types/server/db/index.d.ts +6 -0
- package/dist/types/server/db/marci/query.d.ts +326 -0
- package/dist/types/server/db/types.d.ts +163 -0
- package/dist/types/server/errors.d.ts +8 -0
- package/dist/types/server/inject.d.ts +5 -0
- package/dist/types/ui/NativeView.d.ts +38 -0
- package/dist/types/ui/UI.d.ts +27 -0
- package/dist/types/ui/UIBottomSheet.d.ts +71 -0
- package/dist/types/ui/UIButton.d.ts +30 -0
- package/dist/types/ui/UIContainer.d.ts +33 -0
- package/dist/types/ui/UIImage.d.ts +35 -0
- package/dist/types/ui/UIInput.d.ts +110 -0
- package/dist/types/ui/UIModal.d.ts +70 -0
- package/dist/types/ui/UINode.d.ts +363 -0
- package/dist/types/ui/UIPager.d.ts +123 -0
- package/dist/types/ui/UIPopover.d.ts +39 -0
- package/dist/types/ui/UIScreen.d.ts +57 -0
- package/dist/types/ui/UIScrollable.d.ts +40 -0
- package/dist/types/ui/UISpacer.d.ts +9 -0
- package/dist/types/ui/UITabs.d.ts +96 -0
- package/dist/types/ui/UIText.d.ts +19 -0
- package/dist/types/ui/UIVideo.d.ts +28 -0
- package/dist/types/ui/UIVirtualizedList.d.ts +97 -0
- package/dist/types/ui/UIWidget.d.ts +65 -0
- package/dist/types/ui/fonts.d.ts +9 -0
- package/dist/types/ui/presentable.d.ts +68 -0
- package/dist/types/ui/router.d.ts +40 -0
- package/dist/types/ui/theme.d.ts +26 -0
- package/dist/types.json +1 -0
- package/package.json +46 -0
- package/prompts/2d.md +395 -0
- package/prompts/3d-scene-files.md +113 -0
- package/prompts/3d-scene.md +119 -0
- package/prompts/3d.md +303 -0
- package/prompts/README.md +142 -0
- package/prompts/ar.md +109 -0
- package/prompts/canvas.md +27 -0
- package/prompts/compose.ts +46 -0
- package/prompts/concept.md +49 -0
- package/prompts/core-design.md +75 -0
- package/prompts/core.md +264 -0
- package/prompts/design.md +218 -0
- package/prompts/dist/2d-game.md +1530 -0
- package/prompts/dist/3d-app.md +1672 -0
- package/prompts/dist/ar-app.md +1548 -0
- package/prompts/dist/concept.md +49 -0
- package/prompts/dist/design.md +498 -0
- package/prompts/dist/ui-app.md +1134 -0
- package/prompts/index.md +37 -0
- package/prompts/intake-prompt.md +33 -0
- package/prompts/namer-prompt.md +12 -0
- package/prompts/router-prompt.md +50 -0
- package/prompts/select.ts +111 -0
- package/prompts/ui-design.md +203 -0
- package/prompts/ui.md +803 -0
- package/src/animate/animate.ts +238 -0
- package/src/animate/bezier.ts +138 -0
- package/src/animate/easings.ts +126 -0
- package/src/bridges.d.ts +1345 -0
- package/src/canvas/Canvas.ts +305 -0
- package/src/compile/__tests__/assetIconMacro.test.ts +219 -0
- package/src/compile/__tests__/assetMacro.test.ts +74 -0
- package/src/compile/__tests__/assetName.test.ts +55 -0
- package/src/compile/__tests__/compile.test.ts +287 -0
- package/src/compile/__tests__/detectEntry.test.ts +132 -0
- package/src/compile/__tests__/fontMacro.test.ts +199 -0
- package/src/compile/aspectMacro.ts +86 -0
- package/src/compile/assetIconMacro.ts +384 -0
- package/src/compile/assetMacro.ts +146 -0
- package/src/compile/assetName.ts +50 -0
- package/src/compile/bundler.ts +287 -0
- package/src/compile/compileProject.ts +127 -0
- package/src/compile/detectEntry.ts +128 -0
- package/src/compile/fontMacro.ts +459 -0
- package/src/compile/fontRegistry.ts +78 -0
- package/src/compile/header.ts +67 -0
- package/src/compile/index.ts +100 -0
- package/src/compile/libraryImports.ts +52 -0
- package/src/compile/liteMaterial.ts +247 -0
- package/src/compile/sceneEditor.ts +88 -0
- package/src/compile/serverSplit.ts +233 -0
- package/src/compile/serverTypes.ts +227 -0
- package/src/compile/sfnt.ts +98 -0
- package/src/compile/shaderSchema.ts +202 -0
- package/src/compile/shaderTargets.ts +77 -0
- package/src/compile/sourcemap.ts +25 -0
- package/src/core/Aspect.ts +568 -0
- package/src/core/InspectorUI.ts +212 -0
- package/src/core/StateMachine.ts +308 -0
- package/src/core/__tests__/stateMachine.test.ts +132 -0
- package/src/core/color.ts +66 -0
- package/src/core/compWrite.ts +42 -0
- package/src/core/events.ts +38 -0
- package/src/core/fields.ts +120 -0
- package/src/core/registry.ts +23 -0
- package/src/core/signals.ts +277 -0
- package/src/core/time.ts +84 -0
- package/src/g2/Camera2D.ts +40 -0
- package/src/g2/CharacterController2D.ts +276 -0
- package/src/g2/Node2D.ts +267 -0
- package/src/g2/OneWay2D.ts +66 -0
- package/src/g2/Physics2D.ts +346 -0
- package/src/g2/Scene2D.ts +209 -0
- package/src/g2/Shape2D.ts +259 -0
- package/src/g2/Sprite.ts +89 -0
- package/src/g2/SpriteAnimation.ts +171 -0
- package/src/g2/SpriteSheet.ts +166 -0
- package/src/g2/Texture2D.ts +47 -0
- package/src/g2/Tilemap.ts +41 -0
- package/src/g2/Tileset.ts +71 -0
- package/src/g2/Trigger2D.ts +77 -0
- package/src/g2/autotile.ts +433 -0
- package/src/g2/cells.ts +91 -0
- package/src/g2/defineScene2d.ts +381 -0
- package/src/g2/groups2d.ts +106 -0
- package/src/g2/loop.ts +50 -0
- package/src/g2/scenarios2d.ts +69 -0
- package/src/g2/touch.ts +83 -0
- package/src/gl/Camera.ts +160 -0
- package/src/gl/CameraPlace.ts +52 -0
- package/src/gl/CharacterController.ts +238 -0
- package/src/gl/Gearbox.ts +212 -0
- package/src/gl/Geometry.ts +279 -0
- package/src/gl/IK.ts +193 -0
- package/src/gl/InstancedMesh.ts +132 -0
- package/src/gl/Light.ts +135 -0
- package/src/gl/Lightmap.ts +402 -0
- package/src/gl/Locomotion.ts +498 -0
- package/src/gl/Material.ts +279 -0
- package/src/gl/Mesh.ts +83 -0
- package/src/gl/Model.ts +124 -0
- package/src/gl/NavAgent.ts +337 -0
- package/src/gl/NavMesh.ts +397 -0
- package/src/gl/Node.ts +350 -0
- package/src/gl/Noise.ts +30 -0
- package/src/gl/Particles.ts +676 -0
- package/src/gl/Physics.ts +222 -0
- package/src/gl/Plane.ts +53 -0
- package/src/gl/Ragdoll.ts +270 -0
- package/src/gl/Ray.ts +16 -0
- package/src/gl/Scene.ts +505 -0
- package/src/gl/Shape.ts +409 -0
- package/src/gl/Terrain.ts +1092 -0
- package/src/gl/Texture.ts +63 -0
- package/src/gl/Trigger.ts +45 -0
- package/src/gl/Vehicle.ts +473 -0
- package/src/gl/Wheel.ts +240 -0
- package/src/gl/animation/AnimationClip.ts +204 -0
- package/src/gl/animation/Animator.ts +329 -0
- package/src/gl/animation/Layer.ts +39 -0
- package/src/gl/animation/Loop.ts +31 -0
- package/src/gl/animation/Playback.ts +52 -0
- package/src/gl/animation/core.ts +670 -0
- package/src/gl/controls.ts +95 -0
- package/src/gl/physicsEvents.ts +20 -0
- package/src/gl/scenarios.ts +291 -0
- package/src/gl/state.ts +6 -0
- package/src/gl/terrainMesh.ts +219 -0
- package/src/gl/touch.ts +68 -0
- package/src/host.d.ts +61 -0
- package/src/inject.ts +203 -0
- package/src/math/Mathf.ts +118 -0
- package/src/math/mat4.ts +278 -0
- package/src/math/quat.ts +232 -0
- package/src/math/vec.ts +255 -0
- package/src/net/codec.ts +119 -0
- package/src/net/core.ts +384 -0
- package/src/net/index.ts +181 -0
- package/src/net/replication.ts +622 -0
- package/src/plugins/camera.ts +81 -0
- package/src/plugins/geolocation.ts +123 -0
- package/src/plugins/oauth.ts +61 -0
- package/src/plugins/permission.ts +7 -0
- package/src/plugins/push.ts +132 -0
- package/src/plugins/qr.ts +73 -0
- package/src/plugins/service.ts +47 -0
- package/src/runtime/app.ts +101 -0
- package/src/runtime/appEvents.ts +54 -0
- package/src/runtime/channel.ts +61 -0
- package/src/runtime/clipboard.ts +20 -0
- package/src/runtime/datetime.ts +329 -0
- package/src/runtime/device.ts +293 -0
- package/src/runtime/fetch.ts +77 -0
- package/src/runtime/files.ts +108 -0
- package/src/runtime/input.ts +175 -0
- package/src/runtime/media.ts +111 -0
- package/src/runtime/misc.ts +16 -0
- package/src/runtime/net.ts +36 -0
- package/src/runtime/rpc.ts +218 -0
- package/src/runtime/service.ts +83 -0
- package/src/runtime/share.ts +9 -0
- package/src/runtime/storage.ts +13 -0
- package/src/runtime/touch.ts +76 -0
- package/src/scene/defineScene.ts +1396 -0
- package/src/scene/editorPlugins.ts +110 -0
- package/src/scene/gizmos.ts +148 -0
- package/src/scene/grammar.ts +120 -0
- package/src/scene/level.ts +296 -0
- package/src/scene/material.ts +188 -0
- package/src/server/auth/appConfig.ts +12 -0
- package/src/server/auth/global.ts +80 -0
- package/src/server/auth/host.ts +318 -0
- package/src/server/auth/models.ts +83 -0
- package/src/server/auth/types.ts +50 -0
- package/src/server/channel.ts +56 -0
- package/src/server/context.ts +36 -0
- package/src/server/db/defineDb.ts +237 -0
- package/src/server/db/fields.ts +132 -0
- package/src/server/db/httpTransport.ts +93 -0
- package/src/server/db/index.ts +7 -0
- package/src/server/db/marci/query.ts +412 -0
- package/src/server/db/types.ts +202 -0
- package/src/server/errors.ts +12 -0
- package/src/server/host.ts +74 -0
- package/src/server/inject.ts +13 -0
- package/src/server/runtime.ts +133 -0
- package/src/server/validate.ts +87 -0
- package/src/ui/NativeView.ts +142 -0
- package/src/ui/UI.ts +39 -0
- package/src/ui/UIBottomSheet.ts +139 -0
- package/src/ui/UIButton.ts +101 -0
- package/src/ui/UIContainer.ts +60 -0
- package/src/ui/UIImage.ts +83 -0
- package/src/ui/UIInput.ts +185 -0
- package/src/ui/UIModal.ts +139 -0
- package/src/ui/UINode.ts +830 -0
- package/src/ui/UIPager.ts +362 -0
- package/src/ui/UIPopover.ts +100 -0
- package/src/ui/UIScreen.ts +123 -0
- package/src/ui/UIScrollable.ts +87 -0
- package/src/ui/UISpacer.ts +14 -0
- package/src/ui/UITabs.ts +236 -0
- package/src/ui/UIText.ts +51 -0
- package/src/ui/UIVideo.ts +88 -0
- package/src/ui/UIVirtualizedList.ts +241 -0
- package/src/ui/UIWidget.ts +127 -0
- package/src/ui/fonts.ts +13 -0
- package/src/ui/presentable.ts +117 -0
- package/src/ui/router.ts +132 -0
- package/src/ui/theme.ts +84 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { type UIPager } from "./UIPager";
|
|
2
|
+
import { ScreenElement, UIScreen } from "./UIScreen";
|
|
3
|
+
import { type UIRow as UIRowType } from "./UIContainer";
|
|
4
|
+
import { type ImageSource } from "./UIImage";
|
|
5
|
+
import type { UIChildArg } from "./UINode";
|
|
6
|
+
export type UITabDef = {
|
|
7
|
+
label: string;
|
|
8
|
+
/** Tab icon — typically `assetIcon("lucide:…")`. Tinted active/inactive by the bar. */
|
|
9
|
+
icon?: ImageSource;
|
|
10
|
+
/** The tab's root screen. Tabs are fixed at construction (like UIPager's). */
|
|
11
|
+
screen: UIScreen;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A bottom-tab app shell: swipeable tabs (a `UIPager`) plus a themed tab bar, as one
|
|
15
|
+
* `UIScreen` — present it directly (`Router.init(tabs)`). Keys are tab ids, in tab order:
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* const tabs = UITabs({
|
|
19
|
+
* home: { label: "Home", icon: assetIcon("lucide:house"), screen: homeScreen },
|
|
20
|
+
* profile: { label: "Profile", icon: assetIcon("lucide:user"), screen: profileScreen },
|
|
21
|
+
* })
|
|
22
|
+
* Router.init(tabs)
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* In-tab navigation stays the pager's: `UIPager.push(detail)` from any screen (bar stays);
|
|
26
|
+
* `Router.push` opens above the shell (bar covered). Restyle via `theme()` (primaryColor,
|
|
27
|
+
* mutedColor, tabbarBg, …) or the `bar` handle; for a fully custom bar build on `UIPager`.
|
|
28
|
+
*/
|
|
29
|
+
export interface UITabs extends UIScreen {
|
|
30
|
+
/** The active tab id. */
|
|
31
|
+
readonly tab: string;
|
|
32
|
+
/** Switch tabs (instant, the tab-bar convention; `animated: true` slides). */
|
|
33
|
+
select(id: string, animated?: boolean): this;
|
|
34
|
+
/** Fires when the active tab changes and has settled — a bar tap, swipe, or `select()`. */
|
|
35
|
+
onSelect(callback: (id: string, index: number) => void): this;
|
|
36
|
+
/** Show a badge on a tab: `true` = dot, a number/string = count pill, `false`/`null`/`0` clears. */
|
|
37
|
+
badge(id: string, value: number | string | boolean | null): this;
|
|
38
|
+
/** The pager under the bar — in-tab stacks (`push`/`pop`/`depth`). */
|
|
39
|
+
readonly pager: UIPager;
|
|
40
|
+
/** The bar row (named "tabbar") — for restyling beyond the theme variables. */
|
|
41
|
+
readonly bar: UIRowType;
|
|
42
|
+
}
|
|
43
|
+
export declare class TabsElement extends ScreenElement {
|
|
44
|
+
private readonly ids;
|
|
45
|
+
private readonly _pagerEl;
|
|
46
|
+
private readonly _bar;
|
|
47
|
+
private readonly _icons;
|
|
48
|
+
private readonly _labels;
|
|
49
|
+
private readonly _badges;
|
|
50
|
+
private readonly _badgeTexts;
|
|
51
|
+
private readonly _buttons;
|
|
52
|
+
private readonly _selectListeners;
|
|
53
|
+
constructor(defs: Record<string, UITabDef>);
|
|
54
|
+
private _applyActive;
|
|
55
|
+
get tab(): string;
|
|
56
|
+
get pager(): any;
|
|
57
|
+
get bar(): any;
|
|
58
|
+
select(id: string, animated?: boolean): this;
|
|
59
|
+
onSelect(callback: (id: string, index: number) => void): this;
|
|
60
|
+
badge(id: string, value: number | string | boolean | null | undefined): this;
|
|
61
|
+
}
|
|
62
|
+
/** Create the standard bottom-tab shell — see {@link UITabs}. Keys are tab ids in tab order;
|
|
63
|
+
* each tab needs a `label` and its root `screen` (plus an optional `icon`). */
|
|
64
|
+
export declare function UITabs(tabs: Record<string, UITabDef>): UITabs;
|
|
65
|
+
/** A `defineTabs` tab: `label` + optional `icon` (an `assetIcon("lucide:…")` call — never a
|
|
66
|
+
* hand-written source object). `UITabDef` is this plus the tab's root `screen`. */
|
|
67
|
+
export type TabDef = Omit<UITabDef, "screen">;
|
|
68
|
+
/** What `defineTabs` returns: the bar (mount it yourself when the screen owns its whole layout)
|
|
69
|
+
* and the standard screen shell around it. `active` must be a declared tab id, as a literal. */
|
|
70
|
+
export type TabsHandle<T extends Record<string, TabDef>> = {
|
|
71
|
+
/** Tab ids in declaration order. */
|
|
72
|
+
ids: (keyof T & string)[];
|
|
73
|
+
/** The bar alone — one button per tab, the `active` one highlighted. */
|
|
74
|
+
bar(active: keyof T & string): UIRowType;
|
|
75
|
+
/** A screen sitting ON the bar: `[ padded content column, bar ]`. */
|
|
76
|
+
screen(active: keyof T & string, ...children: UIChildArg[]): UIScreen;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Declare a tab bar WITHOUT screens — the design-stage twin of {@link UITabs} (same keys, same
|
|
80
|
+
* `tab-<id>` button names, same theme variables), for mockups where every screen is its own file
|
|
81
|
+
* and mounts the bar with a literal tab id:
|
|
82
|
+
*
|
|
83
|
+
* ```ts
|
|
84
|
+
* export const mainTabs = defineTabs({
|
|
85
|
+
* home: { label: "Home", icon: assetIcon("lucide:house") },
|
|
86
|
+
* profile: { label: "Profile", icon: assetIcon("lucide:user") },
|
|
87
|
+
* })
|
|
88
|
+
* // in a screen file:
|
|
89
|
+
* export default () => mainTabs.screen("home", [ ...content ])
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* Restyle through the theme — `theme({ primaryColor, mutedColor, tabbarBg, screenBg })` recolors
|
|
93
|
+
* every bar at once. The built app passes the same keys (plus each tab's root screen) to `UITabs`,
|
|
94
|
+
* which renders the identical bar interactively.
|
|
95
|
+
*/
|
|
96
|
+
export declare function defineTabs<T extends Record<string, TabDef>>(tabs: T): TabsHandle<T>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Element, type BaseStyle, type DrawableStyle, type ElementStyle, type TextStyle, type UIElementBase } from "./UINode";
|
|
2
|
+
export type UITextStyle = ElementStyle & TextStyle & DrawableStyle;
|
|
3
|
+
/** A text label. */
|
|
4
|
+
export interface UIText extends UIElementBase<UITextStyle, DrawableStyle & BaseStyle & TextStyle> {
|
|
5
|
+
readonly type: "text";
|
|
6
|
+
/** The displayed string — writable at any time. */
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class TextElement extends Element<"text"> {
|
|
10
|
+
private _text;
|
|
11
|
+
constructor(style: any, text: string | (() => string));
|
|
12
|
+
get text(): string;
|
|
13
|
+
set text(value: string);
|
|
14
|
+
}
|
|
15
|
+
/** Create a text label — a string, or `() => string` for reactive text that re-renders when a
|
|
16
|
+
* signal it read changes. */
|
|
17
|
+
export declare function UIText(text: string | (() => string)): UIText;
|
|
18
|
+
/** @deprecated Style as the first argument is legacy — use chained `.style({...})`. */
|
|
19
|
+
export declare function UIText(style: UITextStyle, text: string | (() => string)): UIText;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { VideoPlayer } from "../runtime/media";
|
|
2
|
+
import { type PresentOptions } from "./presentable";
|
|
3
|
+
import { type BaseStyle, type DrawableStyle, type ElementStyle, type UIElementBase } from "./UINode";
|
|
4
|
+
export type UIVideoStyle = ElementStyle & DrawableStyle & {
|
|
5
|
+
objectFit?: "cover" | "contain" | "fill";
|
|
6
|
+
};
|
|
7
|
+
/** A video surface showing a `VideoPlayer`'s output — embeddable in a screen AND
|
|
8
|
+
* fullscreen-presentable (`open()`), with seamless promotion between the two. */
|
|
9
|
+
export interface UIVideo extends UIElementBase<UIVideoStyle, DrawableStyle & BaseStyle> {
|
|
10
|
+
readonly type: "video";
|
|
11
|
+
/** The player driving this surface (playback control lives on it). */
|
|
12
|
+
player: VideoPlayer;
|
|
13
|
+
/** Show fullscreen as the current destination. Promotion: if this video is mounted in a screen,
|
|
14
|
+
* the SAME native player moves fullscreen — playback uninterrupted; a pop moves it back. */
|
|
15
|
+
open(options?: PresentOptions): void;
|
|
16
|
+
/** Dismiss if this is the visible destination. */
|
|
17
|
+
close(): void;
|
|
18
|
+
/** Became the visible destination. */
|
|
19
|
+
onOpen(callback: () => void): this;
|
|
20
|
+
/** Stopped being the visible destination. */
|
|
21
|
+
onClose(callback: () => void): this;
|
|
22
|
+
/** Hardware/system back while current. */
|
|
23
|
+
onBackPressed(callback: () => void): this;
|
|
24
|
+
}
|
|
25
|
+
/** Create a video node showing `player`'s output. */
|
|
26
|
+
export declare function UIVideo(player: VideoPlayer): UIVideo;
|
|
27
|
+
/** @deprecated Style as the first argument is legacy — use chained `.style({...})`. */
|
|
28
|
+
export declare function UIVideo(style: UIVideoStyle, player: VideoPlayer): UIVideo;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Element, type Color, type DrawableStyle, type ElementStyle, type UIElementBase, type UINodeChild } from "./UINode";
|
|
2
|
+
export type UIVirtualizedListStyle = DrawableStyle & ElementStyle & {
|
|
3
|
+
/** Tint of the native pull-to-refresh spinner (pairs with `onRefresh`). */
|
|
4
|
+
refreshControlColor?: Color;
|
|
5
|
+
/** Same key and semantics as UIScrollable's; `"none"` keeps a chat composer's keyboard up no
|
|
6
|
+
* matter how the history is scrolled. */
|
|
7
|
+
keyboardDismissMode?: "interactive" | "scroll" | "none";
|
|
8
|
+
};
|
|
9
|
+
export interface VListConfig<T> {
|
|
10
|
+
/** Stable unique key of an item. */
|
|
11
|
+
keyOf: (item: T) => string;
|
|
12
|
+
/** Subtree factory — called when the item enters the window; the subtree lives until it
|
|
13
|
+
* leaves. */
|
|
14
|
+
render: (item: T) => UINodeChild;
|
|
15
|
+
/** Height estimate (px) used before the first measurement — a number, or a per-item function
|
|
16
|
+
* (chat: `msg => 40 + Math.ceil(msg.text.length / 35) * 20`). Computed once when the item is
|
|
17
|
+
* added. */
|
|
18
|
+
estimatedHeight: number | ((item: T) => number);
|
|
19
|
+
/** Extra px around the viewport kept mounted. Default: one viewport height. */
|
|
20
|
+
overscan?: number;
|
|
21
|
+
/** Chat mode: the first layout starts scrolled to the end, and appends auto-scroll while the
|
|
22
|
+
* list sits at the bottom. */
|
|
23
|
+
inverted?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** A windowed (virtualized) list: only the items near the viewport are mounted — for long feeds
|
|
26
|
+
* and chats. Items are keyed; feed it via `setData`/`append`/`prepend`. */
|
|
27
|
+
export interface UIVirtualizedList<T = unknown> extends UIElementBase<UIVirtualizedListStyle> {
|
|
28
|
+
readonly type: "vlist";
|
|
29
|
+
/** Replace the data wholesale — vanished keys are unmounted by the host's window sync. */
|
|
30
|
+
setData(items: T[]): this;
|
|
31
|
+
/** Append items to the end (auto-scrolls when `inverted` and resting at the bottom). */
|
|
32
|
+
append(...items: T[]): this;
|
|
33
|
+
/** Insert at the start WITHOUT a scroll jump (the host compensates the offset). */
|
|
34
|
+
prepend(...items: T[]): this;
|
|
35
|
+
/** Update items with the same keys: mounted ones re-render; the cached height persists until
|
|
36
|
+
* re-measured. */
|
|
37
|
+
update(...items: T[]): this;
|
|
38
|
+
/** Remove items by key. */
|
|
39
|
+
removeByKey(...keys: string[]): this;
|
|
40
|
+
/** Number of data items (mounted or not). */
|
|
41
|
+
readonly itemCount: number;
|
|
42
|
+
/** The data item under `key`, if any. */
|
|
43
|
+
getItem(key: string): T | undefined;
|
|
44
|
+
/** Scroll to `offset` px. */
|
|
45
|
+
scrollTo(offset: number, animated?: boolean): void;
|
|
46
|
+
/** Scroll to the item with `key`. */
|
|
47
|
+
scrollToKey(key: string, animated?: boolean): void;
|
|
48
|
+
/** Scroll to the end of the content. */
|
|
49
|
+
scrollToEnd(animated?: boolean): void;
|
|
50
|
+
/** Scroll position changed (px from the start edge). */
|
|
51
|
+
onScroll(callback: (scrollPosition: number) => void): this;
|
|
52
|
+
/** Pull-to-refresh: the spinner stays until the returned promise settles. Attach BEFORE the
|
|
53
|
+
* node mounts (hosts read it at creation). Native hosts only — no-op on web. */
|
|
54
|
+
onRefresh(callback: () => void | Promise<void>): this;
|
|
55
|
+
/** Fires within `thresholdPx` of the content's bottom edge — once, re-armed after leaving the
|
|
56
|
+
* edge (host-side latch). Infinite-scroll loading. */
|
|
57
|
+
onEndReached(thresholdPx: number, callback: () => void): this;
|
|
58
|
+
/** Same, for the top edge — chat history loading. */
|
|
59
|
+
onStartReached(thresholdPx: number, callback: () => void): this;
|
|
60
|
+
}
|
|
61
|
+
export declare class VListElement<T> extends Element<"vlist"> implements UIVirtualizedList<T> {
|
|
62
|
+
_overscan: number;
|
|
63
|
+
_inverted: boolean;
|
|
64
|
+
_keys: string[];
|
|
65
|
+
_estimates: number[];
|
|
66
|
+
_endThreshold: number;
|
|
67
|
+
_startThreshold: number;
|
|
68
|
+
protected sl: ((scrollPosition: number) => void)[];
|
|
69
|
+
protected erl: (() => void)[];
|
|
70
|
+
protected strl: (() => void)[];
|
|
71
|
+
private items;
|
|
72
|
+
private mounted;
|
|
73
|
+
private keyOf;
|
|
74
|
+
private renderItem;
|
|
75
|
+
private estimate;
|
|
76
|
+
constructor(config: VListConfig<T>);
|
|
77
|
+
private get isAttached();
|
|
78
|
+
private register;
|
|
79
|
+
setData(items: T[]): this;
|
|
80
|
+
append(...items: T[]): this;
|
|
81
|
+
prepend(...items: T[]): this;
|
|
82
|
+
update(...items: T[]): this;
|
|
83
|
+
removeByKey(...keys: string[]): this;
|
|
84
|
+
get itemCount(): number;
|
|
85
|
+
getItem(key: string): T | undefined;
|
|
86
|
+
scrollTo(offset: number, animated?: boolean): void;
|
|
87
|
+
scrollToKey(key: string, animated?: boolean): void;
|
|
88
|
+
scrollToEnd(animated?: boolean): void;
|
|
89
|
+
onScroll(callback: (scrollPosition: number) => void): this;
|
|
90
|
+
_refreshCallback: any;
|
|
91
|
+
onRefresh(callback: () => void | Promise<void>): this;
|
|
92
|
+
onEndReached(thresholdPx: number, callback: () => void): this;
|
|
93
|
+
onStartReached(thresholdPx: number, callback: () => void): this;
|
|
94
|
+
}
|
|
95
|
+
/** Create a virtualized list from a config (`keyOf` + `render` + `estimatedHeight` required),
|
|
96
|
+
* then feed it via `setData`/`append`/`prepend`. Give it a size (`flexGrow: 1` as a screen body). */
|
|
97
|
+
export declare function UIVirtualizedList<T>(config: VListConfig<T>): UIVirtualizedList<T>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { TouchStartEvent } from "../runtime/touch";
|
|
2
|
+
import { Presentable } from "./presentable";
|
|
3
|
+
import { ContainerElement, type BaseStyle, type Color, type ContainerStyle, type DrawableStyle, type PaddingStyle, type PositionStyle, type UIChildArg, type UIContainerBase, type UINodeChild, type ChildrenFn } from "./UINode";
|
|
4
|
+
export type UIWidgetStyle = ContainerStyle & DrawableStyle & PaddingStyle & BaseStyle & PositionStyle & {
|
|
5
|
+
/** A layer behind the widget that intercepts clicks — `"transparent"` still intercepts, `null`
|
|
6
|
+
* removes the layer. A tap on it fires `onOverlayTap`. */
|
|
7
|
+
overlayColor?: Color | null;
|
|
8
|
+
};
|
|
9
|
+
/** A floating overlay — absolutely positioned in device coordinates, mounted above the page as
|
|
10
|
+
* its own layout root (never a child of what's underneath). The base of dialogs, toasts,
|
|
11
|
+
* mini-players and scene HUDs; `UIModal`/`UIPopover`/`UIBottomSheet` build on it. */
|
|
12
|
+
export interface UIWidget extends UIContainerBase<UIWidgetStyle, DrawableStyle & BaseStyle & {
|
|
13
|
+
overlayColor?: Color | null;
|
|
14
|
+
}> {
|
|
15
|
+
readonly type: "widget";
|
|
16
|
+
/**
|
|
17
|
+
* Attach this widget to a destination (a `Scene`, a `UIScreen`, …): the widget lives on that
|
|
18
|
+
* page's layer — it shows/hides with the page and rides its transition, and a screen pushed
|
|
19
|
+
* on top covers it (a scene HUD behaves like part of the scene). Sticky until `attachTo(null)`
|
|
20
|
+
* (= back to a global overlay). Set it while the widget is hidden. The widget is always its own
|
|
21
|
+
* overlay root mounted into the owner's page view — it never becomes a child of the owner, so it
|
|
22
|
+
* stays topmost and its updates never trigger the owner's relayout. Works with a `UIScreen` that
|
|
23
|
+
* is a page inside a `UIPager`: the widget mounts into that tab and rides its swipe. (Web shows
|
|
24
|
+
* and hides it with the owner but does not yet ride the transition.)
|
|
25
|
+
*/
|
|
26
|
+
attachTo(owner: Presentable | null): this;
|
|
27
|
+
/** Show the widget. By default it is a global overlay above every destination — it stays
|
|
28
|
+
* visible across navigation until `hide()` (dialogs, mini-player, global loader). If the
|
|
29
|
+
* widget was attached via `attachTo(owner)`, it mounts on that page's layer instead and is
|
|
30
|
+
* only visible while the owner is presented. */
|
|
31
|
+
show(): void;
|
|
32
|
+
/** Unmount the widget. */
|
|
33
|
+
hide(): void;
|
|
34
|
+
/** Mounted right now (`show()` ran, `hide()` hasn't). */
|
|
35
|
+
readonly isShow: boolean;
|
|
36
|
+
/** Touch began on the widget; `ev.track(...)` takes over the rest of the gesture. */
|
|
37
|
+
onTouchStart(callback: (ev: TouchStartEvent<UIWidget>) => void): this;
|
|
38
|
+
/** Tap on the overlay layer (requires an `overlayColor`). */
|
|
39
|
+
onOverlayTap(callback: () => void): this;
|
|
40
|
+
/** Hardware/system back while the widget is shown. */
|
|
41
|
+
onBackPressed(callback: () => void): this;
|
|
42
|
+
}
|
|
43
|
+
export declare class WidgetElement extends ContainerElement<"widget"> {
|
|
44
|
+
scrollable: false;
|
|
45
|
+
_owner?: Presentable;
|
|
46
|
+
constructor(type: "widget", style: UIWidgetStyle, children: UINodeChild[] | ChildrenFn);
|
|
47
|
+
attachTo(owner: Presentable | null): this;
|
|
48
|
+
show(): void;
|
|
49
|
+
hide(): void;
|
|
50
|
+
get isShow(): boolean;
|
|
51
|
+
_interactive: boolean;
|
|
52
|
+
readonly touchStartListeners: any[];
|
|
53
|
+
onTouchStart(callback: any): this;
|
|
54
|
+
_emitTouchStart(pointerId: number, clientX: number, clientY: number): any;
|
|
55
|
+
readonly otl: (() => void)[];
|
|
56
|
+
onOverlayTap(callback: () => void): this;
|
|
57
|
+
_backButtonCallback?: () => void;
|
|
58
|
+
onBackPressed(callback: any): this;
|
|
59
|
+
}
|
|
60
|
+
/** Create a widget (same argument forms as `UIColumn`). Position it with absolute-style props
|
|
61
|
+
* (`top`/`left`/`bottom`/`right`), then `show()`/`hide()`. */
|
|
62
|
+
export declare function UIWidget(...children: UIChildArg[]): UIWidget;
|
|
63
|
+
export declare function UIWidget(children: UINodeChild[] | ChildrenFn): UIWidget;
|
|
64
|
+
/** @deprecated Style as the first argument is legacy — use chained `.style({...})`. */
|
|
65
|
+
export declare function UIWidget(style: UIWidgetStyle, children?: UINodeChild[] | ChildrenFn): UIWidget;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type FontOptions = {
|
|
2
|
+
weight?: number;
|
|
3
|
+
style?: "normal" | "italic";
|
|
4
|
+
};
|
|
5
|
+
/** Register a font face from a URL at runtime under `fontFamily`; resolves once it's ready to
|
|
6
|
+
* use in styles. For registry/project fonts prefer the compile-time `font()` macro — this is the
|
|
7
|
+
* dynamic escape hatch. */
|
|
8
|
+
export declare function registerFont(fontFamily: string, url: string, options?: FontOptions): Promise<void>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** Built-in transition catalog. `push`/`pop` are the stacked-navigation pair (slide + parallax +
|
|
2
|
+
* dim + edge shadow); the rest are simple two-view moves. */
|
|
3
|
+
export type TransitionName = "push" | "pop" | "slide-from-left" | "slide-from-right" | "slide-from-top" | "slide-from-bottom" | "zoom" | "zoom-in" | "zoom-out" | "fade" | "none";
|
|
4
|
+
/** Start/end pose of one side of a custom transition. `x`/`y` are logical px, or a percentage of
|
|
5
|
+
* the destination's size (e.g. `"100%"` = one full width to the right). */
|
|
6
|
+
export type TransitionTransform = {
|
|
7
|
+
x?: number | `${number}%`;
|
|
8
|
+
y?: number | `${number}%`;
|
|
9
|
+
scale?: number;
|
|
10
|
+
opacity?: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* A custom transition: declarative poses for the incoming/outgoing destination, played natively.
|
|
14
|
+
* Serializes onto each platform's existing transition machinery — there is no per-frame JS.
|
|
15
|
+
* Fields omitted keep the identity pose. Interactive back-swipe stays system-native (push/pop
|
|
16
|
+
* only); a spec applies to non-interactive transitions.
|
|
17
|
+
*/
|
|
18
|
+
export interface TransitionSpec {
|
|
19
|
+
/** Duration in ms (default 300). */
|
|
20
|
+
duration?: number;
|
|
21
|
+
/** cubic-bezier control points (default ease-out). */
|
|
22
|
+
easing?: [number, number, number, number];
|
|
23
|
+
/** The entering destination animates FROM this pose to identity. */
|
|
24
|
+
incoming?: {
|
|
25
|
+
from?: TransitionTransform;
|
|
26
|
+
};
|
|
27
|
+
/** The leaving destination animates from identity TO this pose. */
|
|
28
|
+
outgoing?: {
|
|
29
|
+
to?: TransitionTransform;
|
|
30
|
+
};
|
|
31
|
+
/** Scrim alpha (0..1) painted over whichever destination is underneath. */
|
|
32
|
+
dim?: number;
|
|
33
|
+
/** Which side stacks on top during the animation (default "incoming"). On Android, transitions
|
|
34
|
+
* involving a scene always animate the screen side on top — the scene view itself never moves. */
|
|
35
|
+
onTop?: "incoming" | "outgoing";
|
|
36
|
+
}
|
|
37
|
+
export type Transition = TransitionName | TransitionSpec;
|
|
38
|
+
export type PresentOptions = {
|
|
39
|
+
/** Transition to play while this destination replaces the current one (default "none" for a
|
|
40
|
+
* direct open(); the Router applies its own defaults — push/pop, and the theme's
|
|
41
|
+
* `replaceTransition` for replace). */
|
|
42
|
+
transition?: Transition;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Anything that can be shown as the app's current destination: a `UIScreen`, a `Scene` /
|
|
46
|
+
* `ARScene`, a `Scene2D`, a `NativeView`, or a `UIVideo`. One Presentable is visible at a time;
|
|
47
|
+
* open it directly (`p.open()` — replaces the current destination, suspending an active Router
|
|
48
|
+
* until `Router.restore()`) or navigate with `Router.push/replace/pop`.
|
|
49
|
+
*
|
|
50
|
+
* `onOpen`/`onClose` are the presentation lifecycle (fired when the destination becomes / stops
|
|
51
|
+
* being the visible one — including router pushes covering it and pops revealing it).
|
|
52
|
+
*/
|
|
53
|
+
export interface Presentable {
|
|
54
|
+
open(options?: PresentOptions): void | this | Promise<void>;
|
|
55
|
+
close(): void;
|
|
56
|
+
onOpen(callback: () => void): this;
|
|
57
|
+
onClose(callback: () => void): this;
|
|
58
|
+
onBackPressed(callback: () => void): this;
|
|
59
|
+
}
|
|
60
|
+
/** Runtime companion of the `Presentable` interface (declaration merging): the navigation
|
|
61
|
+
* state that isn't tied to the Router. */
|
|
62
|
+
export declare const Presentable: Readonly<{
|
|
63
|
+
/** The destination visible right now (a `UIScreen`, `Scene`, `Scene2D`, `NativeView` or
|
|
64
|
+
* `UIVideo`), or `null` before the first open. Distinct from `Router.current` — that is the
|
|
65
|
+
* top of the router stack, which stays meaningful while the router is suspended by a direct
|
|
66
|
+
* `open()`; this is what is actually on screen. `UIWidget.show()` attaches to it. */
|
|
67
|
+
readonly current: Presentable | null;
|
|
68
|
+
}>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Presentable, type Transition } from "./presentable";
|
|
2
|
+
type RouterOptions = {
|
|
3
|
+
showDefaultBackButton?: boolean;
|
|
4
|
+
};
|
|
5
|
+
type NavigateOptions = {
|
|
6
|
+
/** Transition to play. Defaults: `"push"` for push, `"pop"` for pop; replace follows the
|
|
7
|
+
* theme's `replaceTransition` (`"none"` out of the box). */
|
|
8
|
+
transition?: Transition;
|
|
9
|
+
};
|
|
10
|
+
/** Stack navigation over `Presentable` destinations. `init` once with the home page, then
|
|
11
|
+
* `push`/`replace`/`pop`; the back gesture/button pops natively. A direct `page.open()` suspends
|
|
12
|
+
* the router until `restore()`. */
|
|
13
|
+
type Router = {
|
|
14
|
+
/** The top of the router stack (not necessarily what's on screen — see `Presentable.current`). */
|
|
15
|
+
get current(): Presentable;
|
|
16
|
+
/** Mount the router with `homePage` as the stack root — the app's navigation entry point. */
|
|
17
|
+
init(homePage: Presentable, opts?: RouterOptions): void;
|
|
18
|
+
/** Push a destination onto the stack — a `UIScreen`, a `Scene`, a `Scene2D`, a `NativeView`,
|
|
19
|
+
* or a `UIVideo`. The back gesture/button pops it. Destinations with async preparation
|
|
20
|
+
* (`ARScene`: camera permission + warm render) return a Promise — the current page stays
|
|
21
|
+
* visible until they're ready, and a rejection (permission denied / superseded) leaves the
|
|
22
|
+
* stack untouched. */
|
|
23
|
+
push(page: Presentable, opts?: NavigateOptions): void | Promise<void>;
|
|
24
|
+
/** Swap the top of the stack for `page` — no back entry to the replaced one. */
|
|
25
|
+
replace(page: Presentable, opts?: NavigateOptions): void | Promise<void>;
|
|
26
|
+
/** Pop the top destination (the programmatic twin of the back gesture); `to` unwinds to a
|
|
27
|
+
* stack index in one step. */
|
|
28
|
+
pop(to?: number, opts?: NavigateOptions): void;
|
|
29
|
+
/** Blank the router's page, keeping the stack — `restore()` brings it back. A destination
|
|
30
|
+
* opened directly stays visible. */
|
|
31
|
+
hide(): void;
|
|
32
|
+
/** Re-present the stack top after `hide()` or a direct `open()` suspended the router. */
|
|
33
|
+
restore(): void;
|
|
34
|
+
/** `"change"` fires on every stack change — pushes, pops, and native back gestures — with the
|
|
35
|
+
* new top destination. */
|
|
36
|
+
addEventListener(channel: "change", callback: (page: Presentable) => void): void;
|
|
37
|
+
removeEventListener(channel: "change", callback: (page: Presentable) => void): void;
|
|
38
|
+
};
|
|
39
|
+
export declare const Router: Router;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Transition } from "./presentable";
|
|
2
|
+
export type ThemeValues = Record<string, string | number | null>;
|
|
3
|
+
export type ThemeAccessors<T> = {
|
|
4
|
+
readonly [K in keyof T]: K extends string ? `var(--${K})` : never;
|
|
5
|
+
};
|
|
6
|
+
/** App theme: callable to merge variables (`theme({...})` — re-calling re-styles the live UI, so
|
|
7
|
+
* dark mode is just a second call), with the system vars as static properties
|
|
8
|
+
* (`theme.primaryColor`, `theme["comfort-top"]`, …). */
|
|
9
|
+
export declare const theme: (<T extends Record<string, string | number | Transition | null>>(values: T & { [K in Exclude<keyof T, "replaceTransition">]: string | number | null; }) => ThemeAccessors<Omit<T, "replaceTransition">>) & {
|
|
10
|
+
/** The app accent color. Kit components will read it via `var(--primaryColor, <fallback>)`. */
|
|
11
|
+
readonly primaryColor: "var(--primaryColor)";
|
|
12
|
+
/** Secondary / inactive content color for kit components. */
|
|
13
|
+
readonly mutedColor: "var(--mutedColor)";
|
|
14
|
+
/** DEFAULT text color — text without an explicit `color` follows it (hosts source their
|
|
15
|
+
* default from the theme; unset = the host default, white on dark screens). Set it once for
|
|
16
|
+
* a light theme instead of `color: "black"` on every label. */
|
|
17
|
+
readonly color: "var(--color)";
|
|
18
|
+
/** DEFAULT text font — text without an explicit `fontFamily` follows it. */
|
|
19
|
+
readonly fontFamily: "var(--fontFamily)";
|
|
20
|
+
/** Raw comfort knobs (logical px). The bare `comfort-top` style TOKEN applies the safe-area
|
|
21
|
+
* formula — these accessors read the knob value itself, for manual composition. */
|
|
22
|
+
readonly "comfort-top": "var(--comfort-top)";
|
|
23
|
+
readonly "comfort-bottom": "var(--comfort-bottom)";
|
|
24
|
+
readonly "comfort-left": "var(--comfort-left)";
|
|
25
|
+
readonly "comfort-right": "var(--comfort-right)";
|
|
26
|
+
};
|