vueless 0.0.12 → 0.0.14

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/README.md CHANGED
@@ -1,174 +1,55 @@
1
- ## How to run the project locally
1
+ ![logo.png](public/images/vueless-logo-git.png)
2
2
 
3
- - Install **node.js 16.XX** version (see [instructions](https://nodejs.org/en/download/package-manager/) for your OS).
3
+ ## Vueless UI
4
4
 
5
- - Install globally [Yarn](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable):
5
+ * [Documentation](https://docs.vueless.com/)
6
+ * [UI Components](https://ui.vueless.com/)
7
+ * [Website](http://vueless.com/)
6
8
 
7
- ```bash
8
- npm install --global yarn
9
- ```
10
-
11
- - Create project folder and clone files from Git into:
12
-
13
- ```bash
14
- # download project from remote repository
15
- git clone origin git@gitlab.com:<project_name>.git
16
-
17
- # go to project folder
18
- cd <project_name>
19
- ```
20
-
21
- - Install project dependencies (node_modules):
22
-
23
- ```bash
24
- yarn install
25
- ```
9
+ ## Quick Start
26
10
 
27
- - Create environment file:
11
+ 1. Install `vueless` UI library packages.
28
12
 
29
13
  ```bash
30
- # for local environment
31
- cp .env.local.example .env.local
14
+ npm install vueless @vueless/plugin-vite
32
15
  ```
33
16
 
34
- - Run the app in **development** mode:
35
-
36
- ```bash
37
- yarn dev
38
- ```
39
-
40
- - The project is ready!
41
-
42
- ## REST API
43
-
44
- - Public URL: https://fine.gitbook.io/api/
45
-
46
- - Development URL (same but editable):
17
+ 2. Create `vueless.config.js` at the root of the project.
47
18
 
48
- - URL: https://app.gitbook.com/s/-MAVM-6BL-A_fpwuMsE1/
49
- - Login: i.ivan.gridnev@gmail.com
50
- - Password: XZQnUtFEZ4v9PML
51
-
52
- Section **AUTH & APPS** contains **Main** application endpoints, while section **APP INSTANCE** contains **Business** application endpoints.
53
-
54
-
55
- ## Additional commands
56
-
57
- - Open Storybook (frontend base UI components documentation):
58
-
59
- ```bash
60
- # run Storybook in development mode (with docs and stories):
61
- # It's good for debugging components.
62
- yarn sb:dev-full
63
-
64
- # run Storybook in development mode (with docs only):
65
- yarn sb:dev
66
-
67
- # build Storybook (to publish in the web):
68
- yarn sb:build
69
-
70
- # Run the built application from a `/storybook-static` folder in production mode:
71
- yarn sb:preview
19
+ ```javascript filename="vueless.config.js" title="vueless.config.js"
20
+ export default {
21
+ color: {},
22
+ component: {},
23
+ };
72
24
  ```
73
25
 
74
- - Run code-style check / formatting:
26
+ 3. Add TailwindCSS preset.
75
27
 
76
- ```bash
77
- # check code style (only show errors)
78
- yarn lint
79
-
80
- # check code style and fix all possible errors
81
- yarn lint:fix
28
+ ```javascript
29
+ import { vuelessPreset } from "vueless/preset.tailwind";
82
30
 
83
- # check code style of given file paths (fail pipeline if at least 1 error or warning appears)
84
- yarn lint:ci
31
+ export default {
32
+ presets: [vuelessPreset],
33
+ ...
34
+ };
85
35
  ```
86
36
 
87
- - Run auto tests:
37
+ 4. Add Vite plugins.
88
38
 
89
- ```bash
90
- # start unit tests
91
- yarn test:unit
39
+ ```javascript
40
+ import { Vueless, VuelessUnpluginComponents } from "@vueless/plugin-vite";
92
41
 
93
- # start end to end tests
94
- yarn test:e2e
95
-
96
- # start end to end tests in headless mode (no UI)
97
- yarn test:e2e-ci
42
+ export default defineConfig({
43
+ plugins: [
44
+ ...
45
+ Vueless(),
46
+ VuelessUnpluginComponents(),
47
+ ],
48
+ ...
49
+ })
98
50
  ```
99
51
 
100
- - Build application:
52
+ That's it! You can use components in your app now ✨
101
53
 
102
- ```bash
103
- # for the dev / test / production servers
104
- cp .env.example .env
105
54
 
106
- yarn build
107
- # TIP: 📐
108
- # to analise and reduce the build size see the report.html in a project root folder.
109
- ```
110
-
111
- - Run the built application from a `/dist` folder in **production mode**:
112
55
 
113
- ```bash
114
- yarn preview
115
- ```
116
-
117
- - Automated releases (new app release in GitLab and increase app version number):
118
-
119
- ```bash
120
- # increase third app version number (0.0.X).
121
- yarn release
122
-
123
- # increase second app version number (0.X.0).
124
- yarn release:production
125
-
126
- # increase first app version number (X.0.0).
127
- release:production-major
128
- ```
129
-
130
- - Update browserslist DB to the latest version (it changes yarn.lock only):
131
-
132
- ```bash
133
- npx browserslist@latest --update-db
134
- ```
135
-
136
- - **Note**: `yarn` automatically calls the` postinstall` command,
137
- which generate components web-types for IDE (props autocomplete).
138
- If you need to do this manually, just use the command below:
139
-
140
- ```bash
141
- node .mono/our.library.web-types-gen
142
- ```
143
-
144
- ## Capacitor (iOS & Android apps)
145
-
146
- - Update app src after `dist` or `capacitor.config.js` file changes:
147
-
148
- ```bash
149
- npx cap copy
150
- ```
151
-
152
- - Open iOS app locally:
153
-
154
- ```bash
155
- npx cap open ios
156
- ```
157
-
158
- - Open Android app locally:
159
-
160
- ```bash
161
- npx cap open android
162
- ```
163
-
164
- - Sync the app after new capacitor plugin installation:
165
-
166
- ```bash
167
- npx cap sync
168
- ```
169
-
170
- - Generate app icons and splash screens ([docs](https://github.com/ionic-team/capacitor-assets)):
171
-
172
- ```bash
173
- npx @capacitor/assets generate --assetPath 'public/static/capacitor' --iconBackgroundColor '#FFFFFF' --iconBackgroundColorDark '#111827' --splashBackgroundColor '#F3F4F6' --splashBackgroundColorDark '#1F2937' --ios --android
174
- ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -19,8 +19,7 @@
19
19
  "sb:build": "STORYBOOK_VUELESS_ENV=1 storybook build",
20
20
  "sb:preview": "vite preview --host --outDir=storybook-static",
21
21
  "vueless:update": "yarn add -D file:../vite-plugin-vueless file:../vueless-storybook",
22
- "vueless:publish": "rm -rf dist && mkdir -p dist && cp -r src/* package.json LICENSE web-types.json README.md dist/ && npm publish ./dist",
23
- "postinstall": "node .web-types-gen"
22
+ "vueless:prepare": "node .web-types-gen && rm -rf dist && mkdir -p dist && cp -r src/* package.json LICENSE web-types.json README.md dist/"
24
23
  },
25
24
  "dependencies": {
26
25
  "@kyvg/vue3-notification": "^3.2.1",
@@ -60,9 +59,6 @@
60
59
  "vite-plugin-eslint": "^1.8.1",
61
60
  "vue": "^3.4.19"
62
61
  },
63
- "resolutions": {
64
- "string-width": "4.2.3"
65
- },
66
62
  "repository": {
67
63
  "type": "git",
68
64
  "url": "git+https://github.com/vuelessjs/vueless.git"
@@ -0,0 +1,95 @@
1
+ import colors from "tailwindcss/colors.js";
2
+ import forms from "@tailwindcss/forms";
3
+ import vuelessConfig from "../../../vueless.config.js";
4
+
5
+ export const grayColors = ["slate", "gray", "zinc", "neutral", "stone"];
6
+ export const brandColors = [
7
+ "brand",
8
+ "red",
9
+ "orange",
10
+ "amber",
11
+ "yellow",
12
+ "lime",
13
+ "green",
14
+ "emerald",
15
+ "teal",
16
+ "cyan",
17
+ "sky",
18
+ "blue",
19
+ "indigo",
20
+ "violet",
21
+ "purple",
22
+ "fuchsia",
23
+ "pink",
24
+ "rose",
25
+ ];
26
+
27
+ /**
28
+ * Generates preset for TailwindCSS base on Vueless config.
29
+ * @returns {Object}
30
+ */
31
+ export function vuelessPreset() {
32
+ const isProd = process.env.NODE_ENV === "production";
33
+ const brandColor = twColorWithOpacity("--color-brand");
34
+ const { brand, gray } = vuelessConfig;
35
+
36
+ let brandPalette = brandColors.includes(brand) ? colors[brand] : colors.green;
37
+ let grayPalette = grayColors.includes(gray) ? colors[gray] : colors.zinc;
38
+
39
+ if (brand === "grayscale") {
40
+ brandPalette = grayPalette;
41
+ }
42
+
43
+ const prodSafelist = getSafelist();
44
+ const devSafelist = [
45
+ {
46
+ pattern: /(border|bg|text|ring)-(.*)-((50|[1-9]00|950)?)$/,
47
+ variants: ["hover", "focus", "focus-within", "active"],
48
+ },
49
+ ];
50
+
51
+ return {
52
+ content: [
53
+ "./index.html",
54
+ "./src/**/*.{js,ts,jsx,tsx,vue}",
55
+ "./vueless.config.{js,ts}",
56
+ "./node_modules/vueless/**/*.{js,ts,vue}",
57
+ ],
58
+ safelist: isProd ? prodSafelist : devSafelist,
59
+ theme: {
60
+ extend: {
61
+ colors: {
62
+ brand: { ...brandPalette, DEFAULT: brandColor },
63
+ gray: grayPalette,
64
+ },
65
+ fontSize: {
66
+ "2xs": ["0.625rem", "0.875rem"], // 10px
67
+ },
68
+ },
69
+ },
70
+ plugins: [forms],
71
+ };
72
+ }
73
+
74
+ /**
75
+ * Transform CSS variable with RGB numbers into CSS color.
76
+ * @returns {Function}
77
+ */
78
+ function twColorWithOpacity(variableName) {
79
+ return ({ opacityValue }) => {
80
+ return opacityValue !== undefined
81
+ ? `rgba(var(${variableName}), ${opacityValue})`
82
+ : `rgb(var(${variableName}))`;
83
+ };
84
+ }
85
+
86
+ /**
87
+ * Convert sting patterns to RegExp.
88
+ * @returns {Array} - TailwindCSS safelist.
89
+ */
90
+ function getSafelist() {
91
+ return JSON.parse(process.env.SAFELIST_JSON || "[]").map((rule) => ({
92
+ ...rule,
93
+ pattern: new RegExp(rule.pattern),
94
+ }));
95
+ }
@@ -1,4 +1,4 @@
1
- import { contributions } from "/web-types.json";
1
+ import { contributions } from "../web-types.json";
2
2
 
3
3
  const getComponentData = (componentName) => {
4
4
  return contributions.html.tags.find((item) => item.name === componentName);
@@ -2,7 +2,7 @@ import { merge } from "lodash-es";
2
2
  import { defineConfig } from "cva";
3
3
  import { twMerge } from "tailwind-merge";
4
4
  import colors from "tailwindcss/colors";
5
- import { brandColors, grayColors } from "../service.tailwind";
5
+ import { brandColors, grayColors } from "../preset.tailwind";
6
6
  import vuelessConfig from "../../../vueless.config.js";
7
7
 
8
8
  /*
@@ -46,7 +46,7 @@ import colors from "tailwindcss/colors";
46
46
 
47
47
  import UHeader from "../ui.text-header";
48
48
  import UIService from "../service.ui";
49
- import { grayColors } from "../service.tailwind";
49
+ import { grayColors } from "../preset.tailwind";
50
50
 
51
51
  import { UStepper } from "./constants/index";
52
52
  import defaultConfig from "./configs/default.config";
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.8",
4
+ "version": "0.0.14",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -1,103 +0,0 @@
1
- import colors from "tailwindcss/colors.js";
2
- import forms from "@tailwindcss/forms";
3
- import vuelessConfig from "../../vueless.config.js";
4
-
5
- export const grayColors = ["slate", "gray", "zinc", "neutral", "stone"];
6
- export const brandColors = [
7
- "brand",
8
- "red",
9
- "orange",
10
- "amber",
11
- "yellow",
12
- "lime",
13
- "green",
14
- "emerald",
15
- "teal",
16
- "cyan",
17
- "sky",
18
- "blue",
19
- "indigo",
20
- "violet",
21
- "purple",
22
- "fuchsia",
23
- "pink",
24
- "rose",
25
- ];
26
-
27
- export default class TailwindServiceDefault {
28
- constructor() {
29
- this.vuelessPreset = this.get();
30
- }
31
-
32
- /**
33
- * Transform CSS variable with RGB numbers into CSS color.
34
- * @returns {Function}
35
- */
36
- static twColorWithOpacity(variableName) {
37
- return ({ opacityValue }) => {
38
- return opacityValue !== undefined
39
- ? `rgba(var(${variableName}), ${opacityValue})`
40
- : `rgb(var(${variableName}))`;
41
- };
42
- }
43
-
44
- /**
45
- * Convert sting patterns to RegExp.
46
- * @returns {Array} - TailwindCSS safelist.
47
- */
48
- static getSafelist() {
49
- return JSON.parse(process.env.SAFELIST_JSON || "[]").map((rule) => ({
50
- ...rule,
51
- pattern: new RegExp(rule.pattern),
52
- }));
53
- }
54
-
55
- /**
56
- * Generates preset for TailwindCSS base on Vueless config.
57
- * @returns {Object}
58
- */
59
- get() {
60
- const isProd = process.env.NODE_ENV === "production";
61
- const brandColor = TailwindServiceDefault.twColorWithOpacity("--color-brand");
62
- const { brand, gray } = vuelessConfig;
63
-
64
- let brandPalette = brandColors.includes(brand) ? colors[brand] : colors.green;
65
- let grayPalette = grayColors.includes(gray) ? colors[gray] : colors.zinc;
66
-
67
- if (brand === "grayscale") {
68
- brandPalette = grayPalette;
69
- }
70
-
71
- const prodSafelist = TailwindServiceDefault.getSafelist();
72
- const devSafelist = [
73
- {
74
- pattern: /(border|bg|text|ring)-(.*)-((50|[1-9]00|950)?)$/,
75
- variants: ["hover", "focus", "focus-within", "active"],
76
- },
77
- ];
78
-
79
- return {
80
- content: [
81
- "./index.html",
82
- "./src/**/*.{js,ts,jsx,tsx,vue}",
83
- "./vueless.config.{js,ts}",
84
- "./node_modules/vueless/**/*.{js,ts,vue}",
85
- ],
86
- safelist: isProd ? prodSafelist : devSafelist,
87
- theme: {
88
- extend: {
89
- colors: {
90
- brand: { ...brandPalette, DEFAULT: brandColor },
91
- gray: grayPalette,
92
- },
93
- fontSize: {
94
- "2xs": ["0.625rem", "0.875rem"], // 10px
95
- },
96
- },
97
- },
98
- plugins: [forms],
99
- };
100
- }
101
- }
102
-
103
- export const { vuelessPreset } = new TailwindServiceDefault();