Conversation
- Bump version to 0.3.0 - Change plugin-flanker from file dependency to peer dependency ^1.0.0 - Update CHANGELOG with refactoring details - Update README compatibility section to note plugin requirement The timeline package now properly declares the plugin as a peer dependency, which users will need to install alongside the timeline package.
- Installed plugin-flanker v1.0.0 from npm (now published) - Package now properly depends on published plugin as peer dependency - Refactored trial creation to use plugin for stimulus presentation - Plugin handles RAF-based SOA timing and response collection - Timeline package focuses on experiment orchestration - Added comprehensive source files for timeline management - Added multiple example demonstrations All builds successful with published plugin dependency. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The soa parameter is only added to timeline variables when soa_config is provided in the timeline options. When not provided, the plugin was trying to access a non-existent timeline variable, causing an error. Now uses try/catch to gracefully handle missing soa variable and defaults to 0 when not present. Fixes: Timeline variable soa not found error 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Previous implementation used try/catch to check if timeline variable existed, which was awkward and error-prone. New approach: - Pass boolean flag to createFlankerTrial based on whether soa config is provided - Only access timeline variable when we know it exists - Cleaner conditional logic without try/catch - SOA properly recorded in data when present This maintains the original design where SOA can vary per trial (sampled from array or range) via timeline variables, but handles the case where no SOA is configured more gracefully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Following jspsych-timelines convention, all utility functions and trial components are now exported under a single 'utils' object: jsPsychTimelineArrowFlankerTask.utils.createFlankerTrial() jsPsychTimelineArrowFlankerTask.utils.generateTrialVariables() etc. This matches the pattern used in other timeline packages (go-nogo, false-memory, spatial-cueing). Types and constants remain as direct exports for convenience. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Removed internal utilities from exports: - generateTrialVariables (internal trial generation) - mergeConfig (internal configuration merging) - All type/constant exports except ArrowFlankerConfig Kept only trial components that users might need for custom timelines: - createFixationTrial - createFlankerTrial - createITITrial - createBlockBreak Plus ArrowFlankerConfig type for TypeScript users. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Previous approach tried to track sequential effects via timeline variables, which was error-prone and required pre-calculating previous trial info. New approach: - Use on_finish callback to look at actual previous trial data - Query jsPsych.data.get() for last flanker trial - Record previous_congruency and previous_correct from actual data - No need to track in timeline variables generation Benefits: - Simpler and more reliable - Based on actual trial outcomes, not predictions - No timeline variable errors - Easier to understand and maintain 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add text_object parameter to support translation and customization of all user-facing text. Follows jspsych-timelines convention from go-nogo package. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: d47ac28 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Document all breaking changes, new features, and improvements from the plugin-flanker integration. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Change @jspsych-contrib/plugin-flanker from peerDependency to dependency to match the pattern used by other timeline packages in the repository. This simplifies installation for users. Also add @jspsych/plugin-html-keyboard-response as a dependency. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR represents a major refactor of the arrow-flanker timeline package to use the newly published @jspsych-contrib/plugin-flanker package. The refactor adds extensive features for research applications including SOA manipulation, congruency ratio control, sequential effects tracking, neutral trials, and multi-block designs with comprehensive configuration options.
Key changes:
- Refactored architecture to use
@jspsych-contrib/plugin-flankerfor stimulus presentation instead of custom implementation - Added comprehensive type system with 10+ configurable parameter categories (temporal, spatial, design, response)
- Implemented text configuration system for internationalization support
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 20 comments.
Show a summary per file
| File | Description |
|---|---|
src/index.ts |
Complete rewrite of main timeline creation logic with extensive parameterization support and backward compatibility |
src/types.ts |
New comprehensive type definitions for all configuration parameters |
src/utils.ts |
New utility functions for trial variable generation, SOA assignment, and configuration merging |
src/trials.ts |
New trial component creation functions (fixation, flanker, ITI, block breaks) |
src/stimuli.ts |
New stimulus generation functions (though likely unused given plugin dependency) |
src/constants.ts |
New default configuration values and SVG arrow definitions |
src/text.ts |
New text configuration system for user-facing strings |
src/index.spec.ts |
Expanded test coverage with 15 new test cases for various features |
examples/*.html |
Five new example files demonstrating different research applications |
examples/README.md |
New comprehensive documentation for examples with research guidelines |
README.md |
Complete rewrite with extensive API documentation and usage examples |
CHANGELOG.md |
Added entry for version 0.3.0 documenting refactor changes |
package.json |
Version bump to 0.3.0 and added peer dependency on @jspsych-contrib/plugin-flanker |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <head> | ||
| <title>Arrow Flanker Task - Neutral Trials Example</title> | ||
| <script src="https://unpkg.com/jspsych@8"></script> | ||
| <script src="https://unpkg.com/@jspsych/plugin-html-keyboard-response@2"></script> |
There was a problem hiding this comment.
Missing required script tag for the @jspsych-contrib/plugin-flanker dependency. The examples load @jspsych/plugin-html-keyboard-response but do not load the flanker plugin which is now a required peer dependency. Add:
<script src="https://unpkg.com/@jspsych-contrib/plugin-flanker@1"></script>| <script src="https://unpkg.com/@jspsych/plugin-html-keyboard-response@2"></script> | |
| <script src="https://unpkg.com/@jspsych/plugin-html-keyboard-response@2"></script> | |
| <script src="https://unpkg.com/@jspsych-contrib/plugin-flanker@1"></script> |
| ` | ||
| }; | ||
|
|
||
| jsPsych.run([instructions, highConflictBlock, blockBreak, lowConflictBlock, debrief]) |
There was a problem hiding this comment.
The example incorrectly passes timeline objects directly to jsPsych.run(), but createTimeline returns an object with a timeline property (see line 146-148 in index.ts). This should destructure or access the .timeline property. The current code will not work as expected.
| jsPsych.run([instructions, highConflictBlock, blockBreak, lowConflictBlock, debrief]) | |
| jsPsych.run([instructions, ...highConflictBlock.timeline, blockBreak, ...lowConflictBlock.timeline, debrief]) |
| return { | ||
| type: jsPsychHtmlKeyboardResponse, | ||
| stimulus: createFixationStimulus({ size: fixation_size, container_height }), | ||
| choices: 'NO_KEYS', |
There was a problem hiding this comment.
The choices parameter should be 'NO_KEYS' instead of "NONE". In jsPsych v8, the correct constant for disabling keyboard responses is 'NO_KEYS', not "NONE".
| return { | ||
| type: jsPsychHtmlKeyboardResponse, | ||
| stimulus: createBlank({ container_height }), | ||
| choices: 'NO_KEYS', |
There was a problem hiding this comment.
The choices parameter should be 'NO_KEYS' instead of "NONE". In jsPsych v8, the correct constant for disabling keyboard responses is 'NO_KEYS', not "NONE".
| @@ -0,0 +1,32 @@ | |||
| --- | |||
| "@jspsych-timelines/arrow-flanker": major | |||
There was a problem hiding this comment.
The changeset indicates this is a "major" version bump, but the package.json shows the version changing from 0.2.0 to 0.3.0, which is a minor version bump according to semantic versioning. For a major version bump with breaking changes as described, the version should be 1.0.0 instead of 0.3.0.
| <script src="https://unpkg.com/@jspsych/plugin-html-keyboard-response"></script> | ||
| <title>Arrow Flanker Task - Basic Example</title> | ||
| <script src="https://unpkg.com/jspsych@8"></script> | ||
| <script src="https://unpkg.com/@jspsych/plugin-html-keyboard-response@2"></script> |
There was a problem hiding this comment.
Missing required script tag for the @jspsych-contrib/plugin-flanker dependency. The examples load @jspsych/plugin-html-keyboard-response but do not load the flanker plugin which is now a required peer dependency. Add:
<script src="https://unpkg.com/@jspsych-contrib/plugin-flanker@1"></script>| <script src="https://unpkg.com/@jspsych/plugin-html-keyboard-response@2"></script> | |
| <script src="https://unpkg.com/@jspsych/plugin-html-keyboard-response@2"></script> | |
| <script src="https://unpkg.com/@jspsych-contrib/plugin-flanker@1"></script> |
| ` | ||
| }; | ||
|
|
||
| jsPsych.run([instructions, flankerTask, debrief]) |
There was a problem hiding this comment.
The example incorrectly passes flankerTask directly to jsPsych.run(), but createTimeline returns an object with a timeline property (see line 146-148 in index.ts). This should be jsPsych.run([instructions, ...flankerTask.timeline]) or similar. The current code will not work as expected.
| jsPsych.run([instructions, flankerTask, debrief]) | |
| jsPsych.run([instructions, ...flankerTask.timeline, debrief]) |
| } | ||
| }); | ||
|
|
||
| jsPsych.run([instructions, flankerTask]) |
There was a problem hiding this comment.
The example incorrectly passes flankerTask directly to jsPsych.run(), but createTimeline returns an object with a timeline property (see line 146-148 in index.ts). This should be jsPsych.run([instructions, ...flankerTask.timeline]) or similar. The current code will not work as expected.
| jsPsych.run([instructions, flankerTask]) | |
| jsPsych.run([instructions, ...flankerTask.timeline]) |
| import { | ||
| CongruencyType, | ||
| Direction, | ||
| FlankerTrialVariable, | ||
| CongruencyRatio, | ||
| SOAConfig, | ||
| RepetitionControl | ||
| } from './types'; |
There was a problem hiding this comment.
Unused import CongruencyType.
| congruency_ratio, | ||
| include_neutral, | ||
| soa_config, | ||
| track_sequence_effects = false, |
There was a problem hiding this comment.
Unused variable track_sequence_effects.
This adds a host of features to the arrow flanker timeline to make it a realistically useful package.