@avs/go 0.14.72008 → 0.14.72037

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 (46) hide show
  1. package/LICENSE +195 -0
  2. package/NOTICE +5 -0
  3. package/README.md +2 -2
  4. package/dist/avs-element-mixin.d.ts +3 -3
  5. package/dist/avs-element-mixin.d.ts.map +1 -1
  6. package/dist/avs-element-mixin.js +1 -1
  7. package/dist/avs-go-dataviz.d.ts +34 -44
  8. package/dist/avs-go-dataviz.d.ts.map +1 -1
  9. package/dist/avs-go-dataviz.js +49 -66
  10. package/dist/avs-go-dynamic-html.d.ts +1 -1
  11. package/dist/avs-go-dynamic-html.d.ts.map +1 -1
  12. package/dist/avs-go-dynamic-html.js +8 -3
  13. package/dist/avs-go-info.d.ts +1 -1
  14. package/dist/avs-go-info.d.ts.map +1 -1
  15. package/dist/avs-go-info.js +7 -2
  16. package/dist/avs-go.min.js +36 -57
  17. package/dist/avs-renderer.d.ts +2 -2
  18. package/dist/avs-renderer.d.ts.map +1 -1
  19. package/dist/avs-renderer.js +5 -1
  20. package/dist/constants.d.ts +1 -1
  21. package/dist/constants.js +2 -2
  22. package/dist/icons.d.ts +1 -1
  23. package/dist/icons.js +1 -1
  24. package/dist/index.d.ts +1 -1
  25. package/dist/index.js +1 -1
  26. package/dist/types.d.ts +4 -15
  27. package/dist/types.d.ts.map +1 -1
  28. package/dist/types.js +2 -18
  29. package/licenses/lit.BSD-3 +28 -0
  30. package/{lib/LICENSE-avsthreejs → licenses/three.MIT} +1 -21
  31. package/package.json +14 -4
  32. package/demo/data/scene.json +0 -1
  33. package/demo/img/avs.png +0 -0
  34. package/demo/jsonView.html +0 -36
  35. package/dist/avs-go.min.js.LICENSE.txt +0 -61
  36. package/rollup.config.js +0 -26
  37. package/src/avs-element-mixin.ts +0 -126
  38. package/src/avs-go-dataviz.ts +0 -2400
  39. package/src/avs-go-dynamic-html.ts +0 -138
  40. package/src/avs-go-info.ts +0 -141
  41. package/src/avs-renderer.ts +0 -44
  42. package/src/constants.ts +0 -21
  43. package/src/icons.ts +0 -29
  44. package/src/index.ts +0 -23
  45. package/src/types.ts +0 -160
  46. package/tsconfig.json +0 -16
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2018 Advanced Visual Systems Inc.
3
+ * Copyright 2018-2026 Advanced Visual Systems Inc.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -24,14 +24,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
24
24
  return c > 3 && r && Object.defineProperty(target, key, r), r;
25
25
  };
26
26
  import { AvsElementMixin } from './avs-element-mixin.js';
27
- import { LitElement, html } from 'lit';
27
+ import { LitElement, html, css } from 'lit';
28
28
  import { customElement, property } from 'lit/decorators.js';
29
29
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
30
30
  import { AvsRenderer } from './avs-renderer.js';
31
31
  import { Viewer, TransformInteractor, PanInteractor, ZoomRectangleInteractor, PickDepthEnum, Animator } from '../lib/avs-three.module.min.js';
32
32
  import { AVS, PLAY, CAMERA, TIMELAPSE, HOME, DELETE, COPY, LINK } from './icons.js';
33
33
  import { Euler, Vector3, Quaternion } from 'three';
