@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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threlte/gltf",
3
- "version": "2.0.3",
3
+ "version": "3.0.0-next.1",
4
4
  "description": "GLTF to Threlte converter",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -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
- import { Group } from 'three'
476
+ ${options.stype && !options.isolated ? `import type { Snippet } from 'svelte'` : ''}
477
477
  import { ${[
478
478
  'T',
479
- options.types && !options.isolated ? 'type Props, type Events, type Slots' : '',
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
- ${options.types && !options.isolated ? 'type $$Props = Props<THREE.Group>' : ''}
537
- ${options.types && !options.isolated ? 'type $$Events = Events<THREE.Group>' : ''}
538
- ${
539
- options.types && !options.isolated
540
- ? 'type $$Slots = Slots<THREE.Group> & { fallback: {}; error: { error: any } }'
541
- : ''
542
- }
543
-
544
- export const ref = new Group()
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 is={ref} dispose={false} ${!options.isolated ? '{...$$restProps} bind:this={$component}' : ''}>
560
+ <T.Group bind:ref dispose={false} ${!options.isolated ? '{...props}' : ''}>
563
561
  {#await gltf}
564
- <slot name="fallback" />
562
+ {@render fallback?.()}
565
563
  {:then gltf}
566
564
  ${scene}
567
565
  {:catch error}
568
- <slot name="error" {error} />
566
+ {@render error?.({ error })}
569
567
  {/await}
570
568
 
571
- <slot {ref} />
569
+ {@render children?.({ ref })}
572
570
  </T>
573
571
  `
574
572
  }