fu-kit 0.4.2 → 0.6.0

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/LICENCE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Volodymyr Ishchenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,58 +1,23 @@
1
1
  # fu-kit
2
2
 
3
- ## Standard Vue run sequence
4
-
5
- Lightweight cozy components library for Vue3.
6
-
7
- Demo [fu-kit.vovchisko.dev](https://fu-kit.vovchisko.dev)
8
-
9
3
  ![Unreasonable](https://img.shields.io/badge/unreasonable-absolutely-green)
10
-
11
4
  ![NPM Version](https://img.shields.io/npm/v/fu-kit.svg)
12
- ![npm bundle size](https://img.shields.io/bundlephobia/min/fu-kit)
13
5
  ![NPM Downloads per month](https://img.shields.io/npm/dm/fu-kit.svg)
14
6
  ![GitHub last commit](https://img.shields.io/github/last-commit/vovchisko/fu-kit.svg)
15
7
  ![GitHub license](https://img.shields.io/github/license/vovchisko/fu-kit.svg)
16
8
 
17
- ```
18
- npm i # install
19
- npm run serve # serve locally
20
- npm run build # build demo
21
- ```
22
-
23
- > ### 🚧 Use with caution! 🚧
24
- > This components library is under development.
9
+ Lightweight cozy components library for Vue3.
25
10
 
26
- ## Components
11
+ Non-buildable Vue3 SFC components built, mostly, to work with vite, but with some additional pain can works with vue-cli+webpack.
27
12
 
28
- - [x] button
29
- - [x] button-link
30
- - [x] code-view
31
- - [x] copy
32
- - [ ] progress-radial
33
- - [x] select
34
- - [x] select fancy (select-x)
35
- - [ ] select transparent (slot)
36
- - [x] text
37
- - [x] sidebar
38
- - [ ] modal
39
- - [ ] drawer
40
- - [x] text
41
- - [x] textarea
42
- - [ ] checkbox
43
- - [ ] radio
44
- - [ ] checklist
45
- - [ ] checklist fancy
46
- - [ ] slider
47
- - [ ] layout w/ sidebar
48
- - [ ] layout w/ nav-bar
49
-
50
- ## Utils
13
+ Use it with caution. This is my play yard.
51
14
 
52
- - [ ] media-listener
53
- - [ ] scroll-blocker
54
- - [ ] ?
15
+ ## Standard Vue run sequence
55
16
 
56
- ## Icons
17
+ Demo [fu-kit.vovchisko.dev](https://fu-kit.vovchisko.dev)
57
18
 
58
- Icons can be in-lined SVG or font-based. TBD.
19
+ ```
20
+ npm i # install
21
+ npm run serve # serve locally
22
+ npm run build # build demo
23
+ ```
package/package.json CHANGED
@@ -1,52 +1,45 @@
1
1
  {
2
2
  "name": "fu-kit",
3
- "version": "0.4.2",
3
+ "version": "0.6.0",
4
4
  "description": "",
5
- "main": "dist/fu-kit.ssr.js",
6
- "browser": "dist/fu-kit.esm.js",
7
- "module": "dist/fu-kit.esm.js",
8
- "unpkg": "dist/fu-kit.min.js",
5
+ "main": "src/entry.js",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "serve": "vite preview"
10
+ },
11
+ "sideEffects": [
12
+ "*.scss",
13
+ "*.vue"
14
+ ],
9
15
  "files": [
10
- "dist/*",
16
+ "src/components/*",
11
17
  "src/scss-kit/*",
18
+ "src/utils/*",
19
+ "src/entry.js",
20
+ "src/constants.js",
12
21
  "reset.scss",
13
22
  "root.scss",
14
23
  "scss.scss"
15
24
  ],
16
- "sideEffects": false,
17
- "dependencies": {},
18
- "scripts": {
19
- "serve": "vue-cli-service serve src/serve/main.js",
20
- "prebuild": "rimraf ./dist && rimraf ./docs",
21
- "postbuild": "npm run build:docs",
22
- "build": "cross-env NODE_ENV=production rollup --config rollup.config.js",
23
- "build:docs": "node ./scripts/re-link-docs.js",
24
- "build:ssr": "cross-env NODE_ENV=production rollup --config rollup.config.js --format cjs",
25
- "build:es": "cross-env NODE_ENV=production rollup --config rollup.config.js --format es",
26
- "build:unpkg": "cross-env NODE_ENV=production rollup --config rollup.config.js --format iife"
27
- },
28
25
  "devDependencies": {
29
- "@rollup/plugin-alias": "^3.1.2",
30
- "@rollup/plugin-commonjs": "^14.0.0",
31
- "@rollup/plugin-node-resolve": "^9.0.0",
32
- "@rollup/plugin-replace": "^2.4.2",
33
- "@vue/cli-service": "^4.5.13",
34
- "@vue/compiler-sfc": "^3.0.11",
26
+ "@vitejs/plugin-vue": "^1.9.3",
35
27
  "cross-env": "^7.0.3",
36
- "minimist": "^1.2.5",
37
- "postcss": "^8.2.10",
38
28
  "rimraf": "^3.0.2",
39
- "rollup": "^2.52.8",
40
- "rollup-plugin-postcss": "^4.0.0",
41
- "rollup-plugin-terser": "^7.0.2",
42
- "rollup-plugin-vue": "^6.0.0",
43
29
  "sass": "^1.26.5",
44
- "sass-loader": "^8.0.2"
30
+ "vite": "^2.6.4"
45
31
  },
46
32
  "peerDependencies": {
47
- "vue": "^3.0.5"
33
+ "vue": "^3.2.16"
48
34
  },
49
35
  "engines": {
50
36
  "node": ">=12"
37
+ },
38
+ "dependencies": {
39
+ "lodash": "^4.17.21",
40
+ "vue": "^3.2.16",
41
+ "vue-router": "^4.0.0-0",
42
+ "vue-the-mask": "^0.11.1",
43
+ "vue3-click-away": "^1.2.1"
51
44
  }
52
45
  }
package/reset.scss CHANGED
@@ -1,71 +1,81 @@
1
- @import "src/scss-kit/typo";
2
-
3
- body {
4
- margin: 0;
5
- padding: 0;
6
- color: var(--pal-text);
7
- }
8
-
9
- address, article, aside, blockquote, details, dialog, dd, div, dl, dt, fieldset, figcaption,
10
- figure, footer, form, hgroup, hr, li, main, nav,
11
- ol, p, pre, section, table, ul {
12
- margin: 0;
13
- padding: 0;
14
- box-sizing: border-box;
15
- font-family: var(--typo-font-text);
16
- line-height: 1.2;
17
- }
18
-
19
- h1, h2, h3, h4, h5, h6, header {
20
- font-family: var(--typo-font-heading);
21
- margin: 0;
22
- padding: 0;
23
- box-sizing: border-box;
24
- line-height: 1.2;
25
- }
26
-
27
- input, button, textarea, select, span, b, small {
28
- box-sizing: border-box;
29
- line-height: 1.2;
30
- }
31
-
32
- h1 {
33
- @include typo(700);
34
- }
35
-
36
- h2 {
37
- @include typo(600);
38
- }
39
-
40
- h3 {
41
- @include typo(500);
42
- }
43
-
44
- h4 {
45
- @include typo(400);
46
- }
47
-
48
- h5 {
49
- @include typo(300);
50
- }
51
-
52
- p {
53
- @include typo(200);
54
- }
55
-
56
- small {
57
- @include typo(100);
58
- }
59
-
60
- label {
61
- @include typo(100);
62
- display: block;
63
- }
64
-
65
- a {
66
- color: var(--pal-link);
67
-
68
- &:active, &:focus {
69
- color: var(--pal-link-active);
70
- }
71
- }
1
+ @import "src/scss-kit/typo";
2
+
3
+ body {
4
+ margin: 0;
5
+ padding: 0;
6
+ color: var(--pal-text);
7
+ }
8
+
9
+ address, article, aside, blockquote, details, dialog, dd, div, dl, dt, fieldset, figcaption,
10
+ figure, footer, form, hgroup, hr, li, main, nav,
11
+ ol, p, pre, section, table, ul {
12
+ margin: 0;
13
+ padding: 0;
14
+ box-sizing: border-box;
15
+ font-family: var(--typo-font-text);
16
+ line-height: 1.2;
17
+ }
18
+
19
+ h1, h2, h3, h4, h5, h6, header {
20
+ font-family: var(--typo-font-heading);
21
+ margin: 0;
22
+ padding: 0;
23
+ box-sizing: border-box;
24
+ line-height: 1.2;
25
+ }
26
+
27
+ input, button, textarea, select, span, b, small {
28
+ box-sizing: border-box;
29
+ line-height: 1;
30
+ font-family: var(--typo-font-text);
31
+ font-size: inherit;
32
+ }
33
+
34
+ pre {
35
+ font-family: var(--typo-font-mono);
36
+ }
37
+
38
+ h1 {
39
+ @include typo(700);
40
+ }
41
+
42
+ h2 {
43
+ @include typo(600);
44
+ }
45
+
46
+ h3 {
47
+ @include typo(500);
48
+ }
49
+
50
+ h4 {
51
+ @include typo(400);
52
+ }
53
+
54
+ h5 {
55
+ @include typo(300);
56
+ }
57
+
58
+ p {
59
+ @include typo(200);
60
+ }
61
+
62
+ small {
63
+ @include typo(100);
64
+ }
65
+
66
+ label {
67
+ @include typo(100);
68
+ display: block;
69
+ }
70
+
71
+ a {
72
+ color: var(--pal-link);
73
+
74
+ &:active, &:focus {
75
+ color: var(--pal-link-active);
76
+ }
77
+ }
78
+
79
+ svg {
80
+ fill: none;
81
+ }
package/root.scss CHANGED
@@ -1,11 +1,10 @@
1
1
  @import "src/scss-kit/typo";
2
2
  @import "src/scss-kit/colors";
3
3
 
4
- :root {
5
-
4
+ html {
6
5
  // RAW RGB VALUES
7
6
  --rgb-white: #{hex2rgb(#FFFFFF)};
8
- --rgb-light: #{hex2rgb(#FEFEFE)};
7
+ --rgb-light: #{hex2rgb(#FAFAFA)};
9
8
  --rgb-grey100: #{hex2rgb(#F4F4F4)};
10
9
  --rgb-grey200: #{hex2rgb(#DCDCDC)};
11
10
  --rgb-grey300: #{hex2rgb(#BFBFBF)};
@@ -18,12 +17,13 @@
18
17
  --rgb-dark: #{hex2rgb(#151515)};
19
18
  --rgb-black: #{hex2rgb(#000000)};
20
19
 
21
- --rgb-brand: #{hex2rgb(#8347A8)};
22
- --rgb-primary: #{hex2rgb(#2E88F1)};
23
- --rgb-secondary: #{hex2rgb(#434F5F)};
24
- --rgb-positive: #{hex2rgb(#6DBE2C)};
25
- --rgb-warning: #{hex2rgb(#FFA927)};
26
- --rgb-negative: #{hex2rgb(#FF4B4B)};
20
+ --rgb-brand: #{hex2rgb(#0095ff)};
21
+ --rgb-primary: #{hex2rgb(#0095ff)};
22
+ --rgb-secondary: #{hex2rgb(#131315)};
23
+ --rgb-positive: #{hex2rgb(#3e9400)};
24
+ --rgb-warning: #{hex2rgb(#ff7300)};
25
+ --rgb-negative: #{hex2rgb(#ff3535)};
26
+ --rgb-link: #{hex2rgb(#0095ff)};
27
27
 
28
28
  // Format palette colors: "--pal-{code}": #RGB
29
29
 
@@ -55,15 +55,16 @@
55
55
  --pal-acc-warning: rgb(var(--rgb-white));
56
56
  --pal-acc-negative: rgb(var(--rgb-white));
57
57
 
58
- --pal-text: rgb(var(--rgb-dark));
58
+ --pal-text: rgb(var(--rgb-grey700));
59
59
  --pal-text-dimm: rgb(var(--rgb-grey600));
60
60
  --pal-block: rgb(var(--rgb-grey100));
61
61
  --pal-block-border: rgb(var(--rgb-grey200));
62
62
  --pal-bg: rgb(var(--rgb-white));
63
- --pal-overlay: rgba(var(--rgb-dark), 0.2);
63
+ --pal-overlay: rgba(var(--rgb-grey500), 0.2);
64
64
  --pal-link: rgb(var(--rgb-primary));
65
- --pal-link-active: rgb(var(--rgb-dark));
65
+ --pal-link-active: rgb(var(--rgb-brand));
66
66
 
67
+ --ui-rgb: var(--rgb-primary);
67
68
  --ui-pal: var(--pal-primary);
68
69
  --ui-pal-bg: var(--pal-bg);
69
70
  --ui-pal-acc: var(--pal-acc-primary);
@@ -74,17 +75,26 @@
74
75
  --ui-pal-disabled: rgb(var(--rgb-grey100));
75
76
  --ui-pal-disabled-border: rgb(var(--rgb-grey300));
76
77
 
77
- --ui-transition: linear 120ms;
78
78
  --ui-lt-h: 36px;
79
79
  --ui-lt-h-sub: 22px;
80
+ --ui-lt-check-border-width: 2px;
81
+ --ui-switch-h: 24px;
82
+ --ui-switch-w: 38px;
83
+ --ui-check-size: 20px;
84
+ --ui-check-border-w: 2px;
80
85
  --ui-lt-border-style: solid;
81
- --ui-lt-border-width: 1px;
86
+ --ui-lt-border-width: 2px;
82
87
  --ui-lt-border-radius: var(--lt-border-radius-inner);
83
88
  --ui-lt-disabled-border-style: dashed;
84
- --ui-lt-scroll-width: 12px;
85
89
 
86
- --typo-font-heading: 'Segoe UI', San Francisco, Roboto, Lucida Sans;
87
- --typo-font-text: 'Segoe UI', San Francisco, Roboto, Lucida Sans;
90
+ --ui-scroll-bg: inherit;
91
+ --ui-scroll-width: 8px;
92
+
93
+ --ui-dropdown-max-height: 30vh;
94
+
95
+ --typo-font-text: Helvetica, 'Segoe UI', San Francisco, Roboto, Lucida Sans;
96
+ --typo-font-heading: var(--typo-font-text);
97
+ --typo-font-ui: var(--typo-font-text);
88
98
  --typo-font-mono: monospace;
89
99
 
90
100
  // font-size
@@ -105,8 +115,8 @@
105
115
  --typo-lh200: 16px;
106
116
  --typo-lh300: 18px;
107
117
  --typo-lh400: 22px;
108
- --typo-lh500: 26px;
109
- --typo-lh600: 32px;
118
+ --typo-lh500: 24px;
119
+ --typo-lh600: 36px;
110
120
  --typo-lh700: 42px;
111
121
  --typo-lh800: 48px;
112
122
  --typo-lh900: 64px;
@@ -122,8 +132,8 @@
122
132
  --lt-sp800: 256px;
123
133
  --lt-sp900: 512px;
124
134
 
125
- --lt-border-radius: 9px;
126
- --lt-border-radius-inner: 5px;
135
+ --lt-border-radius: 0px;
136
+ --lt-border-radius-inner: 0px;
127
137
 
128
138
  --lt-z-1: 1;
129
139
  --lt-z-back: -1;
@@ -131,4 +141,6 @@
131
141
  --lt-z-nav: 2000;
132
142
  --lt-z-modal-backdrop: 3000;
133
143
  --lt-z-modal: 3001;
144
+
145
+ --ui-transition: linear 120ms;
134
146
  }
@@ -0,0 +1,169 @@
1
+ <template>
2
+ <button
3
+ v-bind="{
4
+ ...$attrs,
5
+ type: $attrs.type || 'button',
6
+ class: ['ui-button', (hollow ? ' _hollow' : ''), (naked ? ' _naked' : ''), (isLoading ? ' _loading' : '')].join(''),
7
+ }"
8
+ @mouseup="mUp"
9
+ >
10
+ <slot />
11
+ <ui-icon v-if="isLoading" name="loader" class="ui-button_loader" />
12
+ </button>
13
+ </template>
14
+
15
+ <script>
16
+ import { defineComponent } from 'vue'
17
+
18
+ import UiIcon from './UiIcon.vue'
19
+
20
+ export default defineComponent({
21
+ name: 'ui-button',
22
+ components: { UiIcon },
23
+ props: {
24
+ hollow: { type: Boolean, default: false },
25
+ naked: { type: Boolean, default: false },
26
+ isLoading: { type: Boolean, default: false },
27
+ },
28
+ setup () {
29
+ const mUp = (e) => e.target.blur()
30
+ return { mUp }
31
+ },
32
+ })
33
+ </script>
34
+
35
+ <style lang="scss" scoped>
36
+ @import "../../scss";
37
+
38
+ .ui-button {
39
+ @include typo(200);
40
+
41
+ display: flex;
42
+ align-items: center;
43
+ justify-content: center;
44
+ box-sizing: border-box;
45
+ cursor: pointer;
46
+ padding: var(--ui-button-padding, #{spacing(300)} #{spacing(400)});
47
+ font-family: var(--typo-font-ui);
48
+ min-height: var(--ui-lt-h);
49
+ border-width: var(--ui-lt-border-width);
50
+ border-style: var(--ui-lt-border-style);
51
+ border-color: var(--ui-pal);
52
+ border-radius: var(--ui-lt-border-radius);
53
+ transition: all var(--ui-transition);
54
+ background: var(--ui-pal);
55
+ color: var(--ui-pal-acc);
56
+ line-height: 1;
57
+ will-change: box-shadow, transform;
58
+ gap: var(--ui-button-gap, #{spacing(300)});
59
+ outline: none;
60
+ user-select: none;
61
+
62
+ --icon-size: 1em;
63
+
64
+ -webkit-tap-highlight-color: transparent;
65
+
66
+ & > * {
67
+ pointer-events: none;
68
+ }
69
+
70
+ &:hover {
71
+ text-decoration: none;
72
+ box-shadow: 0 4px 12px -4px var(--ui-pal);
73
+ }
74
+
75
+ &:focus {
76
+ box-shadow: 0 4px 12px -4px var(--ui-pal);
77
+ }
78
+
79
+ &:active {
80
+ transition-duration: 20ms;
81
+ box-shadow: 0 3px 4px -2px var(--ui-pal);
82
+ }
83
+
84
+ &:disabled {
85
+ cursor: not-allowed;
86
+ background: var(--ui-pal-disabled);
87
+ border-color: var(--ui-pal-disabled-border);
88
+ border-style: var(--ui-lt-disabled-border-style);
89
+ color: var(--ui-pal-disabled-border);
90
+ box-shadow: none;
91
+ }
92
+
93
+ &._hollow {
94
+ background: transparent;
95
+ color: var(--ui-pal);
96
+
97
+ &:hover {
98
+ box-shadow: 0 3px 10px -4px var(--ui-pal);
99
+ }
100
+
101
+ &:focus {
102
+ box-shadow: 0 3px 10px -4px var(--ui-pal);
103
+ }
104
+
105
+ &:active {
106
+ box-shadow: 0 1px 4px -2px var(--ui-pal);
107
+ }
108
+
109
+ &:disabled {
110
+ color: var(--ui-pal-disabled-border);
111
+ box-shadow: none;
112
+ }
113
+ }
114
+
115
+ &._naked {
116
+ background: transparent;
117
+ color: var(--ui-pal);
118
+ border: 0 none;
119
+ padding: var(--ui-button-padding, var(--lt-sp300));
120
+
121
+ &:hover {
122
+ box-shadow: none;
123
+ }
124
+
125
+ &:focus {
126
+ box-shadow: none;
127
+ }
128
+
129
+ &:active {
130
+ box-shadow: none;
131
+ }
132
+
133
+ &:disabled {
134
+ color: var(--ui-pal-disabled-border);
135
+ box-shadow: none;
136
+ }
137
+ }
138
+
139
+ &._loading {
140
+ color: transparent;
141
+ }
142
+
143
+ &_loader {
144
+ --icon-size: 1em;
145
+ --icon-color: var(--ui-pal-acc);
146
+ position: absolute;
147
+ animation: spin 2s infinite;
148
+ }
149
+
150
+ &._hollow > &_loader, &._naked > &_loader {
151
+ --icon-size: 1em;
152
+ --icon-color: var(--ui-pal);
153
+ position: absolute;
154
+ animation: spin 2s infinite;
155
+ }
156
+ }
157
+
158
+ @keyframes spin {
159
+ 0% {
160
+ transform: scale(1) rotate(0);
161
+ }
162
+ 50% {
163
+ transform: scale(1.5) rotate(180deg);
164
+ }
165
+ 100% {
166
+ transform: scale(1) rotate(360deg);
167
+ }
168
+ }
169
+ </style>
@@ -0,0 +1,74 @@
1
+ <template>
2
+ <button
3
+ v-bind="{
4
+ ...$attrs,
5
+ type: $attrs.type || 'button',
6
+ class: 'ui-button-link',
7
+ }"
8
+ @mouseup="mUp"
9
+ >
10
+ <slot />
11
+ </button>
12
+ </template>
13
+
14
+ <script>
15
+ import { defineComponent } from 'vue'
16
+
17
+ export default defineComponent({
18
+ name: 'ui-button-link',
19
+ props: {
20
+ hollow: { type: Boolean, default: false },
21
+ },
22
+ setup (props) {
23
+ const mUp = (e) => e.target.blur()
24
+ return { hollow: props.hollow, mUp }
25
+ },
26
+ })
27
+ </script>
28
+
29
+ <style lang="scss" scoped>
30
+ @import "../../scss";
31
+
32
+ .ui-button-link {
33
+ @include typo(200);
34
+ padding: spacing(0, 0);
35
+
36
+ display: inline-block;
37
+ box-sizing: border-box;
38
+ cursor: pointer;
39
+ font-family: var(--typo-font-text);
40
+ border: 0 none;
41
+ transition: all var(--ui-transition);
42
+ background: transparent;
43
+ color: var(--pal-link);
44
+ line-height: 1;
45
+ will-change: box-shadow, transform;
46
+ outline: none;
47
+ user-select: none;
48
+ -webkit-tap-highlight-color: transparent;
49
+ text-decoration: none;
50
+
51
+ & > * {
52
+ pointer-events: none;
53
+ }
54
+
55
+ &:hover {
56
+ text-decoration: underline;
57
+ }
58
+
59
+ &:focus {
60
+ color: var(--pal-link-active);
61
+ text-decoration: underline;
62
+ }
63
+
64
+ &:active {
65
+ color: var(--pal-link-active);
66
+ text-decoration: underline;
67
+ }
68
+
69
+ &:disabled {
70
+ cursor: not-allowed;
71
+ color: var(--ui-pal-disabled);
72
+ }
73
+ }
74
+ </style>