Builds a transformStyle callback that carries the GeoLeaf-owned sources and
layers from the previous style into the next one, appending the layers after
the incoming basemap layers so they render on top (correct z-order). The raster
basemap injection path re-inserts its layer at the bottom independently, so a
vector→raster swap keeps GeoLeaf layers on top as well.
Ownership is read through readOwned (the adapter's layer registry, and what code outside
the adapter declared to it) rather than inferred from id conventions, so the merge is
authoritative. It is read when the callback RUNS, never when it is built: a layer created
while a style URL downloads is GeoLeaf's too, and "nothing to preserve" is decided against
the real previous.
Preserved layers keep their serialized paint/layout (e.g. taxonomy match expressions
and visibility), and GeoJSON sources keep their serialized data — hence the
rebuild is unnecessary.
A declared basemap credit is set on the incoming style's own sources FIRST, before the merge,
so it never lands on a GeoLeaf data source. It applies on the first style load too.
Builds a
transformStylecallback that carries the GeoLeaf-owned sources and layers from the previous style into the next one, appending the layers after the incoming basemap layers so they render on top (correct z-order). The raster basemap injection path re-inserts its layer at the bottom independently, so a vector→raster swap keeps GeoLeaf layers on top as well.Ownership is read through
readOwned(the adapter's layer registry, and what code outside the adapter declared to it) rather than inferred from id conventions, so the merge is authoritative. It is read when the callback RUNS, never when it is built: a layer created while a style URL downloads is GeoLeaf's too, and "nothing to preserve" is decided against the realprevious. Preserved layers keep their serialized paint/layout (e.g. taxonomymatchexpressions andvisibility), and GeoJSON sources keep their serializeddata— hence the rebuild is unnecessary.A declared basemap credit is set on the incoming style's own sources FIRST, before the merge, so it never lands on a GeoLeaf data source. It applies on the first style load too.