@pie-element/mc-populated-blank 0.3.0-next.20 → 0.3.0-next.21

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.
@@ -1,4 +1,4 @@
1
- import { t as e } from "../McPopulatedBlank-DJOmkW2m.js";
1
+ import { t as e } from "../McPopulatedBlank-B0ep0vS4.js";
2
2
  //#region ../../lib-svelte/delivery-events/dist/index2.js
3
3
  function t(e) {
4
4
  return !!e && typeof e == "object" && !Array.isArray(e);
@@ -1,5 +1,5 @@
1
- import { A as e, C as t, D as n, E as r, F as i, N as a, P as o, S as s, T as c, _ as l, d as u, g as d, h as f, j as p, k as m, m as h, n as g, p as _, t as v, u as y, w as b, x } from "../client-CWh3mUUV.js";
2
- import { n as S, t as C } from "../McPopulatedBlank-DJOmkW2m.js";
1
+ import { A as e, C as t, D as n, E as r, F as i, N as a, P as o, S as s, T as c, _ as l, d as u, g as d, h as f, j as p, k as m, m as h, n as g, p as _, t as v, u as y, w as b, x } from "../client-Dfdyltec.js";
2
+ import { n as S, t as C } from "../McPopulatedBlank-B0ep0vS4.js";
3
3
  import { n as w, o as T } from "../controller-DEUOAZHa.js";
4
4
  //#region src/print/preparePrint.ts
5
5
  async function E(e, t) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/print/preparePrint.ts","../../../src/print/Print.svelte","../../../src/print/index.ts"],"sourcesContent":["import { createCorrectResponseSession, model as toViewModel } from '../controller/index.js';\nimport type { McpbQuestion, McpbRole, McpbSession } from '../shared/types.js';\n\nexport interface PrintView {\n model: Record<string, unknown>;\n session: McpbSession | null;\n teacherInstructions: string;\n audioUrl: string;\n audioTranscript: string;\n}\n\n/**\n * `pie-print` hands over the item's own model and `options.role`, so print asks\n * the controller for what a player shows that role in `view` mode, in the\n * authored choice order. An instructor's key is the correct-response session,\n * the same path a player shows it through; `printAnswerKey: false` withholds it.\n */\nexport async function preparePrint(\n question: McpbQuestion,\n role: McpbRole | undefined\n): Promise<PrintView> {\n const env = { mode: 'view' as const, role };\n const viewModel = await toViewModel({ ...question, lockChoiceOrder: true }, null, env);\n const key =\n question.printAnswerKey === false\n ? null\n : ((await createCorrectResponseSession(question, env)) as McpbSession | null);\n const { teacherInstructions, audioUrl, audioTranscript, ...model } = viewModel;\n return {\n // Delivery renders these as a collapsed toggle and a player; print writes them out.\n model: { ...model, teacherInstructions: null, hasAudio: false },\n session: key,\n teacherInstructions: String(teacherInstructions || ''),\n audioUrl: String(audioUrl || ''),\n audioTranscript: String(audioTranscript || ''),\n };\n}\n","<svelte:options\n customElement={{\n shadow: 'none',\n props: {\n model: { type: 'Object' },\n options: { type: 'Object' },\n },\n }}\n/>\n\n<script lang=\"ts\">\nimport McPopulatedBlank from '../delivery/McPopulatedBlank.svelte';\nimport { t as translate } from '../delivery/i18n';\nimport { preparePrint, type PrintView } from './preparePrint';\n\nlet { model = null, options = null }: { model?: any; options?: any } = $props();\n\nlet view = $state<PrintView | null>(null);\n\n$effect(() => {\n const question = model;\n const role = options?.role;\n if (!question) {\n view = null;\n return;\n }\n let current = true;\n preparePrint(question, role).then((next) => {\n if (current) view = next;\n });\n return () => {\n current = false;\n };\n});\n\nconst t = (key: string) => translate(key, (view?.model.language as string) || undefined);\n</script>\n\n{#if view}\n <div class=\"mpb-print\">\n {#if view.teacherInstructions}\n <div class=\"mpb-print-block mpb-print-teacher-instructions\">{@html view.teacherInstructions}</div>\n {/if}\n\n {#if view.audioUrl || view.audioTranscript}\n <div class=\"mpb-print-block mpb-print-audio\">\n {#if view.audioUrl}\n <div><strong>{t('printAudio')}</strong> {view.audioUrl}</div>\n {/if}\n {#if view.audioTranscript}\n <div><strong>{t('printTranscript')}</strong> {view.audioTranscript}</div>\n {/if}\n </div>\n {/if}\n\n <McPopulatedBlank model={view.model} session={view.session} />\n </div>\n{/if}\n\n<style>\n /* Inset to line up with the delivery root's padding. */\n .mpb-print-block {\n padding: 0 1rem;\n margin: 1rem 0;\n }\n\n .mpb-print-teacher-instructions :global(p) {\n margin: 0.5em 0;\n }\n\n .mpb-print-audio {\n font-size: 0.875rem;\n line-height: 1.25rem;\n }\n</style>\n","import PrintComponent from './Print.svelte';\n\n/** `pie-print` sets `options` before the model; `role` decides whether the key prints. */\nexport default (PrintComponent as any).element;\n"],"mappings":";;;;AAiBA,eAAsB,EACpB,GACA,GACoB;CACpB,IAAM,IAAM;EAAE,MAAM;EAAiB;CAAK,GACpC,IAAY,MAAM,EAAY;EAAE,GAAG;EAAU,iBAAiB;CAAK,GAAG,MAAM,CAAG,GAC/E,IACJ,EAAS,mBAAmB,KACxB,OACE,MAAM,EAA6B,GAAU,CAAG,GAClD,EAAE,wBAAqB,aAAU,oBAAiB,GAAG,MAAU;CACrE,OAAO;EAEL,OAAO;GAAE,GAAG;GAAO,qBAAqB;GAAM,UAAU;EAAM;EAC9D,SAAS;EACT,qBAAqB,OAAO,KAAuB,EAAE;EACrD,UAAU,OAAO,KAAY,EAAE;EAC/B,iBAAiB,OAAO,KAAmB,EAAE;CAC/C;AACF;;;;;;;iBC1BA;;CAKA,IAAI,IAAO,EAAA,GAAA,SAAA,GAAG,IAAI,GAAE,IAAO,EAAA,GAAA,WAAA,GAAG,IAAI,GAE9B,IAAO,EAAyB,IAAI;CAExC,QAAc;EACZ,IAAM,IAAW,EAAK,GAChB,IAAO,EAAO,CAAA,EAAE;EACtB,IAAE,CAAG,GAAU;KACb,GAAO,IAAI;GACX;EACF;EACA,IAAI,IAAU;EAId,OAHA,EAAa,GAAU,CAAI,CAAA,CAAE,MAAM,MAAS;GAC1C,AAAI,KAAO,EAAE,GAAO,GAAI,EAAA;EAC1B,CAAC,SACY;GACX,IAAU;EACZ;CACF,CAAC;CAED,IAAM,KAAK,MAAgB,EAAU,GAAG,EAAG,CAAI,CAAA,EAAE,MAAM,YAAuB,KAAA,CAAS;;;;;gBApBzE,MAAI;;;;;;kBAAY,MAAI;;;;MAwB/B,IAAG,EAAA,SAAH,CAAG;OAEC,IAAG,EAAA;KAAH,SAAG,EAA+D,CAAI,CAAA,CAAC,qBAAmB,EAAA,KAA1F,CAAG,QAAH,CAAG;;;KADD,CAAI,CAAA,CAAC,uBAAmB,EAAA,CAAA;;;OAK1B,IAAG,EAAA,SAAH,CAAG;QAEC,IAAG,EAAA,GAAE,IAAM,EAAX,CAAG,SAAE,GAAM,EAAA,SAAN,CAAM;MAAX,CAAG;yBAAqC,CAAI,CAAA,CAAC,YAAQ,IAAA;cAAxC,EAAE,YAAY,CAAA,CAAA,QAA3B,CAAG;;;MADD,CAAI,CAAA,CAAC,YAAQ,EAAA,CAAA;;;QAIf,IAAG,EAAA,GAAE,IAAM,EAAX,CAAG,SAAE,GAAM,EAAA,SAAN,CAAM;MAAX,CAAG;yBAA0C,CAAI,CAAA,CAAC,mBAAe,IAAA;cAApD,EAAE,iBAAiB,CAAA,CAAA,QAAhC,CAAG;;;MADD,CAAI,CAAA,CAAC,mBAAe,EAAA,CAAA;SAJ1B,CAAG,QAAH,CAAG;;;MADD,CAAI,CAAA,CAAC,YAAQ,EAAI,CAAI,CAAA,CAAC,oBAAe,EAAA,CAAA;MAWzC,EAAA,EAAA,GAAA,CAAgB,GAAA;;aAAQ,CAAI,CAAA,CAAC;;;aAAgB,CAAI,CAAA,CAAC;;QAhBpD,CAAG,QAAH,CAAG;;;IADD,CAAI,KAAA,EAAA,CAAA;;AAFD;;;;;;;ACjCR,IAAA,IAAgB,EAAuB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/print/preparePrint.ts","../../../src/print/Print.svelte","../../../src/print/index.ts"],"sourcesContent":["import { createCorrectResponseSession, model as toViewModel } from '../controller/index.js';\nimport type { McpbQuestion, McpbRole, McpbSession } from '../shared/types.js';\n\nexport interface PrintView {\n model: Record<string, unknown>;\n session: McpbSession | null;\n teacherInstructions: string;\n audioUrl: string;\n audioTranscript: string;\n}\n\n/**\n * `pie-print` hands over the item's own model and `options.role`, so print asks\n * the controller for what a player shows that role in `view` mode, in the\n * authored choice order. An instructor's key is the correct-response session,\n * the same path a player shows it through; `printAnswerKey: false` withholds it.\n */\nexport async function preparePrint(\n question: McpbQuestion,\n role: McpbRole | undefined\n): Promise<PrintView> {\n const env = { mode: 'view' as const, role };\n const viewModel = await toViewModel({ ...question, lockChoiceOrder: true }, null, env);\n const key =\n question.printAnswerKey === false\n ? null\n : ((await createCorrectResponseSession(question, env)) as McpbSession | null);\n const { teacherInstructions, audioUrl, audioTranscript, ...model } = viewModel;\n return {\n // Delivery renders these as a collapsed toggle and a player; print writes them out.\n model: { ...model, teacherInstructions: null, hasAudio: false },\n session: key,\n teacherInstructions: String(teacherInstructions || ''),\n audioUrl: String(audioUrl || ''),\n audioTranscript: String(audioTranscript || ''),\n };\n}\n","<svelte:options\n customElement={{\n shadow: 'none',\n props: {\n model: { type: 'Object' },\n options: { type: 'Object' },\n },\n }}\n/>\n\n<script lang=\"ts\">\nimport McPopulatedBlank from '../delivery/McPopulatedBlank.svelte';\nimport { t as translate } from '../delivery/i18n';\nimport { preparePrint, type PrintView } from './preparePrint';\n\nlet { model = null, options = null }: { model?: any; options?: any } = $props();\n\nlet view = $state<PrintView | null>(null);\n\n$effect(() => {\n const question = model;\n const role = options?.role;\n if (!question) {\n view = null;\n return;\n }\n let current = true;\n preparePrint(question, role).then((next) => {\n if (current) view = next;\n });\n return () => {\n current = false;\n };\n});\n\nconst t = (key: string) => translate(key, (view?.model.language as string) || undefined);\n</script>\n\n{#if view}\n <div class=\"mpb-print\">\n {#if view.teacherInstructions}\n <div class=\"mpb-print-block mpb-print-teacher-instructions\">{@html view.teacherInstructions}</div>\n {/if}\n\n {#if view.audioUrl || view.audioTranscript}\n <div class=\"mpb-print-block mpb-print-audio\">\n {#if view.audioUrl}\n <div><strong>{t('printAudio')}</strong> {view.audioUrl}</div>\n {/if}\n {#if view.audioTranscript}\n <div><strong>{t('printTranscript')}</strong> {view.audioTranscript}</div>\n {/if}\n </div>\n {/if}\n\n <McPopulatedBlank model={view.model} session={view.session} />\n </div>\n{/if}\n\n<style>\n /* Inset to line up with the delivery root's padding. */\n .mpb-print-block {\n padding: 0 1rem;\n margin: 1rem 0;\n }\n\n .mpb-print-teacher-instructions :global(p) {\n margin: 0.5em 0;\n }\n\n .mpb-print-audio {\n font-size: 0.875rem;\n line-height: 1.25rem;\n }\n</style>\n","import PrintComponent from './Print.svelte';\n\n/** `pie-print` sets `options` before the model; `role` decides whether the key prints. */\nexport default (PrintComponent as any).element;\n"],"mappings":";;;;AAiBA,eAAsB,EACpB,GACA,GACoB;CACpB,IAAM,IAAM;EAAE,MAAM;EAAiB;CAAK,GACpC,IAAY,MAAM,EAAY;EAAE,GAAG;EAAU,iBAAiB;CAAK,GAAG,MAAM,CAAG,GAC/E,IACJ,EAAS,mBAAmB,KACxB,OACE,MAAM,EAA6B,GAAU,CAAG,GAClD,EAAE,wBAAqB,aAAU,oBAAiB,GAAG,MAAU;CACrE,OAAO;EAEL,OAAO;GAAE,GAAG;GAAO,qBAAqB;GAAM,UAAU;EAAM;EAC9D,SAAS;EACT,qBAAqB,OAAO,KAAuB,EAAE;EACrD,UAAU,OAAO,KAAY,EAAE;EAC/B,iBAAiB,OAAO,KAAmB,EAAE;CAC/C;AACF;;;;;;;iBC1BA;;CAKA,IAAM,IAAK,EAAA,GAAA,SAAA,GAAG,IAAI,GAAE,IAAO,EAAA,GAAA,WAAA,GAAG,IAAI,GAE9B,IAAO,EAAyB,IAAI;CAExC,QAAc;EACZ,IAAM,IAAW,EAAK,GAChB,IAAO,EAAO,CAAA,EAAE;EACtB,IAAI,CAAC,GAAU;GACb,EAAA,GAAO,IAAI;GACX;EACF;EACA,IAAI,IAAU;EAId,OAHA,EAAa,GAAU,CAAI,CAAC,CAAC,MAAM,MAAS;GAC1C,AAAI,KAAS,EAAA,GAAO,GAAI,EAAA;EAC1B,CAAC,SACY;GACX,IAAU;EACZ;CACF,CAAC;CAED,IAAM,KAAK,MAAgB,EAAU,GAAK,EAAC,CAAI,CAAA,EAAE,MAAM,YAAuB,K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