@limetech/lime-crm-building-blocks 1.140.0 → 2.0.0

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 (215) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/file-contents-url-CIoCVl85.js +14 -0
  3. package/dist/cjs/{filter-group-logic-BPpM2NqX.js → filter-group-logic-EDLGrkTt.js} +12 -12
  4. package/dist/cjs/{filter-operators-BTWvpD6A.js → filter-operators-CVCyCZ7Q.js} +11 -11
  5. package/dist/cjs/index.cjs.js +2 -2
  6. package/dist/cjs/{index.esm-Se3EtD3m.js → index.esm-CcYbS__E.js} +210 -181
  7. package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
  8. package/dist/cjs/{lime-query-validation-CJC3mtnT.js → lime-query-validation-B0oYW7Z6.js} +7 -7
  9. package/dist/cjs/limebb-browser.cjs.entry.js +1 -1
  10. package/dist/cjs/limebb-chat-icon-list_3.cjs.entry.js +1 -1
  11. package/dist/cjs/limebb-chat-list.cjs.entry.js +1 -1
  12. package/dist/cjs/limebb-component-config.cjs.entry.js +1 -1
  13. package/dist/cjs/limebb-component-picker.cjs.entry.js +1 -1
  14. package/dist/cjs/limebb-composer-toolbar.cjs.entry.js +1 -1
  15. package/dist/cjs/limebb-currency-picker.cjs.entry.js +1 -1
  16. package/dist/cjs/limebb-data-cells.cjs.entry.js +1 -1
  17. package/dist/cjs/limebb-date-picker.cjs.entry.js +1 -1
  18. package/dist/cjs/limebb-feed-timeline-item.cjs.entry.js +5 -1
  19. package/dist/cjs/limebb-feed.cjs.entry.js +1 -1
  20. package/dist/cjs/limebb-filter-chip_6.cjs.entry.js +22 -22
  21. package/dist/cjs/limebb-info-tile.cjs.entry.js +10 -9
  22. package/dist/cjs/limebb-inline-image.cjs.entry.js +49 -0
  23. package/dist/cjs/limebb-kanban-group.cjs.entry.js +2 -2
  24. package/dist/cjs/limebb-kanban-item.cjs.entry.js +1 -1
  25. package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +3 -3
  26. package/dist/cjs/limebb-lime-query-filter-builder.cjs.entry.js +5 -5
  27. package/dist/cjs/limebb-lime-query-filter-comparison_2.cjs.entry.js +4 -4
  28. package/dist/cjs/limebb-lime-query-order-by-editor_2.cjs.entry.js +2 -2
  29. package/dist/cjs/limebb-lime-query-response-format-builder.cjs.entry.js +3 -3
  30. package/dist/cjs/limebb-limeobject-file-viewer.cjs.entry.js +3 -3
  31. package/dist/cjs/limebb-loader.cjs.entry.js +2 -2
  32. package/dist/cjs/limebb-locale-picker.cjs.entry.js +1 -1
  33. package/dist/cjs/limebb-mention.cjs.entry.js +1 -1
  34. package/dist/cjs/limebb-notification-item.cjs.entry.js +1 -1
  35. package/dist/cjs/limebb-notification-list.cjs.entry.js +1 -1
  36. package/dist/cjs/limebb-object-chip.cjs.entry.js +3 -3
  37. package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +1 -1
  38. package/dist/cjs/limebb-property-selector.cjs.entry.js +3 -3
  39. package/dist/cjs/limebb-rule-arg-filter-editor.cjs.entry.js +2 -2
  40. package/dist/cjs/limebb-rule-chip-popover.cjs.entry.js +2 -2
  41. package/dist/cjs/limebb-rule-editor.cjs.entry.js +2 -2
  42. package/dist/cjs/limebb-rule-gate.cjs.entry.js +1 -1
  43. package/dist/cjs/limebb-text-editor.cjs.entry.js +51 -144
  44. package/dist/cjs/limebb-trend-indicator.cjs.entry.js +1 -1
  45. package/dist/cjs/limebb-value-comparison-editor.cjs.entry.js +9 -9
  46. package/dist/cjs/{limetype-CmgP0nbZ.js → limetype-C-fVThrI.js} +1 -1
  47. package/dist/cjs/loader.cjs.js +1 -1
  48. package/dist/collection/collection-manifest.json +1 -0
  49. package/dist/collection/components/feed/feed-item/feed-timeline-item.js +4 -0
  50. package/dist/collection/components/info-tile/info-tile.js +1 -1
  51. package/dist/collection/components/info-tile/loader.js +2 -1
  52. package/dist/collection/components/inline-image/inline-image.css +12 -0
  53. package/dist/collection/components/inline-image/inline-image.js +146 -0
  54. package/dist/collection/components/rule-editor/value-comparison-editor/value-comparison-editor.js +1 -1
  55. package/dist/collection/components/text-editor/text-editor.js +57 -45
  56. package/dist/collection/util/file-contents-url.js +10 -0
  57. package/dist/components/chat-item.js +1 -1
  58. package/dist/components/currency-picker.js +1 -1
  59. package/dist/components/date-picker.js +1 -1
  60. package/dist/components/feed-timeline-item.js +1 -1
  61. package/dist/components/file-contents-url.js +1 -0
  62. package/dist/components/filter-chip.js +1 -1
  63. package/dist/components/filter-condition-picker.js +1 -1
  64. package/dist/components/filter-operators.js +1 -1
  65. package/dist/components/index.esm.js +1 -1
  66. package/dist/components/kanban-group.js +1 -1
  67. package/dist/components/kanban-item.js +1 -1
  68. package/dist/components/lime-query-filter-builder.js +1 -1
  69. package/dist/components/lime-query-filter-comparison-editor.js +1 -1
  70. package/dist/components/lime-query-filter-comparison.js +1 -1
  71. package/dist/components/lime-query-filter-expression.js +1 -1
  72. package/dist/components/lime-query-validation.js +1 -1
  73. package/dist/components/lime-query-value-input.js +1 -1
  74. package/dist/components/limebb-browser.js +1 -1
  75. package/dist/components/limebb-chat-list.js +1 -1
  76. package/dist/components/limebb-component-config.js +1 -1
  77. package/dist/components/limebb-component-picker.js +1 -1
  78. package/dist/components/limebb-composer-toolbar.js +1 -1
  79. package/dist/components/limebb-data-cells.js +1 -1
  80. package/dist/components/limebb-feed.js +1 -1
  81. package/dist/components/limebb-info-tile.js +1 -1
  82. package/dist/components/limebb-inline-image.d.ts +11 -0
  83. package/dist/components/limebb-inline-image.js +1 -0
  84. package/dist/components/limebb-lime-query-builder.js +1 -1
  85. package/dist/components/limebb-lime-query-response-format-builder.js +1 -1
  86. package/dist/components/limebb-limeobject-file-viewer.js +1 -1
  87. package/dist/components/limebb-loader.js +1 -1
  88. package/dist/components/limebb-locale-picker.js +1 -1
  89. package/dist/components/limebb-mention.js +1 -1
  90. package/dist/components/limebb-notification-list.js +1 -1
  91. package/dist/components/limebb-object-chip.js +1 -1
  92. package/dist/components/limebb-rule-arg-filter-editor.js +1 -1
  93. package/dist/components/limebb-rule-editor.js +1 -1
  94. package/dist/components/limebb-rule-gate.js +1 -1
  95. package/dist/components/limebb-text-editor.js +1 -1
  96. package/dist/components/limebb-trend-indicator.js +1 -1
  97. package/dist/components/limebb-value-comparison-editor.js +1 -1
  98. package/dist/components/limetype-field.js +1 -1
  99. package/dist/components/notification-item.js +1 -1
  100. package/dist/components/percentage-visualizer.js +1 -1
  101. package/dist/components/property-selector.js +1 -1
  102. package/dist/components/rule-chip-popover.js +1 -1
  103. package/dist/esm/file-contents-url-Oswz9F3I.js +12 -0
  104. package/dist/esm/{filter-group-logic-BMY_GEsX.js → filter-group-logic-DS1inQTh.js} +12 -12
  105. package/dist/esm/{filter-operators-Lw-ccmxQ.js → filter-operators-CsZi5iCV.js} +11 -11
  106. package/dist/esm/{index.esm-C-L5fkQs.js → index.esm-BjIhvFKX.js} +200 -172
  107. package/dist/esm/index.js +2 -2
  108. package/dist/esm/lime-crm-building-blocks.js +1 -1
  109. package/dist/esm/{lime-query-validation-BwvluehW.js → lime-query-validation-CVV7mrLj.js} +7 -7
  110. package/dist/esm/limebb-browser.entry.js +1 -1
  111. package/dist/esm/limebb-chat-icon-list_3.entry.js +1 -1
  112. package/dist/esm/limebb-chat-list.entry.js +1 -1
  113. package/dist/esm/limebb-component-config.entry.js +1 -1
  114. package/dist/esm/limebb-component-picker.entry.js +1 -1
  115. package/dist/esm/limebb-composer-toolbar.entry.js +1 -1
  116. package/dist/esm/limebb-currency-picker.entry.js +1 -1
  117. package/dist/esm/limebb-data-cells.entry.js +1 -1
  118. package/dist/esm/limebb-date-picker.entry.js +1 -1
  119. package/dist/esm/limebb-feed-timeline-item.entry.js +5 -1
  120. package/dist/esm/limebb-feed.entry.js +1 -1
  121. package/dist/esm/limebb-filter-chip_6.entry.js +22 -22
  122. package/dist/esm/limebb-info-tile.entry.js +10 -9
  123. package/dist/esm/limebb-inline-image.entry.js +47 -0
  124. package/dist/esm/limebb-kanban-group.entry.js +2 -2
  125. package/dist/esm/limebb-kanban-item.entry.js +1 -1
  126. package/dist/esm/limebb-lime-query-builder.entry.js +3 -3
  127. package/dist/esm/limebb-lime-query-filter-builder.entry.js +5 -5
  128. package/dist/esm/limebb-lime-query-filter-comparison_2.entry.js +4 -4
  129. package/dist/esm/limebb-lime-query-order-by-editor_2.entry.js +2 -2
  130. package/dist/esm/limebb-lime-query-response-format-builder.entry.js +3 -3
  131. package/dist/esm/limebb-limeobject-file-viewer.entry.js +3 -3
  132. package/dist/esm/limebb-loader.entry.js +2 -2
  133. package/dist/esm/limebb-locale-picker.entry.js +1 -1
  134. package/dist/esm/limebb-mention.entry.js +1 -1
  135. package/dist/esm/limebb-notification-item.entry.js +1 -1
  136. package/dist/esm/limebb-notification-list.entry.js +1 -1
  137. package/dist/esm/limebb-object-chip.entry.js +3 -3
  138. package/dist/esm/limebb-percentage-visualizer.entry.js +1 -1
  139. package/dist/esm/limebb-property-selector.entry.js +3 -3
  140. package/dist/esm/limebb-rule-arg-filter-editor.entry.js +2 -2
  141. package/dist/esm/limebb-rule-chip-popover.entry.js +2 -2
  142. package/dist/esm/limebb-rule-editor.entry.js +2 -2
  143. package/dist/esm/limebb-rule-gate.entry.js +1 -1
  144. package/dist/esm/limebb-text-editor.entry.js +51 -144
  145. package/dist/esm/limebb-trend-indicator.entry.js +1 -1
  146. package/dist/esm/limebb-value-comparison-editor.entry.js +9 -9
  147. package/dist/esm/{limetype-D4ZaWZ-3.js → limetype-BbMRN-SU.js} +1 -1
  148. package/dist/esm/loader.js +1 -1
  149. package/dist/lime-crm-building-blocks/index.esm.js +1 -1
  150. package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
  151. package/dist/lime-crm-building-blocks/p-135ba2ee.entry.js +1 -0
  152. package/dist/lime-crm-building-blocks/p-1c6e5402.entry.js +1 -0
  153. package/dist/lime-crm-building-blocks/{p-9452fb56.entry.js → p-240cbd82.entry.js} +1 -1
  154. package/dist/lime-crm-building-blocks/{p-58f18819.entry.js → p-25984c90.entry.js} +1 -1
  155. package/dist/lime-crm-building-blocks/{p-80e04b27.entry.js → p-397a6191.entry.js} +1 -1
  156. package/dist/lime-crm-building-blocks/{p-a6e9cefe.entry.js → p-52a92d89.entry.js} +1 -1
  157. package/dist/lime-crm-building-blocks/p-585f6cfe.entry.js +1 -0
  158. package/dist/lime-crm-building-blocks/{p-05a1762a.entry.js → p-59fb624c.entry.js} +1 -1
  159. package/dist/lime-crm-building-blocks/{p-fb8d854b.entry.js → p-5beb508a.entry.js} +1 -1
  160. package/dist/lime-crm-building-blocks/{p-92bf5318.entry.js → p-662fb8b6.entry.js} +1 -1
  161. package/dist/lime-crm-building-blocks/{p-00ca6522.entry.js → p-673226a6.entry.js} +1 -1
  162. package/dist/lime-crm-building-blocks/{p-e242b955.entry.js → p-69b08896.entry.js} +1 -1
  163. package/dist/lime-crm-building-blocks/{p-01f84b0c.entry.js → p-6c2e25d9.entry.js} +1 -1
  164. package/dist/lime-crm-building-blocks/{p-3bf316f9.entry.js → p-742926a3.entry.js} +1 -1
  165. package/dist/lime-crm-building-blocks/p-78d362b4.entry.js +1 -0
  166. package/dist/lime-crm-building-blocks/p-79c492b2.entry.js +1 -0
  167. package/dist/lime-crm-building-blocks/{p-dba6f583.entry.js → p-7a5c2dda.entry.js} +1 -1
  168. package/dist/lime-crm-building-blocks/{p-354257f4.entry.js → p-7ce967b6.entry.js} +1 -1
  169. package/dist/lime-crm-building-blocks/{p-d40f53a5.entry.js → p-906b4eca.entry.js} +1 -1
  170. package/dist/lime-crm-building-blocks/p-CE43qjk3.js +1 -0
  171. package/dist/lime-crm-building-blocks/p-Cw4kdMw3.js +1 -0
  172. package/dist/lime-crm-building-blocks/p-DLehg4hi.js +1 -0
  173. package/dist/lime-crm-building-blocks/{p-CI6VHE0w.js → p-Dhyy9Td7.js} +1 -1
  174. package/dist/lime-crm-building-blocks/p-Oswz9F3I.js +1 -0
  175. package/dist/lime-crm-building-blocks/p-a3058b72.entry.js +1 -0
  176. package/dist/lime-crm-building-blocks/p-b78ub0mY.js +1 -0
  177. package/dist/lime-crm-building-blocks/{p-f3cb68d6.entry.js → p-bc297cf4.entry.js} +1 -1
  178. package/dist/lime-crm-building-blocks/{p-cac2a49f.entry.js → p-bcd8c767.entry.js} +1 -1
  179. package/dist/lime-crm-building-blocks/p-c4e5e589.entry.js +1 -0
  180. package/dist/lime-crm-building-blocks/{p-8986f27b.entry.js → p-d014ec57.entry.js} +1 -1
  181. package/dist/lime-crm-building-blocks/p-d20404ec.entry.js +1 -0
  182. package/dist/lime-crm-building-blocks/{p-fb050628.entry.js → p-d2e85be2.entry.js} +1 -1
  183. package/dist/lime-crm-building-blocks/{p-dec2b87d.entry.js → p-d3fe25a7.entry.js} +1 -1
  184. package/dist/lime-crm-building-blocks/{p-f1090436.entry.js → p-d43cf8d1.entry.js} +1 -1
  185. package/dist/lime-crm-building-blocks/{p-430e3d11.entry.js → p-dd7aec09.entry.js} +1 -1
  186. package/dist/lime-crm-building-blocks/{p-b34817df.entry.js → p-e2e1358d.entry.js} +1 -1
  187. package/dist/lime-crm-building-blocks/{p-c0fa239a.entry.js → p-e4a21ebe.entry.js} +1 -1
  188. package/dist/lime-crm-building-blocks/{p-c4e2dca5.entry.js → p-e581d0b7.entry.js} +1 -1
  189. package/dist/lime-crm-building-blocks/{p-863f456c.entry.js → p-e6a85c26.entry.js} +1 -1
  190. package/dist/lime-crm-building-blocks/p-e8b2df7c.entry.js +1 -0
  191. package/dist/lime-crm-building-blocks/{p-6fe4c1cd.entry.js → p-ef890206.entry.js} +1 -1
  192. package/dist/lime-crm-building-blocks/{p-d7d21bad.entry.js → p-f6377fa5.entry.js} +1 -1
  193. package/dist/lime-crm-building-blocks/p-f9e9d18e.entry.js +1 -0
  194. package/dist/test/setup.js +1 -0
  195. package/dist/types/components/inline-image/inline-image.d.ts +32 -0
  196. package/dist/types/components/text-editor/text-editor.d.ts +17 -11
  197. package/dist/types/components.d.ts +93 -14
  198. package/dist/types/interface.d.ts +0 -5
  199. package/dist/types/util/file-contents-url.d.ts +9 -0
  200. package/package.json +12 -13
  201. package/dist/collection/components/text-editor/uploader/building-blocks-upload-handler.js +0 -112
  202. package/dist/lime-crm-building-blocks/p-29758303.entry.js +0 -1
  203. package/dist/lime-crm-building-blocks/p-2dab7d4b.entry.js +0 -1
  204. package/dist/lime-crm-building-blocks/p-43bdd66b.entry.js +0 -1
  205. package/dist/lime-crm-building-blocks/p-752742f8.entry.js +0 -1
  206. package/dist/lime-crm-building-blocks/p-B-WBKAaa.js +0 -1
  207. package/dist/lime-crm-building-blocks/p-BjXRsiQr.js +0 -1
  208. package/dist/lime-crm-building-blocks/p-Bkno2RtN.js +0 -1
  209. package/dist/lime-crm-building-blocks/p-D1RJ1y7s.js +0 -1
  210. package/dist/lime-crm-building-blocks/p-c891125e.entry.js +0 -1
  211. package/dist/lime-crm-building-blocks/p-cd7106f7.entry.js +0 -1
  212. package/dist/lime-crm-building-blocks/p-dbbc5ba7.entry.js +0 -1
  213. package/dist/lime-crm-building-blocks/p-ec1e079e.entry.js +0 -1
  214. package/dist/lime-crm-building-blocks/p-edeb359f.entry.js +0 -1
  215. package/dist/types/components/text-editor/uploader/building-blocks-upload-handler.d.ts +0 -62
