hyperbook 0.113.1 → 0.113.3
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/dist/asset-manifest.json +9 -9
- package/dist/assets/directive-bitflow/{EditorElement-zyz99U6n.js → EditorElement-BNwEKIvk.js} +258 -258
- package/dist/assets/directive-bitflow/{ReportElements-BnX14NtV.js → ReportElements-CAvHx5xm.js} +2 -2
- package/dist/assets/directive-bitflow/{bitLoaders-DIGwTcpd.js → bitLoaders-7qanePQL.js} +1138 -1073
- package/dist/assets/directive-bitflow/{dom-uYx_3K1r.js → dom-B6NPWBb1.js} +1558 -1551
- package/dist/assets/directive-bitflow/editor.js +3 -3
- package/dist/assets/directive-bitflow/flow.js +4 -4
- package/dist/assets/directive-bitflow/{index-BseSaQlX.js → index-4JaKZ7WT.js} +2 -2
- package/dist/assets/directive-bitflow/{index-e_8twLaN.js → index-6CQr_atd.js} +120 -120
- package/dist/assets/directive-bitflow/{index-COndsSPW.js → index-B9iG-a48.js} +9 -9
- package/dist/assets/directive-bitflow/{index-C5czXkRd.js → index-BFYoOtcY.js} +36 -36
- package/dist/assets/directive-bitflow/{index-YPMWh-1B.js → index-BI6aFdIS.js} +21 -21
- package/dist/assets/directive-bitflow/{index-D7m-hJZ9.js → index-Bf078mfo.js} +69 -69
- package/dist/assets/directive-bitflow/{index-Bf_FQRbK.js → index-BinE5Wvd.js} +19 -19
- package/dist/assets/directive-bitflow/{index-CFcRAa3F.js → index-BoX5-jkC.js} +31 -31
- package/dist/assets/directive-bitflow/{index-NyNuXp4C.js → index-BqRsXShM.js} +34 -34
- package/dist/assets/directive-bitflow/{index-Fr7yl4Vn.js → index-BxihQ8Oo.js} +21 -21
- package/dist/assets/directive-bitflow/{index-B3jMTk1o.js → index-C5YguHZU.js} +101 -101
- package/dist/assets/directive-bitflow/{index-XxGfBwJe.js → index-C8zwSmE6.js} +27 -27
- package/dist/assets/directive-bitflow/{index-BLcJNyog.js → index-C9JSBTNc.js} +91 -91
- package/dist/assets/directive-bitflow/{index-CjscG0z6.js → index-CCMI6UK4.js} +75 -75
- package/dist/assets/directive-bitflow/{index-CK1UMcfT.js → index-CGDt8H6s.js} +24 -24
- package/dist/assets/directive-bitflow/{index-xapm2BQE.js → index-Ca1v0pjV.js} +102 -92
- package/dist/assets/directive-bitflow/{index-IQHOi2fr.js → index-CaYn3Gmh.js} +31 -31
- package/dist/assets/directive-bitflow/{index-BpG316Ls.js → index-CbQue0If.js} +67 -67
- package/dist/assets/directive-bitflow/{index-CzdZQibq.js → index-CjH3h0OO.js} +79 -79
- package/dist/assets/directive-bitflow/{index-B7Z6Q-PQ.js → index-CkO3QfOS.js} +8 -8
- package/dist/assets/directive-bitflow/{index-BIJ7VfD2.js → index-Cz4i5rfe.js} +39 -39
- package/dist/assets/directive-bitflow/{index-8jTO-NJA.js → index-D0NtgeiX.js} +85 -85
- package/dist/assets/directive-bitflow/{index-DtsDy2By.js → index-D1C_1SPY.js} +14 -14
- package/dist/assets/directive-bitflow/{index-BdBBCZSy.js → index-D45u7EVR.js} +227 -194
- package/dist/assets/directive-bitflow/{index-cnRM_JDB.js → index-D9Ox4YpM.js} +33 -33
- package/dist/assets/directive-bitflow/{index-Bqf-kixT.js → index-DJ1w2Xcm.js} +46 -46
- package/dist/assets/directive-bitflow/{index-BQ5h4nDN.js → index-DUqW2fmV.js} +94 -94
- package/dist/assets/directive-bitflow/{index-ChgzyMHe.js → index-Deedj9EF.js} +25 -25
- package/dist/assets/directive-bitflow/{index-CZyaFdD2.js → index-Dg6nnY_v.js} +68 -68
- package/dist/assets/directive-bitflow/{index-kRpwcprB.js → index-DgxEzomz.js} +2 -2
- package/dist/assets/directive-bitflow/{index-D5yZNeIg.js → index-Dl0-ZAT5.js} +52 -52
- package/dist/assets/directive-bitflow/{index-DnVYIuen.js → index-Do6dmZyj.js} +42 -42
- package/dist/assets/directive-bitflow/{index-DjWNEPDL.js → index-DqnGC-DU.js} +31 -31
- package/dist/assets/directive-bitflow/{index-ivI25bnR.js → index-DwXXeSwk.js} +73 -73
- package/dist/assets/directive-bitflow/{index-Bf_NXJjq.js → index-b6qwcTj9.js} +15 -15
- package/dist/assets/directive-bitflow/{index-Fq7njn6_.js → index-d105UFQI.js} +58 -58
- package/dist/assets/directive-bitflow/{index-CW9iev-_.js → index-jijMWQB6.js} +8 -8
- package/dist/assets/directive-bitflow/{index-C_ZTSeqv.js → index-kxO5_U9Y.js} +24 -24
- package/dist/assets/directive-bitflow/{index-DoKlIgCD.js → index-p5AOgOal.js} +35 -35
- package/dist/assets/directive-bitflow/{index-CvCZVgKv.js → index-q2APknM6.js} +46 -46
- package/dist/assets/directive-bitflow/{index-eN2S_MLj.js → index-zVkWgm5I.js} +70 -70
- package/dist/assets/directive-bitflow/index.js +6 -6
- package/dist/assets/directive-bitflow/katex-DSLAjWZH-CHGN3Pr6.js +11314 -0
- package/dist/assets/directive-bitflow/katex-Dv-tcU2S-Dv-tcU2S.js +4 -0
- package/dist/assets/directive-bitflow/report.js +1 -1
- package/dist/assets/directive-bitflow/{shareableReport-ArQU1XjG.js → shareableReport-mdyEMdsJ.js} +6 -6
- package/dist/index.js +1 -1
- package/package.json +2 -2
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
const re = ["none", "minor", "major"], Me = ve(re), Ce =
|
|
1
|
+
import { P as A, ak as he, Y as L, a2 as O, ac as we, ad as ne, a9 as q, a4 as pe, j as i, a as x, a5 as ve, b as P, aj as E, aa as xe, s as ge } from "./dom-B6NPWBb1.js";
|
|
2
|
+
import { e as ke, g as R, F as Y, M as je, r as G, i as K, P as ye, B as Ne, y as Le, U as Te, H as Se } from "./bitLoaders-7qanePQL.js";
|
|
3
|
+
const re = ["none", "minor", "major"], Me = ve(re), Ce = A({
|
|
4
4
|
/** Stable across edits, so a placed marker and an answer keep pointing at
|
|
5
5
|
* the same item even after the author reorders the list. */
|
|
6
|
-
id:
|
|
6
|
+
id: O().min(1),
|
|
7
7
|
/** What the chip and the marker show — plain text, e.g. "3/4" or "√2". Not
|
|
8
8
|
* parsed: it is only ever displayed, never read back into arithmetic. */
|
|
9
|
-
label:
|
|
9
|
+
label: O().min(1),
|
|
10
10
|
/** The correct position, in the line's own units — never a fraction of the
|
|
11
11
|
* line's length. The author types an expression in the form ("3/4",
|
|
12
12
|
* "sqrt(2)"); this is always the evaluated number. */
|
|
13
|
-
value:
|
|
13
|
+
value: L(),
|
|
14
14
|
/** Overrides `tolerance` for this one item — a harder root among easier
|
|
15
15
|
* fractions, say. Absent means the line's own tolerance applies. */
|
|
16
|
-
tolerance:
|
|
17
|
-
}),
|
|
18
|
-
instruction:
|
|
16
|
+
tolerance: L().min(0).optional()
|
|
17
|
+
}), He = A({
|
|
18
|
+
instruction: O().default(""),
|
|
19
19
|
/** The line's extent, in its own units. */
|
|
20
|
-
min:
|
|
21
|
-
max:
|
|
20
|
+
min: L().default(-2),
|
|
21
|
+
max: L().default(2),
|
|
22
22
|
/** Spacing of the labelled ticks. Always positive: a step of zero would
|
|
23
23
|
* ask for infinitely many of them. */
|
|
24
|
-
tickStep:
|
|
24
|
+
tickStep: L().positive().default(1),
|
|
25
25
|
/** Unlabelled ticks between two major ones. Capped at 10 — past that the
|
|
26
26
|
* line reads as a smear of lines rather than a scale. */
|
|
27
|
-
minorTicks:
|
|
27
|
+
minorTicks: L().int().min(0).max(10).default(0),
|
|
28
28
|
labelTicks: q().default(!0),
|
|
29
29
|
items: pe(Ce).default([]),
|
|
30
30
|
/**
|
|
@@ -36,7 +36,7 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
36
36
|
* `toleranceFor` in `evaluate.ts` falls back to the same formula for a
|
|
37
37
|
* document that predates a field, or one written by hand.
|
|
38
38
|
*/
|
|
39
|
-
tolerance:
|
|
39
|
+
tolerance: L().min(0).optional(),
|
|
40
40
|
/** Where a placed marker actually lands. `"minor"` with no minor ticks
|
|
41
41
|
* drawn is the same as `"major"` — there is nothing finer to snap to. */
|
|
42
42
|
snap: Me.default("minor"),
|
|
@@ -77,24 +77,24 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
77
77
|
message: `${o.value} is outside the line (${r} to ${c}).`
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
|
-
}), at =
|
|
80
|
+
}), at = A({
|
|
81
81
|
/** Item id → where the learner placed it, in the line's own units. */
|
|
82
|
-
positions: he(
|
|
83
|
-
}),
|
|
82
|
+
positions: he(O(), L()).default({})
|
|
83
|
+
}), ze = (e) => e.tolerance ?? e.tickStep / 4, Pe = (e, r) => r.tolerance ?? ze(e), We = 1e-9, F = (e, r) => {
|
|
84
84
|
const c = {};
|
|
85
85
|
for (const n of e.items) {
|
|
86
86
|
const a = r?.positions?.[n.id];
|
|
87
87
|
c[n.id] = a !== void 0 && Math.abs(a - n.value) <= Pe(e, n) + We ? "correct" : "wrong";
|
|
88
88
|
}
|
|
89
89
|
return c;
|
|
90
|
-
},
|
|
91
|
-
const c = Object.values(
|
|
90
|
+
}, Ie = (e, r) => {
|
|
91
|
+
const c = Object.values(F(e, r));
|
|
92
92
|
return {
|
|
93
93
|
earned: c.filter((n) => n === "correct").length,
|
|
94
94
|
possible: c.length
|
|
95
95
|
};
|
|
96
|
-
},
|
|
97
|
-
const c = Object.values(
|
|
96
|
+
}, Re = (e, r) => {
|
|
97
|
+
const c = Object.values(F(e, r));
|
|
98
98
|
return c.length > 0 && c.every((n) => n === "correct");
|
|
99
99
|
}, $e = ({
|
|
100
100
|
data: e,
|
|
@@ -102,12 +102,12 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
102
102
|
}) => {
|
|
103
103
|
if (e.evaluation.mode === "skip")
|
|
104
104
|
return { state: "unknown", allowRetry: !1 };
|
|
105
|
-
const c =
|
|
105
|
+
const c = Re(e, r), n = Ie(e, r), a = e.partialCredit && n.possible > 0 ? n : { earned: c ? 1 : 0, possible: 1 };
|
|
106
106
|
return {
|
|
107
107
|
state: c ? "correct" : "wrong",
|
|
108
108
|
score: a,
|
|
109
109
|
allowRetry: e.evaluation.enableRetry,
|
|
110
|
-
detail: { items:
|
|
110
|
+
detail: { items: F(e, r) }
|
|
111
111
|
};
|
|
112
112
|
}, V = {
|
|
113
113
|
en: {
|
|
@@ -144,7 +144,7 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
144
144
|
wrong: "falsch",
|
|
145
145
|
correctValue: "Richtige Position: {value}"
|
|
146
146
|
}
|
|
147
|
-
},
|
|
147
|
+
}, Oe = ".bitflow-number-line{display:flex;flex-direction:column;gap:var(--bitflow-space-small)}.bitflow-number-line-diagram{width:100%;height:auto;background:var(--bitflow-color-surface);border:1px solid var(--bitflow-color-border);border-radius:var(--bitflow-radius-standard)}.bitflow-number-line-axis{stroke:var(--bitflow-color-neutral-700);stroke-width:calc(3 * var(--bitflow-number-line-scale, 1));stroke-linecap:round}.bitflow-number-line-ticks-major line{stroke:var(--bitflow-color-neutral-700);stroke-width:calc(2.5 * var(--bitflow-number-line-scale, 1))}.bitflow-number-line-ticks-minor line{stroke:var(--bitflow-color-neutral-200);stroke-width:calc(1.5 * var(--bitflow-number-line-scale, 1))}.bitflow-number-line-tick-labels text{fill:var(--bitflow-color-text-muted);font-family:var(--bitflow-font-family);font-size:calc(23px * var(--bitflow-number-line-scale, 1));font-variant-numeric:tabular-nums;text-anchor:middle}.bitflow-number-line-catcher{cursor:crosshair}.bitflow-number-line-answer line{stroke:var(--bitflow-color-text-muted);stroke-width:3;stroke-dasharray:6 5}.bitflow-number-line-label text{fill:var(--bitflow-color-text);stroke:var(--bitflow-color-surface);stroke-width:5px;paint-order:stroke fill;font-family:var(--bitflow-font-family);font-size:22px;font-weight:var(--bitflow-font-weight-medium);text-anchor:middle}.bitflow-number-line-dot{fill:var(--bitflow-color-primary);stroke:var(--bitflow-color-on-primary);stroke-width:2}.bitflow-number-line-dot-active{stroke:var(--bitflow-color-neutral-900);stroke-width:3}.bitflow-number-line-dot-correct{fill:var(--bitflow-color-correct)}.bitflow-number-line-dot-wrong{fill:var(--bitflow-color-wrong)}.bitflow-number-line-verdict{font-family:var(--bitflow-font-family);font-size:22px;font-weight:var(--bitflow-font-weight-bold)}.bitflow-number-line-verdict-correct{fill:var(--bitflow-color-correct)}.bitflow-number-line-verdict-wrong{fill:var(--bitflow-color-wrong)}.bitflow-number-line-hit{fill:transparent;stroke:none;cursor:grab;touch-action:none}.bitflow-number-line-hit:focus-visible{outline:3px solid var(--bitflow-color-primary);outline-offset:2px}.bitflow-number-line-palette{display:flex;flex-wrap:wrap;gap:var(--bitflow-space-xxsmall)}.bitflow-number-line-chip{display:inline-flex;align-items:center;min-height:44px;padding:var(--bitflow-space-xxsmall) var(--bitflow-space-small);border:var(--bitflow-border-width) solid var(--bitflow-color-border);border-radius:var(--bitflow-radius-full);background:var(--bitflow-color-surface);cursor:pointer}.bitflow-number-line-chip:has(:checked){border-color:var(--bitflow-color-neutral-900);font-weight:var(--bitflow-font-weight-bold)}.bitflow-number-line-chip:has(:focus-visible){box-shadow:var(--bitflow-shadow-outline)}.bitflow-number-line-row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--bitflow-space-xsmall)}.bitflow-number-line-row-label{flex:1 1 auto;font-variant-numeric:tabular-nums}.bitflow-number-line-badge{font-weight:var(--bitflow-font-weight-bold)}.bitflow-number-line-badge-correct{color:var(--bitflow-color-correct)}.bitflow-number-line-badge-wrong{color:var(--bitflow-color-wrong)}.bitflow-number-line-editor-row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--bitflow-space-xsmall)}.bitflow-number-line-editor-row>.bitflow-input{flex:1 1 8rem;width:auto;min-width:0}.bitflow-number-line-number{flex:0 1 var(--bitflow-number-line-number-width, 6rem);width:var(--bitflow-number-line-number-width, 6rem)}", Ee = {
|
|
148
148
|
en: {
|
|
149
149
|
instructionLabel: "Instruction",
|
|
150
150
|
instructionHint: "Shown above the line. Markdown is allowed.",
|
|
@@ -213,15 +213,15 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
213
213
|
partialCreditHint: "Ein Punkt je Wert statt einer für den ganzen Zahlenstrahl. Neun von zehn richtig platziert sind neun Zehntel der Wertung.",
|
|
214
214
|
advanced: "Erweitert"
|
|
215
215
|
}
|
|
216
|
-
}, $ = 1e3, Ve = 220, S = { left: 48, right: 48 },
|
|
216
|
+
}, $ = 1e3, Ve = 220, S = { left: 48, right: 48 }, B = $ - S.left - S.right, y = 132, oe = (e) => e.max - e.min || 1, H = (e, r) => S.left + (r - e.min) / oe(e) * B, De = (e, r) => e.min + (r - S.left) / B * oe(e), U = (e) => e.minorTicks > 0 ? e.tickStep / (e.minorTicks + 1) : e.tickStep, se = (e, r) => {
|
|
217
217
|
if (r !== "none")
|
|
218
|
-
return r === "major" ? e.tickStep :
|
|
219
|
-
},
|
|
218
|
+
return r === "major" ? e.tickStep : U(e);
|
|
219
|
+
}, Ze = (e) => se(e, e.snap) ?? U(e), W = (e) => Math.round(e * 1e9) / 1e9, J = (e, r) => {
|
|
220
220
|
const c = Math.min(Math.max(r, e.min), e.max), n = se(e, e.snap);
|
|
221
221
|
if (!n) return W(c);
|
|
222
222
|
const a = e.min + Math.round((c - e.min) / n) * n;
|
|
223
223
|
return W(Math.min(Math.max(a, e.min), e.max));
|
|
224
|
-
}, Q = 400,
|
|
224
|
+
}, Q = 400, Ae = (e) => {
|
|
225
225
|
const { min: r, max: c, tickStep: n } = e;
|
|
226
226
|
if (!(n > 0)) return { major: [r, c].filter(Number.isFinite), minor: [] };
|
|
227
227
|
const a = n * 1e-6, o = [];
|
|
@@ -229,14 +229,14 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
229
229
|
o.push(W(b));
|
|
230
230
|
const u = [];
|
|
231
231
|
if (e.minorTicks > 0) {
|
|
232
|
-
const b =
|
|
232
|
+
const b = U(e);
|
|
233
233
|
for (let d = r; d <= c + a && u.length < Q; d += b) {
|
|
234
234
|
const k = W(d);
|
|
235
235
|
o.some((j) => Math.abs(j - k) < a) || u.push(k);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
return { major: o, minor: u };
|
|
239
|
-
}, T = (e) => String(W(e * 1e3) / 1e3),
|
|
239
|
+
}, T = (e) => String(W(e * 1e3) / 1e3), Fe = (e, r) => {
|
|
240
240
|
const c = [...e].sort((o, u) => o.view - u.view), n = [], a = {};
|
|
241
241
|
for (const o of c) {
|
|
242
242
|
let u = 0;
|
|
@@ -244,14 +244,14 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
244
244
|
n[u] = o.view, a[o.id] = u;
|
|
245
245
|
}
|
|
246
246
|
return a;
|
|
247
|
-
}, ee = 9,
|
|
247
|
+
}, ee = 9, Be = 36, Z = 14, te = 7, ie = 40, Ue = 26, Xe = 22, _e = 70, qe = 4, Ye = 560, Ge = 2.2, Ke = (e) => {
|
|
248
248
|
const [r, c] = x.useState(1);
|
|
249
249
|
return x.useLayoutEffect(() => {
|
|
250
250
|
const n = e.current;
|
|
251
251
|
if (!n || typeof ResizeObserver > "u") return;
|
|
252
252
|
const a = () => {
|
|
253
253
|
const u = n.getBoundingClientRect().width;
|
|
254
|
-
u && c(Math.min(
|
|
254
|
+
u && c(Math.min(Ge, Math.max(1, Ye / u)));
|
|
255
255
|
};
|
|
256
256
|
a();
|
|
257
257
|
const o = new ResizeObserver(a);
|
|
@@ -265,14 +265,14 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
265
265
|
readonly: a,
|
|
266
266
|
onPlace: o
|
|
267
267
|
}) => {
|
|
268
|
-
const u = (t, s) => P(V, t, n, s), b = x.useRef(null), d =
|
|
268
|
+
const u = (t, s) => P(V, t, n, s), b = x.useRef(null), d = Ke(b), k = x.useId(), j = r?.positions ?? {}, [M, l] = x.useState(
|
|
269
269
|
() => e.items.find((t) => j[t.id] === void 0)?.id ?? e.items[0]?.id
|
|
270
|
-
), [f, p] = x.useState(""), g = x.useRef(null), [, h] = x.useReducer((t) => t + 1, 0),
|
|
270
|
+
), [f, p] = x.useState(""), g = x.useRef(null), [, h] = x.useReducer((t) => t + 1, 0), N = !!o && !a, D = Ae(e), X = (t) => {
|
|
271
271
|
const s = b.current?.getBoundingClientRect();
|
|
272
272
|
if (!s || s.width === 0) return;
|
|
273
273
|
const m = (t - s.left) / s.width * $;
|
|
274
|
-
return
|
|
275
|
-
},
|
|
274
|
+
return De(e, m);
|
|
275
|
+
}, I = (t, s, m) => {
|
|
276
276
|
if (!o) return;
|
|
277
277
|
const v = J(e, s);
|
|
278
278
|
if (o(t.id, v), p(u(m, { label: t.label, value: T(v) })), m === "placed") {
|
|
@@ -282,13 +282,13 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
282
282
|
w && l(w.id);
|
|
283
283
|
}
|
|
284
284
|
}, me = (t) => {
|
|
285
|
-
if (!
|
|
285
|
+
if (!N || !M) return;
|
|
286
286
|
const s = e.items.find((v) => v.id === M), m = X(t.clientX);
|
|
287
|
-
!s || m === void 0 ||
|
|
287
|
+
!s || m === void 0 || I(s, m, j[s.id] === void 0 ? "placed" : "moved");
|
|
288
288
|
}, de = (t, s, m) => {
|
|
289
|
-
!
|
|
289
|
+
!N || t.button !== 0 || (t.stopPropagation(), l(s.id), g.current = { itemId: s.id, startClientX: t.clientX, value: m, moved: !1 }, h());
|
|
290
290
|
};
|
|
291
|
-
|
|
291
|
+
Le((t) => {
|
|
292
292
|
const s = g.current;
|
|
293
293
|
if (!s) return;
|
|
294
294
|
const m = s.moved || Math.abs(t.clientX - s.startClientX) > qe, v = X(t.clientX), w = v === void 0 ? s.value : J(e, v);
|
|
@@ -297,22 +297,22 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
297
297
|
const t = g.current;
|
|
298
298
|
if (g.current = null, h(), !t || !t.moved) return;
|
|
299
299
|
const s = e.items.find((m) => m.id === t.itemId);
|
|
300
|
-
s &&
|
|
300
|
+
s && I(s, t.value, "moved");
|
|
301
301
|
});
|
|
302
302
|
const be = (t, s, m) => {
|
|
303
|
-
if (!
|
|
304
|
-
const v = t.shiftKey ? e.tickStep :
|
|
303
|
+
if (!N) return;
|
|
304
|
+
const v = t.shiftKey ? e.tickStep : Ze(e);
|
|
305
305
|
let w;
|
|
306
|
-
t.key === "ArrowLeft" ? w = m - v : t.key === "ArrowRight" ? w = m + v : t.key === "Home" ? w = e.min : t.key === "End" && (w = e.max), w !== void 0 && (t.preventDefault(),
|
|
307
|
-
},
|
|
306
|
+
t.key === "ArrowLeft" ? w = m - v : t.key === "ArrowRight" ? w = m + v : t.key === "Home" ? w = e.min : t.key === "End" && (w = e.max), w !== void 0 && (t.preventDefault(), I(s, w, "moved"));
|
|
307
|
+
}, _ = e.items.flatMap((t) => {
|
|
308
308
|
const s = g.current?.itemId === t.id ? g.current.value : j[t.id];
|
|
309
309
|
return s === void 0 ? [] : [{ item: t, value: s }];
|
|
310
|
-
}), fe =
|
|
311
|
-
|
|
312
|
-
|
|
310
|
+
}), fe = Fe(
|
|
311
|
+
_.map(({ item: t, value: s }) => ({ id: t.id, view: H(e, s) })),
|
|
312
|
+
_e
|
|
313
313
|
);
|
|
314
314
|
return /* @__PURE__ */ i.jsxs("div", { className: "bitflow-number-line", children: [
|
|
315
|
-
|
|
315
|
+
N && /* @__PURE__ */ i.jsx(
|
|
316
316
|
"div",
|
|
317
317
|
{
|
|
318
318
|
className: "bitflow-number-line-palette",
|
|
@@ -330,7 +330,7 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
330
330
|
checked: M === t.id,
|
|
331
331
|
onChange: () => l(t.id),
|
|
332
332
|
onKeyDown: (m) => {
|
|
333
|
-
m.key !== "Enter" || s !== void 0 || (m.preventDefault(),
|
|
333
|
+
m.key !== "Enter" || s !== void 0 || (m.preventDefault(), I(t, (e.min + e.max) / 2, "placed"));
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
),
|
|
@@ -363,30 +363,30 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
363
363
|
y2: y
|
|
364
364
|
}
|
|
365
365
|
),
|
|
366
|
-
/* @__PURE__ */ i.jsx("g", { className: "bitflow-number-line-ticks-minor", children:
|
|
367
|
-
const s =
|
|
366
|
+
/* @__PURE__ */ i.jsx("g", { className: "bitflow-number-line-ticks-minor", children: D.minor.map((t) => {
|
|
367
|
+
const s = H(e, t);
|
|
368
368
|
return /* @__PURE__ */ i.jsx("line", { x1: s, x2: s, y1: y - te, y2: y + te }, `minor-${t}`);
|
|
369
369
|
}) }),
|
|
370
|
-
/* @__PURE__ */ i.jsx("g", { className: "bitflow-number-line-ticks-major", children:
|
|
371
|
-
const s =
|
|
372
|
-
return /* @__PURE__ */ i.jsx("line", { x1: s, x2: s, y1: y -
|
|
370
|
+
/* @__PURE__ */ i.jsx("g", { className: "bitflow-number-line-ticks-major", children: D.major.map((t) => {
|
|
371
|
+
const s = H(e, t);
|
|
372
|
+
return /* @__PURE__ */ i.jsx("line", { x1: s, x2: s, y1: y - Z, y2: y + Z }, `major-${t}`);
|
|
373
373
|
}) }),
|
|
374
|
-
e.labelTicks && /* @__PURE__ */ i.jsx("g", { className: "bitflow-number-line-tick-labels", children:
|
|
374
|
+
e.labelTicks && /* @__PURE__ */ i.jsx("g", { className: "bitflow-number-line-tick-labels", children: D.major.map((t) => /* @__PURE__ */ i.jsx(
|
|
375
375
|
"text",
|
|
376
376
|
{
|
|
377
|
-
x:
|
|
378
|
-
y: y +
|
|
377
|
+
x: H(e, t),
|
|
378
|
+
y: y + Z + 10 + 20 * d,
|
|
379
379
|
textAnchor: "middle",
|
|
380
380
|
children: T(t)
|
|
381
381
|
},
|
|
382
382
|
`label-${t}`
|
|
383
383
|
)) }),
|
|
384
|
-
|
|
384
|
+
N && /* @__PURE__ */ i.jsx(
|
|
385
385
|
"rect",
|
|
386
386
|
{
|
|
387
387
|
x: S.left,
|
|
388
388
|
y: y - ie,
|
|
389
|
-
width:
|
|
389
|
+
width: B,
|
|
390
390
|
height: ie * 2,
|
|
391
391
|
fill: "transparent",
|
|
392
392
|
className: "bitflow-number-line-catcher",
|
|
@@ -397,7 +397,7 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
397
397
|
"g",
|
|
398
398
|
{
|
|
399
399
|
className: "bitflow-number-line-answer",
|
|
400
|
-
transform: `translate(${
|
|
400
|
+
transform: `translate(${H(e, t.value)} ${y}) scale(${d})`,
|
|
401
401
|
children: [
|
|
402
402
|
/* @__PURE__ */ i.jsx("title", { children: u("correctValue", { value: T(t.value) }) }),
|
|
403
403
|
/* @__PURE__ */ i.jsx("line", { x1: 0, y1: -18, x2: 0, y2: 18 })
|
|
@@ -405,8 +405,8 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
405
405
|
},
|
|
406
406
|
`answer-${t.id}`
|
|
407
407
|
)),
|
|
408
|
-
|
|
409
|
-
const m = c?.[t.id], v =
|
|
408
|
+
_.map(({ item: t, value: s }) => {
|
|
409
|
+
const m = c?.[t.id], v = H(e, s), w = fe[t.id] ?? 0, C = ["bitflow-number-line-dot"];
|
|
410
410
|
return M === t.id && C.push("bitflow-number-line-dot-active"), m && C.push(`bitflow-number-line-dot-${m}`), /* @__PURE__ */ i.jsxs(
|
|
411
411
|
"g",
|
|
412
412
|
{
|
|
@@ -417,7 +417,7 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
417
417
|
"g",
|
|
418
418
|
{
|
|
419
419
|
className: "bitflow-number-line-label",
|
|
420
|
-
transform: `translate(0 ${-(
|
|
420
|
+
transform: `translate(0 ${-(Ue + w * Xe)})`,
|
|
421
421
|
children: /* @__PURE__ */ i.jsx("text", { children: t.label })
|
|
422
422
|
}
|
|
423
423
|
),
|
|
@@ -431,10 +431,10 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
431
431
|
children: m === "correct" ? "✓" : "✗"
|
|
432
432
|
}
|
|
433
433
|
),
|
|
434
|
-
|
|
434
|
+
N && /* @__PURE__ */ i.jsx(
|
|
435
435
|
"circle",
|
|
436
436
|
{
|
|
437
|
-
r:
|
|
437
|
+
r: Be,
|
|
438
438
|
className: "bitflow-number-line-hit",
|
|
439
439
|
role: "slider",
|
|
440
440
|
tabIndex: 0,
|
|
@@ -443,10 +443,10 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
443
443
|
"aria-valuemax": e.max,
|
|
444
444
|
"aria-valuenow": s,
|
|
445
445
|
"aria-valuetext": T(s),
|
|
446
|
-
onPointerDown: (
|
|
447
|
-
onKeyDown: (
|
|
448
|
-
onClick: (
|
|
449
|
-
|
|
446
|
+
onPointerDown: (z) => de(z, t, s),
|
|
447
|
+
onKeyDown: (z) => be(z, t, s),
|
|
448
|
+
onClick: (z) => {
|
|
449
|
+
z.stopPropagation(), l(t.id);
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
452
|
)
|
|
@@ -512,7 +512,7 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
512
512
|
}) => {
|
|
513
513
|
const [n, a] = x.useState(() => String(e));
|
|
514
514
|
return x.useEffect(() => {
|
|
515
|
-
const o =
|
|
515
|
+
const o = E(n);
|
|
516
516
|
(!o.ok || Math.abs(o.value - e) > 1e-9) && a(String(e));
|
|
517
517
|
}, [e]), /* @__PURE__ */ i.jsx(
|
|
518
518
|
"input",
|
|
@@ -524,7 +524,7 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
524
524
|
value: n,
|
|
525
525
|
onChange: (o) => {
|
|
526
526
|
a(o.target.value);
|
|
527
|
-
const u =
|
|
527
|
+
const u = E(o.target.value);
|
|
528
528
|
u.ok && r(u.value);
|
|
529
529
|
}
|
|
530
530
|
}
|
|
@@ -537,7 +537,7 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
537
537
|
const [n, a] = x.useState(() => e === void 0 ? "" : String(e));
|
|
538
538
|
return x.useEffect(() => {
|
|
539
539
|
if (e === void 0) return;
|
|
540
|
-
const o =
|
|
540
|
+
const o = E(n);
|
|
541
541
|
(!o.ok || Math.abs(o.value - e) > 1e-9) && a(String(e));
|
|
542
542
|
}, [e]), /* @__PURE__ */ i.jsx(
|
|
543
543
|
"input",
|
|
@@ -553,7 +553,7 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
553
553
|
r(void 0);
|
|
554
554
|
return;
|
|
555
555
|
}
|
|
556
|
-
const b =
|
|
556
|
+
const b = E(u);
|
|
557
557
|
b.ok && r(b.value);
|
|
558
558
|
}
|
|
559
559
|
}
|
|
@@ -564,7 +564,7 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
564
564
|
if (!r.includes(n)) return n;
|
|
565
565
|
}
|
|
566
566
|
}, et = ({ data: e, locale: r, onChange: c, errors: n }) => {
|
|
567
|
-
const a = (l, f) => P(
|
|
567
|
+
const a = (l, f) => P(Ee, l, r, f), o = (l) => c({ ...e, ...l }), u = (l, f) => o({
|
|
568
568
|
items: e.items.map((p) => p.id === l ? { ...p, ...f } : p)
|
|
569
569
|
}), b = () => o({
|
|
570
570
|
items: [
|
|
@@ -575,10 +575,10 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
575
575
|
value: (e.min + e.max) / 2
|
|
576
576
|
}
|
|
577
577
|
]
|
|
578
|
-
}), d = (l, f, p, g, h) => /* @__PURE__ */ i.jsx(
|
|
578
|
+
}), d = (l, f, p, g, h) => /* @__PURE__ */ i.jsx(G, { label: l, error: g, hint: h, children: (N) => /* @__PURE__ */ i.jsx(
|
|
579
579
|
ae,
|
|
580
580
|
{
|
|
581
|
-
...
|
|
581
|
+
...N,
|
|
582
582
|
className: "bitflow-input bitflow-number-line-number",
|
|
583
583
|
value: f,
|
|
584
584
|
onChange: p
|
|
@@ -606,12 +606,12 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
606
606
|
),
|
|
607
607
|
/* @__PURE__ */ i.jsxs("div", { className: "bitflow-row", children: [
|
|
608
608
|
d(a("minLabel"), e.min, (l) => o({ min: l })),
|
|
609
|
-
d(a("maxLabel"), e.max, (l) => o({ max: l }),
|
|
609
|
+
d(a("maxLabel"), e.max, (l) => o({ max: l }), R(n, "max")),
|
|
610
610
|
d(
|
|
611
611
|
a("tickStepLabel"),
|
|
612
612
|
e.tickStep,
|
|
613
613
|
(l) => o({ tickStep: l }),
|
|
614
|
-
|
|
614
|
+
R(n, "tickStep"),
|
|
615
615
|
a("tickStepHint")
|
|
616
616
|
),
|
|
617
617
|
d(
|
|
@@ -623,7 +623,7 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
623
623
|
)
|
|
624
624
|
] }),
|
|
625
625
|
/* @__PURE__ */ i.jsx(
|
|
626
|
-
|
|
626
|
+
Y,
|
|
627
627
|
{
|
|
628
628
|
label: a("labelTicksLabel"),
|
|
629
629
|
hint: a("labelTicksHint"),
|
|
@@ -640,7 +640,7 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
640
640
|
onChange: (l) => o({ snap: l })
|
|
641
641
|
}
|
|
642
642
|
),
|
|
643
|
-
/* @__PURE__ */ i.jsx(
|
|
643
|
+
/* @__PURE__ */ i.jsx(G, { label: a("toleranceLabel"), hint: a("toleranceHint"), children: (l) => /* @__PURE__ */ i.jsx(
|
|
644
644
|
le,
|
|
645
645
|
{
|
|
646
646
|
...l,
|
|
@@ -657,7 +657,7 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
657
657
|
/* @__PURE__ */ i.jsxs("fieldset", { className: "bitflow-field", children: [
|
|
658
658
|
/* @__PURE__ */ i.jsx("legend", { className: "bitflow-label", children: a("itemsLabel") }),
|
|
659
659
|
/* @__PURE__ */ i.jsx("span", { className: "bitflow-hint", children: a("itemsHint") }),
|
|
660
|
-
|
|
660
|
+
K(n, "items") && /* @__PURE__ */ i.jsx("span", { className: "bitflow-field-error", role: "alert", children: K(n, "items") }),
|
|
661
661
|
M.map((l) => /* @__PURE__ */ i.jsx("span", { className: "bitflow-field-error", role: "alert", children: l }, l)),
|
|
662
662
|
e.items.length === 0 && /* @__PURE__ */ i.jsx("p", { className: "bitflow-text-muted", children: a("noItems") }),
|
|
663
663
|
e.items.map((l, f) => {
|
|
@@ -671,7 +671,7 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
671
671
|
value: l.label,
|
|
672
672
|
placeholder: a("itemLabelPlaceholder"),
|
|
673
673
|
"aria-label": a("itemLabelOf", { position: p }),
|
|
674
|
-
"aria-invalid":
|
|
674
|
+
"aria-invalid": R(n, `items.${f}.label`) ? !0 : void 0,
|
|
675
675
|
onChange: (h) => u(l.id, { label: h.target.value })
|
|
676
676
|
}
|
|
677
677
|
),
|
|
@@ -681,7 +681,7 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
681
681
|
className: "bitflow-input bitflow-number-line-number",
|
|
682
682
|
value: l.value,
|
|
683
683
|
"aria-label": a("itemValueOf", { position: p }),
|
|
684
|
-
"aria-invalid":
|
|
684
|
+
"aria-invalid": R(n, `items.${f}.value`) ? !0 : void 0,
|
|
685
685
|
onChange: (h) => u(l.id, { value: h })
|
|
686
686
|
}
|
|
687
687
|
),
|
|
@@ -712,7 +712,7 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
712
712
|
] }),
|
|
713
713
|
/* @__PURE__ */ i.jsxs(ye, { summary: a("advanced"), children: [
|
|
714
714
|
/* @__PURE__ */ i.jsx(
|
|
715
|
-
|
|
715
|
+
Y,
|
|
716
716
|
{
|
|
717
717
|
label: a("partialCreditLabel"),
|
|
718
718
|
hint: a("partialCreditHint"),
|
|
@@ -721,7 +721,7 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
721
721
|
}
|
|
722
722
|
),
|
|
723
723
|
/* @__PURE__ */ i.jsx(
|
|
724
|
-
|
|
724
|
+
Ne,
|
|
725
725
|
{
|
|
726
726
|
evaluation: e.evaluation,
|
|
727
727
|
locale: r,
|
|
@@ -734,7 +734,7 @@ const re = ["none", "minor", "major"], Me = ve(re), Ce = Z({
|
|
|
734
734
|
xe({
|
|
735
735
|
type: ue,
|
|
736
736
|
kind: "task",
|
|
737
|
-
schema:
|
|
737
|
+
schema: He,
|
|
738
738
|
evaluate: $e,
|
|
739
739
|
Task: Je,
|
|
740
740
|
Form: et,
|
|
@@ -761,37 +761,37 @@ xe({
|
|
|
761
761
|
})
|
|
762
762
|
});
|
|
763
763
|
Se(ue);
|
|
764
|
-
ge("bitflow-styles-task-number-line",
|
|
764
|
+
ge("bitflow-styles-task-number-line", Oe);
|
|
765
765
|
export {
|
|
766
766
|
at as AnswerSchema,
|
|
767
|
-
|
|
767
|
+
He as DataSchema,
|
|
768
768
|
et as Form,
|
|
769
769
|
Ce as ItemSchema,
|
|
770
770
|
y as LINE_Y,
|
|
771
771
|
S as MARGIN,
|
|
772
772
|
ce as NumberLineView,
|
|
773
|
-
|
|
773
|
+
B as PLOT_WIDTH,
|
|
774
774
|
re as SNAP_MODES,
|
|
775
775
|
Me as SnapModeSchema,
|
|
776
776
|
ue as TYPE,
|
|
777
777
|
Je as Task,
|
|
778
778
|
Ve as VIEW_HEIGHT,
|
|
779
779
|
$ as VIEW_WIDTH,
|
|
780
|
-
|
|
780
|
+
Re as allCorrect,
|
|
781
781
|
$e as evaluate,
|
|
782
|
-
|
|
782
|
+
Ee as formMessages,
|
|
783
783
|
T as formatValue,
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
784
|
+
F as itemStates,
|
|
785
|
+
Ze as keyboardStepFor,
|
|
786
|
+
ze as lineTolerance,
|
|
787
787
|
V as messages,
|
|
788
|
-
|
|
789
|
-
|
|
788
|
+
U as minorStepFor,
|
|
789
|
+
Ie as scoreOf,
|
|
790
790
|
se as snapStepFor,
|
|
791
791
|
J as snapValue,
|
|
792
|
-
|
|
793
|
-
|
|
792
|
+
Fe as stackLabels,
|
|
793
|
+
Ae as ticksFor,
|
|
794
794
|
Pe as toleranceFor,
|
|
795
|
-
|
|
796
|
-
|
|
795
|
+
H as valueToView,
|
|
796
|
+
De as viewToValue
|
|
797
797
|
};
|