Skip to content

Commit

Permalink
chore: added types export
Browse files Browse the repository at this point in the history
fix: changed all type imports to export file
  • Loading branch information
Craig Howell committed Oct 7, 2022
1 parent 99f7fc5 commit c03a043
Show file tree
Hide file tree
Showing 37 changed files with 88 additions and 82 deletions.
4 changes: 2 additions & 2 deletions src/lib/components/autocomplete/Autocomplete.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
</script>

<script lang="ts">
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
import { slide, scale } from 'svelte/transition';
import { clickOutside } from '../../actions';
import { onMount, setContext } from 'svelte';
export let leading: MaterialIcons | undefined = undefined;
export let leading: MaterialIcon | undefined = undefined;
export let name: string;
export let label: string | undefined = undefined;
export let srOnly = false;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/avatar-group/Icon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import { AVATAR_GROUP_AVATAR_PLACEHOLDER_CONTEXT_ID } from './Placeholder.svelte';
import { getContext } from 'svelte/internal';
import { useContext } from '../../utils/useContext';
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
export let icon: MaterialIcons = 'person';
export let icon: MaterialIcon = 'person';
useContext({
context_id: AVATAR_GROUP_CONTEXT_ID,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/avatar/Icon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import { AVATAR_PLACEHOLDER_CONTEXT_ID } from './Placeholder.svelte';
import { getContext } from 'svelte/internal';
import { useContext } from '../../utils/useContext';
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
export let icon: MaterialIcons = 'person';
export let icon: MaterialIcon = 'person';
useContext({
context_id: AVATAR_CONTEXT_ID,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/breadcrumbs/Icon.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script lang="ts">
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
import { twMerge } from 'tailwind-merge';
import { BREADCRUMBS_CONTEXT_ID } from './Breadcrumbs.svelte';
import { BREADCRUMBS_CRUMB_CONTEXT_ID } from './Crumb.svelte';
import { useContext } from '../../utils/useContext';
export let icon: MaterialIcons;
export let icon: MaterialIcon;
useContext({
context_id: BREADCRUMBS_CONTEXT_ID,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/button-group/Icon.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script lang="ts">
import { scale } from 'svelte/transition';
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
import { twMerge } from 'tailwind-merge';
import { BUTTON_GROUP_CONTEXT_ID } from './ButtonGroup.svelte';
import { useContext } from '../../utils/useContext';
import { BUTTON_GROUP_BUTTON_CONTEXT_ID } from './Button.svelte';
export let icon: MaterialIcons;
export let icon: MaterialIcon;
useContext({
context_id: BUTTON_GROUP_CONTEXT_ID,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/button/Icon.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script lang="ts">
import { scale } from 'svelte/transition';
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
import { twMerge } from 'tailwind-merge';
import { BUTTON_CONTEXT_ID } from './Button.svelte';
import { useContext } from '../../utils/useContext';
import { getContext } from 'svelte';
export let icon: MaterialIcons;
export let icon: MaterialIcon;
useContext({
context_id: BUTTON_CONTEXT_ID,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/card/Action.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { CARD_CONTEXT_ID } from './Card.svelte';
import { CARD_ACTIONS_CONTEXT_ID } from './Actions.svelte';
import { useContext } from '../../utils/useContext';
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
import HoverBackground from '../HoverBackground.svelte';
import { current_component } from 'svelte/internal';
Expand All @@ -12,7 +12,7 @@
export let use: ActionArray = [];
const forwardEvents = forwardEventsBuilder(current_component);
export let icon: MaterialIcons;
export let icon: MaterialIcon;
export let label: string | undefined = undefined;
useContext({
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/carousel/Carousel.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import type { Slide } from '../../types/carousel-slide';
import type { CarouselSlide } from '../../types';
export let slides: Slide[] = [];
export let slides: CarouselSlide[] = [];
export let activeSlide = 0;
export let rotation = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/currency/Currency.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts">
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
import { slide, scale } from 'svelte/transition';
export let trailing: MaterialIcons | undefined = undefined;
export let trailing: MaterialIcon | undefined = undefined;
export let name: string;
export let label: string | undefined = undefined;
export let srOnly = false;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/datepicker/DateInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import dayjs, { Dayjs } from 'dayjs';
import Input from '../input';
import Dropdown from '../dropdown';
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
const innerStore = writable(null as Dayjs | null);
const store = (() => {
Expand All @@ -25,7 +25,7 @@
};
})();
export let trailing: MaterialIcons | undefined = 'calendar_month';
export let trailing: MaterialIcon | undefined = 'calendar_month';
export let name: string;
export let label: string | undefined = undefined;
export let srOnly = false;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/divider/Icon.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts">
import type MaterialIcons from '$lib/types/material-icons';
import type { MaterialIcon } from '../../types';
import { twMerge } from 'tailwind-merge';
export let icon: MaterialIcons;
export let icon: MaterialIcon;
const defaultClass =
'material-icons px-2 bg-light-surface dark:bg-dark-surface text-light-content dark:text-dark-content';
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/empty/Icon.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts">
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
import { twMerge } from 'tailwind-merge';
export let icon: MaterialIcons;
export let icon: MaterialIcon;
const defaultClass = 'material-icons text-light-icon dark:text-dark-icon mx-auto text-5xl';
const finalClass = twMerge(defaultClass, $$props.class);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/feed/Icon.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts">
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
import { twMerge } from 'tailwind-merge';
export let icon: MaterialIcons;
export let icon: MaterialIcon;
const defaultClass = 'material-icons text-xl text-white bg-primary';
const finalClass = twMerge(defaultClass, $$props.class);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/icon/Icon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
export let use: ActionArray = [];
const forwardEvents = forwardEventsBuilder(current_component);
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
export let icon: MaterialIcons;
export let icon: MaterialIcon;
const defaultClass = 'material-icons';
const finalClass = twMerge(defaultClass, $$props.class);
Expand Down
6 changes: 3 additions & 3 deletions src/lib/components/input/Input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
export let use: ActionArray = [];
const forwardEvents = forwardEventsBuilder(current_component);
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
import { slide, scale } from 'svelte/transition';
import Swap from '../swap';
export let leading: MaterialIcons | undefined = undefined;
export let trailing: MaterialIcons | undefined = undefined;
export let leading: MaterialIcon | undefined = undefined;
export let trailing: MaterialIcon | undefined = undefined;
export let name: string;
export let type: 'text' | 'email' | 'password' = 'text';
export let label: string | undefined = undefined;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/layout/BottomNavigationItem.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts" context="module">
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
export interface IBottomNavigationItem {
onClick: () => void;
icon: MaterialIcons;
icon: MaterialIcon;
label: string;
}
</script>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/lightbox/Control.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts">
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
import { twMerge } from 'tailwind-merge';
export let icon: MaterialIcons;
export let icon: MaterialIcon;
const defaultClass =
'relative cursor-pointer flex items-center justify-center h-12 w-12 bg-white bg-opacity-10 rounded-full transition-reveal scale-90 hover:scale-100 hover:bg-opacity-20 hover:active:scale-95 pointer-events-auto text-light-surface';
Expand Down
7 changes: 3 additions & 4 deletions src/lib/components/lightbox/LightBox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@
import { crossfade } from '../../utils/crossfade';
import { fade, fly, scale } from 'svelte/transition';
import type { Slide } from '../../types/carousel-slide';
import type { Action } from '../../types/lightbox-action';
import type { CarouselSlide, LightboxAction } from '../../types';
import Control from './Control.svelte';
import Portal from '../portal/Portal.svelte';
export let slides: Slide[] = [];
export let slides: CarouselSlide[] = [];
export let activeSlide = 0;
export let handleClose: () => void;
export let showClose = true;
export let allowRotation = true;
export let allowPrint = true;
export let allowDownload = true;
export let actions: Action[] = [];
export let actions: LightboxAction[] = [];
const [send, receive] = crossfade;
let rotation = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/list/Icon.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts">
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
import { twMerge } from 'tailwind-merge';
export let icon: MaterialIcons;
export let icon: MaterialIcon;
const defaultClass = 'material-icons text-2xl text-white bg-primary';
const finalClass = twMerge(defaultClass, $$props.class);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/menu/Icon.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts">
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
import { twMerge } from 'tailwind-merge';
export let icon: MaterialIcons;
export let icon: MaterialIcon;
const defaultClass = 'material-icons h-6 w-6 min-h-6 min-w-6 mr-3';
const finalClass = twMerge(defaultClass, $$props.class);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/post/Action.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { POST_CONTEXT_ID } from './Post.svelte';
import { POST_ACTIONS_CONTEXT_ID } from './Actions.svelte';
import { useContext } from '../../utils/useContext';
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
import HoverBackground from '../HoverBackground.svelte';
import { current_component } from 'svelte/internal';
Expand All @@ -12,7 +12,7 @@
export let use: ActionArray = [];
const forwardEvents = forwardEventsBuilder(current_component);
export let icon: MaterialIcons;
export let icon: MaterialIcon;
export let label: string | undefined = undefined;
useContext({
Expand Down
7 changes: 3 additions & 4 deletions src/lib/components/post/Images.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import { twMerge } from 'tailwind-merge';
import { useContext } from '../../utils/useContext';
import { POST_CONTEXT_ID } from './Post.svelte';
import type { Slide } from '../../types/carousel-slide';
import type { Action } from '../../types/lightbox-action';
import type { CarouselSlide, LightboxAction } from '../../types';
import { current_component } from 'svelte/internal';
import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions';
Expand All @@ -14,12 +13,12 @@
export let use: ActionArray = [];
const forwardEvents = forwardEventsBuilder(current_component);
export let images: Slide[] = [];
export let images: CarouselSlide[] = [];
export let handleClick: ((index: number) => void) | undefined = undefined;
export let includeLightBox = true;
export let activeSlide = 0;
export let showClose = true;
export let lightboxActions: Action[] = [];
export let lightboxActions: LightboxAction[] = [];
let lightBoxOpen = false;
let lightBox1Open = false;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/select/Select.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script lang="ts">
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
import { slide, scale } from 'svelte/transition';
import { clickOutside } from '../../actions';
import HoverBackground from '../HoverBackground.svelte';
import { onMount } from 'svelte';
export let leading: MaterialIcons | undefined = undefined;
export let leading: MaterialIcon | undefined = undefined;
export let name: string;
export let label: string | undefined = undefined;
export let srOnly = false;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/statistic/Icon.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts">
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
import { twMerge } from 'tailwind-merge';
export let icon: MaterialIcons;
export let icon: MaterialIcon;
const defaultClass = 'material-icons text-5xl text-light-content dark:text-dark-content';
const finalClass = twMerge(defaultClass, $$props.class);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/tabs/Icon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import { useContext } from '../../utils/useContext';
import { getContext } from 'svelte';
import type { Writable } from 'svelte/store';
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
import { twMerge } from 'tailwind-merge';
export let icon: MaterialIcons;
export let icon: MaterialIcon;
useContext({
context_id: TABS_CONTEXT_ID,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/timeline/Item.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import type MaterialIcons from '../../types/material-icons';
import type { MaterialIcon } from '../../types';
import Avatar from '../avatar';
import { formatDate } from '../../utils/formatDate';
Expand All @@ -8,7 +8,7 @@
export let creator: string;
export let created: Date;
export let description: string;
export let icon: MaterialIcons | undefined = undefined;
export let icon: MaterialIcon | undefined = undefined;
</script>

{#if type === 'comment'}
Expand Down
8 changes: 8 additions & 0 deletions src/lib/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { Slide as CarouselSlide } from './carousel-slide';
import type { Action as LightboxAction } from './lightbox-action';
import type MaterialIcon from './material-icons';
import type { TableColumn } from './table-column';
import type { TimelineItem } from './timeline-item';
import type TwSizes from './twSizes';

export { CarouselSlide, LightboxAction, MaterialIcon, TableColumn, TimelineItem, TwSizes };
4 changes: 2 additions & 2 deletions src/lib/types/lightbox-action.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type MaterialIcons from './material-icons';
import type { MaterialIcon } from './';

export interface Action {
icon: MaterialIcons;
icon: MaterialIcon;
action: () => void;
}
4 changes: 2 additions & 2 deletions src/lib/types/material-icons.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type MaterialIcons =
type MaterialIcon =
| '123'
| '360'
| '10k'
Expand Down Expand Up @@ -2273,4 +2273,4 @@ type MaterialIcons =
| 'zoom_out'
| 'zoom_out_map';

export default MaterialIcons;
export default MaterialIcon;
Loading

0 comments on commit c03a043

Please sign in to comment.