@pikacss/core 0.0.39 → 0.0.41

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.cjs CHANGED
@@ -223,7 +223,7 @@ const hooks = {
223
223
  transformStyleItems: (plugins, styleItems) => execAsyncHook(plugins, "transformStyleItems", styleItems),
224
224
  transformStyleDefinitions: (plugins, styleDefinitions) => execAsyncHook(plugins, "transformStyleDefinitions", styleDefinitions),
225
225
  preflightUpdated: (plugins) => execSyncHook(plugins, "preflightUpdated", void 0),
226
- atomicStyleAdded: (plugins) => execSyncHook(plugins, "atomicStyleAdded", void 0),
226
+ atomicStyleAdded: (plugins, atomicStyle) => execSyncHook(plugins, "atomicStyleAdded", atomicStyle),
227
227
  autocompleteConfigUpdated: (plugins) => execSyncHook(plugins, "autocompleteConfigUpdated", void 0)
228
228
  };
229
229
  const orderMap = new Map([
package/dist/index.d.cts CHANGED
@@ -26,7 +26,7 @@ interface DynamicRule<T> {
26
26
  createResolved: (matched: RegExpMatchArray) => Awaitable<T>;
27
27
  }
28
28
  declare abstract class AbstractResolver<T> {
29
- protected _resolvedResultsMap: Map<string, ResolvedResult<T>>;
29
+ _resolvedResultsMap: Map<string, ResolvedResult<T>>;
30
30
  staticRulesMap: Map<string, StaticRule<T>>;
31
31
  dynamicRulesMap: Map<string, DynamicRule<T>>;
32
32
  onResolved: (string: string, type: 'static' | 'dynamic', result: ResolvedResult<T>) => void;
package/dist/index.d.mts CHANGED
@@ -26,7 +26,7 @@ interface DynamicRule<T> {
26
26
  createResolved: (matched: RegExpMatchArray) => Awaitable<T>;
27
27
  }
28
28
  declare abstract class AbstractResolver<T> {
29
- protected _resolvedResultsMap: Map<string, ResolvedResult<T>>;
29
+ _resolvedResultsMap: Map<string, ResolvedResult<T>>;
30
30
  staticRulesMap: Map<string, StaticRule<T>>;
31
31
  dynamicRulesMap: Map<string, DynamicRule<T>>;
32
32
  onResolved: (string: string, type: 'static' | 'dynamic', result: ResolvedResult<T>) => void;
package/dist/index.mjs CHANGED
@@ -222,7 +222,7 @@ const hooks = {
222
222
  transformStyleItems: (plugins, styleItems) => execAsyncHook(plugins, "transformStyleItems", styleItems),
223
223
  transformStyleDefinitions: (plugins, styleDefinitions) => execAsyncHook(plugins, "transformStyleDefinitions", styleDefinitions),
224
224
  preflightUpdated: (plugins) => execSyncHook(plugins, "preflightUpdated", void 0),
225
- atomicStyleAdded: (plugins) => execSyncHook(plugins, "atomicStyleAdded", void 0),
225
+ atomicStyleAdded: (plugins, atomicStyle) => execSyncHook(plugins, "atomicStyleAdded", atomicStyle),
226
226
  autocompleteConfigUpdated: (plugins) => execSyncHook(plugins, "autocompleteConfigUpdated", void 0)
227
227
  };
228
228
  const orderMap = new Map([
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pikacss/core",
3
3
  "type": "module",
4
- "version": "0.0.39",
4
+ "version": "0.0.41",
5
5
  "author": "DevilTea <ch19980814@gmail.com>",
6
6
  "license": "MIT",
7
7
  "repository": {
package/README.md DELETED
@@ -1,201 +0,0 @@
1
- # @pikacss/core
2
-
3
- The core Atomic CSS-in-JS engine of PikaCSS.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- pnpm add @pikacss/core
9
- ```
10
-
11
- ## Quick Start
12
-
13
- **pika.config.ts**:
14
- ```typescript
15
- import { defineEngineConfig } from '@pikacss/core'
16
-
17
- export default defineEngineConfig({
18
- // Your configuration
19
- })
20
- ```
21
-
22
- **Your code**:
23
- ```typescript
24
- import { createEngine, defineEngineConfig } from '@pikacss/core'
25
-
26
- const config = defineEngineConfig({
27
- // Engine configuration
28
- prefix: 'pk-',
29
- defaultSelector: '.%',
30
- plugins: []
31
- })
32
-
33
- const engine = createEngine(config)
34
- await engine.setup()
35
- ```
36
-
37
- ## Features
38
-
39
- - ⚡ High-performance Atomic CSS-in-JS engine
40
- - 🎯 Type-safe with full TypeScript support
41
- - 🔌 Extensible plugin system
42
- - 🎨 Built-in support for shortcuts, selectors, variables, keyframes
43
- - 📦 Works at build-time, zero runtime overhead
44
- - 🔧 Fully configurable
45
- - 🌐 Framework-agnostic core
46
-
47
- ## Usage for Integration Developers
48
-
49
- ### Creating an Engine
50
-
51
- ```typescript
52
- import { createEngine, defineEngineConfig } from '@pikacss/core'
53
-
54
- const config = defineEngineConfig({
55
- // Prefix for generated atomic CSS class names
56
- prefix: 'pk-',
57
-
58
- // Default selector format (% will be replaced with atomic ID)
59
- defaultSelector: '.%',
60
-
61
- // Plugins to extend functionality
62
- plugins: [],
63
-
64
- // Global CSS preflights
65
- preflights: [],
66
- })
67
-
68
- const engine = createEngine(config)
69
- await engine.setup()
70
- ```
71
-
72
- ### Engine Methods
73
-
74
- The engine provides methods for managing CSS generation:
75
-
76
- ```typescript
77
- // Add global CSS
78
- engine.addPreflight('* { box-sizing: border-box; }')
79
-
80
- // Access sub-systems
81
- engine.variables // CSS variables management
82
- engine.keyframes // CSS keyframes management
83
- engine.selectors // CSS selectors management
84
- engine.shortcuts // CSS shortcuts management
85
- engine.important // Important rules management
86
- ```
87
-
88
- ### Configuration
89
-
90
- Use `defineEngineConfig` for type-safe configuration:
91
-
92
- ```typescript
93
- import { defineEngineConfig } from '@pikacss/core'
94
-
95
- export default defineEngineConfig({
96
- // Prefix for atomic class IDs
97
- prefix: 'pk-',
98
-
99
- // Default selector format (% = atomic ID)
100
- defaultSelector: '.%',
101
-
102
- // Global CSS preflights
103
- preflights: [
104
- ':root { --primary: #3b82f6; }',
105
- // Or function:
106
- ({ engine, isFormatted }) => '/* Generated CSS */'
107
- ],
108
-
109
- // Shortcuts configuration
110
- shortcuts: {
111
- shortcuts: [
112
- ['flex-center', {
113
- display: 'flex',
114
- alignItems: 'center',
115
- justifyContent: 'center'
116
- }],
117
- ]
118
- },
119
-
120
- // Plugins to extend functionality
121
- plugins: []
122
- })
123
- ```
124
-
125
- ## API
126
-
127
- ### Main Exports
128
-
129
- ```typescript
130
- // Engine creation
131
- export function createEngine(config: EngineConfig): Engine
132
-
133
- // Type-safe config helpers
134
- export function defineEngineConfig(config: EngineConfig): EngineConfig
135
- export function defineEnginePlugin(plugin: EnginePlugin): EnginePlugin
136
- export function defineStyleDefinition(def: StyleDefinition): StyleDefinition
137
- export function definePreflight(preflight: Preflight): Preflight
138
- export function defineKeyframes(keyframes: Keyframes): Keyframes
139
- export function defineSelector(selector: Selector): Selector
140
- export function defineShortcut(shortcut: Shortcut): Shortcut
141
- export function defineVariables(variables: VariablesDefinition): VariablesDefinition
142
-
143
- // Utilities
144
- export { log, createLogger } from './internal/utils'
145
- ```
146
-
147
- ### Engine Instance
148
-
149
- The `Engine` instance provides methods for managing the CSS generation:
150
-
151
- - `engine.setup()` - Initialize the engine with plugins
152
- - `engine.addPreflight(css)` - Add global CSS
153
- - `engine.variables` - Manage CSS variables
154
- - `engine.keyframes` - Manage CSS keyframes
155
- - `engine.selectors` - Manage CSS selectors
156
- - `engine.shortcuts` - Manage CSS shortcuts
157
- - `engine.important` - Manage important rules
158
-
159
- ## Plugin Development
160
-
161
- Create custom plugins to extend PikaCSS:
162
-
163
- ```typescript
164
- import type { Plugin } from '@pikacss/core'
165
-
166
- export function myPlugin(): Plugin {
167
- return {
168
- name: 'my-plugin',
169
-
170
- setup(api) {
171
- // Add preflights
172
- api.addPreflight({
173
- css: '/* your global CSS */'
174
- })
175
-
176
- // Add rules
177
- api.addRule({
178
- /* rule configuration */
179
- })
180
-
181
- // Add shortcuts
182
- api.addShortcut({
183
- /* shortcut configuration */
184
- })
185
-
186
- // Add variants
187
- api.addVariant({
188
- /* variant configuration */
189
- })
190
- }
191
- }
192
- }
193
- ```
194
-
195
- ## Documentation
196
-
197
- For complete documentation, visit: [PikaCSS Documentation](https://pikacss.github.io/pikacss/)
198
-
199
- ## License
200
-
201
- MIT © DevilTea