@limetech/lime-crm-building-blocks 1.126.0 → 1.126.2
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/CHANGELOG.md +14 -0
- package/dist/cjs/{index.esm-QC7n_5ug.js → index.esm-C1i_NocP.js} +274 -217
- package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
- package/dist/cjs/{lime-query-validation-Djq87Kvd.js → lime-query-validation-DOruuzFE.js} +7 -7
- package/dist/cjs/limebb-browser.cjs.entry.js +1 -1
- package/dist/cjs/limebb-chat-icon-list_3.cjs.entry.js +1 -1
- package/dist/cjs/limebb-chat-list.cjs.entry.js +1 -1
- package/dist/cjs/limebb-component-config.cjs.entry.js +1 -1
- package/dist/cjs/limebb-component-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-composer-toolbar.cjs.entry.js +1 -1
- package/dist/cjs/limebb-currency-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-data-cells.cjs.entry.js +1 -1
- package/dist/cjs/limebb-date-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-feed-timeline-item.cjs.entry.js +1 -1
- package/dist/cjs/limebb-feed.cjs.entry.js +1 -1
- package/dist/cjs/limebb-info-tile.cjs.entry.js +8 -8
- package/dist/cjs/limebb-kanban-group.cjs.entry.js +2 -2
- package/dist/cjs/limebb-kanban-item.cjs.entry.js +1 -1
- package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +3 -3
- package/dist/cjs/limebb-lime-query-filter-builder_3.cjs.entry.js +6 -6
- package/dist/cjs/limebb-lime-query-filter-comparison_2.cjs.entry.js +17 -17
- package/dist/cjs/limebb-lime-query-filter-group_3.cjs.entry.js +11 -11
- package/dist/cjs/limebb-lime-query-response-format-builder.cjs.entry.js +3 -3
- package/dist/cjs/limebb-limeobject-file-viewer.cjs.entry.js +3 -3
- package/dist/cjs/limebb-loader.cjs.entry.js +1 -1
- package/dist/cjs/limebb-locale-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-mention.cjs.entry.js +1 -1
- package/dist/cjs/limebb-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/limebb-notification-list.cjs.entry.js +1 -1
- package/dist/cjs/limebb-object-chip.cjs.entry.js +3 -3
- package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +1 -1
- package/dist/cjs/limebb-property-selector.cjs.entry.js +3 -3
- package/dist/cjs/limebb-rule-chip-popover.cjs.entry.js +6 -4
- package/dist/cjs/limebb-rule-editor.cjs.entry.js +21 -18
- package/dist/cjs/limebb-rule-gate.cjs.entry.js +2 -2
- package/dist/cjs/limebb-text-editor.cjs.entry.js +5 -5
- package/dist/cjs/limebb-trend-indicator.cjs.entry.js +1 -1
- package/dist/cjs/{limetype-C1krEdDi.js → limetype-BlG0Apxb.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/rule-editor/rule-chip-popover/rule-chip-popover.js +6 -4
- package/dist/collection/components/rule-editor/rule-editor.js +14 -14
- package/dist/collection/components/rule-editor/view-helpers.js +14 -11
- package/dist/collection/components/rule-gate/rule-gate.js +6 -6
- package/dist/components/chat-item.js +1 -1
- package/dist/components/currency-picker.js +1 -1
- package/dist/components/date-picker.js +1 -1
- package/dist/components/feed-timeline-item.js +1 -1
- package/dist/components/index.esm.js +1 -1
- package/dist/components/kanban-group.js +1 -1
- package/dist/components/kanban-item.js +1 -1
- package/dist/components/lime-query-filter-builder.js +1 -1
- package/dist/components/lime-query-filter-comparison.js +1 -1
- package/dist/components/lime-query-filter-expression.js +1 -1
- package/dist/components/lime-query-validation.js +1 -1
- package/dist/components/lime-query-value-input.js +1 -1
- package/dist/components/limebb-browser.js +1 -1
- package/dist/components/limebb-chat-list.js +1 -1
- package/dist/components/limebb-component-config.js +1 -1
- package/dist/components/limebb-component-picker.js +1 -1
- package/dist/components/limebb-composer-toolbar.js +1 -1
- package/dist/components/limebb-data-cells.js +1 -1
- package/dist/components/limebb-feed.js +1 -1
- package/dist/components/limebb-info-tile.js +1 -1
- package/dist/components/limebb-lime-query-builder.js +1 -1
- package/dist/components/limebb-lime-query-response-format-builder.js +1 -1
- package/dist/components/limebb-limeobject-file-viewer.js +1 -1
- package/dist/components/limebb-loader.js +1 -1
- package/dist/components/limebb-locale-picker.js +1 -1
- package/dist/components/limebb-mention.js +1 -1
- package/dist/components/limebb-notification-list.js +1 -1
- package/dist/components/limebb-object-chip.js +1 -1
- package/dist/components/limebb-rule-editor.js +1 -1
- package/dist/components/limebb-rule-gate.js +1 -1
- package/dist/components/limebb-text-editor.js +1 -1
- package/dist/components/limebb-trend-indicator.js +1 -1
- package/dist/components/limetype-field.js +1 -1
- package/dist/components/notification-item.js +1 -1
- package/dist/components/percentage-visualizer.js +1 -1
- package/dist/components/property-selector.js +1 -1
- package/dist/components/rule-chip-popover.js +1 -1
- package/dist/esm/{index.esm-EC5zE5lw.js → index.esm-CMeGYws2.js} +267 -210
- package/dist/esm/lime-crm-building-blocks.js +1 -1
- package/dist/esm/{lime-query-validation-Dav-tsNr.js → lime-query-validation-DvCLebd2.js} +7 -7
- package/dist/esm/limebb-browser.entry.js +1 -1
- package/dist/esm/limebb-chat-icon-list_3.entry.js +1 -1
- package/dist/esm/limebb-chat-list.entry.js +1 -1
- package/dist/esm/limebb-component-config.entry.js +1 -1
- package/dist/esm/limebb-component-picker.entry.js +1 -1
- package/dist/esm/limebb-composer-toolbar.entry.js +1 -1
- package/dist/esm/limebb-currency-picker.entry.js +1 -1
- package/dist/esm/limebb-data-cells.entry.js +1 -1
- package/dist/esm/limebb-date-picker.entry.js +1 -1
- package/dist/esm/limebb-feed-timeline-item.entry.js +1 -1
- package/dist/esm/limebb-feed.entry.js +1 -1
- package/dist/esm/limebb-info-tile.entry.js +8 -8
- package/dist/esm/limebb-kanban-group.entry.js +2 -2
- package/dist/esm/limebb-kanban-item.entry.js +1 -1
- package/dist/esm/limebb-lime-query-builder.entry.js +3 -3
- package/dist/esm/limebb-lime-query-filter-builder_3.entry.js +6 -6
- package/dist/esm/limebb-lime-query-filter-comparison_2.entry.js +17 -17
- package/dist/esm/limebb-lime-query-filter-group_3.entry.js +11 -11
- package/dist/esm/limebb-lime-query-response-format-builder.entry.js +3 -3
- package/dist/esm/limebb-limeobject-file-viewer.entry.js +3 -3
- package/dist/esm/limebb-loader.entry.js +1 -1
- package/dist/esm/limebb-locale-picker.entry.js +1 -1
- package/dist/esm/limebb-mention.entry.js +1 -1
- package/dist/esm/limebb-notification-item.entry.js +1 -1
- package/dist/esm/limebb-notification-list.entry.js +1 -1
- package/dist/esm/limebb-object-chip.entry.js +3 -3
- package/dist/esm/limebb-percentage-visualizer.entry.js +1 -1
- package/dist/esm/limebb-property-selector.entry.js +3 -3
- package/dist/esm/limebb-rule-chip-popover.entry.js +6 -4
- package/dist/esm/limebb-rule-editor.entry.js +21 -18
- package/dist/esm/limebb-rule-gate.entry.js +2 -2
- package/dist/esm/limebb-text-editor.entry.js +5 -5
- package/dist/esm/limebb-trend-indicator.entry.js +1 -1
- package/dist/esm/{limetype-COL4hyNy.js → limetype-DvPoeXt-.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/{p-7d51a34c.entry.js → p-006b6449.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-c469db7e.entry.js → p-10ddd002.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-277b6ad4.entry.js → p-1955495c.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-11494f30.entry.js → p-25234f4b.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-abcb1e49.entry.js → p-2a05b949.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-30778dac.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-1797622d.entry.js → p-47799e80.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-fd6dcfe3.entry.js → p-49b8a9ca.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-6093254e.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-b8d9ff68.entry.js → p-610dae2e.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-62b247c1.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-65ea94b4.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-dd38e0ba.entry.js → p-7975c91f.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-c4f41ec4.entry.js → p-7ace2e41.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-8084e825.entry.js → p-89170cc9.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-3781a766.entry.js → p-92738a30.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-71a6f624.entry.js → p-99054b73.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-f09c7244.entry.js → p-993991af.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-f0a567f3.entry.js → p-99790629.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-74455a30.entry.js → p-9ccd9d7f.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-f5244a1a.entry.js → p-9f03e766.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-CAMipqwt.js → p-CI7dwT4T.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-C25FPZQh.js → p-CYiNR7pQ.js} +1 -1
- package/dist/lime-crm-building-blocks/p-D5qhls4G.js +1 -0
- package/dist/lime-crm-building-blocks/{p-8d6cc027.entry.js → p-a3439b73.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-6ada2b2b.entry.js → p-a634c792.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-b1a8d1a0.entry.js → p-b978301b.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-43a7facd.entry.js → p-beae8aa1.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-e6ed33ff.entry.js → p-c3a72b03.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-6d3a9ed3.entry.js → p-c43dc121.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-7a125570.entry.js → p-d026068f.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-d1c61830.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-057e1638.entry.js → p-d33efebb.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-24fc049c.entry.js → p-e1e1e2d1.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-c139ab98.entry.js → p-e468e359.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-35c72752.entry.js → p-ea461bb7.entry.js} +1 -1
- package/dist/types/components/rule-editor/rule-editor.d.ts +5 -5
- package/dist/types/components/rule-editor/view-helpers.d.ts +7 -3
- package/dist/types/components/rule-gate/rule-gate.d.ts +2 -2
- package/dist/types/components.d.ts +12 -12
- package/package.json +4 -5
- package/dist/lime-crm-building-blocks/p-1831e571.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-3313e357.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-7922726c.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-BeLcuSg8.js +0 -1
- package/dist/lime-crm-building-blocks/p-cefb24bb.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-e717bdff.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as e,HTMLElement as i,createEvent as t,h as r,Host as s,transformTag as o}from"@stencil/core/internal/client";import{j as l}from"./index.esm.js";import{i as a}from"./lime-query-validation.js";import{d as m}from"./lime-query-filter-builder.js";import{d}from"./lime-query-filter-comparison.js";import{e as n,b as u,d as h}from"./lime-query-filter-expression.js";import{d as b}from"./order-by-editor.js";import{d as c}from"./order-by-item.js";import{d as p}from"./response-format-editor.js";import{d as f}from"./response-format-item.js";import{d as y}from"./lime-query-value-input.js";import{d as v}from"./limetype-field.js";import{d as g}from"./property-selector.js";const q=e(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.change=t(this,"change",7),this.mode="visual",this.codeValue="",this.limetype="",this.handleLimetypeChange=e=>{e.stopPropagation(),this.limetype=e.detail,this.filter=void 0,this.internalResponseFormat={object:{}},this.emitChange()},this.handleFilterChange=e=>{var i;e.stopPropagation(),this.filter=null!==(i=e.detail)&&void 0!==i?i:void 0,this.emitChange()},this.handleResponseFormatChange=e=>{e.stopPropagation(),this.internalResponseFormat=e.detail,this.emitChange()},this.handleLimitChange=e=>{e.stopPropagation();const i=e.detail;this.limit=i?Number.parseInt(i,10):void 0,this.emitChange()},this.handleOrderByChange=e=>{e.stopPropagation(),this.orderBy=e.detail,this.emitChange()},this.handleDescriptionChange=e=>{e.stopPropagation(),this.description=e.detail||void 0,this.emitChange()},this.handleDescriptionBlur=()=>{if(this.description){const e=this.description.trim();e!==this.description&&(this.description=e||void 0,this.emitChange())}},this.handleChange=e=>{e.stopPropagation();const i=e.detail.id;if("visual"===i)try{const e=JSON.parse(this.codeValue);if(!this.checkVisualModeSupport().visualModeSupported)return;this.limetype=e.limetype||"",this.filter=e.filter,this.internalResponseFormat=e.responseFormat,this.limit=e.limit,this.orderBy=e.orderBy,this.description=e["#description"],this.mode="visual",this.change.emit(e)}catch(e){}else"code"===i&&(this.updateCodeValue(),this.mode="code")},this.handleCodeChange=e=>{e.stopPropagation(),this.codeValue=e.detail;try{const e=JSON.parse(this.codeValue);this.change.emit(e)}catch(e){}}}getButtons(){return[{id:"visual",title:"Visual"},{id:"code",title:"Code"}]}get visualModeEnabled(){var e,i,t;return null!==(t=null===(i=null===(e=this.platform)||void 0===e?void 0:e.isFeatureEnabled)||void 0===i?void 0:i.call(e,"useLimeQueryBuilderGuiMode"))&&void 0!==t&&t}componentWillLoad(){if(!this.visualModeEnabled)return this.mode="code",void this.updateCodeValue();this.value&&(this.limetype=this.value.limetype||"",this.filter=this.value.filter,this.internalResponseFormat=this.value.responseFormat,this.limit=this.value.limit,this.orderBy=this.value.orderBy,this.description=this.value["#description"]),this.updateCodeValue(),this.checkVisualModeSupport().visualModeSupported||(this.mode="code")}render(){return r(s,{key:"9a121529165f1691e32b2b156b128977c5b5ba3a"},this.renderHeader(),this.renderContent())}renderContent(){const e=this.checkVisualModeSupport();return this.visualModeEnabled&&"code"!==this.mode?this.renderVisualMode():this.renderCodeMode(e)}emitChange(){"code"!==this.mode&&this.limetype&&this.change.emit(this.buildLimeQuery())}updateCodeValue(){this.codeValue=JSON.stringify(this.limetype?this.buildLimeQuery():this.value||{},null,2)}buildLimeQuery(){const e={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter};return this.description&&(e["#description"]=this.description),void 0!==this.limit&&this.limit>0&&(e.limit=this.limit),this.orderBy&&this.orderBy.length>0&&(e.orderBy=this.orderBy),e}checkVisualModeSupport(){if(!this.limetypes)return{valid:!0,visualModeSupported:!0,validationErrors:[],visualModeLimitations:[]};let e;if("code"===this.mode&&this.codeValue)try{e=JSON.parse(this.codeValue)}catch(e){return{valid:!1,visualModeSupported:!1,validationErrors:["Invalid JSON"],visualModeLimitations:[]}}else{if(!this.limetype)return{valid:!0,visualModeSupported:!0,validationErrors:[],visualModeLimitations:[]};e={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter},void 0!==this.limit&&this.limit>0&&(e.limit=this.limit)}return a(e,this.limetypes,this.activeLimetype,this.visualModeEnabled)}renderModeSwitch(e){const i=!e.visualModeSupported,t=this.getButtons().map((e=>Object.assign(Object.assign({},e),{selected:e.id===this.mode})));return r("limel-button-group",{slot:"actions",onChange:this.handleChange,value:t,disabled:i})}renderCodeEditor(e){return[r("limel-code-editor",{value:this.codeValue,language:"json",lineNumbers:!0,fold:!0,lint:!0,onChange:this.handleCodeChange}),!e.valid&&e.validationErrors.length>0&&r("div",{class:"validation-errors"},r("strong",null,"Invalid Lime Query:"),r("ul",null,e.validationErrors.map((e=>r("li",null,e))))),this.visualModeEnabled&&e.valid&&!e.visualModeSupported&&e.visualModeLimitations.length>0&&r("div",{class:"visual-mode-limitations"},r("strong",null,"Cannot switch to visual mode:"),r("ul",null,e.visualModeLimitations.map((e=>r("li",null,e)))))]}renderLimetypeSection(){return r("limebb-limetype-field",{platform:this.platform,context:this.context,label:"Limetype",value:this.limetype,required:!0,fieldName:"limetype",onChange:this.handleLimetypeChange})}renderDescriptionSection(){if(this.limetype)return r("section",{class:"description"},r("limel-input-field",{label:"Description",type:"textarea",value:this.description||"",placeholder:"Describe what data this query retrieves...",helperText:"Optional: Help AI agents and humans understand the query purpose",onChange:this.handleDescriptionChange,onBlur:this.handleDescriptionBlur}))}renderResponseFormatSection(){if(this.limetype)return r("section",{class:"response-format"},r("limebb-lime-query-response-format-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.internalResponseFormat,onChange:this.handleResponseFormatChange}))}renderFilterSection(){if(this.limetype)return r("section",{class:"filter"},r("limel-header",{class:"is-narrow",heading:"Filter Conditions",icon:"-lime-filter"}),r("limebb-lime-query-filter-builder",{platform:this.platform,context:this.context,limetype:this.limetype,activeLimetype:this.activeLimetype,expression:this.filter,onExpressionChange:this.handleFilterChange}))}renderQueryOptionsSection(){var e;if(this.limetype)return r("section",{class:"query-options"},r("limel-header",{class:"is-narrow",heading:"Query Options",icon:"ask_question"}),r("div",{class:"query-options-controls"},r("limel-input-field",{label:"Limit",type:"number",value:(null===(e=this.limit)||void 0===e?void 0:""+e)||"",placeholder:"No limit",helperText:"Maximum number of results",onChange:this.handleLimitChange}),r("limebb-lime-query-order-by-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.orderBy,onChange:this.handleOrderByChange})))}renderVisualMode(){return r("div",{class:"visual-mode"},this.renderLimetypeSection(),this.renderDescriptionSection(),this.renderResponseFormatSection(),this.renderFilterSection(),this.renderQueryOptionsSection())}renderHeader(){const e=this.checkVisualModeSupport();return r("limel-header",{heading:this.label},this.renderModeControls(e))}renderModeControls(e){if(this.visualModeEnabled)return this.renderModeSwitch(e)}renderCodeMode(e){return r("div",{class:"code-mode"},this.renderCodeEditor(e))}static get style(){return"*,*:before,*:after{box-sizing:border-box}:host(limebb-lime-query-builder){--header-background-color:rgb(var(--contrast-500));--limebb-lime-query-builder-background-color:rgb(var(--contrast-100));--limebb-lime-query-builder-border-radius:0.75rem;--limebb-lime-query-builder-visual-mode-padding:1rem;--limebb-lime-query-builder-group-color:rgb(var(--color-sky-lighter));box-sizing:border-box;width:calc(100% - 1.5rem);margin:0.75rem auto;display:flex;flex-direction:column;border-radius:var(--limebb-lime-query-builder-border-radius);background-color:var(--limebb-lime-query-builder-background-color);box-shadow:var(--shadow-inflated-16)}.visual-mode{display:flex;flex-direction:column;gap:1rem;padding:var(--limebb-lime-query-builder-visual-mode-padding);border:1px solid var(--header-background-color);border-radius:0 0 var(--limebb-lime-query-builder-border-radius) var(--limebb-lime-query-builder-border-radius)}.code-mode{--code-editor-max-height:70vh;display:flex;flex-direction:column;gap:1rem}.code-mode .validation-errors{padding:0.75rem 1rem;color:rgb(var(--color-red-default));background-color:rgb(var(--color-red-lighter));border-left:0.25rem solid rgb(var(--color-red-default));border-radius:0.25rem;font-size:0.875rem}.code-mode .validation-errors strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-mode .validation-errors ul{margin:0;padding-left:1.5rem}.code-mode .validation-errors li{margin:0.25rem 0}.code-mode .visual-mode-limitations{padding:0.75rem 1rem;color:rgb(var(--color-blue-dark));background-color:rgb(var(--color-blue-lighter));border-left:0.25rem solid rgb(var(--color-blue-default));border-radius:0.25rem;font-size:0.875rem}.code-mode .visual-mode-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-mode .visual-mode-limitations ul{margin:0;padding-left:1.5rem}.code-mode .visual-mode-limitations li{margin:0.25rem 0}section.description,section.filter,section.query-options{display:flex;flex-direction:column;gap:1rem}section h4{margin:0;font-size:1.125rem;font-weight:600;color:rgb(var(--contrast-1000))}limel-header.is-narrow{--header-top-right-left-border-radius:0;width:calc(100% + var(--limebb-lime-query-builder-visual-mode-padding) * 2);margin-left:calc(var(--limebb-lime-query-builder-visual-mode-padding) * -1)}.query-options-controls{display:flex;flex-direction:column;gap:1rem}"}},[1,"limebb-lime-query-builder",{platform:[16],context:[16],value:[16],label:[1],activeLimetype:[1,"active-limetype"],limetypes:[32],mode:[32],codeValue:[32],limetype:[32],filter:[32],internalResponseFormat:[32],limit:[32],orderBy:[32],description:[32]}]);!function(e,i,t,r){var s,o=arguments.length,l=o<3?i:null===r?r=Object.getOwnPropertyDescriptor(i,t):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,i,t,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(l=(o<3?s(l):o>3?s(i,t,l):s(i,t))||l);o>3&&l&&Object.defineProperty(i,t,l)}([l()],q.prototype,"limetypes",void 0);const x=q,k=function(){"undefined"!=typeof customElements&&["limebb-lime-query-builder","limebb-lime-query-filter-builder","limebb-lime-query-filter-comparison","limebb-lime-query-filter-expression","limebb-lime-query-filter-group","limebb-lime-query-filter-not","limebb-lime-query-order-by-editor","limebb-lime-query-order-by-item","limebb-lime-query-response-format-editor","limebb-lime-query-response-format-item","limebb-lime-query-value-input","limebb-limetype-field","limebb-property-selector"].forEach((e=>{switch(e){case"limebb-lime-query-builder":customElements.get(o(e))||customElements.define(o(e),q);break;case"limebb-lime-query-filter-builder":customElements.get(o(e))||m();break;case"limebb-lime-query-filter-comparison":customElements.get(o(e))||d();break;case"limebb-lime-query-filter-expression":customElements.get(o(e))||h();break;case"limebb-lime-query-filter-group":customElements.get(o(e))||u();break;case"limebb-lime-query-filter-not":customElements.get(o(e))||n();break;case"limebb-lime-query-order-by-editor":customElements.get(o(e))||b();break;case"limebb-lime-query-order-by-item":customElements.get(o(e))||c();break;case"limebb-lime-query-response-format-editor":customElements.get(o(e))||p();break;case"limebb-lime-query-response-format-item":customElements.get(o(e))||f();break;case"limebb-lime-query-value-input":customElements.get(o(e))||y();break;case"limebb-limetype-field":customElements.get(o(e))||v();break;case"limebb-property-selector":customElements.get(o(e))||g()}}))};export{x as LimebbLimeQueryBuilder,k as defineCustomElement}
|
|
1
|
+
import{proxyCustomElement as e,HTMLElement as i,createEvent as t,h as r,Host as s,transformTag as o}from"@stencil/core/internal/client";import{L as l}from"./index.esm.js";import{i as a}from"./lime-query-validation.js";import{d as m}from"./lime-query-filter-builder.js";import{d}from"./lime-query-filter-comparison.js";import{e as n,b as u,d as h}from"./lime-query-filter-expression.js";import{d as b}from"./order-by-editor.js";import{d as c}from"./order-by-item.js";import{d as p}from"./response-format-editor.js";import{d as f}from"./response-format-item.js";import{d as y}from"./lime-query-value-input.js";import{d as v}from"./limetype-field.js";import{d as g}from"./property-selector.js";const q=e(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.change=t(this,"change",7),this.mode="visual",this.codeValue="",this.limetype="",this.handleLimetypeChange=e=>{e.stopPropagation(),this.limetype=e.detail,this.filter=void 0,this.internalResponseFormat={object:{}},this.emitChange()},this.handleFilterChange=e=>{var i;e.stopPropagation(),this.filter=null!==(i=e.detail)&&void 0!==i?i:void 0,this.emitChange()},this.handleResponseFormatChange=e=>{e.stopPropagation(),this.internalResponseFormat=e.detail,this.emitChange()},this.handleLimitChange=e=>{e.stopPropagation();const i=e.detail;this.limit=i?Number.parseInt(i,10):void 0,this.emitChange()},this.handleOrderByChange=e=>{e.stopPropagation(),this.orderBy=e.detail,this.emitChange()},this.handleDescriptionChange=e=>{e.stopPropagation(),this.description=e.detail||void 0,this.emitChange()},this.handleDescriptionBlur=()=>{if(this.description){const e=this.description.trim();e!==this.description&&(this.description=e||void 0,this.emitChange())}},this.handleChange=e=>{e.stopPropagation();const i=e.detail.id;if("visual"===i)try{const e=JSON.parse(this.codeValue);if(!this.checkVisualModeSupport().visualModeSupported)return;this.limetype=e.limetype||"",this.filter=e.filter,this.internalResponseFormat=e.responseFormat,this.limit=e.limit,this.orderBy=e.orderBy,this.description=e["#description"],this.mode="visual",this.change.emit(e)}catch(e){}else"code"===i&&(this.updateCodeValue(),this.mode="code")},this.handleCodeChange=e=>{e.stopPropagation(),this.codeValue=e.detail;try{const e=JSON.parse(this.codeValue);this.change.emit(e)}catch(e){}}}getButtons(){return[{id:"visual",title:"Visual"},{id:"code",title:"Code"}]}get visualModeEnabled(){var e,i,t;return null!==(t=null===(i=null===(e=this.platform)||void 0===e?void 0:e.isFeatureEnabled)||void 0===i?void 0:i.call(e,"useLimeQueryBuilderGuiMode"))&&void 0!==t&&t}componentWillLoad(){if(!this.visualModeEnabled)return this.mode="code",void this.updateCodeValue();this.value&&(this.limetype=this.value.limetype||"",this.filter=this.value.filter,this.internalResponseFormat=this.value.responseFormat,this.limit=this.value.limit,this.orderBy=this.value.orderBy,this.description=this.value["#description"]),this.updateCodeValue(),this.checkVisualModeSupport().visualModeSupported||(this.mode="code")}render(){return r(s,{key:"9a121529165f1691e32b2b156b128977c5b5ba3a"},this.renderHeader(),this.renderContent())}renderContent(){const e=this.checkVisualModeSupport();return this.visualModeEnabled&&"code"!==this.mode?this.renderVisualMode():this.renderCodeMode(e)}emitChange(){"code"!==this.mode&&this.limetype&&this.change.emit(this.buildLimeQuery())}updateCodeValue(){this.codeValue=JSON.stringify(this.limetype?this.buildLimeQuery():this.value||{},null,2)}buildLimeQuery(){const e={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter};return this.description&&(e["#description"]=this.description),void 0!==this.limit&&this.limit>0&&(e.limit=this.limit),this.orderBy&&this.orderBy.length>0&&(e.orderBy=this.orderBy),e}checkVisualModeSupport(){if(!this.limetypes)return{valid:!0,visualModeSupported:!0,validationErrors:[],visualModeLimitations:[]};let e;if("code"===this.mode&&this.codeValue)try{e=JSON.parse(this.codeValue)}catch(e){return{valid:!1,visualModeSupported:!1,validationErrors:["Invalid JSON"],visualModeLimitations:[]}}else{if(!this.limetype)return{valid:!0,visualModeSupported:!0,validationErrors:[],visualModeLimitations:[]};e={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter},void 0!==this.limit&&this.limit>0&&(e.limit=this.limit)}return a(e,this.limetypes,this.activeLimetype,this.visualModeEnabled)}renderModeSwitch(e){const i=!e.visualModeSupported,t=this.getButtons().map((e=>Object.assign(Object.assign({},e),{selected:e.id===this.mode})));return r("limel-button-group",{slot:"actions",onChange:this.handleChange,value:t,disabled:i})}renderCodeEditor(e){return[r("limel-code-editor",{value:this.codeValue,language:"json",lineNumbers:!0,fold:!0,lint:!0,onChange:this.handleCodeChange}),!e.valid&&e.validationErrors.length>0&&r("div",{class:"validation-errors"},r("strong",null,"Invalid Lime Query:"),r("ul",null,e.validationErrors.map((e=>r("li",null,e))))),this.visualModeEnabled&&e.valid&&!e.visualModeSupported&&e.visualModeLimitations.length>0&&r("div",{class:"visual-mode-limitations"},r("strong",null,"Cannot switch to visual mode:"),r("ul",null,e.visualModeLimitations.map((e=>r("li",null,e)))))]}renderLimetypeSection(){return r("limebb-limetype-field",{platform:this.platform,context:this.context,label:"Limetype",value:this.limetype,required:!0,fieldName:"limetype",onChange:this.handleLimetypeChange})}renderDescriptionSection(){if(this.limetype)return r("section",{class:"description"},r("limel-input-field",{label:"Description",type:"textarea",value:this.description||"",placeholder:"Describe what data this query retrieves...",helperText:"Optional: Help AI agents and humans understand the query purpose",onChange:this.handleDescriptionChange,onBlur:this.handleDescriptionBlur}))}renderResponseFormatSection(){if(this.limetype)return r("section",{class:"response-format"},r("limebb-lime-query-response-format-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.internalResponseFormat,onChange:this.handleResponseFormatChange}))}renderFilterSection(){if(this.limetype)return r("section",{class:"filter"},r("limel-header",{class:"is-narrow",heading:"Filter Conditions",icon:"-lime-filter"}),r("limebb-lime-query-filter-builder",{platform:this.platform,context:this.context,limetype:this.limetype,activeLimetype:this.activeLimetype,expression:this.filter,onExpressionChange:this.handleFilterChange}))}renderQueryOptionsSection(){var e;if(this.limetype)return r("section",{class:"query-options"},r("limel-header",{class:"is-narrow",heading:"Query Options",icon:"ask_question"}),r("div",{class:"query-options-controls"},r("limel-input-field",{label:"Limit",type:"number",value:(null===(e=this.limit)||void 0===e?void 0:""+e)||"",placeholder:"No limit",helperText:"Maximum number of results",onChange:this.handleLimitChange}),r("limebb-lime-query-order-by-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.orderBy,onChange:this.handleOrderByChange})))}renderVisualMode(){return r("div",{class:"visual-mode"},this.renderLimetypeSection(),this.renderDescriptionSection(),this.renderResponseFormatSection(),this.renderFilterSection(),this.renderQueryOptionsSection())}renderHeader(){const e=this.checkVisualModeSupport();return r("limel-header",{heading:this.label},this.renderModeControls(e))}renderModeControls(e){if(this.visualModeEnabled)return this.renderModeSwitch(e)}renderCodeMode(e){return r("div",{class:"code-mode"},this.renderCodeEditor(e))}static get style(){return"*,*:before,*:after{box-sizing:border-box}:host(limebb-lime-query-builder){--header-background-color:rgb(var(--contrast-500));--limebb-lime-query-builder-background-color:rgb(var(--contrast-100));--limebb-lime-query-builder-border-radius:0.75rem;--limebb-lime-query-builder-visual-mode-padding:1rem;--limebb-lime-query-builder-group-color:rgb(var(--color-sky-lighter));box-sizing:border-box;width:calc(100% - 1.5rem);margin:0.75rem auto;display:flex;flex-direction:column;border-radius:var(--limebb-lime-query-builder-border-radius);background-color:var(--limebb-lime-query-builder-background-color);box-shadow:var(--shadow-inflated-16)}.visual-mode{display:flex;flex-direction:column;gap:1rem;padding:var(--limebb-lime-query-builder-visual-mode-padding);border:1px solid var(--header-background-color);border-radius:0 0 var(--limebb-lime-query-builder-border-radius) var(--limebb-lime-query-builder-border-radius)}.code-mode{--code-editor-max-height:70vh;display:flex;flex-direction:column;gap:1rem}.code-mode .validation-errors{padding:0.75rem 1rem;color:rgb(var(--color-red-default));background-color:rgb(var(--color-red-lighter));border-left:0.25rem solid rgb(var(--color-red-default));border-radius:0.25rem;font-size:0.875rem}.code-mode .validation-errors strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-mode .validation-errors ul{margin:0;padding-left:1.5rem}.code-mode .validation-errors li{margin:0.25rem 0}.code-mode .visual-mode-limitations{padding:0.75rem 1rem;color:rgb(var(--color-blue-dark));background-color:rgb(var(--color-blue-lighter));border-left:0.25rem solid rgb(var(--color-blue-default));border-radius:0.25rem;font-size:0.875rem}.code-mode .visual-mode-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-mode .visual-mode-limitations ul{margin:0;padding-left:1.5rem}.code-mode .visual-mode-limitations li{margin:0.25rem 0}section.description,section.filter,section.query-options{display:flex;flex-direction:column;gap:1rem}section h4{margin:0;font-size:1.125rem;font-weight:600;color:rgb(var(--contrast-1000))}limel-header.is-narrow{--header-top-right-left-border-radius:0;width:calc(100% + var(--limebb-lime-query-builder-visual-mode-padding) * 2);margin-left:calc(var(--limebb-lime-query-builder-visual-mode-padding) * -1)}.query-options-controls{display:flex;flex-direction:column;gap:1rem}"}},[1,"limebb-lime-query-builder",{platform:[16],context:[16],value:[16],label:[1],activeLimetype:[1,"active-limetype"],limetypes:[32],mode:[32],codeValue:[32],limetype:[32],filter:[32],internalResponseFormat:[32],limit:[32],orderBy:[32],description:[32]}]);!function(e,i,t,r){var s,o=arguments.length,l=o<3?i:null===r?r=Object.getOwnPropertyDescriptor(i,t):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,i,t,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(l=(o<3?s(l):o>3?s(i,t,l):s(i,t))||l);o>3&&l&&Object.defineProperty(i,t,l)}([l()],q.prototype,"limetypes",void 0);const x=q,k=function(){"undefined"!=typeof customElements&&["limebb-lime-query-builder","limebb-lime-query-filter-builder","limebb-lime-query-filter-comparison","limebb-lime-query-filter-expression","limebb-lime-query-filter-group","limebb-lime-query-filter-not","limebb-lime-query-order-by-editor","limebb-lime-query-order-by-item","limebb-lime-query-response-format-editor","limebb-lime-query-response-format-item","limebb-lime-query-value-input","limebb-limetype-field","limebb-property-selector"].forEach((e=>{switch(e){case"limebb-lime-query-builder":customElements.get(o(e))||customElements.define(o(e),q);break;case"limebb-lime-query-filter-builder":customElements.get(o(e))||m();break;case"limebb-lime-query-filter-comparison":customElements.get(o(e))||d();break;case"limebb-lime-query-filter-expression":customElements.get(o(e))||h();break;case"limebb-lime-query-filter-group":customElements.get(o(e))||u();break;case"limebb-lime-query-filter-not":customElements.get(o(e))||n();break;case"limebb-lime-query-order-by-editor":customElements.get(o(e))||b();break;case"limebb-lime-query-order-by-item":customElements.get(o(e))||c();break;case"limebb-lime-query-response-format-editor":customElements.get(o(e))||p();break;case"limebb-lime-query-response-format-item":customElements.get(o(e))||f();break;case"limebb-lime-query-value-input":customElements.get(o(e))||y();break;case"limebb-limetype-field":customElements.get(o(e))||v();break;case"limebb-property-selector":customElements.get(o(e))||g()}}))};export{x as LimebbLimeQueryBuilder,k as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as e,HTMLElement as t,createEvent as i,h as o,transformTag as r}from"@stencil/core/internal/client";import{
|
|
1
|
+
import{proxyCustomElement as e,HTMLElement as t,createEvent as i,h as o,transformTag as r}from"@stencil/core/internal/client";import{L as s}from"./index.esm.js";import{v as l}from"./lime-query-validation.js";import{d as a}from"./response-format-editor.js";import{d as n}from"./response-format-item.js";import{d}from"./property-selector.js";function m(e){let t;try{t=JSON.parse(e)}catch(e){throw Error("Invalid JSON: "+e.message)}if(null===t||"object"!=typeof t)throw Error("Response format must be an object");const i=new Set(["object","aggregates"]),o=Object.keys(t),r=o.filter((e=>!i.has(e)));if(r.length>0)throw Error(`Unexpected properties in response format: ${r.join(", ")}. Only 'object' and 'aggregates' are allowed.`);if(o.length>0&&!t.object&&!t.aggregates)throw Error("Response format must contain at least one of: object, aggregates");return t}const c=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.change=i(this,"change",7),this.label="Response Format",this.helperText="",this.mode="visual",this.codeValue="",this.handleModeChange=e=>{e.stopPropagation();const t=e.detail.id;"visual"===t?this.switchToVisualMode():"code"===t&&this.switchToCode()},this.switchToVisualMode=()=>{try{const e=m(this.codeValue);if(!l(e,this.limetypes,this.limetype,this.visualModeEnabled).visualModeSupported)return;this.internalValue=e,this.mode="visual",this.change.emit(e)}catch(e){}},this.switchToCode=()=>{this.updateCodeValue(),this.mode="code"},this.handleCodeChange=e=>{e.stopPropagation(),this.codeValue=e.detail;try{const e=m(this.codeValue);this.internalValue=e,this.change.emit(e)}catch(e){}},this.handleVisualModeChange=e=>{e.stopPropagation(),this.internalValue=e.detail,this.updateCodeValue(),this.change.emit(e.detail)}}get visualModeEnabled(){var e,t,i;return null!==(i=null===(t=null===(e=this.platform)||void 0===e?void 0:e.isFeatureEnabled)||void 0===t?void 0:t.call(e,"useLimeQueryBuilderGuiMode"))&&void 0!==i&&i}componentWillLoad(){this.internalValue=this.value||{object:{_id:null}},this.updateCodeValue(),this.visualModeEnabled&&this.checkVisualModeSupport().visualModeSupported||(this.mode="code")}componentWillUpdate(){this.value&&"visual"===this.mode&&(this.internalValue=this.value)}render(){const e=this.checkVisualModeSupport();return o("div",{key:"65a41f46fe1088f0d52be0337c427177a1aa1a44",class:"response-format-builder"},this.label&&o("h1",{key:"5a75e321aee3ff6753baccbd72d17c5377f28d28",class:"builder-label"},this.label),this.helperText&&o("p",{key:"e13518253b52ff8f847575b4465dc2295c7452f0",class:"builder-helper-text"},this.helperText),this.visualModeEnabled&&o("div",{key:"2122357f51fd2185d1b544381eb2199de5b1f56c",class:"mode-controls"},this.renderModeSwitch(e)),this.visualModeEnabled&&"code"!==this.mode?o("div",{class:"visual-mode"},this.renderVisualMode()):o("div",{class:"code-mode"},this.renderCodeEditor(e)))}renderModeSwitch(e){const t=!e.visualModeSupported,i=[{id:"visual",title:"Visual"},{id:"code",title:"Code"}].map((e=>Object.assign(Object.assign({},e),{selected:e.id===this.mode})));return o("limel-button-group",{value:i,disabled:t,onChange:this.handleModeChange})}renderCodeEditor(e){return o("div",{class:"code-editor-container"},o("limel-code-editor",{value:this.codeValue,language:"json",lineNumbers:!0,fold:!0,lint:!0,onChange:this.handleCodeChange}),!e.valid&&e.validationErrors.length>0&&o("div",{class:"validation-errors"},o("strong",null,"Invalid Response Format:"),o("ul",null,e.validationErrors.map((e=>o("li",null,e))))),this.visualModeEnabled&&e.valid&&!e.visualModeSupported&&e.visualModeLimitations.length>0&&o("div",{class:"visual-mode-limitations"},o("strong",null,"Cannot switch to visual mode:"),o("ul",null,e.visualModeLimitations.map((e=>o("li",null,e))))))}renderVisualMode(){return o("limebb-lime-query-response-format-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.internalValue,onChange:this.handleVisualModeChange})}checkVisualModeSupport(){if(!this.limetypes)return{valid:!1,visualModeSupported:!1,validationErrors:["Limetypes not loaded"],visualModeLimitations:[]};let e;if("code"===this.mode)try{e=m(this.codeValue)}catch(e){return{valid:!1,visualModeSupported:!1,validationErrors:[e.message],visualModeLimitations:[]}}else e=this.internalValue;return l(e,this.limetypes,this.limetype,this.visualModeEnabled)}updateCodeValue(){this.codeValue=function(e){return JSON.stringify(e,null,2)}(this.internalValue)}static get style(){return":host(limebb-lime-query-response-format-builder){display:block;width:100%}.response-format-builder{display:flex;flex-direction:column}.builder-label{color:rgb(var(--contrast-1100));font-size:1.625rem;line-height:1.25rem;font-weight:300;margin-top:1rem;margin-bottom:0.25rem}.builder-helper-text{margin-top:0px;margin-bottom:0.5rem;font-size:var(--limel-theme-default-font-size);color:rgb(var(--contrast-1100))}.mode-controls{display:flex;justify-content:flex-end;padding:0.5rem}.visual-mode,.code-mode{display:block}.code-editor-container{--code-editor-max-height:70vh;display:flex;flex-direction:column;gap:1rem}.code-editor-container .validation-errors{padding:0.75rem 1rem;color:rgb(var(--color-red-default));background-color:rgb(var(--color-red-lighter));border-left:0.25rem solid rgb(var(--color-red-default));border-radius:0.25rem;font-size:0.875rem}.code-editor-container .validation-errors strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-editor-container .validation-errors ul{margin:0;padding-left:1.5rem}.code-editor-container .validation-errors li{margin:0.25rem 0}.code-editor-container .visual-mode-limitations{padding:0.75rem 1rem;color:rgb(var(--color-blue-dark));background-color:rgb(var(--color-blue-lighter));border-left:0.25rem solid rgb(var(--color-blue-default));border-radius:0.25rem;font-size:0.875rem}.code-editor-container .visual-mode-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-editor-container .visual-mode-limitations ul{margin:0;padding-left:1.5rem}.code-editor-container .visual-mode-limitations li{margin:0.25rem 0}"}},[1,"limebb-lime-query-response-format-builder",{platform:[16],context:[16],limetype:[1],value:[16],label:[1],helperText:[1,"helper-text"],limetypes:[32],mode:[32],codeValue:[32],internalValue:[32]}]);!function(e,t,i,o){var r,s=arguments.length,l=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(s<3?r(l):s>3?r(t,i,l):r(t,i))||l);s>3&&l&&Object.defineProperty(t,i,l)}([s()],c.prototype,"limetypes",void 0);const u=c,h=function(){"undefined"!=typeof customElements&&["limebb-lime-query-response-format-builder","limebb-lime-query-response-format-editor","limebb-lime-query-response-format-item","limebb-property-selector"].forEach((e=>{switch(e){case"limebb-lime-query-response-format-builder":customElements.get(r(e))||customElements.define(r(e),c);break;case"limebb-lime-query-response-format-editor":customElements.get(r(e))||a();break;case"limebb-lime-query-response-format-item":customElements.get(r(e))||n();break;case"limebb-property-selector":customElements.get(r(e))||d()}}))};export{u as LimebbLimeQueryResponseFormatBuilder,h as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as e,HTMLElement as t,h as i,transformTag as l}from"@stencil/core/internal/client";import{
|
|
1
|
+
import{proxyCustomElement as e,HTMLElement as t,h as i,transformTag as l}from"@stencil/core/internal/client";import{G as s,R as r,b as o}from"./index.esm.js";import{g as n}from"./extension-mapping.js";import{d as c}from"./empty-state.js";import{d as a}from"./live-docs-info.js";import{n as f}from"./negate.js";const m=["pdf","edit","view"];var h=function(e,t,i,l){var s,r=arguments.length,o=r<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,i):l;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,l);else for(var n=e.length-1;n>=0;n--)(s=e[n])&&(o=(r<3?s(o):r>3?s(t,i,o):s(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};const u=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.fileTypes=["view","contents","download"],this.renderLiveDocs=e=>{if(!this.isLiveDocsAvailable(e))return i("limebb-live-docs-info",null);if(!this.platform.isFeatureEnabled("useOfficeFilePreview"))return i("limebb-empty-state",{value:"Preview of this file type will be available soon",icon:{name:"attention",color:"rgb(var(--color-blue-light))"}});const t=this.getLiveDocsUrl(e);return i("iframe",{src:t,frameBorder:0,marginHeight:0,marginWidth:0})},this.renderFileViewer=e=>{const t=e.filename,l=this.getFileUrl(e);return l?i("limel-file-viewer",{filename:t,url:l,allowFullscreen:!0,allowOpenInNewTab:!0}):this.renderNotFound()},this.renderUnsupported=e=>i("limel-file-viewer",{filename:e.filename,url:void 0,allowFullscreen:!0,allowOpenInNewTab:!0}),this.renderNotFound=()=>[i("section",{class:"not-found"},i("limel-icon",{name:"error",size:"large"}),i("h2",null,this.translator.get("webclient.not-found")),i("p",null,this.translator.get("webclient.no-files-attached",{object:this.getDescriptive(this.limeobject)})))]}render(){const e=this.getFile();if(!e)return this.renderNotFound();const t=n(e.extension);return(0,{fileViewer:this.renderFileViewer,browser:this.renderFileViewer,sharepoint:this.renderLiveDocs,unsupported:this.renderUnsupported}[t])(e)}getLiveDocsUrl(e){let t=[...this.fileTypes];return this.platform.isFeatureEnabled("useOfficeFilePreview")&&(t=["pdf",...t]),t.filter(this.isLiveDocsType).map((t=>e.getUrl(t))).find(Boolean)}getFileUrl(e){return this.fileTypes.filter(f(this.isLiveDocsType)).map((t=>e.getUrl(t))).find(Boolean)}getFile(){const e=this.fileProperty;if(e)return this.limeobject.getFile(e.name)}isLiveDocsAvailable(e){return m.some((t=>e.getUrl(t)))}isLiveDocsType(e){return m.includes(e)}getDescriptive(e){var t;return(null==e?void 0:e.descriptive)||(null===(t=this.limetype)||void 0===t?void 0:t.localname.singular)||this.translator.get("object")}get fileProperty(){if(this.limeobject){if(this.property){const e=this.limeobject.getLimetype().getProperty(this.property);if("file"===e.type)return e}return Object.values(this.limeobject.getLimetype().properties).find((e=>"file"===e.type))}}get translator(){return this.platform.get(o.Translate)}static get style(){return".not-found{display:flex;flex-direction:column;height:100%;align-items:center;justify-content:center;line-height:1rem;color:rgb(var(--contrast-1100))}.not-found limel-icon{color:rgb(var(--color-red-default))}iframe{height:100%;width:100%}"}},[1,"limebb-limeobject-file-viewer",{platform:[16],context:[16],property:[1],fileTypes:[16],limeobject:[32],limetype:[32]}]);h([s()],u.prototype,"limeobject",void 0),h([r()],u.prototype,"limetype",void 0);const b=u,p=function(){"undefined"!=typeof customElements&&["limebb-limeobject-file-viewer","limebb-empty-state","limebb-live-docs-info"].forEach((e=>{switch(e){case"limebb-limeobject-file-viewer":customElements.get(l(e))||customElements.define(l(e),u);break;case"limebb-empty-state":customElements.get(l(e))||c();break;case"limebb-live-docs-info":customElements.get(l(e))||a()}}))};export{b as LimebbLimeobjectFileViewer,p as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as e,HTMLElement as t,createEvent as o,transformTag as n}from"@stencil/core/internal/client";import{H as i,
|
|
1
|
+
import{proxyCustomElement as e,HTMLElement as t,createEvent as o,transformTag as n}from"@stencil/core/internal/client";import{H as i,b as l}from"./index.esm.js";import{H as s}from"./highlight-item.handler.js";let c=class{constructor(e){this.itemId=e}};c=function(e,t,o,n){var i,l=arguments.length,s=l<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,n);else for(var c=e.length-1;c>=0;c--)(i=e[c])&&(s=(l<3?i(s):l>3?i(t,o,s):i(t,o))||s);return l>3&&s&&Object.defineProperty(t,o,s),s}([i({id:"limebb-feed.highlight-item"})],c);const r=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.loaded=o(this,"loaded",7)}connectedCallback(){}async componentWillLoad(){const e=new s;this.platform.register(s.SERVICE_NAME,e),this.commandBus.register(c,e),this.loaded.emit()}componentWillUpdate(){}disconnectedCallback(){}get commandBus(){return this.platform.get(l.CommandBus)}},[1,"limebb-loader",{platform:[16],context:[16]}]),m=r,a=function(){"undefined"!=typeof customElements&&["limebb-loader"].forEach((e=>{"limebb-loader"===e&&(customElements.get(n(e))||customElements.define(n(e),r))}))};export{m as LimebbLoader,a as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as n,HTMLElement as r,createEvent as t,h as e,transformTag as u}from"@stencil/core/internal/client";import{
|
|
1
|
+
import{proxyCustomElement as n,HTMLElement as r,createEvent as t,h as e,transformTag as u}from"@stencil/core/internal/client";import{b as i}from"./index.esm.js";import{t as f,c as o,a,i as c,g as s,b as l,d as v}from"./get.js";import{e as d,f as h,h as m,j as b,S as p,k as y,l as g,d as j}from"./_Uint8Array.js";import{c as x,e as k,a as w,S as A}from"./_MapCache.js";import{b as E}from"./_baseIsEqual.js";import{i as O}from"./isSymbol.js";import{d as S}from"./_defineProperty.js";function _(n){return n}var q=Date.now;function C(n){return function(){return n}}var U=function(n){var r=0,t=0;return function(){var e=q(),u=16-(e-t);if(t=e,u>0){if(++r>=800)return arguments[0]}else r=0;return n.apply(void 0,arguments)}}(S?function(n,r){return S(n,"toString",{configurable:!0,enumerable:!1,value:C(r),writable:!0})}:_),I=Math.max;function L(n,r,t){if(!x(t))return!1;var e=typeof r;return!!("number"==e?d(t)&&h(r,t.length):"string"==e&&r in t)&&k(t[r],n)}var M=A?A.isConcatSpreadable:void 0;function R(n){return w(n)||m(n)||!!(M&&n&&n[M])}var T=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function D(n){return T.test(n)}var P="\\ud800-\\udfff",W="["+P+"]",z="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",B="\\ud83c[\\udffb-\\udfff]",F="[^"+P+"]",G="(?:\\ud83c[\\udde6-\\uddff]){2}",H="[\\ud800-\\udbff][\\udc00-\\udfff]",J="(?:"+z+"|"+B+")?",K="[\\ufe0e\\ufe0f]?",N=K+J+"(?:\\u200d(?:"+[F,G,H].join("|")+")"+K+J+")*",Q=RegExp(B+"(?="+B+")|(?:"+[F+z+"?",z,G,H,W].join("|")+")"+N,"g");var V=function(n){var r=D(n=f(n))?function(n){return D(n)?function(n){return n.match(Q)||[]}(n):function(n){return n.split("")}(n)}(n):void 0,t=r?r[0]:n.charAt(0),e=r?function(n,r,t){var e=n.length;return t=void 0===t?e:t,!r&&t>=e?n:function(n,r,t){var e=-1,u=n.length;r<0&&(r=-r>u?0:u+r),(t=t>u?u:t)<0&&(t+=u),u=r>t?0:t-r>>>0,r>>>=0;for(var i=Array(u);++e<u;)i[e]=n[e+r];return i}(n,r,t)}(r,1).join(""):n.slice(1);return t.toUpperCase()+e};function X(n){return n==n&&!x(n)}function Y(n,r){return function(t){return null!=t&&t[n]===r&&(void 0!==r||n in Object(t))}}function Z(n,r){return null!=n&&r in Object(n)}function $(n){return"function"==typeof n?n:null==n?_:"object"==typeof n?w(n)?function(n,r){return c(n)&&X(r)?Y(a(n),r):function(t){var e=s(t,n);return void 0===e&&e===r?function(n,r){return null!=n&&function(n,r,t){for(var e=-1,u=(r=o(r,n)).length,i=!1;++e<u;){var f=a(r[e]);if(!(i=null!=n&&t(n,f)))break;n=n[f]}return i||++e!=u?i:!!(u=null==n?0:n.length)&&g(u)&&h(f,u)&&(w(n)||m(n))}(n,r,Z)}(t,n):E(r,e,3)}}(n[0],n[1]):function(n){var r=function(n){for(var r=y(n),t=r.length;t--;){var e=r[t],u=n[e];r[t]=[e,u,X(u)]}return r}(n);return 1==r.length&&r[0][2]?Y(r[0][0],r[0][1]):function(t){return t===n||function(n,r,t){var e=t.length,u=e;if(null==n)return!u;for(n=Object(n);e--;){var i=t[e];if(i[2]?i[1]!==n[i[0]]:!(i[0]in n))return!1}for(;++e<u;){var f=(i=t[e])[0],o=n[f],a=i[1];if(i[2]){if(void 0===o&&!(f in n))return!1}else{var c=new p;if(!E(a,o,3,void 0,c))return!1}}return!0}(t,0,r)}}(n):function(n){return c(n)?function(n){return function(r){return null==r?void 0:r[n]}}(a(n)):function(n){return function(r){return l(r,n)}}(n)}(n)}var nn=function(n,r){if(null==n)return n;if(!d(n))return function(n,r){return n&&function(n,r,t){for(var e=-1,u=Object(n),i=t(n),f=i.length;f--;){var o=i[++e];if(!1===r(u[o],o,u))break}return n}(n,r,y)}(n,r);for(var t=n.length,e=-1,u=Object(n);++e<t&&!1!==r(u[e],e,u););return n};function rn(n,r){if(n!==r){var t=void 0!==n,e=null===n,u=n==n,i=O(n),f=void 0!==r,o=null===r,a=r==r,c=O(r);if(!o&&!c&&!i&&n>r||i&&f&&a&&!o&&!c||e&&f&&a||!t&&a||!u)return 1;if(!e&&!i&&!c&&n<r||c&&t&&u&&!e&&!i||o&&t&&u||!f&&u||!a)return-1}return 0}function tn(n,r,t){r=r.length?v(r,(function(n){return w(n)?function(r){return l(r,1===n.length?n[0]:n)}:n})):[_];var e=-1;r=v(r,j($));var u=function(n,r){var t=-1,e=d(n)?Array(n.length):[];return nn(n,(function(n){e[++t]=r(n)})),e}(n,(function(n){return{criteria:v(r,(function(r){return r(n)})),index:++e,value:n}}));return function(n){var r=n.length;for(n.sort((function(n,r){return function(n,r,t){for(var e=-1,u=n.criteria,i=r.criteria,f=u.length,o=t.length;++e<f;){var a=rn(u[e],i[e]);if(a)return e>=o?a:a*("desc"==t[e]?-1:1)}return n.index-r.index}(n,r,t)}));r--;)n[r]=n[r].value;return n}(u)}var en=function(n){return U(function(n,r,t){return r=I(void 0===r?1:r,0),function(){for(var e=arguments,u=-1,i=I(e.length-r,0),f=Array(i);++u<i;)f[u]=e[r+u];u=-1;for(var o=Array(r+1);++u<r;)o[u]=e[u];return o[r]=t(f),function(n,r,t){switch(t.length){case 0:return n.call(r);case 1:return n.call(r,t[0]);case 2:return n.call(r,t[0],t[1]);case 3:return n.call(r,t[0],t[1],t[2])}return n.apply(r,t)}(n,this,o)}}(n,void 0,_),n+"")}((function(n,r){if(null==n)return[];var t=r.length;return t>1&&L(n,r[0],r[1])?r=[]:t>2&&L(r[0],r[1],r[2])&&(r=[r[0]]),tn(n,function(n,r,t,e,u){var i=-1,f=n.length;for(t||(t=R),u||(u=[]);++i<f;){var o=n[i];t(o)?b(u,o):u[u.length]=o}return u}(r),[])}));function un(n,r){if(0===n.length||0===r.length)return"";n="en_us"===n?"en-US":n,r="en_us"===r?"en-US":r;const t=(new Intl.DisplayNames(r,{type:"language"}).of(n)||"").split(" ");return t[0]=function(n){return V(f(n).toLowerCase())}(t[0]),t.join(" ")}const fn=n(class extends r{constructor(n){super(),!1!==n&&this.__registerHost(),this.__attachShadow(),this.change=t(this,"change",7),this.context={limetype:null,id:null},this.handleChange=n=>{n.stopPropagation(),this.change.emit(this.multipleChoice?n.detail.map((n=>n.value)):n.detail.value)}}async componentWillLoad(){try{this.http=this.platform.get(i.Http),this.allLanguages=await async function(n){const r=await n.get("api/v1/admin/settings/languages"),t=[];return(null==r?void 0:r.active)&&t.push(...r.active),(null==r?void 0:r.inactive)&&t.push(...r.inactive),t}(this.http)}catch(n){console.error(n)}}getOptions(){return this.allLanguages.map((n=>({value:n,text:un(n,n)})))}render(){const n=this.getOptions();let r;if(Array.isArray(this.value)){const t=this.value;r=n.filter((n=>t.includes(n.value)))}else{const t=this.value;r=n.find((n=>n.value===t))}return e("limel-select",{key:"b5aad60b10237826f58f096a343beb7fcbfe2b9b",value:r,options:en(n,"text"),helperText:this.helperText,label:this.label,required:this.required,disabled:this.disabled,readonly:this.readonly,onChange:this.handleChange,multiple:this.multipleChoice})}},[1,"limebb-locale-picker",{platform:[16],context:[16],value:[1],required:[4],disabled:[4],label:[1],helperText:[1,"helper-text"],readonly:[4],multipleChoice:[4,"multiple-choice"],allLanguages:[32]}]),on=fn,an=function(){"undefined"!=typeof customElements&&["limebb-locale-picker"].forEach((n=>{"limebb-locale-picker"===n&&(customElements.get(u(n))||customElements.define(u(n),fn))}))};export{on as LimebbLocalePicker,an as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as e,HTMLElement as t,getElement as o,h as r,transformTag as i}from"@stencil/core/internal/client";import{f as n}from"./dom.js";import{
|
|
1
|
+
import{proxyCustomElement as e,HTMLElement as t,getElement as o,h as r,transformTag as i}from"@stencil/core/internal/client";import{f as n}from"./dom.js";import{b as s}from"./index.esm.js";const a=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow()}connectedCallback(){const e=n(o(this),this.hasPlatform);e&&this.loadLimeObject(e.platform)}hasPlatform(e){return"platform"in e&&!!e.platform&&"object"==typeof e.platform}async loadLimeObject(e){const t=e.get(s.LimeObjectRepository);if(this.limeobject=t.getObject(this.limetype,this.objectid),!this.limeobject){try{await t.loadObject(this.limetype,this.objectid)}catch(e){console.error("Could not load mentioned object")}this.limeobject=t.getObject(this.limetype,this.objectid)}}render(){return this.limeobject?this.renderLimeObject(this.limeobject):this.renderSlot()}renderLimeObject(e){return r("a",{href:`object/${this.limetype}/${this.objectid}`},e.descriptive,this.renderSlot({hidden:!0}))}renderSlot(e={}){return r("span",Object.assign({},e),r("slot",null))}static get style(){return':host(limebb-mention){display:inline}a{transition:background-color 0.2s ease;white-space:normal;overflow-wrap:break-word;word-break:break-word;padding:0 0.125rem;border-radius:0.25rem;text-decoration:none;color:rgb(var(--color-blue-default));background-color:rgb(var(--color-blue-default), 0.06)}a:hover{background-color:rgb(var(--color-blue-default), 0.16)}a:before,span:before{content:"@";opacity:0.7}'}},[257,"limebb-mention",{limetype:[1],objectid:[2],limeobject:[32]}]),c=a,l=function(){"undefined"!=typeof customElements&&["limebb-mention"].forEach((e=>{"limebb-mention"===e&&(customElements.get(i(e))||customElements.define(i(e),a))}))};export{c as LimebbMention,l as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as e,HTMLElement as i,createEvent as t,h as o,transformTag as r}from"@stencil/core/internal/client";import{n}from"./index.esm.js";import{d as a}from"./notification-item.js";function s(e){for(const i of e.items)e.processedItems.push({type:"notification",item:i});return e}function l(e){const i=[];let t=e.newItemIndicatorInserted;for(const o of e.processedItems)"notification"===o.type&&e.lastVisitedTimestamp&&!t&&new Date(o.item.timestamp)<=e.lastVisitedTimestamp&&e.hasUnseenNotifications&&(i.push({type:"newItemIndicator"}),t=!0),i.push(o);return e.processedItems=i,e.newItemIndicatorInserted=t,e}function c(e){const i=[];let t=null,o=null;for(const r of e.processedItems)if("notification"===r.type){const n=e.dateTimeFormatter.format(new Date(r.item.timestamp),"date");n!==o&&(t&&i.push(t),t={type:"group",groupType:"dateGroup",heading:n,items:[]},o=n),t&&t.items.push(r)}else"newItemIndicator"===r.type&&(t?t.items.push(r):i.push(r));return t&&i.push(t),Object.assign(Object.assign({},e),{processedItems:i})}const m=e(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.itemClick=t(this,"itemClick",7),this.items=[],this.processedItems=[],this.handleItemClick=e=>{this.itemClick.emit(e.detail)}}handleItemsChange(){let e=null;this.lastVisitedTimestamp&&(e=function(e){return new Date("string"==typeof e?Date.parse(e):e)}(this.lastVisitedTimestamp)),this.processedItems=function(e,i,t){return function(e){return[s,l,c].reduce(((e,i)=>i(e)),e)}({items:e,processedItems:[],lastVisitedTimestamp:t,dateTimeFormatter:i,newItemIndicatorInserted:!1,lastProcessedDate:null,hasUnseenNotifications:e.some((e=>t&&new Date(e.timestamp)>t))}).processedItems}(this.items,this.dateTimeFormatter,e)}componentWillLoad(){this.handleItemsChange()}render(){return[this.renderSpinner(),this.renderNotificationItems()]}renderSpinner(){if(this.loading)return o("limel-spinner",{size:"small"})}renderNotificationItems(){return this.processedItems.map((e=>{switch(e.type){case"group":return this.renderGroup(e);case"newItemIndicator":return this.renderIndicator();default:return null}}))}renderGroup(e){return o("section",{class:"date-group"},o("a",{class:"date-heading"},e.heading),e.items.map((e=>"notification"===e.type?this.renderNotificationItem(e.item):"newItemIndicator"===e.type?this.renderIndicator():void 0)))}renderNotificationItem(e){return o("limebb-notification-item",{platform:this.platform,context:this.context,item:e,key:e.id,onInteract:this.handleItemClick})}renderIndicator(){return o("div",{class:"new-items-indicator"},o("hr",null),o("h3",null,this.translator.get("webclient.new")))}get dateTimeFormatter(){return this.platform.get(n.DateTimeFormatter)}get translator(){return this.platform.get(n.Translate)}static get watchers(){return{items:[{handleItemsChange:0}]}}static get style(){return'@charset "UTF-8";:host(limebb-notification-list){--limebb-notification-list-background-color:var( --notification-list-background-color, rgb(var(--contrast-300)) );display:flex;flex-direction:column;gap:1rem;max-width:45rem;background-color:var(--limebb-notification-list-background-color);padding:0.5rem}limebb-notification-item:focus{outline:none}limebb-notification-item:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}limebb-notification-item:not(.is-read){--limebb-notification-item-unread-badge-color:rgb( var(--color-red-default) );--limebb-notification-item-unread-badge-scale:1;background-color:rgb(var(--contrast-100)) !important}limebb-notification-item.is-clickable{transition:color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);cursor:pointer;color:var(--limel-theme-on-surface-color);background-color:transparent}limebb-notification-item.is-clickable:hover,limebb-notification-item.is-clickable:focus,limebb-notification-item.is-clickable:focus-visible{will-change:color, background-color, box-shadow, transform}limebb-notification-item.is-clickable:hover,limebb-notification-item.is-clickable:focus-visible{transform:translate3d(0, 0.01rem, 0);color:var(--limel-theme-on-surface-color);background-color:var(--lime-elevated-surface-background-color)}limebb-notification-item.is-clickable:hover{box-shadow:var(--button-shadow-hovered)}limebb-notification-item.is-clickable:active{--limel-clickable-transform-timing-function:cubic-bezier( 0.83, -0.15, 0.49, 1.16 );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}limebb-notification-item.is-clickable:hover,limebb-notification-item.is-clickable:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}limebb-notification-item.is-clickable:hover{border-color:transparent}limebb-notification-item.is-read{border-color:rgb(var(--contrast-600));background-color:rgb(var(--contrast-500))}limebb-notification-item.is-selected{box-shadow:var(--shadow-focused-state)}limebb-notification-item.is-selected:hover{box-shadow:var(--shadow-focused-state), var(--button-shadow-hovered)}limel-spinner{align-self:center;justify-self:center;margin:auto}.date-group{isolation:isolate;display:flex;flex-direction:column;gap:0.5rem}.date-heading{position:sticky;z-index:1;top:0.25rem;display:flex;border-radius:9rem;padding:0.25rem 0.5rem;margin:0;width:fit-content;font-size:0.75rem;line-height:1;color:rgb(var(--contrast-900));backdrop-filter:blur(0.5rem);-webkit-backdrop-filter:blur(0.5rem);transition:color 0.2s ease, border-color 0.4s ease}.date-heading:hover{color:rgb(var(--contrast-1000));border-color:rgb(var(--contrast-500))}.date-heading:hover:before{opacity:1}.date-heading:before{transition:opacity 0.2s ease;content:"";position:absolute;z-index:-1;inset:0;opacity:0.6;border-radius:inherit;background-color:var(--limebb-notification-list-background-color)}.new-items-indicator{position:relative;isolation:isolate;display:flex;align-items:center;justify-content:flex-end;margin:0.25rem 0}.new-items-indicator hr{border:none;position:absolute;width:100%;height:1px;background-color:rgb(var(--color-red-lighter))}.new-items-indicator h3{z-index:1;padding:0 0.5rem;border-radius:1rem;margin:0 1rem;font-size:small;line-height:0.75rem;text-transform:lowercase;color:rgb(var(--color-red-default));background-color:var(--limebb-notification-list-background-color)}'}},[1,"limebb-notification-list",{platform:[16],context:[16],items:[16],loading:[4],lastVisitedTimestamp:[1,"last-visited-timestamp"]},void 0,{items:[{handleItemsChange:0}]}]),
|
|
1
|
+
import{proxyCustomElement as e,HTMLElement as i,createEvent as t,h as o,transformTag as r}from"@stencil/core/internal/client";import{b as n}from"./index.esm.js";import{d as a}from"./notification-item.js";function s(e){for(const i of e.items)e.processedItems.push({type:"notification",item:i});return e}function l(e){const i=[];let t=e.newItemIndicatorInserted;for(const o of e.processedItems)"notification"===o.type&&e.lastVisitedTimestamp&&!t&&new Date(o.item.timestamp)<=e.lastVisitedTimestamp&&e.hasUnseenNotifications&&(i.push({type:"newItemIndicator"}),t=!0),i.push(o);return e.processedItems=i,e.newItemIndicatorInserted=t,e}function c(e){const i=[];let t=null,o=null;for(const r of e.processedItems)if("notification"===r.type){const n=e.dateTimeFormatter.format(new Date(r.item.timestamp),"date");n!==o&&(t&&i.push(t),t={type:"group",groupType:"dateGroup",heading:n,items:[]},o=n),t&&t.items.push(r)}else"newItemIndicator"===r.type&&(t?t.items.push(r):i.push(r));return t&&i.push(t),Object.assign(Object.assign({},e),{processedItems:i})}const m=e(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.itemClick=t(this,"itemClick",7),this.items=[],this.processedItems=[],this.handleItemClick=e=>{this.itemClick.emit(e.detail)}}handleItemsChange(){let e=null;this.lastVisitedTimestamp&&(e=function(e){return new Date("string"==typeof e?Date.parse(e):e)}(this.lastVisitedTimestamp)),this.processedItems=function(e,i,t){return function(e){return[s,l,c].reduce(((e,i)=>i(e)),e)}({items:e,processedItems:[],lastVisitedTimestamp:t,dateTimeFormatter:i,newItemIndicatorInserted:!1,lastProcessedDate:null,hasUnseenNotifications:e.some((e=>t&&new Date(e.timestamp)>t))}).processedItems}(this.items,this.dateTimeFormatter,e)}componentWillLoad(){this.handleItemsChange()}render(){return[this.renderSpinner(),this.renderNotificationItems()]}renderSpinner(){if(this.loading)return o("limel-spinner",{size:"small"})}renderNotificationItems(){return this.processedItems.map((e=>{switch(e.type){case"group":return this.renderGroup(e);case"newItemIndicator":return this.renderIndicator();default:return null}}))}renderGroup(e){return o("section",{class:"date-group"},o("a",{class:"date-heading"},e.heading),e.items.map((e=>"notification"===e.type?this.renderNotificationItem(e.item):"newItemIndicator"===e.type?this.renderIndicator():void 0)))}renderNotificationItem(e){return o("limebb-notification-item",{platform:this.platform,context:this.context,item:e,key:e.id,onInteract:this.handleItemClick})}renderIndicator(){return o("div",{class:"new-items-indicator"},o("hr",null),o("h3",null,this.translator.get("webclient.new")))}get dateTimeFormatter(){return this.platform.get(n.DateTimeFormatter)}get translator(){return this.platform.get(n.Translate)}static get watchers(){return{items:[{handleItemsChange:0}]}}static get style(){return'@charset "UTF-8";:host(limebb-notification-list){--limebb-notification-list-background-color:var( --notification-list-background-color, rgb(var(--contrast-300)) );display:flex;flex-direction:column;gap:1rem;max-width:45rem;background-color:var(--limebb-notification-list-background-color);padding:0.5rem}limebb-notification-item:focus{outline:none}limebb-notification-item:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}limebb-notification-item:not(.is-read){--limebb-notification-item-unread-badge-color:rgb( var(--color-red-default) );--limebb-notification-item-unread-badge-scale:1;background-color:rgb(var(--contrast-100)) !important}limebb-notification-item.is-clickable{transition:color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);cursor:pointer;color:var(--limel-theme-on-surface-color);background-color:transparent}limebb-notification-item.is-clickable:hover,limebb-notification-item.is-clickable:focus,limebb-notification-item.is-clickable:focus-visible{will-change:color, background-color, box-shadow, transform}limebb-notification-item.is-clickable:hover,limebb-notification-item.is-clickable:focus-visible{transform:translate3d(0, 0.01rem, 0);color:var(--limel-theme-on-surface-color);background-color:var(--lime-elevated-surface-background-color)}limebb-notification-item.is-clickable:hover{box-shadow:var(--button-shadow-hovered)}limebb-notification-item.is-clickable:active{--limel-clickable-transform-timing-function:cubic-bezier( 0.83, -0.15, 0.49, 1.16 );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}limebb-notification-item.is-clickable:hover,limebb-notification-item.is-clickable:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}limebb-notification-item.is-clickable:hover{border-color:transparent}limebb-notification-item.is-read{border-color:rgb(var(--contrast-600));background-color:rgb(var(--contrast-500))}limebb-notification-item.is-selected{box-shadow:var(--shadow-focused-state)}limebb-notification-item.is-selected:hover{box-shadow:var(--shadow-focused-state), var(--button-shadow-hovered)}limel-spinner{align-self:center;justify-self:center;margin:auto}.date-group{isolation:isolate;display:flex;flex-direction:column;gap:0.5rem}.date-heading{position:sticky;z-index:1;top:0.25rem;display:flex;border-radius:9rem;padding:0.25rem 0.5rem;margin:0;width:fit-content;font-size:0.75rem;line-height:1;color:rgb(var(--contrast-900));backdrop-filter:blur(0.5rem);-webkit-backdrop-filter:blur(0.5rem);transition:color 0.2s ease, border-color 0.4s ease}.date-heading:hover{color:rgb(var(--contrast-1000));border-color:rgb(var(--contrast-500))}.date-heading:hover:before{opacity:1}.date-heading:before{transition:opacity 0.2s ease;content:"";position:absolute;z-index:-1;inset:0;opacity:0.6;border-radius:inherit;background-color:var(--limebb-notification-list-background-color)}.new-items-indicator{position:relative;isolation:isolate;display:flex;align-items:center;justify-content:flex-end;margin:0.25rem 0}.new-items-indicator hr{border:none;position:absolute;width:100%;height:1px;background-color:rgb(var(--color-red-lighter))}.new-items-indicator h3{z-index:1;padding:0 0.5rem;border-radius:1rem;margin:0 1rem;font-size:small;line-height:0.75rem;text-transform:lowercase;color:rgb(var(--color-red-default));background-color:var(--limebb-notification-list-background-color)}'}},[1,"limebb-notification-list",{platform:[16],context:[16],items:[16],loading:[4],lastVisitedTimestamp:[1,"last-visited-timestamp"]},void 0,{items:[{handleItemsChange:0}]}]),b=m,d=function(){"undefined"!=typeof customElements&&["limebb-notification-list","limebb-notification-item"].forEach((e=>{switch(e){case"limebb-notification-list":customElements.get(r(e))||customElements.define(r(e),m);break;case"limebb-notification-item":customElements.get(r(e))||a()}}))};export{b as LimebbNotificationList,d as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as i,getElement as e,h as s,transformTag as h}from"@stencil/core/internal/client";import{g as o}from"./limetype.js";import{f as a}from"./dom.js";import{
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as i,getElement as e,h as s,transformTag as h}from"@stencil/core/internal/client";import{g as o}from"./limetype.js";import{f as a}from"./dom.js";import{j as l,b as r}from"./index.esm.js";const n=l("object-resolver");function c(t,i){return`object/${t}/${i}`}class d{constructor(t){this.onStateChange=t,this.state={loadFailed:!1},this.hasPendingLoad=!1,this.isDisconnected=!1}get resolvedPlatform(){return this._platform}connect(t,i,e,s){this.limetype=t,this.objectid=i,this.isDisconnected=!1,this.hasPendingLoad=!1,this._platform=s||this.findPlatform(e),this._platform?(this.resolveLimeType(),this.loadLimeObject()):n.error(`No platform found. Pass "platform" prop or place the component inside a parent that exposes "platform". limetype=${t}, objectid=${i}`)}update(t,i){this.limetype=t,this.objectid=i,this.updateState({limeobject:void 0,limetypeData:void 0,loadFailed:!1}),this.hasPendingLoad||(this.hasPendingLoad=!0,queueMicrotask((()=>{if(this.hasPendingLoad=!1,!this.isDisconnected){if(!this._platform)return this.updateState({loadFailed:!0}),void n.warn(`Cannot update: no platform available. limetype=${this.limetype}, objectid=${this.objectid}`);this.resolveLimeType(),this.loadLimeObject()}})))}disconnect(){this.isDisconnected=!0}findPlatform(t){const i=a(t,this.hasPlatformProp);return null==i?void 0:i.platform}hasPlatformProp(t){return"platform"in t&&!!t.platform&&"object"==typeof t.platform}resolveLimeType(){const t=this._platform.get(r.LimeTypeRepository);this.updateState({limetypeData:t.getLimeType(this.limetype)})}async loadLimeObject(){const t=this.limetype,i=this.objectid,e=this._platform.get(r.LimeObjectRepository),s=e.getObject(t,i);if(s)this.updateState({limeobject:s});else{try{await e.loadObject(t,i)}catch(e){if(this.isStale(t,i))return;return this.updateState({loadFailed:!0}),void n.error(`Failed to load ${t}/${i}`,e)}this.isStale(t,i)||this.updateState({limeobject:e.getObject(t,i)})}}isStale(t,i){return this.isDisconnected||this.limetype!==t||this.objectid!==i}updateState(t){this.state=Object.assign(Object.assign({},this.state),t),this.isDisconnected||this.onStateChange(this.state)}}const m=t(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.size="default",this.data={loadFailed:!1},this.resolver=new d((t=>{this.data=t}))}connectedCallback(){this.resolver.connect(this.limetype,this.objectid,e(this),this.platform)}disconnectedCallback(){this.resolver.disconnect()}handlePropChange(){this.resolver.update(this.limetype,this.objectid)}render(){if(!this.resolver.resolvedPlatform)return;const t=o(this.data.limetypeData);return s("limel-chip",{text:this.getChipText(),icon:t,size:this.size,link:{href:c(this.limetype,this.objectid)},loading:!this.data.limeobject&&!this.data.loadFailed})}getChipText(){var t;return(null===(t=this.data.limeobject)||void 0===t?void 0:t.descriptive)?this.data.limeobject.descriptive:this.data.loadFailed?this.getErrorText():""}getErrorText(){if(!this.resolver.resolvedPlatform)return"loading failed";try{return this.resolver.resolvedPlatform.get(r.Translate).get("webclient.limeobject.errors.load-failed")}catch(t){return"loading failed"}}static get watchers(){return{limetype:[{handlePropChange:0}],objectid:[{handlePropChange:0}]}}static get style(){return":host{display:inline-block;vertical-align:baseline}"}},[1,"limebb-object-chip",{limetype:[1],objectid:[2],size:[1],platform:[16],data:[32]},void 0,{limetype:[{handlePropChange:0}],objectid:[{handlePropChange:0}]}]),p=m,u=function(){"undefined"!=typeof customElements&&["limebb-object-chip"].forEach((t=>{"limebb-object-chip"===t&&(customElements.get(h(t))||customElements.define(h(t),m))}))};export{p as LimebbObjectChip,u as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e,proxyCustomElement as t,HTMLElement as n,createEvent as r,transformTag as l}from"@stencil/core/internal/client";import{n as i}from"./index.esm.js";import{d as o}from"./rule-chip-popover.js";function s(e,t){return t?{type:"not",rule:e}:e}function u(e,t){return e.length===t.length&&e.every(((e,n)=>e===t[n]))}function a(e,t){return e.filter((e=>u(e.path,t)))}function c(e,t){let n=e;for(const e of t)n=h(n,e);return n}function d(e,t,n){if(0===t.length)return n;const[r,...l]=t;if("not"===e.type&&"rule"===r)return Object.assign(Object.assign({},e),{rule:d(e.rule,l,n)});if(("all"===e.type||"any"===e.type)&&"rules"===r){if(0===l.length)return n;const[t,...r]=l;if("number"!=typeof t)return e;const i=[...e.rules];return i[t]=d(i[t],r,n),Object.assign(Object.assign({},e),{rules:i})}return e}function h(e,t){return"not"===e.type&&"rule"===t?e.rule:"all"!==e.type&&"any"!==e.type||"rules"!==t?"all"!==e.type&&"any"!==e.type||"number"!=typeof t?e:e.rules[t]:e}const p={name:"question",color:"rgb(var(--color-glaucous-light))"};function f(e,t){return{"rule-node":!0,["rule-node--"+e]:!0,"rule-node--invalid":t.length>0}}function b(e){return"__chip__:"+e}function m(e){return"ref"===e.type?{ref:e,isNegated:!1}:"not"===e.type&&"ref"===e.rule.type?{ref:e.rule,isNegated:!0}:null}const v=({groupNode:t,groupPath:n,chipChildren:r,ctx:l})=>{const i=new Map,o=r.map((e=>{const t=b(e.index);i.set(t,e);const n=function(e,t){var n;return null!==(n=e.find((e=>e.value===t)))&&void 0!==n?n:{value:t,text:t,icon:p}}(l.primitiveOptions,e.ref.id);return Object.assign(Object.assign({},n),{text:e.isNegated?"¬ "+n.text:n.text,value:t})})),s=function(e){return t=>Promise.resolve(function(e,t){if(!t)return e;const n=t.toLocaleLowerCase().split(/\s+/);return e.filter((e=>n.every((t=>{var n,r;return e.text.toLocaleLowerCase().includes(t)||(null===(n=e.secondaryText)||void 0===n?void 0:n.toLocaleLowerCase().includes(t))||(null===(r=e.value)||void 0===r?void 0:r.toLocaleLowerCase().includes(t))}))))}(e,t))}(l.primitiveOptions),u=function(e,t,n){var r;const l=C(t,n);return null===l?null:null!==(r=e.find((e=>e.index===l)))&&void 0!==r?r:null}(r,n,l.openChipPath),a="all"===t.type?"&":"|";return e("limel-popover",{class:"rule-node__chips-popover",open:null!==u,openDirection:"bottom-start",onClose:l.onPopoverClose},e("div",{slot:"trigger",class:"rule-node__chips"},e("limel-picker",{multiple:!0,label:l.translator.get("webclient.rule-editor.rules-label"),value:o,searcher:s,delimiter:a,readonly:l.readonly,disabled:l.disabled,onChange:g(t,n,i,l),onInteract:_(n,i,l)})),e("div",null,function(t,n,r){if(!t)return null;const l=function(e,t){return[...e,"rules",t]}(n,t.index);return e("limebb-rule-chip-popover",{platform:r.platform,context:r.context,refNode:t.ref,isNegated:t.isNegated,metadata:r.metadataById.get(t.ref.id),readonly:r.readonly,disabled:r.disabled,isMutable:r.isMutable,onNegate:y(t,l,r),onUpdateArgs:x(t,l,r),onDeleteChip:j(l,r)})}(u,n,l)))},g=(e,t,n,r)=>l=>{l.stopPropagation();const i=Array.isArray(l.detail)?l.detail:[],o=C(t,r.openChipPath);if(null!==o){const e=b(o);i.every((t=>t.value!==e))&&r.onPopoverClose()}const s=i.flatMap((e=>{if("string"!=typeof e.value)return[];const t=n.get(e.value);return t?[t.isNegated?{type:"not",rule:t.ref}:t.ref]:[{type:"ref",id:e.value}]})),u=e.rules.filter((e=>null===m(e)));r.onReplaceNode(t,Object.assign(Object.assign({},e),{rules:[...s,...u]}))},_=(e,t,n)=>r=>{r.stopPropagation();const l=function(e){if("string"==typeof e)return e;if(e&&"object"==typeof e&&"value"in e){const t=e.value;return"string"==typeof t?t:void 0}}(r.detail),i=l?t.get(l):void 0;i&&n.onChipInteract([...e,"rules",i.index])},y=(e,t,n)=>r=>{r.stopPropagation(),n.onReplaceNode(t,r.detail?{type:"not",rule:e.ref}:e.ref)},x=(e,t,n)=>r=>{r.stopPropagation();const l=e.isNegated?[...t,"rule"]:t;n.onUpdateArgs(l,r.detail)},j=(e,t)=>()=>{t.onDelete(e)};function C(e,t){if(!t||t.length<2)return null;if(!u(function(e){return e.slice(0,-2)}(t),e))return null;const n=t.at(-1);return"number"==typeof n?n:null}const w=({node:t,path:n,isNegated:r,ctx:l})=>{const i=r?[...n,"rule"]:n,o=r?[...a(l.issues,n),...a(l.issues,i)]:a(l.issues,n),s=[],u=[];for(const[e,n]of t.rules.entries()){const t=m(n);t?s.push(Object.assign(Object.assign({},t),{index:e})):u.push({child:n,index:e})}const c=function(e){return[{value:"all",text:e.translator.get("webclient.rule-editor.combinator.all")},{value:"any",text:e.translator.get("webclient.rule-editor.combinator.any")}]}(l),d=c.find((e=>e.value===t.type));return e("div",{class:f(t.type,o),key:O(n)},e("div",{class:"rule-node__header"},e("limel-select",{class:"rule-node__combinator-select",value:d,options:c,disabled:!l.isMutable,onChange:k(t,n,r,l)}),function(t,n,r,l){return l.isMutable?e("div",{class:"rule-node__header-actions"},e("limel-switch",{class:"rule-node__negate-switch",label:l.translator.get("webclient.rule-editor.negate"),value:r,onChange:A(t,n,l)}),e("limel-icon-button",{icon:"trash",label:l.translator.get("webclient.rule-editor.delete"),onClick:()=>l.onDelete(n)})):null}(t,n,r,l)),e("div",{class:"rule-node__body"},e(V,{issues:o}),e(v,{groupNode:t,groupPath:i,chipChildren:s,ctx:l}),function(t,n,r){return 0===t.length?null:e("div",{class:"rule-node__children"},t.map((t=>e(M,{node:t.child,path:[...n,"rules",t.index],ctx:r}))))}(u,i,l),function(t,n,r,l){return l.isMutable?e("div",{class:"rule-node__footer"},e("limel-button",{icon:"add",label:l.translator.get("webclient.rule-editor.add-nested-group"),onClick:z(t,n,r,l)})):null}(t,n,r,l)))};function O(e){return 0===e.length?"root":e.join("/")}function N(e,t,n,r){r.onReplaceNode(t,s(e,n))}const k=(e,t,n,r)=>l=>{l.stopPropagation();const i=l.detail.value;i!==e.type&&N(Object.assign(Object.assign({},e),{type:i}),t,n,r)},z=(e,t,n,r)=>()=>{N(function(e){return Object.assign(Object.assign({},e),{rules:[...e.rules,{type:"all",rules:[]}]})}(e),t,n,r)},A=(e,t,n)=>r=>{r.stopPropagation(),n.onReplaceNode(t,s(e,r.detail))},M=t=>{const{node:n,path:r,ctx:l}=t,i=S(n);return i?e(w,{node:i.node,path:r,isNegated:i.isNegated,ctx:l}):null},P=e=>"not"===e.type&&("all"===e.rule.type||"any"===e.rule.type);function S(e){if("all"===e.type||"any"===e.type)return{node:e,isNegated:!1};if(P(e))return{node:e.rule,isNegated:!0};if("not"===e.type){const t=S(e.rule);if(t)return{node:t.node,isNegated:!t.isNegated}}return null}const V=({issues:t})=>0===t.length?null:t.map((t=>e("div",{class:"rule-node__issue"},t.message))),D=t(class extends n{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.change=r(this,"change",7),this.issues=[],this.openChipPath=null,this.metadataById=new Map,this.primitiveOptions=[],this.normalizedCache=null,this.handleDelete=e=>{this.openChipPath=null,this.emitIfChanged(function(e,t){if(0===t.length)return{type:"all",rules:[]};const n=t.slice(0,-1),r=t.at(-1),l=c(e,n);if(("all"===l.type||"any"===l.type)&&"number"==typeof r){const t=[...l.rules];return t.splice(r,1),d(e,n,Object.assign(Object.assign({},l),{rules:t}))}return"not"===l.type&&"rule"===r?d(e,n,{type:"all",rules:[]}):e}(this.normalizedValue,e))},this.handleUpdateArgs=(e,t)=>{this.emitIfChanged(function(e,t,n){const r=c(e,t);return"ref"!==r.type?e:d(e,t,Object.assign(Object.assign({},r),{args:n}))}(this.normalizedValue,e,t))},this.handleReplaceNode=(e,t)=>{this.emitIfChanged(function(e,t,n){return d(e,t,n)}(this.normalizedValue,e,t))},this.handleChipInteract=e=>{this.openChipPath=e},this.handlePopoverClose=()=>{this.openChipPath=null}}componentWillLoad(){this.indexMetadata(),this.runValidation()}componentDidLoad(){this.emitNormalization()}onValueChange(){this.emitNormalization()||this.runValidation()}onAvailableSubjectsChange(){this.runValidation()}render(){return e("div",{key:"d179f399433b3c80aa09e52baa19713eef7c1921",class:{"rule-editor":!0,"rule-editor--disabled":this.disabled}},this.renderLabel(),e(M,{key:"14cac42e37f52f0a32390a1f374f014b60e31dde",node:this.normalizedValue,path:[],ctx:this.createRenderContext()}),this.renderHelperText())}renderLabel(){return this.label?e("div",{class:"rule-editor__label"},this.label):null}renderHelperText(){return this.helperText?e("div",{class:"rule-editor__helper-text"},this.helperText):null}createRenderContext(){return{issues:this.issues,metadataById:this.metadataById,primitiveOptions:this.primitiveOptions,isMutable:!this.readonly&&!this.disabled,readonly:this.readonly,disabled:this.disabled,platform:this.platform,context:this.context,translator:this.platform.get(i.Translate),openChipPath:this.openChipPath,onDelete:this.handleDelete,onUpdateArgs:this.handleUpdateArgs,onReplaceNode:this.handleReplaceNode,onChipInteract:this.handleChipInteract,onPopoverClose:this.handlePopoverClose}}indexMetadata(){var e,t,n;const r=null!==(n=null===(t=(e=this.ruleRegistry).listMetadata)||void 0===t?void 0:t.call(e))&&void 0!==n?n:[];this.metadataById=new Map(r.map((e=>[e.id,e]))),this.primitiveOptions=function(e){return[...e.values()].map((e=>{var t,n;return{value:e.id,text:null!==(t=e.title)&&void 0!==t?t:e.id,secondaryText:null!==(n=e.description)&&void 0!==n?n:"",icon:e.icon}})).sort(((e,t)=>e.text.localeCompare(t.text)))}(this.metadataById)}runValidation(){if(!this.value)return void(this.issues=[]);const e=this.ruleRegistry.validate(this.normalizedValue,this.availableSubjects);this.issues=e.ok?[]:e.issues}emitIfChanged(e){e!==this.normalizedValue&&this.change.emit(function(e){return"all"!==e.type&&"any"!==e.type?e:0===e.rules.length?void 0:e}(e))}get normalizedValue(){if(null!==this.normalizedCache&&this.normalizedCache.source===this.value)return this.normalizedCache.normalized;const e=function(e){return e?S(e)?e:{type:"all",rules:[e]}:{type:"all",rules:[]}}(this.value);return this.normalizedCache={source:this.value,normalized:e},e}emitNormalization(){if(!this.value)return!1;const e=this.normalizedValue;return e!==this.value&&(this.change.emit(e),!0)}get ruleRegistry(){return this.platform.get(i.RuleRegistry)}static get watchers(){return{value:[{onValueChange:0}],availableSubjects:[{onAvailableSubjectsChange:0}]}}static get style(){return":host{display:block}.rule-editor--disabled{opacity:0.6;pointer-events:none}.rule-editor__label{font-size:0.75rem;font-weight:600;color:rgb(var(--contrast-1500));margin-bottom:0.25rem}.rule-editor__helper-text{font-size:0.75rem;color:rgb(var(--contrast-1300));margin-top:0.25rem}.rule-node{border:1px solid rgb(var(--contrast-500));border-radius:0.5rem;margin:0.25rem 0;overflow:hidden;background-color:rgb(var(--contrast-100))}.rule-node--invalid{border-color:rgb(var(--color-red-default))}.rule-node--all>.rule-node__header,.rule-node--any>.rule-node__header{background-color:rgb(var(--contrast-300));padding:0.375rem 0.75rem;border-bottom:1px solid rgb(var(--contrast-500))}.rule-node__header{display:flex;align-items:center;gap:0.5rem}.rule-node__header-actions{margin-left:auto;display:grid;grid-auto-flow:column;grid-gap:0.5rem;padding:0.125rem;align-items:center}.rule-node__combinator-select{min-width:6rem}.rule-node__body{padding:0.75rem;display:flex;flex-direction:column;gap:0.75rem}limel-popover.rule-node__chips-popover{display:contents}.rule-node__chips{display:block;width:100%}.rule-node__chips limel-picker{display:block;width:100%}.rule-node__children{display:flex;flex-direction:column;gap:0.5rem}.rule-node__footer{display:flex;justify-content:center}.rule-node__issue{color:rgb(var(--color-red-default));font-size:0.875rem}"}},[1,"limebb-rule-editor",{platform:[16],context:[16],value:[16],availableSubjects:[16],required:[516],readonly:[516],disabled:[516],label:[513],helperText:[1,"helper-text"],issues:[32],openChipPath:[32]},void 0,{value:[{onValueChange:0}],availableSubjects:[{onAvailableSubjectsChange:0}]}]),E=D,I=function(){"undefined"!=typeof customElements&&["limebb-rule-editor","limebb-rule-chip-popover"].forEach((e=>{switch(e){case"limebb-rule-editor":customElements.get(l(e))||customElements.define(l(e),D);break;case"limebb-rule-chip-popover":customElements.get(l(e))||o()}}))};export{E as LimebbRuleEditor,I as defineCustomElement}
|
|
1
|
+
import{h as e,proxyCustomElement as t,HTMLElement as n,createEvent as r,transformTag as l}from"@stencil/core/internal/client";import{b as o}from"./index.esm.js";import{d as i}from"./rule-chip-popover.js";function s(e,t){return t?{type:"not",rule:e}:e}function u(e,t){return e.length===t.length&&e.every(((e,n)=>e===t[n]))}function a(e,t){return e.filter((e=>u(e.path,t)))}function c(e,t){let n=e;for(const e of t)n=h(n,e);return n}function d(e,t,n){if(0===t.length)return n;const[r,...l]=t;if("not"===e.type&&"rule"===r)return Object.assign(Object.assign({},e),{rule:d(e.rule,l,n)});if(("all"===e.type||"any"===e.type)&&"rules"===r){if(0===l.length)return n;const[t,...r]=l;if("number"!=typeof t)return e;const o=[...e.rules];return o[t]=d(o[t],r,n),Object.assign(Object.assign({},e),{rules:o})}return e}function h(e,t){return"not"===e.type&&"rule"===t?e.rule:"all"!==e.type&&"any"!==e.type||"rules"!==t?"all"!==e.type&&"any"!==e.type||"number"!=typeof t?e:e.rules[t]:e}const p={name:"question",color:"rgb(var(--color-glaucous-light))"};function f(e,t){return{"rule-node":!0,["rule-node--"+e]:!0,"rule-node--invalid":t.length>0}}function b(e){return"__chip__:"+e}function m(e){return"ref"===e.type?{ref:e,isNegated:!1}:"not"===e.type&&"ref"===e.rule.type?{ref:e.rule,isNegated:!0}:null}const v=({groupNode:t,groupPath:n,chipChildren:r,ctx:l})=>{const o=new Map,i=r.map((e=>{const t=b(e.index);o.set(t,e);const n=function(e,t){var n;return null!==(n=e.find((e=>e.value===t)))&&void 0!==n?n:{value:t,text:t,icon:p}}(l.primitiveOptions,e.ref.id);return Object.assign(Object.assign({},n),{text:e.isNegated?"¬ "+n.text:n.text,value:t})})),s=function(e){return t=>Promise.resolve(function(e,t){if(!t)return e;const n=t.toLocaleLowerCase().split(/\s+/);return e.filter((e=>n.every((t=>{var n,r;return e.text.toLocaleLowerCase().includes(t)||(null===(n=e.secondaryText)||void 0===n?void 0:n.toLocaleLowerCase().includes(t))||(null===(r=e.value)||void 0===r?void 0:r.toLocaleLowerCase().includes(t))}))))}(e,t))}(l.primitiveOptions),u=function(e,t,n){var r;const l=j(t,n);return null===l?null:null!==(r=e.find((e=>e.index===l)))&&void 0!==r?r:null}(r,n,l.openChipPath),a="all"===t.type?"&":"|";return e("limel-popover",{class:"rule-node__chips-popover",open:null!==u,openDirection:"bottom-start",onClose:l.onPopoverClose},e("div",{slot:"trigger",class:"rule-node__chips"},e("limel-picker",{multiple:!0,label:l.translator.get("webclient.rule-editor.rules-label"),value:i,searcher:s,delimiter:a,readonly:l.readonly,disabled:l.disabled,onChange:g(t,n,o,l),onInteract:_(n,o,l)})),e("div",null,function(t,n,r){if(!t)return null;const l=function(e,t){return[...e,"rules",t]}(n,t.index);return e("limebb-rule-chip-popover",{platform:r.platform,context:r.context,refNode:t.ref,isNegated:t.isNegated,metadata:r.metadataById.get(t.ref.id),readonly:r.readonly,disabled:r.disabled,isMutable:r.isMutable,onNegate:y(t,l,r),onUpdateArgs:x(t,l,r),onDeleteChip:C(l,r)})}(u,n,l)))},g=(e,t,n,r)=>l=>{l.stopPropagation();const o=Array.isArray(l.detail)?l.detail:[],i=j(t,r.openChipPath);if(null!==i){const e=b(i);o.every((t=>t.value!==e))&&r.onPopoverClose()}const s=o.flatMap((e=>{if("string"!=typeof e.value)return[];const t=n.get(e.value);return t?[t.isNegated?{type:"not",rule:t.ref}:t.ref]:[{type:"ref",id:e.value}]})),u=e.rules.filter((e=>null===m(e)));r.onReplaceNode(t,Object.assign(Object.assign({},e),{rules:[...s,...u]}))},_=(e,t,n)=>r=>{r.stopPropagation();const l=function(e){if("string"==typeof e)return e;if(e&&"object"==typeof e&&"value"in e){const t=e.value;return"string"==typeof t?t:void 0}}(r.detail),o=l?t.get(l):void 0;o&&n.onChipInteract([...e,"rules",o.index])},y=(e,t,n)=>r=>{r.stopPropagation(),n.onReplaceNode(t,r.detail?{type:"not",rule:e.ref}:e.ref)},x=(e,t,n)=>r=>{r.stopPropagation();const l=e.isNegated?[...t,"rule"]:t;n.onUpdateArgs(l,r.detail)},C=(e,t)=>()=>{t.onDelete(e)};function j(e,t){if(!t||t.length<2)return null;if(!u(function(e){return e.slice(0,-2)}(t),e))return null;const n=t.at(-1);return"number"==typeof n?n:null}const w=({node:t,path:n,isNegated:r,ctx:l})=>{const o=r?[...n,"rule"]:n,i=r?[...a(l.issues,n),...a(l.issues,o)]:a(l.issues,n),s=[],u=[];for(const[e,n]of t.rules.entries()){const t=m(n);t?s.push(Object.assign(Object.assign({},t),{index:e})):u.push({child:n,index:e})}const c=function(e){return[{value:"all",text:e.translator.get("webclient.rule-editor.combinator.all")},{value:"any",text:e.translator.get("webclient.rule-editor.combinator.any")}]}(l),d=c.find((e=>e.value===t.type));return e("div",{class:f(t.type,i),key:O(n)},e("div",{class:"rule-node__header"},e("limel-select",{class:"rule-node__combinator-select",value:d,options:c,disabled:!l.isMutable,onChange:k(t,n,r,l)}),function(t,n,r,l){return l.isMutable?e("div",{class:"rule-node__header-actions"},e("limel-switch",{class:"rule-node__negate-switch",label:l.translator.get("webclient.rule-editor.negate"),value:r,onChange:A(t,n,l)}),e("limel-icon-button",{icon:"trash",label:l.translator.get("webclient.rule-editor.delete"),onClick:()=>l.onDelete(n)})):null}(t,n,r,l)),e("div",{class:"rule-node__body"},e(D,{issues:i}),e(v,{groupNode:t,groupPath:o,chipChildren:s,ctx:l}),function(t,n,r){return 0===t.length?null:e("div",{class:"rule-node__children"},t.map((t=>e(M,{node:t.child,path:[...n,"rules",t.index],ctx:r}))))}(u,o,l),function(t,n,r,l){return l.isMutable?e("div",{class:"rule-node__footer"},e("limel-button",{icon:"add",label:l.translator.get("webclient.rule-editor.add-nested-group"),onClick:z(t,n,r,l)})):null}(t,n,r,l)))};function O(e){return 0===e.length?"root":e.join("/")}function N(e,t,n,r){r.onReplaceNode(t,s(e,n))}const k=(e,t,n,r)=>l=>{l.stopPropagation();const o=l.detail.value;o!==e.type&&N(Object.assign(Object.assign({},e),{type:o}),t,n,r)},z=(e,t,n,r)=>()=>{N(function(e){return Object.assign(Object.assign({},e),{rules:[...e.rules,{type:"all",rules:[]}]})}(e),t,n,r)},A=(e,t,n)=>r=>{r.stopPropagation(),n.onReplaceNode(t,s(e,r.detail))},M=t=>{const{node:n,path:r,ctx:l}=t,o=V(n);return o?e(w,{node:o.node,path:r,isNegated:o.isNegated,ctx:l}):null},P=e=>"not"===e.type&&("all"===e.rule.type||"any"===e.rule.type);function V(e){if("all"===e.type||"any"===e.type)return{node:e,isNegated:!1};if(P(e))return{node:e.rule,isNegated:!0};if("not"===e.type){const t=V(e.rule);if(t)return{node:t.node,isNegated:!t.isNegated}}return null}const D=({issues:t})=>0===t.length?null:t.map((t=>e("div",{class:"rule-node__issue"},t.message))),E=t(class extends n{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.change=r(this,"change",7),this.issues=[],this.openChipPath=null,this.metadataById=new Map,this.primitiveOptions=[],this.normalizedCache=null,this.handleDelete=e=>{this.openChipPath=null,this.emitIfChanged(function(e,t){if(0===t.length)return{type:"all",rules:[]};const n=t.slice(0,-1),r=t.at(-1),l=c(e,n);if(("all"===l.type||"any"===l.type)&&"number"==typeof r){const t=[...l.rules];return t.splice(r,1),d(e,n,Object.assign(Object.assign({},l),{rules:t}))}return"not"===l.type&&"rule"===r?d(e,n,{type:"all",rules:[]}):e}(this.normalizedValue,e))},this.handleUpdateArgs=(e,t)=>{this.emitIfChanged(function(e,t,n){const r=c(e,t);return"ref"!==r.type?e:d(e,t,Object.assign(Object.assign({},r),{args:n}))}(this.normalizedValue,e,t))},this.handleReplaceNode=(e,t)=>{this.emitIfChanged(function(e,t,n){return d(e,t,n)}(this.normalizedValue,e,t))},this.handleChipInteract=e=>{this.openChipPath=e},this.handlePopoverClose=()=>{this.openChipPath=null}}componentWillLoad(){this.indexMetadata(),this.runValidation()}componentDidLoad(){this.emitNormalization()}onValueChange(){this.emitNormalization()||this.runValidation()}onAvailableContextsChange(){this.runValidation()}render(){return e("div",{key:"8e0da39f6544c86de0143e91a6c48c9f2654315f",class:{"rule-editor":!0,"rule-editor--disabled":this.disabled}},this.renderLabel(),e(M,{key:"cd093f5dc5a9b747036f581e6230f1205cf834e6",node:this.normalizedValue,path:[],ctx:this.createRenderContext()}),this.renderHelperText())}renderLabel(){return this.label?e("div",{class:"rule-editor__label"},this.label):null}renderHelperText(){return this.helperText?e("div",{class:"rule-editor__helper-text"},this.helperText):null}createRenderContext(){return{issues:this.issues,metadataById:this.metadataById,primitiveOptions:this.primitiveOptions,isMutable:!this.readonly&&!this.disabled,readonly:this.readonly,disabled:this.disabled,platform:this.platform,context:this.context,translator:this.platform.get(o.Translate),openChipPath:this.openChipPath,onDelete:this.handleDelete,onUpdateArgs:this.handleUpdateArgs,onReplaceNode:this.handleReplaceNode,onChipInteract:this.handleChipInteract,onPopoverClose:this.handlePopoverClose}}indexMetadata(){var e,t,n;const r=null!==(n=null===(t=(e=this.ruleRegistry).listMetadata)||void 0===t?void 0:t.call(e))&&void 0!==n?n:[];this.metadataById=new Map(r.map((e=>[e.id,e]))),this.primitiveOptions=function(e,t){return[...e.values()].map((e=>({value:e.id,text:e.title?t.get(e.title):e.id,secondaryText:e.description?t.get(e.description):"",icon:e.icon}))).sort(((e,t)=>e.text.localeCompare(t.text)))}(this.metadataById,this.platform.get(o.Translate))}runValidation(){if(!this.value)return void(this.issues=[]);const e=this.ruleRegistry.validate(this.normalizedValue,this.availableContexts);this.issues=e.ok?[]:e.issues}emitIfChanged(e){e!==this.normalizedValue&&this.change.emit(function(e){return"all"!==e.type&&"any"!==e.type?e:0===e.rules.length?void 0:e}(e))}get normalizedValue(){if(null!==this.normalizedCache&&this.normalizedCache.source===this.value)return this.normalizedCache.normalized;const e=function(e){return e?V(e)?e:{type:"all",rules:[e]}:{type:"all",rules:[]}}(this.value);return this.normalizedCache={source:this.value,normalized:e},e}emitNormalization(){if(!this.value)return!1;const e=this.normalizedValue;return e!==this.value&&(this.change.emit(e),!0)}get ruleRegistry(){return this.platform.get(o.RuleRegistry)}static get watchers(){return{value:[{onValueChange:0}],availableContexts:[{onAvailableContextsChange:0}]}}static get style(){return":host{display:block}.rule-editor--disabled{opacity:0.6;pointer-events:none}.rule-editor__label{font-size:0.75rem;font-weight:600;color:rgb(var(--contrast-1500));margin-bottom:0.25rem}.rule-editor__helper-text{font-size:0.75rem;color:rgb(var(--contrast-1300));margin-top:0.25rem}.rule-node{border:1px solid rgb(var(--contrast-500));border-radius:0.5rem;margin:0.25rem 0;overflow:hidden;background-color:rgb(var(--contrast-100))}.rule-node--invalid{border-color:rgb(var(--color-red-default))}.rule-node--all>.rule-node__header,.rule-node--any>.rule-node__header{background-color:rgb(var(--contrast-300));padding:0.375rem 0.75rem;border-bottom:1px solid rgb(var(--contrast-500))}.rule-node__header{display:flex;align-items:center;gap:0.5rem}.rule-node__header-actions{margin-left:auto;display:grid;grid-auto-flow:column;grid-gap:0.5rem;padding:0.125rem;align-items:center}.rule-node__combinator-select{min-width:6rem}.rule-node__body{padding:0.75rem;display:flex;flex-direction:column;gap:0.75rem}limel-popover.rule-node__chips-popover{display:contents}.rule-node__chips{display:block;width:100%}.rule-node__chips limel-picker{display:block;width:100%}.rule-node__children{display:flex;flex-direction:column;gap:0.5rem}.rule-node__footer{display:flex;justify-content:center}.rule-node__issue{color:rgb(var(--color-red-default));font-size:0.875rem}"}},[1,"limebb-rule-editor",{platform:[16],context:[16],value:[16],availableContexts:[16],required:[516],readonly:[516],disabled:[516],label:[513],helperText:[1,"helper-text"],issues:[32],openChipPath:[32]},void 0,{value:[{onValueChange:0}],availableContexts:[{onAvailableContextsChange:0}]}]),I=E,L=function(){"undefined"!=typeof customElements&&["limebb-rule-editor","limebb-rule-chip-popover"].forEach((e=>{switch(e){case"limebb-rule-editor":customElements.get(l(e))||customElements.define(l(e),E);break;case"limebb-rule-chip-popover":customElements.get(l(e))||i()}}))};export{I as LimebbRuleEditor,L as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as e,HTMLElement as t,h as s,Host as n,transformTag as o}from"@stencil/core/internal/client";import{
|
|
1
|
+
import{proxyCustomElement as e,HTMLElement as t,h as s,Host as n,transformTag as o}from"@stencil/core/internal/client";import{b as i}from"./index.esm.js";const r=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.shouldRender=!1}componentWillLoad(){this.compileAndEvaluate()}onRuleChange(){this.compileAndEvaluate()}onScopeChange(){this.compileAndEvaluate()}render(){return s(n,{key:"365df6908301371b8b964671382ad936971b6624",hidden:!this.shouldRender},s("slot",{key:"ca7c2a9febf0189dfae882a2ae894d1d0262a213"}))}get ruleRegistry(){return this.platform.get(i.RuleRegistry)}compileAndEvaluate(){var e;if(!this.rule)return void(this.shouldRender=!0);const t=this.ruleRegistry.compile(this.rule),s=null!==(e=this.scope)&&void 0!==e?e:this.ruleRegistry.scope({host:this.host});this.shouldRender=t(s)}get host(){return this}static get watchers(){return{rule:[{onRuleChange:0}],scope:[{onScopeChange:0}]}}static get style(){return":host{display:contents}:host([hidden]){display:none}"}},[257,"limebb-rule-gate",{platform:[16],rule:[16],scope:[16],shouldRender:[32]},void 0,{rule:[{onRuleChange:0}],scope:[{onScopeChange:0}]}]),l=r,h=function(){"undefined"!=typeof customElements&&["limebb-rule-gate"].forEach((e=>{"limebb-rule-gate"===e&&(customElements.get(o(e))||customElements.define(o(e),r))}))};export{l as LimebbRuleGate,h as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as e,createEvent as i,h as s,transformTag as r}from"@stencil/core/internal/client";import{n,Z as o,Q as a,j as h}from"./index.esm.js";import{A as c,E as u,b as l,a as d,T as f}from"./keycodes.js";import{o as m,U as v,c as b,a as p,d as g,n as y,i as j,S as w,g as x}from"./_Uint8Array.js";import{d as O}from"./_defineProperty.js";import{c as k,e as S,S as I,i as E,a as C,r as T}from"./_MapCache.js";import{c as A}from"./random-string.js";import{h as P,b as M,c as F}from"./limetype.js";import{i as N}from"./non-null.js";import{d as _}from"./empty-state.js";import{d as z}from"./text-editor-picker.js";import{i as D}from"./isSymbol.js";var L=/\s/,Q=/^\s+/;var R=/^[-+]0x[0-9a-f]+$/i,U=/^0b[01]+$/i,$=/^0o[0-7]+$/i,G=parseInt;function q(t){if("number"==typeof t)return t;if(D(t))return NaN;if(k(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=k(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=function(t){return t?t.slice(0,function(t){for(var e=t.length;e--&&L.test(t.charAt(e)););return e}(t)+1).replace(Q,""):t}(t);var i=U.test(t);return i||$.test(t)?G(t.slice(2),i?2:8):R.test(t)?NaN:+t}var W=Object.create,B=function(){function t(){}return function(e){if(!k(e))return{};if(W)return W(e);t.prototype=e;var i=new t;return t.prototype=void 0,i}}(),H=Object.prototype.hasOwnProperty;var K=m(Object.getPrototypeOf,Object);"object"==typeof exports&&exports&&!exports.nodeType&&exports&&"object"==typeof module&&module&&!module.nodeType&&module;var V=Object.prototype.hasOwnProperty;function Z(t){var e=new t.constructor(t.byteLength);return new v(e).set(new v(t)),e}var J=/\w*$/,X=I?I.prototype:void 0,Y=X?X.valueOf:void 0;var tt=y&&y.isMap,et=tt?g(tt):function(t){return E(t)&&"[object Map]"==p(t)},it=y&&y.isSet,st=it?g(it):function(t){return E(t)&&"[object Set]"==p(t)},rt="[object Arguments]",nt="[object Function]",ot="[object Object]",at={};function ht(t,e,i,s,r,n){var o;if(void 0!==o)return o;if(!k(t))return t;var a=C(t);if(a)o=function(t){var e=t.length,i=new t.constructor(e);return e&&"string"==typeof t[0]&&V.call(t,"index")&&(i.index=t.index,i.input=t.input),i}(t);else{var h=p(t),c=h==nt||"[object GeneratorFunction]"==h;if(j(t))return function(t){return t.slice()}(t);if(h==ot||h==rt||c&&!r)o=c?{}:function(t){return"function"!=typeof t.constructor||b(t)?{}:B(K(t))}(t);else{if(!at[h])return r?t:{};o=function(t,e){var i=t.constructor;switch(e){case"[object ArrayBuffer]":return Z(t);case"[object Boolean]":case"[object Date]":return new i(+t);case"[object DataView]":return function(t){var e=Z(t.buffer);return new t.constructor(e,t.byteOffset,t.byteLength)}(t);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(t){var e=Z(t.buffer);return new t.constructor(e,t.byteOffset,t.length)}(t);case"[object Map]":case"[object Set]":return new i;case"[object Number]":case"[object String]":return new i(t);case"[object RegExp]":return function(t){var e=new t.constructor(t.source,J.exec(t));return e.lastIndex=t.lastIndex,e}(t);case"[object Symbol]":return function(t){return Y?Object(Y.call(t)):{}}(t)}}(t,h)}}n||(n=new w);var u=n.get(t);if(u)return u;n.set(t,o),st(t)?t.forEach((function(s){o.add(ht(s,e,i,0,t,n))})):et(t)&&t.forEach((function(s,r){o.set(r,ht(s,e,i,0,t,n))}));var l=a?void 0:x(t);return function(t,e){for(var i=-1,s=null==t?0:t.length;++i<s&&!1!==e(t[i],i););}(l||t,(function(s,r){l&&(s=t[r=s]),function(t,e,i){var s=t[e];H.call(t,e)&&S(s,i)&&(void 0!==i||e in t)||function(t,e,i){"__proto__"==e&&O?O(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}(t,e,i)}(o,r,ht(s,e,i,0,t,n))})),o}at[rt]=at["[object Array]"]=at["[object ArrayBuffer]"]=at["[object DataView]"]=at["[object Boolean]"]=at["[object Date]"]=at["[object Float32Array]"]=at["[object Float64Array]"]=at["[object Int8Array]"]=at["[object Int16Array]"]=at["[object Int32Array]"]=at["[object Map]"]=at["[object Number]"]=at[ot]=at["[object RegExp]"]=at["[object Set]"]=at["[object String]"]=at["[object Symbol]"]=at["[object Uint8Array]"]=at["[object Uint8ClampedArray]"]=at["[object Uint16Array]"]=at["[object Uint32Array]"]=!0,at["[object Error]"]=at[nt]=at["[object WeakMap]"]=!1;var ct=function(){return T.Date.now()},ut=Math.max,lt=Math.min;function dt(t,e){return t.map(((t,i)=>{const s=function(t){return ht(t,5)}(t);return Object.assign(Object.assign({},s),{selected:i===e})}))}class ft{get limeObjectService(){return this.platform.get(n.LimeObjectRepository)}get queryService(){return this.platform.get(n.Query)}get viewFactoryRegistry(){return this.platform.get(n.ViewFactoryRegistry)}get translator(){var t;return null===(t=this.platform)||void 0===t?void 0:t.get(n.Translate)}get triggerCharacter(){return this._triggerCharacter}get triggerHandler(){return this._triggerHandler}constructor(t,e,i){this.platform=t,this.context=e,this.searchableLimetypes=i,this.groupCounts={},this._triggerCharacter="@",this._triggerHandler={searcher:t=>this.searcher(t),inserter:(t,e)=>this.inserter(t,e),emptySearchMessage:"Start typing a name...",noItemsFoundMessage:"No results for your search...",nodeDefinition:{customElement:{tagName:"limebb-mention",attributes:["limetype","objectid","href"]},mapAttributes:t=>({limetype:t.value.getLimetype().name,objectid:t.value.id,href:`object/${this.context.limetype}/${this.context.id}`})}},this.searcher=async t=>{if(!t)return[];const{objects:e}=await this.limeObjectService.search(t,this.searchableLimetypes,10);return this.createSearchListItems(e)},this.inserter=async(t,e)=>{var i;const s=this.triggerHandler.nodeDefinition;s&&t.insert({node:{tagName:s.customElement.tagName,attributes:s.mapAttributes(e)},children:[null===(i=e.value)||void 0===i?void 0:i.descriptive]})}}async initialize(){await this.loadGroupCounts()}async loadGroupCounts(){const t=this.searchableLimetypes.filter((t=>!M(t,"user")&&P(t,"user"))).map((t=>this.getGroupCounts(t)));for(const e of await Promise.all(t))Object.assign(this.groupCounts,e)}async getGroupCounts(t){var e;const i=F(t,"user"),s=t.name;try{const t=await this.queryService.execute({limetype:s,responseFormat:{object:{_id:null,[i.name]:{count:{aggregate:{op:o.Count}}}}}});if(!(null===(e=t.objects)||void 0===e?void 0:e.length))return{[s]:{}};const r=this.createGroupCount(t.objects,i.name);return{[s]:r}}catch(e){return console.error("Error fetching group count for limetype: "+t.name,e),{[s]:{}}}}createGroupCount(t,e){const i={};for(const s of t){const{_id:t,[e]:r}=s;i[t]=r.count}return i}createSearchListItems(t=[]){return t.map((t=>this.createSearchListItem(t))).filter(N)}createSearchListItem(t){const e=this.viewFactoryRegistry.getFactory("search"),i=this.limeObjectService.getObject(t._limetype,t._id);if(!i)return null;const s=e(i,this.context),r=this.getGroupCountComponent(i);return Object.assign(Object.assign({},s),r?{primaryComponent:r}:{})}getGroupCountComponent(t){var e;const i=t.getLimetype(),s=null===(e=this.groupCounts[i.name])||void 0===e?void 0:e[t.id],r=F(i,"user");if(void 0!==s&&r)return{name:"limebb-mention-group-counter",props:{count:s,limetype:r.relation.getLimetype(),helperLabel:this.translator.get("webclient.notification-center.members-will-be-notified")}}}}class mt{constructor(t,e){this.file=t,this.http=e,this.uploadCancelled=!1,this.getUrl=t=>"api/v1/file/"+(null!=t?t:"")}async initialize(){this.uploadService=await this.http.createFileUpload(a.Post,this.getUrl(),this.file),this.progressCallback&&(this.uploadService.onProgress=this.progressCallback)}async upload(){return this.uploadService.upload()}getFileName(){return this.file.name}cancel(){this.uploadService.cancel(),this.uploadCancelled=!0}set onProgress(t){this.progressCallback=t,this.uploadService&&(this.uploadService.onProgress=t)}}class vt{constructor(t){this.platform=t}async handleImagePasted(t){const e=null==t?void 0:t.fileInfo;if(!e)return;if(!this.validateImageSize(e))return;t.insertThumbnail();const i=await this.createFileUpload(e),s=null==i?void 0:i.href;return s&&void 0!==(null==i?void 0:i.fileId)?t.insertImage(s):t.insertFailedThumbnail(),i}parseFileIdFromSrc(t){if(t){const e=/\/(\d+)\/contents\/?$/.exec(t);if(e&&e[1])return Number(e[1])}}validateImageSize(t){return!!t.fileContent&&t.fileContent.size<=52428800}async createFileUpload(t){var e;if(!t.fileContent)return;const i=new mt(t.fileContent,this.http);await i.initialize();const s=Object.assign(Object.assign({},t),{progress:0,file:i,state:"added",fileId:void 0,href:void 0,id:t.id});i.onProgress=t=>{0===s.progress&&(s.state="uploading"),s.progress=t,100===t&&(s.state="finalizing")};const r=await i.upload();return s.fileId=r.id,s.filename=r.filename,s.extension=r.extension,s.contentType=r.contentType,s.size=r.size,s.state="done",s.href=null===(e=r._links)||void 0===e?void 0:e.contents.href,s}get http(){return this.platform.get(n.Http)}}const bt=t(class extends e{watchOpen(){this.setupHandlers(),this.setPickerMessage()}watchQuery(){this.setPickerMessage()}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.change=i(this,"change",7),this.metadataChange=i(this,"metadataChange",7),this.allowMentioning=!1,this.contentType="markdown",this.language="en",this.disabled=!1,this.readonly=!1,this.invalid=!1,this.required=!1,this.ui="standard",this.allowResize=!0,this.value="",this.triggerMap={},this.customElements=[],this.allowInlineImages=!1,this.items=[],this.highlightedItemIndex=0,this.isPickerOpen=!1,this.isSearching=!1,this.registeredTriggers=[],this.registeredTriggerMap=this.triggerMap,this.registeredCustomElements=this.customElements,this.activeTrigger=void 0,this.handleMouseClick=t=>{this.textEditorPickerElement&&(t.target===this.textEditorPickerElement||this.resetTriggerAndPicker())},this.handleKeyPress=t=>{if(!this.isPickerOpen||!this.activeTrigger)return;if(![u,l,c,d,f].includes(t.key))return;if(t.stopPropagation(),t.preventDefault(),"keyup"===t.type)return;const e={[u]:this.handleEscapeKey,[d]:this.handleEnterOrTabKey,[f]:this.handleEnterOrTabKey,[c]:this.handleArrowKeyPress,[l]:this.handleArrowKeyPress}[t.key];e&&e(t)},this.handleArrowKeyPress=t=>{this.highlightedItemIndex=this.findNonSeparatorIndex(t.key,this.highlightedItemIndex)},this.findNonSeparatorIndex=(t,e,i=0)=>{if(0===this.items.length||i>this.items.length)return e;const s=((t,e,i)=>(e+(t===c?1:-1)+i)%i)(t,e,this.items.length);return this.isListSeparator(this.items[s])?this.findNonSeparatorIndex(t,s,i+1):s},this.handleEscapeKey=()=>{var t;null===(t=this.triggerFunction)||void 0===t||t.stopTrigger(),this.resetTriggerAndPicker()},this.handleEnterOrTabKey=t=>{this.handleItemSelection(t)},this.handleMetadataChange=t=>{t.stopPropagation();const e=t.detail,i=this.getEnhancedImages(e.images||[]),s=Object.assign(Object.assign({},e),{images:i});this.metadataChange.emit(s)},this.handleImagePasted=t=>{t.stopPropagation(),this.allowInlineImages&&this.uploadHandler.handleImagePasted(t.detail)},this.handleTriggerStart=t=>{t.stopPropagation(),this.activeTrigger=t.detail.trigger,this.triggerFunction=t.detail.textEditor,this.isPickerOpen=!0},this.handleTriggerStop=t=>{t.stopPropagation(),this.resetTriggerAndPicker()},this.handleTriggerChange=t=>{var e;t.stopImmediatePropagation(),this.editorPickerQuery=t.detail.value;const i=null===(e=this.registeredTriggerMap[t.detail.trigger])||void 0===e?void 0:e.searcher;i&&(this.isSearching=!0,this.debouncedSearchFn(i,this.editorPickerQuery))},this.resetTriggerAndPicker=()=>{this.isPickerOpen=!1,this.activeTrigger=void 0,this.triggerFunction=void 0,this.isSearching=!1,this.highlightedItemIndex=0,this.items=[]},this.handleItemSelection=t=>{var e;let i;if(t instanceof CustomEvent)i=t.detail;else{if(!(t instanceof KeyboardEvent))return;{const t=this.items[this.highlightedItemIndex];if(this.isListSeparator(t))return;i=t}}if(!this.activeTrigger||(null==i?void 0:i.disabled))return;const s=this.registeredTriggerMap[this.activeTrigger];try{s.inserter(this.triggerFunction,i)}catch(t){console.error("Error inserting",t)}this.resetTriggerAndPicker(),null===(e=this.textEditor)||void 0===e||e.focus()},this.handleVisibilityChange=()=>{"hidden"===document.visibilityState&&this.saveDraft()},this.handleBeforeUnload=()=>{this.saveDraft()},this.portalId=A(),this.debouncedSearchFn=function(t,e,i){var s,r,n,o,a,h,c=0,u=!1,l=!1,d=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){var i=s,n=r;return s=r=void 0,c=e,o=t.apply(n,i)}function m(t){var i=t-h;return void 0===h||i>=e||i<0||l&&t-c>=n}function v(){var t=ct();if(m(t))return b(t);a=setTimeout(v,function(t){var i=e-(t-h);return l?lt(i,n-(t-c)):i}(t))}function b(t){return a=void 0,d&&s?f(t):(s=r=void 0,o)}function p(){var t=ct(),i=m(t);if(s=arguments,r=this,h=t,i){if(void 0===a)return function(t){return c=t,a=setTimeout(v,e),u?f(t):o}(h);if(l)return clearTimeout(a),a=setTimeout(v,e),f(h)}return void 0===a&&(a=setTimeout(v,e)),o}return e=q(e)||0,k(i)&&(u=!!i.leading,n=(l="maxWait"in i)?ut(q(i.maxWait)||0,e):n,d="trailing"in i?!!i.trailing:d),p.cancel=function(){void 0!==a&&clearTimeout(a),c=0,s=h=r=a=void 0},p.flush=function(){return void 0===a?o:b(ct())},p}((async(t,e)=>{try{const i=await t(e);if(e!==this.editorPickerQuery||!this.activeTrigger)return;this.items=i}catch(t){console.error("Error searching",t)}finally{this.isSearching=!1}}),300)}connectedCallback(){var t,e,i,s;if(this.draftIdentifier){const r=null!==(e=null===(t=this.context)||void 0===t?void 0:t.id)&&void 0!==e?e:"no-limeobject",n=null!==(s=null===(i=this.context)||void 0===i?void 0:i.limetype)&&void 0!==s?s:"no-limetype";this.textEditorInnerId=["text-editor-draft",n,r,this.draftIdentifier].join("-")}this.textEditorInnerId&&(document.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("beforeunload",this.handleBeforeUnload)),this.uploadHandler=new vt(this.platform)}componentWillLoad(){this.allowMentioning&&this.registerMentions(),this.registerTriggers(),this.loadDraft()}disconnectedCallback(){document.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("beforeunload",this.handleBeforeUnload),document.removeEventListener("mousedown",this.handleMouseClick),this.saveDraft(),this.host&&(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0})),this.debouncedSearchFn&&this.debouncedSearchFn.cancel&&this.debouncedSearchFn.cancel()}registerMentions(){const t=new ft(this.platform,this.context,this.searchableLimetypes),e=t.triggerHandler.nodeDefinition;e&&(this.registeredCustomElements.push(e.customElement),this.registeredTriggerMap[t.triggerCharacter]=t.triggerHandler,t.initialize())}registerTriggers(){this.registeredTriggers=Object.keys(this.registeredTriggerMap)}setPickerMessage(){var t;if(!this.activeTrigger)return;const e=this.registeredTriggerMap[this.activeTrigger];this.pickerMessage=(null===(t=this.editorPickerQuery)||void 0===t?void 0:t.length)>0?e.noItemsFoundMessage:e.emptySearchMessage}setupHandlers(){this.isPickerOpen?(this.host.addEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.addEventListener("keydown",this.handleKeyPress,{capture:!0}),document.addEventListener("mousedown",this.handleMouseClick)):(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0}),document.removeEventListener("mousedown",this.handleMouseClick))}isListSeparator(t){return"separator"in t&&!0===t.separator}render(){return[s("limel-text-editor",{key:"38d692ec58c569a0429caddf7ecfe418e21ac14b",ref:t=>this.textEditor=t,tabindex:this.disabled?-1:0,value:this.value,contentType:this.contentType,customElements:this.registeredCustomElements,"aria-disabled":this.disabled,language:this.language,triggers:this.registeredTriggers,onTriggerStart:this.handleTriggerStart,onTriggerStop:this.handleTriggerStop,onTriggerChange:this.handleTriggerChange,onImagePasted:this.handleImagePasted,onMetadataChange:this.handleMetadataChange,ui:this.ui,allowResize:this.allowResize,required:this.required,disabled:this.disabled,readonly:this.readonly,helperText:this.helperText,placeholder:this.placeholder,label:this.label,invalid:this.invalid}),this.renderPicker()]}renderPicker(){if(this.isPickerOpen)return s("limel-portal",{containerId:this.portalId,visible:this.isPickerOpen,openDirection:"top",inheritParentWidth:!0,anchor:this.textEditor},s("limebb-text-editor-picker",{ref:t=>this.textEditorPickerElement=t,items:dt(this.items,this.highlightedItemIndex),onItemSelected:this.handleItemSelection,emptyMessage:this.pickerMessage,isSearching:this.isSearching}))}getEnhancedImages(t){return t.map((t=>{let e;return"success"===t.state&&(e=this.uploadHandler.parseFileIdFromSrc(t.src)),e?Object.assign(Object.assign({},t),{fileId:e}):t}))}loadDraft(){if(!this.userDataService||!this.textEditorInnerId)return;if(this.value)return;const t=this.userDataService.get(this.textEditorInnerId);t&&this.change.emit(t)}saveDraft(){var t,e,i,s;if(!this.textEditorInnerId)return;const r=null===(t=this.value)||void 0===t?void 0:t.trim(),n=null===(e=this.userDataService)||void 0===e?void 0:e.get(this.textEditorInnerId);r&&r!==n?null===(i=this.userDataService)||void 0===i||i.set(this.textEditorInnerId,r):!r&&n&&(null===(s=this.userDataService)||void 0===s||s.set(this.textEditorInnerId,void 0))}get userDataService(){return this.platform.get(n.UserDataRepository)}static get delegatesFocus(){return!0}get host(){return this}static get watchers(){return{isPickerOpen:[{watchOpen:0}],editorPickerQuery:[{watchQuery:0}]}}static get style(){return":host(limebb-text-editor){display:block;width:100%;min-width:5rem;min-height:5rem;height:100%;max-height:var(--text-editor-max-height, calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)) - 4rem))}"}},[17,"limebb-text-editor",{platform:[16],context:[16],allowMentioning:[4,"allow-mentioning"],contentType:[1,"content-type"],language:[513],disabled:[516],readonly:[516],helperText:[513,"helper-text"],placeholder:[513],label:[513],invalid:[516],required:[516],selectedContext:[16],ui:[513],allowResize:[4,"allow-resize"],value:[1],draftIdentifier:[1,"draft-identifier"],triggerMap:[16],customElements:[16],allowInlineImages:[4,"allow-inline-images"],items:[32],highlightedItemIndex:[32],editorPickerQuery:[32],searchableLimetypes:[32],isPickerOpen:[32],isSearching:[32]},void 0,{isPickerOpen:[{watchOpen:0}],editorPickerQuery:[{watchQuery:0}]}]);!function(t,e,i,s){var r,n=arguments.length,o=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,i,o):r(e,i))||o);n>3&&o&&Object.defineProperty(e,i,o)}([h({map:[function(t){return Object.values(t).filter((t=>M(t,"user")||P(t,"user")))}]})],bt.prototype,"searchableLimetypes",void 0);const pt=bt,gt=function(){"undefined"!=typeof customElements&&["limebb-text-editor","limebb-empty-state","limebb-text-editor-picker"].forEach((t=>{switch(t){case"limebb-text-editor":customElements.get(r(t))||customElements.define(r(t),bt);break;case"limebb-empty-state":customElements.get(r(t))||_();break;case"limebb-text-editor-picker":customElements.get(r(t))||z()}}))};export{pt as LimebbTextEditor,gt as defineCustomElement}
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as e,createEvent as i,h as s,transformTag as r}from"@stencil/core/internal/client";import{b as n,r as o,c as a,L as h}from"./index.esm.js";import{A as c,E as u,b as l,a as d,T as f}from"./keycodes.js";import{o as m,U as v,c as b,a as p,d as g,n as y,i as j,S as w,g as x}from"./_Uint8Array.js";import{d as O}from"./_defineProperty.js";import{c as k,e as S,S as I,i as E,a as C,r as T}from"./_MapCache.js";import{c as A}from"./random-string.js";import{h as P,b as M,c as F}from"./limetype.js";import{i as N}from"./non-null.js";import{d as _}from"./empty-state.js";import{d as L}from"./text-editor-picker.js";import{i as z}from"./isSymbol.js";var D=/\s/,R=/^\s+/;var U=/^[-+]0x[0-9a-f]+$/i,$=/^0b[01]+$/i,Q=/^0o[0-7]+$/i,G=parseInt;function q(t){if("number"==typeof t)return t;if(z(t))return NaN;if(k(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=k(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=function(t){return t?t.slice(0,function(t){for(var e=t.length;e--&&D.test(t.charAt(e)););return e}(t)+1).replace(R,""):t}(t);var i=$.test(t);return i||Q.test(t)?G(t.slice(2),i?2:8):U.test(t)?NaN:+t}var W=Object.create,B=function(){function t(){}return function(e){if(!k(e))return{};if(W)return W(e);t.prototype=e;var i=new t;return t.prototype=void 0,i}}(),H=Object.prototype.hasOwnProperty;var K=m(Object.getPrototypeOf,Object);"object"==typeof exports&&exports&&!exports.nodeType&&exports&&"object"==typeof module&&module&&!module.nodeType&&module;var V=Object.prototype.hasOwnProperty;function J(t){var e=new t.constructor(t.byteLength);return new v(e).set(new v(t)),e}var X=/\w*$/,Y=I?I.prototype:void 0,Z=Y?Y.valueOf:void 0;var tt=y&&y.isMap,et=tt?g(tt):function(t){return E(t)&&"[object Map]"==p(t)},it=y&&y.isSet,st=it?g(it):function(t){return E(t)&&"[object Set]"==p(t)},rt="[object Arguments]",nt="[object Function]",ot="[object Object]",at={};function ht(t,e,i,s,r,n){var o;if(void 0!==o)return o;if(!k(t))return t;var a=C(t);if(a)o=function(t){var e=t.length,i=new t.constructor(e);return e&&"string"==typeof t[0]&&V.call(t,"index")&&(i.index=t.index,i.input=t.input),i}(t);else{var h=p(t),c=h==nt||"[object GeneratorFunction]"==h;if(j(t))return function(t){return t.slice()}(t);if(h==ot||h==rt||c&&!r)o=c?{}:function(t){return"function"!=typeof t.constructor||b(t)?{}:B(K(t))}(t);else{if(!at[h])return r?t:{};o=function(t,e){var i=t.constructor;switch(e){case"[object ArrayBuffer]":return J(t);case"[object Boolean]":case"[object Date]":return new i(+t);case"[object DataView]":return function(t){var e=J(t.buffer);return new t.constructor(e,t.byteOffset,t.byteLength)}(t);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(t){var e=J(t.buffer);return new t.constructor(e,t.byteOffset,t.length)}(t);case"[object Map]":case"[object Set]":return new i;case"[object Number]":case"[object String]":return new i(t);case"[object RegExp]":return function(t){var e=new t.constructor(t.source,X.exec(t));return e.lastIndex=t.lastIndex,e}(t);case"[object Symbol]":return function(t){return Z?Object(Z.call(t)):{}}(t)}}(t,h)}}n||(n=new w);var u=n.get(t);if(u)return u;n.set(t,o),st(t)?t.forEach((function(s){o.add(ht(s,e,i,0,t,n))})):et(t)&&t.forEach((function(s,r){o.set(r,ht(s,e,i,0,t,n))}));var l=a?void 0:x(t);return function(t,e){for(var i=-1,s=null==t?0:t.length;++i<s&&!1!==e(t[i],i););}(l||t,(function(s,r){l&&(s=t[r=s]),function(t,e,i){var s=t[e];H.call(t,e)&&S(s,i)&&(void 0!==i||e in t)||function(t,e,i){"__proto__"==e&&O?O(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}(t,e,i)}(o,r,ht(s,e,i,0,t,n))})),o}at[rt]=at["[object Array]"]=at["[object ArrayBuffer]"]=at["[object DataView]"]=at["[object Boolean]"]=at["[object Date]"]=at["[object Float32Array]"]=at["[object Float64Array]"]=at["[object Int8Array]"]=at["[object Int16Array]"]=at["[object Int32Array]"]=at["[object Map]"]=at["[object Number]"]=at[ot]=at["[object RegExp]"]=at["[object Set]"]=at["[object String]"]=at["[object Symbol]"]=at["[object Uint8Array]"]=at["[object Uint8ClampedArray]"]=at["[object Uint16Array]"]=at["[object Uint32Array]"]=!0,at["[object Error]"]=at[nt]=at["[object WeakMap]"]=!1;var ct=function(){return T.Date.now()},ut=Math.max,lt=Math.min;function dt(t,e){return t.map(((t,i)=>{const s=function(t){return ht(t,5)}(t);return Object.assign(Object.assign({},s),{selected:i===e})}))}class ft{get limeObjectService(){return this.platform.get(n.LimeObjectRepository)}get queryService(){return this.platform.get(n.Query)}get viewFactoryRegistry(){return this.platform.get(n.ViewFactoryRegistry)}get translator(){var t;return null===(t=this.platform)||void 0===t?void 0:t.get(n.Translate)}get triggerCharacter(){return this._triggerCharacter}get triggerHandler(){return this._triggerHandler}constructor(t,e,i){this.platform=t,this.context=e,this.searchableLimetypes=i,this.groupCounts={},this._triggerCharacter="@",this._triggerHandler={searcher:t=>this.searcher(t),inserter:(t,e)=>this.inserter(t,e),emptySearchMessage:"Start typing a name...",noItemsFoundMessage:"No results for your search...",nodeDefinition:{customElement:{tagName:"limebb-mention",attributes:["limetype","objectid","href"]},mapAttributes:t=>({limetype:t.value.getLimetype().name,objectid:t.value.id,href:`object/${this.context.limetype}/${this.context.id}`})}},this.searcher=async t=>{if(!t)return[];const{objects:e}=await this.limeObjectService.search(t,this.searchableLimetypes,10);return this.createSearchListItems(e)},this.inserter=async(t,e)=>{var i;const s=this.triggerHandler.nodeDefinition;s&&t.insert({node:{tagName:s.customElement.tagName,attributes:s.mapAttributes(e)},children:[null===(i=e.value)||void 0===i?void 0:i.descriptive]})}}async initialize(){await this.loadGroupCounts()}async loadGroupCounts(){const t=this.searchableLimetypes.filter((t=>!M(t,"user")&&P(t,"user"))).map((t=>this.getGroupCounts(t)));for(const e of await Promise.all(t))Object.assign(this.groupCounts,e)}async getGroupCounts(t){var e;const i=F(t,"user"),s=t.name;try{const t=await this.queryService.execute({limetype:s,responseFormat:{object:{_id:null,[i.name]:{count:{aggregate:{op:o.Count}}}}}});if(!(null===(e=t.objects)||void 0===e?void 0:e.length))return{[s]:{}};const r=this.createGroupCount(t.objects,i.name);return{[s]:r}}catch(e){return console.error("Error fetching group count for limetype: "+t.name,e),{[s]:{}}}}createGroupCount(t,e){const i={};for(const s of t){const{_id:t,[e]:r}=s;i[t]=r.count}return i}createSearchListItems(t=[]){return t.map((t=>this.createSearchListItem(t))).filter(N)}createSearchListItem(t){const e=this.viewFactoryRegistry.getFactory("search"),i=this.limeObjectService.getObject(t._limetype,t._id);if(!i)return null;const s=e(i,this.context),r=this.getGroupCountComponent(i);return Object.assign(Object.assign({},s),r?{primaryComponent:r}:{})}getGroupCountComponent(t){var e;const i=t.getLimetype(),s=null===(e=this.groupCounts[i.name])||void 0===e?void 0:e[t.id],r=F(i,"user");if(void 0!==s&&r)return{name:"limebb-mention-group-counter",props:{count:s,limetype:r.relation.getLimetype(),helperLabel:this.translator.get("webclient.notification-center.members-will-be-notified")}}}}class mt{constructor(t,e){this.file=t,this.http=e,this.uploadCancelled=!1,this.getUrl=t=>"api/v1/file/"+(null!=t?t:"")}async initialize(){this.uploadService=await this.http.createFileUpload(a.Post,this.getUrl(),this.file),this.progressCallback&&(this.uploadService.onProgress=this.progressCallback)}async upload(){return this.uploadService.upload()}getFileName(){return this.file.name}cancel(){this.uploadService.cancel(),this.uploadCancelled=!0}set onProgress(t){this.progressCallback=t,this.uploadService&&(this.uploadService.onProgress=t)}}class vt{constructor(t){this.platform=t}async handleImagePasted(t){const e=null==t?void 0:t.fileInfo;if(!e)return;if(!this.validateImageSize(e))return;t.insertThumbnail();const i=await this.createFileUpload(e),s=null==i?void 0:i.href;return s&&void 0!==(null==i?void 0:i.fileId)?t.insertImage(s):t.insertFailedThumbnail(),i}parseFileIdFromSrc(t){if(t){const e=/\/(\d+)\/contents\/?$/.exec(t);if(e&&e[1])return Number(e[1])}}validateImageSize(t){return!!t.fileContent&&t.fileContent.size<=52428800}async createFileUpload(t){var e;if(!t.fileContent)return;const i=new mt(t.fileContent,this.http);await i.initialize();const s=Object.assign(Object.assign({},t),{progress:0,file:i,state:"added",fileId:void 0,href:void 0,id:t.id});i.onProgress=t=>{0===s.progress&&(s.state="uploading"),s.progress=t,100===t&&(s.state="finalizing")};const r=await i.upload();return s.fileId=r.id,s.filename=r.filename,s.extension=r.extension,s.contentType=r.contentType,s.size=r.size,s.state="done",s.href=null===(e=r._links)||void 0===e?void 0:e.contents.href,s}get http(){return this.platform.get(n.Http)}}const bt=t(class extends e{watchOpen(){this.setupHandlers(),this.setPickerMessage()}watchQuery(){this.setPickerMessage()}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.change=i(this,"change",7),this.metadataChange=i(this,"metadataChange",7),this.allowMentioning=!1,this.contentType="markdown",this.language="en",this.disabled=!1,this.readonly=!1,this.invalid=!1,this.required=!1,this.ui="standard",this.allowResize=!0,this.value="",this.triggerMap={},this.customElements=[],this.allowInlineImages=!1,this.items=[],this.highlightedItemIndex=0,this.isPickerOpen=!1,this.isSearching=!1,this.registeredTriggers=[],this.registeredTriggerMap=this.triggerMap,this.registeredCustomElements=this.customElements,this.activeTrigger=void 0,this.handleMouseClick=t=>{this.textEditorPickerElement&&(t.target===this.textEditorPickerElement||this.resetTriggerAndPicker())},this.handleKeyPress=t=>{if(!this.isPickerOpen||!this.activeTrigger)return;if(![u,l,c,d,f].includes(t.key))return;if(t.stopPropagation(),t.preventDefault(),"keyup"===t.type)return;const e={[u]:this.handleEscapeKey,[d]:this.handleEnterOrTabKey,[f]:this.handleEnterOrTabKey,[c]:this.handleArrowKeyPress,[l]:this.handleArrowKeyPress}[t.key];e&&e(t)},this.handleArrowKeyPress=t=>{this.highlightedItemIndex=this.findNonSeparatorIndex(t.key,this.highlightedItemIndex)},this.findNonSeparatorIndex=(t,e,i=0)=>{if(0===this.items.length||i>this.items.length)return e;const s=((t,e,i)=>(e+(t===c?1:-1)+i)%i)(t,e,this.items.length);return this.isListSeparator(this.items[s])?this.findNonSeparatorIndex(t,s,i+1):s},this.handleEscapeKey=()=>{var t;null===(t=this.triggerFunction)||void 0===t||t.stopTrigger(),this.resetTriggerAndPicker()},this.handleEnterOrTabKey=t=>{this.handleItemSelection(t)},this.handleMetadataChange=t=>{t.stopPropagation();const e=t.detail,i=this.getEnhancedImages(e.images||[]),s=Object.assign(Object.assign({},e),{images:i});this.metadataChange.emit(s)},this.handleImagePasted=t=>{t.stopPropagation(),this.allowInlineImages&&this.uploadHandler.handleImagePasted(t.detail)},this.handleTriggerStart=t=>{t.stopPropagation(),this.activeTrigger=t.detail.trigger,this.triggerFunction=t.detail.textEditor,this.isPickerOpen=!0},this.handleTriggerStop=t=>{t.stopPropagation(),this.resetTriggerAndPicker()},this.handleTriggerChange=t=>{var e;t.stopImmediatePropagation(),this.editorPickerQuery=t.detail.value;const i=null===(e=this.registeredTriggerMap[t.detail.trigger])||void 0===e?void 0:e.searcher;i&&(this.isSearching=!0,this.debouncedSearchFn(i,this.editorPickerQuery))},this.resetTriggerAndPicker=()=>{this.isPickerOpen=!1,this.activeTrigger=void 0,this.triggerFunction=void 0,this.isSearching=!1,this.highlightedItemIndex=0,this.items=[]},this.handleItemSelection=t=>{var e;let i;if(t instanceof CustomEvent)i=t.detail;else{if(!(t instanceof KeyboardEvent))return;{const t=this.items[this.highlightedItemIndex];if(this.isListSeparator(t))return;i=t}}if(!this.activeTrigger||(null==i?void 0:i.disabled))return;const s=this.registeredTriggerMap[this.activeTrigger];try{s.inserter(this.triggerFunction,i)}catch(t){console.error("Error inserting",t)}this.resetTriggerAndPicker(),null===(e=this.textEditor)||void 0===e||e.focus()},this.handleVisibilityChange=()=>{"hidden"===document.visibilityState&&this.saveDraft()},this.handleBeforeUnload=()=>{this.saveDraft()},this.portalId=A(),this.debouncedSearchFn=function(t,e,i){var s,r,n,o,a,h,c=0,u=!1,l=!1,d=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){var i=s,n=r;return s=r=void 0,c=e,o=t.apply(n,i)}function m(t){var i=t-h;return void 0===h||i>=e||i<0||l&&t-c>=n}function v(){var t=ct();if(m(t))return b(t);a=setTimeout(v,function(t){var i=e-(t-h);return l?lt(i,n-(t-c)):i}(t))}function b(t){return a=void 0,d&&s?f(t):(s=r=void 0,o)}function p(){var t=ct(),i=m(t);if(s=arguments,r=this,h=t,i){if(void 0===a)return function(t){return c=t,a=setTimeout(v,e),u?f(t):o}(h);if(l)return clearTimeout(a),a=setTimeout(v,e),f(h)}return void 0===a&&(a=setTimeout(v,e)),o}return e=q(e)||0,k(i)&&(u=!!i.leading,n=(l="maxWait"in i)?ut(q(i.maxWait)||0,e):n,d="trailing"in i?!!i.trailing:d),p.cancel=function(){void 0!==a&&clearTimeout(a),c=0,s=h=r=a=void 0},p.flush=function(){return void 0===a?o:b(ct())},p}((async(t,e)=>{try{const i=await t(e);if(e!==this.editorPickerQuery||!this.activeTrigger)return;this.items=i}catch(t){console.error("Error searching",t)}finally{this.isSearching=!1}}),300)}connectedCallback(){var t,e,i,s;if(this.draftIdentifier){const r=null!==(e=null===(t=this.context)||void 0===t?void 0:t.id)&&void 0!==e?e:"no-limeobject",n=null!==(s=null===(i=this.context)||void 0===i?void 0:i.limetype)&&void 0!==s?s:"no-limetype";this.textEditorInnerId=["text-editor-draft",n,r,this.draftIdentifier].join("-")}this.textEditorInnerId&&(document.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("beforeunload",this.handleBeforeUnload)),this.uploadHandler=new vt(this.platform)}componentWillLoad(){this.allowMentioning&&this.registerMentions(),this.registerTriggers(),this.loadDraft()}disconnectedCallback(){document.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("beforeunload",this.handleBeforeUnload),document.removeEventListener("mousedown",this.handleMouseClick),this.saveDraft(),this.host&&(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0})),this.debouncedSearchFn&&this.debouncedSearchFn.cancel&&this.debouncedSearchFn.cancel()}registerMentions(){const t=new ft(this.platform,this.context,this.searchableLimetypes),e=t.triggerHandler.nodeDefinition;e&&(this.registeredCustomElements.push(e.customElement),this.registeredTriggerMap[t.triggerCharacter]=t.triggerHandler,t.initialize())}registerTriggers(){this.registeredTriggers=Object.keys(this.registeredTriggerMap)}setPickerMessage(){var t;if(!this.activeTrigger)return;const e=this.registeredTriggerMap[this.activeTrigger];this.pickerMessage=(null===(t=this.editorPickerQuery)||void 0===t?void 0:t.length)>0?e.noItemsFoundMessage:e.emptySearchMessage}setupHandlers(){this.isPickerOpen?(this.host.addEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.addEventListener("keydown",this.handleKeyPress,{capture:!0}),document.addEventListener("mousedown",this.handleMouseClick)):(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0}),document.removeEventListener("mousedown",this.handleMouseClick))}isListSeparator(t){return"separator"in t&&!0===t.separator}render(){return[s("limel-text-editor",{key:"38d692ec58c569a0429caddf7ecfe418e21ac14b",ref:t=>this.textEditor=t,tabindex:this.disabled?-1:0,value:this.value,contentType:this.contentType,customElements:this.registeredCustomElements,"aria-disabled":this.disabled,language:this.language,triggers:this.registeredTriggers,onTriggerStart:this.handleTriggerStart,onTriggerStop:this.handleTriggerStop,onTriggerChange:this.handleTriggerChange,onImagePasted:this.handleImagePasted,onMetadataChange:this.handleMetadataChange,ui:this.ui,allowResize:this.allowResize,required:this.required,disabled:this.disabled,readonly:this.readonly,helperText:this.helperText,placeholder:this.placeholder,label:this.label,invalid:this.invalid}),this.renderPicker()]}renderPicker(){if(this.isPickerOpen)return s("limel-portal",{containerId:this.portalId,visible:this.isPickerOpen,openDirection:"top",inheritParentWidth:!0,anchor:this.textEditor},s("limebb-text-editor-picker",{ref:t=>this.textEditorPickerElement=t,items:dt(this.items,this.highlightedItemIndex),onItemSelected:this.handleItemSelection,emptyMessage:this.pickerMessage,isSearching:this.isSearching}))}getEnhancedImages(t){return t.map((t=>{let e;return"success"===t.state&&(e=this.uploadHandler.parseFileIdFromSrc(t.src)),e?Object.assign(Object.assign({},t),{fileId:e}):t}))}loadDraft(){if(!this.userDataService||!this.textEditorInnerId)return;if(this.value)return;const t=this.userDataService.get(this.textEditorInnerId);t&&this.change.emit(t)}saveDraft(){var t,e,i,s;if(!this.textEditorInnerId)return;const r=null===(t=this.value)||void 0===t?void 0:t.trim(),n=null===(e=this.userDataService)||void 0===e?void 0:e.get(this.textEditorInnerId);r&&r!==n?null===(i=this.userDataService)||void 0===i||i.set(this.textEditorInnerId,r):!r&&n&&(null===(s=this.userDataService)||void 0===s||s.set(this.textEditorInnerId,void 0))}get userDataService(){return this.platform.get(n.UserDataRepository)}static get delegatesFocus(){return!0}get host(){return this}static get watchers(){return{isPickerOpen:[{watchOpen:0}],editorPickerQuery:[{watchQuery:0}]}}static get style(){return":host(limebb-text-editor){display:block;width:100%;min-width:5rem;min-height:5rem;height:100%;max-height:var(--text-editor-max-height, calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)) - 4rem))}"}},[17,"limebb-text-editor",{platform:[16],context:[16],allowMentioning:[4,"allow-mentioning"],contentType:[1,"content-type"],language:[513],disabled:[516],readonly:[516],helperText:[513,"helper-text"],placeholder:[513],label:[513],invalid:[516],required:[516],selectedContext:[16],ui:[513],allowResize:[4,"allow-resize"],value:[1],draftIdentifier:[1,"draft-identifier"],triggerMap:[16],customElements:[16],allowInlineImages:[4,"allow-inline-images"],items:[32],highlightedItemIndex:[32],editorPickerQuery:[32],searchableLimetypes:[32],isPickerOpen:[32],isSearching:[32]},void 0,{isPickerOpen:[{watchOpen:0}],editorPickerQuery:[{watchQuery:0}]}]);!function(t,e,i,s){var r,n=arguments.length,o=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,i,o):r(e,i))||o);n>3&&o&&Object.defineProperty(e,i,o)}([h({map:[function(t){return Object.values(t).filter((t=>M(t,"user")||P(t,"user")))}]})],bt.prototype,"searchableLimetypes",void 0);const pt=bt,gt=function(){"undefined"!=typeof customElements&&["limebb-text-editor","limebb-empty-state","limebb-text-editor-picker"].forEach((t=>{switch(t){case"limebb-text-editor":customElements.get(r(t))||customElements.define(r(t),bt);break;case"limebb-empty-state":customElements.get(r(t))||_();break;case"limebb-text-editor-picker":customElements.get(r(t))||L()}}))};export{pt as LimebbTextEditor,gt as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as o,HTMLElement as r,h as e,Host as t,transformTag as a}from"@stencil/core/internal/client";import{n as i}from"./index.esm.js";import{g as s,n as l}from"./normalize-value.js";const n=o(class extends r{constructor(o){super(),!1!==o&&this.__registerHost(),this.__attachShadow(),this.suffix="%",this.reducePresence=!0,this.locale="en",this.labelId="a"+crypto.randomUUID(),this.tooltipId="a"+crypto.randomUUID(),this.helperTextId="a"+crypto.randomUUID(),this.renderHelperLine=()=>{if(this.hasHelperText())return e("limel-helper-line",{helperTextId:this.helperTextId,helperText:this.helperText,invalid:this.invalid})},this.hasHelperText=()=>null!=this.helperText}valueChanged(o){this.numValue=this.parseValue(o)}componentWillLoad(){try{this.locale=this.platform.get(i.UserPreferencesRepository).get("locale"),this.numberFormat=new Intl.NumberFormat(this.locale)}catch(o){console.warn(`Could not get user's locale (${this.locale}), falling back to 'en'.`),this.locale="en",this.numberFormat=new Intl.NumberFormat("en")}this.numValue=this.parseValue(this.value)}render(){return e(t,{key:"fd3bce29b7cd49a4642904fa630616b10e7d55b8",class:this.getContainerClassList()},e("limel-notched-outline",{key:"3502f060569abb0e12c5b6bca84fdf9b190e840f",id:this.tooltipId,label:this.label,labelId:this.labelId,invalid:this.invalid,required:this.required,hasValue:!0,hasFloatingLabel:!0,"aria-labelledby":this.labelId,"aria-describedby":this.helperTextId,"aria-controls":this.helperTextId},e("div",{key:"4f007fec33a71fe2205c1fbb861b45b8d41f440e",slot:"content",tabIndex:0},this.renderVisualization())),this.renderHelperLine(),this.renderTooltip())}renderVisualization(){if(!this.reducePresence||0!==this.numValue&&this.hasValue())return this.hasValue()?[this.getArrowIcon(),e("span",null,this.renderGrowthPercentage(),this.renderGrowthAmount())]:e("span",{class:"no-value"},"–")}renderTooltip(){if(void 0===this.formerValue)return;const o=this.value+" - "+(this.formerValue>0?this.formerValue:"("+this.formerValue+")")+" = "+this.calculateGrowth()+` ${this.suffix} `,r=this.calculatePercentage();return e("limel-tooltip",{openDirection:"top-start",elementId:this.tooltipId,label:r+"%",helperLabel:o})}renderGrowthPercentage(){if(void 0===this.formerValue)return this.formatValue(this.numValue,this.suffix);const o=this.calculatePercentage();return null!==o?this.formatValue(o,"%"):void 0}renderGrowthAmount(){if(void 0===this.formerValue)return;const o=this.calculateGrowth();return e("span",{class:"growth-unit"},"( ",this.formatValue(o,this.suffix)," )")}hasValue(){return null!=this.value&&""!==this.value}getContainerClassList(){if(!this.hasValue())return;const o=this.getPercentage(),r=s(o);return Object.assign({},r&&{[r]:!0})}getPercentage(){return void 0===this.formerValue?this.numValue:this.calculatePercentage()}calculateGrowth(){return this.numValue-this.formerValue}calculatePercentage(){return 0===this.formerValue?null:Number.parseFloat(((this.numValue-this.formerValue)/Math.abs(this.formerValue)*100).toFixed(2))}unifyMinusSign(o){return o.replaceAll("−","-")}convertToUnicodeMinus(o){return o.replaceAll("-","−")}parseValue(o){return"string"==typeof o?Number.parseFloat(l(this.unifyMinusSign(o),this.locale)):o}formatValue(o,r){const e=`${this.numberFormat.format(o)} ${r}`;return o>0?"+"+e:this.convertToUnicodeMinus(e)}getArrowIcon(){return e("limel-icon",{class:"icon",name:"right","aria-hidden":"true",role:"presentation"})}static get watchers(){return{value:[{valueChanged:0}]}}static get style(){return'@charset "UTF-8";*{box-sizing:border-box}:host(limebb-trend-indicator){position:relative;display:block;height:100%;width:100%}limel-notched-outline:not([invalid]:not([invalid=false])) .limel-notched-outline--outlines{--limel-notched-outline-border-color:transparent}div[slot=content]{display:flex;align-items:center;gap:0.5rem;border-radius:inherit;background-color:transparent !important}div[slot=content]:focus{outline:none}div[slot=content]:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}:host(limebb-trend-indicator):has(label) div[slot=content]{min-height:2.5rem;padding:0 0.375rem 0 1rem}:host(limebb-trend-indicator[former-value]) div[slot=content]{cursor:help}div[slot=content] span{flex-shrink:0}.icon{flex-shrink:0;display:flex;transition-property:color, background-color, transform;transition-duration:0.4s;transition-timing-function:ease;width:1.25rem;height:1.25rem;border-radius:50%;padding:0.12rem;color:rgb(var(--color-white));background-color:rgb(var(--color-gray-default), 0.5)}:host(.has-value-40to30-negative) .icon{color:rgb(var(--color-gray-darker))}:host(.has-value-30to20-negative) .icon{color:rgb(var(--color-gray-darker))}:host(.has-value-20to10-negative) .icon{color:rgb(var(--color-gray-darker))}:host(.has-value-10to0-negative) .icon{color:rgb(var(--color-gray-darker))}:host(.has-value-0to10-positive) .icon{color:rgb(var(--color-gray-dark))}:host(.has-value-10to20-positive) .icon{color:rgb(var(--color-gray-dark))}:host(.has-value-20to30-positive) .icon{color:rgb(var(--color-gray-dark))}:host(.has-value-30to40-positive) .icon{color:rgb(var(--color-gray-dark))}:host(.has-value-200or-larger-negative) .icon{background-color:rgb(var(--color-red-darker));transform:rotate(90deg)}:host(.has-value-200to100-negative) .icon{background-color:rgb(var(--color-red-dark));transform:rotate(90deg)}:host(.has-value-100to90-negative) .icon{background-color:rgb(var(--color-red-dark));transform:rotate(90deg)}:host(.has-value-90to80-negative) .icon{background-color:rgb(var(--color-red-dark));transform:rotate(81deg)}:host(.has-value-80to70-negative) .icon{background-color:rgb(var(--color-red-default));transform:rotate(72deg)}:host(.has-value-70to60-negative) .icon{background-color:rgb(var(--color-red-default));transform:rotate(63deg)}:host(.has-value-60to50-negative) .icon{background-color:rgb(var(--color-coral-default));transform:rotate(54deg)}:host(.has-value-50to40-negative) .icon{background-color:rgb(var(--color-coral-default));transform:rotate(45deg)}:host(.has-value-40to30-negative) .icon{background-color:rgb(var(--color-orange-default));transform:rotate(36deg)}:host(.has-value-30to20-negative) .icon{background-color:rgb(var(--color-orange-default));transform:rotate(27deg)}:host(.has-value-20to10-negative) .icon{background-color:rgb(var(--color-amber-default));transform:rotate(18deg)}:host(.has-value-10to0-negative) .icon{background-color:rgb(var(--color-amber-default));transform:rotate(9deg)}:host(.has-value-0) .icon{background-color:rgb(var(--color-gray-default));transform:rotate(0deg)}:host(.has-value-0to10-positive) .icon{background-color:rgb(var(--color-yellow-default));transform:rotate(-9deg)}:host(.has-value-10to20-positive) .icon{background-color:rgb(var(--color-yellow-default));transform:rotate(-18deg)}:host(.has-value-20to30-positive) .icon{background-color:rgb(var(--color-grass-default));transform:rotate(-27deg)}:host(.has-value-30to40-positive) .icon{background-color:rgb(var(--color-grass-default));transform:rotate(-36deg)}:host(.has-value-40to50-positive) .icon{background-color:rgb(var(--color-lime-default));transform:rotate(-45deg)}:host(.has-value-50to60-positive) .icon{background-color:rgb(var(--color-lime-default));transform:rotate(-54deg)}:host(.has-value-60to70-positive) .icon{background-color:rgb(var(--color-teal-default));transform:rotate(-63deg)}:host(.has-value-70to80-positive) .icon{background-color:rgb(var(--color-teal-default));transform:rotate(-72deg)}:host(.has-value-80to90-positive) .icon{background-color:rgb(var(--color-teal-dark));transform:rotate(-81deg)}:host(.has-value-90to100-positive) .icon{background-color:rgb(var(--color-teal-dark));transform:rotate(-90deg)}:host(.has-value-100to200-positive) .icon{background-color:rgb(var(--color-teal-dark));transform:rotate(-90deg)}:host(.has-value-200or-larger-positive) .icon{background-color:rgb(var(--color-teal-darker));transform:rotate(-90deg)}:host(.has-value-0) .icon{background-color:rgb(var(--color-gray-default), 0.5);transform:rotate(0deg)}:host(.has-value-0) .icon polyline{color:transparent}:host(.has-value-200or-larger-negative) .icon:after,:host(.has-value-200or-larger-negative) .icon:before,:host(.has-value-200to100-negative) .icon:after,:host(.has-value-200to100-negative) .icon:before,:host(.has-value-100to200-positive) .icon:after,:host(.has-value-100to200-positive) .icon:before,:host(.has-value-200or-larger-positive) .icon:after,:host(.has-value-200or-larger-positive) .icon:before{transition:border-color 0.6s ease;content:"";position:absolute;inset:0;margin:auto;border:1px solid transparent;border-radius:50%}:host(.has-value-200or-larger-negative) .icon:before,:host(.has-value-200to100-negative) .icon:before,:host(.has-value-100to200-positive) .icon:before,:host(.has-value-200or-larger-positive) .icon:before{transform:scale(1.2)}:host(.has-value-200or-larger-negative) .icon:after,:host(.has-value-200to100-negative) .icon:after,:host(.has-value-100to200-positive) .icon:after,:host(.has-value-200or-larger-positive) .icon:after{transform:scale(1.4);opacity:0.4}:host(.has-value-200to100-negative) .icon:before,:host(.has-value-200or-larger-negative) .icon:before{border-color:rgb(var(--color-red-dark))}:host(.has-value-200or-larger-negative) .icon:after{border-color:rgb(var(--color-red-darker))}:host(.has-value-100to200-positive) .icon:before,:host(.has-value-200or-larger-positive) .icon:before{border-color:rgb(var(--color-teal-dark))}:host(.has-value-200or-larger-positive) .icon:after{border-color:rgb(var(--color-teal-darker))}.no-value{transform:translateY(0.5rem)}.growth-unit{padding-left:0.5rem;opacity:0.5}:host(limebb-trend-indicator:focus),:host(limebb-trend-indicator:focus-visible),:host(limebb-trend-indicator:focus-within){--limel-h-l-grid-template-rows-transition-speed:0.46s;--limel-h-l-grid-template-rows:1fr}:host(limebb-trend-indicator){--limel-h-l-grid-template-rows-transition-speed:0.3s;--limel-h-l-grid-template-rows:0fr}:host(limebb-trend-indicator:focus) limel-helper-line,:host(limebb-trend-indicator:focus-visible) limel-helper-line,:host(limebb-trend-indicator:focus-within) limel-helper-line,:host(limebb-trend-indicator:hover) limel-helper-line{will-change:grid-template-rows}'}},[1,"limebb-trend-indicator",{platform:[16],context:[16],value:[520],formerValue:[514,"former-value"],suffix:[513],label:[513],invalid:[516],required:[516],helperText:[513,"helper-text"],reducePresence:[516,"reduce-presence"]},void 0,{value:[{valueChanged:0}]}]),c=n,h=function(){"undefined"!=typeof customElements&&["limebb-trend-indicator"].forEach((o=>{"limebb-trend-indicator"===o&&(customElements.get(a(o))||customElements.define(a(o),n))}))};export{c as LimebbTrendIndicator,h as defineCustomElement}
|
|
1
|
+
import{proxyCustomElement as o,HTMLElement as r,h as e,Host as t,transformTag as a}from"@stencil/core/internal/client";import{b as i}from"./index.esm.js";import{g as s,n as l}from"./normalize-value.js";const n=o(class extends r{constructor(o){super(),!1!==o&&this.__registerHost(),this.__attachShadow(),this.suffix="%",this.reducePresence=!0,this.locale="en",this.labelId="a"+crypto.randomUUID(),this.tooltipId="a"+crypto.randomUUID(),this.helperTextId="a"+crypto.randomUUID(),this.renderHelperLine=()=>{if(this.hasHelperText())return e("limel-helper-line",{helperTextId:this.helperTextId,helperText:this.helperText,invalid:this.invalid})},this.hasHelperText=()=>null!=this.helperText}valueChanged(o){this.numValue=this.parseValue(o)}componentWillLoad(){try{this.locale=this.platform.get(i.UserPreferencesRepository).get("locale"),this.numberFormat=new Intl.NumberFormat(this.locale)}catch(o){console.warn(`Could not get user's locale (${this.locale}), falling back to 'en'.`),this.locale="en",this.numberFormat=new Intl.NumberFormat("en")}this.numValue=this.parseValue(this.value)}render(){return e(t,{key:"fd3bce29b7cd49a4642904fa630616b10e7d55b8",class:this.getContainerClassList()},e("limel-notched-outline",{key:"3502f060569abb0e12c5b6bca84fdf9b190e840f",id:this.tooltipId,label:this.label,labelId:this.labelId,invalid:this.invalid,required:this.required,hasValue:!0,hasFloatingLabel:!0,"aria-labelledby":this.labelId,"aria-describedby":this.helperTextId,"aria-controls":this.helperTextId},e("div",{key:"4f007fec33a71fe2205c1fbb861b45b8d41f440e",slot:"content",tabIndex:0},this.renderVisualization())),this.renderHelperLine(),this.renderTooltip())}renderVisualization(){if(!this.reducePresence||0!==this.numValue&&this.hasValue())return this.hasValue()?[this.getArrowIcon(),e("span",null,this.renderGrowthPercentage(),this.renderGrowthAmount())]:e("span",{class:"no-value"},"–")}renderTooltip(){if(void 0===this.formerValue)return;const o=this.value+" - "+(this.formerValue>0?this.formerValue:"("+this.formerValue+")")+" = "+this.calculateGrowth()+` ${this.suffix} `,r=this.calculatePercentage();return e("limel-tooltip",{openDirection:"top-start",elementId:this.tooltipId,label:r+"%",helperLabel:o})}renderGrowthPercentage(){if(void 0===this.formerValue)return this.formatValue(this.numValue,this.suffix);const o=this.calculatePercentage();return null!==o?this.formatValue(o,"%"):void 0}renderGrowthAmount(){if(void 0===this.formerValue)return;const o=this.calculateGrowth();return e("span",{class:"growth-unit"},"( ",this.formatValue(o,this.suffix)," )")}hasValue(){return null!=this.value&&""!==this.value}getContainerClassList(){if(!this.hasValue())return;const o=this.getPercentage(),r=s(o);return Object.assign({},r&&{[r]:!0})}getPercentage(){return void 0===this.formerValue?this.numValue:this.calculatePercentage()}calculateGrowth(){return this.numValue-this.formerValue}calculatePercentage(){return 0===this.formerValue?null:Number.parseFloat(((this.numValue-this.formerValue)/Math.abs(this.formerValue)*100).toFixed(2))}unifyMinusSign(o){return o.replaceAll("−","-")}convertToUnicodeMinus(o){return o.replaceAll("-","−")}parseValue(o){return"string"==typeof o?Number.parseFloat(l(this.unifyMinusSign(o),this.locale)):o}formatValue(o,r){const e=`${this.numberFormat.format(o)} ${r}`;return o>0?"+"+e:this.convertToUnicodeMinus(e)}getArrowIcon(){return e("limel-icon",{class:"icon",name:"right","aria-hidden":"true",role:"presentation"})}static get watchers(){return{value:[{valueChanged:0}]}}static get style(){return'@charset "UTF-8";*{box-sizing:border-box}:host(limebb-trend-indicator){position:relative;display:block;height:100%;width:100%}limel-notched-outline:not([invalid]:not([invalid=false])) .limel-notched-outline--outlines{--limel-notched-outline-border-color:transparent}div[slot=content]{display:flex;align-items:center;gap:0.5rem;border-radius:inherit;background-color:transparent !important}div[slot=content]:focus{outline:none}div[slot=content]:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}:host(limebb-trend-indicator):has(label) div[slot=content]{min-height:2.5rem;padding:0 0.375rem 0 1rem}:host(limebb-trend-indicator[former-value]) div[slot=content]{cursor:help}div[slot=content] span{flex-shrink:0}.icon{flex-shrink:0;display:flex;transition-property:color, background-color, transform;transition-duration:0.4s;transition-timing-function:ease;width:1.25rem;height:1.25rem;border-radius:50%;padding:0.12rem;color:rgb(var(--color-white));background-color:rgb(var(--color-gray-default), 0.5)}:host(.has-value-40to30-negative) .icon{color:rgb(var(--color-gray-darker))}:host(.has-value-30to20-negative) .icon{color:rgb(var(--color-gray-darker))}:host(.has-value-20to10-negative) .icon{color:rgb(var(--color-gray-darker))}:host(.has-value-10to0-negative) .icon{color:rgb(var(--color-gray-darker))}:host(.has-value-0to10-positive) .icon{color:rgb(var(--color-gray-dark))}:host(.has-value-10to20-positive) .icon{color:rgb(var(--color-gray-dark))}:host(.has-value-20to30-positive) .icon{color:rgb(var(--color-gray-dark))}:host(.has-value-30to40-positive) .icon{color:rgb(var(--color-gray-dark))}:host(.has-value-200or-larger-negative) .icon{background-color:rgb(var(--color-red-darker));transform:rotate(90deg)}:host(.has-value-200to100-negative) .icon{background-color:rgb(var(--color-red-dark));transform:rotate(90deg)}:host(.has-value-100to90-negative) .icon{background-color:rgb(var(--color-red-dark));transform:rotate(90deg)}:host(.has-value-90to80-negative) .icon{background-color:rgb(var(--color-red-dark));transform:rotate(81deg)}:host(.has-value-80to70-negative) .icon{background-color:rgb(var(--color-red-default));transform:rotate(72deg)}:host(.has-value-70to60-negative) .icon{background-color:rgb(var(--color-red-default));transform:rotate(63deg)}:host(.has-value-60to50-negative) .icon{background-color:rgb(var(--color-coral-default));transform:rotate(54deg)}:host(.has-value-50to40-negative) .icon{background-color:rgb(var(--color-coral-default));transform:rotate(45deg)}:host(.has-value-40to30-negative) .icon{background-color:rgb(var(--color-orange-default));transform:rotate(36deg)}:host(.has-value-30to20-negative) .icon{background-color:rgb(var(--color-orange-default));transform:rotate(27deg)}:host(.has-value-20to10-negative) .icon{background-color:rgb(var(--color-amber-default));transform:rotate(18deg)}:host(.has-value-10to0-negative) .icon{background-color:rgb(var(--color-amber-default));transform:rotate(9deg)}:host(.has-value-0) .icon{background-color:rgb(var(--color-gray-default));transform:rotate(0deg)}:host(.has-value-0to10-positive) .icon{background-color:rgb(var(--color-yellow-default));transform:rotate(-9deg)}:host(.has-value-10to20-positive) .icon{background-color:rgb(var(--color-yellow-default));transform:rotate(-18deg)}:host(.has-value-20to30-positive) .icon{background-color:rgb(var(--color-grass-default));transform:rotate(-27deg)}:host(.has-value-30to40-positive) .icon{background-color:rgb(var(--color-grass-default));transform:rotate(-36deg)}:host(.has-value-40to50-positive) .icon{background-color:rgb(var(--color-lime-default));transform:rotate(-45deg)}:host(.has-value-50to60-positive) .icon{background-color:rgb(var(--color-lime-default));transform:rotate(-54deg)}:host(.has-value-60to70-positive) .icon{background-color:rgb(var(--color-teal-default));transform:rotate(-63deg)}:host(.has-value-70to80-positive) .icon{background-color:rgb(var(--color-teal-default));transform:rotate(-72deg)}:host(.has-value-80to90-positive) .icon{background-color:rgb(var(--color-teal-dark));transform:rotate(-81deg)}:host(.has-value-90to100-positive) .icon{background-color:rgb(var(--color-teal-dark));transform:rotate(-90deg)}:host(.has-value-100to200-positive) .icon{background-color:rgb(var(--color-teal-dark));transform:rotate(-90deg)}:host(.has-value-200or-larger-positive) .icon{background-color:rgb(var(--color-teal-darker));transform:rotate(-90deg)}:host(.has-value-0) .icon{background-color:rgb(var(--color-gray-default), 0.5);transform:rotate(0deg)}:host(.has-value-0) .icon polyline{color:transparent}:host(.has-value-200or-larger-negative) .icon:after,:host(.has-value-200or-larger-negative) .icon:before,:host(.has-value-200to100-negative) .icon:after,:host(.has-value-200to100-negative) .icon:before,:host(.has-value-100to200-positive) .icon:after,:host(.has-value-100to200-positive) .icon:before,:host(.has-value-200or-larger-positive) .icon:after,:host(.has-value-200or-larger-positive) .icon:before{transition:border-color 0.6s ease;content:"";position:absolute;inset:0;margin:auto;border:1px solid transparent;border-radius:50%}:host(.has-value-200or-larger-negative) .icon:before,:host(.has-value-200to100-negative) .icon:before,:host(.has-value-100to200-positive) .icon:before,:host(.has-value-200or-larger-positive) .icon:before{transform:scale(1.2)}:host(.has-value-200or-larger-negative) .icon:after,:host(.has-value-200to100-negative) .icon:after,:host(.has-value-100to200-positive) .icon:after,:host(.has-value-200or-larger-positive) .icon:after{transform:scale(1.4);opacity:0.4}:host(.has-value-200to100-negative) .icon:before,:host(.has-value-200or-larger-negative) .icon:before{border-color:rgb(var(--color-red-dark))}:host(.has-value-200or-larger-negative) .icon:after{border-color:rgb(var(--color-red-darker))}:host(.has-value-100to200-positive) .icon:before,:host(.has-value-200or-larger-positive) .icon:before{border-color:rgb(var(--color-teal-dark))}:host(.has-value-200or-larger-positive) .icon:after{border-color:rgb(var(--color-teal-darker))}.no-value{transform:translateY(0.5rem)}.growth-unit{padding-left:0.5rem;opacity:0.5}:host(limebb-trend-indicator:focus),:host(limebb-trend-indicator:focus-visible),:host(limebb-trend-indicator:focus-within){--limel-h-l-grid-template-rows-transition-speed:0.46s;--limel-h-l-grid-template-rows:1fr}:host(limebb-trend-indicator){--limel-h-l-grid-template-rows-transition-speed:0.3s;--limel-h-l-grid-template-rows:0fr}:host(limebb-trend-indicator:focus) limel-helper-line,:host(limebb-trend-indicator:focus-visible) limel-helper-line,:host(limebb-trend-indicator:focus-within) limel-helper-line,:host(limebb-trend-indicator:hover) limel-helper-line{will-change:grid-template-rows}'}},[1,"limebb-trend-indicator",{platform:[16],context:[16],value:[520],formerValue:[514,"former-value"],suffix:[513],label:[513],invalid:[516],required:[516],helperText:[513,"helper-text"],reducePresence:[516,"reduce-presence"]},void 0,{value:[{valueChanged:0}]}]),c=n,h=function(){"undefined"!=typeof customElements&&["limebb-trend-indicator"].forEach((o=>{"limebb-trend-indicator"===o&&(customElements.get(a(o))||customElements.define(a(o),n))}))};export{c as LimebbTrendIndicator,h as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as e,HTMLElement as t,createEvent as i,h as s,transformTag as l}from"@stencil/core/internal/client";import{
|
|
1
|
+
import{proxyCustomElement as e,HTMLElement as t,createEvent as i,h as s,transformTag as l}from"@stencil/core/internal/client";import{b as o}from"./index.esm.js";import{g as n}from"./limetype.js";import{i as r}from"./non-null.js";import{b as a}from"./_baseIsEqual.js";import{i as d,a as m,b as h}from"./_MapCache.js";function p(e){return"string"==typeof e||!m(e)&&d(e)&&"[object String]"==h(e)}const u=["string","text","phone","integer","decimal","percent","time","date","year","quarter","month","yesno","link","user","xml","option","set","file","system"],c=u.filter((e=>"system"!==e));c.push("belongsto","hasone","hasmany","hasandbelongstomany");const f=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.change=i(this,"change",7),this.propertyFields=[],this.fieldName="limetype",this.handleChange=e=>{e.stopPropagation();let t="";e.detail&&"value"in e.detail&&(t=e.detail.value),this.change.emit(t||void 0)}}componentWillLoad(){const e=this.platform.get(o.Application).getLanguage();this.collator=new Intl.Collator(e,{numeric:!0,sensitivity:"base"})}componentShouldUpdate(e,t,i){var s,l,o,n;return"formInfo"!==i||(o=null===(s=null==e?void 0:e.schema)||void 0===s?void 0:s.oneOf,n=null===(l=null==t?void 0:t.schema)||void 0===l?void 0:l.oneOf,!a(o,n))}render(){var e;const t=this.getLimeTypes().map(v);t.sort(((e,t)=>this.collator.compare(e.text,t.text)));let i=t.find((e=>e.value===this.value)),l=this.invalid;return this.value&&!i&&(l=!0,t.unshift({text:(null===(e=this.limeTypeRepository.getLimeType(this.value))||void 0===e?void 0:e.localname.singular)||this.value,value:this.value}),i=t[0]),t.unshift({text:"",value:""}),s("limel-select",{key:"20a7d5eb86c746d11ad805083be5ef9f5fd2397d",label:this.label,options:t,value:i,required:this.required,helperText:this.helperText,invalid:l,disabled:this.disabled||this.readonly,onChange:this.handleChange})}componentWillRender(){this.updatePropertyFields(this.value||"")}getLimeTypes(){var e,t;let i=this.limetypes;return(null===(t=null===(e=this.formInfo)||void 0===e?void 0:e.schema)||void 0===t?void 0:t.oneOf)&&(i=this.formInfo.schema.oneOf.map((e=>e.const)).filter(p)),i?i.map((e=>this.limeTypeRepository.getLimeType(e))).filter(r):this.limeTypeRepository.getLimeTypes()}updatePropertyFields(e){for(const t of this.propertyFields)t.limetype=e,t.allowedPropertyTypes===u&&(t.allowedPropertyTypes=c)}get limeTypeRepository(){return this.platform.get(o.LimeTypeRepository)}},[0,"limebb-limetype-field",{platform:[16],context:[16],label:[513],required:[516],readonly:[516],disabled:[516],value:[513],helperText:[513,"helper-text"],invalid:[4],limetypes:[16],propertyFields:[16],fieldName:[1,"field-name"],formInfo:[16]}]),v=e=>({text:e.localname.singular,value:e.name,icon:n(e)});function y(){"undefined"!=typeof customElements&&["limebb-limetype-field"].forEach((e=>{"limebb-limetype-field"===e&&(customElements.get(l(e))||customElements.define(l(e),f))}))}export{f as L,y as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as e,createEvent as i,h as r,Host as o,transformTag as n}from"@stencil/core/internal/client";import{
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as e,createEvent as i,h as r,Host as o,transformTag as n}from"@stencil/core/internal/client";import{b as a}from"./index.esm.js";const s=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.interact=i(this,"interact",7),this.handleClick=()=>{this.isItemClickable()&&this.handleNotificationListItemClick()},this.handleKeyDown=t=>{this.isItemClickable()&&"Enter"===t.key&&this.handleNotificationListItemClick()},this.renderHeading=()=>{if(!this.item.heading)return;if(!this.item.author)return r("limel-markdown",{value:this.translator.get(this.item.heading)});const t=this.getAuthorLink(),e=this.translator.get(this.item.heading,{author:t});return r("limel-markdown",{class:"heading",value:e})},this.createMenuItem=t=>{var e,i;return"separator"in t?t:{value:t,text:null!==(e=t.label)&&void 0!==e?e:"",secondaryText:t.description,disabled:t.disabled,icon:null!==(i=t.icon)&&void 0!==i?i:""}},this.handleMenuItemSelect=t=>{var e;t.stopPropagation();const i=null===(e=t.detail.value)||void 0===e?void 0:e.command;i&&this.commandbus.handle(i)},this.handleNotificationListItemClick=()=>{this.interact.emit(this.item)}}render(){var t,e;return r(o,{key:"951b650d804bfe49133743bc461e344d9dd0324b",id:this.item.id,class:{"is-clickable":this.isItemClickable(),"is-read":!!(null===(t=this.item)||void 0===t?void 0:t.read),"is-selected":!!(null===(e=this.item)||void 0===e?void 0:e.selected)},onClick:this.handleClick,onKeyDown:this.handleKeyDown,tabindex:0},this.renderSource(),this.renderContent())}isItemClickable(){var t;return!!(null===(t=this.item)||void 0===t?void 0:t.clickable)}renderSource(){return r("div",{class:"header"},this.renderIcon(),this.renderCaption(),this.renderTimestamp(),this.renderUnpromotedActionsMenu())}renderIcon(){var t,e,i,o;if(this.item.icon)return r("limel-icon",{class:"icon",badge:!0,name:null!==(e=null===(t=this.item.icon)||void 0===t?void 0:t.name)&&void 0!==e?e:"dot_circle",style:{color:`${null===(i=this.item.icon)||void 0===i?void 0:i.color}`,"background-color":`${null===(o=this.item.icon)||void 0===o?void 0:o.backgroundColor}`}})}renderContent(){return r("div",{class:"content"},r("div",{class:"body"},this.renderHeadline(),this.renderValue()),this.renderAuthorPicture())}renderHeadline(){if(this.item.heading)return r("div",{class:"headline"},this.renderHeading())}getAuthorLink(){if(!this.item.author)return;if("string"==typeof this.item.author.name)return this.item.author.name;const{href:t,text:e}=this.item.author.name;return`[${e}](${t})`}renderAuthorPicture(){var t;if(null===(t=this.item.author)||void 0===t?void 0:t.picture)return r("img",{class:"author-avatar",loading:"lazy",src:this.item.author.picture})}renderCaption(){if(this.item.caption)return r("h2",{class:"caption"},this.item.caption)}renderValue(){if(this.item.value)return r("limel-markdown",{class:"body-text",value:this.item.value})}renderUnpromotedActionsMenu(){var t,e;if(!(null===(t=this.item.unpromotedActions)||void 0===t?void 0:t.length))return;const i=this.item.unpromotedActions.map(this.createMenuItem);return r("limel-menu",{class:"unpromoted-actions-menu",items:i,openDirection:"bottom-end",onSelect:this.handleMenuItemSelect},r("limel-icon-button",{icon:"menu_2",slot:"trigger",label:null===(e=this.translator)||void 0===e?void 0:e.get("webclient.more-actions")}))}renderTimestamp(){const t=this.item.timestamp;if(t)return r("span",{class:"timestamp"},this.dateTimeFormatter.format(t,"timeofday"))}get dateTimeFormatter(){return this.platform.get(a.DateTimeFormatter)}get translator(){var t;return null===(t=this.platform)||void 0===t?void 0:t.get(a.Translate)}get commandbus(){var t;return null===(t=this.platform)||void 0===t?void 0:t.get(a.CommandBus)}static get style(){return'@charset "UTF-8";*{box-sizing:border-box}:host(limebb-notification-item){isolation:isolate;position:relative;box-sizing:border-box;display:flex;flex-direction:column;gap:0.25rem;margin-left:0.5rem;border-radius:0.75rem;border:1px solid rgb(var(--contrast-500))}:host(limebb-notification-item):before{content:"";display:block;position:absolute;left:-1rem;top:0.85rem;border-radius:50%;height:0.5rem;width:0.5rem;transition:background-color 0.2s ease, scale 0.2s cubic-bezier(0.82, 0.3, 0.14, 1.36);scale:var(--limebb-notification-item-unread-badge-scale, 0.6);background-color:var(--limebb-notification-item-unread-badge-color, transparent)}:host(limebb-notification-item:hover) .timestamp{color:rgb(var(--contrast-1100))}:host(limebb-notification-item:hover) .body-text{opacity:1}.header{display:flex;align-items:center;gap:0.25rem;min-height:2rem;padding:0 0 0 0.25rem;margin-bottom:0.25rem}.header:not(:has(.icon)){padding-left:0.75rem}.header:not(:has(.unpromoted-actions-menu)){padding-right:0.5rem}.caption,.timestamp{font-size:0.75rem}.caption{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin:0;flex-grow:1;font-weight:600;color:rgb(var(--contrast-900))}.timestamp{flex-shrink:0;margin-left:auto;transition:color 0.4s ease, opacity 0.2s ease;color:rgb(var(--contrast-900))}.headline{display:flex;gap:0.25rem;align-items:center}.content{display:flex;min-width:0;gap:0.5rem;padding:0 0.75rem 0.5rem 0.75rem}.heading{display:-webkit-box;overflow:hidden;white-space:normal;-webkit-box-orient:vertical;-webkit-line-clamp:2;max-height:2.5rem;font-size:0.875rem;--markdown-hyperlink-color:var(--mdc-theme-primary);--markdown-hyperlink-color--hovered:rgb(var(--color-teal-light))}.body{display:flex;flex-direction:column;gap:0.5rem}.body-text{display:-webkit-box;overflow:hidden;white-space:normal;-webkit-box-orient:vertical;-webkit-line-clamp:3;max-height:4.25rem;transition:opacity 0.2s ease;opacity:0.7}.icon{--icon-background-color:var(--limebb-feed-background-color);flex-shrink:0;width:1.5rem;padding:0.125rem}.author-avatar{border-radius:50%;width:2rem;height:2rem;object-fit:cover;margin-top:auto;margin-right:-0.25rem;margin-left:auto;box-shadow:0 0 0 1px rgb(var(--contrast-600))}.author{font-weight:bold;text-decoration:none;white-space:nowrap}a.author{position:relative;cursor:pointer;transition:color 0.2s ease;color:var(--mdc-theme-primary)}a.author:before{transition:opacity 0.2s ease, transform 0.3s ease-out;content:"";position:absolute;inset:auto 0 0 0;width:calc(100% - 0.5rem);margin:auto;height:0.125rem;border-radius:1rem;background-color:currentColor;opacity:0;transform:scale(0.6)}a.author:hover{color:rgb(var(--color-teal-light))}a.author:hover:before{opacity:0.3;transform:scale(1)}limel-chip-set{--button-shadow-normal:none;margin-left:-1rem;margin-bottom:-0.5rem}'}},[1,"limebb-notification-item",{platform:[16],context:[16],item:[16]}]);function l(){"undefined"!=typeof customElements&&["limebb-notification-item"].forEach((t=>{"limebb-notification-item"===t&&(customElements.get(n(t))||customElements.define(n(t),s))}))}export{s as N,l as d}
|