lecodes-sdk 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/global.d.ts +18 -4
- package/dist/inject.js +260 -361
- package/dist/types/animate/tween/Animation.d.ts +69 -0
- package/dist/types/animate/tween/Timeline.d.ts +55 -0
- package/dist/types/animate/tween/animateValue.d.ts +27 -0
- package/dist/types/animate/tween/easing.d.ts +29 -0
- package/dist/types/animate/tween/spec.d.ts +178 -0
- package/dist/types/g2/Node2D.d.ts +16 -0
- package/dist/types/g2/Sprite.d.ts +11 -1
- package/dist/types/gl/Camera.d.ts +15 -1
- package/dist/types/gl/Foliage.d.ts +47 -0
- package/dist/types/gl/Geometry.d.ts +24 -0
- package/dist/types/gl/Light.d.ts +28 -7
- package/dist/types/gl/Lightmap.d.ts +90 -60
- package/dist/types/gl/Material.d.ts +28 -20
- package/dist/types/gl/Model.d.ts +7 -5
- package/dist/types/gl/Node.d.ts +18 -0
- package/dist/types/gl/Particles.d.ts +55 -1
- package/dist/types/gl/Scene.d.ts +20 -0
- package/dist/types/gl/animation/AnimationClip.d.ts +19 -0
- package/dist/types/gl/animation/Animator.d.ts +27 -0
- package/dist/types/gl/animation/DynamicBone.d.ts +19 -8
- package/dist/types/gl/animation/IK.d.ts +86 -30
- package/dist/types/gl/animation/Locomotion.d.ts +52 -3
- package/dist/types/gl/animation/Warp.d.ts +2 -1
- package/dist/types/gl/animation/core.d.ts +35 -4
- package/dist/types/gl/physics/Ragdoll.d.ts +87 -12
- package/dist/types/gl/terrain/Terrain.d.ts +12 -2
- package/dist/types/inject.d.ts +8 -2
- package/dist/types/runtime/input.d.ts +7 -0
- package/dist/types/scene/defineScene.d.ts +44 -32
- package/dist/types/ui/UIButton.d.ts +3 -1
- package/dist/types/ui/UIInput.d.ts +5 -1
- package/dist/types/ui/UINode.d.ts +24 -24
- package/dist/types.json +1 -1
- package/package.json +1 -1
- package/prompts/README.md +142 -142
- package/prompts/core-design.md +27 -4
- package/prompts/core.md +35 -6
- package/prompts/dist/2d-game.md +197 -408
- package/prompts/dist/3d-app.md +166 -491
- package/prompts/dist/ar-app.md +163 -373
- package/prompts/dist/design.md +87 -83
- package/prompts/dist/ui-app.md +136 -325
- package/prompts/select.ts +19 -4
- package/src/animate/tween/Animation.ts +378 -0
- package/src/animate/tween/Timeline.ts +175 -0
- package/src/animate/tween/animateValue.ts +100 -0
- package/src/animate/tween/easing.ts +172 -0
- package/src/animate/tween/spec.ts +479 -0
- package/src/audio/audio.ts +161 -161
- package/src/bridges.d.ts +235 -65
- package/src/compile/__tests__/assetMacro.test.ts +26 -0
- package/src/compile/__tests__/detectEntry.test.ts +19 -0
- package/src/compile/__tests__/serverSplit.test.ts +27 -0
- package/src/compile/bundler.ts +34 -4
- package/src/compile/compileProject.ts +31 -1
- package/src/compile/detectEntry.ts +8 -3
- package/src/compile/index.ts +2 -0
- package/src/compile/serverSplit.ts +9 -3
- package/src/g2/Node2D.ts +38 -0
- package/src/g2/Sprite.ts +20 -1
- package/src/gl/Camera.ts +34 -1
- package/src/gl/CameraPlace.ts +52 -52
- package/src/gl/Foliage.ts +102 -0
- package/src/gl/Geometry.ts +393 -348
- package/src/gl/Light.ts +49 -16
- package/src/gl/Lightmap.ts +439 -275
- package/src/gl/Material.ts +59 -47
- package/src/gl/Mesh.ts +120 -120
- package/src/gl/Model.ts +23 -12
- package/src/gl/Node.ts +39 -0
- package/src/gl/Particles.ts +80 -2
- package/src/gl/Scene.ts +34 -1
- package/src/gl/animation/AnimationClip.ts +52 -0
- package/src/gl/animation/Animator.ts +42 -2
- package/src/gl/animation/DynamicBone.ts +35 -12
- package/src/gl/animation/IK.ts +173 -152
- package/src/gl/animation/Locomotion.ts +72 -8
- package/src/gl/animation/Playback.ts +5 -4
- package/src/gl/animation/Warp.ts +5 -2
- package/src/gl/animation/core.ts +65 -4
- package/src/gl/physics/Ragdoll.ts +451 -272
- package/src/gl/scenarios.ts +291 -291
- package/src/gl/terrain/Terrain.ts +33 -2
- package/src/inject.ts +236 -226
- package/src/runtime/input.ts +11 -0
- package/src/scene/defineScene.ts +72 -62
- package/src/scene/gizmos.ts +148 -148
- package/src/ui/UIButton.ts +2 -2
- package/src/ui/UIInput.ts +3 -3
- package/src/ui/UINode.ts +61 -36
- package/dist/types/animate/animate.d.ts +0 -20
- package/src/animate/animate.ts +0 -238
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ClickEvent as ClickEventType, TouchStartEvent as TouchStartEventType, LongPressEvent as LongPressEventType } from "../runtime/touch";
|
|
2
|
-
import { type ElementStyle, type ContainerStyle, type DrawableStyle, type UIChildArg, type UIContainerBase, type UINodeChild, type ChildrenFn, type BaseStyle, type Color } from "./UINode";
|
|
2
|
+
import { type ElementStyle, type ContainerStyle, type DrawableStyle, type UIChildArg, type UIContainerBase, type UINodeChild, type ChildrenFn, type BaseStyle, type Color, type LayerEasing } from "./UINode";
|
|
3
3
|
export type UIButtonStyle = ElementStyle & DrawableStyle & ContainerStyle & {
|
|
4
4
|
rippleColor?: Color | "default";
|
|
5
5
|
};
|
|
@@ -8,6 +8,8 @@ export type UIButtonStyle = ElementStyle & DrawableStyle & ContainerStyle & {
|
|
|
8
8
|
export interface UIButton extends UIContainerBase<UIButtonStyle & {
|
|
9
9
|
onPressed?: UIButtonStyle & {
|
|
10
10
|
duration?: number;
|
|
11
|
+
delay?: number;
|
|
12
|
+
easing?: LayerEasing;
|
|
11
13
|
};
|
|
12
14
|
}, DrawableStyle & BaseStyle> {
|
|
13
15
|
readonly type: "button";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ElementStyle, type DrawableStyle, type TextStyle, type Color, type BaseStyle, type UIElementBase } from "./UINode";
|
|
1
|
+
import { type ElementStyle, type DrawableStyle, type TextStyle, type Color, type BaseStyle, type UIElementBase, type LayerEasing } from "./UINode";
|
|
2
2
|
type InputStyle = {
|
|
3
3
|
placeholder?: string;
|
|
4
4
|
placeholderColor?: Color;
|
|
@@ -50,6 +50,8 @@ type SubmitStyle = {
|
|
|
50
50
|
export interface UIInput extends UIElementBase<UIInputStyle & SubmitStyle & {
|
|
51
51
|
onFocused?: UIInputStyle & {
|
|
52
52
|
duration?: number;
|
|
53
|
+
delay?: number;
|
|
54
|
+
easing?: LayerEasing;
|
|
53
55
|
};
|
|
54
56
|
}, DrawableStyle & BaseStyle> {
|
|
55
57
|
readonly type: "input";
|
|
@@ -77,6 +79,8 @@ export interface UIInput extends UIElementBase<UIInputStyle & SubmitStyle & {
|
|
|
77
79
|
export interface UITextArea extends UIElementBase<UIInputStyle & {
|
|
78
80
|
onFocused?: UIInputStyle & {
|
|
79
81
|
duration?: number;
|
|
82
|
+
delay?: number;
|
|
83
|
+
easing?: LayerEasing;
|
|
80
84
|
};
|
|
81
85
|
}, DrawableStyle & BaseStyle> {
|
|
82
86
|
readonly type: "textarea";
|
|
@@ -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
|
-
/**
|
|
249
|
-
* (
|
|
250
|
-
export type
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
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).
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
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`:
|