@bravostudioai/react 0.1.35 → 0.1.38

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,64 +1,64 @@
1
1
  import { qualifyPropNames as E } from "./propQualification.js";
2
2
  function g(i) {
3
- const c = i.replace(/[^a-zA-Z0-9\s]/g, "").trim();
4
- return c ? c.split(/\s+/).map((s, y) => {
3
+ const o = i.replace(/[^a-zA-Z0-9\s]/g, "").trim();
4
+ return o ? o.split(/\s+/).map((s, y) => {
5
5
  if (!s) return "";
6
- const t = s === s.toUpperCase() && s.length > 1 ? s.toLowerCase() : s, o = t.charAt(0), r = t.slice(1);
7
- return y === 0 ? o.toLowerCase() + r : o.toUpperCase() + r;
6
+ const t = s === s.toUpperCase() && s.length > 1 ? s.toLowerCase() : s, e = t.charAt(0), r = t.slice(1);
7
+ return y === 0 ? e.toLowerCase() + r : e.toUpperCase() + r;
8
8
  }).join("").replace(/^[0-9]/, "_$&") : "item";
9
9
  }
10
- function F(i, c) {
10
+ function W(i, o) {
11
11
  const s = g(i);
12
- if (c.length === 0)
12
+ if (o.length === 0)
13
13
  return s;
14
- const y = c.filter((r) => r && r.trim()).reverse();
14
+ const y = o.filter((r) => r && r.trim()).reverse();
15
15
  return y.length === 0 ? s : y.map(
16
16
  (r) => g(r)
17
17
  ).map((r) => r.charAt(0).toUpperCase() + r.slice(1)).join("") + s;
18
18
  }
19
- function S(i, c) {
20
- if (c.length === 0)
19
+ function I(i, o) {
20
+ if (o.length === 0)
21
21
  return [];
22
22
  let s = 0;
23
23
  const y = Math.min(
24
24
  i.length,
25
- ...c.map((o) => o.length)
25
+ ...o.map((e) => e.length)
26
26
  );
27
- for (let o = 0; o < y; o++) {
28
- const r = i[o];
29
- if (c.every((f) => f[o] === r))
27
+ for (let e = 0; e < y; e++) {
28
+ const r = i[e];
29
+ if (o.every((f) => f[e] === r))
30
30
  s++;
31
31
  else
32
32
  break;
33
33
  }
34
34
  const t = i.slice(s);
35
- for (let o = 1; o <= t.length; o++) {
36
- const r = t.slice(0, o);
37
- if (c.every((f) => {
38
- if (f.length < s + o)
35
+ for (let e = 1; e <= t.length; e++) {
36
+ const r = t.slice(0, e);
37
+ if (o.every((f) => {
38
+ if (f.length < s + e)
39
39
  return !0;
40
40
  const a = f.slice(
41
41
  s,
42
- s + o
42
+ s + e
43
43
  );
44
- return !W(r, a);
44
+ return !P(r, a);
45
45
  }))
46
46
  return r;
47
47
  }
48
48
  return t;
49
49
  }
50
- function W(i, c) {
51
- return i.length !== c.length ? !1 : i.every((s, y) => s === c[y]);
50
+ function P(i, o) {
51
+ return i.length !== o.length ? !1 : i.every((s, y) => s === o[y]);
52
52
  }
53
- function P(i, c) {
54
- return i === "component:image" || i === "component:text" || i?.startsWith("component:input-") ? "string" : "any";
53
+ function C(i, o) {
54
+ return i === "component:image" || i === "component:text" || i?.startsWith("component:input-") || i === "component:webview" || i === "component:web-view" || i === "component:video" || i === "component:video" ? "string" : i === "component:embed" ? "React.ReactNode" : "any";
55
55
  }
56
- function j(i) {
57
- return i === "component:image" ? "imageUrl" : i === "component:text" ? "text" : "value";
56
+ function S(i) {
57
+ return i === "component:image" ? "imageUrl" : i === "component:text" ? "text" : i === "component:webview" || i === "component:web-view" ? "url" : i === "component:video" ? "videoUrl" : "value";
58
58
  }
59
- function x(i) {
60
- const c = [];
61
- function s(t, o = []) {
59
+ function j(i) {
60
+ const o = [];
61
+ function s(t, e = []) {
62
62
  if (!(!t || typeof t != "object")) {
63
63
  if (t.type === "container:slider") {
64
64
  const r = {
@@ -79,46 +79,46 @@ function x(i) {
79
79
  if (t.containers && Array.isArray(t.containers) && t.containers.forEach(f), !p && t.components && Array.isArray(t.components) && t.components.forEach(f), p) {
80
80
  const a = p;
81
81
  let u = [];
82
- const n = [], l = (e, b = []) => {
83
- if (!e || typeof e != "object") return;
84
- if (e.type === "component:image" && n.push(e), Array.isArray(e.tags) && (e.tags.includes("encore:data") || e.tags.includes("bravo:data"))) {
85
- const A = g(e.name || "item"), C = P(e.type, e.name);
82
+ const c = [], l = (n, b = []) => {
83
+ if (!n || typeof n != "object") return;
84
+ if (n.type === "component:image" && c.push(n), Array.isArray(n.tags) && (n.tags.includes("encore:data") || n.tags.includes("bravo:data"))) {
85
+ const A = g(n.name || "item"), v = C(n.type, n.name);
86
86
  u.push({
87
- id: e.id,
88
- name: e.name || "Unnamed",
89
- type: e.type,
90
- tags: e.tags || [],
87
+ id: n.id,
88
+ name: n.name || "Unnamed",
89
+ type: n.type,
90
+ tags: n.tags || [],
91
91
  propName: A,
92
92
  // Will be qualified later if needed
93
- propType: C,
93
+ propType: v,
94
94
  // Store parent path for later qualification
95
95
  _parentPath: [...b]
96
96
  });
97
97
  }
98
98
  const h = [...b];
99
- if (e.name && (e.type?.startsWith("container:") || e.type?.startsWith("component:"))) {
100
- const A = e.name.trim(), C = /^frame\s*\d*$/i.test(A) || A.toUpperCase() === "FRAME";
101
- A && !C && h.push(e.name);
99
+ if (n.name && (n.type?.startsWith("container:") || n.type?.startsWith("component:"))) {
100
+ const A = n.name.trim(), v = /^frame\s*\d*$/i.test(A) || A.toUpperCase() === "FRAME";
101
+ A && !v && h.push(n.name);
102
102
  }
103
- e.body && Array.isArray(e.body) && e.body.forEach(
103
+ n.body && Array.isArray(n.body) && n.body.forEach(
104
104
  (A) => l(A, h)
105
- ), e.containers && Array.isArray(e.containers) && e.containers.forEach(
105
+ ), n.containers && Array.isArray(n.containers) && n.containers.forEach(
106
106
  (A) => l(A, h)
107
- ), e.components && Array.isArray(e.components) && e.components.forEach(
107
+ ), n.components && Array.isArray(n.components) && n.components.forEach(
108
108
  (A) => l(A, h)
109
109
  );
110
110
  };
111
111
  if (a.components && Array.isArray(a.components) && a.components.forEach(
112
- (e) => l(e, [])
112
+ (n) => l(n, [])
113
113
  ), !u.some(
114
- (e) => e.type === "component:image"
115
- ) && n.length > 0) {
116
- const e = n[0], h = (e.name || "image").toLowerCase().includes("image") ? "imageUrl" : g(e.name || "image");
114
+ (n) => n.type === "component:image"
115
+ ) && c.length > 0) {
116
+ const n = c[0], h = (n.name || "image").toLowerCase().includes("image") ? "imageUrl" : g(n.name || "image");
117
117
  u.push({
118
- id: e.id,
119
- name: e.name || "Image",
120
- type: e.type,
121
- tags: e.tags || [],
118
+ id: n.id,
119
+ name: n.name || "Image",
120
+ type: n.type,
121
+ tags: n.tags || [],
122
122
  propName: h,
123
123
  // Will be qualified later if needed
124
124
  propType: "string",
@@ -126,8 +126,8 @@ function x(i) {
126
126
  _parentPath: []
127
127
  });
128
128
  }
129
- if (E(u), n.length > 0) {
130
- const b = (n[0].name || "").toLowerCase();
129
+ if (E(u), c.length > 0) {
130
+ const b = (c[0].name || "").toLowerCase();
131
131
  u = u.filter((h) => {
132
132
  if (h.type === "component:image") return !0;
133
133
  if (h.type === "component:color") {
@@ -145,73 +145,74 @@ function x(i) {
145
145
  components: u
146
146
  };
147
147
  }
148
- c.push(r);
148
+ o.push(r);
149
149
  }
150
- t.body && Array.isArray(t.body) && t.body.forEach((r) => s(r, [...o, "body"])), t.containers && Array.isArray(t.containers) && t.containers.forEach(
151
- (r) => s(r, [...o, "containers"])
150
+ t.body && Array.isArray(t.body) && t.body.forEach((r) => s(r, [...e, "body"])), t.containers && Array.isArray(t.containers) && t.containers.forEach(
151
+ (r) => s(r, [...e, "containers"])
152
152
  ), t.components && Array.isArray(t.components) && t.components.forEach(
153
- (r) => s(r, [...o, "components"])
153
+ (r) => s(r, [...e, "components"])
154
154
  );
155
155
  }
156
156
  }
157
157
  const y = i.data?.body || i.body || i.data?.body || [];
158
- return Array.isArray(y) && y.length > 0 && y.forEach((t) => s(t)), c;
158
+ return Array.isArray(y) && y.length > 0 && y.forEach((t) => s(t)), o;
159
159
  }
160
- function N(i) {
161
- const c = [], s = /* @__PURE__ */ new Set();
160
+ function x(i) {
161
+ const o = [], s = /* @__PURE__ */ new Set();
162
162
  function y(r) {
163
163
  !r || typeof r != "object" || (r.type === "container:slider" && s.add(r.id), r.body && Array.isArray(r.body) && r.body.forEach(y), r.containers && Array.isArray(r.containers) && r.containers.forEach(y));
164
164
  }
165
165
  function t(r, p, f = []) {
166
166
  if (!r || typeof r != "object" || p && s.has(p)) return;
167
- if (Array.isArray(r.tags) && (r.tags.includes("encore:data") || r.tags.includes("bravo:data")) && (r.type === "component:text" || r.type === "component:image")) {
168
- const n = g(r.name || "item"), l = P(r.type, r.name);
169
- c.push({
167
+ const a = Array.isArray(r.tags) && (r.tags.includes("encore:data") || r.tags.includes("bravo:data"));
168
+ if (r.type === "component:embed" || r.type === "component:webview" || r.type === "component:web-view" || r.type === "component:video" || a && (r.type === "component:text" || r.type === "component:image")) {
169
+ const l = g(r.name || "item"), m = C(r.type, r.name);
170
+ o.push({
170
171
  id: r.id,
171
172
  name: r.name || "Unnamed",
172
173
  type: r.type,
173
174
  tags: r.tags || [],
174
- propName: n,
175
+ propName: l,
175
176
  // Will be qualified later if needed
176
- propType: l,
177
+ propType: m,
177
178
  // Store parent path for later qualification
178
179
  _parentPath: [...f]
179
180
  });
180
181
  }
181
- const a = [...f];
182
+ const u = [...f];
182
183
  if (r.name && (r.type?.startsWith("container:") || r.type?.startsWith("component:"))) {
183
- const n = r.name.trim(), l = /^frame\s*\d*$/i.test(n) || n.toUpperCase() === "FRAME";
184
- n && !l && a.push(r.name);
184
+ const l = r.name.trim(), m = /^frame\s*\d*$/i.test(l) || l.toUpperCase() === "FRAME";
185
+ l && !m && u.push(r.name);
185
186
  }
186
- const u = r.id;
187
+ const c = r.id;
187
188
  r.body && Array.isArray(r.body) && r.body.forEach(
188
- (n) => t(n, u, a)
189
+ (l) => t(l, c, u)
189
190
  ), r.containers && Array.isArray(r.containers) && r.containers.forEach(
190
- (n) => t(n, u, a)
191
+ (l) => t(l, c, u)
191
192
  ), r.components && Array.isArray(r.components) && r.components.forEach(
192
- (n) => t(n, u, a)
193
+ (l) => t(l, c, u)
193
194
  );
194
195
  }
195
- const o = i.data?.body || i.body || i.data?.body || [];
196
- return Array.isArray(o) && o.length > 0 && (o.forEach(y), o.forEach((r) => t(r))), E(c), c;
196
+ const e = i.data?.body || i.body || i.data?.body || [];
197
+ return Array.isArray(e) && e.length > 0 && (e.forEach(y), e.forEach((r) => t(r))), E(o), o;
197
198
  }
198
- function d(i) {
199
- const c = /* @__PURE__ */ new Map();
199
+ function N(i) {
200
+ const o = /* @__PURE__ */ new Map();
200
201
  function s(t) {
201
202
  if (!(!t || typeof t != "object")) {
202
203
  if (t.type === "component:input-stateful-set" && Array.isArray(t.tags)) {
203
- const o = t.tags.find(
204
+ const e = t.tags.find(
204
205
  (r) => r.startsWith("input-group:")
205
206
  );
206
- if (o) {
207
- const r = o.split(":");
207
+ if (e) {
208
+ const r = e.split(":");
208
209
  if (r.length >= 3) {
209
210
  const p = r[1], f = r[2];
210
- c.has(f) || c.set(f, {
211
+ o.has(f) || o.set(f, {
211
212
  groupName: f,
212
213
  groupType: p,
213
214
  elements: []
214
- }), c.get(f).elements.push({
215
+ }), o.get(f).elements.push({
215
216
  id: t.id,
216
217
  name: t.name || "Unnamed"
217
218
  });
@@ -222,43 +223,43 @@ function d(i) {
222
223
  }
223
224
  }
224
225
  const y = i.data?.body || i.body || i.data?.body || [];
225
- return Array.isArray(y) && y.length > 0 && y.forEach((t) => s(t)), Array.from(c.values());
226
+ return Array.isArray(y) && y.length > 0 && y.forEach((t) => s(t)), Array.from(o.values());
226
227
  }
227
- function M(i) {
228
- const c = [];
229
- function s(t, o) {
228
+ function d(i) {
229
+ const o = [];
230
+ function s(t, e) {
230
231
  if (!t || typeof t != "object") return;
231
232
  const r = t.type?.startsWith("container:") || t.type === "container:default", p = t.name?.toLowerCase().includes("form") || Array.isArray(t.tags) && t.tags.includes("form");
232
233
  let f = !1, a;
233
- function u(n) {
234
- if (!(!n || typeof n != "object")) {
235
- if (Array.isArray(n.tags) && (n.tags.includes("action:submit") || n.tags.includes("submit"))) {
236
- f = !0, a = n.id;
234
+ function u(c) {
235
+ if (!(!c || typeof c != "object")) {
236
+ if (Array.isArray(c.tags) && (c.tags.includes("action:submit") || c.tags.includes("submit"))) {
237
+ f = !0, a = c.id;
237
238
  return;
238
239
  }
239
- if (n.actions?.tap?.action === "submit") {
240
- f = !0, a = n.id;
240
+ if (c.actions?.tap?.action === "submit") {
241
+ f = !0, a = c.id;
241
242
  return;
242
243
  }
243
- n.components && Array.isArray(n.components) && n.components.forEach(u), n.body && Array.isArray(n.body) && n.body.forEach(u);
244
+ c.components && Array.isArray(c.components) && c.components.forEach(u), c.body && Array.isArray(c.body) && c.body.forEach(u);
244
245
  }
245
246
  }
246
- if (r && (p || o === void 0) && u(t), r && (f || p)) {
247
- const n = [], l = (m, e = []) => {
247
+ if (r && (p || e === void 0) && u(t), r && (f || p)) {
248
+ const c = [], l = (m, n = []) => {
248
249
  if (!m || typeof m != "object") return;
249
250
  if (m.type?.startsWith("component:input-") || m.type === "component:input-text" || m.type === "component:input-image" || m.type === "component:input-email" || m.type === "component:input-password" || m.type === "component:input-select") {
250
251
  const h = g(m.name || "Unnamed input");
251
- n.push({
252
+ c.push({
252
253
  id: m.id,
253
254
  name: m.name || "Unnamed input",
254
255
  type: m.type,
255
256
  propName: h,
256
257
  // Will be qualified later if needed
257
- _parentPath: [...e]
258
+ _parentPath: [...n]
258
259
  // Store parent path for qualification
259
260
  });
260
261
  }
261
- const b = [...e];
262
+ const b = [...n];
262
263
  if (m.name && (m.type?.startsWith("container:") || m.type?.startsWith("component:"))) {
263
264
  const h = m.name.trim(), A = /^frame\s*\d*$/i.test(h) || h.toUpperCase() === "FRAME";
264
265
  h && !A && b.push(m.name);
@@ -267,27 +268,27 @@ function M(i) {
267
268
  (h) => l(h, b)
268
269
  ), m.body && Array.isArray(m.body) && m.body.forEach((h) => l(h, b));
269
270
  };
270
- l(t, []), n.length > 0 && c.push({
271
+ l(t, []), c.length > 0 && o.push({
271
272
  formId: t.id,
272
273
  formName: t.name || "Form",
273
274
  submitButtonId: a,
274
- inputs: n
275
+ inputs: c
275
276
  });
276
277
  }
277
278
  t.body && Array.isArray(t.body) && t.body.forEach(
278
- (n) => s(n, r ? t : o)
279
+ (c) => s(c, r ? t : e)
279
280
  ), t.containers && Array.isArray(t.containers) && t.containers.forEach(
280
- (n) => s(n, r ? t : o)
281
+ (c) => s(c, r ? t : e)
281
282
  ), t.components && Array.isArray(t.components) && t.components.forEach(
282
- (n) => s(n, r ? t : o)
283
+ (c) => s(c, r ? t : e)
283
284
  );
284
285
  }
285
286
  const y = i.data?.body || i.body || i.data?.body || [];
286
- return Array.isArray(y) && y.length > 0 && y.forEach((t) => s(t)), c;
287
+ return Array.isArray(y) && y.length > 0 && y.forEach((t) => s(t)), o;
287
288
  }
288
- function L(i, c) {
289
+ function M(i, o) {
289
290
  const s = [], y = /* @__PURE__ */ new Set();
290
- c.forEach((r) => {
291
+ o.forEach((r) => {
291
292
  r.inputs.forEach((p) => {
292
293
  y.add(p.id);
293
294
  });
@@ -314,36 +315,49 @@ function L(i, c) {
314
315
  (a) => t(a, f)
315
316
  );
316
317
  }
317
- const o = i.data?.body || i.body || i.data?.body || [];
318
- return Array.isArray(o) && o.length > 0 && o.forEach((r) => t(r)), I(s), s;
318
+ const e = i.data?.body || i.body || i.data?.body || [];
319
+ return Array.isArray(e) && e.length > 0 && e.forEach((r) => t(r)), U(s), s;
319
320
  }
320
- function I(i) {
321
+ function U(i) {
321
322
  E(i);
322
323
  }
323
- function _(i) {
324
- const c = [];
325
- function s(t, o = []) {
324
+ function G(i) {
325
+ const o = [];
326
+ console.log(
327
+ "[DEBUG] local encore-lib findActionButtons running via alias. Check node.actions support."
328
+ );
329
+ function s(t, e = []) {
326
330
  if (!t || typeof t != "object") return;
331
+ (t.id === "01KF5PAFFVFSKY6QJZXQTC99P5" || t.tags && t.tags.some((a) => a.includes("action"))) && console.log(`[DEBUG] traverse node ${t.name} (${t.id})`, {
332
+ type: t.type,
333
+ tags: t.tags,
334
+ hasActions: !!t.actions,
335
+ actionsKeys: t.actions ? Object.keys(t.actions) : []
336
+ });
327
337
  const r = Array.isArray(t.tags) && t.tags.some((a) => a.startsWith("action:")), p = t.actions && typeof t.actions == "object";
328
338
  if (r || p) {
329
339
  let a = "tap";
330
340
  if (Array.isArray(t.tags)) {
331
- const n = t.tags.find(
341
+ const c = t.tags.find(
332
342
  (l) => l.startsWith("action:")
333
343
  );
334
- n && (a = n.replace("action:", ""));
344
+ c && (a = c.replace("action:", ""));
335
345
  }
336
- t.actions?.tap?.action && (a = t.actions.tap.action);
346
+ t.actions?.tap?.action && (a = t.actions.tap.action), console.log(`[DEBUG] Found action button: ${t.name} (${t.id})`, {
347
+ actionType: a,
348
+ hasActionTag: r,
349
+ hasActions: p
350
+ });
337
351
  const u = g(t.name || "button");
338
- c.push({
352
+ o.push({
339
353
  id: t.id,
340
354
  name: t.name || "Button",
341
355
  propName: u,
342
356
  actionType: a,
343
- _parentPath: [...o]
357
+ _parentPath: [...e]
344
358
  });
345
359
  }
346
- const f = [...o];
360
+ const f = [...e];
347
361
  if (t.name && (t.type?.startsWith("container:") || t.type?.startsWith("component:"))) {
348
362
  const a = t.name.trim(), u = /^frame\s*\d*$/i.test(a) || a.toUpperCase() === "FRAME";
349
363
  a && !u && f.push(t.name);
@@ -355,29 +369,29 @@ function _(i) {
355
369
  );
356
370
  }
357
371
  const y = i.data?.body || i.body || i.data?.body || [];
358
- return Array.isArray(y) && y.length > 0 && y.forEach((t) => s(t)), v(c), c;
372
+ return Array.isArray(y) && y.length > 0 && y.forEach((t) => s(t)), F(o), o;
359
373
  }
360
- function v(i) {
374
+ function F(i) {
361
375
  E(i);
362
376
  }
363
- function q(i) {
364
- i.forEach((c) => {
365
- E(c.inputs);
377
+ function $(i) {
378
+ i.forEach((o) => {
379
+ E(o.inputs);
366
380
  });
367
381
  }
368
382
  export {
369
- W as arraysEqual,
370
- _ as findActionButtons,
371
- M as findForms,
372
- d as findInputGroups,
373
- S as findMinimalDistinguishingPath,
374
- x as findSlidersAndDataBindings,
375
- N as findStandaloneComponents,
376
- L as findStandaloneSelectInputs,
377
- F as generateQualifiedPropName,
378
- j as getComponentPropName,
379
- P as getComponentPropType,
380
- q as qualifyFormInputs,
383
+ P as arraysEqual,
384
+ G as findActionButtons,
385
+ d as findForms,
386
+ N as findInputGroups,
387
+ I as findMinimalDistinguishingPath,
388
+ j as findSlidersAndDataBindings,
389
+ x as findStandaloneComponents,
390
+ M as findStandaloneSelectInputs,
391
+ W as generateQualifiedPropName,
392
+ S as getComponentPropName,
393
+ C as getComponentPropType,
394
+ $ as qualifyFormInputs,
381
395
  g as sanitizePropName
382
396
  };
383
397
  //# sourceMappingURL=parser.js.map