@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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webspatial/react-sdk",
3
- "version": "0.1.11",
3
+ "version": "0.1.14",
4
4
  "description": "React components for WebSpatial",
5
5
  "main": "./dist/default/index.js",
6
6
  "type": "module",
@@ -26,12 +26,10 @@
26
26
  },
27
27
  "./web": "./dist/web/index.js",
28
28
  "./web/jsx-dev-runtime": "./dist/jsx/jsx-dev-runtime.web.js",
29
- "./web/jsx-runtime": "./dist/jsx/jsx-runtime.web.js",
30
- "./plugin-esbuild": "./npm/plugin/esbuild.mjs"
29
+ "./web/jsx-runtime": "./dist/jsx/jsx-runtime.web.js"
31
30
  },
32
31
  "files": [
33
- "dist",
34
- "npm"
32
+ "dist"
35
33
  ],
36
34
  "repository": {
37
35
  "type": "git",
@@ -53,7 +51,7 @@
53
51
  "peerDependencies": {
54
52
  "react": ">=18.0.0",
55
53
  "react-dom": ">=18.0.0",
56
- "@webspatial/core-sdk": "0.1.11"
54
+ "@webspatial/core-sdk": "0.1.14"
57
55
  },
58
56
  "peerDependenciesMeta": {
59
57
  "@webspatial/core-sdk": {
@@ -1,66 +0,0 @@
1
- import 'react/jsx-runtime';
2
- import * as react from 'react';
3
- import { JSXSource } from 'react/jsx-dev-runtime';
4
-
5
- declare function jsxs(type: React.ElementType, props: unknown, key?: React.Key): react.ReactElement<any, string | react.JSXElementConstructor<any>>;
6
- declare function jsx(type: React.ElementType, props: unknown, key?: React.Key): react.ReactElement<any, string | react.JSXElementConstructor<any>>;
7
- declare function jsxDEV(type: React.ElementType, props: unknown, key: React.Key, isStatic: boolean, source?: JSXSource, self?: unknown): react.ReactElement<any, string | react.JSXElementConstructor<any>>;
8
-
9
- type IsPreReact19 = 2 extends Parameters<React.FunctionComponent<any>>['length'] ? true : false;
10
- /** @ts-ignore */
11
- type ReactJSXElement = true extends IsPreReact19 ? JSX.Element : React.JSX.Element;
12
- /** @ts-ignore */
13
- type ReactJSXElementClass = true extends IsPreReact19 ? JSX.ElementClass : React.JSX.ElementClass;
14
- /** @ts-ignore */
15
- type ReactJSXElementAttributesProperty = true extends IsPreReact19 ? JSX.ElementAttributesProperty : React.JSX.ElementAttributesProperty;
16
- /** @ts-ignore */
17
- type ReactJSXElementChildrenAttribute = true extends IsPreReact19 ? JSX.ElementChildrenAttribute : React.JSX.ElementChildrenAttribute;
18
- /** @ts-ignore */
19
- type ReactJSXLibraryManagedAttributes<C, P> = true extends IsPreReact19 ? JSX.LibraryManagedAttributes<C, P> : React.JSX.LibraryManagedAttributes<C, P>;
20
- /** @ts-ignore */
21
- type ReactJSXIntrinsicAttributes = true extends IsPreReact19 ? JSX.IntrinsicAttributes : React.JSX.IntrinsicAttributes;
22
- /** @ts-ignore */
23
- type ReactJSXIntrinsicClassAttributes<T> = true extends IsPreReact19 ? JSX.IntrinsicClassAttributes<T> : React.JSX.IntrinsicClassAttributes<T>;
24
- /** @ts-ignore */
25
- type ReactJSXIntrinsicElements = true extends IsPreReact19 ? JSX.IntrinsicElements : React.JSX.IntrinsicElements;
26
- /** @ts-ignore */
27
- type ReactJSXElementType = true extends IsPreReact19 ? string | React.JSXElementConstructor<any> : React.JSX.ElementType;
28
- declare namespace WebSpatialJSX {
29
- type ElementType = ReactJSXElementType;
30
- interface Element extends ReactJSXElement {
31
- }
32
- interface ElementClass extends ReactJSXElementClass {
33
- }
34
- interface ElementAttributesProperty extends ReactJSXElementAttributesProperty {
35
- }
36
- interface ElementChildrenAttribute extends ReactJSXElementChildrenAttribute {
37
- }
38
- type LibraryManagedAttributes<C, P> = ReactJSXLibraryManagedAttributes<C, P>;
39
- interface IntrinsicAttributes extends ReactJSXIntrinsicAttributes {
40
- }
41
- interface IntrinsicClassAttributes<T> extends ReactJSXIntrinsicClassAttributes<T> {
42
- }
43
- type IntrinsicElements = {
44
- [K in keyof ReactJSXIntrinsicElements]: ReactJSXIntrinsicElements[K] & {
45
- style?: React.CSSProperties;
46
- 'enable-xr'?: boolean;
47
- };
48
- };
49
- }
50
- declare module 'react' {
51
- interface CSSProperties {
52
- '--xr-background-material'?: string;
53
- '--xr-back'?: number | string;
54
- '--xr-z-index'?: number | string;
55
- }
56
- }
57
-
58
- declare global {
59
- interface CSSStyleDeclaration {
60
- '--xr-background-material'?: string;
61
- '--xr-back'?: number | string;
62
- '--xr-z-index'?: number | string;
63
- }
64
- }
65
-
66
- export { WebSpatialJSX as W, jsx as a, jsxs as b, jsxDEV as j };
@@ -1,11 +0,0 @@
1
- import { definePlugin } from 'esbuild-plugin-define'
2
- const injectEnvPlugin = () => {
3
- return definePlugin({
4
- process: {
5
- env: {
6
- XR_ENV: process.env.XR_ENV,
7
- },
8
- },
9
- })
10
- }
11
- export default injectEnvPlugin
@@ -1,8 +0,0 @@
1
- export default function injectProcessEnv() {
2
- return {
3
- name: 'rollup-plugin-inject-env',
4
- define: {
5
- 'process.env.XR_ENV': JSON.stringify(process.env.XR_ENV || ''),
6
- },
7
- }
8
- }
@@ -1,9 +0,0 @@
1
- const AVP = 'avp'
2
- function getEnv() {
3
- const env = process.env.XR_ENV || ''
4
- return env
5
- }
6
- module.exports = {
7
- getEnv,
8
- AVP,
9
- }
@@ -1,5 +0,0 @@
1
- import { Plugin } from 'vite'
2
-
3
- declare function injectProcessEnv(): Plugin
4
-
5
- export = injectProcessEnv
@@ -1,86 +0,0 @@
1
- const path = require('path')
2
- const fs = require('fs')
3
- const { getEnv, AVP } = require('./shared')
4
-
5
- function injectProcessEnv() {
6
- return {
7
- name: 'vite-plugin-inject-env',
8
- config: () => {
9
- const xrEnv = getEnv()
10
-
11
- const isAVP = xrEnv === AVP
12
-
13
- const output = isAVP
14
- ? {
15
- entryFileNames: `assets/[name]-[hash].${AVP}.js`, // no share js entry
16
- chunkFileNames: `assets/[name]-[hash].${AVP}.js`, // no share js chunk
17
- assetFileNames: 'assets/[name]-[hash][extname]', // shared css image
18
- }
19
- : {}
20
-
21
- return {
22
- resolve: {
23
- alias: [
24
- {
25
- find: /^@webspatial\/react-sdk$/,
26
- replacement: isAVP
27
- ? '@webspatial/react-sdk/default'
28
- : '@webspatial/react-sdk/web',
29
- },
30
- ],
31
- },
32
- define: {
33
- 'process.env.XR_ENV': JSON.stringify(xrEnv),
34
- 'import.meta.env.XR_ENV': JSON.stringify(xrEnv), // visible in development
35
- },
36
- build: {
37
- emptyOutDir: xrEnv !== AVP, // keep dist folder
38
- rollupOptions: {
39
- output,
40
- },
41
- },
42
- optimizeDeps: {},
43
- }
44
- },
45
- renderStart(outputOptions) {
46
- // rename index.html to index.avp.html
47
- const xrEnv = getEnv()
48
- if (xrEnv !== AVP) {
49
- return
50
- }
51
-
52
- const outDir = outputOptions.dir || 'dist'
53
- const indexPath = path.resolve(outDir, 'index.html')
54
- const tempIndexPath = path.resolve(outDir, 'index.html.tmp')
55
-
56
- if (fs.existsSync(indexPath)) {
57
- fs.renameSync(indexPath, tempIndexPath)
58
- console.log(
59
- `[Build Start] Renamed existing index.html to ${tempIndexPath}`,
60
- )
61
- }
62
- },
63
- writeBundle(outputOptions) {
64
- const xrEnv = getEnv()
65
- if (xrEnv !== AVP) {
66
- return
67
- }
68
- const outDir = outputOptions.dir || 'dist'
69
- const indexHtmlPath = path.resolve(outDir, 'index.html')
70
- const tempIndexPath = path.resolve(outDir, 'index.html.tmp')
71
- const newHtmlPath = path.resolve(outDir, 'index.avp.html')
72
-
73
- if (fs.existsSync(indexHtmlPath)) {
74
- fs.renameSync(indexHtmlPath, newHtmlPath)
75
- console.log(`Renamed index.html to ${newHtmlPath}`)
76
- }
77
-
78
- // recover index.html.tmp to index.html
79
- if (fs.existsSync(tempIndexPath)) {
80
- fs.renameSync(tempIndexPath, indexHtmlPath)
81
- console.log(`Renamed ${tempIndexPath} back to index.html`)
82
- }
83
- },
84
- }
85
- }
86
- module.exports = injectProcessEnv
@@ -1,9 +0,0 @@
1
- const webpack = require('webpack')
2
-
3
- module.exports = {
4
- plugins: [
5
- new webpack.DefinePlugin({
6
- 'process.env.XR_ENV': JSON.stringify(process.env.XR_ENV || ''),
7
- }),
8
- ],
9
- }