@pikacss/plugin-typography 0.0.38 → 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.
package/README.md CHANGED
@@ -16,7 +16,9 @@ import { defineEngineConfig } from '@pikacss/core'
16
16
  import { typography } from '@pikacss/plugin-typography'
17
17
 
18
18
  export default defineEngineConfig({
19
- plugins: [typography()]
19
+ plugins: [
20
+ typography() // Note: must call function
21
+ ]
20
22
  })
21
23
  ```
22
24
 
@@ -185,26 +187,47 @@ Size modifiers apply the complete `prose` styles with different font sizes:
185
187
 
186
188
  ### Customization
187
189
 
188
- Override color variables when creating the plugin:
190
+ The plugin provides module augmentation for type-safe configuration. After importing the plugin, the `typography` property becomes available in `EngineConfig` with full TypeScript autocomplete.
189
191
 
190
192
  **pika.config.ts**:
191
193
  ```typescript
192
194
  import { defineEngineConfig } from '@pikacss/core'
193
195
  import { typography } from '@pikacss/plugin-typography'
194
196
 
197
+ // Module augmentation is automatic - just import the plugin
195
198
  export default defineEngineConfig({
196
- plugins: [
197
- typography({
198
- variables: {
199
- '--pk-prose-color-body': '#374151',
200
- '--pk-prose-color-headings': '#111827',
201
- '--pk-prose-color-links': '#2563eb',
202
- }
203
- })
204
- ]
199
+ plugins: [
200
+ typography() // Note: must call function
201
+ ],
202
+ typography: { // ✅ TypeScript autocomplete works here
203
+ variables: {
204
+ '--pk-prose-color-body': '#374151',
205
+ '--pk-prose-color-headings': '#111827',
206
+ '--pk-prose-color-links': '#2563eb',
207
+ }
208
+ }
205
209
  })
206
210
  ```
207
211
 
212
+ **How Module Augmentation Works**:
213
+
214
+ The plugin declares module augmentation internally:
215
+
216
+ ```typescript
217
+ declare module '@pikacss/core' {
218
+ interface EngineConfig {
219
+ typography?: {
220
+ variables?: Partial<Record<string, string>>
221
+ }
222
+ }
223
+ }
224
+ ```
225
+
226
+ This enables:
227
+ - **IntelliSense**: TypeScript shows the `typography` property when you type in `defineEngineConfig`
228
+ - **Type Safety**: Invalid configuration shapes are caught at compile time
229
+ - **Documentation**: Hover over the property to see available options
230
+
208
231
  #### Available CSS Variables
209
232
 
210
233
  ```css
@@ -284,7 +307,7 @@ Using modular shortcuts can significantly reduce CSS bundle size:
284
307
 
285
308
  ## Documentation
286
309
 
287
- For complete documentation, visit: [PikaCSS Documentation](https://pikacss.dev)
310
+ For complete documentation, visit: [PikaCSS Documentation](https://pikacss.github.io/pikacss/)
288
311
 
289
312
  ## License
290
313
 
package/dist/index.cjs CHANGED
@@ -307,13 +307,17 @@ const proseTablesStyle = (0, _pikacss_core.defineStyleDefinition)({
307
307
 
308
308
  //#endregion
309
309
  //#region src/index.ts
310
- function typography(options = {}) {
310
+ function typography() {
311
+ let typographyConfig = {};
311
312
  return (0, _pikacss_core.defineEnginePlugin)({
312
313
  name: "typography",
314
+ configureRawConfig: (config) => {
315
+ if (config.typography) typographyConfig = config.typography;
316
+ },
313
317
  configureEngine: async (engine) => {
314
318
  engine.variables.add({
315
319
  ...typographyVariables,
316
- ...options.variables
320
+ ...typographyConfig.variables
317
321
  });
318
322
  engine.shortcuts.add(["prose-base", proseBaseStyle]);
319
323
  engine.shortcuts.add(["prose-paragraphs", ["prose-base", proseParagraphsStyle]]);
package/dist/index.d.cts CHANGED
@@ -34,6 +34,6 @@ declare module '@pikacss/core' {
34
34
  typography?: TypographyPluginOptions;
35
35
  }
36
36
  }
37
- declare function typography(options?: TypographyPluginOptions): EnginePlugin;
37
+ declare function typography(): EnginePlugin;
38
38
  //#endregion
39
39
  export { TypographyPluginOptions, typography };
package/dist/index.d.mts CHANGED
@@ -34,6 +34,6 @@ declare module '@pikacss/core' {
34
34
  typography?: TypographyPluginOptions;
35
35
  }
36
36
  }
37
- declare function typography(options?: TypographyPluginOptions): EnginePlugin;
37
+ declare function typography(): EnginePlugin;
38
38
  //#endregion
39
39
  export { TypographyPluginOptions, typography };
package/dist/index.mjs CHANGED
@@ -307,13 +307,17 @@ const proseTablesStyle = defineStyleDefinition({
307
307
 
308
308
  //#endregion
309
309
  //#region src/index.ts
310
- function typography(options = {}) {
310
+ function typography() {
311
+ let typographyConfig = {};
311
312
  return defineEnginePlugin({
312
313
  name: "typography",
314
+ configureRawConfig: (config) => {
315
+ if (config.typography) typographyConfig = config.typography;
316
+ },
313
317
  configureEngine: async (engine) => {
314
318
  engine.variables.add({
315
319
  ...typographyVariables,
316
- ...options.variables
320
+ ...typographyConfig.variables
317
321
  });
318
322
  engine.shortcuts.add(["prose-base", proseBaseStyle]);
319
323
  engine.shortcuts.add(["prose-paragraphs", ["prose-base", proseParagraphsStyle]]);
package/package.json CHANGED
@@ -4,16 +4,16 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.0.38",
7
+ "version": "0.0.40",
8
8
  "author": "DevilTea <ch19980814@gmail.com>",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/pikacss/pikacss.git",
12
+ "url": "https://github.com/pikacss/pikacss.github.io.git",
13
13
  "directory": "packages/plugin-typography"
14
14
  },
15
15
  "bugs": {
16
- "url": "https://github.com/pikacss/pikacss/issues"
16
+ "url": "https://github.com/pikacss/pikacss.github.io/issues"
17
17
  },
18
18
  "keywords": [
19
19
  "pikacss",
@@ -39,10 +39,10 @@
39
39
  "dist"
40
40
  ],
41
41
  "peerDependencies": {
42
- "@pikacss/core": "0.0.38"
42
+ "@pikacss/core": "0.0.40"
43
43
  },
44
44
  "devDependencies": {
45
- "@pikacss/core": "0.0.38"
45
+ "@pikacss/core": "0.0.40"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "tsdown",