@maple-design/preset-unocss-vue 1.4.8 → 1.5.1

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 CHANGED
@@ -1,140 +1,83 @@
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
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let unocss = require("unocss");
46
3
  // src/index.ts
47
- var src_exports = {};
48
- __export(src_exports, {
49
- presetMaple: () => presetMaple
50
- });
51
- module.exports = __toCommonJS(src_exports);
52
- var import_unocss = require("unocss");
53
4
  function getSpacing() {
54
- return Object.fromEntries(Array.from({ length: 201 }, (_, value) => [String(value), `${value}px`]));
5
+ return Object.fromEntries(Array.from({ length: 201 }, (_, value) => [String(value), `${value}px`]));
55
6
  }
56
7
  function getBreakpoints(options = {}) {
57
- const { breakpoints = true } = options;
58
- if (!breakpoints) {
59
- return;
60
- }
61
- const defaults = { sm: "768px", md: "992px", lg: "1200px", xl: "1920px" };
62
- return breakpoints === true ? defaults : __spreadValues(__spreadValues({}, defaults), breakpoints);
8
+ const { breakpoints = true } = options;
9
+ if (!breakpoints) return;
10
+ const defaults = {
11
+ sm: "768px",
12
+ md: "992px",
13
+ lg: "1200px",
14
+ xl: "1920px"
15
+ };
16
+ return breakpoints === true ? defaults : {
17
+ ...defaults,
18
+ ...breakpoints
19
+ };
63
20
  }
64
21
  function getFontSize(options = {}) {
65
- const { fontSize = true } = options;
66
- if (!fontSize) {
67
- return;
68
- }
69
- const defaults = {
70
- xs: "var(--mp-font-size-xs)",
71
- sm: "var(--mp-font-size-sm)",
72
- md: "var(--mp-font-size-md)",
73
- lg: "var(--mp-font-size-lg)"
74
- };
75
- return fontSize === true ? defaults : __spreadValues(__spreadValues({}, defaults), fontSize);
22
+ const { fontSize = true } = options;
23
+ if (!fontSize) return;
24
+ const defaults = {
25
+ xs: "var(--mp-font-size-xs)",
26
+ sm: "var(--mp-font-size-sm)",
27
+ md: "var(--mp-font-size-md)",
28
+ lg: "var(--mp-font-size-lg)"
29
+ };
30
+ return fontSize === true ? defaults : {
31
+ ...defaults,
32
+ ...fontSize
33
+ };
76
34
  }
77
35
  function getColors(options = {}) {
78
- const { colors = true } = options;
79
- if (!colors) {
80
- return;
81
- }
82
- const defaults = {
83
- primary: "var(--mp-color-primary)",
84
- info: "var(--mp-color-info)",
85
- warning: "var(--mp-color-warning)",
86
- danger: "var(--mp-color-danger)",
87
- success: "var(--mp-color-success)"
88
- };
89
- if (colors === true) {
90
- return defaults;
91
- }
92
- const _a = colors, { body: _body, disabled: _disabled } = _a, customColors = __objRest(_a, ["body", "disabled"]);
93
- return __spreadValues(__spreadValues({}, defaults), customColors);
36
+ const { colors = true } = options;
37
+ if (!colors) return;
38
+ const defaults = {
39
+ primary: "var(--mp-color-primary)",
40
+ info: "var(--mp-color-info)",
41
+ warning: "var(--mp-color-warning)",
42
+ danger: "var(--mp-color-danger)",
43
+ success: "var(--mp-color-success)"
44
+ };
45
+ if (colors === true) return defaults;
46
+ const { body: _body, disabled: _disabled, ...customColors } = colors;
47
+ return {
48
+ ...defaults,
49
+ ...customColors
50
+ };
94
51
  }
95
52
  function getDisabled(options = {}) {
96
- var _a;
97
- const { colors = true } = options;
98
- if (!colors) {
99
- return;
100
- }
101
- return colors === true ? "var(--mp-color-disabled)" : (_a = colors.disabled) != null ? _a : "var(--mp-color-disabled)";
53
+ const { colors = true } = options;
54
+ if (!colors) return;
55
+ return colors === true ? "var(--mp-color-disabled)" : colors.disabled ?? "var(--mp-color-disabled)";
102
56
  }
103
57
  function getBody(options = {}) {
104
- var _a;
105
- const { colors = true } = options;
106
- if (!colors) {
107
- return;
108
- }
109
- return colors === true ? "var(--mp-color-body)" : (_a = colors.body) != null ? _a : "var(--mp-color-body)";
58
+ const { colors = true } = options;
59
+ if (!colors) return;
60
+ return colors === true ? "var(--mp-color-body)" : colors.body ?? "var(--mp-color-body)";
110
61
  }
