Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Started work on interactivity api work with an example. #941

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/272.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/481.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/535.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/980.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/blocks/add-to-calendar/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => '754b4dfa4e592032751e');
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => 'd363e7f0b415ef3e95a3');
2 changes: 1 addition & 1 deletion build/blocks/add-to-calendar/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/blocks/event-date/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('moment', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n'), 'version' => '2a87e9e9bf69563aeae1');
<?php return array('dependencies' => array('moment', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n'), 'version' => 'fbdfb147c6c684a7d803');
4 changes: 2 additions & 2 deletions build/blocks/event-date/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/blocks/events-list/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '97b565c364ee272e7701');
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '5a8bd90dfac508ab2c54');
2 changes: 1 addition & 1 deletion build/blocks/events-list/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/blocks/online-event/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '120d638313cd180d9338');
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '6b29b724d454d963ac65');
2 changes: 1 addition & 1 deletion build/blocks/online-event/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/blocks/rsvp-response/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '1dfd2576a31f517fef45');
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '94657e92928e2e24a9d3');
2 changes: 1 addition & 1 deletion build/blocks/rsvp-response/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/blocks/rsvp/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '3b137897829338f9530a');
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '4cc0d5b440604a182d58');
2 changes: 1 addition & 1 deletion build/blocks/rsvp/index.js

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions build/blocks/test/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "gatherpress/test",
"version": "0.1.0",
"title": "Test",
"category": "widgets",
"icon": "smiley",
"description": "Example block scaffolded with Create Block tool.",
"example": {},
"supports": {
"html": false,
"interactivity": true
},
"textdomain": "gatherpress",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"render": "file:./render.php",
"viewScriptModule": "file:./view.js"
}
1 change: 1 addition & 0 deletions build/blocks/test/index-rtl.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.wp-block-create-block-todolist{border:1px dotted red}
1 change: 1 addition & 0 deletions build/blocks/test/index.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => '595522ffcd4dee9af4b0');
1 change: 1 addition & 0 deletions build/blocks/test/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.wp-block-create-block-todolist{border:1px dotted red}
1 change: 1 addition & 0 deletions build/blocks/test/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions build/blocks/test/render.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
$unique_id = wp_unique_id( 'p-' );
?>

<div
<?php echo get_block_wrapper_attributes(); ?>
data-wp-interactive="create-block"
<?php echo wp_interactivity_data_wp_context( array( 'isOpen' => false ) ); ?>
data-wp-watch="callbacks.logIsOpen"
>
<button
data-wp-on--click="actions.toggle"
data-wp-bind--aria-expanded="context.isOpen"
aria-controls="<?php echo esc_attr( $unique_id ); ?>"
>
<?php esc_html_e( 'Toggle', 'donation-calculator' ); ?>
</button>

<p
id="<?php echo esc_attr( $unique_id ); ?>"
data-wp-bind--hidden="!context.isOpen"
>
<?php
esc_html_e( 'Donation Calculator - hello from an interactive block!', 'donation-calculator' );
?>
</p>
</div>
1 change: 1 addition & 0 deletions build/blocks/test/style-index-rtl.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions build/blocks/test/style-index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions build/blocks/test/view.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('@wordpress/interactivity'), 'version' => '14b981d5b2a7ca6ef0ef', 'type' => 'module');
1 change: 1 addition & 0 deletions build/blocks/test/view.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/blocks/venue/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('moment', 'react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n'), 'version' => '48c337124ea797af392b');
<?php return array('dependencies' => array('moment', 'react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n'), 'version' => 'a0e47b9963a1c027e94e');
4 changes: 2 additions & 2 deletions build/blocks/venue/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/blocks/venue/venue.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => 'ac43be418ed67d7ea96a');
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-components', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => '8e319152ee2a4c6bce1a');
2 changes: 1 addition & 1 deletion build/blocks/venue/venue.js

Large diffs are not rendered by default.

Binary file added build/images/layers-2x.8f2c4d11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/images/layers.416d9136.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/images/marker-icon-2x.680f69f3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/images/marker-icon.2b3e1faf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/images/marker-shadow.a0c6cc14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion build/profile_style.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '15d01c9dc99209264b1e');
<?php return array('dependencies' => array(), 'version' => '5ad55e96c95a60dea038');
2 changes: 1 addition & 1 deletion build/profile_style.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/settings_style.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '9c37901c158173551201');
<?php return array('dependencies' => array(), 'version' => 'c56489ba63321625e127');
2 changes: 1 addition & 1 deletion build/settings_style.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions includes/core/classes/class-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,28 @@ protected function setup_hooks(): void {
add_action( 'wp_head', array( $this, 'add_global_object' ), PHP_INT_MIN );
// Set priority to 11 to not conflict with media modal.
add_action( 'admin_footer', array( $this, 'event_communication_modal' ), 11 );
// add_action( 'wp_enqueue_scripts', function() {
//// wp_enqueue_script( 'wp-interactivity' );
// $asset = $this->get_asset_data( 'test' );
// // Enqueue the JS file.
// // It assumes that the JS file is in the same directory as this PHP file
//// wp_enqueue_script(
//// '@my-plugin/entry',
//// $this->build . 'test.js',
//// $asset['dependencies'],
//// $asset['version'],
//// true
//// );
// if ( ! wp_script_is( 'wp-interactivity', 'registered' ) ) {
// wp_enqueue_script( 'wp-interactivity', 'http://gatherpress-org.test/wp-includes/js/dist/interactivity.js', array(), false, true );
// }
// wp_enqueue_script_module(
// '@my-plugin/entry',
// $this->build . 'test.js',
// $asset['dependencies'],
// $asset['version'],
// );
// });
}

/**
Expand Down
Loading
Loading