@somecat/epub-reader 0.1.5 → 0.1.6

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/react.js CHANGED
@@ -257,6 +257,7 @@ var icons = {
257
257
  x: '<path d="M18 6L6 18M6 6l12 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',
258
258
  type: '<path d="M4 7V4h16v3M9 20h6M12 4v16" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',
259
259
  sliders: '<path d="M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',
260
+ progress: '<g transform="scale(0.0234375)"><path fill="currentColor" d="M835.79 610.26a25.38 25.38 0 1 1 0-50.77h129.77a25.38 25.38 0 0 1 0 50.77zM58.23 606.63a25.38 25.38 0 1 1 0-50.77h64.87a25.38 25.38 0 1 1 0 50.77z"/><path fill="currentColor" d="M479.73 264.12C627.34 264.12 747 383.78 747 531.39S627.34 798.66 479.73 798.66 212.46 679 212.46 531.39s119.66-267.27 267.27-267.27m0-46a312.43 312.43 0 1 0 122 24.64 311.35 311.35 0 0 0-122-24.64z"/></g>',
260
261
  settings: '<path fill="currentColor" fill-rule="evenodd" d="M12.563 3.2h-1.126l-.645 2.578l-.647.2a6.3 6.3 0 0 0-1.091.452l-.599.317l-2.28-1.368l-.796.797l1.368 2.28l-.317.598a6.3 6.3 0 0 0-.453 1.091l-.199.647l-2.578.645v1.126l2.578.645l.2.647q.173.568.452 1.091l.317.599l-1.368 2.28l.797.796l2.28-1.368l.598.317q.523.278 1.091.453l.647.199l.645 2.578h1.126l.645-2.578l.647-.2a6.3 6.3 0 0 0 1.091-.452l.599-.317l2.28 1.368l.796-.797l-1.368-2.28l.317-.598q.278-.523.453-1.091l.199-.647l2.578-.645v-1.126l-2.578-.645l-.2-.647a6.3 6.3 0 0 0-.452-1.091l-.317-.599l1.368-2.28l-.797-.796l-2.28 1.368l-.598-.317a6.3 6.3 0 0 0-1.091-.453l-.647-.199zm2.945 2.17l1.833-1.1a1 1 0 0 1 1.221.15l1.018 1.018a1 1 0 0 1 .15 1.221l-1.1 1.833q.33.62.54 1.3l2.073.519a1 1 0 0 1 .757.97v1.438a1 1 0 0 1-.757.97l-2.073.519q-.21.68-.54 1.3l1.1 1.833a1 1 0 0 1-.15 1.221l-1.018 1.018a1 1 0 0 1-1.221.15l-1.833-1.1q-.62.33-1.3.54l-.519 2.073a1 1 0 0 1-.97.757h-1.438a1 1 0 0 1-.97-.757l-.519-2.073a7.5 7.5 0 0 1-1.3-.54l-1.833 1.1a1 1 0 0 1-1.221-.15L4.42 18.562a1 1 0 0 1-.15-1.221l1.1-1.833a7.5 7.5 0 0 1-.54-1.3l-2.073-.519A1 1 0 0 1 2 12.72v-1.438a1 1 0 0 1 .757-.97l2.073-.519q.21-.68.54-1.3L4.27 6.66a1 1 0 0 1 .15-1.221L5.438 4.42a1 1 0 0 1 1.221-.15l1.833 1.1q.62-.33 1.3-.54l.519-2.073A1 1 0 0 1 11.28 2h1.438a1 1 0 0 1 .97.757l.519 2.073q.68.21 1.3.54zM12 14.8a2.8 2.8 0 1 0 0-5.6a2.8 2.8 0 0 0 0 5.6m0 1.2a4 4 0 1 1 0-8a4 4 0 0 1 0 8"/>'
261
262
  };
262
263
  var SvgIcon = ({ name, size = 24, color = "currentColor", className }) => {
@@ -509,7 +510,7 @@ var MobileUI = ({
509
510
  onTouchEnd: handleTouchEnd,
510
511
  onTouchCancel: handleTouchEnd,
511
512
  title: "\u8FDB\u5EA6",
512
- children: /* @__PURE__ */ jsx(SvgIcon, { name: "sliders" })
513
+ children: /* @__PURE__ */ jsx(SvgIcon, { name: "progress" })
513
514
  }
514
515
  ),
515
516
  /* @__PURE__ */ jsx(
@@ -579,7 +580,7 @@ var MobileUI = ({
579
580
  }
580
581
  }
581
582
  ),
582
- /* @__PURE__ */ jsx("button", { type: "button", className: "epub-reader__btn", onClick: () => onSearch(search.query), disabled: status !== "ready", children: "\u641C\u7D22" })
583
+ /* @__PURE__ */ jsx("button", { type: "button", className: "epub-reader__btn epub-reader__btn--wide", onClick: () => onSearch(search.query), disabled: status !== "ready", children: "\u641C\u7D22" })
583
584
  ] }),
