Compare commits

..

35 Commits

Author SHA1 Message Date
6163ed77dc article block front end rendering 2026-01-03 13:33:13 +00:00
94a6c1e0f6 package-lock.json 2026-01-03 10:32:26 +00:00
0d2fb4922e basic article block backend working 2026-01-03 10:31:24 +00:00
17a8807a87 block background image settings 2026-01-02 20:21:33 +00:00
7200e572e0 cleanup unused theme hook 2026-01-02 18:54:16 +00:00
ed045c16e1 block background colours and tint 2026-01-02 01:15:56 +00:00
0c6b74042e add hard boiled security plugin 2026-01-01 21:56:56 +00:00
706f04d91d add css class name helper functions for blocks 2025-12-19 12:29:38 +00:00
3d51f8f735 move restAPI class to utilities 2025-12-19 12:28:59 +00:00
39444a6898 fix editor styles after wp update 2025-12-19 12:28:25 +00:00
a4d764b510 remove console.log from block js 2025-12-18 11:01:52 +00:00
beb4ca8e6c remove unused css 2025-12-18 11:00:43 +00:00
e11cdede0b setup endpoints class and add container widths for blocks 2025-12-18 10:59:25 +00:00
007bc6cbac integrating attributes 2025-12-18 10:57:50 +00:00
5a3d5f148a remove autoload_psr4 for old block approach 2025-12-18 10:54:43 +00:00
a53a0c2cc0 tweak editor styles 2025-12-15 18:34:09 +00:00
43b5e39f10 remove old style acf block 2025-12-15 18:24:46 +00:00
9fd6afa1e1 use standard block.json method with ACF blocks 2025-12-15 18:10:06 +00:00
5015672eff composer update 2025-12-15 18:09:37 +00:00
ac5351c8c7 auto-registering blocks in php and javascript with dynamic enqueuing of associated styles and scripts with support for scss and blade 2025-12-13 14:22:42 +00:00
f8d5bb5aa2 cleanup allowed_blocks logic and add mechanism for disabling blade template for specific block 2025-12-12 13:12:37 +00:00
1275c503a7 a working react/php dynamic wordpress block example integrated with the Vite build process 2025-12-10 19:44:32 +00:00
21d6f20a00 restrict core blocks to inner blocks of specified parent blocks. blocks blocks blocks 2025-12-09 22:40:44 +00:00
e692225429 stop loading blocks in main app.js 2025-12-09 22:11:20 +00:00
76290560de block whitelist json 2025-12-09 22:10:55 +00:00
73aaf300ae remove BadExample css 2025-12-09 22:10:35 +00:00
ddbc6ad468 remove old code 2025-12-09 22:09:49 +00:00
70988bf19b move Blocks.php stuff alongside top level includes 2025-12-09 22:07:50 +00:00
a233611582 use json file for block whitelist 2025-12-09 22:06:47 +00:00
6c6b028bf1 basic block styles within editor 2025-12-09 22:04:29 +00:00
3db971e2f4 remove blocks.js 2025-12-09 22:02:59 +00:00
d49d6720fe tweak acf block settings 2025-12-09 22:02:24 +00:00
ae35f92d4d add $wpblue var 2025-12-09 22:01:52 +00:00
4508bc33e9 fix container width in blocks 2025-12-09 22:01:23 +00:00
9528b61867 update .editorconfig 2025-12-09 21:57:25 +00:00
71 changed files with 2926 additions and 1278 deletions

View File

