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

Migrate blocks to block api v3 #551

Open
wants to merge 65 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
a34d3ef
Convert an old block to an FSE block as an experiment
jaymcp May 1, 2024
4ea4d6f
Begin block migration process
jaymcp May 21, 2024
543c971
Migrate to package imports
jaymcp Oct 18, 2024
fdcdcf2
Converts a number of class components on the post list block to funct…
Gentyspun Oct 22, 2024
60f711e
Fixes a number of broken imports
Gentyspun Oct 22, 2024
a3d94f9
Fixed renders for action block and cta block and removed cta from ins…
Gentyspun Oct 25, 2024
fe01857
Fixes view.js for background media and collapsable blocks, fixes edit…
Gentyspun Oct 29, 2024
7b88390
Enqueues a bunch of custom block styles so they use the new API version
Gentyspun Oct 31, 2024
bd7aeca
Removes old style files and imports for embed sutori and fluid iframe…
Gentyspun Nov 1, 2024
2a9496c
Fixes the new stat counter and tweet action blocks and removes the ol…
Gentyspun Nov 4, 2024
dd4e88f
Fixes the link group and download blocks and removes all their old ap…
Gentyspun Nov 6, 2024
6d5d65f
Fixes all the custom embed blocks to use the new block API V3, flouri…
Gentyspun Nov 7, 2024
1009dae
Fixes the hero block and the post list block, but post list still nee…
Gentyspun Nov 11, 2024
2acbcbc
remove imports
Gentyspun Nov 11, 2024
2a2b778
Imports a bunch of essential includes to prevent build failures and g…
Gentyspun Nov 12, 2024
6167b42
Removes console logs
Gentyspun Nov 12, 2024
c2da26d
Reorganise, fix some block rendering issues, introduce Custom Select …
jaymcp Nov 18, 2024
b4f32d7
Adds block props to a number of block edits
Gentyspun Nov 12, 2024
a0639b3
Enqueues menu styles and adds block props
Gentyspun Nov 12, 2024
4af2667
Removes menu block console log
Gentyspun Nov 12, 2024
abbc25b
Remove debug log
jaymcp Nov 18, 2024
8529458
Remove accidental debug statement
jaymcp Nov 18, 2024
d8349d0
Removes a bunch of outdated blocks and adds new api V3 versions, name…
Gentyspun Nov 19, 2024
3d2a266
Move sidebar helpers
jaymcp Nov 18, 2024
dba0126
Update asset enqueues
jaymcp Nov 18, 2024
b49bd39
Replace SSR blocks with real blocks & patterns
jaymcp Nov 18, 2024
9f55ae9
Removes all old block data related to responsive iframe and iframe bu…
Gentyspun Nov 22, 2024
48aa9c5
Updates the old banner and button blocks to API V3
Gentyspun Nov 25, 2024
b23f198
Updates regions block edit
Gentyspun Nov 26, 2024
f40a300
Fixup regions block API calls
jaymcp Nov 26, 2024
94024c6
Fixes all the regions block styles and removes the old versions
Gentyspun Nov 26, 2024
6120268
Updates the terms list block to API V3 and removes the old version
Gentyspun Nov 29, 2024
f5a21aa
Updates the deprecated columns block to API V3 and removes the old ve…
Gentyspun Nov 29, 2024
46187bb
Updated term list edit
Gentyspun Nov 29, 2024
f964486
Updates both the deprecated header and image blocks to the new API V3…
Gentyspun Dec 3, 2024
dcffb9e
Refactor Related Content
jaymcp Dec 3, 2024
9d7142c
Fix several issues with the Section block display component
jaymcp Dec 3, 2024
d3e0979
Updates the old deprecated LWI block to the new block API version
Gentyspun Dec 3, 2024
7661652
Removes old links with icons block from the inserter
Gentyspun Dec 4, 2024
8b3512b
Updates the links with icons block and the slider block to the new AP…
Gentyspun Dec 9, 2024
fd67dc9
Updates the slider block to the new API V3 and removes the old version
Gentyspun Dec 10, 2024
7deb360
Removes old slider and section blocks and replaces with new API versions
Gentyspun Dec 10, 2024
dbc148f
Converts the slider, key facts and related content blocks to the new …
Gentyspun Dec 11, 2024
f976fa7
Removes a bunch of now redundant blocks
Gentyspun Dec 12, 2024
959f229
Removes all the no longer needed block JS files
Gentyspun Dec 12, 2024
d508017
Converts the pop in block to the new API V3
Gentyspun Dec 17, 2024
7b13bdc
Initial refactoring pass
jaymcp Jan 22, 2025
8d04361
Move admin assets
jaymcp Jan 29, 2025
d8625cd
Move block style registration
jaymcp Jan 29, 2025
66c56a5
Move fonts and other static assets
jaymcp Feb 4, 2025
6178be0
Fix issues with fonts; register assets; move mods
jaymcp Feb 13, 2025
a447d82
Migrate remaining styles and rename directories
jaymcp Feb 27, 2025
69c1720
Migrate asset localisation
jaymcp Feb 27, 2025
cbffb6b
Fix linting
jaymcp Feb 27, 2025
a305a44
Fix linting
jaymcp Feb 27, 2025
d2d981c
Fix remaining linting issues
jaymcp Feb 27, 2025
4856302
Fix incorrect package manager in script
jaymcp Mar 4, 2025
42f5b08
Move some JS dependencies to dev-only
jaymcp Mar 4, 2025
629e43f
Update hero font sizes
jaymcp Mar 5, 2025
3b7c5f5
Update gitignore
jaymcp Mar 5, 2025
a02125e
Provide internationalisation settings to the stat counter block
jaymcp Mar 6, 2025
abc508b
Move WP dependencies in package.json
jaymcp Mar 6, 2025
652b670
Fix incorrect script name
jaymcp Mar 6, 2025
7e82be2
Fix incorrect SCSS declarations
jaymcp Mar 6, 2025
ebf2930
Fix missing script handle
jaymcp Mar 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
web.config
/db-config.php
/index.php
/private/.yarn
/private/node_modules
/readme.html
/wp-activate.php
Expand All @@ -22,6 +23,7 @@ web.config
/wp-content/backup-db/*
/wp-content/blogs.dir/*
/wp-content/cache/*
/wp-content/debug.log
/wp-content/index.php
/wp-content/languages/*
/wp-content/mu-plugins/*
Expand All @@ -30,6 +32,7 @@ web.config
/wp-content/themes/humanity-theme/assets/images/*
/wp-content/themes/humanity-theme/assets/scripts/*
/wp-content/themes/humanity-theme/assets/styles/*
/wp-content/themes/humanity-theme/build/*
/wp-content/themes/index.php
/wp-content/themes/twenty*
/wp-content/upgrade/*
Expand Down
1 change: 1 addition & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
<description>PHPCS linting rules for the Humanity Theme</description>
<config name="minimum_supported_wp_version" value="5.8" />
<rule ref="./vendor/bigbite/phpcs-config/BigBite" />
<exclude-pattern>./build/**/*.asset.php</exclude-pattern>
</ruleset>
4 changes: 2 additions & 2 deletions private/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
"prettier/prettier": ["error"],
"react/prop-types": "off",
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
"@wordpress/i18n-text-domain": ["error", { "allowedTextDomain": ["amnesty", "default"] }]
"@wordpress/i18n-text-domain": ["error", { "allowedTextDomain": ["amnesty", "default"]}]
},
"settings": {
"react": {
"version": "18.2.0"
"version": "18.3.1"
}
}
}
86 changes: 0 additions & 86 deletions private/.gitignore

