@5even7/dlc-ui 0.2.4 → 0.2.6

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 CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  > **发版规则**:默认每次发布只递增补丁号(0.x.y → 0.x.(y+1),即 +0.01);除非手动明确指定新版本号,否则不升次版本。
4
4
 
5
+ ## 0.2.6 - 2026-08-09
6
+
7
+ - 修复:Vue wrapper 重建组件时因“插槽容器搬移”导致组件树损坏(子组件丢失、mouseColor 开关无效)的问题;插槽改回搬子节点。
8
+ - 胶囊 `mouseColor` 改为热切换(新增控制器 `setMouseColor()`,不再重建组件);进度条 `showValue` 改为热切换(新增 `setShowValue()`,数字元素始终存在、按需隐藏)。
9
+
10
+ ## 0.2.5 - 2026-08-08
11
+
12
+ - 修复:胶囊 `textRatio` 小于 164px(历史 `--hj-copy-min-width` 默认)时文字区不跟随缩小的 bug;现在 `textRatio` 是文字区宽度的唯一权威值,0~100 全范围生效。
13
+
5
14
  ## 0.2.4 - 2026-08-08
6
15
 
7
16
  - 移除 Progress `keyboard` 属性与键盘控制(拖动/受控 value 已覆盖主要场景)。
package/dist/capsule.cjs CHANGED
@@ -1184,8 +1184,9 @@ function createCapsule(container) {
1184
1184
  }
1185
1185
  if (merged.textRatio !== undefined) {
1186
1186
  root.style.setProperty('--hj-text-width', "".concat(merged.textRatio, "%"));
1187
- var userMinWidth = merged.cssVars && merged.cssVars['--hj-text-min-width'];
1188
- if (merged.textRatio === 0) root.style.setProperty('--hj-text-min-width', '0');else if (userMinWidth) root.style.setProperty('--hj-text-min-width', userMinWidth);else root.style.removeProperty('--hj-text-min-width');
1187
+ // textRatio 是文字区宽度的唯一权威值:min-width 会阻止其缩小到
1188
+ // 164px 以下(--hj-copy-min-width 的历史默认),这里强制归零。
1189
+ root.style.setProperty('--hj-text-min-width', '0');
1189
1190
  }
1190
1191
  renderer.resize();
1191
1192
  };
@@ -1309,8 +1310,7 @@ function createCapsule(container) {
1309
1310
  dirty.textRatio = true;
1310
1311
  merged.textRatio = value;
1311
1312
  root.style.setProperty('--hj-text-width', "".concat(value, "%"));
1312
- var userMinWidth = merged.cssVars && merged.cssVars['--hj-text-min-width'];
1313
- if (value === 0) root.style.setProperty('--hj-text-min-width', '0');else if (userMinWidth) root.style.setProperty('--hj-text-min-width', userMinWidth);else root.style.removeProperty('--hj-text-min-width');
1313
+ root.style.setProperty('--hj-text-min-width', '0');
1314
1314
  return this;
1315
1315
  },
