@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,217 @@
1
+ import { ae as BaseElementBlock, $ as $components, aM as renderComponent, ak as setCurrentComponentIdAction, ap as setContextMenuEvent } from './BaseElement-pS6m_x6Q.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-DiNqE6xi.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-DiNqE6xi.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-pS6m_x6Q.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 };
@@ -0,0 +1,122 @@
1
+ import { i as u, B as m, e as C, h as g, j as v, $ as f, a as w, p as y, s as x, n as h, r as $, b as a, o as b, g as _, c as d, d as l, t as D } from "./micro-app-entry-DiNqE6xi.js";
2
+ const V = u`
3
+ .collection_viewer {
4
+ --columns: 1;
5
+ min-width: 200px;
6
+ max-height: 400px;
7
+ display: flex;
8
+ flex-wrap: wrap; /* Allows items to wrap into new rows */
9
+ }
10
+
11
+ .vertical {
12
+ flex-direction: column;
13
+ flex-wrap: nowrap
14
+
15
+ }
16
+
17
+ .collection{
18
+ flex: 0 0 calc(100% / var(--columns) - 10px); /* Fixed width */
19
+ }
20
+ `;
21
+ var A = Object.defineProperty, I = Object.getOwnPropertyDescriptor, o = (e, t, i, s) => {
22
+ for (var r = s > 1 ? void 0 : s ? I(t, i) : t, p = e.length - 1, c; p >= 0; p--)
23
+ (c = e[p]) && (r = (s ? c(t, i, r) : c(r)) || r);
24
+ return s && r && A(t, i, r), r;
25
+ };
26
+ let n = class extends m {
27
+ constructor() {
28
+ super(...arguments), this.isViewMode = !1, this.dropDragPalceHolderStyle = {
29
+ display: "none",
30
+ height: "auto",
31
+ width: "auto",
32
+ minWidth: "80px",
33
+ backgroundColor: "rgb(202 235 255)",
34
+ zIndex: "7",
35
+ borderRadius: "2px"
36
+ }, this.childrenComponents = [], this.containerRef = C();
37
+ }
38
+ connectedCallback() {
39
+ super.connectedCallback(), this.updateChildrenComponents(), this.component?.event?.onInit && g(
40
+ this.component,
41
+ v(this.component, "event.onInit")
42
+ );
43
+ }
44
+ updated(e) {
45
+ e.has("component") && this.updateChildrenComponents();
46
+ }
47
+ updateChildrenComponents() {
48
+ const e = f.get()[this.component?.application_id];
49
+ if (!e || !this.component?.childrenIds?.length) {
50
+ this.childrenComponents = [];
51
+ return;
52
+ }
53
+ this.childrenComponents = this.component.childrenIds.map((t) => e.find((i) => i.uuid === t)).filter(Boolean);
54
+ }
55
+ handleCollectionClick(e) {
56
+ w(null), !y.get() && (x(this.component?.uuid), e.preventDefault(), e.stopPropagation());
57
+ }
58
+ renderRow(e) {
59
+ return a`
60
+ <div class="collection" ${h(this.containerRef)}
61
+ @click="${(t) => this.handleCollectionClick(t)}">
62
+ ${this.childrenComponents.length ? a`${$(
63
+ this.childrenComponents.map((t) => ({ ...t, item: e })),
64
+ e,
65
+ this.isViewMode
66
+ )}` : a`<div class="empty-message">Add or Drag an item into this collection</div>`}
67
+ </div>`;
68
+ }
69
+ getData() {
70
+ return Array.isArray(this.inputHandlersValue.data) ? this.inputHandlersValue.data : this.component.input?.data ? [] : [
71
+ { title: "Function 1" },
72
+ { title: "Function 2" },
73
+ { title: "Function 3" }
74
+ ];
75
+ }
76
+ renderComponent() {
77
+ const e = this.inputHandlersValue.direction?.value === "vertical", t = this.getData();
78
+ return a`
79
+ <div
80
+ ${h(this.inputRef)}
81
+ style=${b(this.getStyles())}
82
+ class=${_({
83
+ collection_viewer: !0,
84
+ vertical: e
85
+ })}
86
+ >
87
+ ${t.map((i, s) => this.renderRow({ ...i, index: s }))}
88
+ </div>
89
+ `;
90
+ }
91
+ };
92
+ n.styles = V;
93
+ o([
94
+ d({ type: Object })
95
+ ], n.prototype, "component", 2);
96
+ o([
97
+ d({ type: Boolean })
98
+ ], n.prototype, "isViewMode", 2);
99
+ o([
100
+ d({ type: String })
101
+ ], n.prototype, "mode", 2);
102
+ o([
103
+ l()
104
+ ], n.prototype, "hoveredComponent", 2);
105
+ o([
106
+ l()
107
+ ], n.prototype, "currentEditingApplication", 2);
108
+ o([
109
+ l()
110
+ ], n.prototype, "draggingComponentInfo", 2);
111
+ o([
112
+ l()
113
+ ], n.prototype, "dropDragPalceHolderStyle", 2);
114
+ o([
115
+ l()
116
+ ], n.prototype, "childrenComponents", 2);
117
+ n = o([
118
+ D("collection-viewer")
119
+ ], n);
120
+ export {
121
+ n as CollectionViewer
122
+ };