@decidables/accumulable-elements 0.3.5 → 0.3.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decidables/accumulable-elements",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "accumulable-elements: Web Components for visualizing the Diffusion Decision Model",
5
5
  "keywords": [
6
6
  "web component",
@@ -24,7 +24,8 @@
24
24
  "./components": "./src/components/index.js",
25
25
  "./equations": "./src/equations/index.js",
26
26
  "./examples": "./src/examples/index.js",
27
- "./*": "./src/*.js"
27
+ "./*": "./src/*.js",
28
+ "./colors.yml": "./src/colors.yml"
28
29
  },
29
30
  "repository": {
30
31
  "type": "git",
@@ -53,14 +54,13 @@
53
54
  "gulp": "^5.0.1"
54
55
  },
55
56
  "dependencies": {
56
- "@decidables/accumulable-math": "^0.2.4",
57
- "@decidables/decidables-elements": "^0.5.4",
57
+ "@decidables/accumulable-math": "^0.2.5",
58
+ "@decidables/decidables-elements": "^0.5.6",
58
59
  "@lit-labs/motion": "^1.0.9",
59
60
  "@observablehq/plot": "^0.6.17",
60
61
  "bayes.js": "https://github.com/akrawitz/bayes.js.git#commit=c7b091b75f85a86b6a3965a983b31e23d9ef456f",
61
62
  "d3": "^7.9.0",
62
- "lit": "^3.3.1",
63
- "regenerator-runtime": "^0.14.1"
63
+ "lit": "^3.3.1"
64
64
  },
65
- "gitHead": "c0a4df1a6d35d43648d21c14d63cbcee6dd28f9e"
65
+ "gitHead": "8c39b095d6cc3cf6a5f49457048bebf53e7158c1"
66
66
  }
@@ -1,5 +1,5 @@
1
1
 
2
- import {html, css} from 'lit';
2
+ import {css, html} from 'lit';
3
3
 
4
4
  import '@decidables/decidables-elements/button';
5
5
  import '@decidables/decidables-elements/slider';
@@ -1,5 +1,5 @@
1
1
 
2
- import {html, css} from 'lit';
2
+ import {css, html} from 'lit';
3
3
 
4
4
  import DDMMath from '@decidables/accumulable-math';
5
5
  import '@decidables/decidables-elements/button';
@@ -1,5 +1,5 @@
1
1
 
2
- import {html, css} from 'lit';
2
+ import {css, html} from 'lit';
3
3
 
4
4
  import '@decidables/decidables-elements/spinner';
5
5
 
@@ -1,5 +1,5 @@
1
1
 
2
- import {html, css} from 'lit';
2
+ import {css, html} from 'lit';
3
3
 
4
4
  import DDMMath from '@decidables/accumulable-math';
5
5
 
@@ -1,5 +1,5 @@
1
1
 
2
- import {css, html} from 'lit';
2
+ import {css, html, render} from 'lit';
3
3
  import * as d3 from 'd3';
4
4
 
5
5
  import DDMMath from '@decidables/accumulable-math';
