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 🙏

© 2025 – Pkg Stats / Ryan Hefner

com-shell

v0.1.1

Published

This library provides tools for managing page model data storage using IndexedDB for debugging purposes.

Readme

com-shell

This library provides tools for managing page model data storage using IndexedDB for debugging purposes.

Description

A debugging utility for storing and retrieving page layout data using IndexedDB. It provides an interface to persist component configurations and layout information for development and testing scenarios.

Installation

npm install com-shell
# or
yarn add com-shell

Core Concepts

  • pageModelDB: The main database instance for managing layout data
  • XComLayout: Class representing a component layout with metadata
  • ComArgs: Type definition for component arguments and configuration

Basic Usage

import { pageModelDB, XComLayout } from 'com-shell';

// Enable debugging mode
pageModelDB.enable();

// The instance is also available globally as window.$PageModelDB
// This ensures a single instance across multiple applications

// Check if debugging is enabled
if (pageModelDB.isEnabled()) {
  // Create a new layout
  const layout = pageModelDB.generateLayout('engine1', 'page1', 'layout1');

  // Set layout properties
  layout.setLayoutLabel('My Layout');

  // Add or update layout in database
  await pageModelDB.addOrUpdateLayout(layout);

  // Retrieve layout
  const retrievedLayout = pageModelDB.getLayout('engine1', 'page1', 'layout1');
}

// Control logging output
pageModelDB.enableLog();  // Enable console logging
pageModelDB.disableLog(); // Disable console logging

// Access from console
window.$PageModelDB?.enable();     // Enable debugging
window.$PageModelDB?.disable();    // Disable debugging
window.$PageModelDB?.enableLog();  // Enable logging
window.$PageModelDB?.disableLog(); // Disable logging

Logging Behavior

The package includes smart logging control:

  • Debug logs: Only shown when enableLog() is called
  • Error logs: Always shown (cannot be disabled)
  • Warning logs: Only shown when logging is enabled
  • All logs are prefixed with [PageModelDB] for easy filtering
// Enable logging to see debug information
pageModelDB.enableLog();

// Now operations will log to console
await pageModelDB.addOrUpdateLayout(layout);
// Console: [PageModelDB] Layout added successfully

// Disable logging for cleaner console
pageModelDB.disableLog();

API

Exports

  • pageModelDB: Main database instance for layout operations
  • XComLayout: Class for representing component layouts
  • ComArgs: Type for component configuration data

pageModelDB Methods

Debug Mode Control

  • enable(): Enable debugging mode (sets localStorage flag)
  • disable(): Disable debugging mode (clears localStorage flag)
  • isEnabled(): Check if debugging mode is enabled

Logging Control

  • enableLog(): Enable console logging (sets localStorage.page_model_log_enabled)
  • disableLog(): Disable console logging (clears localStorage.page_model_log_enabled)
  • isLogEnabled(): Check if logging is enabled

Layout Operations

  • getLayout(pageEngine, pageKey, layoutApiKey): Retrieve a specific layout
  • addOrUpdateLayout(layout): Add or update a layout
  • deleteLayout(pageEngine, pageKey, layoutApiKey): Delete a layout
  • getAllLayouts(): Get all layouts
  • clearAllLayouts(): Clear all stored layouts
  • generateLayout(pageEngine, pageKey, layoutApiKey): Create a new layout instance

Global Access

The package ensures a single global instance across multiple applications:

  • When the module is loaded, it creates or reuses window.$PageModelDB
  • This ensures that even if multiple apps import the package, they share the same instance
  • You can access it directly from the browser console: window.$PageModelDB

Development

Building

npm run build
# or
yarn build

Testing

npm run test
# or
yarn test