@maple-design/preset-tailwindcss-vue 0.0.0-stage → 1.1.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/lib/index.cjs +145 -0
- package/lib/index.d.cts +52 -0
- package/lib/index.d.ts +52 -0
- package/lib/index.js +123 -0
- package/package.json +49 -3
- package/README.md +0 -3
package/lib/index.cjs
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
var __export = (target, all) => {
|
|
33
|
+
for (var name in all)
|
|
34
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
35
|
+
};
|
|
36
|
+
var __copyProps = (to, from, except, desc) => {
|
|
37
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
38
|
+
for (let key of __getOwnPropNames(from))
|
|
39
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
40
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
41
|
+
}
|
|
42
|
+
return to;
|
|
43
|
+
};
|
|
44
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
45
|
+
|
|
46
|
+
// src/index.ts
|
|
47
|
+
var src_exports = {};
|
|
48
|
+
__export(src_exports, {
|
|
49
|
+
presetMaple: () => presetMaple
|
|
50
|
+
});
|
|
51
|
+
module.exports = __toCommonJS(src_exports);
|
|
52
|
+
function getSpacing() {
|
|
53
|
+
return Object.fromEntries(Array.from({ length: 201 }, (_, value) => [String(value), `${value}px`]));
|
|
54
|
+
}
|
|
55
|
+
function getScreens(options = {}) {
|
|
56
|
+
const { screens = true } = options;
|
|
57
|
+
if (!screens) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const defaultScreens = {
|
|
61
|
+
sm: "768px",
|
|
62
|
+
md: "992px",
|
|
63
|
+
lg: "1200px",
|
|
64
|
+
xl: "1920px"
|
|
65
|
+
};
|
|
66
|
+
if (screens === true) {
|
|
67
|
+
return defaultScreens;
|
|
68
|
+
}
|
|
69
|
+
return __spreadValues(__spreadValues({}, defaultScreens), screens);
|
|
70
|
+
}
|
|
71
|
+
function getFontSize(options = {}) {
|
|
72
|
+
const { fontSize = true } = options;
|
|
73
|
+
if (!fontSize) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const defaultFontSize = {
|
|
77
|
+
xs: "var(--mp-font-size-xs)",
|
|
78
|
+
sm: "var(--mp-font-size-sm)",
|
|
79
|
+
md: "var(--mp-font-size-md)",
|
|
80
|
+
lg: "var(--mp-font-size-lg)"
|
|
81
|
+
};
|
|
82
|
+
if (fontSize === true) {
|
|
83
|
+
return defaultFontSize;
|
|
84
|
+
}
|
|
85
|
+
return __spreadValues(__spreadValues({}, defaultFontSize), fontSize);
|
|
86
|
+
}
|
|
87
|
+
function getColors(options = {}) {
|
|
88
|
+
const { colors = true } = options;
|
|
89
|
+
if (!colors) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const defaultColors = {
|
|
93
|
+
primary: "var(--mp-color-primary)",
|
|
94
|
+
info: "var(--mp-color-info)",
|
|
95
|
+
warning: "var(--mp-color-warning)",
|
|
96
|
+
danger: "var(--mp-color-danger)",
|
|
97
|
+
success: "var(--mp-color-success)"
|
|
98
|
+
};
|
|
99
|
+
if (colors === true) {
|
|
100
|
+
return defaultColors;
|
|
101
|
+
}
|
|
102
|
+
const _a = colors, { body: _body, disabled: _disabled } = _a, customColors = __objRest(_a, ["body", "disabled"]);
|
|
103
|
+
return __spreadValues(__spreadValues({}, defaultColors), customColors);
|
|
104
|
+
}
|
|
105
|
+
function getDisabled(options = {}) {
|
|
106
|
+
var _a;
|
|
107
|
+
const { colors = true } = options;
|
|
108
|
+
if (!colors) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
return colors === true ? "var(--mp-color-disabled)" : (_a = colors.disabled) != null ? _a : "var(--mp-color-disabled)";
|
|
112
|
+
}
|
|
113
|
+
function getBody(options = {}) {
|
|
114
|
+
var _a;
|
|
115
|
+
const { colors = true } = options;
|
|
116
|
+
if (!colors) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
return colors === true ? "var(--mp-color-body)" : (_a = colors.body) != null ? _a : "var(--mp-color-body)";
|
|
120
|
+
}
|
|
121
|
+
function presetMaple(options = {}) {
|
|
122
|
+
const body = getBody(options);
|
|
123
|
+
const disabled = getDisabled(options);
|
|
124
|
+
return {
|
|
125
|
+
prefix: "mp-",
|
|
126
|
+
corePlugins: {
|
|
127
|
+
boxShadow: false,
|
|
128
|
+
boxShadowColor: false
|
|
129
|
+
},
|
|
130
|
+
theme: {
|
|
131
|
+
extend: {
|
|
132
|
+
colors: getColors(options),
|
|
133
|
+
backgroundColor: body || disabled ? { body, disabled } : void 0,
|
|
134
|
+
textColor: disabled ? { disabled } : void 0,
|
|
135
|
+
screens: getScreens(options),
|
|
136
|
+
fontSize: getFontSize(options),
|
|
137
|
+
spacing: getSpacing()
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
143
|
+
0 && (module.exports = {
|
|
144
|
+
presetMaple
|
|
145
|
+
});
|
package/lib/index.d.cts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
interface PresetMapleOptions {
|
|
2
|
+
screens?: boolean | PresetMapleScreens;
|
|
3
|
+
fontSize?: boolean | PresetMapleFontSize;
|
|
4
|
+
colors?: boolean | PresetMapleColors;
|
|
5
|
+
}
|
|
6
|
+
interface PresetMapleScreens {
|
|
7
|
+
sm?: string | number;
|
|
8
|
+
md?: string | number;
|
|
9
|
+
lg?: string | number;
|
|
10
|
+
xl?: string | number;
|
|
11
|
+
}
|
|
12
|
+
interface PresetMapleFontSize {
|
|
13
|
+
xs?: string;
|
|
14
|
+
sm?: string;
|
|
15
|
+
md?: string;
|
|
16
|
+
lg?: string;
|
|
17
|
+
}
|
|
18
|
+
interface PresetMapleColors {
|
|
19
|
+
body?: string;
|
|
20
|
+
primary?: string;
|
|
21
|
+
info?: string;
|
|
22
|
+
warning?: string;
|
|
23
|
+
danger?: string;
|
|
24
|
+
success?: string;
|
|
25
|
+
disabled?: string;
|
|
26
|
+
}
|
|
27
|
+
declare function presetMaple(options?: PresetMapleOptions): {
|
|
28
|
+
prefix: string;
|
|
29
|
+
corePlugins: {
|
|
30
|
+
boxShadow: boolean;
|
|
31
|
+
boxShadowColor: boolean;
|
|
32
|
+
};
|
|
33
|
+
theme: {
|
|
34
|
+
extend: {
|
|
35
|
+
colors: Omit<PresetMapleColors, "body" | "disabled"> | undefined;
|
|
36
|
+
backgroundColor: {
|
|
37
|
+
body: string | undefined;
|
|
38
|
+
disabled: string | undefined;
|
|
39
|
+
} | undefined;
|
|
40
|
+
textColor: {
|
|
41
|
+
disabled: string;
|
|
42
|
+
} | undefined;
|
|
43
|
+
screens: PresetMapleScreens | undefined;
|
|
44
|
+
fontSize: PresetMapleFontSize | undefined;
|
|
45
|
+
spacing: {
|
|
46
|
+
[k: string]: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export { PresetMapleColors, PresetMapleFontSize, PresetMapleOptions, PresetMapleScreens, presetMaple };
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
interface PresetMapleOptions {
|
|
2
|
+
screens?: boolean | PresetMapleScreens;
|
|
3
|
+
fontSize?: boolean | PresetMapleFontSize;
|
|
4
|
+
colors?: boolean | PresetMapleColors;
|
|
5
|
+
}
|
|
6
|
+
interface PresetMapleScreens {
|
|
7
|
+
sm?: string | number;
|
|
8
|
+
md?: string | number;
|
|
9
|
+
lg?: string | number;
|
|
10
|
+
xl?: string | number;
|
|
11
|
+
}
|
|
12
|
+
interface PresetMapleFontSize {
|
|
13
|
+
xs?: string;
|
|
14
|
+
sm?: string;
|
|
15
|
+
md?: string;
|
|
16
|
+
lg?: string;
|
|
17
|
+
}
|
|
18
|
+
interface PresetMapleColors {
|
|
19
|
+
body?: string;
|
|
20
|
+
primary?: string;
|
|
21
|
+
info?: string;
|
|
22
|
+
warning?: string;
|
|
23
|
+
danger?: string;
|
|
24
|
+
success?: string;
|
|
25
|
+
disabled?: string;
|
|
26
|
+
}
|
|
27
|
+
declare function presetMaple(options?: PresetMapleOptions): {
|
|
28
|
+
prefix: string;
|
|
29
|
+
corePlugins: {
|
|
30
|
+
boxShadow: boolean;
|
|
31
|
+
boxShadowColor: boolean;
|
|
32
|
+
};
|
|
33
|
+
theme: {
|
|
34
|
+
extend: {
|
|
35
|
+
colors: Omit<PresetMapleColors, "body" | "disabled"> | undefined;
|
|
36
|
+
backgroundColor: {
|
|
37
|
+
body: string | undefined;
|
|
38
|
+
disabled: string | undefined;
|
|
39
|
+
} | undefined;
|
|
40
|
+
textColor: {
|
|
41
|
+
disabled: string;
|
|
42
|
+
} | undefined;
|
|
43
|
+
screens: PresetMapleScreens | undefined;
|
|
44
|
+
fontSize: PresetMapleFontSize | undefined;
|
|
45
|
+
spacing: {
|
|
46
|
+
[k: string]: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export { PresetMapleColors, PresetMapleFontSize, PresetMapleOptions, PresetMapleScreens, presetMaple };
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
var __objRest = (source, exclude) => {
|
|
18
|
+
var target = {};
|
|
19
|
+
for (var prop in source)
|
|
20
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
21
|
+
target[prop] = source[prop];
|
|
22
|
+
if (source != null && __getOwnPropSymbols)
|
|
23
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
24
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
function getSpacing() {
|
|
32
|
+
return Object.fromEntries(Array.from({ length: 201 }, (_, value) => [String(value), `${value}px`]));
|
|
33
|
+
}
|
|
34
|
+
function getScreens(options = {}) {
|
|
35
|
+
const { screens = true } = options;
|
|
36
|
+
if (!screens) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const defaultScreens = {
|
|
40
|
+
sm: "768px",
|
|
41
|
+
md: "992px",
|
|
42
|
+
lg: "1200px",
|
|
43
|
+
xl: "1920px"
|
|
44
|
+
};
|
|
45
|
+
if (screens === true) {
|
|
46
|
+
return defaultScreens;
|
|
47
|
+
}
|
|
48
|
+
return __spreadValues(__spreadValues({}, defaultScreens), screens);
|
|
49
|
+
}
|
|
50
|
+
function getFontSize(options = {}) {
|
|
51
|
+
const { fontSize = true } = options;
|
|
52
|
+
if (!fontSize) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const defaultFontSize = {
|
|
56
|
+
xs: "var(--mp-font-size-xs)",
|
|
57
|
+
sm: "var(--mp-font-size-sm)",
|
|
58
|
+
md: "var(--mp-font-size-md)",
|
|
59
|
+
lg: "var(--mp-font-size-lg)"
|
|
60
|
+
};
|
|
61
|
+
if (fontSize === true) {
|
|
62
|
+
return defaultFontSize;
|
|
63
|
+
}
|
|
64
|
+
return __spreadValues(__spreadValues({}, defaultFontSize), fontSize);
|
|
65
|
+
}
|
|
66
|
+
function getColors(options = {}) {
|
|
67
|
+
const { colors = true } = options;
|
|
68
|
+
if (!colors) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const defaultColors = {
|
|
72
|
+
primary: "var(--mp-color-primary)",
|
|
73
|
+
info: "var(--mp-color-info)",
|
|
74
|
+
warning: "var(--mp-color-warning)",
|
|
75
|
+
danger: "var(--mp-color-danger)",
|
|
76
|
+
success: "var(--mp-color-success)"
|
|
77
|
+
};
|
|
78
|
+
if (colors === true) {
|
|
79
|
+
return defaultColors;
|
|
80
|
+
}
|
|
81
|
+
const _a = colors, { body: _body, disabled: _disabled } = _a, customColors = __objRest(_a, ["body", "disabled"]);
|
|
82
|
+
return __spreadValues(__spreadValues({}, defaultColors), customColors);
|
|
83
|
+
}
|
|
84
|
+
function getDisabled(options = {}) {
|
|
85
|
+
var _a;
|
|
86
|
+
const { colors = true } = options;
|
|
87
|
+
if (!colors) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
return colors === true ? "var(--mp-color-disabled)" : (_a = colors.disabled) != null ? _a : "var(--mp-color-disabled)";
|
|
91
|
+
}
|
|
92
|
+
function getBody(options = {}) {
|
|
93
|
+
var _a;
|
|
94
|
+
const { colors = true } = options;
|
|
95
|
+
if (!colors) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
return colors === true ? "var(--mp-color-body)" : (_a = colors.body) != null ? _a : "var(--mp-color-body)";
|
|
99
|
+
}
|
|
100
|
+
function presetMaple(options = {}) {
|
|
101
|
+
const body = getBody(options);
|
|
102
|
+
const disabled = getDisabled(options);
|
|
103
|
+
return {
|
|
104
|
+
prefix: "mp-",
|
|
105
|
+
corePlugins: {
|
|
106
|
+
boxShadow: false,
|
|
107
|
+
boxShadowColor: false
|
|
108
|
+
},
|
|
109
|
+
theme: {
|
|
110
|
+
extend: {
|
|
111
|
+
colors: getColors(options),
|
|
112
|
+
backgroundColor: body || disabled ? { body, disabled } : void 0,
|
|
113
|
+
textColor: disabled ? { disabled } : void 0,
|
|
114
|
+
screens: getScreens(options),
|
|
115
|
+
fontSize: getFontSize(options),
|
|
116
|
+
spacing: getSpacing()
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
presetMaple
|
|
123
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maple-design/preset-tailwindcss-vue",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "tailwindcss preset of maple",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"tailwindcss",
|
|
7
|
+
"preset",
|
|
8
|
+
"maple"
|
|
9
|
+
],
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/loca-spirit/maple-design-mobile/issues"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/loca-spirit/maple-design-mobile.git",
|
|
16
|
+
"directory": "packages/preset-tailwindcss"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": "chouchouji <1305974212@qq.com>",
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"type": "module",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"import": "./lib/index.js",
|
|
25
|
+
"require": "./lib/index.cjs",
|
|
26
|
+
"types": "./lib/index.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"./*": "./*"
|
|
29
|
+
},
|
|
30
|
+
"main": "lib/index.cjs",
|
|
31
|
+
"module": "lib/index.js",
|
|
32
|
+
"types": "lib/index.d.ts",
|
|
33
|
+
"files": [
|
|
34
|
+
"lib"
|
|
35
|
+
],
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^18.7.20",
|
|
38
|
+
"tsup": "7.2.0",
|
|
39
|
+
"typescript": "5.3.3"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"tailwindcss": "^3.4.1"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public",
|
|
46
|
+
"registry": "https://registry.npmjs.org/"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsup src/index.ts --format esm,cjs --out-dir=lib --dts --clean",
|
|
50
|
+
"dev": "tsup src/index.ts --format esm --out-dir=lib --watch --dts"
|
|
51
|
+
}
|
|
6
52
|
}
|
package/README.md
DELETED