baiten3d 0.1.1 → 0.1.2

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.
@@ -5,7 +5,7 @@ export interface SheetListDrawerProps {
5
5
  readonly publicationTitle: string;
6
6
  readonly sheets: readonly ComposedSheet[];
7
7
  readonly activeSpreadIndex: number;
8
- readonly onJumpToSpread: (spreadIndex: number) => void;
8
+ readonly onJumpToSpread: (spreadIndex: number, sheetIndex?: number) => void;
9
9
  readonly onSelectArticle: (slug: string, sheetIndex?: number) => void;
10
10
  readonly onClose: () => void;
11
11
  }
@@ -1 +1 @@
1
- export { c as ArchiveIndexView, r as MagazineViewer, n as NewspaperViewer, t as NewsstandView } from "../../react-CNogCJgk.js";
1
+ export { c as ArchiveIndexView, r as MagazineViewer, n as NewspaperViewer, t as NewsstandView } from "../../react-D1PVmQQw.js";
@@ -6,6 +6,7 @@
6
6
  * URL を汚染しないよう `pathname` のプレフィックスを必ず検証する。
7
7
  */
8
8
  export declare function readInitialPageParam(maxPages: number): number | null;
9
+ export declare function readInitialHashId(): string | null;
9
10
  export interface SyncReaderUrlOptions {
10
11
  readonly assetBase: string;
11
12
  readonly publicationId: string;
@@ -17,7 +18,12 @@ export interface SyncReaderUrlOptions {
17
18
  readonly omitPageOne?: boolean;
18
19
  /** 記事拡大・全文リーダーで個別記事を開いている場合のスラッグ */
19
20
  readonly articleSlug?: string | null;
21
+ /**
22
+ * 同一スラッグの記事が `paginateBy: "h2"` 等で複数ページへ分割されている場合に、
23
+ * 2ページ目以降でも `/{pub}/{slug}/?p=N` としてページ位置を URL へ保持する。
24
+ */
25
+ readonly preservePageWithArticle?: boolean;
20
26
  /** 記事を開く等の明示操作は pushState、ページめくりは replaceState */
21
27
  readonly push?: boolean;
22
28
  }
23
- export declare function syncReaderUrl({ assetBase, publicationId, latestEditionId, activeEditionId, page, omitPageOne, articleSlug, push, }: SyncReaderUrlOptions): void;
29
+ export declare function syncReaderUrl({ assetBase, publicationId, latestEditionId, activeEditionId, page, omitPageOne, articleSlug, preservePageWithArticle, push, }: SyncReaderUrlOptions): void;
@@ -1,8 +1,8 @@
1
1
  import { access as e, copyFile as t, cp as n, mkdir as r, mkdtemp as i, readFile as a, readdir as o, realpath as s, rm as c, stat as l, writeFile as u } from "node:fs/promises";
2
2
  import { basename as d, dirname as f, isAbsolute as p, join as m, relative as h, resolve as g, sep as _ } from "node:path";
3
3
  import v from "yaml";
4
- import { t as y } from "../../composeSite-CcP_4wa0.js";
5
- import { n as b } from "../../rack-DndsEqJP.js";
4
+ import { t as y } from "../../composeSite-BEb4A7zA.js";
5
+ import { n as b } from "../../rack-C76bUYRK.js";
6
6
  import ee from "rehype-highlight";
7
7
  import te, { defaultSchema as x } from "rehype-sanitize";
8
8
  import ne from "rehype-stringify";
@@ -859,21 +859,23 @@ function G(e, t, n) {
859
859
  return r ? K(e, t, r, n, !0) : q(e, t, n);
860
860
  }
861
861
  function K(e, t, n, r, i = !1, a) {
862
- let o = Q(r), s = n.sheets.map((e) => {
863
- let n = e.blocks.map((e) => {
864
- let n = `${o}${t.config.id}/${e.article.slug}/`, r = e.article.heroImage ? `<img src="${o}${$(t.config.id)}/${$(e.article.heroImage)}" alt="${$(e.article.heroCaption ?? e.article.title)}" loading="lazy" width="640" height="480">` : "";
865
- return `<article class="baiten-ssr-block" data-role="${$(e.role)}" data-col-span="${e.colSpan}" data-row-span="${e.rowSpan}">
866
- <h3><a href="${$(n)}">${$(e.article.title)}</a></h3>
867
- ${e.article.subtitle ? `<p class="baiten-ssr-subtitle">${$(e.article.subtitle)}</p>` : ""}
868
- ${r}
869
- <p class="baiten-ssr-summary">${$(e.article.summary)}</p>
862
+ let o = Q(r), s = /* @__PURE__ */ new Set(), c = n.sheets.map((e) => {
863
+ let n = e.blocks.map((n) => {
864
+ let r = s.has(n.article.slug);
865
+ s.add(n.article.slug);
866
+ let i = r ? `${o}${t.config.id}/${n.article.slug}/?p=${e.page}` : `${o}${t.config.id}/${n.article.slug}/`, a = n.article.heroImage ? `<img src="${o}${$(t.config.id)}/${$(n.article.heroImage)}" alt="${$(n.article.heroCaption ?? n.article.title)}" loading="lazy" width="640" height="480">` : "";
867
+ return `<article class="baiten-ssr-block" data-role="${$(n.role)}" data-col-span="${n.colSpan}" data-row-span="${n.rowSpan}">
868
+ <h3><a href="${$(i)}">${$(n.article.title)}</a></h3>
869
+ ${n.article.subtitle ? `<p class="baiten-ssr-subtitle">${$(n.article.subtitle)}</p>` : ""}
870
+ ${a}
871
+ <p class="baiten-ssr-summary">${$(n.article.summary)}</p>
870
872
  </article>`;
871
873
  }).join("\n");
872
874
  return `<section class="baiten-ssr-sheet" aria-label="${e.page}面">
873
875
  <h2>${e.page}面</h2>
874
876
  ${n}
875
877
  </section>`;
876
- }).join("\n"), c = t.editions.map((e) => `<li><a href="${o}${$(t.config.id)}/editions/${$(e.id)}/">${$(e.label)} — ${$(e.title)} (${$(e.publishedAt)})</a></li>`).join("\n"), l = i ? `${t.config.title} | ${e.site.title}` : `${t.config.title} ${n.label}(${n.title}) | ${e.site.title}`, u = t.config.description ?? n.leadArticle?.summary ?? `${t.config.title}の紙面`, d = `<main class="baiten-ssr-edition" data-pub="${$(t.config.id)}" data-theme="${$(t.config.theme)}" data-scene="${$(t.config.scene)}" dir="${t.readingDirection}">
878
+ }).join("\n"), l = t.editions.map((e) => `<li><a href="${o}${$(t.config.id)}/editions/${$(e.id)}/">${$(e.label)} — ${$(e.title)} (${$(e.publishedAt)})</a></li>`).join("\n"), u = i ? `${t.config.title} | ${e.site.title}` : `${t.config.title} ${n.label}(${n.title}) | ${e.site.title}`, d = t.config.description ?? n.leadArticle?.summary ?? `${t.config.title}の紙面`, f = `<main class="baiten-ssr-edition" data-pub="${$(t.config.id)}" data-theme="${$(t.config.theme)}" data-scene="${$(t.config.scene)}" dir="${t.readingDirection}">
877
879
  <header>
878
880
  <nav aria-label="紙面ナビゲーション">
879
881
  <a href="${o}">売店へ戻る</a>
@@ -882,20 +884,20 @@ function K(e, t, n, r, i = !1, a) {
882
884
  <h1>${$(t.config.title)} — ${$(n.label)}</h1>
883
885
  <p><time datetime="${$(n.publishedAt)}">${$(n.publishedAt)}</time></p>
884
886
  </header>
885
- ${s}
887
+ ${c}
886
888
  <aside aria-label="バックナンバー">
887
889
  <h2>バックナンバー</h2>
888
- <ul>${c}</ul>
890
+ <ul>${l}</ul>
889
891
  </aside>
890
- </main>`, f = a ?? r;
892
+ </main>`, p = a ?? r;
891
893
  return Y(e, {
892
- title: l,
893
- description: u,
894
+ title: u,
895
+ description: d,
894
896
  routePath: r,
895
- canonicalRoutePath: f,
897
+ canonicalRoutePath: p,
896
898
  ogType: "website",
897
899
  ogImage: n.leadArticle?.heroImage ? `${t.config.id}/${n.leadArticle.heroImage}` : void 0,
898
- jsonLd: [X(e, l, u, f)],
900
+ jsonLd: [X(e, u, d, p)],
899
901
  initialView: i ? {
900
902
  kind: "edition",
901
903
  publicationId: t.config.id
@@ -904,7 +906,7 @@ function K(e, t, n, r, i = !1, a) {
904
906
  publicationId: t.config.id,
905
907
  editionId: n.id
906
908
  },
907
- body: d
909
+ body: f
908
910
  });
909
911
  }
910
912
  function q(e, t, n) {
@@ -1,4 +1,4 @@
1
- import { a as e } from "./rack-DndsEqJP.js";
1
+ import { a as e } from "./rack-C76bUYRK.js";
2
2
  // src/application/composeSite.ts
3
3
  function t(t, i = {}) {
4
4
  let a = t.map((t) => e(t.config, t.articles)), o = i.entryViewOverride ?? (a.length === 1 ? "front-page" : "stand"), s = n(a), c = r(a);
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./react-CNogCJgk.js";
2
- import { t as c } from "./composeSite-CcP_4wa0.js";
3
- import { a as l, n as u, r as d, t as f } from "./rack-DndsEqJP.js";
1
+ import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./react-D1PVmQQw.js";
2
+ import { t as c } from "./composeSite-BEb4A7zA.js";
3
+ import { a as l, n as u, r as d, t as f } from "./rack-C76bUYRK.js";
4
4
  export { t as ArchiveIndexView, a as MagazineViewer, r as NewspaperViewer, s as NewsstandView, f as chunkRackRows, l as composePublication, c as composeSite, n as computeMastheadTitleSizePx, u as isSafeNavigationHref, e as normalizeOverlayTone, i as publicationStyleToCssVars, o as resolvePublicationStyle, d as resolveRackSlots };
@@ -186,7 +186,33 @@ function u(e, n, r, i, a) {
186
186
  blocks: u
187
187
  });
188
188
  else if (u.length !== 0) {
189
- if (r === "full-bleed-image" || u.length === 1 && (u[0]?.article.pages?.length ?? 0) > 0) {
189
+ if (n === "magazine" && u.length === 1 && u[0]?.article.paginateBy === "h2") {
190
+ let e = u[0], t = e.article, n = b(t), a = Math.max(i.page, v(c));
191
+ for (let o = 0; o < n.length; o += 1) {
192
+ let s = n[o];
193
+ if (!s) continue;
194
+ let l = {
195
+ ...t,
196
+ title: o === 0 ? t.title : s.title,
197
+ subtitle: o === 0 ? t.subtitle : void 0,
198
+ heroImage: o === 0 ? t.heroImage : void 0,
199
+ heroCaption: o === 0 ? t.heroCaption : void 0,
200
+ body: s.body,
201
+ bodyHtml: s.bodyHtml
202
+ };
203
+ c.push({
204
+ page: a,
205
+ template: o === 0 ? r : r === "magazine-feature" ? "magazine-editorial" : r,
206
+ sectionLabel: o === 0 ? i.sectionLabel ?? s.sectionLabel ?? t.kicker : s.sectionLabel ?? t.kicker,
207
+ columns: i.columns,
208
+ rows: i.rows,
209
+ blocks: [{
210
+ ...e,
211
+ article: l
212
+ }]
213
+ }), a += 1;
214
+ }
215
+ } else if (r === "full-bleed-image" || u.length === 1 && (u[0]?.article.pages?.length ?? 0) > 0) {
190
216
  let e = i.page;
191
217
  for (let t of u) {
192
218
  let n = t.article.pages;