@decidables/discountable-elements 0.3.9 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +62 -5
- package/lib/discountableElements.esm.js +1112 -838
- package/lib/discountableElements.esm.js.map +1 -1
- package/lib/discountableElements.esm.min.js +283 -135
- package/lib/discountableElements.esm.min.js.map +1 -1
- package/lib/discountableElements.umd.js +1112 -837
- package/lib/discountableElements.umd.js.map +1 -1
- package/lib/discountableElements.umd.min.js +283 -135
- package/lib/discountableElements.umd.min.js.map +1 -1
- package/package.json +4 -4
- package/src/components/discountable-control.js +2 -2
- package/src/components/discountable-response.js +24 -0
- package/src/components/htd-calculation.js +44 -8
- package/src/components/htd-curves.js +179 -37
- package/src/components/htd-fit-worker.js +1 -1
- package/src/components/htd-fit.js +32 -4
- package/src/components/htd-parameters.js +112 -0
- package/src/components/index.js +1 -0
- package/src/equations/adk2v.js +30 -5
- package/src/examples/human.js +110 -64
- package/src/examples/interactive.js +18 -1
- package/src/examples/model.js +89 -65
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.4.0](https://github.com/decidables/decidables/compare/@decidables/discountable-elements@0.3.9...@decidables/discountable-elements@0.4.0) (2025-05-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **discountable-elements:** add larger touch targets to htd-curves ([0f57a3a](https://github.com/decidables/decidables/commit/0f57a3a1cc09bf63ee8cc4c50d08159c06daaad8))
|
|
12
|
+
* **discountable-elements:** add parameter value controls as htd-parameters ([0b50fbf](https://github.com/decidables/decidables/commit/0b50fbf6bd5f76b11fdea7d01f8826f99d6184f9))
|
|
13
|
+
* **discountable-elements:** colored nonlinear slider for k in htd-parameters ([59c670b](https://github.com/decidables/decidables/commit/59c670b8911ca7dd80a46c4f1a7b74681eb62ca1))
|
|
14
|
+
* **discountable-elements:** controls/parameters must be explicitly included to be shown in examples ([3e41072](https://github.com/decidables/decidables/commit/3e41072b1934b33f5a1af849388c144a86372daf))
|
|
15
|
+
* **discountable-elements:** htd-fit: tips and highlighting in fit plots ([a399e5f](https://github.com/decidables/decidables/commit/a399e5f877c22ca2ede74f28ef7b77025047b15f))
|
|
16
|
+
* **discountable-elements:** key responses for discountable-response ([850dbf2](https://github.com/decidables/decidables/commit/850dbf2e61372ca5f2c2bd7c8f6bd89275cda7b2))
|
|
17
|
+
* **discountable-elements:** use parameter settings throughout ([cc4c307](https://github.com/decidables/decidables/commit/cc4c307a618c8d65d8e317787c930145b0fb8a18))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **discountable-elements:** fix htd-curves touch drag ([cfc516f](https://github.com/decidables/decidables/commit/cfc516f1ae581c5001e8998a20ff7d6fccc92182))
|
|
23
|
+
* **discountable-elements:** fix touch targets for htd-curves ([6b79be9](https://github.com/decidables/decidables/commit/6b79be97a782653bb2cc712005cdbe9efe0e6b94))
|
|
24
|
+
* **discountable-elements:** htd curve - remove redundant SVG element ([002a529](https://github.com/decidables/decidables/commit/002a52921fabc3bc279922fd5ff8e173e12a727b))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [0.3.9](https://github.com/decidables/decidables/compare/@decidables/discountable-elements@0.3.8...@decidables/discountable-elements@0.3.9) (2025-02-06)
|
|
7
29
|
|
|
8
30
|
**Note:** Version bump only for package @decidables/discountable-elements
|
package/README.md
CHANGED
|
@@ -96,6 +96,9 @@ Response buttons and feedback for inter-temporal choice tasks
|
|
|
96
96
|
This element provides 'first' and 'second' response buttons. It can also display a running count
|
|
97
97
|
of the trials and display response feedback.
|
|
98
98
|
|
|
99
|
+
Also accepts keyboard responses: <kbd>ArrowLeft</kbd> for 'first' button and <kbd>ArrowRight</kbd> for
|
|
100
|
+
'second' button.
|
|
101
|
+
|
|
99
102
|
##### Attributes
|
|
100
103
|
|
|
101
104
|
- `interactive: boolean = false`
|
|
@@ -396,6 +399,36 @@ be directly manipulated.
|
|
|
396
399
|
<htd-curves interactive amount="60" delay="30" k="0.05" label="1"></htd-curves>
|
|
397
400
|
```
|
|
398
401
|
|
|
402
|
+
#### `HTDParameters` / `<htd-parameters>`
|
|
403
|
+
|
|
404
|
+
Control panel for HTD model parameters
|
|
405
|
+
|
|
406
|
+
A configurable set of controls for user manipulation of HTD model parameters. Controls can be
|
|
407
|
+
provided for the discounting factor.
|
|
408
|
+
|
|
409
|
+
##### Attributes
|
|
410
|
+
|
|
411
|
+
- `k: number = undefined`
|
|
412
|
+
- Show a slider for setting the discounting factor, initialized to the value provided
|
|
413
|
+
- Options
|
|
414
|
+
- `0` to `100` in steps of `0.001`
|
|
415
|
+
|
|
416
|
+
##### Methods
|
|
417
|
+
|
|
418
|
+
##### Custom Events
|
|
419
|
+
|
|
420
|
+
- `ddm-parameters-k`
|
|
421
|
+
- Indicates an update to the discounting factor
|
|
422
|
+
- `detail`
|
|
423
|
+
- `k: number`
|
|
424
|
+
- New value for the discounting factor
|
|
425
|
+
|
|
426
|
+
##### Example
|
|
427
|
+
|
|
428
|
+
```html
|
|
429
|
+
<htd-parameters interactive k="1.6"></htd-parameters>
|
|
430
|
+
```
|
|
431
|
+
|
|
399
432
|
#### `ITCChoice` / `<itc-choice>`
|
|
400
433
|
|
|
401
434
|
A choice between two options at different times
|
|
@@ -632,6 +665,19 @@ controls, the task itself, response buttons with feedback, HTD curves, and trace
|
|
|
632
665
|
histograms for the parameters in the model fit. The HTD curves should not be interactive, because
|
|
633
666
|
their rendering is determined by the user's task performance.
|
|
634
667
|
|
|
668
|
+
##### Attributes
|
|
669
|
+
|
|
670
|
+
**Note:** Since model parameter attributes are set on the example, they don't need to be set on the
|
|
671
|
+
individual components, as they will be propagated and kept in sync.
|
|
672
|
+
|
|
673
|
+
- `trials: number = 10`
|
|
674
|
+
- Number of trials to run
|
|
675
|
+
- `duration: number = 2000`
|
|
676
|
+
- The duration of the stimulus, wait, and inter-trial interval on each trial, initialized to the
|
|
677
|
+
value provided in milliseconds
|
|
678
|
+
- `k: number = 0.05`
|
|
679
|
+
- Parameter k (discounting factor)
|
|
680
|
+
|
|
635
681
|
##### Slots
|
|
636
682
|
|
|
637
683
|
- *unnamed*
|
|
@@ -692,6 +738,10 @@ components, as they will be propagated and kept in sync.
|
|
|
692
738
|
- Wired elements
|
|
693
739
|
- `<htd-calculation>`
|
|
694
740
|
- Display and change the value calculations
|
|
741
|
+
- `<htd-parameters>`
|
|
742
|
+
- Allows user to adjust model parameters with sliders
|
|
743
|
+
- `<htd-parameters>`
|
|
744
|
+
- Displays the model parameters for current fit
|
|
695
745
|
- `<htd-curves>`
|
|
696
746
|
- Displays the options as amounts with delays with discounting curves based on the current
|
|
697
747
|
model parameters
|
|
@@ -701,8 +751,9 @@ components, as they will be propagated and kept in sync.
|
|
|
701
751
|
##### Example
|
|
702
752
|
|
|
703
753
|
```html
|
|
704
|
-
<htd-example-interactive
|
|
754
|
+
<htd-example-interactive amount-ss="5" delay-ss="1" amount-ll="30" delay-ll="50" k="0.01">
|
|
705
755
|
<itc-choice interactive></itc-choice>
|
|
756
|
+
<htd-parameters interactive></htd-parameters>
|
|
706
757
|
<htd-curves interactive></htd-curves>
|
|
707
758
|
<htd-calculation numeric interactive></htd-calculation>
|
|
708
759
|
</htd-example-interactive>
|
|
@@ -722,7 +773,12 @@ not be interactive, because their values are received from the model's task perf
|
|
|
722
773
|
**Note:** Since model parameter attributes are set on the example, they don't need to be set on the
|
|
723
774
|
individual components, as they will be propagated and kept in sync.
|
|
724
775
|
|
|
725
|
-
- `
|
|
776
|
+
- `trials: number = 10`
|
|
777
|
+
- Number of trials to run
|
|
778
|
+
- `duration: number = 2000`
|
|
779
|
+
- The duration of the stimulus, wait, and inter-trial interval on each trial, initialized to the
|
|
780
|
+
value provided in milliseconds
|
|
781
|
+
- `k: number = 0.05`
|
|
726
782
|
- Parameter k (discounting factor)
|
|
727
783
|
|
|
728
784
|
##### Slots
|
|
@@ -745,9 +801,10 @@ individual components, as they will be propagated and kept in sync.
|
|
|
745
801
|
##### Example
|
|
746
802
|
|
|
747
803
|
```html
|
|
748
|
-
<htd-example-model k="0.
|
|
749
|
-
<discountable-control
|
|
750
|
-
<itc-task
|
|
804
|
+
<htd-example-model trials="10" duration="2000" k="0.05">
|
|
805
|
+
<discountable-control run pause reset></discountable-control>
|
|
806
|
+
<itc-task></itc-task>
|
|
807
|
+
<htd-parameters interactive></htd-parameters>
|
|
751
808
|
<htd-curves interactive></htd-curves>
|
|
752
809
|
<discountable-response trial feedback></discountable-response>
|
|
753
810
|
</htd-example-model>
|