@versatiles/style
    Preparing search index...

    Type Alias GuessStyleOptions

    Options for guessStyle.

    • urls — the same shape as for osm() and satellite(): base resolves relative URLs (tiles, glyphs, sprites) and defaults to the page origin, or tiles.versatiles.org outside a browser; glyphsPattern and sprite set where the guessed style loads fonts and icons from.
    • fetch — used when source is a URL, as for inlineSources() and fetchTileJSON().
    • schemas — additional schemas to recognise, each the builder from its own subpath.

    ── Why schemas is an option and a registry was not ─────────────────────────

    Auto-dispatch is the one thing one-function-per-subpath does not get for free. guessStyle lives in the root entry, so importing every schema here would reintroduce exactly the bundle cost that design avoids — a CDN user who never touches OpenMapTiles would still download it. Injection keeps the cost with the caller who asked for it:

    import { guessStyle } from '@versatiles/style';
    import { omt } from '@versatiles/style/omt';
    await guessStyle(tileJSON, { schemas: [omt] });

    This is acceptable here precisely where a global registry was not: guessStyle is already async, already does runtime detection, already takes a function-valued option (fetch), and its options never pass through minimizeOptions/toCode, so nothing here has to round-trip.

    The list is additive: which built-in schema a tileset is comes from guessSchema, which does not depend on schemas at all — injecting omt only decides whether a tileset already detected as OpenMapTiles gets its style or the inspector style. A schema of the caller's own (any other tileset.id) is tried after that, by its sourceLayers, in the order given.

    type GuessStyleOptions = {
        fetch?: FetchLike;
        schemas?: readonly SchemaBuilder[];
        urls?: Pick<OsmUrlsOptions, "base" | "glyphsPattern" | "sprite">;
    }
    Index
    fetch?: FetchLike
    schemas?: readonly SchemaBuilder[]
    urls?: Pick<OsmUrlsOptions, "base" | "glyphsPattern" | "sprite">