mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 01:28:55 +00:00
feat(studio): follow-ups from using Studio on a real journey (#1984)
* feat(studio): widen the document, and stop a save from losing it The schema gains what the elements coming after it need: an icon element, a badge that can be restyled rather than only placed, a date and a pair of coordinates on a text binding, and the map's route, pin and road settings. Widening it turned up two ways a book could fail to come back. The mood badge writes its code into the document, and the schema said that code was exactly two characters, from a first draft where it was a country. The real codes are words, so every save was rejected and the read that followed parsed to an empty document: seventeen spreads in, nothing out. Widened to what the badge actually writes, and normalizeBookDocument now drops the elements it cannot read rather than the whole book, so one bad element costs a picture frame instead of a year of work. The other was the body limit. The parser allowed 100kb for everything, and a book with a routed map measures past that, so the save came back 413 and the editor sat on "not saved" with no way forward. Book writes get their own parser at 8mb; everything else keeps the limit it had. * feat(studio): a date, a pair of coordinates and an icon library Three things that had to be drawn by hand before. A journal entry knows when it happened and where, and neither could be put on a page: you read the date off the entry and typed it into a text box, where it then stayed while the entry moved. Both are chips now, next to the title and the story, and both follow their entry the way the others do. The formatting lives in one place so the chip, the template and the resolver cannot drift by a character — coordinates in degrees or decimals, the date in the reader's language. The icons are the whole Lucide set, searchable, placed as a real element with its own colour and stroke rather than as a character in a font. The stroke is deliberately not called strokeWidth: three separate places rescale a field of that name by page width, and an icon whose line thins as the book grows is not what anyone asked for. And the badges finally have their settings. A mood or weather badge could be placed and then only moved: the icon's colour was fixed, the icon could not be turned off, and there was no way to keep the icon and drop the words. All three are switches now, with the colour following the badge unless you say otherwise. * fix(studio): let a placed entry field follow its journal entry again The inspector says a bound field follows the journal entry and that editing it here breaks the link. The first half was not true: nothing ever re-read the entry, so renaming a title in Journey left the old words on the page for good, and the same went for every other bound field. The resolver runs where the journey is loaded and re-reads the fields that still point at an entry. What it will not do is as important as what it does. A field somebody has typed over stays typed over, an entry that is gone leaves its element alone rather than blanking it, and an entry that answers with nothing never wipes what is already on the page. Formatted fields — the date, the coordinates — are only re-read when the format itself changed, which is what keeps this from quietly rewriting books that already exist: an entry whose date was placed as a heading and then set in capitals keeps its capitals. Checked against the real database before it shipped, where the first version overwrote three of them. * feat(studio): start a new book empty, with six layouts to choose from A new journey opened onto a book that had already been laid out, which is the wrong first move: it decides the shape of somebody's book before they have seen it, and undoing it means deleting pages one at a time. A new book starts empty now, and the auto layout runs when it is asked to. The layouts themselves went from two to six, so choosing one is a real choice: what was there covered a photo-heavy spread and a text-heavy one and nothing in between. * fix(studio): hyphenate the export the way the editor does, and set the bleed Two things the press sees and the editor did not. A paragraph broke in different places in the PDF than on screen. The print document is written from scratch and never carried a language, so the browser hyphenated the editor's German and the export's nothing-in- particular. It takes the page's own language now. The wait for the sheet to be ready also covers the images inside SVG, with a ceiling, so a map that is slow to draw does not print half-finished. And the bleed and the safe margin are typeable. Both were baked into every page preset at what a photo-book vendor usually asks for, 3mm and 5mm, with no control anywhere. That is fine until a printer asks for 5 and 10, at which point the book cannot be made here at all: the export carries the wrong bleed and the crop marks sit in the wrong place, which nobody finds until the guillotine has run. * feat(studio): rebuild the inspector The panel on the right had grown by accretion: every element type had added its own controls in whatever shape suited it that day, so the same idea — a colour, a size, a toggle — looked different depending on what you had selected, and long panels were a wall of unlabelled fields. It is one set of controls now, used by every element: foldable sections, a line that holds a label and its control, radio choices, checkboxes, the app's own toggle, and a number field that holds a draft so typing "500" is not read as "5", clamped and written back under the cursor. Duplicated controls were merged rather than deleted; nothing an element could do before it cannot do now. The head carries the element's identity and its actions, so what you have selected is readable without counting fields, and the sections have room to breathe: what was there was correct and unreadable. * feat(studio): a route map worth printing The map in a book was a straight grey line between grey dots on a tile that was chosen for a screen. At print size those tiles are read at roughly four times the resolution they were fetched for, which is why it looked soft next to everything around it. The imagery comes from sources that hold up on paper: NASA's shaded relief and EOX's cloudless Sentinel-2, both licensed for it, picked at a zoom that matches the printer rather than the screen. Tiles are fetched at twice the density where the source offers it, and the seam between them scales with the tile instead of sitting at a fixed fraction of a millimetre, which under editor zoom fell below one device pixel and showed as white threads. The route is drawn rather than plotted. A leg that was never recorded bows, by an amount that grows with its length and turns away from the pole, and it dashes, because an inferred line should not claim to be a track — a recorded track never bows. Both strokes are laid down in two passes, casing then core, so the line stays legible over dark sea and bright desert alike. Legs can follow roads instead, routed leg by leg with the geometry thinned before it is stored, which is the setting a road trip wants and the one a flight cannot have. Stops carry their own first photograph, cut to a circle by a stencil that exists — the first one was written into a defs block that only appears on a map clipped to a coastline, so on an ordinary map it clipped nothing and the photographs sat square on the page. A stop with no photograph of its own is numbered rather than handed one from elsewhere in the journey: a marker at one place showing a picture taken at another is a caption that lies. Whatever the frame, the whole route is inside it. The window takes the frame's aspect, so the fit and the imagery agree instead of one containing what the other covers, and a map dragged narrow no longer cuts off its end. Each linked trip can carry its own map, and a map notices a photograph added to a stop afterwards rather than having to be placed again. * i18n(journey): the new Studio strings, in all 23 locales * test(journey): pin the coverage the map work brought with it The journey domain measures higher than its floor after this round, so the floor follows it up. Only journey moved; the generator's suggestion would have taken memories' functions down a point, and a ratchet that can fall is not a ratchet. * test(studio): cover the thinning that keeps a road route saveable The one path in roadRoute nothing exercised, and the one that matters most: a router answers a long drive with thousands of points at a precision no press can resolve, and all of it goes into the document. Keeping a leg whole is what pushed a real book past the body limit. Both ends have to survive so the line still meets its stops, and the spacing has to stay even, because cutting a run out of the middle would straighten exactly the bends somebody wanted to see.
This commit is contained in:
@@ -327,6 +327,56 @@
|
||||
}
|
||||
.trek-dash .st-panel-scroll { overflow-y: auto; overflow-x: hidden; padding: 0 12px 14px; min-height: 0; }
|
||||
|
||||
/* ----------------- inspector: the head ----------------- */
|
||||
/*
|
||||
* The panel's own title, and the three things you do to what it is about.
|
||||
*
|
||||
* It is set larger and darker than a section label on purpose: those were the
|
||||
* same small capitals in the same grey, so a panel with eight groups had nine
|
||||
* headings that all looked alike and no top.
|
||||
*/
|
||||
.trek-dash .st-inspector-head { padding: 12px 12px 10px; text-transform: none; letter-spacing: 0; }
|
||||
.trek-dash .st-inspector-head .st-what {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
min-width: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 650;
|
||||
letter-spacing: -0.01em;
|
||||
color: var(--ink);
|
||||
}
|
||||
.trek-dash .st-inspector-head .st-what em {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 18px;
|
||||
height: 18px;
|
||||
padding: 0 5px;
|
||||
border-radius: 999px;
|
||||
background: color-mix(in oklch, var(--ink) 8%, transparent);
|
||||
font-size: 10.5px;
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: var(--ink-2);
|
||||
}
|
||||
.trek-dash .st-head-acts { display: flex; align-items: center; gap: 2px; flex: none; }
|
||||
.trek-dash .st-act {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
border-radius: 8px;
|
||||
color: var(--ink-3);
|
||||
transition: background .14s, color .14s;
|
||||
}
|
||||
.trek-dash .st-act:hover { background: color-mix(in oklch, var(--ink) 8%, transparent); color: var(--ink); }
|
||||
.trek-dash .st-act.is-on { color: var(--accent); background: color-mix(in oklch, var(--accent) 12%, transparent); }
|
||||
.trek-dash .st-act.is-danger:hover { background: color-mix(in oklch, #e11d48 16%, transparent); color: #e11d48; } /* theme-lint-disable — destructive, not a scheme colour */
|
||||
.trek-dash .st-act:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent-soft), 0 0 0 3px var(--accent); }
|
||||
|
||||
/* ----------------- page thumbnails ----------------- */
|
||||
.trek-dash .st-thumbs { display: flex; flex-direction: column; gap: 10px; }
|
||||
.trek-dash .st-thumb {
|
||||
@@ -863,16 +913,117 @@
|
||||
}
|
||||
|
||||
/* ----------------- inspector controls ----------------- */
|
||||
.trek-dash .st-section { padding: 12px 2px 14px; border-bottom: 1px solid var(--line); }
|
||||
/* ----------------- inspector: sections ----------------- */
|
||||
/*
|
||||
* A section is a question, and its head is the way to fold the answer away.
|
||||
* The whole head is the target rather than a caret nobody can hit, and the
|
||||
* label is a shade darker than it was: it used to be set in exactly the same
|
||||
* small capitals as the panel's own title, which left the panel with two
|
||||
* levels of heading that looked like one.
|
||||
*/
|
||||
/*
|
||||
* Two shapes share this class, and they carry their padding differently.
|
||||
*
|
||||
* A plain section is a heading with things under it, written as markup in the
|
||||
* panels — the shape browser, the travel cards — and it has always padded
|
||||
* itself. A folding section moves that padding onto its own head and body, so
|
||||
* a folded one collapses to the height of its heading instead of leaving an
|
||||
* empty band behind.
|
||||
*
|
||||
* The rebuild moved the padding onto the head and body and forgot the twelve
|
||||
* plain sections still written by hand, which lost their air and left every
|
||||
* heading in the panels sitting on the block above it.
|
||||
*/
|
||||
.trek-dash .st-section { padding: 14px 2px 18px; border-bottom: 1px solid var(--line); }
|
||||
.trek-dash .st-section:last-of-type { border-bottom: 0; }
|
||||
.trek-dash .st-section.is-fold { padding: 0 2px; }
|
||||
.trek-dash .st-section-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
padding: 13px 2px 11px;
|
||||
color: var(--ink-3);
|
||||
transition: color .14s;
|
||||
}
|
||||
.trek-dash .st-section-head:hover { color: var(--ink); }
|
||||
.trek-dash .st-section-head:hover .st-section-label { color: inherit; }
|
||||
.trek-dash .st-section-label {
|
||||
font-size: 10.5px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.13em;
|
||||
letter-spacing: 0.11em;
|
||||
/*
|
||||
* Quieter than what it heads, and quieter than the panel's own title.
|
||||
* `inherit` was wrong twice over: in a folding head it happened to pick up
|
||||
* the right grey, and in the twelve hand-written sections it picked up full
|
||||
* ink, which made every group heading in the left-hand panels louder than
|
||||
* the title above them.
|
||||
*/
|
||||
color: var(--ink-3);
|
||||
margin-bottom: 9px;
|
||||
/*
|
||||
* A heading needs room before what it heads. In a folding section the head's
|
||||
* own padding provides it, so that one takes it back off below — otherwise
|
||||
* the gap would be counted twice and the panel would drift the other way.
|
||||
*/
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.trek-dash .st-section-head .st-section-label { margin-bottom: 0; }
|
||||
.trek-dash .st-section-caret { flex: none; opacity: 0.5; transition: transform .18s, opacity .14s; }
|
||||
.trek-dash .st-section-head:hover .st-section-caret { opacity: 1; }
|
||||
.trek-dash .st-section.is-folded .st-section-caret { transform: rotate(-90deg); }
|
||||
.trek-dash .st-section-body { padding: 0 2px 17px; }
|
||||
/* Specific enough to beat `.st-hint`, which is declared later in this file
|
||||
and was quietly winning with its own 6px top padding. */
|
||||
.trek-dash .st-section-body > .st-section-hint { padding: 0 0 8px; }
|
||||
|
||||
/* ----------------- inspector: one labelled line ----------------- */
|
||||
/*
|
||||
* The label carries the *role* — accent, text, icon — which is the thing three
|
||||
* identical swatch rows under three identical headings could never say.
|
||||
*/
|
||||
.trek-dash .st-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
|
||||
.trek-dash .st-line + .st-line { margin-top: 8px; }
|
||||
.trek-dash .st-line.is-wide { display: block; }
|
||||
.trek-dash .st-line-label {
|
||||
flex: none;
|
||||
width: 52px;
|
||||
font-size: 11px;
|
||||
color: var(--ink-3);
|
||||
line-height: 1.25;
|
||||
}
|
||||
.trek-dash .st-line.is-wide .st-line-label { display: block; margin-bottom: 7px; width: auto; }
|
||||
.trek-dash .st-line-body { flex: 1; min-width: 0; }
|
||||
|
||||
/* ----------------- inspector: a switch on its own line ----------------- */
|
||||
.trek-dash .st-switch {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
padding: 4px 0;
|
||||
}
|
||||
.trek-dash .st-switch + .st-switch { border-top: 1px solid var(--line); }
|
||||
.trek-dash .st-switch-label { font-size: 12px; color: var(--ink-2); min-width: 0; }
|
||||
|
||||
/* ----------------- inspector: a number with its unit ----------------- */
|
||||
.trek-dash .st-num { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
||||
.trek-dash .st-num-label { flex: none; font-size: 11px; color: var(--ink-3); min-width: 13px; }
|
||||
.trek-dash .st-num-box { position: relative; flex: 1; min-width: 0; display: flex; }
|
||||
.trek-dash .st-num-box .st-input { padding-right: 26px; }
|
||||
/* The unit sits inside the field, so the number and what it is in read as one
|
||||
value rather than as a field with a word next to it. */
|
||||
.trek-dash .st-num-unit {
|
||||
position: absolute;
|
||||
right: 9px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
font-size: 10.5px;
|
||||
color: var(--ink-3);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
||||
.trek-dash .st-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
|
||||
.trek-dash .st-row { display: flex; flex-wrap: wrap; gap: 5px; }
|
||||
@@ -926,14 +1077,36 @@
|
||||
.trek-dash .st-chip:hover { background: color-mix(in oklch, var(--ink) 10%, transparent); color: var(--ink); }
|
||||
.trek-dash .st-chip.is-on { background: var(--accent); color: var(--accent-text, #fff); }
|
||||
.trek-dash .st-chip.is-icon { width: 27px; padding: 0; }
|
||||
/*
|
||||
* Choose-several, which is a different question from choose-one and has to
|
||||
* look like it: an outline that fills only with the tick, so a set of seven
|
||||
* with three in it reads as three ticks rather than as three of something.
|
||||
*/
|
||||
.trek-dash .st-chip.is-pick {
|
||||
background: transparent;
|
||||
box-shadow: inset 0 0 0 1px var(--line-2);
|
||||
padding: 0 10px 0 9px;
|
||||
}
|
||||
.trek-dash .st-chip.is-pick:hover { background: color-mix(in oklch, var(--ink) 6%, transparent); }
|
||||
.trek-dash .st-chip.is-pick.is-on {
|
||||
background: color-mix(in oklch, var(--accent) 12%, transparent);
|
||||
box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--accent) 45%, transparent);
|
||||
color: var(--ink);
|
||||
}
|
||||
.trek-dash .st-chip.is-danger:hover { background: color-mix(in oklch, #e11d48 18%, transparent); color: #e11d48; }
|
||||
.trek-dash .st-chip:focus { outline: none; }
|
||||
.trek-dash .st-chip:focus-visible { box-shadow: 0 0 0 2px var(--accent-soft), 0 0 0 3px var(--accent); }
|
||||
|
||||
.trek-dash .st-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
/*
|
||||
* Ten swatches on one line, which needs the whole panel width rather than what
|
||||
* is left beside a label — so the colour rows are `wide`, with the role above
|
||||
* them. Measured rather than guessed: the body is 261px, and 10 at 22px with
|
||||
* 4px between them is 256.
|
||||
*/
|
||||
.trek-dash .st-swatches { display: flex; flex-wrap: wrap; gap: 4px; }
|
||||
.trek-dash .st-swatch {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border-radius: 7px;
|
||||
border: 1px solid var(--line-2);
|
||||
box-shadow: var(--sh-xs);
|
||||
@@ -1178,6 +1351,22 @@
|
||||
transition: background .16s, border-color .16s, transform .14s;
|
||||
min-width: 0;
|
||||
}
|
||||
/*
|
||||
* The one to reach for, said with a ring.
|
||||
*
|
||||
* The label sits in a grid cell about eighty pixels wide, where a word like
|
||||
* "recommended" is two lines of ellipsis and reads as noise. Green because it
|
||||
* is the one colour a reader already takes as "this one is fine" without being
|
||||
* told, and it is deliberately not the accent: the accent is what the user
|
||||
* picked for their book, and it changes.
|
||||
*/
|
||||
.trek-dash .st-travel-card.is-recommended {
|
||||
border-color: color-mix(in oklch, #16a34a 55%, transparent); /* theme-lint-disable — a recommendation, not a scheme colour */
|
||||
box-shadow: 0 0 0 1px color-mix(in oklch, #16a34a 30%, transparent); /* theme-lint-disable */
|
||||
}
|
||||
.trek-dash .st-travel-card.is-recommended:hover {
|
||||
border-color: color-mix(in oklch, #16a34a 80%, transparent); /* theme-lint-disable */
|
||||
}
|
||||
.trek-dash .st-travel-card:hover {
|
||||
background: var(--surface);
|
||||
border-color: color-mix(in oklch, var(--accent) 40%, var(--line-2));
|
||||
|
||||
Reference in New Issue
Block a user