MCPcopy
hub / github.com/livebud/bud / get_contents

Method get_contents

package/svelte/compiler.js:14492–14655  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

14490 return new Block$1(Object.assign({}, this, { key: null }, options, { parent: this }));
14491 }
14492 get_contents(key) {
14493 const { dev } = this.renderer.options;
14494 if (this.has_outros) {
14495 this.add_variable({ type: "Identifier", name: "#current" });
14496 if (this.chunks.intro.length > 0) {
14497 this.chunks.intro.push(b`#current = true;`);
14498 this.chunks.mount.push(b`#current = true;`);
14499 }
14500 if (this.chunks.outro.length > 0) {
14501 this.chunks.outro.push(b`#current = false;`);
14502 }
14503 }
14504 if (this.autofocus) {
14505 if (this.autofocus.condition_expression) {
14506 this.chunks.mount.push(b`if (${this.autofocus.condition_expression}) ${this.autofocus.element_var}.focus();`);
14507 } else {
14508 this.chunks.mount.push(b`${this.autofocus.element_var}.focus();`);
14509 }
14510 }
14511 this.render_listeners();
14512 const properties2 = {};
14513 const noop2 = x`@noop`;
14514 properties2.key = key;
14515 if (this.first) {
14516 properties2.first = x`null`;
14517 this.chunks.hydrate.push(b`this.first = ${this.first};`);
14518 }
14519 if (this.chunks.create.length === 0 && this.chunks.hydrate.length === 0) {
14520 properties2.create = noop2;
14521 } else {
14522 const hydrate = this.chunks.hydrate.length > 0 && (this.renderer.options.hydratable ? b`this.h();` : this.chunks.hydrate);
14523 properties2.create = x`function #create() {
14524 ${this.chunks.create}
14525 ${hydrate}
14526 }`;
14527 }
14528 if (this.renderer.options.hydratable || this.chunks.claim.length > 0) {
14529 if (this.chunks.claim.length === 0 && this.chunks.hydrate.length === 0) {
14530 properties2.claim = noop2;
14531 } else {
14532 properties2.claim = x`function #claim(#nodes) {
14533 ${this.chunks.claim}
14534 ${this.renderer.options.hydratable && this.chunks.hydrate.length > 0 && b`this.h();`}
14535 }`;
14536 }
14537 }
14538 if (this.renderer.options.hydratable && this.chunks.hydrate.length > 0) {
14539 properties2.hydrate = x`function #hydrate() {
14540 ${this.chunks.hydrate}
14541 }`;
14542 }
14543 if (this.chunks.mount.length === 0) {
14544 properties2.mount = noop2;
14545 } else if (this.event_listeners.length === 0) {
14546 properties2.mount = x`function #mount(#target, #anchor) {
14547 ${this.chunks.mount}
14548 }`;
14549 } else {

Callers 2

renderMethod · 0.80
domFunction · 0.80

Calls 7

bFunction · 0.85
xFunction · 0.85
add_variableMethod · 0.80
pushMethod · 0.80
render_listenersMethod · 0.80
get_unique_nameMethod · 0.80
replaceMethod · 0.80

Tested by

no test coverage detected