Skip to main content

sharemap_maplib_flutter 1.3.1 copy "sharemap_maplib_flutter: ^1.3.1" to clipboard
sharemap_maplib_flutter: ^1.3.1 copied to clipboard

A MapLibre-based map widget for Flutter integrating ShareMap APIs, supporting dynamic POI layer toggling, HMAC-signed requests, and custom style loading.

Chưa phát hành #

1.3.1 — 2026-11-26 #

Sửa lỗi — rasterize marker ở DPR cao #

  • Sửa ghép ảnh marker có số và ảnh marker có viền để không áp dụng tỉ lệ device-pixel hai lần. Trên Flutter Web DPR 2, marker điểm dừng của route trước đây có thể chỉ hiện một phần tư hình tròn; icon có viền cũng có thể bị crop hoặc lệch.

1.3.0 — 2026-11-25 #

Nâng cấp dependency MapLibre #

  • Nâng sharemap_maplibre_gl lên 0.28.0+sharemap.1, dùng bản đã publish với hỗ trợ transformRequest.
  • Nâng mức SDK tối thiểu lên Dart 3.12.0 và Flutter 3.44.0 theo dependency.

Thêm — route 1.5: routeType: "direct-route" — tuyến nối thẳng cho máy bay · tàu hoả · tàu thuỷ (2026-11-17) #

  • Theo spec ai-map-protocol/docs/superpowers/specs/2026-11-17-route-direct-route-design.md, components doc 10.6 "Chế độ direct-route" và thiết kế sharemap-route 2.10 / 3.6 / 6.9. kComponentVersions['route'] → 1.5. Như lib React.
  • Hình học engine tự sinh (component_direct_route.dart, thuần Dart): pathMode geodesic (mặc định — slerp trên mặt cầu, segments: "auto" = clamp(ceil(góc tâm × 2), 8, 128); hai điểm đối cực > 179.9° → đoạn thẳng Mercator) · arc (Bézier bậc hai trong Web Mercator, đỉnh vòm cao bulge × L, side trái / phải chiều đi, auto = 64). curve { bulge, side, segments } giải theo từng khoá: chặng → route → mặc định (0.15, left, auto). Kinh độ mở cuộn theo cung ngắn rồi cắt hai nhánh tại ±180°. Đỉnh sinh làm tròn 6 chữ số, điểm neo giữ nguyên.
  • Điểm neo = vị trí các điểm dừng khi route có ≥ 2 điểm dừng và mọi điểm đều biết vị trí (kể cả markerRef); còn tham chiếu đang chờ / không điểm dừng → các đỉnh coordinates (khi đó chặng không áp). Marker được trỏ bị dời / tới muộn → đường cong tính lại. Hai điểm neo cách nhau < 1 m → khúc không vẽ. Không có đoạn nối (stopConnectors vô hiệu).
  • Biên dịch: mỗi khúc một feature {id}/direct/{i} (sm:role: "line", sm:part: "direct", sm:section: i, sm:option: 0; MultiLineString hai nhánh khi bị cắt tại ±180°). Nét của khúc gộp năm tầng route.default.direct ← preset .direct ← leg.vehicles[vehicleType].direct ← style.direct ← legs[i].style.direct. Nhãn + mũi tên chạy dọc polyline đã sinh; nhãn không chạy qua khúc có chú thích. Chú thích chặng: at theo chiều dài dọc đường cong của khúc (đo trong Web Mercator); rotate: true → icon xoay theo phương vị tiếp tuyến (0–359°, glyph vẽ chĩa lên) và xoay cùng bản đồ; chip luôn thẳng đứng, dạt trái khi tiếp tuyến lệch trục dọc < 30°. bbox / fitBounds trên polyline đã sinh + điểm dừng, kinh độ mở cuộn (tuyến qua 180° có kinh độ ngoài ±180 — camera ôm Thái Bình Dương). Chấm / huy hiệu số mặc định = màu nét của khúc đầu tiên (chặng from: 0); derived.color cũng vậy. Marker along và animation trên direct-route chạy theo polyline đã sinh.
  • Pha A (mọi lỗi SCHEMA_INVALID tại đúng khoá): pathMode / curve / style.direct ngoài direct-route; style.line|done|… trong direct-route; plane · train · ship chỉ trong direct-route, bus · coach · truck · van chỉ ngoài; legs[].pathMode|curve|style chỉ trong direct-route; chặng to ≠ from + 1; direct-route không nhận progress, alternatives, selectedOptionIndex ≠ 0, day, transition; casing.widthPx ≥ widthPx kiểm trên nét đã gộp của route và từng chặng. update đổi loại rời / vào direct-route: bỏ pathMode, curve, ghi đè nét của loại cũ, legs về [] (trừ khi gửi kèm legs). update curve thay cả object.
  • Theme: token route.default.direct + route.default.leg.vehicles.{plane,train,ship} (glyph, màu, direct); preset muted khai direct.opacity: 0.35. Theme riêng chưa khai → số đo sharemap (kDirectFallback, LegStyle.vehicleDirect). Bộ glyph thêm plane · train · ship (61 glyph) — dùng cho icon.glyph của marker và icon.name của chú thích. mapContext: routeType: "direct-route", legs gọn với vehicleType mới (không xuất pathMode / curve).
  • Layer mới, dựng lười (MapLibre Native không đọc line-dasharray / line-cap theo feature): nét đứt của khúc có mẫu / đầu nét khác hằng của layer dash lên layer biến thể sm-route-{grp}-dash-{a}x{b}-{cap} (feature mang sm:dvar) — plane [2.5, 2], train [0.5, 1.5] đầu butt, ship [0.3, 1.7] vẽ đúng mẫu. Icon chú thích xoay nằm ở sm-route-{grp}-annotation-map (sm:role: "annotation-map", icon-rotation-alignment: map, icon-pitch-alignment: viewport); góc nướng vào ảnh vẽ ở tỉ lệ điểm ảnh của máy.
  • Khoảng lệch còn lại (bảng B14 của doc/ios-android-chua-ho-tro.md): layer casing và layer line (nét liền) vẫn một line-cap hằng theo theme (round) — viền của khúc train (đầu butt) có đầu tròn nhô ~3 px ở hai mút (nằm dưới marker điểm dừng), nét liền cap: "butt" | "square" vẫn vẽ round; route loại khác (walking, phương án B…) vẫn dùng một mẫu đứt chung như trước. Icon xoay: bản đồ hướng bắc thì ảnh lấy mẫu 1:1; khi người dùng xoay bản đồ MapLibre nội suy LINEAR lúc xoay (mềm hơn nhẹ). Chưa đo trên máy thật.
  • Facade: SMRoute(pathMode:, curve:). Demo web: màn "Route 1.5" (direct_route_screen.dart) — bay TP.HCM → Cam Ranh (arc, markerRef, icon xoay + chip), tàu hoả Sài Gòn → Nha Trang, Tokyo → Los Angeles geodesic qua 180°, ba điểm dừng bay + tàu thuỷ. Hằng nhúng theme / bộ glyph / schema theme / schema command và fixture ví dụ sinh lại từ protocol.

Đổi — popup 1.2: thẻ neo marker mặc định đóng, mỗi lúc một thẻ neo mở #

  • Popup có anchorTo mà add không ghi open → đóng; người dùng bấm marker mới mở (openOnAnchorClick). Popup không neo bỏ open vẫn mở. Chỉ áp lúc add — update bỏ open giữ trạng thái đang có. App nào cần thẻ neo mở sẵn phải ghi open: true (cả facade SMPopup(anchorTo: …)).
  • Người dùng mở một thẻ neo (bấm marker, ComponentEngine.setOpen(id, true)) → engine đóng các thẻ neo khác đang mở (close by: "user"). Thẻ không neo và thẻ mở bằng lệnh không bị ảnh hưởng. Tắt bằng ShareMapLibre(exclusiveAnchoredPopups: false) / ComponentEngine(exclusiveAnchoredPopups: false).
  • Xuất cấu hình (export, đồng bộ) in open khi khác mặc định mới; trần 10 popup mở cùng lúc đếm theo trạng thái mở thật.
  • kComponentVersions['popup'] → 1.2.

1.2.1 #

  • SHAR-2030 — ShareMapLibre.layerCodes nhận URL tile POI ShareMap đầy đủ cho get_pois_layer_mvt và get_pois_layer_by_admin_mvt. Nguồn sharemaplayers dùng URL POI ShareMap đầu tiên trong danh sách, giữ tham số truy vấn đã truyền. Khi URL có t hoặc token khác rỗng, SDK dùng token đó và bỏ qua bước gắn token tự động và ký HMAC cho request.
  • Map Agent — Thêm API gợi ý @mention và dựng payload.references cho marker, route, trip-plan và popup độc lập. Chat giữ nguyên nội dung hiển thị và có thể gửi prompt riêng cho agent. Với câu đang chờ, tham chiếu được dựng lúc gửi để dùng trạng thái bản đồ mới nhất.
  • Hiển thị marker — Canh mũi ghim neo đáy đúng tọa độ, đồng bộ hình ghim dự phòng với sprite và tính lại khoảng cách cho popup neo vào marker.
  • Phiên bản package/SDK là 1.2.1; AI Map Protocol vẫn là 2.0.0.

1.2.0 #

Lưu ý nâng cấp từ 1.1.0 #

  • ShareMapLibreController.refreshTiles() không còn tham số visiblePoiTypes.
  • AiSharemapAgent / AiSharemapAgentOptions đổi tên thành AiShareMapAgent / AiShareMapAgentOptions.
  • Phiên bản package/SDK là 1.2.0; phiên bản AI Map Protocol vẫn là 2.0.0.

Thêm — đổi server layers: ShareMapLibre.setLayersBaseUrl (2026-10-28) #

  • Trước đây host layers cố định theo mode (layers.sharemap.live / dev-layers.sharemap.live). Nay ShareMapLibre.setLayersBaseUrl(url) đổi cho cả thư viện: tile POI của layerCodes ({url}/sharemap.get_pois_layer_mvt/{z}/{x}/{y}?…, giữ tiền tố đường dẫn / cổng / http) và ShareMapPoiService không tự khai baseUrl; map đang mở có layer POI tải lại style ngay; null = về mặc định. Đọc lại bằng ShareMapLibre.layersBaseUrl(mode). ShareMapPoiService(baseUrl: …) đặt riêng một service. URL sai (không http(s), thiếu host, có query / fragment) → ArgumentError. Xác thực không đổi: x-api-key HMAC như cũ, token ?t= chỉ cho domain layers của ShareMap. React không cần tương đương: app tự truyền URL tile qua attachSharemapPois.

Thêm — marker 1.4 thẻ nhãn + route 1.4 mũi tên chỉ hướng (2026-10-28) #

  • Theo sharemap-ai-design-component (marker 3.6 / 3.6.1, route 2.9, animation 2.2) và protocol marker.md 6.2 "Thẻ nhãn", route.md 7.2 "Mũi tên chỉ hướng". kComponentVersions marker / route 1.4. Như lib React.
  • Thẻ nhãn: label nhận { title, subtitle?, color?, backgroundColor?, border?, position?, pointer? } — ảnh engine vẽ (sm-labelcard-…, RasterImage.content = hộp phần đục), feature {id}/label (sm:role: "label") của chính marker, không xoay, không theo scale; icon căn theo bản đồ → thẻ ở nhóm viewport. Khe gapPx (5) đo tới mép phần đục của icon (alpha ≥ 10 %, opaqueBox) theo góc đang vẽ (rotatedVerticalExtents, trừ hướng bản đồ khi icon căn theo bản đồ); animation tính lại sm:offset mỗi khung. Token theme marker.labelCard; mapContext label = title · subtitle.
  • Mũi tên: metadata.showDirectionArrows + arrowColor / arrowSize / arrowSpacingPx / arrowRotate / arrowImageUrl (lỗi tải → chevron dựng sẵn). Khoá sm:arrow (+ sm:asize / sm:arot / sm:aspace khi khác theme) trên mọi feature nét; layer mới sm-route-{grp}-arrow (biến thể -{N} cho khoảng lặp khác) giữa line và label, có bản chuyển động. Nhóm z0 nay 8 layer. Token theme route.default.arrow.
  • Icon sprite dùng thẳng (không qua rasterizer) đo phần đục từ atlas (spriteContentBox). Facade: SMMarker.label / setLabel nhận chuỗi hoặc map, helper SMLabel.card(title, subtitle: …). Demo web Components: xe tải mang thẻ nhãn, tuyến giao có mũi tên. Hằng nhúng theme / schema theme / schema command sinh lại từ protocol.

Sửa — camera follow của animation làm icon POI giật (Flutter web) #

  • MapLibre GL JS lấy mẫu ảnh icon NEAREST khi bản đồ chỉ dịch mà pitch == 0; follow dời camera lẻ pixel mỗi khung làm icon POI nhảy lệch khỏi nhãn. Web: khi bản đồ phẳng tuyệt đối, follow đặt kèm pitch kFollowPitchEpsilon (0.001°) → icon LINEAR, trôi mượt cùng bản đồ; camera vẫn trôi lẻ pixel (không làm tròn — làm tròn thì cả bản đồ nhích từng nấc). Hết marker để theo (tạm dừng, tới đích, tắt follow, gỡ animation) thì pitch về 0. Native không đổi (MapLibre Native lấy mẫu LINEAR khi camera đang đổi). Như lib React.

