git-viewer 13.0.0 → 14.0.0

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.
Files changed (2) hide show
  1. package/dist/entry.bundled.js +25 -176
  2. package/package.json +1 -1
@@ -1615,7 +1615,6 @@ var AppStore = class extends TypedEventTarget {
1615
1615
  __publicField(this, "search", "");
1616
1616
  __publicField(this, "selectedCommit", null);
1617
1617
  __publicField(this, "fullscreenDiff", false);
1618
- __publicField(this, "theme", "light");
1619
1618
  }
1620
1619
  setRefs(refs) {
1621
1620
  this.refs = refs;
@@ -1629,15 +1628,6 @@ var AppStore = class extends TypedEventTarget {
1629
1628
  this.search = search;
1630
1629
  this.dispatchEvent(new Event("filter"));
1631
1630
  }
1632
- setTheme(theme) {
1633
- this.theme = theme;
1634
- try {
1635
- localStorage.setItem(THEME_STORAGE_KEY, theme);
1636
- } catch {
1637
- }
1638
- applyTheme(theme);
1639
- this.dispatchEvent(new Event("theme"));
1640
- }
1641
1631
  selectCommit(commit) {
1642
1632
  this.selectedCommit = commit;
1643
1633
  this.dispatchEvent(new Event("selectedCommit"));
@@ -1649,8 +1639,7 @@ var AppStore = class extends TypedEventTarget {
1649
1639
  });
1650
1640
  }
1651
1641
  };
