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

aurelia-fast-adapter

v1.0.7

Published

Enables better interactions between Aurelia 2 applications and FAST web-components. Adds two-way binding for components and provides a FAST implementation of Aurelia Dialog Service.

Downloads

31

Readme

Aurelia FAST Adapter

Helps you build Aurelia 2 applications using FAST web-components. With it you can:

  • have two-way binding on FAST web-components
  • use the Dialog Service to handle FAST dialog web-component

Install

npm install aurelia-fast-adapter

Enable two-way binding

Simply register the FASTAdapter in your main.ts

// main.ts
import { FASTAdapter } from "aurelia-fast-adapter";

Aurelia.register(FASTAdapter);

Now your Aurelia 2 application knows how to handle two-way bindings with all FAST components.

Change FAST prefix

FAST web-components use the fast- prefix by default, but this can be changed for any implementation. You can reflect this prefix by configuring the registration as such:

// main.ts
import { FASTAdapter } from "aurelia-fast-adapter";

FASTAdapter.customize({withPrefix: 'ecos'}; // now FASTAdapter knows that your components use a different prefix, `ecos-` here

Register custom components

Before to register the FASTAdapter one can extends the public static tags property in order to add more components. For exemple:

FASTAdapter.tags['DATE-FIELD'] = ['value'];

Load the FAST implementation of the Dialog Service

The only required part is loading the custom settings and renderer instead of the default ones. This is accomplished in your main.ts like so:

Register the FAST implementation

// main.ts
import { DialogConfiguration, DialogService } from '@aurelia/dialog';
import { FASTDialogGlobalSettings, FASTDialogRenderer } from "aurelia-fast-adapter";

Aurelia..register(DialogConfiguration.customize((settings: FASTDialogGlobalSettings) => {
    settings.startingZIndex = 3;
    settings.prefix = 'ecos';
    settings.hiddenFirst = true;
  }, [DialogService, FASTDialogRenderer, FASTDialogGlobalSettings]))

But there are some settings you can leverage as well:

Change the prefix of the FAST Dialog web-component

You might be using a different prefix than fast- when registering your FAST web-components. The adapter needs to be aware of this:

// main.ts
import { DialogConfiguration, DialogService } from '@aurelia/dialog';
import { FASTDialogGlobalSettings, FASTDialogRenderer } from "aurelia-fast-adapter";

Aurelia..register(DialogConfiguration.customize((settings: FASTDialogGlobalSettings) => {
    settings.prefix = 'ecos'; // add this line here
  }, [DialogService, FASTDialogRenderer, FASTDialogGlobalSettings]))

With this in place, the Dialog Service will compose a Dialog with a component called <ecos-dialog> instead of <fast-dialog>;

Dialog animation: start with a hidden dialog

Depending on the FAST Dialog implementation, you might want the Dialog Service to add the web-component with the hidden attribute set. When doing so, you can then control how to "reveal" the dialog with some animation.

// main.ts
import { DialogConfiguration, DialogService } from '@aurelia/dialog';
import { FASTDialogGlobalSettings, FASTDialogRenderer } from "aurelia-fast-adapter";

Aurelia..register(DialogConfiguration.customize((settings: FASTDialogGlobalSettings) => {
    settings.hiddenFirst = true; // add this line
  }, [DialogService, FASTDialogRenderer, FASTDialogGlobalSettings]))

Be aware that when you do this, all Dialog will be hidden and it's now you're job to remove the hidden attribute. You can do so in the attached hook of the component loaded in the Dialog.

In this package you'll find a class that you can make your component inherit when used in a Dialog setting. It's called: FASTDialogViewModel.

import { DialogViewModel } from 'aurelia-fast-adapter';

export class DialogServiceComponent extends DialogViewModel {

  // I am component that must be loaded by the Dialog Service

}

This will automatically add the attached hook that remove the hidden attribute of the dialog in order to start CSS transition (if any). It will also add a detaching hook, returning a Promise waiting for the end of an transition.