Thêm — component animation 1.0: marker chạy theo route (2026-10-27) #

  • Component mới animation (components doc chương 15 — ai-map-protocol/themes/components/animation.md; spec docs/superpowers/specs/2026-10-27-animation-component-design.md): { type: "animation", id: "{origin}-animation-{17 số}", bindings: [{ routeId, markers: [{ markerId, at?, speed (km/h), easing?, rotate?, playing? }] }], playing?, fill? (hold · reset), follow? ({ mode: center · edge, markerId }), events? (start · pause · resume · finish), properties?, tags? }; seek ∈ [0, 1] là chỉ thị của update (không lưu). Không vẽ gì riêng (như trip-plan); route là route thường (visible: false vẫn cho hình học); kComponentVersions.animation = '1.0', protocol vẫn 2.0.0.
  • Pha A (15.2, không mã lỗi mới): hình dạng (marker thiếu speed, durationMs, easing / fill lạ, seek trong add / ngoài [0, 1], remove kèm trường) → SCHEMA_INVALID; trên sổ sau action: route / marker thiếu → COMPONENT_NOT_FOUND, khác origin → NAMESPACE_VIOLATION, route < 2 điểm khác nhau / marker along / không lngLat / là điểm dừng sở hữu → SCHEMA_INVALID, marker trong hai binding (mọi animation) → COMPONENT_DEPENDENCY_CONFLICT; gỡ (hay đổi hỏng) route / marker còn trong bindings → COMPONENT_DEPENDENCY_CONFLICT tại phần tử gây ra, repair nêu id animation; gỡ cùng lúc animation + route + marker thì được. Trần 20 animation mỗi origin, 50 binding / 200 marker mỗi animation (PAYLOAD_TOO_LARGE). get animation chỉ nhận id · tags · limit.
  • update bindings gộp theo khoá (mergeAnimationBindings): binding theo routeId, marker theo markerId gộp từng trường, null về mặc định, { markerId | routeId, remove: true } bỏ, binding hết marker bỏ, hết binding → SCHEMA_INVALID, marker trùng do gộp → COMPONENT_DEPENDENCY_CONFLICT (trùng trong một add → SCHEMA_INVALID). Component Memory: byAnimatedMarker / byAnimatedRoute, animationOf(markerId), animationsOn(routeId), ComponentEntry.animationBindings.
  • Chạy (component_animation.dart, hàm thuần + đồng hồ của host): quãng đường địa lý haversine (R = 6371008.8 m) trên hình học đang vẽ (phương án chọn), s(t) = s₀ + D · ease(t / T), T = D / v; easing cubic-bezier CSS (khớp bảng 100 m / 36 km/h của tài liệu thiết kế); tạm dừng đóng băng thời gian lẫn đường cong; đổi speed / easing giữ vị trí (đoạn mới); đổi at / binding / hình học / phương án route / add lại → chạy lại từ at (phát lại start); seek dời mọi marker, 1 phát finish từng marker chưa xong (kể cả đang dừng), < 1 đưa marker đã xong về chạy; fill; marker chưa chạy đứng ở điểm at; gỡ animation / bỏ khỏi binding → về lngLat; rotate = hướng cạnh (+ rotation, ở đỉnh lấy cạnh sau, căn theo bản đồ); reducedMotion nhảy thẳng tới cuối (vẫn phát sự kiện).
  • Vẽ: marker đang chạy biên dịch vào sm-anim-points (layer sm-anim-marker-{grp}, icon-rotate theo dữ liệu, nay nhận bấm — bấm xe = bấm marker), mỗi khung một setGeoJsonSource cho mọi marker; dừng / xong → biên dịch lại về sm-points (im lặng). Vòng khung hình Timer cùng nhịp frameInterval với transition, tự dừng khi không còn marker chạy; tickAnimations() cho test. Marker trong binding (chạy hay không) không kéo được; popup neo chạy theo; visible() đếm cả nó. Đang chạy → hasTransitions (mapContext settled: false, như layer animation).
  • follow: center mỗi khung moveCamera(newLatLng); edge hỏi toScreenLocationBatch tối đa mỗi 100 ms, marker cách mép < 120 px thì moveCamera(scrollBy) vừa đủ về lại 120 px; không xếp hàng lời gọi camera. Ngay sau một lệnh animation có follow, camera tới marker được theo một lần (kể cả khi nó đứng yên).
  • Sự kiện (15.5): vỏ chung type: "animation" + ComponentEvent.params ({ routeId, markerId }, finish thêm remaining), chỉ sự kiện đã khai, sau sự kiện vòng đời của đoạn; không phát updated theo khung; update chỉ có seek áp nhưng không phát updated (không skippedByDiff); seek: 1 với marker chưa từng chạy chỉ phát finish.
  • mapContext (15.6): mục { type, id, origin, visible: true, playing, fill, routeCount, markerCount, finished, follow? }, marker trong binding mang animatedBy; count.byType.animation. get → state: { finished }.
  • Đồng bộ: cấu hình animation đi như mọi component (vị trí không bao giờ ghi); áp từ xa dùng animationSyncItem (bản vá kèm remove / null vì bindings gộp theo khoá); animation tới trước route / marker thì chờ; gỡ từ xa gỡ animation trước. Người dùng gỡ marker / route đang chạy (removeByUser, nút Xóa) → animation bỏ nó (dropAnimatedRemoved, hết binding thì gỡ theo).
  • Facade SMAnimation (+ SMAnimationBinding, SMAnimationMarker): play / pause / seek(k) / restart / setSpeed / setEasing / setMarkerPlaying / setFill / setFollow / replace, onStart / onPause / onResume / onFinish (tự khai events). Xuất thêm cubicBezier, animationEase, haversineMeters, AnimationPath, kAnimationEasings / kAnimationFills / kAnimationFollowModes, ComponentEngine.animationState(id).
  • Schema lệnh nhúng (amjson_command_schema.dart) sinh lại từ protocol; fixture schema + ví dụ component-animation*.

