1import { S as SvelteComponent, i as init, s as safe_not_equal, f as element, q as create_component, m as space, b as attr, c as insert, u as mount_component, d as append, a3 as set_input_value, l as listen, v as transition_in, w as transition_out, e as detach, x as destroy_component, A as createEventDispatcher, h as text, j as set_data, a4 as flush, L as assign, M as StatusTracker, D as binding_callbacks, J as bind, N as get_spread_update, O as get_spread_object, G as add_flush_callback, F as bubble } from './index.4ddf74a5.js'; 2import { B as Block } from './Block.d349039f.js'; 3import { g as get_styles } from './styles.c72835fa.js'; 4import { B as BlockTitle } from './BlockTitle.ced39a36.js'; 5 6/* home/runner/work/gradio/gradio/ui/packages/form/src/ColorPicker.svelte generated by Svelte v3.49.0 */ 7 8function create_default_slot$1(ctx) { 9 let t; 10 11 return { 12 c() { 13 t = text(/*label*/ ctx[1]); 14 }, 15 m(target, anchor) { 16 insert(target, t, anchor); 17 }, 18 p(ctx, dirty) { 19 if (dirty & /*label*/ 2) set_data(t, /*label*/ ctx[1]); 20 }, 21 d(detaching) { 22 if (detaching) detach(t); 23 } 24 }; 25} 26 27function create_fragment$1(ctx) { 28 let label_1; 29 let blocktitle; 30 let t; 31 let input; 32 let input_class_value; 33 let current; 34 let mounted; 35 let dispose; 36 37 blocktitle = new BlockTitle({ 38 props: { 39 show_label: /*show_label*/ ctx[3], 40 $$slots: { default: [create_default_slot$1] }, 41 $$scope: { ctx } 42 } 43 }); 44 45 return { 46 c() { 47 label_1 = element("label"); 48 create_component(blocktitle.$$.fragment); 49 t = space(); 50 input = element("input"); 51 attr(input, "type", "color"); 52 attr(input, "class", input_class_value = "gr-box-unrounded " + /*classes*/ ctx[4]); 53 input.disabled = /*disabled*/ ctx[2]; 54 attr(label_1, "class", "block"); 55 }, 56 m(target, anchor) { 57 insert(target, label_1, anchor); 58 mount_component(blocktitle, label_1, null); 59 append(label_1, t); 60 append(label_1, input); 61 set_input_value(input, /*value*/ ctx[0]); 62 current = true; 63 64 if (!mounted) { 65 dispose = listen(input, "input", /*input_input_handler*/ ctx[6]); 66 mounted = true; 67 } 68 }, 69 p(ctx, [dirty]) { 70 const blocktitle_changes = {}; 71 if (dirty & /*show_label*/ 8) blocktitle_changes.show_label = /*show_label*/ ctx[3]; 72 73 if (dirty & /*$$scope, label*/ 514) { 74 blocktitle_changes.$$scope = { dirty, ctx }; 75 } 76 77 blocktitle.$set(blocktitle_changes); 78 79 if (!current || dirty & /*classes*/ 16 && input_class_value !== (input_class_value = "gr-box-unrounded " + /*classes*/ ctx[4])) { 80 attr(input, "class", input_class_value); 81 } 82 83 if (!current || dirty & /*disabled*/ 4) { 84 input.disabled = /*disabled*/ ctx[2]; 85 } 86 87 if (dirty & /*value*/ 1) { 88 set_input_value(input, /*value*/ ctx[0]); 89 } 90 }, 91 i(local) { 92 if (current) return; 93 transition_in(blocktitle.$$.fragment, local); 94 current = true; 95 }, 96 o(local) { 97 transition_out(blocktitle.$$.fragment, local); 98 current = false; 99 }, 100 d(detaching) { 101 if (detaching) detach(label_1); 102 destroy_component(blocktitle); 103 mounted = false; 104 dispose(); 105 } 106 }; 107} 108 109function instance$1($$self, $$props, $$invalidate) { 110 let classes; 111 let { value = "#000000" } = $$props; 112 let { style = {} } = $$props; 113 let { label } = $$props; 114 let { disabled = false } = $$props; 115 let { show_label = true } = $$props; 116 const dispatch = createEventDispatcher(); 117 118 function handle_change(val) { 119 dispatch("change", val); 120 } 121 122 function input_input_handler() { 123 value = this.value; 124 $$invalidate(0, value); 125 } 126 127 $$self.$$set = $$props => {
128 if ('value' in $$props) $$invalidate(0, value = $$props.value); 129 if ('style' in $$props) $$invalidate(5, style = $$props.style); 130 if ('label' in $$props) $$invalidate(1, label = $$props.label); 131 if ('disabled' in $$props) $$invalidate(2, disabled = $$props.disabled); 132 if ('show_label' in $$props) $$invalidate(3, show_label = $$props.show_label); 133 }; 134 135 $$self.$$.update = () => { 136 if ($$self.$$.dirty & /*value*/ 1) ; 137 138 if ($$self.$$.dirty & /*value*/ 1) { 139 handle_change(value); 140 } 141 142 if ($$self.$$.dirty & /*style*/ 32) { 143 $$invalidate(4, { classes } = get_styles(style, ["rounded", "border"]), classes); 144 } 145 }; 146 147 return [value, label, disabled, show_label, classes, style, input_input_handler]; 148} 149 150class ColorPicker extends SvelteComponent { 151 constructor(options) { 152 super(); 153 154 init(this, options, instance$1, create_fragment$1, safe_not_equal, { 155 value: 0, 156 style: 5, 157 label: 1, 158 disabled: 2, 159 show_label: 3 160 }); 161 } 162} 163 164/* src/components/ColorPicker/ColorPicker.svelte generated by Svelte v3.49.0 */ 165 166function create_default_slot(ctx) { 167 let statustracker; 168 let t; 169 let colorpicker; 170 let updating_value; 171 let current; 172 const statustracker_spread_levels = [/*loading_status*/ ctx[6]]; 173 let statustracker_props = {}; 174 175 for (let i = 0; i < statustracker_spread_levels.length; i += 1) { 176 statustracker_props = assign(statustracker_props, statustracker_spread_levels[i]); 177 } 178 179 statustracker = new StatusTracker({ props: statustracker_props }); 180 181 function colorpicker_value_binding(value) { 182 /*colorpicker_value_binding*/ ctx[8](value); 183 } 184 185 let colorpicker_props = { 186 style: /*style*/ ctx[5], 187 label: /*label*/ ctx[1], 188 show_label: /*show_label*/ ctx[4], 189 disabled: /*mode*/ ctx[7] === "static" 190 }; 191 192 if (/*value*/ ctx[0] !== void 0) { 193 colorpicker_props.value = /*value*/ ctx[0]; 194 } 195 196 colorpicker = new ColorPicker({ props: colorpicker_props }); 197 binding_callbacks.push(() => bind(colorpicker, 'value', colorpicker_value_binding)); 198 colorpicker.$on("change", /*change_handler*/ ctx[9]); 199 colorpicker.$on("submit", /*submit_handler*/ ctx[10]); 200 201 return { 202 c() { 203 create_component(statustracker.$$.fragment); 204 t = space(); 205 create_component(colorpicker.$$.fragment); 206 }, 207 m(target, anchor) { 208 mount_component(statustracker, target, anchor); 209 insert(target, t, anchor); 210 mount_component(colorpicker, target, anchor); 211 current = true; 212 }, 213 p(ctx, dirty) { 214 const statustracker_changes = (dirty & /*loading_status*/ 64) 215 ? get_spread_update(statustracker_spread_levels, [get_spread_object(/*loading_status*/ ctx[6])]) 216 : {}; 217 218 statustracker.$set(statustracker_changes); 219 const colorpicker_changes = {}; 220 if (dirty & /*style*/ 32) colorpicker_changes.style = /*style*/ ctx[5]; 221 if (dirty & /*label*/ 2) colorpicker_changes.label = /*label*/ ctx[1]; 222 if (dirty & /*show_label*/ 16) colorpicker_changes.show_label = /*show_label*/ ctx[4]; 223 if (dirty & /*mode*/ 128) colorpicker_changes.disabled = /*mode*/ ctx[7] === "static"; 224 225 if (!updating_value && dirty & /*value*/ 1) { 226 updating_value = true; 227 colorpicker_changes.value = /*value*/ ctx[0]; 228 add_flush_callback(() => updating_value = false); 229 } 230 231 colorpicker.$set(colorpicker_changes); 232 }, 233 i(local) { 234 if (current) return; 235 transition_in(statustracker.$$.fragment, local); 236 transition_in(colorpicker.$$.fragment, local); 237 current = true; 238 }, 239 o(local) { 240 transition_out(statustracker.$$.fragment, local); 241 transition_out(colorpicker.$$.fragment, local); 242 current = false; 243 }, 244 d(detaching) { 245 destroy_component(statustracker, detaching); 246 if (detaching) detach(t); 247 destroy_component(colorpicker, detaching); 248 } 249 }; 250} 251 252function create_fragment(ctx) { 253 let block; 254 let current; 255 256 block = new Block({ 257 props: { 258 visible: /*visible*/ ctx[3], 259 elem_id: /*elem_id*/ ctx[2], 260 disable: typeof /*style*/ ctx[5].container === "boolean" && !/*style*/ ctx[5].container, 261 $$slots: { default: [create_default_slot] }, 262 $$scope: { ctx } 263 } 264 }); 265 266 return { 267 c() { 268 create_component(block.$$.fragment); 269 }, 270 m(target, anchor) { 271 mount_component(block, target, anchor); 272 current = true; 273 }, 274 p(ctx, [dirty]) { 275 const block_changes = {};
276 if (dirty & /*visible*/ 8) block_changes.visible = /*visible*/ ctx[3]; 277 if (dirty & /*elem_id*/ 4) block_changes.elem_id = /*elem_id*/ ctx[2]; 278 if (dirty & /*style*/ 32) block_changes.disable = typeof /*style*/ ctx[5].container === "boolean" && !/*style*/ ctx[5].container; 279 280 if (dirty & /*$$scope, style, label, show_label, mode, value, loading_status*/ 2291) { 281 block_changes.$$scope = { dirty, ctx }; 282 } 283 284 block.$set(block_changes); 285 }, 286 i(local) { 287 if (current) return; 288 transition_in(block.$$.fragment, local); 289 current = true; 290 }, 291 o(local) { 292 transition_out(block.$$.fragment, local); 293 current = false; 294 }, 295 d(detaching) { 296 destroy_component(block, detaching); 297 } 298 }; 299} 300 301function instance($$self, $$props, $$invalidate) { 302 let { label = "ColorPicker" } = $$props; 303 let { elem_id = "" } = $$props; 304 let { visible = true } = $$props; 305 let { value } = $$props; 306 let { show_label } = $$props; 307 let { style = {} } = $$props; 308 let { loading_status } = $$props; 309 let { mode } = $$props; 310 311 function colorpicker_value_binding(value$1) { 312 value = value$1; 313 $$invalidate(0, value); 314 } 315 316 function change_handler(event) { 317 bubble.call(this, $$self, event); 318 } 319 320 function submit_handler(event) { 321 bubble.call(this, $$self, event); 322 } 323 324 $$self.$$set = $$props => {
325 if ('label' in $$props) $$invalidate(1, label = $$props.label); 326 if ('elem_id' in $$props) $$invalidate(2, elem_id = $$props.elem_id); 327 if ('visible' in $$props) $$invalidate(3, visible = $$props.visible); 328 if ('value' in $$props) $$invalidate(0, value = $$props.value); 329 if ('show_label' in $$props) $$invalidate(4, show_label = $$props.show_label); 330 if ('style' in $$props) $$invalidate(5, style = $$props.style); 331 if ('loading_status' in $$props) $$invalidate(6, loading_status = $$props.loading_status); 332 if ('mode' in $$props) $$invalidate(7, mode = $$props.mode); 333 }; 334 335 return [ 336 value, 337 label, 338 elem_id, 339 visible, 340 show_label, 341 style, 342 loading_status, 343 mode, 344 colorpicker_value_binding, 345 change_handler, 346 submit_handler 347 ]; 348} 349 350class ColorPicker_1 extends SvelteComponent { 351 constructor(options) { 352 super(); 353 354 init(this, options, instance, create_fragment, safe_not_equal, { 355 label: 1, 356 elem_id: 2, 357 visible: 3, 358 value: 0, 359 show_label: 4, 360 style: 5, 361 loading_status: 6, 362 mode: 7 363 }); 364 } 365 366 get label() { 367 return this.$$.ctx[1]; 368 } 369 370 set label(label) { 371 this.$$set({ label }); 372 flush(); 373 } 374 375 get elem_id() { 376 return this.$$.ctx[2]; 377 } 378 379 set elem_id(elem_id) { 380 this.$$set({ elem_id }); 381 flush(); 382 } 383 384 get visible() { 385 return this.$$.ctx[3]; 386 } 387 388 set visible(visible) { 389 this.$$set({ visible }); 390 flush(); 391 } 392 393 get value() { 394 return this.$$.ctx[0]; 395 } 396 397 set value(value) { 398 this.$$set({ value }); 399 flush(); 400 } 401 402 get show_label() { 403 return this.$$.ctx[4]; 404 } 405 406 set show_label(show_label) { 407 this.$$set({ show_label }); 408 flush(); 409 } 410 411 get style() { 412 return this.$$.ctx[5]; 413 } 414 415 set style(style) { 416 this.$$set({ style }); 417 flush(); 418 } 419 420 get loading_status() { 421 return this.$$.ctx[6]; 422 } 423 424 set loading_status(loading_status) { 425 this.$$set({ loading_status }); 426 flush(); 427 } 428 429 get mode() { 430 return this.$$.ctx[7]; 431 } 432 433 set mode(mode) { 434 this.$$set({ mode }); 435 flush(); 436 } 437} 438 439var ColorPicker_1$1 = ColorPicker_1; 440 441const modes = ["static", "dynamic"]; 442 443export { ColorPicker_1$1 as Component, modes };
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.