From cd1758b16f4cb6b176980b2c868efa3c98d30343 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Wed, 20 Nov 2024 15:38:44 +0100 Subject: [PATCH] feat: support `` (#2599) --- packages/language-server/src/plugins/html/dataProvider.ts | 6 ++++++ packages/svelte2tsx/src/htmlxtojsx_v2/index.ts | 2 ++ .../test/htmlx2jsx/samples/.svelte-html.v5/expectedv2.js | 1 + .../test/htmlx2jsx/samples/.svelte-html.v5/input.svelte | 1 + 4 files changed, 10 insertions(+) create mode 100644 packages/svelte2tsx/test/htmlx2jsx/samples/.svelte-html.v5/expectedv2.js create mode 100644 packages/svelte2tsx/test/htmlx2jsx/samples/.svelte-html.v5/input.svelte diff --git a/packages/language-server/src/plugins/html/dataProvider.ts b/packages/language-server/src/plugins/html/dataProvider.ts index 30495b6bd..df998d61c 100644 --- a/packages/language-server/src/plugins/html/dataProvider.ts +++ b/packages/language-server/src/plugins/html/dataProvider.ts @@ -200,6 +200,12 @@ const svelteTags: ITagData[] = [ } ] }, + { + name: 'svelte:html', + description: + 'This element allows you to add properties and listeners to events on `document.documentElement`. This is useful for attributes such as `lang` which influence how the browser interprets the content.', + attributes: [] + }, { name: 'svelte:document', description: diff --git a/packages/svelte2tsx/src/htmlxtojsx_v2/index.ts b/packages/svelte2tsx/src/htmlxtojsx_v2/index.ts index 95f8cec4f..913cc54bc 100644 --- a/packages/svelte2tsx/src/htmlxtojsx_v2/index.ts +++ b/packages/svelte2tsx/src/htmlxtojsx_v2/index.ts @@ -135,6 +135,7 @@ export function convertHtmlxToJsx( case 'Title': case 'Document': case 'Body': + case 'SvelteHTML': case 'SvelteBoundary': case 'Slot': case 'SlotTemplate': @@ -239,6 +240,7 @@ export function convertHtmlxToJsx( case 'Head': case 'Title': case 'Body': + case 'SvelteHTML': case 'SvelteBoundary': case 'Document': case 'Slot': diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/.svelte-html.v5/expectedv2.js b/packages/svelte2tsx/test/htmlx2jsx/samples/.svelte-html.v5/expectedv2.js new file mode 100644 index 000000000..23e947d26 --- /dev/null +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/.svelte-html.v5/expectedv2.js @@ -0,0 +1 @@ + { svelteHTML.createElement("svelte:html", { "lang":`de`,}); } \ No newline at end of file diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/.svelte-html.v5/input.svelte b/packages/svelte2tsx/test/htmlx2jsx/samples/.svelte-html.v5/input.svelte new file mode 100644 index 000000000..cd4ed850b --- /dev/null +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/.svelte-html.v5/input.svelte @@ -0,0 +1 @@ +