Skip to content

Commit

Permalink
Update theme docgen for new theme.json structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Lende committed Jan 5, 2022
1 parent 02e60d0 commit 396d9cf
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bin/api-docs/gen-theme-reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,15 @@ ${ markupFn( data ) }
let autogen = '';

// Settings
const settings = themejson.definitions.settingsProperties.properties;
const settings = Object.entries( themejson.definitions )
.filter( ( [ settingsKey ] ) =>
/^settingsProperties(?!Complete)\w+$/.test( settingsKey )
)
.reduce(
( settingsObj, [ , { properties } ] ) =>
Object.assign( settingsObj, properties ),
{}
);
const settingSections = keys( settings );
autogen += '## Settings' + '\n\n';
settingSections.forEach( ( section ) => {
Expand Down
95 changes: 95 additions & 0 deletions docs/reference-guides/theme-json-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,101 @@ This reference guide lists the settings and style properties defined in the them
<!-- START TOKEN Autogenerated - DO NOT EDIT -->
## Settings


### appearanceTools

Setting that enables the following UI tools:

- border: color, radius, style, width
- color: link
- spacing: blockGap, margin, padding
- typography: lineHeight


---

### border

Settings related to borders.

| Property | Type | Default | Props |
| --- | --- | --- |--- |
| color | boolean | false | |
| radius | boolean | false | |
| style | boolean | false | |
| width | boolean | false | |

---

### color

Settings related to colors.

| Property | Type | Default | Props |
| --- | --- | --- |--- |
| background | boolean | true | |
| custom | boolean | true | |
| customDuotone | boolean | true | |
| customGradient | boolean | true | |
| defaultGradients | boolean | true | |
| defaultPalette | boolean | true | |
| duotone | array | | colors, name, slug |
| gradients | array | | gradient, name, slug |
| link | boolean | false | |
| palette | array | | color, name, slug |
| text | boolean | true | |

---

### layout

Settings related to layout.

| Property | Type | Default | Props |
| --- | --- | --- |--- |
| contentSize | string | | |
| wideSize | string | | |

---

### spacing

Settings related to spacing.

| Property | Type | Default | Props |
| --- | --- | --- |--- |
| blockGap | undefined | null | |
| margin | boolean | false | |
| padding | boolean | false | |
| units | array | px,em,rem,vh,vw,% | |

---

### typography

Settings related to typography.

| Property | Type | Default | Props |
| --- | --- | --- |--- |
| customFontSize | boolean | true | |
| fontStyle | boolean | true | |
| fontWeight | boolean | true | |
| letterSpacing | boolean | true | |
| lineHeight | boolean | false | |
| textDecoration | boolean | true | |
| textTransform | boolean | true | |
| dropCap | boolean | true | |
| fontSizes | array | | name, size, slug |
| fontFamilies | array | | fontFamily, name, slug |

---

### custom

Generate custom CSS custom properties of the form `--wp--custom--{key}--{nested-key}: {value};`. `camelCased` keys are transformed to `kebab-case` as to follow the CSS property naming schema. Keys at different depth levels are separated by `--`, so keys should not include `--` in the name.


---
## Styles


Expand Down

0 comments on commit 396d9cf

Please sign in to comment.