From 7ee984cd9700e7b2a0ca703c3b0fdf2d2dce5e35 Mon Sep 17 00:00:00 2001
From: wangxu <1580265815@qq.com>
Date: Tue, 27 Oct 2026 15:04:16 +0800
Subject: [PATCH 1/2] =?UTF-8?q?fix(password-strength):=20=E4=BF=AE?=
=?UTF-8?q?=E5=A4=8D=E6=9C=AC=E5=9C=B0=E5=8C=96=E5=BC=BA=E5=BA=A6=E6=A0=87?=
=?UTF-8?q?=E7=AD=BE=E9=87=8D=E5=8F=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 将固定文字槽改为最小宽度,保留标签与强度条的间距
- 添加中英文及法文标签切换、窄宽布局与动效回归测试
- 同步三种语言的组件文档和令牌说明
---
.../Docs/TextFields/PasswordStrength/en-US.md | 2 +-
.../Docs/TextFields/PasswordStrength/zh-CN.md | 2 +-
.../Docs/TextFields/PasswordStrength/zh-TW.md | 2 +-
.../PasswordStrength/PasswordStrengthToken.cs | 2 +-
.../Themes/PasswordStrengthTheme.axaml | 2 +-
.../TextFields/PasswordStrengthTests.cs | 47 +++++++++++++++++++
6 files changed, 52 insertions(+), 5 deletions(-)
diff --git a/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/en-US.md b/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/en-US.md
index d4cd4156..73b97c8c 100644
--- a/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/en-US.md
+++ b/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/en-US.md
@@ -70,7 +70,7 @@ field. The caret, selection, undo, IME composition and clipboard shortcuts are t
copy under the frame. The error row swaps its whole message at once.
6. **Meter row**: 12 px below the field or its error row. Four equal segments, 4 px tall, with 5 px gaps, on a track in
the border color.
-7. **Strength word**: a 72 px slot at the end of the meter row, 12 px from the meter, right aligned, in the medium
+7. **Strength word**: a minimum 72 px slot that grows for localized labels at the end of the meter row, 12 px from the meter, right aligned, in the medium
weight of the small body size. It is empty while the field is empty.
8. **Requirement list** (`Rules`): 16 px below the meter, 6 px between rules. Each row has a 16 px circle that gains a
faint success tint and a tick when the rule is met, then the rule label. An unmet rule with a `Remaining` function
diff --git a/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/zh-CN.md b/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/zh-CN.md
index f256bb5a..00d28cbe 100644
--- a/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/zh-CN.md
+++ b/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/zh-CN.md
@@ -48,7 +48,7 @@ source-hash: 03a81b19e445
4. **显示切换按钮**:位于外框末端的 34 px 方形按钮,圆角 13 px,内含 18 px 的眼睛图标。按下时缩放至 94%;显示密码时,它会报告其开启状态。
5. **说明行与错误行**(`Description`、`ErrorMessage`):与 `Input` 共用的辅助行和错误行,位于外框下方,12 px 文案。错误行会整体替换其消息。
6. **强度计行**:位于字段或其错误行下方 12 px。四段等宽的 4 px 高色段,间隔 5 px,底色为边框颜色。
-7. **强度文字**:强度计行末端的 72 px 区域,与强度计相距 12 px,右对齐,使用小号正文的中等字重。字段为空时它也为空。
+7. **强度文字**:强度计行末端至少 72 px 的区域,随本地化文字增宽,与强度计相距 12 px,右对齐,使用小号正文的中等字重。字段为空时它也为空。
8. **规则列表**(`Rules`):位于强度计下方 16 px,规则之间间隔 6 px。每行有一个 16 px 的圆圈,规则满足时圆圈带淡淡的成功色并显示对勾,之后是规则文字。未满足且带有 `Remaining` 函数的规则,还会以弱化颜色显示滚动计数,例如“还差 4 个”。
### 强度等级
diff --git a/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/zh-TW.md b/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/zh-TW.md
index a2ab2aef..75a3255d 100644
--- a/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/zh-TW.md
+++ b/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/zh-TW.md
@@ -48,7 +48,7 @@ source-hash: 03a81b19e445
4. **顯示切換按鈕**:位於外框末端的 34 px 方形按鈕,圓角 13 px,內含 18 px 的眼睛圖示。按下時縮放至 94%;顯示密碼時,它會回報其開啟狀態。
5. **說明列與錯誤列**(`Description`、`ErrorMessage`):與 `Input` 共用的輔助列和錯誤列,位於外框下方,12 px 文案。錯誤列會整則替換其訊息。
6. **強度計列**:位於欄位或其錯誤列下方 12 px。四段等寬的 4 px 高色段,間隔 5 px,底色為邊框顏色。
-7. **強度文字**:強度計列末端的 72 px 區域,與強度計相距 12 px,靠右對齊,使用小號內文的中等字重。欄位為空時它也會是空的。
+7. **強度文字**:強度計列末端至少 72 px 的區域,隨本地化文字增寬,與強度計相距 12 px,靠右對齊,使用小號內文的中等字重。欄位為空時它也會是空的。
8. **規則清單**(`Rules`):位於強度計下方 16 px,規則之間間隔 6 px。每列有一個 16 px 的圓圈,規則符合時圓圈帶淡淡的成功色並顯示勾號,之後是規則文字。未符合且帶有 `Remaining` 函式的規則,還會以淡化顏色顯示滾動計數,例如「還差 4 個」。
### 強度等級
diff --git a/src/TKCode.Arc/TextFields/PasswordStrength/PasswordStrengthToken.cs b/src/TKCode.Arc/TextFields/PasswordStrength/PasswordStrengthToken.cs
index af04d8fc..de12f244 100644
--- a/src/TKCode.Arc/TextFields/PasswordStrength/PasswordStrengthToken.cs
+++ b/src/TKCode.Arc/TextFields/PasswordStrength/PasswordStrengthToken.cs
@@ -20,7 +20,7 @@ internal sealed class PasswordStrengthToken : AbstractControlDesignToken
public double SegmentHeight { get; set; }
public double SegmentGap { get; set; }
- /// The strength word's fixed slot: 4.5rem, 12px from the meter, 1.4em tall.
+ /// The strength word's minimum slot: 4.5rem, growing for localized labels, 12px from the meter, 1.4em tall.
public double WordWidth { get; set; }
public Thickness WordMargin { get; set; }
public double WordLineHeight { get; set; }
diff --git a/src/TKCode.Arc/TextFields/PasswordStrength/Themes/PasswordStrengthTheme.axaml b/src/TKCode.Arc/TextFields/PasswordStrength/Themes/PasswordStrengthTheme.axaml
index bd46188d..53acfab7 100644
--- a/src/TKCode.Arc/TextFields/PasswordStrength/Themes/PasswordStrengthTheme.axaml
+++ b/src/TKCode.Arc/TextFields/PasswordStrength/Themes/PasswordStrengthTheme.axaml
@@ -88,7 +88,7 @@
StrongTone="{arc:ArcDesignTokenResource Success}" />
().Single();
+ var meter = field.GetVisualDescendants().OfType().Single();
+ var drawing = new DrawingGroup();
+ using (var context = drawing.Open())
+ {
+ word.Render(context);
+ }
+ var bounds = drawing.GetBounds();
+ var textOrigin = word.TranslatePoint(default, window)!.Value;
+ var meterOrigin = meter.TranslatePoint(default, window)!.Value;
+ var fieldOrigin = field.TranslatePoint(default, window)!.Value;
+ (textOrigin.X + bounds.Left - meterOrigin.X - meter.Bounds.Width)
+ .ShouldBeGreaterThanOrEqualTo(11.5, label);
+ (textOrigin.X + bounds.Right).ShouldBeLessThanOrEqualTo(fieldOrigin.X + width + 0.5);
+ word.Bounds.Width.ShouldBeGreaterThanOrEqualTo(72);
+ meter.Bounds.Width.ShouldBeGreaterThan(0);
+ }
+ }
+ finally
+ {
+ window.Close();
+ }
+ }
+
[Theory]
[InlineData("", 0, false)]
[InlineData("Abc1!", 1, true)]
From 4f3ca7a7566e254725ff4508bd9cb6194cd77842 Mon Sep 17 00:00:00 2001
From: auimus
Date: Wed, 28 Oct 2026 16:50:52 +0800
Subject: [PATCH 2/2] test(password-strength): address maintainer feedback
Use Conforme for the French label so the existing 280/480 DIP and Full/Off
layout regression cases still exercise a label wider than 72 DIP without
exhausting the meter width in the headless font. Preserve all assertions
and the existing MinWidth implementation.
Clarify the English minimum-width description and regenerate both Chinese
source hashes with tools/docs/dochash.py. The final English hash is
1b9e076740df; 5ec2a501d220 was the hash before the wording improvement.
Validation on Windows (.NET SDK 11.0.100-rc.2.26504.105, runtime 10.0.14):
- Initial solution build succeeded (4 warnings, 0 errors).
- PasswordStrengthTests: 15 passed, including all 4 localized layout cases.
- GalleryDocsTests: 9 passed, including translation freshness; 1 failed
because local XML API documentation was not generated (GDOC008).
- Core tests: 139 passed.
- Final source hashes, unchanged test matrix/assertions, and diff checked.
Attempts to rebuild with GenerateDocumentationFile=true were blocked by
Avalonia AVLN9999 (missing TKCode.Arc.Mobile intermediate DLL), including
serial and fresh-intermediate builds. Full control-suite validation is
therefore limited; no project/configuration changes or unrelated CI fixes
are included.
---
.../Docs/TextFields/PasswordStrength/en-US.md | 4 ++--
.../Docs/TextFields/PasswordStrength/zh-CN.md | 2 +-
.../Docs/TextFields/PasswordStrength/zh-TW.md | 2 +-
tests/TKCode.Arc.Tests/TextFields/PasswordStrengthTests.cs | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/en-US.md b/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/en-US.md
index 73b97c8c..2be800b0 100644
--- a/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/en-US.md
+++ b/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/en-US.md
@@ -70,8 +70,8 @@ field. The caret, selection, undo, IME composition and clipboard shortcuts are t
copy under the frame. The error row swaps its whole message at once.
6. **Meter row**: 12 px below the field or its error row. Four equal segments, 4 px tall, with 5 px gaps, on a track in
the border color.
-7. **Strength word**: a minimum 72 px slot that grows for localized labels at the end of the meter row, 12 px from the meter, right aligned, in the medium
- weight of the small body size. It is empty while the field is empty.
+7. **Strength word**: At the end of the meter row, a slot at least 72 px wide that grows for localized labels,
+ 12 px from the meter, right aligned, in the medium weight of the small body size. It is empty while the field is empty.
8. **Requirement list** (`Rules`): 16 px below the meter, 6 px between rules. Each row has a 16 px circle that gains a
faint success tint and a tick when the rule is met, then the rule label. An unmet rule with a `Remaining` function
also shows a rolling count such as "4 more" in the muted color.
diff --git a/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/zh-CN.md b/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/zh-CN.md
index 00d28cbe..2bb906e5 100644
--- a/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/zh-CN.md
+++ b/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/zh-CN.md
@@ -1,7 +1,7 @@
---
title: 密码强度
summary: 在输入新密码时显示其强度。
-source-hash: 03a81b19e445
+source-hash: 1b9e076740df
---
diff --git a/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/zh-TW.md b/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/zh-TW.md
index 75a3255d..73ad8e50 100644
--- a/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/zh-TW.md
+++ b/gallery/TKCode.Arc.Gallery/Docs/TextFields/PasswordStrength/zh-TW.md
@@ -1,7 +1,7 @@
---
title: 密碼強度
summary: 在輸入新密碼時顯示其強度。
-source-hash: 03a81b19e445
+source-hash: 1b9e076740df
---
diff --git a/tests/TKCode.Arc.Tests/TextFields/PasswordStrengthTests.cs b/tests/TKCode.Arc.Tests/TextFields/PasswordStrengthTests.cs
index 26f69e72..825b7d78 100644
--- a/tests/TKCode.Arc.Tests/TextFields/PasswordStrengthTests.cs
+++ b/tests/TKCode.Arc.Tests/TextFields/PasswordStrengthTests.cs
@@ -22,7 +22,7 @@ public void Localized_Strength_Labels_Keep_Their_Gap_And_Fit_The_Field(int width
var window = TestHelpers.Show(field, level);
try
{
- foreach (var label in new[] { "Strong", "符合输入要求", "Exigences respectées", "Good" })
+ foreach (var label in new[] { "Strong", "符合输入要求", "Conforme", "Good" })
{
field.Messages = new PasswordStrengthMessages { Strong = label };
field.Text = "Correct-Horse-9";