@@ -0,0 +1,32 @@
1
+ /**
2
+ * An inline image, referenced only by its file id so stored content stays
3
+ * portable. The contents URL is resolved at render time. Used for read-only
4
+ * rendering via `limel-markdown`; inside the editor the same tag is handled by
5
+ * `limel-text-editor`.
6
+ *
7
+ * @private
8
+ */
9
+ export declare class InlineImage {
10
+ /**
11
+ * Id of the file backing this image. Maps to the `image-id` attribute.
12
+ */
13
+ imageId: string;
14
+ /**
15
+ * Alternative text for the image.
16
+ */
17
+ alt: string;
18
+ /**
19
+ * Rendered width (e.g. `400` or `400px`).
20
+ */
21
+ width?: string;
22
+ /**
23
+ * Rendered height (e.g. `300` or `300px`).
24
+ */
25
+ height?: string;
26
+ private appName;
27
+ connectedCallback(): void;
28
+ render(): any;
29
+ private hasPlatform;
30
+ private toCssSize;
31
+ }
32
+ //# sourceMappingURL=inline-image.d.ts.map
@@ -2,7 +2,6 @@ import { CustomElementDefinition, EditorUiType, FormComponent, Languages } from
2
2
  import { LimeWebComponentContext, LimeWebComponentPlatform } from '@limetech/lime-web-components';
3
3
  import { EventEmitter } from '../../stencil-public-runtime';
4
4
  import { TriggerMap } from './text-editor.types';
5
- import { EnhancedEditorMetadata } from './uploader/building-blocks-upload-handler';
6
5
  /**
7
6
  * This component is a wrapper on the `limel-text-editor`. It adds support for platform
8
7
  * specific things that can't reside in lime-elements. So this is basically an
@@ -164,19 +163,24 @@ export declare class LimeBBTextEditor implements FormComponent<string> {
164
163
  triggerMap: TriggerMap;
165
164
  customElements: CustomElementDefinition[];
166
165
  /**
167
- * Enables image pasting in the editor.
166
+ * Enables pasting images into the editor.
168
167
  * Default: `false`
169
168
  *
169
+ * Existing inline images always render and round-trip regardless of this
170
+ * setting; it only controls whether the user can paste and upload new ones.
171
+ *
170
172
  * :::note
171
- * This component handles the upload process.
172
- * The consumer must process the uploaded images by listening to `metadataChange` event.
173
+ * This component handles the upload process and embeds pasted images
174
+ * directly in the editor content. Listen to `imageUploadingChange` to know
175
+ * when an upload is in progress (e.g. to disable a save button).
173
176
  * :::
174
177
  */
