@unocss/preset-mini 0.16.0 → 0.16.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.
@@ -166,8 +166,13 @@ const placeholder = [
166
166
 
167
167
  const borders = [
168
168
  [/^border$/, handlerBorder],
169
- [/^(?:border|b)(?:-([^-]+))?$/, handlerBorder],
170
- [/^(?:border|b)(?:-([^-]+))?(?:-([^-]+))?$/, handlerBorder],
169
+ [/^(?:border|b)()-(.+)$/, handlerBorder],
170
+ [/^(?:border|b)-([^-]+)-(.+)$/, handlerBorder],
171
+ [/^(?:border|b)()-size-(.+)$/, handlerBorderSize],
172
+ [/^(?:border|b)-([^-]+)-size-(.+)$/, handlerBorderSize],
173
+ [/^(?:border|b)()-(.+)$/, handlerBorderColor],
174
+ [/^(?:border|b)-([^-]+)-(.+)$/, handlerBorderColor],
175
+ [/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": index.handler.bracket.percent(opacity) })],
171
176
  ["border-solid", { "border-style": "solid" }],
172
177
  ["border-dashed", { "border-style": "dashed" }],
173
178
  ["border-dotted", { "border-style": "dotted" }],
@@ -175,20 +180,35 @@ const borders = [
175
180
  ["border-none", { "border-style": "none" }],
176
181
  [/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
177
182
  [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?$/, handlerRounded],
178
- [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-([^-]+))?$/, handlerRounded],
179
- [/^(?:border|b)-(.+)$/, colorResolver$1("border-color", "border")],
180
- [/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": index.handler.bracket.percent(opacity) })]
183
+ [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-([^-]+))?$/, handlerRounded]
181
184
  ];
182
- function handlerBorder([, a, b]) {
185
+ function handlerBorder(m) {
186
+ const borderSizes = handlerBorderSize(m);
187
+ if (borderSizes) {
188
+ return [
189
+ ...borderSizes,
190
+ ["border-style", "solid"]
191
+ ];
192
+ }
193
+ }
194
+ function handlerBorderSize([, a, b]) {
183
195
  const [d, s = "1"] = index.directionMap[a] ? [a, b] : ["", a];
184
196
  const v = index.handler.bracket.px(s);
185
197
  if (v != null) {
186
198
  return [
187
- ...index.directionMap[d].map((i) => [`border${i}-width`, v]),
188
- ["border-style", "solid"]
199
+ ...index.directionMap[d].map((i) => [`border${i}-width`, v])
189
200
  ];
190
201
  }
191
202
  }
203
+ function handlerBorderColor([, a, c], ctx) {
204
+ const ofColor = colorResolver$1("border-color", "border")(["", c], ctx);
205
+ if (ofColor) {
206
+ const borders2 = index.directionMap[index.directionMap[a] ? a : ""].map((i) => colorResolver$1(`border${i}-color`, "border")(["", c], ctx));
207
+ const borderObject = {};
208
+ Object.assign(borderObject, ...borders2);
209
+ return borderObject;
210
+ }
211
+ }
192
212
  function handlerRounded([, a, b], { theme }) {
193
213
  const [d, s = "DEFAULT"] = index.cornerMap[a] ? [a, b] : ["", a];
194
214
  const v = theme.borderRadius?.[s] || index.handler.bracket.fraction.rem(s);
@@ -826,6 +846,8 @@ const variablesAbbrMap = {
826
846
  "backface": "backface-visibility",
827
847
  "whitespace": "white-space",
828
848
  "break": "word-break",
849
+ "b": "border-color",
850
+ "border": "border-color",
829
851
  "color": "color",
830
852
  "case": "text-transform",
831
853
  "origin": "transform-origin",
@@ -846,17 +868,20 @@ const variablesAbbrMap = {
846
868
  "self": "align-self",
847
869
  "object": "object-fit"
848
870
  };
849
- const cssVariables = [[
850
- /^(.+)-\$(.+)$/,
851
- ([, name, varname]) => {
871
+ const cssVariables = [
872
+ [/^(.+)-\$(.+)$/, ([, name, varname]) => {
852
873
  const prop = variablesAbbrMap[name];
853
874
  if (prop) {
854
875
  return {
855
876
  [prop]: `var(--${varname})`
856
877
  };
857
878
  }
858
- }
859
- ]];
879
+ }],
880
+ [/^(?:border|b)-([^-]+)-\$(.+)$/, ([, a, v]) => {
881
+ if (a in index.directionMap)
882
+ return index.directionMap[a].map((i) => [`border${i}-color`, `var(--${v})`]);
883
+ }]
884
+ ];
860
885
 
861
886
  const questionMark = [
862
887
  [
@@ -164,8 +164,13 @@ const placeholder = [
164
164
 
165
165
  const borders = [
166
166
  [/^border$/, handlerBorder],
167
- [/^(?:border|b)(?:-([^-]+))?$/, handlerBorder],
168
- [/^(?:border|b)(?:-([^-]+))?(?:-([^-]+))?$/, handlerBorder],
167
+ [/^(?:border|b)()-(.+)$/, handlerBorder],
168
+ [/^(?:border|b)-([^-]+)-(.+)$/, handlerBorder],
169
+ [/^(?:border|b)()-size-(.+)$/, handlerBorderSize],
170
+ [/^(?:border|b)-([^-]+)-size-(.+)$/, handlerBorderSize],
171
+ [/^(?:border|b)()-(.+)$/, handlerBorderColor],
172
+ [/^(?:border|b)-([^-]+)-(.+)$/, handlerBorderColor],
173
+ [/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": handler.bracket.percent(opacity) })],
169
174
  ["border-solid", { "border-style": "solid" }],
170
175
  ["border-dashed", { "border-style": "dashed" }],
171
176
  ["border-dotted", { "border-style": "dotted" }],
@@ -173,20 +178,35 @@ const borders = [
173
178
  ["border-none", { "border-style": "none" }],
174
179
  [/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
175
180
  [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?$/, handlerRounded],
176
- [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-([^-]+))?$/, handlerRounded],
177
- [/^(?:border|b)-(.+)$/, colorResolver$1("border-color", "border")],
178
- [/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": handler.bracket.percent(opacity) })]
181
+ [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-([^-]+))?$/, handlerRounded]
179
182
  ];
180
- function handlerBorder([, a, b]) {
183
+ function handlerBorder(m) {
184
+ const borderSizes = handlerBorderSize(m);
185
+ if (borderSizes) {
186
+ return [
187
+ ...borderSizes,
188
+ ["border-style", "solid"]
189
+ ];
190
+ }
191
+ }
192
+ function handlerBorderSize([, a, b]) {
181
193
  const [d, s = "1"] = directionMap[a] ? [a, b] : ["", a];
182
194
  const v = handler.bracket.px(s);
183
195
  if (v != null) {
184
196
  return [
185
- ...directionMap[d].map((i) => [`border${i}-width`, v]),
186
- ["border-style", "solid"]
197
+ ...directionMap[d].map((i) => [`border${i}-width`, v])
187
198
  ];
188
199
  }
189
200
  }
201
+ function handlerBorderColor([, a, c], ctx) {
202
+ const ofColor = colorResolver$1("border-color", "border")(["", c], ctx);
203
+ if (ofColor) {
204
+ const borders2 = directionMap[directionMap[a] ? a : ""].map((i) => colorResolver$1(`border${i}-color`, "border")(["", c], ctx));
205
+ const borderObject = {};
206
+ Object.assign(borderObject, ...borders2);
207
+ return borderObject;
208
+ }
209
+ }
190
210
  function handlerRounded([, a, b], { theme }) {
191
211
  const [d, s = "DEFAULT"] = cornerMap[a] ? [a, b] : ["", a];
192
212
  const v = theme.borderRadius?.[s] || handler.bracket.fraction.rem(s);
@@ -824,6 +844,8 @@ const variablesAbbrMap = {
824
844
  "backface": "backface-visibility",
825
845
  "whitespace": "white-space",
826
846
  "break": "word-break",
847
+ "b": "border-color",
848
+ "border": "border-color",
827
849
  "color": "color",
828
850
  "case": "text-transform",
829
851
  "origin": "transform-origin",
@@ -844,17 +866,20 @@ const variablesAbbrMap = {
844
866
  "self": "align-self",
845
867
  "object": "object-fit"
846
868
  };
847
- const cssVariables = [[
848
- /^(.+)-\$(.+)$/,
849
- ([, name, varname]) => {
869
+ const cssVariables = [
870
+ [/^(.+)-\$(.+)$/, ([, name, varname]) => {
850
871
  const prop = variablesAbbrMap[name];
851
872
  if (prop) {
852
873
  return {
853
874
  [prop]: `var(--${varname})`
854
875
  };
855
876
  }
856
- }
857
- ]];
877
+ }],
878
+ [/^(?:border|b)-([^-]+)-\$(.+)$/, ([, a, v]) => {
879
+ if (a in directionMap)
880
+ return directionMap[a].map((i) => [`border${i}-color`, `var(--${v})`]);
881
+ }]
882
+ ];
858
883
 
859
884
  const questionMark = [
860
885
  [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "description": "The minimal preset for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -61,7 +61,7 @@
61
61
  "*.css"
62
62
  ],
63
63
  "dependencies": {
64
- "@unocss/core": "0.16.0"
64
+ "@unocss/core": "0.16.1"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",