lecodes-sdk 1.2.0 → 2.0.1

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.
Files changed (260) hide show
  1. package/README.md +5 -2
  2. package/dist/editor.d.ts +12 -0
  3. package/dist/global.d.ts +4 -8
  4. package/dist/host.d.ts +2 -3
  5. package/dist/types/animate/tween/Animation.d.ts +0 -3
  6. package/dist/types/animate/tween/animateValue.d.ts +4 -2
  7. package/dist/types/animate/tween/easing.d.ts +8 -0
  8. package/dist/types/animate/tween/spec.d.ts +15 -7
  9. package/dist/types/audio/audio.d.ts +2 -1
  10. package/dist/types/canvas/Canvas.d.ts +40 -108
  11. package/dist/types/canvas/gen/cssColor.d.ts +17 -0
  12. package/dist/types/canvas/gen/recorder.d.ts +118 -0
  13. package/dist/types/canvas/gen/spec.d.ts +144 -0
  14. package/dist/types/core/color.d.ts +3 -1
  15. package/dist/types/core/pins.d.ts +18 -0
  16. package/dist/types/g2/Node2D.d.ts +5 -8
  17. package/dist/types/g2/Scene2D.d.ts +6 -2
  18. package/dist/types/gl/Foliage.d.ts +30 -7
  19. package/dist/types/gl/Light.d.ts +8 -0
  20. package/dist/types/gl/Lightmap.d.ts +13 -2
  21. package/dist/types/gl/Material.d.ts +17 -3
  22. package/dist/types/gl/Model.d.ts +6 -2
  23. package/dist/types/gl/Node.d.ts +3 -6
  24. package/dist/types/gl/Scene.d.ts +41 -13
  25. package/dist/types/gl/Texture.d.ts +1 -1
  26. package/dist/types/gl/animation/Locomotion.d.ts +8 -1
  27. package/dist/types/inject.d.ts +11 -11
  28. package/dist/types/inject.editor.d.ts +1 -0
  29. package/dist/types/net/core.d.ts +7 -0
  30. package/dist/types/plugin.d.ts +76 -0
  31. package/dist/types/plugins/gen/camera/sdk/camera.d.ts +24 -0
  32. package/dist/types/plugins/gen/camera/sdk/camera.gen.d.ts +25 -0
  33. package/dist/types/plugins/{geolocation.d.ts → gen/geolocation/sdk/geolocation.d.ts} +2 -20
  34. package/dist/types/plugins/gen/geolocation/sdk/geolocation.gen.d.ts +31 -0
  35. package/dist/types/plugins/{map.d.ts → gen/map/sdk/map.d.ts} +9 -50
  36. package/dist/types/plugins/gen/map/sdk/map.gen.d.ts +53 -0
  37. package/dist/types/plugins/gen/push/sdk/push.d.ts +23 -0
  38. package/dist/types/plugins/gen/push/sdk/push.gen.d.ts +35 -0
  39. package/dist/types/plugins/{qr.d.ts → gen/qr-scanner/sdk/qr-scanner.d.ts} +2 -3
  40. package/dist/types/plugins/gen/qr-scanner/sdk/qr-scanner.gen.d.ts +15 -0
  41. package/dist/types/runtime/app.d.ts +9 -2
  42. package/dist/types/runtime/fetch.d.ts +2 -0
  43. package/dist/types/runtime/input.d.ts +1 -1
  44. package/dist/types/runtime/media.d.ts +6 -10
  45. package/dist/types/runtime/misc.d.ts +4 -1
  46. package/dist/types/runtime/net.d.ts +3 -2
  47. package/dist/types/runtime/touch.d.ts +32 -0
  48. package/dist/types/scene/defineScene.d.ts +43 -2
  49. package/dist/types/scene/editor.d.ts +52 -0
  50. package/dist/types/scene/gizmos.d.ts +7 -4
  51. package/dist/types/ui/NativeView.d.ts +6 -4
  52. package/dist/types/ui/UI.d.ts +1 -1
  53. package/dist/types/ui/UIBottomSheet.d.ts +6 -12
  54. package/dist/types/ui/UIButton.d.ts +12 -14
  55. package/dist/types/ui/UIContainer.d.ts +0 -6
  56. package/dist/types/ui/UIImage.d.ts +1 -4
  57. package/dist/types/ui/UIInput.d.ts +8 -24
  58. package/dist/types/ui/UIModal.d.ts +0 -2
  59. package/dist/types/ui/UINode.d.ts +70 -56
  60. package/dist/types/ui/UIPager.d.ts +28 -27
  61. package/dist/types/ui/UIPopover.d.ts +0 -2
  62. package/dist/types/ui/UIScreen.d.ts +12 -17
  63. package/dist/types/ui/UIScrollable.d.ts +1 -4
  64. package/dist/types/ui/UIText.d.ts +0 -2
  65. package/dist/types/ui/UIVideo.d.ts +3 -5
  66. package/dist/types/ui/UIVirtualizedList.d.ts +14 -16
  67. package/dist/types/ui/UIWidget.d.ts +10 -9
  68. package/dist/types/ui/colorKeys.gen.d.ts +9 -0
  69. package/dist/types/ui/presentable.d.ts +46 -32
  70. package/dist/types/ui/router.d.ts +18 -7
  71. package/dist/types/ui/styleColor.d.ts +1 -0
  72. package/dist/types/ui/transitions.d.ts +18 -0
  73. package/dist/types/ui/tree.d.ts +75 -0
  74. package/dist/types/version.d.ts +10 -0
  75. package/dist/types.json +1 -1
  76. package/package.json +12 -3
  77. package/prompts/2d.md +2 -6
  78. package/prompts/3d.md +1 -5
  79. package/prompts/README.md +1 -1
  80. package/prompts/canvas.md +9 -8
  81. package/prompts/compose.ts +1 -1
  82. package/prompts/core.md +3 -3
  83. package/prompts/design.md +1 -1
  84. package/prompts/dist/2d-game.md +473 -239
  85. package/prompts/dist/3d-app.md +553 -205
  86. package/prompts/dist/ar-app.md +435 -202
  87. package/prompts/dist/design.md +113 -95
  88. package/prompts/dist/ui-app.md +386 -170
  89. package/prompts/ui-design.md +2 -3
  90. package/prompts/ui.md +45 -37
  91. package/src/animate/tween/Animation.ts +34 -150
  92. package/src/animate/tween/Timeline.ts +175 -175
  93. package/src/animate/tween/animateValue.ts +6 -3
  94. package/src/animate/tween/easing.ts +10 -3
  95. package/src/animate/tween/spec.ts +41 -15
  96. package/src/audio/Sound.ts +3 -3
  97. package/src/audio/audio.ts +2 -1
  98. package/src/bridges/2d.d.ts +317 -0
  99. package/src/bridges/app.d.ts +91 -0
  100. package/src/bridges/audio.d.ts +97 -0
  101. package/src/bridges/canvas.d.ts +79 -0
  102. package/src/bridges/device.d.ts +72 -0
  103. package/src/bridges/fetch.d.ts +80 -0
  104. package/src/bridges/files.d.ts +70 -0
  105. package/src/bridges/gl.d.ts +1133 -0
  106. package/src/bridges/input.d.ts +72 -0
  107. package/src/bridges/media.d.ts +55 -0
  108. package/src/bridges/nav.d.ts +71 -0
  109. package/src/bridges/net.d.ts +52 -0
  110. package/src/bridges/service.d.ts +52 -0
  111. package/src/bridges/socket.d.ts +31 -0
  112. package/src/bridges/storage.d.ts +33 -0
  113. package/src/bridges/tree.d.ts +301 -0
  114. package/src/bridges/types.d.ts +49 -0
  115. package/src/canvas/Canvas.ts +114 -159
  116. package/src/canvas/gen/cssColor.ts +224 -0
  117. package/src/canvas/gen/recorder.ts +212 -0
  118. package/src/canvas/gen/spec.ts +201 -0
  119. package/src/chisel.ts +193 -0
  120. package/src/compile/assetMacro.ts +1 -1
  121. package/src/compile/bundler.ts +11 -2
  122. package/src/compile/compileProject.ts +43 -4
  123. package/src/compile/fontMacro.ts +3 -4
  124. package/src/compile/header.ts +26 -5
  125. package/src/compile/index.ts +3 -1
  126. package/src/compile/liteMaterial.ts +1 -1
  127. package/src/compile/sceneEditor.ts +11 -26
  128. package/src/core/color.ts +73 -30
  129. package/src/core/pins.ts +51 -0
  130. package/src/core/signals.ts +8 -1
  131. package/src/g2/CharacterController2D.ts +3 -3
  132. package/src/g2/Node2D.ts +57 -39
  133. package/src/g2/Physics2D.ts +2 -2
  134. package/src/g2/Scene2D.ts +35 -23
  135. package/src/g2/Texture2D.ts +1 -1
  136. package/src/g2/loop.ts +4 -4
  137. package/src/gl/CameraPlace.ts +52 -52
  138. package/src/gl/Foliage.ts +72 -17
  139. package/src/gl/Geometry.ts +1 -2
  140. package/src/gl/Light.ts +10 -0
  141. package/src/gl/Lightmap.ts +45 -29
  142. package/src/gl/Material.ts +95 -51
  143. package/src/gl/Mesh.ts +120 -120
  144. package/src/gl/Model.ts +21 -16
  145. package/src/gl/Node.ts +91 -24
  146. package/src/gl/Particles.ts +1 -1
  147. package/src/gl/Scene.ts +100 -44
  148. package/src/gl/Texture.ts +8 -7
  149. package/src/gl/animation/AnimationClip.ts +1 -1
  150. package/src/gl/animation/DynamicBone.ts +482 -482
  151. package/src/gl/animation/Locomotion.ts +8 -3
  152. package/src/gl/nav/NavMesh.ts +3 -4
  153. package/src/gl/physics/Physics.ts +2 -2
  154. package/src/gl/physics/physicsEvents.ts +3 -3
  155. package/src/gl/scenarios.ts +291 -291
  156. package/src/gl/terrain/Terrain.ts +4 -5
  157. package/src/gl/touch.ts +14 -15
  158. package/src/host.d.ts +2 -3
  159. package/src/inject.editor.ts +7 -0
  160. package/src/inject.ts +13 -16
  161. package/src/net/core.ts +6 -5
  162. package/src/net/index.ts +1 -1
  163. package/src/net/replication.ts +1 -1
  164. package/src/plugin.ts +191 -0
  165. package/src/plugins/gen/camera/contract.d.ts +27 -0
  166. package/src/plugins/gen/camera/sdk/camera.gen.ts +46 -0
  167. package/src/plugins/gen/camera/sdk/camera.ts +57 -0
  168. package/src/plugins/gen/geolocation/contract.d.ts +50 -0
  169. package/src/plugins/gen/geolocation/sdk/geolocation.gen.ts +54 -0
  170. package/src/plugins/{geolocation.ts → gen/geolocation/sdk/geolocation.ts} +22 -43
  171. package/src/plugins/gen/map/contract.d.ts +144 -0
  172. package/src/plugins/gen/map/sdk/map.gen.ts +88 -0
  173. package/src/plugins/{map.ts → gen/map/sdk/map.ts} +68 -102
  174. package/src/plugins/gen/push/contract.d.ts +61 -0
  175. package/src/plugins/gen/push/sdk/push.gen.ts +60 -0
  176. package/src/plugins/gen/push/sdk/push.ts +105 -0
  177. package/src/plugins/gen/qr-scanner/contract.d.ts +16 -0
  178. package/src/plugins/gen/qr-scanner/sdk/qr-scanner.gen.ts +29 -0
  179. package/src/plugins/gen/qr-scanner/sdk/qr-scanner.ts +52 -0
  180. package/src/plugins/permission.ts +5 -4
  181. package/src/runtime/app.ts +20 -9
  182. package/src/runtime/appEvents.ts +5 -4
  183. package/src/runtime/channel.ts +18 -15
  184. package/src/runtime/clipboard.ts +4 -3
  185. package/src/runtime/datetime.ts +2 -1
  186. package/src/runtime/device.ts +17 -15
  187. package/src/runtime/fetch.ts +30 -20
  188. package/src/runtime/files.ts +16 -15
  189. package/src/runtime/input.ts +12 -10
  190. package/src/runtime/media.ts +50 -46
  191. package/src/runtime/misc.ts +7 -3
  192. package/src/runtime/net.ts +8 -7
  193. package/src/runtime/rpc.ts +1 -3
  194. package/src/runtime/service.ts +19 -14
  195. package/src/runtime/share.ts +4 -3
  196. package/src/runtime/storage.ts +6 -4
  197. package/src/runtime/touch.ts +32 -0
  198. package/src/scene/defineScene.ts +61 -365
  199. package/src/scene/editor.ts +408 -0
  200. package/src/scene/editorPlugins.ts +3 -3
  201. package/src/scene/gizmos.ts +15 -9
  202. package/src/server/db/marci/query.ts +1 -1
  203. package/src/server/host.ts +1 -1
  204. package/src/server/runtime.ts +1 -1
  205. package/src/ui/NativeView.ts +72 -25
  206. package/src/ui/UI.ts +3 -3
  207. package/src/ui/UIBottomSheet.ts +16 -17
  208. package/src/ui/UIButton.ts +54 -16
  209. package/src/ui/UIContainer.ts +0 -6
  210. package/src/ui/UIImage.ts +34 -30
  211. package/src/ui/UIInput.ts +29 -37
  212. package/src/ui/UIModal.ts +1 -3
  213. package/src/ui/UINode.ts +347 -297
  214. package/src/ui/UIPager.ts +93 -78
  215. package/src/ui/UIPopover.ts +0 -2
  216. package/src/ui/UIScreen.ts +41 -36
  217. package/src/ui/UIScrollable.ts +19 -13
  218. package/src/ui/UISpacer.ts +1 -1
  219. package/src/ui/UITabs.ts +8 -6
  220. package/src/ui/UIText.ts +7 -17
  221. package/src/ui/UIVideo.ts +30 -27
  222. package/src/ui/UIVirtualizedList.ts +58 -59
  223. package/src/ui/UIWidget.ts +38 -18
  224. package/src/ui/colorKeys.gen.ts +37 -0
  225. package/src/ui/fonts.ts +2 -2
  226. package/src/ui/presentable.ts +59 -42
  227. package/src/ui/router.ts +52 -35
  228. package/src/ui/styleColor.ts +56 -0
  229. package/src/ui/theme.ts +7 -6
  230. package/src/ui/transitions.ts +249 -0
  231. package/src/ui/tree.ts +346 -0
  232. package/src/version.ts +24 -0
  233. package/tests/helpers/engineWorld.ts +11 -0
  234. package/tests/helpers/fakeTree.ts +353 -0
  235. package/tests/helpers/hostStubs.ts +31 -0
  236. package/tests/helpers/index.ts +14 -0
  237. package/tests/helpers/memoryMarci.ts +124 -0
  238. package/tests/helpers/phases.ts +23 -0
  239. package/tests/helpers/preload.ts +18 -0
  240. package/tests/helpers/stubApp.ts +2 -0
  241. package/tests/helpers/stubDevice.ts +2 -0
  242. package/tests/helpers/stubFetch.ts +2 -0
  243. package/tests/helpers/stubInput.ts +2 -0
  244. package/dist/inject.js +0 -4629
  245. package/dist/types/core/registry.d.ts +0 -7
  246. package/dist/types/plugins/camera.d.ts +0 -25
  247. package/dist/types/plugins/push.d.ts +0 -46
  248. package/src/bridges.d.ts +0 -1769
  249. package/src/compile/__tests__/assetIconMacro.test.ts +0 -219
  250. package/src/compile/__tests__/assetMacro.test.ts +0 -100
  251. package/src/compile/__tests__/assetName.test.ts +0 -55
  252. package/src/compile/__tests__/compile.test.ts +0 -310
  253. package/src/compile/__tests__/detectEntry.test.ts +0 -151
  254. package/src/compile/__tests__/fontMacro.test.ts +0 -199
  255. package/src/compile/__tests__/serverSplit.test.ts +0 -27
  256. package/src/core/__tests__/stateMachine.test.ts +0 -132
  257. package/src/core/registry.ts +0 -23
  258. package/src/plugins/camera.ts +0 -81
  259. package/src/plugins/push.ts +0 -132
  260. package/src/plugins/qr.ts +0 -73
