@vertexvis/viewer 1.0.2-canary.20 → 1.0.2-canary.21
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/dist/cjs/{controller-CMJs6F-h.js → controller-C74GX70e.js} +60 -4
- package/dist/cjs/controller-C74GX70e.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/vertex-scene-tree.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js +1 -1
- package/dist/collection/components/scene-tree/lib/jwt.js +1 -1
- package/dist/collection/components/scene-tree/lib/jwt.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{p-B7C1GfGS.js → p-BmoTo_-J.js} +2 -2
- package/dist/components/p-CnYEgl0H.js +5 -0
- package/dist/components/p-CnYEgl0H.js.map +1 -0
- package/dist/components/vertex-scene-tree.js +1 -1
- package/dist/components/vertex-viewer-pin-group.js +1 -1
- package/dist/components/vertex-viewer-pin-tool.js +1 -1
- package/dist/esm/{controller-vXSti_qr.js → controller-CE2DwTNf.js} +60 -4
- package/dist/esm/controller-CE2DwTNf.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/vertex-scene-tree.entry.js +1 -1
- package/dist/esm/vertex-viewer-pin-group.entry.js +1 -1
- package/dist/types/components/scene-tree/lib/jwt.d.ts +1 -1
- package/dist/viewer/index.esm.js +1 -1
- package/dist/viewer/{p-4b5a62da.entry.js → p-06c99572.entry.js} +2 -2
- package/dist/viewer/{p-61188ccc.entry.js → p-72479c7e.entry.js} +2 -2
- package/dist/viewer/p-CnYEgl0H.js +5 -0
- package/dist/viewer/p-CnYEgl0H.js.map +1 -0
- package/dist/viewer/viewer.esm.js +1 -1
- package/package.json +8 -8
- package/dist/cjs/controller-CMJs6F-h.js.map +0 -1
- package/dist/components/p-BNfR95Px.js +0 -5
- package/dist/components/p-BNfR95Px.js.map +0 -1
- package/dist/esm/controller-vXSti_qr.js.map +0 -1
- package/dist/viewer/p-BNfR95Px.js +0 -5
- package/dist/viewer/p-BNfR95Px.js.map +0 -1
- /package/dist/components/{p-B7C1GfGS.js.map → p-BmoTo_-J.js.map} +0 -0
- /package/dist/viewer/{p-4b5a62da.entry.js.map → p-06c99572.entry.js.map} +0 -0
- /package/dist/viewer/{p-61188ccc.entry.js.map → p-72479c7e.entry.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{h as e,F as t,t as i,p as s,H as n,d as o,f as a,e as r}from"./p-Bb32XUUS.js";import{s as l,w as d,S as c,a as h,b as u}from"./p-BNfR95Px.js";import{p as f}from"./p-CuSSK1ZL.js";import{i as v}from"./p-DC86ZXai.js";import{d as p,g as m}from"./p-BEkJ7rmE.js";import{i as w}from"./p-CiSHWNC4.js";import{S as b}from"./p-BZwvQkyb.js";import{d as y}from"./p-CIuxJYJL.js";import{d as g}from"./p-Y8W_BXUk.js";import{d as x}from"./p-B5SQ_oXT.js";import{d as I}from"./p-Bkm6H5uq.js";import{d as C}from"./p-DxuSiXYg.js";const k=({details:i},s)=>e("div",{class:"error"},e("div",{class:"error-section error-message"},e("span",null,i.message),i.link&&e(t,null,e("span",null," See our "),e("a",{href:i.link,target:"_blank"},"documentation")," ",e("span",null," for more information."))),e("div",{class:"error-section"},s));const E=500;async function R(e,t,{suppliedCorrelationId:i}={}){const s=await e.scene();return s.elements((e=>e.items.where((e=>e.withItemId(t))).show())).execute({suppliedCorrelationId:i})}async function S(e,t,{suppliedCorrelationId:i}={}){const s=await e.scene();return s.elements((e=>e.items.where((e=>e.withItemId(t))).hide())).execute({suppliedCorrelationId:i})}async function M(e,t,{append:i=false,suppliedCorrelationId:s}){const n=await e.scene();return n.elements((e=>[...i?[]:[e.items.where((e=>e.all())).deselect()],e.items.where((e=>e.withItemId(t))).select()])).execute({suppliedCorrelationId:s})}async function D(e,t,i,{append:s=true,suppliedCorrelationId:n}){const o=await e.scene();return o.elements((e=>[...s?[]:[e.items.where((e=>e.all())).deselect()],e.items.where((e=>e.withSceneTreeRange({start:t,end:i}))).select()])).execute({suppliedCorrelationId:n})}async function L(e,t,i,s,n,{append:o=false,suppliedCorrelationId:a}){const r=await e.scene();return r.elements((e=>[...o?[]:[e.items.where((e=>e.all())).deselect()],e.items.where((e=>e.withMetadata(t,i,s,n))).select()])).execute({suppliedCorrelationId:a})}async function j(e,t,{suppliedCorrelationId:i}={}){const s=await e.scene();return s.elements((e=>e.items.where((e=>e.withItemId(t))).deselect())).execute({suppliedCorrelationId:i})}async function K(e,t,{suppliedCorrelationId:i,animationDurationMs:s}={}){const n=await e.scene();await n.elements((e=>[e.items.where((e=>e.all())).hide(),e.items.where((e=>e.withItemId(t))).show()])).execute({suppliedCorrelationId:i});const o=await n.camera().flyTo((e=>e.withItemId(t))).render({animation:{milliseconds:s!==null&&s!==void 0?s:E}});await o.onAnimationCompleted.once()}const T=()=>`button{border:none;background:transparent;cursor:pointer;margin:0;padding:0}.button{padding:0.5rem;border-radius:0.25rem}.button-secondary{color:var(--neutral-800);background-color:var(--neutral-300)}.button-secondary:hover{color:var(--neutral-900)}.button-secondary:hover:enabled{box-shadow:0 2px 2px rgb(0 0 0 / 20%)}.button-secondary:disabled{opacity:0.8}.button-secondary:hover:disabled{cursor:not-allowed}:host{--scene-tree-toolbar-separator:1px solid var(--neutral-300);--scene-tree-default-font-family:unset;--scene-tree-default-font-size:unset;--scene-tree-default-font-color:unset;--scene-tree-secondary-font-color:unset;--scene-tree-selected-row-background-color:unset;--scene-tree-hovered-row-background-color:unset;--scene-tree-row-background-color:unset;--scene-tree-row-background-color-depth-n:unset;--scene-tree-overlay-z-index:3000;width:300px;height:100%;user-select:none;-webkit-user-select:none;cursor:default;display:flex;flex-direction:column;position:relative}.rows-scroll{position:relative;height:var(--scene-tree-row-height, 0);flex-grow:1}.rows{position:relative}.row{position:absolute;display:flex;align-items:center;width:100%;height:var(--scene-tree-row-height);padding:var(--scene-tree-row-padding);box-sizing:border-box}.row:hover{background-color:var(--scene-tree-row-hover-color)}.row.is-selected{background-color:var(--scene-tree-row-selected-color)}.expand-toggle{cursor:pointer;width:16px}.row-text{margin-left:0.25rem;width:100%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.visibility-btn{display:flex;align-items:center;visibility:hidden;padding:4px}.visibility-btn.is-hidden{visibility:visible}.row:hover .visibility-btn{visibility:visible}.error,.empty-results{position:absolute;top:0;left:0;display:flex;flex-direction:column;align-items:center;font-size:0.875rem;width:100%;height:100%;padding:1rem;box-sizing:border-box;justify-content:center;background-color:white;z-index:var(--scene-tree-overlay-z-index)}.error-section{margin-top:1rem}.error-message{text-align:center}.search-toolbar,slot[name='header']::slotted(*){border-bottom:var(--scene-tree-toolbar-separator)}slot[name='footer']::slotted(:not(:last-child)){border-top:var(--scene-tree-toolbar-separator)}.header{display:flex;flex-direction:column}.footer{display:flex;flex-direction:column}.loading{position:absolute;top:150px;left:50%;transform:translate(-50%, -50%);text-align:center}`;const A=25;const F=s(class t extends n{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.connectionError=o(this,"connectionError");this.firstRowRendered=o(this,"firstRowRendered");this.overScanCount=25;this.configEnv="platprod";this.searchOptions={};this.metadataSearchExactMatch=false;this.metadataSearchKeys=[];this.metadataKeys=[];this.operationAnimationDuration=500;this.rows=[];this.totalRows=0;this.showLoader=false;this.showEmptyResults=false;this.stateMap={componentLoaded:false};this.hasPartialFilterResults=false;this.refreshingResults=false;this.attemptingRetry=false;this.firstCellRendered=false}async invalidateRows(){a(this.getLayoutElement())}async scrollToIndex(e,t={}){const{animate:i,position:s="middle"}=t;const n=Math.max(0,Math.min(e,this.totalRows));const o=this.getScrollToPosition(n,s);await this.getLayoutElement().scrollToPosition(o,{behavior:i?"smooth":undefined})}async scrollToItem(e,t={}){var i;const s=this.totalRows;const n=await((i=this.controller)===null||i===void 0?void 0:i.expandParentNodes(e));if(n!=null&&s!==this.totalRows){return new Promise((e=>{const i=this.getLayoutElement();const s=async()=>{i.removeEventListener("layoutRendered",s);await this.scrollToIndex(n,t);e()};i.addEventListener("layoutRendered",s)}))}else if(n!=null){await this.scrollToIndex(n,t)}}async expandAll(){var e;await((e=this.controller)===null||e===void 0?void 0:e.expandAll())}async collapseAll(){var e;await((e=this.controller)===null||e===void 0?void 0:e.collapseAll())}async expandItem(e){await this.performRowOperation(e,(async({id:e,node:t})=>{var i;if(!t.expanded){await((i=this.controller)===null||i===void 0?void 0:i.expandNode(e))}}))}async collapseItem(e){await this.performRowOperation(e,(async({id:e,node:t})=>{var i;if(t.expanded){await((i=this.controller)===null||i===void 0?void 0:i.collapseNode(e))}}))}async toggleExpandItem(e){await this.performRowOperation(e,(async({node:e})=>{if(e.expanded){await this.collapseItem(e)}else{await this.expandItem(e)}}))}async toggleItemVisibility(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(i.visible||i.partiallyVisible){await S(e,t)}else{await R(e,t)}}))}async hideItem(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(i.visible){await S(e,t)}}))}async showItem(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(!i.visible){await R(e,t)}}))}async selectItem(e,{recurseParent:t,...i}={}){await this.performRowOperation(e,(async({viewer:s,id:n})=>{var o,a,r,l;const d=await((o=this.controller)===null||o===void 0?void 0:o.fetchNodeAncestors(n))||[];const c=(a=this.stateMap.selectionPath)===null||a===void 0?void 0:a.includes(n);const h=this.getNodeFromRowOrIndex(e);const u=d.length>0?d[0].selected:true;const f=h.selected&&!u;if(t&&(c||f)){const e=d.find((({selected:e})=>!e));if(e!=null){await this.selectItem(e,i);this.lastSelectedItemId=n}else{await M(s,n,i);this.lastSelectedItemId=n}}else if(i.range&&this.lastSelectedItemId!=null){const e=await((r=this.controller)===null||r===void 0?void 0:r.expandParentNodes(n));const t=await((l=this.controller)===null||l===void 0?void 0:l.expandParentNodes(this.lastSelectedItemId));if(t&&e){const n=Math.min(t,e);const o=Math.max(t,e);await D(s,n,o,i)}}else{await M(s,n,i);this.lastSelectedItemId=n}this.stateMap.selectionPath=[...d.map((({id:e})=>(e===null||e===void 0?void 0:e.hex)||"")),n]}))}async deselectItem(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(i.selected){this.lastSelectedItemId=undefined;await j(e,t)}}))}async isolateItem(e){await this.performRowOperation(e,(async({viewer:e,id:t})=>{await K(e,t,{animationDurationMs:this.operationAnimationDuration})}))}async getRowAtIndex(e){return this.rows[e]}async getRowForItemId(e){var t;const i=await((t=this.controller)===null||t===void 0?void 0:t.expandParentNodes(e));if(i!=null){return this.rows[i]}else{return undefined}}async getRowForEvent(e){const{clientY:t,target:i}=e;if(i!=null&&this.errorDetails==null&&m(this.el,i)&&v(i)){return this.getRowAtClientY(t)}else{return undefined}}getRowAtClientY(e){const t=this.getLayoutElement();const i=t.layoutOffset;const s=Math.floor((e-i+t.scrollOffset)/t.rowHeight);return this.getRowAtIndex(s)}async filterItems(e,t={}){var i;const s={...t,metadataSearchKeys:t.columns};const n=this.getMetadataSearchKeys(s);return(i=this.controller)===null||i===void 0?void 0:i.filter(e,{...t,columns:n})}async selectFilteredItems(e,t){var i,s,n,o,a,r;if(this.viewer!=null){const l=(s=(i=this.searchOptions)===null||i===void 0?void 0:i.metadataSearchKeys)!==null&&s!==void 0?s:this.metadataSearchKeys;const d=l.length>0?l:this.metadataKeys;const c=d.length>0?d:["VERTEX_SCENE_ITEM_NAME"];const h=(o=(n=this.searchOptions)===null||n===void 0?void 0:n.exactMatch)!==null&&o!==void 0?o:this.metadataSearchExactMatch;const u=(r=(a=this.searchOptions)===null||a===void 0?void 0:a.removeHiddenItems)!==null&&r!==void 0?r:false;await L(this.viewer,e,c,h,u,{append:false,...t})}}async fetchMetadataKeys(){var e,t;return(t=(e=this.controller)===null||e===void 0?void 0:e.fetchMetadataKeys())!==null&&t!==void 0?t:[]}disconnectedCallback(){var e,t,i;(e=this.stateMap.viewerDisposable)===null||e===void 0?void 0:e.dispose();(t=this.stateMap.viewerSceneReadyDisposable)===null||t===void 0?void 0:t.dispose();(i=this.controller)===null||i===void 0?void 0:i.cancel()}connectedCallback(){this.connectToViewer()}componentWillLoad(){var e;if(this.controller==null){const{sceneTreeHost:t}=this.getConfig().network;const i=new l.SceneTreeAPIClient(t,this.getConfig().flags.grpcUseStreamingWebSocketTransport?{transport:d}:undefined);this.controller=new c(i,100);(e=this.controller)===null||e===void 0?void 0:e.setMetadataKeys(this.metadataKeys)}this.stateMap.onStateChangeDisposable=this.controller.onStateChange.on((e=>this.handleControllerStateChange(e)));this.connectToViewer();this.updateMissingViewerError()}async componentDidLoad(){var e;this.ensureLayoutDefined();this.updateLayoutElement();const t=this.getLayoutElement();const i=new ResizeObserver((()=>{this.invalidateRows()}));i.observe(t);this.stateMap.resizeObserver=i;this.stateMap.componentLoaded=true;(e=this.controller)===null||e===void 0?void 0:e.setMetadataKeys(this.metadataKeys)}componentWillRender(){this.updateLayoutElement()}render(){return e(r,{key:"5ffa85bb61bc8292e6c9ec4239cea7c87c24b189"},e("div",{key:"e305f4cee0f16338acad4d60edb5469fc0b20b7c",class:"header"},e("slot",{key:"785f655c31f4c8866a4e9b89fd6be9bd8b7a92af",name:"header"},e("vertex-scene-tree-toolbar",{key:"1e6a2755f67a2e315df254d5703c998af503d90f",class:"search-toolbar"},e("vertex-scene-tree-search",{key:"390e24becad6a63e149eab8e73493787b8d44bf7",controller:this.controller})))),e("slot",{key:"6d740f086d94bb7deeb2ba71031826c76756cc2e",name:"partial-filter-results-banner"},this.hasPartialFilterResults&&e("vertex-scene-tree-notification-banner",{key:"6789e4bdfb24c1a69b32d6c9909665af82082e09",message:this.refreshingResults?"Refreshing results...":"Data loading, refresh for more.",actionLabel:"Refresh",onAction:()=>{var e;return(e=this.controller)===null||e===void 0?void 0:e.refreshFilter()}})),this.errorDetails!=null&&this.renderError(this.errorDetails),this.errorDetails==null&&e("div",{key:"55774ba1f9d307b71197b0eab0c03f4aabf95041",class:"rows-scroll"},this.showLoader&&e("slot",{key:"eaacd5e2516236f909ce018ce384fad0b4b0d611",name:"loading"},e("vertex-viewer-spinner",{key:"de02dfe0223593839a240c7dfbdeaee3bf57b74b",class:"loading",size:"md"})),e("slot",{key:"5141e29171debf43a663e3318fb8ae3cb14e32ff"}),this.showEmptyResults&&e("slot",{key:"375cf7088655dc757587e69836377eec1f9ac0f9",name:"empty-results"},e("div",{key:"952d5b5a6445384ec3d2b3ae2f422c31c8cd26c9",class:"empty-results"},"No Results Found."))),e("div",{key:"aa2170a0a13edba86aa5e220bd8f38627aaa726b",class:"footer"},e("slot",{key:"93416a47de11cb2a70b2ff586034134ef483167d",name:"footer"})))}renderError(t){if(t.code!==h.SCENE_TREE_DISABLED){return e(k,{details:t},e("button",{class:"button button-secondary",onClick:()=>this.retryConnectToViewer(),disabled:this.attemptingRetry},"Retry"))}else{return e(k,{details:t})}}handleViewerChanged(e,t){if(!this.stateMap.componentLoaded){return}this.connectToViewer()}handleControllerChanged(e){var t;if(!this.stateMap.componentLoaded){return}(t=this.stateMap.onStateChangeDisposable)===null||t===void 0?void 0:t.dispose();this.stateMap.onStateChangeDisposable=e.onStateChange.on((e=>this.handleControllerStateChange(e)));e.setMetadataKeys(this.metadataKeys)}handleMetadataKeysChanged(){var e;(e=this.controller)===null||e===void 0?void 0:e.setMetadataKeys(this.metadataKeys)}retryConnectToViewer(){this.attemptingRetry=true;this.errorDetails=undefined;this.connectToViewer()}connectToViewer(){var e,t,i;(e=this.stateMap.viewerDisposable)===null||e===void 0?void 0:e.dispose();(t=this.stateMap.viewerSceneReadyDisposable)===null||t===void 0?void 0:t.dispose();if(this.viewer==null&&this.viewerSelector!=null){this.viewer=document.querySelector(this.viewerSelector)}if(this.viewer!=null){this.clearMissingViewerError();const e=async()=>{const e=this.getLayoutElement();await e.attemptComputeCellHeight()};this.viewer.addEventListener("sceneReady",e);this.stateMap.viewerDisposable=(i=this.controller)===null||i===void 0?void 0:i.connectToViewer(this.viewer);this.stateMap.viewerSceneReadyDisposable={dispose:()=>{var t;return(t=this.viewer)===null||t===void 0?void 0:t.removeEventListener("sceneReady",e)}}}else{this.attemptingRetry=false;if(this.stateMap.componentLoaded){this.updateMissingViewerError()}}}updateMissingViewerError(){if(this.viewer==null){this.errorDetails=new u("MISSING_VIEWER",h.MISSING_VIEWER)}}clearMissingViewerError(){var e;if(((e=this.errorDetails)===null||e===void 0?void 0:e.code)===h.MISSING_VIEWER){this.errorDetails=undefined}}scheduleClearUnusedData(){if(this.stateMap.idleCallbackId!=null){window.cancelIdleCallback(this.stateMap.idleCallbackId)}this.stateMap.idleCallbackId=window.requestIdleCallback((e=>{var t,i,s;const n=(t=e.timeRemaining)===null||t===void 0?void 0:t.call(e);if(n==null||n>=A){const e=this.getLayoutElement();const t=e.viewportStartIndex;const n=e.viewportEndIndex;const[o,a]=((i=this.controller)===null||i===void 0?void 0:i.getPageIndexesForRange(t,n))||[];if(o!=null&&a!=null){(s=this.controller)===null||s===void 0?void 0:s.invalidatePagesOutsideRange(o,a,50)}}else{this.scheduleClearUnusedData()}}))}handleControllerStateChange(e){this.showLoader=!!e.shouldShowLoading;this.showEmptyResults=!!e.shouldShowEmptyResults;this.rows=e.rows;this.totalRows=e.totalRows;this.hasPartialFilterResults=!!e.isPartialFilterResponse;this.refreshingResults=!!e.isSearching;if(e.connection.type==="failure"){this.errorDetails=e.connection.details;this.connectionError.emit(e.connection.details)}else if(e.connection.type==="disconnected"){this.errorDetails=new u("DISCONNECTED",h.DISCONNECTED)}else{this.errorDetails=undefined}if(e.connection.type==="connected"||e.connection.type==="failure"){this.attemptingRetry=false}}getNodeFromRowOrIndex(e){const t=typeof e==="number"?this.rows[e]:e;if(t==null){throw new Error(`Cannot perform scene tree operation. Row not found.`)}return w(t)?t.node:t}async performRowOperation(e,t){const i=this.getNodeFromRowOrIndex(e);if(i.id==null){throw new Error(`Cannot perform scene tree operation. ID is undefined.`)}if(this.viewer==null){throw new Error(`Cannot perform scene tree operation. Cannot get reference to viewer.`)}await t({viewer:this.viewer,id:i.id.hex,node:i})}async handleSearch(e){var t,i,s,n;const o=this.getMetadataSearchKeys(this.searchOptions);const a=(i=(t=this.searchOptions)===null||t===void 0?void 0:t.exactMatch)!==null&&i!==void 0?i:this.metadataSearchExactMatch;const r=(n=(s=this.searchOptions)===null||s===void 0?void 0:s.removeHiddenItems)!==null&&n!==void 0?n:false;try{await this.filterItems(e.detail,{columns:o,exactMatch:a,removeHiddenItems:r})}catch(e){console.error("Failed to filter tree with exception: ",e)}}async handleCellLoaded(){if(!this.firstCellRendered&&this.rows.length>0){this.firstCellRendered=true;this.firstRowRendered.emit()}}getScrollToPosition(e,t){var i;const s=this.getLayoutElement();const n=Math.max(0,Math.min(e,this.totalRows-1));const o=(i=s.layoutHeight)!==null&&i!==void 0?i:0;const a=s.rowHeight;if(t==="start"){return n*a}else if(t==="middle"){const e=n*a+a/2;return e-o/2}else{const e=n*a+a;return e-o}}getConfig(){return f(this.configEnv,this.config)}ensureLayoutDefined(){let e=this.el.querySelector("vertex-scene-tree-table-layout");if(e==null){e=document.createElement("vertex-scene-tree-table-layout");e.innerHTML=`\n <vertex-scene-tree-table-column>\n <template>\n <vertex-scene-tree-table-cell prop:value="{{row.node.name}}" expand-toggle isolate-button visibility-toggle></vertex-scene-tree-table-cell>\n </template>\n </vertex-scene-tree-table-column>\n `;this.el.appendChild(e)}this.stateMap.layoutEl=e}updateLayoutElement(){const e=this.stateMap.layoutEl;if(e!=null){e.rows=this.rows;e.tree=this.el;e.totalRows=this.totalRows;e.controller=this.controller;e.rowData=this.rowData}else if(!this.stateMap.componentLoaded&&this.totalRows>0){console.debug("Scene tree has rows, but the component has not yet rendered")}}getLayoutElement(){if(this.stateMap.layoutEl!=null){return this.stateMap.layoutEl}else{throw new Error("Layout element is undefined")}}getMetadataSearchKeys(e){var t,i;const s=(t=e===null||e===void 0?void 0:e.metadataSearchKeys)!==null&&t!==void 0?t:this.metadataSearchKeys;const n=(i=e===null||e===void 0?void 0:e.exactMatch)!==null&&i!==void 0?i:this.metadataSearchExactMatch;if(n){const e=s.length>0?s:[b];return e}else if(s.length>0){return s}return undefined}get el(){return this}static get watchers(){return{viewer:[{handleViewerChanged:0}],controller:[{handleControllerChanged:0}],metadataKeys:[{handleMetadataKeysChanged:0}]}}static get style(){return T()}},[257,"vertex-scene-tree",{overScanCount:[2,"over-scan-count"],viewerSelector:[1,"viewer-selector"],viewer:[1040],rowData:[16],config:[1],configEnv:[1,"config-env"],controller:[1040],searchOptions:[1040],metadataSearchExactMatch:[1028,"metadata-search-exact-match"],metadataSearchKeys:[1040],metadataKeys:[16],operationAnimationDuration:[2,"operation-animation-duration"],rows:[32],totalRows:[32],showLoader:[32],showEmptyResults:[32],stateMap:[32],errorDetails:[32],hasPartialFilterResults:[32],refreshingResults:[32],attemptingRetry:[32],invalidateRows:[64],scrollToIndex:[64],scrollToItem:[64],expandAll:[64],collapseAll:[64],expandItem:[64],collapseItem:[64],toggleExpandItem:[64],toggleItemVisibility:[64],hideItem:[64],showItem:[64],selectItem:[64],deselectItem:[64],isolateItem:[64],getRowAtIndex:[64],getRowForItemId:[64],getRowForEvent:[64],getRowAtClientY:[64],filterItems:[64],selectFilteredItems:[64],fetchMetadataKeys:[64]},[[0,"search","handleSearch"],[0,"cellLoaded","handleCellLoaded"]],{viewer:[{handleViewerChanged:0}],controller:[{handleControllerChanged:0}],metadataKeys:[{handleMetadataKeysChanged:0}]}]);function V(){if(typeof customElements==="undefined"){return}const e=["vertex-scene-tree","vertex-scene-tree-notification-banner","vertex-scene-tree-search","vertex-scene-tree-table-layout","vertex-scene-tree-toolbar","vertex-viewer-icon","vertex-viewer-spinner"];e.forEach((e=>{switch(e){case"vertex-scene-tree":if(!customElements.get(i(e))){customElements.define(i(e),F)}break;case"vertex-scene-tree-notification-banner":if(!customElements.get(i(e))){y()}break;case"vertex-scene-tree-search":if(!customElements.get(i(e))){g()}break;case"vertex-scene-tree-table-layout":if(!customElements.get(i(e))){p()}break;case"vertex-scene-tree-toolbar":if(!customElements.get(i(e))){x()}break;case"vertex-viewer-icon":if(!customElements.get(i(e))){I()}break;case"vertex-viewer-spinner":if(!customElements.get(i(e))){C()}break}}))}V();const z=F;const N=V;export{z as VertexSceneTree,N as defineCustomElement};
|
|
4
|
+
import{h as e,F as t,t as i,p as s,H as n,d as o,f as a,e as r}from"./p-Bb32XUUS.js";import{s as l,w as d,S as c,a as h,b as u}from"./p-CnYEgl0H.js";import{p as f}from"./p-CuSSK1ZL.js";import{i as v}from"./p-DC86ZXai.js";import{d as p,g as m}from"./p-BEkJ7rmE.js";import{i as w}from"./p-CiSHWNC4.js";import{S as b}from"./p-BZwvQkyb.js";import{d as y}from"./p-CIuxJYJL.js";import{d as g}from"./p-Y8W_BXUk.js";import{d as x}from"./p-B5SQ_oXT.js";import{d as I}from"./p-Bkm6H5uq.js";import{d as C}from"./p-DxuSiXYg.js";const k=({details:i},s)=>e("div",{class:"error"},e("div",{class:"error-section error-message"},e("span",null,i.message),i.link&&e(t,null,e("span",null," See our "),e("a",{href:i.link,target:"_blank"},"documentation")," ",e("span",null," for more information."))),e("div",{class:"error-section"},s));const E=500;async function R(e,t,{suppliedCorrelationId:i}={}){const s=await e.scene();return s.elements((e=>e.items.where((e=>e.withItemId(t))).show())).execute({suppliedCorrelationId:i})}async function S(e,t,{suppliedCorrelationId:i}={}){const s=await e.scene();return s.elements((e=>e.items.where((e=>e.withItemId(t))).hide())).execute({suppliedCorrelationId:i})}async function M(e,t,{append:i=false,suppliedCorrelationId:s}){const n=await e.scene();return n.elements((e=>[...i?[]:[e.items.where((e=>e.all())).deselect()],e.items.where((e=>e.withItemId(t))).select()])).execute({suppliedCorrelationId:s})}async function D(e,t,i,{append:s=true,suppliedCorrelationId:n}){const o=await e.scene();return o.elements((e=>[...s?[]:[e.items.where((e=>e.all())).deselect()],e.items.where((e=>e.withSceneTreeRange({start:t,end:i}))).select()])).execute({suppliedCorrelationId:n})}async function L(e,t,i,s,n,{append:o=false,suppliedCorrelationId:a}){const r=await e.scene();return r.elements((e=>[...o?[]:[e.items.where((e=>e.all())).deselect()],e.items.where((e=>e.withMetadata(t,i,s,n))).select()])).execute({suppliedCorrelationId:a})}async function j(e,t,{suppliedCorrelationId:i}={}){const s=await e.scene();return s.elements((e=>e.items.where((e=>e.withItemId(t))).deselect())).execute({suppliedCorrelationId:i})}async function K(e,t,{suppliedCorrelationId:i,animationDurationMs:s}={}){const n=await e.scene();await n.elements((e=>[e.items.where((e=>e.all())).hide(),e.items.where((e=>e.withItemId(t))).show()])).execute({suppliedCorrelationId:i});const o=await n.camera().flyTo((e=>e.withItemId(t))).render({animation:{milliseconds:s!==null&&s!==void 0?s:E}});await o.onAnimationCompleted.once()}const T=()=>`button{border:none;background:transparent;cursor:pointer;margin:0;padding:0}.button{padding:0.5rem;border-radius:0.25rem}.button-secondary{color:var(--neutral-800);background-color:var(--neutral-300)}.button-secondary:hover{color:var(--neutral-900)}.button-secondary:hover:enabled{box-shadow:0 2px 2px rgb(0 0 0 / 20%)}.button-secondary:disabled{opacity:0.8}.button-secondary:hover:disabled{cursor:not-allowed}:host{--scene-tree-toolbar-separator:1px solid var(--neutral-300);--scene-tree-default-font-family:unset;--scene-tree-default-font-size:unset;--scene-tree-default-font-color:unset;--scene-tree-secondary-font-color:unset;--scene-tree-selected-row-background-color:unset;--scene-tree-hovered-row-background-color:unset;--scene-tree-row-background-color:unset;--scene-tree-row-background-color-depth-n:unset;--scene-tree-overlay-z-index:3000;width:300px;height:100%;user-select:none;-webkit-user-select:none;cursor:default;display:flex;flex-direction:column;position:relative}.rows-scroll{position:relative;height:var(--scene-tree-row-height, 0);flex-grow:1}.rows{position:relative}.row{position:absolute;display:flex;align-items:center;width:100%;height:var(--scene-tree-row-height);padding:var(--scene-tree-row-padding);box-sizing:border-box}.row:hover{background-color:var(--scene-tree-row-hover-color)}.row.is-selected{background-color:var(--scene-tree-row-selected-color)}.expand-toggle{cursor:pointer;width:16px}.row-text{margin-left:0.25rem;width:100%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.visibility-btn{display:flex;align-items:center;visibility:hidden;padding:4px}.visibility-btn.is-hidden{visibility:visible}.row:hover .visibility-btn{visibility:visible}.error,.empty-results{position:absolute;top:0;left:0;display:flex;flex-direction:column;align-items:center;font-size:0.875rem;width:100%;height:100%;padding:1rem;box-sizing:border-box;justify-content:center;background-color:white;z-index:var(--scene-tree-overlay-z-index)}.error-section{margin-top:1rem}.error-message{text-align:center}.search-toolbar,slot[name='header']::slotted(*){border-bottom:var(--scene-tree-toolbar-separator)}slot[name='footer']::slotted(:not(:last-child)){border-top:var(--scene-tree-toolbar-separator)}.header{display:flex;flex-direction:column}.footer{display:flex;flex-direction:column}.loading{position:absolute;top:150px;left:50%;transform:translate(-50%, -50%);text-align:center}`;const A=25;const F=s(class t extends n{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.connectionError=o(this,"connectionError");this.firstRowRendered=o(this,"firstRowRendered");this.overScanCount=25;this.configEnv="platprod";this.searchOptions={};this.metadataSearchExactMatch=false;this.metadataSearchKeys=[];this.metadataKeys=[];this.operationAnimationDuration=500;this.rows=[];this.totalRows=0;this.showLoader=false;this.showEmptyResults=false;this.stateMap={componentLoaded:false};this.hasPartialFilterResults=false;this.refreshingResults=false;this.attemptingRetry=false;this.firstCellRendered=false}async invalidateRows(){a(this.getLayoutElement())}async scrollToIndex(e,t={}){const{animate:i,position:s="middle"}=t;const n=Math.max(0,Math.min(e,this.totalRows));const o=this.getScrollToPosition(n,s);await this.getLayoutElement().scrollToPosition(o,{behavior:i?"smooth":undefined})}async scrollToItem(e,t={}){var i;const s=this.totalRows;const n=await((i=this.controller)===null||i===void 0?void 0:i.expandParentNodes(e));if(n!=null&&s!==this.totalRows){return new Promise((e=>{const i=this.getLayoutElement();const s=async()=>{i.removeEventListener("layoutRendered",s);await this.scrollToIndex(n,t);e()};i.addEventListener("layoutRendered",s)}))}else if(n!=null){await this.scrollToIndex(n,t)}}async expandAll(){var e;await((e=this.controller)===null||e===void 0?void 0:e.expandAll())}async collapseAll(){var e;await((e=this.controller)===null||e===void 0?void 0:e.collapseAll())}async expandItem(e){await this.performRowOperation(e,(async({id:e,node:t})=>{var i;if(!t.expanded){await((i=this.controller)===null||i===void 0?void 0:i.expandNode(e))}}))}async collapseItem(e){await this.performRowOperation(e,(async({id:e,node:t})=>{var i;if(t.expanded){await((i=this.controller)===null||i===void 0?void 0:i.collapseNode(e))}}))}async toggleExpandItem(e){await this.performRowOperation(e,(async({node:e})=>{if(e.expanded){await this.collapseItem(e)}else{await this.expandItem(e)}}))}async toggleItemVisibility(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(i.visible||i.partiallyVisible){await S(e,t)}else{await R(e,t)}}))}async hideItem(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(i.visible){await S(e,t)}}))}async showItem(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(!i.visible){await R(e,t)}}))}async selectItem(e,{recurseParent:t,...i}={}){await this.performRowOperation(e,(async({viewer:s,id:n})=>{var o,a,r,l;const d=await((o=this.controller)===null||o===void 0?void 0:o.fetchNodeAncestors(n))||[];const c=(a=this.stateMap.selectionPath)===null||a===void 0?void 0:a.includes(n);const h=this.getNodeFromRowOrIndex(e);const u=d.length>0?d[0].selected:true;const f=h.selected&&!u;if(t&&(c||f)){const e=d.find((({selected:e})=>!e));if(e!=null){await this.selectItem(e,i);this.lastSelectedItemId=n}else{await M(s,n,i);this.lastSelectedItemId=n}}else if(i.range&&this.lastSelectedItemId!=null){const e=await((r=this.controller)===null||r===void 0?void 0:r.expandParentNodes(n));const t=await((l=this.controller)===null||l===void 0?void 0:l.expandParentNodes(this.lastSelectedItemId));if(t&&e){const n=Math.min(t,e);const o=Math.max(t,e);await D(s,n,o,i)}}else{await M(s,n,i);this.lastSelectedItemId=n}this.stateMap.selectionPath=[...d.map((({id:e})=>(e===null||e===void 0?void 0:e.hex)||"")),n]}))}async deselectItem(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(i.selected){this.lastSelectedItemId=undefined;await j(e,t)}}))}async isolateItem(e){await this.performRowOperation(e,(async({viewer:e,id:t})=>{await K(e,t,{animationDurationMs:this.operationAnimationDuration})}))}async getRowAtIndex(e){return this.rows[e]}async getRowForItemId(e){var t;const i=await((t=this.controller)===null||t===void 0?void 0:t.expandParentNodes(e));if(i!=null){return this.rows[i]}else{return undefined}}async getRowForEvent(e){const{clientY:t,target:i}=e;if(i!=null&&this.errorDetails==null&&m(this.el,i)&&v(i)){return this.getRowAtClientY(t)}else{return undefined}}getRowAtClientY(e){const t=this.getLayoutElement();const i=t.layoutOffset;const s=Math.floor((e-i+t.scrollOffset)/t.rowHeight);return this.getRowAtIndex(s)}async filterItems(e,t={}){var i;const s={...t,metadataSearchKeys:t.columns};const n=this.getMetadataSearchKeys(s);return(i=this.controller)===null||i===void 0?void 0:i.filter(e,{...t,columns:n})}async selectFilteredItems(e,t){var i,s,n,o,a,r;if(this.viewer!=null){const l=(s=(i=this.searchOptions)===null||i===void 0?void 0:i.metadataSearchKeys)!==null&&s!==void 0?s:this.metadataSearchKeys;const d=l.length>0?l:this.metadataKeys;const c=d.length>0?d:["VERTEX_SCENE_ITEM_NAME"];const h=(o=(n=this.searchOptions)===null||n===void 0?void 0:n.exactMatch)!==null&&o!==void 0?o:this.metadataSearchExactMatch;const u=(r=(a=this.searchOptions)===null||a===void 0?void 0:a.removeHiddenItems)!==null&&r!==void 0?r:false;await L(this.viewer,e,c,h,u,{append:false,...t})}}async fetchMetadataKeys(){var e,t;return(t=(e=this.controller)===null||e===void 0?void 0:e.fetchMetadataKeys())!==null&&t!==void 0?t:[]}disconnectedCallback(){var e,t,i;(e=this.stateMap.viewerDisposable)===null||e===void 0?void 0:e.dispose();(t=this.stateMap.viewerSceneReadyDisposable)===null||t===void 0?void 0:t.dispose();(i=this.controller)===null||i===void 0?void 0:i.cancel()}connectedCallback(){this.connectToViewer()}componentWillLoad(){var e;if(this.controller==null){const{sceneTreeHost:t}=this.getConfig().network;const i=new l.SceneTreeAPIClient(t,this.getConfig().flags.grpcUseStreamingWebSocketTransport?{transport:d}:undefined);this.controller=new c(i,100);(e=this.controller)===null||e===void 0?void 0:e.setMetadataKeys(this.metadataKeys)}this.stateMap.onStateChangeDisposable=this.controller.onStateChange.on((e=>this.handleControllerStateChange(e)));this.connectToViewer();this.updateMissingViewerError()}async componentDidLoad(){var e;this.ensureLayoutDefined();this.updateLayoutElement();const t=this.getLayoutElement();const i=new ResizeObserver((()=>{this.invalidateRows()}));i.observe(t);this.stateMap.resizeObserver=i;this.stateMap.componentLoaded=true;(e=this.controller)===null||e===void 0?void 0:e.setMetadataKeys(this.metadataKeys)}componentWillRender(){this.updateLayoutElement()}render(){return e(r,{key:"5ffa85bb61bc8292e6c9ec4239cea7c87c24b189"},e("div",{key:"e305f4cee0f16338acad4d60edb5469fc0b20b7c",class:"header"},e("slot",{key:"785f655c31f4c8866a4e9b89fd6be9bd8b7a92af",name:"header"},e("vertex-scene-tree-toolbar",{key:"1e6a2755f67a2e315df254d5703c998af503d90f",class:"search-toolbar"},e("vertex-scene-tree-search",{key:"390e24becad6a63e149eab8e73493787b8d44bf7",controller:this.controller})))),e("slot",{key:"6d740f086d94bb7deeb2ba71031826c76756cc2e",name:"partial-filter-results-banner"},this.hasPartialFilterResults&&e("vertex-scene-tree-notification-banner",{key:"6789e4bdfb24c1a69b32d6c9909665af82082e09",message:this.refreshingResults?"Refreshing results...":"Data loading, refresh for more.",actionLabel:"Refresh",onAction:()=>{var e;return(e=this.controller)===null||e===void 0?void 0:e.refreshFilter()}})),this.errorDetails!=null&&this.renderError(this.errorDetails),this.errorDetails==null&&e("div",{key:"55774ba1f9d307b71197b0eab0c03f4aabf95041",class:"rows-scroll"},this.showLoader&&e("slot",{key:"eaacd5e2516236f909ce018ce384fad0b4b0d611",name:"loading"},e("vertex-viewer-spinner",{key:"de02dfe0223593839a240c7dfbdeaee3bf57b74b",class:"loading",size:"md"})),e("slot",{key:"5141e29171debf43a663e3318fb8ae3cb14e32ff"}),this.showEmptyResults&&e("slot",{key:"375cf7088655dc757587e69836377eec1f9ac0f9",name:"empty-results"},e("div",{key:"952d5b5a6445384ec3d2b3ae2f422c31c8cd26c9",class:"empty-results"},"No Results Found."))),e("div",{key:"aa2170a0a13edba86aa5e220bd8f38627aaa726b",class:"footer"},e("slot",{key:"93416a47de11cb2a70b2ff586034134ef483167d",name:"footer"})))}renderError(t){if(t.code!==h.SCENE_TREE_DISABLED){return e(k,{details:t},e("button",{class:"button button-secondary",onClick:()=>this.retryConnectToViewer(),disabled:this.attemptingRetry},"Retry"))}else{return e(k,{details:t})}}handleViewerChanged(e,t){if(!this.stateMap.componentLoaded){return}this.connectToViewer()}handleControllerChanged(e){var t;if(!this.stateMap.componentLoaded){return}(t=this.stateMap.onStateChangeDisposable)===null||t===void 0?void 0:t.dispose();this.stateMap.onStateChangeDisposable=e.onStateChange.on((e=>this.handleControllerStateChange(e)));e.setMetadataKeys(this.metadataKeys)}handleMetadataKeysChanged(){var e;(e=this.controller)===null||e===void 0?void 0:e.setMetadataKeys(this.metadataKeys)}retryConnectToViewer(){this.attemptingRetry=true;this.errorDetails=undefined;this.connectToViewer()}connectToViewer(){var e,t,i;(e=this.stateMap.viewerDisposable)===null||e===void 0?void 0:e.dispose();(t=this.stateMap.viewerSceneReadyDisposable)===null||t===void 0?void 0:t.dispose();if(this.viewer==null&&this.viewerSelector!=null){this.viewer=document.querySelector(this.viewerSelector)}if(this.viewer!=null){this.clearMissingViewerError();const e=async()=>{const e=this.getLayoutElement();await e.attemptComputeCellHeight()};this.viewer.addEventListener("sceneReady",e);this.stateMap.viewerDisposable=(i=this.controller)===null||i===void 0?void 0:i.connectToViewer(this.viewer);this.stateMap.viewerSceneReadyDisposable={dispose:()=>{var t;return(t=this.viewer)===null||t===void 0?void 0:t.removeEventListener("sceneReady",e)}}}else{this.attemptingRetry=false;if(this.stateMap.componentLoaded){this.updateMissingViewerError()}}}updateMissingViewerError(){if(this.viewer==null){this.errorDetails=new u("MISSING_VIEWER",h.MISSING_VIEWER)}}clearMissingViewerError(){var e;if(((e=this.errorDetails)===null||e===void 0?void 0:e.code)===h.MISSING_VIEWER){this.errorDetails=undefined}}scheduleClearUnusedData(){if(this.stateMap.idleCallbackId!=null){window.cancelIdleCallback(this.stateMap.idleCallbackId)}this.stateMap.idleCallbackId=window.requestIdleCallback((e=>{var t,i,s;const n=(t=e.timeRemaining)===null||t===void 0?void 0:t.call(e);if(n==null||n>=A){const e=this.getLayoutElement();const t=e.viewportStartIndex;const n=e.viewportEndIndex;const[o,a]=((i=this.controller)===null||i===void 0?void 0:i.getPageIndexesForRange(t,n))||[];if(o!=null&&a!=null){(s=this.controller)===null||s===void 0?void 0:s.invalidatePagesOutsideRange(o,a,50)}}else{this.scheduleClearUnusedData()}}))}handleControllerStateChange(e){this.showLoader=!!e.shouldShowLoading;this.showEmptyResults=!!e.shouldShowEmptyResults;this.rows=e.rows;this.totalRows=e.totalRows;this.hasPartialFilterResults=!!e.isPartialFilterResponse;this.refreshingResults=!!e.isSearching;if(e.connection.type==="failure"){this.errorDetails=e.connection.details;this.connectionError.emit(e.connection.details)}else if(e.connection.type==="disconnected"){this.errorDetails=new u("DISCONNECTED",h.DISCONNECTED)}else{this.errorDetails=undefined}if(e.connection.type==="connected"||e.connection.type==="failure"){this.attemptingRetry=false}}getNodeFromRowOrIndex(e){const t=typeof e==="number"?this.rows[e]:e;if(t==null){throw new Error(`Cannot perform scene tree operation. Row not found.`)}return w(t)?t.node:t}async performRowOperation(e,t){const i=this.getNodeFromRowOrIndex(e);if(i.id==null){throw new Error(`Cannot perform scene tree operation. ID is undefined.`)}if(this.viewer==null){throw new Error(`Cannot perform scene tree operation. Cannot get reference to viewer.`)}await t({viewer:this.viewer,id:i.id.hex,node:i})}async handleSearch(e){var t,i,s,n;const o=this.getMetadataSearchKeys(this.searchOptions);const a=(i=(t=this.searchOptions)===null||t===void 0?void 0:t.exactMatch)!==null&&i!==void 0?i:this.metadataSearchExactMatch;const r=(n=(s=this.searchOptions)===null||s===void 0?void 0:s.removeHiddenItems)!==null&&n!==void 0?n:false;try{await this.filterItems(e.detail,{columns:o,exactMatch:a,removeHiddenItems:r})}catch(e){console.error("Failed to filter tree with exception: ",e)}}async handleCellLoaded(){if(!this.firstCellRendered&&this.rows.length>0){this.firstCellRendered=true;this.firstRowRendered.emit()}}getScrollToPosition(e,t){var i;const s=this.getLayoutElement();const n=Math.max(0,Math.min(e,this.totalRows-1));const o=(i=s.layoutHeight)!==null&&i!==void 0?i:0;const a=s.rowHeight;if(t==="start"){return n*a}else if(t==="middle"){const e=n*a+a/2;return e-o/2}else{const e=n*a+a;return e-o}}getConfig(){return f(this.configEnv,this.config)}ensureLayoutDefined(){let e=this.el.querySelector("vertex-scene-tree-table-layout");if(e==null){e=document.createElement("vertex-scene-tree-table-layout");e.innerHTML=`\n <vertex-scene-tree-table-column>\n <template>\n <vertex-scene-tree-table-cell prop:value="{{row.node.name}}" expand-toggle isolate-button visibility-toggle></vertex-scene-tree-table-cell>\n </template>\n </vertex-scene-tree-table-column>\n `;this.el.appendChild(e)}this.stateMap.layoutEl=e}updateLayoutElement(){const e=this.stateMap.layoutEl;if(e!=null){e.rows=this.rows;e.tree=this.el;e.totalRows=this.totalRows;e.controller=this.controller;e.rowData=this.rowData}else if(!this.stateMap.componentLoaded&&this.totalRows>0){console.debug("Scene tree has rows, but the component has not yet rendered")}}getLayoutElement(){if(this.stateMap.layoutEl!=null){return this.stateMap.layoutEl}else{throw new Error("Layout element is undefined")}}getMetadataSearchKeys(e){var t,i;const s=(t=e===null||e===void 0?void 0:e.metadataSearchKeys)!==null&&t!==void 0?t:this.metadataSearchKeys;const n=(i=e===null||e===void 0?void 0:e.exactMatch)!==null&&i!==void 0?i:this.metadataSearchExactMatch;if(n){const e=s.length>0?s:[b];return e}else if(s.length>0){return s}return undefined}get el(){return this}static get watchers(){return{viewer:[{handleViewerChanged:0}],controller:[{handleControllerChanged:0}],metadataKeys:[{handleMetadataKeysChanged:0}]}}static get style(){return T()}},[257,"vertex-scene-tree",{overScanCount:[2,"over-scan-count"],viewerSelector:[1,"viewer-selector"],viewer:[1040],rowData:[16],config:[1],configEnv:[1,"config-env"],controller:[1040],searchOptions:[1040],metadataSearchExactMatch:[1028,"metadata-search-exact-match"],metadataSearchKeys:[1040],metadataKeys:[16],operationAnimationDuration:[2,"operation-animation-duration"],rows:[32],totalRows:[32],showLoader:[32],showEmptyResults:[32],stateMap:[32],errorDetails:[32],hasPartialFilterResults:[32],refreshingResults:[32],attemptingRetry:[32],invalidateRows:[64],scrollToIndex:[64],scrollToItem:[64],expandAll:[64],collapseAll:[64],expandItem:[64],collapseItem:[64],toggleExpandItem:[64],toggleItemVisibility:[64],hideItem:[64],showItem:[64],selectItem:[64],deselectItem:[64],isolateItem:[64],getRowAtIndex:[64],getRowForItemId:[64],getRowForEvent:[64],getRowAtClientY:[64],filterItems:[64],selectFilteredItems:[64],fetchMetadataKeys:[64]},[[0,"search","handleSearch"],[0,"cellLoaded","handleCellLoaded"]],{viewer:[{handleViewerChanged:0}],controller:[{handleControllerChanged:0}],metadataKeys:[{handleMetadataKeysChanged:0}]}]);function V(){if(typeof customElements==="undefined"){return}const e=["vertex-scene-tree","vertex-scene-tree-notification-banner","vertex-scene-tree-search","vertex-scene-tree-table-layout","vertex-scene-tree-toolbar","vertex-viewer-icon","vertex-viewer-spinner"];e.forEach((e=>{switch(e){case"vertex-scene-tree":if(!customElements.get(i(e))){customElements.define(i(e),F)}break;case"vertex-scene-tree-notification-banner":if(!customElements.get(i(e))){y()}break;case"vertex-scene-tree-search":if(!customElements.get(i(e))){g()}break;case"vertex-scene-tree-table-layout":if(!customElements.get(i(e))){p()}break;case"vertex-scene-tree-toolbar":if(!customElements.get(i(e))){x()}break;case"vertex-viewer-icon":if(!customElements.get(i(e))){I()}break;case"vertex-viewer-spinner":if(!customElements.get(i(e))){C()}break}}))}V();const z=F;const N=V;export{z as VertexSceneTree,N as defineCustomElement};
|
|
5
5
|
//# sourceMappingURL=vertex-scene-tree.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{V as o,d as s}from"./p-
|
|
4
|
+
import{V as o,d as s}from"./p-BmoTo_-J.js";const t=o;const m=s;export{t as VertexViewerPinGroup,m as defineCustomElement};
|
|
5
5
|
//# sourceMappingURL=vertex-viewer-pin-group.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{t as i,p as t,H as e,h as s,e as n}from"./p-Bb32XUUS.js";import{a as o,d as l,P as r}from"./p-D97fhwcJ.js";import{p as h}from"./p-Q_Zx-nhC.js";import{b as d}from"./p-JEG5R8Jl.js";import{l as a,p as u}from"./p-Fn5MVjY7.js";import{g as v}from"./p-DLsIYOYi.js";import{E as c}from"./p-CFus3r7d.js";import{E as p}from"./p-B87-hFXA.js";import{P as f}from"./p-DMtbdNoY.js";import{g as m}from"./p-Bg-uS9BH.js";import{d as w}from"./p-NXN0rSu2.js";import{d as C}from"./p-B15IwFjA.js";import{d as b}from"./p-Bkm6H5uq.js";import{d as y}from"./p-B7C1GfGS.js";import{d as g}from"./p-B4MsUZ3n.js";class x{get elementRect(){return this.rectObserver.rect}constructor(i,t,e){this.rectObserver=new c;this.droppableSurfaces=[p.PRECISE_SURFACE,p.IMPRECISE_SURFACE,p.GENERIC_GEOMETRY];this.handlePointerMove=async i=>{const t=await this.isDroppableSurface(i);const e=this.controller.getDraggable();if(e!=null&&t){this.handleDrag(e,i)}if(this.controller.getDraggable()==null&&this.controller.getToolMode()==="edit"&&t){this.addCursor(this.getCursorType())}else{this.clearCursor()}};this.handleDrag=async(i,t)=>{const e=v(t,this.elementRect);const s=await this.getWorldPositionForPoint(e);if(s!=null){this.controller.updateDraggable({...i,lastPoint:e},s)}};this.handlePointerDown=async i=>{const t=t=>{const s=h.distance(h.create(i.clientX,t.clientY),h.create(t.clientX,t.clientY));if(s<=2&&i.buttons!==2){if(this.controller.getToolMode()==="edit"){const t=v(i,this.elementRect);this.handlePlacePin(t)}}e()};const e=()=>{window.removeEventListener("pointerup",t)};window.addEventListener("pointerup",t);return{dispose:e}};this.handlePointerUp=async()=>{const i=this.controller.getDraggable();const t=i===null||i===void 0?void 0:i.lastPoint;this.controller.setDraggable(undefined);if(t!=null&&i!=null){this.ifInitialized((async({api:e})=>{var s,n,o,l,r,h;const[d]=await e.hitItems(t);if((d===null||d===void 0?void 0:d.hitPoint)!=null&&((s=d===null||d===void 0?void 0:d.hitPoint)===null||s===void 0?void 0:s.x)!=null&&((n=d===null||d===void 0?void 0:d.hitPoint)===null||n===void 0?void 0:n.y)!=null&&((o=d===null||d===void 0?void 0:d.hitPoint)===null||o===void 0?void 0:o.z)!=null){this.controller.updateDraggable({...i,lastPoint:t},{x:(l=d===null||d===void 0?void 0:d.hitPoint)===null||l===void 0?void 0:l.x,y:d===null||d===void 0?void 0:d.hitPoint.y,z:d===null||d===void 0?void 0:d.hitPoint.z},(h=(r=d===null||d===void 0?void 0:d.partId)===null||r===void 0?void 0:r.hex)!==null&&h!==void 0?h:undefined)}}))}};this.controller=i;this.xOffset=t;this.yOffset=e}initialize(i,t){this.element=i;this.api=t;this.rectObserver.observe(i);i.addEventListener("pointermove",this.handlePointerMove);i.addEventListener("pointerdown",this.handlePointerDown);window.addEventListener("pointerup",this.handlePointerUp)}dispose(){var i,t;this.rectObserver.disconnect();this.clearCursor();(i=this.element)===null||i===void 0?void 0:i.removeEventListener("pointermove",this.handlePointerMove);(t=this.element)===null||t===void 0?void 0:t.removeEventListener("pointerdown",this.handlePointerDown);window.removeEventListener("pointerup",this.handlePointerUp);this.element=undefined;this.api=undefined}async getWorldPositionForPoint(i){return this.ifInitialized((async({api:t})=>{const e=await t.getWorldPointFromViewport(i);return e}))}async handlePlacePin(i,t){this.ifInitialized((async({api:e})=>{var s,n,l,r,h,a;const[u]=await e.hitItems(i);if((u===null||u===void 0?void 0:u.hitPoint)!=null&&this.elementRect!=null){if((u===null||u===void 0?void 0:u.hitPoint)!=null&&(u===null||u===void 0?void 0:u.hitPoint.x)!=null&&(u===null||u===void 0?void 0:u.hitPoint.y)!=null&&(u===null||u===void 0?void 0:u.hitPoint.z)!=null){const e=t!=null?t.id:d.create();const v=this.controller.getStyleAttributes()!=null?{style:this.controller.getStyleAttributes()}:undefined;switch(this.controller.getToolType()){case"pin-icon":this.controller.setPin({type:"icon",id:e,worldPosition:{x:(s=u===null||u===void 0?void 0:u.hitPoint)===null||s===void 0?void 0:s.x,y:u===null||u===void 0?void 0:u.hitPoint.y,z:u===null||u===void 0?void 0:u.hitPoint.z},partId:(l=(n=u===null||u===void 0?void 0:u.itemId)===null||n===void 0?void 0:n.hex)!==null&&l!==void 0?l:undefined,attributes:v});break;case"pin-text":const d=t==null;const c=o(i,this.elementRect,d,this.xOffset,this.yOffset);this.controller.setPin({type:"text",id:e,worldPosition:{x:(r=u===null||u===void 0?void 0:u.hitPoint)===null||r===void 0?void 0:r.x,y:u===null||u===void 0?void 0:u.hitPoint.y,z:u===null||u===void 0?void 0:u.hitPoint.z},partId:(a=(h=u===null||u===void 0?void 0:u.itemId)===null||h===void 0?void 0:h.hex)!==null&&a!==void 0?a:undefined,label:{point:c},attributes:v});this.controller.setSelectedPinId(e);break}}}else{this.controller.setSelectedPinId()}}))}getCursorType(){switch(this.controller.getToolType()){case"pin-icon":return u;case"pin-text":return a}}addCursor(i){this.clearCursor();this.cursor=this.ifInitialized((({api:t})=>t.addCursor(i)))}async isDroppableSurface(i){var t;const e=v(i,this.elementRect);const s=await((t=this.api)===null||t===void 0?void 0:t.getEntityTypeAtPoint(e));return s!=null&&this.droppableSurfaces.includes(s)}ifInitialized(i){if(this.element!=null&&this.api!=null){return i({element:this.element,api:this.api})}else{throw new Error("Pins interaction handler not initialized.")}}clearCursor(){var i;(i=this.cursor)===null||i===void 0?void 0:i.dispose();this.cursor=undefined}}const j=()=>`:host{position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden;pointer-events:none;--viewer-pin-tool-initial-label-offset-x:20;--viewer-pin-tool-initial-label-offset-y:20}`;const P=t(class i extends e{constructor(i){super();if(i!==false){this.__registerHost()}this.__attachShadow();this.pinModel=new f;this.tool="pin-icon";this.mode="view";this.pins=[];this.stateMap={};this.handleSetProjectionMatrix=()=>{var i,t;this.projectionViewMatrix=(t=(i=this.viewer)===null||i===void 0?void 0:i.frame)===null||t===void 0?void 0:t.scene.camera.projectionViewMatrix}}watchModeChange(){var i;(i=this.pinController)===null||i===void 0?void 0:i.setToolMode(this.mode);this.setupInteractionHandler();if(this.mode==="edit"){this.setFeatureMaps();this.setCameraAndKeyboardControls()}else{this.resetFeatureMaps();this.resetCameraAndKeyboardControls()}}watchTypeChange(){var i;(i=this.pinController)===null||i===void 0?void 0:i.setToolType(this.tool);this.setupInteractionHandler()}watchAccentColorChange(){var i;(i=this.pinController)===null||i===void 0?void 0:i.setAccentColor(this.accentColor);this.setupInteractionHandler()}watchPrimaryColorChange(){var i;(i=this.pinController)===null||i===void 0?void 0:i.setPrimaryColor(this.primaryColor);this.setupInteractionHandler()}watchPinsChange(){if(this.pins.length>0){this.setDepthBuffers();this.setFeatureMaps()}else{this.resetDepthBuffers();this.resetFeatureMaps()}}connectedCallback(){this.setupInteractionHandler();this.setDepthBuffers();this.setFeatureMaps();this.setCameraAndKeyboardControls()}componentWillLoad(){this.updateViewport();this.setupController();this.setupInteractionHandler();this.setDepthBuffers();this.setFeatureMaps();this.setCameraAndKeyboardControls();this.pinModel.onEntitiesChanged((i=>{this.pins=i}));this.pinModel.onSelectionChange((i=>{this.selectedPinId=i}));this.handleViewerChanged(this.viewer,undefined)}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.updateViewport()));this.resizeObserver.observe(this.hostEl)}disconnectedCallback(){this.clearInteractionHandler();this.clearModelListeners();this.resetDepthBuffers();this.resetFeatureMaps();this.resetCameraAndKeyboardControls()}handleViewerChanged(i,t){this.setupInteractionHandler();this.setDepthBuffers();this.setFeatureMaps();this.setCameraAndKeyboardControls();if(t!=null){t.removeEventListener("frameDrawn",this.handleSetProjectionMatrix)}if(i!=null){i.addEventListener("frameDrawn",this.handleSetProjectionMatrix)}this.handleSetProjectionMatrix()}render(){return s(n,{key:"ce2867d4a624dabf607b9de837e73a0a0c40eaf9"},s("vertex-viewer-dom-renderer",{key:"7d2dc3d75ca1818ba7b9b292ccbe1db7ac5c7ac8",viewer:this.viewer,drawMode:"2d"},this.pins.map((i=>s("vertex-viewer-pin-group",{id:`pin-group-${i.id}`,"data-is-dom-group-element":true,pin:i,elementBounds:this.elementBounds,pinModel:this.pinModel,pinController:this.pinController,projectionViewMatrix:this.projectionViewMatrix,selected:this.selectedPinId===i.id})))))}setupController(){const i=this.accentColor||this.primaryColor?{accentColor:this.accentColor,primaryColor:this.primaryColor}:undefined;this.pinController=new r(this.pinModel,this.mode,this.tool,i)}clearInteractionHandler(){var i;(i=this.registeredInteractionHandler)===null||i===void 0?void 0:i.then((i=>i.dispose()));this.registeredInteractionHandler=undefined}setupInteractionHandler(){var i;const t=window.getComputedStyle(this.hostEl);const e=t.getPropertyValue("--viewer-pin-tool-initial-label-offset-x").trim();const s=Number.isFinite(Number.parseInt(e))?Number.parseInt(e):20;const n=t.getPropertyValue("--viewer-pin-tool-initial-label-offset-y").trim();const o=Number.isFinite(Number.parseInt(n))?Number.parseInt(n):20;this.clearInteractionHandler();if(this.pinController!=null){this.registeredInteractionHandler=(i=this.viewer)===null||i===void 0?void 0:i.registerInteractionHandler(new x(this.pinController,s,o))}}clearModelListeners(){var i,t,e;(i=this.onEntitiesChangedHandler)===null||i===void 0?void 0:i.dispose();this.onEntitiesChangedHandler=undefined;(t=this.onEntityAddedHandler)===null||t===void 0?void 0:t.dispose();this.onEntityAddedHandler=undefined;(e=this.resizeObserver)===null||e===void 0?void 0:e.disconnect()}updateViewport(){this.elementBounds=m(this.hostEl)}setDepthBuffers(){if(this.pins.length>0&&this.viewer!=null&&this.viewer.depthBuffers==null){this.stateMap.shouldClearDepthBuffers=true;this.viewer.depthBuffers="final"}}resetDepthBuffers(){if(this.stateMap.shouldClearDepthBuffers&&this.viewer!=null){this.viewer.depthBuffers=undefined;this.stateMap.shouldClearDepthBuffers=undefined}}setFeatureMaps(){if((this.pins.length>0||this.mode==="edit")&&this.viewer!=null&&this.viewer.featureMaps==null){this.stateMap.shouldClearFeatureMaps=true;this.viewer.featureMaps="final"}}resetFeatureMaps(){if(this.stateMap.shouldClearFeatureMaps&&this.viewer!=null){this.viewer.featureMaps=undefined;this.stateMap.shouldClearFeatureMaps=undefined}}setCameraAndKeyboardControls(){if(this.mode==="edit"&&this.viewer!=null){if(this.viewer.cameraControls){this.stateMap.shouldClearCameraControls=true;this.viewer.cameraControls=false}if(this.viewer.keyboardControls){this.stateMap.shouldClearKeyboardControls=true;this.viewer.keyboardControls=false}}}resetCameraAndKeyboardControls(){if(this.viewer!=null){if(this.stateMap.shouldClearCameraControls){this.viewer.cameraControls=true;this.stateMap.shouldClearCameraControls=undefined}if(this.stateMap.shouldClearKeyboardControls){this.viewer.keyboardControls=true;this.stateMap.shouldClearKeyboardControls=undefined}}}get hostEl(){return this}static get watchers(){return{mode:[{watchModeChange:0}],tool:[{watchTypeChange:0}],accentColor:[{watchAccentColorChange:0}],primaryColor:[{watchPrimaryColorChange:0}],pins:[{watchPinsChange:0}],viewer:[{handleViewerChanged:0}]}}static get style(){return j()}},[1,"vertex-viewer-pin-tool",{pinController:[1040],pinModel:[16],viewer:[16],tool:[1025],mode:[1025],primaryColor:[1025,"primary-color"],accentColor:[1025,"accent-color"],pins:[32],selectedPinId:[32],elementBounds:[32],projectionViewMatrix:[32]},undefined,{mode:[{watchModeChange:0}],tool:[{watchTypeChange:0}],accentColor:[{watchAccentColorChange:0}],primaryColor:[{watchPrimaryColorChange:0}],pins:[{watchPinsChange:0}],viewer:[{handleViewerChanged:0}]}]);function k(){if(typeof customElements==="undefined"){return}const t=["vertex-viewer-pin-tool","vertex-viewer-dom-element","vertex-viewer-dom-renderer","vertex-viewer-icon","vertex-viewer-pin-group","vertex-viewer-pin-label","vertex-viewer-pin-label-line"];t.forEach((t=>{switch(t){case"vertex-viewer-pin-tool":if(!customElements.get(i(t))){customElements.define(i(t),P)}break;case"vertex-viewer-dom-element":if(!customElements.get(i(t))){w()}break;case"vertex-viewer-dom-renderer":if(!customElements.get(i(t))){C()}break;case"vertex-viewer-icon":if(!customElements.get(i(t))){b()}break;case"vertex-viewer-pin-group":if(!customElements.get(i(t))){y()}break;case"vertex-viewer-pin-label":if(!customElements.get(i(t))){l()}break;case"vertex-viewer-pin-label-line":if(!customElements.get(i(t))){g()}break}}))}k();const E=P;const M=k;export{E as VertexViewerPinTool,M as defineCustomElement};
|
|
4
|
+
import{t as i,p as t,H as e,h as s,e as n}from"./p-Bb32XUUS.js";import{a as o,d as l,P as r}from"./p-D97fhwcJ.js";import{p as h}from"./p-Q_Zx-nhC.js";import{b as d}from"./p-JEG5R8Jl.js";import{l as a,p as u}from"./p-Fn5MVjY7.js";import{g as v}from"./p-DLsIYOYi.js";import{E as c}from"./p-CFus3r7d.js";import{E as p}from"./p-B87-hFXA.js";import{P as f}from"./p-DMtbdNoY.js";import{g as m}from"./p-Bg-uS9BH.js";import{d as w}from"./p-NXN0rSu2.js";import{d as C}from"./p-B15IwFjA.js";import{d as b}from"./p-Bkm6H5uq.js";import{d as y}from"./p-BmoTo_-J.js";import{d as g}from"./p-B4MsUZ3n.js";class x{get elementRect(){return this.rectObserver.rect}constructor(i,t,e){this.rectObserver=new c;this.droppableSurfaces=[p.PRECISE_SURFACE,p.IMPRECISE_SURFACE,p.GENERIC_GEOMETRY];this.handlePointerMove=async i=>{const t=await this.isDroppableSurface(i);const e=this.controller.getDraggable();if(e!=null&&t){this.handleDrag(e,i)}if(this.controller.getDraggable()==null&&this.controller.getToolMode()==="edit"&&t){this.addCursor(this.getCursorType())}else{this.clearCursor()}};this.handleDrag=async(i,t)=>{const e=v(t,this.elementRect);const s=await this.getWorldPositionForPoint(e);if(s!=null){this.controller.updateDraggable({...i,lastPoint:e},s)}};this.handlePointerDown=async i=>{const t=t=>{const s=h.distance(h.create(i.clientX,t.clientY),h.create(t.clientX,t.clientY));if(s<=2&&i.buttons!==2){if(this.controller.getToolMode()==="edit"){const t=v(i,this.elementRect);this.handlePlacePin(t)}}e()};const e=()=>{window.removeEventListener("pointerup",t)};window.addEventListener("pointerup",t);return{dispose:e}};this.handlePointerUp=async()=>{const i=this.controller.getDraggable();const t=i===null||i===void 0?void 0:i.lastPoint;this.controller.setDraggable(undefined);if(t!=null&&i!=null){this.ifInitialized((async({api:e})=>{var s,n,o,l,r,h;const[d]=await e.hitItems(t);if((d===null||d===void 0?void 0:d.hitPoint)!=null&&((s=d===null||d===void 0?void 0:d.hitPoint)===null||s===void 0?void 0:s.x)!=null&&((n=d===null||d===void 0?void 0:d.hitPoint)===null||n===void 0?void 0:n.y)!=null&&((o=d===null||d===void 0?void 0:d.hitPoint)===null||o===void 0?void 0:o.z)!=null){this.controller.updateDraggable({...i,lastPoint:t},{x:(l=d===null||d===void 0?void 0:d.hitPoint)===null||l===void 0?void 0:l.x,y:d===null||d===void 0?void 0:d.hitPoint.y,z:d===null||d===void 0?void 0:d.hitPoint.z},(h=(r=d===null||d===void 0?void 0:d.partId)===null||r===void 0?void 0:r.hex)!==null&&h!==void 0?h:undefined)}}))}};this.controller=i;this.xOffset=t;this.yOffset=e}initialize(i,t){this.element=i;this.api=t;this.rectObserver.observe(i);i.addEventListener("pointermove",this.handlePointerMove);i.addEventListener("pointerdown",this.handlePointerDown);window.addEventListener("pointerup",this.handlePointerUp)}dispose(){var i,t;this.rectObserver.disconnect();this.clearCursor();(i=this.element)===null||i===void 0?void 0:i.removeEventListener("pointermove",this.handlePointerMove);(t=this.element)===null||t===void 0?void 0:t.removeEventListener("pointerdown",this.handlePointerDown);window.removeEventListener("pointerup",this.handlePointerUp);this.element=undefined;this.api=undefined}async getWorldPositionForPoint(i){return this.ifInitialized((async({api:t})=>{const e=await t.getWorldPointFromViewport(i);return e}))}async handlePlacePin(i,t){this.ifInitialized((async({api:e})=>{var s,n,l,r,h,a;const[u]=await e.hitItems(i);if((u===null||u===void 0?void 0:u.hitPoint)!=null&&this.elementRect!=null){if((u===null||u===void 0?void 0:u.hitPoint)!=null&&(u===null||u===void 0?void 0:u.hitPoint.x)!=null&&(u===null||u===void 0?void 0:u.hitPoint.y)!=null&&(u===null||u===void 0?void 0:u.hitPoint.z)!=null){const e=t!=null?t.id:d.create();const v=this.controller.getStyleAttributes()!=null?{style:this.controller.getStyleAttributes()}:undefined;switch(this.controller.getToolType()){case"pin-icon":this.controller.setPin({type:"icon",id:e,worldPosition:{x:(s=u===null||u===void 0?void 0:u.hitPoint)===null||s===void 0?void 0:s.x,y:u===null||u===void 0?void 0:u.hitPoint.y,z:u===null||u===void 0?void 0:u.hitPoint.z},partId:(l=(n=u===null||u===void 0?void 0:u.itemId)===null||n===void 0?void 0:n.hex)!==null&&l!==void 0?l:undefined,attributes:v});break;case"pin-text":const d=t==null;const c=o(i,this.elementRect,d,this.xOffset,this.yOffset);this.controller.setPin({type:"text",id:e,worldPosition:{x:(r=u===null||u===void 0?void 0:u.hitPoint)===null||r===void 0?void 0:r.x,y:u===null||u===void 0?void 0:u.hitPoint.y,z:u===null||u===void 0?void 0:u.hitPoint.z},partId:(a=(h=u===null||u===void 0?void 0:u.itemId)===null||h===void 0?void 0:h.hex)!==null&&a!==void 0?a:undefined,label:{point:c},attributes:v});this.controller.setSelectedPinId(e);break}}}else{this.controller.setSelectedPinId()}}))}getCursorType(){switch(this.controller.getToolType()){case"pin-icon":return u;case"pin-text":return a}}addCursor(i){this.clearCursor();this.cursor=this.ifInitialized((({api:t})=>t.addCursor(i)))}async isDroppableSurface(i){var t;const e=v(i,this.elementRect);const s=await((t=this.api)===null||t===void 0?void 0:t.getEntityTypeAtPoint(e));return s!=null&&this.droppableSurfaces.includes(s)}ifInitialized(i){if(this.element!=null&&this.api!=null){return i({element:this.element,api:this.api})}else{throw new Error("Pins interaction handler not initialized.")}}clearCursor(){var i;(i=this.cursor)===null||i===void 0?void 0:i.dispose();this.cursor=undefined}}const j=()=>`:host{position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden;pointer-events:none;--viewer-pin-tool-initial-label-offset-x:20;--viewer-pin-tool-initial-label-offset-y:20}`;const P=t(class i extends e{constructor(i){super();if(i!==false){this.__registerHost()}this.__attachShadow();this.pinModel=new f;this.tool="pin-icon";this.mode="view";this.pins=[];this.stateMap={};this.handleSetProjectionMatrix=()=>{var i,t;this.projectionViewMatrix=(t=(i=this.viewer)===null||i===void 0?void 0:i.frame)===null||t===void 0?void 0:t.scene.camera.projectionViewMatrix}}watchModeChange(){var i;(i=this.pinController)===null||i===void 0?void 0:i.setToolMode(this.mode);this.setupInteractionHandler();if(this.mode==="edit"){this.setFeatureMaps();this.setCameraAndKeyboardControls()}else{this.resetFeatureMaps();this.resetCameraAndKeyboardControls()}}watchTypeChange(){var i;(i=this.pinController)===null||i===void 0?void 0:i.setToolType(this.tool);this.setupInteractionHandler()}watchAccentColorChange(){var i;(i=this.pinController)===null||i===void 0?void 0:i.setAccentColor(this.accentColor);this.setupInteractionHandler()}watchPrimaryColorChange(){var i;(i=this.pinController)===null||i===void 0?void 0:i.setPrimaryColor(this.primaryColor);this.setupInteractionHandler()}watchPinsChange(){if(this.pins.length>0){this.setDepthBuffers();this.setFeatureMaps()}else{this.resetDepthBuffers();this.resetFeatureMaps()}}connectedCallback(){this.setupInteractionHandler();this.setDepthBuffers();this.setFeatureMaps();this.setCameraAndKeyboardControls()}componentWillLoad(){this.updateViewport();this.setupController();this.setupInteractionHandler();this.setDepthBuffers();this.setFeatureMaps();this.setCameraAndKeyboardControls();this.pinModel.onEntitiesChanged((i=>{this.pins=i}));this.pinModel.onSelectionChange((i=>{this.selectedPinId=i}));this.handleViewerChanged(this.viewer,undefined)}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.updateViewport()));this.resizeObserver.observe(this.hostEl)}disconnectedCallback(){this.clearInteractionHandler();this.clearModelListeners();this.resetDepthBuffers();this.resetFeatureMaps();this.resetCameraAndKeyboardControls()}handleViewerChanged(i,t){this.setupInteractionHandler();this.setDepthBuffers();this.setFeatureMaps();this.setCameraAndKeyboardControls();if(t!=null){t.removeEventListener("frameDrawn",this.handleSetProjectionMatrix)}if(i!=null){i.addEventListener("frameDrawn",this.handleSetProjectionMatrix)}this.handleSetProjectionMatrix()}render(){return s(n,{key:"ce2867d4a624dabf607b9de837e73a0a0c40eaf9"},s("vertex-viewer-dom-renderer",{key:"7d2dc3d75ca1818ba7b9b292ccbe1db7ac5c7ac8",viewer:this.viewer,drawMode:"2d"},this.pins.map((i=>s("vertex-viewer-pin-group",{id:`pin-group-${i.id}`,"data-is-dom-group-element":true,pin:i,elementBounds:this.elementBounds,pinModel:this.pinModel,pinController:this.pinController,projectionViewMatrix:this.projectionViewMatrix,selected:this.selectedPinId===i.id})))))}setupController(){const i=this.accentColor||this.primaryColor?{accentColor:this.accentColor,primaryColor:this.primaryColor}:undefined;this.pinController=new r(this.pinModel,this.mode,this.tool,i)}clearInteractionHandler(){var i;(i=this.registeredInteractionHandler)===null||i===void 0?void 0:i.then((i=>i.dispose()));this.registeredInteractionHandler=undefined}setupInteractionHandler(){var i;const t=window.getComputedStyle(this.hostEl);const e=t.getPropertyValue("--viewer-pin-tool-initial-label-offset-x").trim();const s=Number.isFinite(Number.parseInt(e))?Number.parseInt(e):20;const n=t.getPropertyValue("--viewer-pin-tool-initial-label-offset-y").trim();const o=Number.isFinite(Number.parseInt(n))?Number.parseInt(n):20;this.clearInteractionHandler();if(this.pinController!=null){this.registeredInteractionHandler=(i=this.viewer)===null||i===void 0?void 0:i.registerInteractionHandler(new x(this.pinController,s,o))}}clearModelListeners(){var i,t,e;(i=this.onEntitiesChangedHandler)===null||i===void 0?void 0:i.dispose();this.onEntitiesChangedHandler=undefined;(t=this.onEntityAddedHandler)===null||t===void 0?void 0:t.dispose();this.onEntityAddedHandler=undefined;(e=this.resizeObserver)===null||e===void 0?void 0:e.disconnect()}updateViewport(){this.elementBounds=m(this.hostEl)}setDepthBuffers(){if(this.pins.length>0&&this.viewer!=null&&this.viewer.depthBuffers==null){this.stateMap.shouldClearDepthBuffers=true;this.viewer.depthBuffers="final"}}resetDepthBuffers(){if(this.stateMap.shouldClearDepthBuffers&&this.viewer!=null){this.viewer.depthBuffers=undefined;this.stateMap.shouldClearDepthBuffers=undefined}}setFeatureMaps(){if((this.pins.length>0||this.mode==="edit")&&this.viewer!=null&&this.viewer.featureMaps==null){this.stateMap.shouldClearFeatureMaps=true;this.viewer.featureMaps="final"}}resetFeatureMaps(){if(this.stateMap.shouldClearFeatureMaps&&this.viewer!=null){this.viewer.featureMaps=undefined;this.stateMap.shouldClearFeatureMaps=undefined}}setCameraAndKeyboardControls(){if(this.mode==="edit"&&this.viewer!=null){if(this.viewer.cameraControls){this.stateMap.shouldClearCameraControls=true;this.viewer.cameraControls=false}if(this.viewer.keyboardControls){this.stateMap.shouldClearKeyboardControls=true;this.viewer.keyboardControls=false}}}resetCameraAndKeyboardControls(){if(this.viewer!=null){if(this.stateMap.shouldClearCameraControls){this.viewer.cameraControls=true;this.stateMap.shouldClearCameraControls=undefined}if(this.stateMap.shouldClearKeyboardControls){this.viewer.keyboardControls=true;this.stateMap.shouldClearKeyboardControls=undefined}}}get hostEl(){return this}static get watchers(){return{mode:[{watchModeChange:0}],tool:[{watchTypeChange:0}],accentColor:[{watchAccentColorChange:0}],primaryColor:[{watchPrimaryColorChange:0}],pins:[{watchPinsChange:0}],viewer:[{handleViewerChanged:0}]}}static get style(){return j()}},[1,"vertex-viewer-pin-tool",{pinController:[1040],pinModel:[16],viewer:[16],tool:[1025],mode:[1025],primaryColor:[1025,"primary-color"],accentColor:[1025,"accent-color"],pins:[32],selectedPinId:[32],elementBounds:[32],projectionViewMatrix:[32]},undefined,{mode:[{watchModeChange:0}],tool:[{watchTypeChange:0}],accentColor:[{watchAccentColorChange:0}],primaryColor:[{watchPrimaryColorChange:0}],pins:[{watchPinsChange:0}],viewer:[{handleViewerChanged:0}]}]);function k(){if(typeof customElements==="undefined"){return}const t=["vertex-viewer-pin-tool","vertex-viewer-dom-element","vertex-viewer-dom-renderer","vertex-viewer-icon","vertex-viewer-pin-group","vertex-viewer-pin-label","vertex-viewer-pin-label-line"];t.forEach((t=>{switch(t){case"vertex-viewer-pin-tool":if(!customElements.get(i(t))){customElements.define(i(t),P)}break;case"vertex-viewer-dom-element":if(!customElements.get(i(t))){w()}break;case"vertex-viewer-dom-renderer":if(!customElements.get(i(t))){C()}break;case"vertex-viewer-icon":if(!customElements.get(i(t))){b()}break;case"vertex-viewer-pin-group":if(!customElements.get(i(t))){y()}break;case"vertex-viewer-pin-label":if(!customElements.get(i(t))){l()}break;case"vertex-viewer-pin-label-line":if(!customElements.get(i(t))){g()}break}}))}k();const E=P;const M=k;export{E as VertexViewerPinTool,M as defineCustomElement};
|
|
5
5
|
//# sourceMappingURL=vertex-viewer-pin-tool.js.map
|
|
@@ -6539,10 +6539,66 @@ function webSocketSubscriptionTransportFactory(options) {
|
|
|
6539
6539
|
}
|
|
6540
6540
|
}
|
|
6541
6541
|
|
|
6542
|
-
|
|
6542
|
+
class InvalidTokenError extends Error {
|
|
6543
|
+
}
|
|
6544
|
+
InvalidTokenError.prototype.name = "InvalidTokenError";
|
|
6545
|
+
function b64DecodeUnicode(str) {
|
|
6546
|
+
return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {
|
|
6547
|
+
let code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
6548
|
+
if (code.length < 2) {
|
|
6549
|
+
code = "0" + code;
|
|
6550
|
+
}
|
|
6551
|
+
return "%" + code;
|
|
6552
|
+
}));
|
|
6553
|
+
}
|
|
6554
|
+
function base64UrlDecode(str) {
|
|
6555
|
+
let output = str.replace(/-/g, "+").replace(/_/g, "/");
|
|
6556
|
+
switch (output.length % 4) {
|
|
6557
|
+
case 0:
|
|
6558
|
+
break;
|
|
6559
|
+
case 2:
|
|
6560
|
+
output += "==";
|
|
6561
|
+
break;
|
|
6562
|
+
case 3:
|
|
6563
|
+
output += "=";
|
|
6564
|
+
break;
|
|
6565
|
+
default:
|
|
6566
|
+
throw new Error("base64 string is not of the correct length");
|
|
6567
|
+
}
|
|
6568
|
+
try {
|
|
6569
|
+
return b64DecodeUnicode(output);
|
|
6570
|
+
}
|
|
6571
|
+
catch (err) {
|
|
6572
|
+
return atob(output);
|
|
6573
|
+
}
|
|
6574
|
+
}
|
|
6575
|
+
function jwtDecode(token, options) {
|
|
6576
|
+
if (typeof token !== "string") {
|
|
6577
|
+
throw new InvalidTokenError("Invalid token specified: must be a string");
|
|
6578
|
+
}
|
|
6579
|
+
options || (options = {});
|
|
6580
|
+
const pos = options.header === true ? 0 : 1;
|
|
6581
|
+
const part = token.split(".")[pos];
|
|
6582
|
+
if (typeof part !== "string") {
|
|
6583
|
+
throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);
|
|
6584
|
+
}
|
|
6585
|
+
let decoded;
|
|
6586
|
+
try {
|
|
6587
|
+
decoded = base64UrlDecode(part);
|
|
6588
|
+
}
|
|
6589
|
+
catch (e) {
|
|
6590
|
+
throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);
|
|
6591
|
+
}
|
|
6592
|
+
try {
|
|
6593
|
+
return JSON.parse(decoded);
|
|
6594
|
+
}
|
|
6595
|
+
catch (e) {
|
|
6596
|
+
throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);
|
|
6597
|
+
}
|
|
6598
|
+
}
|
|
6543
6599
|
|
|
6544
6600
|
function decodeSceneTreeJwt(jwt) {
|
|
6545
|
-
return
|
|
6601
|
+
return jwtDecode(jwt);
|
|
6546
6602
|
}
|
|
6547
6603
|
|
|
6548
6604
|
/**
|
|
@@ -7484,6 +7540,6 @@ SceneTreeController.MAX_GET_TREE_ATTEMPTS = 6;
|
|
|
7484
7540
|
SceneTreeController.GET_TREE_RETRY_DELAYS_IN_MS = [1000, 2000, 4000, 8000, 15000];
|
|
7485
7541
|
|
|
7486
7542
|
export { SceneTreeController as S, SceneTreeErrorCode as a, SceneTreeErrorDetails as b, scene_tree_api_pb_serviceExports as s, webSocketSubscriptionTransportFactory as w };
|
|
7487
|
-
//# sourceMappingURL=controller-
|
|
7543
|
+
//# sourceMappingURL=controller-CE2DwTNf.js.map
|
|
7488
7544
|
|
|
7489
|
-
//# sourceMappingURL=controller-
|
|
7545
|
+
//# sourceMappingURL=controller-CE2DwTNf.js.map
|