@nuraly/runtime 0.1.8 → 0.1.10

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 (106) hide show
  1. package/dist/AIChat-DP3ZdLL3.js +220 -0
  2. package/dist/AIChat-km1IYaR-.js +260 -0
  3. package/dist/Badge-BR94MUt5.js +48 -0
  4. package/dist/Badge-DzNZFKtC.js +70 -0
  5. package/dist/{BaseElement-BNBn_IJk.js → BaseElement-pS6m_x6Q.js} +153 -24
  6. package/dist/Button-BHAN7npC.js +92 -0
  7. package/dist/Button-DCqgsxrL.js +80 -0
  8. package/dist/Card-B70c8NFb.js +150 -0
  9. package/dist/Card-DhOCsGKC.js +120 -0
  10. package/dist/Checkbox-BZTcPwew.js +59 -0
  11. package/dist/Checkbox-LYTIBAUV.js +65 -0
  12. package/dist/Code-BWbiciC8.js +123 -0
  13. package/dist/Code-Ds0vFclr.js +109 -0
  14. package/dist/{CodeEditor-Bf4L2rO_.js → CodeEditor-ChuFC0ex.js} +22 -22
  15. package/dist/Col-B_wpWUcU.js +217 -0
  16. package/dist/Col-DYs8_65c.js +193 -0
  17. package/dist/Collapse-4kxbQ74u.js +74 -0
  18. package/dist/Collapse-Dkw6Ner6.js +96 -0
  19. package/dist/Collections-BSF-PqBz.js +122 -0
  20. package/dist/Collections-D5rwMFbv.js +151 -0
  21. package/dist/Container-DMNh5U4Y.js +204 -0
  22. package/dist/DatePicker-BmEOONiA.js +99 -0
  23. package/dist/DatePicker-VuUroOT4.js +80 -0
  24. package/dist/Divider-BfxR3rVl.js +86 -0
  25. package/dist/Divider-etMTYU3d.js +106 -0
  26. package/dist/Document-CHBcJciR.js +74 -0
  27. package/dist/Document-Cj-TmjAf.js +90 -0
  28. package/dist/Dropdown-BRtHvDa3.js +133 -0
  29. package/dist/Dropdown-C47Y11dj.js +112 -0
  30. package/dist/EmbedURL-BwbJRnY1.js +142 -0
  31. package/dist/EmbedURL-Ci5X1vQG.js +114 -0
  32. package/dist/FileUpload-BBgPcRag.js +54 -0
  33. package/dist/FileUpload-BgkhxtNe.js +47 -0
  34. package/dist/Form-BLq6U3In.js +339 -0
  35. package/dist/Form-E6zXqgsm.js +286 -0
  36. package/dist/Icon-CcLuhz6B.js +64 -0
  37. package/dist/Icon-_UiLblGb.js +74 -0
  38. package/dist/Image-B_VERIvH.js +111 -0
  39. package/dist/Image-hI8kIx8U.js +93 -0
  40. package/dist/Link-BVTo43Cc.js +76 -0
  41. package/dist/Link-xSrPxOLt.js +95 -0
  42. package/dist/Menu-CembLIjO.js +83 -0
  43. package/dist/Menu-D9ZjIOMg.js +73 -0
  44. package/dist/MicroApp-DI1kQwJk.js +100 -0
  45. package/dist/MicroApp-DJw57sLE.js +75 -0
  46. package/dist/NumberInput-DftAAKEs.js +84 -0
  47. package/dist/NumberInput-eOAk0-fb.js +95 -0
  48. package/dist/Panel-Bso5fv4i.js +127 -0
  49. package/dist/Panel-CwzW9iuA.js +161 -0
  50. package/dist/Radio-button-Sii5iveh.js +71 -0
  51. package/dist/Radio-button-YXsVqipQ.js +53 -0
  52. package/dist/RefComponent-Bwk_I0mK.js +79 -0
  53. package/dist/RefComponent-ZxafRVhZ.js +96 -0
  54. package/dist/RichText-CgYXXC_a.js +485 -0
  55. package/dist/RichText-DV46U7fI.js +449 -0
  56. package/dist/Row-Bb95f5DI.js +229 -0
  57. package/dist/Row-Dmd_61mR.js +202 -0
  58. package/dist/Select-Cma8JHAj.js +77 -0
  59. package/dist/Select-DqA08VYb.js +87 -0
  60. package/dist/Slider-B2_Qecjz.js +74 -0
  61. package/dist/Slider-DVY0N2YX.js +55 -0
  62. package/dist/Table-0WjrBnz-.js +159 -0
  63. package/dist/Table-dEma50kw.js +184 -0
  64. package/dist/Tabs-BDKEv1jn.js +131 -0
  65. package/dist/Tabs-Cvt3Q8vx.js +116 -0
  66. package/dist/Tag-BcZvQkE_.js +47 -0
  67. package/dist/Tag-DMZ0mu8y.js +61 -0
  68. package/dist/TextInput-KI6r9xET.js +193 -0
  69. package/dist/TextInput-hxK-HhJi.js +148 -0
  70. package/dist/TextLabel-DkV26yaL.js +102 -0
  71. package/dist/Textarea-Bzs3jSUm.js +117 -0
  72. package/dist/Textarea-CwK3SYbz.js +83 -0
  73. package/dist/Video-C4uBWCBb.js +100 -0
  74. package/dist/Video-CL1lgcvB.js +120 -0
  75. package/dist/aitchat-DjX5s7_8.js +23 -0
  76. package/dist/colorpicker-B-KETfWw.js +64 -0
  77. package/dist/colorpicker-DhB0AygJ.js +75 -0
  78. package/dist/constants-Bs_KQRi_.js +4 -0
  79. package/dist/constants-CXdpxgF2.js +4 -0
  80. package/dist/{cssMode-DMsdy1N0.js → cssMode-CV7QbFJv.js} +1 -1
  81. package/dist/{freemarker2-D51H9HYi.js → freemarker2-CqQxSEZa.js} +1 -1
  82. package/dist/{handlebars-CF6gdAX4.js → handlebars-a71LdN7X.js} +1 -1
  83. package/dist/{html-c2n_zkM3.js → html-D8UaB7IC.js} +1 -1
  84. package/dist/{htmlMode-9IJTuZUh.js → htmlMode-CqWQMFWX.js} +1 -1
  85. package/dist/iconbutton-DfnrRmmB.js +69 -0
  86. package/dist/iconbutton-DvIQHV8o.js +53 -0
  87. package/dist/{javascript-DhEEBMxD.js → javascript-D_jGqcRD.js} +1 -1
  88. package/dist/{jsonMode-CB6k-4rp.js → jsonMode-C3-m5xts.js} +1 -1
  89. package/dist/{liquid-CwtPiwnW.js → liquid-DLwYj6Te.js} +1 -1
  90. package/dist/{mdx-LewPRYF8.js → mdx-DhYjhxkW.js} +1 -1
  91. package/dist/micro-app-entry-DiNqE6xi.js +12042 -0
  92. package/dist/micro-app.bundle.js +1 -1
  93. package/dist/micro-app.js +6 -4940
  94. package/dist/{python-h5Z2g-yl.js → python-B-WcGqFq.js} +1 -1
  95. package/dist/{razor-D5ep1Doy.js → razor-JGACy1mz.js} +1 -1
  96. package/dist/runtime.js +4 -2
  97. package/dist/{tsMode-B_6LiBE1.js → tsMode-lzBM1oT2.js} +1 -1
  98. package/dist/{typescript-BBG0jH4p.js → typescript-CuL5pdO2.js} +1 -1
  99. package/dist/{xml-DgLB7rE6.js → xml-D1tacAKD.js} +1 -1
  100. package/dist/{yaml-DiI4HpSv.js → yaml-CjPB1g7v.js} +1 -1
  101. package/package.json +4 -1
  102. package/utils/index.ts +4 -1
  103. package/utils/lazy-component-loader.ts +120 -0
  104. package/utils/register-components.ts +14 -40
  105. package/utils/render-util.ts +84 -0
  106. package/dist/micro-app-entry-C3RDIukG.js +0 -15831
