@decidables/discountable-elements 0.6.2 → 0.6.4

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@decidables/discountable-elements",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "discountable-elements: Web Components for visualizing Hyperbolic Temporal Discounting",
5
5
  "keywords": [
6
6
  "web component",
@@ -23,7 +23,8 @@
23
23
  "./components": "./src/components/index.js",
24
24
  "./equations": "./src/equations/index.js",
25
25
  "./examples": "./src/examples/index.js",
26
- "./*": "./src/*.js"
26
+ "./*": "./src/*.js",
27
+ "./colors.yml": "./src/colors.yml"
27
28
  },
28
29
  "repository": {
29
30
  "type": "git",
@@ -52,14 +53,13 @@
52
53
  "gulp": "^5.0.1"
53
54
  },
54
55
  "dependencies": {
55
- "@decidables/decidables-elements": "^0.5.4",
56
- "@decidables/discountable-math": "^0.2.4",
56
+ "@decidables/decidables-elements": "^0.5.6",
57
+ "@decidables/discountable-math": "^0.2.5",
57
58
  "@lit-labs/motion": "^1.0.9",
58
59
  "@observablehq/plot": "^0.6.17",
59
60
  "bayes.js": "https://github.com/akrawitz/bayes.js.git#commit=c7b091b75f85a86b6a3965a983b31e23d9ef456f",
60
61
  "d3": "^7.9.0",
61
- "lit": "^3.3.1",
62
- "regenerator-runtime": "^0.14.1"
62
+ "lit": "^3.3.1"
63
63
  },
64
- "gitHead": "40a8d99faef87f4616aa28ae5299893a59873f1d"
64
+ "gitHead": "8c39b095d6cc3cf6a5f49457048bebf53e7158c1"
65
65
  }
@@ -1,5 +1,5 @@
1
1
 
2
- import {html, css} from 'lit';
2
+ import {css, html} from 'lit';
3
3
 
4
4
  import '@decidables/decidables-elements/button';
5
5
  import '@decidables/decidables-elements/slider';
@@ -1,5 +1,5 @@
1
1
 
2
- import {html, css} from 'lit';
2
+ import {css, html} from 'lit';
3
3
 
4
4
  import '@decidables/decidables-elements/button';
5
5
 
@@ -1,5 +1,5 @@
1
1
 
2
- import {html, css} from 'lit';
2
+ import {css, html} from 'lit';
3
3
  import {animate, fadeIn} from '@lit-labs/motion';
4
4
 
5
5
  import '@decidables/decidables-elements/spinner';
@@ -1,5 +1,5 @@
1
1
 
2
- import {html, css} from 'lit';
2
+ import {css, html, render} from 'lit';
3
3
  import * as d3 from 'd3';
4
4
 
5
5
  import HTDMath from '@decidables/discountable-math';
@@ -256,26 +256,45 @@ export default class HTDCurves extends DecidablesMixinResizeable(DiscountableEle
256
256
 
257
257
  .option .interactive:hover {
258
258
  filter: url("#shadow-4");
259
+
260
+ /* HACK: This gets Safari to correctly apply the filter! */
261
+ /* https://github.com/emilbjorklund/svg-weirdness/issues/27 */
262
+ transform: translateX(0);
259
263
  }
260
264
 
261
265
  .option .interactive:active {
262
266
  filter: url("#shadow-8");
267
+
268
+ /* HACK: This gets Safari to correctly apply the filter! */
269
+ transform: translateY(0);
263
270
  }
264
271
 
265
272
  :host(.keyboard) .option .interactive:focus-within {
266
273
  filter: url("#shadow-8");
274
+
275
+ /* HACK: This gets Safari to correctly apply the filter! */
276
+ transform: translateZ(0);
267
277
  }
268
278
 
269
279
  .option .body.interactive:has(~ .point:hover) {
270
280
  filter: url("#shadow-4");
281
+
282
+ /* HACK: This gets Safari to correctly apply the filter! */
283
+ transform: translateX(0);
271
284
  }
272
285
 
273
286
  .option .body.interactive:has(~ .point:active) {
274
287
  filter: url("#shadow-8");
288
+
289
+ /* HACK: This gets Safari to correctly apply the filter! */
290
+ transform: translateY(0);
275
291
  }
276
292
 
277
293
  :host(.keyboard) .option .body.interactive:has(~ .point:focus-within) {
278
294
  filter: url("#shadow-8");
295
+
296
+ /* HACK: This gets Safari to correctly apply the filter! */
297
+ transform: translateZ(0);
279
298
  }
280
299
 
281
300
  .gradient.sooner stop {
@@ -453,11 +472,15 @@ export default class HTDCurves extends DecidablesMixinResizeable(DiscountableEle
453
472
  }]);
