@openremote/or-tree-menu 1.8.0-snapshot.20250723094757 → 1.8.0-snapshot.20250725074716

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/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var __decorate=this&&this.__decorate||function(e,t,r,o){var i,n=arguments.length,s=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,o);else for(var d=e.length-1;d>=0;d--)(i=e[d])&&(s=(n<3?i(s):n>3?i(t,r,s):i(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s},__awaiter=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(i,n){function s(e){try{l(o.next(e))}catch(e){n(e)}}function d(e){try{l(o.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,d)}l((o=o.apply(e,t||[])).next())}))};import{css,html,LitElement}from"lit";import{customElement,property,queryAll}from"lit/decorators.js";import{map}from"lit/directives/map.js";import{when}from"lit/directives/when.js";import{InputType}from"@openremote/or-mwc-components/or-mwc-input";import{getContentWithMenuTemplate}from"@openremote/or-mwc-components/or-mwc-menu";import{Util}from"@openremote/core";import{moveNodesToGroupNode}from"./util";import{OrTreeDragEvent,OrTreeSelectEvent,TreeMenuSelection,TreeMenuSorting}from"./model";import{i18next}from"@openremote/or-translate";import"./or-tree-group";import"./or-tree-node";export*from"./or-tree-group";export*from"./or-tree-node";export*from"./model";const styles=css`
1
+ var __decorate=this&&this.__decorate||function(e,t,r,o){var i,n=arguments.length,s=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,o);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(s=(n<3?i(s):n>3?i(t,r,s):i(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s},__awaiter=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))(function(i,n){function s(e){try{d(o.next(e))}catch(e){n(e)}}function l(e){try{d(o.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,l)}d((o=o.apply(e,t||[])).next())})};import{css as e,html as t,LitElement as r}from"lit";import{customElement as o,property as i,queryAll as n}from"lit/decorators.js";import{map as s}from"lit/directives/map.js";import{when as l}from"lit/directives/when.js";import{InputType as d}from"@openremote/or-mwc-components/or-mwc-input";import{getContentWithMenuTemplate as a}from"@openremote/or-mwc-components/or-mwc-menu";import{Util as h}from"@openremote/core";import{moveNodesToGroupNode as p}from"./util";import{OrTreeDragEvent as c,OrTreeSelectEvent as u,TreeMenuSelection as g,TreeMenuSorting as _}from"./model";import{i18next as f}from"@openremote/or-translate";import"./or-tree-group";import"./or-tree-node";export*from"./or-tree-group";export*from"./or-tree-node";export*from"./model";let styles=e`
2
2
  * {
3
3
  box-sizing: border-box;
4
4
  }
@@ -50,48 +50,48 @@ var __decorate=this&&this.__decorate||function(e,t,r,o){var i,n=arguments.length
50
50
  display: flex;
51
51
  align-items: center;
52
52
  }
53
- `;let OrTreeMenu=class extends LitElement{constructor(){super(...arguments),this.nodes=[],this.selection=TreeMenuSelection.LEAF,this.draggable=!1,this.noHeader=!1,this.menuTitle="Tree Menu",this.sortBy=TreeMenuSorting.A_TO_Z,this.groupFirst=!1,this._treeNodeCache=new Map}static get styles(){return[styles]}willUpdate(e){return(e.has("nodes")||e.has("sortBy")||e.has("groupFirst"))&&this.nodes&&(this.nodes=this._sortNodes(this.nodes,this.sortBy,this.groupFirst)),e.has("selection")&&e.get("selection")&&this.selection&&this.deselectAllNodes(),super.willUpdate(e)}render(){return html`
53
+ `,OrTreeMenu=class extends r{constructor(){super(...arguments),this.nodes=[],this.selection=g.LEAF,this.draggable=!1,this.noHeader=!1,this.menuTitle="Tree Menu",this.sortBy=_.A_TO_Z,this.groupFirst=!1,this._treeNodeCache=new Map}static get styles(){return[styles]}willUpdate(e){return(e.has("nodes")||e.has("sortBy")||e.has("groupFirst"))&&this.nodes&&(this.nodes=this._sortNodes(this.nodes,this.sortBy,this.groupFirst)),e.has("selection")&&e.get("selection")&&this.selection&&this.deselectAllNodes(),super.willUpdate(e)}render(){return t`
54
54
  <div id="tree-container">
55
- ${when(!this.noHeader,(()=>this._getHeaderTemplate()))}
55
+ ${l(!this.noHeader,()=>this._getHeaderTemplate())}
56
56
  ${this._getTreeTemplate(this.nodes)}
57
57
  ${this._getErrorTemplate()}
58
58
  </div>
59
- `}moveNodesToGroup(e,t){this.nodes=moveNodesToGroupNode(e,t,this.nodes)}_getTreeTemplate(e){return this._treeNodeCache=new Map,html`
59
+ `}moveNodesToGroup(e,t){this.nodes=p(e,t,this.nodes)}_getTreeTemplate(e){return this._treeNodeCache=new Map,t`
60
60
  <ol id="tree-list" @dragover=${this._onDragOverList} @drop=${this._onDragDropList}>
61
- ${map(e,(e=>this._getNodeTemplate(e)))}
61
+ ${s(e,e=>this._getNodeTemplate(e))}
62
62
  </ol>
63
- `}_getNodeTemplate(e,t){return e.children?this._getGroupNodeTemplate(e,t):this._getSingleNodeTemplate(e,t)}_getSingleNodeTemplate(e,t){const r=this._setTreeNodeId(e);return html`
63
+ `}_getNodeTemplate(e,t){return e.children?this._getGroupNodeTemplate(e,t):this._getSingleNodeTemplate(e,t)}_getSingleNodeTemplate(e,r){let o=this._setTreeNodeId(e);return t`
64
64
  <li draggable=${this.draggable}
