@pie-players/pie-tool-calculator-shared 0.3.72 → 0.3.74
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/README.md +9 -5
- package/dist/calculator-element.js +2510 -45
- package/package.json +15 -16
- package/dist/CalculatorElement.svelte.d.ts +0 -1
- package/dist/CalculatorInlineTool.svelte.d.ts +0 -1
- package/dist/CalculatorTool-Dhv9G4lI.js +0 -231
- package/dist/CalculatorTool.svelte.d.ts +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -136
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.74",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Provider-neutral calculator tool surfaces shared by PIE vendor adapters",
|
|
6
6
|
"repository": {
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"shared",
|
|
20
20
|
"wcag"
|
|
21
21
|
],
|
|
22
|
-
"main": "./dist/
|
|
23
|
-
"types": "./dist/
|
|
22
|
+
"main": "./dist/calculator-element.js",
|
|
23
|
+
"types": "./dist/calculator-element.d.ts",
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
|
-
"types": "./dist/
|
|
27
|
-
"import": "./dist/
|
|
26
|
+
"types": "./dist/calculator-element.d.ts",
|
|
27
|
+
"import": "./dist/calculator-element.js"
|
|
28
28
|
},
|
|
29
29
|
"./calculator-element": {
|
|
30
30
|
"types": "./dist/calculator-element.d.ts",
|
|
@@ -40,24 +40,23 @@
|
|
|
40
40
|
"test": "bun test tests",
|
|
41
41
|
"typecheck": "tsc --noEmit",
|
|
42
42
|
"check": "svelte-check --tsconfig ./tsconfig.json --compiler-warnings options_missing_custom_element:ignore",
|
|
43
|
-
"lint": "biome
|
|
43
|
+
"lint": "biome lint ."
|
|
44
44
|
},
|
|
45
45
|
"license": "MIT",
|
|
46
|
-
"unpkg": "./dist/
|
|
47
|
-
"jsdelivr": "./dist/
|
|
46
|
+
"unpkg": "./dist/calculator-element.js",
|
|
47
|
+
"jsdelivr": "./dist/calculator-element.js",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@pie-players/pie-assessment-toolkit": "0.3.
|
|
50
|
-
"@pie-players/pie-players-shared": "0.3.
|
|
51
|
-
"svelte": "^5.57.0"
|
|
49
|
+
"@pie-players/pie-assessment-toolkit": "0.3.74",
|
|
50
|
+
"@pie-players/pie-players-shared": "0.3.74"
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
|
-
"@biomejs/biome": "^2.5.
|
|
55
|
-
"@sveltejs/vite-plugin-svelte": "^7.3.
|
|
56
|
-
"svelte": "^5.57.
|
|
53
|
+
"@biomejs/biome": "^2.5.15",
|
|
54
|
+
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
55
|
+
"svelte": "^5.57.1",
|
|
57
56
|
"svelte-check": "^4.7.6",
|
|
58
57
|
"typescript": "^5.9.3",
|
|
59
|
-
"vite": "^8.
|
|
60
|
-
"vite-plugin-dts": "^5.
|
|
58
|
+
"vite": "^8.3.2",
|
|
59
|
+
"vite-plugin-dts": "^5.1.1"
|
|
61
60
|
},
|
|
62
61
|
"homepage": "https://github.com/pie-framework/pie-players/tree/master/packages/tool-calculator-shared#readme",
|
|
63
62
|
"bugs": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SvelteComponent as default } from 'svelte';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SvelteComponent as default } from 'svelte';
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import "svelte/internal/disclose-version";
|
|
2
|
-
import * as e from "svelte/internal/client";
|
|
3
|
-
import { connectToolRuntimeContext as X } from "@pie-players/pie-assessment-toolkit";
|
|
4
|
-
import { resolveInterfaceI18n as Y } from "@pie-players/pie-players-shared/i18n/provider";
|
|
5
|
-
import { onMount as Z, untrack as $ } from "svelte";
|
|
6
|
-
function ee(w) {
|
|
7
|
-
const n = /* @__PURE__ */ new Set(), a = (o) => {
|
|
8
|
-
if (o === void 0) return { $type: "undefined" };
|
|
9
|
-
if (typeof o == "bigint") return {
|
|
10
|
-
$type: "bigint",
|
|
11
|
-
value: o.toString()
|
|
12
|
-
};
|
|
13
|
-
if (typeof o == "function") return {
|
|
14
|
-
$type: "function",
|
|
15
|
-
value: o.toString()
|
|
16
|
-
};
|
|
17
|
-
if (typeof o == "symbol") return {
|
|
18
|
-
$type: "symbol",
|
|
19
|
-
value: o.description ?? ""
|
|
20
|
-
};
|
|
21
|
-
if (o === null || typeof o != "object") return o;
|
|
22
|
-
if (n.has(o)) return { $type: "circular-reference" };
|
|
23
|
-
n.add(o);
|
|
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
|
-
return n.delete(o), c;
|
|
26
|
-
};
|
|
27
|
-
return JSON.stringify(a(w));
|
|
28
|
-
}
|
|
29
|
-
var te = e.from_html('<div class="pie-tool-calculator__loading svelte-i18sle"> </div>'), ie = e.from_html('<div class="pie-tool-calculator__loading pie-tool-calculator__loading--error svelte-i18sle">Calculator failed to initialize. <div class="pie-tool-calculator__error-details svelte-i18sle"> </div></div>'), oe = e.from_html('<div class="pie-tool-calculator notranslate svelte-i18sle" role="region" tabindex="-1" translate="no"><div class="pie-tool-calculator__container svelte-i18sle"></div> <!> <!></div>'), re = e.from_html('<div class="pie-tool-calculator__context-host svelte-i18sle"><!></div>'), le = {
|
|
30
|
-
hash: "svelte-i18sle",
|
|
31
|
-
code: `.pie-tool-calculator__context-host.svelte-i18sle {display:flex;width:100%;height:100%;min-height:0;}.pie-tool-calculator.svelte-i18sle {position:relative;display:flex;flex:1 1 auto;min-width:100%;min-height:0;background:var(--pie-white, white);overflow:hidden;}.pie-tool-calculator__container.svelte-i18sle {position:relative;width:100%;height:100%;min-width:100%;min-height:100%;
|
|
32
|
-
/*
|
|
33
|
-
* \`--pie-white\`, not the literal. The token inverts by design (#ffffff light,
|
|
34
|
-
* #000000 dark, redefined per colour scheme), so a hardcoded white showed
|
|
35
|
-
* through as a white plate behind a dark calculator the moment a provider's own
|
|
36
|
-
* surface stopped being opaque — and under a PNP colour scheme it was simply
|
|
37
|
-
* the wrong colour.
|
|
38
|
-
*/background:var(--pie-white, white);overflow:hidden;}.pie-tool-calculator__mount {width:100%;height:100%;min-width:100%;min-height:100%;}.pie-tool-calculator__loading.svelte-i18sle {position:absolute;inset:0;z-index:2;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb, var(--pie-white, #fff) 90%, transparent);color:var(--pie-text, #334155);font-size:0.9rem;}.pie-tool-calculator__loading--error.svelte-i18sle {flex-direction:column;gap:0.5rem;padding:0.75rem;color:var(--pie-incorrect, #b91c1c);text-align:center;}.pie-tool-calculator__error-details.svelte-i18sle {max-width:95%;color:var(--pie-incorrect, #7f1d1d);font-size:0.8rem;line-height:1.2;word-break:break-word;}.pie-tool-calculator__mount > * {width:100% !important;height:100% !important;}`
|
|
39
|
-
};
|
|
40
|
-
function ae(w, n) {
|
|
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, ""), p = e.prop(n, "calculatorType", 7, "basic"), d = e.prop(n, "availableTypes", 23, () => [
|
|
43
|
-
"basic",
|
|
44
|
-
"scientific",
|
|
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), 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
|
-
let E = null, f = null, g = 0, M = !1, I = null;
|
|
49
|
-
const q = /* @__PURE__ */ new Set();
|
|
50
|
-
e.user_effect(() => {
|
|
51
|
-
if (e.get(x))
|
|
52
|
-
return X(e.get(x), (t) => {
|
|
53
|
-
e.set(O, t, !0);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
function D() {
|
|
57
|
-
I?.disconnect(), I = null;
|
|
58
|
-
for (const t of q) clearTimeout(t);
|
|
59
|
-
q.clear();
|
|
60
|
-
}
|
|
61
|
-
function P() {
|
|
62
|
-
g += 1, D();
|
|
63
|
-
const t = e.get(u), r = f;
|
|
64
|
-
e.set(u, null), f = null;
|
|
65
|
-
try {
|
|
66
|
-
t?.destroy();
|
|
67
|
-
} catch (i) {
|
|
68
|
-
console.warn("[CalculatorTool] calculator cleanup failed:", i);
|
|
69
|
-
}
|
|
70
|
-
r?.remove(), E = null, e.set(h, !1), e.set(b, !1);
|
|
71
|
-
}
|
|
72
|
-
function G() {
|
|
73
|
-
requestAnimationFrame(() => {
|
|
74
|
-
if (!a() || !e.get(u) || !f?.isConnected) return;
|
|
75
|
-
const t = document.activeElement;
|
|
76
|
-
t instanceof Node && f.contains(t) || e.get(u).focus?.();
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
function H(t, r) {
|
|
80
|
-
D(), typeof ResizeObserver < "u" && (I = new ResizeObserver(() => {
|
|
81
|
-
a() && r.isConnected && t.resize?.();
|
|
82
|
-
}), I.observe(r));
|
|
83
|
-
for (const i of [
|
|
84
|
-
60,
|
|
85
|
-
250,
|
|
86
|
-
1e3
|
|
87
|
-
]) {
|
|
88
|
-
const l = setTimeout(() => {
|
|
89
|
-
q.delete(l), a() && r.isConnected && t.resize?.();
|
|
90
|
-
}, i);
|
|
91
|
-
q.add(l);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
async function J(t, r, i) {
|
|
95
|
-
e.set(h, !0), e.set(m, null);
|
|
96
|
-
try {
|
|
97
|
-
if (!c()) throw new Error("Calculator provider id is required");
|
|
98
|
-
const l = e.get(A)?.toolProviderRegistry;
|
|
99
|
-
if (!l) throw new Error("Calculator provider registry is unavailable");
|
|
100
|
-
const j = await (await l.getProvider(c())).createInstance();
|
|
101
|
-
if (t !== g || !a() || !i.isConnected) {
|
|
102
|
-
i.remove();
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
const _ = await j.createCalculator(e.get(z), i, y());
|
|
106
|
-
if (t !== g || !a() || !i.isConnected) {
|
|
107
|
-
_.destroy(), i.remove();
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
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
|
-
});
|
|
113
|
-
} catch (l) {
|
|
114
|
-
if (t !== g) {
|
|
115
|
-
i.remove();
|
|
116
|
-
return;
|
|
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(b, !1);
|
|
119
|
-
} finally {
|
|
120
|
-
t === g && e.set(h, !1);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
function L() {
|
|
124
|
-
M = !1;
|
|
125
|
-
const t = e.get(T), r = e.get(A);
|
|
126
|
-
if (!a() || !t || !t.isConnected || !r) {
|
|
127
|
-
(e.get(u) || e.get(h) || f) && P(), e.set(m, null);
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
const i = `${c()}:${e.get(z)}:${e.get(F)}`;
|
|
131
|
-
if (e.get(u) && E === i) {
|
|
132
|
-
G();
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
(e.get(u) || e.get(h) || f) && P();
|
|
136
|
-
const l = document.createElement("div");
|
|
137
|
-
l.className = "pie-tool-calculator__mount", t.replaceChildren(l), f = l, J(++g, i, l);
|
|
138
|
-
}
|
|
139
|
-
function Q() {
|
|
140
|
-
M || (M = !0, queueMicrotask(L));
|
|
141
|
-
}
|
|
142
|
-
e.user_effect(() => {
|
|
143
|
-
a(), c(), e.get(z), y(), e.get(F), e.get(T), e.get(A), $(Q);
|
|
144
|
-
}), Z(() => () => P());
|
|
145
|
-
var W = {
|
|
146
|
-
get visible() {
|
|
147
|
-
return a();
|
|
148
|
-
},
|
|
149
|
-
set visible(t = !1) {
|
|
150
|
-
a(t), e.flush();
|
|
151
|
-
},
|
|
152
|
-
get toolId() {
|
|
153
|
-
return o();
|
|
154
|
-
},
|
|
155
|
-
set toolId(t = "calculator") {
|
|
156
|
-
o(t), e.flush();
|
|
157
|
-
},
|
|
158
|
-
get providerId() {
|
|
159
|
-
return c();
|
|
160
|
-
},
|
|
161
|
-
set providerId(t = "") {
|
|
162
|
-
c(t), e.flush();
|
|
163
|
-
},
|
|
164
|
-
get calculatorType() {
|
|
165
|
-
return p();
|
|
166
|
-
},
|
|
167
|
-
set calculatorType(t = "basic") {
|
|
168
|
-
p(t), e.flush();
|
|
169
|
-
},
|
|
170
|
-
get availableTypes() {
|
|
171
|
-
return d();
|
|
172
|
-
},
|
|
173
|
-
set availableTypes(t = [
|
|
174
|
-
"basic",
|
|
175
|
-
"scientific",
|
|
176
|
-
"graphing"
|
|
177
|
-
]) {
|
|
178
|
-
d(t), e.flush();
|
|
179
|
-
},
|
|
180
|
-
get calculatorConfig() {
|
|
181
|
-
return y();
|
|
182
|
-
},
|
|
183
|
-
set calculatorConfig(t = {}) {
|
|
184
|
-
y(t), e.flush();
|
|
185
|
-
},
|
|
186
|
-
get toolkitCoordinator() {
|
|
187
|
-
return S();
|
|
188
|
-
},
|
|
189
|
-
set toolkitCoordinator(t = null) {
|
|
190
|
-
S(t), e.flush();
|
|
191
|
-
}
|
|
192
|
-
}, R = re(), B = e.child(R), U = (t) => {
|
|
193
|
-
var r = oe(), i = e.child(r);
|
|
194
|
-
e.bind_this(i, (s) => e.set(T, s), () => e.get(T));
|
|
195
|
-
var l = e.sibling(i, 2), j = (s) => {
|
|
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
|
-
};
|
|
199
|
-
e.if(l, (s) => {
|
|
200
|
-
(e.get(h) || !e.get(m) && !e.get(b)) && s(j);
|
|
201
|
-
});
|
|
202
|
-
var _ = e.sibling(l, 2), V = (s) => {
|
|
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
|
-
};
|
|
206
|
-
e.if(_, (s) => {
|
|
207
|
-
e.get(m) && s(V);
|
|
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
|
-
}, [
|
|
211
|
-
() => e.get(k).getLocale(),
|
|
212
|
-
() => e.get(k).getDirection?.() ?? "ltr",
|
|
213
|
-
() => e.get(k).t("tools.calculator.toolA11y")
|
|
214
|
-
]), e.append(t, r);
|
|
215
|
-
};
|
|
216
|
-
return e.if(B, (t) => {
|
|
217
|
-
a() && t(U);
|
|
218
|
-
}), e.reset(R), e.bind_this(R, (t) => e.set(x, t), () => e.get(x)), e.append(w, R), e.pop(W);
|
|
219
|
-
}
|
|
220
|
-
e.create_custom_element(ae, {
|
|
221
|
-
visible: {},
|
|
222
|
-
toolId: {},
|
|
223
|
-
providerId: {},
|
|
224
|
-
calculatorType: {},
|
|
225
|
-
availableTypes: {},
|
|
226
|
-
calculatorConfig: {},
|
|
227
|
-
toolkitCoordinator: {}
|
|
228
|
-
}, [], [], { mode: "open" });
|
|
229
|
-
export {
|
|
230
|
-
ae as t
|
|
231
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SvelteComponent as default } from 'svelte';
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { t as D } from "./CalculatorTool-Dhv9G4lI.js";
|
|
2
|
-
import "svelte/internal/disclose-version";
|
|
3
|
-
import * as e from "svelte/internal/client";
|
|
4
|
-
import { ZIndexLayer as q, connectToolRuntimeContext as K, toOverlayToolId as N } from "@pie-players/pie-assessment-toolkit";
|
|
5
|
-
import { resolveInterfaceI18n as U } from "@pie-players/pie-players-shared/i18n/provider";
|
|
6
|
-
import { untrack as H } from "svelte";
|
|
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
|
-
hash: "svelte-ar9a63",
|
|
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;
|
|
10
|
-
/* Button fills resolve through the button tokens, which every base theme
|
|
11
|
-
and colour scheme sets opaque. The base light theme ships
|
|
12
|
-
--pie-background transparent so PIE content reveals the host page. */background-color:var(--pie-button-background-color, var(--pie-button-bg, var(--pie-white, #fff)));color:var(--pie-text, #333);cursor:pointer;transition:background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;}.pie-tool-calculator-inline__button.svelte-ar9a63:hover:not(:disabled) {background-color:var(--pie-button-hover-background-color, var(--pie-button-hover-bg, var(--pie-secondary-background, #f5f5f5)));transform:translateY(-1px);box-shadow:0 2px 4px rgb(0 0 0 / 10%);}.pie-tool-calculator-inline__button.svelte-ar9a63:focus-visible {z-index:1;outline:2px solid var(--pie-button-focus-outline, #0066cc);outline-offset:2px;box-shadow:0 0 0 4px color-mix(in srgb, var(--pie-button-focus-outline, #0066cc) 20%, transparent);}.pie-tool-calculator-inline__button--active.svelte-ar9a63 {border-color:var(--pie-tool-trigger-active-border-color, var(--pie-primary, #1976d2));background-color:var(--pie-tool-trigger-active-background, var(--pie-primary, #1976d2));color:var(
|
|
13
|
-
--pie-tool-trigger-active-color,
|
|
14
|
-
color-mix(in srgb, var(--pie-background, #fff) var(--pie-fixed-hue-collapse, 0%), white)
|
|
15
|
-
);}.pie-tool-calculator-inline__button--active.svelte-ar9a63:hover:not(:disabled) {border-color:var(--pie-tool-trigger-active-border-color, var(--pie-primary, #1976d2));background-color:var(
|
|
16
|
-
--pie-tool-trigger-active-background,
|
|
17
|
-
color-mix(
|
|
18
|
-
in srgb,
|
|
19
|
-
var(--pie-primary, #1565c0) var(--pie-fixed-hue-collapse, 0%),
|
|
20
|
-
var(--pie-primary-dark, #1565c0)
|
|
21
|
-
)
|
|
22
|
-
);color:var(
|
|
23
|
-
--pie-tool-trigger-active-color,
|
|
24
|
-
color-mix(in srgb, var(--pie-background, #fff) var(--pie-fixed-hue-collapse, 0%), white)
|
|
25
|
-
);}.pie-tool-calculator-inline__button.svelte-ar9a63:disabled {cursor:not-allowed;opacity:0.6;}.pie-tool-calculator-inline__button--sm.svelte-ar9a63 {width:1.5rem;height:1.5rem;padding:0.625rem;}.pie-tool-calculator-inline__button--md.svelte-ar9a63 {width:2rem;height:2rem;}.pie-tool-calculator-inline__button--lg.svelte-ar9a63 {width:2.5rem;height:2.5rem;}.pie-tool-calculator-inline__icon.svelte-ar9a63 {width:1.25rem;height:1.25rem;fill:currentColor;}.pie-tool-calculator-inline__button.svelte-ar9a63:not(.pie-tool-calculator-inline__button--active):hover:not(:disabled) .pie-tool-calculator-inline__icon:where(.svelte-ar9a63) {color:var(--pie-button-hover-color, #667eea);}.pie-tool-calculator-inline__button--active.svelte-ar9a63 .pie-tool-calculator-inline__icon:where(.svelte-ar9a63) {color:var(--pie-tool-trigger-active-color, inherit);}.pie-tool-calculator-inline__button--sm.svelte-ar9a63 .pie-tool-calculator-inline__icon:where(.svelte-ar9a63) {width:1rem;height:1rem;}.pie-tool-calculator-inline__button--lg.svelte-ar9a63 .pie-tool-calculator-inline__icon:where(.svelte-ar9a63) {width:1.5rem;height:1.5rem;}.pie-sr-only.svelte-ar9a63 {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;}
|
|
26
|
-
|
|
27
|
-
@media (prefers-reduced-motion: reduce) {.pie-tool-calculator-inline__button.svelte-ar9a63 {transition:none;}
|
|
28
|
-
}`
|
|
29
|
-
};
|
|
30
|
-
function j(T, i) {
|
|
31
|
-
e.push(i, !0), e.append_styles(T, Z);
|
|
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", k = [
|
|
34
|
-
"basic",
|
|
35
|
-
"scientific",
|
|
36
|
-
"graphing"
|
|
37
|
-
], C = {
|
|
38
|
-
basic: {
|
|
39
|
-
name: "tools.calculator.nameBasic",
|
|
40
|
-
opened: "tools.calculator.openedBasic",
|
|
41
|
-
closed: "tools.calculator.closedBasic"
|
|
42
|
-
},
|
|
43
|
-
scientific: {
|
|
44
|
-
name: "tools.calculator.nameScientific",
|
|
45
|
-
opened: "tools.calculator.openedScientific",
|
|
46
|
-
closed: "tools.calculator.closedScientific"
|
|
47
|
-
},
|
|
48
|
-
graphing: {
|
|
49
|
-
name: "tools.calculator.nameGraphing",
|
|
50
|
-
opened: "tools.calculator.openedGraphing",
|
|
51
|
-
closed: "tools.calculator.closedGraphing"
|
|
52
|
-
}
|
|
53
|
-
};
|
|
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
|
-
e.user_effect(() => {
|
|
57
|
-
if (e.get(c))
|
|
58
|
-
return K(e.get(c), (t) => {
|
|
59
|
-
e.set(b, t, !0);
|
|
60
|
-
});
|
|
61
|
-
}), e.user_effect(() => {
|
|
62
|
-
const t = e.get(n), r = s(), o = e.get(c);
|
|
63
|
-
if (!(!t || !r || !o))
|
|
64
|
-
return H(() => {
|
|
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
|
-
}), () => {
|
|
67
|
-
l === t && a === r && (l.unregisterTool(a), l = null, a = null);
|
|
68
|
-
};
|
|
69
|
-
}), e.user_effect(() => {
|
|
70
|
-
const t = e.get(n), r = e.get(_);
|
|
71
|
-
if (!x || !t) return;
|
|
72
|
-
const o = () => {
|
|
73
|
-
e.set(h, t.isToolVisible(r), !0);
|
|
74
|
-
}, p = t.subscribe(o);
|
|
75
|
-
return H(o), p;
|
|
76
|
-
});
|
|
77
|
-
function B() {
|
|
78
|
-
if (!e.get(n)) return;
|
|
79
|
-
const t = e.get(n).isToolVisible(e.get(_));
|
|
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
|
-
}
|
|
82
|
-
var L = {
|
|
83
|
-
get toolId() {
|
|
84
|
-
return s();
|
|
85
|
-
},
|
|
86
|
-
set toolId(t = "calculator-inline") {
|
|
87
|
-
s(t), e.flush();
|
|
88
|
-
},
|
|
89
|
-
get targetToolId() {
|
|
90
|
-
return g();
|
|
91
|
-
},
|
|
92
|
-
set targetToolId(t = "") {
|
|
93
|
-
g(t), e.flush();
|
|
94
|
-
},
|
|
95
|
-
get calculatorType() {
|
|
96
|
-
return u();
|
|
97
|
-
},
|
|
98
|
-
set calculatorType(t = "basic") {
|
|
99
|
-
u(t), e.flush();
|
|
100
|
-
},
|
|
101
|
-
get availableTypes() {
|
|
102
|
-
return v();
|
|
103
|
-
},
|
|
104
|
-
set availableTypes(t = "basic,scientific,graphing") {
|
|
105
|
-
v(t), e.flush();
|
|
106
|
-
},
|
|
107
|
-
get size() {
|
|
108
|
-
return d();
|
|
109
|
-
},
|
|
110
|
-
set size(t = "md") {
|
|
111
|
-
d(t), e.flush();
|
|
112
|
-
}
|
|
113
|
-
}, I = e.comment(), S = e.first_child(I), O = (t) => {
|
|
114
|
-
var r = Y(), o = e.child(r);
|
|
115
|
-
let p;
|
|
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
|
-
};
|
|
121
|
-
return e.if(S, (t) => {
|
|
122
|
-
x && t(O);
|
|
123
|
-
}), e.append(T, I), e.pop(L);
|
|
124
|
-
}
|
|
125
|
-
e.delegate(["click"]);
|
|
126
|
-
e.create_custom_element(j, {
|
|
127
|
-
toolId: {},
|
|
128
|
-
targetToolId: {},
|
|
129
|
-
calculatorType: {},
|
|
130
|
-
availableTypes: {},
|
|
131
|
-
size: {}
|
|
132
|
-
}, [], [], { mode: "open" });
|
|
133
|
-
export {
|
|
134
|
-
j as CalculatorInlineTool,
|
|
135
|
-
D as CalculatorTool
|
|
136
|
-
};
|