Skip to content

Commit

Permalink
✨ feat(patch): support nested tailwindcss color groups (#1341)
Browse files Browse the repository at this point in the history
* ✨ feat(patch): add support for nested tailwindcss color groups
  • Loading branch information
kellymears committed Apr 26, 2022
1 parent 84707a9 commit b6868f0
Show file tree
Hide file tree
Showing 13 changed files with 321 additions and 300 deletions.
2 changes: 1 addition & 1 deletion sources/@roots/bud-preset-wordpress/src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export type StylesPropertiesAndElementsComplete = StylesProperties & {
elements?: StylesElementsPropertiesComplete
}

export interface JSONSchemaForWordPressBlockThemeGlobalSettingsAndStyles {
export interface GlobalSettingsAndStyles {
/**
* JSON schema URI for theme.json.
*/
Expand Down
6 changes: 3 additions & 3 deletions sources/@roots/sage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
".": "./lib/cjs/index.js",
"./client": "./lib/cjs/client/index.js",
"./client/dom-ready": "./lib/cjs/client/dom-ready.js",
"./theme/tailwind": "./lib/cjs/theme/tailwind.adapter.js",
"./theme": "./lib/cjs/theme/index.js",
"./stylelint-config": "./stylelint-config/index.js"
},
"typesVersions": {
Expand All @@ -62,8 +62,8 @@
"client/dom-ready": [
"./types/client/dom-ready.d.ts"
],
"theme/tailwind": [
"./types/theme/tailwind.adapter.d.ts"
"theme": [
"./types/theme/index.d.ts"
]
}
},
Expand Down
80 changes: 80 additions & 0 deletions sources/@roots/sage/src/env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import Sage from './extension'
import ThemeJSON from './theme/extension'

declare module '@roots/bud-framework' {
interface Bud {
/**
* Generate a WordPress `theme.json`
*
* @example
* Use default values:
*
* ```js
* app.themeJson()
* ```
*
* @example
* Set with an object:
*
* ```js
* app.themeJson({
* color: {
* palette: []
* }
* })
* ```
*
* @example
* Set with a callback. Callback supplies a container object.
*
* ```js
* app.themeJson(theme => {
* theme.set('color.palette', [])
* return theme
* })
* ```
*
* @example
* Set with a callback. Pass `true` as a second parameter to
* specify that you would like to use a raw object rather than
* a container.
*
* ```js
* app.themeJson(theme => ({
* ...theme,
* color: {
* palette: [],
* },
* }), true)
* ```
*
* @public
*/
themeJson: ThemeJSON['themeJson']

/**
* Use extended tailwind colors as theme.json colors
*
* @example
* app.useTailwindColors()
*
* @public
*/
useTailwindColors: ThemeJSON['useTailwindColors']
}

interface Locations {
'@resources': string
'@public': string
'@fonts': string
'@images': string
'@scripts': string
'@styles': string
'@views': string
}

interface Modules {
'@roots/sage': Sage
'wp-theme-json': ThemeJSON
}
}
85 changes: 1 addition & 84 deletions sources/@roots/sage/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,90 +10,7 @@
* @packageDocumentation
*/

import '@roots/bud-preset-wordpress'
import '@roots/bud-tailwindcss'

import * as themeJson from './theme/api/themeJson'
import * as useTailwindColors from './theme/api/useTailwindColors'
import ThemeJSON from './theme/extension'

declare module '@roots/bud-framework' {
interface Bud {
/**
* Generate a WordPress `theme.json`
*
* @example
* Use default values:
*
* ```js
* app.themeJson()
* ```
*
* @example
* Set with an object:
*
* ```js
* app.themeJson({
* color: {
* palette: []
* }
* })
* ```
*
* @example
* Set with a callback. Callback supplies a container object.
*
* ```js
* app.themeJson(theme => {
* theme.set('color.palette', [])
* return theme
* })
* ```
*
* @example
* Set with a callback. Pass `true` as a second parameter to
* specify that you would like to use a raw object rather than
* a container.
*
* ```js
* app.themeJson(theme => ({
* ...theme,
* color: {
* palette: [],
* },
* }), true)
* ```
*
* @public
*/
themeJson: themeJson.facade

/**
* Use extended tailwind colors as theme.json colors
*
* @example
* app.useTailwindColors()
*
* @public
*/
useTailwindColors: useTailwindColors.facade
}

interface Locations {
'@resources': string
'@public': string
'@fonts': string
'@images': string
'@scripts': string
'@styles': string
'@views': string
}

interface Modules {
'@roots/sage': Sage
'wp-theme-json': ThemeJSON
}
}
import './env'

import Sage from './extension'
export default Sage
Expand Down
58 changes: 0 additions & 58 deletions sources/@roots/sage/src/theme/api/themeJson.ts

This file was deleted.

31 changes: 0 additions & 31 deletions sources/@roots/sage/src/theme/api/useTailwindColors.ts

This file was deleted.

0 comments on commit b6868f0

Please sign in to comment.