@kubex/zinc 1.1.41 → 1.1.43
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/custom-elements.json +5 -4
- package/dist/vscode.html-custom-data.json +1 -1
- package/dist/web-types.json +3 -3
- package/dist/zn.d.ts +6 -1
- package/dist/zn.min.js +6 -5
- package/package.json +1 -1
- package/src/components/chat-message-attachment/chat-message-attachment.component.ts +7 -2
- package/src/components/chat-message-attachment/chat-message-attachment.test.ts +14 -1
- package/src/components/editor/modules/dialog/dialog.component.ts +3 -2
- package/src/components/editor/modules/dialog/dialog.scss +1 -1
- package/src/components/editor/modules/toolbar/toolbar.ts +1 -1
|
@@ -3933,8 +3933,9 @@
|
|
|
3933
3933
|
"text": "string"
|
|
3934
3934
|
},
|
|
3935
3935
|
"default": "'_blank'",
|
|
3936
|
-
"description": "Where to open the link. Defaults to a new tab.",
|
|
3937
|
-
"attribute": "target"
|
|
3936
|
+
"description": "Where to open the link. Defaults to a new tab. Reflected so the console's\npagelet link interception (`[href]:not([target])`) skips the host and the\nbrowser handles the click natively (download / new tab) instead of\nloading the file URL as a pagelet.",
|
|
3937
|
+
"attribute": "target",
|
|
3938
|
+
"reflects": true
|
|
3938
3939
|
},
|
|
3939
3940
|
{
|
|
3940
3941
|
"kind": "field",
|
|
@@ -3981,7 +3982,7 @@
|
|
|
3981
3982
|
"text": "string"
|
|
3982
3983
|
},
|
|
3983
3984
|
"default": "'_blank'",
|
|
3984
|
-
"description": "Where to open the link. Defaults to a new tab.",
|
|
3985
|
+
"description": "Where to open the link. Defaults to a new tab. Reflected so the console's\npagelet link interception (`[href]:not([target])`) skips the host and the\nbrowser handles the click natively (download / new tab) instead of\nloading the file URL as a pagelet.",
|
|
3985
3986
|
"fieldName": "target"
|
|
3986
3987
|
},
|
|
3987
3988
|
{
|
|
@@ -40175,7 +40176,7 @@
|
|
|
40175
40176
|
"package": {
|
|
40176
40177
|
"name": "@kubex/zinc",
|
|
40177
40178
|
"description": "A collection of web components for building web applications based off of @shoelace-style/Shoelace",
|
|
40178
|
-
"version": "1.1.
|
|
40179
|
+
"version": "1.1.43",
|
|
40179
40180
|
"author": "",
|
|
40180
40181
|
"license": "MIT"
|
|
40181
40182
|
}
|
|
@@ -535,7 +535,7 @@
|
|
|
535
535
|
},
|
|
536
536
|
{
|
|
537
537
|
"name": "target",
|
|
538
|
-
"description": "Where to open the link. Defaults to a new tab.",
|
|
538
|
+
"description": "Where to open the link. Defaults to a new tab. Reflected so the console's\npagelet link interception (`[href]:not([target])`) skips the host and the\nbrowser handles the click natively (download / new tab) instead of\nloading the file URL as a pagelet.",
|
|
539
539
|
"values": []
|
|
540
540
|
},
|
|
541
541
|
{
|
package/dist/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"name": "@kubex/zinc",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.43",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -1097,7 +1097,7 @@
|
|
|
1097
1097
|
},
|
|
1098
1098
|
{
|
|
1099
1099
|
"name": "target",
|
|
1100
|
-
"description": "Where to open the link. Defaults to a new tab.",
|
|
1100
|
+
"description": "Where to open the link. Defaults to a new tab. Reflected so the console's\npagelet link interception (`[href]:not([target])`) skips the host and the\nbrowser handles the click natively (download / new tab) instead of\nloading the file URL as a pagelet.",
|
|
1101
1101
|
"value": { "type": "string", "default": "'_blank'" }
|
|
1102
1102
|
},
|
|
1103
1103
|
{
|
|
@@ -1132,7 +1132,7 @@
|
|
|
1132
1132
|
},
|
|
1133
1133
|
{
|
|
1134
1134
|
"name": "target",
|
|
1135
|
-
"description": "Where to open the link. Defaults to a new tab.",
|
|
1135
|
+
"description": "Where to open the link. Defaults to a new tab. Reflected so the console's\npagelet link interception (`[href]:not([target])`) skips the host and the\nbrowser handles the click natively (download / new tab) instead of\nloading the file URL as a pagelet.",
|
|
1136
1136
|
"type": "string"
|
|
1137
1137
|
},
|
|
1138
1138
|
{
|
package/dist/zn.d.ts
CHANGED
|
@@ -1627,7 +1627,12 @@ declare module "components/chat-message-attachment/chat-message-attachment.compo
|
|
|
1627
1627
|
name: string;
|
|
1628
1628
|
/** The leading icon name. */
|
|
1629
1629
|
icon: string;
|
|
1630
|
-
/**
|
|
1630
|
+
/**
|
|
1631
|
+
* Where to open the link. Defaults to a new tab. Reflected so the console's
|
|
1632
|
+
* pagelet link interception (`[href]:not([target])`) skips the host and the
|
|
1633
|
+
* browser handles the click natively (download / new tab) instead of
|
|
1634
|
+
* loading the file URL as a pagelet.
|
|
1635
|
+
*/
|
|
1631
1636
|
target: string;
|
|
1632
1637
|
/** Prompt a download rather than navigating to the link. */
|
|
1633
1638
|
download: boolean;
|
package/dist/zn.min.js
CHANGED
|
@@ -251,7 +251,7 @@ import{a as _n,b as R1,c as nr,d as c,e as B}from"./chunks/zn.UBLZO6CI.js";var Z
|
|
|
251
251
|
<zn-icon part="icon" class="paperclip@lu" src=${this.icon} size="20"></zn-icon>`:W}
|
|
252
252
|
<span part="label" class="attachment__label"><slot>${this.name}</slot></span>
|
|
253
253
|
</a>
|
|
254
|
-
`}};Qr.styles=T(hb),Qr.dependencies={"zn-icon":ct},c([p()],Qr.prototype,"href",2),c([p()],Qr.prototype,"name",2),c([p()],Qr.prototype,"icon",2),c([p()],Qr.prototype,"target",2),c([p({type:Boolean})],Qr.prototype,"download",2);var kS=Qr;Qr.define("zn-chat-message-attachment");var ub=A`@keyframes rotate-gradient{from{--rotate:0deg}to{--rotate:360deg}}:host{text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-transform:none}:host *,:host *::before,:host *::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:rgb(var(--zn-border-color))}[hidden]{display:none !important}.width-container,.form-container,.wide-form-container{height:100%;width:100%;margin:var(--zn-default-margin,0 auto)}.width-container{max-width:var(--zn-container)}.form-container{max-width:var(--zn-container-ph)}.wide-form-container{max-width:var(--zn-container-lg)}:host{display:inline-block;vertical-align:middle}.chip{display:inline-flex;font-size:var(--zn-text-chip-font-size);font-family:var(--zn-font-family-sans);font-weight:var(--zn-text-chip-font-weight);border-radius:var(--zn-border-radius-small);padding-inline:var(--zn-spacing-x-small);padding-block:0;height:var(--zn-spacing-medium);text-align:center;gap:var(--zn-spacing-x-small);width:-moz-fit-content;width:fit-content;justify-content:center;align-items:center;line-height:var(--zn-text-chip-line-height);letter-spacing:var(--zn-letter-spacing-loose);white-space:nowrap}.chip--flush{padding:0;height:auto}.chip--flush-x{padding-inline:0}.chip--flush-y{padding-block:0;height:auto}.chip--primary{color:rgba(var(--zn-primary),0.9);background:rgba(var(--zn-primary),0.1)}.chip--error{color:rgb(var(--zn-color-error));background:rgba(var(--zn-color-error),0.1)}.chip--info{color:rgb(var(--zn-color-info));background:rgba(var(--zn-color-info),0.1)}.chip--warning{color:rgb(var(--zn-color-warning));background:rgba(var(--zn-color-warning),0.1)}.chip--success{color:rgb(var(--zn-color-success));background:rgba(var(--zn-color-success),0.1)}.chip--neutral{color:rgb(var(--zn-text));background:rgba(var(--zn-border-color),0.1)}.chip--transparent{color:rgb(var(--zn-text));background:transparent}.chip--custom{color:rgb(var(--zn-text));background-color:hsl(from var(--chip-color-override,inherit) h s l/0.1)}.chip__value{overflow:hidden;text-overflow:ellipsis;text-transform:var(--zn-text-chip-transform)}.chip__caption{opacity:0.7;font-weight:var(--zn-text-chip-font-weight);text-transform:var(--zn-text-chip-transform)}.chip__caption::after{content:":"}.chip--no-content{padding:var(--zn-spacing-3x-small) var(--zn-spacing-2x-small)}.chip--with-icon{padding-left:var(--zn-spacing-2x-small)}`;var Mr=class extends C{constructor(){super(...arguments);this.icon="";this.caption="";this.iconSize=18;this.type="neutral";this.flush=!1;this.flushX=!1;this.flushY=!1;this.hasSlotController=new J(this,"[default]","action")}render(){let t=this.hasSlotController.test("[default]");return u`
|
|
254
|
+
`}};Qr.styles=T(hb),Qr.dependencies={"zn-icon":ct},c([p()],Qr.prototype,"href",2),c([p()],Qr.prototype,"name",2),c([p()],Qr.prototype,"icon",2),c([p({reflect:!0})],Qr.prototype,"target",2),c([p({type:Boolean})],Qr.prototype,"download",2);var kS=Qr;Qr.define("zn-chat-message-attachment");var ub=A`@keyframes rotate-gradient{from{--rotate:0deg}to{--rotate:360deg}}:host{text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-transform:none}:host *,:host *::before,:host *::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:rgb(var(--zn-border-color))}[hidden]{display:none !important}.width-container,.form-container,.wide-form-container{height:100%;width:100%;margin:var(--zn-default-margin,0 auto)}.width-container{max-width:var(--zn-container)}.form-container{max-width:var(--zn-container-ph)}.wide-form-container{max-width:var(--zn-container-lg)}:host{display:inline-block;vertical-align:middle}.chip{display:inline-flex;font-size:var(--zn-text-chip-font-size);font-family:var(--zn-font-family-sans);font-weight:var(--zn-text-chip-font-weight);border-radius:var(--zn-border-radius-small);padding-inline:var(--zn-spacing-x-small);padding-block:0;height:var(--zn-spacing-medium);text-align:center;gap:var(--zn-spacing-x-small);width:-moz-fit-content;width:fit-content;justify-content:center;align-items:center;line-height:var(--zn-text-chip-line-height);letter-spacing:var(--zn-letter-spacing-loose);white-space:nowrap}.chip--flush{padding:0;height:auto}.chip--flush-x{padding-inline:0}.chip--flush-y{padding-block:0;height:auto}.chip--primary{color:rgba(var(--zn-primary),0.9);background:rgba(var(--zn-primary),0.1)}.chip--error{color:rgb(var(--zn-color-error));background:rgba(var(--zn-color-error),0.1)}.chip--info{color:rgb(var(--zn-color-info));background:rgba(var(--zn-color-info),0.1)}.chip--warning{color:rgb(var(--zn-color-warning));background:rgba(var(--zn-color-warning),0.1)}.chip--success{color:rgb(var(--zn-color-success));background:rgba(var(--zn-color-success),0.1)}.chip--neutral{color:rgb(var(--zn-text));background:rgba(var(--zn-border-color),0.1)}.chip--transparent{color:rgb(var(--zn-text));background:transparent}.chip--custom{color:rgb(var(--zn-text));background-color:hsl(from var(--chip-color-override,inherit) h s l/0.1)}.chip__value{overflow:hidden;text-overflow:ellipsis;text-transform:var(--zn-text-chip-transform)}.chip__caption{opacity:0.7;font-weight:var(--zn-text-chip-font-weight);text-transform:var(--zn-text-chip-transform)}.chip__caption::after{content:":"}.chip--no-content{padding:var(--zn-spacing-3x-small) var(--zn-spacing-2x-small)}.chip--with-icon{padding-left:var(--zn-spacing-2x-small)}`;var Mr=class extends C{constructor(){super(...arguments);this.icon="";this.caption="";this.iconSize=18;this.type="neutral";this.flush=!1;this.flushX=!1;this.flushY=!1;this.hasSlotController=new J(this,"[default]","action")}render(){let t=this.hasSlotController.test("[default]");return u`
|
|
255
255
|
<div class="${N({chip:!0,"chip--with-content":t,"chip--no-content":!t,"chip--with-icon":this.icon,"chip--flush":this.flush,"chip--flush-x":this.flushX,"chip--flush-y":this.flushY,"chip--info":this.type==="info","chip--success":this.type==="success","chip--warning":this.type==="warning","chip--error":this.type==="error","chip--primary":this.type==="primary","chip--transparent":this.type==="transparent","chip--custom":this.type==="custom","chip--neutral":this.type==="neutral"})}">
|
|
256
256
|
${this.icon?u`
|
|
257
257
|
<zn-icon src="${this.icon}" size="${this.iconSize}"></zn-icon>`:""}
|
|
@@ -2936,7 +2936,7 @@ ${ua(this.code(r,t))}
|
|
|
2936
2936
|
`)!==`
|
|
2937
2937
|
`&&(this._quill.insertText(o,`
|
|
2938
2938
|
`,st.sources.USER),o+=1),this._quill.insertEmbed(o,"hr",!0,st.sources.USER),this._quill.insertText(o+1,`
|
|
2939
|
-
`,st.sources.USER),this._quill.setSelection(o+1,0,st.sources.USER),this._syncToolbarState()}_openDatePicker(){let t=this._component.shadowRoot;if(!t)return;let o=t.querySelector("zn-button.toolbar__date-dropdown-trigger");if((s=>s?.offsetParent!==null)(o)){o.click();return}let a=t.querySelector("zn-dropdown.toolbar__overflow");if(a){a.show().then();let l=t.querySelector(".toolbar__overflow-menu")?.querySelector('zn-menu-item[data-overflow-source="date"]');l&&(l.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0})),l.focus?.())}}_openDialog(t){let o=this._quill.getModule("dialog")?.component;o&&(o.dialogEl.showModal(),o.setContent(`<app-space id="app-editor-modal" allow-scripts auto-load loading-text="Loading, please wait..." uri="${t}"></app-space>`))}_addImage(){let t=document.createElement("input");t.setAttribute("type","file"),t.setAttribute("accept","image/*"),t.click(),t.onchange=()=>{let o=t.files?.[0];if(!o?.type||!o.type.startsWith("image/"))return;let n=new window.FileReader;n.onload=()=>{let a=n.result,s=this._quill.getSelection(!0),l=s?s.index+s.length:this._quill.getLength();this._quill.insertEmbed(l,"image",a,st.sources.USER);let d=this._quill.root,m=Array.from(d.querySelectorAll("img")).reverse().find(f=>f.getAttribute("src")===a)||null;m&&(m.setAttribute("alt",o.name.replace(/\.[^/.]+$/,"")),m.setAttribute("title",o.name)),this._quill.setSelection(l+1,0,st.sources.USER),this._syncToolbarState();try{this._quill.getModule("attachment")?.addAttachment(o,a)}catch(f){console.warn("[Toolbar] Failed to process image with attachment handler",f)}},n.readAsDataURL(o)}}},Bw=Im;var Vw=A`@charset "UTF-8";/*!
|
|
2939
|
+
`,st.sources.USER),this._quill.setSelection(o+1,0,st.sources.USER),this._syncToolbarState()}_openDatePicker(){let t=this._component.shadowRoot;if(!t)return;let o=t.querySelector("zn-button.toolbar__date-dropdown-trigger");if((s=>s?.offsetParent!==null)(o)){o.click();return}let a=t.querySelector("zn-dropdown.toolbar__overflow");if(a){a.show().then();let l=t.querySelector(".toolbar__overflow-menu")?.querySelector('zn-menu-item[data-overflow-source="date"]');l&&(l.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0})),l.focus?.())}}_openDialog(t){let o=this._quill.getModule("dialog")?.component;o&&(o.dialogEl.showModal(),o.setContent(`<app-space id="app-editor-modal" fetch-style="app-space-inline" allow-scripts auto-load loading-text="Loading, please wait..." uri="${t}"></app-space>`))}_addImage(){let t=document.createElement("input");t.setAttribute("type","file"),t.setAttribute("accept","image/*"),t.click(),t.onchange=()=>{let o=t.files?.[0];if(!o?.type||!o.type.startsWith("image/"))return;let n=new window.FileReader;n.onload=()=>{let a=n.result,s=this._quill.getSelection(!0),l=s?s.index+s.length:this._quill.getLength();this._quill.insertEmbed(l,"image",a,st.sources.USER);let d=this._quill.root,m=Array.from(d.querySelectorAll("img")).reverse().find(f=>f.getAttribute("src")===a)||null;m&&(m.setAttribute("alt",o.name.replace(/\.[^/.]+$/,"")),m.setAttribute("title",o.name)),this._quill.setSelection(l+1,0,st.sources.USER),this._syncToolbarState();try{this._quill.getModule("attachment")?.addAttachment(o,a)}catch(f){console.warn("[Toolbar] Failed to process image with attachment handler",f)}},n.readAsDataURL(o)}}},Bw=Im;var Vw=A`@charset "UTF-8";/*!
|
|
2940
2940
|
* Quill Editor v2.0.3
|
|
2941
2941
|
* https://quilljs.com
|
|
2942
2942
|
* Copyright (c) 2017-2024, Slab
|
|
@@ -2958,7 +2958,7 @@ ${ua(this.code(r,t))}
|
|
|
2958
2958
|
<div id="action-container" class="ql-toolbar ql-snow">
|
|
2959
2959
|
<slot name="actions"></slot>
|
|
2960
2960
|
</div>
|
|
2961
|
-
`}};At.styles=T(Vw),c([V("#editor")],At.prototype,"editor",2),c([V("#editorHtml")],At.prototype,"editorHtml",2),c([V("#toolbar")],At.prototype,"toolbar",2),c([p({reflect:!0})],At.prototype,"id",2),c([p()],At.prototype,"name",2),c([p()],At.prototype,"value",2),c([p({attribute:"interaction-type",type:String})],At.prototype,"interactionType",2),c([p({attribute:"attachment-url",type:String})],At.prototype,"uploadAttachmentUrl",2),c([p({attribute:"code-blocks",type:Boolean})],At.prototype,"codeBlocksEnabled",2),c([p({attribute:"dividers",type:Boolean})],At.prototype,"dividersEnabled",2),c([p({attribute:"links",type:Boolean})],At.prototype,"linksEnabled",2),c([p({attribute:"attachments",type:Boolean})],At.prototype,"attachmentsEnabled",2),c([p({attribute:"images",type:Boolean})],At.prototype,"imagesEnabled",2),c([p({attribute:"videos",type:Boolean})],At.prototype,"videosEnabled",2),c([p({attribute:"dates",type:Boolean})],At.prototype,"datesEnabled",2),c([p({attribute:"emojis",type:Boolean})],At.prototype,"emojisEnabled",2),c([p({attribute:"code",type:Boolean})],At.prototype,"codeEnabled",2),c([p({attribute:"ai",type:Boolean})],At.prototype,"aiEnabled",2),c([p({attribute:"ai-path"})],At.prototype,"aiPath",2),c([p({attribute:"store-key",reflect:!0})],At.prototype,"storeKey",2),c([p({attribute:"store-ttl",type:Number,reflect:!0})],At.prototype,"storeTtl",2),c([p({attribute:"local-storage",type:Boolean,reflect:!0})],At.prototype,"localStorage",2);var s6=At;At.define("zn-editor");var Uw=A`@keyframes rotate-gradient{from{--rotate:0deg}to{--rotate:360deg}}:host{text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-transform:none}:host *,:host *::before,:host *::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:rgb(var(--zn-border-color))}[hidden]{display:none !important}.width-container,.form-container,.wide-form-container{height:100%;width:100%;margin:var(--zn-default-margin,0 auto)}.width-container{max-width:var(--zn-container)}.form-container{max-width:var(--zn-container-ph)}.wide-form-container{max-width:var(--zn-container-lg)}:host ::-webkit-scrollbar{width:5px;height:5px}:host{}:host ::-webkit-scrollbar-track{background:transparent}:host{}:host ::-webkit-scrollbar-thumb{background:rgba(var(--inverse-base),0.2);border-radius:5px}:host{}:host ::-webkit-scrollbar-thumb:hover{background:rgba(var(--inverse-base),0.6)}:host{display:block;position:absolute;overflow:hidden}::backdrop{background-color:var(--zn-backdrop-color,rgba(128,128,128,0.6))}.editor-dialog{background-color:rgb(var(--zn-panel));border:1px solid rgb(var(--zn-border-color));border-radius:var(--zn-border-radius);width:100%;max-width:975px;max-height:650px;padding:0}.editor-dialog .loading-wrapper{display:flex;flex-direction:column;height:100%;padding:1rem;gap:10px}.editor-dialog__close{position:absolute;top:0;right:0;margin:var(--zn-spacing-small);z-index:10001}.editor-dialog__content{min-height:min(500px,70vh);overflow:auto;box-sizing:border-box}`;var Wo=class extends C{constructor(){super(...arguments);this.hasFocus=!1;this.open=!1;this.uri=""}set editorId(t){this._editorId=t,this.requestUpdate()}connectedCallback(){super.connectedCallback()}firstUpdated(t){super.firstUpdated(t),this.dialogEl.addEventListener("close",()=>{this.open=!1,this.innerHTML=""})}setContent(t){this.innerHTML=t}handleOpenChange(){this.open?this.addOpenListeners():this.removeOpenListeners()}addOpenListeners(){"CloseWatcher"in window&&(this.closeWatcher?.destroy(),this.closeWatcher=new CloseWatcher,this.closeWatcher.onclose=()=>this.requestClose("keyboard"))}removeOpenListeners(){this.closeWatcher?.destroy()}requestClose(t){this.emit("zn-request-close",{cancelable:!0,detail:{source:t}}).defaultPrevented||this.dialogEl.close()}_getLoadingState(){return u`
|
|
2961
|
+
`}};At.styles=T(Vw),c([V("#editor")],At.prototype,"editor",2),c([V("#editorHtml")],At.prototype,"editorHtml",2),c([V("#toolbar")],At.prototype,"toolbar",2),c([p({reflect:!0})],At.prototype,"id",2),c([p()],At.prototype,"name",2),c([p()],At.prototype,"value",2),c([p({attribute:"interaction-type",type:String})],At.prototype,"interactionType",2),c([p({attribute:"attachment-url",type:String})],At.prototype,"uploadAttachmentUrl",2),c([p({attribute:"code-blocks",type:Boolean})],At.prototype,"codeBlocksEnabled",2),c([p({attribute:"dividers",type:Boolean})],At.prototype,"dividersEnabled",2),c([p({attribute:"links",type:Boolean})],At.prototype,"linksEnabled",2),c([p({attribute:"attachments",type:Boolean})],At.prototype,"attachmentsEnabled",2),c([p({attribute:"images",type:Boolean})],At.prototype,"imagesEnabled",2),c([p({attribute:"videos",type:Boolean})],At.prototype,"videosEnabled",2),c([p({attribute:"dates",type:Boolean})],At.prototype,"datesEnabled",2),c([p({attribute:"emojis",type:Boolean})],At.prototype,"emojisEnabled",2),c([p({attribute:"code",type:Boolean})],At.prototype,"codeEnabled",2),c([p({attribute:"ai",type:Boolean})],At.prototype,"aiEnabled",2),c([p({attribute:"ai-path"})],At.prototype,"aiPath",2),c([p({attribute:"store-key",reflect:!0})],At.prototype,"storeKey",2),c([p({attribute:"store-ttl",type:Number,reflect:!0})],At.prototype,"storeTtl",2),c([p({attribute:"local-storage",type:Boolean,reflect:!0})],At.prototype,"localStorage",2);var s6=At;At.define("zn-editor");var Uw=A`@keyframes rotate-gradient{from{--rotate:0deg}to{--rotate:360deg}}:host{text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-transform:none}:host *,:host *::before,:host *::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:rgb(var(--zn-border-color))}[hidden]{display:none !important}.width-container,.form-container,.wide-form-container{height:100%;width:100%;margin:var(--zn-default-margin,0 auto)}.width-container{max-width:var(--zn-container)}.form-container{max-width:var(--zn-container-ph)}.wide-form-container{max-width:var(--zn-container-lg)}:host ::-webkit-scrollbar{width:5px;height:5px}:host{}:host ::-webkit-scrollbar-track{background:transparent}:host{}:host ::-webkit-scrollbar-thumb{background:rgba(var(--inverse-base),0.2);border-radius:5px}:host{}:host ::-webkit-scrollbar-thumb:hover{background:rgba(var(--inverse-base),0.6)}:host{display:block;position:absolute;overflow:hidden}::backdrop{background-color:var(--zn-backdrop-color,rgba(128,128,128,0.6))}.editor-dialog{background-color:rgb(var(--zn-panel));border:1px solid rgb(var(--zn-border-color));border-radius:var(--zn-border-radius);width:100%;max-width:975px;max-height:650px;padding:0}.editor-dialog .loading-wrapper{display:flex;flex-direction:column;height:100%;padding:1rem;gap:10px}.editor-dialog__close{position:absolute;top:0;right:0;margin:var(--zn-spacing-x-small);z-index:10001}.editor-dialog__content{min-height:min(500px,70vh);overflow:auto;box-sizing:border-box}`;var Wo=class extends C{constructor(){super(...arguments);this.hasFocus=!1;this.open=!1;this.uri=""}set editorId(t){this._editorId=t,this.requestUpdate()}connectedCallback(){super.connectedCallback()}firstUpdated(t){super.firstUpdated(t),this.dialogEl.addEventListener("close",()=>{this.open=!1,this.innerHTML=""})}setContent(t){this.innerHTML=t}handleOpenChange(){this.open?this.addOpenListeners():this.removeOpenListeners()}addOpenListeners(){"CloseWatcher"in window&&(this.closeWatcher?.destroy(),this.closeWatcher=new CloseWatcher,this.closeWatcher.onclose=()=>this.requestClose("keyboard"))}removeOpenListeners(){this.closeWatcher?.destroy()}requestClose(t){this.emit("zn-request-close",{cancelable:!0,detail:{source:t}}).defaultPrevented||this.dialogEl.close()}_getLoadingState(){return u`
|
|
2962
2962
|
<div class="loading-wrapper">
|
|
2963
2963
|
<zn-skeleton height="55px"></zn-skeleton>
|
|
2964
2964
|
<zn-skeleton height="55px"></zn-skeleton>
|
|
@@ -2971,8 +2971,9 @@ ${ua(this.code(r,t))}
|
|
|
2971
2971
|
context-data=${JSON.stringify({"editor-id":this._editorId})}>
|
|
2972
2972
|
<zn-button
|
|
2973
2973
|
class="editor-dialog__close"
|
|
2974
|
-
icon="
|
|
2975
|
-
icon-
|
|
2974
|
+
icon="x@lu"
|
|
2975
|
+
icon-button="small"
|
|
2976
|
+
icon-size="20"
|
|
2976
2977
|
type="button"
|
|
2977
2978
|
color="transparent"
|
|
2978
2979
|
@click="${()=>this.dialogEl.close()}"
|
package/package.json
CHANGED
|
@@ -37,8 +37,13 @@ export default class ZnChatMessageAttachment extends ZincElement {
|
|
|
37
37
|
/** The leading icon name. */
|
|
38
38
|
@property() icon: string = 'paperclip@lu';
|
|
39
39
|
|
|
40
|
-
/**
|
|
41
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Where to open the link. Defaults to a new tab. Reflected so the console's
|
|
42
|
+
* pagelet link interception (`[href]:not([target])`) skips the host and the
|
|
43
|
+
* browser handles the click natively (download / new tab) instead of
|
|
44
|
+
* loading the file URL as a pagelet.
|
|
45
|
+
*/
|
|
46
|
+
@property({reflect: true}) target: string = '_blank';
|
|
42
47
|
|
|
43
48
|
/** Prompt a download rather than navigating to the link. */
|
|
44
49
|
@property({type: Boolean}) download = false;
|
|
@@ -28,11 +28,24 @@ describe('<zn-chat-message-attachment>', () => {
|
|
|
28
28
|
<zn-chat-message-attachment href="#" name="file.pdf"></zn-chat-message-attachment>
|
|
29
29
|
</zn-chat-message>`);
|
|
30
30
|
|
|
31
|
-
const row = el.shadowRoot!.querySelector('.message__attachments')
|
|
31
|
+
const row = el.shadowRoot!.querySelector('.message__attachments')!;
|
|
32
32
|
// The row is display:none until something is slotted in; a slotted attachment must reveal it.
|
|
33
33
|
expect(getComputedStyle(row).display).to.not.equal('none');
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
+
it('should reflect target onto the host so pagelet link interception skips it', async () => {
|
|
37
|
+
const el = await fixture<HTMLElement>(html`
|
|
38
|
+
<zn-chat-message>
|
|
39
|
+
<zn-chat-message-attachment href="https://example.com/file.pdf" name="file.pdf"></zn-chat-message-attachment>
|
|
40
|
+
</zn-chat-message>`);
|
|
41
|
+
|
|
42
|
+
const attachment = el.querySelector('zn-chat-message-attachment')!;
|
|
43
|
+
// The console intercepts clicks on `[href]:not([target])` — without a reflected
|
|
44
|
+
// target attribute the click is hijacked and the attachment never downloads.
|
|
45
|
+
expect(attachment.getAttribute('target')).to.equal('_blank');
|
|
46
|
+
expect(attachment.matches('[href]:not([href^="#"]):not([href=""]):not([target])')).to.be.false;
|
|
47
|
+
});
|
|
48
|
+
|
|
36
49
|
it('should render the name in the link', async () => {
|
|
37
50
|
const el = await fixture<HTMLElement>(html`
|
|
38
51
|
<zn-chat-message>
|
|
@@ -96,8 +96,9 @@ export default class DialogComponent extends ZincElement {
|
|
|
96
96
|
context-data=${JSON.stringify({'editor-id': this._editorId})}>
|
|
97
97
|
<zn-button
|
|
98
98
|
class="editor-dialog__close"
|
|
99
|
-
icon="
|
|
100
|
-
icon-
|
|
99
|
+
icon="x@lu"
|
|
100
|
+
icon-button="small"
|
|
101
|
+
icon-size="20"
|
|
101
102
|
type="button"
|
|
102
103
|
color="transparent"
|
|
103
104
|
@click="${() => this.dialogEl.close()}"
|
|
@@ -331,7 +331,7 @@ class Toolbar extends QuillToolbar {
|
|
|
331
331
|
if (!dialog) return;
|
|
332
332
|
|
|
333
333
|
dialog.dialogEl.showModal();
|
|
334
|
-
dialog.setContent(`<app-space id="app-editor-modal" allow-scripts auto-load loading-text="Loading, please wait..." uri="${uri}"></app-space>`);
|
|
334
|
+
dialog.setContent(`<app-space id="app-editor-modal" fetch-style="app-space-inline" allow-scripts auto-load loading-text="Loading, please wait..." uri="${uri}"></app-space>`);
|
|
335
335
|
}
|
|
336
336
|
|
|
337
337
|
private _handleOverflowUpdate = () => {
|