@nuraly/runtime 0.1.9 → 0.1.11

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 (114) hide show
  1. package/components/ui/components/base/controllers/InputHandlerController.ts +5 -0
  2. package/components/ui/components/inputs/ColorPicker/colorpicker.ts +1 -7
  3. package/components/ui/components/inputs/Form/Form.ts +3 -11
  4. package/components/ui/components/inputs/RadioButton/Radio-button.ts +1 -7
  5. package/components/ui/components/inputs/Select/Select.ts +1 -7
  6. package/components/ui/components/layout/Grid/Col.ts +2 -6
  7. package/components/ui/components/layout/Grid/Row.ts +2 -6
  8. package/components/ui/components/studio/FunctionsPanel/FunctionsPanel.ts +4 -16
  9. package/dist/AIChat-C-wFf4PD.js +220 -0
  10. package/dist/AIChat-Cly-frW6.js +260 -0
  11. package/dist/Badge-BUm76SZ2.js +70 -0
  12. package/dist/Badge-BarGcY8u.js +48 -0
  13. package/dist/{BaseElement-BNBn_IJk.js → BaseElement-wyA58UxT.js} +156 -24
  14. package/dist/Button-BEgayuX9.js +80 -0
  15. package/dist/Button-wgwjzM_f.js +92 -0
  16. package/dist/Card-B4r5RQgn.js +120 -0
  17. package/dist/Card-a1sdDpKe.js +150 -0
  18. package/dist/Checkbox-CC9PkwpC.js +59 -0
  19. package/dist/Checkbox-WVmAN9ZP.js +65 -0
  20. package/dist/Code-Dc66ui4C.js +109 -0
  21. package/dist/Code-kVoVXBbt.js +123 -0
  22. package/dist/{CodeEditor-B1gNuvPb.js → CodeEditor-2QHTZxKN.js} +22 -22
  23. package/dist/Col-BKbQ2o0P.js +217 -0
  24. package/dist/Col-x4rRO4dz.js +193 -0
  25. package/dist/Collapse-Dd2GfevD.js +74 -0
  26. package/dist/Collapse-Xo-jb8zs.js +96 -0
  27. package/dist/Collections-DEqUHWFe.js +151 -0
  28. package/dist/Collections-DsTr-Zt7.js +122 -0
  29. package/dist/Container-C1HjQgb7.js +204 -0
  30. package/dist/DatePicker-DRVwFJmL.js +99 -0
  31. package/dist/DatePicker-oAOJyU3e.js +80 -0
  32. package/dist/Divider-BMA6S7Pd.js +106 -0
  33. package/dist/Divider-zbcO-KF9.js +86 -0
  34. package/dist/Document-BqVezrmJ.js +90 -0
  35. package/dist/Document-C2lg-jdj.js +74 -0
  36. package/dist/Dropdown-BRN-hpgd.js +133 -0
  37. package/dist/Dropdown-j62nqdd-.js +112 -0
  38. package/dist/EmbedURL-Bgr2pdf_.js +114 -0
  39. package/dist/EmbedURL-DFt6rN3J.js +142 -0
  40. package/dist/FileUpload-B5TBQJPC.js +54 -0
  41. package/dist/FileUpload-sYxMn9Rj.js +47 -0
  42. package/dist/Form-7ZWgBVzR.js +286 -0
  43. package/dist/Form-CsN7UMF-.js +339 -0
  44. package/dist/Icon-B_2ZWGd0.js +64 -0
  45. package/dist/Icon-CkLIObME.js +74 -0
  46. package/dist/Image-CcswllGj.js +93 -0
  47. package/dist/Image-CihbGdKt.js +111 -0
  48. package/dist/Link-BEUscah_.js +95 -0
  49. package/dist/Link-C4HV3i5L.js +76 -0
  50. package/dist/Menu-B98hcumz.js +83 -0
  51. package/dist/Menu-BEzo-k-M.js +73 -0
  52. package/dist/MicroApp-BDPSu_XC.js +75 -0
  53. package/dist/MicroApp-DCBOKAJ4.js +100 -0
  54. package/dist/NumberInput-Bbo10XmQ.js +95 -0
  55. package/dist/NumberInput-YJKsJDcd.js +84 -0
  56. package/dist/Panel-C1tcqveD.js +161 -0
  57. package/dist/Panel-DidE5uT5.js +127 -0
  58. package/dist/Radio-button-CuVS3-fC.js +71 -0
  59. package/dist/Radio-button-Cxj0bL8i.js +53 -0
  60. package/dist/RefComponent-BgOcavVg.js +79 -0
  61. package/dist/RefComponent-DTerPZ8J.js +96 -0
  62. package/dist/RichText-BiZgSdNO.js +449 -0
  63. package/dist/RichText-CwMNVuR_.js +485 -0
  64. package/dist/Row-BEx5bGTR.js +202 -0
  65. package/dist/Row-XczXHjOV.js +229 -0
  66. package/dist/Select-Bd16OOiE.js +87 -0
  67. package/dist/Select-D0xinu-U.js +77 -0
  68. package/dist/Slider-BVFPWYh3.js +55 -0
  69. package/dist/Slider-DGulvswN.js +74 -0
  70. package/dist/Table-C44wa8yn.js +159 -0
  71. package/dist/Table-CQiS_Q-s.js +184 -0
  72. package/dist/Tabs-CPQxFISc.js +131 -0
  73. package/dist/Tabs-DW2Su8xF.js +116 -0
  74. package/dist/Tag-BEfAQrjG.js +61 -0
  75. package/dist/Tag-BLxTFDcC.js +47 -0
  76. package/dist/TextInput-BWhdGS3a.js +148 -0
  77. package/dist/TextInput-CV850FvO.js +193 -0
  78. package/dist/TextLabel-CbSGmoVY.js +102 -0
  79. package/dist/Textarea-Bncyxfts.js +83 -0
  80. package/dist/Textarea-SEbx4KI5.js +117 -0
  81. package/dist/Video--shJ014h.js +120 -0
  82. package/dist/Video-CflXfaiK.js +100 -0
  83. package/dist/aitchat-Btz9TPEN.js +23 -0
  84. package/dist/colorpicker-BO_4CeX4.js +64 -0
  85. package/dist/colorpicker-UzXsx6gP.js +75 -0
  86. package/dist/constants-Bs_KQRi_.js +4 -0
  87. package/dist/constants-CXdpxgF2.js +4 -0
  88. package/dist/{cssMode-D82-gS78.js → cssMode-tpaxIZJS.js} +1 -1
  89. package/dist/{freemarker2-CYRLpyjt.js → freemarker2-Nx-tkO9y.js} +1 -1
  90. package/dist/{handlebars-R8Efxi60.js → handlebars-CF3Jmmto.js} +1 -1
  91. package/dist/{html-czhjovcp.js → html-CdZEJTJR.js} +1 -1
  92. package/dist/{htmlMode-DpyKDYYs.js → htmlMode-CztruwTl.js} +1 -1
  93. package/dist/iconbutton-BwuZYQyh.js +53 -0
  94. package/dist/iconbutton-CE0Vxu1G.js +69 -0
  95. package/dist/{javascript-DwqkMEdb.js → javascript-CVODTc2t.js} +1 -1
  96. package/dist/{jsonMode-Cmxxe0W9.js → jsonMode-ChPl6moP.js} +1 -1
  97. package/dist/{liquid-2spuEcBh.js → liquid-BckHw388.js} +1 -1
  98. package/dist/{mdx-BjBXyEeR.js → mdx-DB1fiwuN.js} +1 -1
  99. package/dist/micro-app-entry-BgDXbkmh.js +12042 -0
  100. package/dist/micro-app.bundle.js +1 -1
  101. package/dist/micro-app.js +6 -4969
  102. package/dist/{python-DLI1ji08.js → python-DOQt67t7.js} +1 -1
  103. package/dist/{razor-oAnIJsrL.js → razor-D65ZeXuP.js} +1 -1
  104. package/dist/runtime.js +4 -2
  105. package/dist/{tsMode-D_PMsbjK.js → tsMode-CXrSAnjJ.js} +1 -1
  106. package/dist/{typescript-Bu3ZbtQI.js → typescript-BuKvlC_a.js} +1 -1
  107. package/dist/{xml-CNSSkPqy.js → xml-_nj2r-yt.js} +1 -1
  108. package/dist/{yaml-5RF_PGNe.js → yaml-m8PrW_TL.js} +1 -1
  109. package/package.json +1 -1
  110. package/utils/index.ts +4 -1
  111. package/utils/lazy-component-loader.ts +120 -0
  112. package/utils/register-components.ts +14 -40
  113. package/utils/render-util.ts +84 -0
  114. package/dist/micro-app-entry-DYAnCRDo.js +0 -15860
