Support Features rendering / static/unmount props

Fixes #1
This commit is contained in:
Ryan Gossiaux
2021-12-22 11:55:52 -08:00
parent 7d413d6e34
commit d21287eace
10 changed files with 178 additions and 141 deletions

View File

@@ -14,7 +14,7 @@
import { get_current_component } from "svelte/internal";
import type { SupportedAs } from "$lib/internal/elements";
import type { HTMLActionArray } from "$lib/hooks/use-actions";
import Render from "$lib/utils/Render.svelte";
import Render, { Features } from "$lib/utils/Render.svelte";
const forwardEvents = forwardEventsBuilder(get_current_component());
export let as: SupportedAs = "div";
@@ -41,15 +41,15 @@
};
</script>
{#if visible}
<Render
{...{ ...$$restProps, ...propsWeControl }}
{as}
{slotProps}
use={[...use, forwardEvents]}
name={"DisclosurePanel"}
bind:el={$panelStore}
>
<slot {...slotProps} />
</Render>
{/if}
<Render
{...{ ...$$restProps, ...propsWeControl }}
{as}
{slotProps}
use={[...use, forwardEvents]}
name={"DisclosurePanel"}
bind:el={$panelStore}
{visible}
features={Features.RenderStrategy | Features.Static}
>
<slot {...slotProps} />
</Render>