@limetech/lime-crm-building-blocks 1.55.1 → 1.55.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## [1.55.3](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.55.2...v1.55.3) (2024-12-11)
2
+
3
+ ### Bug Fixes
4
+
5
+
6
+ * **text-editor:** don't explicitly add trigger ([7e02fa4](https://github.com/Lundalogik/lime-crm-building-blocks/commit/7e02fa4248d0bbe382cd9390376cc4680430ea2a))
7
+ * **text-editor:** use descriptive as fallback ([6012e65](https://github.com/Lundalogik/lime-crm-building-blocks/commit/6012e65ba45bc42b7e9a7c70baaf6efe39dbc2af)), closes [Lundalogik/crm-feature#4522](https://github.com/Lundalogik/crm-feature/issues/4522)
8
+
9
+ ## [1.55.2](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.55.1...v1.55.2) (2024-12-11)
10
+
11
+ ### Bug Fixes
12
+
13
+
14
+ * **mention:** display the `@` as a pseudo element ([2d8c171](https://github.com/Lundalogik/lime-crm-building-blocks/commit/2d8c171e9ad789f8979f7994b4e56f9010cf2a69))
15
+ * **mention:** ensure long- or multiple words break into new lines ([6a683a4](https://github.com/Lundalogik/lime-crm-building-blocks/commit/6a683a4eed05c42c705d4afa1ce53add98542cb3))
16
+ * **mention:** transition background color on hover ([c52e24f](https://github.com/Lundalogik/lime-crm-building-blocks/commit/c52e24f1fdaff3ec6c3b2e71ad327b55e6fd08f6))
17
+
1
18
  ## [1.55.1](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.55.0...v1.55.1) (2024-12-10)
2
19
 
3
20
  ### Bug Fixes
@@ -30,7 +30,7 @@ function isShadowRoot(node) {
30
30
  return (node === null || node === void 0 ? void 0 : node.nodeType) === Node.DOCUMENT_FRAGMENT_NODE;
31
31
  }
32
32
 
33
- const mentionCss = ":host(limebb-mention){display:inline-block}.mention{background-color:rgb(var(--color-blue-default), 0.1);color:rgb(var(--color-blue-default));padding:0.125rem 0.25rem;border-radius:0.25rem;text-decoration:none;white-space:nowrap}.mention-loading{background-color:rgb(var(--color-green-default), 0.1);color:rgb(var(--color-green-light));padding:0.125rem 0.25rem;border-radius:0.25rem;text-decoration:none;white-space:nowrap}.mention-failure{background-color:rgb(var(--color-red-default), 0.1);color:rgb(var(--color-red-light));padding:0.125rem 0.25rem;border-radius:0.25rem;text-decoration:none;white-space:nowrap}.mention:hover{background-color:rgb(var(--color-blue-default), 0.15)}";
33
+ const mentionCss = ":host(limebb-mention){display:inline}a{transition:background-color 0.2s ease;white-space:normal;overflow-wrap:break-word;word-break:break-word;padding:0 0.125rem;border-radius:0.25rem;text-decoration:none;color:rgb(var(--color-blue-default));background-color:rgb(var(--color-blue-default), 0.06)}a:hover{background-color:rgb(var(--color-blue-default), 0.16)}a:before,span:before{content:\"@\";opacity:0.7}";
34
34
 
35
35
  const Mention = class {
36
36
  constructor(hostRef) {
@@ -74,10 +74,10 @@ const Mention = class {
74
74
  return this.renderLimeObject(this.limeobject);
75
75
  }
76
76
  renderLimeObject(limeobject) {
77
- return (index.h("a", { class: "mention", href: `object/${this.limetype}/${this.objectid}` }, "@", limeobject.descriptive, this.renderSlot({ hidden: true })));
77
+ return (index.h("a", { href: `object/${this.limetype}/${this.objectid}` }, limeobject.descriptive, this.renderSlot({ hidden: true })));
78
78
  }
79
79
  renderSlot(attributes = {}) {
80
- return (index.h("span", Object.assign({}, attributes), "@", index.h("slot", null)));
80
+ return (index.h("span", Object.assign({}, attributes), index.h("slot", null)));
81
81
  }
82
82
  };
83
83
  Mention.style = mentionCss;
@@ -1328,7 +1328,7 @@ const LimeBBTextEditor = class {
1328
1328
  (_a = this.textEditor) === null || _a === void 0 ? void 0 : _a.focus();
1329
1329
  };
1330
1330
  this.insertEditorNode = (item) => {
1331
- var _a;
1331
+ var _a, _b;
1332
1332
  if (this.activeTrigger === undefined) {
1333
1333
  console.warn('No triggerMap found');
1334
1334
  return;
@@ -1340,7 +1340,7 @@ const LimeBBTextEditor = class {
1340
1340
  tagName: nodeDefinition.customElement.tagName,
1341
1341
  attributes: nodeDefinition.mapAttributes(item),
1342
1342
  },
1343
- children: [this.activeTrigger + item.text],
1343
+ children: [(_b = item.value) === null || _b === void 0 ? void 0 : _b.descriptive],
1344
1344
  });
1345
1345
  }
1346
1346
  catch (e) {
@@ -1,34 +1,24 @@
1
1
  :host(limebb-mention) {
2
- display: inline-block;
2
+ display: inline;
3
3
  }
4
4
 
5
- .mention {
6
- background-color: rgb(var(--color-blue-default), 0.1);
7
- color: rgb(var(--color-blue-default));
8
- padding: 0.125rem 0.25rem;
9
- border-radius: 0.25rem;
10
- text-decoration: none;
11
- white-space: nowrap;
12
- }
13
-
14
- .mention-loading {
15
- background-color: rgb(var(--color-green-default), 0.1);
16
- color: rgb(var(--color-green-light));
17
- padding: 0.125rem 0.25rem;
5
+ a {
6
+ transition: background-color 0.2s ease;
7
+ white-space: normal;
8
+ overflow-wrap: break-word;
9
+ word-break: break-word;
10
+ padding: 0 0.125rem;
18
11
  border-radius: 0.25rem;
19
12
  text-decoration: none;
20
- white-space: nowrap;
13
+ color: rgb(var(--color-blue-default));
14
+ background-color: rgb(var(--color-blue-default), 0.06);
21
15
  }
22
-
23
- .mention-failure {
24
- background-color: rgb(var(--color-red-default), 0.1);
25
- color: rgb(var(--color-red-light));
26
- padding: 0.125rem 0.25rem;
27
- border-radius: 0.25rem;
28
- text-decoration: none;
29
- white-space: nowrap;
16
+ a:hover {
17
+ background-color: rgb(var(--color-blue-default), 0.16);
30
18
  }
31
19
 
32
- .mention:hover {
33
- background-color: rgb(var(--color-blue-default), 0.15);
20
+ a:before,
21
+ span:before {
22
+ content: "@";
23
+ opacity: 0.7;
34
24
  }
@@ -8,6 +8,8 @@ import { getElement, h } from '@stencil/core';
8
8
  * been mentioned. The mentioned user descriptive should be added as a slot along with
9
9
  * the limetype and object id of the mentioned user object.
10
10
  *
11
+ * This component is internally used together with `limebb-text-editor` to
12
+ * render "mentioned" coworkers inside the `<p>` elements.
11
13
  *
12
14
  * :::note
13
15
  * Platform will be fetched from the DOM if not supplied
@@ -15,6 +17,7 @@ import { getElement, h } from '@stencil/core';
15
17
  *
16
18
  * @exampleComponent limebb-example-mention
17
19
  * @exampleComponent limebb-example-mention-with-invalid-object
20
+ * @exampleComponent limebb-example-mention-multi-lines
18
21
  * @private
19
22
  */
20
23
  export class Mention {
@@ -56,10 +59,10 @@ export class Mention {
56
59
  return this.renderLimeObject(this.limeobject);
57
60
  }
58
61
  renderLimeObject(limeobject) {
59
- return (h("a", { class: "mention", href: `object/${this.limetype}/${this.objectid}` }, "@", limeobject.descriptive, this.renderSlot({ hidden: true })));
62
+ return (h("a", { href: `object/${this.limetype}/${this.objectid}` }, limeobject.descriptive, this.renderSlot({ hidden: true })));
60
63
  }
61
64
  renderSlot(attributes = {}) {
62
- return (h("span", Object.assign({}, attributes), "@", h("slot", null)));
65
+ return (h("span", Object.assign({}, attributes), h("slot", null)));
63
66
  }
64
67
  static get is() { return "limebb-mention"; }
65
68
  static get encapsulation() { return "shadow"; }
@@ -209,7 +209,7 @@ export class LimeBBTextEditor {
209
209
  (_a = this.textEditor) === null || _a === void 0 ? void 0 : _a.focus();
210
210
  };
211
211
  this.insertEditorNode = (item) => {
212
- var _a;
212
+ var _a, _b;
213
213
  if (this.activeTrigger === undefined) {
214
214
  console.warn('No triggerMap found');
215
215
  return;
@@ -221,7 +221,7 @@ export class LimeBBTextEditor {
221
221
  tagName: nodeDefinition.customElement.tagName,
222
222
  attributes: nodeDefinition.mapAttributes(item),
223
223
  },
224
- children: [this.activeTrigger + item.text],
224
+ children: [(_b = item.value) === null || _b === void 0 ? void 0 : _b.descriptive],
225
225
  });
226
226
  }
227
227
  catch (e) {
@@ -26,7 +26,7 @@ function isShadowRoot(node) {
26
26
  return (node === null || node === void 0 ? void 0 : node.nodeType) === Node.DOCUMENT_FRAGMENT_NODE;
27
27
  }
28
28
 
29
- const mentionCss = ":host(limebb-mention){display:inline-block}.mention{background-color:rgb(var(--color-blue-default), 0.1);color:rgb(var(--color-blue-default));padding:0.125rem 0.25rem;border-radius:0.25rem;text-decoration:none;white-space:nowrap}.mention-loading{background-color:rgb(var(--color-green-default), 0.1);color:rgb(var(--color-green-light));padding:0.125rem 0.25rem;border-radius:0.25rem;text-decoration:none;white-space:nowrap}.mention-failure{background-color:rgb(var(--color-red-default), 0.1);color:rgb(var(--color-red-light));padding:0.125rem 0.25rem;border-radius:0.25rem;text-decoration:none;white-space:nowrap}.mention:hover{background-color:rgb(var(--color-blue-default), 0.15)}";
29
+ const mentionCss = ":host(limebb-mention){display:inline}a{transition:background-color 0.2s ease;white-space:normal;overflow-wrap:break-word;word-break:break-word;padding:0 0.125rem;border-radius:0.25rem;text-decoration:none;color:rgb(var(--color-blue-default));background-color:rgb(var(--color-blue-default), 0.06)}a:hover{background-color:rgb(var(--color-blue-default), 0.16)}a:before,span:before{content:\"@\";opacity:0.7}";
30
30
 
31
31
  const Mention = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
32
32
  constructor() {
@@ -72,10 +72,10 @@ const Mention = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
72
72
  return this.renderLimeObject(this.limeobject);
73
73
  }
74
74
  renderLimeObject(limeobject) {
75
- return (h("a", { class: "mention", href: `object/${this.limetype}/${this.objectid}` }, "@", limeobject.descriptive, this.renderSlot({ hidden: true })));
75
+ return (h("a", { href: `object/${this.limetype}/${this.objectid}` }, limeobject.descriptive, this.renderSlot({ hidden: true })));
76
76
  }
77
77
  renderSlot(attributes = {}) {
78
- return (h("span", Object.assign({}, attributes), "@", h("slot", null)));
78
+ return (h("span", Object.assign({}, attributes), h("slot", null)));
79
79
  }
80
80
  static get style() { return mentionCss; }
81
81
  }, [1, "limebb-mention", {
@@ -1327,7 +1327,7 @@ const LimeBBTextEditor = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
1327
1327
  (_a = this.textEditor) === null || _a === void 0 ? void 0 : _a.focus();
1328
1328
  };
1329
1329
  this.insertEditorNode = (item) => {
1330
- var _a;
1330
+ var _a, _b;
1331
1331
  if (this.activeTrigger === undefined) {
1332
1332
  console.warn('No triggerMap found');
1333
1333
  return;
@@ -1339,7 +1339,7 @@ const LimeBBTextEditor = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
1339
1339
  tagName: nodeDefinition.customElement.tagName,
1340
1340
  attributes: nodeDefinition.mapAttributes(item),
1341
1341
  },
1342
- children: [this.activeTrigger + item.text],
1342
+ children: [(_b = item.value) === null || _b === void 0 ? void 0 : _b.descriptive],
1343
1343
  });
1344
1344
  }
1345
1345
  catch (e) {
@@ -26,7 +26,7 @@ function isShadowRoot(node) {
26
26
  return (node === null || node === void 0 ? void 0 : node.nodeType) === Node.DOCUMENT_FRAGMENT_NODE;
27
27
  }
28
28
 
29
- const mentionCss = ":host(limebb-mention){display:inline-block}.mention{background-color:rgb(var(--color-blue-default), 0.1);color:rgb(var(--color-blue-default));padding:0.125rem 0.25rem;border-radius:0.25rem;text-decoration:none;white-space:nowrap}.mention-loading{background-color:rgb(var(--color-green-default), 0.1);color:rgb(var(--color-green-light));padding:0.125rem 0.25rem;border-radius:0.25rem;text-decoration:none;white-space:nowrap}.mention-failure{background-color:rgb(var(--color-red-default), 0.1);color:rgb(var(--color-red-light));padding:0.125rem 0.25rem;border-radius:0.25rem;text-decoration:none;white-space:nowrap}.mention:hover{background-color:rgb(var(--color-blue-default), 0.15)}";
29
+ const mentionCss = ":host(limebb-mention){display:inline}a{transition:background-color 0.2s ease;white-space:normal;overflow-wrap:break-word;word-break:break-word;padding:0 0.125rem;border-radius:0.25rem;text-decoration:none;color:rgb(var(--color-blue-default));background-color:rgb(var(--color-blue-default), 0.06)}a:hover{background-color:rgb(var(--color-blue-default), 0.16)}a:before,span:before{content:\"@\";opacity:0.7}";
30
30
 
31
31
  const Mention = class {
32
32
  constructor(hostRef) {
@@ -70,10 +70,10 @@ const Mention = class {
70
70
  return this.renderLimeObject(this.limeobject);
71
71
  }
72
72
  renderLimeObject(limeobject) {
73
- return (h("a", { class: "mention", href: `object/${this.limetype}/${this.objectid}` }, "@", limeobject.descriptive, this.renderSlot({ hidden: true })));
73
+ return (h("a", { href: `object/${this.limetype}/${this.objectid}` }, limeobject.descriptive, this.renderSlot({ hidden: true })));
74
74
  }
75
75
  renderSlot(attributes = {}) {
76
- return (h("span", Object.assign({}, attributes), "@", h("slot", null)));
76
+ return (h("span", Object.assign({}, attributes), h("slot", null)));
77
77
  }
78
78
  };
79
79
  Mention.style = mentionCss;
@@ -1324,7 +1324,7 @@ const LimeBBTextEditor = class {
1324
1324
  (_a = this.textEditor) === null || _a === void 0 ? void 0 : _a.focus();
1325
1325
  };
1326
1326
  this.insertEditorNode = (item) => {
1327
- var _a;
1327
+ var _a, _b;
1328
1328
  if (this.activeTrigger === undefined) {
1329
1329
  console.warn('No triggerMap found');
1330
1330
  return;
@@ -1336,7 +1336,7 @@ const LimeBBTextEditor = class {
1336
1336
  tagName: nodeDefinition.customElement.tagName,
1337
1337
  attributes: nodeDefinition.mapAttributes(item),
1338
1338
  },
1339
- children: [this.activeTrigger + item.text],
1339
+ children: [(_b = item.value) === null || _b === void 0 ? void 0 : _b.descriptive],
1340
1340
  });
1341
1341
  }
1342
1342
  catch (e) {
@@ -1 +1 @@
1
- import{p as e,b as t}from"./p-8e85017b.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((e=>t([["p-4b389d50",[[1,"limebb-feed",{platform:[16],context:[16],items:[16],emptyStateMessage:[1,"empty-state-message"],heading:[1],loading:[4],minutesOfProximity:[2,"minutes-of-proximity"],totalCount:[2,"total-count"],lastVisitedTimestamp:[1,"last-visited-timestamp"]}]]],["p-32ab34e5",[[1,"limebb-kanban",{platform:[16],context:[16],items:[16],paginationSize:[2,"pagination-size"],groupBy:[513,"group-by"],groups:[16]}]]],["p-3f9b33ca",[[1,"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],items:[32],highlightedItemIndex:[32],customElements:[32],registeredTriggers:[32],editorPickerQuery:[32],searchableLimetypes:[32],isPickerOpen:[32],isSearching:[32]}]]],["p-2e549d89",[[1,"limebb-date-range",{platform:[16],context:[16],startTime:[16],endTime:[16],startTimeLabel:[1,"start-time-label"],endTimeLabel:[1,"end-time-label"],language:[1],timeFormat:[1,"time-format"],type:[1]}]]],["p-beb4e864",[[1,"limebb-info-tile-currency-format",{platform:[16],context:[16],value:[16]}]]],["p-56654f3d",[[1,"limebb-notification-list",{platform:[16],context:[16],items:[16],loading:[4],lastVisitedTimestamp:[1,"last-visited-timestamp"]}]]],["p-c4e176ca",[[17,"limebb-browser",{platform:[16],context:[16],items:[16],layout:[1],filter:[32]}]]],["p-dc97e968",[[1,"limebb-component-config",{platform:[16],context:[16],value:[16],required:[4],readonly:[4],disabled:[4],label:[1],helperText:[1,"helper-text"],formInfo:[16],type:[1],nameField:[1,"name-field"],configComponent:[32],configViewType:[32]}]]],["p-3f66a22e",[[1,"limebb-component-picker",{platform:[16],context:[16],type:[1],tags:[16],value:[1],copyLabel:[1,"copy-label"],hideCopyButton:[4,"hide-copy-button"],required:[4],readonly:[4],disabled:[4],label:[1],helperText:[1,"helper-text"]}]]],["p-74dfea73",[[1,"limebb-dashboard-widget",{heading:[513],subheading:[513],supportingText:[513,"supporting-text"],icon:[513]}]]],["p-8aafd8fb",[[1,"limebb-icon-picker",{value:[1],required:[4],readonly:[4],invalid:[4],disabled:[4],label:[1],helperText:[1,"helper-text"]}]]],["p-949f5146",[[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],config:[32],filters:[32],value:[32],loading:[32],error:[32]}]]],["p-3602eb38",[[1,"limebb-info-tile-date-format",{value:[16]}]]],["p-87d08f0d",[[1,"limebb-info-tile-decimal-format",{value:[16]}]]],["p-2867f980",[[1,"limebb-info-tile-format",{platform:[16],context:[16],type:[1],value:[16]}]]],["p-c163374e",[[1,"limebb-info-tile-relative-date-format",{value:[16]}]]],["p-d0a17301",[[1,"limebb-info-tile-unit-format",{value:[16]}]]],["p-58416605",[[1,"limebb-limeobject-file-viewer",{platform:[16],context:[16],property:[1],fileTypes:[16],limeobject:[32],limetype:[32]}]]],["p-1acd64f5",[[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]}]]],["p-0b662fa5",[[1,"limebb-mention",{limetype:[1],objectid:[2],limeobject:[32]}]]],["p-25011706",[[17,"limebb-navigation-button",{href:[513],tooltipLabel:[513,"tooltip-label"],tooltipHelperLabel:[513,"tooltip-helper-label"],type:[513]}]]],["p-fd6bc5af",[[1,"limebb-kanban-column",{platform:[16],context:[16],columnHeading:[1,"column-heading"],items:[16],loading:[4],paginationSize:[2,"pagination-size"],displayedItemCount:[32]}]]],["p-a3aeec8e",[[1,"limebb-text-editor-picker",{items:[16],open:[516],isSearching:[4,"is-searching"],emptyMessage:[1,"empty-message"]}]]],["p-99a45f29",[[1,"limebb-currency-picker",{platform:[16],context:[16],label:[513],currencies:[16],helperText:[513,"helper-text"],required:[516],readonly:[516],invalid:[516],disabled:[516],value:[1]}]]],["p-bf3dfc8b",[[1,"limebb-date-picker",{platform:[16],context:[16],disabled:[516],readonly:[516],invalid:[516],label:[513],placeholder:[513],helperText:[513,"helper-text"],required:[516],value:[1],type:[513]}]]],["p-abdc6601",[[1,"limebb-feed-timeline-item",{platform:[16],context:[16],item:[16],ui:[513],isBundled:[516,"is-bundled"],headingCanExpand:[32],isHeadingExpanded:[32],showMore:[32],isTall:[32]}]]],["p-39b80f7a",[[1,"limebb-notification-item",{platform:[16],context:[16],item:[16]}]]],["p-9e9e54f3",[[1,"limebb-kanban-item",{platform:[16],context:[16],item:[16]}]]],["p-b4e15af7",[[1,"limebb-empty-state",{heading:[513],value:[513],icon:[16]}]]]],e)));
1
+ import{p as e,b as t}from"./p-8e85017b.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((e=>t([["p-4b389d50",[[1,"limebb-feed",{platform:[16],context:[16],items:[16],emptyStateMessage:[1,"empty-state-message"],heading:[1],loading:[4],minutesOfProximity:[2,"minutes-of-proximity"],totalCount:[2,"total-count"],lastVisitedTimestamp:[1,"last-visited-timestamp"]}]]],["p-32ab34e5",[[1,"limebb-kanban",{platform:[16],context:[16],items:[16],paginationSize:[2,"pagination-size"],groupBy:[513,"group-by"],groups:[16]}]]],["p-99f8e335",[[1,"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],items:[32],highlightedItemIndex:[32],customElements:[32],registeredTriggers:[32],editorPickerQuery:[32],searchableLimetypes:[32],isPickerOpen:[32],isSearching:[32]}]]],["p-2e549d89",[[1,"limebb-date-range",{platform:[16],context:[16],startTime:[16],endTime:[16],startTimeLabel:[1,"start-time-label"],endTimeLabel:[1,"end-time-label"],language:[1],timeFormat:[1,"time-format"],type:[1]}]]],["p-beb4e864",[[1,"limebb-info-tile-currency-format",{platform:[16],context:[16],value:[16]}]]],["p-56654f3d",[[1,"limebb-notification-list",{platform:[16],context:[16],items:[16],loading:[4],lastVisitedTimestamp:[1,"last-visited-timestamp"]}]]],["p-c4e176ca",[[17,"limebb-browser",{platform:[16],context:[16],items:[16],layout:[1],filter:[32]}]]],["p-dc97e968",[[1,"limebb-component-config",{platform:[16],context:[16],value:[16],required:[4],readonly:[4],disabled:[4],label:[1],helperText:[1,"helper-text"],formInfo:[16],type:[1],nameField:[1,"name-field"],configComponent:[32],configViewType:[32]}]]],["p-3f66a22e",[[1,"limebb-component-picker",{platform:[16],context:[16],type:[1],tags:[16],value:[1],copyLabel:[1,"copy-label"],hideCopyButton:[4,"hide-copy-button"],required:[4],readonly:[4],disabled:[4],label:[1],helperText:[1,"helper-text"]}]]],["p-74dfea73",[[1,"limebb-dashboard-widget",{heading:[513],subheading:[513],supportingText:[513,"supporting-text"],icon:[513]}]]],["p-8aafd8fb",[[1,"limebb-icon-picker",{value:[1],required:[4],readonly:[4],invalid:[4],disabled:[4],label:[1],helperText:[1,"helper-text"]}]]],["p-949f5146",[[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],config:[32],filters:[32],value:[32],loading:[32],error:[32]}]]],["p-3602eb38",[[1,"limebb-info-tile-date-format",{value:[16]}]]],["p-87d08f0d",[[1,"limebb-info-tile-decimal-format",{value:[16]}]]],["p-2867f980",[[1,"limebb-info-tile-format",{platform:[16],context:[16],type:[1],value:[16]}]]],["p-c163374e",[[1,"limebb-info-tile-relative-date-format",{value:[16]}]]],["p-d0a17301",[[1,"limebb-info-tile-unit-format",{value:[16]}]]],["p-58416605",[[1,"limebb-limeobject-file-viewer",{platform:[16],context:[16],property:[1],fileTypes:[16],limeobject:[32],limetype:[32]}]]],["p-1acd64f5",[[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]}]]],["p-6abd79e1",[[1,"limebb-mention",{limetype:[1],objectid:[2],limeobject:[32]}]]],["p-25011706",[[17,"limebb-navigation-button",{href:[513],tooltipLabel:[513,"tooltip-label"],tooltipHelperLabel:[513,"tooltip-helper-label"],type:[513]}]]],["p-fd6bc5af",[[1,"limebb-kanban-column",{platform:[16],context:[16],columnHeading:[1,"column-heading"],items:[16],loading:[4],paginationSize:[2,"pagination-size"],displayedItemCount:[32]}]]],["p-a3aeec8e",[[1,"limebb-text-editor-picker",{items:[16],open:[516],isSearching:[4,"is-searching"],emptyMessage:[1,"empty-message"]}]]],["p-99a45f29",[[1,"limebb-currency-picker",{platform:[16],context:[16],label:[513],currencies:[16],helperText:[513,"helper-text"],required:[516],readonly:[516],invalid:[516],disabled:[516],value:[1]}]]],["p-bf3dfc8b",[[1,"limebb-date-picker",{platform:[16],context:[16],disabled:[516],readonly:[516],invalid:[516],label:[513],placeholder:[513],helperText:[513,"helper-text"],required:[516],value:[1],type:[513]}]]],["p-abdc6601",[[1,"limebb-feed-timeline-item",{platform:[16],context:[16],item:[16],ui:[513],isBundled:[516,"is-bundled"],headingCanExpand:[32],isHeadingExpanded:[32],showMore:[32],isTall:[32]}]]],["p-39b80f7a",[[1,"limebb-notification-item",{platform:[16],context:[16],item:[16]}]]],["p-9e9e54f3",[[1,"limebb-kanban-item",{platform:[16],context:[16],item:[16]}]]],["p-b4e15af7",[[1,"limebb-empty-state",{heading:[513],value:[513],icon:[16]}]]]],e)));
@@ -0,0 +1 @@
1
+ import{r as t,g as o,h as r}from"./p-8e85017b.js";import{P as e}from"./p-4506e883.js";function i(t,o){if(o(t))return t;let r=t.parentElement||t.parentNode;var e;return(null==(e=r)?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&(r=r.host),r?i(r,o):void 0}const n=class{constructor(o){t(this,o)}connectedCallback(){const t=i(o(this),this.hasPlatform);t&&this.loadLimeObject(t.platform)}hasPlatform(t){return"platform"in t&&!!t.platform&&"object"==typeof t.platform}async loadLimeObject(t){const o=t.get(e.LimeObjectRepository);if(this.limeobject=o.getObject(this.limetype,this.objectid),!this.limeobject){try{await o.loadObject(this.limetype,this.objectid)}catch(t){console.error("Could not load mentioned object")}this.limeobject=o.getObject(this.limetype,this.objectid)}}render(){return this.limeobject?this.renderLimeObject(this.limeobject):this.renderSlot()}renderLimeObject(t){return r("a",{href:`object/${this.limetype}/${this.objectid}`},t.descriptive,this.renderSlot({hidden:!0}))}renderSlot(t={}){return r("span",Object.assign({},t),r("slot",null))}};n.style=':host(limebb-mention){display:inline}a{transition:background-color 0.2s ease;white-space:normal;overflow-wrap:break-word;word-break:break-word;padding:0 0.125rem;border-radius:0.25rem;text-decoration:none;color:rgb(var(--color-blue-default));background-color:rgb(var(--color-blue-default), 0.06)}a:hover{background-color:rgb(var(--color-blue-default), 0.16)}a:before,span:before{content:"@";opacity:0.7}';export{n as limebb_mention}
@@ -1 +1 @@
1
- import{r as t,c as e,h as r,g as i}from"./p-8e85017b.js";import{P as n}from"./p-4506e883.js";import{a as s}from"./p-db4425f5.js";import{A as o,a,b as c,E as u,T as h}from"./p-0086e532.js";import{d as f,b as v,k as l,c as d,s as b,a as p,e as m,U as j,S as y,g}from"./p-ef494ab2.js";import{i as w,e as O}from"./p-28e4e638.js";import{d as x,r as k,S as A,a as S,i as T}from"./p-e7281662.js";import{d as M,i as E,o as N,g as I,h as _,n as C,a as F}from"./p-f340c7e6.js";import{i as P}from"./p-86b9d9e8.js";import"./p-8b377b1f.js";var R=/\s/,$=/^\s+/;var U=/^[-+]0x[0-9a-f]+$/i,D=/^0b[01]+$/i,L=/^0o[0-7]+$/i,Q=parseInt;function W(t){if("number"==typeof t)return t;if(w(t))return NaN;if(x(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=x(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;var r;t=(r=t)?r.slice(0,function(t){for(var e=t.length;e--&&R.test(t.charAt(e)););return e}(r)+1).replace($,""):r;var i=D.test(t);return i||L.test(t)?Q(t.slice(2),i?2:8):U.test(t)?NaN:+t}var B=Object.create,q=function(){function t(){}return function(e){if(!x(e))return{};if(B)return B(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function z(t,e,r){"__proto__"==e&&f?f(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var G=Object.prototype.hasOwnProperty;function H(t,e,r){var i=t[e];G.call(t,e)&&O(i,r)&&(void 0!==r||e in t)||z(t,e,r)}function K(t,e,r,i){var n=!r;r||(r={});for(var s=-1,o=e.length;++s<o;){var a=e[s],c=i?i(r[a],t[a],a,r,t):void 0;void 0===c&&(c=t[a]),n?z(r,a,c):H(r,a,c)}return r}var V=Object.prototype.hasOwnProperty;function J(t){return E(t)?v(t,!0):function(t){if(!x(t))return function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}(t);var e=M(t),r=[];for(var i in t)("constructor"!=i||!e&&V.call(t,i))&&r.push(i);return r}(t)}var X=N(Object.getPrototypeOf,Object),Y="object"==typeof exports&&exports&&!exports.nodeType&&exports,Z=Y&&"object"==typeof module&&module&&!module.nodeType&&module,tt=Z&&Z.exports===Y?k.Buffer:void 0,et=tt?tt.allocUnsafe:void 0,rt=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)p(e,d(t)),t=X(t);return e}:b;function it(t){return m(t,J,rt)}var nt=Object.prototype.hasOwnProperty;function st(t){var e=new t.constructor(t.byteLength);return new j(e).set(new j(t)),e}var ot=/\w*$/,at=A?A.prototype:void 0,ct=at?at.valueOf:void 0;var ut=C&&C.isMap,ht=ut?_(ut):function(t){return S(t)&&"[object Map]"==I(t)},ft=C&&C.isSet,vt=ft?_(ft):function(t){return S(t)&&"[object Set]"==I(t)},lt={};function dt(t,e,r,i,n,s){var o,a=1&e,c=2&e,u=4&e;if(r&&(o=n?r(t,i,n,s):r(t)),void 0!==o)return o;if(!x(t))return t;var h=T(t);if(h){if(o=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&nt.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!a)return function(t,e){var r=-1,i=t.length;for(e||(e=Array(i));++r<i;)e[r]=t[r];return e}(t,o)}else{var f=I(t),v="[object Function]"==f||"[object GeneratorFunction]"==f;if(F(t))return function(t,e){if(e)return t.slice();var r=t.length,i=et?et(r):new t.constructor(r);return t.copy(i),i}(t,a);if("[object Object]"==f||"[object Arguments]"==f||v&&!n){if(o=c||v?{}:function(t){return"function"!=typeof t.constructor||M(t)?{}:q(X(t))}(t),!a)return c?function(t,e){return K(t,rt(t),e)}(t,function(t,e){return t&&K(e,J(e),t)}(o,t)):function(t,e){return K(t,d(t),e)}(t,function(t,e){return t&&K(e,l(e),t)}(o,t))}else{if(!lt[f])return n?t:{};o=function(t,e,r){var i,n,s=t.constructor;switch(e){case"[object ArrayBuffer]":return st(t);case"[object Boolean]":case"[object Date]":return new s(+t);case"[object DataView]":return function(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);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,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,r);case"[object Map]":return new s;case"[object Number]":case"[object String]":return new s(t);case"[object RegExp]":return(n=new(i=t).constructor(i.source,ot.exec(i))).lastIndex=i.lastIndex,n;case"[object Set]":return new s;case"[object Symbol]":return ct?Object(ct.call(t)):{}}}(t,f,a)}}s||(s=new y);var b=s.get(t);if(b)return b;s.set(t,o),vt(t)?t.forEach((function(i){o.add(dt(i,e,r,i,t,s))})):ht(t)&&t.forEach((function(i,n){o.set(n,dt(i,e,r,n,t,s))}));var p=h?void 0:(u?c?it:g:c?J:l)(t);return function(t,e){for(var r=-1,i=null==t?0:t.length;++r<i&&!1!==e(t[r],r););}(p||t,(function(i,n){p&&(i=t[n=i]),H(o,n,dt(i,e,r,n,t,s))})),o}lt["[object Arguments]"]=lt["[object Array]"]=lt["[object ArrayBuffer]"]=lt["[object DataView]"]=lt["[object Boolean]"]=lt["[object Date]"]=lt["[object Float32Array]"]=lt["[object Float64Array]"]=lt["[object Int8Array]"]=lt["[object Int16Array]"]=lt["[object Int32Array]"]=lt["[object Map]"]=lt["[object Number]"]=lt["[object Object]"]=lt["[object RegExp]"]=lt["[object Set]"]=lt["[object String]"]=lt["[object Symbol]"]=lt["[object Uint8Array]"]=lt["[object Uint8ClampedArray]"]=lt["[object Uint16Array]"]=lt["[object Uint32Array]"]=!0,lt["[object Error]"]=lt["[object Function]"]=lt["[object WeakMap]"]=!1;var bt=function(){return k.Date.now()},pt=Math.max,mt=Math.min;const jt=class{constructor(r){var i;t(this,r),this.change=e(this,"change",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.items=[],this.highlightedItemIndex=0,this.customElements=[],this.registeredTriggers=[],this.isPickerOpen=!1,this.isSearching=!1,this.activeTrigger=void 0,this.triggerMap={"@":{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.handleKeyPress=t=>{if(!this.isPickerOpen||!this.activeTrigger)return;if(![a,c,o,u,h].includes(t.key))return;if(t.stopPropagation(),t.preventDefault(),"keyup"===t.type)return;const e={[a]:this.handleEscapeKey,[u]:this.handleEnterOrTabKey,[h]:this.handleEnterOrTabKey,[o]:this.handleArrowKeyPress,[c]:this.handleArrowKeyPress}[t.key];e&&e(t)},this.handleArrowKeyPress=t=>{var e;this.highlightedItemIndex=(this.highlightedItemIndex+(t.key===o?1:-1)+(e=this.items.length))%e},this.handleEscapeKey=()=>{this.isPickerOpen=!1,this.stopTrigger()},this.handleEnterOrTabKey=t=>{this.handleItemSelection(t)},this.handleTriggerStart=t=>{t.stopPropagation(),this.isPickerOpen=!0,this.activeTrigger=t.detail.trigger,this.triggerFunction=t.detail.textEditor},this.handleTriggerStop=t=>{t.stopPropagation(),this.stopTrigger()},this.handleTriggerChange=t=>{t.stopImmediatePropagation(),this.editorPickerQuery=t.detail.value,this.search()},this.stopTrigger=()=>{this.isPickerOpen=!1,this.activeTrigger=void 0,this.triggerFunction=void 0,this.highlightedItemIndex=0},this.handleItemSelection=t=>{var e;let r;if(t instanceof CustomEvent)r=t.detail;else{if(!(t instanceof KeyboardEvent))return;r=this.items[this.highlightedItemIndex]}this.insertEditorNode(r),this.stopTrigger(),null===(e=this.textEditor)||void 0===e||e.focus()},this.insertEditorNode=t=>{var e;if(void 0===this.activeTrigger)return void console.warn("No triggerMap found");const r=this.triggerMap[this.activeTrigger];try{null===(e=this.triggerFunction)||void 0===e||e.insert({node:{tagName:r.customElement.tagName,attributes:r.mapAttributes(t)},children:[this.activeTrigger+t.text]})}catch(t){console.error("Can't insert node to the text editor",t)}},this.portalId="crypto"in window&&"function"==typeof(null===(i=window.crypto)||void 0===i?void 0:i.randomUUID)?"a_"+crypto.randomUUID():String.fromCharCode(97+Math.floor(26*Math.random()))+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2),this.search=function(t,e,r){var i,n,s,o,a,c,u=0,h=!1,f=!1,v=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function l(e){var r=i,s=n;return i=n=void 0,u=e,o=t.apply(s,r)}function d(t){return u=t,a=setTimeout(p,e),h?l(t):o}function b(t){var r=t-c;return void 0===c||r>=e||r<0||f&&t-u>=s}function p(){var t=bt();if(b(t))return m(t);a=setTimeout(p,function(t){var r=e-(t-c);return f?mt(r,s-(t-u)):r}(t))}function m(t){return a=void 0,v&&i?l(t):(i=n=void 0,o)}function j(){var t=bt(),r=b(t);if(i=arguments,n=this,c=t,r){if(void 0===a)return d(c);if(f)return clearTimeout(a),a=setTimeout(p,e),l(c)}return void 0===a&&(a=setTimeout(p,e)),o}return e=W(e)||0,x(r)&&(h=!!r.leading,s=(f="maxWait"in r)?pt(W(r.maxWait)||0,e):s,v="trailing"in r?!!r.trailing:v),j.cancel=function(){void 0!==a&&clearTimeout(a),u=0,i=c=n=a=void 0},j.flush=function(){return void 0===a?o:m(bt())},j}(this.search,300)}watchOpen(){this.setupHandlers()}watchQuery(){this.setPickerMessage()}componentWillLoad(){this.setCustomElementsAndTriggers()}disconnectedCallback(){this.host&&(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0}))}setCustomElementsAndTriggers(){this.customElements=Object.values(this.triggerMap).map((t=>t.customElement)),this.allowMentioning&&(this.registeredTriggers=Object.keys(this.triggerMap))}setPickerMessage(){this.pickerMessage=!0===this.isPickerOpen&&this.editorPickerQuery.length>0?"No results for your search...":"Start typing a name..."}setupHandlers(){this.isPickerOpen?(this.host.addEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.addEventListener("keydown",this.handleKeyPress,{capture:!0})):(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0}))}render(){return[r("limel-text-editor",{ref:t=>this.textEditor=t,tabindex:this.disabled?-1:0,value:this.value,contentType:this.contentType,customElements:this.customElements,"aria-disabled":this.disabled,language:this.language,triggers:this.registeredTriggers,onTriggerStart:this.handleTriggerStart,onTriggerStop:this.handleTriggerStop,onTriggerChange:this.handleTriggerChange,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 r("limel-portal",{containerId:this.portalId,visible:this.isPickerOpen,openDirection:"top",inheritParentWidth:!0,anchor:this.textEditor},r("limebb-text-editor-picker",{items:(t=this.items,e=this.highlightedItemIndex,t.map(((t,r)=>{const i=dt(t,5);return Object.assign(Object.assign({},i),{selected:r===e})}))),onItemSelected:this.handleItemSelection,emptyMessage:this.pickerMessage,isSearching:this.isSearching}));var t,e}async search(){if(!this.limeObjectService)return;this.isSearching=!0;const t=this.editorPickerQuery;try{const{objects:e}=await this.limeObjectService.search(t,this.searchableLimetypes,10);if(t!==this.editorPickerQuery)return;if(!e.length)return void(this.items=[]);this.items=this.createSearchListItems(e),this.isSearching=!1}catch(t){console.error("Failed search for user",t)}}createSearchListItems(t=[]){const e=this.viewFactoryRegistry.getFactory("search");return t.map((t=>{const r=this.limeObjectService.getObject(t._limetype,t._id);return r?e(r,this.context):null})).filter(P)}get limeObjectService(){return this.platform.get(n.LimeObjectRepository)}get viewFactoryRegistry(){return this.platform.get(n.ViewFactoryRegistry)}get host(){return i(this)}static get watchers(){return{isPickerOpen:["watchOpen"],editorPickerQuery:["watchQuery"]}}};!function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);s>3&&o&&Object.defineProperty(e,r,o)}([s({map:[function(t){return Object.values(t).filter((t=>"user"===t.label||function(t){const e=function(t){return Object.values(t.properties).find((t=>{var e,r;return"user"===(null===(r=null===(e=null==t?void 0:t.relation)||void 0===e?void 0:e.getLimetype())||void 0===r?void 0:r.label)}))}(t);return!!e&&(function(t){return t&&["belongsto","hasone","hasmany","hasandbelongstomany"].includes(t.type)}(r=e)&&!function(t){return t&&["belongsto","hasone"].includes(t.type)}(r))&&("user",!("user"===t.label));var r}(t)))}]})],jt.prototype,"searchableLimetypes",void 0);export{jt as limebb_text_editor}
1
+ import{r as t,c as e,h as r,g as i}from"./p-8e85017b.js";import{P as n}from"./p-4506e883.js";import{a as s}from"./p-db4425f5.js";import{A as o,a,b as c,E as u,T as h}from"./p-0086e532.js";import{d as f,b as v,k as l,c as d,s as b,a as p,e as m,U as j,S as y,g}from"./p-ef494ab2.js";import{i as w,e as O}from"./p-28e4e638.js";import{d as x,r as k,S as A,a as S,i as T}from"./p-e7281662.js";import{d as M,i as E,o as N,g as I,h as _,n as C,a as F}from"./p-f340c7e6.js";import{i as P}from"./p-86b9d9e8.js";import"./p-8b377b1f.js";var R=/\s/,$=/^\s+/;var U=/^[-+]0x[0-9a-f]+$/i,D=/^0b[01]+$/i,L=/^0o[0-7]+$/i,Q=parseInt;function W(t){if("number"==typeof t)return t;if(w(t))return NaN;if(x(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=x(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;var r;t=(r=t)?r.slice(0,function(t){for(var e=t.length;e--&&R.test(t.charAt(e)););return e}(r)+1).replace($,""):r;var i=D.test(t);return i||L.test(t)?Q(t.slice(2),i?2:8):U.test(t)?NaN:+t}var B=Object.create,q=function(){function t(){}return function(e){if(!x(e))return{};if(B)return B(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function z(t,e,r){"__proto__"==e&&f?f(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var G=Object.prototype.hasOwnProperty;function H(t,e,r){var i=t[e];G.call(t,e)&&O(i,r)&&(void 0!==r||e in t)||z(t,e,r)}function K(t,e,r,i){var n=!r;r||(r={});for(var s=-1,o=e.length;++s<o;){var a=e[s],c=i?i(r[a],t[a],a,r,t):void 0;void 0===c&&(c=t[a]),n?z(r,a,c):H(r,a,c)}return r}var V=Object.prototype.hasOwnProperty;function J(t){return E(t)?v(t,!0):function(t){if(!x(t))return function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}(t);var e=M(t),r=[];for(var i in t)("constructor"!=i||!e&&V.call(t,i))&&r.push(i);return r}(t)}var X=N(Object.getPrototypeOf,Object),Y="object"==typeof exports&&exports&&!exports.nodeType&&exports,Z=Y&&"object"==typeof module&&module&&!module.nodeType&&module,tt=Z&&Z.exports===Y?k.Buffer:void 0,et=tt?tt.allocUnsafe:void 0,rt=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)p(e,d(t)),t=X(t);return e}:b;function it(t){return m(t,J,rt)}var nt=Object.prototype.hasOwnProperty;function st(t){var e=new t.constructor(t.byteLength);return new j(e).set(new j(t)),e}var ot=/\w*$/,at=A?A.prototype:void 0,ct=at?at.valueOf:void 0;var ut=C&&C.isMap,ht=ut?_(ut):function(t){return S(t)&&"[object Map]"==I(t)},ft=C&&C.isSet,vt=ft?_(ft):function(t){return S(t)&&"[object Set]"==I(t)},lt={};function dt(t,e,r,i,n,s){var o,a=1&e,c=2&e,u=4&e;if(r&&(o=n?r(t,i,n,s):r(t)),void 0!==o)return o;if(!x(t))return t;var h=T(t);if(h){if(o=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&nt.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!a)return function(t,e){var r=-1,i=t.length;for(e||(e=Array(i));++r<i;)e[r]=t[r];return e}(t,o)}else{var f=I(t),v="[object Function]"==f||"[object GeneratorFunction]"==f;if(F(t))return function(t,e){if(e)return t.slice();var r=t.length,i=et?et(r):new t.constructor(r);return t.copy(i),i}(t,a);if("[object Object]"==f||"[object Arguments]"==f||v&&!n){if(o=c||v?{}:function(t){return"function"!=typeof t.constructor||M(t)?{}:q(X(t))}(t),!a)return c?function(t,e){return K(t,rt(t),e)}(t,function(t,e){return t&&K(e,J(e),t)}(o,t)):function(t,e){return K(t,d(t),e)}(t,function(t,e){return t&&K(e,l(e),t)}(o,t))}else{if(!lt[f])return n?t:{};o=function(t,e,r){var i,n,s=t.constructor;switch(e){case"[object ArrayBuffer]":return st(t);case"[object Boolean]":case"[object Date]":return new s(+t);case"[object DataView]":return function(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);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,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,r);case"[object Map]":return new s;case"[object Number]":case"[object String]":return new s(t);case"[object RegExp]":return(n=new(i=t).constructor(i.source,ot.exec(i))).lastIndex=i.lastIndex,n;case"[object Set]":return new s;case"[object Symbol]":return ct?Object(ct.call(t)):{}}}(t,f,a)}}s||(s=new y);var b=s.get(t);if(b)return b;s.set(t,o),vt(t)?t.forEach((function(i){o.add(dt(i,e,r,i,t,s))})):ht(t)&&t.forEach((function(i,n){o.set(n,dt(i,e,r,n,t,s))}));var p=h?void 0:(u?c?it:g:c?J:l)(t);return function(t,e){for(var r=-1,i=null==t?0:t.length;++r<i&&!1!==e(t[r],r););}(p||t,(function(i,n){p&&(i=t[n=i]),H(o,n,dt(i,e,r,n,t,s))})),o}lt["[object Arguments]"]=lt["[object Array]"]=lt["[object ArrayBuffer]"]=lt["[object DataView]"]=lt["[object Boolean]"]=lt["[object Date]"]=lt["[object Float32Array]"]=lt["[object Float64Array]"]=lt["[object Int8Array]"]=lt["[object Int16Array]"]=lt["[object Int32Array]"]=lt["[object Map]"]=lt["[object Number]"]=lt["[object Object]"]=lt["[object RegExp]"]=lt["[object Set]"]=lt["[object String]"]=lt["[object Symbol]"]=lt["[object Uint8Array]"]=lt["[object Uint8ClampedArray]"]=lt["[object Uint16Array]"]=lt["[object Uint32Array]"]=!0,lt["[object Error]"]=lt["[object Function]"]=lt["[object WeakMap]"]=!1;var bt=function(){return k.Date.now()},pt=Math.max,mt=Math.min;const jt=class{constructor(r){var i;t(this,r),this.change=e(this,"change",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.items=[],this.highlightedItemIndex=0,this.customElements=[],this.registeredTriggers=[],this.isPickerOpen=!1,this.isSearching=!1,this.activeTrigger=void 0,this.triggerMap={"@":{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.handleKeyPress=t=>{if(!this.isPickerOpen||!this.activeTrigger)return;if(![a,c,o,u,h].includes(t.key))return;if(t.stopPropagation(),t.preventDefault(),"keyup"===t.type)return;const e={[a]:this.handleEscapeKey,[u]:this.handleEnterOrTabKey,[h]:this.handleEnterOrTabKey,[o]:this.handleArrowKeyPress,[c]:this.handleArrowKeyPress}[t.key];e&&e(t)},this.handleArrowKeyPress=t=>{var e;this.highlightedItemIndex=(this.highlightedItemIndex+(t.key===o?1:-1)+(e=this.items.length))%e},this.handleEscapeKey=()=>{this.isPickerOpen=!1,this.stopTrigger()},this.handleEnterOrTabKey=t=>{this.handleItemSelection(t)},this.handleTriggerStart=t=>{t.stopPropagation(),this.isPickerOpen=!0,this.activeTrigger=t.detail.trigger,this.triggerFunction=t.detail.textEditor},this.handleTriggerStop=t=>{t.stopPropagation(),this.stopTrigger()},this.handleTriggerChange=t=>{t.stopImmediatePropagation(),this.editorPickerQuery=t.detail.value,this.search()},this.stopTrigger=()=>{this.isPickerOpen=!1,this.activeTrigger=void 0,this.triggerFunction=void 0,this.highlightedItemIndex=0},this.handleItemSelection=t=>{var e;let r;if(t instanceof CustomEvent)r=t.detail;else{if(!(t instanceof KeyboardEvent))return;r=this.items[this.highlightedItemIndex]}this.insertEditorNode(r),this.stopTrigger(),null===(e=this.textEditor)||void 0===e||e.focus()},this.insertEditorNode=t=>{var e,r;if(void 0===this.activeTrigger)return void console.warn("No triggerMap found");const i=this.triggerMap[this.activeTrigger];try{null===(e=this.triggerFunction)||void 0===e||e.insert({node:{tagName:i.customElement.tagName,attributes:i.mapAttributes(t)},children:[null===(r=t.value)||void 0===r?void 0:r.descriptive]})}catch(t){console.error("Can't insert node to the text editor",t)}},this.portalId="crypto"in window&&"function"==typeof(null===(i=window.crypto)||void 0===i?void 0:i.randomUUID)?"a_"+crypto.randomUUID():String.fromCharCode(97+Math.floor(26*Math.random()))+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2),this.search=function(t,e,r){var i,n,s,o,a,c,u=0,h=!1,f=!1,v=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function l(e){var r=i,s=n;return i=n=void 0,u=e,o=t.apply(s,r)}function d(t){return u=t,a=setTimeout(p,e),h?l(t):o}function b(t){var r=t-c;return void 0===c||r>=e||r<0||f&&t-u>=s}function p(){var t=bt();if(b(t))return m(t);a=setTimeout(p,function(t){var r=e-(t-c);return f?mt(r,s-(t-u)):r}(t))}function m(t){return a=void 0,v&&i?l(t):(i=n=void 0,o)}function j(){var t=bt(),r=b(t);if(i=arguments,n=this,c=t,r){if(void 0===a)return d(c);if(f)return clearTimeout(a),a=setTimeout(p,e),l(c)}return void 0===a&&(a=setTimeout(p,e)),o}return e=W(e)||0,x(r)&&(h=!!r.leading,s=(f="maxWait"in r)?pt(W(r.maxWait)||0,e):s,v="trailing"in r?!!r.trailing:v),j.cancel=function(){void 0!==a&&clearTimeout(a),u=0,i=c=n=a=void 0},j.flush=function(){return void 0===a?o:m(bt())},j}(this.search,300)}watchOpen(){this.setupHandlers()}watchQuery(){this.setPickerMessage()}componentWillLoad(){this.setCustomElementsAndTriggers()}disconnectedCallback(){this.host&&(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0}))}setCustomElementsAndTriggers(){this.customElements=Object.values(this.triggerMap).map((t=>t.customElement)),this.allowMentioning&&(this.registeredTriggers=Object.keys(this.triggerMap))}setPickerMessage(){this.pickerMessage=!0===this.isPickerOpen&&this.editorPickerQuery.length>0?"No results for your search...":"Start typing a name..."}setupHandlers(){this.isPickerOpen?(this.host.addEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.addEventListener("keydown",this.handleKeyPress,{capture:!0})):(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0}))}render(){return[r("limel-text-editor",{ref:t=>this.textEditor=t,tabindex:this.disabled?-1:0,value:this.value,contentType:this.contentType,customElements:this.customElements,"aria-disabled":this.disabled,language:this.language,triggers:this.registeredTriggers,onTriggerStart:this.handleTriggerStart,onTriggerStop:this.handleTriggerStop,onTriggerChange:this.handleTriggerChange,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 r("limel-portal",{containerId:this.portalId,visible:this.isPickerOpen,openDirection:"top",inheritParentWidth:!0,anchor:this.textEditor},r("limebb-text-editor-picker",{items:(t=this.items,e=this.highlightedItemIndex,t.map(((t,r)=>{const i=dt(t,5);return Object.assign(Object.assign({},i),{selected:r===e})}))),onItemSelected:this.handleItemSelection,emptyMessage:this.pickerMessage,isSearching:this.isSearching}));var t,e}async search(){if(!this.limeObjectService)return;this.isSearching=!0;const t=this.editorPickerQuery;try{const{objects:e}=await this.limeObjectService.search(t,this.searchableLimetypes,10);if(t!==this.editorPickerQuery)return;if(!e.length)return void(this.items=[]);this.items=this.createSearchListItems(e),this.isSearching=!1}catch(t){console.error("Failed search for user",t)}}createSearchListItems(t=[]){const e=this.viewFactoryRegistry.getFactory("search");return t.map((t=>{const r=this.limeObjectService.getObject(t._limetype,t._id);return r?e(r,this.context):null})).filter(P)}get limeObjectService(){return this.platform.get(n.LimeObjectRepository)}get viewFactoryRegistry(){return this.platform.get(n.ViewFactoryRegistry)}get host(){return i(this)}static get watchers(){return{isPickerOpen:["watchOpen"],editorPickerQuery:["watchQuery"]}}};!function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);s>3&&o&&Object.defineProperty(e,r,o)}([s({map:[function(t){return Object.values(t).filter((t=>"user"===t.label||function(t){const e=function(t){return Object.values(t.properties).find((t=>{var e,r;return"user"===(null===(r=null===(e=null==t?void 0:t.relation)||void 0===e?void 0:e.getLimetype())||void 0===r?void 0:r.label)}))}(t);return!!e&&(function(t){return t&&["belongsto","hasone","hasmany","hasandbelongstomany"].includes(t.type)}(r=e)&&!function(t){return t&&["belongsto","hasone"].includes(t.type)}(r))&&("user",!("user"===t.label));var r}(t)))}]})],jt.prototype,"searchableLimetypes",void 0);export{jt as limebb_text_editor}
@@ -5,6 +5,8 @@
5
5
  * been mentioned. The mentioned user descriptive should be added as a slot along with
6
6
  * the limetype and object id of the mentioned user object.
7
7
  *
8
+ * This component is internally used together with `limebb-text-editor` to
9
+ * render "mentioned" coworkers inside the `<p>` elements.
8
10
  *
9
11
  * :::note
10
12
  * Platform will be fetched from the DOM if not supplied
@@ -12,6 +14,7 @@
12
14
  *
13
15
  * @exampleComponent limebb-example-mention
14
16
  * @exampleComponent limebb-example-mention-with-invalid-object
17
+ * @exampleComponent limebb-example-mention-multi-lines
15
18
  * @private
16
19
  */
17
20
  export declare class Mention {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-crm-building-blocks",
3
- "version": "1.55.1",
3
+ "version": "1.55.3",
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",
@@ -43,10 +43,10 @@
43
43
  "devDependencies": {
44
44
  "@eslint/eslintrc": "^3.2.0",
45
45
  "@eslint/js": "^9.16.0",
46
- "@limetech/lime-elements": "^37.75.2",
46
+ "@limetech/lime-elements": "^37.76.0",
47
47
  "@limetech/lime-web-components": "^5.41.0",
48
48
  "@lundalogik/lime-icons8": "^2.30.1",
49
- "@lundalogik/limeclient.js": "^1.72.0",
49
+ "@lundalogik/limeclient.js": "^1.73.1",
50
50
  "@stencil/core": "<2.19.0",
51
51
  "@stencil/sass": "^3.0.12",
52
52
  "@types/jest": "^27.0.3",
@@ -1 +0,0 @@
1
- import{r,g as o,h as e}from"./p-8e85017b.js";import{P as t}from"./p-4506e883.js";function n(r,o){if(o(r))return r;let e=r.parentElement||r.parentNode;var t;return(null==(t=e)?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&(e=e.host),e?n(e,o):void 0}const i=class{constructor(o){r(this,o)}connectedCallback(){const r=n(o(this),this.hasPlatform);r&&this.loadLimeObject(r.platform)}hasPlatform(r){return"platform"in r&&!!r.platform&&"object"==typeof r.platform}async loadLimeObject(r){const o=r.get(t.LimeObjectRepository);if(this.limeobject=o.getObject(this.limetype,this.objectid),!this.limeobject){try{await o.loadObject(this.limetype,this.objectid)}catch(r){console.error("Could not load mentioned object")}this.limeobject=o.getObject(this.limetype,this.objectid)}}render(){return this.limeobject?this.renderLimeObject(this.limeobject):this.renderSlot()}renderLimeObject(r){return e("a",{class:"mention",href:`object/${this.limetype}/${this.objectid}`},"@",r.descriptive,this.renderSlot({hidden:!0}))}renderSlot(r={}){return e("span",Object.assign({},r),"@",e("slot",null))}};i.style=":host(limebb-mention){display:inline-block}.mention{background-color:rgb(var(--color-blue-default), 0.1);color:rgb(var(--color-blue-default));padding:0.125rem 0.25rem;border-radius:0.25rem;text-decoration:none;white-space:nowrap}.mention-loading{background-color:rgb(var(--color-green-default), 0.1);color:rgb(var(--color-green-light));padding:0.125rem 0.25rem;border-radius:0.25rem;text-decoration:none;white-space:nowrap}.mention-failure{background-color:rgb(var(--color-red-default), 0.1);color:rgb(var(--color-red-light));padding:0.125rem 0.25rem;border-radius:0.25rem;text-decoration:none;white-space:nowrap}.mention:hover{background-color:rgb(var(--color-blue-default), 0.15)}";export{i as limebb_mention}