@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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,26 @@
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.2.0](https://github.com/decidables/decidables/compare/@decidables/decidables-elements@0.1.1...@decidables/decidables-elements@0.2.0) (2022-03-24)
7
+
8
+
9
+ ### ⚠ BREAKING CHANGES
10
+
11
+ * **decidables-elements:** getComputedStyleValue now trims whitespace
12
+ which gets included in CSS custom variables
13
+ * **decidables-elements:** Remove unique ID from DecidablesElement
14
+
15
+ ### Bug Fixes
16
+
17
+ * **decidables-elements:** getComputedStyleValue now trims whitespace ([5d58de2](https://github.com/decidables/decidables/commit/5d58de29f121bc4009d81675a9e5ae1ace3714a9))
18
+
19
+
20
+ ### Code Refactoring
21
+
22
+ * **decidables-elements:** remove unique ID hack for IE11 ([6d8e721](https://github.com/decidables/decidables/commit/6d8e72119ab42a78317e7c235a50670a2aafc097))
23
+
24
+
25
+
6
26
  ### [0.1.1](https://github.com/decidables/decidables/compare/@decidables/decidables-elements@0.1.0...@decidables/decidables-elements@0.1.1) (2022-03-21)
7
27
 
8
28
  **Note:** Version bump only for package @decidables/decidables-elements
@@ -3403,28 +3403,8 @@ let _$6 = t => t,
3403
3403
  */
3404
3404
 
3405
3405
  class DecidablesElement extends s {
3406
- // HACK: Create a unique ID for each DecidablesElement
3407
- // This is needed because Edge/IE11 don't have real Shadow DOM, so IDs leak
3408
- // out of elements and collide if there is more than one of an element on a
3409
- // page. Known issue for checkbox/switches and the id/for pattern on <input>
3410
- // and <label>
3411
- static get uniqueId() {
3412
- DecidablesElement.ID += 1;
3413
- return DecidablesElement.ID;
3414
- }
3415
-
3416
- constructor() {
3417
- super();
3418
- this.uniqueId = `decidables-${DecidablesElement.uniqueId}`;
3419
- }
3420
-
3421
3406
  getComputedStyleValue(property) {
3422
- // HACK: IE11 requires use of polyfill interface to get custom property value in Javascript
3423
- if (window.ShadyCSS) {
3424
- return window.ShadyCSS.getComputedStyleValue(this, property);
3425
- }
3426
-
3427
- return getComputedStyle(this).getPropertyValue(property);
3407
+ return getComputedStyle(this).getPropertyValue(property).trim();
3428
3408
  }
3429
3409
 
3430
3410
  firstUpdated(changedProperties) {
@@ -3596,7 +3576,6 @@ class DecidablesElement extends s {
3596
3576
  static get svgFilters() {
3597
3577
  const shadows = DecidablesElement.shadows; // eslint-disable-line prefer-destructuring
3598
3578
 
3599
- const erodeRadius = 1;
3600
3579
  const filters = shadows.elevations.map(z => {
3601
3580
  return y(_t$6 || (_t$6 = _$6`
3602
3581
  <filter id=${0} x="-250%" y="-250%" width="600%" height="600%">
@@ -3618,8 +3597,7 @@ class DecidablesElement extends s {
3618
3597
  <feComposite in="opU" in2="blurU" result="shU" operator="in" />
3619
3598
  <feComposite in="opP" in2="blurP" result="shP" operator="in" />
3620
3599
  <feComposite in="opA" in2="blurA" result="shA" operator="in" />
3621
- <!-- HACK Edge: Using a dynamic value for erode radius stops Edge from corrupting the "radius" value! -->
3622
- <feMorphology in="solid" result="smaller" operator="erode" radius=${0} />
3600
+ <feMorphology in="solid" result="smaller" operator="erode" radius="1" />
3623
3601
  <feComposite in="shU" in2="smaller" result="finalU" operator="out" />
3624
3602
  <feComposite in="shP" in2="smaller" result="finalP" operator="out" />
3625
3603
  <feComposite in="shA" in2="smaller" result="finalA" operator="out" />
@@ -3629,7 +3607,7 @@ class DecidablesElement extends s {
3629
3607
  <feMergeNode in="finalA" />
3630
3608
  <feMergeNode in="SourceGraphic" />
3631
3609
  </feMerge>
3632
- </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);
3610
+ </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);
3633
3611
  });
3634
3612
  return y(_t8 || (_t8 = _$6`
3635
3613
  <svg class="defs">
@@ -3699,9 +3677,7 @@ class DecidablesElement extends s {
3699
3677
  `), 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));
3700
3678
  }
3701
3679
 
3702
- } // Static property of DecidablesElement!
3703
-
3704
- DecidablesElement.ID = 0;
3680
+ }
3705
3681
 
3706
3682
  let _$5 = t => t,
3707
3683
  _t$5,
@@ -4113,14 +4089,14 @@ class DecidablesSlider extends DecidablesElement {
4113
4089
 
4114
4090
  render() {
4115
4091
  return $(_t2$4 || (_t2$4 = _$4`
4116
- <label for=${0}>
4092
+ <label for="slider">
4117
4093
  <slot></slot>
4118
4094
  </label>
4119
4095
  <div class="range">
4120
- <input type="range" id=${0} min=${0} max=${0} step=${0} .value=${0} @change=${0} @input=${0}>
4096
+ <input type="range" id="slider" min=${0} max=${0} step=${0} .value=${0} @change=${0} @input=${0}>
4121
4097
  </div>
4122
4098
  <decidables-spinner min=${0} max=${0} step=${0} .value=${0} @input=${0}></decidables-spinner>
4123
- `), `${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));
4099
+ `), 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));
4124
4100
  }
4125
4101
 
4126
4102
  }
@@ -4430,14 +4406,14 @@ class DecidablesSwitch extends DecidablesElement {
4430
4406
 
4431
4407
  render() {
4432
4408
  return $(_t2$2 || (_t2$2 = _$2`
4433
- <input type="checkbox" id=${0} ?checked=${0} ?disabled=${0} @change=${0}>
4434
- <label for=${0}>
4409
+ <input type="checkbox" id="switch" ?checked=${0} ?disabled=${0} @change=${0}>
4410
+ <label for="switch">
4435
4411
  <slot name="off-label"></slot>
4436
4412
  </label>
4437
- <label for=${0}>
4413
+ <label for="switch">
4438
4414
  <slot></slot>
4439
4415
  </label>
4440
- `), `${this.uniqueId}-checkbox`, this.checked, this.disabled, this.changed.bind(this), `${this.uniqueId}-checkbox`, `${this.uniqueId}-checkbox`);
4416
+ `), this.checked, this.disabled, this.changed.bind(this));
4441
4417
  }
4442
4418
 
4443
4419
  }
@@ -4644,11 +4620,11 @@ class DecidablesToggleOption extends DecidablesElement {
4644
4620
 
4645
4621
  render() {
4646
4622
  return $(_t2 || (_t2 = _`
4647
- <input type="radio" id=${0} name=${0} value=${0} .checked=${0} @change=${0}>
4648
- <label for=${0}>
4623
+ <input type="radio" id="toggle-option" name=${0} value=${0} .checked=${0} @change=${0}>
4624
+ <label for="toggle-option">
4649
4625
  <slot></slot>
4650
4626
  </label>
4651
- `), `${this.uniqueId}-radio`, this.name, this.value, this.checked, this.changed.bind(this), `${this.uniqueId}-radio`);
4627
+ `), this.name, this.value, this.checked, this.changed.bind(this));
4652
4628
  }
4653
4629
 
4654
4630
  }