@unocss/transformer-compile-class 0.55.1 → 0.55.3

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.
@@ -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 { type CompileClassOptions, transformerCompileClass as default };
@@ -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 { type CompileClassOptions, transformerCompileClass as default };
package/dist/index.d.ts CHANGED
@@ -53,4 +53,4 @@ interface CompileClassOptions {
53
53
  }
54
54
  declare function transformerCompileClass(options?: CompileClassOptions): SourceCodeTransformer;
55
55
 
56
- export { CompileClassOptions, transformerCompileClass as default };
56
+ export { type 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.1",
3
+ "version": "0.55.3",
4
4
  "description": "Compile group of classes into one class",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -33,10 +33,10 @@
33
33
  "dist"
34
34
  ],
35
35
  "dependencies": {
36
- "@unocss/core": "0.55.1"
36
+ "@unocss/core": "0.55.3"
37
37
  },
38
38
  "devDependencies": {
39
- "magic-string": "^0.30.2"
39
+ "magic-string": "^0.30.3"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "unbuild",