@decidables/decidables-elements 0.1.1 → 0.3.1
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 +42 -0
- package/lib/decidablesElements.esm.js +20 -41
- package/lib/decidablesElements.esm.js.map +1 -1
- package/lib/decidablesElements.esm.min.js +25 -24
- package/lib/decidablesElements.esm.min.js.map +1 -1
- package/lib/decidablesElements.umd.js +20 -41
- package/lib/decidablesElements.umd.js.map +1 -1
- package/lib/decidablesElements.umd.min.js +23 -22
- package/lib/decidablesElements.umd.min.js.map +1 -1
- package/package.json +2 -2
- package/src/button.js +1 -1
- package/src/decidables-element.js +7 -29
- package/src/slider.js +2 -2
- package/src/switch.js +3 -3
- package/src/toggle-option.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,48 @@
|
|
|
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.1](https://github.com/decidables/decidables/compare/@decidables/decidables-elements@0.3.0...@decidables/decidables-elements@0.3.1) (2022-04-07)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @decidables/decidables-elements
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.3.0](https://github.com/decidables/decidables/compare/@decidables/decidables-elements@0.2.0...@decidables/decidables-elements@0.3.0) (2022-03-31)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **decidables-elements:** add border and border-radius as core styling variables ([a719f5a](https://github.com/decidables/decidables/commit/a719f5ad191dc9bd3e3ec7f41bc1156c8902f933))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* **all:** improve contrast for UI controls ([4a97725](https://github.com/decidables/decidables/commit/4a9772558c569bf18c92c36731c6b05f9630ac2c))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [0.2.0](https://github.com/decidables/decidables/compare/@decidables/decidables-elements@0.1.1...@decidables/decidables-elements@0.2.0) (2022-03-24)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### ⚠ BREAKING CHANGES
|
|
32
|
+
|
|
33
|
+
* **decidables-elements:** getComputedStyleValue now trims whitespace
|
|
34
|
+
which gets included in CSS custom variables
|
|
35
|
+
* **decidables-elements:** Remove unique ID from DecidablesElement
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
* **decidables-elements:** getComputedStyleValue now trims whitespace ([5d58de2](https://github.com/decidables/decidables/commit/5d58de29f121bc4009d81675a9e5ae1ace3714a9))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Code Refactoring
|
|
43
|
+
|
|
44
|
+
* **decidables-elements:** remove unique ID hack for IE11 ([6d8e721](https://github.com/decidables/decidables/commit/6d8e72119ab42a78317e7c235a50670a2aafc097))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
6
48
|
### [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
49
|
|
|
8
50
|
**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
|
-
|
|
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) {
|
|
@@ -3594,9 +3574,9 @@ class DecidablesElement extends s {
|
|
|
3594
3574
|
}
|
|
3595
3575
|
|
|
3596
3576
|
static get svgFilters() {
|
|
3597
|
-
const shadows = DecidablesElement.shadows;
|
|
3577
|
+
const shadows = DecidablesElement.shadows;
|
|
3578
|
+
/* eslint-disable-line prefer-destructuring */
|
|
3598
3579
|
|
|
3599
|
-
const erodeRadius = 1;
|
|
3600
3580
|
const filters = shadows.elevations.map(z => {
|
|
3601
3581
|
return y(_t$6 || (_t$6 = _$6`
|
|
3602
3582
|
<filter id=${0} x="-250%" y="-250%" width="600%" height="600%">
|
|
@@ -3618,8 +3598,7 @@ class DecidablesElement extends s {
|
|
|
3618
3598
|
<feComposite in="opU" in2="blurU" result="shU" operator="in" />
|
|
3619
3599
|
<feComposite in="opP" in2="blurP" result="shP" operator="in" />
|
|
3620
3600
|
<feComposite in="opA" in2="blurA" result="shA" operator="in" />
|
|
3621
|
-
|
|
3622
|
-
<feMorphology in="solid" result="smaller" operator="erode" radius=${0} />
|
|
3601
|
+
<feMorphology in="solid" result="smaller" operator="erode" radius="1" />
|
|
3623
3602
|
<feComposite in="shU" in2="smaller" result="finalU" operator="out" />
|
|
3624
3603
|
<feComposite in="shP" in2="smaller" result="finalP" operator="out" />
|
|
3625
3604
|
<feComposite in="shA" in2="smaller" result="finalA" operator="out" />
|
|
@@ -3629,7 +3608,7 @@ class DecidablesElement extends s {
|
|
|
3629
3608
|
<feMergeNode in="finalA" />
|
|
3630
3609
|
<feMergeNode in="SourceGraphic" />
|
|
3631
3610
|
</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
|
|
3611
|
+
</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
3612
|
});
|
|
3634
3613
|
return y(_t8 || (_t8 = _$6`
|
|
3635
3614
|
<svg class="defs">
|
|
@@ -3663,6 +3642,8 @@ class DecidablesElement extends s {
|
|
|
3663
3642
|
---font-family-base: var(--font-family-base, "Source Sans", sans-serif);
|
|
3664
3643
|
---font-family-math: var(--font-family-math, "Source Serif", serif);
|
|
3665
3644
|
|
|
3645
|
+
---border: var(--border, 1px solid var(---color-border));
|
|
3646
|
+
---border-radius: var(--border-radius, 0.25rem);
|
|
3666
3647
|
---transition-duration: var(--transition-duration, 500ms);
|
|
3667
3648
|
|
|
3668
3649
|
font-family: var(---font-family-base);
|
|
@@ -3696,12 +3677,10 @@ class DecidablesElement extends s {
|
|
|
3696
3677
|
width: 0;
|
|
3697
3678
|
height: 0;
|
|
3698
3679
|
}
|
|
3699
|
-
`), 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.
|
|
3680
|
+
`), 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.dark25), o$3(this.greys.grey), o$3(this.greys.dark50), o$3(this.greys.dark75));
|
|
3700
3681
|
}
|
|
3701
3682
|
|
|
3702
|
-
}
|
|
3703
|
-
|
|
3704
|
-
DecidablesElement.ID = 0;
|
|
3683
|
+
}
|
|
3705
3684
|
|
|
3706
3685
|
let _$5 = t => t,
|
|
3707
3686
|
_t$5,
|
|
@@ -3740,7 +3719,7 @@ class DecidablesButton extends DecidablesElement {
|
|
|
3740
3719
|
color: var(---color-text-inverse);
|
|
3741
3720
|
|
|
3742
3721
|
border: 0;
|
|
3743
|
-
border-radius:
|
|
3722
|
+
border-radius: var(---border-radius);
|
|
3744
3723
|
outline: none;
|
|
3745
3724
|
}
|
|
3746
3725
|
|
|
@@ -4113,14 +4092,14 @@ class DecidablesSlider extends DecidablesElement {
|
|
|
4113
4092
|
|
|
4114
4093
|
render() {
|
|
4115
4094
|
return $(_t2$4 || (_t2$4 = _$4`
|
|
4116
|
-
<label for
|
|
4095
|
+
<label for="slider">
|
|
4117
4096
|
<slot></slot>
|
|
4118
4097
|
</label>
|
|
4119
4098
|
<div class="range">
|
|
4120
|
-
<input type="range" id
|
|
4099
|
+
<input type="range" id="slider" min=${0} max=${0} step=${0} .value=${0} @change=${0} @input=${0}>
|
|
4121
4100
|
</div>
|
|
4122
4101
|
<decidables-spinner min=${0} max=${0} step=${0} .value=${0} @input=${0}></decidables-spinner>
|
|
4123
|
-
`),
|
|
4102
|
+
`), 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
4103
|
}
|
|
4125
4104
|
|
|
4126
4105
|
}
|
|
@@ -4430,14 +4409,14 @@ class DecidablesSwitch extends DecidablesElement {
|
|
|
4430
4409
|
|
|
4431
4410
|
render() {
|
|
4432
4411
|
return $(_t2$2 || (_t2$2 = _$2`
|
|
4433
|
-
<input type="checkbox" id
|
|
4434
|
-
<label for
|
|
4412
|
+
<input type="checkbox" id="switch" ?checked=${0} ?disabled=${0} @change=${0}>
|
|
4413
|
+
<label for="switch">
|
|
4435
4414
|
<slot name="off-label"></slot>
|
|
4436
4415
|
</label>
|
|
4437
|
-
<label for
|
|
4416
|
+
<label for="switch">
|
|
4438
4417
|
<slot></slot>
|
|
4439
4418
|
</label>
|
|
4440
|
-
`),
|
|
4419
|
+
`), this.checked, this.disabled, this.changed.bind(this));
|
|
4441
4420
|
}
|
|
4442
4421
|
|
|
4443
4422
|
}
|
|
@@ -4644,11 +4623,11 @@ class DecidablesToggleOption extends DecidablesElement {
|
|
|
4644
4623
|
|
|
4645
4624
|
render() {
|
|
4646
4625
|
return $(_t2 || (_t2 = _`
|
|
4647
|
-
<input type="radio" id
|
|
4648
|
-
<label for
|
|
4626
|
+
<input type="radio" id="toggle-option" name=${0} value=${0} .checked=${0} @change=${0}>
|
|
4627
|
+
<label for="toggle-option">
|
|
4649
4628
|
<slot></slot>
|
|
4650
4629
|
</label>
|
|
4651
|
-
`),
|
|
4630
|
+
`), this.name, this.value, this.checked, this.changed.bind(this));
|
|
4652
4631
|
}
|
|
4653
4632
|
|
|
4654
4633
|
}
|