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

@api-components/api-navigation

Package Overview
Dependencies
Maintainers
4
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@api-components/api-navigation

An element to display the response body

  • 4.2.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
41
increased by115.79%
Maintainers
4
Weekly downloads
 
Created
Source

Published on NPM

Build Status

Published on webcomponents.org

<api-navigation>

A navigation for an API spec generated from AMF ld+json model.

Version compatibility

This version only works with AMF model version 2 (AMF parser >= 4.0.0). For compatibility with previous model version use 3.x.x version of the component.

Usage

Installation

npm install @api-components/api-navigation --save

The element works with AMF json/ld model. When the model is set it computes list of documentation nodes, types, endpoints, methods and security schemas. As a result user can select any of the items in the UI and the application is informed about user choice via custom event.

The selection is a selected API shape @id. The application is responsible for computing the model selected by the user.

Note, this element does not contain polyfills for Array platform features.

Passive navigation

Passive navigation means that a navigation event occurred but it wasn't invoked by intentional user interaction. For example api-endpoint-documentation component renders list of documentations for HTTP methods. While scrolling through the list navigation context changes (user reads documentation of a method) but the navigation never was caused by user intentional interaction. This event, annotated with passive: true property in the detail object, prohibits other element from taking a navigation action but some may reflect the change in the UI.

In an html file

<html>
  <head>
    <script type="module">
      import '@api-components/api-navigation/api-navigation.js';
    </script>
  </head>
  <body>
    <api-navigation amf="..."></api-navigation>
  </body>
</html>

In a LitElement

import { LitElement, html } from 'lit-element';
import '@api-components/api-navigation/api-navigation.js';

class SampleElement extends LitElement {
  render() {
    return html`
    <api-navigation
      .amf="${this.amf}"
      @api-navigation-selection-changed="${this._navigationHandler}"></api-navigation>
    `;
  }

  _navigationHandler(e) {
    const { selected, type, endpointId, passive } = e.detail;
  }
}
customElements.define('sample-element', SampleElement);

Development

git clone https://github.com/advanced-rest-client/api-navigation
cd api-navigation
npm install

Running the demo locally

npm start

Running the tests

npm test

Keywords

FAQs

Package last updated on 02 Mar 2021

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