lecodes-sdk 1.1.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 +11 -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/Particles.d.ts +15 -0
- 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 +59 -3
- package/dist/types/gl/terrain/Terrain.d.ts +8 -0
- 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 +8 -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 +142 -142
- 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 +77 -54
- package/prompts/dist/3d-app.md +75 -52
- package/prompts/dist/ar-app.md +74 -51
- package/prompts/dist/design.md +30 -8
- package/prompts/dist/ui-app.md +73 -46
- package/prompts/ui-design.md +2 -3
- package/prompts/ui.md +45 -37
- package/src/animate/tween/Animation.ts +262 -378
- package/src/animate/tween/animateValue.ts +103 -100
- package/src/animate/tween/easing.ts +10 -3
- package/src/animate/tween/spec.ts +505 -479
- package/src/audio/Sound.ts +3 -3
- package/src/audio/audio.ts +162 -161
- 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/Foliage.ts +72 -17
- package/src/gl/Geometry.ts +1 -2
- package/src/gl/Light.ts +13 -0
- package/src/gl/Lightmap.ts +45 -29
- package/src/gl/Material.ts +95 -51
- package/src/gl/Model.ts +172 -167
- package/src/gl/Node.ts +91 -24
- package/src/gl/Particles.ts +20 -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/Locomotion.ts +77 -8
- 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/terrain/Terrain.ts +33 -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 +233 -236
- 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 +21 -8
- 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 +154 -148
- 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 -4730
- 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 -1760
- 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
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { FetchResponse } from "../runtime/fetch";
|
|
2
|
+
import type { ColorInput } from "../core/color";
|
|
2
3
|
import type { Animation } from "../animate/tween/Animation";
|
|
3
4
|
import { type TweenMeta } from "../animate/tween/spec";
|
|
5
|
+
import { type TreeElement } from "./tree";
|
|
4
6
|
export interface UINode {
|
|
5
7
|
readonly type: string;
|
|
6
8
|
/** Author-given semantic name (a stable selector for tests + AI review feedback). */
|
|
7
|
-
|
|
9
|
+
name?: string;
|
|
8
10
|
style: Style<this, any>;
|
|
9
11
|
/** Style-class proxy — read/set/toggle/bind the `$`-classes declared in `.style()`. See {@link Classes}. */
|
|
10
12
|
readonly class: Classes<this>;
|
|
@@ -15,9 +17,11 @@ export type UINodeChild = UINode | null | undefined | false;
|
|
|
15
17
|
* flattened one level at the argument position, so `UIColumn(header, items.map(row), footer)`
|
|
16
18
|
* needs no spread. */
|
|
17
19
|
export type UIChildArg = UINodeChild | UINodeChild[];
|
|
18
|
-
/** A color: CSS
|
|
19
|
-
*
|
|
20
|
-
|
|
20
|
+
/** A color: any CSS color string (`"#1c1c1e"`, `"rgba(0,0,0,0.5)"`, `"green"`, `"hsl(210 50% 40%)"`),
|
|
21
|
+
* a theme reference (`"var(--primaryColor)"`), an opaque `0xRRGGBB` number or `[r, g, b(, a)]` in
|
|
22
|
+
* 0..1; `null` clears. A string is the core's to parse (an unknown one is transparent, as in
|
|
23
|
+
* CSS); a number or an array that is not a color throws at the write. */
|
|
24
|
+
export type Color = ColorInput | null;
|
|
21
25
|
/** Style props every element accepts. */
|
|
22
26
|
export type BaseStyle = {
|
|
23
27
|
opacity?: number | `${number}`;
|
|
@@ -30,12 +34,6 @@ export type BaseStyle = {
|
|
|
30
34
|
bgColor?: Color | null;
|
|
31
35
|
overflow?: "visible" | "hidden";
|
|
32
36
|
boxSizing?: "border-box" | "content-box";
|
|
33
|
-
/**
|
|
34
|
-
* Author-given semantic name — a stable selector for tests and for marking elements in the AI
|
|
35
|
-
* code-review feedback loop. NOT a style: it's extracted at construction (never sent to the layout
|
|
36
|
-
* engine) and surfaced on the node + in the renderer's serialized output. Available on every element.
|
|
37
|
-
*/
|
|
38
|
-
name?: string;
|
|
39
37
|
};
|
|
40
38
|
/** Painted-box props: background, gradient, border, radius. */
|
|
41
39
|
export type DrawableStyle = {
|
|
@@ -155,25 +153,32 @@ export type TextStyle = {
|
|
|
155
153
|
textOverflow?: "ellipsis" | "clip";
|
|
156
154
|
};
|
|
157
155
|
/** Reactive style input: every primitive-valued prop also accepts a `() => value` binding that
|
|
158
|
-
* re-applies when a signal it read changes. Nested
|
|
159
|
-
*
|
|
156
|
+
* re-applies when a signal it read changes. Nested `$class` blocks stay static — bindings are
|
|
157
|
+
* extracted at the top level only. */
|
|
160
158
|
export type Reactive<T> = {
|
|
161
159
|
[K in keyof T]: NonNullable<T[K]> extends object ? T[K] : T[K] | (() => T[K]);
|
|
162
160
|
};
|
|
163
|
-
/** The curve of a
|
|
164
|
-
*
|
|
165
|
-
*
|
|
161
|
+
/** The curve of a `$class` block's swap (with a `duration`): a curve name (`outCubic`,
|
|
162
|
+
* `inOutSine`, `smoothstep` — the default — …), `cubic-bezier(x1,y1,x2,y2)` or `steps(n)`. A
|
|
163
|
+
* function cannot ride a style block; use `animateTo` for those. */
|
|
166
164
|
export type LayerEasing = string;
|
|
167
|
-
/**
|
|
168
|
-
*
|
|
169
|
-
* down the tree (CSS-`.dark`-on-body style): a class set on a node also
|
|
170
|
-
* blocks on all descendants within the same root (docs/
|
|
171
|
-
*
|
|
172
|
-
* classes
|
|
165
|
+
/** Style states: any `$`-prefixed key in `.style()` declares a state block; `duration`/`delay`/
|
|
166
|
+
* `easing` animate its swap. User classes (`$checked`, `$selected`, …) are toggled from code via the
|
|
167
|
+
* `el.class` proxy and INHERIT down the tree (CSS-`.dark`-on-body style): a class set on a node also
|
|
168
|
+
* activates same-name `$` blocks on all descendants within the same root (sdk/docs/ui/classes.md).
|
|
169
|
+
*
|
|
170
|
+
* Five classes are reserved — the system toggles them, `el.class` cannot:
|
|
171
|
+
* - `$hovered` / `$pressed` / `$focused` — the host's hover (mouse only) / press / focus. They
|
|
172
|
+
* cascade from the node the host toggled and STOP at the nearest interactive descendant (a
|
|
173
|
+
* button inside a pressed card is not pressed; it has its own scope).
|
|
174
|
+
* - `$landscape` / `$portrait` — the display orientation, GLOBAL: active on every node at once.
|
|
175
|
+
*
|
|
176
|
+
* Precedence on the same prop: base < `$landscape`/`$portrait` < user `$classes` (later-declared
|
|
177
|
+
* beats earlier) < `$hovered` < `$pressed` < `$focused`.
|
|
173
178
|
*
|
|
174
179
|
* Instantiated with the node's FULL style `T` — a class block accepts everything the node's
|
|
175
|
-
* `.style()` does
|
|
176
|
-
*
|
|
180
|
+
* `.style()` does. Narrowing it wrongly rejects valid props such as `$active: { color }`; guarded
|
|
181
|
+
* by tests/ui/types.test.ts. */
|
|
177
182
|
export type ClassStyles<T> = {
|
|
178
183
|
[key: `$${string}`]: T & {
|
|
179
184
|
duration?: number;
|
|
@@ -196,8 +201,9 @@ export type ClassValue = boolean | (() => boolean);
|
|
|
196
201
|
* el.class({ checked: true, done: () => … }) // batch form — returns the element, chainable
|
|
197
202
|
* ```
|
|
198
203
|
*
|
|
199
|
-
* Class names are accepted with or without the declaration-site `$` prefix.
|
|
200
|
-
*
|
|
204
|
+
* Class names are accepted with or without the declaration-site `$` prefix. A write of a reserved
|
|
205
|
+
* class (`hovered` `pressed` `focused` `landscape` `portrait`) throws — the system toggles those.
|
|
206
|
+
* `R` is the concrete node type, so the batch form chains like `.style()`.
|
|
201
207
|
*
|
|
202
208
|
* Typing note: property access is `any` because an index signature can't give reads (`boolean`)
|
|
203
209
|
* and writes ({@link ClassValue}) different types — the batch form is the fully typed path;
|
|
@@ -211,14 +217,25 @@ export interface UIElementBase<S extends object, A extends object = S> {
|
|
|
211
217
|
/** Style: `.style({...})` merges (chainable); `el.style.key = v` writes one prop, a `() => v`
|
|
212
218
|
* value binds it to signals — see {@link Style}. */
|
|
213
219
|
style: Style<this, S>;
|
|
220
|
+
/** Author-given semantic name — a stable selector for tests and for marking elements in the AI
|
|
221
|
+
* code-review feedback loop; surfaced in the renderer's serialized output. Set it with `.named()`
|
|
222
|
+
* (chainable) or assign it. */
|
|
223
|
+
name?: string;
|
|
224
|
+
/** Set the semantic name (chainable). */
|
|
225
|
+
named(name: string): this;
|
|
214
226
|
/** Tween to the target style — meta keys `duration`/`delay`/`loop`/…, see {@link AnimateStyle}. */
|
|
215
227
|
animateTo: AnimateStyle<this, A>;
|
|
216
228
|
/** Tween from the given style to the current one (entrance animations). */
|
|
217
229
|
animateFrom: AnimateStyle<this, A>;
|
|
218
230
|
/** Fires after every layout pass with the parent-relative box. */
|
|
219
231
|
onLayout(onLayout: OnLayoutCallback): this;
|
|
220
|
-
/** Absolute rect in device space, read live (includes scroll); `null` before
|
|
232
|
+
/** Absolute rect in device space, read live (includes scroll); `null` before layout. */
|
|
221
233
|
getBoundingClientRect(): BoundingClientRect | null;
|
|
234
|
+
/** The parent element, or `null` for a root (a screen, a widget, an unmounted subtree's top). */
|
|
235
|
+
readonly parent: UINode | null;
|
|
236
|
+
/** Free this element's subtree now (views, layout, native state). Only for a DETACHED subtree —
|
|
237
|
+
* remove / hide / close it first; an attached one is left alone. After it the element is dead. */
|
|
238
|
+
destroy(): void;
|
|
222
239
|
/** Style-class proxy — read `el.class.checked`, set `el.class.checked = true`, toggle with
|
|
223
240
|
* `!el.class.checked`, bind `el.class.done = () => sig.value`, batch/chain `el.class({ … })`.
|
|
224
241
|
* Classes cascade to descendants. See {@link Classes}. */
|
|
@@ -234,24 +251,14 @@ export interface UIContainerBase<S extends object, A extends object = S> extends
|
|
|
234
251
|
remove(...nodes: UINodeChild[]): this;
|
|
235
252
|
/** Replace all children — an array, or a function for reactive children. */
|
|
236
253
|
setContent(nodes: UINodeChild[] | ChildrenFn): this;
|
|
237
|
-
/** The children
|
|
238
|
-
readonly children:
|
|
254
|
+
/** The children — a SNAPSHOT read from the runtime; mutate via `append`/`insert`/`remove`/`setContent`. */
|
|
255
|
+
readonly children: UINode[];
|
|
239
256
|
}
|
|
240
|
-
|
|
241
|
-
* `$`-class, keyed by device orientation instead of `el.class`). Same full-`T` rule as class
|
|
242
|
-
* blocks. */
|
|
243
|
-
export type OrientationStyles<T> = {
|
|
244
|
-
onLandscape?: T;
|
|
245
|
-
onPortrait?: T;
|
|
246
|
-
/** @deprecated Misspelling of `onPortrait` (no second "r"). Kept so existing projects and published
|
|
247
|
-
* bundles keep working — hosts still honour it — but new code should use `onPortrait`. */
|
|
248
|
-
onPortait?: T;
|
|
249
|
-
};
|
|
250
|
-
export type StyleFn<R, T extends object> = ((style: Reactive<T> & OrientationStyles<T> & ClassStyles<T>) => R);
|
|
257
|
+
export type StyleFn<R, T extends object> = ((style: Reactive<T> & ClassStyles<T>) => R);
|
|
251
258
|
/** The `el.style` surface: callable — `.style({...})` merges and returns the element for
|
|
252
259
|
* chaining — and per-key readable/writable (`el.style.opacity = 0.5`; a `() => value` write
|
|
253
|
-
* installs a reactive binding). */
|
|
254
|
-
export type Style<R, T extends object> = StyleFn<R, T> & T &
|
|
260
|
+
* installs a reactive binding). Reads answer what the app set. */
|
|
261
|
+
export type Style<R, T extends object> = StyleFn<R, T> & T & ClassStyles<T>;
|
|
255
262
|
/** Style props of an animate bag: a single value (tween from the current value) or an array of
|
|
256
263
|
* KEYFRAMES (`opacity: [1, 0.3, 1]`, offsets via `times`). */
|
|
257
264
|
export type AnimateProps<T extends object> = {
|
|
@@ -290,17 +297,14 @@ export type BoundingClientRect = {
|
|
|
290
297
|
width: number;
|
|
291
298
|
height: number;
|
|
292
299
|
};
|
|
293
|
-
export declare class Element<T extends string> {
|
|
300
|
+
export declare class Element<T extends string> implements TreeElement {
|
|
294
301
|
readonly type: T;
|
|
295
|
-
|
|
296
|
-
* object so it never reaches the layout engine; the renderer reads it off the node. */
|
|
297
|
-
readonly name?: string;
|
|
298
|
-
protected _style: any;
|
|
299
|
-
protected _id: number;
|
|
302
|
+
private _name?;
|
|
300
303
|
protected _styleProxy: any;
|
|
301
|
-
protected _appear: any;
|
|
302
|
-
protected _disappear: any;
|
|
303
304
|
constructor(type: T, style: any);
|
|
305
|
+
get name(): string | undefined;
|
|
306
|
+
set name(value: string | undefined);
|
|
307
|
+
named(name: string): this;
|
|
304
308
|
get style(): any;
|
|
305
309
|
/** Tween to the target style and commit it (unless `commit: false` or looping — a loop is an
|
|
306
310
|
* effect, not a state change). A prop value may be an array of keyframes; meta keys
|
|
@@ -324,7 +328,9 @@ export declare class Element<T extends string> {
|
|
|
324
328
|
* Names are accepted with or without the leading `$`. A class set on an element CASCADES: it is
|
|
325
329
|
* also active on every descendant (their same-name `$` blocks light up), until the subtree's
|
|
326
330
|
* root — hosted screens/widgets don't inherit. Reads reflect only this element's own classes;
|
|
327
|
-
* there is no opt-out below an active ancestor. `Object.keys(el.class)` lists the active names.
|
|
331
|
+
* there is no opt-out below an active ancestor. `Object.keys(el.class)` lists the active names.
|
|
332
|
+
* The reserved classes (`$hovered` `$pressed` `$focused` `$landscape` `$portrait`) are the
|
|
333
|
+
* system's: writing one throws. */
|
|
328
334
|
get class(): any;
|
|
329
335
|
protected ll?: OnLayoutCallback[];
|
|
330
336
|
/** Observe layout: fires after every host layout pass with the parent-relative box. */
|
|
@@ -332,9 +338,14 @@ export declare class Element<T extends string> {
|
|
|
332
338
|
/** Absolute rect in device space — the space `UIWidget` positions in and touch events report
|
|
333
339
|
* `clientX`/`clientY` in — including scroll offsets, read live at call time (unlike `onLayout`,
|
|
334
340
|
* whose coordinates are parent-relative and go stale when an ancestor scrolls). `null` before
|
|
335
|
-
* the element is
|
|
341
|
+
* the element is laid out and on hosts without the read. Anchor popovers position-once
|
|
336
342
|
* at open; don't poll per frame. */
|
|
337
343
|
getBoundingClientRect(): BoundingClientRect | null;
|
|
344
|
+
/** The parent element, or `null`. Resolves while the parent is itself attached (mounted under a
|
|
345
|
+
* presented / router-held screen, a shown widget, a pager page …); a loose subtree's root is
|
|
346
|
+
* held only by its handle and is not findable from its children. */
|
|
347
|
+
get parent(): any;
|
|
348
|
+
destroy(): void;
|
|
338
349
|
}
|
|
339
350
|
/** Reactive children: re-runs when a signal it read changes; the result is reconciled against
|
|
340
351
|
* the mounted children (kept nodes stay mounted, state intact). */
|
|
@@ -349,14 +360,17 @@ export type ChildrenFn = () => UINodeChild[];
|
|
|
349
360
|
*/
|
|
350
361
|
export declare function __uiMap(list: any, render: (item: any, index: number) => any, slot: string): any[];
|
|
351
362
|
export declare class ContainerElement<T extends string> extends Element<T> {
|
|
352
|
-
children: any[];
|
|
353
363
|
constructor(type: T, style: any, children: any[] | ChildrenFn);
|
|
354
|
-
/**
|
|
364
|
+
/** The children — a snapshot read from the runtime (falsy entries were never mounted). */
|
|
365
|
+
get children(): any[];
|
|
366
|
+
private _insertAt;
|
|
367
|
+
/** Append children (falsy entries are skipped). */
|
|
355
368
|
append(...nodes: UINodeChild[]): this;
|
|
356
|
-
/** Insert children at `index
|
|
369
|
+
/** Insert children at `index`. */
|
|
357
370
|
insert(index: number, ...nodes: UINodeChild[]): this;
|
|
358
|
-
/** Remove (unmount) the given children.
|
|
359
|
-
|
|
371
|
+
/** Remove (unmount) the given children. The removed subtrees stay valid (re-appendable) as long
|
|
372
|
+
* as you hold them; dropped ones are freed. */
|
|
373
|
+
remove(...nodesToDelete: UINodeChild[]): this;
|
|
360
374
|
/** Replace all children — a plain array, or a function for reactive children. */
|
|
361
375
|
setContent(children: UINodeChild[] | ChildrenFn): this;
|
|
362
376
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ContainerElement, type BaseStyle, type ChildrenFn, type DrawableStyle, type ElementStyle, type UIElementBase, type UINodeChild } from "./UINode";
|
|
2
2
|
import type { UIScreen } from "./UIScreen";
|
|
3
|
+
import type { NavigateOptions, PopOptions } from "./router";
|
|
3
4
|
/** Styles a pager accepts — layout box + drawable (background, borders, …). Pages style
|
|
4
5
|
* themselves; the pager only owns its own slot. */
|
|
5
6
|
export type UIPagerStyle = ElementStyle & DrawableStyle;
|
|
@@ -33,17 +34,21 @@ export interface UIPager extends UIElementBase<UIPagerStyle, DrawableStyle & Bas
|
|
|
33
34
|
readonly index: number;
|
|
34
35
|
/** Fires when the selected tab changes and has settled — a user swipe or `select()`. */
|
|
35
36
|
onSelect(callback: (index: number) => void): this;
|
|
36
|
-
/** Push `screen` on top of the **current tab
|
|
37
|
-
*
|
|
38
|
-
|
|
37
|
+
/** Push `screen` on top of the **current tab**; the edge back-swipe (or `pop()`) removes it.
|
|
38
|
+
* Other tabs are unaffected. Transitions as in `Router.push`: `"push"` unless one is named, and
|
|
39
|
+
* the screen remembers its way back (`popTransition`, or the mirror of the way it came). */
|
|
40
|
+
push(screen: UIScreen, opts?: NavigateOptions): this;
|
|
39
41
|
/** Pop the current tab's top screen (no-op at the tab root — the root never pops). The
|
|
40
|
-
* programmatic twin of the native edge back-swipe.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
* programmatic twin of the native edge back-swipe. Plays the way back the screen remembers
|
|
43
|
+
* unless a transition is named. */
|
|
44
|
+
pop(opts?: PopOptions): this;
|
|
45
|
+
/** Unwind the current tab back to its root screen in one step: the top screen leaves with its
|
|
46
|
+
* way back (or the named transition), the ones between are never shown. */
|
|
47
|
+
popToRoot(opts?: PopOptions): this;
|
|
44
48
|
/** Swap the current tab's top screen for `screen` without growing the stack (at depth 1 this
|
|
45
|
-
* swaps the tab's root).
|
|
46
|
-
|
|
49
|
+
* swaps the tab's root). `"fade"` unless a transition is named; the way back stays the one of
|
|
50
|
+
* the place in the stack unless `popTransition` names another. */
|
|
51
|
+
replace(screen: UIScreen, opts?: NavigateOptions): this;
|
|
47
52
|
/** The current tab's screens, root → top (read-only snapshot). */
|
|
48
53
|
readonly stack: UIScreen[];
|
|
49
54
|
/** The current tab's stack depth — 1 means only the root. While `depth > 1`, swiping between
|
|
@@ -51,37 +56,35 @@ export interface UIPager extends UIElementBase<UIPagerStyle, DrawableStyle & Bas
|
|
|
51
56
|
readonly depth: number;
|
|
52
57
|
/** Fires when the current tab's depth changes — push, pop, replace, or a back-swipe. */
|
|
53
58
|
onChange(callback: (depth: number) => void): this;
|
|
59
|
+
/** The pages, tab-major (every tab's stack root → top). */
|
|
60
|
+
readonly children: UIScreen[];
|
|
54
61
|
}
|
|
55
62
|
export declare class PagerElement extends ContainerElement<"pager"> {
|
|
56
|
-
/** Per-tab stack lengths — partitions the flat tab-major `children`. Named `_*` so chisel
|
|
57
|
-
* keeps it (the host reads it live). */
|
|
58
|
-
_lens: number[];
|
|
59
|
-
/** Selected tab. */
|
|
60
|
-
_index: number;
|
|
61
63
|
_openCount: number;
|
|
62
64
|
private scl;
|
|
63
65
|
private ncl;
|
|
64
66
|
constructor(style: UIPagerStyle | null, tabs: UIScreen[]);
|
|
65
|
-
/** Start offset of tab `i`'s segment in the flat `
|
|
67
|
+
/** Start offset of tab `i`'s segment in the flat `_pages`. */
|
|
66
68
|
private _offset;
|
|
69
|
+
/** Push the whole picture to the runtime. */
|
|
70
|
+
private _sync;
|
|
71
|
+
get children(): any[];
|
|
67
72
|
get index(): number;
|
|
68
73
|
get stack(): UIScreen[];
|
|
69
74
|
get depth(): number;
|
|
70
75
|
onSelect(callback: (index: number) => void): this;
|
|
71
76
|
onChange(callback: (depth: number) => void): this;
|
|
72
77
|
select(index: number, animated?: boolean): this;
|
|
73
|
-
push(screen: UIScreen): this;
|
|
74
|
-
pop(): this;
|
|
75
|
-
popToRoot(): this;
|
|
76
|
-
replace(screen: UIScreen): this;
|
|
78
|
+
push(screen: UIScreen, opts?: NavigateOptions): this;
|
|
79
|
+
pop(opts?: PopOptions): this;
|
|
80
|
+
popToRoot(opts?: PopOptions): this;
|
|
81
|
+
replace(screen: UIScreen, opts?: NavigateOptions): this;
|
|
77
82
|
private _rebuild;
|
|
78
83
|
setContent(children: UINodeChild[] | ChildrenFn): this;
|
|
79
84
|
append(...nodes: UINodeChild[]): this;
|
|
80
85
|
insert(index: number, ...nodes: UINodeChild[]): this;
|
|
81
|
-
remove(...nodesToDelete:
|
|
86
|
+
remove(...nodesToDelete: UINodeChild[]): this;
|
|
82
87
|
_reconcile(next: UINodeChild[]): void;
|
|
83
|
-
_hostDidSelect(index: number): void;
|
|
84
|
-
_hostDidPop(depth: number): void;
|
|
85
88
|
private _emitSelect;
|
|
86
89
|
private _emitChange;
|
|
87
90
|
private _track;
|
|
@@ -96,20 +99,18 @@ interface UIPagerConstructor {
|
|
|
96
99
|
* swiping); several → swipeable sibling tabs, fixed at construction, each starting as its own
|
|
97
100
|
* one-screen stack. */
|
|
98
101
|
(...tabs: (UIScreen | UIScreen[] | false | null | undefined)[]): UIPager;
|
|
99
|
-
/** @deprecated Style as the first argument is legacy — use chained `.style({...})`. */
|
|
100
|
-
(style: UIPagerStyle, content?: UIScreen | UIScreen[]): UIPager;
|
|
101
102
|
/** The pager that owns the currently visible screen, or `null` when the visible screen isn't
|
|
102
103
|
* hosted by one. With pagers nested inside pages, resolves to the **innermost** — so ambient
|
|
103
104
|
* calls act on the pager the user is actually looking at. */
|
|
104
105
|
readonly current: UIPager | null;
|
|
105
106
|
/** `UIPager.current.push(screen)` — push onto the pager owning the visible screen, no
|
|
106
107
|
* reference threading. No-op with a console warning when there is no current pager. */
|
|
107
|
-
push(screen: UIScreen): void;
|
|
108
|
+
push(screen: UIScreen, opts?: NavigateOptions): void;
|
|
108
109
|
/** `UIPager.current.pop()` — pop the visible pager's current tab (no-op at the tab root, or
|
|
109
110
|
* with a warning when there is no current pager). */
|
|
110
|
-
pop(): void;
|
|
111
|
+
pop(opts?: PopOptions): void;
|
|
111
112
|
/** `UIPager.current.popToRoot()` — unwind the visible pager's current tab to its root. */
|
|
112
|
-
popToRoot(): void;
|
|
113
|
+
popToRoot(opts?: PopOptions): void;
|
|
113
114
|
}
|
|
114
115
|
/**
|
|
115
116
|
* Create a pager — THE screen-navigation element: an array of screens becomes swipeable sibling
|
|
@@ -35,5 +35,3 @@ export declare class PopoverElement extends ModalElement {
|
|
|
35
35
|
* `show(anchor)` next to an element or `{x, y}` point. Same argument forms as `UIColumn`. */
|
|
36
36
|
export declare function UIPopover(...children: UIChildArg[]): UIPopover;
|
|
37
37
|
export declare function UIPopover(children: UINodeChild[] | ChildrenFn): UIPopover;
|
|
38
|
-
/** @deprecated Style as the first argument is legacy — use chained `.style({...})`. */
|
|
39
|
-
export declare function UIPopover(style: UIPopoverStyle, children?: UINodeChild[] | ChildrenFn): UIPopover;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TouchStartEvent } from "../runtime/touch";
|
|
2
|
-
import { type PresentOptions } from "./presentable";
|
|
2
|
+
import { type DismissOptions, type PresentOptions } from "./presentable";
|
|
3
3
|
import { ContainerElement, type BaseStyle, type ContainerStyle, type DrawableStyle, type PaddingStyle, type UIChildArg, type UIContainerBase, type UINodeChild, type ChildrenFn } from "./UINode";
|
|
4
4
|
export type UIScreenStyle = ContainerStyle & DrawableStyle & PaddingStyle & BaseStyle;
|
|
5
5
|
/** A screen — the root the router/host mounts, sized to its slot. A screen NEVER scrolls: it is
|
|
@@ -12,46 +12,41 @@ export interface UIScreen extends UIContainerBase<UIScreenStyle, DrawableStyle &
|
|
|
12
12
|
* scene, a native view — suspending an active Router until `Router.restore()`). */
|
|
13
13
|
open(options?: PresentOptions): void;
|
|
14
14
|
/** Dismiss if this screen is the visible destination. */
|
|
15
|
-
close(): void;
|
|
15
|
+
close(options?: DismissOptions): void;
|
|
16
16
|
/** Hardware/system back while this screen is current. */
|
|
17
|
+
onBack(callback: () => void): this;
|
|
18
|
+
/** @deprecated Renamed `onBack` (2026-09-26). An alias for the projects compiled before the
|
|
19
|
+
* rename; removed with the release that recompiles them. */
|
|
17
20
|
onBackPressed(callback: () => void): this;
|
|
18
21
|
/** The screen became the visible destination (first open, or revealed by a pop). */
|
|
19
22
|
onOpen(callback: () => void): this;
|
|
20
23
|
/** The screen stopped being visible — closed, replaced, or covered by a push. */
|
|
21
24
|
onClose(callback: () => void): this;
|
|
22
25
|
/**
|
|
23
|
-
* Keep this screen's
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* detach/re-attach. You own the lifetime — a kept tree is freed only by `dispose()` or when the
|
|
27
|
-
* project unloads. (Native-only today; web rebuilds.)
|
|
26
|
+
* Keep this screen's native state when a pager releases it: instead of dropping its view, the
|
|
27
|
+
* host keeps it (scroll position, input text), so re-pushing the SAME screen object restores it
|
|
28
|
+
* in place. `onClose`/`onOpen` still fire on detach/re-attach. Free it with `destroy()`.
|
|
28
29
|
*/
|
|
29
30
|
keepAlive(enabled?: boolean): this;
|
|
30
|
-
/** Free a `keepAlive()` screen's retained tree now. No-op unless it's currently detached-and-kept. */
|
|
31
|
-
dispose(): this;
|
|
32
31
|
/** Touch began on the screen; `ev.track(...)` takes over the rest of the gesture. */
|
|
33
32
|
onTouchStart(callback: (ev: TouchStartEvent<UIScreen>) => void): this;
|
|
34
33
|
}
|
|
35
34
|
export declare class ScreenElement extends ContainerElement<"screen"> {
|
|
36
35
|
open(options?: PresentOptions): void;
|
|
37
|
-
close(): void;
|
|
36
|
+
close(options?: DismissOptions): void;
|
|
38
37
|
protected ol: (() => void)[];
|
|
39
38
|
onOpen(callback: () => void): this;
|
|
40
39
|
protected cl: (() => void)[];
|
|
41
40
|
onClose(callback: () => void): this;
|
|
42
|
-
_keepAlive: boolean;
|
|
43
41
|
keepAlive(enabled?: boolean): this;
|
|
44
|
-
dispose(): this;
|
|
45
42
|
readonly touchStartListeners: any[];
|
|
46
|
-
_interactive: boolean;
|
|
47
43
|
onTouchStart(callback: any): this;
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
private _backButtonCallback?;
|
|
45
|
+
onBack(callback: any): this;
|
|
46
|
+
/** @deprecated see the interface */
|
|
50
47
|
onBackPressed(callback: any): this;
|
|
51
48
|
}
|
|
52
49
|
/** Create a screen. Present it with `.open()`, or via `Router` / `UIPager`. Same argument forms
|
|
53
50
|
* as `UIColumn`. */
|
|
54
51
|
export declare function UIScreen(...children: UIChildArg[]): UIScreen;
|
|
55
52
|
export declare function UIScreen(children: UINodeChild[] | ChildrenFn): UIScreen;
|
|
56
|
-
/** @deprecated Style as the first argument is legacy — use chained `.style({...})`. */
|
|
57
|
-
export declare function UIScreen(style: UIScreenStyle, children?: UINodeChild[] | ChildrenFn): UIScreen;
|
|
@@ -28,13 +28,10 @@ export interface UIScrollable extends UIContainerBase<UIScrollableStyle> {
|
|
|
28
28
|
onScrollRelease(callback: () => void): UIScrollable;
|
|
29
29
|
/** Pulled past the content edge by `delta` px. */
|
|
30
30
|
onOverscroll(callback: (delta: number) => void): UIScrollable;
|
|
31
|
-
/** Pull-to-refresh: the spinner stays until the returned promise settles.
|
|
32
|
-
* node mounts (hosts read it at creation). Vertical only; native hosts — no-op on web. */
|
|
31
|
+
/** Pull-to-refresh: the spinner stays until the returned promise settles. Vertical only. */
|
|
33
32
|
onRefresh(callback: () => void | Promise<void>): UIScrollable;
|
|
34
33
|
}
|
|
35
34
|
/** Create a scroll container (same argument forms as `UIColumn`). As a screen body, pair with
|
|
36
35
|
* `flexGrow: 1`. */
|
|
37
36
|
export declare function UIScrollable(...children: UIChildArg[]): UIScrollable;
|
|
38
37
|
export declare function UIScrollable(children: UINodeChild[] | ChildrenFn): UIScrollable;
|
|
39
|
-
/** @deprecated Style as the first argument is legacy — use chained `.style({...})`. */
|
|
40
|
-
export declare function UIScrollable(style: UIScrollableStyle, children?: UINodeChild[] | ChildrenFn): UIScrollable;
|
|
@@ -15,5 +15,3 @@ export declare class TextElement extends Element<"text"> {
|
|
|
15
15
|
/** Create a text label — a string, or `() => string` for reactive text that re-renders when a
|
|
16
16
|
* signal it read changes. */
|
|
17
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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { VideoPlayer } from "../runtime/media";
|
|
2
|
-
import { type PresentOptions } from "./presentable";
|
|
2
|
+
import { type DismissOptions, type PresentOptions } from "./presentable";
|
|
3
3
|
import { type BaseStyle, type DrawableStyle, type ElementStyle, type UIElementBase } from "./UINode";
|
|
4
4
|
export type UIVideoStyle = ElementStyle & DrawableStyle & {
|
|
5
5
|
objectFit?: "cover" | "contain" | "fill";
|
|
@@ -14,15 +14,13 @@ export interface UIVideo extends UIElementBase<UIVideoStyle, DrawableStyle & Bas
|
|
|
14
14
|
* the SAME native player moves fullscreen — playback uninterrupted; a pop moves it back. */
|
|
15
15
|
open(options?: PresentOptions): void;
|
|
16
16
|
/** Dismiss if this is the visible destination. */
|
|
17
|
-
close(): void;
|
|
17
|
+
close(options?: DismissOptions): void;
|
|
18
18
|
/** Became the visible destination. */
|
|
19
19
|
onOpen(callback: () => void): this;
|
|
20
20
|
/** Stopped being the visible destination. */
|
|
21
21
|
onClose(callback: () => void): this;
|
|
22
22
|
/** Hardware/system back while current. */
|
|
23
|
-
|
|
23
|
+
onBack(callback: () => void): this;
|
|
24
24
|
}
|
|
25
25
|
/** Create a video node showing `player`'s output. */
|
|
26
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;
|
|
@@ -26,11 +26,11 @@ export interface VListConfig<T> {
|
|
|
26
26
|
* and chats. Items are keyed; feed it via `setData`/`append`/`prepend`. */
|
|
27
27
|
export interface UIVirtualizedList<T = unknown> extends UIElementBase<UIVirtualizedListStyle> {
|
|
28
28
|
readonly type: "vlist";
|
|
29
|
-
/** Replace the data wholesale — vanished keys are unmounted by the
|
|
29
|
+
/** Replace the data wholesale — vanished keys are unmounted by the window sync. */
|
|
30
30
|
setData(items: T[]): this;
|
|
31
31
|
/** Append items to the end (auto-scrolls when `inverted` and resting at the bottom). */
|
|
32
32
|
append(...items: T[]): this;
|
|
33
|
-
/** Insert at the start WITHOUT a scroll jump (the
|
|
33
|
+
/** Insert at the start WITHOUT a scroll jump (the runtime compensates the offset). */
|
|
34
34
|
prepend(...items: T[]): this;
|
|
35
35
|
/** Update items with the same keys: mounted ones re-render; the cached height persists until
|
|
36
36
|
* re-measured. */
|
|
@@ -49,32 +49,31 @@ export interface UIVirtualizedList<T = unknown> extends UIElementBase<UIVirtuali
|
|
|
49
49
|
scrollToEnd(animated?: boolean): void;
|
|
50
50
|
/** Scroll position changed (px from the start edge). */
|
|
51
51
|
onScroll(callback: (scrollPosition: number) => void): this;
|
|
52
|
-
/** Pull-to-refresh: the spinner stays until the returned promise settles.
|
|
53
|
-
* node mounts (hosts read it at creation). Native hosts only — no-op on web. */
|
|
52
|
+
/** Pull-to-refresh: the spinner stays until the returned promise settles. */
|
|
54
53
|
onRefresh(callback: () => void | Promise<void>): this;
|
|
55
54
|
/** Fires within `thresholdPx` of the content's bottom edge — once, re-armed after leaving the
|
|
56
|
-
* edge (
|
|
55
|
+
* edge (a runtime-side latch). Infinite-scroll loading. */
|
|
57
56
|
onEndReached(thresholdPx: number, callback: () => void): this;
|
|
58
57
|
/** Same, for the top edge — chat history loading. */
|
|
59
58
|
onStartReached(thresholdPx: number, callback: () => void): this;
|
|
60
59
|
}
|
|
61
60
|
export declare class VListElement<T> extends Element<"vlist"> implements UIVirtualizedList<T> {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
_endThreshold: number;
|
|
67
|
-
_startThreshold: number;
|
|
68
|
-
protected sl: ((scrollPosition: number) => void)[];
|
|
69
|
-
protected erl: (() => void)[];
|
|
70
|
-
protected strl: (() => void)[];
|
|
61
|
+
private readonly sl;
|
|
62
|
+
private readonly erl;
|
|
63
|
+
private readonly strl;
|
|
64
|
+
private _refreshCallback?;
|
|
71
65
|
private items;
|
|
72
66
|
private mounted;
|
|
73
67
|
private keyOf;
|
|
74
68
|
private renderItem;
|
|
75
69
|
private estimate;
|
|
70
|
+
private readonly _overscan;
|
|
71
|
+
private readonly _inverted;
|
|
72
|
+
private _endThreshold;
|
|
73
|
+
private _startThreshold;
|
|
74
|
+
private _inited;
|
|
76
75
|
constructor(config: VListConfig<T>);
|
|
77
|
-
private
|
|
76
|
+
private _ensure;
|
|
78
77
|
private register;
|
|
79
78
|
setData(items: T[]): this;
|
|
80
79
|
append(...items: T[]): this;
|
|
@@ -87,7 +86,6 @@ export declare class VListElement<T> extends Element<"vlist"> implements UIVirtu
|
|
|
87
86
|
scrollToKey(key: string, animated?: boolean): void;
|
|
88
87
|
scrollToEnd(animated?: boolean): void;
|
|
89
88
|
onScroll(callback: (scrollPosition: number) => void): this;
|
|
90
|
-
_refreshCallback: any;
|
|
91
89
|
onRefresh(callback: () => void | Promise<void>): this;
|
|
92
90
|
onEndReached(thresholdPx: number, callback: () => void): this;
|
|
93
91
|
onStartReached(thresholdPx: number, callback: () => void): this;
|
|
@@ -20,8 +20,7 @@ export interface UIWidget extends UIContainerBase<UIWidgetStyle, DrawableStyle &
|
|
|
20
20
|
* (= back to a global overlay). Set it while the widget is hidden. The widget is always its own
|
|
21
21
|
* overlay root mounted into the owner's page view — it never becomes a child of the owner, so it
|
|
22
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.
|
|
24
|
-
* and hides it with the owner but does not yet ride the transition.)
|
|
23
|
+
* is a page inside a `UIPager`: the widget mounts into that tab and rides its swipe.
|
|
25
24
|
*/
|
|
26
25
|
attachTo(owner: Presentable | null): this;
|
|
27
26
|
/** Show the widget. By default it is a global overlay above every destination — it stays
|
|
@@ -32,34 +31,36 @@ export interface UIWidget extends UIContainerBase<UIWidgetStyle, DrawableStyle &
|
|
|
32
31
|
/** Unmount the widget. */
|
|
33
32
|
hide(): void;
|
|
34
33
|
/** Mounted right now (`show()` ran, `hide()` hasn't). */
|
|
35
|
-
readonly
|
|
34
|
+
readonly isShown: boolean;
|
|
36
35
|
/** Touch began on the widget; `ev.track(...)` takes over the rest of the gesture. */
|
|
37
36
|
onTouchStart(callback: (ev: TouchStartEvent<UIWidget>) => void): this;
|
|
38
37
|
/** Tap on the overlay layer (requires an `overlayColor`). */
|
|
39
38
|
onOverlayTap(callback: () => void): this;
|
|
40
39
|
/** Hardware/system back while the widget is shown. */
|
|
40
|
+
onBack(callback: () => void): this;
|
|
41
|
+
/** @deprecated Renamed `onBack` (2026-09-26). An alias for the projects compiled before the
|
|
42
|
+
* rename; removed with the release that recompiles them. */
|
|
41
43
|
onBackPressed(callback: () => void): this;
|
|
42
44
|
}
|
|
43
45
|
export declare class WidgetElement extends ContainerElement<"widget"> {
|
|
44
46
|
scrollable: false;
|
|
45
47
|
_owner?: Presentable;
|
|
48
|
+
private _shown;
|
|
46
49
|
constructor(type: "widget", style: UIWidgetStyle, children: UINodeChild[] | ChildrenFn);
|
|
47
50
|
attachTo(owner: Presentable | null): this;
|
|
48
51
|
show(): void;
|
|
49
52
|
hide(): void;
|
|
50
|
-
get
|
|
51
|
-
_interactive: boolean;
|
|
53
|
+
get isShown(): boolean;
|
|
52
54
|
readonly touchStartListeners: any[];
|
|
53
55
|
onTouchStart(callback: any): this;
|
|
54
|
-
_emitTouchStart(pointerId: number, clientX: number, clientY: number): any;
|
|
55
56
|
readonly otl: (() => void)[];
|
|
56
57
|
onOverlayTap(callback: () => void): this;
|
|
57
|
-
_backButtonCallback
|
|
58
|
+
private _backButtonCallback?;
|
|
59
|
+
onBack(callback: any): this;
|
|
60
|
+
/** @deprecated see the interface */
|
|
58
61
|
onBackPressed(callback: any): this;
|
|
59
62
|
}
|
|
60
63
|
/** Create a widget (same argument forms as `UIColumn`). Position it with absolute-style props
|
|
61
64
|
* (`top`/`left`/`bottom`/`right`), then `show()`/`hide()`. */
|
|
62
65
|
export declare function UIWidget(...children: UIChildArg[]): UIWidget;
|
|
63
66
|
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
|
+
/** The keys whose value IS a color — every color property with its aliases: normalize the value
|
|
2
|
+
* to '#rrggbbaa'. Pass-throughs: null / undefined (a reset), any string containing "var(" (the
|
|
3
|
+
* core resolves theme vars), rippleColor's "default" (a core keyword). */
|
|
4
|
+
export declare const COLOR_KEYS: ReadonlySet<string>;
|
|
5
|
+
/** The shorthands that expand into a color property. A color is only ONE of their value forms:
|
|
6
|
+
* never normalize the value whole — "2px solid red", a gradient or an image path go to the core
|
|
7
|
+
* raw (its shorthand parsers read the colors inside with the same grammar), a number on
|
|
8
|
+
* `border*` is a WIDTH; only a number / color array on `background` is a color. */
|
|
9
|
+
export declare const COLOR_SHORTHAND_KEYS: ReadonlySet<string>;
|