@pie-element/shared-feedback 0.1.2-next.20261002215153 → 0.1.2

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.
Files changed (2) hide show
  1. package/dist/index.js +20 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -28,16 +28,23 @@ function t(e) {
28
28
  }
29
29
  //#endregion
30
30
  //#region src/index.ts
31
- function n(n, i = {}) {
32
- return new Promise((a) => {
33
- let o = {
34
- ...e,
35
- ...i
36
- }, s = t(n), c = o[s], l = e[s];
37
- r(c, l[c.type]).then(a);
31
+ function n(n, r) {
32
+ let i = {
33
+ ...e,
34
+ ...r
35
+ }, a = t(n), o = e[a] || {}, s = i[a] || o;
36
+ return {
37
+ config: s,
38
+ fallback: o[s.type || "default"]
39
+ };
40
+ }
41
+ function r(e, t = {}) {
42
+ return new Promise((r) => {
43
+ let { config: a, fallback: o } = n(e, t);
44
+ i(a, o).then(r);
38
45
  });
39
46
  }
40
- function r(e, t) {
47
+ function i(e, t) {
41
48
  return new Promise((n) => {
42
49
  if (!e || e.type === "none") {
43
50
  n(void 0);
@@ -46,15 +53,12 @@ function r(e, t) {
46
53
  n(e[e.type] || t);
47
54
  });
48
55
  }
49
- function i(n, r = {}) {
50
- let i = {
51
- ...e,
52
- ...r
53
- }, o = t(n), s = i[o], c = e[o];
54
- return a(s, c[s.type]);
56
+ function a(e, t = {}) {
57
+ let { config: r, fallback: i } = n(e, t);
58
+ return o(r, i);
55
59
  }
56
- function a(e, t) {
60
+ function o(e, t) {
57
61
  if (!(!e || e.type === "none")) return e[e.type] || t;
58
62
  }
59
63
  //#endregion
60
- export { e as defaultFeedback, a as getActualFeedback, i as getActualFeedbackForCorrectness, r as getFeedback, n as getFeedbackForCorrectness, t as normalizeCorrectness };
64
+ export { e as defaultFeedback, o as getActualFeedback, a as getActualFeedbackForCorrectness, i as getFeedback, r as getFeedbackForCorrectness, t as normalizeCorrectness };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/shared-feedback",
3
- "version": "0.1.2-next.20261002215153",
3
+ "version": "0.1.2",
4
4
  "description": "Feedback utilities for PIE elements",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",