1import { B as Block } from './Button-20c14f3f.js'; 2import { B as BlockTitle } from './BlockTitle-1fab1ef7.js'; 3import { S as Static } from './Index-34f70ab5.js'; 4export { default as BaseExample } from './Example-510d9c7e.js'; 5import './index-6d9f7a14.js'; 6import './svelte/svelte.js'; 7import './Info-222aa883.js'; 8 9const Colorpicker_svelte_svelte_type_style_lang = ''; 10 11/* home/runner/work/gradio/gradio/js/colorpicker/shared/Colorpicker.svelte generated by Svelte v4.2.2 */ 12const { 13 SvelteComponent: SvelteComponent$1, 14 append, 15 attr, 16 bubble, 17 create_component: create_component$1, 18 destroy_component: destroy_component$1, 19 detach: detach$1, 20 element, 21 init: init$1, 22 insert: insert$1, 23 listen, 24 mount_component: mount_component$1, 25 run_all, 26 safe_not_equal: safe_not_equal$1, 27 set_data, 28 set_input_value, 29 space: space$1, 30 text, 31 transition_in: transition_in$1, 32 transition_out: transition_out$1 33} = window.__gradio__svelte__internal; 34const { createEventDispatcher, afterUpdate } = window.__gradio__svelte__internal; 35function create_default_slot$1(ctx) { 36 let t; 37 38 return { 39 c() { 40 t = text(/*label*/ ctx[1]); 41 }, 42 m(target, anchor) { 43 insert$1(target, t, anchor); 44 }, 45 p(ctx, dirty) { 46 if (dirty & /*label*/ 2) set_data(t, /*label*/ ctx[1]); 47 }, 48 d(detaching) { 49 if (detaching) { 50 detach$1(t); 51 } 52 } 53 }; 54} 55 56function create_fragment$1(ctx) { 57 let label_1; 58 let blocktitle; 59 let t; 60 let input; 61 let current; 62 let mounted; 63 let dispose; 64 65 blocktitle = new BlockTitle({ 66 props: { 67 show_label: /*show_label*/ ctx[4], 68 info: /*info*/ ctx[2], 69 $$slots: { default: [create_default_slot$1] }, 70 $$scope: { ctx } 71 } 72 }); 73 74 return { 75 c() { 76 label_1 = element("label"); 77 create_component$1(blocktitle.$$.fragment); 78 t = space$1(); 79 input = element("input"); 80 attr(input, "type", "color"); 81 input.disabled = /*disabled*/ ctx[3]; 82 attr(input, "class", "svelte-56zyyb"); 83 attr(label_1, "class", "block"); 84 }, 85 m(target, anchor) { 86 insert$1(target, label_1, anchor); 87 mount_component$1(blocktitle, label_1, null); 88 append(label_1, t); 89 append(label_1, input); 90 set_input_value(input, /*value*/ ctx[0]); 91 current = true; 92 93 if (!mounted) { 94 dispose = [ 95 listen(input, "input", /*input_input_handler*/ ctx[8]), 96 listen(input, "focus", /*focus_handler*/ ctx[6]), 97 listen(input, "blur", /*blur_handler*/ ctx[7]) 98 ]; 99 100 mounted = true; 101 } 102 }, 103 p(ctx, [dirty]) { 104 const blocktitle_changes = {}; 105 if (dirty & /*show_label*/ 16) blocktitle_changes.show_label = /*show_label*/ ctx[4]; 106 if (dirty & /*info*/ 4) blocktitle_changes.info = /*info*/ ctx[2]; 107 108 if (dirty & /*$$scope, label*/ 2050) { 109 blocktitle_changes.$$scope = { dirty, ctx }; 110 } 111 112 blocktitle.$set(blocktitle_changes); 113 114 if (!current || dirty & /*disabled*/ 8) { 115 input.disabled = /*disabled*/ ctx[3]; 116 } 117 118 if (dirty & /*value*/ 1) { 119 set_input_value(input, /*value*/ ctx[0]); 120 } 121 }, 122 i(local) { 123 if (current) return; 124 transition_in$1(blocktitle.$$.fragment, local); 125 current = true; 126 }, 127 o(local) { 128 transition_out$1(blocktitle.$$.fragment, local); 129 current = false; 130 }, 131 d(detaching) { 132 if (detaching) { 133 detach$1(label_1); 134 } 135 136 destroy_component$1(blocktitle); 137 mounted = false; 138 run_all(dispose); 139 } 140 }; 141} 142 143function instance$1($$self, $$props, $$invalidate) { 144 let { value = "#000000" } = $$props; 145 let { value_is_output = false } = $$props; 146 let { label } = $$props; 147 let { info = undefined } = $$props; 148 let { disabled = false } = $$props; 149 let { show_label = true } = $$props; 150 const dispatch = createEventDispatcher(); 151 152 function handle_change() { 153 dispatch("change", value); 154 155 if (!value_is_output) { 156 dispatch("input"); 157 } 158 } 159 160 afterUpdate(() => { 161 $$invalidate(5, value_is_output = false); 162 }); 163 164 function focus_handler(event) { 165 bubble.call(this, $$self, event); 166 } 167 168 function blur_handler(event) { 169 bubble.call(this, $$self, event); 170 } 171 172 function input_input_handler() { 173 value = this.value; 174 $$invalidate(0, value); 175 } 176 177 $$self.$$set = $$props => {
178 if ('value' in $$props) $$invalidate(0, value = $$props.value); 179 if ('value_is_output' in $$props) $$invalidate(5, value_is_output = $$props.value_is_output); 180 if ('label' in $$props) $$invalidate(1, label = $$props.label); 181 if ('info' in $$props) $$invalidate(2, info = $$props.info); 182 if ('disabled' in $$props) $$invalidate(3, disabled = $$props.disabled); 183 if ('show_label' in $$props) $$invalidate(4, show_label = $$props.show_label); 184 }; 185 186 $$self.$$.update = () => { 187 if ($$self.$$.dirty & /*value*/ 1) { 188 (handle_change()); 189 } 190 }; 191 192 return [ 193 value, 194 label, 195 info, 196 disabled, 197 show_label, 198 value_is_output, 199 focus_handler, 200 blur_handler, 201 input_input_handler 202 ]; 203} 204 205class Colorpicker extends SvelteComponent$1 { 206 constructor(options) { 207 super(); 208 209 init$1(this, options, instance$1, create_fragment$1, safe_not_equal$1, { 210 value: 0, 211 value_is_output: 5, 212 label: 1, 213 info: 2, 214 disabled: 3, 215 show_label: 4 216 }); 217 } 218} 219 220const Colorpicker$1 = Colorpicker; 221 222/* home/runner/work/gradio/gradio/js/colorpicker/Index.svelte generated by Svelte v4.2.2 */ 223const { 224 SvelteComponent, 225 add_flush_callback, 226 assign, 227 bind, 228 binding_callbacks, 229 create_component, 230 destroy_component, 231 detach, 232 flush, 233 get_spread_object, 234 get_spread_update, 235 init, 236 insert, 237 mount_component, 238 safe_not_equal, 239 space, 240 transition_in, 241 transition_out 242} = window.__gradio__svelte__internal; 243function create_default_slot(ctx) { 244 let statustracker; 245 let t; 246 let colorpicker; 247 let updating_value; 248 let updating_value_is_output; 249 let current; 250 251 const statustracker_spread_levels = [ 252 { 253 autoscroll: /*gradio*/ ctx[12].autoscroll 254 }, 255 { i18n: /*gradio*/ ctx[12].i18n }, 256 /*loading_status*/ ctx[11] 257 ]; 258 259 let statustracker_props = {}; 260 261 for (let i = 0; i < statustracker_spread_levels.length; i += 1) { 262 statustracker_props = assign(statustracker_props, statustracker_spread_levels[i]); 263 } 264 265 statustracker = new Static({ props: statustracker_props }); 266 267 function colorpicker_value_binding(value) { 268 /*colorpicker_value_binding*/ ctx[14](value); 269 } 270 271 function colorpicker_value_is_output_binding(value) { 272 /*colorpicker_value_is_output_binding*/ ctx[15](value); 273 } 274 275 let colorpicker_props = { 276 label: /*label*/ ctx[2], 277 info: /*info*/ ctx[3], 278 show_label: /*show_label*/ ctx[7], 279 disabled: !/*interactive*/ ctx[13] 280 }; 281 282 if (/*value*/ ctx[0] !== void 0) { 283 colorpicker_props.value = /*value*/ ctx[0]; 284 } 285 286 if (/*value_is_output*/ ctx[1] !== void 0) { 287 colorpicker_props.value_is_output = /*value_is_output*/ ctx[1]; 288 } 289 290 colorpicker = new Colorpicker$1({ props: colorpicker_props }); 291 binding_callbacks.push(() => bind(colorpicker, 'value', colorpicker_value_binding)); 292 binding_callbacks.push(() => bind(colorpicker, 'value_is_output', colorpicker_value_is_output_binding)); 293 colorpicker.$on("change", /*change_handler*/ ctx[16]); 294 colorpicker.$on("input", /*input_handler*/ ctx[17]); 295 colorpicker.$on("submit", /*submit_handler*/ ctx[18]); 296 colorpicker.$on("blur", /*blur_handler*/ ctx[19]); 297 colorpicker.$on("focus", /*focus_handler*/ ctx[20]); 298 299 return { 300 c() { 301 create_component(statustracker.$$.fragment); 302 t = space(); 303 create_component(colorpicker.$$.fragment); 304 }, 305 m(target, anchor) { 306 mount_component(statustracker, target, anchor); 307 insert(target, t, anchor); 308 mount_component(colorpicker, target, anchor); 309 current = true; 310 }, 311 p(ctx, dirty) { 312 const statustracker_changes = (dirty & /*gradio, loading_status*/ 6144) 313 ? get_spread_update(statustracker_spread_levels, [ 314 dirty & /*gradio*/ 4096 && { 315 autoscroll: /*gradio*/ ctx[12].autoscroll 316 }, 317 dirty & /*gradio*/ 4096 && { i18n: /*gradio*/ ctx[12].i18n }, 318 dirty & /*loading_status*/ 2048 && get_spread_object(/*loading_status*/ ctx[11]) 319 ]) 320 : {}; 321 322 statustracker.$set(statustracker_changes); 323 const colorpicker_changes = {}; 324 if (dirty & /*label*/ 4) colorpicker_changes.label = /*label*/ ctx[2]; 325 if (dirty & /*info*/ 8) colorpicker_changes.info = /*info*/ ctx[3]; 326 if (dirty & /*show_label*/ 128) colorpicker_changes.show_label = /*show_label*/ ctx[7];
327 if (dirty & /*interactive*/ 8192) colorpicker_changes.disabled = !/*interactive*/ ctx[13]; 328 329 if (!updating_value && dirty & /*value*/ 1) { 330 updating_value = true; 331 colorpicker_changes.value = /*value*/ ctx[0]; 332 add_flush_callback(() => updating_value = false); 333 } 334 335 if (!updating_value_is_output && dirty & /*value_is_output*/ 2) { 336 updating_value_is_output = true; 337 colorpicker_changes.value_is_output = /*value_is_output*/ ctx[1]; 338 add_flush_callback(() => updating_value_is_output = false); 339 } 340 341 colorpicker.$set(colorpicker_changes); 342 }, 343 i(local) { 344 if (current) return; 345 transition_in(statustracker.$$.fragment, local); 346 transition_in(colorpicker.$$.fragment, local); 347 current = true; 348 }, 349 o(local) { 350 transition_out(statustracker.$$.fragment, local); 351 transition_out(colorpicker.$$.fragment, local); 352 current = false; 353 }, 354 d(detaching) { 355 if (detaching) { 356 detach(t); 357 } 358 359 destroy_component(statustracker, detaching); 360 destroy_component(colorpicker, detaching); 361 } 362 }; 363} 364 365function create_fragment(ctx) { 366 let block; 367 let current; 368 369 block = new Block({ 370 props: { 371 visible: /*visible*/ ctx[6], 372 elem_id: /*elem_id*/ ctx[4], 373 elem_classes: /*elem_classes*/ ctx[5], 374 container: /*container*/ ctx[8], 375 scale: /*scale*/ ctx[9], 376 min_width: /*min_width*/ ctx[10], 377 $$slots: { default: [create_default_slot] }, 378 $$scope: { ctx } 379 } 380 }); 381 382 return { 383 c() { 384 create_component(block.$$.fragment); 385 }, 386 m(target, anchor) { 387 mount_component(block, target, anchor); 388 current = true; 389 }, 390 p(ctx, [dirty]) { 391 const block_changes = {}; 392 if (dirty & /*visible*/ 64) block_changes.visible = /*visible*/ ctx[6]; 393 if (dirty & /*elem_id*/ 16) block_changes.elem_id = /*elem_id*/ ctx[4]; 394 if (dirty & /*elem_classes*/ 32) block_changes.elem_classes = /*elem_classes*/ ctx[5]; 395 if (dirty & /*container*/ 256) block_changes.container = /*container*/ ctx[8]; 396 if (dirty & /*scale*/ 512) block_changes.scale = /*scale*/ ctx[9]; 397 if (dirty & /*min_width*/ 1024) block_changes.min_width = /*min_width*/ ctx[10]; 398 399 if (dirty & /*$$scope, label, info, show_label, interactive, value, value_is_output, gradio, loading_status*/ 2111631) { 400 block_changes.$$scope = { dirty, ctx }; 401 } 402 403 block.$set(block_changes); 404 }, 405 i(local) { 406 if (current) return; 407 transition_in(block.$$.fragment, local); 408 current = true; 409 }, 410 o(local) { 411 transition_out(block.$$.fragment, local); 412 current = false; 413 }, 414 d(detaching) { 415 destroy_component(block, detaching); 416 } 417 }; 418} 419 420function instance($$self, $$props, $$invalidate) { 421 let { label = "ColorPicker" } = $$props; 422 let { info = undefined } = $$props; 423 let { elem_id = "" } = $$props; 424 let { elem_classes = [] } = $$props; 425 let { visible = true } = $$props; 426 let { value } = $$props; 427 let { value_is_output = false } = $$props; 428 let { show_label } = $$props; 429 let { container = true } = $$props; 430 let { scale = null } = $$props; 431 let { min_width = undefined } = $$props; 432 let { loading_status } = $$props; 433 let { gradio } = $$props; 434 let { interactive } = $$props; 435 436 function colorpicker_value_binding(value$1) { 437 value = value$1; 438 $$invalidate(0, value); 439 } 440 441 function colorpicker_value_is_output_binding(value) { 442 value_is_output = value; 443 $$invalidate(1, value_is_output); 444 } 445 446 const change_handler = () => gradio.dispatch("change"); 447 const input_handler = () => gradio.dispatch("input"); 448 const submit_handler = () => gradio.dispatch("submit"); 449 const blur_handler = () => gradio.dispatch("blur"); 450 const focus_handler = () => gradio.dispatch("focus"); 451 452 $$self.$$set = $$props => {
453 if ('label' in $$props) $$invalidate(2, label = $$props.label); 454 if ('info' in $$props) $$invalidate(3, info = $$props.info); 455 if ('elem_id' in $$props) $$invalidate(4, elem_id = $$props.elem_id); 456 if ('elem_classes' in $$props) $$invalidate(5, elem_classes = $$props.elem_classes); 457 if ('visible' in $$props) $$invalidate(6, visible = $$props.visible); 458 if ('value' in $$props) $$invalidate(0, value = $$props.value); 459 if ('value_is_output' in $$props) $$invalidate(1, value_is_output = $$props.value_is_output); 460 if ('show_label' in $$props) $$invalidate(7, show_label = $$props.show_label); 461 if ('container' in $$props) $$invalidate(8, container = $$props.container); 462 if ('scale' in $$props) $$invalidate(9, scale = $$props.scale); 463 if ('min_width' in $$props) $$invalidate(10, min_width = $$props.min_width); 464 if ('loading_status' in $$props) $$invalidate(11, loading_status = $$props.loading_status); 465 if ('gradio' in $$props) $$invalidate(12, gradio = $$props.gradio); 466 if ('interactive' in $$props) $$invalidate(13, interactive = $$props.interactive); 467 }; 468 469 return [ 470 value, 471 value_is_output, 472 label, 473 info, 474 elem_id, 475 elem_classes, 476 visible, 477 show_label, 478 container, 479 scale, 480 min_width, 481 loading_status, 482 gradio, 483 interactive, 484 colorpicker_value_binding, 485 colorpicker_value_is_output_binding, 486 change_handler, 487 input_handler, 488 submit_handler, 489 blur_handler, 490 focus_handler 491 ]; 492} 493 494class Index extends SvelteComponent { 495 constructor(options) { 496 super(); 497 498 init(this, options, instance, create_fragment, safe_not_equal, { 499 label: 2, 500 info: 3, 501 elem_id: 4, 502 elem_classes: 5, 503 visible: 6, 504 value: 0, 505 value_is_output: 1, 506 show_label: 7, 507 container: 8, 508 scale: 9, 509 min_width: 10, 510 loading_status: 11, 511 gradio: 12, 512 interactive: 13 513 }); 514 } 515 516 get label() { 517 return this.$$.ctx[2]; 518 } 519 520 set label(label) { 521 this.$$set({ label }); 522 flush(); 523 } 524 525 get info() { 526 return this.$$.ctx[3]; 527 } 528 529 set info(info) { 530 this.$$set({ info }); 531 flush(); 532 } 533 534 get elem_id() { 535 return this.$$.ctx[4]; 536 } 537 538 set elem_id(elem_id) { 539 this.$$set({ elem_id }); 540 flush(); 541 } 542 543 get elem_classes() { 544 return this.$$.ctx[5]; 545 } 546 547 set elem_classes(elem_classes) { 548 this.$$set({ elem_classes }); 549 flush(); 550 } 551 552 get visible() { 553 return this.$$.ctx[6]; 554 } 555 556 set visible(visible) { 557 this.$$set({ visible }); 558 flush(); 559 } 560 561 get value() { 562 return this.$$.ctx[0]; 563 } 564 565 set value(value) { 566 this.$$set({ value }); 567 flush(); 568 } 569 570 get value_is_output() { 571 return this.$$.ctx[1]; 572 } 573 574 set value_is_output(value_is_output) { 575 this.$$set({ value_is_output }); 576 flush(); 577 } 578 579 get show_label() { 580 return this.$$.ctx[7]; 581 } 582 583 set show_label(show_label) { 584 this.$$set({ show_label }); 585 flush(); 586 } 587 588 get container() { 589 return this.$$.ctx[8]; 590 } 591 592 set container(container) { 593 this.$$set({ container }); 594 flush(); 595 } 596 597 get scale() { 598 return this.$$.ctx[9]; 599 } 600 601 set scale(scale) { 602 this.$$set({ scale }); 603 flush(); 604 } 605 606 get min_width() { 607 return this.$$.ctx[10]; 608 } 609 610 set min_width(min_width) { 611 this.$$set({ min_width }); 612 flush(); 613 } 614 615 get loading_status() { 616 return this.$$.ctx[11]; 617 } 618 619 set loading_status(loading_status) { 620 this.$$set({ loading_status }); 621 flush(); 622 } 623 624 get gradio() { 625 return this.$$.ctx[12]; 626 } 627 628 set gradio(gradio) { 629 this.$$set({ gradio }); 630 flush(); 631 } 632 633 get interactive() { 634 return this.$$.ctx[13]; 635 } 636 637 set interactive(interactive) { 638 this.$$set({ interactive }); 639 flush(); 640 } 641} 642 643export { Colorpicker$1 as BaseColorPicker, Index as default }; 644//# sourceMappingURL=Index-48cf32f8.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.