1316
1316
  setCssVars: function setCssVars(vars) {
@@ -1328,6 +1328,11 @@ function createCapsule(container) {
1328
1328
  updateAria();
1329
1329
  return this;
1330
1330
  },
1331
+ setMouseColor: function setMouseColor(value) {
1332
+ merged.mouseColor = value !== false;
1333
+ if (typeof renderer.setMouseColor === 'function') renderer.setMouseColor(merged.mouseColor);
1334
+ return this;
1335
+ },
1331
1336
  setSize: function setSize(width, height) {
1332
1337
  if (width !== undefined) {
1333
1338
  parseSize(width); // 非法尺寸直接抛错前先校验,避免污染内部状态
package/dist/capsule.mjs CHANGED
@@ -974,10 +974,9 @@ function createCapsule(container, options = {}) {
974
974
  for (const name of Object.keys(vars)) root.style.setProperty(name, vars[name]);
975
975
  if (merged.textRatio !== undefined) {
976
976
  root.style.setProperty('--hj-text-width', `${merged.textRatio}%`);
977
- const userMinWidth = merged.cssVars && merged.cssVars['--hj-text-min-width'];
978
- if (merged.textRatio === 0) root.style.setProperty('--hj-text-min-width', '0');
979
- else if (userMinWidth) root.style.setProperty('--hj-text-min-width', userMinWidth);
980
- else root.style.removeProperty('--hj-text-min-width');
977
+ // textRatio 是文字区宽度的唯一权威值:min-width 会阻止其缩小到
978
+ // 164px 以下(--hj-copy-min-width 的历史默认),这里强制归零。
979
+ root.style.setProperty('--hj-text-min-width', '0');
981
980
  }
982
981
  renderer.resize();
983
982
  };
@@ -1076,10 +1075,7 @@ function createCapsule(container, options = {}) {
1076
1075
  dirty.textRatio = true;
1077
1076
  merged.textRatio = value;
1078
1077
  root.style.setProperty('--hj-text-width', `${value}%`);
1079
- const userMinWidth = merged.cssVars && merged.cssVars['--hj-text-min-width'];
1080
- if (value === 0) root.style.setProperty('--hj-text-min-width', '0');
1081
- else if (userMinWidth) root.style.setProperty('--hj-text-min-width', userMinWidth);
1082
- else root.style.removeProperty('--hj-text-min-width');
1078
+ root.style.setProperty('--hj-text-min-width', '0');
1083
1079
  return this;
1084
1080
  },
1085
1081
  setCssVars(vars) {
@@ -1094,6 +1090,11 @@ function createCapsule(container, options = {}) {
1094
1090
  updateAria();
1095
1091
  return this;
1096
1092
  },
1093
+ setMouseColor(value) {
1094
+ merged.mouseColor = value !== false;
1095
+ if (typeof renderer.setMouseColor === 'function') renderer.setMouseColor(merged.mouseColor);
1096
+ return this;
1097
+ },
1097
1098
  setSize(width, height) {
1098
1099
  if (width !== undefined) {
1099
1100
  parseSize(width); // 非法尺寸直接抛错前先校验,避免污染内部状态
package/dist/index.cjs CHANGED
@@ -1230,8 +1230,9 @@ function createCapsule(container) {
1230
1230
  }
1231
1231
  if (merged.textRatio !== undefined) {
1232
1232
  root.style.setProperty('--hj-text-width', "".concat(merged.textRatio, "%"));
1233
- var userMinWidth = merged.cssVars && merged.cssVars['--hj-text-min-width'];
1234
- if (merged.textRatio === 0) root.style.setProperty('--hj-text-min-width', '0');else if (userMinWidth) root.style.setProperty('--hj-text-min-width', userMinWidth);else root.style.removeProperty('--hj-text-min-width');
1233
+ // textRatio 是文字区宽度的唯一权威值:min-width 会阻止其缩小到
1234
+ // 164px 以下(--hj-copy-min-width 的历史默认),这里强制归零。
1235
+ root.style.setProperty('--hj-text-min-width', '0');
1235
1236
  }
1236
1237
  renderer.resize();
1237
1238
  };
@@ -1355,8 +1356,7 @@ function createCapsule(container) {
1355
1356
  dirty.textRatio = true;
1356
1357
  merged.textRatio = value;
1357
1358
  root.style.setProperty('--hj-text-width', "".concat(value, "%"));
1358
- var userMinWidth = merged.cssVars && merged.cssVars['--hj-text-min-width'];
1359
- if (value === 0) root.style.setProperty('--hj-text-min-width', '0');else if (userMinWidth) root.style.setProperty('--hj-text-min-width', userMinWidth);else root.style.removeProperty('--hj-text-min-width');
1359
+ root.style.setProperty('--hj-text-min-width', '0');
1360
1360
  return this;
1361
1361
  },
1362
1362
  setCssVars: function setCssVars(vars) {
@@ -1374,6 +1374,11 @@ function createCapsule(container) {
1374
1374
  updateAria();
1375
1375
  return this;
1376
1376
  },
1377
+ setMouseColor: function setMouseColor(value) {
1378
+ merged.mouseColor = value !== false;
1379
+ if (typeof renderer.setMouseColor === 'function') renderer.setMouseColor(merged.mouseColor);
1380
+ return this;
1381
+ },
1377
1382
  setSize: function setSize(width, height) {
1378
1383
  if (width !== undefined) {
1379
1384
  parseSize(width); // 非法尺寸直接抛错前先校验,避免污染内部状态
@@ -2006,6 +2011,12 @@ var ProgressCapsuleController = /*#__PURE__*/function () {
2006
2011
  this.root.setAttribute('aria-valuetext', "".concat(rounded).concat(this.valueSuffix));
2007
2012
  return this;
2008
2013
  }
2014
+ }, {
2015
+ key: "setShowValue",
2016
+ value: function setShowValue(show) {
2017
+ if (this.valueElement) this.valueElement.hidden = show === false;
2018
+ return this;
2019
+ }
2009
2020
  }, {
2010
2021
  key: "resizeCanvas",
2011
2022
  value: function resizeCanvas() {
@@ -2530,15 +2541,14 @@ function createProgressCapsule(container) {
2530
2541
  visualLayer.className = 'hj-progress-visual';
2531
2542
  fillContent(textLayer, options.text);
2532
2543
  fillContent(visualLayer, options.colorContent);
2533
- var valueElement = merged.showValue === false ? null : document.createElement('div');
2534
- if (valueElement) {
2535
- valueElement.className = 'hj-progress-value';
2536
- valueElement.setAttribute('aria-hidden', 'true');
2537
- }
2544
+ var valueElement = document.createElement('div');
2545
+ valueElement.className = 'hj-progress-value';
2546
+ valueElement.setAttribute('aria-hidden', 'true');
2547
+ valueElement.hidden = merged.showValue === false;
2538
2548
  root.appendChild(canvas);
2539
2549
  root.appendChild(textLayer);
2540
2550
  root.appendChild(visualLayer);
2541
- if (valueElement) root.appendChild(valueElement);
2551
+ root.appendChild(valueElement);
2542
2552
  container.appendChild(root);
2543
2553
  var emitter = createEmitter();
2544
2554
  var paused = merged.respectReducedMotion && prefersReducedMotion$1();
@@ -2711,6 +2721,10 @@ function createProgressCapsule(container) {
2711
2721
  controller.setValueSuffix(suffix);
2712
2722
  return this;
2713
2723
  },
2724
+ setShowValue: function setShowValue(show) {
2725
+ controller.setShowValue(show);
2726
+ return this;
2727
+ },
2714
2728
  setColors: function setColors(colors) {
2715
2729
  var next = Array.isArray(colors) ? colors.map(normalizeColor) : [];
2716
2730
  if (next.length !== 4 || next.some(function (color) {
package/dist/index.mjs CHANGED
@@ -1065,10 +1065,9 @@ function createCapsule(container, options = {}) {
1065
1065
  for (const name of Object.keys(vars)) root.style.setProperty(name, vars[name]);
1066
1066
  if (merged.textRatio !== undefined) {
1067
1067
  root.style.setProperty('--hj-text-width', `${merged.textRatio}%`);
1068
- const userMinWidth = merged.cssVars && merged.cssVars['--hj-text-min-width'];
1069
- if (merged.textRatio === 0) root.style.setProperty('--hj-text-min-width', '0');
1070
- else if (userMinWidth) root.style.setProperty('--hj-text-min-width', userMinWidth);
1071
- else root.style.removeProperty('--hj-text-min-width');
1068
+ // textRatio 是文字区宽度的唯一权威值:min-width 会阻止其缩小到
1069
+ // 164px 以下(--hj-copy-min-width 的历史默认),这里强制归零。
1070
+ root.style.setProperty('--hj-text-min-width', '0');
1072
1071
  }
1073
1072
  renderer.resize();
1074
1073
  };
@@ -1167,10 +1166,7 @@ function createCapsule(container, options = {}) {
1167
1166
  dirty.textRatio = true;
1168
1167
  merged.textRatio = value;
1169
1168
  root.style.setProperty('--hj-text-width', `${value}%`);
1170
- const userMinWidth = merged.cssVars && merged.cssVars['--hj-text-min-width'];
1171
- if (value === 0) root.style.setProperty('--hj-text-min-width', '0');
1172
- else if (userMinWidth) root.style.setProperty('--hj-text-min-width', userMinWidth);
1173
- else root.style.removeProperty('--hj-text-min-width');
1169
+ root.style.setProperty('--hj-text-min-width', '0');
1174
1170
  return this;
1175
1171
  },
1176
1172
  setCssVars(vars) {
@@ -1185,6 +1181,11 @@ function createCapsule(container, options = {}) {
1185
1181
  updateAria();
1186
1182
  return this;
1187
1183
  },
1184
+ setMouseColor(value) {
1185
+ merged.mouseColor = value !== false;
1186
+ if (typeof renderer.setMouseColor === 'function') renderer.setMouseColor(merged.mouseColor);
1187
+ return this;
1188
+ },
1188
1189
  setSize(width, height) {
1189
1190
  if (width !== undefined) {
1190
1191
  parseSize(width); // 非法尺寸直接抛错前先校验,避免污染内部状态
@@ -1984,6 +1985,11 @@ class ProgressCapsuleController {
1984
1985
  this.root.setAttribute('aria-valuetext', `${rounded}${this.valueSuffix}`);
1985
1986
  return this;
1986
1987
  }
1988
+
1989
+ setShowValue(show) {
1990
+ if (this.valueElement) this.valueElement.hidden = show === false;
1991
+ return this;
1992
+ }
1987
1993
 
1988
1994
  resizeCanvas() {
1989
1995
  const bounds = this.root.getBoundingClientRect();
@@ -2478,16 +2484,15 @@ function createProgressCapsule(container, options = {}) {
2478
2484
  fillContent(textLayer, options.text);
2479
2485
  fillContent(visualLayer, options.colorContent);
2480
2486
 
2481
- const valueElement = merged.showValue === false ? null : document.createElement('div');
2482
- if (valueElement) {
2483
- valueElement.className = 'hj-progress-value';
2484
- valueElement.setAttribute('aria-hidden', 'true');
2485
- }
2487
+ const valueElement = document.createElement('div');
2488
+ valueElement.className = 'hj-progress-value';
2489
+ valueElement.setAttribute('aria-hidden', 'true');
2490
+ valueElement.hidden = merged.showValue === false;
2486
2491
 
2487
2492
  root.appendChild(canvas);
2488
2493
  root.appendChild(textLayer);
2489
2494
  root.appendChild(visualLayer);
2490
- if (valueElement) root.appendChild(valueElement);
2495
+ root.appendChild(valueElement);
2491
2496
  container.appendChild(root);
2492
2497
 
2493
2498
  const emitter = createEmitter();
@@ -2643,6 +2648,10 @@ function createProgressCapsule(container, options = {}) {
2643
2648
  controller.setValueSuffix(suffix);
2644
2649
  return this;
2645
2650
  },
2651
+ setShowValue(show) {
2652
+ controller.setShowValue(show);
2653
+ return this;
2654
+ },
2646
2655
  setColors(colors) {
2647
2656
  const next = Array.isArray(colors) ? colors.map(normalizeColor) : [];
2648
2657
  if (next.length !== 4 || next.some((color) => !color)) return this;
package/dist/index.umd.js CHANGED
@@ -1234,8 +1234,9 @@
1234
1234
  }
1235
1235
  if (merged.textRatio !== undefined) {
1236
1236
  root.style.setProperty('--hj-text-width', "".concat(merged.textRatio, "%"));
1237
- var userMinWidth = merged.cssVars && merged.cssVars['--hj-text-min-width'];
1238
- if (merged.textRatio === 0) root.style.setProperty('--hj-text-min-width', '0');else if (userMinWidth) root.style.setProperty('--hj-text-min-width', userMinWidth);else root.style.removeProperty('--hj-text-min-width');
1237
+ // textRatio 是文字区宽度的唯一权威值:min-width 会阻止其缩小到
1238
+ // 164px 以下(--hj-copy-min-width 的历史默认),这里强制归零。
1239
+ root.style.setProperty('--hj-text-min-width', '0');
1239
1240
  }
1240
1241
  renderer.resize();
1241
1242
  };
@@ -1359,8 +1360,7 @@
1359
1360
  dirty.textRatio = true;
1360
1361
  merged.textRatio = value;
1361
1362
  root.style.setProperty('--hj-text-width', "".concat(value, "%"));
1362
- var userMinWidth = merged.cssVars && merged.cssVars['--hj-text-min-width'];
1363
- if (value === 0) root.style.setProperty('--hj-text-min-width', '0');else if (userMinWidth) root.style.setProperty('--hj-text-min-width', userMinWidth);else root.style.removeProperty('--hj-text-min-width');
1363
+ root.style.setProperty('--hj-text-min-width', '0');
1364
1364
  return this;
1365
1365
  },
1366
1366
  setCssVars: function setCssVars(vars) {
@@ -1378,6 +1378,11 @@
1378
1378
  updateAria();
1379
1379
  return this;
1380
1380
  },
1381
+ setMouseColor: function setMouseColor(value) {
1382
+ merged.mouseColor = value !== false;
1383
+ if (typeof renderer.setMouseColor === 'function') renderer.setMouseColor(merged.mouseColor);
1384
+ return this;
1385
+ },
1381
1386
  setSize: function setSize(width, height) {
1382
1387
  if (width !== undefined) {
1383
1388
  parseSize(width); // 非法尺寸直接抛错前先校验,避免污染内部状态
@@ -2010,6 +2015,12 @@
2010
2015
  this.root.setAttribute('aria-valuetext', "".concat(rounded).concat(this.valueSuffix));
2011
2016
  return this;
2012
2017
  }
2018
+ }, {
2019
+ key: "setShowValue",
2020
+ value: function setShowValue(show) {
2021
+ if (this.valueElement) this.valueElement.hidden = show === false;
2022
+ return this;
2023
+ }
2013
2024
  }, {
2014
2025
  key: "resizeCanvas",
2015
2026
  value: function resizeCanvas() {
@@ -2534,15 +2545,14 @@
2534
2545
  visualLayer.className = 'hj-progress-visual';
2535
2546
  fillContent(textLayer, options.text);
2536
2547
  fillContent(visualLayer, options.colorContent);
2537
- var valueElement = merged.showValue === false ? null : document.createElement('div');
2538
- if (valueElement) {
2539
- valueElement.className = 'hj-progress-value';
2540
- valueElement.setAttribute('aria-hidden', 'true');
2541
- }
2548
+ var valueElement = document.createElement('div');
2549
+ valueElement.className = 'hj-progress-value';
2550
+ valueElement.setAttribute('aria-hidden', 'true');
2551
+ valueElement.hidden = merged.showValue === false;
2542
2552
  root.appendChild(canvas);
2543
2553
  root.appendChild(textLayer);
2544
2554
  root.appendChild(visualLayer);
2545
- if (valueElement) root.appendChild(valueElement);
2555
+ root.appendChild(valueElement);
2546
2556
  container.appendChild(root);
2547
2557
  var emitter = createEmitter();
2548
2558
  var paused = merged.respectReducedMotion && prefersReducedMotion$1();
@@ -2715,6 +2725,10 @@
2715
2725
  controller.setValueSuffix(suffix);
2716
2726
  return this;
2717
2727
  },
2728
+ setShowValue: function setShowValue(show) {
2729
+ controller.setShowValue(show);
2730
+ return this;
2731
+ },
2718
2732
  setColors: function setColors(colors) {
2719
2733
  var next = Array.isArray(colors) ? colors.map(normalizeColor) : [];
2720
2734
  if (next.length !== 4 || next.some(function (color) {