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

@shushujs/to-control

v1.0.2

Published

Resize or drag to move a html dom.

Downloads

5

Readme

说明

基于@howdyjs/to-control 开发,将对于@howdyjs/to-drag的依赖更新为@shushujs/to-drag。下方为原项目介绍:

ToControl

Version Size

Resize or drag to move a html dom.

特性

  1. 将一个定位为absolute的Dom设置成可拖拽移动与更改大小
  2. 继承于@howdyjs/to-drag,为其添加更改大小功能

原生使用

import ToControl from '@howdyjs/to-control'
new ToDrag({
  el: '#to-control', // Selector or Dom
  options: {
    // Your Options
    // 参考下方说明
  }
});
  • UMD CDN: https://unpkg.com/@howdyjs/to-control/dist/index.umd.js(需同时引入ToDrag)
  • UMD Name: HowdyToControl
  • UMD Example: Click Here

Options (Objcet)

|参数|说明|类型|可选值|默认值| |:---|:---|:---|:---|:---| |moveCursor|是否显示移动光标(cursor: move)|Boolean|-|true| |forbidBodyScroll|默认开启,处理移动端滚动穿透问题,当前使用设置body的overflow实现,设为false时需自行处理滚动穿透问题|Boolean|-|true| |isAbsolute|是否为Absolute模式, 可控制absolute的元素在其父元素下进行拖拽|Boolean|-|false| |parentSelector|Absolute模式下元素的父级容器,目前只支持传入字符串选择器|String|-|-| |arrowOptions|右下角更改大小用的箭头配置,配置参考下表|Object|-|-| |positionMode|定位模式,默认会记录top与left值,更改此值可以定位方向(1: top/left, 2: top/right, 3: bottom/left, 4: bottom/right)|Number|1,2,3,4|1| |disabled|是否禁用,需传入函数返回Boolean,若需同时隐藏箭头ICON在原生使用自行调用updateArrow方法,在Vue指令方式需触发DOM更新|Function: () => boolean|-|-|

arrowOptions (Objcet)

|参数|说明|类型|可选值|默认值| |:---|:---|:---|:---|:---| |size|箭头大小,单位为px|number|-|8| |lineWidth|箭头线宽|number|-|2| |lineColor|箭头颜色|String|-|#9a9a9a| |padding|距离右下角padding|number|-|2| |background|箭头盒子背景属性,一般用于自定义图标|String|-|none|

箭头盒子的CSS类名为to-control-arrow,也可自行控制样式

Event

该插件继承自@howdyjs/to-drag,在拖拽更改位置时可以使用其事件回调。

同时提供了tocontrolstart, tocontrolmove, tocontrolend作为更改大小后的事件,参数与to-drag事件参数一致。

需要注意tocontrolend会同时触发todragend.

Method

  • updateArrow: 可手动更新箭头DOM

以Vue指令方式使用

import { ToControlDirective } from '@howdyjs/to-control'
// Vue3全局引入
app.use(ToControlDirective, someGlobalOptions)

// Vue2全局引入(对vue2做了兼容)
Vue.use(ToControlDirective, someGlobalOptions)

// 组件内引入
export default {
  directive: {
    'to-control': ToControlDirective
  }
}

指令Value (Objcet)

参数同上方的配置Options