@bravostudioai/react 0.1.14 → 0.1.16

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.
@@ -1,231 +1,237 @@
1
- import { sanitizePropName as l, getComponentPropType as G, getComponentPropName as W } from "./parser.js";
2
- function K(U, I, y, b, m, c, g, P, h, d = !1) {
3
- const E = [], N = [], a = [], r = [], u = [], k = [];
4
- m.forEach((o) => {
5
- E.push(` ${o.propName}?: ${o.propType};`);
1
+ import { sanitizePropName as m, getComponentPropType as W, getComponentPropName as R } from "./parser.js";
2
+ function K(k, x, P, E, u, c, N, v, l, d = !1, I) {
3
+ const y = [], a = [], p = [], f = [], D = [], A = [];
4
+ u.forEach((o) => {
5
+ y.push(` ${o.propName}?: ${o.propType};`);
6
6
  }), c.forEach((o) => {
7
- const n = l(o.groupName);
8
- a.push(` ${n}?: string;`), a.push(
7
+ const n = m(o.groupName);
8
+ p.push(` ${n}?: string;`), p.push(
9
9
  ` on${n[0].toUpperCase()}${n.slice(
10
10
  1
11
11
  )}Change?: (value: string) => void;`
12
12
  );
13
13
  });
14
- const A = [];
15
- g.forEach((o) => {
16
- const n = l(o.formName), p = `${n[0].toUpperCase()}${n.slice(
14
+ const w = [];
15
+ N.forEach((o) => {
16
+ const n = m(o.formName), s = `${n[0].toUpperCase()}${n.slice(
17
17
  1
18
- )}FormData`, s = [];
18
+ )}FormData`, r = [];
19
19
  o.inputs.forEach(($) => {
20
- const S = $.propName, v = G($.type, $.name);
21
- s.push(` ${S}: ${v};`);
22
- }), A.push(`export interface ${p} {
23
- ${s.join(`
20
+ const T = $.propName, b = W($.type, $.name);
21
+ r.push(` ${T}: ${b};`);
22
+ }), w.push(`export interface ${s} {
23
+ ${r.join(`
24
24
  `)}
25
- }`), r.push(
25
+ }`), f.push(
26
26
  ` on${n[0].toUpperCase()}${n.slice(
27
27
  1
28
- )}Submit?: (formData: ${p}) => void;`
28
+ )}Submit?: (formData: ${s}) => void;`
29
29
  );
30
- }), P.forEach((o) => {
31
- const n = o.propName, p = n[0].toUpperCase() + n.slice(1);
32
- u.push(` ${n}?: string;`), u.push(
30
+ }), v.forEach((o) => {
31
+ const n = o.propName, s = n[0].toUpperCase() + n.slice(1);
32
+ D.push(` ${n}?: string;`), D.push(
33
33
  ` ${n}Options?: Array<string | { value: string; label: string }>;`
34
- ), u.push(
35
- ` on${p}Change?: (value: string) => void;`
34
+ ), D.push(
35
+ ` on${s}Change?: (value: string) => void;`
36
36
  );
37
- }), h.forEach((o) => {
38
- const n = o.propName, p = n[0].toUpperCase() + n.slice(1);
39
- k.push(` on${p}Click?: () => void;`);
40
- }), b.forEach((o) => {
37
+ }), l.forEach((o) => {
38
+ const n = o.propName, s = n[0].toUpperCase() + n.slice(1);
39
+ A.push(` on${s}Click?: () => void;`);
40
+ }), E.forEach((o) => {
41
41
  if (o.arrayContainer && o.arrayContainer.components.length > 0) {
42
- const p = o.arrayContainer, s = `${p.propName[0].toUpperCase()}${p.propName.slice(
42
+ const s = o.arrayContainer, r = `${s.propName[0].toUpperCase()}${s.propName.slice(
43
43
  1
44
44
  )}Item`;
45
- E.push(` ${p.propName}: ${s}[];`);
45
+ y.push(` ${s.propName}: ${r}[];`);
46
46
  }
47
- const n = l(o.name || "container");
48
- N.push(` ${n}CurrentIndex?: number;`), N.push(
47
+ const n = m(o.name || "container");
48
+ a.push(` ${n}CurrentIndex?: number;`), a.push(
49
49
  ` on${n[0].toUpperCase()}${n.slice(
50
50
  1
51
51
  )}IndexChange?: (index: number) => void;`
52
52
  );
53
53
  });
54
- const x = [
55
- ...E,
56
- ...N,
54
+ const z = [
55
+ ...y,
57
56
  ...a,
58
- ...r,
59
- ...u,
60
- ...k
61
- ], z = x.length > 0, D = z ? `export interface ${y}Props {
62
- ${x.join(`
57
+ ...p,
58
+ ...f,
59
+ ...D,
60
+ ...A
61
+ ], j = z.length > 0, O = j ? `export interface ${P}Props {
62
+ ${z.join(`
63
63
  `)}
64
- }` : "", O = b.filter((o) => o.arrayContainer && o.arrayContainer.components.length > 0).map((o) => {
65
- const n = o.arrayContainer, p = `${n.propName[0].toUpperCase()}${n.propName.slice(
64
+ }` : "", M = E.filter((o) => o.arrayContainer && o.arrayContainer.components.length > 0).map((o) => {
65
+ const n = o.arrayContainer, s = `${n.propName[0].toUpperCase()}${n.propName.slice(
66
66
  1
67
- )}Item`, s = n.components.map(($) => ` ${$.propName}: ${$.propType};`).join(`
67
+ )}Item`, r = n.components.map(($) => ` ${$.propName}: ${$.propType};`).join(`
68
68
  `);
69
- return `export interface ${p} {
70
- ${s}
69
+ return `export interface ${s} {
70
+ ${r}
71
71
  }`;
72
72
  }).join(`
73
73
 
74
- `), M = A.join(`
74
+ `), F = w.join(`
75
75
 
76
- `), j = [], T = [];
77
- m.forEach((o) => {
78
- const n = W(o.type);
79
- j.push(` // ${o.name}
76
+ `), S = [], U = [];
77
+ u.forEach((o) => {
78
+ const n = R(o.type);
79
+ S.push(` // ${o.name}
80
80
  ...(props.${o.propName} !== undefined && { "${o.id}": { ${n}: props.${o.propName} } as any }),`);
81
- }), P.forEach((o) => {
82
- j.push(` // ${o.name}
81
+ }), v.forEach((o) => {
82
+ S.push(` // ${o.name}
83
83
  ...((props.${o.propName} !== undefined || props.${o.propName}Options !== undefined) && {
84
84
  "${o.id}": {
85
85
  ...(props.${o.propName} !== undefined && { value: props.${o.propName} }),
86
86
  ...(props.${o.propName}Options !== undefined && { options: props.${o.propName}Options }),
87
87
  } as any
88
88
  }),`);
89
- }), b.forEach((o) => {
89
+ }), E.forEach((o) => {
90
90
  if (o.arrayContainer && o.arrayContainer.components.length > 0) {
91
- const $ = o.arrayContainer, S = $.components.map((v) => {
92
- const B = W(v.type);
93
- return ` // ${v.name}
94
- "${v.id}": {
95
- ${B}: item.${v.propName},
91
+ const $ = o.arrayContainer, T = $.components.map((b) => {
92
+ const G = R(b.type);
93
+ return ` // ${b.name}
94
+ "${b.id}": {
95
+ ${G}: item.${b.propName},
96
96
  }`;
97
97
  }).join(`,
98
98
  `);
99
- j.push(` // ${$.name}
99
+ S.push(` // ${$.name}
100
100
  "${$.id}": props.${$.propName}.map((item) => ({
101
- ${S}
101
+ ${T}
102
102
  })),`);
103
103
  }
104
- const n = l(o.name || "container"), p = `${n[0].toUpperCase()}${n.slice(
104
+ const n = m(o.name || "container"), s = `${n[0].toUpperCase()}${n.slice(
105
105
  1
106
- )}IndexChange`, s = [];
107
- o.id && (s.push(` // ${o.name}`), s.push(` "${o.id}": {`), s.push(
106
+ )}IndexChange`, r = [];
107
+ o.id && (r.push(` // ${o.name}`), r.push(` "${o.id}": {`), r.push(
108
108
  ` currentIndex: props.${n}CurrentIndex,`
109
- ), s.push(` onIndexChange: props.on${p},`), s.push(" }")), s.length > 0 && T.push(s.join(`
109
+ ), r.push(` onIndexChange: props.on${s},`), r.push(" }")), r.length > 0 && U.push(r.join(`
110
110
  `));
111
111
  });
112
- const F = T.length > 0 ? `
112
+ const B = U.length > 0 ? `
113
113
  repeatingContainerControls={{
114
- ${T.join(`,
114
+ ${U.join(`,
115
115
  `)}
116
- }}` : "", w = [], e = [];
117
- (c.length > 0 || g.length > 0 || P.length > 0 || h.length > 0) && (e.push(" const handleAction = (payload: any) => {"), e.push(" const { action } = payload?.bravo || {};"), e.push(""), P.length > 0 && (e.push(" // Handle select input changes"), e.push(
116
+ }}` : "", t = [], e = [];
117
+ (c.length > 0 || N.length > 0 || v.length > 0 || l.length > 0) && (e.push(" const handleAction = (payload: any) => {"), e.push(" const { action } = payload?.bravo || {};"), e.push(""), v.length > 0 && (e.push(" // Handle select input changes"), e.push(
118
118
  ' if (action?.action === "input-change" || action?.action === "select-change") {'
119
- ), e.push(" const nodeId = action?.nodeId;"), e.push(" const value = action?.params?.value;"), e.push(""), P.forEach((o) => {
120
- const n = o.propName, s = `on${n[0].toUpperCase() + n.slice(1)}Change`;
119
+ ), e.push(" const nodeId = action?.nodeId;"), e.push(" const value = action?.params?.value;"), e.push(""), v.forEach((o) => {
120
+ const n = o.propName, r = `on${n[0].toUpperCase() + n.slice(1)}Change`;
121
121
  e.push(` // ${o.name}`), e.push(
122
- ` if (nodeId === "${o.id}" && props.${s}) {`
123
- ), e.push(` props.${s}(value);`), e.push(" return;"), e.push(" }");
124
- }), e.push(" }"), e.push("")), h.length > 0 && (e.push(" // Handle button clicks"), e.push(
122
+ ` if (nodeId === "${o.id}" && props.${r}) {`
123
+ ), e.push(` props.${r}(value);`), e.push(" return;"), e.push(" }");
124
+ }), e.push(" }"), e.push("")), l.length > 0 && (e.push(" // Handle button clicks"), e.push(
125
125
  ' if (action?.action === "remote" || action?.action === "tap" || action?.action === "link") {'
126
- ), e.push(" const nodeId = action?.nodeId;"), e.push(""), h.forEach((o) => {
127
- const n = o.propName, s = `on${n[0].toUpperCase() + n.slice(1)}Click`;
126
+ ), e.push(" const nodeId = action?.nodeId;"), e.push(""), l.forEach((o) => {
127
+ const n = o.propName, r = `on${n[0].toUpperCase() + n.slice(1)}Click`;
128
128
  e.push(` // ${o.name}`), e.push(
129
- ` if (nodeId === "${o.id}" && props.${s}) {`
130
- ), e.push(` props.${s}();`), e.push(" return;"), e.push(" }");
129
+ ` if (nodeId === "${o.id}" && props.${r}) {`
130
+ ), e.push(` props.${r}();`), e.push(" return;"), e.push(" }");
131
131
  }), e.push(" }"), e.push("")), c.length > 0 && (e.push(
132
132
  ' if (action?.action === "input-group-change") {'
133
133
  ), e.push(
134
134
  " const { groupName, value } = action.params;"
135
135
  ), c.forEach((o) => {
136
- const n = l(o.groupName), p = `on${n[0].toUpperCase()}${n.slice(
136
+ const n = m(o.groupName), s = `on${n[0].toUpperCase()}${n.slice(
137
137
  1
138
138
  )}Change`;
139
139
  e.push(
140
- ` if (groupName === "${o.groupName}" && props.${p}) {`
141
- ), e.push(` props.${p}(value);`), e.push(" return;"), e.push(" }");
142
- }), e.push(" }"), e.push("")), g.length > 0 && (e.push(' if (action?.action === "submit") {'), e.push(" // Get form inputs from Encore state"), e.push(
143
- ` const formInputs = useEncoreState.getState().formInputs["${I}"] || {};`
144
- ), e.push(" const submitNodeId = action?.nodeId;"), e.push(""), g.forEach((o, n) => {
145
- const p = l(o.formName), s = `on${p[0].toUpperCase()}${p.slice(
140
+ ` if (groupName === "${o.groupName}" && props.${s}) {`
141
+ ), e.push(` props.${s}(value);`), e.push(" return;"), e.push(" }");
142
+ }), e.push(" }"), e.push("")), N.length > 0 && (e.push(' if (action?.action === "submit") {'), e.push(" // Get form inputs from Encore state"), e.push(
143
+ ` const formInputs = useEncoreState.getState().formInputs["${x}"] || {};`
144
+ ), e.push(" const submitNodeId = action?.nodeId;"), e.push(""), N.forEach((o, n) => {
145
+ const s = m(o.formName), r = `on${s[0].toUpperCase()}${s.slice(
146
146
  1
147
147
  )}Submit`;
148
148
  n > 0 && e.push(""), e.push(
149
149
  ` // Form: ${o.formName} (${o.formId})`
150
150
  ), o.submitButtonId ? e.push(
151
- ` if (submitNodeId === "${o.submitButtonId}" && props.${s}) {`
152
- ) : g.length === 1 ? e.push(` if (props.${s}) {`) : e.push(` if (props.${s}) {`), e.push(" // Extract form inputs for this form");
153
- const $ = `${p[0].toUpperCase()}${p.slice(
151
+ ` if (submitNodeId === "${o.submitButtonId}" && props.${r}) {`
152
+ ) : N.length === 1 ? e.push(` if (props.${r}) {`) : e.push(` if (props.${r}) {`), e.push(" // Extract form inputs for this form");
153
+ const $ = `${s[0].toUpperCase()}${s.slice(
154
154
  1
155
155
  )}FormData`;
156
156
  e.push(
157
157
  ` const formData: ${$} = {`
158
158
  );
159
- const S = [];
160
- o.inputs.forEach((v) => {
161
- const B = v.propName;
162
- S.push(
163
- ` ${B}: formInputs["${v.id}"]`
159
+ const T = [];
160
+ o.inputs.forEach((b) => {
161
+ const G = b.propName;
162
+ T.push(
163
+ ` ${G}: formInputs["${b.id}"]`
164
164
  );
165
- }), e.push(S.join(`,
166
- `)), e.push(" };"), e.push(` props.${s}(formData);`), e.push(
165
+ }), e.push(T.join(`,
166
+ `)), e.push(" };"), e.push(` props.${r}(formData);`), e.push(
167
167
  " // Note: Default form submission will still proceed after callback"
168
168
  ), e.push(" }");
169
169
  }), e.push(" }")), e.push(" };")), c.forEach((o) => {
170
- const n = l(o.groupName);
171
- w.push(
170
+ const n = m(o.groupName);
171
+ t.push(
172
172
  ` ...(props.${n} !== undefined && { ${n}: props.${n} }),`
173
173
  );
174
174
  });
175
- const t = w.length > 0 ? `
175
+ const C = t.length > 0 ? `
176
176
  inputGroups={{
177
- ${w.join(`
177
+ ${t.join(`
178
178
  `)}
179
- }}` : "", f = e.length > 0 ? `
180
- onAction={handleAction}` : "", i = z ? `props: ${y}Props` : "", C = D ? `${D}
179
+ }}` : "", i = e.length > 0 ? `
180
+ onAction={handleAction}` : "", g = j ? `props: ${P}Props` : "", h = O ? `${O}
181
181
 
182
182
  ` : "";
183
183
  return `/**
184
- * ${y}
184
+ * ${P}
185
185
  *
186
186
  * Wrapper component for Encore Studio app.
187
187
  * See README.md for detailed documentation.
188
188
  */
189
189
 
190
- import { EncoreApp${g.length > 0 ? ", useEncoreState" : ""} } from "@bravostudioai/react";
190
+ import { EncoreApp${N.length > 0 ? ", useEncoreState" : ""} } from "@bravostudioai/react";
191
191
  ${d ? 'import productionData from "./data.json";' : ""}
192
192
 
193
- ${O ? `${O}
193
+ ${M ? `${M}
194
194
 
195
- ` : ""}${M ? `${M}
195
+ ` : ""}${F ? `${F}
196
196
 
197
- ` : ""}${C}export function ${y}(${i}) {
197
+ ` : ""}${h}export function ${P}(${g}) {
198
198
  ${e.length > 0 ? e.join(`
199
199
  `) : ""}
200
200
  return (
201
201
  <EncoreApp
202
- appId="${U}"
203
- pageId="${I}"
202
+ appId="${k}"
203
+ pageId="${x}"
204
204
  ${d ? `appDefinition={productionData.app}
205
205
  pageDefinition={productionData.page}
206
206
  componentCode={productionData.componentCode}` : ""}
207
207
  data={{
208
- ${j.join(`
208
+ ${S.join(`
209
209
  `)}
210
- }}${F}${t}${f}
210
+ }}${B}${C}${i}
211
211
  />
212
212
  );
213
213
  }
214
214
 
215
- export default ${y};
215
+ export default ${P};
216
+
217
+ export const PageMeta = {
218
+ width: ${I?.width ?? "undefined"},
219
+ height: ${I?.height ?? "undefined"},
220
+ aspectRatio: ${I?.aspectRatio ?? "undefined"},
221
+ };
216
222
  `;
217
223
  }
218
- function L(U, I, y, b, m, c, g, P, h, d, E) {
219
- const N = [], a = [], r = [], u = [];
220
- g.forEach((e) => {
221
- N.push(`### \`${e.propName}\` (${e.propType}, optional)
222
-
223
- ${e.name} (${e.type}) - Component ID: ${e.id}`);
224
- }), c.forEach((e) => {
225
- if (e.arrayContainer && e.arrayContainer.components.length > 0) {
226
- const i = e.arrayContainer, C = i.components.map((o) => `- \`${o.propName}\` (${o.propType}): ${o.name} (${o.type}) - Component ID: ${o.id}`).join(`
224
+ function L(k, x, P, E, u, c, N, v, l, d, I) {
225
+ const y = [], a = [], p = [], f = [];
226
+ N.forEach((t) => {
227
+ y.push(`### \`${t.propName}\` (${t.propType}, optional)
228
+
229
+ ${t.name} (${t.type}) - Component ID: ${t.id}`);
230
+ }), c.forEach((t) => {
231
+ if (t.arrayContainer && t.arrayContainer.components.length > 0) {
232
+ const i = t.arrayContainer, g = i.components.map((h) => `- \`${h.propName}\` (${h.propType}): ${h.name} (${h.type}) - Component ID: ${h.id}`).join(`
227
233
  `);
228
- N.push(`### \`${i.propName}\` (${i.propName[0].toUpperCase()}${i.propName.slice(
234
+ y.push(`### \`${i.propName}\` (${i.propName[0].toUpperCase()}${i.propName.slice(
229
235
  1
230
236
  )}Item[])
231
237
 
@@ -233,24 +239,24 @@ Array of items for "${i.name}" container (ID: ${i.id})
233
239
 
234
240
  **Properties:**
235
241
 
236
- ${C}`);
242
+ ${g}`);
237
243
  }
238
- const t = l(e.name || "container"), f = `${t[0].toUpperCase()}${t.slice(
244
+ const e = m(t.name || "container"), C = `${e[0].toUpperCase()}${e.slice(
239
245
  1
240
246
  )}IndexChange`;
241
- a.push(`### \`${t}CurrentIndex\` (number, optional)
247
+ a.push(`### \`${e}CurrentIndex\` (number, optional)
242
248
 
243
- Controls the currently visible slide/index for the "${e.name}" container (ID: ${e.id}).
249
+ Controls the currently visible slide/index for the "${t.name}" container (ID: ${t.id}).
244
250
 
245
251
  When provided, the slider operates in controlled mode - the parent component controls which slide is displayed. When not provided, the slider manages its own state.
246
252
 
247
- ### \`on${f}\` ((index: number) => void, optional)
253
+ ### \`on${C}\` ((index: number) => void, optional)
248
254
 
249
255
  Callback fired when the user navigates to a different slide. Called with the new slide index (0-based).
250
256
 
251
257
  This event fires whenever the slide changes, whether by user interaction, automatic advancement, or programmatic control.`);
252
258
  });
253
- const k = N.length > 0 ? N.join(`
259
+ const D = y.length > 0 ? y.join(`
254
260
 
255
261
  `) : "This component currently has no data-bound props.", A = a.length > 0 ? `## Control Props
256
262
 
@@ -258,84 +264,84 @@ These props allow you to imperatively control repeating containers (sliders, lis
258
264
 
259
265
  ${a.join(`
260
266
 
261
- `)}` : "", x = [];
262
- P.forEach((e) => {
263
- const t = l(e.groupName), f = `on${t[0].toUpperCase()}${t.slice(
267
+ `)}` : "", w = [];
268
+ v.forEach((t) => {
269
+ const e = m(t.groupName), C = `on${e[0].toUpperCase()}${e.slice(
264
270
  1
265
- )}Change`, i = e.elements.map((C) => `- "${C.name}"`).join(`
271
+ )}Change`, i = t.elements.map((g) => `- "${g.name}"`).join(`
266
272
  `);
267
- x.push(`### \`${t}\` (string, optional)
273
+ w.push(`### \`${e}\` (string, optional)
268
274
 
269
- Sets which element is active in the "${e.groupName}" input group (type: ${e.groupType}).
275
+ Sets which element is active in the "${t.groupName}" input group (type: ${t.groupType}).
270
276
 
271
277
  **Available elements:**
272
278
  ${i}
273
279
 
274
- ### \`${f}\` ((value: string) => void, optional)
280
+ ### \`${C}\` ((value: string) => void, optional)
275
281
 
276
- Callback fired when the user selects a different element in the "${e.groupName}" input group. Called with the name of the selected element.`);
282
+ Callback fired when the user selects a different element in the "${t.groupName}" input group. Called with the name of the selected element.`);
277
283
  });
278
- const z = x.length > 0 ? `## Input Group Props
284
+ const z = w.length > 0 ? `## Input Group Props
279
285
 
280
286
  These props allow you to control input groups (radio button-like behavior) and receive notifications when the selection changes.
281
287
 
282
- ${x.join(`
288
+ ${w.join(`
283
289
 
284
- `)}` : "", D = [];
285
- h.forEach((e) => {
286
- const t = l(e.formName), f = `on${t[0].toUpperCase()}${t.slice(
290
+ `)}` : "", j = [];
291
+ l.forEach((t) => {
292
+ const e = m(t.formName), C = `on${e[0].toUpperCase()}${e.slice(
287
293
  1
288
- )}Submit`, i = `${t[0].toUpperCase()}${t.slice(
294
+ )}Submit`, i = `${e[0].toUpperCase()}${e.slice(
289
295
  1
290
- )}FormData`, C = e.inputs.map((o) => {
291
- const n = o.propName, p = G(o.type, o.name);
292
- return `- \`${n}\` (${p}) - ${o.name}`;
296
+ )}FormData`, g = t.inputs.map((h) => {
297
+ const o = h.propName, n = W(h.type, h.name);
298
+ return `- \`${o}\` (${n}) - ${h.name}`;
293
299
  }).join(`
294
300
  `);
295
- D.push(`### \`${f}\` ((formData: ${i}) => void, optional)
301
+ j.push(`### \`${C}\` ((formData: ${i}) => void, optional)
296
302
 
297
- Callback fired when the "${e.formName}" form is submitted. Called with a typed object containing all form input values with human-readable property names.
303
+ Callback fired when the "${t.formName}" form is submitted. Called with a typed object containing all form input values with human-readable property names.
298
304
 
299
305
  **Form data shape:**
300
306
  \`\`\`typescript
301
307
  interface ${i} {
302
- ${e.inputs.map((o) => {
303
- const n = o.propName, p = G(o.type, o.name);
304
- return ` ${n}: ${p};`;
308
+ ${t.inputs.map((h) => {
309
+ const o = h.propName, n = W(h.type, h.name);
310
+ return ` ${o}: ${n};`;
305
311
  }).join(`
306
312
  `)}
307
313
  }
308
314
  \`\`\`
309
315
 
310
316
  **Form inputs:**
311
- ${C}`);
317
+ ${g}`);
312
318
  });
313
- const O = D.length > 0 ? `## Form Submission Props
319
+ const O = j.length > 0 ? `## Form Submission Props
314
320
 
315
321
  These props allow you to handle form submissions and access form input values.
316
322
 
317
- ${D.join(`
323
+ ${j.join(`
318
324
 
319
325
  `)}` : "";
320
- d.forEach((e) => {
321
- const t = e.propName, i = `on${t[0].toUpperCase() + t.slice(1)}Change`, C = `${t}Options`;
322
- r.push(`### \`${t}\` (string, optional)
326
+ d.forEach((t) => {
327
+ const e = t.propName, i = `on${e[0].toUpperCase() + e.slice(1)}Change`, g = `${e}Options`;
328
+ p.push(`### \`${e}\` (string, optional)
323
329
 
324
- Controls the selected value of the "${e.name}" dropdown (Component ID: ${e.id}).
330
+ Controls the selected value of the "${t.name}" dropdown (Component ID: ${t.id}).
325
331
 
326
332
  When provided, the select input operates in controlled mode - the parent component controls the current value.
327
333
 
328
- ### \`${C}\` (Array<string | { value: string; label: string }>, optional)
334
+ ### \`${g}\` (Array<string | { value: string; label: string }>, optional)
329
335
 
330
- Sets the available options for the "${e.name}" dropdown. Can be an array of strings (used as both value and label) or an array of objects with \`value\` and \`label\` properties.
336
+ Sets the available options for the "${t.name}" dropdown. Can be an array of strings (used as both value and label) or an array of objects with \`value\` and \`label\` properties.
331
337
 
332
338
  **Example:**
333
339
  \`\`\`tsx
334
340
  // Simple string array
335
- ${C}={["Option 1", "Option 2", "Option 3"]}
341
+ ${g}={["Option 1", "Option 2", "Option 3"]}
336
342
 
337
343
  // Object array with separate values and labels
338
- ${C}={[
344
+ ${g}={[
339
345
  { value: "opt1", label: "Option 1" },
340
346
  { value: "opt2", label: "Option 2" },
341
347
  ]}
@@ -343,34 +349,34 @@ ${C}={[
343
349
 
344
350
  ### \`${i}\` ((value: string) => void, optional)
345
351
 
346
- Callback fired when the user selects a different option in the "${e.name}" dropdown. Called with the selected value.`);
352
+ Callback fired when the user selects a different option in the "${t.name}" dropdown. Called with the selected value.`);
347
353
  });
348
- const M = r.length > 0 ? `## Select Input Props
354
+ const M = p.length > 0 ? `## Select Input Props
349
355
 
350
356
  These props allow you to control select/dropdown inputs and respond to value changes.
351
357
 
352
- ${r.join(`
358
+ ${p.join(`
353
359
 
354
360
  `)}` : "";
355
- E.forEach((e) => {
356
- const t = e.propName, i = `on${t[0].toUpperCase() + t.slice(1)}Click`;
357
- u.push(`### \`${i}\` (() => void, optional)
361
+ I.forEach((t) => {
362
+ const e = t.propName, i = `on${e[0].toUpperCase() + e.slice(1)}Click`;
363
+ f.push(`### \`${i}\` (() => void, optional)
358
364
 
359
- Callback fired when the "${e.name}" button is clicked (Component ID: ${e.id}).
365
+ Callback fired when the "${t.name}" button is clicked (Component ID: ${t.id}).
360
366
 
361
- Action type: \`${e.actionType}\``);
367
+ Action type: \`${t.actionType}\``);
362
368
  });
363
- const j = u.length > 0 ? `## Action Button Props
369
+ const F = f.length > 0 ? `## Action Button Props
364
370
 
365
371
  These props allow you to respond to button clicks and other user interactions.
366
372
 
367
- ${u.join(`
373
+ ${f.join(`
368
374
 
369
- `)}` : "", T = `## Props
375
+ `)}` : "", S = `## Props
370
376
 
371
377
  ### Data Props
372
378
 
373
- ${k}
379
+ ${D}
374
380
 
375
381
  ${A}
376
382
 
@@ -380,31 +386,31 @@ ${O}
380
386
 
381
387
  ${M}
382
388
 
383
- ${j}`, F = c.length > 0 && c[0].arrayContainer ? `<${m}
389
+ ${F}`, U = c.length > 0 && c[0].arrayContainer ? `<${u}
384
390
  ${c.map(
385
- (e) => e.arrayContainer ? `${e.arrayContainer.propName}={[
391
+ (t) => t.arrayContainer ? `${t.arrayContainer.propName}={[
386
392
  {
387
- ${e.arrayContainer?.components.map(
388
- (t) => `${t.propName}: "${t.type === "component:image" ? "https://example.com/image.jpg" : "Example value"}"`
393
+ ${t.arrayContainer?.components.map(
394
+ (e) => `${e.propName}: "${e.type === "component:image" ? "https://example.com/image.jpg" : "Example value"}"`
389
395
  ).join(`,
390
396
  `)}
391
397
  }
392
398
  ]}` : ""
393
399
  ).filter(Boolean).join(`
394
400
  `)}
395
- />` : `<${m} />`;
396
- let w = "";
401
+ />` : `<${u} />`;
402
+ let B = "";
397
403
  if (c.length > 0 && c[0]) {
398
- const e = c[0], t = l(e.name || "container"), f = `${t[0].toUpperCase()}${t.slice(
404
+ const t = c[0], e = m(t.name || "container"), C = `${e[0].toUpperCase()}${e.slice(
399
405
  1
400
406
  )}IndexChange`;
401
- w = `## Controlling Slides
407
+ B = `## Controlling Slides
402
408
 
403
409
  You can imperatively control which slide is displayed and listen for slide changes:
404
410
 
405
411
  \`\`\`tsx
406
412
  import { useState } from "react";
407
- import { ${m} } from "./${m}";
413
+ import { ${u} } from "./${u}";
408
414
 
409
415
  function MyComponent() {
410
416
  const [currentSlide, setCurrentSlide] = useState(0);
@@ -417,39 +423,39 @@ function MyComponent() {
417
423
  <button onClick={() => setCurrentSlide((prev) => prev + 1)}>
418
424
  Next
419
425
  </button>
420
- <${m}
426
+ <${u}
421
427
  ${c.map(
422
428
  (i) => i.arrayContainer ? `${i.arrayContainer.propName}={[/* array of items */]}` : ""
423
429
  ).filter(Boolean).join(`
424
430
  `)}
425
- ${t}CurrentIndex={currentSlide}
426
- on${f}={(index) => setCurrentSlide(index)}
431
+ ${e}CurrentIndex={currentSlide}
432
+ on${C}={(index) => setCurrentSlide(index)}
427
433
  />
428
434
  </>
429
435
  );
430
436
  }
431
437
  \`\`\``;
432
438
  }
433
- return `# ${m}
439
+ return `# ${u}
434
440
 
435
441
  Encore App Wrapper Component
436
442
 
437
- This component wraps the Encore Studio app **"${y}"** (App ID: \`${U}\`) for the page **"${b}"** (Page ID: \`${I}\`).
443
+ This component wraps the Encore Studio app **"${P}"** (App ID: \`${k}\`) for the page **"${E}"** (Page ID: \`${x}\`).
438
444
 
439
445
  The component automatically maps props to data-bound components within the app. Components marked with \`encore:data\` tags are exposed as props, allowing you to dynamically populate content.
440
446
 
441
- ${T}
447
+ ${S}
442
448
 
443
449
  ## Usage
444
450
 
445
451
  \`\`\`tsx
446
- import { ${m} } from "./${m}";
452
+ import { ${u} } from "./${u}";
447
453
 
448
454
  function MyComponent() {
449
455
  return (
450
- <${m}
456
+ <${u}
451
457
  ${c.map(
452
- (e) => e.arrayContainer ? `${e.arrayContainer.propName}={[/* array of items */]}` : ""
458
+ (t) => t.arrayContainer ? `${t.arrayContainer.propName}={[/* array of items */]}` : ""
453
459
  ).filter(Boolean).join(`
454
460
  `)}
455
461
  />
@@ -460,52 +466,52 @@ function MyComponent() {
460
466
  ## Example
461
467
 
462
468
  \`\`\`tsx
463
- ${F}
469
+ ${U}
464
470
  \`\`\`
465
471
 
466
- ${w}
472
+ ${B}
467
473
  `;
468
474
  }
469
- function R(U, I, y, b, m, c, g, P) {
470
- const h = [], d = [], E = l(I);
471
- b.forEach((a) => {
472
- h.push(a.propName);
473
- }), m.forEach((a) => {
474
- const r = l(a.groupName);
475
- h.push(r), d.push(`on${r[0].toUpperCase()}${r.slice(1)}Change`);
475
+ function Y(k, x, P, E, u, c, N, v) {
476
+ const l = [], d = [], I = m(x);
477
+ E.forEach((a) => {
478
+ l.push(a.propName);
479
+ }), u.forEach((a) => {
480
+ const p = m(a.groupName);
481
+ l.push(p), d.push(`on${p[0].toUpperCase()}${p.slice(1)}Change`);
476
482
  }), c.forEach((a) => {
477
- const r = l(a.formName);
483
+ const p = m(a.formName);
478
484
  d.push(
479
- `on${r[0].toUpperCase()}${r.slice(1)}Submit`
485
+ `on${p[0].toUpperCase()}${p.slice(1)}Submit`
480
486
  );
481
- }), g.forEach((a) => {
482
- const r = a.propName, u = r[0].toUpperCase() + r.slice(1);
483
- h.push(r), h.push(`${r}Options`), d.push(`on${u}Change`);
487
+ }), N.forEach((a) => {
488
+ const p = a.propName, f = p[0].toUpperCase() + p.slice(1);
489
+ l.push(p), l.push(`${p}Options`), d.push(`on${f}Change`);
490
+ }), v.forEach((a) => {
491
+ const p = a.propName, f = p[0].toUpperCase() + p.slice(1);
492
+ d.push(`on${f}Click`);
484
493
  }), P.forEach((a) => {
485
- const r = a.propName, u = r[0].toUpperCase() + r.slice(1);
486
- d.push(`on${u}Click`);
487
- }), y.forEach((a) => {
488
- a.arrayContainer && a.arrayContainer.components.length > 0 && h.push(a.arrayContainer.propName);
489
- const r = l(a.name || "container"), u = `${r[0].toUpperCase()}${r.slice(
494
+ a.arrayContainer && a.arrayContainer.components.length > 0 && l.push(a.arrayContainer.propName);
495
+ const p = m(a.name || "container"), f = `${p[0].toUpperCase()}${p.slice(
490
496
  1
491
497
  )}IndexChange`;
492
- h.push(`${r}CurrentIndex`), d.push(`on${u}`);
498
+ l.push(`${p}CurrentIndex`), d.push(`on${f}`);
493
499
  });
494
- const N = `<${E}
495
- ${h.map((a) => `${a}={${a}}`).join(`
500
+ const y = `<${I}
501
+ ${l.map((a) => `${a}={${a}}`).join(`
496
502
  `)}
497
503
  ${d.map((a) => `${a}={${a}}`).join(`
498
504
  `)}
499
505
  />`;
500
506
  return {
501
- props: h,
507
+ props: l,
502
508
  events: d,
503
- jsx: N
509
+ jsx: y
504
510
  };
505
511
  }
506
512
  export {
507
513
  K as generateComponentCode,
508
- R as generateComponentMetadata,
514
+ Y as generateComponentMetadata,
509
515
  L as generateReadme
510
516
  };
511
517
  //# sourceMappingURL=generator.js.map