hyperbook 0.113.0 → 0.113.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.
- package/README.md +18 -3
- package/dist/asset-manifest.json +9 -9
- package/dist/assets/directive-bitflow/{EditorElement-zyz99U6n.js → EditorElement-CE3Yr86b.js} +155 -155
- package/dist/assets/directive-bitflow/{ReportElements-BnX14NtV.js → ReportElements-eYGRtw6N.js} +1 -1
- package/dist/assets/directive-bitflow/{bitLoaders-DIGwTcpd.js → bitLoaders-CxvZkGrY.js} +1138 -1073
- package/dist/assets/directive-bitflow/editor.js +3 -3
- package/dist/assets/directive-bitflow/flow.js +3 -3
- package/dist/assets/directive-bitflow/{index-IQHOi2fr.js → index-88c3K20U.js} +31 -31
- package/dist/assets/directive-bitflow/{index-Bqf-kixT.js → index-B61LKxr1.js} +45 -45
- package/dist/assets/directive-bitflow/{index-CFcRAa3F.js → index-BG0PL-Z6.js} +30 -30
- package/dist/assets/directive-bitflow/{index-B3jMTk1o.js → index-BNdpL6Ss.js} +78 -78
- package/dist/assets/directive-bitflow/{index-Fq7njn6_.js → index-BO-d4HVC.js} +48 -48
- package/dist/assets/directive-bitflow/{index-Bf_NXJjq.js → index-BZhNY0lo.js} +12 -12
- package/dist/assets/directive-bitflow/{index-COndsSPW.js → index-BadyFTU5.js} +8 -8
- package/dist/assets/directive-bitflow/{index-CvCZVgKv.js → index-BlT1EcFH.js} +34 -34
- package/dist/assets/directive-bitflow/{index-CW9iev-_.js → index-BuQ-K_tR.js} +7 -7
- package/dist/assets/directive-bitflow/{index-DjWNEPDL.js → index-Bw0pL0hW.js} +28 -28
- package/dist/assets/directive-bitflow/{index-BQ5h4nDN.js → index-BwBVUdJ9.js} +94 -94
- package/dist/assets/directive-bitflow/{index-CjscG0z6.js → index-BydYlLy4.js} +73 -73
- package/dist/assets/directive-bitflow/{index-BpG316Ls.js → index-C7RJxxAx.js} +63 -63
- package/dist/assets/directive-bitflow/{index-eN2S_MLj.js → index-CERSJ9uS.js} +70 -70
- package/dist/assets/directive-bitflow/{index-DtsDy2By.js → index-CLHtOGrW.js} +11 -11
- package/dist/assets/directive-bitflow/{index-Bf_FQRbK.js → index-CWe2GjBK.js} +14 -14
- package/dist/assets/directive-bitflow/{index-CzdZQibq.js → index-CfKpkSVC.js} +72 -72
- package/dist/assets/directive-bitflow/{index-Fr7yl4Vn.js → index-CjKhq7gY.js} +23 -23
- package/dist/assets/directive-bitflow/{index-DoKlIgCD.js → index-Cm4w1Zyc.js} +38 -38
- package/dist/assets/directive-bitflow/{index-D5yZNeIg.js → index-D0U3nepG.js} +52 -52
- package/dist/assets/directive-bitflow/{index-C5czXkRd.js → index-D4PdXMcj.js} +33 -33
- package/dist/assets/directive-bitflow/{index-BLcJNyog.js → index-D9LOuqr2.js} +99 -99
- package/dist/assets/directive-bitflow/{index-BIJ7VfD2.js → index-DIb3CXwC.js} +42 -42
- package/dist/assets/directive-bitflow/{index-CZyaFdD2.js → index-DQP0cUsP.js} +70 -70
- package/dist/assets/directive-bitflow/{index-ChgzyMHe.js → index-DUOrQfVe.js} +27 -27
- package/dist/assets/directive-bitflow/{index-kRpwcprB.js → index-DW3cUBvZ.js} +1 -1
- package/dist/assets/directive-bitflow/{index-C_ZTSeqv.js → index-DYWo0PUv.js} +24 -24
- package/dist/assets/directive-bitflow/{index-xapm2BQE.js → index-D_QhyFcx.js} +101 -91
- package/dist/assets/directive-bitflow/{index-BdBBCZSy.js → index-Dn5hHVuT.js} +226 -193
- package/dist/assets/directive-bitflow/{index-D7m-hJZ9.js → index-DruC5d43.js} +69 -69
- package/dist/assets/directive-bitflow/{index-e_8twLaN.js → index-EKIgFddO.js} +105 -105
- package/dist/assets/directive-bitflow/{index-8jTO-NJA.js → index-HXNGIC7K.js} +70 -70
- package/dist/assets/directive-bitflow/{index-DnVYIuen.js → index-ISbOe239.js} +42 -42
- package/dist/assets/directive-bitflow/{index-cnRM_JDB.js → index-IsMJtrUT.js} +31 -31
- package/dist/assets/directive-bitflow/{index-B7Z6Q-PQ.js → index-TUXuIR22.js} +6 -6
- package/dist/assets/directive-bitflow/{index-CK1UMcfT.js → index-WbE9UOFa.js} +24 -24
- package/dist/assets/directive-bitflow/{index-YPMWh-1B.js → index-d5ebPDeY.js} +13 -13
- package/dist/assets/directive-bitflow/{index-NyNuXp4C.js → index-ledofrbo.js} +33 -33
- package/dist/assets/directive-bitflow/{index-BseSaQlX.js → index-oNmOArKu.js} +1 -1
- package/dist/assets/directive-bitflow/{index-ivI25bnR.js → index-rp4UTV85.js} +84 -84
- package/dist/assets/directive-bitflow/{index-XxGfBwJe.js → index-xTX3CXJW.js} +23 -23
- 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-vjEU4OvA.js} +2 -2
- package/dist/index.js +6351 -3340
- package/dist/schemas/hyperbook.schema.json +4 -4
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { L as
|
|
2
|
-
import {
|
|
3
|
-
const je = '.bitflow-parsons{display:flex;flex-direction:column;gap:var(--bitflow-space-
|
|
1
|
+
import { L as D, a4 as ee, ac as ue, ad as te, a5 as fe, a9 as B, a2 as M, a as y, j as i, P as ne, b as P, aa as pe, s as me } from "./dom-uYx_3K1r.js";
|
|
2
|
+
import { e as Z, C as he, g as W, P as be, M as ge, F as V, B as we, q as ve, y as xe, U as ye, H as ke } from "./bitLoaders-CxvZkGrY.js";
|
|
3
|
+
const je = '.bitflow-parsons{display:flex;flex-direction:column;gap:var(--bitflow-space-small)}.bitflow-parsons-columns{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(260px,100%),1fr));gap:var(--bitflow-space-small)}.bitflow-parsons-list{display:flex;flex-direction:column;gap:var(--bitflow-space-xxsmall);padding:0;margin:var(--bitflow-space-xxsmall) 0 0;list-style:none}.bitflow-parsons-columns>*>.bitflow-text-muted{display:flex;align-items:center;justify-content:center;min-height:6rem;margin-top:var(--bitflow-space-xxsmall);padding:var(--bitflow-space-small);text-align:center;border:var(--bitflow-border-width) dashed var(--bitflow-color-border);border-radius:var(--bitflow-radius-standard)}.bitflow-parsons-line{display:flex;gap:var(--bitflow-space-xsmall);align-items:center;margin-inline-start:var(--bitflow-parsons-indent, 0rem);width:calc(100% - var(--bitflow-parsons-indent, 0rem));padding:var(--bitflow-space-xxsmall) var(--bitflow-space-xsmall);font:inherit;color:var(--bitflow-color-text);text-align:left;cursor:grab;background:var(--bitflow-color-surface);border:var(--bitflow-border-width) solid var(--bitflow-color-border);border-radius:var(--bitflow-radius-standard);touch-action:manipulation}.bitflow-parsons-line:disabled{cursor:default}.bitflow-parsons-grip{flex:none;align-self:stretch;display:flex;align-items:center;justify-content:center;width:2rem;margin-block:calc(-1 * var(--bitflow-space-xxsmall));margin-inline-start:calc(-1 * var(--bitflow-space-xsmall));touch-action:none;cursor:grab}.bitflow-parsons-grip:before{content:"";width:12px;height:18px;background:radial-gradient(circle,var(--bitflow-color-neutral-400) 1.5px,transparent 2px) 0 0 / 6px 6px}.bitflow-parsons-line code{flex:1;min-width:0;font-family:var(--bitflow-font-family-mono);font-size:var(--bitflow-font-size-small);white-space:pre-wrap;overflow-wrap:anywhere;padding-inline-start:2ch;text-indent:-2ch}.bitflow-parsons-number{flex:none;width:1.5rem;font-size:var(--bitflow-font-size-small);font-variant-numeric:tabular-nums;color:var(--bitflow-color-text-muted);text-align:right}.bitflow-parsons-line.bitflow-parsons-line-correct{background:color-mix(in srgb,var(--bitflow-color-correct) 12%,var(--bitflow-color-surface));border-color:var(--bitflow-color-correct)}.bitflow-parsons-line.bitflow-parsons-line-wrong{background:color-mix(in srgb,var(--bitflow-color-wrong) 12%,var(--bitflow-color-surface));border-color:var(--bitflow-color-wrong)}.bitflow-parsons-line.bitflow-parsons-line-stray{background:var(--bitflow-color-neutral-100);border-style:dashed;border-color:var(--bitflow-color-wrong)}.bitflow-parsons-line.bitflow-parsons-line-gap{background:var(--bitflow-color-neutral-100);border-style:dashed;border-color:var(--bitflow-color-primary)}.bitflow-parsons-lifted{position:fixed;top:0;left:0;z-index:10;cursor:grabbing;pointer-events:none;box-shadow:var(--bitflow-shadow-medium)}.bitflow-parsons-lifted.bitflow-parsons-lifted-out{opacity:.55;border-style:dashed}.bitflow-parsons-read{margin:0;padding:var(--bitflow-space-xsmall);list-style:none;background:var(--bitflow-color-surface);border:1px solid var(--bitflow-color-border);border-radius:var(--bitflow-radius-standard);overflow-x:auto}.bitflow-parsons-read-line{display:flex;align-items:baseline;gap:var(--bitflow-space-xsmall)}.bitflow-parsons-read-line code{font-family:var(--bitflow-font-family-mono);font-size:var(--bitflow-font-size-small);white-space:pre}.bitflow-parsons-read-level{flex:none;min-width:var(--bitflow-parsons-level-width, 4.5rem);font-size:var(--bitflow-font-size-small);font-variant-numeric:tabular-nums;color:var(--bitflow-color-text-muted);-webkit-user-select:none;user-select:none}.bitflow-parsons-structogram .bitflow-parsons-line code{font-family:var(--bitflow-font-family);font-size:var(--bitflow-font-size-standard)}.bitflow-parsons-structogram .bitflow-parsons-program{gap:0}.bitflow-parsons-structogram .bitflow-parsons-program .bitflow-parsons-line{margin-inline-start:0;width:100%;border-radius:0;margin-top:calc(-1 * var(--bitflow-border-width));padding-inline-start:calc(var(--bitflow-parsons-indent, 0rem) + var(--bitflow-space-xsmall));background-image:repeating-linear-gradient(to right,var(--bitflow-color-neutral-200) 0 calc(1.5rem - 2px),var(--bitflow-color-neutral-700) calc(1.5rem - 2px) 1.5rem);background-size:var(--bitflow-parsons-indent, 0rem) 100%;background-repeat:no-repeat}.bitflow-parsons-structogram .bitflow-parsons-program li:first-child .bitflow-parsons-line{margin-top:0;border-start-start-radius:var(--bitflow-radius-standard);border-start-end-radius:var(--bitflow-radius-standard)}.bitflow-parsons-structogram .bitflow-parsons-program li:last-child .bitflow-parsons-line{border-end-start-radius:var(--bitflow-radius-standard);border-end-end-radius:var(--bitflow-radius-standard)}.bitflow-parsons-row{display:flex;align-items:stretch;gap:var(--bitflow-space-xxsmall)}.bitflow-parsons-row>.bitflow-parsons-line{flex:1;min-width:0}.bitflow-parsons-actions{display:none;flex:none;grid-template-rows:1fr 1fr;grid-auto-flow:column;gap:2px}@media(pointer:coarse){.bitflow-parsons-actions{display:grid}}.bitflow-parsons-action{min-width:2rem;min-height:1.5rem;padding:0;font:inherit;font-size:var(--bitflow-font-size-small);color:var(--bitflow-color-text);background:var(--bitflow-color-surface);border:1px solid var(--bitflow-color-border);border-radius:var(--bitflow-radius-small);cursor:pointer}.bitflow-parsons-action:disabled{opacity:.4;cursor:default}.bitflow-parsons-structogram .bitflow-parsons-program .bitflow-parsons-line-branch{position:relative;padding-bottom:1.25em;background-image:linear-gradient(to top right,transparent calc(50% - 1px),var(--bitflow-color-neutral-700) 50%,transparent calc(50% + 1px)),linear-gradient(to top left,transparent calc(50% - 1px),var(--bitflow-color-neutral-700) 50%,transparent calc(50% + 1px)),repeating-linear-gradient(to right,var(--bitflow-color-neutral-200) 0 calc(1.5rem - 2px),var(--bitflow-color-neutral-700) calc(1.5rem - 2px) 1.5rem);background-size:calc((100% - var(--bitflow-parsons-indent, 0rem)) / 2) 100%,calc((100% - var(--bitflow-parsons-indent, 0rem)) / 2) 100%,var(--bitflow-parsons-indent, 0rem) 100%;background-position:var(--bitflow-parsons-indent, 0rem) 0,100% 0,0 0;background-repeat:no-repeat}.bitflow-parsons-structogram .bitflow-parsons-line-branch code{text-align:center}.bitflow-parsons-cases{position:absolute;inset-inline:calc(var(--bitflow-parsons-indent, 0rem) + var(--bitflow-space-xsmall)) var(--bitflow-space-xsmall);bottom:2px;display:flex;justify-content:space-between;font-size:var(--bitflow-font-size-small);color:var(--bitflow-color-text-muted);pointer-events:none}.bitflow-parsons-structogram .bitflow-parsons-program .bitflow-parsons-line-else code{font-style:italic;color:var(--bitflow-color-text-muted)}.bitflow-parsons-structogram .bitflow-parsons-program .bitflow-parsons-line-else{border-top-style:double;border-top-width:4px}', ae = (e) => e.lines.filter((n) => !n.distractor), ze = (e, n) => {
|
|
4
4
|
const l = ae(e), r = (a) => e.lines.find((c) => c.id === a)?.distractor === !0;
|
|
5
5
|
return n.map((a, c) => {
|
|
6
6
|
const s = l[c], m = s !== void 0 && s.id === a.lineId;
|
|
@@ -11,7 +11,7 @@ const je = '.bitflow-parsons{display:flex;flex-direction:column;gap:var(--bitflo
|
|
|
11
11
|
distractor: r(a.lineId)
|
|
12
12
|
};
|
|
13
13
|
});
|
|
14
|
-
},
|
|
14
|
+
}, Ie = ({
|
|
15
15
|
data: e,
|
|
16
16
|
answer: n
|
|
17
17
|
}) => {
|
|
@@ -89,7 +89,7 @@ const je = '.bitflow-parsons{display:flex;flex-direction:column;gap:var(--bitflo
|
|
|
89
89
|
lineStray: "gehört nicht ins Programm",
|
|
90
90
|
usedDistractors: "{count} Zeile(n) verwendet, die nicht dazugehören."
|
|
91
91
|
}
|
|
92
|
-
},
|
|
92
|
+
}, Le = D({
|
|
93
93
|
/** Stable across edits, so an answer keeps pointing at the same line. */
|
|
94
94
|
id: M().min(1),
|
|
95
95
|
text: M().default(""),
|
|
@@ -104,7 +104,7 @@ const je = '.bitflow-parsons{display:flex;flex-direction:column;gap:var(--bitflo
|
|
|
104
104
|
* to decide what is not part of the answer.
|
|
105
105
|
*/
|
|
106
106
|
distractor: B().default(!1)
|
|
107
|
-
}), Se =
|
|
107
|
+
}), Se = D({
|
|
108
108
|
instruction: M().default(""),
|
|
109
109
|
/**
|
|
110
110
|
* Recorded so the code can be shown as what it is. Nothing highlights it:
|
|
@@ -113,7 +113,7 @@ const je = '.bitflow-parsons{display:flex;flex-direction:column;gap:var(--bitflo
|
|
|
113
113
|
*/
|
|
114
114
|
language: M().default(""),
|
|
115
115
|
/** The solution lines in order, with the distractors mixed among them. */
|
|
116
|
-
lines: ee(
|
|
116
|
+
lines: ee(Le).default([]),
|
|
117
117
|
/**
|
|
118
118
|
* Whether indentation is part of the answer. Off, the learner is asked
|
|
119
119
|
* only for the order and indentation is shown but not adjustable.
|
|
@@ -163,10 +163,10 @@ const je = '.bitflow-parsons{display:flex;flex-direction:column;gap:var(--bitflo
|
|
|
163
163
|
path: ["indentationMatters"],
|
|
164
164
|
message: "Every line is at the same indentation, so asking for indentation adds nothing. Indent the nested lines, or switch it off."
|
|
165
165
|
});
|
|
166
|
-
}), Me =
|
|
166
|
+
}), Me = D({
|
|
167
167
|
lineId: M().min(1),
|
|
168
168
|
indent: ne().int().min(0).default(0)
|
|
169
|
-
}), Ge =
|
|
169
|
+
}), Ge = D({
|
|
170
170
|
/** The lines the learner has put in the program, in order. */
|
|
171
171
|
lines: ee(Me).default([])
|
|
172
172
|
}), Ne = {
|
|
@@ -236,7 +236,7 @@ const je = '.bitflow-parsons{display:flex;flex-direction:column;gap:var(--bitflo
|
|
|
236
236
|
readonly: a,
|
|
237
237
|
onChange: c
|
|
238
238
|
}) => {
|
|
239
|
-
const s = (t, o) =>
|
|
239
|
+
const s = (t, o) => P($, t, r, o), [m, h] = y.useState(""), g = y.useRef(null), d = y.useRef(null), p = y.useRef(null), w = y.useRef(null), S = y.useRef(!1), [, E] = y.useReducer((t) => t + 1, 0), b = w.current, j = b?.moved ? b.order : n, R = (t) => e.lines.find((o) => o.id === t), z = (t) => R(t)?.text ?? t, re = new Set(j.map((t) => t.lineId)), A = e.lines.filter((t) => !re.has(t.id)), oe = (t) => {
|
|
240
240
|
if (a || S.current) {
|
|
241
241
|
S.current = !1;
|
|
242
242
|
return;
|
|
@@ -268,7 +268,7 @@ const je = '.bitflow-parsons{display:flex;flex-direction:column;gap:var(--bitflo
|
|
|
268
268
|
s("indentedTo", { code: z(u.lineId), indent: f })
|
|
269
269
|
));
|
|
270
270
|
}, se = () => J * parseFloat(getComputedStyle(document.documentElement).fontSize || "16"), F = (t, o, u) => {
|
|
271
|
-
if (a || t.button !== 0 || Te(t.pointerType) && !
|
|
271
|
+
if (a || t.button !== 0 || Te(t.pointerType) && !Pe(t.target)) return;
|
|
272
272
|
const f = t.currentTarget.getBoundingClientRect();
|
|
273
273
|
w.current = {
|
|
274
274
|
lineId: o,
|
|
@@ -284,7 +284,7 @@ const je = '.bitflow-parsons{display:flex;flex-direction:column;gap:var(--bitflo
|
|
|
284
284
|
order: n,
|
|
285
285
|
overBank: u,
|
|
286
286
|
moved: !1
|
|
287
|
-
},
|
|
287
|
+
}, E();
|
|
288
288
|
}, U = (t) => {
|
|
289
289
|
const o = w.current;
|
|
290
290
|
if (!o) return;
|
|
@@ -296,16 +296,16 @@ const je = '.bitflow-parsons{display:flex;flex-direction:column;gap:var(--bitflo
|
|
|
296
296
|
const v = [...d.current?.querySelectorAll("li") ?? []].filter(
|
|
297
297
|
(k) => k.querySelector(".bitflow-parsons-line")?.getAttribute("data-line") !== o.lineId
|
|
298
298
|
);
|
|
299
|
-
let
|
|
299
|
+
let I = v.length;
|
|
300
300
|
for (let k = 0; k < v.length; k++) {
|
|
301
301
|
const G = v[k].getBoundingClientRect();
|
|
302
302
|
if (t.clientY < G.top + G.height / 2) {
|
|
303
|
-
|
|
303
|
+
I = k;
|
|
304
304
|
break;
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
const
|
|
308
|
-
x = [...f], x.splice(
|
|
307
|
+
const L = t.clientX - o.grabX, H = (p.current ?? d.current)?.getBoundingClientRect(), ce = e.indentationMatters ? Math.max(0, Math.round((L - (H?.left ?? 0)) / se())) : o.order.find((k) => k.lineId === o.lineId)?.indent ?? 0;
|
|
308
|
+
x = [...f], x.splice(I, 0, { lineId: o.lineId, indent: ce });
|
|
309
309
|
}
|
|
310
310
|
w.current = {
|
|
311
311
|
...o,
|
|
@@ -317,11 +317,11 @@ const je = '.bitflow-parsons{display:flex;flex-direction:column;gap:var(--bitflo
|
|
|
317
317
|
// slow drag moves a pixel at a time and would otherwise never count as
|
|
318
318
|
// a drag at all — it would end as a click and take the line out.
|
|
319
319
|
moved: o.moved || Math.abs(t.clientX - o.fromX) > 3 || Math.abs(t.clientY - o.fromY) > 3
|
|
320
|
-
}, w.current.moved && q.follow(d.current, t.clientX, t.clientY),
|
|
320
|
+
}, w.current.moved && q.follow(d.current, t.clientX, t.clientY), E();
|
|
321
321
|
}, le = () => {
|
|
322
322
|
q.stop();
|
|
323
323
|
const t = w.current;
|
|
324
|
-
if (w.current = null,
|
|
324
|
+
if (w.current = null, E(), !t || !t.moved) return;
|
|
325
325
|
S.current = !0;
|
|
326
326
|
const o = JSON.stringify(n);
|
|
327
327
|
if (JSON.stringify(t.order) === o) return;
|
|
@@ -376,8 +376,8 @@ const je = '.bitflow-parsons{display:flex;flex-direction:column;gap:var(--bitflo
|
|
|
376
376
|
j.length === 0 ? /* @__PURE__ */ i.jsx("p", { className: "bitflow-text-muted", children: s("programEmpty") }) : /* @__PURE__ */ i.jsx("ol", { ref: p, className: "bitflow-parsons-list bitflow-parsons-program", children: j.map((t, o) => {
|
|
377
377
|
const u = R(t.lineId);
|
|
378
378
|
if (!u) return null;
|
|
379
|
-
const f = l?.[o], x = b?.moved === !0 && b.lineId === t.lineId, v = ["bitflow-parsons-line"],
|
|
380
|
-
return
|
|
379
|
+
const f = l?.[o], x = b?.moved === !0 && b.lineId === t.lineId, v = ["bitflow-parsons-line"], I = e.display === "structogram" ? Re(j, o, R) : void 0;
|
|
380
|
+
return I && v.push(`bitflow-parsons-line-${I}`), x && v.push("bitflow-parsons-line-gap"), f && v.push(
|
|
381
381
|
f.distractor ? "bitflow-parsons-line-stray" : f.placed && f.indented !== !1 ? "bitflow-parsons-line-correct" : "bitflow-parsons-line-wrong"
|
|
382
382
|
), /* Keyed by the line, not by where it sits: a line keeps its
|
|
383
383
|
element as the program is rearranged, so the browser keeps
|
|
@@ -400,16 +400,16 @@ const je = '.bitflow-parsons{display:flex;flex-direction:column;gap:var(--bitflo
|
|
|
400
400
|
total: j.length,
|
|
401
401
|
indent: t.indent
|
|
402
402
|
}),
|
|
403
|
-
onPointerDown: (
|
|
404
|
-
onKeyDown: (
|
|
403
|
+
onPointerDown: (L) => F(L, t.lineId, !1),
|
|
404
|
+
onKeyDown: (L) => {
|
|
405
405
|
const H = {
|
|
406
406
|
ArrowUp: () => N(o, -1),
|
|
407
407
|
ArrowDown: () => N(o, 1),
|
|
408
408
|
ArrowLeft: () => C(o, -1),
|
|
409
409
|
ArrowRight: () => C(o, 1),
|
|
410
410
|
Backspace: () => O(o)
|
|
411
|
-
}[
|
|
412
|
-
H && (
|
|
411
|
+
}[L.key];
|
|
412
|
+
H && (L.preventDefault(), H());
|
|
413
413
|
},
|
|
414
414
|
onClick: () => O(o),
|
|
415
415
|
children: [
|
|
@@ -424,7 +424,7 @@ const je = '.bitflow-parsons{display:flex;flex-direction:column;gap:var(--bitflo
|
|
|
424
424
|
}
|
|
425
425
|
),
|
|
426
426
|
/* @__PURE__ */ i.jsx("code", { children: u.text }),
|
|
427
|
-
|
|
427
|
+
I === "branch" && /* @__PURE__ */ i.jsxs("span", { className: "bitflow-parsons-cases", "aria-hidden": "true", children: [
|
|
428
428
|
/* @__PURE__ */ i.jsx("span", { children: s("yes") }),
|
|
429
429
|
/* @__PURE__ */ i.jsx("span", { children: s("no") })
|
|
430
430
|
] })
|
|
@@ -507,12 +507,12 @@ const je = '.bitflow-parsons{display:flex;flex-direction:column;gap:var(--bitflo
|
|
|
507
507
|
]
|
|
508
508
|
}
|
|
509
509
|
);
|
|
510
|
-
}, X = () => /* @__PURE__ */ i.jsx("span", { className: "bitflow-parsons-grip", "aria-hidden": "true" }), Te = (e) => e === "touch" || e === "pen",
|
|
510
|
+
}, X = () => /* @__PURE__ */ i.jsx("span", { className: "bitflow-parsons-grip", "aria-hidden": "true" }), Te = (e) => e === "touch" || e === "pen", Pe = (e) => e instanceof Element && e.closest(".bitflow-parsons-grip") !== null, De = /^\s*(wenn|falls|if)\b/i, Ee = /^\s*(sonst|else)\b/i, Re = (e, n, l) => {
|
|
511
511
|
const r = l(e[n].lineId)?.text ?? "";
|
|
512
|
-
if (
|
|
512
|
+
if (Ee.test(r)) return "else";
|
|
513
513
|
const a = e[n + 1];
|
|
514
514
|
if (!(!a || a.indent <= e[n].indent))
|
|
515
|
-
return
|
|
515
|
+
return De.test(r) ? "branch" : "loop";
|
|
516
516
|
}, Ae = (e, n) => {
|
|
517
517
|
const l = Xe(We(n)), r = [...e];
|
|
518
518
|
for (let a = r.length - 1; a > 0; a--) {
|
|
@@ -601,7 +601,7 @@ const je = '.bitflow-parsons{display:flex;flex-direction:column;gap:var(--bitflo
|
|
|
601
601
|
onChange: l,
|
|
602
602
|
errors: r
|
|
603
603
|
}) => {
|
|
604
|
-
const a = (d, p) =>
|
|
604
|
+
const a = (d, p) => P(Ne, d, n, p), c = (d) => l({ ...e, ...d }), [s, m] = y.useState(() => ({
|
|
605
605
|
program: T(Y(e.lines)),
|
|
606
606
|
distractors: T(K(e.lines))
|
|
607
607
|
}));
|
|
@@ -714,12 +714,12 @@ pe({
|
|
|
714
714
|
type: ie,
|
|
715
715
|
kind: "task",
|
|
716
716
|
schema: Se,
|
|
717
|
-
evaluate:
|
|
717
|
+
evaluate: Ie,
|
|
718
718
|
Task: Oe,
|
|
719
719
|
Form: Fe,
|
|
720
720
|
info: (e) => ({
|
|
721
|
-
name:
|
|
722
|
-
description:
|
|
721
|
+
name: P($, "name", e),
|
|
722
|
+
description: P($, "description", e)
|
|
723
723
|
}),
|
|
724
724
|
defaultData: () => ({
|
|
725
725
|
instruction: "",
|
|
@@ -737,12 +737,12 @@ export {
|
|
|
737
737
|
Ge as AnswerSchema,
|
|
738
738
|
Se as DataSchema,
|
|
739
739
|
Fe as Form,
|
|
740
|
-
|
|
740
|
+
Le as LineSchema,
|
|
741
741
|
Me as PlacedLineSchema,
|
|
742
742
|
He as Puzzle,
|
|
743
743
|
ie as TYPE,
|
|
744
744
|
Oe as Task,
|
|
745
|
-
|
|
745
|
+
Ie as evaluate,
|
|
746
746
|
Ne as formMessages,
|
|
747
747
|
$ as messages,
|
|
748
748
|
ze as outcomes,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { L as h, a9 as k, a2 as m, j as n, b as r, w as p, s as b, aa as w } from "./dom-uYx_3K1r.js";
|
|
2
|
-
import {
|
|
2
|
+
import { C as g, e as f, F as v, U as L, H as N } from "./bitLoaders-CxvZkGrY.js";
|
|
3
3
|
const B = ".bitflow-outline{border:var(--bitflow-border-width) solid var(--bitflow-color-border);border-radius:var(--bitflow-radius-standard);padding:var(--bitflow-space-small)}.bitflow-outline-list{margin:var(--bitflow-space-xsmall) 0 0;padding-inline-start:var(--bitflow-space-medium);color:var(--bitflow-color-text-muted)}", H = {
|
|
4
4
|
en: {
|
|
5
5
|
titleLabel: "Title",
|
|
@@ -132,7 +132,7 @@ const B = ".bitflow-outline{border:var(--bitflow-border-width) solid var(--bitfl
|
|
|
132
132
|
timeLimit: t.meta.timeLimit,
|
|
133
133
|
canGoBack: t.meta.navigation !== "linear"
|
|
134
134
|
};
|
|
135
|
-
},
|
|
135
|
+
}, O = ({ data: t, flow: o, locale: a }) => {
|
|
136
136
|
const i = (u, s) => r(d, u, a, s), e = t.showOutline ? x(o) : void 0;
|
|
137
137
|
return /* @__PURE__ */ n.jsxs("div", { className: "bitflow-stack", children: [
|
|
138
138
|
t.title && /* @__PURE__ */ n.jsx("h1", { className: "bitflow-heading", children: t.title }),
|
|
@@ -153,7 +153,7 @@ const B = ".bitflow-outline{border:var(--bitflow-border-width) solid var(--bitfl
|
|
|
153
153
|
] })
|
|
154
154
|
] })
|
|
155
155
|
] });
|
|
156
|
-
},
|
|
156
|
+
}, M = ({
|
|
157
157
|
data: t,
|
|
158
158
|
locale: o,
|
|
159
159
|
onChange: a
|
|
@@ -195,8 +195,8 @@ w({
|
|
|
195
195
|
type: c,
|
|
196
196
|
kind: "start",
|
|
197
197
|
schema: j,
|
|
198
|
-
Task:
|
|
199
|
-
Form:
|
|
198
|
+
Task: O,
|
|
199
|
+
Form: M,
|
|
200
200
|
info: (t) => ({
|
|
201
201
|
name: r(d, "name", t),
|
|
202
202
|
description: r(d, "description", t)
|
|
@@ -206,9 +206,9 @@ w({
|
|
|
206
206
|
N(c);
|
|
207
207
|
export {
|
|
208
208
|
j as DataSchema,
|
|
209
|
-
|
|
209
|
+
M as Form,
|
|
210
210
|
c as TYPE,
|
|
211
|
-
|
|
211
|
+
O as Task,
|
|
212
212
|
H as formMessages,
|
|
213
213
|
d as messages,
|
|
214
214
|
x as outlineOf
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { L as
|
|
2
|
-
import { ag as Me, ah as ye, ai as Ne, aj as
|
|
3
|
-
import {
|
|
1
|
+
import { L as j, a2 as w, ac as $, ad as Z, a4 as F, ab as B, a9 as _, P as R, ae as x, j as o, a as T, a5 as S, af as U, b as L, s as K, aa as Y } from "./dom-uYx_3K1r.js";
|
|
2
|
+
import { ag as Me, ah as ye, ai as Ne, aj as Ce } from "./dom-uYx_3K1r.js";
|
|
3
|
+
import { e as N, C as V, g as f, M as A, P as Q, F as X, B as J, U as ee, r as te, H as ae } from "./bitLoaders-CxvZkGrY.js";
|
|
4
4
|
const ne = S([
|
|
5
5
|
/** The same number, up to floating-point noise. */
|
|
6
6
|
"exact",
|
|
@@ -19,7 +19,7 @@ const ne = S([
|
|
|
19
19
|
"shown",
|
|
20
20
|
/** The learner has to supply it, and it has to be right. */
|
|
21
21
|
"required"
|
|
22
|
-
]), re = S(["value", "valueAndUnit"]), oe = S(["point", "comma", "both"]), se =
|
|
22
|
+
]), re = S(["value", "valueAndUnit"]), oe = S(["point", "comma", "both"]), se = j({
|
|
23
23
|
instruction: w().default(""),
|
|
24
24
|
/**
|
|
25
25
|
* What the answer should come to, written as a number or an expression.
|
|
@@ -31,14 +31,14 @@ const ne = S([
|
|
|
31
31
|
expected: w().default(""),
|
|
32
32
|
tolerance: ne.default("exact"),
|
|
33
33
|
/** The ± for `absolute`, or the percentage for `percent`. */
|
|
34
|
-
toleranceValue:
|
|
34
|
+
toleranceValue: R().min(0).default(0),
|
|
35
35
|
/** Places for `decimals`, figures for `significant`. */
|
|
36
|
-
digits:
|
|
36
|
+
digits: R().int().min(0).max(10).default(2),
|
|
37
37
|
unitMode: ie.default("none"),
|
|
38
38
|
/** The unit as the author writes it, e.g. `m/s^2`. */
|
|
39
39
|
unit: w().default(""),
|
|
40
40
|
/** Other spellings that count, one per line in the form. */
|
|
41
|
-
unitAlternatives:
|
|
41
|
+
unitAlternatives: F(w()).default([]),
|
|
42
42
|
scoring: re.default("value"),
|
|
43
43
|
decimalSeparator: oe.default("both"),
|
|
44
44
|
/**
|
|
@@ -53,13 +53,13 @@ const ne = S([
|
|
|
53
53
|
* the right answer, so `9.8` catches `9.81` when the tolerance says it
|
|
54
54
|
* should.
|
|
55
55
|
*/
|
|
56
|
-
valueFeedback:
|
|
57
|
-
|
|
56
|
+
valueFeedback: F(
|
|
57
|
+
j({
|
|
58
58
|
value: w().default(""),
|
|
59
59
|
feedback: B
|
|
60
60
|
})
|
|
61
61
|
).default([]),
|
|
62
|
-
evaluation:
|
|
62
|
+
evaluation: $.default(Z)
|
|
63
63
|
}).check((e) => {
|
|
64
64
|
const t = e.value;
|
|
65
65
|
if (t.evaluation.mode !== "auto") return;
|
|
@@ -110,7 +110,7 @@ const ne = S([
|
|
|
110
110
|
message: "This is not a number the task can compare against."
|
|
111
111
|
});
|
|
112
112
|
});
|
|
113
|
-
}), Ae =
|
|
113
|
+
}), Ae = j({
|
|
114
114
|
/**
|
|
115
115
|
* Exactly what the learner typed.
|
|
116
116
|
*
|
|
@@ -122,11 +122,11 @@ const ne = S([
|
|
|
122
122
|
* report and a reviewer read.
|
|
123
123
|
*/
|
|
124
124
|
input: w().default("")
|
|
125
|
-
}), le = (e) => [e.unit, ...e.unitAlternatives].map((t) => t.trim()).filter((t) => t !== ""),
|
|
125
|
+
}), le = (e) => [e.unit, ...e.unitAlternatives].map((t) => t.trim()).filter((t) => t !== ""), C = (e, t, i = 1e-9) => {
|
|
126
126
|
if (e === t) return !0;
|
|
127
127
|
const n = Math.max(Math.abs(e), Math.abs(t));
|
|
128
128
|
return Math.abs(e - t) <= i * Math.max(1, n);
|
|
129
|
-
},
|
|
129
|
+
}, H = (e, t) => !Number.isFinite(e) || Math.abs(e) >= 1e21 ? e : Number(e.toFixed(Math.min(10, Math.max(0, t)))), P = (e, t) => !Number.isFinite(e) || e === 0 ? e : Number(e.toPrecision(Math.min(21, Math.max(1, t)))), W = (e, t, i) => {
|
|
130
130
|
switch (i.tolerance) {
|
|
131
131
|
case "absolute":
|
|
132
132
|
return Math.abs(e - t) <= i.toleranceValue + Number.EPSILON;
|
|
@@ -135,17 +135,17 @@ const ne = S([
|
|
|
135
135
|
return Math.abs(e - t) <= n + Number.EPSILON;
|
|
136
136
|
}
|
|
137
137
|
case "decimals":
|
|
138
|
-
return
|
|
139
|
-
P(e, i.digits),
|
|
140
|
-
P(t, i.digits)
|
|
141
|
-
);
|
|
142
|
-
case "significant":
|
|
143
|
-
return j(
|
|
138
|
+
return C(
|
|
144
139
|
H(e, i.digits),
|
|
145
140
|
H(t, i.digits)
|
|
146
141
|
);
|
|
142
|
+
case "significant":
|
|
143
|
+
return C(
|
|
144
|
+
P(e, i.digits),
|
|
145
|
+
P(t, i.digits)
|
|
146
|
+
);
|
|
147
147
|
default:
|
|
148
|
-
return
|
|
148
|
+
return C(e, t);
|
|
149
149
|
}
|
|
150
150
|
}, ce = (e, t) => {
|
|
151
151
|
switch (t.tolerance) {
|
|
@@ -186,7 +186,7 @@ const ne = S([
|
|
|
186
186
|
expected: n.ok ? n.value : void 0
|
|
187
187
|
};
|
|
188
188
|
}, ue = (e, t) => {
|
|
189
|
-
const i = le(e).map(
|
|
189
|
+
const i = le(e).map(U), n = U(t);
|
|
190
190
|
return e.unitMode === "none" ? n === "" : n === "" ? e.unitMode === "shown" : i.includes(n);
|
|
191
191
|
}, de = ({
|
|
192
192
|
data: e,
|
|
@@ -399,7 +399,7 @@ const ne = S([
|
|
|
399
399
|
readonly: a,
|
|
400
400
|
onChange: s
|
|
401
401
|
}) => {
|
|
402
|
-
const l = (g,
|
|
402
|
+
const l = (g, I) => L(D, g, n, I), u = T.useId(), m = `${u}-unit`, b = `${u}-hint`, p = G(e, t.input), r = pe(p, t.input, n, l), c = ge(e, l), E = e.unitMode === "shown" && e.unit.trim() !== "", h = T.useRef(null), M = !e.allowExpression && !a, y = () => {
|
|
403
403
|
const g = t.input;
|
|
404
404
|
s({ input: g.startsWith("-") ? g.slice(1) : `-${g}` }), h.current?.focus();
|
|
405
405
|
}, d = i, z = d === void 0 ? void 0 : d.valueCorrect && !d.unitCorrect ? d.unit === "" ? l("outcomeUnitMissing") : l("outcomeUnitWrong") : !d.valueCorrect && d.unitCorrect && d.unit !== "" ? l("outcomeValueWrong") : void 0;
|
|
@@ -529,7 +529,7 @@ const ne = S([
|
|
|
529
529
|
}
|
|
530
530
|
),
|
|
531
531
|
/* @__PURE__ */ o.jsx(
|
|
532
|
-
|
|
532
|
+
V,
|
|
533
533
|
{
|
|
534
534
|
label: a("expectedLabel"),
|
|
535
535
|
hint: a("expectedHint"),
|
|
@@ -584,7 +584,7 @@ const ne = S([
|
|
|
584
584
|
),
|
|
585
585
|
e.unitMode !== "none" && /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
586
586
|
/* @__PURE__ */ o.jsx(
|
|
587
|
-
|
|
587
|
+
V,
|
|
588
588
|
{
|
|
589
589
|
label: a("unitLabel"),
|
|
590
590
|
hint: a("unitHint"),
|
|
@@ -733,16 +733,16 @@ export {
|
|
|
733
733
|
ie as UnitModeSchema,
|
|
734
734
|
ce as acceptedRange,
|
|
735
735
|
le as acceptedUnits,
|
|
736
|
-
|
|
736
|
+
U as canonicalUnit,
|
|
737
737
|
de as evaluate,
|
|
738
738
|
me as formMessages,
|
|
739
739
|
v as formatValue,
|
|
740
740
|
D as messages,
|
|
741
|
-
|
|
741
|
+
Ce as parseExpression,
|
|
742
742
|
x as parseQuantity,
|
|
743
743
|
G as read,
|
|
744
|
-
|
|
745
|
-
|
|
744
|
+
H as roundToDecimals,
|
|
745
|
+
P as roundToSignificant,
|
|
746
746
|
ue as unitAccepted,
|
|
747
747
|
W as withinTolerance
|
|
748
748
|
};
|