vueless 0.0.666 → 0.0.668
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/commands/index.js +5 -0
- package/bin/commands/init.js +39 -0
- package/bin/constants.js +48 -0
- package/bin/index.js +24 -0
- package/package.json +5 -2
- package/ui.text-money/UMoney.vue +5 -3
- package/ui.text-money/config.ts +1 -1
- package/ui.text-money/storybook/stories.ts +2 -2
- package/ui.text-money/types.ts +1 -1
- package/ui.text-money/utilMoney.ts +7 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
|
|
3
|
+
import { cwd } from "node:process";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { writeFile } from "node:fs/promises";
|
|
6
|
+
import { styleText } from "node:util";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
DEFAULT_VUELESS_CONFIG_NAME,
|
|
10
|
+
DEFAULT_VUELESS_CONFIG_CONTNET,
|
|
11
|
+
TYPESCRIPT_EXT,
|
|
12
|
+
JAVASCRIPT_EXT,
|
|
13
|
+
} from "../constants.js";
|
|
14
|
+
|
|
15
|
+
const destPath = path.join(cwd(), DEFAULT_VUELESS_CONFIG_NAME);
|
|
16
|
+
|
|
17
|
+
const vuelessInitOptions = ["--ts", "--js"];
|
|
18
|
+
|
|
19
|
+
export async function vuelssInit(options) {
|
|
20
|
+
const isValidOptions = options.every((option) => vuelessInitOptions.includes(option));
|
|
21
|
+
|
|
22
|
+
if (options.length && !isValidOptions) {
|
|
23
|
+
throw new Error("Ivalid options were provided");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const fileExt = options.includes("--ts") ? TYPESCRIPT_EXT : JAVASCRIPT_EXT;
|
|
27
|
+
const formattedDestPath = path.format({ ...path.parse(destPath), base: "", ext: fileExt });
|
|
28
|
+
|
|
29
|
+
console.log(formattedDestPath);
|
|
30
|
+
|
|
31
|
+
await writeFile(formattedDestPath, DEFAULT_VUELESS_CONFIG_CONTNET, "utf-8");
|
|
32
|
+
|
|
33
|
+
const successMessage = styleText(
|
|
34
|
+
"green",
|
|
35
|
+
`Success: ${formattedDestPath.split(path.sep).at(-1)} was created in ${cwd()} directory`,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
console.log(successMessage);
|
|
39
|
+
}
|
package/bin/constants.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export const DEFAULT_VUELESS_CONFIG_NAME = "vueless.config.js";
|
|
2
|
+
export const DEFAULT_EXIT_CODE = 0;
|
|
3
|
+
export const FAILURE_CODE = 1;
|
|
4
|
+
export const TYPESCRIPT_EXT = ".ts";
|
|
5
|
+
export const JAVASCRIPT_EXT = ".js";
|
|
6
|
+
export const DEFAULT_VUELESS_CONFIG_CONTNET = `
|
|
7
|
+
export default {
|
|
8
|
+
/**
|
|
9
|
+
* Global settings.
|
|
10
|
+
*/
|
|
11
|
+
strategy: "merge",
|
|
12
|
+
brand: "grayscale",
|
|
13
|
+
gray: "cool",
|
|
14
|
+
darkMode: "auto",
|
|
15
|
+
ring: 4,
|
|
16
|
+
ringOffset: 0,
|
|
17
|
+
ringOffsetColorLight: "#ffffff", // white
|
|
18
|
+
ringOffsetColorDark: "#111827", // gray-900
|
|
19
|
+
rounding: 8,
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Directive settings.
|
|
23
|
+
*/
|
|
24
|
+
directive: {},
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Component settings.
|
|
28
|
+
*/
|
|
29
|
+
component: /*tw*/ {},
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Tailwind CSS theme config.
|
|
33
|
+
* https://tailwindcss.com/docs/theme
|
|
34
|
+
*/
|
|
35
|
+
tailwindTheme: {
|
|
36
|
+
extend: {
|
|
37
|
+
colors: {},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Custom classes TailwindMerge settings.
|
|
43
|
+
* All lists of rules available here:
|
|
44
|
+
* https://github.com/dcastil/tailwind-merge/blob/v2.3.0/src/lib/default-config.ts
|
|
45
|
+
*/
|
|
46
|
+
tailwindMerge: {},
|
|
47
|
+
};
|
|
48
|
+
`;
|
package/bin/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/* eslint-disable no-console */
|
|
4
|
+
|
|
5
|
+
import { commands } from "./commands/index.js";
|
|
6
|
+
|
|
7
|
+
import { DEFAULT_EXIT_CODE, FAILURE_CODE } from "./constants.js";
|
|
8
|
+
|
|
9
|
+
const [command, ...options] = process.argv.slice(2);
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
if (!command || command === "undefiend") {
|
|
13
|
+
process.exit(DEFAULT_EXIT_CODE);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (command in commands) {
|
|
17
|
+
commands[command](options);
|
|
18
|
+
} else {
|
|
19
|
+
throw new Error(`There is no such command: ${command}`);
|
|
20
|
+
}
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.error(error.message);
|
|
23
|
+
process.exit(error.code || FAILURE_CODE);
|
|
24
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vueless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.668",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
|
|
6
6
|
"keywords": [
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"build": "npm run pre:start && storybook build --docs",
|
|
34
34
|
"preview": "vite preview --host --outDir=storybook-static",
|
|
35
35
|
"ts:check": "vue-tsc --build --force",
|
|
36
|
-
"release:prepare": "npm run pre:start && rm -rf dist && mkdir -p dist && cp -r src/. package.json LICENSE README.md dist/",
|
|
36
|
+
"release:prepare": "npm run pre:start && rm -rf dist && mkdir -p dist && cp -r src/. package.json LICENSE README.md dist/ && cp -r bin dist/bin",
|
|
37
37
|
"release:beta": "release-it --ci --npm.publish --preRelease=beta --increment=prerelease",
|
|
38
38
|
"release:patch": "release-it patch --ci --npm.publish",
|
|
39
39
|
"release:minor": "release-it minor --ci --npm.publish --git.tag --github.release",
|
|
@@ -42,6 +42,9 @@
|
|
|
42
42
|
"lint:fix": "eslint --fix src/ .storybook/",
|
|
43
43
|
"lint:ci": "eslint --no-fix --max-warnings=0"
|
|
44
44
|
},
|
|
45
|
+
"bin": {
|
|
46
|
+
"vueless": "./bin/index.js"
|
|
47
|
+
},
|
|
45
48
|
"dependencies": {
|
|
46
49
|
"@tailwindcss/forms": "^0.5.9",
|
|
47
50
|
"cva": "^1.0.0-beta.1",
|
package/ui.text-money/UMoney.vue
CHANGED
|
@@ -7,7 +7,7 @@ import { hasSlotContent } from "../utils/helper.ts";
|
|
|
7
7
|
|
|
8
8
|
import { COMPONENT_NAME } from "./constants.ts";
|
|
9
9
|
import defaultConfig from "./config.ts";
|
|
10
|
-
import { separatedMoney, MONEY_SIGN_TYPE } from "./utilMoney.ts";
|
|
10
|
+
import { separatedMoney, MONEY_SIGN_TYPE, MATH_SIGN } from "./utilMoney.ts";
|
|
11
11
|
|
|
12
12
|
import type { Props, Config } from "./types.ts";
|
|
13
13
|
|
|
@@ -31,8 +31,10 @@ const currencySpace = computed(() => {
|
|
|
31
31
|
const mathSign = computed(() => {
|
|
32
32
|
let type = "";
|
|
33
33
|
|
|
34
|
-
if (props.sign === MONEY_SIGN_TYPE.
|
|
35
|
-
if (props.sign === MONEY_SIGN_TYPE.
|
|
34
|
+
if (props.sign === MONEY_SIGN_TYPE.unsigned) type = "";
|
|
35
|
+
if (props.sign === MONEY_SIGN_TYPE.positive) type = MATH_SIGN.PLUS;
|
|
36
|
+
if (props.sign === MONEY_SIGN_TYPE.negative) type = MATH_SIGN.MINUS;
|
|
37
|
+
if (props.sign === MONEY_SIGN_TYPE.auto && props.value < 0) type = MATH_SIGN.MINUS;
|
|
36
38
|
|
|
37
39
|
return type;
|
|
38
40
|
});
|
package/ui.text-money/config.ts
CHANGED
|
@@ -28,7 +28,7 @@ export default {
|
|
|
28
28
|
args: {
|
|
29
29
|
value: 10,
|
|
30
30
|
symbol: "$",
|
|
31
|
-
sign: "
|
|
31
|
+
sign: "auto",
|
|
32
32
|
},
|
|
33
33
|
argTypes: {
|
|
34
34
|
...getArgTypes(UMoney.__name),
|
|
@@ -95,7 +95,7 @@ Colors.args = {
|
|
|
95
95
|
enum: "color",
|
|
96
96
|
value: 0,
|
|
97
97
|
symbol: "$",
|
|
98
|
-
sign: "
|
|
98
|
+
sign: "auto",
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
export const Sizes = EnumVariantTemplate.bind({});
|
package/ui.text-money/types.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
export const MONEY_SIGN_TYPE = {
|
|
2
|
-
|
|
2
|
+
auto: "auto",
|
|
3
3
|
positive: "positive",
|
|
4
4
|
negative: "negative",
|
|
5
|
+
unsigned: "unsigned",
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const MATH_SIGN = {
|
|
9
|
+
PLUS: "+",
|
|
10
|
+
MINUS: "-",
|
|
5
11
|
};
|
|
6
12
|
|
|
7
13
|
export const ADD_SPACE_IN_MONEY_REG_EX = /(\d)(?=(\d{3})+(\D|$))/g;
|