@ni/nimble-components 32.9.0 → 32.9.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 (37) hide show
  1. package/dist/all-components-bundle.js +96 -139
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +3565 -3560
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/checkbox/index.d.ts +12 -4
  6. package/dist/esm/checkbox/index.js +2 -11
  7. package/dist/esm/checkbox/index.js.map +1 -1
  8. package/dist/esm/combobox/index.d.ts +12 -7
  9. package/dist/esm/combobox/index.js +2 -8
  10. package/dist/esm/combobox/index.js.map +1 -1
  11. package/dist/esm/number-field/index.d.ts +12 -11
  12. package/dist/esm/number-field/index.js +2 -8
  13. package/dist/esm/number-field/index.js.map +1 -1
  14. package/dist/esm/patterns/error/template.js +7 -1
  15. package/dist/esm/patterns/error/template.js.map +1 -1
  16. package/dist/esm/patterns/error/testing/error-pattern.pageobject.d.ts +14 -0
  17. package/dist/esm/patterns/error/testing/error-pattern.pageobject.js +46 -0
  18. package/dist/esm/patterns/error/testing/error-pattern.pageobject.js.map +1 -0
  19. package/dist/esm/patterns/error/types.d.ts +16 -5
  20. package/dist/esm/patterns/error/types.js +27 -1
  21. package/dist/esm/patterns/error/types.js.map +1 -1
  22. package/dist/esm/radio-group/index.d.ts +11 -4
  23. package/dist/esm/radio-group/index.js +2 -13
  24. package/dist/esm/radio-group/index.js.map +1 -1
  25. package/dist/esm/rich-text/editor/index.d.ts +12 -16
  26. package/dist/esm/rich-text/editor/index.js +2 -14
  27. package/dist/esm/rich-text/editor/index.js.map +1 -1
  28. package/dist/esm/select/index.d.ts +11 -11
  29. package/dist/esm/select/index.js +2 -8
  30. package/dist/esm/select/index.js.map +1 -1
  31. package/dist/esm/text-area/index.d.ts +12 -18
  32. package/dist/esm/text-area/index.js +2 -15
  33. package/dist/esm/text-area/index.js.map +1 -1
  34. package/dist/esm/text-field/index.d.ts +12 -11
  35. package/dist/esm/text-field/index.js +2 -8
  36. package/dist/esm/text-field/index.js.map +1 -1
  37. package/package.json +1 -1
@@ -1,2 +1,28 @@
1
- export {};
1
+ import { attr, observable } from '@microsoft/fast-element';
2
+ // As the returned class is internal to the function, we can't write a signature that uses is directly, so rely on inference
3
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type
4
+ export function mixinErrorPattern(base) {
5
+ /**
6
+ * The Mixin that provides a concrete column with the API to support being resized
7
+ * proportionally within a Table.
8
+ */
9
+ class ErrorPatternElement extends base {
10
+ constructor() {
11
+ super(...arguments);
12
+ /*
13
+ * Show the error appearance of the control
14
+ */
15
+ this.errorVisible = false;
16
+ /* @internal
17
+ * Indicates if the error text has overflowed its container. The value should not be
18
+ * set directly. Instead, it is used with the `overflow` directive.
19
+ */
20
+ this.errorHasOverflow = false;
21
+ }
22
+ }
23
+ attr({ attribute: 'error-text' })(ErrorPatternElement.prototype, 'errorText');
24
+ attr({ attribute: 'error-visible', mode: 'boolean' })(ErrorPatternElement.prototype, 'errorVisible');
25
+ observable(ErrorPatternElement.prototype, 'errorHasOverflow');
26
+ return ErrorPatternElement;
27
+ }
2
28
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/patterns/error/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * This interface should be used by components that want to leverage the error pattern. The error pattern conditionally adds error text to the template when an error is configured to be visible.\n */\nexport interface ErrorPattern {\n /**\n * The error text that will be displayed when a component is in the error appearance\n */\n errorText?: string;\n\n /*\n * Show the error appearance of the control\n */\n errorVisible: boolean;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/patterns/error/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAe,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAWxE,4HAA4H;AAC5H,+HAA+H;AAC/H,MAAM,UAAU,iBAAiB,CAC7B,IAAW;IAEX;;;OAGG;IACH,MAAe,mBAAoB,SAAQ,IAAI;QAA/C;;YAMI;;eAEG;YACI,iBAAY,GAAG,KAAK,CAAC;YAE5B;;;eAGG;YACI,qBAAgB,GAAG,KAAK,CAAC;QACpC,CAAC;KAAA;IAED,IAAI,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,CAC7B,mBAAmB,CAAC,SAAS,EAC7B,WAAW,CACd,CAAC;IACF,IAAI,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CACjD,mBAAmB,CAAC,SAAS,EAC7B,cAAc,CACjB,CAAC;IACF,UAAU,CAAC,mBAAmB,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;IAC9D,OAAO,mBAAmB,CAAC;AAC/B,CAAC","sourcesContent":["import { attr, FASTElement, observable } from '@microsoft/fast-element';\n\nexport interface ErrorPattern {\n errorText?: string;\n errorVisible: boolean;\n errorHasOverflow: boolean;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype FASTElementConstructor = abstract new (...args: any[]) => FASTElement;\n\n// As the returned class is internal to the function, we can't write a signature that uses is directly, so rely on inference\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type\nexport function mixinErrorPattern<TBase extends FASTElementConstructor>(\n base: TBase\n) {\n /**\n * The Mixin that provides a concrete column with the API to support being resized\n * proportionally within a Table.\n */\n abstract class ErrorPatternElement extends base implements ErrorPattern {\n /**\n * The error text that will be displayed when a component is in the error appearance\n */\n public errorText?: string;\n\n /*\n * Show the error appearance of the control\n */\n public errorVisible = false;\n\n /* @internal\n * Indicates if the error text has overflowed its container. The value should not be\n * set directly. Instead, it is used with the `overflow` directive.\n */\n public errorHasOverflow = false;\n }\n\n attr({ attribute: 'error-text' })(\n ErrorPatternElement.prototype,\n 'errorText'\n );\n attr({ attribute: 'error-visible', mode: 'boolean' })(\n ErrorPatternElement.prototype,\n 'errorVisible'\n );\n observable(ErrorPatternElement.prototype, 'errorHasOverflow');\n return ErrorPatternElement;\n}\n"]}
@@ -1,17 +1,24 @@
1
1
  import { RadioGroup as FoundationRadioGroup } from '@microsoft/fast-foundation';
2
2
  import { Orientation } from '@microsoft/fast-web-utilities';
3
- import type { ErrorPattern } from '../patterns/error/types';
4
3
  declare global {
5
4
  interface HTMLElementTagNameMap {
6
5
  'nimble-radio-group': RadioGroup;
7
6
  }
8
7
  }
9
8
  export { Orientation };
9
+ declare const RadioGroup_base: (abstract new (...args: any[]) => {
10
+ errorText?: string | undefined;
11
+ errorVisible: boolean;
12
+ errorHasOverflow: boolean;
13
+ readonly $fastController: import("@microsoft/fast-element").Controller;
14
+ $emit(type: string, detail?: any, options?: Omit<CustomEventInit<any>, "detail"> | undefined): boolean | void;
15
+ connectedCallback(): void;
16
+ disconnectedCallback(): void;
17
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
18
+ }) & typeof FoundationRadioGroup;
10
19
  /**
11
20
  * A nimble-styled grouping element for radio buttons
12
21
  */
13
- export declare class RadioGroup extends FoundationRadioGroup implements ErrorPattern {
14
- errorText?: string;
15
- errorVisible: boolean;
22
+ export declare class RadioGroup extends RadioGroup_base {
16
23
  }
17
24
  export declare const radioGroupTag = "nimble-radio-group";
@@ -1,25 +1,14 @@
1
- import { __decorate } from "tslib";
2
1
  import { RadioGroup as FoundationRadioGroup, DesignSystem } from '@microsoft/fast-foundation';
3
2
  import { Orientation } from '@microsoft/fast-web-utilities';
4
- import { attr } from '@microsoft/fast-element';
5
3
  import { styles } from './styles';
6
4
  import { template } from './template';
5
+ import { mixinErrorPattern } from '../patterns/error/types';
7
6
  export { Orientation };
8
7
  /**
9
8
  * A nimble-styled grouping element for radio buttons
10
9
  */
11
- export class RadioGroup extends FoundationRadioGroup {
12
- constructor() {
13
- super(...arguments);
14
- this.errorVisible = false;
15
- }
10
+ export class RadioGroup extends mixinErrorPattern(FoundationRadioGroup) {
16
11
  }
17
- __decorate([
18
- attr({ attribute: 'error-text' })
19
- ], RadioGroup.prototype, "errorText", void 0);
20
- __decorate([
21
- attr({ attribute: 'error-visible', mode: 'boolean' })
22
- ], RadioGroup.prototype, "errorVisible", void 0);
23
12
  const nimbleRadioGroup = RadioGroup.compose({
24
13
  baseName: 'radio-group',
25
14
  baseClass: FoundationRadioGroup,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/radio-group/index.ts"],"names":[],"mappings":";AAAA,OAAO,EACH,UAAU,IAAI,oBAAoB,EAClC,YAAY,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAStC,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,oBAAoB;IAApD;;QAKW,iBAAY,GAAG,KAAK,CAAC;IAChC,CAAC;CAAA;AAJU;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;6CACR;AAGnB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;gDAC1B;AAGhC,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,CAAC;IACxC,QAAQ,EAAE,aAAa;IACvB,SAAS,EAAE,oBAAoB;IAC/B,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC","sourcesContent":["import {\n RadioGroup as FoundationRadioGroup,\n DesignSystem\n} from '@microsoft/fast-foundation';\nimport { Orientation } from '@microsoft/fast-web-utilities';\nimport { attr } from '@microsoft/fast-element';\nimport { styles } from './styles';\nimport { template } from './template';\nimport type { ErrorPattern } from '../patterns/error/types';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-radio-group': RadioGroup;\n }\n}\n\nexport { Orientation };\n\n/**\n * A nimble-styled grouping element for radio buttons\n */\nexport class RadioGroup extends FoundationRadioGroup implements ErrorPattern {\n @attr({ attribute: 'error-text' })\n public errorText?: string;\n\n @attr({ attribute: 'error-visible', mode: 'boolean' })\n public errorVisible = false;\n}\n\nconst nimbleRadioGroup = RadioGroup.compose({\n baseName: 'radio-group',\n baseClass: FoundationRadioGroup,\n template,\n styles,\n shadowOptions: {\n delegatesFocus: true\n }\n});\n\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleRadioGroup());\nexport const radioGroupTag = 'nimble-radio-group';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/radio-group/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,IAAI,oBAAoB,EAClC,YAAY,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAQ5D,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAiB,CAAC,oBAAoB,CAAC;CAAG;AAE1E,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,CAAC;IACxC,QAAQ,EAAE,aAAa;IACvB,SAAS,EAAE,oBAAoB;IAC/B,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC","sourcesContent":["import {\n RadioGroup as FoundationRadioGroup,\n DesignSystem\n} from '@microsoft/fast-foundation';\nimport { Orientation } from '@microsoft/fast-web-utilities';\nimport { styles } from './styles';\nimport { template } from './template';\nimport { mixinErrorPattern } from '../patterns/error/types';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-radio-group': RadioGroup;\n }\n}\n\nexport { Orientation };\n\n/**\n * A nimble-styled grouping element for radio buttons\n */\nexport class RadioGroup extends mixinErrorPattern(FoundationRadioGroup) {}\n\nconst nimbleRadioGroup = RadioGroup.compose({\n baseName: 'radio-group',\n baseClass: FoundationRadioGroup,\n template,\n styles,\n shadowOptions: {\n delegatesFocus: true\n }\n});\n\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleRadioGroup());\nexport const radioGroupTag = 'nimble-radio-group';\n"]}
@@ -3,7 +3,6 @@ import { Editor } from '@tiptap/core';
3
3
  import type { SuggestionProps } from '@tiptap/suggestion';
4
4
  import type { ToggleButton } from '../../toggle-button';
5
5
  import { MentionDetail } from './types';
6
- import type { ErrorPattern } from '../../patterns/error/types';
7
6
  import { RichTextMarkdownSerializer } from '../models/markdown-serializer';
8
7
  import { RichText } from '../base';
9
8
  import type { RichTextMentionListbox } from '../mention-listbox';
@@ -15,10 +14,20 @@ declare global {
15
14
  'nimble-rich-text-editor': RichTextEditor;
16
15
  }
17
16
  }
17
+ declare const RichTextEditor_base: (abstract new (...args: any[]) => {
18
+ errorText?: string | undefined;
19
+ errorVisible: boolean;
20
+ errorHasOverflow: boolean;
21
+ readonly $fastController: import("@microsoft/fast-element").Controller;
22
+ $emit(type: string, detail?: any, options?: Omit<CustomEventInit<any>, "detail"> | undefined): boolean | void;
23
+ connectedCallback(): void;
24
+ disconnectedCallback(): void;
25
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
26
+ }) & typeof RichText;
18
27
  /**
19
28
  * A nimble styled rich text editor
20
29
  */
21
- export declare class RichTextEditor extends RichText implements ErrorPattern {
30
+ export declare class RichTextEditor extends RichTextEditor_base {
22
31
  /**
23
32
  * @internal
24
33
  */
@@ -49,20 +58,6 @@ export declare class RichTextEditor extends RichText implements ErrorPattern {
49
58
  * HTML Attribute: footer-hidden
50
59
  */
51
60
  footerHidden: boolean;
52
- /**
53
- * Whether to display the error state.
54
- *
55
- * @public
56
- * HTML Attribute: error-visible
57
- */
58
- errorVisible: boolean;
59
- /**
60
- * A message explaining why the value is invalid.
61
- *
62
- * @public
63
- * HTML Attribute: error-text
64
- */
65
- errorText?: string;
66
61
  /**
67
62
  * @public
68
63
  * HTML Attribute: placeholder
@@ -268,3 +263,4 @@ export declare class RichTextEditor extends RichText implements ErrorPattern {
268
263
  export interface RichTextEditor extends ARIAGlobalStatesAndProperties {
269
264
  }
270
265
  export declare const richTextEditorTag = "nimble-rich-text-editor";
266
+ export {};
@@ -7,6 +7,7 @@ import HardBreak from '@tiptap/extension-hard-break';
7
7
  import { template } from './template';
8
8
  import { styles } from './styles';
9
9
  import { TipTapNodeName, mentionPluginPrefix } from './types';
10
+ import { mixinErrorPattern } from '../../patterns/error/types';
10
11
  import { RichTextMarkdownParser } from '../models/markdown-parser';
11
12
  import { RichTextMarkdownSerializer } from '../models/markdown-serializer';
12
13
  import { RichText } from '../base';
@@ -15,7 +16,7 @@ import { EditorConfiguration } from '../models/editor-configuration';
15
16
  /**
16
17
  * A nimble styled rich text editor
17
18
  */
18
- export class RichTextEditor extends RichText {
19
+ export class RichTextEditor extends mixinErrorPattern(RichText) {
19
20
  constructor() {
20
21
  super(...arguments);
21
22
  /**
@@ -48,13 +49,6 @@ export class RichTextEditor extends RichText {
48
49
  * HTML Attribute: footer-hidden
49
50
  */
50
51
  this.footerHidden = false;
51
- /**
52
- * Whether to display the error state.
53
- *
54
- * @public
55
- * HTML Attribute: error-visible
56
- */
57
- this.errorVisible = false;
58
52
  /**
59
53
  * The width of the vertical scrollbar, if displayed.
60
54
  * @internal
@@ -525,12 +519,6 @@ __decorate([
525
519
  __decorate([
526
520
  attr({ attribute: 'footer-hidden', mode: 'boolean' })
527
521
  ], RichTextEditor.prototype, "footerHidden", void 0);
528
- __decorate([
529
- attr({ attribute: 'error-visible', mode: 'boolean' })
530
- ], RichTextEditor.prototype, "errorVisible", void 0);
531
- __decorate([
532
- attr({ attribute: 'error-text' })
533
- ], RichTextEditor.prototype, "errorText", void 0);
534
522
  __decorate([
535
523
  attr
536
524
  ], RichTextEditor.prototype, "placeholder", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rich-text/editor/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACH,WAAW,EACX,6BAA6B,EAC7B,YAAY,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EACH,cAAc,EACd,MAAM,EAIT,MAAM,cAAc,CAAC;AAGtB,OAAO,SAAS,MAAM,8BAA8B,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EACH,cAAc,EACd,mBAAmB,EAGtB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAInC,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,IAAI,EAAE,SAAS,EAAE,CAAC;oDAC1B;AASrB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;iDACR;AAOnB;IADN,IAAI;mDACuB;AAkCrB;IADN,UAAU;kDACsB;AAM1B;IADN,UAAU;qDACyB;AAM7B;IADN,UAAU;wDAC4B;AAMhC;IADN,UAAU;0DAC8B;AAOlC;IADN,UAAU;sDACgB;AAMpB;IADN,UAAU;8DACwB;AAM5B;IADN,UAAU;4DACkC;AAyiBjD,WAAW,CAAC,cAAc,EAAE,6BAA6B,CAAC,CAAC;AAE3D,MAAM,oBAAoB,GAAG,cAAc,CAAC,OAAO,CAAC;IAChD,QAAQ,EAAE,kBAAkB;IAC5B,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE;KACrB,UAAU,CAAC,QAAQ,CAAC;KACpB,QAAQ,CAAC,oBAAoB,EAAE,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,yBAAyB,CAAC","sourcesContent":["import { observable, attr, DOM } from '@microsoft/fast-element';\nimport {\n applyMixins,\n ARIAGlobalStatesAndProperties,\n DesignSystem\n} from '@microsoft/fast-foundation';\nimport { keyEnter, keySpace } from '@microsoft/fast-web-utilities';\nimport {\n findParentNode,\n isList,\n AnyExtension,\n Extension,\n Editor\n} from '@tiptap/core';\n\nimport type { PlaceholderOptions } from '@tiptap/extension-placeholder';\nimport HardBreak from '@tiptap/extension-hard-break';\nimport type { SuggestionProps } from '@tiptap/suggestion';\nimport { template } from './template';\nimport { styles } from './styles';\nimport type { ToggleButton } from '../../toggle-button';\nimport {\n TipTapNodeName,\n mentionPluginPrefix,\n MentionDetail,\n FormatButtonsState\n} from './types';\nimport type { ErrorPattern } from '../../patterns/error/types';\nimport { RichTextMarkdownParser } from '../models/markdown-parser';\nimport { RichTextMarkdownSerializer } from '../models/markdown-serializer';\nimport { RichText } from '../base';\nimport type { RichTextMentionListbox } from '../mention-listbox';\nimport type { MappingConfigs } from '../../rich-text-mention/base/types';\nimport type { MentionExtensionConfiguration } from '../models/mention-extension-configuration';\nimport { createTiptapEditor } from './models/create-tiptap-editor';\nimport { EditorConfiguration } from '../models/editor-configuration';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-rich-text-editor': RichTextEditor;\n }\n}\n\n/**\n * A nimble styled rich text editor\n */\nexport class RichTextEditor extends RichText implements ErrorPattern {\n /**\n * @internal\n */\n public editorDiv = this.createEditor();\n\n /**\n * @internal\n */\n public tiptapEditor = createTiptapEditor(\n () => {},\n () => {},\n this.editorDiv,\n [],\n this.mentionListbox,\n this.placeholder\n );\n\n /**\n * @internal\n */\n public readonly xmlSerializer = new XMLSerializer();\n\n /**\n * @internal\n */\n public richTextMarkdownSerializer = new RichTextMarkdownSerializer([]);\n\n /**\n * Whether to disable user from editing and interacting with toolbar buttons\n *\n * @public\n * HTML Attribute: disabled\n */\n @attr({ mode: 'boolean' })\n public disabled = false;\n\n /**\n * Whether to hide the footer of the rich text editor\n *\n * @public\n * HTML Attribute: footer-hidden\n */\n @attr({ attribute: 'footer-hidden', mode: 'boolean' })\n public footerHidden = false;\n\n /**\n * Whether to display the error state.\n *\n * @public\n * HTML Attribute: error-visible\n */\n @attr({ attribute: 'error-visible', mode: 'boolean' })\n public errorVisible = false;\n\n /**\n * A message explaining why the value is invalid.\n *\n * @public\n * HTML Attribute: error-text\n */\n @attr({ attribute: 'error-text' })\n public errorText?: string;\n\n /**\n * @public\n * HTML Attribute: placeholder\n */\n @attr\n public placeholder?: string;\n\n /**\n * True if the editor is empty or contains only whitespace, false otherwise.\n *\n * @public\n */\n public get empty(): boolean {\n // Tiptap [isEmpty](https://tiptap.dev/api/editor#is-empty) returns false even if the editor has only whitespace.\n // Get the prose mirror textContent of all the nodes with whitespace trimmed to see if it is empty\n // Mention nodes are formatted as empty text content, so if empty make sure there are no mention nodes remaining\n if (this.tiptapEditor.state.doc.textContent.trim() === '') {\n let hasMention = false;\n this.tiptapEditor.state.doc.descendants(node => {\n if (node.type.name.startsWith(mentionPluginPrefix)) {\n hasMention = true;\n }\n const continueDescent = hasMention === false;\n return continueDescent;\n });\n return !hasMention;\n }\n return false;\n }\n\n /**\n * @internal\n */\n public mentionListbox?: RichTextMentionListbox;\n\n /**\n * @internal\n */\n @observable\n public boldButton!: ToggleButton;\n\n /**\n * @internal\n */\n @observable\n public italicsButton!: ToggleButton;\n\n /**\n * @internal\n */\n @observable\n public bulletListButton!: ToggleButton;\n\n /**\n * @internal\n */\n @observable\n public numberedListButton!: ToggleButton;\n\n /**\n * The width of the vertical scrollbar, if displayed.\n * @internal\n */\n @observable\n public scrollbarWidth = -1;\n\n /**\n * @internal\n */\n @observable\n public activeMentionCharacter = '';\n\n /**\n * @internal\n */\n @observable\n public activeMappingConfigs?: MappingConfigs;\n\n /**\n * @internal\n */\n public activeMentionCommand?: SuggestionProps['command'];\n\n /**\n * @internal\n */\n public editorContainer!: HTMLDivElement;\n\n private resizeObserver?: ResizeObserver;\n private updateScrollbarWidthQueued = false;\n\n /**\n * @internal\n */\n public override connectedCallback(): void {\n super.connectedCallback();\n if (!this.editorDiv.isConnected) {\n this.editorContainer.append(this.editorDiv);\n }\n this.bindEditorTransactionEvent();\n this.bindEditorUpdateEvent();\n this.stopNativeInputEventPropagation();\n this.resizeObserver = new ResizeObserver(() => this.onResize());\n this.resizeObserver.observe(this);\n }\n\n /**\n * @internal\n */\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.unbindEditorTransactionEvent();\n this.unbindEditorUpdateEvent();\n this.unbindNativeInputEvent();\n this.resizeObserver?.disconnect();\n }\n\n /**\n * @internal\n */\n public disabledChanged(): void {\n this.disableEditor();\n this.disableMentionViewElement();\n }\n\n /**\n * Update the placeholder text and view of the editor.\n * @internal\n */\n public placeholderChanged(_prev: unknown, _next: unknown): void {\n const placeholderExtension = this.getTipTapExtension(\n 'placeholder'\n ) as Extension<PlaceholderOptions>;\n placeholderExtension.options.placeholder = this.placeholder ?? '';\n this.tiptapEditor.view.dispatch(this.tiptapEditor.state.tr);\n\n this.queueUpdateScrollbarWidth();\n }\n\n /**\n * @internal\n */\n public ariaLabelChanged(_prev: unknown, _next: unknown): void {\n if (this.ariaLabel !== null && this.ariaLabel !== undefined) {\n this.editorDiv.setAttribute('aria-label', this.ariaLabel);\n } else {\n this.editorDiv.removeAttribute('aria-label');\n }\n }\n\n /**\n * @internal\n */\n public configurationChanged(\n prev: EditorConfiguration | undefined,\n next: EditorConfiguration\n ): void {\n const formatButtonsState = this.getButtonsState(this.tiptapEditor);\n const { from, to } = this.tiptapEditor.view.state.selection;\n if (this.isMentionExtensionConfigUnchanged(prev, next)) {\n this.setMarkdown(this.getMarkdown());\n } else {\n const mentionExtensionConfig = this.getMentionExtensionConfig();\n const currentStateMarkdown = this.getMarkdown();\n this.richTextMarkdownSerializer = new RichTextMarkdownSerializer(\n mentionExtensionConfig.map(config => config.name)\n );\n this.initializeEditor();\n this.setMarkdown(currentStateMarkdown);\n }\n this.tiptapEditor.commands.setTextSelection({ from, to });\n this.resetEditorButtonsState(formatButtonsState);\n this.setActiveMappingConfigs();\n }\n\n /**\n * @internal\n */\n public activeMentionCharacterChanged(): void {\n this.setActiveMappingConfigs();\n }\n\n /**\n * Toggle the bold mark and focus back to the editor\n * @internal\n */\n public boldButtonClick(): void {\n this.tiptapEditor.chain().focus().toggleBold().run();\n }\n\n /**\n * Toggle the bold mark and focus back to the editor\n * @internal\n */\n public boldButtonKeyDown(event: KeyboardEvent): boolean {\n if (this.keyActivatesButton(event)) {\n this.tiptapEditor.chain().focus().toggleBold().run();\n return false;\n }\n return true;\n }\n\n /**\n * Toggle the italics mark and focus back to the editor\n * @internal\n */\n public italicsButtonClick(): void {\n this.tiptapEditor.chain().focus().toggleItalic().run();\n }\n\n /**\n * Toggle the italics mark and focus back to the editor\n * @internal\n */\n public italicsButtonKeyDown(event: KeyboardEvent): boolean {\n if (this.keyActivatesButton(event)) {\n this.tiptapEditor.chain().focus().toggleItalic().run();\n return false;\n }\n return true;\n }\n\n /**\n * Toggle the unordered list node and focus back to the editor\n * @internal\n */\n public bulletListButtonClick(): void {\n this.tiptapEditor.chain().focus().toggleBulletList().run();\n }\n\n /**\n * Toggle the unordered list node and focus back to the editor\n * @internal\n */\n public bulletListButtonKeyDown(event: KeyboardEvent): boolean {\n if (this.keyActivatesButton(event)) {\n this.tiptapEditor.chain().focus().toggleBulletList().run();\n return false;\n }\n return true;\n }\n\n /**\n * Toggle the ordered list node and focus back to the editor\n * @internal\n */\n public numberedListButtonClick(): void {\n this.tiptapEditor.chain().focus().toggleOrderedList().run();\n }\n\n /**\n * Toggle the ordered list node and focus back to the editor\n * @internal\n */\n public numberedListButtonKeyDown(event: KeyboardEvent): boolean {\n if (this.keyActivatesButton(event)) {\n this.tiptapEditor.chain().focus().toggleOrderedList().run();\n return false;\n }\n return true;\n }\n\n /**\n * Inserts the mention character into the editor and focus back to the editor\n * @internal\n */\n public mentionButtonClick(character: string): void {\n this.tiptapEditor\n .chain()\n .insertContent(\n this.shouldInsertSpace() ? ` ${character}` : character\n )\n .focus()\n .run();\n }\n\n /**\n * This function load tip tap editor with provided markdown content by parsing into html\n * @public\n */\n public setMarkdown(markdown: string): void {\n const html = this.getHtmlContent(markdown);\n this.tiptapEditor.commands.setContent(html);\n this.disableMentionViewElement();\n }\n\n /**\n * This function returns markdown string by serializing tiptap editor document using prosemirror MarkdownSerializer\n * @public\n */\n public getMarkdown(): string {\n return this.richTextMarkdownSerializer.serializeDOMToMarkdown(\n this.tiptapEditor.state.doc\n );\n }\n\n /**\n * @internal\n */\n public stopEventPropagation(event: Event): boolean {\n // Don't bubble the 'change' event from the toggle button because\n // all the formatting button has its own 'toggle' event through 'click' and 'keydown'.\n event.stopPropagation();\n return false;\n }\n\n public getMentionedHrefs(): string[] {\n const mentionedHrefs = new Set<string>();\n this.tiptapEditor.state.doc.descendants(node => {\n if (node.type.name.startsWith(mentionPluginPrefix)) {\n mentionedHrefs.add(node.attrs.href as string);\n }\n });\n return Array.from(mentionedHrefs);\n }\n\n /**\n * @internal\n */\n public getMentionExtensionConfig(): MentionExtensionConfiguration[] {\n return this.configuration instanceof EditorConfiguration\n ? this.configuration.mentionExtensionConfig\n : [];\n }\n\n /**\n * @internal\n */\n public onMentionSelect(event: CustomEvent<MentionDetail>): void {\n if (this.activeMentionCommand) {\n this.activeMentionCommand({\n href: event.detail.href,\n label: event.detail.displayName\n });\n }\n }\n\n /**\n * @internal\n */\n public focusoutHandler(): void {\n if (!this.mentionListbox?.open) {\n return;\n }\n this.mentionListbox?.close();\n }\n\n public override createConfig(): void {\n this.validate();\n if (this.richTextValidator.isValid()) {\n if (\n this.richTextUpdateTracker.updateButtonLabel\n || this.richTextUpdateTracker.updateMappingConfigs\n || this.richTextUpdateTracker.updatePattern\n ) {\n this.configuration = new EditorConfiguration(\n this.mentionElements\n );\n }\n } else {\n this.configuration = undefined;\n }\n }\n\n private isMentionExtensionConfigUnchanged(\n prev: EditorConfiguration | undefined,\n next: EditorConfiguration | undefined\n ): boolean {\n const prevConfigCharacters = prev?.mentionExtensionConfig\n .map(config => config.character)\n .sort((a, b) => a.localeCompare(b))\n .toString();\n const nextConfigCharacters = next?.mentionExtensionConfig\n .map(config => config.character)\n .sort((a, b) => a.localeCompare(b))\n .toString();\n return prevConfigCharacters === nextConfigCharacters;\n }\n\n private createEditor(): HTMLDivElement {\n const editor = document.createElement('div');\n editor.className = 'editor';\n editor.setAttribute('aria-multiline', 'true');\n editor.setAttribute('role', 'textbox');\n editor.setAttribute('aria-disabled', 'false');\n return editor;\n }\n\n private initializeEditor(): void {\n this.unbindEditorTransactionEvent();\n this.unbindEditorUpdateEvent();\n this.unbindNativeInputEvent();\n this.tiptapEditor?.destroy();\n this.tiptapEditor = createTiptapEditor(\n character => {\n this.activeMentionCharacter = character;\n },\n command => {\n this.activeMentionCommand = command;\n },\n this.editorDiv,\n this.configuration instanceof EditorConfiguration\n ? this.configuration.mentionExtensionConfig\n : [],\n this.mentionListbox,\n this.placeholder\n );\n this.disableEditor();\n this.disableMentionViewElement();\n this.bindEditorTransactionEvent();\n this.bindEditorUpdateEvent();\n this.stopNativeInputEventPropagation();\n }\n\n /**\n * This function takes the Fragment from parseMarkdownToDOM function and return the serialized string using XMLSerializer\n */\n private getHtmlContent(markdown: string): string {\n const parseResult = RichTextMarkdownParser.parseMarkdownToDOM(\n markdown,\n this.configuration?.parserMentionConfig\n );\n return this.xmlSerializer.serializeToString(parseResult.fragment);\n }\n\n /**\n * Binding the \"transaction\" event to the editor allows continuous monitoring the events and updating the button state in response to\n * various actions such as mouse events, keyboard events, changes in the editor content etc,.\n * https://tiptap.dev/api/events#transaction\n */\n private bindEditorTransactionEvent(): void {\n this.tiptapEditor.on('transaction', () => {\n this.updateEditorButtonsState();\n });\n }\n\n private unbindEditorTransactionEvent(): void {\n this.tiptapEditor.off('transaction');\n }\n\n private updateEditorButtonsState(): void {\n if (!this.$fastController.isConnected) {\n return;\n }\n\n const { extensionManager, state } = this.tiptapEditor;\n const { extensions } = extensionManager;\n const { selection } = state;\n const parentList = findParentNode((node: { type: { name: string } }) => isList(node.type.name, extensions))(selection);\n\n this.boldButton.checked = this.tiptapEditor.isActive('bold');\n this.italicsButton.checked = this.tiptapEditor.isActive('italic');\n this.bulletListButton.checked = parentList?.node.type.name === TipTapNodeName.bulletList;\n this.numberedListButton.checked = parentList?.node.type.name === TipTapNodeName.numberedList;\n }\n\n private keyActivatesButton(event: KeyboardEvent): boolean {\n switch (event.key) {\n case keySpace:\n case keyEnter:\n return true;\n default:\n return false;\n }\n }\n\n private unbindEditorUpdateEvent(): void {\n this.tiptapEditor.off('update');\n }\n\n /**\n * input event is fired when there is a change in the content of the editor.\n *\n * https://tiptap.dev/api/events#update\n */\n private bindEditorUpdateEvent(): void {\n this.tiptapEditor.on('update', () => {\n this.$emit('input');\n this.queueUpdateScrollbarWidth();\n });\n }\n\n private disableEditor(): void {\n this.tiptapEditor.setEditable(!this.disabled);\n this.setEditorTabIndex();\n this.editorDiv.setAttribute(\n 'aria-disabled',\n this.disabled ? 'true' : 'false'\n );\n this.mentionListbox?.close();\n }\n\n private disableMentionViewElement(): void {\n this.tiptapEditor.state.doc.descendants((node, pos) => {\n if (node.type.name.startsWith(mentionPluginPrefix)) {\n const updatedAttrs = {\n ...node.attrs,\n disabled: this.disabled ? '' : null\n };\n const updatedNode = this.tiptapEditor.schema.node(\n node.type.name,\n updatedAttrs,\n node.content\n );\n const updatedTransaction = this.tiptapEditor.state.tr.replaceWith(\n pos,\n pos + node.nodeSize,\n updatedNode\n );\n this.tiptapEditor.view.dispatch(updatedTransaction);\n }\n return true;\n });\n }\n\n /**\n * Stopping the native input event propagation emitted by the contenteditable element in the Tiptap\n * since there is an issue (linked below) in ProseMirror where selecting the text and removing it\n * does not trigger the native HTMLElement input event. So using the \"update\" event emitted by the\n * Tiptap to capture it as an \"input\" customEvent in the rich text editor.\n *\n * Prose Mirror issue: https://discuss.prosemirror.net/t/how-to-handle-select-backspace-delete-cut-type-kind-of-events-handletextinput-or-handledomevents-input-doesnt-help/4844\n */\n private stopNativeInputEventPropagation(): void {\n this.tiptapEditor.view.dom.addEventListener('input', event => {\n event.stopPropagation();\n });\n }\n\n private unbindNativeInputEvent(): void {\n this.tiptapEditor.view.dom.removeEventListener('input', () => {});\n }\n\n private queueUpdateScrollbarWidth(): void {\n if (!this.$fastController.isConnected) {\n return;\n }\n if (!this.updateScrollbarWidthQueued) {\n this.updateScrollbarWidthQueued = true;\n DOM.queueUpdate(() => this.updateScrollbarWidth());\n }\n }\n\n private updateScrollbarWidth(): void {\n this.updateScrollbarWidthQueued = false;\n this.scrollbarWidth = this.tiptapEditor.view.dom.offsetWidth\n - this.tiptapEditor.view.dom.clientWidth;\n }\n\n private onResize(): void {\n this.scrollbarWidth = this.tiptapEditor.view.dom.offsetWidth\n - this.tiptapEditor.view.dom.clientWidth;\n }\n\n private getTipTapExtension(\n extensionName: string\n ): AnyExtension | undefined {\n return this.tiptapEditor.extensionManager.extensions.find(\n (extension: { name: string }) => extension.name === extensionName\n );\n }\n\n private setEditorTabIndex(): void {\n this.tiptapEditor.setOptions({\n editorProps: {\n attributes: {\n tabindex: this.disabled ? '-1' : '0'\n }\n }\n });\n }\n\n private setActiveMappingConfigs(): void {\n this.activeMappingConfigs = this.activeMentionCharacter\n ? this.getMentionExtensionConfigFromCharacter(\n this.activeMentionCharacter\n )?.mappingConfigs\n : undefined;\n }\n\n private shouldInsertSpace(): boolean {\n const { $anchor, $head } = this.tiptapEditor.view.state.selection;\n\n const isAtStartOfLine = $head.parentOffset === 0 || $anchor.parentOffset === 0;\n const nodeBeforeSelection = $anchor.pos < $head.pos ? $anchor.nodeBefore : $head.nodeBefore;\n const isHardBreakNode = nodeBeforeSelection?.type.name === HardBreak.name;\n const hasWhitespaceBeforeCurrentPosition = nodeBeforeSelection?.textContent.endsWith(' ');\n\n return (\n !isAtStartOfLine\n && !isHardBreakNode\n && !hasWhitespaceBeforeCurrentPosition\n );\n }\n\n private getMentionExtensionConfigFromCharacter(\n character: string\n ): MentionExtensionConfiguration | undefined {\n return this.getMentionExtensionConfig().find(\n config => config.character === character\n );\n }\n\n private resetEditorButtonsState(\n buttonsState: FormatButtonsState | undefined\n ): void {\n if (buttonsState?.bold && !this.tiptapEditor.isActive('bold')) {\n this.tiptapEditor.chain().focus().toggleBold().run();\n }\n if (buttonsState?.italics && !this.tiptapEditor.isActive('italic')) {\n this.tiptapEditor.chain().focus().toggleItalic().run();\n }\n }\n\n private getButtonsState(\n tiptapEditor: Editor\n ): FormatButtonsState | undefined {\n if (!this.$fastController.isConnected) {\n return undefined;\n }\n return {\n bold: tiptapEditor.isActive('bold'),\n italics: tiptapEditor.isActive('italic')\n };\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface RichTextEditor extends ARIAGlobalStatesAndProperties {}\napplyMixins(RichTextEditor, ARIAGlobalStatesAndProperties);\n\nconst nimbleRichTextEditor = RichTextEditor.compose({\n baseName: 'rich-text-editor',\n template,\n styles,\n shadowOptions: {\n delegatesFocus: true\n }\n});\n\nDesignSystem.getOrCreate()\n .withPrefix('nimble')\n .register(nimbleRichTextEditor());\nexport const richTextEditorTag = 'nimble-rich-text-editor';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rich-text/editor/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACH,WAAW,EACX,6BAA6B,EAC7B,YAAY,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EACH,cAAc,EACd,MAAM,EAIT,MAAM,cAAc,CAAC;AAGtB,OAAO,SAAS,MAAM,8BAA8B,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EACH,cAAc,EACd,mBAAmB,EAGtB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAInC,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAQrE;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,iBAAiB,CAAC,QAAQ,CAAC;IAA/D;;QACI;;WAEG;QACI,cAAS,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAEvC;;WAEG;QACI,iBAAY,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QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE;KACrB,UAAU,CAAC,QAAQ,CAAC;KACpB,QAAQ,CAAC,oBAAoB,EAAE,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,yBAAyB,CAAC","sourcesContent":["import { observable, attr, DOM } from '@microsoft/fast-element';\nimport {\n applyMixins,\n ARIAGlobalStatesAndProperties,\n DesignSystem\n} from '@microsoft/fast-foundation';\nimport { keyEnter, keySpace } from '@microsoft/fast-web-utilities';\nimport {\n findParentNode,\n isList,\n AnyExtension,\n Extension,\n Editor\n} from '@tiptap/core';\n\nimport type { PlaceholderOptions } from '@tiptap/extension-placeholder';\nimport HardBreak from '@tiptap/extension-hard-break';\nimport type { SuggestionProps } from '@tiptap/suggestion';\nimport { template } from './template';\nimport { styles } from './styles';\nimport type { ToggleButton } from '../../toggle-button';\nimport {\n TipTapNodeName,\n mentionPluginPrefix,\n MentionDetail,\n FormatButtonsState\n} from './types';\nimport { mixinErrorPattern } from '../../patterns/error/types';\nimport { RichTextMarkdownParser } from '../models/markdown-parser';\nimport { RichTextMarkdownSerializer } from '../models/markdown-serializer';\nimport { RichText } from '../base';\nimport type { RichTextMentionListbox } from '../mention-listbox';\nimport type { MappingConfigs } from '../../rich-text-mention/base/types';\nimport type { MentionExtensionConfiguration } from '../models/mention-extension-configuration';\nimport { createTiptapEditor } from './models/create-tiptap-editor';\nimport { EditorConfiguration } from '../models/editor-configuration';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-rich-text-editor': RichTextEditor;\n }\n}\n\n/**\n * A nimble styled rich text editor\n */\nexport class RichTextEditor extends mixinErrorPattern(RichText) {\n /**\n * @internal\n */\n public editorDiv = this.createEditor();\n\n /**\n * @internal\n */\n public tiptapEditor = createTiptapEditor(\n () => {},\n () => {},\n this.editorDiv,\n [],\n this.mentionListbox,\n this.placeholder\n );\n\n /**\n * @internal\n */\n public readonly xmlSerializer = new XMLSerializer();\n\n /**\n * @internal\n */\n public richTextMarkdownSerializer = new RichTextMarkdownSerializer([]);\n\n /**\n * Whether to disable user from editing and interacting with toolbar buttons\n *\n * @public\n * HTML Attribute: disabled\n */\n @attr({ mode: 'boolean' })\n public disabled = false;\n\n /**\n * Whether to hide the footer of the rich text editor\n *\n * @public\n * HTML Attribute: footer-hidden\n */\n @attr({ attribute: 'footer-hidden', mode: 'boolean' })\n public footerHidden = false;\n\n /**\n * @public\n * HTML Attribute: placeholder\n */\n @attr\n public placeholder?: string;\n\n /**\n * True if the editor is empty or contains only whitespace, false otherwise.\n *\n * @public\n */\n public get empty(): boolean {\n // Tiptap [isEmpty](https://tiptap.dev/api/editor#is-empty) returns false even if the editor has only whitespace.\n // Get the prose mirror textContent of all the nodes with whitespace trimmed to see if it is empty\n // Mention nodes are formatted as empty text content, so if empty make sure there are no mention nodes remaining\n if (this.tiptapEditor.state.doc.textContent.trim() === '') {\n let hasMention = false;\n this.tiptapEditor.state.doc.descendants(node => {\n if (node.type.name.startsWith(mentionPluginPrefix)) {\n hasMention = true;\n }\n const continueDescent = hasMention === false;\n return continueDescent;\n });\n return !hasMention;\n }\n return false;\n }\n\n /**\n * @internal\n */\n public mentionListbox?: RichTextMentionListbox;\n\n /**\n * @internal\n */\n @observable\n public boldButton!: ToggleButton;\n\n /**\n * @internal\n */\n @observable\n public italicsButton!: ToggleButton;\n\n /**\n * @internal\n */\n @observable\n public bulletListButton!: ToggleButton;\n\n /**\n * @internal\n */\n @observable\n public numberedListButton!: ToggleButton;\n\n /**\n * The width of the vertical scrollbar, if displayed.\n * @internal\n */\n @observable\n public scrollbarWidth = -1;\n\n /**\n * @internal\n */\n @observable\n public activeMentionCharacter = '';\n\n /**\n * @internal\n */\n @observable\n public activeMappingConfigs?: MappingConfigs;\n\n /**\n * @internal\n */\n public activeMentionCommand?: SuggestionProps['command'];\n\n /**\n * @internal\n */\n public editorContainer!: HTMLDivElement;\n\n private resizeObserver?: ResizeObserver;\n private updateScrollbarWidthQueued = false;\n\n /**\n * @internal\n */\n public override connectedCallback(): void {\n super.connectedCallback();\n if (!this.editorDiv.isConnected) {\n this.editorContainer.append(this.editorDiv);\n }\n this.bindEditorTransactionEvent();\n this.bindEditorUpdateEvent();\n this.stopNativeInputEventPropagation();\n this.resizeObserver = new ResizeObserver(() => this.onResize());\n this.resizeObserver.observe(this);\n }\n\n /**\n * @internal\n */\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.unbindEditorTransactionEvent();\n this.unbindEditorUpdateEvent();\n this.unbindNativeInputEvent();\n this.resizeObserver?.disconnect();\n }\n\n /**\n * @internal\n */\n public disabledChanged(): void {\n this.disableEditor();\n this.disableMentionViewElement();\n }\n\n /**\n * Update the placeholder text and view of the editor.\n * @internal\n */\n public placeholderChanged(_prev: unknown, _next: unknown): void {\n const placeholderExtension = this.getTipTapExtension(\n 'placeholder'\n ) as Extension<PlaceholderOptions>;\n placeholderExtension.options.placeholder = this.placeholder ?? '';\n this.tiptapEditor.view.dispatch(this.tiptapEditor.state.tr);\n\n this.queueUpdateScrollbarWidth();\n }\n\n /**\n * @internal\n */\n public ariaLabelChanged(_prev: unknown, _next: unknown): void {\n if (this.ariaLabel !== null && this.ariaLabel !== undefined) {\n this.editorDiv.setAttribute('aria-label', this.ariaLabel);\n } else {\n this.editorDiv.removeAttribute('aria-label');\n }\n }\n\n /**\n * @internal\n */\n public configurationChanged(\n prev: EditorConfiguration | undefined,\n next: EditorConfiguration\n ): void {\n const formatButtonsState = this.getButtonsState(this.tiptapEditor);\n const { from, to } = this.tiptapEditor.view.state.selection;\n if (this.isMentionExtensionConfigUnchanged(prev, next)) {\n this.setMarkdown(this.getMarkdown());\n } else {\n const mentionExtensionConfig = this.getMentionExtensionConfig();\n const currentStateMarkdown = this.getMarkdown();\n this.richTextMarkdownSerializer = new RichTextMarkdownSerializer(\n mentionExtensionConfig.map(config => config.name)\n );\n this.initializeEditor();\n this.setMarkdown(currentStateMarkdown);\n }\n this.tiptapEditor.commands.setTextSelection({ from, to });\n this.resetEditorButtonsState(formatButtonsState);\n this.setActiveMappingConfigs();\n }\n\n /**\n * @internal\n */\n public activeMentionCharacterChanged(): void {\n this.setActiveMappingConfigs();\n }\n\n /**\n * Toggle the bold mark and focus back to the editor\n * @internal\n */\n public boldButtonClick(): void {\n this.tiptapEditor.chain().focus().toggleBold().run();\n }\n\n /**\n * Toggle the bold mark and focus back to the editor\n * @internal\n */\n public boldButtonKeyDown(event: KeyboardEvent): boolean {\n if (this.keyActivatesButton(event)) {\n this.tiptapEditor.chain().focus().toggleBold().run();\n return false;\n }\n return true;\n }\n\n /**\n * Toggle the italics mark and focus back to the editor\n * @internal\n */\n public italicsButtonClick(): void {\n this.tiptapEditor.chain().focus().toggleItalic().run();\n }\n\n /**\n * Toggle the italics mark and focus back to the editor\n * @internal\n */\n public italicsButtonKeyDown(event: KeyboardEvent): boolean {\n if (this.keyActivatesButton(event)) {\n this.tiptapEditor.chain().focus().toggleItalic().run();\n return false;\n }\n return true;\n }\n\n /**\n * Toggle the unordered list node and focus back to the editor\n * @internal\n */\n public bulletListButtonClick(): void {\n this.tiptapEditor.chain().focus().toggleBulletList().run();\n }\n\n /**\n * Toggle the unordered list node and focus back to the editor\n * @internal\n */\n public bulletListButtonKeyDown(event: KeyboardEvent): boolean {\n if (this.keyActivatesButton(event)) {\n this.tiptapEditor.chain().focus().toggleBulletList().run();\n return false;\n }\n return true;\n }\n\n /**\n * Toggle the ordered list node and focus back to the editor\n * @internal\n */\n public numberedListButtonClick(): void {\n this.tiptapEditor.chain().focus().toggleOrderedList().run();\n }\n\n /**\n * Toggle the ordered list node and focus back to the editor\n * @internal\n */\n public numberedListButtonKeyDown(event: KeyboardEvent): boolean {\n if (this.keyActivatesButton(event)) {\n this.tiptapEditor.chain().focus().toggleOrderedList().run();\n return false;\n }\n return true;\n }\n\n /**\n * Inserts the mention character into the editor and focus back to the editor\n * @internal\n */\n public mentionButtonClick(character: string): void {\n this.tiptapEditor\n .chain()\n .insertContent(\n this.shouldInsertSpace() ? ` ${character}` : character\n )\n .focus()\n .run();\n }\n\n /**\n * This function load tip tap editor with provided markdown content by parsing into html\n * @public\n */\n public setMarkdown(markdown: string): void {\n const html = this.getHtmlContent(markdown);\n this.tiptapEditor.commands.setContent(html);\n this.disableMentionViewElement();\n }\n\n /**\n * This function returns markdown string by serializing tiptap editor document using prosemirror MarkdownSerializer\n * @public\n */\n public getMarkdown(): string {\n return this.richTextMarkdownSerializer.serializeDOMToMarkdown(\n this.tiptapEditor.state.doc\n );\n }\n\n /**\n * @internal\n */\n public stopEventPropagation(event: Event): boolean {\n // Don't bubble the 'change' event from the toggle button because\n // all the formatting button has its own 'toggle' event through 'click' and 'keydown'.\n event.stopPropagation();\n return false;\n }\n\n public getMentionedHrefs(): string[] {\n const mentionedHrefs = new Set<string>();\n this.tiptapEditor.state.doc.descendants(node => {\n if (node.type.name.startsWith(mentionPluginPrefix)) {\n mentionedHrefs.add(node.attrs.href as string);\n }\n });\n return Array.from(mentionedHrefs);\n }\n\n /**\n * @internal\n */\n public getMentionExtensionConfig(): MentionExtensionConfiguration[] {\n return this.configuration instanceof EditorConfiguration\n ? this.configuration.mentionExtensionConfig\n : [];\n }\n\n /**\n * @internal\n */\n public onMentionSelect(event: CustomEvent<MentionDetail>): void {\n if (this.activeMentionCommand) {\n this.activeMentionCommand({\n href: event.detail.href,\n label: event.detail.displayName\n });\n }\n }\n\n /**\n * @internal\n */\n public focusoutHandler(): void {\n if (!this.mentionListbox?.open) {\n return;\n }\n this.mentionListbox?.close();\n }\n\n public override createConfig(): void {\n this.validate();\n if (this.richTextValidator.isValid()) {\n if (\n this.richTextUpdateTracker.updateButtonLabel\n || this.richTextUpdateTracker.updateMappingConfigs\n || this.richTextUpdateTracker.updatePattern\n ) {\n this.configuration = new EditorConfiguration(\n this.mentionElements\n );\n }\n } else {\n this.configuration = undefined;\n }\n }\n\n private isMentionExtensionConfigUnchanged(\n prev: EditorConfiguration | undefined,\n next: EditorConfiguration | undefined\n ): boolean {\n const prevConfigCharacters = prev?.mentionExtensionConfig\n .map(config => config.character)\n .sort((a, b) => a.localeCompare(b))\n .toString();\n const nextConfigCharacters = next?.mentionExtensionConfig\n .map(config => config.character)\n .sort((a, b) => a.localeCompare(b))\n .toString();\n return prevConfigCharacters === nextConfigCharacters;\n }\n\n private createEditor(): HTMLDivElement {\n const editor = document.createElement('div');\n editor.className = 'editor';\n editor.setAttribute('aria-multiline', 'true');\n editor.setAttribute('role', 'textbox');\n editor.setAttribute('aria-disabled', 'false');\n return editor;\n }\n\n private initializeEditor(): void {\n this.unbindEditorTransactionEvent();\n this.unbindEditorUpdateEvent();\n this.unbindNativeInputEvent();\n this.tiptapEditor?.destroy();\n this.tiptapEditor = createTiptapEditor(\n character => {\n this.activeMentionCharacter = character;\n },\n command => {\n this.activeMentionCommand = command;\n },\n this.editorDiv,\n this.configuration instanceof EditorConfiguration\n ? this.configuration.mentionExtensionConfig\n : [],\n this.mentionListbox,\n this.placeholder\n );\n this.disableEditor();\n this.disableMentionViewElement();\n this.bindEditorTransactionEvent();\n this.bindEditorUpdateEvent();\n this.stopNativeInputEventPropagation();\n }\n\n /**\n * This function takes the Fragment from parseMarkdownToDOM function and return the serialized string using XMLSerializer\n */\n private getHtmlContent(markdown: string): string {\n const parseResult = RichTextMarkdownParser.parseMarkdownToDOM(\n markdown,\n this.configuration?.parserMentionConfig\n );\n return this.xmlSerializer.serializeToString(parseResult.fragment);\n }\n\n /**\n * Binding the \"transaction\" event to the editor allows continuous monitoring the events and updating the button state in response to\n * various actions such as mouse events, keyboard events, changes in the editor content etc,.\n * https://tiptap.dev/api/events#transaction\n */\n private bindEditorTransactionEvent(): void {\n this.tiptapEditor.on('transaction', () => {\n this.updateEditorButtonsState();\n });\n }\n\n private unbindEditorTransactionEvent(): void {\n this.tiptapEditor.off('transaction');\n }\n\n private updateEditorButtonsState(): void {\n if (!this.$fastController.isConnected) {\n return;\n }\n\n const { extensionManager, state } = this.tiptapEditor;\n const { extensions } = extensionManager;\n const { selection } = state;\n const parentList = findParentNode((node: { type: { name: string } }) => isList(node.type.name, extensions))(selection);\n\n this.boldButton.checked = this.tiptapEditor.isActive('bold');\n this.italicsButton.checked = this.tiptapEditor.isActive('italic');\n this.bulletListButton.checked = parentList?.node.type.name === TipTapNodeName.bulletList;\n this.numberedListButton.checked = parentList?.node.type.name === TipTapNodeName.numberedList;\n }\n\n private keyActivatesButton(event: KeyboardEvent): boolean {\n switch (event.key) {\n case keySpace:\n case keyEnter:\n return true;\n default:\n return false;\n }\n }\n\n private unbindEditorUpdateEvent(): void {\n this.tiptapEditor.off('update');\n }\n\n /**\n * input event is fired when there is a change in the content of the editor.\n *\n * https://tiptap.dev/api/events#update\n */\n private bindEditorUpdateEvent(): void {\n this.tiptapEditor.on('update', () => {\n this.$emit('input');\n this.queueUpdateScrollbarWidth();\n });\n }\n\n private disableEditor(): void {\n this.tiptapEditor.setEditable(!this.disabled);\n this.setEditorTabIndex();\n this.editorDiv.setAttribute(\n 'aria-disabled',\n this.disabled ? 'true' : 'false'\n );\n this.mentionListbox?.close();\n }\n\n private disableMentionViewElement(): void {\n this.tiptapEditor.state.doc.descendants((node, pos) => {\n if (node.type.name.startsWith(mentionPluginPrefix)) {\n const updatedAttrs = {\n ...node.attrs,\n disabled: this.disabled ? '' : null\n };\n const updatedNode = this.tiptapEditor.schema.node(\n node.type.name,\n updatedAttrs,\n node.content\n );\n const updatedTransaction = this.tiptapEditor.state.tr.replaceWith(\n pos,\n pos + node.nodeSize,\n updatedNode\n );\n this.tiptapEditor.view.dispatch(updatedTransaction);\n }\n return true;\n });\n }\n\n /**\n * Stopping the native input event propagation emitted by the contenteditable element in the Tiptap\n * since there is an issue (linked below) in ProseMirror where selecting the text and removing it\n * does not trigger the native HTMLElement input event. So using the \"update\" event emitted by the\n * Tiptap to capture it as an \"input\" customEvent in the rich text editor.\n *\n * Prose Mirror issue: https://discuss.prosemirror.net/t/how-to-handle-select-backspace-delete-cut-type-kind-of-events-handletextinput-or-handledomevents-input-doesnt-help/4844\n */\n private stopNativeInputEventPropagation(): void {\n this.tiptapEditor.view.dom.addEventListener('input', event => {\n event.stopPropagation();\n });\n }\n\n private unbindNativeInputEvent(): void {\n this.tiptapEditor.view.dom.removeEventListener('input', () => {});\n }\n\n private queueUpdateScrollbarWidth(): void {\n if (!this.$fastController.isConnected) {\n return;\n }\n if (!this.updateScrollbarWidthQueued) {\n this.updateScrollbarWidthQueued = true;\n DOM.queueUpdate(() => this.updateScrollbarWidth());\n }\n }\n\n private updateScrollbarWidth(): void {\n this.updateScrollbarWidthQueued = false;\n this.scrollbarWidth = this.tiptapEditor.view.dom.offsetWidth\n - this.tiptapEditor.view.dom.clientWidth;\n }\n\n private onResize(): void {\n this.scrollbarWidth = this.tiptapEditor.view.dom.offsetWidth\n - this.tiptapEditor.view.dom.clientWidth;\n }\n\n private getTipTapExtension(\n extensionName: string\n ): AnyExtension | undefined {\n return this.tiptapEditor.extensionManager.extensions.find(\n (extension: { name: string }) => extension.name === extensionName\n );\n }\n\n private setEditorTabIndex(): void {\n this.tiptapEditor.setOptions({\n editorProps: {\n attributes: {\n tabindex: this.disabled ? '-1' : '0'\n }\n }\n });\n }\n\n private setActiveMappingConfigs(): void {\n this.activeMappingConfigs = this.activeMentionCharacter\n ? this.getMentionExtensionConfigFromCharacter(\n this.activeMentionCharacter\n )?.mappingConfigs\n : undefined;\n }\n\n private shouldInsertSpace(): boolean {\n const { $anchor, $head } = this.tiptapEditor.view.state.selection;\n\n const isAtStartOfLine = $head.parentOffset === 0 || $anchor.parentOffset === 0;\n const nodeBeforeSelection = $anchor.pos < $head.pos ? $anchor.nodeBefore : $head.nodeBefore;\n const isHardBreakNode = nodeBeforeSelection?.type.name === HardBreak.name;\n const hasWhitespaceBeforeCurrentPosition = nodeBeforeSelection?.textContent.endsWith(' ');\n\n return (\n !isAtStartOfLine\n && !isHardBreakNode\n && !hasWhitespaceBeforeCurrentPosition\n );\n }\n\n private getMentionExtensionConfigFromCharacter(\n character: string\n ): MentionExtensionConfiguration | undefined {\n return this.getMentionExtensionConfig().find(\n config => config.character === character\n );\n }\n\n private resetEditorButtonsState(\n buttonsState: FormatButtonsState | undefined\n ): void {\n if (buttonsState?.bold && !this.tiptapEditor.isActive('bold')) {\n this.tiptapEditor.chain().focus().toggleBold().run();\n }\n if (buttonsState?.italics && !this.tiptapEditor.isActive('italic')) {\n this.tiptapEditor.chain().focus().toggleItalic().run();\n }\n }\n\n private getButtonsState(\n tiptapEditor: Editor\n ): FormatButtonsState | undefined {\n if (!this.$fastController.isConnected) {\n return undefined;\n }\n return {\n bold: tiptapEditor.isActive('bold'),\n italics: tiptapEditor.isActive('italic')\n };\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface RichTextEditor extends ARIAGlobalStatesAndProperties {}\napplyMixins(RichTextEditor, ARIAGlobalStatesAndProperties);\n\nconst nimbleRichTextEditor = RichTextEditor.compose({\n baseName: 'rich-text-editor',\n template,\n styles,\n shadowOptions: {\n delegatesFocus: true\n }\n});\n\nDesignSystem.getOrCreate()\n .withPrefix('nimble')\n .register(nimbleRichTextEditor());\nexport const richTextEditorTag = 'nimble-rich-text-editor';\n"]}
@@ -1,6 +1,5 @@
1
1
  import { AnchoredRegion, ListboxOption, SelectPosition } from '@microsoft/fast-foundation';
2
2
  import { DropdownAppearance, ListOptionOwner } from '../patterns/dropdown/types';
3
- import type { ErrorPattern } from '../patterns/error/types';
4
3
  import type { ListOption } from '../list-option';
5
4
  import { FilterMode } from './types';
6
5
  import { FormAssociatedSelect } from './models/select-form-associated';
@@ -10,10 +9,20 @@ declare global {
10
9
  }
11
10
  }
12
11
  type BooleanOrVoid = boolean | void;
12
+ declare const Select_base: (abstract new (...args: any[]) => {
13
+ errorText?: string | undefined;
14
+ errorVisible: boolean;
15
+ errorHasOverflow: boolean;
16
+ readonly $fastController: import("@microsoft/fast-element").Controller;
17
+ $emit(type: string, detail?: any, options?: Omit<CustomEventInit<any>, "detail"> | undefined): boolean | void;
18
+ connectedCallback(): void;
19
+ disconnectedCallback(): void;
20
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
21
+ }) & typeof FormAssociatedSelect;
13
22
  /**
14
23
  * A nimble-styled HTML select.
15
24
  */
16
- export declare class Select extends FormAssociatedSelect implements ErrorPattern, ListOptionOwner {
25
+ export declare class Select extends Select_base implements ListOptionOwner {
17
26
  appearance: DropdownAppearance;
18
27
  /**
19
28
  * Reflects the placement for the listbox when the select is open.
@@ -21,15 +30,6 @@ export declare class Select extends FormAssociatedSelect implements ErrorPattern
21
30
  * @public
22
31
  */
23
32
  positionAttribute?: SelectPosition;
24
- /**
25
- * A message explaining why the value is invalid.
26
- *
27
- * @public
28
- * @remarks
29
- * HTML Attribute: error-text
30
- */
31
- errorText: string | undefined;
32
- errorVisible: boolean;
33
33
  filterMode: FilterMode;
34
34
  clearable: boolean;
35
35
  loadingVisible: boolean;
@@ -7,6 +7,7 @@ import { arrowExpanderDown16X16 } from '@ni/nimble-tokens/dist/icons/js';
7
7
  import { styles } from './styles';
8
8
  import { DropdownAppearance } from '../patterns/dropdown/types';
9
9
  import { errorTextTemplate } from '../patterns/error/template';
10
+ import { mixinErrorPattern } from '../patterns/error/types';
10
11
  import { iconExclamationMarkTag } from '../icons/exclamation-mark';
11
12
  import { isListOption, isListOptionGroup, template } from './template';
12
13
  import { FilterMode } from './types';
@@ -25,11 +26,10 @@ const isOptionOrGroupVisible = (el) => {
25
26
  /**
26
27
  * A nimble-styled HTML select.
27
28
  */
28
- export class Select extends FormAssociatedSelect {
29
+ export class Select extends mixinErrorPattern(FormAssociatedSelect) {
29
30
  constructor() {
30
31
  super(...arguments);
31
32
  this.appearance = DropdownAppearance.underline;
32
- this.errorVisible = false;
33
33
  this.filterMode = FilterMode.none;
34
34
  this.clearable = false;
35
35
  this.loadingVisible = false;
@@ -1023,12 +1023,6 @@ __decorate([
1023
1023
  __decorate([
1024
1024
  attr({ attribute: 'position' })
1025
1025
  ], Select.prototype, "positionAttribute", void 0);
1026
- __decorate([
1027
- attr({ attribute: 'error-text' })
1028
- ], Select.prototype, "errorText", void 0);
1029
- __decorate([
1030
- attr({ attribute: 'error-visible', mode: 'boolean' })
1031
- ], Select.prototype, "errorVisible", void 0);
1032
1026
  __decorate([
1033
1027
  attr({ attribute: 'filter-mode' })
1034
1028
  ], Select.prototype, "filterMode", void 0);