baiten3d 0.1.2 → 0.1.3

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.
@@ -1979,23 +1979,32 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
1979
1979
  let n = e.allArticles.find((e) => e.slug === t.slug) ?? t;
1980
1980
  z(n);
1981
1981
  }, [e.allArticles]), en = h((e, t) => {
1982
- let n = e.target, r = e.currentTarget.classList.contains("baiten-mag-prose") ? n?.closest(".baiten-figure") : e.currentTarget;
1983
- if (!r) return;
1982
+ let n = t.matches(".baiten-figure, .baiten-mag-fig-box, [data-figure-kind]") ? t : e?.closest(".baiten-figure, [data-figure-kind]") ?? null;
1983
+ return !n || !t.contains(n) ? null : n;
1984
+ }, []), tn = h((e, t) => {
1985
+ let n = en(e.target, e.currentTarget);
1986
+ if (!n) return;
1984
1987
  e.stopPropagation();
1985
- let i = r.querySelector("img");
1986
- _t(i ? {
1987
- kind: "image",
1988
- title: t,
1989
- src: i.getAttribute("src") ?? i.src,
1990
- alt: i.alt || t
1991
- } : {
1992
- kind: "table",
1988
+ let r = n.getAttribute("data-figure-kind") ?? n.querySelector("[data-figure-kind]")?.getAttribute("data-figure-kind"), i = r === "code" || r === "table" || r === "mermaid" || r === "image" ? r : void 0, a = n.querySelector("img");
1989
+ if (a && (!i || i === "image")) {
1990
+ _t({
1991
+ kind: "image",
1992
+ title: t,
1993
+ src: a.getAttribute("src") ?? a.src,
1994
+ alt: a.alt || t
1995
+ });
1996
+ return;
1997
+ }
1998
+ let o = n.querySelector("code");
1999
+ _t({
2000
+ kind: i ?? (o ? "code" : "table"),
1993
2001
  title: t,
1994
- html: r.innerHTML
2002
+ html: n.innerHTML,
2003
+ copyText: o?.textContent ?? void 0
1995
2004
  });
1996
- }, []), tn = h((e, t) => {
1997
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), en(e, t));
1998
- }, [en]), nn = (e) => {
2005
+ }, [en]), nn = h((e, t) => {
2006
+ (e.key === "Enter" || e.key === " ") && en(e.target, e.currentTarget) && (e.preventDefault(), tn(e, t));
2007
+ }, [tn, en]), rn = (e) => {
1999
2008
  if (F || Ae) return;
2000
2009
  if (it(e.target, e.currentTarget)) {
2001
2010
  kt.current = null;
@@ -2006,14 +2015,14 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2006
2015
  x: t.clientX,
2007
2016
  y: t.clientY
2008
2017
  });
