@decidables/discountable-elements 0.6.3 → 0.6.5
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 +19 -0
- package/lib/discountableElements.esm.js +48 -71
- package/lib/discountableElements.esm.js.map +1 -1
- package/lib/discountableElements.esm.min.js +64 -47
- package/lib/discountableElements.esm.min.js.map +1 -1
- package/lib/discountableElements.umd.js +48 -71
- package/lib/discountableElements.umd.js.map +1 -1
- package/lib/discountableElements.umd.min.js +64 -47
- package/lib/discountableElements.umd.min.js.map +1 -1
- package/package.json +5 -5
- 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 +31 -7
- 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
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.6.5](https://github.com/decidables/decidables/compare/@decidables/discountable-elements@0.6.4...@decidables/discountable-elements@0.6.5) (2026-01-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **discountable-elements:** fix style in `htd-curves` due to `stylelint` changes ([2593dcb](https://github.com/decidables/decidables/commit/2593dcb432d21027ebc1dd65cc4f169cbae1fbec))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [0.6.4](https://github.com/decidables/decidables/compare/@decidables/discountable-elements@0.6.3...@decidables/discountable-elements@0.6.4) (2026-01-14)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **discountable-elements:** update starting location of bar in `htd-curves` ([983159c](https://github.com/decidables/decidables/commit/983159c3ddb76cfdff856ee7108d1840247001a6)), closes [#10](https://github.com/decidables/decidables/issues/10)
|
|
21
|
+
* **libraries:** add hacks to get Safari to render shadows properly ([120b73c](https://github.com/decidables/decidables/commit/120b73c2e771d59cf43de8dbe8a064a4902b6bd4)), closes [#11](https://github.com/decidables/decidables/issues/11)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [0.6.3](https://github.com/decidables/decidables/compare/@decidables/discountable-elements@0.6.2...@decidables/discountable-elements@0.6.3) (2025-11-30)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @decidables/discountable-elements
|
|
@@ -10350,54 +10350,12 @@ class DecidablesElement extends i$2 {
|
|
|
10350
10350
|
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`;
|
|
10351
10351
|
return `${umbraS} ${umbraC}, ${penumbraS} ${penumbraC}, ${ambientS} ${ambientC}`;
|
|
10352
10352
|
}
|
|
10353
|
-
static get svgDefs() {
|
|
10354
|
-
const shadows = DecidablesElement.shadows; /* eslint-disable-line prefer-destructuring */
|
|
10355
|
-
|
|
10356
|
-
const filters = shadows.elevations.map(z => {
|
|
10357
|
-
return `
|
|
10358
|
-
<filter id=${`shadow-${z}`} filterUnits="userSpaceOnUse" x="-100%" y="-100%" width="200%" height="200%">
|
|
10359
|
-
<feComponentTransfer in="SourceAlpha" result="solid">
|
|
10360
|
-
<feFuncA type="table" tableValues="0 1 1"/>
|
|
10361
|
-
</feComponentTransfer>
|
|
10362
|
-
<feOffset in="solid" result="offU" dx=${shadows.mapUmbra[z].y / 2} dy=${shadows.mapUmbra[z].y} />
|
|
10363
|
-
<feOffset in="solid" result="offP" dx=${shadows.mapPenumbra[z].y / 2} dy=${shadows.mapPenumbra[z].y} />
|
|
10364
|
-
<feOffset in="solid" result="offA" dx=${shadows.mapAmbient[z].y / 2} dy=${shadows.mapAmbient[z].y} />
|
|
10365
|
-
${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)} />`}
|
|
10366
|
-
${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)} />`}
|
|
10367
|
-
${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)} />`}
|
|
10368
|
-
<feGaussianBlur in=${shadows.mapUmbra[z].s === 0 ? 'offU' : 'spreadU'} result="blurU" stdDeviation=${shadows.mapUmbra[z].b / 2} />
|
|
10369
|
-
<feGaussianBlur in=${shadows.mapPenumbra[z].s === 0 ? 'offP' : 'spreadP'} result="blurP" stdDeviation=${shadows.mapPenumbra[z].b / 2} />
|
|
10370
|
-
<feGaussianBlur in=${shadows.mapAmbient[z].s === 0 ? 'offA' : 'spreadA'} result="blurA" stdDeviation=${shadows.mapAmbient[z].b / 2} />
|
|
10371
|
-
<feFlood in="SourceGraphic" result="opU" flood-color=${shadows.baselineColor} flood-opacity=${shadows.opacityUmbra + shadows.opacityBoost} />
|
|
10372
|
-
<feFlood in="SourceGraphic" result="opP" flood-color=${shadows.baselineColor} flood-opacity=${shadows.opacityPenumbra + shadows.opacityBoost} />
|
|
10373
|
-
<feFlood in="SourceGraphic" result="opA" flood-color=${shadows.baselineColor} flood-opacity=${shadows.opacityAmbient + shadows.opacityBoost} />
|
|
10374
|
-
<feComposite in="opU" in2="blurU" result="shU" operator="in" />
|
|
10375
|
-
<feComposite in="opP" in2="blurP" result="shP" operator="in" />
|
|
10376
|
-
<feComposite in="opA" in2="blurA" result="shA" operator="in" />
|
|
10377
|
-
<feMorphology in="solid" result="smaller" operator="erode" radius="1" />
|
|
10378
|
-
<feComposite in="shU" in2="smaller" result="finalU" operator="out" />
|
|
10379
|
-
<feComposite in="shP" in2="smaller" result="finalP" operator="out" />
|
|
10380
|
-
<feComposite in="shA" in2="smaller" result="finalA" operator="out" />
|
|
10381
|
-
<feMerge>
|
|
10382
|
-
<feMergeNode in="finalU" />
|
|
10383
|
-
<feMergeNode in="finalP" />
|
|
10384
|
-
<feMergeNode in="finalA" />
|
|
10385
|
-
<feMergeNode in="SourceGraphic" />
|
|
10386
|
-
</feMerge>
|
|
10387
|
-
</filter>`;
|
|
10388
|
-
});
|
|
10389
|
-
return `
|
|
10390
|
-
<defs>
|
|
10391
|
-
${filters}
|
|
10392
|
-
</defs>
|
|
10393
|
-
`;
|
|
10394
|
-
}
|
|
10395
10353
|
static get svgFilters() {
|
|
10396
10354
|
const shadows = DecidablesElement.shadows; /* eslint-disable-line prefer-destructuring */
|
|
10397
10355
|
|
|
10398
10356
|
const filters = shadows.elevations.map(z => {
|
|
10399
10357
|
return b$1`
|
|
10400
|
-
<filter id=${`shadow-${z}`} x="-
|
|
10358
|
+
<filter id=${`shadow-${z}`} filterUnits="userSpaceOnUse" x="-100%" y="-100%" width="200%" height="200%">
|
|
10401
10359
|
<feComponentTransfer in="SourceAlpha" result="solid">
|
|
10402
10360
|
<feFuncA type="table" tableValues="0 1 1"/>
|
|
10403
10361
|
</feComponentTransfer>
|
|
@@ -10429,11 +10387,9 @@ class DecidablesElement extends i$2 {
|
|
|
10429
10387
|
</filter>`;
|
|
10430
10388
|
});
|
|
10431
10389
|
return b$1`
|
|
10432
|
-
<
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
</defs>
|
|
10436
|
-
</svg>
|
|
10390
|
+
<defs class="filtersUser">
|
|
10391
|
+
${filters}
|
|
10392
|
+
</defs>
|
|
10437
10393
|
`;
|
|
10438
10394
|
}
|
|
10439
10395
|
static get styles() {
|
|
@@ -12208,9 +12164,9 @@ class x extends f {
|
|
|
12208
12164
|
}
|
|
12209
12165
|
update(t, [i]) {
|
|
12210
12166
|
const s = void 0 === this.u;
|
|
12211
|
-
return s && (this.u = t.options?.host, this.u.addController(this), this.u.updateComplete.then(t => this.t = true), this.element = t.element, j.set(this.element, this)), this.optionsOrCallback = i, (s || "function" != typeof i) && this.
|
|
12167
|
+
return s && (this.u = t.options?.host, this.u.addController(this), this.u.updateComplete.then(t => this.t = true), this.element = t.element, j.set(this.element, this)), this.optionsOrCallback = i, (s || "function" != typeof i) && this.m(i), this.render(i);
|
|
12212
12168
|
}
|
|
12213
|
-
|
|
12169
|
+
m(t) {
|
|
12214
12170
|
t = t ?? {};
|
|
12215
12171
|
const i = this.getController();
|
|
12216
12172
|
void 0 !== i && ((t = {
|
|
@@ -12221,7 +12177,7 @@ class x extends f {
|
|
|
12221
12177
|
...t.keyframeOptions
|
|
12222
12178
|
}), t.properties ??= b, this.options = t;
|
|
12223
12179
|
}
|
|
12224
|
-
|
|
12180
|
+
p() {
|
|
12225
12181
|
const t = {},
|
|
12226
12182
|
i = this.element.getBoundingClientRect(),
|
|
12227
12183
|
s = getComputedStyle(this.element);
|
|
@@ -12242,20 +12198,20 @@ class x extends f {
|
|
|
12242
12198
|
})(t, this._)), this.h = this.t && !this.isDisabled() && !this.isAnimating() && i && this.element.isConnected, this.h && (this._ = Array.isArray(t) ? Array.from(t) : t), this.h;
|
|
12243
12199
|
}
|
|
12244
12200
|
hostUpdate() {
|
|
12245
|
-
"function" == typeof this.optionsOrCallback && this.
|
|
12201
|
+
"function" == typeof this.optionsOrCallback && this.m(this.optionsOrCallback()), this.v() && (this.A = this.p(), this.i = this.i ?? this.element.parentNode, this.o = this.element.nextSibling);
|
|
12246
12202
|
}
|
|
12247
12203
|
async hostUpdated() {
|
|
12248
12204
|
if (!this.h || !this.element.isConnected || this.options.skipInitial && !this.isHostRendered) return;
|
|
12249
12205
|
let t;
|
|
12250
12206
|
this.prepare(), await a;
|
|
12251
|
-
const i = this.
|
|
12252
|
-
s = this.
|
|
12253
|
-
e = this.
|
|
12207
|
+
const i = this.P(),
|
|
12208
|
+
s = this.V(this.options.keyframeOptions, i),
|
|
12209
|
+
e = this.p();
|
|
12254
12210
|
if (void 0 !== this.A) {
|
|
12255
12211
|
const {
|
|
12256
12212
|
from: s,
|
|
12257
12213
|
to: h
|
|
12258
|
-
} = this.
|
|
12214
|
+
} = this.O(this.A, e, i);
|
|
12259
12215
|
this.log("measured", [this.A, e, s, h]), t = this.calculateKeyframes(s, h);
|
|
12260
12216
|
} else {
|
|
12261
12217
|
const s = r.get(this.options.inId);
|
|
@@ -12264,7 +12220,7 @@ class x extends f {
|
|
|
12264
12220
|
const {
|
|
12265
12221
|
from: h,
|
|
12266
12222
|
to: n
|
|
12267
|
-
} = this.
|
|
12223
|
+
} = this.O(s, e, i);
|
|
12268
12224
|
t = this.calculateKeyframes(h, n), t = this.options.in ? [{
|
|
12269
12225
|
...this.options.in[0],
|
|
12270
12226
|
...t[0]
|
|
@@ -12274,10 +12230,10 @@ class x extends f {
|
|
|
12274
12230
|
this.animate(t, s);
|
|
12275
12231
|
}
|
|
12276
12232
|
resetStyles() {
|
|
12277
|
-
void 0 !== this.
|
|
12233
|
+
void 0 !== this.j && (this.element.setAttribute("style", this.j ?? ""), this.j = void 0);
|
|
12278
12234
|
}
|
|
12279
12235
|
commitStyles() {
|
|
12280
|
-
this.
|
|
12236
|
+
this.j = this.element.getAttribute("style"), this.webAnimation?.commitStyles(), this.webAnimation?.cancel();
|
|
12281
12237
|
}
|
|
12282
12238
|
reconnected() {}
|
|
12283
12239
|
async disconnected() {
|
|
@@ -12286,14 +12242,14 @@ class x extends f {
|
|
|
12286
12242
|
if (this.prepare(), await a(), this.i?.isConnected) {
|
|
12287
12243
|
const t = this.o && this.o.parentNode === this.i ? this.o : null;
|
|
12288
12244
|
if (this.i.insertBefore(this.element, t), this.options.stabilizeOut) {
|
|
12289
|
-
const t = this.
|
|
12245
|
+
const t = this.p();
|
|
12290
12246
|
this.log("stabilizing out");
|
|
12291
12247
|
const i = this.A.left - t.left,
|
|
12292
12248
|
s = this.A.top - t.top;
|
|
12293
12249
|
!("static" === getComputedStyle(this.element).position) || 0 === i && 0 === s || (this.element.style.position = "relative"), 0 !== i && (this.element.style.left = i + "px"), 0 !== s && (this.element.style.top = s + "px");
|
|
12294
12250
|
}
|
|
12295
12251
|
}
|
|
12296
|
-
const t = this.
|
|
12252
|
+
const t = this.V(this.options.keyframeOptions);
|
|
12297
12253
|
await this.animate(this.options.out, t), this.element.remove();
|
|
12298
12254
|
}
|
|
12299
12255
|
prepare() {
|
|
@@ -12305,7 +12261,7 @@ class x extends f {
|
|
|
12305
12261
|
didFinish(t) {
|
|
12306
12262
|
t && this.options.onComplete?.(this), this.A = void 0, this.animatingProperties = void 0, this.frames = void 0, this.resolveFinished();
|
|
12307
12263
|
}
|
|
12308
|
-
|
|
12264
|
+
P() {
|
|
12309
12265
|
const t = [];
|
|
12310
12266
|
for (let i = this.element.parentNode; i; i = i?.parentNode) {
|
|
12311
12267
|
const s = j.get(i);
|
|
@@ -12319,13 +12275,13 @@ class x extends f {
|
|
|
12319
12275
|
n.add(this.u);
|
|
12320
12276
|
}), t;
|
|
12321
12277
|
}
|
|
12322
|
-
|
|
12278
|
+
V(t, i = this.P()) {
|
|
12323
12279
|
const s = {
|
|
12324
12280
|
...A
|
|
12325
12281
|
};
|
|
12326
12282
|
return i.forEach(t => Object.assign(s, t.options.keyframeOptions)), Object.assign(s, t), s;
|
|
12327
12283
|
}
|
|
12328
|
-
|
|
12284
|
+
O(t, i, s) {
|
|
12329
12285
|
t = {
|
|
12330
12286
|
...t
|
|
12331
12287
|
}, i = {
|
|
@@ -13066,26 +13022,45 @@ class HTDCurves extends DecidablesMixinResizeable(DiscountableElement) {
|
|
|
13066
13022
|
|
|
13067
13023
|
.option .interactive:hover {
|
|
13068
13024
|
filter: url("#shadow-4");
|
|
13025
|
+
|
|
13026
|
+
/* HACK: This gets Safari to correctly apply the filter! */
|
|
13027
|
+
/* https://github.com/emilbjorklund/svg-weirdness/issues/27 */
|
|
13028
|
+
transform: translateX(0);
|
|
13069
13029
|
}
|
|
13070
13030
|
|
|
13071
13031
|
.option .interactive:active {
|
|
13072
13032
|
filter: url("#shadow-8");
|
|
13033
|
+
|
|
13034
|
+
/* HACK: This gets Safari to correctly apply the filter! */
|
|
13035
|
+
transform: translateY(0);
|
|
13073
13036
|
}
|
|
13074
13037
|
|
|
13075
13038
|
:host(.keyboard) .option .interactive:focus-within {
|
|
13076
13039
|
filter: url("#shadow-8");
|
|
13040
|
+
|
|
13041
|
+
/* HACK: This gets Safari to correctly apply the filter! */
|
|
13042
|
+
transform: translateZ(0);
|
|
13077
13043
|
}
|
|
13078
13044
|
|
|
13079
13045
|
.option .body.interactive:has(~ .point:hover) {
|
|
13080
13046
|
filter: url("#shadow-4");
|
|
13047
|
+
|
|
13048
|
+
/* HACK: This gets Safari to correctly apply the filter! */
|
|
13049
|
+
transform: translateX(0);
|
|
13081
13050
|
}
|
|
13082
13051
|
|
|
13083
13052
|
.option .body.interactive:has(~ .point:active) {
|
|
13084
13053
|
filter: url("#shadow-8");
|
|
13054
|
+
|
|
13055
|
+
/* HACK: This gets Safari to correctly apply the filter! */
|
|
13056
|
+
transform: translateY(0);
|
|
13085
13057
|
}
|
|
13086
13058
|
|
|
13087
|
-
:host(.keyboard) .
|
|
13059
|
+
:host(.keyboard) .body.interactive:has(~ .point:focus-within) {
|
|
13088
13060
|
filter: url("#shadow-8");
|
|
13061
|
+
|
|
13062
|
+
/* HACK: This gets Safari to correctly apply the filter! */
|
|
13063
|
+
transform: translateZ(0);
|
|
13089
13064
|
}
|
|
13090
13065
|
|
|
13091
13066
|
.gradient.sooner stop {
|
|
@@ -13251,16 +13226,18 @@ class HTDCurves extends DecidablesMixinResizeable(DiscountableElement) {
|
|
|
13251
13226
|
rem: this.rem
|
|
13252
13227
|
}]);
|
|
13253
13228
|
// ENTER
|
|
13254
|
-
const svgEnter = svgUpdate.enter().append('svg').classed('main', true)
|
|
13255
|
-
|
|
13229
|
+
const svgEnter = svgUpdate.enter().append('svg').classed('main', true).each((datum, index, nodes) => {
|
|
13230
|
+
// Filters for shadows
|
|
13231
|
+
B$1(DiscountableElement.svgFilters, nodes[index]);
|
|
13232
|
+
});
|
|
13256
13233
|
// Gradients for fill animations
|
|
13257
|
-
const
|
|
13258
|
-
const soonerGradient =
|
|
13234
|
+
const svgGradients = svgEnter.append('defs').classed('gradients', true);
|
|
13235
|
+
const soonerGradient = svgGradients.append('linearGradient').classed('gradient sooner', true).attr('id', 'sooner-gradient');
|
|
13259
13236
|
soonerGradient.append('stop').classed('stop-0', true).attr('offset', '0');
|
|
13260
13237
|
soonerGradient.append('stop').classed('stop-before animation', true).attr('offset', '1');
|
|
13261
13238
|
soonerGradient.append('stop').classed('stop-after animation', true).attr('offset', '1');
|
|
13262
13239
|
soonerGradient.append('stop').classed('stop-100', true).attr('offset', '1');
|
|
13263
|
-
const laterGradient =
|
|
13240
|
+
const laterGradient = svgGradients.append('linearGradient').classed('gradient later', true).attr('id', 'later-gradient');
|
|
13264
13241
|
laterGradient.append('stop').classed('stop-0', true).attr('offset', '0');
|
|
13265
13242
|
laterGradient.append('stop').classed('stop-before animation', true).attr('offset', '1');
|
|
13266
13243
|
laterGradient.append('stop').classed('stop-after animation', true).attr('offset', '1');
|
|
@@ -13808,7 +13785,7 @@ class HTDCurves extends DecidablesMixinResizeable(DiscountableElement) {
|
|
|
13808
13785
|
element.d = interpolateD(time);
|
|
13809
13786
|
return `${xScale(element.d)}`;
|
|
13810
13787
|
};
|
|
13811
|
-
}).attrTween('y2', (datum, index, elements) => {
|
|
13788
|
+
}).attr('y1', yScale(0)).attrTween('y2', (datum, index, elements) => {
|
|
13812
13789
|
const element = elements[index];
|
|
13813
13790
|
const interpolateA = interpolate$1(element.a !== undefined ? element.a : datum.a, datum.a);
|
|
13814
13791
|
return time => {
|