@@ -1,15 +1,25 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.php]
indent_size = 2
quote_type = single
[*.md]
trim_trailing_whitespace = false
[*.php]
indent_size = 4
[*.blade.php]
indent_size = 2
[resources/views/**.php]
indent_size = 2
[index.php]
indent_size = 2

View File

@@ -54,7 +54,7 @@
"oscarotero/env": "^2.1",
"roots/bedrock-autoloader": "^1.0",
"roots/bedrock-disallow-indexing": "^2.0",
"roots/wordpress": "6.8.2",
"roots/wordpress": "^6.9",
"roots/wp-config": "1.0.0",
"wpackagist-theme/twentytwentyfive": "^1.0",
"koodimonni-language/core-en_gb": "^6.8",
@@ -65,9 +65,10 @@
"roots/acorn-prettify": "^1.0",
"wpackagist-plugin/contact-form-7": "^6.1",
"wpackagist-plugin/flamingo": "^2.6",
"wpackagist-plugin/resizable-editor-sidebar": "^1.02",
"wpengine/advanced-custom-fields-pro": "^6.5",
"ourcodeworld/name-that-color": "dev-master"
"wpengine/advanced-custom-fields-pro": "^6.7",
"ourcodeworld/name-that-color": "dev-master",
"wpackagist-plugin/resizable-editor-sidebar": "1.0.6",
"badegguk/hard-boiled-security": "^1.0"
},
"require-dev": {
"roave/security-advisories": "dev-latest",
@@ -89,6 +90,7 @@
"web/app/mu-plugins/{$name}/": [
"type:wordpress-muplugin",
"badegguk/bad-egg-digital-login-page",
"badegguk/hard-boiled-security",
"wpengine/advanced-custom-fields-pro"
],
"web/app/plugins/{$name}/": ["type:wordpress-plugin"],

1185
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,58 +0,0 @@
<?php
namespace App\ACF;
class CloneGroup
{
public function __construct()
{
}
public function block_background()
{
return [
'contrast',
'bg_colour',
'bg_tint',
];
}
public function block_intro()
{
return [
'overline',
'heading',
'blurb',
'intro_alignment',
];
}
public function block_footer()
{
return [
'blurb_footer',
'links',
'footer_alignment',
];
}
public function block_settings()
{
return [
'section_anchor_id',
'padding_top',
'padding_bottom',
'container_width',
'angle_status',
'angle_position',
'angle_direction',
'angle_colour',
'angle_tint',
];
}
public function block_all()
{
return array_merge($this->block_intro(), $this->block_footer(), $this->block_settings(), $this->block_background());
}
}

View File

@@ -8,14 +8,15 @@ class Dynamic
{
public function __construct()
{
add_filter('acf/load_field/name=colour', [ $this, 'load_colours' ]);
add_filter('acf/load_field/name=bg_colour', [ $this, 'load_colours' ]);
add_filter('acf/load_field/name=tint', [ $this, 'load_tints' ]);
add_filter('acf/load_field/name=bg_tint', [ $this, 'load_tints' ]);
add_filter('acf/load_field/name=colour', [ $this, 'load_colours' ]);
add_filter('acf/load_field/name=bg_colour', [ $this, 'load_colours' ]);
add_filter('acf/load_field/name=tint', [ $this, 'load_tints' ]);
add_filter('acf/load_field/name=bg_tint', [ $this, 'load_tints' ]);
add_filter('acf/load_field/name=container_width', [ $this, 'container_width' ]);
add_filter('acf/load_field/name=fontawesome_regular', [ $this, 'load_fontawesome_regular_icons' ]);
add_filter('acf/load_field/name=fontawesome_solid', [ $this, 'load_fontawesome_solid_icons' ]);
add_filter('acf/load_field/name=fontawesome_brands', [ $this, 'load_fontawesome_brand_icons' ]);
add_action('acf/input/admin_footer', [$this, 'colour_ui'] );
add_filter('acf/load_field/name=fontawesome_solid', [ $this, 'load_fontawesome_solid_icons' ]);
add_filter('acf/load_field/name=fontawesome_brands', [ $this, 'load_fontawesome_brand_icons' ]);
add_action('acf/input/admin_footer', [ $this, 'colour_ui' ]);
}
public function load_colours( $field )
@@ -25,7 +26,9 @@ class Dynamic
$colours = $colour->values();
$field['choices'] = [];
$field['choices'] = [
'0' => __('None', 'badegg'),
];
foreach($colours as $slug => $hex):
$field['choices'][$slug] = '<i class="fas fa-circle" style="color: '. $hex .'"></i> ' . @$NameThatColour->name($hex)['name'];
@@ -47,13 +50,27 @@ class Dynamic
$field['choices'][$slug] = ucfirst($slug);
else:
$field['choices'][0] = 'None';
$field['choices'][0] = __('None', 'badegg');
endif;
endforeach;
return $field;
}
public function container_width( $field )
{
$field['choices'] = [
0 => 'Auto',
'narrow' => __('Narrow', 'badegg'),
'small' => __('Small', 'badegg'),
'medium' => __('Medium', 'badegg'),
'large' => __('Large', 'badegg'),
'full' => __('Edge to edge', 'badegg'),
];
return $field;
}
public function load_fontawesome_regular_icons( $field )
{
$field['choices'] = [];

View File

@@ -1,155 +0,0 @@
<?php
namespace App\Admin;
use Blocks\Editor;
class Blocks
{
public function __construct()
{
add_filter( 'block_categories_all' , [$this, 'categories']);
add_action('allowed_block_types_all', [$this, 'blacklist'], 100, 2);
}
public function categories( $categories )
{
// Adding a new category.
$categories = array_merge([
[
'slug' => 'badegg',
'title' => __('Provided by Bad Egg Digital'),
],
], $categories);
return $categories;
}
public function blacklist()
{
// Reference:
// https://www.wpexplorer.com/how-to-remove-gutenberg-blocks/
// https://www.wpexplorer.com/wordpress-core-blocks-list/
// Existing blocks with Blade templates
// https://roots.io/acorn/docs/rendering-blade-views/#existing-blocks-with-blade-templates
$blocks = array_keys( \WP_Block_Type_Registry::get_instance()->get_all_registered() );
$blacklist = [
// Design
'core/button',
'core/comment-template',
'core/home-link',
'core/navigation-link',
'core/navigation-submenu',
'core/buttons',
'core/column',
'core/columns',
'core/group',
'core/more',
'core/nextpage',
'core/separator',
'core/spacer',
'core/text-columns',
// Embed
'core/embed',
// Media
'core/cover',
'core/file',
'core/gallery',
'core/image',
'core/media-text',
'core/audio',
'core/video',
// Reusable
'core/block',
// Text
'core/footnotes',
'core/heading',
'core/list',
'core/code',
'core/details',
'core/freeform',
'core/list-item',
'core/missing',
'core/paragraph',
'core/preformatted',
'core/pullquote',
'core/quote',
'core/table',
'core/verse',
// Theme
'core/avatar',
'core/comment-author-name',
'core/comment-content',
'core/comment-date',
'core/comment-edit-link',
'core/comment-reply-link',
'core/comments',
'core/comments-pagination',
'core/comments-pagination-next',
'core/comments-pagination-numbers',
'core/comments-pagination-previous',
'core/comments-title',
'core/loginout',
'core/navigation',
'core/pattern',
'core/post-author',
'core/post-author-biography',
'core/post-author-name',
'core/post-comments-form',
'core/post-content',
'core/post-date',
'core/post-excerpt',
'core/post-featured-image',
'core/post-navigation-link',
'core/post-template',
'core/post-terms',
'core/post-title',
'core/query',
'core/query-no-results',
'core/query-pagination',
'core/query-pagination-next',
'core/query-pagination-numbers',
'core/query-pagination-previous',
'core/query-title',
'core/read-more',
'core/site-logo',
'core/site-tagline',
'core/site-title',
'core/template-part',
'core/term-description',
'core/post-comments',
// Widgets
'core/legacy-widget',
'core/widget-group',
'core/archives',
'core/calendar',
'core/categories',
'core/latest-comments',
'core/latest-posts',
'core/page-list',
'core/page-list-item',
'core/rss',
'core/search',
'core/shortcode',
'core/social-link',
'core/tag-cloud',
'core/html',
'core/social-links',
];
$Editor = new Editor\Editor();
$blacklist = array_diff($blacklist, $Editor->inner_blocks());
return array_values( array_diff( $blocks, $blacklist ) );
}
}

View File

@@ -6,8 +6,8 @@ class DisablePost
{
public function __construct()
{
add_filter('register_post_type_args', [$this, 'args'], 0, 2);
add_filter('register_taxonomy_args', [$this, 'args'], 0, 2);
// add_filter('register_post_type_args', [$this, 'args'], 0, 2);
// add_filter('register_taxonomy_args', [$this, 'args'], 0, 2);
}
public function args($args, $type)

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Admin;
use ourcodeworld\NameThatColor\ColorInterpreter as NameThatColor;
use App\Utilities;
class Theme
{
public function __construct()
{
add_action( 'after_setup_theme', [$this, 'DynamicPalette'] );
}
public function DynamicPalette()
{
$colour = new Utilities\Colour;
$NameThatColour = new NameThatColor;
$palette = [];
$colours = $colour->values();
foreach($colours as $slug => $hex) {
$palette[] = [
'name' => esc_html__(@$NameThatColour->name($hex)['name'], 'badegg'),
'slug' => $slug,
'color' => $hex,
];
}
if(!empty($colours)) {
add_theme_support('editor-color-palette', $palette);
}
}
}

View File

@@ -40,7 +40,7 @@ class Colour
endforeach;
endif;
$values['0'] = '#FFFFFF';
$values['white'] = '#FFFFFF';
$values['black'] = '#000000';
return $values;

View File

@@ -3,56 +3,94 @@
namespace App\Utilities;
class CssClasses {
public function section($props = [])
public function section($props = [], $name = 'unnamed', $knockout = false)
{
$Colour = new Colour;
$hex = $Colour->name2hex(@$props['bg_colour'], @$props['bg_tint']);
$defaults = [
'padding_top' => null,
'padding_bottom' => null,
'bg_colour' => null,
'bg_tint' => null,
'contrast' => null,
'bg_image' => null,
];
$pattern = @$props['pattern'];
$pattern_top = @$props['pattern_top'];
$pattern_bottom = @$props['pattern_bottom'];
$props = wp_parse_args($props, $defaults);
$Colour = new Colour;
$hex = $Colour->name2hex($props['bg_colour'], $props['bg_tint']);
$classes = [
'section',
'section-' . $props['name'],
// 'section-' . str_replace('acf/', '', $props['name']),
'bg-' . $this->colourTint([
'colour' => @$props['bg_colour'],
'tint' => @$props['bg_tint'],
]),
'section-' . str_replace('/', '-', $name),
];
if($Colour->is_dark($hex) && $this->is_knockout_block($props['name']))
if($props['bg_colour'])
$classes[] = 'bg-' . $this->colourTint([
'colour' => $props['bg_colour'],
'tint' => $props['bg_tint'],
]);
if(($knockout && $Colour->is_dark($hex) || $props['contrast'] == 'light'))
$classes[] = 'knockout';
if(@$props['padding_top'])
if($props['padding_top'])
$classes[] = 'section-zero-top';
if(@$props['padding_bottom'])
if($props['padding_bottom'])
$classes[] = 'section-zero-bottom';
if($pattern):
if($pattern == 'both'):
$classes[] = 'pattern-top';
$classes[] = 'pattern-bottom';
else:
$classes[] = 'pattern-' . $pattern;
endif;
if(in_array($pattern, ['top', 'both']))
$classes[] = 'pattern-top-' . $this->colourTint($pattern_top);
if(in_array($pattern, ['bottom', 'both']))
$classes[] = 'pattern-bottom-' . $this->colourTint($pattern_bottom);
endif;
if(@$props['bg_image'])
if($props['bg_image'])
$classes[] = "bg-watermarked";
if(@$props['className']) $args = array_merge($classes, explode(' ', $props['className']));
return $classes;
}
public function container($args = [], $bg_props = [])
{
$args = wp_parse_args($args, [
'width' => null,
'location' => null,
'section' => false,
'align' => null,
'wysiwyg' => false,
]);
$bg_props = wp_parse_args($bg_props, [
'bg_colour' => null,
'bg_tint' => null,
'contrast' => null,
]);
$Colour = new Colour;
$hex = $Colour->name2hex($bg_props['bg_colour'], $bg_props['bg_tint']);
$classes = [
'container',
];
if($args['width'])
$classes[] = 'container-' . $args['width'];
if($args['location'])
$classes[] = $args['location'];
if($args['section'])
$classes[] = 'section';
if(str_contains($args['location'], 'intro'))
$classes[] = 'section-zero-top';
if(str_contains($args['location'], 'footer'))
$classes[] = 'section-zero-bottom';
if($args['wysiwyg'])
$classes[] = 'wysiwyg';
if($args['align'])
$classes[] = 'align-' . $args['align'];
if(($Colour->is_dark($hex) || $bg_props['contrast'] == 'light'))
$classes[] = 'knockout';
return $classes;
}
@@ -94,7 +132,7 @@ class CssClasses {
public function is_knockout_block($name = null)
{
$blacklist = [
'bad-example',
'badegg/acfdemo',
];
if(in_array($name, $blacklist)):

View File

@@ -0,0 +1,80 @@
<?php
namespace App\Utilities;
use ourcodeworld\NameThatColor\ColorInterpreter as NameThatColor;
class RestAPI
{
public function __construct()
{
add_action( 'rest_api_init', [$this, 'blocks']);
}
public function blocks( )
{
$restBase = 'badegg/v1';
register_rest_route($restBase, '/blocks/config', [
'methods' => 'GET',
'callback' => [ $this, 'config'],
'permission_callback' => function(){
return true;
},
]);
}
public function config()
{
return rest_ensure_response([
'container' => $this->containerWidths(),
'colours' => $this->colours(),
'tints' => $this->tints(),
]);
}
public function containerWidths()
{
return [
[ 'label' => __('Auto', 'badegg'), 'value' => 0 ],
[ 'label' => __('Narrow', 'badegg'), 'value' => 'narrow' ],
[ 'label' => __('Small', 'badegg'), 'value' => 'small' ],
[ 'label' => __('Medium', 'badegg'), 'value' => 'medium' ],
[ 'label' => __('Large', 'badegg'), 'value' => 'large' ],
[ 'label' => __('Edge to edge', 'badegg'), 'value' => 'full' ],
];
}
public function colours()
{
$colour = new Colour;
$NameThatColour = new NameThatColor;
$palette = [];
$colours = $colour->values();
foreach($colours as $slug => $hex) {
$palette[] = [
'name' => esc_html__(@$NameThatColour->name($hex)['name'], 'badegg'),
'slug' => $slug,
'color' => $hex,
];
}
return $palette;
}
public function tints()
{
return [
['label' => __('Lightest', 'badegg'), 'value' => 'lightest'],
['label' => __('Lighter', 'badegg'), 'value' => 'lighter' ],
['label' => __('Light', 'badegg'), 'value' => 'light' ],
['label' => __('None', 'badegg'), 'value' => 0 ],
['label' => __('Dark', 'badegg'), 'value' => 'dark' ],
['label' => __('Darker', 'badegg'), 'value' => 'darker' ],
['label' => __('Darkest', 'badegg'), 'value' => 'darkest' ],
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\View\Composers;
use Roots\Acorn\View\Composer;
use App\Utilities;
class Blocks extends Composer
{
/**
* List of views served by this composer.
*
* @var array
*/
protected static $views = [
'layouts.block-acf',
'partials.block-*',
];
/**
* Data to be passed to view before rendering.
*
* @return array
*/
public function with()
{
return [
'CssClasses' => new Utilities\CssClasses,
];
}
}

View File

