@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/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.7](https://github.com/decidables/decidables/compare/@decidables/accumulable-elements@0.3.6...@decidables/accumulable-elements@0.3.7) (2026-01-14)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **libraries:** add hacks to get Safari to render shadows properly ([120b73c](https://github.com/decidables/decidables/commit/120b73c2e771d59cf43de8dbe8a064a4902b6bd4)), closes [#11](https://github.com/decidables/decidables/issues/11)
12
+
13
+
14
+
15
+ ## [0.3.6](https://github.com/decidables/decidables/compare/@decidables/accumulable-elements@0.3.5...@decidables/accumulable-elements@0.3.6) (2025-11-30)
16
+
17
+ **Note:** Version bump only for package @decidables/accumulable-elements
18
+
19
+
20
+
21
+
22
+
6
23
  ## [0.3.5](https://github.com/decidables/decidables/compare/@decidables/accumulable-elements@0.3.4...@decidables/accumulable-elements@0.3.5) (2025-11-21)
7
24
 
8
25
 
package/README.md CHANGED
@@ -1079,7 +1079,7 @@ export default class AccumulableElementSomething extends AccumulableElement {
1079
1079
  - `gulpfile.js` (Tasks for *gulp*)
1080
1080
  - `package.json` (Package config for *yarn* and *npm*)
1081
1081
  - `README.md` (This file)
1082
- - `rollup-stats.html` (Report on js bundle composition and size) **\[autogenerated\]**
1082
+ - `rollup-stats.auto.html` (Report on js bundle composition and size) **\[autogenerated\]**
1083
1083
 
1084
1084
  ## [License](https://github.com/decidables/decidables/blob/main/LICENSE.md)
1085
1085
 
@@ -4736,54 +4736,12 @@ class DecidablesElement extends i {
4736
4736
  const ambientS = rotate ? `${-ambientM.y}px ${ambientM.y / 2}px ${ambientM.b}px ${ambientM.s}px` : `${ambientM.y / 2}px ${ambientM.y}px ${ambientM.b}px ${ambientM.s}px`;
4737
4737
  return `${umbraS} ${umbraC}, ${penumbraS} ${penumbraC}, ${ambientS} ${ambientC}`;
4738
4738
  }
4739
- static get svgDefs() {
4740
- const shadows = DecidablesElement.shadows; /* eslint-disable-line prefer-destructuring */
4741
-
4742
- const filters = shadows.elevations.map(z => {
4743
- return `
4744
- <filter id=${`shadow-${z}`} filterUnits="userSpaceOnUse" x="-100%" y="-100%" width="200%" height="200%">
4745
- <feComponentTransfer in="SourceAlpha" result="solid">
4746
- <feFuncA type="table" tableValues="0 1 1"/>
4747
- </feComponentTransfer>
4748
- <feOffset in="solid" result="offU" dx=${shadows.mapUmbra[z].y / 2} dy=${shadows.mapUmbra[z].y} />
4749
- <feOffset in="solid" result="offP" dx=${shadows.mapPenumbra[z].y / 2} dy=${shadows.mapPenumbra[z].y} />
4750
- <feOffset in="solid" result="offA" dx=${shadows.mapAmbient[z].y / 2} dy=${shadows.mapAmbient[z].y} />
4751
- ${shadows.mapUmbra[z].s === 0 ? '' : `<feMorphology in="offU" result="spreadU" operator=${shadows.mapUmbra[z].s > 0 ? 'dilate' : 'erode'} radius=${Math.abs(shadows.mapUmbra[z].s)} />`}
4752
- ${shadows.mapPenumbra[z].s === 0 ? '' : `<feMorphology in="offP" result="spreadP" operator=${shadows.mapPenumbra[z].s > 0 ? 'dilate' : 'erode'} radius=${Math.abs(shadows.mapPenumbra[z].s)} />`}
4753
- ${shadows.mapAmbient[z].s === 0 ? '' : `<feMorphology in="offA" result="spreadA" operator=${shadows.mapAmbient[z].s > 0 ? 'dilate' : 'erode'} radius=${Math.abs(shadows.mapAmbient[z].s)} />`}
4754
- <feGaussianBlur in=${shadows.mapUmbra[z].s === 0 ? 'offU' : 'spreadU'} result="blurU" stdDeviation=${shadows.mapUmbra[z].b / 2} />
4755
- <feGaussianBlur in=${shadows.mapPenumbra[z].s === 0 ? 'offP' : 'spreadP'} result="blurP" stdDeviation=${shadows.mapPenumbra[z].b / 2} />
4756
- <feGaussianBlur in=${shadows.mapAmbient[z].s === 0 ? 'offA' : 'spreadA'} result="blurA" stdDeviation=${shadows.mapAmbient[z].b / 2} />
4757
- <feFlood in="SourceGraphic" result="opU" flood-color=${shadows.baselineColor} flood-opacity=${shadows.opacityUmbra + shadows.opacityBoost} />
4758
- <feFlood in="SourceGraphic" result="opP" flood-color=${shadows.baselineColor} flood-opacity=${shadows.opacityPenumbra + shadows.opacityBoost} />
4759
- <feFlood in="SourceGraphic" result="opA" flood-color=${shadows.baselineColor} flood-opacity=${shadows.opacityAmbient + shadows.opacityBoost} />
4760
- <feComposite in="opU" in2="blurU" result="shU" operator="in" />
4761
- <feComposite in="opP" in2="blurP" result="shP" operator="in" />
4762
- <feComposite in="opA" in2="blurA" result="shA" operator="in" />
4763
- <feMorphology in="solid" result="smaller" operator="erode" radius="1" />
4764
- <feComposite in="shU" in2="smaller" result="finalU" operator="out" />
4765
- <feComposite in="shP" in2="smaller" result="finalP" operator="out" />
4766
- <feComposite in="shA" in2="smaller" result="finalA" operator="out" />
4767
- <feMerge>
4768
- <feMergeNode in="finalU" />
4769
- <feMergeNode in="finalP" />
4770
- <feMergeNode in="finalA" />
4771
- <feMergeNode in="SourceGraphic" />
4772
- </feMerge>
4773
- </filter>`;
4774
- });
4775
- return `
4776
- <defs>
4777
- ${filters}
4778
- </defs>
4779
- `;
4780
- }
4781
4739
  static get svgFilters() {
4782
4740
  const shadows = DecidablesElement.shadows; /* eslint-disable-line prefer-destructuring */
4783
4741
 
4784
4742
  const filters = shadows.elevations.map(z => {
4785
4743
  return b`
4786
- <filter id=${`shadow-${z}`} x="-250%" y="-250%" width="600%" height="600%">
4744
+ <filter id=${`shadow-${z}`} filterUnits="userSpaceOnUse" x="-100%" y="-100%" width="200%" height="200%">
4787
4745
  <feComponentTransfer in="SourceAlpha" result="solid">
4788
4746
  <feFuncA type="table" tableValues="0 1 1"/>
4789
4747
  </feComponentTransfer>
@@ -4815,11 +4773,9 @@ class DecidablesElement extends i {
4815
4773
  </filter>`;
4816
4774
  });
4817
4775
  return b`
4818
- <svg class="defs">
4819
- <defs>
4820
- ${filters}
4821
- </defs>
4822
- </svg>
4776
+ <defs class="filtersUser">
4777
+ ${filters}
4778
+ </defs>
4823
4779
  `;
4824
4780
  }
4825
4781
  static get styles() {
@@ -8036,31 +7992,50 @@ class DDMModel extends DecidablesMixinResizeable(AccumulableElement) {
8036
7992
  /*
8037
7993
  OVERLAYER
8038
7994
  */
8039
- .interactive {
7995
+ .boundary.interactive {
7996
+ cursor: ns-resize;
7997
+ }
7998
+
7999
+ .t0z.interactive {
8000
+ cursor: move;
8001
+ }
8002
+
8003
+ .boundary.interactive,
8004
+ .t0z.interactive {
8040
8005
  filter: url("#shadow-2");
8041
8006
  outline: none;
8042
8007
  }
8043
8008
 
8044
- .interactive:hover {
8009
+ .boundary.interactive:hover,
8010
+ .t0z.interactive:hover {
8045
8011
  filter: url("#shadow-4");
8012
+
8013
+ /* HACK: This gets Safari to correctly apply the filter! */
8014
+ /* https://github.com/emilbjorklund/svg-weirdness/issues/27 */
8015
+ transform: translateX(0);
8046
8016
  }
8047
8017
 
8048
- .interactive:active {
8018
+ .boundary.interactive:active,
8019
+ .t0z.interactive:active {
8049
8020
  filter: url("#shadow-8");
8021
+
8022
+ /* HACK: This gets Safari to correctly apply the filter! */
8023
+ transform: translateY(0);
8050
8024
  }
8051
8025
 
8052
- :host(.keyboard) .interactive:focus {
8026
+ :host(.keyboard) .boundary.interactive:focus,
8027
+ :host(.keyboard) .t0z.interactive:focus {
8053
8028
  filter: url("#shadow-8");
8054
- }
8055
8029
 
8056
- .boundary {
8057
- fill: none;
8058
- stroke: var(---color-element-emphasis);
8059
- stroke-width: 2;
8030
+ /* HACK: This gets Safari to correctly apply the filter! */
8031
+ transform: translateZ(0);
8060
8032
  }
8061
8033
 
8062
- .boundary.interactive {
8063
- cursor: ns-resize;
8034
+ .t0z .point {
8035
+ fill: var(---color-element-emphasis);
8036
+ stroke-width: 0;
8037
+
8038
+ r: 6px;
8064
8039
  }
8065
8040
 
8066
8041
  .drift {
@@ -8074,21 +8049,38 @@ class DDMModel extends DecidablesMixinResizeable(AccumulableElement) {
8074
8049
 
8075
8050
  .drift.interactive {
8076
8051
  cursor: ns-resize;
8052
+
8053
+ filter: url("#shadow-2");
8054
+ outline: none;
8055
+
8056
+ /* HACK: This gets Safari to correctly apply the filter! */
8057
+ fill: #000000;
8058
+ fill-opacity: 0;
8077
8059
  }
8078
8060
 
8079
- .drift .arrow {
8080
- stroke-dasharray: none;
8061
+ .drift.interactive:hover {
8062
+ filter: url("#shadow-4");
8063
+
8064
+ /* HACK: This gets Safari to correctly apply the filter! */
8065
+ fill: #ff0000;
8081
8066
  }
8082
8067
 
8083
- .t0z.interactive {
8084
- cursor: move;
8068
+ .drift.interactive:active {
8069
+ filter: url("#shadow-8");
8070
+
8071
+ /* HACK: This gets Safari to correctly apply the filter! */
8072
+ fill: #00ff00;
8085
8073
  }
8086
8074
 
8087
- .t0z .point {
8088
- fill: var(---color-element-emphasis);
8089
- stroke-width: 0;
8075
+ :host(.keyboard) .drift.interactive:focus {
8076
+ filter: url("#shadow-8");
8090
8077
 
8091
- r: 6px;
8078
+ /* HACK: This gets Safari to correctly apply the filter! */
8079
+ fill: #0000ff;
8080
+ }
8081
+
8082
+ .drift .arrow {
8083
+ stroke-dasharray: none;
8092
8084
  }
8093
8085
 
8094
8086
  /* Make larger targets for touch users */
@@ -8450,16 +8442,19 @@ class DDMModel extends DecidablesMixinResizeable(AccumulableElement) {
8450
8442
  rem: this.rem
8451
8443
  }]);
8452
8444
  // ENTER
8453
- const svgEnter = svgUpdate.enter().append('svg').classed('main', true).html(AccumulableElement.svgDefs);
8454
- const svgDefs = svgEnter.append('defs');
8445
+ const svgEnter = svgUpdate.enter().append('svg').classed('main', true).each((datum, index, nodes) => {
8446
+ // Filters for shadows
8447
+ B(AccumulableElement.svgFilters, nodes[index]);
8448
+ });
8449
+ const svgMarkers = svgEnter.append('defs').classed('markers', true);
8455
8450
  // Arrowhead marker for measures
8456
8451
  const measureArrow = parameter => {
8457
8452
  /* Hack to avoid lack of context-stroke and context-fill in Safari */
8458
- svgDefs.append('marker').attr('id', `measure-arrow-${parameter}`).attr('class', `measure-arrow ${parameter}`).attr('orient', 'auto-start-reverse').attr('markerUnits', 'userSpaceOnUse').attr('viewBox', '-10 -6 12 12').attr('refX', '0').attr('refY', '0').attr('markerWidth', '12').attr('markerHeight', '12').append('path').attr('class', 'arrow').attr('d', 'M -7 -3 l 6 3 l -6 3 z');
8453
+ svgMarkers.append('marker').attr('id', `measure-arrow-${parameter}`).attr('class', `measure-arrow ${parameter}`).attr('orient', 'auto-start-reverse').attr('markerUnits', 'userSpaceOnUse').attr('viewBox', '-10 -6 12 12').attr('refX', '0').attr('refY', '0').attr('markerWidth', '12').attr('markerHeight', '12').append('path').attr('class', 'arrow').attr('d', 'M -7 -3 l 6 3 l -6 3 z');
8459
8454
  };
8460
8455
  const measureCappedArrow = parameter => {
8461
8456
  /* Hack to avoid lack of context-stroke and context-fill in Safari */
8462
- const marker = svgDefs.append('marker').attr('id', `measure-capped-arrow-${parameter}`).attr('class', `measure-arrow capped ${parameter}`).attr('orient', 'auto-start-reverse').attr('markerUnits', 'userSpaceOnUse').attr('viewBox', '-10 -6 12 12').attr('refX', '0').attr('refY', '0').attr('markerWidth', '12').attr('markerHeight', '12');
8457
+ const marker = svgMarkers.append('marker').attr('id', `measure-capped-arrow-${parameter}`).attr('class', `measure-arrow capped ${parameter}`).attr('orient', 'auto-start-reverse').attr('markerUnits', 'userSpaceOnUse').attr('viewBox', '-10 -6 12 12').attr('refX', '0').attr('refY', '0').attr('markerWidth', '12').attr('markerHeight', '12');
8463
8458
  marker.append('path').attr('class', 'arrow').attr('d', 'M -7 -3 l 6 3 l -6 3 z');
8464
8459
  marker.append('path').attr('class', 'cap').attr('d', 'M 0 -4 l 0 8');
8465
8460
  };
@@ -8471,12 +8466,12 @@ class DDMModel extends DecidablesMixinResizeable(AccumulableElement) {
8471
8466
  // Flat markers for SDs
8472
8467
  const sdCap = outcome => {
8473
8468
  /* Hack to avoid lack of context-stroke and context-fill in Safari */
8474
- 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');
8475
- 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');
8469
+ svgMarkers.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');
8470
+ svgMarkers.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');
8476
8471
  };
8477
8472
  sdCap('error');
8478
8473
  sdCap('correct');
8479
- 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));
8474
+ const gradient = svgMarkers.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));
8480
8475
  gradient.append('stop').classed('stop-0', true).attr('offset', '0%');
8481
8476
  gradient.append('stop').classed('stop-100', true).attr('offset', '100%');
8482
8477
  // MERGE