@threlte/gltf 3.0.0-next.0 → 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 +6 -0
- package/package.json +1 -1
- package/src/utils/parser.js +14 -13
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/utils/parser.js
CHANGED
|
@@ -473,9 +473,10 @@ function parse(fileName, gltf, options = {}) {
|
|
|
473
473
|
|
|
474
474
|
const imports = `
|
|
475
475
|
${options.types ? `\nimport type * as THREE from 'three'` : ''}
|
|
476
|
+
${options.stype && !options.isolated ? `import type { Snippet } from 'svelte'` : ''}
|
|
476
477
|
import { ${[
|
|
477
478
|
'T',
|
|
478
|
-
options.types && !options.isolated ? 'type Props
|
|
479
|
+
options.types && !options.isolated ? 'type Props' : ''
|
|
479
480
|
]
|
|
480
481
|
.filter(Boolean)
|
|
481
482
|
.join(', ')} } from '@threlte/core'
|
|
@@ -507,7 +508,6 @@ ${parseExtras(gltf.parser.json.asset && gltf.parser.json.asset.extras)}-->
|
|
|
507
508
|
${
|
|
508
509
|
options.preload
|
|
509
510
|
? `
|
|
510
|
-
|
|
511
511
|
<script context="module"${options.types ? ' lang="ts"' : ''}>
|
|
512
512
|
${imports}
|
|
513
513
|
|
|
@@ -530,17 +530,18 @@ ${
|
|
|
530
530
|
<script${options.types ? ' lang="ts"' : ''}>
|
|
531
531
|
${!options.preload ? imports : ''}
|
|
532
532
|
|
|
533
|
-
${options.types && !options.isolated ? 'type $$Events = Events<THREE.Group>' : ''}
|
|
534
|
-
${
|
|
535
|
-
options.types && !options.isolated
|
|
536
|
-
? 'type $$Slots = Slots<THREE.Group> & { fallback: {}; error: { error: any } }'
|
|
537
|
-
: ''
|
|
538
|
-
}
|
|
539
|
-
|
|
540
533
|
let {
|
|
541
534
|
ref = $bindable(),
|
|
535
|
+
fallback,
|
|
536
|
+
error,
|
|
537
|
+
children,
|
|
542
538
|
...props
|
|
543
|
-
}${options.types && !options.isolated ?
|
|
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()
|
|
544
545
|
|
|
545
546
|
${!options.preload && options.suspense ? 'const suspend = useSuspense()' : ''}
|
|
546
547
|
|
|
@@ -558,14 +559,14 @@ ${
|
|
|
558
559
|
|
|
559
560
|
<T.Group bind:ref dispose={false} ${!options.isolated ? '{...props}' : ''}>
|
|
560
561
|
{#await gltf}
|
|
561
|
-
|
|
562
|
+
{@render fallback?.()}
|
|
562
563
|
{:then gltf}
|
|
563
564
|
${scene}
|
|
564
565
|
{:catch error}
|
|
565
|
-
|
|
566
|
+
{@render error?.({ error })}
|
|
566
567
|
{/await}
|
|
567
568
|
|
|
568
|
-
|
|
569
|
+
{@render children?.({ ref })}
|
|
569
570
|
</T>
|
|
570
571
|
`
|
|
571
572
|
}
|