kinsite 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/lib/css.mjs +6 -4
- package/lib/render.mjs +8 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -159,7 +159,10 @@ whole image. Placing or moving a crop isn't listed on What's new.
|
|
|
159
159
|
anyone has a `CROP` of, gets a page of its own, and each of those people's thumbnails
|
|
160
160
|
links to it. The page shows the whole image with a faint numbered outline on each
|
|
161
161
|
cropped person; hovering or focusing an outline shows their name and the link's `TITL`,
|
|
162
|
-
so a caption like "(unconfirmed)" says how sure the placement is.
|
|
162
|
+
so a caption like "(unconfirmed)" says how sure the placement is. A "Show outlines"
|
|
163
|
+
box under the photo, ticked to start, can be unticked to see the photo plain. Hovering a
|
|
164
|
+
name in the list lights that person's outline, even with outlines unticked, and hovering
|
|
165
|
+
an outline lights the name. Below it, "In this
|
|
163
166
|
photo" lists the outlined people by number, left to right, and "Also in this photo (not
|
|
164
167
|
yet placed)" lists the people linked without a crop, so readers can see who still needs
|
|
165
168
|
a place. With `anonymizeLiving`, a photo shared with a living person is withheld from
|
package/lib/css.mjs
CHANGED
|
@@ -18,7 +18,7 @@ a{color:var(--accent);text-decoration:none}a:hover{text-decoration:underline}
|
|
|
18
18
|
h2{font-size:.95em;text-transform:uppercase;letter-spacing:.05em;color:var(--mut);
|
|
19
19
|
border-bottom:1px solid var(--line);padding-bottom:4px;margin:1.4em 0 .6em;position:relative}
|
|
20
20
|
h2 a.self{position:absolute;left:-1.2em;color:var(--mut);opacity:.35}
|
|
21
|
-
h2 a.self:hover,h2 a.self:focus{opacity:1;text-decoration:none}
|
|
21
|
+
h2 a.self:hover,h2 a.self:focus-visible{opacity:1;text-decoration:none}
|
|
22
22
|
@media(max-width:880px){h2 a.self{position:static;margin-left:.5em}}
|
|
23
23
|
ul.rel{list-style:none;padding:0;margin:0}ul.rel li{margin:.2em 0}
|
|
24
24
|
.photos{display:flex;flex-wrap:wrap;gap:12px;margin:.4em 0}
|
|
@@ -37,9 +37,11 @@ ul.rel{list-style:none;padding:0;margin:0}ul.rel li{margin:.2em 0}
|
|
|
37
37
|
.stage a.who span{display:none;position:absolute;top:100%;left:-2px;margin-top:4px;padding:2px 8px;z-index:1;
|
|
38
38
|
width:max-content;max-width:min(18em,45vw);font-size:.8em;color:#fff;background:var(--ink);border-radius:4px}
|
|
39
39
|
.stage a.who.r span{left:auto;right:-2px}
|
|
40
|
-
.stage a.who:hover,.stage a.who:focus{border-color:#fff;box-shadow:0 0 0 2px var(--accent);text-decoration:none}
|
|
41
|
-
.stage a.who:hover span,.stage a.who:focus span{display:block}
|
|
42
|
-
|
|
40
|
+
.stage a.who:hover,.stage a.who:focus-visible,.stage a.who.on{border-color:#fff;box-shadow:0 0 0 2px var(--accent);text-decoration:none}
|
|
41
|
+
.stage a.who:hover span,.stage a.who:focus-visible span,.stage a.who.on span{display:block}
|
|
42
|
+
.stage:has(+ .outlines input:not(:checked)) a.who:not(.on){display:none}
|
|
43
|
+
.outlines{display:block;color:var(--mut);font-size:.85em;margin:-.6em 0 0;cursor:pointer}
|
|
44
|
+
ol.placed{margin:0;padding-left:1.6em}ol.placed li{margin:.2em 0;border-radius:4px}ol.placed li.on{background:#f1ece2}
|
|
43
45
|
.docs a{display:inline-block;margin:.2em .6em .2em 0}
|
|
44
46
|
#q{width:100%;padding:10px 12px;font-size:1em;border:1px solid var(--line);
|
|
45
47
|
border-radius:8px;margin:.6em 0 .4em}
|
package/lib/render.mjs
CHANGED
|
@@ -11,6 +11,13 @@ export { esc, yr }
|
|
|
11
11
|
export const DEFAULT_TITLE = 'Family Tree'
|
|
12
12
|
export const IMG_EXT = new Set(['.jpg', '.jpeg', '.png', '.gif', '.webp'])
|
|
13
13
|
const CROP_MAX_HEIGHT = 260
|
|
14
|
+
const PAIR_SCRIPT = "<script>var W=document.querySelectorAll('.stage a.who'),P=document.querySelectorAll('ol.placed li');" +
|
|
15
|
+
"function on(i,v){W[i].classList.toggle('on',v);P[i].classList.toggle('on',v);}" +
|
|
16
|
+
"[W,P].forEach(function(g){[].forEach.call(g,function(e,i){" +
|
|
17
|
+
"e.addEventListener('mouseenter',function(){on(i,true);});e.addEventListener('mouseleave',function(){on(i,false);});});});" +
|
|
18
|
+
"[].forEach.call(P,function(e,i){e.addEventListener('focusin',function(ev){on(i,ev.target.matches(':focus-visible'));});" +
|
|
19
|
+
"e.addEventListener('focusout',function(){on(i,false);});});" +
|
|
20
|
+
"addEventListener('pageshow',function(){for(var i=0;i<W.length;i++)on(i,false);});</script>"
|
|
14
21
|
const pct = n => `${+(n * 100).toFixed(3)}%`
|
|
15
22
|
|
|
16
23
|
export const known = s => ((s ?? '').trim() === '?' ? '' : s ?? '')
|
|
@@ -218,7 +225,7 @@ export class Renderer {
|
|
|
218
225
|
})
|
|
219
226
|
const b = ['<p class=back><a href="index.html">← All people</a></p>', `<h1>${esc(heading)}</h1>`,
|
|
220
227
|
`<div class=stage><a href="${src}"><img src="${src}" alt="${esc(heading)}"></a>${boxes.join('')}</div>`]
|
|
221
|
-
if (placed.length) b.push(`<h2>In this photo</h2><ol class=placed>${placed.map(item).join('')}</ol
|
|
228
|
+
if (placed.length) b.push('<label class=outlines><input type=checkbox checked> Show outlines</label>', `<h2>In this photo</h2><ol class=placed>${placed.map(item).join('')}</ol>`, PAIR_SCRIPT)
|
|
222
229
|
if (unplaced.length) b.push(`<h2>Also in this photo (not yet placed)</h2><ul class=rel>${unplaced.map(item).join('')}</ul>`)
|
|
223
230
|
return this.page(heading, b.join(''))
|
|
224
231
|
}
|