@needle-tools/engine 4.16.0-next.0798cbb → 4.16.0-next.34e2848
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/SKILL.md +25 -36
- package/dist/{needle-engine.bundle-Dz6Tag-6.js → needle-engine.bundle-29FOZhUC.js} +3306 -3284
- package/dist/{needle-engine.bundle-D-KMaXfY.min.js → needle-engine.bundle-B-h3Fb-x.min.js} +115 -115
- package/dist/{needle-engine.bundle-DEWMFvfK.umd.cjs → needle-engine.bundle-DsfSTG8s.umd.cjs} +114 -114
- package/dist/needle-engine.d.ts +3 -0
- package/dist/needle-engine.js +2 -2
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine/webcomponents/logo-element.d.ts +6 -3
- package/lib/engine/webcomponents/logo-element.js +18 -0
- package/lib/engine/webcomponents/logo-element.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +10 -7
- package/lib/engine/webcomponents/needle menu/needle-menu.js +13 -2
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.d.ts +4 -1
- package/lib/engine/webcomponents/needle-engine.js +16 -8
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine/xr/NeedleXRSession.js +15 -3
- package/lib/engine/xr/NeedleXRSession.js.map +1 -1
- package/package.json +1 -1
- package/src/engine/webcomponents/logo-element.ts +20 -3
- package/src/engine/webcomponents/needle menu/needle-menu.ts +22 -9
- package/src/engine/webcomponents/needle-engine.ts +36 -25
- package/src/engine/xr/NeedleXRSession.ts +16 -3
package/SKILL.md
CHANGED
|
@@ -1,33 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: needle-engine
|
|
3
|
-
description:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
description: >
|
|
4
|
+
Provides Needle Engine context for web-based 3D projects built on Three.js
|
|
5
|
+
with the @needle-tools/engine component system. Use this skill whenever the user
|
|
6
|
+
is working with Needle Engine components, GLB files exported from Unity or Blender,
|
|
7
|
+
Vite configs with needlePlugins, TypeScript classes extending Behaviour, or anything
|
|
8
|
+
involving @needle-tools/engine imports. Also trigger when the user mentions
|
|
9
|
+
"needle engine", "needle tools", serializable decorators (@serializable, @syncField,
|
|
10
|
+
@registerType), the <needle-engine> web component, or 3D scenes loaded from GLB
|
|
11
|
+
in a web context — even if they don't explicitly name the engine.
|
|
12
|
+
compatibility:
|
|
13
|
+
- optional: needle_search MCP tool (search Needle Engine docs, forum posts, and community answers)
|
|
10
14
|
---
|
|
11
15
|
|
|
12
16
|
# Needle Engine
|
|
13
17
|
|
|
14
18
|
You are an expert in Needle Engine — a web-first 3D engine built on Three.js with a component system and Unity/Blender-based workflow.
|
|
15
19
|
|
|
16
|
-
## When to Use This Skill
|
|
17
|
-
|
|
18
|
-
**Use when the user is:**
|
|
19
|
-
- Editing TypeScript files that import from `@needle-tools/engine`
|
|
20
|
-
- Working on a project with `vite.config.ts` that uses `needlePlugins`
|
|
21
|
-
- Loading or debugging `.glb` files exported from Unity or Blender
|
|
22
|
-
- Using the Needle Engine Blender addon or Unity package
|
|
23
|
-
- Asking about component lifecycle, serialization, XR, networking, or deployment
|
|
24
|
-
|
|
25
|
-
**Do NOT use for:**
|
|
26
|
-
- Pure Three.js projects with no Needle Engine
|
|
27
|
-
- Non-web Unity/Blender work with no GLB export
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
20
|
## Quick Start
|
|
32
21
|
|
|
33
22
|
```html
|
|
@@ -51,7 +40,7 @@ export class HelloWorld extends Behaviour {
|
|
|
51
40
|
}
|
|
52
41
|
```
|
|
53
42
|
|
|
54
|
-
> **TypeScript config required:** `tsconfig.json` must have `"experimentalDecorators": true` and `"useDefineForClassFields": false` for decorators to work.
|
|
43
|
+
> ⚠️ **TypeScript config required:** `tsconfig.json` must have `"experimentalDecorators": true` and `"useDefineForClassFields": false` for decorators to work. Without `useDefineForClassFields: false`, TypeScript overwrites `@serializable()` properties with their default values *after* the decorator runs, silently breaking deserialization.
|
|
55
44
|
|
|
56
45
|
---
|
|
57
46
|
|
|
@@ -211,26 +200,26 @@ Use this *before* guessing at API details — the docs are the source of truth.
|
|
|
211
200
|
|
|
212
201
|
## Common Gotchas
|
|
213
202
|
|
|
214
|
-
- `@registerType` is required or the component won't be instantiated from GLB
|
|
215
|
-
- GLB assets go in `assets/`, static files (fonts, images) in `public/` (configurable via `needle.config.json`)
|
|
216
|
-
- `useDefineForClassFields: false` must be set in `tsconfig.json` — otherwise
|
|
217
|
-
- `@syncField()` only triggers on reassignment — mutating an array/object in place won't sync
|
|
218
|
-
- Physics callbacks (`onCollisionEnter` etc.) require a Needle `Collider` component on the GameObject
|
|
219
|
-
- `removeComponent()` does NOT call `onDestroy` —
|
|
220
|
-
- Prefer `instantiate()` and `destroy()` functions over `GameObject.instantiate()` / `GameObject.destroy()`
|
|
203
|
+
- `@registerType` is required or the component won't be instantiated from GLB. Unity/Blender export adds this automatically via codegen; hand-written components need it explicitly.
|
|
204
|
+
- GLB assets go in `assets/`, static files (fonts, images, videos) in `public/` (configurable via `needle.config.json`)
|
|
205
|
+
- `useDefineForClassFields: false` must be set in `tsconfig.json` — otherwise TypeScript overwrites decorated fields with their defaults after the decorator runs, silently breaking serialization
|
|
206
|
+
- `@syncField()` only triggers on reassignment — mutating an array/object in place won't sync. Do `this.arr = this.arr` to force a sync event.
|
|
207
|
+
- Physics callbacks (`onCollisionEnter` etc.) require a Needle `Collider` component (BoxCollider, SphereCollider ...) on the GameObject — they won't fire on mesh-only objects
|
|
208
|
+
- `removeComponent()` does NOT call `onDestroy` — any cleanup logic in `onDestroy` (event listeners, timers, allocated resources) will be skipped. Use `destroy(obj)` for full cleanup.
|
|
209
|
+
- Prefer the standalone `instantiate()` and `destroy()` functions over `GameObject.instantiate()` / `GameObject.destroy()` — the standalone versions are the current API
|
|
221
210
|
- `loadAsset()` returns a model wrapper (not an Object3D) — use `.scene` to get the root Object3D
|
|
222
|
-
- `AssetReference.getOrCreateFromUrl()` caches by URL — loading the same URL twice returns the same Object3D. Use `.instantiate()` or `loadAsset()` with `{ context }` for multiple copies
|
|
211
|
+
- `AssetReference.getOrCreateFromUrl()` caches by URL — loading the same URL twice returns the same Object3D. Use `.instantiate()` or `loadAsset()` with `{ context }` for multiple independent copies
|
|
223
212
|
|
|
224
213
|
---
|
|
225
214
|
|
|
226
215
|
## References
|
|
227
216
|
|
|
228
|
-
|
|
217
|
+
Read these **only when needed** — don't load them all upfront:
|
|
229
218
|
|
|
230
|
-
- [Full API Reference](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/api.md) — lifecycle, decorators, context API, animation, networking, XR, physics
|
|
231
|
-
- [Framework Integration](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/integration.md) — React, Svelte, Vue, vanilla JS
|
|
232
|
-
- [Troubleshooting](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/troubleshooting.md) —
|
|
233
|
-
- [Component Template](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/templates/my-component.ts) —
|
|
219
|
+
- 📖 [Full API Reference](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/api.md) — read when writing component code (lifecycle, decorators, context API, animation, networking, XR, physics)
|
|
220
|
+
- 🔗 [Framework Integration](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/integration.md) — read when integrating with React, Svelte, Vue, or vanilla JS
|
|
221
|
+
- 🐛 [Troubleshooting](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/troubleshooting.md) — read when debugging errors or unexpected behavior
|
|
222
|
+
- 🧩 [Component Template](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/templates/my-component.ts) — use as a starting point for new components
|
|
234
223
|
|
|
235
224
|
## Important URLs
|
|
236
225
|
|