book-index-ui 0.66.7 → 0.66.8-rc.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.
- package/dist/{Badge-Dw5XcOep.js → Badge-3bEvwpf2.js} +39 -25
- package/dist/{Badge-Czc0_9hI.cjs → Badge-Oejp55Xg.cjs} +1 -1
- package/dist/editor.cjs +1 -1
- package/dist/editor.d.ts +25 -0
- package/dist/editor.js +1 -1
- package/dist/index.cjs +70 -70
- package/dist/index.d.ts +34 -0
- package/dist/index.js +6101 -5949
- package/dist/storage.d.ts +22 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as m, jsx as p } from "react/jsx-runtime";
|
|
2
2
|
import { createContext as B, useContext as R, useRef as P, useEffect as N } from "react";
|
|
3
3
|
import "opencc-js/t2cn";
|
|
4
4
|
import { V as _ } from "./variant-chars-L-oO6iL7.js";
|
|
@@ -271,10 +271,10 @@ const b = '"Songti SC", "Songti TC", STSong, "Noto Serif CJK SC", "Source Han Se
|
|
|
271
271
|
note: "列表页标题栏、检索框行、统计摘要、结果区的左右内边距;宿主要贴齐自己的版心时设 0"
|
|
272
272
|
}
|
|
273
273
|
})
|
|
274
|
-
], O = Object.assign({}, ...W.map((e) => e.tokens)),
|
|
275
|
-
for (const [e, o] of Object.entries(O))
|
|
274
|
+
], O = Object.assign({}, ...W.map((e) => e.tokens)), S = {};
|
|
275
|
+
for (const [e, o] of Object.entries(O)) S[e] = `var(--bim-${e}, ${o.value})`;
|
|
276
276
|
function a(e) {
|
|
277
|
-
const o =
|
|
277
|
+
const o = S[e];
|
|
278
278
|
if (o === void 0) throw new Error(`book-index-ui: 未定义的设计变量 --bim-${e}`);
|
|
279
279
|
return o;
|
|
280
280
|
}
|
|
@@ -284,7 +284,7 @@ function L(e) {
|
|
|
284
284
|
function Te(e, o) {
|
|
285
285
|
return L(e).includes(o);
|
|
286
286
|
}
|
|
287
|
-
const
|
|
287
|
+
const Ce = {
|
|
288
288
|
source: "底本",
|
|
289
289
|
ocr: "OCR",
|
|
290
290
|
rough: "粗校",
|
|
@@ -299,7 +299,7 @@ const M = B(null), I = [
|
|
|
299
299
|
function F(e) {
|
|
300
300
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
301
301
|
}
|
|
302
|
-
function
|
|
302
|
+
function Se(e, o = I) {
|
|
303
303
|
const t = [...new Set(o.filter(Boolean))].sort((l, d) => d.length - l.length);
|
|
304
304
|
if (!t.length) return e;
|
|
305
305
|
const n = new RegExp(`(${t.map(F).join("|")})`, "g"), i = new Set(t);
|
|
@@ -309,7 +309,7 @@ function Ce(e, o = I) {
|
|
|
309
309
|
return d.length === 1 ? e(l) : d.map((r, s) => s % 2 === 1 && i.has(r) ? r : r && e(r)).join("");
|
|
310
310
|
};
|
|
311
311
|
}
|
|
312
|
-
const
|
|
312
|
+
const U = {
|
|
313
313
|
indexType: { work: "作品", book: "書籍", collection: "叢編", entity: "人物" },
|
|
314
314
|
resourceType: { text: "文字資源", image: "圖片資源", textImage: "文字+圖片資源", physical: "館藏" },
|
|
315
315
|
resourceTypeShort: { text: "文字", image: "圖片", textImage: "文字+圖片", physical: "館藏" },
|
|
@@ -649,7 +649,7 @@ const H = {
|
|
|
649
649
|
textResource: "文字資源",
|
|
650
650
|
imageResource: "圖片資源"
|
|
651
651
|
}
|
|
652
|
-
},
|
|
652
|
+
}, H = {
|
|
653
653
|
indexType: { work: "作品", book: "书籍", collection: "丛编", entity: "人物" },
|
|
654
654
|
resourceType: { text: "文字资源", image: "图片资源", textImage: "文字+图片资源", physical: "馆藏" },
|
|
655
655
|
resourceTypeShort: { text: "文字", image: "图片", textImage: "文字+图片", physical: "馆藏" },
|
|
@@ -1324,6 +1324,13 @@ const V = u({
|
|
|
1324
1324
|
noVersionsFiltered: "當前篩選下沒有版本",
|
|
1325
1325
|
noVersions: "暫無版本著錄",
|
|
1326
1326
|
moreUnit: "種版本",
|
|
1327
|
+
groupCount: "{n} 本",
|
|
1328
|
+
groupImage: "{n} 有影印",
|
|
1329
|
+
groupUngrouped: "未分組",
|
|
1330
|
+
groupExpandAll: "全部展開",
|
|
1331
|
+
groupCollapseAll: "全部收起",
|
|
1332
|
+
groupMore: "顯示更多(還有 {n} 本)",
|
|
1333
|
+
relationWith: "{relation} {n}",
|
|
1327
1334
|
sameEditionCopies: "同版另藏 {n} 部:",
|
|
1328
1335
|
inferredEraNote: "部分年代據版本題名推斷,非著錄原文",
|
|
1329
1336
|
empty: "尚未著錄該作品的版本與書目收錄。",
|
|
@@ -1380,6 +1387,13 @@ const V = u({
|
|
|
1380
1387
|
noVersionsFiltered: "当前筛选下没有版本",
|
|
1381
1388
|
noVersions: "暂无版本著录",
|
|
1382
1389
|
moreUnit: "种版本",
|
|
1390
|
+
groupCount: "{n} 本",
|
|
1391
|
+
groupImage: "{n} 有影印",
|
|
1392
|
+
groupUngrouped: "未分组",
|
|
1393
|
+
groupExpandAll: "全部展开",
|
|
1394
|
+
groupCollapseAll: "全部收起",
|
|
1395
|
+
groupMore: "显示更多(还有 {n} 本)",
|
|
1396
|
+
relationWith: "{relation} {n}",
|
|
1383
1397
|
sameEditionCopies: "同版另藏 {n} 部:",
|
|
1384
1398
|
inferredEraNote: "部分年代据版本题名推断,非著录原文",
|
|
1385
1399
|
empty: "尚未著录该作品的版本与书目收录。",
|
|
@@ -2543,7 +2557,7 @@ function ne(e, o) {
|
|
|
2543
2557
|
const x = /* @__PURE__ */ new Map();
|
|
2544
2558
|
function h(e) {
|
|
2545
2559
|
let o = x.get(e);
|
|
2546
|
-
return o || (o = { ...e === "zh-Hans" ?
|
|
2560
|
+
return o || (o = { ...e === "zh-Hans" ? H : U, ...ae(e) }, x.set(e, o)), o;
|
|
2547
2561
|
}
|
|
2548
2562
|
function w(e, o) {
|
|
2549
2563
|
let t = e;
|
|
@@ -2609,9 +2623,9 @@ function Ae(e) {
|
|
|
2609
2623
|
return;
|
|
2610
2624
|
}
|
|
2611
2625
|
}
|
|
2612
|
-
const
|
|
2626
|
+
const C = { text: 0, image: 1, physical: 2 };
|
|
2613
2627
|
function de(e) {
|
|
2614
|
-
return e.length === 0 ? "physical" : [...e].sort((o, t) => (
|
|
2628
|
+
return e.length === 0 ? "physical" : [...e].sort((o, t) => (C[o] ?? 99) - (C[t] ?? 99)).join("+");
|
|
2615
2629
|
}
|
|
2616
2630
|
function Be(e) {
|
|
2617
2631
|
return e.includes("text") && e.includes("image") ? "text+image" : e[0] || "physical";
|
|
@@ -2629,13 +2643,13 @@ function Re(e) {
|
|
|
2629
2643
|
if (s.volumes && s.volumes.length > 0) continue;
|
|
2630
2644
|
const g = o(s.name);
|
|
2631
2645
|
if (!g) continue;
|
|
2632
|
-
const [v, A] = g,
|
|
2633
|
-
t.has(
|
|
2646
|
+
const [v, A] = g, f = `${v}|${de(L(s))}`;
|
|
2647
|
+
t.has(f) || t.set(f, {
|
|
2634
2648
|
base: { ...s, name: v, url: "", volumes: [] },
|
|
2635
2649
|
volumes: [],
|
|
2636
2650
|
indices: []
|
|
2637
2651
|
});
|
|
2638
|
-
const y = t.get(
|
|
2652
|
+
const y = t.get(f);
|
|
2639
2653
|
y.volumes.push({ volume: A, url: s.url || void 0, status: "found" }), y.indices.push(r);
|
|
2640
2654
|
}
|
|
2641
2655
|
const n = [], i = /* @__PURE__ */ new Set();
|
|
@@ -2670,7 +2684,7 @@ function be(e) {
|
|
|
2670
2684
|
const t = o.match(/^(\d+)/);
|
|
2671
2685
|
return t ? parseInt(t[1], 10) : void 0;
|
|
2672
2686
|
}
|
|
2673
|
-
function
|
|
2687
|
+
function me(e, o) {
|
|
2674
2688
|
try {
|
|
2675
2689
|
if (new URL(e).hostname.includes("wikimedia.org")) {
|
|
2676
2690
|
const n = e.match(/\/wiki\/File:(.+?)(?:#|$)/);
|
|
@@ -2687,18 +2701,18 @@ function fe(e, o) {
|
|
|
2687
2701
|
function Ne(e) {
|
|
2688
2702
|
if (!e.url) return;
|
|
2689
2703
|
const o = be(e.metadata);
|
|
2690
|
-
return o ?
|
|
2704
|
+
return o ? me(e.url, o) : e.url;
|
|
2691
2705
|
}
|
|
2692
2706
|
const _e = ({ title: e, onSave: o, onAskAI: t, extraButtons: n, children: i }) => {
|
|
2693
2707
|
const l = ie();
|
|
2694
|
-
return /* @__PURE__ */
|
|
2708
|
+
return /* @__PURE__ */ m("div", { style: {
|
|
2695
2709
|
background: a("bg"),
|
|
2696
2710
|
border: `1px solid ${a("widget-border")}`,
|
|
2697
2711
|
borderRadius: "4px",
|
|
2698
2712
|
padding: "16px",
|
|
2699
2713
|
marginBottom: "12px"
|
|
2700
2714
|
}, children: [
|
|
2701
|
-
/* @__PURE__ */
|
|
2715
|
+
/* @__PURE__ */ m("div", { style: {
|
|
2702
2716
|
display: "flex",
|
|
2703
2717
|
justifyContent: "space-between",
|
|
2704
2718
|
alignItems: "center",
|
|
@@ -2707,15 +2721,15 @@ const _e = ({ title: e, onSave: o, onAskAI: t, extraButtons: n, children: i }) =
|
|
|
2707
2721
|
borderBottom: `1px solid ${a("widget-border")}`
|
|
2708
2722
|
}, children: [
|
|
2709
2723
|
/* @__PURE__ */ p("div", { style: { fontSize: "14px", fontWeight: 600, color: a("fg") }, children: e }),
|
|
2710
|
-
/* @__PURE__ */
|
|
2724
|
+
/* @__PURE__ */ m("div", { style: { display: "flex", gap: "8px" }, children: [
|
|
2711
2725
|
n,
|
|
2712
2726
|
t && /* @__PURE__ */ p("button", { onClick: t, style: he, children: "AI" }),
|
|
2713
|
-
o && /* @__PURE__ */ p("button", { onClick: o, style:
|
|
2727
|
+
o && /* @__PURE__ */ p("button", { onClick: o, style: fe, children: l.action.save })
|
|
2714
2728
|
] })
|
|
2715
2729
|
] }),
|
|
2716
2730
|
i
|
|
2717
2731
|
] });
|
|
2718
|
-
},
|
|
2732
|
+
}, fe = {
|
|
2719
2733
|
padding: "4px 12px",
|
|
2720
2734
|
fontSize: "12px",
|
|
2721
2735
|
border: "none",
|
|
@@ -2731,7 +2745,7 @@ const _e = ({ title: e, onSave: o, onAskAI: t, extraButtons: n, children: i }) =
|
|
|
2731
2745
|
background: "transparent",
|
|
2732
2746
|
color: a("fg"),
|
|
2733
2747
|
cursor: "pointer"
|
|
2734
|
-
}, Ee = ({ label: e, value: o, onChange: t, placeholder: n, disabled: i }) => /* @__PURE__ */
|
|
2748
|
+
}, Ee = ({ label: e, value: o, onChange: t, placeholder: n, disabled: i }) => /* @__PURE__ */ m("div", { style: { marginBottom: "16px" }, children: [
|
|
2735
2749
|
/* @__PURE__ */ p("label", { style: {
|
|
2736
2750
|
display: "block",
|
|
2737
2751
|
fontSize: "11px",
|
|
@@ -2806,7 +2820,7 @@ export {
|
|
|
2806
2820
|
Ee as F,
|
|
2807
2821
|
M as L,
|
|
2808
2822
|
_e as S,
|
|
2809
|
-
|
|
2823
|
+
Ce as T,
|
|
2810
2824
|
Be as a,
|
|
2811
2825
|
a as b,
|
|
2812
2826
|
We as c,
|
|
@@ -2821,7 +2835,7 @@ export {
|
|
|
2821
2835
|
ne as l,
|
|
2822
2836
|
re as m,
|
|
2823
2837
|
be as n,
|
|
2824
|
-
|
|
2838
|
+
me as o,
|
|
2825
2839
|
z as p,
|
|
2826
2840
|
Y as q,
|
|
2827
2841
|
Ne as r,
|
|
@@ -2829,6 +2843,6 @@ export {
|
|
|
2829
2843
|
Ie as t,
|
|
2830
2844
|
ie as u,
|
|
2831
2845
|
Pe as v,
|
|
2832
|
-
|
|
2846
|
+
Se as w,
|
|
2833
2847
|
pe as x
|
|
2834
2848
|
};
|