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
|
@@ -6,8 +6,9 @@ import type { WarpOptions } from "./Warp";
|
|
|
6
6
|
import type { Node } from "../Node";
|
|
7
7
|
/** How fast the character wants to go: the gait picks its clips and its speed. */
|
|
8
8
|
export type Gait = "walk" | "run" | "sprint";
|
|
9
|
-
/** What the engine shows: the idle, a start, the gait loop, a turn while moving, a stop,
|
|
10
|
-
|
|
9
|
+
/** What the engine shows: the idle, a start, the gait loop, a turn while moving, a stop, a turn on the spot —
|
|
10
|
+
* an ACTION (`act()`): a one-shot that owns the body until it hands over — or the STRAFE blend (`move({ strafe })`). */
|
|
11
|
+
export type LocomotionState = "idle" | "start" | "move" | "turn" | "stop" | "spin" | "action" | "strafe";
|
|
11
12
|
/** Who moves the body:
|
|
12
13
|
* `'hybrid'` (the default) — the clip's own recorded motion moves it; while the gait loop shows it
|
|
13
14
|
* is ADJUSTED toward what the simulation wants by at most `tuning.adjust` metres a second, and a
|
|
@@ -42,6 +43,10 @@ export type LocomotionSet = {
|
|
|
42
43
|
turns?: LocomotionClip[];
|
|
43
44
|
/** turns on the spot — what a facing still owed by a standing body plays */
|
|
44
45
|
spins?: LocomotionClip[];
|
|
46
|
+
/** the STRAFE set: the same gait recorded forward, backward, to either side and on the diagonals — the members of
|
|
47
|
+
* the directional blend `move(dir, { face, strafe: true })` shows. `angle` = the way a take travels in the body's
|
|
48
|
+
* frame (degrees, + = left); left out, the engine reads it off the take's root. */
|
|
49
|
+
strafes?: LocomotionClip[];
|
|
45
50
|
};
|
|
46
51
|
/** The tuning. Times are seconds, speeds m/s, angles degrees. */
|
|
47
52
|
export type LocomotionTuning = {
|
|
@@ -199,6 +204,8 @@ export declare class Locomotion extends Aspect<"loco", Node, LocomotionEvents> {
|
|
|
199
204
|
private _mag;
|
|
200
205
|
private _gait;
|
|
201
206
|
private _seq;
|
|
207
|
+
private _act;
|
|
208
|
+
private _strafe;
|
|
202
209
|
private readonly _in;
|
|
203
210
|
private readonly _out;
|
|
204
211
|
private readonly _names;
|
|
@@ -225,11 +232,60 @@ export declare class Locomotion extends Aspect<"loco", Node, LocomotionEvents> {
|
|
|
225
232
|
/** State the movement intent for this frame: a world direction (its length is the stick's pull,
|
|
226
233
|
* clamped to 1) and the gait. `null` = no movement — the body stops, but it keeps facing where it
|
|
227
234
|
* was last asked to, and turns there on the spot if it still owes the turn.
|
|
228
|
-
* `face` states a facing of its own (aiming,
|
|
235
|
+
* `face` states a facing of its own (aiming, a camera-relative shooter) — and with `strafe: true` the body MOVES
|
|
236
|
+
* where the direction points while it faces there: the loop becomes the directional blend of `set.strafes` (a
|
|
237
|
+
* guard, a lock-on), the facing is steered standing too, state `'strafe'`. Stated every frame like the rest. */
|
|
229
238
|
move(direction: Vec3Like | null | undefined, options?: {
|
|
230
239
|
gait?: Gait;
|
|
231
240
|
face?: Vec3Like;
|
|
241
|
+
strafe?: boolean;
|
|
232
242
|
}): void;
|
|
243
|
+
/** Play an ACTION: a one-shot that OWNS the body the way a start or a stop does — a roll, a backstep, a lunging
|
|
244
|
+
* attack. Its recording moves the body alone (in every displacement mode but `'data'`, where the host does),
|
|
245
|
+
* the steering and the selector stand by, and when it hands over the usual rules carry on: a direction held
|
|
246
|
+
* starts (or, still carrying speed, runs on), nothing held stands.
|
|
247
|
+
*
|
|
248
|
+
* `direction` is where its TRAVEL must go, world (`Vec3`, or a heading in degrees, 0 = +Z, + = toward +X). A
|
|
249
|
+
* clip travels some way relative to the body — forward, left, back; measured off its own root, or `angle`
|
|
250
|
+
* (degrees, + = left) — and the body is turned by what is left between that and `direction`, over `turn`
|
|
251
|
+
* seconds (default 0.12), so the travel lands exactly where it was pointed. Which clip to play is yours to
|
|
252
|
+
* pick: the one whose travel is nearest the direction IN THE BODY'S FRAME (`direction − facing`) leaves the
|
|
253
|
+
* least to turn. Left out = it plays where the body faces.
|
|
254
|
+
*
|
|
255
|
+
* `at` enters the clip that many seconds in (a wind-up skipped), `rate` plays it faster or slower (its metres
|
|
256
|
+
* stay, the time changes), `travel` takes only that share of its recorded travel (an attack aimed at a target:
|
|
257
|
+
* 0.3 to stop at the blade's length from one that is close, 1.3 to reach one a step too far — the pose is
|
|
258
|
+
* untouched, so keep it to a fast step; `{ share, at, after }` takes another share from clip time `at` on: a
|
|
259
|
+
* swing's take travels on after its cut, into a body that stands at the blade's length), `dash` THROWS the body
|
|
260
|
+
* `distance` metres along the action's direction on top of that, inside `time` seconds (default 0.12) from its first
|
|
261
|
+
* step, eased out — the gap to a target closed in the wind-up, the blow struck from where it lands (scaling a take's
|
|
262
|
+
* own step is a slide stretched over the whole swing), `fade` is the transition into it and `out` the one out of it (default: the tuning's
|
|
263
|
+
* `blend`; an action ends in ITS stance, not the idle's, and a longer way out is what hides that), and `exit` is the
|
|
264
|
+
* clip time from which a MOVE intent may take over — the cancel window: along the way the body faces at once, a
|
|
265
|
+
* heading that needs a turn as soon as the body has slowed to where a start can answer; with nothing asked for it plays out, to
|
|
266
|
+
* its end (an action ends in its own recovery, at rest), and the body then STANDS THE WAY THE ACTION LEFT IT:
|
|
267
|
+
* the facing intent that outlives a released key is not a demand after an action — no turn on the spot.
|
|
268
|
+
* WHEN an action may be asked for (out of another one, out of a start) is the caller's rule: this cuts into
|
|
269
|
+
* whatever shows. `state` reads `'action'` while it does. False = no such clip. */
|
|
270
|
+
act(clip: string, options?: {
|
|
271
|
+
direction?: Vec3Like | number;
|
|
272
|
+
angle?: number;
|
|
273
|
+
turn?: number;
|
|
274
|
+
at?: number;
|
|
275
|
+
exit?: number;
|
|
276
|
+
fade?: number;
|
|
277
|
+
out?: number;
|
|
278
|
+
rate?: number;
|
|
279
|
+
travel?: number | {
|
|
280
|
+
share: number;
|
|
281
|
+
at: number;
|
|
282
|
+
after: number;
|
|
283
|
+
};
|
|
284
|
+
dash?: {
|
|
285
|
+
distance: number;
|
|
286
|
+
time?: number;
|
|
287
|
+
};
|
|
288
|
+
}): boolean;
|
|
233
289
|
/** Face this way without moving — the facing intent on its own (`Vec3`, or a heading in degrees,
|
|
234
290
|
* 0 = +Z, + = toward +X). A standing body turns to it on the spot. */
|
|
235
291
|
face(direction: Vec3Like | number): void;
|
|
@@ -176,6 +176,14 @@ export declare class Terrain {
|
|
|
176
176
|
heightAt(x: number, z: number): number;
|
|
177
177
|
/** The drawn triangle's normal at a local (x, z) (unit Vec3, +Y up). */
|
|
178
178
|
normalAt(x: number, z: number): Vec3;
|
|
179
|
+
/** The LAYER WEIGHTS at a local (x, z) — what the splat shader blends there: the control map read bilinearly
|
|
180
|
+
* between its samples and normalised to sum 1 (`[1, 0, 0, 0]` where the map is empty, as the shader has
|
|
181
|
+
* it). Index = the layer's in `layers`. Outside the grid the edge answers. This is how a game asks WHAT the
|
|
182
|
+
* ground is under a point — footprints in the sand and none on the cobble, a footstep sound per layer, dust
|
|
183
|
+
* by surface — and the blend is already in the numbers, so a transition is a fade and not a line. */
|
|
184
|
+
weightsAt(x: number, z: number): [number, number, number, number];
|
|
185
|
+
/** The heaviest layer's index at a local (x, z) — `weightsAt` when only "which one" is asked. */
|
|
186
|
+
layerAt(x: number, z: number): number;
|
|
179
187
|
/** The smooth (vertex) normal at integer sample (ix, iz). */
|
|
180
188
|
sampleNormal(ix: number, iz: number): Vec3;
|
|
181
189
|
/** Extent in local metres: `[width, depth]`. */
|
package/dist/types/inject.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export { Bus, REVERB_PRESETS, type ReverbPreset, type ReverbParams, type EchoPar
|
|
|
29
29
|
export { audio, type PlaySoundOptions, type SpatialOptions, type Rolloff, type AudioStats } from "./audio/audio";
|
|
30
30
|
export { openFilePicker, files, type FileData } from "./runtime/files";
|
|
31
31
|
export { share } from "./runtime/share";
|
|
32
|
-
export { ClickEvent, TouchStartEvent, LongPressEvent } from "./runtime/touch";
|
|
32
|
+
export { ClickEvent, TouchStartEvent, LongPressEvent, MouseEnterEvent } from "./runtime/touch";
|
|
33
33
|
export { Scene2D } from "./g2/Scene2D";
|
|
34
34
|
export { Node2D } from "./g2/Node2D";
|
|
35
35
|
export { Camera2D } from "./g2/Camera2D";
|
|
@@ -55,7 +55,7 @@ export { cells, encodeCells, type CellsData } from "./g2/cells";
|
|
|
55
55
|
export { CameraFollow } from "./g2/scenarios2d";
|
|
56
56
|
export { UIScreen, type UIScreenStyle, UIRow, UIColumn, UIBox, type UIContainerStyle, UIText, type UITextStyle, UIButton, type UIButtonStyle, UIImage, type UIImageStyle, UIVideo, type UIVideoStyle, UIInput, UITextArea, type UIInputStyle, UIScrollable, type UIScrollableStyle, UIPager, type UIPagerStyle, UITabs, type UITabDef, defineTabs, type TabDef, type TabsHandle, UIWidget, type UIWidgetStyle, UIModal, type UIModalStyle, UIBottomSheet, type UIBottomSheetStyle, UIPopover, type UIPopoverStyle, UISpacer, type UISpacerStyle, UIVirtualizedList, Router, NativeView, type UINativeViewStyle, registerFont, __uiMap, __UIColumn, __UIRow, __UIBox, __UIButton, __UIScreen, __UIScrollable, __UIWidget, } from "./ui/UI";
|
|
57
57
|
export { Presentable } from "./ui/UI";
|
|
58
|
-
export type { PresentOptions, Transition, TransitionName,
|
|
58
|
+
export type { DismissOptions, PresentOptions, Transition, TransitionName, TransitionPose, TransitionSpec } from "./ui/UI";
|
|
59
59
|
export type { UINode, UINodeChild } from "./ui/UINode";
|
|
60
60
|
export { theme, type ThemeValues, type ThemeAccessors } from "./ui/theme";
|
|
61
61
|
export { animate, type AnimateOptions, type AnimateValue, type AnimateOut } from "./animate/tween/animateValue";
|
|
@@ -65,25 +65,25 @@ export { type Animation } from "./animate/tween/Animation";
|
|
|
65
65
|
export { type TweenMeta } from "./animate/tween/spec";
|
|
66
66
|
export { type EasingInput } from "./animate/tween/easing";
|
|
67
67
|
export { easeIn, easeOut, easeInOut } from "./animate/easings";
|
|
68
|
-
export { QRScanner } from "./plugins/qr";
|
|
69
|
-
export { CameraView, type CameraFacing } from "./plugins/camera";
|
|
70
|
-
export { Geolocation, type GeoPosition, type GeoOptions, type GeoWatch } from "./plugins/geolocation";
|
|
71
|
-
export { MapView, type MapOptions, type MapStyle, type MapStyleName, type MapCamera, type MapTap, type LngLat, type CameraMove, type FitOptions, type MapPaddingValues, type MarkerItem, type MarkerTap, type MarkerLayer, type MarkerLayerOptions, type LineLayer, type LineLayerOptions, type UserLocationOptions, } from "./plugins/map";
|
|
72
|
-
export { Push, type PushPayload, type PushStatus, type PushRegisterOptions, type PushEvent } from "./plugins/push";
|
|
68
|
+
export { QRScanner } from "./plugins/gen/qr-scanner/sdk/qr-scanner";
|
|
69
|
+
export { CameraView, type CameraFacing } from "./plugins/gen/camera/sdk/camera";
|
|
70
|
+
export { Geolocation, type GeoPosition, type GeoOptions, type GeoWatch } from "./plugins/gen/geolocation/sdk/geolocation";
|
|
71
|
+
export { MapView, type MapOptions, type MapStyle, type MapStyleName, type MapCamera, type MapTap, type LngLat, type CameraMove, type FitOptions, type MapPaddingValues, type MarkerItem, type MarkerTap, type MarkerLayer, type MarkerLayerOptions, type LineLayer, type LineLayerOptions, type UserLocationOptions, } from "./plugins/gen/map/sdk/map";
|
|
72
|
+
export { Push, type PushPayload, type PushStatus, type PushRegisterOptions, type PushEvent } from "./plugins/gen/push/sdk/push";
|
|
73
73
|
export { OAuth, type OAuthCredential, type OAuthProviderName } from "./plugins/oauth";
|
|
74
74
|
export { Service } from "./plugins/service";
|
|
75
|
-
export { defineScene, use, ref, make, SceneHandle
|
|
76
|
-
export { defineMaterial, MaterialHandle
|
|
75
|
+
export { defineScene, use, ref, make, SceneHandle } from "./scene/defineScene";
|
|
76
|
+
export { defineMaterial, MaterialHandle } from "./scene/material";
|
|
77
77
|
export type { MaterialData, MaterialParamValue, ShaderMaterialDef, LitMaterialDef, UnlitMaterialDef } from "./scene/material";
|
|
78
78
|
export type { SceneDef, SceneNodeDef, MeshDef, LightDef, MaterialDef, CameraNodeDef, AspectEntry, MakeEntry, LoadedScene, SceneInstance } from "./scene/defineScene";
|
|
79
79
|
export { CameraPlace } from "./gl/CameraPlace";
|
|
80
80
|
export { Level } from "./scene/level";
|
|
81
81
|
export type { LevelSpot, LevelBuild, LevelCollider, LevelLineOptions, LevelGridOptions, LevelRingOptions, LevelScatterOptions, LevelPlaceOptions } from "./scene/level";
|
|
82
82
|
export type { FieldMeta } from "./core/fields";
|
|
83
|
-
export { Gizmos
|
|
83
|
+
export { Gizmos } from "./scene/gizmos";
|
|
84
84
|
export type { GizmoStyle, GizmoAnchor } from "./scene/gizmos";
|
|
85
85
|
export { MoveTo, FollowPath, Spin, LookAt, PlayAnimation } from "./gl/scenarios";
|
|
86
|
-
export { registerEditorWindow, registerEditorTool
|
|
86
|
+
export { registerEditorWindow, registerEditorTool } from "./scene/editorPlugins";
|
|
87
87
|
export type { EditorApi, EditorRayHit, EditorToolHooks, EditorWindowFn } from "./scene/editorPlugins";
|
|
88
88
|
export { Scene, ARScene, VRScene } from "./gl/Scene";
|
|
89
89
|
export { Node } from "./gl/Node";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { sceneEditor as __sceneEditor, type SceneEditorApi } from "./scene/editor";
|
package/dist/types/net/core.d.ts
CHANGED
|
@@ -25,6 +25,13 @@ export type NetLaunch = {
|
|
|
25
25
|
port: number;
|
|
26
26
|
maxClients: number;
|
|
27
27
|
};
|
|
28
|
+
/** Link statistics (`player.rtt` / `player.loss` read them): the bridge's `NetStats`. */
|
|
29
|
+
export type NetStats = {
|
|
30
|
+
rtt: number;
|
|
31
|
+
loss: number;
|
|
32
|
+
sentKbps: number;
|
|
33
|
+
receivedKbps: number;
|
|
34
|
+
};
|
|
28
35
|
export declare const CH_RELIABLE = 0;
|
|
29
36
|
export declare const CH_UNRELIABLE = 1;
|
|
30
37
|
export declare const PROTO = 2;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { File as HostFile } from "./runtime/fetch";
|
|
2
|
+
import { ServiceClient } from "./runtime/service";
|
|
3
|
+
import { NativeViewElement } from "./ui/NativeView";
|
|
4
|
+
export type { PresentOptions } from "./ui/presentable";
|
|
5
|
+
export type { NativeView } from "./ui/NativeView";
|
|
6
|
+
export type { FetchResponse } from "./runtime/fetch";
|
|
7
|
+
/** Signed 32-bit integer on the wire. */
|
|
8
|
+
export type i32 = number;
|
|
9
|
+
/** Double on the wire — also every integer that can leave 32 bits (a millisecond time stamp). */
|
|
10
|
+
export type f64 = number;
|
|
11
|
+
/** Bytes that STAY in the host's buffer table: the native half hands over its bytes + a name, the
|
|
12
|
+
* app gets the SDK's `File` handle (a texture source, a `FormData` value, a share) and the bytes
|
|
13
|
+
* never enter the JS heap. For bytes the app must read itself, a contract says `Uint8Array`. */
|
|
14
|
+
export type File = HostFile;
|
|
15
|
+
/** Any JSON value, opaque to the generator (GeoJSON, a developer's own payload): it crosses as is
|
|
16
|
+
* and the native half receives the platform's untyped value. */
|
|
17
|
+
export type Json = null | boolean | number | string | Json[] | {
|
|
18
|
+
[key: string]: Json;
|
|
19
|
+
};
|
|
20
|
+
declare const channel: unique symbol;
|
|
21
|
+
/** Marks a contract interface as a NativeView channel. `Name` is what the halves register under
|
|
22
|
+
* (`registerView(name)`); `Params` is what a factory receives; `Events` maps an event's name to
|
|
23
|
+
* its payload (`void` = no payload). */
|
|
24
|
+
export interface View<Name extends string, Params extends object = {}, Events extends object = {}> {
|
|
25
|
+
readonly [channel]?: {
|
|
26
|
+
kind: "view";
|
|
27
|
+
name: Name;
|
|
28
|
+
params: Params;
|
|
29
|
+
events: Events;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** Marks a contract interface as a headless Service channel — see {@link View}. */
|
|
33
|
+
export interface Service<Name extends string, Params extends object = {}, Events extends object = {}> {
|
|
34
|
+
readonly [channel]?: {
|
|
35
|
+
kind: "service";
|
|
36
|
+
name: Name;
|
|
37
|
+
params: Params;
|
|
38
|
+
events: Events;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** A listener of the event `K`: no argument for a `void` payload. */
|
|
42
|
+
export type Listener<Events, K extends keyof Events> = Events[K] extends void ? () => void : (payload: Events[K]) => void;
|
|
43
|
+
/** What an event's payload is read with when it is not on the wire what it is for the app (it
|
|
44
|
+
* holds a File): by the event's name. */
|
|
45
|
+
export type EventReaders = {
|
|
46
|
+
[event: string]: (wire: any) => any;
|
|
47
|
+
};
|
|
48
|
+
/** The element of a view plugin: a `NativeView` whose events are the contract's. Generated wrappers
|
|
49
|
+
* extend it (`<Name>Base`); a hand-written one extends that, or this when its API is not the wire's. */
|
|
50
|
+
export declare class ViewChannel<Events extends object = {}> extends NativeViewElement {
|
|
51
|
+
private readonly _readers;
|
|
52
|
+
constructor(iface: string, name: string, params: object, readers?: EventReaders);
|
|
53
|
+
/** Whether this host registered a view under `name` — at contract version `since` or later, when
|
|
54
|
+
* one is given (a method's `@since`). */
|
|
55
|
+
static supports(name: string, since?: number): boolean;
|
|
56
|
+
on<K extends keyof Events & string>(event: K, callback: Listener<Events, K>): this;
|
|
57
|
+
off<K extends keyof Events & string>(event: K, callback: Listener<Events, K>): this;
|
|
58
|
+
}
|
|
59
|
+
/** The client of a service plugin: a session that opens on the first call, with the contract's
|
|
60
|
+
* events. The service twin of {@link ViewChannel}. */
|
|
61
|
+
export declare class ServiceChannel<Events extends object = {}> extends ServiceClient {
|
|
62
|
+
private readonly _readers;
|
|
63
|
+
constructor(iface: string, name: string, params?: object, readers?: EventReaders);
|
|
64
|
+
/** Whether this host registered a service under `name` — at contract version `since` or later,
|
|
65
|
+
* when one is given (a method's `@since`). */
|
|
66
|
+
static supports(name: string, since?: number): boolean;
|
|
67
|
+
on<K extends keyof Events & string>(event: K, callback: Listener<Events, K>): this;
|
|
68
|
+
off<K extends keyof Events & string>(event: K, callback: Listener<Events, K>): this;
|
|
69
|
+
}
|
|
70
|
+
/** The text of a host buffer — what a bundled `asset()` is in a shell compile (`"id:N"`): the host
|
|
71
|
+
* already holds the bytes. Empty when there is no such buffer. */
|
|
72
|
+
export declare const bufferText: (systemId: number) => string;
|
|
73
|
+
/** Prepare-then-present for a view that needs the camera: fail before any prompt on a host without
|
|
74
|
+
* the view, ask for the permission while the current destination stays visible, give up when
|
|
75
|
+
* another navigation superseded this one. Resolves when the view may open. */
|
|
76
|
+
export declare const prepareCamera: (view: ViewChannel<any>) => Promise<void>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type File, type NativeView, type PresentOptions } from "../../../../plugin";
|
|
2
|
+
import type { Facing } from "../contract";
|
|
3
|
+
export type CameraFacing = Facing;
|
|
4
|
+
export interface CameraView extends NativeView {
|
|
5
|
+
/** Request the camera permission, then present the preview. The current destination stays
|
|
6
|
+
* visible until the camera is ready; rejects if the permission is denied, the host has no
|
|
7
|
+
* camera, or another navigation superseded this one. */
|
|
8
|
+
open(options?: PresentOptions): Promise<void>;
|
|
9
|
+
/** Capture a still frame as an image `File` (host-encoded). */
|
|
10
|
+
takePhoto(): Promise<File>;
|
|
11
|
+
/** Switch between the front and the back camera while the preview is live. */
|
|
12
|
+
setFacingMode(facingMode: CameraFacing): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Create a camera view (default: the back camera). `CameraView.isSupported` reports whether this
|
|
16
|
+
* host has the capability — check it before offering the feature.
|
|
17
|
+
*/
|
|
18
|
+
export declare const CameraView: {
|
|
19
|
+
(options?: {
|
|
20
|
+
facingMode?: CameraFacing;
|
|
21
|
+
}): CameraView;
|
|
22
|
+
/** Whether this host registered a "camera" view. */
|
|
23
|
+
readonly isSupported: boolean;
|
|
24
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ViewChannel, type File } from "../../../../plugin";
|
|
2
|
+
import type { CameraEvents, CameraParams, Facing } from "../contract";
|
|
3
|
+
/** What the halves register under. */
|
|
4
|
+
export declare const NAME = "camera";
|
|
5
|
+
/** The contract's version: the highest `@since` of its members. */
|
|
6
|
+
export declare const VERSION = 1;
|
|
7
|
+
/** Capture a still frame as a JPEG.
|
|
8
|
+
* Rejects with "failed". */
|
|
9
|
+
export declare const takePhoto: (view: ViewChannel<CameraEvents>) => Promise<File>;
|
|
10
|
+
/** Switch the camera while the preview is live. */
|
|
11
|
+
export declare const setFacingMode: (view: ViewChannel<CameraEvents>, mode: Facing) => Promise<void>;
|
|
12
|
+
/** A method of the contract. */
|
|
13
|
+
export type Method = "takePhoto" | "setFacingMode";
|
|
14
|
+
/** Whether this host has the view "camera" — and, given a method, a half new enough for it
|
|
15
|
+
* (a method added after the first version of the contract is tagged `@since`). */
|
|
16
|
+
export declare const supports: (method?: Method) => boolean;
|
|
17
|
+
/** The view "camera" with the wire's methods as its own. */
|
|
18
|
+
export declare class CameraViewBase extends ViewChannel<CameraEvents> {
|
|
19
|
+
constructor(params?: CameraParams);
|
|
20
|
+
/** Capture a still frame as a JPEG.
|
|
21
|
+
* Rejects with "failed". */
|
|
22
|
+
takePhoto(): Promise<File>;
|
|
23
|
+
/** Switch the camera while the preview is live. */
|
|
24
|
+
setFacingMode(mode: Facing): Promise<void>;
|
|
25
|
+
}
|
|
@@ -1,23 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
longitude: number;
|
|
4
|
-
/** Horizontal accuracy radius, meters. */
|
|
5
|
-
accuracy: number;
|
|
6
|
-
/** Meters above sea level, or null when the provider doesn't know. */
|
|
7
|
-
altitude: number | null;
|
|
8
|
-
/** Direction of travel in degrees clockwise from north, or null when stationary/unknown. */
|
|
9
|
-
heading: number | null;
|
|
10
|
-
/** Ground speed in m/s, or null when unknown. */
|
|
11
|
-
speed: number | null;
|
|
12
|
-
/** When this fix was taken, ms epoch. */
|
|
13
|
-
timestamp: number;
|
|
14
|
-
}
|
|
15
|
-
export interface GeoOptions {
|
|
16
|
-
/** Prefer the precise (GPS) provider — slower first fix, more battery. Default false. */
|
|
17
|
-
highAccuracy?: boolean;
|
|
18
|
-
/** getCurrent only: reject with "timeout" if no fix arrives in this many ms. */
|
|
19
|
-
timeout?: number;
|
|
20
|
-
}
|
|
1
|
+
import type { GeoOptions, GeoPosition } from "../contract";
|
|
2
|
+
export type { GeoOptions, GeoPosition };
|
|
21
3
|
/** A live `Geolocation.watch()` subscription — `stop()` it when the screen goes away. */
|
|
22
4
|
export interface GeoWatch {
|
|
23
5
|
stop(): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ServiceChannel } from "../../../../plugin";
|
|
2
|
+
import type { GeoOptions, GeoPosition, GeolocationEvents, GeolocationParams } from "../contract";
|
|
3
|
+
/** What the halves register under. */
|
|
4
|
+
export declare const NAME = "geolocation";
|
|
5
|
+
/** The contract's version: the highest `@since` of its members. */
|
|
6
|
+
export declare const VERSION = 1;
|
|
7
|
+
/** One fix.
|
|
8
|
+
* Rejects with "denied" / "unavailable" / "timeout". */
|
|
9
|
+
export declare const getCurrent: (service: ServiceChannel<GeolocationEvents>, options?: GeoOptions) => Promise<GeoPosition>;
|
|
10
|
+
/** Start the session's watch; resolves once it is live (permission granted, provider started).
|
|
11
|
+
* A second call while watching resolves at once and keeps the first call's options.
|
|
12
|
+
* Rejects with "denied" / "unavailable". */
|
|
13
|
+
export declare const startWatch: (service: ServiceChannel<GeolocationEvents>, options?: GeoOptions) => Promise<void>;
|
|
14
|
+
export declare const stopWatch: (service: ServiceChannel<GeolocationEvents>) => Promise<void>;
|
|
15
|
+
/** A method of the contract. */
|
|
16
|
+
export type Method = "getCurrent" | "startWatch" | "stopWatch";
|
|
17
|
+
/** Whether this host has the service "geolocation" — and, given a method, a half new enough for it
|
|
18
|
+
* (a method added after the first version of the contract is tagged `@since`). */
|
|
19
|
+
export declare const supports: (method?: Method) => boolean;
|
|
20
|
+
/** The service "geolocation" with the wire's methods as its own. */
|
|
21
|
+
export declare class GeolocationBase extends ServiceChannel<GeolocationEvents> {
|
|
22
|
+
constructor(params?: GeolocationParams);
|
|
23
|
+
/** One fix.
|
|
24
|
+
* Rejects with "denied" / "unavailable" / "timeout". */
|
|
25
|
+
getCurrent(options?: GeoOptions): Promise<GeoPosition>;
|
|
26
|
+
/** Start the session's watch; resolves once it is live (permission granted, provider started).
|
|
27
|
+
* A second call while watching resolves at once and keeps the first call's options.
|
|
28
|
+
* Rejects with "denied" / "unavailable". */
|
|
29
|
+
startWatch(options?: GeoOptions): Promise<void>;
|
|
30
|
+
stopWatch(): Promise<void>;
|
|
31
|
+
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { NativeView } from "
|
|
2
|
-
import type {
|
|
1
|
+
import { type FetchResponse, type NativeView } from "../../../../plugin";
|
|
2
|
+
import type { LngLat, MapCamera, MapCameraMove, MapFitOptions, MapPadding, MapParams, MapUserLocationOptions } from "../contract";
|
|
3
|
+
export type { LngLat, MapCamera };
|
|
4
|
+
export type CameraMove = MapCameraMove;
|
|
5
|
+
export type FitOptions = MapFitOptions;
|
|
6
|
+
export type MapPaddingValues = MapPadding;
|
|
7
|
+
export type UserLocationOptions = MapUserLocationOptions;
|
|
3
8
|
/** The ready-made styles a map falls back on — [OpenFreeMap](https://openfreemap.org): OSM data,
|
|
4
9
|
* no key, no registration, no request limits, commercial use allowed, and the whole stack is
|
|
5
10
|
* open-source if you'd rather self-host. `liberty` is the default. Credit them (and OSM) in your
|
|
@@ -27,32 +32,12 @@ export type MapStyleName = "liberty" | "bright" | "positron" | "dark" | "fiord";
|
|
|
27
32
|
* relative urls until its `publicUrl` is configured.
|
|
28
33
|
*/
|
|
29
34
|
export type MapStyle = MapStyleName | (string & {}) | FetchResponse | object;
|
|
30
|
-
|
|
31
|
-
export type LngLat = [number, number];
|
|
32
|
-
export interface MapCamera {
|
|
33
|
-
center: LngLat;
|
|
34
|
-
zoom: number;
|
|
35
|
-
/** Degrees clockwise from north. */
|
|
36
|
-
bearing: number;
|
|
37
|
-
/** Degrees from the vertical. */
|
|
38
|
-
pitch: number;
|
|
39
|
-
}
|
|
40
|
-
export interface MapOptions {
|
|
35
|
+
export interface MapOptions extends Omit<MapParams, "style" | "styleJson"> {
|
|
41
36
|
/** The MapLibre style: a ready-made name (`"liberty"` — the default, `"positron"`, …), a URL,
|
|
42
37
|
* a style bundled with the app (`asset("./style.json")`), an already-read file
|
|
43
38
|
* (`fetchLocal("style.json")`, `await fetch(url)`) or the style object itself — see
|
|
44
39
|
* {@link MapStyle}. */
|
|
45
40
|
style?: MapStyle;
|
|
46
|
-
center?: LngLat;
|
|
47
|
-
zoom?: number;
|
|
48
|
-
minZoom?: number;
|
|
49
|
-
maxZoom?: number;
|
|
50
|
-
bearing?: number;
|
|
51
|
-
pitch?: number;
|
|
52
|
-
/** Two-finger rotate gesture (default true). */
|
|
53
|
-
rotate?: boolean;
|
|
54
|
-
/** Two-finger tilt gesture (default false — most city maps stay flat). */
|
|
55
|
-
tilt?: boolean;
|
|
56
41
|
}
|
|
57
42
|
/** A tap on the map itself — not on a feature of a managed layer. */
|
|
58
43
|
export interface MapTap {
|
|
@@ -60,26 +45,6 @@ export interface MapTap {
|
|
|
60
45
|
/** View-space point, px. */
|
|
61
46
|
point: [number, number];
|
|
62
47
|
}
|
|
63
|
-
export interface CameraMove {
|
|
64
|
-
zoom?: number;
|
|
65
|
-
bearing?: number;
|
|
66
|
-
pitch?: number;
|
|
67
|
-
/** Animation length, ms (flyTo only; default 600). */
|
|
68
|
-
duration?: number;
|
|
69
|
-
}
|
|
70
|
-
export interface MapPaddingValues {
|
|
71
|
-
top?: number | string;
|
|
72
|
-
left?: number | string;
|
|
73
|
-
bottom?: number | string;
|
|
74
|
-
right?: number | string;
|
|
75
|
-
}
|
|
76
|
-
export interface FitOptions {
|
|
77
|
-
/** Px around the points, or per edge. Added to the view padding set by `setPadding`. */
|
|
78
|
-
padding?: number | MapPaddingValues;
|
|
79
|
-
maxZoom?: number;
|
|
80
|
-
/** Default true. */
|
|
81
|
-
animate?: boolean;
|
|
82
|
-
}
|
|
83
48
|
/** One marker. `id` comes back in `onTap`; `icon` names an image of the style's sprite; `color` /
|
|
84
49
|
* `title` feed the default layers; extra keys become feature properties. */
|
|
85
50
|
export interface MarkerItem {
|
|
@@ -111,12 +76,6 @@ export interface LineLayerOptions {
|
|
|
111
76
|
/** 0–1 (default 1). */
|
|
112
77
|
opacity?: number;
|
|
113
78
|
}
|
|
114
|
-
export interface UserLocationOptions {
|
|
115
|
-
/** Horizontal accuracy radius, meters — drawn as the halo around the dot. */
|
|
116
|
-
accuracy?: number | null;
|
|
117
|
-
/** Degrees clockwise from north — drawn as the direction wedge; null hides it. */
|
|
118
|
-
heading?: number | null;
|
|
119
|
-
}
|
|
120
79
|
export interface MarkerLayer {
|
|
121
80
|
readonly name: string;
|
|
122
81
|
/** Replace the layer's markers. */
|
|
@@ -165,7 +124,7 @@ export interface MapView extends NativeView {
|
|
|
165
124
|
}
|
|
166
125
|
/**
|
|
167
126
|
* Create a map view. `MapView.isSupported` reports whether this host registered a "map" view —
|
|
168
|
-
* check it before offering the feature
|
|
127
|
+
* check it before offering the feature.
|
|
169
128
|
*/
|
|
170
129
|
export declare const MapView: {
|
|
171
130
|
(options?: MapOptions): MapView;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ViewChannel, type Json } from "../../../../plugin";
|
|
2
|
+
import type { LngLat, MapCamera, MapCameraMove, MapEvents, MapFitOptions, MapLayerKind, MapLayerOptions, MapPadding, MapParams, MapUserLocationOptions } from "../contract";
|
|
3
|
+
/** What the halves register under. */
|
|
4
|
+
export declare const NAME = "map";
|
|
5
|
+
/** The contract's version: the highest `@since` of its members. */
|
|
6
|
+
export declare const VERSION = 1;
|
|
7
|
+
/** Make sure the GeoJSON source `source` exists. A source the style declares is used as is (its
|
|
8
|
+
* layers draw, only data flows); otherwise the half creates it with the default layers of `kind`.
|
|
9
|
+
* Rejects with "notReady". */
|
|
10
|
+
export declare const ensureLayer: (view: ViewChannel<MapEvents>, source: string, kind: MapLayerKind, options?: MapLayerOptions) => Promise<void>;
|
|
11
|
+
export declare const removeLayer: (view: ViewChannel<MapEvents>, source: string) => Promise<void>;
|
|
12
|
+
/** Replace the data of a GeoJSON source: a Feature or a FeatureCollection.
|
|
13
|
+
* Rejects with "notReady". */
|
|
14
|
+
export declare const setData: (view: ViewChannel<MapEvents>, source: string, geojson: Json) => Promise<void>;
|
|
15
|
+
export declare const flyTo: (view: ViewChannel<MapEvents>, center: LngLat, options?: MapCameraMove) => Promise<void>;
|
|
16
|
+
export declare const jumpTo: (view: ViewChannel<MapEvents>, center: LngLat, options?: MapCameraMove) => Promise<void>;
|
|
17
|
+
/** Fit the camera to the points.
|
|
18
|
+
* Rejects with "noPoints". */
|
|
19
|
+
export declare const fitPoints: (view: ViewChannel<MapEvents>, points: LngLat[], options?: MapFitOptions) => Promise<void>;
|
|
20
|
+
/** The part of the view covered by the app's UI; camera moves center inside the rest. */
|
|
21
|
+
export declare const setPadding: (view: ViewChannel<MapEvents>, padding: MapPadding) => Promise<void>;
|
|
22
|
+
/** Rejects with "notReady". */
|
|
23
|
+
export declare const getCamera: (view: ViewChannel<MapEvents>) => Promise<MapCamera>;
|
|
24
|
+
/** Move the user puck; null hides it. */
|
|
25
|
+
export declare const setUserLocation: (view: ViewChannel<MapEvents>, lngLat: LngLat | null, options?: MapUserLocationOptions) => Promise<void>;
|
|
26
|
+
/** A method of the contract. */
|
|
27
|
+
export type Method = "ensureLayer" | "removeLayer" | "setData" | "flyTo" | "jumpTo" | "fitPoints" | "setPadding" | "getCamera" | "setUserLocation";
|
|
28
|
+
/** Whether this host has the view "map" — and, given a method, a half new enough for it
|
|
29
|
+
* (a method added after the first version of the contract is tagged `@since`). */
|
|
30
|
+
export declare const supports: (method?: Method) => boolean;
|
|
31
|
+
/** The view "map" with the wire's methods as its own. */
|
|
32
|
+
export declare class MapViewBase extends ViewChannel<MapEvents> {
|
|
33
|
+
constructor(params?: MapParams);
|
|
34
|
+
/** Make sure the GeoJSON source `source` exists. A source the style declares is used as is (its
|
|
35
|
+
* layers draw, only data flows); otherwise the half creates it with the default layers of `kind`.
|
|
36
|
+
* Rejects with "notReady". */
|
|
37
|
+
ensureLayer(source: string, kind: MapLayerKind, options?: MapLayerOptions): Promise<void>;
|
|
38
|
+
removeLayer(source: string): Promise<void>;
|
|
39
|
+
/** Replace the data of a GeoJSON source: a Feature or a FeatureCollection.
|
|
40
|
+
* Rejects with "notReady". */
|
|
41
|
+
setData(source: string, geojson: Json): Promise<void>;
|
|
42
|
+
flyTo(center: LngLat, options?: MapCameraMove): Promise<void>;
|
|
43
|
+
jumpTo(center: LngLat, options?: MapCameraMove): Promise<void>;
|
|
44
|
+
/** Fit the camera to the points.
|
|
45
|
+
* Rejects with "noPoints". */
|
|
46
|
+
fitPoints(points: LngLat[], options?: MapFitOptions): Promise<void>;
|
|
47
|
+
/** The part of the view covered by the app's UI; camera moves center inside the rest. */
|
|
48
|
+
setPadding(padding: MapPadding): Promise<void>;
|
|
49
|
+
/** Rejects with "notReady". */
|
|
50
|
+
getCamera(): Promise<MapCamera>;
|
|
51
|
+
/** Move the user puck; null hides it. */
|
|
52
|
+
setUserLocation(lngLat: LngLat | null, options?: MapUserLocationOptions): Promise<void>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PushEvents, PushPayload, PushRegisterOptions, PushRegistration, PushStatus } from "../contract";
|
|
2
|
+
export type { PushPayload, PushRegisterOptions, PushStatus };
|
|
3
|
+
export type PushEvent = keyof PushEvents;
|
|
4
|
+
/**
|
|
5
|
+
* Remote push notifications. `Push.isSupported` reports whether this host registered the
|
|
6
|
+
* service — check it before offering notification features.
|
|
7
|
+
*/
|
|
8
|
+
export declare const Push: {
|
|
9
|
+
/** Whether this host registered a "push" service. */
|
|
10
|
+
readonly isSupported: boolean;
|
|
11
|
+
/** Permission + registration state. Never prompts. */
|
|
12
|
+
getStatus(): Promise<PushStatus>;
|
|
13
|
+
/** Ask for permission (first time) and register this device → the opaque address your server
|
|
14
|
+
* targets. Idempotent — safe to call every launch; rejects "denied" / "unavailable". */
|
|
15
|
+
register(options?: PushRegisterOptions): Promise<PushRegistration>;
|
|
16
|
+
/** Remove this device's registration (the address stops receiving). */
|
|
17
|
+
unregister(): Promise<void>;
|
|
18
|
+
/** The notification that cold-started this app run, or null. Stable across calls. */
|
|
19
|
+
getLaunch(): Promise<PushPayload | null>;
|
|
20
|
+
/** "message" = received while the app is open; "tap" = the user tapped one while it ran. */
|
|
21
|
+
addEventListener(event: PushEvent, callback: (payload: PushPayload) => void): void;
|
|
22
|
+
removeEventListener(event: PushEvent, callback: (payload: PushPayload) => void): void;
|
|
23
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ServiceChannel } from "../../../../plugin";
|
|
2
|
+
import type { PushEvents, PushParams, PushPayload, PushRegisterOptions, PushRegistration, PushStatus } from "../contract";
|
|
3
|
+
/** What the halves register under. */
|
|
4
|
+
export declare const NAME = "push";
|
|
5
|
+
/** The contract's version: the highest `@since` of its members. */
|
|
6
|
+
export declare const VERSION = 1;
|
|
7
|
+
/** Permission + registration state. Never prompts. */
|
|
8
|
+
export declare const getStatus: (service: ServiceChannel<PushEvents>) => Promise<PushStatus>;
|
|
9
|
+
/** Ask for the permission (the first time) and register this device. Idempotent.
|
|
10
|
+
* Rejects with "denied" / "unavailable". */
|
|
11
|
+
export declare const register: (service: ServiceChannel<PushEvents>, options?: PushRegisterOptions) => Promise<PushRegistration>;
|
|
12
|
+
/** Remove this device's registration.
|
|
13
|
+
* Rejects with "unavailable". */
|
|
14
|
+
export declare const unregister: (service: ServiceChannel<PushEvents>) => Promise<void>;
|
|
15
|
+
/** The notification that cold-started this world, or null. Stable across calls. */
|
|
16
|
+
export declare const getLaunch: (service: ServiceChannel<PushEvents>) => Promise<PushPayload | null>;
|
|
17
|
+
/** A method of the contract. */
|
|
18
|
+
export type Method = "getStatus" | "register" | "unregister" | "getLaunch";
|
|
19
|
+
/** Whether this host has the service "push" — and, given a method, a half new enough for it
|
|
20
|
+
* (a method added after the first version of the contract is tagged `@since`). */
|
|
21
|
+
export declare const supports: (method?: Method) => boolean;
|
|
22
|
+
/** The service "push" with the wire's methods as its own. */
|
|
23
|
+
export declare class PushBase extends ServiceChannel<PushEvents> {
|
|
24
|
+
constructor(params?: PushParams);
|
|
25
|
+
/** Permission + registration state. Never prompts. */
|
|
26
|
+
getStatus(): Promise<PushStatus>;
|
|
27
|
+
/** Ask for the permission (the first time) and register this device. Idempotent.
|
|
28
|
+
* Rejects with "denied" / "unavailable". */
|
|
29
|
+
register(options?: PushRegisterOptions): Promise<PushRegistration>;
|
|
30
|
+
/** Remove this device's registration.
|
|
31
|
+
* Rejects with "unavailable". */
|
|
32
|
+
unregister(): Promise<void>;
|
|
33
|
+
/** The notification that cold-started this world, or null. Stable across calls. */
|
|
34
|
+
getLaunch(): Promise<PushPayload | null>;
|
|
35
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { type PresentOptions } from "
|
|
2
|
-
import { NativeView } from "../ui/NativeView";
|
|
1
|
+
import { type NativeView, type PresentOptions } from "../../../../plugin";
|
|
3
2
|
export interface QRScanner extends NativeView {
|
|
4
3
|
/** Fires per decoded camera frame: the decoded string, or `null` for a frame with no readable
|
|
5
4
|
* code (expect those repeatedly while the user aims). The same code can be reported more than
|
|
6
5
|
* once — `close()` or debounce once you have what you need. */
|
|
7
6
|
onScan(callback: (data: string | null) => void): this;
|
|
8
|
-
/** Request camera permission, then present the scanner. The current destination (and its
|
|
7
|
+
/** Request the camera permission, then present the scanner. The current destination (and its
|
|
9
8
|
* loading state) stays visible until the scanner is ready; rejects if the camera is denied,
|
|
10
9
|
* the host can't scan, or another navigation superseded this one. */
|
|
11
10
|
open(options?: PresentOptions): Promise<void>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ViewChannel } from "../../../../plugin";
|
|
2
|
+
import type { QRScannerEvents, QRScannerParams } from "../contract";
|
|
3
|
+
/** What the halves register under. */
|
|
4
|
+
export declare const NAME = "qrScanner";
|
|
5
|
+
/** The contract's version: the highest `@since` of its members. */
|
|
6
|
+
export declare const VERSION = 1;
|
|
7
|
+
/** A method of the contract. */
|
|
8
|
+
export type Method = never;
|
|
9
|
+
/** Whether this host has the view "qrScanner" — and, given a method, a half new enough for it
|
|
10
|
+
* (a method added after the first version of the contract is tagged `@since`). */
|
|
11
|
+
export declare const supports: (method?: Method) => boolean;
|
|
12
|
+
/** The view "qrScanner" with the wire's methods as its own. */
|
|
13
|
+
export declare class QRScannerBase extends ViewChannel<QRScannerEvents> {
|
|
14
|
+
constructor(params?: QRScannerParams);
|
|
15
|
+
}
|