(block, parent_node, parent_nodes)
| 20531 | this.fragment.render(this.block, parent_node, parent_nodes); |
| 20532 | } |
| 20533 | render_dynamic_key(block, parent_node, parent_nodes) { |
| 20534 | this.fragment.render(this.block, null, x`#nodes`); |
| 20535 | const has_transitions = !!(this.block.has_intro_method || this.block.has_outro_method); |
| 20536 | const dynamic = this.block.has_update_method; |
| 20537 | const previous_key = block.get_unique_name("previous_key"); |
| 20538 | const snippet = this.node.expression.manipulate(block); |
| 20539 | block.add_variable(previous_key, snippet); |
| 20540 | const not_equal = this.renderer.component.component_options.immutable ? x`@not_equal` : x`@safe_not_equal`; |
| 20541 | const condition = x`${this.renderer.dirty(this.dependencies)} && ${not_equal}(${previous_key}, ${previous_key} = ${snippet})`; |
| 20542 | block.chunks.init.push(b` |
| 20543 | let ${this.var} = ${this.block.name}(#ctx); |
| 20544 | `); |
| 20545 | block.chunks.create.push(b`${this.var}.c();`); |
| 20546 | if (this.renderer.options.hydratable) { |
| 20547 | block.chunks.claim.push(b`${this.var}.l(${parent_nodes});`); |
| 20548 | } |
| 20549 | block.chunks.mount.push(b`${this.var}.m(${parent_node || "#target"}, ${parent_node ? "null" : "#anchor"});`); |
| 20550 | const anchor = this.get_or_create_anchor(block, parent_node, parent_nodes); |
| 20551 | const body = b` |
| 20552 | ${has_transitions ? b` |
| 20553 | @group_outros(); |
| 20554 | @transition_out(${this.var}, 1, 1, @noop); |
| 20555 | @check_outros(); |
| 20556 | ` : b`${this.var}.d(1);`} |
| 20557 | ${this.var} = ${this.block.name}(#ctx); |
| 20558 | ${this.var}.c(); |
| 20559 | ${has_transitions && b`@transition_in(${this.var})`} |
| 20560 | ${this.var}.m(${this.get_update_mount_node(anchor)}, ${anchor}); |
| 20561 | `; |
| 20562 | if (dynamic) { |
| 20563 | block.chunks.update.push(b` |
| 20564 | if (${condition}) { |
| 20565 | ${body} |
| 20566 | } else { |
| 20567 | ${this.var}.p(#ctx, #dirty); |
| 20568 | } |
| 20569 | `); |
| 20570 | } else { |
| 20571 | block.chunks.update.push(b` |
| 20572 | if (${condition}) { |
| 20573 | ${body} |
| 20574 | } |
| 20575 | `); |
| 20576 | } |
| 20577 | if (has_transitions) { |
| 20578 | block.chunks.intro.push(b`@transition_in(${this.var})`); |
| 20579 | block.chunks.outro.push(b`@transition_out(${this.var})`); |
| 20580 | } |
| 20581 | block.chunks.destroy.push(b`${this.var}.d(detaching)`); |
| 20582 | } |
| 20583 | }; |
| 20584 | function get_slot_definition(block, scope2, lets) { |
| 20585 | if (lets.length === 0) |
no test coverage detected