@decidables/accumulable-elements 0.3.2 → 0.3.4

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.
@@ -8130,15 +8130,29 @@
8130
8130
  text-anchor: end;
8131
8131
  }
8132
8132
 
8133
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
8134
+ .measure-arrow.a {
8135
+ fill: var(---color-a);
8136
+ stroke: var(---color-a);
8137
+ }
8138
+
8133
8139
  .measure.z .line {
8134
8140
  stroke: var(---color-z);
8135
8141
  }
8136
8142
 
8137
- .measure.z .label {
8143
+ .measure.z .label,
8144
+ /* Hack to avoid Safari weirdness */
8145
+ .measure.z .label tspan {
8138
8146
  dominant-baseline: hanging;
8139
8147
  text-anchor: start;
8140
8148
  }
8141
8149
 
8150
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
8151
+ .measure-arrow.z {
8152
+ fill: var(---color-z);
8153
+ stroke: var(---color-z);
8154
+ }
8155
+
8142
8156
  .measure.v .line {
8143
8157
  stroke: var(---color-v);
8144
8158
  }
@@ -8148,6 +8162,12 @@
8148
8162
  text-anchor: start;
8149
8163
  }
8150
8164
 
8165
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
8166
+ .measure-arrow.v {
8167
+ fill: var(---color-v);
8168
+ stroke: var(---color-v);
8169
+ }
8170
+
8151
8171
  .measure.t0 .line {
8152
8172
  stroke: var(---color-t0);
8153
8173
  }
@@ -8157,6 +8177,12 @@
8157
8177
  text-anchor: middle;
8158
8178
  }
8159
8179
 
8180
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
8181
+ .measure-arrow.t0 {
8182
+ fill: var(---color-t0);
8183
+ stroke: var(---color-t0);
8184
+ }
8185
+
8160
8186
  .sd .indicator,
8161
8187
  .mean .indicator {
8162
8188
  stroke-width: 2;
@@ -8182,6 +8208,20 @@
8182
8208
  stroke: var(---color-error-dark);
8183
8209
  }
8184
8210
 
