@decidables/decidables-elements 0.1.1 → 0.2.0

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.
@@ -3409,28 +3409,8 @@
3409
3409
  */
3410
3410
 
3411
3411
  class DecidablesElement extends s {
3412
- // HACK: Create a unique ID for each DecidablesElement
3413
- // This is needed because Edge/IE11 don't have real Shadow DOM, so IDs leak
3414
- // out of elements and collide if there is more than one of an element on a
3415
- // page. Known issue for checkbox/switches and the id/for pattern on <input>
3416
- // and <label>
3417
- static get uniqueId() {
3418
- DecidablesElement.ID += 1;
3419
- return DecidablesElement.ID;
3420
- }
3421
-
3422
- constructor() {
3423
- super();
3424
- this.uniqueId = `decidables-${DecidablesElement.uniqueId}`;
3425
- }
3426
-
3427
3412
  getComputedStyleValue(property) {
3428
- // HACK: IE11 requires use of polyfill interface to get custom property value in Javascript
3429
- if (window.ShadyCSS) {
3430
- return window.ShadyCSS.getComputedStyleValue(this, property);
3431
- }
3432
-
3433
- return getComputedStyle(this).getPropertyValue(property);
3413
+ return getComputedStyle(this).getPropertyValue(property).trim();
3434
3414
  }
3435
3415
 
3436
3416
  firstUpdated(changedProperties) {
@@ -3602,7 +3582,6 @@
3602
3582
  static get svgFilters() {
3603
3583
  const shadows = DecidablesElement.shadows; // eslint-disable-line prefer-destructuring
3604
3584
 
3605
- const erodeRadius = 1;
3606
3585
  const filters = shadows.elevations.map(z => {
3607
3586
  return y(_t$6 || (_t$6 = _$6`
3608
3587
  <filter id=${0} x="-250%" y="-250%" width="600%" height="600%">
@@ -3624,8 +3603,7 @@
3624
3603
  <feComposite in="opU" in2="blurU" result="shU" operator="in" />
3625
3604
  <feComposite in="opP" in2="blurP" result="shP" operator="in" />
3626
3605
  <feComposite in="opA" in2="blurA" result="shA" operator="in" />
3627
- <!-- HACK Edge: Using a dynamic value for erode radius stops Edge from corrupting the "radius" value! -->
3628
- <feMorphology in="solid" result="smaller" operator="erode" radius=${0} />
3606
+ <feMorphology in="solid" result="smaller" operator="erode" radius="1" />
3629
3607
  <feComposite in="shU" in2="smaller" result="finalU" operator="out" />
3630
3608
  <feComposite in="shP" in2="smaller" result="finalP" operator="out" />
3631
3609
  <feComposite in="shA" in2="smaller" result="finalA" operator="out" />
@@ -3635,7 +3613,7 @@
3635
3613
  <feMergeNode in="finalA" />
3636
3614
  <feMergeNode in="SourceGraphic" />
3637
3615
  </feMerge>
3638
- </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(_t2$6 || (_t2$6 = _$6``)) : y(_t3 || (_t3 = _$6`<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(_t4 || (_t4 = _$6``)) : y(_t5 || (_t5 = _$6`<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(_t6 || (_t6 = _$6``)) : y(_t7 || (_t7 = _$6`<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);
3616
+ </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(_t2$6 || (_t2$6 = _$6``)) : y(_t3 || (_t3 = _$6`<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(_t4 || (_t4 = _$6``)) : y(_t5 || (_t5 = _$6`<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(_t6 || (_t6 = _$6``)) : y(_t7 || (_t7 = _$6`<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);
3639
3617
  });
3640
3618
  return y(_t8 || (_t8 = _$6`
3641
3619
  <svg class="defs">
@@ -3705,9 +3683,7 @@
3705
3683
  `), 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));
3706
3684
  }
3707
3685
 
3708
- } // Static property of DecidablesElement!
3709
-
3710
- DecidablesElement.ID = 0;
3686
+ }
3711
3687
 
3712
3688
  let _$5 = t => t,
3713
3689
  _t$5,
@@ -4119,14 +4095,14 @@
4119
4095
 
4120
4096
  render() {
4121
4097
  return $(_t2$4 || (_t2$4 = _$4`
4122
- <label for=${0}>
4098
+ <label for="slider">
4123
4099
  <slot></slot>
4124
4100
  </label>
4125
4101
  <div class="range">
4126
- <input type="range" id=${0} min=${0} max=${0} step=${0} .value=${0} @change=${0} @input=${0}>
4102
+ <input type="range" id="slider" min=${0} max=${0} step=${0} .value=${0} @change=${0} @input=${0}>
4127
4103
  </div>
4128
4104
  <decidables-spinner min=${0} max=${0} step=${0} .value=${0} @input=${0}></decidables-spinner>
4129
- `), `${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));
4105
+ `), 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));
4130
4106
  }
4131
4107
 
4132
4108
  }
@@ -4436,14 +4412,14 @@
4436
4412
 
4437
4413
  render() {
4438
4414
  return $(_t2$2 || (_t2$2 = _$2`
4439
- <input type="checkbox" id=${0} ?checked=${0} ?disabled=${0} @change=${0}>
4440
- <label for=${0}>
4415
+ <input type="checkbox" id="switch" ?checked=${0} ?disabled=${0} @change=${0}>
4416
+ <label for="switch">
4441
4417
  <slot name="off-label"></slot>
4442
4418
  </label>
4443
- <label for=${0}>
4419
+ <label for="switch">
4444
4420
  <slot></slot>
4445
4421
  </label>
4446
- `), `${this.uniqueId}-checkbox`, this.checked, this.disabled, this.changed.bind(this), `${this.uniqueId}-checkbox`, `${this.uniqueId}-checkbox`);
4422
+ `), this.checked, this.disabled, this.changed.bind(this));
4447
4423
  }
4448
4424
 
4449
4425
  }
@@ -4650,11 +4626,11 @@
4650
4626
 
4651
4627
  render() {
4652
4628
  return $(_t2 || (_t2 = _`
4653
- <input type="radio" id=${0} name=${0} value=${0} .checked=${0} @change=${0}>
4654
- <label for=${0}>
4629
+ <input type="radio" id="toggle-option" name=${0} value=${0} .checked=${0} @change=${0}>
4630
+ <label for="toggle-option">
4655
4631
  <slot></slot>
4656
4632
  </label>
4657
- `), `${this.uniqueId}-radio`, this.name, this.value, this.checked, this.changed.bind(this), `${this.uniqueId}-radio`);
4633
+ `), this.name, this.value, this.checked, this.changed.bind(this));
4658
4634
  }
4659
4635
 
4660
4636
  }