@luzmo/analytics-components-kit 1.0.1-alpha.140 → 1.0.1-alpha.142
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/README.md +17 -5
- package/angular/components/ai-interaction-textarea.component.ts +2 -0
- package/angular/components/grid.component.ts +2 -2
- package/angular/esm/components/ai-interaction-textarea.component.d.ts +2 -1
- package/angular/esm/components/ai-interaction-textarea.component.js +7 -2
- package/angular/esm/components/grid.component.d.ts +2 -2
- package/angular/esm/types/ai-chat.types.d.ts +1 -0
- package/angular/types/ai-chat.types.ts +1 -0
- package/components/ai-chat/ai-chat.d.ts +21 -1
- package/components/ai-chat/index.cjs +1 -1
- package/components/ai-chat/index.d.ts +1 -0
- package/components/ai-chat/index.js +3 -3
- package/components/ai-chat/request-contract.d.ts +38 -0
- package/components/{ai-chat-Dg2dvhDq.js → ai-chat-DlUYd_Cf.js} +211 -151
- package/components/ai-chat-rok8ar11.cjs +62 -0
- package/components/ai-interaction-textarea/ai-interaction-textarea.d.ts +6 -0
- package/components/ai-interaction-textarea/index.cjs +1 -1
- package/components/ai-interaction-textarea/index.js +1 -1
- package/components/{ai-interaction-textarea-DDVKMfTQ.cjs → ai-interaction-textarea-BGnQbDpJ.cjs} +2 -2
- package/components/{ai-interaction-textarea-ZDQPVgXC.js → ai-interaction-textarea-EdWcPK0w.js} +6 -3
- package/components/grid/grid.d.ts +4 -9
- package/components/grid/helpers/grid-effects.d.ts +1 -0
- package/components/grid/helpers/grid-events.d.ts +50 -0
- package/components/grid/helpers/grid-interactions.d.ts +91 -0
- package/components/grid/helpers/grid-item-management.d.ts +45 -0
- package/components/grid/helpers/grid-item-popover.d.ts +15 -0
- package/components/grid/helpers/grid-items.d.ts +9 -0
- package/components/grid/helpers/grid-keyboard-updates.d.ts +18 -0
- package/components/grid/helpers/grid-keydown-event.d.ts +18 -0
- package/components/grid/helpers/grid-popover-cleanup.d.ts +4 -0
- package/components/grid/helpers/grid-rendering.d.ts +63 -0
- package/components/grid/helpers/grid-stack-lifecycle.d.ts +26 -0
- package/components/grid/helpers/grid-theme.d.ts +16 -0
- package/components/grid/helpers/grid-update-cycle.d.ts +24 -0
- package/components/grid/index.cjs +1 -1
- package/components/grid/index.js +1 -1
- package/components/grid-BNbbl-9p.cjs +316 -0
- package/components/{grid-BW6LPvCu.js → grid-Ca-fxUK1.js} +2341 -1965
- package/components/index.cjs +1 -1
- package/components/index.js +5 -5
- package/components/item-data-picker-panel/index.cjs +1 -1
- package/components/item-data-picker-panel/index.js +1 -1
- package/components/slot-contents-picker/index.cjs +1 -1
- package/components/slot-contents-picker/index.js +1 -1
- package/components/slot-contents-picker/slot-contents-picker.d.ts +4 -2
- package/components/{slot-contents-picker-HRJuZQq5.cjs → slot-contents-picker-BO5lSTDz.cjs} +4 -4
- package/components/{slot-contents-picker-CgACNIVS.js → slot-contents-picker-Bw_G1BwZ.js} +112 -92
- package/custom-elements.json +1558 -17
- package/package.json +2 -2
- package/types/ai-chat.types.d.ts +1 -0
- package/components/ai-chat-CbqvVZDp.cjs +0 -60
- package/components/grid-xtLaTdhb.cjs +0 -316
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*! * A kit of modern Luzmo Web Components for analytics in your web application.
|
|
2
|
+
*
|
|
3
|
+
* Copyright © 2026 Luzmo
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Luzmo web components (“Luzmo Web Components”)
|
|
6
|
+
* must be used according to the Luzmo Terms of Service.
|
|
7
|
+
* This license allows users with a current active Luzmo account
|
|
8
|
+
* to use the Luzmo Web Components. This license terminates
|
|
9
|
+
* automatically if a user no longer has an active Luzmo account.
|
|
10
|
+
* Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
|
|
11
|
+
*
|
|
12
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
13
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
14
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
15
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
16
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
17
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
18
|
+
* SOFTWARE.
|
|
19
|
+
* */
|
|
20
|
+
const e=require(`./chunk-350yNsax.cjs`),t=require(`./base-C_azywlB.cjs`),n=require(`./decorate-Dq4-zbi1.cjs`);require(`@luzmo/lucero/chat-message`);let r=require(`lit`),i=require(`lit/decorators.js`),a=require(`lit/directives/unsafe-html.js`);var{entries:o,setPrototypeOf:s,isFrozen:c,getPrototypeOf:l,getOwnPropertyDescriptor:u}=Object,{freeze:d,seal:f,create:ee}=Object,{apply:te,construct:ne}=typeof Reflect<`u`&&Reflect;d||=function(e){return e},f||=function(e){return e},te||=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)},ne||=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)};var p=b(Array.prototype.forEach),re=b(Array.prototype.lastIndexOf),ie=b(Array.prototype.pop),m=b(Array.prototype.push),ae=b(Array.prototype.splice),h=b(String.prototype.toLowerCase),oe=b(String.prototype.toString),se=b(String.prototype.match),g=b(String.prototype.replace),ce=b(String.prototype.indexOf),le=b(String.prototype.trim),_=b(Object.prototype.hasOwnProperty),v=b(RegExp.prototype.test),y=x(TypeError);function b(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return te(e,t,r)}}function x(e){return function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return ne(e,n)}}function S(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:h;s&&s(e,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(c(t)||(t[r]=e),i=e)}e[i]=!0}return e}function ue(e){for(let t=0;t<e.length;t++)_(e,t)||(e[t]=null);return e}function C(e){let t=ee(null);for(let[n,r]of o(e))_(e,n)&&(Array.isArray(r)?t[n]=ue(r):r&&typeof r==`object`&&r.constructor===Object?t[n]=C(r):t[n]=r);return t}function w(e,t){for(;e!==null;){let n=u(e,t);if(n){if(n.get)return b(n.get);if(typeof n.value==`function`)return b(n.value)}e=l(e)}function n(){return null}return n}var de=d(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),fe=d(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),pe=d([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),me=d([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),he=d(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),ge=d([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),_e=d([`#text`]),ve=d(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns.slot`.split(`.`)),ye=d(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),be=d(`accent.accentunder.align.bevelled.close.columnsalign.columnlines.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lspace.lquote.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),T=d([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),xe=f(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Se=f(/<%[\w\W]*|[\w\W]*%>/gm),Ce=f(/\$\{[\w\W]*/gm),E=f(/^data-[\-\w.\u00B7-\uFFFF]+$/),D=f(/^aria-[\-\w]+$/),we=f(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),O=f(/^(?:\w+script|data):/i),k=f(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Te=f(/^html$/i),Ee=f(/^[a-z][.\w]*(-[.\w]+)+$/i),De=Object.freeze({__proto__:null,ARIA_ATTR:D,ATTR_WHITESPACE:k,CUSTOM_ELEMENT:Ee,DATA_ATTR:E,DOCTYPE_NAME:Te,ERB_EXPR:Se,IS_ALLOWED_URI:we,IS_SCRIPT_OR_DATA:O,MUSTACHE_EXPR:xe,TMPLIT_EXPR:Ce}),A={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Oe=function(){return typeof window>`u`?null:window},ke=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Ae=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function je(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Oe(),t=e=>je(e);if(t.version=`3.3.1`,t.removed=[],!e||!e.document||e.document.nodeType!==A.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e,r=n,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:c,Element:l,NodeFilter:u,NamedNodeMap:f=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:te,DOMParser:ne,trustedTypes:b}=e,x=l.prototype,ue=w(x,`cloneNode`),xe=w(x,`remove`),Se=w(x,`nextSibling`),Ce=w(x,`childNodes`),E=w(x,`parentNode`);if(typeof s==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let D,O=``,{implementation:k,createNodeIterator:Ee,createDocumentFragment:Me,getElementsByTagName:Ne}=n,{importNode:Pe}=r,j=Ae();t.isSupported=typeof o==`function`&&typeof E==`function`&&k&&k.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:Fe,ERB_EXPR:Ie,TMPLIT_EXPR:Le,DATA_ATTR:Re,ARIA_ATTR:ze,IS_SCRIPT_OR_DATA:Be,ATTR_WHITESPACE:Ve,CUSTOM_ELEMENT:He}=De,{IS_ALLOWED_URI:Ue}=De,M=null,We=S({},[...de,...fe,...pe,...he,..._e]),N=null,Ge=S({},[...ve,...ye,...be,...T]),P=Object.seal(ee(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),F=null,Ke=null,I=Object.seal(ee(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),qe=!0,Je=!0,Ye=!1,Xe=!0,L=!1,R=!0,z=!1,Ze=!1,Qe=!1,B=!1,V=!1,H=!1,$e=!0,et=!1,tt=!0,U=!1,W={},G=null,nt=S({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),rt=null,it=S({},[`audio`,`video`,`img`,`source`,`image`,`track`]),at=null,ot=S({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),st=`http://www.w3.org/1998/Math/MathML`,ct=`http://www.w3.org/2000/svg`,K=`http://www.w3.org/1999/xhtml`,q=K,lt=!1,ut=null,dt=S({},[st,ct,K],oe),ft=S({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),pt=S({},[`annotation-xml`]),mt=S({},[`title`,`style`,`font`,`a`,`script`]),J=null,ht=[`application/xhtml+xml`,`text/html`],Y=null,X=null,gt=n.createElement(`form`),_t=function(e){return e instanceof RegExp||e instanceof Function},vt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(X&&X===e)){if((!e||typeof e!=`object`)&&(e={}),e=C(e),J=ht.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Y=J===`application/xhtml+xml`?oe:h,M=_(e,`ALLOWED_TAGS`)?S({},e.ALLOWED_TAGS,Y):We,N=_(e,`ALLOWED_ATTR`)?S({},e.ALLOWED_ATTR,Y):Ge,ut=_(e,`ALLOWED_NAMESPACES`)?S({},e.ALLOWED_NAMESPACES,oe):dt,at=_(e,`ADD_URI_SAFE_ATTR`)?S(C(ot),e.ADD_URI_SAFE_ATTR,Y):ot,rt=_(e,`ADD_DATA_URI_TAGS`)?S(C(it),e.ADD_DATA_URI_TAGS,Y):it,G=_(e,`FORBID_CONTENTS`)?S({},e.FORBID_CONTENTS,Y):nt,F=_(e,`FORBID_TAGS`)?S({},e.FORBID_TAGS,Y):C({}),Ke=_(e,`FORBID_ATTR`)?S({},e.FORBID_ATTR,Y):C({}),W=_(e,`USE_PROFILES`)?e.USE_PROFILES:!1,qe=e.ALLOW_ARIA_ATTR!==!1,Je=e.ALLOW_DATA_ATTR!==!1,Ye=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Xe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,L=e.SAFE_FOR_TEMPLATES||!1,R=e.SAFE_FOR_XML!==!1,z=e.WHOLE_DOCUMENT||!1,B=e.RETURN_DOM||!1,V=e.RETURN_DOM_FRAGMENT||!1,H=e.RETURN_TRUSTED_TYPE||!1,Qe=e.FORCE_BODY||!1,$e=e.SANITIZE_DOM!==!1,et=e.SANITIZE_NAMED_PROPS||!1,tt=e.KEEP_CONTENT!==!1,U=e.IN_PLACE||!1,Ue=e.ALLOWED_URI_REGEXP||we,q=e.NAMESPACE||K,ft=e.MATHML_TEXT_INTEGRATION_POINTS||ft,pt=e.HTML_INTEGRATION_POINTS||pt,P=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(P.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(P.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==`boolean`&&(P.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),L&&(Je=!1),V&&(B=!0),W&&(M=S({},_e),N=[],W.html===!0&&(S(M,de),S(N,ve)),W.svg===!0&&(S(M,fe),S(N,ye),S(N,T)),W.svgFilters===!0&&(S(M,pe),S(N,ye),S(N,T)),W.mathMl===!0&&(S(M,he),S(N,be),S(N,T))),e.ADD_TAGS&&(typeof e.ADD_TAGS==`function`?I.tagCheck=e.ADD_TAGS:(M===We&&(M=C(M)),S(M,e.ADD_TAGS,Y))),e.ADD_ATTR&&(typeof e.ADD_ATTR==`function`?I.attributeCheck=e.ADD_ATTR:(N===Ge&&(N=C(N)),S(N,e.ADD_ATTR,Y))),e.ADD_URI_SAFE_ATTR&&S(at,e.ADD_URI_SAFE_ATTR,Y),e.FORBID_CONTENTS&&(G===nt&&(G=C(G)),S(G,e.FORBID_CONTENTS,Y)),e.ADD_FORBID_CONTENTS&&(G===nt&&(G=C(G)),S(G,e.ADD_FORBID_CONTENTS,Y)),tt&&(M[`#text`]=!0),z&&S(M,[`html`,`head`,`body`]),M.table&&(S(M,[`tbody`]),delete F.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw y(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw y(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);D=e.TRUSTED_TYPES_POLICY,O=D.createHTML(``)}else D===void 0&&(D=ke(b,i)),D!==null&&typeof O==`string`&&(O=D.createHTML(``));d&&d(e),X=e}},yt=S({},[...fe,...pe,...me]),bt=S({},[...he,...ge]),xt=function(e){let t=E(e);(!t||!t.tagName)&&(t={namespaceURI:q,tagName:`template`});let n=h(e.tagName),r=h(t.tagName);return ut[e.namespaceURI]?e.namespaceURI===ct?t.namespaceURI===K?n===`svg`:t.namespaceURI===st?n===`svg`&&(r===`annotation-xml`||ft[r]):!!yt[n]:e.namespaceURI===st?t.namespaceURI===K?n===`math`:t.namespaceURI===ct?n===`math`&&pt[r]:!!bt[n]:e.namespaceURI===K?t.namespaceURI===ct&&!pt[r]||t.namespaceURI===st&&!ft[r]?!1:!bt[n]&&(mt[n]||!yt[n]):!!(J===`application/xhtml+xml`&&ut[e.namespaceURI]):!1},Z=function(e){m(t.removed,{element:e});try{E(e).removeChild(e)}catch{xe(e)}},Q=function(e,n){try{m(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{m(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(B||V)try{Z(n)}catch{}else try{n.setAttribute(e,``)}catch{}},St=function(e){let t=null,r=null;if(Qe)e=`<remove></remove>`+e;else{let t=se(e,/^[\r\n\t ]+/);r=t&&t[0]}J===`application/xhtml+xml`&&q===K&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=D?D.createHTML(e):e;if(q===K)try{t=new ne().parseFromString(i,J)}catch{}if(!t||!t.documentElement){t=k.createDocument(q,`template`,null);try{t.documentElement.innerHTML=lt?O:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),q===K?Ne.call(t,z?`html`:`body`)[0]:z?t.documentElement:a},Ct=function(e){return Ee.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},wt=function(e){return e instanceof te&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof f)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},Tt=function(e){return typeof c==`function`&&e instanceof c};function $(e,n,r){p(e,e=>{e.call(t,n,r,X)})}let Et=function(e){let n=null;if($(j.beforeSanitizeElements,e,null),wt(e))return Z(e),!0;let r=Y(e.nodeName);if($(j.uponSanitizeElement,e,{tagName:r,allowedTags:M}),R&&e.hasChildNodes()&&!Tt(e.firstElementChild)&&v(/<[/\w!]/g,e.innerHTML)&&v(/<[/\w!]/g,e.textContent)||e.nodeType===A.progressingInstruction||R&&e.nodeType===A.comment&&v(/<[/\w]/g,e.data))return Z(e),!0;if(!(I.tagCheck instanceof Function&&I.tagCheck(r))&&(!M[r]||F[r])){if(!F[r]&&Ot(r)&&(P.tagNameCheck instanceof RegExp&&v(P.tagNameCheck,r)||P.tagNameCheck instanceof Function&&P.tagNameCheck(r)))return!1;if(tt&&!G[r]){let t=E(e)||e.parentNode,n=Ce(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=ue(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,Se(e))}}}return Z(e),!0}return e instanceof l&&!xt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&v(/<\/no(script|embed|frames)/i,e.innerHTML)?(Z(e),!0):(L&&e.nodeType===A.text&&(n=e.textContent,p([Fe,Ie,Le],e=>{n=g(n,e,` `)}),e.textContent!==n&&(m(t.removed,{element:e.cloneNode()}),e.textContent=n)),$(j.afterSanitizeElements,e,null),!1)},Dt=function(e,t,r){if($e&&(t===`id`||t===`name`)&&(r in n||r in gt))return!1;if(!(Je&&!Ke[t]&&v(Re,t))&&!(qe&&v(ze,t))&&!(I.attributeCheck instanceof Function&&I.attributeCheck(t,e))){if(!N[t]||Ke[t]){if(!(Ot(e)&&(P.tagNameCheck instanceof RegExp&&v(P.tagNameCheck,e)||P.tagNameCheck instanceof Function&&P.tagNameCheck(e))&&(P.attributeNameCheck instanceof RegExp&&v(P.attributeNameCheck,t)||P.attributeNameCheck instanceof Function&&P.attributeNameCheck(t,e))||t===`is`&&P.allowCustomizedBuiltInElements&&(P.tagNameCheck instanceof RegExp&&v(P.tagNameCheck,r)||P.tagNameCheck instanceof Function&&P.tagNameCheck(r))))return!1}else if(!at[t]&&!v(Ue,g(r,Ve,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&ce(r,`data:`)===0&&rt[e])&&!(Ye&&!v(Be,g(r,Ve,``)))&&r)return!1}return!0},Ot=function(e){return e!==`annotation-xml`&&se(e,He)},kt=function(e){$(j.beforeSanitizeAttributes,e,null);let{attributes:n}=e;if(!n||wt(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:N,forceKeepAttr:void 0},i=n.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=n[i],c=Y(a),l=s,u=a===`value`?l:le(l);if(r.attrName=c,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,$(j.uponSanitizeAttribute,e,r),u=r.attrValue,et&&(c===`id`||c===`name`)&&(Q(a,e),u=`user-content-`+u),R&&v(/((--!?|])>)|<\/(style|title|textarea)/i,u)){Q(a,e);continue}if(c===`attributename`&&se(u,`href`)){Q(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Q(a,e);continue}if(!Xe&&v(/\/>/i,u)){Q(a,e);continue}L&&p([Fe,Ie,Le],e=>{u=g(u,e,` `)});let d=Y(e.nodeName);if(!Dt(d,c,u)){Q(a,e);continue}if(D&&typeof b==`object`&&typeof b.getAttributeType==`function`&&!o)switch(b.getAttributeType(d,c)){case`TrustedHTML`:u=D.createHTML(u);break;case`TrustedScriptURL`:u=D.createScriptURL(u);break}if(u!==l)try{o?e.setAttributeNS(o,a,u):e.setAttribute(a,u),wt(e)?Z(e):ie(t.removed)}catch{Q(a,e)}}$(j.afterSanitizeAttributes,e,null)},At=function e(t){let n=null,r=Ct(t);for($(j.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)$(j.uponSanitizeShadowNode,n,null),Et(n),kt(n),n.content instanceof a&&e(n.content);$(j.afterSanitizeShadowDOM,t,null)};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,o=null,s=null,l=null;if(lt=!e,lt&&(e=`<!-->`),typeof e!=`string`&&!Tt(e))if(typeof e.toString==`function`){if(e=e.toString(),typeof e!=`string`)throw y(`dirty is not a string, aborting`)}else throw y(`toString is not a function`);if(!t.isSupported)return e;if(Ze||vt(n),t.removed=[],typeof e==`string`&&(U=!1),U){if(e.nodeName){let t=Y(e.nodeName);if(!M[t]||F[t])throw y(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof c)i=St(`<!---->`),o=i.ownerDocument.importNode(e,!0),o.nodeType===A.element&&o.nodeName===`BODY`||o.nodeName===`HTML`?i=o:i.appendChild(o);else{if(!B&&!L&&!z&&e.indexOf(`<`)===-1)return D&&H?D.createHTML(e):e;if(i=St(e),!i)return B?null:H?O:``}i&&Qe&&Z(i.firstChild);let u=Ct(U?e:i);for(;s=u.nextNode();)Et(s),kt(s),s.content instanceof a&&At(s.content);if(U)return e;if(B){if(V)for(l=Me.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(N.shadowroot||N.shadowrootmode)&&(l=Pe.call(r,l,!0)),l}let d=z?i.outerHTML:i.innerHTML;return z&&M[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&v(Te,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
21
|
+
`+d),L&&p([Fe,Ie,Le],e=>{d=g(d,e,` `)}),D&&H?D.createHTML(d):d},t.setConfig=function(){vt(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),Ze=!0},t.clearConfig=function(){X=null,Ze=!1},t.isValidAttribute=function(e,t,n){return X||vt({}),Dt(Y(e),Y(t),n)},t.addHook=function(e,t){typeof t==`function`&&m(j[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=re(j[e],t);return n===-1?void 0:ae(j[e],n,1)[0]}return ie(j[e])},t.removeHooks=function(e){j[e]=[]},t.removeAllHooks=function(){j=Ae()},t}var Me=je(),Ne=`:host{box-sizing:border-box;flex-direction:column;width:100%;height:100%;display:flex}:host .chat-container{background:var(--luzmo-ai-chat-background,var(--ai-chat-background));border-radius:var(--luzmo-ai-chat-border-radius,var(--ai-chat-border-radius));width:100%;height:100%;min-height:0;padding:var(--luzmo-ai-chat-padding,var(--ai-chat-padding));gap:var(--luzmo-ai-chat-gap,var(--ai-chat-gap));border:var(--luzmo-ai-chat-border,var(--ai-chat-border));box-shadow:var(--luzmo-ai-chat-box-shadow,var(--ai-chat-box-shadow));box-sizing:border-box;flex-direction:column;flex:1;display:flex;overflow:hidden}:host .chat-messages-container{gap:var(--luzmo-ai-chat-gap,var(--ai-chat-gap));flex-direction:column;flex:1;min-height:0;display:flex;overflow:auto}:host luzmo-chat-message{--luzmo-primary:rgba(var(--luzmo-primary-rgb),.08);--chat-message-primary-text-color:var(--luzmo-font-color);--chat-message-primary-border-color:transparent}:host luzmo-ai-interaction-textarea{flex-grow:0;flex-shrink:0}:host{--ai-chat-background:var(--luzmo-background-color);--ai-chat-border-radius:0;--ai-chat-padding:0;--ai-chat-gap:1rem;--ai-chat-max-height:none;--ai-chat-messages-flex:1;--ai-chat-border:none;--ai-chat-box-shadow:none}`;function Pe(e){let{prompt:t,datasetIds:n,authKey:r,authToken:i,conversationId:a,chart:o,modelPreference:s,apiVersion:c=`0.1.0`}=e;return{key:r,token:i,action:`create`,version:c,properties:{content:{role:`user`,content:t},...a?{conversation_id:a}:{}},options:{available_datasets:n,...n.length>0?{dataset_id:n[0]}:{},...o?{chart:{...o,title:o.title||o.options.title,filters:o.filterGroups||[],aichartId:o.aichartId||``}}:{},model_preference:s}}}var j=class extends t.i{constructor(...e){super(...e),this.messages=[],this.selectedDatasets=[],this.placeholder=`Describe your change`,this.disabled=!1,this.showAssistantContextMenu=!1,this.authKey=``,this.authToken=``,this.apiUrl=`https://api.luzmo.com`,this.appServer=`https://app.luzmo.com`,this.flagOpendata=!1,this.hideDatasetButton=!1,this.modelPreference=`performance`,this.requestMode=`internal`,this.isGenerating=!1,this.conversationId=null,this.chart=null,this.apiVersion=`0.1.0`,this._isGeneratingInternal=!1,this._textareaValue=``}static{this.styles=(0,r.unsafeCSS)(Ne)}static{this.tagName=`luzmo-ai-chat`}_generateMessageId(){return`msg-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}_buildRequestBody(e,t){return Pe({prompt:e,datasetIds:t,authKey:this.authKey,authToken:this.authToken,conversationId:this.conversationId,chart:this.chart,modelPreference:this.modelPreference,apiVersion:this.apiVersion})}async _sendMessage(e){let t=`${this.apiUrl}/${this.apiVersion}/aimessage`,n=await fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},mode:`cors`,body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.message||`API request failed with status ${n.status}`)}return await n.json()}async _addUserMessage(e,t){let n={id:this._generateMessageId(),type:`user`,message:e};this.messages=[...this.messages,n],this._textareaValue=``,this.dispatchEvent(new CustomEvent(`luzmo-message-sent`,{detail:{message:n,selectedDatasets:t},bubbles:!0,composed:!0})),await this.updateComplete,this._scrollToBottom()}_prepareForAIResponse(){this._isGeneratingInternal=!0;let e={id:this._generateMessageId(),type:`ai`,message:``};return this.messages=[...this.messages,e],e}_handleChartResponse(e,t){this.dispatchEvent(new CustomEvent(`luzmo-chart-generated`,{detail:{aiSampleChart:e},bubbles:!0,composed:!0}));let n=e.message||e.error||e.clarificationQuestion;n&&(t.message=n,this.messages=[...this.messages.slice(0,-1),{...t}],this.dispatchEvent(new CustomEvent(`luzmo-response-received`,{detail:{message:t,done:!0},bubbles:!0,composed:!0})))}_handleErrorResponse(e,t){let n=null;if(e.functionResponse?.error){let t=e.functionResponse.explanation;t&&typeof t==`string`&&(n=e.functionResponse.explanation)}else n=e.functionResponse;n||=e.message||e.error||e.clarificationQuestion||null,n&&(t.message=n,this.messages=[...this.messages.slice(0,-1),{...t}]),this.dispatchEvent(new CustomEvent(`luzmo-response-received`,{detail:{message:t,done:!0},bubbles:!0,composed:!0}))}_processAIResponse(e,t){e.generatedChart===void 0?(e.functionResponse?.error!==void 0||typeof e.functionResponse==`string`||e.clarificationQuestion===`string`)&&this._handleErrorResponse(e,t):this._handleChartResponse(e,t)}_handleAPIError(e){console.error(`AI Chart Generation Error:`,e);let t={id:this._generateMessageId(),type:`ai`,message:`${e instanceof Error?e.message:`Unknown error`}`};this.messages=[...this.messages,t],this.dispatchEvent(new CustomEvent(`luzmo-response-received`,{detail:{message:t,error:e},bubbles:!0,composed:!0}))}async _finalizeAIResponse(){this._isGeneratingInternal=!1,await this.updateComplete,this._scrollToBottom()}_handleDatasetSelected(e){let t=e.detail;this.selectedDatasets.some(e=>e.id===t.id)||(this.selectedDatasets=[...this.selectedDatasets,t],this._emitDatasetsChanged())}_handleDatasetRemoved(e){let t=e.detail;this.selectedDatasets=this.selectedDatasets.filter(e=>e.id!==t.id),this._emitDatasetsChanged()}_emitDatasetsChanged(){this.dispatchEvent(new CustomEvent(`luzmo-datasets-changed`,{detail:{selectedDatasets:this.selectedDatasets},bubbles:!0,composed:!0}))}async _handlePromptSubmitted(e){let{prompt:t,selectedDatasets:n}=e.detail,r=n.map(e=>e.id),i=this._buildRequestBody(t,r);if(await this._addUserMessage(t,n),this.requestMode===`external`){let e={prompt:t,selectedDatasets:n,datasetIds:r,request:i,url:`${this.apiUrl}/${this.apiVersion}/aimessage`};this.dispatchEvent(new CustomEvent(`luzmo-prompt-submitted`,{detail:e,bubbles:!0,composed:!0}));return}let a=await this._prepareForAIResponse();try{let e=await this._sendMessage(i);this._processAIResponse(e,a)}catch(e){this._handleAPIError(e)}finally{await this._finalizeAIResponse()}}_scrollToBottom(){let e=this.shadowRoot?.querySelector(`.chat-messages-container`);e&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight})})}_sanitizeMessage(e){return Me.sanitize(e,{ALLOWED_TAGS:[`p`,`br`,`strong`,`em`,`b`,`i`,`u`,`s`,`code`,`pre`,`blockquote`,`ul`,`ol`,`li`,`a`],ALLOWED_ATTR:[`href`,`title`,`target`,`rel`],ALLOW_DATA_ATTR:!1,FORBID_TAGS:[`script`,`iframe`,`object`,`embed`,`form`,`input`,`button`],FORBID_ATTR:[`onerror`,`onload`,`onclick`,`onmouseover`,`onfocus`,`onblur`]})}_renderMessages(){return this.messages.map(e=>e.type===`user`?r.html`
|
|
22
|
+
<luzmo-chat-message
|
|
23
|
+
avatar-placement="bottom"
|
|
24
|
+
position="right"
|
|
25
|
+
variant="primary"
|
|
26
|
+
size="s"
|
|
27
|
+
>
|
|
28
|
+
${e.message}
|
|
29
|
+
</luzmo-chat-message>
|
|
30
|
+
`:r.html`
|
|
31
|
+
<luzmo-chat-message
|
|
32
|
+
avatar-placement="bottom"
|
|
33
|
+
position="left"
|
|
34
|
+
quiet
|
|
35
|
+
size="s"
|
|
36
|
+
>
|
|
37
|
+
${(0,a.unsafeHTML)(this._sanitizeMessage(e.message))}
|
|
38
|
+
</luzmo-chat-message>
|
|
39
|
+
`)}render(){let e=this.requestMode===`external`?this.isGenerating:this._isGeneratingInternal;return r.html`
|
|
40
|
+
<div class="chat-container">
|
|
41
|
+
<div class="chat-messages-container">
|
|
42
|
+
${this._renderMessages()}
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<luzmo-ai-interaction-textarea
|
|
46
|
+
.value=${this._textareaValue}
|
|
47
|
+
.selectedDatasets=${this.selectedDatasets}
|
|
48
|
+
.placeholder=${this.placeholder}
|
|
49
|
+
?disabled=${this.disabled}
|
|
50
|
+
?is-generating=${e}
|
|
51
|
+
?hide-dataset-button=${this.hideDatasetButton}
|
|
52
|
+
auth-key=${this.authKey}
|
|
53
|
+
auth-token=${this.authToken}
|
|
54
|
+
api-url=${this.apiUrl}
|
|
55
|
+
app-server=${this.appServer}
|
|
56
|
+
?flag-opendata=${this.flagOpendata}
|
|
57
|
+
@prompt-submitted=${this._handlePromptSubmitted}
|
|
58
|
+
@dataset-selected=${this._handleDatasetSelected}
|
|
59
|
+
@dataset-removed=${this._handleDatasetRemoved}
|
|
60
|
+
></luzmo-ai-interaction-textarea>
|
|
61
|
+
</div>
|
|
62
|
+
`}};n.t([(0,i.property)({type:Array})],j.prototype,`messages`,void 0),n.t([(0,i.property)({type:Array,attribute:`selected-datasets`})],j.prototype,`selectedDatasets`,void 0),n.t([(0,i.property)({type:String})],j.prototype,`placeholder`,void 0),n.t([(0,i.property)({type:Boolean,reflect:!0})],j.prototype,`disabled`,void 0),n.t([(0,i.property)({type:Boolean,attribute:`show-assistant-context-menu`})],j.prototype,`showAssistantContextMenu`,void 0),n.t([(0,i.property)({type:String,attribute:`auth-key`})],j.prototype,`authKey`,void 0),n.t([(0,i.property)({type:String,attribute:`auth-token`})],j.prototype,`authToken`,void 0),n.t([(0,i.property)({type:String,attribute:`api-url`})],j.prototype,`apiUrl`,void 0),n.t([(0,i.property)({type:String,attribute:`app-server`})],j.prototype,`appServer`,void 0),n.t([(0,i.property)({type:Boolean,attribute:`flag-opendata`})],j.prototype,`flagOpendata`,void 0),n.t([(0,i.property)({type:Boolean,attribute:`hide-dataset-button`})],j.prototype,`hideDatasetButton`,void 0),n.t([(0,i.property)({type:String,attribute:`model-preference`})],j.prototype,`modelPreference`,void 0),n.t([(0,i.property)({type:String,attribute:`request-mode`})],j.prototype,`requestMode`,void 0),n.t([(0,i.property)({type:Boolean,attribute:`is-generating`})],j.prototype,`isGenerating`,void 0),n.t([(0,i.property)({type:String,attribute:`conversation-id`})],j.prototype,`conversationId`,void 0),n.t([(0,i.property)({type:Object,attribute:`chart`})],j.prototype,`chart`,void 0),n.t([(0,i.property)({type:String,attribute:`api-version`})],j.prototype,`apiVersion`,void 0),n.t([(0,i.state)()],j.prototype,`_isGeneratingInternal`,void 0),n.t([(0,i.state)()],j.prototype,`_textareaValue`,void 0),customElements.get(`luzmo-ai-chat`)||customElements.define(`luzmo-ai-chat`,j),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return j}});
|
|
@@ -11,6 +11,7 @@ import '../dataset-selector-row';
|
|
|
11
11
|
* @property {boolean} hide-dataset-button - When true, hides the "+ Add dataset" button
|
|
12
12
|
* @property {boolean} is-generating - When true, shows a spinning loader icon instead of the submit arrow
|
|
13
13
|
* @property {string} value - The current value of the textarea (can be controlled from parent to clear or set text)
|
|
14
|
+
* @property {boolean} retain-on-submit - When true, retains the input value after submission (default: false, clears on submit)
|
|
14
15
|
*
|
|
15
16
|
* @property {string} --luzmo-ai-interaction-textarea-background-color - Override for background color of the component (client customization)
|
|
16
17
|
* @property {string} --ai-interaction-textarea-background-color - Background color of the component
|
|
@@ -89,6 +90,11 @@ export declare class LuzmoAiInteractionTextarea extends LitElement {
|
|
|
89
90
|
* The current value of the textarea (controlled from parent)
|
|
90
91
|
*/
|
|
91
92
|
value: string;
|
|
93
|
+
/**
|
|
94
|
+
* When true, retains the input value after submitting a prompt (default: false)
|
|
95
|
+
* When false (default), clears the textarea value after submission
|
|
96
|
+
*/
|
|
97
|
+
retainOnSubmit: boolean;
|
|
92
98
|
private _promptValue;
|
|
93
99
|
private _isPromptValid;
|
|
94
100
|
private get _buttonDisabled();
|
|
@@ -17,4 +17,4 @@
|
|
|
17
17
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
18
18
|
* SOFTWARE.
|
|
19
19
|
* */
|
|
20
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../set-locale-CKjJZRH6.cjs`),require(`../dataset-icon-BbNgugDA.cjs`),require(`../data-broker-BUIUM5hr.cjs`),require(`../dataset-selector-list-BdeJlo0u.cjs`),require(`../dataset-selector-row-CAlRVIk_.cjs`);const e=require(`../ai-interaction-textarea-
|
|
20
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../set-locale-CKjJZRH6.cjs`),require(`../dataset-icon-BbNgugDA.cjs`),require(`../data-broker-BUIUM5hr.cjs`),require(`../dataset-selector-list-BdeJlo0u.cjs`),require(`../dataset-selector-row-CAlRVIk_.cjs`);const e=require(`../ai-interaction-textarea-BGnQbDpJ.cjs`);Object.defineProperty(exports,`LuzmoAiInteractionTextarea`,{enumerable:!0,get:function(){return e.t}});
|
|
@@ -28,5 +28,5 @@ import "../dataset-icon-x6Q8nhYc.js";
|
|
|
28
28
|
import "../data-broker-cLR-t5LM.js";
|
|
29
29
|
import "../dataset-selector-list-DO_ExOrO.js";
|
|
30
30
|
import "../dataset-selector-row-VsvdrVDf.js";
|
|
31
|
-
import { t as LuzmoAiInteractionTextarea } from "../ai-interaction-textarea-
|
|
31
|
+
import { t as LuzmoAiInteractionTextarea } from "../ai-interaction-textarea-EdWcPK0w.js";
|
|
32
32
|
export { LuzmoAiInteractionTextarea };
|
package/components/{ai-interaction-textarea-DDVKMfTQ.cjs → ai-interaction-textarea-BGnQbDpJ.cjs}
RENAMED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
18
18
|
* SOFTWARE.
|
|
19
19
|
* */
|
|
20
|
-
const e=require(`./chunk-350yNsax.cjs`),t=require(`./decorate-Dq4-zbi1.cjs`);let n=require(`lit`),r=require(`lit/decorators.js`),i=require(`@lit/localize`),a=require(`@luzmo/icons`),o=require(`lit/directives/class-map.js`);var s=`:host{box-sizing:border-box;background-color:var(--luzmo-ai-interaction-textarea-background-color,var(--ai-interaction-textarea-background-color));border:1px solid var(--luzmo-ai-interaction-textarea-border-color,var(--ai-interaction-textarea-border-color));border-radius:var(--luzmo-ai-interaction-textarea-border-radius,var(--ai-interaction-textarea-border-radius));padding:var(--luzmo-ai-interaction-textarea-padding,var(--ai-interaction-textarea-padding));gap:var(--luzmo-ai-interaction-textarea-gap,var(--ai-interaction-textarea-gap));font-family:var(--luzmo-ai-interaction-textarea-font-family,var(--ai-interaction-textarea-font-family));font-size:var(--luzmo-ai-interaction-textarea-font-size,var(--ai-interaction-textarea-font-size));flex-direction:column;display:flex}:host:has(textarea:focus){border-color:var(--luzmo-ai-interaction-textarea-focus-border-color,var(--ai-interaction-textarea-focus-border-color));box-shadow:var(--luzmo-ai-interaction-textarea-focus-box-shadow,var(--ai-interaction-textarea-focus-box-shadow))}:host .content-wrapper{gap:var(--luzmo-ai-interaction-textarea-gap,var(--ai-interaction-textarea-gap));flex-direction:column;display:flex}:host .content-wrapper.single-line{flex-direction:row;align-items:center}:host .content-wrapper.single-line textarea{flex:1;min-height:auto}:host .content-wrapper.single-line .button-container{align-self:flex-end}:host .content-wrapper.disabled{opacity:.6;pointer-events:none;cursor:not-allowed}:host .content-wrapper.disabled *{pointer-events:none}:host textarea{background-color:var(--luzmo-ai-interaction-textarea-textarea-background,var(--ai-interaction-textarea-textarea-background));resize:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;vertical-align:middle;min-height:var(--luzmo-ai-interaction-textarea-textarea-min-height,var(--ai-interaction-textarea-textarea-min-height,3rem));color:var(--luzmo-ai-interaction-textarea-textarea-color,var(--ai-interaction-textarea-textarea-color));font-family:var(--luzmo-ai-interaction-textarea-font-family,var(--ai-interaction-textarea-font-family));font-size:var(--luzmo-ai-interaction-textarea-font-size,var(--ai-interaction-textarea-font-size));border:none;outline:none;padding:0;line-height:1.5}:host textarea::placeholder{color:var(--luzmo-ai-interaction-textarea-textarea-placeholder-color,var(--ai-interaction-textarea-textarea-placeholder-color))}:host .button-container{text-align:var(--luzmo-ai-interaction-textarea-button-container-text-align,var(--ai-interaction-textarea-button-container-text-align))}:host .button-container button{padding:var(--luzmo-ai-interaction-textarea-button-padding,var(--ai-interaction-textarea-button-padding));min-width:var(--luzmo-ai-interaction-textarea-button-min-width,var(--ai-interaction-textarea-button-min-width));min-height:var(--luzmo-ai-interaction-textarea-button-min-height,var(--ai-interaction-textarea-button-min-height));border-radius:var(--luzmo-ai-interaction-textarea-button-border-radius,var(--ai-interaction-textarea-button-border-radius));font-size:var(--luzmo-ai-interaction-textarea-button-font-size,var(--ai-interaction-textarea-button-font-size));cursor:pointer;border:none;justify-content:center;align-items:center;transition:all .15s;display:inline-flex}:host .button-container button:disabled,:host .button-container button.disabled{opacity:.6;cursor:not-allowed}:host .button-container button svg{justify-content:center;align-items:center;display:flex}:host .button-container button svg.spin{animation:1s linear infinite spin}:host .button-container button.btn-primary{background-color:var(--luzmo-ai-interaction-textarea-button-background-color,var(--ai-interaction-textarea-button-background-color));color:var(--luzmo-ai-interaction-textarea-button-color,var(--ai-interaction-textarea-button-color))}:host .button-container button.btn-primary:hover:not(:disabled):not(.disabled){background-color:var(--luzmo-ai-interaction-textarea-button-background-color-hover,var(--ai-interaction-textarea-button-background-color-hover))}:host .button-container button.btn-primary:disabled,:host .button-container button.btn-primary.disabled{background-color:var(--luzmo-ai-interaction-textarea-button-background-color-disabled,var(--ai-interaction-textarea-button-background-color-disabled));opacity:.6}@keyframes spin{to{transform:rotate(360deg)}}:host{--ai-interaction-textarea-background-color:var(--luzmo-background-color-alt-2);--ai-interaction-textarea-border-color:var(--luzmo-border-color);--ai-interaction-textarea-border-radius:.5rem;--ai-interaction-textarea-padding:.75rem;--ai-interaction-textarea-gap:1rem;--ai-interaction-textarea-focus-border-color:var(--luzmo-primary);--ai-interaction-textarea-focus-box-shadow:0 0 1rem 0 var(--luzmo-primary-50);--ai-interaction-textarea-font-family:var(--luzmo-font-family);--ai-interaction-textarea-font-size:.875rem;--ai-interaction-textarea-textarea-background:transparent;--ai-interaction-textarea-textarea-color:var(--luzmo-font-color);--ai-interaction-textarea-textarea-placeholder-color:var(--luzmo-font-color-extra-dimmed);--ai-interaction-textarea-textarea-min-height:3rem;--ai-interaction-textarea-button-container-text-align:right;--ai-interaction-textarea-button-padding:0;--ai-interaction-textarea-button-min-width:2rem;--ai-interaction-textarea-button-min-height:1.875rem;--ai-interaction-textarea-button-border-radius:.5rem;--ai-interaction-textarea-button-font-size:1rem;--ai-interaction-textarea-button-background-color:var(--luzmo-primary);--ai-interaction-textarea-button-background-color-hover:var(--luzmo-primary-hover);--ai-interaction-textarea-button-background-color-disabled:var(--luzmo-primary);--ai-interaction-textarea-button-color:var(--luzmo-primary-inverse-color)}`,c=class extends n.LitElement{constructor(...e){super(...e),this.placeholder=`Type your prompt here...`,this.selectedDatasets=[],this.authKey=``,this.authToken=``,this.apiUrl=`https://api.luzmo.com`,this.appServer=`https://app.luzmo.com`,this.flagOpendata=!1,this.disabled=!1,this.singleLine=!1,this.hideDatasetButton=!1,this.isGenerating=!1,this.value=``,this._promptValue=``,this._isPromptValid=!1}static{this.styles=(0,n.unsafeCSS)(s)}static{this.tagName=`luzmo-ai-interaction-textarea`}get _buttonDisabled(){return this.hideDatasetButton?this.disabled||!this._isPromptValid:this.disabled||this.selectedDatasets.length===0||!this._isPromptValid}_autoResizeTextarea(e){if(e.style.height=`auto`,this.singleLine){let t=1.5,n=Number.parseFloat(getComputedStyle(e).fontSize)||14,r=t*n,i=8*t*n,a=Math.max(r,Math.min(e.scrollHeight,i));e.style.height=`${a}px`}else{let t=Math.max(2*1.5*16,Math.min(e.scrollHeight,8*1.5*16));e.style.height=`${t}px`}}_handlePromptInput(e){let t=e.target;this._promptValue=t.value,this._isPromptValid=t.value.trim().length>0,this._autoResizeTextarea(t),t.scrollTo({top:t.scrollHeight})}_handleKeyDown(e){e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),this._submitPrompt())}_submitPrompt(){if(this._buttonDisabled)return;let e=this._promptValue.trim();this.dispatchEvent(new CustomEvent(`prompt-submitted`,{detail:{prompt:e,selectedDatasets:this.selectedDatasets},bubbles:!0,composed:!0})),this._promptValue=``,this._isPromptValid=!1,requestAnimationFrame(()=>{let e=this.shadowRoot?.querySelector(`textarea`);e&&this._autoResizeTextarea(e)})}_handleDatasetSelected(e){let t=e.detail;this.selectedDatasets.some(e=>e.id===t.id)||(this.selectedDatasets=[...this.selectedDatasets,t])}_handleDatasetRemoved(e){let t=e.detail;this.selectedDatasets=this.selectedDatasets.filter(e=>e.id!==t.id)}willUpdate(e){e.has(`value`)&&(this._promptValue=this.value,this._isPromptValid=this.value.trim().length>0,requestAnimationFrame(()=>{let e=this.shadowRoot?.querySelector(`textarea`);e&&this._autoResizeTextarea(e)}))}firstUpdated(){let e=this.shadowRoot?.querySelector(`textarea`);e&&this._autoResizeTextarea(e)}render(){return n.html`
|
|
20
|
+
const e=require(`./chunk-350yNsax.cjs`),t=require(`./decorate-Dq4-zbi1.cjs`);let n=require(`lit`),r=require(`lit/decorators.js`),i=require(`@lit/localize`),a=require(`@luzmo/icons`),o=require(`lit/directives/class-map.js`);var s=`:host{box-sizing:border-box;background-color:var(--luzmo-ai-interaction-textarea-background-color,var(--ai-interaction-textarea-background-color));border:1px solid var(--luzmo-ai-interaction-textarea-border-color,var(--ai-interaction-textarea-border-color));border-radius:var(--luzmo-ai-interaction-textarea-border-radius,var(--ai-interaction-textarea-border-radius));padding:var(--luzmo-ai-interaction-textarea-padding,var(--ai-interaction-textarea-padding));gap:var(--luzmo-ai-interaction-textarea-gap,var(--ai-interaction-textarea-gap));font-family:var(--luzmo-ai-interaction-textarea-font-family,var(--ai-interaction-textarea-font-family));font-size:var(--luzmo-ai-interaction-textarea-font-size,var(--ai-interaction-textarea-font-size));flex-direction:column;display:flex}:host:has(textarea:focus){border-color:var(--luzmo-ai-interaction-textarea-focus-border-color,var(--ai-interaction-textarea-focus-border-color));box-shadow:var(--luzmo-ai-interaction-textarea-focus-box-shadow,var(--ai-interaction-textarea-focus-box-shadow))}:host .content-wrapper{gap:var(--luzmo-ai-interaction-textarea-gap,var(--ai-interaction-textarea-gap));flex-direction:column;display:flex}:host .content-wrapper.single-line{flex-direction:row;align-items:center}:host .content-wrapper.single-line textarea{flex:1;min-height:auto}:host .content-wrapper.single-line .button-container{align-self:flex-end}:host .content-wrapper.disabled{opacity:.6;pointer-events:none;cursor:not-allowed}:host .content-wrapper.disabled *{pointer-events:none}:host textarea{background-color:var(--luzmo-ai-interaction-textarea-textarea-background,var(--ai-interaction-textarea-textarea-background));resize:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;vertical-align:middle;min-height:var(--luzmo-ai-interaction-textarea-textarea-min-height,var(--ai-interaction-textarea-textarea-min-height,3rem));color:var(--luzmo-ai-interaction-textarea-textarea-color,var(--ai-interaction-textarea-textarea-color));font-family:var(--luzmo-ai-interaction-textarea-font-family,var(--ai-interaction-textarea-font-family));font-size:var(--luzmo-ai-interaction-textarea-font-size,var(--ai-interaction-textarea-font-size));border:none;outline:none;padding:0;line-height:1.5}:host textarea::placeholder{color:var(--luzmo-ai-interaction-textarea-textarea-placeholder-color,var(--ai-interaction-textarea-textarea-placeholder-color))}:host .button-container{text-align:var(--luzmo-ai-interaction-textarea-button-container-text-align,var(--ai-interaction-textarea-button-container-text-align))}:host .button-container button{padding:var(--luzmo-ai-interaction-textarea-button-padding,var(--ai-interaction-textarea-button-padding));min-width:var(--luzmo-ai-interaction-textarea-button-min-width,var(--ai-interaction-textarea-button-min-width));min-height:var(--luzmo-ai-interaction-textarea-button-min-height,var(--ai-interaction-textarea-button-min-height));border-radius:var(--luzmo-ai-interaction-textarea-button-border-radius,var(--ai-interaction-textarea-button-border-radius));font-size:var(--luzmo-ai-interaction-textarea-button-font-size,var(--ai-interaction-textarea-button-font-size));cursor:pointer;border:none;justify-content:center;align-items:center;transition:all .15s;display:inline-flex}:host .button-container button:disabled,:host .button-container button.disabled{opacity:.6;cursor:not-allowed}:host .button-container button svg{justify-content:center;align-items:center;display:flex}:host .button-container button svg.spin{animation:1s linear infinite spin}:host .button-container button.btn-primary{background-color:var(--luzmo-ai-interaction-textarea-button-background-color,var(--ai-interaction-textarea-button-background-color));color:var(--luzmo-ai-interaction-textarea-button-color,var(--ai-interaction-textarea-button-color))}:host .button-container button.btn-primary:hover:not(:disabled):not(.disabled){background-color:var(--luzmo-ai-interaction-textarea-button-background-color-hover,var(--ai-interaction-textarea-button-background-color-hover))}:host .button-container button.btn-primary:disabled,:host .button-container button.btn-primary.disabled{background-color:var(--luzmo-ai-interaction-textarea-button-background-color-disabled,var(--ai-interaction-textarea-button-background-color-disabled));opacity:.6}@keyframes spin{to{transform:rotate(360deg)}}:host{--ai-interaction-textarea-background-color:var(--luzmo-background-color-alt-2);--ai-interaction-textarea-border-color:var(--luzmo-border-color);--ai-interaction-textarea-border-radius:.5rem;--ai-interaction-textarea-padding:.75rem;--ai-interaction-textarea-gap:1rem;--ai-interaction-textarea-focus-border-color:var(--luzmo-primary);--ai-interaction-textarea-focus-box-shadow:0 0 1rem 0 var(--luzmo-primary-50);--ai-interaction-textarea-font-family:var(--luzmo-font-family);--ai-interaction-textarea-font-size:.875rem;--ai-interaction-textarea-textarea-background:transparent;--ai-interaction-textarea-textarea-color:var(--luzmo-font-color);--ai-interaction-textarea-textarea-placeholder-color:var(--luzmo-font-color-extra-dimmed);--ai-interaction-textarea-textarea-min-height:3rem;--ai-interaction-textarea-button-container-text-align:right;--ai-interaction-textarea-button-padding:0;--ai-interaction-textarea-button-min-width:2rem;--ai-interaction-textarea-button-min-height:1.875rem;--ai-interaction-textarea-button-border-radius:.5rem;--ai-interaction-textarea-button-font-size:1rem;--ai-interaction-textarea-button-background-color:var(--luzmo-primary);--ai-interaction-textarea-button-background-color-hover:var(--luzmo-primary-hover);--ai-interaction-textarea-button-background-color-disabled:var(--luzmo-primary);--ai-interaction-textarea-button-color:var(--luzmo-primary-inverse-color)}`,c=class extends n.LitElement{constructor(...e){super(...e),this.placeholder=`Type your prompt here...`,this.selectedDatasets=[],this.authKey=``,this.authToken=``,this.apiUrl=`https://api.luzmo.com`,this.appServer=`https://app.luzmo.com`,this.flagOpendata=!1,this.disabled=!1,this.singleLine=!1,this.hideDatasetButton=!1,this.isGenerating=!1,this.value=``,this.retainOnSubmit=!1,this._promptValue=``,this._isPromptValid=!1}static{this.styles=(0,n.unsafeCSS)(s)}static{this.tagName=`luzmo-ai-interaction-textarea`}get _buttonDisabled(){return this.hideDatasetButton?this.disabled||!this._isPromptValid:this.disabled||this.selectedDatasets.length===0||!this._isPromptValid}_autoResizeTextarea(e){if(e.style.height=`auto`,this.singleLine){let t=1.5,n=Number.parseFloat(getComputedStyle(e).fontSize)||14,r=t*n,i=8*t*n,a=Math.max(r,Math.min(e.scrollHeight,i));e.style.height=`${a}px`}else{let t=Math.max(2*1.5*16,Math.min(e.scrollHeight,8*1.5*16));e.style.height=`${t}px`}}_handlePromptInput(e){let t=e.target;this._promptValue=t.value,this._isPromptValid=t.value.trim().length>0,this._autoResizeTextarea(t),t.scrollTo({top:t.scrollHeight})}_handleKeyDown(e){e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),this._submitPrompt())}_submitPrompt(){if(this._buttonDisabled)return;let e=this._promptValue.trim();this.dispatchEvent(new CustomEvent(`prompt-submitted`,{detail:{prompt:e,selectedDatasets:this.selectedDatasets},bubbles:!0,composed:!0})),this.retainOnSubmit||(this._promptValue=``,this._isPromptValid=!1),requestAnimationFrame(()=>{let e=this.shadowRoot?.querySelector(`textarea`);e&&this._autoResizeTextarea(e)})}_handleDatasetSelected(e){let t=e.detail;this.selectedDatasets.some(e=>e.id===t.id)||(this.selectedDatasets=[...this.selectedDatasets,t])}_handleDatasetRemoved(e){let t=e.detail;this.selectedDatasets=this.selectedDatasets.filter(e=>e.id!==t.id)}willUpdate(e){e.has(`value`)&&(this._promptValue=this.value,this._isPromptValid=this.value.trim().length>0,requestAnimationFrame(()=>{let e=this.shadowRoot?.querySelector(`textarea`);e&&this._autoResizeTextarea(e)}))}firstUpdated(){let e=this.shadowRoot?.querySelector(`textarea`);e&&this._autoResizeTextarea(e)}render(){return n.html`
|
|
21
21
|
<div class=${(0,o.classMap)({"content-wrapper":!0,disabled:this.disabled,"single-line":this.singleLine})}>
|
|
22
22
|
${this.hideDatasetButton?``:n.html`
|
|
23
23
|
<luzmo-dataset-selector-row
|
|
@@ -53,4 +53,4 @@ const e=require(`./chunk-350yNsax.cjs`),t=require(`./decorate-Dq4-zbi1.cjs`);let
|
|
|
53
53
|
</button>
|
|
54
54
|
</div>
|
|
55
55
|
</div>
|
|
56
|
-
`}};t.t([(0,r.property)({type:String})],c.prototype,`placeholder`,void 0),t.t([(0,r.property)({type:Array})],c.prototype,`selectedDatasets`,void 0),t.t([(0,r.property)({type:String,attribute:`auth-key`})],c.prototype,`authKey`,void 0),t.t([(0,r.property)({type:String,attribute:`auth-token`})],c.prototype,`authToken`,void 0),t.t([(0,r.property)({type:String,attribute:`api-url`})],c.prototype,`apiUrl`,void 0),t.t([(0,r.property)({type:String,attribute:`app-server`})],c.prototype,`appServer`,void 0),t.t([(0,r.property)({type:Boolean,attribute:`flag-opendata`})],c.prototype,`flagOpendata`,void 0),t.t([(0,r.property)({type:Boolean,reflect:!0,attribute:`disabled`})],c.prototype,`disabled`,void 0),t.t([(0,r.property)({type:Boolean,attribute:`single-line`})],c.prototype,`singleLine`,void 0),t.t([(0,r.property)({type:Boolean,attribute:`hide-dataset-button`})],c.prototype,`hideDatasetButton`,void 0),t.t([(0,r.property)({type:Boolean,attribute:`is-generating`})],c.prototype,`isGenerating`,void 0),t.t([(0,r.property)({type:String})],c.prototype,`value`,void 0),t.t([(0,r.state)()],c.prototype,`_promptValue`,void 0),t.t([(0,r.state)()],c.prototype,`_isPromptValid`,void 0),c=t.t([(0,i.localized)()],c),customElements.get(`luzmo-ai-interaction-textarea`)||customElements.define(`luzmo-ai-interaction-textarea`,c),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return c}});
|
|
56
|
+
`}};t.t([(0,r.property)({type:String})],c.prototype,`placeholder`,void 0),t.t([(0,r.property)({type:Array})],c.prototype,`selectedDatasets`,void 0),t.t([(0,r.property)({type:String,attribute:`auth-key`})],c.prototype,`authKey`,void 0),t.t([(0,r.property)({type:String,attribute:`auth-token`})],c.prototype,`authToken`,void 0),t.t([(0,r.property)({type:String,attribute:`api-url`})],c.prototype,`apiUrl`,void 0),t.t([(0,r.property)({type:String,attribute:`app-server`})],c.prototype,`appServer`,void 0),t.t([(0,r.property)({type:Boolean,attribute:`flag-opendata`})],c.prototype,`flagOpendata`,void 0),t.t([(0,r.property)({type:Boolean,reflect:!0,attribute:`disabled`})],c.prototype,`disabled`,void 0),t.t([(0,r.property)({type:Boolean,attribute:`single-line`})],c.prototype,`singleLine`,void 0),t.t([(0,r.property)({type:Boolean,attribute:`hide-dataset-button`})],c.prototype,`hideDatasetButton`,void 0),t.t([(0,r.property)({type:Boolean,attribute:`is-generating`})],c.prototype,`isGenerating`,void 0),t.t([(0,r.property)({type:String})],c.prototype,`value`,void 0),t.t([(0,r.property)({type:Boolean,attribute:`retain-on-submit`})],c.prototype,`retainOnSubmit`,void 0),t.t([(0,r.state)()],c.prototype,`_promptValue`,void 0),t.t([(0,r.state)()],c.prototype,`_isPromptValid`,void 0),c=t.t([(0,i.localized)()],c),customElements.get(`luzmo-ai-interaction-textarea`)||customElements.define(`luzmo-ai-interaction-textarea`,c),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return c}});
|
package/components/{ai-interaction-textarea-ZDQPVgXC.js → ai-interaction-textarea-EdWcPK0w.js}
RENAMED
|
@@ -25,7 +25,7 @@ import { luzmoArrowRight, luzmoIcon, luzmoSpin } from "@luzmo/icons";
|
|
|
25
25
|
import { classMap } from "lit/directives/class-map.js";
|
|
26
26
|
var ai_interaction_textarea_module_default = ":host{box-sizing:border-box;background-color:var(--luzmo-ai-interaction-textarea-background-color,var(--ai-interaction-textarea-background-color));border:1px solid var(--luzmo-ai-interaction-textarea-border-color,var(--ai-interaction-textarea-border-color));border-radius:var(--luzmo-ai-interaction-textarea-border-radius,var(--ai-interaction-textarea-border-radius));padding:var(--luzmo-ai-interaction-textarea-padding,var(--ai-interaction-textarea-padding));gap:var(--luzmo-ai-interaction-textarea-gap,var(--ai-interaction-textarea-gap));font-family:var(--luzmo-ai-interaction-textarea-font-family,var(--ai-interaction-textarea-font-family));font-size:var(--luzmo-ai-interaction-textarea-font-size,var(--ai-interaction-textarea-font-size));flex-direction:column;display:flex}:host:has(textarea:focus){border-color:var(--luzmo-ai-interaction-textarea-focus-border-color,var(--ai-interaction-textarea-focus-border-color));box-shadow:var(--luzmo-ai-interaction-textarea-focus-box-shadow,var(--ai-interaction-textarea-focus-box-shadow))}:host .content-wrapper{gap:var(--luzmo-ai-interaction-textarea-gap,var(--ai-interaction-textarea-gap));flex-direction:column;display:flex}:host .content-wrapper.single-line{flex-direction:row;align-items:center}:host .content-wrapper.single-line textarea{flex:1;min-height:auto}:host .content-wrapper.single-line .button-container{align-self:flex-end}:host .content-wrapper.disabled{opacity:.6;pointer-events:none;cursor:not-allowed}:host .content-wrapper.disabled *{pointer-events:none}:host textarea{background-color:var(--luzmo-ai-interaction-textarea-textarea-background,var(--ai-interaction-textarea-textarea-background));resize:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;vertical-align:middle;min-height:var(--luzmo-ai-interaction-textarea-textarea-min-height,var(--ai-interaction-textarea-textarea-min-height,3rem));color:var(--luzmo-ai-interaction-textarea-textarea-color,var(--ai-interaction-textarea-textarea-color));font-family:var(--luzmo-ai-interaction-textarea-font-family,var(--ai-interaction-textarea-font-family));font-size:var(--luzmo-ai-interaction-textarea-font-size,var(--ai-interaction-textarea-font-size));border:none;outline:none;padding:0;line-height:1.5}:host textarea::placeholder{color:var(--luzmo-ai-interaction-textarea-textarea-placeholder-color,var(--ai-interaction-textarea-textarea-placeholder-color))}:host .button-container{text-align:var(--luzmo-ai-interaction-textarea-button-container-text-align,var(--ai-interaction-textarea-button-container-text-align))}:host .button-container button{padding:var(--luzmo-ai-interaction-textarea-button-padding,var(--ai-interaction-textarea-button-padding));min-width:var(--luzmo-ai-interaction-textarea-button-min-width,var(--ai-interaction-textarea-button-min-width));min-height:var(--luzmo-ai-interaction-textarea-button-min-height,var(--ai-interaction-textarea-button-min-height));border-radius:var(--luzmo-ai-interaction-textarea-button-border-radius,var(--ai-interaction-textarea-button-border-radius));font-size:var(--luzmo-ai-interaction-textarea-button-font-size,var(--ai-interaction-textarea-button-font-size));cursor:pointer;border:none;justify-content:center;align-items:center;transition:all .15s;display:inline-flex}:host .button-container button:disabled,:host .button-container button.disabled{opacity:.6;cursor:not-allowed}:host .button-container button svg{justify-content:center;align-items:center;display:flex}:host .button-container button svg.spin{animation:1s linear infinite spin}:host .button-container button.btn-primary{background-color:var(--luzmo-ai-interaction-textarea-button-background-color,var(--ai-interaction-textarea-button-background-color));color:var(--luzmo-ai-interaction-textarea-button-color,var(--ai-interaction-textarea-button-color))}:host .button-container button.btn-primary:hover:not(:disabled):not(.disabled){background-color:var(--luzmo-ai-interaction-textarea-button-background-color-hover,var(--ai-interaction-textarea-button-background-color-hover))}:host .button-container button.btn-primary:disabled,:host .button-container button.btn-primary.disabled{background-color:var(--luzmo-ai-interaction-textarea-button-background-color-disabled,var(--ai-interaction-textarea-button-background-color-disabled));opacity:.6}@keyframes spin{to{transform:rotate(360deg)}}:host{--ai-interaction-textarea-background-color:var(--luzmo-background-color-alt-2);--ai-interaction-textarea-border-color:var(--luzmo-border-color);--ai-interaction-textarea-border-radius:.5rem;--ai-interaction-textarea-padding:.75rem;--ai-interaction-textarea-gap:1rem;--ai-interaction-textarea-focus-border-color:var(--luzmo-primary);--ai-interaction-textarea-focus-box-shadow:0 0 1rem 0 var(--luzmo-primary-50);--ai-interaction-textarea-font-family:var(--luzmo-font-family);--ai-interaction-textarea-font-size:.875rem;--ai-interaction-textarea-textarea-background:transparent;--ai-interaction-textarea-textarea-color:var(--luzmo-font-color);--ai-interaction-textarea-textarea-placeholder-color:var(--luzmo-font-color-extra-dimmed);--ai-interaction-textarea-textarea-min-height:3rem;--ai-interaction-textarea-button-container-text-align:right;--ai-interaction-textarea-button-padding:0;--ai-interaction-textarea-button-min-width:2rem;--ai-interaction-textarea-button-min-height:1.875rem;--ai-interaction-textarea-button-border-radius:.5rem;--ai-interaction-textarea-button-font-size:1rem;--ai-interaction-textarea-button-background-color:var(--luzmo-primary);--ai-interaction-textarea-button-background-color-hover:var(--luzmo-primary-hover);--ai-interaction-textarea-button-background-color-disabled:var(--luzmo-primary);--ai-interaction-textarea-button-color:var(--luzmo-primary-inverse-color)}", LuzmoAiInteractionTextarea = class extends LitElement {
|
|
27
27
|
constructor(...e) {
|
|
28
|
-
super(...e), this.placeholder = "Type your prompt here...", this.selectedDatasets = [], this.authKey = "", this.authToken = "", this.apiUrl = "https://api.luzmo.com", this.appServer = "https://app.luzmo.com", this.flagOpendata = !1, this.disabled = !1, this.singleLine = !1, this.hideDatasetButton = !1, this.isGenerating = !1, this.value = "", this._promptValue = "", this._isPromptValid = !1;
|
|
28
|
+
super(...e), this.placeholder = "Type your prompt here...", this.selectedDatasets = [], this.authKey = "", this.authToken = "", this.apiUrl = "https://api.luzmo.com", this.appServer = "https://app.luzmo.com", this.flagOpendata = !1, this.disabled = !1, this.singleLine = !1, this.hideDatasetButton = !1, this.isGenerating = !1, this.value = "", this.retainOnSubmit = !1, this._promptValue = "", this._isPromptValid = !1;
|
|
29
29
|
}
|
|
30
30
|
static {
|
|
31
31
|
this.styles = unsafeCSS(ai_interaction_textarea_module_default);
|
|
@@ -62,7 +62,7 @@ var ai_interaction_textarea_module_default = ":host{box-sizing:border-box;backgr
|
|
|
62
62
|
},
|
|
63
63
|
bubbles: !0,
|
|
64
64
|
composed: !0
|
|
65
|
-
})), this._promptValue = "", this._isPromptValid = !1, requestAnimationFrame(() => {
|
|
65
|
+
})), this.retainOnSubmit || (this._promptValue = "", this._isPromptValid = !1), requestAnimationFrame(() => {
|
|
66
66
|
let e = this.shadowRoot?.querySelector("textarea");
|
|
67
67
|
e && this._autoResizeTextarea(e);
|
|
68
68
|
});
|
|
@@ -157,5 +157,8 @@ __decorate([property({ type: String })], LuzmoAiInteractionTextarea.prototype, "
|
|
|
157
157
|
})], LuzmoAiInteractionTextarea.prototype, "hideDatasetButton", void 0), __decorate([property({
|
|
158
158
|
type: Boolean,
|
|
159
159
|
attribute: "is-generating"
|
|
160
|
-
})], LuzmoAiInteractionTextarea.prototype, "isGenerating", void 0), __decorate([property({ type: String })], LuzmoAiInteractionTextarea.prototype, "value", void 0), __decorate([
|
|
160
|
+
})], LuzmoAiInteractionTextarea.prototype, "isGenerating", void 0), __decorate([property({ type: String })], LuzmoAiInteractionTextarea.prototype, "value", void 0), __decorate([property({
|
|
161
|
+
type: Boolean,
|
|
162
|
+
attribute: "retain-on-submit"
|
|
163
|
+
})], LuzmoAiInteractionTextarea.prototype, "retainOnSubmit", void 0), __decorate([state()], LuzmoAiInteractionTextarea.prototype, "_promptValue", void 0), __decorate([state()], LuzmoAiInteractionTextarea.prototype, "_isPromptValid", void 0), LuzmoAiInteractionTextarea = __decorate([localized()], LuzmoAiInteractionTextarea), customElements.get("luzmo-ai-interaction-textarea") || customElements.define("luzmo-ai-interaction-textarea", LuzmoAiInteractionTextarea);
|
|
161
164
|
export { LuzmoAiInteractionTextarea as t };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import '@luzmo/embed';
|
|
2
|
+
import type { ThemeConfig } from '@luzmo/dashboard-contents-types';
|
|
2
3
|
import type { LuzmoEmbedVizItem } from '@luzmo/embed';
|
|
3
4
|
import { Placement } from '@luzmo/lucero';
|
|
4
5
|
import '@luzmo/lucero/action-button';
|
|
@@ -8,6 +9,7 @@ import { LuzmoElement } from '@luzmo/lucero/utils';
|
|
|
8
9
|
import { GridStack } from 'gridstack';
|
|
9
10
|
import { CSSResultArray, PropertyValues, TemplateResult } from 'lit';
|
|
10
11
|
import './grid-item-actions-menu';
|
|
12
|
+
import { type GridItemLookup } from './helpers/grid-item-management';
|
|
11
13
|
import type { GridItemData, GridItemRenderer, InputActionGroup } from './types';
|
|
12
14
|
/**
|
|
13
15
|
* @customElement luzmo-grid
|
|
@@ -80,7 +82,7 @@ export declare class LuzmoGrid extends LuzmoElement {
|
|
|
80
82
|
/**
|
|
81
83
|
* Grid options configuration
|
|
82
84
|
*/
|
|
83
|
-
theme?:
|
|
85
|
+
theme?: ThemeConfig;
|
|
84
86
|
/**
|
|
85
87
|
* Items to add to the grid
|
|
86
88
|
*/
|
|
@@ -104,7 +106,6 @@ export declare class LuzmoGrid extends LuzmoElement {
|
|
|
104
106
|
disconnectedCallback(): void;
|
|
105
107
|
protected willUpdate(changedProperties: PropertyValues): void;
|
|
106
108
|
protected updated(changedProperties: PropertyValues): void;
|
|
107
|
-
private _updateLuzmoVizItemsLanguage;
|
|
108
109
|
private _handleMouseover;
|
|
109
110
|
private _handleMouseout;
|
|
110
111
|
private _handleKeyDown;
|
|
@@ -136,12 +137,7 @@ export declare class LuzmoGrid extends LuzmoElement {
|
|
|
136
137
|
private _renderOverlayContent;
|
|
137
138
|
private _createItemActionsMenuPopover;
|
|
138
139
|
private _removeItemActionsMenuPopover;
|
|
139
|
-
|
|
140
|
-
getGridItemById(id: string): {
|
|
141
|
-
item: GridItemData;
|
|
142
|
-
element: HTMLElement;
|
|
143
|
-
luzmoElement?: LuzmoEmbedVizItem;
|
|
144
|
-
} | undefined;
|
|
140
|
+
getGridItemById(id: string): GridItemLookup | undefined;
|
|
145
141
|
addGridItem(newItem: GridItemData): HTMLElement;
|
|
146
142
|
removeGridItem(gridItem: GridItemData): void;
|
|
147
143
|
removeGridItemById(id: string): void;
|
|
@@ -163,7 +159,6 @@ export declare class LuzmoGrid extends LuzmoElement {
|
|
|
163
159
|
* @returns The number of items that were deactivated
|
|
164
160
|
*/
|
|
165
161
|
deactivateItems(): number;
|
|
166
|
-
private _renderItem;
|
|
167
162
|
private _renderGrid;
|
|
168
163
|
protected render(): TemplateResult;
|
|
169
164
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const updateLuzmoVizItemsLanguage: (gridItemElements: NodeListOf<HTMLElement>, contentLanguage: string) => void;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { GridStack } from 'gridstack';
|
|
2
|
+
import type { GridItemData } from '../types';
|
|
3
|
+
export type GridItemActionType = 'toggle' | 'button';
|
|
4
|
+
type GridLifecycleEventName = 'luzmo-grid-ready' | 'luzmo-grid-changed';
|
|
5
|
+
export type DispatchItemActionEvent = (action: string, actionType: GridItemActionType, active: boolean, element: HTMLElement, itemId: string, item?: GridItemData, deletedId?: string, originalElement?: HTMLElement) => void;
|
|
6
|
+
export interface GridItemActionEventDetail {
|
|
7
|
+
action: string;
|
|
8
|
+
actionType: GridItemActionType;
|
|
9
|
+
active: boolean;
|
|
10
|
+
items: GridItemData[];
|
|
11
|
+
element: HTMLElement;
|
|
12
|
+
id: string;
|
|
13
|
+
type?: GridItemData['type'];
|
|
14
|
+
slots?: GridItemData['slots'];
|
|
15
|
+
options?: GridItemData['options'];
|
|
16
|
+
filters: NonNullable<GridItemData['filters']>;
|
|
17
|
+
deletedId?: string;
|
|
18
|
+
originalElement?: HTMLElement;
|
|
19
|
+
}
|
|
20
|
+
export interface CreateGridItemActionDetailArgs {
|
|
21
|
+
action: string;
|
|
22
|
+
actionType: GridItemActionType;
|
|
23
|
+
active: boolean;
|
|
24
|
+
items: GridItemData[];
|
|
25
|
+
element: HTMLElement;
|
|
26
|
+
itemId: string;
|
|
27
|
+
item?: GridItemData;
|
|
28
|
+
deletedId?: string;
|
|
29
|
+
originalElement?: HTMLElement;
|
|
30
|
+
}
|
|
31
|
+
interface EventDispatcher {
|
|
32
|
+
dispatchEvent: (event: Event) => boolean;
|
|
33
|
+
}
|
|
34
|
+
interface DispatchGridItemActionEventArgs extends CreateGridItemActionDetailArgs {
|
|
35
|
+
target: EventDispatcher;
|
|
36
|
+
}
|
|
37
|
+
interface GridLifecycleEventDetail {
|
|
38
|
+
element: HTMLElement;
|
|
39
|
+
grid?: GridStack;
|
|
40
|
+
items: GridItemData[];
|
|
41
|
+
}
|
|
42
|
+
interface DispatchGridLifecycleEventArgs {
|
|
43
|
+
target: EventDispatcher;
|
|
44
|
+
eventName: GridLifecycleEventName;
|
|
45
|
+
detail: GridLifecycleEventDetail;
|
|
46
|
+
}
|
|
47
|
+
export declare const createGridItemActionDetail: ({ action, actionType, active, items, element, itemId, item, deletedId, originalElement }: CreateGridItemActionDetailArgs) => GridItemActionEventDetail;
|
|
48
|
+
export declare const dispatchGridItemActionEvent: ({ target, action, actionType, active, items, element, itemId, item, deletedId, originalElement }: DispatchGridItemActionEventArgs) => void;
|
|
49
|
+
export declare const dispatchGridLifecycleEvent: ({ target, eventName, detail }: DispatchGridLifecycleEventArgs) => void;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { GridItemData } from '../types';
|
|
2
|
+
import type { DispatchItemActionEvent } from './grid-events';
|
|
3
|
+
import type { GridItemLookup } from './grid-item-management';
|
|
4
|
+
export interface GridInteractionState {
|
|
5
|
+
activeItemElement?: HTMLElement;
|
|
6
|
+
activeItemActionToggle?: string;
|
|
7
|
+
}
|
|
8
|
+
interface ShouldRemovePopoverOnMouseoutArgs {
|
|
9
|
+
event: Event;
|
|
10
|
+
gridItem: HTMLElement;
|
|
11
|
+
}
|
|
12
|
+
interface ApplyGridItemFocusArgs {
|
|
13
|
+
event: FocusEvent;
|
|
14
|
+
focusedItemElement?: HTMLElement;
|
|
15
|
+
removeItemActionsMenuPopover: (item: HTMLElement) => void;
|
|
16
|
+
}
|
|
17
|
+
interface ClearGridItemFocusArgs {
|
|
18
|
+
event: FocusEvent;
|
|
19
|
+
focusedItemElement?: HTMLElement;
|
|
20
|
+
removeItemActionsMenuPopover: (item: HTMLElement) => void;
|
|
21
|
+
}
|
|
22
|
+
interface ClearGridItemFocusResult {
|
|
23
|
+
focusedItemElement?: HTMLElement;
|
|
24
|
+
shouldFocusGrid: boolean;
|
|
25
|
+
}
|
|
26
|
+
interface CleanupActiveGridItemArgs {
|
|
27
|
+
item: HTMLElement;
|
|
28
|
+
activeItemElement?: HTMLElement;
|
|
29
|
+
gridElement: HTMLElement;
|
|
30
|
+
removeItemActionsMenuPopover: (item: HTMLElement) => void;
|
|
31
|
+
}
|
|
32
|
+
interface HandleGridActionArgs {
|
|
33
|
+
event: CustomEvent;
|
|
34
|
+
gridElement: HTMLElement;
|
|
35
|
+
items: GridItemData[];
|
|
36
|
+
state: GridInteractionState;
|
|
37
|
+
cleanupActiveItem: (item: HTMLElement) => void;
|
|
38
|
+
dispatchItemActionEvent: DispatchItemActionEvent;
|
|
39
|
+
handleDeleteItem: (event: Event) => void;
|
|
40
|
+
handleCloneItem: (event: CustomEvent) => void;
|
|
41
|
+
createItemActionsMenuPopover: (element: HTMLElement, activeAction?: string) => void;
|
|
42
|
+
}
|
|
43
|
+
interface HandleGridClickArgs {
|
|
44
|
+
event: MouseEvent;
|
|
45
|
+
gridElement: HTMLElement;
|
|
46
|
+
hostElement: HTMLElement;
|
|
47
|
+
items: GridItemData[];
|
|
48
|
+
activeItemActionToggle?: string;
|
|
49
|
+
cleanupActiveItem: (item: HTMLElement) => void;
|
|
50
|
+
dispatchItemActionEvent: DispatchItemActionEvent;
|
|
51
|
+
}
|
|
52
|
+
interface TriggerGridItemActionArgs {
|
|
53
|
+
gridElement: HTMLElement;
|
|
54
|
+
items: GridItemData[];
|
|
55
|
+
gridItemData?: GridItemLookup;
|
|
56
|
+
itemId: string;
|
|
57
|
+
action: string;
|
|
58
|
+
options?: {
|
|
59
|
+
active?: boolean;
|
|
60
|
+
};
|
|
61
|
+
state: GridInteractionState;
|
|
62
|
+
cleanupActiveItem: (item: HTMLElement) => void;
|
|
63
|
+
dispatchItemActionEvent: DispatchItemActionEvent;
|
|
64
|
+
createItemActionsMenuPopover: (element: HTMLElement, activeAction?: string) => void;
|
|
65
|
+
}
|
|
66
|
+
export interface TriggerGridItemActionResult {
|
|
67
|
+
result: boolean | undefined;
|
|
68
|
+
state: GridInteractionState;
|
|
69
|
+
}
|
|
70
|
+
interface DeactivateGridItemsArgs {
|
|
71
|
+
gridElement: HTMLElement;
|
|
72
|
+
items: GridItemData[];
|
|
73
|
+
state: GridInteractionState;
|
|
74
|
+
cleanupActiveItem: (item: HTMLElement) => void;
|
|
75
|
+
dispatchItemActionEvent: DispatchItemActionEvent;
|
|
76
|
+
}
|
|
77
|
+
export interface DeactivateGridItemsResult {
|
|
78
|
+
deactivatedCount: number;
|
|
79
|
+
state: GridInteractionState;
|
|
80
|
+
}
|
|
81
|
+
export declare const getGridItemElementFromTarget: (target: EventTarget | null) => HTMLElement | undefined;
|
|
82
|
+
export declare const shouldRemovePopoverOnMouseout: ({ event, gridItem }: ShouldRemovePopoverOnMouseoutArgs) => boolean;
|
|
83
|
+
export declare const applyGridItemFocus: ({ event, focusedItemElement, removeItemActionsMenuPopover }: ApplyGridItemFocusArgs) => HTMLElement | undefined;
|
|
84
|
+
export declare const clearGridItemFocus: ({ event, focusedItemElement, removeItemActionsMenuPopover }: ClearGridItemFocusArgs) => ClearGridItemFocusResult;
|
|
85
|
+
export declare const resolveGridItemForDelete: (event: Event, fallback?: HTMLElement) => HTMLElement | undefined;
|
|
86
|
+
export declare const cleanupActiveGridItem: ({ item, activeItemElement, gridElement, removeItemActionsMenuPopover }: CleanupActiveGridItemArgs) => HTMLElement | undefined;
|
|
87
|
+
export declare const handleGridAction: ({ event, gridElement, items, state, cleanupActiveItem, dispatchItemActionEvent, handleDeleteItem, handleCloneItem, createItemActionsMenuPopover }: HandleGridActionArgs) => GridInteractionState;
|
|
88
|
+
export declare const handleGridClick: ({ event, gridElement, hostElement, items, activeItemActionToggle, cleanupActiveItem, dispatchItemActionEvent }: HandleGridClickArgs) => GridInteractionState;
|
|
89
|
+
export declare const triggerGridItemAction: ({ gridElement, items, gridItemData, itemId, action, options, state, cleanupActiveItem, dispatchItemActionEvent, createItemActionsMenuPopover }: TriggerGridItemActionArgs) => TriggerGridItemActionResult;
|
|
90
|
+
export declare const deactivateGridItems: ({ gridElement, items, state, cleanupActiveItem, dispatchItemActionEvent }: DeactivateGridItemsArgs) => DeactivateGridItemsResult;
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { LuzmoEmbedVizItem } from '@luzmo/embed';
|
|
2
|
+
import type { GridStack } from 'gridstack';
|
|
3
|
+
import type { GridItemData } from '../types';
|
|
4
|
+
import type { DispatchItemActionEvent } from './grid-events';
|
|
5
|
+
export interface GridItemLookup {
|
|
6
|
+
item: GridItemData;
|
|
7
|
+
element: HTMLElement;
|
|
8
|
+
luzmoElement?: LuzmoEmbedVizItem;
|
|
9
|
+
}
|
|
10
|
+
interface AddGridItemArgs {
|
|
11
|
+
newItem: GridItemData;
|
|
12
|
+
gridElement: HTMLElement;
|
|
13
|
+
grid?: GridStack;
|
|
14
|
+
createId: () => string;
|
|
15
|
+
}
|
|
16
|
+
export interface AddGridItemResult {
|
|
17
|
+
item: GridItemData;
|
|
18
|
+
element: HTMLElement;
|
|
19
|
+
}
|
|
20
|
+
interface RemoveGridItemByIdArgs {
|
|
21
|
+
id: string;
|
|
22
|
+
grid?: GridStack;
|
|
23
|
+
items: GridItemData[];
|
|
24
|
+
getGridItemById: (id: string) => GridItemLookup | undefined;
|
|
25
|
+
removeItemActionsMenuPopover: (gridItem: HTMLElement) => void;
|
|
26
|
+
activeItemElement?: HTMLElement;
|
|
27
|
+
cleanupActiveItem: (item: HTMLElement) => void;
|
|
28
|
+
}
|
|
29
|
+
interface RemoveGridItemByIdResult {
|
|
30
|
+
activeItemElement?: HTMLElement;
|
|
31
|
+
focusedItemElement?: HTMLElement;
|
|
32
|
+
}
|
|
33
|
+
interface HandleCloneItemArgs {
|
|
34
|
+
event: CustomEvent;
|
|
35
|
+
hasGrid: boolean;
|
|
36
|
+
items: GridItemData[];
|
|
37
|
+
createId: () => string;
|
|
38
|
+
addGridItem: (newItem: GridItemData) => HTMLElement;
|
|
39
|
+
dispatchItemActionEvent: DispatchItemActionEvent;
|
|
40
|
+
}
|
|
41
|
+
export declare const mapGridItems: (items: GridItemData[], gridElement: HTMLElement) => GridItemLookup[];
|
|
42
|
+
export declare const addGridItem: ({ newItem, gridElement, grid, createId }: AddGridItemArgs) => AddGridItemResult;
|
|
43
|
+
export declare const removeGridItemById: ({ id, grid, items, getGridItemById, removeItemActionsMenuPopover, activeItemElement, cleanupActiveItem }: RemoveGridItemByIdArgs) => RemoveGridItemByIdResult;
|
|
44
|
+
export declare const handleCloneItem: ({ event, hasGrid, items, createId, addGridItem: addGridItemToComponent, dispatchItemActionEvent }: HandleCloneItemArgs) => void;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Placement } from '@luzmo/lucero';
|
|
2
|
+
import { type TemplateResult } from 'lit';
|
|
3
|
+
import type { GridItemData } from '../types';
|
|
4
|
+
import type { GridItemLookup } from './grid-item-management';
|
|
5
|
+
interface CreateItemActionsMenuPopoverArgs {
|
|
6
|
+
element: HTMLElement;
|
|
7
|
+
activeAction?: string;
|
|
8
|
+
getGridItemById: (id: string) => GridItemLookup | undefined;
|
|
9
|
+
placementItemActionsMenu: Placement;
|
|
10
|
+
renderOverlayContent: (item?: GridItemData, activeAction?: string) => TemplateResult;
|
|
11
|
+
removeItemActionsMenuPopover: (gridItem: HTMLElement) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const createItemActionsMenuPopover: ({ element, activeAction, getGridItemById, placementItemActionsMenu, renderOverlayContent, removeItemActionsMenuPopover }: CreateItemActionsMenuPopoverArgs) => void;
|
|
14
|
+
export declare const removeItemActionsMenuPopover: (gridItem: HTMLElement) => void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GridStackWidget } from 'gridstack';
|
|
2
|
+
import type { GridItemData } from '../types';
|
|
3
|
+
export declare const normalizeGridItems: (items: GridItemData[], createId: () => string) => void;
|
|
4
|
+
export declare const ensureGridItemId: (item: GridItemData, createId: () => string) => string;
|
|
5
|
+
export declare const buildGridWidgetOptions: (item: GridItemData | undefined, id?: string) => GridStackWidget;
|
|
6
|
+
export declare const createGridItemFromInput: (newItem: GridItemData, id: string) => GridItemData;
|
|
7
|
+
export declare const createOrphanGridItemElement: (itemId: string) => HTMLDivElement;
|
|
8
|
+
export declare const readGridItemPosition: (gridItemElement: HTMLElement) => GridItemData["position"];
|
|
9
|
+
export declare const findGridItemElementById: (elements: Iterable<HTMLElement>, id: string | undefined) => HTMLElement | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type GridArrowKey = 'ArrowLeft' | 'ArrowRight' | 'ArrowUp' | 'ArrowDown';
|
|
2
|
+
export interface GridKeyboardNode {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
w: number;
|
|
6
|
+
h: number;
|
|
7
|
+
}
|
|
8
|
+
export type GridKeyboardUpdate = Partial<Pick<GridKeyboardNode, 'x' | 'y' | 'w' | 'h'>>;
|
|
9
|
+
export interface GridKeyboardUpdateArgs {
|
|
10
|
+
key: GridArrowKey;
|
|
11
|
+
node: GridKeyboardNode;
|
|
12
|
+
maxColumns: number;
|
|
13
|
+
shiftKey: boolean;
|
|
14
|
+
ctrlKey: boolean;
|
|
15
|
+
metaKey: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const isGridArrowKey: (key: string) => key is GridArrowKey;
|
|
18
|
+
export declare const getGridKeyboardUpdate: ({ key, node, maxColumns, shiftKey, ctrlKey, metaKey }: GridKeyboardUpdateArgs) => GridKeyboardUpdate | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { GridStack } from 'gridstack';
|
|
2
|
+
export interface HandleGridKeyDownArgs {
|
|
3
|
+
event: KeyboardEvent;
|
|
4
|
+
viewMode: boolean;
|
|
5
|
+
focusedItemElement?: HTMLElement;
|
|
6
|
+
activeItemElement?: HTMLElement;
|
|
7
|
+
gridElement: HTMLElement;
|
|
8
|
+
grid?: GridStack;
|
|
9
|
+
columns: number;
|
|
10
|
+
handleDeleteItem: (event: Event) => void;
|
|
11
|
+
removeItemActionsMenuPopover: (gridItem: HTMLElement) => void;
|
|
12
|
+
createItemActionsMenuPopover: (element: HTMLElement) => void;
|
|
13
|
+
}
|
|
14
|
+
export interface HandleGridKeyDownResult {
|
|
15
|
+
focusedItemElement?: HTMLElement;
|
|
16
|
+
activeItemElement?: HTMLElement;
|
|
17
|
+
}
|
|
18
|
+
export declare const handleGridKeyDown: ({ event, viewMode, focusedItemElement, activeItemElement, gridElement, grid, columns, handleDeleteItem, removeItemActionsMenuPopover, createItemActionsMenuPopover }: HandleGridKeyDownArgs) => HandleGridKeyDownResult;
|