lecodes-sdk 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/global.d.ts +18 -4
  2. package/dist/types/animate/tween/Animation.d.ts +69 -0
  3. package/dist/types/animate/tween/Timeline.d.ts +55 -0
  4. package/dist/types/animate/tween/animateValue.d.ts +27 -0
  5. package/dist/types/animate/tween/easing.d.ts +29 -0
  6. package/dist/types/animate/tween/spec.d.ts +178 -0
  7. package/dist/types/g2/Node2D.d.ts +16 -0
  8. package/dist/types/g2/Sprite.d.ts +11 -1
  9. package/dist/types/gl/Camera.d.ts +15 -1
  10. package/dist/types/gl/Foliage.d.ts +47 -0
  11. package/dist/types/gl/Geometry.d.ts +24 -0
  12. package/dist/types/gl/Light.d.ts +25 -7
  13. package/dist/types/gl/Lightmap.d.ts +90 -60
  14. package/dist/types/gl/Material.d.ts +28 -20
  15. package/dist/types/gl/Model.d.ts +7 -5
  16. package/dist/types/gl/Node.d.ts +18 -0
  17. package/dist/types/gl/Particles.d.ts +40 -1
  18. package/dist/types/gl/Scene.d.ts +20 -0
  19. package/dist/types/gl/animation/AnimationClip.d.ts +19 -0
  20. package/dist/types/gl/animation/Animator.d.ts +27 -0
  21. package/dist/types/gl/animation/DynamicBone.d.ts +19 -8
  22. package/dist/types/gl/animation/IK.d.ts +86 -30
  23. package/dist/types/gl/animation/Warp.d.ts +2 -1
  24. package/dist/types/gl/animation/core.d.ts +35 -4
  25. package/dist/types/gl/physics/Ragdoll.d.ts +87 -12
  26. package/dist/types/gl/terrain/Terrain.d.ts +4 -2
  27. package/dist/types/inject.d.ts +8 -2
  28. package/dist/types/scene/defineScene.d.ts +44 -32
  29. package/dist/types/ui/UIButton.d.ts +3 -1
  30. package/dist/types/ui/UIInput.d.ts +5 -1
  31. package/dist/types/ui/UINode.d.ts +24 -24
  32. package/dist/types.json +1 -1
  33. package/package.json +1 -1
  34. package/prompts/core-design.md +27 -4
  35. package/prompts/core.md +35 -6
  36. package/prompts/select.ts +19 -4
  37. package/src/animate/tween/Animation.ts +378 -0
  38. package/src/animate/tween/Timeline.ts +175 -0
  39. package/src/animate/tween/animateValue.ts +100 -0
  40. package/src/animate/tween/easing.ts +172 -0
  41. package/src/animate/tween/spec.ts +479 -0
  42. package/src/bridges.d.ts +226 -65
  43. package/src/compile/__tests__/assetMacro.test.ts +26 -0
  44. package/src/compile/__tests__/detectEntry.test.ts +19 -0
  45. package/src/compile/__tests__/serverSplit.test.ts +27 -0
  46. package/src/compile/bundler.ts +34 -4
  47. package/src/compile/compileProject.ts +31 -1
  48. package/src/compile/detectEntry.ts +8 -3
  49. package/src/compile/index.ts +2 -0
  50. package/src/compile/serverSplit.ts +9 -3
  51. package/src/g2/Node2D.ts +38 -0
  52. package/src/g2/Sprite.ts +20 -1
  53. package/src/gl/Camera.ts +34 -1
  54. package/src/gl/Foliage.ts +102 -0
  55. package/src/gl/Geometry.ts +393 -348
  56. package/src/gl/Light.ts +46 -16
  57. package/src/gl/Lightmap.ts +439 -275
  58. package/src/gl/Material.ts +59 -47
  59. package/src/gl/Model.ts +167 -156
  60. package/src/gl/Node.ts +39 -0
  61. package/src/gl/Particles.ts +61 -2
  62. package/src/gl/Scene.ts +34 -1
  63. package/src/gl/animation/AnimationClip.ts +52 -0
  64. package/src/gl/animation/Animator.ts +42 -2
  65. package/src/gl/animation/DynamicBone.ts +482 -459
  66. package/src/gl/animation/IK.ts +173 -152
  67. package/src/gl/animation/Playback.ts +5 -4
  68. package/src/gl/animation/Warp.ts +5 -2
  69. package/src/gl/animation/core.ts +65 -4
  70. package/src/gl/physics/Ragdoll.ts +451 -272
  71. package/src/gl/terrain/Terrain.ts +4 -2
  72. package/src/inject.ts +12 -2
  73. package/src/scene/defineScene.ts +72 -62
  74. package/src/ui/UIButton.ts +2 -2
  75. package/src/ui/UIInput.ts +3 -3
  76. package/src/ui/UINode.ts +61 -36
  77. package/dist/types/animate/animate.d.ts +0 -20
  78. package/src/animate/animate.ts +0 -238
@@ -1,4 +1,6 @@
1
1
  import type { FetchResponse } from "../runtime/fetch";
