@unocss/preset-mini 0.15.5 → 0.15.6

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.
@@ -366,6 +366,11 @@ const fontSizes = [
366
366
  "line-height": height
367
367
  };
368
368
  }
369
+ }],
370
+ [/^text-size-(.+)$/, ([, s]) => {
371
+ const raw = index.handler.bracket.rem(s);
372
+ if (raw)
373
+ return { "font-size": raw };
369
374
  }]
370
375
  ];
371
376
  const fontWeights = [
@@ -364,6 +364,11 @@ const fontSizes = [
364
364
  "line-height": height
365
365
  };
366
366
  }
367
+ }],
368
+ [/^text-size-(.+)$/, ([, s]) => {
369
+ const raw = handler.bracket.rem(s);
370
+ if (raw)
371
+ return { "font-size": raw };
367
372
  }]
368
373
  ];
369
374
  const fontWeights = [
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ const core = require('@unocss/core');
4
+
3
5
  const directionMap = {
4
6
  "l": ["-left"],
5
7
  "r": ["-right"],
@@ -111,7 +113,7 @@ function global(str) {
111
113
  return str;
112
114
  }
113
115
 
114
- const handlers = {
116
+ const valueHandlers = {
115
117
  __proto__: null,
116
118
  rem: rem,
117
119
  px: px,
@@ -124,51 +126,17 @@ const handlers = {
124
126
  global: global
125
127
  };
126
128
 
127
- const handlersNames = Object.keys(handlers);
128
- const handler = function(str) {
129
- const s = this.__options?.sequence || [];
130
- this.__options.sequence = [];
131
- for (const n of s) {
132
- const res = handlers[n](str);
133
- if (res != null)
134
- return res;
135
- }
136
- return void 0;
137
- };
138
- function addProcessor(that, name) {
139
- if (!that.__options) {
140
- that.__options = {
141
- sequence: []
142
- };
143
- }
144
- that.__options.sequence.push(name);
145
- return that;
146
- }
147
- handlersNames.forEach((i) => {
148
- Object.defineProperty(handler, i, {
149
- enumerable: true,
150
- get() {
151
- return addProcessor(this, i);
152
- }
153
- });
154
- });
129
+ const handler = core.createValueHandler(valueHandlers);
130
+ const h = handler;
155
131
 
156
132
  function capitalize(str) {
157
133
  return str.charAt(0).toUpperCase() + str.slice(1);
158
134
  }
159
135
 
160
- exports.bracket = bracket;
161
136
  exports.capitalize = capitalize;
162
137
  exports.cornerMap = cornerMap;
163
- exports.cssvar = cssvar;
164
138
  exports.directionMap = directionMap;
165
- exports.fraction = fraction;
166
- exports.global = global;
139
+ exports.h = h;
167
140
  exports.handler = handler;
168
- exports.handlersNames = handlersNames;
169
- exports.number = number;
170
- exports.percent = percent;
171
- exports.px = px;
172
- exports.rem = rem;
173
- exports.time = time;
141
+ exports.valueHandlers = valueHandlers;
174
142
  exports.xyzMap = xyzMap;
@@ -1,3 +1,5 @@
1
+ import { createValueHandler } from '@unocss/core';
2
+
1
3
  const directionMap = {
2
4
  "l": ["-left"],
3
5
  "r": ["-right"],
@@ -109,7 +111,7 @@ function global(str) {
109
111
  return str;
110
112
  }
111
113
 
112
- const handlers = {
114
+ const valueHandlers = {
113
115
  __proto__: null,
114
116
  rem: rem,
115
117
  px: px,
@@ -122,37 +124,11 @@ const handlers = {
122
124
  global: global
123
125
  };
124
126
 
125
- const handlersNames = Object.keys(handlers);
126
- const handler = function(str) {
127
- const s = this.__options?.sequence || [];
128
- this.__options.sequence = [];
129
- for (const n of s) {
130
- const res = handlers[n](str);
131
- if (res != null)
132
- return res;
133
- }
134
- return void 0;
135
- };
136
- function addProcessor(that, name) {
137
- if (!that.__options) {
138
- that.__options = {
139
- sequence: []
140
- };
141
- }
142
- that.__options.sequence.push(name);
143
- return that;
144
- }
145
- handlersNames.forEach((i) => {
146
- Object.defineProperty(handler, i, {
147
- enumerable: true,
148
- get() {
149
- return addProcessor(this, i);
150
- }
151
- });
152
- });
127
+ const handler = createValueHandler(valueHandlers);
128
+ const h = handler;
153
129
 
154
130
  function capitalize(str) {
155
131
  return str.charAt(0).toUpperCase() + str.slice(1);
156
132
  }
157
133
 
158
- export { capitalize as a, percent as b, cornerMap as c, directionMap as d, bracket as e, fraction as f, cssvar as g, handler as h, global as i, handlersNames as j, number as n, px as p, rem as r, time as t, xyzMap as x };
134
+ export { capitalize as a, h as b, cornerMap as c, directionMap as d, handler as h, valueHandlers as v, xyzMap as x };
package/dist/utils.cjs CHANGED
@@ -4,22 +4,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./chunks/index.cjs');
6
6
  const variants = require('./chunks/variants.cjs');
7
+ require('@unocss/core');
7
8
 
8
9
 
9
10
 
10
- exports.bracket = index.bracket;
11
11
  exports.capitalize = index.capitalize;
12
12
  exports.cornerMap = index.cornerMap;
13
- exports.cssvar = index.cssvar;
14
13
  exports.directionMap = index.directionMap;
15
- exports.fraction = index.fraction;
16
- exports.global = index.global;
14
+ exports.h = index.h;
17
15
  exports.handler = index.handler;
18
- exports.handlersNames = index.handlersNames;
19
- exports.number = index.number;
20
- exports.percent = index.percent;
21
- exports.px = index.px;
22
- exports.rem = index.rem;
23
- exports.time = index.time;
16
+ exports.valueHandlers = index.valueHandlers;
24
17
  exports.xyzMap = index.xyzMap;
25
18
  exports.variantMatcher = variants.variantMatcher;
package/dist/utils.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as _unocss_core from '@unocss/core';
1
2
  import { VariantHandler } from '@unocss/core';
2
3
 
3
4
  declare const directionMap: Record<string, string[]>;
@@ -37,20 +38,11 @@ declare namespace handlers {
37
38
  };
38
39
  }
39
40
 
40
- declare type HandlerName = keyof typeof handlers;
41
- declare const handlersNames: ("number" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global")[];
42
- declare type Handler = {
43
- [K in HandlerName]: Handler;
44
- } & {
45
- (str: string): string | undefined;
46
- __options: {
47
- sequence: HandlerName[];
48
- };
49
- };
50
- declare const handler: Handler;
41
+ declare const handler: _unocss_core.ValueHandler<"number" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global">;
42
+ declare const h: _unocss_core.ValueHandler<"number" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global">;
51
43
 
52
44
  declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => (input: string) => VariantHandler | undefined;
53
45
 
54
46
  declare function capitalize<T extends string>(str: T): Capitalize<T>;
55
47
 
56
- export { Handler, HandlerName, bracket, capitalize, cornerMap, cssvar, directionMap, fraction, global, handler, handlersNames, number, percent, px, rem, time, variantMatcher, xyzMap };
48
+ export { capitalize, cornerMap, directionMap, h, handler, handlers as valueHandlers, variantMatcher, xyzMap };
package/dist/utils.mjs CHANGED
@@ -1,2 +1,3 @@
1
- export { e as bracket, a as capitalize, c as cornerMap, g as cssvar, d as directionMap, f as fraction, i as global, h as handler, j as handlersNames, n as number, b as percent, p as px, r as rem, t as time, x as xyzMap } from './chunks/index.mjs';
1
+ export { a as capitalize, c as cornerMap, d as directionMap, b as h, h as handler, v as valueHandlers, x as xyzMap } from './chunks/index.mjs';
2
2
  export { v as variantMatcher } from './chunks/variants.mjs';
3
+ import '@unocss/core';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.15.5",
3
+ "version": "0.15.6",
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.15.5"
64
+ "@unocss/core": "0.15.6"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",