Skip to content

Commit 479ebb4

Browse files
Merge branch 'trunk' into add/wp-ai-client
2 parents 7e30d97 + 81885a9 commit 479ebb4

File tree

74 files changed

+2015
-481
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+2015
-481
lines changed

.github/pull_request_template.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,18 @@ If this is your first time contributing, you may also find reviewing these guide
1212
- Inline Documentation Standards: https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/
1313
- Browser Support Policies: https://make.wordpress.org/core/handbook/best-practices/browser-support/
1414
- Proper spelling and grammar related best practices: https://make.wordpress.org/core/handbook/best-practices/spelling/
15+
- ✨ If you are using AI tools, you must adhere to the AI Guidelines: https://make.wordpress.org/ai/handbook/ai-guidelines/
1516
-->
1617

1718
<!-- Insert a description of your changes here -->
1819

1920
Trac ticket: <!-- insert a link to the WordPress Trac ticket here -->
2021

22+
## Use of AI Tools
23+
24+
<!--
25+
You are free to use artificial intelligence (AI) tooling to contribute, but you must disclose what tooling you are using and to what extent a pull request has been authored by AI. It is your responsibility to review and take responsibility for what AI generates. See the WordPress AI Guidelines: <https://make.wordpress.org/ai/handbook/ai-guidelines/>.
26+
-->
27+
2128
---
2229
**This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See [GitHub Pull Requests for Code Review](https://make.wordpress.org/core/handbook/contribute/git/github-pull-requests-for-code-review/) in the Core Handbook for more details.**

package-lock.json

Lines changed: 22 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://develop.svn.wordpress.org/trunk"
88
},
99
"gutenberg": {
10-
"ref": "7bf80ea84eb8b62eceb1bb3fe82e42163673ca79"
10+
"ref": "59a08c5496008ca88f4b6b86f38838c3612d88c8"
1111
},
1212
"engines": {
1313
"node": ">=20.10.0",
@@ -30,6 +30,7 @@
3030
"@lodder/grunt-postcss": "^3.1.1",
3131
"@playwright/test": "1.56.1",
3232
"@pmmmwh/react-refresh-webpack-plugin": "0.6.1",
33+
"@types/codemirror": "5.60.17",
3334
"@wordpress/e2e-test-utils-playwright": "1.33.2",
3435
"@wordpress/prettier-config": "4.33.1",
3536
"@wordpress/scripts": "30.26.2",
@@ -79,6 +80,7 @@
7980
"core-js-url-browser": "3.6.4",
8081
"csslint": "1.0.5",
8182
"element-closest": "3.0.2",
83+
"espree": "9.6.1",
8284
"esprima": "4.0.1",
8385
"formdata-polyfill": "4.0.10",
8486
"hoverintent": "2.2.1",
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/**
2+
* CodeMirror JavaScript linter.
3+
*
4+
* @since 7.0.0
5+
*/
6+
7+
import CodeMirror from 'codemirror';
8+
9+
/**
10+
* CodeMirror Lint Error.
11+
*
12+
* @see https://codemirror.net/5/doc/manual.html#addon_lint
13+
*
14+
* @typedef {Object} CodeMirrorLintError
15+
* @property {string} message - Error message.
16+
* @property {'error'} severity - Severity.
17+
* @property {CodeMirror.Position} from - From position.
18+
* @property {CodeMirror.Position} to - To position.
19+
*/
20+
21+
/**
22+
* JSHint options supported by Espree.
23+
*
24+
* @see https://jshint.com/docs/options/
25+
* @see https://www.npmjs.com/package/espree#options
26+
*
27+
* @typedef {Object} SupportedJSHintOptions
28+
* @property {number} [esversion] - "This option is used to specify the ECMAScript version to which the code must adhere."
29+
* @property {boolean} [es5] - "This option enables syntax first defined in the ECMAScript 5.1 specification. This includes allowing reserved keywords as object properties."
30+
* @property {boolean} [es3] - "This option tells JSHint that your code needs to adhere to ECMAScript 3 specification. Use this option if you need your program to be executable in older browsers—such as Internet Explorer 6/7/8/9—and other legacy JavaScript environments."
31+
* @property {boolean} [module] - "This option informs JSHint that the input code describes an ECMAScript 6 module. All module code is interpreted as strict mode code."
32+
* @property {'implied'} [strict] - "This option requires the code to run in ECMAScript 5's strict mode."
33+
*/
34+
35+
/**
36+
* Validates JavaScript.
37+
*
38+
* @since 7.0.0
39+
*
40+
* @param {string} text - Source.
41+
* @param {SupportedJSHintOptions} options - Linting options.
42+
* @returns {Promise<CodeMirrorLintError[]>}
43+
*/
44+
async function validator( text, options ) {
45+
const errors = /** @type {CodeMirrorLintError[]} */ [];
46+
try {
47+
const espree = await import( /* webpackIgnore: true */ 'espree' );
48+
espree.parse( text, {
49+
...getEspreeOptions( options ),
50+
loc: true,
51+
} );
52+
} catch ( error ) {
53+
if (
54+
// This is an `EnhancedSyntaxError` in Espree: <https://github.com/brettz9/espree/blob/3c1120280b24f4a5e4c3125305b072fa0dfca22b/packages/espree/lib/espree.js#L48-L54>.
55+
error instanceof SyntaxError &&
56+
typeof error.lineNumber === 'number' &&
57+
typeof error.column === 'number'
58+
) {
59+
const line = error.lineNumber - 1;
60+
errors.push( {
61+
message: error.message,
62+
severity: 'error',
63+
from: CodeMirror.Pos( line, error.column - 1 ),
64+
to: CodeMirror.Pos( line, error.column ),
65+
} );
66+
} else {
67+
console.warn( '[CodeMirror] Unable to lint JavaScript:', error ); // jshint ignore:line
68+
}
69+
}
70+
71+
return errors;
72+
}
73+
74+
CodeMirror.registerHelper( 'lint', 'javascript', validator );
75+
76+
/**
77+
* Gets the options for Espree from the supported JSHint options.
78+
*
79+
* @since 7.0.0
80+
*
81+
* @param {SupportedJSHintOptions} options - Linting options for JSHint.
82+
* @return {{
83+
* ecmaVersion?: number|'latest',
84+
* ecmaFeatures?: {
85+
* impliedStrict?: true
86+
* }
87+
* }}
88+
*/
89+
function getEspreeOptions( options ) {
90+
const ecmaFeatures = {};
91+
if ( options.strict === 'implied' ) {
92+
ecmaFeatures.impliedStrict = true;
93+
}
94+
95+
return {
96+
ecmaVersion: getEcmaVersion( options ),
97+
sourceType: options.module ? 'module' : 'script',
98+
ecmaFeatures,
99+
};
100+
}
101+
102+
/**
103+
* Gets the ECMAScript version.
104+
*
105+
* @since 7.0.0
106+
*
107+
* @param {SupportedJSHintOptions} options - Options.
108+
* @return {number|'latest'} ECMAScript version.
109+
*/
110+
function getEcmaVersion( options ) {
111+
if ( typeof options.esversion === 'number' ) {
112+
return options.esversion;
113+
}
114+
if ( options.es5 ) {
115+
return 5;
116+
}
117+
if ( options.es3 ) {
118+
return 3;
119+
}
120+
return 'latest';
121+
}

src/wp-admin/css/common.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
.screen-reader-text + .dashicons-external {
140140
margin-top: -1px;
141141
margin-left: 2px;
142+
text-decoration: none;
142143
}
143144

144145
.screen-reader-shortcut {

src/wp-admin/css/themes.css

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,9 +1086,7 @@ body.folded .theme-browser ~ .theme-overlay .theme-wrap {
10861086

10871087
.upload-theme .wp-upload-form,
10881088
.upload-plugin .wp-upload-form {
1089-
background: #f6f7f7;
1090-
border: 1px solid #c3c4c7;
1091-
padding: 30px;
1089+
position: relative;
10921090
margin: 30px auto;
10931091
display: inline-flex;
10941092
justify-content: space-between;
@@ -1097,7 +1095,16 @@ body.folded .theme-browser ~ .theme-overlay .theme-wrap {
10971095

10981096
.upload-theme .wp-upload-form input[type="file"],
10991097
.upload-plugin .wp-upload-form input[type="file"] {
1100-
margin-right: 10px;
1098+
background: #f6f7f7;
1099+
border: 1px solid #c3c4c7;
1100+
margin: 0;
1101+
padding: 30px 128px 30px 30px;
1102+
}
1103+
1104+
.upload-plugin .wp-upload-form input[type=submit],
1105+
.upload-theme .wp-upload-form input[type=submit] {
1106+
position: absolute;
1107+
right: 30px;
11011108
}
11021109

11031110
.upload-theme .install-help,
@@ -1131,6 +1138,7 @@ p.no-themes-local {
11311138
}
11321139

11331140
@media only screen and (max-width: 1120px) {
1141+
.upload-plugin .wp-upload-form,
11341142
.upload-theme .wp-upload-form {
11351143
margin: 20px 0;
11361144
max-width: 100%;
@@ -2015,12 +2023,22 @@ body.full-overlay-active {
20152023
padding-bottom: 4px;
20162024
}
20172025

2018-
.upload-theme .wp-upload-form,
2019-
.upload-plugin .wp-upload-form {
2020-
display: block;
2026+
.upload-plugin .wp-upload-form,
2027+
.upload-theme .wp-upload-form {
2028+
width: 100%;
20212029
}
20222030

2023-
:is(.upload-theme, .upload-plugin) .wp-upload-form input[type="submit"] {
2024-
margin-top: 10px;
2031+
.upload-plugin .wp-upload-form input[type=file],
2032+
.upload-theme .wp-upload-form input[type=file] {
2033+
padding: 30px 30px 80px;
2034+
width: 100%;
2035+
}
2036+
2037+
:is(.upload-theme, .upload-plugin) .wp-upload-form input[type="submit"].button {
2038+
right: unset;
2039+
left: 50%;
2040+
transform: translateX(-50%) !important;
2041+
top: calc( 1.4em + 42px ); /* Line height of control + gap + top padding. */
2042+
margin: 10px 0 0;
20252043
}
20262044
}

0 commit comments

Comments
 (0)