@@ -249,7 +249,7 @@ export function create_field_proxy(target, get_input, depend, set_input, get_iss
249249 if ( prop === 'as' ) {
250250 /**
251251 * @param {string } type
252- * @param {string } [input_value]
252+ * @param {string | number | boolean } [input_value]
253253 */
254254 const as_func = ( type , input_value ) => {
255255 const is_array =
@@ -258,9 +258,9 @@ export function create_field_proxy(target, get_input, depend, set_input, get_iss
258258 ( type === 'checkbox' && typeof input_value === 'string' ) ;
259259
260260 const prefix =
261- type === 'number' || type === 'range'
261+ type === 'number' || type === 'range' || type === 'hidden number'
262262 ? 'n:'
263- : type === 'checkbox' && ! is_array
263+ : type === 'checkbox' && ! is_array || type === 'hidden boolean'
264264 ? 'b:'
265265 : '' ;
266266
@@ -292,6 +292,32 @@ export function create_field_proxy(target, get_input, depend, set_input, get_iss
292292 } ) ;
293293 }
294294
295+ // Handle hidden number inputs
296+ if ( type === 'hidden number' ) {
297+ if ( DEV ) {
298+ if ( typeof input_value !== 'number' ) {
299+ throw new Error ( `\`hidden number\` input must be a number value.` )
300+ }
301+ }
302+
303+ return Object . defineProperties ( base_props , {
304+ value : { value : input_value , enumerable : true }
305+ } ) ;
306+ }
307+
308+ // Handle hidden boolean inputs
309+ if ( type === 'hidden boolean' ) {
310+ if ( DEV ) {
311+ if ( typeof input_value !== 'boolean' ) {
312+ throw new Error ( `\`hidden boolean\` input must be a boolean value.` )
313+ }
314+ }
315+
316+ return Object . defineProperties ( base_props , {
317+ value : { value : input_value && 'on' , enumerable : true }
318+ } )
319+ }
320+
295321 // Handle select inputs
296322 if ( type === 'select' || type === 'select multiple' ) {
297323 return Object . defineProperties ( base_props , {
0 commit comments