@@ -0,0 +1,245 @@
<?php
/**
* Theme Blocks.
*/
namespace App\Blocks;
add_filter('block_type_metadata', function($metadata){
$name = $metadata['name'];
if (str_starts_with($name, 'core/') ) {
unset($metadata['supports']['color']);
unset($metadata['supports']['typography']);
}
return $metadata;
});
// Disable all core blocks except what we need as inner blocks
// resources/js/editor.js handles hiding the inner blocks at the top level
add_action('allowed_block_types_all', __NAMESPACE__ . '\\list_allowed', 100, 2);
// add blocks to the allowed list via filter
add_filter('badegg_block_types_allow', function($allowed){
return array_merge($allowed, [
// 'core/categories',
]);
});
// Add the badegg block category
add_filter( 'block_categories_all' , function ( $categories ) {
// Adding a new category.
$categories = array_merge([
[
'slug' => 'badegg',
'title' => __('Provided by Bad Egg Digital'),
],
], $categories);
return $categories;
});
// Auto register WP blocks
add_action('init', function () {
$blocks = glob(get_theme_file_path('resources/views/blocks/*/block.json'));
foreach ($blocks as $block_json) {
$json = json_decode(file_get_contents($block_json));
$slug = basename(dirname($block_json));
$blockPath = "resources/views/blocks/{$slug}";
$viewScript = "{$blockPath}/view.js";
$script = "{$blockPath}/script.js";
$editorCSS = "{$blockPath}/editor.scss";
$style = "{$blockPath}/style.scss";
// editorStyle
if (file_exists(get_theme_file_path($editorCSS))) {
wp_register_style(
"{$slug}-editor-style",
\Vite::asset($editorCSS),
[],
null
);
}
// script
if(file_exists(get_theme_file_path($script))) {
wp_register_script(
"{$slug}-script",
\Vite::asset($script),
[],
null,
true
);
}
// style
if (file_exists(get_theme_file_path($style))) {
wp_register_style(
"{$slug}-style",
\Vite::asset($style),
[],
null
);
}
// viewScript
if(file_exists(get_theme_file_path($viewScript))) {
wp_register_script(
"{$slug}-view-script",
\Vite::asset($viewScript),
[],
null,
true
);
}
$props = [
'editor_style' => "{$slug}-editor-style",
'style' => "{$slug}-style",
'script' => "{$slug}-script",
'view_script' => "{$slug}-view-script",
'attributes' => [
'container_width' => [
'type' => 'string',
'default' => '',
],
'alignment' => [
'type' => 'string',
],
'padding_top' => [
'type' => 'boolean',
'default' => true
],
'padding_bottom' => [
'type' => 'boolean',
'default' => true
],
'background_colour' => [
'type' => 'string',
'default' => '',
],
'background_hex' => [
'type' => 'string',
'default' => '',
],
'background_tint' => [
'type' => 'string',
'default' => '0',
],
'background_image' => [
'type' => 'integer',
'default' => 0,
],
'background_url' => [
'type' => 'string',
'default' => '',
],
'background_opacity' => [
'type' => 'integer',
'default' => 30
],
'background_position' => [
'type' => 'string',
'default' => '',
],
'background_fixed' => [
'type' => 'boolean',
'default' => false,
],
'background_contrast' => [
'type' => 'boolean',
'default' => false,
],
],
];
if(!property_exists($json, 'acf') && \Roots\view()->exists("blocks.{$slug}.render")) {
$props['render_callback'] = function ($attributes, $content, $block) {
$slug = basename($block->name);
return \Roots\view("blocks.{$slug}.render", [
'attributes' => $attributes,
'content' => $content,
'block' => $block,
]);
};
}
register_block_type($block_json, $props);
}
});
function list_inner()
{
$file = file_get_contents(get_theme_file_path("resources/json/core-block-whitelist.json"));
$json = json_decode($file);
return $json;
}
function list_all()
{
$blocks = array_map(function($block) {
$name = $block->name;
return $block->name;
}, \WP_Block_Type_Registry::get_instance()->get_all_registered());
return array_values($blocks);
}
function list_custom()
{
return array_filter(list_all(), function($value){
if (str_starts_with($value, 'acf/') || str_starts_with($value, 'badegg/')) return $value;
});
}
function list_allowed()
{
$add_allowed = [];
return array_merge(
list_custom(),
list_inner(),
apply_filters('badegg_block_types_allow', $add_allowed),
);
}
function render_acf($block, $content = '', $is_preview = false, $post_id = 0, $wp_block = false, $context = false) {
$slug = basename($block['name']);
$block['slug'] = $slug;
$blade = \Roots\view(
"blocks.{$slug}.render",
[
'block' => $block,
'content' => $content,
'is_preview' => $is_preview,
'post_id' => $post_id,
'wp_block' => $wp_block,
'context' => $context,
],
);
if($blade) {
echo $blade;
} else {
ob_start(); ?>
<section class="section bg-error knockout">
<div class="container container-small align-centre wysiwyg">
<h2>Missing Blade Template</h2>
<p>(resources/views/blocks/<?= $slug ?>/render.blade.php)</p>
</div>
</section>
<?php echo ob_get_clean();
}
}

View File

