@unocss/autocomplete 0.50.7 → 0.51.0
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/README.md +2 -64
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,71 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Autocomplete utils for UnoCSS. This is embedded in [the playground](https://uno.antfu.me/play/) and [the VS Code extension](https://github.com/unocss/unocss/tree/main/packages/vscode).
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Documentation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Static Rules
|
|
10
|
-
|
|
11
|
-
Static rules like this will just work without any configuration.
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
rules: [
|
|
15
|
-
['flex', { display: 'flex' }]
|
|
16
|
-
]
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### Dynamic Rules
|
|
20
|
-
|
|
21
|
-
For dynamic rules, you can provide an extra `meta` object to the rule and specify the autocomplete template.
|
|
22
|
-
|
|
23
|
-
```ts
|
|
24
|
-
rules: [
|
|
25
|
-
[
|
|
26
|
-
/^m-(\d)$/,
|
|
27
|
-
([, d]) => ({ margin: `${d / 4}rem` }),
|
|
28
|
-
{ autocomplete: 'm-<num>' }, // <-- this
|
|
29
|
-
],
|
|
30
|
-
]
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
The template uses a simple DSL to specify the autocomplete suggestions. The syntax is:
|
|
34
|
-
|
|
35
|
-
- `(...|...)`: logic OR groups. `|` as the separator. Will be used as suggestions when the some of the groups match.
|
|
36
|
-
- `<...>`: built-in short hands. currently supports `<num>`, `<percent>` and `<directions>`
|
|
37
|
-
- `$...`: theme inferring. for example, `$colors` will list all the properties of the `colors` object of the theme.
|
|
38
|
-
|
|
39
|
-
For examples:
|
|
40
|
-
|
|
41
|
-
###### Example 1
|
|
42
|
-
|
|
43
|
-
- **Template**: `(border|b)-(solid|dashed|dotted|double|hidden|none)`
|
|
44
|
-
- **Input**: `b-do`
|
|
45
|
-
- **Suggestions**: `b-dashed`, `b-double`
|
|
46
|
-
|
|
47
|
-
###### Example 2
|
|
48
|
-
|
|
49
|
-
- **Template**: `m-<num>`
|
|
50
|
-
- **Input**: `m-`
|
|
51
|
-
- **Suggestions**: `m-1`, `m-2`, `m-3` ...
|
|
52
|
-
|
|
53
|
-
###### Example 3
|
|
54
|
-
|
|
55
|
-
- **Template**: `text-$colors`
|
|
56
|
-
- **Input**: `text-r`
|
|
57
|
-
- **Suggestions**: `text-red`, `text-rose` ...
|
|
58
|
-
|
|
59
|
-
###### Example 4
|
|
60
|
-
|
|
61
|
-
For multiple templates
|
|
62
|
-
|
|
63
|
-
- **Template**: `['(border|b)-<num>', '(border|b)-<directions>-<num>']`
|
|
64
|
-
|
|
65
|
-
- **Input**: `b-`
|
|
66
|
-
- **Suggestions**: `b-x`, `b-y`, `b-1`, `b-2` ...
|
|
67
|
-
|
|
68
|
-
- **Input**: `b-x-`
|
|
69
|
-
- **Suggestions**: `b-x-1`, `b-x-2` ...
|
|
7
|
+
Please refer to the [documentation](https://unocss.dev/tools/autocomplete).
|
|
70
8
|
|
|
71
9
|
## License
|
|
72
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/autocomplete",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.0",
|
|
4
4
|
"description": "Autocomplete utils for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"lru-cache": "^8.0.4"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@unocss/core": "0.
|
|
39
|
+
"@unocss/core": "0.51.0"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "unbuild",
|