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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@senka-ai/layout-engine

v0.0.2

Published

Intuitive layout system for Senka's no-code platform

Downloads

5

Readme

@senka-ai/layout-engine

Intuitive layout system for Senka's no-code platform that enables non-technical users to create professional, responsive layouts through visual tools.

Features

  • 🎯 Intuitive Arrangements: Think in spatial terms (Stack, Row, Grid) not CSS
  • 📐 Smart Constraints: Flexible positioning with automatic conflict resolution
  • 📱 Responsive by Default: Automatic mobile optimization with override capability
  • 🎨 Visual Controls: Drag-and-drop with real-time preview
  • 🔒 Modification Safety: Preview changes before applying with rollback
  • Performance Optimized: Minimal CSS output with intelligent caching

Installation

npm install @senka-ai/layout-engine

Basic Usage

import { LayoutEngine } from '@senka-ai/layout-engine'

const engine = new LayoutEngine()

// Create a simple stack layout - no 'as const' needed!
const layout = {
  id: 'main-layout',
  type: 'stack',
  direction: 'vertical',
  gap: 'normal',
  fillContainer: true,
  responsive: {
    automatic: {
      enabled: true,
      mobileOptimization: 'balanced',
    },
  },
}

// Generate CSS
const css = engine.generateCSS(layout)

Arrangement Types

Stack

Elements arranged vertically (or horizontally), one after another.

{
  id: 'my-stack',
  type: 'stack',
  direction: 'vertical', // or 'horizontal'
  reverse: false,
  gap: 'normal'
}

Row

Elements arranged side-by-side horizontally.

{
  id: 'my-row',
  type: 'row',
  wrap: true,
  reverse: false,
  gap: 'normal',
  align: 'center'
}

Grid

Elements arranged in a structured grid pattern.

{
  id: 'my-grid',
  type: 'grid',
  columns: 3,
  gap: 'normal',
  fillContainer: true
}

Flow

Elements flow naturally like text, wrapping when needed.

{
  id: 'my-flow',
  type: 'flow',
  gap: 'cozy',
  align: 'start'
}

Overlay

Elements layered on top of each other.

{
  id: 'my-overlay',
  type: 'overlay',
  position: 'center',
  zIndex: 10
}

Spacing System

Use semantic spacing values, direct numbers, or spacing objects:

// Semantic spacing (recommended)
{
  gap: 'tight',        // 4px
  padding: 'cozy',     // 8px
}

// Direct numbers
{
  gap: 16,             // 16px
  padding: 24,         // 24px
}

// Spacing objects for custom values
{
  gap: { scale: 'custom', custom: 20 },
  padding: {
    top: { scale: 'normal' },    // 16px
    horizontal: { scale: 'cozy' } // 8px
  }
}

Available scales: 'tight' (4px), 'cozy' (8px), 'normal' (16px), 'comfortable' (24px), 'spacious' (32px)

Responsive Features

Automatic Optimization

{
  responsive: {
    automatic: {
      enabled: true,
      mobileOptimization: 'aggressive',
      rules: {
        stackRowsOnMobile: true,
        increaseSpacingForTouch: true,
        simplifyGridsOnMobile: true
      }
    }
  }
}

Custom Breakpoints

{
  responsive: {
    breakpointRules: {
      mobile: {
        arrangement: { type: 'stack' },
        spacing: { gap: 'comfortable' }
      },
      desktop: {
        arrangement: { type: 'row' },
        spacing: { gap: 'normal' }
      }
    }
  }
}

Constraints

Pin elements to edges or center them:

{
  constraints: {
    horizontal: {
      left: { enabled: true, offset: 20 },
      right: { enabled: true, offset: 20 }
    },
    vertical: {
      centerV: true
    }
  }
}

Visual Controls (Svelte Components)

<script>
  import { ArrangementPicker, SpacingSlider } from '@senka-ai/layout-engine'

  let arrangement = 'stack'
  let spacing = 'normal'
</script>

<ArrangementPicker bind:value={arrangement} />
<SpacingSlider bind:value={spacing} />

API Reference

LayoutEngine

Main class for generating CSS from layout definitions.

const engine = new LayoutEngine(options?: LayoutEngineOptions)

// Generate CSS
engine.generateCSS(layout: LayoutContainer): string

// Optimize for platform
engine.optimizeForPlatform(layout: LayoutContainer, platform: Platform): LayoutContainer

// Validate layout
engine.validate(layout: LayoutContainer): ValidationResult

Types

See TypeScript definitions for complete type information.

License

MIT