2
+ import type { Animation } from "../animate/tween/Animation";
3
+ import { type TweenMeta } from "../animate/tween/spec";
2
4
  export interface UINode {
3
5
  readonly type: string;
4
6
  /** Author-given semantic name (a stable selector for tests + AI review feedback). */
@@ -158,8 +160,12 @@ export type TextStyle = {
158
160
  export type Reactive<T> = {
159
161
  [K in keyof T]: NonNullable<T[K]> extends object ? T[K] : T[K] | (() => T[K]);
160
162
  };
163
+ /** The curve of a state block's swap (`$class` / `onPressed` / `onFocused` with a `duration`): a
164
+ * curve name (`outCubic`, `inOutSine`, `smoothstep` — the default — …), `cubic-bezier(x1,y1,x2,y2)`
165
+ * or `steps(n)`. A function cannot ride a style block; use `animateTo` for those. */
166
+ export type LayerEasing = string;
161
167
  /** User-defined style classes: any `$`-prefixed key in `.style()` declares a state block toggled
162
- * from code via the `el.class` proxy; `duration`/`delay` animate the swap. Class state INHERITS
168
+ * from code via the `el.class` proxy; `duration`/`delay`/`easing` animate the swap. Class state INHERITS
163
169
  * down the tree (CSS-`.dark`-on-body style): a class set on a node also activates same-name `$`
164
170
  * blocks on all descendants within the same root (docs/style-class-cascade-plan.md).
165
171
  * `$pressed`/`$focused` are reserved — hosts toggle them on press/focus (they beat other
@@ -172,6 +178,7 @@ export type ClassStyles<T> = {
172
178
  [key: `$${string}`]: T & {
173
179
  duration?: number;
174
180
  delay?: number;
181
+ easing?: LayerEasing;
175
182
  };
176
183
  };
177
184
  /** Value accepted by a `el.class` write: a boolean sets the class, a `() => boolean` binds it —
@@ -245,25 +252,15 @@ export type StyleFn<R, T extends object> = ((style: Reactive<T> & OrientationSty
245
252
  * chaining — and per-key readable/writable (`el.style.opacity = 0.5`; a `() => value` write
246
253
  * installs a reactive binding). */
247
254
  export type Style<R, T extends object> = StyleFn<R, T> & T & OrientationStyles<T> & ClassStyles<T>;
248
- /** The `animateTo`/`animateFrom` surface: target style props plus the flat meta keys below
249
- * (stripped before the commit into the element's style). */
250
- export type AnimateStyle<R, T extends object> = ((style: T & {
251
- /** Tween length in **milliseconds** (default 225). */
252
- duration?: number;
253
- /** Wait before starting, in **milliseconds**. A looping animation delays once, not per cycle. */
254
- delay?: number;
255
- /** Escape hatch: target an internal style layer (the onPressed/orientation mechanism). Not part of the supported surface. */
256
- layer?: number;
257
- /** `false` = animate without writing the targets into the element's style (e.g. a fade-out right before `.hide()`). */
258
- commit?: boolean;
259
- /** Repeat the animation: `true` = forever, a number = that many cycles. A looping animation is an
260
- * effect, not a state change — it never commits, and the element ends back at its base style.
261
- * The loop stops when a later `animateTo`/`animateFrom` runs on the element or it leaves the screen. */
262
- loop?: boolean | number;
263
- /** `"ping-pong"` (default) animates there and back each cycle — no jump. `"restart"` snaps back and
264
- * replays forward — for full-turn spinners (`transform: "rotate(360deg)"`) and shimmers. Only meaningful with `loop`. */
265
- loopMode?: "restart" | "ping-pong";
266
- }) => R);
255
+ /** Style props of an animate bag: a single value (tween from the current value) or an array of
256
+ * KEYFRAMES (`opacity: [1, 0.3, 1]`, offsets via `times`). */
257
+ export type AnimateProps<T extends object> = {
258
+ [K in keyof T]?: T[K] | T[K][];
259
+ };
260
+ /** The `animateTo`/`animateFrom` surface: target style props (single values or keyframe arrays) plus
261
+ * the flat meta keys — `duration` / `delay` / `easing` / `times` / `loop` / `loopMode` / `commit` /
262
+ * `clock`, see {@link TweenMeta}. Returns the {@link Animation} handle (seek, rate, `finished`). */
263
+ export type AnimateStyle<R, T extends object> = ((style: AnimateProps<T> & TweenMeta) => Animation);
267
264
  export type AppearStyle<R, T> = (arg: {
268
265
  from: T;
269
266
  duration?: number;
@@ -306,10 +303,13 @@ export declare class Element<T extends string> {
306
303
  constructor(type: T, style: any);
307
304
  get style(): any;
308
305
  /** Tween to the target style and commit it (unless `commit: false` or looping — a loop is an
309
- * effect, not a state change). Meta keys: `duration`/`delay`/`loop`/… — see {@link AnimateStyle}. */
310
- animateTo(style: any): this;
311
- /** Tween FROM the given style to the element's current one (entrance animations). */
312
- animateFrom(style: any): this;
306
+ * effect, not a state change). A prop value may be an array of keyframes; meta keys
307
+ * `duration`/`delay`/`easing`/`times`/`loop`/… — see {@link AnimateStyle}. Returns the
308
+ * {@link Animation} handle. */
309
+ animateTo(style: any): Animation;
310
+ /** Tween FROM the given style to the element's current one (entrance animations): the element's
311
+ * own style is the implicit last keyframe. Never modifies the stored style. */
312
+ animateFrom(style: any): Animation;
313
313
  protected _classProxy?: any;
314
314
  /** Style-class control — flips the `$`-class blocks declared in `.style()`. One proxy, same
315
315
  * contract as `el.style`: