@fluid-topics/ft-reader-attachments 1.1.35 → 1.1.37

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.
@@ -13,7 +13,7 @@ export declare class FtReaderAttachments extends FtReaderAttachments_base implem
13
13
  map?: FtMap;
14
14
  attachments?: Array<FtMapAttachment>;
15
15
  constructor();
16
- protected render(): import("lit").TemplateResult<1> | typeof nothing;
16
+ protected render(): typeof nothing | import("lit").TemplateResult<1>;
17
17
  protected update(props: PropertyValues): void;
18
18
  }
19
19
  export {};
@@ -39,23 +39,27 @@ class FtReaderAttachments extends withI18n(FtReaderComponent) {
39
39
  const icon = resolveFileFormatIcon(attachment.mimeType, last(attachment.file.split(".")));
40
40
  const url = attachment.externalLink ? attachment.viewerUrl : (_a = this.service) === null || _a === void 0 ? void 0 : _a.makeAbsolute((_b = attachment.viewerUrl) !== null && _b !== void 0 ? _b : "");
41
41
  return html `
42
- <div part="attachment">
43
- <a part="viewer-link" href="${url}">
44
- <ft-ripple part="ripple viewer-link-ripple"></ft-ripple>
45
- <ft-icon part="file-format-icon"
46
- variant="file-format"
47
- value="${icon}"
48
- style="color: ${(_c = fileFormatColors[icon]) !== null && _c !== void 0 ? _c : fileFormatColors[FtFileFormatIcons.UNKNOWN]}"></ft-icon>
49
- <ft-typography part="name" variant="body2">${attachment.name}</ft-typography>
50
- </a>
51
- <a part="download-link"
52
- href="${(_d = this.service) === null || _d === void 0 ? void 0 : _d.getAttachmentDownloadLink(attachment.id)}"
53
- title="${attachmentsMessages.messages.download(attachment.file)}">
54
- <ft-ripple part="ripple download-link-ripple"></ft-ripple>
55
- <ft-icon part="download-icon">DOWNLOAD</ft-icon>
56
- </a>
57
- </div>
58
- `;
42
+ <div part="attachment">
43
+ <a part="viewer-link" href="${url}">
44
+ <ft-ripple part="ripple viewer-link-ripple"></ft-ripple>
45
+ <ft-icon part="file-format-icon"
46
+ variant="file-format"
47
+ value="${icon}"
48
+ style="color: ${(_c = fileFormatColors[icon]) !== null && _c !== void 0 ? _c : fileFormatColors[FtFileFormatIcons.UNKNOWN]}"></ft-icon>
49
+ <ft-typography part="name" variant="body2">${attachment.name}</ft-typography>
50
+ </a>
51
+ ${attachment.externalLink
52
+ ? nothing
53
+ : html `
54
+ <a part="download-link"
55
+ href="${(_d = this.service) === null || _d === void 0 ? void 0 : _d.getAttachmentDownloadLink(attachment.id)}"
56
+ title="${attachmentsMessages.messages.download(attachment.file)}">
57
+ <ft-ripple part="ripple download-link-ripple"></ft-ripple>
58
+ <ft-icon part="download-icon">DOWNLOAD</ft-icon>
59
+ </a>
60
+ `}
61
+ </div>
62
+ `;
59
63
  })}
60
64
  </div>
61
65
  `;
@@ -375,22 +375,24 @@ const Gt=Symbol.for(""),Mt=t=>{if(t?.r===Gt)return t?._$litStatic$},jt=t=>({_$li
375
375
  `}contentAvailableCallback(t){super.contentAvailableCallback(t),this.rippleEffect&&this.rippleEffect.ontransitionstart!==this.onTransitionStart&&(this.rippleEffect.ontransitionstart=this.onTransitionStart,this.rippleEffect.ontransitionend=this.onTransitionEnd)}update(t){var o,e;super.update(t),t.has("disabled")&&(this.disabled?(this.endRipple(),null===(o=this.target)||void 0===o||o.removeAttribute("data-is-ft-ripple-target")):null===(e=this.target)||void 0===e||e.setAttribute("data-is-ft-ripple-target","true"))}endRipple(){this.endHover(),this.endFocus(),this.endPress(),this.rippling=!1}connectedCallback(){super.connectedCallback(),this.setupDebouncer.run((()=>this.defaultSetup()))}defaultSetup(){var t,o;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.host.parentElement;e&&this.setupFor(null!==(o=this.target)&&void 0!==o?o:e)}setupFor(t){if(this.setupDebouncer.cancel(),this.target===t)return;this.onDisconnect&&this.onDisconnect(),this.target=t,t.setAttribute("data-is-ft-ripple-target","true");const o=(...t)=>o=>{t.forEach((t=>window.addEventListener(t,this.endPress,{once:!0}))),this.startPress(o)},e=o("mouseup","contextmenu"),a=o("touchend","touchcancel"),r=t=>{["Enter"," "].includes(t.key)&&o("keyup")(t)},i={passive:!0};t.addEventListener("mouseover",this.startHover,i),t.addEventListener("mousemove",this.moveRipple,i),t.addEventListener("mouseleave",this.endHover,i),t.addEventListener("mousedown",e,i),t.addEventListener("touchstart",a,i),t.addEventListener("touchmove",this.moveRipple,i),t.addEventListener("keydown",r,i),t.addEventListener("focus",this.startFocus,i),t.addEventListener("blur",this.endFocus,i),t.addEventListener("focusin",this.startFocus,i),t.addEventListener("focusout",this.endFocus,i),this.onDisconnect=()=>{t.removeAttribute("data-is-ft-ripple-target"),t.removeEventListener("mouseover",this.startHover,i),t.removeEventListener("mousemove",this.moveRipple,i),t.removeEventListener("mouseleave",this.endHover,i),t.removeEventListener("mousedown",e,i),t.removeEventListener("touchstart",a,i),t.removeEventListener("touchmove",this.moveRipple,i),t.removeEventListener("keydown",r,i),t.removeEventListener("focus",this.startFocus,i),t.removeEventListener("blur",this.endFocus,i),t.removeEventListener("focusin",this.startFocus,i),t.removeEventListener("focusout",this.endFocus,i),this.onDisconnect=void 0,this.target=void 0}}getCoordinates(t){const o=t,e=t;let a,r;return null!=o.x?({x:a,y:r}=o):null!=e.touches&&(a=e.touches[0].clientX,r=e.touches[0].clientY),{x:a,y:r}}isFocusVisible(t){return!(t instanceof HTMLElement)||t.matches(":focus-visible")}isIgnored(t){if(this.disabled)return!0;if(null!=t)for(let o of t.composedPath()){if(o===this.target)break;if("hasAttribute"in o&&o.hasAttribute("data-is-ft-ripple-target"))return!0}return!1}disconnectedCallback(){super.disconnectedCallback(),this.onDisconnect&&this.onDisconnect(),this.endRipple()}}we.elementDefinitions={},we.styles=y,Se([a.property({type:Boolean})],we.prototype,"primary",void 0),Se([a.property({type:Boolean})],we.prototype,"secondary",void 0),Se([a.property({type:Boolean})],we.prototype,"unbounded",void 0),Se([a.property({type:Boolean})],we.prototype,"activated",void 0),Se([a.property({type:Boolean})],we.prototype,"selected",void 0),Se([a.property({type:Boolean})],we.prototype,"disabled",void 0),Se([a.state()],we.prototype,"hovered",void 0),Se([a.state()],we.prototype,"focused",void 0),Se([a.state()],we.prototype,"pressed",void 0),Se([a.state()],we.prototype,"rippling",void 0),Se([a.state()],we.prototype,"originX",void 0),Se([a.state()],we.prototype,"originY",void 0),Se([a.query(".ft-ripple")],we.prototype,"ripple",void 0),Se([a.query(".ft-ripple--effect")],we.prototype,"rippleEffect",void 0),o.customElement("ft-ripple")(we);var Ce=function(t,o,e,a){for(var r,i=arguments.length,n=i<3?o:null===a?a=Object.getOwnPropertyDescriptor(o,e):a,l=t.length-1;l>=0;l--)(r=t[l])&&(n=(i<3?r(n):i>3?r(o,e,n):r(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class Ie extends(j(w)){constructor(){super(),this.hideFileFormatIcon=!1,this.hideFilename=!1,this.hideDownloadIcon=!1,this.addI18nContext(V,X)}render(){var t,a;if((null!==(a=null===(t=this.attachments)||void 0===t?void 0:t.length)&&void 0!==a?a:0)>0){const t={"hide-file-format-icon":this.hideFileFormatIcon,"hide-filename":this.hideFilename,"hide-download-icon":this.hideDownloadIcon};return e.html`
376
376
  <div part="container" class="${n.classMap(t)}">
377
377
  ${r.repeat(this.attachments,(t=>t.id),(t=>{var a,r,i,n;const l=function(t,o){var e,a,r,i;t=(null!=t?t:"").toLowerCase(),o=(null!=o?o:"").toLowerCase();const[n,l]=((null!==(e=ot.get(t))&&void 0!==e?e:t)+"/").split("/");return null!==(i=null!==(r=null!==(a=tt.get(l))&&void 0!==a?a:tt.get(o))&&void 0!==r?r:tt.get(n))&&void 0!==i?i:Q.UNKNOWN}(t.mimeType,o.last(t.file.split("."))),p=t.externalLink?t.viewerUrl:null===(a=this.service)||void 0===a?void 0:a.makeAbsolute(null!==(r=t.viewerUrl)&&void 0!==r?r:"");return e.html`
378
- <div part="attachment">
379
- <a part="viewer-link" href="${p}">
380
- <ft-ripple part="ripple viewer-link-ripple"></ft-ripple>
381
- <ft-icon part="file-format-icon"
382
- variant="file-format"
383
- value="${l}"
384
- style="color: ${null!==(i=et[l])&&void 0!==i?i:et[Q.UNKNOWN]}"></ft-icon>
385
- <ft-typography part="name" variant="body2">${t.name}</ft-typography>
386
- </a>
387
- <a part="download-link"
388
- href="${null===(n=this.service)||void 0===n?void 0:n.getAttachmentDownloadLink(t.id)}"
389
- title="${V.messages.download(t.file)}">
390
- <ft-ripple part="ripple download-link-ripple"></ft-ripple>
391
- <ft-icon part="download-icon">DOWNLOAD</ft-icon>
392
- </a>
393
- </div>
394
- `}))}
378
+ <div part="attachment">
379
+ <a part="viewer-link" href="${p}">
380
+ <ft-ripple part="ripple viewer-link-ripple"></ft-ripple>
381
+ <ft-icon part="file-format-icon"
382
+ variant="file-format"
383
+ value="${l}"
384
+ style="color: ${null!==(i=et[l])&&void 0!==i?i:et[Q.UNKNOWN]}"></ft-icon>
385
+ <ft-typography part="name" variant="body2">${t.name}</ft-typography>
386
+ </a>
387
+ ${t.externalLink?e.nothing:e.html`
388
+ <a part="download-link"
389
+ href="${null===(n=this.service)||void 0===n?void 0:n.getAttachmentDownloadLink(t.id)}"
390
+ title="${V.messages.download(t.file)}">
391
+ <ft-ripple part="ripple download-link-ripple"></ft-ripple>
392
+ <ft-icon part="download-icon">DOWNLOAD</ft-icon>
393
+ </a>
394
+ `}
395
+ </div>
396
+ `}))}
395
397
  </div>
396
398
  `}return e.nothing}update(t){var o;super.update(t),t.has("map")&&(this.map?null===(o=this.service)||void 0===o||o.getAttachments().then((t=>this.attachments=t)):this.attachments=void 0)}}Ie.elementDefinitions={"ft-icon":it,"ft-ripple":we,"ft-typography":ve},Ie.styles=x,Ce([a.property({type:Boolean})],Ie.prototype,"hideFileFormatIcon",void 0),Ce([a.property({type:Boolean})],Ie.prototype,"hideFilename",void 0),Ce([a.property({type:Boolean})],Ie.prototype,"hideDownloadIcon",void 0),Ce([o.redux({store:"reader"})],Ie.prototype,"map",void 0),Ce([a.state()],Ie.prototype,"attachments",void 0),o.customElement("ft-reader-attachments")(Ie),t.FtReaderAttachments=Ie,t.FtReaderAttachmentsCssVariables=u,t.styles=x}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litRepeat,ftGlobals.litUnsafeHTML,ftGlobals.litClassMap);
@@ -76,7 +76,7 @@ let we=class extends Dt{constructor(){super(...arguments),this.renderOptions={ho
76
76
  * @license
77
77
  * Copyright 2019 Google LLC
78
78
  * SPDX-License-Identifier: BSD-3-Clause
79
- */class Le extends we{createRenderRoot(){const t=this.constructor;t.elementDefinitions&&!t.registry&&(t.registry=new CustomElementRegistry,Object.entries(t.elementDefinitions).forEach((([e,o])=>t.registry.define(e,o))));const e={...t.shadowRootOptions,customElements:t.registry},o=this.renderOptions.creationScope=this.attachShadow(e);return((t,e)=>{$e?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const o=document.createElement("style"),r=We.litNonce;void 0!==r&&o.setAttribute("nonce",r),o.textContent=e.cssText,t.appendChild(o)}))})(o,t.elementStyles),o}}var Ke,Ae=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};const je=Symbol("constructorPrototype"),Fe=Symbol("constructorName"),Ze=Symbol("exportpartsDebouncer");class Me extends Le{constructor(){super(),this[Ke]=new i(5),this[Fe]=this.constructor.name,this[je]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[Fe]&&Object.setPrototypeOf(this,this[je])}updated(t){super.updated(t),setTimeout((()=>{this.contentAvailableCallback(t),this.scheduleExportpartsUpdate()}),0)}contentAvailableCallback(t){var e,o;if((null!==(o=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll(".ft-lit-element--custom-stylesheet"))&&void 0!==o?o:[]).forEach((t=>t.remove())),this.customStylesheet){const t=document.createElement("style");t.classList.add("ft-lit-element--custom-stylesheet"),t.innerHTML=this.customStylesheet,this.shadowRoot.append(t)}}scheduleExportpartsUpdate(){this[Ze].run((()=>{var t;(null===(t=this.exportpartsPrefix)||void 0===t?void 0:t.trim())?this.setExportpartsAttribute([this.exportpartsPrefix]):null!=this.exportpartsPrefixes&&this.exportpartsPrefixes.length>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)}))}setExportpartsAttribute(t){var e,o,r,i,n,a;const s=t=>null!=t&&t.trim().length>0,c=t.filter(s).map((t=>t.trim()));if(0===c.length)return void this.removeAttribute("exportparts");const l=new Set;for(let t of null!==(o=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll("[part],[exportparts]"))&&void 0!==o?o:[]){const e=null!==(i=null===(r=t.getAttribute("part"))||void 0===r?void 0:r.split(" "))&&void 0!==i?i:[],o=null!==(a=null===(n=t.getAttribute("exportparts"))||void 0===n?void 0:n.split(",").map((t=>t.split(":")[1])))&&void 0!==a?a:[];new Array(...e,...o).filter(s).map((t=>t.trim())).forEach((t=>l.add(t)))}if(0===l.size)return void this.removeAttribute("exportparts");const f=[...l.values()].flatMap((t=>c.map((e=>`${t}:${e}--${t}`))));this.setAttribute("exportparts",[...this.part,...f].join(", "))}}Ke=Ze,Ae([R()],Me.prototype,"exportpartsPrefix",void 0),Ae([K([])],Me.prototype,"exportpartsPrefixes",void 0),Ae([R()],Me.prototype,"customStylesheet",void 0);const ze=Ce.create("--ft-utils-highlight-html-background-color","","COLOR","#FFF26E");Ct`
79
+ */class Le extends we{createRenderRoot(){const t=this.constructor;t.elementDefinitions&&!t.registry&&(t.registry=new CustomElementRegistry,Object.entries(t.elementDefinitions).forEach((([e,o])=>t.registry.define(e,o))));const e={...t.shadowRootOptions,customElements:t.registry},o=this.renderOptions.creationScope=this.attachShadow(e);return((t,e)=>{$e?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const o=document.createElement("style"),r=We.litNonce;void 0!==r&&o.setAttribute("nonce",r),o.textContent=e.cssText,t.appendChild(o)}))})(o,t.elementStyles),o}}var Ke,Ae=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};const je=Symbol("constructorPrototype"),Fe=Symbol("constructorName"),Ze=Symbol("exportpartsDebouncer");class Me extends Le{constructor(){super(),this[Ke]=new i(5),this[Fe]=this.constructor.name,this[je]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[Fe]&&Object.setPrototypeOf(this,this[je])}updated(t){super.updated(t),this.updateComplete.then((()=>{this.contentAvailableCallback(t),this.scheduleExportpartsUpdate()}))}contentAvailableCallback(t){var e,o;if((null!==(o=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll(".ft-lit-element--custom-stylesheet"))&&void 0!==o?o:[]).forEach((t=>t.remove())),this.customStylesheet){const t=document.createElement("style");t.classList.add("ft-lit-element--custom-stylesheet"),t.innerHTML=this.customStylesheet,this.shadowRoot.append(t)}}scheduleExportpartsUpdate(){var t,e,o;((null===(t=this.exportpartsPrefix)||void 0===t?void 0:t.trim())||null!==(o=null===(e=this.exportpartsPrefixes)||void 0===e?void 0:e.length)&&void 0!==o&&o)&&this[Ze].run((()=>{var t,e;(null===(t=this.exportpartsPrefix)||void 0===t?void 0:t.trim())?this.setExportpartsAttribute([this.exportpartsPrefix]):null!=this.exportpartsPrefixes&&(null===(e=this.exportpartsPrefixes)||void 0===e?void 0:e.length)>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)}))}setExportpartsAttribute(t){var e,o,r,i,n,a;const s=t=>null!=t&&t.trim().length>0,c=t.filter(s).map((t=>t.trim()));if(0===c.length)return void this.removeAttribute("exportparts");const l=new Set;for(let t of null!==(o=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll("[part],[exportparts]"))&&void 0!==o?o:[]){const e=null!==(i=null===(r=t.getAttribute("part"))||void 0===r?void 0:r.split(" "))&&void 0!==i?i:[],o=null!==(a=null===(n=t.getAttribute("exportparts"))||void 0===n?void 0:n.split(",").map((t=>t.split(":")[1])))&&void 0!==a?a:[];new Array(...e,...o).filter(s).map((t=>t.trim())).forEach((t=>l.add(t)))}if(0===l.size)return void this.removeAttribute("exportparts");const f=[...l.values()].flatMap((t=>c.map((e=>`${t}:${e}--${t}`))));this.setAttribute("exportparts",[...this.part,...f].join(", "))}}Ke=Ze,Ae([R()],Me.prototype,"exportpartsPrefix",void 0),Ae([K([])],Me.prototype,"exportpartsPrefixes",void 0),Ae([R()],Me.prototype,"customStylesheet",void 0);const ze=Ce.create("--ft-utils-highlight-html-background-color","","COLOR","#FFF26E");Ct`
80
80
  .highlight-html-match {
81
81
  background: ${ze};
82
82
  }
