@lucca-front/ng 22.0.1-rc.1 → 22.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/fesm2022/lucca-front-ng-core-select-api.mjs +1 -0
  2. package/fesm2022/lucca-front-ng-core-select-api.mjs.map +1 -1
  3. package/fesm2022/lucca-front-ng-core-select-establishment.mjs +32 -9
  4. package/fesm2022/lucca-front-ng-core-select-establishment.mjs.map +1 -1
  5. package/fesm2022/lucca-front-ng-core-select-job-qualification.mjs +11 -0
  6. package/fesm2022/lucca-front-ng-core-select-job-qualification.mjs.map +1 -1
  7. package/fesm2022/lucca-front-ng-data-table.mjs +2 -2
  8. package/fesm2022/lucca-front-ng-data-table.mjs.map +1 -1
  9. package/fesm2022/lucca-front-ng-dialog.mjs +2 -2
  10. package/fesm2022/lucca-front-ng-dialog.mjs.map +1 -1
  11. package/fesm2022/lucca-front-ng-forms-rich-text-input-formatters-plain-text.mjs +5 -2
  12. package/fesm2022/lucca-front-ng-forms-rich-text-input-formatters-plain-text.mjs.map +1 -1
  13. package/fesm2022/lucca-front-ng-forms-rich-text-input.mjs +52 -20
  14. package/fesm2022/lucca-front-ng-forms-rich-text-input.mjs.map +1 -1
  15. package/fesm2022/lucca-front-ng-index-table.mjs +2 -2
  16. package/fesm2022/lucca-front-ng-index-table.mjs.map +1 -1
  17. package/fesm2022/lucca-front-ng-multi-select.mjs +2 -2
  18. package/fesm2022/lucca-front-ng-multi-select.mjs.map +1 -1
  19. package/package.json +4 -4
  20. package/src/components/_listbox.scss +12 -6
  21. package/types/lucca-front-ng-core-select-api.d.ts +6 -0
  22. package/types/lucca-front-ng-core-select-establishment.d.ts +7 -0
  23. package/types/lucca-front-ng-core-select-job-qualification.d.ts +8 -0
  24. package/types/lucca-front-ng-forms-rich-text-input.d.ts +3 -2
