@threlte/gltf 2.0.3 → 3.0.0-next.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.
- package/CHANGELOG.md +12 -0
- package/package.json +1 -1
- package/src/utils/parser.js +18 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @threlte/gltf
|
|
2
2
|
|
|
3
|
+
## 3.0.0-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 36128d5: Replace events with callback props and slots with snippets
|
|
8
|
+
|
|
9
|
+
## 3.0.0-next.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- e27c1e4: Remove forwardEventHandlers from generated svelte files
|
|
14
|
+
|
|
3
15
|
## 2.0.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/package.json
CHANGED
package/src/utils/parser.js
CHANGED
|
@@ -473,11 +473,10 @@ function parse(fileName, gltf, options = {}) {
|
|
|
473
473
|
|
|
474
474
|
const imports = `
|
|
475
475
|
${options.types ? `\nimport type * as THREE from 'three'` : ''}
|
|
476
|
-
|
|
476
|
+
${options.stype && !options.isolated ? `import type { Snippet } from 'svelte'` : ''}
|
|
477
477
|
import { ${[
|
|
478
478
|
'T',
|
|
479
|
-
options.types && !options.isolated ? 'type Props
|
|
480
|
-
!options.isolated && 'forwardEventHandlers'
|
|
479
|
+
options.types && !options.isolated ? 'type Props' : ''
|
|
481
480
|
]
|
|
482
481
|
.filter(Boolean)
|
|
483
482
|
.join(', ')} } from '@threlte/core'
|
|
@@ -509,7 +508,6 @@ ${parseExtras(gltf.parser.json.asset && gltf.parser.json.asset.extras)}-->
|
|
|
509
508
|
${
|
|
510
509
|
options.preload
|
|
511
510
|
? `
|
|
512
|
-
|
|
513
511
|
<script context="module"${options.types ? ' lang="ts"' : ''}>
|
|
514
512
|
${imports}
|
|
515
513
|
|
|
@@ -530,18 +528,20 @@ ${
|
|
|
530
528
|
|
|
531
529
|
|
|
532
530
|
<script${options.types ? ' lang="ts"' : ''}>
|
|
533
|
-
|
|
534
531
|
${!options.preload ? imports : ''}
|
|
535
532
|
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
|
|
533
|
+
let {
|
|
534
|
+
ref = $bindable(),
|
|
535
|
+
fallback,
|
|
536
|
+
error,
|
|
537
|
+
children,
|
|
538
|
+
...props
|
|
539
|
+
}${options.types && !options.isolated ? `: Props<THREE.Group> & {
|
|
540
|
+
ref?: THREE.Group
|
|
541
|
+
children?: Snippet<[{ ref: THREE.Group }]>
|
|
542
|
+
fallback?: Snippet
|
|
543
|
+
error?: Snippet<[{ error: Error }]>
|
|
544
|
+
}` : ''} = $props()
|
|
545
545
|
|
|
546
546
|
${!options.preload && options.suspense ? 'const suspend = useSuspense()' : ''}
|
|
547
547
|
|
|
@@ -555,20 +555,18 @@ ${
|
|
|
555
555
|
}(gltf, ref)`
|
|
556
556
|
: ''
|
|
557
557
|
}
|
|
558
|
-
|
|
559
|
-
${!options.isolated ? 'const component = forwardEventHandlers()' : ''}
|
|
560
558
|
</script>
|
|
561
559
|
|
|
562
|
-
<T
|
|
560
|
+
<T.Group bind:ref dispose={false} ${!options.isolated ? '{...props}' : ''}>
|
|
563
561
|
{#await gltf}
|
|
564
|
-
|
|
562
|
+
{@render fallback?.()}
|
|
565
563
|
{:then gltf}
|
|
566
564
|
${scene}
|
|
567
565
|
{:catch error}
|
|
568
|
-
|
|
566
|
+
{@render error?.({ error })}
|
|
569
567
|
{/await}
|
|
570
568
|
|
|
571
|
-
|
|
569
|
+
{@render children?.({ ref })}
|
|
572
570
|
</T>
|
|
573
571
|
`
|
|
574
572
|
}
|