@@ -46,16 +46,6 @@ add_filter('admin_head', function () {
])->toHtml();
});
add_action( 'enqueue_block_editor_assets', function(){
wp_enqueue_script(
'restrict-core-blocks',
Vite::asset('resources/js/admin/block-restrictions.js'),
array( 'wp-blocks', 'wp-dom-ready', 'wp-edit-blocks', 'wp-hooks' ),
'v1.0.0',
true
);
});
/**
* Use the generated theme.json file.
*

View File

@@ -35,8 +35,7 @@
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Blocks\\": "resources/views/blocks"
"App\\": "app/"
}
},
"require": {

View File

@@ -57,21 +57,7 @@ autoload_psr4('PostTypes');
autoload_psr4('ACF');
autoload_psr4('Utilities');
autoload_psr4('Admin');
autoload_psr4('Ajax');
function autoload_psr4_blocks() {
$path = __dir__ . '/resources/views/blocks/*';
$namespace = 'Blocks\\';
foreach(glob($path, GLOB_ONLYDIR) as $directory) {
$name = basename($directory);
$class = $namespace . $name . '\\' . $name;
new $class();
}
}
autoload_psr4_blocks();
/*
|--------------------------------------------------------------------------
@@ -85,7 +71,7 @@ autoload_psr4_blocks();
|
*/
collect(['setup', 'filters'])
collect(['setup', 'filters', 'blocks'])
->each(function ($file) {
if (! locate_template($file = "app/{$file}.php", true, true)) {
wp_die(

View File

@@ -7,6 +7,7 @@
"name": "sage",
"devDependencies": {
"@roots/vite-plugin": "^1.0.2",
"fast-glob": "^3.3.3",
"laravel-vite-plugin": "^1.2.0",
"sass": "^1.93.2",
"vite": "^6.2.0"
@@ -463,7 +464,6 @@
"integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.5.0",
"@jridgewell/trace-mapping": "^0.3.24"
@@ -475,7 +475,6 @@
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=6.0.0"
}
@@ -486,7 +485,6 @@
"integrity": "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@jridgewell/gen-mapping": "^0.3.5",
"@jridgewell/trace-mapping": "^0.3.25"
@@ -497,8 +495,7 @@
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
"integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/@jridgewell/trace-mapping": {
"version": "0.3.31",
@@ -506,12 +503,49 @@
"integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@jridgewell/resolve-uri": "^3.1.0",
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
"integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
"dev": true,
"license": "MIT",
"dependencies": {
"@nodelib/fs.stat": "2.0.5",
"run-parallel": "^1.1.9"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/@nodelib/fs.stat": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
"integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 8"
}
},
"node_modules/@nodelib/fs.walk": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
"integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@nodelib/fs.scandir": "2.1.5",
"fastq": "^1.6.0"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/@parcel/watcher": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.1.tgz",
@@ -1156,7 +1190,6 @@
"integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@types/estree": "*",
"@types/json-schema": "*"
@@ -1168,7 +1201,6 @@
"integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@types/eslint": "*",
"@types/estree": "*"
@@ -1186,8 +1218,7 @@
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
"integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/@types/node": {
"version": "24.9.2",
@@ -1195,7 +1226,6 @@
"integrity": "sha512-uWN8YqxXxqFMX2RqGOrumsKeti4LlmIMIyV0lgut4jx7KQBcBiW6vkDtIBvHnHIquwNfJhk8v2OtmO8zXWHfPA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"undici-types": "~7.16.0"
}
@@ -1206,7 +1236,6 @@
"integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@webassemblyjs/helper-numbers": "1.13.2",
"@webassemblyjs/helper-wasm-bytecode": "1.13.2"
@@ -1217,24 +1246,21 @@
"resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz",
"integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/@webassemblyjs/helper-api-error": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz",
"integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/@webassemblyjs/helper-buffer": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz",
"integrity": "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/@webassemblyjs/helper-numbers": {
"version": "1.13.2",
@@ -1242,7 +1268,6 @@
"integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@webassemblyjs/floating-point-hex-parser": "1.13.2",
"@webassemblyjs/helper-api-error": "1.13.2",
@@ -1254,8 +1279,7 @@
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz",
"integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/@webassemblyjs/helper-wasm-section": {
"version": "1.14.1",
@@ -1263,7 +1287,6 @@
"integrity": "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@webassemblyjs/helper-buffer": "1.14.1",
@@ -1277,7 +1300,6 @@
"integrity": "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@xtuc/ieee754": "^1.2.0"
}
@@ -1288,7 +1310,6 @@
"integrity": "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==",
"dev": true,
"license": "Apache-2.0",
"peer": true,
"dependencies": {
"@xtuc/long": "4.2.2"
}
@@ -1298,8 +1319,7 @@
"resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.13.2.tgz",
"integrity": "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/@webassemblyjs/wasm-edit": {
"version": "1.14.1",
@@ -1307,7 +1327,6 @@
"integrity": "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@webassemblyjs/helper-buffer": "1.14.1",
@@ -1325,7 +1344,6 @@
"integrity": "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@webassemblyjs/helper-wasm-bytecode": "1.13.2",
@@ -1340,7 +1358,6 @@
"integrity": "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@webassemblyjs/helper-buffer": "1.14.1",
@@ -1354,7 +1371,6 @@
"integrity": "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@webassemblyjs/helper-api-error": "1.13.2",
@@ -1370,7 +1386,6 @@
"integrity": "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@xtuc/long": "4.2.2"
@@ -1398,16 +1413,14 @@
"resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
"integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==",
"dev": true,
"license": "BSD-3-Clause",
"peer": true
"license": "BSD-3-Clause"
},
"node_modules/@xtuc/long": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz",
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
"dev": true,
"license": "Apache-2.0",
"peer": true
"license": "Apache-2.0"
},
"node_modules/acorn": {
"version": "8.15.0",
@@ -1429,7 +1442,6 @@
"integrity": "sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=10.13.0"
},
@@ -1461,7 +1473,6 @@
"integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"ajv": "^8.0.0"
},
@@ -1480,7 +1491,6 @@
"integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"fast-deep-equal": "^3.1.3"
},
@@ -1494,7 +1504,6 @@
"integrity": "sha512-JU0h5APyQNsHOlAM7HnQnPToSDQoEBZqzu/YBlqDnEeymPnZDREeXJA3KBMQee+dKteAxZ2AtvQEvVYdZf241Q==",
"dev": true,
"license": "Apache-2.0",
"peer": true,
"bin": {
"baseline-browser-mapping": "dist/cli.js"
}
@@ -1505,7 +1514,6 @@
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"fill-range": "^7.1.1"
},
@@ -1553,8 +1561,7 @@
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/caniuse-lite": {
"version": "1.0.30001751",
@@ -1575,8 +1582,7 @@
"url": "https://github.com/sponsors/ai"
}
],
"license": "CC-BY-4.0",
"peer": true
"license": "CC-BY-4.0"
},
"node_modules/chokidar": {
"version": "4.0.3",
@@ -1600,7 +1606,6 @@
"integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=6.0"
}
@@ -1610,8 +1615,7 @@
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/detect-libc": {
"version": "1.0.3",
@@ -1632,8 +1636,7 @@
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.244.tgz",
"integrity": "sha512-OszpBN7xZX4vWMPJwB9illkN/znA8M36GQqQxi6MNy9axWxhOfJyZZJtSLQCpEFLHP2xK33BiWx9aIuIEXVCcw==",
"dev": true,
"license": "ISC",
"peer": true
"license": "ISC"
},
"node_modules/enhanced-resolve": {
"version": "5.18.3",
@@ -1641,7 +1644,6 @@
"integrity": "sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"graceful-fs": "^4.2.4",
"tapable": "^2.2.0"
@@ -1655,8 +1657,7 @@
"resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz",
"integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/esbuild": {
"version": "0.25.11",
@@ -1706,7 +1707,6 @@
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=6"
}
@@ -1717,7 +1717,6 @@
"integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
"dev": true,
"license": "BSD-2-Clause",
"peer": true,
"dependencies": {
"esrecurse": "^4.3.0",
"estraverse": "^4.1.1"
@@ -1732,7 +1731,6 @@
"integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
"dev": true,
"license": "BSD-2-Clause",
"peer": true,
"dependencies": {
"estraverse": "^5.2.0"
},
@@ -1746,7 +1744,6 @@
"integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
"dev": true,
"license": "BSD-2-Clause",
"peer": true,
"engines": {
"node": ">=4.0"
}
@@ -1757,7 +1754,6 @@
"integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
"dev": true,
"license": "BSD-2-Clause",
"peer": true,
"engines": {
"node": ">=4.0"
}
@@ -1768,7 +1764,6 @@
"integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=0.8.x"
}
@@ -1778,8 +1773,24 @@
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
"dev": true,
"license": "MIT"
},
"node_modules/fast-glob": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz",
"integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==",
"dev": true,
"license": "MIT",
"peer": true
"dependencies": {
"@nodelib/fs.stat": "^2.0.2",
"@nodelib/fs.walk": "^1.2.3",
"glob-parent": "^5.1.2",
"merge2": "^1.3.0",
"micromatch": "^4.0.8"
},
"engines": {
"node": ">=8.6.0"
}
},
"node_modules/fast-uri": {
"version": "3.1.0",
@@ -1796,8 +1807,17 @@
"url": "https://opencollective.com/fastify"
}
],
"license": "BSD-3-Clause",
"peer": true
"license": "BSD-3-Clause"
},
"node_modules/fastq": {
"version": "1.19.1",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz",
"integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==",
"dev": true,
"license": "ISC",
"dependencies": {
"reusify": "^1.0.4"
}
},
"node_modules/fdir": {
"version": "6.5.0",
@@ -1823,7 +1843,6 @@
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"to-regex-range": "^5.0.1"
},
@@ -1846,21 +1865,32 @@
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"dev": true,
"license": "ISC",
"dependencies": {
"is-glob": "^4.0.1"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/glob-to-regexp": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz",
"integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==",
"dev": true,
"license": "BSD-2-Clause",
"peer": true
"license": "BSD-2-Clause"
},
"node_modules/graceful-fs": {
"version": "4.2.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
"dev": true,
"license": "ISC",
"peer": true
"license": "ISC"
},
"node_modules/has-flag": {
"version": "4.0.0",
@@ -1868,7 +1898,6 @@
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=8"
}
@@ -1886,7 +1915,6 @@
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
"dev": true,
"license": "MIT",
"optional": true,
"engines": {
"node": ">=0.10.0"
}
@@ -1897,7 +1925,6 @@
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"is-extglob": "^2.1.1"
},
@@ -1911,7 +1938,6 @@
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true,
"license": "MIT",
"optional": true,
"engines": {
"node": ">=0.12.0"
}
@@ -1922,7 +1948,6 @@
"integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@types/node": "*",
"merge-stream": "^2.0.0",
@@ -1937,16 +1962,14 @@
"resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
"integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/json-schema-traverse": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/json2php": {
"version": "0.0.7",
@@ -1981,7 +2004,6 @@
"integrity": "sha512-IWqP2SCPhyVFTBtRcgMHdzlf9ul25NwaFx4wCEH/KjAXuuHY4yNjvPXsBokp8jCB936PyWRaPKUNh8NvylLp2Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=6.11.5"
},
@@ -1995,8 +2017,17 @@
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
"dev": true,
"license": "MIT"
},
"node_modules/merge2": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
"integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
"dev": true,
"license": "MIT",
"peer": true
"engines": {
"node": ">= 8"
}
},
"node_modules/micromatch": {
"version": "4.0.8",
@@ -2004,7 +2035,6 @@
"integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"braces": "^3.0.3",
"picomatch": "^2.3.1"
@@ -2019,7 +2049,6 @@
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true,
"license": "MIT",
"optional": true,
"engines": {
"node": ">=8.6"
},
@@ -2033,7 +2062,6 @@
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">= 0.6"
}
@@ -2044,7 +2072,6 @@
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"mime-db": "1.52.0"
},
@@ -2076,8 +2103,7 @@
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/node-addon-api": {
"version": "7.1.1",
@@ -2092,8 +2118,7 @@
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz",
"integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/picocolors": {
"version": "1.1.1",
@@ -2108,6 +2133,7 @@
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@@ -2144,13 +2170,33 @@
"node": "^10 || ^12 || >=14"
}
},
"node_modules/queue-microtask": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
"integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/randombytes": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
"integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"safe-buffer": "^5.1.0"
}
@@ -2175,11 +2221,21 @@
"integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/reusify": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz",
"integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==",
"dev": true,
"license": "MIT",
"engines": {
"iojs": ">=1.0.0",
"node": ">=0.10.0"
}
},
"node_modules/rollup": {
"version": "4.52.5",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.52.5.tgz",
@@ -2222,6 +2278,30 @@
"fsevents": "~2.3.2"
}
},
"node_modules/run-parallel": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
"integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT",
"dependencies": {
"queue-microtask": "^1.2.2"
}
},
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
@@ -2241,8 +2321,7 @@
"url": "https://feross.org/support"
}
],
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/sass": {
"version": "1.93.2",
@@ -2250,6 +2329,7 @@
"integrity": "sha512-t+YPtOQHpGW1QWsh1CHQ5cPIr9lbbGZLZnbihP/D/qZj/yuV68m8qarcV17nvkOX81BCrvzAlq2klCQFZghyTg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"chokidar": "^4.0.0",
"immutable": "^5.0.2",
@@ -2271,7 +2351,6 @@
"integrity": "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@types/json-schema": "^7.0.9",
"ajv": "^8.9.0",
@@ -2292,7 +2371,6 @@
"integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==",
"dev": true,
"license": "BSD-3-Clause",
"peer": true,
"dependencies": {
"randombytes": "^2.1.0"
}
@@ -2303,7 +2381,6 @@
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true,
"license": "BSD-3-Clause",
"peer": true,
"engines": {
"node": ">=0.10.0"
}
@@ -2324,7 +2401,6 @@
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
@@ -2336,7 +2412,6 @@
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"has-flag": "^4.0.0"
},
@@ -2353,7 +2428,6 @@
"integrity": "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=6"
},
@@ -2368,7 +2442,6 @@
"integrity": "sha512-nIVck8DK+GM/0Frwd+nIhZ84pR/BX7rmXMfYwyg+Sri5oGVE99/E3KvXqpC2xHFxyqXyGHTKBSioxxplrO4I4w==",
"dev": true,
"license": "BSD-2-Clause",
"peer": true,
"dependencies": {
"@jridgewell/source-map": "^0.3.3",
"acorn": "^8.15.0",
@@ -2388,7 +2461,6 @@
"integrity": "sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@jridgewell/trace-mapping": "^0.3.25",
"jest-worker": "^27.4.5",
@@ -2441,7 +2513,6 @@
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"is-number": "^7.0.0"
},
@@ -2454,8 +2525,7 @@
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
"integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/update-browserslist-db": {
"version": "1.1.4",
@@ -2477,7 +2547,6 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"escalade": "^3.2.0",
"picocolors": "^1.1.1"
@@ -2495,6 +2564,7 @@
"integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"esbuild": "^0.25.0",
"fdir": "^6.4.4",
@@ -2594,7 +2664,6 @@
"integrity": "sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"glob-to-regexp": "^0.4.1",
"graceful-fs": "^4.1.2"
@@ -2659,7 +2728,6 @@
"integrity": "sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=10.13.0"
}

View File

