Fixes#6137
Adding a trusted modifier to make events not be dispatchable by console/sourcecode.
Useful to prevent injected code to automatically dispatch event for preventing botting
* Implement new hydration optimization
During hydration, greedily pick nodes that exist in the original HTML that should not be detached.
Detach the rest.
* Implement optimal reordering during hydration
During hydration we track the order in which children are claimed.
Afterwards, rather than reordering them greedily one-by-one, we reorder all claimed children during the first append optimally.
The optimal reordering first finds the longest subsequence of children that have been claimed in order.
These children will not be moved.
The rest of the children are reordered to where they have to go.
This algorithm is guaranteed to be optimal in the number of reorderings.
The hydration/head-meta-hydrate-duplicate test sample has been modified slightly.
The order in which the <title> tag is being generated changed, which does not affect correctness.
* Fix issue potentially causing extra reorders
Not sorting children before executing the `insertBefore` calls in `init_hydrate` potentially caused extra `insertBefore` calls in `append`
* Simplify`init_hydrate` sorting logic
Fixes#6291Fixes#6345
Both writable and readable initialized without any arguments are already valid, but TS complains about it. This makes both allowed to be emptily initialized. It's also possible to invoke readable with one argument only.
* Allow to customize the css scope class
* Pass component name to scope class generator
* Move Stylesheet arguments into an object
* Refactor to cssHash
* Please the almighty linter
* pass hash function to cssHash
* update test
* document cssHash option
Co-authored-by: Christian Kaisermann <christian@kaisermann.me>
* call onDestroy when disconnected
* lifecycle hooks and custom elements
- Call onMount in connectedCallback for customElements
- register onMount return values as on_disconnect-callbacks for customElements
- run on_disconnect callbacks in disconnectedCallback
* do not reset on_mount so that it can fire again if reinserted
* simpler isCustomElement & skip extra function call
- pass options.customElement down to mount_component
- remove expensive isCustomElement check
- only call add_render_callback if not customElement
Co-authored-by: Pontus Lundin <pontus.lundin@ica.se>