hypothesis 1.1461.0 → 1.1462.0
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/build/boot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?
|
|
1
|
+
!function(){"use strict";var s={"scripts/annotator.bundle.js":"scripts/annotator.bundle.js?a35462","styles/annotator.css":"styles/annotator.css?ec72d0","styles/annotator.css.map":"styles/annotator.css.map?de3818","styles/highlights.css":"styles/highlights.css?6b4ebd","styles/highlights.css.map":"styles/highlights.css.map?241350","styles/katex.min.css":"styles/katex.min.css?e179ab","styles/katex.min.css.map":"styles/katex.min.css.map?cd8c0e","styles/pdfjs-overrides.css":"styles/pdfjs-overrides.css?c95edf","styles/pdfjs-overrides.css.map":"styles/pdfjs-overrides.css.map?1d8ac6","styles/sidebar.css":"styles/sidebar.css?13d728","styles/sidebar.css.map":"styles/sidebar.css.map?1984a9","styles/ui-playground.css":"styles/ui-playground.css?db6174","styles/ui-playground.css.map":"styles/ui-playground.css.map?ec0173","scripts/ui-playground.bundle.js":"scripts/ui-playground.bundle.js?d0b7a0","scripts/sidebar.bundle.js":"scripts/sidebar.bundle.js?a1481b","scripts/annotator.bundle.js.map":"scripts/annotator.bundle.js.map?0e1727","scripts/ui-playground.bundle.js.map":"scripts/ui-playground.bundle.js.map?ce6c89","scripts/sidebar.bundle.js.map":"scripts/sidebar.bundle.js.map?0cd446"};function t(s){s.setAttribute("data-hypothesis-asset","")}function e(s,e){var n=s.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=e,t(n),s.head.appendChild(n)}function n(s,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.esModule,o=void 0===r||r,i=n.forceReload,a=void 0!==i&&i,l=s.createElement("script");o&&(l.type="module"),a&&(e+="#ts=".concat(Date.now())),l.src=e,l.async=!1,t(l),s.head.appendChild(l)}function r(s,e,n,r){var o=s.createElement("link");o.rel=e,o.href=r,o.type="application/annotator+".concat(n),t(o),s.head.appendChild(o)}function o(s,e,n){var r=s.createElement("link");r.rel="preload",r.as=e,r.href=n,"fetch"===e&&(r.crossOrigin="anonymous"),t(r),s.head.appendChild(r)}function i(s,t){return s.assetRoot+"build/"+s.manifest[t]}function a(s){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(-1===s.indexOf("{"))return s;var e=function(){var s,t,e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:document).currentScript;return e?(s=e.src,(t=s.match(/(https?):\/\/([^:/]+)/))?{protocol:t[1],hostname:t[2]}:null):null}(t);if(!e)throw new Error("Could not process URL template because script origin is unknown");return s=(s=s.replace("{current_host}",e.hostname)).replace("{current_scheme}",e.protocol)}if(function(){var s=[function(){return Object.fromEntries([])},function(){return new URL(document.location.href)},function(){return new Request("https://hypothes.is")},function(){return Element.prototype.attachShadow},function(){return CSS.supports("display: grid")},function(){return document.evaluate("/html/body",document,null,XPathResult.ANY_TYPE,null),!0}];try{return s.every((function(s){return s()}))}catch(s){return!1}}()){var l=function(s){for(var t={},e=s.querySelectorAll("script.js-hypothesis-config"),n=0;n<e.length;n++){var r=void 0;try{r=JSON.parse(e[n].textContent||"")}catch(s){console.warn("Could not parse settings from js-hypothesis-config tags",s),r={}}Object.assign(t,r)}return t}(document),c=a(l.assetRoot||"https://cdn.hypothes.is/hypothesis/1.1462.0/");if(document.querySelector("hypothesis-app")){!function(s,t){o(s,"fetch",t.apiUrl),o(s,"fetch",t.apiUrl+"links");for(var r=0,a=["scripts/sidebar.bundle.js"];r<a.length;r++)n(s,i(t,a[r]),{esModule:!0});for(var l=0,c=["styles/katex.min.css","styles/sidebar.css"];l<c.length;l++)e(s,i(t,c[l]))}(document,{assetRoot:c,manifest:s,apiUrl:l.apiUrl})}else{var p=function(){var s;return null===(s=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).chrome)||void 0===s||null===(s=s.runtime)||void 0===s?void 0:s.id}();if(p&&!function(s){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:document).querySelector("script.js-hypothesis-config[data-extension-id=".concat(s,"]"))}(p))throw new Error("Could not start Hypothesis extension as configuration is missing");var u=l,d=a(u.notebookAppUrl||"https://hypothes.is/notebook"),h=a(u.profileAppUrl||"https://hypothes.is/user-profile"),y=a(u.sidebarAppUrl||"https://hypothes.is/app.html");!function(s,t){if(!s.querySelector('link[type="application/annotator+html"]')){r(s,"sidebar","html",t.sidebarAppUrl),r(s,"notebook","html",t.notebookAppUrl),r(s,"profile","html",t.profileAppUrl),o(s,"style",i(t,"styles/annotator.css")),r(s,"hypothesis-client","javascript",t.assetRoot+"build/boot.js");for(var a=0,l=["scripts/annotator.bundle.js"];a<l.length;a++)n(s,i(t,l[a]),{esModule:!1});var c=[];void 0!==window.PDFViewerApplication&&c.push("styles/pdfjs-overrides.css"),c.push("styles/highlights.css");for(var p=0,u=c;p<u.length;p++)e(s,i(t,u[p]))}}(document,{assetRoot:c,manifest:s,notebookAppUrl:d,profileAppUrl:h,sidebarAppUrl:y})}}else console.warn("The Hypothesis annotation tool is not supported in this browser. See https://web.hypothes.is/help/which-browsers-are-supported-by-hypothesis/.")}();
|
package/build/manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?
|
|
2
|
+
"scripts/annotator.bundle.js": "scripts/annotator.bundle.js?a35462",
|
|
3
3
|
"styles/annotator.css": "styles/annotator.css?ec72d0",
|
|
4
4
|
"styles/annotator.css.map": "styles/annotator.css.map?de3818",
|
|
5
5
|
"styles/highlights.css": "styles/highlights.css?6b4ebd",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"styles/sidebar.css.map": "styles/sidebar.css.map?1984a9",
|
|
13
13
|
"styles/ui-playground.css": "styles/ui-playground.css?db6174",
|
|
14
14
|
"styles/ui-playground.css.map": "styles/ui-playground.css.map?ec0173",
|
|
15
|
-
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?832608",
|
|
16
15
|
"scripts/ui-playground.bundle.js": "scripts/ui-playground.bundle.js?d0b7a0",
|
|
17
|
-
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?
|
|
18
|
-
"scripts/
|
|
19
|
-
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?ce6c89"
|
|
16
|
+
"scripts/sidebar.bundle.js": "scripts/sidebar.bundle.js?a1481b",
|
|
17
|
+
"scripts/annotator.bundle.js.map": "scripts/annotator.bundle.js.map?0e1727",
|
|
18
|
+
"scripts/ui-playground.bundle.js.map": "scripts/ui-playground.bundle.js.map?ce6c89",
|
|
19
|
+
"scripts/sidebar.bundle.js.map": "scripts/sidebar.bundle.js.map?0cd446"
|
|
20
20
|
}
|
|
@@ -140,7 +140,7 @@ this._sidebarRPC.on("scrollToAnnotation",(t=>{this._scrollToAnnotation(t)})),thi
|
|
|
140
140
|
this._selectionObserver.disconnect(),this._adder.destroy(),this._bucketBarClient.destroy(),null===(t=this._clusterToolbar)||void 0===t||t.destroy(),null===(e=this._outsideAssignmentNotice)||void 0===e||e.destroy(),function(t){ti(Array.from(t.querySelectorAll("hypothesis-highlight")))}(this.element),this._integration.destroy()}async anchor(t){this._contentReady&&(await this._contentReady,this._contentReady=void 0);const e=t=>{var e;const n=vr(t);if(!n)return;const i=Qn(n,null===(e=t.annotation)||void 0===e?void 0:e.$cluster);i.forEach((e=>{e._annotation=t.annotation})),t.highlights=i,this._hoveredAnnotations.has(t.annotation.$tag)&&ei(i,!0)};this.detach(t.$tag,!1),this._annotations.add(t.$tag),t.target||(t.target=[]);const n=await Promise.all(t.target.map((async e=>{if(!e.selector||!e.selector.some((t=>"TextQuoteSelector"===t.type)))return{annotation:t,target:e};let n;try{const i=await this._integration.anchor(this.element,e.selector),o=Un.fromRange(i);n={annotation:t,target:e,range:o}}catch(i){n={
|
|
141
141
|
annotation:t,target:e}}return n})));if(!this._annotations.has(t.$tag))return[];for(const t of n)e(t);return t.$orphan=n.length>0&&n.every((t=>t.target.selector&&!t.range)),this._updateAnchors(this.anchors.concat(n),!0),this._sidebarRPC.call("syncAnchoringStatus",t),n}detach(t,e=!0){this._annotations.delete(t);const n=[];for(const e of this.anchors)e.annotation.$tag!==t?n.push(e):e.highlights&&ti(e.highlights);this._updateAnchors(n,e)}_updateAnchors(t,e){var n;this.anchors=t,null===(n=this._clusterToolbar)||void 0===n||n.scheduleClusterUpdates(),e&&this._bucketBarClient.update(this.anchors)}async createAnnotation({highlight:t=!1}={}){const e=this.selectedRanges;this.selectedRanges=[];const n=await this.getDocumentInfo(),i=this.element,o=(await Promise.all(e.map((t=>this._integration.describe(i,t))))).map((t=>({source:n.uri,selector:t}))),r={uri:n.uri,document:n.metadata,target:o,$highlight:t,$cluster:t?"user-highlights":"user-annotations",$tag:"a:"+s(8)};return this._sidebarRPC.call("createAnnotation",r),
|
|
142
142
|
this.anchor(r),br(),r}_hoverAnnotations(t){this._hoveredAnnotations.clear(),t.forEach((t=>this._hoveredAnnotations.add(t)));for(const e of this.anchors)if(e.highlights){const n=t.includes(e.annotation.$tag);ei(e.highlights,n)}this._sidebarRPC.call("hoverAnnotations",t)}_onSelection(t){const e=this._integration.getAnnotatableRange(t);if(!e)return void this._onClearSelection();const n=document.getSelection(),i=jn(n),o=Gn(n);o?(this.selectedRanges=[e],this._hostRPC.call("textSelected"),this._adder.annotationsForSelection=gr(),this._isAdderVisible=!0,this._adder.show(o,i)):this._onClearSelection()}_onClearSelection(){this._isAdderVisible=!1,this._adder.hide(),this.selectedRanges=[],this._informHostOnNextSelectionClear&&this._hostRPC.call("textUnselected"),this._informHostOnNextSelectionClear=!0}selectAnnotations(t,{toggle:e=!1,focusInSidebar:n=!1}={}){e?this._sidebarRPC.call("toggleAnnotationSelection",t):this._sidebarRPC.call("showAnnotations",t,n),this._sidebarRPC.call("openSidebar")}
|
|
143
|
-
setHighlightsVisible(t,e=!0){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t,e&&this._hostRPC.call("highlightsVisibleChanged",t)}get highlightsVisible(){return this._highlightsVisible}fitSideBySide(t){this._sidebarLayout=t,this._integration.fitSideBySide(t)}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){le(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}_setOutsideAssignmentNoticeVisible(t){this._outsideAssignmentNotice||(this._outsideAssignmentNotice=new fr(this.element)),this._outsideAssignmentNotice.setVisible(t)}}function xr(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function Cr(t,e){var n;const i={};for(const[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.
|
|
143
|
+
setHighlightsVisible(t,e=!0){!function(t,e){t.classList.toggle("hypothesis-highlights-always-on",e)}(this.element,t),this._highlightsVisible=t,e&&this._hostRPC.call("highlightsVisibleChanged",t)}get highlightsVisible(){return this._highlightsVisible}fitSideBySide(t){this._sidebarLayout=t,this._integration.fitSideBySide(t)}get hoveredAnnotationTags(){return this._hoveredAnnotations}_handleShortcut(t){le(t,"Ctrl+Shift+H")&&this.setHighlightsVisible(!this._highlightsVisible)}_setOutsideAssignmentNoticeVisible(t){this._outsideAssignmentNotice||(this._outsideAssignmentNotice=new fr(this.element)),this._outsideAssignmentNotice.setVisible(t)}}function xr(t,e){const n=new URL(t),i=new URLSearchParams;return i.append("config",JSON.stringify(e)),n.hash=i.toString(),n.toString()}function Cr(t,e){var n;const i={};for(const[t,n]of Object.entries(e))"notebookAppUrl"!==t&&"sidebarAppUrl"!==t&&null!=n&&(i[t]=n);i.origin=new URL(t).origin,i.version="1.1462.0";const o=new URL(window.location.href);if(o.hash="",
|
|
144
144
|
i.hostURL=o.toString(),Array.isArray(i.services)&&(null===(n=i.services)||void 0===n?void 0:n.length)>0){const t=i.services[0];t.onLoginRequest&&(t.onLoginRequestProvided=!0),t.onLogoutRequest&&(t.onLogoutRequestProvided=!0),t.onSignupRequest&&(t.onSignupRequestProvided=!0),t.onProfileRequest&&(t.onProfileRequestProvided=!0),t.onHelpRequest&&(t.onHelpRequestProvided=!0)}return i}function Sr({closed:t,onClose:e,children:n,"data-testid":i}){const o=Kt(null);return Yt((()=>{var e,n;t?null===(e=o.current)||void 0===e||e.close():null===(n=o.current)||void 0===n||n.showModal()}),[t]),Yt((()=>{const t=o.current;return null==t||t.addEventListener("cancel",e),()=>{null==t||t.removeEventListener("cancel",e)}}),[e]),we("dialog",{ref:o,className:"relative w-full h-full backdrop:bg-black/50","data-testid":i,children:n})}function Nr({closed:t,children:e,...n}){return we("div",{...n,className:be("fixed z-max top-0 left-0 right-0 bottom-0 p-3 bg-black/50",{hidden:t}),children:we("div",{className:"relative w-full h-full",
|
|
145
145
|
children:e})})}function Er({document_:t=document,...e}){return we(Zt((()=>function(t){return"function"==typeof t.createElement("dialog").showModal}(t)?Sr:Nr),[t]),{...e})}function Ar({config:t,groupId:e}){return we("iframe",{title:"Hypothesis annotation notebook",className:"h-full w-full border-0",allow:"fullscreen; clipboard-write",src:xr(t.notebookAppUrl,{...Cr(t.notebookAppUrl,t),group:e})})}function Tr({eventBus:t,config:e}){const[n,i]=Xt(0),[o,r]=Xt(!0),[s,a]=Xt(null),l=Kt(""),c=Kt(null);Yt((()=>(l.current=document.body.style.overflow,()=>{document.body.style.overflow=l.current})),[]),Yt((()=>{document.body.style.overflow=o?l.current:"hidden"}),[o]),Yt((()=>{const e=t.createEmitter();return e.subscribe("openNotebook",(t=>{r(!1),i((t=>t+1)),a(t)})),c.current=e,()=>{e.destroy()}}),[t]);const h=Qt((()=>{var t;r(!0),null===(t=c.current)||void 0===t||t.publish("closeNotebook")}),[]);return null===s?null:we(Er,{closed:o,onClose:h,"data-testid":"notebook-outer",children:[we("div",{
|
|
146
146
|
className:"absolute right-0 m-3",children:we(an,{title:"Close the Notebook",onClick:h,variant:"dark",classes:be("!bg-transparent enabled:hover:!bg-grey-3"),"data-testid":"close-button",children:we(ke,{className:"w-4 h-4"})})}),we(Ar,{config:e,groupId:s},n)]})}class kr{constructor(t,e,n){i(this,"_container",void 0),this._container=new kn("notebook",(()=>we(Tr,{eventBus:e,config:n}))),t.append(this._container.element),this._container.render()}destroy(){this._container.destroy()}}function Rr({eventBus:t,config:e}){const[n,i]=Xt(!0),o=Kt(null);Yt((()=>{const e=t.createEmitter();return e.subscribe("openProfile",(()=>{i(!1)})),o.current=e,()=>{e.destroy()}}),[t]);const r=()=>{var t;i(!0),null===(t=o.current)||void 0===t||t.publish("closeProfile")};return n?null:we(Er,{closed:n,onClose:r,"data-testid":"profile-outer",children:[we("div",{className:"absolute right-0 m-3",children:we(an,{title:"Close profile dialog",onClick:r,variant:"dark",classes:be("!bg-transparent enabled:hover:!bg-grey-3"),children:we(ke,{
|
|
@@ -172,7 +172,7 @@ const[e,n]=Xt([]),i=Qt((t=>n((e=>[...e,t]))),[]),o=Qt((t=>n((e=>e.filter((e=>e.i
|
|
|
172
172
|
classes:be("transition-colors focus-visible-ring ring-inset","w-[27px] h-[27px] mt-[140px] ml-px-1.5","flex items-center justify-center bg-white border","text-grey-6 hover:text-grey-9 transition-colors","border-r-0","shadow-sidebar"),title:"Close annotation sidebar",onClick:t,unstyled:!0,children:we(ke,{})}),!c&&we(ht,{children:[we(on,{classes:be("transition-colors focus-visible-ring ring-inset","h-[40px] w-[33px] pl-[6px] rounded-bl","bg-white text-grey-5 hover:text-grey-9","border-l border-b"),elementRef:l,title:"Annotation sidebar",expanded:n,"aria-controls":i,onClick:a,unstyled:!0,children:we(n?Le:Me,{})}),we("div",{className:"space-y-px-1.5 mt-px-2",children:[we(Dr,{title:"Show highlights",icon:r?en:Ue,pressed:r,onClick:s}),we(Dr,{title:"note"===o?"New page note":"New annotation",icon:"note"===o?Ge:Ae,onClick:e})]}),we(Fr,{highlightsVisible:r})]})]})}class Vr{constructor(t,e){i(this,"_container",void 0),i(this,"_newAnnotationType",void 0),i(this,"_useMinimalControls",void 0),
|
|
173
173
|
i(this,"_highlightsVisible",void 0),i(this,"_sidebarOpen",void 0),i(this,"_sidebarContainerId",void 0),i(this,"_closeSidebar",void 0),i(this,"_toggleSidebar",void 0),i(this,"_toggleHighlights",void 0),i(this,"_createAnnotation",void 0),i(this,"_sidebarToggleButton",void 0);const{createAnnotation:n,setSidebarOpen:o,setHighlightsVisible:r}=e;this._container=t,this._useMinimalControls=!1,this._newAnnotationType="note",this._highlightsVisible=!1,this._sidebarOpen=!1,this._sidebarContainerId=e.sidebarContainerId,this._closeSidebar=()=>o(!1),this._toggleSidebar=()=>o(!this._sidebarOpen),this._toggleHighlights=()=>r(!this._highlightsVisible),this._createAnnotation=()=>{n(),o(!0)},this._sidebarToggleButton={current:null},this.render()}getWidth(){return this._container.firstChild.getBoundingClientRect().width}set useMinimalControls(t){this._useMinimalControls=t,this.render()}get useMinimalControls(){return this._useMinimalControls}set sidebarOpen(t){this._sidebarOpen=t,this.render()}get sidebarOpen(){
|
|
174
174
|
return this._sidebarOpen}set newAnnotationType(t){this._newAnnotationType=t,this.render()}get newAnnotationType(){return this._newAnnotationType}set highlightsVisible(t){this._highlightsVisible=t,this.render()}get highlightsVisible(){return this._highlightsVisible}get sidebarToggleButton(){return this._sidebarToggleButton.current}render(){Rt(we(Hr,{closeSidebar:this._closeSidebar,createAnnotation:this._createAnnotation,newAnnotationType:this._newAnnotationType,isSidebarOpen:this._sidebarOpen,sidebarContainerId:this._sidebarContainerId,showHighlights:this._highlightsVisible,toggleHighlights:this._toggleHighlights,toggleSidebar:this._toggleSidebar,toggleSidebarRef:this._sidebarToggleButton,useMinimalControls:this.useMinimalControls}),this._container)}}const Ur=280;class qr{constructor(t,e,n){var r;if(i(this,"_emitter",void 0),i(this,"_config",void 0),i(this,"_listeners",void 0),i(this,"_gestureState",void 0),i(this,"_layoutState",void 0),i(this,"_hammerManager",void 0),i(this,"_hypothesisSidebar",void 0),
|
|
175
|
-
i(this,"_messagesElement",void 0),i(this,"_toolbarWidth",void 0),i(this,"_renderFrame",void 0),i(this,"_guestWithSelection",void 0),i(this,"_sidebarRPC",void 0),i(this,"_guestRPC",void 0),i(this,"bucketBar",void 0),i(this,"features",void 0),i(this,"externalFrame",void 0),i(this,"iframeContainer",void 0),i(this,"toolbar",void 0),i(this,"onLoginRequest",void 0),i(this,"onLogoutRequest",void 0),i(this,"onSignupRequest",void 0),i(this,"onProfileRequest",void 0),i(this,"onHelpRequest",void 0),i(this,"onLayoutChange",void 0),i(this,"iframe",void 0),this._emitter=e.createEmitter(),this._guestWithSelection=null,this._guestRPC=[],this._sidebarRPC=new C,this.iframe=function(t){const e=t.sidebarAppUrl,n=xr(e,Cr(e,t)),i=document.createElement("iframe");return i.src=n,i.title="Hypothesis annotation viewer",i.className="sidebar-frame",i.allow="fullscreen; clipboard-write",Object.defineProperty(i,"allow",{
|
|
175
|
+
i(this,"_messagesElement",void 0),i(this,"_toolbarWidth",void 0),i(this,"_renderFrame",void 0),i(this,"_guestWithSelection",void 0),i(this,"_sidebarRPC",void 0),i(this,"_guestRPC",void 0),i(this,"bucketBar",void 0),i(this,"features",void 0),i(this,"externalFrame",void 0),i(this,"iframeContainer",void 0),i(this,"toolbar",void 0),i(this,"onLoginRequest",void 0),i(this,"onLogoutRequest",void 0),i(this,"onSignupRequest",void 0),i(this,"onProfileRequest",void 0),i(this,"onHelpRequest",void 0),i(this,"onLayoutChange",void 0),i(this,"iframe",void 0),this._emitter=e.createEmitter(),this._guestWithSelection=null,this._guestRPC=[],this._sidebarRPC=new C,this.iframe=function(t){const e=t.sidebarAppUrl,n=xr(e,Cr(e,t)),i=document.createElement("iframe");return i.src=n,i.title="Hypothesis annotation viewer",i.className="sidebar-frame",i.allow="fullscreen; clipboard-write",Object.defineProperty(i,"allow",{set:()=>{}})}(n),this._config=n,this.bucketBar=null,this.features=new fi,n.externalContainerSelector){var s
|
|
176
176
|
;this.externalFrame=null!==(s=document.querySelector(n.externalContainerSelector))&&void 0!==s?s:t,this.externalFrame.appendChild(this.iframe)}else{if(this.iframeContainer=document.createElement("div"),this.iframeContainer.style.display="none",this.iframeContainer.className="sidebar-container",this.iframeContainer.id="sidebar-container","clean"===n.theme)this.iframeContainer.classList.add("theme-clean");else{let t;n.bucketContainerSelector&&(t=document.querySelector(n.bucketContainerSelector),t||console.warn(`Custom bucket container "${n.bucketContainerSelector}" not found`));const e=document.createElement("div");e.setAttribute("data-testid","sidebar-edge"),e.className=be("absolute top-0 bottom-0 w-[23px] left-[-22px]","flex flex-col pt-[110px] pr-[5px]","bg-grey-2 sidebar-collapsed:bg-black/[.08]","pointer-events-none"),this.iframeContainer.append(e),t||(t=e),this.bucketBar=new Lr(t,{onFocusAnnotations:t=>this._guestRPC.forEach((e=>e.call("hoverAnnotations",t))),
|
|
177
177
|
onScrollToAnnotation:t=>this._guestRPC.forEach((e=>e.call("scrollToAnnotation",t))),onSelectAnnotations:(t,e)=>this._guestRPC.forEach((n=>n.call("selectAnnotations",t,e)))})}this.iframeContainer.appendChild(this.iframe),this._hypothesisSidebar=document.createElement("hypothesis-sidebar");const e=Tn(this._hypothesisSidebar);e.appendChild(this.iframeContainer),t.appendChild(this._hypothesisSidebar),this._messagesElement=document.createElement("div"),e.appendChild(this._messagesElement),Rt(we(Br,{emitter:this._emitter}),this._messagesElement)}this.iframe.contentWindow&&g(this.iframe.contentWindow),this._listeners=new o;const a=document.createElement("div");this.toolbar=new Vr(a,{sidebarContainerId:null===(r=this.iframeContainer)||void 0===r?void 0:r.id,createAnnotation:()=>{var t;if(0===this._guestRPC.length)return;(null!==(t=this._guestWithSelection)&&void 0!==t?t:this._guestRPC[0]).call("createAnnotation")},setSidebarOpen:t=>t?this.open():this.close(),setHighlightsVisible:t=>this.setHighlightsVisible(t)}),
|
|
178
178
|
"clean"===n.theme?this.toolbar.useMinimalControls=!0:this.toolbar.useMinimalControls=!1,this.iframeContainer?(this.iframeContainer.prepend(a),this._toolbarWidth=this.toolbar.getWidth()):this._toolbarWidth=0,this._listeners.add(window,"resize",(()=>this._onResize())),this._gestureState={initial:null,final:null},this._setupGestures(),this.close();const[l]=n.services||[];l&&(this.onLoginRequest=l.onLoginRequest,this.onLogoutRequest=l.onLogoutRequest,this.onSignupRequest=l.onSignupRequest,this.onProfileRequest=l.onProfileRequest,this.onHelpRequest=l.onHelpRequest),this.onLayoutChange=n.onLayoutChange,this._layoutState={expanded:!1,width:0,height:0,toolbarWidth:0},this._updateLayoutState(!1),this._setupSidebarEvents()}destroy(){var t,e;this._guestRPC.forEach((t=>t.destroy())),this._sidebarRPC.destroy(),null===(t=this.bucketBar)||void 0===t||t.destroy(),this._listeners.removeAll(),null===(e=this._hammerManager)||void 0===e||e.destroy(),this._hypothesisSidebar?(Rt(null,this._messagesElement),
|