@pie-element/simple-cloze 0.1.11-next.20261022203410 → 0.1.11
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-CohVvlmX.js → controller-DJZiUChx.js} +2 -2
- package/dist/browser/{controller-CohVvlmX.js.map → controller-DJZiUChx.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-CohVvlmX.js → controller-DJZiUChx.js} +2 -2
- package/dist/browser/editor-runtime/{controller-CohVvlmX.js.map → controller-DJZiUChx.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-IKOj6Q2b.js";
|
|
2
|
-
import { n as ue, u as de } from "../controller-
|
|
2
|
+
import { n as ue, u as de } from "../controller-DJZiUChx.js";
|
|
3
3
|
//#region ../../shared/configure-events/dist/index.js
|
|
4
4
|
var fe = class e extends CustomEvent {
|
|
5
5
|
static {
|
|
@@ -17785,7 +17785,7 @@ E(["input"]), oe($S, {
|
|
|
17785
17785
|
//#region src/author/index.ts
|
|
17786
17786
|
var eC = $S.element, tC = Object.freeze({
|
|
17787
17787
|
name: "@pie-element/simple-cloze",
|
|
17788
|
-
version: "0.1.11
|
|
17788
|
+
version: "0.1.11"
|
|
17789
17789
|
});
|
|
17790
17790
|
//#endregion
|
|
17791
17791
|
export { eC as default, tC as piePackage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as createCorrectResponseSession, n as createDefaultModel, r as getCorrectness, i as getPartialScore, a as model, o as normalizeSession, s as outcome, c as piePackage, l as validate } from "../controller-
|
|
1
|
+
export { t as createCorrectResponseSession, n as createDefaultModel, r as getCorrectness, i as getPartialScore, a as model, o as normalizeSession, s as outcome, c as piePackage, l as validate } from "../controller-DJZiUChx.js";
|
|
@@ -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.11
|
|
67
|
+
version: "0.1.11"
|
|
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-DJZiUChx.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller-
|
|
1
|
+
{"version":3,"file":"controller-DJZiUChx.js","names":["defaults","toPlainText","defaults_default","comparable","value","hasContent","html","getCorrectness","response","session","key","question","getPartialScore","getTraceLog","traceLog","correctness","score","outcome","createDefaultModel","model","normalizeSession","s","safeSession","safeEnv","env","normalizedQuestion","out","resolve","createCorrectResponseSession","validate","errors","config","piePackage","\"name\"","\"version\""],"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,IAAAE,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,GCEMC,KAAc,MAA2BF,EAAYG,CAAK,CAAC,CAAC,YAAY,GAIxEC,KAAc,MAClB,OAAOC,KAAS,YAChBA,EACG,QAAQ,sCAAsC,EAAE,CAAC,CACjD,QAAQ,YAAY,GAAG,CAAC,CACxB,KAAK,CAAC,CAAC,SAAS,GAMRC,KACX,GACA,MAC2B;CAC3B,IAAMC,IAAWL,EAAWM,GAAS,KAAK;CAC1C,IAAI,CAACD,GACH,OAAO;CAGT,IAAME,IAAMP,EAAWQ,GAAU,aAAa;CAK9C,OAJID,KAAOF,MAAaE,IACf,YAGF;AACT,GAGaE,KACX,GACA,MACY,IAAeD,GAAUF,CAAO,MAAM,YAE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,GAGUE,KACX,GACA,MAEO,IAAI,SAAS,MAAY;CAC9B,AAAIJ,GAAK,SAAS,cAAcA,GAAK,SAAS,eAE5CG,EAAQ;EAAE,IAAI;EAAK,OAAO1B,EAAYU,GAAU,aAAa;CAAE,CAAC,IAEhEgB,EAAQ,IAAI;AAEhB,CAAC,GAGUE,KACX,IAAmC,CAAC,GACpC,IAAmC,CAAC,MACT;CAC3B,IAAMC,IAAiC,CAAC;CAUxC,OARIC,GAAQ,QAAQ,YAAY,CAAC1B,EAAWc,GAAO,MAAM,MACvD,EAAO,SAAS,4BAGbhB,EAAWgB,GAAO,aAAa,MAClC,EAAO,gBAAgB,+BAGlBW;AACT,G"}
|
|
@@ -242,7 +242,7 @@ function R(e, t) {
|
|
|
242
242
|
//#region src/delivery/index.ts
|
|
243
243
|
var z = R(N, { isComplete: (e, t) => typeof t?.value == "string" && t.value.trim().length > 0 }), B = Object.freeze({
|
|
244
244
|
name: "@pie-element/simple-cloze",
|
|
245
|
-
version: "0.1.11
|
|
245
|
+
version: "0.1.11"
|
|
246
246
|
});
|
|
247
247
|
//#endregion
|
|
248
248
|
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-IKOj6Q2b.js";
|
|
2
|
-
import { n as R, u as ee } from "../controller-
|
|
2
|
+
import { n as R, u as ee } from "../controller-DJZiUChx.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";
|
|
@@ -982,7 +982,7 @@ F(["input"]), j(At, {
|
|
|
982
982
|
//#region src/author/index.ts
|
|
983
983
|
var jt = At.element, Mt = Object.freeze({
|
|
984
984
|
name: "@pie-element/simple-cloze",
|
|
985
|
-
version: "0.1.11
|
|
985
|
+
version: "0.1.11"
|
|
986
986
|
});
|
|
987
987
|
//#endregion
|
|
988
988
|
export { jt as default, Mt as piePackage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as createCorrectResponseSession, n as createDefaultModel, r as getCorrectness, i as getPartialScore, a as model, o as normalizeSession, s as outcome, c as piePackage, l as validate } from "../controller-
|
|
1
|
+
export { t as createCorrectResponseSession, n as createDefaultModel, r as getCorrectness, i as getPartialScore, a as model, o as normalizeSession, s as outcome, c as piePackage, l as validate } from "../controller-DJZiUChx.js";
|
|
@@ -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.11
|
|
67
|
+
version: "0.1.11"
|
|
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-DJZiUChx.js.map
|
package/dist/browser/editor-runtime/{controller-CohVvlmX.js.map → controller-DJZiUChx.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller-
|
|
1
|
+
{"version":3,"file":"controller-DJZiUChx.js","names":["defaults","toPlainText","defaults_default","comparable","value","hasContent","html","getCorrectness","response","session","key","question","getPartialScore","getTraceLog","traceLog","correctness","score","outcome","createDefaultModel","model","normalizeSession","s","safeSession","safeEnv","env","normalizedQuestion","out","resolve","createCorrectResponseSession","validate","errors","config","piePackage","\"name\"","\"version\""],"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,IAAAE,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,GCEMC,KAAc,MAA2BF,EAAYG,CAAK,CAAC,CAAC,YAAY,GAIxEC,KAAc,MAClB,OAAOC,KAAS,YAChBA,EACG,QAAQ,sCAAsC,EAAE,CAAC,CACjD,QAAQ,YAAY,GAAG,CAAC,CACxB,KAAK,CAAC,CAAC,SAAS,GAMRC,KACX,GACA,MAC2B;CAC3B,IAAMC,IAAWL,EAAWM,GAAS,KAAK;CAC1C,IAAI,CAACD,GACH,OAAO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AI,sBALFH,EAAQ,SAAS,iBAAiBA,EAAQ,SAAS,UAAUA,EAAQ,SAAS,eACtDE,EAAmB,6BACzCA,EAAmB,sBAGG,MAG5BE,EAAQD,CAAG;AACb,CAAC,GAGUE,KACX,GACA,MAEO,IAAI,SAAS,MAAY;CAC9B,AAAIJ,GAAK,SAAS,cAAcA,GAAK,SAAS,eAE5CG,EAAQ;EAAE,IAAI;EAAK,OAAO1B,EAAYU,GAAU,aAAa;CAAE,CAAC,IAEhEgB,EAAQ,IAAI;AAEhB,CAAC,GAGUE,KACX,IAAmC,CAAC,GACpC,IAAmC,CAAC,MACT;CAC3B,IAAMC,IAAiC,CAAC;CAUxC,OARIC,GAAQ,QAAQ,YAAY,CAAC1B,EAAWc,GAAO,MAAM,MACvD,EAAO,SAAS,4BAGbhB,EAAWgB,GAAO,aAAa,MAClC,EAAO,gBAAgB,+BAGlBW;AACT,G"}
|
|
@@ -242,7 +242,7 @@ function R(e, t) {
|
|
|
242
242
|
//#region src/delivery/index.ts
|
|
243
243
|
var z = R(N, { isComplete: (e, t) => typeof t?.value == "string" && t.value.trim().length > 0 }), B = Object.freeze({
|
|
244
244
|
name: "@pie-element/simple-cloze",
|
|
245
|
-
version: "0.1.11
|
|
245
|
+
version: "0.1.11"
|
|
246
246
|
});
|
|
247
247
|
//#endregion
|
|
248
248
|
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.11
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/@pie-element/simple-cloze@0.1.11/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.11
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/@pie-element/simple-cloze@0.1.11/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.11
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/@pie-element/simple-cloze@0.1.11/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.11
|
|
3
|
+
"version": "0.1.11",
|
|
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.3
|
|
18
|
+
"version": "0.1.3",
|
|
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.3
|
|
100
|
-
"@pie-element/shared-utils": "0.1.6
|
|
101
|
-
"@pie-lib/delivery-events-svelte": "0.2.2
|
|
99
|
+
"@pie-element/shared-types": "0.2.3",
|
|
100
|
+
"@pie-element/shared-utils": "0.1.6",
|
|
101
|
+
"@pie-lib/delivery-events-svelte": "0.2.2"
|
|
102
102
|
}
|
|
103
103
|
}
|