-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for resize observer bindings #8022
Conversation
I made a different pull request earlier using resize observers for the old dimension bindings. I removed them as I was told that it would cause inconsistent behaviour between browsers. With your permission, I'd like to re-implement it behind a compiler option, as the old bindings are easier to use.
|
Hi all. I need some advice on how to fix this error. It is happening during type ResizeObserverEntry = any;
type ResizeObserverOptions = any;
type ResizeObserver = any;
declare const ResizeObserver: any; I tried changing the TSConfig version to Should I just copy the ResizeObserver type definitions from |
What's the error exactly? I would be ok to slap a |
Adding My above solution works and is probably fine since the observer is only used internally. Error
|
@dummdidumm is attempting to deploy a commit to the Svelte Team on Vercel. A member of the Team first needs to authorize it. |
leftovers from sveltejs#8022
This has been released in 3.59.0. Thank you! |
Good to have this feature as it should be more performant but feels less ergonomic than Old: <script>
let clientWidth
</script>
<div bind:clientWidth>Width: {clientWidth}</div> New (pretty hard to remember): <script>
let borderBoxSize;
let width;
$: width = borderBoxSize && borderBoxSize[borderBoxSize.length-1]?.inlineSize;
</script>
<div bind:borderBoxSize>Width {width}</div> Any chance of some shorthand that removes this boilerplate e.g.: <script>
let borderBoxInlineSize;
</script>
<div bind:borderBoxInlineSize>Width: {borderBoxInlineSize}</div> |
Is this documented? It looks like it isn't. |
@aradalvand Good catch! Would you like to submit a PR to supplement the docs? |
Implements ResizeObserver bindings: #5524 (comment)
Continuation of: #5963
Related to #7583
I'm not familiar with the codebase so I'm not sure if this is the intended way to implement special bindings.