npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@soeren_balke/ng-builder

v0.3.0

Published

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.0.1. The ng-builder is a module to dynamicly build components. This Tool wrapps the angular viewContainerRef. The Components are easy to develop and use with

Downloads

42

Readme

ng-builder

This project was generated with Angular CLI version 10.0.1. The ng-builder is a module to dynamicly build components. This Tool wrapps the angular viewContainerRef. The Components are easy to develop and use with data.

Use

npm install @soeren_balke/ng-builder --save

add your Builder Components

  1. Create a module where you import the component that you use for the ng builder
@NgModule({
  imports: [
    CommonModule,
  ],
  declarations: [
    ExampleOneComponent,
    // ...
  ],
  exports: [
    ExampleOneComponent,
    // ...
  ]
})
  1. Import your and the ng builder module into your right module
@NgModule({
  declarations: [
    //...
  ],
  imports: [
    //...
    ComponentListModule, // <-- your component module
    NgBuilderModule // <-- the ng builder module
  ],
  providers: [
    //...
  ]
})
  1. create your component, which used in ng builder

component.ts

import { Builder } from '@soeren_balke/ng-builder';
export class ExampleOneComponent extends Builder implements OnInit {
}

extends Builder is for the requierd imputs and output.

| Name | Type | Description | |------|------|-------------| | data | Input | (any) This is the data for the component. Use attributes to seperate each data. | | edit | Input | (boolean - false) Enable the edit mode | | saveEdit| Output | This event fire when you hit the save button. Only enable when edit mode is activate |

component.html

<div>
  <img [src]="data.src || ''" alt="">
  <input type="text" *ngIf="edit" [(ngModel)]="data.src">
  <!-- or formControl ;) -->
</div>

<!-- This is the Edit Part -->
<div *ngIf="edit">
  <button (click)="saveEdit.emit(data)">
    save
  </button>
</div>
  1. create Service to declare your builder components
export class ComponentListService {
  private componentList = [
    {
      component: ExampleOneComponent,
      displayName: 'Example One'
    },
    //...
  ];

  constructor() { }

  getComponentList() {
    return this.componentList;
  }
}
  1. Use the ng-builder component app.component.ts
import { ViewChild } from '@angular/core';
import { NgBuilderComponent } from '@soeren_balke/ng-builder';
@ViewChild(NgBuilderComponent) ngBuilder: NgBuilderComponent;

constructor(
  private componentList: ComponentListService
) {}

ngOnInit()  {
  this.cList = this.componentList.getComponentList();
}

selectComponent(component) {
  // to use the the builde with content in the component:

  // this.ngBuilderComponentList.push({
  //   edit: false,
  //   data: {
  //     content: 'asdasd'
  //   },
  //   component: component
  // });

  this.ngBuilderComponentList.push({
    edit: true,
    component: component
  });

  this.ngBuilder.generateComponentList();
}

saveComponent(data) {
  console.log(data);
}

app.component.html

<lib-ng-builder 
  [componentList]="ngBuilderComponentList"
  (saveComponent)="saveComponent($event)">
</lib-ng-builder>

| Attribute | Type | Description | | --------- | ---- | ----------- | | componentList | BuilderComponent | { component: any; edit: boolean; data?: any; } | | saveComponent | EventErmitter | Fire when the build component fire his saveEdit Event |

Dev

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Publish

Run npm run lib:build to build the aot of library. Run npm run lib:prod to publish the build lib.

Example

Live Example: https://stackblitz.com/github/samy-blake/ng-builder