@webspatial/react-sdk 0.1.11 → 0.1.14

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,4 +1,4 @@
1
- import * as React from 'react';
1
+ import * as React$1 from 'react';
2
2
  import React__default, { ReactNode, CSSProperties, ElementType, ForwardedRef } from 'react';
3
3
  import { BackgroundMaterialType, CornerRadius, SpatialEntity, Vec3, SpatialSession, WindowContainerOptions as WindowContainerOptions$1 } from '@webspatial/core-sdk';
4
4
  import { ModelViewerElement } from '@google/model-viewer';
@@ -40,7 +40,7 @@ interface SpatialReactComponentProps {
40
40
  }
41
41
  type SpatialReactComponentRef = ForwardedRef<HTMLDivElement>;
42
42
 
43
- declare const SpatialReactComponent: React.ForwardRefExoticComponent<SpatialReactComponentProps & React.RefAttributes<HTMLDivElement>>;
43
+ declare const SpatialReactComponent: React$1.ForwardRefExoticComponent<SpatialReactComponentProps & React$1.RefAttributes<HTMLDivElement>>;
44
44
 
45
45
  declare function withSpatial(Component: React__default.ElementType): any;
46
46
  declare const SpatialPrimitive: Record<string, typeof SpatialReactComponent>;
@@ -51,7 +51,7 @@ declare function withSpatialMonitor(El: React__default.ElementType): any;
51
51
  type SpatialMonitorProps = {
52
52
  El?: ElementType;
53
53
  };
54
- declare const SpatialMonitor: React.ForwardRefExoticComponent<SpatialMonitorProps & React.RefAttributes<HTMLElement>>;
54
+ declare const SpatialMonitor: React$1.ForwardRefExoticComponent<SpatialMonitorProps & React$1.RefAttributes<HTMLElement>>;
55
55
 
56
56
  /**
57
57
  * External-developers can call this function to sync the standardInstance layout to PortalInstance.
@@ -68,7 +68,7 @@ declare function parseCornerRadius(computedStyle: CSSStyleDeclaration): {
68
68
  bottomTrailing: number;
69
69
  };
70
70
 
71
- declare const CSSSpatialComponent: React.ForwardRefExoticComponent<SpatialReactComponentProps & React.RefAttributes<HTMLDivElement>>;
71
+ declare const CSSSpatialComponent: React$1.ForwardRefExoticComponent<SpatialReactComponentProps & React$1.RefAttributes<HTMLDivElement>>;
72
72
 
73
73
  declare function withCSSSpatial(Component: React__default.ElementType): any;
74
74
  declare const CSSSpatialPrimitive: Record<string, typeof CSSSpatialComponent>;
@@ -86,6 +86,11 @@ interface SpatialViewRef extends HTMLDivElement {
86
86
  */
87
87
  declare const SpatialView: React__default.ForwardRefExoticComponent<SpatialViewProps & React__default.RefAttributes<SpatialViewRef>>;
88
88
 
89
+ type PartialSpatialTransformType = {
90
+ position?: Partial<vecType>;
91
+ rotation?: Partial<quatType>;
92
+ scale?: Partial<vecType>;
93
+ };
89
94
  interface ModelEvent {
90
95
  target: ModelElement;
91
96
  }
@@ -94,10 +99,34 @@ interface ModelDragEvent extends ModelEvent {
94
99
  translation3D: Vec3;
95
100
  startLocation3D: Vec3;
96
101
  }
