@pikacss/nuxt-pikacss 0.0.39 → 0.0.40

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.
Files changed (2) hide show
  1. package/README.md +87 -50
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -13,12 +13,12 @@ pnpm add @pikacss/nuxt-pikacss
13
13
  **nuxt.config.ts**:
14
14
  ```typescript
15
15
  export default defineNuxtConfig({
16
- modules: [
17
- '@pikacss/nuxt-pikacss'
18
- ],
19
- pikacss: {
20
- // options
21
- }
16
+ modules: [
17
+ '@pikacss/nuxt-pikacss'
18
+ ],
19
+ pikacss: {
20
+ // options
21
+ }
22
22
  })
23
23
  ```
24
24
 
@@ -39,9 +39,9 @@ The module works out of the box with zero configuration:
39
39
  ```typescript
40
40
  // nuxt.config.ts
41
41
  export default defineNuxtConfig({
42
- modules: [
43
- '@pikacss/nuxt-pikacss'
44
- ]
42
+ modules: [
43
+ '@pikacss/nuxt-pikacss'
44
+ ]
45
45
  })
46
46
  ```
47
47
 
@@ -52,40 +52,43 @@ You can customize PikaCSS through the `pikacss` option:
52
52
  ```typescript
53
53
  // nuxt.config.ts
54
54
  export default defineNuxtConfig({
55
- modules: [
56
- '@pikacss/nuxt-pikacss'
57
- ],
58
- pikacss: {
59
- // File scanning configuration
60
- scan: {
61
- include: ['**/*.vue', '**/*.tsx', '**/*.jsx'],
62
- exclude: ['node_modules/**']
63
- },
64
-
65
- // Engine configuration or config file path
66
- config: './pika.config.ts',
67
-
68
- // Auto-create config file if missing
69
- autoCreateConfig: true,
70
-
71
- // PikaCSS function name (globally available in Nuxt)
72
- fnName: 'pika',
73
-
74
- // Output format for class names
75
- transformedFormat: 'string', // 'string' | 'array' | 'inline'
76
-
77
- // TypeScript code generation
78
- tsCodegen: true, // or specify a path: 'src/pika.gen.ts'
79
-
80
- // CSS code generation
81
- cssCodegen: true // or specify a path: 'src/pika.gen.css'
82
- }
55
+ modules: [
56
+ '@pikacss/nuxt-pikacss'
57
+ ],
58
+ pikacss: {
59
+ // File scanning configuration
60
+ scan: {
61
+ include: ['**/*.vue', '**/*.tsx', '**/*.jsx'], // Default patterns for Nuxt
62
+ exclude: ['node_modules/**', 'dist/**'] // Default: node_modules and dist
63
+ },
64
+
65
+ // Engine configuration or config file path
66
+ config: './pika.config.ts', // or inline EngineConfig object
67
+
68
+ // Auto-create config file if missing
69
+ autoCreateConfig: true, // Default: true
70
+
71
+ // PikaCSS function name (globally available in Nuxt)
72
+ fnName: 'pika', // Default: 'pika'
73
+
74
+ // Output format for class names
75
+ transformedFormat: 'string', // 'string' | 'array' | 'inline' (default: 'string')
76
+
77
+ // TypeScript code generation
78
+ tsCodegen: true, // true (auto path) | false | custom path string
79
+
80
+ // CSS code generation (always enabled, cannot be false)
81
+ cssCodegen: true // true (auto path) | custom path string
82
+ }
83
83
  })
84
84
  ```
85
85
 
86
- ::: tip
87
- The `pika()` function is globally available in Nuxt components - no import needed!
88
- :::
86
+ ### Automatic Features
87
+
88
+ The Nuxt module provides zero-config setup with automatic:
89
+ - **CSS Injection**: Virtual `pika.css` module is auto-imported - no manual import needed
90
+ - **Vue Scanning**: Automatically scans `.vue`, `.tsx`, `.jsx` files
91
+ - **Global Function**: `pika()` is globally available in all components
89
92
 
90
93
  ### Using in Components
91
94
 
