anubis-ui 1.2.26 → 1.3.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.
- package/README.md +113 -50
- package/package.json +1 -1
- package/src/config/colors.config.json +0 -12
package/README.md
CHANGED
|
@@ -3,13 +3,67 @@
|
|
|
3
3
|
|
|
4
4
|
AnubisUI (Autonomous Nominative Utility Based Intuitive Styler) is a Vite plugin that provides dynamic CSS class generation based on configuration files. It automatically generates CSS rules by scanning your source files and mapping utility classes to their corresponding styles.
|
|
5
5
|
|
|
6
|
+
## 🚀 Quick Start
|
|
7
|
+
|
|
8
|
+
AnubisUI automatically generates the CSS classes you need, simply by using them in your code. No need to write CSS manually!
|
|
9
|
+
|
|
10
|
+
### Concrete Example
|
|
11
|
+
|
|
12
|
+
**In your Vue/HTML component:**
|
|
13
|
+
```html
|
|
14
|
+
<template>
|
|
15
|
+
<div class="bg-primary-low text-primary rounded-lg smooth hover:shadow-accent-wide">
|
|
16
|
+
<button class="bg-accent text-primary size-lg weight-bold hover:bg-accent-high">
|
|
17
|
+
Click me
|
|
18
|
+
</button>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**AnubisUI automatically generates the CSS:**
|
|
24
|
+
```css
|
|
25
|
+
.bg-primary-low { background: var(--primary-low) !important; }
|
|
26
|
+
.text-primary { color: var(--primary) !important; }
|
|
27
|
+
.rounded-lg { border-radius: 12px !important; }
|
|
28
|
+
.smooth { transition-duration: 0.1s !important; }
|
|
29
|
+
.hover\:shadow-accent-wide:hover { box-shadow: 0px 0px 10px 2px var(--accent) !important; }
|
|
30
|
+
/* ... and much more */
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Key Benefits
|
|
34
|
+
|
|
35
|
+
✅ **Zero CSS to write** - Use classes, AnubisUI generates the CSS\
|
|
36
|
+
✅ **Light/dark themes** - Automatic support with CSS variables\
|
|
37
|
+
✅ **Hot-reload** - Classes are detected and generated on the fly\
|
|
38
|
+
✅ **Optimized** - Only used classes are generated\
|
|
39
|
+
✅ **Customizable** - Configure your colors, variations and presets
|
|
40
|
+
|
|
41
|
+
### Typical Use Cases
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<!-- Card with border and shadow on hover -->
|
|
45
|
+
<div class="bg-neutral-lowest border-neutral-thin rounded-lg hover:shadow-primary-wide smooth">
|
|
46
|
+
<h2 class="text-primary size-2xl weight-bold">Title</h2>
|
|
47
|
+
<p class="text-neutral-medium size-md">Description</p>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<!-- Button with states -->
|
|
51
|
+
<button class="bg-success text-primary rounded smooth hover:bg-success-high">
|
|
52
|
+
Validate
|
|
53
|
+
</button>
|
|
54
|
+
|
|
55
|
+
<!-- Badge with inner borders -->
|
|
56
|
+
<span class="bg-warning-lowest inner-border-warning-thin rounded-full text-warning-high size-sm">
|
|
57
|
+
New
|
|
58
|
+
</span>
|
|
59
|
+
```
|
|
60
|
+
|
|
6
61
|
> __⚠️ IMPORTANT__ - Dynamic classes like `` `bg-primary-${props.bg}` `` **will NOT work**
|
|
7
62
|
>
|
|
8
63
|
> Classes must be **EXPLICITLY written** in the code to allow the extraction to work correctly. The plugin uses regex pattern matching on your source files.
|
|
9
64
|
>
|
|
10
65
|
> Use the `force` configuration to generate specific classes even if they're not present in the code.
|
|
11
66
|
|
|
12
|
-
|
|
13
67
|
## Table of Contents
|
|
14
68
|
1. [Features](#features)
|
|
15
69
|
2. [Installation](#installation)
|
|
@@ -71,12 +125,12 @@ css: [
|
|
|
71
125
|
- Each color is exposed as a CSS variable: `--primary`, `--secondary`, etc.
|
|
72
126
|
- Pre-defined color levels: `lowest`, `lower`, `low`, `medium`, `high`, `higher`, `highest`
|
|
73
127
|
|
|
74
|
-
5. Start adding classes to your
|
|
128
|
+
5. Start adding classes to your .vue files
|
|
75
129
|
```html
|
|
76
130
|
<div class="bg-primary-low border-neutral-medium hover:shadow-wide rounded-lg" />
|
|
77
|
-
<button class="bg-accent text-
|
|
131
|
+
<button class="bg-accent text-primary size-lg weight-bold smooth">Click me</button>
|
|
78
132
|
```
|
|
79
|
-
<sup>any .
|
|
133
|
+
<sup>any .vue file</sup>
|
|
80
134
|
|
|
81
135
|
6. Enjoy
|
|
82
136
|
|
|
@@ -96,33 +150,29 @@ To override default configuration, add a `anubis.config.json` in project root fo
|
|
|
96
150
|
>Overriding completly replaces default configuration. You need to copy/paste it and add yours if you want to keep the default too.
|
|
97
151
|
<br />
|
|
98
152
|
|
|
99
|
-
|
|
153
|
+
Only the sections you want to override need to be included - other sections will use default values.\
|
|
154
|
+
For every config you want to change, add the corresponding section in your config file
|
|
155
|
+
<br />
|
|
100
156
|
|
|
157
|
+
### Some examples:
|
|
101
158
|
```js
|
|
102
159
|
{
|
|
103
160
|
// files.config.json
|
|
104
161
|
"files": {
|
|
105
162
|
"targets": ["/.vue"],
|
|
106
|
-
"ignore": []
|
|
163
|
+
"ignore": ["**/*specificFile.vue"]
|
|
107
164
|
},
|
|
108
165
|
|
|
109
166
|
// colors.config.json
|
|
110
|
-
"colors": ["primary", "secondary"],
|
|
111
|
-
|
|
112
|
-
// states.config.json
|
|
113
|
-
"states": ["hover"],
|
|
167
|
+
"colors": ["primary", "secondary", "..."],
|
|
114
168
|
|
|
115
|
-
//
|
|
116
|
-
"
|
|
169
|
+
// utilities.config.json
|
|
170
|
+
"utilities": [
|
|
117
171
|
{
|
|
118
172
|
"prefix": "bg",
|
|
119
173
|
"declaration": "background: ${color}",
|
|
120
174
|
"export": "all"
|
|
121
175
|
}
|
|
122
|
-
],
|
|
123
|
-
|
|
124
|
-
// presets.config.json
|
|
125
|
-
"presets": [
|
|
126
176
|
{
|
|
127
177
|
"prefix": "border",
|
|
128
178
|
"declaration": "border-width: ${value} !important; border-color: ${color} !important; border-style: solid;",
|
|
@@ -145,20 +195,13 @@ For every config you want to change, add the corresponding section in your confi
|
|
|
145
195
|
// force.config.json
|
|
146
196
|
"force": [
|
|
147
197
|
"bg-primary-10",
|
|
148
|
-
"
|
|
149
|
-
"
|
|
198
|
+
"hover:border-neutral-thin",
|
|
199
|
+
"text-danger"
|
|
150
200
|
]
|
|
151
201
|
}
|
|
152
202
|
```
|
|
153
203
|
<sup>anubis.config.json (example)</sup>
|
|
154
204
|
|
|
155
|
-
Only the sections you want to override need to be included - other sections will use default values. Not every
|
|
156
|
-
> Presets is still unstable, use at your own risks
|
|
157
|
-
<br />
|
|
158
|
-
You __MUST__ use the exact same [presets](#presets-presetsconfigjson) names syntax to keep it working, but variations key/values can change.
|
|
159
|
-
<br />
|
|
160
|
-
Copy-paste is recommanded
|
|
161
|
-
|
|
162
205
|
---
|
|
163
206
|
### Colors (`colors.config.json`)
|
|
164
207
|
Define your color palette with light/dark theme support. Colors can be defined in three different ways:
|
|
@@ -173,7 +216,7 @@ Define your color palette with light/dark theme support. Colors can be defined i
|
|
|
173
216
|
"dark": "#1a94db"
|
|
174
217
|
}
|
|
175
218
|
```
|
|
176
|
-
Generates color variables for both light and dark themes with opacity variations
|
|
219
|
+
<sup>Generates color variables for both light and dark themes with opacity variations.</sup>
|
|
177
220
|
|
|
178
221
|
2. **Light theme only** - Define only `light` value:
|
|
179
222
|
```json
|
|
@@ -181,7 +224,7 @@ Define your color palette with light/dark theme support. Colors can be defined i
|
|
|
181
224
|
"light": "#ff00ff"
|
|
182
225
|
}
|
|
183
226
|
```
|
|
184
|
-
Generates color variables only for light theme. Dark theme will not have this color defined
|
|
227
|
+
<sup>Generates color variables only for light theme. Dark theme will not have this color defined.</sup>
|
|
185
228
|
|
|
186
229
|
3. **Dark theme only** - Define only `dark` value:
|
|
187
230
|
```json
|
|
@@ -189,9 +232,30 @@ Define your color palette with light/dark theme support. Colors can be defined i
|
|
|
189
232
|
"dark": "#00ffff"
|
|
190
233
|
}
|
|
191
234
|
```
|
|
192
|
-
Generates color variables only for dark theme. Light theme will not have this color defined
|
|
193
|
-
|
|
194
|
-
Full palette includes
|
|
235
|
+
<sup>Generates color variables only for dark theme. Light theme will not have this color defined.</sup>
|
|
236
|
+
|
|
237
|
+
Full palette includes:\
|
|
238
|
+
<b>Colors</b>
|
|
239
|
+
<ul>
|
|
240
|
+
<li>primary</li>
|
|
241
|
+
<li>secondary</li>
|
|
242
|
+
<li>accent</li>
|
|
243
|
+
<li>neutral</li>
|
|
244
|
+
<li>success</li>
|
|
245
|
+
<li>warning</li>
|
|
246
|
+
<li>danger</lu>
|
|
247
|
+
</ul>
|
|
248
|
+
|
|
249
|
+
<b>Levels</b>
|
|
250
|
+
<ul>
|
|
251
|
+
<li>lowest <i>- lighest</i></li>
|
|
252
|
+
<li>lower</li>
|
|
253
|
+
<li>low</li>
|
|
254
|
+
<li>medium</li>
|
|
255
|
+
<li>high</li>
|
|
256
|
+
<li>higher</li>
|
|
257
|
+
<li>highest <i>- darkest</i></li>
|
|
258
|
+
</ul>
|
|
195
259
|
|
|
196
260
|
**Color naming convention**: Colors are automatically converted to CSS variables as `--{color-name}`. Use semantic color levels to ensure proper theme adaptation.
|
|
197
261
|
|
|
@@ -220,19 +284,18 @@ You can add multiple glob patterns to scan different file types:
|
|
|
220
284
|
```
|
|
221
285
|
|
|
222
286
|
---
|
|
223
|
-
###
|
|
224
|
-
Configure
|
|
287
|
+
### Utilities (`utilities.config.json`)
|
|
288
|
+
Configure all utility classes. This includes both color-based utilities and standalone utilities.
|
|
225
289
|
|
|
226
|
-
**[View default
|
|
290
|
+
**[View default utilities config →](./src/config/utilities.config.json)**
|
|
227
291
|
|
|
228
|
-
|
|
292
|
+
**Color-based utilities** (require a color):
|
|
293
|
+
- `bg` - Background colors
|
|
294
|
+
- `text` - Text colors
|
|
295
|
+
- `border` - Border with width variations and color
|
|
296
|
+
- `inner-border` - Inset box shadow with width variations and color
|
|
297
|
+
- `shadow` - Box shadow with spread variations and color
|
|
229
298
|
|
|
230
|
-
Presets include:
|
|
231
|
-
- `bg` - Background colors (no variations)
|
|
232
|
-
- `text` - Text colors (no variations)
|
|
233
|
-
- `border` - Border with width variations
|
|
234
|
-
- `inner-border` - Inset box shadow with width variations
|
|
235
|
-
- `shadow` - Box shadow with spread variations
|
|
236
299
|
|
|
237
300
|
---
|
|
238
301
|
### Quality of Life (`qol.config.json`)
|
|
@@ -313,12 +376,12 @@ These utilities require a color from your config:
|
|
|
313
376
|
|
|
314
377
|
Examples:
|
|
315
378
|
```html
|
|
316
|
-
<div class="bg-primary-low text-
|
|
379
|
+
<div class="bg-primary-low text-primary">Blue background with primary text</div>
|
|
317
380
|
<div class="bg-success-lowest text-success-highest">Success themed element</div>
|
|
318
381
|
```
|
|
319
382
|
|
|
320
|
-
###
|
|
321
|
-
|
|
383
|
+
### Utility Variations (Color + Size)
|
|
384
|
+
Utilities can combine colors with size variations:
|
|
322
385
|
|
|
323
386
|
- `border-{color}-{variation}` - Border with color and width
|
|
324
387
|
- Variations: `thinest`, `thiner`, `thin`, `default`, `thick`, `thicker`, `thickest`, `node`
|
|
@@ -373,7 +436,7 @@ Examples:
|
|
|
373
436
|
|
|
374
437
|
## Prefix/Declaration Relations
|
|
375
438
|
|
|
376
|
-
### Color
|
|
439
|
+
### Color-based Utilities
|
|
377
440
|
| Prefix | CSS Declaration |
|
|
378
441
|
|--------------|---------------------------------------------------------------------------------|
|
|
379
442
|
| bg | `background: var(--{color}) !important;` |
|
|
@@ -409,7 +472,7 @@ Examples:
|
|
|
409
472
|
- Concurrent file reading with configurable limit (default: 10 files)
|
|
410
473
|
|
|
411
474
|
3. **Class Extraction** (`src/tools/extraction/extractClasses.ts`)
|
|
412
|
-
- Builds dynamic regex from config (states,
|
|
475
|
+
- Builds dynamic regex from config (states, utilities prefixes)
|
|
413
476
|
- Extracts classes matching pattern: `(state:)?(prefix-)(-?(color|variation))?`
|
|
414
477
|
- Merges with forced classes from config
|
|
415
478
|
- Deduplicates and returns unique classes
|
|
@@ -417,7 +480,7 @@ Examples:
|
|
|
417
480
|
4. **Rule Generation** (`src/tools/mapping/mapClassIntoRule.ts`)
|
|
418
481
|
- Parses each class to identify state, prefix, color, and variation
|
|
419
482
|
- Validates color existence in config
|
|
420
|
-
- Handles
|
|
483
|
+
- Handles utility variations (direct values or CSS variables)
|
|
421
484
|
- Generates CSS rules with proper selectors and declarations
|
|
422
485
|
- Collects variants for CSS variable export
|
|
423
486
|
|
|
@@ -447,10 +510,10 @@ The plugin (`index.js`) provides:
|
|
|
447
510
|
├── src/
|
|
448
511
|
│ ├── config/ # Default configuration files
|
|
449
512
|
│ │ ├── colors.config.json # Color palette (light/dark themes)
|
|
450
|
-
│ │ ├──
|
|
451
|
-
│ │ ├──
|
|
452
|
-
│ │ ├──
|
|
453
|
-
│ │ └──
|
|
513
|
+
│ │ ├── utilities.config.json # All utility classes (bg, text, border, etc.)
|
|
514
|
+
│ │ ├── states.config.json # State modifiers
|
|
515
|
+
│ │ ├── files.config.json # File scan patterns
|
|
516
|
+
│ │ └── force.config.json # Force specific classes
|
|
454
517
|
│ ├── interfaces/ # TypeScript type definitions
|
|
455
518
|
│ └── tools/
|
|
456
519
|
│ ├── extraction/ # Class extraction logic
|
package/package.json
CHANGED
|
@@ -3,18 +3,6 @@
|
|
|
3
3
|
"light": "transparent",
|
|
4
4
|
"dark": "transparent"
|
|
5
5
|
},
|
|
6
|
-
"text": {
|
|
7
|
-
"light": "#000",
|
|
8
|
-
"dark": "#fff"
|
|
9
|
-
},
|
|
10
|
-
"text-invert": {
|
|
11
|
-
"light": "#fff",
|
|
12
|
-
"dark": "#000"
|
|
13
|
-
},
|
|
14
|
-
"text-link": {
|
|
15
|
-
"light": "#0a5a8a",
|
|
16
|
-
"dark": "#0f84cb"
|
|
17
|
-
},
|
|
18
6
|
"accent": {
|
|
19
7
|
"light": "#0f84cb",
|
|
20
8
|
"dark": "#1a94db"
|