Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add types #2

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/// <reference types="svelte" />

import { SvelteComponentTyped } from "svelte";

declare module SvgIcon {
export interface SvgIconProps {
/**
* Required. An SVG path to render as an icon
*/
path: string;
/**
* This sets the size and viewbox to match the recommended size for the icon pack specified.
*/
type?: "mdi" | "simple-icons" | "default";
/**
* The width and height of the SVG element
*/
size?: string | number;
/**
* The `viewBox` of the SVG element
*/
viewbox?: string;
/**
* One of "none", "horizontal", "vertical", or "both". Flips the icon in the specified direction(s).
*/
flip?: "none" | "horizontal" | "vertical" | "both";
/**
* Rotates the icon by the specified value. Can be any valid [CSS angle](https://developer.mozilla.org/en-US/docs/Web/CSS/angle) value.
*/
rotate?: string | number;
}
}

type Props = SvgIcon.SvgIconProps & { [attribute: string]: any };

declare class SvgIcon extends SvelteComponentTyped<Props> {}
export = SvgIcon;
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"version": "0.1.1",
"description": "Icon component for Svelte",
"main": "lib/svg-icon.svelte",
"exports": {
"types": "./index.d.ts",
"svelte": "./lib/svg-icon.svelte"
},
"directories": {
"lib": "lib",
"test": "tests"
Expand Down