@icepanel/core-frontend
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

IcePanel Core Frontend

npm version npm size npm downloads github issues github prs

This package provides the Angular module required for creating frontend components for IcePanel plugins.

Installation

First install the package into your project.

npm install @icepanel/core @icepanel/core-frontend
yarn add @icepanel/core @icepanel/core-frontend

Usage

You can then import the Angular module and define the components which should be used.

import { IModel, PluginType } from '@icepanel/core'
import { IcePanelFrontendModule, IFrontendModule } from '@icepanel/core-frontend'
import { PrototypeComponent } from './prototype'
import { EnvironmentComponent } from './environment'

@NgModule({
  imports: [IcePanelFrontendModule],
  declarations: [PrototypeComponent, EnvironmentComponent],
  entryComponents: [PrototypeComponent, EnvironmentComponent]
})
export class FrontendModule implements IFrontendModule {
  environmentComponent(model: IModel) {
    switch (model.plugin.type) {
      case PluginType.App:
        return EnvironmentComponent
      default:
        return null
    }
  }
  prototypeComponent(model: IModel) {
    switch (model.plugin.type) {
      case PluginType.App:
        return PrototypeComponent
      default:
        return null
    }
  }
  setupComponent() {
    return null
  }
}

/@icepanel/core-frontend/

    Package Sidebar

    Install

    npm i @icepanel/core-frontend

    Weekly Downloads

    6

    Version

    0.2.0

    License

    MIT

    Unpacked Size

    27.2 kB

    Total Files

    12

    Last publish

    Collaborators

    • victor96