65
65
  @dragstart=${t=>this._onDragStart(t,e)}
66
- @dragover=${r=>this._onDragOverSingleNode(r,e,t)}
67
- @dragleave=${r=>this._onDragLeaveSingleNode(r,e,t)}
68
- @drop=${r=>this._onDragDropSingleNode(r,e,t)}>
69
- <or-tree-node id=${r} ?selected=${e.selected} ?readonly=${e.readonly} @click="${this._onTreeNodeClick}">
66
+ @dragover=${t=>this._onDragOverSingleNode(t,e,r)}
67
+ @dragleave=${t=>this._onDragLeaveSingleNode(t,e,r)}
68
+ @drop=${t=>this._onDragDropSingleNode(t,e,r)}>
69
+ <or-tree-node id=${o} ?selected=${e.selected} ?readonly=${e.readonly} @click="${this._onTreeNodeClick}">
70
70
  ${this._getSingleNodeSlotTemplate(e)}
71
71
  </or-tree-node>
72
72
  </li>
73
- `}_getSingleNodeSlotTemplate(e){return html`
73
+ `}_getSingleNodeSlotTemplate(e){return t`
74
74
  <or-icon slot="prefix" icon="flag"></or-icon>
75
75
  <span>${e.label}</span>
76
76
  <span slot="suffix"></span>
77
- `}_getGroupNodeTemplate(e,t){const r=this.selection===TreeMenuSelection.LEAF,o=this._setTreeNodeId(e);return html`
77
+ `}_getGroupNodeTemplate(e,r){let o=this.selection===g.LEAF,i=this._setTreeNodeId(e);return t`
78
78
  <li>
79
- <or-tree-group ?leaf=${r} ?expanded=${e.expanded}>
80
- <or-tree-node slot="parent" id=${o} ?readonly=${r}
79
+ <or-tree-group ?leaf=${o} ?expanded=${e.expanded}>
80
+ <or-tree-node slot="parent" id=${i} ?readonly=${o}
81
81
  @click=${this._onTreeGroupClick}
82
82
  @dragover=${t=>this._onDragOverGroup(t,e)}
83
83
  @dragleave=${t=>this._onDragLeaveGroup(t,e)}
84
84
  @drop=${t=>this._onDragDropGroup(t,e)}>
85
85
  ${this._getGroupNodeSlotTemplate(e)}
86
86
  </or-tree-node>
87
- ${map(e.children,(t=>this._getNodeTemplate(t,e)))}
87
+ ${s(e.children,t=>this._getNodeTemplate(t,e))}
88
88
  </or-tree-group>
89
89
  </li>
90
- `}_getGroupNodeSlotTemplate(e){return html`
90
+ `}_getGroupNodeSlotTemplate(e){return t`
91
91
  <or-icon slot="prefix" icon="folder"></or-icon>
92
92
  <span>${e.label}</span>
93
93
  <span slot="suffix"></span>
94
- `}_getHeaderTemplate(){return html`
94
+ `}_getHeaderTemplate(){return t`
95
95
  <div id="tree-header">
96
96
  <h3 id="tree-header-title">
97
97
  <or-translate value=${this.menuTitle}></or-translate>
