Git Product home page Git Product logo

shinokada / svelte-heros-v2 Goto Github PK

View Code? Open in Web Editor NEW
41.0 4.0 3.0 9.5 MB

Hero Icons v2 for Svelte. You can select outline and solid icons using the variation props. Svlete-Heros support major CSS framework. You can add additional CSS using the `class` props.

Home Page: https://svelte-heros-v2.codewithshin.com

License: Apache License 2.0

JavaScript 0.96% TypeScript 0.05% HTML 0.20% Svelte 97.81% CSS 0.98%

svelte-heros-v2's Introduction

Svelte Heros v2

Sponsor npm Created by Shin Okada License npm

If you are looking for the version 1, go to Svelte-Heros

Hero Icons v2 uses Heroicon v2 to create Svelte SVG icons. You can select outline and solid icons using the variation props. Svlete-Heros support major CSS framework. You can add additional CSS using the class props.

Thank you for considering my open-source package. If you use it in a commercial project, please support me by sponsoring me on GitHub: https://github.com/sponsors/shinokada. Your support helps me maintain and improve this package for the benefit of the community.

Docs

See the Svelte Heros V2 documentation to learn more.

Icons

Repo

GitHub Repo

Installation

pnpm i -D svelte-heros-v2

Original source

tailwindlabs/heroicons

License

Svelte-Heros-V2 License

tailwindlabs/heroicons LICENSE

Other icons

Svelte-Icon-Sets

svelte-heros-v2's People

Contributors

github-actions[bot] avatar samuba avatar shinokada avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

svelte-heros-v2's Issues

[FEAT]: Improve preview in REPL

Description

First of all, thanks for your work! It's super useful :)

One of the issues I encounter is with the REPL. It's always hard to find an icon and the matching name.
Imo, it would be super useful if the icon name is displayed alongside the icon.

I suggest you this solution:

<script>
	import * as Icons from 'svelte-heros-v2';
	const random_hex_color_code = () => {
		let n = (Math.random() * 0xfffff * 1000000).toString(16);
		return '#' + n.slice(0, 6);
	};
</script>

<div class="container">
	{#each Object.entries(Icons) as [name, component]}
		<div class="icon">
			<svelte:component this={component} color={random_hex_color_code()} />
			{name}
		</div>
	{/each}
</div>

<style>
	.container {
		display: grid;
		grid-template-columns: 1fr 1fr 1fr;
		gap: 8px;
	}

	.icon {
		display: flex;
		gap: 4px;
		align-items: center;
	}
</style>

Additional Information

No response

Importing custom svg icon

Describe the bug

Hi, how to import custom svg icons.

Reproduction

none

Version and System Info

MacOS Somona

[BUG]: Getting "Cannot find module 'svelte-heros-v2/Plus.svelte' or its corresponding type"

Description of the bug

When importing an icon using this method import Plus from 'svelte-heros-v2/Plus.svelte';, I get an error saying "Cannot find module 'svelte-heros-v2/Plus.svelte' or its corresponding type".

importing as import { Plus } from 'svelte-heros-v2': works also but without the error.

The code runs but I need to get rid of the error. I have the latest version of everything installed.

Steps To Reproduce

Try to import an icon in a svelte component.

Additional Information

No response

[BUG]: Seems v2 need v1?

Description of the bug

use svelte-heros-v2, without v1, on start got error:

Cannot find module 'svelte-heros' imported from
'xxx/node_modules/.pnpm/[email protected]/node_modules/flowbite-svelte/accordions/AccordionItem.svelte'

If v2 depends on v1 to work, then might should mention that in README.

But, IMO, v2 should not need v1, otherwise when import icon in .svelte file, it will show both icons, which may be a bit mess.

Steps To Reproduce

  • pnpm rm svelte-heros
  • pnpm add svelte-heros-v2@latest
  • pnpm prune
  • pnpm dev
    on start, will get above error,

Additional Information

No response

[BUG]: Upgrading to V2 made my Svelteapp crash

Description of the bug

Hey there. Thanks for creating this useful little module.

I've upgraded from V1 and spent quite some time troubleshooting why my app crashes with a "500 Internal server error", while there were no errors shown in the console.

The reason for the crash was that I referenced an icon ArrowNarrowDown that is no longer present in
svelte-heros-v2. Possibly this is less a problem of this library but one of Vite or Sveltekit. Maybe you have an idea how I could dedect such a problem in the future.

Thanks a lot. Have a nice day! :)

Michael

Steps To Reproduce

  1. Create a new Sveltekit app (latest Sveltekit version)
  2. import { ArrowNarrowDown } from 'svelte-heros-v2';

Additional Information

No response

[BUG]: Different Names than original

Description of the bug

Hey, thank you fro your great work!

One question I have... why have you chosen different icon names than in the original library?

original: x-circle
svelte-heros-v2: XCircle

Steps To Reproduce

Documentation

Additional Information

No response

Italic icon missing

Describe the bug

The Italic icon is missing from the library

Reproduction

Not required

Version and System Info

Svelte, MacOS

[Vulnerbability]: XSS Cross Site Scripting

Description of the bug

Based on the code, I saw the rendering method is using String Template literals to process the color user just gives.

Exploit
Screenshot Exploit

Prove of Concept
Screenshot PoC

Steps To Reproduce

  1. write the XSS in the parameter, ex. color, strokeWeight, etc...
  2. execute the site you are running.
  3. got the alert popup

Additional Information

No response

[BUG]: Solid Icons are not solid filled

Description of the bug

Solid icons are no longer solid fill.

image

Steps To Reproduce

  1. Pick the Star Icon
  2. The Solid variation is not filled
<Icon name="star-solid" class="text-green-500" />

I'm trying to upgrade to v 0.8.2 and is seeing this regression.

Additional Information

No response

[FEAT]: Mini variation

Description

Would love to be able to use the "Mini" variation with all the icons. It's especially useful in header elements and form components. Saves time playing with the icon sizes and a lot of component libraries utilize it so it'd make it easier to implement them.
image

Additional Information

No response

[BUG]: Icons should not be focusable

Description of the bug

I noticed that unlike in svelte-heros-v1 the icons receive a focus when tabbing through the focusable elements. I think this shouldn't happen.

Steps To Reproduce

  1. Use any Icon
  2. Use TAB

Additional Information

No response

[FEAT]: Global default for variation

Description

I've been looking at this upcoming PR:

#21

Thinking it would be useful to be able to control the solid | outline | mini defaults at a global level rather than having to apply "solid" to every image.

Something like this could work:

SvelteHeroes.defaultVariation = SvelteHeroes.solid;

Likewise setting the size globally could also be useful.

Cheers,
Matt

Additional Information

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.