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

@mand-mobile/platform

v3.0.1-alpha.9

Published

mand-mobile runtime cross platform plugins

Downloads

3

Readme

@mand-mobile/platform

Runtime shims and compiletime plugins for smoothing out differences between platforms.

Component

transition

Usage

import TransitionPrimitive from '@mand-mobile/platform/lib/runtime/component/transition'

Props

  • show: Boolean, default: false
  • name: String
  • styles: Object

Events

  • beforeEnter
  • enter
  • afterEnter
  • beforeLeave
  • leave
  • afterLeave

scroll-view

Usage

import ScrollViewPrimitive from '@mand-mobile/platform/lib/runtime/component/scroll-view'

Props

  • scrollingX: Boolean, default: false
  • scrollingY: Boolean, default: true
  • height: [Number, String], default: 'auto'
  • refresherEnable: Boolean, default: false
  • endReachedThreshold: Number, default: 0
  • styles: Object

Events

  • refreshing
  • end-reached
  • scroll, params: { scrollTop, scrollLeft }

Methods

  • reflowScroller
  • getSizes: () => { wrapperW, wrapperH, contentW, contentH }
  • getOffsets: () => { left, top }
  • scrollTo: (left: number, top: number, isAnimation = false) => void
  • triggerRefresh
  • finishRefresh
  • finishLoadMore

toast

Usage

import toastFactory from '@mand-mobile/platform/lib/runtime/component/toast'

Methods

  • toastFactory: ToastOptions: VueOptions => Toast

dialog

Usage

import dialogFactory from '@mand-mobile/platform/lib/runtime/component/dialog'

Methods

  • dialogFactory: DialogOptions: VueOptions => Dialog

action-sheet

Usage

import actionSheetFactory from '@mand-mobile/platform/lib/runtime/component/action-sheet'

Methods

  • actionSheetFactory: ActionSheetOptions: VueOptions => ActionSheet

Module

Dom

Usage

import {Dom} from '@mand-mobile/platform/lib/runtime/module'

const $MDDom = Dom.bind(this) // scoped selector like refs
$MDDom().querySelector('xxxx').getScrollOffset()

API

documentElement

documentElement(): nodeRef

uniapp返回的是可视区域实例 查看详情

$MDDom().documentElement()
querySelector

querySelector(elNmae: string): nodeRef

export default {
  async mounted () {
    const testNodeRef = this.$MDDom().querySelector('.test')
    const rect: DOMRect = await testNodeRef.getBoundingClientRect()
  }
}
querySelectorAll

querySelectorAll(elNmae: string): nodeRef

uniapp中返回的不是真实数组,所以不能直接用length等属性,需调用getNode方法

export default {
  async mounted () {
    const firsttTestNodeRef = this.$MDDom().querySelector('.test')[0]
    const rect: DOMRect = await firsttTestNodeRef.getBoundingClientRect()
  }
}
getNode

getNode(): Promise<any[]>

web中不做处理直接返回dom节点,uniapp支持Canvas节点的获取 查看详情

const nodeRefs = $MDDom().querySelectorAll('.test')
const nodes = await nodeRefs.getNode()
 
 
console.log(nodes) // [node, node, ...]
 
const nodeRef = $MDDom().querySelector('.test')
const node = await nodeRefs.getNode()
 
console.log(node) 
getAttribute

getAttribute(prop: string): Promise<any>

uniapp中只能查询id或者nodesRef.fields方法中properties中可查询属性

export default {
  async mounted () {
    await $MDDom().querySelector('.test').getAttribute('id')
  }
}
getBoundingClientRect

getBoundingClientRect(): Promise<DOMRect>

export default {
  async mounted () {
    await $MDDom().querySelector('.test').getBoundingClientRect()
  }
}
getScrollOffset

getScrollOffset(): Promise<{scrollLeft: number, scrollTop: number }>

export default {
  async mounted () {
    await $MDDom().querySelector('.test').getScrollOffset()
  }
}
getComputedStyle

getComputedStyle(propList: Array<string>): Promise<object>

export default {
  async mounted () {
    await $MDDom().querySelector('.test').getComputedStyle(['position'])
  }
}

Device

Usage

import {Device} from '@mand-mobile/platform/lib/runtime/module'

const device = Device()
device.vibrate()

or

export default {
  mounted () {
    $MDDevice().vibrate()
  }
}

API

vibrate

短时震动,仅在小程序真机有效,web和小程序调试工具无效