@@ -510,22 +510,24 @@ const $a=li(class extends fi{constructor(t){if(super(t),t.type!==si||"class"!==t
510
510
  `}contentAvailableCallback(t){super.contentAvailableCallback(t),this.rippleEffect&&this.rippleEffect.ontransitionstart!==this.onTransitionStart&&(this.rippleEffect.ontransitionstart=this.onTransitionStart,this.rippleEffect.ontransitionend=this.onTransitionEnd)}update(t){var e,o;super.update(t),t.has("disabled")&&(this.disabled?(this.endRipple(),null===(e=this.target)||void 0===e||e.removeAttribute("data-is-ft-ripple-target")):null===(o=this.target)||void 0===o||o.setAttribute("data-is-ft-ripple-target","true"))}endRipple(){this.endHover(),this.endFocus(),this.endPress(),this.rippling=!1}connectedCallback(){super.connectedCallback(),this.setupDebouncer.run((()=>this.defaultSetup()))}defaultSetup(){var t,e;const o=null===(t=this.shadowRoot)||void 0===t?void 0:t.host.parentElement;o&&this.setupFor(null!==(e=this.target)&&void 0!==e?e:o)}setupFor(t){if(this.setupDebouncer.cancel(),this.target===t)return;this.onDisconnect&&this.onDisconnect(),this.target=t,t.setAttribute("data-is-ft-ripple-target","true");const e=(...t)=>e=>{t.forEach((t=>window.addEventListener(t,this.endPress,{once:!0}))),this.startPress(e)},o=e("mouseup","contextmenu"),r=e("touchend","touchcancel"),i=t=>{["Enter"," "].includes(t.key)&&e("keyup")(t)},n={passive:!0};t.addEventListener("mouseover",this.startHover,n),t.addEventListener("mousemove",this.moveRipple,n),t.addEventListener("mouseleave",this.endHover,n),t.addEventListener("mousedown",o,n),t.addEventListener("touchstart",r,n),t.addEventListener("touchmove",this.moveRipple,n),t.addEventListener("keydown",i,n),t.addEventListener("focus",this.startFocus,n),t.addEventListener("blur",this.endFocus,n),t.addEventListener("focusin",this.startFocus,n),t.addEventListener("focusout",this.endFocus,n),this.onDisconnect=()=>{t.removeAttribute("data-is-ft-ripple-target"),t.removeEventListener("mouseover",this.startHover,n),t.removeEventListener("mousemove",this.moveRipple,n),t.removeEventListener("mouseleave",this.endHover,n),t.removeEventListener("mousedown",o,n),t.removeEventListener("touchstart",r,n),t.removeEventListener("touchmove",this.moveRipple,n),t.removeEventListener("keydown",i,n),t.removeEventListener("focus",this.startFocus,n),t.removeEventListener("blur",this.endFocus,n),t.removeEventListener("focusin",this.startFocus,n),t.removeEventListener("focusout",this.endFocus,n),this.onDisconnect=void 0,this.target=void 0}}getCoordinates(t){const e=t,o=t;let r,i;return null!=e.x?({x:r,y:i}=e):null!=o.touches&&(r=o.touches[0].clientX,i=o.touches[0].clientY),{x:r,y:i}}isFocusVisible(t){return!(t instanceof HTMLElement)||t.matches(":focus-visible")}isIgnored(t){if(this.disabled)return!0;if(null!=t)for(let e of t.composedPath()){if(e===this.target)break;if("hasAttribute"in e&&e.hasAttribute("data-is-ft-ripple-target"))return!0}return!1}disconnectedCallback(){super.disconnectedCallback(),this.onDisconnect&&this.onDisconnect(),this.endRipple()}}Ka.elementDefinitions={},Ka.styles=Jr,La([R({type:Boolean})],Ka.prototype,"primary",void 0),La([R({type:Boolean})],Ka.prototype,"secondary",void 0),La([R({type:Boolean})],Ka.prototype,"unbounded",void 0),La([R({type:Boolean})],Ka.prototype,"activated",void 0),La([R({type:Boolean})],Ka.prototype,"selected",void 0),La([R({type:Boolean})],Ka.prototype,"disabled",void 0),La([I()],Ka.prototype,"hovered",void 0),La([I()],Ka.prototype,"focused",void 0),La([I()],Ka.prototype,"pressed",void 0),La([I()],Ka.prototype,"rippling",void 0),La([I()],Ka.prototype,"originX",void 0),La([I()],Ka.prototype,"originY",void 0),La([W(".ft-ripple")],Ka.prototype,"ripple",void 0),La([W(".ft-ripple--effect")],Ka.prototype,"rippleEffect",void 0),L("ft-ripple")(Ka);var Aa=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class ja extends(Zi(ai)){constructor(){super(),this.hideFileFormatIcon=!1,this.hideFilename=!1,this.hideDownloadIcon=!1,this.addI18nContext(_i,Hi)}render(){var t,e;if((null!==(e=null===(t=this.attachments)||void 0===t?void 0:t.length)&&void 0!==e?e:0)>0){const t={"hide-file-format-icon":this.hideFileFormatIcon,"hide-filename":this.hideFilename,"hide-download-icon":this.hideDownloadIcon};return se`
511
511
  <div part="container" class="${$a(t)}">
512
512
  ${mi(this.attachments,(t=>t.id),(t=>{var e,o,r,i;const n=function(t,e){var o,r,i,n;t=(null!=t?t:"").toLowerCase(),e=(null!=e?e:"").toLowerCase();const[a,s]=((null!==(o=Ji.get(t))&&void 0!==o?o:t)+"/").split("/");return null!==(n=null!==(i=null!==(r=Yi.get(s))&&void 0!==r?r:Yi.get(e))&&void 0!==i?i:Yi.get(a))&&void 0!==n?n:Vi.UNKNOWN}(t.mimeType,(a=t.file.split("."))[a.length-1]);var a;const s=t.externalLink?t.viewerUrl:null===(e=this.service)||void 0===e?void 0:e.makeAbsolute(null!==(o=t.viewerUrl)&&void 0!==o?o:"");return se`
513
- <div part="attachment">
514
- <a part="viewer-link" href="${s}">
515
- <ft-ripple part="ripple viewer-link-ripple"></ft-ripple>
516
- <ft-icon part="file-format-icon"
517
- variant="file-format"
518
- value="${n}"
519
- style="color: ${null!==(r=Xi[n])&&void 0!==r?r:Xi[Vi.UNKNOWN]}"></ft-icon>
520
- <ft-typography part="name" variant="body2">${t.name}</ft-typography>
521
- </a>
522
- <a part="download-link"
523
- href="${null===(i=this.service)||void 0===i?void 0:i.getAttachmentDownloadLink(t.id)}"
524
- title="${_i.messages.download(t.file)}">
525
- <ft-ripple part="ripple download-link-ripple"></ft-ripple>
526
- <ft-icon part="download-icon">DOWNLOAD</ft-icon>
527
- </a>
528
- </div>
529
- `}))}
513
+ <div part="attachment">
514
+ <a part="viewer-link" href="${s}">
515
+ <ft-ripple part="ripple viewer-link-ripple"></ft-ripple>
516
+ <ft-icon part="file-format-icon"
517
+ variant="file-format"
518
+ value="${n}"
519
+ style="color: ${null!==(r=Xi[n])&&void 0!==r?r:Xi[Vi.UNKNOWN]}"></ft-icon>
520
+ <ft-typography part="name" variant="body2">${t.name}</ft-typography>
521
+ </a>
522
+ ${t.externalLink?le:se`
523
+ <a part="download-link"
524
+ href="${null===(i=this.service)||void 0===i?void 0:i.getAttachmentDownloadLink(t.id)}"
525
+ title="${_i.messages.download(t.file)}">
526
+ <ft-ripple part="ripple download-link-ripple"></ft-ripple>
527
+ <ft-icon part="download-icon">DOWNLOAD</ft-icon>
528
+ </a>
529
+ `}
530
+ </div>
531
+ `}))}
530
532
  </div>
531
533
  `}return le}update(t){var e;super.update(t),t.has("map")&&(this.map?null===(e=this.service)||void 0===e||e.getAttachments().then((t=>this.attachments=t)):this.attachments=void 0)}}ja.elementDefinitions={"ft-icon":en,"ft-ripple":Ka,"ft-typography":Wa},ja.styles=ei,Aa([R({type:Boolean})],ja.prototype,"hideFileFormatIcon",void 0),Aa([R({type:Boolean})],ja.prototype,"hideFilename",void 0),Aa([R({type:Boolean})],ja.prototype,"hideDownloadIcon",void 0),Aa([Be({store:"reader"})],ja.prototype,"map",void 0),Aa([I()],ja.prototype,"attachments",void 0),L("ft-reader-attachments")(ja),t.FtReaderAttachments=ja,t.FtReaderAttachmentsCssVariables=ti,t.styles=ei}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-attachments",