@@ -100,4 +100,4 @@ var __decorate=this&&this.__decorate||function(e,t,r,o){var i,n=arguments.length
100
100
  ${this._getSortActionTemplate(this.sortBy,this.sortOptions)}
101
101
  </div>
102
102
  </div>
103
- `}_getSortActionTemplate(e,t){return getContentWithMenuTemplate(html`<or-mwc-input type=${InputType.BUTTON} icon="sort-variant" title="${i18next.t("sort")}"></or-mwc-input>`,(t||[]).map((e=>({value:e,text:e}))),e,(e=>this._onSortClick(String(e))))}_getErrorTemplate(){return html``}_onSortClick(e){this.sortBy=e}_onTreeGroupClick(e){const t=e.currentTarget,r=t.parentElement,o=(e,t)=>{e.select(),this._lastSelectedNode=t,this._notifyNodesSelect()};switch(this.selection){case TreeMenuSelection.LEAF:return;case TreeMenuSelection.MULTI:if(e.shiftKey&&this._lastSelectedNode){const e=Array.from(this._uiNodes||[]),t=r.getGroupNode();if(t){const r=e.indexOf(t),o=e.indexOf(this._lastSelectedNode);return void this._selectNodesBetween(e,r,o)}}else if(e.ctrlKey)return void o(r,t);return this.deselectAllNodes(),void o(r,t);case TreeMenuSelection.SINGLE:return this.deselectAllNodes(),void o(r,t)}}_onTreeNodeClick(e){const t=e.currentTarget;if(t){if(this.selection===TreeMenuSelection.MULTI){if(e.shiftKey&&this._lastSelectedNode){const e=Array.from(this._uiNodes||[]),r=e.indexOf(this._lastSelectedNode),o=e.indexOf(t);if(r>-1&&o>-1)return void this._selectNodesBetween(e,r,o)}else if(e.ctrlKey)return void this._selectNode(t);return this.deselectAllNodes(),void this._selectNode(t)}return this.deselectAllNodes(),void this._selectNode(t)}}_onDragStart(e,t){var r;e.target?null===(r=e.dataTransfer)||void 0===r||r.setData("treeNode",JSON.stringify(t)):e.preventDefault()}_onDragOverList(e){this.draggable&&e.preventDefault()}_onDragOverSingleNode(e,t,r){if(this.draggable&&(e.preventDefault(),r)){const e=this._getUiNodeFromTree(r);null==e||e.setAttribute("drophover","true")}}_onDragOverGroup(e,t){this.draggable&&(e.preventDefault(),e.currentTarget.setAttribute("drophover","true"))}_onDragLeaveSingleNode(e,t,r){if(r&&this.draggable){e.preventDefault();const t=this._getUiNodeFromTree(r);null==t||t.removeAttribute("drophover")}}_onDragLeaveGroup(e,t){this.draggable&&e.currentTarget.removeAttribute("drophover")}_onDragDropList(e){this._onDragDropGroup(e)}_onDragDropSingleNode(e,t,r){this._onDragDropGroup(e,r)}_onDragDropGroup(e,t){var r,o;if(this.draggable){e.preventDefault(),e.stopPropagation(),t&&(null===(r=this._getUiNodeFromTree(t))||void 0===r||r.removeAttribute("drophover"));let i=[];const n=null===(o=e.dataTransfer)||void 0===o?void 0:o.getData("treeNode");if(n){const e=JSON.parse(n);e&&i.push(e)}if(this.selection===TreeMenuSelection.MULTI){let e=this._findSelectedTreeNodes();e=e.filter((e=>!e.children)),e.length>0&&(this.deselectAllNodes(),i.push(...e.filter((e=>!i.find((t=>JSON.stringify(t)===JSON.stringify(e)))))))}(null==t?void 0:t.children)&&(i=i.filter((e=>{var r;return!(null===(r=t.children)||void 0===r?void 0:r.find((t=>t.id===e.id)))}))),i.length>0&&this._dispatchCancellableDragEvent(i,t,this.nodes).then((()=>{this.nodes=moveNodesToGroupNode(i,t,this.nodes)})).catch((e=>{}))}}_dispatchCancellableDragEvent(e,t,r=[]){return new Promise(((o,i)=>{this.dispatchEvent(new OrTreeDragEvent(e,t,r))?o():i()}))}_selectNode(e,t=!0){if(e){if(t){const t=[...this._findSelectedTreeNodes()],r=this._getTreeNodeFromTree(e);if(r&&t.push(r),!this._dispatchSelectEvent(t))return}e.selected=!0,this._lastSelectedNode=e}}_selectNodesBetween(e,t,r,o=!0){const i=[];if(t<r)for(let o=t;o<=r;o++)i.push(e[o]);else if(t>r)for(let o=r;o<=t;o++)i.push(e[o]);if(o){const e=i.map((e=>this._getTreeNodeFromTree(e))).filter((e=>e));if(!this._notifyNodesSelect(e))return}i.forEach((e=>this._selectNode(e)))}_notifyNodesSelect(e){return __awaiter(this,void 0,void 0,(function*(){return yield this.getUpdateComplete(),e||(e=this._findSelectedTreeNodes()),this._dispatchSelectEvent(e)}))}_findSelectedTreeNodes(e=Array.from(this._uiNodes||[]),t=this._treeNodeCache){const r=e.filter((e=>e.selected)),o=Array.from(t.entries());return r.map((e=>o.find((t=>t[1]===e.id)))).map((e=>null==e?void 0:e[0])).filter((e=>void 0!==e))}_getTreeNodeFromTree(e,t=this._treeNodeCache){var r;return null===(r=Array.from(t.entries()).find((t=>t[1]===e.id)))||void 0===r?void 0:r[0]}_getUiNodeFromTree(e,t=this._treeNodeCache){var r;const o=Array.from(t.entries()),i=JSON.stringify(e),n=null===(r=o.find((e=>JSON.stringify(e[0])===i)))||void 0===r?void 0:r[1];return n?this.shadowRoot.getElementById(n):void 0}_dispatchSelectEvent(e){return this.dispatchEvent(new OrTreeSelectEvent(e||[]))}deselectAllNodes(){(this._uiGroups||[]).forEach((e=>e.deselect())),(this._uiNodes||[]).forEach((e=>e.selected=!1))}_sortNodes(e,t,r=!1){console.debug(`Sorting nodes in the tree menu using '${t}'`);const o=e.filter((e=>void 0!==e.children));if(o.forEach((e=>{var r;return null===(r=e.children)||void 0===r?void 0:r.sort(this._getSortFunction(t))})),r){const r=e.filter((e=>void 0===e.children));return o.sort(this._getSortFunction(t)),r.sort(this._getSortFunction(t)),[...o,...r]}return e.sort(this._getSortFunction(t))}_setTreeNodeId(e,t=Math.random().toString(36).substring(2,11)){return this._treeNodeCache.get(e)?this._treeNodeCache.get(e):(this._treeNodeCache.set(e,t),t)}_getSortFunction(e){return e===TreeMenuSorting.Z_TO_A?(e,t)=>t.label.localeCompare(e.label):Util.sortByString((e=>e.label))}expandGroup(e){this.updateComplete.then((()=>{const t=this.nodes.find((t=>t.id===e&&t.children));t&&(t.expanded=!0,this.requestUpdate())}))}};__decorate([property({type:Array})],OrTreeMenu.prototype,"nodes",void 0),__decorate([property({type:String})],OrTreeMenu.prototype,"selection",void 0),__decorate([property({type:Boolean})],OrTreeMenu.prototype,"draggable",void 0),__decorate([property({type:Boolean,attribute:"no-header"})],OrTreeMenu.prototype,"noHeader",void 0),__decorate([property({type:String,attribute:"menu-title"})],OrTreeMenu.prototype,"menuTitle",void 0),__decorate([property({type:Array,attribute:"sort-options"})],OrTreeMenu.prototype,"sortOptions",void 0),__decorate([property({type:String,attribute:"sort-by",reflect:!0})],OrTreeMenu.prototype,"sortBy",void 0),__decorate([property({type:Boolean,attribute:"group-first"})],OrTreeMenu.prototype,"groupFirst",void 0),__decorate([queryAll("or-tree-node")],OrTreeMenu.prototype,"_uiNodes",void 0),__decorate([queryAll("or-tree-group")],OrTreeMenu.prototype,"_uiGroups",void 0),OrTreeMenu=__decorate([customElement("or-tree-menu")],OrTreeMenu);export{OrTreeMenu};
103
+ `}_getSortActionTemplate(e,r){return a(t`<or-mwc-input type=${d.BUTTON} icon="sort-variant" title="${f.t("sort")}"></or-mwc-input>`,(r||[]).map(e=>({value:e,text:e})),e,e=>this._onSortClick(String(e)))}_getErrorTemplate(){return t``}_onSortClick(e){this.sortBy=e}_onTreeGroupClick(e){let t=e.currentTarget,r=t.parentElement,o=(e,t)=>{e.select(),this._lastSelectedNode=t,this._notifyNodesSelect()};switch(this.selection){case g.LEAF:return;case g.MULTI:if(e.shiftKey&&this._lastSelectedNode){let e=Array.from(this._uiNodes||[]),t=r.getGroupNode();if(t){let r=e.indexOf(t),o=e.indexOf(this._lastSelectedNode);this._selectNodesBetween(e,r,o);return}}else if(e.ctrlKey)return void o(r,t);this.deselectAllNodes(),o(r,t);return;case g.SINGLE:this.deselectAllNodes(),o(r,t);return}}_onTreeNodeClick(e){let t=e.currentTarget;if(t)if(this.selection===g.MULTI){if(e.shiftKey&&this._lastSelectedNode){let e=Array.from(this._uiNodes||[]),r=e.indexOf(this._lastSelectedNode),o=e.indexOf(t);if(r>-1&&o>-1)return void this._selectNodesBetween(e,r,o)}else if(e.ctrlKey)return void this._selectNode(t);this.deselectAllNodes(),this._selectNode(t);return}else{this.deselectAllNodes(),this._selectNode(t);return}}_onDragStart(e,t){var r;e.target?null==(r=e.dataTransfer)||r.setData("treeNode",JSON.stringify(t)):e.preventDefault()}_onDragOverList(e){this.draggable&&e.preventDefault()}_onDragOverSingleNode(e,t,r){if(this.draggable&&(e.preventDefault(),r)){let e=this._getUiNodeFromTree(r);null==e||e.setAttribute("drophover","true")}}_onDragOverGroup(e,t){this.draggable&&(e.preventDefault(),e.currentTarget.setAttribute("drophover","true"))}_onDragLeaveSingleNode(e,t,r){if(r&&this.draggable){e.preventDefault();let t=this._getUiNodeFromTree(r);null==t||t.removeAttribute("drophover")}}_onDragLeaveGroup(e,t){this.draggable&&e.currentTarget.removeAttribute("drophover")}_onDragDropList(e){this._onDragDropGroup(e)}_onDragDropSingleNode(e,t,r){this._onDragDropGroup(e,r)}_onDragDropGroup(e,t){var r,o;if(this.draggable){e.preventDefault(),e.stopPropagation(),t&&(null==(r=this._getUiNodeFromTree(t))||r.removeAttribute("drophover"));let i=[],n=null==(o=e.dataTransfer)?void 0:o.getData("treeNode");if(n){let e=JSON.parse(n);e&&i.push(e)}if(this.selection===g.MULTI){let e=this._findSelectedTreeNodes();(e=e.filter(e=>!e.children)).length>0&&(this.deselectAllNodes(),i.push(...e.filter(e=>!i.find(t=>JSON.stringify(t)===JSON.stringify(e)))))}(null==t?void 0:t.children)&&(i=i.filter(e=>{var r;return!(null==(r=t.children)?void 0:r.find(t=>t.id===e.id))})),i.length>0&&this._dispatchCancellableDragEvent(i,t,this.nodes).then(()=>{this.nodes=p(i,t,this.nodes)}).catch(e=>{})}}_dispatchCancellableDragEvent(e,t,r=[]){return new Promise((o,i)=>{this.dispatchEvent(new c(e,t,r))?o():i()})}_selectNode(e,t=!0){if(e){if(t){let t=[...this._findSelectedTreeNodes()],r=this._getTreeNodeFromTree(e);if(r&&t.push(r),!this._dispatchSelectEvent(t))return}e.selected=!0,this._lastSelectedNode=e}}_selectNodesBetween(e,t,r,o=!0){let i=[];if(t<r)for(let o=t;o<=r;o++)i.push(e[o]);else if(t>r)for(let o=r;o<=t;o++)i.push(e[o]);if(o){let e=i.map(e=>this._getTreeNodeFromTree(e)).filter(e=>e);if(!this._notifyNodesSelect(e))return}i.forEach(e=>this._selectNode(e))}_notifyNodesSelect(e){return __awaiter(this,void 0,void 0,function*(){return yield this.getUpdateComplete(),e||(e=this._findSelectedTreeNodes()),this._dispatchSelectEvent(e)})}_findSelectedTreeNodes(e=Array.from(this._uiNodes||[]),t=this._treeNodeCache){let r=e.filter(e=>e.selected),o=Array.from(t.entries());return r.map(e=>o.find(t=>t[1]===e.id)).map(e=>null==e?void 0:e[0]).filter(e=>void 0!==e)}_getTreeNodeFromTree(e,t=this._treeNodeCache){var r;return null==(r=Array.from(t.entries()).find(t=>t[1]===e.id))?void 0:r[0]}_getUiNodeFromTree(e,t=this._treeNodeCache){var r;let o=Array.from(t.entries()),i=JSON.stringify(e),n=null==(r=o.find(e=>JSON.stringify(e[0])===i))?void 0:r[1];return n?this.shadowRoot.getElementById(n):void 0}_dispatchSelectEvent(e){return this.dispatchEvent(new u(e||[]))}deselectAllNodes(){(this._uiGroups||[]).forEach(e=>e.deselect()),(this._uiNodes||[]).forEach(e=>e.selected=!1)}_sortNodes(e,t,r=!1){console.debug(`Sorting nodes in the tree menu using '${t}'`);let o=e.filter(e=>void 0!==e.children);if(o.forEach(e=>{var r;return null==(r=e.children)?void 0:r.sort(this._getSortFunction(t))}),r){let r=e.filter(e=>void 0===e.children);return o.sort(this._getSortFunction(t)),r.sort(this._getSortFunction(t)),[...o,...r]}return e.sort(this._getSortFunction(t))}_setTreeNodeId(e,t=Math.random().toString(36).substring(2,11)){return this._treeNodeCache.get(e)?this._treeNodeCache.get(e):(this._treeNodeCache.set(e,t),t)}_getSortFunction(e){return e===_.Z_TO_A?(e,t)=>t.label.localeCompare(e.label):h.sortByString(e=>e.label)}expandGroup(e){this.updateComplete.then(()=>{let t=this.nodes.find(t=>t.id===e&&t.children);t&&(t.expanded=!0,this.requestUpdate())})}};__decorate([i({type:Array})],OrTreeMenu.prototype,"nodes",void 0),__decorate([i({type:String})],OrTreeMenu.prototype,"selection",void 0),__decorate([i({type:Boolean})],OrTreeMenu.prototype,"draggable",void 0),__decorate([i({type:Boolean,attribute:"no-header"})],OrTreeMenu.prototype,"noHeader",void 0),__decorate([i({type:String,attribute:"menu-title"})],OrTreeMenu.prototype,"menuTitle",void 0),__decorate([i({type:Array,attribute:"sort-options"})],OrTreeMenu.prototype,"sortOptions",void 0),__decorate([i({type:String,attribute:"sort-by",reflect:!0})],OrTreeMenu.prototype,"sortBy",void 0),__decorate([i({type:Boolean,attribute:"group-first"})],OrTreeMenu.prototype,"groupFirst",void 0),__decorate([n("or-tree-node")],OrTreeMenu.prototype,"_uiNodes",void 0),__decorate([n("or-tree-group")],OrTreeMenu.prototype,"_uiGroups",void 0),OrTreeMenu=__decorate([o("or-tree-menu")],OrTreeMenu);export{OrTreeMenu};
@@ -1,4 +1,4 @@
1
- var __decorate=this&&this.__decorate||function(e,t,o,r){var n,s=arguments.length,l=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,r);else for(var i=e.length-1;i>=0;i--)(n=e[i])&&(l=(s<3?n(l):s>3?n(t,o,l):n(t,o))||l);return s>3&&l&&Object.defineProperty(t,o,l),l};import{css,html,LitElement}from"lit";import{customElement,property,queryAssignedElements}from"lit/decorators.js";import{when}from"lit/directives/when.js";const getStyles=()=>css`
1
+ var __decorate=this&&this.__decorate||function(e,t,o,r){var n,l=arguments.length,s=l<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var i=e.length-1;i>=0;i--)(n=e[i])&&(s=(l<3?n(s):l>3?n(t,o,s):n(t,o))||s);return l>3&&s&&Object.defineProperty(t,o,s),s};import{css as e,html as t,LitElement as o}from"lit";import{customElement as r,property as n,queryAssignedElements as l}from"lit/decorators.js";import{when as s}from"lit/directives/when.js";let getStyles=()=>e`
2
2
  * {
3
3
  box-sizing: border-box;
4
4
  }
