Skip to content

Commit 241c120

Browse files
refactor: normalize boolean modifier naming to bare adjectives
Rename IsTabStop() -> TabStop() and ShowAddButton() -> AddButtonVisible() to align with the DSL convention of bare adjective modifiers (Disabled, Editable, Selectable, etc.). Old names kept as [Obsolete] shims for backward compatibility. Migrate all internal usages and update reactor.api.txt. Fixes #268 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 09c9dd9 commit 241c120

10 files changed

Lines changed: 47 additions & 18 deletions

File tree

plugins/reactor/skills/reactor-dsl/references/reactor.api.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ T.HelpText<T>(string text) → T
340340
T.HierarchyLevel<T>(int level) → T
341341
T.Immediate<T>() → T
342342
T.InteractionStates<T>(Func<InteractionStatesBuilder, InteractionStatesBuilder> configure, Curve curve = null) → T
343-
T.IsTabStop<T>(bool isTabStop = true) → T
344343
T.ItemContainerTransitions<T>(Transition[] transitions) → T
345344
T.ItemStatus<T>(string status) → T
346345
T.Keyframes<T>(string name, object trigger, Func<KeyframeBuilder, KeyframeBuilder> configure) → T
@@ -426,6 +425,7 @@ T.SpringLayoutAnimation<T>(float dampingRatio = 0.6, float period = 0.08) → T
426425
T.Stagger<T>(TimeSpan delay, Curve curve = null) → T
427426
T.TabIndex<T>(int index) → T
428427
T.TabNavigation<T>(KeyboardNavigationMode mode) → T
428+
T.TabStop<T>(bool tabStop = true) → T
429429
T.ToolTip<T>(string tip) → T
430430
T.Transition<T>(Transition transition, Curve curve = null) → T
431431
T.Translation<T>(float x, float y, float z) → T
@@ -447,8 +447,8 @@ T.WithKey<T>(string key) → T
447447
T.WithToolTip<T>(Element tooltip) → T
448448
T.WithTransitions<T>(Transition[] transitions) → T
449449
T.XYFocusKeyboardNavigation<T>(XYFocusKeyboardNavigationMode mode) → T
450+
TabViewElement.AddButtonVisible(bool visible = true) → TabViewElement
450451
TabViewElement.Set(Action<TabView> configure) → TabViewElement
451-
TabViewElement.ShowAddButton(bool visible = true) → TabViewElement
452452
TeachingTipElement.Set(Action<TeachingTip> configure) → TeachingTipElement
453453
TemplatedFlipViewElement<T>.Set<T>(Action<FlipView> configure) → TemplatedFlipViewElement<T>
454454
TemplatedGridViewElement<T>.Set<T>(Action<GridView> configure) → TemplatedGridViewElement<T>

samples/ReactorCharting.Gallery/Samples/MultiLineChart.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private static Element BuildDataTable(string[] months, string[] seriesNames, dou
152152
return Grid(colDefs, rowDefs, allCells)
153153
.AutomationName("Temperature data table")
154154
.FullDescription("Data table showing monthly average temperatures in °C for New York, London, and Tokyo.")
155-
.IsTabStop(true)
155+
.TabStop(true)
156156
.MaxWidth(700);
157157
}
158158
}

