@webspatial/react-sdk 0.0.9 → 0.0.11

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.
@@ -1,164 +0,0 @@
1
- import * as React from 'react';
2
- import React__default, { ReactNode, CSSProperties, ElementType, ForwardedRef } from 'react';
3
- import { BackgroundMaterialType, CornerRadius, SpatialEntity, Vec3, SpatialSession } from '@webspatial/core-sdk';
4
- import * as react_jsx_runtime from 'react/jsx-runtime';
5
- import { ModelViewerElement } from '@google/model-viewer';
6
- import { WindowContainerOptions } from '@webspatial/core-sdk/';
7
-
8
- type vecType = {
9
- x: number;
10
- y: number;
11
- z: number;
12
- };
13
- type quatType = {
14
- x: number;
15
- y: number;
16
- z: number;
17
- w: number;
18
- };
19
-
20
- type spatialStyleDef = {
21
- position: Partial<vecType>;
22
- rotation: quatType;
23
- scale: Partial<vecType>;
24
- zIndex?: number;
25
- material?: {
26
- type: BackgroundMaterialType;
27
- };
28
- cornerRadius: number | CornerRadius;
29
- visible?: boolean;
30
- };
31
- interface SpatialReactComponentProps {
32
- allowScroll?: boolean;
33
- scrollWithParent?: boolean;
34
- spatialStyle?: Partial<spatialStyleDef>;
35
- children?: ReactNode;
36
- className?: string;
37
- style?: CSSProperties | undefined;
38
- component?: ElementType;
39
- debugName?: string;
40
- debugShowStandardInstance?: boolean;
41
- }
42
- type SpatialReactComponentRef = ForwardedRef<HTMLDivElement>;
43
-
44
- declare const SpatialReactComponent: React.ForwardRefExoticComponent<SpatialReactComponentProps & React.RefAttributes<HTMLDivElement>>;
45
-
46
- declare function withSpatial(Component: React__default.ElementType): any;
47
- declare const SpatialPrimitive: Record<string, typeof SpatialReactComponent>;
48
- declare const SpatialDiv: React__default.ForwardRefExoticComponent<SpatialReactComponentProps & React__default.RefAttributes<HTMLDivElement>>;
49
-
50
- /**
51
- * Component that add MutationObserver to monitor all dom changes including its children.
52
- * If any dom changes, it will notify all SpatialDiv to render again for the purpose of sync standInstance layout to portalInstance.
53
- */
54
- declare function SpatialMonitor(props: any): react_jsx_runtime.JSX.Element;
55
-
56
- /**
57
- * External-developers can call this function to sync the standardInstance layout to PortalInstance.
58
- *
59
- * Currently: notifyUpdateStandInstanceLayout is called when the document head changed
60
- * or when the monitored div changed (in both cases spatialDiv's layout may be changed, so we need to update the layout)
61
- */
62
- declare function notifyUpdateStandInstanceLayout(): void;
63
-
64
- declare function parseCornerRadius(computedStyle: CSSStyleDeclaration): {
65
- topLeading: number;
66
- bottomLeading: number;
67
- topTrailing: number;
68
- bottomTrailing: number;
69
- };
70
-
71
- declare const CSSSpatialComponent: React.ForwardRefExoticComponent<SpatialReactComponentProps & React.RefAttributes<HTMLDivElement>>;
72
-
73
- declare function withCSSSpatial(Component: React__default.ElementType): any;
74
- declare const CSSSpatialPrimitive: Record<string, typeof CSSSpatialComponent>;
75
- declare const CSSSpatialDiv: React__default.ForwardRefExoticComponent<SpatialReactComponentProps & React__default.RefAttributes<HTMLDivElement>>;
76
-
77
- interface SpatialViewProps extends React__default.HTMLAttributes<HTMLDivElement> {
78
- onViewLoad?: (viewEnt: SpatialEntity) => void;
79
- onViewUnload?: () => void;
80
- }
81
- interface SpatialViewRef extends HTMLDivElement {
82
- getViewEntity: () => Promise<SpatialEntity | null>;
83
- }
84
- /**
85
- * [Experimental] Allows embedding 3D dynamic content within the webpage
86
- */
87
- declare const SpatialView: React__default.ForwardRefExoticComponent<SpatialViewProps & React__default.RefAttributes<SpatialViewRef>>;
88
-
89
- interface ModelEvent {
90
- target: ModelElement;
91
- }
92
- interface ModelDragEvent extends ModelEvent {
93
- eventType: 'dragstart' | 'dragend' | 'drag';
94
- translation3D: Vec3;
95
- startLocation3D: Vec3;
96
- }
97
- interface ModelElement extends HTMLDivElement {
98
- ready: boolean;
99
- currentSrc: string;
100
- }
101
-
102
- declare global {
103
- namespace JSX {
104
- interface IntrinsicElements {
105
- 'model-viewer': ModelViewerElement | {
106
- ref: any;
107
- };
108
- }
109
- }
110
- }
111
- type ModelChildren = React__default.ReactElement<{
112
- type: string;
113
- src: string;
114
- }> | [React__default.ReactElement<{
115
- type: string;
116
- src: string;
117
- }>, React__default.ReactElement] | React__default.ReactElement<{
118
- type: string;
119
- src: string;
120
- }>[];
121
- interface ModelProps {
122
- className?: string;
123
- style?: CSSProperties | undefined;
124
- children: ModelChildren;
125
- onLoad?: (event: ModelEvent) => void;
126
- contentMode?: 'fill' | 'fit';
127
- resizable?: boolean;
128
- aspectRatio?: number;
129
- onDragStart?: (dragEvent: ModelDragEvent) => void;
130
- onDrag?: (dragEvent: ModelDragEvent) => void;
131
- onDragEnd?: (dragEvent: ModelDragEvent) => void;
132
- onTap?: (event: ModelEvent) => void;
133
- onDoubleTap?: (event: ModelEvent) => void;
134
- onLongPress?: (event: ModelEvent) => void;
135
- poster?: string;
136
- }
137
- declare const Model: React__default.ForwardRefExoticComponent<ModelProps & React__default.RefAttributes<ModelElement>>;
138
-
139
- /** @hidden */
140
- declare function getSession(): SpatialSession | null;
141
-
142
- declare function enableDebugTool(): void;
143
-
144
- declare global {
145
- interface Window {
146
- xrCurrentSceneDefaults: (defaultConfig: WindowContainerOptions) => Promise<WindowContainerOptions>;
147
- }
148
- }
149
- declare const defaultSceneConfig: WindowContainerOptions;
150
- declare class XRApp {
151
- private static instance;
152
- static getInstance(): XRApp;
153
- handleATag(event: MouseEvent): void;
154
- init(): void;
155
- deinit(): void;
156
- private configMap;
157
- private getConfig;
158
- show(window: Window, cfg: WindowContainerOptions): Promise<void>;
159
- open: (url?: string, target?: string, features?: string) => Window | null;
160
- initScene(name: string, callback: (pre: WindowContainerOptions) => WindowContainerOptions): void;
161
- }
162
- declare function initScene(name: string, callback: (pre: WindowContainerOptions) => WindowContainerOptions): void;
163
-
164
- export { CSSSpatialDiv, CSSSpatialPrimitive, Model, type ModelProps, SpatialDiv, type SpatialReactComponentProps as SpatialDivProps, type SpatialReactComponentRef as SpatialDivRef, SpatialMonitor, SpatialPrimitive, type SpatialReactComponentProps, type SpatialReactComponentRef, SpatialView, type SpatialViewRef, XRApp, defaultSceneConfig, enableDebugTool, getSession, initScene, notifyUpdateStandInstanceLayout, parseCornerRadius, withCSSSpatial, withSpatial };