@@ -36,14 +36,14 @@ var __decorate=this&&this.__decorate||function(e,t,o,r){var n,s=arguments.length
36
36
  :host(:not([readonly])) > #chevron {
37
37
  cursor: pointer;
38
38
  }
39
- `;let OrTreeGroup=class extends LitElement{constructor(){super(...arguments),this.expanded=!1,this.leaf=!1,this.readonly=!1,this._slotClickListener=e=>this.leaf?this._onExpandToggle(e):null,this._chevronClickListener=e=>this._onExpandToggle(e)}static get styles(){return[getStyles()]}select(){const e=this.getGroupNode();!this.leaf&&e&&(e.selected=!0)}selectAll(){this.select(),this.getChildNodes().forEach((e=>e.selected=!0))}deselect(){const e=this.getGroupNode();e&&(e.selected=!1)}deselectAll(){this.deselect(),this.getChildNodes().forEach((e=>e.selected=!1))}getGroupNode(){var e;return null===(e=this._parentNodes)||void 0===e?void 0:e[0]}getChildNodes(){return Array.from(this._childNodes||[]).map((e=>e.querySelector("or-tree-node"))).filter((e=>null!=e))}firstUpdated(e){var t;return null===(t=this._parentNodes)||void 0===t||t.forEach((e=>{e.addEventListener("click",this._slotClickListener)})),super.firstUpdated(e)}disconnectedCallback(){var e;null===(e=this._parentNodes)||void 0===e||e.forEach((e=>{e.removeEventListener("click",this._slotClickListener)})),super.disconnectedCallback()}render(){return html`
40
- ${when(!this.readonly,(()=>this._getIconTemplate(this.expanded)))}
39
+ `,OrTreeGroup=class extends o{constructor(){super(...arguments),this.expanded=!1,this.leaf=!1,this.readonly=!1,this._slotClickListener=e=>this.leaf?this._onExpandToggle(e):null,this._chevronClickListener=e=>this._onExpandToggle(e)}static get styles(){return[getStyles()]}select(){let e=this.getGroupNode();!this.leaf&&e&&(e.selected=!0)}selectAll(){this.select(),this.getChildNodes().forEach(e=>e.selected=!0)}deselect(){let e=this.getGroupNode();e&&(e.selected=!1)}deselectAll(){this.deselect(),this.getChildNodes().forEach(e=>e.selected=!1)}getGroupNode(){var e;return null==(e=this._parentNodes)?void 0:e[0]}getChildNodes(){return Array.from(this._childNodes||[]).map(e=>e.querySelector("or-tree-node")).filter(e=>null!=e)}firstUpdated(e){var t;return null==(t=this._parentNodes)||t.forEach(e=>{e.addEventListener("click",this._slotClickListener)}),super.firstUpdated(e)}disconnectedCallback(){var e;null==(e=this._parentNodes)||e.forEach(e=>{e.removeEventListener("click",this._slotClickListener)}),super.disconnectedCallback()}render(){return t`
40
+ ${s(!this.readonly,()=>this._getIconTemplate(this.expanded))}
41
41
  <slot name="parent"></slot>
