@decidables/discountable-elements 0.6.3 → 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/CHANGELOG.md +10 -0
- package/lib/discountableElements.esm.js +31 -54
- package/lib/discountableElements.esm.js.map +1 -1
- package/lib/discountableElements.esm.min.js +63 -46
- package/lib/discountableElements.esm.min.js.map +1 -1
- package/lib/discountableElements.umd.js +31 -54
- package/lib/discountableElements.umd.js.map +1 -1
- package/lib/discountableElements.umd.min.js +63 -46
- package/lib/discountableElements.umd.min.js.map +1 -1
- package/package.json +3 -3
- package/src/components/discountable-control.js +1 -1
- package/src/components/discountable-response.js +1 -1
- package/src/components/htd-calculation.js +1 -1
- package/src/components/htd-curves.js +30 -6
- package/src/components/htd-fit.js +1 -1
- package/src/components/htd-parameters.js +1 -1
- package/src/components/itc-choice.js +1 -1
- package/src/components/itc-option.js +1 -1
- package/src/components/itc-task.js +1 -1
- package/src/examples/htd-example.js +1 -1
|
@@ -10356,54 +10356,12 @@
|
|
|
10356
10356
|
const ambientS = rotate ? `${-ambientM.y}px ${ambientM.y / 2}px ${ambientM.b}px ${ambientM.s}px` : `${ambientM.y / 2}px ${ambientM.y}px ${ambientM.b}px ${ambientM.s}px`;
|
|
10357
10357
|
return `${umbraS} ${umbraC}, ${penumbraS} ${penumbraC}, ${ambientS} ${ambientC}`;
|
|
10358
10358
|
}
|
|
10359
|
-
static get svgDefs() {
|
|
10360
|
-
const shadows = DecidablesElement.shadows; /* eslint-disable-line prefer-destructuring */
|
|
10361
|
-
|
|
10362
|
-
const filters = shadows.elevations.map(z => {
|
|
10363
|
-
return `
|
|
10364
|
-
<filter id=${`shadow-${z}`} filterUnits="userSpaceOnUse" x="-100%" y="-100%" width="200%" height="200%">
|
|
10365
|
-
<feComponentTransfer in="SourceAlpha" result="solid">
|
|
10366
|
-
<feFuncA type="table" tableValues="0 1 1"/>
|
|
10367
|
-
</feComponentTransfer>
|
|
10368
|
-
<feOffset in="solid" result="offU" dx=${shadows.mapUmbra[z].y / 2} dy=${shadows.mapUmbra[z].y} />
|
|
10369
|
-
<feOffset in="solid" result="offP" dx=${shadows.mapPenumbra[z].y / 2} dy=${shadows.mapPenumbra[z].y} />
|
|
10370
|
-
<feOffset in="solid" result="offA" dx=${shadows.mapAmbient[z].y / 2} dy=${shadows.mapAmbient[z].y} />
|
|
10371
|
-
${shadows.mapUmbra[z].s === 0 ? '' : `<feMorphology in="offU" result="spreadU" operator=${shadows.mapUmbra[z].s > 0 ? 'dilate' : 'erode'} radius=${Math.abs(shadows.mapUmbra[z].s)} />`}
|
|
10372
|
-
${shadows.mapPenumbra[z].s === 0 ? '' : `<feMorphology in="offP" result="spreadP" operator=${shadows.mapPenumbra[z].s > 0 ? 'dilate' : 'erode'} radius=${Math.abs(shadows.mapPenumbra[z].s)} />`}
|
|
10373
|
-
${shadows.mapAmbient[z].s === 0 ? '' : `<feMorphology in="offA" result="spreadA" operator=${shadows.mapAmbient[z].s > 0 ? 'dilate' : 'erode'} radius=${Math.abs(shadows.mapAmbient[z].s)} />`}
|
|
10374
|
-
<feGaussianBlur in=${shadows.mapUmbra[z].s === 0 ? 'offU' : 'spreadU'} result="blurU" stdDeviation=${shadows.mapUmbra[z].b / 2} />
|
|
10375
|
-
<feGaussianBlur in=${shadows.mapPenumbra[z].s === 0 ? 'offP' : 'spreadP'} result="blurP" stdDeviation=${shadows.mapPenumbra[z].b / 2} />
|
|
10376
|
-
<feGaussianBlur in=${shadows.mapAmbient[z].s === 0 ? 'offA' : 'spreadA'} result="blurA" stdDeviation=${shadows.mapAmbient[z].b / 2} />
|
|
10377
|
-
<feFlood in="SourceGraphic" result="opU" flood-color=${shadows.baselineColor} flood-opacity=${shadows.opacityUmbra + shadows.opacityBoost} />
|
|
10378
|
-
<feFlood in="SourceGraphic" result="opP" flood-color=${shadows.baselineColor} flood-opacity=${shadows.opacityPenumbra + shadows.opacityBoost} />
|
|
10379
|
-
<feFlood in="SourceGraphic" result="opA" flood-color=${shadows.baselineColor} flood-opacity=${shadows.opacityAmbient + shadows.opacityBoost} />
|
|
10380
|
-
<feComposite in="opU" in2="blurU" result="shU" operator="in" />
|
|
10381
|
-
<feComposite in="opP" in2="blurP" result="shP" operator="in" />
|
|
10382
|
-
<feComposite in="opA" in2="blurA" result="shA" operator="in" />
|
|
10383
|
-
<feMorphology in="solid" result="smaller" operator="erode" radius="1" />
|
|
10384
|
-
<feComposite in="shU" in2="smaller" result="finalU" operator="out" />
|
|
10385
|
-
<feComposite in="shP" in2="smaller" result="finalP" operator="out" />
|
|
10386
|
-
<feComposite in="shA" in2="smaller" result="finalA" operator="out" />
|
|
10387
|
-
<feMerge>
|
|
10388
|
-
<feMergeNode in="finalU" />
|
|
10389
|
-
<feMergeNode in="finalP" />
|
|
10390
|
-
<feMergeNode in="finalA" />
|
|
10391
|
-
<feMergeNode in="SourceGraphic" />
|
|
10392
|
-
</feMerge>
|
|
10393
|
-
</filter>`;
|
|
10394
|
-
});
|
|
10395
|
-
return `
|
|
10396
|
-
<defs>
|
|
10397
|
-
${filters}
|
|
10398
|
-
</defs>
|
|
10399
|
-
`;
|
|
10400
|
-
}
|
|
10401
10359
|
static get svgFilters() {
|
|
10402
10360
|
const shadows = DecidablesElement.shadows; /* eslint-disable-line prefer-destructuring */
|
|
10403
10361
|
|
|
10404
10362
|
const filters = shadows.elevations.map(z => {
|
|
10405
10363
|
return b$1`
|
|
10406
|
-
<filter id=${`shadow-${z}`} x="-
|
|
10364
|
+
<filter id=${`shadow-${z}`} filterUnits="userSpaceOnUse" x="-100%" y="-100%" width="200%" height="200%">
|
|
10407
10365
|
<feComponentTransfer in="SourceAlpha" result="solid">
|
|
10408
10366
|
<feFuncA type="table" tableValues="0 1 1"/>
|
|
10409
10367
|
</feComponentTransfer>
|
|
@@ -10435,11 +10393,9 @@
|
|
|
10435
10393
|
</filter>`;
|
|
10436
10394
|
});
|
|
10437
10395
|
return b$1`
|
|
10438
|
-
<
|
|
10439
|
-
|
|
10440
|
-
|
|
10441
|
-
</defs>
|
|
10442
|
-
</svg>
|
|
10396
|
+
<defs class="filtersUser">
|
|
10397
|
+
${filters}
|
|
10398
|
+
</defs>
|
|
10443
10399
|
`;
|
|
10444
10400
|
}
|
|
10445
10401
|
static get styles() {
|
|
@@ -13072,26 +13028,45 @@
|
|
|
13072
13028
|
|
|
13073
13029
|
.option .interactive:hover {
|
|
13074
13030
|
filter: url("#shadow-4");
|
|
13031
|
+
|
|
13032
|
+
/* HACK: This gets Safari to correctly apply the filter! */
|
|
13033
|
+
/* https://github.com/emilbjorklund/svg-weirdness/issues/27 */
|
|
13034
|
+
transform: translateX(0);
|
|
13075
13035
|
}
|
|
13076
13036
|
|
|
13077
13037
|
.option .interactive:active {
|
|
13078
13038
|
filter: url("#shadow-8");
|
|
13039
|
+
|
|
13040
|
+
/* HACK: This gets Safari to correctly apply the filter! */
|
|
13041
|
+
transform: translateY(0);
|
|
13079
13042
|
}
|
|
13080
13043
|
|
|
13081
13044
|
:host(.keyboard) .option .interactive:focus-within {
|
|
13082
13045
|
filter: url("#shadow-8");
|
|
13046
|
+
|
|
13047
|
+
/* HACK: This gets Safari to correctly apply the filter! */
|
|
13048
|
+
transform: translateZ(0);
|
|
13083
13049
|
}
|
|
13084
13050
|
|
|
13085
13051
|
.option .body.interactive:has(~ .point:hover) {
|
|
13086
13052
|
filter: url("#shadow-4");
|
|
13053
|
+
|
|
13054
|
+
/* HACK: This gets Safari to correctly apply the filter! */
|
|
13055
|
+
transform: translateX(0);
|
|
13087
13056
|
}
|
|
13088
13057
|
|
|
13089
13058
|
.option .body.interactive:has(~ .point:active) {
|
|
13090
13059
|
filter: url("#shadow-8");
|
|
13060
|
+
|
|
13061
|
+
/* HACK: This gets Safari to correctly apply the filter! */
|
|
13062
|
+
transform: translateY(0);
|
|
13091
13063
|
}
|
|
13092
13064
|
|
|
13093
13065
|
:host(.keyboard) .option .body.interactive:has(~ .point:focus-within) {
|
|
13094
13066
|
filter: url("#shadow-8");
|
|
13067
|
+
|
|
13068
|
+
/* HACK: This gets Safari to correctly apply the filter! */
|
|
13069
|
+
transform: translateZ(0);
|
|
13095
13070
|
}
|
|
13096
13071
|
|
|
13097
13072
|
.gradient.sooner stop {
|
|
@@ -13257,16 +13232,18 @@
|
|
|
13257
13232
|
rem: this.rem
|
|
13258
13233
|
}]);
|
|
13259
13234
|
// ENTER
|
|
13260
|
-
const svgEnter = svgUpdate.enter().append('svg').classed('main', true)
|
|
13261
|
-
|
|
13235
|
+
const svgEnter = svgUpdate.enter().append('svg').classed('main', true).each((datum, index, nodes) => {
|
|
13236
|
+
// Filters for shadows
|
|
13237
|
+
B$1(DiscountableElement.svgFilters, nodes[index]);
|
|
13238
|
+
});
|
|
13262
13239
|
// Gradients for fill animations
|
|
13263
|
-
const
|
|
13264
|
-
const soonerGradient =
|
|
13240
|
+
const svgGradients = svgEnter.append('defs').classed('gradients', true);
|
|
13241
|
+
const soonerGradient = svgGradients.append('linearGradient').classed('gradient sooner', true).attr('id', 'sooner-gradient');
|
|
13265
13242
|
soonerGradient.append('stop').classed('stop-0', true).attr('offset', '0');
|
|
13266
13243
|
soonerGradient.append('stop').classed('stop-before animation', true).attr('offset', '1');
|
|
13267
13244
|
soonerGradient.append('stop').classed('stop-after animation', true).attr('offset', '1');
|
|
13268
13245
|
soonerGradient.append('stop').classed('stop-100', true).attr('offset', '1');
|
|
13269
|
-
const laterGradient =
|
|
13246
|
+
const laterGradient = svgGradients.append('linearGradient').classed('gradient later', true).attr('id', 'later-gradient');
|
|
13270
13247
|
laterGradient.append('stop').classed('stop-0', true).attr('offset', '0');
|
|
13271
13248
|
laterGradient.append('stop').classed('stop-before animation', true).attr('offset', '1');
|
|
13272
13249
|
laterGradient.append('stop').classed('stop-after animation', true).attr('offset', '1');
|
|
@@ -13814,7 +13791,7 @@
|
|
|
13814
13791
|
element.d = interpolateD(time);
|
|
13815
13792
|
return `${xScale(element.d)}`;
|
|
13816
13793
|
};
|
|
13817
|
-
}).attrTween('y2', (datum, index, elements) => {
|
|
13794
|
+
}).attr('y1', yScale(0)).attrTween('y2', (datum, index, elements) => {
|
|
13818
13795
|
const element = elements[index];
|
|
13819
13796
|
const interpolateA = interpolate$1(element.a !== undefined ? element.a : datum.a, datum.a);
|
|
13820
13797
|
return time => {
|