@limetech/lime-crm-building-blocks 2.2.1 → 2.3.1

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.
Files changed (237) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
  3. package/dist/cjs/limebb-alert-dialog.cjs.entry.js +1 -1
  4. package/dist/cjs/limebb-browser.cjs.entry.js +2 -2
  5. package/dist/cjs/limebb-chat-icon-list_3.cjs.entry.js +4 -4
  6. package/dist/cjs/limebb-chat-list.cjs.entry.js +82 -103
  7. package/dist/cjs/limebb-color-palette-picker.cjs.entry.js +1 -1
  8. package/dist/cjs/limebb-color-palette-swatches.cjs.entry.js +1 -1
  9. package/dist/cjs/limebb-composer-toolbar.cjs.entry.js +2 -2
  10. package/dist/cjs/limebb-currency-picker.cjs.entry.js +1 -1
  11. package/dist/cjs/limebb-dashboard-widget.cjs.entry.js +1 -1
  12. package/dist/cjs/limebb-date-picker.cjs.entry.js +1 -1
  13. package/dist/cjs/limebb-date-range.cjs.entry.js +1 -1
  14. package/dist/cjs/limebb-document-chips.cjs.entry.js +1 -1
  15. package/dist/cjs/limebb-document-item.cjs.entry.js +2 -2
  16. package/dist/cjs/limebb-document-picker.cjs.entry.js +1 -1
  17. package/dist/cjs/limebb-feed-item-thumbnail-file-info.cjs.entry.js +1 -1
  18. package/dist/cjs/limebb-feed-timeline-item.cjs.entry.js +1 -1
  19. package/dist/cjs/limebb-feed.cjs.entry.js +1 -1
  20. package/dist/cjs/limebb-filter-chip_6.cjs.entry.js +7 -7
  21. package/dist/cjs/limebb-icon-picker.cjs.entry.js +1 -1
  22. package/dist/cjs/limebb-info-tile-format.cjs.entry.js +1 -1
  23. package/dist/cjs/limebb-info-tile.cjs.entry.js +1 -1
  24. package/dist/cjs/limebb-kanban-group.cjs.entry.js +1 -1
  25. package/dist/cjs/limebb-kanban-item.cjs.entry.js +1 -1
  26. package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +1 -1
  27. package/dist/cjs/limebb-lime-query-filter-comparison_2.cjs.entry.js +2 -2
  28. package/dist/cjs/limebb-lime-query-order-by-editor_2.cjs.entry.js +2 -2
  29. package/dist/cjs/limebb-lime-query-order-by-item.cjs.entry.js +2 -2
  30. package/dist/cjs/limebb-lime-query-response-format-builder.cjs.entry.js +1 -1
  31. package/dist/cjs/limebb-lime-query-response-format-editor_2.cjs.entry.js +1 -1
  32. package/dist/cjs/limebb-live-docs-info.cjs.entry.js +2 -2
  33. package/dist/cjs/limebb-locale-picker.cjs.entry.js +1 -1
  34. package/dist/cjs/limebb-mention-group-counter.cjs.entry.js +2 -2
  35. package/dist/cjs/limebb-navigation-button_2.cjs.entry.js +2 -2
  36. package/dist/cjs/limebb-notification-item.cjs.entry.js +1 -1
  37. package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +2 -2
  38. package/dist/cjs/limebb-rule-chip-popover.cjs.entry.js +1 -1
  39. package/dist/cjs/limebb-rule-editor.cjs.entry.js +1 -1
  40. package/dist/cjs/limebb-rule-gate.cjs.entry.js +1 -1
  41. package/dist/cjs/limebb-text-editor.cjs.entry.js +1 -1
  42. package/dist/cjs/limebb-trend-indicator.cjs.entry.js +1 -1
  43. package/dist/cjs/limebb-value-comparison-editor.cjs.entry.js +1 -1
  44. package/dist/cjs/loader.cjs.js +1 -1
  45. package/dist/collection/components/alert-dialog/alert-dialog.js +1 -1
  46. package/dist/collection/components/browser/browser.js +2 -2
  47. package/dist/collection/components/chat-list/chat-icon-list/chat-icon-list.js +1 -1
  48. package/dist/collection/components/chat-list/chat-item/chat-item.js +2 -2
  49. package/dist/collection/components/chat-list/chat-list.css +23 -1
  50. package/dist/collection/components/chat-list/chat-list.js +50 -23
  51. package/dist/collection/components/chat-list/scroll-anchor.js +33 -38
  52. package/dist/collection/components/chat-list/typing-indicator/typing-indicator.js +1 -1
  53. package/dist/collection/components/color-palette-picker/color-palette-picker.js +1 -1
  54. package/dist/collection/components/color-palette-picker/color-palette-swatches/color-palette-swatches.js +1 -1
  55. package/dist/collection/components/composer-toolbar/composer-toolbar.js +2 -2
  56. package/dist/collection/components/currency-picker/currency-picker.js +1 -1
  57. package/dist/collection/components/dashboard-widget/dashboard-widget.js +1 -1
  58. package/dist/collection/components/date-picker/date-picker.js +1 -1
  59. package/dist/collection/components/date-range/date-range.js +1 -1
  60. package/dist/collection/components/document-chips/document-chips.js +1 -1
  61. package/dist/collection/components/document-picker/document-item/document-item.js +2 -2
  62. package/dist/collection/components/document-picker/document-picker.js +1 -1
  63. package/dist/collection/components/feed/feed-item/feed-timeline-item.js +1 -1
  64. package/dist/collection/components/feed/feed-item-thumbnail-file-info/feed-item-thumbnail-file-info.js +1 -1
  65. package/dist/collection/components/feed/feed.js +1 -1
  66. package/dist/collection/components/filter-chip/filter-chip.js +2 -2
  67. package/dist/collection/components/filter-condition-picker/filter-condition-picker.js +1 -1
  68. package/dist/collection/components/icon-picker/icon-picker.js +1 -1
  69. package/dist/collection/components/info-tile/format/config/info-tile-format.js +1 -1
  70. package/dist/collection/components/info-tile/info-tile.js +1 -1
  71. package/dist/collection/components/kanban/kanban-group/kanban-group.js +1 -1
  72. package/dist/collection/components/kanban/kanban-item/kanban-item.js +1 -1
  73. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison-editor.js +1 -1
  74. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +2 -2
  75. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.js +2 -2
  76. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.js +1 -1
  77. package/dist/collection/components/lime-query-builder/lime-query-builder.js +1 -1
  78. package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.js +1 -1
  79. package/dist/collection/components/lime-query-builder/limetype-field/limetype-field.js +1 -1
  80. package/dist/collection/components/lime-query-builder/order-by/order-by-editor.js +1 -1
  81. package/dist/collection/components/lime-query-builder/order-by/order-by-item.js +2 -2
  82. package/dist/collection/components/lime-query-builder/response-format/response-format-item.js +1 -1
  83. package/dist/collection/components/limeobject/file-viewer/live-docs-info.js +2 -2
  84. package/dist/collection/components/locale-picker/locale-picker.js +1 -1
  85. package/dist/collection/components/notification-list/notification-item/notification-item.js +1 -1
  86. package/dist/collection/components/percentage-visualizer/percentage-visualizer.js +2 -2
  87. package/dist/collection/components/rule-editor/rule-chip-popover/rule-chip-popover.js +1 -1
  88. package/dist/collection/components/rule-editor/rule-editor.js +1 -1
  89. package/dist/collection/components/rule-editor/value-comparison-editor/value-comparison-editor.js +1 -1
  90. package/dist/collection/components/rule-gate/rule-gate.js +1 -1
  91. package/dist/collection/components/summary-popover/summary-popover.js +2 -2
  92. package/dist/collection/components/text-editor/mention-group-counter.js +2 -2
  93. package/dist/collection/components/text-editor/text-editor.js +1 -1
  94. package/dist/collection/components/trend-indicator/trend-indicator.js +1 -1
  95. package/dist/components/chat-icon-list.js +1 -1
  96. package/dist/components/chat-item.js +1 -1
  97. package/dist/components/currency-picker.js +1 -1
  98. package/dist/components/date-picker.js +1 -1
  99. package/dist/components/document-item.js +1 -1
  100. package/dist/components/feed-item-thumbnail-file-info.js +1 -1
  101. package/dist/components/feed-timeline-item.js +1 -1
  102. package/dist/components/filter-chip.js +1 -1
  103. package/dist/components/filter-condition-picker.js +1 -1
  104. package/dist/components/kanban-group.js +1 -1
  105. package/dist/components/kanban-item.js +1 -1
  106. package/dist/components/lime-query-filter-comparison-editor.js +1 -1
  107. package/dist/components/lime-query-filter-comparison.js +1 -1
  108. package/dist/components/lime-query-filter-expression.js +1 -1
  109. package/dist/components/limebb-alert-dialog.js +1 -1
  110. package/dist/components/limebb-browser.js +1 -1
  111. package/dist/components/limebb-chat-list.js +1 -1
  112. package/dist/components/limebb-color-palette-picker.js +1 -1
  113. package/dist/components/limebb-color-palette-swatches.js +1 -1
  114. package/dist/components/limebb-composer-toolbar.js +1 -1
  115. package/dist/components/limebb-dashboard-widget.js +1 -1
  116. package/dist/components/limebb-date-range.js +1 -1
  117. package/dist/components/limebb-document-chips.js +1 -1
  118. package/dist/components/limebb-document-picker.js +1 -1
  119. package/dist/components/limebb-feed.js +1 -1
  120. package/dist/components/limebb-icon-picker.js +1 -1
  121. package/dist/components/limebb-info-tile-format.js +1 -1
  122. package/dist/components/limebb-info-tile.js +1 -1
  123. package/dist/components/limebb-lime-query-builder.js +1 -1
  124. package/dist/components/limebb-lime-query-response-format-builder.js +1 -1
  125. package/dist/components/limebb-locale-picker.js +1 -1
  126. package/dist/components/limebb-mention-group-counter.js +1 -1
  127. package/dist/components/limebb-rule-editor.js +1 -1
  128. package/dist/components/limebb-rule-gate.js +1 -1
  129. package/dist/components/limebb-text-editor.js +1 -1
  130. package/dist/components/limebb-trend-indicator.js +1 -1
  131. package/dist/components/limebb-value-comparison-editor.js +1 -1
  132. package/dist/components/limetype-field.js +1 -1
  133. package/dist/components/live-docs-info.js +1 -1
  134. package/dist/components/notification-item.js +1 -1
  135. package/dist/components/order-by-editor.js +1 -1
  136. package/dist/components/order-by-item.js +1 -1
  137. package/dist/components/percentage-visualizer.js +1 -1
  138. package/dist/components/response-format-item.js +1 -1
  139. package/dist/components/rule-chip-popover.js +1 -1
  140. package/dist/components/summary-popover.js +1 -1
  141. package/dist/components/typing-indicator.js +1 -1
  142. package/dist/esm/lime-crm-building-blocks.js +1 -1
  143. package/dist/esm/limebb-alert-dialog.entry.js +1 -1
  144. package/dist/esm/limebb-browser.entry.js +2 -2
  145. package/dist/esm/limebb-chat-icon-list_3.entry.js +4 -4
  146. package/dist/esm/limebb-chat-list.entry.js +82 -103
  147. package/dist/esm/limebb-color-palette-picker.entry.js +1 -1
  148. package/dist/esm/limebb-color-palette-swatches.entry.js +1 -1
  149. package/dist/esm/limebb-composer-toolbar.entry.js +2 -2
  150. package/dist/esm/limebb-currency-picker.entry.js +1 -1
  151. package/dist/esm/limebb-dashboard-widget.entry.js +1 -1
  152. package/dist/esm/limebb-date-picker.entry.js +1 -1
  153. package/dist/esm/limebb-date-range.entry.js +1 -1
  154. package/dist/esm/limebb-document-chips.entry.js +1 -1
  155. package/dist/esm/limebb-document-item.entry.js +2 -2
  156. package/dist/esm/limebb-document-picker.entry.js +1 -1
  157. package/dist/esm/limebb-feed-item-thumbnail-file-info.entry.js +1 -1
  158. package/dist/esm/limebb-feed-timeline-item.entry.js +1 -1
  159. package/dist/esm/limebb-feed.entry.js +1 -1
  160. package/dist/esm/limebb-filter-chip_6.entry.js +7 -7
  161. package/dist/esm/limebb-icon-picker.entry.js +1 -1
  162. package/dist/esm/limebb-info-tile-format.entry.js +1 -1
  163. package/dist/esm/limebb-info-tile.entry.js +1 -1
  164. package/dist/esm/limebb-kanban-group.entry.js +1 -1
  165. package/dist/esm/limebb-kanban-item.entry.js +1 -1
  166. package/dist/esm/limebb-lime-query-builder.entry.js +1 -1
  167. package/dist/esm/limebb-lime-query-filter-comparison_2.entry.js +2 -2
  168. package/dist/esm/limebb-lime-query-order-by-editor_2.entry.js +2 -2
  169. package/dist/esm/limebb-lime-query-order-by-item.entry.js +2 -2
  170. package/dist/esm/limebb-lime-query-response-format-builder.entry.js +1 -1
  171. package/dist/esm/limebb-lime-query-response-format-editor_2.entry.js +1 -1
  172. package/dist/esm/limebb-live-docs-info.entry.js +2 -2
  173. package/dist/esm/limebb-locale-picker.entry.js +1 -1
  174. package/dist/esm/limebb-mention-group-counter.entry.js +2 -2
  175. package/dist/esm/limebb-navigation-button_2.entry.js +2 -2
  176. package/dist/esm/limebb-notification-item.entry.js +1 -1
  177. package/dist/esm/limebb-percentage-visualizer.entry.js +2 -2
  178. package/dist/esm/limebb-rule-chip-popover.entry.js +1 -1
  179. package/dist/esm/limebb-rule-editor.entry.js +1 -1
  180. package/dist/esm/limebb-rule-gate.entry.js +1 -1
  181. package/dist/esm/limebb-text-editor.entry.js +1 -1
  182. package/dist/esm/limebb-trend-indicator.entry.js +1 -1
  183. package/dist/esm/limebb-value-comparison-editor.entry.js +1 -1
  184. package/dist/esm/loader.js +1 -1
  185. package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
  186. package/dist/lime-crm-building-blocks/p-08797129.entry.js +1 -0
  187. package/dist/lime-crm-building-blocks/{p-0a05b3e9.entry.js → p-0cbe2180.entry.js} +1 -1
  188. package/dist/lime-crm-building-blocks/p-0cc47cad.entry.js +1 -0
  189. package/dist/lime-crm-building-blocks/{p-54735042.entry.js → p-1990e369.entry.js} +1 -1
  190. package/dist/lime-crm-building-blocks/{p-0dd64440.entry.js → p-229d018c.entry.js} +1 -1
  191. package/dist/lime-crm-building-blocks/{p-7cd8dffd.entry.js → p-28550961.entry.js} +1 -1
  192. package/dist/lime-crm-building-blocks/{p-568c4e76.entry.js → p-32a81271.entry.js} +1 -1
  193. package/dist/lime-crm-building-blocks/p-3babfbe0.entry.js +1 -0
  194. package/dist/lime-crm-building-blocks/{p-de7724f0.entry.js → p-402a9c97.entry.js} +1 -1
  195. package/dist/lime-crm-building-blocks/{p-97e2e5c9.entry.js → p-46aec244.entry.js} +1 -1
  196. package/dist/lime-crm-building-blocks/{p-f102f169.entry.js → p-551a36f6.entry.js} +1 -1
  197. package/dist/lime-crm-building-blocks/{p-615770be.entry.js → p-6331f9c5.entry.js} +1 -1
  198. package/dist/lime-crm-building-blocks/{p-c46802cd.entry.js → p-635a45ad.entry.js} +1 -1
  199. package/dist/lime-crm-building-blocks/{p-d8d32cb1.entry.js → p-6f923112.entry.js} +1 -1
  200. package/dist/lime-crm-building-blocks/p-79d743bb.entry.js +1 -0
  201. package/dist/lime-crm-building-blocks/{p-4e4d096c.entry.js → p-7ae27308.entry.js} +1 -1
  202. package/dist/lime-crm-building-blocks/{p-b48d7d23.entry.js → p-81783bd4.entry.js} +1 -1
  203. package/dist/lime-crm-building-blocks/{p-657b89d4.entry.js → p-8c36b847.entry.js} +1 -1
  204. package/dist/lime-crm-building-blocks/{p-5b97d4f4.entry.js → p-8e9fcf3c.entry.js} +1 -1
  205. package/dist/lime-crm-building-blocks/{p-c635f826.entry.js → p-90f0c96b.entry.js} +1 -1
  206. package/dist/lime-crm-building-blocks/{p-b6807166.entry.js → p-95ba7a84.entry.js} +1 -1
  207. package/dist/lime-crm-building-blocks/{p-2d1c7b6f.entry.js → p-97e75dee.entry.js} +1 -1
  208. package/dist/lime-crm-building-blocks/{p-170ab4be.entry.js → p-a201df35.entry.js} +1 -1
  209. package/dist/lime-crm-building-blocks/{p-a716b3a8.entry.js → p-a953d48e.entry.js} +1 -1
  210. package/dist/lime-crm-building-blocks/{p-ee7bd504.entry.js → p-ab0f8170.entry.js} +1 -1
  211. package/dist/lime-crm-building-blocks/p-ad5dcefd.entry.js +1 -0
  212. package/dist/lime-crm-building-blocks/{p-73f23d08.entry.js → p-b44b9dbc.entry.js} +1 -1
  213. package/dist/lime-crm-building-blocks/{p-f024c185.entry.js → p-bf05d9de.entry.js} +1 -1
  214. package/dist/lime-crm-building-blocks/{p-e910963c.entry.js → p-c0d49532.entry.js} +1 -1
  215. package/dist/lime-crm-building-blocks/{p-d8ce3497.entry.js → p-cc53a8ca.entry.js} +1 -1
  216. package/dist/lime-crm-building-blocks/{p-45dd8663.entry.js → p-cf03a756.entry.js} +1 -1
  217. package/dist/lime-crm-building-blocks/{p-27b9c824.entry.js → p-cf66256a.entry.js} +1 -1
  218. package/dist/lime-crm-building-blocks/{p-f3905fa2.entry.js → p-d3c58bc1.entry.js} +1 -1
  219. package/dist/lime-crm-building-blocks/{p-d816fcc8.entry.js → p-dcb49a62.entry.js} +1 -1
  220. package/dist/lime-crm-building-blocks/{p-b3529254.entry.js → p-dd02821e.entry.js} +1 -1
  221. package/dist/lime-crm-building-blocks/{p-fc372344.entry.js → p-ddc4ede8.entry.js} +1 -1
  222. package/dist/lime-crm-building-blocks/{p-f1060c88.entry.js → p-dfaef740.entry.js} +1 -1
  223. package/dist/lime-crm-building-blocks/{p-3fd84800.entry.js → p-e6cc320a.entry.js} +1 -1
  224. package/dist/lime-crm-building-blocks/{p-7c5ecffe.entry.js → p-f3539042.entry.js} +1 -1
  225. package/dist/lime-crm-building-blocks/{p-b6c2d93b.entry.js → p-f5c1ed0c.entry.js} +1 -1
  226. package/dist/lime-crm-building-blocks/{p-ea6ab8b0.entry.js → p-f9991c35.entry.js} +1 -1
  227. package/dist/types/components/chat-list/chat-list.d.ts +8 -2
  228. package/dist/types/components/chat-list/scroll-anchor.d.ts +8 -31
  229. package/dist/types/components.d.ts +4 -0
  230. package/package.json +1 -1
  231. package/dist/collection/components/chat-list/typing-indicator-scroll.js +0 -41
  232. package/dist/lime-crm-building-blocks/p-02fba38e.entry.js +0 -1
  233. package/dist/lime-crm-building-blocks/p-0445035f.entry.js +0 -1
  234. package/dist/lime-crm-building-blocks/p-6d8efe87.entry.js +0 -1
  235. package/dist/lime-crm-building-blocks/p-93af3e81.entry.js +0 -1
  236. package/dist/lime-crm-building-blocks/p-a2b9c410.entry.js +0 -1
  237. package/dist/types/components/chat-list/typing-indicator-scroll.d.ts +0 -18
