@decidables/detectable-elements 0.1.1 → 0.1.2

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.
@@ -6484,28 +6484,8 @@
6484
6484
  */
6485
6485
 
6486
6486
  class DecidablesElement extends s {
6487
- // HACK: Create a unique ID for each DecidablesElement
6488
- // This is needed because Edge/IE11 don't have real Shadow DOM, so IDs leak
6489
- // out of elements and collide if there is more than one of an element on a
6490
- // page. Known issue for checkbox/switches and the id/for pattern on <input>
6491
- // and <label>
6492
- static get uniqueId() {
6493
- DecidablesElement.ID += 1;
6494
- return DecidablesElement.ID;
6495
- }
6496
-
6497
- constructor() {
6498
- super();
6499
- this.uniqueId = `decidables-${DecidablesElement.uniqueId}`;
6500
- }
6501
-
6502
6487
  getComputedStyleValue(property) {
6503
- // HACK: IE11 requires use of polyfill interface to get custom property value in Javascript
6504
- if (window.ShadyCSS) {
6505
- return window.ShadyCSS.getComputedStyleValue(this, property);
6506
- }
6507
-
6508
- return getComputedStyle(this).getPropertyValue(property);
6488
+ return getComputedStyle(this).getPropertyValue(property).trim();
6509
6489
  }
6510
6490
 
6511
6491
  firstUpdated(changedProperties) {
@@ -6677,7 +6657,6 @@
6677
6657
  static get svgFilters() {
6678
6658
  const shadows = DecidablesElement.shadows; // eslint-disable-line prefer-destructuring
6679
6659
 
6680
- const erodeRadius = 1;
6681
6660
  const filters = shadows.elevations.map(z => {
6682
6661
  return y$1(_t$m || (_t$m = _$m`
6683
6662
  <filter id=${0} x="-250%" y="-250%" width="600%" height="600%">
@@ -6699,8 +6678,7 @@
6699
6678
  <feComposite in="opU" in2="blurU" result="shU" operator="in" />
6700
6679
  <feComposite in="opP" in2="blurP" result="shP" operator="in" />
6701
6680
  <feComposite in="opA" in2="blurA" result="shA" operator="in" />
6702
- <!-- HACK Edge: Using a dynamic value for erode radius stops Edge from corrupting the "radius" value! -->
6703
- <feMorphology in="solid" result="smaller" operator="erode" radius=${0} />
6681
+ <feMorphology in="solid" result="smaller" operator="erode" radius="1" />
6704
6682
  <feComposite in="shU" in2="smaller" result="finalU" operator="out" />
6705
6683
  <feComposite in="shP" in2="smaller" result="finalP" operator="out" />
6706
6684
  <feComposite in="shA" in2="smaller" result="finalA" operator="out" />
@@ -6710,7 +6688,7 @@
6710
6688
  <feMergeNode in="finalA" />
6711
6689
  <feMergeNode in="SourceGraphic" />
6712
6690
  </feMerge>
6713
- </filter>`), `shadow-${z}`, shadows.mapUmbra[z].y / 2, shadows.mapUmbra[z].y, shadows.mapPenumbra[z].y / 2, shadows.mapPenumbra[z].y, shadows.mapAmbient[z].y / 2, shadows.mapAmbient[z].y, shadows.mapUmbra[z].s === 0 ? y$1(_t2$k || (_t2$k = _$m``)) : y$1(_t3$a || (_t3$a = _$m`<feMorphology in="offU" result="spreadU" operator=${0} radius=${0} />`), shadows.mapUmbra[z].s > 0 ? 'dilate' : 'erode', Math.abs(shadows.mapUmbra[z].s)), shadows.mapPenumbra[z].s === 0 ? y$1(_t4$a || (_t4$a = _$m``)) : y$1(_t5$a || (_t5$a = _$m`<feMorphology in="offP" result="spreadP" operator=${0} radius=${0} />`), shadows.mapPenumbra[z].s > 0 ? 'dilate' : 'erode', Math.abs(shadows.mapPenumbra[z].s)), shadows.mapAmbient[z].s === 0 ? y$1(_t6$a || (_t6$a = _$m``)) : y$1(_t7$a || (_t7$a = _$m`<feMorphology in="offA" result="spreadA" operator=${0} radius=${0} />`), shadows.mapAmbient[z].s > 0 ? 'dilate' : 'erode', Math.abs(shadows.mapAmbient[z].s)), shadows.mapUmbra[z].s === 0 ? 'offU' : 'spreadU', shadows.mapUmbra[z].b / 2, shadows.mapPenumbra[z].s === 0 ? 'offP' : 'spreadP', shadows.mapPenumbra[z].b / 2, shadows.mapAmbient[z].s === 0 ? 'offA' : 'spreadA', shadows.mapAmbient[z].b / 2, shadows.baselineColor, shadows.opacityUmbra + shadows.opacityBoost, shadows.baselineColor, shadows.opacityPenumbra + shadows.opacityBoost, shadows.baselineColor, shadows.opacityAmbient + shadows.opacityBoost, erodeRadius);
6691
+ </filter>`), `shadow-${z}`, shadows.mapUmbra[z].y / 2, shadows.mapUmbra[z].y, shadows.mapPenumbra[z].y / 2, shadows.mapPenumbra[z].y, shadows.mapAmbient[z].y / 2, shadows.mapAmbient[z].y, shadows.mapUmbra[z].s === 0 ? y$1(_t2$k || (_t2$k = _$m``)) : y$1(_t3$a || (_t3$a = _$m`<feMorphology in="offU" result="spreadU" operator=${0} radius=${0} />`), shadows.mapUmbra[z].s > 0 ? 'dilate' : 'erode', Math.abs(shadows.mapUmbra[z].s)), shadows.mapPenumbra[z].s === 0 ? y$1(_t4$a || (_t4$a = _$m``)) : y$1(_t5$a || (_t5$a = _$m`<feMorphology in="offP" result="spreadP" operator=${0} radius=${0} />`), shadows.mapPenumbra[z].s > 0 ? 'dilate' : 'erode', Math.abs(shadows.mapPenumbra[z].s)), shadows.mapAmbient[z].s === 0 ? y$1(_t6$a || (_t6$a = _$m``)) : y$1(_t7$a || (_t7$a = _$m`<feMorphology in="offA" result="spreadA" operator=${0} radius=${0} />`), shadows.mapAmbient[z].s > 0 ? 'dilate' : 'erode', Math.abs(shadows.mapAmbient[z].s)), shadows.mapUmbra[z].s === 0 ? 'offU' : 'spreadU', shadows.mapUmbra[z].b / 2, shadows.mapPenumbra[z].s === 0 ? 'offP' : 'spreadP', shadows.mapPenumbra[z].b / 2, shadows.mapAmbient[z].s === 0 ? 'offA' : 'spreadA', shadows.mapAmbient[z].b / 2, shadows.baselineColor, shadows.opacityUmbra + shadows.opacityBoost, shadows.baselineColor, shadows.opacityPenumbra + shadows.opacityBoost, shadows.baselineColor, shadows.opacityAmbient + shadows.opacityBoost);
6714
6692
  });
6715
6693
  return y$1(_t8$8 || (_t8$8 = _$m`
6716
6694
  <svg class="defs">
@@ -6780,9 +6758,7 @@
6780
6758
  `), o$3(this.cssBoxShadow(0)), o$3(this.cssBoxShadow(2)), o$3(this.cssBoxShadow(4)), o$3(this.cssBoxShadow(8)), o$3(this.greys.white), o$3(this.greys.light75), o$3(this.greys.dark75), o$3(this.greys.white), o$3(this.greys.dark25), o$3(this.greys.light75), o$3(this.greys.light50), o$3(this.greys.grey), o$3(this.greys.dark25), o$3(this.greys.dark50), o$3(this.greys.dark75));
6781
6759
  }
6782
6760
 
6783
- } // Static property of DecidablesElement!
6784
-
6785
- DecidablesElement.ID = 0;
6761
+ }
6786
6762
 
6787
6763
  let _$l = t => t,
6788
6764
  _t$l,
@@ -7194,14 +7170,14 @@
7194
7170
 
7195
7171
  render() {
7196
7172
  return $(_t2$i || (_t2$i = _$k`
7197
- <label for=${0}>
7173
+ <label for="slider">
7198
7174
  <slot></slot>
7199
7175
  </label>
7200
7176
  <div class="range">
7201
- <input type="range" id=${0} min=${0} max=${0} step=${0} .value=${0} @change=${0} @input=${0}>
7177
+ <input type="range" id="slider" min=${0} max=${0} step=${0} .value=${0} @change=${0} @input=${0}>
7202
7178
  </div>
7203
7179
  <decidables-spinner min=${0} max=${0} step=${0} .value=${0} @input=${0}></decidables-spinner>
7204
- `), `${this.uniqueId}-slider`, `${this.uniqueId}-slider`, l(this.min), l(this.max), l(this.step), this.value, this.changed.bind(this), this.inputted.bind(this), l(this.min), l(this.max), l(this.step), this.value, this.inputted.bind(this));
7180
+ `), l(this.min), l(this.max), l(this.step), this.value, this.changed.bind(this), this.inputted.bind(this), l(this.min), l(this.max), l(this.step), this.value, this.inputted.bind(this));
7205
7181
  }
7206
7182
 
7207
7183
  }
@@ -7511,14 +7487,14 @@
7511
7487
 
7512
7488
  render() {
7513
7489
  return $(_t2$g || (_t2$g = _$i`
7514
- <input type="checkbox" id=${0} ?checked=${0} ?disabled=${0} @change=${0}>
7515
- <label for=${0}>
7490
+ <input type="checkbox" id="switch" ?checked=${0} ?disabled=${0} @change=${0}>
7491
+ <label for="switch">
7516
7492
  <slot name="off-label"></slot>
7517
7493
  </label>
7518
- <label for=${0}>
7494
+ <label for="switch">
7519
7495
  <slot></slot>
7520
7496
  </label>
7521
- `), `${this.uniqueId}-checkbox`, this.checked, this.disabled, this.changed.bind(this), `${this.uniqueId}-checkbox`, `${this.uniqueId}-checkbox`);
7497
+ `), this.checked, this.disabled, this.changed.bind(this));
7522
7498
  }
7523
7499
 
7524
7500
  }
@@ -7725,11 +7701,11 @@
7725
7701
 
7726
7702
  render() {
7727
7703
  return $(_t2$e || (_t2$e = _$g`
7728
- <input type="radio" id=${0} name=${0} value=${0} .checked=${0} @change=${0}>
7729
- <label for=${0}>
7704
+ <input type="radio" id="toggle-option" name=${0} value=${0} .checked=${0} @change=${0}>
7705
+ <label for="toggle-option">
7730
7706
  <slot></slot>
7731
7707
  </label>
7732
- `), `${this.uniqueId}-radio`, this.name, this.value, this.checked, this.changed.bind(this), `${this.uniqueId}-radio`);
7708
+ `), this.name, this.value, this.checked, this.changed.bind(this));
7733
7709
  }