@@ -17,6 +17,7 @@
},
"devDependencies": {
"@roots/vite-plugin": "^1.0.2",
"fast-glob": "^3.3.3",
"laravel-vite-plugin": "^1.2.0",
"sass": "^1.93.2",
"vite": "^6.2.0"

View File

@@ -0,0 +1,131 @@
{
"key": "group_block_acfdemo",
"title": "Block: ACF Demo",
"fields": [
{
"key": "field_693d7783d862a",
"label": "Content",
"name": "",
"aria-label": "",
"type": "accordion",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"open": 1,
"multi_expand": 1,
"endpoint": 0
},
{
"key": "field_693d779cd862b",
"label": "",
"name": "content",
"aria-label": "",
"type": "wysiwyg",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"allow_in_bindings": 0,
"tabs": "all",
"toolbar": "full",
"media_upload": 1,
"delay": 0
},
{
"key": "field_693d7764938f3",
"label": "Introduction",
"name": "block_intro",
"aria-label": "",
"type": "clone",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"clone": [
"group_clone_block_intro"
],
"display": "seamless",
"layout": "block",
"prefix_label": 0,
"prefix_name": 0
},
{
"key": "field_6940187f74afb",
"label": "Footer",
"name": "block_footer",
"aria-label": "",
"type": "clone",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"clone": [
"group_clone_block_footer"
],
"display": "seamless",
"layout": "block",
"prefix_label": 0,
"prefix_name": 0
},
{
"key": "field_693d776493992",
"label": "Settings",
"name": "block_settings",
"aria-label": "",
"type": "clone",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"clone": [
"group_clone_block_settings"
],
"display": "seamless",
"layout": "block",
"prefix_label": 0,
"prefix_name": 0
}
],
"location": [
[
{
"param": "block",
"operator": "==",
"value": "badegg\/acfdemo"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": true,
"description": "",
"show_in_rest": 0,
"display_title": "",
"modified": 1765814950
}

View File

@@ -17,7 +17,9 @@
"id": ""
},
"choices": {
"0": "<i class=\"fas fa-circle\" style=\"color: #FFFFFF\"><\/i> White",
"0": "auto",
"primary": "<i class=\"fas fa-circle\" style=\"color: #dd3333\"><\/i> Punch",
"white": "<i class=\"fas fa-circle\" style=\"color: #FFFFFF\"><\/i> White",
"black": "<i class=\"fas fa-circle\" style=\"color: #000000\"><\/i> Black"
},
"default_value": 0,
@@ -39,7 +41,29 @@
"type": "select",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"conditional_logic": [
[
{
"field": "field_67325dd23234e",
"operator": "!=",
"value": "0"
}
],
[
{
"field": "field_67325dd23234e",
"operator": "!=",
"value": "black"
}
],
[
{
"field": "field_67325dd23234e",
"operator": "!=",
"value": "white"
}
]
],
"wrapper": {
"width": "50",
"class": "",
@@ -113,5 +137,5 @@
"active": true,
"description": "",
"show_in_rest": 0,
"modified": 1764224358
"modified": 1765746167
}

View File

@@ -3,7 +3,7 @@
"title": "Clone: Block Footer",
"fields": [
{
"key": "field_67659b49a6db2",
"key": "field_694016b164221",
"label": "Footer",
"name": "",
"aria-label": "",
@@ -21,31 +21,11 @@
"endpoint": 0
},
{
"key": "field_67659b49a754a",
"label": "Blurb",
"name": "blurb_footer",
"key": "field_694016b164272",
"label": "",
"name": "footer",
"aria-label": "",
"type": "textarea",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"maxlength": "",
"rows": 3,
"placeholder": "",
"new_lines": ""
},
{
"key": "field_67659b7502137",
"label": "Links",
"name": "links",
"aria-label": "",
"type": "repeater",
"type": "group",
"instructions": "",
"required": 0,
"conditional_logic": 0,
@@ -55,19 +35,33 @@
"id": ""
},
"layout": "block",
"pagination": 0,
"min": 0,
"max": 2,
"collapsed": "",
"button_label": "Add Button",
"rows_per_page": 20,
"sub_fields": [
{
"key": "field_67659b8702138",
"label": "Button",
"name": "button",
"key": "field_694016b165315",
"label": "Blurb",
"name": "blurb",
"aria-label": "",
"type": "clone",
"type": "textarea",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"maxlength": "",
"rows": 3,
"placeholder": "",
"new_lines": ""
},
{
"key": "field_69401a2f06555",
"label": "Links",
"name": "links",
"aria-label": "",
"type": "repeater",
"instructions": "",
"required": 0,
"conditional_logic": 0,
@@ -76,49 +70,106 @@
"class": "",
"id": ""
},
"clone": [
"group_clone_button"
],
"display": "seamless",
"layout": "block",
"prefix_label": 0,
"prefix_name": 0,
"parent_repeater": "field_67659b7502137"
"pagination": 0,
"min": 0,
"max": 0,
"collapsed": "",
"button_label": "Add Row",
"rows_per_page": 20,
"sub_fields": [
{
"key": "field_69401a4006556",
"label": "Link",
"name": "link",
"aria-label": "",
"type": "clone",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"clone": [
"group_clone_button"
],
"display": "seamless",
"layout": "block",
"prefix_label": 0,
"prefix_name": 0,
"parent_repeater": "field_69401a2f06555"
}
]
},
{
"key": "field_694016b165337",
"label": "Alignment",
"name": "align",
"aria-label": "",
"type": "select",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {
"left": "Left",
"centre": "Centre",
"right": "Right"
},
"default_value": "centre",
"return_format": "value",
"multiple": 0,
"allow_null": 0,
"allow_in_bindings": 0,
"ui": 0,
"ajax": 0,
"placeholder": "",
"create_options": 0,
"save_options": 0
},
{
"key": "field_694016b16537f",
"label": "Container width",
"name": "container_width",
"aria-label": "",
"type": "select",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {
"0": "Auto",
"narrow": "Narrow",
"small": "Small",
"medium": "Medium",
"large": "Large",
"full": "Edge to edge"
},
"default_value": "narrow",
"return_format": "value",
"multiple": 0,
"allow_null": 0,
"allow_in_bindings": 0,
"ui": 0,
"ajax": 0,
"placeholder": "",
"create_options": 0,
"save_options": 0
}
]
},
{
"key": "field_682fb9ff58080",
"label": "Alignment",
"name": "footer_alignment",
"aria-label": "",
"type": "select",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {
"centre": "Centre",
"left": "Left",
"right": "Right"
},
"default_value": "centre",
"return_format": "value",
"multiple": 0,
"allow_null": 0,
"allow_in_bindings": 0,
"ui": 0,
"ajax": 0,
"placeholder": "",
"create_options": 0,
"save_options": 0
},
{
"key": "field_6828dac95eb68",
"key": "field_694016b1642c5",
"label": "Footer (end)",
"name": "",
"aria-label": "",
@@ -154,5 +205,6 @@
"active": true,
"description": "",
"show_in_rest": 0,
"modified": 1747958307
"display_title": "",
"modified": 1765809897
}

View File

@@ -21,52 +21,11 @@
"endpoint": 0
},
{
"key": "field_676599964d3cc",
"label": "Heading",
"name": "heading",
"key": "field_693f37ad7fa70",
"label": "",
"name": "intro",
"aria-label": "",
"type": "textarea",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "hfont",
"id": ""
},
"default_value": "",
"maxlength": "",
"allow_in_bindings": 0,
"rows": 2,
"placeholder": "",
"new_lines": ""
},
{
"key": "field_6765999d4d3cd",
"label": "Blurb",
"name": "blurb",
"aria-label": "",
"type": "textarea",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"maxlength": "",
"rows": 3,
"placeholder": "",
"new_lines": ""
},
{
"key": "field_68bf1126c2760",
"label": "Links",
"name": "links",
"aria-label": "",
"type": "repeater",
"type": "group",
"instructions": "",
"required": 0,
"conditional_logic": 0,
@@ -76,19 +35,34 @@
"id": ""
},
"layout": "block",
"pagination": 0,
"min": 0,
"max": 1,
"collapsed": "",
"button_label": "Add Button",
"rows_per_page": 20,
"sub_fields": [
{
"key": "field_68bf1171c2761",
"label": "Link",
"name": "link",
"key": "field_676599964d3cc",
"label": "Heading",
"name": "heading",
"aria-label": "",
"type": "clone",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "hfont",
"id": ""
},
"default_value": "",
"maxlength": "",
"allow_in_bindings": 0,
"placeholder": "",
"prepend": "",
"append": ""
},
{
"key": "field_6765999d4d3cd",
"label": "Blurb",
"name": "blurb",
"aria-label": "",
"type": "textarea",
"instructions": "",
"required": 0,
"conditional_logic": 0,
@@ -97,14 +71,74 @@
"class": "",
"id": ""
},
"clone": [
"group_clone_button"
],
"display": "seamless",
"layout": "block",
"prefix_label": 0,
"prefix_name": 0,
"parent_repeater": "field_68bf1126c2760"
"default_value": "",
"maxlength": "",
"rows": 3,
"placeholder": "",
"new_lines": ""
},
{
"key": "field_69400cbafb964",
"label": "Alignment",
"name": "align",
"aria-label": "",
"type": "select",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {
"left": "Left",
"centre": "Centre",
"right": "Right"
},
"default_value": "centre",
"return_format": "value",
"multiple": 0,
"allow_null": 0,
"allow_in_bindings": 0,
"ui": 0,
"ajax": 0,
"placeholder": "",
"create_options": 0,
"save_options": 0
},
{
"key": "field_693f3a7fae85e",
"label": "Container width",
"name": "container_width",
"aria-label": "",
"type": "select",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {
"0": "Auto",
"narrow": "Narrow",
"small": "Small",
"medium": "Medium",
"large": "Large",
"full": "Edge to edge"
},
"default_value": "narrow",
"return_format": "value",
"multiple": 0,
"allow_null": 0,
"allow_in_bindings": 0,
"ui": 0,
"ajax": 0,
"placeholder": "",
"create_options": 0,
"save_options": 0
}
]
},
@@ -145,5 +179,6 @@
"active": true,
"description": "",
"show_in_rest": 0,
"modified": 1757498726
"display_title": "",
"modified": 1765809893
}

View File

@@ -3,7 +3,7 @@
"title": "Clone: Block Settings",
"fields": [
{
"key": "field_673511c31122f",
"key": "field_69403228d2637",
"label": "Settings",
"name": "",
"aria-label": "",
@@ -17,15 +17,15 @@
"id": ""
},
"open": 0,
"multi_expand": 0,
"multi_expand": 1,
"endpoint": 0
},
{
"key": "field_680016e0fac24",
"label": "Anchor ID",
"name": "section_anchor_id",
"key": "field_694031b513e66",
"label": "",
"name": "settings",
"aria-label": "",
"type": "text",
"type": "group",
"instructions": "",
"required": 0,
"conditional_logic": 0,
@@ -34,155 +34,117 @@
"class": "",
"id": ""
},
"default_value": "",
"maxlength": "",
"placeholder": "",
"prepend": "#",
"append": ""
},
{
"key": "field_6800097e61765",
"label": "Container Width",
"name": "container_width",
"aria-label": "",
"type": "select",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {
"0": "Full Width",
"large": "Large",
"medium": "Medium",
"small": "Small",
"narrow": "Narrow"
},
"default_value": 0,
"return_format": "value",
"multiple": 0,
"allow_null": 0,
"ui": 0,
"ajax": 0,
"placeholder": ""
},
{
"key": "field_67350eb62cdf9",
"label": "Top Padding",
"name": "padding_top",
"aria-label": "",
"type": "radio",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "50",
"class": "",
"id": ""
},
"choices": [
"On",
"Off"
],
"default_value": "",
"return_format": "value",
"allow_null": 0,
"other_choice": 0,
"layout": "horizontal",
"save_other_choice": 0
},
{
"key": "field_673510c1dc830",
"label": "Bottom Padding",
"name": "padding_bottom",
"aria-label": "",
"type": "radio",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "50",
"class": "",
"id": ""
},
"choices": [
"On",
"Off"
],
"default_value": "",
"return_format": "value",
"allow_null": 0,
"other_choice": 0,
"layout": "horizontal",
"save_other_choice": 0
},
{
"key": "field_6735258c2d9ff",
"label": "Background",
"name": "",
"aria-label": "",
"type": "accordion",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"open": 0,
"multi_expand": 0,
"endpoint": 0
},
{
"key": "field_67350aeb146ca",
"label": "Background",
"name": "background",
"aria-label": "",
"type": "clone",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"clone": [
"group_clone_background_settings"
],
"display": "seamless",
"layout": "block",
"prefix_label": 0,
"prefix_name": 0
"sub_fields": [
{
"key": "field_67350eb62cdf9",
"label": "Top Padding",
"name": "padding_top",
"aria-label": "",
"type": "radio",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "50",
"class": "",
"id": ""
},
"choices": [
"On",
"Off"
],
"default_value": "",
"return_format": "value",
"allow_null": 0,
"other_choice": 0,
"layout": "horizontal",
"save_other_choice": 0
},
{
"key": "field_673510c1dc830",
"label": "Bottom Padding",
"name": "padding_bottom",
"aria-label": "",
"type": "radio",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "50",
"class": "",
"id": ""
},
"choices": [
"On",
"Off"
],
"default_value": "",
"return_format": "value",
"allow_null": 0,
"other_choice": 0,
"layout": "horizontal",
"save_other_choice": 0
},
{
"key": "field_6800097e61765",
"label": "Container Width",
"name": "container_width",
"aria-label": "",
"type": "select",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {
"0": "Auto",
"narrow": "Narrow",
"small": "Small",
"medium": "Medium",
"large": "Large",
"full": "Edge to edge"
},
"default_value": 0,
"return_format": "value",
"multiple": 0,
"allow_null": 0,
"allow_in_bindings": 1,
"ui": 0,
"ajax": 0,
"placeholder": "",
"create_options": 0,
"save_options": 0
},
{
"key": "field_67350aeb146ca",
"label": "Background",
"name": "background",
"aria-label": "",
"type": "clone",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"clone": [
"group_clone_background_settings"
],
"display": "seamless",
"layout": "block",
"prefix_label": 0,
"prefix_name": 0
}
]
},
{
"key": "field_67fff4d4ddbb7",
"label": "Angle",
"name": "angle",
"aria-label": "",
"type": "clone",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"clone": [
"group_clone_angle"
],
"display": "seamless",
"layout": "block",
"prefix_label": 1,
"prefix_name": 1
},
{
"key": "field_6828da67543fc",
"key": "field_69403239d2638",
"label": "Settings (end)",
"name": "",
"aria-label": "",
@@ -218,5 +180,6 @@
"active": true,
"description": "",
"show_in_rest": 0,
"modified": 1747508044
"display_title": "",
"modified": 1765815052
}

