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

@typhonjs-typedoc/typedoc-theme-dmt

v0.3.0

Published

Provides a modern and customizable UX augmentation to the default TypeDoc theme bringing enhanced features and usability.

Downloads

2,553

Readme

@typhonjs-typedoc/typedoc-theme-dmt

NPM Code Style License Discord Twitch

Provides a customizable UX augmentation to the default TypeDoc theme bringing final mile fit and finish. The approach taken is not to provide a theme replacement, but an augmentation of the output from the default theme providing enhanced usability, features, and polish. A large benefit to this approach is that it allows the Default Modern Theme (DMT) to keep up with new releases and features of TypeDoc.

The DMT is slated for future mainlining into the TypeDoc default theme.

Installation:

package.json:

{
   "devDependencies": {
      "@typhonjs-typedoc/typedoc-theme-dmt": "^0.3.0",
      "typedoc": "^0.27.3"
   }
}

Features:

The Default Modern Theme (DMT) achieves enhanced usability through replacing several components of the default theme with Svelte powered implementations. This includes the navigation index and search capabilities. Other changes from the default theme include enhanced styles and usage of modern CSS features like container queries to provide better font size changes for different screen orientations.

Accessibility:

The DMT styles enhance accessibility making keyboard navigation clear and concise.

There are additional keyboard hotkeys available (for macOS "Alt" is the "Option / ⌥" key):

  • <Alt-C>: Focus main content.
  • <Alt-E>: Expand / collapse all navigation folders.
  • <Alt-H>: Open / close the help panel.
  • <Alt-I>: Go to home page / main index.html
  • <Alt-M>: If there is a modules.html index then go to it.
  • <Alt-N>: Scroll to current page in navigation panel and focus it.
  • <Alt-O>: If available, focus first anchor in On This Page container.
  • <Alt-S>: Show and focus the main search entry.

When using the navigation index you may press <Alt> when opening / closing a folder and it will open or close all children folders underneath.

Deployment Requirements:

The DMT uses ES Module loading for the dynamic functionality on the frontend in browser. This requires at minimum a way to serve / host the docs. You will see a CORS error when loading file:// URLs locally. Several easy options are available for hosting the generated docs. Please see the wiki article: Webserver Required To Serve Generated Docs.

Configuration:

typedoc.json / includes all extra DMT options with comments (JSON5):

{
  // Add the DMT plugin.
  "plugin": [
    "@typhonjs-typedoc/typedoc-theme-dmt"
  ],

  // Set the theme.
  "theme": "default-modern",

  // -----------------------------------------------------------------------------------------------------------------

  // The following options are specific to the Default Modern Theme. Default options are listed unless otherwise specified.

  // Set a local file path or URL to set as the favicon.
  "dmtFavicon": "./assets/favicon.ico",

  // An array of user specified "icon links" that are placed in toolbar links. An example entry is included below.
  "dmtLinksIcon": [
    {
      "icon": "./assets/icons/custom-icon.png", // File path or URL to image.
      "title": "My Custom Link",                // Tooltip to display as "title".
      "url": "<URL>"                            // URL for link.
    }
  ],

  // An object with preconfigured "icon links" for popular services that are placed in toolbar links.
  // All current services supported are listed, but choose the ones you use.
  "dmtLinksService": {
    "Discord": "<URL>",
    "GitHub": "<URL>",
    "BitBucket": "<URL>",
    "GitLab": "<URL>",
    "NPM": "<URL>"
  },

  // Additional navigation sidebar options.
  "dmtNavigation": {
    "moduleIcon": false,  // When true renders module icon.
    "style": 'full'       // A full tree is rendered by default. Other options include 'compact' and 'flat'. The first
                          // renders a full tree, but compacts all intermediary folders with no children and the latter
                          // flattens all module / package paths.
  },

  // May be `false` to disable main search functionality. Otherwise, provide an object
  // search icon in the top link bar is removed.
  "dmtSearch": {
    // When true the main search index stores parent reflection full names. This is set to false by default because when
    // using modules the full module path is shown in search results for all symbols.
    "fullName": false,

    // A positive integer greater than 0 providing a limit on main search query results.
    "limit": 10
  },

  // Control additional theme settings that the DMT offers. Theme animation for accordion / details elements works great
  // for small to larger documentation efforts. However, for very large projects it may be useful to completely disable
  // theme animation due to the amount of DOM elements displayed. Theme animation uses WAAPI to animate the `height` of
  // details elements and this causes layout reflows. You may opt in this case to turn off theme animation completely.
  "dmtSettings": {
    "animation": true // When true theme animation is enabled.
  }
}

Synergy:

  • A zero configuration CLI that uses the DMT to automatically generate API documentation from well configured package.json based projects is available via @typhonjs-typedoc/typedoc-pkg. This CLI incorporates ts-lib-docs mentioned next and makes it easy to generate end-to-end documentation.

  • The DMT is used to generate complete API docs for the built-in Typescript library declarations. @typhonjs-typedoc/ts-lib-docs provides several data sources including a TypeDoc plugin that associates all symbols from the built-in TS lib declarations allowing complete end-to-end API docs for your project and the modern web.

Roadmap:

  • Upstream as many things possible back to the main TypeDoc default theme.

  • Continue to refine main search component and setup for better results with large projects / lots of symbols.

  • Finish implementing new "quick search" Svelte component that provides an alternate quick way to search the navigation panel and local file being viewed.