2020-02-14 12:51:45 +01:00
|
|
|
<script>
|
2020-02-25 16:21:23 +01:00
|
|
|
import { cssVars, createClasses } from "./cssVars"
|
2020-02-21 12:43:21 +01:00
|
|
|
|
2020-02-25 16:21:23 +01:00
|
|
|
export let className = ""
|
|
|
|
export let onLoad
|
2020-03-04 16:20:53 +01:00
|
|
|
export let type = "div"
|
2020-02-25 16:21:23 +01:00
|
|
|
export let _bb
|
2020-02-21 12:43:21 +01:00
|
|
|
|
2020-02-25 16:21:23 +01:00
|
|
|
let containerElement
|
|
|
|
let hasLoaded
|
|
|
|
let currentChildren
|
2020-02-21 12:43:21 +01:00
|
|
|
|
2020-02-25 16:21:23 +01:00
|
|
|
$: {
|
|
|
|
if (containerElement) {
|
|
|
|
_bb.attachChildren(containerElement)
|
|
|
|
if (!hasLoaded) {
|
|
|
|
_bb.call(onLoad)
|
|
|
|
hasLoaded = true
|
|
|
|
}
|
2020-02-14 12:51:45 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2020-02-25 16:21:23 +01:00
|
|
|
{#if type === 'div'}
|
2020-05-19 18:00:53 +02:00
|
|
|
<div bind:this={containerElement} />
|
2020-02-25 16:21:23 +01:00
|
|
|
{:else if type === 'header'}
|
2020-05-19 18:00:53 +02:00
|
|
|
<header bind:this={containerElement} />
|
2020-02-25 16:21:23 +01:00
|
|
|
{:else if type === 'main'}
|
2020-05-19 18:00:53 +02:00
|
|
|
<main bind:this={containerElement} />
|
2020-02-25 16:21:23 +01:00
|
|
|
{:else if type === 'footer'}
|
2020-05-19 18:00:53 +02:00
|
|
|
<footer bind:this={containerElement} />
|
2020-02-25 16:21:23 +01:00
|
|
|
{:else if type === 'aside'}
|
2020-05-19 18:00:53 +02:00
|
|
|
<aside bind:this={containerElement} />
|
2020-02-25 16:21:23 +01:00
|
|
|
{:else if type === 'summary'}
|
2020-05-19 18:00:53 +02:00
|
|
|
<summary bind:this={containerElement} />
|
2020-02-25 16:21:23 +01:00
|
|
|
{:else if type === 'details'}
|
2020-05-19 18:00:53 +02:00
|
|
|
<details bind:this={containerElement} />
|
2020-02-25 16:21:23 +01:00
|
|
|
{:else if type === 'article'}
|
2020-05-19 18:00:53 +02:00
|
|
|
<article bind:this={containerElement} />
|
2020-02-25 16:21:23 +01:00
|
|
|
{:else if type === 'nav'}
|
2020-05-19 18:00:53 +02:00
|
|
|
<nav bind:this={containerElement} />
|
2020-02-25 16:21:23 +01:00
|
|
|
{:else if type === 'mark'}
|
2020-05-19 18:00:53 +02:00
|
|
|
<mark bind:this={containerElement} />
|
2020-02-25 16:21:23 +01:00
|
|
|
{:else if type === 'figure'}
|
2020-05-19 18:00:53 +02:00
|
|
|
<figure bind:this={containerElement} />
|
2020-02-25 16:21:23 +01:00
|
|
|
{:else if type === 'figcaption'}
|
2020-05-19 18:00:53 +02:00
|
|
|
<figcaption bind:this={containerElement} />
|
2020-02-25 16:21:23 +01:00
|
|
|
{:else if type === 'paragraph'}
|
2020-05-19 18:00:53 +02:00
|
|
|
<p bind:this={containerElement} />
|
2020-02-14 12:51:45 +01:00
|
|
|
{/if}
|