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

@spaas/scrollbar

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spaas/scrollbar - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

build/rollup.config.js

81

package.json
{
"name": "@spaas/scrollbar",
"version": "1.0.0",
"description": "覆盖原有的滚动条样式",
"version": "1.0.1",
"description": "基于elementUI的滚动条组件",
"license": "MIT",
"keywords": [
"ice",
"vue",
"component"
],
"files": [

@@ -11,31 +17,65 @@ "src/",

],
"license": "MIT",
"keywords": [
"ice",
"vue",
"block"
],
"main": "dist/index.umd.js",
"module": "dist/index.esm.js",
"unpkg": "dist/index.min.js",
"browser": {
"./sfc": "src/index.vue"
},
"scripts": {
"start": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"start": "vue-styleguidist server",
"doc": "vue-styleguidist build",
"build": "npm run build:unpkg & npm run build:es & npm run build:umd",
"build:umd": "rollup --config build/rollup.config.js --format umd --file dist/index.umd.js",
"build:es": "rollup --config build/rollup.config.js --format es --file dist/index.esm.js",
"build:unpkg": "rollup --config build/rollup.config.js --format iife --file dist/index.min.js",
"precommit": "pretty-quick --staged",
"stdver": "standard-version -m '[skip ci] chore(release): v%s'",
"release": "gren release --override",
"screenshot": "ice-devtools screenshot",
"prepublishOnly": "npm run build"
"prepublishOnly": "npm run build && npm run screenshot"
},
"dependencies": {
"@femessage/theme-deepexi": "^2.4.11",
"element-ui": "^2.4.11",
"rollup-plugin-less": "^1.1.2",
"rollup-plugin-node-resolve": "^5.1.0",
"vue": "^2.5.16"
},
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/plugin-transform-runtime": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
"@vue/babel-plugin-transform-vue-jsx": "^1.0.0",
"@vue/babel-preset-jsx": "^1.0.0",
"@vue/cli-plugin-babel": "^3.4.0",
"@vue/cli-plugin-eslint": "^3.4.0",
"@vue/cli-service": "^3.4.0",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.5",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.7.0",
"babel-preset-env": "^1.7.0",
"babel-preset-es2015-rollup": "^3.0.0",
"babel-preset-latest": "^6.24.1",
"eslint": "^5.8.0",
"eslint-plugin-vue": "^5.0.0",
"vue-template-compiler": "^2.5.21",
"file-loader": "^3.0.1",
"github-release-notes": "^0.17.0",
"glob": "^7.1.3",
"husky": "^0.14.3",
"less": "^3.9.0",
"less-loader": "^5.0.0"
"less-loader": "^5.0.0",
"minimist": "^1.2.0",
"prettier": "1.12.1",
"pretty-quick": "^1.4.1",
"rollup": "^1.9.0",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-buble": "^0.19.6",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-terser": "^4.0.4",
"rollup-plugin-vue": "^4.7.2",
"standard-version": "^6.0.1",
"vue-loader": "^15.7.0",
"vue-styleguidist": "3.11.4",
"vue-template-compiler": "^2.5.16",
"webpack": "^4.29.6"
},

