@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 CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## 3.0.0-next.0
4
10
 
5
11
  ### Major Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threlte/gltf",
3
- "version": "3.0.0-next.0",
3
+ "version": "3.0.0-next.1",
4
4
  "description": "GLTF to Threlte converter",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -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, type Events, type Slots' : ''
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 ? ': Props<THREE.Group>' : ''} = $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()
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
- <slot name="fallback" />
562
+ {@render fallback?.()}
562
563
  {:then gltf}
563
564
  ${scene}
564
565
  {:catch error}
565
- <slot name="error" {error} />
566
+ {@render error?.({ error })}
566
567
  {/await}
567
568
 
568
- <slot {ref} />
569
+ {@render children?.({ ref })}
569
570
  </T>
570
571
  `
571
572
  }