dskcode 0.1.19 → 0.1.20

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/index.js CHANGED
@@ -5021,6 +5021,7 @@ function StockList({ codes, onExit, onBackToChat }) {
5021
5021
  const [currentTime, setCurrentTime] = useState7(
5022
5022
  () => (/* @__PURE__ */ new Date()).toLocaleTimeString("zh-CN", { hour12: false })
5023
5023
  );
5024
+ const [dimMode, setDimMode] = useState7(false);
5024
5025
  const { doubleCtrlC, handleCtrlC } = useDoubleCtrlC(onExit);
5025
5026
  useEffect6(() => {
5026
5027
  const timer = setInterval(() => {
@@ -5107,9 +5108,11 @@ function StockList({ codes, onExit, onBackToChat }) {
5107
5108
  } else if (input === "r") {
5108
5109
  setCountdown(5);
5109
5110
  loadData();
5111
+ } else if (input === "h") {
5112
+ setDimMode((v) => !v);
5110
5113
  }
5111
5114
  },
5112
- [stocks, selectedIndex, detailView, onExit, onBackToChat, loadData, handleCtrlC]
5115
+ [stocks, selectedIndex, detailView, onExit, onBackToChat, loadData, handleCtrlC, setDimMode]
5113
5116
  )
5114
5117
  );
5115
5118
  if (detailView) {
@@ -5118,9 +5121,10 @@ function StockList({ codes, onExit, onBackToChat }) {
5118
5121
  }
5119
5122
  return renderDetail(detailView, () => setDetailView(null), detailPrices ?? void 0, detailCountdown, currentTime);
5120
5123
  }
5124
+ const cp2 = (c) => dimMode ? { dimColor: true } : { color: c };
5121
5125
  return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
5122
5126
  /* @__PURE__ */ jsxs12(Box12, { marginBottom: 1, justifyContent: "space-between", children: [
5123
- /* @__PURE__ */ jsx12(Text13, { bold: true, color: "#00ffff", children: " \u{1F4C8} \u81EA\u9009\u80A1\u76D1\u63A7" }),
5127
+ /* @__PURE__ */ jsx12(Text13, { bold: true, ...cp2("#00ffff"), children: " \u{1F4C8} \u81EA\u9009\u80A1\u76D1\u63A7" }),
5124
5128
  /* @__PURE__ */ jsxs12(Text13, { dimColor: true, children: [
5125
5129
  " \u{1F550} ",
5126
5130
  currentTime
@@ -5144,30 +5148,30 @@ function StockList({ codes, onExit, onBackToChat }) {
5144
5148
  const isUp = stock.changePercent >= 0;
5145
5149
  const color = isUp ? "#ff1493" : "#00ff41";
5146
5150
  return /* @__PURE__ */ jsxs12(Box12, { children: [
5147
- /* @__PURE__ */ jsx12(Box12, { width: 3, flexShrink: 0, children: isSelected ? /* @__PURE__ */ jsx12(Text13, { bold: true, color: "#00ffff", children: "\u25B8 " }) : /* @__PURE__ */ jsx12(Text13, { children: " " }) }),
5148
- /* @__PURE__ */ jsx12(Box12, { width: 9, children: /* @__PURE__ */ jsx12(Text13, { bold: true, color: isSelected ? "#00ffff" : "#ffffff", children: stock.code }) }),
5149
- /* @__PURE__ */ jsx12(Box12, { width: 16, children: /* @__PURE__ */ jsx12(Text13, { color: isSelected ? "#ffffff" : "#cccccc", children: stock.name }) }),
5150
- /* @__PURE__ */ jsx12(Box12, { width: 12, children: /* @__PURE__ */ jsx12(Text13, { bold: true, color, children: formatPrice(stock.price) }) }),
5151
- /* @__PURE__ */ jsx12(Box12, { width: 12, children: /* @__PURE__ */ jsxs12(Text13, { color, children: [
5151
+ /* @__PURE__ */ jsx12(Box12, { width: 3, flexShrink: 0, children: isSelected ? /* @__PURE__ */ jsx12(Text13, { bold: true, ...cp2("#00ffff"), children: "\u25B8 " }) : /* @__PURE__ */ jsx12(Text13, { children: " " }) }),
5152
+ /* @__PURE__ */ jsx12(Box12, { width: 9, children: /* @__PURE__ */ jsx12(Text13, { bold: true, ...cp2(isSelected ? "#00ffff" : "#ffffff"), children: stock.code }) }),
5153
+ /* @__PURE__ */ jsx12(Box12, { width: 16, children: /* @__PURE__ */ jsx12(Text13, { ...cp2(isSelected ? "#ffffff" : "#cccccc"), children: stock.name }) }),
5154
+ /* @__PURE__ */ jsx12(Box12, { width: 12, children: /* @__PURE__ */ jsx12(Text13, { bold: true, ...cp2(color), children: formatPrice(stock.price) }) }),
5155
+ /* @__PURE__ */ jsx12(Box12, { width: 12, children: /* @__PURE__ */ jsxs12(Text13, { ...cp2(color), children: [
5152
5156
  isUp ? "+" : "",
5153
5157
  stock.changePercent.toFixed(2),
5154
5158
  "%"
5155
5159
  ] }) }),
5156
- /* @__PURE__ */ jsx12(Box12, { width: 12, children: /* @__PURE__ */ jsxs12(Text13, { color, children: [
5160
+ /* @__PURE__ */ jsx12(Box12, { width: 12, children: /* @__PURE__ */ jsxs12(Text13, { ...cp2(color), children: [
5157
5161
  isUp ? "+" : "",
5158
5162
  stock.changeAmount.toFixed(3)
5159
5163
  ] }) }),
5160
- /* @__PURE__ */ jsx12(Box12, { width: 12, children: /* @__PURE__ */ jsx12(Text13, { color: "#cccccc", children: formatPrice(stock.high) }) }),
5161
- /* @__PURE__ */ jsx12(Box12, { width: 12, children: /* @__PURE__ */ jsx12(Text13, { color: "#888888", children: formatPrice(stock.low) }) }),
5162
- /* @__PURE__ */ jsx12(Box12, { children: /* @__PURE__ */ jsx12(Text13, { color: "#888888", children: formatAmount(stock.amount) }) })
5164
+ /* @__PURE__ */ jsx12(Box12, { width: 12, children: /* @__PURE__ */ jsx12(Text13, { ...cp2("#cccccc"), children: formatPrice(stock.high) }) }),
5165
+ /* @__PURE__ */ jsx12(Box12, { width: 12, children: /* @__PURE__ */ jsx12(Text13, { ...cp2("#888888"), children: formatPrice(stock.low) }) }),
5166
+ /* @__PURE__ */ jsx12(Box12, { children: /* @__PURE__ */ jsx12(Text13, { ...cp2("#888888"), children: formatAmount(stock.amount) }) })
5163
5167
  ] }, stock.code);
5164
5168
  }) }),
5165
- /* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(Text13, { dimColor: true, children: ` \u2191/\u2193 \u9009\u62E9 Enter \u8BE6\u60C5 r \u624B\u52A8\u5237\u65B0 q \u8FD4\u56DE` }) }),
5169
+ /* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(Text13, { dimColor: true, children: ` \u2191/\u2193 \u9009\u62E9 Enter \u8BE6\u60C5 r \u624B\u52A8\u5237\u65B0 h \u7F6E\u7070/\u6062\u590D q \u8FD4\u56DE` }) }),
5166
5170
  /* @__PURE__ */ jsxs12(Box12, { children: [
5167
5171
  /* @__PURE__ */ jsx12(Text13, { dimColor: true, children: ` \u6700\u540E\u66F4\u65B0: ${lastUpdate} \u7F16\u8F91\u81EA\u9009\u80A1: ` }),
5168
- /* @__PURE__ */ jsx12(Text13, { color: "#c792ea", children: osc8Link(toFileUrl(SETTINGS_PATH), SETTINGS_PATH) })
5172
+ /* @__PURE__ */ jsx12(Text13, { ...cp2("#c792ea"), children: osc8Link(toFileUrl(SETTINGS_PATH), SETTINGS_PATH) })
5169
5173
  ] }),
5170
- doubleCtrlC && /* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(Text13, { color: "#ff1493", bold: true, children: " \u26A0 \u518D\u6309\u4E00\u6B21 Ctrl+C \u9000\u51FA dskcode" }) })
5174
+ doubleCtrlC && /* @__PURE__ */ jsx12(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx12(Text13, { bold: true, ...cp2("#ff1493"), children: " \u26A0 \u518D\u6309\u4E00\u6B21 Ctrl+C \u9000\u51FA dskcode" }) })
5171
5175
  ] });
5172
5176
  }
5173
5177
  function renderDetail(stock, _onBack, prices, countdown = 10, currentTime) {