mirror of
https://github.com/bitbaum/substrata.git
synced 2026-12-04 06:08:02 +01:00
* feat(search): match with @bitbaum/searchkit; forgive a slip in every search box
Site search was the one box in the fleet with typo tolerance, and it carried
its own copies of what searchkit now does once for everyone: folding, an
edit distance, the typo budget, prefix lookup, highlight offsets and snippet
cutting. Those now come from the package. What stays is what is genuinely
this corpus's: the TF-IDF ranking over long documents with type weights and
phrase bonuses (search/score.ts), the narrow plural rule, the stop words, and
"a real word is never corrected".
A full swap to createSearch's tie-break ranking was tried against the golden
pairs and lost two: "gallium ch" put Chalco first (a two-letter prefix that
covers a one-word title outranks an exact rare word) and "quartz" put a
company above the quartz bottleneck (no term frequency). So searchkit decides
which words a typed word could mean (candidates) and where to mark them;
the ranking stays here.
Small gains in the engine: a slip in the word still being typed ("photres")
and in a word the corpus has only as the start of others ("canno" -> Canon)
now find it; marks use original offsets, so accented words are marked where
they stand. Real words are still never corrected, so result counts for them
are unchanged.
The other boxes had no tolerance at all and now share the package: the globe's
country finder and the palette's page list (search + marks), and the filter
boxes on Exposure, Data series and the desk (lib/text-filter.ts: membership
only, every word required, the table's own order kept). One slip in a country
or page name used to return nothing 96-97% of the time; success@1 is now
0.989 for both. Careers keeps its SQL substring, with a comment saying why.
Tests: generated typo suites (typoCases + evaluate) over company and country
names in site search, every country name in the finder, and every page label
in the palette, plus hand-picked slips and the existing golden pairs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf
* chore(deps): add @bitbaum/searchkit, pinned to orangecat a868c0a9
The fleet's one search package, installed from orangecat by commit
(packages/searchkit). It ships compiled dist/, so no transpile step.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf
* docs(changelog): link the search entry to #179
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf
---------
Co-authored-by: Claude <noreply@anthropic.com>
393 lines
9.1 KiB
CSS
393 lines
9.1 KiB
CSS
/*
|
|
* The world view: the globe (components/portal/Globe.tsx, drawn on a canvas
|
|
* from the --map-* tokens), its legend and zoom, the country finder, and the
|
|
* type of the country panel's content (components/portal/WorldPanel.tsx).
|
|
* Colour only means something here: the --map-seq ramp is "more of it", the
|
|
* ink accent is "selected".
|
|
*/
|
|
.wm {
|
|
position: absolute;
|
|
inset: 0;
|
|
overflow: hidden;
|
|
background: var(--map-ocean);
|
|
touch-action: none;
|
|
}
|
|
.wm-attribution {
|
|
position: absolute;
|
|
z-index: 2;
|
|
top: calc(var(--atlas-bar-h) + var(--atlas-gutter) * 1.75);
|
|
left: var(--atlas-gutter);
|
|
max-width: min(27rem, calc(100% - var(--atlas-gutter) * 2));
|
|
margin: 0;
|
|
padding: 0.4rem 0.6rem;
|
|
border: 1px solid var(--color-border-subtle);
|
|
border-radius: 0.5rem;
|
|
background: var(--atlas-glass);
|
|
backdrop-filter: blur(12px);
|
|
color: var(--color-fg-tertiary);
|
|
font-size: var(--text-label);
|
|
line-height: 1.4;
|
|
pointer-events: auto;
|
|
}
|
|
.wm-attribution a {
|
|
color: var(--color-fg-secondary);
|
|
text-decoration: underline;
|
|
text-underline-offset: 0.15em;
|
|
}
|
|
.wm-globe {
|
|
display: block;
|
|
cursor: grab;
|
|
touch-action: none;
|
|
-webkit-tap-highlight-color: transparent;
|
|
}
|
|
.wm-globe:active {
|
|
cursor: grabbing;
|
|
}
|
|
.wm-globe:focus-visible {
|
|
outline: 2px solid var(--color-accent);
|
|
outline-offset: -2px;
|
|
}
|
|
.map-swatch[data-bin='1'] {
|
|
background: var(--map-seq-1);
|
|
}
|
|
.map-swatch[data-bin='2'] {
|
|
background: var(--map-seq-2);
|
|
}
|
|
.map-swatch[data-bin='3'] {
|
|
background: var(--map-seq-3);
|
|
}
|
|
.map-swatch[data-bin='4'] {
|
|
background: var(--map-seq-4);
|
|
}
|
|
.map-swatch[data-bin='5'] {
|
|
background: var(--map-seq-5);
|
|
}
|
|
.wm-tip {
|
|
position: absolute;
|
|
z-index: 2;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.125rem;
|
|
max-width: 16rem;
|
|
padding: 0.5rem 0.75rem;
|
|
border: 1px solid var(--color-border-strong);
|
|
border-radius: 0.5rem;
|
|
background: var(--atlas-glass);
|
|
backdrop-filter: blur(12px);
|
|
font-size: 0.8125rem;
|
|
pointer-events: none;
|
|
transform: translate(0.875rem, 0.875rem);
|
|
}
|
|
.wm-tip span {
|
|
color: var(--color-fg-tertiary);
|
|
}
|
|
.wm-failed {
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 0;
|
|
right: 0;
|
|
text-align: center;
|
|
font-size: 0.875rem;
|
|
color: var(--color-fg-tertiary);
|
|
}
|
|
.wm-retry {
|
|
min-height: 44px;
|
|
margin-top: 0.5rem;
|
|
padding: 0.5rem 0.75rem;
|
|
border: 1px solid var(--color-border-subtle);
|
|
border-radius: 0.5rem;
|
|
background: var(--atlas-glass);
|
|
color: var(--color-fg-secondary);
|
|
font: inherit;
|
|
cursor: pointer;
|
|
}
|
|
.wm[data-loading] .wm-zoom {
|
|
visibility: hidden;
|
|
}
|
|
|
|
/* Zoom: bottom right of the part of the map nothing covers. */
|
|
.wm-zoom {
|
|
position: absolute;
|
|
z-index: 2;
|
|
right: var(--atlas-gutter);
|
|
bottom: calc(var(--atlas-sheet-peek) + var(--atlas-dock) + var(--atlas-gutter));
|
|
display: flex;
|
|
flex-direction: column;
|
|
overflow: hidden;
|
|
border: 1px solid var(--color-border-strong);
|
|
border-radius: var(--atlas-radius);
|
|
background: var(--atlas-glass);
|
|
backdrop-filter: blur(12px);
|
|
}
|
|
@media (min-width: 768px) and (max-width: 1023px) {
|
|
.wm-zoom {
|
|
bottom: calc(var(--atlas-sheet-peek) + var(--atlas-dock) + var(--atlas-gutter) * 2);
|
|
}
|
|
}
|
|
@media (min-width: 1024px) {
|
|
.wm-zoom {
|
|
right: calc(var(--atlas-panel-w) + var(--atlas-gutter) * 2);
|
|
bottom: var(--atlas-gutter);
|
|
}
|
|
}
|
|
.wm-zoom button {
|
|
width: 2.75rem;
|
|
height: 2.75rem;
|
|
font-size: 1.125rem;
|
|
color: var(--color-fg-secondary);
|
|
cursor: pointer;
|
|
}
|
|
.wm-zoom button + button {
|
|
border-top: 1px solid var(--color-border-subtle);
|
|
}
|
|
.wm-zoom button:hover {
|
|
background: var(--color-surface-raised);
|
|
color: var(--color-fg-primary);
|
|
}
|
|
|
|
/* Legend: bottom left, clear of the zoom column. */
|
|
.map-legend {
|
|
position: absolute;
|
|
z-index: 2;
|
|
left: var(--atlas-gutter);
|
|
bottom: calc(var(--atlas-sheet-peek) + var(--atlas-dock) + var(--atlas-gutter));
|
|
max-width: min(20rem, calc(100% - var(--atlas-gutter) * 3 - 2.75rem));
|
|
margin: 0;
|
|
padding: 0.625rem 0.75rem;
|
|
border: 1px solid var(--color-border-strong);
|
|
border-radius: var(--atlas-radius);
|
|
background: var(--atlas-glass);
|
|
backdrop-filter: blur(12px);
|
|
font-size: 0.75rem;
|
|
line-height: 1.4;
|
|
}
|
|
@media (min-width: 768px) and (max-width: 1023px) {
|
|
.map-legend {
|
|
bottom: calc(var(--atlas-sheet-peek) + var(--atlas-dock) + var(--atlas-gutter) * 2);
|
|
}
|
|
}
|
|
@media (min-width: 1024px) {
|
|
.map-legend {
|
|
bottom: var(--atlas-gutter);
|
|
max-width: 22rem;
|
|
}
|
|
}
|
|
.map-legend figcaption {
|
|
font-weight: 600;
|
|
color: var(--color-fg-primary);
|
|
}
|
|
.map-legend ul {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 0.25rem 0.75rem;
|
|
margin-top: 0.375rem;
|
|
color: var(--color-fg-secondary);
|
|
}
|
|
.map-legend li {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.375rem;
|
|
}
|
|
.map-legend .map-scale {
|
|
flex-wrap: nowrap;
|
|
gap: 0.125rem;
|
|
margin-top: 0.5rem;
|
|
}
|
|
.map-scale li {
|
|
flex: 1;
|
|
flex-direction: column;
|
|
align-items: stretch;
|
|
gap: 0.25rem;
|
|
min-width: 0;
|
|
font: 0.625rem/1.2 var(--font-mono);
|
|
color: var(--color-fg-tertiary);
|
|
white-space: nowrap;
|
|
}
|
|
.map-swatch {
|
|
display: inline-block;
|
|
width: 0.75rem;
|
|
height: 0.75rem;
|
|
border-radius: 0.1875rem;
|
|
}
|
|
.map-scale .map-swatch {
|
|
width: 100%;
|
|
height: 0.5rem;
|
|
border-radius: 0;
|
|
}
|
|
.map-legend p {
|
|
margin-top: 0.375rem;
|
|
color: var(--color-fg-tertiary);
|
|
}
|
|
.map-legend p a {
|
|
text-decoration: underline;
|
|
text-underline-offset: 0.2em;
|
|
}
|
|
|
|
/* Country finder: the way to every country by name. */
|
|
.country-finder input {
|
|
width: 100%;
|
|
min-height: 2.75rem;
|
|
padding: 0 0.875rem;
|
|
border: 1px solid var(--color-border-strong);
|
|
border-radius: 0.5rem;
|
|
background: var(--color-surface-raised);
|
|
color: var(--color-fg-primary);
|
|
font-size: 1rem;
|
|
}
|
|
.country-finder input::placeholder {
|
|
color: var(--color-fg-tertiary);
|
|
}
|
|
.country-finder ul {
|
|
margin-top: 0.25rem;
|
|
}
|
|
.country-finder a {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
min-height: 2.75rem;
|
|
padding: 0 0.25rem;
|
|
border-bottom: 1px solid var(--color-border-subtle);
|
|
font-size: 0.9375rem;
|
|
}
|
|
.country-finder a:hover {
|
|
color: var(--color-fg-primary);
|
|
background: var(--color-surface-raised);
|
|
}
|
|
.country-finder-iso {
|
|
font: var(--text-label) var(--font-mono);
|
|
color: var(--color-fg-muted);
|
|
}
|
|
.country-finder-none {
|
|
padding: 0.75rem 0.25rem;
|
|
font-size: 0.8125rem;
|
|
color: var(--color-fg-muted);
|
|
}
|
|
|
|
/* The country panel's content (WorldPanel.tsx), set in the atlas' type. */
|
|
.world-panel h2 {
|
|
font: 600 1.125rem/1.3 var(--font-heading);
|
|
letter-spacing: -0.01em;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
.world-panel h3 {
|
|
margin: 1.5rem 0 0.5rem;
|
|
font: 500 var(--text-label)/1.4 var(--font-mono);
|
|
letter-spacing: 0.12em;
|
|
text-transform: uppercase;
|
|
color: var(--color-fg-tertiary);
|
|
}
|
|
.world-panel section {
|
|
margin-top: 1.5rem;
|
|
}
|
|
.world-panel ul:not(.resource-chips) {
|
|
display: flex;
|
|
flex-direction: column;
|
|
font-size: 0.9375rem;
|
|
}
|
|
.world-panel ul:not(.resource-chips) > li {
|
|
padding: 0.5rem 0;
|
|
border-bottom: 1px solid var(--color-border-subtle);
|
|
color: var(--color-fg-secondary);
|
|
}
|
|
.world-panel ul:not(.resource-chips) a {
|
|
color: var(--color-fg-primary);
|
|
}
|
|
.world-panel ul:not(.resource-chips) a:hover {
|
|
text-decoration: underline;
|
|
text-underline-offset: 0.2em;
|
|
}
|
|
.world-roles {
|
|
font-size: 0.8125rem;
|
|
line-height: 1.5;
|
|
color: var(--color-fg-secondary);
|
|
margin-bottom: 0.75rem;
|
|
}
|
|
.world-roles-label {
|
|
color: var(--color-fg-tertiary);
|
|
}
|
|
.world-why {
|
|
font-size: 0.9375rem;
|
|
line-height: 1.55;
|
|
color: var(--color-fg-secondary);
|
|
}
|
|
.country-graph {
|
|
margin: 1.5rem 0 0;
|
|
overflow: auto;
|
|
border-radius: 0.5rem;
|
|
}
|
|
.country-graph svg {
|
|
width: 100%;
|
|
height: auto;
|
|
}
|
|
.resource-chips {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 0.5rem;
|
|
}
|
|
.resource-chips a {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
min-height: 2.75rem;
|
|
padding: 0 0.875rem;
|
|
border: 1px solid var(--color-border-strong);
|
|
border-radius: 999px;
|
|
font-size: 0.8125rem;
|
|
}
|
|
.resource-chips a:hover {
|
|
border-color: var(--color-fg-primary);
|
|
}
|
|
|
|
/* Categorical keys and the measure switch in the legend. */
|
|
.map-swatch[data-bin='0'] {
|
|
background: var(--map-land);
|
|
box-shadow: inset 0 0 0 1px var(--color-border-strong);
|
|
}
|
|
.map-swatch[data-bin='6'] {
|
|
background: repeating-linear-gradient(45deg, var(--map-seq-3) 0 1.5px, var(--map-land) 1.5px 4px);
|
|
}
|
|
.map-legend .atlas-pick {
|
|
max-width: none;
|
|
margin-top: 0.5rem;
|
|
}
|
|
|
|
/* On a phone the legend keeps its title, scale and source; the caveat moves
|
|
to the panel's reading distance (it is in the country head's figure). */
|
|
.map-source-short {
|
|
display: none;
|
|
}
|
|
@media (max-width: 767px) {
|
|
.map-legend .map-note:not([data-caveat]) {
|
|
display: none;
|
|
}
|
|
.map-source-short {
|
|
display: inline;
|
|
}
|
|
.map-source-long {
|
|
display: none;
|
|
}
|
|
.map-source a {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
min-height: 2.75rem;
|
|
}
|
|
}
|
|
|
|
/* Producer sites, as the globe draws them (globe-overlay.ts): a light dot
|
|
with an ink rim, or an open ring where only the province is known. */
|
|
.map-site {
|
|
display: inline-block;
|
|
flex: none;
|
|
width: 0.5rem;
|
|
height: 0.5rem;
|
|
margin-inline: 0.1875rem;
|
|
border: 1.25px solid var(--color-fg-primary);
|
|
border-radius: 999px;
|
|
background: var(--color-surface-page);
|
|
}
|
|
.map-site[data-region] {
|
|
width: 0.75rem;
|
|
height: 0.75rem;
|
|
margin-inline: 0.0625rem;
|
|
background: transparent;
|
|
}
|