(
node: ts.Node,
children: ts.JsxChild[],
output: JSXOutputState,
transformContext: ts.TransformationContext,
)
| 650 | } |
| 651 | |
| 652 | private outputComponentChildren( |
| 653 | node: ts.Node, |
| 654 | children: ts.JsxChild[], |
| 655 | output: JSXOutputState, |
| 656 | transformContext: ts.TransformationContext, |
| 657 | ): ts.Statement[] { |
| 658 | const slotteds: Slotted[] = []; |
| 659 | let hasExplicitSlotted = false; |
| 660 | let hasImplicitSlotted = false; |
| 661 | |
| 662 | for (const child of children) { |
| 663 | if (this.isEmptyJsxExpression(child) || this.isJsxText(child)) { |
| 664 | continue; |
| 665 | } |
| 666 | |
| 667 | if (ts.isJsxElement(child) && child.openingElement.tagName.getText() === 'slotted') { |
| 668 | hasExplicitSlotted = true; |
| 669 | |
| 670 | const slotName = this.getSlotValueExpr(child.openingElement.attributes, output, transformContext); |
| 671 | if (slotName) { |
| 672 | slotteds.push({ slotName, expressions: child.children.map((item) => item) }); |
| 673 | } else { |
| 674 | this.insertChildrenToUnnamedSlot( |
| 675 | child.children.map((item) => item), |
| 676 | slotteds, |
| 677 | ); |
| 678 | } |
| 679 | } else if (ts.isJsxSelfClosingElement(child) && child.tagName.getText() === 'slotted') { |
| 680 | hasExplicitSlotted = true; |
| 681 | |
| 682 | const slotName = this.getSlotValueExpr(child.attributes, output, transformContext); |
| 683 | if (slotName) { |
| 684 | slotteds.push({ slotName, expressions: [] }); |
| 685 | } else { |
| 686 | this.insertChildrenToUnnamedSlot([], slotteds); |
| 687 | } |
| 688 | } else { |
| 689 | hasImplicitSlotted = true; |
| 690 | |
| 691 | this.insertChildrenToUnnamedSlot([child], slotteds); |
| 692 | } |
| 693 | |
| 694 | this.ensureImplicitSlottedNotUsedWithExplicit(node, hasExplicitSlotted, hasImplicitSlotted); |
| 695 | } |
| 696 | |
| 697 | const statements: ts.Statement[] = []; |
| 698 | |
| 699 | for (const slotted of slotteds) { |
| 700 | statements.push(...this.outputSlot(node, slotted.expressions, slotted.slotName, output, transformContext)); |
| 701 | } |
| 702 | |
| 703 | return statements; |
| 704 | } |
| 705 | |
| 706 | private toParametersArray( |
| 707 | parameters: readonly (ts.Expression | undefined)[], |
no test coverage detected