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
package/README.md CHANGED
@@ -55,7 +55,7 @@ node.matrix = m
55
55
  ```
56
56
 
57
57
  `Quat`/`Mat4` cover the rest: `Quat.fromEuler/lookRotation/slerp`, `Mat4.compose/decompose/lookAt/
58
- perspective`. All of it is fuzz-tested against gl-matrix (dev-only oracle) in `tests/math.oracle.test.ts`.
58
+ perspective`. All of it is fuzz-tested against gl-matrix (dev-only oracle) in `tests/math/oracle.test.ts`.
59
59
 
60
60
  ## Design rules
61
61
 
@@ -63,7 +63,7 @@ perspective`. All of it is fuzz-tested against gl-matrix (dev-only oracle) in `t
63
63
  `.collider()`, `.clips()/.play()`); reuse is a factory function. Per-frame logic is `setLoop(dt => …)`.
64
64
  - **Few globals.** Variants are static factory methods (`Mesh.box()`, `Material.lit()`,
65
65
  `Texture2D.load()`), not free functions.
66
- - **Pure re-skin.** Calls the existing `_creator` / `_creator2d` / `_creatorUI` / `_creatorUtils`
66
+ - **Pure re-skin.** Calls the existing `_creator` / `_creator2d` / `_creatorTree` / `_creatorUtils`
67
67
  host bridges — no native engine changes.
68
68
 
69
69
  ## Layout
@@ -93,6 +93,9 @@ bun test # compile/parity + math/color + 2D + 3D-runtime + UI tests
93
93
  bun run typecheck # tsc --noEmit
