@decidables/decidables-elements 0.0.4 → 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/package.json CHANGED
@@ -1,7 +1,14 @@
1
1
  {
2
2
  "name": "@decidables/decidables-elements",
3
- "version": "0.0.4",
3
+ "version": "0.2.0",
4
4
  "description": "decidables-elements: Basic UI Web Components for the decidables project",
5
+ "keywords": [
6
+ "web component",
7
+ "explorable explanation",
8
+ "explorable",
9
+ "decision making",
10
+ "decidables"
11
+ ],
5
12
  "type": "module",
6
13
  "main": "./lib/decidablesElements.umd.min.js",
7
14
  "browser": "./lib/decidablesElements.umd.min.js",
@@ -36,17 +43,13 @@
36
43
  "test:file": "web-test-runner $@ --config ../../.webtestrunnerrc.js",
37
44
  "build": "gulp build"
38
45
  },
39
- "browserslist": [
40
- "> 0.25%",
41
- "not dead"
42
- ],
43
46
  "devDependencies": {
44
47
  "@web/test-runner": "^0.13.27",
45
48
  "gulp": "^4.0.2"
46
49
  },
47
50
  "dependencies": {
48
51
  "d3": "^7.3.0",
49
- "lit": "^2.1.2"
52
+ "lit": "^2.2.1"
50
53
  },
51
- "gitHead": "f3e3115ad33a8e1ad5db8ae455b67f571f4561c6"
54
+ "gitHead": "07fdb2ad62b19a19a284992cb74119bd0963b2a3"
52
55
  }
@@ -12,27 +12,8 @@ import * as d3 from 'd3';
12
12
  <decidables-element>
13
13
  */
14
14
  export default class DecidablesElement extends LitElement {
15
- // HACK: Create a unique ID for each DecidablesElement
16
- // This is needed because Edge/IE11 don't have real Shadow DOM, so IDs leak
17
- // out of elements and collide if there is more than one of an element on a
18
- // page. Known issue for checkbox/switches and the id/for pattern on <input>
19
- // and <label>
20
- static get uniqueId() {
21
- DecidablesElement.ID += 1;
22
- return DecidablesElement.ID;
23
- }
24
-
25
- constructor() {
26
- super();
27
- this.uniqueId = `decidables-${DecidablesElement.uniqueId}`;
28
- }
29
-
30
15
  getComputedStyleValue(property) {
31
- // HACK: IE11 requires use of polyfill interface to get custom property value in Javascript
32
- if (window.ShadyCSS) {
33
- return window.ShadyCSS.getComputedStyleValue(this, property);
34
- }
35
- return getComputedStyle(this).getPropertyValue(property);
16
+ return getComputedStyle(this).getPropertyValue(property).trim();
36
17
  }
37
18
 
38
19
  firstUpdated(changedProperties) {
@@ -145,7 +126,6 @@ export default class DecidablesElement extends LitElement {
145
126
 
146
127
  static get svgFilters() {
147
128
  const shadows = DecidablesElement.shadows; // eslint-disable-line prefer-destructuring
148
- const erodeRadius = 1;
149
129
 
150
130
  const filters = shadows.elevations.map((z) => {
151
131
  return svg`
@@ -177,8 +157,7 @@ export default class DecidablesElement extends LitElement {
177
157
  <feComposite in="opU" in2="blurU" result="shU" operator="in" />
178
158
  <feComposite in="opP" in2="blurP" result="shP" operator="in" />
179
159
  <feComposite in="opA" in2="blurA" result="shA" operator="in" />
180
- <!-- HACK Edge: Using a dynamic value for erode radius stops Edge from corrupting the "radius" value! -->
181
- <feMorphology in="solid" result="smaller" operator="erode" radius=${erodeRadius} />
160
+ <feMorphology in="solid" result="smaller" operator="erode" radius="1" />
182
161
  <feComposite in="shU" in2="smaller" result="finalU" operator="out" />
183
162
  <feComposite in="shP" in2="smaller" result="finalP" operator="out" />
184
163
  <feComposite in="shA" in2="smaller" result="finalA" operator="out" />
@@ -259,6 +238,3 @@ export default class DecidablesElement extends LitElement {
259
238
  `;
260
239
  }
261
240
  }
262
-
263
- // Static property of DecidablesElement!
264
- DecidablesElement.ID = 0;
package/src/slider.js CHANGED
@@ -319,11 +319,11 @@ export default class DecidablesSlider extends DecidablesElement {
319
319
 
320
320
  render() {
321
321
  return html`
322
- <label for=${`${this.uniqueId}-slider`}>
322
+ <label for="slider">
323
323
  <slot></slot>
324
324
  </label>
325
325
  <div class="range">
326
- <input type="range" id=${`${this.uniqueId}-slider`} min=${ifDefined(this.min)} max=${ifDefined(this.max)} step=${ifDefined(this.step)} .value=${this.value} @change=${this.changed.bind(this)} @input=${this.inputted.bind(this)}>
326
+ <input type="range" id="slider" min=${ifDefined(this.min)} max=${ifDefined(this.max)} step=${ifDefined(this.step)} .value=${this.value} @change=${this.changed.bind(this)} @input=${this.inputted.bind(this)}>
327
327
  </div>
328
328
  <decidables-spinner min=${ifDefined(this.min)} max=${ifDefined(this.max)} step=${ifDefined(this.step)} .value=${this.value} @input=${this.inputted.bind(this)}></decidables-spinner>
329
329
  `;
package/src/switch.js CHANGED
@@ -165,11 +165,11 @@ export default class DecidablesSwitch extends DecidablesElement {
165
165
 
166
166
  render() {
167
167
  return html`
168
- <input type="checkbox" id=${`${this.uniqueId}-checkbox`} ?checked=${this.checked} ?disabled=${this.disabled} @change=${this.changed.bind(this)}>
169
- <label for=${`${this.uniqueId}-checkbox`}>
168
+ <input type="checkbox" id="switch" ?checked=${this.checked} ?disabled=${this.disabled} @change=${this.changed.bind(this)}>
169
+ <label for="switch">
170
170
  <slot name="off-label"></slot>
171
171
  </label>
172
- <label for=${`${this.uniqueId}-checkbox`}>
172
+ <label for="switch">
173
173
  <slot></slot>
174
174
  </label>
175
175
  `;
@@ -152,8 +152,8 @@ export default class DecidablesToggleOption extends DecidablesElement {
152
152
 
153
153
  render() {
154
154
  return html`
155
- <input type="radio" id=${`${this.uniqueId}-radio`} name=${this.name} value=${this.value} .checked=${this.checked} @change=${this.changed.bind(this)}>
156
- <label for=${`${this.uniqueId}-radio`}>
155
+ <input type="radio" id="toggle-option" name=${this.name} value=${this.value} .checked=${this.checked} @change=${this.changed.bind(this)}>
156
+ <label for="toggle-option">
157
157
  <slot></slot>
158
158
  </label>
159
159
  `;