@limetech/lime-elements 37.27.0 → 37.28.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 (53) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/lime-elements.cjs.js +1 -1
  3. package/dist/cjs/limel-markdown.cjs.entry.js +6 -43714
  4. package/dist/cjs/limel-markdown.cjs.entry.js.map +1 -1
  5. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +8697 -29
  6. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
  7. package/dist/cjs/limel-text-editor.cjs.entry.js +2 -1
  8. package/dist/cjs/limel-text-editor.cjs.entry.js.map +1 -1
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/markdown-parser-1686b0d7.js +44158 -0
  11. package/dist/cjs/markdown-parser-1686b0d7.js.map +1 -0
  12. package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +42 -16
  13. package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js.map +1 -1
  14. package/dist/collection/components/text-editor/text-editor.js +23 -2
  15. package/dist/collection/components/text-editor/text-editor.js.map +1 -1
  16. package/dist/collection/components/text-editor/utils/content-type-converter.js +2 -0
  17. package/dist/collection/components/text-editor/utils/content-type-converter.js.map +1 -0
  18. package/dist/collection/components/text-editor/utils/html-converter.js +21 -0
  19. package/dist/collection/components/text-editor/utils/html-converter.js.map +1 -0
  20. package/dist/collection/components/text-editor/utils/markdown-converter.js +21 -0
  21. package/dist/collection/components/text-editor/utils/markdown-converter.js.map +1 -0
  22. package/dist/esm/lime-elements.js +1 -1
  23. package/dist/esm/limel-markdown.entry.js +4 -43712
  24. package/dist/esm/limel-markdown.entry.js.map +1 -1
  25. package/dist/esm/limel-prosemirror-adapter.entry.js +8697 -29
  26. package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
  27. package/dist/esm/limel-text-editor.entry.js +2 -1
  28. package/dist/esm/limel-text-editor.entry.js.map +1 -1
  29. package/dist/esm/loader.js +1 -1
  30. package/dist/esm/markdown-parser-2ab3dab9.js +44155 -0
  31. package/dist/esm/markdown-parser-2ab3dab9.js.map +1 -0
  32. package/dist/lime-elements/lime-elements.esm.js +1 -1
  33. package/dist/lime-elements/lime-elements.esm.js.map +1 -1
  34. package/dist/lime-elements/p-50a9c9b4.entry.js +2 -0
  35. package/dist/lime-elements/p-50a9c9b4.entry.js.map +1 -0
  36. package/dist/lime-elements/p-714d3ef8.js +8 -0
  37. package/dist/lime-elements/p-714d3ef8.js.map +1 -0
  38. package/dist/lime-elements/p-b4669729.entry.js +2 -0
  39. package/dist/lime-elements/p-b4669729.entry.js.map +1 -0
  40. package/dist/lime-elements/{p-48d4564a.entry.js → p-e9d2525d.entry.js} +2 -2
  41. package/dist/lime-elements/p-e9d2525d.entry.js.map +1 -0
  42. package/dist/types/components/text-editor/prosemirror-adapter/prosemirror-adapter.d.ts +10 -3
  43. package/dist/types/components/text-editor/text-editor.d.ts +8 -1
  44. package/dist/types/components/text-editor/utils/content-type-converter.d.ts +15 -0
  45. package/dist/types/components/text-editor/utils/html-converter.d.ts +10 -0
  46. package/dist/types/components/text-editor/utils/markdown-converter.d.ts +10 -0
  47. package/dist/types/components.d.ts +28 -4
  48. package/package.json +2 -1
  49. package/dist/lime-elements/p-48d4564a.entry.js.map +0 -1
  50. package/dist/lime-elements/p-91f40d46.entry.js +0 -2
  51. package/dist/lime-elements/p-91f40d46.entry.js.map +0 -1
  52. package/dist/lime-elements/p-b6e238b6.entry.js +0 -8
  53. package/dist/lime-elements/p-b6e238b6.entry.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{r as e,c as r,h as t}from"./p-443111b3.js";const o='@charset "UTF-8";:host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}.lime-empty-value-for-readonly{z-index:1;position:absolute;top:0.875rem;left:1rem}.lime-looks-like-input-value{line-height:1.75rem;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;color:rgba(var(--contrast-1400), 1);font-size:0.875rem;font-weight:400;letter-spacing:0.009375em}.mdc-text-field--disabled .lime-looks-like-input-value{cursor:not-allowed;opacity:0.4}*{box-sizing:border-box}:host(limel-text-editor){--limel-text-editor-padding:0.75rem;position:relative;isolation:isolate;display:flex;flex-direction:column;width:100%;min-width:5rem;min-height:4rem;height:100%;max-height:100%}:host(limel-text-editor:not([readonly])){--limel-text-editor-outline-color:rgba(var(--contrast-700), 0.65);--limel-text-editor-background-color:rgba(var(--contrast-200), 0.5);--limel-text-editor-label-color:rgba(var(--contrast-1200), 1)}:host(limel-text-editor[readonly]){--limel-text-editor-outline-color:transparent;min-height:2.5rem}:host(limel-text-editor[readonly]) limel-markdown{display:block;padding:var(--limel-text-editor-padding)}.notched-outline{position:absolute;inset:0;display:flex;background-color:var(--limel-text-editor-background-color)}.leading-outline,.notch,.trailing-outline{border-width:1px;border-style:solid;border-color:var(--limel-text-editor-outline-color)}.leading-outline{flex-shrink:0;width:0.75rem;border-right-width:0;border-top-left-radius:0.25rem;border-bottom-left-radius:0.25rem}.notch{flex-shrink:0;position:relative;z-index:2;border-top-width:0;border-right-width:0;border-left-width:0;max-width:calc(100% - 1.5rem)}.trailing-outline{flex-grow:1;border-left-width:0;border-top-right-radius:0.25rem;border-bottom-right-radius:0.25rem}label{transform:translateY(-50%);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:block;padding:0 0.25rem;color:var(--limel-text-editor-label-color);font-size:0.65rem;letter-spacing:var(--mdc-typography-subtitle1-letter-spacing, 0.009375em)}limel-prosemirror-adapter{flex-grow:1;min-width:0;min-height:0;height:100%;overflow:hidden auto}';const i=class{constructor(t){e(this,t);this.change=r(this,"change",7);this.handleChange=()=>e=>{e.stopPropagation();this.change.emit(e.detail)};this.disabled=undefined;this.readonly=undefined;this.helperText=undefined;this.placeholder=undefined;this.label=undefined;this.invalid=undefined;this.value=undefined}render(){return[t("span",{class:"notched-outline"},t("span",{class:"leading-outline"}),this.renderLabel(),t("span",{class:"trailing-outline"})),this.renderEditor()]}renderEditor(){if(this.readonly&&!this.value){return t("span",{class:"lime-empty-value-for-readonly lime-looks-like-input-value"},"–")}if(this.readonly){return t("limel-markdown",{value:this.value})}return t("limel-prosemirror-adapter",{onChange:this.handleChange,value:this.value})}renderLabel(){if(!this.label){return}return t("span",{class:"notch"},t("label",null,this.label))}};i.style=o;export{i as limel_text_editor};