Thêm — đồng bộ Component Memory nhiều máy + API host còn thiếu so với React (2026-10-27) #

  • Đồng bộ component (sharemap-mymap/docs/component_memory_sync.md mục 3–13, port component/sync/* của React): hợp đồng ComponentSyncTransport (user? · clientId · subscribe(onChanges, onError) lần đầu initial · write(ops, mirror)), SyncDoc / SyncDocMeta / SyncBatch / SyncOp (SyncSetOp · SyncDeleteOp) / MirrorOp / RemoteChange — toJson / fromJson đúng hình doc của bản web (nháp không batch.seq / by.client). Codec: kSharedTag, isSyncedEntry (ai-* ∪ app-* tag shared, trừ điểm dừng), toDocBody (trip-plan routes → routeIds theo day, popup bỏ open), nestPlans, encodeNestedArrays / decodeNestedArrays (quy ước { "$a": [...] }).
  • ComponentEngine.sync(transport, {onError, onStatus}) → ComponentSyncStop (void Function({bool keepComponents})): gom sự kiện vòng đời + lớp phủ state theo microtask thành MỘT write, chờ snapshot đầu rồi mới ghi, khử vang theo client, áp từ xa từng gói (gói hỏng → áp lẻ, item hỏng bỏ qua + onError), popup chờ marker neo tới sau, popup từ xa mặc định đóng, đổi chủ mang dấu gốc, ẩn / hiện theo visible; connecting → live → error (nghe hỏng: tự dừng, gỡ component đã đồng bộ). Dừng mặc định gỡ mọi component đã đồng bộ của kho; keepComponents: true chỉ huỷ nghe.
  • Áp từ xa: ComponentEngine.applyRemoteComponents(actions, origin) → Future<RemoteApplyResult> — Pha A với ComponentValidateEnv(remote: true, pendingRefs: true) (cấu hình đi nguyên, tham chiếu marker đang chờ được nhận) rồi Pha B, phát sự kiện như thường. Khoá chung với batch: ComponentHost.withRemoteLock / runHostAction / applyingRemote (ShareMapEngine hiện thực) — executeBatch chờ lần áp từ xa đang chạy, lần áp chờ batch đang chạy; adopt / removeByUser đi runHostAction để sự kiện của chúng không bị coi là «từ xa». adoptRemote(id, AdoptedStamp).
  • ComponentEntry.adopted (AdoptedStamp {by, at} — «người dùng đã chọn», 13.6) sống qua update / thay / kéo / đổi chủ; sync ghi khi người dùng máy này adopt. ComponentEngine.onStateChanged(listener): kéo / đặt marker, chọn phương án, mở / đóng popup (người dùng / setOpen / bấm marker), nhập ô — những thay đổi không phát updated.
  • ShareMapLibre(sync:, onSyncError:, onSyncStatus:) — ComponentSyncBinding (port syncBinding.ts): đổi transport (identity) → dừng sync cũ (gỡ component kho cũ) rồi gắn mới; widget gỡ → chỉ huỷ nghe. Có sync thì engine được dựng.
  • Package mới packages/sharemap_maplib_flutter_firebase (lõi KHÔNG phụ thuộc Firebase): firestoreComponentSync( firestore:, mapRef:, userId:, clientId:, mirror:) — cùng layout sharemaps/{id}/mapComponents/{componentId} + mapComponentsSeq cấp trong transaction, by.client, updatedAt serverTimestamp, $a, hook gương FieldUpdate ghi cùng transaction. Phần chạm SDK sau FirestoreSyncBackend (bản thật CloudFirestoreSyncBackend), test bằng backend giả.
  • exportOf(id) (cấu hình đã gộp lớp phủ, null khi không có), setHidden(id, hidden) (ẩn chỉ trên lớp vẽ máy này: ComponentEntryState.hidden, visible / export / mapContext giữ, không sự kiện, không onStateChanged, sống qua update kể cả từ xa, marker ẩn kéo theo popup neo; false khi id không có), visible({type}) → Future<List< ComponentEntry>> (queryRenderedFeaturesInRect trên layer cố định trừ anim / đoạn nối + popup đang mở; cần viewportSize — thiếu thì StateError), newId(type).
  • GlyphIcon (widget, CustomPainter vector — sắc ở mọi pixelRatio) + glyphSvgMarkup(glyph:, color:, size:, style:) (trùng từng ký tự bản React — test so fixture sinh từ dist/glyphs.js) + paintGlyphIcon: một hình học chung với ảnh engine (rasterizer nay gọi paintGlyphIcon).
  • Khác bản web: visible() bất đồng bộ; Transaction.update của FlutterFire không nhận FieldPath nên doc gốc ghi bằng set(…, SetOptions(mergeFields: [FieldPath…])) (key có dấu chấm vẫn an toàn; doc gốc chưa có → lỗi như update); khoá so thân doc dùng JSON chuẩn hoá (khoá sắp xếp) thay JSON.stringify — doc từ kho khác thứ tự khoá không gây ghi thừa; tham số userId thay user: { id }.

Thêm — route 1.3: chặng đa phương tiện legs[] + chú thích chặng annotations[] (theo React, 2026-10-27) #

  • route.legs[] { from, to?, vehicleType?: bus|coach|truck|van, annotations? } theo chỉ số stops[] (spec ai-map-protocol/docs/superpowers/specs/2026-10-27-route-legs-annotations-design.md). Pha A: khoá lạ, vehicleType lạ, placement ≠ center, chữ > 60, chú thích không ra icon → SCHEMA_INVALID; icon.name ngoài bộ glyph → ICON_NOT_FOUND; sau gộp 0 ≤ from ≤ n−2, from < to ≤ n−1, cặp (from, to) không trùng.
  • Gộp: legs thay cả mảng, null / [] bỏ; update gửi stops không kèm legs mà dãy id điểm dừng đổi → bỏ legs (luật nằm ở Pha A vì cấu hình route Flutter không mang stops). Gỡ điểm dừng ngoài command route (marker sở hữu / marker được tham chiếu) → chặng chạm nó bỏ, chỉ số sau lùi (legsWithoutStops); updated ["legs", "stops"].
  • Hiển thị: feature {routeId}/leg/{i}/annotation/{k} (+ /label) trên sm-lines, layer mới sm-route-{grp}-annotation trên label (không bản anim, nhận bấm = bấm route, không đổi phương án đang chọn). Neo ở đoạn thẳng ngang dài nhất của chặng (legAnchorPoint); chip trên / dưới icon, dạt trái khi đoạn dọc — độ dời nướng vào lề trong suốt của ảnh, không sm:offset. Nhãn tuyến thành phần bù (MultiLineString). Ảnh sm-legicon-{glyph}-{băm} / sm-legchip-{băm} vẽ dart:ui theo pixelRatio.
  • Theme route.default.leg (LegStyle, theme riêng thiếu → số đo sharemap); bộ glyph thêm coach, truck, van (58); mapContext route có legs: [{ from, to, vehicleType?, label? }]; kComponentVersions.route = '1.3'. Facade SMRoute(legs: …) như bản web.
  • Khác bản web: layer annotation để icon-size = hằng tỉ lệ ảnh của engine (1 / pixelRatio trên Android / web — bytes addImage là 1x; 1 trên iOS) thay cho 1 cố định.

Thêm — marker 1.3: icon glyph (tròn nền màu + glyph trắng) (theo React 2.2.0, 2026-10-24) #

  • Icon { glyph, color?, sizePx? }: glyph = location hoặc một trong 54 loại place — bộ glyph nhúng component_glyphs_sharemap.dart (GENERATED từ ai-map-protocol/themes/glyphs/sharemap-glyphs.json, test so fixture). Tên lạ → ICON_NOT_FOUND.
  • Thiếu color: Pha A ghi màu loại hay màu cố định theo id (distinctGlyphColor, trùng bản JS) vào cấu hình. ComponentEngine(defaultMarkerIcon: 'location'): marker add không icon nhận { glyph: 'location', color } (không áp cho update, điểm dừng route). ComponentValidateEnv.remote cho đường áp từ xa.
  • Vẽ vector (path_parsing → Path) ở pixelRatio, ảnh sm-glyph-{tên}-{màu}-{Ø}; nhãn cách mép dưới hình tròn 3 px; huy hiệu route 1.2 theo hộp tròn. capabilities.glyphs[], token theme marker.default.glyph, kComponentVersions.marker = '1.3'.
  • Phụ thuộc mới: path_parsing ^1.1.0.

Thêm — route 1.2 / marker 1.2: điểm dừng tham chiếu marker + hàng huy hiệu số (theo React 2.1.0, 2026-10-24) #

  • route.stops[] nhận { type: "markerRef", id } — trỏ marker đã có (place đã lưu, marker AI); route không vẽ lại, không sở hữu. Pha A: đúng hai khoá, id là id marker (SCHEMA_INVALID); lệnh ai trỏ marker không có trong sổ / items → COMPONENT_NOT_FOUND tại stops/i/id (chỉ khi route thật sự gửi stops); host (app) cho phép tham chiếu đang chờ; ComponentValidateEnv.pendingRefs cho đường đồng bộ (Flutter chưa có đường sync — cờ để sẵn). Route ai trỏ được place app. Trần số: stopNumberStart + stops.length − 1 ≤ 99 đếm cả tham chiếu.
  • Sổ: ComponentEntry.stopIds là thứ tự đầy đủ của stops (sở hữu + tham chiếu), stopRefs đánh dấu vị trí tham chiếu (isRefAt, refIds, ownedStopIds); số trên chấm = stopNumberStart + vị trí đầy đủ (map = mapContext). ComponentMemory.byRef / refsTo(markerId) (theo seq, có cả khi marker chưa tới).
  • Vòng đời: gỡ marker được trỏ (command, cascade, ai.clearContent, clear, người dùng) → mọi route trỏ tới bỏ điểm dừng đó, đánh số lại, mỗi route một updated ["stops"] (không phát khi route là phần tử của đoạn); gỡ / ẩn route → huy hiệu của nó biến, marker ở lại (cascaded chỉ đếm điểm dừng sở hữu); marker được trỏ dời / ẩn / tới muộn → route dựng lại đoạn nối; «Chọn kế hoạch» (adopt) đổi chủ cả marker ai được trỏ + popup neo nó; export giữ { type: "markerRef", id }.
  • Hiển thị: điểm dừng sở hữu { color } / bỏ trống / "none" vẫn là chấm có số; icon khác (ảnh, sprite, emoji, template) giữ icon + hàng huy hiệu số giữa phía trên — feature thứ hai {markerId}/badges của marker (sm:role: badges, cùng layer marker, sm:seq + 0.5), ảnh sm-badges-{băm} vẽ bằng dart:ui theo pixelRatio (viên thuốc trắng + nền màu lùi viền, số căn theo khung nét thật đo ở cỡ ×10, bóng 0 1px 3px rgba(0,0,0,.35), lề 4 px). Đáy hàng cách mép trên hộp icon route.default.stop.badge.iconGapPx (2 px — không đè icon): sm:offset tính sau khi ảnh vẽ xong. Marker được trỏ giữ dáng + hàng huy hiệu; chấm có số được route khác trỏ giữ số của route chủ + huy hiệu của route khác. Màu huy hiệu = màu điểm dừng của route (tourist-route: màu ngày); thứ tự day → route → số. Kéo marker mang theo hàng huy hiệu.
  • Icon url nhận shape: "circle" (kUrlIconShapes): cắt vuông phủ kín giữa ảnh, cắt tròn, vòng mảnh rgba(0,0,0,.05); tải lỗi → tròn giữ chỗ #E2E8F0. Một ảnh lỗi không còn làm hỏng cả lệnh (component đó vẽ không icon); Pha B hỏng vì MapLibre vẫn EXEC_FAILED + hoàn nguyên.
  • Bấm: click của marker kèm ComponentEvent.stopIn: [(route, n)]; ComponentEngine.onMarkerClick(handler) — app nhận cú bấm vào MỌI marker (không cần events), trả true → engine không mở popup neo (vd mở panel place).
  • mapContext: route stops: [{ id, n, ref? }], marker stopIn: [{ route, n }]; vượt trần giữ mục ai, rồi route / kế hoạch / popup / marker là điểm dừng, cắt marker app thường (pickContextEntries), giữ thứ tự sổ.
  • kComponentVersions: marker 1.2, route 1.2. Theme: token route.default.stop.badge (BadgeStyle, thiếu khoá → số đo sharemap). Schema / theme nhúng sinh lại từ ai-map-protocol; ví dụ component-route-stop-icon-*, component-route-stop-ref* chép vào fixtures. Facade SMRoute / SMTripPlan cho markerRef đi nguyên.
  • Khoảng lệch: ảnh hàng huy hiệu cần bù tỉ lệ (sm:isize, Android) nằm ở layer -transform của nhóm — có thể khác layer với icon (icon không bù tỉ lệ ở layer gốc); hàng huy hiệu không đè icon nên không thấy khác, chỉ thứ tự chồng so với marker khác cùng nhóm có thể lệch. Feature huy hiệu không tự kéo được (draggable: false) — kéo từ icon, huy hiệu theo. amjson-input.schema.json của protocol chưa khai stops / stopIn (Fleet đã nhận) — test bỏ đúng hai lỗi đó.

Thêm — component trip-plan 1.0 (ai-map-protocol components doc chương 14, 2026-10-18) #

  • Loại component mới trip-plan: kế hoạch du lịch sở hữu các tourist-route lồng trong routes[] (mỗi route một day, không trùng; 1–14 route; ≤ 10 kế hoạch mỗi origin) dưới một title — như route sở hữu stops[]. Không vẽ gì: engine dựng từng route lồng đúng đường của route rời (màu ngày, chấm có số mỗi ngày từ 1) rồi ghi sổ ComponentMemory.byPlan + ComponentEntry.planOf; routesOf(planId) sắp theo day.

  • Pha A (14.3): route lồng không phải tourist-route / thiếu day / hai route cùng day (hint nêu hai id) / routes là chuỗi id / rỗng → SCHEMA_INVALID trỏ routes[i].…; 15 route hay kế hoạch thứ 11 → PAYLOAD_TOO_LARGE; route lồng khác origin → NAMESPACE_VIOLATION. Route lồng cùng id với route đang có = thay (route rời / route của kế hoạch khác thành route của kế hoạch này; kế hoạch cũ co lại, hết route thì gỡ theo). Sửa riêng một route của kế hoạch: day kiểm trùng với anh em, routeType không đổi được.

  • update gửi routes = thay cả mảng (route rơi khỏi mảng gỡ theo, removed reason: "cascade"); không gửi thì chỉ đổi title / visible / tags / properties. remove kế hoạch gỡ mọi route + điểm dừng + marker bám + popup neo (data.cascaded đếm đủ). Gỡ trực tiếp một route của kế hoạch → kế hoạch updated (changed: ["routes"]), còn 0 route → removed cascade. ai.clearContent gỡ kế hoạch như mọi component.

  • Ẩn lan xuống: hiện thật của route = plan.visible && route.visible, kéo theo điểm dừng, đoạn nối, popup neo; route tự ẩn vẫn ẩn khi kế hoạch hiện lại.

  • mapContext.component: mục { type: "trip-plan", …, title, days, stopCount, distanceKm, durationMin, routes[] } với routes[] là các mục route lồng (theo day); route của kế hoạch không lặp ở cấp trên; count.byType có trip-plan; nguồn label thêm trip-plan.title. component.get { type: "trip-plan", id } trả nguyên kế hoạch kèm routes[] (có stops), bộ lọc tags / visible / bbox (khung bao mọi route) / limit; get route thêm bộ lọc planOf. export(id) cùng hình.

  • API host (engine.components): adopt(String id) → Future<bool> — «Chọn kế hoạch»: đổi chủ ai → app cho component và cả cây nó sở hữu (kế hoạch → route → marker điểm dừng / bám → popup neo), id giữ, mỗi component phát adopted { from: "ai", to: "app", by: "user" } (tổng quát của «Lưu địa điểm» — adoptByUser giữ nguyên, dùng chung đường); removeByUser(String id) → Future<bool> — «Bỏ kế hoạch»: gỡ mọi origin không qua command, removed reason: "user" cho [id], "cascade" cho phần gỡ theo (tổng quát của nút Xóa trên thẻ — deleteByUser giữ nguyên). list(ComponentQuery(type: 'trip-plan')) / ComponentQuery(planOf:); count(type: 'trip-plan').

  • ComponentEntry.color (derived.color, 7.4): màu nét đang vẽ của route — màu ngày của theme với tourist-route, preset / style.line.color đè lên — đặt khi route được biên dịch (_applyPlans), host tô chấm số của thẻ lộ trình cùng màu tuyến.

  • kComponentTypes += trip-plan; id ^(ai|app)-(marker|route|popup|trip-plan)-[0-9]{17}$; kComponentVersions thêm trip-plan: "1.0" (mọi gói [1]/[2]/[3] khai thêm); capabilities.components liệt kê trip-plan (ComponentEngine(componentTypes:) mặc định có nó; client không khai → COMMAND_NOT_ALLOWED); kThemedComponentTypes = ba loại có mục theme (trip-plan không có preset / style). Schema nhúng kAmjsonCommandSchemaJson sinh lại từ fixture (có TripPlanAttrs, ComponentVersions có trip-plan).

  • Facade SMTripPlan (lib/src/components/sm_trip_plan.dart): SMTripPlan(title:, routes:) — route / điểm dừng thiếu id được cấp id ổn định theo vị trí; setTitle / setRoutes / setVisible / setTags / setProperties; routeIds; onUpdated / onRemoved / onAdopted. buildComponentBatch khai componentVersions cho cả loại lồng (routes[] → route, stops[] → marker).

  • PlannedUpsert.isStop đổi tên thành owned (điểm dừng, route lồng, kế hoạch co lại — không đếm trong data); thêm cascadeRemoveRoute / cascadeRemovePlan / reconcileTripPlans / detachStopFromRoute (Pha A và đường người dùng dùng chung). Test: test/engine/component/trip_plan_test.dart (30 ca) + ví dụ TP1 / 3 ví dụ sai của spec chép vào test/fixtures/amjson_examples.

  • Thêm command builders có kiểu cho camera, layer, image, query, polygon, buildings, fleet, planned route, tracking markers và history/trajectory. Batch dùng protocol 2.0 và responseTo mới; managed resource ID ổn định theo namespace.

  • Thêm DTO/adapter GPS, lịch sử và FleetSnapshotTracker; controller VehicleTrackingController quản lý chọn xe, cleanup, reload style, playback, seek, tốc độ và camera follow. Dữ liệu backend POI giữ nguyên quyền hiển thị.

  • Engine nội suy live-vehicle, giới hạn ghi source ở 10Hz với một frame đang ghi mỗi source; source mutation/cleanup chờ frame cũ hoàn thành.

  • Luồng đổi style đợi callback style-loaded trước khôi phục tài nguyên.

  • Thêm test tracking, demo Vehicle Tracking và doc/react-flutter-parity.md.

  • Khác biệt native vẫn được ghi rõ: nhãn halo thay 9-slice, history cursor qua MarkerAdapter, chưa terrain/native plugin parity và chưa đo máy thật.

Tracking và example bổ sung (2026-10-16) #

  • Thêm panel chi tiết xe, lịch sử và điểm giao tái sử dụng, controlled callbacks và slots; web example nối chi tiết/kế hoạch/lịch sử và khoảng thời gian.

  • Playback có idle/playing/paused/stopped/ended và tốc độ trong state/tick; stop thực sự đưa về đầu; cập nhật cùng history giữ playhead/tốc độ.

  • Hủy history đang nạp khi clear/replacement/close; pause/stop bỏ camera follow; planned route chỉ fit khi geometry đổi; group state và throttle UI tick.

  • Tổ chức example theo 5 mục menu, tách dữ liệu/command/panel và thêm hướng dẫn đọc.

Thêm — Trả lời hai pha + chat liên tục: message_delta.done, hàng chờ câu hỏi ở MapAgentChatController (ai-map-protocol §9.1.3) #

  • message_delta { text, done? }: agent phát chữ của model ngay khi có (từng token, hoặc nguyên câu một lần) rồi mới định vị / tính tuyến; mẩu cuối done: true (có thể rỗng). MapAgentStreamAssembler kiểm done là boolean, bỏ qua mẩu tới sau done, lộ messageDone. Callback đổi kiểu thành MapAgentMessageDeltaCallback = void Function(String text, {bool done}) ở MapAgentTransport.send / MapAgentAdapter.send / MapAgentStreamAssembler(onMessageDelta:); AiShareMapRemote.ask(onMessageDraft:) thành MapAgentMessageDraftCallback = void Function(String draft, {bool done}). Lớp hiện thực MapAgentTransport cũ vẫn biên dịch (tham số override rộng hơn); closure (t) => … truyền vào phải thành (t, {done = false}) => ….
  • AiShareMapRemote.ask(requestId:): lớp trên đặt requestId của lượt trước khi chạy; bỏ trống thì tự sinh bằng newMapAgentRequestId() (giờ là API public).
  • MapAgentChatController — chat liên tục (song song với hook useMapAgentChat của React): một phiên chỉ chạy một lượt một lúc; câu gửi trong lúc lượt đang chạy xếp vào pending và tự gửi tuần tự khi lượt trước kết thúc — xong hay lỗi đều đi tiếp (lỗi lượt trước vẫn ở error tới khi lượt sau bắt đầu).
    • send(String) giờ đồng bộ, trả MapAgentSendReceipt? { id, queued, settled } (null khi câu rỗng / chưa attach): id = requestId của lượt (= MapAgentTurn.requestId), settled hoàn tất khi lượt của câu đó kết thúc hoặc câu bị rút. Code cũ await chat.send(x) → await chat.send(x)?.settled. Quyết định chạy-ngay / xếp hàng dựa trên field thường bật đồng bộ, nên hai send trong cùng microtask không chạy chồng.
    • pending (danh sách MapAgentPrompt { id, text } không sửa được), cancelPending(id), current (câu đang chạy, null khi rảnh), busy = isThinking || pending.isNotEmpty; isThinking giữ nghĩa cũ. Bong bóng người dùng vào messages lúc thật sự gửi (khi current đổi), không phải lúc xếp hàng. reset() / dispose() bỏ hàng chờ; cancel() chỉ huỷ lượt đang chạy.
    • draft = MapAgentDraft { requestId, text, done } của lượt đang chạy (null khi rảnh); draftMessage giữ làm bí danh của draft?.text. UI dựng block câu trả lời tại done, cập nhật cùng block khi aiMessage chuẩn của batch_end vào messages.
  • Khai capabilities.mapLinks → agent gắn [tên](sharemap:cite/<n>) vào tên địa điểm có trong citations. Mặc định false (app hiện chữ thuần không thấy cú pháp lạ). EngineCapabilities.toJson(mapLinks:), buildMapAgentInput(mapLinks:).

BREAKING — Route 1.1 / marker 1.1: tourist-route + day, điểm dừng là chấm có số (components doc 6.2, 7.2–7.4, R2–R8) #

  • routeType: "tourist-route" + day (1–99): tuyến một ngày của lịch trình — vẽ như basic, màu route.touristRoute.dayColors[(day − 1) % n] thay line.color ở tầng mặc định (ComponentTheme.routeStyleOf): preset có line.color đè màu ngày, style.line.color đè cuối. day bắt buộc với tourist-route, loại khác gửi day → SCHEMA_INVALID (kiểm sau gộp; đổi sang loại khác thì day bị bỏ). mapContext route mang day. SMRoute(day:), day, setDay().
  • Điểm dừng của mọi loại route = chấm tròn có số (không còn ghim sprite): icon { color }, hình marker.dot.numbered (Ø 24, viền marker.dot.border, số trắng đậm 700 — 0.55 / 0.46 × Ø), neo center, nhãn dưới chấm (sm:toffset [0, 1.2]). Số do engine điền; màu mặc định: tourist-route → màu tuyến cuối cùng, loại khác → route.stop.color (#3AA3FF). Điểm dừng chỉ nhận { color } — ghim sprite / emoji / url / template / pinText → SCHEMA_INVALID. Ảnh khoá sm-dotnum-{màu}-{cỡ}-{viền}-{chữ}-{màu chữ} (dotNumberImageId, DotImage(text:, textColor:)). mapContext không còn icon: "pin-blue" cho điểm dừng.
  • stopConnectors (mặc định true): điểm dừng đang hiện cách hình học đang vẽ (alternatives: phương án đang chọn) ≥ 5 m → đoạn nối [điểm gần nhất, điểm dừng] (nearestOnLine), feature sm:role: "connector", sm:fid {id}/connector/{i}, màu = màu tuyến tại điểm đó (progress: done / remaining; alternatives: selected). Layer mới sm-route-{grp}-connector dưới casing: chấm tròn — line-dasharray / rộng / đục là hằng từ token route.connector (khoá bắt buộc của theme gốc), đầu tròn, không nhận bấm, không sự kiện, không mapContext. Điểm dừng dời / ẩn / gỡ → route dựng lại đoạn nối; false → không vẽ.
  • Marker { color, pinText?, pinTextColor? }: chấm có số cho marker rời (SMIcon.color(…, pinText:)).
  • Popup anchorTo một chấm: khoảng tự tính theo hộp chấm gồm viền (chấm 16 → 10, chấm có số → 14) — kể cả khi ảnh chưa vẽ xong.
  • Theme: route.default.stop + touristRoute.dayColors là khoá bắt buộc của theme gốc; marker.default.dot.numbered. kComponentVersions marker / route → 1.1. Fixtures schema (command · input · style · theme), themes/sharemap.json, ví dụ route / mentions / cases / toolgroups đồng bộ; bản nhúng sinh lại. Demo: tuyến ngày 2 + điểm lịch trình là chấm có số; điểm dừng giao hàng đổi sang { color }.

Sửa — marker.border.radius số tối đa 64 #

Pha A nay loại border.radius dạng số > 64 (SCHEMA_INVALID), khớp MarkerBorder của schema command và style doc; "circle" giữ nguyên. Schema command nhúng sinh lại; ví dụ component-route-stop-number-start.json đồng bộ.

Thêm — popup.shareButton, thẻ điểm dừng chỉ còn ✕, "Lưu địa điểm" chuyển chỗ AI cho người dùng (components doc 4.4, 5.3, 8.2, 8.3) #

  • shareButton (mặc định false, chỉ với content — cùng template → SCHEMA_INVALID, kiểm sau gộp): PopupShareButton (icon chia sẻ 13 vẽ đúng SVG thiết kế, hover như ✕) trong nhóm nút góc phải thùng rác · chia sẻ · ✕ (gap 8, một khối — nút tắt thì dồn về phải); bấm phát action actionId: "share". Token popup.default.share — khoá bắt buộc của theme gốc; dark có share. Tên đọc "Chia sẻ" / "Share".
  • Thẻ điểm dừng: popup anchorTo một ghim điểm dừng route chỉ dựng ✕ — không hàng nút, không xóa, không chia sẻ (cấu hình giữ nguyên; đổi neo sang marker thường thì hiện lại).
  • Adopt: bấm add-place trên popup có origin hiện tại ai → ComponentEngine.adoptByUser: popup + marker nó neo đổi origin ai → app trong sổ (id giữ), add-place bị bỏ khỏi content.actions, phát sự kiện vòng đời adopted {from: "ai", to: "app", by: "user"} cho cả hai (ComponentEvent.from / .to); không phát action add-place. Popup app bấm add-place vẫn chỉ phát action. Thẻ giữ bề rộng đang có tới khi đóng (khoá chung với hàng xác nhận xóa — hai khoá một bề rộng, hết cả hai mới nhả).
  • Namespace theo origin hiện tại: component đang có kiểm origin của command với origin trong sổ, tạo mới theo tiền tố id — update / remove / get theo id, anchorTo, along.routeId, điểm dừng, bộ lọc stopOf / alongOf. ai.clearContent và mapContext (origin) dùng origin hiện tại.
  • Facade: SMPopup(shareButton:), shareButton, setShareButton(), onAdopted; SMMarker.onAdopted; SMComponentBase.origin đổi theo adopted (lệnh sau đi bằng app), SMPopup bỏ add-place khỏi state.
  • Fixtures schema command / style, themes/sharemap.json, mentions, cases đồng bộ; bản nhúng sinh lại. Demo: nút chia sẻ trên thẻ lịch trình, "Chỗ AI gợi ý" lưu được.

Thêm — popup.deleteButton: người dùng xóa chỗ này khỏi bản đồ (components doc 8.2, 8.3) #

  • deleteButton (mặc định false, chỉ với content — cùng template → SCHEMA_INVALID, kiểm sau gộp): thùng rác PopupDeleteButton ngay trái ✕ (gap 8, cùng cách căn dòng chữ đầu) trên thẻ location và tourist-point; popup neo điểm dừng route không dựng nút. Token popup.default.delete (sizePx 16 · iconSizePx 13 · color · hoverColor đỏ) và button.danger — khoá bắt buộc của theme gốc; preset dark có delete.
  • Bấm → hàng xác nhận PopupDeleteConfirm thay hàng nút (câu hỏi 12/600 + gợi ý 11, Hủy secondary nhận focus · Xóa danger + thùng rác); Hủy trở lại; đóng thẻ khi đang xác nhận = hủy. Thẻ location (tự giãn theo hàng nút) giữ bề rộng lúc mở hàng xác nhận làm bề rộng tối thiểu tới khi hủy — không co lại. Chữ theo uiLocale ("Xóa địa điểm này khỏi bản đồ?" / "Remove this place from the map?", Hủy · Xóa / Cancel · Remove, tên nút "Xóa địa điểm" / "Remove place").
  • Xóa → ComponentEngine.deleteByUser(popupId) (thao tác người dùng, mọi origin): popup anchorTo → gỡ marker (removed reason: "user") + popup ("cascade"); không neo → gỡ riêng popup ("user").
  • SMPopup(deleteButton:), deleteButton, setDeleteButton(). Fixtures schema command / style, themes/sharemap.json, ví dụ (component-popup-delete-template.json, tourist-point, mentions, cases) đồng bộ; bản nhúng sinh lại. Demo: thẻ lịch trình có nút xóa.

Thêm — popup.openOnAnchorClick + luật một marker — một popup (components doc 8.2, 10.8, 10.12) #

  • openOnAnchorClick (mặc định true, chỉ tác dụng khi có anchorTo; null khi update = mặc định): người dùng bấm marker (kể cả ghim điểm dừng route) mà popup neo vào nó đang đóng → state.open = true, hiện overlay, phát open by: "user"; đang mở thì giữ nguyên — cú bấm đó không bị closeOnClick đóng lại. Không cần marker khai events; marker khai click thì app vẫn nhận click. Áp cho popup mọi origin. false = app tự xử lý cú bấm. SMPopup(openOnAnchorClick:), openOnAnchorClick, setOpenOnAnchorClick().
  • Một marker — một popup: Pha A kiểm trên sổ sau action (dời neo trong cùng action hợp lệ); popup thứ hai neo vào marker đã có popup → COMPONENT_DEPENDENCY_CONFLICT, repair.available / hint nêu popup đang neo. ComponentMemory.byAnchor nay một-một (Map<markerId, popupId>), thêm popupOf(markerId).
  • mapContext.component.items[] của popup: popupType luôn có với popup content (location khi chưa khai), không có với popup template (mang template); anchorTo = marker đang neo, chỉ khi có — cả hai vào contextHash (components doc 11). Fixture amjson-input.schema.json đồng bộ.
  • Schema command nhúng sinh lại; fixtures component-popup-tourist-point-update.json, cases/mentions-lich-trinh.json đồng bộ.

Sửa — thẻ popup có content.category: nút ✕ bị đẩy xuống dòng tiêu đề #

category (khối mở rộng) nay nằm trong hàng tiêu đề (components doc 8.3 "Hàng tiêu đề"): cột chữ = category (11/600, chữ hoa, giãn 0.04 em, line-height 14, màu subtitle.color) cách hàng title + rating 2 px; hàng căn trên. Nút ✕ luôn ở góc phải trên, căn giữa theo dòng chữ đầu — dòng category khi có (lệch −1), không thì dòng title (+1.6) — PopupCloseButton(lineHeight:). Thẻ tourist-point cùng luật (✕ ngang dòng nhãn). image vẫn trên cùng thẻ. Fixtures mentions-*.json đồng bộ lại (nay có "popupType": "location").

Thêm — Popup 1.1: popupType: "tourist-point" + content.extra.visit #

Thẻ điểm tham quan trong lịch trình (ai-map-protocol themes/components/popup.md 8.2, 8.3 "Giao diện tourist-point", 8.5 P7) — đúng Popup 3 của sharemap-ai-design-component/sharemap-popup, cùng thang với thẻ location (cùng khung, cỡ chữ, mũi tên 16 × 8, hàng nút): nhãn, tiêu đề xuống dòng, hàng lịch ghé thăm (ô ngày · ô buổi + khoảng giờ), ghi chú, đường kẻ, "Trên bản đồ" + địa chỉ, hàng nút chung.

  • popupType (location mặc định · tourist-point), tập đóng — tên lạ → SCHEMA_INVALID; chỉ đi với content (cùng template / data → SCHEMA_INVALID); "location" không lưu vào cấu hình, null khi update = về location. tourist-point chỉ nhận category · title · subtitle (bắt buộc — địa chỉ) · extra · actions.
  • content.extra.visit { day, period, startTime, endTime } — extra tập khoá đóng, chỉ ở tourist-point; day số 1–99 hoặc chuỗi 1–40; period ∈ morning · noon · afternoon · evening · night · allday; startTime cần period, endTime (tuỳ chọn) cần startTime và sau nó trong cùng ngày. Hợp loại kiểm trên cấu hình sau khi gộp (content không gộp sâu). Popup mẫu (TemplatePopup) khai content.extra → SCHEMA_INVALID.
  • extra.visit.note (chuỗi 1–300, chữ thuần) — hàng ghi chú (TouristPointIcon.note = tp-note 14 px cách chữ 6, token touristPoint.visitNote 12/400 + iconColor, line-height 16) ngay dưới hàng lịch, cách gap thẻ − 4 (6); không có hàng lịch (không day lẫn period) thì đứng một mình, giữ gap thường (10). Đường kẻ khi có hàng lịch hoặc hàng ghi chú. visitNote là token bắt buộc của theme gốc.
  • content.subtitle nới 120 → 300 ký tự cho mọi popupType.
  • Renderer TouristPointView (component_popup_layer.dart): rộng cố định touristPoint.card.widthPx (300 ≈ thẻ location ba nút; padding 12, gap 10), kẹp ở bề rộng bản đồ − 32 và maxWidthPx số; bị kẹp dưới widthPx thì chỉ hàng lịch xếp một cột (mọi cỡ khác giữ nguyên). Header cách cột 8, nhãn 11/600 line-height 14 giãn 0.04 em cách tiêu đề 2, tiêu đề 16/700 line-height 1.2; ô lịch cao 40, bo 8, padding 0 10, icon 18 cách chữ 8, hai ô cách 6; địa chỉ ghim 16 cách chữ 8, nhãn 11/500 cách địa chỉ 12/400 (line-height 16) 2; nút ✕ hộp 16 như location. Không day lẫn period → ẩn hàng lịch; một ô thì chiếm cả hàng; mặt trời cho morning · noon · afternoon · allday, mặt trăng + màu visitPeriod.moon cho evening · night; icon vẽ đúng path SVG tp-calendar · tp-sun · tp-moon · tp-note · tp-pin (parseSvgPathData nay đọc cả lệnh cung A). Thẻ + mũi tên (touristPoint.anchorIcon 8 → 16 × 8) vẫn một Path. Hàng lịch đọc thành một câu cho trình đọc màn hình.
  • Theme: nhóm popup.default.touristPoint (TouristPointLook) là khoá bắt buộc của theme gốc; preset dark có bản tối. Bản nhúng themes/sharemap.json và schema command / style / theme sinh lại.
  • uiLocale — tuỳ chọn khởi tạo (ComponentEngine(uiLocale:), ShareMapLibre(uiLocale:), mặc định vi; vi · en, en-US → en, ngôn ngữ khác lùi về vi) cho chữ engine tự sinh: "Ngày 2" / "Day 2", Sáng · Trưa · Chiều · Tối · Đêm · Cả ngày, "Trên bản đồ", nhãn mặc định "ĐIỂM THAM QUAN" / "ATTRACTION", tên nút đóng cho trình đọc màn hình "Đóng" / "Close" (mọi thẻ popup). Không đi trên dây; chữ AI viết thắng. PopupUiText (component_ui_text.dart), engine.uiText. Nút của thẻ (✕, hàng nút) nay là nút trợ năng riêng (Semantics.container), không gộp tên vào chữ bên cạnh.
  • popupType khác null (kể cả "location") cùng template → SCHEMA_INVALID, kiểm trên cấu hình sau khi gộp (update "popupType": "location" lên popup template cũng bị loại); "popupType": null cùng template hợp lệ.
  • SMPopup(popupType:), popupType, setPopupType(type, content:). kComponentVersions.popup → 1.1.
  • Demo example_web (Components): hai điểm lịch trình (sáng — mặt trời, tối — mặt trăng) + đổi lịch.

Bỏ — client.locale trong gói [1] (ai-map-protocol §3.7) #

MapAgentClientInfo không còn locale (trước lấy từ PlatformDispatcher.locale); MapAgentClientInfo.current() bỏ tham số locale. Ngôn ngữ trả lời theo câu người dùng gõ — ngôn ngữ máy từng làm agent trả câu runtime sai thứ tiếng. Fixtures protocol (schema, ví dụ input / turns / cases, vector wire input) đồng bộ lại.

Sửa — Map Agent qua SSE: lượt có marker/popup bị từ chối vì rơi componentVersions #

Bộ ghép [2] từ stream (lib/src/agent/remote/map_agent_stream.dart) không chép componentVersions từ khung batch_start, nên validator của engine từ chối mọi lượt có action component.* (SCHEMA_INVALID — "componentVersions is required…"): AI trả lời nhưng bản đồ không vẽ gì, camera không bay, chip citation trong chat bấm không có gì. Nay chép ngay sau version (components doc 5.6, spec §9.1.3). Ví dụ stream progress-session-citations đồng bộ lại từ ai-map-protocol (bản cũ không có action component nên test không bắt được) + test riêng.

Thêm — mapContext.camera.corners: bốn góc vùng người dùng đang thấy #

buildMapContext() chiếu bốn góc viewport (controller.toLatLng, cả bốn một lượt) ra [lng, lat] — trên-trái, trên-phải, dưới-phải, dưới-trái, 5 chữ số — đặt ngay sau bounds. Toạ độ màn hình theo đơn vị của nền tảng (Android: pixel vật lý; iOS / web: pixel logic), như ComponentPopupLayer. Bản đồ xoay / nghiêng thì vùng thấy là tứ giác hẹp hơn bounds; không chiếu được thì bỏ. Hàm visibleCorners (map_context_digest.dart).

Thêm — Vị trí người dùng: locateUser (mặc định bật) + mapContext.userLocation #

Bản đồ lấy vị trí thiết bị để AI hiểu "gần tôi", "từ chỗ tôi" (ai-map-protocol sharemap-engine.md 12d, sharemap-context.md 4.1a). ShareMapLibre(locateUser: false) tắt hẳn: không hỏi quyền, không định vị, mapContext không có userLocation. locateUserOptions: LocateUserOptions(prompt, showDot, showButton, highAccuracy, labels).

  • Dependency mới geolocator (kiểm / xin quyền, mở cài đặt, stream vị trí — Android, iOS, web). App phải khai quyền: iOS NSLocationWhenInUseUsageDescription, Android ACCESS_FINE_LOCATION / ACCESS_COARSE_LOCATION.
  • Kiểm quyền trước: đã cho phép → theo dõi ngay (distanceFilter 10 m); hỏi được → thẻ xin quyền (Cho phép gọi hộp thoại hệ thống, Để sau); bị chặn → thẻ với Mở cài đặt (web: hướng dẫn ổ khoá + Thử lại); tắt dịch vụ vị trí → thẻ Bật vị trí. Quay lại app (AppLifecycleState.resumed) hoặc bật lại dịch vụ thì tự kiểm lại. Thẻ theo thiết kế sharemap-popup (PopupLook, PopupActionButton), rộng 320, giữa đáy bản đồ; Escape = Để sau.
  • Chấm vị trí = puck của MapLibre (myLocationEnabled), chỉ bật khi đã có quyền — bật sớm thì iOS tự hỏi, vượt mặt thẻ của engine. Nút "Vị trí của tôi" bay tới hoặc xin quyền lại.
  • Có vị trí lần đầu thì camera bay tới (zoom ≥ 16, một lần mỗi bản đồ) — trừ khi camera đã rời initialCameraPosition (người dùng kéo, AI / app ra lệnh camera): không giật khung nhìn. flyTo: false tắt. Bấm nút vị trí lúc chưa có vị trí thì có là bay, bất kể camera.
  • mapContext.userLocation ngay sau camera: status ok (lngLat 5 chữ số, accuracyM, at, heading khi đang đi, speedMps) · locating · prompt · denied · unavailable. Không vào contextHash; gói omitted vẫn mang.
  • API: engine.userLocation, engine.userLocationTracker (ChangeNotifier), engine.requestUserLocation(); ShareMapEngineOptions.userLocation; ShareMapLibre.userLocationPlatform thay geolocator khi test. Module lib/src/engine/user_location/, widget lib/src/widgets/user_location_overlay.dart.

Thêm — popup.anchorTo: popup neo vào marker #

Popup khai anchorTo: "<id marker>" thay cho lngLat (components doc 8.2): đứng ở vị trí marker đang vẽ và đi theo khi marker dời — update, người dùng kéo (dính theo ngón tay từng bước drag), placeOnClick, marker along khi route đổi tiến độ / chạy transition. Không khai offsetPx thì engine đo hộp icon marker đang vẽ (ảnh engine vẽ hoặc ảnh sprite × scale, theo anchor / offsetPx của marker) và đặt khoảng mũi tên theo từng phía (PopupOverlaySpec.offsetSides, markerIconExtents, popupAnchorPlacement nhận PopupOffsetSides). Marker ẩn → popup ẩn; remove marker (hay route mang marker) gỡ dây chuyền popup (reason: "cascade"). Có lngLat thì lngLat thắng về vị trí. ComponentMemory.popupsOf(markerId); SMPopup(anchorTo:) nhận id hoặc SMMarker, setAnchorTo(), setLngLat(null). Schema command nhúng sinh lại.

BREAKING — Popup theo thiết kế sharemap-popup, style theme tách theo phần #

Thẻ popup mặc định (ComponentPopupLayer) dựng lại đúng thiết kế sharemap-ai-design-component/sharemap-popup (components doc 8.3): hàng tiêu đề (title một dòng + ★ rating + (ratingCount) + nút ✕), subtitle, description (has-description: padding 12, gap 10), hàng nút .buttons-N (primary / secondary, hover / active, icon SVG của thiết kế). Thẻ + mũi tên neo vẽ thành một Path (PopupCardPainter): mũi tên cùng nền thẻ, bóng card.shadow phủ cả hai. Số đo khớp thiết kế (thẻ 3 nút 303.6 × 107 px với font Inter).

  • Theme popup: bỏ token phẳng background / foreground / muted / accent / radiusPx / shadow; thay bằng phần card (+hasDescription) · title · rating · subtitle · description · close · button (primary / secondary) · anchorIcon. PopupOverlaySpec.look mang các phần này; đọc qua PopupLook.of.
  • PopupOverlaySpec.maxWidthPx thành double? — null = "none" (mặc định sharemap: tự giãn); thẻ luôn kẹp ở bề rộng bản đồ − 32, title cắt …. SMPopup(maxWidthPx:) nhận số hoặc 'none'.
  • offsetPx = khoảng từ điểm tới đỉnh mũi tên, mặc định theme sharemap đổi 25 → 16 (vừa emoji / icon 32 px neo giữa; ghim sprite 40 × 48 thì khai offsetPx: 48); hướng góc dời ngang 14 + s để mũi tên thẳng điểm. anchor: auto chọn phía như maplibregl.Popup (theo kích thước thẻ đo được).
  • PopupContent thêm description (≤ 300), ratingCount; icon nút thêm add-place.
  • App cần khai font Inter (pubspec) để khớp số đo; thiếu thì lùi về font hệ thống.

BREAKING — AI Map Protocol 2.0.0, phase 1 (protocol base) #

Spec: ai-map-protocol 2.0.0 (§3 Input, §5 Command, §7 Result; sharemap-context.md §4–§6). Phase 2 — the component target (marker / route / popup engine and the SMMarker / SMRoute / SMPopup facades) — is the next section; it plugs into the seam below.

  • kProtocolVersion = 2.0.0. A [2] with another major is rejected VERSION_MISMATCH; round and aiMessage are now required on network batches; contextResync and origin are accepted envelope fields.
  • Whitelist 13 → 25 commands (§5.2): adds camera.easeTo, source.addVectorTiles (host allowlist ShareMapEngineOptions.allowedTileHosts), source.patch (+ transition), layer.setInteraction, feature.setState / clearState, image.add / remove, and component.add/update/get/remove. source.addOrUpdate gains circle, dataset and options (cluster, lineMetrics, tolerance, promoteId); layer.add gains fill-extrusion, interaction, animation, progress, iconTemplate; marker.addFromSource takes the 2.0.0 shape (popup template popup, events, color — the 0.0.x popupProperty / emoji / iconUrl payload fields are gone).
  • The Command Validator checks payloads with the spec's own schema (amjson-command.schema.json, embedded as kAmjsonCommandSchemaJson, validated by the new JsonSchemaValidator), plus the rules the schema cannot express: id format {origin}-{kind}-{17 digits} with kind from the closed set — strict, like the web engine: free-form ids such as ai-coffee-shops are SCHEMA_INVALID with path although the schema's ManagedId still lets them through —, layer ids {sourceId}-{role} (role ^[a-z][a-z0-9-]{0,23}$, no exception), origin namespaces (NAMESPACE_VIOLATION), tile/icon hosts, registered templates (TEMPLATE_NOT_FOUND) and datasets, progress / animation cross-rules, expression depth, size caps (PAYLOAD_TOO_LARGE with repair.limit / actual). Every error carries path (JSON Pointer) and repair. validateAction(action, ValidationContext(...)) replaces the named-argument form.
  • Pha A (sharemap-engine.md §3.1): the engine pre-checks the whole batch — whitelist, capabilities.commands, namespace, schema, caps, in-batch dependencies (layer.add / marker.addFromSource / source.patch on a source nothing creates → SOURCE_NOT_FOUND, missing-dependency), image cap per origin, lineMetrics for progress, sourceLayer on vector sources. Any failure ⇒ status: "rejected", failing actions error, the rest skipped, no map call. New ShareMapEngine.precheck(batch) runs it as a dry run.
  • origin (§5.1.1). JsonCommandBatch.origin (missing = app) and withOrigin(). ShareMapEngine.executeAiBatch() is the single place every AI path goes through and overwrites origin: ai — AiShareMapRemote and every local agent tool now use it; a packet that claims app through an AI path is rejected. App code calling executeBatch without origin works on app- ids; ai.clearContent only clears the namespace of the batch's origin (clearContent(origin); clearAiContent() kept).
  • Error registry 14 → 18 (TEMPLATE_NOT_FOUND, ICON_NOT_FOUND, COMPONENT_NOT_FOUND, COMPONENT_DEPENDENCY_CONFLICT).
  • JsonResult.status is required; [3] always carries status and mapContext. JsonResult.version is now the client's protocol version, not an echo of [2].
  • mapContext 2.0.0 (sharemap-context.md §4), emitted directly by the engine — toProtocolMapContext() and includeBasemapLayers are gone. Groups camera (+sizePx, limits from minMaxZoomPreference / cameraTargetBounds), component (from the component handler, empty without one), source (every style source but sm-*, real type from the loaded style JSON / getStyle(), origin, featureCount / dataHash for engine GeoJSON, live, dataset, clustered, markers {count, popupProperty}), layer (only ai / app and aiEditable basemap layers + basemapLayerCount; hasFilter, interactive, selectable, animated, progress), image.count, digest (L2 from per-layer queryRenderedFeaturesInRect: dedupe by id, cluster point_count, bbox, property whitelist, ≤ 3 samples, selected) and meta (builtAt, settled, inventory, contextHash = first 16 hex of SHA-256 over the canonical inventory without component progress and live-source hashes, lastBatchId, selections, lastInteraction). No marker, ai, aiManaged, popup, terrain. MapContext.aiDigest stays as a convenience for local tools (filters origin: ai).
  • [1] Input 2.0.0 (buildMapAgentInput): payload.prompt (no type, no sanitizedPrompt), capabilities from engine.capabilities (EngineCapabilities: only commands the engine really runs — no feature.* on iOS/Android, component.* and components only with a handler — plus allowedTileHosts, templates, datasets, icons, limits). supportedMapAgentCommands(engine) takes the engine. AiShareMapRemote drops includeBasemapLayers / allowedTileHosts (the engine owns tile hosts).
  • Delta context (§3.5): new MapContextDelta. AiShareMapRemote sends meta.inventory: "omitted" (four inventory groups dropped) when the hash equals the last hash sent in the session, and full on the first turn of a session, when the agent returns a session.id different from the one the client holds, or historyMessages: 0 for the session the client already held (the first [2] of a brand-new session legitimately says 0 and forces nothing), whenever the hash changed, and in the [3] that answers contextResync: true (same round, results: [], no action run). The flag is read from REST bodies and from SSE batch_start.
  • Component seam (phase 2): ComponentHandler (lib/src/engine/component_handler.dart)
    • ShareMapEngine.registerComponentHandler(). The engine routes component.* to the handler's precheck (Pha A, whole batch) and apply (one call per run of consecutive component actions), clear(origin) for ai.clearContent, and inventory() for mapContext.component. Without a handler component.* stays in the whitelist but is not advertised and is rejected COMMAND_NOT_ALLOWED (command-not-in-capabilities) — never silently dropped.
  • New public API: managed_id.dart (generateEntityId, stableEntityId, parseManagedId, parseLayerId, layerIdFor), ShareMapDataset / registerDataset, ShareMapTemplate / registerTemplate, ShareMapIcon / setIcons, markSourceLive, handleFeatureTap / handleMarkerTap, ShareMapEngineOptions.{allowedTileHosts, propertyWhitelist, styleJson, cameraLimits, featureStateSupported, reducedMotion, onInteraction, onTemplatePopup, httpClient} and copyWith.
  • Local agent tools generate 2.0.0 ids (aiToolSourceId / aiKeyedSourceId, same slots as the web toolIds.ts) and the new marker.addFromSource payload.
  • sharemapSdkVersion / package version 1.2.0.

AMJSON Components 2.0.0 — the component target (phase 2) #

Spec: ai-map-protocol/sharemap-amjson-components.md (chapters 3–12), port of the web engine sharemap-maplib-reactjs/src/lib/engine/component/.

  • ComponentEngine (lib/src/engine/component/) implements ComponentHandler; ShareMapLibre registers it with every engine it builds, so capabilities.components (marker, popup, route), component.add/update/get/remove and the 13 built-in pins (capabilities.icons, after the app's sprite icons) are advertised by default. Headless engines call engine.registerComponentHandler(ComponentEngine()).
  • Pha A on a draft Component Memory for every component action of the batch (an ai.clearContent in between is simulated): identity (type outside capabilities.components → COMMAND_NOT_ALLOWED on /type, id format, kind ↔ type, origin → NAMESPACE_VIOLATION, "one id, one resource" against sourceIds both ways), shape of every attribute (no unknown fields, no clamping, null = back to default in update), merge (style deep, objects / arrays replaced, lngLat ↔ along, content ↔ template, a route type change drops old-type state and style overrides, new geometry re-selects option 0), then on the merged config: along.routeId (same origin, COMPONENT_NOT_FOUND + missing-dependency; order inside items irrelevant, later actions not visible), "{progress}" needs a progress route, wrong-type attributes, COMPONENT_DEPENDENCY_CONFLICT, stops (full markers, lngLat, no along / drag, same origin, unique ids), templates (TEMPLATE_NOT_FOUND + repair.available, wrong kind → SCHEMA_INVALID, data checked against dataSchema with the exact path, image-url fields outside allowedIconHosts dropped then re-checked), ICON_NOT_FOUND + available, caps checked on the Component Memory after the action (200 / 50 / 50 per origin, 10 open popups, one placeOnClick per origin, 10 000 vertices…). Errors carry path (JSON Pointer), repair and data.errors (≤ 10 rows; beyond that rows with the same code
    • path tail are grouped with count; errorCount = total).
  • Component Memory — the indexed component store (id / type / origin / tag / owner), class ComponentMemory in component_memory.dart, exposed as ComponentEngine.memory; the 10.12 API on ComponentEngine: get, count, list(ComponentQuery), fromFeature, export, events / on(listener).
  • Compile → fixed resources: features on sm-points / sm-lines (+ sm-polygons reserved, sm-anim-points / sm-anim-lines) carrying sm:* properties (only values that differ from the layer defaults), layers sm-marker-{grp} / sm-route-{grp}-{casing|dash|line|label} per group key (zIndex / zoom range / alignment) inserted with the C3 belowLayerId, never moved, empty groups removed; built lazily on the first component action, rebuilt after a style reload. One setGeoJsonSource per changed source per run of consecutive component actions; no-op actions → skippedByDiff. Pha B failure (e.g. an image that cannot be drawn) → EXEC_FAILED, sources restored, Component Memory untouched.
  • Images keyed by content (sm-emoji-…, sm-pin-…, sm-url-…, sm-{pin}, sm-tpl-…, -b… for borders), drawn with dart:ui (UiComponentRasterizer: built-in pins drawn as paths, emoji, https / data: URLs through the engine HTTP client, ShareMapTemplate.renderImage for marker templates, borders), reference counted, all drawn before any source write.
  • Routes: basic; progress cut into done / rest geometries (no line-gradient), markers along "{progress}" on the same cut; alternatives (selected option on top; tapping another option selects it → select by user; update → select by batch); transition interpolates progress on the sm-anim-* copies (~60 fps timer, line and markers in the same frame, updated with changed: ['progress'] at the end; instant with reducedMotion); stops are full markers owned by the route (cascade on remove, list replaced on stops, a stop removed alone leaves stops).
  • get → {count, missing, truncated, items: [{component, state}]}, read where the action sits in the batch; AI reads only its own components, app reads both.
  • ai.clearContent removes the origin's components (removed, reason: clear); so do the host calls ShareMapEngine.clearAiContent() and the new clearAppContent().
  • ComponentEngine.setOpen(id, open) (spec §8.3, §10.12): the host opens / closes a popup of any origin on the user's behalf (not an AMJSON command — no namespace check). Changes only state.open, emits open / close with by: "user", returns false for an id that is not a popup; a visible: false popup remembers it without showing; the owner's next update with open re-applies the config.
  • Chat helpers for place mentions (spec §5.7, amjson-mentions.md): readItinerary(engine) reads the itinerary from the Component Memory (markers tagged plan, ai before app, else the route with most stops), and resolveCitation(engine, citation) / popupPairs(citations) turn citations[].componentIds into a fly-to target + the paired popup to open.
  • Events (click, hover, contextmenu, dragstart, dragend, placed, select, open, close, action — only when declared in events; added / updated / removed always) go to ComponentEngine.on; user interactions are recorded into meta.lastInteraction (lngLat only for click / dragend / placed).
  • mapContext.component: counts by origin / type; items with label (marker label / route metadata.label / popup content.title, cut to 60), no coordinates / properties / popup content; 600 items then truncated; route progress stays out of contextHash.
  • Popups are a Flutter widget overlay (ComponentPopupLayer, placed by ShareMapLibre in a Stack above the map): positions from one batched toScreenLocationBatch per camera change (in-flight calls coalesced; trackCameraPosition is switched on only while a popup is shown), anchor (including auto), offsetPx, maxWidthPx ≤ 480, close button, closeOnClick (a popup opened while handling a click survives that click), closeOnMove, zoom range; PopupContent rendered as plain Text (never HTML) with action buttons; templates through ShareMapTemplate.popupBuilder(context, data, ctx) (ctx.emit limited to the template's actions, ctx.close). The phase-1 template popups of layer.add.interaction.popup / marker.addFromSource.popup open in the same overlay when the app does not set onTemplatePopup.
  • Facades SMMarker, SMRoute, SMPopup (+ SMIcon, SMComponentError): attach(engine) = component.add, mutations send component.update with only the changed keys, remove(); position is an alias of lngLat; SMRoute.setProgress(p, durationMs:), selectOption, setStops (stable ids per position), fitBounds; SMPopup.open/close/setContent/setTemplate; listeners (onClick, onDragEnd, onSelect, onAction, …) declare their interaction event to the engine. Commands go through the new ShareMapEngine.executeBatchQueued (serial, never superseded).
  • ShareMapTemplate gains popupBuilder / renderImage; its capability data drops format: "image-url" fields. Seam additions: ComponentHost.{sourceIdExists, icons, templates, isIconUrlAllowed, reducedMotion, fetchImageBytes, recordMapCall}, ComponentHandler.{hasComponent, builtinIcons, showTemplatePopup}, ComponentActionRef.isClear.
  • Demo: example_web → "AMJSON Components".
  • User overlay on config (spec §5.5) — user interactions write only state, never config, and the write lands before the event fires:
    • Popup inputs: PopupContent.inputs[] (≤ 8; text with required maxLength 1–300 and optional placeholder, number with min / max, select with 1–20 options, toggle; initial value checked against the kind) validated in Pha A with exact paths; template popups (layer.add / layer.setInteraction interaction.popup, marker.addFromSource.popup) declaring content.inputs → SCHEMA_INVALID on …/popup/content/inputs. The overlay renders text / number fields, a dropdown and a switch, and commits on Enter / blur / selection / toggle (not per keystroke; out-of-range numbers do not commit). A commit that differs from the effective value writes state.input[name] then emits input (name, value) — implicit, declaring "input" in events is SCHEMA_INVALID; equal value → silent; state.input capped at 2 KB. Templates declare ShareMapTemplate.inputs (ShareMapTemplateInput, published in capabilities.templates[].inputs, checked at registerTemplate) and commit with ctx.setInput(name, value) (bad name / type / cap → ignored with a debug warning); ctx.input exposes the current values. ComponentEngine.commitInput is the shared path. An update sending content or template / data clears state.input; other updates keep it. mapContext.component.items[].input (in contextHash), meta.lastInteraction {event: "input", name, value}, get state.input.
    • Dragged / placed markers keep config.lngLat as declared and store the position in state.lngLat + moved: true (previously the drag rewrote config). Rendering, get state.lngLat and export use it; an update without lngLat (e.g. a new icon) keeps the dragged position; an update with lngLat / along resets it (moved: false, updated even when the value equals the config).
    • Route option chosen by the user (tap on an alternative) writes only state.selectedOptionIndex (previously an internal update rewrote config.selectedOptionIndex): re-rendered with the state index, select with by: "user", no updated. An owner update without selectedOptionIndex / coordinates / alternatives / routeType keeps the choice; one that sends any of them resets it to the config value (new geometry still re-selects option 0) — discarding a different user choice is a real change (updated.changed has selectedOptionIndex, select by: "batch"), even when the config is identical. get state, mapContext, fitBounds, bbox, markers along the route and export use the effective index; add replacing the route resets it.
    • export now merges the overlay into the config (dragged position, chosen option, open: false, entered values as inputs[].value); get keeps config and state apart.
    • No lost user writes while a run is being applied: when the applied run is committed to the Component Memory, entries the run did not touch are taken from the live store, and every update item re-carries the overlay written meanwhile (entered values, dragged / placed position, chosen option, open from a user close or setOpen) for the field groups it did not send; add carries nothing. If the carried overlay changes what is drawn, the component is re-rendered silently, and the popup overlay shows the carried values.
  • Host writes ComponentEngine.add / update / remove(items) (spec §10.12): one component.* action with origin: "app" through executeBatchQueued (Pha A on a draft, lifecycle events); returns the action data, throws SMComponentError (with errors[] and the full result) when rejected. Seam addition: ComponentHost.executeBatchQueued.

AMJSON Theme, preset, sprite pins, componentVersions (phase 2, protocol sync 2026-10-07) #

Spec: ai-map-protocol/sharemap-amjson-theme.md (new), sharemap-amjson-components.md §5.2 / §5.6 / §6.2 / §7.4 / §10.2 / §10.5 / §11, ai-map-protocol.md §3.1 / §7.2, schemas amjson-command / -input / -result / -transport / -theme (new), all protocol examples re-synced into test/fixtures/ (whole examples/ tree, plus amjson_theme/sharemap.json, amjson_cases/, amjson_toolgroups/, amjson_usage/).

  • componentVersions (components doc 5.6) — kComponentVersions { marker: "1.0", route: "1.0", popup: "1.0" }, written right after version: in every [1] the runtime builds (buildMapAgentInput), in every [3] (JsonResult.componentVersions, default kComponentVersions; also the remote runtime's result packet) and in every [2] the host write API / SMMarker / SMRoute / SMPopup compose (buildComponentBatch — only the types the items use). JsonCommandBatch.componentVersions is parsed and kept on incoming [2]; the envelope check (validateBatchJson) only enforces what the schema enforces — presence when the batch has a component.* action and the shape (non-empty, keys marker | route | popup, values MAJOR.MINOR) — SCHEMA_INVALID at /componentVersions. Values are never compared or branched on.
  • AMJSON Theme. themes/sharemap.json is embedded (kSharemapThemeJson, ComponentTheme.sharemap), the theme schema too (kAmjsonThemeSchemaJson, both drift-checked against the fixtures). ComponentEngine(theme: json) / ShareMapLibre(componentTheme: json) load a theme at setup, engine.setTheme(json) later, engine.theme → {name, version}, engine.currentTheme the merged ComponentTheme. Loading (theme doc 5.1): schema → extends resolved against the themes already loaded (sharemap always; chain ≤ 4) with deep merge (null deletes) → merged result must be a complete root theme (§7) → ≤ 64 KB; any failure throws ComponentThemeError and the current theme stays. Compile (5.2 / 5.3): the fixed layers take their fallbacks from theme.<type>.default — route layers from the line stroke (cap constant and the dash layer's pattern from remaining.dash, see below), marker label text-size / text-color / text-halo-* plus icon-size / icon-opacity from marker.default; icon-image falls back to pin, icon-anchor to bottom. A component compiles as theme.default ← presets[preset] ← its own tokens and writes only tokens that differ from the layer fallback: a component with no tokens carries identity keys + geometry only (routes keep sm:ccolor / sm:cwidth because the casing layer filters on has). setTheme (5.4) is one pass after idle (waits for drags / progress transitions): setLayerProperties on every fixed layer in place (no remove / add), every Component Memory entry recompiled, one setGeoJsonSource per changed source, theme images (dots, framed sprites) re-drawn and stale ones released, popup overlays re-framed, no lifecycle events; same name + version is a no-op; a basemap style reload rebuilds the fixed resources with the current theme. Popup default / preset frame tokens are the overlay defaults; the look tokens (background, foreground, muted, accent, radiusPx, shadow) travel as PopupOverlaySpec.look and become a local Theme of the default popup card (templates read them through Theme.of(context)).
  • preset common attribute (components doc 5.2, theme doc 4) on marker / route / popup: ^[a-z][a-z0-9-]{0,39}$ or null; a name not in the current theme → PRESET_NOT_FOUND (new ErrorCodes.presetNotFound, in the registry) with path and repair.available = the theme's presets of that type; update with a new preset keeps the component's own overrides, preset: null returns to default. mapContext.component.items[].preset; capabilities.theme = { name, version, presets: { marker[], route[], popup[] } } (ComponentHandler.themeCapability). The per-stroke preset in route.style.* and the five hardcoded names (primaryActive…) are gone — an unknown key, SCHEMA_INVALID; the stroke / label defaults that used to be constants in component_defaults.dart / component_fixtures.dart now come from the theme.
  • Marker icon { name } (components doc 6.2): kind: "pin" | "other", default pin. pin → name ∈ pin | pin-blue | pin-orange | pin-red (sprite pins), anchor bottom, optional pinText (1–2 chars) + pinTextColor (default marker.pin.textColor, white); other → any sprite name (ICON_NOT_FOUND otherwise), anchor center, no pinText. Every invalid combination is SCHEMA_INVALID at the precise path (/icon/name, /icon/kind, /icon/pinText, /icon/pinTextColor), matching the schema's if/then rules. The 13 engine built-in pins are gone (kBuiltinPinNames, pin-number, *-blank, ComponentHandler.builtinIcons): capabilities.icons[] lists sprite names only. Rendering: a pin without text is the sprite image itself (sm:icon: "pin-red"; pin is the layer fallback, so no sm:icon); a pin with text is drawn by the engine onto a copy of the sprite pin (sm-pintext-{pin}-{text}-{color}, text size scaled for 1 vs 2 chars); { color } is now a filled dot per marker.dot (sm-dot-{color}-{size}-{borderColor}-{borderWidth}, -none-0 without border), anchor center — no more coloured pin; sm:anchor is written only when ≠ bottom. border (theme / preset / component) applies to other, emoji, url and template icons only — never to pins or dots; a framed sprite icon becomes a copy sm-sprite-{name}-b…. Omitted icon = { name: "pin" }. SMIcon.name(name, {kind, pinText, pinTextColor, sizePx}), SMIcon.pin(...), SMIcon.sprite(...); preset: on the three facades.
  • Tests: component_theme_test.dart (theme embed / schema drift, load / extends / merge / completeness, capabilities.theme invariant, preset resolution and PRESET_NOT_FOUND, delta-vs-theme compile invariant, pin kind / pinText validation and image ids, dot ids, componentVersions in [1] / [3] / host-API [2] and the envelope check, setTheme — in-place layers, recompile, single write, no events, no-op, invalid keeps current, setTheme ≡ fresh engine, style reload, popup card colours); existing tests updated for the removed built-in pins, the dot, the bottom anchor default and the removed per-stroke preset.

Route stops are always numbered pin-blue sprite pins (protocol sync 2026-10-07) #

Spec: components doc §7.2 (stops, "Marker điểm dừng" → "Hình và số thứ tự"), §7.6 R2 / R3, schema $defs/RouteStop + stops.maxItems 99, mentions doc §5; fixtures and the embedded command schema re-synced.

  • Every route.stops[] marker is a sprite pin kind: "pin": omitted icon → pin-blue, or exactly { name: pin | pin-blue | pin-orange | pin-red } (kind: "pin", sizePx allowed). Any other icon (emoji, url, template, { color }, "none", kind: "other", a non-pin name) and any sender pinText / pinTextColor → SCHEMA_INVALID at the stop's /icon (/icon/kind, /icon/name, /icon/pinText, /icon/pinTextColor) — checked before the generic icon rules, so no extra ICON_NOT_FOUND row. The same rule applies to a marker that is a stop when it is updated / re-added on its own (R3).
  • The engine draws the number: pinText = 1-based position in the owning route's stopIds, text colour = theme marker.pin.textColor (sm-pintext-pin-blue-1-ffffff). It is never stored in the stop's config — get / export stay valid input. Whenever a route's stop list changes (stops re-sent / reordered, a stop removed or moved to another route) every remaining stop is recompiled with its new number in the same single source write, without updated events. A stop updated directly (icon: { name: "pin-red" }) keeps its number; icon: null returns it to pin-blue.
  • ComponentLimits.routeStopsMax 100 → 99 (number always ≤ 2 characters).
  • route.stopNumberStart (§7.2): integer 1–99, default 1 (1 / null are not stored in the config; null in update = back to 1). Stop i (0-based) shows stopNumberStart + i. After the merge the engine checks stopNumberStart + stops − 1 ≤ 99 (stops sent, or the current list when an update does not send stops) → SCHEMA_INVALID at <item>/stopNumberStart. Changing it renumbers every stop of the route: only the number images not yet loaded are rasterized (ids keyed by content and shared across routes), unreferenced ones are released, stops whose number is unchanged are not rewritten (feature diff), exactly one sm-points write, no sm-lines write, no updated for the stops. Re-adding a route with the same stops but another start still redraws them. SMRoute(stopNumberStart:) + setStopNumberStart(int?).
  • mapContext.component.items[].icon of a stop is its pin name (pin-blue by default).
  • Free markers are unchanged (any icon; the sender may set pinText).
  • Tests: test/engine/component/component_route_stops_test.dart (default pin-blue + numbering, renumber after stops replace and after removing a stop, stop update keeps its number and is validated, invalid stop icons / pinText, export round-trip, 99-stop cap, free markers unaffected, stopNumberStart numbering / single sm-points write / overflow / facade).

Sharp markers, centred pin numbers (protocol sync 2026-10-07) #

Spec: components doc §3.3 C2 / C2a, §10.2, §10.5, theme doc §5.2 (mirrors the React fix).

  • Blur. MapLibre samples a symbol layer LINEAR as soon as icon-size / icon-rotate read feature data (or icon-size ≠ 1), which made every component marker softer than the style's POI icons. Each group now has the base layer sm-marker-{grp} (filter !has sm:tf, constant icon-size = theme marker.default.scale, no icon-rotate) and a lazily built sm-marker-{grp}-transform (filter has sm:tf, data-driven size / rotate), pruned when unused — also in z0; a group's animation layer stays while its transform layer is used. Features carry sm:tf: true when they have sm:size, sm:rotate, along.rotate or an image-scale compensation sm:isize. Order in a group: base < animation < transform. Taps / long-press queries / setTheme cover the new layer.
  • Pin number off-centre. The number is placed at the centre of the pin head measured from the sprite pixels (pinHeadOf: bbox of opaque, non-white pixels in the top 80 %; cy = top + min(d, bboxHeight)/2; fallback (w/2, 0.405·h, 0.65·w)), bold, 0.6·d (1 char) / 0.5·d (2 chars), centred on the measured ink bounds of the glyphs.
  • Sharpness of pin-number images. Without sizePx the pin is copied 1:1 from the sprite atlas and registered at the atlas's own pixel ratio (no resampling); sm:isize is computed per image (ImageRatioProvider.pixelRatioFor). Other engine-drawn images use the map's pixel ratio. ShareMapSpriteService now loads the @2x atlas on high-density screens (falls back to 1x).

Khoảng lệch — what MapLibre Native cannot do, and the closest behaviour shipped #

Giải thích theo nhóm, ảnh hưởng tới AI và hướng làm tiếp: doc/ios-android-chua-ho-tro.md.

Spec On iOS / Android Why
feature.setState / clearState, interaction.hoverState Not advertised; Pha A answers COMMAND_NOT_ALLOWED. Run on web (featureStateSupported, default kIsWeb). hoverState is ignored everywhere The plugin throws UnimplementedError for feature-state on Native; the web hover callback carries no layer id
source.patch Patch applied to the engine's copy, whole source re-sent with setGeoJsonSource; transition interpolates Point positions and numeric properties at ~10 fps No GeoJSONSource.updateData on Native
source.addOrUpdate.filter Applied as ['all', sourceFilter, layerFilter] on every layer reading the source Native GeoJSON sources have no filter
options.cluster.minPoints Ignored GeojsonSourceProperties has no clusterMinPoints
Changing options of an existing source Source removed and re-added, its layers re-attached Native cannot change source options in place
image.remove Overwrites the image with a 1×1 transparent PNG and forgets it No removeImage
image.add pixelRatio, stretchX/Y, content; SVG Ignored; SVG → EXEC_FAILED addImage(name, bytes, sdf) only, decoded by the platform
layer.add.iconTemplate Pha A checks the template; execution → EXEC_FAILED (intent-not-expressible, use image.add + icon-image) No canvas template rendering on Native yet
animation dash-flow / pulse Timer at ~10 fps re-sends paint (line-dasharray phase cycling, circle-radius/opacity) No requestAnimationFrame / line-dash-offset
interaction.popup, marker.addFromSource.popup Content filled from the tapped feature (text only); shown in the component popup overlay, or handed to onTemplatePopup when the app sets it; openOn: hover opens on tap No popup widget on Native
interaction.expandClusterOnClick Zooms in two levels at the tap No getClusterExpansionZoom
hover events of layers Not emitted No hover on touch; the web hover callback is not wired (no layer id)
setPaintProperty / setLayoutProperty on a layer the engine did not add Merged with the layer's definition from the loaded style JSON; unknown style → EXEC_FAILED setLayerProperties overwrites every property
camera.flyTo.speed / essential speed → fixed duration (1.2 ≈ 1.5 s); essential ignored Native animations take a duration
camera.padding Not emitted The library has no persistent view padding yet
query.renderedFeatures without options.layers One query over every layer; strict property whitelist, no layer member No layer attribution in that query
mapContext.source.items Sources added straight through the controller (annotation managers, app raster layers) are omitted Their type is unknown without getStyle() (iOS)
meta.settled false while a live source, animation or transition exists idle never comes
Component source writes Whole sm-* source re-sent with setGeoJsonSource, once per changed source per run of component actions No updateData on Native (rule A4 allows exactly this)
Component images released Overwritten with a 1×1 transparent PNG No removeImage
Route dash / cap tokens Every dashed line uses the theme's route.default.remaining.dash pattern (sharemap: [1, 1.5]; a custom dash only switches the line to dashed); cap is always the theme's route.default.line.cap; join is honoured Native does not accept data expressions for line-dasharray / line-cap
Pin with pinText (sprite pin + text) The engine copies the pin from the sprite atlas the widget downloads over HTTP (ShareMapSpriteService, the style's sprite URL — the same PNG MapLibre renders) and draws the text on it. When no atlas is loaded (headless engine, style without sprite, atlas still downloading) a vector fallback pin with the ShareMap pin shape and colours (kFallbackPinColors) is drawn instead; image ids stay sm-pintext-{pin}-{text}-{color}. The pin head is measured from the atlas pixels; the vector fallback uses its own circle MapLibre Native does not expose the pixels of the sprite it loaded; the atlas has to be fetched separately
Framed sprite icon (kind: "other" + border) Copied from the same HTTP atlas; no atlas → EXEC_FAILED ("sprite icon … is not available in the loaded sprite atlas") Same — nothing to draw the frame on without the atlas
Theme presets.<name>: null (drop an inherited preset, theme doc §8) Accepted on themes with extends; the schema check runs on the file with those entries removed, the merge then deletes the preset amjson-theme.schema.json only allows preset objects — the doc and the schema disagree; the engine follows the doc for inherited themes and the schema for root themes
setTheme cost Every fixed layer gets setLayerProperties (whole paint + layout re-sent) and each changed sm-* source is re-sent in full No setPaintProperty for a single property, no updateData on Native
Engine-drawn marker images Drawn at the device pixel ratio (pin numbers: at the atlas ratio); when the platform's read ratio differs the feature carries sm:isize = platformRatio / imageRatio, folded into icon-size — such markers live on the -transform layer (LINEAR sampling), so on Android / web engine-drawn images cannot be as sharp as sprite icons addImage has no pixelRatio: Android / web read the bytes as 1x, iOS at screen scale
Marker dragging Plugin feature drag (draggable: true on the feature; press-and-move on touch, mouse drag on web), positions written to sm-anim-points, dragend with bounds snap-back, placeOnClick on empty-map taps No DOM marker; the native drag only reports positions
contextmenu Long press (onMapLongClick) on every platform — no right click on web The plugin has no context-menu event
Component hover Web / mouse only (onFeatureHover) No hover on touch
"One click, one component" The plugin reports the first interactive feature it hits; the topmost one is not guaranteed when components overlap Native hit-test order is not exposed
icon.url with SVG EXEC_FAILED at apply ("SVG icon images cannot be rasterized") dart:ui cannot decode SVG without an extra dependency
hideUnderlyingPoi Validated (app only) and stored, not applied — the basemap POI under the marker stays visible Needs per-style POI layer filters; cut from this release
Marker ariaLabel Stored, not exposed to screen readers (popups use Semantics) Symbol layers have no accessibility tree
Event point Logical pixels (Android's physical pixels divided by the device pixel ratio) Android reports physical pixels

Also in this release (protocol 0.1.0 groundwork, never released on its own) #

  • AI Map Protocol 0.1.0 (kProtocolVersion). Additive: JsonCommandBatch gains round (default 1), session, citations and pass-through usage (malformed usage is dropped, never rejects the batch); JsonResult gains round, status (ok/partial/rejected) and sessionId; ActionResult gains repair and path. 0.0.1 batches run unchanged.
  • Engine idempotency cache is keyed by (responseTo, round) (§9.2). Keying by responseTo alone returned round 1's Result for round 2 of the same turn, so follow-up and repair batches never ran.
  • New validateBatchJson checks the envelope of a network [2] (unknown fields, version major → VERSION_MISMATCH, responseTo, round, onError, actions).
  • Remote Map Agent client (lib/src/agent/remote/, AI on the backend): MapAgentAdapter ([1]/[3] → [2]/204, typed HTTP errors), MapAgentRuntime (builds [1] with requestId/sessionId/projected mapContext/capabilities/client, executes [2] on ShareMapEngine, replies [3] with resultFor/round/status/sessionId, loops while 200, persists sessionId through an injectable MapAgentSessionStorage) and MapAgentChatController for UI state.
  • Byte caps (§9.6.1): a [2] over 8 MiB is not read further (turn fails, no [3]); 4–8 MiB is parsed and answered with a rejected [3] where every action is PAYLOAD_TOO_LARGE with repair.limit/actual; L3 data in [3] is trimmed to 1 MiB (features dropped from the end, truncated/totalBeforeCap) on a copy, and a [3] over 2 MiB throws instead of being sent.
  • AMJSON Wire v1 (§9.1.7): AES-256-GCM over raw deflate with a per-session key from POST <endpoint>/wire-key; wire: AmjsonWireMode.enc by default, falls back to JSON on 404/415, retries once on WIRE_KEY_INVALID. Passes every vector of ai-map-protocol/examples/wire/. Ships a strict, bounded raw-inflate decoder (pure Dart, web-safe) that rejects truncated/trailing streams and stops decompression bombs while inflating.
  • Remote Map Agent is SSE-only (§9.1.4, §9.1.6): the Fleet Map Agent answers only with text/event-stream, so MapAgentAdapter always sends Accept: text/event-stream for [1] and [3], reads the response incrementally (UTF-8 + line splitting that survive any chunk boundary, keep-alive comments ignored) and reassembles the frames (§9.1.3) into the [2] exactly like reassemble() in ai-map-protocol/scripts/validate.py — including session from batch_start and usage/citations from batch_end. Over AMJSON Wire each event's data: is a base64url wire packet holding the {type, payload} frame (§9.1.7). 204 closes the turn; 406 throws a MapAgentHttpException saying the agent does not serve SSE; a 2xx that is not text/event-stream is an error. The 415/WIRE_KEY_INVALID retry-once paths are unchanged.
  • New MapAgentStreamException (STREAM_INCOMPLETE): stream ended before batch_end, connection lost, silent for timeout or longer than the new streamTimeout (default 5 min), out-of-order/gapped index, actionCount mismatch, any frame after batch_end, malformed progress. New MapAgentErrorFrameException carries the code/message of an error frame. The client buffers until batch_end, so a broken stream never half-runs a batch.
  • Progress (§9.1.3 progress frame): MapAgentAdapter.send(onProgress, onMessageDelta) → MapAgentRuntime.ask(onProgress, onMessageDraft) → MapAgentChatController.progress (MapAgentProgress {stage, text, tool}) and draftMessage, set while thinking and cleared when the turn ends.
  • Byte caps over the stream: the 8 MiB read cap is cumulative over the raw stream (plus framing slack) and, over wire, over the inflated frame JSON; MapAgentReply.byteLength is the JSON byte length of the reassembled [2], so the 4 MiB rejected rule is unchanged.
  • ErrorCodes registry gains AGENT_UNAVAILABLE and RATE_LIMITED (§7.2, error frame only — never in [3]).
  • Web streams too: package:http's BrowserClient uses fetch with a ReadableStream body, so progress arrives as it happens in the browser. The same-origin proxy must pipe the stream without buffering.
  • example_web: the Map Agent panel shows the agent's progress text (stage icon, tool name) and the streaming aiMessage draft while a turn runs.
  • New dependencies: cryptography (AES-GCM, WebCrypto on web) and archive (raw deflate). http lower bound raised to ^1.6.0 (AbortableRequest; on the web, cancelling a response subscription that waits for the next chunk).
  • example_web: "Map Agent" mode in the AI Agent screen (default endpoint /api/map-agent/chat).
  • Debug tool sees the remote Map Agent path. MapAgentRuntime emits, only when debugBus.enabled, around every transport call ([1] and each [3]): remote:send (MapAgentSendEvent: packet input/result, round, endpoint, wire actually used, plaintext UTF-8 bytes, exact body), remote:progress (MapAgentProgressEvent), remote:receive (MapAgentReceiveEvent: 200 with the reassembled [2] or 204, durationMs) and remote:error (MapAgentErrorEvent: code, httpStatus, message). traceId is the turn's requestId, so they group with the engine events of the same turn. The panel shows plaintext packets even though AMJSON Wire encrypts the network — a local, opt-in dev tool; events never carry the wire key, kid or ciphertext.
  • New debug groups input, remote ("Map Agent") and result, new flow stages input/remote/command/result, and DebugViewMode (client / backend): the Debug Panel gets a "Tự động | LLM ở client | LLM ở backend" switch — auto follows the most recent turn (detectViewMode) — and each mode shows only its own group filters and flow diagram (engine/map in both).
  • DebugStatus.warn (amber in the panel, ⚠️ in the console; not counted by "Chỉ lỗi" or the 🐞 badge): used for remote:error with code SUPERSEDED.

1.1.0 #

  • Layers token: with xApiKey + secretKey, the SDK now exchanges them for a short-lived token at POST https://geomesh.sharemap.live/layer/token and attaches it as ?t= to layers.sharemap.live tile URLs. Tiles and layers use separate token sources and separate endpoints; a tiles token is rejected by layers. New optional layersTokenUrl overrides the layers endpoint (dev/staging).
  • Breaking default: enableTilesToken now defaults to true. Apps without keys keep using the free tier with no extra network calls; apps that set only one of xApiKey / secretKey get a configuration warning.
  • Mobile client identification: every request carries X-Sharemap-Client and a SharemapSDK/<version> (...) User-Agent with package name, OS, OS version and device model. See doc/mobile_client_identification.md.
  • Add POI models, ShareMapPoiService, map controller POI extension, sprite service and ShareMapSpriteIcon widget.
  • Add min zoom for business layers.
  • Style requests authenticate with the x-api-key header.
  • Debug panel logs transformed map requests.
  • Warn when a layer or POI call has xApiKey but no secretKey.

1.0.1 #

  • Upgrade sharemap_maplibre_gl to 0.26.2+sharemap.2, including the corrected iOS CocoaPods and Swift Package identities.

1.0.0 #

  • Map requests use MapLibre transformRequest to resolve authentication for each resource URL. HMAC credentials are sent through the x-api-key header; the style loader no longer inserts them into source, tile, or glyph URLs.
  • Add opt-in enableTilesToken: acquire and refresh short-lived tiles tokens, attach them as ?t= on supported tile hosts, and keep HMAC authentication for business layers and Geomesh APIs. The option remains disabled by default.
  • Fix Android MapLibre initialization before HTTP client/platform-view setup.
  • Fix Dart web compilation by removing an unsupported 64-bit integer literal.
  • Pin the hosted sharemap_maplibre_gl dependency to 0.26.2+sharemap.1. Known iOS limitation: this dependency still uses the old CocoaPods package identity; iOS integration is not verified for this release.
  • Android hosts require JDK 21, Android SDK 36, and NDK 28; the pinned MapLibre dependency specifies NDK 28.1.13356709.
  • Background Location remains experimental in this release. This version does not certify its stability; see the existing device-test checklist and limits.
  • Upgrade from 0.0.5: resolve the new package/dependency versions and perform a full rebuild after the native dependency changes (hot reload is insufficient).

0.0.5 #

  • Fix: Switch to published sharemap_maplibre_gl dependency and remove obsolete maplibre_gl git overrides.
  • Fix: Restore ShareMapLibre.isShareMapLayersHost static helper.
  • Fix: Repair missing or empty Android background-location disclosure strings during setup.

0.1.0-dev.1 #

  • Thêm vị trí nền native dạng chủ động bật cho Android và iOS.
  • Thêm model vị trí, trạng thái và lỗi đã chuẩn hóa cùng broadcast stream.
  • Thêm public options trực tiếp cho bốn tham số Android LocationRequest và năm tham số iOS CLLocationManager; không dùng profile hoặc tracking mode.
  • Hợp nhất public entry point: background location được gọi trực tiếp qua ShareMapLibre.start(), stop(), getStatus() và các stream liên quan.
  • Breaking: xóa ShareMapTrackingMode và field mode khỏi ShareMapLocationStatus; start() không truyền options vẫn dùng bộ giá trị mặc định tương đương cấu hình normal trước đây.
  • Thêm ShareMapTrackingOptions.maxDuration để ứng dụng host tùy chọn mốc tự dừng tổng thời lượng phiên; status bổ sung sessionStartedAt và expiresAt.
  • Thêm lệnh setup chạy lặp an toàn và lệnh doctor chỉ đọc cấu hình.
  • Thêm example tester tối giản, chỉ dùng public API để tích hợp foreground service Android và Core Location iOS.
  • Giữ nguyên API MapLibre hiện có; networking và lưu trữ dữ liệu nằm ngoài plugin.

0.0.3 #

  • Fix: Update street style URL path to correct sharemap-streets.json resource endpoint.

0.0.2 #

  • Fix: Resolve type compilation error by refactoring class inheritance with createState override.

0.0.1 #

  • Bản phát hành đầu tiên của widget ShareMap MapLibre.
0
likes
130
points
915
downloads

Documentation

API reference

Publisher

verified publishersharemap.live

Weekly Downloads

A MapLibre-based map widget for Flutter integrating ShareMap APIs, supporting dynamic POI layer toggling, HMAC-signed requests, and custom style loading.

Homepage
Repository (GitHub)

License

unknown (license)

Dependencies

archive, crypto, cryptography, device_info_plus, flutter, geolocator, http, meta, package_info_plus, path_parsing, pointer_interceptor, sharemap_maplibre_gl, xml

More

Packages that depend on sharemap_maplib_flutter

Packages that implement sharemap_maplib_flutter