111
62
  function presetMaple(options = {}) {
112
- const body = getBody(options);
113
- const disabled = getDisabled(options);
114
- const rules = [];
115
- if (body) {
116
- rules.push(["mp-bg-body", { "background-color": body }]);
117
- }
118
- if (disabled) {
119
- rules.push(["mp-bg-disabled", { "background-color": disabled }]);
120
- rules.push(["mp-text-disabled", { color: disabled }]);
121
- }
122
- return [
123
- (0, import_unocss.presetUno)({ prefix: "mp-" }),
124
- {
125
- name: "@maple-design/preset-unocss-vue",
126
- blocklist: [/^(?:[\w-]+:)*mp-shadow(?:-.+)?$/],
127
- theme: {
128
- colors: getColors(options),
129
- fontSize: getFontSize(options),
130
- breakpoints: getBreakpoints(options),
131
- spacing: getSpacing()
132
- },
133
- rules
134
- }
135
- ];
63
+ const body = getBody(options);
64
+ const disabled = getDisabled(options);
65
+ const rules = [];
66
+ if (body) rules.push(["mp-bg-body", { "background-color": body }]);
67
+ if (disabled) {
68
+ rules.push(["mp-bg-disabled", { "background-color": disabled }]);
69
+ rules.push(["mp-text-disabled", { color: disabled }]);
70
+ }
71
+ return [(0, unocss.presetUno)({ prefix: "mp-" }), {
72
+ name: "@maple-design/preset-unocss-vue",
73
+ blocklist: [/^(?:[\w-]+:)*mp-shadow(?:-.+)?$/],
74
+ theme: {
75
+ colors: getColors(options),
76
+ fontSize: getFontSize(options),
77
+ breakpoints: getBreakpoints(options),
78
+ spacing: getSpacing()
79
+ },
80
+ rules
81
+ }];
136
82
  }
