dsh-m 0.9.57 → 0.9.58
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/CHANGELOG.md +12 -0
- package/lib/client.js +19 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,12 @@ The full release history of dsh-m, maintained bilingually: **Chinese first, Engl
|
|
|
8
8
|
|
|
9
9
|
## 中文
|
|
10
10
|
|
|
11
|
+
### 0.9.58 优化:+N 动态紧跟末可见分类,并与其框高一致
|
|
12
|
+
|
|
13
|
+
- **位置(`4ade54f`)**:在 0.9.57 的独立安全槽位中,根据末可见分类 chip 的实测右缘设置 `+N` 左缘 = 右缘 + 6px;槽位由 52px 扩为 60px,窄宽时仍不与分类或筛选重叠。精选区没有筛选时不额外预留筛选 gutter;展开态 `⌃` 仍位于列表尾部。
|
|
14
|
+
- **框高(`aeed14c`)**:`+N` 直接采用末可见分类的实测 border-box 高度,并以 inline-flex 居中数字,不再依赖西文数字与中文标签各自的浏览器自动行高。只改 `+N`,不改变分区 chip 的尺寸。
|
|
15
|
+
- **验证**:1224 项测试与 typecheck 全绿;用真实 DSH 目录数据在 880/700/520/420/320px 社区区测得两框同高 21px、顶边差 0、水平间距约 5–6px、相交面积 0;260px 精选区也无重叠,精选↔社区往返正常。
|
|
16
|
+
|
|
11
17
|
### 0.9.57 修复:精选切换后面板崩溃/无法重开 + 折叠筛选双框与 +N 重叠
|
|
12
18
|
|
|
13
19
|
- **根因(0.9.56 真机复现)**:精选区的标签对象可能每次父级重渲染都重建;layout effect 依赖 `chips` 数组引用及自身更新的 `geom`,同步测量反复进入、最终触发 React `Maximum update depth exceeded`(#185)。React 清空面板树但留下 `#dshm-panel-root`,旧入口守卫只检查容器存在,导致点击入口永久无效。叠加折叠筛选定位壳和按钮的双边框、以及 +N 位置夹取/文档流试验在窄宽下压住相邻 chip。
|
|
@@ -426,6 +432,12 @@ The full release history of dsh-m, maintained bilingually: **Chinese first, Engl
|
|
|
426
432
|
|
|
427
433
|
## English
|
|
428
434
|
|
|
435
|
+
### Improved in 0.9.58 — the +N toggle follows the last visible category at matching height
|
|
436
|
+
|
|
437
|
+
- **Position (`4ade54f`)**: within the 0.9.57 reserved, overlap-free slot, position `+N` from the measured right edge of the last visible category chip plus 6px. The slot grows from 52px to 60px to preserve clearance at narrow widths. Curated rows without a Filter trigger still reserve no unnecessary Filter gutter; expanded `⌃` remains at list end.
|
|
438
|
+
- **Equal height (`aeed14c`)**: use the last visible chip’s measured border-box height for `+N` and center its text with inline-flex, rather than letting Latin-only text and CJK category labels acquire different automatic line heights. Other chips keep their existing dimensions.
|
|
439
|
+
- **Verification**: 1224 tests and typecheck pass. Against the real DSH catalog, community layouts at 880/700/520/420/320px showed equal 21px boxes, 0px top-edge delta, roughly 5–6px horizontal separation, and zero overlap; the 260px curated layout had zero overlap and curated↔community switching remained stable.
|
|
440
|
+
|
|
429
441
|
### Fixed in 0.9.57 — curated-zone update loop, dead panel entry, and collapsed filter/overflow overlaps
|
|
430
442
|
|
|
431
443
|
- **Root cause (reproduced on 0.9.56)**: curated labels may get a fresh object on every parent render; the layout effect depended on the `chips` array identity and on its own `geom` update. Synchronous remeasurement repeatedly entered the same commit, eventually throwing React `Maximum update depth exceeded` (#185). React emptied the panel tree while leaving `#dshm-panel-root`; the old entry guard checked only for a container and silently blocked every later open. The pinned Filter wrapper also added a second border around its bordered button, while the clamped/inline `+N` iterations overlapped neighboring chips at narrow widths.
|
package/lib/client.js
CHANGED
|
@@ -2204,11 +2204,11 @@ var CSS = `
|
|
|
2204
2204
|
.dshm-chips{display:flex;flex-wrap:wrap;gap:6px;position:relative}
|
|
2205
2205
|
.dshm-chips-clip{overflow:hidden}
|
|
2206
2206
|
.dshm-chips-gutter{padding-right:var(--dshm-clip-gutter,96px)}
|
|
2207
|
-
/* +N/\u7B5B\u9009\u5206\u522B\u5360\u53F3\u4FA7
|
|
2208
|
-
.dshm-chips.dshm-chips-clip.dshm-chips-reserve{padding-right:
|
|
2209
|
-
.dshm-chips.dshm-chips-clip.dshm-chips-gutter.dshm-chips-reserve{padding-right:calc(var(--dshm-clip-gutter,96px) +
|
|
2207
|
+
/* +N/\u7B5B\u9009\u5206\u522B\u5360\u53F3\u4FA7 60/96px\uFF1B\u4FDD\u7559\u4F18\u5148\u7EA7\u9AD8\u4E8E\u5355\u72EC\u7684\u7B5B\u9009 gutter\u3002 */
|
|
2208
|
+
.dshm-chips.dshm-chips-clip.dshm-chips-reserve{padding-right:60px}
|
|
2209
|
+
.dshm-chips.dshm-chips-clip.dshm-chips-gutter.dshm-chips-reserve{padding-right:calc(var(--dshm-clip-gutter,96px) + 60px)}
|
|
2210
2210
|
.dsvm-chipmore{position:absolute;right:8px}
|
|
2211
|
-
.dsvm-chipmore-plus{position:absolute;
|
|
2211
|
+
.dsvm-chipmore-plus{position:absolute;z-index:1;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;background-color:var(--dsw-alias-bg-base,#fff);background-image:linear-gradient(var(--dsw-alias-bg-base,#fff),var(--dsw-alias-bg-base,#fff)),linear-gradient(var(--dsw-alias-bg-base,#fff),var(--dsw-alias-bg-base,#fff))}
|
|
2212
2212
|
.dsvm-searchrow{display:flex;align-items:center;gap:8px}
|
|
2213
2213
|
.dsvm-searchrow .dshm-search{flex:1;display:flex}
|
|
2214
2214
|
.dshm-search{position:relative}
|
|
@@ -2755,8 +2755,17 @@ function ZoneChips({ zone, counts, labels, active, onPick, trailing, wrapTitle }
|
|
|
2755
2755
|
const clipTopV = clipTopOf2(tops, maxRows);
|
|
2756
2756
|
const hiddenCount2 = countBeyondRows2(tops, maxRows);
|
|
2757
2757
|
const lastVisTop2 = visibleRowTop2(tops, maxRows);
|
|
2758
|
-
|
|
2759
|
-
|
|
2758
|
+
let lastVisRight = 0;
|
|
2759
|
+
let lastVisHeight = rh;
|
|
2760
|
+
for (const k of el.children) {
|
|
2761
|
+
if (!(k instanceof HTMLElement) || k.getAttribute("data-chip") !== "1") continue;
|
|
2762
|
+
if (k.offsetTop < clipTopV) {
|
|
2763
|
+
lastVisRight = k.offsetLeft + k.offsetWidth;
|
|
2764
|
+
lastVisHeight = k.offsetHeight;
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
const next = { tops, clipTop: clipTopV, hiddenCount: hiddenCount2, lastVisTop: lastVisTop2, lastVisRight, lastVisHeight };
|
|
2768
|
+
const same = prev && prev.hiddenCount === next.hiddenCount && prev.clipTop === next.clipTop && prev.lastVisTop === next.lastVisTop && prev.lastVisRight === next.lastVisRight && prev.lastVisHeight === next.lastVisHeight && prev.tops.length === next.tops.length && prev.tops.every((t, i) => t === next.tops[i]);
|
|
2760
2769
|
return same ? prev : next;
|
|
2761
2770
|
});
|
|
2762
2771
|
setRowHeight((prev) => Math.abs(prev - rh) <= 0.5 ? prev : rh);
|
|
@@ -2818,6 +2827,8 @@ function ZoneChips({ zone, counts, labels, active, onPick, trailing, wrapTitle }
|
|
|
2818
2827
|
const clipTop = geom ? geom.clipTop : Infinity;
|
|
2819
2828
|
const hiddenCount = geom ? geom.hiddenCount : 0;
|
|
2820
2829
|
const lastVisTop = geom ? geom.lastVisTop : 0;
|
|
2830
|
+
const moreLeft = geom ? geom.lastVisRight + 6 : 0;
|
|
2831
|
+
const moreHeight = geom ? geom.lastVisHeight : rowHeight || 22;
|
|
2821
2832
|
const btn = (c, i) => {
|
|
2822
2833
|
const top = geom ? geom.tops[i + 1] : null;
|
|
2823
2834
|
const clipped = clip && geom && typeof top === "number" && top >= clipTop;
|
|
@@ -2858,12 +2869,12 @@ function ZoneChips({ zone, counts, labels, active, onPick, trailing, wrapTitle }
|
|
|
2858
2869
|
...chips.map((c, i) => btn(c, i)),
|
|
2859
2870
|
// 折叠态 +N(0.9.57 终版):绝对定位钉在「末可见行右端预留槽」——出流不挤压 chip、不参与
|
|
2860
2871
|
// 行分组(data-more);预留槽由 .dshm-chips-clip 的 padding-right 划出,几何保证零重叠;
|
|
2861
|
-
//
|
|
2872
|
+
// 左缘动态紧贴末可见 chip 右侧 6px,仍受右侧预留槽保护;垂直对齐末可见行。
|
|
2862
2873
|
clip && geom && hiddenCount > 0 ? h("button", {
|
|
2863
2874
|
key: "more",
|
|
2864
2875
|
"data-more": "1",
|
|
2865
2876
|
className: "dshm-chip dsvm-chipmore-plus",
|
|
2866
|
-
style: { top: `${lastVisTop}px` },
|
|
2877
|
+
style: { top: `${lastVisTop}px`, left: `${moreLeft}px`, height: `${moreHeight}px` },
|
|
2867
2878
|
onClick: () => setExpanded(true)
|
|
2868
2879
|
}, `+${hiddenCount}`) : null,
|
|
2869
2880
|
expanded ? [
|