1652
- var THEME_STORAGE_KEY = "git-viewer-theme";
1653
- var lightPalette = {
1642
+ var colors = {
1654
1643
  bg: "#ffffff",
1655
1644
  bgLight: "#f6f8fa",
1656
1645
  bgLighter: "#eaeef2",
@@ -1660,30 +1649,9 @@ var lightPalette = {
1660
1649
  accent: "#0969da",
1661
1650
  accentDim: "#ddf4ff",
1662
1651
  green: "#1a7f37",
1663
- red: "#cf222e",
1664
- diffAddBg: "#dafbe1",
1665
- diffDelBg: "#ffebe9",
1666
- diffAddText: "#116329",
1667
- diffDelText: "#a40e26"
1652
+ red: "#cf222e"
1668
1653
  };
1669
- var darkPalette = {
1670
- bg: "#0b0f14",
1671
- bgLight: "#111821",
1672
- bgLighter: "#1a2431",
1673
- border: "#283241",
1674
- text: "#e6edf3",
1675
- textMuted: "#9aa7b4",
1676
- accent: "#7aa2ff",
1677
- accentDim: "#0b1b33",
1678
- green: "#3fb950",
1679
- red: "#ff7b72",
1680
- diffAddBg: "#132a1f",
1681
- diffDelBg: "#2a1619",
1682
- diffAddText: "#7ee787",
1683
- diffDelText: "#ffa198"
1684
- };
1685
- var colors = lightPalette;
1686
- var graphColorsLight = [
1654
+ var graphColors = [
1687
1655
  "#0969da",
1688
1656
  // blue
1689
1657
  "#8250df",
@@ -1701,71 +1669,30 @@ var graphColorsLight = [
1701
1669
  "#0550ae"
1702
1670
  // dark blue
1703
1671
  ];
1704
- var graphColorsDark = [
1705
- "#7aa2ff",
1706
- // blue
1707
- "#b488ff",
1708
- // purple
1709
- "#ff8bd3",
1710
- // pink
1711
- "#ff7b72",
1712
- // red
1713
- "#f5b85b",
1714
- // orange
1715
- "#f2cc8f",
1716
- // amber
1717
- "#3fb950",
1718
- // green
1719
- "#5cc8ff"
1720
- // cyan
1721
- ];
1722
- var graphColors = graphColorsLight;
1723
- function loadTheme() {
1724
- try {
1725
- let stored = localStorage.getItem(THEME_STORAGE_KEY);
1726
- if (stored === "light" || stored === "dark") return stored;
1727
- } catch {
1728
- }
1729
- let media = window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)") : null;
1730
- return media && media.matches ? "dark" : "light";
1731
- }
1732
- function applyTheme(theme) {
1733
- document.documentElement.dataset.theme = theme;
1734
- document.documentElement.style.colorScheme = theme;
1735
- document.body.style.backgroundColor = theme === "dark" ? darkPalette.bg : lightPalette.bg;
1736
- }
1737
1672
  function App(handle) {
1738
1673
  let store = new AppStore();
1739
1674
  handle.context.set(store);
1740
- store.setTheme(loadTheme());
1741
- handle.on(store, {
1742
- theme: () => handle.update()
1743
- });
1744
1675
  handle.queueTask(async (signal) => {
1745
1676
  let refs = await fetchRefs(signal);
1746
1677
  store.setRefs(refs);
1747
1678
  });
1748
- return () => {
1749
- colors = store.theme === "dark" ? darkPalette : lightPalette;
1750
- graphColors = store.theme === "dark" ? graphColorsDark : graphColorsLight;
1751
- return /* @__PURE__ */ jsx(
1752
- "div",
1753
- {
1754
- css: {
1755
- display: "flex",
1756
- height: "100vh",
1757
- background: colors.bg,
1758
- color: colors.text,
1759
- fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
1760
- fontSize: "13px"
1761
- },
1762
- children: [
1763
- /* @__PURE__ */ jsx(Sidebar, {}),
1764
- /* @__PURE__ */ jsx(MainPanel, {})
1765
- ]
1766
- }
1767
- );
1768
- };
1679
+ return () => /* @__PURE__ */ jsx(
1680
+ "div",
1681
+ {
1682
+ css: {
1683
+ display: "flex",
1684
+ height: "100vh",
1685
+ background: colors.bg,
1686
+ color: colors.text,
1687
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
1688
+ fontSize: "13px"
1689
+ },
1690
+ children: [
1691
+ /* @__PURE__ */ jsx(Sidebar, {}),
1692
+ /* @__PURE__ */ jsx(MainPanel, {})
1693
+ ]
1694
+ }
1695
+ );
1769
1696
  }
1770
1697
  function Sidebar(handle) {
1771
1698
  let store = handle.context.get(App);
@@ -1988,7 +1915,6 @@ function CommitList(handle) {
1988
1915
  }
1989
1916
  ),
1990
1917
  /* @__PURE__ */ jsx("div", { css: { flex: 1 } }),
1991
- /* @__PURE__ */ jsx(ThemeToggle, {}),
1992
1918
  /* @__PURE__ */ jsx(
1993
1919
  "input",
1994
1920
  {
@@ -2065,68 +1991,6 @@ function CommitList(handle) {
2065
1991
  }
2066
1992
  );
2067
1993
  }
2068
- function ThemeToggle(handle) {
2069
- let store = handle.context.get(App);
2070
- handle.on(store, {
2071
- theme: () => handle.update()
2072
- });
2073
- return () => {
2074
- let isDark = store.theme === "dark";
2075
- return /* @__PURE__ */ jsx(
2076
- "button",
2077
- {
2078
- "aria-label": "Toggle theme",
2079
- title: isDark ? "Switch to light mode" : "Switch to dark mode",
2080
- css: {
2081
- display: "inline-flex",
2082
- alignItems: "center",
2083
- gap: "6px",
2084
- padding: "4px 10px",
2085
- border: `1px solid ${colors.border}`,
2086
- borderRadius: "999px",
2087
- background: colors.bg,
2088
- color: colors.text,
2089
- fontSize: "12px",
2090
- cursor: "pointer",
2091
- "&:hover": {
2092
- borderColor: colors.accent,
2093
- background: colors.bgLighter
2094
- }
2095
- },
2096
- on: { click: () => store.setTheme(isDark ? "light" : "dark") },
2097
- children: [
2098
- isDark ? /* @__PURE__ */ jsx(
2099
- "svg",
2100
- {
2101
- width: "14",
2102
- height: "14",
2103
- viewBox: "0 0 24 24",
2104
- fill: "none",
2105
- stroke: "currentColor",
2106
- "stroke-width": "2",
2107
- children: /* @__PURE__ */ jsx("path", { d: "M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z" })
2108
- }
2109
- ) : /* @__PURE__ */ jsx(
2110
- "svg",
2111
- {
2112
- width: "14",
2113
- height: "14",
2114
- viewBox: "0 0 24 24",
2115
- fill: "none",
2116
- stroke: "currentColor",
2117
- "stroke-width": "2",
2118
- children: [
2119
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "4" }),
2120
- /* @__PURE__ */ jsx("path", { d: "M12 2v2m0 16v2m10-10h-2M4 12H2m15.5-7.5-1.5 1.5M8 16l-1.5 1.5M16 16l1.5 1.5M8 8 6.5 6.5" })
2121
- ]
2122
- }
2123
- ),
2124
- /* @__PURE__ */ jsx("span", { children: isDark ? "Dark" : "Light" })
2125
- ]
2126
- }
2127
- );
2128
- };
2129
- }
2130
1994
  function FilterButton(handle) {
2131
1995
  let store = handle.context.get(App);
2132
1996
  handle.on(store, {
@@ -2491,7 +2355,6 @@ function DiffPanel(handle) {
2491
2355
  "section",
2492
2356
  {
2493
2357
  connect: (node) => diffContentRef = node,
2494
- class: store.theme === "dark" ? "d2h-dark-color-scheme" : "",
2495
2358
  css: {
2496
2359
  "& .d2h-wrapper": { background: "transparent" },
2497
2360
  "& .d2h-file-header": {
@@ -2503,30 +2366,16 @@ function DiffPanel(handle) {
2503
2366
  zIndex: 1
2504
2367
  },
2505
2368
  "& .d2h-file-name": { color: colors.text },
2506
- "& .d2h-code-line": {
2507
- padding: "0 8px",
2508
- background: colors.bg
2509
- },
2369
+ "& .d2h-code-line": { padding: "0 8px" },
2510
2370
  "& .d2h-code-line-ctn": { color: colors.text },
2511
- "& .d2h-ins": { background: colors.diffAddBg },
2512
- "& .d2h-del": { background: colors.diffDelBg },
2513
- "& .d2h-ins .d2h-code-line-ctn": {
2514
- color: colors.diffAddText
2515
- },
2516
- "& .d2h-del .d2h-code-line-ctn": {
2517
- color: colors.diffDelText
2518
- },
2371
+ "& .d2h-ins": { background: "#dafbe1" },
2372
+ "& .d2h-del": { background: "#ffebe9" },
2373
+ "& .d2h-ins .d2h-code-line-ctn": { color: colors.green },
2374
+ "& .d2h-del .d2h-code-line-ctn": { color: colors.red },
2519
2375
  "& .d2h-code-linenumber": {
2520
2376
  color: colors.textMuted,
2521
- background: colors.bgLight,
2522
2377
  borderRight: `1px solid ${colors.border}`
2523
2378
  },
2524
- "& .d2h-code-line-prefix": { color: colors.textMuted },
2525
- "& .d2h-emptyplaceholder": { background: colors.bgLight },
2526
- "& .d2h-info": {
2527
- background: colors.bgLight,
2528
- color: colors.textMuted
2529
- },
2530
2379
  "& .d2h-file-diff": {
2531
2380
  borderBottom: `1px solid ${colors.border}`
2532
2381
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-viewer",
3
- "version": "13.0.0",
3
+ "version": "14.0.0",
4
4
  "description": "Visual git log viewer with branch graph and diff display",
5
5
  "repository": {
6
6
  "type": "git",