584
585
  /* @__PURE__ */ jsxs("div", { className: "epub-reader__checks", children: [
585
586
  /* @__PURE__ */ jsxs("label", { className: "epub-reader__check", children: [
@@ -632,6 +633,39 @@ var MobileUI = ({
632
633
  /* @__PURE__ */ jsx("span", { className: "epub-reader__status", children: status === "error" ? errorText || "\u9519\u8BEF" : status === "opening" ? "\u6B63\u5728\u6253\u5F00\u2026" : "" }),
633
634
  sectionLabel ? /* @__PURE__ */ jsx("span", { children: sectionLabel }) : null
634
635
  ] }),
636
+ /* @__PURE__ */ jsxs("div", { className: "epub-reader__mprogress", children: [
637
+ /* @__PURE__ */ jsx(
638
+ "input",
639
+ {
640
+ className: "epub-reader__range",
641
+ type: "range",
642
+ min: 0,
643
+ max: 100,
644
+ step: 1,
645
+ value: displayedPercent,
646
+ style: {
647
+ background: `linear-gradient(to right, var(--epub-reader-range-fill) 0%, var(--epub-reader-range-fill) ${displayedPercent}%, var(--epub-reader-range-track) ${displayedPercent}%, var(--epub-reader-range-track) 100%)`
648
+ },
649
+ onChange: (e) => {
650
+ onSeekStart();
651
+ onSeekChange(Number(e.target.value));
652
+ },
653
+ onPointerUp: (e) => {
654
+ const v = Number(e.target.value);
655
+ onSeekEnd(v);
656
+ },
657
+ onKeyUp: (e) => {
658
+ if (e.key !== "Enter") return;
659
+ const v = Number(e.target.value);
660
+ onSeekCommit(v);
661
+ }
662
+ }
663
+ ),
664
+ /* @__PURE__ */ jsxs("div", { className: "epub-reader__mprogress-percent", children: [
665
+ displayedPercent,
666
+ "%"
667
+ ] })
668
+ ] }),
635
669
  /* @__PURE__ */ jsxs("div", { className: "epub-reader__mnav", children: [
636
670
  /* @__PURE__ */ jsx(
637
671
  "button",
@@ -685,36 +719,6 @@ var MobileUI = ({
685
719
  children: /* @__PURE__ */ jsx(SvgIcon, { name: "chevrons-right" })
686
720
  }
687
721
  )
688
- ] }),
689
- /* @__PURE__ */ jsxs("div", { className: "epub-reader__mprogress", children: [
690
- /* @__PURE__ */ jsx(
691
- "input",
692
- {
693
- className: "epub-reader__range",
694
- type: "range",
695
- min: 0,
696
- max: 100,
697
- step: 1,
698
- value: displayedPercent,
699
- onChange: (e) => {
700
- onSeekStart();
701
- onSeekChange(Number(e.target.value));
702
- },
703
- onPointerUp: (e) => {
704
- const v = Number(e.target.value);
705
- onSeekEnd(v);
706
- },
707
- onKeyUp: (e) => {
708
- if (e.key !== "Enter") return;
709
- const v = Number(e.target.value);
710
- onSeekCommit(v);
711
- }
712
- }
713
- ),
714
- /* @__PURE__ */ jsxs("div", { className: "epub-reader__mprogress-percent", children: [
715
- displayedPercent,
716
- "%"
717
- ] })
718
722
  ] })
719
723
  ] }) : null,
720
724
  activePanel === "settings" ? /* @__PURE__ */ jsxs("div", { className: "epub-reader__msettings", children: [
@@ -758,59 +762,61 @@ var MobileUI = ({
758
762
  ] }),
759
763
  /* @__PURE__ */ jsx("div", { className: "epub-reader__mfont-a is-big", children: "A" })
760
764
  ] }),
761
- /* @__PURE__ */ jsxs("div", { className: "epub-reader__msetting", children: [
762
- /* @__PURE__ */ jsxs("div", { className: "epub-reader__msetting-head", children: [
763
- /* @__PURE__ */ jsx("div", { className: "epub-reader__msetting-label", children: "\u884C\u9AD8" }),
764
- /* @__PURE__ */ jsx("div", { className: "epub-reader__msetting-value", children: lineHeight.toFixed(2) })
765
+ /* @__PURE__ */ jsxs("div", { className: "epub-reader__msettings-row", children: [
766
+ /* @__PURE__ */ jsxs("div", { className: "epub-reader__msetting", children: [
767
+ /* @__PURE__ */ jsxs("div", { className: "epub-reader__msetting-head", children: [
768
+ /* @__PURE__ */ jsx("div", { className: "epub-reader__msetting-label", children: "\u884C\u9AD8" }),
769
+ /* @__PURE__ */ jsx("div", { className: "epub-reader__msetting-value", children: lineHeight.toFixed(2) })
770
+ ] }),
771
+ /* @__PURE__ */ jsx(
772
+ "input",
773
+ {
774
+ className: "epub-reader__range",
775
+ type: "range",
776
+ min: 1,
777
+ max: 3,
778
+ step: 0.05,
779
+ value: lineHeight,
780
+ "aria-label": "\u884C\u9AD8",
781
+ onChange: (e) => onLineHeightChange(Number(e.target.value))
782
+ }
783
+ )
765
784
  ] }),
766
- /* @__PURE__ */ jsx(
767
- "input",
768
- {
769
- className: "epub-reader__range",
770
- type: "range",
771
- min: 1,
772
- max: 3,
773
- step: 0.05,
774
- value: lineHeight,
775
- "aria-label": "\u884C\u9AD8",
776
- onChange: (e) => onLineHeightChange(Number(e.target.value))
777
- }
778
- )
779
- ] }),
780
- /* @__PURE__ */ jsxs("div", { className: "epub-reader__msetting", children: [
781
- /* @__PURE__ */ jsxs("div", { className: "epub-reader__msetting-head", children: [
782
- /* @__PURE__ */ jsx("div", { className: "epub-reader__msetting-label", children: "\u5B57\u95F4\u8DDD" }),
783
- /* @__PURE__ */ jsxs("div", { className: "epub-reader__msetting-value", children: [
784
- letterSpacing.toFixed(2),
785
- "em"
786
- ] })
785
+ /* @__PURE__ */ jsxs("div", { className: "epub-reader__msetting", children: [
786
+ /* @__PURE__ */ jsxs("div", { className: "epub-reader__msetting-head", children: [
787
+ /* @__PURE__ */ jsx("div", { className: "epub-reader__msetting-label", children: "\u5B57\u95F4\u8DDD" }),
788
+ /* @__PURE__ */ jsxs("div", { className: "epub-reader__msetting-value", children: [
789
+ letterSpacing.toFixed(2),
790
+ "em"
791
+ ] })
792
+ ] }),
793
+ /* @__PURE__ */ jsx(
794
+ "input",
795
+ {
796
+ className: "epub-reader__range",
797
+ type: "range",
798
+ min: 0,
799
+ max: 0.3,
800
+ step: 0.01,
801
+ value: letterSpacing,
802
+ "aria-label": "\u5B57\u95F4\u8DDD",
803
+ onChange: (e) => onLetterSpacingChange(Number(e.target.value))
804
+ }
805
+ )
787
806
  ] }),
788
807
  /* @__PURE__ */ jsx(
789
- "input",
808
+ "button",
790
809
  {
791
- className: "epub-reader__range",
792
- type: "range",
793
- min: 0,
794
- max: 0.3,
795
- step: 0.01,
796
- value: letterSpacing,
797
- "aria-label": "\u5B57\u95F4\u8DDD",
798
- onChange: (e) => onLetterSpacingChange(Number(e.target.value))
810
+ type: "button",
811
+ className: "epub-reader__btn",
812
+ onClick: () => onToggleDarkMode(!darkMode),
813
+ "aria-pressed": darkMode,
814
+ "aria-label": darkMode ? "\u6697\u9ED1\u6A21\u5F0F\uFF1A\u5F00\uFF0C\u70B9\u51FB\u5207\u6362\u5230\u4EAE\u8272" : "\u6697\u9ED1\u6A21\u5F0F\uFF1A\u5173\uFF0C\u70B9\u51FB\u5207\u6362\u5230\u6697\u9ED1",
815
+ title: darkMode ? "\u5207\u6362\u5230\u4EAE\u8272" : "\u5207\u6362\u5230\u6697\u9ED1",
816
+ children: /* @__PURE__ */ jsx(SvgIcon, { name: darkMode ? "sun" : "moon" })
799
817
  }
800
818
  )
801
- ] }),
802
- /* @__PURE__ */ jsx(
803
- "button",
804
- {
805
- type: "button",
806
- className: "epub-reader__btn",
807
- onClick: () => onToggleDarkMode(!darkMode),
808
- "aria-pressed": darkMode,
809
- "aria-label": darkMode ? "\u6697\u9ED1\u6A21\u5F0F\uFF1A\u5F00\uFF0C\u70B9\u51FB\u5207\u6362\u5230\u4EAE\u8272" : "\u6697\u9ED1\u6A21\u5F0F\uFF1A\u5173\uFF0C\u70B9\u51FB\u5207\u6362\u5230\u6697\u9ED1",
810
- title: darkMode ? "\u5207\u6362\u5230\u4EAE\u8272" : "\u5207\u6362\u5230\u6697\u9ED1",
811
- children: /* @__PURE__ */ jsx(SvgIcon, { name: darkMode ? "sun" : "moon" })
812
- }
813
- )
819
+ ] })
814
820
  ] }) : null
815
821
  ] })
816
822
  ]