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

@uportal/waffle-menu

v1.40.2

Published

An app launcher dropdown

Downloads

103

Readme

Waffle Menu

NPM Version Maven Central Build Status

Demo

https://uportal-project.github.io/uPortal-web-components/en/components/waffle-menu/demo

Development

# clone the repository if you haven't already
git clone https://github.com/uPortal-contrib/uPortal-web-components

# navigate to the waffle menu folder
cd uPortal-web-components/@uportal/waffle-menu

# install the goods
npm install

# start the app
npm start

Build

Pretty simple:

npm run build

This will compile your JavaScript in to build/static/js/main.{buildnumbers}.js

Usage

After building, grab the compiled javascript files and place it on your page. You can now place <waffle-menu> anywhere on your page.

Since <waffle-menu> is a web component, it's usage is demonstrated in the uPortal-web-components/@uportal/waffle-menu/public/index.html file.

In index.html, you'll see that <waffle-menu /> is hard coded in place. There's supporting javascript on the page to assist in testing the component. A json variable is assigned in the header containing an array of objects as data for each of the links. Below the component, javascript is used to assign attributes to the component itself.

Here's the guts of that html file:

<waffle-menu
  debug="true"
  button-color="red"
  url="/proxy/uPortal/api/v4-3/dlm/portletRegistry.json?categoryId=local.21"
></waffle-menu>

slots

This component supports slots for a header and footer element above and below the list of icons.

<waffle-menu oidc-url="https://example.com/uPortal/api/v5-1/userinfo">
  <div slot="header">Header goes here</div>
  <div slot="footer">
    <a href="">Footer goes here</a>
  </div>
</waffle-menu>
Notice

We have a /proxy/ leading the url attribute. This is a developer convenience to be able to query against your local running instance of uPortal. The proxy is configured in package.json:

  "proxy": {
    "/proxy": {
      "target": "http://localhost:8080",
      "changeOrigin": true,
      "pathRewrite": {
        "^/proxy": "/"
      }
    }
  },

Attributes

<waffle-menu> takes the following attributes:

oidc-url

<waffle-menu
  oidc-url="https://example.com/uPortal/api/v5-1/userinfo"
></waffle-menu>

button-color

applies a color to the waffle menu button. Useful if you want to avoid specifying the color in CSS. If not set, button-color defaults to #ffffff.

Example:

<waffle-menu button-color="#ffffff">

menu-background-color

applies a color to the waffle menu dropdown. Useful if you want to avoid specifying the color in CSS. If not set, menu-background-color defaults to #e0e0e0.

Example:

<waffle-menu menu-background-color="#99aa99">

url

Fully qualified url pointing to the API where <waffle-menu> can find data in portlet registry format.

Example:

<waffle-menu
  url="/uPortal/api/v4-3/dlm/portletRegistry.json?categoryId=local.21"
></waffle-menu>

context-portlet-url

Common URI or URL path to target a portlet inside the portal, the fname will be appended. The default value is /uPortal/p/.

Example:

<waffle-menu context-portlet-url="/portal/p/"></waffle-menu>

debug

Disable open id connect for testing.

:warning: For testing purposes only, do not use this in production.

Example:

<waffle-menu debug="true"></waffle-menu>

Internal JSON structure

The JSON structure for the data is pretty simple. It's an array of objects, and each object containing 3 or 4 properties.

JSON object properties

| Property Name | Description | | ------------- | -------------------------------------------------------------------------------------- | | type | Either box or footer. Tells <waffle-menu> where in the menu to display the link. | | link | The url of the link item in the menu. | | label | The label to display for the link. | | image | The url of an image to use for box links. |

Waffle specific portlet parameters

For the image, the Waffle Menu searches for a waffleIconUrl, then iconUrl, and then falls back to the provided default property.

For text, the Waffle Menu searches for a waffleLabel, and falls back to the portlet's title.