UNPKG

@threlte/core

Version:

A 3D framework for the web, built on top of Svelte and Three.js

50 lines (49 loc) 1.26 kB
import type { Component } from 'svelte'; import * as THREE from 'three'; import TComp from './T.svelte'; import type { Props } from './types'; type Extensions = Record<string, Component>; type ThreeCatalogue = { [K in keyof typeof THREE]: (typeof THREE)[K]; }; type TComponentProxy = { [K in keyof ThreeCatalogue]: Component<Props<ThreeCatalogue[K]>, {}, 'ref'>; }; /** * Extends the default THREE namespace and allows using custom Three.js objects with `<T>`. * * @example * ```svelte * <script> * import { extend, T } from 'threlte' * import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js' * * extend({ OrbitControls }) * </script> * * <T.OrbitControls /> * ``` */ export declare const extend: (extensions: Record<string, unknown>) => void; /** * ## `<T>` * * Threlte's `<T>` component is a wrapper around Three.js objects. It is a generic component that can be used to create any Three.js object. * * @example * * ```svelte * <script> * import { T } from 'threlte' * </script> * * <T.PerspectiveCamera makeDefault /> * * <T.Mesh> * <T.BoxGeometry /> * <T.MeshBasicMaterial color="red" /> * </T.Mesh> * ``` */ export declare const T: typeof TComp & TComponentProxy & Extensions; export {};