@@ -1 +1 @@
1
- import{proxyCustomElement as t,HTMLElement as e,createEvent as i,h as l,transformTag as n}from"@stencil/core/internal/client";const o=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.change=i(this,"change",7),this.handleChangeType=t=>{t.stopPropagation();const e=t.detail.id;"none"===e?this.change.emit():this.change.emit("date"===e||"relative-date"===e?{type:e}:"percent"===e?{type:"number",options:{style:"percent"},suffix:["percentSign"]}:{type:"number",options:{style:e}})},this.isValidButton=t=>!this.type||"none"===t.id||"none"!==this.type&&("date"===this.type?t.id.includes("date"):!t.id.includes("date"))}render(){var t,e,i,n,o,s,r,d,a,u,m;const c=[{id:"none",title:"No formatting",selected:!(null===(t=this.value)||void 0===t?void 0:t.type)},{id:"currency",title:"Currency",selected:"number"===(null===(e=this.value)||void 0===e?void 0:e.type)&&"currency"===(null===(i=this.value.options)||void 0===i?void 0:i.style)},{id:"decimal",title:"Decimal",selected:"number"===(null===(n=this.value)||void 0===n?void 0:n.type)&&"decimal"===(null===(o=this.value.options)||void 0===o?void 0:o.style)},{id:"percent",title:"Percent",selected:"number"===(null===(s=this.value)||void 0===s?void 0:s.type)&&"percent"===(null===(r=this.value.options)||void 0===r?void 0:r.style)},{id:"unit",title:"Unit",selected:"number"===(null===(d=this.value)||void 0===d?void 0:d.type)&&"unit"===(null===(a=this.value.options)||void 0===a?void 0:a.style)},{id:"date",title:"Date",selected:"date"===(null===(u=this.value)||void 0===u?void 0:u.type)},{id:"relative-date",title:"Relative date",selected:"relative-date"===(null===(m=this.value)||void 0===m?void 0:m.type)}];return[l("limel-button-group",{key:"68999f607fd66a5a451929d6720200734c6505ea",value:c.filter(this.isValidButton),onChange:this.handleChangeType}),this.renderFormatConfig()]}renderFormatConfig(){var t,e;if(!(null===(t=this.value)||void 0===t?void 0:t.type))return;let i=this.value.type;this.isNumberFormat(this.value)&&(i=null===(e=this.value.options)||void 0===e?void 0:e.style);const n=`limebb-info-tile-${i}-format`;return customElements.get(n)?l(n,{platform:this.platform,context:this.context,class:"format",value:this.value}):void 0}isNumberFormat(t){return"number"===(null==t?void 0:t.type)}static get style(){return":host(limebb-info-tile-format){display:grid;gap:1rem}limel-button-group{grid-column:1/-1}.format{display:grid;gap:0.5rem;grid-template-columns:repeat(auto-fit, minmax(8rem, 1fr))}"}},[1,"limebb-info-tile-format",{platform:[16],context:[16],type:[1],value:[16]}]),s=o,r=function(){"undefined"!=typeof customElements&&["limebb-info-tile-format"].forEach((t=>{"limebb-info-tile-format"===t&&(customElements.get(n(t))||customElements.define(n(t),o))}))};export{s as LimebbInfoTileFormat,r as defineCustomElement}
1
+ import{proxyCustomElement as t,HTMLElement as e,createEvent as i,h as l,transformTag as n}from"@stencil/core/internal/client";const o=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.change=i(this,"change",7),this.handleChangeType=t=>{t.stopPropagation();const e=t.detail.id;"none"===e?this.change.emit():this.change.emit("date"===e||"relative-date"===e?{type:e}:"percent"===e?{type:"number",options:{style:"percent"},suffix:["percentSign"]}:{type:"number",options:{style:e}})},this.isValidButton=t=>!this.type||"none"===t.id||"none"!==this.type&&("date"===this.type?t.id.includes("date"):!t.id.includes("date"))}render(){var t,e,i,n,o,s,r,d,u,a,m;const c=[{id:"none",title:"No formatting",selected:!(null===(t=this.value)||void 0===t?void 0:t.type)},{id:"currency",title:"Currency",selected:"number"===(null===(e=this.value)||void 0===e?void 0:e.type)&&"currency"===(null===(i=this.value.options)||void 0===i?void 0:i.style)},{id:"decimal",title:"Decimal",selected:"number"===(null===(n=this.value)||void 0===n?void 0:n.type)&&"decimal"===(null===(o=this.value.options)||void 0===o?void 0:o.style)},{id:"percent",title:"Percent",selected:"number"===(null===(s=this.value)||void 0===s?void 0:s.type)&&"percent"===(null===(r=this.value.options)||void 0===r?void 0:r.style)},{id:"unit",title:"Unit",selected:"number"===(null===(d=this.value)||void 0===d?void 0:d.type)&&"unit"===(null===(u=this.value.options)||void 0===u?void 0:u.style)},{id:"date",title:"Date",selected:"date"===(null===(a=this.value)||void 0===a?void 0:a.type)},{id:"relative-date",title:"Relative date",selected:"relative-date"===(null===(m=this.value)||void 0===m?void 0:m.type)}];return[l("limel-button-group",{key:"af628fd7209c35426f94257b9d01751132eb7062",value:c.filter(this.isValidButton),onChange:this.handleChangeType}),this.renderFormatConfig()]}renderFormatConfig(){var t,e;if(!(null===(t=this.value)||void 0===t?void 0:t.type))return;let i=this.value.type;this.isNumberFormat(this.value)&&(i=null===(e=this.value.options)||void 0===e?void 0:e.style);const n=`limebb-info-tile-${i}-format`;return customElements.get(n)?l(n,{platform:this.platform,context:this.context,class:"format",value:this.value}):void 0}isNumberFormat(t){return"number"===(null==t?void 0:t.type)}static get style(){return":host(limebb-info-tile-format){display:grid;gap:1rem}limel-button-group{grid-column:1/-1}.format{display:grid;gap:0.5rem;grid-template-columns:repeat(auto-fit, minmax(8rem, 1fr))}"}},[1,"limebb-info-tile-format",{platform:[16],context:[16],type:[1],value:[16]}]),s=o,r=function(){"undefined"!=typeof customElements&&["limebb-info-tile-format"].forEach((t=>{"limebb-info-tile-format"===t&&(customElements.get(n(t))||customElements.define(n(t),o))}))};export{s as LimebbInfoTileFormat,r as defineCustomElement}
@@ -1 +1 @@
1
- import{proxyCustomElement as t,HTMLElement as e,h as i,transformTag as r}from"@stencil/core/internal/client";import{n as s,o,p as n,h as a,I as l,s as h}from"./index.esm.js";import{a as c}from"./limetype.js";class u{constructor(t){this.getState=t,this.contextType="info-tile"}getContext(){const{limetype:t,filterId:e,filterName:i,aggregateOperator:r,propertyName:s,value:o,label:n}=this.getState();if(!t||!e)return console.debug("InfoTileContextProvider: No limetype or filterId available"),null;const a={widgetType:"info-tile",limetype:t,filterId:e};return i&&(a.filterName=i),a.aggregateOperator=r,s&&(a.propertyName=s),void 0!==o&&(a.value=o),n&&(a.label=n),{data:a,purpose:"Shows an aggregated value from a filter. Clicking navigates to the explorer with that filter applied."}}}class f{constructor(t,e=[]){this.platform=t,this.filters=e}async load(t,e){let i;return i=this.isObjectIdentifier(e)?await this.loadLimeObjectInfoTile(t,e):await this.loadBasicInfoTile(t),i}async loadBasicInfoTile(t){var e;const i=this.getFilter(t.filter);if(!i)throw Error(`Filter "${t.filter}" not found`);return null!==(e=(await this.query.execute({limetype:i.limetype,responseFormat:{aggregates:{infotiles:{value:{op:t.operator,key:t.name}}}},filter:i.filter})).aggregates.infotiles[0].value)&&void 0!==e?e:0}async loadLimeObjectInfoTile(t,e){await this.objectRepository.loadObject(e.limetype,e.id,{properties:[t]});const i=this.objectRepository.getObject(e.limetype,e.id);return null==i?void 0:i.getValue([t.name,t.key].join("."))}isObjectIdentifier(t){return!(!(null==t?void 0:t.limetype)||!(null==t?void 0:t.id))}getFilter(t){return this.filters.find((e=>e.id===t))}get query(){return this.platform.get(s.Query)}get objectRepository(){return this.platform.get(s.LimeObjectRepository)}}function d(t,e){return t&&(t[e]||t.en||t.en_us)||""}function p(t,e=[]){const{path:i,query:r}=function(t,e=[]){if(!t)return{path:"#"};const i=["explorer",t.limetype,t.id].join("/"),r=function(t,e){const i=[...e,t].filter((t=>void 0!==t));if(0!==i.length)return 1===i.length?i[0]:{op:o.AND,exp:i}}(t.filter,e);return r?{path:i,query:{filter:r}}:{path:i}}(t,e);return r?`${i}?${Object.entries(r).map((([t,e])=>`${t}=${encodeURIComponent(JSON.stringify(e))}`)).join("&")}`:i}class g{constructor(t){this.locale=t}format(t){let e=t+"";return"number"==typeof t?e=new Intl.NumberFormat(this.locale).format(t):new Date(t).getTime()&&(e=new Intl.DateTimeFormat(this.locale).format(new Date(t))),{value:e}}}class m{constructor(t){this.locale=t}format(t,e){const i=new Date(t);return{prefix:this.formatAffix("prefix",i,e),value:this.formatValue(i,e),suffix:this.formatAffix("suffix",i,e)}}formatValue(t,e){const i=Object.assign({},e.options);if(e.prefix)for(const t of e.prefix)delete i[t];if(e.suffix)for(const t of e.suffix)delete i[t];return new Intl.DateTimeFormat(this.locale,i).format(t)}formatAffix(t,e,i){const r=Object.assign({},i.options);for(const e of Object.keys(r))"hour12"!==e&&((i[t]||[]).includes(e)||delete r[e]);if(0!==Object.values(r).filter(Boolean).length)return new Intl.DateTimeFormat(this.locale,r).format(e)}}class v{constructor(t){this.locale=t}format(t,e){var i,r;const s=new Intl.NumberFormat(this.locale,e.options),o=s.formatToParts(t);let n="",a="",l="";for(const t of o)(null===(i=e.prefix)||void 0===i?void 0:i.includes(t.type))?n+=t.value:(null===(r=e.suffix)||void 0===r?void 0:r.includes(t.type))?l+=t.value:a+=t.value;return a||(a=s.format(t),n="",l=""),{prefix:n,value:a,suffix:l}}}class y{constructor(t){this.locale=t}format(t,e){const i=new Intl.RelativeTimeFormat(this.locale,e.options),{value:r,unit:s}=this.getRelativeTime(t),o=i.formatToParts(r,s);let n="",a="",l="";for(const t of o)"literal"!==t.type||a?"literal"===t.type&&a?l+=t.value:a+=t.value:n+=t.value;return a||(a=n||l,n="",l=""),{prefix:n,value:a,suffix:l}}getRelativeTime(t){const e=new Date(t),i=new Date,r=e.getTime()-i.getTime(),s=[{unit:"year",value:31536e6},{unit:"month",value:2592e6},{unit:"week",value:6048e5},{unit:"day",value:864e5},{unit:"hour",value:36e5},{unit:"minute",value:6e4},{unit:"second",value:1e3}];for(const t of s){const e=r/t.value;if(Math.abs(e)>=1)return{value:Math.round(e),unit:t.unit}}return{value:0,unit:"second"}}}class b{constructor(t){this.locale=t}createFormatter(t,e){return"number"===(null==t?void 0:t.type)&&"number"==typeof e?new v(this.locale):"date"===(null==t?void 0:t.type)&&"string"==typeof e?new m(this.locale):"relative-date"===(null==t?void 0:t.type)&&"string"==typeof e?new y(this.locale):new g(this.locale)}}var w=function(t,e,i,r){var s,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(n=(o<3?s(n):o>3?s(e,i,n):s(e,i))||n);return o>3&&n&&Object.defineProperty(e,i,n),n};const x=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.aggregateOperator=h.Count,this.loading=!1,this.error=!1}get hostElement(){return this.host}connectedCallback(){this.registerContextProvider()}disconnectedCallback(){var t;null===(t=this.unregisterContextProvider)||void 0===t||t.call(this)}componentWillLoad(){this.loadInfoTileValue()}watchFilterId(){this.loadInfoTileValue()}watchPropertyName(){this.loadInfoTileValue()}watchAggregateOperator(){this.loadInfoTileValue()}async loadInfoTileValue(){if(this.loading=!0,this.error=!1,this.getFilter()){try{const t={key:this.getKey(),name:this.propertyName,operator:this.aggregateOperator,filter:this.filterId};this.value=await this.loader.load(t,this.context)}catch(t){console.error(t),this.error=!0}this.loading=!1}else this.error=!0}getKey(){return Math.random().toString(36).slice(2)}render(){var t,e;const r=this.getFilter(),s=this.getFormattedValue(),o={disabled:this.disabled,icon:this.icon,prefix:(null===(t=null==s?void 0:s.prefix)||void 0===t?void 0:t.trim())||this.prefix,suffix:(null===(e=null==s?void 0:s.suffix)||void 0===e?void 0:e.trim())||this.suffix,reducedPresence:this.shouldReducePresence()},n=Object.assign(Object.assign({},o),{icon:"error",prefix:"ERROR",loading:!0,label:this.getLabel(r)}),a=Object.assign(Object.assign({},o),{label:this.getLabel(r),link:this.getLink(r),loading:this.loading,value:null==s?void 0:s.value.trim()});return i("limel-info-tile",Object.assign({key:"802c93fade2b3aff10e53c1a970798b994bff2d2",class:{error:!r||this.error}},!r||this.error?n:a))}shouldReducePresence(){if(this.reducedPresence)return!0;if(!this.reducedPresenceRule||this.loading)return!1;try{return this.ruleRegistry.compile(this.reducedPresenceRule).evaluate(this.ruleRegistry.scope({host:this.hostElement,with:{scalarValue:this.value}}))}catch(t){return!1}}getFormattedValue(){if(!this.value&&0!==this.value)return{value:""};try{return this.getFormatter(this.value).format(this.value,this.format)}catch(t){return new g(this.language).format(this.value)}}getLabel(t){return t?"string"==typeof this.label?this.translator.get(this.label):d(this.label&&"object"==typeof this.label?this.label:t.name,this.language):"No filter set is selected"}getLink(t){const e=c({targetLimetype:t?this.limetypes[t.limetype]:void 0,currentLimetype:this.context.limetype?this.limetypes[this.context.limetype]:void 0,contextLimetypeName:this.context.limetype,contextId:this.context.id,propertyName:this.propertyName});return{href:p(t,e&&this.context.id?[{key:e,op:o.EQUALS,exp:this.context.id}]:[])}}getFilter(){return function(t,e){if(t&&e)return t.find((t=>t.id===e))}(this.filters,this.filterId)}getFormatter(t){return new b(this.language).createFormatter(this.format,t)}get translator(){return this.platform.get(s.Translate)}get ruleRegistry(){return this.platform.get(s.RuleRegistry)}get language(){return this.platform.get(s.Application).getLanguage()}get loader(){return new f(this.platform,this.filters)}registerContextProvider(){const t=this.platform.get(s.AIContextRegistry);if(!(null==t?void 0:t.register))return;const e=new u((()=>{const t=this.getFilter();return{limetype:null==t?void 0:t.limetype,filterId:this.filterId,filterName:t?d(t.name,this.language):void 0,aggregateOperator:this.aggregateOperator,propertyName:this.propertyName,value:this.value,label:this.getLabel(t)}}));this.unregisterContextProvider=t.register(e,this.hostElement)}get host(){return this}static get watchers(){return{filterId:[{watchFilterId:0}],propertyName:[{watchPropertyName:0}],aggregateOperator:[{watchAggregateOperator:0}]}}static get style(){return":host(limebb-info-tile){display:block;overflow:visible !important;background-color:transparent !important}limel-info-tile.error{--info-tile-icon-color:rgb(var(--color-red-dark));border:1px dashed rgb(var(--contrast-500));border-radius:var(--info-tile-border-radius, 1rem)}"}},[1,"limebb-info-tile",{platform:[16],context:[16],filterId:[513,"filter-id"],disabled:[4],icon:[513],label:[1],prefix:[1],suffix:[1],propertyName:[1,"property-name"],aggregateOperator:[1,"aggregate-operator"],format:[16],reducedPresence:[516,"reduced-presence"],reducedPresenceRule:[16],config:[32],filters:[32],value:[32],loading:[32],error:[32],limetypes:[32]},void 0,{filterId:[{watchFilterId:0}],propertyName:[{watchPropertyName:0}],aggregateOperator:[{watchAggregateOperator:0}]}]);w([n({})],x.prototype,"config",void 0),w([a()],x.prototype,"filters",void 0),w([l()],x.prototype,"limetypes",void 0);const I=x,O=function(){"undefined"!=typeof customElements&&["limebb-info-tile"].forEach((t=>{"limebb-info-tile"===t&&(customElements.get(r(t))||customElements.define(r(t),x))}))};export{I as LimebbInfoTile,O as defineCustomElement}
1
+ import{proxyCustomElement as t,HTMLElement as e,h as i,transformTag as r}from"@stencil/core/internal/client";import{n as s,o,p as n,h as a,I as l,s as h}from"./index.esm.js";import{a as c}from"./limetype.js";class u{constructor(t){this.getState=t,this.contextType="info-tile"}getContext(){const{limetype:t,filterId:e,filterName:i,aggregateOperator:r,propertyName:s,value:o,label:n}=this.getState();if(!t||!e)return console.debug("InfoTileContextProvider: No limetype or filterId available"),null;const a={widgetType:"info-tile",limetype:t,filterId:e};return i&&(a.filterName=i),a.aggregateOperator=r,s&&(a.propertyName=s),void 0!==o&&(a.value=o),n&&(a.label=n),{data:a,purpose:"Shows an aggregated value from a filter. Clicking navigates to the explorer with that filter applied."}}}class f{constructor(t,e=[]){this.platform=t,this.filters=e}async load(t,e){let i;return i=this.isObjectIdentifier(e)?await this.loadLimeObjectInfoTile(t,e):await this.loadBasicInfoTile(t),i}async loadBasicInfoTile(t){var e;const i=this.getFilter(t.filter);if(!i)throw Error(`Filter "${t.filter}" not found`);return null!==(e=(await this.query.execute({limetype:i.limetype,responseFormat:{aggregates:{infotiles:{value:{op:t.operator,key:t.name}}}},filter:i.filter})).aggregates.infotiles[0].value)&&void 0!==e?e:0}async loadLimeObjectInfoTile(t,e){await this.objectRepository.loadObject(e.limetype,e.id,{properties:[t]});const i=this.objectRepository.getObject(e.limetype,e.id);return null==i?void 0:i.getValue([t.name,t.key].join("."))}isObjectIdentifier(t){return!(!(null==t?void 0:t.limetype)||!(null==t?void 0:t.id))}getFilter(t){return this.filters.find((e=>e.id===t))}get query(){return this.platform.get(s.Query)}get objectRepository(){return this.platform.get(s.LimeObjectRepository)}}function d(t,e){return t&&(t[e]||t.en||t.en_us)||""}function p(t,e=[]){const{path:i,query:r}=function(t,e=[]){if(!t)return{path:"#"};const i=["explorer",t.limetype,t.id].join("/"),r=function(t,e){const i=[...e,t].filter((t=>void 0!==t));if(0!==i.length)return 1===i.length?i[0]:{op:o.AND,exp:i}}(t.filter,e);return r?{path:i,query:{filter:r}}:{path:i}}(t,e);return r?`${i}?${Object.entries(r).map((([t,e])=>`${t}=${encodeURIComponent(JSON.stringify(e))}`)).join("&")}`:i}class g{constructor(t){this.locale=t}format(t){let e=t+"";return"number"==typeof t?e=new Intl.NumberFormat(this.locale).format(t):new Date(t).getTime()&&(e=new Intl.DateTimeFormat(this.locale).format(new Date(t))),{value:e}}}class m{constructor(t){this.locale=t}format(t,e){const i=new Date(t);return{prefix:this.formatAffix("prefix",i,e),value:this.formatValue(i,e),suffix:this.formatAffix("suffix",i,e)}}formatValue(t,e){const i=Object.assign({},e.options);if(e.prefix)for(const t of e.prefix)delete i[t];if(e.suffix)for(const t of e.suffix)delete i[t];return new Intl.DateTimeFormat(this.locale,i).format(t)}formatAffix(t,e,i){const r=Object.assign({},i.options);for(const e of Object.keys(r))"hour12"!==e&&((i[t]||[]).includes(e)||delete r[e]);if(0!==Object.values(r).filter(Boolean).length)return new Intl.DateTimeFormat(this.locale,r).format(e)}}class v{constructor(t){this.locale=t}format(t,e){var i,r;const s=new Intl.NumberFormat(this.locale,e.options),o=s.formatToParts(t);let n="",a="",l="";for(const t of o)(null===(i=e.prefix)||void 0===i?void 0:i.includes(t.type))?n+=t.value:(null===(r=e.suffix)||void 0===r?void 0:r.includes(t.type))?l+=t.value:a+=t.value;return a||(a=s.format(t),n="",l=""),{prefix:n,value:a,suffix:l}}}class b{constructor(t){this.locale=t}format(t,e){const i=new Intl.RelativeTimeFormat(this.locale,e.options),{value:r,unit:s}=this.getRelativeTime(t),o=i.formatToParts(r,s);let n="",a="",l="";for(const t of o)"literal"!==t.type||a?"literal"===t.type&&a?l+=t.value:a+=t.value:n+=t.value;return a||(a=n||l,n="",l=""),{prefix:n,value:a,suffix:l}}getRelativeTime(t){const e=new Date(t),i=new Date,r=e.getTime()-i.getTime(),s=[{unit:"year",value:31536e6},{unit:"month",value:2592e6},{unit:"week",value:6048e5},{unit:"day",value:864e5},{unit:"hour",value:36e5},{unit:"minute",value:6e4},{unit:"second",value:1e3}];for(const t of s){const e=r/t.value;if(Math.abs(e)>=1)return{value:Math.round(e),unit:t.unit}}return{value:0,unit:"second"}}}class y{constructor(t){this.locale=t}createFormatter(t,e){return"number"===(null==t?void 0:t.type)&&"number"==typeof e?new v(this.locale):"date"===(null==t?void 0:t.type)&&"string"==typeof e?new m(this.locale):"relative-date"===(null==t?void 0:t.type)&&"string"==typeof e?new b(this.locale):new g(this.locale)}}var w=function(t,e,i,r){var s,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(n=(o<3?s(n):o>3?s(e,i,n):s(e,i))||n);return o>3&&n&&Object.defineProperty(e,i,n),n};const x=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.aggregateOperator=h.Count,this.loading=!1,this.error=!1}get hostElement(){return this.host}connectedCallback(){this.registerContextProvider()}disconnectedCallback(){var t;null===(t=this.unregisterContextProvider)||void 0===t||t.call(this)}componentWillLoad(){this.loadInfoTileValue()}watchFilterId(){this.loadInfoTileValue()}watchPropertyName(){this.loadInfoTileValue()}watchAggregateOperator(){this.loadInfoTileValue()}async loadInfoTileValue(){if(this.loading=!0,this.error=!1,this.getFilter()){try{const t={key:this.getKey(),name:this.propertyName,operator:this.aggregateOperator,filter:this.filterId};this.value=await this.loader.load(t,this.context)}catch(t){console.error(t),this.error=!0}this.loading=!1}else this.error=!0}getKey(){return Math.random().toString(36).slice(2)}render(){var t,e;const r=this.getFilter(),s=this.getFormattedValue(),o={disabled:this.disabled,icon:this.icon,prefix:(null===(t=null==s?void 0:s.prefix)||void 0===t?void 0:t.trim())||this.prefix,suffix:(null===(e=null==s?void 0:s.suffix)||void 0===e?void 0:e.trim())||this.suffix,reducedPresence:this.shouldReducePresence()},n=Object.assign(Object.assign({},o),{icon:"error",prefix:"ERROR",loading:!0,label:this.getLabel(r)}),a=Object.assign(Object.assign({},o),{label:this.getLabel(r),link:this.getLink(r),loading:this.loading,value:null==s?void 0:s.value.trim()});return i("limel-info-tile",Object.assign({key:"50e9fba6bf058bc41f8596f42fba5b2a20762adc",class:{error:!r||this.error}},!r||this.error?n:a))}shouldReducePresence(){if(this.reducedPresence)return!0;if(!this.reducedPresenceRule||this.loading)return!1;try{return this.ruleRegistry.compile(this.reducedPresenceRule).evaluate(this.ruleRegistry.scope({host:this.hostElement,with:{scalarValue:this.value}}))}catch(t){return!1}}getFormattedValue(){if(!this.value&&0!==this.value)return{value:""};try{return this.getFormatter(this.value).format(this.value,this.format)}catch(t){return new g(this.language).format(this.value)}}getLabel(t){return t?"string"==typeof this.label?this.translator.get(this.label):d(this.label&&"object"==typeof this.label?this.label:t.name,this.language):"No filter set is selected"}getLink(t){const e=c({targetLimetype:t?this.limetypes[t.limetype]:void 0,currentLimetype:this.context.limetype?this.limetypes[this.context.limetype]:void 0,contextLimetypeName:this.context.limetype,contextId:this.context.id,propertyName:this.propertyName});return{href:p(t,e&&this.context.id?[{key:e,op:o.EQUALS,exp:this.context.id}]:[])}}getFilter(){return function(t,e){if(t&&e)return t.find((t=>t.id===e))}(this.filters,this.filterId)}getFormatter(t){return new y(this.language).createFormatter(this.format,t)}get translator(){return this.platform.get(s.Translate)}get ruleRegistry(){return this.platform.get(s.RuleRegistry)}get language(){return this.platform.get(s.Application).getLanguage()}get loader(){return new f(this.platform,this.filters)}registerContextProvider(){const t=this.platform.get(s.AIContextRegistry);if(!(null==t?void 0:t.register))return;const e=new u((()=>{const t=this.getFilter();return{limetype:null==t?void 0:t.limetype,filterId:this.filterId,filterName:t?d(t.name,this.language):void 0,aggregateOperator:this.aggregateOperator,propertyName:this.propertyName,value:this.value,label:this.getLabel(t)}}));this.unregisterContextProvider=t.register(e,this.hostElement)}get host(){return this}static get watchers(){return{filterId:[{watchFilterId:0}],propertyName:[{watchPropertyName:0}],aggregateOperator:[{watchAggregateOperator:0}]}}static get style(){return":host(limebb-info-tile){display:block;overflow:visible !important;background-color:transparent !important}limel-info-tile.error{--info-tile-icon-color:rgb(var(--color-red-dark));border:1px dashed rgb(var(--contrast-500));border-radius:var(--info-tile-border-radius, 1rem)}"}},[1,"limebb-info-tile",{platform:[16],context:[16],filterId:[513,"filter-id"],disabled:[4],icon:[513],label:[1],prefix:[1],suffix:[1],propertyName:[1,"property-name"],aggregateOperator:[1,"aggregate-operator"],format:[16],reducedPresence:[516,"reduced-presence"],reducedPresenceRule:[16],config:[32],filters:[32],value:[32],loading:[32],error:[32],limetypes:[32]},void 0,{filterId:[{watchFilterId:0}],propertyName:[{watchPropertyName:0}],aggregateOperator:[{watchAggregateOperator:0}]}]);w([n({})],x.prototype,"config",void 0),w([a()],x.prototype,"filters",void 0),w([l()],x.prototype,"limetypes",void 0);const I=x,O=function(){"undefined"!=typeof customElements&&["limebb-info-tile"].forEach((t=>{"limebb-info-tile"===t&&(customElements.get(r(t))||customElements.define(r(t),x))}))};export{I as LimebbInfoTile,O as defineCustomElement}
@@ -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{I as l}from"./index.esm.js";import{i as m}from"./lime-query-validation.js";import{d as a}from"./filter-chip.js";import{d}from"./filter-condition-picker.js";import{d as n}from"./lime-query-filter-builder.js";import{d as u}from"./lime-query-filter-comparison.js";import{d as c}from"./lime-query-filter-comparison-editor.js";import{e as h,b,d as p}from"./lime-query-filter-expression.js";import{d as f}from"./order-by-editor.js";import{d as y}from"./order-by-item.js";import{d as v}from"./response-format-editor.js";import{d as g}from"./response-format-item.js";import{d as q}from"./lime-query-value-input.js";import{d as x}from"./limetype-field.js";import{d as k}from"./property-selector.js";const E=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:"0f28a00b055f7e9094dd26cf733acba1158dda45"},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 m(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:"Enter a number",helperText:"Maximum number of results. When empty, a default limit is applied.",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 m=e.length-1;m>=0;m--)(s=e[m])&&(l=(o<3?s(l):o>3?s(i,t,l):s(i,t))||l);o>3&&l&&Object.defineProperty(i,t,l)}([l()],E.prototype,"limetypes",void 0);const j=E,C=function(){"undefined"!=typeof customElements&&["limebb-lime-query-builder","limebb-filter-chip","limebb-filter-condition-picker","limebb-lime-query-filter-builder","limebb-lime-query-filter-comparison","limebb-lime-query-filter-comparison-editor","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),E);break;case"limebb-filter-chip":customElements.get(o(e))||a();break;case"limebb-filter-condition-picker":customElements.get(o(e))||d();break;case"limebb-lime-query-filter-builder":customElements.get(o(e))||n();break;case"limebb-lime-query-filter-comparison":customElements.get(o(e))||u();break;case"limebb-lime-query-filter-comparison-editor":customElements.get(o(e))||c();break;case"limebb-lime-query-filter-expression":customElements.get(o(e))||p();break;case"limebb-lime-query-filter-group":customElements.get(o(e))||b();break;case"limebb-lime-query-filter-not":customElements.get(o(e))||h();break;case"limebb-lime-query-order-by-editor":customElements.get(o(e))||f();break;case"limebb-lime-query-order-by-item":customElements.get(o(e))||y();break;case"limebb-lime-query-response-format-editor":customElements.get(o(e))||v();break;case"limebb-lime-query-response-format-item":customElements.get(o(e))||g();break;case"limebb-lime-query-value-input":customElements.get(o(e))||q();break;case"limebb-limetype-field":customElements.get(o(e))||x();break;case"limebb-property-selector":customElements.get(o(e))||k()}}))};export{j as LimebbLimeQueryBuilder,C 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{I as l}from"./index.esm.js";import{i as m}from"./lime-query-validation.js";import{d as a}from"./filter-chip.js";import{d}from"./filter-condition-picker.js";import{d as n}from"./lime-query-filter-builder.js";import{d as u}from"./lime-query-filter-comparison.js";import{d as c}from"./lime-query-filter-comparison-editor.js";import{e as h,b,d as p}from"./lime-query-filter-expression.js";import{d as f}from"./order-by-editor.js";import{d as y}from"./order-by-item.js";import{d as v}from"./response-format-editor.js";import{d as g}from"./response-format-item.js";import{d as q}from"./lime-query-value-input.js";import{d as x}from"./limetype-field.js";import{d as k}from"./property-selector.js";const E=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:"798c1d0486dae6e06663e9a64913cc5d614a6351"},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 m(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:"Enter a number",helperText:"Maximum number of results. When empty, a default limit is applied.",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 m=e.length-1;m>=0;m--)(s=e[m])&&(l=(o<3?s(l):o>3?s(i,t,l):s(i,t))||l);o>3&&l&&Object.defineProperty(i,t,l)}([l()],E.prototype,"limetypes",void 0);const j=E,C=function(){"undefined"!=typeof customElements&&["limebb-lime-query-builder","limebb-filter-chip","limebb-filter-condition-picker","limebb-lime-query-filter-builder","limebb-lime-query-filter-comparison","limebb-lime-query-filter-comparison-editor","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),E);break;case"limebb-filter-chip":customElements.get(o(e))||a();break;case"limebb-filter-condition-picker":customElements.get(o(e))||d();break;case"limebb-lime-query-filter-builder":customElements.get(o(e))||n();break;case"limebb-lime-query-filter-comparison":customElements.get(o(e))||u();break;case"limebb-lime-query-filter-comparison-editor":customElements.get(o(e))||c();break;case"limebb-lime-query-filter-expression":customElements.get(o(e))||p();break;case"limebb-lime-query-filter-group":customElements.get(o(e))||b();break;case"limebb-lime-query-filter-not":customElements.get(o(e))||h();break;case"limebb-lime-query-order-by-editor":customElements.get(o(e))||f();break;case"limebb-lime-query-order-by-item":customElements.get(o(e))||y();break;case"limebb-lime-query-response-format-editor":customElements.get(o(e))||v();break;case"limebb-lime-query-response-format-item":customElements.get(o(e))||g();break;case"limebb-lime-query-value-input":customElements.get(o(e))||q();break;case"limebb-limetype-field":customElements.get(o(e))||x();break;case"limebb-property-selector":customElements.get(o(e))||k()}}))};export{j as LimebbLimeQueryBuilder,C 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{I 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 c(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 m=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=c(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=c(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:"4c041be9c674f687bb3d03c3b8c1377a1d2ec6ee",class:"response-format-builder"},this.label&&o("h1",{key:"ba7ea3457146bae1e97f252ac041aba21a02c27f",class:"builder-label"},this.label),this.helperText&&o("p",{key:"9c6d9c8a355f24fa89aadd7eb8f138997bc790c0",class:"builder-helper-text"},this.helperText),this.visualModeEnabled&&o("div",{key:"9b62a2ab35e98ac15b53af561a51262495689392",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=c(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()],m.prototype,"limetypes",void 0);const u=m,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),m);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
+ import{proxyCustomElement as e,HTMLElement as t,createEvent as i,h as o,transformTag as r}from"@stencil/core/internal/client";import{I 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 c(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 m=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=c(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=c(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:"d868f51ef5cc95effba94387d20647c49828624d",class:"response-format-builder"},this.label&&o("h1",{key:"8214fdd8202636c11b50e57f9958be91b19560bb",class:"builder-label"},this.label),this.helperText&&o("p",{key:"0c86057aaed7567dbb946794804d2c4afa126c75",class:"builder-helper-text"},this.helperText),this.visualModeEnabled&&o("div",{key:"288c5f91ef8a9c540ca474f3c94642dcb3e867c7",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=c(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()],m.prototype,"limetypes",void 0);const u=m,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),m);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 n,HTMLElement as r,createEvent as t,h as e,transformTag as u}from"@stencil/core/internal/client";import{n as i}from"./index.esm.js";import{t as f,c as o,a,i as c,g as s,b as l,d}from"./get.js";import{e as v,f as h,h as m,j as p,S as b,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?v(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 b;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(!v(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?d(r,(function(n){return w(n)?function(r){return l(r,1===n.length?n[0]:n)}:n})):[_];var e=-1;r=d(r,j($));var u=function(n,r){var t=-1,e=v(n)?Array(n.length):[];return nn(n,(function(n){e[++t]=r(n)})),e}(n,(function(n){return{criteria:d(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)?p(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:"a5dddeb9a8703c4c3f49d2aa8f6ca177765f9620",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
+ import{proxyCustomElement as n,HTMLElement as r,createEvent as t,h as e,transformTag as u}from"@stencil/core/internal/client";import{n 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 p,S as b,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 b;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)?p(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:"54aa5665273199c08b9f638c5cc485ee2ebf93a8",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,h as r,transformTag as o}from"@stencil/core/internal/client";const n=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.tooltipId="a"+crypto.randomUUID()}render(){const e=this.getLabel();return[r("span",{key:"b6e816b8efd22fdaff81f6669d11ab8efae9e05e",id:this.tooltipId},e),r("limel-tooltip",{key:"62294172fabc48ad688b14ae75fe43d142ac0cb7",elementId:this.tooltipId,label:e,helperLabel:this.helperLabel})]}getLabel(){const e=this.limetype.localname;return`${this.count} ${1===this.count?e.singular:e.plural}`}static get style(){return":host(limebb-mention-group-counter){order:2;margin-right:-0.5rem;box-sizing:border-box;transition:background-color 0.2s ease;min-width:fit-content;font-size:smaller;border-radius:9rem;cursor:help;padding:0.25rem 0.5rem;line-height:1;border:1px solid rgb(var(--contrast-500))}:host(limebb-mention-group-counter:hover){border-color:rgb(var(--contrast-100));background-color:rgb(var(--contrast-600))}"}},[1,"limebb-mention-group-counter",{count:[2],limetype:[16],helperLabel:[1,"helper-label"]}]),i=n,s=function(){"undefined"!=typeof customElements&&["limebb-mention-group-counter"].forEach((e=>{"limebb-mention-group-counter"===e&&(customElements.get(o(e))||customElements.define(o(e),n))}))};export{i as LimebbMentionGroupCounter,s as defineCustomElement}
1
+ import{proxyCustomElement as e,HTMLElement as t,h as r,transformTag as o}from"@stencil/core/internal/client";const n=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.tooltipId="a"+crypto.randomUUID()}render(){const e=this.getLabel();return[r("span",{key:"9d2a5cc82685527003c3543c6c7b6417c873a414",id:this.tooltipId},e),r("limel-tooltip",{key:"13529982e0de933c56a10b54ba1f098a9771ab92",elementId:this.tooltipId,label:e,helperLabel:this.helperLabel})]}getLabel(){const e=this.limetype.localname;return`${this.count} ${1===this.count?e.singular:e.plural}`}static get style(){return":host(limebb-mention-group-counter){order:2;margin-right:-0.5rem;box-sizing:border-box;transition:background-color 0.2s ease;min-width:fit-content;font-size:smaller;border-radius:9rem;cursor:help;padding:0.25rem 0.5rem;line-height:1;border:1px solid rgb(var(--contrast-500))}:host(limebb-mention-group-counter:hover){border-color:rgb(var(--contrast-100));background-color:rgb(var(--contrast-600))}"}},[1,"limebb-mention-group-counter",{count:[2],limetype:[16],helperLabel:[1,"helper-label"]}]),i=n,s=function(){"undefined"!=typeof customElements&&["limebb-mention-group-counter"].forEach((e=>{"limebb-mention-group-counter"===e&&(customElements.get(o(e))||customElements.define(o(e),n))}))};export{i as LimebbMentionGroupCounter,s as defineCustomElement}
@@ -1 +1 @@
1
- import{h as e,proxyCustomElement as t,HTMLElement as i,createEvent as n,Host as l,transformTag as r}from"@stencil/core/internal/client";import{M as o,n as s}from"./index.esm.js";import{r as a,b as u,A as d}from"./rule-editor-modes.js";import{c}from"./random-string.js";import{d as h}from"./rule-chip-popover.js";function p(e,t){return t?{type:"not",rule:e}:e}function b(e,t){return e.length===t.length&&e.every(((e,i)=>e===t[i]))}function f(e,t){return e.filter((e=>b(e.path,t)))}function m(e,t){let i=e;for(const e of t){if(void 0===i)return;i=g(i,e)}return i}function v(e,t,i){if(0===t.length)return i;const[n,...l]=t;if("not"===e.type&&"rule"===n)return Object.assign(Object.assign({},e),{rule:v(e.rule,l,i)});if(("all"===e.type||"any"===e.type)&&"rules"===n){if(0===l.length)return i;const[t,...n]=l;if("number"!=typeof t)return e;const r=[...e.rules];return r[t]=v(r[t],n,i),Object.assign(Object.assign({},e),{rules:r})}return e}function g(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 y={name:"question",color:"rgb(var(--color-glaucous-light))"};function x(e,t){return{"rule-node":!0,["rule-node--"+e]:!0,"rule-node--invalid":t.length>0}}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)))}function w(e,t){return e.reads.every((e=>t.has(e)))}function C(e){return"__chip__:"+e}function O(e,t){return[...e,"rules",t]}function j(e){return"ref"===e.type?{ref:e,isNegated:!1}:"not"===e.type&&"ref"===e.rule.type?{ref:e.rule,isNegated:!0}:null}const k=({groupNode:t,groupPath:i,chipChildren:n,ctx:l})=>{const r=new Map,o=n.map((e=>{const t=C(e.index);r.set(t,e);const i=function(e,t){var i;return null!==(i=e.find((e=>e.value===t)))&&void 0!==i?i:{value:t,text:t,icon:y}}(l.allPrimitiveOptions,e.ref.id);return Object.assign(Object.assign({},i),{text:e.isNegated?"¬ "+i.text:i.text,value:t})})),s=function(e){return t=>Promise.resolve(function(e,t){if(!t)return e;const i=t.toLocaleLowerCase().split(/\s+/);return e.filter((e=>i.every((t=>{var i,n;return e.text.toLocaleLowerCase().includes(t)||(null===(i=e.secondaryText)||void 0===i?void 0:i.toLocaleLowerCase().includes(t))||(null===(n=e.value)||void 0===n?void 0:n.toLocaleLowerCase().includes(t))}))))}(e,t))}(l.availablePrimitiveOptions),a=function(e,t,i){var n;const l=I(t,i);return null===l?null:null!==(n=e.find((e=>e.index===l)))&&void 0!==n?n:null}(n,i,l.openChipPath),u="all"===t.type?"&":"|";return e("limel-popover",{class:"rule-node__chips-popover",open:null!==a,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:u,readonly:l.readonly,disabled:l.disabled,onChange:M(t,i,r,l),onInteract:N(i,r,l)})),e("div",null,function(t,i,n){if(!t)return null;const l=O(i,t.index);return e("limebb-rule-chip-popover",{platform:n.platform,context:n.context,refNode:t.ref,isNegated:t.isNegated,metadata:n.metadataById.get(t.ref.id),readonly:n.readonly,disabled:n.disabled,isMutable:n.isMutable,focusOnOpen:n.focusOnOpen,onNegate:P(t,l,n),onUpdateArgs:R(t,l,n),onDeleteChip:A(l,n)})}(a,i,l)))},M=(e,t,i,n)=>l=>{l.stopPropagation();const r=Array.isArray(l.detail)?l.detail:[],o=I(t,n.openChipPath);if(null!==o){const e=C(o);r.every((t=>t.value!==e))&&n.onPopoverClose()}const s=r.flatMap((e=>{if("string"!=typeof e.value)return[];const t=i.get(e.value);return t?[t.isNegated?{type:"not",rule:t.ref}:t.ref]:[{type:"ref",id:e.value}]})),a=e.rules.filter((e=>null===j(e)));n.onReplaceNode(t,Object.assign(Object.assign({},e),{rules:[...s,...a]}))},N=(e,t,i)=>n=>{n.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}}(n.detail),r=l?t.get(l):void 0;r&&i.onChipInteract([...e,"rules",r.index])},P=(e,t,i)=>n=>{n.stopPropagation(),i.onReplaceNode(t,n.detail?{type:"not",rule:e.ref}:e.ref)},R=(e,t,i)=>n=>{n.stopPropagation();const l=e.isNegated?[...t,"rule"]:t;i.onUpdateArgs(l,n.detail)},A=(e,t)=>()=>{t.onDelete(e)};function I(e,t){if(!t||t.length<2)return null;if(!b(function(e){return e.slice(0,-2)}(t),e))return null;const i=t.at(-1);return"number"==typeof i?i:null}const T=({node:t,path:i,isNegated:n,ctx:l})=>{const r=n?[...i,"rule"]:i,o=n?[...f(l.issues,i),...f(l.issues,r)]:f(l.issues,i),s=[],a=[];for(const[e,i]of t.rules.entries()){const t=j(i);t?s.push(Object.assign(Object.assign({},t),{index:e})):a.push({child:i,index:e})}const u=function(e){return[{value:"all",text:e.translator.get("webclient.combinator.all")},{value:"any",text:e.translator.get("webclient.combinator.any")}]}(l),d=u.find((e=>e.value===t.type));return e("div",{class:x(t.type,o),key:V(i)},e("div",{class:"rule-node__header"},e("limel-select",{class:"rule-node__combinator-select",value:d,options:u,disabled:!l.isMutable,onChange:D(t,i,n,l)}),function(t,i,n,l){return l.isMutable?e("div",{class:"rule-node__header-actions"},e("limel-switch",{class:"rule-node__negate-switch",label:l.translator.get("webclient.negate"),value:n,onChange:F(t,i,l)}),e("limel-icon-button",{icon:"trash",label:l.translator.get("webclient.rule-editor.delete"),onClick:()=>l.onDelete(i)})):null}(t,i,n,l)),e("div",{class:"rule-node__body"},e(U,{issues:o}),e(k,{groupNode:t,groupPath:r,chipChildren:s,ctx:l}),function(t,i,n){return 0===t.length?null:e("div",{class:"rule-node__children"},t.map((t=>e(L,{node:t.child,path:[...i,"rules",t.index],ctx:n}))))}(a,r,l),function(t,i,n,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:E(t,i,n,l)})):null}(t,i,n,l)))};function V(e){return 0===e.length?"root":e.join("/")}function z(e,t,i,n){n.onReplaceNode(t,p(e,i))}const D=(e,t,i,n)=>l=>{l.stopPropagation();const r=l.detail.value;r!==e.type&&z(Object.assign(Object.assign({},e),{type:r}),t,i,n)},E=(e,t,i,n)=>()=>{z(function(e){return Object.assign(Object.assign({},e),{rules:[...e.rules,{type:"all",rules:[]}]})}(e),t,i,n)},F=(e,t,i)=>n=>{n.stopPropagation(),i.onReplaceNode(t,p(e,n.detail))},L=t=>{const{node:i,path:n,ctx:l}=t,r=q(i);return r?e(T,{node:r.node,path:n,isNegated:r.isNegated,ctx:l}):null},S=e=>"not"===e.type&&("all"===e.rule.type||"any"===e.rule.type);function q(e){if("all"===e.type||"any"===e.type)return{node:e,isNegated:!1};if(S(e))return{node:e.rule,isNegated:!0};if("not"===e.type){const t=q(e.rule);if(t)return{node:t.node,isNegated:!t.isNegated}}return null}const U=({issues:t})=>0===t.length?null:t.map((t=>e("div",{class:"rule-node__issue"},t.message))),H={never:"webclient.never",always:"webclient.always",conditional:"webclient.conditionally"},B=t=>{const{modes:i,selected:n,disabled:l,translator:r,onModeChange:o}=t;return e("limel-button-group",{value:i.map((e=>({id:e,title:r.get(H[e]),selected:e===n}))),disabled:l,onChange:e=>{e.stopPropagation(),o(e.detail.id)}})};const W=t(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.change=n(this,"change",7),this.issues=[],this.openChipPath=null,this.modeOverride=null,this.focusOnOpen=!1,this.metadataById=new Map,this.allPrimitiveOptions=[],this.availablePrimitiveOptions=[],this.reachableSlots=new Set,this.normalizedCache=null,this.hasLoaded=!1,this.labelId=c(),this.helperTextId=c(),this.handleModeChange=e=>{var t;"conditional"===this.currentMode&&(this.stashedTree=this.value),this.modeOverride=e,this.change.emit(null!==(t=a(e))&&void 0!==t?t:this.stashedTree)},this.handleDelete=e=>{this.openChipPath=null,this.focusOnOpen=!1,this.emitIfChanged(function(e,t){if(0===t.length)return{type:"all",rules:[]};const i=t.slice(0,-1),n=t.at(-1),l=m(e,i);if(void 0===l)return e;if(("all"===l.type||"any"===l.type)&&"number"==typeof n){const t=[...l.rules];return t.splice(n,1),v(e,i,Object.assign(Object.assign({},l),{rules:t}))}return"not"===l.type&&"rule"===n?v(e,i,{type:"all",rules:[]}):e}(this.normalizedValue,e))},this.handleUpdateArgs=(e,t)=>{this.emitIfChanged(function(e,t,i){const n=m(e,t);return void 0===n||"ref"!==n.type?e:v(e,t,Object.assign(Object.assign({},n),{args:i}))}(this.normalizedValue,e,t))},this.handleReplaceNode=(e,t)=>{const i=this.autoOpenPathFor(e,t);this.focusOnOpen=null!==i,null!==i&&(this.openChipPath=i),this.emitIfChanged(function(e,t,i){return v(e,t,i)}(this.normalizedValue,e,t))},this.handleChipInteract=e=>{this.openChipPath=e,this.focusOnOpen=!1},this.handlePopoverClose=()=>{this.openChipPath=null,this.focusOnOpen=!1}}componentWillLoad(){this.rebuildFromRegistries()}rebuildFromRegistries(){this.computeReachableSlots(),this.indexMetadata(),this.rebuildAvailableOptions(),this.runValidation()}connectedCallback(){this.hasLoaded&&(this.computeReachableSlots(),this.rebuildAvailableOptions(),this.runValidation())}componentDidLoad(){this.hasLoaded=!0,this.emitNormalization()}onValueChange(){this.clearReachedModeOverride(),this.emitNormalization()||this.runValidation()}onAvailableContextsChange(){this.rebuildFromRegistries()}render(){return e(l,{key:"4b342b249b781177e52a63b864e85ba3d17f7239"},this.renderHelp(),e("limel-notched-outline",{key:"e6ffe3d2dc9226e99be1f56bdd3274528b4d917f",label:this.label,labelId:this.labelId,required:this.required,readonly:this.readonly,disabled:this.disabled,invalid:this.invalid,hasValue:!0,hasFloatingLabel:!0},e("div",{key:"790a6c064d07647ab3bbe5687af7a763f49e1982",slot:"content",class:{"rule-editor":!0,"rule-editor--disabled":this.disabled},role:"group","aria-labelledby":this.label?this.labelId:void 0,"aria-describedby":this.helperText?this.helperTextId:void 0},this.renderModes(),this.renderTree())),this.renderHelperLine())}renderModes(){const t=this.modes,i=this.currentMode;return t&&i?e(B,{modes:t,selected:i,disabled:this.disabled||this.readonly,translator:this.translator,onModeChange:this.handleModeChange}):null}renderTree(){const t=this.currentMode;return t&&"conditional"!==t?null:e(L,{node:this.normalizedValue,path:[],ctx:this.createRenderContext()})}renderHelperLine(){return this.helperText?e("limel-helper-line",{helperText:this.helperText,helperTextId:this.helperTextId,invalid:this.invalid}):null}renderHelp(){return this.help?e("limel-help",{value:this.help}):null}createRenderContext(){return{issues:this.issues,metadataById:this.metadataById,allPrimitiveOptions:this.allPrimitiveOptions,availablePrimitiveOptions:this.availablePrimitiveOptions,isMutable:!this.readonly&&!this.disabled,readonly:this.readonly,disabled:this.disabled,platform:this.platform,context:this.effectiveContext,translator:this.translator,openChipPath:this.openChipPath,focusOnOpen:this.focusOnOpen,onDelete:this.handleDelete,onUpdateArgs:this.handleUpdateArgs,onReplaceNode:this.handleReplaceNode,onChipInteract:this.handleChipInteract,onPopoverClose:this.handlePopoverClose}}get currentMode(){var e,t;const i=this.modes;if(null==i?void 0:i.length)return null!==(t=null!==(e=this.modeOverride)&&void 0!==e?e:u(this.value))&&void 0!==t?t:i[0]}clearReachedModeOverride(){const e=u(this.value);void 0!==e&&e!==this.modeOverride&&(this.modeOverride=null)}autoOpenPathFor(e,t){var i;if("all"!==t.type&&"any"!==t.type)return null;const n=m(this.normalizedValue,e);if(void 0===n||"all"!==n.type&&"any"!==n.type)return null;const l=new Set(n.rules.map((e=>{var t;return null===(t=j(e))||void 0===t?void 0:t.ref})).filter((e=>void 0!==e))),r=t.rules.map(((e,t)=>{var i;const n=null===(i=j(e))||void 0===i?void 0:i.ref;return n&&!l.has(n)?{ref:n,index:t}:null})).filter((e=>null!==e));if(1!==r.length)return null;const[{ref:o,index:s}]=r;return(null===(i=this.metadataById.get(o.id))||void 0===i?void 0:i.configComponent)?O(e,s):null}indexMetadata(){var e,t,i;const n=null!==(i=null===(t=(e=this.ruleRegistry).listMetadata)||void 0===t?void 0:t.call(e))&&void 0!==i?i:[];this.metadataById=new Map(n.map((e=>[e.id,e]))),this.allPrimitiveOptions=_(this.metadataById,this.translator)}rebuildAvailableOptions(){this.availablePrimitiveOptions=_(this.availablePrimitiveMetadata(),this.translator)}availablePrimitiveMetadata(){const e=new Map;for(const[t,i]of this.metadataById)t!==d&&w(i,this.reachableSlots)&&e.set(t,i);return e}computeReachableSlots(){var e;const t=this.contextRegistry,i=t.list().map((e=>e.id)).filter((e=>void 0!==t.get(e,this.host)));this.reachableSlots=new Set([...i,...null!==(e=this.availableContexts)&&void 0!==e?e:[]])}runValidation(){if(!this.value)return void(this.issues=[]);const e=this.ruleRegistry.validate(this.normalizedValue,[...this.reachableSlots]);this.issues=e.ok?[]:e.issues}emitIfChanged(e){e!==this.normalizedValue&&(this.modeOverride="conditional",this.change.emit(function(e){return"all"!==e.type&&"any"!==e.type?e:0===e.rules.length?void 0:e}(e)))}get normalizedValue(){const e=this.currentMode;if(null!==this.normalizedCache&&this.normalizedCache.source===this.value&&this.normalizedCache.mode===e)return this.normalizedCache.normalized;const t=function(e,t){return e?"always"===t||"never"===t||q(e)?e:{type:"all",rules:[e]}:{type:"all",rules:[]}}(this.value,e);return this.normalizedCache={source:this.value,mode:e,normalized:t},t}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(s.RuleRegistry)}get translator(){return this.platform.get(s.Translate)}get contextRegistry(){return this.platform.get(s.ContextRegistry)}get effectiveContext(){var e,t;return(null===(e=this.context)||void 0===e?void 0:e.limetype)?this.context:(null===(t=this.resolvedContext)||void 0===t?void 0:t.limetype)?this.resolvedContext:G}get host(){return this}static get watchers(){return{value:[{onValueChange:0}],availableContexts:[{onAvailableContextsChange:0}]}}static get style(){return'@charset "UTF-8";:host{display:block;position:relative}.limel-notched-outline{--limel-notched-outline-background-color:transparent;padding:0.5rem 0 0 0}limel-notched-outline:not([invalid]:not([invalid=false])) .limel-notched-outline{--limel-notched-outline-border-color:transparent}.rule-editor--disabled{opacity:0.6;pointer-events:none}.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;--popover-surface-width:min(calc(100vw - 4rem), 50rem)}.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}:host(limebb-rule-editor:focus),:host(limebb-rule-editor:focus-visible),:host(limebb-rule-editor:focus-within){--limel-h-l-grid-template-rows-transition-speed:0.46s;--limel-h-l-grid-template-rows:1fr}:host(limebb-rule-editor){--limel-h-l-grid-template-rows-transition-speed:0.3s;--limel-h-l-grid-template-rows:0fr}:host(limebb-rule-editor:focus) limel-helper-line,:host(limebb-rule-editor:focus-visible) limel-helper-line,:host(limebb-rule-editor:focus-within) limel-helper-line,:host(limebb-rule-editor:hover) limel-helper-line{will-change:grid-template-rows}limel-help{position:absolute;top:calc(var(--form-row-gap, 1rem) * -0.5);left:calc(var(--form-column-gap, 1rem) * -0.5);z-index:1}'}},[1,"limebb-rule-editor",{platform:[16],context:[16],value:[16],availableContexts:[16],modes:[16],required:[516],readonly:[516],disabled:[516],invalid:[516],label:[513],helperText:[1,"helper-text"],help:[1],resolvedContext:[32],issues:[32],openChipPath:[32],modeOverride:[32],availablePrimitiveOptions:[32]},void 0,{value:[{onValueChange:0}],availableContexts:[{onAvailableContextsChange:0}]}]);!function(e,t,i,n){var l,r=arguments.length,o=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(l=e[s])&&(o=(r<3?l(o):r>3?l(t,i,o):l(t,i))||o);r>3&&o&&Object.defineProperty(t,i,o)}([o("context")],W.prototype,"resolvedContext",void 0);const G=Object.freeze({limetype:null,id:null}),J=W,K=function(){"undefined"!=typeof customElements&&["limebb-rule-editor","limebb-rule-chip-popover"].forEach((e=>{switch(e){case"limebb-rule-editor":customElements.get(r(e))||customElements.define(r(e),W);break;case"limebb-rule-chip-popover":customElements.get(r(e))||h()}}))};export{J as LimebbRuleEditor,K as defineCustomElement}
1
+ import{h as e,proxyCustomElement as t,HTMLElement as i,createEvent as n,Host as l,transformTag as r}from"@stencil/core/internal/client";import{M as o,n as s}from"./index.esm.js";import{r as a,b as u,A as d}from"./rule-editor-modes.js";import{c}from"./random-string.js";import{d as h}from"./rule-chip-popover.js";function p(e,t){return t?{type:"not",rule:e}:e}function b(e,t){return e.length===t.length&&e.every(((e,i)=>e===t[i]))}function f(e,t){return e.filter((e=>b(e.path,t)))}function m(e,t){let i=e;for(const e of t){if(void 0===i)return;i=g(i,e)}return i}function v(e,t,i){if(0===t.length)return i;const[n,...l]=t;if("not"===e.type&&"rule"===n)return Object.assign(Object.assign({},e),{rule:v(e.rule,l,i)});if(("all"===e.type||"any"===e.type)&&"rules"===n){if(0===l.length)return i;const[t,...n]=l;if("number"!=typeof t)return e;const r=[...e.rules];return r[t]=v(r[t],n,i),Object.assign(Object.assign({},e),{rules:r})}return e}function g(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 y={name:"question",color:"rgb(var(--color-glaucous-light))"};function x(e,t){return{"rule-node":!0,["rule-node--"+e]:!0,"rule-node--invalid":t.length>0}}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)))}function w(e,t){return e.reads.every((e=>t.has(e)))}function C(e){return"__chip__:"+e}function O(e,t){return[...e,"rules",t]}function j(e){return"ref"===e.type?{ref:e,isNegated:!1}:"not"===e.type&&"ref"===e.rule.type?{ref:e.rule,isNegated:!0}:null}const k=({groupNode:t,groupPath:i,chipChildren:n,ctx:l})=>{const r=new Map,o=n.map((e=>{const t=C(e.index);r.set(t,e);const i=function(e,t){var i;return null!==(i=e.find((e=>e.value===t)))&&void 0!==i?i:{value:t,text:t,icon:y}}(l.allPrimitiveOptions,e.ref.id);return Object.assign(Object.assign({},i),{text:e.isNegated?"¬ "+i.text:i.text,value:t})})),s=function(e){return t=>Promise.resolve(function(e,t){if(!t)return e;const i=t.toLocaleLowerCase().split(/\s+/);return e.filter((e=>i.every((t=>{var i,n;return e.text.toLocaleLowerCase().includes(t)||(null===(i=e.secondaryText)||void 0===i?void 0:i.toLocaleLowerCase().includes(t))||(null===(n=e.value)||void 0===n?void 0:n.toLocaleLowerCase().includes(t))}))))}(e,t))}(l.availablePrimitiveOptions),a=function(e,t,i){var n;const l=I(t,i);return null===l?null:null!==(n=e.find((e=>e.index===l)))&&void 0!==n?n:null}(n,i,l.openChipPath),u="all"===t.type?"&":"|";return e("limel-popover",{class:"rule-node__chips-popover",open:null!==a,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:u,readonly:l.readonly,disabled:l.disabled,onChange:M(t,i,r,l),onInteract:N(i,r,l)})),e("div",null,function(t,i,n){if(!t)return null;const l=O(i,t.index);return e("limebb-rule-chip-popover",{platform:n.platform,context:n.context,refNode:t.ref,isNegated:t.isNegated,metadata:n.metadataById.get(t.ref.id),readonly:n.readonly,disabled:n.disabled,isMutable:n.isMutable,focusOnOpen:n.focusOnOpen,onNegate:P(t,l,n),onUpdateArgs:R(t,l,n),onDeleteChip:A(l,n)})}(a,i,l)))},M=(e,t,i,n)=>l=>{l.stopPropagation();const r=Array.isArray(l.detail)?l.detail:[],o=I(t,n.openChipPath);if(null!==o){const e=C(o);r.every((t=>t.value!==e))&&n.onPopoverClose()}const s=r.flatMap((e=>{if("string"!=typeof e.value)return[];const t=i.get(e.value);return t?[t.isNegated?{type:"not",rule:t.ref}:t.ref]:[{type:"ref",id:e.value}]})),a=e.rules.filter((e=>null===j(e)));n.onReplaceNode(t,Object.assign(Object.assign({},e),{rules:[...s,...a]}))},N=(e,t,i)=>n=>{n.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}}(n.detail),r=l?t.get(l):void 0;r&&i.onChipInteract([...e,"rules",r.index])},P=(e,t,i)=>n=>{n.stopPropagation(),i.onReplaceNode(t,n.detail?{type:"not",rule:e.ref}:e.ref)},R=(e,t,i)=>n=>{n.stopPropagation();const l=e.isNegated?[...t,"rule"]:t;i.onUpdateArgs(l,n.detail)},A=(e,t)=>()=>{t.onDelete(e)};function I(e,t){if(!t||t.length<2)return null;if(!b(function(e){return e.slice(0,-2)}(t),e))return null;const i=t.at(-1);return"number"==typeof i?i:null}const T=({node:t,path:i,isNegated:n,ctx:l})=>{const r=n?[...i,"rule"]:i,o=n?[...f(l.issues,i),...f(l.issues,r)]:f(l.issues,i),s=[],a=[];for(const[e,i]of t.rules.entries()){const t=j(i);t?s.push(Object.assign(Object.assign({},t),{index:e})):a.push({child:i,index:e})}const u=function(e){return[{value:"all",text:e.translator.get("webclient.combinator.all")},{value:"any",text:e.translator.get("webclient.combinator.any")}]}(l),d=u.find((e=>e.value===t.type));return e("div",{class:x(t.type,o),key:V(i)},e("div",{class:"rule-node__header"},e("limel-select",{class:"rule-node__combinator-select",value:d,options:u,disabled:!l.isMutable,onChange:D(t,i,n,l)}),function(t,i,n,l){return l.isMutable?e("div",{class:"rule-node__header-actions"},e("limel-switch",{class:"rule-node__negate-switch",label:l.translator.get("webclient.negate"),value:n,onChange:F(t,i,l)}),e("limel-icon-button",{icon:"trash",label:l.translator.get("webclient.rule-editor.delete"),onClick:()=>l.onDelete(i)})):null}(t,i,n,l)),e("div",{class:"rule-node__body"},e(U,{issues:o}),e(k,{groupNode:t,groupPath:r,chipChildren:s,ctx:l}),function(t,i,n){return 0===t.length?null:e("div",{class:"rule-node__children"},t.map((t=>e(L,{node:t.child,path:[...i,"rules",t.index],ctx:n}))))}(a,r,l),function(t,i,n,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:E(t,i,n,l)})):null}(t,i,n,l)))};function V(e){return 0===e.length?"root":e.join("/")}function z(e,t,i,n){n.onReplaceNode(t,p(e,i))}const D=(e,t,i,n)=>l=>{l.stopPropagation();const r=l.detail.value;r!==e.type&&z(Object.assign(Object.assign({},e),{type:r}),t,i,n)},E=(e,t,i,n)=>()=>{z(function(e){return Object.assign(Object.assign({},e),{rules:[...e.rules,{type:"all",rules:[]}]})}(e),t,i,n)},F=(e,t,i)=>n=>{n.stopPropagation(),i.onReplaceNode(t,p(e,n.detail))},L=t=>{const{node:i,path:n,ctx:l}=t,r=q(i);return r?e(T,{node:r.node,path:n,isNegated:r.isNegated,ctx:l}):null},S=e=>"not"===e.type&&("all"===e.rule.type||"any"===e.rule.type);function q(e){if("all"===e.type||"any"===e.type)return{node:e,isNegated:!1};if(S(e))return{node:e.rule,isNegated:!0};if("not"===e.type){const t=q(e.rule);if(t)return{node:t.node,isNegated:!t.isNegated}}return null}const U=({issues:t})=>0===t.length?null:t.map((t=>e("div",{class:"rule-node__issue"},t.message))),H={never:"webclient.never",always:"webclient.always",conditional:"webclient.conditionally"},B=t=>{const{modes:i,selected:n,disabled:l,translator:r,onModeChange:o}=t;return e("limel-button-group",{value:i.map((e=>({id:e,title:r.get(H[e]),selected:e===n}))),disabled:l,onChange:e=>{e.stopPropagation(),o(e.detail.id)}})};const W=t(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.change=n(this,"change",7),this.issues=[],this.openChipPath=null,this.modeOverride=null,this.focusOnOpen=!1,this.metadataById=new Map,this.allPrimitiveOptions=[],this.availablePrimitiveOptions=[],this.reachableSlots=new Set,this.normalizedCache=null,this.hasLoaded=!1,this.labelId=c(),this.helperTextId=c(),this.handleModeChange=e=>{var t;"conditional"===this.currentMode&&(this.stashedTree=this.value),this.modeOverride=e,this.change.emit(null!==(t=a(e))&&void 0!==t?t:this.stashedTree)},this.handleDelete=e=>{this.openChipPath=null,this.focusOnOpen=!1,this.emitIfChanged(function(e,t){if(0===t.length)return{type:"all",rules:[]};const i=t.slice(0,-1),n=t.at(-1),l=m(e,i);if(void 0===l)return e;if(("all"===l.type||"any"===l.type)&&"number"==typeof n){const t=[...l.rules];return t.splice(n,1),v(e,i,Object.assign(Object.assign({},l),{rules:t}))}return"not"===l.type&&"rule"===n?v(e,i,{type:"all",rules:[]}):e}(this.normalizedValue,e))},this.handleUpdateArgs=(e,t)=>{this.emitIfChanged(function(e,t,i){const n=m(e,t);return void 0===n||"ref"!==n.type?e:v(e,t,Object.assign(Object.assign({},n),{args:i}))}(this.normalizedValue,e,t))},this.handleReplaceNode=(e,t)=>{const i=this.autoOpenPathFor(e,t);this.focusOnOpen=null!==i,null!==i&&(this.openChipPath=i),this.emitIfChanged(function(e,t,i){return v(e,t,i)}(this.normalizedValue,e,t))},this.handleChipInteract=e=>{this.openChipPath=e,this.focusOnOpen=!1},this.handlePopoverClose=()=>{this.openChipPath=null,this.focusOnOpen=!1}}componentWillLoad(){this.rebuildFromRegistries()}rebuildFromRegistries(){this.computeReachableSlots(),this.indexMetadata(),this.rebuildAvailableOptions(),this.runValidation()}connectedCallback(){this.hasLoaded&&(this.computeReachableSlots(),this.rebuildAvailableOptions(),this.runValidation())}componentDidLoad(){this.hasLoaded=!0,this.emitNormalization()}onValueChange(){this.clearReachedModeOverride(),this.emitNormalization()||this.runValidation()}onAvailableContextsChange(){this.rebuildFromRegistries()}render(){return e(l,{key:"98380987c6687ce58cca822ea2fd2f106787897b"},this.renderHelp(),e("limel-notched-outline",{key:"bbf2d6da192524c4cf8e2e616ca2dab6206a43a6",label:this.label,labelId:this.labelId,required:this.required,readonly:this.readonly,disabled:this.disabled,invalid:this.invalid,hasValue:!0,hasFloatingLabel:!0},e("div",{key:"9e7043bae1b8f60f9ead7b0ed1874dae32944e9e",slot:"content",class:{"rule-editor":!0,"rule-editor--disabled":this.disabled},role:"group","aria-labelledby":this.label?this.labelId:void 0,"aria-describedby":this.helperText?this.helperTextId:void 0},this.renderModes(),this.renderTree())),this.renderHelperLine())}renderModes(){const t=this.modes,i=this.currentMode;return t&&i?e(B,{modes:t,selected:i,disabled:this.disabled||this.readonly,translator:this.translator,onModeChange:this.handleModeChange}):null}renderTree(){const t=this.currentMode;return t&&"conditional"!==t?null:e(L,{node:this.normalizedValue,path:[],ctx:this.createRenderContext()})}renderHelperLine(){return this.helperText?e("limel-helper-line",{helperText:this.helperText,helperTextId:this.helperTextId,invalid:this.invalid}):null}renderHelp(){return this.help?e("limel-help",{value:this.help}):null}createRenderContext(){return{issues:this.issues,metadataById:this.metadataById,allPrimitiveOptions:this.allPrimitiveOptions,availablePrimitiveOptions:this.availablePrimitiveOptions,isMutable:!this.readonly&&!this.disabled,readonly:this.readonly,disabled:this.disabled,platform:this.platform,context:this.effectiveContext,translator:this.translator,openChipPath:this.openChipPath,focusOnOpen:this.focusOnOpen,onDelete:this.handleDelete,onUpdateArgs:this.handleUpdateArgs,onReplaceNode:this.handleReplaceNode,onChipInteract:this.handleChipInteract,onPopoverClose:this.handlePopoverClose}}get currentMode(){var e,t;const i=this.modes;if(null==i?void 0:i.length)return null!==(t=null!==(e=this.modeOverride)&&void 0!==e?e:u(this.value))&&void 0!==t?t:i[0]}clearReachedModeOverride(){const e=u(this.value);void 0!==e&&e!==this.modeOverride&&(this.modeOverride=null)}autoOpenPathFor(e,t){var i;if("all"!==t.type&&"any"!==t.type)return null;const n=m(this.normalizedValue,e);if(void 0===n||"all"!==n.type&&"any"!==n.type)return null;const l=new Set(n.rules.map((e=>{var t;return null===(t=j(e))||void 0===t?void 0:t.ref})).filter((e=>void 0!==e))),r=t.rules.map(((e,t)=>{var i;const n=null===(i=j(e))||void 0===i?void 0:i.ref;return n&&!l.has(n)?{ref:n,index:t}:null})).filter((e=>null!==e));if(1!==r.length)return null;const[{ref:o,index:s}]=r;return(null===(i=this.metadataById.get(o.id))||void 0===i?void 0:i.configComponent)?O(e,s):null}indexMetadata(){var e,t,i;const n=null!==(i=null===(t=(e=this.ruleRegistry).listMetadata)||void 0===t?void 0:t.call(e))&&void 0!==i?i:[];this.metadataById=new Map(n.map((e=>[e.id,e]))),this.allPrimitiveOptions=_(this.metadataById,this.translator)}rebuildAvailableOptions(){this.availablePrimitiveOptions=_(this.availablePrimitiveMetadata(),this.translator)}availablePrimitiveMetadata(){const e=new Map;for(const[t,i]of this.metadataById)t!==d&&w(i,this.reachableSlots)&&e.set(t,i);return e}computeReachableSlots(){var e;const t=this.contextRegistry,i=t.list().map((e=>e.id)).filter((e=>void 0!==t.get(e,this.host)));this.reachableSlots=new Set([...i,...null!==(e=this.availableContexts)&&void 0!==e?e:[]])}runValidation(){if(!this.value)return void(this.issues=[]);const e=this.ruleRegistry.validate(this.normalizedValue,[...this.reachableSlots]);this.issues=e.ok?[]:e.issues}emitIfChanged(e){e!==this.normalizedValue&&(this.modeOverride="conditional",this.change.emit(function(e){return"all"!==e.type&&"any"!==e.type?e:0===e.rules.length?void 0:e}(e)))}get normalizedValue(){const e=this.currentMode;if(null!==this.normalizedCache&&this.normalizedCache.source===this.value&&this.normalizedCache.mode===e)return this.normalizedCache.normalized;const t=function(e,t){return e?"always"===t||"never"===t||q(e)?e:{type:"all",rules:[e]}:{type:"all",rules:[]}}(this.value,e);return this.normalizedCache={source:this.value,mode:e,normalized:t},t}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(s.RuleRegistry)}get translator(){return this.platform.get(s.Translate)}get contextRegistry(){return this.platform.get(s.ContextRegistry)}get effectiveContext(){var e,t;return(null===(e=this.context)||void 0===e?void 0:e.limetype)?this.context:(null===(t=this.resolvedContext)||void 0===t?void 0:t.limetype)?this.resolvedContext:G}get host(){return this}static get watchers(){return{value:[{onValueChange:0}],availableContexts:[{onAvailableContextsChange:0}]}}static get style(){return'@charset "UTF-8";:host{display:block;position:relative}.limel-notched-outline{--limel-notched-outline-background-color:transparent;padding:0.5rem 0 0 0}limel-notched-outline:not([invalid]:not([invalid=false])) .limel-notched-outline{--limel-notched-outline-border-color:transparent}.rule-editor--disabled{opacity:0.6;pointer-events:none}.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;--popover-surface-width:min(calc(100vw - 4rem), 50rem)}.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}:host(limebb-rule-editor:focus),:host(limebb-rule-editor:focus-visible),:host(limebb-rule-editor:focus-within){--limel-h-l-grid-template-rows-transition-speed:0.46s;--limel-h-l-grid-template-rows:1fr}:host(limebb-rule-editor){--limel-h-l-grid-template-rows-transition-speed:0.3s;--limel-h-l-grid-template-rows:0fr}:host(limebb-rule-editor:focus) limel-helper-line,:host(limebb-rule-editor:focus-visible) limel-helper-line,:host(limebb-rule-editor:focus-within) limel-helper-line,:host(limebb-rule-editor:hover) limel-helper-line{will-change:grid-template-rows}limel-help{position:absolute;top:calc(var(--form-row-gap, 1rem) * -0.5);left:calc(var(--form-column-gap, 1rem) * -0.5);z-index:1}'}},[1,"limebb-rule-editor",{platform:[16],context:[16],value:[16],availableContexts:[16],modes:[16],required:[516],readonly:[516],disabled:[516],invalid:[516],label:[513],helperText:[1,"helper-text"],help:[1],resolvedContext:[32],issues:[32],openChipPath:[32],modeOverride:[32],availablePrimitiveOptions:[32]},void 0,{value:[{onValueChange:0}],availableContexts:[{onAvailableContextsChange:0}]}]);!function(e,t,i,n){var l,r=arguments.length,o=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(l=e[s])&&(o=(r<3?l(o):r>3?l(t,i,o):l(t,i))||o);r>3&&o&&Object.defineProperty(t,i,o)}([o("context")],W.prototype,"resolvedContext",void 0);const G=Object.freeze({limetype:null,id:null}),J=W,K=function(){"undefined"!=typeof customElements&&["limebb-rule-editor","limebb-rule-chip-popover"].forEach((e=>{switch(e){case"limebb-rule-editor":customElements.get(r(e))||customElements.define(r(e),W);break;case"limebb-rule-chip-popover":customElements.get(r(e))||h()}}))};export{J as LimebbRuleEditor,K as defineCustomElement}
@@ -1 +1 @@
1
- import{proxyCustomElement as e,HTMLElement as t,h as s,Host as i,transformTag as o}from"@stencil/core/internal/client";import{n}from"./index.esm.js";const l=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.shouldRender=!1}componentWillLoad(){this.evaluate()}disconnectedCallback(){var e;null===(e=this.stopSubscription)||void 0===e||e.call(this)}onRuleChange(){this.evaluate()}onScopeChange(){this.evaluate()}render(){return s(i,{key:"ce41c51b7f8b049d7d89374ef0c452b2e961aa23",hidden:!this.shouldRender},s("slot",{key:"ad04db83bceca78bf7bb2eb7b7b2dae018025319"}))}get ruleRegistry(){return this.platform.get(n.RuleRegistry)}evaluate(){var e;if(null===(e=this.stopSubscription)||void 0===e||e.call(this),this.stopSubscription=void 0,this.rule)try{const e=this.ruleRegistry.compile(this.rule);if(this.scope)return void(this.shouldRender=e.evaluate(this.scope));this.stopSubscription=this.ruleRegistry.subscribe(e,{host:this.host},(e=>{this.shouldRender=e}))}catch(e){console.warn("rule-gate failed to compile rule; hiding slot",{rule:this.rule,error:e}),this.shouldRender=!1}else this.shouldRender=!0}get host(){return this}static get watchers(){return{rule:[{onRuleChange:0}],scope:[{onScopeChange:0}]}}static get style(){return":host{display:block}:host([hidden]){display:none}"}},[257,"limebb-rule-gate",{platform:[16],rule:[16],scope:[16],shouldRender:[32]},void 0,{rule:[{onRuleChange:0}],scope:[{onScopeChange:0}]}]),r=l,h=function(){"undefined"!=typeof customElements&&["limebb-rule-gate"].forEach((e=>{"limebb-rule-gate"===e&&(customElements.get(o(e))||customElements.define(o(e),l))}))};export{r as LimebbRuleGate,h as defineCustomElement}
1
+ import{proxyCustomElement as e,HTMLElement as t,h as s,Host as i,transformTag as o}from"@stencil/core/internal/client";import{n}from"./index.esm.js";const l=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.shouldRender=!1}componentWillLoad(){this.evaluate()}disconnectedCallback(){var e;null===(e=this.stopSubscription)||void 0===e||e.call(this)}onRuleChange(){this.evaluate()}onScopeChange(){this.evaluate()}render(){return s(i,{key:"36ac8be5125b3a169160a699388f69641d8b4c1c",hidden:!this.shouldRender},s("slot",{key:"3b14a3726279f295e5983adab2b2f5f7b5c103ed"}))}get ruleRegistry(){return this.platform.get(n.RuleRegistry)}evaluate(){var e;if(null===(e=this.stopSubscription)||void 0===e||e.call(this),this.stopSubscription=void 0,this.rule)try{const e=this.ruleRegistry.compile(this.rule);if(this.scope)return void(this.shouldRender=e.evaluate(this.scope));this.stopSubscription=this.ruleRegistry.subscribe(e,{host:this.host},(e=>{this.shouldRender=e}))}catch(e){console.warn("rule-gate failed to compile rule; hiding slot",{rule:this.rule,error:e}),this.shouldRender=!1}else this.shouldRender=!0}get host(){return this}static get watchers(){return{rule:[{onRuleChange:0}],scope:[{onScopeChange:0}]}}static get style(){return":host{display:block}:host([hidden]){display:none}"}},[257,"limebb-rule-gate",{platform:[16],rule:[16],scope:[16],shouldRender:[32]},void 0,{rule:[{onRuleChange:0}],scope:[{onScopeChange:0}]}]),r=l,h=function(){"undefined"!=typeof customElements&&["limebb-rule-gate"].forEach((e=>{"limebb-rule-gate"===e&&(customElements.get(o(e))||customElements.define(o(e),l))}))};export{r 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,s as o,c as a,I as h,_ as c}from"./index.esm.js";import{A as u,E as l,b as d,a as f,T as m}from"./keycodes.js";import{o as p,U as b,c as v,a as g,d as y,n as j,i as w,S as x,g as k}from"./_Uint8Array.js";import{d as O}from"./_defineProperty.js";import{c as S,e as E,S as I,i as T,a as C,r as A}from"./_MapCache.js";import{c as P}from"./random-string.js";import{h as M,b as N,c as F}from"./limetype.js";import{i as _}from"./non-null.js";import{g as R}from"./file-contents-url.js";import{d as U}from"./empty-state.js";import{d as D}from"./text-editor-picker.js";import{i as L}from"./isSymbol.js";var z=/\s/,Q=/^\s+/;var $=/^[-+]0x[0-9a-f]+$/i,G=/^0b[01]+$/i,q=/^0o[0-7]+$/i,W=parseInt;function B(t){if("number"==typeof t)return t;if(L(t))return NaN;if(S(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=S(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--&&z.test(t.charAt(e)););return e}(t)+1).replace(Q,""):t}(t);var i=G.test(t);return i||q.test(t)?W(t.slice(2),i?2:8):$.test(t)?NaN:+t}var H=Object.create,K=function(){function t(){}return function(e){if(!S(e))return{};if(H)return H(e);t.prototype=e;var i=new t;return t.prototype=void 0,i}}(),V=Object.prototype.hasOwnProperty;var J=p(Object.getPrototypeOf,Object);"object"==typeof exports&&exports&&!exports.nodeType&&exports&&"object"==typeof module&&module&&!module.nodeType&&module;var X=Object.prototype.hasOwnProperty;function Y(t){var e=new t.constructor(t.byteLength);return new b(e).set(new b(t)),e}var Z=/\w*$/,tt=I?I.prototype:void 0,et=tt?tt.valueOf:void 0;var it=j&&j.isMap,st=it?y(it):function(t){return T(t)&&"[object Map]"==g(t)},rt=j&&j.isSet,nt=rt?y(rt):function(t){return T(t)&&"[object Set]"==g(t)},ot="[object Arguments]",at="[object Function]",ht="[object Object]",ct={};function ut(t,e,i,s,r,n){var o;if(void 0!==o)return o;if(!S(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]&&X.call(t,"index")&&(i.index=t.index,i.input=t.input),i}(t);else{var h=g(t),c=h==at||"[object GeneratorFunction]"==h;if(w(t))return function(t){return t.slice()}(t);if(h==ht||h==ot||c&&!r)o=c?{}:function(t){return"function"!=typeof t.constructor||v(t)?{}:K(J(t))}(t);else{if(!ct[h])return r?t:{};o=function(t,e){var i=t.constructor;switch(e){case"[object ArrayBuffer]":return Y(t);case"[object Boolean]":case"[object Date]":return new i(+t);case"[object DataView]":return function(t){var e=Y(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=Y(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,Z.exec(t));return e.lastIndex=t.lastIndex,e}(t);case"[object Symbol]":return function(t){return et?Object(et.call(t)):{}}(t)}}(t,h)}}n||(n=new x);var u=n.get(t);if(u)return u;n.set(t,o),nt(t)?t.forEach((function(s){o.add(ut(s,e,i,0,t,n))})):st(t)&&t.forEach((function(s,r){o.set(r,ut(s,e,i,0,t,n))}));var l=a?void 0:k(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];V.call(t,e)&&E(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,ut(s,e,i,0,t,n))})),o}ct[ot]=ct["[object Array]"]=ct["[object ArrayBuffer]"]=ct["[object DataView]"]=ct["[object Boolean]"]=ct["[object Date]"]=ct["[object Float32Array]"]=ct["[object Float64Array]"]=ct["[object Int8Array]"]=ct["[object Int16Array]"]=ct["[object Int32Array]"]=ct["[object Map]"]=ct["[object Number]"]=ct[ht]=ct["[object RegExp]"]=ct["[object Set]"]=ct["[object String]"]=ct["[object Symbol]"]=ct["[object Uint8Array]"]=ct["[object Uint8ClampedArray]"]=ct["[object Uint16Array]"]=ct["[object Uint32Array]"]=!0,ct["[object Error]"]=ct[at]=ct["[object WeakMap]"]=!1;var lt=function(){return A.Date.now()},dt=Math.max,ft=Math.min;function mt(t,e){return t.map(((t,i)=>{const s=function(t){return ut(t,5)}(t);return Object.assign(Object.assign({},s),{selected:i===e})}))}class pt{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 contextRegistry(){return this.platform.get(n.ContextRegistry)}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,s){this.platform=t,this.context=e,this.searchableLimetypes=i,this.host=s,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=>!N(t,"user")&&M(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(_)}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.contextRegistry.scope({host:this.host})),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 bt{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)}}var vt=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);return n>3&&o&&Object.defineProperty(e,i,o),o};const gt=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.imageUploadingChange=i(this,"imageUploadingChange",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.allowPasteImages=!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.pendingUploads=0,this.handleMouseClick=t=>{this.textEditorPickerElement&&(t.target===this.textEditorPickerElement||this.resetTriggerAndPicker())},this.handleKeyPress=t=>{if(!this.isPickerOpen||!this.activeTrigger)return;if(![l,d,u,f,m].includes(t.key))return;if(t.stopPropagation(),t.preventDefault(),"keyup"===t.type)return;const e={[l]:this.handleEscapeKey,[f]:this.handleEnterOrTabKey,[m]:this.handleEnterOrTabKey,[u]:this.handleArrowKeyPress,[d]: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===u?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.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=P(),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 p(){var t=lt();if(m(t))return b(t);a=setTimeout(p,function(t){var i=e-(t-h);return l?ft(i,n-(t-c)):i}(t))}function b(t){return a=void 0,d&&s?f(t):(s=r=void 0,o)}function v(){var t=lt(),i=m(t);if(s=arguments,r=this,h=t,i){if(void 0===a)return function(t){return c=t,a=setTimeout(p,e),u?f(t):o}(h);if(l)return clearTimeout(a),a=setTimeout(p,e),f(h)}return void 0===a&&(a=setTimeout(p,e)),o}return e=B(e)||0,S(i)&&(u=!!i.leading,n=(l="maxWait"in i)?dt(B(i.maxWait)||0,e):n,d="trailing"in i?!!i.trailing:d),v.cancel=function(){void 0!==a&&clearTimeout(a),c=0,s=h=r=a=void 0},v.flush=function(){return void 0===a?o:b(lt())},v}((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))}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 pt(this.platform,this.context,this.searchableLimetypes,this.host),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:"7c5597fd2affe6f7a625c3fabfbaaef70ac41b00",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,inlineImages:this.inlineImages,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:mt(this.items,this.highlightedItemIndex),onItemSelected:this.handleItemSelection,emptyMessage:this.pickerMessage,isSearching:this.isSearching}))}get inlineImages(){return Object.assign({tagName:"limebb-inline-image",getUrl:t=>R(this.appName,t)},this.allowPasteImages&&{upload:t=>this.uploadImage(t)})}async uploadImage(t){0===this.pendingUploads&&this.imageUploadingChange.emit(!0),this.pendingUploads++;try{return await this.uploadFile(t)}finally{this.pendingUploads--,0===this.pendingUploads&&this.imageUploadingChange.emit(!1)}}async uploadFile(t){if(t.size>52428800)throw Error("Image exceeds the maximum file size");const e=this.platform.get(n.Http),i=new bt(t,e);await i.initialize();const s=await i.upload();if(!s.id)throw Error("File upload response is missing an id");return s.id+""}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(100svh - (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],allowPasteImages:[4,"allow-paste-images"],items:[32],highlightedItemIndex:[32],editorPickerQuery:[32],searchableLimetypes:[32],appName:[32],isPickerOpen:[32],isSearching:[32]},void 0,{isPickerOpen:[{watchOpen:0}],editorPickerQuery:[{watchQuery:0}]}]);vt([h({map:[function(t){return Object.values(t).filter((t=>N(t,"user")||M(t,"user")))}]})],gt.prototype,"searchableLimetypes",void 0),vt([c()],gt.prototype,"appName",void 0);const yt=gt,jt=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),gt);break;case"limebb-empty-state":customElements.get(r(t))||U();break;case"limebb-text-editor-picker":customElements.get(r(t))||D()}}))};export{yt as LimebbTextEditor,jt 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{n,s as o,c as a,I as h,_ as c}from"./index.esm.js";import{A as u,E as l,b as d,a as f,T as m}from"./keycodes.js";import{o as p,U as b,c as v,a as g,d as y,n as j,i as w,S as x,g as k}from"./_Uint8Array.js";import{d as O}from"./_defineProperty.js";import{c as S,e as E,S as I,i as T,a as C,r as A}from"./_MapCache.js";import{c as P}from"./random-string.js";import{h as M,b as N,c as F}from"./limetype.js";import{i as _}from"./non-null.js";import{g as R}from"./file-contents-url.js";import{d as U}from"./empty-state.js";import{d as D}from"./text-editor-picker.js";import{i as L}from"./isSymbol.js";var z=/\s/,Q=/^\s+/;var $=/^[-+]0x[0-9a-f]+$/i,G=/^0b[01]+$/i,q=/^0o[0-7]+$/i,W=parseInt;function B(t){if("number"==typeof t)return t;if(L(t))return NaN;if(S(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=S(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--&&z.test(t.charAt(e)););return e}(t)+1).replace(Q,""):t}(t);var i=G.test(t);return i||q.test(t)?W(t.slice(2),i?2:8):$.test(t)?NaN:+t}var H=Object.create,K=function(){function t(){}return function(e){if(!S(e))return{};if(H)return H(e);t.prototype=e;var i=new t;return t.prototype=void 0,i}}(),V=Object.prototype.hasOwnProperty;var J=p(Object.getPrototypeOf,Object);"object"==typeof exports&&exports&&!exports.nodeType&&exports&&"object"==typeof module&&module&&!module.nodeType&&module;var X=Object.prototype.hasOwnProperty;function Y(t){var e=new t.constructor(t.byteLength);return new b(e).set(new b(t)),e}var Z=/\w*$/,tt=I?I.prototype:void 0,et=tt?tt.valueOf:void 0;var it=j&&j.isMap,st=it?y(it):function(t){return T(t)&&"[object Map]"==g(t)},rt=j&&j.isSet,nt=rt?y(rt):function(t){return T(t)&&"[object Set]"==g(t)},ot="[object Arguments]",at="[object Function]",ht="[object Object]",ct={};function ut(t,e,i,s,r,n){var o;if(void 0!==o)return o;if(!S(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]&&X.call(t,"index")&&(i.index=t.index,i.input=t.input),i}(t);else{var h=g(t),c=h==at||"[object GeneratorFunction]"==h;if(w(t))return function(t){return t.slice()}(t);if(h==ht||h==ot||c&&!r)o=c?{}:function(t){return"function"!=typeof t.constructor||v(t)?{}:K(J(t))}(t);else{if(!ct[h])return r?t:{};o=function(t,e){var i=t.constructor;switch(e){case"[object ArrayBuffer]":return Y(t);case"[object Boolean]":case"[object Date]":return new i(+t);case"[object DataView]":return function(t){var e=Y(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=Y(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,Z.exec(t));return e.lastIndex=t.lastIndex,e}(t);case"[object Symbol]":return function(t){return et?Object(et.call(t)):{}}(t)}}(t,h)}}n||(n=new x);var u=n.get(t);if(u)return u;n.set(t,o),nt(t)?t.forEach((function(s){o.add(ut(s,e,i,0,t,n))})):st(t)&&t.forEach((function(s,r){o.set(r,ut(s,e,i,0,t,n))}));var l=a?void 0:k(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];V.call(t,e)&&E(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,ut(s,e,i,0,t,n))})),o}ct[ot]=ct["[object Array]"]=ct["[object ArrayBuffer]"]=ct["[object DataView]"]=ct["[object Boolean]"]=ct["[object Date]"]=ct["[object Float32Array]"]=ct["[object Float64Array]"]=ct["[object Int8Array]"]=ct["[object Int16Array]"]=ct["[object Int32Array]"]=ct["[object Map]"]=ct["[object Number]"]=ct[ht]=ct["[object RegExp]"]=ct["[object Set]"]=ct["[object String]"]=ct["[object Symbol]"]=ct["[object Uint8Array]"]=ct["[object Uint8ClampedArray]"]=ct["[object Uint16Array]"]=ct["[object Uint32Array]"]=!0,ct["[object Error]"]=ct[at]=ct["[object WeakMap]"]=!1;var lt=function(){return A.Date.now()},dt=Math.max,ft=Math.min;function mt(t,e){return t.map(((t,i)=>{const s=function(t){return ut(t,5)}(t);return Object.assign(Object.assign({},s),{selected:i===e})}))}class pt{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 contextRegistry(){return this.platform.get(n.ContextRegistry)}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,s){this.platform=t,this.context=e,this.searchableLimetypes=i,this.host=s,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=>!N(t,"user")&&M(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(_)}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.contextRegistry.scope({host:this.host})),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 bt{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)}}var vt=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);return n>3&&o&&Object.defineProperty(e,i,o),o};const gt=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.imageUploadingChange=i(this,"imageUploadingChange",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.allowPasteImages=!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.pendingUploads=0,this.handleMouseClick=t=>{this.textEditorPickerElement&&(t.target===this.textEditorPickerElement||this.resetTriggerAndPicker())},this.handleKeyPress=t=>{if(!this.isPickerOpen||!this.activeTrigger)return;if(![l,d,u,f,m].includes(t.key))return;if(t.stopPropagation(),t.preventDefault(),"keyup"===t.type)return;const e={[l]:this.handleEscapeKey,[f]:this.handleEnterOrTabKey,[m]:this.handleEnterOrTabKey,[u]:this.handleArrowKeyPress,[d]: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===u?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.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=P(),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 p(){var t=lt();if(m(t))return b(t);a=setTimeout(p,function(t){var i=e-(t-h);return l?ft(i,n-(t-c)):i}(t))}function b(t){return a=void 0,d&&s?f(t):(s=r=void 0,o)}function v(){var t=lt(),i=m(t);if(s=arguments,r=this,h=t,i){if(void 0===a)return function(t){return c=t,a=setTimeout(p,e),u?f(t):o}(h);if(l)return clearTimeout(a),a=setTimeout(p,e),f(h)}return void 0===a&&(a=setTimeout(p,e)),o}return e=B(e)||0,S(i)&&(u=!!i.leading,n=(l="maxWait"in i)?dt(B(i.maxWait)||0,e):n,d="trailing"in i?!!i.trailing:d),v.cancel=function(){void 0!==a&&clearTimeout(a),c=0,s=h=r=a=void 0},v.flush=function(){return void 0===a?o:b(lt())},v}((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))}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 pt(this.platform,this.context,this.searchableLimetypes,this.host),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:"c6245590284cdd6f097ae0facf7204fb7c5fd60b",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,inlineImages:this.inlineImages,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:mt(this.items,this.highlightedItemIndex),onItemSelected:this.handleItemSelection,emptyMessage:this.pickerMessage,isSearching:this.isSearching}))}get inlineImages(){return Object.assign({tagName:"limebb-inline-image",getUrl:t=>R(this.appName,t)},this.allowPasteImages&&{upload:t=>this.uploadImage(t)})}async uploadImage(t){0===this.pendingUploads&&this.imageUploadingChange.emit(!0),this.pendingUploads++;try{return await this.uploadFile(t)}finally{this.pendingUploads--,0===this.pendingUploads&&this.imageUploadingChange.emit(!1)}}async uploadFile(t){if(t.size>52428800)throw Error("Image exceeds the maximum file size");const e=this.platform.get(n.Http),i=new bt(t,e);await i.initialize();const s=await i.upload();if(!s.id)throw Error("File upload response is missing an id");return s.id+""}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(100svh - (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],allowPasteImages:[4,"allow-paste-images"],items:[32],highlightedItemIndex:[32],editorPickerQuery:[32],searchableLimetypes:[32],appName:[32],isPickerOpen:[32],isSearching:[32]},void 0,{isPickerOpen:[{watchOpen:0}],editorPickerQuery:[{watchQuery:0}]}]);vt([h({map:[function(t){return Object.values(t).filter((t=>N(t,"user")||M(t,"user")))}]})],gt.prototype,"searchableLimetypes",void 0),vt([c()],gt.prototype,"appName",void 0);const yt=gt,jt=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),gt);break;case"limebb-empty-state":customElements.get(r(t))||U();break;case"limebb-text-editor-picker":customElements.get(r(t))||D()}}))};export{yt as LimebbTextEditor,jt 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:"b963d9086b70b11dce31375284e54574f54b4f0c",class:this.getContainerClassList()},e("limel-notched-outline",{key:"d2d2587a0239cba584177dbc1806762e9d783460",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:"8e7b6c37d803c5c682220681e93c3a096d4e02d2",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]:focus{outline:none}div[slot=content]:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}div[slot=content]{display:flex;align-items:center;gap:0.5rem;border-radius:inherit;background-color:transparent !important}: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{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:"056a2d392addfbf69cb5668d2e33013f16ec7480",class:this.getContainerClassList()},e("limel-notched-outline",{key:"a189c535a364147f31db8d8b9836565b32fb82bc",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:"a3a17c9481626fe68b6689d1b64d37080b7d099c",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]:focus{outline:none}div[slot=content]:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}div[slot=content]{display:flex;align-items:center;gap:0.5rem;border-radius:inherit;background-color:transparent !important}: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 r}from"@stencil/core/internal/client";import{o as a}from"./index.esm.js";import{o as n,c as o,a as l}from"./filter-operators.js";import{d as h}from"./filter-condition-picker.js";const u=[{value:"string",text:"Text"},{value:"number",text:"Number"},{value:"date",text:"Date"},{value:"datetime",text:"Date & time"},{value:"time",text:"Time"}],d=[a.EQUALS,a.NOT_EQUALS,a.LESS,a.LESS_OR_EQUAL,a.GREATER,a.GREATER_OR_EQUAL],c=n(d),m={string:"string",number:"integer",date:"date",datetime:"date",time:"time"},v="__relative_offset__",p="__specific__",f=[{value:"$now",text:"Now"},{value:"$today",text:"Today"},{value:"$tomorrow",text:"Tomorrow"},{value:"$yesterday",text:"Yesterday"},{value:"$this_week",text:"This week"},{value:"$this_month",text:"This month"},{value:"$this_quarter",text:"This quarter"},{value:"$this_year",text:"This year"}],b=new Set(f.map((e=>e.value))),x=[{value:"next",text:"Next"},{value:"previous",text:"Previous"}],y=[{value:"day",text:"days"},{value:"week",text:"weeks"},{value:"month",text:"months"},{value:"quarter",text:"quarters"},{value:"year",text:"years"}],g=/^\$(next|previous)_(day|week|month|quarter|year)\((\d+)\)$/,k=new Set(["date","datetime","time"]),w=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.change=i(this,"change",7),this.value={},this.direction="next",this.unit="week",this.count=1,this.countInput="1",this.countInvalid=!1,this.handleTypeChange=e=>{var t,i;e.stopPropagation(),this.resetOperandState(),this.emit(this.currentOperator,void 0,null!==(i=null===(t=e.detail)||void 0===t?void 0:t.value)&&void 0!==i?i:"string")},this.handleConditionChange=e=>{e.stopPropagation();const t=o(e.detail);t&&this.emit(t,this.value.operand)},this.handleScalarOperandChange=e=>{e.stopPropagation(),this.emit(this.currentOperator,this.parseScalarOperand(e.detail))},this.handleOperandKeyChange=e=>{var t;e.stopPropagation();const i=this.currentOperator,s=null===(t=e.detail)||void 0===t?void 0:t.value;if(this.operandKey=s,s!==v)return s===p?(this.specificDate||(this.specificDate=new Date),void this.emit(i,this.formatSpecific(this.specificDate))):void this.emit(i,s||void 0);this.emit(i,this.relativeOffsetToken())},this.handleDirectionChange=e=>{var t,i;e.stopPropagation(),this.direction=null!==(i=null===(t=e.detail)||void 0===t?void 0:t.value)&&void 0!==i?i:"next",this.emitRelativeOffset()},this.handleUnitChange=e=>{var t,i;e.stopPropagation(),this.unit=null!==(i=null===(t=e.detail)||void 0===t?void 0:t.value)&&void 0!==i?i:"week",this.emitRelativeOffset()},this.handleCountChange=e=>{e.stopPropagation(),this.countInput=e.detail+"";const t=Number.parseInt(this.countInput,10);Number.isNaN(t)||t<1?this.countInvalid=!0:(this.countInvalid=!1,this.count=t,this.emitRelativeOffset())},this.handleSpecificDateChange=e=>{e.stopPropagation();const t=this.currentOperator,i=e.detail instanceof Date?e.detail:void 0;this.specificDate=i,this.emit(t,i?this.formatSpecific(i):void 0)}}componentWillLoad(){this.syncFromValue(this.value)}onValueChange(e){this.syncFromValue(e)}get valueType(){var e;return null!==(e=this.value.valueType)&&void 0!==e?e:"string"}get currentOperator(){var e;return null!==(e=this.value.operator)&&void 0!==e?e:d[0]}render(){const e=u.find((e=>e.value===this.valueType));return s("div",{key:"adecd47e558632637dec3506429c285dcddf7746",class:"rule"},s("limel-select",{key:"41032f0494cccf8ab9ef429e0648e84b70de7a80",class:"type-select",label:"Compare as",options:u,value:e,onChange:this.handleTypeChange}),s("limebb-filter-condition-picker",{key:"118a34ec6bf0b057ad504690ea2bbb50295697ef",class:"operator-select",platform:this.platform,propertyType:m[this.valueType],conditions:c,value:l(this.currentOperator),onChange:this.handleConditionChange}),this.renderOperand())}renderOperand(){return k.has(this.valueType)?this.renderTemporalOperand():this.renderScalarInput()}renderScalarInput(){return s("limel-input-field",{class:"operand-input",label:"Compared with",type:"number"===this.valueType?"number":"text",value:void 0===this.value.operand?"":this.value.operand+"",onChange:this.handleScalarOperandChange})}renderTemporalOperand(){const e=this.operandOptions(),t=e.find((e=>e.value===this.operandKey));return[s("limel-select",{key:"operand-select",class:"operand-select",label:"Compared with",options:e,value:t,onChange:this.handleOperandKeyChange}),this.renderTemporalSubControl()]}operandOptions(){if("time"===this.valueType)return[{value:"$now",text:"Now"},{value:p,text:"Specific time…"}];const e="datetime"===this.valueType?"Specific date & time…":"Specific date…";return[..."date"===this.valueType?f.filter((e=>"$now"!==e.value)):f,{value:v,text:"Relative offset…"},{value:p,text:e}]}renderTemporalSubControl(){return this.operandKey===v?this.renderOffsetBuilder():this.operandKey===p?this.renderDatePicker():null}renderOffsetBuilder(){const e=x.find((e=>e.value===this.direction)),t=y.find((e=>e.value===this.unit));return s("div",{key:"offset-builder",class:"offset-builder"},s("limel-select",{class:"offset-direction",options:x,value:e,onChange:this.handleDirectionChange}),s("limel-input-field",{class:"offset-count",label:"Amount",type:"number",required:!0,invalid:this.countInvalid,value:this.countInput,onChange:this.handleCountChange}),s("limel-select",{class:"offset-unit",options:y,value:t,onChange:this.handleUnitChange}))}renderDatePicker(){return s("limel-date-picker",{key:"specific-picker",class:"operand-picker",label:"Compared with",type:this.valueType,value:this.specificDate,onChange:this.handleSpecificDateChange})}emitRelativeOffset(){this.emit(this.currentOperator,this.relativeOffsetToken())}relativeOffsetToken(){return`$${this.direction}_${this.unit}(${this.count})`}parseScalarOperand(e){const t=e+"";if(""===t.trim())return;if("number"!==this.valueType)return t;const i=Number(t);return Number.isNaN(i)?void 0:i}formatSpecific(e){return"datetime"===this.valueType?e.toISOString():"time"===this.valueType?`${$(e.getHours())}:${$(e.getMinutes())}:${$(e.getSeconds())}`:`${e.getFullYear()}-${$(e.getMonth()+1)}-${$(e.getDate())}`}emit(e,t,i=this.valueType){const s={valueType:i};e&&(s.operator=e),void 0!==t&&(s.operand=t),this.change.emit(s)}resetOperandState(){this.operandKey=void 0,this.specificDate=void 0,this.direction="next",this.unit="week",this.count=1,this.countInput="1",this.countInvalid=!1}syncFromValue(e){const t=null==e?void 0:e.operand;if("string"!=typeof t||""===t)return;if(!k.has(this.valueType))return void(this.operandKey=void 0);const i=g.exec(t);if(i){const[,e,t,s]=i;return this.operandKey=v,this.direction=e,this.unit=t,this.count=Number(s),this.countInput=s,void(this.countInvalid=!1)}b.has(t)?this.operandKey=t:(this.operandKey=p,this.specificDate=this.parseSpecific(t))}parseSpecific(e){const t=new Date(this.specificDateText(e));return Number.isNaN(t.getTime())?void 0:t}specificDateText(e){return"time"===this.valueType?"1970-01-01T"+e:"date"===this.valueType?e+"T00:00:00":e}static get watchers(){return{value:[{onValueChange:0}]}}static get style(){return":host{display:block}.rule{display:grid;gap:0.5rem;grid-template-columns:repeat(auto-fit, minmax(12rem, 1fr))}.offset-builder{display:flex;gap:0.5rem;align-items:flex-end;grid-column:1/-1}.offset-builder .offset-count{max-width:6rem}"}},[1,"limebb-value-comparison-editor",{value:[16],platform:[16],operandKey:[32],direction:[32],unit:[32],count:[32],countInput:[32],countInvalid:[32],specificDate:[32]},void 0,{value:[{onValueChange:0}]}]);function $(e){return(e+"").padStart(2,"0")}const T=w,C=function(){"undefined"!=typeof customElements&&["limebb-value-comparison-editor","limebb-filter-condition-picker"].forEach((e=>{switch(e){case"limebb-value-comparison-editor":customElements.get(r(e))||customElements.define(r(e),w);break;case"limebb-filter-condition-picker":customElements.get(r(e))||h()}}))};export{T as LimebbValueComparisonEditor,C 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{o as n}from"./index.esm.js";import{o as a,c as o,a as l}from"./filter-operators.js";import{d as h}from"./filter-condition-picker.js";const u=[{value:"string",text:"Text"},{value:"number",text:"Number"},{value:"date",text:"Date"},{value:"datetime",text:"Date & time"},{value:"time",text:"Time"}],d=[n.EQUALS,n.NOT_EQUALS,n.LESS,n.LESS_OR_EQUAL,n.GREATER,n.GREATER_OR_EQUAL],c=a(d),m={string:"string",number:"integer",date:"date",datetime:"date",time:"time"},v="__relative_offset__",p="__specific__",f=[{value:"$now",text:"Now"},{value:"$today",text:"Today"},{value:"$tomorrow",text:"Tomorrow"},{value:"$yesterday",text:"Yesterday"},{value:"$this_week",text:"This week"},{value:"$this_month",text:"This month"},{value:"$this_quarter",text:"This quarter"},{value:"$this_year",text:"This year"}],b=new Set(f.map((t=>t.value))),x=[{value:"next",text:"Next"},{value:"previous",text:"Previous"}],y=[{value:"day",text:"days"},{value:"week",text:"weeks"},{value:"month",text:"months"},{value:"quarter",text:"quarters"},{value:"year",text:"years"}],g=/^\$(next|previous)_(day|week|month|quarter|year)\((\d+)\)$/,k=new Set(["date","datetime","time"]),w=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.change=i(this,"change",7),this.value={},this.direction="next",this.unit="week",this.count=1,this.countInput="1",this.countInvalid=!1,this.handleTypeChange=t=>{var e,i;t.stopPropagation(),this.resetOperandState(),this.emit(this.currentOperator,void 0,null!==(i=null===(e=t.detail)||void 0===e?void 0:e.value)&&void 0!==i?i:"string")},this.handleConditionChange=t=>{t.stopPropagation();const e=o(t.detail);e&&this.emit(e,this.value.operand)},this.handleScalarOperandChange=t=>{t.stopPropagation(),this.emit(this.currentOperator,this.parseScalarOperand(t.detail))},this.handleOperandKeyChange=t=>{var e;t.stopPropagation();const i=this.currentOperator,s=null===(e=t.detail)||void 0===e?void 0:e.value;if(this.operandKey=s,s!==v)return s===p?(this.specificDate||(this.specificDate=new Date),void this.emit(i,this.formatSpecific(this.specificDate))):void this.emit(i,s||void 0);this.emit(i,this.relativeOffsetToken())},this.handleDirectionChange=t=>{var e,i;t.stopPropagation(),this.direction=null!==(i=null===(e=t.detail)||void 0===e?void 0:e.value)&&void 0!==i?i:"next",this.emitRelativeOffset()},this.handleUnitChange=t=>{var e,i;t.stopPropagation(),this.unit=null!==(i=null===(e=t.detail)||void 0===e?void 0:e.value)&&void 0!==i?i:"week",this.emitRelativeOffset()},this.handleCountChange=t=>{t.stopPropagation(),this.countInput=t.detail+"";const e=Number.parseInt(this.countInput,10);Number.isNaN(e)||e<1?this.countInvalid=!0:(this.countInvalid=!1,this.count=e,this.emitRelativeOffset())},this.handleSpecificDateChange=t=>{t.stopPropagation();const e=this.currentOperator,i=t.detail instanceof Date?t.detail:void 0;this.specificDate=i,this.emit(e,i?this.formatSpecific(i):void 0)}}componentWillLoad(){this.syncFromValue(this.value)}onValueChange(t){this.syncFromValue(t)}get valueType(){var t;return null!==(t=this.value.valueType)&&void 0!==t?t:"string"}get currentOperator(){var t;return null!==(t=this.value.operator)&&void 0!==t?t:d[0]}render(){const t=u.find((t=>t.value===this.valueType));return s("div",{key:"c41b47392bdfc1ecdd2b0829e59e6ec0f2184a1f",class:"rule"},s("limel-select",{key:"5ecdb7dc1b09131635acfb7d823776b80dbd2ffe",class:"type-select",label:"Compare as",options:u,value:t,onChange:this.handleTypeChange}),s("limebb-filter-condition-picker",{key:"b474c9062eb6207f2a6b1751101df2bf1cc80547",class:"operator-select",platform:this.platform,propertyType:m[this.valueType],conditions:c,value:l(this.currentOperator),onChange:this.handleConditionChange}),this.renderOperand())}renderOperand(){return k.has(this.valueType)?this.renderTemporalOperand():this.renderScalarInput()}renderScalarInput(){return s("limel-input-field",{class:"operand-input",label:"Compared with",type:"number"===this.valueType?"number":"text",value:void 0===this.value.operand?"":this.value.operand+"",onChange:this.handleScalarOperandChange})}renderTemporalOperand(){const t=this.operandOptions(),e=t.find((t=>t.value===this.operandKey));return[s("limel-select",{key:"operand-select",class:"operand-select",label:"Compared with",options:t,value:e,onChange:this.handleOperandKeyChange}),this.renderTemporalSubControl()]}operandOptions(){if("time"===this.valueType)return[{value:"$now",text:"Now"},{value:p,text:"Specific time…"}];const t="datetime"===this.valueType?"Specific date & time…":"Specific date…";return[..."date"===this.valueType?f.filter((t=>"$now"!==t.value)):f,{value:v,text:"Relative offset…"},{value:p,text:t}]}renderTemporalSubControl(){return this.operandKey===v?this.renderOffsetBuilder():this.operandKey===p?this.renderDatePicker():null}renderOffsetBuilder(){const t=x.find((t=>t.value===this.direction)),e=y.find((t=>t.value===this.unit));return s("div",{key:"offset-builder",class:"offset-builder"},s("limel-select",{class:"offset-direction",options:x,value:t,onChange:this.handleDirectionChange}),s("limel-input-field",{class:"offset-count",label:"Amount",type:"number",required:!0,invalid:this.countInvalid,value:this.countInput,onChange:this.handleCountChange}),s("limel-select",{class:"offset-unit",options:y,value:e,onChange:this.handleUnitChange}))}renderDatePicker(){return s("limel-date-picker",{key:"specific-picker",class:"operand-picker",label:"Compared with",type:this.valueType,value:this.specificDate,onChange:this.handleSpecificDateChange})}emitRelativeOffset(){this.emit(this.currentOperator,this.relativeOffsetToken())}relativeOffsetToken(){return`$${this.direction}_${this.unit}(${this.count})`}parseScalarOperand(t){const e=t+"";if(""===e.trim())return;if("number"!==this.valueType)return e;const i=Number(e);return Number.isNaN(i)?void 0:i}formatSpecific(t){return"datetime"===this.valueType?t.toISOString():"time"===this.valueType?`${$(t.getHours())}:${$(t.getMinutes())}:${$(t.getSeconds())}`:`${t.getFullYear()}-${$(t.getMonth()+1)}-${$(t.getDate())}`}emit(t,e,i=this.valueType){const s={valueType:i};t&&(s.operator=t),void 0!==e&&(s.operand=e),this.change.emit(s)}resetOperandState(){this.operandKey=void 0,this.specificDate=void 0,this.direction="next",this.unit="week",this.count=1,this.countInput="1",this.countInvalid=!1}syncFromValue(t){const e=null==t?void 0:t.operand;if("string"!=typeof e||""===e)return;if(!k.has(this.valueType))return void(this.operandKey=void 0);const i=g.exec(e);if(i){const[,t,e,s]=i;return this.operandKey=v,this.direction=t,this.unit=e,this.count=Number(s),this.countInput=s,void(this.countInvalid=!1)}b.has(e)?this.operandKey=e:(this.operandKey=p,this.specificDate=this.parseSpecific(e))}parseSpecific(t){const e=new Date(this.specificDateText(t));return Number.isNaN(e.getTime())?void 0:e}specificDateText(t){return"time"===this.valueType?"1970-01-01T"+t:"date"===this.valueType?t+"T00:00:00":t}static get watchers(){return{value:[{onValueChange:0}]}}static get style(){return":host{display:block}.rule{display:grid;gap:0.5rem;grid-template-columns:repeat(auto-fit, minmax(12rem, 1fr))}.offset-builder{display:flex;gap:0.5rem;align-items:flex-end;grid-column:1/-1}.offset-builder .offset-count{max-width:6rem}"}},[1,"limebb-value-comparison-editor",{value:[16],platform:[16],operandKey:[32],direction:[32],unit:[32],count:[32],countInput:[32],countInvalid:[32],specificDate:[32]},void 0,{value:[{onValueChange:0}]}]);function $(t){return(t+"").padStart(2,"0")}const T=w,C=function(){"undefined"!=typeof customElements&&["limebb-value-comparison-editor","limebb-filter-condition-picker"].forEach((t=>{switch(t){case"limebb-value-comparison-editor":customElements.get(r(t))||customElements.define(r(t),w);break;case"limebb-filter-condition-picker":customElements.get(r(t))||h()}}))};export{T as LimebbValueComparisonEditor,C 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{n 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:"c649a9e99ec7af2055df7f1cd82cdd87f19ddde7",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
+ import{proxyCustomElement as e,HTMLElement as t,createEvent as i,h as s,transformTag as l}from"@stencil/core/internal/client";import{n 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 m,a as h,b as d}from"./_MapCache.js";function p(e){return"string"==typeof e||!h(e)&&m(e)&&"[object String]"==d(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:"1bb0d48ee4613baef033cea5f6f610261a67972f",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 e,HTMLElement as o,h as r,transformTag as a}from"@stencil/core/internal/client";const t=e(class extends o{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow()}render(){return[r("div",{key:"189796d67448366e2af26362a29463afff7079a1",class:"header"},r("limel-icon",{key:"ffcee585bc30f862066e8dce49ad3330bca13afd",name:"not_showing_video_frames"}),r("h2",{key:"90c5c00930a425a39a144aec4232b76517184b2a"},"Viewing this file type requires ",r("em",{key:"c05d9ed5568c1a6cd393aa95e654ea19bf5c133a"},"Live Docs"))),r("p",{key:"09d96468c886fa0dcfe8b9b9a3df79c3f5c87f78"},r("em",{key:"c232fdf6277bbe910d23cebf18afadcd2118f43d"},"Live Docs")," not only enables you to view many file formats such as Microsoft Office documents, but it also empowers you to edit them right in the CRM. No need to download anything on your device!",r("a",{key:"dbb74111b5995c013235ea585fa56fd41049540a",target:"_blank",href:"https://www.lime-technologies.com/en/lime-crm/live-docs/"},"Learn more"))]}static get style(){return":host(limebb-live-docs-info){padding:1rem 2rem;display:flex;flex-direction:column;gap:0.5rem;border-style:dashed;border-color:rgb(var(--contrast-700));border-radius:0 0 0.5rem 0.5rem;border-width:0 1px 1px 1px}.header{display:flex;align-items:center;gap:0.5rem}h2,p{margin:0;color:rgb(var(--contrast-1100))}h2{font-size:large;font-weight:300}limel-icon{color:rgb(var(--color-orange-default));width:2rem}a{all:unset;cursor:pointer;transition:color 0.2s ease;color:rgb(var(--color-sky-default));margin-left:0.5rem}a:hover{color:rgb(var(--color-sky-dark));text-decoration:underline}"}},[1,"limebb-live-docs-info"]);function i(){"undefined"!=typeof customElements&&["limebb-live-docs-info"].forEach((e=>{"limebb-live-docs-info"===e&&(customElements.get(a(e))||customElements.define(a(e),t))}))}export{t as L,i as d}
1
+ import{proxyCustomElement as e,HTMLElement as o,h as r,transformTag as t}from"@stencil/core/internal/client";const i=e(class extends o{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow()}render(){return[r("div",{key:"02407fa43e06e6e634b542a4f37e2c0fad7658e8",class:"header"},r("limel-icon",{key:"718c73e93bc8898e28ae94f3576a33b87ce7038d",name:"not_showing_video_frames"}),r("h2",{key:"2b9c6d298551499c92d29da9e7ffbcfb9c358885"},"Viewing this file type requires ",r("em",{key:"5802a6ae90b7b94cc06dad829b4e69186551b52a"},"Live Docs"))),r("p",{key:"22bda139aa0c3f8d7127639d22c51dbe22628722"},r("em",{key:"d35dfbee9a70cb7c86458d3de2c6e01f7ea8d18f"},"Live Docs")," not only enables you to view many file formats such as Microsoft Office documents, but it also empowers you to edit them right in the CRM. No need to download anything on your device!",r("a",{key:"f9d0d15458c623435108c41c83bf5d29e710cfab",target:"_blank",href:"https://www.lime-technologies.com/en/lime-crm/live-docs/"},"Learn more"))]}static get style(){return":host(limebb-live-docs-info){padding:1rem 2rem;display:flex;flex-direction:column;gap:0.5rem;border-style:dashed;border-color:rgb(var(--contrast-700));border-radius:0 0 0.5rem 0.5rem;border-width:0 1px 1px 1px}.header{display:flex;align-items:center;gap:0.5rem}h2,p{margin:0;color:rgb(var(--contrast-1100))}h2{font-size:large;font-weight:300}limel-icon{color:rgb(var(--color-orange-default));width:2rem}a{all:unset;cursor:pointer;transition:color 0.2s ease;color:rgb(var(--color-sky-default));margin-left:0.5rem}a:hover{color:rgb(var(--color-sky-dark));text-decoration:underline}"}},[1,"limebb-live-docs-info"]);function a(){"undefined"!=typeof customElements&&["limebb-live-docs-info"].forEach((e=>{"limebb-live-docs-info"===e&&(customElements.get(t(e))||customElements.define(t(e),i))}))}export{i as L,a as d}