@@ -0,0 +1,485 @@
1
+ import { html as html$1 } from 'lit';
2
+ import { property, state, customElement } from 'lit/decorators.js';
3
+ import { ref } from 'lit/directives/ref.js';
4
+ import { ae as BaseElementBlock, a8 as executeHandler } from './BaseElement-pS6m_x6Q.js';
5
+ import { css, LitElement, html } from 'lit-element';
6
+ import { unsafeHTML } from 'lit/directives/unsafe-html.js';
7
+ import { styleMap } from 'lit/directives/style-map.js';
8
+
9
+ var __defProp$1 = Object.defineProperty;
10
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
11
+ var __decorateClass$1 = (decorators, target, key, kind) => {
12
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
13
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
14
+ if (decorator = decorators[i])
15
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
16
+ if (kind && result) __defProp$1(target, key, result);
17
+ return result;
18
+ };
19
+ const svgIcons = {
20
+ format_clear: '<svg viewBox="0 0 24 24"><path d="M3.27 5L2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21 18 19.73 3.55 5.27 3.27 5zM6 5v.18L8.82 8h2.4l-.72 1.68 2.1 2.1L14.21 8H20V5H6z"></path></svg>',
21
+ format_bold: '<svg viewBox="0 0 24 24"><path d="M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z"></path></svg>',
22
+ format_italic: '<svg viewBox="0 0 24 24"><path d="M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"></path></svg>',
23
+ format_underlined: '<svg viewBox="0 0 24 24"><path d="M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z"></path></svg>',
24
+ format_align_left: '<svg viewBox="0 0 24 24"><path d="M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"></path></svg>',
25
+ format_align_center: '<svg viewBox="0 0 24 24"><path d="M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"></path></svg>',
26
+ format_align_right: '<svg viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"></path></svg>',
27
+ format_list_numbered: '<svg viewBox="0 0 24 24"><path d="M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"></path></svg>',
28
+ format_list_bulleted: '<svg viewBox="0 0 24 24"><path d="M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"></path></svg>',
29
+ format_quote: '<svg viewBox="0 0 24 24"><path d="M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"></path></svg>',
30
+ format_indent_decrease: '<svg viewBox="0 0 24 24"><path d="M11 17h10v-2H11v2zm-8-5l4 4V8l-4 4zm0 9h18v-2H3v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"></path></svg>',
31
+ format_indent_increase: '<svg viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"></path></svg>',
32
+ link_off: '<svg viewBox="0 0 24 24"><path d="M17 7h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.43-.98 2.63-2.31 2.98l1.46 1.46C20.88 15.61 22 13.95 22 12c0-2.76-2.24-5-5-5zm-1 4h-2.19l2 2H16zM2 4.27l3.11 3.11C3.29 8.12 2 9.91 2 12c0 2.76 2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1 0-1.59 1.21-2.9 2.76-3.07L8.73 11H8v2h2.73L13 15.27V17h1.73l4.01 4.01 1.41-1.41L3.41 2.86 2 4.27z"></path></svg>',
33
+ add_link: '<svg viewBox="0 0 24 24"><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"></path></svg>',
34
+ format_color_text: '<svg viewBox="0 0 24 24"><path d="M11 3L5.5 17h2.25l1.12-3h6.25l1.12 3h2.25L13 3h-2zm-1.38 9L12 5.67 14.38 12H9.62z"></path></svg>',
35
+ border_color: '<svg viewBox="0 0 24 24"><path d="M17.75 7L14 3.25l-10 10V17h3.75l10-10zm2.96-2.96c.39-.39.39-1.02 0-1.41L18.37.29c-.39-.39-1.02-.39-1.41 0L15 2.25 18.75 6l1.96-1.96z"></path></svg>',
36
+ title: '<svg viewBox="0 0 24 24"><path d="M5 4v3h5.5v12h3V7H19V4z"></path></svg>',
37
+ text_format: '<svg viewBox="0 0 24 24"><path d="M5 17v2h14v-2H5zm4.5-4.2h5l.9 2.2h2.1L12.75 4h-1.5L6.5 15h2.1l.9-2.2zM12 5.98L13.87 11h-3.74L12 5.98z"></path></svg>',
38
+ format_size: '<svg viewBox="0 0 24 24"><path d="M9 4v3h5v12h3V7h5V4H9zm-6 8h3v7h3v-7h3V9H3v3z"></path></svg>',
39
+ undo: '<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"></path></svg>',
40
+ redo: '<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"></path></svg>',
41
+ content_cut: '<svg viewBox="0 0 24 24"><path d="M9.64 7.64c.23-.5.36-1.05.36-1.64 0-2.21-1.79-4-4-4S2 3.79 2 6s1.79 4 4 4c.59 0 1.14-.13 1.64-.36L10 12l-2.36 2.36C7.14 14.13 6.59 14 6 14c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4c0-.59-.13-1.14-.36-1.64L12 14l7 7h3v-1L9.64 7.64zM6 8c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm0 12c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm6-7.5c-.28 0-.5-.22-.5-.5s.22-.5.5-.5.5.22.5.5-.22.5-.5.5zM19 3l-6 6 2 2 7-7V3z"></path></svg>',
42
+ content_copy: '<svg viewBox="0 0 24 24"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"></path></svg>',
43
+ content_paste: '<svg viewBox="0 0 24 24"><path d="M19 2h-4.18C14.4.84 13.3 0 12 0c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm7 18H5V4h2v3h10V4h2v16z"></path></svg>'
44
+ };
45
+ let RichTextEditor = class extends LitElement {
46
+ constructor() {
47
+ super(...arguments);
48
+ this.content = "";
49
+ this.root = null;
50
+ }
51
+ render() {
52
+ return html`<main>
53
+
54
+ <div id="editor-actions">
55
+ <div id="toolbar">
56
+ ${toolbar(this.shadowRoot, this.getSelection(), (command, val) => {
57
+ document.execCommand(command, false, val);
58
+ })}
59
+ <input id="bg" type="color" style="display: none" />
60
+ <input id="fg" type="color" style="display: none" />
61
+ </div>
62
+ </div>
63
+ <div id="editor" @input=${(e) => {
64
+ this.dispatchEvent(new CustomEvent("content-change", {
65
+ detail: {
66
+ value: this.root?.innerHTML
67
+ }
68
+ }));
69
+ }}>${this.root}</div>
70
+ </main> `;
71
+ }
72
+ async firstUpdated() {
73
+ this.parentElement?.querySelector("rich-text-editor template");
74
+ this.reset();
75
+ }
76
+ reset() {
77
+ const parser = new DOMParser();
78
+ const doc = parser.parseFromString(this.content, "text/html");
79
+ document.execCommand("defaultParagraphSeparator", false, "br");
80
+ document.addEventListener("selectionchange", () => {
81
+ this.requestUpdate();
82
+ });
83
+ const root = doc.querySelector("body");
84
+ root.setAttribute("contenteditable", "true");
85
+ this.root = root;
86
+ this.root.style.height = "100%";
87
+ }
88
+ getSelection() {
89
+ if (this.shadowRoot?.getSelection) return this.shadowRoot?.getSelection();
90
+ return null;
91
+ }
92
+ };
93
+ RichTextEditor.styles = css`
94
+ :host {
95
+ /* --editor-width: 600px; */
96
+ /* --editor-height: 600px; */
97
+ /* --editor-background: #f1f1f1; */
98
+ --editor-toolbar-height: 33px;
99
+ --editor-toolbar-background: #454545;
100
+ --editor-toolbar-on-background: white;
101
+ /* --editor-toolbar-on-active-background: #a4a4a4; */
102
+ }
103
+ main {
104
+ width: var(--editor-width);
105
+ height: var(--editor-height);
106
+ display: grid;
107
+ grid-template-areas:
108
+ "toolbar toolbar"
109
+ "editor editor";
110
+ grid-template-rows: auto 1fr;
111
+ grid-template-columns: auto auto;
112
+ }
113
+ #editor-actions {
114
+ grid-area: toolbar;
115
+ width: var(--editor-width);
116
+ /* height: var(--editor-toolbar-height); */
117
+ background-color: var(--editor-toolbar-background);
118
+ color: var(--editor-toolbar-on-background);
119
+ overscroll-behavior: contain;
120
+ /* overflow-y: auto; */
121
+ -ms-overflow-style: none;
122
+ scrollbar-width: none;
123
+ overflow:auto;
124
+
125
+ /* Add these lines for vertical alignment */
126
+ display: flex;
127
+ align-items: center; /* vertically center items */
128
+ }
129
+ #editor-actions::-webkit-scrollbar {
130
+ display: none;
131
+ }
132
+ #editor {
133
+ width: var(--editor-width);
134
+ grid-area: editor;
135
+ background-color: var(--editor-background);
136
+ border: 1px solid var(--editor-toolbar-background);
137
+ }
138
+ #toolbar {
139
+ width: 1080px;
140
+ height: var(--editor-toolbar-height);
141
+ }
142
+ [contenteditable] {
143
+ outline: 0px solid transparent;
144
+ }
145
+ .icon-button {
146
+ display: inline-flex;
147
+ align-items: center;
148
+ justify-content: center;
149
+ width: 30px;
150
+ height: 30px;
151
+ border: none;
152
+ background: transparent;
153
+ cursor: pointer;
154
+ padding: 0;
155
+ color: var(--editor-toolbar-on-background);
156
+ }
157
+ .icon-button svg {
158
+ width: 20px;
159
+ height: 20px;
160
+ fill: currentColor;
161
+ }
162
+ .icon-button.active {
163
+ color: var(--editor-toolbar-on-active-background);
164
+ }
165
+ select {
166
+ margin-top: -5px;
167
+ height: calc(var(--editor-toolbar-height) - 10px);
168
+ vertical-align: middle;
169
+ }
170
+ input[type="color"] {
171
+ height: calc(var(--editor-toolbar-height) - 15px);
172
+ -webkit-appearance: none;
173
+ border: none;
174
+ width: 22px;
175
+ }
176
+ input[type="color"]::-webkit-color-swatch-wrapper {
177
+ padding: 0;
178
+ }
179
+ input[type="color"]::-webkit-color-swatch {
180
+ border: none;
181
+ }
182
+ `;
183
+ __decorateClass$1([
184
+ property()
185
+ ], RichTextEditor.prototype, "content", 2);
186
+ __decorateClass$1([
187
+ state()
188
+ ], RichTextEditor.prototype, "root", 2);
189
+ RichTextEditor = __decorateClass$1([
190
+ customElement("rich-text-editor-block")
191
+ ], RichTextEditor);
192
+ function toolbar(shadowRoot, selection, command) {
193
+ const tags = [];
194
+ if (selection?.type === "Range") {
195
+ let parentNode = selection?.baseNode;
196
+ if (parentNode) {
197
+ const checkNode = () => {
198
+ const parentTagName = parentNode?.tagName?.toLowerCase()?.trim();
199
+ if (parentTagName) tags.push(parentTagName);
200
+ };
201
+ while (parentNode != null) {
202
+ checkNode();
203
+ parentNode = parentNode?.parentNode;
204
+ }
205
+ }
206
+ }
207
+ const commands = [
208
+ {
209
+ icon: "format_clear",
210
+ command: "removeFormat"
211
+ },
212
+ {
213
+ icon: "format_bold",
214
+ command: "bold",
215
+ active: tags.includes("b")
216
+ },
217
+ {
218
+ icon: "format_italic",
219
+ command: "italic",
220
+ active: tags.includes("i")
221
+ },
222
+ {
223
+ icon: "format_underlined",
224
+ command: "underline",
225
+ active: tags.includes("u")
226
+ },
227
+ {
228
+ icon: "format_align_left",
229
+ command: "justifyleft"
230
+ },
231
+ {
232
+ icon: "format_align_center",
233
+ command: "justifycenter"
234
+ },
235
+ {
236
+ icon: "format_align_right",
237
+ command: "justifyright"
238
+ },
239
+ {
240
+ icon: "format_list_numbered",
241
+ command: "insertorderedlist",
242
+ active: tags.includes("ol")
243
+ },
244
+ {
245
+ icon: "format_list_bulleted",
246
+ command: "insertunorderedlist",
247
+ active: tags.includes("ul")
248
+ },
249
+ {
250
+ icon: "format_quote",
251
+ command: "formatblock",
252
+ command_value: "blockquote"
253
+ },
254
+ {
255
+ icon: "format_indent_decrease",
256
+ command: "outdent"
257
+ },
258
+ {
259
+ icon: "format_indent_increase",
260
+ command: "indent"
261
+ },
262
+ tags.includes("a") ? { icon: "link_off", command: "unlink" } : {
263
+ icon: "add_link",
264
+ command: () => {
265
+ const newLink = prompt("Write the URL here", "http://");
266
+ if (newLink && newLink != "" && newLink != "http://") {
267
+ command("createlink", newLink);
268
+ }
269
+ }
270
+ },
271
+ {
272
+ icon: "format_color_text",
273
+ command: () => {
274
+ const input = shadowRoot.querySelector("#fg");
275
+ input.addEventListener("input", (e) => {
276
+ const val = e.target.value;
277
+ command("forecolor", val);
278
+ });
279
+ input.click();
280
+ },
281
+ type: "color"
282
+ },
283
+ {
284
+ icon: "border_color",
285
+ command: () => {
286
+ const input = shadowRoot.querySelector("#bg");
287
+ input.addEventListener("input", (e) => {
288
+ const val = e.target.value;
289
+ command("backcolor", val);
290
+ });
291
+ input.click();
292
+ },
293
+ type: "color"
294
+ },
295
+ {
296
+ icon: "format_size",
297
+ command: "fontsize",
298
+ values: [
299
+ { name: "Font Size", value: "--" },
300
+ { name: "Very Small", value: "1" },
301
+ { name: "Small", value: "2" },
302
+ { name: "Normal", value: "3" },
303
+ { name: "Medium Large", value: "4" },
304
+ { name: "Large", value: "5" },
305
+ { name: "Very Large", value: "6" },
306
+ { name: "Maximum", value: "7" }
307
+ ]
308
+ },
309
+ {
310
+ icon: "undo",
311
+ command: "undo"
312
+ },
313
+ {
314
+ icon: "redo",
315
+ command: "redo"
316
+ },
317
+ {
318
+ icon: "content_cut",
319
+ command: "cut"
320
+ },
321
+ {
322
+ icon: "content_copy",
323
+ command: "copy"
324
+ },
325
+ {
326
+ icon: "content_paste",
327
+ command: "paste"
328
+ }
329
+ ];
330
+ return html`
331
+ ${commands.map((n) => {
332
+ if (n.values) {
333
+ return html`
334
+ <select
335
+ id="${n.icon}"
336
+ @change=${(e) => {
337
+ const val = e.target.value;
338
+ if (val === "--") {
339
+ command("removeFormat", void 0);
340
+ } else if (typeof n.command === "string") {
341
+ command(n.command, val);
342
+ }
343
+ }}
344
+ >
345
+ ${n.values.map(
346
+ (v) => html`<option value=${v.value}>${v.name}</option>`
347
+ )}
348
+ </select>
349
+ `;
350
+ } else {
351
+ return html`
352
+ <button
353
+ class="icon-button ${n.active ? "active" : ""}"
354
+ @click=${() => {
355
+ if (typeof n.command === "string") {
356
+ command(n.command, n.command_value);
357
+ } else {
358
+ n.command();
359
+ }
360
+ }}
361
+ .innerHTML=${svgIcons[n.icon]}
362
+ ></button>
363
+ `;
364
+ }
365
+ })}
366
+ `;
367
+ }
368
+
369
+ var __defProp = Object.defineProperty;
370
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
371
+ var __decorateClass = (decorators, target, key, kind) => {
372
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
373
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
374
+ if (decorator = decorators[i])
375
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
376
+ if (kind && result) __defProp(target, key, result);
377
+ return result;
378
+ };
379
+ let RichTextContainer = class extends BaseElementBlock {
380
+ constructor() {
381
+ super();
382
+ this.isViewMode = false;
383
+ this.dragOverSituation = false;
384
+ this.wrapperStyle = {};
385
+ this.editing = false;
386
+ this.handleKeyDown = (e) => {
387
+ if (e.key === "Escape" && this.editing) {
388
+ this.editing = false;
389
+ e.preventDefault();
390
+ e.stopPropagation();
391
+ }
392
+ };
393
+ this.handleDoubleClick = () => {
394
+ this.editing = true;
395
+ };
396
+ }
397
+ connectedCallback() {
398
+ super.connectedCallback();
399
+ window.addEventListener("keydown", this.handleKeyDown);
400
+ }
401
+ disconnectedCallback() {
402
+ super.disconnectedCallback();
403
+ window.removeEventListener("keydown", this.handleKeyDown);
404
+ }
405
+ handleCodeEditorChange(value) {
406
+ if (!this.isViewMode) {
407
+ const serializedValue = JSON.stringify(value);
408
+ executeHandler(
409
+ this.component,
410
+ /* js */
411
+ `
412
+ try {
413
+ const selectedComponent = Utils.first($selectedComponents);
414
+ updateInput(selectedComponent, "value", "string", ${serializedValue}, null);
415
+ } catch (error) {
416
+ console.error(error);
417
+ }
418
+ `,
419
+ {}
420
+ );
421
+ }
422
+ }
423
+ renderComponent() {
424
+ return html$1`
425
+
426
+ <div ${ref(this.inputRef)}
427
+ class="${`drop-${this.component.uuid}`}"
428
+ style=${styleMap({
429
+ width: this.editing ? "auto" : this.getStyles().width,
430
+ display: "block"
431
+ })}
432
+ >
433
+ ${this.editing && !this.isViewMode ? html$1`
434
+ <rich-text-editor-block
435
+ @content-change=${(e) => {
436
+ this.handleCodeEditorChange(e.detail.value);
437
+ }}
438
+ .content=${this.inputHandlersValue.value}
439
+ ></rich-text-editor-block>
440
+ ` : html$1`
441
+ <p @dblclick=${this.handleDoubleClick}>
442
+ ${unsafeHTML(this.inputHandlersValue.value)}
443
+ </p>
444
+ `}
445
+ </div>
446
+ `;
447
+ }
448
+ firstUpdated(_changedProperties) {
449
+ }
450
+ };
451
+ __decorateClass([
452
+ property({ type: Object })
453
+ ], RichTextContainer.prototype, "component", 2);
454
+ __decorateClass([
455
+ property({ type: Object })
456
+ ], RichTextContainer.prototype, "item", 2);
457
+ __decorateClass([
458
+ property({ type: Object })
459
+ ], RichTextContainer.prototype, "draggingComponentInfo", 2);
460
+ __decorateClass([
461
+ property({ type: Boolean })
462
+ ], RichTextContainer.prototype, "isViewMode", 2);
463
+ __decorateClass([
464
+ state()
465
+ ], RichTextContainer.prototype, "dragOverSituation", 2);
466
+ __decorateClass([
467
+ state()
468
+ ], RichTextContainer.prototype, "selectedComponent", 2);
469
+ __decorateClass([
470
+ state()
471
+ ], RichTextContainer.prototype, "hoveredComponent", 2);
472
+ __decorateClass([
473
+ state()
474
+ ], RichTextContainer.prototype, "wrapperStyle", 2);
475
+ __decorateClass([
476
+ state()
477
+ ], RichTextContainer.prototype, "components", 2);
478
+ __decorateClass([
479
+ state()
480
+ ], RichTextContainer.prototype, "editing", 2);
481
+ RichTextContainer = __decorateClass([
482
+ customElement("rich-text-block")
483
+ ], RichTextContainer);
484
+
485
+ export { RichTextContainer };