Inspector inputs and sharing
The inspector accepts indexed fixtures, local .mlt files, and web URLs as tile sources. It keeps the chosen source and useful view state in the address bar, so an engineer can reopen the same tile and point to the same layer or region.
Source loading
Input sources
The source picker gives the inspector three ways to obtain tile bytes. Indexed fixtures provide known examples, a file load supports private or newly generated tiles, and a URL load supports a tile that a web server makes available to the browser.
The inspector keeps the source identity separate from the bytes. A fixture is identified by its fixture key, while a fetched tile is identified by its URL. A local file has no reusable source identity, so it can be inspected without being placed in a share link.
| Source | Selection model | Sharing behavior |
|---|---|---|
| Fixture | Choose from the catalog or a starter tile | Stored as fixture |
| Local file | File picker or drag and drop | Not stored as a source |
| Web tile | Enter an absolute or relative HTTP(S) address | Stored as url |
The URL path accepts only web schemes and fetches without credentials. This lets a shared URL name a tile without asking the recipient’s browser to send cookies to another site. The remote server must also allow cross-origin browser requests.
References: inspector/…/SourcePicker.vue• L217-255 inspector/…/fixtures.ts• L416-447 inspector/…/App.vue• L149-210
Load lifecycle
The app treats each source choice as a new move. A later choice cancels the visible effect of an earlier request, which prevents a slow fixture or URL response from replacing the tile that the user selected last.
The source flow turns a selected source into bytes, then into the region view and optional geometry data.
flowchart LR
A[Fixture, file, or URL] --> B[Load bytes]
B --> C[Annotate tile]
B --> D[Decode geometry]
C --> E[Region and byte views]
D --> F[Geometry view]
When bytes arrive, the inspector replaces the current tile, builds its byte and region view, and tries to create decoded geometry data. A failure in geometry decoding does not remove the byte view. The app reports source errors separately and returns to an empty home state when the user chooses Home.
The fixture catalog loads before a deep-linked tile is restored. This makes the picker ready for normal use and lets a bad catalog request remain visible instead of being hidden by a later reset.
References: inspector/…/App.vue• L91-107 inspector/…/App.vue• L109-160 inspector/…/App.vue• L256-269
Fixture catalog
Fixture index
The fixture index is the catalog contract between the build system and the browser. It records each tile’s key, size, and available format facets, while the build or development server exposes only the indexed tile bytes.
The catalog combines synthetic coverage with real-world tiles. Its facet data comes from the tile inspection command when that tool is available, so the picker can describe geometry, column, string, stream, and compression choices without decoding every tile in the browser.
The source list is the main maintenance point for test data. A new fixture corpus must be named there and must resolve to a directory. The generated index then supplies the same key used by the picker, the deep link, and the served byte path.
References: inspector/…/fixture-index.ts• L25-70 inspector/…/fixture-index.ts• L73-127 inspector/…/fixture-index.ts• L135-184
Fixture filtering
The fixture picker narrows the catalog with a name search and format facets. Facets are combined as requirements: a tile must satisfy every selected value, including every selected value within one axis. Counts show both the current match set and the wider coverage of the catalog.
The facet vocabulary is based on format concepts rather than only on values found in the current catalog. This keeps unsupported or missing cases visible as coverage gaps. Unknown values from the index remain visible instead of being discarded, which helps expose newer encoder output or a naming change.
The picker can sort the narrowed set by fixture name or byte size. Its starter choices are only shown when their keys still exist in the index, so they do not become stale links after fixture changes.
References: inspector/…/fixtures.ts• L100-215 inspector/…/fixtures.ts• L277-395 inspector/…/SourcePicker.vue• L161-215 inspector/…/fixtures.ts• L514-548
Decoder controls
Layer scope
The layer control changes which top-level layer the region tree displays. The decoder still owns region numbering for the whole tile, so the inspector maps a selected region in the filtered tree back to the whole tree before it asks the decoder for values.
This keeps byte details correct while allowing a large multi-layer tile to be read one layer at a time. Changing the layer clears the selected region because the visible tree has changed its numbering and contents.
References: inspector/…/RenderControls.vue• L8-47 inspector/…/App.vue• L53-77 inspector/…/App.vue• L79-89 inspector/…/hex.ts• L136-159
Payload limits
The detail pane and hover tip decode payloads on demand instead of decoding all values when a tile opens. The request includes a maximum value count, and the detail pane uses a separate character cap for long text.
Show more raises these limits in bounded steps. The result can report truncation, repeated runs, binary size, or a decode error without forcing the inspector to render a full large stream. This keeps source loading quick while still allowing focused inspection.
References: inspector/…/App.vue• L79-89 inspector/…/RegionDetail.vue• L12-22 inspector/…/RegionDetail.vue• L82-125 inspector/…/blob.ts• L7-24
Deep-link state
Query contract
The deep link is a compact query-string contract. It names the tile source and the position to restore, then carries the picker state and the two view panels that affect the shared reading context.
| Query value | Meaning |
|---|---|
fixture | Indexed fixture key |
url | HTTP(S) tile address |
layer | Top-level layer number |
region | Selected region number in that layer view |
at | Region label accepted for hand-written links and resolved on load |
Repeated f | Selected fixture facets |
q | Fixture search text |
geo=0 | Hide the geometry panel; omitted means shown |
stats=0 | Hide the statistics panel; omitted means shown |
The writer omits default values. The reader ignores unknown filter axes. Facet parameters repeat instead of joining, so format values that contain punctuation remain unambiguous. A label in at is resolved to a numeric region when possible, then the stable numeric selection is written back.
References: inspector/…/deeplink.ts• L5-31 inspector/…/deeplink.ts• L35-69 inspector/…/deeplink.spec.ts• L22-67 inspector/…/deeplink.spec.ts• L149-174
Browser history
Opening another tile creates a browser history entry. Moving within the same tile replaces the current entry, so changing layers or regions does not fill the Back button with every inspection step.
On a Back or Forward event, the app reads the query again. It reloads the source only when the link names another tile, then restores the layer, panels, picker state, and selected region after the tile is ready.
References: inspector/…/deeplink.ts• L71-88 inspector/…/App.vue• L215-254 inspector/…/App.vue• L271-304
Documentation embedding
The documentation page embeds the inspector in a frame and mirrors the app’s query string into the page URL. The standalone view can open a shareable link in a new window, while the framed view can return to the documentation page with the current state.
The app sends its current deep-link query to the parent page after it has applied the initial link. A reload of the documentation page therefore restores the tile shown in the frame rather than only the tile used to open the page.
References: docs/…/index.md• L42-63 inspector/…/App.vue• L306-360
Change checklist
When these files or sections are changed, remember to consider these:
- When fixture sources or fixture paths change, keep the catalog key, served byte path, starter keys, and
fixturedeep-link value aligned. - When a facet axis or value changes, update its vocabulary, filter key validation, and the generated facet names together.
- When source restoration changes, preserve the distinction between an indexed fixture, a URL tile, and a local file so history and sharing do not name the wrong source.
- When a view state becomes shareable, update both the deep-link read/write contract and the restore order used after asynchronous loading.
- When region filtering changes, keep filtered region indices mapped to the whole tile before calling the decoder.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A fixture is added without a matching indexed source path | The picker cannot load it or the build serves no bytes | Keep FIXTURE_SOURCES, index keys, and emitted fixture paths in one contract |
| A remote server blocks cross-origin requests | URL loading fails even when the address is valid | The picker explains the browser requirement and the app reports the fetch failure |
| An old or hand-written link names an invalid layer or region number | The app opens the tile but cannot select the requested location | Parse only non-negative integers and restore the selection only after the tree exists |
| A filtered layer index is passed directly to whole-tile decoding | The detail pane can show the wrong payload | Map filtered regions back to whole-tree indices before decoding |
| A slow earlier load finishes after a newer source choice | The address bar and visible tile can disagree | Each load checks its move number before applying bytes or errors |
Key files
| File | Why to read it |
|---|---|
| inspector/…/App.vue | Coordinates source loading, restoration, decoder calls, and address-bar state |
| inspector/…/SourcePicker.vue | Defines the user-facing fixture, file, URL, search, and facet flows |
| inspector/…/fixtures.ts | Defines fixture identities, facet matching, source validation, and byte loading |
| inspector/…/fixture-index.ts | Defines how test and real-world tile data becomes the browser catalog |
| inspector/…/deeplink.ts | Defines the shareable query contract and browser history behavior |
| inspector/…/RegionDetail.vue | Shows how selected payloads become bounded decoder requests |
| inspector/…/RenderControls.vue | Defines the layer and shareable panel controls |
| docs/…/index.md | Shows how the documentation page embeds the app and mirrors its link state |
| Tile inspector | Parent overview of the inspector’s role |
| Inspector views and annotations | Related overview of the byte, region, geometry, and annotation views |