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

@cylon-x/magic-design

v0.0.4

Published

Magic Design

Readme

设计器二期

1、基本概念

1.1、元组件:构成复合组件的最小单位

Text、Image、Button、Divider、Video 等

1.2、复合组件:由若干个元组件构成的一个大组件

Text、Banner、Image Gallery、Image and Text、Carousel、Reward、Newsletter 等

1.3、业务公共组件:项目中复用的公共组件

所有的公共组件需要开放 value 和 onChange Api(除 Button、Iconfont)

Button、Iconfont、AlignSelecter、Collapse、ColorPicker、ImagePicker、LayoutSelecter、Slider、UrlPicker

2、元组件

2.1

元组件类型:

TEXT、IMAGE、BUTTON、DIVIDER、VIDEO

元组件报文格式:

{
  id:'xxxx' //元组件key
  type: 'TYPE', //元组件类型
  style:{
  	fontFamily:'xxx', //字体
  	...css  //属性名称尽量使用标准css名称
	},
	hoverStyle:{

  }
}

动态设置 hover 效果

onMouseEnter={e => { e.target.style.color = 'red'; }}

onMouseLeave={e => { e.target.style.color = 'white'; }}

文本可编辑

contenteditable="true"

2.2 、元组件报文

Text

{
  id:'xxxx' //元组件key
  type: 'TYPE', //元组件类型
  content:'this is text',
  style:{
    fontFamily:'xxx', //字体
    fontSize: '14px',
    width: '200px',
    ...css
	}
}

Image

{
  id:'xxxx' //元组件key
  type: 'IMAGE', //元组件类型
  name:'123.png',
  src:'../image.png', //图片地址
  url:'www.baidu.com', //图片跳转地址
  style:{
    width: '200px',
    ...css
	},
	hoverStyle:{     //hover 类型为new时保存src,类型为enlarge时保存scale
    scale: '2',
    src:'../image1.png',
  }
}

Button

{
  id:'xxxx' //元组件key
  type: 'BUTTON', //元组件类型
  name:'Submit',
  url: 'www.baidu.com',
  style:{
  	buttonIconSrc:'../img.png',
 	  buttonIconPlace: 'left',
  	color:'#FEFEFE',
  	border: '1px solid red',
  	borderRadius:'10px',
    fontFamily:'xxx', //字体
    fontSize: '14px',
    ...css
	},
	hoverStyle {
    color:'#FEFEFE',
  	border: '1px solid red',
    fontFamily:'xxx', //字体
    fontSize: '14px',
    ...css
  }
}

2、复合组件

2.1

元组件类型:

TEXT、BANNER、IMAGE_GALLERT、IMAGE_TEXT、CAROUSEL、REWARD、NEWSLETTER

复合组件报文格式:

{
  id:'xxxx' //复合组件key
  type: 'TYPE', //复合组件类型
  setting:{     //开关类型的配置及属性配置放在这里
  	autoplays: 3, //3秒轮播
	},
	groupSource:[],  //元组件集合组数据放在这里
	metas:{
    title:{
      open:false,
      type:'IMAGE'
      ...metaCompJson
    },
    subTitle:{
      open:false,
        type:'IMAGE'
        ...metaCompJson
    }
  },
	customize:{
    layout:'',
    background:{

    }
  }
}

Text

{
	id: 'xxxx', //复合组件key
  type: 'TEXT', //复合组件类型
  setting:{
    layout:'left', // 模块布局 left/center/right ,每一个layout可能都是一个不同的组件
    title:{
      type:'TEXT'
       ...metaCompJson
    },
    subtitle:{
      type:'TEXT'
       ...metaCompJson
    },
  },
  source:[
    {                   //此处可以抽出业务组件
      title:{
        type:'TEXT'
       ...metaCompJson
      },
      content:{
        type:'TEXT'
       ...metaCompJson
      }
    }
  ],
  style:{
  	align:'left',  //文本布局 left/center/right
  	backgroundColor: 'red',
  	backgroundImage:'../image.png'
	}
}

Banner

modifySetting

{
  "comositeId": "1111",

  "value": {
    "autoplays": 4
  }
}
{
	id: 'xxxx',
	type: 'BANNER',
	setting:{
    open:false
  	autoplays: 3, //3秒轮播
    arrows:{      // 滚动箭头
    	open:false,
    	color:'red',
    	size:'',
    	hoverSize:'',
      hoverColor:'green',
  	},
    dots:{       //面板指示点
      open:false,
      color: 'red',
      size:'',
      hoverSize:''
      hoverColor:'green',
    },
	},
  groupSource:[
    {                     //此处可以作为一个业务组件
      id:'xxxxx',
      image:{
        open:false,
        type:'IMAGE'
        ...metaCompJson
      },
      title:{
        open:false,
        type:'TEXT',
        ...metaCompJson
      },
      content:{
        open:false,
        type:'TEXT',
        ...metaCompJson
      },
      button:{
        type:'BUTTON',
        ...metaCompJson
      },
      secondaryButton:{
        type:'BUTTON',
        ...metaCompJson
      },
      layout:'center',
      align:'left',
      //文本布局 left/center/right
    }
  ]
}

Image Gallery

Image and Text

{
  id:'xxxx'
  type: 'IMAGE_TEXT',
  setting:{
  	layout:'left',
  	title:{},
		subtitle:{},
		button:{},
		secondaryButton:{}
	},
	source:[

  ],
  style:{
    align:'left',
    backgroundColor:'red',
    backgroundImage:'./img.png'
  }
}

疑问:

Text 元组件

文字链接配置好之后,怎么删除

链接配置的规则,按单词还是字符

image 元组件

属性控制进度条和输入框是否要限制最大最小值

button 元组件

是否需要 icon 的 hover 效果

banner 中的 text Align 放在元组件里?