View File

@@ -14,13 +14,11 @@
@use "sections/footer";
// Components
@use "components/block";
@use "components/forms";
@use "components/button";
@use "components/card";
// Blocks
@use "blocks/BadExample";
// Page Styles
@use "views/page";

View File

@@ -0,0 +1,15 @@
.has-bg-image {
position: relative;
>.container {
position: relative;
z-index: 1;
}
.badegg-block-background {
position: absolute;
inset: 0;
}
}

View File

@@ -13,13 +13,13 @@ button {
button,
input[type="submit"] {
&.button {
&.btn {
appearance: none;
}
}
%button,
.button {
.btn {
display: inline-block;
padding: 0.5em 1.25em;
border: 0.125em solid colours.$black;
@@ -102,10 +102,10 @@ input[type="submit"] {
&.bigger { font-size: 1.5em; }
}
.button-wrap {
.btn-wrap {
margin: 1.5em -0.25em -0.25em;
.button {
.btn {
margin: 0.25em;
}
}

View File

@@ -2,10 +2,6 @@
@use "../global/variables/breakpoints";
@use "../global/variables/colours";
textarea {
min-height: 10.375em;
}
input,
textarea {
color: colours.$grey;

View File

@@ -1,53 +1,73 @@
@use "./app";
@use "app";
@use "global/variables/colours";
html :where(.wp-block) {
max-width: none;
}
.block-editor-block-list__layout .block-editor-block-list__block:not([contenteditable=true]) {
&:hover:after {
content: '';
outline: 2px solid colours.$wpblue;
position: absolute;
inset: 0;
}
&:focus:after {
outline-style: dashed;
}
}
.editor-styles-wrapper {
padding: 1em;
padding: 0;
background: transparent;
}
.editor-visual-editor {
.wp-block {
max-width: none;
&__post-title-wrapper {
position: sticky;
top: 0;
z-index: 100;
padding: 1rem;
margin: 0 !important;
background: white;
box-shadow: 0 0.5rem 1rem rgba(black, 0.15);
}
}
.editor-styles-wrapper {
background: colours.$grey-lightest;
.block-list-appender {
width: 350px;
max-width: 90%;
margin: 1em auto;
background: white;
}
&__post-title-wrapper {
padding: 1rem;
margin: 0 0 3rem !important;
background: white;
box-shadow: 0 0.5rem 1rem rgba(black, 0.15);
}
.wp-block-post-title {
position: relative;
padding: 0.5rem;
border: 1px solid rgba(black, 0.3);
margin: 0;
&::before {
content: 'Page Title';
position: absolute;
top: -0.5rem;
left: 0.5rem;
color: rgba(black, 0.3);
font-size: 0.8rem;
display: block;
padding: 0 0.5rem;
margin: 0;
background: white;
line-height: 1;
font-weight: 400;
}
}
.wp-block-post-content {
// background: white;
// box-shadow: 0 0.5rem 1rem rgba(black, 0.15);
}
}
.wp-block-post-title {
position: relative;
padding: 0.5rem;
border: 1px solid rgba(black, 0.3);
margin: 0;
&::before {
content: 'Page Title';
position: absolute;
top: -0.5rem;
left: 0.5rem;
color: rgba(black, 0.3);
font-size: 0.8rem;
display: block;
padding: 0 0.5rem;
margin: 0;
background: white;
line-height: 1;
font-weight: 400;
}
}
.is-root-container > .wp-block:not(.block-list-appender) {
max-width: none;
margin: 0;
}

View File

@@ -142,11 +142,7 @@ hr {
}
.align {
&-centre {
text-align: center;
}
&-right {
text-align: right;
}
&-left { text-align: left; }
&-centre, &-center { text-align: center; }
&-right { text-align: right; }
}

View File

@@ -27,9 +27,10 @@
}
.container {
width: 90%;
width: calc(100% - spacing.$innerMedium * 2);
margin: auto;
&-full { width: auto; }
&-large { max-width: spacing.$containerLarge; }
&-medium { max-width: spacing.$containerMedium; }
&-small { max-width: spacing.$containerSmall; }

View File

@@ -5,7 +5,7 @@
@mixin generate_button_colors($name, $hex) {
$buttons: (
".button",
".btn",
"button",
"input[type=submit]",
);

View File

@@ -1,5 +1,7 @@
@use "sass:color";
$wpblue: #2271b1;
//== Status
$success: #39b54a;
$error: #be1e2d;

View File

@@ -3,10 +3,11 @@ import.meta.glob([
'../fonts/**',
]);
import blocks from './blocks.js';
import Header from './sections/header.js';
// import.meta.glob('../views/blocks/**/{style.scss,script.js,view.js}', { eager: true })
import Header from '../views/sections/header/header.js';
import LazyLoad from './lib/Lazy.js';
LazyLoad();
blocks();
Header();

View File

@@ -1,6 +0,0 @@
// import BadExample from "./blocks/BadExample";
export default function()
{
// BadExample();
}

View File

@@ -0,0 +1,46 @@
import { useSelect } from '@wordpress/data';
/**
* AttachmentImage
*
* This component is used to display an image from the media library.
* It's meant as a JS companion to the PHP function `wp_get_attachment_image()`.
*
* @link https://www.briancoords.com/getting-wordpress-media-library-images-in-javascript/
*
* @param {object} props
* @param {number} props.imageId The ID of the image to display.
* @param {string} props.size The size of the image to display. Defaults to 'full'.
* @returns {*} React JSX
*/
export default function AttachmentImage({ imageId, size = 'full' }) {
const { image } = useSelect((select) => ({
image: select('core').getEntityRecord('postType', 'attachment', imageId),
}));
const imageAttributes = () =>{
let attributes = {
src: image.source_url,
alt: image.alt_text,
className: `attachment-${size} size-${size}`,
width: image.media_details.width,
height: image.media_details.height,
};
if (image.media_details && image.media_details.sizes && image.media_details.sizes[size]) {
attributes.src = image.media_details.sizes[size].source_url;
attributes.width = image.media_details.sizes[size].width;
attributes.height = image.media_details.sizes[size].height;
}
return attributes;
};
return (
<>
{image && (
<img {...imageAttributes()} />
)}
</>
)
}

View File

@@ -0,0 +1,33 @@
import { useSelect } from '@wordpress/data';
/**
* BackgroundImage
*
* This component is used to display a background image for a block based on its attributes.
*
* @param {object} props
* @param {string} props.background_image The url of the background image.
* @param {string} props.background_position The background-position property.
* @param {boolean} props.background_fixed Toggle for background-attachment: fixed.
* @param {number} props.background_opacity The opacity value applied to the image.
* @returns {*} React JSX
*/
export default function BackgroundImage({ background_url, background_position = 'center', background_fixed = false, background_opacity = 70 }) {
return (
<>
{background_url && (
<div
className="badegg-block-background"
style={{
backgroundImage: `url(${background_url})`,
backgroundPosition: background_position,
backgroundSize: 'cover',
backgroundAttachment: background_fixed ? 'fixed' : 'scroll',
opacity: Number(background_opacity) * 0.01,
}}
/>
)}
</>
)
}

View File

@@ -0,0 +1,233 @@
import { useSelect } from '@wordpress/data';
/**
* BlockSettings
*
* Bundles the <InspectorControls> used for several blocks
* *
* @param {object} props
* @param {number} props.attributes the data
* @param {string} props.setAttributes the state
* @returns {*} React JSX
*/
import { __ } from '@wordpress/i18n';
import { useState, useEffect } from '@wordpress/element';
import apiFetch from '@wordpress/api-fetch';
import {
Panel,
PanelBody,
PanelRow,
SelectControl,
ToggleControl,
RangeControl,
ColorPalette,
Button,
Spinner,
} from '@wordpress/components';
import {
InspectorControls,
BlockControls,
AlignmentToolbar,
MediaUpload,
MediaUploadCheck,
} from '@wordpress/block-editor';
export default function BlockSettings({ attributes, setAttributes }) {
const [ configOptions, setConfigOptions ] = useState([]);
const [ isLoading, setIsLoading ] = useState(true);
useEffect( () => {
let isMounted = true;
apiFetch( { path: '/badegg/v1/blocks/config' } )
.then( ( data ) => {
if ( isMounted ) {
setConfigOptions( data );
setIsLoading( false );
}
} )
.catch( () => {
if ( isMounted ) {
setConfigOptions( null );
setIsLoading( false );
}
} );
return () => {
isMounted = false;
};
}, [] );
if ( isLoading ) {
return (
<InspectorControls>
<Panel>
<PanelBody>
<Spinner />
</PanelBody>
</Panel>
</InspectorControls>
);
}
if ( ! configOptions ) {
return null;
}
const {
alignment,
container_width,
padding_top,
padding_bottom,
background_hex,
background_tint,
background_image,
background_opacity,
background_contrast,
background_fixed,
} = attributes;
return (
<>
<BlockControls>
<AlignmentToolbar
value={ alignment }
onChange={(value) => setAttributes({alignment: value})}
/>
</BlockControls>
<InspectorControls>
<Panel className="badegg-components-panel">
<PanelBody title={ __("Spacing", "badegg") }>
<SelectControl
label={ __("Container Width", "badegg") }
value={ container_width }
options={ configOptions.container }
onChange={ (value) => setAttributes({ container_width: value }) }
__next40pxDefaultSize={ true }
__nextHasNoMarginBottom={ true }
/>
<ToggleControl
label={ __('Top padding', 'badegg') }
checked={ padding_top }
onChange={(value) => setAttributes({ padding_top: value }) }
__nextHasNoMarginBottom
/>
<ToggleControl
label={ __('Bottom padding', 'badegg') }
checked={ padding_bottom }
onChange={(value) => setAttributes({ padding_bottom: value }) }
__nextHasNoMarginBottom
/>
</PanelBody>
<PanelBody title={ __("Background", "badegg") }>
<p style={{ textTransform: 'uppercase', fontSize: '11px' }} className="components-truncate components-text components-input-control__label">
{ __('Colour', 'badegg') }
</p>
<ColorPalette
colors={ configOptions.colours }
value={ background_hex }
clearable={ false }
disableCustomColors={ true }
style={{ marginBottom: '16px' }}
onChange={ ( value ) => {
let slug, hex, selected = '';
if(value) {
selected = configOptions.colours.find(
( c ) => c.color === value
);
hex = value;
}
if(selected) {
slug = selected.slug;
}
setAttributes( {
background_colour: slug,
background_hex: hex,
});
} }
/>
{ 'background_colour' in attributes && attributes.background_colour && ![0, '0', 'white', 'black'].includes(attributes.background_colour) ? (
<SelectControl
label={ __("Background Tint", "badegg") }
value={ background_tint }
options={ configOptions.tints }
onChange={ (value) => setAttributes({ background_tint: value }) }
__next40pxDefaultSize={ true }
__nextHasNoMarginBottom={ true }
/>
) : null }
{ background_image != 0 && (
<>
<ToggleControl
label={ __('Text Contrast', 'badegg') }
checked={ background_contrast }
onChange={(value) => setAttributes({ background_contrast: value }) }
__nextHasNoMarginBottom
/>
<ToggleControl
label={ __('Fixed Position', 'badegg') }
checked={ background_fixed }
onChange={(value) => setAttributes({ background_fixed: value }) }
__nextHasNoMarginBottom
/>
<RangeControl
__next40pxDefaultSize
__nextHasNoMarginBottom
label={ __("Opacity", "badegg") }
value={ background_opacity }
onChange={ ( value ) => setAttributes({ background_opacity: value }) }
min={ 5 }
max={ 100 }
/>
</>
)}
<PanelRow>
<MediaUploadCheck>
<MediaUpload
onSelect={ (media) => {
setAttributes({
background_image: media.id,
background_url: media.url,
});
}}
allowedTypes={ ['image'] }
value={ background_image }
render={ ({ open }) => (
<Button
onClick={ open }
variant="primary"
>
{ background_image ? __("Replace image", "badegg") : __("Choose image", "badegg") }
</Button>
)}
/>
</MediaUploadCheck>
{ background_image != 0 && (
<Button
onClick={ () => setAttributes({ background_image: 0 }) }
isDestructive
variant="secondary"
>
{ __("Remove image", "badegg") }
</Button>
)}
</PanelRow>
</PanelBody>
</Panel>
</InspectorControls>
</>
);
}

View File

@@ -0,0 +1,56 @@
export function containerClassNames(attributes, bgProps)
{
let classNames = [
'container',
];
if('container_width' in attributes)
classNames.push(`container-${attributes.container_width}`);
if('alignment' in attributes)
classNames.push(`align-${attributes.alignment}`);
return classNames;
}
export function sectionClassNames(attributes, defaultClasses = '', extraClasses = [])
{
let classNames = [
'section',
];
if('padding_top'in attributes && !attributes.padding_top)
classNames.push('section-zero-top');
if('padding_bottom'in attributes && !attributes.padding_bottom)
classNames.push('section-zero-bottom');
if('background_colour' in attributes && attributes.background_colour) {
let bg = `bg-${ attributes.background_colour }`;
if(
'background_tint' in attributes &&
attributes.background_tint != 0 &&
!['white', 'black'].includes(attributes.background_colour)
) {
bg += `-${ attributes.background_tint }`;
}
classNames.push(bg);
}
if('background_image' in attributes && attributes.background_image != '0')
classNames.push('has-bg-image');
if('background_contrast' in attributes && attributes.background_contrast)
classNames.push('knockout');
// combine arrays
classNames = classNames.concat(defaultClasses).concat(extraClasses);
// remove duplicate items
classNames = [ ...new Set(classNames) ];
return classNames;
}

View File

@@ -1,45 +1,46 @@
import domReady from '@wordpress/dom-ready';
import blockWhitelist from '../json/core-block-whitelist.json';
import.meta.glob('../views/blocks/**/{index.jsx,index.js}', { eager: true })
domReady(() => {
const TEXT_EDITOR_BLOCKS = [
// Design
'core/separator',
'core/spacer',
// Media
'core/cover',
'core/file',
'core/gallery',
'core/image',
'core/media-text',
'core/audio',
'core/video',
// Text
'core/footnotes',
'core/heading',
'core/list',
'core/code',
'core/details',
'core/list-item',
'core/missing',
'core/paragraph',
'core/preformatted',
'core/pullquote',
'core/quote',
'core/table',
'core/verse',
];
const restrictEditorParentBlocks = (settings, name) => {
const TEXT_EDITOR_BLOCKS = [
// Design
'core/separator',
'core/spacer',
// Media
'core/cover',
'core/file',
'core/gallery',
'core/image',
'core/media-text',
'core/audio',
'core/video',
// Text
'core/footnotes',
'core/heading',
'core/list',
'core/code',
'core/details',
'core/freeform',
'core/list-item',
'core/missing',
'core/paragraph',
'core/preformatted',
'core/pullquote',
'core/quote',
'core/table',
'core/verse',
];
if (TEXT_EDITOR_BLOCKS.includes(name)) {
settings.parent = ['acf/badegg-editor']
settings.parent = [
'acf/badegg-editor',
'badegg/article',
];
}
// console.log(settings, name)
return settings
}

View File

@@ -0,0 +1,26 @@
[
"core/separator",
"core/spacer",
"core/cover",
"core/file",
"core/gallery",
"core/image",
"core/media-text",
"core/audio",
"core/video",
"core/footnotes",
"core/heading",
"core/list",
"core/code",
"core/details",
"core/list-item",
"core/missing",
"core/paragraph",
"core/preformatted",
"core/pullquote",
"core/quote",
"core/table",
"core/verse"
]

View File

@@ -1,21 +0,0 @@
@if(@$data['section_anchor_id'])
<div id="{{ $data['section_anchor_id'] }}" class="section-anchor"></div>
@endif
<section
id="{{ $block['id'] }}"
class="badegg-block
@if(@$data['section_classes']) {{ implode(' ', $data['section_classes']) }} @endif
{{ @$block['className'] }}
">
<div class="section-{{ $block['name'] }}-inner">
<div class="container{{ @$data['container_width'] ? ' container-' . $data['container_width'] : '' }} block-content wysiwyg">
<InnerBlocks
allowedBlocks="{!! esc_attr( wp_json_encode( $data['allowed_blocks'] ) ) !!}"
template="{!! esc_attr( wp_json_encode( $data['template'] ) ) !!}"
/>
</div>
</div>
</section>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

View File

@@ -1,137 +0,0 @@
<?php
namespace Blocks\Editor;
use App\Utilities;
use App\ACF;
class Editor
{
public function __construct()
{
add_action('acf/init', [$this, 'init']);
}
public function init()
{
acf_register_block_type([
'name' => 'badegg-editor',
'title' => __('Text Editor'),
'description' => __('Long form text content with support for things like headings, lists, and images.'),
'render_callback' => [ $this, 'render'],
'category' => 'badegg',
'icon' => 'media-document',
'supports' => [
'align' => false,
'jsx' => true,
],
'example' => [
'attributes' => [
'mode' => 'preview',
'data' => [
'inserter' => true,
],
],
],
]);
}
public function render($block, $content = '', $is_preview = false)
{
$name = basename(__FILE__, '.php');
$themeURL = get_template_directory_uri();
if($is_preview && @$block['data']['inserter']):
echo '<img style="display: block; width: 100%" src="' . $themeURL . '/resources/views/blocks/' . $name . '/' . $name . '.jpg" />';
return;
endif;
$CssClasses = new Utilities\CssClasses;
$Colour = new Utilities\Colour;
$CloneGroup = new ACF\CloneGroup;
$data = [];
$fields = [
];
$fields = array_merge($fields, $CloneGroup->block_all());
foreach($fields as $field):
$data[$field] = get_field($field);
endforeach;
unset($block['data']);
$block['name'] = str_replace('acf/', '', $block['name']);
$data = array_merge($data, $block);
$data['section_classes'] = $CssClasses->section($data);
$data['allowed_blocks'] = $this->inner_blocks();
$data['template'] = $this->default_template();
$data['block'] = $block;
echo \Roots\view("blocks.$name.$name", [
'data' => $data,
'block' => $block,
])->render();
}
public function default_template()
{
return [
[
'core/heading',
[
'level' => 1,
'placeholder' => 'Heading',
],
],
[
'core/paragraph',
[
'placeholder' => 'You can type your own text, change the heading level, or delete it altogether. You can also type over this text.',
],
],
[
'core/paragraph',
[
'placeholder' => 'To adjust block settings, click the Text Editor icon floating above this block to display them in the sidebar.',
],
],
];
}
public function inner_blocks()
{
return [
// Design
'core/separator',
'core/spacer',
// Media
'core/cover',
'core/file',
'core/gallery',
'core/image',
'core/media-text',
'core/audio',
'core/video',
// Text
'core/footnotes',
'core/heading',
'core/list',
'core/code',
'core/details',
'core/freeform',
'core/list-item',
'core/missing',
'core/paragraph',
'core/preformatted',
'core/pullquote',
'core/quote',
'core/table',
'core/verse',
];
}
}

View File

@@ -0,0 +1,28 @@
{
"apiVersion": 3,
"name": "badegg/acfdemo",
"title": "ACF Demo",
"category": "badegg",
"icon": "media-document",
"description": "An example block powered by ACF",
"keywords": ["acf", "demo"],
"acf": {
"mode": "preview",
"validate": "false",
"renderCallback": "\\App\\Blocks\\render_acf"
},
"supports": {
"anchor": true,
"align": false,
"jsx": true
},
"example": {
"attributes": {
"mode": "preview",
"data": {
"inserter": true
}
}
}
}

View File

@@ -0,0 +1,4 @@
// block.json's editorStyle, applied in block editor and front end
.wp-block-acf-demo.block-editor-block-list__block {
display: block;
}

View File

@@ -0,0 +1 @@
// block.json's editorScript, loaded only in the block editor

View File

@@ -0,0 +1,10 @@
@extends('layouts.block-acf', [
'block' => $block,
'is_preview' => $is_preview,
'context' => $context,
'knockout' => true,
])
@section('block-content')
{!! the_field('content') !!}
@overwrite

View File

@@ -0,0 +1 @@
// block.json's script, loaded in block editor and front end

View File

@@ -0,0 +1,4 @@
// block.json's style, applied in block editor and front end
.wp-block-acf-demo {
display: block;
}

View File

@@ -0,0 +1 @@
// block.json's viewScript, applied on front end only

View File

@@ -0,0 +1,18 @@
{
"apiVersion": 3,
"name": "badegg/article",
"title": "Article Builder",
"category": "badegg",
"icon": {
"src": "format-aside",
"foreground": "#f58762"
},
"description": "A wrapper to contain core blocks",
"supports": {
"html": true,
"color": {
"background": false,
"text": false
}
}
}

View File

@@ -0,0 +1,4 @@
// block.json's editorStyle, applied in block editor and front end
.wp-block-badegg-article.block-editor-block-list__block {
display: block;
}

View File

@@ -0,0 +1,63 @@
// block.json's editorScript, loaded only in the block editor
import metadata from './block.json';
import { __ } from '@wordpress/i18n';
import { registerBlockType } from '@wordpress/blocks';
import {
useBlockProps,
InnerBlocks,
} from '@wordpress/block-editor';
import allowedBlocks from '../../../json/core-block-whitelist.json';
import { containerClassNames, sectionClassNames } from '../../../js/blocks/lib/classNames';
import BackgroundImage from '../../../js/blocks/components/BackgroundImage';
import BlockSettings from '../../../js/blocks/components/BlockSettings';
registerBlockType(metadata.name, {
edit({ attributes, setAttributes }) {
const blockProps = useBlockProps();
blockProps.className = sectionClassNames(attributes, blockProps.className, [ 'wysiwyg' ]).join(' ');
return (
<div { ...blockProps }>
<BlockSettings
attributes={ attributes }
setAttributes={ setAttributes }
/>
<div className={ containerClassNames(attributes).join(' ') }>
<InnerBlocks
allowedBlocks={ allowedBlocks }
defaultBlock={
{
name: "core/paragraph",
attributes: {
placeholder: "start typing",
}
}
}
/>
</div>
<BackgroundImage { ...attributes } />
</div>
);
},
save({ attributes }) {
const blockProps = useBlockProps.save();
blockProps.className = sectionClassNames(attributes, blockProps.className, [ 'wysiwyg' ] ).join(' ');
return (
<div { ...blockProps }>
<div className={ containerClassNames(attributes).join(' ') }>
<InnerBlocks.Content />
</div>
<BackgroundImage { ...attributes } />
</div>
)
}
});

View File

@@ -0,0 +1 @@
// block.json's script, loaded in block editor and front end

View File

@@ -0,0 +1,4 @@
// block.json's style, applied in block editor and front end
.wp-block-badegg-article {
display: block;
}

View File

@@ -0,0 +1 @@
// block.json's viewScript, applied on front end only

View File

@@ -0,0 +1,15 @@
{
"apiVersion": 3,
"name": "badegg/example",
"title": "Example",
"category": "badegg",
"icon": "cover-image",
"description": "This is an example of a custom native block",
"editorScript": "example-editor-script",
"editorStyle": "example-editor-style",
"style": "example-style",
"script": "example-script",
"supports": {
"html": false
}
}

View File

@@ -0,0 +1,5 @@
// block.json's editorStyle, applied in block editor and front end
.wp-block-badegg-example.block-editor-block-list__block {
display: block;
border: 2px solid red;
}

View File

@@ -0,0 +1,17 @@
// block.json's editorScript, loaded only in the block editor
import { registerBlockType } from '@wordpress/blocks';
import { useBlockProps } from '@wordpress/block-editor';
import metadata from './block.json';
registerBlockType(metadata.name, {
edit() {
const blockProps = useBlockProps();
return (
<section { ...blockProps }>
<h2>Bad Egg Block Example</h2>
</section>
);
}
});

View File

@@ -0,0 +1,3 @@
<div class="block-badegg-example">
<h2>Bad Egg Example Block (Blade)</h2>
</div>

View File

@@ -0,0 +1 @@
// block.json's script, loaded in block editor and front end

View File

@@ -0,0 +1,4 @@
// block.json's style, applied in block editor and front end
.wp-block-badegg-example {
display: block;
}

View File

@@ -0,0 +1 @@
// block.json's viewScript, applied on front end only

View File

@@ -0,0 +1,23 @@
@php
$settings = get_field('settings');
$sectionProps = [
'class' => implode(' ', $CssClasses->section(get_field('settings'), @$block['name'], @$knockout)),
];
$containerProps = [
'width' => @$settings['container_width'],
];
@endphp
<div id="{{ @$block['anchor'] }}" @if($is_preview) class="{{ $sectionProps['class'] }}" @else {!! get_block_wrapper_attributes($sectionProps) !!} @endif>
@include('partials.block-acf-intro', ['props' => get_field('intro'), 'settings' => $settings])
<div class="{{ implode(' ', $CssClasses->container($containerProps)) }}">
@yield('block-content')
</div>
@include('partials.block-acf-footer', ['props' => get_field('footer'), 'settings' => $settings])
</div>

View File

@@ -1,50 +1,11 @@
@if(@$data['section_anchor_id'])
<div id="{{ $data['section_anchor_id'] }}" class="section-anchor"></div>
@if(!$is_preview)
<div {!! get_block_wrapper_attributes() !!}>
@endif
<section
id="{{ $block['id'] }}"
class="badegg-block
@if(@$data['section_classes']) {{ implode(' ', $data['section_classes']) }} @endif
{{ @$block['className'] }}
">
<div class="section-{{ $block['name'] }}-inner">
@if(@$data['heading'] || @$data['blurb'])
<div class="section-intro inner inner-bottom @if($data['bg_colour'] != 'white') knockout @endif">
<div class="container">
<div class="section-intro-inner wysiwyg">
<h2>{{ @$data['heading'] }}</h2>
<p>{{ @$data['blurb'] }}</p>
</div>
@if(@$data['links'])
<div class="btn-wrap">
@foreach($data['links'] as $link)
@include('components.button', $link)
@endforeach
</div>
@endif
</div>
</div>
@endif
<div class="container{{ @$data['container_width'] ? ' container-' . $data['container_width'] : '' }} block-content">
@yield('block-content')
</div>
@if(@$data['links'])
<div class="section-footer inner-top">
<div class="container">
<div class="btn-wrap">
@foreach($data['links'] as $link)
@include('components.button', $link)
@endforeach
</div>
</div>
</div>
@endif
<div class="wp-block-inner">
@yield('block-content')
</div>
@if(!$is_preview)
</div>
</section>
@endif

View File

@@ -0,0 +1,30 @@
@if($props['blurb'])
@php
$containerProps = [
'width' => $props['container_width'],
'location' => 'block-footer',
'section' => true,
'align' => $props['align'],
'wysiwyg' => true,
];
@endphp
<div class="{{ implode(' ', $CssClasses->container($containerProps, @$settings)) }}">
@if($props['blurb']) <p>{{ $props['blurb'] }}</p> @endif
@if(@$props['links'])
<div class="section-footer inner-top">
<div class="container">
<div class="btn-wrap">
@foreach($props['links'] as $link)
@include('components.button', $link)
@endforeach
</div>
</div>
</div>
@endif
</div>
@endif

View File

@@ -0,0 +1,17 @@
@if(@$props['heading'] || @$props['blurb'])
@php
$containerProps = [
'width' => $props['container_width'],
'location' => 'block-intro',
'section' => true,
'align' => $props['align'],
'wysiwyg' => true,
];
@endphp
<div class="{{ implode(' ', $CssClasses->container($containerProps, @$settings)) }}">
@if($props['heading']) <h2>{{ $props['heading'] }}</h3> @endif
@if($props['blurb']) <p>{{ $props['blurb'] }}</p> @endif
</div>
@endif

View File

@@ -24,6 +24,8 @@ export default function Header() {
const position = body.offsetTop;
const header = document.querySelector(".site-header");
if(!header) return;
if (scrolled > position + header.offsetHeight) {
body.classList.add("scrolled");
} else {

View File

@@ -1,17 +1,49 @@
import { defineConfig } from 'vite'
import laravel from 'laravel-vite-plugin'
import { wordpressPlugin, wordpressThemeJson } from '@roots/vite-plugin';
import fg from 'fast-glob';
import path from 'path';
function blockAsset(file)
{
const files = fg.sync('resources/views/blocks/**/' + file);
let list = {};
files.forEach(file => {
const parts = file.split(path.sep);
const fileName = parts[parts.length - 1];
const extension = fileName.split('.').pop();
const blockName = parts[parts.length - 2];
list[`blocks/${blockName}/${fileName.replace('.' + extension, '')}`] = `resources/views/blocks/${blockName}/${fileName}`;
});
return list;
}
const editorStyle = blockAsset('editor.scss');
const script = blockAsset('script.js');
const viewScript = blockAsset('view.js');
const style = blockAsset('style.scss');
export default defineConfig({
base: '/app/themes/badegg/public/build/',
plugins: [
laravel({
input: [
'resources/css/app.scss',
'resources/js/app.js',
'resources/css/editor.scss',
'resources/js/editor.js',
],
input: {
// 'resources/css/app.scss',
// 'resources/js/app.js',
// 'resources/css/editor.scss',
// 'resources/js/editor.js',
'css/app': 'resources/css/app.scss',
'js/app': 'resources/js/app.js',
'css/editor': 'resources/css/editor.scss',
'js/editor': 'resources/js/editor.js',
...editorStyle,
...viewScript,
...script,
...style,
},
refresh: true,
url: process.env.APP_URL,
}),