@nuraly/runtime 0.1.9 → 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 (113) hide show
  1. package/components/ui/components/inputs/ColorPicker/colorpicker.ts +1 -7
  2. package/components/ui/components/inputs/Form/Form.ts +3 -11
  3. package/components/ui/components/inputs/RadioButton/Radio-button.ts +1 -7
  4. package/components/ui/components/inputs/Select/Select.ts +1 -7
  5. package/components/ui/components/layout/Grid/Col.ts +2 -6
  6. package/components/ui/components/layout/Grid/Row.ts +2 -6
  7. package/components/ui/components/studio/FunctionsPanel/FunctionsPanel.ts +4 -16
  8. package/dist/AIChat-DP3ZdLL3.js +220 -0
  9. package/dist/AIChat-km1IYaR-.js +260 -0
  10. package/dist/Badge-BR94MUt5.js +48 -0
  11. package/dist/Badge-DzNZFKtC.js +70 -0
  12. package/dist/{BaseElement-BNBn_IJk.js → BaseElement-pS6m_x6Q.js} +153 -24
  13. package/dist/Button-BHAN7npC.js +92 -0
  14. package/dist/Button-DCqgsxrL.js +80 -0
  15. package/dist/Card-B70c8NFb.js +150 -0
  16. package/dist/Card-DhOCsGKC.js +120 -0
  17. package/dist/Checkbox-BZTcPwew.js +59 -0
  18. package/dist/Checkbox-LYTIBAUV.js +65 -0
  19. package/dist/Code-BWbiciC8.js +123 -0
  20. package/dist/Code-Ds0vFclr.js +109 -0
  21. package/dist/{CodeEditor-B1gNuvPb.js → CodeEditor-ChuFC0ex.js} +22 -22
  22. package/dist/Col-B_wpWUcU.js +217 -0
  23. package/dist/Col-DYs8_65c.js +193 -0
  24. package/dist/Collapse-4kxbQ74u.js +74 -0
  25. package/dist/Collapse-Dkw6Ner6.js +96 -0
  26. package/dist/Collections-BSF-PqBz.js +122 -0
  27. package/dist/Collections-D5rwMFbv.js +151 -0
  28. package/dist/Container-DMNh5U4Y.js +204 -0
  29. package/dist/DatePicker-BmEOONiA.js +99 -0
  30. package/dist/DatePicker-VuUroOT4.js +80 -0
  31. package/dist/Divider-BfxR3rVl.js +86 -0
  32. package/dist/Divider-etMTYU3d.js +106 -0
  33. package/dist/Document-CHBcJciR.js +74 -0
  34. package/dist/Document-Cj-TmjAf.js +90 -0
  35. package/dist/Dropdown-BRtHvDa3.js +133 -0
  36. package/dist/Dropdown-C47Y11dj.js +112 -0
  37. package/dist/EmbedURL-BwbJRnY1.js +142 -0
  38. package/dist/EmbedURL-Ci5X1vQG.js +114 -0
  39. package/dist/FileUpload-BBgPcRag.js +54 -0
  40. package/dist/FileUpload-BgkhxtNe.js +47 -0
  41. package/dist/Form-BLq6U3In.js +339 -0
  42. package/dist/Form-E6zXqgsm.js +286 -0
  43. package/dist/Icon-CcLuhz6B.js +64 -0
  44. package/dist/Icon-_UiLblGb.js +74 -0
  45. package/dist/Image-B_VERIvH.js +111 -0
  46. package/dist/Image-hI8kIx8U.js +93 -0
  47. package/dist/Link-BVTo43Cc.js +76 -0
  48. package/dist/Link-xSrPxOLt.js +95 -0
  49. package/dist/Menu-CembLIjO.js +83 -0
  50. package/dist/Menu-D9ZjIOMg.js +73 -0
  51. package/dist/MicroApp-DI1kQwJk.js +100 -0
  52. package/dist/MicroApp-DJw57sLE.js +75 -0
  53. package/dist/NumberInput-DftAAKEs.js +84 -0
  54. package/dist/NumberInput-eOAk0-fb.js +95 -0
  55. package/dist/Panel-Bso5fv4i.js +127 -0
  56. package/dist/Panel-CwzW9iuA.js +161 -0
  57. package/dist/Radio-button-Sii5iveh.js +71 -0
  58. package/dist/Radio-button-YXsVqipQ.js +53 -0
  59. package/dist/RefComponent-Bwk_I0mK.js +79 -0
  60. package/dist/RefComponent-ZxafRVhZ.js +96 -0
  61. package/dist/RichText-CgYXXC_a.js +485 -0
  62. package/dist/RichText-DV46U7fI.js +449 -0
  63. package/dist/Row-Bb95f5DI.js +229 -0
  64. package/dist/Row-Dmd_61mR.js +202 -0
  65. package/dist/Select-Cma8JHAj.js +77 -0
  66. package/dist/Select-DqA08VYb.js +87 -0
  67. package/dist/Slider-B2_Qecjz.js +74 -0
  68. package/dist/Slider-DVY0N2YX.js +55 -0
  69. package/dist/Table-0WjrBnz-.js +159 -0
  70. package/dist/Table-dEma50kw.js +184 -0
  71. package/dist/Tabs-BDKEv1jn.js +131 -0
  72. package/dist/Tabs-Cvt3Q8vx.js +116 -0
  73. package/dist/Tag-BcZvQkE_.js +47 -0
  74. package/dist/Tag-DMZ0mu8y.js +61 -0
  75. package/dist/TextInput-KI6r9xET.js +193 -0
  76. package/dist/TextInput-hxK-HhJi.js +148 -0
  77. package/dist/TextLabel-DkV26yaL.js +102 -0
  78. package/dist/Textarea-Bzs3jSUm.js +117 -0
  79. package/dist/Textarea-CwK3SYbz.js +83 -0
  80. package/dist/Video-C4uBWCBb.js +100 -0
  81. package/dist/Video-CL1lgcvB.js +120 -0
  82. package/dist/aitchat-DjX5s7_8.js +23 -0
  83. package/dist/colorpicker-B-KETfWw.js +64 -0
  84. package/dist/colorpicker-DhB0AygJ.js +75 -0
  85. package/dist/constants-Bs_KQRi_.js +4 -0
  86. package/dist/constants-CXdpxgF2.js +4 -0
  87. package/dist/{cssMode-D82-gS78.js → cssMode-CV7QbFJv.js} +1 -1
  88. package/dist/{freemarker2-CYRLpyjt.js → freemarker2-CqQxSEZa.js} +1 -1
  89. package/dist/{handlebars-R8Efxi60.js → handlebars-a71LdN7X.js} +1 -1
  90. package/dist/{html-czhjovcp.js → html-D8UaB7IC.js} +1 -1
  91. package/dist/{htmlMode-DpyKDYYs.js → htmlMode-CqWQMFWX.js} +1 -1
  92. package/dist/iconbutton-DfnrRmmB.js +69 -0
  93. package/dist/iconbutton-DvIQHV8o.js +53 -0
  94. package/dist/{javascript-DwqkMEdb.js → javascript-D_jGqcRD.js} +1 -1
  95. package/dist/{jsonMode-Cmxxe0W9.js → jsonMode-C3-m5xts.js} +1 -1
  96. package/dist/{liquid-2spuEcBh.js → liquid-DLwYj6Te.js} +1 -1
  97. package/dist/{mdx-BjBXyEeR.js → mdx-DhYjhxkW.js} +1 -1
  98. package/dist/micro-app-entry-DiNqE6xi.js +12042 -0
  99. package/dist/micro-app.bundle.js +1 -1
  100. package/dist/micro-app.js +6 -4969
  101. package/dist/{python-DLI1ji08.js → python-B-WcGqFq.js} +1 -1
  102. package/dist/{razor-oAnIJsrL.js → razor-JGACy1mz.js} +1 -1
  103. package/dist/runtime.js +4 -2
  104. package/dist/{tsMode-D_PMsbjK.js → tsMode-lzBM1oT2.js} +1 -1
  105. package/dist/{typescript-Bu3ZbtQI.js → typescript-CuL5pdO2.js} +1 -1
  106. package/dist/{xml-CNSSkPqy.js → xml-D1tacAKD.js} +1 -1
  107. package/dist/{yaml-5RF_PGNe.js → yaml-CjPB1g7v.js} +1 -1
  108. package/package.json +1 -1
  109. package/utils/index.ts +4 -1
  110. package/utils/lazy-component-loader.ts +120 -0
  111. package/utils/register-components.ts +14 -40
  112. package/utils/render-util.ts +84 -0
  113. package/dist/micro-app-entry-DYAnCRDo.js +0 -15860
