@suifei/dsh-market-lens 0.27.0 → 0.28.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.
package/README.md CHANGED
@@ -6,6 +6,8 @@ A股 / 港股 / 美股的**只读**看盘·盯盘股票看板 DSH Web 插件—
6
6
  - 市场:A 股(沪/深/北)、港股、美股;指数、个股(板块视图在后续版本)。
7
7
  - 不做:下单、撤单、持仓盈亏、量化执行、任何写操作(连配置写回都没有)。
8
8
 
9
+ > npm 安装请认准 **0.27.1**:0.27.0 的宿主模块依赖在 link/精简 profile 下解析不到(loader 静默不挂载,无路由无入口),0.27.1 起 schemastery/dsh-tools 为真实依赖,link 与 npm 两条路径自足。
10
+
9
11
  ## 截图
10
12
 
11
13
  | 三列首页 · 暗色 | 证券大厅(灯阵总屏 · 紧凑档) | 三列首页 · 亮色 |
package/client.js CHANGED
@@ -382,7 +382,7 @@ window.__ModuleLoader__.load({
382
382
  }
383
383
 
384
384
  // ---------- diagnostic reporting (batched POST /market-lens/diag) ----------
385
- const CLIENT_REV = '0.27.0';
385
+ const CLIENT_REV = '0.28.0';
386
386
  const diagQueue = [];
387
387
  let diagTimer = 0;
388
388
  // the host meta tells the real level; until then assume the shipped 'errors' default
@@ -1992,9 +1992,9 @@ window.__ModuleLoader__.load({
1992
1992
  // 2D-game style pipeline: draw the page to an offscreen content canvas,
1993
1993
  // sample it into an n x m bulb grid (one bulb = one 4px cell, round with
1994
1994
  // a soft halo), bake to a bulb canvas, then a cheap rAF loop blits it and
1995
- // adds the living parts: a scan band, random bulb chatter, and page wipes
1996
- // that kill and re-light bulbs cell by cell. No libraries, ~1 blit + a
1997
- // few hundred tiny fills per frame at 24fps.
1995
+ // adds the living parts: a scan band and random bulb chatter. The rows window
1996
+ // itself scrolls one seamless LED row per step (no page wipes since 0.28).
1997
+ // No libraries, ~1 blit + a few hundred tiny fills per frame at ~9fps.
1998
1998
  const PITCH = 3.5; // css px per bulb cell inside the off-screen wall (3px bulb + 0.5px seam)
1999
1999
  const BULB = 3; // bulb footprint in wall px
2000
2000
  const PSZ = 4; // sprite sheet size (integer canvas)
@@ -2197,8 +2197,8 @@ window.__ModuleLoader__.load({
2197
2197
 
2198
2198
  /**
2199
2199
  * The hall itself: a fixed viewport of N quote rows (computed from the
2200
- * real height), rotating row by row; when a page is done a bulb wipe
2201
- * clears the screen and the next page lights up. The lit row expands the
2200
+ * real height), scrolling the whole tape up one seamless LED row per step; the
2201
+ * lit row expands the chart band, which never moves. Page wipes are gone:
2202
2202
  * chart strip; hover pauses and grabs, click returns to the desk.
2203
2203
  */
2204
2204
  // layout planner for the bulb wall: pure coordinates, shared by the
@@ -2349,7 +2349,7 @@ window.__ModuleLoader__.load({
2349
2349
  }
2350
2350
 
2351
2351
  function LedBoard({ rows, quotes, seenQuote, meta, onPick, getKline, ledUp, ledDown, tiny, t }) {
2352
- // fixed-spec wall: 1024 x 768 bulb cells live off-screen; layout
2352
+ // fixed-spec wall: 800 x 450 bulb cells live off-screen; layout
2353
2353
  // constants (ledPlan) sit on a 960-cell basis so this matrix shows
2354
2354
  // the full five-zone master board, and the baked picture is scaled
2355
2355
  // to fit whatever glass the host hands us.
@@ -2364,8 +2364,6 @@ window.__ModuleLoader__.load({
2364
2364
  const canvasRef = React.useRef(null);
2365
2365
  const contentRef = React.useRef(null);
2366
2366
  const sceneRef = React.useRef(null);
2367
- const transRef = React.useRef(null);
2368
- const pendingRef = React.useRef(null);
2369
2367
  const pitchRef = React.useRef(0);
2370
2368
  const topRef = React.useRef(0);
2371
2369
  const geoRef = React.useRef({ ox: 0, oy: 0, sc: 1 });
@@ -2375,15 +2373,18 @@ window.__ModuleLoader__.load({
2375
2373
  const pairIdxRef = React.useRef(0);
2376
2374
  const sceneSigRef = React.useRef('');
2377
2375
  const [size, setSize] = React.useState({ w: 0, h: 0 });
2378
- const [page, setPage] = React.useState(0);
2376
+ const [scrollRow, setScrollRow] = React.useState(0);
2379
2377
  const [lit, setLit] = React.useState(0);
2380
2378
  const [paused, setPaused] = React.useState(false);
2381
2379
  const [feedTick, setFeedTick] = React.useState(0);
2382
2380
  const HROWS = WALL_ROWS;
2383
- const pageSize = Math.max(2, Math.floor((HROWS - ROWS_TOP_C - CHART_C - FOOT_HC) / ROW_MIN_C));
2384
- const pages = Math.max(1, Math.ceil(rows.length / pageSize));
2385
- const start = Math.min(page * pageSize, Math.max(0, rows.length - pageSize));
2386
- const view = rows.slice(start, start + pageSize);
2381
+ // seamless scroll: the window always holds nWin rows cut from the doubled
2382
+ // watchlist tape; every rotation step advances the tape by exactly one LED
2383
+ // row and the last row wraps in as the next head; the chart band below
2384
+ // the rows never moves, and there are no pages and no bulb wipe anymore
2385
+ const winN = Math.max(2, Math.floor((HROWS - ROWS_TOP_C - CHART_C - FOOT_HC) / ROW_MIN_C));
2386
+ const nWin = rows.length === 0 ? 0 : Math.min(rows.length, winN);
2387
+ const view = nWin === 0 ? [] : [...rows, ...rows].slice(scrollRow % rows.length, scrollRow % rows.length + nWin);
2387
2388
  const ticker = (meta?.indexBar ?? []).map((symbol) => quotes.get(symbol) ?? seenQuote(symbol)).filter((q) => q !== void 0);
2388
2389
  const tape = ticker.length === 0 ? [] : [...ticker, ...ticker];
2389
2390
  const rowsKey = rows.map((row) => row.symbol).join(',');
@@ -2416,8 +2417,8 @@ window.__ModuleLoader__.load({
2416
2417
  // report the wall geometry, so live row/col counts and the display
2417
2418
  // scale can be read straight out of the diag log
2418
2419
  React.useEffect(() => {
2419
- diag('panel.led.geo', { wall: `${String(WALL_COLS)}x${String(WALL_ROWS)}`, pitch: PITCH, pageSize, disp: size.w === 0 ? 'pending' : `${String(size.w)}x${String(size.h)} @${(Math.min(size.w / WALL_W_PX, size.h / WALL_H_PX)).toFixed(3)}x` });
2420
- }, [pageSize, size]);
2420
+ diag('panel.led.geo', { wall: `${String(WALL_COLS)}x${String(WALL_ROWS)}`, pitch: PITCH, winRows: nWin, disp: size.w === 0 ? 'pending' : `${String(size.w)}x${String(size.h)} @${(Math.min(size.w / WALL_W_PX, size.h / WALL_H_PX)).toFixed(3)}x` });
2421
+ }, [nWin, size]);
2421
2422
  // one canvas pixel per css pixel, no devicePixelRatio games: the
2422
2423
  // browser never resamples the wall, so bulbs cannot shimmer or spill
2423
2424
  React.useEffect(() => {
@@ -2513,10 +2514,10 @@ window.__ModuleLoader__.load({
2513
2514
  } : null;
2514
2515
  const nowD = new Date();
2515
2516
  // skip the whole re-bake unless something the wall can show has
2516
- // actually moved: page, lit row, lattice mode, every number on
2517
+ // actually moved: scroll head, lit row, lattice mode, every number
2517
2518
  // screen, and the minute the clock prints
2518
2519
  const sig = [
2519
- String(page), String(lit), tiny === true ? "T" : "S",
2520
+ String(scrollRow), String(lit), tiny === true ? "T" : "S",
2520
2521
  view.map((r) => {
2521
2522
  const q = quotes.get(r.symbol) ?? seenQuote(r.symbol);
2522
2523
  return `${String(q?.price)}:${String(q?.changePct)}:${String(q?.high)}:${String(q?.low)}:${String(q?.prevClose)}:${String(q?.amount)}`;
@@ -2568,27 +2569,19 @@ window.__ModuleLoader__.load({
2568
2569
  diag("panel.led.bake", { ms: Math.round(performance.now() - t0), cells: WALL_COLS * WALL_ROWS });
2569
2570
  // atomic publish: the loop never sees a half-baked screen
2570
2571
  sceneRef.current = pair[pairIdxRef.current];
2571
- }, [size, view.length, page, lit, feedTick, tiny, quotes]);
2572
- // rotation: one row every four seconds; a finished page queues a wipe
2572
+ }, [size, view.length, scrollRow, lit, feedTick, tiny, quotes]);
2573
+ // rotation: the whole rows window advances one LED row every four seconds
2573
2574
  const rotRef = React.useRef(() => void 0);
2574
2575
  rotRef.current = () => {
2575
- if (paused === true || transRef.current !== null || view.length === 0) return;
2576
- if (lit + 1 < view.length) {
2577
- setLit(lit + 1);
2578
- return;
2579
- }
2580
- transRef.current = { phase: 'out', f: 0 };
2581
- pendingRef.current = () => {
2582
- setPage(start + pageSize >= rows.length ? 0 : (page + 1) % pages);
2583
- setLit(0);
2584
- };
2576
+ if (paused === true || rows.length < 2) return;
2577
+ setScrollRow((cur) => (cur + 1) % rows.length);
2585
2578
  };
2586
2579
  React.useEffect(() => {
2587
2580
  const timer = window.setInterval(() => rotRef.current(), 4000);
2588
2581
  return () => window.clearInterval(timer);
2589
2582
  }, []);
2590
- // the living screen: the 1024x768 wall lives off-screen at its native
2591
- // lattice (background, scene, wipe all in wall px); every frame blits
2583
+ // the living screen: the 800x450 wall lives off-screen at its native
2584
+ // lattice (background and scene in wall px); every frame blits
2592
2585
  // the two fixed-size layers proportionally scaled onto the container,
2593
2586
  // then cheap living detail on top, in display px
2594
2587
  React.useEffect(() => {
@@ -2605,9 +2598,8 @@ window.__ModuleLoader__.load({
2605
2598
  geoRef.current = { ox, oy, sc };
2606
2599
  x.imageSmoothingEnabled = true;
2607
2600
  x.imageSmoothingQuality = 'high';
2608
- // frame background: the off-bulb field, pattern-built once per page
2601
+ // frame background: the off-bulb field, pattern-built once per wall
2609
2602
  const bg = getWallBg();
2610
- const total = WALL_COLS * WALL_ROWS;
2611
2603
  const bulbPx = Math.max(1, Math.round(BULB * sc));
2612
2604
  const cellPx = Math.max(1, Math.round(PITCH * sc));
2613
2605
  let raf = 0;
@@ -2632,31 +2624,6 @@ window.__ModuleLoader__.load({
2632
2624
  x.fillStyle = k % 4 === 0 ? 'rgba(150,210,255,0.12)' : 'rgba(5,8,15,0.45)';
2633
2625
  x.fillRect(bxp + 1, byp + 1, 1, 1);
2634
2626
  }
2635
- const tr = transRef.current;
2636
- if (tr !== null) {
2637
- // a wipe flips a tenth of the wall's lamps per frame, capped
2638
- // so the 786k-cell matrix stays a few ms of fillRects
2639
- const n = Math.min(24000, Math.floor((total / 10) * 0.3));
2640
- if (tr.phase === 'out') {
2641
- tr.f++;
2642
- x.fillStyle = OFF_BG;
2643
- for (let k = 0; k < n; k++) x.fillRect(ox + Math.floor(Math.random() * WALL_COLS) * cellPx, oy + Math.floor(Math.random() * WALL_ROWS) * cellPx, bulbPx, bulbPx);
2644
- if (tr.f >= 10) {
2645
- transRef.current = { phase: 'in', f: 0 };
2646
- const commit = pendingRef.current;
2647
- pendingRef.current = null;
2648
- if (commit !== null) commit();
2649
- }
2650
- } else {
2651
- tr.f++;
2652
- for (let k = 0; k < n; k++) {
2653
- const sx = LPX(Math.floor(Math.random() * WALL_COLS) * PITCH);
2654
- const sy = LPX(Math.floor(Math.random() * WALL_ROWS) * PITCH);
2655
- x.drawImage(scene, sx, sy, BULB, BULB, ox + Math.round(sx * sc), oy + Math.round(sy * sc), bulbPx, bulbPx);
2656
- }
2657
- if (tr.f >= 10) transRef.current = null;
2658
- }
2659
- }
2660
2627
  };
2661
2628
  raf = window.requestAnimationFrame(step);
2662
2629
  return () => window.cancelAnimationFrame(raf);
@@ -2679,7 +2646,7 @@ window.__ModuleLoader__.load({
2679
2646
  const i = hit(event);
2680
2647
  if (i >= 0) {
2681
2648
  setPaused(true);
2682
- if (transRef.current === null) setLit(i);
2649
+ setLit(Math.min(i, nWin - 1));
2683
2650
  } else setPaused(false);
2684
2651
  },
2685
2652
  onMouseLeave: () => setPaused(false),
package/index.js CHANGED
@@ -167,7 +167,7 @@ export function apply(ctx, config) {
167
167
  service,
168
168
  diag,
169
169
  alerts,
170
- config: { ...config, version: '0.27.0' },
170
+ config: { ...config, version: '0.28.0' },
171
171
  });
172
172
 
173
173
  ctx.effect(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suifei/dsh-market-lens",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -40,11 +40,13 @@
40
40
  "scripts": {
41
41
  "test": "node --test test/"
42
42
  },
43
- "peerDependencies": {
44
- "@deepseek-ai/cordis": "~4.1.0",
43
+ "dependencies": {
45
44
  "@deepseek-ai/dsh-tools": "0.2.2-rc.1",
46
45
  "@deepseek-ai/schemastery": "~3.19.0"
47
46
  },
47
+ "peerDependencies": {
48
+ "@deepseek-ai/cordis": "~4.1.0"
49
+ },
48
50
  "dsh": {
49
51
  "bundle": {
50
52
  "patch": "./cordis.patch.yml"