1import { B as Block } from './Button-4603580c.js'; 2import { B as BlockTitle } from './BlockTitle-2f12d8c5.js'; 3import { S as Static } from './Index-1fd72dbe.js'; 4import './index-a4a7fd54.js'; 5import './svelte/svelte.js'; 6import './Info-71a6cb7e.js'; 7 8const Index_svelte_svelte_type_style_lang = ''; 9 10/* home/runner/work/gradio/gradio/js/number/Index.svelte generated by Svelte v4.2.2 */ 11const { 12 SvelteComponent, 13 append, 14 assign, 15 attr, 16 create_component, 17 destroy_component, 18 detach, 19 element, 20 get_spread_object, 21 get_spread_update, 22 init, 23 insert, 24 listen, 25 mount_component, 26 run_all, 27 safe_not_equal, 28 set_data, 29 set_input_value, 30 space, 31 text, 32 to_number, 33 toggle_class, 34 transition_in, 35 transition_out 36} = window.__gradio__svelte__internal;const { afterUpdate, tick } = window.__gradio__svelte__internal; 37function create_default_slot_1(ctx) { 38 let t; 39 40 return { 41 c() { 42 t = text(/*label*/ ctx[2]); 43 }, 44 m(target, anchor) { 45 insert(target, t, anchor); 46 }, 47 p(ctx, dirty) { 48 if (dirty & /*label*/ 4) set_data(t, /*label*/ ctx[2]); 49 }, 50 d(detaching) { 51 if (detaching) { 52 detach(t); 53 } 54 } 55 }; 56} 57 58// (43:0) <Block {visible} {elem_id} {elem_classes} padding={container} allow_overflow={false} {scale} {min_width} > 59function create_default_slot(ctx) { 60 let statustracker; 61 let t0; 62 let label_1; 63 let blocktitle; 64 let t1; 65 let input; 66 let current; 67 let mounted; 68 let dispose; 69 70 const statustracker_spread_levels = [ 71 { autoscroll: /*gradio*/ ctx[1].autoscroll }, 72 { i18n: /*gradio*/ ctx[1].i18n }, 73 /*loading_status*/ ctx[13] 74 ]; 75 76 let statustracker_props = {}; 77 78 for (let i = 0; i < statustracker_spread_levels.length; i += 1) { 79 statustracker_props = assign(statustracker_props, statustracker_spread_levels[i]); 80 } 81 82 statustracker = new Static({ props: statustracker_props }); 83 84 blocktitle = new BlockTitle({ 85 props: { 86 show_label: /*show_label*/ ctx[10], 87 info: /*info*/ ctx[3], 88 $$slots: { default: [create_default_slot_1] }, 89 $$scope: { ctx } 90 } 91 }); 92 93 return { 94 c() { 95 create_component(statustracker.$$.fragment); 96 t0 = space(); 97 label_1 = element("label"); 98 create_component(blocktitle.$$.fragment); 99 t1 = space(); 100 input = element("input"); 101 attr(input, "aria-label", /*label*/ ctx[2]); 102 attr(input, "type", "number"); 103 attr(input, "min", /*minimum*/ ctx[11]); 104 attr(input, "max", /*maximum*/ ctx[12]); 105 attr(input, "step", /*step*/ ctx[14]); 106 input.disabled = /*disabled*/ ctx[15]; 107 attr(input, "class", "svelte-pjtc3"); 108 attr(label_1, "class", "block svelte-pjtc3"); 109 toggle_class(label_1, "container", /*container*/ ctx[7]); 110 }, 111 m(target, anchor) { 112 mount_component(statustracker, target, anchor); 113 insert(target, t0, anchor); 114 insert(target, label_1, anchor); 115 mount_component(blocktitle, label_1, null); 116 append(label_1, t1); 117 append(label_1, input); 118 set_input_value(input, /*value*/ ctx[0]); 119 current = true; 120 121 if (!mounted) { 122 dispose = [ 123 listen(input, "input", /*input_input_handler*/ ctx[19]), 124 listen(input, "keypress", /*handle_keypress*/ ctx[16]), 125 listen(input, "blur", /*blur_handler*/ ctx[20]), 126 listen(input, "focus", /*focus_handler*/ ctx[21]) 127 ]; 128 129 mounted = true; 130 } 131 }, 132 p(ctx, dirty) { 133 const statustracker_changes = (dirty & /*gradio, loading_status*/ 8194) 134 ? get_spread_update(statustracker_spread_levels, [ 135 dirty & /*gradio*/ 2 && { autoscroll: /*gradio*/ ctx[1].autoscroll }, 136 dirty & /*gradio*/ 2 && { i18n: /*gradio*/ ctx[1].i18n }, 137 dirty & /*loading_status*/ 8192 && get_spread_object(/*loading_status*/ ctx[13]) 138 ]) 139 : {}; 140 141 statustracker.$set(statustracker_changes); 142 const blocktitle_changes = {}; 143 if (dirty & /*show_label*/ 1024) blocktitle_changes.show_label = /*show_label*/ ctx[10]; 144 if (dirty & /*info*/ 8) blocktitle_changes.info = /*info*/ ctx[3]; 145 146 if (dirty & /*$$scope, label*/ 8388612) { 147 blocktitle_changes.$$scope = { dirty, ctx }; 148 } 149 150 blocktitle.$set(blocktitle_changes); 151 152 if (!current || dirty & /*label*/ 4) { 153 attr(input, "aria-label", /*label*/ ctx[2]); 154 } 155 156 if (!current || dirty & /*minimum*/ 2048) { 157 attr(input, "min", /*minimum*/ ctx[11]); 158 } 159 160 if (!current || dirty & /*maximum*/ 4096) { 161 attr(input, "max", /*maximum*/ ctx[12]); 162 } 163 164 if (!current || dirty & /*step*/ 16384) { 165 attr(input, "step", /*step*/ ctx[14]); 166 } 167 168 if (!current || dirty & /*disabled*/ 32768) { 169 input.disabled = /*disabled*/ ctx[15]; 170 } 171
172 if (dirty & /*value*/ 1 && to_number(input.value) !== /*value*/ ctx[0]) { 173 set_input_value(input, /*value*/ ctx[0]); 174 } 175 176 if (!current || dirty & /*container*/ 128) { 177 toggle_class(label_1, "container", /*container*/ ctx[7]); 178 } 179 }, 180 i(local) { 181 if (current) return; 182 transition_in(statustracker.$$.fragment, local); 183 transition_in(blocktitle.$$.fragment, local); 184 current = true; 185 }, 186 o(local) { 187 transition_out(statustracker.$$.fragment, local); 188 transition_out(blocktitle.$$.fragment, local); 189 current = false; 190 }, 191 d(detaching) { 192 if (detaching) { 193 detach(t0); 194 detach(label_1); 195 } 196 197 destroy_component(statustracker, detaching); 198 destroy_component(blocktitle); 199 mounted = false; 200 run_all(dispose); 201 } 202 }; 203} 204 205function create_fragment(ctx) { 206 let block; 207 let current; 208 209 block = new Block({ 210 props: { 211 visible: /*visible*/ ctx[6], 212 elem_id: /*elem_id*/ ctx[4], 213 elem_classes: /*elem_classes*/ ctx[5], 214 padding: /*container*/ ctx[7], 215 allow_overflow: false, 216 scale: /*scale*/ ctx[8], 217 min_width: /*min_width*/ ctx[9], 218 $$slots: { default: [create_default_slot] }, 219 $$scope: { ctx } 220 } 221 }); 222 223 return { 224 c() { 225 create_component(block.$$.fragment); 226 }, 227 m(target, anchor) { 228 mount_component(block, target, anchor); 229 current = true; 230 }, 231 p(ctx, [dirty]) { 232 const block_changes = {}; 233 if (dirty & /*visible*/ 64) block_changes.visible = /*visible*/ ctx[6]; 234 if (dirty & /*elem_id*/ 16) block_changes.elem_id = /*elem_id*/ ctx[4]; 235 if (dirty & /*elem_classes*/ 32) block_changes.elem_classes = /*elem_classes*/ ctx[5]; 236 if (dirty & /*container*/ 128) block_changes.padding = /*container*/ ctx[7]; 237 if (dirty & /*scale*/ 256) block_changes.scale = /*scale*/ ctx[8]; 238 if (dirty & /*min_width*/ 512) block_changes.min_width = /*min_width*/ ctx[9]; 239 240 if (dirty & /*$$scope, container, label, minimum, maximum, step, disabled, value, gradio, show_label, info, loading_status*/ 8453263) { 241 block_changes.$$scope = { dirty, ctx }; 242 } 243 244 block.$set(block_changes); 245 }, 246 i(local) { 247 if (current) return; 248 transition_in(block.$$.fragment, local); 249 current = true; 250 }, 251 o(local) { 252 transition_out(block.$$.fragment, local); 253 current = false; 254 }, 255 d(detaching) { 256 destroy_component(block, detaching); 257 } 258 }; 259} 260 261function instance($$self, $$props, $$invalidate) { 262 let disabled; 263 let { gradio } = $$props; 264 let { label = gradio.i18n("number.number") } = $$props; 265 let { info = undefined } = $$props; 266 let { elem_id = "" } = $$props; 267 let { elem_classes = [] } = $$props; 268 let { visible = true } = $$props; 269 let { container = true } = $$props; 270 let { scale = null } = $$props; 271 let { min_width = undefined } = $$props; 272 let { value = 0 } = $$props; 273 let { show_label } = $$props; 274 let { minimum = undefined } = $$props; 275 let { maximum = undefined } = $$props; 276 let { loading_status } = $$props; 277 let { value_is_output = false } = $$props; 278 let { step = null } = $$props; 279 let { interactive } = $$props; 280 281 function handle_change() { 282 if (!isNaN(value) && value !== null) { 283 gradio.dispatch("change"); 284 285 if (!value_is_output) { 286 gradio.dispatch("input"); 287 } 288 } 289 } 290 291 afterUpdate(() => { 292 $$invalidate(17, value_is_output = false); 293 }); 294 295 async function handle_keypress(e) { 296 await tick(); 297 298 if (e.key === "Enter") { 299 e.preventDefault(); 300 gradio.dispatch("submit"); 301 } 302 } 303 304 function input_input_handler() { 305 value = to_number(this.value); 306 $$invalidate(0, value); 307 } 308 309 const blur_handler = () => gradio.dispatch("blur"); 310 const focus_handler = () => gradio.dispatch("focus"); 311 312 $$self.$$set = $$props => {
313 if ('gradio' in $$props) $$invalidate(1, gradio = $$props.gradio); 314 if ('label' in $$props) $$invalidate(2, label = $$props.label); 315 if ('info' in $$props) $$invalidate(3, info = $$props.info); 316 if ('elem_id' in $$props) $$invalidate(4, elem_id = $$props.elem_id); 317 if ('elem_classes' in $$props) $$invalidate(5, elem_classes = $$props.elem_classes); 318 if ('visible' in $$props) $$invalidate(6, visible = $$props.visible); 319 if ('container' in $$props) $$invalidate(7, container = $$props.container); 320 if ('scale' in $$props) $$invalidate(8, scale = $$props.scale); 321 if ('min_width' in $$props) $$invalidate(9, min_width = $$props.min_width); 322 if ('value' in $$props) $$invalidate(0, value = $$props.value); 323 if ('show_label' in $$props) $$invalidate(10, show_label = $$props.show_label); 324 if ('minimum' in $$props) $$invalidate(11, minimum = $$props.minimum); 325 if ('maximum' in $$props) $$invalidate(12, maximum = $$props.maximum); 326 if ('loading_status' in $$props) $$invalidate(13, loading_status = $$props.loading_status);
327 if ('value_is_output' in $$props) $$invalidate(17, value_is_output = $$props.value_is_output); 328 if ('step' in $$props) $$invalidate(14, step = $$props.step); 329 if ('interactive' in $$props) $$invalidate(18, interactive = $$props.interactive); 330 }; 331 332 $$self.$$.update = () => { 333 if ($$self.$$.dirty & /*value*/ 1) { 334 (handle_change()); 335 } 336 337 if ($$self.$$.dirty & /*interactive*/ 262144) { 338 $$invalidate(15, disabled = !interactive); 339 } 340 }; 341 342 return [ 343 value, 344 gradio, 345 label, 346 info, 347 elem_id, 348 elem_classes, 349 visible, 350 container, 351 scale, 352 min_width, 353 show_label, 354 minimum, 355 maximum, 356 loading_status, 357 step, 358 disabled, 359 handle_keypress, 360 value_is_output, 361 interactive, 362 input_input_handler, 363 blur_handler, 364 focus_handler 365 ]; 366} 367 368class Index extends SvelteComponent { 369 constructor(options) { 370 super(); 371 372 init(this, options, instance, create_fragment, safe_not_equal, { 373 gradio: 1, 374 label: 2, 375 info: 3, 376 elem_id: 4, 377 elem_classes: 5, 378 visible: 6, 379 container: 7, 380 scale: 8, 381 min_width: 9, 382 value: 0, 383 show_label: 10, 384 minimum: 11, 385 maximum: 12, 386 loading_status: 13, 387 value_is_output: 17, 388 step: 14, 389 interactive: 18 390 }); 391 } 392} 393 394export { Index as default }; 395//# sourceMappingURL=Index-e44e93e7.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.