@limetech/lime-elements 39.16.1 → 39.16.3
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 +15 -0
- package/dist/cjs/limel-picker.cjs.entry.js +14 -4
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +28 -4
- package/dist/collection/components/picker/picker.js +15 -4
- package/dist/collection/components/text-editor/utils/has-custom-element-node.js +21 -0
- package/dist/collection/components/text-editor/utils/html-converter.js +4 -2
- package/dist/collection/components/text-editor/utils/markdown-converter.js +4 -2
- package/dist/esm/limel-picker.entry.js +14 -4
- package/dist/esm/limel-prosemirror-adapter.entry.js +28 -4
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-f6c3f49b.entry.js → p-02817f83.entry.js} +1 -1
- package/dist/lime-elements/{p-2160ff6e.entry.js → p-c5d8079b.entry.js} +1 -1
- package/dist/types/components/picker/picker.d.ts +1 -0
- package/dist/types/components/text-editor/utils/has-custom-element-node.d.ts +10 -0
- package/dist/types/components.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as s,a as h}from"./p-DBTJNfo7.js";import{i as e}from"./p-B9Ofc5RB.js";import{T as n,E as o,a as r,A as l,b as a}from"./p-rI0IeKpx.js";import{c as d}from"./p-JbKhhoXs.js";import{a as c,g as p}from"./p-CgNJbSP4.js";import{d as u}from"./p-BviYUVSD.js";import"./p-BJQylLSL.js";import"./p-D6dCQvwl.js";import"./p-BOEi1C7r.js";import"./p-oiMYqRQ0.js";const m=class{constructor(s){t(this,s),this.change=i(this,"change"),this.interact=i(this,"interact"),this.action=i(this,"action"),this.disabled=!1,this.readonly=!1,this.required=!1,this.invalid=!1,this.allItems=[],this.multiple=!1,this.delimiter=null,this.actions=[],this.actionPosition="bottom",this.actionScrollBehavior="sticky",this.badgeIcons=!1,this.textValue="",this.loading=!1,this.chips=[],this.chipSetEditMode=!1,this.getValueId=t=>{const i=t.value;return i&&"object"==typeof i?i.id:i},this.createChips=t=>t?this.multiple?t.map(this.createChip):[this.createChip(t)]:[],this.createChip=t=>{const i=p(t.icon),s=c(t.icon,t.iconColor);return{id:`${this.getValueId(t)}`,text:t.text,removable:!0,icon:i?{name:i,color:s}:void 0,image:t.image,value:t,menuItems:t.actions}},this.search=async t=>{const i=setTimeout((()=>{this.loading=!0})),s=this.searcher||this.defaultSearcher,h=await s(this.textValue);clearTimeout(i),this.handleSearchResult(t,h)},this.defaultSearcher=async t=>""===t?this.allItems.slice(0,20):this.allItems.filter((i=>{let s=i.text.toLowerCase();return i.secondaryText&&(s=s+" "+i.secondaryText.toLowerCase()),s.includes(t.toLowerCase())})).slice(0,20),this.handleTextInput=this.handleTextInput.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleDropdownKeyDown=this.handleDropdownKeyDown.bind(this),this.handleInputFieldFocus=this.handleInputFieldFocus.bind(this),this.handleChange=this.handleChange.bind(this),this.handleInteract=this.handleInteract.bind(this),this.handleListChange=this.handleListChange.bind(this),this.handleActionListChange=this.handleActionListChange.bind(this),this.handleStopEditAndBlur=this.handleStopEditAndBlur.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.onListKeyDown=this.onListKeyDown.bind(this),this.portalId=d(),this.debouncedSearch=u(this.search,300)}componentWillLoad(){this.chips=this.createChips(this.value)}componentDidLoad(){this.chipSet=this.host.shadowRoot.querySelector("limel-chip-set"),this.updateTabIndex()}disconnectedCallback(){this.debouncedSearch.cancel()}onDisabledChange(){this.updateTabIndex()}updateTabIndex(){this.host.setAttribute("tabindex",this.disabled||this.readonly?"-1":"0")}async componentWillUpdate(){this.chipSetEditMode=!1,this.chipSet&&(this.chipSetEditMode=await this.chipSet.getEditMode())}render(){const t={};return this.multiple||(t.maxItems=1),[s("limel-chip-set",Object.assign({key:"
|
|
1
|
+
import{r as t,c as i,h as s,a as h}from"./p-DBTJNfo7.js";import{i as e}from"./p-B9Ofc5RB.js";import{T as n,E as o,a as r,A as l,b as a}from"./p-rI0IeKpx.js";import{c as d}from"./p-JbKhhoXs.js";import{a as c,g as p}from"./p-CgNJbSP4.js";import{d as u}from"./p-BviYUVSD.js";import"./p-BJQylLSL.js";import"./p-D6dCQvwl.js";import"./p-BOEi1C7r.js";import"./p-oiMYqRQ0.js";const m=class{constructor(s){t(this,s),this.change=i(this,"change"),this.interact=i(this,"interact"),this.action=i(this,"action"),this.disabled=!1,this.readonly=!1,this.required=!1,this.invalid=!1,this.allItems=[],this.multiple=!1,this.delimiter=null,this.actions=[],this.actionPosition="bottom",this.actionScrollBehavior="sticky",this.badgeIcons=!1,this.textValue="",this.loading=!1,this.chips=[],this.chipSetEditMode=!1,this.getValueId=t=>{const i=t.value;return i&&"object"==typeof i?i.id:i},this.createChips=t=>t?this.multiple?t.map(this.createChip):[this.createChip(t)]:[],this.createChip=t=>{const i=p(t.icon),s=c(t.icon,t.iconColor);return{id:`${this.getValueId(t)}`,text:t.text,removable:!0,icon:i?{name:i,color:s}:void 0,image:t.image,value:t,menuItems:t.actions}},this.search=async t=>{const i=setTimeout((()=>{this.loading=!0})),s=this.searcher||this.defaultSearcher,h=await s(this.textValue);clearTimeout(i),this.handleSearchResult(t,h)},this.defaultSearcher=async t=>""===t?this.allItems.slice(0,20):this.allItems.filter((i=>{let s=i.text.toLowerCase();return i.secondaryText&&(s=s+" "+i.secondaryText.toLowerCase()),s.includes(t.toLowerCase())})).slice(0,20),this.handleTextInput=this.handleTextInput.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleDropdownKeyDown=this.handleDropdownKeyDown.bind(this),this.handleInputFieldFocus=this.handleInputFieldFocus.bind(this),this.handleChange=this.handleChange.bind(this),this.handleInteract=this.handleInteract.bind(this),this.handleListChange=this.handleListChange.bind(this),this.handleActionListChange=this.handleActionListChange.bind(this),this.handleStopEditAndBlur=this.handleStopEditAndBlur.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.onListKeyDown=this.onListKeyDown.bind(this),this.portalId=d(),this.debouncedSearch=u(this.search,300)}componentWillLoad(){this.chips=this.createChips(this.value)}componentDidLoad(){this.chipSet=this.host.shadowRoot.querySelector("limel-chip-set"),this.updateTabIndex()}disconnectedCallback(){this.debouncedSearch.cancel()}onDisabledChange(){this.updateTabIndex()}updateTabIndex(){this.host.setAttribute("tabindex",this.disabled||this.readonly?"-1":"0")}async componentWillUpdate(){this.chipSetEditMode=!1,this.chipSet&&(this.chipSetEditMode=await this.chipSet.getEditMode())}render(){const t={};return this.multiple||(t.maxItems=1),[s("limel-chip-set",Object.assign({key:"d7928164dfd143478fb1b4ed248fdfa6c7c55f68",type:"input",inputType:"search",label:this.label,helperText:this.helperText,leadingIcon:this.leadingIcon,value:this.chips,disabled:this.disabled,invalid:this.invalid,delimiter:this.renderDelimiter(),readonly:this.readonly,required:this.required,searchLabel:this.searchLabel,onInput:this.handleTextInput,onKeyDown:this.handleInputKeyDown,onChange:this.handleChange,onInteract:this.handleInteract,onStartEdit:this.handleInputFieldFocus,onStopEdit:this.handleStopEditAndBlur,emptyInputOnBlur:!1,clearAllButton:this.multiple&&!this.chipSetEditMode},t)),this.renderDropdown()]}onChangeValue(){this.chips=this.createChips(this.value)}renderDelimiter(){return this.multiple?this.delimiter:null}renderDropdown(){const t=this.getDropdownContent(),i=[];if(this.shouldShowDropDownContent()){const s=this.getActionContent();"top"===this.actionPosition&&i.push(s),t&&i.push(t),"bottom"===this.actionPosition&&i.push(s)}return this.renderPortal(i)}getActionContent(){var t,i;return 0===(null!==(i=null===(t=this.actions)||void 0===t?void 0:t.length)&&void 0!==i?i:0)?null:[s("limel-list",{class:{"static-actions-list":!0,"is-on-top":"top"===this.actionPosition,"is-at-bottom":"bottom"===this.actionPosition,"has-position-sticky":"sticky"===this.actionScrollBehavior},badgeIcons:!0,type:"selectable",onChange:this.handleActionListChange,items:this.actions.map(this.removeUnusedPropertiesOnAction)})]}removeUnusedPropertiesOnAction(t){return Object.assign(Object.assign({},t),{actions:[]})}shouldShowDropDownContent(){return!this.isFull()&&!!this.chipSetEditMode}getDropdownContent(){var t;if(this.shouldShowDropDownContent())return this.loading?this.renderSpinner():(null===(t=this.items)||void 0===t?void 0:t.length)?this.renderListResult():this.renderEmptyMessage()}isFull(){return!this.multiple&&!!this.value}renderSpinner(){return s("div",{style:{width:"100%",display:"flex","align-items":"center","justify-content":"center",padding:"1rem 0"}},s("limel-spinner",{limeBranded:!1}))}renderEmptyMessage(){if(this.emptyResultMessage)return s("p",{style:{color:"rgb(var(--contrast-1100))","text-align":"center",margin:"0.5rem 1rem"}},this.emptyResultMessage)}renderListResult(){return s("limel-list",{badgeIcons:this.badgeIcons,onChange:this.handleListChange,onKeyDown:this.onListKeyDown,type:"selectable",items:this.items})}onListKeyDown(t){[n,o,r].includes(t.key)&&this.chipSet.setFocus()}renderPortal(t=[]){const i=getComputedStyle(this.host).getPropertyValue("--dropdown-z-index");return s("limel-portal",{visible:t.length>0,containerId:this.portalId,inheritParentWidth:!0,containerStyle:{"z-index":i}},s("limel-menu-surface",{open:t.length>0,allowClicksElement:this.host,style:{"--menu-surface-width":"100%","max-height":"inherit",display:"flex"},onDismiss:this.handleCloseMenu},t))}handleStopEditAndBlur(){const t=this.host.shadowRoot.activeElement||document.activeElement,i=document.querySelector(`#${this.portalId}`);e(t,this.host)||e(t,i)||this.clearInputField()}async handleTextInput(t){t.stopPropagation();const i=t.detail;this.textValue=i,this.debouncedSearch(i),""===i&&this.debouncedSearch.flush()}handleListChange(t){var i;if(t.stopPropagation(),!this.value||this.value!==t.detail){let i=t.detail;this.multiple&&(i=[...this.value,t.detail]),this.change.emit(i),this.items=[]}this.multiple&&(this.textValue="",null===(i=this.chipSet)||void 0===i||i.setFocus(!0))}handleActionListChange(t){t.stopPropagation(),t.detail&&(this.action.emit(t.detail.value),this.items=[])}handleInputFieldFocus(){this.debouncedSearch(this.textValue)}handleChange(t){t.stopPropagation(),this.textValue="";let i=null;this.multiple&&(i=t.detail.map((t=>this.value.find((i=>`${this.getValueId(i)}`===t.id))))),this.change.emit(i)}handleInteract(t){t.stopPropagation(),this.interact.emit(t.detail?t.detail.value:t.detail)}handleInputKeyDown(t){const i=t.key===n&&!t.altKey&&!t.metaKey&&!t.shiftKey,s=t.key===l,h=t.key===a;if(!i&&!s&&!h)return;const e=document.querySelector(` #${this.portalId} limel-list`);if(e){if(i||h){const i=e.shadowRoot.querySelector(".mdc-deprecated-list-item");if(!i)return;return t.preventDefault(),void i.focus()}if(s){const i=[...e.shadowRoot.querySelectorAll(".mdc-deprecated-list-item")].at(-1);if(!i)return;t.preventDefault(),i.focus()}}}handleDropdownKeyDown(t){t.key===o&&(t.preventDefault(),this.textValue="",this.chipSet.setFocus(!0))}handleSearchResult(t,i){if(t===this.textValue){if(this.items=i,this.multiple){const t=this.value;this.items=i.filter((i=>!t.includes(i)))}this.loading=!1}}handleCloseMenu(){this.items.length>0||this.clearInputField()}clearInputField(){this.chipSet.emptyInput(),this.textValue="",this.handleSearchResult("",[]),this.debouncedSearch.cancel()}static get delegatesFocus(){return!0}get host(){return h(this)}static get watchers(){return{disabled:[{onDisabledChange:0}],value:[{onChangeValue:0}]}}};m.style=":host{position:relative;display:block}:host([hidden]){display:none}";export{m as limel_picker}
|
|
@@ -13,6 +13,7 @@ import { PickerValue } from './value.types';
|
|
|
13
13
|
* @exampleComponent limel-example-picker-empty-suggestions
|
|
14
14
|
* @exampleComponent limel-example-picker-leading-icon
|
|
15
15
|
* @exampleComponent limel-example-picker-static-actions
|
|
16
|
+
* @exampleComponent limel-example-picker-sections
|
|
16
17
|
* @exampleComponent limel-example-picker-composite
|
|
17
18
|
*/
|
|
18
19
|
export declare class Picker {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Node } from 'prosemirror-model';
|
|
2
|
+
import { CustomElementDefinition } from '../../../interface';
|
|
3
|
+
/**
|
|
4
|
+
* Recursively checks if a ProseMirror node or
|
|
5
|
+
* any of its child nodes is a registered custom element node.
|
|
6
|
+
* @param node - the ProseMirror node to check
|
|
7
|
+
* @param customElements - the registered custom element definitions
|
|
8
|
+
*/
|
|
9
|
+
export declare function hasCustomElementNode(node: Node, customElements: CustomElementDefinition[]): boolean;
|
|
10
|
+
//# sourceMappingURL=has-custom-element-node.d.ts.map
|
|
@@ -2754,6 +2754,7 @@ export namespace Components {
|
|
|
2754
2754
|
* @exampleComponent limel-example-picker-empty-suggestions
|
|
2755
2755
|
* @exampleComponent limel-example-picker-leading-icon
|
|
2756
2756
|
* @exampleComponent limel-example-picker-static-actions
|
|
2757
|
+
* @exampleComponent limel-example-picker-sections
|
|
2757
2758
|
* @exampleComponent limel-example-picker-composite
|
|
2758
2759
|
*/
|
|
2759
2760
|
interface LimelPicker {
|
|
@@ -5705,6 +5706,7 @@ declare global {
|
|
|
5705
5706
|
* @exampleComponent limel-example-picker-empty-suggestions
|
|
5706
5707
|
* @exampleComponent limel-example-picker-leading-icon
|
|
5707
5708
|
* @exampleComponent limel-example-picker-static-actions
|
|
5709
|
+
* @exampleComponent limel-example-picker-sections
|
|
5708
5710
|
* @exampleComponent limel-example-picker-composite
|
|
5709
5711
|
*/
|
|
5710
5712
|
interface HTMLLimelPickerElement extends Components.LimelPicker, HTMLStencilElement {
|
|
@@ -9321,6 +9323,7 @@ declare namespace LocalJSX {
|
|
|
9321
9323
|
* @exampleComponent limel-example-picker-empty-suggestions
|
|
9322
9324
|
* @exampleComponent limel-example-picker-leading-icon
|
|
9323
9325
|
* @exampleComponent limel-example-picker-static-actions
|
|
9326
|
+
* @exampleComponent limel-example-picker-sections
|
|
9324
9327
|
* @exampleComponent limel-example-picker-composite
|
|
9325
9328
|
*/
|
|
9326
9329
|
interface LimelPicker {
|
|
@@ -12281,6 +12284,7 @@ declare module "@stencil/core" {
|
|
|
12281
12284
|
* @exampleComponent limel-example-picker-empty-suggestions
|
|
12282
12285
|
* @exampleComponent limel-example-picker-leading-icon
|
|
12283
12286
|
* @exampleComponent limel-example-picker-static-actions
|
|
12287
|
+
* @exampleComponent limel-example-picker-sections
|
|
12284
12288
|
* @exampleComponent limel-example-picker-composite
|
|
12285
12289
|
*/
|
|
12286
12290
|
"limel-picker": LocalJSX.IntrinsicElements["limel-picker"] & JSXBase.HTMLAttributes<HTMLLimelPickerElement>;
|