8211
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
8212
+ .cap.correct {
8213
+ fill: var(---color-correct-dark);
8214
+ stroke: var(---color-correct-dark);
8215
+ stroke-dasharray: 100%;
8216
+ }
8217
+
8218
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
8219
+ .cap.error {
8220
+ fill: var(---color-error-dark);
8221
+ stroke: var(---color-error-dark);
8222
+ stroke-dasharray: 100%;
8223
+ }
8224
+
8185
8225
  .rt-label rect {
8186
8226
  filter: url("#shadow-2");
8187
8227
 
@@ -8401,10 +8441,29 @@
8401
8441
  const svgEnter = svgUpdate.enter().append('svg').classed('main', true).html(AccumulableElement.svgDefs);
8402
8442
  const svgDefs = svgEnter.append('defs');
8403
8443
  // Arrowhead marker for measures
8404
- svgDefs.append('marker').attr('id', 'measure-arrow').attr('orient', 'auto-start-reverse').attr('markerUnits', 'userSpaceOnUse').attr('viewBox', '-5 -5 10 10').attr('refX', '2').attr('refY', '0').attr('markerWidth', '10').attr('markerHeight', '10').append('path').attr('stroke', 'context-stroke').attr('fill', 'context-stroke').attr('d', 'M -3 -3 l 6 3 l -6 3 z');
8444
+ const measureArrow = parameter => {
8445
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
8446
+ svgDefs.append('marker').attr('id', `measure-arrow-${parameter}`).attr('class', `measure-arrow ${parameter}`).attr('orient', 'auto-start-reverse').attr('markerUnits', 'userSpaceOnUse').attr('viewBox', '-5 -5 10 10').attr('refX', '2').attr('refY', '0').attr('markerWidth', '10').attr('markerHeight', '10').append('path').attr('stroke', 'context-stroke').attr('fill', 'context-stroke').attr('d', 'M -3 -3 l 6 3 l -6 3 z');
8447
+ };
8448
+ const measureArrowCap = parameter => {
8449
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
8450
+ const marker = svgDefs.append('marker').attr('id', `measure-arrow-cap-${parameter}`).attr('class', `measure-arrow cap ${parameter}`).attr('orient', 'auto-start-reverse').attr('markerUnits', 'userSpaceOnUse').attr('viewBox', '-5 -5 10 10').attr('refX', '2').attr('refY', '0').attr('markerWidth', '10').attr('markerHeight', '10');
8451
+ marker.append('path').attr('stroke', 'context-stroke').attr('fill', 'context-stroke').attr('d', 'M -3 -3 l 6 3 l -6 3 z');
8452
+ marker.append('path').attr('stroke', 'context-stroke').attr('fill', 'context-stroke').attr('stroke-width', '2').attr('d', 'M 4 -4 l 0 8');
8453
+ };
8454
+ measureArrow('a');
8455
+ measureArrow('z');
8456
+ measureArrowCap('v');
8457
+ measureArrow('t0');
8458
+ measureArrowCap('t0');
8405
8459
  // Flat markers for SDs
8406
- svgDefs.append('marker').attr('id', 'model-sd-cap').attr('orient', 'auto-start-reverse').attr('markerUnits', 'userSpaceOnUse').attr('viewBox', '-5 -5 10 10').attr('refX', '0').attr('refY', '0').attr('markerWidth', '10').attr('markerHeight', '10').append('path').attr('stroke', 'context-stroke').attr('fill', 'context-stroke').attr('stroke-width', '2').attr('d', 'M 0 -4 l 0 8');
8407
- svgDefs.append('marker').attr('id', 'data-sd-cap').attr('orient', 'auto-start-reverse').attr('markerUnits', 'userSpaceOnUse').attr('viewBox', '-5 -5 10 10').attr('refX', '0').attr('refY', '0').attr('markerWidth', '10').attr('markerHeight', '10').append('path').attr('stroke', 'context-stroke').attr('fill', 'context-stroke').attr('stroke-width', '2').attr('d', 'M 0 -3 l 0 6');
8460
+ const sdCap = outcome => {
8461
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
8462
+ svgDefs.append('marker').attr('id', `model-sd-cap-${outcome}`).attr('class', `model-sd cap ${outcome}`).attr('orient', 'auto-start-reverse').attr('markerUnits', 'userSpaceOnUse').attr('viewBox', '-5 -5 10 10').attr('refX', '0').attr('refY', '0').attr('markerWidth', '10').attr('markerHeight', '10').append('path').attr('stroke', 'context-stroke').attr('fill', 'context-stroke').attr('stroke-width', '2').attr('d', 'M 0 -4 l 0 8');
8463
+ svgDefs.append('marker').attr('id', `data-sd-cap-${outcome}`).attr('class', `data-sd cap ${outcome}`).attr('orient', 'auto-start-reverse').attr('markerUnits', 'userSpaceOnUse').attr('viewBox', '-5 -5 10 10').attr('refX', '0').attr('refY', '0').attr('markerWidth', '10').attr('markerHeight', '10').append('path').attr('stroke', 'context-stroke').attr('fill', 'context-stroke').attr('stroke-width', '2').attr('d', 'M 0 -3 l 0 6');
8464
+ };
8465
+ sdCap('error');
8466
+ sdCap('correct');
8408
8467
  const gradient = svgDefs.append('linearGradient').attr('id', 'path-animate').attr('gradientUnits', 'userSpaceOnUse').attr('color-interpolation', 'linearRGB').attr('x1', '0').attr('x2', '0').attr('y1', evidenceScale(this.bounds.upper)).attr('y2', evidenceScale(this.bounds.lower));
8409
8468
  gradient.append('stop').classed('stop-0', true).attr('offset', '0%');
8410
8469
  gradient.append('stop').classed('stop-100', true).attr('offset', '100%');
@@ -8997,7 +9056,8 @@
8997
9056
  const aUpdate = evidenceOverlayerMerge.selectAll('.measure.a').data(this.measures ? [this.a] : []);
8998
9057
  // ENTER
8999
9058
  const aEnter = aUpdate.enter().append('g').classed('measure a', true);
9000
- aEnter.append('line').classed('line', true).attr('marker-start', 'url(#measure-arrow)').attr('marker-end', 'url(#measure-arrow)');
9059
+ aEnter.append('line').classed('line', true)
9060
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */.attr('marker-start', 'url(#measure-arrow-a)').attr('marker-end', 'url(#measure-arrow-a)');
9001
9061
  const aLabel = aEnter.append('text').classed('label', true);
9002
9062
  aLabel.append('tspan').classed('a math-var', true).text('a');
9003
9063
  aLabel.append('tspan').classed('equals', true).text(' = ');
@@ -9015,7 +9075,8 @@
9015
9075
  const zUpdate = evidenceOverlayerMerge.selectAll('.measure.z').data(this.measures ? [this.z] : []);
9016
9076
  // ENTER
9017
9077
  const zEnter = zUpdate.enter().append('g').classed('measure z', true);
9018
- zEnter.append('line').classed('line', true).attr('marker-start', 'url(#measure-arrow)').attr('marker-end', 'url(#measure-arrow)');
9078
+ zEnter.append('line').classed('line', true)
9079
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */.attr('marker-start', 'url(#measure-arrow-z)').attr('marker-end', 'url(#measure-arrow-z)');
9019
9080
  const zLabel = zEnter.append('text').classed('label', true);
9020
9081
  zLabel.append('tspan').classed('z math-var', true).text('z');
9021
9082
  zLabel.append('tspan').classed('equals', true).text(' = ');
@@ -9033,19 +9094,21 @@
9033
9094
  const vUpdate = evidenceOverlayerMerge.selectAll('.measure.v').data(this.measures ? [this.v] : []);
9034
9095
  // ENTER
9035
9096
  const vEnter = vUpdate.enter().append('g').classed('measure v', true);
9036
- vEnter.append('path').classed('line', true).attr('marker-start', 'url(#measure-arrow)').attr('marker-end', 'url(#measure-arrow)');
9097
+ vEnter.append('path').classed('line', true)
9098
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */.attr('marker-start', 'url(#measure-arrow-cap-v)').attr('marker-end', 'url(#measure-arrow-cap-v)');
9037
9099
  const vLabel = vEnter.append('text').classed('label', true);
9038
9100
  vLabel.append('tspan').classed('v math-var', true).text('v');
9039
9101
  vLabel.append('tspan').classed('equals', true).text(' = ');
9040
9102
  vLabel.append('tspan').classed('value', true);
9041
9103
  // MERGE
9042
- const driftAngle = Math.atan(this.v / 1000 * scaleRatio);
9043
9104
  const driftHypotenuse = timeScale(200) - timeScale(0) + this.rem * 0.75;
9105
+ const driftCorrection = 2 / driftHypotenuse;
9106
+ const driftAngle = Math.atan(this.v / 1000 * scaleRatio) - driftCorrection;
9044
9107
  const driftX = Math.cos(driftAngle) * driftHypotenuse;
9045
9108
  const driftY = Math.sin(driftAngle) * driftHypotenuse;
9046
9109
  const vMerge = vEnter.merge(vUpdate);
9047
9110
  vMerge.select('.line').transition().duration(this.drag ? 0 : transitionDuration).ease(cubicOut).attr('d', `
9048
- M ${timeScale(this.t0 + 200) + this.rem * 0.75}, ${evidenceScale(this.startingPoint)}
9111
+ M ${timeScale(this.t0 + 200) + this.rem * 0.75}, ${evidenceScale(this.startingPoint) - 2}
9049
9112
  A ${timeScale(200) - timeScale(0)} ${timeScale(200) - timeScale(0)} 0 0 0 ${timeScale(this.t0) + driftX} ${evidenceScale(this.startingPoint) - driftY}
9050
9113
  `);
9051
9114
  const vLabelMerge = vMerge.select('.label').transition().duration(this.drag ? 0 : transitionDuration).ease(cubicOut).attr('x', timeScale(this.t0 + 200) + this.rem * 0.5).attr('y', evidenceScale(this.bounds.upper) - this.rem * 0.25);
@@ -9058,7 +9121,8 @@
9058
9121
  const t0Update = evidenceOverlayerMerge.selectAll('.measure.t0').data(this.measures ? [this.t0] : []);
9059
9122
  // ENTER
9060
9123
  const t0Enter = t0Update.enter().append('g').classed('measure t0', true);
9061
- t0Enter.append('line').classed('line', true).attr('marker-start', 'url(#measure-arrow)').attr('marker-end', 'url(#measure-arrow)');
9124
+ t0Enter.append('line').classed('line', true)
9125
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */.attr('marker-start', 'url(#measure-arrow-t0)').attr('marker-end', 'url(#measure-arrow-cap-t0)');
9062
9126
  const t0Label = t0Enter.append('text').classed('label', true);
9063
9127
  t0Label.append('tspan').classed('t0 math-var', true).text('t₀');
9064
9128
  t0Label.append('tspan').classed('equals', true).text(' = ');
@@ -9134,7 +9198,12 @@
9134
9198
  const sdEnter = sdUpdate.enter().append('g').attr('class', datum => {
9135
9199
  return `model sd ${datum.outcome}`;
9136
9200
  });
9137
- sdEnter.append('line').classed('indicator', true).attr('marker-start', 'url(#model-sd-cap)').attr('marker-end', 'url(#model-sd-cap)');
9201
+ sdEnter.append('line').classed('indicator', true)
9202
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */.attr('marker-start', datum => {
9203
+ return `url(#model-sd-cap-${datum.outcome})`;
9204
+ }).attr('marker-end', datum => {
9205
+ return `url(#model-sd-cap-${datum.outcome})`;
9206
+ });
9138
9207
  // MERGE
9139
9208
  const sdMerge = sdEnter.merge(sdUpdate);
9140
9209
  sdMerge.select('.indicator').transition().duration(this.drag ? 0 : transitionDuration).ease(cubicOut).attr('x1', datum => {
@@ -9158,7 +9227,12 @@
9158
9227
  const dataSDEnter = dataSDUpdate.enter().append('g').attr('class', datum => {
9159
9228
  return `data sd ${datum.outcome}`;
9160
9229
  });
9161
- dataSDEnter.append('line').classed('indicator', true).attr('marker-start', 'url(#data-sd-cap)').attr('marker-end', 'url(#data-sd-cap)').attr('y1', datum => {
9230
+ dataSDEnter.append('line').classed('indicator', true)
9231
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */.attr('marker-start', datum => {
9232
+ return `url(#data-sd-cap-${datum.outcome})`;
9233
+ }).attr('marker-end', datum => {
9234
+ return `url(#data-sd-cap-${datum.outcome})`;
9235
+ }).attr('y1', datum => {
9162
9236
  return datum.densityScale(0) + (datum.outcome === 'correct' ? 0.375 : -0.375) * this.rem;
9163
9237
  }).attr('y2', datum => {
9164
9238
  return datum.densityScale(0) + (datum.outcome === 'correct' ? 0.375 : -0.375) * this.rem;