From 2732c5ba12a3648aa8d26f78d8b9f25ce5ea6da7 Mon Sep 17 00:00:00 2001 From: Marvin Brouwer Date: Fri, 19 Jan 2024 21:08:24 +0100 Subject: [PATCH 1/8] chore: configured whitespace for consistency --- .editorconfig | 5 +++++ .vscode/settings.json | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..86b561542f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,5 @@ +root = true + +[*] +end_of_line = lf +charset = utf-8 diff --git a/.vscode/settings.json b/.vscode/settings.json index 0eb31972af..74a96f84fa 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,9 +1,11 @@ { - "editor.codeActionsOnSave": { - "source.fixAll": "explicit", - "source.organizeImports": "explicit" - }, - "typescript.format.enable": true, - "editor.formatOnSave": true, - "typescript.tsdk": "node_modules/typescript/lib" -} + "files.eol": "\n", + "editor.renderWhitespace": "boundary", + "editor.codeActionsOnSave": { + "source.fixAll": "explicit", + "source.organizeImports": "explicit" + }, + "typescript.format.enable": true, + "editor.formatOnSave": true, + "typescript.tsdk": "node_modules/typescript/lib" +} \ No newline at end of file From 601ca7a79b0cacd43476d0f8438912f446510ded Mon Sep 17 00:00:00 2001 From: Marvin Brouwer Date: Mon, 22 Jan 2024 08:40:16 +0100 Subject: [PATCH 2/8] feat(1333): Added documentation of intended feature --- docs/components.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/components.md b/docs/components.md index b2eb9cffce..33ff5fda5c 100644 --- a/docs/components.md +++ b/docs/components.md @@ -380,3 +380,27 @@ export default function Layout(props) { ); } ``` + +### Slots with data + +In case of components that might need to reference data inside of slots, you can simply pass along props: + +```jsx +import { Slot } from '@builder.io/mitosis'; + +export default function Carousel(props) { + return ( + + ); +} +``` From aedb2acf426fb33915449b54005d6c07a09fd2a2 Mon Sep 17 00:00:00 2001 From: Marvin Brouwer Date: Mon, 22 Jan 2024 20:58:14 +0100 Subject: [PATCH 3/8] feat(1333): Added data binding for vue slots --- .../vue-composition.test.ts.snap | 106 ++++++++---- .../__tests__/__snapshots__/vue.test.ts.snap | 118 +++++++++---- .../data/blocks/slot-named-data.raw.tsx | 17 ++ .../__tests__/data/blocks/slot-named.raw.tsx | 4 +- packages/core/src/__tests__/test-generator.ts | 2 + packages/core/src/generators/vue/blocks.ts | 160 +++++++++--------- 6 files changed, 266 insertions(+), 141 deletions(-) create mode 100644 packages/core/src/__tests__/data/blocks/slot-named-data.raw.tsx diff --git a/packages/core/src/__tests__/__snapshots__/vue-composition.test.ts.snap b/packages/core/src/__tests__/__snapshots__/vue-composition.test.ts.snap index 53578b0172..ceed8eb4b5 100644 --- a/packages/core/src/__tests__/__snapshots__/vue-composition.test.ts.snap +++ b/packages/core/src/__tests__/__snapshots__/vue-composition.test.ts.snap @@ -12,7 +12,7 @@ exports[`Vue > jsx > Javascript Test > AdvancedRef 1`] = ` @change=\\"name = $event.target.value\\" /> - @@ -215,7 +215,7 @@ exports[`Vue > jsx > Javascript Test > BasicBooleanAttribute 1`] = ` " @@ -1050,7 +1050,7 @@ exports[`Vue > jsx > Javascript Test > Image 1`] = ` - + @@ -1215,7 +1215,6 @@ const props = defineProps([ exports[`Vue > jsx > Javascript Test > InputParent 1`] = ` " @@ -1286,7 +1285,7 @@ exports[`Vue > jsx > Javascript Test > Section 2`] = ` }\\" v-bind=\\"attributes\\" > - + @@ -1345,8 +1344,10 @@ exports[`Vue > jsx > Javascript Test > SlotHtml 1`] = ` " @@ -4473,8 +4493,10 @@ exports[`Vue > jsx > Typescript Test > SlotHtml 1`] = ` "