2
- //# sourceMappingURL=p-48d4564a.entry.js.map
1
+ import{r as e,c as r,h as t}from"./p-443111b3.js";const o='@charset "UTF-8";:host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}.lime-empty-value-for-readonly{z-index:1;position:absolute;top:0.875rem;left:1rem}.lime-looks-like-input-value{line-height:1.75rem;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;color:rgba(var(--contrast-1400), 1);font-size:0.875rem;font-weight:400;letter-spacing:0.009375em}.mdc-text-field--disabled .lime-looks-like-input-value{cursor:not-allowed;opacity:0.4}*{box-sizing:border-box}:host(limel-text-editor){--limel-text-editor-padding:0.75rem;position:relative;isolation:isolate;display:flex;flex-direction:column;width:100%;min-width:5rem;min-height:4rem;height:100%;max-height:100%}:host(limel-text-editor:not([readonly])){--limel-text-editor-outline-color:rgba(var(--contrast-700), 0.65);--limel-text-editor-background-color:rgba(var(--contrast-200), 0.5);--limel-text-editor-label-color:rgba(var(--contrast-1200), 1)}:host(limel-text-editor[readonly]){--limel-text-editor-outline-color:transparent;min-height:2.5rem}:host(limel-text-editor[readonly]) limel-markdown{display:block;padding:var(--limel-text-editor-padding)}.notched-outline{position:absolute;inset:0;display:flex;background-color:var(--limel-text-editor-background-color)}.leading-outline,.notch,.trailing-outline{border-width:1px;border-style:solid;border-color:var(--limel-text-editor-outline-color)}.leading-outline{flex-shrink:0;width:0.75rem;border-right-width:0;border-top-left-radius:0.25rem;border-bottom-left-radius:0.25rem}.notch{flex-shrink:0;position:relative;z-index:2;border-top-width:0;border-right-width:0;border-left-width:0;max-width:calc(100% - 1.5rem)}.trailing-outline{flex-grow:1;border-left-width:0;border-top-right-radius:0.25rem;border-bottom-right-radius:0.25rem}label{transform:translateY(-50%);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:block;padding:0 0.25rem;color:var(--limel-text-editor-label-color);font-size:0.65rem;letter-spacing:var(--mdc-typography-subtitle1-letter-spacing, 0.009375em)}limel-prosemirror-adapter{flex-grow:1;min-width:0;min-height:0;height:100%;overflow:hidden auto}';const i=class{constructor(t){e(this,t);this.change=r(this,"change",7);this.handleChange=()=>e=>{e.stopPropagation();this.change.emit(e.detail)};this.contentType="markdown";this.disabled=undefined;this.readonly=undefined;this.helperText=undefined;this.placeholder=undefined;this.label=undefined;this.invalid=undefined;this.value=undefined}render(){return[t("span",{class:"notched-outline"},t("span",{class:"leading-outline"}),this.renderLabel(),t("span",{class:"trailing-outline"})),this.renderEditor()]}renderEditor(){if(this.readonly&&!this.value){return t("span",{class:"lime-empty-value-for-readonly lime-looks-like-input-value"},"–")}if(this.readonly){return t("limel-markdown",{value:this.value})}return t("limel-prosemirror-adapter",{contentType:this.contentType,onChange:this.handleChange,value:this.value})}renderLabel(){if(!this.label){return}return t("span",{class:"notch"},t("label",null,this.label))}};i.style=o;export{i as limel_text_editor};
2
+ //# sourceMappingURL=p-e9d2525d.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["textEditorCss","TextEditor","this","handleChange","event","stopPropagation","change","emit","detail","render","h","class","renderLabel","renderEditor","readonly","value","contentType","onChange","label"],"sources":["./src/components/text-editor/text-editor.scss?tag=limel-text-editor&encapsulation=shadow","./src/components/text-editor/text-editor.tsx"],"sourcesContent":["@use '../../style/internal/shared_input-select-picker';\n@use '../../../src/style/mixins.scss';\n\n@include shared_input-select-picker.lime-empty-value-for-readonly;\n@include shared_input-select-picker.lime-looks-like-input-value;\n\n* {\n box-sizing: border-box;\n}\n\n:host(limel-text-editor) {\n --limel-text-editor-padding: 0.75rem;\n position: relative;\n isolation: isolate;\n display: flex;\n flex-direction: column;\n\n width: 100%;\n min-width: 5rem;\n min-height: 4rem;\n height: 100%;\n max-height: 100%;\n}\n\n:host(limel-text-editor:not([readonly])) {\n --limel-text-editor-outline-color: #{shared_input-select-picker.$lime-text-field-outline-color};\n --limel-text-editor-background-color: #{shared_input-select-picker.$background-color-normal};\n --limel-text-editor-label-color: #{shared_input-select-picker.$label-color};\n}\n\n:host(limel-text-editor[readonly]) {\n --limel-text-editor-outline-color: transparent;\n min-height: shared_input-select-picker.$height-of-mdc-text-field;\n\n limel-markdown {\n display: block;\n padding: var(--limel-text-editor-padding);\n }\n}\n\n.notched-outline {\n position: absolute;\n inset: 0;\n\n display: flex;\n background-color: var(--limel-text-editor-background-color);\n}\n\n.leading-outline,\n.notch,\n.trailing-outline {\n border-width: 1px;\n border-style: solid;\n border-color: var(--limel-text-editor-outline-color);\n}\n\n.leading-outline {\n flex-shrink: 0;\n width: 0.75rem;\n border-right-width: 0;\n border-top-left-radius: 0.25rem;\n border-bottom-left-radius: 0.25rem;\n}\n\n.notch {\n flex-shrink: 0;\n\n position: relative;\n z-index: 2;\n\n border-top-width: 0;\n border-right-width: 0;\n border-left-width: 0;\n\n max-width: calc(100% - 1.5rem);\n}\n\n.trailing-outline {\n flex-grow: 1;\n border-left-width: 0;\n border-top-right-radius: 0.25rem;\n border-bottom-right-radius: 0.25rem;\n}\n\nlabel {\n transform: translateY(-50%);\n\n @include mixins.truncate-text;\n display: block;\n padding: 0 0.25rem;\n\n color: var(--limel-text-editor-label-color);\n font-size: 0.65rem; // `10.4px` similar to MDC's floating label\n letter-spacing: var(--mdc-typography-subtitle1-letter-spacing, 0.009375em);\n}\n\nlimel-prosemirror-adapter {\n flex-grow: 1;\n\n min-width: 0;\n min-height: 0;\n height: 100%;\n overflow: hidden auto;\n}\n","import { Component, Event, EventEmitter, Prop, h } from '@stencil/core';\nimport { FormComponent } from '../form/form.types';\n/**\n * A rich text editor that offers a rich text editing experience with markdown support,\n * in the sense that you can easily type markdown syntax and see the rendered\n * result as rich text in real-time. For instance, you can type `# Hello, world!`\n * and see it directly turning to a heading 1 (an `<h1>` HTML element).\n *\n * Naturally, you can use standard keyboard hotkeys such as <kbd>Ctrl</kbd> + <kbd>B</kbd>\n * to toggle bold text, <kbd>Ctrl</kbd> + <kbd>I</kbd> to toggle italic text, and so on.\n *\n * @exampleComponent limel-example-text-editor-basic\n * @exampleComponent limel-example-text-editor-as-form-component\n * @exampleComponent limel-example-text-editor-composite\n * @exampleComponent limel-example-text-editor-with-markdown\n * @exampleComponent limel-example-text-editor-with-html\n * @exampleComponent limel-example-text-editor-height\n * @beta\n * @private\n */\n@Component({\n tag: 'limel-text-editor',\n shadow: true,\n styleUrl: 'text-editor.scss',\n})\nexport class TextEditor implements FormComponent<string> {\n /** The type of content that the editor should handle and emit, defaults to `markdown`\n *\n * Assumed to be set only once, so not reactive to changes\n */\n @Prop()\n public contentType: 'markdown' | 'html' = 'markdown';\n\n /**\n * Set to `true` to disable the field.\n * Use `disabled` to indicate that the field can normally be interacted\n * with, but is currently disabled. This tells the user that if certain\n * requirements are met, the field may become enabled again.\n */\n @Prop({ reflect: true })\n public disabled?: boolean;\n\n /**\n * Set to `true` to make the component read-only.\n * Use `readonly` when the field is only there to present the data it holds,\n * and will not become possible for the current user to edit.\n * :::note\n * Consider that it might be better to use `limel-markdown`\n * instead of `limel-text-editor` when the goal is visualizing data.\n * :::\n */\n @Prop({ reflect: true })\n public readonly?: boolean;\n\n /**\n * Optional helper text to display below the input field when it has focus\n */\n @Prop({ reflect: true })\n public helperText?: string;\n\n /**\n * The placeholder text shown inside the input field,\n * when the field is empty.\n */\n @Prop({ reflect: true })\n public placeholder?: string;\n\n /**\n * The label of the editor\n */\n @Prop({ reflect: true })\n public label?: string;\n\n /**\n * Set to `true` to indicate that the current value of the editor is\n * invalid.\n */\n @Prop({ reflect: true })\n public invalid?: boolean;\n\n /**\n * Description of the text inside the editor as markdown\n */\n @Prop({ reflect: true })\n public value: string;\n\n /**\n * Dispatched when a change is made to the editor\n */\n @Event()\n public change: EventEmitter<string>;\n\n public render() {\n return [\n <span class=\"notched-outline\">\n <span class=\"leading-outline\" />\n {this.renderLabel()}\n <span class=\"trailing-outline\" />\n </span>,\n this.renderEditor(),\n ];\n }\n\n private renderEditor() {\n if (this.readonly && !this.value) {\n return (\n <span class=\"lime-empty-value-for-readonly lime-looks-like-input-value\">\n –\n </span>\n );\n }\n\n if (this.readonly) {\n return <limel-markdown value={this.value} />;\n }\n\n return (\n <limel-prosemirror-adapter\n contentType={this.contentType}\n onChange={this.handleChange}\n value={this.value}\n />\n );\n }\n\n private renderLabel() {\n if (!this.label) {\n return;\n }\n\n return (\n <span class=\"notch\">\n <label>{this.label}</label>\n </span>\n );\n }\n\n private handleChange = () => (event: CustomEvent<string>) => {\n event.stopPropagation();\n this.change.emit(event.detail);\n };\n}\n"],"mappings":"kDAAA,MAAMA,EAAgB,upG,MCyBTC,EAAU,M,wDAgHXC,KAAAC,aAAe,IAAOC,IAC1BA,EAAMC,kBACNH,KAAKI,OAAOC,KAAKH,EAAMI,OAAO,E,iBA5GQ,W,sKA6DnCC,SACH,MAAO,CACHC,EAAA,QAAMC,MAAM,mBACRD,EAAA,QAAMC,MAAM,oBACXT,KAAKU,cACNF,EAAA,QAAMC,MAAM,sBAEhBT,KAAKW,e,CAILA,eACJ,GAAIX,KAAKY,WAAaZ,KAAKa,MAAO,CAC9B,OACIL,EAAA,QAAMC,MAAM,6DAA2D,I,CAM/E,GAAIT,KAAKY,SAAU,CACf,OAAOJ,EAAA,kBAAgBK,MAAOb,KAAKa,O,CAGvC,OACIL,EAAA,6BACIM,YAAad,KAAKc,YAClBC,SAAUf,KAAKC,aACfY,MAAOb,KAAKa,O,CAKhBH,cACJ,IAAKV,KAAKgB,MAAO,CACb,M,CAGJ,OACIR,EAAA,QAAMC,MAAM,SACRD,EAAA,aAAQR,KAAKgB,O"}
@@ -9,7 +9,13 @@
9
9
  */
