Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dimmmensions

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dimmmensions

A collection of dimensions from iOS and iPadOS devices.

  • 2.3.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

Dimmmensions

📏 A collection of dimensions from iOS and iPadOS devices.

  • 🤖 Automated: Authored and updated automatically
  • 🧪 Reliable: Fully tested with 100% code coverage
  • 📦 Typed: Written in TypeScript and includes definitions out-of-the-box
  • 💨 Zero dependencies

version build npm size coverage license

Introduction

Dimmmensions collects dimensions as objects for each device.

interface Dimensions {
  device: "iPhone" | "iPad"
  name: string
  radius: number
  scale: number
  landscape: OrientedDimensions
  portrait: OrientedDimensions
}

landscape and portrait both contain orientation-specific dimensions and size classes.

interface OrientedDimensions {
  screen: {
    width: number
    height: number
  }
  layoutMargins: {
    top: number
    left: number
    right: number
    bottom: number
  }
  readableContent: {
    top: number
    left: number
    right: number
    bottom: number
  }
  safeArea: {
    top: number
    left: number
    right: number
    bottom: number
  }
  sizeClass: {
    horizontal: "compact" | "regular"
    vertical: "compact" | "regular"
  }
}
Examples
iPhone 11

{
  "device": "iPhone",
  "name": "iPhone 11",
  "radius": 41.5,
  "scale": 2,
  "landscape": {
    "screen": {
      "width": 896,
      "height": 414
    },
    "layoutMargins": {
      "top": 0,
      "left": 64,
      "right": 64,
      "bottom": 21
    },
    "readableContent": {
      "top": 0,
      "left": 116,
      "right": 116,
      "bottom": 21
    },
    "safeArea": {
      "top": 0,
      "left": 48,
      "right": 48,
      "bottom": 21
    },
    "sizeClass": {
      "horizontal": "regular",
      "vertical": "compact"
    }
  },
  "portrait": {
    "screen": {
      "width": 414,
      "height": 896
    },
    "layoutMargins": {
      "top": 48,
      "left": 20,
      "right": 20,
      "bottom": 34
    },
    "readableContent": {
      "top": 48,
      "left": 20,
      "right": 20,
      "bottom": 34
    },
    "safeArea": {
      "top": 48,
      "left": 0,
      "right": 0,
      "bottom": 34
    },
    "sizeClass": {
      "horizontal": "compact",
      "vertical": "regular"
    }
  }
}

iPad mini

{
  "device": "iPad",
  "name": "iPad mini (6th generation)",
  "radius": 21.5,
  "scale": 2,
  "landscape": {
    "screen": {
      "width": 1133,
      "height": 744
    },
    "sizeClass": {
      "horizontal": "regular",
      "vertical": "regular"
    },
    "layoutMargins": {
      "top": 24,
      "left": 20,
      "right": 20,
      "bottom": 20
    },
    "readableContent": {
      "top": 24,
      "left": 234.5,
      "right": 234.5,
      "bottom": 20
    },
    "safeArea": {
      "top": 24,
      "left": 0,
      "right": 0,
      "bottom": 20
    }
  },
  "portrait": {
    "screen": {
      "width": 744,
      "height": 1133
    },
    "sizeClass": {
      "horizontal": "regular",
      "vertical": "regular"
    },
    "layoutMargins": {
      "top": 24,
      "left": 20,
      "right": 20,
      "bottom": 20
    },
    "readableContent": {
      "top": 24,
      "left": 20,
      "right": 20,
      "bottom": 20
    },
    "safeArea": {
      "top": 24,
      "left": 0,
      "right": 0,
      "bottom": 20
    }
  }
}

Installation

Skypack
import { dimensions } from "https://cdn.skypack.dev/dimmmensions"
Yarn
yarn add dimmmensions
npm
npm install dimmmensions

Usage

dimensions

Import dimensions.

import { dimensions } from "dimmmensions"

// dimensions: [Dimensions, Dimensions, Dimensions...]
getDimensions

Import getDimensions.

import { getDimensions } from "dimmmensions"

Given no arguments, getDimensions will also return all dimensions.

const dimensions = getDimensions()

// dimensions: [Dimensions, Dimensions, Dimensions...]

Given a specific width and height, getDimensions will return dimensions that match the specified screen size, either in portrait or landscape.

const dimensions = getDimensions(320, 568)

// dimensions: [Dimensions]

Automation

Dimensions are extracted from iOS and iPadOS with the generate command—using Xcode and Simulator.

Keywords

FAQs

Package last updated on 23 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc