Skip to content

Commit d9287c4

Browse files
committed
Modified
1 parent 8dd88f3 commit d9287c4

4 files changed

Lines changed: 49 additions & 49 deletions

File tree

samples/A2UI-Google-Sheets/index.html

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html>
33
<head>
44
<base target="_top" />
@@ -10,8 +10,9 @@
1010
--surface-color: #ffffff;
1111
}
1212
body {
13-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
14-
Helvetica, Arial, sans-serif;
13+
font-family:
14+
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
15+
Arial, sans-serif;
1516
margin: 0;
1617
padding: 0;
1718
background: var(--bg-color);
@@ -359,7 +360,7 @@ <h3>A2UI App Hub</h3>
359360
if (msg.beginRendering.styles?.primaryColor) {
360361
document.documentElement.style.setProperty(
361362
"--primary-color",
362-
msg.beginRendering.styles.primaryColor
363+
msg.beginRendering.styles.primaryColor,
363364
);
364365
}
365366
}
@@ -370,7 +371,7 @@ <h3>A2UI App Hub</h3>
370371
}
371372
if (msg.surfaceUpdate) {
372373
msg.surfaceUpdate.components.forEach(
373-
(c) => (state.components[c.id] = c)
374+
(c) => (state.components[c.id] = c),
374375
);
375376
if (!state.rootId && msg.surfaceUpdate.components.length > 0) {
376377
state.rootId = msg.surfaceUpdate.components[0].id;
@@ -405,14 +406,14 @@ <h3>A2UI App Hub</h3>
405406
.replace(/>/g, "&gt;");
406407
html = html.replace(
407408
/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,
408-
'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'
409+
'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>',
409410
);
410411
const urlPattern = /(https?:\/\/[^\s]+)/;
411412
if (!html.includes("<a ") && urlPattern.test(html)) {
412413
html = html.replace(
413414
urlPattern,
414415
(match) =>
415-
`<a href="${match}" target="_blank" rel="noopener noreferrer">More Info</a>`
416+
`<a href="${match}" target="_blank" rel="noopener noreferrer">More Info</a>`,
416417
);
417418
}
418419
return html;
@@ -426,12 +427,12 @@ <h3>A2UI App Hub</h3>
426427

427428
if (entry.valueMap && Array.isArray(entry.valueMap)) {
428429
const isStandardMap = entry.valueMap.some(
429-
(v) => v && typeof v === "object" && "key" in v
430+
(v) => v && typeof v === "object" && "key" in v,
430431
);
431432
if (isStandardMap) {
432433
const isListLike = entry.valueMap.every(
433434
(v, i) =>
434-
String(v.key) === String(i) || String(v.key).startsWith("item")
435+
String(v.key) === String(i) || String(v.key).startsWith("item"),
435436
);
436437
if (isListLike) return entry.valueMap.map((v) => parseValue(v));
437438
const obj = {};
@@ -523,7 +524,7 @@ <h3>A2UI App Hub</h3>
523524
props.url.literalString ||
524525
resolvePath(sid, joinPath(ctx, props.url.path));
525526
img.src =
526-
url || "https://via.placeholder.com/400x200?text=No+Image";
527+
url || "https:\/\/via.placeholder.com\/400x200?text=No+Image";
527528
if (props.width) {
528529
img.style.width = props.width;
529530
img.style.minHeight = "0";
@@ -580,26 +581,26 @@ <h3>A2UI App Hub</h3>
580581
};
581582
sendMessage(
582583
`DETAILS_JSON:${JSON.stringify(d)}`,
583-
"Loading Form..."
584+
"Loading Form...",
584585
);
585586
} else if (actionName === "submit_booking") {
586587
const inputs = document.querySelectorAll(".a2ui-textfield");
587588
let details = [];
588589
inputs.forEach((i) =>
589-
details.push(`${i.dataset.label}: ${i.value}`)
590+
details.push(`${i.dataset.label}: ${i.value}`),
590591
);
591592
const rName =
592593
resolvePath(sid, "restaurantName") || "the restaurant";
593594
const rImage = resolvePath(sid, "imageUrl") || "";
594595
sendMessage(
595596
`User submitted a booking for ${rName}. Details: ${details.join(
596-
", "
597+
", ",
597598
)}. ImageUrl: ${rImage}`,
598-
"Submitting..."
599+
"Submitting...",
599600
);
600601
} else if (actionName === "add_events") {
601602
const checkboxes = document.querySelectorAll(
602-
".a2ui-checkbox:checked"
603+
".a2ui-checkbox:checked",
603604
);
604605
if (checkboxes.length === 0) {
605606
alert("Please select at least one event.");
@@ -614,7 +615,7 @@ <h3>A2UI App Hub</h3>
614615
}
615616
});
616617
const msg = `Please add these events to calendar: ${JSON.stringify(
617-
selectedEvents
618+
selectedEvents,
618619
)}`;
619620
sendMessage(msg, "Adding to Calendar...");
620621
} else if (actionName === "back_to_list") {
@@ -717,9 +718,8 @@ <h3>A2UI App Hub</h3>
717718

718719
if (r.uiJson) renderA2UiMessages(r.uiJson);
719720
else if (r.text)
720-
document.getElementById(
721-
"ui-container"
722-
).innerHTML = `<div class="a2ui-card"><p>${r.text}</p></div>`;
721+
document.getElementById("ui-container").innerHTML =
722+
`<div class="a2ui-card"><p>${r.text}</p></div>`;
723723
})
724724
.withFailureHandler((e) => {
725725
alert("Error: " + e.message);

samples/A2UI-Lerning-Agent/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ <h2 class="a2ui-text-h2">A2UI App Hub</h2>
933933
props.url.literalString ||
934934
resolvePath(sid, joinPath(ctx, props.url.path));
935935
img.src =
936-
url || "https://via.placeholder.com/400x200?text=No+Image";
936+
url || "https:\/\/via.placeholder.com\/400x200?text=No+Image";
937937
if (props.width) img.style.width = props.width;
938938
el.appendChild(img);
939939
break;

samples/A2UI-Restaurant-finder/index.html

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html>
33
<head>
44
<base target="_top" />
@@ -10,8 +10,9 @@
1010
--surface-color: #ffffff;
1111
}
1212
body {
13-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
14-
Helvetica, Arial, sans-serif;
13+
font-family:
14+
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
15+
Arial, sans-serif;
1516
margin: 0;
1617
padding: 0;
1718
background: var(--bg-color);
@@ -308,7 +309,7 @@ <h3>Restaurant Finder</h3>
308309
if (msg.beginRendering.styles?.primaryColor) {
309310
document.documentElement.style.setProperty(
310311
"--primary-color",
311-
msg.beginRendering.styles.primaryColor
312+
msg.beginRendering.styles.primaryColor,
312313
);
313314
}
314315
}
@@ -319,7 +320,7 @@ <h3>Restaurant Finder</h3>
319320
}
320321
if (msg.surfaceUpdate) {
321322
msg.surfaceUpdate.components.forEach(
322-
(c) => (state.components[c.id] = c)
323+
(c) => (state.components[c.id] = c),
323324
);
324325
if (!state.rootId && msg.surfaceUpdate.components.length > 0) {
325326
state.rootId = msg.surfaceUpdate.components[0].id;
@@ -364,14 +365,14 @@ <h3>Restaurant Finder</h3>
364365
.replace(/>/g, "&gt;");
365366
html = html.replace(
366367
/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,
367-
'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'
368+
'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>',
368369
);
369370
const urlPattern = /(https?:\/\/[^\s]+)/;
370371
if (!html.includes("<a ") && urlPattern.test(html)) {
371372
html = html.replace(
372373
urlPattern,
373374
(match) =>
374-
`<a href="${match}" target="_blank" rel="noopener noreferrer">More Info</a>`
375+
`<a href="${match}" target="_blank" rel="noopener noreferrer">More Info</a>`,
375376
);
376377
}
377378
return html;
@@ -390,12 +391,12 @@ <h3>Restaurant Finder</h3>
390391

391392
if (entry.valueMap && Array.isArray(entry.valueMap)) {
392393
const isStandardMap = entry.valueMap.some(
393-
(v) => v && typeof v === "object" && "key" in v
394+
(v) => v && typeof v === "object" && "key" in v,
394395
);
395396
if (isStandardMap) {
396397
const isListLike = entry.valueMap.every(
397398
(v, i) =>
398-
String(v.key) === String(i) || String(v.key).startsWith("item")
399+
String(v.key) === String(i) || String(v.key).startsWith("item"),
399400
);
400401
if (isListLike) return entry.valueMap.map((v) => parseValue(v));
401402
const obj = {};
@@ -505,7 +506,7 @@ <h3>Restaurant Finder</h3>
505506
props.url.literalString ||
506507
resolvePath(sid, joinPath(ctx, props.url.path));
507508
img.src =
508-
url || "https://via.placeholder.com/400x200?text=No+Image";
509+
url || "https:\/\/via.placeholder.com\/400x200?text=No+Image";
509510
el.appendChild(img);
510511
break;
511512
case "Button":
@@ -533,21 +534,21 @@ <h3>Restaurant Finder</h3>
533534
};
534535
sendMessage(
535536
`DETAILS_JSON:${JSON.stringify(d)}`,
536-
"Loading Form..."
537+
"Loading Form...",
537538
);
538539
} else if (props.action?.name === "submit_booking") {
539540
const inputs = document.querySelectorAll(".a2ui-input-field");
540541
let details = [];
541542
inputs.forEach((i) =>
542-
details.push(`${i.dataset.label}: ${i.value}`)
543+
details.push(`${i.dataset.label}: ${i.value}`),
543544
);
544545
const rName =
545546
resolvePath(sid, "restaurantName") || "the restaurant";
546547
sendMessage(
547548
`User submitted a booking for ${rName}. Details: ${details.join(
548-
", "
549+
", ",
549550
)}`,
550-
"Submitting..."
551+
"Submitting...",
551552
);
552553
} else if (props.action?.name === "back_to_list") {
553554
restoreHistory();
@@ -656,9 +657,8 @@ <h3>Restaurant Finder</h3>
656657
l.style.display = "none";
657658
if (r.uiJson) renderA2UiMessages(r.uiJson);
658659
else if (r.text)
659-
document.getElementById(
660-
"ui-container"
661-
).innerHTML = `<div class="a2ui-card"><p>${r.text}</p></div>`;
660+
document.getElementById("ui-container").innerHTML =
661+
`<div class="a2ui-card"><p>${r.text}</p></div>`;
662662
})
663663
.withFailureHandler((e) => {
664664
alert("Error: " + e.message);

samples/A2UI-Smart-Budget/index.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html>
33
<head>
44
<base target="_top" />
@@ -11,8 +11,9 @@
1111
--bg-color: #f4f6f8;
1212
}
1313
body {
14-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
15-
Helvetica, Arial, sans-serif;
14+
font-family:
15+
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
16+
Arial, sans-serif;
1617
margin: 0;
1718
padding: 0;
1819
background: var(--bg-color);
@@ -202,7 +203,7 @@ <h3>Budget Simulator</h3>
202203
type="text"
203204
id="user-input"
204205
placeholder="Ask about your budget..."
205-
onkeydown="if(event.key==='Enter') handleSend()"
206+
onkeydown="if (event.key === 'Enter') handleSend();"
206207
/>
207208
<button id="send-btn" onclick="handleSend()">Send</button>
208209
</div>
@@ -236,7 +237,7 @@ <h3>Budget Simulator</h3>
236237
if (msg.beginRendering.styles?.primaryColor) {
237238
document.documentElement.style.setProperty(
238239
"--primary-color",
239-
msg.beginRendering.styles.primaryColor
240+
msg.beginRendering.styles.primaryColor,
240241
);
241242
}
242243
}
@@ -247,7 +248,7 @@ <h3>Budget Simulator</h3>
247248
}
248249
if (msg.surfaceUpdate) {
249250
msg.surfaceUpdate.components.forEach(
250-
(c) => (state.components[c.id] = c)
251+
(c) => (state.components[c.id] = c),
251252
);
252253
if (!state.rootId && msg.surfaceUpdate.components.length > 0)
253254
state.rootId = msg.surfaceUpdate.components[0].id;
@@ -401,7 +402,7 @@ <h3>Budget Simulator</h3>
401402
sendMessage(
402403
JSON.stringify(payload),
403404
"update_budget_sheet",
404-
"Updating Sheet..."
405+
"Updating Sheet...",
405406
);
406407
}
407408
};
@@ -428,7 +429,7 @@ <h3>Budget Simulator</h3>
428429
const c = renderComponent(
429430
sid,
430431
ch.template.componentId,
431-
`${ch.template.dataBinding}/${i}`
432+
`${ch.template.dataBinding}/${i}`,
432433
);
433434
if (c) el.appendChild(c);
434435
});
@@ -454,7 +455,7 @@ <h3>Budget Simulator</h3>
454455
if (toolName === "update_budget_sheet") {
455456
const payload = JSON.parse(query);
456457
finalQuery = `Execute update_budget_sheet with these details: ${JSON.stringify(
457-
payload
458+
payload,
458459
)}`;
459460
}
460461

@@ -464,9 +465,8 @@ <h3>Budget Simulator</h3>
464465
stText.innerText = "Ready";
465466
if (r.uiJson) renderA2UiMessages(r.uiJson);
466467
else if (r.text) {
467-
document.getElementById(
468-
"ui-container"
469-
).innerHTML = `<div class="a2ui-card"><p>${r.text}</p></div>`;
468+
document.getElementById("ui-container").innerHTML =
469+
`<div class="a2ui-card"><p>${r.text}</p></div>`;
470470
}
471471
})
472472
.withFailureHandler((e) => {

0 commit comments

Comments
 (0)