Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pitaya-components/fab

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pitaya-components/fab

Pitaya-Framework Component FAB.

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

FAB

npm npm NPM

Description

Pitaya-framework template component.

This documentation assumes you are at least slightly familiar with aurelia and its usage. If not, we highly suggest you take a look at its Quick Start section first to get a better understanding of the approaches that are presented it here.

Screenshot

Screenshot

Demo

MDC Design & API Documentation

Installation

npm install @pitaya-components/master-component --save

Basic Usage

Import

You have a few options when importing a component into your layout:

Template
<template>
	<require from="@pitaya-components/master-component/dist/native-modules/master-component"></require>
    ...
</template>
View model
@viewResources( "@pitaya-components/master-component/dist/native-modules/master-component" )
export class MyView
{
	...
}
Global resources
export function configure( config: FrameworkConfiguration )
{
	config.globalResources( [
		PLATFORM.moduleName( "@pitaya-components/master-component/dist/native-modules/master-component" )
	] );
}

Initialization

Our components are usually initialized by defining them in your views HTML. And can be accessed afterwards in the corresponding view model.

Template
<template>
	<master-component
		view-model.ref="masterComponent"
		on-attached.call="_masterComponentHasBeenAttached(component)"
	></master-component>
	...
</template>
View model
import {MasterComponent} from "@pitaya-components/master-component";

export class MyView
{
	public component: MasterComponent;

	public doSomething()
	{
		this.component.title = "Bananarama";
	}
}

Variants

Simple component

Put different variants here

<master-component></master-component>

Event handlers

Attaching an event handler is as simple as adding on-<event>.call="<function>(<parameters>)". The function that you specify has to be defined as a method on the view model class, so that aurelias template engine can use it.

Template
<pitaya-button	
	on-click.call="myButtonHasBeenClicked(event)"
>
	BUTTON LABEL
</pitaya-button>
View model
export class MyView
{
	public myButtonHasBeenClicked(event: CustomEvent)
	{
		console.log("Event detail:", event.detail);
	}
}

You also can pass any parameter you like. Specifying event just tells the component that you wish to receive the event object, but if you define something else, it will be passed down to your function just like one would expect.

Template
<pitaya-button	
	on-click.call="myButtonHasBeenClicked('my custom message')"
>
	BUTTON LABEL
</pitaya-button>
View model
export class MyView
{
	public myButtonHasBeenClicked(message: string)
	{
		console.log(message);
	}
}

Bindables

A bindable is part of a core functionality of aurelia which basically allows you to configure a component from within your HTML code. They can be set/accessed via HTML attribute and also programmatically.

Template
<master-component	
	title="Super duper template component"
></master-component>
View model
import {MasterComponent} from "@pitaya-components/master-component";

export class MyView
{
	public component: MasterComponent;
	
	public someMethod()
	{
		this.component.title    = "Super duper template component";
	}
}

Bindable properties

Attribute / PropertyType
titlestring
on-attached( component ) => {}

Methods and properties

Method SignatureDescription
title: stringSets the title
onAttached: FunctionSets the onAttached callback
reinitialize() => Promise <void> | voidReinitializes the component

Style Customization

SASS mixins

MixinDesciption
master-component-backgroundSets the background color

With this component we are relying on the [PLACEHOLDER] component of MDC. Check out the documentation to learn how to use their SASS mixins.

Dependencies

PackageUrl
aurelia-frameworkaurelia-framework
Aurelia-typed-observable-pluginAurelia-typed-observable-plugin

Changes

The main repository uses tagged Releases to communicate changes between versions.

FAQ

Q: Why another JavaScript framework?
A: Read this article for a detailed overview of ours goals.

Reach Out!

Find us on Twitter for the latest news, and please consider giving us a ?? star on GitHub!

Support

For contributions in the form of bug fixes and changes, feel free to use Pull Requests or send us a DM on Twitter to discuss how best to approach your issue.

License

The Master component source code is licensed under the MIT license.

Keywords

FAQs

Package last updated on 24 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc