@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
|
@@ -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
|
-
|
|
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) {
|
|
@@ -3600,9 +3580,9 @@
|
|
|
3600
3580
|
}
|
|
3601
3581
|
|
|
3602
3582
|
static get svgFilters() {
|
|
3603
|
-
const shadows = DecidablesElement.shadows;
|
|
3583
|
+
const shadows = DecidablesElement.shadows;
|
|
3584
|
+
/* eslint-disable-line prefer-destructuring */
|
|
3604
3585
|
|
|
3605
|
-
const erodeRadius = 1;
|
|
3606
3586
|
const filters = shadows.elevations.map(z => {
|
|
3607
3587
|
return y(_t$6 || (_t$6 = _$6`
|
|
3608
3588
|
<filter id=${0} x="-250%" y="-250%" width="600%" height="600%">
|
|
@@ -3624,8 +3604,7 @@
|
|
|
3624
3604
|
<feComposite in="opU" in2="blurU" result="shU" operator="in" />
|
|
3625
3605
|
<feComposite in="opP" in2="blurP" result="shP" operator="in" />
|
|
3626
3606
|
<feComposite in="opA" in2="blurA" result="shA" operator="in" />
|
|
3627
|
-
|
|
3628
|
-
<feMorphology in="solid" result="smaller" operator="erode" radius=${0} />
|
|
3607
|
+
<feMorphology in="solid" result="smaller" operator="erode" radius="1" />
|
|
3629
3608
|
<feComposite in="shU" in2="smaller" result="finalU" operator="out" />
|
|
3630
3609
|
<feComposite in="shP" in2="smaller" result="finalP" operator="out" />
|
|
3631
3610
|
<feComposite in="shA" in2="smaller" result="finalA" operator="out" />
|
|
@@ -3635,7 +3614,7 @@
|
|
|
3635
3614
|
<feMergeNode in="finalA" />
|
|
3636
3615
|
<feMergeNode in="SourceGraphic" />
|
|
3637
3616
|
</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
|
|
3617
|
+
</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
3618
|
});
|
|
3640
3619
|
return y(_t8 || (_t8 = _$6`
|
|
3641
3620
|
<svg class="defs">
|
|
@@ -3669,6 +3648,8 @@
|
|
|
3669
3648
|
---font-family-base: var(--font-family-base, "Source Sans", sans-serif);
|
|
3670
3649
|
---font-family-math: var(--font-family-math, "Source Serif", serif);
|
|
3671
3650
|
|
|
3651
|
+
---border: var(--border, 1px solid var(---color-border));
|
|
3652
|
+
---border-radius: var(--border-radius, 0.25rem);
|
|
3672
3653
|
---transition-duration: var(--transition-duration, 500ms);
|
|
3673
3654
|
|
|
3674
3655
|
font-family: var(---font-family-base);
|
|
@@ -3702,12 +3683,10 @@
|
|
|
3702
3683
|
width: 0;
|
|
3703
3684
|
height: 0;
|
|
3704
3685
|
}
|
|
3705
|
-
`), 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.
|
|
3686
|
+
`), 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));
|
|
3706
3687
|
}
|
|
3707
3688
|
|
|
3708
|
-
}
|
|
3709
|
-
|
|
3710
|
-
DecidablesElement.ID = 0;
|
|
3689
|
+
}
|
|
3711
3690
|
|
|
3712
3691
|
let _$5 = t => t,
|
|
3713
3692
|
_t$5,
|
|
@@ -3746,7 +3725,7 @@
|
|
|
3746
3725
|
color: var(---color-text-inverse);
|
|
3747
3726
|
|
|
3748
3727
|
border: 0;
|
|
3749
|
-
border-radius:
|
|
3728
|
+
border-radius: var(---border-radius);
|
|
3750
3729
|
outline: none;
|
|
3751
3730
|
}
|
|
3752
3731
|
|
|
@@ -4119,14 +4098,14 @@
|
|
|
4119
4098
|
|
|
4120
4099
|
render() {
|
|
4121
4100
|
return $(_t2$4 || (_t2$4 = _$4`
|
|
4122
|
-
<label for
|
|
4101
|
+
<label for="slider">
|
|
4123
4102
|
<slot></slot>
|
|
4124
4103
|
</label>
|
|
4125
4104
|
<div class="range">
|
|
4126
|
-
<input type="range" id
|
|
4105
|
+
<input type="range" id="slider" min=${0} max=${0} step=${0} .value=${0} @change=${0} @input=${0}>
|
|
4127
4106
|
</div>
|
|
4128
4107
|
<decidables-spinner min=${0} max=${0} step=${0} .value=${0} @input=${0}></decidables-spinner>
|
|
4129
|
-
`),
|
|
4108
|
+
`), 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
4109
|
}
|
|
4131
4110
|
|
|
4132
4111
|
}
|
|
@@ -4436,14 +4415,14 @@
|
|
|
4436
4415
|
|
|
4437
4416
|
render() {
|
|
4438
4417
|
return $(_t2$2 || (_t2$2 = _$2`
|
|
4439
|
-
<input type="checkbox" id
|
|
4440
|
-
<label for
|
|
4418
|
+
<input type="checkbox" id="switch" ?checked=${0} ?disabled=${0} @change=${0}>
|
|
4419
|
+
<label for="switch">
|
|
4441
4420
|
<slot name="off-label"></slot>
|
|
4442
4421
|
</label>
|
|
4443
|
-
<label for
|
|
4422
|
+
<label for="switch">
|
|
4444
4423
|
<slot></slot>
|
|
4445
4424
|
</label>
|
|
4446
|
-
`),
|
|
4425
|
+
`), this.checked, this.disabled, this.changed.bind(this));
|
|
4447
4426
|
}
|
|
4448
4427
|
|
|
4449
4428
|
}
|
|
@@ -4650,11 +4629,11 @@
|
|
|
4650
4629
|
|
|
4651
4630
|
render() {
|
|
4652
4631
|
return $(_t2 || (_t2 = _`
|
|
4653
|
-
<input type="radio" id
|
|
4654
|
-
<label for
|
|
4632
|
+
<input type="radio" id="toggle-option" name=${0} value=${0} .checked=${0} @change=${0}>
|
|
4633
|
+
<label for="toggle-option">
|
|
4655
4634
|
<slot></slot>
|
|
4656
4635
|
</label>
|
|
4657
|
-
`),
|
|
4636
|
+
`), this.name, this.value, this.checked, this.changed.bind(this));
|
|
4658
4637
|
}
|
|
4659
4638
|
|
|
4660
4639
|
}
|