@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,220 @@
1
+ import { $ as u, k as d, l, m as g, i as m, v as f, B as y, o as b, b as h, c as x, d as c, t as v } from "./micro-app-entry-DiNqE6xi.js";
2
+ function C(t, e) {
3
+ u.set({
4
+ ...u.get(),
5
+ [t]: e
6
+ });
7
+ }
8
+ function w(t) {
9
+ t.forEach((e) => {
10
+ d(
11
+ e,
12
+ l("global", "currentPage").value,
13
+ l("global", "currentEditingApplication").value.uuid
14
+ );
15
+ }), setTimeout(() => {
16
+ g.emit("component:refresh");
17
+ }, 1e3);
18
+ }
19
+ const U = m`
20
+ :host {
21
+ display:flex;
22
+ align-items:center;
23
+ }
24
+ .chat-input-container {
25
+ position: relative;
26
+ display: inline-block;
27
+ width: 100%;
28
+ }
29
+ .chat-input {
30
+ display: flex;
31
+ margin-top: 10px;
32
+ width: 100%;
33
+ }
34
+ .chat-input nr-input {
35
+ flex: 1;
36
+ margin-right: 10px;
37
+ }
38
+ .chat-messages {
39
+ margin-top: 10px;
40
+ max-height: 200px;
41
+ overflow-y: auto;
42
+ background-color: #f9f9f9;
43
+ border: 1px solid #ccc;
44
+ border-radius: 8px;
45
+ padding: 10px;
46
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
47
+ }
48
+ .chat-message {
49
+ border-radius: 16px;
50
+ padding: 8px 12px;
51
+ margin-bottom: 8px;
52
+ max-width: 80%;
53
+ word-wrap: break-word;
54
+ }
55
+ .ai-message {
56
+ background-color: #d1fae5;
57
+ align-self: flex-start;
58
+ }
59
+ .error-message {
60
+ color: red;
61
+ margin-top: 10px;
62
+ }
63
+ .loading-indicator {
64
+ margin-top: 10px;
65
+ font-size: 14px;
66
+ color: #555;
67
+ }
68
+ `;
69
+ function $() {
70
+ return fetch("/api/chat", {
71
+ method: "POST",
72
+ headers: {
73
+ "Content-Type": "application/json"
74
+ }
75
+ }).then((t) => {
76
+ if (!t.ok)
77
+ throw new Error(`HTTP error! status: ${t.status}`);
78
+ return t.json();
79
+ }).then((t) => t).catch((t) => {
80
+ throw console.error("Error creating chat:", t), t;
81
+ });
82
+ }
83
+ function k(t) {
84
+ const e = {};
85
+ return t.forEach((s) => {
86
+ const i = f();
87
+ e[s.uuid] = i;
88
+ }), t.forEach((s) => {
89
+ e[s.uuid] && (s.uuid = e[s.uuid]), s.childrenIds && (s.childrenIds = s.childrenIds.map((i) => e[i] || i));
90
+ }), t;
91
+ }
92
+ var I = Object.defineProperty, M = Object.getOwnPropertyDescriptor, r = (t, e, s, i) => {
93
+ for (var a = i > 1 ? void 0 : i ? M(e, s) : e, n = t.length - 1, p; n >= 0; n--)
94
+ (p = t[n]) && (a = (i ? p(e, s, a) : p(a)) || a);
95
+ return i && a && I(e, s, a), a;
96
+ };
97
+ try {
98
+ await import("@nuralyui/slider-input");
99
+ } catch {
100
+ console.warn("[@nuralyui/slider-input] Package not found or failed to load.");
101
+ }
102
+ try {
103
+ await import("@nuralyui/button");
104
+ } catch {
105
+ console.warn("[@nuralyui/button] Package not found or failed to load.");
106
+ }
107
+ try {
108
+ await import("@nuralyui/input");
109
+ } catch {
110
+ console.warn("[@nuralyui/input] Package not found or failed to load.");
111
+ }
112
+ let o = class extends y {
113
+ constructor() {
114
+ super(...arguments), this.preview = !1, this.rootUUID = "", this.isChatBoxVisible = !1, this.chatUuid = "", this.messages = [], this.errorMessage = "", this.inputValue = "", this.isLoading = !1;
115
+ }
116
+ connectedCallback() {
117
+ super.connectedCallback();
118
+ }
119
+ render() {
120
+ const t = this.component?.style || {};
121
+ return h`
122
+ <div class="chat-input-container" style=${b({ ...t })}>
123
+ <nr-button @click=${this.toggleChatBox}>Ask AI</nr-button>
124
+ ${this.isChatBoxVisible ? h`
125
+ <div class="chat-input">
126
+ <nr-input value=${this.inputValue} placeholder="Type your message" @valueChange=${this.handleInputChange} @keyup=${this.handleKeyUp} ></nr-input>
127
+ <nr-button @click=${this.handleSendMessage}>Send</nr-button>
128
+ </div>
129
+ ${this.messages.length > 0 ? h`
130
+ <div class="chat-messages">
131
+ ${this.preview ? h`<micro-app uuid=${this.chatUuid} componentToRenderUUID=${this.rootUUID}></micro-app>` : ""}
132
+ <nr-button @click=${() => w(this.structureComponent)}>Insert</nr-button>
133
+ </div>
134
+ ` : ""}
135
+ ${this.errorMessage ? h`<div class="error-message">${this.errorMessage}</div>` : ""}
136
+ ${this.isLoading ? h`<div class="loading-indicator">Loading...</div>` : ""}
137
+ ` : ""}
138
+ </div>
139
+ `;
140
+ }
141
+ async toggleChatBox() {
142
+ this.isChatBoxVisible = !this.isChatBoxVisible, this.isChatBoxVisible ? await this.getChatUuid() : this.errorMessage = "";
143
+ }
144
+ async getChatUuid() {
145
+ this.isLoading = !0, $().then((t) => {
146
+ this.chatUuid = t.chat_id, this.errorMessage = "";
147
+ }).catch((t) => {
148
+ console.error("Error getting chat UUID:", t), this.errorMessage = "Cannot connect to server. Please try again.";
149
+ }).finally(() => {
150
+ this.isLoading = !1;
151
+ });
152
+ }
153
+ async sendMessage(t) {
154
+ this.isLoading = !0;
155
+ try {
156
+ const s = (await (await fetch(`/api/chat/${this.chatUuid}`, {
157
+ method: "POST",
158
+ headers: {
159
+ "Content-Type": "application/json"
160
+ },
161
+ body: JSON.stringify({ query: t })
162
+ })).json()).response;
163
+ this.messages.push({ type: "ai", content: s }), this.structureComponent = [];
164
+ const i = s.components ?? s;
165
+ Array.isArray(i) && (this.structureComponent = i.map((n) => (n.application_id = this.chatUuid, n))), this.structureComponent = k(this.structureComponent);
166
+ const a = this.structureComponent.find((n) => n.component_type === "vertical-container-block");
167
+ this.rootUUID = a.uuid, C(this.chatUuid, [...this.structureComponent]), requestAnimationFrame(() => {
168
+ this.preview = !0;
169
+ });
170
+ } catch (e) {
171
+ console.error("Error sending message:", e);
172
+ } finally {
173
+ this.isLoading = !1;
174
+ }
175
+ }
176
+ handleSendMessage(t) {
177
+ const e = this.inputValue;
178
+ e.trim() && (this.sendMessage(e), this.inputValue = "");
179
+ }
180
+ handleInputChange(t) {
181
+ this.inputValue = t.detail.value;
182
+ }
183
+ handleKeyUp(t) {
184
+ t.key === "Enter" && this.handleSendMessage(t);
185
+ }
186
+ };
187
+ o.styles = U;
188
+ r([
189
+ x({ type: Object })
190
+ ], o.prototype, "component", 2);
191
+ r([
192
+ c()
193
+ ], o.prototype, "preview", 2);
194
+ r([
195
+ c()
196
+ ], o.prototype, "rootUUID", 2);
197
+ r([
198
+ c()
199
+ ], o.prototype, "isChatBoxVisible", 2);
200
+ r([
201
+ c()
202
+ ], o.prototype, "chatUuid", 2);
203
+ r([
204
+ c()
205
+ ], o.prototype, "messages", 2);
206
+ r([
207
+ c()
208
+ ], o.prototype, "errorMessage", 2);
209
+ r([
210
+ c()
211
+ ], o.prototype, "inputValue", 2);
212
+ r([
213
+ c()
214
+ ], o.prototype, "isLoading", 2);
215
+ o = r([
216
+ v("ai-chat-block")
217
+ ], o);
218
+ export {
219
+ o as AiChat
220
+ };
@@ -0,0 +1,260 @@
1
+ import { styleMap } from 'lit/directives/style-map.js';
2
+ import { ae as BaseElementBlock } from './BaseElement-pS6m_x6Q.js';
3
+ import { css, html } from 'lit';
4
+ import { property, state, customElement } from 'lit/decorators.js';
5
+ import { v4 } from 'uuid';
6
+ import { b as addGeneratedComponents, a as addTempApplication } from './aitchat-DjX5s7_8.js';
7
+
8
+ const styles = css`
9
+ :host {
10
+ display:flex;
11
+ align-items:center;
12
+ }
13
+ .chat-input-container {
14
+ position: relative;
15
+ display: inline-block;
16
+ width: 100%;
17
+ }
18
+ .chat-input {
19
+ display: flex;
20
+ margin-top: 10px;
21
+ width: 100%;
22
+ }
23
+ .chat-input nr-input {
24
+ flex: 1;
25
+ margin-right: 10px;
26
+ }
27
+ .chat-messages {
28
+ margin-top: 10px;
29
+ max-height: 200px;
30
+ overflow-y: auto;
31
+ background-color: #f9f9f9;
32
+ border: 1px solid #ccc;
33
+ border-radius: 8px;
34
+ padding: 10px;
35
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
36
+ }
37
+ .chat-message {
38
+ border-radius: 16px;
39
+ padding: 8px 12px;
40
+ margin-bottom: 8px;
41
+ max-width: 80%;
42
+ word-wrap: break-word;
43
+ }
44
+ .ai-message {
45
+ background-color: #d1fae5;
46
+ align-self: flex-start;
47
+ }
48
+ .error-message {
49
+ color: red;
50
+ margin-top: 10px;
51
+ }
52
+ .loading-indicator {
53
+ margin-top: 10px;
54
+ font-size: 14px;
55
+ color: #555;
56
+ }
57
+ `;
58
+
59
+ function createChat() {
60
+ return fetch("/api/chat", {
61
+ method: "POST",
62
+ headers: {
63
+ "Content-Type": "application/json"
64
+ }
65
+ }).then((response) => {
66
+ if (!response.ok) {
67
+ throw new Error(`HTTP error! status: ${response.status}`);
68
+ }
69
+ return response.json();
70
+ }).then((data) => {
71
+ return data;
72
+ }).catch((error) => {
73
+ console.error("Error creating chat:", error);
74
+ throw error;
75
+ });
76
+ }
77
+
78
+ function replaceUUIDs(data) {
79
+ const uuidMapping = {};
80
+ data.forEach((item) => {
81
+ const newUUID = v4();
82
+ uuidMapping[item.uuid] = newUUID;
83
+ });
84
+ data.forEach((item) => {
85
+ if (uuidMapping[item.uuid]) {
86
+ item.uuid = uuidMapping[item.uuid];
87
+ }
88
+ if (item.childrenIds) {
89
+ item.childrenIds = item.childrenIds.map((childId) => {
90
+ return uuidMapping[childId] || childId;
91
+ });
92
+ }
93
+ });
94
+ return data;
95
+ }
96
+
97
+ var __defProp = Object.defineProperty;
98
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
99
+ var __decorateClass = (decorators, target, key, kind) => {
100
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
101
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
102
+ if (decorator = decorators[i])
103
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
104
+ if (kind && result) __defProp(target, key, result);
105
+ return result;
106
+ };
107
+ try {
108
+ await import('@nuralyui/slider-input');
109
+ } catch (error) {
110
+ console.warn("[@nuralyui/slider-input] Package not found or failed to load.");
111
+ }
112
+ try {
113
+ await import('@nuralyui/button');
114
+ } catch (error) {
115
+ console.warn("[@nuralyui/button] Package not found or failed to load.");
116
+ }
117
+ try {
118
+ await import('@nuralyui/input');
119
+ } catch (error) {
120
+ console.warn("[@nuralyui/input] Package not found or failed to load.");
121
+ }
122
+ let AiChat = class extends BaseElementBlock {
123
+ constructor() {
124
+ super(...arguments);
125
+ this.preview = false;
126
+ this.rootUUID = "";
127
+ this.isChatBoxVisible = false;
128
+ this.chatUuid = "";
129
+ this.messages = [];
130
+ this.errorMessage = "";
131
+ this.inputValue = "";
132
+ this.isLoading = false;
133
+ }
134
+ connectedCallback() {
135
+ super.connectedCallback();
136
+ }
137
+ render() {
138
+ const aiChatStyle = this.component?.style || {};
139
+ return html`
140
+ <div class="chat-input-container" style=${styleMap({ ...aiChatStyle })}>
141
+ <nr-button @click=${this.toggleChatBox}>Ask AI</nr-button>
142
+ ${this.isChatBoxVisible ? html`
143
+ <div class="chat-input">
144
+ <nr-input value=${this.inputValue} placeholder="Type your message" @valueChange=${this.handleInputChange} @keyup=${this.handleKeyUp} ></nr-input>
145
+ <nr-button @click=${this.handleSendMessage}>Send</nr-button>
146
+ </div>
147
+ ${this.messages.length > 0 ? html`
148
+ <div class="chat-messages">
149
+ ${this.preview ? html`<micro-app uuid=${this.chatUuid} componentToRenderUUID=${this.rootUUID}></micro-app>` : ""}
150
+ <nr-button @click=${() => addGeneratedComponents(this.structureComponent)}>Insert</nr-button>
151
+ </div>
152
+ ` : ""}
153
+ ${this.errorMessage ? html`<div class="error-message">${this.errorMessage}</div>` : ""}
154
+ ${this.isLoading ? html`<div class="loading-indicator">Loading...</div>` : ""}
155
+ ` : ""}
156
+ </div>
157
+ `;
158
+ }
159
+ async toggleChatBox() {
160
+ this.isChatBoxVisible = !this.isChatBoxVisible;
161
+ if (this.isChatBoxVisible) {
162
+ await this.getChatUuid();
163
+ } else {
164
+ this.errorMessage = "";
165
+ }
166
+ }
167
+ async getChatUuid() {
168
+ this.isLoading = true;
169
+ createChat().then((data) => {
170
+ this.chatUuid = data.chat_id;
171
+ this.errorMessage = "";
172
+ }).catch((error) => {
173
+ console.error("Error getting chat UUID:", error);
174
+ this.errorMessage = "Cannot connect to server. Please try again.";
175
+ }).finally(() => {
176
+ this.isLoading = false;
177
+ });
178
+ }
179
+ async sendMessage(message) {
180
+ this.isLoading = true;
181
+ try {
182
+ const response = await fetch(`/api/chat/${this.chatUuid}`, {
183
+ method: "POST",
184
+ headers: {
185
+ "Content-Type": "application/json"
186
+ },
187
+ body: JSON.stringify({ query: message })
188
+ });
189
+ const aiResponse = (await response.json()).response;
190
+ this.messages.push({ type: "ai", content: aiResponse });
191
+ this.structureComponent = [];
192
+ const result = aiResponse.components ?? aiResponse;
193
+ if (Array.isArray(result)) {
194
+ this.structureComponent = result.map((component) => {
195
+ component.application_id = this.chatUuid;
196
+ return component;
197
+ });
198
+ }
199
+ this.structureComponent = replaceUUIDs(this.structureComponent);
200
+ const structureComponentRoot = this.structureComponent.find((component) => component.component_type === "vertical-container-block");
201
+ this.rootUUID = structureComponentRoot.uuid;
202
+ addTempApplication(this.chatUuid, [...this.structureComponent]);
203
+ requestAnimationFrame(() => {
204
+ this.preview = true;
205
+ });
206
+ } catch (error) {
207
+ console.error("Error sending message:", error);
208
+ } finally {
209
+ this.isLoading = false;
210
+ }
211
+ }
212
+ handleSendMessage(event) {
213
+ const message = this.inputValue;
214
+ if (message.trim()) {
215
+ this.sendMessage(message);
216
+ this.inputValue = "";
217
+ }
218
+ }
219
+ handleInputChange(event) {
220
+ this.inputValue = event.detail.value;
221
+ }
222
+ handleKeyUp(event) {
223
+ if (event.key === "Enter") {
224
+ this.handleSendMessage(event);
225
+ }
226
+ }
227
+ };
228
+ AiChat.styles = styles;
229
+ __decorateClass([
230
+ property({ type: Object })
231
+ ], AiChat.prototype, "component", 2);
232
+ __decorateClass([
233
+ state()
234
+ ], AiChat.prototype, "preview", 2);
235
+ __decorateClass([
236
+ state()
237
+ ], AiChat.prototype, "rootUUID", 2);
238
+ __decorateClass([
239
+ state()
240
+ ], AiChat.prototype, "isChatBoxVisible", 2);
241
+ __decorateClass([
242
+ state()
243
+ ], AiChat.prototype, "chatUuid", 2);
244
+ __decorateClass([
245
+ state()
246
+ ], AiChat.prototype, "messages", 2);
247
+ __decorateClass([
248
+ state()
249
+ ], AiChat.prototype, "errorMessage", 2);
250
+ __decorateClass([
251
+ state()
252
+ ], AiChat.prototype, "inputValue", 2);
253
+ __decorateClass([
254
+ state()
255
+ ], AiChat.prototype, "isLoading", 2);
256
+ AiChat = __decorateClass([
257
+ customElement("ai-chat-block")
258
+ ], AiChat);
259
+
260
+ export { AiChat };
@@ -0,0 +1,48 @@
1
+ import { B as v, n as $, o as w, b as H, i as V, c, t as y } from "./micro-app-entry-DiNqE6xi.js";
2
+ var P = Object.defineProperty, g = Object.getOwnPropertyDescriptor, a = (n, e, s, o) => {
3
+ for (var t = o > 1 ? void 0 : o ? g(e, s) : e, i = n.length - 1, l; i >= 0; i--)
4
+ (l = n[i]) && (t = (o ? l(e, s, t) : l(t)) || t);
5
+ return o && t && P(e, s, t), t;
6
+ };
7
+ try {
8
+ await import("@nuralyui/badge");
9
+ } catch {
10
+ console.warn("[@nuralyui/badge] Package not found or failed to load.");
11
+ }
12
+ let u = class extends v {
13
+ renderComponent() {
14
+ const n = this.component?.style || {}, e = this.component?.input?.count?.value ?? this.inputHandlersValue?.count, s = this.component?.input?.text?.value || this.inputHandlersValue?.text || "", o = this.component?.input?.dot?.value ?? this.inputHandlersValue?.dot ?? !1, t = this.component?.input?.showZero?.value ?? this.inputHandlersValue?.showZero ?? !1, i = this.component?.input?.overflowCount?.value || this.inputHandlersValue?.overflowCount || 99, l = this.component?.input?.size?.value || this.inputHandlersValue?.size || "default", f = this.component?.input?.color?.value || this.inputHandlersValue?.color, h = this.component?.input?.status?.value || this.inputHandlersValue?.status, d = this.component?.input?.ribbon?.value || this.inputHandlersValue?.ribbon, b = this.component?.input?.ribbonPlacement?.value || this.inputHandlersValue?.ribbonPlacement || "end", r = this.component?.input?.offsetX?.value || this.inputHandlersValue?.offsetX, p = this.component?.input?.offsetY?.value || this.inputHandlersValue?.offsetY, m = r || p ? [r || 0, p || 0] : void 0;
15
+ return H`
16
+ <nr-badge
17
+ ${$(this.inputRef)}
18
+ style=${w(n)}
19
+ .count=${e}
20
+ .text=${s}
21
+ .size=${l}
22
+ .color=${f}
23
+ .status=${h}
24
+ .ribbon=${d}
25
+ .ribbonPlacement=${b}
26
+ .overflowCount=${i}
27
+ .offset=${m}
28
+ ?dot=${o}
29
+ ?showZero=${t}
30
+ >
31
+ <slot></slot>
32
+ </nr-badge>
33
+ `;
34
+ }
35
+ };
36
+ u.styles = [V``];
37
+ a([
38
+ c({ type: Object })
39
+ ], u.prototype, "component", 2);
40
+ a([
41
+ c({ type: Object })
42
+ ], u.prototype, "item", 2);
43
+ u = a([
44
+ y("badge-block")
45
+ ], u);
46
+ export {
47
+ u as BadgeBlock
48
+ };
@@ -0,0 +1,70 @@
1
+ import { html, css } from 'lit';
2
+ import { property, customElement } from 'lit/decorators.js';
3
+ import { styleMap } from 'lit/directives/style-map.js';
4
+ import { ae as BaseElementBlock } from './BaseElement-pS6m_x6Q.js';
5
+ import { ref } from 'lit/directives/ref.js';
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
+ var __decorateClass = (decorators, target, key, kind) => {
10
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
11
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
12
+ if (decorator = decorators[i])
13
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
14
+ if (kind && result) __defProp(target, key, result);
15
+ return result;
16
+ };
17
+ try {
18
+ await import('@nuralyui/badge');
19
+ } catch (error) {
20
+ console.warn("[@nuralyui/badge] Package not found or failed to load.");
21
+ }
22
+ let BadgeBlock = class extends BaseElementBlock {
23
+ renderComponent() {
24
+ const badgeStyles = this.component?.style || {};
25
+ const count = this.component?.input?.count?.value ?? this.inputHandlersValue?.count;
26
+ const text = this.component?.input?.text?.value || this.inputHandlersValue?.text || "";
27
+ const dot = this.component?.input?.dot?.value ?? this.inputHandlersValue?.dot ?? false;
28
+ const showZero = this.component?.input?.showZero?.value ?? this.inputHandlersValue?.showZero ?? false;
29
+ const overflowCount = this.component?.input?.overflowCount?.value || this.inputHandlersValue?.overflowCount || 99;
30
+ const size = this.component?.input?.size?.value || this.inputHandlersValue?.size || "default";
31
+ const color = this.component?.input?.color?.value || this.inputHandlersValue?.color;
32
+ const status = this.component?.input?.status?.value || this.inputHandlersValue?.status;
33
+ const ribbon = this.component?.input?.ribbon?.value || this.inputHandlersValue?.ribbon;
34
+ const ribbonPlacement = this.component?.input?.ribbonPlacement?.value || this.inputHandlersValue?.ribbonPlacement || "end";
35
+ const offsetX = this.component?.input?.offsetX?.value || this.inputHandlersValue?.offsetX;
36
+ const offsetY = this.component?.input?.offsetY?.value || this.inputHandlersValue?.offsetY;
37
+ const offset = offsetX || offsetY ? [offsetX || 0, offsetY || 0] : void 0;
38
+ return html`
39
+ <nr-badge
40
+ ${ref(this.inputRef)}
41
+ style=${styleMap(badgeStyles)}
42
+ .count=${count}
43
+ .text=${text}
44
+ .size=${size}
45
+ .color=${color}
46
+ .status=${status}
47
+ .ribbon=${ribbon}
48
+ .ribbonPlacement=${ribbonPlacement}
49
+ .overflowCount=${overflowCount}
50
+ .offset=${offset}
51
+ ?dot=${dot}
52
+ ?showZero=${showZero}
53
+ >
54
+ <slot></slot>
55
+ </nr-badge>
56
+ `;
57
+ }
58
+ };
59
+ BadgeBlock.styles = [css``];
60
+ __decorateClass([
61
+ property({ type: Object })
62
+ ], BadgeBlock.prototype, "component", 2);
63
+ __decorateClass([
64
+ property({ type: Object })
65
+ ], BadgeBlock.prototype, "item", 2);
66
+ BadgeBlock = __decorateClass([
67
+ customElement("badge-block")
68
+ ], BadgeBlock);
69
+
70
+ export { BadgeBlock };