@wordpress/global-styles-ui 1.15.1 → 1.16.0
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/CHANGELOG.md +2 -0
- package/build/block-preview-panel.cjs +2 -2
- package/build/block-preview-panel.cjs.map +2 -2
- package/build/font-library/font-collection.cjs +1 -1
- package/build/font-library/font-collection.cjs.map +2 -2
- package/build/font-library/lib/unbrotli.cjs +1 -1
- package/build/font-library/lib/unbrotli.cjs.map +2 -2
- package/build/hooks.cjs.map +1 -1
- package/build/screen-block-list.cjs +4 -2
- package/build/screen-block-list.cjs.map +2 -2
- package/build/screen-block.cjs +9 -9
- package/build/screen-block.cjs.map +2 -2
- package/build/screen-revisions/revisions-buttons.cjs +10 -3
- package/build/screen-revisions/revisions-buttons.cjs.map +3 -3
- package/build/utils.cjs +2 -2
- package/build/utils.cjs.map +2 -2
- package/build/variations/variation.cjs.map +2 -2
- package/build-module/block-preview-panel.mjs +2 -2
- package/build-module/block-preview-panel.mjs.map +2 -2
- package/build-module/font-library/font-collection.mjs +1 -1
- package/build-module/font-library/font-collection.mjs.map +2 -2
- package/build-module/font-library/lib/unbrotli.mjs +1 -1
- package/build-module/font-library/lib/unbrotli.mjs.map +2 -2
- package/build-module/hooks.mjs.map +1 -1
- package/build-module/screen-block-list.mjs +4 -2
- package/build-module/screen-block-list.mjs.map +2 -2
- package/build-module/screen-block.mjs +9 -9
- package/build-module/screen-block.mjs.map +2 -2
- package/build-module/screen-revisions/revisions-buttons.mjs +15 -4
- package/build-module/screen-revisions/revisions-buttons.mjs.map +2 -2
- package/build-module/utils.mjs +2 -2
- package/build-module/utils.mjs.map +2 -2
- package/build-module/variations/variation.mjs.map +2 -2
- package/build-style/style-rtl.css +4 -6
- package/build-style/style.css +4 -6
- package/build-types/hooks.d.ts +2 -2
- package/build-types/screen-block-list.d.ts.map +1 -1
- package/build-types/screen-revisions/revisions-buttons.d.ts.map +1 -1
- package/build-types/variations/variation.d.ts.map +1 -1
- package/package.json +25 -20
- package/src/block-preview-panel.tsx +2 -2
- package/src/hooks.ts +2 -2
- package/src/screen-block-list.tsx +3 -0
- package/src/screen-block.tsx +9 -9
- package/src/screen-revisions/revisions-buttons.tsx +14 -6
- package/src/screen-revisions/style.scss +4 -6
- package/src/utils.ts +2 -2
- package/src/variations/variation.tsx +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revisions-buttons.d.ts","sourceRoot":"","sources":["../../src/screen-revisions/revisions-buttons.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"revisions-buttons.d.ts","sourceRoot":"","sources":["../../src/screen-revisions/revisions-buttons.tsx"],"names":[],"mappings":"AAeA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AA+ExC,UAAU,oBAAoB;IAC7B,aAAa,EAAE,QAAQ,EAAE,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrC,QAAQ,EAAE,CAAE,QAAQ,EAAE,QAAQ,KAAM,IAAI,CAAC;IACzC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,iBAAS,gBAAgB,CAAE,EAC1B,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,EAAE,oBAAoB,+BAgJtB;eAEc,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variation.d.ts","sourceRoot":"","sources":["../../src/variations/variation.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"variation.d.ts","sourceRoot":"","sources":["../../src/variations/variation.tsx"],"names":[],"mappings":"AAqBA,UAAU,cAAc;IACvB,SAAS,EAAE,GAAG,CAAC;IACf,QAAQ,EAAE,CAAE,SAAS,EAAE,OAAO,KAAM,KAAK,CAAC,SAAS,CAAC;IACpD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,CAAE,EAClC,SAAS,EACT,QAAQ,EACR,MAAc,EACd,UAAU,EACV,WAAmB,EACnB,EAAE,cAAc,+BAiFhB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/global-styles-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "Global Styles UI components for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -43,24 +43,23 @@
|
|
|
43
43
|
"./build-style/": "./build-style/"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"@wordpress/
|
|
48
|
-
"@wordpress/
|
|
49
|
-
"@wordpress/
|
|
50
|
-
"@wordpress/
|
|
51
|
-
"@wordpress/
|
|
52
|
-
"@wordpress/
|
|
53
|
-
"@wordpress/
|
|
54
|
-
"@wordpress/
|
|
55
|
-
"@wordpress/
|
|
56
|
-
"@wordpress/
|
|
57
|
-
"@wordpress/
|
|
58
|
-
"@wordpress/
|
|
59
|
-
"@wordpress/
|
|
60
|
-
"@wordpress/
|
|
61
|
-
"@wordpress/
|
|
62
|
-
"@wordpress/
|
|
63
|
-
"@wordpress/ui": "^0.15.1",
|
|
46
|
+
"@wordpress/a11y": "^4.49.0",
|
|
47
|
+
"@wordpress/api-fetch": "^7.49.0",
|
|
48
|
+
"@wordpress/base-styles": "^10.1.0",
|
|
49
|
+
"@wordpress/block-editor": "^15.22.0",
|
|
50
|
+
"@wordpress/blocks": "^15.22.0",
|
|
51
|
+
"@wordpress/components": "^36.0.0",
|
|
52
|
+
"@wordpress/compose": "^8.2.0",
|
|
53
|
+
"@wordpress/core-data": "^7.49.0",
|
|
54
|
+
"@wordpress/data": "^10.49.0",
|
|
55
|
+
"@wordpress/date": "^5.49.0",
|
|
56
|
+
"@wordpress/element": "^8.1.0",
|
|
57
|
+
"@wordpress/global-styles-engine": "^1.16.0",
|
|
58
|
+
"@wordpress/i18n": "^6.22.0",
|
|
59
|
+
"@wordpress/icons": "^15.0.0",
|
|
60
|
+
"@wordpress/keycodes": "^4.49.0",
|
|
61
|
+
"@wordpress/private-apis": "^1.49.0",
|
|
62
|
+
"@wordpress/ui": "^0.16.0",
|
|
64
63
|
"change-case": "^4.1.2",
|
|
65
64
|
"clsx": "^2.1.1",
|
|
66
65
|
"colord": "^2.9.3"
|
|
@@ -70,11 +69,17 @@
|
|
|
70
69
|
"@testing-library/react": "^16.3.2"
|
|
71
70
|
},
|
|
72
71
|
"peerDependencies": {
|
|
72
|
+
"@types/react": "^18.3.27",
|
|
73
73
|
"react": "^18.0.0",
|
|
74
74
|
"react-dom": "^18.0.0"
|
|
75
75
|
},
|
|
76
|
+
"peerDependenciesMeta": {
|
|
77
|
+
"@types/react": {
|
|
78
|
+
"optional": true
|
|
79
|
+
}
|
|
80
|
+
},
|
|
76
81
|
"publishConfig": {
|
|
77
82
|
"access": "public"
|
|
78
83
|
},
|
|
79
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "0e7112a4f4fde4ea15bd9060489b8f6fe11eb6ca"
|
|
80
85
|
}
|
|
@@ -24,8 +24,8 @@ interface BlockPreviewPanelProps {
|
|
|
24
24
|
// Keep in sync with responsive breakpoint media queries in the global styles engine.
|
|
25
25
|
const PREVIEW_WIDTH_BY_VIEWPORT: Record< string, number > = {
|
|
26
26
|
default: 783,
|
|
27
|
-
tablet: 600,
|
|
28
|
-
mobile: 480,
|
|
27
|
+
'@tablet': 600,
|
|
28
|
+
'@mobile': 480,
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
const BlockPreviewPanel = ( {
|
package/src/hooks.ts
CHANGED
|
@@ -36,8 +36,8 @@ extend( [ a11yPlugin ] );
|
|
|
36
36
|
* @param blockName The name of the block, if applicable.
|
|
37
37
|
* @param readFrom Which source to read from: "base" (theme), "user" (customizations), or "merged" (final result).
|
|
38
38
|
* @param shouldDecodeEncode Whether to decode and encode the style value.
|
|
39
|
-
* @param state Optional style state path. Supports viewport states (e.g.
|
|
40
|
-
* pseudo-selector states (e.g. `:hover`) or both (e.g.
|
|
39
|
+
* @param state Optional style state path. Supports viewport states (e.g. `@mobile`),
|
|
40
|
+
* pseudo-selector states (e.g. `:hover`) or both (e.g. `@mobile.:hover`).
|
|
41
41
|
* Pseudo selectors are always read/written as nested keys.
|
|
42
42
|
* @return An array containing the style value and a function to set the style
|
|
43
43
|
* value.
|
|
@@ -40,6 +40,7 @@ const {
|
|
|
40
40
|
useHasBorderPanel,
|
|
41
41
|
useSettingsForBlockElement,
|
|
42
42
|
useHasColorPanel,
|
|
43
|
+
useHasBackgroundPanel,
|
|
43
44
|
} = unlock( blockEditorPrivateApis );
|
|
44
45
|
|
|
45
46
|
function useSortedBlockTypes() {
|
|
@@ -70,6 +71,7 @@ export function useBlockHasGlobalStyles( blockName: string ) {
|
|
|
70
71
|
const settings = useSettingsForBlockElement( rawSettings, blockName );
|
|
71
72
|
const hasTypographyPanel = useHasTypographyPanel( settings );
|
|
72
73
|
const hasColorPanel = useHasColorPanel( settings );
|
|
74
|
+
const hasBackgroundPanel = useHasBackgroundPanel( settings );
|
|
73
75
|
const hasBorderPanel = useHasBorderPanel( settings );
|
|
74
76
|
const hasDimensionsPanel = useHasDimensionsPanel( settings );
|
|
75
77
|
const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
|
|
@@ -77,6 +79,7 @@ export function useBlockHasGlobalStyles( blockName: string ) {
|
|
|
77
79
|
const hasGlobalStyles =
|
|
78
80
|
hasTypographyPanel ||
|
|
79
81
|
hasColorPanel ||
|
|
82
|
+
hasBackgroundPanel ||
|
|
80
83
|
hasLayoutPanel ||
|
|
81
84
|
hasVariationsPanel;
|
|
82
85
|
return hasGlobalStyles;
|
package/src/screen-block.tsx
CHANGED
|
@@ -275,7 +275,7 @@ function ScreenBlock( { name, variation }: ScreenBlockProps ) {
|
|
|
275
275
|
// If there are settings changes, we need to update both styles and
|
|
276
276
|
// settings atomically to avoid race conditions.
|
|
277
277
|
if ( newSettings?.typography ) {
|
|
278
|
-
// Build the state-aware path so that viewport styles (e.g. mobile)
|
|
278
|
+
// Build the state-aware path so that viewport styles (e.g. @mobile)
|
|
279
279
|
// are written to the correct sub-path and do not overwrite the default.
|
|
280
280
|
const stylePathForState = [ prefix, stateParam ]
|
|
281
281
|
.filter( Boolean )
|
|
@@ -364,14 +364,6 @@ function ScreenBlock( { name, variation }: ScreenBlockProps ) {
|
|
|
364
364
|
</VStack>
|
|
365
365
|
</div>
|
|
366
366
|
) }
|
|
367
|
-
{ hasColorPanel && (
|
|
368
|
-
<StylesColorPanel
|
|
369
|
-
inheritedValue={ inheritedStyle }
|
|
370
|
-
value={ style }
|
|
371
|
-
onChange={ setStyle }
|
|
372
|
-
settings={ settings }
|
|
373
|
-
/>
|
|
374
|
-
) }
|
|
375
367
|
{ hasBackgroundPanel && (
|
|
376
368
|
<StylesBackgroundPanel
|
|
377
369
|
inheritedValue={ inheritedStyle }
|
|
@@ -419,6 +411,14 @@ function ScreenBlock( { name, variation }: ScreenBlockProps ) {
|
|
|
419
411
|
includeLayoutControls
|
|
420
412
|
/>
|
|
421
413
|
) }
|
|
414
|
+
{ hasColorPanel && (
|
|
415
|
+
<StylesColorPanel
|
|
416
|
+
inheritedValue={ inheritedStyle }
|
|
417
|
+
value={ style }
|
|
418
|
+
onChange={ setStyle }
|
|
419
|
+
settings={ settings }
|
|
420
|
+
/>
|
|
421
|
+
) }
|
|
422
422
|
{ hasImageSettingsPanel && ! hasSelectedState && (
|
|
423
423
|
<ImageSettingsPanel
|
|
424
424
|
onChange={ onChangeLightbox }
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __, sprintf } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
Button,
|
|
7
|
+
Composite,
|
|
8
|
+
privateApis as componentsPrivateApis,
|
|
9
|
+
} from '@wordpress/components';
|
|
6
10
|
import { dateI18n, getDate, humanTimeDiff, getSettings } from '@wordpress/date';
|
|
7
11
|
import { store as coreStore } from '@wordpress/core-data';
|
|
8
12
|
import { useSelect } from '@wordpress/data';
|
|
@@ -13,6 +17,9 @@ import { ENTER, SPACE } from '@wordpress/keycodes';
|
|
|
13
17
|
* Internal dependencies
|
|
14
18
|
*/
|
|
15
19
|
import type { Revision } from './types';
|
|
20
|
+
import { unlock } from '../lock-unlock';
|
|
21
|
+
|
|
22
|
+
const { Badge: WCBadge } = unlock( componentsPrivateApis );
|
|
16
23
|
|
|
17
24
|
const DAY_IN_MILLISECONDS = 60 * 60 * 1000 * 24;
|
|
18
25
|
|
|
@@ -229,11 +236,12 @@ function RevisionsButtons( {
|
|
|
229
236
|
</span>
|
|
230
237
|
{ isSelected &&
|
|
231
238
|
( areStylesEqual ? (
|
|
232
|
-
<
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
239
|
+
<WCBadge
|
|
240
|
+
className="global-styles-ui-screen-revisions__active-badge"
|
|
241
|
+
intent="info"
|
|
242
|
+
>
|
|
243
|
+
{ __( 'Active' ) }
|
|
244
|
+
</WCBadge>
|
|
237
245
|
) : (
|
|
238
246
|
<Button
|
|
239
247
|
size="compact"
|
|
@@ -70,8 +70,7 @@
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
.global-styles-ui-screen-revisions__changes > li,
|
|
73
|
-
.global-styles-ui-screen-revisions__meta
|
|
74
|
-
.global-styles-ui-screen-revisions__applied-text {
|
|
73
|
+
.global-styles-ui-screen-revisions__meta {
|
|
75
74
|
color: $gray-900;
|
|
76
75
|
}
|
|
77
76
|
}
|
|
@@ -98,15 +97,14 @@
|
|
|
98
97
|
}
|
|
99
98
|
|
|
100
99
|
.global-styles-ui-screen-revisions__apply-button.is-primary,
|
|
101
|
-
.global-styles-ui-screen-
|
|
100
|
+
.global-styles-ui-screen-revisions__active-badge {
|
|
102
101
|
align-self: flex-start;
|
|
103
102
|
// Left margin = left padding of .global-styles-ui-screen-revisions__revision-item-wrapper.
|
|
104
|
-
margin:
|
|
103
|
+
margin: 0 $grid-unit-15 $grid-unit-15 $grid-unit-50;
|
|
105
104
|
}
|
|
106
105
|
|
|
107
106
|
.global-styles-ui-screen-revisions__changes,
|
|
108
|
-
.global-styles-ui-screen-revisions__meta
|
|
109
|
-
.global-styles-ui-screen-revisions__applied-text {
|
|
107
|
+
.global-styles-ui-screen-revisions__meta {
|
|
110
108
|
color: $gray-700;
|
|
111
109
|
font-size: 12px;
|
|
112
110
|
}
|
package/src/utils.ts
CHANGED
|
@@ -56,8 +56,8 @@ export const VALID_BLOCK_STATES: Record< string, StateDefinition[] > = {
|
|
|
56
56
|
* These map to CSS media queries wrapping the block's styles.
|
|
57
57
|
*/
|
|
58
58
|
export const RESPONSIVE_STATES: StateDefinition[] = [
|
|
59
|
-
{ value: 'tablet', label: __( 'Tablet' ) },
|
|
60
|
-
{ value: 'mobile', label: __( 'Mobile' ) },
|
|
59
|
+
{ value: '@tablet', label: __( 'Tablet' ) },
|
|
60
|
+
{ value: '@mobile', label: __( 'Mobile' ) },
|
|
61
61
|
];
|
|
62
62
|
|
|
63
63
|
/**
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
areGlobalStylesEqual,
|
|
11
11
|
mergeGlobalStyles,
|
|
12
12
|
} from '@wordpress/global-styles-engine';
|
|
13
|
-
// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.
|
|
14
13
|
import { Tooltip } from '@wordpress/ui';
|
|
15
14
|
|
|
16
15
|
/**
|