34
- import { Renderer } from './types.js';
35
34
  const ro = new ResizeObserver((entries, observer) => {
36
35
  entries.forEach((entry) => {
37
36
  const target = entry.target;
@@ -55,9 +54,7 @@ const ro = new ResizeObserver((entries, observer) => {
55
54
  * @applysMixin AvsElementMixin
56
55
  */
57
56
  let AvsGoDataViz = class AvsGoDataViz extends AvsElementMixin(LitElement) {
58
- render() {
59
- return html `
60
- <style>
57
+ static { this.styles = css `
61
58
  :host {
62
59
  display:block;
63
60
  width:100%;
@@ -205,7 +202,9 @@ let AvsGoDataViz = class AvsGoDataViz extends AvsElementMixin(LitElement) {
205
202
  @-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
206
203
  @-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
207
204
  @keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
208
- </style>
205
+ `; }
206
+ render() {
207
+ return html `
209
208
  <div id="dataVizDiv"></div>
210
209
  <div id="motionCapture">
211
210
  <div style="display: flex; justify-content: center" id="motionCaptureTitle">Motion Capture</div>
@@ -238,13 +237,6 @@ let AvsGoDataViz = class AvsGoDataViz extends AvsElementMixin(LitElement) {
238
237
  <div id="tooltip"></div>
239
238
  `;
240
239
  }
241
- /**
242
- * Default line style and color
243
- */
244
- _rectangleStyle() {
245
- this.rectCtx.setLineDash([3]);
246
- this.rectCtx.strokeStyle = "#ff0000";
247
- }
248
240
  /**
249
241
  * Assemble the model from our properties to send to the server.
250
242
  */
@@ -570,7 +562,7 @@ let AvsGoDataViz = class AvsGoDataViz extends AvsElementMixin(LitElement) {
570
562
  * At least one of the properties was changed.
571
563
  */
572
564
  updated(changedProperties) {
573
- if (!Object.values(Renderer)?.includes(this.renderer)) {
565
+ if (!['IMAGE', 'SVG', 'THREEJS'].includes(this.renderer)) {
574
566
  this._dispatchErrorEvent("'renderer' property must be 'IMAGE', 'SVG' or 'THREEJS'.");
575
567
  return;
576
568
  }
@@ -733,15 +725,15 @@ let AvsGoDataViz = class AvsGoDataViz extends AvsElementMixin(LitElement) {
733
725
  // Set animation controls, tooltip and zoom overlay style to reversed theme
734
726
  if (response.sceneInfo.backgroundColor) {
735
727
  var col = response.sceneInfo.backgroundColor.match(/[0-9.]+/gi);
736
- var bgCol = this.getInheritedBackgroundCol(this).trim().match(/[0-9.]+/gi);
728
+ var bgCol = this._getInheritedBackgroundCol(this).trim().match(/[0-9.]+/gi);
737
729
  var blendedR = (Number(col[0]) * Number(col[3]));
738
730
  var blendedG = (Number(col[1]) * Number(col[3]));
739
731
  var blendedB = (Number(col[2]) * Number(col[3]));
740
732
  if (Number(col[3]) == 0) {
741
733
  // In case sceneInfo.backgroundColor is transparent, blend with inherited background color
742
- blendedR += (bgCol[0] * (1 - Number(col[3])));
743
- blendedG += (bgCol[1] * (1 - Number(col[3])));
744
- blendedB += (bgCol[2] * (1 - Number(col[3])));
734
+ blendedR += (Number(bgCol[0]) * (1 - Number(col[3])));
735
+ blendedG += (Number(bgCol[1]) * (1 - Number(col[3])));
736
+ blendedB += (Number(bgCol[2]) * (1 - Number(col[3])));
745
737
  }
746
738
  motionCapture.style.color = "var(--avs-motion-capture-color, rgb(" + blendedR + ", " + blendedG + ", " + blendedB + "))";
747
739
  zoomOverlay.style.color = "var(--avs-zoom-overlay-color, rgb(" + blendedR + "," + blendedG + "," + blendedB + "))";
@@ -823,8 +815,8 @@ let AvsGoDataViz = class AvsGoDataViz extends AvsElementMixin(LitElement) {
823
815
  }
824
816
  }
825
817
  }
826
- getInheritedBackgroundCol(el) {
827
- var defaultStyle = this.getDefaultBackground();
818
+ _getInheritedBackgroundCol(el) {
819
+ var defaultStyle = this._getDefaultBackground();
828
820
  var bgCol = window.getComputedStyle(el).backgroundColor;
829
821
  if (bgCol != defaultStyle) {
830
822
  return bgCol;
@@ -832,9 +824,9 @@ let AvsGoDataViz = class AvsGoDataViz extends AvsElementMixin(LitElement) {
832
824
  if (!el.parentElement) {
833
825
  return defaultStyle;
834
826
  }
835
- return this.getInheritedBackgroundCol(el.parentElement);
827
+ return this._getInheritedBackgroundCol(el.parentElement);
836
828
  }
837
- getDefaultBackground() {
829
+ _getDefaultBackground() {
838
830
  // have to add to the document in order to use getComputedStyle
839
831
  var div = document.createElement("div");
840
832
  document.head.appendChild(div);
@@ -892,7 +884,8 @@ let AvsGoDataViz = class AvsGoDataViz extends AvsElementMixin(LitElement) {
892
884
  break;
893
885
  case 'track':
894
886
  this.rectCtx.clearRect(0, 0, this.width, this.height);
895
- this._rectangleStyle();
887
+ this.rectCtx.setLineDash([3]);
888
+ this.rectCtx.strokeStyle = "#ff0000";
896
889
  this.rectCtx.strokeRect(adjustedCoords.left, adjustedCoords.top, adjustedCoords.right - adjustedCoords.left, adjustedCoords.bottom - adjustedCoords.top);
897
890
  break;
898
891
  case 'end':
@@ -923,7 +916,7 @@ let AvsGoDataViz = class AvsGoDataViz extends AvsElementMixin(LitElement) {
923
916
  if (this.tapEnable && e.buttons & 1) {
924
917
  this.tapping = true;
925
918
  }
926
- if (this.trackEnable && e.buttons & 2) {
919
+ if (this.trackEnable && e.buttons & 1) {
927
920
  this.tracking = 1;
928
921
  }
929
922
  }
@@ -1228,7 +1221,7 @@ let AvsGoDataViz = class AvsGoDataViz extends AvsElementMixin(LitElement) {
1228
1221
  constructor() {
1229
1222
  super();
1230
1223
  // Set default property values
1231
- this.renderer = Renderer.THREEJS;
1224
+ this.renderer = "THREEJS";
1232
1225
  this.resizeThreshold = 10;
1233
1226
  this.pointerTimeout = 600;
1234
1227
  this.panWidthZoomLevel = 100;
@@ -1344,7 +1337,7 @@ let AvsGoDataViz = class AvsGoDataViz extends AvsElementMixin(LitElement) {
1344
1337
  // Convert to JSON, compress and base64url encode
1345
1338
  const json = JSON.stringify(this.motionCaptureFrames);
1346
1339
  const compressed = await this._compress(json);
1347
- const encoded = btoa(String.fromCharCode(...new Uint8Array(compressed))).replaceAll('/', '_').replaceAll('+', '-');
1340
+ const encoded = btoa(compressed).replaceAll('/', '_').replaceAll('+', '-');
1348
1341
  // Create URL and copy to clipboard
1349
1342
  const url = window.location.origin + window.location.pathname + "?motionCapture=" + encoded;
1350
1343
  navigator.clipboard.writeText(url);
@@ -1357,53 +1350,43 @@ let AvsGoDataViz = class AvsGoDataViz extends AvsElementMixin(LitElement) {
1357
1350
  }, 2000);
1358
1351
  }
1359
1352
  /**
1360
- * Convert a string to its UTF-8 bytes and compress it.
1353
+ * Gzip compress a string.
1361
1354
  *
1362
- * @param {string} str
1363
- * @returns {Promise<Uint8Array>}
1355
+ * @param {string} inString
1356
+ * @returns {Promise<string>}
1364
1357
  */
1365
- async _compress(str) {
1366
- // Convert the string to a byte stream.
1367
- const stream = new Blob([str]).stream();
1358
+ async _compress(inString) {
1359
+ // Convert the string to a byte array.
1360
+ const byteArray = new TextEncoder().encode(inString);
1368
1361
  // Create a compressed stream.
1369
- const compressedStream = stream.pipeThrough(new CompressionStream("gzip"));
1370
- // Read all the bytes from this stream.
1371
- const chunks = [];
1372
- for await (const chunk of compressedStream) {
1373
- chunks.push(chunk);
1374
- }
1375
- return this._concatUint8Arrays(chunks);
1362
+ const cs = new CompressionStream("gzip");
1363
+ const writer = cs.writable.getWriter();
1364
+ writer.write(byteArray);
1365
+ writer.close();
1366
+ // Read all the bytes from this stream and return string.
1367
+ const outBuffer = await new Response(cs.readable).arrayBuffer();
1368
+ return String.fromCharCode(...new Uint8Array(outBuffer));
1376
1369
  }
1377
1370
  /**
1378
- * Decompress bytes into a UTF-8 string.
1371
+ * Gzip decompress a string.
1379
1372
  *
1380
- * @param {Uint8Array} compressedBytes
1373
+ * @param {string} inString
1381
1374
  * @returns {Promise<string>}
1382
1375
  */
1383
- async _decompress(compressedBytes) {
1384
- // Convert the bytes to a stream.
1385
- const stream = new Blob([compressedBytes]).stream();
1386
- // Create a decompressed stream.
1387
- const decompressedStream = stream.pipeThrough(new DecompressionStream("gzip"));
1388
- // Read all the bytes from this stream.
1389
- const chunks = [];
1390
- for await (const chunk of decompressedStream) {
1391
- chunks.push(chunk);
1376
+ async _decompress(inString) {
1377
+ // Convert the string to a byte array.
1378
+ const byteArray = new Uint8Array(inString.length);
1379
+ for (let i = 0; i < inString.length; i++) {
1380
+ byteArray[i] = inString.charCodeAt(i);
1392
1381
  }
1393
- const stringBytes = await this._concatUint8Arrays(chunks);
1394
- // Convert the bytes to a string.
1395
- return new TextDecoder().decode(stringBytes);
1396
- }
1397
- /**
1398
- * Combine multiple Uint8Arrays into one.
1399
- *
1400
- * @param {ReadonlyArray<Uint8Array>} uint8arrays
1401
- * @returns {Promise<Uint8Array>}
1402
- */
1403
- async _concatUint8Arrays(uint8arrays) {
1404
- const blob = new Blob(uint8arrays);
1405
- const buffer = await blob.arrayBuffer();
1406
- return new Uint8Array(buffer);
1382
+ // Create a decompressed stream.
1383
+ const cs = new DecompressionStream("gzip");
1384
+ const writer = cs.writable.getWriter();
1385
+ writer.write(byteArray);
1386
+ writer.close();
1387
+ // Read all the bytes from this stream and return string.
1388
+ const outBuffer = await new Response(cs.readable).arrayBuffer();
1389
+ return String.fromCharCode(...new Uint8Array(outBuffer));
1407
1390
  }
1408
1391
  _handleMotionCaptureClear() {
1409
1392
  this.motionCaptureFrames.length = 0;
@@ -1616,7 +1599,7 @@ let AvsGoDataViz = class AvsGoDataViz extends AvsElementMixin(LitElement) {
1616
1599
  }
1617
1600
  catch {
1618
1601
  // Decode from base64url, decompress and parse JSON
1619
- const decoded = atob(newValue).replaceAll('_', '/').replaceAll('-', '+');
1602
+ const decoded = atob(newValue.replaceAll('_', '/').replaceAll('-', '+'));
1620
1603
  const decompressed = await this._decompress(decoded);
1621
1604
  this.motionCaptureFrames = JSON.parse(decompressed);
1622
1605
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2018 Advanced Visual Systems Inc.
3
+ * Copyright 2018-2026 Advanced Visual Systems Inc.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -1 +1 @@
1
- {"version":3,"file":"avs-go-dynamic-html.d.ts","sourceRoot":"","sources":["../src/avs-go-dynamic-html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAQ,cAAc,EAAE,MAAM,KAAK,CAAC;;AAOvD;;;;;;;;GAQG;AACH,qBACa,gBAAiB,SAAQ,qBAA2B;IAE/D,2DAA2D;IAE3D,GAAG,EAAE,MAAM,CAAC;IAEZ,2EAA2E;IAE3E,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,gFAAgF;IAEhF,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAElC,gFAAgF;IAEhF,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,iFAAiF;IAEjF,yBAAyB,CAAC,EAAE,MAAM,CAAC;IAGnC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,MAAM;IAIN,UAAU,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC;CAiEnD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,qBAAqB,EAAE,gBAAgB,CAAC;KACzC;CACF"}
1
+ {"version":3,"file":"avs-go-dynamic-html.d.ts","sourceRoot":"","sources":["../src/avs-go-dynamic-html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAQ,cAAc,EAAE,MAAM,KAAK,CAAC;;AAOvD;;;;;;;;GAQG;AACH,qBACa,gBAAiB,SAAQ,qBAA2B;IAE/D,2DAA2D;IAE3D,GAAG,EAAE,MAAM,CAAM;IAEjB,2EAA2E;IAE3E,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,gFAAgF;IAEhF,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAElC,gFAAgF;IAEhF,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,iFAAiF;IAEjF,yBAAyB,CAAC,EAAE,MAAM,CAAC;IAGnC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,MAAM;IAIN,UAAU,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC;CAiEnD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,qBAAqB,EAAE,gBAAgB,CAAC;KACzC;CACF"}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2018 Advanced Visual Systems Inc.
3
+ * Copyright 2018-2026 Advanced Visual Systems Inc.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -38,11 +38,16 @@ import DOMPurify from 'dompurify';
38
38
  * @applysMixin AvsElementMixin
39
39
  */
40
40
  let AvsGoDynamicHtml = class AvsGoDynamicHtml extends AvsElementMixin(LitElement) {
41
+ constructor() {
42
+ super(...arguments);
43
+ /** The URL to an instance of AVS/Go server application. */
44
+ this.url = "";
45
+ }
41
46
  render() {
42
47
  return html `${unsafeHTML(this._html)}`;
43
48
  }
44
49
  willUpdate(changedProperties) {
45
- if (!this.url) {
50
+ if (!this.url || this.url.length < 1) {
46
51
  if (changedProperties.has('url')) {
47
52
  this._dispatchErrorEvent("'url' property must be set to an instance of AVS/Go server.");
48
53
  }
@@ -97,7 +102,7 @@ let AvsGoDynamicHtml = class AvsGoDynamicHtml extends AvsElementMixin(LitElement
97
102
  else {
98
103
  this._dispatchErrorEvent("Empty response from AVS/Go server.");
99
104
  }
100
- }, null, model);
105
+ }, undefined, model);
101
106
  }
102
107
  };
103
108
  __decorate([
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2018 Advanced Visual Systems Inc.
3
+ * Copyright 2018-2026 Advanced Visual Systems Inc.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -1 +1 @@
1
- {"version":3,"file":"avs-go-info.d.ts","sourceRoot":"","sources":["../src/avs-go-info.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;;AAKjC;;;;;;;;;;;;GAYG;AACH,qBACa,SAAU,SAAQ,cAA2B;IAExD,2DAA2D;IAE3D,GAAG,EAAE,MAAM,CAAC;IAEZ,2EAA2E;IAE3E,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,gFAAgF;IAEhF,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAElC,wEAAwE;IAExE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,yEAAyE;IAEzE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,UAAU;CAsEX;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,SAAS,CAAC;KAC1B;CACF"}
1
+ {"version":3,"file":"avs-go-info.d.ts","sourceRoot":"","sources":["../src/avs-go-info.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;;AAKjC;;;;;;;;;;;;GAYG;AACH,qBACa,SAAU,SAAQ,cAA2B;IAExD,2DAA2D;IAE3D,GAAG,EAAE,MAAM,CAAM;IAEjB,2EAA2E;IAE3E,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,gFAAgF;IAEhF,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAElC,wEAAwE;IAExE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,yEAAyE;IAEzE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,UAAU;CAsEX;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,SAAS,CAAC;KAC1B;CACF"}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2018 Advanced Visual Systems Inc.
3
+ * Copyright 2018-2026 Advanced Visual Systems Inc.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -40,11 +40,16 @@ import { AvsElementMixin } from './avs-element-mixin.js';
40
40
  * @applysMixin AvsElementMixin
41
41
  */
42
42
  let AvsGoInfo = class AvsGoInfo extends AvsElementMixin(LitElement) {
43
+ constructor() {
44
+ super(...arguments);
45
+ /** The URL to an instance of AVS/Go server application. */
46
+ this.url = "";
47
+ }
43
48
  /**
44
49
  * Send the request to the server.
45
50
  */
46
51
  updateInfo() {
47
- if (!this.url) {
52
+ if (!this.url || this.url.length < 1) {
48
53
  this._dispatchErrorEvent("'url' property must be set to an instance of AVS/Go server.");
49
54
  return;
50
55
  }