2009
- }, rn = (e) => {
2018
+ }, an = (e) => {
2010
2019
  let t = kt.current;
2011
2020
  if (kt.current = null, !t || F || Ae) return;
2012
2021
  let n = e.changedTouches[0];
2013
2022
  if (!n) return;
2014
2023
  let r = n.clientX - t.x, i = n.clientY - t.y;
2015
2024
  Math.abs(r) < 46 || Math.abs(r) < Math.abs(i) * 1.2 || Yt(A ? r > 0 ? "forward" : "backward" : r < 0 ? "forward" : "backward");
2016
- }, an = se({
2025
+ }, on = se({
2017
2026
  kind: "magazine",
2018
2027
  stageWidth: q.width,
2019
2028
  stageHeight: q.height,
@@ -2023,7 +2032,7 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2023
2032
  isMobile: K,
2024
2033
  logicalX: Be.lx,
2025
2034
  logicalY: Be.ly
2026
- }), on = h(() => {
2035
+ }), sn = h(() => {
2027
2036
  L(null), ge(null), Ve(oe({
2028
2037
  logicalWidth: Q,
2029
2038
  logicalHeight: $,
@@ -2033,12 +2042,12 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2033
2042
  Q,
2034
2043
  $,
2035
2044
  K
2036
- ]), sn = (e, t) => {
2045
+ ]), cn = (e, t) => {
2037
2046
  if (We.current) {
2038
2047
  We.current = !1;
2039
2048
  return;
2040
2049
  }
2041
- let n = wt.current?.getBoundingClientRect(), r = n ? n.left + an.rawScreenX : e, i = n ? n.top + an.rawScreenY : t;
2050
+ let n = wt.current?.getBoundingClientRect(), r = n ? n.left + on.rawScreenX : e, i = n ? n.top + on.rawScreenY : t;
2042
2051
  if (r > 0 && i > 0 && typeof document.elementsFromPoint == "function") for (let e of document.elementsFromPoint(r, i)) {
2043
2052
  let t = e.closest?.("[data-article-slug]"), n = t?.getAttribute("data-article-slug");
2044
2053
  if (n) {
@@ -2049,10 +2058,10 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2049
2058
  }
2050
2059
  let a = It?.blocks[0] ? It : Lt, o = a?.blocks[0]?.article.slug;
2051
2060
  o && Qt(o, a?.page);
2052
- }, cn = (e) => {
2061
+ }, ln = (e) => {
2053
2062
  if (Ae && !Y && !Z && wt.current && (K || e.pointerType !== "mouse")) {
2054
2063
  let t = wt.current.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
2055
- if (Math.hypot(n - an.screenX, r - an.screenY) <= an.diameter / 2 + 12) Ue.current = {
2064
+ if (Math.hypot(n - on.screenX, r - on.screenY) <= on.diameter / 2 + 12) Ue.current = {
2056
2065
  pointerId: e.pointerId,
2057
2066
  mode: "relative",
2058
2067
  startClientX: e.clientX,
@@ -2095,7 +2104,7 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2095
2104
  origPanY: Ce.y,
2096
2105
  moved: !1
2097
2106
  }, ke(!0), e.currentTarget.setPointerCapture?.(e.pointerId)));
2098
- }, ln = (e) => {
2107
+ }, un = (e) => {
2099
2108
  if (Ae && !Y && !Z && wt.current) {
2100
2109
  let t = wt.current.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top, i = Ue.current;
2101
2110
  if (i && i.pointerId === e.pointerId) {
@@ -2140,7 +2149,7 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2140
2149
  x: Math.max(-i, Math.min(i, t.origPanX + n)),
2141
2150
  y: Math.max(-a, Math.min(a, t.origPanY + r))
2142
2151
  });
2143
- }, un = (e) => {
2152
+ }, dn = (e) => {
2144
2153
  let t = Ue.current;
2145
2154
  if (t && t.pointerId === e.pointerId) {
2146
2155
  (t.moved || !t.startedInsideLens) && (We.current = !0, window.setTimeout(() => {
@@ -2154,7 +2163,7 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2154
2163
  }
2155
2164
  let n = At.current;
2156
2165
  n && n.pointerId === e.pointerId && (At.current = null, ke(!1), e.currentTarget.releasePointerCapture?.(e.pointerId));
2157
- }, dn = v(() => {
2166
+ }, fn = v(() => {
2158
2167
  let e = (q.width - Q * Wt) / 2, t = (q.height - $ * Wt) / 2;
2159
2168
  if (!Z || !De || Y) return `translate3d(${e}px, ${t}px, 0px) scale(${Wt})`;
2160
2169
  let n = Math.max(0, Math.min(Q, De.x + De.width / 2)), r = Math.max(0, Math.min($, De.y + De.height / 2)), i = Wt * xe, a = q.width / 2 - n * i + Ce.x, o = q.height / 2 - r * i + Ce.y, s = Math.min(e, q.width - Q * i - 32), c = Math.max(e, 32), l = Math.min(t, q.height - $ * i - 32);
@@ -2171,15 +2180,15 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2171
2180
  Q,
2172
2181
  q.height,
2173
2182
  q.width
2174
- ]), fn = d ?? e.config.scene, pn = at[fn], mn = () => {
2183
+ ]), pn = d ?? e.config.scene, mn = at[pn], hn = () => {
2175
2184
  _ ? _() : window.location.href = `${n}?bay=magazine`;
2176
- }, hn = () => {
2185
+ }, gn = () => {
2177
2186
  D ? D() : window.location.href = `${n}${e.config.id}/archive/`;
2178
- }, gn = (e) => {
2187
+ }, _n = (e) => {
2179
2188
  re(e), P(-1), L(null), ge(null), ve(null), be(null), $e(!1), O?.(e);
2180
- }, _n = h((e) => {
2189
+ }, vn = h((e) => {
2181
2190
  nt(!1), Jt(e);
2182
- }, [Jt]), vn = Y ? `表紙 / 全${J.length}P` : K ? `${It?.page ?? X + 1}P / 全${J.length}P` : Lt ? `${It?.page ?? X + 1}–${Lt.page}P / 全${J.length}P` : `${It?.page ?? X + 1}P / 全${J.length}P`, yn = v(() => {
2191
+ }, [Jt]), yn = Y ? `表紙 / 全${J.length}P` : K ? `${It?.page ?? X + 1}P / 全${J.length}P` : Lt ? `${It?.page ?? X + 1}–${Lt.page}P / 全${J.length}P` : `${It?.page ?? X + 1}P / 全${J.length}P`, bn = v(() => {
2183
2192
  if (U?.phase !== "animating" || U.singlePage) return Rt;
2184
2193
  if (U.physicalDir === "next") {
2185
2194
  let e = J[U.targetCursor] ?? null, t = J[U.targetCursor + 1] ?? null;
@@ -2191,7 +2200,7 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2191
2200
  Rt,
2192
2201
  J,
2193
2202
  U
2194
- ]), bn = v(() => {
2203
+ ]), xn = v(() => {
2195
2204
  if (U?.phase !== "animating" || U.singlePage) return zt;
2196
2205
  if (U.physicalDir === "prev") {
2197
2206
  let e = J[U.targetCursor] ?? null, t = J[U.targetCursor + 1] ?? null;
@@ -2203,7 +2212,7 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2203
2212
  zt,
2204
2213
  J,
2205
2214
  U
2206
- ]), xn = U && U.phase === "animating" ? /* @__PURE__ */ S(He, {
2215
+ ]), Sn = U && U.phase === "animating" ? /* @__PURE__ */ S(He, {
2207
2216
  backCanvas: U.backCanvas,
2208
2217
  backSheet: U.backSheet,
2209
2218
  direction: U.physicalDir,
@@ -2217,13 +2226,13 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2217
2226
  spreadWidth: U.spreadWidth,
2218
2227
  staticProgress: jt,
2219
2228
  surface: "magazine"
2220
- }) : null, Sn = W?.stage === "hinge" ? /* @__PURE__ */ S(ht, {
2229
+ }) : null, Cn = W?.stage === "hinge" ? /* @__PURE__ */ S(ht, {
2221
2230
  assetBase: n,
2222
2231
  direction: W.direction,
2223
2232
  edition: Pt,
2224
2233
  isRtl: A,
2225
2234
  publication: e
2226
- }) : null, Cn = /* @__PURE__ */ S(gt, {
2235
+ }) : null, wn = /* @__PURE__ */ S(gt, {
2227
2236
  activeEdition: Pt,
2228
2237
  allSheets: J,
2229
2238
  assetBase: n,
@@ -2235,22 +2244,22 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2235
2244
  isRtl: A,
2236
2245
  isVertical: ee,
2237
2246
  leftPageRef: Et,
2238
- leftSheet: yn,
2239
- onFigureClick: en,
2240
- onFigureKeyDown: tn,
2241
- onJumpToSheet: _n,
2247
+ leftSheet: bn,
2248
+ onFigureClick: tn,
2249
+ onFigureKeyDown: nn,
2250
+ onJumpToSheet: vn,
2242
2251
  onOpenClipping: $t,
2243
2252
  onSelectArticle: Qt,
2244
2253
  publication: e,
2245
2254
  rightPageRef: Dt,
2246
- rightSheet: bn,
2255
+ rightSheet: xn,
2247
2256
  spreadGridRef: Tt,
2248
- spreadOverlay: xn,
2249
- coverOverlay: Sn,
2257
+ spreadOverlay: Sn,
2258
+ coverOverlay: Cn,
2250
2259
  stagingPageRef: Ot,
2251
2260
  stagingSheet: U?.stagingSheet ?? null,
2252
2261
  stagingSide: U?.stagingSide ?? "left"
2253
- }), wn = /* @__PURE__ */ S(gt, {
2262
+ }), Tn = /* @__PURE__ */ S(gt, {
2254
2263
  activeEdition: Pt,
2255
2264
  allSheets: J,
2256
2265
  assetBase: n,
@@ -2261,9 +2270,9 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2261
2270
  isRtl: A,
2262
2271
  isVertical: ee,
2263
2272
  leftSheet: Rt,
2264
- onFigureClick: en,
2265
- onFigureKeyDown: tn,
2266
- onJumpToSheet: _n,
2273
+ onFigureClick: tn,
2274
+ onFigureKeyDown: nn,
2275
+ onJumpToSheet: vn,
2267
2276
  onOpenClipping: $t,
2268
2277
  onSelectArticle: Qt,
2269
2278
  publication: e,
@@ -2280,7 +2289,7 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2280
2289
  "data-paper-finish": e.config.paperFinish ?? "matte",
2281
2290
  "data-photo-treatment": Mt.photoTreatment,
2282
2291
  "data-reading-direction": e.readingDirection,
2283
- "data-scene": fn,
2292
+ "data-scene": pn,
2284
2293
  "data-text-size": Fe,
2285
2294
  "data-writing-mode": e.writingMode,
2286
2295
  dir: "ltr",
@@ -2289,14 +2298,14 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2289
2298
  style: {
2290
2299
  ...Nt,
2291
2300
  "--baiten-mag-text-scale": String(ze),
2292
- backgroundColor: pn.fallbackColor,
2293
- backgroundImage: `url(${pn.backgroundUrl})`
2301
+ backgroundColor: mn.fallbackColor,
2302
+ backgroundImage: `url(${mn.backgroundUrl})`
2294
2303
  },
2295
2304
  children: [
2296
2305
  /* @__PURE__ */ S("div", {
2297
2306
  "aria-hidden": "true",
2298
2307
  className: "baiten-viewer__scrim",
2299
- style: { background: pn.scrimGradient }
2308
+ style: { background: mn.scrimGradient }
2300
2309
  }),
2301
2310
  /* @__PURE__ */ C("header", {
2302
2311
  className: "baiten-reader-topbar",
@@ -2328,7 +2337,7 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2328
2337
  }) : /* @__PURE__ */ C("button", {
2329
2338
  "aria-label": "売店へ戻る",
2330
2339
  className: "baiten-glass-btn",
2331
- onClick: mn,
2340
+ onClick: hn,
2332
2341
  type: "button",
2333
2342
  children: [/* @__PURE__ */ S(p, {
2334
2343
  "aria-hidden": "true",
@@ -2360,7 +2369,7 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2360
2369
  "aria-selected": Ae && !Z,
2361
2370
  className: `baiten-segmented__btn${Ae && !Z ? " is-active" : ""}`,
2362
2371
  onClick: () => {
2363
- Ae && !Z ? Me(!1) : on();
2372
+ Ae && !Z ? Me(!1) : sn();
2364
2373
  },
2365
2374
  role: "tab",
2366
2375
  type: "button",
@@ -2500,19 +2509,19 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2500
2509
  Z && e.target === e.currentTarget && (L(null), ge(null));
2501
2510
  },
2502
2511
  onKeyDown: () => {},
2503
- onPointerCancel: un,
2504
- onPointerDown: cn,
2505
- onPointerMove: ln,
2506
- onPointerUp: un,
2507
- onTouchEnd: rn,
2508
- onTouchStart: nn,
2512
+ onPointerCancel: dn,
2513
+ onPointerDown: ln,
2514
+ onPointerMove: un,
2515
+ onPointerUp: dn,
2516
+ onTouchEnd: an,
2517
+ onTouchStart: rn,
2509
2518
  ref: wt,
2510
2519
  children: [/* @__PURE__ */ S("div", {
2511
2520
  className: `baiten-camera-rig${Oe ? " is-dragging" : ""}`,
2512
2521
  style: {
2513
2522
  width: Q,
2514
2523
  height: $,
2515
- transform: dn
2524
+ transform: fn
2516
2525
  },
2517
2526
  children: Y ? /* @__PURE__ */ S(pt, {
2518
2527
  assetBase: n,
@@ -2526,24 +2535,24 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2526
2535
  edition: Pt,
2527
2536
  isRtl: A,
2528
2537
  publication: e
2529
- }) : Cn
2538
+ }) : wn
2530
2539
  }), Ae && !Y && !Z ? /* @__PURE__ */ S(qe, {
2531
- diameter: an.diameter,
2540
+ diameter: on.diameter,
2532
2541
  logicalHeight: $,
2533
2542
  logicalWidth: Q,
2534
2543
  logicalX: Be.lx,
2535
2544
  logicalY: Be.ly,
2536
- magnifiedScale: an.magnifiedScale,
2537
- onActivate: sn,
2538
- screenX: an.screenX,
2539
- screenY: an.screenY,
2545
+ magnifiedScale: on.magnifiedScale,
2546
+ onActivate: cn,
2547
+ screenX: on.screenX,
2548
+ screenY: on.screenY,
2540
2549
  children: /* @__PURE__ */ S("div", {
2541
2550
  className: "baiten-mag-loupe-host",
2542
2551
  style: {
2543
2552
  width: Q,
2544
2553
  height: $
2545
2554
  },
2546
- children: wn
2555
+ children: Tn
2547
2556
  })
2548
2557
  }) : null]
2549
2558
  }),
@@ -2555,7 +2564,7 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2555
2564
  children: Y ? /* @__PURE__ */ C(x, { children: [
2556
2565
  /* @__PURE__ */ C("span", {
2557
2566
  className: "baiten-bottom-pill__label",
2558
- children: [/* @__PURE__ */ S("strong", { children: e.config.title }), /* @__PURE__ */ S("span", { children: vn })]
2567
+ children: [/* @__PURE__ */ S("strong", { children: e.config.title }), /* @__PURE__ */ S("span", { children: yn })]
2559
2568
  }),
2560
2569
  /* @__PURE__ */ S("span", {
2561
2570
  "aria-hidden": "true",
@@ -2593,7 +2602,7 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2593
2602
  }),
2594
2603
  /* @__PURE__ */ C("span", {
2595
2604
  className: "baiten-bottom-pill__label",
2596
- children: [/* @__PURE__ */ S("strong", { children: e.config.title }), /* @__PURE__ */ S("span", { children: vn })]
2605
+ children: [/* @__PURE__ */ S("strong", { children: e.config.title }), /* @__PURE__ */ S("span", { children: yn })]
2597
2606
  }),
2598
2607
  /* @__PURE__ */ S("span", {
2599
2608
  "aria-hidden": "true",
@@ -2628,7 +2637,7 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2628
2637
  }),
2629
2638
  /* @__PURE__ */ C("span", {
2630
2639
  className: "baiten-bottom-pill__label",
2631
- children: [/* @__PURE__ */ S("strong", { children: e.config.title }), /* @__PURE__ */ S("span", { children: vn })]
2640
+ children: [/* @__PURE__ */ S("strong", { children: e.config.title }), /* @__PURE__ */ S("span", { children: yn })]
2632
2641
  }),
2633
2642
  /* @__PURE__ */ S("span", {
2634
2643
  "aria-hidden": "true",
@@ -2652,8 +2661,8 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2652
2661
  activeEditionId: Pt?.id,
2653
2662
  editions: e.editions,
2654
2663
  onClose: () => $e(!1),
2655
- onOpenArchive: hn,
2656
- onSelectEdition: gn,
2664
+ onOpenArchive: gn,
2665
+ onSelectEdition: _n,
2657
2666
  open: Ke,
2658
2667
  publicationTitle: e.config.title
2659
2668
  }),
@@ -2669,7 +2678,7 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2669
2678
  /* @__PURE__ */ S(Je, {
2670
2679
  activeSpreadIndex: X < 0 ? 0 : Math.floor(X / 2),
2671
2680
  onClose: () => nt(!1),
2672
- onJumpToSpread: (e, t) => _n(t ?? e * 2),
2681
+ onJumpToSpread: (e, t) => vn(t ?? e * 2),
2673
2682
  onSelectArticle: (e, t) => {
2674
2683
  nt(!1), Zt(e, t);
2675
2684
  },
@@ -2682,8 +2691,8 @@ function ft({ publication: e, assetBase: n = "./", initialEditionId: a, initialA
2682
2691
  assetBase: n,
2683
2692
  edition: Pt,
2684
2693
  onClose: () => z(null),
2685
- onFigureClick: en,
2686
- onFigureKeyDown: tn,
2694
+ onFigureClick: tn,
2695
+ onFigureKeyDown: nn,
2687
2696
  publication: e
2688
2697
  }),
2689
2698
  /* @__PURE__ */ S(Ne, {