@threlte/rapier 3.0.0-next.2 → 3.0.0-next.4

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.
@@ -7,7 +7,7 @@ import { parseRigidBodyType } from '../../lib/parseRigidBodyType';
7
7
  import { setParentRigidbodyObject } from '../../lib/rigidBodyObjectContext';
8
8
  import { useCreateEvent } from '../../lib/useCreateEvent';
9
9
  const { world, rapier, addRigidBodyToContext, removeRigidBodyFromContext } = useRapier();
10
- let { linearVelocity, angularVelocity, type = 'dynamic', canSleep = true, gravityScale = 1, ccd = false, angularDamping = 0, linearDamping = 0, lockRotations = false, lockTranslations = false, enabledRotations = [true, true, true], enabledTranslations = [true, true, true], dominance = 0, enabled = true, userData = {}, rigidBody = $bindable(), oncreate, oncollisionenter, oncollisionexit, oncontact, onsensorenter, onsensorexit, onsleep, onwake } = $props();
10
+ let { linearVelocity, angularVelocity, type = 'dynamic', canSleep = true, gravityScale = 1, ccd = false, angularDamping = 0, linearDamping = 0, lockRotations = false, lockTranslations = false, enabledRotations = [true, true, true], enabledTranslations = [true, true, true], dominance = 0, enabled = true, userData = {}, rigidBody = $bindable(), oncreate, oncollisionenter, oncollisionexit, oncontact, onsensorenter, onsensorexit, onsleep, onwake, children } = $props();
11
11
  /**
12
12
  * Every RigidBody receives and forwards collision-related events
13
13
  */