42
42
  <ol ?hidden=${!this.expanded}>
43
43
  <slot @slotchange=${this._onSlotChange}></slot>
44
44
  </ol>
45
- `}_getIconTemplate(e=!1){return html`
45
+ `}_getIconTemplate(e=!1){return t`
46
46
  <or-icon id="chevron" part="chevron" icon="${e?"chevron-down":"chevron-right"}"
47
47
  @click="${this._chevronClickListener}"
48
48
  ></or-icon>
49
- `}_onExpandToggle(e){this.expanded=!this.expanded}_onSlotChange(e){this._applyIndentToChildren()}_applyIndentToChildren(e=this.getChildNodes()){e.forEach((e=>{let t=(e=>{let t=0;for(;e;)"or-tree-group"===e.tagName.toLowerCase()&&t++,e=e.parentElement;return t})(e);"parent"===e.slot&&t--,e.style.setProperty("--or-tree-node-indent",24+12*t+"px")}))}};__decorate([property({type:Boolean,reflect:!0})],OrTreeGroup.prototype,"expanded",void 0),__decorate([property({type:Boolean})],OrTreeGroup.prototype,"leaf",void 0),__decorate([property({type:Boolean})],OrTreeGroup.prototype,"readonly",void 0),__decorate([queryAssignedElements({slot:void 0})],OrTreeGroup.prototype,"_childNodes",void 0),__decorate([queryAssignedElements({slot:"parent"})],OrTreeGroup.prototype,"_parentNodes",void 0),OrTreeGroup=__decorate([customElement("or-tree-group")],OrTreeGroup);export{OrTreeGroup};
49
+ `}_onExpandToggle(e){this.expanded=!this.expanded}_onSlotChange(e){this._applyIndentToChildren()}_applyIndentToChildren(e=this.getChildNodes()){e.forEach(e=>{let t=(e=>{let t=0;for(;e;)"or-tree-group"===e.tagName.toLowerCase()&&t++,e=e.parentElement;return t})(e);"parent"===e.slot&&t--,e.style.setProperty("--or-tree-node-indent",`${24+12*t}px`)})}};__decorate([n({type:Boolean,reflect:!0})],OrTreeGroup.prototype,"expanded",void 0),__decorate([n({type:Boolean})],OrTreeGroup.prototype,"leaf",void 0),__decorate([n({type:Boolean})],OrTreeGroup.prototype,"readonly",void 0),__decorate([l({slot:void 0})],OrTreeGroup.prototype,"_childNodes",void 0),__decorate([l({slot:"parent"})],OrTreeGroup.prototype,"_parentNodes",void 0),OrTreeGroup=__decorate([r("or-tree-group")],OrTreeGroup);export{OrTreeGroup};
@@ -1,4 +1,4 @@
1
- var __decorate=this&&this.__decorate||function(e,r,o,t){var n,d=arguments.length,l=d<3?r:null===t?t=Object.getOwnPropertyDescriptor(r,o):t;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,r,o,t);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(l=(d<3?n(l):d>3?n(r,o,l):n(r,o))||l);return d>3&&l&&Object.defineProperty(r,o,l),l};import{css,html,LitElement}from"lit";import{customElement,property}from"lit/decorators.js";const styles=css`
1
+ var __decorate=this&&this.__decorate||function(e,r,o,t){var d,n=arguments.length,l=n<3?r:null===t?t=Object.getOwnPropertyDescriptor(r,o):t;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,r,o,t);else for(var s=e.length-1;s>=0;s--)(d=e[s])&&(l=(n<3?d(l):n>3?d(r,o,l):d(r,o))||l);return n>3&&l&&Object.defineProperty(r,o,l),l};import{css as e,html as r,LitElement as o}from"lit";import{customElement as t,property as d}from"lit/decorators.js";let styles=e`
2
2
  * {
3
3
  box-sizing: border-box;
4
4
  }