102
+ interface Model3DProps {
103
+ spatialTransform?: PartialSpatialTransformType;
104
+ modelUrl: string;
105
+ visible: boolean;
106
+ contentMode?: 'fill' | 'fit';
107
+ resizable?: boolean;
108
+ aspectRatio?: number;
109
+ className?: string;
110
+ style?: CSSProperties | undefined;
111
+ children?: React.ReactNode;
112
+ onLoad?: (event: ModelEvent) => void;
113
+ onDragStart?: (dragEvent: ModelDragEvent) => void;
114
+ onDrag?: (dragEvent: ModelDragEvent) => void;
115
+ onDragEnd?: (dragEvent: ModelDragEvent) => void;
116
+ onTap?: (event: ModelEvent) => void;
117
+ onDoubleTap?: (event: ModelEvent) => void;
118
+ onLongPress?: (event: ModelEvent) => void;
119
+ }
97
120
  interface ModelElement extends HTMLDivElement {
98
121
  ready: boolean;
99
122
  currentSrc: string;
100
123
  }
124
+ type ModelElementRef = ForwardedRef<ModelElement>;
125
+ type CSSModel3DProps = Omit<Model3DProps, 'spatialTransform' | 'visible'>;
126
+
127
+ declare const Model3D: React$1.ForwardRefExoticComponent<Model3DProps & React$1.RefAttributes<ModelElement>>;
128
+
129
+ declare const CSSModel3D: React$1.ForwardRefExoticComponent<CSSModel3DProps & React$1.RefAttributes<ModelElement>>;
101
130
 
102
131
  declare global {
103
132
  namespace JSX {
@@ -164,4 +193,6 @@ declare function initScene(name: string, callback: (pre: WindowContainerOptions$
164
193
 
165
194
  declare function spatialPolyfill(): void;
166
195
 
167
- 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, spatialPolyfill, withCSSSpatial, withSpatial, withSpatialMonitor };
196
+ declare const version: string;
197
+
198
+ export { CSSModel3D, CSSSpatialDiv, CSSSpatialPrimitive, Model, Model3D, type Model3DProps, type ModelDragEvent, type ModelElement, type ModelElementRef, type ModelEvent, 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, spatialPolyfill, version, withCSSSpatial, withSpatial, withSpatialMonitor };
package/dist/web/index.js CHANGED
@@ -1,3 +1,12 @@
1
+
2
+ (function(){
3
+ if(typeof window === 'undefined') return;
4
+ if(!window.__webspatialsdk__) window.__webspatialsdk__ = {}
5
+ window.__webspatialsdk__['react-sdk-version'] = "0.1.14"
6
+ window.__webspatialsdk__['XR_ENV'] = "web"
7
+ })()
8
+
9
+
1
10
  // src/spatial-react-components/SpatialPrimitive.tsx
2
11
  import { forwardRef as forwardRef3 } from "react";
3
12
 
@@ -691,7 +700,8 @@ function getInheritedStyleProps(computedStyle) {
691
700
  // position also need to be synced
692
701
  "position",
693
702
  "width",
694
- "height"
703
+ "height",
704
+ "display"
695
705
  ];
696
706
  var props = {};
697
707
  for (var cssName of propNames) {
@@ -887,8 +897,7 @@ function renderJSXPortalInstance(inProps, inheritedPortalStyle, className) {
887
897
  marginTop: "0px",
888
898
  marginBottom: "0px",
889
899
  borderRadius: "0px",
890
- overflow: "",
891
- display: "block"
900
+ overflow: ""
892
901
  };
893
902
  const style = {
894
903
  ...inStyle,
@@ -3789,6 +3798,9 @@ function spatialPolyfill() {
3789
3798
  hijackDocumentElementStyle();
3790
3799
  monitorExternalStyleChange();
3791
3800
  }
3801
+
3802
+ // src/index.ts
3803
+ var version = "0.1.14";
3792
3804
  export {
3793
3805
  CSSSpatialDiv,
3794
3806
  CSSSpatialPrimitive,
@@ -3805,6 +3817,7 @@ export {
3805
3817
  notifyUpdateStandInstanceLayout,
3806
3818
  parseCornerRadius,
3807
3819
  spatialPolyfill,
3820
+ version,
3808
3821
  withCSSSpatial,
3809
3822
  withSpatial,
3810
3823
  withSpatialMonitor