@@ -114,5 +114,5 @@ onDestroy(() => {
114
114
  </script>
115
115
 
116
116
  <SceneGraphObject {object}>
117
- <slot rigidBody={rigidBodyInternal} />
117
+ {@render children?.({ rigidBody: rigidBodyInternal })}
118
118
  </SceneGraphObject>
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">import { onDestroy, setContext, tick } from 'svelte';
2
2
  import { useFrameHandler } from '../../hooks/useFrameHandler';
3
3
  import { createRapierContext } from '../../lib/createRapierContext';
4
- let { gravity = [0, -9.81, 0], rawIntegrationParameters, rawIslands, rawBroadPhase, rawNarrowPhase, rawBodies, rawColliders, rawImpulseJoints, rawMultibodyJoints, rawCCDSolver, rawQueryPipeline, rawPhysicsPipeline, rawSerializationPipeline, rawDebugRenderPipeline, stage } = $props();
4
+ let { gravity = [0, -9.81, 0], rawIntegrationParameters, rawIslands, rawBroadPhase, rawNarrowPhase, rawBodies, rawColliders, rawImpulseJoints, rawMultibodyJoints, rawCCDSolver, rawQueryPipeline, rawPhysicsPipeline, rawSerializationPipeline, rawDebugRenderPipeline, stage, children } = $props();
5
5
  const rapierContext = createRapierContext({ x: gravity[0], y: gravity[1], z: gravity[2] }, rawIntegrationParameters, rawIslands, rawBroadPhase, rawNarrowPhase, rawBodies, rawColliders, rawImpulseJoints, rawMultibodyJoints, rawCCDSolver, rawQueryPipeline, rawPhysicsPipeline, rawSerializationPipeline, rawDebugRenderPipeline);
6
6
  setContext('threlte-rapier-context', rapierContext);
7
7
  $effect.pre(() => {
@@ -16,4 +16,4 @@ onDestroy(async () => {
16
16
  });
17
17
  </script>
18
18
 
19
- <slot />
19
+ {@render children?.()}
@@ -1,17 +1,11 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  import type { WorldProps } from './World.svelte';
3
3
  declare const __propDef: {
4
- props: WorldProps & {
5
- children?: ((this: void) => typeof import("svelte").SnippetReturn & {
6
- _: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
7
- }) | undefined;
8
- };
4
+ props: WorldProps;
9
5
  events: {
10
6
  [evt: string]: CustomEvent<any>;
11
7
  };
12
- slots: {
13
- default: {};
14
- };
8
+ slots: {};
15
9
  };
16
10
  export type InnerWorldProps = typeof __propDef.props;
17
11
  export type InnerWorldEvents = typeof __propDef.events;
@@ -17,7 +17,7 @@ let { gravity, rawIntegrationParameters, rawIslands, rawBroadPhase, rawNarrowPha
17
17
  * Use this to control when the rapier physics engine is updating the scene.
18
18
  * @default undefined
19
19
  */
20
- stage } = $props();
20
+ stage, fallback, children } = $props();
21
21
  let error = $state(false);
22
22
  const init = async () => {
23
23
  if ($initialized)
@@ -51,10 +51,10 @@ onMount(init);
51
51
  {rawDebugRenderPipeline}
52
52
  {stage}
53
53
  >
54
- <slot />
54
+ {@render children?.()}
55
55
  </InnerWorld>
56
56
  {/if}
57
57
 
58
58
  {#if error}
59
- <slot name="fallback" />
59
+ {@render fallback?.()}
60
60
  {/if}
@@ -13,7 +13,7 @@ import type {
13
13
  RawRigidBodySet,
14
14
  RawSerializationPipeline
15
15
  } from '@dimforge/rapier3d-compat/raw'
16
- import { SvelteComponent } from 'svelte'
16
+ import { SvelteComponent, type Snippet } from 'svelte'
17
17
  import type { Vector3 } from 'three'
18
18
  import type { Key, Stage } from '@threlte/core'
19
19
 
@@ -33,6 +33,9 @@ export type WorldProps = {
33
33
  rawSerializationPipeline?: RawSerializationPipeline
34
34
  rawDebugRenderPipeline?: RawDebugRenderPipeline
35
35
  stage?: Key | Stage
36
+
37
+ children?: Snippet
38
+ fallback?: Snippet
36
39
  }
37
40
 
38
41
  export default class World extends SvelteComponent<WorldProps> {}
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@threlte/rapier",
3
- "version": "3.0.0-next.2",
3
+ "version": "3.0.0-next.4",
4
4
  "author": "Grischa Erbe <hello@legrisch.com> (https://legrisch.com)",
5
5
  "license": "MIT",
6
+ "description": "Components and hooks to use the Rapier physics engine in Threlte",
6
7
  "devDependencies": {
7
8
  "@dimforge/rapier3d-compat": "^0.12.0",
8
9
  "@sveltejs/adapter-auto": "^3.2.0",
@@ -10,7 +11,7 @@
10
11
  "@sveltejs/package": "^2.3.1",
11
12
  "@sveltejs/vite-plugin-svelte": "^3.1.0",
12
13
  "@types/node": "^20.12.7",
13
- "@types/three": "^0.163.0",
14
+ "@types/three": "^0.165.0",
14
15
  "@typescript-eslint/eslint-plugin": "^7.6.0",
15
16
  "@typescript-eslint/parser": "^7.6.0",
16
17
  "@yushijinhun/three-minifier-rollup": "^0.4.0",
@@ -25,12 +26,12 @@
25
26
  "svelte-check": "^3.6.9",
26
27
  "svelte-preprocess": "^5.1.3",
27
28
  "svelte2tsx": "^0.7.6",
28
- "three": "^0.163.0",
29
+ "three": "^0.165.0",
29
30
  "tslib": "^2.6.2",
30
31
  "type-fest": "^4.15.0",
31
32
  "typescript": "^5.4.5",
32
33
  "vite": "^5.2.8",
33
- "@threlte/core": "8.0.0-next.6"
34
+ "@threlte/core": "8.0.0-next.8"
34
35
  },
35
36
  "peerDependencies": {
36
37
  "@dimforge/rapier3d-compat": ">=0.12",
@@ -38,6 +39,24 @@
38
39
  "three": ">=0.152"
39
40
  },
40
41
  "type": "module",
42
+ "keywords": [
43
+ "threlte",
44
+ "rapier",
45
+ "svelte",
46
+ "three",
47
+ "three.js",
48
+ "3d",
49
+ "physics"
50
+ ],
51
+ "homepage": "https://threlte.xyz",
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "https://github.com/threlte/threlte.git",
55
+ "directory": "packages/rapier"
56
+ },
57
+ "bugs": {
58
+ "url": "https://github.com/threlte/threlte/issues"
59
+ },
41
60
  "exports": {
42
61
  ".": {
43
62
  "types": "./dist/index.d.ts",