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

v-dynamic-island

v0.1.0

Published

A Vue (3.x) implementation of Dynamic Island.

Downloads

2

Readme

Vue Dynamic Island

A Vue (3.x) implementation of Dynamic Island.

How to use

Install first:

pnpm install v-dynamic-island

Then import into your Vue project:

<script setup>
import { ref } from 'vue'
import DynamicIsland from 'v-dynamic-island'
import 'v-dynamic-island/style.css'

// to control the display
const shown = ref(false)
const expanded = ref(false)
</script>

<template>
  <DynamicIsland :shown="shown" :expanded="expanded">
    <template #leading>
      <!-- leading content -->
    </template>
    <template #trailing>
      <!-- trailing content -->
    </template>
    <template #expanded>
      <!-- expanded content -->
    </template>
  </DynamicIsland>
</template>

Explanations

The shown prop controls whether the island would be enabled.

The island has two modes: compat mode and expanded mode. The expanded prop controls which mode it is on.

The #leading and #trailing slots accepts the compat content. The former one is for the left side and the later one is for the right side.

The #expanded slot accepts the expanded content.

To be notice that the "little-pill" core area (roughly 137px x 40px) of the island always shouldn't be able to render anything since that's the place where Apple puts the TrueDepth Camera.

Live examples

https://jinjiang.dev/v-dynamic-island

Basic APIs

Props

  • shown: boolean
  • expanded: boolean

Slots

  • #leading
  • #trailing
  • #expanded

Emits

  • none

Advanced feature

  • Shaking as a warning.
  • Customize device width for the max width of expanded content.
  • "Super element" transitions for leading/trailing content between compat mode and expanded mode.
  • Slots for expanded leading/trailing content.

Advanced APIs

Props

  • warning: boolean

    When set to be true, the whole island would be shaked for a few times as a warning. According to the original design of Dynamic Island, this prop should only be used on the compat mode.

  • deviceWidth: number

    By default the component will auto detect the device width. However, you can explicitly specify a number for that. Usually, it's useful when you prepare a demo on non-iOS devices or laptops.

  • superLeading: boolean or { top, left, size }

    By default, #leading content will be hidden on the expanded mode. However, if you want to retain it, you can set it to be true. So when switching to the expanded mode, #leading content would be kept and scaled up.

    You can also set it as a customized position and size for its expanded mode.

    • The top and left is the number of pixels from the center of the content to the island edges.
    • The size is the number of pixels height, which is used for calculating the scaling transition.
  • superTrailing: boolean or { top, right, size }

    Similar to superTrailing but for #trailing content.

Slots

  • #expanded-leading
  • #expanded-trailing

Emits

  • none

Specs & default values

TrueDepth Camera:

  • Size of the cemara: 137px x 40px.

Compat mode:

  • Gap between heading/trailing slots and the TrueDepth Camera: 10px.
  • Height of headling/trailing slots: 40px.

Expanded mode:

  • Padding of the expanded slot: top 137px, other sides 10px.
  • Default height of headling/trailing slots: 80px.
  • Default center of heading slot to the top: 46px.
  • Default center of heading slot to the left: 46px.
  • Default center of trailing slot to the top: 46px.
  • Default center of trailing slot to the right: 46px.