48 Matching Annotations
- Aug 2022
- Jul 2021
-
github.com github.com
-
this happens with getClient and setClient because it is a svelte context which is only available at component initialization (construction) and cannot be in an event handler.
-
- Jan 2021
-
github.com github.com
-
Thanks to that I have chance and time to properly initialise all the properties without reactive calls and I do not have to ignore these "initialising" events before proper initialisation.
-
-
medium.com medium.com
-
Knowing exactly what happens in your application can mean the difference between feeling in full control or experiencing deep frustration. Personally, unknowns drive me crazy, which in turn often leads to all sorts of experiments and/or debug sessions.
-
- Nov 2020
-
github.com github.com
-
For use$ since svelte is never going to support actions for components, i designed something that reminds React hooks that will in some ways replace this feature.
Isn't that what use$ is trying to do already? How is that "something that reminds React hooks" any different? Will be interested to see...
-
-
github.com github.com
-
Another difference is that context in Svelte does not insert anything into the visual component tree. There is no <Context.Provider> element like in React
-
-
github.com github.com
-
stackoverflow.com stackoverflow.com
-
github.com github.com
-
class: '' - A CSS class string.
-
- Oct 2020
-
github.com github.com
-
For the sake of best compatibility we convert the className attribute to class for svelte.
Svelte refuses to standardize on any way to pass a CSS class. I thought className was actually the most common name for this prop though even in Svelte...
-
-
-
(One can already destructure the loop variable but using a store obtained that way currently throws an error - Stores must be declared at the top level of the component (this may change in a future version of Svelte))
-
-
github.com github.com
- Sep 2020
-
stackoverflow.com stackoverflow.com
-
stackoverflow.com stackoverflow.com
-
setContext must be called synchronously during component initialization. That is, from the root of the <script> tag
-
-
github.com github.com
-
github.com github.com
-
It looks like the issue stems from having "svelte" as a dependency instead of a devDependencies in package.json within the sapper project. This causes import 'svelte' to load the rollup excluded npm package's set_current_component instead of from within the sapper generated server.js.
-
-
-
Most simple example: <script> import ChildComponent from './Child.svelte'; </script> <style> .class-to-add { background-color: tomato; } </style> <ChildComponent class="class-to-add" /> ...compiles to CSS without the class-to-add declaration, as svelte currently does not recognize the class name as being used. I'd expect class-to-add is bundled with all nested style declarations class-to-add is passed to ChildComponent as class-to-add svelte-HASH This looks like a bug / missing feature to me.
-
-
color: red; //doesn't apply this rule, because scoping doesn't extend to children
-
Say I want to style this javascript routing anchor tag on various pages (some may be buttons, plain links, images) it makes it incredibly difficult. Eg:
-
Having to wrap everything in a selector :global(child) { } is hacky
-
-
github.com github.com
-
There is a good amount of properties that should mostly be applied from a parent's point of view. We're talking stuff like grid-area in grid layouts, margin and flex in flex layouts. Even properties like position and and the top/right/left/bottom following it in some cases.
-
Svelte will not offer a generic way to support style customizing via contextual class overrides (as we'd do it in plain HTML). Instead we'll invent something new that is entirely different. If a child component is provided and does not anticipate some contextual usage scenario (style wise) you'd need to copy it or hack around that via :global hacks.
-
The RFC is more appropriate because it does not allow a parent to abritrarily control anything below it, that responsibility still relies on the component itself. Just because people have been passing classes round and overriding child styles for years doesn't mean it is a good choice and isn't something we wnat to encourage.
-
This allows passing classes to child components with svelte-{hash} through the class prop and prevents removing such classes from css.
Tags
- forking to add a desired missing feature/change
- programming: who is responsible for this concern?
- component/library author can't consider/know ahead of time all of the ways users may want to use it
- Svelte: components are their own boss (encapsulation)
- forced to fork/copy and paste library code because it didn't provide enough customizability/extensibility / didn't foresee some specific prop/behavior that needed to be overridable/configurable (explicit interface)
- trying to prevent one bad thing leading to people doing/choosing an even worse option
- control (programming)
- who should have control over this? (programming)
- Svelte: how to affect child component styles
- run-time dynamicness/generics vs. having to explicitly list/hard-code all options ahead of time
- ugly/kludgey
- maintenance burden to explicitly define/enumerate/hard-code possible options (explicit interface)
- limiting how much library consumers/users can control/override
- workarounds
- which component/tool/organization/etc. is responsible for this concern?
- whose responsibility is it?
Annotators
URL
-
-
github.com github.com
-
Allow creating custom components with the same abilities as native dom. By all means keep the same level of encapsulation, don't push class on components, but allow a component to mark the class property or another as a CSS Class property, in which case you could pass it through the same transformation that native elements go through
-
The problem with working around the current limitations of Svelte style (:global, svelte:head, external styles or various wild card selectors) is that the API is uglier, bigger, harder to explain AND it loses one of the best features of Svelte IMO - contextual style encapsulation. I can understand that CSS classes are a bit uncontrollable, but this type of blocking will just push developers to work around it and create worse solutions.
Tags
- feature parity
- important point
- analogy
- trying to prevent one bad thing leading to people doing/choosing an even worse option
- DOM
- Svelte component
- comparison
- Svelte: CSS encapsulation
- missing out on the benefits of something
- +0.9
- optional feature
- Svelte: how to affect child component styles
- arbitrary limitations leading to less-than-ideal workarounds
- key point
Annotators
URL
-
-
svelte.dev svelte.dev
-
github.com github.com
-
The point of the feature is to not rely on the third-party author of the child component to add a prop for every action under the sun. Rather, they could just mark a recipient for actions on the component (assuming there is a viable target element), and then consumers of the library could extend the component using whatever actions they desire.
-
They don't need to add a prop for every action. The action itself can be passed in as a prop. <script> export let action; </script> <div use:action>whatever</div> The argument for the action can be another prop or can be part of the same prop.
Tags
- powerful
- component/library author can't consider/know ahead of time all of the ways users may want to use it
- pass-through arguments/props/options
- Svelte: action (use:)
- emergent
- component properties (props)
- I didn't know you could do that / that was possible!
- run-time dynamicness/generics vs. having to explicitly list/hard-code all options ahead of time
- flexibility
- extensibility
Annotators
URL
-
-
simply-svelte-autocomplete.surge.sh simply-svelte-autocomplete.surge.sh
-
c0bra.github.io c0bra.github.ioSvelma1
-
github.com github.com
-
-
However, we've another unresolved problem - passing parent's styles to child components.
-
-
svelte.dev svelte.dev
-
github.com github.com
-
www.codingwithjesse.com www.codingwithjesse.com
-
With Svelte, components and files have a one-to-one relationship. Every file is a component, and files can't have more than one component. This is generally a "best practice" when using most component frameworks.
-
-
illright.github.io illright.github.io
- Jul 2020
-
github.com github.com