7734
7710
 
7735
7711
  }
@@ -8042,7 +8018,7 @@
8042
8018
  }
8043
8019
 
8044
8020
  .dot {
8045
- /* r: 2px; HACK: Firefox does not support CSS SVG Geometry Properties */
8021
+ r: 2px;
8046
8022
  }
8047
8023
 
8048
8024
  .dots.coherent {
@@ -8088,9 +8064,8 @@
8088
8064
 
8089
8065
  firstUpdated(changedProperties) {
8090
8066
  super.firstUpdated(changedProperties); // Get the width and height after initial render/update has occurred
8091
- // HACK Edge: Edge doesn't have width/height until after a 0ms timeout
8092
8067
 
8093
- window.setTimeout(this.getDimensions.bind(this), 0);
8068
+ this.getDimensions();
8094
8069
  }
8095
8070
 
8096
8071
  update(changedProperties) {
@@ -8378,9 +8353,7 @@
8378
8353
  return datum;
8379
8354
  }); // ENTER
8380
8355
 
8381
- const dotEnter = dotUpdate.enter().append('circle').classed('dot', true).attr('r', 2);
8382
- /* HACK: Firefox does not support CSS SVG Geometry Properties */
8383
- // MERGE
8356
+ const dotEnter = dotUpdate.enter().append('circle').classed('dot', true); // MERGE
8384
8357
 
