@avs/go 0.14.72000 → 0.14.72008

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.
Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/dist/avs-element-mixin.d.ts +28 -0
  3. package/dist/avs-element-mixin.d.ts.map +1 -0
  4. package/dist/avs-element-mixin.js +108 -0
  5. package/dist/avs-go-dataviz.d.ts +457 -0
  6. package/dist/avs-go-dataviz.d.ts.map +1 -0
  7. package/dist/avs-go-dataviz.js +2090 -0
  8. package/dist/avs-go-dynamic-html.d.ts +52 -0
  9. package/dist/avs-go-dynamic-html.d.ts.map +1 -0
  10. package/dist/avs-go-dynamic-html.js +124 -0
  11. package/dist/avs-go-info.d.ts +57 -0
  12. package/dist/avs-go-info.d.ts.map +1 -0
  13. package/dist/avs-go-info.js +127 -0
  14. package/dist/avs-go.min.js +211 -160
  15. package/dist/avs-renderer.d.ts +37 -0
  16. package/dist/avs-renderer.d.ts.map +1 -0
  17. package/dist/avs-renderer.js +33 -0
  18. package/dist/constants.d.ts +21 -0
  19. package/dist/constants.d.ts.map +1 -0
  20. package/dist/constants.js +20 -0
  21. package/dist/icons.d.ts +28 -0
  22. package/dist/icons.d.ts.map +1 -0
  23. package/dist/icons.js +27 -0
  24. package/dist/index.d.ts +23 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +22 -0
  27. package/dist/types.d.ts +142 -0
  28. package/dist/types.d.ts.map +1 -0
  29. package/dist/types.js +36 -0
  30. package/package.json +4 -3
  31. package/rollup.config.js +17 -7
  32. package/src/avs-element-mixin.ts +126 -0
  33. package/src/{avs-go-dataviz.js → avs-go-dataviz.ts} +518 -654
  34. package/src/{avs-go-dynamic-html.js → avs-go-dynamic-html.ts} +37 -50
  35. package/src/{avs-go-info.js → avs-go-info.ts} +36 -47
  36. package/src/{avs-renderer.js → avs-renderer.ts} +10 -2
  37. package/src/{constants.js → constants.ts} +1 -1
  38. package/src/icons.ts +29 -0
  39. package/src/{avs-go.js → index.ts} +3 -3
  40. package/src/types.ts +160 -0
  41. package/tsconfig.json +16 -0
  42. package/src/avs-element-base.js +0 -119
  43. package/src/logo.js +0 -29
