@@ -137,12 +137,25 @@ public HtmxResponse ReplaceUrl(string url)
137
137
return this ;
138
138
}
139
139
140
+ /// <summary>
141
+ /// Allows you to specify how the response will be swapped.
142
+ /// </summary>
143
+ /// <param name="modifier">The hx-swap attributes supports modifiers for changing the behavior of the swap.</param>
144
+ /// <returns>This <see cref="HtmxResponse"/> object instance.</returns>
145
+ public HtmxResponse Reswap ( string modifier )
146
+ {
147
+ headers [ HtmxResponseHeaderNames . Reswap ] = modifier ;
148
+
149
+ return this ;
150
+ }
151
+
140
152
/// <summary>
141
153
/// Allows you to specify how the response will be swapped.
142
154
/// </summary>
143
155
/// <param name="swapStyle"></param>
156
+ /// <param name="modifier">The hx-swap attributes supports modifiers for changing the behavior of the swap.</param>
144
157
/// <returns>This <see cref="HtmxResponse"/> object instance.</returns>
145
- public HtmxResponse Reswap ( SwapStyle swapStyle )
158
+ public HtmxResponse Reswap ( SwapStyle swapStyle , string ? modifier = null )
146
159
{
147
160
AssertIsHtmxRequest ( ) ;
148
161
@@ -159,11 +172,26 @@ public HtmxResponse Reswap(SwapStyle swapStyle)
159
172
_ => throw new SwitchExpressionException ( swapStyle ) ,
160
173
} ;
161
174
162
- headers [ HtmxResponseHeaderNames . Reswap ] = style ;
175
+ var value = modifier != null ? $ "{ style } { modifier } " : style ;
176
+
177
+ headers [ HtmxResponseHeaderNames . Reswap ] = value ;
163
178
164
179
return this ;
165
180
}
166
181
182
+ /// <summary>
183
+ /// Allows you to specify how the response will be swapped.
184
+ /// </summary>
185
+ /// <param></param>
186
+ /// <param name="swapStyle"></param>
187
+ /// <returns></returns>
188
+ public HtmxResponse Reswap ( SwapStyleBuilder swapStyle )
189
+ {
190
+ var ( style , modifier ) = swapStyle . Build ( ) ;
191
+
192
+ return style is null ? Reswap ( modifier ) : Reswap ( ( SwapStyle ) style , modifier ) ;
193
+ }
194
+
167
195
/// <summary>
168
196
/// A CSS selector that updates the target of the content update to a different element on the page.
169
197
/// </summary>
@@ -192,6 +220,17 @@ public HtmxResponse Reselect(string selector)
192
220
return this ;
193
221
}
194
222
223
+ /// <summary>
224
+ /// Sets response code to stop polling
225
+ /// </summary>
226
+ /// <returns></returns>
227
+ public HtmxResponse StopPolling ( )
228
+ {
229
+ context . Response . StatusCode = HtmxStatusCodes . StopPolling ;
230
+
231
+ return this ;
232
+ }
233
+
195
234
/// <summary>
196
235
/// Allows you to trigger client-side events.
197
236
/// </summary>
0 commit comments