From 8152ebe5a296c8e67301e611d5695942e2914f18 Mon Sep 17 00:00:00 2001 From: Patrick Date: Mon, 5 Jun 2023 12:47:20 +0200 Subject: [PATCH 1/2] add support for resize observer bindings --- .../src/plugins/html/dataProvider.ts | 16 ++++++++++++++++ .../src/htmlxtojsx_v2/nodes/Binding.ts | 6 +++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/language-server/src/plugins/html/dataProvider.ts b/packages/language-server/src/plugins/html/dataProvider.ts index dbf38c667..a0ce6da04 100644 --- a/packages/language-server/src/plugins/html/dataProvider.ts +++ b/packages/language-server/src/plugins/html/dataProvider.ts @@ -64,6 +64,22 @@ const svelteAttributes: IAttributeData[] = [ name: 'bind:offsetHeight', description: 'Available for block level elements. (read-only)' }, + { + name: 'contentRect', + description: 'Available for all elements. (read-only)' + }, + { + name: 'contentBoxSize', + description: 'Available for all elements. (read-only)' + }, + { + name: 'borderBoxSize', + description: 'Available for all elements. (read-only)' + }, + { + name: 'devicePixelContentBoxSize', + description: 'Available for all elements. (read-only)' + }, { name: 'bind:this', description: diff --git a/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Binding.ts b/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Binding.ts index 7f5d04f41..73e139272 100644 --- a/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Binding.ts +++ b/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Binding.ts @@ -17,7 +17,11 @@ const oneWayBindingAttributes: Set = new Set([ 'ended', 'readyState', 'naturalWidth', - 'naturalHeight' + 'naturalHeight', + 'contentRect', + 'contentBoxSize', + 'borderBoxSize', + 'devicePixelContentBoxSize' ]); /** * List of all binding names that are transformed to sth like `binding = variable`. From 2f2155f176330f049db617f96d6f32ab9051bb92 Mon Sep 17 00:00:00 2001 From: Patrick Date: Tue, 6 Jun 2023 09:58:32 +0200 Subject: [PATCH 2/2] Update packages/language-server/src/plugins/html/dataProvider.ts Co-authored-by: Willow (GHOST) --- packages/language-server/src/plugins/html/dataProvider.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/language-server/src/plugins/html/dataProvider.ts b/packages/language-server/src/plugins/html/dataProvider.ts index a0ce6da04..4099245bf 100644 --- a/packages/language-server/src/plugins/html/dataProvider.ts +++ b/packages/language-server/src/plugins/html/dataProvider.ts @@ -65,19 +65,19 @@ const svelteAttributes: IAttributeData[] = [ description: 'Available for block level elements. (read-only)' }, { - name: 'contentRect', + name: 'bind:contentRect', description: 'Available for all elements. (read-only)' }, { - name: 'contentBoxSize', + name: 'bind:contentBoxSize', description: 'Available for all elements. (read-only)' }, { - name: 'borderBoxSize', + name: 'bind:borderBoxSize', description: 'Available for all elements. (read-only)' }, { - name: 'devicePixelContentBoxSize', + name: 'bind:devicePixelContentBoxSize', description: 'Available for all elements. (read-only)' }, {