dsh-cad-studio 0.27.0 → 0.27.2

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 (3) hide show
  1. package/README.md +1 -1
  2. package/client.js +16 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -113,7 +113,7 @@ npm 包:<https://www.npmjs.com/package/dsh-cad-studio>(`dsh plugin` / DSH
113
113
 
114
114
  ![装配与视口](https://raw.githubusercontent.com/STofone/dsh-cad-studio/main/docs/preview.png)
115
115
 
116
- **选中项**:视口点选 ↔ 列表联动;改色、显隐、透明度、隔离、线框、副本同透明度、重置。
116
+ **选中项**:视口点选 ↔ 列表联动;点颜色方块直接换色(色块旁显示当前 hex)、显隐、透明度、隔离、线框、副本同透明度、重置。
117
117
 
118
118
  ![选中项](https://raw.githubusercontent.com/STofone/dsh-cad-studio/main/docs/props.png)
119
119
 
package/client.js CHANGED
@@ -163,6 +163,12 @@ window.__ModuleLoader__.load({
163
163
  // twice is how the swatches once rendered pure white.
164
164
  swatch: (color) => ({ width: 10, height: 10, borderRadius: 2, flex: 'none', background: color }),
165
165
  swatchButton: { padding: 2, margin: 0, border: 0, background: 'transparent', cursor: 'pointer', display: 'inline-flex', borderRadius: 3, flex: 'none' },
166
+ swatchPick: {
167
+ padding: '2px 5px', margin: 0, border: '1px solid rgba(140,150,165,.34)', background: 'transparent',
168
+ cursor: 'pointer', display: 'inline-flex', alignItems: 'center', gap: 5, borderRadius: 4,
169
+ font: 'inherit', fontSize: 9.5, color: 'inherit', fontVariantNumeric: 'tabular-nums',
170
+ },
171
+ swatchHex: { opacity: 0.7, letterSpacing: '.02em' },
166
172
  eyeButton: { marginLeft: 'auto', padding: 2, border: 0, background: 'transparent', cursor: 'pointer', display: 'inline-flex', opacity: 0.85, flex: 'none' },
167
173
  colorPop: { position: 'absolute', top: '100%', left: 4, zIndex: 40, padding: 6, borderRadius: 6, border: '1px solid', boxShadow: '0 10px 26px rgba(0,0,0,.3)', display: 'flex', flexDirection: 'column', gap: 5 },
168
174
  colorRow: { display: 'grid', gridTemplateColumns: 'repeat(6, 14px)', gap: 4 },
@@ -2716,14 +2722,21 @@ const FILE_EXTS = ['step', 'stp', 'iges', 'igs', 'brep', 'stl']
2716
2722
  h('div', { key: 'sub', style: styles.propSub }, `${pickedInst.part}${pickedCopies > 1 ? ` · 共 ${pickedCopies} 个副本` : ''}${pickedTris ? ` · ${pickedTris.toLocaleString()} 三角面` : ''}${pickedSize ? ` · ${pickedSize} mm` : ''}`),
2717
2723
  h('div', { key: 'color', style: { ...styles.propRow, position: 'relative' } }, [
2718
2724
  h('span', { key: 'l', style: styles.propLabel }, '颜色'),
2719
- h('span', { key: 's', style: styles.swatch(pickedHex) }),
2725
+ // The swatch IS the button: a separate 「换色」按钮 was one click of
2726
+ // ceremony for something a colour chip already promises.
2720
2727
  h('button', {
2721
2728
  key: 'b',
2722
2729
  type: 'button',
2723
2730
  'data-cad-prop-color': pickedInst.name,
2724
- style: { ...styles.propBtn, marginLeft: 'auto' },
2731
+ 'data-cad-prop-swatch': pickedHex,
2732
+ style: { ...styles.swatchPick, marginLeft: 'auto' },
2733
+ title: '点这个色块换色',
2734
+ 'aria-label': `换色:${displayName(pickedInst.name, pickedInst.part)}(当前 ${pickedHex})`,
2725
2735
  onClick: () => setPropColorOpen((open) => !open),
2726
- }, '换色'),
2736
+ }, [
2737
+ h('span', { key: 's', style: { ...styles.swatch(pickedHex), width: 14, height: 14, borderRadius: 3, boxShadow: 'inset 0 0 0 1px rgba(16,24,40,.22)' } }),
2738
+ h('span', { key: 'h', style: styles.swatchHex }, pickedHex),
2739
+ ]),
2727
2740
  propColorOpen ? h(ColorPopover, {
2728
2741
  key: 'pop',
2729
2742
  theme,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-cad-studio",
3
- "version": "0.27.0",
3
+ "version": "0.27.2",
4
4
  "type": "module",
5
5
  "description": "CAD Studio — FreeCAD 桥(给 AI 的 14 个工具)+ Web 右栏 3D 面板:建模/装配/关节运动/出图/多页签查看",
6
6
  "exports": {