8385
8358
  dotEnter.merge(dotUpdate).attr('cx', datum => {
8386
8359
  return datum.x;
@@ -13601,7 +13574,7 @@
13601
13574
  .point .circle {
13602
13575
  fill: var(---color-element-emphasis);
13603
13576
 
13604
- /* r: 6; HACK: Firefox does not support CSS SVG Geometry Properties */
13577
+ r: 6px;
13605
13578
  }
13606
13579
 
13607
13580
  .point .label {
@@ -13640,9 +13613,8 @@
13640
13613
 
13641
13614
  firstUpdated(changedProperties) {
13642
13615
  super.firstUpdated(changedProperties); // Get the width and height after initial render/update has occurred
13643
- // HACK Edge: Edge doesn't have width/height until after a 0ms timeout
13644
13616
 
13645
- window.setTimeout(this.getDimensions.bind(this), 0);
13617
+ this.getDimensions();
13646
13618
  }
13647
13619
 
13648
13620
  update(changedProperties) {
@@ -14033,9 +14005,7 @@
14033
14005
  }); // ENTER
14034
14006
 
14035
14007
  const pointEnter = pointUpdate.enter().append('g').classed('point', true);
14036
- pointEnter.append('circle').classed('circle', true).attr('r', 6);
14037
- /* HACK: Firefox does not support CSS SVG Geometry Properties */
14038
-
14008
+ pointEnter.append('circle').classed('circle', true);
14039
14009
  pointEnter.append('text').classed('label', true); // MERGE
14040
14010
 
14041
14011
  const pointMerge = pointEnter.merge(pointUpdate);
@@ -14397,13 +14367,13 @@
14397
14367
  </div>`), this.trials ? $(_t3$9 || (_t3$9 = _$c`<decidables-slider min="1" max="100" step="1" .value=${0} @change=${0} @input=${0}>Trials</decidables-slider>`), this.trials, this.setTrials.bind(this), this.setTrials.bind(this)) : $(_t4$9 || (_t4$9 = _$c``)), this.duration ? $(_t5$9 || (_t5$9 = _$c`<decidables-slider min="10" max="2000" step="10" .value=${0} @change=${0} @input=${0}>Duration</decidables-slider>`), this.duration, this.setDuration.bind(this), this.setDuration.bind(this)) : $(_t6$9 || (_t6$9 = _$c``)), this.coherence ? $(_t7$9 || (_t7$9 = _$c`<decidables-slider min="0" max="1" step=".01" .value=${0} @change=${0} @input=${0}>Coherence</decidables-slider>`), this.coherence, this.setCoherence.bind(this), this.setCoherence.bind(this)) : $(_t8$7 || (_t8$7 = _$c``)), this.payoff ? $(_t9$7 || (_t9$7 = _$c`<decidables-slider class="payoff" min="0" max="100" step="1" .value=${0} @change=${0} @input=${0}>Payoff</decidables-slider>`), this.payoff, this.setPayoff.bind(this), this.setPayoff.bind(this)) : $(_t10$7 || (_t10$7 = _$c``)), this.color !== undefined ? $(_t11$7 || (_t11$7 = _$c`
14398
14368
  <decidables-toggle @change=${0}>
14399
14369
  <span slot="label">Emphasis</span>
14400
- <decidables-toggle-option name=${0} value="none" ?checked=${0}>None</decidables-toggle-option>
14401
- <decidables-toggle-option name=${0} value="accuracy" ?checked=${0}>Accuracy</decidables-toggle-option>
14402
- <decidables-toggle-option name=${0} value="stimulus" ?checked=${0}>Stimulus</decidables-toggle-option>
14403
- <decidables-toggle-option name=${0} value="response" ?checked=${0}>Response</decidables-toggle-option>
14404
- <decidables-toggle-option name=${0} value="outcome" ?checked=${0}>Outcome</decidables-toggle-option>
14370
+ <decidables-toggle-option name="toggle" value="none" ?checked=${0}>None</decidables-toggle-option>
14371
+ <decidables-toggle-option name="toggle" value="accuracy" ?checked=${0}>Accuracy</decidables-toggle-option>
14372
+ <decidables-toggle-option name="toggle" value="stimulus" ?checked=${0}>Stimulus</decidables-toggle-option>
14373
+ <decidables-toggle-option name="toggle" value="response" ?checked=${0}>Response</decidables-toggle-option>
14374
+ <decidables-toggle-option name="toggle" value="outcome" ?checked=${0}>Outcome</decidables-toggle-option>
14405
14375
  </decidables-toggle>
14406
- `), this.chooseColor.bind(this), `${this.uniqueId}-color`, this.color === 'none', `${this.uniqueId}-color`, this.color === 'accuracy', `${this.uniqueId}-color`, this.color === 'stimulus', `${this.uniqueId}-color`, this.color === 'response', `${this.uniqueId}-color`, this.color === 'outcome') : $(_t12$2 || (_t12$2 = _$c``)), this.zRoc !== undefined ? $(_t13$2 || (_t13$2 = _$c`
14376
+ `), this.chooseColor.bind(this), this.color === 'none', this.color === 'accuracy', this.color === 'stimulus', this.color === 'response', this.color === 'outcome') : $(_t12$2 || (_t12$2 = _$c``)), this.zRoc !== undefined ? $(_t13$2 || (_t13$2 = _$c`
14407
14377
  <decidables-switch ?checked=${0} @change=${0}>
14408
14378
  <span class="math-var">z</span>ROC
14409
14379
  <span slot="off-label">ROC</span>
@@ -14847,7 +14817,7 @@
14847
14817
  .threshold .handle {
14848
14818
  fill: var(---color-element-emphasis);
14849
14819
 
14850
- /* r: 6; HACK: Firefox does not support CSS SVG Geometry Properties */
14820
+ r: 6px;
14851
14821
  }
14852
14822
 
14853
14823
  /* Make a larger target for touch users */
@@ -14946,9 +14916,8 @@
14946
14916
 
14947
14917
  firstUpdated(changedProperties) {
14948
14918
  super.firstUpdated(changedProperties); // Get the width and height after initial render/update has occurred
14949
- // HACK Edge: Edge doesn't have width/height until after a 0ms timeout
14950
14919
 
14951
- window.setTimeout(this.getDimensions.bind(this), 0);
14920
+ this.getDimensions();
14952
14921
  }
14953
14922
 
14954
14923
  update(changedProperties) {
@@ -15581,9 +15550,7 @@
15581
15550
 
15582
15551
  const thresholdEnter = thresholdUpdate.enter().append('g').classed('threshold', true);
15583
15552
  thresholdEnter.append('line').classed('line', true);
15584
- thresholdEnter.append('circle').classed('handle', true).attr('r', 6);
15585
- /* HACK: Firefox does not support CSS SVG Geometry Properties */
15586
- // MERGE
15553
+ thresholdEnter.append('circle').classed('handle', true); // MERGE
15587
15554
 
15588
15555
  const thresholdMerge = thresholdEnter.merge(thresholdUpdate).attr('tabindex', this.interactive ? 0 : null).classed('interactive', this.interactive);
15589
15556
 
@@ -18210,9 +18177,6 @@
18210
18177
  ---border: var(--border, 1px solid var(---color-border));
18211
18178
  display: inline-block;
18212
18179
 
18213
- /* This makes IE11 happy */
18214
- width: 100%;
18215
-
18216
18180
  margin-bottom: 1rem;
18217
18181
  }
18218
18182