@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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
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.3.4](https://github.com/decidables/decidables/compare/@decidables/accumulable-elements@0.3.3...@decidables/accumulable-elements@0.3.4) (2025-11-13)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **accumulable-elements:** fix ddm-model line markers for Safari and add dimension lines ([3269ea1](https://github.com/decidables/decidables/commit/3269ea1066759376ec5fd3d1c88fef1065f83461))
12
+
13
+
14
+
15
+ ## [0.3.3](https://github.com/decidables/decidables/compare/@decidables/accumulable-elements@0.3.2...@decidables/accumulable-elements@0.3.3) (2025-11-03)
16
+
17
+ **Note:** Version bump only for package @decidables/accumulable-elements
18
+
19
+
20
+
21
+
22
+
6
23
  ## [0.3.2](https://github.com/decidables/decidables/compare/@decidables/accumulable-elements@0.3.1...@decidables/accumulable-elements@0.3.2) (2025-10-22)
7
24
 
8
25
  **Note:** Version bump only for package @decidables/accumulable-elements
@@ -8124,15 +8124,29 @@ class DDMModel extends DecidablesMixinResizeable(AccumulableElement) {
8124
8124
  text-anchor: end;
8125
8125
  }
8126
8126
 
8127
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
8128
+ .measure-arrow.a {
8129
+ fill: var(---color-a);
8130
+ stroke: var(---color-a);
8131
+ }
8132
+
8127
8133
  .measure.z .line {
8128
8134
  stroke: var(---color-z);
8129
8135
  }
8130
8136
 
8131
- .measure.z .label {
8137
+ .measure.z .label,
8138
+ /* Hack to avoid Safari weirdness */
8139
+ .measure.z .label tspan {
8132
8140
  dominant-baseline: hanging;
8133
8141
  text-anchor: start;
8134
8142
  }
8135
8143
 
8144
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
8145
+ .measure-arrow.z {
8146
+ fill: var(---color-z);
8147
+ stroke: var(---color-z);
8148
+ }
8149
+
8136
8150
  .measure.v .line {
8137
8151
  stroke: var(---color-v);
8138
8152
  }
@@ -8142,6 +8156,12 @@ class DDMModel extends DecidablesMixinResizeable(AccumulableElement) {
8142
8156
  text-anchor: start;
8143
8157
  }
8144
8158
 
8159
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
8160
+ .measure-arrow.v {
8161
+ fill: var(---color-v);
8162
+ stroke: var(---color-v);
8163
+ }
8164
+
8145
8165
  .measure.t0 .line {
8146
8166
  stroke: var(---color-t0);
8147
8167
  }
@@ -8151,6 +8171,12 @@ class DDMModel extends DecidablesMixinResizeable(AccumulableElement) {
8151
8171
  text-anchor: middle;
8152
8172
  }
8153
8173
 
8174
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
8175
+ .measure-arrow.t0 {
8176
+ fill: var(---color-t0);
8177
+ stroke: var(---color-t0);
8178
+ }
8179
+
8154
8180
  .sd .indicator,
8155
8181
  .mean .indicator {
8156
8182
  stroke-width: 2;
@@ -8176,6 +8202,20 @@ class DDMModel extends DecidablesMixinResizeable(AccumulableElement) {
8176
8202
  stroke: var(---color-error-dark);
8177
8203
  }
8178
8204
 
8205
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
8206
+ .cap.correct {
8207
+ fill: var(---color-correct-dark);
8208
+ stroke: var(---color-correct-dark);
8209
+ stroke-dasharray: 100%;
8210
+ }
8211
+
8212
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
8213
+ .cap.error {
8214
+ fill: var(---color-error-dark);
8215
+ stroke: var(---color-error-dark);
8216
+ stroke-dasharray: 100%;
8217
+ }
8218
+
8179
8219
  .rt-label rect {
8180
8220
  filter: url("#shadow-2");
8181
8221
 
@@ -8395,10 +8435,29 @@ class DDMModel extends DecidablesMixinResizeable(AccumulableElement) {
8395
8435
  const svgEnter = svgUpdate.enter().append('svg').classed('main', true).html(AccumulableElement.svgDefs);
8396
8436
  const svgDefs = svgEnter.append('defs');
8397
8437
  // Arrowhead marker for measures
8398
- 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');
8438
+ const measureArrow = parameter => {
8439
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
8440
+ 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');
8441
+ };
8442
+ const measureArrowCap = parameter => {
8443
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
8444
+ 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');
8445
+ marker.append('path').attr('stroke', 'context-stroke').attr('fill', 'context-stroke').attr('d', 'M -3 -3 l 6 3 l -6 3 z');
8446
+ marker.append('path').attr('stroke', 'context-stroke').attr('fill', 'context-stroke').attr('stroke-width', '2').attr('d', 'M 4 -4 l 0 8');
8447
+ };
8448
+ measureArrow('a');
8449
+ measureArrow('z');
8450
+ measureArrowCap('v');
8451
+ measureArrow('t0');
8452
+ measureArrowCap('t0');
8399
8453
  // Flat markers for SDs
8400
- 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');
8401
- 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');
8454
+ const sdCap = outcome => {
8455
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */
8456
+ 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');
8457
+ 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');
8458
+ };
8459
+ sdCap('error');
8460
+ sdCap('correct');
8402
8461
  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));
8403
8462
  gradient.append('stop').classed('stop-0', true).attr('offset', '0%');
8404
8463
  gradient.append('stop').classed('stop-100', true).attr('offset', '100%');
@@ -8991,7 +9050,8 @@ class DDMModel extends DecidablesMixinResizeable(AccumulableElement) {
8991
9050
  const aUpdate = evidenceOverlayerMerge.selectAll('.measure.a').data(this.measures ? [this.a] : []);
8992
9051
  // ENTER
8993
9052
  const aEnter = aUpdate.enter().append('g').classed('measure a', true);
8994
- aEnter.append('line').classed('line', true).attr('marker-start', 'url(#measure-arrow)').attr('marker-end', 'url(#measure-arrow)');
9053
+ aEnter.append('line').classed('line', true)
9054
+ /* 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)');
8995
9055
  const aLabel = aEnter.append('text').classed('label', true);
8996
9056
  aLabel.append('tspan').classed('a math-var', true).text('a');
8997
9057
  aLabel.append('tspan').classed('equals', true).text(' = ');
@@ -9009,7 +9069,8 @@ class DDMModel extends DecidablesMixinResizeable(AccumulableElement) {
9009
9069
  const zUpdate = evidenceOverlayerMerge.selectAll('.measure.z').data(this.measures ? [this.z] : []);
9010
9070
  // ENTER
9011
9071
  const zEnter = zUpdate.enter().append('g').classed('measure z', true);
9012
- zEnter.append('line').classed('line', true).attr('marker-start', 'url(#measure-arrow)').attr('marker-end', 'url(#measure-arrow)');
9072
+ zEnter.append('line').classed('line', true)
9073
+ /* 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)');
9013
9074
  const zLabel = zEnter.append('text').classed('label', true);
9014
9075
  zLabel.append('tspan').classed('z math-var', true).text('z');
9015
9076
  zLabel.append('tspan').classed('equals', true).text(' = ');
@@ -9027,19 +9088,21 @@ class DDMModel extends DecidablesMixinResizeable(AccumulableElement) {
9027
9088
  const vUpdate = evidenceOverlayerMerge.selectAll('.measure.v').data(this.measures ? [this.v] : []);
9028
9089
  // ENTER
9029
9090
  const vEnter = vUpdate.enter().append('g').classed('measure v', true);
9030
- vEnter.append('path').classed('line', true).attr('marker-start', 'url(#measure-arrow)').attr('marker-end', 'url(#measure-arrow)');
9091
+ vEnter.append('path').classed('line', true)
9092
+ /* 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)');
9031
9093
  const vLabel = vEnter.append('text').classed('label', true);
9032
9094
  vLabel.append('tspan').classed('v math-var', true).text('v');
9033
9095
  vLabel.append('tspan').classed('equals', true).text(' = ');
9034
9096
  vLabel.append('tspan').classed('value', true);
9035
9097
  // MERGE
9036
- const driftAngle = Math.atan(this.v / 1000 * scaleRatio);
9037
9098
  const driftHypotenuse = timeScale(200) - timeScale(0) + this.rem * 0.75;
9099
+ const driftCorrection = 2 / driftHypotenuse;
9100
+ const driftAngle = Math.atan(this.v / 1000 * scaleRatio) - driftCorrection;
9038
9101
  const driftX = Math.cos(driftAngle) * driftHypotenuse;
9039
9102
  const driftY = Math.sin(driftAngle) * driftHypotenuse;
9040
9103
  const vMerge = vEnter.merge(vUpdate);
9041
9104
  vMerge.select('.line').transition().duration(this.drag ? 0 : transitionDuration).ease(cubicOut).attr('d', `
9042
- M ${timeScale(this.t0 + 200) + this.rem * 0.75}, ${evidenceScale(this.startingPoint)}
9105
+ M ${timeScale(this.t0 + 200) + this.rem * 0.75}, ${evidenceScale(this.startingPoint) - 2}
9043
9106
  A ${timeScale(200) - timeScale(0)} ${timeScale(200) - timeScale(0)} 0 0 0 ${timeScale(this.t0) + driftX} ${evidenceScale(this.startingPoint) - driftY}
9044
9107
  `);
9045
9108
  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);
@@ -9052,7 +9115,8 @@ class DDMModel extends DecidablesMixinResizeable(AccumulableElement) {
9052
9115
  const t0Update = evidenceOverlayerMerge.selectAll('.measure.t0').data(this.measures ? [this.t0] : []);
9053
9116
  // ENTER
9054
9117
  const t0Enter = t0Update.enter().append('g').classed('measure t0', true);
9055
- t0Enter.append('line').classed('line', true).attr('marker-start', 'url(#measure-arrow)').attr('marker-end', 'url(#measure-arrow)');
9118
+ t0Enter.append('line').classed('line', true)
9119
+ /* 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)');
9056
9120
  const t0Label = t0Enter.append('text').classed('label', true);
9057
9121
  t0Label.append('tspan').classed('t0 math-var', true).text('t₀');
9058
9122
  t0Label.append('tspan').classed('equals', true).text(' = ');
@@ -9128,7 +9192,12 @@ class DDMModel extends DecidablesMixinResizeable(AccumulableElement) {
9128
9192
  const sdEnter = sdUpdate.enter().append('g').attr('class', datum => {
9129
9193
  return `model sd ${datum.outcome}`;
9130
9194
  });
9131
- sdEnter.append('line').classed('indicator', true).attr('marker-start', 'url(#model-sd-cap)').attr('marker-end', 'url(#model-sd-cap)');
9195
+ sdEnter.append('line').classed('indicator', true)
9196
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */.attr('marker-start', datum => {
9197
+ return `url(#model-sd-cap-${datum.outcome})`;
9198
+ }).attr('marker-end', datum => {
9199
+ return `url(#model-sd-cap-${datum.outcome})`;
9200
+ });
9132
9201
  // MERGE
9133
9202
  const sdMerge = sdEnter.merge(sdUpdate);
9134
9203
  sdMerge.select('.indicator').transition().duration(this.drag ? 0 : transitionDuration).ease(cubicOut).attr('x1', datum => {
@@ -9152,7 +9221,12 @@ class DDMModel extends DecidablesMixinResizeable(AccumulableElement) {
9152
9221
  const dataSDEnter = dataSDUpdate.enter().append('g').attr('class', datum => {
9153
9222
  return `data sd ${datum.outcome}`;
9154
9223
  });
9155
- dataSDEnter.append('line').classed('indicator', true).attr('marker-start', 'url(#data-sd-cap)').attr('marker-end', 'url(#data-sd-cap)').attr('y1', datum => {
9224
+ dataSDEnter.append('line').classed('indicator', true)
9225
+ /* Hack to avoid lack of context-stroke and context-fill in Safari */.attr('marker-start', datum => {
9226
+ return `url(#data-sd-cap-${datum.outcome})`;
9227
+ }).attr('marker-end', datum => {
9228
+ return `url(#data-sd-cap-${datum.outcome})`;
9229
+ }).attr('y1', datum => {
9156
9230
  return datum.densityScale(0) + (datum.outcome === 'correct' ? 0.375 : -0.375) * this.rem;
9157
9231
  }).attr('y2', datum => {
9158
9232
  return datum.densityScale(0) + (datum.outcome === 'correct' ? 0.375 : -0.375) * this.rem;