@@ -18,10 +18,12 @@
18
18
  * Advanced Visual Systems Inc. (http://www.avs.com)
19
19
  */
20
20
 
21
- import { AvsElementBase } from './avs-element-base.js';
22
- import { html } from 'lit';
21
+ import { LitElement, html, PropertyValues } from 'lit';
22
+ import { customElement, property, state } from 'lit/decorators.js';
23
+ import { AvsElementMixin } from './avs-element-mixin.js';
23
24
  import { unsafeHTML } from 'lit/directives/unsafe-html.js';
24
25
  import DOMPurify from 'dompurify';
26
+ import { DynamicHtmlModel, DynamicHtmlResponse } from './types.js';
25
27
 
26
28
  /**
27
29
  * `avs-go-dynamic-html` is a Lit element which requests HTML by instancing
@@ -30,58 +32,39 @@ import DOMPurify from 'dompurify';
30
32
  *
31
33
  * @customElement
32
34
  * @lit
35
+ * @applysMixin AvsElementMixin
33
36
  */
34
- export class AvsGoDynamicHtml extends AvsElementBase {
35
- static properties = {
36
- /**
37
- * The URL to an instance of AVS/Go server application.
38
- */
39
- url: {
40
- type: String
41
- },
37
+ @customElement('avs-go-dynamic-html')
38
+ export class AvsGoDynamicHtml extends AvsElementMixin(LitElement) {
42
39
 
43
- /**
44
- * Name of the data source registered in the library map on the server.
45
- */
46
- dataSourceName: {
47
- type: String,
48
- attribute: 'data-source-name'
49
- },
40
+ /** The URL to an instance of AVS/Go server application. */
41
+ @property()
42
+ url: string;
50
43
 
51
- /**
52
- * User properties as JSON passed directly to the data source on the server.
53
- */
54
- dataSourceUserProperties: {
55
- type: String,
56
- attribute: 'data-source-user-properties'
57
- },
44
+ /** Name of the data source registered in the library map on the server. */
45
+ @property({ attribute: 'data-source-name' })
46
+ dataSourceName?: string;
58
47
 
59
- /**
60
- * The name of the dynamic html registered in the library map on the server.
61
- */
62
- dynamicHtmlName: {
63
- type: String,
64
- attribute: 'dynamic-html-name'
65
- },
48
+ /** User properties as JSON passed directly to the data source on the server. */
49
+ @property({ attribute: 'data-source-user-properties' })
50
+ dataSourceUserProperties?: string;
66
51
 
67
- /**
68
- * User properties as JSON passed directly to the dynamic html on the server.
69
- */
70
- dynamicHtmlUserProperties: {
71
- type: String,
72
- attribute: 'dynamic-html-user-properties'
73
- },
52
+ /** The name of the dynamic html registered in the library map on the server. */
53
+ @property({ attribute: 'dynamic-html-name' })
54
+ dynamicHtmlName?: string;
74
55
 
75
- _html: {
76
- state: true
77
- }
78
- }
56
+ /** User properties as JSON passed directly to the dynamic html on the server. */
57
+ @property({ attribute: 'dynamic-html-user-properties' })
58
+ dynamicHtmlUserProperties?: string;
59
+
60
+ @state()
61
+ _html?: string;
79
62
 
80
63
  render() {
81
64
  return html`${unsafeHTML(this._html)}`;
82
65
  }
83
66
 
84
- willUpdate(changedProperties) {
67
+ willUpdate(changedProperties: PropertyValues<this>) {
85
68
  if (!this.url) {
86
69
  if (changedProperties.has('url')) {
87
70
  this._dispatchErrorEvent("'url' property must be set to an instance of AVS/Go server.");
@@ -96,18 +79,18 @@ export class AvsGoDynamicHtml extends AvsElementBase {
96
79
  }
97
80
 
98
81
  // Assemble the model
99
- const model = {
82
+ const model: DynamicHtmlModel = {
100
83
  dynamicHtmlProperties: {
101
84
  name: this.dynamicHtmlName
102
85
  }
103
86
  };
104
87
  if (this.dynamicHtmlUserProperties) {
105
- let dynamicHtmlUserProperties;
88
+ let dynamicHtmlUserProperties: object;
106
89
  try {
107
90
  dynamicHtmlUserProperties = JSON.parse(this.dynamicHtmlUserProperties);
108
91
  }
109
92
  catch (error) {
110
- this._dispatchErrorEvent("Can't parse 'dynamic-html-user-properties'. " + error.message);
93
+ this._dispatchErrorEvent("Can't parse 'dynamic-html-user-properties'. " + error);
111
94
  return;
112
95
  }
113
96
  model.dynamicHtmlProperties.userProperties = dynamicHtmlUserProperties;
@@ -119,12 +102,12 @@ export class AvsGoDynamicHtml extends AvsElementBase {
119
102
  name: this.dataSourceName
120
103
  }
121
104
  if (this.dataSourceUserProperties) {
122
- let dataSourceUserProperties;
105
+ let dataSourceUserProperties: object;
123
106
  try {
124
107
  dataSourceUserProperties = JSON.parse(this.dataSourceUserProperties);
125
108
  }
126
109
  catch (error) {
127
- this._dispatchErrorEvent("Can't parse 'data-source-user-properties'. " + error.message);
110
+ this._dispatchErrorEvent("Can't parse 'data-source-user-properties'. " + error);
128
111
  return;
129
112
  }
130
113
  model.dataSourceProperties.userProperties = dataSourceUserProperties;
@@ -133,7 +116,7 @@ export class AvsGoDynamicHtml extends AvsElementBase {
133
116
 
134
117
  // Send the request
135
118
  this._httpRequest(this.url,
136
- (response) => {
119
+ (response: DynamicHtmlResponse) => {
137
120
  if (response.html) {
138
121
  const html = decodeURIComponent(response.html.replace(/\+/g, '%20'));
139
122
  this._html = DOMPurify.sanitize(html);
@@ -148,4 +131,8 @@ export class AvsGoDynamicHtml extends AvsElementBase {
148
131
  }
149
132
  }
150
133
 
151
- customElements.define('avs-go-dynamic-html', AvsGoDynamicHtml);
134
+ declare global {
135
+ interface HTMLElementTagNameMap {
136
+ 'avs-go-dynamic-html': AvsGoDynamicHtml;
137
+ }
138
+ }
@@ -18,7 +18,10 @@
18
18
  * Advanced Visual Systems Inc. (http://www.avs.com)
19
19
  */
20
20
 
21
- import { AvsElementBase } from './avs-element-base.js';
21
+ import { LitElement } from 'lit';
22
+ import { customElement, property } from 'lit/decorators.js';
23
+ import { AvsElementMixin } from './avs-element-mixin.js';
24
+ import { InfoModel, InfoResponse } from './types.js';
22
25
 
23
26
  /**
24
27
  * `avs-go-info` is a Lit element which requests data by instancing
@@ -31,49 +34,31 @@ import { AvsElementBase } from './avs-element-base.js';
31
34
  *
32
35
  * @customElement
33
36
  * @lit
37
+ * @applysMixin AvsElementMixin
34
38
  */
35
- export class AvsGoInfo extends AvsElementBase {
36
- static properties = {
37
- /**
38
- * The URL to an instance of AVS/Go server application.
39
- */
40
- url: {
41
- type: String
42
- },
39
+ @customElement('avs-go-info')
40
+ export class AvsGoInfo extends AvsElementMixin(LitElement) {
41
+
42
+ /** The URL to an instance of AVS/Go server application. */
43
+ @property()
44
+ url: string;
43
45
 
44
- /**
45
- * Name of the data source registered in the library map on the server.
46
- */
47
- dataSourceName: {
48
- type: String,
49
- attribute: 'data-source-name'
50
- },
46
+ /** Name of the data source registered in the library map on the server. */
47
+ @property({ attribute: 'data-source-name' })
48
+ dataSourceName?: string;
51
49
 
52
- /**
53
- * User properties as JSON passed directly to the data source on the server.
54
- */
55
- dataSourceUserProperties: {
56
- type: String,
57
- attribute: 'data-source-user-properties'
58
- },
50
+ /** User properties as JSON passed directly to the data source on the server. */
51
+ @property({ attribute: 'data-source-user-properties' })
52
+ dataSourceUserProperties?: string;
59
53
 
60
- /**
61
- * The name of the info registered in the library map on the server.
62
- */
63
- infoName: {
64
- type: String,
65
- attribute: 'info-name'
66
- },
54
+ /** The name of the info registered in the library map on the server. */
55
+ @property({ attribute: 'info-name' })
56
+ infoName?: string;
57
+
58
+ /** User properties as JSON passed directly to the info on the server. */
59
+ @property({ attribute: 'info-user-properties' })
60
+ infoUserProperties?: string;
67
61
 
68
- /**
69
- * User properties as JSON passed directly to the info on the server.
70
- */
71
- infoUserProperties: {
72
- type: String,
73
- attribute: 'info-user-properties'
74
- }
75
- }
76
-
77
62
  /**
78
63
  * Send the request to the server.
79
64
  */
@@ -88,18 +73,18 @@ export class AvsGoInfo extends AvsElementBase {
88
73
  }
89
74
 
90
75
  // Assemble the model
91
- const model = {
76
+ const model: InfoModel = {
92
77
  infoProperties: {
93
78
  name: this.infoName
94
79
  }
95
80
  };
96
81
  if (this.infoUserProperties) {
97
- let infoUserProperties;
82
+ let infoUserProperties: object;
98
83
  try {
99
84
  infoUserProperties = JSON.parse(this.infoUserProperties);
100
85
  }
101
86
  catch (error) {
102
- this._dispatchErrorEvent("Can't parse 'info-user-properties'. " + error.message);
87
+ this._dispatchErrorEvent("Can't parse 'info-user-properties'. " + error);
103
88
  return;
104
89
  }
105
90
  model.infoProperties.userProperties = infoUserProperties;
@@ -111,12 +96,12 @@ export class AvsGoInfo extends AvsElementBase {
111
96
  name: this.dataSourceName
112
97
  }
113
98
  if (this.dataSourceUserProperties) {
114
- let dataSourceUserProperties;
99
+ let dataSourceUserProperties: object;
115
100
  try {
116
101
  dataSourceUserProperties = JSON.parse(this.dataSourceUserProperties);
117
102
  }
118
103
  catch (error) {
119
- this._dispatchErrorEvent("Can't parse 'data-source-user-properties'. " + error.message);
104
+ this._dispatchErrorEvent("Can't parse 'data-source-user-properties'. " + error);
120
105
  return;
121
106
  }
122
107
  model.dataSourceProperties.userProperties = dataSourceUserProperties;
@@ -125,7 +110,7 @@ export class AvsGoInfo extends AvsElementBase {
125
110
 
126
111
  // Send the request
127
112
  this._httpRequest(this.url,
128
- (response) => {
113
+ (response: InfoResponse) => {
129
114
  if (response.info) {
130
115
  const info = JSON.parse(decodeURIComponent(response.info.replace(/\+/g, '%20')));
131
116
 
@@ -143,10 +128,14 @@ export class AvsGoInfo extends AvsElementBase {
143
128
  this._dispatchErrorEvent("Empty response from AVS/Go server.");
144
129
  }
145
130
  },
146
- null,
131
+ undefined,
147
132
  model
148
133
  );
149
134
  }
150
135
  }
151
136
 
152
- customElements.define('avs-go-info', AvsGoInfo);
137
+ declare global {
138
+ interface HTMLElementTagNameMap {
139
+ 'avs-go-info': AvsGoInfo;
140
+ }
141
+ }
@@ -18,7 +18,7 @@
18
18
  * Advanced Visual Systems Inc. (http://www.avs.com)
19
19
  */
20
20
 
21
- import {WebGLRenderer} from 'three';
21
+ import { WebGLRenderer } from 'three';
22
22
 
23
23
  /**
24
24
  * `avs-renderer` is a custom element created internally by
@@ -28,9 +28,17 @@ import {WebGLRenderer} from 'three';
28
28
  * @customElement
29
29
  */
30
30
  export class AvsRenderer extends HTMLElement {
31
+ webGLRenderer: WebGLRenderer;
32
+
31
33
  connectedCallback() {
32
34
  this.webGLRenderer = new WebGLRenderer( {alpha: true} );
33
35
  }
34
36
  }
35
37
 
36
- window.customElements.define('avs-renderer', AvsRenderer);
38
+ customElements.define('avs-renderer', AvsRenderer);
39
+
40
+ declare global {
41
+ interface HTMLElementTagNameMap {
42
+ 'avs-renderer': AvsRenderer;
43
+ }
44
+ }
@@ -18,4 +18,4 @@
18
18
  * Advanced Visual Systems Inc. (http://www.avs.com)
19
19
  */
20
20
 
21
- export var VERSION = '0.14.72000';
21
+ export const VERSION: string = '0.14.72008';
package/src/icons.ts ADDED
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2018 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
+ export const AVS: string = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"46px\" viewBox=\"0 0 12.170833 12.170834\" width=\"46px\"><path d=\"M 7.2486073,9.9076469 H 5.2849946 L 8.4704866,6.123394 6.2360101,3.4130208 7.1885217,2.271515 10.424524,6.122616 Z M 6.0677825,8.6164059 3.9785527,6.1181874 6.0843599,3.5947138 8.1676051,6.1217782 Z M 1.7215741,6.1177086 6.5503222,0.33124232 H 8.5047186 L 3.6754319,6.1184268 5.9155339,8.7972611 4.958833,9.9337997 Z M 7.3399924,2.0900614 9.0019205,0.09856041 H 6.441462 L 1.4175556,6.1188457 4.7994028,10.140329 H 7.3569887 L 10.728423,6.122616 Z\" style=\"display:inline;fill:#2e8cbd;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.0598462\" id=\"path22\" /><path d=\"M 7.2486073,9.9076469 H 5.2849946 L 8.4704866,6.123394 6.2360101,3.4130208 7.1885217,2.271515 10.424524,6.122616 Z M 6.0677825,8.6164059 3.9785527,6.1181874 6.0843599,3.5947138 8.1676051,6.1217782 Z M 1.7215741,6.1177086 6.5503222,0.33124232 H 8.5047186 L 3.6754319,6.1184268 5.9155339,8.7972611 4.958833,9.9337997 Z M 7.3399924,2.0900614 9.0019205,0.09856041 H 6.441462 L 1.4175556,6.1188457 4.7994028,10.140329 H 7.3569887 L 10.728423,6.122616 Z\" style=\"fill:none;stroke:#2e8cbd;stroke-width:0.179539;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" id=\"path26\" /><g id=\"g78\" class=\"spinnerBackground\"><path d=\"M 5.0916012,7.2951741 C 4.5581951,6.6568 4.1217726,6.1273448 4.1217726,6.1186069 c 0,-0.022412 1.9511841,-2.3603376 1.9654853,-2.3550616 0.00645,0.00237 0.4481639,0.5337638 0.981573,1.1808488 L 8.0386633,6.1209126 7.7794202,6.4289493 C 7.6368389,6.5983701 7.1955674,7.1235887 6.7988191,7.5961017 6.4020707,8.0686158 6.0738528,8.4553619 6.0694438,8.4555369 6.0650388,8.4557059 5.6250056,7.9335497 5.0916012,7.2951741 Z\" id=\"path39\" /><path d=\"M 5.5264617,9.7764122 C 5.5385577,9.7616559 6.2319291,8.9374956 7.0672769,7.9449584 7.9026265,6.9524246 8.5861155,6.1329723 8.5861409,6.1239554 8.5861681,6.1149485 8.0879549,5.5032753 7.4789997,4.7647 6.8700453,4.0261248 6.3741103,3.4156149 6.3769213,3.4080117 6.3797713,3.4004117 6.562373,3.1774787 6.7827896,2.9126121 7.164399,2.4540426 7.1848936,2.4323657 7.2117806,2.4588741 7.2273026,2.4741751 7.9274525,3.3048587 8.767655,4.3048177 L 10.295296,6.1229243 9.4136171,7.1736012 C 8.9286921,7.751474 8.2336861,8.5795488 7.8691565,9.0137659 L 7.2063776,9.8032561 H 6.3554188 c -0.7939025,0 -0.8494825,-0.00179 -0.8289571,-0.026839 z\" id=\"path41\" /><path d=\"M 3.4382986,7.9881037 C 2.6063322,7.0074024 1.9089456,6.1852746 1.8885531,6.1611518 L 1.8514763,6.1172937 4.2262773,3.2714352 6.6010789,0.42557499 H 7.4490822 8.2970851 L 7.0763447,1.8883334 c -3.0218884,3.6209928 -3.5158893,4.2139972 -3.519859,4.2252855 -0.00231,0.00662 0.4954141,0.6094855 1.1060858,1.3397178 0.6106728,0.7302338 1.1103133,1.3348316 1.1103133,1.3435515 0,0.017734 -0.7956667,0.9718373 -0.8117152,0.9733472 -0.00562,5.108e-4 -0.6909038,-0.80143 -1.522871,-1.7821306 z\" id=\"path43\" /></g></svg>";
22
+
23
+ export const TIMELAPSE: string = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\" fill=\"currentColor\"><path d=\"M0 0h24v24H0V0z\" fill=\"none\"/><path d=\"M16.24 7.75c-1.17-1.17-2.7-1.76-4.24-1.76v6l-4.24 4.24c2.34 2.34 6.14 2.34 8.49 0 2.34-2.34 2.34-6.14-.01-8.48zM12 1.99c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z\"/></svg>";
24
+ export const CAMERA: string = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\" fill=\"currentColor\"><path d=\"M0 0h24v24H0V0z\" fill=\"none\"/><path d=\"M20 4h-3.17L15 2H9L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V6h4.05l1.83-2h4.24l1.83 2H20v12zM12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0 8c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z\"/></svg>";
25
+ export const PLAY: string = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\" fill=\"currentColor\"><path d=\"M0 0h24v24H0V0z\" fill=\"none\"/><path d=\"M10 8.64L15.27 12 10 15.36V8.64M8 5v14l11-7L8 5z\"/></svg>";
26
+ export const HOME: string = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\" fill=\"currentColor\"><path d=\"M0 0h24v24H0V0z\" fill=\"none\"/><path d=\"M12 5.69l5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3L2 12h3v8h6v-6h2v6h6v-8h3L12 3z\"/></svg>";
27
+ export const DELETE: string = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\" fill=\"currentColor\"><path d=\"M0 0h24v24H0V0z\" fill=\"none\"/><path d=\"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z\"/></svg>";
28
+ export const COPY: string = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\" fill=\"currentColor\"><path d=\"M0 0h24v24H0V0z\" fill=\"none\"/><path d=\"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z\"/></svg>";
29
+ export const LINK: string = "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\" fill=\"currentColor\"><path d=\"M0 0h24v24H0V0z\" fill=\"none\"/><path d=\"M17 7h-4v2h4c1.65 0 3 1.35 3 3s-1.35 3-3 3h-4v2h4c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-6 8H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-2zm-3-4h8v2H8z\"/></svg>";
@@ -18,6 +18,6 @@
18
18
  * Advanced Visual Systems Inc. (http://www.avs.com)
19
19
  */
20
20
 
21
- import { AvsGoDataViz } from './avs-go-dataviz.js'
22
- import { AvsGoInfo } from './avs-go-info.js'
23
- import { AvsGoDynamicHtml } from './avs-go-dynamic-html.js'
21
+ export { AvsGoDataViz } from './avs-go-dataviz'
22
+ export { AvsGoInfo } from './avs-go-info'
23
+ export { AvsGoDynamicHtml } from './avs-go-dynamic-html'
package/src/types.ts ADDED
@@ -0,0 +1,160 @@
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
+ export enum Renderer {
22
+ IMAGE = "IMAGE",
23
+ SVG = "SVG",
24
+ THREEJS = "THREEJS"
25
+ }
26
+
27
+ export enum PickDepth {
28
+ CLOSEST = "CLOSEST",
29
+ ALL = "ALL"
30
+ }
31
+
32
+ export enum PickLevel {
33
+ SCENE_NODE = "SCENE_NODE",
34
+ CELL_SET = "CELL_SET",
35
+ CELL = "CELL"
36
+ }
37
+
38
+ export interface PanProperties {
39
+ widthZoomLevel?: number;
40
+ heightZoomLevel?: number;
41
+ }
42
+
43
+ export interface StreamProperties {
44
+ chunkSizeFirst?: number;
45
+ chunkSize?: number;
46
+ chunkId?: string;
47
+ }
48
+
49
+ export interface PickDetail {
50
+ x?: number;
51
+ y?: number;
52
+ left?: number;
53
+ right?: number;
54
+ top?: number;
55
+ bottom?: number;
56
+ selected?: Array<SelectedInfo>;
57
+ }
58
+
59
+ export interface PickProperties extends PickDetail {
60
+ type: string;
61
+ level?: PickLevel;
62
+ depth?: PickDepth;
63
+ highlight?: boolean;
64
+ highlightColor?: string;
65
+ highlightLayer?: boolean;
66
+ }
67
+
68
+ export interface RendererProperties {
69
+ name?: string;
70
+ userProperties?: object;
71
+ type: Renderer;
72
+ width: number;
73
+ height: number;
74
+ themeName?: string;
75
+ cssProperties?: object;
76
+ pickProperties?: PickProperties;
77
+ panProperties?: PanProperties;
78
+ streamProperties?: StreamProperties;
79
+ transformMatrix?: Array<number>;
80
+ fullReset?: boolean;
81
+ }
82
+
83
+ export interface DataVizModel {
84
+ sceneProperties: {
85
+ name: string;
86
+ userProperties?: object;
87
+ };
88
+ dataSourceProperties?: {
89
+ name: string;
90
+ userProperties?: object;
91
+ };
92
+ rendererProperties?: RendererProperties;
93
+ }
94
+
95
+ export interface SelectedInfo {
96
+ seriesIndex?: number;
97
+ itemIndex?: number;
98
+ componentInfo?: string;
99
+ }
100
+
101
+ export interface MotionCaptureFrame {
102
+ time: number;
103
+ scale: number;
104
+ position: Array<number>;
105
+ rotation: Array<number>;
106
+ }
107
+
108
+ export interface HttpResponse {
109
+ error?: string;
110
+ }
111
+
112
+ export interface SceneInfo {
113
+ color?: string;
114
+ backgroundColor?: string;
115
+ fontFamily?: string;
116
+ }
117
+
118
+ export interface ThreeJS {
119
+ chunkId?: string;
120
+ moreChunks?: boolean;
121
+ }
122
+
123
+ export interface DataVizResponse extends HttpResponse {
124
+ sceneInfo?: SceneInfo;
125
+ selectionInfo?: PickProperties;
126
+ image?: string;
127
+ imagemap?: string;
128
+ svg?: string;
129
+ threejs?: ThreeJS;
130
+ }
131
+
132
+ export interface InfoModel {
133
+ infoProperties: {
134
+ name: string;
135
+ userProperties?: object;
136
+ };
137
+ dataSourceProperties?: {
138
+ name: string;
139
+ userProperties?: object;
140
+ };
141
+ }
142
+
143
+ export interface InfoResponse extends HttpResponse {
144
+ info?: string;
145
+ }
146
+
147
+ export interface DynamicHtmlModel {
148
+ dynamicHtmlProperties: {
149
+ name: string;
150
+ userProperties?: object;
151
+ };
152
+ dataSourceProperties?: {
153
+ name: string;
154
+ userProperties?: object;
155
+ };
156
+ }
157
+
158
+ export interface DynamicHtmlResponse extends HttpResponse {
159
+ html?: string;
160
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2022",
4
+ "module": "esnext",
5
+ "moduleResolution": "bundler",
6
+ "lib": [ "es2022", "DOM", "DOM.Iterable", "DOM.AsyncIterable" ],
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "experimentalDecorators": true,
10
+ "useDefineForClassFields": false,
11
+ "outDir": "./dist",
12
+ "rootDir": "./src"
13
+ },
14
+ "include": [ "src/**/*.ts" ],
15
+ "exclude": []
16
+ }
@@ -1,119 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2018 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 { LitElement } from 'lit';
22
- import { VERSION } from './constants.js';
23
-
24
- export class AvsElementBase extends LitElement {
25
-
26
- /**
27
- * Generate a HTTP request.
28
- * @param url URL to an instance of AVS/Go server or file to get.
29
- * @param model Model content to POST to the server (or undefined to generate a GET request).
30
- */
31
- _httpRequest(url, onLoad, onError, model) {
32
- if (!url) {
33
- this._dispatchErrorEvent("'url' property must point to an instance of AVS/Go server.");
34
- onError();
35
- }
36
-
37
- // Assembly the request body
38
- const verArray = VERSION.split('.');
39
- const version = [parseInt(verArray[0]), parseInt(verArray[1]), parseInt(verArray[2])];
40
- const body = {
41
- source: this.localName,
42
- model: model,
43
- version: version
44
- };
45
-
46
- // Send the request
47
- fetch(url, {
48
- method: model ? 'POST' : 'GET',
49
- headers: {
50
- 'Content-Type': 'application/json'
51
- },
52
- body: model ? JSON.stringify(body) : undefined
53
- })
54
- .then(response => response.json())
55
- .then(response => {
56
- if (response.error) {
57
- this._processServerError(response.error);
58
- if (onError) {
59
- onError();
60
- }
61
- }
62
- else if (onLoad) {
63
- onLoad(response);
64
- }
65
- })
66
- .catch(error => {
67
- this._dispatchErrorEvent(error);
68
- if (onError) {
69
- onError();
70
- }
71
- });
72
- }
73
-
74
- /**
75
- * @param error
76
- */
77
- _processServerError(error) {
78
- if (!error) {
79
- return;
80
- }
81
-
82
- const goException = JSON.parse(decodeURIComponent(error.replace(/\+/g, '%20')));
83
- let output = "An error occurred on the AVS/Go server";
84
-
85
- for (const key in goException) {
86
- if (goException.hasOwnProperty(key)) {
87
- if (output != "") {
88
- output += "\n ";
89
- }
90
- output += key + ": ";
91
- const child = goException[key];
92
- if (child === Object(child)) {
93
- output = output + JSON.stringify(child);
94
- }
95
- else {
96
- output = output + goException[key];
97
- }
98
- }
99
- }
100
-
101
- this._dispatchErrorEvent(output);
102
- }
103
-
104
- /**
105
- *
106
- * @param {any} error
107
- */
108
- _dispatchErrorEvent(error) {
109
- /**
110
- * Error message from AVS/Go Web Component or Server.
111
- * @event avs-error
112
- */
113
- this.dispatchEvent(new CustomEvent('avs-error', {
114
- bubbles: true,
115
- composed: true,
116
- detail: error
117
- }));
118
- }
119
- }