From 3516c4d8dbe6a97af790229de1c92a8e3b730b08 Mon Sep 17 00:00:00 2001 From: TommusRhodus Date: Tue, 16 Jul 2024 15:00:12 +0100 Subject: [PATCH] Updates namespacing from wpsp to wpcomsp --- .phpcs.xml | 4 ++-- .utilities/class-wpsp-blocks-self-update.php | 6 ++--- composer.json | 2 +- dynamic-table-of-contents/build/block.json | 2 +- dynamic-table-of-contents/build/index.js | 2 +- dynamic-table-of-contents/build/render.php | 4 ++-- .../build/style-index.css | 2 +- dynamic-table-of-contents/build/view.js | 2 +- .../classes/class-wpsp-blocks-self-update.php | 6 ++--- .../dynamic-table-of-contents.php | 22 +++++++++---------- dynamic-table-of-contents/src/block.json | 2 +- dynamic-table-of-contents/src/render.php | 4 ++-- dynamic-table-of-contents/src/style.scss | 2 +- dynamic-table-of-contents/src/view.js | 6 ++--- hello-world/build/block.json | 2 +- hello-world/build/index.css | 2 +- hello-world/build/index.js | 2 +- hello-world/build/style-index.css | 2 +- hello-world/build/view.js | 2 +- .../classes/class-wpsp-blocks-self-update.php | 6 ++--- hello-world/hello-world.php | 14 ++++++------ hello-world/src/block.json | 2 +- hello-world/src/editor.scss | 2 +- hello-world/src/style.scss | 2 +- hello-world/src/view.js | 2 +- readme.md | 11 ++++------ sibling-pages-list/build/block.json | 2 +- sibling-pages-list/build/index.js | 2 +- .../classes/class-wpsp-blocks-self-update.php | 6 ++--- sibling-pages-list/sibling-pages-list.php | 18 +++++++-------- sibling-pages-list/src/block.json | 2 +- sibling-pages-list/src/style.scss | 2 +- special-projects-blocks-monorepo.php | 6 ++--- 33 files changed, 75 insertions(+), 78 deletions(-) diff --git a/.phpcs.xml b/.phpcs.xml index 8ba861e..2603af2 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -1,6 +1,6 @@ - - Custom ruleset for wpsp blocks monorepo + + Custom ruleset for wpcomsp blocks monorepo diff --git a/.utilities/class-wpsp-blocks-self-update.php b/.utilities/class-wpsp-blocks-self-update.php index 05df386..3b8ae31 100644 --- a/.utilities/class-wpsp-blocks-self-update.php +++ b/.utilities/class-wpsp-blocks-self-update.php @@ -3,21 +3,21 @@ * Plugin Autoupdate Filter Self Update class. * sets up autoupdates for this GitHub-hosted plugin. * - * @package wpsp + * @package wpcomsp */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } -class WPSP_Blocks_Self_Update { +class WPCOMSP_Blocks_Self_Update { public static $instance; /** * Get instance of this class. * - * @return WPSP_Blocks_Self_Update + * @return WPCOMSP_Blocks_Self_Update */ public static function get_instance() { if ( ! self::$instance ) { diff --git a/composer.json b/composer.json index d78beca..87d2dfe 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "a8cteam51/wpsp", + "name": "a8cteam51/wpcomsp", "type": "wordpress-project", "description": "", diff --git a/dynamic-table-of-contents/build/block.json b/dynamic-table-of-contents/build/block.json index 203c2b4..2de0393 100644 --- a/dynamic-table-of-contents/build/block.json +++ b/dynamic-table-of-contents/build/block.json @@ -1,7 +1,7 @@ { "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, - "name": "wpsp/dynamic-table-of-contents", + "name": "wpcomsp/dynamic-table-of-contents", "version": "0.1.9", "title": "Dynamic Table of Contents", "category": "design", diff --git a/dynamic-table-of-contents/build/index.js b/dynamic-table-of-contents/build/index.js index 42b785f..8601144 100644 --- a/dynamic-table-of-contents/build/index.js +++ b/dynamic-table-of-contents/build/index.js @@ -1 +1 @@ -(()=>{"use strict";var e,t={414:()=>{const e=window.React,t=window.wp.blocks,a=window.wp.i18n,n=window.wp.blockEditor,l=JSON.parse('{"u2":"wpsp/dynamic-table-of-contents"}'),r=(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false"},(0,e.createElement)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M20 9.484h-8.889v-1.5H20v1.5Zm0 7h-4.889v-1.5H20v1.5Zm-14 .032a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 1a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"}),(0,e.createElement)("path",{d:"M13 15.516a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM8 8.484a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z"}));(0,t.registerBlockType)(l.u2,{edit:function({attributes:t,setAttributes:l}){return(0,e.createElement)("div",{...(0,n.useBlockProps)()},(0,e.createElement)(n.RichText,{tagName:"h2",placeholder:(0,a.__)("Table of Contents Title","dynamic-table-of-contents"),value:t.title,onChange:e=>l({title:e}),className:"table-of-contents-title"}),(0,e.createElement)("ul",{className:"table-of-contents-list"},(0,e.createElement)("li",{className:"table-of-contents-list-item"},(0,e.createElement)("a",{href:"#",className:"active"},"This is an example.")),(0,e.createElement)("li",{className:"table-of-contents-list-item"},(0,e.createElement)("a",{href:"#"},"Of the block appearance.")),(0,e.createElement)("li",{className:"table-of-contents-list-item"},(0,e.createElement)("a",{href:"#"},"When used in your post."))))},icon:r})}},a={};function n(e){var l=a[e];if(void 0!==l)return l.exports;var r=a[e]={exports:{}};return t[e](r,r.exports,n),r.exports}n.m=t,e=[],n.O=(t,a,l,r)=>{if(!a){var o=1/0;for(m=0;m=r)&&Object.keys(n.O).every((e=>n.O[e](a[s])))?a.splice(s--,1):(i=!1,r0&&e[m-1][2]>r;m--)e[m]=e[m-1];e[m]=[a,l,r]},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={826:0,431:0};n.O.j=t=>0===e[t];var t=(t,a)=>{var l,r,[o,i,s]=a,c=0;if(o.some((t=>0!==e[t]))){for(l in i)n.o(i,l)&&(n.m[l]=i[l]);if(s)var m=s(n)}for(t&&t(a);cn(414)));l=n.O(l)})(); \ No newline at end of file +(()=>{"use strict";var e,t={414:()=>{const e=window.React,t=window.wp.blocks,a=window.wp.i18n,n=window.wp.blockEditor,l=JSON.parse('{"u2":"wpcomsp/dynamic-table-of-contents"}'),r=(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false"},(0,e.createElement)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M20 9.484h-8.889v-1.5H20v1.5Zm0 7h-4.889v-1.5H20v1.5Zm-14 .032a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 1a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"}),(0,e.createElement)("path",{d:"M13 15.516a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM8 8.484a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z"}));(0,t.registerBlockType)(l.u2,{edit:function({attributes:t,setAttributes:l}){return(0,e.createElement)("div",{...(0,n.useBlockProps)()},(0,e.createElement)(n.RichText,{tagName:"h2",placeholder:(0,a.__)("Table of Contents Title","dynamic-table-of-contents"),value:t.title,onChange:e=>l({title:e}),className:"table-of-contents-title"}),(0,e.createElement)("ul",{className:"table-of-contents-list"},(0,e.createElement)("li",{className:"table-of-contents-list-item"},(0,e.createElement)("a",{href:"#",className:"active"},"This is an example.")),(0,e.createElement)("li",{className:"table-of-contents-list-item"},(0,e.createElement)("a",{href:"#"},"Of the block appearance.")),(0,e.createElement)("li",{className:"table-of-contents-list-item"},(0,e.createElement)("a",{href:"#"},"When used in your post."))))},icon:r})}},a={};function n(e){var l=a[e];if(void 0!==l)return l.exports;var r=a[e]={exports:{}};return t[e](r,r.exports,n),r.exports}n.m=t,e=[],n.O=(t,a,l,r)=>{if(!a){var o=1/0;for(m=0;m=r)&&Object.keys(n.O).every((e=>n.O[e](a[s])))?a.splice(s--,1):(i=!1,r0&&e[m-1][2]>r;m--)e[m]=e[m-1];e[m]=[a,l,r]},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={826:0,431:0};n.O.j=t=>0===e[t];var t=(t,a)=>{var l,r,[o,i,s]=a,c=0;if(o.some((t=>0!==e[t]))){for(l in i)n.o(i,l)&&(n.m[l]=i[l]);if(s)var m=s(n)}for(t&&t(a);cn(414)));l=n.O(l)})(); \ No newline at end of file diff --git a/dynamic-table-of-contents/build/render.php b/dynamic-table-of-contents/build/render.php index cf7dd90..d32162c 100644 --- a/dynamic-table-of-contents/build/render.php +++ b/dynamic-table-of-contents/build/render.php @@ -14,7 +14,7 @@ $asset_deps = require trailingslashit( plugin_dir_path( __FILE__ ) ) . 'view.asset.php'; wp_enqueue_script( - 'wpsp-dynamic-table-of-contents-view', + 'wpcomsp-dynamic-table-of-contents-view', plugins_url( 'view.js', __FILE__ ), $asset_deps['dependencies'], $asset_deps['version'], @@ -25,7 +25,7 @@
> :first-child{margin-top:0}.wp-block-wpsp-dynamic-table-of-contents>:last-child{margin-bottom:0}.wp-block-wpsp-dynamic-table-of-contents h2{color:inherit;font-size:var(--wp--preset--font-size--medium);margin-bottom:1.5rem}.wp-block-wpsp-dynamic-table-of-contents ul{border-top:1px solid var(--wp--preset--color--light-gray);list-style:none;margin:0;padding:.5rem 0 0}.wp-block-wpsp-dynamic-table-of-contents ul li{margin-bottom:0;padding-top:1rem}.wp-block-wpsp-dynamic-table-of-contents ul li a:not(.active){color:var(--wp--preset--color--black)}.wp-block-wpsp-dynamic-table-of-contents ul li a:hover{text-decoration:underline}.wp-block-wpsp-dynamic-table-of-contents ul li a.active{font-weight:700} +.wp-block-post-content h1,.wp-block-post-content h2,.wp-block-post-content h3,.wp-block-post-content h4,.wp-block-post-content h5,.wp-block-post-content h6{scroll-margin-top:2rem}.wp-block-wpcomsp-dynamic-table-of-contents{font-family:var(--wp--preset--font-family--sans-serif);max-width:312px}.wp-block-wpcomsp-dynamic-table-of-contents.is-position-sticky{top:2rem}.admin-bar .wp-block-wpcomsp-dynamic-table-of-contents.is-position-sticky{top:calc(2rem + 32px)}.wp-block-wpcomsp-dynamic-table-of-contents>:first-child{margin-top:0}.wp-block-wpcomsp-dynamic-table-of-contents>:last-child{margin-bottom:0}.wp-block-wpcomsp-dynamic-table-of-contents h2{color:inherit;font-size:var(--wp--preset--font-size--medium);margin-bottom:1.5rem}.wp-block-wpcomsp-dynamic-table-of-contents ul{border-top:1px solid var(--wp--preset--color--light-gray);list-style:none;margin:0;padding:.5rem 0 0}.wp-block-wpcomsp-dynamic-table-of-contents ul li{margin-bottom:0;padding-top:1rem}.wp-block-wpcomsp-dynamic-table-of-contents ul li a:not(.active){color:var(--wp--preset--color--black)}.wp-block-wpcomsp-dynamic-table-of-contents ul li a:hover{text-decoration:underline}.wp-block-wpcomsp-dynamic-table-of-contents ul li a.active{font-weight:700} diff --git a/dynamic-table-of-contents/build/view.js b/dynamic-table-of-contents/build/view.js index faf9535..b295172 100644 --- a/dynamic-table-of-contents/build/view.js +++ b/dynamic-table-of-contents/build/view.js @@ -1 +1 @@ -(()=>{const t=document.querySelectorAll(".wp-block-post-content h1, .wp-block-post-content h2, .wp-block-post-content h3, .wp-block-post-content h4, .wp-block-post-content h5, .wp-block-post-content h6"),e=document.querySelector(".wp-block-wpsp-dynamic-table-of-contents ul"),o=new IntersectionObserver((t=>{let e=document.querySelectorAll(".wp-block-wpsp-dynamic-table-of-contents a");t.forEach((t=>{const o=t.target.id,c=document.querySelector(`.wp-block-wpsp-dynamic-table-of-contents a[href="#${o}"]`);t.isIntersecting&&(e.forEach((t=>{t.classList.remove("active")})),c.classList.add("active"))}))}),{rootMargin:"0px 0px -75% 0px"});t.forEach(((t,c)=>{const n=t.id;if(n.length){const l=document.createElement("li"),s=document.createElement("a");s.href=`#${n}`,s.textContent=t.textContent,0===c&&s.classList.add("active"),l.appendChild(s),e.appendChild(l),o.observe(t)}}))})(); \ No newline at end of file +(()=>{const t=document.querySelectorAll(".wp-block-post-content h1, .wp-block-post-content h2, .wp-block-post-content h3, .wp-block-post-content h4, .wp-block-post-content h5, .wp-block-post-content h6"),e=document.querySelector(".wp-block-wpcomsp-dynamic-table-of-contents ul"),o=new IntersectionObserver((t=>{let e=document.querySelectorAll(".wp-block-wpcomsp-dynamic-table-of-contents a");t.forEach((t=>{const o=t.target.id,c=document.querySelector(`.wp-block-wpcomsp-dynamic-table-of-contents a[href="#${o}"]`);t.isIntersecting&&(e.forEach((t=>{t.classList.remove("active")})),c.classList.add("active"))}))}),{rootMargin:"0px 0px -75% 0px"});t.forEach(((t,c)=>{const n=t.id;if(n.length){const l=document.createElement("li"),s=document.createElement("a");s.href=`#${n}`,s.textContent=t.textContent,0===c&&s.classList.add("active"),l.appendChild(s),e.appendChild(l),o.observe(t)}}))})(); \ No newline at end of file diff --git a/dynamic-table-of-contents/classes/class-wpsp-blocks-self-update.php b/dynamic-table-of-contents/classes/class-wpsp-blocks-self-update.php index 05df386..3b8ae31 100644 --- a/dynamic-table-of-contents/classes/class-wpsp-blocks-self-update.php +++ b/dynamic-table-of-contents/classes/class-wpsp-blocks-self-update.php @@ -3,21 +3,21 @@ * Plugin Autoupdate Filter Self Update class. * sets up autoupdates for this GitHub-hosted plugin. * - * @package wpsp + * @package wpcomsp */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } -class WPSP_Blocks_Self_Update { +class WPCOMSP_Blocks_Self_Update { public static $instance; /** * Get instance of this class. * - * @return WPSP_Blocks_Self_Update + * @return WPCOMSP_Blocks_Self_Update */ public static function get_instance() { if ( ! self::$instance ) { diff --git a/dynamic-table-of-contents/dynamic-table-of-contents.php b/dynamic-table-of-contents/dynamic-table-of-contents.php index cec8d1e..1b94b0f 100644 --- a/dynamic-table-of-contents/dynamic-table-of-contents.php +++ b/dynamic-table-of-contents/dynamic-table-of-contents.php @@ -12,7 +12,7 @@ * License URI: https://www.gnu.org/licenses/gpl-2.0.html * Text Domain: dynamic-table-of-contents * - * @package wpsp + * @package wpcomsp */ // Exit if accessed directly. @@ -23,12 +23,12 @@ // Define the plugin folder name. -// If no other WPSP Block Plugin added the self update class, add it. -if ( ! class_exists( 'WPSP_Blocks_Self_Update' ) ) { - require __DIR__ . '/classes/class-wpsp-blocks-self-update.php'; +// If no other WPCOMSP Block Plugin added the self update class, add it. +if ( ! class_exists( 'WPCOMSP_Blocks_Self_Update' ) ) { + require __DIR__ . '/classes/class-wpcomsp-blocks-self-update.php'; - $wpsp_blocks_self_update = WPSP_Blocks_Self_Update::get_instance(); - $wpsp_blocks_self_update->hooks(); + $wpcomsp_blocks_self_update = WPCOMSP_Blocks_Self_Update::get_instance(); + $wpcomsp_blocks_self_update->hooks(); } /** @@ -40,7 +40,7 @@ * @return array */ add_filter( - 'wpsp_installed_blocks', + 'wpcomsp_installed_blocks', function ( $blocks ) { $plugin_data = get_plugin_data( __FILE__ ); @@ -58,10 +58,10 @@ function ( $blocks ) { * * @see https://developer.wordpress.org/reference/functions/register_block_type/ */ -function wpsp_dynamic_table_of_contents_block_init() { +function wpcomsp_dynamic_table_of_contents_block_init() { register_block_type( __DIR__ . '/build' ); } -add_action( 'init', 'wpsp_dynamic_table_of_contents_block_init' ); +add_action( 'init', 'wpcomsp_dynamic_table_of_contents_block_init' ); /** * Filter the render block output of heading blocks. @@ -71,7 +71,7 @@ function wpsp_dynamic_table_of_contents_block_init() { * * @return string Block content. */ -function wpsp_dynamic_table_of_contents_block_render( $block_content, $block ) { +function wpcomsp_dynamic_table_of_contents_block_render( $block_content, $block ) { if ( 'core/heading' !== $block['blockName'] ) { return $block_content; } @@ -91,4 +91,4 @@ function wpsp_dynamic_table_of_contents_block_render( $block_content, $block ) { return $processor->get_updated_html(); } -add_filter( 'render_block', 'wpsp_dynamic_table_of_contents_block_render', 10, 2 ); +add_filter( 'render_block', 'wpcomsp_dynamic_table_of_contents_block_render', 10, 2 ); diff --git a/dynamic-table-of-contents/src/block.json b/dynamic-table-of-contents/src/block.json index baf1cfd..ecff3cb 100644 --- a/dynamic-table-of-contents/src/block.json +++ b/dynamic-table-of-contents/src/block.json @@ -1,7 +1,7 @@ { "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, - "name": "wpsp/dynamic-table-of-contents", + "name": "wpcomsp/dynamic-table-of-contents", "version": "0.1.9", "title": "Dynamic Table of Contents", "category": "design", diff --git a/dynamic-table-of-contents/src/render.php b/dynamic-table-of-contents/src/render.php index cf7dd90..d32162c 100644 --- a/dynamic-table-of-contents/src/render.php +++ b/dynamic-table-of-contents/src/render.php @@ -14,7 +14,7 @@ $asset_deps = require trailingslashit( plugin_dir_path( __FILE__ ) ) . 'view.asset.php'; wp_enqueue_script( - 'wpsp-dynamic-table-of-contents-view', + 'wpcomsp-dynamic-table-of-contents-view', plugins_url( 'view.js', __FILE__ ), $asset_deps['dependencies'], $asset_deps['version'], @@ -25,7 +25,7 @@
> { - let $links = document.querySelectorAll('.wp-block-wpsp-dynamic-table-of-contents a'); + let $links = document.querySelectorAll('.wp-block-wpcomsp-dynamic-table-of-contents a'); entries.forEach((entry) => { const $id = entry.target.id; - const $link = document.querySelector(`.wp-block-wpsp-dynamic-table-of-contents a[href="#${$id}"]`); + const $link = document.querySelector(`.wp-block-wpcomsp-dynamic-table-of-contents a[href="#${$id}"]`); if (entry.isIntersecting) { $links.forEach((link) => { diff --git a/hello-world/build/block.json b/hello-world/build/block.json index d91b052..f338f4f 100644 --- a/hello-world/build/block.json +++ b/hello-world/build/block.json @@ -1,7 +1,7 @@ { "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, - "name": "wpsp/hello-world", + "name": "wpcomsp/hello-world", "version": "0.1.0", "title": "Hello World", "category": "widgets", diff --git a/hello-world/build/index.css b/hello-world/build/index.css index 0ce29ba..6219fc4 100644 --- a/hello-world/build/index.css +++ b/hello-world/build/index.css @@ -1 +1 @@ -.wp-block-wpsp-hello-world{border:1px dotted red} +.wp-block-wpcomsp-hello-world{border:1px dotted red} diff --git a/hello-world/build/index.js b/hello-world/build/index.js index 2f6c906..f9f01cf 100644 --- a/hello-world/build/index.js +++ b/hello-world/build/index.js @@ -1 +1 @@ -(()=>{"use strict";var e,o={250:()=>{const e=window.wp.blocks,o=window.React,r=window.wp.i18n,l=window.wp.blockEditor,t=JSON.parse('{"u2":"wpsp/hello-world"}');(0,e.registerBlockType)(t.u2,{edit:function(){return(0,o.createElement)("p",{...(0,l.useBlockProps)()},(0,r.__)("Hello World – hello from the editor!","hello-world"))},save:function(){return(0,o.createElement)("p",{...l.useBlockProps.save()},"Hello World – hello from the saved content!")}})}},r={};function l(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return o[e](n,n.exports,l),n.exports}l.m=o,e=[],l.O=(o,r,t,n)=>{if(!r){var i=1/0;for(c=0;c=n)&&Object.keys(l.O).every((e=>l.O[e](r[a])))?r.splice(a--,1):(s=!1,n0&&e[c-1][2]>n;c--)e[c]=e[c-1];e[c]=[r,t,n]},l.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={826:0,431:0};l.O.j=o=>0===e[o];var o=(o,r)=>{var t,n,[i,s,a]=r,p=0;if(i.some((o=>0!==e[o]))){for(t in s)l.o(s,t)&&(l.m[t]=s[t]);if(a)var c=a(l)}for(o&&o(r);pl(250)));t=l.O(t)})(); \ No newline at end of file +(()=>{"use strict";var e,o={250:()=>{const e=window.wp.blocks,o=window.React,r=window.wp.i18n,l=window.wp.blockEditor,t=JSON.parse('{"u2":"wpcomsp/hello-world"}');(0,e.registerBlockType)(t.u2,{edit:function(){return(0,o.createElement)("p",{...(0,l.useBlockProps)()},(0,r.__)("Hello World – hello from the editor!","hello-world"))},save:function(){return(0,o.createElement)("p",{...l.useBlockProps.save()},"Hello World – hello from the saved content!")}})}},r={};function l(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return o[e](n,n.exports,l),n.exports}l.m=o,e=[],l.O=(o,r,t,n)=>{if(!r){var i=1/0;for(c=0;c=n)&&Object.keys(l.O).every((e=>l.O[e](r[a])))?r.splice(a--,1):(s=!1,n0&&e[c-1][2]>n;c--)e[c]=e[c-1];e[c]=[r,t,n]},l.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={826:0,431:0};l.O.j=o=>0===e[o];var o=(o,r)=>{var t,n,[i,s,a]=r,p=0;if(i.some((o=>0!==e[o]))){for(t in s)l.o(s,t)&&(l.m[t]=s[t]);if(a)var c=a(l)}for(o&&o(r);pl(250)));t=l.O(t)})(); \ No newline at end of file diff --git a/hello-world/build/style-index.css b/hello-world/build/style-index.css index 5e75751..d30daa8 100644 --- a/hello-world/build/style-index.css +++ b/hello-world/build/style-index.css @@ -1 +1 @@ -.wp-block-wpsp-hello-world{background-color:#21759b;color:#fff;padding:2px} +.wp-block-wpcomsp-hello-world{background-color:#21759b;color:#fff;padding:2px} diff --git a/hello-world/build/view.js b/hello-world/build/view.js index deae67e..ec0a502 100644 --- a/hello-world/build/view.js +++ b/hello-world/build/view.js @@ -1 +1 @@ -console.log("Hello World! (from wpsp-hello-world block)"); \ No newline at end of file +console.log("Hello World! (from wpcomsp-hello-world block)"); \ No newline at end of file diff --git a/hello-world/classes/class-wpsp-blocks-self-update.php b/hello-world/classes/class-wpsp-blocks-self-update.php index 05df386..3b8ae31 100644 --- a/hello-world/classes/class-wpsp-blocks-self-update.php +++ b/hello-world/classes/class-wpsp-blocks-self-update.php @@ -3,21 +3,21 @@ * Plugin Autoupdate Filter Self Update class. * sets up autoupdates for this GitHub-hosted plugin. * - * @package wpsp + * @package wpcomsp */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } -class WPSP_Blocks_Self_Update { +class WPCOMSP_Blocks_Self_Update { public static $instance; /** * Get instance of this class. * - * @return WPSP_Blocks_Self_Update + * @return WPCOMSP_Blocks_Self_Update */ public static function get_instance() { if ( ! self::$instance ) { diff --git a/hello-world/hello-world.php b/hello-world/hello-world.php index daefe3f..7e03a17 100644 --- a/hello-world/hello-world.php +++ b/hello-world/hello-world.php @@ -11,19 +11,19 @@ * Update URI: https://opsoasis.wpspecialprojects.com/hello-world/ * Text Domain: hello-world * - * @package wpsp + * @package wpcomsp */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } -// If no other WPSP Block Plugin added the self update class, add it. -if ( ! class_exists( 'WPSP_Blocks_Self_Update' ) ) { - require __DIR__ . '/classes/class-wpsp-blocks-self-update.php'; +// If no other WPCOMSP Block Plugin added the self update class, add it. +if ( ! class_exists( 'WPCOMSP_Blocks_Self_Update' ) ) { + require __DIR__ . '/classes/class-wpcomsp-blocks-self-update.php'; - $wpsp_blocks_self_update = WPSP_Blocks_Self_Update::get_instance(); - $wpsp_blocks_self_update->hooks(); + $wpcomsp_blocks_self_update = WPCOMSP_Blocks_Self_Update::get_instance(); + $wpcomsp_blocks_self_update->hooks(); } /** @@ -35,7 +35,7 @@ * @return array */ add_filter( - 'wpsp_installed_blocks', + 'wpcomsp_installed_blocks', function( $blocks ) { $plugin_data = get_plugin_data( __FILE__ ); diff --git a/hello-world/src/block.json b/hello-world/src/block.json index 4ff7e0d..598a76a 100644 --- a/hello-world/src/block.json +++ b/hello-world/src/block.json @@ -1,7 +1,7 @@ { "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, - "name": "wpsp/hello-world", + "name": "wpcomsp/hello-world", "version": "0.1.0", "title": "Hello World", "category": "widgets", diff --git a/hello-world/src/editor.scss b/hello-world/src/editor.scss index 7f4554b..f1ee279 100644 --- a/hello-world/src/editor.scss +++ b/hello-world/src/editor.scss @@ -4,6 +4,6 @@ * Replace them with your own styles or remove the file completely. */ -.wp-block-wpsp-hello-world { +.wp-block-wpcomsp-hello-world { border: 1px dotted #f00; } diff --git a/hello-world/src/style.scss b/hello-world/src/style.scss index 4dff0f7..42d5b0a 100644 --- a/hello-world/src/style.scss +++ b/hello-world/src/style.scss @@ -5,7 +5,7 @@ * Replace them with your own styles or remove the file completely. */ -.wp-block-wpsp-hello-world { +.wp-block-wpcomsp-hello-world { background-color: #21759b; color: #fff; padding: 2px; diff --git a/hello-world/src/view.js b/hello-world/src/view.js index c9afaa4..5508a52 100644 --- a/hello-world/src/view.js +++ b/hello-world/src/view.js @@ -21,5 +21,5 @@ */ /* eslint-disable no-console */ -console.log( 'Hello World! (from wpsp-hello-world block)' ); +console.log( 'Hello World! (from wpcomsp-hello-world block)' ); /* eslint-enable no-console */ diff --git a/readme.md b/readme.md index 89f55ef..ad6efd4 100644 --- a/readme.md +++ b/readme.md @@ -1,10 +1,10 @@ # WP Special Projects - All Blocks -All namespacing should use `wpsp` as the value. +All namespacing should use `wpcomsp` as the value. Genericize your blocks, do not include site names or data as part of the block markup or content. -Your plugin *must* contain a `CHANGELOG.md` file. +Your plugin _must_ contain a `CHANGELOG.md` file. Your plugin must have an entrypoint with the same name as the folder, i.e. `hello-world/hello-world.php`. @@ -28,7 +28,7 @@ More information here: https://git-scm.com/docs/git-sparse-checkout You can add a new block to the monorepo by running the following steps. Make sure you're starting from the `wp-content/plugins` folder: -``` bash +```bash git clone --no-checkout --sparse https://github.com/a8cteam51/special-projects-blocks-monorepo/ cd special-projects-blocks-monorepo npx @wordpress/create-block @@ -53,7 +53,7 @@ From here, you can start editing your block and follow the regular process to do Start by downloading the block's zip file on your plugin folder -``` bash +```bash git clone --no-checkout --sparse https://github.com/a8cteam51/special-projects-blocks-monorepo/ cd special-projects-blocks-monorepo git sparse-checkout init --cone @@ -67,7 +67,6 @@ git checkout -b %your_new_branch_name% When updating a **static** block — if we add any changes to the edit or save functions, we should deprecate the block to make sure we're not impacting the user experience. This is a great source of information with code examples ranging from simpler to more complex ones here: https://developer.wordpress.org/news/2023/03/10/block-deprecation-a-tutorial/ - ## Partner Agnostic Keep in mind that blocks in this repository can be installed on multiple sites. @@ -85,8 +84,6 @@ Any partner-specific styling rules should be added via a separate stylesheet tha How to extend or customize blocks in the monorepo, without directly editing the blocks themselves. It’s important to avoid modifying blocks in the monorepo unless absolutely necessary. In that case please contact an engineering lead to discuss your modification plans. If you’re importing an existing block into your project block and need to modify the blocks functionality, styling, or output, there’s a variety of hooks and filters available to do this. - - Re-styling the block: https://developer.wordpress.org/themes/features/block-stylesheets/ Writing block variations: https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/extending-the-query-loop-block/ diff --git a/sibling-pages-list/build/block.json b/sibling-pages-list/build/block.json index 6d66521..6fd4bb5 100644 --- a/sibling-pages-list/build/block.json +++ b/sibling-pages-list/build/block.json @@ -1,7 +1,7 @@ { "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, - "name": "wpsp/sibling-pages-list", + "name": "wpcomsp/sibling-pages-list", "version": "0.1.0", "title": "Sibling Pages List", "category": "widgets", diff --git a/sibling-pages-list/build/index.js b/sibling-pages-list/build/index.js index ce99a2f..5817dac 100644 --- a/sibling-pages-list/build/index.js +++ b/sibling-pages-list/build/index.js @@ -1 +1 @@ -(()=>{"use strict";const e=window.React,t=window.wp.blocks,i=window.wp.i18n,a=window.wp.blockEditor,s=JSON.parse('{"UU":"wpsp/sibling-pages-list"}'),l=(0,e.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false"},(0,e.createElement)("path",{d:"M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z"}),(0,e.createElement)("path",{d:"M16 2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2ZM6 3.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5Z"}));(0,t.registerBlockType)(s.UU,{edit:function(){return(0,e.createElement)("p",{...(0,a.useBlockProps)()},(0,i.__)("This block will list the sibling pages for the current page.","sibling-pages-list"))},icon:l})})(); \ No newline at end of file +(()=>{"use strict";const e=window.React,t=window.wp.blocks,i=window.wp.i18n,a=window.wp.blockEditor,s=JSON.parse('{"UU":"wpcomsp/sibling-pages-list"}'),l=(0,e.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false"},(0,e.createElement)("path",{d:"M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z"}),(0,e.createElement)("path",{d:"M16 2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2ZM6 3.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5Z"}));(0,t.registerBlockType)(s.UU,{edit:function(){return(0,e.createElement)("p",{...(0,a.useBlockProps)()},(0,i.__)("This block will list the sibling pages for the current page.","sibling-pages-list"))},icon:l})})(); \ No newline at end of file diff --git a/sibling-pages-list/classes/class-wpsp-blocks-self-update.php b/sibling-pages-list/classes/class-wpsp-blocks-self-update.php index 05df386..3b8ae31 100644 --- a/sibling-pages-list/classes/class-wpsp-blocks-self-update.php +++ b/sibling-pages-list/classes/class-wpsp-blocks-self-update.php @@ -3,21 +3,21 @@ * Plugin Autoupdate Filter Self Update class. * sets up autoupdates for this GitHub-hosted plugin. * - * @package wpsp + * @package wpcomsp */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } -class WPSP_Blocks_Self_Update { +class WPCOMSP_Blocks_Self_Update { public static $instance; /** * Get instance of this class. * - * @return WPSP_Blocks_Self_Update + * @return WPCOMSP_Blocks_Self_Update */ public static function get_instance() { if ( ! self::$instance ) { diff --git a/sibling-pages-list/sibling-pages-list.php b/sibling-pages-list/sibling-pages-list.php index 97a8895..d4ac25f 100644 --- a/sibling-pages-list/sibling-pages-list.php +++ b/sibling-pages-list/sibling-pages-list.php @@ -10,19 +10,19 @@ * License URI: https://www.gnu.org/licenses/gpl-2.0.html * Text Domain: sibling-pages-list * - * @package Wpsp + * @package wpcomsp */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } -// If no other WPSP Block Plugin added the self update class, add it. -if ( ! class_exists( 'WPSP_Blocks_Self_Update' ) ) { - require __DIR__ . '/classes/class-wpsp-blocks-self-update.php'; +// If no other WPCOMSP Block Plugin added the self update class, add it. +if ( ! class_exists( 'WPCOMSP_Blocks_Self_Update' ) ) { + require __DIR__ . '/classes/class-wpcomsp-blocks-self-update.php'; - $wpsp_blocks_self_update = WPSP_Blocks_Self_Update::get_instance(); - $wpsp_blocks_self_update->hooks(); + $wpcomsp_blocks_self_update = WPCOMSP_Blocks_Self_Update::get_instance(); + $wpcomsp_blocks_self_update->hooks(); } /** @@ -34,7 +34,7 @@ * @return array */ add_filter( - 'wpsp_installed_blocks', + 'wpcomsp_installed_blocks', function( $blocks ) { $blocks[] = 'sibling-pages-list'; @@ -49,7 +49,7 @@ function( $blocks ) { * * @see https://developer.wordpress.org/reference/functions/register_block_type/ */ -function wpsp_sibling_pages_list_block_init() { +function wpcomsp_sibling_pages_list_block_init() { register_block_type( __DIR__ . '/build' ); } -add_action( 'init', 'wpsp_sibling_pages_list_block_init' ); +add_action( 'init', 'wpcomsp_sibling_pages_list_block_init' ); diff --git a/sibling-pages-list/src/block.json b/sibling-pages-list/src/block.json index e155218..53a104e 100644 --- a/sibling-pages-list/src/block.json +++ b/sibling-pages-list/src/block.json @@ -1,7 +1,7 @@ { "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, - "name": "wpsp/sibling-pages-list", + "name": "wpcomsp/sibling-pages-list", "version": "0.1.0", "title": "Sibling Pages List", "category": "widgets", diff --git a/sibling-pages-list/src/style.scss b/sibling-pages-list/src/style.scss index 71d1a2e..6da821b 100644 --- a/sibling-pages-list/src/style.scss +++ b/sibling-pages-list/src/style.scss @@ -5,7 +5,7 @@ * Replace them with your own styles or remove the file completely. */ -.wp-block-wpsp-sibling-pages-list { +.wp-block-wpcomsp-sibling-pages-list { background-color: #21759b; color: #fff; padding: 2px; diff --git a/special-projects-blocks-monorepo.php b/special-projects-blocks-monorepo.php index 807c479..a050f0a 100644 --- a/special-projects-blocks-monorepo.php +++ b/special-projects-blocks-monorepo.php @@ -10,9 +10,9 @@ * Update URI: https://github.com/a8cteam51/special-projects-blocks-monorepo/ * License: GPL-2.0-or-later * License URI: https://www.gnu.org/licenses/gpl-2.0.html - * Text Domain: wpsp-blocks + * Text Domain: wpcomsp-blocks * - * @package wpsp + * @package wpcomsp */ @@ -23,7 +23,7 @@ * Example: /dynamic-table-of-contents/dynamic-table-of-contents.php */ function load_add_downloaded_blocks() { - $dirs = glob( dirname( __FILE__ ) . '/*', GLOB_ONLYDIR ); + $dirs = glob( __DIR__ . '/*', GLOB_ONLYDIR ); foreach ( $dirs as $dir ) { if ( file_exists( $dir . DIRECTORY_SEPARATOR . basename( $dir ) . '.php' ) ) {