Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9,071 changes: 7,624 additions & 1,447 deletions client/android/GoogleMapsA2UI/src/main/assets/index.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ class A2UIAttributionIdTests {
val htmlContent = InputStreamReader(inputStream).readText()

assertTrue(
"Expected the generated attribution ID to contain the Web identifier 'gmp_web_maui_v0.1.9_atoui'",
htmlContent.contains("gmp_web_maui_v0.1.9_atoui"),
"Expected the generated attribution ID to contain the Web identifier 'gmp_web_maui_v0.1.10_atoui'",
htmlContent.contains("gmp_web_maui_v0.1.10_atoui"),
)
assertTrue(
"Expected the generated attribution ID to contain the Android identifier 'gmp_android_maui_v0.1.9_atoui'",
htmlContent.contains("gmp_android_maui_v0.1.9_atoui"),
"Expected the generated attribution ID to contain the Android identifier 'gmp_android_maui_v0.1.10_atoui'",
htmlContent.contains("gmp_android_maui_v0.1.10_atoui"),
)
assertTrue(
"Expected the generated attribution ID to contain the combined Web and Android identifier string 'gmp_web_maui_v0.1.9_atoui,gmp_android_maui_v0.1.9_atoui'",
htmlContent.contains("gmp_web_maui_v0.1.9_atoui,gmp_android_maui_v0.1.9_atoui"),
"Expected the generated attribution ID to contain the combined Web and Android identifier string 'gmp_web_maui_v0.1.10_atoui,gmp_android_maui_v0.1.10_atoui'",
htmlContent.contains("gmp_web_maui_v0.1.10_atoui,gmp_android_maui_v0.1.10_atoui"),
)
}
}
2 changes: 1 addition & 1 deletion client/android/web_build/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {customElement} from 'lit/decorators.js';
import {A2UICoreShell} from './core-shell';

(window as any)['A2UI_ATTRIBUTION_ID'] =
'gmp_web_maui_v0.1.9_atoui,gmp_android_maui_v0.1.9_atoui';
'gmp_web_maui_v0.1.10_atoui,gmp_android_maui_v0.1.10_atoui';

const PLACE_CARD_THUMBNAIL_MIN_WIDTH = 350;

Expand Down
9,068 changes: 7,621 additions & 1,447 deletions client/ios/GoogleMapsA2UI/Sources/GoogleMapsA2UI/Resources/index.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions client/ios/GoogleMapsA2UI/Tests/A2UIAttributionIdTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ final class A2UIAttributionIdTests: XCTestCase {
let htmlString = localContent.html

XCTAssertTrue(
htmlString.contains("gmp_web_maui_v0.1.9_atoui"),
"Expected the generated attribution ID to contain the Web identifier 'gmp_web_maui_v0.1.9_atoui'"
htmlString.contains("gmp_web_maui_v0.1.10_atoui"),
"Expected the generated attribution ID to contain the Web identifier 'gmp_web_maui_v0.1.10_atoui'"
)
XCTAssertTrue(
htmlString.contains("gmp_ios_maui_v0.1.9_atoui"),
"Expected the generated attribution ID to contain the iOS identifier 'gmp_ios_maui_v0.1.9_atoui'"
htmlString.contains("gmp_ios_maui_v0.1.10_atoui"),
"Expected the generated attribution ID to contain the iOS identifier 'gmp_ios_maui_v0.1.10_atoui'"
)
XCTAssertTrue(
htmlString.contains("gmp_web_maui_v0.1.9_atoui,gmp_ios_maui_v0.1.9_atoui"),
"Expected the generated attribution ID to contain the combined Web and iOS identifier string 'gmp_web_maui_v0.1.9_atoui,gmp_ios_maui_v0.1.9_atoui'"
htmlString.contains("gmp_web_maui_v0.1.10_atoui,gmp_ios_maui_v0.1.10_atoui"),
"Expected the generated attribution ID to contain the combined Web and iOS identifier string 'gmp_web_maui_v0.1.10_atoui,gmp_ios_maui_v0.1.10_atoui'"
)
}
}
2 changes: 1 addition & 1 deletion client/ios/web_build/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {type PropertyValues} from 'lit';
import {A2UICoreShell} from './core-shell';

(window as any)['A2UI_ATTRIBUTION_ID'] =
'gmp_web_maui_v0.1.9_atoui,gmp_ios_maui_v0.1.9_atoui';
'gmp_web_maui_v0.1.10_atoui,gmp_ios_maui_v0.1.10_atoui';

const PLACE_CARD_THUMBNAIL_MIN_WIDTH = 350;