3
- "version": "1.1.35",
3
+ "version": "1.1.37",
4
4
  "description": "Reader component to list map attachments",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,15 +19,15 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-app-context": "1.1.35",
23
- "@fluid-topics/ft-i18n": "1.1.35",
24
- "@fluid-topics/ft-icon": "1.1.35",
25
- "@fluid-topics/ft-reader-context": "1.1.35",
26
- "@fluid-topics/ft-ripple": "1.1.35",
27
- "@fluid-topics/ft-typography": "1.1.35",
28
- "@fluid-topics/ft-wc-utils": "1.1.35",
22
+ "@fluid-topics/ft-app-context": "1.1.37",
23
+ "@fluid-topics/ft-i18n": "1.1.37",
24
+ "@fluid-topics/ft-icon": "1.1.37",
25
+ "@fluid-topics/ft-reader-context": "1.1.37",
26
+ "@fluid-topics/ft-ripple": "1.1.37",
27
+ "@fluid-topics/ft-typography": "1.1.37",
28
+ "@fluid-topics/ft-wc-utils": "1.1.37",
29
29
  "@fluid-topics/public-api": "1.0.59",
30
30
  "lit": "3.1.0"
31
31
  },
32
- "gitHead": "f44f1bd5f035f2c52dd91ceed0b9c6bf06580b81"
32
+ "gitHead": "a2f1f35da13aa0735c3765b8149fc7564593a7ed"
33
33
  }