137
- // Annotate the CommonJS export names for ESM import in node:
138
- 0 && (module.exports = {
139
- presetMaple
140
- });
83
+ exports.presetMaple = presetMaple;
package/lib/index.d.cts CHANGED
@@ -1,30 +1,27 @@
1
- import { Preset } from 'unocss';
2
-
3
- interface PresetMapleOptions {
4
- breakpoints?: boolean | {
5
- sm?: string | number;
6
- md?: string | number;
7
- lg?: string | number;
8
- xl?: string | number;
9
- };
10
- fontSize?: boolean | PresetMapleFontSize;
11
- colors?: boolean | PresetMapleColors;
1
+ import { Preset } from "unocss";
2
+ export interface PresetMapleOptions {
3
+ breakpoints?: boolean | {
4
+ sm?: string | number;
5
+ md?: string | number;
6
+ lg?: string | number;
7
+ xl?: string | number;
8
+ };
9
+ fontSize?: boolean | PresetMapleFontSize;
10
+ colors?: boolean | PresetMapleColors;
12
11
  }
13
- interface PresetMapleFontSize {
14
- xs?: string;
15
- sm?: string;
16
- md?: string;
17
- lg?: string;
12
+ export interface PresetMapleFontSize {
13
+ xs?: string;
14
+ sm?: string;
15
+ md?: string;
16
+ lg?: string;
18
17
  }
19
- interface PresetMapleColors {
20
- body?: string;
21
- primary?: string;
22
- info?: string;
23
- warning?: string;
24
- danger?: string;
25
- success?: string;
26
- disabled?: string;
18
+ export interface PresetMapleColors {
19
+ body?: string;
20
+ primary?: string;
21
+ info?: string;
22
+ warning?: string;
23
+ danger?: string;
24
+ success?: string;
25
+ disabled?: string;
27
26
  }
28
- declare function presetMaple(options?: PresetMapleOptions): Preset[];
29
-
30
- export { PresetMapleColors, PresetMapleFontSize, PresetMapleOptions, presetMaple };
27
+ export declare function presetMaple(options?: PresetMapleOptions): Preset[];
package/lib/index.d.ts CHANGED
@@ -1,30 +1,27 @@
1
- import { Preset } from 'unocss';
2
-
3
- interface PresetMapleOptions {
4
- breakpoints?: boolean | {
5
- sm?: string | number;
6
- md?: string | number;
7
- lg?: string | number;
8
- xl?: string | number;
9
- };
10
- fontSize?: boolean | PresetMapleFontSize;
11
- colors?: boolean | PresetMapleColors;
1
+ import { Preset } from "unocss";
2
+ export interface PresetMapleOptions {
3
+ breakpoints?: boolean | {
4
+ sm?: string | number;
5
+ md?: string | number;
6
+ lg?: string | number;
7
+ xl?: string | number;
8
+ };
9
+ fontSize?: boolean | PresetMapleFontSize;
10
+ colors?: boolean | PresetMapleColors;
12
11
  }
13
- interface PresetMapleFontSize {
14
- xs?: string;
15
- sm?: string;
16
- md?: string;
17
- lg?: string;
12
+ export interface PresetMapleFontSize {
13
+ xs?: string;
14
+ sm?: string;
15
+ md?: string;
16
+ lg?: string;
18
17
  }
19
- interface PresetMapleColors {
20
- body?: string;
21
- primary?: string;
22
- info?: string;
23
- warning?: string;
24
- danger?: string;
25
- success?: string;
26
- disabled?: string;
18
+ export interface PresetMapleColors {
19
+ body?: string;
20
+ primary?: string;
21
+ info?: string;
22
+ warning?: string;
23
+ danger?: string;
24
+ success?: string;
25
+ disabled?: string;
27
26
  }
28
- declare function presetMaple(options?: PresetMapleOptions): Preset[];
29
-
30
- export { PresetMapleColors, PresetMapleFontSize, PresetMapleOptions, presetMaple };
27
+ export declare function presetMaple(options?: PresetMapleOptions): Preset[];
package/lib/index.js CHANGED
@@ -1,118 +1,82 @@
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
1
  import { presetUno } from "unocss";
2
+ // src/index.ts
32
3
  function getSpacing() {
33
- return Object.fromEntries(Array.from({ length: 201 }, (_, value) => [String(value), `${value}px`]));
4
+ return Object.fromEntries(Array.from({ length: 201 }, (_, value) => [String(value), `${value}px`]));
34
5
  }
35
6
  function getBreakpoints(options = {}) {
36
- const { breakpoints = true } = options;
37
- if (!breakpoints) {
38
- return;
39
- }
40
- const defaults = { sm: "768px", md: "992px", lg: "1200px", xl: "1920px" };
41
- return breakpoints === true ? defaults : __spreadValues(__spreadValues({}, defaults), breakpoints);
7
+ const { breakpoints = true } = options;
8
+ if (!breakpoints) return;
9
+ const defaults = {
10
+ sm: "768px",
11
+ md: "992px",
12
+ lg: "1200px",
13
+ xl: "1920px"
14
+ };
15
+ return breakpoints === true ? defaults : {
16
+ ...defaults,
17
+ ...breakpoints
18
+ };
42
19
  }
43
20
  function getFontSize(options = {}) {
44
- const { fontSize = true } = options;
45
- if (!fontSize) {
46
- return;
47
- }
48
- const defaults = {
49
- xs: "var(--mp-font-size-xs)",
50
- sm: "var(--mp-font-size-sm)",
51
- md: "var(--mp-font-size-md)",
52
- lg: "var(--mp-font-size-lg)"
53
- };
54
- return fontSize === true ? defaults : __spreadValues(__spreadValues({}, defaults), fontSize);
21
+ const { fontSize = true } = options;
22
+ if (!fontSize) return;
23
+ const defaults = {
24
+ xs: "var(--mp-font-size-xs)",
25
+ sm: "var(--mp-font-size-sm)",
26
+ md: "var(--mp-font-size-md)",
27
+ lg: "var(--mp-font-size-lg)"
28
+ };
29
+ return fontSize === true ? defaults : {
30
+ ...defaults,
31
+ ...fontSize
32
+ };
55
33
  }
56
34
  function getColors(options = {}) {
57
- const { colors = true } = options;
58
- if (!colors) {
59
- return;
60
- }
61
- const defaults = {
62
- primary: "var(--mp-color-primary)",
63
- info: "var(--mp-color-info)",
64
- warning: "var(--mp-color-warning)",
65
- danger: "var(--mp-color-danger)",
66
- success: "var(--mp-color-success)"
67
- };
68
- if (colors === true) {
69
- return defaults;
70
- }
71
- const _a = colors, { body: _body, disabled: _disabled } = _a, customColors = __objRest(_a, ["body", "disabled"]);
72
- return __spreadValues(__spreadValues({}, defaults), customColors);
35
+ const { colors = true } = options;
36
+ if (!colors) return;
37
+ const defaults = {
38
+ primary: "var(--mp-color-primary)",
39
+ info: "var(--mp-color-info)",
40
+ warning: "var(--mp-color-warning)",
41
+ danger: "var(--mp-color-danger)",
42
+ success: "var(--mp-color-success)"
43
+ };
44
+ if (colors === true) return defaults;
45
+ const { body: _body, disabled: _disabled, ...customColors } = colors;
46
+ return {
47
+ ...defaults,
48
+ ...customColors
49
+ };
73
50
  }
74
51
  function getDisabled(options = {}) {
75
- var _a;
76
- const { colors = true } = options;
77
- if (!colors) {
78
- return;
79
- }
80
- return colors === true ? "var(--mp-color-disabled)" : (_a = colors.disabled) != null ? _a : "var(--mp-color-disabled)";
52
+ const { colors = true } = options;
53
+ if (!colors) return;
54
+ return colors === true ? "var(--mp-color-disabled)" : colors.disabled ?? "var(--mp-color-disabled)";
81
55
  }
82
56
  function getBody(options = {}) {
83
- var _a;
84
- const { colors = true } = options;
85
- if (!colors) {
86
- return;
87
- }
88
- return colors === true ? "var(--mp-color-body)" : (_a = colors.body) != null ? _a : "var(--mp-color-body)";
57
+ const { colors = true } = options;
58
+ if (!colors) return;
59
+ return colors === true ? "var(--mp-color-body)" : colors.body ?? "var(--mp-color-body)";
89
60
  }
90
61
  function presetMaple(options = {}) {
91
- const body = getBody(options);
92
- const disabled = getDisabled(options);
93
- const rules = [];
94
- if (body) {
95
- rules.push(["mp-bg-body", { "background-color": body }]);
96
- }
97
- if (disabled) {
98
- rules.push(["mp-bg-disabled", { "background-color": disabled }]);
99
- rules.push(["mp-text-disabled", { color: disabled }]);
100
- }
101
- return [
102
- presetUno({ prefix: "mp-" }),
103
- {
104
- name: "@maple-design/preset-unocss-vue",
105
- blocklist: [/^(?:[\w-]+:)*mp-shadow(?:-.+)?$/],
106
- theme: {
107
- colors: getColors(options),
108
- fontSize: getFontSize(options),
109
- breakpoints: getBreakpoints(options),
110
- spacing: getSpacing()
111
- },
112
- rules
113
- }
114
- ];
62
+ const body = getBody(options);
63
+ const disabled = getDisabled(options);
64
+ const rules = [];
65
+ if (body) rules.push(["mp-bg-body", { "background-color": body }]);
66
+ if (disabled) {
67
+ rules.push(["mp-bg-disabled", { "background-color": disabled }]);
68
+ rules.push(["mp-text-disabled", { color: disabled }]);
69
+ }
70
+ return [presetUno({ prefix: "mp-" }), {
71
+ name: "@maple-design/preset-unocss-vue",
72
+ blocklist: [/^(?:[\w-]+:)*mp-shadow(?:-.+)?$/],
73
+ theme: {
74
+ colors: getColors(options),
75
+ fontSize: getFontSize(options),
76
+ breakpoints: getBreakpoints(options),
77
+ spacing: getSpacing()
78
+ },
79
+ rules
80
+ }];
115
81
  }
116
- export {
117
- presetMaple
118
- };
82
+ export { presetMaple };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maple-design/preset-unocss-vue",
3
- "version": "1.4.8",
3
+ "version": "1.5.1",
4
4
  "description": "unocss preset of maple",
5
5
  "keywords": [
6
6
  "unocss",
@@ -34,19 +34,20 @@
34
34
  "lib"
35
35
  ],
36
36
  "devDependencies": {
37
- "@types/node": "^22.12.0",
38
- "tsup": "7.2.0",
39
- "typescript": "5.9.3"
37
+ "@types/node": "^26.6.11",
38
+ "tsdown": "0.23.7",
39
+ "typescript": "7.1.0-beta",
40
+ "unocss": "^66.13.0"
40
41
  },
41
42
  "peerDependencies": {
42
- "unocss": "^0.58.5"
43
+ "unocss": "^0.58.5 || ^66.13.0"
43
44
  },
44
45
  "publishConfig": {
45
46
  "access": "public",
46
47
  "registry": "https://registry.npmjs.org/"
47
48
  },
48
49
  "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"
50
+ "build": "tsdown --config ../../scripts/tsdown.config.mjs --format esm --format cjs",
51
+ "dev": "tsdown --config ../../scripts/tsdown.config.mjs --format esm --watch"
51
52
  }
52
53
  }