@@ -97,9 +100,9 @@ The module automatically imports the virtual `pika.css` module and makes `pika()
97
100
 
98
101
  // Style object
99
102
  const styles = pika({
100
- display: 'flex',
101
- alignItems: 'center',
102
- gap: '1rem'
103
+ display: 'flex',
104
+ alignItems: 'center',
105
+ gap: '1rem'
103
106
  })
104
107
 
105
108
  // Using shortcuts
@@ -107,21 +110,55 @@ const centered = pika('flex-center')
107
110
 
108
111
  // Combining shortcuts with styles
109
112
  const button = pika('btn', {
110
- backgroundColor: '#3b82f6',
111
- color: 'white'
113
+ backgroundColor: '#3b82f6',
114
+ color: 'white'
112
115
  })
113
116
  </script>
114
117
 
115
118
  <template>
116
- <div :class="styles">
117
- <button :class="button">Click me</button>
118
- </div>
119
+ <div :class="styles">
120
+ <button :class="button">
121
+ Click me
122
+ </button>
123
+ </div>
119
124
  </template>
120
125
  ```
121
126
 
122
127
  ## Options
123
128
 
124
- All options from `@pikacss/unplugin-pikacss` are supported. See the [unplugin documentation](../unplugin/README.md) for details.
129
+ The module accepts all options from `@pikacss/unplugin-pikacss` (except `currentPackageName` which is set automatically).
130
+
131
+ ### PluginOptions Interface
132
+
133
+ ```typescript
134
+ interface ModuleOptions {
135
+ scan?: {
136
+ include?: string | string[] // Default: ['**/*.vue', '**/*.tsx', '**/*.jsx']
137
+ exclude?: string | string[] // Default: ['node_modules/**', 'dist/**']
138
+ }
139
+ config?: EngineConfig | string // Config object or path (default: auto-detect)
140
+ autoCreateConfig?: boolean // Default: true
141
+ fnName?: string // Default: 'pika'
142
+ transformedFormat?: 'string' | 'array' | 'inline' // Default: 'string'
143
+ tsCodegen?: boolean | string // Default: true (auto-generate pika.gen.ts)
144
+ cssCodegen?: true | string // Default: true (auto-generate pika.gen.css)
145
+ }
146
+ ```
147
+
148
+ ### Option Details
149
+
150
+ | Option | Type | Default | Description |
151
+ |--------|------|---------|-------------|
152
+ | `scan.include` | `string \| string[]` | `['**/*.vue', '**/*.tsx', '**/*.jsx']` | File patterns to scan for `pika()` calls |
153
+ | `scan.exclude` | `string \| string[]` | `['node_modules/**', 'dist/**']` | File patterns to exclude from scanning |
154
+ | `config` | `EngineConfig \| string` | Auto-detect | Engine config object or path to config file |
155
+ | `autoCreateConfig` | `boolean` | `true` | Auto-create config file if missing |
156
+ | `fnName` | `string` | `'pika'` | Function name to detect in code |
157
+ | `transformedFormat` | `'string' \| 'array' \| 'inline'` | `'string'` | Output format for generated class names |
158
+ | `tsCodegen` | `boolean \| string` | `true` | Generate TypeScript types (true = auto path, false = disabled, string = custom path) |
159
+ | `cssCodegen` | `true \| string` | `true` | Generate CSS output (true = auto path, string = custom path) |
160
+
161
+ See the [@pikacss/unplugin-pikacss documentation](https://github.com/pikacss/pikacss/tree/main/packages/unplugin) for complete details.
125
162
 
126
163
  ## PikaCSS Configuration
127
164
 
@@ -131,7 +168,7 @@ Create a `pika.config.ts` file in your project root:
131
168
  import { defineEngineConfig } from '@pikacss/core'
132
169
 
133
170
  export default defineEngineConfig({
134
- // Your PikaCSS configuration
171
+ // Your PikaCSS configuration
135
172
  })
136
173
  ```
137
174
 
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@pikacss/nuxt-pikacss",
3
3
  "type": "module",
4
- "version": "0.0.39",
4
+ "version": "0.0.40",
5
5
  "author": "DevilTea <ch19980814@gmail.com>",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/pikacss/pikacss.git",
9
+ "url": "https://github.com/pikacss/pikacss.github.io.git",
10
10
  "directory": "packages/nuxt-pikacss"
11
11
  },
12
12
  "bugs": {
13
- "url": "https://github.com/pikacss/pikacss/issues"
13
+ "url": "https://github.com/pikacss/pikacss.github.io/issues"
14
14
  },
15
15
  "keywords": [
16
16
  "pikacss",
@@ -43,7 +43,7 @@
43
43
  "dependencies": {
44
44
  "@nuxt/kit": "^4.2.2",
45
45
  "pathe": "^2.0.3",
46
- "@pikacss/unplugin-pikacss": "0.0.39"
46
+ "@pikacss/unplugin-pikacss": "0.0.40"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@nuxt/schema": "^4.2.2"