@unocss/transformer-compile-class 0.55.1 → 0.55.2
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/dist/index.d.cts +56 -0
- package/dist/index.d.mts +56 -0
- package/package.json +2 -2
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { SourceCodeTransformer } from '@unocss/core';
|
|
2
|
+
|
|
3
|
+
interface CompileClassOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Trigger regex literal. The default trigger regex literal matches `:uno:`,
|
|
6
|
+
* for example: `<div class=":uno: font-bold text-white">`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* The trigger additionally allows defining a capture group named `name`, which
|
|
10
|
+
* allows custom class names. One possible regex would be:
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
* export default defineConfig({
|
|
14
|
+
* transformers: [
|
|
15
|
+
* transformerCompileClass({
|
|
16
|
+
* trigger: /(["'`]):uno(?:-)?(?<name>[^\s\1]+)?:\s([^\1]*?)\1/g
|
|
17
|
+
* }),
|
|
18
|
+
* ],
|
|
19
|
+
* })
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* This regular expression matches `:uno-MYNAME:` and uses `MYNAME` in
|
|
23
|
+
* combination with the class prefix as the final class name, for example:
|
|
24
|
+
* `.uno-MYNAME`. It should be noted that the regex literal needs to include
|
|
25
|
+
* the global flag `/g`.
|
|
26
|
+
*
|
|
27
|
+
* @note
|
|
28
|
+
* This parameter is backwards compatible. It accepts string only trigger
|
|
29
|
+
* words, like `:uno:` or a regex literal.
|
|
30
|
+
*
|
|
31
|
+
* @default `/(["'`]):uno(?:-)?(?<name>[^\s\1]+)?:\s([^\1]*?)\1/g`
|
|
32
|
+
*/
|
|
33
|
+
trigger?: string | RegExp;
|
|
34
|
+
/**
|
|
35
|
+
* Prefix for compile class name
|
|
36
|
+
* @default 'uno-'
|
|
37
|
+
*/
|
|
38
|
+
classPrefix?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Hash function
|
|
41
|
+
*/
|
|
42
|
+
hashFn?: (str: string) => string;
|
|
43
|
+
/**
|
|
44
|
+
* Left unknown classes inside the string
|
|
45
|
+
*
|
|
46
|
+
* @default true
|
|
47
|
+
*/
|
|
48
|
+
keepUnknown?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* The layer name of generated rules
|
|
51
|
+
*/
|
|
52
|
+
layer?: string;
|
|
53
|
+
}
|
|
54
|
+
declare function transformerCompileClass(options?: CompileClassOptions): SourceCodeTransformer;
|
|
55
|
+
|
|
56
|
+
export { CompileClassOptions, transformerCompileClass as default };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { SourceCodeTransformer } from '@unocss/core';
|
|
2
|
+
|
|
3
|
+
interface CompileClassOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Trigger regex literal. The default trigger regex literal matches `:uno:`,
|
|
6
|
+
* for example: `<div class=":uno: font-bold text-white">`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* The trigger additionally allows defining a capture group named `name`, which
|
|
10
|
+
* allows custom class names. One possible regex would be:
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
* export default defineConfig({
|
|
14
|
+
* transformers: [
|
|
15
|
+
* transformerCompileClass({
|
|
16
|
+
* trigger: /(["'`]):uno(?:-)?(?<name>[^\s\1]+)?:\s([^\1]*?)\1/g
|
|
17
|
+
* }),
|
|
18
|
+
* ],
|
|
19
|
+
* })
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* This regular expression matches `:uno-MYNAME:` and uses `MYNAME` in
|
|
23
|
+
* combination with the class prefix as the final class name, for example:
|
|
24
|
+
* `.uno-MYNAME`. It should be noted that the regex literal needs to include
|
|
25
|
+
* the global flag `/g`.
|
|
26
|
+
*
|
|
27
|
+
* @note
|
|
28
|
+
* This parameter is backwards compatible. It accepts string only trigger
|
|
29
|
+
* words, like `:uno:` or a regex literal.
|
|
30
|
+
*
|
|
31
|
+
* @default `/(["'`]):uno(?:-)?(?<name>[^\s\1]+)?:\s([^\1]*?)\1/g`
|
|
32
|
+
*/
|
|
33
|
+
trigger?: string | RegExp;
|
|
34
|
+
/**
|
|
35
|
+
* Prefix for compile class name
|
|
36
|
+
* @default 'uno-'
|
|
37
|
+
*/
|
|
38
|
+
classPrefix?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Hash function
|
|
41
|
+
*/
|
|
42
|
+
hashFn?: (str: string) => string;
|
|
43
|
+
/**
|
|
44
|
+
* Left unknown classes inside the string
|
|
45
|
+
*
|
|
46
|
+
* @default true
|
|
47
|
+
*/
|
|
48
|
+
keepUnknown?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* The layer name of generated rules
|
|
51
|
+
*/
|
|
52
|
+
layer?: string;
|
|
53
|
+
}
|
|
54
|
+
declare function transformerCompileClass(options?: CompileClassOptions): SourceCodeTransformer;
|
|
55
|
+
|
|
56
|
+
export { CompileClassOptions, transformerCompileClass as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/transformer-compile-class",
|
|
3
|
-
"version": "0.55.
|
|
3
|
+
"version": "0.55.2",
|
|
4
4
|
"description": "Compile group of classes into one class",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@unocss/core": "0.55.
|
|
36
|
+
"@unocss/core": "0.55.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"magic-string": "^0.30.2"
|