@@ -1 +1 @@
1
- {"version":3,"file":"lucca-front-ng-forms-rich-text-input-formatters-plain-text.mjs","sources":["../../../packages/ng/forms/rich-text-input/formatters/plain-text/transformers/tag.transformers.ts","../../../packages/ng/forms/rich-text-input/formatters/plain-text/plain-text-formatter.ts","../../../packages/ng/forms/rich-text-input/formatters/plain-text/plain-text-formatter.directive.ts","../../../packages/ng/forms/rich-text-input/formatters/plain-text/lucca-front-ng-forms-rich-text-input-formatters-plain-text.ts"],"sourcesContent":["import { $createTagNode } from '@lucca-front/ng/forms/rich-text-input';\nimport { PlainTextTransformer } from './plain-text-transformer';\n\n/**\n * Transformer for tag nodes\n * It will match the following pattern `{{Tag}}` and create a TagNode (using `replace` function).\n *\n */\nexport const PLAINTEXT_TAGS: PlainTextTransformer = {\n\tregExp: /{{(\\w+)}}/,\n\treplace: (textNode, match) => {\n\t\tif (match[1]) {\n\t\t\ttextNode.replace($createTagNode(match[1].trim()));\n\t\t}\n\t},\n};\n","import { Provider } from '@angular/core';\nimport { registerPlainText } from '@lexical/plain-text';\nimport { $rootTextContent } from '@lexical/text';\nimport { RICH_TEXT_FORMATTER, RichTextFormatter } from '@lucca-front/ng/forms/rich-text-input';\nimport { $createParagraphNode, $createTextNode, $getRoot, LexicalEditor, TextNode } from 'lexical';\nimport { PLAINTEXT_TAGS, PlainTextTransformer } from './transformers';\n\nexport class PlainTextFormatter extends RichTextFormatter {\n\t#transformers: PlainTextTransformer[] = [PLAINTEXT_TAGS];\n\n\tconstructor(transformers?: PlainTextTransformer[]) {\n\t\tsuper();\n\t\tif (transformers) {\n\t\t\tthis.#transformers = transformers;\n\t\t}\n\t}\n\n\toverride registerTextPlugin(editor: LexicalEditor) {\n\t\treturn registerPlainText(editor);\n\t}\n\n\toverride parse(editor: LexicalEditor, text?: string | null): void {\n\t\teditor.update(() => {\n\t\t\tconst rootNode = $getRoot();\n\t\t\trootNode.clear();\n\t\t\tif (text) {\n\t\t\t\tconst paragraphNode = $createParagraphNode();\n\t\t\t\tconst textNode = $createTextNode(text);\n\t\t\t\tparagraphNode.append(textNode);\n\t\t\t\trootNode.append(paragraphNode);\n\t\t\t\tthis.#applyTransformers(textNode);\n\t\t\t}\n\t\t});\n\t}\n\n\toverride format(editor: LexicalEditor): string {\n\t\tlet result = '';\n\t\teditor.getEditorState().read(() => (result = $rootTextContent()));\n\t\treturn result;\n\t}\n\n\t#applyTransformers(textNode: TextNode): void {\n\t\tfor (const t of this.#transformers) {\n\t\t\tconst match = textNode.getTextContent().match(t.regExp);\n\n\t\t\tif (!match) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst startIndex = match.index || 0;\n\t\t\tconst endIndex = startIndex + match[0].length;\n\n\t\t\tlet transformedNode: TextNode | undefined = undefined;\n\t\t\tlet nodeAfter: TextNode | undefined = undefined;\n\t\t\tlet nodeBefore: TextNode | undefined = undefined;\n\n\t\t\tif (startIndex === 0) {\n\t\t\t\t[transformedNode, nodeAfter] = textNode.splitText(endIndex);\n\t\t\t} else {\n\t\t\t\t[nodeBefore, transformedNode, nodeAfter] = textNode.splitText(startIndex, endIndex);\n\t\t\t}\n\t\t\tif (transformedNode) {\n\t\t\t\tt.replace(transformedNode, match);\n\t\t\t}\n\t\t\tif (nodeAfter) {\n\t\t\t\tthis.#applyTransformers(nodeAfter);\n\t\t\t}\n\t\t\tif (nodeBefore) {\n\t\t\t\tthis.#applyTransformers(nodeBefore);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nexport function provideLuRichTextPlainTextFormatter(transformers?: PlainTextTransformer[]): Provider {\n\treturn {\n\t\tprovide: RICH_TEXT_FORMATTER,\n\t\tuseFactory: () => new PlainTextFormatter(transformers),\n\t};\n}\n","import { Directive } from '@angular/core';\nimport { provideLuRichTextPlainTextFormatter } from './plain-text-formatter';\n\n@Directive({\n\tselector: 'lu-rich-text-input[luWithPlainTextTagsFormatter]',\n\tproviders: [provideLuRichTextPlainTextFormatter()],\n})\nexport class PlainTextFormatterWithTagsDirective {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;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C,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAnC,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,mCAAmC,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kDAAA,EAAA,SAAA,EAFpC,CAAC,mCAAmC,EAAE,CAAC,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAEtC,mCAAmC,EAAA,UAAA,EAAA,CAAA;kBAJ/C,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,kDAAkD;AAC5D,oBAAA,SAAS,EAAE,CAAC,mCAAmC,EAAE,CAAC;AAClD,iBAAA;;;ACND;;AAEG;;"}
1
+ {"version":3,"file":"lucca-front-ng-forms-rich-text-input-formatters-plain-text.mjs","sources":["../../../packages/ng/forms/rich-text-input/formatters/plain-text/transformers/tag.transformers.ts","../../../packages/ng/forms/rich-text-input/formatters/plain-text/plain-text-formatter.ts","../../../packages/ng/forms/rich-text-input/formatters/plain-text/plain-text-formatter.directive.ts","../../../packages/ng/forms/rich-text-input/formatters/plain-text/lucca-front-ng-forms-rich-text-input-formatters-plain-text.ts"],"sourcesContent":["import { $createTagNode } from '@lucca-front/ng/forms/rich-text-input';\nimport { PlainTextTransformer } from './plain-text-transformer';\n\n/**\n * Transformer for tag nodes\n * It will match the following pattern `{{Tag}}` and create a TagNode (using `replace` function).\n *\n */\nexport const PLAINTEXT_TAGS: PlainTextTransformer = {\n\tregExp: /{{(\\w+)}}/,\n\treplace: (textNode, match) => {\n\t\tif (match[1]) {\n\t\t\ttextNode.replace($createTagNode(match[1].trim()));\n\t\t}\n\t},\n};\n","import { Provider } from '@angular/core';\nimport { registerPlainText } from '@lexical/plain-text';\nimport { $rootTextContent } from '@lexical/text';\nimport { mergeRegister } from '@lexical/utils';\nimport { RICH_TEXT_FORMATTER, RichTextFormatter } from '@lucca-front/ng/forms/rich-text-input';\nimport { $createParagraphNode, $createTextNode, $getRoot, LexicalEditor, TextNode } from 'lexical';\nimport { PLAINTEXT_TAGS, PlainTextTransformer } from './transformers';\n\nexport class PlainTextFormatter extends RichTextFormatter {\n\t#transformers: PlainTextTransformer[] = [PLAINTEXT_TAGS];\n\n\tconstructor(transformers?: PlainTextTransformer[]) {\n\t\tsuper();\n\t\tif (transformers) {\n\t\t\tthis.#transformers = transformers;\n\t\t}\n\t}\n\n\toverride registerTextPlugin(editor: LexicalEditor) {\n\t\treturn mergeRegister(\n\t\t\tregisterPlainText(editor),\n\t\t\t// Pasted content is inserted as raw text: apply the transformers whenever a text node changes\n\t\t\teditor.registerNodeTransform(TextNode, (textNode) => this.#applyTransformers(textNode)),\n\t\t);\n\t}\n\n\toverride parse(editor: LexicalEditor, text?: string | null): void {\n\t\teditor.update(() => {\n\t\t\tconst rootNode = $getRoot();\n\t\t\trootNode.clear();\n\t\t\tif (text) {\n\t\t\t\tconst paragraphNode = $createParagraphNode();\n\t\t\t\tconst textNode = $createTextNode(text);\n\t\t\t\tparagraphNode.append(textNode);\n\t\t\t\trootNode.append(paragraphNode);\n\t\t\t\tthis.#applyTransformers(textNode);\n\t\t\t}\n\t\t});\n\t}\n\n\toverride format(editor: LexicalEditor): string {\n\t\tlet result = '';\n\t\teditor.getEditorState().read(() => (result = $rootTextContent()));\n\t\treturn result;\n\t}\n\n\t#applyTransformers(textNode: TextNode): void {\n\t\tfor (const t of this.#transformers) {\n\t\t\tconst match = textNode.getTextContent().match(t.regExp);\n\n\t\t\tif (!match) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst startIndex = match.index || 0;\n\t\t\tconst endIndex = startIndex + match[0].length;\n\n\t\t\tlet transformedNode: TextNode | undefined = undefined;\n\t\t\tlet nodeAfter: TextNode | undefined = undefined;\n\t\t\tlet nodeBefore: TextNode | undefined = undefined;\n\n\t\t\tif (startIndex === 0) {\n\t\t\t\t[transformedNode, nodeAfter] = textNode.splitText(endIndex);\n\t\t\t} else {\n\t\t\t\t[nodeBefore, transformedNode, nodeAfter] = textNode.splitText(startIndex, endIndex);\n\t\t\t}\n\t\t\tif (transformedNode) {\n\t\t\t\tt.replace(transformedNode, match);\n\t\t\t}\n\t\t\tif (nodeAfter) {\n\t\t\t\tthis.#applyTransformers(nodeAfter);\n\t\t\t}\n\t\t\tif (nodeBefore) {\n\t\t\t\tthis.#applyTransformers(nodeBefore);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nexport function provideLuRichTextPlainTextFormatter(transformers?: PlainTextTransformer[]): Provider {\n\treturn {\n\t\tprovide: RICH_TEXT_FORMATTER,\n\t\tuseFactory: () => new PlainTextFormatter(transformers),\n\t};\n}\n","import { Directive } from '@angular/core';\nimport { provideLuRichTextPlainTextFormatter } from './plain-text-formatter';\n\n@Directive({\n\tselector: 'lu-rich-text-input[luWithPlainTextTagsFormatter]',\n\tproviders: [provideLuRichTextPlainTextFormatter()],\n})\nexport class PlainTextFormatterWithTagsDirective {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAGA;;;;AAIG;AACI,MAAM,cAAc,GAAyB;AACnD,IAAA,MAAM,EAAE,WAAW;AACnB,IAAA,OAAO,EAAE,CAAC,QAAQ,EAAE,KAAK,KAAI;AAC5B,QAAA,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE;AACb,YAAA,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAClD;IACD,CAAC;;;ACNI,MAAO,kBAAmB,SAAQ,iBAAiB,CAAA;AACxD,IAAA,aAAa,GAA2B,CAAC,cAAc,CAAC;AAExD,IAAA,WAAA,CAAY,YAAqC,EAAA;AAChD,QAAA,KAA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FpC,CAAC,mCAAmC,EAAE,CAAC,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAEtC,mCAAmC,EAAA,UAAA,EAAA,CAAA;kBAJ/C,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,kDAAkD;AAC5D,oBAAA,SAAS,EAAE,CAAC,mCAAmC,EAAE,CAAC;AAClD,iBAAA;;;ACND;;AAEG;;"}
@@ -12,7 +12,7 @@ import { registerHistory, createEmptyHistoryState } from '@lexical/history';
12
12
  import { $isRootTextContentEmpty, $canShowPlaceholderCurry } from '@lexical/text';
13
13
  import { mergeRegister, $getNearestNodeOfType } from '@lexical/utils';
14
14
  import { FormFieldComponent, InputDirective, ɵPresentationDisplayDefaultDirective as _PresentationDisplayDefaultDirective } from '@lucca-front/ng/form-field';
15
- import { createEditor, SKIP_DOM_SELECTION_TAG, $getRoot, $createTextNode, createCommand, $getSelection, $isRangeSelection, $isTextNode, $createParagraphNode, COMMAND_PRIORITY_NORMAL, SELECTION_CHANGE_COMMAND, INSERT_PARAGRAPH_COMMAND, KEY_ENTER_COMMAND, DecoratorNode, TextNode, $getNodeByKey, FORMAT_TEXT_COMMAND } from 'lexical';
15
+ import { createEditor, SKIP_DOM_SELECTION_TAG, $getRoot, $createTextNode, createCommand, $getSelection, $isRangeSelection, $isTextNode, $createParagraphNode, COMMAND_PRIORITY_NORMAL, SELECTION_CHANGE_COMMAND, INSERT_PARAGRAPH_COMMAND, KEY_ENTER_COMMAND, DecoratorNode, $getNodeByKey, TextNode, FORMAT_TEXT_COMMAND } from 'lexical';
16
16
  import { $isAtNodeEnd, $setBlocksType } from '@lexical/selection';
17
17
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
18
18
  import { LuOptionDirective, LuOptionGroupDirective } from '@lucca-front/ng/core-select';
@@ -1222,12 +1222,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImpor
1222
1222
  ], imports: [ListFormatComponent], template: "<lu-rich-text-plugin-list format=\"bullet\" [tooltip]=\"intl().listsBulletLabel\" icon=\"formatBulletedList\" />\n<lu-rich-text-plugin-list format=\"number\" [tooltip]=\"intl().listsNumberedLabel\" icon=\"formatNumberedList\" />\n" }]
