@astl/astrolabe 0.1.2 → 0.1.4
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/CHANGELOG.md +30 -0
- package/dist/cdn/astrolabe-editor.js +3 -3
- package/dist/cdn/astrolabe-player.js +1 -1
- package/dist/cdn/astrolabe.js +1 -1
- package/dist/cdn/astrolabe.standalone.js +1094 -1060
- package/dist/cdn/chunks/{audio-B0LSIn5N.js → audio-Biof5aA3.js} +2 -2
- package/dist/cdn/chunks/{audio-B0LSIn5N.js.map → audio-Biof5aA3.js.map} +1 -1
- package/dist/cdn/chunks/{block-styles-CKo9x7Vt.js → block-styles-CCtSFM4j.js} +2 -2
- package/dist/cdn/chunks/{block-styles-CKo9x7Vt.js.map → block-styles-CCtSFM4j.js.map} +1 -1
- package/dist/cdn/chunks/{book-CHzDDaim.js → book-IFipARhv.js} +2 -2
- package/dist/cdn/chunks/{book-CHzDDaim.js.map → book-IFipARhv.js.map} +1 -1
- package/dist/cdn/chunks/{callout-QFLFLPc5.js → callout-CuajbbYY.js} +2 -2
- package/dist/cdn/chunks/{callout-QFLFLPc5.js.map → callout-CuajbbYY.js.map} +1 -1
- package/dist/cdn/chunks/{categorise-BO2tNVJ3.js → categorise-Cm6kXLXw.js} +2 -2
- package/dist/cdn/chunks/{categorise-BO2tNVJ3.js.map → categorise-Cm6kXLXw.js.map} +1 -1
- package/dist/cdn/chunks/{chip-styles-Dme5daTO.js → chip-styles--gboWK2Z.js} +2 -2
- package/dist/cdn/chunks/{chip-styles-Dme5daTO.js.map → chip-styles--gboWK2Z.js.map} +1 -1
- package/dist/cdn/chunks/{choice-CExBvqKj.js → choice-BSpB6LHl.js} +2 -2
- package/dist/cdn/chunks/{choice-CExBvqKj.js.map → choice-BSpB6LHl.js.map} +1 -1
- package/dist/cdn/chunks/{color-control-Cl5cuMSO.js → color-control-1kkdM8ns.js} +2 -2
- package/dist/cdn/chunks/{color-control-Cl5cuMSO.js.map → color-control-1kkdM8ns.js.map} +1 -1
- package/dist/cdn/chunks/{crossword-Cb-a3Tjj.js → crossword-BdOAEPcL.js} +2 -2
- package/dist/cdn/chunks/{crossword-Cb-a3Tjj.js.map → crossword-BdOAEPcL.js.map} +1 -1
- package/dist/cdn/chunks/{definitions-CNX90WtL.js → definitions-BybSa1mq.js} +2 -2
- package/dist/cdn/chunks/{definitions-CNX90WtL.js.map → definitions-BybSa1mq.js.map} +1 -1
- package/dist/cdn/chunks/{directive-helpers-D7lOZKnB.js → directive-helpers-US6zRjJ1.js} +2 -2
- package/dist/cdn/chunks/{directive-helpers-D7lOZKnB.js.map → directive-helpers-US6zRjJ1.js.map} +1 -1
- package/dist/cdn/chunks/{drop-vRXndjHu.js → drop-D4NQ0WK_.js} +2 -2
- package/dist/cdn/chunks/{drop-vRXndjHu.js.map → drop-D4NQ0WK_.js.map} +1 -1
- package/dist/cdn/chunks/{flash-cards-0NrrKdrx.js → flash-cards-D4ebb5m6.js} +2 -2
- package/dist/cdn/chunks/{flash-cards-0NrrKdrx.js.map → flash-cards-D4ebb5m6.js.map} +1 -1
- package/dist/cdn/chunks/{gap-lor-khst.js → gap-D-Sipuyu.js} +2 -2
- package/dist/cdn/chunks/{gap-lor-khst.js.map → gap-D-Sipuyu.js.map} +1 -1
- package/dist/cdn/chunks/{help-C-woafz5.js → help-CmCFuNXk.js} +2 -2
- package/dist/cdn/chunks/{help-C-woafz5.js.map → help-CmCFuNXk.js.map} +1 -1
- package/dist/cdn/chunks/{help-form-CDg3TCwI.js → help-form-Di2NtKDp.js} +14 -10
- package/dist/cdn/chunks/help-form-Di2NtKDp.js.map +1 -0
- package/dist/cdn/chunks/{hotspot-oel1Eelo.js → hotspot-B3bvqVzf.js} +2 -2
- package/dist/cdn/chunks/{hotspot-oel1Eelo.js.map → hotspot-B3bvqVzf.js.map} +1 -1
- package/dist/cdn/chunks/{image-drop-Dkprw0Kn.js → image-drop-vLc2B7rF.js} +2 -2
- package/dist/cdn/chunks/{image-drop-Dkprw0Kn.js.map → image-drop-vLc2B7rF.js.map} +1 -1
- package/dist/cdn/chunks/{image-label-Dm5shQSh.js → image-label-DsKxQDTQ.js} +2 -2
- package/dist/cdn/chunks/{image-label-Dm5shQSh.js.map → image-label-DsKxQDTQ.js.map} +1 -1
- package/dist/cdn/chunks/{inline-styles-CTgXWnHb.js → inline-styles-CFNlb6f2.js} +2 -2
- package/dist/cdn/chunks/{inline-styles-CTgXWnHb.js.map → inline-styles-CFNlb6f2.js.map} +1 -1
- package/dist/cdn/chunks/{insert-menu-7vANVmTK.js → insert-menu-DAQglwtG.js} +2 -2
- package/dist/cdn/chunks/{insert-menu-7vANVmTK.js.map → insert-menu-DAQglwtG.js.map} +1 -1
- package/dist/cdn/chunks/{issue-list-BT9qvnZU.js → issue-list-CzSmohtT.js} +2 -2
- package/dist/cdn/chunks/{issue-list-BT9qvnZU.js.map → issue-list-CzSmohtT.js.map} +1 -1
- package/dist/cdn/chunks/{live-jdiyYln2.js → live-qnReIRtj.js} +2 -2
- package/dist/cdn/chunks/{live-jdiyYln2.js.map → live-qnReIRtj.js.map} +1 -1
- package/dist/cdn/chunks/{long-answer-CtzClLAx.js → long-answer-NSWJiK0z.js} +2 -2
- package/dist/cdn/chunks/{long-answer-CtzClLAx.js.map → long-answer-NSWJiK0z.js.map} +1 -1
- package/dist/cdn/chunks/{mark-words-CpH3gTcX.js → mark-words-BKu-_uIl.js} +2 -2
- package/dist/cdn/chunks/{mark-words-CpH3gTcX.js.map → mark-words-BKu-_uIl.js.map} +1 -1
- package/dist/cdn/chunks/{match-DKE_4o-x.js → match-BpnJGW_5.js} +21 -13
- package/dist/cdn/chunks/match-BpnJGW_5.js.map +1 -0
- package/dist/cdn/chunks/{memory-B6hSyHyz.js → memory-BgTHujsU.js} +2 -2
- package/dist/cdn/chunks/{memory-B6hSyHyz.js.map → memory-BgTHujsU.js.map} +1 -1
- package/dist/cdn/chunks/messages-Qzse5KMX.js +2 -0
- package/dist/cdn/chunks/messages-Qzse5KMX.js.map +1 -0
- package/dist/cdn/chunks/{option-styles-WKzjKmCH.js → option-styles-B2sBX5Oz.js} +2 -2
- package/dist/cdn/chunks/{option-styles-WKzjKmCH.js.map → option-styles-B2sBX5Oz.js.map} +1 -1
- package/dist/cdn/chunks/{order-BhG_6IC-.js → order-B9gqH5wm.js} +2 -2
- package/dist/cdn/chunks/{order-BhG_6IC-.js.map → order-B9gqH5wm.js.map} +1 -1
- package/dist/cdn/chunks/{picture-view-BKnAyScQ.js → picture-view-Deodu_mb.js} +2 -2
- package/dist/cdn/chunks/{picture-view-BKnAyScQ.js.map → picture-view-Deodu_mb.js.map} +1 -1
- package/dist/cdn/chunks/{repeat-CY2W2URZ.js → repeat-BDXokpxQ.js} +2 -2
- package/dist/cdn/chunks/{repeat-CY2W2URZ.js.map → repeat-BDXokpxQ.js.map} +1 -1
- package/dist/cdn/chunks/{runtime-DxAbpr3S.js → runtime-C25QK5B0.js} +3 -3
- package/dist/cdn/chunks/{runtime-DxAbpr3S.js.map → runtime-C25QK5B0.js.map} +1 -1
- package/dist/cdn/chunks/{scan-jWgPnVxA.js → scan-BVhxT2Hw.js} +2 -2
- package/dist/cdn/chunks/{scan-jWgPnVxA.js.map → scan-BVhxT2Hw.js.map} +1 -1
- package/dist/cdn/chunks/{select-DTA3dJzr.js → select-DPpKJwSg.js} +2 -2
- package/dist/cdn/chunks/{select-DTA3dJzr.js.map → select-DPpKJwSg.js.map} +1 -1
- package/dist/cdn/chunks/select-QZ35cyns.js +2 -0
- package/dist/cdn/chunks/select-QZ35cyns.js.map +1 -0
- package/dist/cdn/chunks/{source-view-CZVxgTNQ.js → source-view-gqFlZzwR.js} +2 -2
- package/dist/cdn/chunks/{source-view-CZVxgTNQ.js.map → source-view-gqFlZzwR.js.map} +1 -1
- package/dist/cdn/chunks/{style-form-DUGbG_kL.js → style-form-DuR0EEum.js} +2 -2
- package/dist/cdn/chunks/{style-form-DUGbG_kL.js.map → style-form-DuR0EEum.js.map} +1 -1
- package/dist/cdn/chunks/{style-messages-qdf3pZbT.js → style-messages-B136zSom.js} +2 -2
- package/dist/cdn/chunks/{style-messages-qdf3pZbT.js.map → style-messages-B136zSom.js.map} +1 -1
- package/dist/cdn/chunks/{style-popups-BobgX1WK.js → style-popups-Bcl5imdP.js} +2 -2
- package/dist/cdn/chunks/{style-popups-BobgX1WK.js.map → style-popups-Bcl5imdP.js.map} +1 -1
- package/dist/cdn/chunks/{style-rules-D17QGzXk.js → style-rules-ozpLz2ec.js} +2 -2
- package/dist/cdn/chunks/{style-rules-D17QGzXk.js.map → style-rules-ozpLz2ec.js.map} +1 -1
- package/dist/cdn/chunks/{styled-Dmx5Yjv7.js → styled-bQqnDxBf.js} +2 -2
- package/dist/cdn/chunks/{styled-Dmx5Yjv7.js.map → styled-bQqnDxBf.js.map} +1 -1
- package/dist/cdn/chunks/{styles-CdJT6Pp9.js → styles-DiY3VA_T.js} +5 -5
- package/dist/cdn/chunks/styles-DiY3VA_T.js.map +1 -0
- package/dist/cdn/chunks/surface-CIz1z2oY.js +1059 -0
- package/dist/cdn/chunks/surface-CIz1z2oY.js.map +1 -0
- package/dist/cdn/chunks/{true-false-DP3MO599.js → true-false-C-S6RmZY.js} +2 -2
- package/dist/cdn/chunks/{true-false-DP3MO599.js.map → true-false-C-S6RmZY.js.map} +1 -1
- package/dist/cdn/chunks/{video-j9MCH6Kw.js → video-Dae8Gguf.js} +2 -2
- package/dist/cdn/chunks/{video-j9MCH6Kw.js.map → video-Dae8Gguf.js.map} +1 -1
- package/dist/cdn/chunks/{word-bank-ARjwUKZf.js → word-bank-CsIle0Ro.js} +2 -2
- package/dist/cdn/chunks/{word-bank-ARjwUKZf.js.map → word-bank-CsIle0Ro.js.map} +1 -1
- package/dist/cdn/chunks/{word-search-AHvM7yCJ.js → word-search-IOCwqo3y.js} +2 -2
- package/dist/cdn/chunks/{word-search-AHvM7yCJ.js.map → word-search-IOCwqo3y.js.map} +1 -1
- package/package.json +9 -9
- package/dist/cdn/chunks/help-form-CDg3TCwI.js.map +0 -1
- package/dist/cdn/chunks/match-DKE_4o-x.js.map +0 -1
- package/dist/cdn/chunks/messages-D1aJfyS_.js +0 -2
- package/dist/cdn/chunks/messages-D1aJfyS_.js.map +0 -1
- package/dist/cdn/chunks/styles-CdJT6Pp9.js.map +0 -1
- package/dist/cdn/chunks/surface-C6wtQkTY.js +0 -1037
- package/dist/cdn/chunks/surface-C6wtQkTY.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-B6hSyHyz.js","names":["en","pl","LitElement","unsafeCSS","nothing","ifDefined","b","r","i$1","A","verdictIcon","AstlElement","i","en_default","memoryManifest","pl_default","RovingFocus","blockStyles","namespace","memoryUiMessages","CLOSED","sideOf","card","words","node","labelOf","placed","free","pairs","pair","p","MemoryElement","element","#roving","#root","grid","child","rights","now","given","answers","slot","ui","open","#open","#renderCard","#confirm","#turnBack","id","side","number","turned","up","marked","verdict","correct","answer","c","refs","name","#name","#press","event","a","paired","params","#label","key","#sayPair","said","memoryElement"],"sources":["../../../../components/src/memory/ui-messages.ts","../../../../components/src/memory/element.ts"],"sourcesContent":["import type { MessageCatalog } from '@astl/core';\nimport en from './messages/ui/en.json' with { type: 'json' };\nimport pl from './messages/ui/pl.json' with { type: 'json' };\n\nconst namespace = 'astl.memory';\n\n/**\n * The student strings (`ui.*`): the element's catalogs. A module of their own, because bundlers split by module: one\n * that also built `memoryMessages` would put the authoring strings into the element's chunk.\n */\nexport const memoryUiMessages: readonly MessageCatalog[] = [\n { namespace, locale: 'en', messages: en },\n { namespace, locale: 'pl', messages: pl },\n];\n","import type { Answers, ComponentManifest, MessageCatalog, Units } from '@astl/core';\nimport { AstlElement, type ElementRegistration, verdictIcon } from '@astl/player';\nimport { RovingFocus } from '@astl/player/interaction';\nimport {\n type CSSResultGroup,\n css,\n html,\n LitElement,\n nothing,\n type PropertyDeclarations,\n type TemplateResult,\n unsafeCSS,\n} from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { blockStyles } from '../block-styles.js';\nimport { memoryManifest } from './manifest.js';\nimport { memoryUiMessages } from './ui-messages.js';\n\ntype Side = 'a' | 'b';\n/** A set A card and the set B card paired with it. */\ntype Pair = readonly [string, string];\n/** The face-up card of each set that is not paired yet. */\ntype Open = Readonly<Record<Side, string | null>>;\n\nconst CLOSED: Open = { a: null, b: null };\n\nconst sideOf = (card: Element): Side => (card.localName === 'astl-card-a' ? 'a' : 'b');\nconst words = (node: Node): string =>\n node instanceof HTMLImageElement\n ? ` ${node.alt} `\n : node.nodeType === Node.TEXT_NODE\n ? (node.textContent ?? '')\n : [...node.childNodes].map(words).join('');\n/** What a face says: its text and the alt text of its pictures. */\nconst labelOf = (card: Element | undefined): string => (card ? words(card) : '').replace(/\\s+/g, ' ').trim();\n\n/** `pairs` with `pair` at the smallest free number. */\nfunction placed(pairs: readonly (Pair | null)[], pair: Pair): (Pair | null)[] {\n const free = pairs.indexOf(null);\n return free < 0 ? [...pairs, pair] : pairs.map((p, i) => (i === free ? pair : p));\n}\n\n/**\n * `<astl-memory>`: cards lie face down in a grid, each back showing its set (A or B). The student turns one card of\n * each set; while both are face up, \"Confirm\" pairs them and \"Turn back\" turns them back. Turning another card of a\n * set replaces that set's face-up card, and pressing a paired card undoes its pair. Pairs are never checked live.\n * Slots: one per set A card (its id), answered with the id of the set B card paired with it.\n *\n * Cards are toggle buttons (pressed = face up) with one tab stop for the grid: the arrow keys move it (RovingFocus,\n * wrapping in reading order). A pair keeps its number and palette colour until it is undone; a new pair takes the\n * smallest free number. The light-DOM `<astl-prompt>` and cards are slotted manually and never moved or changed.\n */\nexport class MemoryElement extends AstlElement {\n static override manifest: ComponentManifest = memoryManifest;\n static override messages: readonly MessageCatalog[] = memoryUiMessages;\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n slotAssignment: 'manual',\n };\n\n static override properties: PropertyDeclarations = {\n pairs: { state: true },\n open: { state: true },\n };\n\n static override styles: CSSResultGroup = [\n // Every card the same size (equal rows and columns), so a face-down card never hints at its face or its partner;\n // rows a little apart: the number and the verdict of a card sit on its top edge. Columns at least 8rem, and at\n // least a fifth of the width less the gaps (four columns in the player's column), so long faces keep a few words a\n // line. With the solution every card is face up: rows take the height of their own cards, so a solution line\n // grows its row only. A card is face down (the back: its set letter on the accent fill), turned (the selected\n // look; in hc also a bar and bold text) or paired (its pair's palette colour and number).\n css`\n .cards {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(min(100%, max(8rem, 22%)), 1fr));\n grid-auto-rows: 1fr;\n gap: var(--astl-space-5) var(--astl-space-3);\n padding-block-start: var(--astl-space-3);\n overflow-wrap: anywhere;\n hyphens: auto;\n }\n .cards[data-solution] {\n grid-auto-rows: auto;\n }\n .card {\n position: relative;\n display: flex;\n flex-direction: column;\n min-inline-size: 0;\n border: var(--astl-outline-width) solid var(--astl-outline);\n border-radius: var(--astl-radius-m);\n background: var(--astl-accent-soft);\n }\n .card[data-up] {\n background: var(--astl-surface);\n }\n .card[data-open] {\n border-color: var(--astl-selected);\n background: var(--astl-selected-soft);\n font-weight: var(--astl-selected-weight);\n }\n .card[data-open]::before {\n content: '';\n position: absolute;\n inset-block: 0;\n inset-inline-start: 0;\n inline-size: var(--astl-selected-bar);\n background: var(--astl-selected);\n }\n .card[data-palette] {\n border-color: var(--astl-memory-ink);\n background: var(--astl-memory-soft);\n }\n .card > button {\n flex: 1 1 auto;\n display: grid;\n min-block-size: 5.5rem;\n margin: 0;\n padding: var(--astl-space-3);\n border: 0;\n background: none;\n color: inherit;\n font: inherit;\n cursor: pointer;\n touch-action: manipulation;\n }\n .card > button:disabled {\n cursor: default;\n }\n .back,\n .face {\n grid-area: 1 / 1;\n display: grid;\n place-content: center;\n min-inline-size: 0;\n text-align: center;\n }\n .back {\n color: var(--astl-accent);\n font-size: 1.75rem;\n font-weight: 700;\n }\n .face,\n [aria-pressed='true'] > .back {\n visibility: hidden;\n }\n [aria-pressed='true'] > .face {\n visibility: visible;\n animation: turn var(--astl-duration-normal) ease-out;\n }\n @keyframes turn {\n from {\n transform: rotateY(90deg);\n }\n }\n @media (prefers-reduced-motion: reduce) {\n [aria-pressed='true'] > .face {\n animation: none;\n }\n }\n `,\n // Stickers on the top edge of a card: its pair number at the inline start, its verdict icon at the inline end.\n // The solution line (block-styles.ts) closes a set A card; the buttons that confirm or turn back follow the grid,\n // kept in view.\n css`\n .number,\n .card > .astl-verdict {\n position: absolute;\n inset-block-start: 0;\n translate: 0 -50%;\n border-radius: var(--astl-radius-pill);\n background: var(--astl-surface);\n font-size: var(--astl-size-small);\n }\n .number {\n inset-inline-start: var(--astl-space-2);\n min-inline-size: 1.5rem;\n padding-inline: var(--astl-space-1);\n border: var(--astl-outline-width) solid var(--astl-memory-ink);\n background: var(--astl-memory-soft);\n color: var(--astl-memory-ink);\n font-weight: 700;\n line-height: 1.4;\n }\n .card > .astl-verdict {\n inset-inline-end: var(--astl-space-2);\n padding: 0.125rem;\n }\n .card > .astl-solution {\n padding-inline: var(--astl-space-2);\n padding-block-end: var(--astl-space-2);\n text-align: center;\n }\n .actions {\n position: sticky;\n inset-block-end: 0;\n display: flex;\n flex-wrap: wrap;\n gap: var(--astl-space-2);\n margin-block-start: var(--astl-space-3);\n padding-block: var(--astl-space-2);\n background: var(--astl-surface);\n }\n .actions > button {\n min-inline-size: var(--astl-target-min);\n min-block-size: var(--astl-target-min);\n padding-inline: var(--astl-space-4);\n border: var(--astl-outline-width) solid var(--astl-outline);\n border-radius: var(--astl-radius-m);\n background: var(--astl-surface);\n color: var(--astl-ink);\n font: inherit;\n font-weight: 600;\n cursor: pointer;\n }\n .group-verdict {\n margin-block: var(--astl-space-3) 0;\n }\n `,\n // Palette slots of pairs, through an attribute: a strict Content Security Policy blocks inline style attributes.\n unsafeCSS(\n Array.from(\n { length: 8 },\n (_, i) =>\n `[data-palette='${i + 1}']{--astl-memory-ink:var(--astl-palette-${i + 1});--astl-memory-soft:var(--astl-palette-${i + 1}-soft)}`,\n ).join(''),\n ),\n blockStyles,\n ];\n\n /** Pair n at index n - 1 (its number and palette slot); null where a pair was undone, so the others keep theirs. */\n declare protected pairs: readonly (Pair | null)[];\n declare protected open: Open;\n\n /** One tab stop for the grid; the arrow keys follow the columns as laid out now, which change with the width. */\n readonly #roving: RovingFocus;\n\n constructor() {\n super();\n this.pairs = [];\n this.open = CLOSED;\n const element = this;\n this.#roving = new RovingFocus(this, {\n count: () => this.cards.length,\n item: (i) => this.#root.querySelector<HTMLButtonElement>(`button[data-index=\"${i}\"]`),\n axis: 'grid',\n wrap: true,\n get columns() {\n const grid = element.#root.querySelector('.cards');\n return grid === null ? 1 : getComputedStyle(grid).gridTemplateColumns.split(' ').length;\n },\n });\n }\n\n /** Both sets' cards in rendered order: view order, or shuffled per attempt with a seed. */\n get cards(): readonly HTMLElement[] {\n return this.shuffled(\n Array.from(this.children).filter(\n (child): child is HTMLElement =>\n (child.localName === 'astl-card-a' || child.localName === 'astl-card-b') && child.id !== '',\n ),\n );\n }\n\n get slotIds(): readonly string[] {\n return this.cards.filter((card) => sideOf(card) === 'a').map((card) => card.id);\n }\n\n getAnswers(): Answers {\n return Object.fromEntries(this.pairs.filter((pair) => pair !== null));\n }\n\n /**\n * Pairs set from outside, in reading order: '' or an unknown card leaves a set A card unpaired, and a set B card\n * that is paired already keeps its first pair (a restored attempt cannot use a card twice).\n */\n setAnswers(answers: Answers): void {\n const rights = new Set(this.cards.filter((card) => sideOf(card) === 'b').map((card) => card.id));\n const now = this.getAnswers();\n const given = this.slotIds.filter(\n (slot) => Object.hasOwn(answers, slot) && answers[slot] !== (now[slot] ?? ''),\n );\n let pairs = this.pairs.map((pair) => (pair !== null && given.includes(pair[0]) ? null : pair));\n for (const slot of given) {\n const card = answers[slot] ?? '';\n if (rights.has(card) && !pairs.some((pair) => pair?.[1] === card)) pairs = placed(pairs, [slot, card]);\n }\n this.pairs = pairs;\n this.open = CLOSED;\n }\n\n units(): Units {\n return { answered: this.pairs.filter((pair) => pair !== null).length, total: this.slotIds.length };\n }\n\n protected override render(): TemplateResult {\n const ui = this.uiLanguage;\n const open = this.#open;\n return html`<fieldset part=\"memory\">\n <legend part=\"prompt\">\n <slot data-tag=\"astl-prompt\"></slot>\n <span class=\"hint\" lang=${ui.lang}><bdi>${this.t('ui.hint')}</bdi></span>\n </legend>\n <div class=\"cards\" part=\"cards\" ?data-solution=${this.solution !== null}>\n ${this.cards.map((card, i) => this.#renderCard(card, i))}\n </div>\n ${\n open.a === null || open.b === null\n ? nothing\n : html`<div class=\"actions\" part=\"actions\" lang=${ui.lang} dir=${ui.dir}>\n <button type=\"button\" @click=${this.#confirm}>${this.t('ui.confirm')}</button>\n <button type=\"button\" @click=${this.#turnBack}>${this.t('ui.turnBack')}</button>\n </div>`\n }\n ${this.renderGroupVerdict()}\n </fieldset>`;\n }\n\n /**\n * A card: named by its number and set; face up, also by its face and whether it is paired. A paired card shows its\n * pair's verdict; a set A card with a solution that differs from its pair shows the set B card it belongs with.\n */\n #renderCard(card: HTMLElement, i: number): TemplateResult {\n const ui = this.uiLanguage;\n const id = card.id;\n const side = sideOf(card);\n const number = this.pairs.findIndex((pair) => pair?.includes(id)) + 1;\n const pair = this.pairs[number - 1] ?? null;\n const turned = pair === null && this.#open[side] === id;\n const up = pair !== null || turned || this.solution !== null;\n // Where pairs are marked one by one, a card left without a pair shows \"no answer\" (dotted), as in every type.\n const marked = Object.keys(this.feedback?.slots ?? {}).length > 0;\n const verdict = pair === null ? (marked ? 'empty' : null) : this.slotVerdict(pair[0]);\n const correct = side === 'a' ? this.solution?.[id] : undefined;\n const answer = correct === pair?.[1] ? undefined : this.cards.find((c) => c.id === correct);\n const refs = [verdict && `verdict-${i}`, answer && `solution-${i}`].filter(Boolean).join(' ');\n // Face up, the face follows the name: \"Card 3, set A, pair 1:\" then what the card shows.\n const name = up\n ? this.t('ui.cardUp', {\n number: i + 1,\n set: this.t(`ui.set.${side}`),\n state: pair === null ? this.t('ui.notPaired') : this.t('ui.paired', { number }),\n })\n : this.#name(card, i);\n return html`<div\n class=\"card astl-box astl-ring\"\n part=\"card\"\n data-palette=${ifDefined(pair === null ? undefined : ((number - 1) % 8) + 1)}\n data-verdict=${ifDefined(verdict ?? undefined)}\n ?data-up=${up}\n ?data-open=${turned}\n >\n <button\n type=\"button\"\n data-item=${id}\n data-index=${i}\n aria-pressed=${up ? 'true' : 'false'}\n aria-describedby=${refs || nothing}\n tabindex=${this.disabled ? -1 : this.#roving.tabIndex(i)}\n ?disabled=${this.disabled}\n @click=${() => this.#press(card, i)}\n @keydown=${(event: KeyboardEvent) => this.#roving.keydown(event, i)}\n >\n <span class=\"astl-vh\" lang=${ui.lang} dir=${ui.dir}>${name}</span>\n <span class=\"back\" part=\"back\" aria-hidden=\"true\" lang=${ui.lang}>${this.t(`ui.set.${side}`)}</span>\n <span class=\"face\" part=\"face\"><slot data-card=${id}></slot></span>\n ${pair === null ? nothing : html`<span class=\"number\" part=\"number\" aria-hidden=\"true\">${number}</span>`}\n </button>\n ${this.renderVerdict(verdict, { hiddenWord: true, id: `verdict-${i}` })}\n ${\n answer === undefined\n ? nothing\n : // A UI sentence around a content name: it reads in the UI's direction, the name keeps its language.\n html`<p class=\"astl-solution\" part=\"solution\" id=\"solution-${i}\" data-card=${answer.id} lang=${ui.lang} dir=${ui.dir}>\n ${verdictIcon('correct')}<span class=\"astl-solution-label\">${this.t('ui.solution')}</span>\n <bdi lang=${ifDefined(this.contentLang || undefined)}>${labelOf(answer)}</bdi>\n </p>`\n }\n </div>`;\n }\n\n // Turning and pairing\n\n get #root(): ShadowRoot {\n return this.renderRoot as ShadowRoot;\n }\n\n /** A locked element turns nothing over: only its pairs show. */\n get #open(): Open {\n return this.disabled ? CLOSED : this.open;\n }\n\n #name(card: Element, i: number): string {\n return this.t('ui.card', { number: i + 1, set: this.t(`ui.set.${sideOf(card)}`) });\n }\n\n #label(id: string): string {\n return labelOf(this.cards.find((card) => card.id === id));\n }\n\n /** `ui.announce.pair` or `unpair`: the pair's number and faces, and how many pairs there are now. */\n #sayPair(key: 'pair' | 'unpair', number: number, [a, b]: Pair): void {\n const paired = this.pairs.filter((pair) => pair !== null).length;\n const params = { number, a: this.#label(a), b: this.#label(b), paired, total: this.slotIds.length };\n this.announce(this.t(`ui.announce.${key}`, params));\n }\n\n /** A press on a card: a paired one undoes its pair; else it turns over (back down when it was face up). */\n #press(card: HTMLElement, i: number): void {\n if (this.disabled) return;\n this.#roving.focus(i);\n const number = this.pairs.findIndex((pair) => pair?.includes(card.id)) + 1;\n const pair = this.pairs[number - 1];\n if (pair) {\n this.pairs = this.pairs.map((p) => (p === pair ? null : p));\n this.emitChange({ [pair[0]]: '' });\n this.#sayPair('unpair', number, pair);\n return;\n }\n const side = sideOf(card);\n const open = { ...this.open, [side]: this.open[side] === card.id ? null : card.id };\n this.open = open;\n const said = { card: this.#name(card, i), label: labelOf(card) };\n const key = open[side] === null ? 'down' : open.a !== null && open.b !== null ? 'decide' : 'turn';\n this.announce(this.t(`ui.announce.${key}`, said));\n }\n\n /** Pairs the two face-up cards; the focus goes back to the grid. */\n #confirm = (): void => {\n const { a, b } = this.#open;\n if (a === null || b === null) return;\n this.pairs = placed(this.pairs, [a, b]);\n this.open = CLOSED;\n this.emitChange({ [a]: b });\n this.#sayPair('pair', this.pairs.findIndex((pair) => pair?.[0] === a) + 1, [a, b]);\n this.#roving.focus(this.#roving.active);\n };\n\n #turnBack = (): void => {\n this.open = CLOSED;\n this.announce(this.t('ui.announce.back'));\n this.#roving.focus(this.#roving.active);\n };\n}\n\nexport const memoryElement: ElementRegistration = {\n manifest: memoryManifest,\n element: MemoryElement,\n messages: memoryUiMessages,\n};\n"],"mappings":"A,yPAIA,IAAMkB,EAAY,cAMLC,EAA8C,CACzD,CAAE,YAAW,OAAQ,KAAM,SAAUnB,CAAG,EACxC,CAAE,YAAW,OAAQ,KAAM,SAAUC,CAAG,CAC1C,ECWMmB,EAAe,CAAE,EAAG,KAAM,EAAG,IAAK,EAElCC,EAAU,GAAy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CAAE,GAAG,KAAK,MAAOM,GAAO,KAAK,KAAKA,KAAU3B,EAAK,GAAK,KAAOA,EAAK,EAAG,EAClF,KAAK,KAAOqB,EACZ,IAAM0B,EAAO,CAAE,KAAM,KAAKT,GAAMtC,EAAMV,CAAC,EAAG,MAAOa,EAAQH,CAAI,CAAE,EACzD6C,EAAMxB,EAAKM,KAAU,KAAO,OAASN,EAAK,IAAM,MAAQA,EAAK,IAAM,KAAO,SAAW,OAC3F,KAAK,SAAS,KAAK,EAAE,eAAewB,IAAOE,CAAI,CAAC,CAClD,CAGA,OAAuB,CACrB,GAAM,CAAE,IAAG,KAAM,KAAKzB,GAClBmB,IAAM,MAAQzD,IAAM,OACxB,KAAK,MAAQoB,EAAO,KAAK,MAAO,CAACqC,EAAGzD,CAAC,CAAC,EACtC,KAAK,KAAOc,EACZ,KAAK,WAAW,EAAG2C,GAAIzD,CAAE,CAAC,EAC1B,KAAK8D,GAAS,OAAQ,KAAK,MAAM,UAAW,GAASvC,IAAO,KAAOkC,CAAC,EAAI,EAAG,CAACA,EAAGzD,CAAC,CAAC,EACjF,KAAK2B,GAAQ,MAAM,KAAKA,GAAQ,MAAM,EACxC,EAEA,OAAwB,CACtB,KAAK,KAAOb,EACZ,KAAK,SAAS,KAAK,EAAE,kBAAkB,CAAC,EACxC,KAAKa,GAAQ,MAAM,KAAKA,GAAQ,MAAM,CACxC,CACF,EAEaqC,EAAqC,CAChD,SAAUxD,EACV,QAASiB,EACT,SAAUZ,CACZ,E"}
|
|
1
|
+
{"version":3,"file":"memory-BgTHujsU.js","names":["en","pl","LitElement","unsafeCSS","nothing","ifDefined","b","r","i$1","A","verdictIcon","AstlElement","i","en_default","memoryManifest","pl_default","RovingFocus","blockStyles","namespace","memoryUiMessages","CLOSED","sideOf","card","words","node","labelOf","placed","free","pairs","pair","p","MemoryElement","element","#roving","#root","grid","child","rights","now","given","answers","slot","ui","open","#open","#renderCard","#confirm","#turnBack","id","side","number","turned","up","marked","verdict","correct","answer","c","refs","name","#name","#press","event","a","paired","params","#label","key","#sayPair","said","memoryElement"],"sources":["../../../../components/src/memory/ui-messages.ts","../../../../components/src/memory/element.ts"],"sourcesContent":["import type { MessageCatalog } from '@astl/core';\nimport en from './messages/ui/en.json' with { type: 'json' };\nimport pl from './messages/ui/pl.json' with { type: 'json' };\n\nconst namespace = 'astl.memory';\n\n/**\n * The student strings (`ui.*`): the element's catalogs. A module of their own, because bundlers split by module: one\n * that also built `memoryMessages` would put the authoring strings into the element's chunk.\n */\nexport const memoryUiMessages: readonly MessageCatalog[] = [\n { namespace, locale: 'en', messages: en },\n { namespace, locale: 'pl', messages: pl },\n];\n","import type { Answers, ComponentManifest, MessageCatalog, Units } from '@astl/core';\nimport { AstlElement, type ElementRegistration, verdictIcon } from '@astl/player';\nimport { RovingFocus } from '@astl/player/interaction';\nimport {\n type CSSResultGroup,\n css,\n html,\n LitElement,\n nothing,\n type PropertyDeclarations,\n type TemplateResult,\n unsafeCSS,\n} from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { blockStyles } from '../block-styles.js';\nimport { memoryManifest } from './manifest.js';\nimport { memoryUiMessages } from './ui-messages.js';\n\ntype Side = 'a' | 'b';\n/** A set A card and the set B card paired with it. */\ntype Pair = readonly [string, string];\n/** The face-up card of each set that is not paired yet. */\ntype Open = Readonly<Record<Side, string | null>>;\n\nconst CLOSED: Open = { a: null, b: null };\n\nconst sideOf = (card: Element): Side => (card.localName === 'astl-card-a' ? 'a' : 'b');\nconst words = (node: Node): string =>\n node instanceof HTMLImageElement\n ? ` ${node.alt} `\n : node.nodeType === Node.TEXT_NODE\n ? (node.textContent ?? '')\n : [...node.childNodes].map(words).join('');\n/** What a face says: its text and the alt text of its pictures. */\nconst labelOf = (card: Element | undefined): string => (card ? words(card) : '').replace(/\\s+/g, ' ').trim();\n\n/** `pairs` with `pair` at the smallest free number. */\nfunction placed(pairs: readonly (Pair | null)[], pair: Pair): (Pair | null)[] {\n const free = pairs.indexOf(null);\n return free < 0 ? [...pairs, pair] : pairs.map((p, i) => (i === free ? pair : p));\n}\n\n/**\n * `<astl-memory>`: cards lie face down in a grid, each back showing its set (A or B). The student turns one card of\n * each set; while both are face up, \"Confirm\" pairs them and \"Turn back\" turns them back. Turning another card of a\n * set replaces that set's face-up card, and pressing a paired card undoes its pair. Pairs are never checked live.\n * Slots: one per set A card (its id), answered with the id of the set B card paired with it.\n *\n * Cards are toggle buttons (pressed = face up) with one tab stop for the grid: the arrow keys move it (RovingFocus,\n * wrapping in reading order). A pair keeps its number and palette colour until it is undone; a new pair takes the\n * smallest free number. The light-DOM `<astl-prompt>` and cards are slotted manually and never moved or changed.\n */\nexport class MemoryElement extends AstlElement {\n static override manifest: ComponentManifest = memoryManifest;\n static override messages: readonly MessageCatalog[] = memoryUiMessages;\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n slotAssignment: 'manual',\n };\n\n static override properties: PropertyDeclarations = {\n pairs: { state: true },\n open: { state: true },\n };\n\n static override styles: CSSResultGroup = [\n // Every card the same size (equal rows and columns), so a face-down card never hints at its face or its partner;\n // rows a little apart: the number and the verdict of a card sit on its top edge. Columns at least 8rem, and at\n // least a fifth of the width less the gaps (four columns in the player's column), so long faces keep a few words a\n // line. With the solution every card is face up: rows take the height of their own cards, so a solution line\n // grows its row only. A card is face down (the back: its set letter on the accent fill), turned (the selected\n // look; in hc also a bar and bold text) or paired (its pair's palette colour and number).\n css`\n .cards {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(min(100%, max(8rem, 22%)), 1fr));\n grid-auto-rows: 1fr;\n gap: var(--astl-space-5) var(--astl-space-3);\n padding-block-start: var(--astl-space-3);\n overflow-wrap: anywhere;\n hyphens: auto;\n }\n .cards[data-solution] {\n grid-auto-rows: auto;\n }\n .card {\n position: relative;\n display: flex;\n flex-direction: column;\n min-inline-size: 0;\n border: var(--astl-outline-width) solid var(--astl-outline);\n border-radius: var(--astl-radius-m);\n background: var(--astl-accent-soft);\n }\n .card[data-up] {\n background: var(--astl-surface);\n }\n .card[data-open] {\n border-color: var(--astl-selected);\n background: var(--astl-selected-soft);\n font-weight: var(--astl-selected-weight);\n }\n .card[data-open]::before {\n content: '';\n position: absolute;\n inset-block: 0;\n inset-inline-start: 0;\n inline-size: var(--astl-selected-bar);\n background: var(--astl-selected);\n }\n .card[data-palette] {\n border-color: var(--astl-memory-ink);\n background: var(--astl-memory-soft);\n }\n .card > button {\n flex: 1 1 auto;\n display: grid;\n min-block-size: 5.5rem;\n margin: 0;\n padding: var(--astl-space-3);\n border: 0;\n background: none;\n color: inherit;\n font: inherit;\n cursor: pointer;\n touch-action: manipulation;\n }\n .card > button:disabled {\n cursor: default;\n }\n .back,\n .face {\n grid-area: 1 / 1;\n display: grid;\n place-content: center;\n min-inline-size: 0;\n text-align: center;\n }\n .back {\n color: var(--astl-accent);\n font-size: 1.75rem;\n font-weight: 700;\n }\n .face,\n [aria-pressed='true'] > .back {\n visibility: hidden;\n }\n [aria-pressed='true'] > .face {\n visibility: visible;\n animation: turn var(--astl-duration-normal) ease-out;\n }\n @keyframes turn {\n from {\n transform: rotateY(90deg);\n }\n }\n @media (prefers-reduced-motion: reduce) {\n [aria-pressed='true'] > .face {\n animation: none;\n }\n }\n `,\n // Stickers on the top edge of a card: its pair number at the inline start, its verdict icon at the inline end.\n // The solution line (block-styles.ts) closes a set A card; the buttons that confirm or turn back follow the grid,\n // kept in view.\n css`\n .number,\n .card > .astl-verdict {\n position: absolute;\n inset-block-start: 0;\n translate: 0 -50%;\n border-radius: var(--astl-radius-pill);\n background: var(--astl-surface);\n font-size: var(--astl-size-small);\n }\n .number {\n inset-inline-start: var(--astl-space-2);\n min-inline-size: 1.5rem;\n padding-inline: var(--astl-space-1);\n border: var(--astl-outline-width) solid var(--astl-memory-ink);\n background: var(--astl-memory-soft);\n color: var(--astl-memory-ink);\n font-weight: 700;\n line-height: 1.4;\n }\n .card > .astl-verdict {\n inset-inline-end: var(--astl-space-2);\n padding: 0.125rem;\n }\n .card > .astl-solution {\n padding-inline: var(--astl-space-2);\n padding-block-end: var(--astl-space-2);\n text-align: center;\n }\n .actions {\n position: sticky;\n inset-block-end: 0;\n display: flex;\n flex-wrap: wrap;\n gap: var(--astl-space-2);\n margin-block-start: var(--astl-space-3);\n padding-block: var(--astl-space-2);\n background: var(--astl-surface);\n }\n .actions > button {\n min-inline-size: var(--astl-target-min);\n min-block-size: var(--astl-target-min);\n padding-inline: var(--astl-space-4);\n border: var(--astl-outline-width) solid var(--astl-outline);\n border-radius: var(--astl-radius-m);\n background: var(--astl-surface);\n color: var(--astl-ink);\n font: inherit;\n font-weight: 600;\n cursor: pointer;\n }\n .group-verdict {\n margin-block: var(--astl-space-3) 0;\n }\n `,\n // Palette slots of pairs, through an attribute: a strict Content Security Policy blocks inline style attributes.\n unsafeCSS(\n Array.from(\n { length: 8 },\n (_, i) =>\n `[data-palette='${i + 1}']{--astl-memory-ink:var(--astl-palette-${i + 1});--astl-memory-soft:var(--astl-palette-${i + 1}-soft)}`,\n ).join(''),\n ),\n blockStyles,\n ];\n\n /** Pair n at index n - 1 (its number and palette slot); null where a pair was undone, so the others keep theirs. */\n declare protected pairs: readonly (Pair | null)[];\n declare protected open: Open;\n\n /** One tab stop for the grid; the arrow keys follow the columns as laid out now, which change with the width. */\n readonly #roving: RovingFocus;\n\n constructor() {\n super();\n this.pairs = [];\n this.open = CLOSED;\n const element = this;\n this.#roving = new RovingFocus(this, {\n count: () => this.cards.length,\n item: (i) => this.#root.querySelector<HTMLButtonElement>(`button[data-index=\"${i}\"]`),\n axis: 'grid',\n wrap: true,\n get columns() {\n const grid = element.#root.querySelector('.cards');\n return grid === null ? 1 : getComputedStyle(grid).gridTemplateColumns.split(' ').length;\n },\n });\n }\n\n /** Both sets' cards in rendered order: view order, or shuffled per attempt with a seed. */\n get cards(): readonly HTMLElement[] {\n return this.shuffled(\n Array.from(this.children).filter(\n (child): child is HTMLElement =>\n (child.localName === 'astl-card-a' || child.localName === 'astl-card-b') && child.id !== '',\n ),\n );\n }\n\n get slotIds(): readonly string[] {\n return this.cards.filter((card) => sideOf(card) === 'a').map((card) => card.id);\n }\n\n getAnswers(): Answers {\n return Object.fromEntries(this.pairs.filter((pair) => pair !== null));\n }\n\n /**\n * Pairs set from outside, in reading order: '' or an unknown card leaves a set A card unpaired, and a set B card\n * that is paired already keeps its first pair (a restored attempt cannot use a card twice).\n */\n setAnswers(answers: Answers): void {\n const rights = new Set(this.cards.filter((card) => sideOf(card) === 'b').map((card) => card.id));\n const now = this.getAnswers();\n const given = this.slotIds.filter(\n (slot) => Object.hasOwn(answers, slot) && answers[slot] !== (now[slot] ?? ''),\n );\n let pairs = this.pairs.map((pair) => (pair !== null && given.includes(pair[0]) ? null : pair));\n for (const slot of given) {\n const card = answers[slot] ?? '';\n if (rights.has(card) && !pairs.some((pair) => pair?.[1] === card)) pairs = placed(pairs, [slot, card]);\n }\n this.pairs = pairs;\n this.open = CLOSED;\n }\n\n units(): Units {\n return { answered: this.pairs.filter((pair) => pair !== null).length, total: this.slotIds.length };\n }\n\n protected override render(): TemplateResult {\n const ui = this.uiLanguage;\n const open = this.#open;\n return html`<fieldset part=\"memory\">\n <legend part=\"prompt\">\n <slot data-tag=\"astl-prompt\"></slot>\n <span class=\"hint\" lang=${ui.lang}><bdi>${this.t('ui.hint')}</bdi></span>\n </legend>\n <div class=\"cards\" part=\"cards\" ?data-solution=${this.solution !== null}>\n ${this.cards.map((card, i) => this.#renderCard(card, i))}\n </div>\n ${\n open.a === null || open.b === null\n ? nothing\n : html`<div class=\"actions\" part=\"actions\" lang=${ui.lang} dir=${ui.dir}>\n <button type=\"button\" @click=${this.#confirm}>${this.t('ui.confirm')}</button>\n <button type=\"button\" @click=${this.#turnBack}>${this.t('ui.turnBack')}</button>\n </div>`\n }\n ${this.renderGroupVerdict()}\n </fieldset>`;\n }\n\n /**\n * A card: named by its number and set; face up, also by its face and whether it is paired. A paired card shows its\n * pair's verdict; a set A card with a solution that differs from its pair shows the set B card it belongs with.\n */\n #renderCard(card: HTMLElement, i: number): TemplateResult {\n const ui = this.uiLanguage;\n const id = card.id;\n const side = sideOf(card);\n const number = this.pairs.findIndex((pair) => pair?.includes(id)) + 1;\n const pair = this.pairs[number - 1] ?? null;\n const turned = pair === null && this.#open[side] === id;\n const up = pair !== null || turned || this.solution !== null;\n // Where pairs are marked one by one, a card left without a pair shows \"no answer\" (dotted), as in every type.\n const marked = Object.keys(this.feedback?.slots ?? {}).length > 0;\n const verdict = pair === null ? (marked ? 'empty' : null) : this.slotVerdict(pair[0]);\n const correct = side === 'a' ? this.solution?.[id] : undefined;\n const answer = correct === pair?.[1] ? undefined : this.cards.find((c) => c.id === correct);\n const refs = [verdict && `verdict-${i}`, answer && `solution-${i}`].filter(Boolean).join(' ');\n // Face up, the face follows the name: \"Card 3, set A, pair 1:\" then what the card shows.\n const name = up\n ? this.t('ui.cardUp', {\n number: i + 1,\n set: this.t(`ui.set.${side}`),\n state: pair === null ? this.t('ui.notPaired') : this.t('ui.paired', { number }),\n })\n : this.#name(card, i);\n return html`<div\n class=\"card astl-box astl-ring\"\n part=\"card\"\n data-palette=${ifDefined(pair === null ? undefined : ((number - 1) % 8) + 1)}\n data-verdict=${ifDefined(verdict ?? undefined)}\n ?data-up=${up}\n ?data-open=${turned}\n >\n <button\n type=\"button\"\n data-item=${id}\n data-index=${i}\n aria-pressed=${up ? 'true' : 'false'}\n aria-describedby=${refs || nothing}\n tabindex=${this.disabled ? -1 : this.#roving.tabIndex(i)}\n ?disabled=${this.disabled}\n @click=${() => this.#press(card, i)}\n @keydown=${(event: KeyboardEvent) => this.#roving.keydown(event, i)}\n >\n <span class=\"astl-vh\" lang=${ui.lang} dir=${ui.dir}>${name}</span>\n <span class=\"back\" part=\"back\" aria-hidden=\"true\" lang=${ui.lang}>${this.t(`ui.set.${side}`)}</span>\n <span class=\"face\" part=\"face\"><slot data-card=${id}></slot></span>\n ${pair === null ? nothing : html`<span class=\"number\" part=\"number\" aria-hidden=\"true\">${number}</span>`}\n </button>\n ${this.renderVerdict(verdict, { hiddenWord: true, id: `verdict-${i}` })}\n ${\n answer === undefined\n ? nothing\n : // A UI sentence around a content name: it reads in the UI's direction, the name keeps its language.\n html`<p class=\"astl-solution\" part=\"solution\" id=\"solution-${i}\" data-card=${answer.id} lang=${ui.lang} dir=${ui.dir}>\n ${verdictIcon('correct')}<span class=\"astl-solution-label\">${this.t('ui.solution')}</span>\n <bdi lang=${ifDefined(this.contentLang || undefined)}>${labelOf(answer)}</bdi>\n </p>`\n }\n </div>`;\n }\n\n // Turning and pairing\n\n get #root(): ShadowRoot {\n return this.renderRoot as ShadowRoot;\n }\n\n /** A locked element turns nothing over: only its pairs show. */\n get #open(): Open {\n return this.disabled ? CLOSED : this.open;\n }\n\n #name(card: Element, i: number): string {\n return this.t('ui.card', { number: i + 1, set: this.t(`ui.set.${sideOf(card)}`) });\n }\n\n #label(id: string): string {\n return labelOf(this.cards.find((card) => card.id === id));\n }\n\n /** `ui.announce.pair` or `unpair`: the pair's number and faces, and how many pairs there are now. */\n #sayPair(key: 'pair' | 'unpair', number: number, [a, b]: Pair): void {\n const paired = this.pairs.filter((pair) => pair !== null).length;\n const params = { number, a: this.#label(a), b: this.#label(b), paired, total: this.slotIds.length };\n this.announce(this.t(`ui.announce.${key}`, params));\n }\n\n /** A press on a card: a paired one undoes its pair; else it turns over (back down when it was face up). */\n #press(card: HTMLElement, i: number): void {\n if (this.disabled) return;\n this.#roving.focus(i);\n const number = this.pairs.findIndex((pair) => pair?.includes(card.id)) + 1;\n const pair = this.pairs[number - 1];\n if (pair) {\n this.pairs = this.pairs.map((p) => (p === pair ? null : p));\n this.emitChange({ [pair[0]]: '' });\n this.#sayPair('unpair', number, pair);\n return;\n }\n const side = sideOf(card);\n const open = { ...this.open, [side]: this.open[side] === card.id ? null : card.id };\n this.open = open;\n const said = { card: this.#name(card, i), label: labelOf(card) };\n const key = open[side] === null ? 'down' : open.a !== null && open.b !== null ? 'decide' : 'turn';\n this.announce(this.t(`ui.announce.${key}`, said));\n }\n\n /** Pairs the two face-up cards; the focus goes back to the grid. */\n #confirm = (): void => {\n const { a, b } = this.#open;\n if (a === null || b === null) return;\n this.pairs = placed(this.pairs, [a, b]);\n this.open = CLOSED;\n this.emitChange({ [a]: b });\n this.#sayPair('pair', this.pairs.findIndex((pair) => pair?.[0] === a) + 1, [a, b]);\n this.#roving.focus(this.#roving.active);\n };\n\n #turnBack = (): void => {\n this.open = CLOSED;\n this.announce(this.t('ui.announce.back'));\n this.#roving.focus(this.#roving.active);\n };\n}\n\nexport const memoryElement: ElementRegistration = {\n manifest: memoryManifest,\n element: MemoryElement,\n messages: memoryUiMessages,\n};\n"],"mappings":"A,yPAIA,IAAMkB,EAAY,cAMLC,EAA8C,CACzD,CAAE,YAAW,OAAQ,KAAM,SAAUnB,CAAG,EACxC,CAAE,YAAW,OAAQ,KAAM,SAAUC,CAAG,CAC1C,ECWMmB,EAAe,CAAE,EAAG,KAAM,EAAG,IAAK,EAElCC,EAAU,GAAyBC,EAAK,YAAc,cAAgB,IAAM,IAC5EC,EAAS,GACbC,aAAgB,iBACZ,IAAIA,EAAK,IAAI,GACbA,EAAK,WAAa,KAAK,UACpBA,EAAK,aAAe,GACrB,CAAC,GAAGA,EAAK,UAAU,CAAC,CAAC,IAAID,CAAK,CAAC,CAAC,KAAK,EAAE,EAEzCE,EAAW,IAAuCH,EAAOC,EAAMD,CAAI,EAAI,GAAA,CAAI,QAAQ,OAAQ,GAAG,CAAC,CAAC,KAAK,EAG3G,SAASI,EAAO,EAAiC,EAA6B,CAC5E,IAAMC,EAAOC,EAAM,QAAQ,IAAI,EAC/B,OAAOD,EAAO,EAAI,CAAC,GAAGC,EAAOC,CAAI,EAAID,EAAM,KAAK,EAAG,IAAOhB,IAAMe,EAAOE,EAAOC,CAAE,CAClF,CAYA,IAAaC,EAAb,cAAmCpB,CAAY,CAC7C,OAAgB,SAA8BG,EAC9C,OAAgB,SAAsCK,EACtD,OAAgB,kBAAoC,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UAAW,GAASvC,IAAO,KAAOkC,CAAC,EAAI,EAAG,CAACA,EAAGzD,CAAC,CAAC,EACjF,KAAK2B,GAAQ,MAAM,KAAKA,GAAQ,MAAM,EACxC,EAEA,OAAwB,CACtB,KAAK,KAAOb,EACZ,KAAK,SAAS,KAAK,EAAE,kBAAkB,CAAC,EACxC,KAAKa,GAAQ,MAAM,KAAKA,GAAQ,MAAM,CACxC,CACF,EAEaqC,EAAqC,CAChD,SAAUxD,EACV,QAASiB,EACT,SAAUZ,CACZ,E"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={"insert.title":`Insert`,"insert.components":`Components`,"insert.exercises":`Exercises`,"insert.content":`Content`,"insert.picture":`Picture`,"insert.picture.description":`A picture with alt text and an optional caption`,"insert.pageBreak":`Page break`,"insert.pageBreak.description":`Split the exercise into steps at the cursor`,"insert.hint":`Hint`,"insert.hint.description":`One students ask for: for the question at the cursor, else for the page`,"insert.explanation":`Explanation`,"insert.explanation.description":`Why the answer is right, shown once it is checked`,"insert.feedback":`Feedback`,"insert.feedback.description":`A text by the verdict, shown once the answer is checked`,"insert.text":`Text`,"insert.text.description":`A paragraph after this block`,"insert.noMatch":`Nothing matches “{query}”.`,"toolbar.label":`Format and insert`,"toolbar.style":`Text style: {style}`,"toolbar.paragraph":`Paragraph`,"toolbar.heading":`Heading`,"toolbar.subheading":`Subheading`,"toolbar.bold":`Bold`,"toolbar.italic":`Italic`,"toolbar.underline":`Underline`,"toolbar.link":`Link`,"toolbar.link.address":`Link address`,"toolbar.link.apply":`Apply`,"toolbar.link.remove":`Remove link`,"toolbar.link.blocked":`This address is not allowed here.`,"toolbar.bulleted":`Bulleted list`,"toolbar.numbered":`Numbered list`,"toolbar.undo":`Undo`,"toolbar.redo":`Redo`,"toolbar.elements":`Elements`,"toolbar.templates":`Templates`,"toolbar.layouts":`Layout`,"toolbar.view":`View`,"toolbar.search":`Search`,"block.text":`Text`,"block.gap":`Gap`,"issue.onPage":`{n} on page {page}`,"picture.title":`Add a picture`,"picture.editTitle":`Edit the picture`,"picture.file":`Upload a picture`,"picture.library":`Choose from the library`,"picture.urlOnly":`This editor adds pictures by their address only: it has no upload.`,"picture.src":`Picture address (URL)`,"picture.alt":`Alt text`,"picture.altHelp":`What the picture shows, for students who cannot see it. Do not give an answer away.`,"picture.decorative":`Decorative: screen readers skip it (alt="")`,"picture.caption":`Caption (optional)`,"picture.cancel":`Cancel`,"picture.insert":`Insert`,"picture.save":`Save`,"picture.uploading":`Uploading…`,"picture.uploaded":`Uploaded.`,"picture.uploadFailed":`The upload failed. Try again, or give the picture's address.`,"picture.uploadBlocked":`The upload gave an address the URL policy does not allow.`,"picture.picked":`Chosen from the library.`,"picture.pickFailed":`The library did not open. Try again, or give the picture's address.`,"picture.pickBlocked":`The library returned an address the URL policy does not allow.`,"picture.srcMissing":`Give the picture's address, or upload it.`,"picture.srcBlocked":`The URL policy does not allow this address.`,"picture.altMissing":`Describe the picture, or mark it as decorative.`,"picture.altRequired":`Describe the picture: students who cannot see it need its alt text for the task.`,"picture.pasteRefused":`This editor has no upload, so a picture file cannot be pasted or dropped. Add it with Insert, Picture, by its address.`,"field.picture.src":`Picture address (URL)`,"field.regions.draw":`Drag on the picture to draw a zone, or add one and type its numbers.`,"field.points.place":`Click the picture to place a pin, or add one and type its position.`,"field.region":`Zone {n}`,"field.region.add":`Add a zone`,"field.region.remove":`Remove zone {n}`,"field.point":`Pin {n}`,"field.point.add":`Add a pin`,"field.point.remove":`Remove pin {n}`,"field.shape":`Shape`,"field.shape.rect":`Rectangle`,"field.shape.circle":`Circle`,"field.shape.polygon":`Polygon`,"field.x":`From the left (%)`,"field.y":`From the top (%)`,"field.width":`Width (%)`,"field.height":`Height (%)`,"field.cx":`Centre from the left (%)`,"field.cy":`Centre from the top (%)`,"field.r":`Radius (% of the width)`,"field.vertex.x":`Point {n} from the left (%)`,"field.vertex.y":`Point {n} from the top (%)`,"field.vertex.add":`Add a point`,"field.vertex.remove":`Remove point {n}`,"field.label":`Label`,"field.label.optional":`Label (optional)`,"field.more":`Only the first {shown} of {count} are listed here: edit the others in the source.`,"inspector.title":`Properties`,"inspector.delete":`Delete`,"inspector.moveUp":`Move up`,"inspector.moveDown":`Move down`,"inspector.empty":`Put the cursor in an exercise element to edit its answers and settings.`,"inspector.unsupported":`Element {tag} cannot be edited here.`,"inspector.unset":`(not set)`,"inspector.item":`{label} {n}`,"inspector.add":`Add`,"inspector.remove":`Remove`,"inspector.removeItem":`Remove: {label} {n}`,"inspector.untitled":`Item {n} (empty)`,"inspector.variant":`Variant`,"inspector.styleTemplate":`Element style`,"inspector.styleTemplate.inherit":`Same as the exercise`,"inspector.styleTemplate.default":`Default look`,"inspector.document":`Exercise`,"inspector.documentStyle":`Look of the whole exercise`,"inspector.upload":`Upload a file`,"inspector.uploadItem":`Upload a file: {label}`,"inspector.uploading":`Uploading…`,"inspector.uploaded":`Uploaded.`,"inspector.uploadFailed":`The upload failed. Try again, or type its address.`,"inspector.uploadBlocked":`The upload gave an address the URL policy does not allow.`,"issues.title":`Problems`,"issues.errors":`{count, plural, one {# error} other {# errors}}`,"issues.warnings":`{count, plural, one {# warning} other {# warnings}}`,"issues.summary":`{errors}, {warnings}`,"issues.none":`No errors or warnings.`,"severity.error":`Error`,"severity.warning":`Warning`,"label.text":`{label}: {text}`,"preview.title":`Student view`,"preview.show":`Preview`,"preview.refresh":`Refresh preview`,"preview.hint":`Press Preview to try the exercise the way a student will see it.`,"preview.loading":`Preparing the preview…`,"preview.stale":`The document changed after this preview. Refresh it to see the changes.`,"preview.invalid":`{count, plural, one {Fix this error to see the preview:} other {Fix these # errors to see the preview:}}`,"preview.failed":`The preview could not be shown.`,"surface.label":`Exercise content`,"surface.pageNumber":`Page {page} of {pages}`,"surface.pageTitle":`Page title`,"surface.pageJoin":`Join with page {previous}`,"surface.pageAdded":`Page {page} added`,"surface.pageJoined":`Page {page} joined with page {previous}`,"surface.pageDelete":`Delete page`,"surface.pageDeleted":`Deleted page {n}`,"surface.pageAddTitle":`Add title`,"surface.pageRemoveTitle":`Remove title`,"surface.pageTitleOf":`Title of page {page}`,"surface.pageTitleRemoved":`Removed the title of page {page}`,"surface.points":`{points, plural, one {# pt} other {# pts}}`,"surface.items":`{n, plural, one {# item} other {# items}}`,"surface.blockMovedUp":`Block moved up, now block {n}`,"surface.blockMovedDown":`Block moved down, now block {n}`,"surface.blockRemoved":`Block {n} deleted`,"surface.addOption":`Add option`,"surface.addPrompt":`Add prompt`,"surface.chip.empty":`No answer`,"surface.chip.more":`+{n}`,"surface.picture.alt":`Picture: {alt}`,"surface.picture.decorative":`Picture, decorative (no alt text)`,"surface.picture.noAlt":`Picture without alt text`,"surface.picture.blocked":`(not shown: the URL policy does not allow its address)`,"surface.picture.edit":`Edit`,"surface.loading":`Loading the editor…`,"surface.failed":`The editor could not be loaded. Reload the page to try again.`,"view.visual":`Visual`,"view.source":`HTML`,"view.visualHint":`Edit the exercise as formatted text`,"view.sourceHint":`Edit the exercise as HTML`,"view.sourceLabel":`The exercise as HTML`,"view.sourceErrors":`{n, plural, one {The HTML has # error. Fix it to go back.} other {The HTML has # errors. Fix them to go back.}}`,"status.elements":`{n, plural, one {# element} other {# elements}}`,"status.errors":`{n, plural, one {# error} other {# errors}}`,"status.warnings":`{n, plural, one {# warning} other {# warnings}}`,"status.ready":`Ready to share`,"insert.layouts":`Layout`,"insert.layout.two":`Two columns`,"insert.layout.two.description":`Two columns of the same width.`,"insert.layout.three":`Three columns`,"insert.layout.three.description":`Three columns of the same width.`,"insert.layout.wide-narrow":`Wide + narrow`,"insert.layout.wide-narrow.description":`A wide column, then a narrow one.`,"insert.layout.narrow-wide":`Narrow + wide`,"insert.layout.narrow-wide.description":`A narrow column, then a wide one.`,"insert.layout.picture-text":`Picture beside text`,"insert.layout.picture-text.description":`A picture you choose, with text next to it.`,"layout.section":`Columns`,"layout.change":`Change layout`,"layout.other":`Another layout`,"layout.unwrap":`Remove layout`,"layout.delete":`Delete with content`,"layout.confirm":`Delete the layout and its content?`,"layout.confirmDelete":`Yes, delete`,"layout.cancel":`Cancel`,"toolbar.font":`Font: {value}`,"toolbar.font.name":`Font`,"toolbar.size":`Size: {value}`,"toolbar.size.name":`Size`,"toolbar.color":`Text colour`,"toolbar.highlight":`Highlight`,"toolbar.align":`Alignment`,"toolbar.align.start":`Left`,"toolbar.align.center":`Centre`,"toolbar.align.end":`Right`,"toolbar.align.justify":`Justified`,"toolbar.spacing":`Spacing`,"toolbar.spacing.line":`Line height`,"toolbar.spacing.after":`Space after`,"toolbar.spacing.none":`None`,"toolbar.spacing.small":`Small`,"toolbar.spacing.medium":`Medium`,"toolbar.spacing.large":`Large`,"toolbar.clear":`Clear formatting`,"toolbar.default":`Default`,"toolbar.myStyles":`My styles`,"toolbar.readyStyles":`Ready styles`,"style.preset.note":`Note`,"style.preset.tip":`Tip`,"style.preset.important":`Important`,"style.preset.definition":`Definition`,"style.preset.example":`Example`,"style.preset.quote":`Quote`,"style.preset.highlight":`Highlight`,"style.preset.small-print":`Small print`,"style.color.theme":`Theme colours`,"style.color.swatch":`Theme colour {n}`,"style.color.custom":`Custom colour`,"style.color.picker":`Pick a colour`,"style.color.invalid":`Write a colour as #rrggbb.`,"style.color.none":`No colour`,"style.close":`Close`,"style.form.none":`Put the cursor in what you want to style.`,"style.target.picture":`Picture style`,"style.target.figure":`Picture and caption style`,"style.target.block":`Block style`,"style.target.component":`Element style`,"style.target.column":`Column style`,"style.target.layout":`Layout style`,"style.position.inline":`In the text`,"style.position.start":`On the left`,"style.position.end":`On the right`,"style.position.center":`Centred`,"style.position.full":`Full width`,"style.rules.open":`Manage styles…`,"style.rules.title":`Styles`,"inspector.style":`Style`,"surface.picture.place":`Position and size: {position}, {width}`,"surface.picture.placeAuto":`Position and size: {position}`,"style.target.more":`{target}…`,"help.cost":`costs {percent}%`,"help.when.correct":`Correct`,"help.when.incorrect":`Wrong`,"help.when.partial":`Partly correct`,"help.when.omitted":`Skipped`,"help.costLabel":`Cost of the hint`,"help.whenLabel":`For the result`,"surface.helpRemove":`{kind, select, hint {Remove the hint} explanation {Remove the explanation} other {Remove the feedback}}`},t={"insert.title":`Wstaw`,"insert.components":`Elementy`,"insert.exercises":`Ćwiczenia`,"insert.content":`Treść`,"insert.picture":`Obrazek`,"insert.picture.description":`Obrazek z tekstem alternatywnym i podpisem do wyboru`,"insert.pageBreak":`Podział strony`,"insert.pageBreak.description":`Podziel ćwiczenie na kroki od miejsca kursora`,"insert.hint":`Podpowiedź`,"insert.hint.description":`Na prośbę ucznia: do pytania przy kursorze, a poza nim do strony`,"insert.explanation":`Wyjaśnienie`,"insert.explanation.description":`Dlaczego odpowiedź jest dobra, widoczne po sprawdzeniu`,"insert.feedback":`Informacja zwrotna`,"insert.feedback.description":`Tekst zależny od wyniku, widoczny po sprawdzeniu`,"insert.text":`Tekst`,"insert.text.description":`Akapit po tym bloku`,"insert.noMatch":`Nic nie pasuje do „{query}”.`,"toolbar.label":`Formatowanie i wstawianie`,"toolbar.style":`Styl tekstu: {style}`,"toolbar.paragraph":`Akapit`,"toolbar.heading":`Nagłówek`,"toolbar.subheading":`Podtytuł`,"toolbar.bold":`Pogrubienie`,"toolbar.italic":`Kursywa`,"toolbar.underline":`Podkreślenie`,"toolbar.link":`Link`,"toolbar.link.address":`Adres linku`,"toolbar.link.apply":`Zastosuj`,"toolbar.link.remove":`Usuń link`,"toolbar.link.blocked":`Tego adresu nie można tu użyć.`,"toolbar.bulleted":`Lista punktowana`,"toolbar.numbered":`Lista numerowana`,"toolbar.undo":`Cofnij`,"toolbar.redo":`Ponów`,"toolbar.elements":`Elementy`,"toolbar.templates":`Szablony`,"toolbar.layouts":`Układ`,"toolbar.view":`Widok`,"toolbar.search":`Szukaj`,"block.text":`Tekst`,"block.gap":`Luka`,"issue.onPage":`{n} na stronie {page}`,"picture.title":`Dodaj obrazek`,"picture.editTitle":`Edytuj obrazek`,"picture.file":`Wgraj obrazek`,"picture.library":`Wybierz z biblioteki`,"picture.urlOnly":`Ten edytor dodaje obrazki tylko po adresie: nie ma wgrywania.`,"picture.src":`Adres obrazka (URL)`,"picture.alt":`Tekst alternatywny`,"picture.altHelp":`Co przedstawia obrazek, dla uczniów, którzy go nie widzą. Nie zdradzaj odpowiedzi.`,"picture.decorative":`Ozdobny: czytniki ekranu go pomijają (alt="")`,"picture.caption":`Podpis (opcjonalny)`,"picture.cancel":`Anuluj`,"picture.insert":`Wstaw`,"picture.save":`Zapisz`,"picture.uploading":`Wgrywam…`,"picture.uploaded":`Wgrano.`,"picture.uploadFailed":`Nie udało się wgrać obrazka. Spróbuj ponownie albo podaj jego adres.`,"picture.uploadBlocked":`Wgrywanie zwróciło adres, na który nie pozwala polityka adresów.`,"picture.picked":`Wybrano z biblioteki.`,"picture.pickFailed":`Nie udało się otworzyć biblioteki. Spróbuj ponownie albo podaj adres obrazka.`,"picture.pickBlocked":`Biblioteka zwróciła adres, na który nie pozwala polityka adresów.`,"picture.srcMissing":`Podaj adres obrazka albo go wgraj.`,"picture.srcBlocked":`Polityka adresów nie pozwala na ten adres.`,"picture.altMissing":`Opisz obrazek albo oznacz go jako ozdobny.`,"picture.altRequired":`Opisz obrazek: uczniowie, którzy go nie widzą, potrzebują tekstu alternatywnego do zadania.`,"picture.pasteRefused":`Ten edytor nie ma wgrywania, więc nie można wkleić ani upuścić pliku obrazka. Dodaj go przez Wstaw, Obrazek, podając adres.`,"field.picture.src":`Adres obrazka (URL)`,"field.regions.draw":`Przeciągnij po obrazku, aby narysować strefę, albo dodaj ją i wpisz jej liczby.`,"field.points.place":`Kliknij obrazek, aby wbić pinezkę, albo dodaj ją i wpisz jej położenie.`,"field.region":`Strefa {n}`,"field.region.add":`Dodaj strefę`,"field.region.remove":`Usuń strefę {n}`,"field.point":`Pinezka {n}`,"field.point.add":`Dodaj pinezkę`,"field.point.remove":`Usuń pinezkę {n}`,"field.shape":`Kształt`,"field.shape.rect":`Prostokąt`,"field.shape.circle":`Koło`,"field.shape.polygon":`Wielokąt`,"field.x":`Od lewej (%)`,"field.y":`Od góry (%)`,"field.width":`Szerokość (%)`,"field.height":`Wysokość (%)`,"field.cx":`Środek od lewej (%)`,"field.cy":`Środek od góry (%)`,"field.r":`Promień (% szerokości)`,"field.vertex.x":`Punkt {n} od lewej (%)`,"field.vertex.y":`Punkt {n} od góry (%)`,"field.vertex.add":`Dodaj punkt`,"field.vertex.remove":`Usuń punkt {n}`,"field.label":`Etykieta`,"field.label.optional":`Etykieta (opcjonalna)`,"field.more":`Tu widać tylko pierwsze {shown} z {count}: pozostałe edytuj w źródle.`,"inspector.title":`Właściwości`,"inspector.delete":`Usuń`,"inspector.moveUp":`Przenieś wyżej`,"inspector.moveDown":`Przenieś niżej`,"inspector.empty":`Umieść kursor w elemencie ćwiczenia, aby edytować jego odpowiedzi i ustawienia.`,"inspector.unsupported":`Elementu {tag} nie można tu edytować.`,"inspector.unset":`(nie ustawiono)`,"inspector.item":`{label} {n}`,"inspector.add":`Dodaj`,"inspector.remove":`Usuń`,"inspector.removeItem":`Usuń: {label} {n}`,"inspector.untitled":`Element {n} (pusty)`,"inspector.variant":`Wariant`,"inspector.styleTemplate":`Styl elementu`,"inspector.styleTemplate.inherit":`Jak całe ćwiczenie`,"inspector.styleTemplate.default":`Domyślny wygląd`,"inspector.document":`Ćwiczenie`,"inspector.documentStyle":`Wygląd całego ćwiczenia`,"inspector.upload":`Wgraj plik`,"inspector.uploadItem":`Wgraj plik: {label}`,"inspector.uploading":`Wgrywam…`,"inspector.uploaded":`Wgrano.`,"inspector.uploadFailed":`Nie udało się wgrać pliku. Spróbuj ponownie albo wpisz jego adres.`,"inspector.uploadBlocked":`Wgrywanie zwróciło adres, na który nie pozwala polityka adresów.`,"issues.title":`Problemy`,"issues.errors":`{count, plural, one {# błąd} few {# błędy} many {# błędów} other {# błędu}}`,"issues.warnings":`{count, plural, one {# ostrzeżenie} few {# ostrzeżenia} many {# ostrzeżeń} other {# ostrzeżenia}}`,"issues.summary":`{errors}, {warnings}`,"issues.none":`Brak błędów i ostrzeżeń.`,"severity.error":`Błąd`,"severity.warning":`Ostrzeżenie`,"label.text":`{label}: {text}`,"preview.title":`Widok ucznia`,"preview.show":`Podgląd`,"preview.refresh":`Odśwież podgląd`,"preview.hint":`Naciśnij „Podgląd”, aby wypróbować ćwiczenie tak, jak zobaczy je uczeń.`,"preview.loading":`Przygotowuję podgląd…`,"preview.stale":`Dokument zmienił się po tym podglądzie. Odśwież go, aby zobaczyć zmiany.`,"preview.invalid":`{count, plural, one {Popraw ten błąd, aby zobaczyć podgląd:} few {Popraw te # błędy, aby zobaczyć podgląd:} many {Popraw tych # błędów, aby zobaczyć podgląd:} other {Popraw te # błędu, aby zobaczyć podgląd:}}`,"preview.failed":`Nie udało się pokazać podglądu.`,"surface.label":`Treść ćwiczenia`,"surface.pageNumber":`Strona {page} z {pages}`,"surface.pageTitle":`Tytuł strony`,"surface.pageJoin":`Połącz ze stroną {previous}`,"surface.pageAdded":`Dodano stronę {page}`,"surface.pageJoined":`Strona {page} połączona ze stroną {previous}`,"surface.pageDelete":`Usuń stronę`,"surface.pageDeleted":`Usunięto stronę {n}`,"surface.pageAddTitle":`Dodaj tytuł`,"surface.pageRemoveTitle":`Usuń tytuł`,"surface.pageTitleOf":`Tytuł strony {page}`,"surface.pageTitleRemoved":`Usunięto tytuł strony {page}`,"surface.points":`{points, plural, one {# pkt} few {# pkt} many {# pkt} other {# pkt}}`,"surface.items":`{n, plural, one {# element} few {# elementy} many {# elementów} other {# elementu}}`,"surface.blockMovedUp":`Blok przesunięty w górę, teraz to blok {n}`,"surface.blockMovedDown":`Blok przesunięty w dół, teraz to blok {n}`,"surface.blockRemoved":`Usunięto blok {n}`,"surface.addOption":`Dodaj odpowiedź`,"surface.addPrompt":`Dodaj polecenie`,"surface.chip.empty":`Brak odpowiedzi`,"surface.chip.more":`+{n}`,"surface.picture.alt":`Obrazek: {alt}`,"surface.picture.decorative":`Obrazek ozdobny (bez tekstu alternatywnego)`,"surface.picture.noAlt":`Obrazek bez tekstu alternatywnego`,"surface.picture.blocked":`(niepokazany: polityka adresów nie pozwala na jego adres)`,"surface.picture.edit":`Edytuj`,"surface.loading":`Wczytuję edytor…`,"surface.failed":`Nie udało się wczytać edytora. Odśwież stronę, aby spróbować ponownie.`,"view.visual":`Wizualny`,"view.source":`HTML`,"view.visualHint":`Edytuj ćwiczenie jako sformatowany tekst`,"view.sourceHint":`Edytuj ćwiczenie jako HTML`,"view.sourceLabel":`Ćwiczenie jako HTML`,"view.sourceErrors":`{n, plural, one {HTML ma # błąd. Popraw go, aby wrócić.} few {HTML ma # błędy. Popraw je, aby wrócić.} many {HTML ma # błędów. Popraw je, aby wrócić.} other {HTML ma # błędu. Popraw go, aby wrócić.}}`,"status.elements":`{n, plural, one {# element} few {# elementy} many {# elementów} other {# elementu}}`,"status.errors":`{n, plural, one {# błąd} few {# błędy} many {# błędów} other {# błędu}}`,"status.warnings":`{n, plural, one {# ostrzeżenie} few {# ostrzeżenia} many {# ostrzeżeń} other {# ostrzeżenia}}`,"status.ready":`Gotowe do udostępnienia`,"insert.layouts":`Układ`,"insert.layout.two":`Dwie kolumny`,"insert.layout.two.description":`Dwie kolumny tej samej szerokości.`,"insert.layout.three":`Trzy kolumny`,"insert.layout.three.description":`Trzy kolumny tej samej szerokości.`,"insert.layout.wide-narrow":`Szeroka + wąska`,"insert.layout.wide-narrow.description":`Szeroka kolumna, a po niej wąska.`,"insert.layout.narrow-wide":`Wąska + szeroka`,"insert.layout.narrow-wide.description":`Wąska kolumna, a po niej szeroka.`,"insert.layout.picture-text":`Obrazek obok tekstu`,"insert.layout.picture-text.description":`Wybrany obrazek, a obok niego tekst.`,"layout.section":`Kolumny`,"layout.change":`Zmień układ`,"layout.other":`Inny układ`,"layout.unwrap":`Usuń układ`,"layout.delete":`Usuń z zawartością`,"layout.confirm":`Usunąć układ razem z zawartością?`,"layout.confirmDelete":`Tak, usuń`,"layout.cancel":`Anuluj`,"toolbar.font":`Czcionka: {value}`,"toolbar.font.name":`Czcionka`,"toolbar.size":`Rozmiar: {value}`,"toolbar.size.name":`Rozmiar`,"toolbar.color":`Kolor tekstu`,"toolbar.highlight":`Wyróżnienie`,"toolbar.align":`Wyrównanie`,"toolbar.align.start":`Do lewej`,"toolbar.align.center":`Do środka`,"toolbar.align.end":`Do prawej`,"toolbar.align.justify":`Wyjustowane`,"toolbar.spacing":`Odstępy`,"toolbar.spacing.line":`Interlinia`,"toolbar.spacing.after":`Odstęp po`,"toolbar.spacing.none":`Brak`,"toolbar.spacing.small":`Mały`,"toolbar.spacing.medium":`Średni`,"toolbar.spacing.large":`Duży`,"toolbar.clear":`Wyczyść formatowanie`,"toolbar.default":`Domyślnie`,"toolbar.myStyles":`Moje style`,"toolbar.readyStyles":`Gotowe style`,"style.preset.note":`Uwaga`,"style.preset.tip":`Wskazówka`,"style.preset.important":`Ważne`,"style.preset.definition":`Definicja`,"style.preset.example":`Przykład`,"style.preset.quote":`Cytat`,"style.preset.highlight":`Wyróżnienie`,"style.preset.small-print":`Mały druk`,"style.color.theme":`Kolory motywu`,"style.color.swatch":`Kolor motywu {n}`,"style.color.custom":`Własny kolor`,"style.color.picker":`Wybierz kolor`,"style.color.invalid":`Wpisz kolor jako #rrggbb.`,"style.color.none":`Bez koloru`,"style.close":`Zamknij`,"style.form.none":`Ustaw kursor w tym, co chcesz ostylować.`,"style.target.picture":`Styl obrazka`,"style.target.figure":`Styl obrazka z podpisem`,"style.target.block":`Styl bloku`,"style.target.component":`Styl elementu`,"style.target.column":`Styl kolumny`,"style.target.layout":`Styl układu`,"style.position.inline":`W tekście`,"style.position.start":`Po lewej`,"style.position.end":`Po prawej`,"style.position.center":`Na środku`,"style.position.full":`Cała szerokość`,"style.rules.open":`Zarządzaj stylami…`,"style.rules.title":`Style`,"inspector.style":`Styl`,"surface.picture.place":`Położenie i rozmiar: {position}, {width}`,"surface.picture.placeAuto":`Położenie i rozmiar: {position}`,"style.target.more":`{target}…`,"help.cost":`koszt {percent}%`,"help.when.correct":`Dobrze`,"help.when.incorrect":`Źle`,"help.when.partial":`Częściowo dobrze`,"help.when.omitted":`Pominięte`,"help.costLabel":`Koszt podpowiedzi`,"help.whenLabel":`Dla wyniku`,"surface.helpRemove":`{kind, select, hint {Usuń podpowiedź} explanation {Usuń wyjaśnienie} other {Usuń informację zwrotną}}`},n=`astl.editor`,r=[{namespace:n,locale:`en`,messages:e},{namespace:n,locale:`pl`,messages:t}];export{r as n,n as t};
|
|
2
|
+
//# sourceMappingURL=messages-Qzse5KMX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages-Qzse5KMX.js","names":["en","pl","en_default","pl_default","EDITOR_NAMESPACE","editorMessages"],"sources":["../../../../editor/src/messages/en.json","../../../../editor/src/messages/pl.json","../../../../editor/src/messages.ts"],"sourcesContent":["{\n \"insert.title\": \"Insert\",\n \"insert.components\": \"Components\",\n \"insert.exercises\": \"Exercises\",\n \"insert.content\": \"Content\",\n \"insert.picture\": \"Picture\",\n \"insert.picture.description\": \"A picture with alt text and an optional caption\",\n \"insert.pageBreak\": \"Page break\",\n \"insert.pageBreak.description\": \"Split the exercise into steps at the cursor\",\n \"insert.hint\": \"Hint\",\n \"insert.hint.description\": \"One students ask for: for the question at the cursor, else for the page\",\n \"insert.explanation\": \"Explanation\",\n \"insert.explanation.description\": \"Why the answer is right, shown once it is checked\",\n \"insert.feedback\": \"Feedback\",\n \"insert.feedback.description\": \"A text by the verdict, shown once the answer is checked\",\n \"insert.text\": \"Text\",\n \"insert.text.description\": \"A paragraph after this block\",\n \"insert.noMatch\": \"Nothing matches “{query}”.\",\n \"toolbar.label\": \"Format and insert\",\n \"toolbar.style\": \"Text style: {style}\",\n \"toolbar.paragraph\": \"Paragraph\",\n \"toolbar.heading\": \"Heading\",\n \"toolbar.subheading\": \"Subheading\",\n \"toolbar.bold\": \"Bold\",\n \"toolbar.italic\": \"Italic\",\n \"toolbar.underline\": \"Underline\",\n \"toolbar.link\": \"Link\",\n \"toolbar.link.address\": \"Link address\",\n \"toolbar.link.apply\": \"Apply\",\n \"toolbar.link.remove\": \"Remove link\",\n \"toolbar.link.blocked\": \"This address is not allowed here.\",\n \"toolbar.bulleted\": \"Bulleted list\",\n \"toolbar.numbered\": \"Numbered list\",\n \"toolbar.undo\": \"Undo\",\n \"toolbar.redo\": \"Redo\",\n \"toolbar.elements\": \"Elements\",\n \"toolbar.templates\": \"Templates\",\n \"toolbar.layouts\": \"Layout\",\n \"toolbar.view\": \"View\",\n \"toolbar.search\": \"Search\",\n \"block.text\": \"Text\",\n \"block.gap\": \"Gap\",\n \"issue.onPage\": \"{n} on page {page}\",\n \"picture.title\": \"Add a picture\",\n \"picture.editTitle\": \"Edit the picture\",\n \"picture.file\": \"Upload a picture\",\n \"picture.library\": \"Choose from the library\",\n \"picture.urlOnly\": \"This editor adds pictures by their address only: it has no upload.\",\n \"picture.src\": \"Picture address (URL)\",\n \"picture.alt\": \"Alt text\",\n \"picture.altHelp\": \"What the picture shows, for students who cannot see it. Do not give an answer away.\",\n \"picture.decorative\": \"Decorative: screen readers skip it (alt=\\\"\\\")\",\n \"picture.caption\": \"Caption (optional)\",\n \"picture.cancel\": \"Cancel\",\n \"picture.insert\": \"Insert\",\n \"picture.save\": \"Save\",\n \"picture.uploading\": \"Uploading…\",\n \"picture.uploaded\": \"Uploaded.\",\n \"picture.uploadFailed\": \"The upload failed. Try again, or give the picture's address.\",\n \"picture.uploadBlocked\": \"The upload gave an address the URL policy does not allow.\",\n \"picture.picked\": \"Chosen from the library.\",\n \"picture.pickFailed\": \"The library did not open. Try again, or give the picture's address.\",\n \"picture.pickBlocked\": \"The library returned an address the URL policy does not allow.\",\n \"picture.srcMissing\": \"Give the picture's address, or upload it.\",\n \"picture.srcBlocked\": \"The URL policy does not allow this address.\",\n \"picture.altMissing\": \"Describe the picture, or mark it as decorative.\",\n \"picture.altRequired\": \"Describe the picture: students who cannot see it need its alt text for the task.\",\n \"picture.pasteRefused\": \"This editor has no upload, so a picture file cannot be pasted or dropped. Add it with Insert, Picture, by its address.\",\n \"field.picture.src\": \"Picture address (URL)\",\n \"field.regions.draw\": \"Drag on the picture to draw a zone, or add one and type its numbers.\",\n \"field.points.place\": \"Click the picture to place a pin, or add one and type its position.\",\n \"field.region\": \"Zone {n}\",\n \"field.region.add\": \"Add a zone\",\n \"field.region.remove\": \"Remove zone {n}\",\n \"field.point\": \"Pin {n}\",\n \"field.point.add\": \"Add a pin\",\n \"field.point.remove\": \"Remove pin {n}\",\n \"field.shape\": \"Shape\",\n \"field.shape.rect\": \"Rectangle\",\n \"field.shape.circle\": \"Circle\",\n \"field.shape.polygon\": \"Polygon\",\n \"field.x\": \"From the left (%)\",\n \"field.y\": \"From the top (%)\",\n \"field.width\": \"Width (%)\",\n \"field.height\": \"Height (%)\",\n \"field.cx\": \"Centre from the left (%)\",\n \"field.cy\": \"Centre from the top (%)\",\n \"field.r\": \"Radius (% of the width)\",\n \"field.vertex.x\": \"Point {n} from the left (%)\",\n \"field.vertex.y\": \"Point {n} from the top (%)\",\n \"field.vertex.add\": \"Add a point\",\n \"field.vertex.remove\": \"Remove point {n}\",\n \"field.label\": \"Label\",\n \"field.label.optional\": \"Label (optional)\",\n \"field.more\": \"Only the first {shown} of {count} are listed here: edit the others in the source.\",\n \"inspector.title\": \"Properties\",\n \"inspector.delete\": \"Delete\",\n \"inspector.moveUp\": \"Move up\",\n \"inspector.moveDown\": \"Move down\",\n \"inspector.empty\": \"Put the cursor in an exercise element to edit its answers and settings.\",\n \"inspector.unsupported\": \"Element {tag} cannot be edited here.\",\n \"inspector.unset\": \"(not set)\",\n \"inspector.item\": \"{label} {n}\",\n \"inspector.add\": \"Add\",\n \"inspector.remove\": \"Remove\",\n \"inspector.removeItem\": \"Remove: {label} {n}\",\n \"inspector.untitled\": \"Item {n} (empty)\",\n \"inspector.variant\": \"Variant\",\n \"inspector.styleTemplate\": \"Element style\",\n \"inspector.styleTemplate.inherit\": \"Same as the exercise\",\n \"inspector.styleTemplate.default\": \"Default look\",\n \"inspector.document\": \"Exercise\",\n \"inspector.documentStyle\": \"Look of the whole exercise\",\n \"inspector.upload\": \"Upload a file\",\n \"inspector.uploadItem\": \"Upload a file: {label}\",\n \"inspector.uploading\": \"Uploading…\",\n \"inspector.uploaded\": \"Uploaded.\",\n \"inspector.uploadFailed\": \"The upload failed. Try again, or type its address.\",\n \"inspector.uploadBlocked\": \"The upload gave an address the URL policy does not allow.\",\n \"issues.title\": \"Problems\",\n \"issues.errors\": \"{count, plural, one {# error} other {# errors}}\",\n \"issues.warnings\": \"{count, plural, one {# warning} other {# warnings}}\",\n \"issues.summary\": \"{errors}, {warnings}\",\n \"issues.none\": \"No errors or warnings.\",\n \"severity.error\": \"Error\",\n \"severity.warning\": \"Warning\",\n \"label.text\": \"{label}: {text}\",\n \"preview.title\": \"Student view\",\n \"preview.show\": \"Preview\",\n \"preview.refresh\": \"Refresh preview\",\n \"preview.hint\": \"Press Preview to try the exercise the way a student will see it.\",\n \"preview.loading\": \"Preparing the preview…\",\n \"preview.stale\": \"The document changed after this preview. Refresh it to see the changes.\",\n \"preview.invalid\": \"{count, plural, one {Fix this error to see the preview:} other {Fix these # errors to see the preview:}}\",\n \"preview.failed\": \"The preview could not be shown.\",\n \"surface.label\": \"Exercise content\",\n \"surface.pageNumber\": \"Page {page} of {pages}\",\n \"surface.pageTitle\": \"Page title\",\n \"surface.pageJoin\": \"Join with page {previous}\",\n \"surface.pageAdded\": \"Page {page} added\",\n \"surface.pageJoined\": \"Page {page} joined with page {previous}\",\n \"surface.pageDelete\": \"Delete page\",\n \"surface.pageDeleted\": \"Deleted page {n}\",\n \"surface.pageAddTitle\": \"Add title\",\n \"surface.pageRemoveTitle\": \"Remove title\",\n \"surface.pageTitleOf\": \"Title of page {page}\",\n \"surface.pageTitleRemoved\": \"Removed the title of page {page}\",\n \"surface.points\": \"{points, plural, one {# pt} other {# pts}}\",\n \"surface.items\": \"{n, plural, one {# item} other {# items}}\",\n \"surface.blockMovedUp\": \"Block moved up, now block {n}\",\n \"surface.blockMovedDown\": \"Block moved down, now block {n}\",\n \"surface.blockRemoved\": \"Block {n} deleted\",\n \"surface.addOption\": \"Add option\",\n \"surface.addPrompt\": \"Add prompt\",\n \"surface.chip.empty\": \"No answer\",\n \"surface.chip.more\": \"+{n}\",\n \"surface.picture.alt\": \"Picture: {alt}\",\n \"surface.picture.decorative\": \"Picture, decorative (no alt text)\",\n \"surface.picture.noAlt\": \"Picture without alt text\",\n \"surface.picture.blocked\": \"(not shown: the URL policy does not allow its address)\",\n \"surface.picture.edit\": \"Edit\",\n \"surface.loading\": \"Loading the editor…\",\n \"surface.failed\": \"The editor could not be loaded. Reload the page to try again.\",\n \"view.visual\": \"Visual\",\n \"view.source\": \"HTML\",\n \"view.visualHint\": \"Edit the exercise as formatted text\",\n \"view.sourceHint\": \"Edit the exercise as HTML\",\n \"view.sourceLabel\": \"The exercise as HTML\",\n \"view.sourceErrors\": \"{n, plural, one {The HTML has # error. Fix it to go back.} other {The HTML has # errors. Fix them to go back.}}\",\n \"status.elements\": \"{n, plural, one {# element} other {# elements}}\",\n \"status.errors\": \"{n, plural, one {# error} other {# errors}}\",\n \"status.warnings\": \"{n, plural, one {# warning} other {# warnings}}\",\n \"status.ready\": \"Ready to share\",\n \"insert.layouts\": \"Layout\",\n \"insert.layout.two\": \"Two columns\",\n \"insert.layout.two.description\": \"Two columns of the same width.\",\n \"insert.layout.three\": \"Three columns\",\n \"insert.layout.three.description\": \"Three columns of the same width.\",\n \"insert.layout.wide-narrow\": \"Wide + narrow\",\n \"insert.layout.wide-narrow.description\": \"A wide column, then a narrow one.\",\n \"insert.layout.narrow-wide\": \"Narrow + wide\",\n \"insert.layout.narrow-wide.description\": \"A narrow column, then a wide one.\",\n \"insert.layout.picture-text\": \"Picture beside text\",\n \"insert.layout.picture-text.description\": \"A picture you choose, with text next to it.\",\n \"layout.section\": \"Columns\",\n \"layout.change\": \"Change layout\",\n \"layout.other\": \"Another layout\",\n \"layout.unwrap\": \"Remove layout\",\n \"layout.delete\": \"Delete with content\",\n \"layout.confirm\": \"Delete the layout and its content?\",\n \"layout.confirmDelete\": \"Yes, delete\",\n \"layout.cancel\": \"Cancel\",\n \"toolbar.font\": \"Font: {value}\",\n \"toolbar.font.name\": \"Font\",\n \"toolbar.size\": \"Size: {value}\",\n \"toolbar.size.name\": \"Size\",\n \"toolbar.color\": \"Text colour\",\n \"toolbar.highlight\": \"Highlight\",\n \"toolbar.align\": \"Alignment\",\n \"toolbar.align.start\": \"Left\",\n \"toolbar.align.center\": \"Centre\",\n \"toolbar.align.end\": \"Right\",\n \"toolbar.align.justify\": \"Justified\",\n \"toolbar.spacing\": \"Spacing\",\n \"toolbar.spacing.line\": \"Line height\",\n \"toolbar.spacing.after\": \"Space after\",\n \"toolbar.spacing.none\": \"None\",\n \"toolbar.spacing.small\": \"Small\",\n \"toolbar.spacing.medium\": \"Medium\",\n \"toolbar.spacing.large\": \"Large\",\n \"toolbar.clear\": \"Clear formatting\",\n \"toolbar.default\": \"Default\",\n \"toolbar.myStyles\": \"My styles\",\n \"toolbar.readyStyles\": \"Ready styles\",\n \"style.preset.note\": \"Note\",\n \"style.preset.tip\": \"Tip\",\n \"style.preset.important\": \"Important\",\n \"style.preset.definition\": \"Definition\",\n \"style.preset.example\": \"Example\",\n \"style.preset.quote\": \"Quote\",\n \"style.preset.highlight\": \"Highlight\",\n \"style.preset.small-print\": \"Small print\",\n \"style.color.theme\": \"Theme colours\",\n \"style.color.swatch\": \"Theme colour {n}\",\n \"style.color.custom\": \"Custom colour\",\n \"style.color.picker\": \"Pick a colour\",\n \"style.color.invalid\": \"Write a colour as #rrggbb.\",\n \"style.color.none\": \"No colour\",\n \"style.close\": \"Close\",\n \"style.form.none\": \"Put the cursor in what you want to style.\",\n \"style.target.picture\": \"Picture style\",\n \"style.target.figure\": \"Picture and caption style\",\n \"style.target.block\": \"Block style\",\n \"style.target.component\": \"Element style\",\n \"style.target.column\": \"Column style\",\n \"style.target.layout\": \"Layout style\",\n \"style.position.inline\": \"In the text\",\n \"style.position.start\": \"On the left\",\n \"style.position.end\": \"On the right\",\n \"style.position.center\": \"Centred\",\n \"style.position.full\": \"Full width\",\n \"style.rules.open\": \"Manage styles…\",\n \"style.rules.title\": \"Styles\",\n \"inspector.style\": \"Style\",\n \"surface.picture.place\": \"Position and size: {position}, {width}\",\n \"surface.picture.placeAuto\": \"Position and size: {position}\",\n \"style.target.more\": \"{target}…\",\n \"help.cost\": \"costs {percent}%\",\n \"help.when.correct\": \"Correct\",\n \"help.when.incorrect\": \"Wrong\",\n \"help.when.partial\": \"Partly correct\",\n \"help.when.omitted\": \"Skipped\",\n \"help.costLabel\": \"Cost of the hint\",\n \"help.whenLabel\": \"For the result\",\n \"surface.helpRemove\": \"{kind, select, hint {Remove the hint} explanation {Remove the explanation} other {Remove the feedback}}\"\n}\n","{\n \"insert.title\": \"Wstaw\",\n \"insert.components\": \"Elementy\",\n \"insert.exercises\": \"Ćwiczenia\",\n \"insert.content\": \"Treść\",\n \"insert.picture\": \"Obrazek\",\n \"insert.picture.description\": \"Obrazek z tekstem alternatywnym i podpisem do wyboru\",\n \"insert.pageBreak\": \"Podział strony\",\n \"insert.pageBreak.description\": \"Podziel ćwiczenie na kroki od miejsca kursora\",\n \"insert.hint\": \"Podpowiedź\",\n \"insert.hint.description\": \"Na prośbę ucznia: do pytania przy kursorze, a poza nim do strony\",\n \"insert.explanation\": \"Wyjaśnienie\",\n \"insert.explanation.description\": \"Dlaczego odpowiedź jest dobra, widoczne po sprawdzeniu\",\n \"insert.feedback\": \"Informacja zwrotna\",\n \"insert.feedback.description\": \"Tekst zależny od wyniku, widoczny po sprawdzeniu\",\n \"insert.text\": \"Tekst\",\n \"insert.text.description\": \"Akapit po tym bloku\",\n \"insert.noMatch\": \"Nic nie pasuje do „{query}”.\",\n \"toolbar.label\": \"Formatowanie i wstawianie\",\n \"toolbar.style\": \"Styl tekstu: {style}\",\n \"toolbar.paragraph\": \"Akapit\",\n \"toolbar.heading\": \"Nagłówek\",\n \"toolbar.subheading\": \"Podtytuł\",\n \"toolbar.bold\": \"Pogrubienie\",\n \"toolbar.italic\": \"Kursywa\",\n \"toolbar.underline\": \"Podkreślenie\",\n \"toolbar.link\": \"Link\",\n \"toolbar.link.address\": \"Adres linku\",\n \"toolbar.link.apply\": \"Zastosuj\",\n \"toolbar.link.remove\": \"Usuń link\",\n \"toolbar.link.blocked\": \"Tego adresu nie można tu użyć.\",\n \"toolbar.bulleted\": \"Lista punktowana\",\n \"toolbar.numbered\": \"Lista numerowana\",\n \"toolbar.undo\": \"Cofnij\",\n \"toolbar.redo\": \"Ponów\",\n \"toolbar.elements\": \"Elementy\",\n \"toolbar.templates\": \"Szablony\",\n \"toolbar.layouts\": \"Układ\",\n \"toolbar.view\": \"Widok\",\n \"toolbar.search\": \"Szukaj\",\n \"block.text\": \"Tekst\",\n \"block.gap\": \"Luka\",\n \"issue.onPage\": \"{n} na stronie {page}\",\n \"picture.title\": \"Dodaj obrazek\",\n \"picture.editTitle\": \"Edytuj obrazek\",\n \"picture.file\": \"Wgraj obrazek\",\n \"picture.library\": \"Wybierz z biblioteki\",\n \"picture.urlOnly\": \"Ten edytor dodaje obrazki tylko po adresie: nie ma wgrywania.\",\n \"picture.src\": \"Adres obrazka (URL)\",\n \"picture.alt\": \"Tekst alternatywny\",\n \"picture.altHelp\": \"Co przedstawia obrazek, dla uczniów, którzy go nie widzą. Nie zdradzaj odpowiedzi.\",\n \"picture.decorative\": \"Ozdobny: czytniki ekranu go pomijają (alt=\\\"\\\")\",\n \"picture.caption\": \"Podpis (opcjonalny)\",\n \"picture.cancel\": \"Anuluj\",\n \"picture.insert\": \"Wstaw\",\n \"picture.save\": \"Zapisz\",\n \"picture.uploading\": \"Wgrywam…\",\n \"picture.uploaded\": \"Wgrano.\",\n \"picture.uploadFailed\": \"Nie udało się wgrać obrazka. Spróbuj ponownie albo podaj jego adres.\",\n \"picture.uploadBlocked\": \"Wgrywanie zwróciło adres, na który nie pozwala polityka adresów.\",\n \"picture.picked\": \"Wybrano z biblioteki.\",\n \"picture.pickFailed\": \"Nie udało się otworzyć biblioteki. Spróbuj ponownie albo podaj adres obrazka.\",\n \"picture.pickBlocked\": \"Biblioteka zwróciła adres, na który nie pozwala polityka adresów.\",\n \"picture.srcMissing\": \"Podaj adres obrazka albo go wgraj.\",\n \"picture.srcBlocked\": \"Polityka adresów nie pozwala na ten adres.\",\n \"picture.altMissing\": \"Opisz obrazek albo oznacz go jako ozdobny.\",\n \"picture.altRequired\": \"Opisz obrazek: uczniowie, którzy go nie widzą, potrzebują tekstu alternatywnego do zadania.\",\n \"picture.pasteRefused\": \"Ten edytor nie ma wgrywania, więc nie można wkleić ani upuścić pliku obrazka. Dodaj go przez Wstaw, Obrazek, podając adres.\",\n \"field.picture.src\": \"Adres obrazka (URL)\",\n \"field.regions.draw\": \"Przeciągnij po obrazku, aby narysować strefę, albo dodaj ją i wpisz jej liczby.\",\n \"field.points.place\": \"Kliknij obrazek, aby wbić pinezkę, albo dodaj ją i wpisz jej położenie.\",\n \"field.region\": \"Strefa {n}\",\n \"field.region.add\": \"Dodaj strefę\",\n \"field.region.remove\": \"Usuń strefę {n}\",\n \"field.point\": \"Pinezka {n}\",\n \"field.point.add\": \"Dodaj pinezkę\",\n \"field.point.remove\": \"Usuń pinezkę {n}\",\n \"field.shape\": \"Kształt\",\n \"field.shape.rect\": \"Prostokąt\",\n \"field.shape.circle\": \"Koło\",\n \"field.shape.polygon\": \"Wielokąt\",\n \"field.x\": \"Od lewej (%)\",\n \"field.y\": \"Od góry (%)\",\n \"field.width\": \"Szerokość (%)\",\n \"field.height\": \"Wysokość (%)\",\n \"field.cx\": \"Środek od lewej (%)\",\n \"field.cy\": \"Środek od góry (%)\",\n \"field.r\": \"Promień (% szerokości)\",\n \"field.vertex.x\": \"Punkt {n} od lewej (%)\",\n \"field.vertex.y\": \"Punkt {n} od góry (%)\",\n \"field.vertex.add\": \"Dodaj punkt\",\n \"field.vertex.remove\": \"Usuń punkt {n}\",\n \"field.label\": \"Etykieta\",\n \"field.label.optional\": \"Etykieta (opcjonalna)\",\n \"field.more\": \"Tu widać tylko pierwsze {shown} z {count}: pozostałe edytuj w źródle.\",\n \"inspector.title\": \"Właściwości\",\n \"inspector.delete\": \"Usuń\",\n \"inspector.moveUp\": \"Przenieś wyżej\",\n \"inspector.moveDown\": \"Przenieś niżej\",\n \"inspector.empty\": \"Umieść kursor w elemencie ćwiczenia, aby edytować jego odpowiedzi i ustawienia.\",\n \"inspector.unsupported\": \"Elementu {tag} nie można tu edytować.\",\n \"inspector.unset\": \"(nie ustawiono)\",\n \"inspector.item\": \"{label} {n}\",\n \"inspector.add\": \"Dodaj\",\n \"inspector.remove\": \"Usuń\",\n \"inspector.removeItem\": \"Usuń: {label} {n}\",\n \"inspector.untitled\": \"Element {n} (pusty)\",\n \"inspector.variant\": \"Wariant\",\n \"inspector.styleTemplate\": \"Styl elementu\",\n \"inspector.styleTemplate.inherit\": \"Jak całe ćwiczenie\",\n \"inspector.styleTemplate.default\": \"Domyślny wygląd\",\n \"inspector.document\": \"Ćwiczenie\",\n \"inspector.documentStyle\": \"Wygląd całego ćwiczenia\",\n \"inspector.upload\": \"Wgraj plik\",\n \"inspector.uploadItem\": \"Wgraj plik: {label}\",\n \"inspector.uploading\": \"Wgrywam…\",\n \"inspector.uploaded\": \"Wgrano.\",\n \"inspector.uploadFailed\": \"Nie udało się wgrać pliku. Spróbuj ponownie albo wpisz jego adres.\",\n \"inspector.uploadBlocked\": \"Wgrywanie zwróciło adres, na który nie pozwala polityka adresów.\",\n \"issues.title\": \"Problemy\",\n \"issues.errors\": \"{count, plural, one {# błąd} few {# błędy} many {# błędów} other {# błędu}}\",\n \"issues.warnings\": \"{count, plural, one {# ostrzeżenie} few {# ostrzeżenia} many {# ostrzeżeń} other {# ostrzeżenia}}\",\n \"issues.summary\": \"{errors}, {warnings}\",\n \"issues.none\": \"Brak błędów i ostrzeżeń.\",\n \"severity.error\": \"Błąd\",\n \"severity.warning\": \"Ostrzeżenie\",\n \"label.text\": \"{label}: {text}\",\n \"preview.title\": \"Widok ucznia\",\n \"preview.show\": \"Podgląd\",\n \"preview.refresh\": \"Odśwież podgląd\",\n \"preview.hint\": \"Naciśnij „Podgląd”, aby wypróbować ćwiczenie tak, jak zobaczy je uczeń.\",\n \"preview.loading\": \"Przygotowuję podgląd…\",\n \"preview.stale\": \"Dokument zmienił się po tym podglądzie. Odśwież go, aby zobaczyć zmiany.\",\n \"preview.invalid\": \"{count, plural, one {Popraw ten błąd, aby zobaczyć podgląd:} few {Popraw te # błędy, aby zobaczyć podgląd:} many {Popraw tych # błędów, aby zobaczyć podgląd:} other {Popraw te # błędu, aby zobaczyć podgląd:}}\",\n \"preview.failed\": \"Nie udało się pokazać podglądu.\",\n \"surface.label\": \"Treść ćwiczenia\",\n \"surface.pageNumber\": \"Strona {page} z {pages}\",\n \"surface.pageTitle\": \"Tytuł strony\",\n \"surface.pageJoin\": \"Połącz ze stroną {previous}\",\n \"surface.pageAdded\": \"Dodano stronę {page}\",\n \"surface.pageJoined\": \"Strona {page} połączona ze stroną {previous}\",\n \"surface.pageDelete\": \"Usuń stronę\",\n \"surface.pageDeleted\": \"Usunięto stronę {n}\",\n \"surface.pageAddTitle\": \"Dodaj tytuł\",\n \"surface.pageRemoveTitle\": \"Usuń tytuł\",\n \"surface.pageTitleOf\": \"Tytuł strony {page}\",\n \"surface.pageTitleRemoved\": \"Usunięto tytuł strony {page}\",\n \"surface.points\": \"{points, plural, one {# pkt} few {# pkt} many {# pkt} other {# pkt}}\",\n \"surface.items\": \"{n, plural, one {# element} few {# elementy} many {# elementów} other {# elementu}}\",\n \"surface.blockMovedUp\": \"Blok przesunięty w górę, teraz to blok {n}\",\n \"surface.blockMovedDown\": \"Blok przesunięty w dół, teraz to blok {n}\",\n \"surface.blockRemoved\": \"Usunięto blok {n}\",\n \"surface.addOption\": \"Dodaj odpowiedź\",\n \"surface.addPrompt\": \"Dodaj polecenie\",\n \"surface.chip.empty\": \"Brak odpowiedzi\",\n \"surface.chip.more\": \"+{n}\",\n \"surface.picture.alt\": \"Obrazek: {alt}\",\n \"surface.picture.decorative\": \"Obrazek ozdobny (bez tekstu alternatywnego)\",\n \"surface.picture.noAlt\": \"Obrazek bez tekstu alternatywnego\",\n \"surface.picture.blocked\": \"(niepokazany: polityka adresów nie pozwala na jego adres)\",\n \"surface.picture.edit\": \"Edytuj\",\n \"surface.loading\": \"Wczytuję edytor…\",\n \"surface.failed\": \"Nie udało się wczytać edytora. Odśwież stronę, aby spróbować ponownie.\",\n \"view.visual\": \"Wizualny\",\n \"view.source\": \"HTML\",\n \"view.visualHint\": \"Edytuj ćwiczenie jako sformatowany tekst\",\n \"view.sourceHint\": \"Edytuj ćwiczenie jako HTML\",\n \"view.sourceLabel\": \"Ćwiczenie jako HTML\",\n \"view.sourceErrors\": \"{n, plural, one {HTML ma # błąd. Popraw go, aby wrócić.} few {HTML ma # błędy. Popraw je, aby wrócić.} many {HTML ma # błędów. Popraw je, aby wrócić.} other {HTML ma # błędu. Popraw go, aby wrócić.}}\",\n \"status.elements\": \"{n, plural, one {# element} few {# elementy} many {# elementów} other {# elementu}}\",\n \"status.errors\": \"{n, plural, one {# błąd} few {# błędy} many {# błędów} other {# błędu}}\",\n \"status.warnings\": \"{n, plural, one {# ostrzeżenie} few {# ostrzeżenia} many {# ostrzeżeń} other {# ostrzeżenia}}\",\n \"status.ready\": \"Gotowe do udostępnienia\",\n \"insert.layouts\": \"Układ\",\n \"insert.layout.two\": \"Dwie kolumny\",\n \"insert.layout.two.description\": \"Dwie kolumny tej samej szerokości.\",\n \"insert.layout.three\": \"Trzy kolumny\",\n \"insert.layout.three.description\": \"Trzy kolumny tej samej szerokości.\",\n \"insert.layout.wide-narrow\": \"Szeroka + wąska\",\n \"insert.layout.wide-narrow.description\": \"Szeroka kolumna, a po niej wąska.\",\n \"insert.layout.narrow-wide\": \"Wąska + szeroka\",\n \"insert.layout.narrow-wide.description\": \"Wąska kolumna, a po niej szeroka.\",\n \"insert.layout.picture-text\": \"Obrazek obok tekstu\",\n \"insert.layout.picture-text.description\": \"Wybrany obrazek, a obok niego tekst.\",\n \"layout.section\": \"Kolumny\",\n \"layout.change\": \"Zmień układ\",\n \"layout.other\": \"Inny układ\",\n \"layout.unwrap\": \"Usuń układ\",\n \"layout.delete\": \"Usuń z zawartością\",\n \"layout.confirm\": \"Usunąć układ razem z zawartością?\",\n \"layout.confirmDelete\": \"Tak, usuń\",\n \"layout.cancel\": \"Anuluj\",\n \"toolbar.font\": \"Czcionka: {value}\",\n \"toolbar.font.name\": \"Czcionka\",\n \"toolbar.size\": \"Rozmiar: {value}\",\n \"toolbar.size.name\": \"Rozmiar\",\n \"toolbar.color\": \"Kolor tekstu\",\n \"toolbar.highlight\": \"Wyróżnienie\",\n \"toolbar.align\": \"Wyrównanie\",\n \"toolbar.align.start\": \"Do lewej\",\n \"toolbar.align.center\": \"Do środka\",\n \"toolbar.align.end\": \"Do prawej\",\n \"toolbar.align.justify\": \"Wyjustowane\",\n \"toolbar.spacing\": \"Odstępy\",\n \"toolbar.spacing.line\": \"Interlinia\",\n \"toolbar.spacing.after\": \"Odstęp po\",\n \"toolbar.spacing.none\": \"Brak\",\n \"toolbar.spacing.small\": \"Mały\",\n \"toolbar.spacing.medium\": \"Średni\",\n \"toolbar.spacing.large\": \"Duży\",\n \"toolbar.clear\": \"Wyczyść formatowanie\",\n \"toolbar.default\": \"Domyślnie\",\n \"toolbar.myStyles\": \"Moje style\",\n \"toolbar.readyStyles\": \"Gotowe style\",\n \"style.preset.note\": \"Uwaga\",\n \"style.preset.tip\": \"Wskazówka\",\n \"style.preset.important\": \"Ważne\",\n \"style.preset.definition\": \"Definicja\",\n \"style.preset.example\": \"Przykład\",\n \"style.preset.quote\": \"Cytat\",\n \"style.preset.highlight\": \"Wyróżnienie\",\n \"style.preset.small-print\": \"Mały druk\",\n \"style.color.theme\": \"Kolory motywu\",\n \"style.color.swatch\": \"Kolor motywu {n}\",\n \"style.color.custom\": \"Własny kolor\",\n \"style.color.picker\": \"Wybierz kolor\",\n \"style.color.invalid\": \"Wpisz kolor jako #rrggbb.\",\n \"style.color.none\": \"Bez koloru\",\n \"style.close\": \"Zamknij\",\n \"style.form.none\": \"Ustaw kursor w tym, co chcesz ostylować.\",\n \"style.target.picture\": \"Styl obrazka\",\n \"style.target.figure\": \"Styl obrazka z podpisem\",\n \"style.target.block\": \"Styl bloku\",\n \"style.target.component\": \"Styl elementu\",\n \"style.target.column\": \"Styl kolumny\",\n \"style.target.layout\": \"Styl układu\",\n \"style.position.inline\": \"W tekście\",\n \"style.position.start\": \"Po lewej\",\n \"style.position.end\": \"Po prawej\",\n \"style.position.center\": \"Na środku\",\n \"style.position.full\": \"Cała szerokość\",\n \"style.rules.open\": \"Zarządzaj stylami…\",\n \"style.rules.title\": \"Style\",\n \"inspector.style\": \"Styl\",\n \"surface.picture.place\": \"Położenie i rozmiar: {position}, {width}\",\n \"surface.picture.placeAuto\": \"Położenie i rozmiar: {position}\",\n \"style.target.more\": \"{target}…\",\n \"help.cost\": \"koszt {percent}%\",\n \"help.when.correct\": \"Dobrze\",\n \"help.when.incorrect\": \"Źle\",\n \"help.when.partial\": \"Częściowo dobrze\",\n \"help.when.omitted\": \"Pominięte\",\n \"help.costLabel\": \"Koszt podpowiedzi\",\n \"help.whenLabel\": \"Dla wyniku\",\n \"surface.helpRemove\": \"{kind, select, hint {Usuń podpowiedź} explanation {Usuń wyjaśnienie} other {Usuń informację zwrotną}}\"\n}\n","import type { MessageCatalog } from '@astl/core';\nimport en from './messages/en.json' with { type: 'json' };\nimport pl from './messages/pl.json' with { type: 'json' };\n\n/** i18n namespace of the authoring kit's own UI (insert menu, inspector, issues, preview). */\nexport const EDITOR_NAMESPACE = 'astl.editor';\n\nexport const editorMessages: readonly MessageCatalog[] = [\n { namespace: EDITOR_NAMESPACE, locale: 'en', messages: en },\n { namespace: EDITOR_NAMESPACE, locale: 'pl', messages: pl },\n];\n"],"mappings":"A,8wsBEKaI,EAAmB,cAEnBC,EAA4C,CACvD,CAAE,UAAWD,EAAkB,OAAQ,KAAM,SAAUJ,CAAG,EAC1D,CAAE,UAAWI,EAAkB,OAAQ,KAAM,SAAUH,CAAG,CAC5D,E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{E as e}from"./runtime-
|
|
1
|
+
import{E as e}from"./runtime-C25QK5B0.js";var t=e`
|
|
2
2
|
.option {
|
|
3
3
|
hyphens: auto;
|
|
4
4
|
}
|
|
@@ -47,4 +47,4 @@ inline-size: var(--astl-selected-bar);
|
|
|
47
47
|
background: var(--astl-selected);
|
|
48
48
|
}
|
|
49
49
|
`;export{t};
|
|
50
|
-
//# sourceMappingURL=option-styles-
|
|
50
|
+
//# sourceMappingURL=option-styles-B2sBX5Oz.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"option-styles-
|
|
1
|
+
{"version":3,"file":"option-styles-B2sBX5Oz.js","names":["i","optionStyles"],"sources":["../../../../components/src/option-styles.ts"],"sourcesContent":["/**\n * Shared CSS of the options with a painted radio, `.option` boxes that show their pick: choice, true-false and match.\n * Imported only by them (one small chunk with their elements, none with the others). An element lists it after its\n * own rules and before `blockStyles`; to refine a rule here, it uses a more specific selector.\n */\nimport { type CSSResultGroup, css } from 'lit';\n\n// Painted radios: crisp in every theme, also when locked (a disabled native control fades out); forced colours draw\n// the native one. A pick shows one hue: the checked control in the selected colour, as the option's edge. Selected:\n// the theme's fill; in hc also a bar at the inline start (selected-* tokens), so a pick shows without the control\n// mark and without colour, and never looks like a verdict border. Option texts can be long: they hyphenate.\nexport const optionStyles: CSSResultGroup = css`\n .option {\n hyphens: auto;\n }\n input {\n appearance: none;\n flex: none;\n box-sizing: border-box;\n display: grid;\n place-content: center;\n inline-size: 1.25rem;\n block-size: 1.25rem;\n margin: 0;\n border: var(--astl-outline-width) solid var(--astl-outline);\n border-radius: 50%;\n background: var(--astl-surface);\n color: var(--astl-on-accent);\n font: inherit;\n cursor: inherit;\n }\n input:checked {\n border-color: var(--astl-selected);\n background: var(--astl-selected);\n }\n input[type='radio']:checked::before {\n content: '';\n inline-size: 0.5rem;\n block-size: 0.5rem;\n border-radius: 50%;\n background: currentColor;\n }\n @media (forced-colors: active) {\n input {\n appearance: auto;\n }\n }\n .option[data-selected] {\n border-color: var(--astl-selected);\n background: var(--astl-selected-soft);\n }\n .option[data-selected]::before {\n content: '';\n position: absolute;\n inset-block: 0;\n inset-inline-start: 0;\n inline-size: var(--astl-selected-bar);\n background: var(--astl-selected);\n }\n`;\n"],"mappings":"A,0CAWA,IAAaC,EAA+B,CAAG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as e,E as t,T as n,b as r,h as i,n as a,v as o,y as s}from"./runtime-
|
|
1
|
+
import{C as e,E as t,T as n,b as r,h as i,n as a,v as o,y as s}from"./runtime-C25QK5B0.js";import{n as c,r as l,t as u}from"./order-manifest-J5IXN0he.js";import{t as d}from"./pick-and-place-DVQIPYuL.js";import{t as f}from"./roving-focus-BxGgi2DD.js";import{t as p}from"./block-styles-CCtSFM4j.js";var m=`astl.order`,h=[{namespace:m,locale:`en`,messages:c},{namespace:m,locale:`pl`,messages:u}],g=2,_=n`<g fill="currentColor"><circle cx="7" cy="5" r="1.6"/><circle cx="13" cy="5" r="1.6"/><circle cx="7" cy="10" r="1.6"/><circle cx="13" cy="10" r="1.6"/><circle cx="7" cy="15" r="1.6"/><circle cx="13" cy="15" r="1.6"/></g>`,v=n`<path d="M10 2.5v15M6 6.5l4-4 4 4M6 13.5l4 4 4-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>`,y=n`<path d="M2.5 10h15M6.5 6l-4 4 4 4M13.5 6l4 4-4 4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>`;function b(e,t,n){let r=e.filter(e=>e!==t);return r.splice(n,0,t),r}function x(e,t){let n=[];for(let r of t){let i=e.get(r)??``,a=/^[1-9]\d*$/.test(i)?Number(i)-1:-1;if(a<0||a>=t.length||n[a]!==void 0)return null;n[a]=r}return n}var S=class extends a{static manifest=l;static messages=h;static shadowRootOptions={...s.shadowRootOptions,slotAssignment:`manual`};static properties={placed:{state:!0}};static styles=[t`
|
|
2
2
|
.hints {
|
|
3
3
|
display: grid;
|
|
4
4
|
margin-block-start: var(--astl-space-1);
|
|
@@ -222,4 +222,4 @@ transition: none;
|
|
|
222
222
|
</div>`}#i(t){return t===void 0?r:e`<span lang=${o(t.getAttribute(`lang`)??void 0)} dir=${o(t.getAttribute(`dir`)??void 0)}
|
|
223
223
|
>${Array.from(t.childNodes,e=>e.cloneNode(!0))}</span
|
|
224
224
|
>`}#a(e,t){let n=this.slotVerdict(t);return n!==null&&(this.placed??this.slotIds)[e]===t?n:null}#o(){let e=this.solution;if(e===null||this.groupVerdict===`correct`)return null;let t=this.slotIds;return x(new Map(t.map(t=>[t,e[t]??``])),t)}#s(e,t){let n=this.getAnswers();this.placed=b(this.placed??this.slotIds,e,t);let r=Object.fromEntries(Object.entries(this.getAnswers()).filter(([e,t])=>n[e]!==t));Object.keys(r).length>0&&this.emitChange(r)}#c(e,t,n){let r=(this.items.find(e=>e.id===t)?.textContent??``).replace(/\s+/g,` `).trim();return this.t(e,{item:r,position:n+1,count:this.slotIds.length})}#l=e=>{let t=e.target instanceof HTMLElement?e.target.closest(`button`):null;if(t===null||this.disabled)return;let n=Number(t.dataset.position);this.#t.keydown(e,this.shown[n]??``)||this.#e.keydown(e,n)};#u(e,t,n){let r=this.shown.indexOf(n),i=getComputedStyle(this).direction===`rtl`,a=[...this.renderRoot.querySelectorAll(`.items > .row`)];for(let[n,o]of a.entries()){if(n===r)continue;let a=o.getBoundingClientRect();if(e<a.left||e>a.right||t<a.top||t>a.bottom)continue;let s=this.horizontal?(i?-1:1)*(e-(a.left+a.width/2)):t-(a.top+a.height/2);return(n>r?s>=-2:s<=g)?n:null}return null}},C={manifest:l,element:S,messages:h};export{C as orderElement};
|
|
225
|
-
//# sourceMappingURL=order-
|
|
225
|
+
//# sourceMappingURL=order-B9gqH5wm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-BhG_6IC-.js","names":["en","pl","LitElement","nothing","ifDefined","b","i$1","w","A","verdictIcon","AstlElement","i","en_default","orderManifest","pl_default","PickAndPlace","RovingFocus","blockStyles","namespace","orderUiMessages","MIDDLE_SLACK","GRIP","MOVE_BLOCK","MOVE_INLINE","moved","out","order","id","item","position","arrangementOf","items","value","positions","k","OrderElement","element","#roving","#pick","#positionAt","x","y","#putDown","#message","moment","from","target","placed","slots","given","answers","slot","next","ui","shown","vertical","solution","#solutionOrder","lifting","#keydown","#renderItem","#renderSolution","lifted","verdict","#verdictAt","describedBy","ref","event","#copyOf","node","before","changed","text","el","key","button","rtl","rows","row","r","past","orderElement"],"sources":["../../../../components/src/order/ui-messages.ts","../../../../components/src/order/element.ts"],"sourcesContent":["import type { MessageCatalog } from '@astl/core';\nimport en from './messages/ui/en.json' with { type: 'json' };\nimport pl from './messages/ui/pl.json' with { type: 'json' };\n\nconst namespace = 'astl.order';\n\n/**\n * The student strings (`ui.*`): the element's catalogs. A module of their own, because bundlers split by module: one\n * that also built `orderMessages` would put the authoring strings into the element's chunk.\n */\nexport const orderUiMessages: readonly MessageCatalog[] = [\n { namespace, locale: 'en', messages: en },\n { namespace, locale: 'pl', messages: pl },\n];\n","import type { Answers, ComponentManifest, MessageCatalog, SlotVerdict, Units } from '@astl/core';\nimport { AstlElement, type ElementRegistration, verdictIcon } from '@astl/player';\nimport { PickAndPlace, RovingFocus } from '@astl/player/interaction';\nimport {\n type CSSResultGroup,\n css,\n html,\n LitElement,\n nothing,\n type PropertyDeclarations,\n svg,\n type TemplateResult,\n} from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { blockStyles } from '../block-styles.js';\nimport { orderManifest } from './manifest.js';\nimport { orderUiMessages } from './ui-messages.js';\n\n/** px around an item's middle that already count as its middle while dragging. */\nconst MIDDLE_SLACK = 2;\n\nconst GRIP = svg`<g fill=\"currentColor\"><circle cx=\"7\" cy=\"5\" r=\"1.6\"/><circle cx=\"13\" cy=\"5\" r=\"1.6\"/><circle cx=\"7\" cy=\"10\" r=\"1.6\"/><circle cx=\"13\" cy=\"10\" r=\"1.6\"/><circle cx=\"7\" cy=\"15\" r=\"1.6\"/><circle cx=\"13\" cy=\"15\" r=\"1.6\"/></g>`;\nconst MOVE_BLOCK = svg`<path d=\"M10 2.5v15M6 6.5l4-4 4 4M6 13.5l4 4 4-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>`;\nconst MOVE_INLINE = svg`<path d=\"M2.5 10h15M6.5 6l-4 4 4 4M13.5 6l4 4-4 4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>`;\n\n/** `order` with `item` moved to `position`. */\nfunction moved(order: readonly string[], item: string, position: number): string[] {\n const out = order.filter((id) => id !== item);\n out.splice(position, 0, item);\n return out;\n}\n\n/**\n * The arrangement (item ids by position) that 1-based `positions` per item describe, or null unless every item has\n * its own position from 1 to n (written the way the element writes them).\n */\nfunction arrangementOf(positions: ReadonlyMap<string, string>, items: readonly string[]): string[] | null {\n const order: string[] = [];\n for (const item of items) {\n const value = positions.get(item) ?? '';\n const k = /^[1-9]\\d*$/.test(value) ? Number(value) - 1 : -1;\n if (k < 0 || k >= items.length || order[k] !== undefined) return null;\n order[k] = item;\n }\n return order;\n}\n\n/**\n * `<astl-order>`: items in a list (`vertical`) or in a wrapping row (`horizontal`), each a native button with one tab\n * stop for the whole list. Space or Enter picks an item up, the arrow keys (in reading direction) move it, Space or\n * Enter puts it down, Escape cancels; a click or tap picks an item up and a second one on another item moves it there\n * (no dragging needed); a pointer can also drag it. The light-DOM `<astl-item>` children keep the view order and are\n * slotted manually into the positions. Slots: one per item id; the answer is the 1-based position the item is at.\n * Unanswered until the student first puts an item down.\n */\nexport class OrderElement extends AstlElement {\n static override manifest: ComponentManifest = orderManifest;\n static override messages: readonly MessageCatalog[] = orderUiMessages;\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n slotAssignment: 'manual',\n };\n\n static override properties: PropertyDeclarations = {\n placed: { state: true },\n };\n\n // Notes on the rules are JS comments between css parts: inside a css literal they would ship to every student.\n static override styles: CSSResultGroup = [\n // Read by young students: UI size, never smaller. The task hint and the \"choose its new place\" hint share one\n // cell, so picking an item up never moves the list (under a finger or a pointer).\n css`\n .hints {\n display: grid;\n margin-block-start: var(--astl-space-1);\n color: var(--astl-ink-muted);\n font-family: var(--astl-font-body);\n font-size: var(--astl-size-ui);\n font-weight: 400;\n }\n .hints > * {\n grid-area: 1 / 1;\n }\n .hints > [data-off] {\n visibility: hidden;\n }\n .items {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-2);\n margin: 0;\n padding: 0;\n list-style: none;\n }\n .horizontal .items {\n flex-direction: row;\n flex-wrap: wrap;\n }\n .row {\n position: relative;\n box-sizing: border-box;\n display: flex;\n align-items: flex-start;\n min-inline-size: 0;\n border: var(--astl-outline-width) solid var(--astl-outline);\n border-radius: var(--astl-radius-m);\n background: var(--astl-surface);\n user-select: none;\n hyphens: auto;\n -webkit-user-select: none;\n transition:\n background-color var(--astl-duration-fast),\n box-shadow var(--astl-duration-fast);\n }\n .horizontal .row {\n flex: 0 1 auto;\n max-inline-size: 100%;\n }\n `,\n // Word chips: snug, so a short sentence fits a phone line or two (the target stays 44px).\n css`\n .horizontal .item {\n padding-inline: var(--astl-space-2);\n }\n .horizontal .row > .astl-verdict {\n margin-inline-end: var(--astl-space-2);\n }\n .row:not([data-verdict]):not([data-lifted]):has(.item:enabled:hover) {\n border-color: var(--astl-selected);\n }\n `,\n // Picked up: the theme's selection fill, a lifted shadow and a move icon instead of the grip; in hc also a bar at\n // the inline start and bold text (selected-* tokens), so it never depends on colour and never looks like a verdict\n // border.\n css`\n .row[data-lifted] {\n z-index: 1;\n border-color: var(--astl-selected);\n background: var(--astl-selected-soft);\n box-shadow: 0 var(--astl-space-1) var(--astl-space-3) color-mix(in srgb, var(--astl-ink) 30%, transparent);\n }\n .row[data-lifted]::before {\n content: '';\n position: absolute;\n inset-block: 0;\n inset-inline-start: 0;\n inline-size: var(--astl-selected-bar);\n background: var(--astl-selected);\n }\n .row[data-lifted] .text {\n font-weight: var(--astl-selected-weight);\n }\n `,\n // While an item is picked up, the place a click or tap would send it to.\n css`\n .lifting .row:not([data-lifted]):has(.item:hover) {\n border-color: var(--astl-selected);\n }\n .item {\n flex: 1 1 auto;\n box-sizing: border-box;\n display: flex;\n align-items: flex-start;\n gap: var(--astl-space-2);\n min-inline-size: var(--astl-target-min);\n min-block-size: var(--astl-target-min);\n margin: 0;\n padding-block: var(--astl-space-2);\n padding-inline: var(--astl-space-3);\n border: 0;\n border-radius: inherit;\n background: none;\n color: inherit;\n font: inherit;\n text-align: start;\n cursor: grab;\n }\n .item:disabled {\n cursor: default;\n }\n .row[data-lifted] .item {\n cursor: grabbing;\n }\n `,\n // Touch drags start on the grip of a list item (the rest scrolls the page) or anywhere on a short chip.\n css`\n .grip,\n .horizontal .item {\n touch-action: none;\n }\n .number {\n flex: none;\n min-inline-size: 1.5em;\n color: var(--astl-ink-muted);\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n text-align: end;\n }\n .grip {\n flex: none;\n display: inline-flex;\n align-items: center;\n block-size: 1lh;\n color: var(--astl-ink-muted);\n }\n .row[data-lifted] .grip {\n color: var(--astl-selected);\n }\n `,\n // Locked (review): the grip says nothing can move.\n css`\n .item:disabled .grip {\n color: var(--astl-line);\n }\n .grip svg {\n inline-size: 1em;\n block-size: 1em;\n }\n .text {\n flex: 1 1 auto;\n min-inline-size: 0;\n }\n .row > .astl-verdict {\n flex: none;\n block-size: 1lh;\n margin-block-start: var(--astl-space-2);\n margin-inline-end: var(--astl-space-3);\n }\n .group-verdict {\n margin-block: var(--astl-space-3) 0;\n }\n .solution {\n margin-block-start: var(--astl-space-3);\n padding-block: var(--astl-space-2);\n padding-inline: var(--astl-space-3);\n border: var(--astl-outline-width) solid var(--astl-line);\n border-radius: var(--astl-radius-m);\n }\n .solution-list {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-1);\n margin: var(--astl-space-2) 0 0;\n padding: 0;\n list-style: none;\n }\n `,\n // Words of a sentence read as one: a little more than a space between them.\n css`\n .horizontal .solution-list {\n flex-flow: row wrap;\n column-gap: var(--astl-space-2);\n }\n .solution-item {\n display: flex;\n gap: var(--astl-space-2);\n }\n @media (prefers-reduced-motion: reduce) {\n .row {\n transition: none;\n }\n }\n `,\n blockStyles,\n ];\n\n /** The student's arrangement, item ids by position; null until they first put an item down (unanswered). */\n declare protected placed: readonly string[] | null;\n\n /** One tab stop for the list: the item that has it, by position (it moves with a picked-up item). */\n readonly #roving: RovingFocus;\n /**\n * Picking up and moving: destinations are positions, and the list shows the picked-up item where it would go.\n * Putting it down is an answer, also where it was picked up (a deliberate choice); focus leaving the list puts a\n * moved item down where it is, an item that did not move just goes back.\n */\n readonly #pick: PickAndPlace<number>;\n\n constructor() {\n super();\n this.placed = null;\n const element = this;\n this.#roving = new RovingFocus(this, {\n count: () => this.slotIds.length,\n item: (position) =>\n (this.renderRoot as ShadowRoot).querySelector<HTMLButtonElement>(\n `button[data-position=\"${position}\"]`,\n ),\n // Reading direction: in a row, the next position is to the right in LTR and to the left in RTL.\n get axis() {\n return element.horizontal ? 'inline' : 'block';\n },\n });\n this.#pick = new PickAndPlace<number>(this, {\n destinations: () => this.slotIds.map((_, k) => k),\n current: (item) => (this.placed ?? this.slotIds).indexOf(item),\n at: (x, y, item) => this.#positionAt(x, y, item),\n commit: (item, position) => this.#putDown(item, position),\n // A put where the student last heard the item is \"put down\"; a jump there (a tap on another item, a drag) is\n // \"moved\".\n say: (moment, item, position, from) =>\n this.#message(\n moment === 'pick'\n ? 'ui.pickedUp'\n : moment === 'cancel'\n ? 'ui.cancelled'\n : moment === 'target' || position !== from\n ? 'ui.moved'\n : 'ui.dropped',\n item,\n position,\n ),\n // Focus follows the item, but only while it is in the list (never pulled back from elsewhere).\n changed: (item) => this.#roving.focus(this.shown.indexOf(item)),\n preview: 'live',\n leave: 'drop',\n get axis() {\n return element.horizontal ? 'inline' : 'block';\n },\n // Touch drags start on the grip of a list item (the rest scrolls the page) or anywhere on a short chip.\n get handle() {\n return element.horizontal ? null : '.grip';\n },\n });\n }\n\n get horizontal(): boolean {\n return this.stringAttribute('variant') === 'horizontal';\n }\n\n /** `<astl-item>` children in view order (never the source order). */\n get items(): readonly HTMLElement[] {\n return this.childElements('astl-item');\n }\n\n /** One slot per item, in reading order (the view order): the item ids. */\n get slotIds(): readonly string[] {\n return this.id === '' ? [] : this.items.map((item) => item.id);\n }\n\n /** Item ids by position, as shown now: with the item being moved where it would go; the answer, or the view order. */\n protected get shown(): readonly string[] {\n const order = this.placed ?? this.slotIds;\n const item = this.#pick.picked;\n const target = this.#pick.target;\n return item === null || target === null ? order : moved(order, item, target);\n }\n\n getAnswers(): Answers {\n const placed = this.placed;\n if (placed === null) return {};\n return Object.fromEntries(placed.map((item, k) => [item, String(k + 1)]));\n }\n\n /**\n * Accepts a complete arrangement only (given positions merged over the shown ones), so what is checked is always\n * what the student sees; every item set to `''` makes the list unanswered again.\n */\n setAnswers(answers: Answers): void {\n const slots = this.slotIds;\n const given = slots.filter((slot) => Object.hasOwn(answers, slot));\n if (given.length === 0) return;\n this.#pick.reset();\n if (given.length === slots.length && given.every((slot) => answers[slot] === '')) {\n this.placed = null;\n return;\n }\n const positions = new Map((this.placed ?? slots).map((item, k) => [item, String(k + 1)]));\n for (const slot of given) positions.set(slot, answers[slot] ?? '');\n const next = arrangementOf(positions, slots);\n if (next !== null) this.placed = next;\n }\n\n units(): Units {\n return { answered: this.placed === null ? 0 : 1, total: 1 };\n }\n\n protected override render(): TemplateResult {\n const ui = this.uiLanguage;\n const shown = this.shown;\n const vertical = !this.horizontal;\n const solution = this.#solutionOrder();\n const lifting = this.#pick.picked !== null;\n const classes = `${vertical ? 'vertical' : 'horizontal'}${lifting ? ' lifting' : ''}`;\n return html`<fieldset part=\"order\" class=${classes}>\n <legend part=\"prompt\">\n <slot data-tag=\"astl-prompt\"></slot>\n <span class=\"hints\" lang=${ui.lang}\n ><span class=\"hint\" ?data-off=${lifting}><bdi>${this.t('ui.hint', { count: shown.length })}</bdi></span\n ><span class=\"moving\" ?data-off=${!lifting}><bdi>${this.t('ui.moving')}</bdi></span></span\n >\n </legend>\n <ol class=\"items\" part=\"list\" role=\"list\" @keydown=${this.#keydown}>\n ${shown.map((id, k) => this.#renderItem(id, k, shown.length, vertical))}\n </ol>\n ${this.renderGroupVerdict()}\n ${solution === null ? nothing : this.#renderSolution(solution, vertical)}\n <span id=\"instructions\" hidden lang=${ui.lang} dir=${ui.dir}>${this.t('ui.instructions')}</span>\n </fieldset>`;\n }\n\n #renderItem(id: string, k: number, count: number, vertical: boolean): TemplateResult {\n const lifted = this.#pick.picked === id;\n const verdict = this.#verdictAt(k, id);\n const ui = this.uiLanguage;\n const describedBy = [`position-${k}`, verdict === null ? '' : `verdict-${k}`, 'instructions']\n .filter((ref) => ref !== '')\n .join(' ');\n return html`<li class=\"row astl-box astl-ring\" part=\"item\" data-verdict=${ifDefined(verdict ?? undefined)} ?data-lifted=${lifted}>\n <button\n type=\"button\"\n class=\"item\"\n data-item=${id}\n data-position=${k}\n tabindex=${this.disabled ? -1 : this.#roving.tabIndex(k)}\n ?disabled=${this.disabled}\n aria-describedby=${describedBy}\n @click=${(event: MouseEvent) => this.#pick.click(event, id, k)}\n @pointerdown=${(event: PointerEvent) => this.#pick.pointerdown(event, id)}\n >\n ${vertical ? html`<span class=\"number\" aria-hidden=\"true\">${k + 1}</span>` : nothing}\n <span class=\"grip\" aria-hidden=\"true\"\n ><svg viewBox=\"0 0 20 20\" focusable=\"false\">${lifted ? (vertical ? MOVE_BLOCK : MOVE_INLINE) : GRIP}</svg></span\n >\n <span class=\"text\"><slot data-item=${id}></slot></span>\n </button>\n <span id=\"position-${k}\" hidden lang=${ui.lang} dir=${ui.dir}\n >${this.t('ui.position', { position: k + 1, count })}</span\n >\n ${this.renderVerdict(verdict, { hiddenWord: true, id: `verdict-${k}` })}\n </li>`;\n }\n\n #renderSolution(order: readonly string[], vertical: boolean): TemplateResult {\n const ui = this.uiLanguage;\n const items = new Map(this.items.map((item) => [item.id, item]));\n return html`<div class=\"solution astl-solution\" part=\"solution\">\n ${verdictIcon('correct')}<span class=\"astl-solution-label\" lang=${ui.lang} dir=${ui.dir}>${this.t('ui.solution')}</span>\n <ol class=\"solution-list\" role=\"list\">\n ${order.map(\n (id, k) => html`<li class=\"solution-item\" data-item=${id}>\n ${vertical ? html`<span class=\"number\" aria-hidden=\"true\">${k + 1}</span>` : nothing}\n <span class=\"text\">${this.#copyOf(items.get(id))}</span>\n </li>`,\n )}\n </ol>\n </div>`;\n }\n\n /** The item's content, copied: a light-DOM node can only be slotted once, and the list already shows it. */\n #copyOf(item: HTMLElement | undefined): TemplateResult | typeof nothing {\n if (item === undefined) return nothing;\n return html`<span lang=${ifDefined(item.getAttribute('lang') ?? undefined)} dir=${ifDefined(item.getAttribute('dir') ?? undefined)}\n >${Array.from(item.childNodes, (node) => node.cloneNode(true))}</span\n >`;\n }\n\n /** The verdict of the item shown at position k, while it is still where it was graded (not being moved away). */\n #verdictAt(k: number, id: string): SlotVerdict | null {\n const verdict = this.slotVerdict(id);\n return verdict !== null && (this.placed ?? this.slotIds)[k] === id ? verdict : null;\n }\n\n /** The correct order to show: none without a solution, and none next to an order that is already correct. */\n #solutionOrder(): readonly string[] | null {\n const solution = this.solution;\n if (solution === null || this.groupVerdict === 'correct') return null;\n const slots = this.slotIds;\n return arrangementOf(new Map(slots.map((slot) => [slot, solution[slot] ?? ''])), slots);\n }\n\n // Moving\n\n /** Puts the item down at `position`: the arrangement shown becomes the answer, reported where it changed. */\n #putDown(item: string, position: number): void {\n const before = this.getAnswers();\n this.placed = moved(this.placed ?? this.slotIds, item, position);\n const changed = Object.fromEntries(\n Object.entries(this.getAnswers()).filter(([slot, value]) => before[slot] !== value),\n );\n if (Object.keys(changed).length > 0) this.emitChange(changed);\n }\n\n #message(key: string, item: string, position: number): string {\n const text = (this.items.find((el) => el.id === item)?.textContent ?? '').replace(/\\s+/g, ' ').trim();\n return this.t(key, { item: text, position: position + 1, count: this.slotIds.length });\n }\n\n /** On the picked-up item the arrow keys move it, else they move the list's tab stop. */\n #keydown = (event: KeyboardEvent): void => {\n const button = event.target instanceof HTMLElement ? event.target.closest('button') : null;\n if (button === null || this.disabled) return;\n const position = Number(button.dataset.position);\n if (!this.#pick.keydown(event, this.shown[position] ?? '')) this.#roving.keydown(event, position);\n };\n\n /**\n * The position a dragged item goes to: the item under the pointer, once the pointer has reached its middle (in\n * reading order) on the way there. The halfway rule keeps items of different sizes from swapping back and forth.\n */\n #positionAt(x: number, y: number, item: string): number | null {\n const from = this.shown.indexOf(item);\n const rtl = getComputedStyle(this).direction === 'rtl';\n const rows = [...(this.renderRoot as ShadowRoot).querySelectorAll<HTMLElement>('.items > .row')];\n for (const [k, row] of rows.entries()) {\n if (k === from) continue;\n const r = row.getBoundingClientRect();\n if (x < r.left || x > r.right || y < r.top || y > r.bottom) continue;\n // Distance past the middle in reading order: positive after it, negative before it. The slack lets a pointer\n // dropped on the middle (rounded to whole pixels) count as there.\n const past = this.horizontal\n ? (rtl ? -1 : 1) * (x - (r.left + r.width / 2))\n : y - (r.top + r.height / 2);\n return (k > from ? past >= -MIDDLE_SLACK : past <= MIDDLE_SLACK) ? k : null;\n }\n return null;\n }\n}\n\nexport const orderElement: ElementRegistration = {\n manifest: orderManifest,\n element: OrderElement,\n messages: orderUiMessages,\n};\n"],"mappings":"A,ySAIA,IAAMkB,EAAY,aAMLC,EAA6C,CACxD,CAAE,YAAW,OAAQ,KAAM,SAAUnB,CAAG,EACxC,CAAE,YAAW,OAAQ,KAAM,SAAUC,CAAG,CAC1C,ECMMmB,EA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IW,EAAOmC,GAAQ,GAAgBA,GAAQ5D,GAAgBc,EAAI,IACzE,CACA,OAAO,IACT,CACF,EAEa+C,EAAoC,CAC/C,SAAUpE,EACV,QAASsB,EACT,SAAUhB,CACZ,E"}
|
|
1
|
+
{"version":3,"file":"order-B9gqH5wm.js","names":["en","pl","LitElement","nothing","ifDefined","b","i$1","w","A","verdictIcon","AstlElement","i","en_default","orderManifest","pl_default","PickAndPlace","RovingFocus","blockStyles","namespace","orderUiMessages","MIDDLE_SLACK","GRIP","MOVE_BLOCK","MOVE_INLINE","moved","out","order","id","item","position","arrangementOf","items","value","positions","k","OrderElement","element","#roving","#pick","#positionAt","x","y","#putDown","#message","moment","from","target","placed","slots","given","answers","slot","next","ui","shown","vertical","solution","#solutionOrder","lifting","#keydown","#renderItem","#renderSolution","lifted","verdict","#verdictAt","describedBy","ref","event","#copyOf","node","before","changed","text","el","key","button","rtl","rows","row","r","past","orderElement"],"sources":["../../../../components/src/order/ui-messages.ts","../../../../components/src/order/element.ts"],"sourcesContent":["import type { MessageCatalog } from '@astl/core';\nimport en from './messages/ui/en.json' with { type: 'json' };\nimport pl from './messages/ui/pl.json' with { type: 'json' };\n\nconst namespace = 'astl.order';\n\n/**\n * The student strings (`ui.*`): the element's catalogs. A module of their own, because bundlers split by module: one\n * that also built `orderMessages` would put the authoring strings into the element's chunk.\n */\nexport const orderUiMessages: readonly MessageCatalog[] = [\n { namespace, locale: 'en', messages: en },\n { namespace, locale: 'pl', messages: pl },\n];\n","import type { Answers, ComponentManifest, MessageCatalog, SlotVerdict, Units } from '@astl/core';\nimport { AstlElement, type ElementRegistration, verdictIcon } from '@astl/player';\nimport { PickAndPlace, RovingFocus } from '@astl/player/interaction';\nimport {\n type CSSResultGroup,\n css,\n html,\n LitElement,\n nothing,\n type PropertyDeclarations,\n svg,\n type TemplateResult,\n} from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { blockStyles } from '../block-styles.js';\nimport { orderManifest } from './manifest.js';\nimport { orderUiMessages } from './ui-messages.js';\n\n/** px around an item's middle that already count as its middle while dragging. */\nconst MIDDLE_SLACK = 2;\n\nconst GRIP = svg`<g fill=\"currentColor\"><circle cx=\"7\" cy=\"5\" r=\"1.6\"/><circle cx=\"13\" cy=\"5\" r=\"1.6\"/><circle cx=\"7\" cy=\"10\" r=\"1.6\"/><circle cx=\"13\" cy=\"10\" r=\"1.6\"/><circle cx=\"7\" cy=\"15\" r=\"1.6\"/><circle cx=\"13\" cy=\"15\" r=\"1.6\"/></g>`;\nconst MOVE_BLOCK = svg`<path d=\"M10 2.5v15M6 6.5l4-4 4 4M6 13.5l4 4 4-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>`;\nconst MOVE_INLINE = svg`<path d=\"M2.5 10h15M6.5 6l-4 4 4 4M13.5 6l4 4-4 4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>`;\n\n/** `order` with `item` moved to `position`. */\nfunction moved(order: readonly string[], item: string, position: number): string[] {\n const out = order.filter((id) => id !== item);\n out.splice(position, 0, item);\n return out;\n}\n\n/**\n * The arrangement (item ids by position) that 1-based `positions` per item describe, or null unless every item has\n * its own position from 1 to n (written the way the element writes them).\n */\nfunction arrangementOf(positions: ReadonlyMap<string, string>, items: readonly string[]): string[] | null {\n const order: string[] = [];\n for (const item of items) {\n const value = positions.get(item) ?? '';\n const k = /^[1-9]\\d*$/.test(value) ? Number(value) - 1 : -1;\n if (k < 0 || k >= items.length || order[k] !== undefined) return null;\n order[k] = item;\n }\n return order;\n}\n\n/**\n * `<astl-order>`: items in a list (`vertical`) or in a wrapping row (`horizontal`), each a native button with one tab\n * stop for the whole list. Space or Enter picks an item up, the arrow keys (in reading direction) move it, Space or\n * Enter puts it down, Escape cancels; a click or tap picks an item up and a second one on another item moves it there\n * (no dragging needed); a pointer can also drag it. The light-DOM `<astl-item>` children keep the view order and are\n * slotted manually into the positions. Slots: one per item id; the answer is the 1-based position the item is at.\n * Unanswered until the student first puts an item down.\n */\nexport class OrderElement extends AstlElement {\n static override manifest: ComponentManifest = orderManifest;\n static override messages: readonly MessageCatalog[] = orderUiMessages;\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n slotAssignment: 'manual',\n };\n\n static override properties: PropertyDeclarations = {\n placed: { state: true },\n };\n\n // Notes on the rules are JS comments between css parts: inside a css literal they would ship to every student.\n static override styles: CSSResultGroup = [\n // Read by young students: UI size, never smaller. The task hint and the \"choose its new place\" hint share one\n // cell, so picking an item up never moves the list (under a finger or a pointer).\n css`\n .hints {\n display: grid;\n margin-block-start: var(--astl-space-1);\n color: var(--astl-ink-muted);\n font-family: var(--astl-font-body);\n font-size: var(--astl-size-ui);\n font-weight: 400;\n }\n .hints > * {\n grid-area: 1 / 1;\n }\n .hints > [data-off] {\n visibility: hidden;\n }\n .items {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-2);\n margin: 0;\n padding: 0;\n list-style: none;\n }\n .horizontal .items {\n flex-direction: row;\n flex-wrap: wrap;\n }\n .row {\n position: relative;\n box-sizing: border-box;\n display: flex;\n align-items: flex-start;\n min-inline-size: 0;\n border: var(--astl-outline-width) solid var(--astl-outline);\n border-radius: var(--astl-radius-m);\n background: var(--astl-surface);\n user-select: none;\n hyphens: auto;\n -webkit-user-select: none;\n transition:\n background-color var(--astl-duration-fast),\n box-shadow var(--astl-duration-fast);\n }\n .horizontal .row {\n flex: 0 1 auto;\n max-inline-size: 100%;\n }\n `,\n // Word chips: snug, so a short sentence fits a phone line or two (the target stays 44px).\n css`\n .horizontal .item {\n padding-inline: var(--astl-space-2);\n }\n .horizontal .row > .astl-verdict {\n margin-inline-end: var(--astl-space-2);\n }\n .row:not([data-verdict]):not([data-lifted]):has(.item:enabled:hover) {\n border-color: var(--astl-selected);\n }\n `,\n // Picked up: the theme's selection fill, a lifted shadow and a move icon instead of the grip; in hc also a bar at\n // the inline start and bold text (selected-* tokens), so it never depends on colour and never looks like a verdict\n // border.\n css`\n .row[data-lifted] {\n z-index: 1;\n border-color: var(--astl-selected);\n background: var(--astl-selected-soft);\n box-shadow: 0 var(--astl-space-1) var(--astl-space-3) color-mix(in srgb, var(--astl-ink) 30%, transparent);\n }\n .row[data-lifted]::before {\n content: '';\n position: absolute;\n inset-block: 0;\n inset-inline-start: 0;\n inline-size: var(--astl-selected-bar);\n background: var(--astl-selected);\n }\n .row[data-lifted] .text {\n font-weight: var(--astl-selected-weight);\n }\n `,\n // While an item is picked up, the place a click or tap would send it to.\n css`\n .lifting .row:not([data-lifted]):has(.item:hover) {\n border-color: var(--astl-selected);\n }\n .item {\n flex: 1 1 auto;\n box-sizing: border-box;\n display: flex;\n align-items: flex-start;\n gap: var(--astl-space-2);\n min-inline-size: var(--astl-target-min);\n min-block-size: var(--astl-target-min);\n margin: 0;\n padding-block: var(--astl-space-2);\n padding-inline: var(--astl-space-3);\n border: 0;\n border-radius: inherit;\n background: none;\n color: inherit;\n font: inherit;\n text-align: start;\n cursor: grab;\n }\n .item:disabled {\n cursor: default;\n }\n .row[data-lifted] .item {\n cursor: grabbing;\n }\n `,\n // Touch drags start on the grip of a list item (the rest scrolls the page) or anywhere on a short chip.\n css`\n .grip,\n .horizontal .item {\n touch-action: none;\n }\n .number {\n flex: none;\n min-inline-size: 1.5em;\n color: var(--astl-ink-muted);\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n text-align: end;\n }\n .grip {\n flex: none;\n display: inline-flex;\n align-items: center;\n block-size: 1lh;\n color: var(--astl-ink-muted);\n }\n .row[data-lifted] .grip {\n color: var(--astl-selected);\n }\n `,\n // Locked (review): the grip says nothing can move.\n css`\n .item:disabled .grip {\n color: var(--astl-line);\n }\n .grip svg {\n inline-size: 1em;\n block-size: 1em;\n }\n .text {\n flex: 1 1 auto;\n min-inline-size: 0;\n }\n .row > .astl-verdict {\n flex: none;\n block-size: 1lh;\n margin-block-start: var(--astl-space-2);\n margin-inline-end: var(--astl-space-3);\n }\n .group-verdict {\n margin-block: var(--astl-space-3) 0;\n }\n .solution {\n margin-block-start: var(--astl-space-3);\n padding-block: var(--astl-space-2);\n padding-inline: var(--astl-space-3);\n border: var(--astl-outline-width) solid var(--astl-line);\n border-radius: var(--astl-radius-m);\n }\n .solution-list {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-1);\n margin: var(--astl-space-2) 0 0;\n padding: 0;\n list-style: none;\n }\n `,\n // Words of a sentence read as one: a little more than a space between them.\n css`\n .horizontal .solution-list {\n flex-flow: row wrap;\n column-gap: var(--astl-space-2);\n }\n .solution-item {\n display: flex;\n gap: var(--astl-space-2);\n }\n @media (prefers-reduced-motion: reduce) {\n .row {\n transition: none;\n }\n }\n `,\n blockStyles,\n ];\n\n /** The student's arrangement, item ids by position; null until they first put an item down (unanswered). */\n declare protected placed: readonly string[] | null;\n\n /** One tab stop for the list: the item that has it, by position (it moves with a picked-up item). */\n readonly #roving: RovingFocus;\n /**\n * Picking up and moving: destinations are positions, and the list shows the picked-up item where it would go.\n * Putting it down is an answer, also where it was picked up (a deliberate choice); focus leaving the list puts a\n * moved item down where it is, an item that did not move just goes back.\n */\n readonly #pick: PickAndPlace<number>;\n\n constructor() {\n super();\n this.placed = null;\n const element = this;\n this.#roving = new RovingFocus(this, {\n count: () => this.slotIds.length,\n item: (position) =>\n (this.renderRoot as ShadowRoot).querySelector<HTMLButtonElement>(\n `button[data-position=\"${position}\"]`,\n ),\n // Reading direction: in a row, the next position is to the right in LTR and to the left in RTL.\n get axis() {\n return element.horizontal ? 'inline' : 'block';\n },\n });\n this.#pick = new PickAndPlace<number>(this, {\n destinations: () => this.slotIds.map((_, k) => k),\n current: (item) => (this.placed ?? this.slotIds).indexOf(item),\n at: (x, y, item) => this.#positionAt(x, y, item),\n commit: (item, position) => this.#putDown(item, position),\n // A put where the student last heard the item is \"put down\"; a jump there (a tap on another item, a drag) is\n // \"moved\".\n say: (moment, item, position, from) =>\n this.#message(\n moment === 'pick'\n ? 'ui.pickedUp'\n : moment === 'cancel'\n ? 'ui.cancelled'\n : moment === 'target' || position !== from\n ? 'ui.moved'\n : 'ui.dropped',\n item,\n position,\n ),\n // Focus follows the item, but only while it is in the list (never pulled back from elsewhere).\n changed: (item) => this.#roving.focus(this.shown.indexOf(item)),\n preview: 'live',\n leave: 'drop',\n get axis() {\n return element.horizontal ? 'inline' : 'block';\n },\n // Touch drags start on the grip of a list item (the rest scrolls the page) or anywhere on a short chip.\n get handle() {\n return element.horizontal ? null : '.grip';\n },\n });\n }\n\n get horizontal(): boolean {\n return this.stringAttribute('variant') === 'horizontal';\n }\n\n /** `<astl-item>` children in view order (never the source order). */\n get items(): readonly HTMLElement[] {\n return this.childElements('astl-item');\n }\n\n /** One slot per item, in reading order (the view order): the item ids. */\n get slotIds(): readonly string[] {\n return this.id === '' ? [] : this.items.map((item) => item.id);\n }\n\n /** Item ids by position, as shown now: with the item being moved where it would go; the answer, or the view order. */\n protected get shown(): readonly string[] {\n const order = this.placed ?? this.slotIds;\n const item = this.#pick.picked;\n const target = this.#pick.target;\n return item === null || target === null ? order : moved(order, item, target);\n }\n\n getAnswers(): Answers {\n const placed = this.placed;\n if (placed === null) return {};\n return Object.fromEntries(placed.map((item, k) => [item, String(k + 1)]));\n }\n\n /**\n * Accepts a complete arrangement only (given positions merged over the shown ones), so what is checked is always\n * what the student sees; every item set to `''` makes the list unanswered again.\n */\n setAnswers(answers: Answers): void {\n const slots = this.slotIds;\n const given = slots.filter((slot) => Object.hasOwn(answers, slot));\n if (given.length === 0) return;\n this.#pick.reset();\n if (given.length === slots.length && given.every((slot) => answers[slot] === '')) {\n this.placed = null;\n return;\n }\n const positions = new Map((this.placed ?? slots).map((item, k) => [item, String(k + 1)]));\n for (const slot of given) positions.set(slot, answers[slot] ?? '');\n const next = arrangementOf(positions, slots);\n if (next !== null) this.placed = next;\n }\n\n units(): Units {\n return { answered: this.placed === null ? 0 : 1, total: 1 };\n }\n\n protected override render(): TemplateResult {\n const ui = this.uiLanguage;\n const shown = this.shown;\n const vertical = !this.horizontal;\n const solution = this.#solutionOrder();\n const lifting = this.#pick.picked !== null;\n const classes = `${vertical ? 'vertical' : 'horizontal'}${lifting ? ' lifting' : ''}`;\n return html`<fieldset part=\"order\" class=${classes}>\n <legend part=\"prompt\">\n <slot data-tag=\"astl-prompt\"></slot>\n <span class=\"hints\" lang=${ui.lang}\n ><span class=\"hint\" ?data-off=${lifting}><bdi>${this.t('ui.hint', { count: shown.length })}</bdi></span\n ><span class=\"moving\" ?data-off=${!lifting}><bdi>${this.t('ui.moving')}</bdi></span></span\n >\n </legend>\n <ol class=\"items\" part=\"list\" role=\"list\" @keydown=${this.#keydown}>\n ${shown.map((id, k) => this.#renderItem(id, k, shown.length, vertical))}\n </ol>\n ${this.renderGroupVerdict()}\n ${solution === null ? nothing : this.#renderSolution(solution, vertical)}\n <span id=\"instructions\" hidden lang=${ui.lang} dir=${ui.dir}>${this.t('ui.instructions')}</span>\n </fieldset>`;\n }\n\n #renderItem(id: string, k: number, count: number, vertical: boolean): TemplateResult {\n const lifted = this.#pick.picked === id;\n const verdict = this.#verdictAt(k, id);\n const ui = this.uiLanguage;\n const describedBy = [`position-${k}`, verdict === null ? '' : `verdict-${k}`, 'instructions']\n .filter((ref) => ref !== '')\n .join(' ');\n return html`<li class=\"row astl-box astl-ring\" part=\"item\" data-verdict=${ifDefined(verdict ?? undefined)} ?data-lifted=${lifted}>\n <button\n type=\"button\"\n class=\"item\"\n data-item=${id}\n data-position=${k}\n tabindex=${this.disabled ? -1 : this.#roving.tabIndex(k)}\n ?disabled=${this.disabled}\n aria-describedby=${describedBy}\n @click=${(event: MouseEvent) => this.#pick.click(event, id, k)}\n @pointerdown=${(event: PointerEvent) => this.#pick.pointerdown(event, id)}\n >\n ${vertical ? html`<span class=\"number\" aria-hidden=\"true\">${k + 1}</span>` : nothing}\n <span class=\"grip\" aria-hidden=\"true\"\n ><svg viewBox=\"0 0 20 20\" focusable=\"false\">${lifted ? (vertical ? MOVE_BLOCK : MOVE_INLINE) : GRIP}</svg></span\n >\n <span class=\"text\"><slot data-item=${id}></slot></span>\n </button>\n <span id=\"position-${k}\" hidden lang=${ui.lang} dir=${ui.dir}\n >${this.t('ui.position', { position: k + 1, count })}</span\n >\n ${this.renderVerdict(verdict, { hiddenWord: true, id: `verdict-${k}` })}\n </li>`;\n }\n\n #renderSolution(order: readonly string[], vertical: boolean): TemplateResult {\n const ui = this.uiLanguage;\n const items = new Map(this.items.map((item) => [item.id, item]));\n return html`<div class=\"solution astl-solution\" part=\"solution\">\n ${verdictIcon('correct')}<span class=\"astl-solution-label\" lang=${ui.lang} dir=${ui.dir}>${this.t('ui.solution')}</span>\n <ol class=\"solution-list\" role=\"list\">\n ${order.map(\n (id, k) => html`<li class=\"solution-item\" data-item=${id}>\n ${vertical ? html`<span class=\"number\" aria-hidden=\"true\">${k + 1}</span>` : nothing}\n <span class=\"text\">${this.#copyOf(items.get(id))}</span>\n </li>`,\n )}\n </ol>\n </div>`;\n }\n\n /** The item's content, copied: a light-DOM node can only be slotted once, and the list already shows it. */\n #copyOf(item: HTMLElement | undefined): TemplateResult | typeof nothing {\n if (item === undefined) return nothing;\n return html`<span lang=${ifDefined(item.getAttribute('lang') ?? undefined)} dir=${ifDefined(item.getAttribute('dir') ?? undefined)}\n >${Array.from(item.childNodes, (node) => node.cloneNode(true))}</span\n >`;\n }\n\n /** The verdict of the item shown at position k, while it is still where it was graded (not being moved away). */\n #verdictAt(k: number, id: string): SlotVerdict | null {\n const verdict = this.slotVerdict(id);\n return verdict !== null && (this.placed ?? this.slotIds)[k] === id ? verdict : null;\n }\n\n /** The correct order to show: none without a solution, and none next to an order that is already correct. */\n #solutionOrder(): readonly string[] | null {\n const solution = this.solution;\n if (solution === null || this.groupVerdict === 'correct') return null;\n const slots = this.slotIds;\n return arrangementOf(new Map(slots.map((slot) => [slot, solution[slot] ?? ''])), slots);\n }\n\n // Moving\n\n /** Puts the item down at `position`: the arrangement shown becomes the answer, reported where it changed. */\n #putDown(item: string, position: number): void {\n const before = this.getAnswers();\n this.placed = moved(this.placed ?? this.slotIds, item, position);\n const changed = Object.fromEntries(\n Object.entries(this.getAnswers()).filter(([slot, value]) => before[slot] !== value),\n );\n if (Object.keys(changed).length > 0) this.emitChange(changed);\n }\n\n #message(key: string, item: string, position: number): string {\n const text = (this.items.find((el) => el.id === item)?.textContent ?? '').replace(/\\s+/g, ' ').trim();\n return this.t(key, { item: text, position: position + 1, count: this.slotIds.length });\n }\n\n /** On the picked-up item the arrow keys move it, else they move the list's tab stop. */\n #keydown = (event: KeyboardEvent): void => {\n const button = event.target instanceof HTMLElement ? event.target.closest('button') : null;\n if (button === null || this.disabled) return;\n const position = Number(button.dataset.position);\n if (!this.#pick.keydown(event, this.shown[position] ?? '')) this.#roving.keydown(event, position);\n };\n\n /**\n * The position a dragged item goes to: the item under the pointer, once the pointer has reached its middle (in\n * reading order) on the way there. The halfway rule keeps items of different sizes from swapping back and forth.\n */\n #positionAt(x: number, y: number, item: string): number | null {\n const from = this.shown.indexOf(item);\n const rtl = getComputedStyle(this).direction === 'rtl';\n const rows = [...(this.renderRoot as ShadowRoot).querySelectorAll<HTMLElement>('.items > .row')];\n for (const [k, row] of rows.entries()) {\n if (k === from) continue;\n const r = row.getBoundingClientRect();\n if (x < r.left || x > r.right || y < r.top || y > r.bottom) continue;\n // Distance past the middle in reading order: positive after it, negative before it. The slack lets a pointer\n // dropped on the middle (rounded to whole pixels) count as there.\n const past = this.horizontal\n ? (rtl ? -1 : 1) * (x - (r.left + r.width / 2))\n : y - (r.top + r.height / 2);\n return (k > from ? past >= -MIDDLE_SLACK : past <= MIDDLE_SLACK) ? k : null;\n }\n return null;\n }\n}\n\nexport const orderElement: ElementRegistration = {\n manifest: orderManifest,\n element: OrderElement,\n messages: orderUiMessages,\n};\n"],"mappings":"A,ySAIA,IAAMkB,EAAY,aAMLC,EAA6C,CACxD,CAAE,YAAW,OAAQ,KAAM,SAAUnB,C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Q,IAC1CtC,GAAKsC,EAAE,IAAMA,EAAE,OAAS,GAC5B,OAAQ7C,EAAIW,EAAOmC,GAAQ,GAAgBA,GAAQ5D,GAAgBc,EAAI,IACzE,CACA,OAAO,IACT,CACF,EAEa+C,EAAoC,CAC/C,SAAUpE,EACV,QAASsB,EACT,SAAUhB,CACZ,E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as e,E as t,S as n,b as r}from"./runtime-
|
|
1
|
+
import{C as e,E as t,S as n,b as r}from"./runtime-C25QK5B0.js";import{c as i,l as a,s as o}from"./directive-helpers-US6zRjJ1.js";var s=o(class extends i{#e={};constructor(e){if(super(e),e.type!==a.ELEMENT)throw Error(`styles() belongs on an element, not in an attribute or text`)}render(e){return n}update(e,[t]){let{style:r}=e.element;for(let e of Object.keys(this.#e))Object.hasOwn(t,e)||r.removeProperty(e);for(let[e,n]of Object.entries(t))this.#e[e]!==n&&r.setProperty(e,n);return this.#e={...t},n}});function c(e,t){if(t!==null)return t;let n=Number(e.getAttribute(`width`)),r=Number(e.getAttribute(`height`));return n>0&&r>0?n/r:4/3}function l(t,n,i,a,o={}){let c=t.getAttribute(`src`)??``;return e`<div
|
|
2
2
|
class="picture"
|
|
3
3
|
part="picture"
|
|
4
4
|
dir="ltr"
|
|
@@ -89,4 +89,4 @@ margin-inline: auto;
|
|
|
89
89
|
pointer-events: auto;
|
|
90
90
|
}
|
|
91
91
|
`;export{d as a,l as i,u as n,s as o,f as r,c as t};
|
|
92
|
-
//# sourceMappingURL=picture-view-
|
|
92
|
+
//# sourceMappingURL=picture-view-Deodu_mb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"picture-view-
|
|
1
|
+
{"version":3,"file":"picture-view-Deodu_mb.js","names":["Directive","PartType","noChange","directive","nothing","b","i","E","A","i$1","t","e","styles","part","name","#last","style","value","aspectOf","loaded","width","host","height","renderPicture","src","attributes","aspect","img","event","content","percent","values","renderSlide","item","pictureStyles"],"sources":["../../../../components/src/picture-view.ts"],"sourcesContent":["/**\n * The picture of the picture types (hotspot, image drop, image label) on the student side: one box of the picture's\n * shape, the picture filling it, and what sits on it placed in percent of the picture. Elements only (it loads Lit);\n * the geometry both sides share is in `picture.ts`.\n *\n * The box takes the picture's aspect ratio: as loaded, else from the element's `width` and `height`, else 4:3 until it\n * loads. So the layout never waits for the picture, and places stay where they belong if it fails to load.\n */\nimport { type CSSResultGroup, css, html, noChange, nothing, type TemplateResult } from 'lit';\nimport {\n Directive,\n type DirectiveResult,\n directive,\n type ElementPart,\n type PartInfo,\n PartType,\n} from 'lit/directive.js';\n\ntype Styles = Readonly<Record<string, string>>;\n\n/**\n * Sets CSS properties (hyphenated names, `--x` too) on the element it sits on, always through the CSSOM. Lit's\n * `styleMap` writes its first render as a `style` attribute, which a strict Content Security Policy blocks\n * (`style-src-attr`). On a change it sets only what changed, and removes what is gone.\n */\nclass StylesDirective extends Directive {\n #last: Styles = {};\n\n constructor(part: PartInfo) {\n super(part);\n if (part.type !== PartType.ELEMENT)\n throw new Error('styles() belongs on an element, not in an attribute or text');\n }\n\n render(_styles: Styles): unknown {\n return noChange;\n }\n\n override update(part: ElementPart, [styles]: [Styles]): unknown {\n const { style } = part.element as HTMLElement;\n for (const name of Object.keys(this.#last)) if (!Object.hasOwn(styles, name)) style.removeProperty(name);\n for (const [name, value] of Object.entries(styles))\n if (this.#last[name] !== value) style.setProperty(name, value);\n this.#last = { ...styles };\n return noChange;\n }\n}\n\n/** The CSS properties of an element, set through the CSSOM (see `StylesDirective`): `<span ${styles({...})}>`. */\nexport const styles: (styles: Styles) => DirectiveResult = directive(StylesDirective);\n\n/** The picture's width over its height (see above); `loaded` is the aspect of the loaded picture, if any. */\nexport function aspectOf(host: Element, loaded: number | null): number {\n if (loaded !== null) return loaded;\n const width = Number(host.getAttribute('width'));\n const height = Number(host.getAttribute('height'));\n return width > 0 && height > 0 ? width / height : 4 / 3;\n}\n\n/**\n * The picture's box with `content` on it. The picture loads as pictures in content do: lazily, decoded off the main\n * thread, and with no referrer (its host learns nothing of the page). `loaded` gets its aspect once it is there. The\n * box never mirrors (coordinates count from the left edge), and its shape is set through the CSSOM (`styles`).\n */\nexport function renderPicture(\n host: Element,\n aspect: number,\n loaded: (aspect: number) => void,\n content: unknown,\n attributes: {\n readonly alt?: string;\n readonly role?: string;\n readonly label?: string;\n readonly describedBy?: string | undefined;\n } = {},\n): TemplateResult {\n const src = host.getAttribute('src') ?? '';\n return html`<div\n class=\"picture\"\n part=\"picture\"\n dir=\"ltr\"\n role=${attributes.role ?? nothing}\n aria-label=${attributes.label ?? nothing}\n aria-describedby=${attributes.describedBy ?? nothing}\n ${styles({ 'aspect-ratio': String(aspect) })}\n >\n ${\n src === ''\n ? nothing\n : html`<img\n class=\"photo\"\n src=${src}\n alt=${attributes.alt ?? ''}\n loading=\"lazy\"\n decoding=\"async\"\n referrerpolicy=\"no-referrer\"\n draggable=\"false\"\n @load=${(event: Event) => {\n const img = event.target as HTMLImageElement;\n if (img.naturalHeight > 0) loaded(img.naturalWidth / img.naturalHeight);\n }}\n />`\n }${content}\n </div>`;\n}\n\n/** CSS variables in percent of the picture, for `styles`: `{ x: 10 }` gives `--x: 10%`. */\nexport function percent(values: Readonly<Record<string, number>>): Record<string, string> {\n return Object.fromEntries(Object.entries(values).map(([name, value]) => [`--${name}`, `${value}%`]));\n}\n\n/** `item` centred on the point (`x`, `y` in percent of the picture) and kept inside the picture: see `.slide`. */\nexport function renderSlide(x: number, y: number, item: TemplateResult): TemplateResult {\n return html`<div class=\"slide\" ${styles(percent({ x, y }))}><div class=\"lane\">${item}</div></div>`;\n}\n\n// `.box` covers a zone (`--x`, `--y` its corner, `--w`, `--h` its size). `.point` centres an item of the size `--size`\n// on the point `--x`, `--y`, kept inside the picture near its edges. `.slide` centres an item of any size on the point\n// `--x`, `--y` and keeps it inside the picture, so it still covers the point. Laid out, not moved: a column across\n// the picture's height holds a row across its width, which holds the item; in each, a spacer before or after takes\n// twice the point's distance from the middle, and auto margins centre what is left over the point. An item too big\n// for that shrinks the spacer instead, so it stops at the picture's edge. Neither the column nor the row takes the\n// pointer. The picture fills the box: it is drawn as the box has it, so places in percent stay true.\nexport const pictureStyles: CSSResultGroup = css`\n .picture {\n position: relative;\n box-sizing: border-box;\n inline-size: 100%;\n border-radius: var(--astl-radius-m);\n background: var(--astl-canvas);\n user-select: none;\n -webkit-user-select: none;\n }\n .photo {\n position: absolute;\n inset: 0;\n display: block;\n inline-size: 100%;\n block-size: 100%;\n border-radius: inherit;\n }\n .box {\n position: absolute;\n inset-inline-start: var(--x);\n inset-block-start: var(--y);\n inline-size: var(--w);\n block-size: var(--h);\n }\n .point {\n position: absolute;\n inset-inline-start: clamp(calc(var(--size) / 2), var(--x), calc(100% - var(--size) / 2));\n inset-block-start: clamp(calc(var(--size) / 2), var(--y), calc(100% - var(--size) / 2));\n translate: -50% -50%;\n }\n .slide,\n .lane {\n display: flex;\n pointer-events: none;\n }\n .slide {\n position: absolute;\n inset: 0;\n flex-direction: column;\n }\n .slide::before,\n .slide::after,\n .lane::before,\n .lane::after {\n content: '';\n flex-grow: 0;\n flex-shrink: 1;\n }\n .slide::before {\n flex-basis: max(0%, calc(2 * var(--y) - 100%));\n }\n .slide::after {\n flex-basis: max(0%, calc(100% - 2 * var(--y)));\n }\n .lane::before {\n flex-basis: max(0%, calc(2 * var(--x) - 100%));\n }\n .lane::after {\n flex-basis: max(0%, calc(100% - 2 * var(--x)));\n }\n .lane {\n flex: none;\n margin-block: auto;\n }\n .lane > * {\n flex: none;\n max-inline-size: 100%;\n margin-inline: auto;\n pointer-events: auto;\n }\n`;\n"],"mappings":"A,iIAiDA,IAAaY,EAA8CT,EAAU,cAxBvCH,CAAU,CACtC,GAAgB,CAAC,EAEjB,YAAY,EAAgB,CAE1B,GADA,MAAMa,CAAI,EACNA,EAAK,OAASZ,EAAS,QACzB,MAAU,MAAM,6DAA6D,CACjF,CAEA,OAAO,EAA0B,CAC/B,OAAOC,CACT,CAEA,OA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C,CAAC,CACrG,CAGA,SAAgBe,EAAY,EAAW,EAAW,EAAsC,CACtF,MAAO,EAAI,sBAAsBpB,EAAOkB,EAAQ,CAAE,IAAG,GAAE,CAAC,CAAC,EAAE,qBAAqBG,EAAK,aACvF,CASA,IAAaC,EAAgC,CAAG"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{S as e}from"./runtime-
|
|
1
|
+
import{S as e}from"./runtime-C25QK5B0.js";import{a as t,c as n,l as r,n as i,o as a,r as o,s,t as c}from"./directive-helpers-US6zRjJ1.js";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2017 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
6
|
*/
|
|
7
7
|
var l=(e,t,n)=>{let r=new Map;for(let i=t;i<=n;i++)r.set(e[i],i);return r},u=s(class extends n{constructor(e){if(super(e),e.type!==r.CHILD)throw Error(`repeat() can only be used in text expressions`)}dt(e,t,n){let r;n===void 0?n=t:t!==void 0&&(r=t);let i=[],a=[],o=0;for(let t of e)i[o]=r?r(t,o):o,a[o]=n(t,o),o++;return{values:a,keys:i}}render(e,t,n){return this.dt(e,t,n).values}update(n,[r,s,u]){let d=c(n),{values:f,keys:p}=this.dt(r,s,u);if(!Array.isArray(d))return this.ut=p,f;let m=this.ut??=[],h=[],g,_,v=0,y=d.length-1,b=0,x=f.length-1;for(;v<=y&&b<=x;)if(d[v]===null)v++;else if(d[y]===null)y--;else if(m[v]===p[b])h[b]=t(d[v],f[b]),v++,b++;else if(m[y]===p[x])h[x]=t(d[y],f[x]),y--,x--;else if(m[v]===p[x])h[x]=t(d[v],f[x]),a(n,h[x+1],d[v]),v++,x--;else if(m[y]===p[b])h[b]=t(d[y],f[b]),a(n,d[v],d[y]),y--,b++;else if(g===void 0&&(g=l(p,b,x),_=l(m,v,y)),g.has(m[v])){if(g.has(m[y])){let e=_.get(p[b]),r=e===void 0?null:d[e];if(r===null){let e=a(n,d[v]);t(e,f[b]),h[b]=e}else h[b]=t(r,f[b]),a(n,d[v],r),d[e]=null;b++}else i(d[y]),y--}else i(d[v]),v++;for(;b<=x;){let e=a(n,h[x+1]);t(e,f[b]),h[b++]=e}for(;v<=y;){let e=d[v++];e!==null&&i(e)}return this.ut=p,o(n,h),e}});export{u as t};
|
|
8
|
-
//# sourceMappingURL=repeat-
|
|
8
|
+
//# sourceMappingURL=repeat-BDXokpxQ.js.map
|