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

@acpaas-ui/ngx-embeddable-widgets

v3.0.1

Published

Angular wrapper for ACPaaS UI Embeddable Widgets

Downloads

41

Readme

Embeddable Widgets Component (Angular)

This is an Angular component and decorator that wraps the ACPaaS UI Embeddable Widgets framework.

For more information on what embeddable widgets are see the link above.

There is a demo app, see below for instructions on running it.

How to use

Installing

> npm install @acpaas-ui/ngx-embeddable-widgets

Embedding a widget

Import the component in your module:

import { EmbeddableWidgetsModule } from '@acpaas-ui/ngx-embeddable-widgets';

@NgModule({
  imports: [
    ...,
    EmbeddableWidgetsModule
  ],
  ...
})

In your template:

<aui-embeddable-widget
  widgetUrl="//example.com/widget/definition.json"
  [props]="{ someProp: 'value' }">
</aui-embeddable-widget>

Supported attributes:

  • widgetUrl: the URL of the widget's JSON definition (required)
  • props: the props to pass to the embedded widget
  • overrides: overrides to specify when the widget definition is loaded (only applied once per loaded tag)
  • useGlobalLibrary: if true, uses window.auiEmbeddableWidgets instead of @acpaas-ui/embeddable-widgets

There are no events, since all event handlers are specified in props. To understand how to do this, look at the onClick event inside the example folder.

Publishing a widget

Create a page in your angular app that contains the widget.

Publish a JSON definition for your widget. For example, you can include a file widget-definition.json in the assets folder. See example/assets/widget-definition.json for an example.

Decorate the page's component:

import { EmbeddableWidget } from '@acpaas-ui/ngx-embeddable-widgets';

@Component({
  selector: 'app-widget',
  templateUrl: './widget.page.html'
})
@EmbeddableWidget('/assets/widget-definition.json')
export class WidgetPage {
// ...

  public auiOnWidgetInit(props) {
    // initialize from props here
  }

This will do the following:

  • Initialize the current page as the widget defined in the JSON.
  • Call the auiOnWidgetInit method and pass it the props specified from the container app.

Run the demo app

> npm install
> npm start

Browse to localhost:4200

Angular Universal

The <aui-embeddable-widget> component can be rendered with server-side rendering in Angular Universal.

  1. Include the following code in server.ts of your Universal app

    if (typeof window === 'undefined') {
      global['window'] = {};
    }
  2. Use <aui-embeddable-widget> in the normal way

Contributing

We welcome your bug reports and pull requests.

Please see our contribution guide.

Support

Joeri Sebrechts ([email protected])

License

This project is published under the MIT license.