Giter Site home page Giter Site logo

Comments (8)

karsa-mistmere avatar karsa-mistmere commented on May 26, 2024 2

How about decoupling the core icon package and the Angular package to make life easier?

It's planned, see #1687

Once we do that, there will be nothing in the way of releasing a modern version of lucide-angular with proper standalone component support.

from lucide.

hakimio avatar hakimio commented on May 26, 2024 1

How about decoupling the core icon package and the Angular package to make life easier?

from lucide.

karsa-mistmere avatar karsa-mistmere commented on May 26, 2024

Hi @hakimio,

This isn't really an issue with lucide-angular, this is just how Angular works. Standalone components have no support for ModuleWithProvider declarations, if you want to use Lucide with standalone components, you already can do it, see: #1288 (comment)

Of course it would be best if we could provide a standalone component, but we can't as long as we want to retain backwards compatibility with previous versions.

Due to performance reasons I also highly advise against injecting a list of icons within every standalone component and relying instead of tree-shaken single imports (basically: only provide icons to a standalone component that the component actually uses).

from lucide.

hakimio avatar hakimio commented on May 26, 2024

Using importProvidersFrom() is not a proper solution. That's just a workaround.
You can provide your own provideLucideIcons(appIcons) at least in addition to LucideAngularModule.pick(). It wouldn't break anything.

from lucide.

hakimio avatar hakimio commented on May 26, 2024

Also, you can release a new major version of lucide-angular with breaking changes. I don't understand why in more than 3 years you haven't released any major version and kept going with 0.x releases.

from lucide.

hakimio avatar hakimio commented on May 26, 2024

makeEnvironmentProviders is available since Angular v15. Older Angular versions are not supported.

from lucide.

karsa-mistmere avatar karsa-mistmere commented on May 26, 2024

Using importProvidersFrom() is not a proper solution. That's just a workaround. You can provide your own provideLucideIcons(appIcons) at least in addition to LucideAngularModule.pick(). It wouldn't break anything.

importProvidersFrom is not something that we recommend using at all, we recommend using the dedicated injection token for this purpose as stated in #1288 (comment)

But even moreso we recommend not providing more icons than necessary, so I'd recommend using this pattern:

import { Component } from '@angular/core';
import { ActivitySquareIcon, LucideAngularModule } from 'lucide-angular';

@Component({
  selector: 'app-demo',
  standalone: true,
  imports: [LucideAngularModule],
  template: `<lucide-icon [name]="ActivitySquareIcon" />`,
})
export class DemoComponent {
  protected readonly ActivitySquareIcon = ActivitySquareIcon;
}

Also, you can release a new major version of lucide-angular with breaking changes.

Every icon is bundled within the package, should we release a new version with breaking changes, people using earlier versions of Angular would be hung out to dry, and if you look at the usage statistics of major versions, people do still use earlier versions, a lot: https://www.npmjs.com/package/@angular/core?activeTab=versions.

from lucide.

hakimio avatar hakimio commented on May 26, 2024

Awesome 🙂

from lucide.

Related Issues (20)

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.