@pie-players/pie-tool-calculator-shared 0.3.68 → 0.3.70
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.
|
@@ -21,7 +21,7 @@ function ee(w) {
|
|
|
21
21
|
if (o === null || typeof o != "object") return o;
|
|
22
22
|
if (n.has(o)) return { $type: "circular-reference" };
|
|
23
23
|
n.add(o);
|
|
24
|
-
const c = Array.isArray(o) ? o.map(a) : Object.fromEntries(Object.entries(o).sort(([
|
|
24
|
+
const c = Array.isArray(o) ? o.map(a) : Object.fromEntries(Object.entries(o).sort(([p], [d]) => p.localeCompare(d)).map(([p, d]) => [p, a(d)]));
|
|
25
25
|
return n.delete(o), c;
|
|
26
26
|
};
|
|
27
27
|
return JSON.stringify(a(w));
|
|
@@ -39,12 +39,12 @@ var te = e.from_html('<div class="pie-tool-calculator__loading svelte-i18sle"> <
|
|
|
39
39
|
};
|
|
40
40
|
function ae(w, n) {
|
|
41
41
|
e.push(n, !0), e.append_styles(w, le);
|
|
42
|
-
let a = e.prop(n, "visible", 7, !1), o = e.prop(n, "toolId", 7, "calculator"), c = e.prop(n, "providerId", 7, ""),
|
|
42
|
+
let a = e.prop(n, "visible", 7, !1), o = e.prop(n, "toolId", 7, "calculator"), c = e.prop(n, "providerId", 7, ""), p = e.prop(n, "calculatorType", 7, "basic"), d = e.prop(n, "availableTypes", 23, () => [
|
|
43
43
|
"basic",
|
|
44
44
|
"scientific",
|
|
45
45
|
"graphing"
|
|
46
|
-
]), y = e.prop(n, "calculatorConfig", 23, () => ({})), S = e.prop(n, "toolkitCoordinator", 7, null), x = e.state(null), T = e.state(null), O = e.state(null), u = e.state(null), h = e.state(!1), m = e.state(null),
|
|
47
|
-
const k = e.derived(() => Y(e.get(O))), A = e.derived(() => S() ?? e.get(O)?.toolkitCoordinator), N = e.derived(() => (typeof d() == "string" ? d().split(",").map((t) => t.trim()) : d()).filter((t) => t === "basic" || t === "scientific" || t === "graphing")), z = e.derived(() => e.get(N).includes(
|
|
46
|
+
]), y = e.prop(n, "calculatorConfig", 23, () => ({})), S = e.prop(n, "toolkitCoordinator", 7, null), x = e.state(null), T = e.state(null), O = e.state(null), u = e.state(null), h = e.state(!1), m = e.state(null), b = e.state(!1);
|
|
47
|
+
const k = e.derived(() => Y(e.get(O))), A = e.derived(() => S() ?? e.get(O)?.toolkitCoordinator), N = e.derived(() => (typeof d() == "string" ? d().split(",").map((t) => t.trim()) : d()).filter((t) => t === "basic" || t === "scientific" || t === "graphing")), z = e.derived(() => e.get(N).includes(p()) ? p() : e.get(N)[0] ?? "basic"), F = e.derived(() => ee(y()));
|
|
48
48
|
let E = null, f = null, g = 0, M = !1, I = null;
|
|
49
49
|
const q = /* @__PURE__ */ new Set();
|
|
50
50
|
e.user_effect(() => {
|
|
@@ -67,7 +67,7 @@ function ae(w, n) {
|
|
|
67
67
|
} catch (i) {
|
|
68
68
|
console.warn("[CalculatorTool] calculator cleanup failed:", i);
|
|
69
69
|
}
|
|
70
|
-
r?.remove(), E = null, e.set(h, !1), e.set(
|
|
70
|
+
r?.remove(), E = null, e.set(h, !1), e.set(b, !1);
|
|
71
71
|
}
|
|
72
72
|
function G() {
|
|
73
73
|
requestAnimationFrame(() => {
|
|
@@ -107,15 +107,15 @@ function ae(w, n) {
|
|
|
107
107
|
_.destroy(), i.remove();
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
|
-
e.set(u, _, !0), E = r, e.set(
|
|
111
|
-
t === g && (_.resize?.(), e.set(
|
|
110
|
+
e.set(u, _, !0), E = r, e.set(b, i.childElementCount > 0), H(_, i), requestAnimationFrame(() => {
|
|
111
|
+
t === g && (_.resize?.(), e.set(b, i.childElementCount > 0), G());
|
|
112
112
|
});
|
|
113
113
|
} catch (l) {
|
|
114
114
|
if (t !== g) {
|
|
115
115
|
i.remove();
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
|
-
e.set(m, l instanceof Error ? l.message : String(l), !0), e.set(u, null), f === i && (f = null), i.remove(), e.set(
|
|
118
|
+
e.set(m, l instanceof Error ? l.message : String(l), !0), e.set(u, null), f === i && (f = null), i.remove(), e.set(b, !1);
|
|
119
119
|
} finally {
|
|
120
120
|
t === g && e.set(h, !1);
|
|
121
121
|
}
|
|
@@ -162,10 +162,10 @@ function ae(w, n) {
|
|
|
162
162
|
c(t), e.flush();
|
|
163
163
|
},
|
|
164
164
|
get calculatorType() {
|
|
165
|
-
return
|
|
165
|
+
return p();
|
|
166
166
|
},
|
|
167
167
|
set calculatorType(t = "basic") {
|
|
168
|
-
|
|
168
|
+
p(t), e.flush();
|
|
169
169
|
},
|
|
170
170
|
get availableTypes() {
|
|
171
171
|
return d();
|
|
@@ -193,20 +193,20 @@ function ae(w, n) {
|
|
|
193
193
|
var r = oe(), i = e.child(r);
|
|
194
194
|
e.bind_this(i, (s) => e.set(T, s), () => e.get(T));
|
|
195
195
|
var l = e.sibling(i, 2), j = (s) => {
|
|
196
|
-
var
|
|
197
|
-
e.
|
|
196
|
+
var v = te(), C = e.only_child(v, !0);
|
|
197
|
+
e.template_effect((K) => e.set_text(C, K), [() => e.get(k).t("tools.calculator.loading")]), e.append(s, v);
|
|
198
198
|
};
|
|
199
199
|
e.if(l, (s) => {
|
|
200
|
-
(e.get(h) || !e.get(m) && !e.get(
|
|
200
|
+
(e.get(h) || !e.get(m) && !e.get(b)) && s(j);
|
|
201
201
|
});
|
|
202
202
|
var _ = e.sibling(l, 2), V = (s) => {
|
|
203
|
-
var
|
|
204
|
-
e.reset(
|
|
203
|
+
var v = ie(), C = e.sibling(e.child(v)), K = e.only_child(C, !0);
|
|
204
|
+
e.reset(v), e.template_effect(() => e.set_text(K, e.get(m))), e.append(s, v);
|
|
205
205
|
};
|
|
206
206
|
e.if(_, (s) => {
|
|
207
207
|
e.get(m) && s(V);
|
|
208
|
-
}), e.reset(r), e.template_effect((s,
|
|
209
|
-
e.set_attribute(r, "data-tool-id", o()), e.set_attribute(r, "data-provider-id", c()), e.set_attribute(r, "lang", s), e.set_attribute(r, "dir",
|
|
208
|
+
}), e.reset(r), e.template_effect((s, v, C) => {
|
|
209
|
+
e.set_attribute(r, "data-tool-id", o()), e.set_attribute(r, "data-provider-id", c()), e.set_attribute(r, "lang", s), e.set_attribute(r, "dir", v), e.set_attribute(r, "aria-label", C), e.set_attribute(i, "data-calculator-type", e.get(z)), r.dir = r.dir;
|
|
210
210
|
}, [
|
|
211
211
|
() => e.get(k).getLocale(),
|
|
212
212
|
() => e.get(k).getDirection?.() ?? "ltr",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as g } from "./CalculatorTool-
|
|
1
|
+
import { t as g } from "./CalculatorTool-Dhv9G4lI.js";
|
|
2
2
|
import "svelte/internal/disclose-version";
|
|
3
3
|
import * as t from "svelte/internal/client";
|
|
4
4
|
import { defineCustomElementSafely as v } from "@pie-players/pie-players-shared";
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as D } from "./CalculatorTool-
|
|
1
|
+
import { t as D } from "./CalculatorTool-Dhv9G4lI.js";
|
|
2
2
|
import "svelte/internal/disclose-version";
|
|
3
3
|
import * as e from "svelte/internal/client";
|
|
4
4
|
import { ZIndexLayer as q, connectToolRuntimeContext as K, toOverlayToolId as N } from "@pie-players/pie-assessment-toolkit";
|
|
5
5
|
import { resolveInterfaceI18n as U } from "@pie-players/pie-players-shared/i18n/provider";
|
|
6
|
-
import { untrack as
|
|
6
|
+
import { untrack as H } from "svelte";
|
|
7
7
|
var Y = e.from_html('<div class="pie-tool-calculator-inline svelte-ar9a63"><button type="button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="pie-tool-calculator-inline__icon svelte-ar9a63" aria-hidden="true"><path d="M7,2H17A2,2 0 0,1 19,4V20A2,2 0 0,1 17,22H7A2,2 0 0,1 5,20V4A2,2 0 0,1 7,2M7,4V8H17V4H7M7,10V12H9V10H7M11,10V12H13V10H11M15,10V12H17V10H15M7,14V16H9V14H7M11,14V16H13V14H11M15,14V16H17V14H15M7,18V20H9V18H7M11,18V20H13V18H11M15,18V20H17V18H15Z"></path></svg></button> <div class="pie-sr-only svelte-ar9a63" role="status" aria-live="polite" aria-atomic="true"> </div></div>'), Z = {
|
|
8
8
|
hash: "svelte-ar9a63",
|
|
9
9
|
code: `.pie-tool-calculator-inline.svelte-ar9a63 {display:inline-flex;align-items:center;gap:0.25rem;}.pie-tool-calculator-inline__button.svelte-ar9a63 {position:relative;display:inline-flex;align-items:center;justify-content:center;padding:0.25rem;border:1px solid var(--pie-border, #ccc);border-radius:4px;
|
|
@@ -30,11 +30,11 @@ var Y = e.from_html('<div class="pie-tool-calculator-inline svelte-ar9a63"><butt
|
|
|
30
30
|
function j(T, i) {
|
|
31
31
|
e.push(i, !0), e.append_styles(T, Z);
|
|
32
32
|
let s = e.prop(i, "toolId", 7, "calculator-inline"), g = e.prop(i, "targetToolId", 7, ""), u = e.prop(i, "calculatorType", 7, "basic"), v = e.prop(i, "availableTypes", 7, "basic,scientific,graphing"), d = e.prop(i, "size", 7, "md");
|
|
33
|
-
const x = typeof window < "u",
|
|
33
|
+
const x = typeof window < "u", k = [
|
|
34
34
|
"basic",
|
|
35
35
|
"scientific",
|
|
36
36
|
"graphing"
|
|
37
|
-
],
|
|
37
|
+
], C = {
|
|
38
38
|
basic: {
|
|
39
39
|
name: "tools.calculator.nameBasic",
|
|
40
40
|
opened: "tools.calculator.openedBasic",
|
|
@@ -51,8 +51,8 @@ function j(T, i) {
|
|
|
51
51
|
closed: "tools.calculator.closedGraphing"
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
let c = e.state(null), b = e.state(null), h = e.state(!1),
|
|
55
|
-
const
|
|
54
|
+
let c = e.state(null), b = e.state(null), h = e.state(!1), y = e.state(""), l = null, a = null;
|
|
55
|
+
const w = e.derived(() => U(e.get(b))), n = e.derived(() => e.get(b)?.toolCoordinator), M = e.derived(() => new Set(v().split(",").map((t) => t.trim()).filter(Boolean))), f = e.derived(() => e.get(M).has(u()) ? u() : "basic"), A = e.derived(() => k.includes(e.get(f)) ? e.get(f) : "basic"), m = e.derived(() => C[e.get(A)]), V = e.derived(() => e.get(w).t(e.get(m).name)), _ = e.derived(() => g() || N(s())), z = e.derived(() => d() === "sm" ? "pie-tool-calculator-inline__button--sm" : d() === "lg" ? "pie-tool-calculator-inline__button--lg" : "pie-tool-calculator-inline__button--md");
|
|
56
56
|
e.user_effect(() => {
|
|
57
57
|
if (e.get(c))
|
|
58
58
|
return K(e.get(c), (t) => {
|
|
@@ -61,7 +61,7 @@ function j(T, i) {
|
|
|
61
61
|
}), e.user_effect(() => {
|
|
62
62
|
const t = e.get(n), r = s(), o = e.get(c);
|
|
63
63
|
if (!(!t || !r || !o))
|
|
64
|
-
return
|
|
64
|
+
return H(() => {
|
|
65
65
|
l && a && (l !== t || a !== r) && (l.unregisterTool(a), l = null, a = null), l || (t.registerTool(r, "Calculator Inline", o, q.TOOL), l = t, a = r);
|
|
66
66
|
}), () => {
|
|
67
67
|
l === t && a === r && (l.unregisterTool(a), l = null, a = null);
|
|
@@ -72,14 +72,14 @@ function j(T, i) {
|
|
|
72
72
|
const o = () => {
|
|
73
73
|
e.set(h, t.isToolVisible(r), !0);
|
|
74
74
|
}, p = t.subscribe(o);
|
|
75
|
-
return
|
|
75
|
+
return H(o), p;
|
|
76
76
|
});
|
|
77
|
-
function
|
|
77
|
+
function B() {
|
|
78
78
|
if (!e.get(n)) return;
|
|
79
79
|
const t = e.get(n).isToolVisible(e.get(_));
|
|
80
|
-
e.get(n).toggleTool(e.get(_)), e.set(
|
|
80
|
+
e.get(n).toggleTool(e.get(_)), e.set(y, e.get(w).t(t ? e.get(m).closed : e.get(m).opened), !0);
|
|
81
81
|
}
|
|
82
|
-
var
|
|
82
|
+
var L = {
|
|
83
83
|
get toolId() {
|
|
84
84
|
return s();
|
|
85
85
|
},
|
|
@@ -110,17 +110,17 @@ function j(T, i) {
|
|
|
110
110
|
set size(t = "md") {
|
|
111
111
|
d(t), e.flush();
|
|
112
112
|
}
|
|
113
|
-
}, I = e.comment(),
|
|
113
|
+
}, I = e.comment(), S = e.first_child(I), O = (t) => {
|
|
114
114
|
var r = Y(), o = e.child(r);
|
|
115
115
|
let p;
|
|
116
|
-
var
|
|
117
|
-
e.reset(
|
|
118
|
-
p = e.set_class(o, 1, `pie-tool-calculator-inline__button ${e.get(
|
|
119
|
-
}), e.delegated("click", o,
|
|
116
|
+
var R = e.sibling(o, 2), E = e.only_child(R, !0);
|
|
117
|
+
e.reset(r), e.bind_this(r, (G) => e.set(c, G), () => e.get(c)), e.template_effect(() => {
|
|
118
|
+
p = e.set_class(o, 1, `pie-tool-calculator-inline__button ${e.get(z) ?? ""}`, "svelte-ar9a63", p, { "pie-tool-calculator-inline__button--active": e.get(h) }), e.set_attribute(o, "aria-label", e.get(V)), e.set_attribute(o, "aria-pressed", e.get(h)), e.set_attribute(o, "title", e.get(V)), e.set_attribute(o, "data-calculator-type", e.get(f)), o.disabled = !e.get(n), e.set_text(E, e.get(y));
|
|
119
|
+
}), e.delegated("click", o, B), e.append(t, r);
|
|
120
120
|
};
|
|
121
|
-
return e.if(
|
|
122
|
-
x && t(
|
|
123
|
-
}), e.append(T, I), e.pop(
|
|
121
|
+
return e.if(S, (t) => {
|
|
122
|
+
x && t(O);
|
|
123
|
+
}), e.append(T, I), e.pop(L);
|
|
124
124
|
}
|
|
125
125
|
e.delegate(["click"]);
|
|
126
126
|
e.create_custom_element(j, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-players/pie-tool-calculator-shared",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.70",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Provider-neutral calculator tool surfaces shared by PIE vendor adapters",
|
|
6
6
|
"repository": {
|
|
@@ -46,17 +46,17 @@
|
|
|
46
46
|
"unpkg": "./dist/index.js",
|
|
47
47
|
"jsdelivr": "./dist/index.js",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@pie-players/pie-assessment-toolkit": "0.3.
|
|
50
|
-
"@pie-players/pie-players-shared": "0.3.
|
|
51
|
-
"svelte": "^5.
|
|
49
|
+
"@pie-players/pie-assessment-toolkit": "0.3.70",
|
|
50
|
+
"@pie-players/pie-players-shared": "0.3.70",
|
|
51
|
+
"svelte": "^5.57.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@biomejs/biome": "^2.5.
|
|
54
|
+
"@biomejs/biome": "^2.5.11",
|
|
55
55
|
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|
|
56
|
-
"svelte": "^5.
|
|
57
|
-
"svelte-check": "^4.7.
|
|
56
|
+
"svelte": "^5.57.0",
|
|
57
|
+
"svelte-check": "^4.7.6",
|
|
58
58
|
"typescript": "^5.9.3",
|
|
59
|
-
"vite": "^8.2.
|
|
59
|
+
"vite": "^8.2.2",
|
|
60
60
|
"vite-plugin-dts": "^5.0.3"
|
|
61
61
|
},
|
|
62
62
|
"homepage": "https://github.com/pie-framework/pie-players/tree/master/packages/tool-calculator-shared#readme",
|