Skip to content

Commit

Permalink
docs: added todos for components needed docs
Browse files Browse the repository at this point in the history
fix(Layout): forward all events including child components
  • Loading branch information
N00nDay committed Oct 14, 2022
1 parent 9c7c1a6 commit 8009171
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/lib/components/grid/Col.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@
>
<slot />
</div>
<!-- TODO: add documentation -->
1 change: 1 addition & 0 deletions src/lib/components/grid/Row.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@
>
<slot />
</div>
<!-- TODO: add documentation -->
1 change: 1 addition & 0 deletions src/lib/components/icon/Icon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
use:forwardEvents
{...exclude($$props, ['use', 'class'])}>{icon}</span
>
<!-- TODO: add documentation -->
12 changes: 11 additions & 1 deletion src/lib/components/layout/Body.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
import { getContext } from 'svelte/internal';
import type { Writable } from 'svelte/store';
import { LAYOUT_CONTENT_CONTEXT_ID } from './Content.svelte';
import { get_current_component } from 'svelte/internal';
import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions';
export let use: ActionArray = [];
import { exclude } from '../../utils/exclude';
const forwardEvents = forwardEventsBuilder(get_current_component());
useContext({
context_id: LAYOUT_CONTEXT_ID,
Expand All @@ -31,6 +36,11 @@
$: finalClass = twMerge(defaultClass, $$props.class);
</script>

<div class={finalClass} style={$$props.style}>
<div
class={finalClass}
use:useActions={use}
use:forwardEvents
{...exclude($$props, ['use', 'class'])}
>
<slot />
</div>
12 changes: 11 additions & 1 deletion src/lib/components/layout/BottomNavigation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
import { useContext } from '../../utils/useContext';
import { LAYOUT_CONTEXT_ID } from './Layout.svelte';
import { twMerge } from 'tailwind-merge';
import { get_current_component } from 'svelte/internal';
import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions';
export let use: ActionArray = [];
import { exclude } from '../../utils/exclude';
const forwardEvents = forwardEventsBuilder(get_current_component());
useContext({
context_id: LAYOUT_CONTEXT_ID,
Expand All @@ -22,6 +27,11 @@
$: finalClass = twMerge(defaultClass, $$props.class);
</script>

<div class={finalClass} style={$$props.style}>
<div
class={finalClass}
use:useActions={use}
use:forwardEvents
{...exclude($$props, ['use', 'class'])}
>
<slot />
</div>
12 changes: 11 additions & 1 deletion src/lib/components/layout/BottomNavigationCreateItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
import { useContext } from '../../utils/useContext';
import { LAYOUT_CONTEXT_ID } from './Layout.svelte';
import { BOTTOM_NAVIGATION_CONTEXT_ID } from './BottomNavigation.svelte';
import { get_current_component } from 'svelte/internal';
import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions';
export let use: ActionArray = [];
import { exclude } from '../../utils/exclude';
const forwardEvents = forwardEventsBuilder(get_current_component());
useContext({
context_id: LAYOUT_CONTEXT_ID,
Expand All @@ -21,7 +26,12 @@
export let open = false;
</script>

<div class="relative h-full w-full">
<div
class="relative h-full w-full"
use:useActions={use}
use:forwardEvents
{...exclude($$props, ['use', 'class', 'style'])}
>
<Button
on:click
shape="circle"
Expand Down
12 changes: 11 additions & 1 deletion src/lib/components/layout/BottomNavigationItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
import { useContext } from '../../utils/useContext';
import { LAYOUT_CONTEXT_ID } from './Layout.svelte';
import { BOTTOM_NAVIGATION_CONTEXT_ID } from './BottomNavigation.svelte';
import { get_current_component } from 'svelte/internal';
import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions';
export let use: ActionArray = [];
import { exclude } from '../../utils/exclude';
const forwardEvents = forwardEventsBuilder(get_current_component());
useContext({
context_id: LAYOUT_CONTEXT_ID,
Expand All @@ -34,7 +39,12 @@
$: finalClass = twMerge(defaultClass, $$props.class);
</script>

<div on:click on:keypress class={finalClass} style={$$props.style}>
<div
class={finalClass}
use:useActions={use}
use:forwardEvents
{...exclude($$props, ['use', 'class'])}
>
{#if icon}
<span class="relative z-10 material-icons">{icon}</span>
{/if}
Expand Down
12 changes: 11 additions & 1 deletion src/lib/components/layout/Content.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
import { setContext } from 'svelte/internal';
import { twMerge } from 'tailwind-merge';
import { writable } from 'svelte/store';
import { get_current_component } from 'svelte/internal';
import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions';
export let use: ActionArray = [];
import { exclude } from '../../utils/exclude';
const forwardEvents = forwardEventsBuilder(get_current_component());
export let collapsed = false;
export let collapsedWidth = '4.5rem';
Expand Down Expand Up @@ -38,6 +43,11 @@
$: finalClass = twMerge(defaultClass, $$props.class);
</script>

<div class={finalClass} style={$$props.style}>
<div
class={finalClass}
use:useActions={use}
use:forwardEvents
{...exclude($$props, ['use', 'class'])}
>
<slot />
</div>
12 changes: 11 additions & 1 deletion src/lib/components/layout/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
import { useContext } from '../../utils/useContext';
import { LAYOUT_CONTEXT_ID } from './Layout.svelte';
import { twMerge } from 'tailwind-merge';
import { get_current_component } from 'svelte/internal';
import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions';
export let use: ActionArray = [];
import { exclude } from '../../utils/exclude';
const forwardEvents = forwardEventsBuilder(get_current_component());
useContext({
context_id: LAYOUT_CONTEXT_ID,
Expand All @@ -22,7 +27,12 @@
$: finalClass = twMerge(defaultClass, $$props.class);
</script>

<header class={finalClass} style={$$props.style}>
<header
class={finalClass}
use:useActions={use}
use:forwardEvents
{...exclude($$props, ['use', 'class'])}
>
<slot />
<slot name="extra" />
</header>
12 changes: 11 additions & 1 deletion src/lib/components/layout/HeaderExtra.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
import { LAYOUT_HEADER_CONTEXT_ID } from './Header.svelte';
import { useContext } from '../../utils/useContext';
import { twMerge } from 'tailwind-merge';
import { get_current_component } from 'svelte/internal';
import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions';
export let use: ActionArray = [];
import { exclude } from '../../utils/exclude';
const forwardEvents = forwardEventsBuilder(get_current_component());
useContext({
context_id: LAYOUT_CONTEXT_ID,
Expand All @@ -19,6 +24,11 @@
$: finalClass = twMerge(defaultClass, $$props.class);
</script>

<div class={finalClass} style={$$props.style}>
<div
class={finalClass}
use:useActions={use}
use:forwardEvents
{...exclude($$props, ['use', 'class'])}
>
<slot />
</div>
12 changes: 11 additions & 1 deletion src/lib/components/layout/Layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
import { setContext } from 'svelte';
import { writable } from 'svelte/store';
import { twMerge } from 'tailwind-merge';
import { get_current_component } from 'svelte/internal';
import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions';
export let use: ActionArray = [];
import { exclude } from '../../utils/exclude';
const forwardEvents = forwardEventsBuilder(get_current_component());
let sideBarWidth = writable('212');
Expand All @@ -27,6 +32,11 @@
$: finalClass = twMerge(defaultClass, $$props.class);
</script>

<div class={finalClass} style={$$props.style}>
<div
class={finalClass}
use:useActions={use}
use:forwardEvents
{...exclude($$props, ['use', 'class'])}
>
<slot />
</div>
12 changes: 11 additions & 1 deletion src/lib/components/layout/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
import { LAYOUT_CONTENT_CONTEXT_ID } from './Content.svelte';
import type { Writable } from 'svelte/store';
import { getContext } from 'svelte';
import { get_current_component } from 'svelte/internal';
import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions';
export let use: ActionArray = [];
import { exclude } from '../../utils/exclude';
const forwardEvents = forwardEventsBuilder(get_current_component());
useContext({
context_id: LAYOUT_CONTEXT_ID,
Expand Down Expand Up @@ -32,7 +37,12 @@
$: finalClass = twMerge(defaultClass, $$props.class);
</script>

<div class={finalClass} style={$$props.style}>
<div
class={finalClass}
use:useActions={use}
use:forwardEvents
{...exclude($$props, ['use', 'class'])}
>
<div
class="h-full flex flex-col transition-size duration-300"
style="width: {$collapsed ? $collapsedWidth : $expandedWidth}"
Expand Down

0 comments on commit 8009171

Please sign in to comment.