@farris/cli 2.0.0-beta.7 → 2.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +2 -2
- package/lib/commands/build-components.js +21 -17
- package/lib/commands/build-components.js.map +1 -0
- package/lib/commands/build-css.js +30 -2
- package/lib/commands/build-css.js.map +1 -0
- package/lib/commands/build-lib.js +16 -6
- package/lib/commands/build-lib.js.map +1 -0
- package/lib/commands/build.js +11 -5
- package/lib/commands/build.js.map +1 -0
- package/lib/commands/create-app.js +2 -1
- package/lib/commands/create-app.js.map +1 -0
- package/lib/commands/dev-serve.js +3 -7
- package/lib/commands/dev-serve.js.map +1 -0
- package/lib/commands/preview-serve.js +1 -0
- package/lib/commands/preview-serve.js.map +1 -0
- package/lib/common/constant.js +1 -0
- package/lib/common/constant.js.map +1 -0
- package/lib/common/generate-app.js +1 -0
- package/lib/common/generate-app.js.map +1 -0
- package/lib/common/get-dependencies.js +1 -0
- package/lib/common/get-dependencies.js.map +1 -0
- package/lib/common/get-farris-config.js +3 -2
- package/lib/common/get-farris-config.js.map +1 -0
- package/lib/common/get-version.js +1 -0
- package/lib/common/get-version.js.map +1 -0
- package/lib/common/get-vite-config.js +16 -8
- package/lib/common/get-vite-config.js.map +1 -0
- package/lib/config/vite-app.js +10 -10
- package/lib/config/vite-app.js.map +1 -0
- package/lib/config/vite-common.js +21 -0
- package/lib/config/vite-common.js.map +1 -0
- package/lib/config/vite-component.js +30 -0
- package/lib/config/vite-component.js.map +1 -0
- package/lib/config/vite-lib.js +12 -20
- package/lib/config/vite-lib.js.map +1 -0
- package/lib/index.js +23 -1
- package/lib/index.js.map +1 -0
- package/lib/plugins/{gen-component-style.js → create-component-style.js} +6 -4
- package/lib/plugins/create-component-style.js.map +1 -0
- package/lib/plugins/create-package-json.js +34 -0
- package/lib/plugins/create-package-json.js.map +1 -0
- package/lib/plugins/dts.js +1 -0
- package/lib/plugins/dts.js.map +1 -0
- package/lib/plugins/html-system.js +1 -0
- package/lib/plugins/html-system.js.map +1 -0
- package/lib/plugins/replace.js +1 -0
- package/lib/plugins/replace.js.map +1 -0
- package/lib/plugins/systemjs-bundle.js +16 -0
- package/lib/plugins/systemjs-bundle.js.map +1 -0
- package/package.json +41 -38
- package/templates/lib/.eslintrc.cjs +15 -15
- package/templates/lib/.prettierrc.json +7 -7
- package/templates/lib/components/button/index.ts +7 -0
- package/templates/lib/components/button/src/button.component.tsx +84 -0
- package/templates/lib/components/button/src/button.props.ts +55 -0
- package/templates/lib/components/button/src/button.scss +179 -0
- package/templates/lib/components/common/index.ts +6 -0
- package/templates/lib/components/common/src/common.scss +4 -0
- package/templates/lib/components/common/src/compositions/index.ts +19 -0
- package/templates/lib/components/common/src/compositions/types.ts +6 -0
- package/templates/lib/components/common/src/compositions/use-bem/index.ts +46 -0
- package/templates/lib/components/common/src/compositions/use-click-away/index.ts +40 -0
- package/templates/lib/components/common/src/compositions/use-context/use-children-contexts.ts +40 -0
- package/templates/lib/components/common/src/compositions/use-context/use-parent-context.ts +24 -0
- package/templates/lib/components/common/src/compositions/use-event-listener/index.ts +45 -0
- package/templates/lib/components/common/src/compositions/use-expose/index.ts +9 -0
- package/templates/lib/components/common/src/compositions/use-lay-render/index.ts +17 -0
- package/templates/lib/components/common/src/compositions/use-link/index.ts +14 -0
- package/templates/lib/components/common/src/compositions/use-lock-scroll/index.ts +25 -0
- package/templates/lib/components/common/src/compositions/use-long-press/index.ts +141 -0
- package/templates/lib/components/common/src/compositions/use-momentum/index.ts +82 -0
- package/templates/lib/components/common/src/compositions/use-mount-component/index.ts +48 -0
- package/templates/lib/components/common/src/compositions/use-rect/index.ts +31 -0
- package/templates/lib/components/common/src/compositions/use-refs/index.ts +21 -0
- package/templates/lib/components/common/src/compositions/use-resize-observer/index.ts +85 -0
- package/templates/lib/components/common/src/compositions/use-resize-observer/utils.ts +37 -0
- package/templates/lib/components/common/src/compositions/use-scroll-parent/index.ts +42 -0
- package/templates/lib/components/common/src/compositions/use-touch/index.ts +82 -0
- package/templates/lib/components/common/src/compositions/use-touch-move/index.ts +120 -0
- package/templates/lib/components/common/src/entity/base-property.ts +129 -0
- package/templates/lib/components/common/src/entity/entity-schema.ts +274 -0
- package/templates/lib/components/common/src/entity/input-base-property.ts +285 -0
- package/templates/lib/components/common/src/style/animation/index.scss +150 -0
- package/templates/lib/components/common/src/style/base.scss +63 -0
- package/templates/lib/components/common/src/style/fonts/farris-mobile-icon.ttf +0 -0
- package/templates/lib/components/common/src/style/icon.scss +6 -0
- package/templates/lib/components/common/src/style/index.scss +4 -0
- package/templates/lib/components/common/src/style/mixins/bem.scss +204 -0
- package/templates/lib/components/common/src/style/mixins/border-radius.scss +13 -0
- package/templates/lib/components/common/src/style/mixins/ellipsis.scss +15 -0
- package/templates/lib/components/common/src/style/mixins/hairline.scss +113 -0
- package/templates/lib/components/common/src/style/mixins/index.scss +6 -0
- package/templates/lib/components/common/src/style/mixins/margin.scss +10 -0
- package/templates/lib/components/common/src/style/mixins/safe-area.scss +9 -0
- package/templates/lib/components/common/src/style/variables.scss +113 -0
- package/templates/lib/components/common/src/utils/index.ts +15 -0
- package/templates/lib/components/common/src/utils/src/common.ts +83 -0
- package/templates/lib/components/common/src/utils/src/date.ts +134 -0
- package/templates/lib/components/common/src/utils/src/dom/event.ts +37 -0
- package/templates/lib/components/common/src/utils/src/hook.ts +18 -0
- package/templates/lib/components/common/src/utils/src/number.ts +26 -0
- package/templates/lib/components/common/src/utils/src/query-filter.ts +40 -0
- package/templates/lib/components/common/src/utils/src/resove-asset.ts +33 -0
- package/templates/lib/components/common/src/utils/src/string.ts +18 -0
- package/templates/lib/components/common/src/utils/src/throttle.ts +41 -0
- package/templates/lib/components/common/src/utils/src/transition.ts +14 -0
- package/templates/lib/components/common/src/utils/src/type.ts +105 -0
- package/templates/lib/components/common/src/utils/src/use-appearance.ts +33 -0
- package/templates/lib/components/common/src/utils/src/with-install.ts +16 -0
- package/templates/lib/components/common/src/utils/src/with-register-designer.ts +16 -0
- package/templates/lib/components/common/src/utils/src/with-register.ts +16 -0
- package/templates/lib/components/common/types.ts +131 -0
- package/templates/lib/components/index.ts +0 -0
- package/templates/lib/farris.config.mjs +37 -16
- package/templates/lib/index.html +12 -12
- package/templates/lib/package.json +28 -28
- package/templates/lib/src/App.vue +80 -5
- package/templates/lib/src/components/TheButton.vue +3 -0
- package/templates/lib/src/main.ts +10 -9
- package/templates/lib/src/router/index.ts +23 -0
- package/templates/lib/src/views/AboutView.vue +15 -0
- package/templates/lib/src/views/HomeView.vue +9 -0
- package/templates/lib/tsconfig.json +19 -17
- package/templates/mobile/.eslintrc.cjs +15 -15
- package/templates/mobile/.prettierrc.json +7 -7
- package/templates/mobile/farris.config.mjs +1 -1
- package/templates/mobile/index.html +12 -12
- package/templates/mobile/package.json +28 -28
- package/templates/mobile/src/App.vue +80 -80
- package/templates/mobile/src/components/TheButton.vue +3 -3
- package/templates/mobile/src/main.ts +12 -12
- package/templates/mobile/src/router/index.ts +23 -23
- package/templates/mobile/src/views/AboutView.vue +15 -15
- package/templates/mobile/src/views/HomeView.vue +9 -9
- package/templates/mobile/tsconfig.json +17 -17
- package/templates/web/.eslintrc.cjs +15 -0
- package/templates/web/.prettierrc.json +8 -0
- package/templates/web/farris.config.mjs +24 -0
- package/templates/web/index.html +12 -0
- package/templates/web/package.json +29 -0
- package/templates/web/src/App.vue +80 -0
- package/templates/web/src/components/TheButton.vue +3 -0
- package/templates/web/src/main.ts +10 -0
- package/templates/web/src/router/index.ts +23 -0
- package/templates/web/src/views/AboutView.vue +15 -0
- package/templates/web/src/views/HomeView.vue +9 -0
- package/templates/web/tsconfig.json +18 -0
- package/templates/lib/packages/button/src/index.vue +0 -4
- package/templates/lib/packages/index.ts +0 -7
@@ -5,13 +5,14 @@ const getComponentStyle = (imports) => {
|
|
5
5
|
return path.startsWith('@components/') && !NotStyleComponents.find(notStylecomponent => path.includes(notStylecomponent));
|
6
6
|
})
|
7
7
|
.filter((item, index, array) => {
|
8
|
-
|
8
|
+
const targetIndex = array.filter(e => e !== item).findIndex(e => item.includes(e));
|
9
|
+
return targetIndex < 0;
|
9
10
|
})
|
10
11
|
.map(name => {
|
11
12
|
const paths = name.split('/');
|
12
13
|
return {
|
13
14
|
name: paths[1],
|
14
|
-
path: `../${paths[1]}/
|
15
|
+
path: `../${paths[1]}/style.js`
|
15
16
|
};
|
16
17
|
});
|
17
18
|
components.push({
|
@@ -25,13 +26,13 @@ const getComponentStyle = (imports) => {
|
|
25
26
|
`;
|
26
27
|
return template;
|
27
28
|
};
|
28
|
-
export function
|
29
|
+
export function createComponentStyle() {
|
29
30
|
return {
|
30
31
|
name: 'farris-gen-component-style',
|
31
32
|
renderChunk(code, chunk) {
|
32
33
|
const { imports } = chunk;
|
33
34
|
const template = getComponentStyle(imports);
|
34
|
-
this.emitFile({
|
35
|
+
template && this.emitFile({
|
35
36
|
type: 'asset',
|
36
37
|
fileName: 'style.js',
|
37
38
|
source: template
|
@@ -41,3 +42,4 @@ export function genComponentStyle() {
|
|
41
42
|
};
|
42
43
|
}
|
43
44
|
;
|
45
|
+
//# sourceMappingURL=create-component-style.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"create-component-style.js","sourceRoot":"","sources":["../../src/plugins/create-component-style.ts"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAAG,CAAC,iBAAiB,EAAE,cAAc,EAAE,kBAAkB,EAAE,QAAQ,CAAC,CAAC;AAE7F,MAAM,iBAAiB,GAAG,CAAC,OAAiB,EAAE,EAAE;IAE9C,MAAM,UAAU,GAAG,OAAO;SACvB,MAAM,CAAC,IAAI,CAAC,EAAE;QACb,OAAO,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC5H,CAAC,CAAC;SACD,MAAM,CAAC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AC,CAAC;YACH,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AAAA,CAAC"}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { readFileSync } from "node:fs";
|
2
|
+
import { resolve } from "node:path";
|
3
|
+
import { CWD } from "../common/constant.js";
|
4
|
+
export const createPackageJson = () => {
|
5
|
+
return {
|
6
|
+
name: 'create-package-json',
|
7
|
+
generateBundle() {
|
8
|
+
const pkg = readFileSync(resolve(CWD, 'package.json'), 'utf-8');
|
9
|
+
const packageJson = JSON.parse(pkg);
|
10
|
+
const result = {
|
11
|
+
name: '',
|
12
|
+
version: '',
|
13
|
+
private: false,
|
14
|
+
main: './index.umd.js',
|
15
|
+
module: './index.esm.js',
|
16
|
+
types: './types/index.d.ts',
|
17
|
+
style: './index.css',
|
18
|
+
};
|
19
|
+
const exclude = ['scripts', 'devDependencies', 'private'];
|
20
|
+
Object.keys(packageJson).forEach(key => {
|
21
|
+
if (exclude.includes(key)) {
|
22
|
+
return;
|
23
|
+
}
|
24
|
+
result[key] = packageJson[key];
|
25
|
+
});
|
26
|
+
this.emitFile({
|
27
|
+
type: 'asset',
|
28
|
+
fileName: 'package.json',
|
29
|
+
source: JSON.stringify(result, null, 2)
|
30
|
+
});
|
31
|
+
}
|
32
|
+
};
|
33
|
+
};
|
34
|
+
//# sourceMappingURL=create-package-json.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"create-package-json.js","sourceRoot":"","sources":["../../src/plugins/create-package-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAQ,EAAE;IACzC,OAAO;QACL,IAAI,EAAE,qBAAqB;QAC3B,cAAc;YACZ,MAAM,GAAG,GAAG,Y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
+
{"version":3,"file":"html-system.js","sourceRoot":"","sources":["../../src/plugins/html-system.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,OAAO;QACL,IAAI,EAAE,uBAAuB;QAC7B,kBAAkB,CAAC,IAAY;YAC7B,MAAM,MAAM,GAAG,gDAAgD,CAAC;YAChE,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,GAAW,EAAE,EAAU,EAAC,EAAE,CAAC;;8BAEhC,EAAE,cAAc,CAAC,CAAC;QAC5C,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
|
package/lib/plugins/replace.js
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"replace.js","sourceRoot":"","sources":["../../src/plugins/replace.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,OAAO,CAAC,IAAgD;IACtE,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,WAAW,CAAC,IAAY,EAAE,KAAU;YAClC,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5C,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,GAAC,CAAC,CAAC,CAAC;YAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,GAAG,IAAI,EAAC,EAAE;gBACpD,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAAA,CAAC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export function systemjsBundle() {
|
2
|
+
return {
|
3
|
+
name: 'systemjs-bundle',
|
4
|
+
outputOptions(options) {
|
5
|
+
if (options.format === 'systemjs') {
|
6
|
+
return {
|
7
|
+
...options,
|
8
|
+
name: undefined
|
9
|
+
};
|
10
|
+
}
|
11
|
+
return options;
|
12
|
+
}
|
13
|
+
};
|
14
|
+
}
|
15
|
+
;
|
16
|
+
//# sourceMappingURL=systemjs-bundle.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"systemjs-bundle.js","sourceRoot":"","sources":["../../src/plugins/systemjs-bundle.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc;IAC5B,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,aAAa,CAAC,OAAY;YACxB,IAAG,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE;gBAChC,OAAO;oBACL,GAAG,OAAO;oBACV,IAAI,EAAE,SAAS;iBAChB,CAAC;aACH;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC;AAAA,CAAC"}
|
package/package.json
CHANGED
@@ -1,38 +1,41 @@
|
|
1
|
-
{
|
2
|
-
"name": "@farris/cli",
|
3
|
-
"private": false,
|
4
|
-
"version": "2.0.0-beta.
|
5
|
-
"type": "module",
|
6
|
-
"typings": "lib/index.d.ts",
|
7
|
-
"bin": {
|
8
|
-
"farris-cli": "./bin/index.js"
|
9
|
-
},
|
10
|
-
"engines": {
|
11
|
-
"node": ">=16.0.0"
|
12
|
-
},
|
13
|
-
"scripts": {
|
14
|
-
"build": "rimraf ./lib && tsc"
|
15
|
-
},
|
16
|
-
"files": [
|
17
|
-
"lib",
|
18
|
-
"templates",
|
19
|
-
"bin.js"
|
20
|
-
],
|
21
|
-
"
|
22
|
-
|
23
|
-
"@
|
24
|
-
"@vitejs/plugin-vue
|
25
|
-
"
|
26
|
-
"
|
27
|
-
"
|
28
|
-
"
|
29
|
-
"
|
30
|
-
"
|
31
|
-
"
|
32
|
-
|
33
|
-
|
34
|
-
"
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
1
|
+
{
|
2
|
+
"name": "@farris/cli",
|
3
|
+
"private": false,
|
4
|
+
"version": "2.0.0-beta.8",
|
5
|
+
"type": "module",
|
6
|
+
"typings": "lib/index.d.ts",
|
7
|
+
"bin": {
|
8
|
+
"farris-cli": "./bin/index.js"
|
9
|
+
},
|
10
|
+
"engines": {
|
11
|
+
"node": ">=16.0.0"
|
12
|
+
},
|
13
|
+
"scripts": {
|
14
|
+
"build": "rimraf ./lib && tsc"
|
15
|
+
},
|
16
|
+
"files": [
|
17
|
+
"lib",
|
18
|
+
"templates",
|
19
|
+
"bin.js"
|
20
|
+
],
|
21
|
+
"license": "MIT",
|
22
|
+
"dependencies": {
|
23
|
+
"@types/inquirer": "^9.0.7",
|
24
|
+
"@vitejs/plugin-vue": "^4.0.0",
|
25
|
+
"@vitejs/plugin-vue-jsx": "^3.0.0",
|
26
|
+
"commander": "^9.4.0",
|
27
|
+
"esbuild": "^0.23.0",
|
28
|
+
"esbuild-sass-plugin": "^3.3.1",
|
29
|
+
"inquirer": "^9.3.0",
|
30
|
+
"ora": "^8.0.1",
|
31
|
+
"typescript": "^4.6.4",
|
32
|
+
"vite": "^4.4.1",
|
33
|
+
"vite-plugin-css-injected-by-js": "^3.5.2",
|
34
|
+
"vite-plugin-dts": "^3.9.1"
|
35
|
+
},
|
36
|
+
"devDependencies": {
|
37
|
+
"@types/inquirer": "^9.0.7",
|
38
|
+
"rimraf": "^5.0.7",
|
39
|
+
"vue": "^3.2.37"
|
40
|
+
}
|
41
|
+
}
|
@@ -1,15 +1,15 @@
|
|
1
|
-
/* eslint-env node */
|
2
|
-
require('@rushstack/eslint-patch/modern-module-resolution')
|
3
|
-
|
4
|
-
module.exports = {
|
5
|
-
root: true,
|
6
|
-
'extends': [
|
7
|
-
'plugin:vue/vue3-essential',
|
8
|
-
'eslint:recommended',
|
9
|
-
'@vue/eslint-config-typescript',
|
10
|
-
'@vue/eslint-config-prettier/skip-formatting'
|
11
|
-
],
|
12
|
-
parserOptions: {
|
13
|
-
ecmaVersion: 'latest'
|
14
|
-
}
|
15
|
-
}
|
1
|
+
/* eslint-env node */
|
2
|
+
require('@rushstack/eslint-patch/modern-module-resolution');
|
3
|
+
|
4
|
+
module.exports = {
|
5
|
+
root: true,
|
6
|
+
'extends': [
|
7
|
+
'plugin:vue/vue3-essential',
|
8
|
+
'eslint:recommended',
|
9
|
+
'@vue/eslint-config-typescript',
|
10
|
+
'@vue/eslint-config-prettier/skip-formatting'
|
11
|
+
],
|
12
|
+
parserOptions: {
|
13
|
+
ecmaVersion: 'latest'
|
14
|
+
}
|
15
|
+
};
|
@@ -1,8 +1,8 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "https://json.schemastore.org/prettierrc",
|
3
|
-
"semi": false,
|
4
|
-
"tabWidth": 2,
|
5
|
-
"singleQuote": true,
|
6
|
-
"printWidth": 100,
|
7
|
-
"trailingComma": "none"
|
1
|
+
{
|
2
|
+
"$schema": "https://json.schemastore.org/prettierrc",
|
3
|
+
"semi": false,
|
4
|
+
"tabWidth": 2,
|
5
|
+
"singleQuote": true,
|
6
|
+
"printWidth": 100,
|
7
|
+
"trailingComma": "none"
|
8
8
|
}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
import { CSSProperties, computed, defineComponent } from 'vue';
|
2
|
+
import { useBem } from '@/components/common';
|
3
|
+
import { BUTTON_NAME, ButtonProps, buttonProps } from './button.props';
|
4
|
+
|
5
|
+
export default defineComponent({
|
6
|
+
name: BUTTON_NAME,
|
7
|
+
props: buttonProps,
|
8
|
+
emits: ['click'],
|
9
|
+
setup(props: ButtonProps, context) {
|
10
|
+
const { slots } = context;
|
11
|
+
|
12
|
+
const { bem, getModifierClass } = useBem(BUTTON_NAME);
|
13
|
+
|
14
|
+
const buttonClass = computed(() => {
|
15
|
+
const classList = [bem(), getModifierClass(props.type)];
|
16
|
+
props.disabled && classList.push(getModifierClass('disabled'));
|
17
|
+
props.block && classList.push(getModifierClass('block'));
|
18
|
+
props.round && classList.push(getModifierClass('round'));
|
19
|
+
props.plain && classList.push(getModifierClass('plain'));
|
20
|
+
props.noBorder && classList.push(getModifierClass('noborder'));
|
21
|
+
props.loading && classList.push(getModifierClass('loading'));
|
22
|
+
props.size && classList.push(getModifierClass(props.size));
|
23
|
+
return classList;
|
24
|
+
});
|
25
|
+
|
26
|
+
const applyGradientBorderBehavior = (style: CSSProperties, color: string) =>{
|
27
|
+
const isGradientColor = color.includes('gradient');
|
28
|
+
if (isGradientColor) {
|
29
|
+
style.border = 0;
|
30
|
+
} else {
|
31
|
+
style.borderColor = color;
|
32
|
+
}
|
33
|
+
};
|
34
|
+
|
35
|
+
const buttonStyle = computed(() => {
|
36
|
+
const textColor = props.plain ? props.color : '#fff';
|
37
|
+
const backgroundColor = !props.plain ? props.color : null;
|
38
|
+
|
39
|
+
const style: CSSProperties = {};
|
40
|
+
if (props.color) {
|
41
|
+
style.color = textColor;
|
42
|
+
style.boxShadow = 'none';
|
43
|
+
backgroundColor && (style.background = backgroundColor);
|
44
|
+
applyGradientBorderBehavior(style, props.color);
|
45
|
+
}
|
46
|
+
return style;
|
47
|
+
});
|
48
|
+
|
49
|
+
const onClickButton = ($event: Event) =>{
|
50
|
+
$event.stopPropagation();
|
51
|
+
if (!props.disabled) {
|
52
|
+
context.emit('click', $event);
|
53
|
+
}
|
54
|
+
};
|
55
|
+
|
56
|
+
const renderLoading = () => {
|
57
|
+
return (
|
58
|
+
props.loading && <>
|
59
|
+
<span class={bem('loading')}>
|
60
|
+
<svg viewBox="25 25 50 50" class={bem('loading-icon-circular')}>
|
61
|
+
<circle cx="50" cy="50" r="20" fill="none" />
|
62
|
+
</svg>
|
63
|
+
</span>
|
64
|
+
{props.loadingText && <span class={bem('loading-text')}>{props.loadingText}</span>}
|
65
|
+
</>
|
66
|
+
);
|
67
|
+
};
|
68
|
+
|
69
|
+
const renderText = ()=> {
|
70
|
+
return slots.default && <span class={bem('text')}>{slots.default()}</span>;
|
71
|
+
};
|
72
|
+
|
73
|
+
return () => (
|
74
|
+
<button
|
75
|
+
class={buttonClass.value}
|
76
|
+
style={buttonStyle.value}
|
77
|
+
onClick={onClickButton}
|
78
|
+
>
|
79
|
+
{renderLoading()}
|
80
|
+
{renderText()}
|
81
|
+
</button>
|
82
|
+
);
|
83
|
+
}
|
84
|
+
});
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import { ExtractPropTypes, PropType } from 'vue';
|
2
|
+
|
3
|
+
export type ButtonType = 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info';
|
4
|
+
export type ButtonSize = 'large' | 'normal' | 'small' | 'mini';
|
5
|
+
|
6
|
+
export const BUTTON_NAME = "fm-button";
|
7
|
+
|
8
|
+
export const buttonProps = {
|
9
|
+
type: {
|
10
|
+
type: String as PropType<ButtonType>,
|
11
|
+
default: 'primary'
|
12
|
+
},
|
13
|
+
size: {
|
14
|
+
type: String as PropType<ButtonSize>,
|
15
|
+
default: ''
|
16
|
+
},
|
17
|
+
color: {
|
18
|
+
type: String,
|
19
|
+
default: ''
|
20
|
+
},
|
21
|
+
block: {
|
22
|
+
type: Boolean,
|
23
|
+
default: false
|
24
|
+
},
|
25
|
+
noBorder: {
|
26
|
+
type: Boolean,
|
27
|
+
default: false
|
28
|
+
},
|
29
|
+
plain: {
|
30
|
+
type: Boolean,
|
31
|
+
default: false
|
32
|
+
},
|
33
|
+
round: {
|
34
|
+
type: Boolean,
|
35
|
+
default: false
|
36
|
+
},
|
37
|
+
disabled: {
|
38
|
+
type: Boolean,
|
39
|
+
default: false
|
40
|
+
},
|
41
|
+
icon: {
|
42
|
+
type: String,
|
43
|
+
default: ''
|
44
|
+
},
|
45
|
+
loading: {
|
46
|
+
type: Boolean,
|
47
|
+
default: false
|
48
|
+
},
|
49
|
+
loadingText: {
|
50
|
+
type: String,
|
51
|
+
default: ''
|
52
|
+
}
|
53
|
+
};
|
54
|
+
|
55
|
+
export type ButtonProps = ExtractPropTypes<typeof buttonProps>;
|
@@ -0,0 +1,179 @@
|
|
1
|
+
@use '../../common/src/style/mixins/index.scss' as *;
|
2
|
+
|
3
|
+
:root {
|
4
|
+
--fm-button-height: 42px;
|
5
|
+
--fm-button-padding: 0 14px;
|
6
|
+
--fm-button-radius: 2px;
|
7
|
+
--fm-button-border-width: 1px;
|
8
|
+
--fm-button-color: var(--fm-white);
|
9
|
+
--fm-button-line-height: var(--fm-line-height);
|
10
|
+
--fm-button-font-size: var(--fm-font-size);
|
11
|
+
--fm-button-plain-background: var(--fm-white);
|
12
|
+
--fm-button-lg-height: 46px;
|
13
|
+
--fm-button-lg-font-size: 18px;
|
14
|
+
--fm-button-md-height: 38px;
|
15
|
+
--fm-button-md-font-size: 14px;
|
16
|
+
--fm-button-sm-height: 34px;
|
17
|
+
--fm-button-sm-padding: 0 8px;
|
18
|
+
--fm-button-sm-font-size: 12px;
|
19
|
+
--fm-button-xs-height: 28px;
|
20
|
+
--fm-button-xs-font-size: 10px;
|
21
|
+
--fm-button-secondary-color: var(--fm-blue-light);
|
22
|
+
}
|
23
|
+
|
24
|
+
@include b(button){
|
25
|
+
position: relative;
|
26
|
+
cursor: pointer;
|
27
|
+
display: inline-flex;
|
28
|
+
align-items: center;
|
29
|
+
justify-content: center;
|
30
|
+
box-sizing: border-box;
|
31
|
+
text-align: center;
|
32
|
+
margin: 0;
|
33
|
+
border: none;
|
34
|
+
transition: opacity 0.2s;
|
35
|
+
color: var(--fm-button-color);
|
36
|
+
height: var(--fm-button-height);
|
37
|
+
padding: var(--fm-button-padding);
|
38
|
+
font-size: var(--fm-button-font-size);
|
39
|
+
line-height: var(--fm-button-line-height);
|
40
|
+
border-radius: var(--fm-button-radius);
|
41
|
+
|
42
|
+
@include m((primary, info)) {
|
43
|
+
background: var(--fm-primary-color);
|
44
|
+
}
|
45
|
+
|
46
|
+
@include m(secondary) {
|
47
|
+
color: var(--fm-primary-color);
|
48
|
+
background: var(--fm-button-secondary-color);
|
49
|
+
}
|
50
|
+
|
51
|
+
@include m(danger) {
|
52
|
+
background-color: var(--fm-danger-color);
|
53
|
+
}
|
54
|
+
|
55
|
+
@include m(warning) {
|
56
|
+
background-color: var(--fm-warning-color);
|
57
|
+
}
|
58
|
+
|
59
|
+
@include m(success) {
|
60
|
+
background-color: var(--fm-success-color);
|
61
|
+
}
|
62
|
+
|
63
|
+
@include m(plain) {
|
64
|
+
box-shadow: none;
|
65
|
+
background: var(--fm-button-plain-background);
|
66
|
+
@include root-m((primary, info)) {
|
67
|
+
color: var(--fm-primary-color);
|
68
|
+
border: var(--fm-button-border-width) solid var(--fm-primary-color);
|
69
|
+
}
|
70
|
+
@include root-m(success) {
|
71
|
+
color: var(--fm-success-color);
|
72
|
+
border: var(--fm-button-border-width) solid var(--fm-success-color);
|
73
|
+
}
|
74
|
+
@include root-m(danger) {
|
75
|
+
color: var(--fm-danger-color);
|
76
|
+
border: var(--fm-button-border-width) solid var(--fm-danger-color);
|
77
|
+
}
|
78
|
+
@include root-m(warning) {
|
79
|
+
color: var(--fm-button-warning-color);
|
80
|
+
border: var(--fm-button-border-width) solid var(--fm-button-warning-color);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
@include m(noborder) {
|
85
|
+
border: none !important;
|
86
|
+
}
|
87
|
+
|
88
|
+
@include m(large) {
|
89
|
+
height: var(--fm-button-lg-height);
|
90
|
+
font-size: var(--fm-button-lg-font-size);
|
91
|
+
}
|
92
|
+
|
93
|
+
@include m(normal) {
|
94
|
+
height: var(--fm-button-md-height);
|
95
|
+
font-size: var(--fm-button-md-font-size);
|
96
|
+
}
|
97
|
+
|
98
|
+
@include m(small) {
|
99
|
+
height: var(--fm-button-sm-height);
|
100
|
+
padding: var(--fm-button-sm-padding);
|
101
|
+
font-size: var(--fm-button-sm-font-size);
|
102
|
+
}
|
103
|
+
|
104
|
+
@include m(mini) {
|
105
|
+
height: var(--fm-button-xs-height);
|
106
|
+
padding: var(--fm-button-sm-padding);
|
107
|
+
font-size: var(--fm-button-xs-font-size);
|
108
|
+
}
|
109
|
+
|
110
|
+
@include m(block) {
|
111
|
+
display: flex;
|
112
|
+
width: 100%;
|
113
|
+
}
|
114
|
+
|
115
|
+
@include m(disabled) {
|
116
|
+
cursor: not-allowed;
|
117
|
+
opacity: var(--fm-disabled-opacity);
|
118
|
+
}
|
119
|
+
|
120
|
+
@include m((loading, disabled)) {
|
121
|
+
&::before {
|
122
|
+
display: none;
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
@include m(round) {
|
127
|
+
border-radius: var(--fm-radius-max);
|
128
|
+
}
|
129
|
+
|
130
|
+
@include m(square) {
|
131
|
+
border-radius: 0;
|
132
|
+
}
|
133
|
+
|
134
|
+
@include e(loading) {
|
135
|
+
display: inline-block;
|
136
|
+
width: 20px;
|
137
|
+
max-width: 100%;
|
138
|
+
height: 20px;
|
139
|
+
max-height: 100%;
|
140
|
+
vertical-align: middle;
|
141
|
+
animation: fm-rotate 2s linear infinite;
|
142
|
+
circle {
|
143
|
+
animation: fm-circular 1.5s ease-in-out infinite;
|
144
|
+
stroke: currentColor;
|
145
|
+
stroke-width: 4;
|
146
|
+
stroke-linecap: round;
|
147
|
+
}
|
148
|
+
}
|
149
|
+
@include e(loading-icon-circular) {
|
150
|
+
color: #fff;
|
151
|
+
}
|
152
|
+
@include e(loading-text) {
|
153
|
+
margin-left: 6px;
|
154
|
+
}
|
155
|
+
@include e(icon) {
|
156
|
+
&:not(:last-child) {
|
157
|
+
margin-right: 6px;
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
&::before {
|
162
|
+
position: absolute;
|
163
|
+
top: 50%;
|
164
|
+
left: 50%;
|
165
|
+
width: 100%;
|
166
|
+
height: 100%;
|
167
|
+
background-color: #000;
|
168
|
+
border: inherit;
|
169
|
+
border-color: #000;
|
170
|
+
border-radius: inherit;
|
171
|
+
-webkit-transform: translate(-50%, -50%);
|
172
|
+
transform: translate(-50%, -50%);
|
173
|
+
opacity: 0;
|
174
|
+
content: ' ';
|
175
|
+
}
|
176
|
+
&:active::before {
|
177
|
+
opacity: 0.1;
|
178
|
+
}
|
179
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
export * from './types';
|
2
|
+
export * from './use-context/use-parent-context';
|
3
|
+
export * from './use-context/use-children-contexts';
|
4
|
+
export * from './use-event-listener';
|
5
|
+
export * from './use-touch-move';
|
6
|
+
export * from './use-touch';
|
7
|
+
export * from './use-lay-render';
|
8
|
+
export * from './use-refs';
|
9
|
+
export * from './use-rect';
|
10
|
+
export * from './use-expose';
|
11
|
+
export * from './use-mount-component';
|
12
|
+
export * from './use-bem';
|
13
|
+
export * from './use-link';
|
14
|
+
export * from './use-click-away';
|
15
|
+
export * from './use-lock-scroll';
|
16
|
+
export * from './use-momentum';
|
17
|
+
export * from './use-scroll-parent';
|
18
|
+
export * from './use-resize-observer';
|
19
|
+
export * from './use-long-press';
|