@@ -477,31 +477,50 @@ export default class DDMModel extends DecidablesMixinResizeable(AccumulableEleme
477
477
  /*
478
478
  OVERLAYER
479
479
  */
480
- .interactive {
480
+ .boundary.interactive {
481
+ cursor: ns-resize;
482
+ }
483
+
484
+ .t0z.interactive {
485
+ cursor: move;
486
+ }
487
+
488
+ .boundary.interactive,
489
+ .t0z.interactive {
481
490
  filter: url("#shadow-2");
482
491
  outline: none;
483
492
  }
484
493
 
485
- .interactive:hover {
494
+ .boundary.interactive:hover,
495
+ .t0z.interactive:hover {
486
496
  filter: url("#shadow-4");
497
+
498
+ /* HACK: This gets Safari to correctly apply the filter! */
499
+ /* https://github.com/emilbjorklund/svg-weirdness/issues/27 */
500
+ transform: translateX(0);
487
501
  }
488
502
 
489
- .interactive:active {
503
+ .boundary.interactive:active,
504
+ .t0z.interactive:active {
490
505
  filter: url("#shadow-8");
506
+
507
+ /* HACK: This gets Safari to correctly apply the filter! */
508
+ transform: translateY(0);
491
509
  }
492
510
 
493
- :host(.keyboard) .interactive:focus {
511
+ :host(.keyboard) .boundary.interactive:focus,
512
+ :host(.keyboard) .t0z.interactive:focus {
494
513
  filter: url("#shadow-8");
495
- }
496
514
 
497
- .boundary {
498
- fill: none;
499
- stroke: var(---color-element-emphasis);
500
- stroke-width: 2;
515
+ /* HACK: This gets Safari to correctly apply the filter! */
516
+ transform: translateZ(0);
501
517
  }
502
518
 
503
- .boundary.interactive {
504
- cursor: ns-resize;
519
+ .t0z .point {
520
+ fill: var(---color-element-emphasis);
521
+ stroke-width: 0;
522
+
523
+ r: 6px;
505
524
  }
506
525
 
507
526
  .drift {
@@ -515,21 +534,38 @@ export default class DDMModel extends DecidablesMixinResizeable(AccumulableEleme
515
534
 
516
535
  .drift.interactive {
517
536
  cursor: ns-resize;
537
+
538
+ filter: url("#shadow-2");
539
+ outline: none;
540
+
541
+ /* HACK: This gets Safari to correctly apply the filter! */
542
+ fill: #000000;
543
+ fill-opacity: 0;
518
544
  }
519
545
 
520
- .drift .arrow {
521
- stroke-dasharray: none;
546
+ .drift.interactive:hover {
547
+ filter: url("#shadow-4");
548
+
549
+ /* HACK: This gets Safari to correctly apply the filter! */
550
+ fill: #ff0000;
522
551
  }
523
552
 
524
- .t0z.interactive {
525
- cursor: move;
553
+ .drift.interactive:active {
554
+ filter: url("#shadow-8");
555
+
556
+ /* HACK: This gets Safari to correctly apply the filter! */
557
+ fill: #00ff00;
526
558
  }
527
559
 
528
- .t0z .point {
529
- fill: var(---color-element-emphasis);
530
- stroke-width: 0;
560
+ :host(.keyboard) .drift.interactive:focus {
561
+ filter: url("#shadow-8");
531
562
 
532
- r: 6px;
563
+ /* HACK: This gets Safari to correctly apply the filter! */
564
+ fill: #0000ff;
565
+ }
566
+
567
+ .drift .arrow {
568
+ stroke-dasharray: none;
533
569
  }
534
570
 
535
571
  /* Make larger targets for touch users */
@@ -938,12 +974,16 @@ export default class DDMModel extends DecidablesMixinResizeable(AccumulableEleme
938
974
  // ENTER
939
975
  const svgEnter = svgUpdate.enter().append('svg')
940
976
  .classed('main', true)
941
- .html(AccumulableElement.svgDefs);
942
- const svgDefs = svgEnter.append('defs');
977
+ .each((datum, index, nodes) => {
978
+ // Filters for shadows
979
+ render(AccumulableElement.svgFilters, nodes[index]);
980
+ });
981
+ const svgMarkers = svgEnter.append('defs')
982
+ .classed('markers', true);
943
983
  // Arrowhead marker for measures
944
984
  const measureArrow = (parameter) => {
945
985
  /* Hack to avoid lack of context-stroke and context-fill in Safari */
946
- svgDefs.append('marker')
986
+ svgMarkers.append('marker')
947
987
  .attr('id', `measure-arrow-${parameter}`)
948
988
  .attr('class', `measure-arrow ${parameter}`)
949
989
  .attr('orient', 'auto-start-reverse')
@@ -959,7 +999,7 @@ export default class DDMModel extends DecidablesMixinResizeable(AccumulableEleme
959
999
  };
960
1000
  const measureCappedArrow = (parameter) => {
961
1001
  /* Hack to avoid lack of context-stroke and context-fill in Safari */
962
- const marker = svgDefs.append('marker')
1002
+ const marker = svgMarkers.append('marker')
963
1003
  .attr('id', `measure-capped-arrow-${parameter}`)
964
1004
  .attr('class', `measure-arrow capped ${parameter}`)
965
1005
  .attr('orient', 'auto-start-reverse')
@@ -986,7 +1026,7 @@ export default class DDMModel extends DecidablesMixinResizeable(AccumulableEleme
986
1026
  // Flat markers for SDs
987
1027
  const sdCap = (outcome) => {
988
1028
  /* Hack to avoid lack of context-stroke and context-fill in Safari */
989
- svgDefs.append('marker')
1029
+ svgMarkers.append('marker')
990
1030
  .attr('id', `model-sd-cap-${outcome}`)
991
1031
  .attr('class', `model-sd cap ${outcome}`)
992
1032
  .attr('orient', 'auto-start-reverse')
@@ -1001,7 +1041,7 @@ export default class DDMModel extends DecidablesMixinResizeable(AccumulableEleme
1001
1041
  .attr('fill', 'context-stroke')
1002
1042
  .attr('stroke-width', '2')
1003
1043
  .attr('d', 'M 0 -4 l 0 8');
1004
- svgDefs.append('marker')
1044
+ svgMarkers.append('marker')
1005
1045
  .attr('id', `data-sd-cap-${outcome}`)
1006
1046
  .attr('class', `data-sd cap ${outcome}`)
1007
1047
  .attr('orient', 'auto-start-reverse')
@@ -1019,7 +1059,7 @@ export default class DDMModel extends DecidablesMixinResizeable(AccumulableEleme
1019
1059
  };
1020
1060
  sdCap('error');
1021
1061
  sdCap('correct');
1022
- const gradient = svgDefs.append('linearGradient')
1062
+ const gradient = svgMarkers.append('linearGradient')
1023
1063
  .attr('id', 'path-animate')
1024
1064
  .attr('gradientUnits', 'userSpaceOnUse')
1025
1065
  .attr('color-interpolation', 'linearRGB')
@@ -1,5 +1,5 @@
1
1
 
2
- import {html, css} from 'lit';
2
+ import {css, html} from 'lit';
3
3
 
4
4
  import '@decidables/decidables-elements/slider';
5
5
  import DDMMath from '@decidables/accumulable-math';
@@ -1,5 +1,5 @@
1
1
 
2
- import {html, css} from 'lit';
2
+ import {css, html} from 'lit';
3
3
  import * as d3 from 'd3';
4
4
 
5
5
  import {DecidablesMixinResizeable} from '@decidables/decidables-elements';
@@ -1,5 +1,5 @@
1
1
 
2
- import {html, css} from 'lit';
2
+ import {css, html} from 'lit';
3
3
 
4
4
  import AccumulableElement from '../accumulable-element';
5
5