@@ -0,0 +1,217 @@
1
+ import { ae as BaseElementBlock, $ as $components, aM as renderComponent, ak as setCurrentComponentIdAction, ap as setContextMenuEvent } from './BaseElement-wyA58UxT.js';
2
+ import { css, nothing, html } from 'lit';
3
+ import { property, state, customElement } from 'lit/decorators.js';
4
+ import { styleMap } from 'lit/directives/style-map.js';
5
+ import { createRef, ref } from 'lit/directives/ref.js';
6
+ import '@nuralyui/grid';
7
+
8
+ const styles = css`
9
+ :host {
10
+ display: block;
11
+ }
12
+
13
+ .grid-col {
14
+ position: relative;
15
+ box-sizing: border-box;
16
+ width: 100%;
17
+ min-height: 1px;
18
+ }
19
+
20
+ .empty-message {
21
+ display: flex;
22
+ justify-content: center;
23
+ align-items: center;
24
+ width: 100%;
25
+ min-height: 60px;
26
+ border: 1px dashed #ccc;
27
+ color: #999;
28
+ font-size: 12px;
29
+ position: relative;
30
+ background: rgba(0, 0, 0, 0.02);
31
+ }
32
+ `;
33
+
34
+ var __defProp = Object.defineProperty;
35
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
36
+ var __decorateClass = (decorators, target, key, kind) => {
37
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
38
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
39
+ if (decorator = decorators[i])
40
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
41
+ if (kind && result) __defProp(target, key, result);
42
+ return result;
43
+ };
44
+ const COL_INPUT_PROPS = ["span", "offset", "order", "pull", "push", "flex", "xs", "sm", "md", "lg", "xl", "xxl"];
45
+ let GridCol = class extends BaseElementBlock {
46
+ constructor() {
47
+ super(...arguments);
48
+ this.isViewMode = false;
49
+ this.childrenComponents = [];
50
+ this.containerRef = createRef();
51
+ }
52
+ connectedCallback() {
53
+ super.connectedCallback();
54
+ this.updateChildrenComponents();
55
+ COL_INPUT_PROPS.forEach((prop) => this.registerCallback(prop, () => this.requestUpdate()));
56
+ }
57
+ willUpdate(changedProperties) {
58
+ super.willUpdate(changedProperties);
59
+ if (changedProperties.has("component")) {
60
+ this.updateChildrenComponents();
61
+ }
62
+ }
63
+ updateChildrenComponents() {
64
+ this.childrenComponents = this.component?.childrenIds?.map((id) => {
65
+ return $components.get()[this.component?.application_id]?.find((component) => component.uuid === id);
66
+ }).filter(Boolean) ?? [];
67
+ }
68
+ /**
69
+ * Parse numeric value from input (handles string or number)
70
+ */
71
+ parseNumeric(value, defaultValue) {
72
+ if (value === void 0 || value === null || value === "") return defaultValue;
73
+ const num = Number(value);
74
+ return isNaN(num) ? defaultValue : num;
75
+ }
76
+ /**
77
+ * Parse responsive breakpoint value
78
+ * Can be a number or an object { span, offset, order, pull, push }
79
+ */
80
+ parseBreakpoint(value) {
81
+ if (value === void 0 || value === null || value === "") return void 0;
82
+ if (typeof value === "number") return value;
83
+ if (typeof value === "string" && !isNaN(Number(value))) return Number(value);
84
+ if (typeof value === "object") return value;
85
+ return void 0;
86
+ }
87
+ /**
88
+ * Get all column properties from input handlers
89
+ */
90
+ getColProps() {
91
+ const input = this.inputHandlersValue;
92
+ return {
93
+ span: this.parseNumeric(input?.span),
94
+ offset: this.parseNumeric(input?.offset, 0),
95
+ order: this.parseNumeric(input?.order),
96
+ pull: this.parseNumeric(input?.pull, 0),
97
+ push: this.parseNumeric(input?.push, 0),
98
+ flex: input?.flex || "",
99
+ xs: this.parseBreakpoint(input?.xs),
100
+ sm: this.parseBreakpoint(input?.sm),
101
+ md: this.parseBreakpoint(input?.md),
102
+ lg: this.parseBreakpoint(input?.lg),
103
+ xl: this.parseBreakpoint(input?.xl),
104
+ xxl: this.parseBreakpoint(input?.xxl)
105
+ };
106
+ }
107
+ /**
108
+ * Render children components
109
+ */
110
+ renderChildren() {
111
+ return this.childrenComponents.length ? renderComponent(
112
+ this.childrenComponents.map((component) => ({ ...component, item: this.item })),
113
+ this.item,
114
+ this.isViewMode,
115
+ { ...this.component, uniqueUUID: this.uniqueUUID }
116
+ ) : nothing;
117
+ }
118
+ /**
119
+ * Render empty state placeholder for editor mode
120
+ */
121
+ renderEmptyState() {
122
+ return html`
123
+ <div
124
+ class="empty-message"
125
+ @click="${() => setCurrentComponentIdAction(this.component?.uuid)}"
126
+ >
127
+ Drop content here
128
+ <drag-wrapper
129
+ .where=${"inside"}
130
+ .message=${"Drop inside"}
131
+ .component=${{ ...this.component }}
132
+ .inputRef=${this.inputRef}
133
+ .isDragInitiator=${this.isDragInitiator}
134
+ >
135
+ </drag-wrapper>
136
+ </div>
137
+ `;
138
+ }
139
+ renderComponent() {
140
+ const props = this.getColProps();
141
+ if (this.isViewMode) {
142
+ return html`
143
+ <nr-col
144
+ ${ref(this.inputRef)}
145
+ data-component-uuid=${this.component?.uuid}
146
+ data-component-name=${this.component?.name}
147
+ style=${styleMap(this.getStyles())}
148
+ span=${props.span ?? nothing}
149
+ offset=${props.offset}
150
+ order=${props.order ?? nothing}
151
+ pull=${props.pull}
152
+ push=${props.push}
153
+ flex=${props.flex || nothing}
154
+ .xs=${props.xs}
155
+ .sm=${props.sm}
156
+ .md=${props.md}
157
+ .lg=${props.lg}
158
+ .xl=${props.xl}
159
+ .xxl=${props.xxl}
160
+ >
161
+ ${this.renderChildren()}
162
+ </nr-col>
163
+ `;
164
+ }
165
+ return html`
166
+ <nr-col
167
+ ${ref(this.inputRef)}
168
+ ${ref(this.containerRef)}
169
+ data-component-uuid=${this.component?.uuid}
170
+ data-component-name=${this.component?.name}
171
+ @click="${(e) => {
172
+ setContextMenuEvent(null);
173
+ this.executeEvent("onClick", e);
174
+ }}"
175
+ style=${styleMap({
176
+ ...this.getStyles(),
177
+ "min-height": this.childrenComponents.length ? "auto" : "60px"
178
+ })}
179
+ span=${props.span ?? nothing}
180
+ offset=${props.offset}
181
+ order=${props.order ?? nothing}
182
+ pull=${props.pull}
183
+ push=${props.push}
184
+ flex=${props.flex || nothing}
185
+ .xs=${props.xs}
186
+ .sm=${props.sm}
187
+ .md=${props.md}
188
+ .lg=${props.lg}
189
+ .xl=${props.xl}
190
+ .xxl=${props.xxl}
191
+ >
192
+ ${this.childrenComponents.length ? this.renderChildren() : this.renderEmptyState()}
193
+ </nr-col>
194
+ `;
195
+ }
196
+ };
197
+ GridCol.styles = styles;
198
+ __decorateClass([
199
+ property({ type: Object })
200
+ ], GridCol.prototype, "component", 2);
201
+ __decorateClass([
202
+ property({ type: Object })
203
+ ], GridCol.prototype, "item", 2);
204
+ __decorateClass([
205
+ property({ type: Boolean })
206
+ ], GridCol.prototype, "isViewMode", 2);
207
+ __decorateClass([
208
+ state()
209
+ ], GridCol.prototype, "childrenComponents", 2);
210
+ __decorateClass([
211
+ state()
212
+ ], GridCol.prototype, "containerRef", 2);
213
+ GridCol = __decorateClass([
214
+ customElement("grid-col-block")
215
+ ], GridCol);
216
+
217
+ export { GridCol };
@@ -0,0 +1,193 @@
1
+ import { i as f, B as x, e as $, $ as g, r as C, A as i, s as y, b as a, n as c, o as m, a as b, c as d, d as u, t as N } from "./micro-app-entry-BgDXbkmh.js";
2
+ import "@nuralyui/grid";
3
+ const w = f`
4
+ :host {
5
+ display: block;
6
+ }
7
+
8
+ .grid-col {
9
+ position: relative;
10
+ box-sizing: border-box;
11
+ width: 100%;
12
+ min-height: 1px;
13
+ }
14
+
15
+ .empty-message {
16
+ display: flex;
17
+ justify-content: center;
18
+ align-items: center;
19
+ width: 100%;
20
+ min-height: 60px;
21
+ border: 1px dashed #ccc;
22
+ color: #999;
23
+ font-size: 12px;
24
+ position: relative;
25
+ background: rgba(0, 0, 0, 0.02);
26
+ }
27
+ `;
28
+ var k = Object.defineProperty, B = Object.getOwnPropertyDescriptor, o = (e, t, r, p) => {
29
+ for (var s = p > 1 ? void 0 : p ? B(t, r) : t, l = e.length - 1, h; l >= 0; l--)
30
+ (h = e[l]) && (s = (p ? h(t, r, s) : h(s)) || s);
31
+ return p && s && k(t, r, s), s;
32
+ };
33
+ const _ = ["span", "offset", "order", "pull", "push", "flex", "xs", "sm", "md", "lg", "xl", "xxl"];
34
+ let n = class extends x {
35
+ constructor() {
36
+ super(...arguments), this.isViewMode = !1, this.childrenComponents = [], this.containerRef = $();
37
+ }
38
+ connectedCallback() {
39
+ super.connectedCallback(), this.updateChildrenComponents(), _.forEach((e) => this.registerCallback(e, () => this.requestUpdate()));
40
+ }
41
+ willUpdate(e) {
42
+ super.willUpdate(e), e.has("component") && this.updateChildrenComponents();
43
+ }
44
+ updateChildrenComponents() {
45
+ this.childrenComponents = this.component?.childrenIds?.map((e) => g.get()[this.component?.application_id]?.find((t) => t.uuid === e)).filter(Boolean) ?? [];
46
+ }
47
+ /**
48
+ * Parse numeric value from input (handles string or number)
49
+ */
50
+ parseNumeric(e, t) {
51
+ if (e == null || e === "") return t;
52
+ const r = Number(e);
53
+ return isNaN(r) ? t : r;
54
+ }
55
+ /**
56
+ * Parse responsive breakpoint value
57
+ * Can be a number or an object { span, offset, order, pull, push }
58
+ */
59
+ parseBreakpoint(e) {
60
+ if (!(e == null || e === "")) {
61
+ if (typeof e == "number") return e;
62
+ if (typeof e == "string" && !isNaN(Number(e))) return Number(e);
63
+ if (typeof e == "object") return e;
64
+ }
65
+ }
66
+ /**
67
+ * Get all column properties from input handlers
68
+ */
69
+ getColProps() {
70
+ const e = this.inputHandlersValue;
71
+ return {
72
+ span: this.parseNumeric(e?.span),
73
+ offset: this.parseNumeric(e?.offset, 0),
74
+ order: this.parseNumeric(e?.order),
75
+ pull: this.parseNumeric(e?.pull, 0),
76
+ push: this.parseNumeric(e?.push, 0),
77
+ flex: e?.flex || "",
78
+ xs: this.parseBreakpoint(e?.xs),
79
+ sm: this.parseBreakpoint(e?.sm),
80
+ md: this.parseBreakpoint(e?.md),
81
+ lg: this.parseBreakpoint(e?.lg),
82
+ xl: this.parseBreakpoint(e?.xl),
83
+ xxl: this.parseBreakpoint(e?.xxl)
84
+ };
85
+ }
86
+ /**
87
+ * Render children components
88
+ */
89
+ renderChildren() {
90
+ return this.childrenComponents.length ? C(
91
+ this.childrenComponents.map((e) => ({ ...e, item: this.item })),
92
+ this.item,
93
+ this.isViewMode,
94
+ { ...this.component, uniqueUUID: this.uniqueUUID }
95
+ ) : i;
96
+ }
97
+ /**
98
+ * Render empty state placeholder for editor mode
99
+ */
100
+ renderEmptyState() {
101
+ return a`
102
+ <div
103
+ class="empty-message"
104
+ @click="${() => y(this.component?.uuid)}"
105
+ >
106
+ Drop content here
107
+ <drag-wrapper
108
+ .where=${"inside"}
109
+ .message=${"Drop inside"}
110
+ .component=${{ ...this.component }}
111
+ .inputRef=${this.inputRef}
112
+ .isDragInitiator=${this.isDragInitiator}
113
+ >
114
+ </drag-wrapper>
115
+ </div>
116
+ `;
117
+ }
118
+ renderComponent() {
119
+ const e = this.getColProps();
120
+ return this.isViewMode ? a`
121
+ <nr-col
122
+ ${c(this.inputRef)}
123
+ data-component-uuid=${this.component?.uuid}
124
+ data-component-name=${this.component?.name}
125
+ style=${m(this.getStyles())}
126
+ span=${e.span ?? i}
127
+ offset=${e.offset}
128
+ order=${e.order ?? i}
129
+ pull=${e.pull}
130
+ push=${e.push}
131
+ flex=${e.flex || i}
132
+ .xs=${e.xs}
133
+ .sm=${e.sm}
134
+ .md=${e.md}
135
+ .lg=${e.lg}
136
+ .xl=${e.xl}
137
+ .xxl=${e.xxl}
138
+ >
139
+ ${this.renderChildren()}
140
+ </nr-col>
141
+ ` : a`
142
+ <nr-col
143
+ ${c(this.inputRef)}
144
+ ${c(this.containerRef)}
145
+ data-component-uuid=${this.component?.uuid}
146
+ data-component-name=${this.component?.name}
147
+ @click="${(t) => {
148
+ b(null), this.executeEvent("onClick", t);
149
+ }}"
150
+ style=${m({
151
+ ...this.getStyles(),
152
+ "min-height": this.childrenComponents.length ? "auto" : "60px"
153
+ })}
154
+ span=${e.span ?? i}
155
+ offset=${e.offset}
156
+ order=${e.order ?? i}
157
+ pull=${e.pull}
158
+ push=${e.push}
159
+ flex=${e.flex || i}
160
+ .xs=${e.xs}
161
+ .sm=${e.sm}
162
+ .md=${e.md}
163
+ .lg=${e.lg}
164
+ .xl=${e.xl}
165
+ .xxl=${e.xxl}
166
+ >
167
+ ${this.childrenComponents.length ? this.renderChildren() : this.renderEmptyState()}
168
+ </nr-col>
169
+ `;
170
+ }
171
+ };
172
+ n.styles = w;
173
+ o([
174
+ d({ type: Object })
175
+ ], n.prototype, "component", 2);
176
+ o([
177
+ d({ type: Object })
178
+ ], n.prototype, "item", 2);
179
+ o([
180
+ d({ type: Boolean })
181
+ ], n.prototype, "isViewMode", 2);
182
+ o([
183
+ u()
184
+ ], n.prototype, "childrenComponents", 2);
185
+ o([
186
+ u()
187
+ ], n.prototype, "containerRef", 2);
188
+ n = o([
189
+ N("grid-col-block")
190
+ ], n);
191
+ export {
192
+ n as GridCol
193
+ };
@@ -0,0 +1,74 @@
1
+ import { B as d, f as h, o as u, A as m, b as c, r as f, d as l, t as C } from "./micro-app-entry-BgDXbkmh.js";
2
+ var g = Object.defineProperty, y = Object.getOwnPropertyDescriptor, r = (t, e, n, i) => {
3
+ for (var o = i > 1 ? void 0 : i ? y(e, n) : e, p = t.length - 1, a; p >= 0; p--)
4
+ (a = t[p]) && (o = (i ? a(e, n, o) : a(o)) || o);
5
+ return i && o && g(e, n, o), o;
6
+ };
7
+ try {
8
+ await import("@nuralyui/collapse");
9
+ } catch {
10
+ console.warn("[@nuralyui/collapse] Package not found or failed to load. Collapse functionality may be limited.");
11
+ }
12
+ let s = class extends d {
13
+ constructor() {
14
+ super(), this.sections = [], this.openStates = [], this.componentsWithChildren = [], this.registerCallback("components", () => {
15
+ this.updateComponents();
16
+ });
17
+ }
18
+ updated(t) {
19
+ super.updated(t), t.has("component") && this.updateComponents();
20
+ }
21
+ firstUpdated(t) {
22
+ super.firstUpdated(t);
23
+ const e = this.component.application_id;
24
+ this.componentsWithChildren = h(e).get();
25
+ }
26
+ updateComponents() {
27
+ this.sections = this.generateSection();
28
+ }
29
+ render() {
30
+ return c`
31
+ <nr-collapse
32
+ style=${u(this.component.style)}
33
+ .sections=${[...this.sections]}
34
+ .size=${this.inputHandlersValue?.size ?? m}
35
+ @section-toggled=${this.handleSectionToggled}
36
+ ></nr-collapse>
37
+ `;
38
+ }
39
+ handleSectionToggled(t) {
40
+ const e = t.detail.index;
41
+ this.openStates[e] = !this.openStates[e], this.sections[e].open = this.openStates[e], this.requestUpdate();
42
+ }
43
+ generateComponent(t) {
44
+ const e = this.componentsWithChildren.filter(
45
+ (n) => t === n.uuid
46
+ );
47
+ return f(e, null, !0);
48
+ }
49
+ generateSection() {
50
+ const t = this.inputHandlersValue?.components;
51
+ return !t || !Array.isArray(t) ? [] : t.map(
52
+ (e, n) => ({
53
+ header: e.label,
54
+ content: c`<div>${this.generateComponent(e.blockName)}</div>`,
55
+ open: this.openStates[n] ?? e.open
56
+ })
57
+ );
58
+ }
59
+ };
60
+ r([
61
+ l()
62
+ ], s.prototype, "sections", 2);
63
+ r([
64
+ l()
65
+ ], s.prototype, "openStates", 2);
66
+ r([
67
+ l()
68
+ ], s.prototype, "componentsWithChildren", 2);
69
+ s = r([
70
+ C("collapse-block")
71
+ ], s);
72
+ export {
73
+ s as Collapse
74
+ };
@@ -0,0 +1,96 @@
1
+ import { nothing, html } from 'lit';
2
+ import { ae as BaseElementBlock, w as $applicationComponents, aM as renderComponent } from './BaseElement-wyA58UxT.js';
3
+ import { state, customElement } from 'lit/decorators.js';
4
+ import { styleMap } from 'lit/directives/style-map.js';
5
+
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __decorateClass = (decorators, target, key, kind) => {
9
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
10
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11
+ if (decorator = decorators[i])
12
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
13
+ if (kind && result) __defProp(target, key, result);
14
+ return result;
15
+ };
16
+ try {
17
+ await import('@nuralyui/collapse');
18
+ } catch (error) {
19
+ console.warn("[@nuralyui/collapse] Package not found or failed to load. Collapse functionality may be limited.");
20
+ }
21
+ let Collapse = class extends BaseElementBlock {
22
+ constructor() {
23
+ super();
24
+ this.sections = [];
25
+ this.openStates = [];
26
+ this.componentsWithChildren = [];
27
+ this.registerCallback("components", () => {
28
+ this.updateComponents();
29
+ });
30
+ }
31
+ updated(changedProperties) {
32
+ super.updated(changedProperties);
33
+ if (changedProperties.has("component")) {
34
+ this.updateComponents();
35
+ }
36
+ }
37
+ firstUpdated(_changedProperties) {
38
+ super.firstUpdated(_changedProperties);
39
+ const application_id = this.component.application_id;
40
+ this.componentsWithChildren = $applicationComponents(application_id).get();
41
+ }
42
+ updateComponents() {
43
+ this.sections = this.generateSection();
44
+ }
45
+ render() {
46
+ return html`
47
+ <nr-collapse
48
+ style=${styleMap(this.component.style)}
49
+ .sections=${[...this.sections]}
50
+ .size=${this.inputHandlersValue?.size ?? nothing}
51
+ @section-toggled=${this.handleSectionToggled}
52
+ ></nr-collapse>
53
+ `;
54
+ }
55
+ handleSectionToggled(e) {
56
+ const index = e.detail.index;
57
+ this.openStates[index] = !this.openStates[index];
58
+ this.sections[index].open = this.openStates[index];
59
+ this.requestUpdate();
60
+ }
61
+ generateComponent(blockName) {
62
+ const children = this.componentsWithChildren.filter(
63
+ (component) => blockName === component.uuid
64
+ );
65
+ return renderComponent(children, null, true);
66
+ }
67
+ generateSection() {
68
+ const components = this.inputHandlersValue?.components;
69
+ if (!components || !Array.isArray(components)) {
70
+ return [];
71
+ }
72
+ return components.map(
73
+ (section, index) => {
74
+ return {
75
+ header: section.label,
76
+ content: html`<div>${this.generateComponent(section.blockName)}</div>`,
77
+ open: this.openStates[index] ?? section.open
78
+ };
79
+ }
80
+ );
81
+ }
82
+ };
83
+ __decorateClass([
84
+ state()
85
+ ], Collapse.prototype, "sections", 2);
86
+ __decorateClass([
87
+ state()
88
+ ], Collapse.prototype, "openStates", 2);
89
+ __decorateClass([
90
+ state()
91
+ ], Collapse.prototype, "componentsWithChildren", 2);
92
+ Collapse = __decorateClass([
93
+ customElement("collapse-block")
94
+ ], Collapse);
95
+
96
+ export { Collapse };