@avs/go-react 0.12.71731
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/README.md +28 -0
- package/demo/README.md +73 -0
- package/demo/eslint.config.js +23 -0
- package/demo/index.html +13 -0
- package/demo/package.json +15 -0
- package/demo/public/hydrogen.json +1 -0
- package/demo/src/App.css +40 -0
- package/demo/src/App.tsx +17 -0
- package/demo/src/index.css +68 -0
- package/demo/src/main.tsx +7 -0
- package/demo/tsconfig.app.json +28 -0
- package/demo/tsconfig.json +7 -0
- package/demo/tsconfig.node.json +26 -0
- package/demo/vite.config.ts +7 -0
- package/package.json +23 -0
- package/src/AvsGoDataViz.jsx +258 -0
- package/src/AvsGoDynamicHtml.jsx +68 -0
- package/src/AvsGoInfo.jsx +83 -0
package/demo/src/App.css
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#root {
|
|
2
|
+
margin: 0 auto;
|
|
3
|
+
text-align: center;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.logo {
|
|
7
|
+
height: 6em;
|
|
8
|
+
padding: 1.5em;
|
|
9
|
+
will-change: filter;
|
|
10
|
+
transition: filter 300ms;
|
|
11
|
+
}
|
|
12
|
+
.logo:hover {
|
|
13
|
+
filter: drop-shadow(0 0 2em #646cffaa);
|
|
14
|
+
}
|
|
15
|
+
.logo.react:hover {
|
|
16
|
+
filter: drop-shadow(0 0 2em #61dafbaa);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@keyframes logo-spin {
|
|
20
|
+
from {
|
|
21
|
+
transform: rotate(0deg);
|
|
22
|
+
}
|
|
23
|
+
to {
|
|
24
|
+
transform: rotate(360deg);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
29
|
+
a:nth-of-type(2) .logo {
|
|
30
|
+
animation: logo-spin infinite 20s linear;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.card {
|
|
35
|
+
padding: 2em;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.read-the-docs {
|
|
39
|
+
color: #888;
|
|
40
|
+
}
|
package/demo/src/App.tsx
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import './App.css'
|
|
2
|
+
import { AvsGoDataViz } from '@avs/go-react/src/AvsGoDataViz';
|
|
3
|
+
|
|
4
|
+
function App() {
|
|
5
|
+
return (
|
|
6
|
+
<div style={{width: '100vw', height: '100vh'}}>
|
|
7
|
+
<AvsGoDataViz
|
|
8
|
+
url='hydrogen.json'
|
|
9
|
+
urlLoadJsonFile
|
|
10
|
+
renderer='THREEJS'
|
|
11
|
+
transformEnable
|
|
12
|
+
/>
|
|
13
|
+
</div>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default App
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
3
|
+
line-height: 1.5;
|
|
4
|
+
font-weight: 400;
|
|
5
|
+
|
|
6
|
+
color-scheme: light dark;
|
|
7
|
+
color: rgba(255, 255, 255, 0.87);
|
|
8
|
+
background-color: #242424;
|
|
9
|
+
|
|
10
|
+
font-synthesis: none;
|
|
11
|
+
text-rendering: optimizeLegibility;
|
|
12
|
+
-webkit-font-smoothing: antialiased;
|
|
13
|
+
-moz-osx-font-smoothing: grayscale;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
a {
|
|
17
|
+
font-weight: 500;
|
|
18
|
+
color: #646cff;
|
|
19
|
+
text-decoration: inherit;
|
|
20
|
+
}
|
|
21
|
+
a:hover {
|
|
22
|
+
color: #535bf2;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
body {
|
|
26
|
+
margin: 0;
|
|
27
|
+
display: flex;
|
|
28
|
+
place-items: center;
|
|
29
|
+
min-width: 320px;
|
|
30
|
+
min-height: 100vh;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
h1 {
|
|
34
|
+
font-size: 3.2em;
|
|
35
|
+
line-height: 1.1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
button {
|
|
39
|
+
border-radius: 8px;
|
|
40
|
+
border: 1px solid transparent;
|
|
41
|
+
padding: 0.6em 1.2em;
|
|
42
|
+
font-size: 1em;
|
|
43
|
+
font-weight: 500;
|
|
44
|
+
font-family: inherit;
|
|
45
|
+
background-color: #1a1a1a;
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
transition: border-color 0.25s;
|
|
48
|
+
}
|
|
49
|
+
button:hover {
|
|
50
|
+
border-color: #646cff;
|
|
51
|
+
}
|
|
52
|
+
button:focus,
|
|
53
|
+
button:focus-visible {
|
|
54
|
+
outline: 4px auto -webkit-focus-ring-color;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@media (prefers-color-scheme: light) {
|
|
58
|
+
:root {
|
|
59
|
+
color: #213547;
|
|
60
|
+
background-color: #ffffff;
|
|
61
|
+
}
|
|
62
|
+
a:hover {
|
|
63
|
+
color: #747bff;
|
|
64
|
+
}
|
|
65
|
+
button {
|
|
66
|
+
background-color: #f9f9f9;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"useDefineForClassFields": true,
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"types": ["vite/client"],
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
|
|
11
|
+
/* Bundler mode */
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"moduleDetection": "force",
|
|
16
|
+
"noEmit": true,
|
|
17
|
+
"jsx": "react-jsx",
|
|
18
|
+
|
|
19
|
+
/* Linting */
|
|
20
|
+
"strict": true,
|
|
21
|
+
"noUnusedLocals": true,
|
|
22
|
+
"noUnusedParameters": true,
|
|
23
|
+
"erasableSyntaxOnly": true,
|
|
24
|
+
"noFallthroughCasesInSwitch": true,
|
|
25
|
+
"noUncheckedSideEffectImports": true
|
|
26
|
+
},
|
|
27
|
+
"include": ["src"]
|
|
28
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
+
"target": "ES2023",
|
|
5
|
+
"lib": ["ES2023"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
|
|
10
|
+
/* Bundler mode */
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"allowImportingTsExtensions": true,
|
|
13
|
+
"verbatimModuleSyntax": true,
|
|
14
|
+
"moduleDetection": "force",
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
|
|
17
|
+
/* Linting */
|
|
18
|
+
"strict": true,
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true,
|
|
21
|
+
"erasableSyntaxOnly": true,
|
|
22
|
+
"noFallthroughCasesInSwitch": true,
|
|
23
|
+
"noUncheckedSideEffectImports": true
|
|
24
|
+
},
|
|
25
|
+
"include": ["vite.config.ts"]
|
|
26
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@avs/go-react",
|
|
3
|
+
"version": "0.12.71731",
|
|
4
|
+
"description": "React wrapper for AVS/Go web components",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"visualization",
|
|
7
|
+
"dataviz",
|
|
8
|
+
"react",
|
|
9
|
+
"avs"
|
|
10
|
+
],
|
|
11
|
+
"author": "Advanced Visual Systems Inc.",
|
|
12
|
+
"license": "Apache-2.0",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@avs/go": "^0.12.0",
|
|
15
|
+
"react": "^19.2.0",
|
|
16
|
+
"react-dom": "^19.2.0"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/avs/avs-go.git",
|
|
21
|
+
"directory": "packages/react"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Advanced Visual Systems Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*
|
|
17
|
+
* This product includes software developed at
|
|
18
|
+
* Advanced Visual Systems Inc. (http://www.avs.com)
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { forwardRef, useRef, useEffect, useImperativeHandle } from 'react';
|
|
22
|
+
import { AvsGoDataViz as AvsGoDataVizPolymer } from '@avs/go/src/avs-go-dataviz';
|
|
23
|
+
|
|
24
|
+
export const AvsGoDataViz = forwardRef(({
|
|
25
|
+
manualUpdate,
|
|
26
|
+
displayCanvas,
|
|
27
|
+
url,
|
|
28
|
+
urlLoadJsonFile,
|
|
29
|
+
sceneName,
|
|
30
|
+
sceneUserProperties,
|
|
31
|
+
dataSourceName,
|
|
32
|
+
dataSourceUserProperties,
|
|
33
|
+
rendererName,
|
|
34
|
+
rendererUserProperties,
|
|
35
|
+
renderer,
|
|
36
|
+
streamEnable,
|
|
37
|
+
streamChunkSizeFirst,
|
|
38
|
+
streamChunkSize,
|
|
39
|
+
themeName,
|
|
40
|
+
hidden,
|
|
41
|
+
resizeThreshold,
|
|
42
|
+
aspectRatio,
|
|
43
|
+
pointerTimeout,
|
|
44
|
+
tapEnable,
|
|
45
|
+
tapLevel,
|
|
46
|
+
tapDepth,
|
|
47
|
+
tapHighlightEnable,
|
|
48
|
+
tapHighlightColor,
|
|
49
|
+
tapHighlightLayerEnable,
|
|
50
|
+
tapProcessEventOnClient,
|
|
51
|
+
onTap,
|
|
52
|
+
trackEnable,
|
|
53
|
+
trackLevel,
|
|
54
|
+
trackDepth,
|
|
55
|
+
trackHighlightEnable,
|
|
56
|
+
trackHighlightColor,
|
|
57
|
+
trackHighlightLayerEnable,
|
|
58
|
+
trackProcessEventOnClient,
|
|
59
|
+
onTrack,
|
|
60
|
+
hoverEnable,
|
|
61
|
+
hoverLevel,
|
|
62
|
+
hoverDepth,
|
|
63
|
+
hoverHighlightEnable,
|
|
64
|
+
hoverHighlightColor,
|
|
65
|
+
hoverHighlightLayerEnable,
|
|
66
|
+
onHover,
|
|
67
|
+
transformEnable,
|
|
68
|
+
transformClientOnly,
|
|
69
|
+
transformRotateDisable,
|
|
70
|
+
transformZoomDisable,
|
|
71
|
+
transformPanDisable,
|
|
72
|
+
transformTwistAngle,
|
|
73
|
+
transformTiltAngle,
|
|
74
|
+
transformScale,
|
|
75
|
+
zoomRectangleEnable,
|
|
76
|
+
panEnable,
|
|
77
|
+
panZoomEnable,
|
|
78
|
+
panWidthZoomLevel,
|
|
79
|
+
panHeightZoomLevel,
|
|
80
|
+
panMaximumZoomLevel,
|
|
81
|
+
animatedGlyphsVisible,
|
|
82
|
+
animatedGlyphsEnable,
|
|
83
|
+
onSceneInfo,
|
|
84
|
+
onLoadComplete,
|
|
85
|
+
onPanInfo,
|
|
86
|
+
onError
|
|
87
|
+
}, ref) => {
|
|
88
|
+
|
|
89
|
+
const dataVizRef = useRef();
|
|
90
|
+
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (!dataVizRef.current) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function handleTap(e) {
|
|
97
|
+
if (onTap) {
|
|
98
|
+
onTap(e.detail);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function handleTrack(e) {
|
|
103
|
+
if (onTrack) {
|
|
104
|
+
onTrack(e.detail);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function handleHover(e) {
|
|
109
|
+
if (onHover) {
|
|
110
|
+
onHover(e.detail);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function handleSceneInfo(e) {
|
|
115
|
+
if (onSceneInfo) {
|
|
116
|
+
onSceneInfo(e.detail);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function handleLoadComplete(e) {
|
|
121
|
+
if (onLoadComplete) {
|
|
122
|
+
onLoadComplete();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function handlePanInfo(e) {
|
|
127
|
+
if (onPanInfo) {
|
|
128
|
+
onPanInfo(e.detail);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function handleError(e) {
|
|
133
|
+
if (onError) {
|
|
134
|
+
onError(e.detail);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
dataVizRef.current.addEventListener('avs-tap', handleTap);
|
|
139
|
+
dataVizRef.current.addEventListener('avs-track', handleTrack);
|
|
140
|
+
dataVizRef.current.addEventListener('avs-hover', handleHover);
|
|
141
|
+
dataVizRef.current.addEventListener('avs-scene-info', handleSceneInfo);
|
|
142
|
+
dataVizRef.current.addEventListener('avs-load-complete', handleLoadComplete);
|
|
143
|
+
dataVizRef.current.addEventListener('avs-pan-info', handlePanInfo);
|
|
144
|
+
dataVizRef.current.addEventListener('avs-error', handleError);
|
|
145
|
+
|
|
146
|
+
return () => {
|
|
147
|
+
if (dataVizRef.current) {
|
|
148
|
+
dataVizRef.current.removeEventListener('avs-tap', handleTap);
|
|
149
|
+
dataVizRef.current.removeEventListener('avs-track', handleTrack);
|
|
150
|
+
dataVizRef.current.removeEventListener('avs-hover', handleHover);
|
|
151
|
+
dataVizRef.current.removeEventListener('avs-scene-info', handleSceneInfo);
|
|
152
|
+
dataVizRef.current.removeEventListener('avs-load-complete', handleLoadComplete);
|
|
153
|
+
dataVizRef.current.removeEventListener('avs-pan-info', handlePanInfo);
|
|
154
|
+
dataVizRef.current.removeEventListener('avs-error', handleError);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}, []);
|
|
158
|
+
|
|
159
|
+
useImperativeHandle(ref, () => ({
|
|
160
|
+
updateViewer() {
|
|
161
|
+
if (dataVizRef.current) {
|
|
162
|
+
dataVizRef.current.updateViewer();
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
runAnimation() {
|
|
167
|
+
if (dataVizRef.current) {
|
|
168
|
+
dataVizRef.current.runAnimation();
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
resetTransform() {
|
|
173
|
+
if (dataVizRef.current) {
|
|
174
|
+
dataVizRef.current.resetTransform();
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
zoomIn() {
|
|
179
|
+
if (dataVizRef.current) {
|
|
180
|
+
dataVizRef.current.zoomIn();
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
zoomOut() {
|
|
185
|
+
if (dataVizRef.current) {
|
|
186
|
+
dataVizRef.current.zoomOut();
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
panTo() {
|
|
191
|
+
if (dataVizRef.current) {
|
|
192
|
+
dataVizRef.current.panTo();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}));
|
|
196
|
+
|
|
197
|
+
return (
|
|
198
|
+
<avs-go-dataviz
|
|
199
|
+
ref={dataVizRef}
|
|
200
|
+
manual-update={manualUpdate}
|
|
201
|
+
display-canvas={displayCanvas}
|
|
202
|
+
url={url}
|
|
203
|
+
url-load-json-file={urlLoadJsonFile}
|
|
204
|
+
scene-name={sceneName}
|
|
205
|
+
scene-user-properties={sceneUserProperties}
|
|
206
|
+
data-source-name={dataSourceName}
|
|
207
|
+
data-source-user-properties={dataSourceUserProperties}
|
|
208
|
+
renderer-name={rendererName}
|
|
209
|
+
renderer-user-properties={rendererUserProperties}
|
|
210
|
+
renderer={renderer}
|
|
211
|
+
stream-enable={streamEnable}
|
|
212
|
+
stream-chunk-size-first={streamChunkSizeFirst}
|
|
213
|
+
stream-chunk-size={streamChunkSize}
|
|
214
|
+
theme-name={themeName}
|
|
215
|
+
hidden={hidden}
|
|
216
|
+
resize-threshold={resizeThreshold}
|
|
217
|
+
aspect-ratio={aspectRatio}
|
|
218
|
+
pointer-timeout={pointerTimeout}
|
|
219
|
+
tap-enable={tapEnable}
|
|
220
|
+
tap-level={tapLevel}
|
|
221
|
+
tap-depth={tapDepth}
|
|
222
|
+
tap-highlight-enable={tapHighlightEnable}
|
|
223
|
+
tap-highlight-color={tapHighlightColor}
|
|
224
|
+
tap-highlight-layer-enable={tapHighlightLayerEnable}
|
|
225
|
+
tap-process-event-on-client={tapProcessEventOnClient}
|
|
226
|
+
track-enable={trackEnable}
|
|
227
|
+
track-level={trackLevel}
|
|
228
|
+
track-depth={trackDepth}
|
|
229
|
+
track-highlight-enable={trackHighlightEnable}
|
|
230
|
+
track-highlight-color={trackHighlightColor}
|
|
231
|
+
track-highlight-layer-enable={trackHighlightLayerEnable}
|
|
232
|
+
track-process-event-on-client={trackProcessEventOnClient}
|
|
233
|
+
hover-enable={hoverEnable}
|
|
234
|
+
hover-level={hoverLevel}
|
|
235
|
+
horer-depth={hoverDepth}
|
|
236
|
+
hover-highlight-enable={hoverHighlightEnable}
|
|
237
|
+
hover-highlight-color={hoverHighlightColor}
|
|
238
|
+
hover-highlight-layer-enable={hoverHighlightLayerEnable}
|
|
239
|
+
transform-enable={transformEnable}
|
|
240
|
+
transform-client-only={transformClientOnly}
|
|
241
|
+
transform-rotate-disable={transformRotateDisable}
|
|
242
|
+
transform-zoom-disable={transformZoomDisable}
|
|
243
|
+
transform-pan-disable={transformPanDisable}
|
|
244
|
+
transform-twist-angle={transformTwistAngle}
|
|
245
|
+
transform-tilt-angle={transformTiltAngle}
|
|
246
|
+
transform-scale={transformScale}
|
|
247
|
+
zoom-reactangle-enable={zoomRectangleEnable}
|
|
248
|
+
pan-enable={panEnable}
|
|
249
|
+
pan-zoom-enable={panZoomEnable}
|
|
250
|
+
pan-width-zoom-level={panWidthZoomLevel}
|
|
251
|
+
pan-height-zoom-level={panHeightZoomLevel}
|
|
252
|
+
pan-maximum-zoom-level={panMaximumZoomLevel}
|
|
253
|
+
animated-glyphs-visible={animatedGlyphsVisible}
|
|
254
|
+
animated-glyphs-enable={animatedGlyphsEnable}
|
|
255
|
+
>
|
|
256
|
+
</avs-go-dataviz>
|
|
257
|
+
);
|
|
258
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Advanced Visual Systems Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*
|
|
17
|
+
* This product includes software developed at
|
|
18
|
+
* Advanced Visual Systems Inc. (http://www.avs.com)
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { forwardRef, useRef, useEffect, useImperativeHandle } from 'react';
|
|
22
|
+
import { AvsGoDynamicHtml as AvsGoDynamicHtmlPolymer } from '@avs/go/src/avs-go-dynamic-html';
|
|
23
|
+
|
|
24
|
+
export const AvsGoDynamicHtml = forwardRef(({
|
|
25
|
+
url,
|
|
26
|
+
linkCss,
|
|
27
|
+
dynamicHtmlName,
|
|
28
|
+
dynamicHtmlUserProperties,
|
|
29
|
+
dataSourceName,
|
|
30
|
+
dataSourceUserProperties,
|
|
31
|
+
onError
|
|
32
|
+
}, ref) => {
|
|
33
|
+
|
|
34
|
+
const dynamicHtmlRef = useRef();
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!dynamicHtmlRef.current) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function handleError(e) {
|
|
42
|
+
if (onError) {
|
|
43
|
+
onError(e.detail);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
dynamicHtmlRef.current.addEventListener('avs-error', handleError);
|
|
48
|
+
|
|
49
|
+
return () => {
|
|
50
|
+
if (dynamicHtmlRef.current) {
|
|
51
|
+
dynamicHtmlRef.current.removeEventListener('avs-error', handleError);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, []);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<avs-go-dynamic-html
|
|
58
|
+
ref={dynamicHtmlRef}
|
|
59
|
+
url={url}
|
|
60
|
+
link-css={linkCss}
|
|
61
|
+
dynamic-html-name={dynamicHtmlName}
|
|
62
|
+
dynamic-html-user-properties={dynamicHtmlUserProperties}
|
|
63
|
+
data-source-name={dataSourceName}
|
|
64
|
+
data-source-user-properties={dataSourceUserProperties}
|
|
65
|
+
>
|
|
66
|
+
</avs-go-dynamic-html>
|
|
67
|
+
);
|
|
68
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Advanced Visual Systems Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*
|
|
17
|
+
* This product includes software developed at
|
|
18
|
+
* Advanced Visual Systems Inc. (http://www.avs.com)
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { forwardRef, useRef, useEffect, useImperativeHandle } from 'react';
|
|
22
|
+
import { AvsGoInfo as AvsGoInfoPolymer } from '@avs/go/src/avs-go-info';
|
|
23
|
+
|
|
24
|
+
export const AvsGoInfo = forwardRef(({
|
|
25
|
+
url,
|
|
26
|
+
infoName,
|
|
27
|
+
infoUserProperties,
|
|
28
|
+
dataSourceName,
|
|
29
|
+
dataSourceUserProperties,
|
|
30
|
+
onInfo,
|
|
31
|
+
onError
|
|
32
|
+
}, ref) => {
|
|
33
|
+
|
|
34
|
+
const infoRef = useRef();
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!infoRef.current) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function handleInfo(e) {
|
|
42
|
+
if (onInfo) {
|
|
43
|
+
onInfo(e.detail);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function handleError(e) {
|
|
48
|
+
if (onError) {
|
|
49
|
+
onError(e.detail);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
infoRef.current.addEventListener('avs-go-info-response', handleInfo);
|
|
54
|
+
infoRef.current.addEventListener('avs-error', handleError);
|
|
55
|
+
|
|
56
|
+
return () => {
|
|
57
|
+
if (infoRef.current) {
|
|
58
|
+
infoRef.current.removeEventListener('avs-go-info-response', handleSceneInfo);
|
|
59
|
+
infoRef.current.removeEventListener('avs-error', handleError);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}, []);
|
|
63
|
+
|
|
64
|
+
useImperativeHandle(ref, () => ({
|
|
65
|
+
updateInfo() {
|
|
66
|
+
if (infoRef.current) {
|
|
67
|
+
infoRef.current.updateInfo();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<avs-go-info
|
|
74
|
+
ref={infoRef}
|
|
75
|
+
url={url}
|
|
76
|
+
info-name={infoName}
|
|
77
|
+
info-user-properties={infoUserProperties}
|
|
78
|
+
data-source-name={dataSourceName}
|
|
79
|
+
data-source-user-properties={dataSourceUserProperties}
|
|
80
|
+
>
|
|
81
|
+
</avs-go-info>
|
|
82
|
+
);
|
|
83
|
+
});
|