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

@material-dev/angular-fontselect-volusion

v0.13.12

Published

A fontselect directive for AngularJS

Downloads

5

Readme

Angular Font-Selector

Build Status Coverage Status

A font selection directive for AngularJS - Try it, it's beautiful.

Breaking Changes

0.13

0.12

  • jdFontselect.fonts has been renamed to jdFontselectFonts
  • jdFontlist.controller has been renamed to jdFontlistController

In order to enable usage of ngAnnotate.

Usage

install bower package:

bower install angular-fontselect --save

add scripts and styles to your project

<script type="bower_components/angular-fontselect/dist/libs/webfontloader.js"></script>
<script type="bower_components/angular-fontselect/dist/angular-fontselect.js"></script>
<link rel="stylesheet" type="text/css" href="bower_components/angular-fontselect/dist/angular-fontselect.css">

or use wiredep

set as dependency in your module

angular.module('myModule', ['jdFontselect']);

use the directive in your views

<h1>Now select a font:</h1>
<jd-fontselect />

Api Keys

You can provide your production API Keys by setting them as a constant in your application. Get one from the Google Developers Console.

angular.module('myApp', ['jdFontselect']).constant('jdFontselectConfig', {
  googleApiKey: '__yourKeyHere__'
});

Directive Attributes

Current State

<jd-fontselect state="myStateObject" />

The State object is meant to be read only and can be used for initiation with a certain state.

// $scope.myStateObject
{
  sort: {               // Sort the list by a given font attribute
    attr: 'name',       // Can be: 'name', 'popularity', 'lastModified'
    direction: true
  },
  providers: {          // Filter the list by Font provider
    google: true,
    websafe: true
  },
  category: undefined,  // Filter. Can be: undefined (all), 'sansserif',
                        //   'serif', 'handwriting', 'display', 'other'
  font: {               // The current font object
    subsets: [ ... ],   // List of supported subsets
    variants: [ ... ],  // List of available Variants
    name: '',           // Name of the font (As displayed in the list)
    popularity: 0,      // Popularity of the font
    key: '',            // Lower-cased alpha only version of the name
    lastModified: 0,    // Timestamp
    stack: '',			// For example '"Open Sans", sans-serif'
    category: ''        // 'sansserif', 'serif', 'handwriting', 'display', 'other'
  },
  search: '',            // Current search string
  subsets: {            // Filter: Object of subsets supported by google
    latin: true
    // [ ... ]
  }
}

Current Stack

<jd-fontselect stack="myFontStack" />

The Font stack can be used in CSS like this

<h1 style="font-family: {{myFontStack}};">Look at this font</h1>

You can change the current font in the selection by giving $scope.myFontStack a value (for example Helvetica, Verdana, sans-serif)

Current Font Name

<jd-fontselect name="myFontName" />

Read-Only. $scope.myFontName now contains the current font name

Translate

<jd-fontselect text="myTranslationObject" />
<jd-fontselect rawText="{ toggleOpenLabel: 'Mach uff!', ... }" />

The text attribute contains a translation object, the rawtext object contains a string, evaluating into a translation object.

// $scope.myTranslationObject
{
  toggleOpenLabel: 'open',
  toggleCloseLabel: 'close',
  searchToggleLabel: 'Search',
  search: 'Search by Fontname',
  toggleSearchLabel: 'Choose Font',
  providerLabel: 'Providers',
  subsetLabel: 'Subsets',
  styleLabel: 'Categories',
  settingsLabel: 'Settings',
  noResultsLabel: 'No Fonts found.',
  pageLabel: 'Page: ',
  fontFabel: 'Fonts: ',
  closeButton: 'Close',
  allFontsListHeadline: 'All Fonts',
  curatedFontsListHeadline: 'Curated Fonts',
  page: {
    prev: '▲',
    next: '▼'
  },
  provider: {
    websafe: 'Websafe Fonts',
    google: 'Google Fonts'
  },
  category: {
    serif: 'Serif',
    sansserif: 'Sans Serif',
    display: 'Display',
    handwriting: 'Handwriting',
    other: 'Other'
  },
  subset: {
    cyrillic: 'Cyrillic',
    'cyrillic-ext': 'Cyrillic Extended',
    greek: 'Greek',
    'greek-ext': 'Greek Extended',
    latin: 'Latin',
    'latin-ext': 'Latin Extended',
    vietnamese: 'Vietnamese',
    devanagari: 'Devanagari',
    khmer: 'Khmer'
  },
  sort: {
    popularity: 'Popularity',
    name: 'Alphabet',
    lastModified: 'Latest'
  },
  sortdir: {
    desc: '▼',
    asc: '▲'
  }
}

On Initiation

<jd-fontselect on-init="myInitiation($scope, $element)" />

This calls $scope.myInitiation with the font selection scope and element once the selection is initiated.

Curated Fonts

In order to show a list of curated fonts on top the list with all fonts configure the jdfsCuratedFontsProvider with an array of ${font.provider}.${font.key}-strings.

angular.module('myApp', ['jdFontselect'])
  .config(function (jdfsCuratedFontsProvider) {
    jdfsCuratedFontsProvider.setCuratedFontKeys(['websafe.timesnewroman', 'google.alef']);
  });

see demo

Contributing

The CONTRIBUTE.md contains a lot of notes and tips to kickstart your development environment.

LICENSE

The MIT License

Copyright (c) 2015 Jimdo GmbH http://jimdo.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.