skills/reactor.api.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ T.HelpText<T>(string text) → T
340340
T.HierarchyLevel<T>(int level) → T
341341
T.Immediate<T>() → T
342342
T.InteractionStates<T>(Func<InteractionStatesBuilder, InteractionStatesBuilder> configure, Curve curve = null) → T
343-
T.IsTabStop<T>(bool isTabStop = true) → T
344343
T.ItemContainerTransitions<T>(Transition[] transitions) → T
345344
T.ItemStatus<T>(string status) → T
346345
T.Keyframes<T>(string name, object trigger, Func<KeyframeBuilder, KeyframeBuilder> configure) → T
@@ -426,6 +425,7 @@ T.SpringLayoutAnimation<T>(float dampingRatio = 0.6, float period = 0.08) → T
426425
T.Stagger<T>(TimeSpan delay, Curve curve = null) → T
427426
T.TabIndex<T>(int index) → T
428427
T.TabNavigation<T>(KeyboardNavigationMode mode) → T
428+
T.TabStop<T>(bool tabStop = true) → T
429429
T.ToolTip<T>(string tip) → T
430430
T.Transition<T>(Transition transition, Curve curve = null) → T
431431
T.Translation<T>(float x, float y, float z) → T
@@ -447,8 +447,8 @@ T.WithKey<T>(string key) → T
447447
T.WithToolTip<T>(Element tooltip) → T
448448
T.WithTransitions<T>(Transition[] transitions) → T
449449
T.XYFocusKeyboardNavigation<T>(XYFocusKeyboardNavigationMode mode) → T
450+
TabViewElement.AddButtonVisible(bool visible = true) → TabViewElement
450451
TabViewElement.Set(Action<TabView> configure) → TabViewElement
451-
TabViewElement.ShowAddButton(bool visible = true) → TabViewElement
452452
TeachingTipElement.Set(Action<TeachingTip> configure) → TeachingTipElement
453453
TemplatedFlipViewElement<T>.Set<T>(Action<FlipView> configure) → TemplatedFlipViewElement<T>
454454
TemplatedGridViewElement<T>.Set<T>(Action<GridView> configure) → TemplatedGridViewElement<T>

src/Reactor/Charting/Accessibility/ChartAlternateViewWrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void HandleKeyDown(object sender, Microsoft.UI.Xaml.Input.KeyRoutedEventArgs e)
7272
.AccessibilityView(AccessibilityView.Content)
7373
.Width(1).Height(1)
7474
.Margin(-10000, 0, 0, 0)
75-
).IsTabStop(true).OnKeyDown(HandleKeyDown);
75+
).TabStop(true).OnKeyDown(HandleKeyDown);
7676
});
7777
}
7878

src/Reactor/Charting/Accessibility/ChartKeyboardNavigator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ void HandleKeyDown(object sender, Microsoft.UI.Xaml.Input.KeyRoutedEventArgs e)
244244

245245
// Wrap chart in a focusable Grid with the keyboard handler
246246
var wrappedChart = chartElement
247-
.IsTabStop(true)
247+
.TabStop(true)
248248
.OnKeyDown(HandleKeyDown);
249249

250250
if (focusOverlay is null)

