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

@moki.codes/mokui-header

v1.0.0

Published

header web ui component

Downloads

3

Readme

header

Description

header block provides header component inside the holygrail layout

Installation

yarn add @moki.codes/mokui-header

Styles

@import "@moki.codes/mokui-header/dist/mokui-theme.css"
@import "@moki.codes/mokui-header/dist/mokui-layout.css"
@import "@moki.codes/mokui-header/dist/mokui-elevation.css"
@import "@moki.codes/mokui-header/dist/mokui-animation.css"
@import "@moki.codes/mokui-header/dist/mokui-header.css"

Basic Usage

<head>
        <style>
                width: calc(var(--msp-1) * 4);
                height: var(--msp-1);
                line-height: var(--msp-1);

                background-color: var(--color-on-background);
        </style>
</head>
...
<body>
<div class="theme
            theme_msp_perfect-fifth
            theme_color_light
            layout
            layout_type_holy-grail
            elevation
            animation">
        <header class="layout__header header header_fixed elevation_depth_4">
                <div class="layout__container layout__container-fluid header__container">
                        <div class="header__action header__action_primary">
                                <svg class="header__icon">
                                        ...
                                </svg>
                        </div>
                        <div class="header__action header__brand">
                                <div class="placeholder-brand elevation elevation_depth_8"></div>
                        </div>
                        <div class="header__navigation">
                                <div class="header__action header__navigation-item">
                                        item
                                </div>
                                <div class="header__action header__navigation-item">
                                        item
                                </div>
                        </div>
                        <div class="header__action header__action_secondary">
                                <svg class="header__icon" ...>
                                        ...
                                </svg>
                        </div>
                </div>
        </header>
</div>
</body>

Modificators

| name | value | description | | ----------- | ------------- | ---------------------------------------------- | | fixed | | makes header fixed |

Variables

header defines various variables which shapes its behavior:

  • --header-height

    • defined as --layout-header-height at layout level, override --layout-header-height to change appearance
  • --header-brand-size

    • defines brand height, override to change appearance
  • --header-action-size

    • defines action height and icon width and height, override to change appearance
  • --header-navigation-size

    • defines navigation height, override to change appearance

Elements

  • container
  • action
  • icon
  • brand
  • navigation
  • navigation-item

container

container for all header elements, centers child elements vertically

action

actionable item

Modificators

| name | value | description | | ----------- | ------------- | ---------------------------------------------- | | primary | | headers primary action leftmost item after | | | | brand hidden on --screen-l or above, visible | | | | otherwise | | secondary | | headers secondary action rightmost item |

icon

header action's icon

brand

headers brand leftmost item

navigation

headers navigation floats left, visible on --screen-l(as defined at the theme level) or above and hidden otherwise

navigation-item

headers navigation menu item(s) floats left

Javascript

Basic Usage

import { Header } from "@moki.codes/mokui-header";

const headerElement = document.querySelector("header");
const header = Header(headerElement);

/* when done */
header.destroy();

Exports

  • Header
  • HeaderComponent
  • HeaderAdapter
  • classes
  • strings

Header

(element: Elements): HeaderComponent<HeaderAdapter<Emitter<Component<{}>>>>

Header factory is a composition of the HeaderComponent, HeaderAdapter, Emitter, Component.

HeaderComponent

<T extends HeaderAdapter<Emitter<Component>>>( o: T = {} as T ): HeaderComponent<T>

Header Component factory provides core header functionality

Methods

| name | description | | --------------------------- | ---------------------------------------------- | | setScrollTarget | set scroll target to the provided EventTarget | | (target: EventTarget): void | target | | destroy(): | clean up routine to be called upon deleting | | HeaderComponent; | component |

HeaderAdapter

<T extends Emitter<Component>>( o: T ): HeaderAdapter<T>

Header Adapter factory provides default adapter functionality, one can override partially or completely used by HeaderComponent.

events

| name | Description | | ------------------------------------- | ------------------------------------ | | mokui-header:action-primary-clicked | header action primary clicked | | mokui-header:action-secondary-clicked | header action secondary clicked |

Methods

| name | description | | --------------------------- | ---------------------------------------------- | | handleActionPrimaryClick() | handler for the header__action_primary click | | : void | event, fires ACTION_PRIMARY_CLICK_EVENT event | | handleActionSecondaryClick()| handler for the header__action_secondary click | | : void | event, fires ACTION_SECONDARY_CLICK_EVENT event| | getViewportScrollY( | returns number of pixels scrolled on scroll | | targetSelector: symbol | targetSelector target from top of the page | | ): number | | | getHeaderHeight(): number | returns height of the root(), (header) | | ): number | | | hasClass(name: string) | returns if root(), (header) has class name | | : boolean | | | addClass(name: string) | adds class name to the element root(), | | : void | (header) | | removeClass(name: string) | removes class name to the element root(), | | : void | (header) |

classes

| name | value | | --------------------------- | ---------------------------------------------- | | HEADER_HIDDEN: "string" | "header_hidden" |

strings

| name | value | | ------------------------------ | ------------------------------------------- | | ACTION_PRIMARY_SELECTOR | ".header__action_primary" | | : "string" | | | ACTION_PRIMARY_CLICKED_EVENT | "mokui-header:action-primary-clicked" | | : "string" | | | ACTION_SECONDARY_CLICKED_EVENT | "mokui-header:action-secondary-clicked" | | : "string" | |