@threlte/theatre 3.0.0-next.7 → 3.0.0-next.8

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.
@@ -3,9 +3,12 @@
3
3
  - Creating namespaces
4
4
  - Potentially Providing a sheet object
5
5
  -->
6
- <script lang="ts">import { useStudio } from '../studio/useStudio';
7
- import { currentWritable, watch, useThrelte } from '@threlte/core';
8
- import { getContext, onDestroy, onMount, setContext } from 'svelte';
6
+ <script
7
+ lang="ts"
8
+ generics="Props extends UnknownShorthandCompoundProps"
9
+ >import { useStudio } from '../studio/useStudio';
10
+ import { currentWritable, useThrelte, watch } from '@threlte/core';
11
+ import { getContext, onDestroy, onMount } from 'svelte';
9
12
  import Declare from './declare/Declare.svelte';
10
13
  import Sync from './sync/Sync.svelte';
11
14
  import Transform from './transform/Transform.svelte';
@@ -1,32 +1,20 @@
1
- import type { ISheetObject, UnknownShorthandCompoundProps } from '@theatre/core'
2
- import { SvelteComponent, type Snippet } from 'svelte'
3
- import type Declare from './declare/Declare.svelte'
4
- import type Sync from './sync/Sync.svelte'
5
- import type Transform from './transform/Transform.svelte'
6
-
7
- export type SheetObjectProps<T> = {
8
- key: string
9
- detach?: boolean
10
- selected?: boolean
11
- props?: T
12
-
13
- children?: Snippet<
14
- [
15
- {
16
- values: ISheetObject['value']
17
- selected: boolean
18
- select: () => void
19
- deselect: () => void
20
- sheetObject: ISheetObject
21
- Sync: typeof Sync
22
- Transform: typeof Transform
23
- Declare: typeof Declare
24
- }
25
- ]
26
- >
27
-
28
- onchange?: (sheet: ISheetObject['value']) => void
1
+ /// <reference types="svelte" />
2
+ import type { UnknownShorthandCompoundProps } from '@theatre/core';
3
+ import type { SheetObjectProps } from './types';
4
+ declare class __sveltets_Render<Props extends UnknownShorthandCompoundProps> {
5
+ props(): SheetObjectProps<Props>;
6
+ events(): {};
7
+ slots(): {};
8
+ bindings(): "selected";
9
+ exports(): {};
29
10
  }
30
- export default class SheetObject<T extends UnknownShorthandCompoundProps> extends SvelteComponent<
31
- SheetObjectProps<T>
32
- > {}
11
+ interface $$IsomorphicComponent {
12
+ new <Props extends UnknownShorthandCompoundProps>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Props>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Props>['props']>, ReturnType<__sveltets_Render<Props>['events']>, ReturnType<__sveltets_Render<Props>['slots']>> & {
13
+ $$bindings?: ReturnType<__sveltets_Render<Props>['bindings']>;
14
+ } & ReturnType<__sveltets_Render<Props>['exports']>;
15
+ <Props extends UnknownShorthandCompoundProps>(internal: unknown, props: ReturnType<__sveltets_Render<Props>['props']> & {}): ReturnType<__sveltets_Render<Props>['exports']>;
16
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
17
+ }
18
+ declare const SheetObject: $$IsomorphicComponent;
19
+ type SheetObject<Props extends UnknownShorthandCompoundProps> = InstanceType<typeof SheetObject<Props>>;
20
+ export default SheetObject;
@@ -1,4 +1,7 @@
1
- <script lang="ts">import { watch } from '@threlte/core';
1
+ <script
2
+ lang="ts"
3
+ generics="P extends UnknownShorthandCompoundProps"
4
+ >import { watch } from '@threlte/core';
2
5
  import { onDestroy } from 'svelte';
3
6
  import { useSheet } from '../useSheet';
4
7
  let { props, children } = $props();
@@ -1,12 +1,20 @@
1
- import type { ISheetObject, UnknownShorthandCompoundProps } from '@theatre/core'
2
- import type { Snippet, SvelteComponent } from 'svelte'
3
-
4
- export type DeclareProps<T extends UnknownShorthandCompoundProps> = {
5
- props: T
6
-
7
- children?: Snippet<[{ values: ISheetObject<T>['value'] }]>
1
+ /// <reference types="svelte" />
2
+ import type { UnknownShorthandCompoundProps } from '@theatre/core';
3
+ import type { DeclareProps } from './types';
4
+ declare class __sveltets_Render<P extends UnknownShorthandCompoundProps> {
5
+ props(): DeclareProps<P>;
6
+ events(): {};
7
+ slots(): {};
8
+ bindings(): "";
9
+ exports(): {};
8
10
  }
9
-
10
- export default class Declare<T extends UnknownShorthandCompoundProps> extends SvelteComponent<
11
- DeclareProps<T>
12
- > {}
11
+ interface $$IsomorphicComponent {
12
+ new <P extends UnknownShorthandCompoundProps>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<P>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<P>['props']>, ReturnType<__sveltets_Render<P>['events']>, ReturnType<__sveltets_Render<P>['slots']>> & {
13
+ $$bindings?: ReturnType<__sveltets_Render<P>['bindings']>;
14
+ } & ReturnType<__sveltets_Render<P>['exports']>;
15
+ <P extends UnknownShorthandCompoundProps>(internal: unknown, props: ReturnType<__sveltets_Render<P>['props']> & {}): ReturnType<__sveltets_Render<P>['exports']>;
16
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
17
+ }
18
+ declare const Declare: $$IsomorphicComponent;
19
+ type Declare<P extends UnknownShorthandCompoundProps> = InstanceType<typeof Declare<P>>;
20
+ export default Declare;
@@ -0,0 +1,9 @@
1
+ import type { ISheetObject, UnknownShorthandCompoundProps } from '@theatre/core';
2
+ import type { Snippet } from 'svelte';
3
+ export type DeclareProps<T extends UnknownShorthandCompoundProps> = {
4
+ props: T;
5
+ children?: Snippet<[{
6
+ values: ISheetObject<T>['value'];
7
+ }]>;
8
+ };
9
+ export type Values<T> = T extends UnknownShorthandCompoundProps ? ISheetObject<T>['value'] : never;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,12 +1,15 @@
1
- <script lang="ts">import { resolvePropertyPath, useParent, watch } from '@threlte/core';
1
+ <script
2
+ lang="ts"
3
+ generics="Type"
4
+ >import { resolvePropertyPath, useParent, watch } from '@threlte/core';
2
5
  import { onDestroy } from 'svelte';
6
+ import { useStudio } from '../../studio/useStudio';
7
+ import { useSheet } from '../useSheet';
3
8
  import { getInitialValue } from './utils/getInitialValue';
4
9
  import { isComplexProp } from './utils/isComplexProp';
10
+ import { isStringProp } from './utils/isStringProp';
5
11
  import { makeAlphanumeric } from './utils/makeAlphanumeric';
6
12
  import { parsePropLabel } from './utils/parsePropLabel';
7
- import { isStringProp } from './utils/isStringProp';
8
- import { useStudio } from '../../studio/useStudio';
9
- import { useSheet } from '../useSheet';
10
13
  let { type, children, ...rest } = $props();
11
14
  const { sheetObject, addProps, removeProps } = useSheet();
12
15
  const parent = useParent();
@@ -73,6 +76,9 @@ watch([parent, sheetObject], ([parent, sheetObject]) => {
73
76
  });
74
77
  initProps();
75
78
  const studio = useStudio();
79
+ /**
80
+ * Capture the current values of the props
81
+ */
76
82
  export const capture = () => {
77
83
  if (!$studio)
78
84
  return;
@@ -1,65 +1,23 @@
1
- import type { Snippet, SvelteComponent } from 'svelte'
2
- import type { Transformer } from '../transfomers/types'
3
- import type { ConditionalKeys, Primitive } from 'type-fest'
4
-
5
- /* COPIED FROM @threlte/core START */
6
- type OmittedPropKeys =
7
- | 'type'
8
- | 'args'
9
- | 'attach'
10
- | 'manual'
11
- | 'makeDefault'
12
- | 'id'
13
- | 'children'
14
- | `is${string}` // isMesh, isObject3D, etc
15
- | 'parent'
16
- | 'uuid'
17
- | 'name'
18
- type AnyClass = new (...args: any) => any
19
- type AnyFn = (...args: any) => any
20
- type MaybeInstance<Type extends any> = Type extends AnyClass ? InstanceType<Type> : Type
21
- type InstanceProps<Type extends any> = Partial<
22
- Omit<
23
- MaybeInstance<Type> extends Primitive
24
- ? Record<string, unknown>
25
- : {
26
- [K in keyof MaybeInstance<Type>]?: MaybeInstance<Type>[K] extends {
27
- set: (...args: any[]) => any
28
- }
29
- ?
30
- | Parameters<MaybeInstance<Type>[K]['set']>
31
- | Parameters<MaybeInstance<Type>[K]['set']>[0]
32
- : MaybeInstance<Type>[K] extends AnyFn
33
- ? never
34
- : MaybeInstance<Type>[K]
35
- },
36
- ConditionalKeys<MaybeInstance<Type>, AnyFn> | OmittedPropKeys
37
- >
38
- >
39
- /* COPIED FROM @threlte/core END */
40
-
41
- type ObjectProp<T> = {
42
- type?: T
1
+ /// <reference types="svelte" />
2
+ import type { SyncProps } from './types';
3
+ declare class __sveltets_Render<Type> {
4
+ props(): SyncProps<Type>;
5
+ events(): {};
6
+ slots(): {};
7
+ bindings(): "";
8
+ exports(): {
9
+ /**
10
+ * Capture the current values of the props
11
+ */ capture: () => void;
12
+ };
43
13
  }
44
-
45
- export type ComplexProp = {
46
- transformer?: Transformer
47
- label?: string
48
- key?: string
14
+ interface $$IsomorphicComponent {
15
+ new <Type>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Type>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Type>['props']>, ReturnType<__sveltets_Render<Type>['events']>, ReturnType<__sveltets_Render<Type>['slots']>> & {
16
+ $$bindings?: ReturnType<__sveltets_Render<Type>['bindings']>;
17
+ } & ReturnType<__sveltets_Render<Type>['exports']>;
18
+ <Type>(internal: unknown, props: ReturnType<__sveltets_Render<Type>['props']> & {}): ReturnType<__sveltets_Render<Type>['exports']>;
19
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
49
20
  }
50
-
51
- export type AnyProp = string | boolean | ComplexProp
52
-
53
- type AnyProps<T> = {
54
- [P in keyof InstanceProps<T>]?: AnyProp
55
- }
56
-
57
- export type SyncProps<T> = AnyProps<T> &
58
- ObjectProp<T> &
59
- Record<string, AnyProp | T> & {
60
- capture?: () => void
61
- } & {
62
- children?: Snippet<[{ capture: () => void }]>
63
- }
64
-
65
- export default class Sync<T> extends SvelteComponent<SyncProps<T>> {}
21
+ declare const Sync: $$IsomorphicComponent;
22
+ type Sync<Type> = InstanceType<typeof Sync<Type>>;
23
+ export default Sync;
@@ -0,0 +1,30 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { ConditionalKeys, Primitive } from 'type-fest';
3
+ import type { Transformer } from '../transfomers/types';
4
+ type OmittedPropKeys = 'type' | 'args' | 'attach' | 'manual' | 'makeDefault' | 'id' | 'children' | `is${string}` | 'parent' | 'uuid' | 'name';
5
+ type AnyClass = new (...args: any) => any;
6
+ type AnyFn = (...args: any) => any;
7
+ type MaybeInstance<Type extends any> = Type extends AnyClass ? InstanceType<Type> : Type;
8
+ type InstanceProps<Type extends any> = Partial<Omit<MaybeInstance<Type> extends Primitive ? Record<string, unknown> : {
9
+ [K in keyof MaybeInstance<Type>]?: MaybeInstance<Type>[K] extends {
10
+ set: (...args: any[]) => any;
11
+ } ? Parameters<MaybeInstance<Type>[K]['set']> | Parameters<MaybeInstance<Type>[K]['set']>[0] : MaybeInstance<Type>[K] extends AnyFn ? never : MaybeInstance<Type>[K];
12
+ }, ConditionalKeys<MaybeInstance<Type>, AnyFn> | OmittedPropKeys>>;
13
+ type ObjectProp<T> = {
14
+ type?: T;
15
+ };
16
+ export type ComplexProp = {
17
+ transformer?: Transformer;
18
+ label?: string;
19
+ key?: string;
20
+ };
21
+ export type AnyProp = string | boolean | ComplexProp;
22
+ type AnyProps<T> = {
23
+ [P in keyof InstanceProps<T>]?: AnyProp;
24
+ };
25
+ export type SyncProps<T> = AnyProps<T> & ObjectProp<T> & Record<string, AnyProp | T> & {
26
+ children?: Snippet<[{
27
+ capture: () => void;
28
+ }]>;
29
+ };
30
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,2 @@
1
- import type { AnyProp, ComplexProp } from '../Sync.svelte';
1
+ import type { AnyProp, ComplexProp } from '../types';
2
2
  export declare const isComplexProp: (prop: AnyProp) => prop is ComplexProp;
@@ -1,2 +1,2 @@
1
- import type { AnyProp } from '../Sync.svelte';
1
+ import type { AnyProp } from '../types';
2
2
  export declare const isStringProp: (prop: AnyProp) => prop is string;
@@ -1,2 +1,2 @@
1
- import type { AnyProp } from '../Sync.svelte';
1
+ import type { AnyProp } from '../types';
2
2
  export declare const parsePropLabel: (alphaNumericKey: string, propValue: AnyProp) => string;
@@ -1,10 +1,13 @@
1
- <script lang="ts">import { types } from '../../theatre';
2
- import { T, watch } from '@threlte/core';
1
+ <script
2
+ lang="ts"
3
+ generics="Label extends string | undefined"
4
+ >import { T, watch } from '@threlte/core';
3
5
  import { TransformControls } from '@threlte/extras';
4
6
  import { onMount } from 'svelte';
5
7
  import { Group } from 'three';
6
8
  import { RAD2DEG } from 'three/src/math/MathUtils.js';
7
9
  import { useStudio } from '../../studio/useStudio';
10
+ import { types } from '../../theatre';
8
11
  import { getDefaultTransformer } from '../transfomers/getDefaultTransformer';
9
12
  import { useSheet } from '../useSheet';
10
13
  let { label, key, mode = 'translate', space, translationSnap, rotationSnap, scaleSnap, children } = $props();
@@ -1,22 +1,19 @@
1
- import type { Snippet, SvelteComponent } from 'svelte'
2
-
3
- export type TransformProps<T extends string | undefined> = {
4
- label?: T
5
- mode?: 'translate' | 'rotate' | 'scale'
6
- translationSnap?: number
7
- rotationSnap?: number
8
- scaleSnap?: number
9
- space?: 'world' | 'local'
10
-
11
- children?: Snippet
12
- } & (T extends string
13
- ? {
14
- key: string
15
- }
16
- : {
17
- key?: string
18
- })
19
-
20
- export default class Transform<Label extends string | undefined> extends SvelteComponent<
21
- TransformProps<Label>
22
- > {}
1
+ /// <reference types="svelte" />
2
+ import type { TransformProps } from './types';
3
+ declare class __sveltets_Render<Label extends string | undefined> {
4
+ props(): TransformProps<Label>;
5
+ events(): {};
6
+ slots(): {};
7
+ bindings(): "";
8
+ exports(): {};
9
+ }
10
+ interface $$IsomorphicComponent {
11
+ new <Label extends string | undefined>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Label>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Label>['props']>, ReturnType<__sveltets_Render<Label>['events']>, ReturnType<__sveltets_Render<Label>['slots']>> & {
12
+ $$bindings?: ReturnType<__sveltets_Render<Label>['bindings']>;
13
+ } & ReturnType<__sveltets_Render<Label>['exports']>;
14
+ <Label extends string | undefined>(internal: unknown, props: ReturnType<__sveltets_Render<Label>['props']> & {}): ReturnType<__sveltets_Render<Label>['exports']>;
15
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
16
+ }
17
+ declare const Transform: $$IsomorphicComponent;
18
+ type Transform<Label extends string | undefined> = InstanceType<typeof Transform<Label>>;
19
+ export default Transform;
@@ -0,0 +1,14 @@
1
+ import type { Snippet } from 'svelte';
2
+ export type TransformProps<T extends string | undefined> = {
3
+ label?: T;
4
+ mode?: 'translate' | 'rotate' | 'scale';
5
+ translationSnap?: number;
6
+ rotationSnap?: number;
7
+ scaleSnap?: number;
8
+ space?: 'world' | 'local';
9
+ children?: Snippet;
10
+ } & (T extends string ? {
11
+ key: string;
12
+ } : {
13
+ key?: string;
14
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ import type { ISheetObject, UnknownShorthandCompoundProps } from '@theatre/core';
2
+ import { type Snippet } from 'svelte';
3
+ import type Declare from './declare/Declare.svelte';
4
+ import type Sync from './sync/Sync.svelte';
5
+ import type Transform from './transform/Transform.svelte';
6
+ export type SheetObjectProps<T extends UnknownShorthandCompoundProps> = {
7
+ key: string;
8
+ detach?: boolean;
9
+ selected?: boolean;
10
+ props?: T;
11
+ children?: Snippet<[
12
+ {
13
+ values: ISheetObject['value'];
14
+ selected: boolean;
15
+ select: () => void;
16
+ deselect: () => void;
17
+ sheetObject: ISheetObject<T>;
18
+ Sync: typeof Sync;
19
+ Transform: typeof Transform;
20
+ Declare: typeof Declare;
21
+ }
22
+ ]>;
23
+ onchange?: (sheet: ISheetObject<T>['value']) => void;
24
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,10 +1,10 @@
1
1
  import type { ISheetObject, UnknownShorthandCompoundProps } from '@theatre/core';
2
2
  import type { CurrentWritable } from '@threlte/core';
3
- interface Context {
4
- sheetObject: CurrentWritable<ISheetObject<any>>;
3
+ type Context<T extends UnknownShorthandCompoundProps = {}> = {
4
+ sheetObject: CurrentWritable<ISheetObject<T>>;
5
5
  addProps: (props: UnknownShorthandCompoundProps) => void;
6
6
  removeProps: (names: string[]) => void;
7
- }
7
+ };
8
8
  export declare const createSheetContext: (context: Context) => void;
9
- export declare const useSheet: () => Context;
9
+ export declare const useSheet: <T extends UnknownShorthandCompoundProps = {}>() => Context<T>;
10
10
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threlte/theatre",
3
- "version": "3.0.0-next.7",
3
+ "version": "3.0.0-next.8",
4
4
  "author": "Grischa Erbe <hello@legrisch.com> (https://legrisch.com)",
5
5
  "license": "MIT",
6
6
  "description": "Threlte Components for Theatre, an animation library with a professional motion design toolset",
@@ -25,13 +25,13 @@
25
25
  "svelte-check": "^3.6.9",
26
26
  "svelte-preprocess": "^5.1.3",
27
27
  "svelte2tsx": "^0.7.6",
28
- "three": "^0.169.0",
28
+ "three": "^0.170.0",
29
29
  "tslib": "^2.6.2",
30
30
  "type-fest": "^4.15.0",
31
31
  "typescript": "^5.4.5",
32
32
  "vite": "^5.2.8",
33
- "@threlte/core": "8.0.0-next.23",
34
- "@threlte/extras": "9.0.0-next.32"
33
+ "@threlte/core": "8.0.0-next.24",
34
+ "@threlte/extras": "9.0.0-next.35"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "svelte": ">=4",