@@ -0,0 +1,286 @@
1
+ import { i as f, B as p, $ as g, s as v, b as d, r as _, n as m, A as h, c, d as u, t as $ } from "./micro-app-entry-DiNqE6xi.js";
2
+ import "@nuralyui/icon";
3
+ import "@nuralyui/label";
4
+ const b = f`
5
+ :host {
6
+ display: block;
7
+ width: 100%;
8
+ }
9
+
10
+ .form-placeholder {
11
+ display: flex;
12
+ flex-direction: column;
13
+ align-items: center;
14
+ justify-content: center;
15
+ color: #64748b;
16
+ min-height: 200px;
17
+ width: 100%;
18
+ border-radius: 8px;
19
+ border: 2px dashed #cbd5e1;
20
+ gap: 12px;
21
+ cursor: pointer;
22
+ }
23
+
24
+ .form-placeholder nr-icon {
25
+ --nuraly-icon-size: 48px;
26
+ }
27
+ `;
28
+ var C = Object.defineProperty, E = Object.getOwnPropertyDescriptor, l = (t, i, e, r) => {
29
+ for (var n = r > 1 ? void 0 : r ? E(i, e) : i, a = t.length - 1, o; a >= 0; a--)
30
+ (o = t[a]) && (n = (r ? o(i, e, n) : o(n)) || n);
31
+ return r && n && C(i, e, n), n;
32
+ };
33
+ try {
34
+ await import("@nuralyui/forms");
35
+ } catch {
36
+ console.warn("[@nuralyui/forms] Package not found or failed to load.");
37
+ }
38
+ let s = class extends p {
39
+ constructor() {
40
+ super(), this._formElement = null, this._registeredFields = /* @__PURE__ */ new Map(), this.childrenComponents = [], this._fieldRegisterHandler = this._handleFieldRegister.bind(this), this._fieldUnregisterHandler = this._handleFieldUnregister.bind(this), this._fieldValueChangeHandler = this._handleFieldValueChange.bind(this);
41
+ }
42
+ connectedCallback() {
43
+ super.connectedCallback(), this.updateChildrenComponents(), this.addEventListener("nr-field-register", this._fieldRegisterHandler), this.addEventListener("nr-field-unregister", this._fieldUnregisterHandler), this.addEventListener("nr-field-value-change", this._fieldValueChangeHandler);
44
+ }
45
+ willUpdate(t) {
46
+ super.willUpdate(t), t.has("component") && this.updateChildrenComponents();
47
+ }
48
+ updateChildrenComponents() {
49
+ this.childrenComponents = this.component?.childrenIds?.map((t) => g.get()[this.component?.application_id]?.find((i) => i.uuid === t)).filter(Boolean) ?? [];
50
+ }
51
+ disconnectedCallback() {
52
+ super.disconnectedCallback(), this.removeEventListener("nr-field-register", this._fieldRegisterHandler), this.removeEventListener("nr-field-unregister", this._fieldUnregisterHandler), this.removeEventListener("nr-field-value-change", this._fieldValueChangeHandler), this._registeredFields.clear();
53
+ }
54
+ firstUpdated(t) {
55
+ super.firstUpdated(t), this._formElement = this.renderRoot.querySelector("nr-form"), this.registerCallback("disabled", (i) => {
56
+ this._formElement && (this._formElement.disabled = i);
57
+ });
58
+ }
59
+ /**
60
+ * Handle field registration from child input blocks
61
+ */
62
+ _handleFieldRegister(t) {
63
+ t.stopPropagation();
64
+ const { element: i, name: e, blockElement: r } = t.detail;
65
+ if (!e || !i) {
66
+ console.warn("[FormBlock] Field registration missing name or element");
67
+ return;
68
+ }
69
+ if (this._registeredFields.set(e, { element: i, blockElement: r }), this._formElement?.validationController)
70
+ try {
71
+ this._formElement.validationController.registerField(i);
72
+ } catch (n) {
73
+ console.warn("[FormBlock] Failed to register field with validation controller:", n);
74
+ }
75
+ }
76
+ /**
77
+ * Handle field unregistration when child input blocks are removed
78
+ */
79
+ _handleFieldUnregister(t) {
80
+ t.stopPropagation();
81
+ const { name: i } = t.detail;
82
+ if (i && this._registeredFields.has(i)) {
83
+ if (this._formElement?.validationController)
84
+ try {
85
+ this._formElement.validationController.unregisterField(i);
86
+ } catch (e) {
87
+ console.warn("[FormBlock] Failed to unregister field:", e);
88
+ }
89
+ this._registeredFields.delete(i);
90
+ }
91
+ }
92
+ /**
93
+ * Handle field value changes for form data collection
94
+ */
95
+ _handleFieldValueChange(t) {
96
+ const { name: i, value: e } = t.detail;
97
+ if (i && this._registeredFields.has(i)) {
98
+ const r = this._registeredFields.get(i);
99
+ r.value = e;
100
+ }
101
+ }
102
+ /**
103
+ * Get all form field values
104
+ */
105
+ getFieldsValue() {
106
+ if (this._formElement?.getFieldsValue)
107
+ return this._formElement.getFieldsValue();
108
+ const t = {};
109
+ for (const [i, e] of this._registeredFields)
110
+ t[i] = e.element?.value ?? e.value;
111
+ return t;
112
+ }
113
+ /**
114
+ * Set form field values
115
+ */
116
+ setFieldsValue(t) {
117
+ this._formElement?.setFieldsValue && this._formElement.setFieldsValue(t);
118
+ }
119
+ /**
120
+ * Validate all form fields
121
+ */
122
+ async validate() {
123
+ return this._formElement?.validate ? this._formElement.validate() : !0;
124
+ }
125
+ /**
126
+ * Submit the form programmatically
127
+ */
128
+ async submit(t) {
129
+ this._formElement?.submit && await this._formElement.submit(t);
130
+ }
131
+ /**
132
+ * Reset the form
133
+ */
134
+ reset() {
135
+ this._formElement?.reset && this._formElement.reset();
136
+ }
137
+ /**
138
+ * Get form state summary
139
+ */
140
+ getFormState() {
141
+ return this._formElement?.getFormState ? this._formElement.getFormState() : {
142
+ isValid: !0,
143
+ isSubmitting: !1,
144
+ hasErrors: !1,
145
+ errorCount: 0,
146
+ fieldCount: this._registeredFields.size
147
+ };
148
+ }
149
+ /**
150
+ * Render placeholder when form is empty in editor mode
151
+ */
152
+ renderPlaceholder() {
153
+ return d`
154
+ <div
155
+ class="form-placeholder"
156
+ @click="${() => v(this.component?.uuid)}"
157
+ >
158
+ <nr-icon name="file-text"></nr-icon>
159
+ <nr-label>Add form fields to this form</nr-label>
160
+ <drag-wrapper
161
+ .where=${"inside"}
162
+ .message=${"Drop inside"}
163
+ .component=${{ ...this.component }}
164
+ .inputRef=${this.inputRef}
165
+ .isDragInitiator=${this.isDragInitiator}
166
+ >
167
+ </drag-wrapper>
168
+ </div>
169
+ `;
170
+ }
171
+ /**
172
+ * Render children components
173
+ */
174
+ renderChildren() {
175
+ return _(
176
+ this.childrenComponents.map((t) => ({ ...t, item: this.item })),
177
+ this.item,
178
+ this.isViewMode,
179
+ { ...this.component, uniqueUUID: this.uniqueUUID }
180
+ );
181
+ }
182
+ renderComponent() {
183
+ const t = this.getStyles(), i = this.childrenComponents.length > 0;
184
+ return this.isViewMode ? d`
185
+ <nr-form
186
+ ${m(this.inputRef)}
187
+ class="${`drop-${this.component.uuid}`}"
188
+ style=${Object.entries(t).map(([e, r]) => `${e}:${r}`).join(";")}
189
+ .disabled=${this.inputHandlersValue?.disabled || !1}
190
+ .validateOnChange=${this.inputHandlersValue?.validateOnChange ?? !1}
191
+ .validateOnBlur=${this.inputHandlersValue?.validateOnBlur ?? !0}
192
+ .preventInvalidSubmission=${this.inputHandlersValue?.preventInvalidSubmission ?? !0}
193
+ .resetOnSuccess=${this.inputHandlersValue?.resetOnSuccess ?? !1}
194
+ .action=${this.inputHandlersValue?.action ?? h}
195
+ .method=${this.inputHandlersValue?.method ?? "POST"}
196
+ @nr-form-submit-success=${(e) => {
197
+ this.executeEvent("onSubmitSuccess", e, {
198
+ formData: e.detail?.formData,
199
+ values: this.getFieldsValue()
200
+ });
201
+ }}
202
+ @nr-form-submit-error=${(e) => {
203
+ this.executeEvent("onSubmitError", e, {
204
+ error: e.detail?.error
205
+ });
206
+ }}
207
+ @nr-form-validation-changed=${(e) => {
208
+ this.executeEvent("onValidationChange", e, {
209
+ validationResult: e.detail?.validationResult
210
+ });
211
+ }}
212
+ @nr-form-field-changed=${(e) => {
213
+ this.executeEvent("onFieldChange", e, {
214
+ field: e.detail?.field
215
+ });
216
+ }}
217
+ @nr-form-reset=${(e) => {
218
+ this.executeEvent("onReset", e, {});
219
+ }}
220
+ >
221
+ ${i ? this.renderChildren() : h}
222
+ </nr-form>
223
+ ` : d`
224
+ <nr-form
225
+ ${m(this.inputRef)}
226
+ class="${`drop-${this.component.uuid}`}"
227
+ style=${Object.entries(t).map(([e, r]) => `${e}:${r}`).join(";")}
228
+ .disabled=${this.inputHandlersValue?.disabled || !1}
229
+ .validateOnChange=${this.inputHandlersValue?.validateOnChange ?? !1}
230
+ .validateOnBlur=${this.inputHandlersValue?.validateOnBlur ?? !0}
231
+ .preventInvalidSubmission=${this.inputHandlersValue?.preventInvalidSubmission ?? !0}
232
+ .resetOnSuccess=${this.inputHandlersValue?.resetOnSuccess ?? !1}
233
+ .action=${this.inputHandlersValue?.action ?? h}
234
+ .method=${this.inputHandlersValue?.method ?? "POST"}
235
+ @nr-form-submit-success=${(e) => {
236
+ this.executeEvent("onSubmitSuccess", e, {
237
+ formData: e.detail?.formData,
238
+ values: this.getFieldsValue()
239
+ });
240
+ }}
241
+ @nr-form-submit-error=${(e) => {
242
+ this.executeEvent("onSubmitError", e, {
243
+ error: e.detail?.error
244
+ });
245
+ }}
246
+ @nr-form-validation-changed=${(e) => {
247
+ this.executeEvent("onValidationChange", e, {
248
+ validationResult: e.detail?.validationResult
249
+ });
250
+ }}
251
+ @nr-form-field-changed=${(e) => {
252
+ this.executeEvent("onFieldChange", e, {
253
+ field: e.detail?.field
254
+ });
255
+ }}
256
+ @nr-form-reset=${(e) => {
257
+ this.executeEvent("onReset", e, {});
258
+ }}
259
+ >
260
+ ${i ? this.renderChildren() : this.renderPlaceholder()}
261
+ </nr-form>
262
+ `;
263
+ }
264
+ };
265
+ s.styles = [b];
266
+ l([
267
+ c({ type: Object })
268
+ ], s.prototype, "component", 2);
269
+ l([
270
+ c({ type: Object })
271
+ ], s.prototype, "item", 2);
272
+ l([
273
+ u()
274
+ ], s.prototype, "_formElement", 2);
275
+ l([
276
+ u()
277
+ ], s.prototype, "_registeredFields", 2);
278
+ l([
279
+ u()
280
+ ], s.prototype, "childrenComponents", 2);
281
+ s = l([
282
+ $("form-block")
283
+ ], s);
284
+ export {
285
+ s as FormBlock
286
+ };
@@ -0,0 +1,64 @@
1
+ import { B as u, n as h, A as l, o as d, b as y, c as p, t as b } from "./micro-app-entry-DiNqE6xi.js";
2
+ var $ = Object.defineProperty, v = Object.getOwnPropertyDescriptor, r = (t, e, c, n) => {
3
+ for (var i = n > 1 ? void 0 : n ? v(e, c) : e, a = t.length - 1, s; a >= 0; a--)
4
+ (s = t[a]) && (i = (n ? s(e, c, i) : s(i)) || i);
5
+ return n && i && $(e, c, i), i;
6
+ };
7
+ try {
8
+ await import("@nuralyui/icon");
9
+ } catch {
10
+ console.warn("[@nuralyui/icon] Package not found or failed to load.");
11
+ }
12
+ let o = class extends u {
13
+ constructor() {
14
+ super(), this.registerCallback("icon", () => {
15
+ });
16
+ }
17
+ connectedCallback() {
18
+ super.connectedCallback();
19
+ }
20
+ renderComponent() {
21
+ const t = this.getStyles();
22
+ return y`
23
+ <nr-icon
24
+ ${h(this.inputRef)}
25
+ .name=${this.inputHandlersValue.icon ?? "smile"}
26
+ .type=${this.inputHandlersValue.type || "solid"}
27
+ .alt=${this.inputHandlersValue.alt || ""}
28
+ .size=${this.inputHandlersValue.size || l}
29
+ .color=${this.inputHandlersValue.color || l}
30
+ .width=${t?.width || l}
31
+ .height=${t?.height || l}
32
+ .clickable=${this.inputHandlersValue.clickable || !1}
33
+ .disabled=${this.inputHandlersValue.state === "disabled"}
34
+ @click=${(e) => {
35
+ this.executeEvent("onClick", e);
36
+ }}
37
+ @icon-click=${(e) => {
38
+ this.executeEvent("onIconClick", e);
39
+ }}
40
+ @icon-keyboard-activation=${(e) => {
41
+ this.executeEvent("onIconKeyboardActivation", e);
42
+ }}
43
+ style=${d({
44
+ display: "block",
45
+ ...this.getStyles(),
46
+ "--nuraly-icon-width": t?.width,
47
+ "--nuraly-icon-height": t?.height
48
+ })}>
49
+ </nr-icon>
50
+ `;
51
+ }
52
+ };
53
+ r([
54
+ p({ type: Object })
55
+ ], o.prototype, "component", 2);
56
+ r([
57
+ p({ type: Object })
58
+ ], o.prototype, "item", 2);
59
+ o = r([
60
+ b("icon-block")
61
+ ], o);
62
+ export {
63
+ o as IconBlock
64
+ };
@@ -0,0 +1,74 @@
1
+ import { nothing, html } 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/icon');
19
+ } catch (error) {
20
+ console.warn("[@nuralyui/icon] Package not found or failed to load.");
21
+ }
22
+ let IconBlock = class extends BaseElementBlock {
23
+ constructor() {
24
+ super();
25
+ this.registerCallback("icon", () => {
26
+ });
27
+ }
28
+ connectedCallback() {
29
+ super.connectedCallback();
30
+ }
31
+ renderComponent() {
32
+ const iconStyles = this.getStyles();
33
+ return html`
34
+ <nr-icon
35
+ ${ref(this.inputRef)}
36
+ .name=${this.inputHandlersValue.icon ?? "smile"}
37
+ .type=${this.inputHandlersValue.type || "solid"}
38
+ .alt=${this.inputHandlersValue.alt || ""}
39
+ .size=${this.inputHandlersValue.size || nothing}
40
+ .color=${this.inputHandlersValue.color || nothing}
41
+ .width=${iconStyles?.width || nothing}
42
+ .height=${iconStyles?.height || nothing}
43
+ .clickable=${this.inputHandlersValue.clickable || false}
44
+ .disabled=${this.inputHandlersValue.state === "disabled"}
45
+ @click=${(e) => {
46
+ this.executeEvent("onClick", e);
47
+ }}
48
+ @icon-click=${(e) => {
49
+ this.executeEvent("onIconClick", e);
50
+ }}
51
+ @icon-keyboard-activation=${(e) => {
52
+ this.executeEvent("onIconKeyboardActivation", e);
53
+ }}
54
+ style=${styleMap({
55
+ display: "block",
56
+ ...this.getStyles(),
57
+ "--nuraly-icon-width": iconStyles?.width,
58
+ "--nuraly-icon-height": iconStyles?.height
59
+ })}>
60
+ </nr-icon>
61
+ `;
62
+ }
63
+ };
64
+ __decorateClass([
65
+ property({ type: Object })
66
+ ], IconBlock.prototype, "component", 2);
67
+ __decorateClass([
68
+ property({ type: Object })
69
+ ], IconBlock.prototype, "item", 2);
70
+ IconBlock = __decorateClass([
71
+ customElement("icon-block")
72
+ ], IconBlock);
73
+
74
+ export { IconBlock };
@@ -0,0 +1,111 @@
1
+ import { html, nothing, css } from 'lit';
2
+ import { property, customElement } from 'lit/decorators.js';
3
+ import { ae as BaseElementBlock } from './BaseElement-pS6m_x6Q.js';
4
+ import { styleMap } from 'lit/directives/style-map.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/image');
19
+ } catch (error) {
20
+ console.warn("[@nuralyui/image] Package not found or failed to load.");
21
+ }
22
+ let ImageBlock = class extends BaseElementBlock {
23
+ connectedCallback() {
24
+ super.connectedCallback();
25
+ this.isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches;
26
+ window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (event) => {
27
+ this.isDarkMode = event.matches;
28
+ this.requestUpdate();
29
+ });
30
+ }
31
+ renderComponent() {
32
+ const fallbackStyles = this.getStyles();
33
+ const imageStyles = this.getStyles() || {};
34
+ const imageStyleHandlers = this.component?.styleHandlers ? Object.fromEntries(
35
+ Object.entries(this.component?.styleHandlers).filter(([key, value]) => value)
36
+ ) : {};
37
+ const imageSrc = this.isDarkMode ? this.inputHandlersValue?.darkSrc ?? this.inputHandlersValue?.src : this.inputHandlersValue?.src;
38
+ if (!imageSrc) {
39
+ return html`
40
+ <div
41
+ ${ref(this.inputRef)}
42
+ class="image-placeholder"
43
+ style=${styleMap({
44
+ width: imageStyleHandlers?.width || imageStyles?.width || "100%",
45
+ height: imageStyleHandlers?.height || imageStyles?.height || "200px"
46
+ })}
47
+ @click=${(e) => this.executeEvent("onClick", e)}
48
+ >
49
+ <nr-icon name="image"></nr-icon>
50
+ <nr-label>No image source</nr-label>
51
+ </div>
52
+ `;
53
+ }
54
+ return html`
55
+ <nr-image
56
+ ${ref(this.inputRef)}
57
+ style=${styleMap({
58
+ ...this.getStyles(),
59
+ "display": "block",
60
+ "--nuraly-image-local-border-top-left-radius": fallbackStyles?.["border-top-left-radius"] ?? "",
61
+ "--nuraly-image-local-border-top-right-radius": fallbackStyles?.["border-top-right-radius"] ?? "",
62
+ "--nuraly-image-local-border-bottom-left-radius": fallbackStyles?.["border-bottom-left-radius"] ?? "",
63
+ "--nuraly-image-local-border-bottom-right-radius": fallbackStyles?.["border-bottom-right-radius"] ?? ""
64
+ })}
65
+ .src=${imageSrc}
66
+ .fallback=${this.inputHandlersValue?.fallback ?? nothing}
67
+ .previewable=${this.inputHandlersValue?.previewable ?? false}
68
+ .fit=${this.inputHandlersValue?.fit ?? nothing}
69
+ .block=${this.inputHandlersValue?.block ?? false}
70
+ .width=${imageStyleHandlers?.width || imageStyles?.width}
71
+ .height=${imageStyleHandlers?.height || imageStyles?.height}
72
+ .alt=${this.inputHandlersValue?.alt ?? "image"}
73
+ @click=${(e) => this.executeEvent("onClick", e)}
74
+ @nr-image-error=${(e) => this.executeEvent("onError", e)}
75
+ @nr-image-load=${(e) => this.executeEvent("onLoad", e)}
76
+ @nr-image-preview-open=${(e) => this.executeEvent("onPreviewOpen", e)}
77
+ @nr-image-preview-close=${(e) => this.executeEvent("onPreviewClose", e)}
78
+ >
79
+ </nr-image>
80
+ `;
81
+ }
82
+ };
83
+ ImageBlock.styles = [css`
84
+ :host {
85
+ display: block;
86
+ }
87
+ .image-placeholder {
88
+ display: flex;
89
+ flex-direction: column;
90
+ align-items: center;
91
+ justify-content: center;
92
+ color: #64748b;
93
+ min-height: 200px;
94
+ min-width: 200px;
95
+ border-radius: 8px;
96
+ border: 2px dashed #cbd5e1;
97
+ gap: 12px;
98
+ box-sizing: border-box;
99
+ }
100
+ .image-placeholder nr-icon {
101
+ --nuraly-icon-size: 48px;
102
+ }
103
+ `];
104
+ __decorateClass([
105
+ property({ type: Object })
106
+ ], ImageBlock.prototype, "component", 2);
107
+ ImageBlock = __decorateClass([
108
+ customElement("image-block")
109
+ ], ImageBlock);
110
+
111
+ export { ImageBlock };
@@ -0,0 +1,93 @@
1
+ import { B as u, n, o as c, b as d, A as h, i as m, c as g, t as b } from "./micro-app-entry-DiNqE6xi.js";
2
+ var f = Object.defineProperty, y = Object.getOwnPropertyDescriptor, p = (t, r, i, a) => {
3
+ for (var e = a > 1 ? void 0 : a ? y(r, i) : r, l = t.length - 1, s; l >= 0; l--)
4
+ (s = t[l]) && (e = (a ? s(r, i, e) : s(e)) || e);
5
+ return a && e && f(r, i, e), e;
6
+ };
7
+ try {
8
+ await import("@nuralyui/image");
9
+ } catch {
10
+ console.warn("[@nuralyui/image] Package not found or failed to load.");
11
+ }
12
+ let o = class extends u {
13
+ connectedCallback() {
14
+ super.connectedCallback(), this.isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches, window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (t) => {
15
+ this.isDarkMode = t.matches, this.requestUpdate();
16
+ });
17
+ }
18
+ renderComponent() {
19
+ const t = this.getStyles(), r = this.getStyles() || {}, i = this.component?.styleHandlers ? Object.fromEntries(
20
+ Object.entries(this.component?.styleHandlers).filter(([e, l]) => l)
21
+ ) : {}, a = this.isDarkMode ? this.inputHandlersValue?.darkSrc ?? this.inputHandlersValue?.src : this.inputHandlersValue?.src;
22
+ return a ? d`
23
+ <nr-image
24
+ ${n(this.inputRef)}
25
+ style=${c({
26
+ ...this.getStyles(),
27
+ display: "block",
28
+ "--nuraly-image-local-border-top-left-radius": t?.["border-top-left-radius"] ?? "",
29
+ "--nuraly-image-local-border-top-right-radius": t?.["border-top-right-radius"] ?? "",
30
+ "--nuraly-image-local-border-bottom-left-radius": t?.["border-bottom-left-radius"] ?? "",
31
+ "--nuraly-image-local-border-bottom-right-radius": t?.["border-bottom-right-radius"] ?? ""
32
+ })}
33
+ .src=${a}
34
+ .fallback=${this.inputHandlersValue?.fallback ?? h}
35
+ .previewable=${this.inputHandlersValue?.previewable ?? !1}
36
+ .fit=${this.inputHandlersValue?.fit ?? h}
37
+ .block=${this.inputHandlersValue?.block ?? !1}
38
+ .width=${i?.width || r?.width}
39
+ .height=${i?.height || r?.height}
40
+ .alt=${this.inputHandlersValue?.alt ?? "image"}
41
+ @click=${(e) => this.executeEvent("onClick", e)}
42
+ @nr-image-error=${(e) => this.executeEvent("onError", e)}
43
+ @nr-image-load=${(e) => this.executeEvent("onLoad", e)}
44
+ @nr-image-preview-open=${(e) => this.executeEvent("onPreviewOpen", e)}
45
+ @nr-image-preview-close=${(e) => this.executeEvent("onPreviewClose", e)}
46
+ >
47
+ </nr-image>
48
+ ` : d`
49
+ <div
50
+ ${n(this.inputRef)}
51
+ class="image-placeholder"
52
+ style=${c({
53
+ width: i?.width || r?.width || "100%",
54
+ height: i?.height || r?.height || "200px"
55
+ })}
56
+ @click=${(e) => this.executeEvent("onClick", e)}
57
+ >
58
+ <nr-icon name="image"></nr-icon>
59
+ <nr-label>No image source</nr-label>
60
+ </div>
61
+ `;
62
+ }
63
+ };
64
+ o.styles = [m`
65
+ :host {
66
+ display: block;
67
+ }
68
+ .image-placeholder {
69
+ display: flex;
70
+ flex-direction: column;
71
+ align-items: center;
72
+ justify-content: center;
73
+ color: #64748b;
74
+ min-height: 200px;
75
+ min-width: 200px;
76
+ border-radius: 8px;
77
+ border: 2px dashed #cbd5e1;
78
+ gap: 12px;
79
+ box-sizing: border-box;
80
+ }
81
+ .image-placeholder nr-icon {
82
+ --nuraly-icon-size: 48px;
83
+ }
84
+ `];
85
+ p([
86
+ g({ type: Object })
87
+ ], o.prototype, "component", 2);
88
+ o = p([
89
+ b("image-block")
90
+ ], o);
91
+ export {
92
+ o as ImageBlock
93
+ };