@@ -56,8 +96,9 @@ "eslintConfig": {

},
"blockConfig": {
"componentConfig": {
"name": "scrollbar",
"title": "滚动条",
"title": "滚动条组件",
"categories": [
"列表",
"数据展示",
"其他"
"信息展示"
],

@@ -64,0 +105,0 @@ "screenshot": ""

@@ -1,5 +0,54 @@

# xpaas-materilas-scrollbar
# @spaas/scrollbar
简介:滚动条
![截图](./screenshot.png)
覆盖原有的滚动条样式
项目简要说明 + 示例图
## Table of Contents
- [Introduction](#introduction)
- [Feature](#feature)
- [Demo](#demo)
- [Install](#install)
- [Example](#example)
- [Reference](#reference)
- [Contributors](#contributors)
- [License](#license)
## Introduction
[⬆ Back to Top](#table-of-contents)
## Feature
[⬆ Back to Top](#table-of-contents)
[⬆ Back to Top](#table-of-contents)
## Install
[⬆ Back to Top](#table-of-contents)
## Example
[⬆ Back to Top](#table-of-contents)
## Reference
[⬆ Back to Top](#table-of-contents)
## Contributors
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
[⬆ Back to Top](#table-of-contents)
## License
[MIT](./LICENSE)
[⬆ Back to Top](#table-of-contents)

@@ -1,141 +0,32 @@

// reference https://github.com/noeldelgado/gemini-scrollbar/blob/master/index.js
// Import vue component
import Component from './index.vue'
import {addResizeListener, removeResizeListener} from './utils/resize-event'
import scrollbarWidth from './utils/scrollbar-width'
import {toObject} from './utils/util'
import Bar from './bar.js'
import './index.less'
// install function executed by Vue.use()
export function install(Vue) {
if (install.installed) return
install.installed = true
Vue.component("Scrollbar", Component)
}
/* istanbul ignore next */
export default {
name: 'ScrollbarMain',
// Create module definition for Vue.use()
const plugin = {
install
}
components: {Bar},
// To auto-install when vue is found
let GlobalVue = null
if (typeof window !== 'undefined') {
GlobalVue = window.Vue
} else if (typeof global !== 'undefined') {
GlobalVue = global.Vue
}
if (GlobalVue) {
GlobalVue.use(plugin)
}
props: {
horizontal: {
type: Boolean,
default: false
}, // 是否显示横向滚动条
vertical: {
type: Boolean,
default: true
}, // 是否显示竖向滚动条
wrapStyle: {},
wrapClass: {},
viewClass: {},
viewStyle: {},
noresize: {
type: Boolean,
default: true
}
},
// To allow use as module (npm/webpack/etc.) export component
export default Component
data() {
return {
sizeWidth: '0',
sizeHeight: '0',
moveX: 0,
moveY: 0
}
},
computed: {
wrap() {
return this.$refs.wrap
},
slotsWrap() {
return this.$refs.slotsWrap
}
},
render(h) {
let gutter = scrollbarWidth()
let style = this.wrapStyle
if (gutter) {
const gutterWith = `-${gutter}px`
const gutterStyle = `${
this.horizontal ? `margin-bottom: ${gutterWith}; ` : ''
}${this.vertical ? `margin-right: ${gutterWith};` : ''}`
if (Array.isArray(this.wrapStyle)) {
style = toObject(this.wrapStyle)
style.marginRight = style.marginBottom = gutterWith
} else if (typeof this.wrapStyle === 'string') {
style += gutterStyle
} else {
style = gutterStyle
}
}
const wrap = (
<div
ref="wrap"
style={style}
onScroll={this.handleScroll}
class={[
this.wrapClass,
'scrollbar__wrap',
gutter ? '' : 'scrollbar__wrap--hidden-default'
]}
>
{
<div
class={['scrollbar__view', this.viewClass]}
style={this.viewStyle}
ref="resize"
>
<div ref="slotsWrap">{this.$slots.default}</div>
</div>
}
</div>
)
let nodes = [wrap]
if (this.horizontal) {
nodes.push(<Bar move={this.moveX} size={this.sizeWidth} />)
}
if (this.vertical) {
nodes.push(<Bar vertical move={this.moveY} size={this.sizeHeight} />)
}
return h('div', {class: 'scrollbar'}, nodes)
},
methods: {
handleScroll() {
const wrap = this.wrap
const slotsWrap = this.slotsWrap
this.moveY = (wrap.scrollTop * 100) / wrap.clientHeight
this.moveX = (wrap.scrollLeft * 100) / wrap.clientWidth
const bottomDistance =
slotsWrap.clientHeight - wrap.scrollTop - wrap.clientHeight
const rightDistance =
this.$refs.slotsWrap.clientHeight - wrap.scrollLeft - wrap.clientWidth
this.$emit('onScrollY', bottomDistance)
this.$emit('onScrollX', rightDistance)
},
update() {
let heightPercentage, widthPercentage
const wrap = this.wrap
if (!wrap) return
heightPercentage = (wrap.clientHeight * 100) / wrap.scrollHeight
widthPercentage = (wrap.clientWidth * 100) / wrap.scrollWidth
this.sizeHeight = heightPercentage < 100 ? heightPercentage + '%' : ''
this.sizeWidth = widthPercentage < 100 ? widthPercentage + '%' : ''
}
},
mounted() {
this.$nextTick(this.update)
!this.noresize && addResizeListener(this.$refs.slotsWrap, this.update)
},
beforeDestroy() {
!this.noresize && removeResizeListener(this.$refs.slotsWrap, this.update)
}
}
// It's possible to expose named exports when writing components that can
// also be used as directives, etc. - eg. import { RollupDemoDirective } from 'rollup-demo';
// export const RollupDemoDirective = component;

@@ -7,3 +7,3 @@ import ResizeObserver from 'resize-observer-polyfill'

const resizeHandler = function(entries) {
for (let entry of entries) {
Object.values(entries).forEach(entry => {
const listeners = entry.target.__resizeListeners__ || []

@@ -15,3 +15,3 @@ if (listeners.length) {

}
}
})
}

@@ -18,0 +18,0 @@

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