Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add config slotsType #36

Merged
merged 1 commit into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 28 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ then in package.json
- [slots](#slots)
- [slotsName](#slotsname)
- [slotsDescription](#slotsdescription)
- [slotsType](#slotsType)
- [slotsSubtags](#slotssubtags)
- [directives](#directives)
- [directivesName](#directivesname)
Expand All @@ -89,7 +90,7 @@ then in package.json
- Required: `true`
- Type: `string`

entry path, refer: [fast-glob](https://github.com/mrmlnc/fast-glob#pattern-syntax)
Specify the entry directory. refer: [fast-glob](https://github.com/mrmlnc/fast-glob#pattern-syntax)

for example:
- `docs/*.md` -- matches all files in the docs
Expand All @@ -101,7 +102,7 @@ for example:
- Required: `true`
- Type: `string`

outDir path, For example `lib`
Specify the output directory. For example, `lib``

### name

Expand Down Expand Up @@ -203,119 +204,126 @@ name for web-types of the WebStorm
- Type: `string` (**This is a regular string and ignores case.**)
- Default: `props`

name of props table. **other string in the header will be identified as sub-component**
The title of the props table. **other string in the header will be identified as sub-component**

### propsName

- Type: `string`
- Default: `Name`

name for the props header name
The header name of the `Name` in the props table

### propsDescription

- Type: `string`
- Default: `Description`

name for props header description
The header name of the `Description` in the props table

### propsType

- Type: `string`
- Default: `Type`

name for props header type
The header name of the `Type` in the props table

### propsOptions

- Type: `string`
- Default: `Options`

name for props header options
The header name of the `Options` in the props table

### propsDefault

- Type: `string`
- Default: `Default`

name for props header default
The header name of the `Default` in the props table

### events

- Type: `string` (**This is a regular string and ignores case.**)
- Default: `events`

name of events table. **other string in the header will be identified as sub-component**
The title of the events table. **other string in the header will be identified as sub-component**

### eventsName

- Type: `string`
- Default: `Name`

name for the events header name
The header name of the `Name` in the events table

### eventsDescription

- Type: `string`
- Default: `Description`

name for events header description
The header name of the `Description` in the events table

### slots

- Type: `string` (**This is a regular string and ignores case.**)
- Default: `slots`

name of slots table. **other string in the header will be identified as sub-component**
The title of the slots table. **other string in the header will be identified as sub-component**

### slotsName

- Type: `string`
- Default: `Name`

name for the slots header name
The header name of the `Name` in the slots table

### slotsDescription

- Type: `string`
- Default: `Description`

name for slots header description
The header name of the `Description` in the slots table

### slotsType

- Type: `string`
- Default: `Type`

The header name of the `Type` in the slots table

### slotsSubtags

- Type: `string`
- Default: `Subtags`

name for slots header subtags
The header name of the `Subtags` in the slots table

### directives

- Type: `string` (**This is a regular string and ignores case.**)
- Default: `directives`

name of directives table. **other string in the header will be identified as sub-component**
The title of the directives table. **other string in the header will be identified as sub-component**

### directivesName

- Type: `string`
- Default: `Name`

name for the directives header name
The header name of the `Name` in the directives table

### directivesDescription

- Type: `string`
- Default: `Description`

name for directives header description
The header name of the `Description` in the directives table

### directivesType

- Type: `string`
- Default: `Type`

name for directives header type
The header name of the `Type` in the directives table

### titleRegExp

Expand Down Expand Up @@ -395,7 +403,7 @@ by default matches all tables, Optimize it through tableRegExp, For example:
/#+\s+(`.*\s*Props|.*\s*Events|.*\s*Slots|.*\s*Directives`)\n+(`\|?.+\|.+`)\n\|?\s*:?-+:?\s*\|.+(`(\n\|?.+\|.+)+`)/g

<div>
### <code>Props | Events | Slots | Directives</code>
### <code>Props / Events / Slots / Directives</code>
<div><code>| header |</code></div>
<div>| ------ |</div>
<div><code>| column |</code></div>
Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const config: Config = {
slots: 'slots',
slotsName: 'Name',
slotsDescription: 'Description',
slotsType: 'Type',
slotsSubtags: 'Subtags',
directives: 'directives',
directivesName: 'Name',
Expand Down
3 changes: 2 additions & 1 deletion src/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export interface Config {
slots: string
slotsName: string
slotsDescription: string
slotsType: string
slotsSubtags: string
directives: string
directivesName: string
Expand Down Expand Up @@ -244,7 +245,7 @@ export type NamePattern =
export type Required = boolean
export type NamePatternTemplate = [
string | NamePatternTemplate | NamePattern,
...(string | NamePatternTemplate | NamePattern)[]
...(string | NamePatternTemplate | NamePattern)[],
]
/**
* A reference to an element in Web-Types model.
Expand Down
2 changes: 2 additions & 0 deletions src/webTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function getWebTypes(options: Options, list: NormalizeData[]) {
eventsDescription,
slotsName,
slotsDescription,
slotsType,
directivesName,
directivesType,
directivesDescription,
Expand Down Expand Up @@ -142,6 +143,7 @@ export function getWebTypes(options: Options, list: NormalizeData[]) {
name: _item,
description: item[slotsDescription],
'doc-url': getDocUrl(options, fileName, slots?.title, path),
type: item[slotsType],
})
}
})
Expand Down
8 changes: 4 additions & 4 deletions test/demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ This is a description of the Demo component

## Slots

| Name | Description | Subtags |
| ---- | ----------- | ------- |
| default | customize button group content | DemoItem / DemoGroup |
| other | some other slots ||
| Name | Description | Type | Subtags |
| ---- | ----------- | ---- | ------- |
| default | customize button group content || DemoItem / DemoGroup |
| other | some other slots | { data: any } ||

## Directives

Expand Down