94
94
  ```
95
95
 
96
+ Tests live in `tests/<area>/`, one folder per `src/<area>` they exercise; [tests/README.md](tests/README.md)
97
+ has the layout, the shared stubs and the one-process rules.
98
+
96
99
  `tests/headless/` holds live WebGL2 render harnesses (manual; need chrome-headless-shell). The 2D
97
100
  harness is green: a project compiled through the real `compileProject` renders correct pixels.
98
101
 
@@ -0,0 +1,12 @@
1
+ // AUTO-GENERATED by build-types.ts. The extra globals of an EDITOR bundle (a compile with
2
+ // `editor: true`): the scene editor's contract with the SDK. For the scene-editor harness, beside
3
+ // global.d.ts — a project never includes this file.
4
+
5
+ import type * as EDITOR from "./types/inject.editor"
6
+
7
+ declare global {
8
+ const __sceneEditor: typeof EDITOR.__sceneEditor
9
+ type SceneEditorApi = EDITOR.SceneEditorApi
10
+ }
11
+
12
+ export {}
package/dist/global.d.ts CHANGED
@@ -59,6 +59,7 @@ declare global {
59
59
  const Mathf: typeof SDK.Mathf
60
60
  const Mesh: typeof SDK.Mesh
61
61
  const Model: typeof SDK.Model
62
+ const MouseEnterEvent: typeof SDK.MouseEnterEvent
62
63
  const MoveTo: typeof SDK.MoveTo
63
64
  const NativeView: typeof SDK.NativeView
64
65
  const NavAgent: typeof SDK.NavAgent
@@ -145,7 +146,6 @@ declare global {
145
146
  const Warp: typeof SDK.Warp
146
147
  const WebSocket: typeof SDK.WebSocket
147
148
  const Wheel: typeof SDK.Wheel
148
- const __GizmoBuffer: typeof SDK.__GizmoBuffer
149
149
  const __UIBox: typeof SDK.__UIBox
150
150
  const __UIButton: typeof SDK.__UIButton
151
151
  const __UIColumn: typeof SDK.__UIColumn
@@ -153,17 +153,12 @@ declare global {
153
153
  const __UIScreen: typeof SDK.__UIScreen
154
154
  const __UIScrollable: typeof SDK.__UIScrollable
155
155
  const __UIWidget: typeof SDK.__UIWidget
156
- const __applyEditorPose: typeof SDK.__applyEditorPose
157
- const __applyMaterialParam: typeof SDK.__applyMaterialParam
158
- const __assignMaterialDef: typeof SDK.__assignMaterialDef
159
156
  const __channel: typeof SDK.__channel
160
157
  const __compOp: typeof SDK.__compOp
161
158
  const __compWrite: typeof SDK.__compWrite
162
- const __editorPlugins: typeof SDK.__editorPlugins
163
159
  const __rpc: typeof SDK.__rpc
164
160
  const __serverOnly: typeof SDK.__serverOnly
165
161
  const __uiMap: typeof SDK.__uiMap
166
- const __withGizmoScope: typeof SDK.__withGizmoScope
167
162
  const animate: typeof SDK.animate
168
163
  const app: typeof SDK.app
169
164
  const audio: typeof SDK.audio
@@ -276,6 +271,7 @@ declare global {
276
271
  type DecalTrail = SDK.DecalTrail
277
272
  type DecalTrailOptions = SDK.DecalTrailOptions
278
273
  type DifferentialMode = SDK.DifferentialMode
274
+ type DismissOptions = SDK.DismissOptions
279
275
  type Displacement = SDK.Displacement
280
276
  type DriveLayout = SDK.DriveLayout
281
277
  type DynamicBone = SDK.DynamicBone
@@ -378,6 +374,7 @@ declare global {
378
374
  type MeshDef = SDK.MeshDef
379
375
  type Model = SDK.Model
380
376
  type MotionOptions = SDK.MotionOptions
377
+ type MouseEnterEvent<T = any> = SDK.MouseEnterEvent<T>
381
378
  type MoveTo = SDK.MoveTo
382
379
  type NativeView = SDK.NativeView
383
380
  type NavAgent = SDK.NavAgent
@@ -516,8 +513,8 @@ declare global {
516
513
  type Trail = SDK.Trail
517
514
  type Transition = SDK.Transition
518
515
  type TransitionName = SDK.TransitionName
516
+ type TransitionPose = SDK.TransitionPose
519
517
  type TransitionSpec = SDK.TransitionSpec
520
- type TransitionTransform = SDK.TransitionTransform
521
518
  type TrianglePick = SDK.TrianglePick
522
519
  type Trigger = SDK.Trigger
523
520
  type Trigger2D = SDK.Trigger2D
@@ -575,7 +572,6 @@ declare global {
575
572
  type Wheel = SDK.Wheel
576
573
  type WheelSuspension = SDK.WheelSuspension
577
574
  type With<N, A extends Aspect<any, any, any>> = SDK.With<N, A>
578
- type __GizmoBuffer = SDK.__GizmoBuffer
579
575
  // ---- server globals (available in *.server.ts; using them in client code is a build error) ----
580
576
  const ApiError: typeof SERVER.ApiError
581
577
  const auth: typeof SERVER.auth
package/dist/host.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  // JS-runtime globals provided by the host engine (web viewer / desktop / iOS), NOT by the SDK.
2
- // Declared only so SDK and user code type-check — never bundled or injected. Mirrors
3
- // packages/projects/src/global.d.ts.
2
+ // Declared only so SDK and user code type-check — never bundled or injected.
4
3
 
5
4
  declare global {
6
5
  function setTimeout(handler: (...args: any[]) => void, timeout?: number): number
@@ -57,7 +56,7 @@ declare global {
57
56
  * `Style<typeof myButton>`) is what you'd pass to `el.style(...)` — for typing reusable style
58
57
  * presets. Deliberately no `Partial<>` wrapper: every style prop is already optional, and
59
58
  * Partial over ClassStyles' `$`-index signature adds `| undefined`, breaking assignability back
60
- * into `.style(...)`. Round-trip guarded by sdk/tests/ui-types.test.ts. */
59
+ * into `.style(...)`. Round-trip guarded by sdk/tests/ui/types.test.ts. */
61
60
  type Style<T> = T extends { style: (s: infer S) => any } ? S : never
62
61
  }
63
62
 
@@ -29,7 +29,6 @@ export interface Animation {
29
29
  * declarations because `TimelineImpl` extends it — marking it internal (even mentioning the tag in
30
30
  * this comment: the strip is a substring match) drops the timeline's playback members. */
31
31
  export declare class TweenAnimation implements Animation {
32
- private _id;
33
32
  private _started;
34
33
  private _endTime;
35
34
  private _playing;
@@ -38,7 +37,6 @@ export declare class TweenAnimation implements Animation {
38
37
  private _resolve;
39
38
  private _settled;
40
39
  private _listeners;
41
- private _fb?;
42
40
  constructor(spec: TweenSpec);
43
41
  private _newPromise;
44
42
  private _settle;
@@ -64,6 +62,5 @@ export declare class TweenAnimation implements Animation {
64
62
  finish(): this;
65
63
  cancel(): this;
66
64
  onFinish(fn: (done: boolean) => void): this;
67
- private _ensureFallback;
68
65
  }
69
66
  export { CLOCK_UI, CLOCK_GAME };
@@ -4,8 +4,10 @@ import type { QuatLike } from "../../math/quat";
4
4
  import type { Mat4Like } from "../../math/mat4";
5
5
  import type { ColorInput } from "../../core/color";
6
6
  import { type TweenMeta } from "./spec";
7
- /** What `animate()` tweens: a number, a color (string / packed / rgb(a) array — delivered as rgba
8
- * 0..1), a 2 / 3-vector, a quaternion (slerp), or a 4x4 matrix (position / rotation / scale). */
7
+ /** What `animate()` tweens: a number (a FLOAT, never a packed color), a color (any CSS color string,
8
+ * through `Color` — delivered as rgba 0..1; a string that is not a color throws), a 2 / 3-vector (a
9
+ * 3-array is a vector, not a color), a quaternion (slerp), or a 4x4 matrix (position / rotation /
10
+ * scale). */
9
11
  export type AnimateValue = number | string | Vec2Like | Vec3Like | QuatLike | Mat4Like | ColorInput;
10
12
  /** `onUpdate` receives a number for a number; every other kind arrives as the SAME `Float32Array`
11
13
  * every frame (overwritten in place — copy it if you keep it). A matrix is the 16 floats. */
@@ -19,6 +19,14 @@ export type EasingInput = string | readonly [number, number, number, number] | E
19
19
  /** id → (name, formula). The formulas are the standard easings.net set; creator-tween's
20
20
  * `ctweenEaseNamed` implements the same list by id. */
21
21
  export declare const NAMED_EASINGS: ReadonlyArray<readonly [string, Easing]>;
22
+ /** The CSS `ease-in-out` curve — also UIKit's default animation curve, and web-lite's transition
23
+ * default: what every host tweened with before the keyframe core. */
24
+ export declare const CSS_EASE_IN_OUT: [number, number, number, number];
25
+ export declare const LINEAR: EasingSpec;
26
+ /** The default of every track with a TARGET (`animateTo` / `animateFrom` / `Timeline.add` on an
27
+ * element, a 3D / 2D object): `ease-in-out` (2026-09-27; linear before). `animate()` — a raw
28
+ * progress the app maps itself — stays linear. Write `easing: "linear"` for uniform motion. */
29
+ export declare const DEFAULT_EASING: EasingSpec;
22
30
  /** Sample an `Easing` function into a table. Endpoints are forced exact so a curve that is
23
31
  * numerically 0.9999 at 1 still lands on the keyframe. */
24
32
  export declare const sampleEasing: (fn: Easing) => Float32Array;
@@ -89,7 +89,8 @@ export type TweenMeta = {
89
89
  delay?: number;
90
90
  /** A curve for every prop, or a per-prop map (`{ width: 'outExpo', opacity: 'linear' }`). Names
91
91
  * (`outCubic`, `inOutSine`, `outBack`, …), `cubic-bezier(…)` / a `[x1, y1, x2, y2]` tuple,
92
- * `steps(n)`, or any `Easing` function. Default linear. */
92
+ * `steps(n)`, or any `Easing` function. Default `ease-in-out` (cubic-bezier(0.42, 0, 0.58, 1),
93
+ * the curve UIKit and CSS transitions ease with); `"linear"` for uniform motion. */
93
94
  easing?: EasingInput | Record<string, EasingInput>;
94
95
  /** Keyframe offsets 0..1 for array-valued props (default: evenly spaced). */
95
96
  times?: number[];
@@ -107,20 +108,27 @@ export type TweenMeta = {
107
108
  };
108
109
  export declare const DEFAULT_DURATION_MS = 225;
109
110
  export declare const warnOnce: (key: string, msg: string) => void;
110
- /** Resolve the per-prop easing from the bag. */
111
- export declare const easingFor: (easing: TweenMeta["easing"], prop: string) => EasingSpec;
111
+ /** Resolve the per-prop easing from the bag; nothing given (or no entry for `prop` in a per-prop
112
+ * map) = `fallback` — the tracks' DEFAULT_EASING, linear for a value tween. */
113
+ export declare const easingFor: (easing: TweenMeta["easing"], prop: string, fallback?: EasingSpec) => EasingSpec;
112
114
  /** Iteration count from `loop`: 1 = one-shot, -1 = forever, n = cycles. */
113
115
  export declare const iterationsOf: (loop: TweenMeta["loop"]) => number;
114
116
  /** A UI style value: number → FLOAT; "12px" / "50%" → FLOAT_UNIT; other strings → STRING (the host
115
- * decides color vs discrete); booleans → DISCRETE. */
117
+ * decides color vs discrete); booleans → DISCRETE. The element hands over the WIRE value
118
+ * (UINode._tweenChannel): a color key arrives as a string, never a packed number. */
116
119
  export declare const uiValue: (v: unknown) => ({
117
120
  kind: number;
118
121
  sig?: string;
119
122
  } & TweenValue) | null;
120
123
  /** Parse `"translate(10px, 20px) rotate(45deg) scale(1.2)"` into a signature + lanes, or null when a
121
124
  * function is unknown (the caller falls back to matrix decomposition on the host). `scale(2)` and
122
- * `translate(5px)` complete their second argument like CSS. */
123
- export declare const parseTransformList: (s: string) => {
125
+ * `translate(5px)` complete their second argument like CSS.
126
+ *
127
+ * `percent`: a `%` in a translate is a percent of the target's box (`translateX(100%)` →
128
+ * `translateX%` [100]; a translate mixing the units splits into its two axes). Without it a `%`
129
+ * reads as px, as the style's own parser reads it — with a warning: only a screen transition
130
+ * measures a translate in percents. */
131
+ export declare const parseTransformList: (s: string, percent?: boolean) => {
124
132
  sig: string;
125
133
  lanes: number[];
126
134
  } | null;
@@ -173,6 +181,6 @@ export type TweenBlob = {
173
181
  strings: string[];
174
182
  targets: unknown[];
175
183
  };
176
- /** Flatten a spec for `_creatorUI.tweenCreate`. Tracks whose target has no host id right now are
184
+ /** Flatten a spec for `_creatorTree.tweenCreate`. Tracks whose target has no host id right now are
177
185
  * dropped (the animation still runs its clock, calls and finish). */
178
186
  export declare const buildBlob: (spec: TweenSpec) => TweenBlob;
@@ -56,7 +56,8 @@ declare class AudioSystem {
56
56
  get supported(): boolean;
57
57
  /** HRTF binaural rendering (MIT KEMAR filters on the CPU): sounds get a real up / down / behind in
58
58
  * HEADPHONES. Off by default — on speakers it only smears the image. Applies to the `hrtfVoices`
59
- * nearest 3D voices; the rest keep plain panning. */
59
+ * nearest 3D voices; the rest keep plain panning. A host built without the filters (an iOS App
60
+ * Clip: they are 184 KB) keeps every voice on the panner — `stats.hrtfVoices` stays 0. */
60
61
  get hrtf(): boolean;
61
62
  set hrtf(v: boolean);
62
63
  /** `Time.scale` also pitches the sfx bus: slow motion drops every effect's tone, like a film. Default
@@ -1,59 +1,26 @@
1
1
  import { Texture2D } from "../g2/Texture2D";
2
2
  import { File, type FetchResponse } from "../runtime/fetch";
3
3
  import type { SvgSourceValue } from "../runtime/misc";
4
- declare const ALIGN: {
5
- readonly left: 0;
6
- readonly center: 1;
7
- readonly right: 2;
8
- readonly start: 3;
9
- readonly end: 4;
10
- };
11
- declare const BASELINE: {
12
- readonly alphabetic: 0;
13
- readonly top: 1;
14
- readonly middle: 2;
15
- readonly bottom: 3;
16
- readonly hanging: 4;
17
- readonly ideographic: 5;
18
- };
19
- declare const JOIN: {
20
- readonly miter: 0;
21
- readonly round: 1;
22
- readonly bevel: 2;
23
- };
24
- declare const CAP: {
25
- readonly butt: 0;
26
- readonly round: 1;
27
- readonly square: 2;
28
- };
29
- export type TextAlign = keyof typeof ALIGN;
30
- export type TextBaseline = keyof typeof BASELINE;
31
- export type LineJoin = keyof typeof JOIN;
32
- export type LineCap = keyof typeof CAP;
4
+ import { Recorder, Gradient, type ImageRef, type TextAlignName, type TextBaselineName, type LineJoinName, type LineCapName, type FillRuleName } from "./gen/recorder";
5
+ export { Gradient };
6
+ export type TextAlign = TextAlignName;
7
+ export type TextBaseline = TextBaselineName;
8
+ export type LineJoin = LineJoinName;
9
+ export type LineCap = LineCapName;
10
+ export type FillRule = FillRuleName;
33
11
  export interface CanvasTextMetrics {
34
12
  width: number;
35
13
  ascent: number;
36
14
  descent: number;
37
15
  }
38
- export declare class Canvas {
16
+ export declare class Canvas extends Recorder {
39
17
  /** Brand so `Sprite`/`UIImage`/`Material` can accept a Canvas anywhere a texture source is expected. */
40
18
  readonly __canvas: true;
41
19
  width: number;
42
20
  height: number;
43
21
  /** Device-pixel multiplier (draw at 2 for crisp retina text). Applied by the backend. */
44
22
  pixelRatio: number;
45
- private _cmd;
46
- private _refs;
47
- private _globalAlpha;
48
- private _fillStyle;
49
- private _strokeStyle;
50
- private _lineWidth;
51
- private _lineJoin;
52
- private _lineCap;
53
- private _font;
54
- private _textAlign;
55
- private _textBaseline;
56
- private _surfaceId;
23
+ private _drawn?;
57
24
  private _tex2d?;
58
25
  private _uiBound;
59
26
  private _lastBakeLen;
@@ -61,71 +28,32 @@ export declare class Canvas {
61
28
  constructor(width: number, height: number, opts?: {
62
29
  pixelRatio?: number;
63
30
  });
64
- private _ref;
65
- /** Discard the recorded drawing to start a new one (for dynamic canvases). */
66
- reset(): this;
67
31
  /** Change the surface size; takes effect on the next bake. */
68
32
  resize(width: number, height: number): this;
69
- save(): this;
70
- restore(): this;
71
- translate(x: number, y: number): this;
72
- scale(sx: number, sy: number): this;
73
- rotate(rad: number): this;
74
- get globalAlpha(): number;
75
- set globalAlpha(a: number);
76
- get fillStyle(): string;
77
- set fillStyle(color: string);
78
- get strokeStyle(): string;
79
- set strokeStyle(color: string);
80
- get lineWidth(): number;
81
- set lineWidth(w: number);
82
- get lineJoin(): LineJoin;
83
- set lineJoin(j: LineJoin);
84
- get lineCap(): LineCap;
85
- set lineCap(c: LineCap);
86
- get font(): string;
87
- set font(f: string);
88
- get textAlign(): TextAlign;
89
- set textAlign(a: TextAlign);
90
- get textBaseline(): TextBaseline;
91
- set textBaseline(b: TextBaseline);
92
- beginPath(): this;
93
- closePath(): this;
94
- moveTo(x: number, y: number): this;
95
- lineTo(x: number, y: number): this;
96
- quadraticCurveTo(cx: number, cy: number, x: number, y: number): this;
97
- bezierCurveTo(c1x: number, c1y: number, c2x: number, c2y: number, x: number, y: number): this;
98
- arc(x: number, y: number, r: number, a0: number, a1: number, ccw?: boolean): this;
99
- rect(x: number, y: number, w: number, h: number): this;
100
- roundRect(x: number, y: number, w: number, h: number, r: number): this;
101
- fill(evenOdd?: boolean): this;
102
- stroke(): this;
103
- fillRect(x: number, y: number, w: number, h: number): this;
104
- strokeRect(x: number, y: number, w: number, h: number): this;
105
- clearRect(x: number, y: number, w: number, h: number): this;
106
- fillText(text: string, x: number, y: number, maxWidth?: number): this;
107
- strokeText(text: string, x: number, y: number, maxWidth?: number): this;
108
- /** Blit a `Bitmap` (a snapshot from `toBitmap()`) onto this canvas. All coordinates are LOGICAL —
109
- * including the source sub-rect in the 9-arg form (it's scaled by the bitmap's pixelRatio here).
110
- * Records a DRAW_IMAGE op, so the blit runs at bake time: keep the Bitmap alive until the next
111
- * `update()`/`toBitmap()`/`texture()`. Three browser-style forms:
33
+ /** Blit a `Bitmap` (a snapshot from `toBitmap()` or `loadImage()`) onto this canvas. All coordinates
34
+ * are LOGICAL — including the source sub-rect in the 9-arg form (it's scaled by the bitmap's
35
+ * pixelRatio here). Records a DRAW_IMAGE op, so the blit runs at bake time; the canvas keeps the
36
+ * Bitmap alive until `reset()` removes the op. Three browser-style forms:
112
37
  * drawImage(bmp, dx, dy) — whole bitmap at its natural size
113
38
  * drawImage(bmp, dx, dy, dw, dh) — whole bitmap, scaled into dw×dh
114
39
  * drawImage(bmp, sx, sy, sw, sh, dx, dy, dw, dh) — a sub-rect of the bitmap, scaled into dw×dh */
115
- drawImage(img: Bitmap, dx: number, dy: number): this;
116
- drawImage(img: Bitmap, dx: number, dy: number, dw: number, dh: number): this;
117
- drawImage(img: Bitmap, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): this;
40
+ drawImage(img: Bitmap | ImageRef, dx: number, dy: number): this;
41
+ drawImage(img: Bitmap | ImageRef, dx: number, dy: number, dw: number, dh: number): this;
42
+ drawImage(img: Bitmap | ImageRef, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): this;
118
43
  /** Decode an image source into a standalone `Bitmap` you can blit with `drawImage()` — either an
119
- * `SvgSource(...)` (rasterized) or a `FetchResponse` holding already-fetched image bytes (decoded).
120
- * This is async because turning SVG markup / encoded bytes into pixels needs a decode step (on the
121
- * web, `createImageBitmap` / an `<img>` load); `await` it ONCE, then `drawImage(bitmap, …)` is
122
- * synchronous and the Bitmap is reusable. The returned Bitmap owns a native surface at the image's
123
- * natural pixel size (`pixelRatio` 1) — `destroy()` it when done. Typical use:
44
+ * `SvgSource(...)` (drawn by the core, painted by the host) or a `FetchResponse` holding already-fetched
45
+ * image bytes (decoded; an SVG file is detected). This is async because the web host decodes with the
46
+ * browser; `await` it ONCE, then `drawImage(bitmap, …)` is synchronous and the Bitmap is reusable. The
47
+ * returned Bitmap owns a native surface at the image's natural pixel size (`pixelRatio` 1), freed
48
+ * once nothing references the Bitmap (`destroy()` frees it early). Typical use:
124
49
  * const logo = await canvas.loadImage(SvgSource(svg)) // or: await fetch(url) → the response
125
50
  * canvas.drawImage(logo, 0, 0) // sync, blit as often as you like */
126
51
  loadImage(source: SvgSourceValue | FetchResponse): Promise<Bitmap>;
127
- /** Measure `text` in the current font on THIS platform. The one synchronous round-trip. */
52
+ /** Measure `text` in the current font and letterSpacing on THIS platform. The one synchronous
53
+ * round-trip. */
128
54
  measureText(text: string): CanvasTextMetrics;
55
+ /** Discard the recording (and the Bitmaps its drawImage ops kept alive). */
56
+ reset(): this;
129
57
  /** Bake and return the 2D texture (created once, then cached). */
130
58
  texture(): Texture2D;
131
59
  /** Re-rasterize and re-upload to every texture this canvas produced (call after redrawing) — the
@@ -133,38 +61,42 @@ export declare class Canvas {
133
61
  update(): this;
134
62
  /** Copy the current pixels into a standalone, immutable `Bitmap` — independent of this canvas, so
135
63
  * later drawing/`reset()` never touches it. Draw it back with `drawImage()`, export it with
136
- * `toDataURL()`, or use it to "flatten" an ever-growing drawing so re-bakes stay O(1):
137
- * const snap = canvas.toBitmap()
138
- * canvas.reset(); canvas.drawImage(snap, 0, 0) // one op replaces the whole history
139
- * // …keep drawing on top; snap.destroy() once it's been drawn in. */
64
+ * `toFile()`, or use it to "flatten" an ever-growing drawing so re-bakes stay O(1):
65
+ * const next = canvas.toBitmap() // bakes with the previous snapshot still alive
66
+ * canvas.reset(); canvas.drawImage(next, 0, 0) // one op replaces the whole history
67
+ * The canvas keeps a drawn Bitmap alive while its drawImage is recorded, and the old snapshot goes
68
+ * on its own once reset() dropped it — no destroy() needed. */
140
69
  toBitmap(): Bitmap;
141
70
  /** Encode the current pixels to an image `File` — 'image/png' (default) or 'image/jpeg'. The File
142
71
  * is an opaque host buffer handle (`name`/`size` only): append it to a FormData to upload, load it
143
72
  * as a texture (`Texture2D.load(file)`), or hand it to a share/save sheet. */
144
73
  toFile(name?: string, type?: string): Promise<File>;
74
+ /** Free the surface now instead of when the canvas is dropped (an image still showing it goes blank).
75
+ * The recording stays: a later bake makes a new surface. */
145
76
  destroy(): void;
146
77
  }
147
78
  /** Duck-type guard so consumers can accept a Canvas anywhere a texture source is expected. */
148
79
  export declare const isCanvas: (v: unknown) => v is Canvas;
149
- /** An immutable RGBA8 snapshot of a canvas, produced by `Canvas.toBitmap()`. It owns its own baked
150
- * surface (a copy), so the source canvas can keep drawing or `reset()` without affecting it. Use it
151
- * to stamp/blit back (`canvas.drawImage(bitmap, …)`), to export (`bitmap.toDataURL()`), or as a
152
- * cheap "layer" you composite. Call `destroy()` when done — it holds a native surface. */
80
+ /** An immutable RGBA8 snapshot of a canvas, produced by `Canvas.toBitmap()` / `loadImage()`. It owns its
81
+ * own baked surface (a copy), so the source canvas can keep drawing or `reset()` without affecting it.
82
+ * Use it to stamp/blit back (`canvas.drawImage(bitmap, …)`), to export (`bitmap.toFile()`), or as a
83
+ * cheap "layer" you composite. Its surface is freed once nothing references the Bitmap (a canvas that
84
+ * drew it keeps it until `reset()`); `destroy()` frees it early. */
153
85
  export declare class Bitmap {
154
86
  readonly __bitmap: true;
155
87
  /** Logical width, matching the Canvas it was captured from (pixelRatio is crispness, not size). */
156
88
  readonly width: number;
157
89
  readonly height: number;
158
90
  readonly pixelRatio: number;
159
- constructor(surfaceId: number, width: number, height: number, pixelRatio: number);
91
+ constructor(surface: Handle | number | null, width: number, height: number, pixelRatio: number);
160
92
  /** Device-pixel dimensions of the stored bitmap (`width * pixelRatio`, rounded). */
161
93
  get pixelWidth(): number;
162
94
  get pixelHeight(): number;
163
95
  /** Encode to an image `File` — 'image/png' (default) or 'image/jpeg'. See `Canvas.toFile`. */
164
96
  toFile(name?: string, type?: string): Promise<File>;
165
- /** Free the native surface. The bitmap must not be drawn or encoded afterwards. */
97
+ /** Free the native surface now instead of when the bitmap is dropped. It must not be drawn or encoded
98
+ * afterwards (a canvas whose recording still draws it blits nothing). */
166
99
  destroy(): void;
167
100
  }
168
101
  /** Duck-type guard for a Bitmap (see `isCanvas`). */
169
102
  export declare const isBitmap: (v: unknown) => v is Bitmap;
170
- export {};
@@ -0,0 +1,17 @@
1
+ /** A color: straight float32 RGBA, 0..1. */
2
+ export interface CssRgba {
3
+ r: number;
4
+ g: number;
5
+ b: number;
6
+ a: number;
7
+ }
8
+ /** The named colors as 0xRRGGBBAA: the 148 CSS Color 4 names, transparent and clear (= transparent). */
9
+ export declare const CSS_COLOR_NAMES: Readonly<Record<string, number>>;
10
+ /** A CSS color → straight float32 RGBA, or null when `input` is not a color. */
11
+ export declare const parseCssColor: (input: string) => CssRgba | null;
12
+ /** A float channel → a byte, as the header's toByte: float32, clamp (NaN → 0), round half up (0.5 → 128). */
13
+ export declare const cssToByte: (v: number) => number;
14
+ /** 0xRRGGBBAA (unsigned). */
15
+ export declare const cssRgba8: (c: CssRgba) => number;
16
+ /** '#rrggbbaa', lower-case. */
17
+ export declare const cssHex8: (c: CssRgba) => string;
@@ -0,0 +1,118 @@
1
+ export type FillRuleName = "nonzero" | "evenodd";
2
+ export type LineJoinName = "miter" | "round" | "bevel";
3
+ export type LineCapName = "butt" | "round" | "square";
4
+ export type TextAlignName = "left" | "center" | "right" | "start" | "end";
5
+ export type TextBaselineName = "alphabetic" | "top" | "middle" | "bottom" | "hanging" | "ideographic";
6
+ /** A gradient built by createLinearGradient / createRadialGradient; assign it to fillStyle / strokeStyle. */
7
+ export declare class Gradient {
8
+ readonly stops: {
9
+ offset: number;
10
+ color: string;
11
+ }[];
12
+ readonly kind: number;
13
+ readonly coords: [number, number, number, number, number, number];
14
+ addColorStop(offset: number, color: string): this;
15
+ }
16
+ /** The recorded stream: the f32 words and the string table the core reads. */
17
+ export interface Stream {
18
+ cmd: Float32Array;
19
+ refs: string[];
20
+ }
21
+ /** A surface with its device size, for the short drawImage forms. */
22
+ export interface ImageRef {
23
+ surface: number;
24
+ width: number;
25
+ height: number;
26
+ }
27
+ export declare class Recorder {
28
+ private cmd;
29
+ private refs;
30
+ private refIndex;
31
+ private _globalAlpha;
32
+ private _fillStyle;
33
+ private _strokeStyle;
34
+ private _lineWidth;
35
+ private _lineJoin;
36
+ private _lineCap;
37
+ private _miterLimit;
38
+ private _lineDash;
39
+ private _lineDashOffset;
40
+ private _font;
41
+ private _textAlign;
42
+ private _textBaseline;
43
+ private _letterSpacing;
44
+ private _saved;
45
+ /** The words recorded so far (a copy) + the string table. */
46
+ stream(): Stream;
47
+ /** Plain arrays, for a JSON file (the golden tests' input). */
48
+ toJSON(): {
49
+ cmd: number[];
50
+ refs: string[];
51
+ };
52
+ /** The number of words recorded. */
53
+ get length(): number;
54
+ /** Discard the recording; the shadowed state is reset too (a fresh replay starts from defaults). */
55
+ reset(): this;
56
+ private ref;
57
+ private push;
58
+ save(): this;
59
+ restore(): this;
60
+ translate(x: number, y: number): this;
61
+ scale(sx: number, sy: number): this;
62
+ rotate(rad: number): this;
63
+ transform(a: number, b: number, c: number, d: number, e: number, f: number): this;
64
+ setTransform(a: number, b: number, c: number, d: number, e: number, f: number): this;
65
+ resetTransform(): this;
66
+ get globalAlpha(): number;
67
+ set globalAlpha(a: number);
68
+ get fillStyle(): string | Gradient;
69
+ set fillStyle(v: string | Gradient);
70
+ get strokeStyle(): string | Gradient;
71
+ set strokeStyle(v: string | Gradient);
72
+ private style;
73
+ createLinearGradient(x0: number, y0: number, x1: number, y1: number): Gradient;
74
+ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): Gradient;
75
+ get lineWidth(): number;
76
+ set lineWidth(w: number);
77
+ get lineJoin(): LineJoinName;
78
+ set lineJoin(j: LineJoinName);
79
+ get lineCap(): LineCapName;
80
+ set lineCap(c: LineCapName);
81
+ get miterLimit(): number;
82
+ set miterLimit(m: number);
83
+ setLineDash(segments: number[]): this;
84
+ getLineDash(): number[];
85
+ get lineDashOffset(): number;
86
+ set lineDashOffset(o: number);
87
+ get font(): string;
88
+ set font(f: string);
89
+ get textAlign(): TextAlignName;
90
+ set textAlign(a: TextAlignName);
91
+ get textBaseline(): TextBaselineName;
92
+ set textBaseline(b: TextBaselineName);
93
+ get letterSpacing(): number;
94
+ set letterSpacing(px: number);
95
+ beginPath(): this;
96
+ closePath(): this;
97
+ moveTo(x: number, y: number): this;
98
+ lineTo(x: number, y: number): this;
99
+ quadraticCurveTo(cx: number, cy: number, x: number, y: number): this;
100
+ bezierCurveTo(c1x: number, c1y: number, c2x: number, c2y: number, x: number, y: number): this;
101
+ arc(x: number, y: number, r: number, a0: number, a1: number, ccw?: boolean): this;
102
+ arcTo(x1: number, y1: number, x2: number, y2: number, r: number): this;
103
+ ellipse(x: number, y: number, rx: number, ry: number, rotation: number, a0: number, a1: number, ccw?: boolean): this;
104
+ rect(x: number, y: number, w: number, h: number): this;
105
+ roundRect(x: number, y: number, w: number, h: number, r: number): this;
106
+ fill(rule?: FillRuleName): this;
107
+ stroke(): this;
108
+ clip(rule?: FillRuleName): this;
109
+ fillRect(x: number, y: number, w: number, h: number): this;
110
+ strokeRect(x: number, y: number, w: number, h: number): this;
111
+ clearRect(x: number, y: number, w: number, h: number): this;
112
+ fillText(text: string, x: number, y: number, maxWidth?: number): this;
113
+ strokeText(text: string, x: number, y: number, maxWidth?: number): this;
114
+ /** Blit a surface. Three browser-style forms; the source rect is in the surface's device px. */
115
+ drawImage(img: ImageRef, dx: number, dy: number): this;
116
+ drawImage(img: ImageRef, dx: number, dy: number, dw: number, dh: number): this;
117
+ drawImage(img: ImageRef, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): this;
118
+ }