├── .browserslistrc ├── .commitlintrc.js ├── .env.development ├── .env.production ├── .eslintignore ├── .eslintrc.js ├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .husky ├── .gitignore ├── _ │ └── husky.sh ├── commit-msg └── pre-commit ├── .npmrc ├── .prettierrc.js ├── .stylelintignore ├── .stylelintrc.json ├── .versionrc ├── CHANGELOG.md ├── README.md ├── babel.config.js ├── docs ├── .vuepress │ ├── config.js │ ├── enhanceApp.js │ ├── public │ │ └── favicon.ico │ ├── shims-vue.d.ts │ └── theme │ │ ├── assets │ │ ├── github.svg │ │ └── logo.png │ │ ├── components │ │ ├── Container.vue │ │ ├── Footer.vue │ │ ├── Navbar.vue │ │ ├── Sidebar.vue │ │ └── Simulator.vue │ │ ├── index.js │ │ ├── layouts │ │ └── Layout.vue │ │ ├── package.json │ │ ├── styles │ │ ├── index.styl │ │ ├── markdown.styl │ │ ├── palette.styl │ │ └── reset.styl │ │ ├── utils │ │ └── index.js │ │ └── yarn.lock ├── README.md └── guide │ ├── basic-rule │ └── README.md │ ├── get-started │ └── README.md │ ├── install │ └── README.md │ ├── presets │ └── README.md │ └── resolution │ └── README.md ├── examples ├── App.tsx ├── README.md ├── common │ └── style │ │ ├── base.less │ │ ├── common.less │ │ ├── demo-block.less │ │ ├── demo-home-nav.less │ │ ├── demo-home.less │ │ ├── demo-nav.less │ │ └── demo-section.less ├── components │ ├── ArrowRight.tsx │ ├── DemoBlock.tsx │ ├── DemoHome.tsx │ ├── DemoHomeNav.tsx │ ├── DemoNav.tsx │ └── DemoSection.tsx ├── config │ └── index.ts ├── main.js ├── router │ └── index.ts └── utils │ └── index.ts ├── mkui.config.js ├── package.json ├── plugins ├── create-new │ ├── README.md │ ├── index.js │ └── template │ │ ├── demo │ │ └── index.md │ │ ├── less.md │ │ ├── readme.md │ │ ├── src │ │ └── tsx.md │ │ └── ts.md └── fs-copy │ ├── README.md │ ├── copy.js │ ├── index.js │ └── utils.js ├── project.md ├── public ├── favicon.ico ├── index.html └── logo.png ├── src ├── GiftRain │ ├── README.md │ ├── demo │ │ └── index.vue │ ├── index.less │ ├── index.ts │ └── src │ │ ├── config.ts │ │ ├── gift.ts │ │ ├── index.tsx │ │ └── types.ts ├── RingToss │ ├── README.md │ ├── demo │ │ └── index.vue │ ├── index.less │ ├── index.ts │ └── src │ │ ├── index.tsx │ │ └── types.ts ├── ScratchCard │ ├── README.md │ ├── demo │ │ └── index.vue │ ├── index.less │ ├── index.ts │ └── src │ │ ├── ScratchCanvas.ts │ │ └── index.tsx ├── SquareWheel │ ├── README.md │ ├── demo │ │ └── index.vue │ ├── index.less │ ├── index.ts │ └── src │ │ └── index.tsx ├── TurnCard │ ├── README.md │ ├── demo │ │ └── index.vue │ ├── index.less │ ├── index.ts │ └── src │ │ ├── index.tsx │ │ └── types.ts ├── Wheel │ ├── README.md │ ├── demo │ │ └── index.vue │ ├── index.less │ ├── index.ts │ └── src │ │ ├── Wheel.tsx │ │ └── index.tsx ├── Wheel3D │ ├── README.md │ ├── demo │ │ └── index.vue │ ├── index.less │ ├── index.ts │ └── src │ │ └── index.tsx ├── WheelFoundation │ ├── README.md │ ├── demo │ │ └── index.vue │ ├── index.less │ ├── index.ts │ ├── presets.ts │ └── src │ │ └── index.tsx ├── constants │ └── StateConstant.ts ├── core │ ├── BasicBase.tsx │ ├── BasicBasePlus.tsx │ └── Resolution.tsx ├── hooks │ ├── useChange.ts │ ├── useRotate.ts │ └── useToggle.ts ├── mixins │ └── update.tsx ├── shims-tsx.d.ts ├── shims-vue.d.ts ├── styles │ ├── animation.less │ ├── funcs.less │ ├── index.less │ └── var.less └── utils │ └── index.ts ├── tsconfig.json ├── types ├── Core.ts └── component.d.ts ├── vue.config.js └── yarn.lock /.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not dead 4 | -------------------------------------------------------------------------------- /.commitlintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * commit提交信息规范 3 | */ 4 | 5 | module.exports = { 6 | extends: ['@commitlint/config-conventional'], 7 | rules: { 8 | 'type-enum': [ 9 | 2, 10 | 'always', 11 | [ 12 | 'feat', // 新增功能 13 | 'fix', // 修复bug 14 | 'docs', // 更新文档 15 | 'style', // 不影响程序逻辑的代码修改(修改空白字符,格式缩进,补全缺失的分号等,没有改变代码逻辑) 16 | 'refactor', // 重构代码(既没有新增功能,也没有修复 bug) 17 | 'test', // 新增测试用例或是更新现有测试 18 | 'chore', // 不属于以上类型的其他类型,比如构建流程, 依赖管理 19 | 'build', // 主要目的是修改项目构建系统(例如 glup,webpack,rollup 的配置等)的提交 20 | 'ci', // 主要目的是修改项目继续集成流程(例如 Travis,Jenkins,GitLab CI,Circle等)的提交 21 | 'revert' // 回滚某个更早之前的提交 22 | ] 23 | ], 24 | 'subject-full-stop': [0, 'never'], 25 | 'subject-case': [0, 'never'] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.env.development: -------------------------------------------------------------------------------- 1 | # 本地开发端口号 2 | SERVER_PORT=2222 3 | 4 | # 本地打包输出目录 5 | BUILD_DIR=dist 6 | -------------------------------------------------------------------------------- /.env.production: -------------------------------------------------------------------------------- 1 | # 本地打包输出目录 2 | BUILD_DIR=dist/demo 3 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /examples/* 2 | /plugins/* 3 | /lib/* 4 | /es/* -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true, 5 | }, 6 | extends: [ 7 | "plugin:vue/essential", 8 | "eslint:recommended", 9 | "@vue/typescript/recommended", 10 | // 暂时关闭一下prettier格式校验 11 | "@vue/prettier", 12 | "@vue/prettier/@typescript-eslint", 13 | ], 14 | parserOptions: { 15 | ecmaVersion: 2020, 16 | }, 17 | rules: { 18 | "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", 19 | "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", 20 | "semi": "off", 21 | "quotes": ["warn", "single"], 22 | "prettier/prettier": ["warn", { "singleQuote": true }], 23 | "@typescript-eslint/explicit-module-boundary-types": "off" 24 | }, 25 | }; 26 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | push: 4 | branches: 5 | - master 6 | jobs: 7 | build-and-deploy-docs: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout 🛎️ 11 | uses: actions/checkout@master 12 | with: 13 | persist-credentials: false 14 | - name: Install and Build 15 | run: | 16 | yarn install 17 | yarn build-copy 18 | yarn build-doc 19 | yarn build 20 | yarn build-demo 21 | - name: Deploy 🚀 22 | uses: JamesIves/github-pages-deploy-action@releases/v4 23 | with: 24 | BRANCH: gh-pages 25 | FOLDER: dist -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | es 5 | lib 6 | docs/components/* 7 | docs/dist 8 | 9 | 10 | # local env files 11 | .env.local 12 | .env.*.local 13 | 14 | # Log files 15 | npm-debug.log* 16 | yarn-debug.log* 17 | yarn-error.log* 18 | pnpm-debug.log* 19 | 20 | # Editor directories and files 21 | .idea 22 | .vscode 23 | *.suo 24 | *.ntvs* 25 | *.njsproj 26 | *.sln 27 | *.sw? 28 | -------------------------------------------------------------------------------- /.husky/.gitignore: -------------------------------------------------------------------------------- 1 | _ 2 | -------------------------------------------------------------------------------- /.husky/_/husky.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ -z "$husky_skip_init" ]; then 3 | debug () { 4 | [ "$HUSKY_DEBUG" = "1" ] && echo "husky (debug) - $1" 5 | } 6 | 7 | readonly hook_name="$(basename "$0")" 8 | debug "starting $hook_name..." 9 | 10 | if [ "$HUSKY" = "0" ]; then 11 | debug "HUSKY env variable is set to 0, skipping hook" 12 | exit 0 13 | fi 14 | 15 | if [ -f ~/.huskyrc ]; then 16 | debug "sourcing ~/.huskyrc" 17 | . ~/.huskyrc 18 | fi 19 | 20 | export readonly husky_skip_init=1 21 | sh -e "$0" "$@" 22 | exitCode="$?" 23 | 24 | if [ $exitCode != 0 ]; then 25 | echo "husky - $hook_name hook exited with code $exitCode (error)" 26 | exit $exitCode 27 | fi 28 | 29 | exit 0 30 | fi 31 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm run commitlint 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm run precommit 5 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | registry=http://npm.dui88.com -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | singleQuote: true, //使用单引号 3 | }; 4 | -------------------------------------------------------------------------------- /.stylelintignore: -------------------------------------------------------------------------------- 1 | dist 2 | node_modules 3 | -------------------------------------------------------------------------------- /.stylelintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["stylelint-config-standard", "stylelint-config-recess-order"], 3 | "plugins": ["stylelint-order"], 4 | "rules": { 5 | "selector-pseudo-class-no-unknown": null, 6 | "unit-case":null, 7 | "no-descending-specificity":null, 8 | "font-family-no-missing-generic-family-keyword": null, 9 | "property-no-unknown":[ 10 | true, 11 | { 12 | "ignoreProperties":[ 13 | "text-stroke" 14 | ] 15 | } 16 | ] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.versionrc: -------------------------------------------------------------------------------- 1 | { 2 | "types": [ 3 | {"type": "chore", "section":"Others", "hidden": false}, 4 | {"type": "revert", "section":"Reverts", "hidden": false}, 5 | {"type": "feat", "section": "Features", "hidden": false}, 6 | {"type": "fix", "section": "Bug Fixes", "hidden": false}, 7 | {"type": "improvement", "section": "Feature Improvements", "hidden": false}, 8 | {"type": "docs", "section":"Docs", "hidden": false}, 9 | {"type": "style", "section":"Styling", "hidden": false}, 10 | {"type": "refactor", "section":"Code Refactoring", "hidden": false}, 11 | {"type": "perf", "section":"Performance Improvements", "hidden": false}, 12 | {"type": "test", "section":"Tests", "hidden": false}, 13 | {"type": "build", "section":"Build System", "hidden": false}, 14 | {"type": "ci", "section":"CI", "hidden":false} 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # `@tuia/market-ui` 2 | 3 | > 丰富、可靠的移动端营销互动组件库 4 | 5 | ## 安装 6 | ```bash 7 | yarn add @tuia/market-ui 8 | ``` 9 | 10 | ## 引入 11 | 12 | ### 方法一、全量导入所有组件 13 | 14 | ```js 15 | import Vue from 'vue' 16 | import MarketUI from '@tuia/market-ui' 17 | import '@tuia/market-ui/es/index.less' 18 | 19 | Vue.use(MarketUI) 20 | ``` 21 | 22 | ### 方法二、手动按需引入组件 23 | 24 | ```js 25 | import TurnCard from '@tuia/market-ui/lib/TurnCard' 26 | import '@tuia/market-ui/lib/TurnCard/style' 27 | ``` 28 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | // "@vue/cli-plugin-babel/preset", 4 | "@tuia/mkui-cli/dist/config/babel.config.js", 5 | ], 6 | }; 7 | -------------------------------------------------------------------------------- /docs/.vuepress/config.js: -------------------------------------------------------------------------------- 1 | const pkg = require('../../package.json') 2 | const path = require('path') 3 | 4 | const resolve = dir => path.join(__dirname, dir) 5 | 6 | module.exports = { 7 | base: '/market-ui/', // 部署到https://foo.github.io/market-ui/ 8 | title: 'MarketUI', 9 | description: pkg.description, 10 | dest: 'dist', 11 | head: [ 12 | ['link', { rel: 'icon', href: '/favicon.ico' }] 13 | ], 14 | // 本地开发默认主机名 15 | host: '127.0.0.1', 16 | // markdown配置,支持自定义传入snippets参数,用于分块html/js/css展示 17 | // from https://github.com/vuejs/vuepress/issues/2663 18 | markdown: { 19 | lineNumbers: false, 20 | extendMarkdown: md => { 21 | const fenceRender = md.renderer.rules.fence; 22 | md.renderer.rules.fence = (...args) => { 23 | return fenceRender(...args) 24 | // Javascript regex modified from /^\/\/ ?#?((?:end)?region) ([\w*-]+)$/ 25 | // from https://github.com/vuejs/vuepress/blob/fbf5e5d/packages/%40vuepress/markdown/lib/snippet.js#L43 26 | .replace(/\/\/ ?#?((?:end)?region) ([\w*-]+)/g, '__REMOVED__') 27 | // Remove surrounding HTML 28 | .split('__REMOVED__').join('__REMOVED__') 29 | // Remove surrounding indentation and new line 30 | .replace(/[ \t]*__REMOVED__\n/g, '') 31 | } 32 | } 33 | }, 34 | plugins: [ 35 | '@vuepress/back-to-top' 36 | ], 37 | theme: '@tuia/vuepress-theme', 38 | themeConfig: { 39 | searchMaxSuggestions: 10 // 搜索框显示的搜索结果配置 40 | }, 41 | configureWebpack: { 42 | resolve: { 43 | alias: { 44 | '@': resolve('../../src') // 设置webpack别名 45 | }, 46 | extensions: ['.ts', '.tsx'], 47 | }, 48 | module: { 49 | rules: [ 50 | /* 用于配置vuepress正确加载和解析从外部引入.tsx文件,官方插件`vuepress-plugin-typescript`只适用于在`.vuepress`内部编写ts组件 */ 51 | /* 需要安装的依赖是`@vue/babel-preset-jsx`和`ts-loader` */ 52 | { 53 | test: /\.tsx?$/, 54 | exclude: /node_modules/, 55 | use: [ 56 | { 57 | loader: 'babel-loader', 58 | options: { 59 | babelrc: false, 60 | configFile: false, 61 | presets: [ 62 | '@vue/babel-preset-jsx' 63 | ] 64 | } 65 | }, 66 | { 67 | loader: 'ts-loader', 68 | options: { 69 | transpileOnly: true, 70 | appendTsxSuffixTo: [/\.vue$/] 71 | } 72 | } 73 | ] 74 | } 75 | ] 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /docs/.vuepress/enhanceApp.js: -------------------------------------------------------------------------------- 1 | /* 应用级别的配置——用于安装一些附加的 Vue 插件、注册全局组件,或者增加额外的路由钩子 */ 2 | export default ({ 3 | Vue, // VuePress 正在使用的 Vue 构造函数 4 | options, // 附加到根实例的一些选项 5 | router, // 当前应用的路由实例 6 | siteData, // 站点元数据 7 | isServer 8 | }) => { 9 | /* 动态添加404重定向路由匹配规则 */ 10 | router.addRoutes([ 11 | { path: '/demo-*', redirect: '/' } 12 | ]) 13 | } 14 | -------------------------------------------------------------------------------- /docs/.vuepress/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuia-fed/market-ui/98188b197086a29b4d09cadd1d5c062ac56d96d3/docs/.vuepress/public/favicon.ico -------------------------------------------------------------------------------- /docs/.vuepress/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import Vue from 'vue'; 3 | export default Vue; 4 | } 5 | -------------------------------------------------------------------------------- /docs/.vuepress/theme/assets/github.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | github 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/.vuepress/theme/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tuia-fed/market-ui/98188b197086a29b4d09cadd1d5c062ac56d96d3/docs/.vuepress/theme/assets/logo.png -------------------------------------------------------------------------------- /docs/.vuepress/theme/components/Container.vue: -------------------------------------------------------------------------------- 1 | 18 | 39 | 83 | -------------------------------------------------------------------------------- /docs/.vuepress/theme/components/Footer.vue: -------------------------------------------------------------------------------- 1 | 7 | 20 | 35 | -------------------------------------------------------------------------------- /docs/.vuepress/theme/components/Navbar.vue: -------------------------------------------------------------------------------- 1 | 26 | 37 | 123 | -------------------------------------------------------------------------------- /docs/.vuepress/theme/components/Sidebar.vue: -------------------------------------------------------------------------------- 1 | 12 | 35 | 76 | -------------------------------------------------------------------------------- /docs/.vuepress/theme/components/Simulator.vue: -------------------------------------------------------------------------------- 1 |