Expand Down
2 changes: 1 addition & 1 deletion client/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@googlemaps/a2ui",
"version": "0.1.9",
"version": "0.1.10",
"description": "Maps Agentic UI Toolkit Library",
"main": "./dist/src/lit/index.js",
"types": "./dist/src/lit/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions client/web/src/lit/custom-components/google_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ export class GoogleMap extends A2uiLitElement<typeof GoogleMapApi> {
color-scheme=${this.colorScheme ?? nothing}
map-id="2d6e1a27a57efe3c9479f6fc"
internal-usage-attribution-ids="${
(window as any)['A2UI_ATTRIBUTION_ID'] || 'gmp_web_maui_v0.1.9_atoui'}"
(window as any)['A2UI_ATTRIBUTION_ID'] || 'gmp_web_maui_v0.1.10_atoui'}"
>${
routes.map(
(route: any) => html`
Expand All @@ -434,7 +434,7 @@ export class GoogleMap extends A2uiLitElement<typeof GoogleMapApi> {
autofits-camera
internal-usage-attribution-ids="${
(window as any)['A2UI_ATTRIBUTION_ID'] ||
'gmp_web_maui_v0.1.9_atoui'}"
'gmp_web_maui_v0.1.10_atoui'}"
></gmp-route-3d>`)}
</gmp-map-3d>
</section>
Expand Down
2 changes: 1 addition & 1 deletion client/web/src/lit/custom-components/google_map_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('GoogleMap Component', () => {

// 4. Assert that the attribute has the correct fallback ID
const attrId = gmpMap3d!.getAttribute('internal-usage-attribution-ids');
expect(attrId).toBe('gmp_web_maui_v0.1.9_atoui');
expect(attrId).toBe('gmp_web_maui_v0.1.10_atoui');

// Cleanup
document.body.removeChild(element);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ export class PlaceDetailsCompact extends
<gmp-place-details-compact orientation="${orientation}"
place="${placeId}"
internal-usage-attribution-ids="${
(window as any)['A2UI_ATTRIBUTION_ID'] || 'gmp_web_maui_v0.1.9_atoui'}">
(window as any)['A2UI_ATTRIBUTION_ID'] ||
'gmp_web_maui_v0.1.10_atoui'}">
<gmp-place-details-place-request place="${placeId}">
</gmp-place-details-place-request>
<gmp-place-content-config>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('PlaceDetailsCompact Component', () => {
// 4. Assert that the attribute has the correct fallback ID
const attrId =
detailsCompact!.getAttribute('internal-usage-attribution-ids');
expect(attrId).toBe('gmp_web_maui_v0.1.9_atoui');
expect(attrId).toBe('gmp_web_maui_v0.1.10_atoui');

// Cleanup
document.body.removeChild(element);
Expand Down
11 changes: 11 additions & 0 deletions client/web/src/lit/custom-components/place_pin_marker_constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,17 @@ export const PLACE_PIN_MARKER_STYLES: CSSResult = css`
height: 20px;
border-radius: 50%;
z-index: 1;
/*
* The glyph SVGs are laid out inline on the text baseline, so the line box
* (and therefore the per-category offsets below) depends on the inherited
* text metrics. Pin them here, matching the marker labels' font, so a host
* page's global typography (e.g. a larger line-height or font-size on
* :root or body, which would otherwise be inherited) cannot shift the
* glyph inside the disc.
*/
font-family: "Google Sans", sans-serif;
font-size: 16px;
line-height: normal;
/*
* The per-POI circle colors are set as custom properties on the element
* (see createPlacePinMarkerTemplate) so that both palettes travel with the
Expand Down
42 changes: 42 additions & 0 deletions client/web/src/lit/custom-components/place_pin_marker_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,48 @@ describe('PlacePinMarker Module', () => {
expect(css).not.toContain('light-dark(#4c3cff');
});

it('keeps the glyph position independent of host page typography', () => {
/** Returns the glyph's offset inside its disc under the given host font. */
function glyphOffset(hostFont: string): {top: number, left: number} {
const host = document.createElement('div');
host.style.font = hostFont;
document.body.append(host);
try {
const root = host.attachShadow({mode: 'open'});
root.adoptedStyleSheets = [PLACE_PIN_MARKER_STYLES.styleSheet!];
const template = createPlacePinMarkerTemplate({
label: 'Cafe',
placePrimaryType: 'food_and_drink',
});
// The builder appends to the <template> element itself (that is what
// <gmp-marker> consumes), so mount its children in a marker wrapper.
const marker = document.createElement('div');
marker.classList.add('custom-marker');
for (const child of Array.from(template.childNodes)) {
marker.append(child.cloneNode(true));
}
root.append(marker);
const icon =
root.querySelector('.custom-marker-content-icon') as HTMLElement;
const svg = icon.querySelector('svg')!;
const iconRect = icon.getBoundingClientRect();
const svgRect = svg.getBoundingClientRect();
return {
top: svgRect.top - iconRect.top,
left: svgRect.left - iconRect.left,
};
} finally {
host.remove();
}
}

const baseline = glyphOffset('16px/normal sans-serif');
// Mirrors the React sample's `:root { font: 18px/145% ... }`, plus an
// exaggerated case.
expect(glyphOffset('18px/145% sans-serif')).toEqual(baseline);
expect(glyphOffset('40px/3 serif')).toEqual(baseline);
});

it('calculates latitude z-index so southern position gets higher z-index',
() => {
const northZ = calculateLatitudeZIndex(47.6062); // Seattle
Expand Down
Loading