diff --git a/packages/plugin-free-sort-ordered/CITATION.cff b/packages/plugin-free-sort-ordered/CITATION.cff new file mode 100644 index 00000000..2627b8c9 --- /dev/null +++ b/packages/plugin-free-sort-ordered/CITATION.cff @@ -0,0 +1,41 @@ +cff-version: 1.2.0 +message: "If you use this software, please cite it as below." +authors: +- family-names: "Cherrie Chang" # Replace with last name + given-names: "Cherrie Chang" # Replace with first name + name-particle: "Cherrie Chang" # Replace with name particle(s) + orcid: "https://orcid.org/0000-0000-0000-0000" # Replace with ORCID +# More authors can be listed here in the same format as above +contact: # Contact person for this extension +- family-names: "Cherrie Chang" + given-names: "Cherrie Chang" + email: "{email}" # Replace with contact person's email + orcid: "https://orcid.org/0000-0000-0000-0000" # Replace with contact person's ORCID +title: "jsPsychPluginFreeSortOrdered" +version: 0.0.0 +doi: 10.5281/zenodo.1234 # Replace with DOI +date-released: 2000-01-01 +url: "{softwareUrl}" # Replace with URL to this extension + +# If you wish to cite a paper on this extension instead, you can use the following template: +preferred-citation: + authors: + - family-names: "Cherrie Chang" + given-names: "Cherrie Chang" + name-particle: "Cherrie Chang" + orcid: "https://orcid.org/0000-0000-0000-0000" + # More authors can be listed here in the same format as above + date-published: 2023-05-11 + doi: 10.21105/joss.12345 + issn: 1234-5678 + issue: 01 + journal: Journal for Open Source Software + publisher: + name: Open Journals + start: 0001 + title: "{title}" + type: article # Other options include: book, pamphlet, conference-paper... + url: "{linkToPublicationInJournal}" + volume: 1 + +# More information on the preffered-citation CFF format can be found at https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-citation-files#citing-something-other-than-software \ No newline at end of file diff --git a/packages/plugin-free-sort-ordered/README.md b/packages/plugin-free-sort-ordered/README.md new file mode 100644 index 00000000..3aae8167 --- /dev/null +++ b/packages/plugin-free-sort-ordered/README.md @@ -0,0 +1,21 @@ +# plugin-free-sort-ordered + +## Overview + +The free sort core plugin, but the images have to be sorted by placing into ordered boxes. + +## Loading + +*Enter instructions for loading the plugin package here.* + +## Compatibility + +`plugin-free-sort-ordered` requires jsPsych v8.0.0 or later. + +## Documentation + +See [documentation](/packages/plugin-free-sort-ordered/README.md) + +## Author / Citation + +[Cherrie Chang](https://github.com/cherriechang) \ No newline at end of file diff --git a/packages/plugin-free-sort-ordered/docs/plugin-free-sort-ordered.md b/packages/plugin-free-sort-ordered/docs/plugin-free-sort-ordered.md new file mode 100644 index 00000000..50308f59 --- /dev/null +++ b/packages/plugin-free-sort-ordered/docs/plugin-free-sort-ordered.md @@ -0,0 +1,33 @@ +# plugin-free-sort-ordered + +The free sort core plugin, but the images have to be sorted by placing into ordered boxes. + +## Parameters + +In addition to the [parameters available in all plugins](https://www.jspsych.org/latest/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of undefined must be specified. Other parameters can be left unspecified if the default value is acceptable. + +| Parameter | Type | Default Value | Description | +| ------------------- | ---------------- | ------------------ | ---------------------------------------- | +| | | | | + +## Data Generated + +In addition to the [default data collected by all plugins](https://www.jspsych.org/latest/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial. + +| Name | Type | Value | +| --------- | ------- | ---------------------------------------- | +| | | | + +## Install + +*Enter instructions for installing the plugin package here.* + +## Examples + +### Title of Example + +```javascript +var trial = { + type: jsPsychPluginFreeSortOrdered +} +``` diff --git a/packages/plugin-free-sort-ordered/examples/index.html b/packages/plugin-free-sort-ordered/examples/index.html new file mode 100644 index 00000000..9c6e367e --- /dev/null +++ b/packages/plugin-free-sort-ordered/examples/index.html @@ -0,0 +1,25 @@ + + + + + jsPsychPluginFreeSortOrdered Example + + + + + + + + + + \ No newline at end of file diff --git a/packages/plugin-free-sort-ordered/jest.config.cjs b/packages/plugin-free-sort-ordered/jest.config.cjs new file mode 100644 index 00000000..6ac19d5c --- /dev/null +++ b/packages/plugin-free-sort-ordered/jest.config.cjs @@ -0,0 +1 @@ +module.exports = require("@jspsych/config/jest").makePackageConfig(__dirname); diff --git a/packages/plugin-free-sort-ordered/package.json b/packages/plugin-free-sort-ordered/package.json new file mode 100644 index 00000000..08b7a6dc --- /dev/null +++ b/packages/plugin-free-sort-ordered/package.json @@ -0,0 +1,53 @@ +{ + "name": "plugin-free-sort-ordered", + "version": "0.0.1", + "description": "The free sort core plugin, but the images have to be sorted by placing into ordered boxes.", + "type": "module", + "main": "dist/index.cjs", + "exports": { + "import": "./dist/index.js", + "require": "./dist/index.cjs" + }, + "typings": "dist/index.d.ts", + "unpkg": "dist/index.browser.min.js", + "files": [ + "src", + "dist" + ], + "source": "src/index.ts", + "scripts": { + "test": "jest", + "test:watch": "npm test -- --watch", + "tsc": "tsc", + "build": "rollup --config", + "build:watch": "npm run build -- --watch" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/jspsych/jsPsych.git", + "directory": "" + }, + "keywords": [ + "jsPsych" + ], + "author": { + "name": "Cherrie Chang", + "url": "https://github.com/cherriechang" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/jspsych/jsPsych/issues" + }, + "homepage": "/packages/plugin-free-sort-ordered/README.md", + "dependencies": { + "jspsych": "^8.0.0", + "@citation-js/core": "^0.7.14", + "@citation-js/plugin-software-formats": "^0.6.1", + "@citation-js/plugin-bibtex": "^0.7.14", + "@citation-js/plugin-cff": "^0.6.1" + }, + "devDependencies": { + "@jspsych/config": "^3.2.2", + "@jspsych/test-utils": "^1.0.0" + } +} diff --git a/packages/plugin-free-sort-ordered/rollup.config.mjs b/packages/plugin-free-sort-ordered/rollup.config.mjs new file mode 100644 index 00000000..f324dcee --- /dev/null +++ b/packages/plugin-free-sort-ordered/rollup.config.mjs @@ -0,0 +1,3 @@ +import { makeRollupConfig } from "@jspsych/config/rollup"; + +export default makeRollupConfig("jsPsychPluginFreeSortOrdered"); diff --git a/packages/plugin-free-sort-ordered/src/index.spec.ts b/packages/plugin-free-sort-ordered/src/index.spec.ts new file mode 100644 index 00000000..5ad9b4bb --- /dev/null +++ b/packages/plugin-free-sort-ordered/src/index.spec.ts @@ -0,0 +1,19 @@ +import { startTimeline } from "@jspsych/test-utils"; + +import jsPsychPluginFreeSortOrdered from "."; + +jest.useFakeTimers(); + +describe("my plugin", () => { + it("should load", async () => { + const { expectFinished, getHTML, getData, displayElement, jsPsych } = await startTimeline([ + { + type: jsPsychPluginFreeSortOrdered, + parameter_name: 1, + parameter_name2: "img.png", + }, + ]); + + await expectFinished(); + }); +}); diff --git a/packages/plugin-free-sort-ordered/src/index.ts b/packages/plugin-free-sort-ordered/src/index.ts new file mode 100644 index 00000000..612c2a36 --- /dev/null +++ b/packages/plugin-free-sort-ordered/src/index.ts @@ -0,0 +1,71 @@ +import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych"; + +import { version } from "../package.json"; + +const info = { + name: "plugin-free-sort-ordered", + version: version, + parameters: { + /** Each element of this array is an image path or svg code. */ + stimuli: { + type: ParameterType.INT | ParameterType.HTML_STRING, + default: undefined, + array: true, + }, + /** The height of the images in pixels */ + stim_height: { + type: ParameterType.INT, + default: 100, + }, + /** The width of the images in pixels */ + stim_width: { + type: ParameterType.INT, + default: 100, + }, + /** How much larger to make the stimulus while moving (1 = no scaling). */ + scale_factor: { + type: ParameterType.FLOAT, + default: 1.5, + }, + }, + data: { + /** Provide a clear description of the data1 that could be used as documentation. We will eventually use these comments to automatically build documentation and produce metadata. */ + data1: { + type: ParameterType.INT, + }, + /** Provide a clear description of the data2 that could be used as documentation. We will eventually use these comments to automatically build documentation and produce metadata. */ + data2: { + type: ParameterType.STRING, + }, + }, + // When you run build on your plugin, citations will be generated here based on the information in the CITATION.cff file. + citations: "__CITATIONS__", +}; + +type Info = typeof info; + +/** + * **plugin-free-sort-ordered** + * + * The free sort core plugin, but the images have to be sorted by placing into ordered boxes. + * + * @author Cherrie Chang + * @see {@link /packages/plugin-free-sort-ordered/README.md}} + */ +class FreeSortOrderedPlugin implements JsPsychPlugin { + static info = info; + + constructor(private jsPsych: JsPsych) {} + + trial(display_element: HTMLElement, trial: TrialType) { + // data saving + var trial_data = { + data1: 99, // Make sure this type and name matches the information for data1 in the data object contained within the info const. + data2: "hello world!", // Make sure this type and name matches the information for data2 in the data object contained within the info const. + }; + // end trial + this.jsPsych.finishTrial(trial_data); + } +} + +export default FreeSortOrderedPlugin; diff --git a/packages/plugin-free-sort-ordered/tsconfig.json b/packages/plugin-free-sort-ordered/tsconfig.json new file mode 100644 index 00000000..fc11d795 --- /dev/null +++ b/packages/plugin-free-sort-ordered/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@jspsych/config/tsconfig.contrib.json", + "compilerOptions": { + "baseUrl": ".", + "resolveJsonModule": true + }, + "include": ["src"] + } + \ No newline at end of file