@@ -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, TransitionSpec, TransitionTransform } from "./ui/UI";
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, applyEditorPose as __applyEditorPose } from "./scene/defineScene";
76
- export { defineMaterial, MaterialHandle, assignMaterialDef as __assignMaterialDef, applyMaterialParam as __applyMaterialParam, } from "./scene/material";
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, GizmoBuffer as __GizmoBuffer, withGizmoScope as __withGizmoScope } from "./scene/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, __editorPlugins } from "./scene/editorPlugins";
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";
@@ -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
- export interface GeoPosition {
2
- latitude: number;
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 "../ui/NativeView";
2
- import type { FetchResponse } from "../runtime/fetch";
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
- /** `[longitude, latitude]` — GeoJSON order, the same as the style, the tiles and your data. */
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 (web, headless and shells without the plugin have none).
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 "../ui/presentable";
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
+ }
@@ -17,6 +17,10 @@ type AppEventMap = {
17
17
  keyboard: (height: number, duration: number) => void;
18
18
  };
19
19
  export declare const app: {
20
+ /** The SDK this app was compiled with (semver, e.g. `"2.0.0"`). Its major is the bundle ↔ runtime
21
+ * contract: a host runs only bundles of its own major, and the launchers send it as `?sdk=` when
22
+ * they fetch a published bundle — the platform keeps one bundle per major. */
23
+ sdkVersion: string;
20
24
  /** Current lifecycle state. `"background"` while the app is not the foreground app / the tab is
21
25
  * hidden. `"active"` on hosts that don't track it. */
22
26
  readonly state: AppState;
@@ -47,12 +51,12 @@ export declare const app: {
47
51
  quit(): void;
48
52
  /** Global back-press fallback (Android back button/gesture — iOS has no system back). Fires
49
53
  * only when nothing else consumed the press: no open widget/modal claimed it, the current
50
- * screen has no `onBackPressed`, every pager is at its tab root and the router is at its
54
+ * screen has no `onBack`, every pager is at its tab root and the router is at its
51
55
  * stack root. The place for app-wide policy — e.g. double-press-to-quit:
52
56
  *
53
57
  * ```ts
54
58
  * let armedAt = 0
55
- * app.onBackPressed(() => {
59
+ * app.onBack(() => {
56
60
  * if (Date.now() - armedAt < 2000) { app.quit(); return }
57
61
  * armedAt = Date.now()
58
62
  * toast("Press back again to exit")
@@ -60,6 +64,9 @@ export declare const app: {
60
64
  * ```
61
65
  *
62
66
  * Replaces the previous handler; pass `null` to remove. */
67
+ onBack(callback: (() => void) | null): void;
68
+ /** @deprecated Renamed `onBack` (2026-09-26). An alias for the projects compiled before the
69
+ * rename; removed with the release that recompiles them. */
63
70
  onBackPressed(callback: (() => void) | null): void;
64
71
  addEventListener<E extends keyof AppEventMap>(event: E, callback: AppEventMap[E]): void;
65
72
  removeEventListener<E extends keyof AppEventMap>(event: E, callback: AppEventMap[E]): void;
@@ -12,6 +12,8 @@ export interface FetchResponse {
12
12
  readonly status: number;
13
13
  json<T = any>(): T;
14
14
  text(): string;
15
+ /** @deprecated A no-op: the body is freed with the response's handle (owned handles). Apps written
16
+ * against the pre-owned SDK still call it after `text()` / `json()`; remove the call. */
15
17
  dispose(): void;
16
18
  }
17
19
  export declare const fetch: (url: string, options?: FetchOptions) => Promise<FetchResponse>;
@@ -1,4 +1,4 @@
1
- /** Continuous channel ids — the `_creatorUtils.inputRead` contract (bridges.d.ts). */
1
+ /** Continuous channel ids — the `_creatorInput.read` contract (sdk/src/bridges/input.d.ts). */
2
2
  export declare const InputChannel: {
3
3
  readonly MouseX: 0;
4
4
  readonly MouseY: 1;
@@ -7,15 +7,14 @@ type MediaEvents = {
7
7
  completed: () => void;
8
8
  };
9
9
  declare abstract class MediaPlayer extends Emitter<MediaEvents> {
10
- protected _id: number;
11
10
  protected _src: string;
12
11
  private _playing;
13
12
  private _loop;
14
13
  private _volume;
15
- private _disposed;
16
- private _assertAlive;
17
14
  play(): void;
18
15
  pause(): void;
16
+ /** Pause and rewind to the start. */
17
+ stop(): void;
19
18
  get playing(): boolean;
20
19
  set playing(value: boolean);
21
20
  get volume(): number;
@@ -27,12 +26,9 @@ declare abstract class MediaPlayer extends Emitter<MediaEvents> {
27
26
  set time(value: number);
28
27
  /** Total media length in seconds (0 until metadata has loaded). */
29
28
  get duration(): number;
30
- /** True once {@link dispose} has been called; the player is unusable afterwards. */
31
- get disposed(): boolean;
32
- /**
33
- * Release the underlying host media resource (decoder, network, buffers) immediately and detach
34
- * all listeners. Idempotent. Any further use of the player throws.
35
- */
29
+ /** @deprecated There is nothing to dispose — a player the app stops referencing is released by
30
+ * the runtime (a playing one at its end). Kept as `stop()` so old code still silences the player;
31
+ * call `stop()` / `pause()` instead. */
36
32
  dispose(): void;
37
33
  }
38
34
  export declare class AudioPlayer extends MediaPlayer {
@@ -40,7 +36,7 @@ export declare class AudioPlayer extends MediaPlayer {
40
36
  }
41
37
  export declare class VideoPlayer extends MediaPlayer {
42
38
  constructor(src?: string);
43
- /** A 3D Texture that samples this video (e.g. for a Material.video()). */
39
+ /** A 3D Texture that samples this video (e.g. for a Material.video()). Owned by the player. */
44
40
  get texture(): Texture;
45
41
  }
46
42
  export {};
@@ -1,3 +1,4 @@
1
+ import type { ColorInput } from "../core/color";
1
2
  /** Show a transient toast notification. */
2
3
  export declare const toast: (msg: string) => void;
3
4
  /** Open `url` in the system browser / external handler (fire-and-forget, like `share`). Silent
@@ -5,7 +6,9 @@ export declare const toast: (msg: string) => void;
5
6
  export declare const openURL: (url: string) => void;
6
7
  export type SvgSourceValue = {
7
8
  readonly svg: string;
8
- tintColor: string | null;
9
+ /** The source-level tint (a mask recolor under the `tintColor` style, which wins): any color, or
10
+ * a theme `var(--…)`. */
11
+ tintColor: ColorInput | null;
9
12
  };
10
13
  /** Wrap raw SVG XML so it can be used as an image source. */
11
14
  export declare const SvgSource: (svg: string) => SvgSourceValue;
@@ -7,8 +7,9 @@ type SocketEvents = {
7
7
  };
8
8
  export declare class WebSocket extends Emitter<SocketEvents> {
9
9
  private _id;
10
- constructor(url: string, headers?: Record<string, string>);
11
- send(message: string | ArrayBuffer): void;
10
+ constructor(url: string);
11
+ /** Send a text frame. */
12
+ send(message: string): void;
12
13
  close(): void;
13
14
  private _onMessage;
14
15
  }