@@ -36,8 +36,8 @@ var __decorate=this&&this.__decorate||function(e,r,o,t){var n,d=arguments.length
36
36
  ::slotted(*:not([slot])) {
37
37
  flex: 1;
38
38
  }
39
- `;let OrTreeNode=class extends LitElement{constructor(){super(...arguments),this.readonly=!1,this.selected=!1}static get styles(){return[styles]}render(){return html`
39
+ `,OrTreeNode=class extends o{constructor(){super(...arguments),this.readonly=!1,this.selected=!1}static get styles(){return[styles]}render(){return r`
40
40
  <slot name="prefix"></slot>
41
41
  <slot></slot>
42
42
  <slot name="suffix"></slot>
43
- `}};__decorate([property({type:Boolean,reflect:!0})],OrTreeNode.prototype,"readonly",void 0),__decorate([property({type:Boolean,reflect:!0})],OrTreeNode.prototype,"selected",void 0),OrTreeNode=__decorate([customElement("or-tree-node")],OrTreeNode);export{OrTreeNode};
43
+ `}};__decorate([d({type:Boolean,reflect:!0})],OrTreeNode.prototype,"readonly",void 0),__decorate([d({type:Boolean,reflect:!0})],OrTreeNode.prototype,"selected",void 0),OrTreeNode=__decorate([t("or-tree-node")],OrTreeNode);export{OrTreeNode};
package/lib/util.js CHANGED
@@ -1 +1 @@
1
- export function moveNodesToGroupNode(e,n,o=[]){console.debug(`Moving nodes '${e.map((e=>e.label)).join(", ")}' into group '${null==n?void 0:n.label}'. Tree nodes are`,n);const i=function o(i){return i.map((i=>{if(e.some((e=>i.id===e.id)))return console.debug("Removed the node from original position."),null;const l=Object.assign({},i);return l.children&&(l.children=o(l.children).filter((e=>null!==e))),n&&i.id===(null==n?void 0:n.id)&&e.forEach((e=>{l.children=l.children?[...l.children,e]:[e]})),l})).filter((e=>null!==e))}(o);return n||i.push(...e),i}
1
+ export function moveNodesToGroupNode(e,n,o=[]){console.debug(`Moving nodes '${e.map(e=>e.label).join(", ")}' into group '${null==n?void 0:n.label}'. Tree nodes are`,n);let l=function o(l){return l.map(l=>{if(e.some(e=>l.id===e.id))return console.debug("Removed the node from original position."),null;let i=Object.assign({},l);return i.children&&(i.children=o(i.children).filter(e=>null!==e)),n&&l.id===(null==n?void 0:n.id)&&e.forEach(e=>{i.children=i.children?[...i.children,e]:[e]}),i}).filter(e=>null!==e)}(o);return n||l.push(...e),l}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openremote/or-tree-menu",
3
- "version": "1.8.0-snapshot.20250723094757",
3
+ "version": "1.8.0-snapshot.20250725074716",
4
4
  "description": "Web Component for displaying a tree menu of items with a predefined hierarchy",