src/Reactor/Controls/DataGrid/DataGridComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ void OnDataChanged()
389389
// fire. Without handledEventsToo, Tab never reaches the DataGrid when the
390390
// user presses Tab inside an editing TextBox.
391391
grid = grid
392-
.IsTabStop(true)
392+
.TabStop(true)
393393
.OnMount(fe =>
394394
{
395395
fe.AddHandler(

src/Reactor/Elements/ElementExtensions.cs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -865,9 +865,17 @@ public static GridViewElement SelectionMode(this GridViewElement el, ListViewSel
865865

866866
// ── TabView sugar ───────────────────────────────────────────────
867867

868-
public static TabViewElement ShowAddButton(this TabViewElement el, bool visible = true) =>
868+
/// <summary>
869+
/// Controls visibility of the "add tab" button in a TabView.
870+
/// </summary>
871+
public static TabViewElement AddButtonVisible(this TabViewElement el, bool visible = true) =>
869872
el with { IsAddTabButtonVisible = visible };
870873

874+
/// <inheritdoc cref="AddButtonVisible"/>
875+
[Obsolete("Use AddButtonVisible() — imperative 'Show*' naming is deprecated (see #268).")]
876+
public static TabViewElement ShowAddButton(this TabViewElement el, bool visible = true) =>
877+
el.AddButtonVisible(visible);
878+
871879
// ── Key ─────────────────────────────────────────────────────────
872880

873881
public static T WithKey<T>(this T el, string key) where T : Element =>
@@ -1404,9 +1412,14 @@ public static T HeadingLevel<T>(this T el, Microsoft.UI.Xaml.Automation.Peers.Au
14041412
/// Sets UIElement.IsTabStop — whether the element participates in Tab navigation.
14051413
/// Works on any element type (Panel, Control, etc.) in WinUI 3.
14061414
/// </summary>
1407-
/// <example>Border(content).IsTabStop(false)</example>
1415+
/// <example>Border(content).TabStop(false)</example>
1416+
public static T TabStop<T>(this T el, bool tabStop = true) where T : Element =>
1417+
Modify(el, new ElementModifiers { IsTabStop = tabStop });
1418+
1419+
/// <inheritdoc cref="TabStop{T}"/>
1420+
[Obsolete("Use TabStop() — 'Is*' prefix naming is deprecated for modifiers (see #268).")]
14081421
public static T IsTabStop<T>(this T el, bool isTabStop = true) where T : Element =>
1409-
Modify(el, new ElementModifiers { IsTabStop = isTabStop });
1422+
el.TabStop(isTabStop);
14101423

14111424
/// <summary>
14121425
/// Sets Control.TabIndex — Tab order position. Lower values receive focus first.

tests/Reactor.AppTests.Host/SelfTest/Fixtures/FocusFixtures.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public override async Task RunAsync()
3838
var host = H.CreateHost();
3939
host.Mount(ctx => VStack(
4040
TextField("a", _ => { }).Set(tb => tb.Name = "ts1"),
41-
TextField("b", _ => { }).Set(tb => tb.Name = "ts2").IsTabStop(false),
41+
TextField("b", _ => { }).Set(tb => tb.Name = "ts2").TabStop(false),
4242
TextField("c", _ => { }).Set(tb => tb.Name = "ts3")));
4343
await Harness.Render();
4444

tests/Reactor.Tests/ElementExtensionsCoverageTests.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,15 @@ public void ListView_GridView_SelectionMode()
378378
}
379379

380380
[Fact]
381-
public void TabView_ShowAddButton_Sugar()
381+
public void TabView_AddButtonVisible_Sugar()
382+
{
383+
var el = TabView([]).AddButtonVisible(false);
384+
Assert.False(el.IsAddTabButtonVisible);
385+
}
386+
387+
[Fact]
388+
[Obsolete("Tests the deprecated ShowAddButton shim")]
389+
public void TabView_ShowAddButton_Sugar_Obsolete_Shim()
382390
{
383391
var el = TabView([]).ShowAddButton(false);
384392
Assert.False(el.IsAddTabButtonVisible);
@@ -529,7 +537,7 @@ public void A11y_Tier1_Modifiers()
529537
{
530538
var el = Button("Y")
531539
.HeadingLevel(Microsoft.UI.Xaml.Automation.Peers.AutomationHeadingLevel.Level2)
532-
.IsTabStop(false)
540+
.TabStop(false)
533541
.TabIndex(3)
534542
.AccessKey("F");
535543
Assert.Equal(Microsoft.UI.Xaml.Automation.Peers.AutomationHeadingLevel.Level2, el.Modifiers!.HeadingLevel);

tests/Reactor.Tests/InputModifierExtensionsTests.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,19 +199,27 @@ public void ElementModifiers_Merge_Keeps_Left_When_Right_Null()
199199
// ── Phase 4 focus & keyboard modifiers (spec 027 Tier 5) ─────────
200200

201201
[Fact]
202-
public void IsTabStop_DefaultParam_IsTrue()
202+
public void TabStop_DefaultParam_IsTrue()
203203
{
204-
var el = TextBlock("x").IsTabStop();
204+
var el = TextBlock("x").TabStop();
205205
Assert.True(el.Modifiers!.IsTabStop);
206206
}
207207

208208
[Fact]
209-
public void IsTabStop_ExplicitFalse_Stores()
209+
public void TabStop_ExplicitFalse_Stores()
210210
{
211-
var el = TextBlock("x").IsTabStop(false);
211+
var el = TextBlock("x").TabStop(false);
212212
Assert.False(el.Modifiers!.IsTabStop);
213213
}
214214

215+
[Fact]
216+
[Obsolete("Tests the deprecated IsTabStop shim")]
217+
public void IsTabStop_Obsolete_Shim_StillWorks()
218+
{
219+
var el = TextBlock("x").IsTabStop();
220+
Assert.True(el.Modifiers!.IsTabStop);
221+
}
222+
215223
[Fact]
216224
public void TabIndex_Stores()
217225
{

0 commit comments

Comments
 (0)