-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add stackable integration #22
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
Open
Arukuen
wants to merge
1
commit into
develop
Choose a base branch
from
feat/55-stackable-integration
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/integrations/stackable/action-types/class-action-type-stackable-accordion-toggle.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <?php | ||
| // Exit if accessed directly. | ||
| if ( ! defined( 'ABSPATH' ) ) { | ||
| exit; | ||
| } | ||
|
|
||
| if ( ! class_exists( 'Interact_Action_Type_Stackable_Accordion_Toggle' ) ) { | ||
| class Interact_Action_Type_Stackable_Accordion_Toggle extends Interact_Abstract_Action_Type { | ||
| public function initialize() { | ||
| $this->name = 'stackableAccordionToggle'; | ||
| $this->category = 'stackable'; | ||
| $this->type = 'time'; | ||
|
|
||
| $this->label = __( 'Stackable Accordion Toggle', 'interactions' ); | ||
| $this->description = __( 'Toggle a Stackable Accordion', 'interactions' ); | ||
|
|
||
| $this->keywords = []; | ||
|
|
||
| $this->properties = [ | ||
| 'stateAction' => [ | ||
| 'name' => __( 'What action to apply', 'interactions' ), | ||
| 'type' => 'select', | ||
| 'default' => 'toggle', | ||
| 'options' => [ | ||
| [ 'label' => __( 'Toggle (both Open & Close)', 'interactions' ), 'value' => 'toggle' ], | ||
| [ 'label' => __( 'Open', 'interactions' ), 'value' => 'open' ], | ||
| [ 'label' => __( 'Close', 'interactions' ), 'value' => 'close' ], | ||
| ], | ||
| ], | ||
| ]; | ||
|
|
||
| $this->has_starting_state = false; | ||
| $this->has_preview = false; | ||
| $this->has_duration = false; | ||
| $this->has_easing = false; | ||
| } | ||
| } | ||
|
|
||
| interact_add_action_type( 'stackableAccordionToggle', 'Interact_Action_Type_Stackable_Accordion_Toggle' ); | ||
| } |
39 changes: 39 additions & 0 deletions
39
...integrations/stackable/action-types/class-action-type-stackable-carousel-change-slide.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?php | ||
| // Exit if accessed directly. | ||
| if ( ! defined( 'ABSPATH' ) ) { | ||
| exit; | ||
| } | ||
|
|
||
| if ( ! class_exists( 'Interact_Action_Type_Stackable_Carousel_Change_Slide' ) ) { | ||
| class Interact_Action_Type_Stackable_Carousel_Change_Slide extends Interact_Abstract_Action_Type { | ||
| public function initialize() { | ||
| $this->name = 'stackableCarouselChangeSlide'; | ||
| $this->category = 'stackable'; | ||
| $this->type = 'time'; | ||
|
|
||
| $this->label = __( 'Stackable Carousel Change Slide', 'interactions' ); | ||
| $this->description = __( 'Change the current slide of the Stackable Carousel', 'interactions' ); | ||
|
|
||
| $this->keywords = []; | ||
|
|
||
| $this->properties = [ | ||
| 'slide' => [ | ||
| 'name' => __( 'Slide', 'interactions' ), | ||
| 'type' => 'number', | ||
| 'default' => '', | ||
| 'min' => 1, | ||
| 'max' => 10, | ||
| 'step' => 1, | ||
| 'help' => __( 'The slide number to change into. Leave this blank to change into the next slide.', 'interactions' ), | ||
| ], | ||
| ]; | ||
|
|
||
| $this->has_starting_state = false; | ||
| $this->has_preview = false; | ||
| $this->has_duration = false; | ||
| $this->has_easing = false; | ||
| } | ||
| } | ||
|
|
||
| interact_add_action_type( 'stackableCarouselChangeSlide', 'Interact_Action_Type_Stackable_Carousel_Change_Slide' ); | ||
| } |
27 changes: 27 additions & 0 deletions
27
src/integrations/stackable/action-types/class-action-type-stackable-count-up-reset.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| <?php | ||
| // Exit if accessed directly. | ||
| if ( ! defined( 'ABSPATH' ) ) { | ||
| exit; | ||
| } | ||
|
|
||
| if ( ! class_exists( 'Interact_Action_Type_Stackable_Count_Up_Reset' ) ) { | ||
| class Interact_Action_Type_Stackable_Count_Up_Reset extends Interact_Abstract_Action_Type { | ||
| public function initialize() { | ||
| $this->name = 'stackableCountUpReset'; | ||
| $this->category = 'stackable'; | ||
| $this->type = 'time'; | ||
|
|
||
| $this->label = __( 'Stackable Count Up Reset', 'interactions' ); | ||
| $this->description = __( 'Reset the Stackable Count Up', 'interactions' ); | ||
|
|
||
| $this->keywords = []; | ||
|
|
||
| $this->has_starting_state = false; | ||
| $this->has_preview = false; | ||
| $this->has_duration = false; | ||
| $this->has_easing = false; | ||
| } | ||
| } | ||
|
|
||
| interact_add_action_type( 'stackableCountUpReset', 'Interact_Action_Type_Stackable_Count_Up_Reset' ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the Stackable scan out of
processSourceDir().sourceDirs.forEach( processSourceDir )invokes this block once per source root, so premium builds process the same Stackable files twice and race to overwrite the samedist/frontend/{interactions,actions}outputs. Please run this scan once, and mirror the earlierexistsSyncguard before eachreaddirSync.💡 Suggested refactor
const processSourceDir = sourceDir => { console.log( `📁 Processing frontend scripts from ${ sourceDir }` ) @@ - // Stackable intergration interaction types - fs.readdirSync( path.resolve( __dirname, '../src/integrations/stackable/interaction-types/frontend' ) ) - .filter( file => file.endsWith( '.js' ) ) - .forEach( async file => { - const type = file.replace( '.js', '' ) - const scriptPath = path.resolve( __dirname, `../src/integrations/stackable//interaction-types/frontend/${ file }` ) - const scriptPathRelative = path.relative( path.resolve( __dirname, '../' ), scriptPath ) - const outputFile = path.resolve( __dirname, `../dist/frontend/interactions/${ type }.php` ) - const content = fs.readFileSync( scriptPath, 'utf8' ) - - if ( buildType === 'development' ) { - writeFile( content, outputFile, scriptPathRelative ) - } else { - await minify( { - compressor: uglifyJS, - content, - output: outputFile, - } ).then( min => { - writeFile( min, outputFile, scriptPathRelative ) - } ) - } - } ) - - // Stackable intergration action types - fs.readdirSync( path.resolve( __dirname, '../src/integrations/stackable/action-types/frontend' ) ) - .filter( file => file.endsWith( '.js' ) ) - .forEach( async file => { - const type = file.replace( '.js', '' ) - const scriptPath = path.resolve( __dirname, `../src/integrations/stackable/action-types/frontend/${ file }` ) - const scriptPathRelative = path.relative( path.resolve( __dirname, '../' ), scriptPath ) - const outputFile = path.resolve( __dirname, `../dist/frontend/actions/${ type }.php` ) - const content = fs.readFileSync( scriptPath, 'utf8' ) - - if ( buildType === 'development' ) { - writeFile( content, outputFile, scriptPathRelative ) - } else { - await minify( { - compressor: uglifyJS, - content, - output: outputFile, - } ).then( min => { - writeFile( min, outputFile, scriptPathRelative ) - } ) - } - } ) } + +const processStackableDirs = () => { + const stackableInteractionDir = path.resolve( __dirname, '../src/integrations/stackable/interaction-types/frontend' ) + if ( fs.existsSync( stackableInteractionDir ) ) { + fs.readdirSync( stackableInteractionDir ) + .filter( file => file.endsWith( '.js' ) ) + .forEach( async file => { + const type = file.replace( '.js', '' ) + const scriptPath = path.resolve( stackableInteractionDir, file ) + const scriptPathRelative = path.relative( path.resolve( __dirname, '../' ), scriptPath ) + const outputFile = path.resolve( __dirname, `../dist/frontend/interactions/${ type }.php` ) + const content = fs.readFileSync( scriptPath, 'utf8' ) + if ( buildType === 'development' ) { + writeFile( content, outputFile, scriptPathRelative ) + } else { + await minify( { compressor: uglifyJS, content, output: outputFile } ).then( min => { + writeFile( min, outputFile, scriptPathRelative ) + } ) + } + } ) + } + + const stackableActionDir = path.resolve( __dirname, '../src/integrations/stackable/action-types/frontend' ) + if ( fs.existsSync( stackableActionDir ) ) { + fs.readdirSync( stackableActionDir ) + .filter( file => file.endsWith( '.js' ) ) + .forEach( async file => { + const type = file.replace( '.js', '' ) + const scriptPath = path.resolve( stackableActionDir, file ) + const scriptPathRelative = path.relative( path.resolve( __dirname, '../' ), scriptPath ) + const outputFile = path.resolve( __dirname, `../dist/frontend/actions/${ type }.php` ) + const content = fs.readFileSync( scriptPath, 'utf8' ) + if ( buildType === 'development' ) { + writeFile( content, outputFile, scriptPathRelative ) + } else { + await minify( { compressor: uglifyJS, content, output: outputFile } ).then( min => { + writeFile( min, outputFile, scriptPathRelative ) + } ) + } + } ) + } +} // Process all source directories sourceDirs.forEach( processSourceDir ) +processStackableDirs()🤖 Prompt for AI Agents