454
473
  // ENTER
455
474
  const svgEnter = svgUpdate.enter().append('svg')
456
- .classed('main', true);
457
- svgEnter.html(DiscountableElement.svgDefs);
475
+ .classed('main', true)
476
+ .each((datum, index, nodes) => {
477
+ // Filters for shadows
478
+ render(DiscountableElement.svgFilters, nodes[index]);
479
+ });
458
480
  // Gradients for fill animations
459
- const svgDefs = svgEnter.append('defs');
460
- const soonerGradient = svgDefs.append('linearGradient')
481
+ const svgGradients = svgEnter.append('defs')
482
+ .classed('gradients', true);
483
+ const soonerGradient = svgGradients.append('linearGradient')
461
484
  .classed('gradient sooner', true)
462
485
  .attr('id', 'sooner-gradient');
463
486
  soonerGradient.append('stop')
@@ -472,7 +495,7 @@ export default class HTDCurves extends DecidablesMixinResizeable(DiscountableEle
472
495
  soonerGradient.append('stop')
473
496
  .classed('stop-100', true)
474
497
  .attr('offset', '1');
475
- const laterGradient = svgDefs.append('linearGradient')
498
+ const laterGradient = svgGradients.append('linearGradient')
476
499
  .classed('gradient later', true)
477
500
  .attr('id', 'later-gradient');
478
501
  laterGradient.append('stop')
@@ -1239,6 +1262,7 @@ export default class HTDCurves extends DecidablesMixinResizeable(DiscountableEle
1239
1262
  return `${xScale(element.d)}`;
1240
1263
  };
1241
1264
  })
1265
+ .attr('y1', yScale(0))
1242
1266
  .attrTween('y2', (datum, index, elements) => {
1243
1267
  const element = elements[index];
1244
1268
  const interpolateA = d3.interpolate(
@@ -1,8 +1,5 @@
1
1
  /* eslint no-restricted-globals: ["off", "self"] */
2
2
 
3
- // Needed for d3 in WebWorker!
4
- import 'regenerator-runtime/runtime';
5
-
6
3
  import * as BayesDistributions from 'bayes.js/distributions';
7
4
  import * as BayesMcmc from 'bayes.js/mcmc';
8
5
  import * as d3 from 'd3';
@@ -1,5 +1,5 @@
1
1
 
2
- import {html, css} from 'lit';
2
+ import {css, html} from 'lit';
3
3
  import * as Plot from '@observablehq/plot';
4
4
 
5
5
  import HTDMath from '@decidables/discountable-math';
@@ -1,5 +1,5 @@
1
1
 
2
- import {html, css} from 'lit';
2
+ import {css, html} from 'lit';
3
3
 
4
4
  import '@decidables/decidables-elements/slider';
5
5
  import HTDMath from '@decidables/discountable-math';
@@ -1,5 +1,5 @@
1
1
 
2
- import {html, css} from 'lit';
2
+ import {css, html} from 'lit';
3
3
 
4
4
  import DiscountableElement from '../discountable-element';
5
5
  import './itc-option';
@@ -1,5 +1,5 @@
1
1
 
2
- import {html, css} from 'lit';
2
+ import {css, html} from 'lit';
3
3
 
4
4
  import DiscountableElement from '../discountable-element';
5
5
 
@@ -1,5 +1,5 @@
1
1
 
2
- import {html, css} from 'lit';
2
+ import {css, html} from 'lit';
3
3
  import * as d3 from 'd3';
4
4
 
5
5
  import DiscountableElement from '../discountable-element';
@@ -1,5 +1,5 @@
1
1
 
2
- import {html, css} from 'lit';
2
+ import {css, html} from 'lit';
3
3
 
4
4
  import DiscountableElement from '../discountable-element';
5
5