5
5
  "customElements": "custom-elements.json",
6
6
  "main": "dist/umd/index.bundle.js",
@@ -13,19 +13,19 @@
13
13
  "scripts": {
14
14
  "analyze": "npx cem analyze --config ../custom-elements-manifest.config.mjs",
15
15
  "test": "echo \"No tests\" && exit 0",
16
- "prepack": "npx webpack"
16
+ "prepack": "npx rspack"
17
17
  },
18
18
  "author": "OpenRemote",
19
19
  "license": "AGPL-3.0-or-later",
20
20
  "dependencies": {
21
21
  "@mdi/js": "^5.9.55",
22
- "@openremote/core": "1.8.0-snapshot.20250723094757",
23
- "@openremote/or-mwc-components": "1.8.0-snapshot.20250723094757",
24
- "@openremote/or-translate": "1.8.0-snapshot.20250723094757",
22
+ "@openremote/core": "1.8.0-snapshot.20250725074716",
23
+ "@openremote/or-mwc-components": "1.8.0-snapshot.20250725074716",
24
+ "@openremote/or-translate": "1.8.0-snapshot.20250725074716",
25
25
  "lit": "^3.2.1"
26
26
  },
27
27
  "devDependencies": {
28
- "@openremote/util": "1.8.0-snapshot.20250723094757"
28
+ "@openremote/util": "1.8.0-snapshot.20250725074716"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"
@@ -0,0 +1,13 @@
1
+ const util = require("@openremote/util");
2
+
3
+ bundles = {
4
+ "index": {
5
+ excludeOr: true
6
+ },
7
+ "index.bundle": {
8
+ excludeOr: true,
9
+ },
10
+ "index.orbundle": undefined
11
+ };
12
+
13
+ module.exports = util.generateExports(__dirname);
@@ -1,136 +0,0 @@
1
- /*! *****************************************************************************
2
- Copyright (c) Microsoft Corporation.
3
-
4
- Permission to use, copy, modify, and/or distribute this software for any
5
- purpose with or without fee is hereby granted.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
- PERFORMANCE OF THIS SOFTWARE.
14
- ***************************************************************************** */
15
-
16
- /**
17
- * @license
18
- * Copyright 2016 Google Inc.
19
- *
20
- * Permission is hereby granted, free of charge, to any person obtaining a copy
21
- * of this software and associated documentation files (the "Software"), to deal
22
- * in the Software without restriction, including without limitation the rights
23
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24
- * copies of the Software, and to permit persons to whom the Software is
25
- * furnished to do so, subject to the following conditions:
26
- *
27
- * The above copyright notice and this permission notice shall be included in
28
- * all copies or substantial portions of the Software.
29
- *
30
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
36
- * THE SOFTWARE.
37
- */
38
-
39
- /**
40
- * @license
41
- * Copyright 2017 Google LLC
42
- * SPDX-License-Identifier: BSD-3-Clause
43
- */
44
-
45
- /**
46
- * @license
47
- * Copyright 2018 Google Inc.
48
- *
49
- * Permission is hereby granted, free of charge, to any person obtaining a copy
50
- * of this software and associated documentation files (the "Software"), to deal
51
- * in the Software without restriction, including without limitation the rights
52
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
53
- * copies of the Software, and to permit persons to whom the Software is
54
- * furnished to do so, subject to the following conditions:
55
- *
56
- * The above copyright notice and this permission notice shall be included in
57
- * all copies or substantial portions of the Software.
58
- *
59
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
60
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
61
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
62
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
63
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
64
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
65
- * THE SOFTWARE.
66
- */
67
-
68
- /**
69
- * @license
70
- * Copyright 2018 Google LLC
71
- * SPDX-License-Identifier: BSD-3-Clause
72
- */
73
-
74
- /**
75
- * @license
76
- * Copyright 2019 Google Inc.
77
- *
78
- * Permission is hereby granted, free of charge, to any person obtaining a copy
79
- * of this software and associated documentation files (the "Software"), to deal
80
- * in the Software without restriction, including without limitation the rights
81
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
82
- * copies of the Software, and to permit persons to whom the Software is
83
- * furnished to do so, subject to the following conditions:
84
- *
85
- * The above copyright notice and this permission notice shall be included in
86
- * all copies or substantial portions of the Software.
87
- *
88
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
89
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
90
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
91
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
92
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
93
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
94
- * THE SOFTWARE.
95
- */
96
-
97
- /**
98
- * @license
99
- * Copyright 2019 Google LLC
100
- * SPDX-License-Identifier: BSD-3-Clause
101
- */
102
-
103
- /**
104
- * @license
105
- * Copyright 2020 Google Inc.
106
- *
107
- * Permission is hereby granted, free of charge, to any person obtaining a copy
108
- * of this software and associated documentation files (the "Software"), to deal
109
- * in the Software without restriction, including without limitation the rights
110
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
111
- * copies of the Software, and to permit persons to whom the Software is
112
- * furnished to do so, subject to the following conditions:
113
- *
114
- * The above copyright notice and this permission notice shall be included in
115
- * all copies or substantial portions of the Software.
116
- *
117
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
118
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
119
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
120
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
121
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
122
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
123
- * THE SOFTWARE.
124
- */
125
-
126
- /**
127
- * @license
128
- * Copyright 2020 Google LLC
129
- * SPDX-License-Identifier: BSD-3-Clause
130
- */
131
-
132
- /**
133
- * @license
134
- * Copyright 2021 Google LLC
135
- * SPDX-License-Identifier: BSD-3-Clause
136
- */
@@ -1,136 +0,0 @@
1
- /*! *****************************************************************************
2
- Copyright (c) Microsoft Corporation.
3
-
4
- Permission to use, copy, modify, and/or distribute this software for any
5
- purpose with or without fee is hereby granted.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
- PERFORMANCE OF THIS SOFTWARE.
14
- ***************************************************************************** */
15
-
16
- /**
17
- * @license
18
- * Copyright 2016 Google Inc.
19
- *
20
- * Permission is hereby granted, free of charge, to any person obtaining a copy
21
- * of this software and associated documentation files (the "Software"), to deal
22
- * in the Software without restriction, including without limitation the rights
23
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24
- * copies of the Software, and to permit persons to whom the Software is
25
- * furnished to do so, subject to the following conditions:
26
- *
27
- * The above copyright notice and this permission notice shall be included in
28
- * all copies or substantial portions of the Software.
29
- *
30
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
36
- * THE SOFTWARE.
37
- */
38
-
39
- /**
40
- * @license
41
- * Copyright 2017 Google LLC
42
- * SPDX-License-Identifier: BSD-3-Clause
43
- */
44
-
45
- /**
46
- * @license
47
- * Copyright 2018 Google Inc.
48
- *
49
- * Permission is hereby granted, free of charge, to any person obtaining a copy
50
- * of this software and associated documentation files (the "Software"), to deal
51
- * in the Software without restriction, including without limitation the rights
52
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
53
- * copies of the Software, and to permit persons to whom the Software is
54
- * furnished to do so, subject to the following conditions:
55
- *
56
- * The above copyright notice and this permission notice shall be included in
57
- * all copies or substantial portions of the Software.
58
- *
59
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
60
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
61
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
62
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
63
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
64
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
65
- * THE SOFTWARE.
66
- */
67
-
68
- /**
69
- * @license
70
- * Copyright 2018 Google LLC
71
- * SPDX-License-Identifier: BSD-3-Clause
72
- */
73
-
74
- /**
75
- * @license
76
- * Copyright 2019 Google Inc.
77
- *
78
- * Permission is hereby granted, free of charge, to any person obtaining a copy
79
- * of this software and associated documentation files (the "Software"), to deal
80
- * in the Software without restriction, including without limitation the rights
81
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
82
- * copies of the Software, and to permit persons to whom the Software is
83
- * furnished to do so, subject to the following conditions:
84
- *
85
- * The above copyright notice and this permission notice shall be included in
86
- * all copies or substantial portions of the Software.
87
- *
88
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
89
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
90
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
91
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
92
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
93
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
94
- * THE SOFTWARE.
95
- */
96
-
97
- /**
98
- * @license
99
- * Copyright 2019 Google LLC
100
- * SPDX-License-Identifier: BSD-3-Clause
101
- */
102
-
103
- /**
104
- * @license
105
- * Copyright 2020 Google Inc.
106
- *
107
- * Permission is hereby granted, free of charge, to any person obtaining a copy
108
- * of this software and associated documentation files (the "Software"), to deal
109
- * in the Software without restriction, including without limitation the rights
110
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
111
- * copies of the Software, and to permit persons to whom the Software is
112
- * furnished to do so, subject to the following conditions:
113
- *
114
- * The above copyright notice and this permission notice shall be included in
115
- * all copies or substantial portions of the Software.
116
- *
117
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
118
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
119
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
120
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
121
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
122
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
123
- * THE SOFTWARE.
124
- */
125
-
126
- /**
127
- * @license
128
- * Copyright 2020 Google LLC
129
- * SPDX-License-Identifier: BSD-3-Clause
130
- */
131
-
132
- /**
133
- * @license
134
- * Copyright 2021 Google LLC
135
- * SPDX-License-Identifier: BSD-3-Clause
136
- */