@smplrspace/smplr-loader 2.4.1-beta.13 → 2.4.1-beta.2
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/.eslintignore +3 -0
- package/.eslintrc.js +42 -0
- package/package.json +3 -18
- package/src/generated/.gitkeep +0 -0
- package/src/index.ts +55 -0
- package/src/loadScript.ts +21 -0
- package/src/loadStylesheet.ts +22 -0
- package/{dist → src}/types.d.ts +0 -1
- package/tsconfig.json +17 -0
- package/dist/generated/smplr.d.ts +0 -342
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -67
- package/dist/index.umd.cjs +0 -1
- package/dist/loadScript.d.ts +0 -2
- package/dist/loadStylesheet.d.ts +0 -1
package/.eslintignore
ADDED
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
es2021: true,
|
|
5
|
+
jest: true,
|
|
6
|
+
node: true,
|
|
7
|
+
},
|
|
8
|
+
parser: '@typescript-eslint/parser',
|
|
9
|
+
parserOptions: {
|
|
10
|
+
ecmaVersion: 'latest',
|
|
11
|
+
sourceType: 'module',
|
|
12
|
+
},
|
|
13
|
+
settings: {
|
|
14
|
+
'import/parsers': {
|
|
15
|
+
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
16
|
+
},
|
|
17
|
+
'import/resolver': {
|
|
18
|
+
typescript: {},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
extends: [
|
|
22
|
+
'eslint:recommended',
|
|
23
|
+
'plugin:@typescript-eslint/recommended',
|
|
24
|
+
'plugin:prettier/recommended',
|
|
25
|
+
'plugin:import/recommended',
|
|
26
|
+
'plugin:import/typescript',
|
|
27
|
+
],
|
|
28
|
+
plugins: ['@typescript-eslint', 'simple-import-sort'],
|
|
29
|
+
rules: {
|
|
30
|
+
'prettier/prettier': [
|
|
31
|
+
'error',
|
|
32
|
+
{
|
|
33
|
+
singleQuote: true,
|
|
34
|
+
semi: false,
|
|
35
|
+
printWidth: 120,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
'import/newline-after-import': 'error',
|
|
39
|
+
'simple-import-sort/imports': 'error',
|
|
40
|
+
'simple-import-sort/exports': 'error',
|
|
41
|
+
},
|
|
42
|
+
}
|
package/package.json
CHANGED
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smplrspace/smplr-loader",
|
|
3
|
-
"version": "2.4.1-beta.
|
|
3
|
+
"version": "2.4.1-beta.2",
|
|
4
4
|
"description": "NPM package to load a typed Smplr.js from CDN easily",
|
|
5
|
-
"
|
|
6
|
-
"files": [
|
|
7
|
-
"dist"
|
|
8
|
-
],
|
|
9
|
-
"main": "./dist/index.umd.cjs",
|
|
10
|
-
"module": "./dist/index.js",
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"import": "./dist/index.js",
|
|
14
|
-
"require": "./dist/index.umd.cjs"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"types": "./dist/index.d.ts",
|
|
5
|
+
"main": "src/index.ts",
|
|
18
6
|
"scripts": {
|
|
19
|
-
"build": "yarn tsc && vite build",
|
|
20
7
|
"dev": "echo 'No dev'",
|
|
21
8
|
"serve": "echo 'No serve'",
|
|
22
9
|
"libtest": "echo 'No libtest'",
|
|
@@ -41,9 +28,7 @@
|
|
|
41
28
|
"eslint-plugin-import": "^2.26.0",
|
|
42
29
|
"eslint-plugin-prettier": "^4.2.1",
|
|
43
30
|
"prettier": "^2.7.1",
|
|
44
|
-
"typescript": "4.7.4"
|
|
45
|
-
"vite": "^4.1.1",
|
|
46
|
-
"vite-plugin-dts": "^1.7.1"
|
|
31
|
+
"typescript": "4.7.4"
|
|
47
32
|
},
|
|
48
33
|
"homepage": "https://www.smplrspace.com",
|
|
49
34
|
"keywords": [
|
|
File without changes
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { loadEsmModule, loadUmdScript } from './loadScript'
|
|
2
|
+
import { loadStylesheet } from './loadStylesheet'
|
|
3
|
+
import { Smplr } from './types'
|
|
4
|
+
|
|
5
|
+
export type { Smplr } from './types'
|
|
6
|
+
|
|
7
|
+
const SMPLR = {
|
|
8
|
+
umd: {
|
|
9
|
+
prod: 'https://app.smplrspace.com/lib/smplr.js',
|
|
10
|
+
dev: 'https://dev.smplrspace.com/lib/smplr.js',
|
|
11
|
+
local: 'http://localhost:3000/lib/smplr.umd.js',
|
|
12
|
+
},
|
|
13
|
+
esm: {
|
|
14
|
+
prod: 'https://app.smplrspace.com/lib/smplr.mjs',
|
|
15
|
+
dev: 'https://dev.smplrspace.com/lib/smplr.mjs',
|
|
16
|
+
local: 'http://localhost:3000/lib/smplr.mjs',
|
|
17
|
+
},
|
|
18
|
+
css: {
|
|
19
|
+
prod: 'https://app.smplrspace.com/lib/smplr.css',
|
|
20
|
+
dev: 'https://dev.smplrspace.com/lib/smplr.css',
|
|
21
|
+
local: 'http://localhost:3000/lib/style.css',
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
type BundleType = 'esm' | 'umd'
|
|
26
|
+
type Env = 'prod' | 'dev' | 'local'
|
|
27
|
+
|
|
28
|
+
export async function loadSmplrJs(bundle: BundleType = 'esm', env: Env = 'prod'): Promise<Smplr> {
|
|
29
|
+
try {
|
|
30
|
+
// we don't wait for the stylesheet, just start to load it
|
|
31
|
+
loadStylesheet(SMPLR.css[env])
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.warn('oops')
|
|
34
|
+
// ignore errors, they will be printed anyway
|
|
35
|
+
}
|
|
36
|
+
// load script
|
|
37
|
+
try {
|
|
38
|
+
if (bundle === 'esm') {
|
|
39
|
+
const smplr = (await loadEsmModule(SMPLR.esm[env])) as Smplr
|
|
40
|
+
console.log('loaded esm', smplr)
|
|
41
|
+
return smplr
|
|
42
|
+
} else {
|
|
43
|
+
await loadUmdScript(SMPLR.umd[env])
|
|
44
|
+
const smplr = window.smplr as Smplr
|
|
45
|
+
if (!smplr) {
|
|
46
|
+
throw new Error('Failed to load smplr.js')
|
|
47
|
+
}
|
|
48
|
+
console.log('loaded umd', smplr)
|
|
49
|
+
return smplr
|
|
50
|
+
}
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error(error)
|
|
53
|
+
throw new Error('Failed to load smplr.js')
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const loadUmdScript = (url: string) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
try {
|
|
4
|
+
const scriptElement = document.createElement('script')
|
|
5
|
+
scriptElement.type = 'text/javascript'
|
|
6
|
+
scriptElement.async = true
|
|
7
|
+
scriptElement.src = url
|
|
8
|
+
scriptElement.addEventListener('load', () => {
|
|
9
|
+
resolve('ok')
|
|
10
|
+
})
|
|
11
|
+
scriptElement.addEventListener('error', () => {
|
|
12
|
+
reject(`Failed to load the script from ${url}`)
|
|
13
|
+
})
|
|
14
|
+
document.body.appendChild(scriptElement)
|
|
15
|
+
} catch (error) {
|
|
16
|
+
reject(error)
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const loadEsmModule = (url: string) => import(url /* @vite-ignore */)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const loadStylesheet = (url: string) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
try {
|
|
4
|
+
const linkElement = document.createElement('link')
|
|
5
|
+
linkElement.type = 'text/css'
|
|
6
|
+
linkElement.href = url
|
|
7
|
+
linkElement.rel = 'stylesheet'
|
|
8
|
+
linkElement.addEventListener('load', () => {
|
|
9
|
+
resolve('ok')
|
|
10
|
+
})
|
|
11
|
+
linkElement.addEventListener('error', () => {
|
|
12
|
+
const error = new Error(`Failed to load the stylesheet from ${url}`)
|
|
13
|
+
console.error(error)
|
|
14
|
+
reject(error)
|
|
15
|
+
})
|
|
16
|
+
document.head.appendChild(linkElement)
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.error(error)
|
|
19
|
+
reject(error)
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
}
|
package/{dist → src}/types.d.ts
RENAMED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"module": "ESNext",
|
|
11
|
+
"moduleResolution": "Node",
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"noEmit": true
|
|
15
|
+
},
|
|
16
|
+
"include": ["src"]
|
|
17
|
+
}
|
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
declare interface BaseDataLayer<T, D extends UnknownData> {
|
|
2
|
-
tooltip?: (dataElement: T & D) => string;
|
|
3
|
-
onClick?: (dataElement: T & D) => void;
|
|
4
|
-
onHover?: (dataElement: T & D) => void;
|
|
5
|
-
onHoverOut?: (dataElement: T & D) => void;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
declare type CameraMode = '2d' | '3d'
|
|
9
|
-
|
|
10
|
-
declare interface ClientOptions {
|
|
11
|
-
organizationId: string;
|
|
12
|
-
clientToken: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
declare type DataLayer<D extends UnknownData = NoData> = PointDataLayer<D> | IconDataLayer<D> | PolygonDataLayer<D> | PolylineDataLayer<D> | FurnitureDataLayer<D>;
|
|
16
|
-
|
|
17
|
-
declare interface DeprecatedPreviewProps {
|
|
18
|
-
mode: CameraMode;
|
|
19
|
-
onViewerReady: () => void;
|
|
20
|
-
onError: () => void;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
declare interface Filter {
|
|
24
|
-
background: {
|
|
25
|
-
clearColor: string;
|
|
26
|
-
};
|
|
27
|
-
directionalLight: {
|
|
28
|
-
distance: number;
|
|
29
|
-
intensity: number;
|
|
30
|
-
};
|
|
31
|
-
hemisphericLight: {
|
|
32
|
-
diffuseColor: string;
|
|
33
|
-
specularColor: string;
|
|
34
|
-
groundColor: string;
|
|
35
|
-
intensity: number;
|
|
36
|
-
};
|
|
37
|
-
whiteMaterial: {
|
|
38
|
-
baseColor: string;
|
|
39
|
-
metallicRatio: number;
|
|
40
|
-
roughnessRatio: number;
|
|
41
|
-
alphaRatio: number;
|
|
42
|
-
};
|
|
43
|
-
indoorMaterial: {
|
|
44
|
-
baseColor: string;
|
|
45
|
-
metallicRatio: number;
|
|
46
|
-
roughnessRatio: number;
|
|
47
|
-
alphaRatio: number;
|
|
48
|
-
};
|
|
49
|
-
grassMaterial: {
|
|
50
|
-
baseColor: string;
|
|
51
|
-
metallicRatio: number;
|
|
52
|
-
roughnessRatio: number;
|
|
53
|
-
alphaRatio: number;
|
|
54
|
-
};
|
|
55
|
-
waterMaterial: {
|
|
56
|
-
baseColor: string;
|
|
57
|
-
metallicRatio: number;
|
|
58
|
-
roughnessRatio: number;
|
|
59
|
-
alphaRatio: number;
|
|
60
|
-
};
|
|
61
|
-
darkGreyMaterial: {
|
|
62
|
-
baseColor: string;
|
|
63
|
-
metallicRatio: number;
|
|
64
|
-
roughnessRatio: number;
|
|
65
|
-
alphaRatio: number;
|
|
66
|
-
};
|
|
67
|
-
glassMaterial: {
|
|
68
|
-
baseColor: string;
|
|
69
|
-
metallicRatio: number;
|
|
70
|
-
roughnessRatio: number;
|
|
71
|
-
alphaRatio: number;
|
|
72
|
-
};
|
|
73
|
-
metalMaterial: {
|
|
74
|
-
baseColor: string;
|
|
75
|
-
metallicRatio: number;
|
|
76
|
-
roughnessRatio: number;
|
|
77
|
-
alphaRatio: number;
|
|
78
|
-
};
|
|
79
|
-
compassMaterial: {
|
|
80
|
-
baseColor: string;
|
|
81
|
-
metallicRatio: number;
|
|
82
|
-
roughnessRatio: number;
|
|
83
|
-
alphaRatio: number;
|
|
84
|
-
};
|
|
85
|
-
placeholderMaterial: {
|
|
86
|
-
baseColor: string;
|
|
87
|
-
metallicRatio: number;
|
|
88
|
-
roughnessRatio: number;
|
|
89
|
-
alphaRatio: number;
|
|
90
|
-
};
|
|
91
|
-
hoveredMaterial: {
|
|
92
|
-
baseColor: string;
|
|
93
|
-
metallicRatio: number;
|
|
94
|
-
roughnessRatio: number;
|
|
95
|
-
alphaRatio: number;
|
|
96
|
-
};
|
|
97
|
-
selectedMaterial: {
|
|
98
|
-
baseColor: string;
|
|
99
|
-
metallicRatio: number;
|
|
100
|
-
roughnessRatio: number;
|
|
101
|
-
alphaRatio: number;
|
|
102
|
-
};
|
|
103
|
-
dataElement: {
|
|
104
|
-
defaultColor: string;
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
declare type FurnitureData = {
|
|
109
|
-
furnitureId: string | string[];
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
declare interface FurnitureDataLayer<D extends UnknownData = NoData> extends BaseDataLayer<FurnitureData, D> {
|
|
113
|
-
id: string;
|
|
114
|
-
type: 'furniture';
|
|
115
|
-
data: (FurnitureData & D)[];
|
|
116
|
-
color?: string | ((dataElement: FurnitureData & D) => string);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
declare type IconData = {
|
|
120
|
-
position: SmplrCoord3d;
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
declare interface IconDataLayer<D extends UnknownData = NoData> extends BaseDataLayer<IconData, D> {
|
|
124
|
-
id: string;
|
|
125
|
-
type: 'icon';
|
|
126
|
-
data: (IconData & D)[];
|
|
127
|
-
icon: {
|
|
128
|
-
url: string;
|
|
129
|
-
width: number;
|
|
130
|
-
height: number;
|
|
131
|
-
};
|
|
132
|
-
width?: number | ((dataElement: IconData & D) => number);
|
|
133
|
-
onDrag?: (dragged: {
|
|
134
|
-
data: IconData & D;
|
|
135
|
-
}) => void;
|
|
136
|
-
onDrop?: (dropped: {
|
|
137
|
-
data: IconData & D;
|
|
138
|
-
position: SmplrCoord3d;
|
|
139
|
-
}) => void;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
declare type NoData = Record<string, never>;
|
|
143
|
-
|
|
144
|
-
declare type OnPickFn = (args: { coordinates: SmplrCoord3d; furnitureId?: string }) => void
|
|
145
|
-
|
|
146
|
-
declare interface OrbitCameraPlacement {
|
|
147
|
-
alpha: number;
|
|
148
|
-
beta: number;
|
|
149
|
-
radius: number;
|
|
150
|
-
target: Vector3Coord;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
declare type PointData = {
|
|
154
|
-
position: SmplrCoord3d;
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
declare interface PointDataLayer<D extends UnknownData = NoData> extends BaseDataLayer<PointData, D> {
|
|
158
|
-
id: string;
|
|
159
|
-
type: 'point';
|
|
160
|
-
data: (PointData & D)[];
|
|
161
|
-
diameter?: number | ((dataElement: PointData & D) => number);
|
|
162
|
-
anchor?: 'bottom' | 'center' | 'top';
|
|
163
|
-
color?: string | ((dataElement: PointData & D) => string);
|
|
164
|
-
alpha?: number;
|
|
165
|
-
onDrag?: (dragged: {
|
|
166
|
-
data: PointData & D;
|
|
167
|
-
}) => void;
|
|
168
|
-
onDrop?: (dropped: {
|
|
169
|
-
data: PointData & D;
|
|
170
|
-
position: SmplrCoord3d;
|
|
171
|
-
}) => void;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
declare type PolygonData = {
|
|
175
|
-
coordinates: SmplrCoord2d[];
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
declare interface PolygonDataLayer<D extends UnknownData = NoData> extends BaseDataLayer<PolygonData, D> {
|
|
179
|
-
id: string;
|
|
180
|
-
type: 'polygon';
|
|
181
|
-
data: (PolygonData & D)[];
|
|
182
|
-
baseHeight?: number | ((dataElement: PolygonData & D) => number);
|
|
183
|
-
height?: number | ((dataElement: PolygonData & D) => number);
|
|
184
|
-
color?: string | ((dataElement: PolygonData & D) => string);
|
|
185
|
-
alpha?: number;
|
|
186
|
-
onDrag?: (dragged: {
|
|
187
|
-
data: PolygonData & D;
|
|
188
|
-
}) => void;
|
|
189
|
-
onDrop?: (dropped: {
|
|
190
|
-
data: PolygonData & D;
|
|
191
|
-
coordinates: SmplrCoord2d[];
|
|
192
|
-
}) => void;
|
|
193
|
-
disableReshape?: boolean;
|
|
194
|
-
reshapeBoxColor?: string;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
declare type PolylineData = {
|
|
198
|
-
coordinates: SmplrCoord3d[];
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
declare interface PolylineDataLayer<D extends UnknownData = NoData> extends BaseDataLayer<PolylineData, D> {
|
|
202
|
-
id: string;
|
|
203
|
-
type: 'polyline';
|
|
204
|
-
data: (PolylineData & D)[];
|
|
205
|
-
shape?: 'circle' | 'triangle' | 'square' | 'pentagon' | 'hexagon' | [number, number][];
|
|
206
|
-
cap?: boolean;
|
|
207
|
-
scale?: number | ((scaled: {
|
|
208
|
-
data: PolylineData & D;
|
|
209
|
-
stepIndex: number;
|
|
210
|
-
distance: number;
|
|
211
|
-
}) => number);
|
|
212
|
-
stepSize?: number;
|
|
213
|
-
color?: string | ((dataElement: PolylineData & D) => string);
|
|
214
|
-
alpha?: number;
|
|
215
|
-
onDrag?: (dragged: {
|
|
216
|
-
data: PolylineData & D;
|
|
217
|
-
}) => void;
|
|
218
|
-
onDrop?: (dropped: {
|
|
219
|
-
data: PolylineData & D;
|
|
220
|
-
coordinates: SmplrCoord3d[];
|
|
221
|
-
}) => void;
|
|
222
|
-
disableReshape?: boolean;
|
|
223
|
-
reshapeBoxColor?: string;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export declare class QueryClient {
|
|
227
|
-
private options;
|
|
228
|
-
constructor(options: ClientOptions);
|
|
229
|
-
private checkOptions;
|
|
230
|
-
private fetchRaw;
|
|
231
|
-
private fetch;
|
|
232
|
-
checkApiConnection(): Promise<'OK'>;
|
|
233
|
-
getApiVersion(): Promise<string>;
|
|
234
|
-
getSpace(id: string): Promise<Space_2>;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
declare interface RenderOptions {
|
|
238
|
-
compass?: boolean
|
|
239
|
-
annotations?: boolean
|
|
240
|
-
skybox?: boolean
|
|
241
|
-
backgroundColor?: string
|
|
242
|
-
filter?: Partial<Filter>
|
|
243
|
-
walls?: {
|
|
244
|
-
render?: boolean
|
|
245
|
-
alpha?: number
|
|
246
|
-
maxHeightCm?: number
|
|
247
|
-
showStructuralWalls?: boolean
|
|
248
|
-
}
|
|
249
|
-
doors?: boolean
|
|
250
|
-
windows?: boolean
|
|
251
|
-
flip?: boolean
|
|
252
|
-
objects?: boolean
|
|
253
|
-
floorplan?: {
|
|
254
|
-
render?: boolean
|
|
255
|
-
alpha?: number
|
|
256
|
-
elevationInCm?: number
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
declare interface SmplrCoord2d {
|
|
261
|
-
levelIndex: number;
|
|
262
|
-
x: number;
|
|
263
|
-
z: number;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
declare interface SmplrCoord3d extends SmplrCoord2d {
|
|
267
|
-
elevation: number;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
export declare class Space {
|
|
271
|
-
private options;
|
|
272
|
-
private viewerStarted;
|
|
273
|
-
private scene;
|
|
274
|
-
private container;
|
|
275
|
-
private setPickHandler;
|
|
276
|
-
private dispatchDataLayersDefinition;
|
|
277
|
-
constructor(options: SpaceOptions);
|
|
278
|
-
private checkOptions;
|
|
279
|
-
private prepareContainer;
|
|
280
|
-
remove: () => void;
|
|
281
|
-
preview({ mode, onViewerReady, onError }: DeprecatedPreviewProps): void;
|
|
282
|
-
startViewer(options: ViewerOptions): void;
|
|
283
|
-
addDataLayer<D extends UnknownData>(dataLayer: DataLayer<D>): void;
|
|
284
|
-
updateDataLayer<D extends UnknownData>(dataLayer: Partial<DataLayer<D>>): void;
|
|
285
|
-
removeDataLayer(id: string): void;
|
|
286
|
-
enablePickingMode({ onPick }: {
|
|
287
|
-
onPick: OnPickFn;
|
|
288
|
-
}): void;
|
|
289
|
-
disablePickingMode(): void;
|
|
290
|
-
getCameraPlacement(): OrbitCameraPlacement;
|
|
291
|
-
setCameraPlacement(placement: OrbitCameraPlacement): void;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
declare interface Space_2 {
|
|
295
|
-
id: string
|
|
296
|
-
created_at: string
|
|
297
|
-
modified_at: string
|
|
298
|
-
name: string
|
|
299
|
-
public_link_enabled: boolean
|
|
300
|
-
status: 'draft' | 'published' | 'archived' | 'deleted'
|
|
301
|
-
definition: object | null
|
|
302
|
-
embed_image: string | null
|
|
303
|
-
short_code: string | null
|
|
304
|
-
assetmap: object | null
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
declare interface SpaceOptions {
|
|
308
|
-
spaceId: string;
|
|
309
|
-
clientToken: string;
|
|
310
|
-
containerId: string;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
declare type UnknownData = Record<string, unknown>;
|
|
314
|
-
|
|
315
|
-
declare interface Vector2Coord {
|
|
316
|
-
x: number;
|
|
317
|
-
y: number;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
declare interface Vector3Coord extends Vector2Coord {
|
|
321
|
-
z: number;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
export declare const version = "2.4.1-beta.13";
|
|
325
|
-
|
|
326
|
-
declare interface ViewerOptions {
|
|
327
|
-
mode?: CameraMode;
|
|
328
|
-
preview?: boolean;
|
|
329
|
-
allowModeChange?: boolean;
|
|
330
|
-
cameraPlacement?: OrbitCameraPlacement;
|
|
331
|
-
disableCameraControls?: boolean;
|
|
332
|
-
hideNavigationButtons?: boolean;
|
|
333
|
-
compass?: boolean;
|
|
334
|
-
annotations?: boolean;
|
|
335
|
-
renderOptions?: RenderOptions;
|
|
336
|
-
onReady?: () => void;
|
|
337
|
-
onError?: (error: unknown) => void;
|
|
338
|
-
onModeChange?: (mode: CameraMode) => void;
|
|
339
|
-
loadingMessage?: string;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
export { }
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
const c = (r) => new Promise((o, s) => {
|
|
2
|
-
try {
|
|
3
|
-
const e = document.createElement("script");
|
|
4
|
-
e.type = "text/javascript", e.async = !0, e.src = r, e.addEventListener("load", () => {
|
|
5
|
-
o("ok");
|
|
6
|
-
}), e.addEventListener("error", () => {
|
|
7
|
-
s(`Failed to load the script from ${r}`);
|
|
8
|
-
}), document.body.appendChild(e);
|
|
9
|
-
} catch (e) {
|
|
10
|
-
s(e);
|
|
11
|
-
}
|
|
12
|
-
}), p = (r) => import(
|
|
13
|
-
r
|
|
14
|
-
/* @vite-ignore */
|
|
15
|
-
), a = (r) => new Promise((o, s) => {
|
|
16
|
-
try {
|
|
17
|
-
const e = document.createElement("link");
|
|
18
|
-
e.type = "text/css", e.href = r, e.rel = "stylesheet", e.addEventListener("load", () => {
|
|
19
|
-
o("ok");
|
|
20
|
-
}), e.addEventListener("error", () => {
|
|
21
|
-
const l = new Error(`Failed to load the stylesheet from ${r}`);
|
|
22
|
-
console.error(l), s(l);
|
|
23
|
-
}), document.head.appendChild(e);
|
|
24
|
-
} catch (e) {
|
|
25
|
-
console.error(e), s(e);
|
|
26
|
-
}
|
|
27
|
-
}), t = {
|
|
28
|
-
umd: {
|
|
29
|
-
prod: "https://app.smplrspace.com/lib/smplr.js",
|
|
30
|
-
dev: "https://dev.smplrspace.com/lib/smplr.js",
|
|
31
|
-
local: "http://localhost:3000/lib/smplr.umd.js"
|
|
32
|
-
},
|
|
33
|
-
esm: {
|
|
34
|
-
prod: "https://app.smplrspace.com/lib/smplr.mjs",
|
|
35
|
-
dev: "https://dev.smplrspace.com/lib/smplr.mjs",
|
|
36
|
-
local: "http://localhost:3000/lib/smplr.mjs"
|
|
37
|
-
},
|
|
38
|
-
css: {
|
|
39
|
-
prod: "https://app.smplrspace.com/lib/smplr.css",
|
|
40
|
-
dev: "https://dev.smplrspace.com/lib/smplr.css",
|
|
41
|
-
local: "http://localhost:3000/lib/style.css"
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
async function d(r = "esm", o = "prod") {
|
|
45
|
-
try {
|
|
46
|
-
a(t.css[o]);
|
|
47
|
-
} catch {
|
|
48
|
-
console.warn("oops");
|
|
49
|
-
}
|
|
50
|
-
try {
|
|
51
|
-
if (r === "esm") {
|
|
52
|
-
const s = await p(t.esm[o]);
|
|
53
|
-
return console.log("loaded esm", s), s;
|
|
54
|
-
} else {
|
|
55
|
-
await c(t.umd[o]);
|
|
56
|
-
const s = window.smplr;
|
|
57
|
-
if (!s)
|
|
58
|
-
throw new Error("Failed to load smplr.js");
|
|
59
|
-
return console.log("loaded umd", s), s;
|
|
60
|
-
}
|
|
61
|
-
} catch (s) {
|
|
62
|
-
throw console.error(s), new Error("Failed to load smplr.js");
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
export {
|
|
66
|
-
d as loadSmplrJs
|
|
67
|
-
};
|
package/dist/index.umd.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(r,l){typeof exports=="object"&&typeof module<"u"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(r=typeof globalThis<"u"?globalThis:r||self,l(r.SmplrLoader={}))})(this,function(r){"use strict";const l=o=>new Promise((t,s)=>{try{const e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src=o,e.addEventListener("load",()=>{t("ok")}),e.addEventListener("error",()=>{s(`Failed to load the script from ${o}`)}),document.body.appendChild(e)}catch(e){s(e)}}),c=o=>import(o),n=o=>new Promise((t,s)=>{try{const e=document.createElement("link");e.type="text/css",e.href=o,e.rel="stylesheet",e.addEventListener("load",()=>{t("ok")}),e.addEventListener("error",()=>{const d=new Error(`Failed to load the stylesheet from ${o}`);console.error(d),s(d)}),document.head.appendChild(e)}catch(e){console.error(e),s(e)}}),p={umd:{prod:"https://app.smplrspace.com/lib/smplr.js",dev:"https://dev.smplrspace.com/lib/smplr.js",local:"http://localhost:3000/lib/smplr.umd.js"},esm:{prod:"https://app.smplrspace.com/lib/smplr.mjs",dev:"https://dev.smplrspace.com/lib/smplr.mjs",local:"http://localhost:3000/lib/smplr.mjs"},css:{prod:"https://app.smplrspace.com/lib/smplr.css",dev:"https://dev.smplrspace.com/lib/smplr.css",local:"http://localhost:3000/lib/style.css"}};async function m(o="esm",t="prod"){try{n(p.css[t])}catch{console.warn("oops")}try{if(o==="esm"){const s=await c(p.esm[t]);return console.log("loaded esm",s),s}else{await l(p.umd[t]);const s=window.smplr;if(!s)throw new Error("Failed to load smplr.js");return console.log("loaded umd",s),s}}catch(s){throw console.error(s),new Error("Failed to load smplr.js")}}r.loadSmplrJs=m,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
|
package/dist/loadScript.d.ts
DELETED
package/dist/loadStylesheet.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const loadStylesheet: (url: string) => Promise<unknown>;
|