This file was deleted.

5 changes: 4 additions & 1 deletion private/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"arrowParens": "always",
"endOfLine": "auto",
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all"
"trailingComma": "all",
"semi": true
}
4 changes: 2 additions & 2 deletions private/bin/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ trap error_out 1 2 3 6
# lint all the things
composer lint
cd ./private
yarn lint:scripts
yarn lint:styles
yarn lint:scss
yarn lint:js
cd ..

if which shfmt > /dev/null; then
Expand Down
128 changes: 59 additions & 69 deletions private/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,81 +6,71 @@
"license": "GPL-2.0-or-later",
"packageManager": "[email protected]",
"scripts": {
"build:dev": "webpack --mode development",
"build:prod": "webpack --mode production",
"build:static": "webpack --mode production --env static",
"build": "webpack --mode production",
"watch:dev": "webpack --mode development --watch",
"watch:prod": "webpack --mode production --watch",
"watch": "webpack --mode development --watch",
"lint:scripts": "eslint ./src/",
"lint:styles": "stylelint \"src/**/*.scss\"",
"lint": "yarn lint:scripts; yarn lint:styles",
"build": "wp-scripts build --webpack-copy-php --source-path=./src --output-path=../wp-content/themes/humanity-theme/build",
"watch": "wp-scripts start --webpack-copy-php --source-path=./src --output-path=../wp-content/themes/humanity-theme/build",
"lint": "yarn lint:scss; yarn lint:js",
"lint:scss": "stylelint ./src/**/*.scss",
"lint:js": "eslint ./src/**/*.(js|jsx)",
"env": "yarn dlx @wordpress/env"
},
"devDependencies": {
"@babel/cli": "^7.16.0",
"@babel/core": "^7.16.0",
"@babel/eslint-parser": "^7.16.3",
"@babel/plugin-proposal-pipeline-operator": "^7.16.0",
"@babel/plugin-transform-class-properties": "^7.23.3",
"@babel/plugin-transform-optional-chaining": "^7.23.4",
"@babel/preset-env": "^7.16.8",
"@babel/preset-react": "^7.16.7",
"@wordpress/eslint-plugin": "^17.4.0",
"@wordpress/i18n": "^4.2.4",
"autoprefixer": "^10.4.0",
"babel-loader": "^9.1.0",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.8.1",
"esbuild-loader": "^4.0.2",
"eslint": "^8.3.0",
"@babel/core": "^7.26.0",
"@babel/plugin-proposal-pipeline-operator": "^7.25.9",
"@playwright/test": "^1.49.1",
"@types/react": "^19.0.8",
"autoprefixer": "^10.4.20",
"eslint": "^8.2.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-webpack-plugin": "^4.0.1",
"expose-loader": "^4.0.0",
"file-loader": "^6.2.0",
"mini-css-extract-plugin": "^2.4.5",
"node-normalize-scss": "^8.1.2",
"postcss": "^8.4.32",
"postcss-banner": "^4.0.1",
"postcss-loader": "^7.0.1",
"postcss-pxtorem": "^6.0.0",
"postcss-reporter": "^7.0.4",
"postcss-scss": "^4.0.3",
"prettier": "^3.1.0",
"react": "^18",
"react-dom": "^18",
"resolve-url-loader": "^5.0.0",
"sass": "^1.62.1",
"sass-loader": "^13.2.2",
"sass-mq": "^6.0.0",
"style-loader": "^3.3.1",
"stylelint": "^15.11.0",
"stylelint-config-recommended-scss": "^13.1.0",
"stylelint-scss": "^5.3.1",
"stylelint-webpack-plugin": "^4.1.1",
"typescript": "^5.3.2",
"webpack": "^5.94.0",
"webpack-cli": "^5.0.0"
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.3",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-webpack-plugin": "^4.2.0",
"postcss": "^8.4.49",
"postcss-pxtorem": "^6.1.0",
"postcss-reporter": "^7.1.0",
"prettier": "^3.4.2",
"react": "18.3.1",
"react-dom": "18.3.1",
"sass": "^1.83.1",
"sass-loader": "^16.0.4",
"stylelint": "^16.12.0",
"stylelint-config-recommended-scss": "^14.1.0",
"stylelint-scss": "^6.10.0",
"stylelint-webpack-plugin": "^5.0.1",
"typescript": "^5.7.3",
"webpack": "^5.97.1",
"webpack-cli": "^6.0.1"
},
"dependencies": {
"@braintree/sanitize-url": "^7.0.1",
"classnames": "^2.3.1",
"core-js": "^3.19.1",
"css-vars-ponyfill": "^2.4.7",
"delegate": "^3.2.0",
"flickity": "^2.2.2",
"flickity-as-nav-for": "^2.0.1",
"intersection-observer": "^0.12.0",
"js-cookie": "^3.0.1",
"memize": "^1.1.0",
"object-fit-images": "^3.2.4",
"react-beautiful-dnd": "^13.1.0",
"react-select": "^5.7.2"
"@braintree/sanitize-url": "^7.1.1",
"@wordpress/api-fetch": "^7.15.1",
"@wordpress/block-editor": "^14.10.1",
"@wordpress/blocks": "^14.4.1",
"@wordpress/components": "^29.1.1",
"@wordpress/compose": "^7.15.1",
"@wordpress/core-data": "^7.15.1",
"@wordpress/data": "^10.15.1",
"@wordpress/dom": "^4.18.0",
"@wordpress/editor": "^14.15.1",
"@wordpress/element": "^6.15.1",
"@wordpress/eslint-plugin": "^22.2.0",
"@wordpress/hooks": "^4.15.0",
"@wordpress/i18n": "^5.15.1",
"@wordpress/plugins": "^7.17.0",
"@wordpress/scripts": "^30.8.1",
"@wordpress/server-side-render": "^5.15.1",
"@wordpress/url": "^4.15.0",
"classnames": "^2.5.1",
"core-js": "^3.40.0",
"flickity": "^3.0.0",
"flickity-as-nav-for": "^3.0.0",
"intersection-observer": "^0.12.2",
"js-cookie": "^3.0.5",
"lodash": "^4.17.21",
"memize": "^2.1.0",
"react-beautiful-dnd": "^13.1.1",
"react-select": "^5.9.0"
}
}
16 changes: 7 additions & 9 deletions private/postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ const autoprefixer = require('autoprefixer');
const pxtorem = require('postcss-pxtorem');
const reporter = require('postcss-reporter');