1223
1223
  }], propDecorators: { pluginComponents: [{ type: i0.ViewChildren, args: [i0.forwardRef(() => RICH_TEXT_PLUGIN_COMPONENT), { isSignal: true }] }], intl: [{ type: i0.Input, args: [{ isSignal: true, alias: "intl", required: false }] }] } });
1224
1224
 
1225
+ // Chip components per editor and node key. Not stored on the nodes: Lexical clones them and reuses old instances on undo/redo.
1226
+ const tagChips = new WeakMap();
1227
+ function getTagChips(editor) {
1228
+ let chips = tagChips.get(editor);
1229
+ if (!chips) {
1230
+ chips = new Map();
1231
+ tagChips.set(editor, chips);
1232
+ }
1233
+ return chips;
1234
+ }
1235
+ /** Destroy the chip components of a tag node that are no longer in the editor DOM. */
1236
+ function destroyStaleTagChips(editor, nodeKey) {
1237
+ const chips = getTagChips(editor);
1238
+ const refs = chips.get(nodeKey);
1239
+ if (!refs) {
1240
+ return;
1241
+ }
1242
+ const currentElement = editor.getElementByKey(nodeKey);
1243
+ refs.forEach((ref) => {
1244
+ if (ref.location.nativeElement !== currentElement) {
1245
+ ref.destroy();
1246
+ refs.delete(ref);
1247
+ }
1248
+ });
1249
+ if (refs.size === 0) {
1250
+ chips.delete(nodeKey);
1251
+ }
1252
+ }
1253
+ /** Destroy stale chip components once Lexical has reconciled the DOM. */
1254
+ function registerTagChipsCleanup(editor) {
1255
+ return editor.registerMutationListener(TagNode, (mutations) => {
1256
+ mutations.forEach((_mutation, nodeKey) => destroyStaleTagChips(editor, nodeKey));
1257
+ });
1258
+ }
1225
1259
  class TagNode extends DecoratorNode {
1226
1260
  #tagKey;
1227
1261
  #tagDescription;
1228
1262
  #disabled;
1229
- // Store the component reference on the node instance
1230
- #componentRef;
1231
1263
  #viewContainerRef;
1232
1264
  setViewContainerRef(vcr) {
1233
1265
  const self = this.getWritable();
@@ -1283,29 +1315,32 @@ class TagNode extends DecoratorNode {
1283
1315
  createDOM(_config, editor) {
1284
1316
  if (this.#viewContainerRef) {
1285
1317
  if (!editor.isEditable()) {
1286
- this.#componentRef?.destroy();
1287
1318
  const span = document.createElement('span');
1288
1319
  span.textContent = this.#tagDescription ?? this.#tagKey;
1289
1320
  return span;
1290
1321
  }
1291
- if (!this.#componentRef) {
1292
- // Create the component
1293
- this.#componentRef = this.#viewContainerRef.createComponent(ChipComponent);
1322
+ // Always create a new component, stale ones are destroyed by `registerTagChipsCleanup`
1323
+ const componentRef = this.#viewContainerRef.createComponent(ChipComponent);
1324
+ const chips = getTagChips(editor);
1325
+ const nodeKey = this.getKey();
1326
+ if (!chips.has(nodeKey)) {
1327
+ chips.set(nodeKey, new Set());
1294
1328
  }
1329
+ chips.get(nodeKey)?.add(componentRef);
1295
1330
  // Set inputs on the component instance
1296
- this.#componentRef.setInput('unkillable', false);
1297
- this.#componentRef.setInput('palette', 'product');
1298
- this.#componentRef.setInput('disabled', this.#disabled);
1331
+ componentRef.setInput('unkillable', false);
1332
+ componentRef.setInput('palette', 'product');
1333
+ componentRef.setInput('disabled', this.#disabled);
1299
1334
  // Get the component's DOM element
1300
- const componentElement = this.#componentRef.location.nativeElement;
1335
+ const componentElement = componentRef.location.nativeElement;
1301
1336
  const textNode = document.createTextNode(this.#tagDescription ?? this.#tagKey);
1302
1337
  componentElement.insertBefore(textNode, componentElement.firstChild);
1303
1338
  componentElement.classList.add('mod-S');
1304
1339
  componentElement.classList.add('richTextField-content-chip');
1305
1340
  // Add click handler ONLY to the delete button, not the whole chip
1306
- this.#componentRef.instance.kill.subscribe(() => {
1341
+ componentRef.instance.kill.subscribe(() => {
1307
1342
  editor.update(() => {
1308
- this.remove();
1343
+ $getNodeByKey(nodeKey)?.remove();
1309
1344
  });
1310
1345
  });
1311
1346
  // Return the component's DOM element
@@ -1318,10 +1353,6 @@ class TagNode extends DecoratorNode {
1318
1353
  updateDOM(prevNode, _dom, _config) {
1319
1354
  return this.#tagDescription !== prevNode.#tagDescription || this.#tagKey !== prevNode.#tagKey || this.#disabled !== prevNode.#disabled || this.#viewContainerRef !== prevNode.#viewContainerRef;
1320
1355
  }
1321
- remove(preserveEmptyParent) {
1322
- super.remove(preserveEmptyParent);
1323
- this.#componentRef?.destroy();
1324
- }
1325
1356
  exportDOM() {
1326
1357
  const element = document.createTextNode(this.getTextContent());
1327
1358
  return { element };
@@ -1466,8 +1497,9 @@ class RichTextPluginTagComponent {
1466
1497
  }
1467
1498
  setEditorInstance(editor) {
1468
1499
  this.editor = editor;
1500
+ this.#registeredCommands = mergeRegister(registerTagChipsCleanup(this.editor),
1469
1501
  // listen for new partial tag nodes (coming from formatters)
1470
- this.#registeredCommands = this.editor.registerMutationListener(TagNode, (mutations) => {
1502
+ this.editor.registerMutationListener(TagNode, (mutations) => {
1471
1503
  const newNodes = new Set(this.#tagNodeKeys());
1472
1504
  this.editor?.read(() => {
1473
1505
  mutations.forEach((m, k) => {
@@ -1482,7 +1514,7 @@ class RichTextPluginTagComponent {
1482
1514
  this.#tagNodeKeys.set(newNodes);
1483
1515
  }
1484
1516
  });
1485
- }, { skipInitialization: true });
1517
+ }, { skipInitialization: true }));
1486
1518
  }
1487
1519
  getLexicalNodes() {
1488
1520
  return [TagNode];
@@ -1678,5 +1710,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImpor
1678
1710
  * Generated bundle index. Do not edit.
1679
1711
  */
1680
1712
 
1681
- export { $createTagNode, $isTagNode, ClearFormatComponent, HeadingsComponent, INITIAL_UPDATE_TAG, LinkComponent, ListStyleToolbarComponent, RICH_TEXT_FORMATTER, RICH_TEXT_PLUGIN_COMPONENT, RichTextFormatter, RichTextInputComponent, RichTextInputToolbarComponent, RichTextPluginTagComponent, TagNode, TextStyleComponent, TextStyleToolbarComponent };
1713
+ export { $createTagNode, $isTagNode, ClearFormatComponent, HeadingsComponent, INITIAL_UPDATE_TAG, LinkComponent, ListStyleToolbarComponent, RICH_TEXT_FORMATTER, RICH_TEXT_PLUGIN_COMPONENT, RichTextFormatter, RichTextInputComponent, RichTextInputToolbarComponent, RichTextPluginTagComponent, TagNode, TextStyleComponent, TextStyleToolbarComponent, registerTagChipsCleanup };
1682
1714
  //# sourceMappingURL=lucca-front-ng-forms-rich-text-input.mjs.map