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

Rewrite front js in vanilla - Fix #121 #162

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
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
54 changes: 54 additions & 0 deletions .versionrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"bumpFiles": [
{
"filename": "accordion-blocks.php",
"updater": "updater.js"
},
{
"filename": "package.json",
"type": "json"
},
{
"filename": "block.json",
"type": "json"
},
{
"filename": "composer.json",
"type": "json"
}
],
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "refactor",
"section": "Refactor"
},
{
"type": "perf",
"section": "Performances"
},
{
"type": "test",
"section": "Tests"
},
{
"type": "build",
"section": "Build System"
},
{
"type": "ci",
"section": "CI"
},
{
"type": "docs",
"section": "Documentation"
}
]
}
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.8.0](https://github.com/corentin-gautier/Accordion-Blocks/compare/v1.7.1...v1.8.0) (2024-11-25)


### Features

* add composer.json ([98d3b04](https://github.com/corentin-gautier/Accordion-Blocks/commit/98d3b045b0e66d8ef8b585d1b18cdb353f8c9af4))

### [1.7.1](https://github.com/corentin-gautier/Accordion-Blocks/compare/v1.7.0...v1.7.1) (2024-07-03)


### Bug Fixes

* css for open state and missing styles ([f3947e9](https://github.com/corentin-gautier/Accordion-Blocks/commit/f3947e964b51a50f5c28eaf12eaa02c28859bb5b))


### Documentation

* Update and rename readme.txt to README.md ([2fcddf1](https://github.com/corentin-gautier/Accordion-Blocks/commit/2fcddf1148a33a6e5582a3450b4feb51507cc0d8))

## 1.7.0 (2023-02-18)


### Features

* add ctrl+f detection ([5591c14](https://github.com/corentin-gautier/Accordion-Blocks/commit/5591c14663e9825a939ef52765992aeebf20cb7c))
* add more block supports ([f6e7511](https://github.com/corentin-gautier/Accordion-Blocks/commit/f6e7511cb77475e1c1593d46146cbca465c0a687))


### Bug Fixes

* compile css ([3b49840](https://github.com/corentin-gautier/Accordion-Blocks/commit/3b49840519affea6169abdd62556c98db6689191)), closes [#1](https://github.com/corentin-gautier/Accordion-Blocks/issues/1) [#2](https://github.com/corentin-gautier/Accordion-Blocks/issues/2)
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Accordion Blocks

Forked from [https://github.com/philbuchanan/Accordion-Blocks](https://github.com/philbuchanan/Accordion-Blocks)

## Description

Vanilla js version of Phil's accordeon plugin for Wordpress to avoid requiring jQuery

## Changelog

See [CHANGELOG.md](CHANGELOG.md)
13 changes: 9 additions & 4 deletions accordion-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: Accordion Blocks
* Plugin URI: https://github.com/philbuchanan/Accordion-Blocks
* Description: Gutenberg blocks for creating responsive accordion drop-downs.
* Version: 1.5.0
* Version: 1.8.0
* Requires at least: 5.9
* Tested up to: 5.9
* Requires PHP: 7.3
Expand Down Expand Up @@ -94,7 +94,7 @@ public function enqueue_frontend_assets() {
wp_register_script(
'pb-accordion-blocks-frontend-script',
plugins_url("js/accordion-blocks$min.js", __FILE__),
array('jquery'),
null,
$this->plugin_version,
true
);
Expand All @@ -110,7 +110,7 @@ public function enqueue_frontend_assets() {

if ($load_scripts_globally || has_block('pb/accordion-item', get_the_ID())) {
wp_enqueue_script('pb-accordion-blocks-frontend-script');
wp_enqueue_style('pb-accordion-blocks-style');
wp_enqueue_style('pb-accordion-blocks-style');
}
}

Expand All @@ -121,7 +121,7 @@ public function enqueue_frontend_assets() {
*/
public function enqueue_assets_on_render($output) {
wp_enqueue_script('pb-accordion-blocks-frontend-script');
wp_enqueue_style('pb-accordion-blocks-style');
wp_enqueue_style('pb-accordion-blocks-style');
return $output;
}

Expand Down Expand Up @@ -151,6 +151,9 @@ public function register_settings() {
'initiallyOpen' => array(
'type' => 'boolean',
),
'openBreakpoint' => array(
'type' => 'number',
),
'clickToClose' => array(
'type' => 'boolean',
),
Expand All @@ -168,6 +171,7 @@ public function register_settings() {
),
'default' => array(
'initiallyOpen' => false,
'openBreakpoint' => 0,
'clickToClose' => true,
'autoClose' => true,
'scroll' => false,
Expand Down Expand Up @@ -238,6 +242,7 @@ public function api_set_defaults($request) {

$new_defaults = (object) array(
'initiallyOpen' => isset($new_defaults->initiallyOpen) ? $new_defaults->initiallyOpen : $old_defaults->initiallyOpen,
'initiallyOpen' => isset($new_defaults->openBreakpoint) ? $new_defaults->openBreakpoint : $old_defaults->openBreakpoint,
'clickToClose' => isset($new_defaults->clickToClose) ? $new_defaults->clickToClose : $old_defaults->clickToClose,
'autoClose' => isset($new_defaults->autoClose) ? $new_defaults->autoClose : $old_defaults->autoClose,
'scroll' => isset($new_defaults->scroll) ? $new_defaults->scroll : $old_defaults->scroll,
Expand Down
21 changes: 20 additions & 1 deletion block.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"apiVersion": "2",
"version": "1.8.0",
"name": "pb/accordion-item",
"title": "Accordion Item",
"category": "text",
Expand All @@ -14,6 +15,10 @@
"type": "boolean",
"default": false
},
"openBreakpoint": {
"type": "number",
"default": 0
},
"clickToClose": {
"type": "boolean",
"default": true
Expand All @@ -39,7 +44,21 @@
}
},
"supports": {
"anchor": true
"anchor": true,
"align": true,
"ariaLabel": true,
"className": true,
"spacing": {
"margin": true,
"padding": true,
"blockGap": true
},
"color": {
"gradients": true,
"background": true,
"text": true,
"link": true
}
},
"editorScript": "file:./build/index.js",
"editorStyle": "file:./build/index.css"
Expand Down
2 changes: 1 addition & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '348416c729ba3f21f077b8a632fd9ba7');
<?php return array('dependencies' => array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'c978629e8cce23a4c4c5864bc9b751f5');
4 changes: 2 additions & 2 deletions build/index.css

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

Loading