module.exports = {
plugins: [
autoprefixer(),
pxtorem({
prop_white_list: ['font', 'font-size', 'line-height', 'letter-spacing'],
}),
reporter({ clearMessages: true }),
],
};
module.exports = [
autoprefixer(),
pxtorem({
prop_white_list: ['font', 'font-size', 'line-height', 'letter-spacing'],
}),
reporter({ clearMessages: true }),
];
File renamed without changes.
12 changes: 12 additions & 0 deletions private/src/admin/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "amnesty-core/admin-assets",
"title": "Admin assets build",
"description": "This is a fake block to make wp-scripts build our admin assets",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"supports": {
"inserter": false
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { isFunction } = lodash;
const { applyFilters } = wp.hooks;
import { isFunction } from 'lodash';
import { applyFilters } from '@wordpress/hooks';

let globalChangeEvent;

Expand Down
31 changes: 31 additions & 0 deletions private/src/admin/cmb-font-options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
document.addEventListener('DOMContentLoaded', () => {
const form = document.getElementById('#cmb2-metabox-amnesty_font_options_page');

if (!form) {
return;
}

const initial = form.querySelector('.cmb2-option[name="font_load_type"]:checked').value;

const repaint = (selector, compare) => {
form.querySelectorAll(selector).forEach((el) => {
if (el.dataset.showFor.indexOf(compare) !== -1) {
// eslint-disable-next-line no-param-reassign
el.closest('.cmb-row').style.display = 'block';
} else {
// eslint-disable-next-line no-param-reassign
el.closest('.cmb-row').style.display = 'none';
}
});
};

repaint('[data-show-for]', initial);

form.addEventListener('click', (e) => {
if (!e.target.classList.contains('cmb2-options')) {
return;
}

repaint('[data-show-for]', e.target.value);
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { addFilter } = wp.hooks;
import { addFilter } from '@wordpress/hooks';

addFilter('amnesty.cmb2.change.type', 'amnesty/cmb2', () => (event, $form) => {
const type = event.target.value;
Expand Down
6 changes: 6 additions & 0 deletions private/src/admin/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import './index.scss';
import './cmb-events';
import './cmb-font-options';
import './cmb-term-type';
import './ordered-list-preview';
import './options-general';
12 changes: 12 additions & 0 deletions private/src/admin/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@use "cmb2";
@use "user-profile";
@use "localisation-options";

:root {
--amnesty-icon-path: url("../images/sprite.svg"), none;
--wp--preset--layout--contentSize: 1468px;
}

.is-hidden {
display: none;
}
Loading