@qaecy/cue-ui 0.0.5 → 0.0.6

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.
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[741],{1741(O,v,o){o.r(v),o.d(v,{DocumentViewer:()=>j});var p=o(467),y=o(9769),c=o(5802),d=o(7705),f=o(2271),s=o(5547),m=o(7885),P=o(8807),D=o(2065);const M=["*"];let R=(()=>{class r{width=(0,d.hFB)("auto");height=(0,d.hFB)("auto");style=(0,d.hFB)("");getStyles=(0,f.EW)(()=>this.style());static \u0275fac=function(t){return new(t||r)};static \u0275cmp=s.VBU({type:r,selectors:[["cue-container"]],hostVars:6,hostBindings:function(t,i){2&t&&(s.Aen(i.getStyles()),s.xc7("max-width",i.width())("max-height",i.height()))},inputs:{width:[1,"width"],height:[1,"height"],style:[1,"style"]},ngContentSelectors:M,decls:1,vars:0,template:function(t,i){1&t&&(s.NAR(),s.SdG(0))},styles:["[_nghost-%COMP%]{display:flex;align-items:stretch;container-name:cue-container;container-type:inline-size}[_nghost-%COMP%] > *[_ngcontent-%COMP%]{flex:1;max-width:100%}"]})}return r})();var w=o(2245),C=o(5381),N=o(1696),B=o(3319),I=o(5448),S=o(2014),V=o(3191);let T=(()=>{class r{searchService=(0,c.WQX)(V.g);entityBeingPlaced=(0,c.vPA)(void 0);confirmedPlacement=(0,c.vPA)(void 0);rdfBaseURL=(0,c.vPA)("");contentUUID=(0,c.vPA)("");activePdfDoc=(0,c.vPA)(null);currentPage=(0,c.vPA)(1);requestedPage=(0,c.vPA)(null);navigateToPage(e){this.currentPage.set(e),this.requestedPage.set(e)}entityTextSearchResults=(0,c.vPA)([]);entityTextSearchResultsOnCurrentPage=(0,f.EW)(()=>this.entityTextSearchResults().filter(e=>e.page===this.currentPage()));currentPlacementBbox=(0,c.vPA)(null);categoryPreviewBoxes=(0,c.vPA)([]);_lastMatchIndex=(0,c.vPA)(null);matchCycleDisplay=(0,f.EW)(()=>{const e=this._lastMatchIndex(),t=this.entityTextSearchResultsOnCurrentPage().length;return null===e||0===t?"":`${e+1}/${t}`});cycleTextMatch(){const e=this.entityTextSearchResultsOnCurrentPage();if(!e.length)return;const t=this._lastMatchIndex(),i=null===t?0:(t+1)%e.length;this._lastMatchIndex.set(i);const n=e[i].xywhStr.replace("percent:",""),[h,g,a,u]=n.split(",").map(Number),b=Math.max(0,h-.5),x=Math.max(0,g-.5),$=Math.min(100-b,a+1),U=Math.min(100-x,u+1);this.currentPlacementBbox.set({xywhStr:`percent:${b.toFixed(2)},${x.toFixed(2)},${$.toFixed(2)},${U.toFixed(2)}`,color:"rgba(255, 160, 0, 0.9)",allowRemove:!1})}setManualBbox(e){this._lastMatchIndex.set(null),this.currentPlacementBbox.set({...e,allowRemove:!1})}clearPlacement(){this.currentPlacementBbox.set(null),this._lastMatchIndex.set(null)}constructor(){(0,c.QZP)(()=>{const e=this.entityBeingPlaced(),t=this.activePdfDoc();e?.value&&t?this.searchService.searchAll(t,e.value).then(i=>{this.entityTextSearchResults.set(i)}):this.entityTextSearchResults.set([])}),(0,c.QZP)(()=>{this.currentPage(),this._lastMatchIndex.set(null),this.currentPlacementBbox.set(null)}),(0,c.QZP)(()=>{const e=this.entityBeingPlaced();this._lastMatchIndex.set(null),void 0===e&&this.currentPlacementBbox.set(null)})}static \u0275fac=function(t){return new(t||r)};static \u0275prov=c.jDH({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var F=o(4015);const A=["viewerTarget"];function E(r,Q){if(1&r){const e=s.RV6();s.j41(0,"cue-flexcontainer",2)(1,"cue-typography"),s.EFF(2),s.nI1(3,"transloco"),s.k0s(),s.j41(4,"cue-button",3),s.bIt("click",function(){c.eBV(e);const i=s.XpG();return c.Njj(i.downloadFile())}),s.j41(5,"cue-button-padder"),s.nrm(6,"cue-button-icon",4),s.k0s(),s.j41(7,"cue-button-label"),s.EFF(8),s.nI1(9,"transloco"),s.k0s()()()}2&r&&(s.R7$(2),s.JRh(s.bMT(3,2,"components.documentViewer.infoNoViewer")),s.R7$(6),s.JRh(s.bMT(9,4,"common.buttons.download")))}let j=(()=>{class r{_eps=(0,c.WQX)(T);url=d.hFB.required();suffix=(0,d.hFB)();settings=(0,d.hFB)(new m.DocumentViewerSettings);interactions=(0,d.CGW)();viewerType=(0,f.EW)(()=>{const e=this.url(),t=void 0!==this.suffix()?this.suffix()?.trim():`.${e.split(".").pop()?.trim()}`,i=t?m.extViewerMap.get(t):void 0;if(console.log("[DocumentViewer] viewerType resolved",{url:e?.substring(0,80),suffix:t,viewerType:i}),void 0!==t)return i});currentComponent=(0,c.vPA)(null);noViewer=(0,f.EW)(()=>null===this.currentComponent());viewerTarget;currentRef;_interactionsState=(0,c.vPA)(new m.DocumentViewerInteractions);constructor(){(0,c.QZP)(()=>{const e=this.viewerType(),t=this.url();e?("pdf"!==e&&this._eps.activePdfDoc.set(null),this.loadViewerComponent(e,t,this.settings())):(this.viewerTarget.clear(),this.currentRef?.destroy(),this.currentRef=void 0,console.info("No viewer available for this file type"),this.currentComponent.set(null),this._eps.activePdfDoc.set(null))}),(0,c.QZP)(()=>{this.interactions.emit(this._interactionsState())}),(0,c.QZP)(()=>{const e=this.settings().pdf,t=this.currentRef;t&&t.setInput("settings",e)})}loadViewerComponent(e,t,i){var n=this;return(0,p.A)(function*(){console.log("[DocumentViewer] loadViewerComponent",{viewerType:e,url:t?.substring(0,100)});try{const h=m.viewerComponents[e],g=yield h();if(n.currentComponent.set(g),n.viewerTarget.clear(),n.currentRef?.destroy(),n.currentRef=n.viewerTarget.createComponent(g),"pdf"===e)n.currentRef.setInput("src",t),void 0!==i?.pdf&&n.currentRef.setInput("settings",i.pdf),n.currentRef.instance.pdfLoaded&&n.currentRef.instance.pdfLoaded.subscribe(a=>{n._eps.currentPage.set(1),n._eps.activePdfDoc.set(a)}),n.currentRef.instance.settingsChange&&n.currentRef.instance.settingsChange.subscribe(a=>{const u=parseInt(a?.page,10);!isNaN(u)&&u>0&&n._eps.currentPage.set(u)}),n.currentRef.instance.artefactDrawn&&n.currentRef.instance.artefactDrawn.subscribe(a=>{"xywh"===a.type&&n._eps.setManualBbox(a.def)}),n.currentRef.instance.artefactEdited&&n.currentRef.instance.artefactEdited.subscribe(a=>{"bbox"===a.type&&n._eps.setManualBbox(a.after)});else if("bim"===e){const a=new P.di("model","Model",t);a.visible=!0,n.currentRef.setInput("data",{models:[a]}),void 0!==i?.bim&&n.currentRef.setInput("settings",i.bim),n.currentRef.instance.selectedElements&&n.currentRef.instance.selectedElements.subscribe(u=>{n._interactionsState.update(l=>(l.bim.selectedElements=u,Object.assign({},l)))}),n.currentRef.instance.clickedElement&&n.currentRef.instance.clickedElement.subscribe(u=>{n._interactionsState.update(l=>(l.bim.clickedElement=u,Object.assign({},l)))})}else if("cad"===e)n.currentRef.setInput("fileURL",t),void 0!==i?.cad&&n.currentRef.setInput("settings",i.cad);else if("image"===e)n.currentRef.setInput("src",t);else if("markdown"===e)n.currentRef.setInput("fileURL",t);else if("text"===e)n.currentRef.setInput("fileURL",t);else if("spreadsheet"===e){const a=n.suffix()?.split(".").pop()||t.split(".").pop()||"csv";n.currentRef.setInput("data",{url:t,format:a})}}catch(h){console.error("Failed to load viewer component:",h),n.currentComponent.set(null)}})()}downloadFile(){var e=this;return(0,p.A)(function*(){const i=yield(yield fetch(e.url())).blob();(0,D.KE)(i,`document${e.suffix()??""}`)})()}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=s.VBU({type:r,selectors:[["cue-document-viewer"]],viewQuery:function(t,i){if(1&t&&s.GBs(A,7,s.c1b),2&t){let n;s.mGM(n=s.lsd())&&(i.viewerTarget=n.first)}},inputs:{url:[1,"url"],suffix:[1,"suffix"],settings:[1,"settings"]},outputs:{interactions:"interactions"},decls:4,vars:1,consts:[["viewerTarget",""],[2,"height","100%","width","100%"],["direction","column","align","center","justify","center",2,"height","100%","width","100%"],[3,"click"],["icon","download"]],template:function(t,i){1&t&&(s.j41(0,"cue-container",1),s.eu8(1,null,0),s.nVh(3,E,10,6,"cue-flexcontainer",2),s.k0s()),2&t&&(s.R7$(3),s.vxM(i.noViewer()?3:-1))},dependencies:[y.MD,R,w.o,C.n,N.$,B.a,I.L,S.z,F.Kj],styles:["[_nghost-%COMP%]{display:contents}"],changeDetection:0})}return r})()}}]);
1
+ "use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[741],{1741(O,v,o){o.r(v),o.d(v,{DocumentViewer:()=>j});var p=o(467),y=o(9769),c=o(5802),d=o(7705),f=o(2271),s=o(5547),g=o(7885),P=o(8807),D=o(2065);const M=["*"];let R=(()=>{class r{width=(0,d.hFB)("auto");height=(0,d.hFB)("auto");style=(0,d.hFB)("");getStyles=(0,f.EW)(()=>this.style());static \u0275fac=function(t){return new(t||r)};static \u0275cmp=s.VBU({type:r,selectors:[["cue-container"]],hostVars:6,hostBindings:function(t,i){2&t&&(s.Aen(i.getStyles()),s.xc7("max-width",i.width())("max-height",i.height()))},inputs:{width:[1,"width"],height:[1,"height"],style:[1,"style"]},ngContentSelectors:M,decls:1,vars:0,template:function(t,i){1&t&&(s.NAR(),s.SdG(0))},styles:["[_nghost-%COMP%]{display:flex;align-items:stretch;container-name:cue-container;container-type:inline-size}[_nghost-%COMP%] > *[_ngcontent-%COMP%]{flex:1;max-width:100%}"]})}return r})();var w=o(2245),C=o(5381),N=o(1696),B=o(3319),I=o(5448),S=o(2014),V=o(3191);let T=(()=>{class r{searchService=(0,c.WQX)(V.g);entityBeingPlaced=(0,c.vPA)(void 0);confirmedPlacement=(0,c.vPA)(void 0);rdfBaseURL=(0,c.vPA)("");contentUUID=(0,c.vPA)("");activePdfDoc=(0,c.vPA)(null);currentPage=(0,c.vPA)(1);requestedPage=(0,c.vPA)(null);navigateToPage(e){this.currentPage.set(e),this.requestedPage.set(e)}entityTextSearchResults=(0,c.vPA)([]);entityTextSearchResultsOnCurrentPage=(0,f.EW)(()=>this.entityTextSearchResults().filter(e=>e.page===this.currentPage()));currentPlacementBbox=(0,c.vPA)(null);categoryPreviewBoxes=(0,c.vPA)([]);_lastMatchIndex=(0,c.vPA)(null);matchCycleDisplay=(0,f.EW)(()=>{const e=this._lastMatchIndex(),t=this.entityTextSearchResultsOnCurrentPage().length;return null===e||0===t?"":`${e+1}/${t}`});cycleTextMatch(){const e=this.entityTextSearchResultsOnCurrentPage();if(!e.length)return;const t=this._lastMatchIndex(),i=null===t?0:(t+1)%e.length;this._lastMatchIndex.set(i);const n=e[i].xywhStr.replace("percent:",""),[h,m,a,u]=n.split(",").map(Number),b=Math.max(0,h-.5),x=Math.max(0,m-.5),$=Math.min(100-b,a+1),U=Math.min(100-x,u+1);this.currentPlacementBbox.set({xywhStr:`percent:${b.toFixed(2)},${x.toFixed(2)},${$.toFixed(2)},${U.toFixed(2)}`,color:"rgba(255, 160, 0, 0.9)",allowRemove:!1})}setManualBbox(e){this._lastMatchIndex.set(null),this.currentPlacementBbox.set({...e,allowRemove:!1})}clearPlacement(){this.currentPlacementBbox.set(null),this._lastMatchIndex.set(null)}constructor(){(0,c.QZP)(()=>{const e=this.entityBeingPlaced(),t=this.activePdfDoc();e?.value&&t?this.searchService.searchAll(t,e.value).then(i=>{this.entityTextSearchResults.set(i)}):this.entityTextSearchResults.set([])}),(0,c.QZP)(()=>{this.currentPage(),this._lastMatchIndex.set(null),this.currentPlacementBbox.set(null)}),(0,c.QZP)(()=>{const e=this.entityBeingPlaced();this._lastMatchIndex.set(null),void 0===e&&this.currentPlacementBbox.set(null)})}static \u0275fac=function(t){return new(t||r)};static \u0275prov=c.jDH({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var F=o(4015);const A=["viewerTarget"];function E(r,Q){if(1&r){const e=s.RV6();s.j41(0,"cue-flexcontainer",2)(1,"cue-typography"),s.EFF(2),s.nI1(3,"transloco"),s.k0s(),s.j41(4,"cue-button",3),s.bIt("click",function(){c.eBV(e);const i=s.XpG();return c.Njj(i.downloadFile())}),s.j41(5,"cue-button-padder"),s.nrm(6,"cue-button-icon",4),s.k0s(),s.j41(7,"cue-button-label"),s.EFF(8),s.nI1(9,"transloco"),s.k0s()()()}2&r&&(s.R7$(2),s.JRh(s.bMT(3,2,"components.documentViewer.infoNoViewer")),s.R7$(6),s.JRh(s.bMT(9,4,"common.buttons.download")))}let j=(()=>{class r{_eps=(0,c.WQX)(T);url=d.hFB.required();suffix=(0,d.hFB)();settings=(0,d.hFB)(new g.DocumentViewerSettings);interactions=(0,d.CGW)();viewerType=(0,f.EW)(()=>{const e=this.url(),t=void 0!==this.suffix()?this.suffix()?.trim():`.${e.split(".").pop()?.trim()}`,i=t?g.extViewerMap.get(t):void 0;if(console.log("[DocumentViewer] viewerType resolved",{url:e?.substring(0,80),suffix:t,viewerType:i}),void 0!==t)return i});currentComponent=(0,c.vPA)(null);noViewer=(0,f.EW)(()=>null===this.currentComponent());viewerTarget;currentRef;_interactionsState=(0,c.vPA)(new g.DocumentViewerInteractions);constructor(){(0,c.QZP)(()=>{const e=this.viewerType(),t=this.url();e?("pdf"!==e&&this._eps.activePdfDoc.set(null),this.loadViewerComponent(e,t,this.settings())):(this.viewerTarget.clear(),this.currentRef?.destroy(),this.currentRef=void 0,console.info("No viewer available for this file type"),this.currentComponent.set(null),this._eps.activePdfDoc.set(null))}),(0,c.QZP)(()=>{this.interactions.emit(this._interactionsState())}),(0,c.QZP)(()=>{const e=this.settings().pdf,t=this.currentRef;t&&t.setInput("settings",e)})}loadViewerComponent(e,t,i){var n=this;return(0,p.A)(function*(){console.log("[DocumentViewer] loadViewerComponent",{viewerType:e,url:t?.substring(0,100)});try{const h=g.viewerComponents[e],m=yield h();if(n.currentComponent.set(m),n.viewerTarget.clear(),n.currentRef?.destroy(),n.currentRef=n.viewerTarget.createComponent(m),"pdf"===e)n.currentRef.setInput("src",t),void 0!==i?.pdf&&n.currentRef.setInput("settings",i.pdf),n.currentRef.instance.pdfLoaded&&n.currentRef.instance.pdfLoaded.subscribe(a=>{n._eps.currentPage.set(1),n._eps.activePdfDoc.set(a)}),n.currentRef.instance.settingsChange&&n.currentRef.instance.settingsChange.subscribe(a=>{const u=parseInt(a?.page,10);!isNaN(u)&&u>0&&n._eps.currentPage.set(u)}),n.currentRef.instance.artefactDrawn&&n.currentRef.instance.artefactDrawn.subscribe(a=>{"xywh"===a.type&&n._eps.setManualBbox(a.def)}),n.currentRef.instance.artefactEdited&&n.currentRef.instance.artefactEdited.subscribe(a=>{"bbox"===a.type&&n._eps.setManualBbox(a.after)});else if("bim"===e){const a=new P.di("model","Model",t);a.visible=!0,n.currentRef.setInput("data",{models:[a]}),void 0!==i?.bim&&n.currentRef.setInput("settings",i.bim),n.currentRef.instance.selectedElements&&n.currentRef.instance.selectedElements.subscribe(u=>{n._interactionsState.update(l=>(l.bim.selectedElements=u,Object.assign({},l)))}),n.currentRef.instance.clickedElement&&n.currentRef.instance.clickedElement.subscribe(u=>{n._interactionsState.update(l=>(l.bim.clickedElement=u,Object.assign({},l)))})}else if("cad"===e)n.currentRef.setInput("fileURL",t),void 0!==i?.cad&&n.currentRef.setInput("settings",i.cad);else if("image"===e)n.currentRef.setInput("src",t);else if("markdown"===e)n.currentRef.setInput("fileURL",t);else if("text"===e)n.currentRef.setInput("fileURL",t);else if("spreadsheet"===e){const a=n.suffix()?.split(".").pop()||t.split(".").pop()||"csv";n.currentRef.setInput("data",{url:t,format:a})}}catch(h){console.error("Failed to load viewer component:",h),n.currentComponent.set(null)}})()}downloadFile(){var e=this;return(0,p.A)(function*(){const i=yield(yield fetch(e.url())).blob();(0,D.KE)(i,`document${e.suffix()??""}`)})()}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=s.VBU({type:r,selectors:[["cue-doc-viewer"]],viewQuery:function(t,i){if(1&t&&s.GBs(A,7,s.c1b),2&t){let n;s.mGM(n=s.lsd())&&(i.viewerTarget=n.first)}},inputs:{url:[1,"url"],suffix:[1,"suffix"],settings:[1,"settings"]},outputs:{interactions:"interactions"},decls:4,vars:1,consts:[["viewerTarget",""],[2,"height","100%","width","100%"],["direction","column","align","center","justify","center",2,"height","100%","width","100%"],[3,"click"],["icon","download"]],template:function(t,i){1&t&&(s.j41(0,"cue-container",1),s.eu8(1,null,0),s.nVh(3,E,10,6,"cue-flexcontainer",2),s.k0s()),2&t&&(s.R7$(3),s.vxM(i.noViewer()?3:-1))},dependencies:[y.MD,R,w.o,C.n,N.$,B.a,I.L,S.z,F.Kj],styles:["[_nghost-%COMP%]{display:contents}"],changeDetection:0})}return r})()}}]);
@@ -198,7 +198,7 @@
198
198
  min-height: 0;
199
199
  }
200
200
 
201
- cue-document-list-wc#sidebar-document-list {
201
+ cue-document-list#sidebar-document-list {
202
202
  display: block;
203
203
  width: 100%;
204
204
  height: 100%;
@@ -247,7 +247,7 @@
247
247
  position: relative;
248
248
  }
249
249
 
250
- cue-document-viewer-wc {
250
+ cue-document-viewer {
251
251
  display: block;
252
252
  height: 100%;
253
253
  width: 100%;
@@ -326,7 +326,7 @@
326
326
  </select>
327
327
  <div class="section-label">Documents</div>
328
328
  <div id="sidebar-document-list-wrap">
329
- <cue-document-list-wc id="sidebar-document-list"></cue-document-list-wc>
329
+ <cue-document-list id="sidebar-document-list"></cue-document-list>
330
330
  </div>
331
331
  <button id="shuffle-btn">&#8635; Shuffle 5 documents</button>
332
332
  </aside>
@@ -349,7 +349,7 @@
349
349
  font-family: monospace;
350
350
  ">
351
351
  <h2 style="margin-top: 0">Angular Bootstrap Failed</h2>
352
- <p>The cue-document-viewer-wc web component failed to initialize.</p>
352
+ <p>The cue-document-viewer web component failed to initialize.</p>
353
353
  <pre id="bootstrap-error-details" style="background: #333; padding: 12px; border-radius: 4px; overflow-x: auto"></pre>
354
354
  <p style="margin-bottom: 0; opacity: 0.9">
355
355
  Check the browser console (F12) for more details.
@@ -362,13 +362,13 @@
362
362
  // the custom element by then, it failed to bootstrap.
363
363
  window.addEventListener('load', () => {
364
364
  setTimeout(() => {
365
- if (customElements.get('cue-document-viewer-wc')) {
366
- console.log('[demo] ✓ cue-document-viewer-wc registered OK');
365
+ if (customElements.get('cue-document-viewer')) {
366
+ console.log('[demo] ✓ cue-document-viewer registered OK');
367
367
  } else {
368
368
  const errorMsg =
369
369
  'Angular failed to bootstrap. Check the Network tab for failed script loads (runtime.js / polyfills.js / main.js).';
370
370
  console.error(
371
- '[demo] ✗ cue-document-viewer-wc NOT registered after 4 s.\n' + errorMsg
371
+ '[demo] ✗ cue-document-viewer NOT registered after 4 s.\n' + errorMsg
372
372
  );
373
373
 
374
374
  // Display error on page
@@ -449,7 +449,7 @@
449
449
  // ── Sidebar document list ─────────────────────────────
450
450
  async function renderFileList(docs) {
451
451
  shownDocs = docs;
452
- await customElements.whenDefined('cue-document-list-wc');
452
+ await customElements.whenDefined('cue-document-list');
453
453
  const list = sidebarList();
454
454
  if (!list) return;
455
455
 
@@ -477,14 +477,14 @@
477
477
  if (oldWrapper) oldWrapper.remove();
478
478
  viewer = null;
479
479
 
480
- await customElements.whenDefined('cue-document-viewer-wc');
480
+ await customElements.whenDefined('cue-document-viewer');
481
481
 
482
482
  // Wrap in a div because :host{display:contents} removes the
483
483
  // custom element from the box model — the wrapper owns the size.
484
484
  const wrapper = document.createElement('div');
485
485
  wrapper.id = 'viewer-wrapper';
486
486
 
487
- viewer = document.createElement('cue-document-viewer-wc');
487
+ viewer = document.createElement('cue-document-viewer');
488
488
 
489
489
  // CRITICAL: Append to DOM FIRST before setting inputs.
490
490
  // Angular needs to initialize the element in the DOM context
@@ -572,10 +572,10 @@
572
572
  }
573
573
  });
574
574
 
575
- customElements.whenDefined('cue-document-list-wc').then(() => {
575
+ customElements.whenDefined('cue-document-list').then(() => {
576
576
  const list = sidebarList();
577
577
  if (!list) return;
578
- debug('custom element ready', { id: 'cue-document-list-wc' });
578
+ debug('custom element ready', { id: 'cue-document-list' });
579
579
  list.simple = true;
580
580
  list.pageSize = 5;
581
581
  list.prefetchPages = 3;