@pie-element/simple-cloze 0.1.10 → 0.1.11-next.20261019143410
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/browser/author/index.js +2 -2
- package/dist/browser/controller/index.js +1 -1
- package/dist/browser/{controller-DKaHN4QB.js → controller-DjzYEYkW.js} +2 -2
- package/dist/browser/{controller-DKaHN4QB.js.map → controller-DjzYEYkW.js.map} +1 -1
- package/dist/browser/delivery/index.js +1 -1
- package/dist/browser/editor-runtime/author/index.js +2 -2
- package/dist/browser/editor-runtime/controller/index.js +1 -1
- package/dist/browser/editor-runtime/{controller-DKaHN4QB.js → controller-DjzYEYkW.js} +2 -2
- package/dist/browser/editor-runtime/{controller-DKaHN4QB.js.map → controller-DjzYEYkW.js.map} +1 -1
- package/dist/browser/editor-runtime/delivery/index.js +1 -1
- package/dist/browser/editor-runtime/print/index.js +1 -1
- package/dist/browser/print/index.js +1 -1
- package/dist/schemas/configuration.schema.json +1 -1
- package/dist/schemas/model.schema.json +1 -1
- package/dist/schemas/session.schema.json +1 -1
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as e, C as t, D as n, E as r, F as i, I as a, L as o, M as s, N as c, O as l, P as u, R as d, S as f, T as p, _ as m, a as h, c as g, d as _, f as v, g as y, h as b, i as x, j as S, k as C, l as ee, m as te, n as w, o as ne, p as re, r as ie, s as ae, t as oe, u as T, v as se, w as ce, x as E, y as D, z as le } from "../client-e4ZTphpa.js";
|
|
2
|
-
import { n as ue, u as de } from "../controller-
|
|
2
|
+
import { n as ue, u as de } from "../controller-DjzYEYkW.js";
|
|
3
3
|
//#region ../../shared/configure-events/dist/index.js
|
|
4
4
|
var fe = class e extends CustomEvent {
|
|
5
5
|
static {
|
|
@@ -17610,7 +17610,7 @@ E(["input"]), oe(IS, {
|
|
|
17610
17610
|
//#region src/author/index.ts
|
|
17611
17611
|
var LS = IS.element, RS = Object.freeze({
|
|
17612
17612
|
name: "@pie-element/simple-cloze",
|
|
17613
|
-
version: "0.1.
|
|
17613
|
+
version: "0.1.11-next.20261019143410"
|
|
17614
17614
|
});
|
|
17615
17615
|
//#endregion
|
|
17616
17616
|
export { LS as default, RS as piePackage };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "../controller-
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "../controller-DjzYEYkW.js";
|
|
2
2
|
export { c as createCorrectResponseSession, i as createDefaultModel, o as getCorrectness, n as getPartialScore, e as model, a as normalizeSession, s as outcome, t as piePackage, r as validate };
|
|
@@ -64,9 +64,9 @@ var t = {
|
|
|
64
64
|
return t?.prompt?.required && !r(e?.prompt) && (i.prompt = "This field is required."), n(e?.correctAnswer) || (i.correctAnswer = "No correct answer defined."), i;
|
|
65
65
|
}, p = Object.freeze({
|
|
66
66
|
name: "@pie-element/simple-cloze",
|
|
67
|
-
version: "0.1.
|
|
67
|
+
version: "0.1.11-next.20261019143410"
|
|
68
68
|
});
|
|
69
69
|
//#endregion
|
|
70
70
|
export { u as a, p as c, a as i, f as l, c as n, l as o, i as r, s, d as t, t as u };
|
|
71
71
|
|
|
72
|
-
//# sourceMappingURL=controller-
|
|
72
|
+
//# sourceMappingURL=controller-DjzYEYkW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller-
|
|
1
|
+
{"version":3,"file":"controller-DjzYEYkW.js","names":[],"sources":["../../src/controller/defaults.ts","../../src/controller/index.ts"],"sourcesContent":["import type { SimpleClozeConfiguration, SimpleClozeModel } from '../types.js';\n\nexport default {\n model: {\n prompt: '<p>Enter your answer:</p>',\n promptEnabled: true,\n correctAnswer: '',\n teacherInstructionsEnabled: true,\n },\n configuration: {\n prompt: {\n label: 'Prompt',\n settings: true,\n },\n teacherInstructions: {\n label: 'Teacher Instructions',\n settings: true,\n },\n settingsPanelDisabled: false,\n },\n} satisfies {\n model: Omit<SimpleClozeModel, 'id' | 'element'>;\n configuration: SimpleClozeConfiguration;\n};\n","import defaults from './defaults.js';\nimport { toPlainText } from './plain-text.js';\nimport type { SimpleClozeConfiguration, SimpleClozeModel, SimpleClozeSession } from '../types.js';\n\nexport type SimpleClozeEnv = {\n mode?: string;\n role?: string;\n [key: string]: unknown;\n};\n\nexport type SimpleClozeCorrectness = 'correct' | 'incorrect' | 'unanswered';\n\nexport type SimpleClozeOutcome = {\n score: number;\n empty: boolean;\n traceLog: string[];\n};\n\n/**\n * Both sides compare as plain text, case-insensitively: an answer key authored\n * as HTML matches the text a learner types.\n */\nconst comparable = (value: unknown): string => toPlainText(value).toLowerCase();\n\n// Strips tags except img, iframe and source (media counts as content), as\n// multiple-choice's `getContent` does.\nconst hasContent = (html: unknown): boolean =>\n typeof html === 'string' &&\n html\n .replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '')\n .replace(/ /gi, ' ')\n .trim().length > 0;\n\n/**\n * A response with no text is unanswered; an answer key with no text matches\n * nothing, so a blank key never scores.\n */\nexport const getCorrectness = (\n question: Partial<SimpleClozeModel> | null | undefined,\n session: SimpleClozeSession | null | undefined\n): SimpleClozeCorrectness => {\n const response = comparable(session?.value);\n if (!response) {\n return 'unanswered';\n }\n\n const key = comparable(question?.correctAnswer);\n if (key && response === key) {\n return 'correct';\n }\n\n return 'incorrect';\n};\n\n/** Single response, all-or-nothing: 1 when it matches the answer key, else 0. */\nexport const getPartialScore = (\n question: Partial<SimpleClozeModel> | null | undefined,\n session: SimpleClozeSession | null | undefined\n): number => (getCorrectness(question, session) === 'correct' ? 1 : 0);\n\nconst getTraceLog = (\n question: Partial<SimpleClozeModel> | null | undefined,\n correctness: SimpleClozeCorrectness,\n score: number\n): string[] => {\n const traceLog = [\n 'Response is compared with the answer key as plain text, ignoring case and extra spaces.',\n ];\n if (!comparable(question?.correctAnswer)) {\n traceLog.push('No correct answer is defined, so no response can score.');\n } else {\n traceLog.push(\n correctness === 'correct'\n ? 'Response matches the answer key.'\n : 'Response does not match the answer key.'\n );\n }\n traceLog.push(`Final score: ${score}.`);\n return traceLog;\n};\n\nexport const outcome = (\n question: Partial<SimpleClozeModel> | null | undefined,\n session: SimpleClozeSession | null | undefined,\n _env: SimpleClozeEnv = {}\n): Promise<SimpleClozeOutcome> =>\n new Promise((resolve) => {\n const correctness = getCorrectness(question, session);\n\n if (correctness === 'unanswered') {\n resolve({\n score: 0,\n empty: true,\n traceLog: ['Student did not enter a response. Score is 0.'],\n });\n return;\n }\n\n const score = correctness === 'correct' ? 1 : 0;\n resolve({ score, empty: false, traceLog: getTraceLog(question, correctness, score) });\n });\n\nexport const createDefaultModel = (\n model: Partial<SimpleClozeModel> = {}\n): Partial<SimpleClozeModel> => ({\n ...defaults.model,\n ...model,\n});\n\nexport const normalizeSession = (s: SimpleClozeSession | null | undefined): SimpleClozeSession => ({\n ...s,\n});\n\nexport const model = (\n question: Partial<SimpleClozeModel> | null | undefined,\n session: SimpleClozeSession | null | undefined,\n env: SimpleClozeEnv | null | undefined\n): Promise<Record<string, unknown>> => {\n return new Promise((resolve) => {\n const safeSession = session || {};\n const safeEnv = env || {};\n const normalizedQuestion = createDefaultModel(question || {});\n\n const out: Record<string, unknown> = {\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n disabled: safeEnv.mode !== 'gather',\n mode: safeEnv.mode,\n role: safeEnv.role,\n language: normalizedQuestion.language,\n };\n\n if (safeEnv.mode === 'evaluate') {\n out.correctness = getCorrectness(normalizedQuestion, safeSession);\n // The key is shown in the text input, so it goes out as plain text.\n out.correctAnswer = toPlainText(normalizedQuestion.correctAnswer);\n }\n\n if (safeEnv.role === 'instructor' && (safeEnv.mode === 'view' || safeEnv.mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.teacherInstructions = null;\n }\n\n resolve(out);\n });\n};\n\nexport const createCorrectResponseSession = (\n question: Partial<SimpleClozeModel> | null | undefined,\n env: SimpleClozeEnv | null | undefined\n): Promise<SimpleClozeSession | null> => {\n return new Promise((resolve) => {\n if (env?.mode !== 'evaluate' && env?.role === 'instructor') {\n // The player sets `id` and `element` on the entry from the item config.\n resolve({ id: '1', value: toPlainText(question?.correctAnswer) });\n } else {\n resolve(null);\n }\n });\n};\n\nexport const validate = (\n model: Partial<SimpleClozeModel> = {},\n config: SimpleClozeConfiguration = {}\n): Record<string, string> => {\n const errors: Record<string, string> = {};\n\n if (config?.prompt?.required && !hasContent(model?.prompt)) {\n errors.prompt = 'This field is required.';\n }\n\n if (!comparable(model?.correctAnswer)) {\n errors.correctAnswer = 'No correct answer defined.';\n }\n\n return errors;\n};\n"],"mappings":";;AAEA,IAAA,IAAe;CACb,OAAO;EACL,QAAQ;EACR,eAAe;EACf,eAAe;EACf,4BAA4B;CAC9B;CACA,eAAe;EACb,QAAQ;GACN,OAAO;GACP,UAAU;EACZ;EACA,qBAAqB;GACnB,OAAO;GACP,UAAU;EACZ;EACA,uBAAuB;CACzB;AACF,GCEM,KAAc,MAA2B,EAAY,CAAK,CAAC,CAAC,YAAY,GAIxE,KAAc,MAClB,OAAO,KAAS,YAChB,EACG,QAAQ,sCAAsC,EAAE,CAAC,CACjD,QAAQ,YAAY,GAAG,CAAC,CACxB,KAAK,CAAC,CAAC,SAAS,GAMR,KACX,GACA,MAC2B;CAC3B,IAAM,IAAW,EAAW,GAAS,KAAK;CAC1C,IAAI,CAAC,GACH,OAAO;CAGT,IAAM,IAAM,EAAW,GAAU,aAAa;CAK9C,OAJI,KAAO,MAAa,IACf,YAGF;AACT,GAGa,KACX,GACA,MACY,IAAe,GAAU,CAAO,MAAM,YAE9C,KACJ,GACA,GACA,MACa;CACb,IAAM,IAAW,CACf,yFACF;CAWA,OAVK,EAAW,GAAU,aAAa,IAGrC,EAAS,KACP,MAAgB,YACZ,qCACA,yCACN,IANA,EAAS,KAAK,yDAAyD,GAQzE,EAAS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,IAAmC,CAAC,MACT;CAC3B,IAAM,IAAiC,CAAC;CAUxC,OARI,GAAQ,QAAQ,YAAY,CAAC,EAAW,GAAO,MAAM,MACvD,EAAO,SAAS,4BAGb,EAAW,GAAO,aAAa,MAClC,EAAO,gBAAgB,+BAGlB;AACT"}
|
|
@@ -238,7 +238,7 @@ function R(e, t) {
|
|
|
238
238
|
//#region src/delivery/index.ts
|
|
239
239
|
var z = R(N, { isComplete: (e, t) => typeof t?.value == "string" && t.value.trim().length > 0 }), B = Object.freeze({
|
|
240
240
|
name: "@pie-element/simple-cloze",
|
|
241
|
-
version: "0.1.
|
|
241
|
+
version: "0.1.11-next.20261019143410"
|
|
242
242
|
});
|
|
243
243
|
//#endregion
|
|
244
244
|
export { z as default, B as piePackage };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as e, C as t, D as n, E as r, F as i, I as a, L as o, M as s, N as c, O as l, P as u, R as d, S as f, T as p, _ as m, a as h, c as g, d as _, f as v, g as y, h as b, i as x, j as S, k as C, l as w, m as T, n as E, o as D, p as O, r as k, s as A, t as j, u as M, v as N, w as P, x as F, y as I, z as L } from "../client-e4ZTphpa.js";
|
|
2
|
-
import { n as R, u as ee } from "../controller-
|
|
2
|
+
import { n as R, u as ee } from "../controller-DjzYEYkW.js";
|
|
3
3
|
import { Editor as te, Extension as ne } from "@tiptap/core";
|
|
4
4
|
import { Plugin as re, PluginKey as ie, TextSelection as ae } from "@tiptap/pm/state";
|
|
5
5
|
import { Table as oe, TableView as se } from "@tiptap/extension-table";
|
|
@@ -993,7 +993,7 @@ F(["input"]), j(At, {
|
|
|
993
993
|
//#region src/author/index.ts
|
|
994
994
|
var jt = At.element, Mt = Object.freeze({
|
|
995
995
|
name: "@pie-element/simple-cloze",
|
|
996
|
-
version: "0.1.
|
|
996
|
+
version: "0.1.11-next.20261019143410"
|
|
997
997
|
});
|
|
998
998
|
//#endregion
|
|
999
999
|
export { jt as default, Mt as piePackage };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "../controller-
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "../controller-DjzYEYkW.js";
|
|
2
2
|
export { c as createCorrectResponseSession, i as createDefaultModel, o as getCorrectness, n as getPartialScore, e as model, a as normalizeSession, s as outcome, t as piePackage, r as validate };
|
|
@@ -64,9 +64,9 @@ var t = {
|
|
|
64
64
|
return t?.prompt?.required && !r(e?.prompt) && (i.prompt = "This field is required."), n(e?.correctAnswer) || (i.correctAnswer = "No correct answer defined."), i;
|
|
65
65
|
}, p = Object.freeze({
|
|
66
66
|
name: "@pie-element/simple-cloze",
|
|
67
|
-
version: "0.1.
|
|
67
|
+
version: "0.1.11-next.20261019143410"
|
|
68
68
|
});
|
|
69
69
|
//#endregion
|
|
70
70
|
export { u as a, p as c, a as i, f as l, c as n, l as o, i as r, s, d as t, t as u };
|
|
71
71
|
|
|
72
|
-
//# sourceMappingURL=controller-
|
|
72
|
+
//# sourceMappingURL=controller-DjzYEYkW.js.map
|
package/dist/browser/editor-runtime/{controller-DKaHN4QB.js.map → controller-DjzYEYkW.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller-
|
|
1
|
+
{"version":3,"file":"controller-DjzYEYkW.js","names":[],"sources":["../../../src/controller/defaults.ts","../../../src/controller/index.ts"],"sourcesContent":["import type { SimpleClozeConfiguration, SimpleClozeModel } from '../types.js';\n\nexport default {\n model: {\n prompt: '<p>Enter your answer:</p>',\n promptEnabled: true,\n correctAnswer: '',\n teacherInstructionsEnabled: true,\n },\n configuration: {\n prompt: {\n label: 'Prompt',\n settings: true,\n },\n teacherInstructions: {\n label: 'Teacher Instructions',\n settings: true,\n },\n settingsPanelDisabled: false,\n },\n} satisfies {\n model: Omit<SimpleClozeModel, 'id' | 'element'>;\n configuration: SimpleClozeConfiguration;\n};\n","import defaults from './defaults.js';\nimport { toPlainText } from './plain-text.js';\nimport type { SimpleClozeConfiguration, SimpleClozeModel, SimpleClozeSession } from '../types.js';\n\nexport type SimpleClozeEnv = {\n mode?: string;\n role?: string;\n [key: string]: unknown;\n};\n\nexport type SimpleClozeCorrectness = 'correct' | 'incorrect' | 'unanswered';\n\nexport type SimpleClozeOutcome = {\n score: number;\n empty: boolean;\n traceLog: string[];\n};\n\n/**\n * Both sides compare as plain text, case-insensitively: an answer key authored\n * as HTML matches the text a learner types.\n */\nconst comparable = (value: unknown): string => toPlainText(value).toLowerCase();\n\n// Strips tags except img, iframe and source (media counts as content), as\n// multiple-choice's `getContent` does.\nconst hasContent = (html: unknown): boolean =>\n typeof html === 'string' &&\n html\n .replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '')\n .replace(/ /gi, ' ')\n .trim().length > 0;\n\n/**\n * A response with no text is unanswered; an answer key with no text matches\n * nothing, so a blank key never scores.\n */\nexport const getCorrectness = (\n question: Partial<SimpleClozeModel> | null | undefined,\n session: SimpleClozeSession | null | undefined\n): SimpleClozeCorrectness => {\n const response = comparable(session?.value);\n if (!response) {\n return 'unanswered';\n }\n\n const key = comparable(question?.correctAnswer);\n if (key && response === key) {\n return 'correct';\n }\n\n return 'incorrect';\n};\n\n/** Single response, all-or-nothing: 1 when it matches the answer key, else 0. */\nexport const getPartialScore = (\n question: Partial<SimpleClozeModel> | null | undefined,\n session: SimpleClozeSession | null | undefined\n): number => (getCorrectness(question, session) === 'correct' ? 1 : 0);\n\nconst getTraceLog = (\n question: Partial<SimpleClozeModel> | null | undefined,\n correctness: SimpleClozeCorrectness,\n score: number\n): string[] => {\n const traceLog = [\n 'Response is compared with the answer key as plain text, ignoring case and extra spaces.',\n ];\n if (!comparable(question?.correctAnswer)) {\n traceLog.push('No correct answer is defined, so no response can score.');\n } else {\n traceLog.push(\n correctness === 'correct'\n ? 'Response matches the answer key.'\n : 'Response does not match the answer key.'\n );\n }\n traceLog.push(`Final score: ${score}.`);\n return traceLog;\n};\n\nexport const outcome = (\n question: Partial<SimpleClozeModel> | null | undefined,\n session: SimpleClozeSession | null | undefined,\n _env: SimpleClozeEnv = {}\n): Promise<SimpleClozeOutcome> =>\n new Promise((resolve) => {\n const correctness = getCorrectness(question, session);\n\n if (correctness === 'unanswered') {\n resolve({\n score: 0,\n empty: true,\n traceLog: ['Student did not enter a response. Score is 0.'],\n });\n return;\n }\n\n const score = correctness === 'correct' ? 1 : 0;\n resolve({ score, empty: false, traceLog: getTraceLog(question, correctness, score) });\n });\n\nexport const createDefaultModel = (\n model: Partial<SimpleClozeModel> = {}\n): Partial<SimpleClozeModel> => ({\n ...defaults.model,\n ...model,\n});\n\nexport const normalizeSession = (s: SimpleClozeSession | null | undefined): SimpleClozeSession => ({\n ...s,\n});\n\nexport const model = (\n question: Partial<SimpleClozeModel> | null | undefined,\n session: SimpleClozeSession | null | undefined,\n env: SimpleClozeEnv | null | undefined\n): Promise<Record<string, unknown>> => {\n return new Promise((resolve) => {\n const safeSession = session || {};\n const safeEnv = env || {};\n const normalizedQuestion = createDefaultModel(question || {});\n\n const out: Record<string, unknown> = {\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n disabled: safeEnv.mode !== 'gather',\n mode: safeEnv.mode,\n role: safeEnv.role,\n language: normalizedQuestion.language,\n };\n\n if (safeEnv.mode === 'evaluate') {\n out.correctness = getCorrectness(normalizedQuestion, safeSession);\n // The key is shown in the text input, so it goes out as plain text.\n out.correctAnswer = toPlainText(normalizedQuestion.correctAnswer);\n }\n\n if (safeEnv.role === 'instructor' && (safeEnv.mode === 'view' || safeEnv.mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.teacherInstructions = null;\n }\n\n resolve(out);\n });\n};\n\nexport const createCorrectResponseSession = (\n question: Partial<SimpleClozeModel> | null | undefined,\n env: SimpleClozeEnv | null | undefined\n): Promise<SimpleClozeSession | null> => {\n return new Promise((resolve) => {\n if (env?.mode !== 'evaluate' && env?.role === 'instructor') {\n // The player sets `id` and `element` on the entry from the item config.\n resolve({ id: '1', value: toPlainText(question?.correctAnswer) });\n } else {\n resolve(null);\n }\n });\n};\n\nexport const validate = (\n model: Partial<SimpleClozeModel> = {},\n config: SimpleClozeConfiguration = {}\n): Record<string, string> => {\n const errors: Record<string, string> = {};\n\n if (config?.prompt?.required && !hasContent(model?.prompt)) {\n errors.prompt = 'This field is required.';\n }\n\n if (!comparable(model?.correctAnswer)) {\n errors.correctAnswer = 'No correct answer defined.';\n }\n\n return errors;\n};\n"],"mappings":";;AAEA,IAAA,IAAe;CACb,OAAO;EACL,QAAQ;EACR,eAAe;EACf,eAAe;EACf,4BAA4B;CAC9B;CACA,eAAe;EACb,QAAQ;GACN,OAAO;GACP,UAAU;EACZ;EACA,qBAAqB;GACnB,OAAO;GACP,UAAU;EACZ;EACA,uBAAuB;CACzB;AACF,GCEM,KAAc,MAA2B,EAAY,CAAK,CAAC,CAAC,YAAY,GAIxE,KAAc,MAClB,OAAO,KAAS,YAChB,EACG,QAAQ,sCAAsC,EAAE,CAAC,CACjD,QAAQ,YAAY,GAAG,CAAC,CACxB,KAAK,CAAC,CAAC,SAAS,GAMR,KACX,GACA,MAC2B;CAC3B,IAAM,IAAW,EAAW,GAAS,KAAK;CAC1C,IAAI,CAAC,GACH,OAAO;CAGT,IAAM,IAAM,EAAW,GAAU,aAAa;CAK9C,OAJI,KAAO,MAAa,IACf,YAGF;AACT,GAGa,KACX,GACA,MACY,IAAe,GAAU,CAAO,MAAM,YAE9C,KACJ,GACA,GACA,MACa;CACb,IAAM,IAAW,CACf,yFACF;CAWA,OAVK,EAAW,GAAU,aAAa,IAGrC,EAAS,KACP,MAAgB,YACZ,qCACA,yCACN,IANA,EAAS,KAAK,yDAAyD,GAQzE,EAAS,KAAK,gBAAgB,EAAM,EAAE,GAC/B;AACT,GAEa,KACX,GACA,GACA,IAAuB,CAAC,MAExB,IAAI,SAAS,MAAY;CACvB,IAA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,EAAO,SAAS,4BAGb,EAAW,GAAO,aAAa,MAClC,EAAO,gBAAgB,+BAGlB;AACT"}
|
|
@@ -238,7 +238,7 @@ function R(e, t) {
|
|
|
238
238
|
//#region src/delivery/index.ts
|
|
239
239
|
var z = R(N, { isComplete: (e, t) => typeof t?.value == "string" && t.value.trim().length > 0 }), B = Object.freeze({
|
|
240
240
|
name: "@pie-element/simple-cloze",
|
|
241
|
-
version: "0.1.
|
|
241
|
+
version: "0.1.11-next.20261019143410"
|
|
242
242
|
});
|
|
243
243
|
//#endregion
|
|
244
244
|
export { z as default, B as piePackage };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://cdn.jsdelivr.net/npm/@pie-element/simple-cloze@0.1.
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/@pie-element/simple-cloze@0.1.11-next.20261019143410/dist/schemas/configuration.schema.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
|
6
6
|
"prompt": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://cdn.jsdelivr.net/npm/@pie-element/simple-cloze@0.1.
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/@pie-element/simple-cloze@0.1.11-next.20261019143410/dist/schemas/model.schema.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
|
6
6
|
"id": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://cdn.jsdelivr.net/npm/@pie-element/simple-cloze@0.1.
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/@pie-element/simple-cloze@0.1.11-next.20261019143410/dist/schemas/session.schema.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
|
6
6
|
"id": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/simple-cloze",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11-next.20261019143410",
|
|
4
4
|
"description": "Simple cloze (text entry) demo/template PIE element built with Svelte 5",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"configure": "@pie-element/simple-cloze/configure",
|
|
16
16
|
"browserEditorRuntime": {
|
|
17
17
|
"name": "@pie-element/shared-editor-runtime",
|
|
18
|
-
"version": "0.1.
|
|
18
|
+
"version": "0.1.3-next.20261006160832",
|
|
19
19
|
"views": {
|
|
20
20
|
"delivery": "editor-runtime/delivery",
|
|
21
21
|
"author": "editor-runtime/author",
|
|
@@ -96,8 +96,8 @@
|
|
|
96
96
|
"clean": "rm -rf dist tsconfig.tsbuildinfo"
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
|
99
|
-
"@pie-element/shared-types": "0.2.
|
|
100
|
-
"@pie-element/shared-utils": "0.1.
|
|
101
|
-
"@pie-lib/delivery-events-svelte": "0.2.
|
|
99
|
+
"@pie-element/shared-types": "0.2.3-next.20261019015909",
|
|
100
|
+
"@pie-element/shared-utils": "0.1.6-next.20261019015909",
|
|
101
|
+
"@pie-lib/delivery-events-svelte": "0.2.2-next.20261015154938"
|
|
102
102
|
}
|
|
103
103
|
}
|