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

@qoh/core-angular

v1.0.0-rc.13

Published

Provide the QueenofheartsService when bootstrapping the app. The QueenofheartsService can use the execQuery-API of a QueenOfHearts-Server and/or send http-requests to any backend. To select which component is used to render the data the components are i

Downloads

213

Readme

@qoh/core-angular

Setup

Provide the QueenofheartsService when bootstrapping the app. The QueenofheartsService can use the execQuery-API of a QueenOfHearts-Server and/or send http-requests to any backend. To select which component is used to render the data the components are identified using the field provided in componentIdentifier.

Bootstrap

Provide the API Token as well as a backend which is initialized with the CMS Token:

bootstrapApplication(AppComponent, {
  providers: [{ provide: 'apiToken', useValue: environment.APITOKEN }, { provide: 'backend', useValue: new DatoCMS(environment.CMSTOKEN) }, QueenofheartsService],
}).catch((err) => console.error(err));

Load data

import { QueenofheartsService, Filter } from '@qoh/core-angular';
const filter = [{ name: filtername, operator: Filter.eq, value: filtervalue }];
const introspectionDepth = 10;
let data = await this.qohService.query(queryName, {
  filter: filter,
  depth: introspectionDepth,
});

Implement and register Components

Your components should implement the QueenofheartsTemplate.

types

Starting development, all components may use the AnyComponent type. With larger backends, this may cause slow queries, so the requested data can be tailored by each component.

This is done by creating a class extending QohComponentData that includes the fields the component uses. For example. If the fields title and subtitle are the only used fields of a component, the data definition looks like this:

class TextData implements QohComponentData{
  __typename="TextRecord",
  title: string,
  subtitle: string
}

This way all the other properties that may be provided by the CMS are automatically stripped from the query.

Types can also be complex types, depending on the CMS. A field with an image for example might look like this:

class ImageData implements QohComponentData{
  __typename="ResponsiveImage",
  title: string,
  width: number,
  hieght: number,
  image: {src:string}
}

Complexity may also be several levels deep.

eager loading:

Call

registerComponent(Component, type, "IDENTIFIER")

for each component to make it available for the QueenofheartsRenderComponent.

IDENTIFIER is the value that component has for the provided componentIdentifier.

lazy loading:

Call

registerLazyComponent(async () => import('COMPONENT-FILE').then(m => m.CLASSNAME), type "IDENTIFIER");

so that the QueenofheartsRenderComponent can lazy-load it.


Render Data

use the QueenofheartsRenderComponent and pass the json for a component to it as data

<queenofhearts-renderer [data]="JSON-DATA"></queenofhearts-renderer>

Debugger

the QueenOfHearts-Debugger is a Chrome-Extension which shows additional data and creates templates for unregistered Components.

To be able to list the available queries for a QueenOfHearts-backend the application has to be bootstrapped with the variables used for the execQuery-API