10
10
  export declare class ProsemirrorAdapter {
11
11
  /**
12
- * The value of the editor, expected to be serialised HTML
12
+ * The type of content that the editor should handle and emit, defaults to `markdown`
13
+ *
14
+ * Assumed to be set only once, so not reactive to changes
15
+ */
16
+ contentType: 'markdown' | 'html';
17
+ /**
18
+ * The value of the editor, expected to be markdown
13
19
  */
14
20
  value: string;
15
21
  private host;
@@ -20,10 +26,11 @@ export declare class ProsemirrorAdapter {
20
26
  * Dispatched when a change is made to the editor
21
27
  */
22
28
  private change;
29
+ private contentConverter;
30
+ componentWillLoad(): void;
23
31
  componentDidLoad(): void;
24
32
  render(): any[];
25
- private initializeEditor;
26
- private getHTML;
33
+ private initializeTextEditor;
27
34
  private handleActionBarItem;
28
35
  private executeCommand;
29
36
  }
@@ -12,11 +12,18 @@ import { FormComponent } from '../form/form.types';
12
12
  * @exampleComponent limel-example-text-editor-basic
13
13
  * @exampleComponent limel-example-text-editor-as-form-component
14
14
  * @exampleComponent limel-example-text-editor-composite
15
+ * @exampleComponent limel-example-text-editor-with-markdown
16
+ * @exampleComponent limel-example-text-editor-with-html
15
17
  * @exampleComponent limel-example-text-editor-height
16
18
  * @beta
17
19
  * @private
18
20
  */
19
21
  export declare class TextEditor implements FormComponent<string> {
22
+ /** The type of content that the editor should handle and emit, defaults to `markdown`
23
+ *
24
+ * Assumed to be set only once, so not reactive to changes
25
+ */
26
+ contentType: 'markdown' | 'html';
20
27
  /**
21
28
  * Set to `true` to disable the field.
22
29
  * Use `disabled` to indicate that the field can normally be interacted
@@ -53,7 +60,7 @@ export declare class TextEditor implements FormComponent<string> {
53
60
  */
54
61
  invalid?: boolean;
55
62
  /**
56
- * Description of the text inside the editor as serialised HTML
63
+ * Description of the text inside the editor as markdown
57
64
  */
58
65
  value: string;
59
66
  /**
@@ -0,0 +1,15 @@
1
+ import { EditorView } from 'prosemirror-view';
2
+ import { Schema } from 'prosemirror-model';
3
+ /**
4
+ * Abstract class implementing a generic parser/serialiser
5
+ * for different editor content types
6
+ *
7
+ * Acts as a parser/serialiser between document encodings (e.g., markdown, HTML) and the ProseMirror document
8
+ *
9
+ * @private
10
+ */
11
+ export interface ContentTypeConverter {
12
+ parseAsHTML: (text: string, schema: Schema) => Promise<string>;
13
+ serialize: (view: EditorView, schema: Schema) => string;
14
+ }
15
+ //# sourceMappingURL=content-type-converter.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { ContentTypeConverter } from './content-type-converter';
2
+ import { EditorView } from 'prosemirror-view';
3
+ /**
4
+ * @private
5
+ */
6
+ export declare class HTMLConverter implements ContentTypeConverter {
7
+ parseAsHTML: (text: string) => Promise<string>;
8
+ serialize: (view: EditorView) => string;
9
+ }
10
+ //# sourceMappingURL=html-converter.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { ContentTypeConverter } from './content-type-converter';
2
+ import { EditorView } from 'prosemirror-view';
3
+ /**
4
+ * @private
5
+ */
6
+ export declare class markdownConverter implements ContentTypeConverter {
7
+ parseAsHTML: (text: string) => Promise<string>;
8
+ serialize: (view: EditorView) => string;
9
+ }
10
+ //# sourceMappingURL=markdown-converter.d.ts.map
@@ -2063,7 +2063,11 @@ export namespace Components {
2063
2063
  */
2064
2064
  interface LimelProsemirrorAdapter {
2065
2065
  /**
2066
- * The value of the editor, expected to be serialised HTML
2066
+ * The type of content that the editor should handle and emit, defaults to `markdown` Assumed to be set only once, so not reactive to changes
2067
+ */
2068
+ "contentType": 'markdown' | 'html';
2069
+ /**
2070
+ * The value of the editor, expected to be markdown
2067
2071
  */
2068
2072
  "value": string;
2069
2073
  }
@@ -2482,11 +2486,17 @@ export namespace Components {
2482
2486
  * @exampleComponent limel-example-text-editor-basic
2483
2487
  * @exampleComponent limel-example-text-editor-as-form-component
2484
2488
  * @exampleComponent limel-example-text-editor-composite
2489
+ * @exampleComponent limel-example-text-editor-with-markdown
2490
+ * @exampleComponent limel-example-text-editor-with-html
2485
2491
  * @exampleComponent limel-example-text-editor-height
2486
2492
  * @beta
2487
2493
  * @private
2488
2494
  */
2489
2495
  interface LimelTextEditor {
2496
+ /**
2497
+ * The type of content that the editor should handle and emit, defaults to `markdown` Assumed to be set only once, so not reactive to changes
2498
+ */
2499
+ "contentType": 'markdown' | 'html';
2490
2500
  /**
2491
2501
  * Set to `true` to disable the field. Use `disabled` to indicate that the field can normally be interacted with, but is currently disabled. This tells the user that if certain requirements are met, the field may become enabled again.
2492
2502
  */
@@ -2512,7 +2522,7 @@ export namespace Components {
2512
2522
  */
2513
2523
  "readonly"?: boolean;
2514
2524
  /**
2515
- * Description of the text inside the editor as serialised HTML
2525
+ * Description of the text inside the editor as markdown
2516
2526
  */
2517
2527
  "value": string;
2518
2528
  }
@@ -4027,6 +4037,8 @@ declare global {
4027
4037
  * @exampleComponent limel-example-text-editor-basic
4028
4038
  * @exampleComponent limel-example-text-editor-as-form-component
4029
4039
  * @exampleComponent limel-example-text-editor-composite
4040
+ * @exampleComponent limel-example-text-editor-with-markdown
4041
+ * @exampleComponent limel-example-text-editor-with-html
4030
4042
  * @exampleComponent limel-example-text-editor-height
4031
4043
  * @beta
4032
4044
  * @private
@@ -6327,12 +6339,16 @@ declare namespace LocalJSX {
6327
6339
  * @private
6328
6340
  */
6329
6341
  interface LimelProsemirrorAdapter {
6342
+ /**
6343
+ * The type of content that the editor should handle and emit, defaults to `markdown` Assumed to be set only once, so not reactive to changes
6344
+ */
6345
+ "contentType"?: 'markdown' | 'html';
6330
6346
  /**
6331
6347
  * Dispatched when a change is made to the editor
6332
6348
  */
6333
6349
  "onChange"?: (event: LimelProsemirrorAdapterCustomEvent<string>) => void;
6334
6350
  /**
6335
- * The value of the editor, expected to be serialised HTML
6351
+ * The value of the editor, expected to be markdown
6336
6352
  */
6337
6353
  "value"?: string;
6338
6354
  }
@@ -6807,11 +6823,17 @@ declare namespace LocalJSX {
6807
6823
  * @exampleComponent limel-example-text-editor-basic
6808
6824
  * @exampleComponent limel-example-text-editor-as-form-component
6809
6825
  * @exampleComponent limel-example-text-editor-composite
6826
+ * @exampleComponent limel-example-text-editor-with-markdown
6827
+ * @exampleComponent limel-example-text-editor-with-html
6810
6828
  * @exampleComponent limel-example-text-editor-height
6811
6829
  * @beta
6812
6830
  * @private
6813
6831
  */
6814
6832
  interface LimelTextEditor {
6833
+ /**
6834
+ * The type of content that the editor should handle and emit, defaults to `markdown` Assumed to be set only once, so not reactive to changes
6835
+ */
6836
+ "contentType"?: 'markdown' | 'html';
6815
6837
  /**
6816
6838
  * Set to `true` to disable the field. Use `disabled` to indicate that the field can normally be interacted with, but is currently disabled. This tells the user that if certain requirements are met, the field may become enabled again.
6817
6839
  */
@@ -6841,7 +6863,7 @@ declare namespace LocalJSX {
6841
6863
  */
6842
6864
  "readonly"?: boolean;
6843
6865
  /**
6844
- * Description of the text inside the editor as serialised HTML
6866
+ * Description of the text inside the editor as markdown
6845
6867
  */
6846
6868
  "value"?: string;
6847
6869
  }
@@ -7952,6 +7974,8 @@ declare module "@stencil/core" {
7952
7974
  * @exampleComponent limel-example-text-editor-basic
7953
7975
  * @exampleComponent limel-example-text-editor-as-form-component
7954
7976
  * @exampleComponent limel-example-text-editor-composite
7977
+ * @exampleComponent limel-example-text-editor-with-markdown
7978
+ * @exampleComponent limel-example-text-editor-with-html
7955
7979
  * @exampleComponent limel-example-text-editor-height
7956
7980
  * @beta
7957
7981
  * @private
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-elements",
3
- "version": "37.27.0",
3
+ "version": "37.28.1",
4
4
  "description": "Lime Elements",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",
@@ -84,6 +84,7 @@
84
84
  "parse-css-color": "^0.2.1",
85
85
  "prettier": "^3.2.5",
86
86
  "prosemirror-example-setup": "^1.2.2",
87
+ "prosemirror-markdown": "^1.12.0",
87
88
  "prosemirror-schema-basic": "^1.2.2",
88
89
  "puppeteer": "^19.11.1",
89
90
  "react": "^18.2.0",
@@ -1 +0,0 @@
1
- {"version":3,"names":["textEditorCss","TextEditor","this","handleChange","event","stopPropagation","change","emit","detail","render","h","class","renderLabel","renderEditor","readonly","value","onChange","label"],"sources":["./src/components/text-editor/text-editor.scss?tag=limel-text-editor&encapsulation=shadow","./src/components/text-editor/text-editor.tsx"],"sourcesContent":["@use '../../style/internal/shared_input-select-picker';\n@use '../../../src/style/mixins.scss';\n\n@include shared_input-select-picker.lime-empty-value-for-readonly;\n@include shared_input-select-picker.lime-looks-like-input-value;\n\n* {\n box-sizing: border-box;\n}\n\n:host(limel-text-editor) {\n --limel-text-editor-padding: 0.75rem;\n position: relative;\n isolation: isolate;\n display: flex;\n flex-direction: column;\n\n width: 100%;\n min-width: 5rem;\n min-height: 4rem;\n height: 100%;\n max-height: 100%;\n}\n\n:host(limel-text-editor:not([readonly])) {\n --limel-text-editor-outline-color: #{shared_input-select-picker.$lime-text-field-outline-color};\n --limel-text-editor-background-color: #{shared_input-select-picker.$background-color-normal};\n --limel-text-editor-label-color: #{shared_input-select-picker.$label-color};\n}\n\n:host(limel-text-editor[readonly]) {\n --limel-text-editor-outline-color: transparent;\n min-height: shared_input-select-picker.$height-of-mdc-text-field;\n\n limel-markdown {\n display: block;\n padding: var(--limel-text-editor-padding);\n }\n}\n\n.notched-outline {\n position: absolute;\n inset: 0;\n\n display: flex;\n background-color: var(--limel-text-editor-background-color);\n}\n\n.leading-outline,\n.notch,\n.trailing-outline {\n border-width: 1px;\n border-style: solid;\n border-color: var(--limel-text-editor-outline-color);\n}\n\n.leading-outline {\n flex-shrink: 0;\n width: 0.75rem;\n border-right-width: 0;\n border-top-left-radius: 0.25rem;\n border-bottom-left-radius: 0.25rem;\n}\n\n.notch {\n flex-shrink: 0;\n\n position: relative;\n z-index: 2;\n\n border-top-width: 0;\n border-right-width: 0;\n border-left-width: 0;\n\n max-width: calc(100% - 1.5rem);\n}\n\n.trailing-outline {\n flex-grow: 1;\n border-left-width: 0;\n border-top-right-radius: 0.25rem;\n border-bottom-right-radius: 0.25rem;\n}\n\nlabel {\n transform: translateY(-50%);\n\n @include mixins.truncate-text;\n display: block;\n padding: 0 0.25rem;\n\n color: var(--limel-text-editor-label-color);\n font-size: 0.65rem; // `10.4px` similar to MDC's floating label\n letter-spacing: var(--mdc-typography-subtitle1-letter-spacing, 0.009375em);\n}\n\nlimel-prosemirror-adapter {\n flex-grow: 1;\n\n min-width: 0;\n min-height: 0;\n height: 100%;\n overflow: hidden auto;\n}\n","import { Component, Event, EventEmitter, Prop, h } from '@stencil/core';\nimport { FormComponent } from '../form/form.types';\n/**\n * A rich text editor that offers a rich text editing experience with markdown support,\n * in the sense that you can easily type markdown syntax and see the rendered\n * result as rich text in real-time. For instance, you can type `# Hello, world!`\n * and see it directly turning to a heading 1 (an `<h1>` HTML element).\n *\n * Naturally, you can use standard keyboard hotkeys such as <kbd>Ctrl</kbd> + <kbd>B</kbd>\n * to toggle bold text, <kbd>Ctrl</kbd> + <kbd>I</kbd> to toggle italic text, and so on.\n *\n * @exampleComponent limel-example-text-editor-basic\n * @exampleComponent limel-example-text-editor-as-form-component\n * @exampleComponent limel-example-text-editor-composite\n * @exampleComponent limel-example-text-editor-height\n * @beta\n * @private\n */\n@Component({\n tag: 'limel-text-editor',\n shadow: true,\n styleUrl: 'text-editor.scss',\n})\nexport class TextEditor implements FormComponent<string> {\n /**\n * Set to `true` to disable the field.\n * Use `disabled` to indicate that the field can normally be interacted\n * with, but is currently disabled. This tells the user that if certain\n * requirements are met, the field may become enabled again.\n */\n @Prop({ reflect: true })\n public disabled?: boolean;\n\n /**\n * Set to `true` to make the component read-only.\n * Use `readonly` when the field is only there to present the data it holds,\n * and will not become possible for the current user to edit.\n * :::note\n * Consider that it might be better to use `limel-markdown`\n * instead of `limel-text-editor` when the goal is visualizing data.\n * :::\n */\n @Prop({ reflect: true })\n public readonly?: boolean;\n\n /**\n * Optional helper text to display below the input field when it has focus\n */\n @Prop({ reflect: true })\n public helperText?: string;\n\n /**\n * The placeholder text shown inside the input field,\n * when the field is empty.\n */\n @Prop({ reflect: true })\n public placeholder?: string;\n\n /**\n * The label of the editor\n */\n @Prop({ reflect: true })\n public label?: string;\n\n /**\n * Set to `true` to indicate that the current value of the editor is\n * invalid.\n */\n @Prop({ reflect: true })\n public invalid?: boolean;\n\n /**\n * Description of the text inside the editor as serialised HTML\n */\n @Prop({ reflect: true })\n public value: string;\n\n /**\n * Dispatched when a change is made to the editor\n */\n @Event()\n public change: EventEmitter<string>;\n\n public render() {\n return [\n <span class=\"notched-outline\">\n <span class=\"leading-outline\" />\n {this.renderLabel()}\n <span class=\"trailing-outline\" />\n </span>,\n this.renderEditor(),\n ];\n }\n\n private renderEditor() {\n if (this.readonly && !this.value) {\n return (\n <span class=\"lime-empty-value-for-readonly lime-looks-like-input-value\">\n –\n </span>\n );\n }\n\n if (this.readonly) {\n return <limel-markdown value={this.value} />;\n }\n\n return (\n <limel-prosemirror-adapter\n onChange={this.handleChange}\n value={this.value}\n />\n );\n }\n\n private renderLabel() {\n if (!this.label) {\n return;\n }\n\n return (\n <span class=\"notch\">\n <label>{this.label}</label>\n </span>\n );\n }\n\n private handleChange = () => (event: CustomEvent<string>) => {\n event.stopPropagation();\n this.change.emit(event.detail);\n };\n}\n"],"mappings":"kDAAA,MAAMA,EAAgB,upG,MCuBTC,EAAU,M,wDAwGXC,KAAAC,aAAe,IAAOC,IAC1BA,EAAMC,kBACNH,KAAKI,OAAOC,KAAKH,EAAMI,OAAO,E,sKA9C3BC,SACH,MAAO,CACHC,EAAA,QAAMC,MAAM,mBACRD,EAAA,QAAMC,MAAM,oBACXT,KAAKU,cACNF,EAAA,QAAMC,MAAM,sBAEhBT,KAAKW,e,CAILA,eACJ,GAAIX,KAAKY,WAAaZ,KAAKa,MAAO,CAC9B,OACIL,EAAA,QAAMC,MAAM,6DAA2D,I,CAM/E,GAAIT,KAAKY,SAAU,CACf,OAAOJ,EAAA,kBAAgBK,MAAOb,KAAKa,O,CAGvC,OACIL,EAAA,6BACIM,SAAUd,KAAKC,aACfY,MAAOb,KAAKa,O,CAKhBH,cACJ,IAAKV,KAAKe,MAAO,CACb,M,CAGJ,OACIP,EAAA,QAAMC,MAAM,SACRD,EAAA,aAAQR,KAAKe,O"}