💃 Free CC0 mannequin pose reference library for AI image tools (Nano Banana, ChatGPT, ComfyUI, Midjourney) — 250+ poses × 5 angles in line art, names in ja/zh/en/ko
Python ai-artai-image-generationart-referencecc0comfyuicontrolnetdatasetdrawing-referencefigure-drawingline-artmannequinmidjourneymultilingualnano-bananapose-referencereference-imagesstable-diffusion
feat(web): costume library page and a pairing tray that keeps a pose and a costume together
wquguruea674154c7fa
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 47f06305..b513870e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,13 @@ the catalog schema.## [Unreleased]+### Added+- Costumes on the site: a costume library page per language (`costume/`, 484 items with a passing view, grey tiers+ only; the transparent versions stay in the download packs) with category, gender and view filters, a four-view+ lightbox and lingerie blurred like the suggestive poses. A pairing tray (`web/tray.js`) keeps one pose and one+ costume across both pages, maps the pose angle to the costume view and gives the combined prompt and both images+ (phones: one share sheet). The pose lightbox gets "Pick a costume for this pose"; the home page a band after the grid.+### Changed- Performance: fonts are self-hosted Latin subsets (Inter Tight, JetBrains Mono; 65 KB, OFL files in `web/fonts/`)and CJK text uses system fonts, replacing Google Fonts (28 requests, 1.6 MB, often unreachable from mainland China).diff --git a/tools/build_site.py b/tools/build_site.pyindex 52c61bd6..513f2b0c 100755--- a/tools/build_site.py+++ b/tools/build_site.py@@ -59,6 +59,26 @@ def library_stats(catalog, ver, updated):"photos": sum(len(p.get("photos") or {}) for p in shown), "languages": 4, "series": series}+def costume_data():+ """The costume library as the costume page reads it (docs/DESIGN.md, 服装与搭配): items with at least one view that+ passed QC (data/costume-qc.json decides what is in data/costumes.json), trimmed to what the page shows. Lingerie is+ public and blurred like the suggestive poses (D-06, D-11)."""+ src = json.loads((ROOT / "data/costumes.json").read_text())+ cats = json.loads((ROOT / "data/costume-src/_categories.json").read_text())+ items = []+ for c in src["items"]:+ v = [c["views"].get(k) for k in C_VIEWS]+ if not any(v):+ continue+ items.append({"id": c["id"], "cat": c["cat"], "g": c.get("gender", "U"), "r": c.get("rating", "general"),+ "n": {l: c["name_" + l] for l in LOCS},+ "era": {l: c.get("era_" + l) or c.get("era_en") or "" for l in LOCS} if c.get("era_en") else None,+ "desc": c.get("desc_en", ""), "keep": c.get("keep_en", ""), "v": v})+ order = sorted(cats, key=lambda k: cats[k]["order"])+ return {"cats": [{"key": k, "name": cats[k]["name"]} for k in order if any(i["cat"] == k for i in items)],+ "items": items}++def git_day(path):try:out = subprocess.run(["git", "log", "-1", "--format=%cs", "--", path], cwd=ROOT, capture_output=True, text=True)@@ -131,9 +151,9 @@ def audit_changelog(entries, pose_ids):bad.append(f"{at}: {k}{sfx} uses internal term {hit[0]!r}")link = e.get("link", "")path = re.split(r"[?#]", link, 1)[0]- ok = path in ("/", "/changelog/") or (re.fullmatch(r"/pose/(P\d{3})/", path) and path[6:10] in pose_ids)+ ok = path in ("/", "/changelog/", "/costume/") or (re.fullmatch(r"/pose/(P\d{3})/", path) and path[6:10] in pose_ids)if link and not ok:- bad.append(f"{at}: link {link} is not a site page (/, /changelog/ or /pose/<id>/ of a catalog pose)")+ bad.append(f"{at}: link {link} is not a site page (/, /changelog/, /costume/ or /pose/<id>/ of a catalog pose)")return bad@@ -210,7 +230,8 @@ HEADERS = """/assets/*/og/*Cache-Control: public, max-age=86400, stale-while-revalidate=86400"""-STAMPED = ("app.css", "app.js", "common.js", "i18n.js")+STAMPED = ("app.css", "app.js", "common.js", "i18n.js", "tray.js", "costume.js")+C_VIEWS = ("front", "diag", "side", "back")def stamp_assets(out, ver):@@ -305,6 +326,13 @@ def main() -> None:packs = json.loads(packs_file.read_text()) if packs_file.exists() else Noneif packs and packs["version"] != ver:print(f"warning: data/packs.json is for v{packs['version']}, the site is v{ver}", file=sys.stderr)+ costumes = costume_data()+ # The home band shows three general fronts; the same three in every language.+ pick = [c for c in costumes["items"] if c["r"] == "general" and c["v"][0]]+ want = [c for c in pick if c["id"] in ("C061", "C195", "C003")] or pick[:3]+ teaser = json.dumps({"n": len(costumes["items"]), "files": [c["v"][0] for c in want[:3]]}, separators=(",", ":"))+ ctpl = (ROOT / "web/costume.html").read_text()+ ccompact = json.dumps(costumes, ensure_ascii=False, separators=(",", ":")).replace("</", "<\\/")for loc in LOCS:T = S[loc]rel = Site.rel(PREFIX[loc])@@ -326,9 +354,23 @@ def main() -> None:.replace("__SKIP__", esc(T["skip"])).replace("__NOSCRIPT__", noscript).replace("__CHANGELOG__", f"{rel}{PREFIX[loc]}changelog/").replace("__BASE__", rel).replace("__CATALOG__", compact).replace("__REPO__", site.repo).replace("__VERSION__", ver)- .replace("__PACKS__", json.dumps(packs, separators=(",", ":"))))+ .replace("__PACKS__", json.dumps(packs, separators=(",", ":"))).replace("__COSTUME_TEASER__", teaser))write(PREFIX[loc], doc)+ # The costume library page, one per language like the gallery.+ crel = Site.rel(PREFIX[loc] + "costume/")+ n = len(costumes["items"])+ chead = site.head(loc, "costume/", fill(T["costumeTitle"], n=n), fill(T["costumeDesc"], n=n),+ site.og_image(loc, "home"), T["ogAlt"], None)+ cnoscript = "<noscript><ul class=\"wrap\">" + "".join(+ f'<li>{c["id"]} {esc(c["n"][loc])}</li>' for c in costumes["items"]) + "</ul></noscript>"+ cdoc = (ctpl.replace("__HEAD__", chead).replace("__HTMLLANG__", HTML_LANG[loc]).replace("__LOC__", loc)+ .replace("__SKIP__", esc(T["skip"])).replace("__NOSCRIPT__", cnoscript)+ .replace("__HOME__", crel + PREFIX[loc] or "./").replace("__CHANGELOG__", f"{crel}{PREFIX[loc]}changelog/")+ .replace("__BASE__", crel).replace("__COSTUMES__", ccompact).replace("__REPO__", site.repo)+ .replace("__VERSION__", ver))+ write(PREFIX[loc] + "costume/", cdoc)+for i in range(len(poses)):write(*site.pose_page(loc, i))write(*site.changelog_page(loc, entries))@@ -338,11 +380,12 @@ def main() -> None:# Static filesfor f in (ROOT / "web").iterdir():- if f.is_file() and f.name not in ("index.html", "changelog.yaml"):+ if f.is_file() and f.name not in ("index.html", "costume.html", "changelog.yaml"):shutil.copy2(f, out / f.name)# Self-hosted Latin font subsets and their OFL licences (docs/LICENSING.md).shutil.copytree(ROOT / "web/fonts", out / "fonts")(out / "catalog.json").write_text(json.dumps(catalog, ensure_ascii=False, indent=1) + "\n")+ (out / "costumes.json").write_text(json.dumps(costumes, ensure_ascii=False, indent=1) + "\n")(out / "stats.json").write_text(json.dumps(stats, ensure_ascii=False, indent=1) + "\n")if args.link_images:(out / "images").symlink_to(ROOT / "images", target_is_directory=True)@@ -353,6 +396,13 @@ def main() -> None:(out / "images" / kind / tier).mkdir(parents=True)for f in sorted(files):shutil.copy2(ROOT / "images" / kind / tier / f, out / "images" / kind / tier / f)+ # Costumes: the grey tiers only. The transparent versions ship in the download packs, not on the site+ # (a Pages deployment holds 20,000 files).+ cfiles = sorted({f for c in costumes["items"] for f in c["v"] if f})+ for tier in ("w300", "w600", "w900"):+ (out / "images/costume/grey" / tier).mkdir(parents=True)+ for f in cfiles:+ shutil.copy2(ROOT / "images/costume/grey" / tier / f, out / "images/costume/grey" / tier / f)else:shutil.copytree(ROOT / "images", out / "images", ignore=shutil.ignore_patterns("full"))icons = [{"src": "favicon.svg", "sizes": "any", "type": "image/svg+xml"}]@@ -369,7 +419,7 @@ def main() -> None:# sitemap.xml with hreflang alternates and the line art as image entries; robots.txtcat_day, cl_day = git_day("data/catalog.json"), entries[0]["date"]rows = []- for key, day, imgs in ([("", cat_day, []), ("changelog/", cl_day, [])] ++ for key, day, imgs in ([("", cat_day, []), ("costume/", git_day("data/costumes.json"), []), ("changelog/", cl_day, [])] +[(f"pose/{p['id']}/", cat_day, [f for f in p["line"] if f]) for p in poses]):alts = "".join(f'<xhtml:link rel="alternate" hreflang="{HTML_LANG[l]}" href="{esc(site.abs(PREFIX[l] + key))}"/>'for l in LOCS) + f'<xhtml:link rel="alternate" hreflang="x-default" href="{esc(site.abs(key))}"/>'diff --git a/tools/site_pages.py b/tools/site_pages.pyindex b842a278..776f9047 100644--- a/tools/site_pages.py+++ b/tools/site_pages.py@@ -148,6 +148,7 @@ class Site:<a class="brand" href="{home}">{LOGO.format(s=40)}<span>Shisei</span></a><div class="nav-links"><a href="{home}#all">{esc(T["navPoses"])}</a>+ <a href="{rel}{PREFIX[loc]}costume/">{esc(T["navCostumes"])}</a><a href="{rel}{PREFIX[loc]}changelog/">{esc(T["navChangelog"])}</a></div><div class="nav-tools">diff --git a/web/app.css b/web/app.cssindex bc8d0639..af76c7ba 100644--- a/web/app.css+++ b/web/app.css@@ -693,3 +693,184 @@ button.lb-tile:hover img, button.lb-tile:focus-visible img { outline: 2px solidhover shadow and focus ring inside the card's own box, which content-visibility clips to. */.grid > .card { content-visibility: auto; contain-intrinsic-size: auto 380px; padding: 24px; margin: -24px; }@media (max-width: 720px) { .grid > .card { padding: 0; margin: 0; contain-intrinsic-size: auto 260px; } }++/* ---- costumes (docs/DESIGN.md, 服装与搭配): the library page, its lightbox, the home band and the pairing tray.+ Costume images carry their own #D9D9D9 ground, so their tiles use the same grey in both themes. */+:root { --cos: #D9D9D9; }+.c-head { padding-top: 28px; display: flex; flex-direction: column; gap: 12px; }+.c-crumb { margin: 0; display: flex; gap: 8px; font-size: 14px; color: var(--ink3); }+.c-crumb a { color: var(--ink3); }+.c-head h1 { margin: 0; font-size: clamp(34px, 5vw, 56px); line-height: 1.05; font-weight: 800; letter-spacing: -0.04em; text-shadow: 3px 4px 0 var(--shadow); }+.c-sub { margin: 0; max-width: 720px; font-size: 17px; line-height: 1.6; color: var(--ink2); }+.c-sec { padding-top: 8px; padding-bottom: 80px; }+.c-filters .filter-row .count { margin-left: 4px; }+.c-filters .chip.adult { margin-left: auto; }+.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 28px 20px; }+.ccard { display: flex; flex-direction: column; gap: 10px; min-width: 0; }+.ctile-box { position: relative; }+.ctile { position: relative; display: block; aspect-ratio: 3 / 4; border-radius: 24px; overflow: hidden; background: var(--cos); transition: transform .25s ease, box-shadow .25s ease; }+.ctile img { width: 100%; height: 100%; object-fit: cover; }+.ccard.veiled .ctile img { filter: blur(14px); transform: scale(1.08); }+.ccard .veil { border-radius: 24px; }+.cvlabel { position: absolute; left: 10px; top: 10px; height: 24px; padding: 0 8px; display: inline-flex; align-items: center; border-radius: 999px; background: rgba(255,255,255,0.85); color: #3F3D39; font-size: 11px; }+.cquick { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 3; min-height: 44px; border: 0; border-radius: 999px; background: #18181B; color: #FFFFFF; font-weight: 600; font-size: 14px; cursor: pointer; opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; }+.ccard.veiled .cquick { display: none; }+@media (hover: hover) {+ .ccard:hover .ctile { transform: translateY(-3px); box-shadow: 0 18px 32px -18px rgba(24,24,27,0.4); }+ .ccard:hover .cquick, .cquick:focus-visible { opacity: 1; transform: none; }+}+@media (hover: none) { .cquick { display: none; } }+.ccard-t { display: flex; flex-direction: column; gap: 2px; padding: 0 4px; min-width: 0; }+.ccard-t h3 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; }+.ccard-t span { font-size: 12px; color: var(--ink4); }++/* costume lightbox: the gallery lightbox's frame, a grey stage, four views */+.clb { width: 100%; height: 100%; }+.clb-box { position: relative; margin: auto; width: min(1100px, calc(100vw - 48px)); height: min(800px, calc(100vh - 48px)); margin-top: max(24px, calc((100vh - 800px) / 2)); display: flex; border-radius: 34px; overflow: hidden; background: var(--bg); box-shadow: 0 30px 80px -30px rgba(0,0,0,0.5); }+.clb-stage { flex: 1 1 auto; position: relative; margin: 18px; border-radius: 26px; background: var(--cos); display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: pan-y; }+.clb-stage > img { width: 100%; height: 100%; object-fit: contain; }+.clb.veiled .clb-stage > img, .clb.veiled .cchip img { filter: blur(28px); }+.clb-gap { display: flex; flex-direction: column; align-items: center; gap: 10px; color: #3F3D39; }+.clb-side { flex: 0 0 360px; padding: 36px 28px 28px 10px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; }+.clb-head { display: flex; flex-direction: column; gap: 8px; padding-right: 48px; }+.clb-head h2 { margin: 0; font-size: 26px; line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; }+.clb-chips { grid-template-columns: repeat(4, minmax(0, 1fr)); }+.clb-chips .cchip { background: var(--cos); }+.clb-chips .cchip img { object-fit: cover; mix-blend-mode: normal; }+.clb-acts { display: flex; flex-direction: column; gap: 10px; }+.clb-acts .pill.block { height: 52px; }+.pill:disabled { opacity: 0.4; cursor: default; }+.clb-row { display: flex; gap: 10px; }+.clb-row .pill { flex: 1; height: 48px; font-size: 14px; min-width: 0; }+.clb-row .circle { width: 48px; height: 48px; }++/* the band after the pose grid: one way in, below the poses */+.c-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px; padding-top: 40px; padding-bottom: 72px; border-top: 1px solid var(--line2); }+.c-band-t { display: flex; flex-direction: column; gap: 8px; max-width: 520px; }+.c-band-t h2 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }+.c-band-t p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--ink2); }+.c-band-card { display: flex; align-items: center; gap: 22px; padding: 14px 26px 14px 14px; border-radius: 28px; background: var(--bg2); text-decoration: none; color: var(--ink); }+.c-band-imgs { display: flex; gap: 8px; }+.c-band-imgs img { width: 96px; height: 128px; object-fit: cover; border-radius: 16px; background: var(--cos); }+.c-band-cta { display: inline-flex; align-items: center; gap: 8px; font-size: 17px; }+@media (hover: hover) { .c-band-card:hover { box-shadow: 0 18px 32px -18px rgba(24,24,27,0.35); transform: translateY(-2px); transition: transform .2s, box-shadow .2s; } }++/* the pose lightbox's way into costumes */+.lb-pairbtn { height: 48px; font-size: 15px; gap: 8px; }++/* the pairing tray */+.tray { position: fixed; right: 24px; bottom: 24px; z-index: 40; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; max-width: calc(100vw - 32px); }+body:has(dialog[open]) .tray { display: none; }+body.has-tray { padding-bottom: 96px; }+body.has-tray .toast, body.has-tray .nudge { bottom: 112px; }+.tray-bar { display: flex; align-items: center; gap: 6px; padding: 7px; border-radius: 26px; background: #18181B; color: #F5F2ED; box-shadow: 0 16px 40px -8px rgba(24,24,27,0.45); }+.tray-l { padding: 0 6px 0 10px; font-size: 12px; color: #B8B3AA; white-space: nowrap; }+.tray-slot { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 4px 12px 4px 4px; border-radius: 18px; background: #2A2A2E; color: #F5F2ED; text-decoration: none; min-width: 0; }+.tray-slot.cur { box-shadow: inset 0 0 0 2px var(--accent); }+.tray-th { display: block; width: 36px; height: 48px; flex: 0 0 auto; border-radius: 10px; overflow: hidden; background: var(--cos); }+.tray-slot.pose .tray-th { background: var(--tint); }+.tray-th img { width: 100%; height: 100%; object-fit: cover; }+.tray-slot.pose .tray-th img { object-fit: contain; mix-blend-mode: multiply; }+.tray-st { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }+.tray-st small { font-size: 11px; color: #B8B3AA; white-space: nowrap; }+.tray-slot.cur .tray-st small { color: var(--accent); }+.tray-st b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+.tray-slot.empty { border: 1.5px dashed #6B6862; background: transparent; padding-left: 10px; }+.tray-plus { font-size: 20px; line-height: 1; color: #B8B3AA; }+.tray-chev { color: #6B6862; flex: 0 0 auto; }+.tray-soon { width: 36px; height: 52px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border: 1.5px dashed #55534E; border-radius: 12px; color: #8A867E; font-size: 18px; }+.tray-done { min-height: 48px; padding: 0 18px; margin-left: 4px; border: 0; border-radius: 999px; background: var(--new); color: var(--new-ink); font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; }+.tray-x { width: 44px; height: 44px; flex: 0 0 auto; border: 0; border-radius: 50%; background: transparent; color: #B8B3AA; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }+.tray-x:hover { color: #FFFFFF; }+.tray-panel { width: 440px; max-width: 100%; max-height: calc(100vh - 140px); overflow-y: auto; box-sizing: border-box; padding: 18px; border-radius: 28px; border: 1px solid var(--line); background: var(--card); color: var(--ink); box-shadow: 0 24px 60px -12px rgba(24,24,27,0.35); display: flex; flex-direction: column; gap: 12px; }+.tp-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }+.tp-h b { font-size: 17px; }+.tp-h span { font-size: 12px; color: var(--ink3); }+.tp-imgs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }+.tp-img { display: block; aspect-ratio: 3 / 4; border-radius: 18px; overflow: hidden; background: var(--cos); }+.tp-img.pose { background: var(--tint); }+.tp-img img { width: 100%; height: 100%; object-fit: cover; }+.tp-img.pose img { object-fit: contain; mix-blend-mode: multiply; }+.tp-note { margin: 0; font-size: 12px; color: var(--ink4); }+.tp-prompt { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 16px; background: var(--bg2); }+.tp-ph { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--ink3); }+.tp-prompt p { margin: 0; font-size: 12px; line-height: 1.6; color: var(--ink2); max-height: 7.2em; overflow-y: auto; overflow-wrap: anywhere; }+.tp-acts { display: flex; gap: 8px; }+.tp-acts .pill { flex: 1; height: 48px; font-size: 14px; }+.tp-tip { margin: 0; font-size: 13px; color: var(--ink3); text-align: center; }++@media (max-width: 860px) {+ .clb-box { flex-direction: column; width: 100vw; height: 100vh; height: 100dvh; margin: 0; border-radius: 0; overflow-y: auto; }+ .clb-stage { flex: 0 0 auto; height: 56vh; height: 56dvh; margin: 60px 12px 0; border-radius: 20px; }+ .clb-side { flex: 0 0 auto; padding: 12px 12px calc(20px + env(safe-area-inset-bottom)); gap: 14px; overflow: visible; }+ .clb-head { order: 2; padding-right: 0; }+ .clb-head h2 { font-size: 20px; }+ .clb-chips { order: 0; gap: 6px; }+ .clb-chips button span { border-radius: 10px; }+ .clb-acts { order: 1; }+ .clb-desc { order: 3; }+ .clb .keys { display: none; }+ .clb .lb-nav { width: 44px; height: 44px; margin-top: -22px; }+ .clb .lb-nav.l { left: 8px; } .clb .lb-nav.r { right: 8px; }+ .clb .lb-counter { left: 12px; top: 12px; height: 28px; font-size: 12px; }+ .clb .lb-close { top: 8px; right: 8px; width: 44px; height: 44px; }+ .lb-pairbtn { order: 4; flex-shrink: 0; height: 44px; margin: 8px 12px 0; font-size: 14px; }+}+@media (max-width: 720px) {+ .c-head { padding-top: 12px; gap: 8px; }+ .c-sub { font-size: 15px; }+ .cgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 8px; }+ .ctile, .ccard .veil { border-radius: 16px; }+ .ccard { gap: 6px; }+ .ccard.veiled .ctile img { filter: blur(10px); }+ .ccard .veil-t { display: none; }+ .ccard .veil-ic { width: 40px; height: 40px; }+ .cvlabel { display: none; }+ .ccard-t h3 { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+ .ccard-t span { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+ .c-filters .filter-row { flex-wrap: nowrap; }+ .c-filters .chip.adult { margin-left: 0; order: -1; flex: 0 0 auto; }+ .c-filters .filter-row .count { display: none; }+ .c-band { padding-top: 28px; padding-bottom: 48px; }+ .c-band-t h2 { font-size: 24px; }+ .c-band-card { width: 100%; gap: 14px; padding: 10px 16px 10px 10px; border-radius: 22px; }+ .c-band-imgs img { width: 54px; height: 72px; border-radius: 12px; }+ .c-band-cta { flex: 1; justify-content: space-between; font-size: 15px; font-weight: 600; }+ /* The tray spans the phone's width; its label and the coming-soon slot give way first. */+ .tray { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: none; align-items: stretch; }+ .tray-bar { gap: 4px; padding: 6px; border-radius: 22px; }+ .tray-l { display: none; }+ .tray-slot { min-height: 52px; padding-right: 8px; gap: 6px; flex: 0 1 auto; }+ .tray-th { width: 33px; height: 44px; border-radius: 9px; }+ .tray-st small { font-size: 10px; }+ .tray-st b { font-size: 12px; }+ .tray-soon { width: 30px; height: 46px; }+ .tray-done { margin-left: auto; min-height: 44px; padding: 0 14px; }+ .tray-x { width: 40px; height: 44px; }+ .tray-panel { width: auto; max-height: calc(100dvh - 120px - env(safe-area-inset-bottom)); padding: 14px; border-radius: 24px; }+ .tp-imgs { grid-template-columns: repeat(2, minmax(0, 1fr)); }+ body.has-tray { padding-bottom: 84px; }+ body.has-tray .toast, body.has-tray .nudge { bottom: calc(84px + env(safe-area-inset-bottom)); }+}+@media (max-width: 380px) { .tray-soon { display: none; } }+.c-band-t .eyebrow { letter-spacing: 0.08em; }+.clb-chips .cchip img { object-fit: contain; }+@media (max-width: 860px) {+ /* Phone lightbox: name on top as in the pose lightbox, then image, views, the pair button; details below. */+ .clb-side { display: contents; }+ .clb-head { order: -1; flex: 0 0 auto; padding: 10px 64px 0 14px; gap: 2px; }+ .clb-head .lb-names { display: none; }+ #clbMeta { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+ .clb-head h2 { font-size: 18px; line-height: 1.3; }+ .clb-stage { order: 0; height: 52vh; height: 52dvh; margin: 10px 12px 0; }+ .clb-chips { order: 1; margin: 10px 12px 0; }+ .clb-acts { order: 2; margin: 12px 12px 0; }+ .clb-desc { order: 3; margin: 14px 12px calc(20px + env(safe-area-inset-bottom)); flex: 0 0 auto; }+}+@media (max-width: 720px) {+ .c-filters { top: 0; }+ .tray-chev, .tray-soon, .tray-pk { display: none; }+ .tray-slot { flex: 1 1 0; }+}+@media (max-width: 860px) { .clb .clb-desc { display: flex; } }+@media (min-width: 721px) { .c-filters .cats { flex-wrap: wrap; overflow: visible; } }diff --git a/web/app.js b/web/app.jsindex 483364cb..f89d6e41 100644--- a/web/app.js+++ b/web/app.js@@ -166,10 +166,43 @@document.querySelector('[data-i18n="browse"]').textContent = T.browse(n);$('heroSeries').innerHTML = SERIES.map((k) => [k, poses.filter((p) => p.series === k).length]).filter((x) => x[1]).map(([k, c]) => '<span><i style="background:' + SERIES_TINT[k] + '"></i>' + esc(T.series[k]) + '<b>' + c + '</b></span>').join('');+ renderBand();$('howList').innerHTML = T.how.map((s) => '<li>' + esc(s) + '</li>').join('');$('termsList').innerHTML = T.termsItems.map((s) => '<li>' + esc(s) + '</li>').join('');}+ /* costumes: a band after the grid and the pairing tray (web/tray.js); poses stay the anchor (docs/DESIGN.md) */+ const TRAY = window.ShiseiTray;+ const TC = () => window.I18N_COSTUME[S.lang];+ function renderBand() {+ const C = window.SHISEI.costumes;+ $('cBand').hidden = !C;+ if (!C) return;+ $('cBandEyebrow').textContent = TC().bandEyebrow;+ $('cBandT').textContent = TC().bandTitle;+ $('cBandSub').textContent = TC().bandSub;+ $('cBandCta').textContent = TC().bandCta(C.n);+ $('cBandImgs').innerHTML = C.files.map((f) => '<img src="' + src('costume/grey', 'w300', f) + '" alt="" width="108" height="144" loading="lazy" decoding="async">').join('');+ }+ TRAY.setPage('pose');+ // The tray's pose slot opens that pose here rather than reloading the page.+ TRAY.onSlot = (kind, st) => {+ if (kind !== 'pose' || !st.pose || !byId.has(st.pose.id)) return false;+ openLb(st.pose.id, st.pose.v, 'line');+ return true;+ };+ window.addEventListener('shisei:combo', () => { if ($('lb').open) renderLb(); });+ function pairPose() {+ const p = byId.get(LB.id);+ const v = p.line[LB.v] ? LB.v : firstView(p.line);+ TRAY.set('pose', { id: p.id, v, file: p.line[v], tint: p.tint, desc: p.desc_en || '', names: TRAY.names(p, 'pose') });+ // With a costume waiting, closing the lightbox shows the tray's opened pair.+ if (TRAY.get().costume) $('lb').close();+ // No costume yet: off to the library to pick one; the tray keeps the pose.+ else location.href = BASE + PREFIX[S.lang] + 'costume/';+ }+ $('lbPairBtn').addEventListener('click', pairPose);+/* hero */function renderMarquee() {const safe = poses.filter((p) => !p.suggestive);@@ -758,6 +791,9 @@if (veil) [$('lbDl'), dl2].forEach((a) => { a.removeAttribute('href'); a.setAttribute('aria-disabled', 'true'); });+ const cos = TRAY.get().costume;+ $('lbPairText').textContent = cos ? TC().pairCostume(cos.id) : TC().startPose;+ $('lbPairBtn').disabled = veil || !p.line.some(Boolean);clearTimeout(lbTip.timer);$('lbTip').hidden = true;// Static pose pages exist only for general std poses (tools/site_pages.py).diff --git a/web/changelog.yaml b/web/changelog.yamlindex 25d4e92d..c1c22216 100644--- a/web/changelog.yaml+++ b/web/changelog.yaml@@ -4,6 +4,22 @@# tag: new | improve | announce | removed. link: an in-site path without language prefix (/, /changelog/, /pose/P001/),# optionally with ?query and #hash; the build prefixes the reader's language. Newest first.entries:+ - date: 2026-11-01+ tag: new+ title: Costumes to pair with your pose+ desc: 484 ghost-mannequin outfits, each from four views. Pick a costume for any pose; a tray keeps the pair and gives both images with a combined prompt.+ link: /costume/+ cta: Browse costumes+ title_zh: 新增服装,给姿势配上+ desc_zh: 484 件隐形人台服装,每件四个视角。给任意姿势配一件,底部托盘记住这一组,给出两张图和合成描述。+ cta_zh: 浏览服装+ title_ja: ポーズに衣装を合わせる+ desc_ja: ゴーストマネキンの衣装 484 点、各 4 アングル。好きなポーズに合わせると、トレイが組み合わせを保持し、2 枚の画像と合成プロンプトを出します。+ cta_ja: 衣装を見る+ title_ko: 포즈에 의상 입히기+ desc_ko: 고스트 마네킹 의상 484벌, 각 4앵글. 원하는 포즈에 맞추면 트레이가 조합을 기억하고 두 이미지와 합성 프롬프트를 줍니다.+ cta_ko: 의상 보기+- date: 2026-10-31tag: improvetitle: Clearer downloadsdiff --git a/web/costume.html b/web/costume.htmlnew file mode 100644index 00000000..7db06d7a--- /dev/null+++ b/web/costume.html@@ -0,0 +1,125 @@+<!doctype html>+<html lang="__HTMLLANG__" data-loc="__LOC__">+<head>+<meta charset="utf-8">+<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">+__HEAD__+<meta name="theme-color" content="#F5F2ED">+<link rel="preload" href="__BASE__fonts/inter-tight-latin.woff2" as="font" type="font/woff2" crossorigin>+<link rel="stylesheet" href="__BASE__app.css?v=__VERSION__">+</head>+<body class="cpage">+<a class="skip" href="#all">__SKIP__</a>++<nav class="nav wrap" aria-label="Shisei">+ <a class="brand" href="__HOME__">+ <svg class="logo" width="40" height="40" viewBox="0 0 100 100" aria-hidden="true"><rect width="100" height="100" rx="24" fill="#18181B"/><circle cx="60" cy="23" r="8" fill="none" stroke="#F5F2ED" stroke-width="6"/><path d="M57 37C38 52 42 68 64 82" fill="none" stroke="#E07A52" stroke-width="11" stroke-linecap="round"/></svg>+ <span>Shisei</span>+ </a>+ <div class="nav-links">+ <a href="__HOME__#all" data-i18n="navPoses"></a>+ <a href="./" aria-current="page" data-c="nav"></a>+ <a href="__CHANGELOG__" data-i18n="navChangelog"></a>+ </div>+ <div class="nav-tools">+ <div class="lang-menu">+ <button type="button" class="pill light small lang-btn" id="lang" aria-expanded="false" aria-controls="langList" data-i18n-aria="langLabel">+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c3 3.5 3 14.5 0 18M12 3c-3 3.5-3 14.5 0 18"/></svg><span id="langName" class="lang-full"></span><span id="langShort" class="lang-short"></span>+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>+ </button>+ <nav class="lang-list" id="langList" data-i18n-aria="langLabel" hidden></nav>+ </div>+ <button type="button" class="circle" id="theme" data-i18n-aria="theme">+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>+ </button>+ <a class="pill dark small gh" href="__REPO__" aria-label="GitHub">+ <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 .5C5.65.5.5 5.65.5 12a11.5 11.5 0 0 0 7.86 10.92c.58.1.79-.25.79-.56v-2c-3.2.7-3.87-1.37-3.87-1.37-.52-1.33-1.28-1.69-1.28-1.69-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.19 1.76 1.19 1.03 1.76 2.69 1.25 3.35.96.1-.75.4-1.25.73-1.54-2.55-.29-5.24-1.28-5.24-5.69 0-1.26.45-2.29 1.19-3.1-.12-.29-.52-1.46.11-3.05 0 0 .97-.31 3.17 1.18a11 11 0 0 1 5.77 0c2.2-1.49 3.17-1.18 3.17-1.18.63 1.59.23 2.76.11 3.05.74.81 1.19 1.84 1.19 3.1 0 4.42-2.69 5.39-5.25 5.68.41.36.78 1.06.78 2.14v3.17c0 .31.21.67.8.56A11.5 11.5 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z"/></svg><span>GitHub</span>+ </a>+ </div>+</nav>++<main>+<header class="wrap c-head">+ <p class="c-crumb"><a href="__HOME__" data-i18n="navPoses"></a><span aria-hidden="true">/</span><span data-c="nav"></span></p>+ <h1 id="cTitle"></h1>+ <p class="c-sub" data-c="sub"></p>+</header>++<section class="wrap c-sec" id="all" aria-labelledby="cTitle">+ <div class="filters c-filters">+ <div class="cats" role="tablist" id="cCats"></div>+ <div class="filter-row">+ <div class="inline-filters" id="cFilters"></div>+ <button type="button" class="chip adult" id="adult" role="switch" aria-checked="false"></button>+ <span class="count" id="count" aria-live="polite"></span>+ </div>+ </div>+ <div id="cGrid" class="cgrid"></div>+</section>+__NOSCRIPT__+</main>++<footer class="foot">+ <div class="wrap foot-in">+ <div class="foot-brand">+ <svg width="28" height="28" viewBox="0 0 100 100" aria-hidden="true"><rect width="100" height="100" rx="24" fill="#18181B"/><circle cx="60" cy="23" r="8" fill="none" stroke="#F5F2ED" stroke-width="7"/><path d="M57 37C38 52 42 68 64 82" fill="none" stroke="#E07A52" stroke-width="12" stroke-linecap="round"/></svg>+ <strong>Shisei 姿勢</strong>+ <span data-i18n="footer"></span>+ </div>+ <nav class="foot-links" aria-label="Footer">+ <a href="__REPO__">GitHub</a>+ <a href="__CHANGELOG__"><span data-i18n="navChangelog"></span> v__VERSION__</a>+ <a href="__BASE__costumes.json">costumes.json</a>+ </nav>+ </div>+</footer>++<dialog class="clb" id="clb" aria-labelledby="clbTitle">+ <div class="clb-box">+ <div class="clb-stage" id="clbStage">+ <img id="clbImg" alt="">+ <div class="clb-gap" id="clbGap" hidden></div>+ <div class="lb-veil" id="clbVeil" hidden>+ <span class="veil-ic"><svg width="30" height="30" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" aria-hidden="true"><path d="M3 3l18 18"/><path d="M10.6 5.1A10 10 0 0 1 12 5c6 0 10 7 10 7a17 17 0 0 1-3.2 3.9"/><path d="M6.6 6.6C3.9 8.4 2 12 2 12s4 7 10 7c1.8 0 3.4-.6 4.8-1.4"/><path d="M9.9 9.9a3 3 0 0 0 4.2 4.2"/></svg></span>+ <b id="clbVeilTitle"></b>+ <button type="button" class="pill dark" id="clbVeilOne"></button>+ <button type="button" class="pill light" id="clbVeilAll"></button>+ </div>+ <button type="button" class="lb-nav l" id="clbPrev" data-i18n-aria="prevAngle"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M15 5l-7 7 7 7"/></svg></button>+ <button type="button" class="lb-nav r" id="clbNext" data-i18n-aria="nextAngle"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M9 5l7 7-7 7"/></svg></button>+ <span class="lb-counter" id="clbCounter"></span>+ </div>+ <aside class="clb-side">+ <div class="clb-head">+ <span class="mono muted" id="clbMeta"></span>+ <h2 id="clbTitle"></h2>+ <dl class="lb-names" id="clbNames"></dl>+ </div>+ <div class="lb-chips clb-chips" role="group" id="clbChips"></div>+ <div class="clb-acts">+ <button type="button" class="pill dark block" id="clbPair"></button>+ <div class="clb-row">+ <button type="button" class="circle" id="clbPrevItem" data-i18n-aria="prevPose"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M12 19V5m0 0-6 6m6-6 6 6"/></svg></button>+ <button type="button" class="circle" id="clbNextItem" data-i18n-aria="nextPose"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M12 5v14m0 0-6-6m6 6 6-6"/></svg></button>+ <a class="pill light" id="clbDl" download><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M12 4v11m0 0-4-4m4 4 4-4M5 20h14"/></svg><span id="clbDlText"></span></a>+ </div>+ </div>+ <div class="lb-desc clb-desc" id="clbDescBox">+ <div class="lb-desc-h"><span data-c="descLabel"></span><button type="button" class="pill light tiny" id="clbCopy" data-i18n="copy"></button></div>+ <p id="clbDesc"></p>+ </div>+ <p class="keys" data-c="keys"></p>+ </aside>+ <button type="button" class="lb-close" id="clbClose" autofocus data-i18n-aria="close"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18"/></svg></button>+ </div>+</dialog>+<div class="toast" id="toast" role="status" aria-live="polite"></div>++<script id="costumes" type="application/json">__COSTUMES__</script>+<script>window.SHISEI = { repo: '__REPO__', version: '__VERSION__', base: '__BASE__', lang: '__LOC__' };</script>+<script src="__BASE__i18n.js?v=__VERSION__"></script>+<script src="__BASE__common.js?v=__VERSION__"></script>+<script src="__BASE__tray.js?v=__VERSION__"></script>+<script src="__BASE__costume.js?v=__VERSION__"></script>+</body>+</html>diff --git a/web/costume.js b/web/costume.jsnew file mode 100644index 00000000..7bba69a5--- /dev/null+++ b/web/costume.js@@ -0,0 +1,305 @@+/* The costume library page (costume/): a grid of ghost-mannequin outfits and a lightbox, both built from the+ costumes.json the build inlines. It is a satellite of the pose gallery (docs/DESIGN.md, 服装与搭配): a costume is+ picked to go with a pose, through the pairing tray (web/tray.js). */+(() => {+ 'use strict';++ const DATA = JSON.parse(document.getElementById('costumes').textContent);+ const LANGS = ['zh', 'ja', 'en', 'ko'];+ const PREFIX = { zh: '', ja: 'ja/', en: 'en/', ko: 'ko/' };+ const loc = LANGS.includes(window.SHISEI.lang) ? window.SHISEI.lang : 'zh';+ const BASE = window.SHISEI.base || '';+ const T = window.I18N[loc], TP = window.I18N_PAGES[loc], TC = window.I18N_COSTUME[loc];+ const VIEWS = window.ShiseiTray.views;+ const EYE_OFF = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true"><path d="M3 3l18 18"/><path d="M10.6 5.1A10 10 0 0 1 12 5c6 0 10 7 10 7a17 17 0 0 1-3.2 3.9"/><path d="M6.6 6.6C3.9 8.4 2 12 2 12s4 7 10 7c1.8 0 3.4-.6 4.8-1.4"/><path d="M9.9 9.9a3 3 0 0 0 4.2 4.2"/></svg>';+ const GAP_IC = '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 8h3l2-2.5h6L17 8h3v11H4z"/><circle cx="12" cy="13" r="3.5"/></svg>';+ const $ = (id) => document.getElementById(id);+ const esc = (s) => String(s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));+ const img = (tier, f) => BASE + 'images/costume/grey/' + tier + '/' + f;+ const srcset = (f) => img('w300', f) + ' 300w, ' + img('w600', f) + ' 600w, ' + img('w900', f) + ' 900w';+ const store = {+ get: (k) => { try { return localStorage.getItem('shisei.' + k); } catch (e) { return null; } },+ set: (k, v) => { try { localStorage.setItem('shisei.' + k, v); } catch (e) { /* private mode */ } }+ };+ const items = DATA.items.map((c) => ({ ...c, suggestive: c.r === 'suggestive' }));+ const byId = new Map(items.map((c) => [c.id, c]));+ const catName = new Map(DATA.cats.map((c) => [c.key, c.name[loc]]));+ const params = new URLSearchParams(location.search);+ // Same switch and storage key as the gallery's (D-06, D-11): lingerie stays blurred until shown.+ const S = {+ cat: catName.has(params.get('cat')) ? params.get('cat') : 'all',+ g: ['F', 'M', 'U'].includes(params.get('g')) ? params.get('g') : 'all',+ view: Math.max(0, VIEWS.indexOf(params.get('view'))),+ adult: store.get('adult') === '1',+ revealed: new Set()+ };+ const veiled = (c) => c.suggestive && !S.adult && !S.revealed.has(c.id);+ const first = (c) => Math.max(0, c.v.findIndex(Boolean));+ const shown = (c) => (c.v[S.view] ? S.view : first(c));+ const tray = window.ShiseiTray;+ tray.setPage('costume');++ function toast(msg) {+ const el = $('toast');+ el.textContent = msg;+ el.classList.add('show');+ clearTimeout(toast.timer);+ toast.timer = setTimeout(() => el.classList.remove('show'), 1800);+ }+ function syncUrl() {+ const p = new URLSearchParams();+ if (S.cat !== 'all') p.set('cat', S.cat);+ if (S.g !== 'all') p.set('g', S.g);+ if (S.view) p.set('view', VIEWS[S.view]);+ const qs = p.toString();+ history.replaceState(null, '', location.pathname + (qs ? '?' + qs : '') + location.hash);+ }++ /* text */+ function applyText() {+ document.querySelectorAll('[data-i18n]').forEach((el) => { const v = T[el.dataset.i18n]; if (typeof v === 'string') el.textContent = v; });+ document.querySelectorAll('[data-i18n-aria]').forEach((el) => el.setAttribute('aria-label', T[el.dataset.i18nAria]));+ document.querySelectorAll('[data-c]').forEach((el) => { const v = TC[el.dataset.c]; if (typeof v === 'string') el.textContent = v; });+ $('langName').textContent = T.langName;+ $('langShort').textContent = T.langShort;+ $('cTitle').textContent = TC.title(items.length);+ }++ /* filters */+ const pool = () => items.filter((c) => (S.cat === 'all' || c.cat === S.cat) && (S.g === 'all' || c.g === S.g));+ function renderFilters() {+ const base = items.filter((c) => S.g === 'all' || c.g === S.g);+ const chip = (key, label, n) => '<button type="button" class="chip" role="tab" aria-selected="' + (S.cat === key) + '" data-cact="cat:' + key + '">' ++ esc(label) + '<span class="n">' + n + '</span></button>';+ $('cCats').setAttribute('aria-label', TC.cat);+ $('cCats').innerHTML = chip('all', TC.all, base.length) ++ DATA.cats.map((k) => [k, base.filter((c) => c.cat === k.key).length]).filter((x) => x[1])+ .map(([k, n]) => chip(k.key, k.name[loc], n)).join('');+ const seg = (label, opts) => '<div class="seg" role="group" aria-label="' + esc(label) + '">' ++ opts.map(([text, act, on]) => '<button type="button" data-cact="' + act + '" aria-pressed="' + on + '">' + esc(text) + '</button>').join('') + '</div>';+ $('cFilters').innerHTML = seg(TC.genderLabel, ['all', 'F', 'M', 'U'].map((g) => [TC.gender[g], 'g:' + g, S.g === g])) ++ seg(TC.viewLabel, TC.views.map((v, i) => [v, 'view:' + i, S.view === i]));+ const adult = $('adult');+ adult.hidden = !items.some((c) => c.suggestive);+ adult.setAttribute('aria-checked', String(S.adult));+ adult.title = TC.adultHint;+ adult.innerHTML = esc(S.adult ? TC.adultOn : TC.adultOff) + '<span class="track" aria-hidden="true"><i></i></span>';+ }++ /* grid */+ function cardHtml(c) {+ const v = shown(c), f = c.v[v];+ const veil = veiled(c);+ const name = c.n[loc];+ return '<article class="ccard' + (veil ? ' veiled' : '') + '" data-id="' + c.id + '">' ++ '<div class="ctile-box"><a class="ctile" href="#' + c.id + '-' + VIEWS[v] + '" data-copen="' + c.id + '" aria-label="' + esc(TC.open(c.id) + ' ' + name) + '">' ++ (f ? '<img src="' + img('w300', f) + '" srcset="' + srcset(f) + '" sizes="(max-width: 720px) 31vw, 240px" alt="' + esc(c.id + ' ' + name + ' · ' + TC.views[v]) + '" loading="lazy" decoding="async">' : '') ++ (v !== S.view ? '<span class="cvlabel">' + esc(TC.views[v]) + '</span>' : '') + '</a>' ++ (veil ? '<button type="button" class="veil" data-creveal="' + c.id + '" aria-label="' + esc(T.veilShow(c.id) + ' ' + name) + '"><span class="veil-ic">' + EYE_OFF + '</span><span class="veil-t">' + esc(T.veilTap) + '</span></button>' : '') ++ quickHtml(c) + '</div>' ++ '<div class="ccard-t"><h3>' + esc(name) + '</h3><span class="mono">' + c.id + ' · ' + esc(catName.get(c.cat)) + '</span></div></article>';+ }+ // Hover / focus shortcut on desktop: pair without opening the lightbox, when a pose is waiting in the tray.+ function quickHtml(c) {+ const pose = tray.get().pose;+ return pose ? '<button type="button" class="cquick" data-cpair="' + c.id + '">' + esc(TC.pairWith(pose.id)) + '</button>' : '';+ }+ function renderGrid() {+ const list = pool();+ $('cGrid').innerHTML = list.length ? list.map(cardHtml).join('') : '<p class="empty">' + esc(TC.empty) + '</p>';+ $('count').textContent = TC.count(list.length, items.length);+ }+ function renderAll() { applyText(); renderLangs(); renderFilters(); renderGrid(); if ($('clb').open) renderLb(); }++ document.addEventListener('click', (e) => {+ const b = e.target.closest('[data-cact]');+ if (!b) return;+ const [k, v] = b.dataset.cact.split(':');+ if (k === 'cat') S.cat = v;+ else if (k === 'g') { S.g = v; if (S.cat !== 'all' && !items.some((c) => c.cat === S.cat && (v === 'all' || c.g === v))) S.cat = 'all'; }+ else if (k === 'view') S.view = +v;+ renderFilters(); renderGrid(); syncUrl();+ });+ $('adult').addEventListener('click', () => {+ S.adult = !S.adult;+ store.set('adult', S.adult ? '1' : '0');+ S.revealed.clear();+ renderAll();+ });+ function reveal(id) {+ S.revealed.add(id);+ const card = document.querySelector('.ccard[data-id="' + id + '"]');+ if (card) { card.classList.remove('veiled'); const v = card.querySelector('.veil'); if (v) v.remove(); }+ if ($('clb').open) renderLb();+ }+ $('cGrid').addEventListener('click', (e) => {+ const rv = e.target.closest('[data-creveal]');+ if (rv) { reveal(rv.dataset.creveal); return; }+ const q = e.target.closest('[data-cpair]');+ if (q) { pairIt(byId.get(q.dataset.cpair), shown(byId.get(q.dataset.cpair))); return; }+ const a = e.target.closest('[data-copen]');+ if (a) { e.preventDefault(); const c = byId.get(a.dataset.copen); openLb(c.id, shown(c)); }+ });++ /* pairing */+ function pairIt(c, v) {+ tray.set('costume', { id: c.id, files: c.v, names: c.n, keep: c.keep, v });+ if ($('clb').open) $('clb').close();+ // With a pose waiting, the tray opens the pair: that is the confirmation.+ if (tray.get().pose) return;+ // No pose yet: the pose is the anchor, so go and pick one; the tray keeps the costume.+ else location.href = BASE + PREFIX[loc] + '#all';+ }+ window.addEventListener('shisei:combo', () => {+ document.querySelectorAll('.ccard').forEach((card) => {+ const box = card.querySelector('.ctile-box'), old = box.querySelector('.cquick');+ if (old) old.remove();+ box.insertAdjacentHTML('beforeend', quickHtml(byId.get(card.dataset.id)));+ });+ if ($('clb').open) renderLb();+ });+ // The tray's costume slot opens that costume here instead of reloading the page.+ tray.onSlot = (kind, st) => {+ if (kind !== 'costume' || !st.costume || !byId.has(st.costume.id)) return false;+ const pv = st.pose ? st.pose.v : 0;+ const want = pv <= 2 ? pv : 0;+ openLb(st.costume.id, st.costume.files[want] ? want : first(byId.get(st.costume.id)));+ return true;+ };++ /* lightbox */+ const LB = { id: null, v: 0 };+ const ALBUM = matchMedia('(pointer: coarse)').matches;+ const SHARE = ALBUM && !!navigator.canShare && (() => {+ try { return navigator.canShare({ files: [new File([''], 'a.webp', { type: 'image/webp' })] }); } catch (e) { return false; }+ })();+ const FILES = new Map();+ function prefetch(url, name) {+ if (!SHARE || FILES.has(url)) return;+ const entry = { file: null };+ FILES.set(url, entry);+ if (FILES.size > 20) FILES.delete(FILES.keys().next().value);+ fetch(url).then((r) => (r.ok ? r.blob() : Promise.reject(r.status)))+ .then((b) => { entry.file = new File([b], name, { type: 'image/webp' }); }).catch(() => FILES.delete(url));+ }+ function lbList() { const l = pool(); return l.some((c) => c.id === LB.id) ? l : items; }+ function openLb(id, v) {+ const c = byId.get(id);+ if (!c) return;+ LB.id = id;+ LB.v = c.v[v] ? v : first(c);+ renderLb();+ if (!$('clb').open) $('clb').showModal();+ }+ function renderLb() {+ const c = byId.get(LB.id), f = c.v[LB.v], name = c.n[loc];+ const veil = veiled(c);+ $('clb').classList.toggle('veiled', veil);+ $('clbVeil').hidden = !veil;+ $('clbVeilTitle').textContent = TC.veilTitle;+ $('clbVeilOne').textContent = T.veilOne;+ $('clbVeilAll').textContent = T.veilAll;+ const im = $('clbImg');+ im.hidden = !f;+ if (f) { im.src = img('w900', f); im.alt = c.id + ' ' + name + ' · ' + TC.views[LB.v]; }+ $('clbGap').hidden = !!f;+ $('clbGap').innerHTML = f ? '' : '<span class="gap-ic">' + GAP_IC + '</span><b>' + esc(TC.gap) + '</b>';+ $('clbCounter').textContent = TC.views[LB.v] + ' ' + (LB.v + 1) + '/4';+ $('clbPrev').disabled = $('clbNext').disabled = c.v.filter(Boolean).length < 2;+ const list = lbList();+ $('clbMeta').textContent = c.id + ' · ' + catName.get(c.cat) + (c.era ? ' · ' + c.era[loc] : '') + ' · ' + TC.gender[c.g] + ' · ' + (list.indexOf(c) + 1) + '/' + list.length;+ $('clbTitle').textContent = name;+ $('clbNames').innerHTML = LANGS.filter((l) => l !== loc).map((l) => '<dt>' + l.toUpperCase() + '</dt><dd>' + esc(c.n[l]) + '</dd>').join('');+ $('clbChips').setAttribute('aria-label', TC.viewLabel);+ $('clbChips').innerHTML = VIEWS.map((_, i) => '<button type="button" data-cv="' + i + '" aria-pressed="' + (i === LB.v) + '"' + (c.v[i] ? '' : ' disabled') + '>' ++ '<span class="cchip">' + (c.v[i] ? '<img src="' + img('w300', c.v[i]) + '" alt="">' : GAP_IC) + '</span>' + esc(TC.views[i]) + '</button>').join('');+ $('clbDesc').textContent = c.desc || '';+ $('clbDescBox').hidden = !c.desc;+ const pose = tray.get().pose;+ $('clbPair').textContent = pose ? TC.pairWith(pose.id) : TC.startWith;+ $('clbPair').disabled = veil;+ const dl = $('clbDl');+ $('clbDlText').textContent = ALBUM ? TC.save : TC.download;+ if (f && !veil) {+ dl.href = img('w900', f);+ dl.setAttribute('download', 'shisei_' + c.id + '_' + VIEWS[LB.v] + '.webp');+ dl.removeAttribute('aria-disabled');+ prefetch(dl.href, dl.getAttribute('download'));+ } else { dl.removeAttribute('href'); dl.setAttribute('aria-disabled', 'true'); }+ history.replaceState(null, '', location.pathname + location.search + '#' + c.id + '-' + VIEWS[LB.v]);+ }+ function stepView(d) {+ const c = byId.get(LB.id);+ for (let k = 1; k <= 4; k++) { const i = (LB.v + d * k + 8) % 4; if (c.v[i]) { LB.v = i; break; } }+ renderLb();+ }+ function stepItem(d) {+ const list = lbList(), i = list.findIndex((c) => c.id === LB.id);+ openLb(list[(i + d + list.length) % list.length].id, LB.v);+ }+ $('clbPrev').addEventListener('click', () => stepView(-1));+ $('clbNext').addEventListener('click', () => stepView(1));+ $('clbPrevItem').addEventListener('click', () => stepItem(-1));+ $('clbNextItem').addEventListener('click', () => stepItem(1));+ $('clbClose').addEventListener('click', () => $('clb').close());+ $('clb').addEventListener('click', (e) => { if (e.target === $('clb')) $('clb').close(); });+ $('clb').addEventListener('close', () => history.replaceState(null, '', location.pathname + location.search));+ $('clbChips').addEventListener('click', (e) => { const b = e.target.closest('[data-cv]'); if (b && !b.disabled) { LB.v = +b.dataset.cv; renderLb(); } });+ $('clbPair').addEventListener('click', () => pairIt(byId.get(LB.id), LB.v));+ $('clbCopy').addEventListener('click', () => window.ShiseiShare.copy(byId.get(LB.id).desc));+ $('clbVeilOne').addEventListener('click', () => reveal(LB.id));+ $('clbVeilAll').addEventListener('click', () => { S.adult = true; store.set('adult', '1'); renderAll(); });+ $('clbDl').addEventListener('click', (e) => {+ const a = e.currentTarget;+ if (!ALBUM || !a.href) return;+ e.preventDefault();+ const entry = SHARE && FILES.get(a.href);+ if (entry && entry.file) navigator.share({ files: [entry.file] }).catch((err) => { if (err.name !== 'AbortError') toast(T.holdToSave); });+ else if (SHARE) { prefetch(a.href, a.getAttribute('download')); toast(T.preparing); }+ else toast(T.holdToSave);+ });+ document.addEventListener('keydown', (e) => {+ if (!$('clb').open) return;+ if (e.key === 'ArrowLeft') { e.preventDefault(); stepView(-1); }+ else if (e.key === 'ArrowRight') { e.preventDefault(); stepView(1); }+ else if (e.key === 'ArrowUp') { e.preventDefault(); stepItem(-1); }+ else if (e.key === 'ArrowDown') { e.preventDefault(); stepItem(1); }+ });+ let sx = null;+ $('clbStage').addEventListener('pointerdown', (e) => { sx = e.clientX; });+ $('clbStage').addEventListener('pointerup', (e) => {+ if (sx === null) return;+ const dx = e.clientX - sx;+ sx = null;+ if (Math.abs(dx) > 50) stepView(dx < 0 ? 1 : -1);+ });++ /* language menu and theme, as on the gallery */+ function renderLangs() {+ const qs = new URLSearchParams(location.search);+ qs.delete('lang');+ const tail = 'costume/' + (qs.toString() ? '?' + qs : '') + location.hash;+ $('langList').innerHTML = LANGS.map((l) => '<a href="' + esc(BASE + PREFIX[l] + tail) + '" lang="' + window.I18N[l].htmlLang + '" hreflang="' + window.I18N[l].htmlLang ++ '" data-lang-link="' + l + '"' + (l === loc ? ' aria-current="true"' : '') + '>' + esc(window.I18N[l].langName) + '</a>').join('');+ }+ const langBtn = $('lang');+ const setLangOpen = (o) => { if (o) renderLangs(); langBtn.setAttribute('aria-expanded', String(o)); $('langList').hidden = !o; };+ langBtn.addEventListener('click', () => setLangOpen(langBtn.getAttribute('aria-expanded') !== 'true'));+ document.addEventListener('click', (e) => { if (!e.target.closest('.lang-menu')) setLangOpen(false); });+ $('theme').addEventListener('click', () => {+ const root = document.documentElement;+ const dark = root.dataset.theme ? root.dataset.theme === 'dark' : matchMedia('(prefers-color-scheme: dark)').matches;+ root.dataset.theme = dark ? 'light' : 'dark';+ store.set('theme', root.dataset.theme);+ });++ // Deep links: #C061 or #C061-back.+ function openFromHash() {+ const m = location.hash.match(/^#(C\d{3})(?:-(front|diag|side|back))?$/);+ if (m && byId.has(m[1])) openLb(m[1], m[2] ? VIEWS.indexOf(m[2]) : 0);+ }+ window.addEventListener('hashchange', openFromHash);++ renderAll();+ openFromHash();+})();diff --git a/web/i18n.js b/web/i18n.jsindex 61892d7f..171b8f3e 100644--- a/web/i18n.js+++ b/web/i18n.js@@ -147,6 +147,75 @@ window.I18N = {}};+// The costume library and the pairing tray (docs/DESIGN.md, 服装与搭配). Category names come from+// data/costume-src/_categories.json, item names from data/costumes.json.+window.I18N_COSTUME = {+ zh: {+ nav: '服装', crumb: '素材库 / 服装',+ title: (n) => '服装 · ' + n + ' 件', sub: '隐形人台商品照,正面、斜侧、侧面、背面四个视角。挑一件配到任意姿势上,两张图一起交给 AI 换装或角色设定。',+ gender: { all: '全部', F: '女装', M: '男装', U: '中性' }, genderLabel: '性别', cat: '大类', all: '全部',+ views: ['正面', '斜侧', '侧面', '背面'], viewLabel: '视角', count: (n, all) => n + ' / ' + all + ' 件', empty: '没有找到匹配的服装',+ open: (id) => '打开 ' + id + ' 大图', gap: '这个视角暂缺', download: '下载这张 · 900', save: '保存到相册',+ descLabel: '英文服装描述,可直接放进提示词', adultOn: '性感内衣:显示', adultOff: '性感内衣:模糊', adultHint: '性感内衣默认模糊;点单张可单独查看,点这里全部显示', veilTitle: '性感内衣,已模糊',+ pairWith: (id) => '配上 ' + id, startWith: '用这件搭配姿势', pairCostume: (id) => '配上 ' + id, startPose: '给这个姿势配服装',+ paired: (id) => '已配上 ' + id,+ tray: '搭配', slotPose: '姿势', slotCostume: '服装', pickPose: '选姿势', pickCostume: '挑服装', picking: '在挑',+ soon: '道具 · 制作中', done: '完成', hide: '收起', end: '结束搭配',+ group: '这一组', prompt: '合成描述', dlPose: '下载姿势', dlCostume: '下载服装', saveGroup: '保存这一组', holdGroup: '长按每张图,选「保存图片」',+ viewNote: (v) => '服装视角跟随姿势:' + v,+ bandEyebrow: '素材库', bandTitle: '给姿势配上服装', bandSub: '在任意姿势的大图里点「给这个姿势配服装」,或者先来这里挑。', bandCta: (n) => '浏览 ' + n + ' 件服装',+ keys: '← → 换视角 ↑ ↓ 换一件 Esc 关闭'+ },+ ja: {+ nav: '衣装', crumb: '素材ライブラリ / 衣装',+ title: (n) => '衣装 · ' + n + ' 点', sub: 'ゴーストマネキンの商品写真。正面・斜め・横・背面の 4 アングル。好きなポーズに合わせて、2 枚まとめて AI の着せ替えやキャラ設定に。',+ gender: { all: 'すべて', F: 'レディース', M: 'メンズ', U: 'ユニセックス' }, genderLabel: '性別', cat: 'カテゴリ', all: 'すべて',+ views: ['正面', '斜め', '横', '背面'], viewLabel: 'アングル', count: (n, all) => n + ' / ' + all + ' 点', empty: '該当する衣装がありません',+ open: (id) => id + ' を拡大', gap: 'このアングルは準備中', download: 'この画像をダウンロード · 900', save: '写真に保存',+ descLabel: '英語の衣装説明(プロンプトにそのまま使えます)', adultOn: 'ランジェリー:表示', adultOff: 'ランジェリー:ぼかし', adultHint: 'ランジェリーは初期状態でぼかしています。1 点ずつタップで表示、ここで全部表示できます', veilTitle: 'セクシーランジェリー(ぼかし中)',+ pairWith: (id) => id + ' に合わせる', startWith: 'この衣装でポーズを選ぶ', pairCostume: (id) => id + ' を合わせる', startPose: 'このポーズに衣装を合わせる',+ paired: (id) => id + ' を合わせました',+ tray: 'コーデ', slotPose: 'ポーズ', slotCostume: '衣装', pickPose: 'ポーズを選ぶ', pickCostume: '衣装を選ぶ', picking: '選択中',+ soon: '小物 · 制作中', done: '完成', hide: '閉じる', end: 'コーデを終了',+ group: 'この組み合わせ', prompt: '合成プロンプト', dlPose: 'ポーズを保存', dlCostume: '衣装を保存', saveGroup: '2 枚とも保存', holdGroup: '各画像を長押しして「画像を保存」',+ viewNote: (v) => '衣装のアングルはポーズに合わせます:' + v,+ bandEyebrow: '素材ライブラリ', bandTitle: 'ポーズに衣装を合わせる', bandSub: 'ポーズの拡大表示で「このポーズに衣装を合わせる」を押すか、ここから選んでください。', bandCta: (n) => n + ' 点の衣装を見る',+ keys: '← → アングル ↑ ↓ 前後の衣装 Esc 閉じる'+ },+ en: {+ nav: 'Costumes', crumb: 'Library / Costumes',+ title: (n) => 'Costumes · ' + n, sub: 'Ghost-mannequin product shots from the front, three-quarter, side and back. Pick one, pair it with any pose and hand both images to your AI outfit or character tool.',+ gender: { all: 'All', F: 'Women', M: 'Men', U: 'Unisex' }, genderLabel: 'Gender', cat: 'Category', all: 'All',+ views: ['Front', '3/4', 'Side', 'Back'], viewLabel: 'View', count: (n, all) => n + ' / ' + all, empty: 'No costumes match',+ open: (id) => 'Open ' + id, gap: 'This view is not ready yet', download: 'Download · 900', save: 'Save to Photos',+ descLabel: 'English costume description, ready for a prompt', adultOn: 'Lingerie: shown', adultOff: 'Lingerie: blurred', adultHint: 'Lingerie is blurred by default; tap one to see it, or show them all here', veilTitle: 'Lingerie, blurred',+ pairWith: (id) => 'Pair with ' + id, startWith: 'Find a pose for this', pairCostume: (id) => 'Pair with ' + id, startPose: 'Pick a costume for this pose',+ paired: (id) => 'Paired with ' + id,+ tray: 'Pairing', slotPose: 'Pose', slotCostume: 'Costume', pickPose: 'Pick a pose', pickCostume: 'Pick a costume', picking: 'picking',+ soon: 'Props · coming', done: 'Done', hide: 'Hide', end: 'End pairing',+ group: 'This pair', prompt: 'Combined prompt', dlPose: 'Pose image', dlCostume: 'Costume image', saveGroup: 'Save both', holdGroup: 'Long-press each image and choose “Save Image”',+ viewNote: (v) => 'Costume view follows the pose: ' + v,+ bandEyebrow: 'Library', bandTitle: 'Dress your pose', bandSub: 'Open any pose and tap “Pick a costume for this pose”, or start here.', bandCta: (n) => 'Browse ' + n + ' costumes',+ keys: '← → view ↑ ↓ costume Esc close'+ },+ ko: {+ nav: '의상', crumb: '소재 라이브러리 / 의상',+ title: (n) => '의상 · ' + n + '벌', sub: '고스트 마네킹 상품 사진. 정면·사선·측면·뒷면 4개 앵글. 원하는 포즈에 맞춰 두 장을 함께 AI 의상 변경이나 캐릭터 설정에 쓰세요.',+ gender: { all: '전체', F: '여성', M: '남성', U: '공용' }, genderLabel: '성별', cat: '분류', all: '전체',+ views: ['정면', '사선', '측면', '뒷면'], viewLabel: '앵글', count: (n, all) => n + ' / ' + all + '벌', empty: '조건에 맞는 의상이 없습니다',+ open: (id) => id + ' 크게 보기', gap: '이 앵글은 준비 중', download: '이 이미지 다운로드 · 900', save: '사진에 저장',+ descLabel: '영어 의상 설명 (프롬프트에 바로 사용)', adultOn: '란제리: 표시', adultOff: '란제리: 흐림', adultHint: '란제리는 기본으로 흐리게 표시됩니다. 하나씩 눌러 보거나 여기서 모두 표시하세요', veilTitle: '란제리, 흐림 처리됨',+ pairWith: (id) => id + '에 맞추기', startWith: '이 의상으로 포즈 고르기', pairCostume: (id) => id + ' 맞추기', startPose: '이 포즈에 의상 맞추기',+ paired: (id) => id + ' 맞춤 완료',+ tray: '코디', slotPose: '포즈', slotCostume: '의상', pickPose: '포즈 고르기', pickCostume: '의상 고르기', picking: '고르는 중',+ soon: '소품 · 제작 중', done: '완료', hide: '접기', end: '코디 끝내기',+ group: '이 조합', prompt: '합성 프롬프트', dlPose: '포즈 저장', dlCostume: '의상 저장', saveGroup: '두 장 모두 저장', holdGroup: '각 이미지를 길게 눌러 「이미지 저장」',+ viewNote: (v) => '의상 앵글은 포즈를 따릅니다: ' + v,+ bandEyebrow: '소재 라이브러리', bandTitle: '포즈에 의상 입히기', bandSub: '포즈를 크게 열고 「이 포즈에 의상 맞추기」를 누르거나 여기서 먼저 고르세요.', bandCta: (n) => '의상 ' + n + '벌 보기',+ keys: '← → 앵글 ↑ ↓ 이전·다음 의상 Esc 닫기'+ }+};+// Strings shared with the build: tools/build_site.py reads this block with json.loads to write the static pages// (pose pages, changelog, 404) and their meta tags, so keep it strict JSON between the two marker lines.// {name}-style slots are filled at build time or by common.js.@@ -154,6 +223,7 @@ window.I18N_PAGES = // BEGIN-JSON{"zh": {"langName": "中文", "langShort": "中", "ogLocale": "zh_CN",+ "navCostumes": "服装", "costumeTitle": "服装参考 · {n} 件 × 4 视角 | Shisei", "costumeDesc": "{n} 件隐形人台服装参考图:中国历代、世界民族、现代日常、礼服、制服、幻想等,每件正面、斜侧、侧面、背面四个视角,CC0。","navPoses": "姿势", "navChangelog": "更新日志","views": ["正面", "斜侧", "侧面", "俯视", "仰视"],"descLabel": "英文姿势描述,可直接放进提示词", "copy": "复制", "copied": "已复制",@@ -182,6 +252,7 @@ window.I18N_PAGES = // BEGIN-JSON},"ja": {"langName": "日本語", "langShort": "日", "ogLocale": "ja_JP",+ "navCostumes": "衣装", "costumeTitle": "衣装リファレンス · {n} 点 × 4 アングル | Shisei", "costumeDesc": "ゴーストマネキンの衣装リファレンス {n} 点。中国の歴代衣装、世界の民族衣装、現代服、フォーマル、制服、ファンタジーなど。各 4 アングル、CC0。","navPoses": "ポーズ", "navChangelog": "更新履歴","views": ["正面", "斜め", "横", "上から", "下から"],"descLabel": "英語のポーズ説明(プロンプトにそのまま使えます)", "copy": "コピー", "copied": "コピーしました",@@ -210,6 +281,7 @@ window.I18N_PAGES = // BEGIN-JSON},"en": {"langName": "English", "langShort": "EN", "ogLocale": "en_US",+ "navCostumes": "Costumes", "costumeTitle": "Costume reference · {n} outfits × 4 views | Shisei", "costumeDesc": "{n} ghost-mannequin costume references: Chinese historical, world traditional, everyday, formal, workwear, fantasy and more, each from the front, three-quarter, side and back. CC0.","navPoses": "Poses", "navChangelog": "Changelog","views": ["Front", "3/4", "Side", "Above", "Below"],"descLabel": "Pose description, ready for a prompt", "copy": "Copy", "copied": "Copied",@@ -238,6 +310,7 @@ window.I18N_PAGES = // BEGIN-JSON},"ko": {"langName": "한국어", "langShort": "한", "ogLocale": "ko_KR",+ "navCostumes": "의상", "costumeTitle": "의상 레퍼런스 · {n}벌 × 4앵글 | Shisei", "costumeDesc": "고스트 마네킹 의상 레퍼런스 {n}벌. 중국 역대 복식, 세계 전통 의상, 데일리, 포멀, 유니폼, 판타지 등. 각 4앵글, CC0.","navPoses": "포즈", "navChangelog": "변경 내역","views": ["정면", "대각선", "옆", "위에서", "아래에서"],"descLabel": "영문 포즈 설명 (프롬프트에 바로 사용)", "copy": "복사", "copied": "복사됨",diff --git a/web/index.html b/web/index.htmlindex 40145b9e..a0ce593c 100644--- a/web/index.html+++ b/web/index.html@@ -18,6 +18,7 @@ __HEAD__</a><div class="nav-links"><a href="#all" data-i18n="navPoses"></a>+ <a href="costume/" data-i18n="navCostumes"></a><button type="button" class="linklike" data-open="how" data-i18n="navHow"></button><a href="__CHANGELOG__" data-i18n="navChangelog"></a></div>@@ -82,6 +83,11 @@ __HEAD__<div id="grid"></div></section>+<section class="wrap c-band" id="cBand" aria-labelledby="cBandT" hidden>+ <div class="c-band-t"><span class="eyebrow" id="cBandEyebrow"></span><h2 id="cBandT"></h2><p id="cBandSub"></p></div>+ <a class="c-band-card" href="costume/"><span class="c-band-imgs" id="cBandImgs"></span><span class="c-band-cta"><b id="cBandCta"></b><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></span></a>+</section>+__NOSCRIPT__</main>@@ -138,6 +144,7 @@ __NOSCRIPT__<p id="lbDesc"></p></div><div class="lb-actions">+ <button type="button" class="pill light lb-pairbtn" id="lbPairBtn"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 4 4 7l2 4 2-1v10h8V10l2 1 2-4-4-3c-1 2-2.4 3-4 3S9 6 8 4z"/></svg><span id="lbPairText"></span></button><div class="lb-dls"><div class="lb-pose"><button type="button" class="pill light lb-back2" id="lbBack2" hidden><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 12H5M11 6l-6 6 6 6"/></svg><span id="lbBack2Text"></span></button>@@ -182,9 +189,10 @@ __NOSCRIPT__<div class="nudge" id="nudge" role="status" hidden><span id="nudgeText"></span><button type="button" id="nudgeAll" data-i18n="veilAll"></button><button type="button" class="nudge-x" id="nudgeClose" data-i18n-aria="close"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18"/></svg></button></div><script id="catalog" type="application/json">__CATALOG__</script>-<script>window.SHISEI = { repo: '__REPO__', version: '__VERSION__', base: '__BASE__', lang: '__LOC__', packs: __PACKS__ };</script>+<script>window.SHISEI = { repo: '__REPO__', version: '__VERSION__', base: '__BASE__', lang: '__LOC__', packs: __PACKS__, costumes: __COSTUME_TEASER__ };</script><script src="__BASE__i18n.js?v=__VERSION__"></script><script src="__BASE__common.js?v=__VERSION__"></script>+<script src="__BASE__tray.js?v=__VERSION__"></script><script src="__BASE__app.js?v=__VERSION__"></script></body></html>diff --git a/web/tray.js b/web/tray.jsnew file mode 100644index 00000000..4eedd304--- /dev/null+++ b/web/tray.js@@ -0,0 +1,162 @@+/* The pairing tray (docs/DESIGN.md, 服装与搭配, design A of 2026-11-01): a pose and a costume picked on two different+ pages stay together in a bar at the bottom right (a full-width bar on phones). The pose is always the first slot:+ the library is a pose library and costumes, later props and scenes, attach to a pose. Each slot leads back to its+ page to change it; "Done" opens the pair, its combined prompt and the two images. The pair lives in localStorage+ so it survives moving between the gallery and the costume page; × ends it. */+(() => {+ 'use strict';+ const KEY = 'shisei.combo';+ const loc = document.documentElement.dataset.loc || 'zh';+ const TC = window.I18N_COSTUME[loc];+ const TP = window.I18N_PAGES[loc];+ const BASE = (window.SHISEI && window.SHISEI.base) || '';+ const PREFIX = { zh: '', ja: 'ja/', en: 'en/', ko: 'ko/' };+ const POSE_VIEWS = ['front', 'diag', 'side', 'above', 'below'];+ const C_VIEWS = ['front', 'diag', 'side', 'back'];+ const NAME = { zh: 'cn', ja: 'jp', en: 'en', ko: 'kr' };+ const esc = (s) => String(s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));+ const home = BASE + PREFIX[loc];+ const costumePage = home + 'costume/';+ const poseImg = (tier, f) => BASE + 'images/line/' + tier + '/' + f;+ const costumeImg = (tier, f) => BASE + 'images/costume/grey/' + tier + '/' + f;+ // Costumes have no view from above or below: those pose angles pair with the costume's front.+ const cView = (c, poseV) => {+ const want = poseV <= 2 ? poseV : 0;+ return c.files[want] ? want : c.files.findIndex(Boolean);+ };+ const store = {+ get() { try { return JSON.parse(localStorage.getItem(KEY)) || {}; } catch (e) { return {}; } },+ set(v) { try { localStorage.setItem(KEY, JSON.stringify(v)); } catch (e) { /* private mode: this page only */ } }+ };+ let state = store.get();+ let open = false;+ let page = 'pose'; // which slot this page fills: 'pose' or 'costume'+ const ALBUM = matchMedia('(pointer: coarse)').matches;+ const SHARE = ALBUM && !!navigator.canShare && (() => {+ try { return navigator.canShare({ files: [new File([''], 'a.webp', { type: 'image/webp' })] }); } catch (e) { return false; }+ })();+ const files = new Map();++ const el = document.createElement('div');+ el.className = 'tray';+ el.id = 'tray';+ el.setAttribute('role', 'region');+ el.setAttribute('aria-label', TC.tray);+ el.hidden = true;+ document.body.appendChild(el);++ function pair() {+ const p = state.pose, c = state.costume;+ if (!p || !c) return null;+ const cv = cView(c, p.v);+ return { p, c, cv, prompt: p.desc + (c.keep ? ', wearing ' + c.keep : '') };+ }+ const poseHref = (p) => home + '#' + p.id + '-' + POSE_VIEWS[p.v];+ const costumeHref = (c, v) => costumePage + '#' + c.id + '-' + C_VIEWS[v];++ function slotHtml(kind) {+ const isPose = kind === 'pose';+ const x = state[kind];+ const cur = page === kind ? ' cur' : '';+ const label = isPose ? TC.slotPose : TC.slotCostume;+ if (!x) {+ return '<a class="tray-slot empty' + cur + '" href="' + esc(isPose ? home + '#all' : costumePage) + '" data-slot="' + kind + '">' ++ '<span class="tray-plus" aria-hidden="true">+</span><span class="tray-st"><small>' + esc(label) + '</small><b>' + esc(isPose ? TC.pickPose : TC.pickCostume) + '</b></span></a>';+ }+ const v = isPose ? x.v : cView(x, state.pose ? state.pose.v : 0);+ const img = isPose ? poseImg('w300', x.file) : costumeImg('w300', x.files[v]);+ const name = (x.names && x.names[loc]) || x.id;+ return '<a class="tray-slot ' + kind + cur + '" href="' + esc(isPose ? poseHref(x) : costumeHref(x, v)) + '" data-slot="' + kind + '"' ++ (isPose ? ' style="--tint:' + esc(x.tint || 'var(--tile)') + '"' : '') + ' aria-label="' + esc(label + ' ' + x.id + ' ' + name) + '">' ++ '<span class="tray-th"><img src="' + esc(img) + '" alt=""></span><span class="tray-st"><small>' + esc(label) + (cur ? '<span class="tray-pk"> · ' + esc(TC.picking) + '</span>' : '') + '</small><b class="mono">' + esc(x.id) + '</b></span></a>';+ }++ function render() {+ const p = state.pose, c = state.costume;+ const on = !!(p || c);+ el.hidden = !on;+ document.body.classList.toggle('has-tray', on);+ if (!on) { el.innerHTML = ''; open = false; return; }+ const P = pair();+ if (!P) open = false;+ const chev = '<svg class="tray-chev" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg>';+ let panel = '';+ if (P && open) {+ const pv = TP.views[P.p.v];+ const pf = poseImg('w900', P.p.file), cf = costumeImg('w900', P.c.files[P.cv]);+ const pn = 'shisei_' + P.p.id + '_' + POSE_VIEWS[P.p.v] + '.webp', cn = 'shisei_' + P.c.id + '_' + C_VIEWS[P.cv] + '.webp';+ const acts = SHARE+ ? '<button type="button" class="pill dark tp-save" data-tray="save">' + esc(TC.saveGroup) + '</button>'+ : '<a class="pill light" href="' + esc(pf) + '" download="' + pn + '">' + esc(TC.dlPose) + '</a><a class="pill dark" href="' + esc(cf) + '" download="' + cn + '">' + esc(TC.dlCostume) + '</a>';+ panel = '<section class="tray-panel" id="trayPanel" aria-label="' + esc(TC.group) + '">' ++ '<div class="tp-h"><b>' + esc(TC.group) + '</b><span class="mono">' + esc(P.p.id + ' + ' + P.c.id) + '</span></div>' ++ '<div class="tp-imgs"><a class="tp-img pose" href="' + esc(poseHref(P.p)) + '" data-slot="pose" style="--tint:' + esc(P.p.tint || 'var(--tile)') + '"><img src="' + esc(poseImg('w600', P.p.file)) + '" alt="' + esc(P.p.id + ' ' + ((P.p.names && P.p.names[loc]) || '') + ' · ' + pv) + '"></a>' ++ '<a class="tp-img costume" href="' + esc(costumeHref(P.c, P.cv)) + '" data-slot="costume"><img src="' + esc(costumeImg('w600', P.c.files[P.cv])) + '" alt="' + esc(P.c.id + ' ' + ((P.c.names && P.c.names[loc]) || '') + ' · ' + TC.views[P.cv]) + '"></a></div>' ++ '<p class="tp-note">' + esc(TC.viewNote(pv + ' → ' + TC.views[P.cv])) + '</p>' ++ '<div class="tp-prompt"><div class="tp-ph"><span>' + esc(TC.prompt) + '</span><button type="button" class="pill light tiny" data-tray="copy">' + esc(TP.copy) + '</button></div><p class="mono">' + esc(P.prompt) + '</p></div>' ++ '<div class="tp-acts">' + acts + '</div><p class="tp-tip" id="trayTip" role="status" hidden></p></section>';+ if (SHARE) [[pf, pn], [cf, cn]].forEach(([u, n]) => prefetch(u, n));+ }+ el.innerHTML = panel + '<div class="tray-bar"><span class="tray-l">' + esc(TC.tray) + '</span>' + slotHtml('pose') + chev + slotHtml('costume') ++ '<span class="tray-soon" title="' + esc(TC.soon) + '"><span aria-hidden="true">+</span><span class="sr">' + esc(TC.soon) + '</span></span>' ++ (P ? '<button type="button" class="tray-done" data-tray="toggle" aria-expanded="' + open + '" aria-controls="trayPanel">' + esc(open ? TC.hide : TC.done) + '</button>' : '') ++ '<button type="button" class="tray-x" data-tray="end" aria-label="' + esc(TC.end) + '"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18"/></svg></button></div>';+ }++ // share() must run inside the tap, so both files are fetched as soon as the panel shows them.+ function prefetch(url, name) {+ if (files.has(url)) return;+ const entry = { file: null };+ files.set(url, entry);+ fetch(url).then((r) => (r.ok ? r.blob() : Promise.reject(r.status)))+ .then((b) => { entry.file = new File([b], name, { type: 'image/webp' }); }).catch(() => files.delete(url));+ }+ function tip(msg) {+ const t = document.getElementById('trayTip');+ if (!t) return;+ t.textContent = msg;+ t.hidden = false;+ }++ el.addEventListener('click', (e) => {+ const b = e.target.closest('[data-tray]');+ const slot = e.target.closest('[data-slot]');+ if (slot && api.onSlot && api.onSlot(slot.dataset.slot, state) === true) { e.preventDefault(); return; }+ if (!b) return;+ const a = b.dataset.tray;+ if (a === 'toggle') { open = !open; render(); if (open) el.querySelector('.tray-panel').scrollTop = 0; }+ else if (a === 'end') { state = {}; store.set(state); open = false; render(); changed(); }+ else if (a === 'copy') { const P = pair(); if (P) window.ShiseiShare.copy(P.prompt); }+ else if (a === 'save') {+ const P = pair();+ const got = [poseImg('w900', P.p.file), costumeImg('w900', P.c.files[P.cv])].map((u) => files.get(u));+ if (got.every((x) => x && x.file)) navigator.share({ files: got.map((x) => x.file) }).catch((err) => { if (err.name !== 'AbortError') tip(TC.holdGroup); });+ else tip((window.I18N[loc] || {}).preparing || TC.holdGroup);+ }+ });+ // Escape folds the panel first.+ document.addEventListener('keydown', (e) => {+ if (e.key === 'Escape' && open && !document.querySelector('dialog[open]')) { open = false; render(); el.querySelector('.tray-done').focus(); }+ });+ // Another tab changed the pair.+ window.addEventListener('storage', (e) => { if (e.key === KEY) { state = store.get(); render(); changed(); } });+ function changed() { window.dispatchEvent(new CustomEvent('shisei:combo', { detail: state })); }++ const api = {+ get: () => state,+ // Called by the gallery with a pose, by the costume page with a costume; the panel opens once both are there.+ set(kind, value) {+ state = Object.assign({}, state, { [kind]: value });+ store.set(state);+ open = !!pair();+ render();+ changed();+ },+ setPage(k) { page = k; render(); },+ names: (o, key) => Object.fromEntries(Object.entries(NAME).map(([l, s]) => [l, o[key === 'pose' ? 'name_' + s : 'name_' + l]])),+ onSlot: null,+ views: C_VIEWS+ };+ window.ShiseiTray = api;+ render();+})();