175
- allowInlineImages: boolean;
178
+ allowPasteImages: boolean;
176
179
  private items;
177
180
  private highlightedItemIndex;
178
181
  private editorPickerQuery;
179
182
  private searchableLimetypes;
183
+ private appName;
180
184
  /**
181
185
  * Open state of the picker
182
186
  */
@@ -191,9 +195,11 @@ export declare class LimeBBTextEditor implements FormComponent<string> {
191
195
  */
192
196
  change: EventEmitter<string>;
193
197
  /**
194
- * Dispatched when the metadata of the editor changes
198
+ * Dispatched when an inline image upload starts (`true`) and when all
199
+ * in-flight uploads have settled (`false`). Use it to gate actions that
200
+ * must wait for pasted images to finish uploading, such as saving.
195
201
  */
196
- metadataChange: EventEmitter<EnhancedEditorMetadata>;
202
+ imageUploadingChange: EventEmitter<boolean>;
197
203
  private registeredTriggers;
198
204
  private registeredTriggerMap;
199
205
  private registeredCustomElements;
@@ -205,7 +211,7 @@ export declare class LimeBBTextEditor implements FormComponent<string> {
205
211
  private textEditorPickerElement;
206
212
  private textEditorInnerId;
207
213
  private debouncedSearchFn;
208
- private uploadHandler;
214
+ private pendingUploads;
209
215
  protected watchOpen(): void;
210
216
  protected watchQuery(): void;
211
217
  constructor();
@@ -225,9 +231,9 @@ export declare class LimeBBTextEditor implements FormComponent<string> {
225
231
  private readonly handleEnterOrTabKey;
226
232
  render(): any[];
227
233
  private renderPicker;
228
- private readonly handleMetadataChange;
229
- private getEnhancedImages;
230
- private readonly handleImagePasted;
234
+ private get inlineImages();
235
+ private uploadImage;
236
+ private uploadFile;
231
237
  private readonly handleTriggerStart;
232
238
  private readonly handleTriggerStop;
233
239
  private readonly handleTriggerChange;
@@ -33,7 +33,6 @@ import { NavigationButtonType } from "./components/navigation-button/navigation-
33
33
  import { NotificationItem } from "./components/notification-list/notification-item/notification-item.types";
34
34
  import { RuleArgFilterEditorValue } from "./components/rule-editor/rule-arg-filter-editor/rule-arg-filter-editor";
35
35
  import { TriggerMap } from "./components/text-editor/text-editor.types";
36
- import { EnhancedEditorMetadata } from "./components/text-editor/uploader/building-blocks-upload-handler";
37
36
  import { ValueComparisonEditorValue } from "./components/rule-editor/value-comparison-editor/value-comparison-editor";
38
37
  export { AlertType } from "./components/alert-dialog/alert-dialog.types";
39
38
  export { AggregateOperator, ContextMap, ContextScope, Expression, JsonValue, LimeFileUrlType, LimeType, LimeWebComponentContext, LimeWebComponentPlatform, NotExpression, Operator, PrimitiveMetadata, PropertyType, Rule, RuleRef } from "@limetech/lime-web-components";
@@ -63,7 +62,6 @@ export { NavigationButtonType } from "./components/navigation-button/navigation-
63
62
  export { NotificationItem } from "./components/notification-list/notification-item/notification-item.types";
64
63
  export { RuleArgFilterEditorValue } from "./components/rule-editor/rule-arg-filter-editor/rule-arg-filter-editor";
65
64
  export { TriggerMap } from "./components/text-editor/text-editor.types";
66
- export { EnhancedEditorMetadata } from "./components/text-editor/uploader/building-blocks-upload-handler";
67
65
  export { ValueComparisonEditorValue } from "./components/rule-editor/value-comparison-editor/value-comparison-editor";
68
66
  export namespace Components {
69
67
  /**
@@ -1319,6 +1317,32 @@ export namespace Components {
1319
1317
  */
1320
1318
  "value": NumberFormat;
1321
1319
  }
1320
+ /**
1321
+ * An inline image, referenced only by its file id so stored content stays
1322
+ * portable. The contents URL is resolved at render time. Used for read-only
1323
+ * rendering via `limel-markdown`; inside the editor the same tag is handled by
1324
+ * `limel-text-editor`.
1325
+ * @private
1326
+ */
1327
+ interface LimebbInlineImage {
1328
+ /**
1329
+ * Alternative text for the image.
1330
+ * @default ''
1331
+ */
1332
+ "alt": string;
1333
+ /**
1334
+ * Rendered height (e.g. `300` or `300px`).
1335
+ */
1336
+ "height"?: string;
1337
+ /**
1338
+ * Id of the file backing this image. Maps to the `image-id` attribute.
1339
+ */
1340
+ "imageId": string;
1341
+ /**
1342
+ * Rendered width (e.g. `400` or `400px`).
1343
+ */
1344
+ "width"?: string;
1345
+ }
1322
1346
  /**
1323
1347
  * A Kanban board is a visual management tool that displays work items as
1324
1348
  * cards, organized into groups representing different stages of a workflow.
@@ -2641,15 +2665,15 @@ export namespace Components {
2641
2665
  */
2642
2666
  interface LimebbTextEditor {
2643
2667
  /**
2644
- * Enables image pasting in the editor. Default: `false` :::note This component handles the upload process. The consumer must process the uploaded images by listening to `metadataChange` event. :::
2668
+ * Set to true to enable mentioning a coworker or groups of coworkers. Mentions already present will still be rendered with a link to the coworker or the group of coworkers regardless of the value of this property
2645
2669
  * @default false
2646
2670
  */
2647
- "allowInlineImages": boolean;
2671
+ "allowMentioning": boolean;
2648
2672
  /**
2649
- * Set to true to enable mentioning a coworker or groups of coworkers. Mentions already present will still be rendered with a link to the coworker or the group of coworkers regardless of the value of this property
2673
+ * Enables pasting images into the editor. Default: `false` Existing inline images always render and round-trip regardless of this setting; it only controls whether the user can paste and upload new ones. :::note This component handles the upload process and embeds pasted images directly in the editor content. Listen to `imageUploadingChange` to know when an upload is in progress (e.g. to disable a save button). :::
2650
2674
  * @default false
2651
2675
  */
2652
- "allowMentioning": boolean;
2676
+ "allowPasteImages": boolean;
2653
2677
  /**
2654
2678
  * Set to `true` to allow the user to vertically resize the editor. Set to `false` to disable the resize functionality.
2655
2679
  * @default true
@@ -3888,6 +3912,19 @@ declare global {
3888
3912
  prototype: HTMLLimebbInfoTileUnitFormatElement;
3889
3913
  new (): HTMLLimebbInfoTileUnitFormatElement;
3890
3914
  };
3915
+ /**
3916
+ * An inline image, referenced only by its file id so stored content stays
3917
+ * portable. The contents URL is resolved at render time. Used for read-only
3918
+ * rendering via `limel-markdown`; inside the editor the same tag is handled by
3919
+ * `limel-text-editor`.
3920
+ * @private
3921
+ */
3922
+ interface HTMLLimebbInlineImageElement extends Components.LimebbInlineImage, HTMLStencilElement {
3923
+ }
3924
+ var HTMLLimebbInlineImageElement: {
3925
+ prototype: HTMLLimebbInlineImageElement;
3926
+ new (): HTMLLimebbInlineImageElement;
3927
+ };
3891
3928
  interface HTMLLimebbKanbanElementEventMap {
3892
3929
  "loadMore": KanbanGroup;
3893
3930
  "interact": KanbanItem;
@@ -4824,7 +4861,7 @@ declare global {
4824
4861
  };
4825
4862
  interface HTMLLimebbTextEditorElementEventMap {
4826
4863
  "change": string;
4827
- "metadataChange": EnhancedEditorMetadata;
4864
+ "imageUploadingChange": boolean;
4828
4865
  }
4829
4866
  /**
4830
4867
  * This component is a wrapper on the `limel-text-editor`. It adds support for platform
@@ -4983,6 +5020,7 @@ declare global {
4983
5020
  "limebb-info-tile-format": HTMLLimebbInfoTileFormatElement;
4984
5021
  "limebb-info-tile-relative-date-format": HTMLLimebbInfoTileRelativeDateFormatElement;
4985
5022
  "limebb-info-tile-unit-format": HTMLLimebbInfoTileUnitFormatElement;
5023
+ "limebb-inline-image": HTMLLimebbInlineImageElement;
4986
5024
  "limebb-kanban": HTMLLimebbKanbanElement;
4987
5025
  "limebb-kanban-group": HTMLLimebbKanbanGroupElement;
4988
5026
  "limebb-kanban-item": HTMLLimebbKanbanItemElement;
@@ -6384,6 +6422,32 @@ declare namespace LocalJSX {
6384
6422
  */
6385
6423
  "value"?: NumberFormat;
6386
6424
  }
6425
+ /**
6426
+ * An inline image, referenced only by its file id so stored content stays
6427
+ * portable. The contents URL is resolved at render time. Used for read-only
6428
+ * rendering via `limel-markdown`; inside the editor the same tag is handled by
6429
+ * `limel-text-editor`.
6430
+ * @private
6431
+ */
6432
+ interface LimebbInlineImage {
6433
+ /**
6434
+ * Alternative text for the image.
6435
+ * @default ''
6436
+ */
6437
+ "alt"?: string;
6438
+ /**
6439
+ * Rendered height (e.g. `300` or `300px`).
6440
+ */
6441
+ "height"?: string;
6442
+ /**
6443
+ * Id of the file backing this image. Maps to the `image-id` attribute.
6444
+ */
6445
+ "imageId"?: string;
6446
+ /**
6447
+ * Rendered width (e.g. `400` or `400px`).
6448
+ */
6449
+ "width"?: string;
6450
+ }
6387
6451
  /**
6388
6452
  * A Kanban board is a visual management tool that displays work items as
6389
6453
  * cards, organized into groups representing different stages of a workflow.
@@ -7813,15 +7877,15 @@ declare namespace LocalJSX {
7813
7877
  */
7814
7878
  interface LimebbTextEditor {
7815
7879
  /**
7816
- * Enables image pasting in the editor. Default: `false` :::note This component handles the upload process. The consumer must process the uploaded images by listening to `metadataChange` event. :::
7880
+ * Set to true to enable mentioning a coworker or groups of coworkers. Mentions already present will still be rendered with a link to the coworker or the group of coworkers regardless of the value of this property
7817
7881
  * @default false
7818
7882
  */
7819
- "allowInlineImages"?: boolean;
7883
+ "allowMentioning"?: boolean;
7820
7884
  /**
7821
- * Set to true to enable mentioning a coworker or groups of coworkers. Mentions already present will still be rendered with a link to the coworker or the group of coworkers regardless of the value of this property
7885
+ * Enables pasting images into the editor. Default: `false` Existing inline images always render and round-trip regardless of this setting; it only controls whether the user can paste and upload new ones. :::note This component handles the upload process and embeds pasted images directly in the editor content. Listen to `imageUploadingChange` to know when an upload is in progress (e.g. to disable a save button). :::
7822
7886
  * @default false
7823
7887
  */
7824
- "allowMentioning"?: boolean;
7888
+ "allowPasteImages"?: boolean;
7825
7889
  /**
7826
7890
  * Set to `true` to allow the user to vertically resize the editor. Set to `false` to disable the resize functionality.
7827
7891
  * @default true
@@ -7873,9 +7937,9 @@ declare namespace LocalJSX {
7873
7937
  */
7874
7938
  "onChange"?: (event: LimebbTextEditorCustomEvent<string>) => void;
7875
7939
  /**
7876
- * Dispatched when the metadata of the editor changes
7940
+ * Dispatched when an inline image upload starts (`true`) and when all in-flight uploads have settled (`false`). Use it to gate actions that must wait for pasted images to finish uploading, such as saving.
7877
7941
  */
7878
- "onMetadataChange"?: (event: LimebbTextEditorCustomEvent<EnhancedEditorMetadata>) => void;
7942
+ "onImageUploadingChange"?: (event: LimebbTextEditorCustomEvent<boolean>) => void;
7879
7943
  /**
7880
7944
  * The placeholder text shown inside the input field, when the field is empty.
7881
7945
  */
@@ -8220,6 +8284,12 @@ declare namespace LocalJSX {
8220
8284
  interface LimebbInfoTileFormatAttributes {
8221
8285
  "type": 'number' | 'date' | 'none';
8222
8286
  }
8287
+ interface LimebbInlineImageAttributes {
8288
+ "imageId": string;
8289
+ "alt": string;
8290
+ "width": string;
8291
+ "height": string;
8292
+ }
8223
8293
  interface LimebbKanbanGroupAttributes {
8224
8294
  "identifier": string;
8225
8295
  "heading": string;
@@ -8390,7 +8460,7 @@ declare namespace LocalJSX {
8390
8460
  "allowResize": boolean;
8391
8461
  "value": string;
8392
8462
  "draftIdentifier": string;
8393
- "allowInlineImages": boolean;
8463
+ "allowPasteImages": boolean;
8394
8464
  }
8395
8465
  interface LimebbTextEditorPickerAttributes {
8396
8466
  "open": boolean;
@@ -8441,6 +8511,7 @@ declare namespace LocalJSX {
8441
8511
  "limebb-info-tile-format": Omit<LimebbInfoTileFormat, keyof LimebbInfoTileFormatAttributes> & { [K in keyof LimebbInfoTileFormat & keyof LimebbInfoTileFormatAttributes]?: LimebbInfoTileFormat[K] } & { [K in keyof LimebbInfoTileFormat & keyof LimebbInfoTileFormatAttributes as `attr:${K}`]?: LimebbInfoTileFormatAttributes[K] } & { [K in keyof LimebbInfoTileFormat & keyof LimebbInfoTileFormatAttributes as `prop:${K}`]?: LimebbInfoTileFormat[K] };
8442
8512
  "limebb-info-tile-relative-date-format": LimebbInfoTileRelativeDateFormat;
8443
8513
  "limebb-info-tile-unit-format": LimebbInfoTileUnitFormat;
8514
+ "limebb-inline-image": Omit<LimebbInlineImage, keyof LimebbInlineImageAttributes> & { [K in keyof LimebbInlineImage & keyof LimebbInlineImageAttributes]?: LimebbInlineImage[K] } & { [K in keyof LimebbInlineImage & keyof LimebbInlineImageAttributes as `attr:${K}`]?: LimebbInlineImageAttributes[K] } & { [K in keyof LimebbInlineImage & keyof LimebbInlineImageAttributes as `prop:${K}`]?: LimebbInlineImage[K] };
8444
8515
  "limebb-kanban": LimebbKanban;
8445
8516
  "limebb-kanban-group": Omit<LimebbKanbanGroup, keyof LimebbKanbanGroupAttributes> & { [K in keyof LimebbKanbanGroup & keyof LimebbKanbanGroupAttributes]?: LimebbKanbanGroup[K] } & { [K in keyof LimebbKanbanGroup & keyof LimebbKanbanGroupAttributes as `attr:${K}`]?: LimebbKanbanGroupAttributes[K] } & { [K in keyof LimebbKanbanGroup & keyof LimebbKanbanGroupAttributes as `prop:${K}`]?: LimebbKanbanGroup[K] };
8446
8517
  "limebb-kanban-item": LimebbKanbanItem;
@@ -8905,6 +8976,14 @@ declare module "@stencil/core" {
8905
8976
  * @private
8906
8977
  */
8907
8978
  "limebb-info-tile-unit-format": LocalJSX.IntrinsicElements["limebb-info-tile-unit-format"] & JSXBase.HTMLAttributes<HTMLLimebbInfoTileUnitFormatElement>;
8979
+ /**
8980
+ * An inline image, referenced only by its file id so stored content stays
8981
+ * portable. The contents URL is resolved at render time. Used for read-only
8982
+ * rendering via `limel-markdown`; inside the editor the same tag is handled by
8983
+ * `limel-text-editor`.
8984
+ * @private
8985
+ */
8986
+ "limebb-inline-image": LocalJSX.IntrinsicElements["limebb-inline-image"] & JSXBase.HTMLAttributes<HTMLLimebbInlineImageElement>;
8908
8987
  /**
8909
8988
  * A Kanban board is a visual management tool that displays work items as
8910
8989
  * cards, organized into groups representing different stages of a workflow.
@@ -9,11 +9,6 @@ export * from './components/notification-list/notification-item/notification-ite
9
9
  export * from './components/browser/browser-item.types';
10
10
  export * from './components/text-editor/text-editor.types';
11
11
  export * from './util/basic-limetype-props';
12
- export {
13
- EnhancedEditorMetadata,
14
- EnhancedEditorImage,
15
- UploadHandler,
16
- } from './components/text-editor/uploader/building-blocks-upload-handler';
17
12
  export {
18
13
  FileUpload,
19
14
  FileStatus,
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Builds the contents URL for a stored file, relative to the application base.
3
+ *
4
+ * @param appName - the current application name
5
+ * @param fileId - the id of the file
6
+ * @returns the file contents URL
7
+ */
8
+ export declare function getFileContentsUrl(appName: string, fileId: string): string;
9
+ //# sourceMappingURL=file-contents-url.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-crm-building-blocks",
3
- "version": "1.140.0",
3
+ "version": "2.0.0",
4
4
  "description": "A home for shared components meant for use with Lime CRM",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -21,9 +21,8 @@
21
21
  "lint": "eslint --max-warnings=0 && prettier -c --ignore-path .gitignore **/*.scss",
22
22
  "lint:fix": "eslint --max-warnings=0 --fix && prettier --write --ignore-path .gitignore **/*.scss",
23
23
  "start": "stencil build --dev --watch --serve --docs",
24
- "test": "cross-env-shell TZ=Europe/Stockholm \"stencil test --spec --collect-coverage\"",
25
- "test:watch": "cross-env-shell TZ=Europe/Stockholm \"stencil test --spec --watchAll\"",
26
- "test:watch:cov": "npm run test:watch -- --collect-coverage",
24
+ "test": "cross-env-shell TZ=Europe/Stockholm \"vitest run --config vitest.config.mts --coverage\"",
25
+ "test:watch": "cross-env-shell TZ=Europe/Stockholm \"vitest --config vitest.config.mts\"",
27
26
  "generate": "stencil generate"
28
27
  },
29
28
  "repository": {
@@ -35,29 +34,29 @@
35
34
  },
36
35
  "devDependencies": {
37
36
  "@limetech/eslint-config": "^4.0.1",
38
- "@limetech/lime-elements": "^39.35.0",
39
- "@limetech/lime-web-components": "^6.26.0",
37
+ "@limetech/lime-elements": "^39.42.0",
38
+ "@limetech/lime-web-components": "^7.2.0",
40
39
  "@lundalogik/lime-icons8": "^2.41.0",
41
- "@lundalogik/limeclient.js": "^1.110.0",
40
+ "@lundalogik/limeclient.js": "^1.113.1",
42
41
  "@stencil/core": "^4.43.5",
43
42
  "@stencil/sass": "^3.2.3",
44
- "@types/jest": "^29.5.14",
43
+ "@stencil/vitest": "^1.13.3",
45
44
  "@types/json-schema": "^7.0.15",
46
45
  "@types/lodash-es": "^4.17.12",
46
+ "@vitest/coverage-v8": "^4.1.10",
47
47
  "cross-env": "^10.1.0",
48
48
  "currency-codes": "^2.2.0",
49
49
  "date-fns": "^4.4.0",
50
- "eslint": "^10.5.0",
50
+ "eslint": "^10.6.0",
51
51
  "fs": "^0.0.1-security",
52
52
  "globals": "^17.7.0",
53
- "jest": "^29.7.0",
54
- "jest-cli": "^29.7.0",
53
+ "happy-dom": "^20.10.6",
55
54
  "kompendium": "npm:@limetech/kompendium@^1.3.0",
56
55
  "lodash-es": "^4.18.1",
57
- "prettier": "^3.8.4",
58
- "puppeteer": "^25.2.1",
56
+ "prettier": "^3.9.4",
59
57
  "replace-in-file": "^7.2.0",
60
58
  "shelljs": "^0.10.0",
59
+ "vitest": "^4.1.9",
61
60
  "yargs": "^18.0.0"
62
61
  }
63
62
  }
@@ -1,112 +0,0 @@
1
- import { PlatformServiceName, } from "@limetech/lime-web-components";
2
- import { FileUpload, MAX_FILE_SIZE, } from "./building-blocks-uploader";
3
- const UPLOAD_COMPLETED = 100;
4
- export class UploadHandler {
5
- constructor(platform) {
6
- this.platform = platform;
7
- }
8
- /**
9
- * Handles image paste events in the text editor
10
- *
11
- * @param imageInserter - The image inserter with the file info
12
- * @returns Promise resolving to the uploaded file wrapper or undefined if upload fails
13
- */
14
- async handleImagePasted(imageInserter) {
15
- const fileInfo = imageInserter === null || imageInserter === void 0 ? void 0 : imageInserter.fileInfo;
16
- if (!fileInfo) {
17
- return;
18
- }
19
- if (!this.validateImageSize(fileInfo)) {
20
- return;
21
- }
22
- imageInserter.insertThumbnail();
23
- const uploadedFile = await this.createFileUpload(fileInfo);
24
- const fileUrl = uploadedFile === null || uploadedFile === void 0 ? void 0 : uploadedFile.href;
25
- const fileId = uploadedFile === null || uploadedFile === void 0 ? void 0 : uploadedFile.fileId;
26
- if (fileUrl && fileId !== undefined) {
27
- imageInserter.insertImage(fileUrl);
28
- }
29
- else {
30
- imageInserter.insertFailedThumbnail();
31
- }
32
- return uploadedFile;
33
- }
34
- /**
35
- * Extracts a file ID from a image source string.
36
- *
37
- * This function parses a URL to find a file ID that appears before
38
- * '/contents/' at the end of the URL.
39
- *
40
- * @param src - The URL string to parse
41
- * @returns The extracted file ID or undefined if no match is found
42
- *
43
- * @example
44
- * // Returns 123
45
- * parseFileIdFromSrc('/api/file/123/contents/');
46
- *
47
- * @example
48
- * // Returns 456
49
- * parseFileIdFromSrc('https://example.com/limepkg-email/api/v1/file/456/contents/');
50
- *
51
- * @example
52
- * // Returns undefined
53
- * parseFileIdFromSrc('/invalid/url/format/');
54
- */
55
- parseFileIdFromSrc(src) {
56
- if (src) {
57
- const regex = /\/(\d+)\/contents\/?$/;
58
- const matches = regex.exec(src);
59
- if (matches && matches[1]) {
60
- return Number(matches[1]);
61
- }
62
- }
63
- }
64
- /**
65
- * Validates that the image file size is within limits
66
- *
67
- * @param fileInfo - The file info to validate
68
- * @returns True if file size is valid, false otherwise
69
- */
70
- validateImageSize(fileInfo) {
71
- if (!fileInfo.fileContent) {
72
- return false;
73
- }
74
- return fileInfo.fileContent.size <= MAX_FILE_SIZE;
75
- }
76
- /**
77
- * Creates and uploads a file
78
- *
79
- * @param fileInfo - The file info to upload
80
- * @returns Promise resolving to the uploaded file wrapper or undefined if upload fails
81
- */
82
- async createFileUpload(fileInfo) {
83
- var _a;
84
- if (!fileInfo.fileContent) {
85
- return;
86
- }
87
- const imageFile = new FileUpload(fileInfo.fileContent, this.http);
88
- await imageFile.initialize();
89
- const imageUpload = Object.assign(Object.assign({}, fileInfo), { progress: 0, file: imageFile, state: 'added', fileId: undefined, href: undefined, id: fileInfo.id });
90
- imageFile.onProgress = (progress) => {
91
- if (imageUpload.progress === 0) {
92
- imageUpload.state = 'uploading';
93
- }
94
- imageUpload.progress = progress;
95
- if (progress === UPLOAD_COMPLETED) {
96
- imageUpload.state = 'finalizing';
97
- }
98
- };
99
- const response = await imageFile.upload();
100
- imageUpload.fileId = response.id;
101
- imageUpload.filename = response.filename;
102
- imageUpload.extension = response.extension;
103
- imageUpload.contentType = response.contentType;
104
- imageUpload.size = response.size;
105
- imageUpload.state = 'done';
106
- imageUpload.href = (_a = response._links) === null || _a === void 0 ? void 0 : _a.contents.href;
107
- return imageUpload;
108
- }
109
- get http() {
110
- return this.platform.get(PlatformServiceName.Http);
111
- }
112
- }
@@ -1 +0,0 @@
1
- import{r as t,c as o,h as i}from"./p-DwHAn7LS.js";import{L as e}from"./p-DI3GWqfD.js";import{b as n}from"./p-Bkno2RtN.js";import{g as r}from"./p-BsH0YW6Z.js";import"./p-BgAfMcRA.js";import"./p-6PYziigk.js";const s=class{constructor(i){t(this,i),this.change=o(this,"change"),this.value={},this.type="component",this.configViewType="code",this.findConfigComponent=t=>{var o,i;return"component"===this.type?null===(o=this.registry.getAll().find((o=>o.name===t)))||void 0===o?void 0:o.configComponent:"command"===this.type?null===(i=this.commandbus.getAll().find((o=>o.id===t)))||void 0===i?void 0:i.configComponent:void 0},this.handleChangeMode=t=>{t.stopPropagation(),this.configViewType=t.detail.id},this.handleCodeEditorChange=t=>{t.stopPropagation();try{const o=JSON.parse(t.detail);this.change.emit(o)}catch(t){}}}componentWillLoad(){this.configComponent=this.getComponentName()}componentShouldUpdate(t,o,i){return"formInfo"!==i}watchFormInfo(){this.configComponent=this.getComponentName()}watchconfigComponent(t,o){t&&!o&&(this.configViewType="config"),t||(this.configViewType="code")}getComponentName(){var t,o,i;const e=[...null!==(o=null===(t=this.formInfo)||void 0===t?void 0:t.schemaPath.slice(0,-1))&&void 0!==o?o:[],this.getNameField()],n=r(null===(i=this.formInfo)||void 0===i?void 0:i.rootValue,e),s=this.findConfigComponent(n);if(s&&customElements.get(s.name))return s}getSiblingPickerTags(){var t,o,i,e,n;const s=null===(t=this.formInfo)||void 0===t?void 0:t.rootSchema,l=null===(o=this.formInfo)||void 0===o?void 0:o.schemaPath;if(!s||!l)return;const d=l.slice(0,-1).flatMap((t=>["properties",t])),h=r(s,[...d,"properties"]);if(h&&"object"==typeof h)for(const t of Object.keys(h)){const o=null===(e=null===(i=h[t])||void 0===i?void 0:i.lime)||void 0===e?void 0:e.component;if("limebb-component-picker"===(null==o?void 0:o.name)&&Array.isArray(null===(n=null==o?void 0:o.props)||void 0===n?void 0:n.tags))return o.props.tags}}render(){return[this.renderHeader(),this.renderContent()]}renderHeader(){let t=[];return this.configComponent&&(t=[{id:"config",title:"Config",selected:"config"===this.configViewType},{id:"code",title:"Code",selected:"code"===this.configViewType}]),i("limel-header",{icon:"edit_property",heading:this.label,subheading:this.helperText},i("limel-button-group",{slot:"actions",value:t,onChange:this.handleChangeMode}))}renderContent(){return"config"===this.configViewType?this.renderConfigComponent():this.renderCodeEditor()}renderCodeEditor(){return i("limel-code-editor",{value:JSON.stringify(this.value,null,"\t"),language:"json",readonly:this.readonly,lineNumbers:!0,fold:!0,lint:!0,onChange:this.handleCodeEditorChange})}renderConfigComponent(){var t,o;const n=this.getSiblingPickerTags();return i(e,{class:"config-component",platform:this.platform,context:this.context,name:null===(t=this.configComponent)||void 0===t?void 0:t.name,props:Object.assign(Object.assign({},null===(o=this.configComponent)||void 0===o?void 0:o.props),{value:this.value,required:this.required,readonly:this.readonly,disabled:this.disabled,label:this.label,helperText:this.helperText,formInfo:this.formInfo,tags:n})})}getNameField(){return this.nameField?this.nameField:{component:"name",command:"id"}[this.type]}get registry(){return this.platform.get(n.WebComponentRegistry)}get commandbus(){return this.platform.get(n.CommandBus)}static get watchers(){return{formInfo:[{watchFormInfo:0}],configComponent:[{watchconfigComponent:0}]}}};s.style=":host(*){--header-background-color:rgb(var(--contrast-600));display:flex;flex-direction:column;border:1px dashed rgb(var(--contrast-700));overflow:clip;border-radius:0.75rem;background-color:rgb(var(--contrast-500))}*{box-sizing:border-box}.label{margin-top:1rem;margin-bottom:1rem}.config-component{display:grid;column-gap:1rem;row-gap:1rem;margin:1rem;grid-template-columns:repeat(3, minmax(0, 1fr))}";export{s as limebb_component_config}
@@ -1 +0,0 @@
1
- import{r as t,h as e,H as i,g as r}from"./p-DwHAn7LS.js";import{b as n}from"./p-Bkno2RtN.js";function o(t){return"type"in t&&"iconList"===t.type}function a(t){if("chat"===t.type||"iconList"===t.type)return t.item.timestamp}function s(t){for(const e of t.items)o(e)?t.processedItems.push({type:"iconList",item:e}):t.processedItems.push({type:"chat",item:e});return t}function l(t){if(!t.lastVisitedTimestamp)return t;const e=t.processedItems,i=t.lastVisitedTimestamp;for(let r=e.length-1;r>=0;r--){const n=e[r];if("group"!==n.type)continue;const o=c(n.items,i);if(-1!==o)return h(t,e,r,n,o)}return t}function c(t,e){for(let i=t.length-1;i>=0;i--){const r=a(t[i]);if(void 0!==r&&new Date(r)<=e)return i}return-1}function h(t,e,i,r,n){const o=n===r.items.length-1;if(o&&i===e.length-1)return t;if(o)return Object.assign(Object.assign({},t),{processedItems:[...e.slice(0,i+1),{type:"newItemIndicator"},...e.slice(i+1)]});const a=[...r.items.slice(0,n+1),{type:"newItemIndicator"},...r.items.slice(n+1)];return Object.assign(Object.assign({},t),{processedItems:[...e.slice(0,i),Object.assign(Object.assign({},r),{items:a}),...e.slice(i+1)]})}function d(t){const e=[];let i=null,r=null;for(const n of t.processedItems){if("chat"!==n.type&&"iconList"!==n.type)continue;const o=t.dateTimeFormatter.format(new Date(n.item.timestamp),"date");o===r?null==i||i.items.push(n):(i&&e.push(i),i={type:"group",groupType:"dateGroup",heading:o,items:[n]},r=o)}return i&&e.push(i),Object.assign(Object.assign({},t),{processedItems:e})}class m{constructor(t,e,i){this.scrollContainer=t,this.getOrder=e,this.isSticky=!0,this.paintedOrder=i}beforeRender(){this.scrollContainer.isConnected&&(this.isSticky=this.distanceFromNewestEdge(this.paintedOrder)<50)}afterRender(){this.scrollContainer.isConnected&&(this.paintedOrder=this.getOrder(),this.isSticky&&this.scrollToNewest())}repinIfSticky(){this.scrollContainer.isConnected&&this.isSticky&&this.scrollToNewest()}scrollToNewest(){const t="oldest-on-top"===this.getOrder()?this.scrollContainer.scrollHeight:0;this.scrollContainer.scrollTop!==t&&(this.scrollContainer.scrollTop=t)}distanceFromNewestEdge(t){return"oldest-on-top"===t?this.scrollContainer.scrollHeight-this.scrollContainer.scrollTop-this.scrollContainer.clientHeight:this.scrollContainer.scrollTop}}const p="grid-template-rows",g=class{constructor(e){var i;t(this,e),this.items=[],this.order="oldest-on-top",this.processedItems=[],this.handleHeightTransitionEnd=(i=()=>{var t;return null===(t=this.scrollAnchor)||void 0===t?void 0:t.repinIfSticky()},t=>{t.propertyName===p&&i()})}handleItemsChange(){let t=null;var e;this.lastVisitedTimestamp&&(t="string"==typeof(e=this.lastVisitedTimestamp)?new Date(Date.parse(e)):new Date(e));const i=(r={items:this.items,processedItems:[],lastVisitedTimestamp:t,dateTimeFormatter:this.dateTimeFormatter},[s,d,l].reduce(((t,e)=>e(t)),r)).processedItems;var r;this.processedItems="newest-on-top"===this.order?i.toReversed().map((t=>"group"!==t.type?t:Object.assign(Object.assign({},t),{items:t.items.toReversed()}))):i}componentWillLoad(){this.handleItemsChange(),this.scrollAnchor=new m(this.host,(()=>this.order),this.order)}componentDidLoad(){var t;!function(t){if(!t)return;const e=globalThis.getComputedStyle(t).transitionProperty;if(!e)return;const i=new Set(e.split(",").map((t=>t.trim())));i.has("all")||i.has(p)||console.warn(`[limebb-chat-list] Typing indicator is transitioning \`${e}\` instead of \`${p}\`. The auto-scroll on indicator appearance will not fire. Update the CSS or the handler so they match.`)}(null===(t=this.host.shadowRoot)||void 0===t?void 0:t.querySelector(".typing-indicator-height-animation"))}componentWillRender(){0!==this.items.length&&this.scrollAnchor.beforeRender()}componentDidRender(){0!==this.items.length&&this.scrollAnchor.afterRender()}render(){return e(i,{key:"2aab7c285dab2438761d90107c573060802863bf",class:{"is-empty":0===this.items.length&&!this.isTypingIndicatorVisible},"aria-busy":this.isBusy(),role:"log"},this.renderSpinner(),"newest-on-top"===this.order&&this.renderTypingIndicatorBlock(),this.renderChatItems(),"oldest-on-top"===this.order&&this.renderTypingIndicatorBlock())}renderSpinner(){if(this.loading)return e("limel-spinner",null)}renderTypingIndicatorBlock(){return e("div",{class:"typing-indicator-height-animation",onTransitionEnd:this.handleHeightTransitionEnd},e("div",null,this.renderTypingIndicator()))}renderTypingIndicator(){if(this.isTypingIndicatorVisible)return e("limebb-typing-indicator",null)}renderChatItems(){return this.processedItems.map((t=>{switch(t.type){case"group":return this.renderGroup(t);case"newItemIndicator":return this.renderIndicator();case"chat":case"iconList":return null;default:return b(t)}}))}renderGroup(t){const i=t.items.map((t=>{switch(t.type){case"chat":return this.renderChatItem(t.item);case"iconList":return this.renderIconList(t.item);case"newItemIndicator":return this.renderIndicator();case"group":return null;default:return b(t)}})),r="date-group-"+t.heading,n=`heading-${r}`.replaceAll(/[^a-zA-Z0-9_-]/g,"_"),o=e("a",{id:n,class:"date-heading",role:"heading","aria-level":2},t.heading);return e("section",{class:"date-group",key:r,"aria-labelledby":n},o,i)}renderChatItem(t){return e("limebb-chat-item",{platform:this.platform,context:this.context,item:t,helperText:t.helperText,hasError:t.hasError,key:t.id})}renderIconList(t){return e("limebb-chat-icon-list",{item:t,key:t.id})}renderIndicator(){return e("div",{class:"new-items-indicator",role:"separator"},e("hr",null),e("h3",null,this.translator.get("webclient.new")))}isBusy(){return this.loading||this.isTypingIndicatorVisible?"true":"false"}get dateTimeFormatter(){return this.platform.get(n.DateTimeFormatter)}get translator(){return this.platform.get(n.Translate)}get host(){return r(this)}static get watchers(){return{items:[{handleItemsChange:0}],order:[{handleItemsChange:0}]}}};function b(t){throw new Error(`Unexpected value in exhaustive switch: ${JSON.stringify(t)}`)}g.style='@charset "UTF-8";:host(limebb-chat-list){--limel-top-edge-fade-height:0.75rem;isolation:isolate;--limel-overflow-mask-vertical:linear-gradient( to bottom, transparent 0%, black calc(0% + var(--limel-top-edge-fade-height, 1rem)), black calc(100% - var(--limel-bottom-edge-fade-height, 1rem)), transparent 100% );-webkit-mask-image:var(--limel-overflow-mask-vertical);mask-image:var(--limel-overflow-mask-vertical);padding-top:var(--limel-top-edge-fade-height, 1rem);padding-bottom:var(--limel-bottom-edge-fade-height, 1rem);box-sizing:border-box;display:flex;flex-direction:column;gap:0.5rem;height:100%;width:100%;min-width:0;min-height:0;padding:var(--limel-top-edge-fade-height) 0.5rem;overflow:hidden auto}:host(limebb-chat-list.is-empty){padding:0}*{box-sizing:border-box}limel-spinner{align-self:center;justify-self:center;margin:auto}.date-group{isolation:isolate;display:flex;flex-direction:inherit;gap:0.5rem}.date-heading{position:sticky;z-index:1;top:0.25rem;display:flex;border-radius:9rem;padding:0.25rem 0.5rem;margin:0 auto;width:fit-content;font-size:0.75rem;line-height:1;color:rgb(var(--contrast-900));backdrop-filter:blur(0.5rem);-webkit-backdrop-filter:blur(0.5rem);transition:color 0.2s ease, border-color 0.4s ease}.date-heading:hover{color:rgb(var(--contrast-1000));border-color:rgb(var(--contrast-500))}.date-heading:hover:before{opacity:1}.date-heading:before{transition:opacity 0.2s ease;content:"";position:absolute;z-index:-1;inset:0;opacity:0.6;border-radius:inherit;background-color:rgb(var(--contrast-100))}.new-items-indicator{position:relative;isolation:isolate;display:flex;align-items:center;justify-content:flex-end;margin:0.25rem 0}.new-items-indicator hr{border:none;position:absolute;width:100%;height:1px;background-color:rgb(var(--color-red-lighter))}.new-items-indicator h3{z-index:1;padding:0 0.5rem;border-radius:1rem;margin:0 1rem;font-size:small;line-height:0.75rem;text-transform:lowercase;color:rgb(var(--color-red-default));background-color:rgb(var(--contrast-100))}.typing-indicator-height-animation{--limebb-chat-typing-opacity-transition-speed:0.1s;--limebb-chat-typing-opacity-transition-delay:0s;--limebb-chat-typing-grid-template-rows-transition-speed:0.3s;position:sticky;z-index:1;transition:grid-template-rows var(--limebb-chat-typing-grid-template-rows-transition-speed) ease;display:grid;grid-template-rows:0}.typing-indicator-height-animation div{transition:opacity var(--limebb-chat-typing-opacity-transition-speed) ease var(--limebb-chat-typing-opacity-transition-delay);overflow:hidden;opacity:0}:host(limebb-chat-list[order=oldest-on-top]) .typing-indicator-height-animation{bottom:0}:host(limebb-chat-list[order=newest-on-top]) .typing-indicator-height-animation{top:0}:host(limebb-chat-list[is-typing-indicator-visible]) .typing-indicator-height-animation{--limebb-chat-typing-opacity-transition-speed:0.4s;--limebb-chat-typing-opacity-transition-delay:0.3s;--limebb-chat-typing-grid-template-rows-transition-speed:0.46s;grid-template-rows:1.5rem}:host(limebb-chat-list[is-typing-indicator-visible]) .typing-indicator-height-animation div{opacity:1}.date-group limebb-chat-item{--limebb-promoted-action-bar-grid-template-rows:0fr}:host(limebb-chat-list[order=oldest-on-top]) .date-group:last-of-type limebb-chat-item:last-of-type{--limebb-promoted-action-bar-grid-template-rows:1fr}:host(limebb-chat-list[order=newest-on-top]) .date-group:first-of-type limebb-chat-item:first-of-type{--limebb-promoted-action-bar-grid-template-rows:1fr}';export{g as limebb_chat_list}
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as e,g as s}from"./p-DwHAn7LS.js";import{b as r,r as n,c as o,L as a}from"./p-Bkno2RtN.js";import{A as h,a as c,b as u,E as l,T as d}from"./p-CwMJvF_Z.js";import{o as f,U as v,c as m,a as b,d as p,n as g,i as y,S as j,g as w}from"./p-CtcTT7BK.js";import{d as O}from"./p-Ceen0vzd.js";import{c as x,e as S,S as k,i as C,a as A,r as T}from"./p-BgAfMcRA.js";import{c as I}from"./p-C2JP2nLw.js";import{h as F,b as E,c as M}from"./p-B-WBKAaa.js";import{i as P}from"./p-CkTg5UPD.js";import{i as N}from"./p-6PYziigk.js";var D=/\s/,L=/^\s+/;var R=/^[-+]0x[0-9a-f]+$/i,$=/^0b[01]+$/i,_=/^0o[0-7]+$/i,z=parseInt;function B(t){if("number"==typeof t)return t;if(N(t))return NaN;if(x(t)){var i="function"==typeof t.valueOf?t.valueOf():t;t=x(i)?i+"":i}if("string"!=typeof t)return 0===t?t:+t;var e;t=(e=t)?e.slice(0,function(t){for(var i=t.length;i--&&D.test(t.charAt(i)););return i}(e)+1).replace(L,""):e;var s=$.test(t);return s||_.test(t)?z(t.slice(2),s?2:8):R.test(t)?NaN:+t}var U=Object.create,G=function(){function t(){}return function(i){if(!x(i))return{};if(U)return U(i);t.prototype=i;var e=new t;return t.prototype=void 0,e}}(),W=Object.prototype.hasOwnProperty;var H=f(Object.getPrototypeOf,Object);"object"==typeof exports&&exports&&!exports.nodeType&&exports&&"object"==typeof module&&module&&!module.nodeType&&module;var K=Object.prototype.hasOwnProperty;function Q(t){var i=new t.constructor(t.byteLength);return new v(i).set(new v(t)),i}var q=/\w*$/,J=k?k.prototype:void 0,V=J?J.valueOf:void 0;var Y=g&&g.isMap,Z=Y?p(Y):function(t){return C(t)&&"[object Map]"==b(t)},X=g&&g.isSet,tt=X?p(X):function(t){return C(t)&&"[object Set]"==b(t)},it="[object Arguments]",et="[object Function]",st="[object Object]",rt={};function nt(t,i,e,s,r,n){var o;if(void 0!==o)return o;if(!x(t))return t;var a=A(t);if(a)o=function(t){var i=t.length,e=new t.constructor(i);return i&&"string"==typeof t[0]&&K.call(t,"index")&&(e.index=t.index,e.input=t.input),e}(t);else{var h=b(t),c=h==et||"[object GeneratorFunction]"==h;if(y(t))return t.slice();if(h==st||h==it||c&&!r)o=c?{}:function(t){return"function"!=typeof t.constructor||m(t)?{}:G(H(t))}(t);else{if(!rt[h])return r?t:{};o=function(t,i){var e,s,r,n,o=t.constructor;switch(i){case"[object ArrayBuffer]":return Q(t);case"[object Boolean]":case"[object Date]":return new o(+t);case"[object DataView]":return n=Q((r=t).buffer),new r.constructor(n,r.byteOffset,r.byteLength);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 i=Q(t.buffer);return new t.constructor(i,t.byteOffset,t.length)}(t);case"[object Map]":case"[object Set]":return new o;case"[object Number]":case"[object String]":return new o(t);case"[object RegExp]":return(s=new(e=t).constructor(e.source,q.exec(e))).lastIndex=e.lastIndex,s;case"[object Symbol]":return V?Object(V.call(t)):{}}}(t,h)}}n||(n=new j);var u=n.get(t);if(u)return u;n.set(t,o),tt(t)?t.forEach((function(s){o.add(nt(s,i,e,0,t,n))})):Z(t)&&t.forEach((function(s,r){o.set(r,nt(s,i,e,0,t,n))}));var l=a?void 0:w(t);return function(t,i){for(var e=-1,s=null==t?0:t.length;++e<s&&!1!==i(t[e],e););}(l||t,(function(s,r){l&&(s=t[r=s]),function(t,i,e){var s=t[i];W.call(t,i)&&S(s,e)&&(void 0!==e||i in t)||function(t,i,e){"__proto__"==i&&O?O(t,i,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[i]=e}(t,i,e)}(o,r,nt(s,i,e,0,t,n))})),o}rt[it]=rt["[object Array]"]=rt["[object ArrayBuffer]"]=rt["[object DataView]"]=rt["[object Boolean]"]=rt["[object Date]"]=rt["[object Float32Array]"]=rt["[object Float64Array]"]=rt["[object Int8Array]"]=rt["[object Int16Array]"]=rt["[object Int32Array]"]=rt["[object Map]"]=rt["[object Number]"]=rt[st]=rt["[object RegExp]"]=rt["[object Set]"]=rt["[object String]"]=rt["[object Symbol]"]=rt["[object Uint8Array]"]=rt["[object Uint8ClampedArray]"]=rt["[object Uint16Array]"]=rt["[object Uint32Array]"]=!0,rt["[object Error]"]=rt[et]=rt["[object WeakMap]"]=!1;var ot=function(){return T.Date.now()},at=Math.max,ht=Math.min;class ct{get limeObjectService(){return this.platform.get(r.LimeObjectRepository)}get queryService(){return this.platform.get(r.Query)}get viewFactoryRegistry(){return this.platform.get(r.ViewFactoryRegistry)}get contextRegistry(){return this.platform.get(r.ContextRegistry)}get translator(){var t;return null===(t=this.platform)||void 0===t?void 0:t.get(r.Translate)}get triggerCharacter(){return this._triggerCharacter}get triggerHandler(){return this._triggerHandler}constructor(t,i,e,s){this.platform=t,this.context=i,this.searchableLimetypes=e,this.host=s,this.groupCounts={},this._triggerCharacter="@",this._triggerHandler={searcher:t=>this.searcher(t),inserter:(t,i)=>this.inserter(t,i),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:i}=await this.limeObjectService.search(t,this.searchableLimetypes,10);return this.createSearchListItems(i)},this.inserter=async(t,i)=>{var e;const s=this.triggerHandler.nodeDefinition;s&&t.insert({node:{tagName:s.customElement.tagName,attributes:s.mapAttributes(i)},children:[null===(e=i.value)||void 0===e?void 0:e.descriptive]})}}async initialize(){await this.loadGroupCounts()}async loadGroupCounts(){const t=this.searchableLimetypes.filter((t=>!E(t,"user")&&F(t,"user"))).map((t=>this.getGroupCounts(t)));for(const i of await Promise.all(t))Object.assign(this.groupCounts,i)}async getGroupCounts(t){var i;const e=M(t,"user"),s=t.name;try{const t=await this.queryService.execute({limetype:s,responseFormat:{object:{_id:null,[e.name]:{count:{aggregate:{op:n.Count}}}}}});if(!(null===(i=t.objects)||void 0===i?void 0:i.length))return{[s]:{}};const r=this.createGroupCount(t.objects,e.name);return{[s]:r}}catch(i){return console.error(`Error fetching group count for limetype: ${t.name}`,i),{[s]:{}}}}createGroupCount(t,i){const e={};for(const s of t){const{_id:t,[i]:r}=s;e[t]=r.count}return e}createSearchListItems(t=[]){return t.map((t=>this.createSearchListItem(t))).filter(P)}createSearchListItem(t){const i=this.viewFactoryRegistry.getFactory("search"),e=this.limeObjectService.getObject(t._limetype,t._id);if(!e)return null;const s=i(e,this.contextRegistry.scope({host:this.host})),r=this.getGroupCountComponent(e);return Object.assign(Object.assign({},s),r?{primaryComponent:r}:{})}getGroupCountComponent(t){var i;const e=t.getLimetype(),s=null===(i=this.groupCounts[e.name])||void 0===i?void 0:i[t.id],r=M(e,"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 ut{constructor(t,i){this.file=t,this.http=i,this.uploadCancelled=!1,this.getUrl=t=>`api/v1/file/${null!=t?t:""}`}async initialize(){this.uploadService=await this.http.createFileUpload(o.Post,this.getUrl(),this.file),this.progressCallback&&(this.uploadService.onProgress=this.progressCallback)}async upload(){return this.uploadService.upload()}getFileName(){return this.file.name}cancel(){this.uploadService.cancel(),this.uploadCancelled=!0}set onProgress(t){this.progressCallback=t,this.uploadService&&(this.uploadService.onProgress=t)}}class lt{constructor(t){this.platform=t}async handleImagePasted(t){const i=null==t?void 0:t.fileInfo;if(!i)return;if(!this.validateImageSize(i))return;t.insertThumbnail();const e=await this.createFileUpload(i),s=null==e?void 0:e.href;return s&&void 0!==(null==e?void 0:e.fileId)?t.insertImage(s):t.insertFailedThumbnail(),e}parseFileIdFromSrc(t){if(t){const i=/\/(\d+)\/contents\/?$/.exec(t);if(i&&i[1])return Number(i[1])}}validateImageSize(t){return!!t.fileContent&&t.fileContent.size<=52428800}async createFileUpload(t){var i;if(!t.fileContent)return;const e=new ut(t.fileContent,this.http);await e.initialize();const s=Object.assign(Object.assign({},t),{progress:0,file:e,state:"added",fileId:void 0,href:void 0,id:t.id});e.onProgress=t=>{0===s.progress&&(s.state="uploading"),s.progress=t,100===t&&(s.state="finalizing")};const r=await e.upload();return s.fileId=r.id,s.filename=r.filename,s.extension=r.extension,s.contentType=r.contentType,s.size=r.size,s.state="done",s.href=null===(i=r._links)||void 0===i?void 0:i.contents.href,s}get http(){return this.platform.get(r.Http)}}const dt=class{watchOpen(){this.setupHandlers(),this.setPickerMessage()}watchQuery(){this.setPickerMessage()}constructor(e){t(this,e),this.change=i(this,"change"),this.metadataChange=i(this,"metadataChange"),this.allowMentioning=!1,this.contentType="markdown",this.language="en",this.disabled=!1,this.readonly=!1,this.invalid=!1,this.required=!1,this.ui="standard",this.allowResize=!0,this.value="",this.triggerMap={},this.customElements=[],this.allowInlineImages=!1,this.items=[],this.highlightedItemIndex=0,this.isPickerOpen=!1,this.isSearching=!1,this.registeredTriggers=[],this.registeredTriggerMap=this.triggerMap,this.registeredCustomElements=this.customElements,this.activeTrigger=void 0,this.handleMouseClick=t=>{this.textEditorPickerElement&&(t.target===this.textEditorPickerElement||this.resetTriggerAndPicker())},this.handleKeyPress=t=>{if(!this.isPickerOpen||!this.activeTrigger)return;if(![c,u,h,l,d].includes(t.key))return;if(t.stopPropagation(),t.preventDefault(),"keyup"===t.type)return;const i={[c]:this.handleEscapeKey,[l]:this.handleEnterOrTabKey,[d]:this.handleEnterOrTabKey,[h]:this.handleArrowKeyPress,[u]:this.handleArrowKeyPress}[t.key];i&&i(t)},this.handleArrowKeyPress=t=>{this.highlightedItemIndex=this.findNonSeparatorIndex(t.key,this.highlightedItemIndex)},this.findNonSeparatorIndex=(t,i,e=0)=>{if(0===this.items.length||e>this.items.length)return i;const s=((t,i,e)=>(i+(t===h?1:-1)+e)%e)(t,i,this.items.length);return this.isListSeparator(this.items[s])?this.findNonSeparatorIndex(t,s,e+1):s},this.handleEscapeKey=()=>{var t;null===(t=this.triggerFunction)||void 0===t||t.stopTrigger(),this.resetTriggerAndPicker()},this.handleEnterOrTabKey=t=>{this.handleItemSelection(t)},this.handleMetadataChange=t=>{t.stopPropagation();const i=t.detail,e=this.getEnhancedImages(i.images||[]),s=Object.assign(Object.assign({},i),{images:e});this.metadataChange.emit(s)},this.handleImagePasted=t=>{t.stopPropagation(),this.allowInlineImages&&this.uploadHandler.handleImagePasted(t.detail)},this.handleTriggerStart=t=>{t.stopPropagation(),this.activeTrigger=t.detail.trigger,this.triggerFunction=t.detail.textEditor,this.isPickerOpen=!0},this.handleTriggerStop=t=>{t.stopPropagation(),this.resetTriggerAndPicker()},this.handleTriggerChange=t=>{var i;t.stopImmediatePropagation(),this.editorPickerQuery=t.detail.value;const e=null===(i=this.registeredTriggerMap[t.detail.trigger])||void 0===i?void 0:i.searcher;e&&(this.isSearching=!0,this.debouncedSearchFn(e,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 i;let e;if(t instanceof CustomEvent)e=t.detail;else{if(!(t instanceof KeyboardEvent))return;{const t=this.items[this.highlightedItemIndex];if(this.isListSeparator(t))return;e=t}}if(!this.activeTrigger||(null==e?void 0:e.disabled))return;const s=this.registeredTriggerMap[this.activeTrigger];try{s.inserter(this.triggerFunction,e)}catch(t){console.error("Error inserting",t)}this.resetTriggerAndPicker(),null===(i=this.textEditor)||void 0===i||i.focus()},this.handleVisibilityChange=()=>{"hidden"===document.visibilityState&&this.saveDraft()},this.handleBeforeUnload=()=>{this.saveDraft()},this.portalId=I(),this.debouncedSearchFn=function(t,i,e){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(i){var e=s,n=r;return s=r=void 0,c=i,o=t.apply(n,e)}function v(t){var e=t-h;return void 0===h||e>=i||e<0||l&&t-c>=n}function m(){var t=ot();if(v(t))return b(t);a=setTimeout(m,function(t){var e=i-(t-h);return l?ht(e,n-(t-c)):e}(t))}function b(t){return a=void 0,d&&s?f(t):(s=r=void 0,o)}function p(){var t=ot(),e=v(t);if(s=arguments,r=this,h=t,e){if(void 0===a)return function(t){return c=t,a=setTimeout(m,i),u?f(t):o}(h);if(l)return clearTimeout(a),a=setTimeout(m,i),f(h)}return void 0===a&&(a=setTimeout(m,i)),o}return i=B(i)||0,x(e)&&(u=!!e.leading,n=(l="maxWait"in e)?at(B(e.maxWait)||0,i):n,d="trailing"in e?!!e.trailing:d),p.cancel=function(){void 0!==a&&clearTimeout(a),c=0,s=h=r=a=void 0},p.flush=function(){return void 0===a?o:b(ot())},p}((async(t,i)=>{try{const e=await t(i);if(i!==this.editorPickerQuery||!this.activeTrigger)return;this.items=e}catch(t){console.error("Error searching",t)}finally{this.isSearching=!1}}),300)}connectedCallback(){var t,i,e,s;if(this.draftIdentifier){const r=null!==(i=null===(t=this.context)||void 0===t?void 0:t.id)&&void 0!==i?i:"no-limeobject",n=null!==(s=null===(e=this.context)||void 0===e?void 0:e.limetype)&&void 0!==s?s:"no-limetype";this.textEditorInnerId=["text-editor-draft",n,r,this.draftIdentifier].join("-")}this.textEditorInnerId&&(document.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("beforeunload",this.handleBeforeUnload)),this.uploadHandler=new lt(this.platform)}componentWillLoad(){this.allowMentioning&&this.registerMentions(),this.registerTriggers(),this.loadDraft()}disconnectedCallback(){document.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("beforeunload",this.handleBeforeUnload),document.removeEventListener("mousedown",this.handleMouseClick),this.saveDraft(),this.host&&(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0})),this.debouncedSearchFn&&this.debouncedSearchFn.cancel&&this.debouncedSearchFn.cancel()}registerMentions(){const t=new ct(this.platform,this.context,this.searchableLimetypes,this.host),i=t.triggerHandler.nodeDefinition;i&&(this.registeredCustomElements.push(i.customElement),this.registeredTriggerMap[t.triggerCharacter]=t.triggerHandler,t.initialize())}registerTriggers(){this.registeredTriggers=Object.keys(this.registeredTriggerMap)}setPickerMessage(){var t;if(!this.activeTrigger)return;const i=this.registeredTriggerMap[this.activeTrigger];this.pickerMessage=(null===(t=this.editorPickerQuery)||void 0===t?void 0:t.length)>0?i.noItemsFoundMessage:i.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[e("limel-text-editor",{key:"0f637527386d51f5b5c3e3a49b42acebafcba3fd",ref:t=>this.textEditor=t,tabindex:this.disabled?-1:0,value:this.value,contentType:this.contentType,customElements:this.registeredCustomElements,"aria-disabled":this.disabled,language:this.language,triggers:this.registeredTriggers,onTriggerStart:this.handleTriggerStart,onTriggerStop:this.handleTriggerStop,onTriggerChange:this.handleTriggerChange,onImagePasted:this.handleImagePasted,onMetadataChange:this.handleMetadataChange,ui:this.ui,allowResize:this.allowResize,required:this.required,disabled:this.disabled,readonly:this.readonly,helperText:this.helperText,placeholder:this.placeholder,label:this.label,invalid:this.invalid}),this.renderPicker()]}renderPicker(){if(this.isPickerOpen)return e("limel-portal",{containerId:this.portalId,visible:this.isPickerOpen,openDirection:"top",inheritParentWidth:!0,anchor:this.textEditor},e("limebb-text-editor-picker",{ref:t=>this.textEditorPickerElement=t,items:(t=this.items,i=this.highlightedItemIndex,t.map(((t,e)=>{const s=nt(t,5);return Object.assign(Object.assign({},s),{selected:e===i})}))),onItemSelected:this.handleItemSelection,emptyMessage:this.pickerMessage,isSearching:this.isSearching}));var t,i}getEnhancedImages(t){return t.map((t=>{let i;return"success"===t.state&&(i=this.uploadHandler.parseFileIdFromSrc(t.src)),i?Object.assign(Object.assign({},t),{fileId:i}):t}))}loadDraft(){if(!this.userDataService||!this.textEditorInnerId)return;if(this.value)return;const t=this.userDataService.get(this.textEditorInnerId);t&&this.change.emit(t)}saveDraft(){var t,i,e,s;if(!this.textEditorInnerId)return;const r=null===(t=this.value)||void 0===t?void 0:t.trim(),n=null===(i=this.userDataService)||void 0===i?void 0:i.get(this.textEditorInnerId);r&&r!==n?null===(e=this.userDataService)||void 0===e||e.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(r.UserDataRepository)}static get delegatesFocus(){return!0}get host(){return s(this)}static get watchers(){return{isPickerOpen:[{watchOpen:0}],editorPickerQuery:[{watchQuery:0}]}}};(function(t,i,e,s){var r,n=arguments.length,o=n<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(i,e,o):r(i,e))||o);n>3&&o&&Object.defineProperty(i,e,o)})([a({map:[function(t){return Object.values(t).filter((t=>E(t,"user")||F(t,"user")))}]})],dt.prototype,"searchableLimetypes",void 0),dt.style=":host(limebb-text-editor){display:block;width:100%;min-width:5rem;min-height:5rem;height:100%;max-height:var(--text-editor-max-height, calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)) - 4rem))}";export{dt as limebb_text_editor}
@@ -1 +0,0 @@
1
- import{r as e,c as t}from"./p-DwHAn7LS.js";import{H as o,b as i}from"./p-Bkno2RtN.js";import{H as c}from"./p-BWMpG2bS.js";let n=class{constructor(e){this.itemId=e}};n=function(e,t,o,i){var c,n=arguments.length,s=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,i);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(n<3?c(s):n>3?c(t,o,s):c(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s}([o({id:"limebb-feed.highlight-item"})],n);const s="limetech.limeobject-matches-filter",l=class{constructor(o){e(this,o),this.loaded=t(this,"loaded")}connectedCallback(){}async componentWillLoad(){const e=new c;var t;this.platform.register(c.SERVICE_NAME,e),this.commandBus.register(n,e),(t=this.platform.get(i.RuleRegistry)).listPrimitives().some((e=>e.id===s))&&t.attachMetadata(s,{configComponent:{name:"limebb-rule-arg-filter-editor"}}),(()=>{this.platform.get(i.RuleRegistry).attachMetadata("limetech.value-comparison",{configComponent:{name:"limebb-value-comparison-editor"}})})(),this.loaded.emit()}componentWillUpdate(){}disconnectedCallback(){}get commandBus(){return this.platform.get(i.CommandBus)}};export{l as limebb_loader}
@@ -1 +0,0 @@
1
- import{i as n,a as o}from"./p-Bkno2RtN.js";function r(n){var o;return(r=(null===(o=null==n?void 0:n.ui)||void 0===o?void 0:o.color)||"rgb(var(--color-gray-default))").startsWith("lime-")?`var(--${r})`:r;var r}function t(n){var o;return{name:(null===(o=null==n?void 0:n.ui)||void 0===o?void 0:o.icon)||"decision",color:r(n)}}function i(n,o){return n.label===o}function e(n,o){return Object.values(n.properties).find((n=>n&&n.relation&&i(n.relation.getLimetype(),o)))}function u(r,t){const i=e(r,t);return!!i&&function(r){return n(r)&&!o(r)}(i)}function l(n){var o,r,t;const{targetLimetype:i,currentLimetype:e,contextLimetypeName:u,contextId:l,propertyName:v}=n;if(i&&u&&l){if(v){const n=null===(r=null===(o=null==e?void 0:e.getProperty(v))||void 0===o?void 0:o.relation)||void 0===r?void 0:r.getBackreference();if(n)return n.name}return null===(t=Object.values(i.properties).find((n=>{var o;return(null===(o=n.relation)||void 0===o?void 0:o.getLimetype().name)===u})))||void 0===t?void 0:t.name}}export{l as a,i as b,e as c,t as g,u as h}
@@ -1 +0,0 @@
1
- import{n}from"./p-Bkno2RtN.js";function e(e){return e.op===n.NOT?e.exp.op===n.AND?"NOT_AND":"NOT_OR":e.op===n.AND?"AND":"OR"}function t(e){return e.op===n.NOT?e.exp:e}function o(e,o){const r=t(e),p={op:"AND"===o||"NOT_AND"===o?n.AND:n.OR,exp:[...r.exp]};return"NOT_AND"===o||"NOT_OR"===o?{op:n.NOT,exp:p}:p}function r(e){if(e.op===n.AND||e.op===n.OR)return!0;if(e.op===n.NOT){const t=e.exp;return t.op===n.AND||t.op===n.OR}return!1}function p(n){return r(n)?n:void 0}function u(){return{key:"",op:n.EQUALS,exp:""}}function s(e){return{op:e===n.AND?n.OR:n.AND,exp:[u()]}}function i(n,e){return{op:n.op,exp:[...n.exp,e]}}function a(n,e,t){const o=[...n.exp];return t?(o[e]=t,{type:"updated",expression:{op:n.op,exp:o}}):(o.splice(e,1),0===o.length?{type:"removed",expression:void 0}:{type:"updated",expression:{op:n.op,exp:o}})}export{p as a,i as b,t as c,s as d,u as e,e as g,r as i,o as s,a as u}