@astl/astrolabe 0.1.3 → 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.
Files changed (102) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cdn/astrolabe-editor.js +3 -3
  3. package/dist/cdn/astrolabe-player.js +1 -1
  4. package/dist/cdn/astrolabe.js +1 -1
  5. package/dist/cdn/astrolabe.standalone.js +1084 -1075
  6. package/dist/cdn/chunks/{audio-B0LSIn5N.js → audio-Biof5aA3.js} +2 -2
  7. package/dist/cdn/chunks/{audio-B0LSIn5N.js.map → audio-Biof5aA3.js.map} +1 -1
  8. package/dist/cdn/chunks/{block-styles-CKo9x7Vt.js → block-styles-CCtSFM4j.js} +2 -2
  9. package/dist/cdn/chunks/{block-styles-CKo9x7Vt.js.map → block-styles-CCtSFM4j.js.map} +1 -1
  10. package/dist/cdn/chunks/{book-CHzDDaim.js → book-IFipARhv.js} +2 -2
  11. package/dist/cdn/chunks/{book-CHzDDaim.js.map → book-IFipARhv.js.map} +1 -1
  12. package/dist/cdn/chunks/{callout-QFLFLPc5.js → callout-CuajbbYY.js} +2 -2
  13. package/dist/cdn/chunks/{callout-QFLFLPc5.js.map → callout-CuajbbYY.js.map} +1 -1
  14. package/dist/cdn/chunks/{categorise-BO2tNVJ3.js → categorise-Cm6kXLXw.js} +2 -2
  15. package/dist/cdn/chunks/{categorise-BO2tNVJ3.js.map → categorise-Cm6kXLXw.js.map} +1 -1
  16. package/dist/cdn/chunks/{chip-styles-Dme5daTO.js → chip-styles--gboWK2Z.js} +2 -2
  17. package/dist/cdn/chunks/{chip-styles-Dme5daTO.js.map → chip-styles--gboWK2Z.js.map} +1 -1
  18. package/dist/cdn/chunks/{choice-CExBvqKj.js → choice-BSpB6LHl.js} +2 -2
  19. package/dist/cdn/chunks/{choice-CExBvqKj.js.map → choice-BSpB6LHl.js.map} +1 -1
  20. package/dist/cdn/chunks/{color-control-Cl5cuMSO.js → color-control-1kkdM8ns.js} +2 -2
  21. package/dist/cdn/chunks/{color-control-Cl5cuMSO.js.map → color-control-1kkdM8ns.js.map} +1 -1
  22. package/dist/cdn/chunks/{crossword-Cb-a3Tjj.js → crossword-BdOAEPcL.js} +2 -2
  23. package/dist/cdn/chunks/{crossword-Cb-a3Tjj.js.map → crossword-BdOAEPcL.js.map} +1 -1
  24. package/dist/cdn/chunks/{definitions-CNX90WtL.js → definitions-BybSa1mq.js} +2 -2
  25. package/dist/cdn/chunks/{definitions-CNX90WtL.js.map → definitions-BybSa1mq.js.map} +1 -1
  26. package/dist/cdn/chunks/{directive-helpers-D7lOZKnB.js → directive-helpers-US6zRjJ1.js} +2 -2
  27. package/dist/cdn/chunks/{directive-helpers-D7lOZKnB.js.map → directive-helpers-US6zRjJ1.js.map} +1 -1
  28. package/dist/cdn/chunks/{drop-vRXndjHu.js → drop-D4NQ0WK_.js} +2 -2
  29. package/dist/cdn/chunks/{drop-vRXndjHu.js.map → drop-D4NQ0WK_.js.map} +1 -1
  30. package/dist/cdn/chunks/{flash-cards-0NrrKdrx.js → flash-cards-D4ebb5m6.js} +2 -2
  31. package/dist/cdn/chunks/{flash-cards-0NrrKdrx.js.map → flash-cards-D4ebb5m6.js.map} +1 -1
  32. package/dist/cdn/chunks/{gap-lor-khst.js → gap-D-Sipuyu.js} +2 -2
  33. package/dist/cdn/chunks/{gap-lor-khst.js.map → gap-D-Sipuyu.js.map} +1 -1
  34. package/dist/cdn/chunks/{help-C-woafz5.js → help-CmCFuNXk.js} +2 -2
  35. package/dist/cdn/chunks/{help-C-woafz5.js.map → help-CmCFuNXk.js.map} +1 -1
  36. package/dist/cdn/chunks/{help-form-DhIyMziw.js → help-form-Di2NtKDp.js} +2 -2
  37. package/dist/cdn/chunks/{help-form-DhIyMziw.js.map → help-form-Di2NtKDp.js.map} +1 -1
  38. package/dist/cdn/chunks/{hotspot-oel1Eelo.js → hotspot-B3bvqVzf.js} +2 -2
  39. package/dist/cdn/chunks/{hotspot-oel1Eelo.js.map → hotspot-B3bvqVzf.js.map} +1 -1
  40. package/dist/cdn/chunks/{image-drop-Dkprw0Kn.js → image-drop-vLc2B7rF.js} +2 -2
  41. package/dist/cdn/chunks/{image-drop-Dkprw0Kn.js.map → image-drop-vLc2B7rF.js.map} +1 -1
  42. package/dist/cdn/chunks/{image-label-Dm5shQSh.js → image-label-DsKxQDTQ.js} +2 -2
  43. package/dist/cdn/chunks/{image-label-Dm5shQSh.js.map → image-label-DsKxQDTQ.js.map} +1 -1
  44. package/dist/cdn/chunks/{inline-styles-CTgXWnHb.js → inline-styles-CFNlb6f2.js} +2 -2
  45. package/dist/cdn/chunks/{inline-styles-CTgXWnHb.js.map → inline-styles-CFNlb6f2.js.map} +1 -1
  46. package/dist/cdn/chunks/{insert-menu-Cn2E54V9.js → insert-menu-DAQglwtG.js} +2 -2
  47. package/dist/cdn/chunks/{insert-menu-Cn2E54V9.js.map → insert-menu-DAQglwtG.js.map} +1 -1
  48. package/dist/cdn/chunks/{issue-list-CQKAW39i.js → issue-list-CzSmohtT.js} +2 -2
  49. package/dist/cdn/chunks/{issue-list-CQKAW39i.js.map → issue-list-CzSmohtT.js.map} +1 -1
  50. package/dist/cdn/chunks/{live-jdiyYln2.js → live-qnReIRtj.js} +2 -2
  51. package/dist/cdn/chunks/{live-jdiyYln2.js.map → live-qnReIRtj.js.map} +1 -1
  52. package/dist/cdn/chunks/{long-answer-CtzClLAx.js → long-answer-NSWJiK0z.js} +2 -2
  53. package/dist/cdn/chunks/{long-answer-CtzClLAx.js.map → long-answer-NSWJiK0z.js.map} +1 -1
  54. package/dist/cdn/chunks/{mark-words-CpH3gTcX.js → mark-words-BKu-_uIl.js} +2 -2
  55. package/dist/cdn/chunks/{mark-words-CpH3gTcX.js.map → mark-words-BKu-_uIl.js.map} +1 -1
  56. package/dist/cdn/chunks/{match-DKE_4o-x.js → match-BpnJGW_5.js} +21 -13
  57. package/dist/cdn/chunks/match-BpnJGW_5.js.map +1 -0
  58. package/dist/cdn/chunks/{memory-B6hSyHyz.js → memory-BgTHujsU.js} +2 -2
  59. package/dist/cdn/chunks/{memory-B6hSyHyz.js.map → memory-BgTHujsU.js.map} +1 -1
  60. package/dist/cdn/chunks/{option-styles-WKzjKmCH.js → option-styles-B2sBX5Oz.js} +2 -2
  61. package/dist/cdn/chunks/{option-styles-WKzjKmCH.js.map → option-styles-B2sBX5Oz.js.map} +1 -1
  62. package/dist/cdn/chunks/{order-BhG_6IC-.js → order-B9gqH5wm.js} +2 -2
  63. package/dist/cdn/chunks/{order-BhG_6IC-.js.map → order-B9gqH5wm.js.map} +1 -1
  64. package/dist/cdn/chunks/{picture-view-BKnAyScQ.js → picture-view-Deodu_mb.js} +2 -2
  65. package/dist/cdn/chunks/{picture-view-BKnAyScQ.js.map → picture-view-Deodu_mb.js.map} +1 -1
  66. package/dist/cdn/chunks/{repeat-CY2W2URZ.js → repeat-BDXokpxQ.js} +2 -2
  67. package/dist/cdn/chunks/{repeat-CY2W2URZ.js.map → repeat-BDXokpxQ.js.map} +1 -1
  68. package/dist/cdn/chunks/{runtime-DxAbpr3S.js → runtime-C25QK5B0.js} +3 -3
  69. package/dist/cdn/chunks/{runtime-DxAbpr3S.js.map → runtime-C25QK5B0.js.map} +1 -1
  70. package/dist/cdn/chunks/{scan-jWgPnVxA.js → scan-BVhxT2Hw.js} +2 -2
  71. package/dist/cdn/chunks/{scan-jWgPnVxA.js.map → scan-BVhxT2Hw.js.map} +1 -1
  72. package/dist/cdn/chunks/{select-DTA3dJzr.js → select-DPpKJwSg.js} +2 -2
  73. package/dist/cdn/chunks/{select-DTA3dJzr.js.map → select-DPpKJwSg.js.map} +1 -1
  74. package/dist/cdn/chunks/select-QZ35cyns.js +2 -0
  75. package/dist/cdn/chunks/select-QZ35cyns.js.map +1 -0
  76. package/dist/cdn/chunks/{source-view-BlJ2mRns.js → source-view-gqFlZzwR.js} +2 -2
  77. package/dist/cdn/chunks/{source-view-BlJ2mRns.js.map → source-view-gqFlZzwR.js.map} +1 -1
  78. package/dist/cdn/chunks/{style-form-D1C2sHzg.js → style-form-DuR0EEum.js} +2 -2
  79. package/dist/cdn/chunks/{style-form-D1C2sHzg.js.map → style-form-DuR0EEum.js.map} +1 -1
  80. package/dist/cdn/chunks/{style-popups-BobgX1WK.js → style-popups-Bcl5imdP.js} +2 -2
  81. package/dist/cdn/chunks/{style-popups-BobgX1WK.js.map → style-popups-Bcl5imdP.js.map} +1 -1
  82. package/dist/cdn/chunks/{style-rules-ChqPVgZn.js → style-rules-ozpLz2ec.js} +2 -2
  83. package/dist/cdn/chunks/{style-rules-ChqPVgZn.js.map → style-rules-ozpLz2ec.js.map} +1 -1
  84. package/dist/cdn/chunks/{styled-Dmx5Yjv7.js → styled-bQqnDxBf.js} +2 -2
  85. package/dist/cdn/chunks/{styled-Dmx5Yjv7.js.map → styled-bQqnDxBf.js.map} +1 -1
  86. package/dist/cdn/chunks/{styles-CXkkL_Qi.js → styles-DiY3VA_T.js} +5 -5
  87. package/dist/cdn/chunks/styles-DiY3VA_T.js.map +1 -0
  88. package/dist/cdn/chunks/surface-CIz1z2oY.js +1059 -0
  89. package/dist/cdn/chunks/surface-CIz1z2oY.js.map +1 -0
  90. package/dist/cdn/chunks/{true-false-DP3MO599.js → true-false-C-S6RmZY.js} +2 -2
  91. package/dist/cdn/chunks/{true-false-DP3MO599.js.map → true-false-C-S6RmZY.js.map} +1 -1
  92. package/dist/cdn/chunks/{video-j9MCH6Kw.js → video-Dae8Gguf.js} +2 -2
  93. package/dist/cdn/chunks/{video-j9MCH6Kw.js.map → video-Dae8Gguf.js.map} +1 -1
  94. package/dist/cdn/chunks/{word-bank-ARjwUKZf.js → word-bank-CsIle0Ro.js} +2 -2
  95. package/dist/cdn/chunks/{word-bank-ARjwUKZf.js.map → word-bank-CsIle0Ro.js.map} +1 -1
  96. package/dist/cdn/chunks/{word-search-AHvM7yCJ.js → word-search-IOCwqo3y.js} +2 -2
  97. package/dist/cdn/chunks/{word-search-AHvM7yCJ.js.map → word-search-IOCwqo3y.js.map} +1 -1
  98. package/package.json +9 -9
  99. package/dist/cdn/chunks/match-DKE_4o-x.js.map +0 -1
  100. package/dist/cdn/chunks/styles-CXkkL_Qi.js.map +0 -1
  101. package/dist/cdn/chunks/surface-BhmSAte0.js +0 -1058
  102. package/dist/cdn/chunks/surface-BhmSAte0.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import{C as e,E as t,b as n,n as r,v as i,y as a}from"./runtime-DxAbpr3S.js";import{n as o,r as s,t as c}from"./audio-manifest-B9FWQzRy.js";import{t as l}from"./block-styles-CKo9x7Vt.js";var u=`astl.audio`,d=[{namespace:u,locale:`en`,messages:o},{namespace:u,locale:`pl`,messages:c}],f=class extends r{static manifest=s;static messages=d;static shadowRootOptions={...a.shadowRootOptions,slotAssignment:`manual`};static styles=[t`
1
+ import{C as e,E as t,b as n,n as r,v as i,y as a}from"./runtime-C25QK5B0.js";import{n as o,r as s,t as c}from"./audio-manifest-B9FWQzRy.js";import{t as l}from"./block-styles-CCtSFM4j.js";var u=`astl.audio`,d=[{namespace:u,locale:`en`,messages:o},{namespace:u,locale:`pl`,messages:c}],f=class extends r{static manifest=s;static messages=d;static shadowRootOptions={...a.shadowRootOptions,slotAssignment:`manual`};static styles=[t`
2
2
  .title {
3
3
  margin-block: 0 var(--astl-space-2);
4
4
  font-weight: 600;
@@ -45,4 +45,4 @@ overflow-wrap: anywhere;
45
45
  <div class="text"><slot data-tag="astl-transcript"></slot></div>
46
46
  </details>`:n}
47
47
  </div>`}},p={manifest:s,element:f,messages:d};export{p as audioElement};
48
- //# sourceMappingURL=audio-B0LSIn5N.js.map
48
+ //# sourceMappingURL=audio-Biof5aA3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"audio-B0LSIn5N.js","names":["en","pl","LitElement","nothing","ifDefined","b","i$1","A","AstlElement","o","i","en_default","audioManifest","pl_default","blockStyles","namespace","audioUiMessages","AudioElement","label","transcript","child","ui","audioElement"],"sources":["../../../../components/src/audio/ui-messages.ts","../../../../components/src/audio/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.audio';\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 `audioMessages` would put the authoring strings into the element's chunk.\n */\nexport const audioUiMessages: 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 } from '@astl/player';\nimport { type CSSResultGroup, css, html, LitElement, nothing, type TemplateResult } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { blockStyles } from '../block-styles.js';\nimport { audioManifest } from './manifest.js';\nimport { audioUiMessages } from './ui-messages.js';\n\n/**\n * `<astl-audio>`: the title, the browser's audio player, and the transcript (the view's `<astl-transcript>`, slotted\n * manually and never changed) in a disclosure under it, its lines as written. Nothing is answered or stored; a\n * handed-in attempt still plays.\n */\nexport class AudioElement extends AstlElement {\n static override manifest: ComponentManifest = audioManifest;\n static override messages: readonly MessageCatalog[] = audioUiMessages;\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n slotAssignment: 'manual',\n };\n\n static override styles: CSSResultGroup = [\n css`\n .title {\n margin-block: 0 var(--astl-space-2);\n font-weight: 600;\n }\n audio {\n display: block;\n box-sizing: border-box;\n inline-size: 100%;\n border: var(--astl-outline-width) solid var(--astl-outline);\n border-radius: 2rem;\n background: var(--astl-surface-raised);\n }\n audio::-webkit-media-controls-panel {\n background-color: var(--astl-surface-raised);\n }\n details {\n margin-block-start: var(--astl-space-2);\n }\n summary {\n padding-block: calc((var(--astl-target-min) - 1lh) / 2);\n font-size: var(--astl-size-ui);\n font-weight: 600;\n cursor: pointer;\n }\n .text {\n margin-block-start: var(--astl-space-1);\n padding-block: var(--astl-space-2);\n padding-inline: var(--astl-space-4);\n border-inline-start: var(--astl-outline-width) solid var(--astl-line);\n white-space: pre-line;\n overflow-wrap: anywhere;\n }\n `,\n blockStyles,\n ];\n\n get slotIds(): readonly string[] {\n return [];\n }\n\n getAnswers(): Answers {\n return {};\n }\n\n setAnswers(): void {}\n\n units(): Units {\n return { answered: 0, total: 0 };\n }\n\n protected override render(): TemplateResult {\n const label = (this.stringAttribute('label') ?? '').trim();\n const transcript = Array.from(this.children).some((child) => child.localName === 'astl-transcript');\n const ui = this.uiLanguage;\n return html`<div part=\"audio\">\n ${label === '' ? nothing : html`<p class=\"title\" part=\"title\" id=\"title\">${label}</p>`}\n <audio\n part=\"player\"\n controls\n preload=\"metadata\"\n src=${ifDefined(this.stringAttribute('src') ?? undefined)}\n aria-labelledby=${ifDefined(label === '' ? undefined : 'title')}\n ></audio>\n ${\n transcript\n ? html`<details part=\"transcript\">\n <summary lang=${ui.lang} dir=${ui.dir}>${this.t('ui.transcript')}</summary>\n <div class=\"text\"><slot data-tag=\"astl-transcript\"></slot></div>\n </details>`\n : nothing\n }\n </div>`;\n }\n}\n\nexport const audioElement: ElementRegistration = {\n manifest: audioManifest,\n element: AudioElement,\n messages: audioUiMessages,\n};\n"],"mappings":"A,2LAIA,IAAMe,EAAY,aAMLC,EAA6C,CACxD,CAAE,YAAW,OAAQ,KAAM,SAAUhB,CAAG,EACxC,CAAE,YAAW,OAAQ,KAAM,SAAUC,CAAG,CAC1C,ECAagB,EAAb,cAAkCT,CAAY,CAC5C,OAAgB,SAA8BI,EAC9C,OAAgB,SAAsCI,EACtD,OAAgB,kBAAoC,CAClD,GAAGd,EAAW,kBACd,eAAgB,QAClB,EAEA,OAAgB,OAAyB,CACvC,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCHY,CAAA,EAGF,IAAI,SAA6B,CAC/B,MAAO,CAAC,CACV,CAEA,YAAsB,CACpB,MAAO,CAAC,CACV,CAEA,YAAmB,CAAC,CAEpB,OAAe,CACb,MAAO,CAAE,SAAU,EAAG,MAAO,CAAE,CACjC,CAEA,QAA4C,CAC1C,IAAMI,GAAS,KAAK,gBAAgB,OAAO,GAAK,GAAA,CAAI,KAAK,EACnDC,EAAa,MAAM,KAAK,KAAK,QAAQ,CAAC,CAAC,KAAM,GAAUC,EAAM,YAAc,iBAAiB,EAC5FC,EAAK,KAAK,WAChB,MAAO,EAAI;QACPH,IAAU,GAAKf,EAAU,CAAI,4CAA4Ce,EAAM,MAAM;;;;;cAK/Ed,EAAU,KAAK,gBAAgB,KAAK,GAAK,IAAA,EAAS,EAAE;0BACxCA,EAAUc,IAAU,GAAK,IAAA,GAAY,OAAO,EAAE;;QAGhEC,EACI,CAAI;8BACcE,EAAG,KAAK,OAAOA,EAAG,IAAI,GAAG,KAAK,EAAE,eAAe,EAAE;;wBAGnElB,EACL;WAEL,CACF,EAEamB,EAAoC,CAC/C,SAAUV,EACV,QAASK,EACT,SAAUD,CACZ,E"}
1
+ {"version":3,"file":"audio-Biof5aA3.js","names":["en","pl","LitElement","nothing","ifDefined","b","i$1","A","AstlElement","o","i","en_default","audioManifest","pl_default","blockStyles","namespace","audioUiMessages","AudioElement","label","transcript","child","ui","audioElement"],"sources":["../../../../components/src/audio/ui-messages.ts","../../../../components/src/audio/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.audio';\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 `audioMessages` would put the authoring strings into the element's chunk.\n */\nexport const audioUiMessages: 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 } from '@astl/player';\nimport { type CSSResultGroup, css, html, LitElement, nothing, type TemplateResult } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { blockStyles } from '../block-styles.js';\nimport { audioManifest } from './manifest.js';\nimport { audioUiMessages } from './ui-messages.js';\n\n/**\n * `<astl-audio>`: the title, the browser's audio player, and the transcript (the view's `<astl-transcript>`, slotted\n * manually and never changed) in a disclosure under it, its lines as written. Nothing is answered or stored; a\n * handed-in attempt still plays.\n */\nexport class AudioElement extends AstlElement {\n static override manifest: ComponentManifest = audioManifest;\n static override messages: readonly MessageCatalog[] = audioUiMessages;\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n slotAssignment: 'manual',\n };\n\n static override styles: CSSResultGroup = [\n css`\n .title {\n margin-block: 0 var(--astl-space-2);\n font-weight: 600;\n }\n audio {\n display: block;\n box-sizing: border-box;\n inline-size: 100%;\n border: var(--astl-outline-width) solid var(--astl-outline);\n border-radius: 2rem;\n background: var(--astl-surface-raised);\n }\n audio::-webkit-media-controls-panel {\n background-color: var(--astl-surface-raised);\n }\n details {\n margin-block-start: var(--astl-space-2);\n }\n summary {\n padding-block: calc((var(--astl-target-min) - 1lh) / 2);\n font-size: var(--astl-size-ui);\n font-weight: 600;\n cursor: pointer;\n }\n .text {\n margin-block-start: var(--astl-space-1);\n padding-block: var(--astl-space-2);\n padding-inline: var(--astl-space-4);\n border-inline-start: var(--astl-outline-width) solid var(--astl-line);\n white-space: pre-line;\n overflow-wrap: anywhere;\n }\n `,\n blockStyles,\n ];\n\n get slotIds(): readonly string[] {\n return [];\n }\n\n getAnswers(): Answers {\n return {};\n }\n\n setAnswers(): void {}\n\n units(): Units {\n return { answered: 0, total: 0 };\n }\n\n protected override render(): TemplateResult {\n const label = (this.stringAttribute('label') ?? '').trim();\n const transcript = Array.from(this.children).some((child) => child.localName === 'astl-transcript');\n const ui = this.uiLanguage;\n return html`<div part=\"audio\">\n ${label === '' ? nothing : html`<p class=\"title\" part=\"title\" id=\"title\">${label}</p>`}\n <audio\n part=\"player\"\n controls\n preload=\"metadata\"\n src=${ifDefined(this.stringAttribute('src') ?? undefined)}\n aria-labelledby=${ifDefined(label === '' ? undefined : 'title')}\n ></audio>\n ${\n transcript\n ? html`<details part=\"transcript\">\n <summary lang=${ui.lang} dir=${ui.dir}>${this.t('ui.transcript')}</summary>\n <div class=\"text\"><slot data-tag=\"astl-transcript\"></slot></div>\n </details>`\n : nothing\n }\n </div>`;\n }\n}\n\nexport const audioElement: ElementRegistration = {\n manifest: audioManifest,\n element: AudioElement,\n messages: audioUiMessages,\n};\n"],"mappings":"A,2LAIA,IAAMe,EAAY,aAMLC,EAA6C,CACxD,CAAE,YAAW,OAAQ,KAAM,SAAUhB,CAAG,EACxC,CAAE,YAAW,OAAQ,KAAM,SAAUC,CAAG,CAC1C,ECAagB,EAAb,cAAkCT,CAAY,CAC5C,OAAgB,SAA8BI,EAC9C,OAAgB,SAAsCI,EACtD,OAAgB,kBAAoC,CAClD,GAAGd,EAAW,kBACd,eAAgB,QAClB,EAEA,OAAgB,OAAyB,CACvC,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCHY,CAAA,EAGF,IAAI,SAA6B,CAC/B,MAAO,CAAC,CACV,CAEA,YAAsB,CACpB,MAAO,CAAC,CACV,CAEA,YAAmB,CAAC,CAEpB,OAAe,CACb,MAAO,CAAE,SAAU,EAAG,MAAO,CAAE,CACjC,CAEA,QAA4C,CAC1C,IAAMI,GAAS,KAAK,gBAAgB,OAAO,GAAK,GAAA,CAAI,KAAK,EACnDC,EAAa,MAAM,KAAK,KAAK,QAAQ,CAAC,CAAC,KAAM,GAAUC,EAAM,YAAc,iBAAiB,EAC5FC,EAAK,KAAK,WAChB,MAAO,EAAI;QACPH,IAAU,GAAKf,EAAU,CAAI,4CAA4Ce,EAAM,MAAM;;;;;cAK/Ed,EAAU,KAAK,gBAAgB,KAAK,GAAK,IAAA,EAAS,EAAE;0BACxCA,EAAUc,IAAU,GAAK,IAAA,GAAY,OAAO,EAAE;;QAGhEC,EACI,CAAI;8BACcE,EAAG,KAAK,OAAOA,EAAG,IAAI,GAAG,KAAK,EAAE,eAAe,EAAE;;wBAGnElB,EACL;WAEL,CACF,EAEamB,EAAoC,CAC/C,SAAUV,EACV,QAASK,EACT,SAAUD,CACZ,E"}
@@ -1,4 +1,4 @@
1
- import{E as e,_ as t,g as n}from"./runtime-DxAbpr3S.js";var r=[t,n,e`
1
+ import{E as e,_ as t,g as n}from"./runtime-C25QK5B0.js";var r=[t,n,e`
2
2
  :host([hidden]) {
3
3
  display: none;
4
4
  }
@@ -65,4 +65,4 @@ vertical-align: -0.2em;
65
65
  color: var(--astl-success);
66
66
  }
67
67
  `];export{r as t};
68
- //# sourceMappingURL=block-styles-CKo9x7Vt.js.map
68
+ //# sourceMappingURL=block-styles-CCtSFM4j.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"block-styles-CKo9x7Vt.js","names":["i","visuallyHidden","verdictStyles","blockStyles"],"sources":["../../../../components/src/block-styles.ts"],"sourcesContent":["/**\n * Shared CSS of the built-in question blocks (`display: 'block'`); fields in running text take `inline-styles.ts`.\n * Built-ins only: it loads with the element chunks, never with the player (other elements take `verdictStyles` and\n * `visuallyHidden` from `@astl/player`). One file per kind, neither importing the other, so each element loads\n * one shared chunk holding only rules it uses (the element budget counts that chunk for every element).\n *\n * An element lists these after its own rules: its own rules never restate them, and the verdict on a box wins over\n * the element's own states of the same specificity (selected, picked up). To refine one, use a more specific selector.\n */\nimport { verdictStyles, visuallyHidden } from '@astl/player';\nimport { type CSSResultGroup, css } from 'lit';\n\nexport const blockStyles: CSSResultGroup = [\n visuallyHidden,\n verdictStyles,\n // `hidden` hides the element and whatever takes focus shows the focus ring. Two classes for the element's boxes:\n // `astl-ring` draws the ring of the control inside the box instead of the control's own (a radio in its option, a\n // button in its card), and `astl-box` shows the box's `data-verdict` in its border (colour and style) and its fill\n // (the verdict's soft colour: the same rule in every type, the fields in running text included). The verdict's fill\n // replaces a pick's or a group's.\n css`\n :host([hidden]) {\n display: none;\n }\n :focus-visible:not(.astl-ring *),\n .astl-ring:has(:focus-visible) {\n outline: var(--astl-focus-width) solid var(--astl-focus);\n outline-offset: var(--astl-focus-offset);\n }\n .astl-ring :focus-visible {\n outline: none;\n }\n .astl-box[data-verdict] {\n border-color: var(--astl-verdict-color);\n border-style: var(--astl-verdict-border);\n background: var(--astl-verdict-soft);\n }\n `,\n // A fieldset whose legend holds the prompt and a hint, and the group verdict line at its end. The hint is read by\n // young students: UI size, never smaller, and on the body face whatever face a look gives the prompt. Where the\n // verdict line sits (its margins) is the element's own.\n css`\n :host {\n display: block;\n margin-block: 0 var(--astl-space-5);\n }\n fieldset {\n min-inline-size: 0;\n margin: 0;\n padding: 0;\n border: 0;\n }\n legend {\n margin-block-end: var(--astl-space-3);\n padding: 0;\n font-weight: 600;\n }\n legend > .hint {\n display: block;\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 .group-verdict {\n padding-block: var(--astl-space-1);\n padding-inline: var(--astl-space-3);\n border-inline-start: var(--astl-focus-width) var(--astl-verdict-border) var(--astl-verdict-color);\n }\n `,\n // The \"correct answer\" line, alike in every type: the tick and its label in the success colour, the answer in ink,\n // at UI size; a long answer hyphenates in its own language. Where it sits is the element's own (the margin reset\n // has no specificity, so an element's own margins win).\n css`\n :where(.astl-solution) {\n margin: 0;\n }\n .astl-solution {\n color: var(--astl-ink);\n font-size: var(--astl-size-ui);\n font-weight: 600;\n line-height: 1.4;\n overflow-wrap: anywhere;\n hyphens: auto;\n }\n .astl-solution > .astl-verdict-icon {\n margin-inline-end: var(--astl-space-1);\n color: var(--astl-success);\n vertical-align: -0.2em;\n }\n .astl-solution-label {\n color: var(--astl-success);\n }\n `,\n];\n"],"mappings":"A,wDAYA,IAAaG,EAA8B,CACzCF,EACAC,EAMA,CAAG;;;;;;;;;;;;;;;;;EAqBH,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCH,CAAG;;;;;;;;;;;;;;;;;;;;CAqBL,E"}
1
+ {"version":3,"file":"block-styles-CCtSFM4j.js","names":["i","visuallyHidden","verdictStyles","blockStyles"],"sources":["../../../../components/src/block-styles.ts"],"sourcesContent":["/**\n * Shared CSS of the built-in question blocks (`display: 'block'`); fields in running text take `inline-styles.ts`.\n * Built-ins only: it loads with the element chunks, never with the player (other elements take `verdictStyles` and\n * `visuallyHidden` from `@astl/player`). One file per kind, neither importing the other, so each element loads\n * one shared chunk holding only rules it uses (the element budget counts that chunk for every element).\n *\n * An element lists these after its own rules: its own rules never restate them, and the verdict on a box wins over\n * the element's own states of the same specificity (selected, picked up). To refine one, use a more specific selector.\n */\nimport { verdictStyles, visuallyHidden } from '@astl/player';\nimport { type CSSResultGroup, css } from 'lit';\n\nexport const blockStyles: CSSResultGroup = [\n visuallyHidden,\n verdictStyles,\n // `hidden` hides the element and whatever takes focus shows the focus ring. Two classes for the element's boxes:\n // `astl-ring` draws the ring of the control inside the box instead of the control's own (a radio in its option, a\n // button in its card), and `astl-box` shows the box's `data-verdict` in its border (colour and style) and its fill\n // (the verdict's soft colour: the same rule in every type, the fields in running text included). The verdict's fill\n // replaces a pick's or a group's.\n css`\n :host([hidden]) {\n display: none;\n }\n :focus-visible:not(.astl-ring *),\n .astl-ring:has(:focus-visible) {\n outline: var(--astl-focus-width) solid var(--astl-focus);\n outline-offset: var(--astl-focus-offset);\n }\n .astl-ring :focus-visible {\n outline: none;\n }\n .astl-box[data-verdict] {\n border-color: var(--astl-verdict-color);\n border-style: var(--astl-verdict-border);\n background: var(--astl-verdict-soft);\n }\n `,\n // A fieldset whose legend holds the prompt and a hint, and the group verdict line at its end. The hint is read by\n // young students: UI size, never smaller, and on the body face whatever face a look gives the prompt. Where the\n // verdict line sits (its margins) is the element's own.\n css`\n :host {\n display: block;\n margin-block: 0 var(--astl-space-5);\n }\n fieldset {\n min-inline-size: 0;\n margin: 0;\n padding: 0;\n border: 0;\n }\n legend {\n margin-block-end: var(--astl-space-3);\n padding: 0;\n font-weight: 600;\n }\n legend > .hint {\n display: block;\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 .group-verdict {\n padding-block: var(--astl-space-1);\n padding-inline: var(--astl-space-3);\n border-inline-start: var(--astl-focus-width) var(--astl-verdict-border) var(--astl-verdict-color);\n }\n `,\n // The \"correct answer\" line, alike in every type: the tick and its label in the success colour, the answer in ink,\n // at UI size; a long answer hyphenates in its own language. Where it sits is the element's own (the margin reset\n // has no specificity, so an element's own margins win).\n css`\n :where(.astl-solution) {\n margin: 0;\n }\n .astl-solution {\n color: var(--astl-ink);\n font-size: var(--astl-size-ui);\n font-weight: 600;\n line-height: 1.4;\n overflow-wrap: anywhere;\n hyphens: auto;\n }\n .astl-solution > .astl-verdict-icon {\n margin-inline-end: var(--astl-space-1);\n color: var(--astl-success);\n vertical-align: -0.2em;\n }\n .astl-solution-label {\n color: var(--astl-success);\n }\n `,\n];\n"],"mappings":"A,wDAYA,IAAaG,EAA8B,CACzCF,EACAC,EAMA,CAAG;;;;;;;;;;;;;;;;;EAqBH,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCH,CAAG;;;;;;;;;;;;;;;;;;;;CAqBL,E"}
@@ -1,4 +1,4 @@
1
- import{E as e}from"./runtime-DxAbpr3S.js";var t=56,n=240,r=1.5,i=e`
1
+ import{E as e}from"./runtime-C25QK5B0.js";var t=56,n=240,r=1.5,i=e`
2
2
  .root[data-spread] > * {
3
3
  max-inline-size: 1240px;
4
4
  }
@@ -12,4 +12,4 @@ border-inline-start: var(--astl-outline-width) solid var(--astl-line);
12
12
  padding-inline-start: var(--astl-space-5);
13
13
  }
14
14
  `.styleSheet;function a(e){i!==void 0&&e instanceof ShadowRoot&&!e.adoptedStyleSheets.includes(i)&&(e.adoptedStyleSheets=[...e.adoptedStyleSheets,i])}function o(e,n){let r=e=>{n(e>=t*(Number.parseFloat(getComputedStyle(document.documentElement).fontSize)||16))},i=new ResizeObserver(([e])=>{e!==void 0&&r(e.contentRect.width)});return i.observe(e),r(e.clientWidth),i}function s(e,t,i){if(matchMedia(`(prefers-reduced-motion: reduce), (forced-colors: active)`).matches)return;let a=`translateX(${(i?-t:t)*r}rem)`;for(let t of e)t.animate([{opacity:0,transform:a},{opacity:1,transform:`none`}],{duration:n,easing:`ease-out`})}export{a as adoptBookSheet,s as turn,o as watchSpread};
15
- //# sourceMappingURL=book-CHzDDaim.js.map
15
+ //# sourceMappingURL=book-IFipARhv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"book-CHzDDaim.js","names":["i","SPREAD_MIN_REM","TURN_MS","TURN_DISTANCE_REM","bookSheet","adoptBookSheet","root","watchSpread","measure","spread","width","observer","entry","host","turn","offset","rtl","direction","page","pages"],"sources":["../../../../player/src/player/book.ts"],"sourcesContent":["/**\n * A book (`kind=\"book\"`) in the player, in a module of its own: a view that is no book never loads it. It says when the\n * player is wide enough for a spread, two pages side by side, draws the spread and slides the pages of a new one in.\n * Without it (or when its chunk fails) a book plays one page at a time, as an exercise.\n */\nimport { css } from 'lit';\n\n/** Narrowest player (rem) that shows a book a spread at a time; narrower, one page at a time. */\nconst SPREAD_MIN_REM = 56;\n/** A spread's turn: its pages come in from the side of travel. */\nconst TURN_MS = 240;\nconst TURN_DISTANCE_REM = 1.5;\n\n/** A spread: two pages side by side (the first on the start side), a line between them as the spine. */\nconst bookSheet = css`\n .root[data-spread] > * {\n max-inline-size: 1240px;\n }\n .root[data-spread] astl-doc {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n column-gap: var(--astl-space-5);\n }\n .root[data-spread] astl-doc > astl-page:not([hidden]) + astl-page:not([hidden]) {\n border-inline-start: var(--astl-outline-width) solid var(--astl-line);\n padding-inline-start: var(--astl-space-5);\n }\n`.styleSheet;\n\n/** Adopts the stylesheet of spreads in a player's root, once. */\nexport function adoptBookSheet(root: Node): void {\n if (bookSheet !== undefined && root instanceof ShadowRoot && !root.adoptedStyleSheets.includes(bookSheet)) {\n root.adoptedStyleSheets = [...root.adoptedStyleSheets, bookSheet];\n }\n}\n\n/**\n * Tells `spread` whether `host` is wide enough for a spread (in the root font size), now and on every resize. The\n * observer is the caller's to disconnect, and to observe `host` again when it is connected again.\n */\nexport function watchSpread(host: HTMLElement, spread: (wide: boolean) => void): ResizeObserver {\n const measure = (width: number) => {\n const rem = Number.parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;\n spread(width >= SPREAD_MIN_REM * rem);\n };\n const observer = new ResizeObserver(([entry]) => {\n if (entry !== undefined) measure(entry.contentRect.width);\n });\n observer.observe(host);\n measure(host.clientWidth);\n return observer;\n}\n\n/**\n * The pages of a new spread come in from the side of travel (`direction` 1 forwards, mirrored right to left); they just\n * appear with reduced motion or forced colours.\n */\nexport function turn(pages: readonly HTMLElement[], direction: 1 | -1, rtl: boolean): void {\n if (matchMedia('(prefers-reduced-motion: reduce), (forced-colors: active)').matches) return;\n const offset = `translateX(${(rtl ? -direction : direction) * TURN_DISTANCE_REM}rem)`;\n for (const page of pages) {\n page.animate(\n [\n { opacity: 0, transform: offset },\n { opacity: 1, transform: 'none' },\n ],\n { duration: TURN_MS, easing: 'ease-out' },\n );\n }\n}\n"],"mappings":"A,0CAQA,IAAMC,EAAiB,GAEjBC,EAAU,IACVC,EAAoB,IAGpBC,EAAY,CAAG;;;;;;;;;;;;;EAanB,WAGF,SAAgBC,EAAe,EAAkB,CAC3CD,IAAc,IAAA,IAAaE,aAAgB,YAAc,CAACA,EAAK,mBAAmB,SAASF,CAAS,IACtG,EAAK,mBAAqB,CAAC,GAAGE,EAAK,mBAAoBF,CAAS,EAEpE,CAMA,SAAgBG,EAAY,EAAmB,EAAiD,CAC9F,IAAMC,EAAW,GAAkB,CAEjCC,EAAOC,GAAST,GADJ,OAAO,WAAW,iBAAiB,SAAS,eAAe,CAAC,CAAC,QAAQ,GAAK,GAClD,CACtC,EACMU,EAAW,IAAI,gBAAgB,CAACC,KAAW,CAC3CA,IAAU,IAAA,IAAWJ,EAAQI,EAAM,YAAY,KAAK,CAC1D,CAAC,EAGD,OAFAD,EAAS,QAAQE,CAAI,EACrBL,EAAQK,EAAK,WAAW,EACjBF,CACT,CAMA,SAAgBG,EAAK,EAA+B,EAAmB,EAAoB,CACzF,GAAI,WAAW,2DAA2D,CAAC,CAAC,QAAS,OACrF,IAAMC,EAAS,eAAeC,EAAM,CAACC,EAAYA,GAAad,EAAkB,MAChF,IAAK,IAAMe,KAAQC,EACjBD,EAAK,QACH,CACE,CAAE,QAAS,EAAG,UAAWH,CAAO,EAChC,CAAE,QAAS,EAAG,UAAW,MAAO,CAClC,EACA,CAAE,SAAUb,EAAS,OAAQ,UAAW,CAC1C,CAEJ,C"}
1
+ {"version":3,"file":"book-IFipARhv.js","names":["i","SPREAD_MIN_REM","TURN_MS","TURN_DISTANCE_REM","bookSheet","adoptBookSheet","root","watchSpread","measure","spread","width","observer","entry","host","turn","offset","rtl","direction","page","pages"],"sources":["../../../../player/src/player/book.ts"],"sourcesContent":["/**\n * A book (`kind=\"book\"`) in the player, in a module of its own: a view that is no book never loads it. It says when the\n * player is wide enough for a spread, two pages side by side, draws the spread and slides the pages of a new one in.\n * Without it (or when its chunk fails) a book plays one page at a time, as an exercise.\n */\nimport { css } from 'lit';\n\n/** Narrowest player (rem) that shows a book a spread at a time; narrower, one page at a time. */\nconst SPREAD_MIN_REM = 56;\n/** A spread's turn: its pages come in from the side of travel. */\nconst TURN_MS = 240;\nconst TURN_DISTANCE_REM = 1.5;\n\n/** A spread: two pages side by side (the first on the start side), a line between them as the spine. */\nconst bookSheet = css`\n .root[data-spread] > * {\n max-inline-size: 1240px;\n }\n .root[data-spread] astl-doc {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n column-gap: var(--astl-space-5);\n }\n .root[data-spread] astl-doc > astl-page:not([hidden]) + astl-page:not([hidden]) {\n border-inline-start: var(--astl-outline-width) solid var(--astl-line);\n padding-inline-start: var(--astl-space-5);\n }\n`.styleSheet;\n\n/** Adopts the stylesheet of spreads in a player's root, once. */\nexport function adoptBookSheet(root: Node): void {\n if (bookSheet !== undefined && root instanceof ShadowRoot && !root.adoptedStyleSheets.includes(bookSheet)) {\n root.adoptedStyleSheets = [...root.adoptedStyleSheets, bookSheet];\n }\n}\n\n/**\n * Tells `spread` whether `host` is wide enough for a spread (in the root font size), now and on every resize. The\n * observer is the caller's to disconnect, and to observe `host` again when it is connected again.\n */\nexport function watchSpread(host: HTMLElement, spread: (wide: boolean) => void): ResizeObserver {\n const measure = (width: number) => {\n const rem = Number.parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;\n spread(width >= SPREAD_MIN_REM * rem);\n };\n const observer = new ResizeObserver(([entry]) => {\n if (entry !== undefined) measure(entry.contentRect.width);\n });\n observer.observe(host);\n measure(host.clientWidth);\n return observer;\n}\n\n/**\n * The pages of a new spread come in from the side of travel (`direction` 1 forwards, mirrored right to left); they just\n * appear with reduced motion or forced colours.\n */\nexport function turn(pages: readonly HTMLElement[], direction: 1 | -1, rtl: boolean): void {\n if (matchMedia('(prefers-reduced-motion: reduce), (forced-colors: active)').matches) return;\n const offset = `translateX(${(rtl ? -direction : direction) * TURN_DISTANCE_REM}rem)`;\n for (const page of pages) {\n page.animate(\n [\n { opacity: 0, transform: offset },\n { opacity: 1, transform: 'none' },\n ],\n { duration: TURN_MS, easing: 'ease-out' },\n );\n }\n}\n"],"mappings":"A,0CAQA,IAAMC,EAAiB,GAEjBC,EAAU,IACVC,EAAoB,IAGpBC,EAAY,CAAG;;;;;;;;;;;;;EAanB,WAGF,SAAgBC,EAAe,EAAkB,CAC3CD,IAAc,IAAA,IAAaE,aAAgB,YAAc,CAACA,EAAK,mBAAmB,SAASF,CAAS,IACtG,EAAK,mBAAqB,CAAC,GAAGE,EAAK,mBAAoBF,CAAS,EAEpE,CAMA,SAAgBG,EAAY,EAAmB,EAAiD,CAC9F,IAAMC,EAAW,GAAkB,CAEjCC,EAAOC,GAAST,GADJ,OAAO,WAAW,iBAAiB,SAAS,eAAe,CAAC,CAAC,QAAQ,GAAK,GAClD,CACtC,EACMU,EAAW,IAAI,gBAAgB,CAACC,KAAW,CAC3CA,IAAU,IAAA,IAAWJ,EAAQI,EAAM,YAAY,KAAK,CAC1D,CAAC,EAGD,OAFAD,EAAS,QAAQE,CAAI,EACrBL,EAAQK,EAAK,WAAW,EACjBF,CACT,CAMA,SAAgBG,EAAK,EAA+B,EAAmB,EAAoB,CACzF,GAAI,WAAW,2DAA2D,CAAC,CAAC,QAAS,OACrF,IAAMC,EAAS,eAAeC,EAAM,CAACC,EAAYA,GAAad,EAAkB,MAChF,IAAK,IAAMe,KAAQC,EACjBD,EAAK,QACH,CACE,CAAE,QAAS,EAAG,UAAWH,CAAO,EAChC,CAAE,QAAS,EAAG,UAAW,MAAO,CAClC,EACA,CAAE,SAAUb,EAAS,OAAQ,UAAW,CAC1C,CAEJ,C"}
@@ -1,4 +1,4 @@
1
- import{C as e,E as t,T as n,n as r}from"./runtime-DxAbpr3S.js";import{n as i,r as a,t as o}from"./callout-manifest-Cb12O4jl.js";import{t as s}from"./block-styles-CKo9x7Vt.js";var c=`astl.callout`,l=[{namespace:c,locale:`en`,messages:i},{namespace:c,locale:`pl`,messages:o}],u={tip:n`<path d="M10 2.5a5.5 5.5 0 0 0-3.2 10V15h6.4v-2.5A5.5 5.5 0 0 0 10 2.5zM7.8 17.5h4.4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>`,info:n`<circle cx="10" cy="10" r="7.5" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M10 9v5" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><circle cx="10" cy="6.2" r="1.2" fill="currentColor"/>`,warning:n`<path d="M10 2.8 18 16.8H2z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><path d="M10 8v4" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><circle cx="10" cy="14.4" r="1.1" fill="currentColor"/>`},d=class extends r{static manifest=a;static messages=l;static styles=[t`
1
+ import{C as e,E as t,T as n,n as r}from"./runtime-C25QK5B0.js";import{n as i,r as a,t as o}from"./callout-manifest-Cb12O4jl.js";import{t as s}from"./block-styles-CCtSFM4j.js";var c=`astl.callout`,l=[{namespace:c,locale:`en`,messages:i},{namespace:c,locale:`pl`,messages:o}],u={tip:n`<path d="M10 2.5a5.5 5.5 0 0 0-3.2 10V15h6.4v-2.5A5.5 5.5 0 0 0 10 2.5zM7.8 17.5h4.4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>`,info:n`<circle cx="10" cy="10" r="7.5" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M10 9v5" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><circle cx="10" cy="6.2" r="1.2" fill="currentColor"/>`,warning:n`<path d="M10 2.8 18 16.8H2z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><path d="M10 8v4" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><circle cx="10" cy="14.4" r="1.1" fill="currentColor"/>`},d=class extends r{static manifest=a;static messages=l;static styles=[t`
2
2
  :host {
3
3
  --astl-callout: var(--astl-accent);
4
4
  --astl-callout-soft: var(--astl-accent-soft);
@@ -46,4 +46,4 @@ margin-block-end: 0 !important;
46
46
  </p>
47
47
  <div class="body" part="body"><slot></slot></div>
48
48
  </div>`}},f={manifest:a,element:d,messages:l};export{f as calloutElement};
49
- //# sourceMappingURL=callout-QFLFLPc5.js.map
49
+ //# sourceMappingURL=callout-CuajbbYY.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"callout-QFLFLPc5.js","names":["en","pl","b","i","w","AstlElement","en_default","calloutManifest","pl_default","blockStyles","namespace","calloutUiMessages","ICONS","CalloutElement","kind","ui","calloutElement"],"sources":["../../../../components/src/callout/ui-messages.ts","../../../../components/src/callout/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.callout';\n\n/** The student strings (`ui.*`), for the element only: a module of their own keeps the authoring ones out of its chunk. */\nexport const calloutUiMessages: 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 } from '@astl/player';\nimport { type CSSResultGroup, css, html, svg, type TemplateResult } from 'lit';\nimport { blockStyles } from '../block-styles.js';\nimport { calloutManifest } from './manifest.js';\nimport { calloutUiMessages } from './ui-messages.js';\n\n/** An icon per kind (decorative: the label says the kind): a light bulb, an \"i\" in a circle, a \"!\" in a triangle. */\nconst ICONS: Readonly<Record<string, TemplateResult>> = {\n tip: svg`<path d=\"M10 2.5a5.5 5.5 0 0 0-3.2 10V15h6.4v-2.5A5.5 5.5 0 0 0 10 2.5zM7.8 17.5h4.4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>`,\n info: svg`<circle cx=\"10\" cy=\"10\" r=\"7.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\"/><path d=\"M10 9v5\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/><circle cx=\"10\" cy=\"6.2\" r=\"1.2\" fill=\"currentColor\"/>`,\n warning: svg`<path d=\"M10 2.8 18 16.8H2z\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linejoin=\"round\"/><path d=\"M10 8v4\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/><circle cx=\"10\" cy=\"14.4\" r=\"1.1\" fill=\"currentColor\"/>`,\n};\n\n/**\n * `<astl-callout>`: a note beside the exercise. Its rich content is the light DOM, shown through a slot and styled by\n * the player like the page around it. A note (`role=\"note\"`: content aside from the main text), not a landmark\n * (`aside`): an exercise may hold several, and landmarks are for the page's regions. Named by its kind label, the text\n * shown next to the icon, so screen readers announce \"Tip, note\". Nothing to answer.\n */\nexport class CalloutElement extends AstlElement {\n static override manifest: ComponentManifest = calloutManifest;\n static override messages: readonly MessageCatalog[] = calloutUiMessages;\n\n // The kind's colour and fill (tokens that read as text on each other, and the ink on the fill). The content's own\n // margins come from the player's canvas, an outer scope that wins over ::slotted() unless the rule is important: the\n // box's padding is the space at its edges.\n static override styles: CSSResultGroup = [\n css`\n :host {\n --astl-callout: var(--astl-accent);\n --astl-callout-soft: var(--astl-accent-soft);\n }\n :host([kind='tip']) {\n --astl-callout: var(--astl-palette-3);\n --astl-callout-soft: var(--astl-palette-3-soft);\n }\n :host([kind='warning']) {\n --astl-callout: var(--astl-warning);\n --astl-callout-soft: var(--astl-warning-soft);\n }\n .callout {\n hyphens: auto;\n padding: var(--astl-space-3) var(--astl-space-4);\n border: var(--astl-outline-width) solid var(--astl-callout);\n border-inline-start-width: var(--astl-space-2);\n border-radius: var(--astl-radius-m);\n background: var(--astl-callout-soft);\n }\n .head {\n display: flex;\n align-items: center;\n gap: var(--astl-space-2);\n margin-block: 0 var(--astl-space-2);\n color: var(--astl-callout);\n font-size: var(--astl-size-ui);\n font-weight: 700;\n }\n .icon {\n flex: none;\n inline-size: 1.4em;\n block-size: 1.4em;\n }\n ::slotted(:first-child) {\n margin-block-start: 0 !important;\n }\n ::slotted(:last-child) {\n margin-block-end: 0 !important;\n }\n `,\n blockStyles,\n ];\n\n get slotIds(): readonly string[] {\n return [];\n }\n\n getAnswers(): Answers {\n return {};\n }\n\n setAnswers(): void {}\n\n units(): Units {\n return { answered: 0, total: 0 };\n }\n\n protected override render(): TemplateResult {\n const kind = this.stringAttribute('kind') ?? 'info';\n const ui = this.uiLanguage;\n return html`<div class=\"callout\" part=\"callout\" role=\"note\" aria-labelledby=\"label\">\n <p class=\"head\">\n <svg class=\"icon\" part=\"icon\" viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">${ICONS[kind]}</svg>\n <span id=\"label\" part=\"label\" lang=${ui.lang} dir=${ui.dir}>${this.t(`ui.kind.${kind}`)}</span>\n </p>\n <div class=\"body\" part=\"body\"><slot></slot></div>\n </div>`;\n }\n}\n\nexport const calloutElement: ElementRegistration = {\n manifest: calloutManifest,\n element: CalloutElement,\n messages: calloutUiMessages,\n};\n"],"mappings":"A,+KAIA,IAAMU,EAAY,eAGLC,EAA+C,CAC1D,CAAE,YAAW,OAAQ,KAAM,SAAUX,CAAG,EACxC,CAAE,YAAW,OAAQ,KAAM,SAAUC,CAAG,CAC1C,ECFMW,EAAkD,CACtD,IAAK,CAAG,8LACR,KAAM,CAAG,gOACT,QAAS,CAAG,qPACd,EAQaC,EAAb,cAAoCR,CAAY,CAC9C,OAAgB,SAA8BE,EAC9C,OAAgB,SAAsCI,EAKtD,OAAgB,OAAyB,CACvC,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CHF,CAAA,EAGF,IAAI,SAA6B,CAC/B,MAAO,CAAC,CACV,CAEA,YAAsB,CACpB,MAAO,CAAC,CACV,CAEA,YAAmB,CAAC,CAEpB,OAAe,CACb,MAAO,CAAE,SAAU,EAAG,MAAO,CAAE,CACjC,CAEA,QAA4C,CAC1C,IAAMK,EAAO,KAAK,gBAAgB,MAAM,GAAK,OACvCC,EAAK,KAAK,WAChB,MAAO,EAAI;;iGAEkFH,EAAME,GAAM;6CAChEC,EAAG,KAAK,OAAOA,EAAG,IAAI,GAAG,KAAK,EAAE,WAAWD,GAAM,EAAE;;;WAI9F,CACF,EAEaE,EAAsC,CACjD,SAAUT,EACV,QAASM,EACT,SAAUF,CACZ,E"}
1
+ {"version":3,"file":"callout-CuajbbYY.js","names":["en","pl","b","i","w","AstlElement","en_default","calloutManifest","pl_default","blockStyles","namespace","calloutUiMessages","ICONS","CalloutElement","kind","ui","calloutElement"],"sources":["../../../../components/src/callout/ui-messages.ts","../../../../components/src/callout/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.callout';\n\n/** The student strings (`ui.*`), for the element only: a module of their own keeps the authoring ones out of its chunk. */\nexport const calloutUiMessages: 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 } from '@astl/player';\nimport { type CSSResultGroup, css, html, svg, type TemplateResult } from 'lit';\nimport { blockStyles } from '../block-styles.js';\nimport { calloutManifest } from './manifest.js';\nimport { calloutUiMessages } from './ui-messages.js';\n\n/** An icon per kind (decorative: the label says the kind): a light bulb, an \"i\" in a circle, a \"!\" in a triangle. */\nconst ICONS: Readonly<Record<string, TemplateResult>> = {\n tip: svg`<path d=\"M10 2.5a5.5 5.5 0 0 0-3.2 10V15h6.4v-2.5A5.5 5.5 0 0 0 10 2.5zM7.8 17.5h4.4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>`,\n info: svg`<circle cx=\"10\" cy=\"10\" r=\"7.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\"/><path d=\"M10 9v5\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/><circle cx=\"10\" cy=\"6.2\" r=\"1.2\" fill=\"currentColor\"/>`,\n warning: svg`<path d=\"M10 2.8 18 16.8H2z\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linejoin=\"round\"/><path d=\"M10 8v4\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/><circle cx=\"10\" cy=\"14.4\" r=\"1.1\" fill=\"currentColor\"/>`,\n};\n\n/**\n * `<astl-callout>`: a note beside the exercise. Its rich content is the light DOM, shown through a slot and styled by\n * the player like the page around it. A note (`role=\"note\"`: content aside from the main text), not a landmark\n * (`aside`): an exercise may hold several, and landmarks are for the page's regions. Named by its kind label, the text\n * shown next to the icon, so screen readers announce \"Tip, note\". Nothing to answer.\n */\nexport class CalloutElement extends AstlElement {\n static override manifest: ComponentManifest = calloutManifest;\n static override messages: readonly MessageCatalog[] = calloutUiMessages;\n\n // The kind's colour and fill (tokens that read as text on each other, and the ink on the fill). The content's own\n // margins come from the player's canvas, an outer scope that wins over ::slotted() unless the rule is important: the\n // box's padding is the space at its edges.\n static override styles: CSSResultGroup = [\n css`\n :host {\n --astl-callout: var(--astl-accent);\n --astl-callout-soft: var(--astl-accent-soft);\n }\n :host([kind='tip']) {\n --astl-callout: var(--astl-palette-3);\n --astl-callout-soft: var(--astl-palette-3-soft);\n }\n :host([kind='warning']) {\n --astl-callout: var(--astl-warning);\n --astl-callout-soft: var(--astl-warning-soft);\n }\n .callout {\n hyphens: auto;\n padding: var(--astl-space-3) var(--astl-space-4);\n border: var(--astl-outline-width) solid var(--astl-callout);\n border-inline-start-width: var(--astl-space-2);\n border-radius: var(--astl-radius-m);\n background: var(--astl-callout-soft);\n }\n .head {\n display: flex;\n align-items: center;\n gap: var(--astl-space-2);\n margin-block: 0 var(--astl-space-2);\n color: var(--astl-callout);\n font-size: var(--astl-size-ui);\n font-weight: 700;\n }\n .icon {\n flex: none;\n inline-size: 1.4em;\n block-size: 1.4em;\n }\n ::slotted(:first-child) {\n margin-block-start: 0 !important;\n }\n ::slotted(:last-child) {\n margin-block-end: 0 !important;\n }\n `,\n blockStyles,\n ];\n\n get slotIds(): readonly string[] {\n return [];\n }\n\n getAnswers(): Answers {\n return {};\n }\n\n setAnswers(): void {}\n\n units(): Units {\n return { answered: 0, total: 0 };\n }\n\n protected override render(): TemplateResult {\n const kind = this.stringAttribute('kind') ?? 'info';\n const ui = this.uiLanguage;\n return html`<div class=\"callout\" part=\"callout\" role=\"note\" aria-labelledby=\"label\">\n <p class=\"head\">\n <svg class=\"icon\" part=\"icon\" viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">${ICONS[kind]}</svg>\n <span id=\"label\" part=\"label\" lang=${ui.lang} dir=${ui.dir}>${this.t(`ui.kind.${kind}`)}</span>\n </p>\n <div class=\"body\" part=\"body\"><slot></slot></div>\n </div>`;\n }\n}\n\nexport const calloutElement: ElementRegistration = {\n manifest: calloutManifest,\n element: CalloutElement,\n messages: calloutUiMessages,\n};\n"],"mappings":"A,+KAIA,IAAMU,EAAY,eAGLC,EAA+C,CAC1D,CAAE,YAAW,OAAQ,KAAM,SAAUX,CAAG,EACxC,CAAE,YAAW,OAAQ,KAAM,SAAUC,CAAG,CAC1C,ECFMW,EAAkD,CACtD,IAAK,CAAG,8LACR,KAAM,CAAG,gOACT,QAAS,CAAG,qPACd,EAQaC,EAAb,cAAoCR,CAAY,CAC9C,OAAgB,SAA8BE,EAC9C,OAAgB,SAAsCI,EAKtD,OAAgB,OAAyB,CACvC,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CHF,CAAA,EAGF,IAAI,SAA6B,CAC/B,MAAO,CAAC,CACV,CAEA,YAAsB,CACpB,MAAO,CAAC,CACV,CAEA,YAAmB,CAAC,CAEpB,OAAe,CACb,MAAO,CAAE,SAAU,EAAG,MAAO,CAAE,CACjC,CAEA,QAA4C,CAC1C,IAAMK,EAAO,KAAK,gBAAgB,MAAM,GAAK,OACvCC,EAAK,KAAK,WAChB,MAAO,EAAI;;iGAEkFH,EAAME,GAAM;6CAChEC,EAAG,KAAK,OAAOA,EAAG,IAAI,GAAG,KAAK,EAAE,WAAWD,GAAM,EAAE;;;WAI9F,CACF,EAEaE,EAAsC,CACjD,SAAUT,EACV,QAASM,EACT,SAAUF,CACZ,E"}
@@ -1,4 +1,4 @@
1
- import{C as e,D as t,E as n,b as r,h as i,n as a,v as o,y as s}from"./runtime-DxAbpr3S.js";import{n as c,r as l,t as u}from"./categorise-manifest-C_hEDVYQ.js";import{t as d}from"./pick-and-place-DVQIPYuL.js";import{t as f}from"./block-styles-CKo9x7Vt.js";import{t as p}from"./repeat-CY2W2URZ.js";import{t as m}from"./chip-styles-Dme5daTO.js";var h=`astl.categorise`,g=[{namespace:h,locale:`en`,messages:c},{namespace:h,locale:`pl`,messages:u}],_=``,v=250,y=e`<svg class="move" viewBox="0 0 20 20" aria-hidden="true" focusable="false">
1
+ import{C as e,D as t,E 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"./categorise-manifest-C_hEDVYQ.js";import{t as d}from"./pick-and-place-DVQIPYuL.js";import{t as f}from"./block-styles-CCtSFM4j.js";import{t as p}from"./repeat-BDXokpxQ.js";import{t as m}from"./chip-styles--gboWK2Z.js";var h=`astl.categorise`,g=[{namespace:h,locale:`en`,messages:c},{namespace:h,locale:`pl`,messages:u}],_=``,v=250,y=e`<svg class="move" viewBox="0 0 20 20" aria-hidden="true" focusable="false">
2
2
  <path
3
3
  d="M10 2.5v15M2.5 10h15M10 2.5 7.5 5M10 2.5 12.5 5M10 17.5 7.5 15M10 17.5 12.5 15M2.5 10 5 7.5M2.5 10 5 12.5M17.5 10 15 7.5M17.5 10 15 12.5"
4
4
  fill="none"
@@ -200,4 +200,4 @@ color: var(--astl-accent);
200
200
  <bdi lang=${o(h===``?void 0:h)}>${this.#o(d)}</bdi>
201
201
  </p>`}
202
202
  </div>`}updated(){let e=this.#e;e!==null&&(this.#e=null,this.renderRoot.querySelector(`button.card-button[data-card="${CSS.escape(e)}"]`)?.focus())}#a(e){return this.placed.get(e)??_}#o(e){return e===_?this.t(`ui.unsorted`):b(this.categories.find(t=>t.id===e))}#s(e,t){let n=this.#a(e),r=this.cards.filter(e=>!this.placed.has(e.id)).map(e=>e.id),i=this.renderRoot.activeElement!==null,a=new Map(this.placed);a.delete(e),t!==_&&a.set(e,t),this.placed=a,this.emitChange({[e]:t}),i&&(this.#e=(n===_?r[r.indexOf(e)+1]:void 0)??e)}#c(e,t,n){let r=this.cards,i=this.placed,a=e===`put`?n===_?`unsort`:`drop`:e;return this.t(`ui.announce.${a}`,{card:b(r.find(e=>e.id===t)),group:this.#o(n),count:n===_?r.length-i.size:[...i.values()].filter(e=>e===n).length,placed:i.size,total:r.length})}#l(e){if(this.#t.picked===null||this.disabled)return;let t=e.composedPath(),n=t.slice(0,t.indexOf(e.currentTarget));if(n.some(e=>e instanceof HTMLButtonElement||e instanceof HTMLAnchorElement))return;let r=n.find(e=>e instanceof HTMLElement&&e.dataset.zone!==void 0);r!==void 0&&this.#t.put(r.dataset.zone??_)}#u(e,t){for(let n of this.renderRoot.querySelectorAll(`[data-zone]`)){let r=n.getBoundingClientRect();if(e>=r.left&&e<=r.right&&t>=r.top&&t<=r.bottom)return n.dataset.zone??null}return null}},C={manifest:l,element:S,messages:g};export{C as categoriseElement};
203
- //# sourceMappingURL=categorise-BO2tNVJ3.js.map
203
+ //# sourceMappingURL=categorise-Cm6kXLXw.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"categorise-BO2tNVJ3.js","names":["en","pl","LitElement","unsafeCSS","nothing","repeat","ifDefined","b","r","i$1","A","verdictIcon","AstlElement","i","en_default","categoriseManifest","pl_default","PickAndPlace","blockStyles","c","chipStyles","namespace","categoriseUiMessages","UNSORTED","LONG_PRESS","MOVE_ICON","textOf","copy","el","img","paletteOf","slot","category","CategoriseElement","#zoneOf","id","#zoneAt","x","y","#move","zone","#message","moment","card","cards","categories","next","value","answers","#pick","state","ui","index","unsorted","slots","#slots","#onZoneClick","#renderZone","named","free","pick","picked","name","#zoneName","note","n","palette","ids","#renderCard","answer","marked","verdict","correct","mark","describedBy","ref","content","event","focus","#focusAfter","from","pile","focused","placed","key","path","inside","node","box","categoriseElement"],"sources":["../../../../components/src/categorise/ui-messages.ts","../../../../components/src/categorise/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.categorise';\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 `categoriseMessages` would put the authoring strings into the element's chunk.\n */\nexport const categoriseUiMessages: readonly MessageCatalog[] = [\n { namespace, locale: 'en', messages: en },\n { namespace, locale: 'pl', messages: pl },\n];\n","import type { Answers, ComponentManifest, JsonValue, MessageCatalog, Units } from '@astl/core';\nimport { AstlElement, type ElementRegistration, verdictIcon } from '@astl/player';\nimport { PickAndPlace, type PickMoment } 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 { repeat } from 'lit/directives/repeat.js';\nimport { blockStyles } from '../block-styles.js';\nimport { chipStyles } from '../chip-styles.js';\nimport { categoriseManifest } from './manifest.js';\nimport { categoriseUiMessages } from './ui-messages.js';\n\n/** Zone key of the unsorted area; categories use their ids. */\nconst UNSORTED = '';\n\n/**\n * A touch held this long (ms) without moving starts a drag. A touch that moves sooner scrolls the page, as touches\n * do everywhere else, and a short one is a tap.\n */\nconst LONG_PRESS = 250;\n\n/** Marks the picked card next to its other cues (bar, lift, `aria-pressed`): four arrows, \"this card moves\". */\nconst MOVE_ICON = html`<svg class=\"move\" viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">\n <path\n d=\"M10 2.5v15M2.5 10h15M10 2.5 7.5 5M10 2.5 12.5 5M10 17.5 7.5 15M10 17.5 12.5 15M2.5 10 5 7.5M2.5 10 5 12.5M17.5 10 15 7.5M17.5 10 15 12.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n</svg>`;\n\n/** What a card or a group says: its text, each picture by its alt text, as a screen reader reads it. */\nconst textOf = (el: Element | undefined): string => {\n const copy = el?.cloneNode(true) as Element | undefined;\n for (const img of copy?.querySelectorAll('img') ?? []) img.replaceWith(` ${img.alt} `);\n return (copy?.textContent ?? '').replace(/\\s+/g, ' ').trim();\n};\n\n/** A group's own palette slot (`palette`, 1 to 8), or null. */\nfunction paletteOf(category: Element): number | null {\n const slot = Number(category.getAttribute('palette'));\n return Number.isInteger(slot) && slot >= 1 && slot <= 8 ? slot : null;\n}\n\n/**\n * `<astl-categorise>`: the cards of the view, unsorted at first, and one drop zone per category. Each card is a\n * native toggle button (`aria-pressed` while picked) in the tab order. Three ways to move a card, all with the\n * same result and announcement:\n * - keyboard: Space or Enter picks the card, the arrow keys choose a zone (the unsorted area, then the categories;\n * left and right follow the writing direction), Enter or Space puts it there, Escape cancels;\n * - pointer: drag the card onto a zone (with touch: hold the card a moment, then drag);\n * - single pointer (WCAG 2.5.7): tap the card, then \"Put here\" (or anywhere in a zone).\n * Slots: one per card (its id); the answer is the id of the category it is in. The light-DOM children are slotted\n * manually and never moved or changed.\n */\nexport class CategoriseElement extends AstlElement {\n static override manifest: ComponentManifest = categoriseManifest;\n static override messages: readonly MessageCatalog[] = categoriseUiMessages;\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 // A column whose gaps space its parts, so the group verdict line has no margin of its own.\n css`\n fieldset {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-3);\n }\n .group-verdict {\n margin-block: 0;\n }\n `,\n // Trays: tinted, solid edges (dashed, dotted and double borders are the verdict language). A tap target while a\n // card is picked: no double-tap zoom (touch-action), so the tap is not delayed.\n css`\n .zone {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-2);\n min-inline-size: 0;\n padding: var(--astl-space-3);\n border: var(--astl-outline-width) solid var(--astl-line);\n border-radius: var(--astl-radius-l);\n background: var(--astl-canvas);\n touch-action: manipulation;\n }\n `,\n // A group's tray takes its palette slot (below), and so do the cards placed in it; cards to sort have no group\n // colour, so colour never hints at an answer, and the group's name stays above its cards.\n css`\n .groups .zone {\n border-color: var(--astl-group);\n background: var(--astl-group-soft);\n }\n `,\n // The zone Enter puts the picked card in, or the one under a dragged card: a doubled edge (an inner outline, which\n // forced colours keep) and a tint.\n css`\n .zone[data-target],\n .zone[data-over] {\n border-color: var(--astl-accent);\n outline: var(--astl-outline-width) solid var(--astl-accent);\n outline-offset: calc(-2 * var(--astl-outline-width));\n background: var(--astl-accent-soft);\n }\n `,\n // While a card is picked, a tap anywhere in a zone puts it there.\n css`\n fieldset[data-picking] .zone {\n cursor: pointer;\n }\n `,\n // One column on phones, up to three in the player's column.\n css`\n .groups {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));\n gap: var(--astl-space-3);\n }\n .label {\n font-size: var(--astl-size-ui);\n font-weight: 600;\n line-height: 1.4;\n overflow-wrap: anywhere;\n }\n .note {\n margin: 0;\n color: var(--astl-ink-muted);\n font-size: var(--astl-size-small);\n }\n .cards {\n display: flex;\n flex-wrap: wrap;\n gap: var(--astl-space-2);\n }\n `,\n // A card is a chip (chipStyles: its box, button, pick and drag): row 1, the button and its verdict icon; row 2, the\n // solution line (block-styles.ts), which wraps at the card's own width rather than stretch the card across its\n // group (a card with one is a little wider, so the line keeps a few words a line). Picked: in hc also bold text\n // (selected-weight). Locked (review, handed in): a quieter edge, the text at full contrast; a verdict keeps its\n // colour. A long press starts a drag (see LONG_PRESS).\n css`\n .card {\n box-sizing: border-box;\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n grid-template-areas: 'button verdict' 'mark mark';\n align-items: start;\n }\n .groups .card {\n border-color: var(--astl-group);\n }\n .card[data-picked] .text {\n font-weight: var(--astl-selected-weight);\n }\n .card:not([data-verdict]):has(.card-button:disabled) {\n border-color: var(--astl-line);\n }\n .card-button {\n grid-area: button;\n }\n .text {\n min-inline-size: 0;\n overflow-wrap: anywhere;\n }\n .card > .astl-verdict {\n grid-area: verdict;\n min-block-size: var(--astl-target-min);\n padding-inline-end: var(--astl-space-3);\n }\n .mark-row {\n grid-area: mark;\n contain: inline-size;\n padding-block-end: var(--astl-space-2);\n padding-inline: var(--astl-space-3);\n }\n .card:has(> .mark-row) {\n min-inline-size: min(100%, 11rem);\n }\n .drop {\n box-sizing: border-box;\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-4);\n border: var(--astl-outline-width) solid var(--astl-accent);\n border-radius: var(--astl-radius-m);\n background: var(--astl-surface);\n color: var(--astl-accent);\n font: inherit;\n font-size: var(--astl-size-ui);\n font-weight: 600;\n line-height: 1.4;\n cursor: pointer;\n }\n .zone[data-target] .drop {\n background: var(--astl-accent);\n color: var(--astl-on-accent);\n }\n `,\n // System colours draw a backplate behind text: a filled button would hide its label.\n css`\n @media (forced-colors: active) {\n .zone[data-target] .drop {\n background: var(--astl-surface);\n color: var(--astl-accent);\n }\n }\n `,\n // Palette slots of the groups, through an attribute: a strict Content Security Policy blocks inline styles.\n unsafeCSS(\n Array.from(\n { length: 8 },\n (_, i) =>\n `[data-palette='${i + 1}']{--astl-group:var(--astl-palette-${i + 1});--astl-group-soft:var(--astl-palette-${i + 1}-soft)}`,\n ).join(''),\n ),\n chipStyles,\n blockStyles,\n ];\n\n /** Card id to category id, in placement order: a zone shows its cards in the order they were put there. */\n declare protected placed: ReadonlyMap<string, string>;\n /** Card to focus after the next render (a card that changes zone is a new button). */\n #focusAfter: string | null = null;\n /**\n * Picking and moving cards: destinations are the zones (the unsorted area, then the categories, in arrow key\n * order with wrap-around), a dragged card follows the pointer, a touch drags after a long press. Focus leaving the\n * task, or a press outside it, puts a picked card down where it was.\n */\n readonly #pick: PickAndPlace<string> = new PickAndPlace<string>(this, {\n destinations: () => [UNSORTED, ...this.categories.map((category) => category.id)],\n current: (id) => this.#zoneOf(id),\n at: (x, y) => this.#zoneAt(x, y),\n commit: (id, zone) => this.#move(id, zone),\n say: (moment, id, zone) => this.#message(moment, id, zone),\n wrap: true,\n box: '.card',\n hold: LONG_PRESS,\n });\n\n constructor() {\n super();\n this.placed = new Map();\n }\n\n /** `<astl-category>` children, in view order. */\n get categories(): readonly HTMLElement[] {\n return this.childElements('astl-category');\n }\n\n /** `<astl-card>` children in rendered order: view order, or shuffled per attempt with a seed. */\n get cards(): readonly HTMLElement[] {\n return this.shuffled(this.childElements('astl-card'));\n }\n\n get slotIds(): readonly string[] {\n return this.id === '' ? [] : this.cards.map((card) => card.id);\n }\n\n getAnswers(): Answers {\n return this.id === '' ? {} : Object.fromEntries(this.placed);\n }\n\n setAnswers(answers: Answers): void {\n const cards = new Set(this.cards.map((card) => card.id));\n const categories = new Set(this.categories.map((category) => category.id));\n const next = new Map(this.placed);\n for (const [id, value] of Object.entries(answers)) {\n if (!cards.has(id) || next.get(id) === value) continue;\n next.delete(id);\n // '' takes the card out; an unknown category cannot be shown, so the card is unsorted, as the player sends it.\n if (categories.has(value)) next.set(id, value);\n }\n this.placed = next;\n this.#pick.reset();\n }\n\n units(): Units {\n return { answered: this.placed.size, total: this.cards.length };\n }\n\n /** The placement order, so a restored attempt shows each zone as the student left it. */\n getUiState(): JsonValue {\n return [...this.placed.keys()];\n }\n\n setUiState(state: JsonValue): void {\n if (!Array.isArray(state)) return;\n const next = new Map<string, string>();\n for (const id of state) {\n const category = typeof id === 'string' ? this.placed.get(id) : undefined;\n if (category !== undefined) next.set(id as string, category);\n }\n for (const [id, category] of this.placed) if (!next.has(id)) next.set(id, category);\n this.placed = next;\n }\n\n protected override render(): TemplateResult {\n const ui = this.uiLanguage;\n const cards = this.cards;\n const index = new Map(cards.map((card, i) => [card.id, i]));\n const unsorted = cards.filter((card) => !this.placed.has(card.id)).map((card) => card.id);\n const slots = this.#slots();\n return html`<fieldset part=\"categorise\" ?data-picking=${this.#pick.picked !== null} @click=${this.#onZoneClick}>\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 <span class=\"astl-vh\" id=\"instructions\" lang=${ui.lang} dir=${ui.dir}>${this.t('ui.instructions')}</span>\n ${this.#renderZone(UNSORTED, unsorted, index, 0, null)}\n <div class=\"groups\">\n ${this.categories.map((category, i) =>\n this.#renderZone(\n category.id,\n [...this.placed].filter(([, c]) => c === category.id).map(([id]) => id),\n index,\n i + 1,\n slots[i] ?? null,\n ),\n )}\n </div>\n ${this.renderGroupVerdict()}\n </fieldset>`;\n }\n\n /**\n * The palette slot of each group, in order: its own `palette`, else the next slot no group names; past the free\n * slots it wraps around them.\n */\n #slots(): readonly number[] {\n const named = this.categories.map(paletteOf);\n const free = [1, 2, 3, 4, 5, 6, 7, 8].filter((slot) => !named.includes(slot));\n let next = 0;\n return named.map((slot) => slot ?? free[next++ % free.length] ?? 1);\n }\n\n #renderZone(\n zone: string,\n ids: readonly string[],\n index: ReadonlyMap<string, number>,\n n: number,\n palette: number | null,\n ): TemplateResult {\n const ui = this.uiLanguage;\n const unsorted = zone === UNSORTED;\n const pick = this.#pick;\n const picked = pick.picked;\n const name = this.#zoneName(zone);\n const note = unsorted ? 'ui.allSorted' : 'ui.emptyGroup';\n return html`<div\n class=\"zone\"\n part=${unsorted ? 'unsorted' : 'group'}\n role=\"group\"\n aria-labelledby=\"zone-${n}\"\n data-zone=${zone}\n data-palette=${palette ?? nothing}\n ?data-target=${picked !== null && pick.target === zone}\n ?data-over=${pick.dragging !== null && pick.over === zone}\n >\n <div class=\"label\" part=\"label\" id=\"zone-${n}\">\n ${\n unsorted\n ? html`<span lang=${ui.lang} dir=${ui.dir}>${name}</span>`\n : html`<slot data-category=${zone}></slot>`\n }\n </div>\n ${\n ids.length === 0\n ? // Aligned like the zone label (the zone's direction); the UI text keeps its own language and direction.\n html`<p class=\"note\"><span lang=${ui.lang} dir=${ui.dir}>${this.t(note)}</span></p>`\n : html`<div class=\"cards\">\n ${repeat(\n ids,\n (id) => id,\n (id) => this.#renderCard(id, index.get(id) ?? 0),\n )}\n </div>`\n }\n ${\n picked !== null && !this.disabled && this.#zoneOf(picked) !== zone\n ? html`<button\n type=\"button\"\n class=\"drop\"\n part=\"drop\"\n lang=${ui.lang}\n dir=${ui.dir}\n aria-label=${this.t('ui.dropLabel', { group: name })}\n @click=${() => pick.put(zone)}\n >\n ${this.t('ui.drop')}\n </button>`\n : nothing\n }\n </div>`;\n }\n\n #renderCard(id: string, i: number): TemplateResult {\n const ui = this.uiLanguage;\n const answer = this.#zoneOf(id);\n // Where cards are marked one by one, a card left unsorted shows \"no answer\" (dotted), as in every type.\n const marked = Object.keys(this.feedback?.slots ?? {}).length > 0;\n const verdict = answer === UNSORTED ? (marked ? 'empty' : null) : this.slotVerdict(id);\n const correct = this.solution?.[id];\n // One clear indicator: a card in its own category needs no solution mark (its place, or its verdict, says it).\n const mark = correct !== undefined && correct !== answer ? correct : null;\n const pick = this.#pick;\n const picked = pick.picked === id;\n const describedBy = [\n this.disabled ? '' : 'instructions',\n verdict === null ? '' : `verdict-${i}`,\n mark === null ? '' : `solution-${i}`,\n ]\n .filter((ref) => ref !== '')\n .join(' ');\n const content = this.contentLang;\n return html`<div\n class=\"card chip astl-box astl-ring\"\n part=\"card\"\n data-card=${id}\n data-verdict=${ifDefined(verdict ?? undefined)}\n ?data-picked=${picked}\n ?data-dragging=${pick.dragging === id}\n >\n <button\n type=\"button\"\n class=\"card-button\"\n data-card=${id}\n aria-pressed=${picked ? 'true' : 'false'}\n aria-describedby=${describedBy === '' ? nothing : describedBy}\n ?disabled=${this.disabled}\n @click=${(event: MouseEvent) => pick.click(event, id)}\n @keydown=${(event: KeyboardEvent) => pick.keydown(event, id)}\n @pointerdown=${(event: PointerEvent) => pick.pointerdown(event, id)}\n @touchmove=${pick.touchmove}\n >\n ${picked ? MOVE_ICON : nothing}<span class=\"text\"><slot data-card=${id}></slot></span>\n </button>\n ${this.renderVerdict(verdict, { hiddenWord: true, id: `verdict-${i}` })}\n ${\n mark === null\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=\"mark-row astl-solution\" part=\"solution\" id=\"solution-${i}\" data-category=${mark} lang=${ui.lang} dir=${ui.dir}>\n ${verdictIcon('correct')}<span class=\"astl-solution-label\">${this.t('ui.solution')}</span>\n <bdi lang=${ifDefined(content === '' ? undefined : content)}>${this.#zoneName(mark)}</bdi>\n </p>`\n }\n </div>`;\n }\n\n protected override updated(): void {\n const focus = this.#focusAfter;\n if (focus !== null) {\n this.#focusAfter = null;\n this.renderRoot\n .querySelector<HTMLElement>(`button.card-button[data-card=\"${CSS.escape(focus)}\"]`)\n ?.focus();\n }\n }\n\n // Moving cards\n\n #zoneOf(id: string): string {\n return this.placed.get(id) ?? UNSORTED;\n }\n\n #zoneName(zone: string): string {\n if (zone === UNSORTED) return this.t('ui.unsorted');\n return textOf(this.categories.find((category) => category.id === zone));\n }\n\n /** Puts card `id` into `zone`: a keyboard put, a \"Put here\" button, a tap on a zone or a drop. */\n #move(id: string, zone: string): void {\n const from = this.#zoneOf(id);\n const pile = this.cards.filter((card) => !this.placed.has(card.id)).map((card) => card.id);\n const focused = (this.renderRoot as ShadowRoot).activeElement !== null;\n const next = new Map(this.placed);\n next.delete(id);\n if (zone !== UNSORTED) next.set(id, zone);\n this.placed = next;\n this.emitChange({ [id]: zone });\n // Sorting works through the pile: from the unsorted area, focus goes on to the card that takes this one's place.\n if (focused) this.#focusAfter = (from === UNSORTED ? pile[pile.indexOf(id) + 1] : undefined) ?? id;\n }\n\n /** `ui.announce.pick`, `target`, `cancel`, and for a put `drop` (or `unsort`, back to the cards to sort). */\n #message(moment: PickMoment, id: string, zone: string): string {\n const cards = this.cards;\n const placed = this.placed;\n const key = moment !== 'put' ? moment : zone === UNSORTED ? 'unsort' : 'drop';\n return this.t(`ui.announce.${key}`, {\n card: textOf(cards.find((card) => card.id === id)),\n group: this.#zoneName(zone),\n // Cards in the zone (a target); cards placed so far (a put).\n count:\n zone === UNSORTED\n ? cards.length - placed.size\n : [...placed.values()].filter((c) => c === zone).length,\n placed: placed.size,\n total: cards.length,\n });\n }\n\n /** Taps on a zone (not on a card, a button or a link) put the picked card there. */\n #onZoneClick(event: MouseEvent): void {\n if (this.#pick.picked === null || this.disabled) return;\n // Only what is inside the task: an element of the host page may carry `data-zone` too.\n const path = event.composedPath();\n const inside = path.slice(0, path.indexOf(event.currentTarget as EventTarget));\n if (inside.some((node) => node instanceof HTMLButtonElement || node instanceof HTMLAnchorElement)) return;\n const zone = inside.find(\n (node): node is HTMLElement => node instanceof HTMLElement && node.dataset.zone !== undefined,\n );\n if (zone !== undefined) this.#pick.put(zone.dataset.zone ?? UNSORTED);\n }\n\n #zoneAt(x: number, y: number): string | null {\n for (const zone of (this.renderRoot as ShadowRoot).querySelectorAll<HTMLElement>('[data-zone]')) {\n const box = zone.getBoundingClientRect();\n if (x >= box.left && x <= box.right && y >= box.top && y <= box.bottom)\n return zone.dataset.zone ?? null;\n }\n return null;\n }\n}\n\nexport const categoriseElement: ElementRegistration = {\n manifest: categoriseManifest,\n element: CategoriseElement,\n messages: categoriseUiMessages,\n};\n"],"mappings":"A,sVAIA,IAAMqB,EAAY,kBAMLC,EAAkD,CAC7D,CAAE,YAAW,OAAQ,KAAM,SAAUtB,CAAG,EACxC,CAAE,YAAW,OAAQ,KAAM,SAAUC,CAAG,CAC1C,ECQMsB,EAAW,GAMXC,EAAa,IAGbC,EAAY,CAAI;;;;;;;;;QAYhBC,EAAU,GAAoC,CAClD,IAAMC,EAAOC,GAAI,UAAU,EAAI,EAC/B,IAAK,IAAMC,KAAOF,GAAM,iBAAiB,KAAK,GAAK,CAAC,EAAGE,EAAI,YAAY,IAAIA,EAAI,IAAI,EAAE,EACrF,OAAQF,GAAM,aAAe,GAAA,CAAI,QAAQ,OAAQ,GAAG,CAAC,CAAC,KAAK,CAC7D,EAGA,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I,KAAKK,GAAM,SAAW,MAAQ,KAAK,SAAU,OAEjD,IAAMoC,EAAOR,EAAM,aAAa,EAC1BS,EAASD,EAAK,MAAM,EAAGA,EAAK,QAAQR,EAAM,aAA4B,CAAC,EAC7E,GAAIS,EAAO,KAAM,GAASC,aAAgB,mBAAqBA,aAAgB,iBAAiB,EAAG,OACnG,IAAM/C,EAAO8C,EAAO,KACjB,GAA8BC,aAAgB,aAAeA,EAAK,QAAQ,OAAS,IAAA,EACtF,EACI/C,IAAS,IAAA,IAAW,KAAKS,GAAM,IAAIT,EAAK,QAAQ,MAAQjB,CAAQ,CACtE,CAEA,GAAQ,EAAW,EAA0B,CAC3C,IAAK,IAAMiB,KAAS,KAAK,WAA0B,iBAA8B,aAAa,EAAG,CAC/F,IAAMgD,EAAMhD,EAAK,sBAAsB,EACvC,GAAIH,GAAKmD,EAAI,MAAQnD,GAAKmD,EAAI,OAASlD,GAAKkD,EAAI,KAAOlD,GAAKkD,EAAI,OAC9D,OAAOhD,EAAK,QAAQ,MAAQ,IAChC,CACA,OAAO,IACT,CACF,EAEaiD,EAAyC,CACpD,SAAU1E,EACV,QAASkB,EACT,SAAUX,CACZ,E"}
1
+ {"version":3,"file":"categorise-Cm6kXLXw.js","names":["en","pl","LitElement","unsafeCSS","nothing","repeat","ifDefined","b","r","i$1","A","verdictIcon","AstlElement","i","en_default","categoriseManifest","pl_default","PickAndPlace","blockStyles","c","chipStyles","namespace","categoriseUiMessages","UNSORTED","LONG_PRESS","MOVE_ICON","textOf","copy","el","img","paletteOf","slot","category","CategoriseElement","#zoneOf","id","#zoneAt","x","y","#move","zone","#message","moment","card","cards","categories","next","value","answers","#pick","state","ui","index","unsorted","slots","#slots","#onZoneClick","#renderZone","named","free","pick","picked","name","#zoneName","note","n","palette","ids","#renderCard","answer","marked","verdict","correct","mark","describedBy","ref","content","event","focus","#focusAfter","from","pile","focused","placed","key","path","inside","node","box","categoriseElement"],"sources":["../../../../components/src/categorise/ui-messages.ts","../../../../components/src/categorise/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.categorise';\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 `categoriseMessages` would put the authoring strings into the element's chunk.\n */\nexport const categoriseUiMessages: readonly MessageCatalog[] = [\n { namespace, locale: 'en', messages: en },\n { namespace, locale: 'pl', messages: pl },\n];\n","import type { Answers, ComponentManifest, JsonValue, MessageCatalog, Units } from '@astl/core';\nimport { AstlElement, type ElementRegistration, verdictIcon } from '@astl/player';\nimport { PickAndPlace, type PickMoment } 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 { repeat } from 'lit/directives/repeat.js';\nimport { blockStyles } from '../block-styles.js';\nimport { chipStyles } from '../chip-styles.js';\nimport { categoriseManifest } from './manifest.js';\nimport { categoriseUiMessages } from './ui-messages.js';\n\n/** Zone key of the unsorted area; categories use their ids. */\nconst UNSORTED = '';\n\n/**\n * A touch held this long (ms) without moving starts a drag. A touch that moves sooner scrolls the page, as touches\n * do everywhere else, and a short one is a tap.\n */\nconst LONG_PRESS = 250;\n\n/** Marks the picked card next to its other cues (bar, lift, `aria-pressed`): four arrows, \"this card moves\". */\nconst MOVE_ICON = html`<svg class=\"move\" viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">\n <path\n d=\"M10 2.5v15M2.5 10h15M10 2.5 7.5 5M10 2.5 12.5 5M10 17.5 7.5 15M10 17.5 12.5 15M2.5 10 5 7.5M2.5 10 5 12.5M17.5 10 15 7.5M17.5 10 15 12.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n</svg>`;\n\n/** What a card or a group says: its text, each picture by its alt text, as a screen reader reads it. */\nconst textOf = (el: Element | undefined): string => {\n const copy = el?.cloneNode(true) as Element | undefined;\n for (const img of copy?.querySelectorAll('img') ?? []) img.replaceWith(` ${img.alt} `);\n return (copy?.textContent ?? '').replace(/\\s+/g, ' ').trim();\n};\n\n/** A group's own palette slot (`palette`, 1 to 8), or null. */\nfunction paletteOf(category: Element): number | null {\n const slot = Number(category.getAttribute('palette'));\n return Number.isInteger(slot) && slot >= 1 && slot <= 8 ? slot : null;\n}\n\n/**\n * `<astl-categorise>`: the cards of the view, unsorted at first, and one drop zone per category. Each card is a\n * native toggle button (`aria-pressed` while picked) in the tab order. Three ways to move a card, all with the\n * same result and announcement:\n * - keyboard: Space or Enter picks the card, the arrow keys choose a zone (the unsorted area, then the categories;\n * left and right follow the writing direction), Enter or Space puts it there, Escape cancels;\n * - pointer: drag the card onto a zone (with touch: hold the card a moment, then drag);\n * - single pointer (WCAG 2.5.7): tap the card, then \"Put here\" (or anywhere in a zone).\n * Slots: one per card (its id); the answer is the id of the category it is in. The light-DOM children are slotted\n * manually and never moved or changed.\n */\nexport class CategoriseElement extends AstlElement {\n static override manifest: ComponentManifest = categoriseManifest;\n static override messages: readonly MessageCatalog[] = categoriseUiMessages;\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 // A column whose gaps space its parts, so the group verdict line has no margin of its own.\n css`\n fieldset {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-3);\n }\n .group-verdict {\n margin-block: 0;\n }\n `,\n // Trays: tinted, solid edges (dashed, dotted and double borders are the verdict language). A tap target while a\n // card is picked: no double-tap zoom (touch-action), so the tap is not delayed.\n css`\n .zone {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-2);\n min-inline-size: 0;\n padding: var(--astl-space-3);\n border: var(--astl-outline-width) solid var(--astl-line);\n border-radius: var(--astl-radius-l);\n background: var(--astl-canvas);\n touch-action: manipulation;\n }\n `,\n // A group's tray takes its palette slot (below), and so do the cards placed in it; cards to sort have no group\n // colour, so colour never hints at an answer, and the group's name stays above its cards.\n css`\n .groups .zone {\n border-color: var(--astl-group);\n background: var(--astl-group-soft);\n }\n `,\n // The zone Enter puts the picked card in, or the one under a dragged card: a doubled edge (an inner outline, which\n // forced colours keep) and a tint.\n css`\n .zone[data-target],\n .zone[data-over] {\n border-color: var(--astl-accent);\n outline: var(--astl-outline-width) solid var(--astl-accent);\n outline-offset: calc(-2 * var(--astl-outline-width));\n background: var(--astl-accent-soft);\n }\n `,\n // While a card is picked, a tap anywhere in a zone puts it there.\n css`\n fieldset[data-picking] .zone {\n cursor: pointer;\n }\n `,\n // One column on phones, up to three in the player's column.\n css`\n .groups {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));\n gap: var(--astl-space-3);\n }\n .label {\n font-size: var(--astl-size-ui);\n font-weight: 600;\n line-height: 1.4;\n overflow-wrap: anywhere;\n }\n .note {\n margin: 0;\n color: var(--astl-ink-muted);\n font-size: var(--astl-size-small);\n }\n .cards {\n display: flex;\n flex-wrap: wrap;\n gap: var(--astl-space-2);\n }\n `,\n // A card is a chip (chipStyles: its box, button, pick and drag): row 1, the button and its verdict icon; row 2, the\n // solution line (block-styles.ts), which wraps at the card's own width rather than stretch the card across its\n // group (a card with one is a little wider, so the line keeps a few words a line). Picked: in hc also bold text\n // (selected-weight). Locked (review, handed in): a quieter edge, the text at full contrast; a verdict keeps its\n // colour. A long press starts a drag (see LONG_PRESS).\n css`\n .card {\n box-sizing: border-box;\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n grid-template-areas: 'button verdict' 'mark mark';\n align-items: start;\n }\n .groups .card {\n border-color: var(--astl-group);\n }\n .card[data-picked] .text {\n font-weight: var(--astl-selected-weight);\n }\n .card:not([data-verdict]):has(.card-button:disabled) {\n border-color: var(--astl-line);\n }\n .card-button {\n grid-area: button;\n }\n .text {\n min-inline-size: 0;\n overflow-wrap: anywhere;\n }\n .card > .astl-verdict {\n grid-area: verdict;\n min-block-size: var(--astl-target-min);\n padding-inline-end: var(--astl-space-3);\n }\n .mark-row {\n grid-area: mark;\n contain: inline-size;\n padding-block-end: var(--astl-space-2);\n padding-inline: var(--astl-space-3);\n }\n .card:has(> .mark-row) {\n min-inline-size: min(100%, 11rem);\n }\n .drop {\n box-sizing: border-box;\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-4);\n border: var(--astl-outline-width) solid var(--astl-accent);\n border-radius: var(--astl-radius-m);\n background: var(--astl-surface);\n color: var(--astl-accent);\n font: inherit;\n font-size: var(--astl-size-ui);\n font-weight: 600;\n line-height: 1.4;\n cursor: pointer;\n }\n .zone[data-target] .drop {\n background: var(--astl-accent);\n color: var(--astl-on-accent);\n }\n `,\n // System colours draw a backplate behind text: a filled button would hide its label.\n css`\n @media (forced-colors: active) {\n .zone[data-target] .drop {\n background: var(--astl-surface);\n color: var(--astl-accent);\n }\n }\n `,\n // Palette slots of the groups, through an attribute: a strict Content Security Policy blocks inline styles.\n unsafeCSS(\n Array.from(\n { length: 8 },\n (_, i) =>\n `[data-palette='${i + 1}']{--astl-group:var(--astl-palette-${i + 1});--astl-group-soft:var(--astl-palette-${i + 1}-soft)}`,\n ).join(''),\n ),\n chipStyles,\n blockStyles,\n ];\n\n /** Card id to category id, in placement order: a zone shows its cards in the order they were put there. */\n declare protected placed: ReadonlyMap<string, string>;\n /** Card to focus after the next render (a card that changes zone is a new button). */\n #focusAfter: string | null = null;\n /**\n * Picking and moving cards: destinations are the zones (the unsorted area, then the categories, in arrow key\n * order with wrap-around), a dragged card follows the pointer, a touch drags after a long press. Focus leaving the\n * task, or a press outside it, puts a picked card down where it was.\n */\n readonly #pick: PickAndPlace<string> = new PickAndPlace<string>(this, {\n destinations: () => [UNSORTED, ...this.categories.map((category) => category.id)],\n current: (id) => this.#zoneOf(id),\n at: (x, y) => this.#zoneAt(x, y),\n commit: (id, zone) => this.#move(id, zone),\n say: (moment, id, zone) => this.#message(moment, id, zone),\n wrap: true,\n box: '.card',\n hold: LONG_PRESS,\n });\n\n constructor() {\n super();\n this.placed = new Map();\n }\n\n /** `<astl-category>` children, in view order. */\n get categories(): readonly HTMLElement[] {\n return this.childElements('astl-category');\n }\n\n /** `<astl-card>` children in rendered order: view order, or shuffled per attempt with a seed. */\n get cards(): readonly HTMLElement[] {\n return this.shuffled(this.childElements('astl-card'));\n }\n\n get slotIds(): readonly string[] {\n return this.id === '' ? [] : this.cards.map((card) => card.id);\n }\n\n getAnswers(): Answers {\n return this.id === '' ? {} : Object.fromEntries(this.placed);\n }\n\n setAnswers(answers: Answers): void {\n const cards = new Set(this.cards.map((card) => card.id));\n const categories = new Set(this.categories.map((category) => category.id));\n const next = new Map(this.placed);\n for (const [id, value] of Object.entries(answers)) {\n if (!cards.has(id) || next.get(id) === value) continue;\n next.delete(id);\n // '' takes the card out; an unknown category cannot be shown, so the card is unsorted, as the player sends it.\n if (categories.has(value)) next.set(id, value);\n }\n this.placed = next;\n this.#pick.reset();\n }\n\n units(): Units {\n return { answered: this.placed.size, total: this.cards.length };\n }\n\n /** The placement order, so a restored attempt shows each zone as the student left it. */\n getUiState(): JsonValue {\n return [...this.placed.keys()];\n }\n\n setUiState(state: JsonValue): void {\n if (!Array.isArray(state)) return;\n const next = new Map<string, string>();\n for (const id of state) {\n const category = typeof id === 'string' ? this.placed.get(id) : undefined;\n if (category !== undefined) next.set(id as string, category);\n }\n for (const [id, category] of this.placed) if (!next.has(id)) next.set(id, category);\n this.placed = next;\n }\n\n protected override render(): TemplateResult {\n const ui = this.uiLanguage;\n const cards = this.cards;\n const index = new Map(cards.map((card, i) => [card.id, i]));\n const unsorted = cards.filter((card) => !this.placed.has(card.id)).map((card) => card.id);\n const slots = this.#slots();\n return html`<fieldset part=\"categorise\" ?data-picking=${this.#pick.picked !== null} @click=${this.#onZoneClick}>\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 <span class=\"astl-vh\" id=\"instructions\" lang=${ui.lang} dir=${ui.dir}>${this.t('ui.instructions')}</span>\n ${this.#renderZone(UNSORTED, unsorted, index, 0, null)}\n <div class=\"groups\">\n ${this.categories.map((category, i) =>\n this.#renderZone(\n category.id,\n [...this.placed].filter(([, c]) => c === category.id).map(([id]) => id),\n index,\n i + 1,\n slots[i] ?? null,\n ),\n )}\n </div>\n ${this.renderGroupVerdict()}\n </fieldset>`;\n }\n\n /**\n * The palette slot of each group, in order: its own `palette`, else the next slot no group names; past the free\n * slots it wraps around them.\n */\n #slots(): readonly number[] {\n const named = this.categories.map(paletteOf);\n const free = [1, 2, 3, 4, 5, 6, 7, 8].filter((slot) => !named.includes(slot));\n let next = 0;\n return named.map((slot) => slot ?? free[next++ % free.length] ?? 1);\n }\n\n #renderZone(\n zone: string,\n ids: readonly string[],\n index: ReadonlyMap<string, number>,\n n: number,\n palette: number | null,\n ): TemplateResult {\n const ui = this.uiLanguage;\n const unsorted = zone === UNSORTED;\n const pick = this.#pick;\n const picked = pick.picked;\n const name = this.#zoneName(zone);\n const note = unsorted ? 'ui.allSorted' : 'ui.emptyGroup';\n return html`<div\n class=\"zone\"\n part=${unsorted ? 'unsorted' : 'group'}\n role=\"group\"\n aria-labelledby=\"zone-${n}\"\n data-zone=${zone}\n data-palette=${palette ?? nothing}\n ?data-target=${picked !== null && pick.target === zone}\n ?data-over=${pick.dragging !== null && pick.over === zone}\n >\n <div class=\"label\" part=\"label\" id=\"zone-${n}\">\n ${\n unsorted\n ? html`<span lang=${ui.lang} dir=${ui.dir}>${name}</span>`\n : html`<slot data-category=${zone}></slot>`\n }\n </div>\n ${\n ids.length === 0\n ? // Aligned like the zone label (the zone's direction); the UI text keeps its own language and direction.\n html`<p class=\"note\"><span lang=${ui.lang} dir=${ui.dir}>${this.t(note)}</span></p>`\n : html`<div class=\"cards\">\n ${repeat(\n ids,\n (id) => id,\n (id) => this.#renderCard(id, index.get(id) ?? 0),\n )}\n </div>`\n }\n ${\n picked !== null && !this.disabled && this.#zoneOf(picked) !== zone\n ? html`<button\n type=\"button\"\n class=\"drop\"\n part=\"drop\"\n lang=${ui.lang}\n dir=${ui.dir}\n aria-label=${this.t('ui.dropLabel', { group: name })}\n @click=${() => pick.put(zone)}\n >\n ${this.t('ui.drop')}\n </button>`\n : nothing\n }\n </div>`;\n }\n\n #renderCard(id: string, i: number): TemplateResult {\n const ui = this.uiLanguage;\n const answer = this.#zoneOf(id);\n // Where cards are marked one by one, a card left unsorted shows \"no answer\" (dotted), as in every type.\n const marked = Object.keys(this.feedback?.slots ?? {}).length > 0;\n const verdict = answer === UNSORTED ? (marked ? 'empty' : null) : this.slotVerdict(id);\n const correct = this.solution?.[id];\n // One clear indicator: a card in its own category needs no solution mark (its place, or its verdict, says it).\n const mark = correct !== undefined && correct !== answer ? correct : null;\n const pick = this.#pick;\n const picked = pick.picked === id;\n const describedBy = [\n this.disabled ? '' : 'instructions',\n verdict === null ? '' : `verdict-${i}`,\n mark === null ? '' : `solution-${i}`,\n ]\n .filter((ref) => ref !== '')\n .join(' ');\n const content = this.contentLang;\n return html`<div\n class=\"card chip astl-box astl-ring\"\n part=\"card\"\n data-card=${id}\n data-verdict=${ifDefined(verdict ?? undefined)}\n ?data-picked=${picked}\n ?data-dragging=${pick.dragging === id}\n >\n <button\n type=\"button\"\n class=\"card-button\"\n data-card=${id}\n aria-pressed=${picked ? 'true' : 'false'}\n aria-describedby=${describedBy === '' ? nothing : describedBy}\n ?disabled=${this.disabled}\n @click=${(event: MouseEvent) => pick.click(event, id)}\n @keydown=${(event: KeyboardEvent) => pick.keydown(event, id)}\n @pointerdown=${(event: PointerEvent) => pick.pointerdown(event, id)}\n @touchmove=${pick.touchmove}\n >\n ${picked ? MOVE_ICON : nothing}<span class=\"text\"><slot data-card=${id}></slot></span>\n </button>\n ${this.renderVerdict(verdict, { hiddenWord: true, id: `verdict-${i}` })}\n ${\n mark === null\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=\"mark-row astl-solution\" part=\"solution\" id=\"solution-${i}\" data-category=${mark} lang=${ui.lang} dir=${ui.dir}>\n ${verdictIcon('correct')}<span class=\"astl-solution-label\">${this.t('ui.solution')}</span>\n <bdi lang=${ifDefined(content === '' ? undefined : content)}>${this.#zoneName(mark)}</bdi>\n </p>`\n }\n </div>`;\n }\n\n protected override updated(): void {\n const focus = this.#focusAfter;\n if (focus !== null) {\n this.#focusAfter = null;\n this.renderRoot\n .querySelector<HTMLElement>(`button.card-button[data-card=\"${CSS.escape(focus)}\"]`)\n ?.focus();\n }\n }\n\n // Moving cards\n\n #zoneOf(id: string): string {\n return this.placed.get(id) ?? UNSORTED;\n }\n\n #zoneName(zone: string): string {\n if (zone === UNSORTED) return this.t('ui.unsorted');\n return textOf(this.categories.find((category) => category.id === zone));\n }\n\n /** Puts card `id` into `zone`: a keyboard put, a \"Put here\" button, a tap on a zone or a drop. */\n #move(id: string, zone: string): void {\n const from = this.#zoneOf(id);\n const pile = this.cards.filter((card) => !this.placed.has(card.id)).map((card) => card.id);\n const focused = (this.renderRoot as ShadowRoot).activeElement !== null;\n const next = new Map(this.placed);\n next.delete(id);\n if (zone !== UNSORTED) next.set(id, zone);\n this.placed = next;\n this.emitChange({ [id]: zone });\n // Sorting works through the pile: from the unsorted area, focus goes on to the card that takes this one's place.\n if (focused) this.#focusAfter = (from === UNSORTED ? pile[pile.indexOf(id) + 1] : undefined) ?? id;\n }\n\n /** `ui.announce.pick`, `target`, `cancel`, and for a put `drop` (or `unsort`, back to the cards to sort). */\n #message(moment: PickMoment, id: string, zone: string): string {\n const cards = this.cards;\n const placed = this.placed;\n const key = moment !== 'put' ? moment : zone === UNSORTED ? 'unsort' : 'drop';\n return this.t(`ui.announce.${key}`, {\n card: textOf(cards.find((card) => card.id === id)),\n group: this.#zoneName(zone),\n // Cards in the zone (a target); cards placed so far (a put).\n count:\n zone === UNSORTED\n ? cards.length - placed.size\n : [...placed.values()].filter((c) => c === zone).length,\n placed: placed.size,\n total: cards.length,\n });\n }\n\n /** Taps on a zone (not on a card, a button or a link) put the picked card there. */\n #onZoneClick(event: MouseEvent): void {\n if (this.#pick.picked === null || this.disabled) return;\n // Only what is inside the task: an element of the host page may carry `data-zone` too.\n const path = event.composedPath();\n const inside = path.slice(0, path.indexOf(event.currentTarget as EventTarget));\n if (inside.some((node) => node instanceof HTMLButtonElement || node instanceof HTMLAnchorElement)) return;\n const zone = inside.find(\n (node): node is HTMLElement => node instanceof HTMLElement && node.dataset.zone !== undefined,\n );\n if (zone !== undefined) this.#pick.put(zone.dataset.zone ?? UNSORTED);\n }\n\n #zoneAt(x: number, y: number): string | null {\n for (const zone of (this.renderRoot as ShadowRoot).querySelectorAll<HTMLElement>('[data-zone]')) {\n const box = zone.getBoundingClientRect();\n if (x >= box.left && x <= box.right && y >= box.top && y <= box.bottom)\n return zone.dataset.zone ?? null;\n }\n return null;\n }\n}\n\nexport const categoriseElement: ElementRegistration = {\n manifest: categoriseManifest,\n element: CategoriseElement,\n messages: categoriseUiMessages,\n};\n"],"mappings":"A,sVAIA,IAAMqB,EAAY,kBAMLC,EAAkD,CAC7D,CAAE,YAAW,OAAQ,KAAM,SAAUtB,CAAG,EACxC,CAAE,YAAW,OAAQ,KAAM,SAAUC,CAAG,CAC1C,ECQMsB,EAAW,GAMXC,EAAa,IAGbC,EAAY,CAAI;;;;;;;;;QAYhBC,EAAU,GAAoC,CAClD,IAAMC,EAAOC,GAAI,UAAU,EAAI,EAC/B,IAAK,IAAMC,KAAOF,GAAM,iBAAiB,KAAK,GAAK,CAAC,EAAGE,EAAI,YAAY,IA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IAAMqB,CAAI,CAAC,CAAC,OACrD,OAAQ2C,EAAO,KACf,MAAOvC,EAAM,MACf,CAAC,CACH,CAGA,GAAa,EAAyB,CACpC,GAAI,KAAKK,GAAM,SAAW,MAAQ,KAAK,SAAU,OAEjD,IAAMoC,EAAOR,EAAM,aAAa,EAC1BS,EAASD,EAAK,MAAM,EAAGA,EAAK,QAAQR,EAAM,aAA4B,CAAC,EAC7E,GAAIS,EAAO,KAAM,GAASC,aAAgB,mBAAqBA,aAAgB,iBAAiB,EAAG,OACnG,IAAM/C,EAAO8C,EAAO,KACjB,GAA8BC,aAAgB,aAAeA,EAAK,QAAQ,OAAS,IAAA,EACtF,EACI/C,IAAS,IAAA,IAAW,KAAKS,GAAM,IAAIT,EAAK,QAAQ,MAAQjB,CAAQ,CACtE,CAEA,GAAQ,EAAW,EAA0B,CAC3C,IAAK,IAAMiB,KAAS,KAAK,WAA0B,iBAA8B,aAAa,EAAG,CAC/F,IAAMgD,EAAMhD,EAAK,sBAAsB,EACvC,GAAIH,GAAKmD,EAAI,MAAQnD,GAAKmD,EAAI,OAASlD,GAAKkD,EAAI,KAAOlD,GAAKkD,EAAI,OAC9D,OAAOhD,EAAK,QAAQ,MAAQ,IAChC,CACA,OAAO,IACT,CACF,EAEaiD,EAAyC,CACpD,SAAU1E,EACV,QAASkB,EACT,SAAUX,CACZ,E"}
@@ -1,4 +1,4 @@
1
- import{E as e}from"./runtime-DxAbpr3S.js";var t=e`
1
+ import{E as e}from"./runtime-C25QK5B0.js";var t=e`
2
2
  .chip {
3
3
  position: relative;
4
4
  max-inline-size: 100%;
@@ -74,4 +74,4 @@ transition: none;
74
74
  }
75
75
  }
76
76
  `;export{t};
77
- //# sourceMappingURL=chip-styles-Dme5daTO.js.map
77
+ //# sourceMappingURL=chip-styles--gboWK2Z.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chip-styles-Dme5daTO.js","names":["i","chipStyles"],"sources":["../../../../components/src/chip-styles.ts"],"sourcesContent":["/**\n * Shared CSS of the chips students pick up and place, a `.chip` box around its button: the cards of categorise and\n * the words of the word bank. Imported only by them (one small chunk with their elements, none with the others). An\n * element lists it after its own rules and before `blockStyles`; to refine a rule here, it uses a more specific\n * selector.\n */\nimport { type CSSResultGroup, css } from 'lit';\n\n// The box carries the border and the ring; its button is the target. A long word hyphenates in its own language.\n// Touches on a chip scroll and zoom as usual (touch-action); a long press starts a drag. Picked: lifted with a solid\n// shadow edge, the move icon and the theme's selection fill; in hc also a bar at the inline start (selected-*\n// tokens). Never by colour alone, never like a verdict border. Dragged: above the rest.\nexport const chipStyles: CSSResultGroup = css`\n .chip {\n position: relative;\n max-inline-size: 100%;\n border: var(--astl-outline-width) solid var(--astl-outline);\n border-radius: var(--astl-radius-m);\n background: var(--astl-surface-raised);\n color: var(--astl-ink);\n hyphens: auto;\n transition:\n translate var(--astl-duration-fast),\n box-shadow var(--astl-duration-fast);\n }\n .chip:has(> button:hover:not(:disabled)) {\n background: var(--astl-accent-soft);\n }\n .chip > button {\n box-sizing: border-box;\n display: flex;\n align-items: center;\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: transparent;\n color: inherit;\n font: inherit;\n line-height: 1.4;\n text-align: start;\n cursor: grab;\n touch-action: manipulation;\n user-select: none;\n -webkit-user-select: none;\n -webkit-touch-callout: none;\n }\n .chip > button:disabled {\n cursor: default;\n }\n .move {\n flex: none;\n inline-size: 1.1em;\n block-size: 1.1em;\n color: var(--astl-selected);\n }\n .chip[data-picked] {\n border-color: var(--astl-selected);\n background: var(--astl-selected-soft);\n box-shadow: 0 var(--astl-space-1) 0 0 var(--astl-selected);\n translate: 0 calc(-1 * var(--astl-space-1));\n }\n .chip[data-picked]::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 .chip[data-dragging] {\n z-index: 1;\n box-shadow: 0 var(--astl-space-1) 0 0 var(--astl-outline);\n transition: none;\n }\n .chip[data-dragging] > button {\n cursor: grabbing;\n }\n @media (prefers-reduced-motion: reduce) {\n .chip {\n transition: none;\n }\n }\n`;\n"],"mappings":"A,0CAYA,IAAaC,EAA6B,CAAG"}
1
+ {"version":3,"file":"chip-styles--gboWK2Z.js","names":["i","chipStyles"],"sources":["../../../../components/src/chip-styles.ts"],"sourcesContent":["/**\n * Shared CSS of the chips students pick up and place, a `.chip` box around its button: the cards of categorise and\n * the words of the word bank. Imported only by them (one small chunk with their elements, none with the others). An\n * element lists it after its own rules and before `blockStyles`; to refine a rule here, it uses a more specific\n * selector.\n */\nimport { type CSSResultGroup, css } from 'lit';\n\n// The box carries the border and the ring; its button is the target. A long word hyphenates in its own language.\n// Touches on a chip scroll and zoom as usual (touch-action); a long press starts a drag. Picked: lifted with a solid\n// shadow edge, the move icon and the theme's selection fill; in hc also a bar at the inline start (selected-*\n// tokens). Never by colour alone, never like a verdict border. Dragged: above the rest.\nexport const chipStyles: CSSResultGroup = css`\n .chip {\n position: relative;\n max-inline-size: 100%;\n border: var(--astl-outline-width) solid var(--astl-outline);\n border-radius: var(--astl-radius-m);\n background: var(--astl-surface-raised);\n color: var(--astl-ink);\n hyphens: auto;\n transition:\n translate var(--astl-duration-fast),\n box-shadow var(--astl-duration-fast);\n }\n .chip:has(> button:hover:not(:disabled)) {\n background: var(--astl-accent-soft);\n }\n .chip > button {\n box-sizing: border-box;\n display: flex;\n align-items: center;\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: transparent;\n color: inherit;\n font: inherit;\n line-height: 1.4;\n text-align: start;\n cursor: grab;\n touch-action: manipulation;\n user-select: none;\n -webkit-user-select: none;\n -webkit-touch-callout: none;\n }\n .chip > button:disabled {\n cursor: default;\n }\n .move {\n flex: none;\n inline-size: 1.1em;\n block-size: 1.1em;\n color: var(--astl-selected);\n }\n .chip[data-picked] {\n border-color: var(--astl-selected);\n background: var(--astl-selected-soft);\n box-shadow: 0 var(--astl-space-1) 0 0 var(--astl-selected);\n translate: 0 calc(-1 * var(--astl-space-1));\n }\n .chip[data-picked]::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 .chip[data-dragging] {\n z-index: 1;\n box-shadow: 0 var(--astl-space-1) 0 0 var(--astl-outline);\n transition: none;\n }\n .chip[data-dragging] > button {\n cursor: grabbing;\n }\n @media (prefers-reduced-motion: reduce) {\n .chip {\n transition: none;\n }\n }\n`;\n"],"mappings":"A,0CAYA,IAAaC,EAA6B,CAAG"}
@@ -1,4 +1,4 @@
1
- import{C as e,E as t,b as n,h as r,hn as i,n as a,v as o,y as s}from"./runtime-DxAbpr3S.js";import{n as c,r as l,t as u}from"./choice-manifest-C-XahD7m.js";import{t as d}from"./live-jdiyYln2.js";import{t as f}from"./block-styles-CKo9x7Vt.js";import{t as p}from"./repeat-CY2W2URZ.js";import{t as m}from"./option-styles-WKzjKmCH.js";var h=`astl.choice`,g=[{namespace:h,locale:`en`,messages:c},{namespace:h,locale:`pl`,messages:u}],_=e=>[...e.querySelectorAll(`img`)].map(e=>e.alt).join(` `).trim(),v=class extends a{static manifest=l;static messages=g;static shadowRootOptions={...s.shadowRootOptions,delegatesFocus:!0,slotAssignment:`manual`};static properties={selected:{state:!0}};static styles=[t`
1
+ import{C as e,E as t,b as n,h as r,hn 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"./choice-manifest-C-XahD7m.js";import{t as d}from"./live-qnReIRtj.js";import{t as f}from"./block-styles-CCtSFM4j.js";import{t as p}from"./repeat-BDXokpxQ.js";import{t as m}from"./option-styles-B2sBX5Oz.js";var h=`astl.choice`,g=[{namespace:h,locale:`en`,messages:c},{namespace:h,locale:`pl`,messages:u}],_=e=>[...e.querySelectorAll(`img`)].map(e=>e.alt).join(` `).trim(),v=class extends a{static manifest=l;static messages=g;static shadowRootOptions={...s.shadowRootOptions,delegatesFocus:!0,slotAssignment:`manual`};static properties={selected:{state:!0}};static styles=[t`
2
2
  :host {
3
3
  --astl-choice-indent: calc(2 * var(--astl-space-3) + 1.25rem);
4
4
  }
@@ -133,4 +133,4 @@ margin-block: var(--astl-space-3) 0;
133
133
  ${r(`correct`)}<span class="astl-solution-label">${this.t(`ui.solutionMark`)}</span>
134
134
  </p>`:n}
135
135
  </div>`}#t(e,t){if(!this.disabled){if(this.multiple){let n=new Set(this.selected);t?n.add(e):n.delete(e),this.selected=n,this.emitChange({[e]:t?i:``})}else t&&(this.selected=new Set([e]),this.emitChange({[this.id]:e}))}}},y={manifest:l,element:v,messages:g};export{y as choiceElement};
136
- //# sourceMappingURL=choice-CExBvqKj.js.map
136
+ //# sourceMappingURL=choice-BSpB6LHl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"choice-CExBvqKj.js","names":["en","pl","LitElement","repeat","ifDefined","live","nothing","b","i$1","A","verdictIcon","FLAG_SELECTED","AstlElement","i","en_default","choiceManifest","pl_default","l","blockStyles","c","optionStyles","namespace","choiceUiMessages","pictureName","el","img","ChoiceElement","options","option","id","picked","known","next","value","answers","multiple","ui","#renderOption","index","checked","verdict","solution","correct","mark","describedBy","ref","name","#pick","event","choiceElement"],"sources":["../../../../components/src/choice/ui-messages.ts","../../../../components/src/choice/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.choice';\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 `choiceMessages` would put the authoring strings into the element's chunk.\n */\nexport const choiceUiMessages: readonly MessageCatalog[] = [\n { namespace, locale: 'en', messages: en },\n { namespace, locale: 'pl', messages: pl },\n];\n","import {\n type Answers,\n type ComponentManifest,\n FLAG_SELECTED,\n type MessageCatalog,\n type Units,\n} from '@astl/core';\nimport { AstlElement, type ElementRegistration, verdictIcon } from '@astl/player';\nimport {\n type CSSResultGroup,\n css,\n html,\n LitElement,\n nothing,\n type PropertyDeclarations,\n type TemplateResult,\n} from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { blockStyles } from '../block-styles.js';\nimport { optionStyles } from '../option-styles.js';\nimport { choiceManifest } from './manifest.js';\nimport { choiceUiMessages } from './ui-messages.js';\n\n/** The alt texts of an element's pictures. */\nconst pictureName = (el: Element): string =>\n [...el.querySelectorAll('img')]\n .map((img) => img.alt)\n .join(' ')\n .trim();\n\n/**\n * `<astl-choice>`: native radios (single) or checkboxes (`multiple`) in one shadow root, so the browser provides\n * the keyboard behaviour. The light-DOM `<astl-prompt>` and `<astl-option>` children are slotted manually and\n * never moved or changed. Variants (`list`, `cards`) change the layout only, in CSS.\n * Slots: single = the element id (answer: the picked option id); multiple = one flag per option id (`'true'`).\n */\nexport class ChoiceElement extends AstlElement {\n static override manifest: ComponentManifest = choiceManifest;\n static override messages: readonly MessageCatalog[] = choiceUiMessages;\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n slotAssignment: 'manual',\n };\n\n static override properties: PropertyDeclarations = {\n selected: { 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 // The indent is where the option text starts (label padding, control, gap): the solution mark lines up with it.\n css`\n :host {\n --astl-choice-indent: calc(2 * var(--astl-space-3) + 1.25rem);\n }\n .options {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-2);\n }\n `,\n // Row 1: the label (control + text) and the option's verdict icon, on the first line of the text. Row 2: the\n // solution line (block-styles.ts), under the text. Nothing wraps against the border.\n css`\n .option {\n position: relative;\n box-sizing: border-box;\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n grid-template-areas: 'label verdict' 'mark mark';\n align-items: start;\n column-gap: var(--astl-space-2);\n padding-inline-end: var(--astl-space-3);\n border: var(--astl-outline-width) solid var(--astl-outline);\n border-radius: var(--astl-radius-m);\n background: var(--astl-surface);\n overflow: clip;\n }\n `,\n // Cards: the same options as a grid of cards, as many columns as fit, equal heights per row. Same controls,\n // keyboard and verdict cues as the list. Tall tiles only where two or more fit side by side: in one column (a\n // phone) they keep the list's height, so a question does not grow to several screens. A picture takes a line of\n // its own, above the label written after it (the player's --astl-picture-display).\n css`\n :host([variant='cards']) .options {\n container-type: inline-size;\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));\n gap: var(--astl-space-3);\n }\n :host([variant='cards']) ::slotted(astl-option) {\n --astl-picture-display: block;\n }\n :host([variant='cards']) .option {\n grid-template-rows: 1fr auto;\n border-radius: var(--astl-radius-l);\n }\n :host([variant='cards']) label {\n align-self: stretch;\n padding-block: var(--astl-space-3);\n }\n :host([variant='cards']) .option > .astl-verdict {\n margin-block-start: var(--astl-space-3);\n }\n @container (inline-size >= 26.75rem) {\n :host([variant='cards']) label {\n min-block-size: calc(2 * var(--astl-target-min));\n }\n }\n `,\n // Selected: the fill and the bar of optionStyles; in hc also bold text (selected-weight).\n css`\n .option[data-selected] .text {\n font-weight: var(--astl-selected-weight);\n }\n label {\n grid-area: label;\n box-sizing: border-box;\n display: flex;\n align-items: flex-start;\n gap: var(--astl-space-3);\n min-block-size: var(--astl-target-min);\n padding-block: var(--astl-space-2);\n padding-inline-start: var(--astl-space-3);\n cursor: pointer;\n }\n `,\n // The painted controls of optionStyles, centred on the first line of the option text, not on the whole text, and\n // checkboxes. Their radius is capped: however round a theme or template makes corners, a checkbox never turns into\n // a radio's circle.\n css`\n .option input {\n margin-block-start: calc((1lh - 1.25rem) / 2);\n }\n input[type='checkbox'] {\n border-radius: min(var(--astl-radius-s), 0.375rem);\n }\n input[type='checkbox']:checked::before {\n content: '';\n inline-size: 0.8rem;\n block-size: 0.8rem;\n background: currentColor;\n clip-path: polygon(12% 50%, 0 63%, 38% 100%, 100% 22%, 86% 9%, 38% 72%);\n }\n input:disabled,\n input:disabled + .text {\n cursor: default;\n }\n .text {\n flex: 1;\n min-inline-size: 0;\n }\n .option > .astl-verdict {\n grid-area: verdict;\n block-size: 1lh;\n margin-block-start: var(--astl-space-2);\n }\n .mark-row {\n grid-area: mark;\n padding-block-end: var(--astl-space-2);\n padding-inline-start: var(--astl-choice-indent);\n }\n .group-verdict {\n margin-block: var(--astl-space-3) 0;\n }\n `,\n optionStyles,\n blockStyles,\n ];\n\n /** Picked option ids. */\n declare protected selected: ReadonlySet<string>;\n\n constructor() {\n super();\n this.selected = new Set();\n }\n\n get multiple(): boolean {\n return this.booleanAttribute('multiple');\n }\n\n /** `<astl-option>` children in rendered order: view order, or per attempt with `shuffle` and a seed. */\n get options(): readonly HTMLElement[] {\n const options = this.childElements('astl-option');\n return this.booleanAttribute('shuffle') ? this.shuffled(options) : options;\n }\n\n get slotIds(): readonly string[] {\n if (this.id === '') return [];\n return this.multiple ? this.options.map((option) => option.id) : [this.id];\n }\n\n getAnswers(): Answers {\n if (this.id === '') return {};\n if (this.multiple) return Object.fromEntries([...this.selected].map((id) => [id, FLAG_SELECTED]));\n const [picked] = this.selected;\n return picked === undefined ? {} : { [this.id]: picked };\n }\n\n setAnswers(answers: Answers): void {\n const known = new Set(this.options.map((option) => option.id));\n const next = new Set(this.selected);\n if (this.multiple) {\n for (const [id, value] of Object.entries(answers)) {\n if (!known.has(id)) continue;\n if (value === FLAG_SELECTED) next.add(id);\n else next.delete(id);\n }\n } else {\n const value = answers[this.id];\n if (value === undefined) return;\n next.clear();\n if (known.has(value)) next.add(value);\n }\n this.selected = next;\n }\n\n units(): Units {\n return { answered: this.selected.size > 0 ? 1 : 0, total: 1 };\n }\n\n protected override render(): TemplateResult {\n const multiple = this.multiple;\n const ui = this.uiLanguage;\n return html`<fieldset part=\"choice\">\n <legend part=\"prompt\">\n <slot data-tag=\"astl-prompt\"></slot>\n <span class=\"hint\" lang=${ui.lang}><bdi>${this.t(multiple ? 'ui.multiple' : 'ui.single')}</bdi></span>\n </legend>\n <div class=\"options\">\n ${repeat(\n this.options,\n (option) => option.id,\n (option, index) => this.#renderOption(option, index, multiple),\n )}\n </div>\n ${this.renderGroupVerdict()}\n </fieldset>`;\n }\n\n #renderOption(option: HTMLElement, index: number, multiple: boolean): TemplateResult {\n const id = option.id;\n const checked = this.selected.has(id);\n const verdict = checked ? this.slotVerdict(multiple ? id : this.id) : null;\n const solution = this.solution;\n const correct =\n solution !== null && (multiple ? solution[id] === FLAG_SELECTED : solution[this.id] === id);\n // One clear indicator: a correct pick already shows its \"correct\" verdict, so it needs no solution mark.\n const mark = correct && verdict !== 'correct';\n const ui = this.uiLanguage;\n const describedBy = [verdict === null ? '' : `verdict-${index}`, mark ? `solution-${index}` : '']\n .filter((ref) => ref !== '')\n .join(' ');\n // An option that shows only a picture is named by its alt text, as its label names it for screen readers:\n // checks that count only visible text in a label (axe's label-title-only) would miss it.\n const name = (option.textContent ?? '').trim() === '' ? pictureName(option) : '';\n return html`<div\n class=\"option astl-box astl-ring\"\n part=\"option\"\n data-verdict=${ifDefined(verdict ?? undefined)}\n ?data-selected=${checked}\n ?data-solution=${correct}\n >\n <label>\n <input\n part=\"control\"\n type=${multiple ? 'checkbox' : 'radio'}\n name=\"choice\"\n value=${id}\n .checked=${live(checked)}\n ?disabled=${this.disabled}\n aria-label=${name === '' ? nothing : name}\n aria-describedby=${describedBy === '' ? nothing : describedBy}\n @change=${(event: Event) => this.#pick(id, (event.target as HTMLInputElement).checked)}\n />\n <span class=\"text\"><slot data-option=${id}></slot></span>\n </label>\n ${this.renderVerdict(verdict, { hiddenWord: true, id: `verdict-${index}` })}\n ${\n mark\n ? html`<p class=\"mark-row astl-solution\" part=\"solution\" id=\"solution-${index}\" lang=${ui.lang} dir=${ui.dir}>\n ${verdictIcon('correct')}<span class=\"astl-solution-label\">${this.t('ui.solutionMark')}</span>\n </p>`\n : nothing\n }\n </div>`;\n }\n\n #pick(id: string, checked: boolean): void {\n if (this.disabled) return;\n if (this.multiple) {\n const next = new Set(this.selected);\n if (checked) next.add(id);\n else next.delete(id);\n this.selected = next;\n this.emitChange({ [id]: checked ? FLAG_SELECTED : '' });\n } else if (checked) {\n this.selected = new Set([id]);\n this.emitChange({ [this.id]: id });\n }\n }\n}\n\nexport const choiceElement: ElementRegistration = {\n manifest: choiceManifest,\n element: ChoiceElement,\n messages: choiceUiMessages,\n};\n"],"mappings":"A,2UAIA,IAAMqB,EAAY,cAMLC,EAA8C,CACzD,CAAE,YAAW,OAAQ,KAAM,SAAUtB,CAAG,EACxC,CAAE,YAAW,OAAQ,KAAM,SAAUC,CAAG,CAC1C,ECaMsB,EAAe,GACnB,CAAC,GAAGC,EAAG,iBAAiB,KAAK,CAAC,CAAC,CAC5B,IAAK,GAAQC,EAAI,GAAG,CAAC,CACrB,KAAK,GAAG,CAAC,CACT,KAAK,EAQGC,EAAb,cAAmCd,CAAY,CAC7C,OAAgB,SAA8BG,EAC9C,OAAgB,SAAsCO,EACtD,OAAgB,kBAAoC,CAClD,GAAGpB,EAAW,kBACd,eAAgB,GAChB,eAAgB,QAClB,EAEA,OAAgB,WAAmC,CACjD,SAAU,CAAE,MAAO,EAAK,CAC1B,EAGA,OAAgB,OAAyB,CAEvC,CAAG;;;;;;;;;EAYH,CAAG;;;;;;;;;;;;;;;EAoBH,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BH,CAAG;;;;;;;;;;;;;;;EAmBH,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCHkB,EACAF,CACF,EAKA,aAAc,CACZ,MAAM,EACN,KAAK,SAAW,IAAI,GACtB,CAEA,IAAI,UAAoB,CACtB,OAAO,KAAK,iBAAiB,UA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CAAoC,KAAK,EAAE,iBAAiB,EAAE;kBAEzFJ,EACL;WAEL,CAEA,GAAM,EAAY,EAAwB,CACxC,GAAI,MAAK,SACT,IAAI,KAAK,SAAU,CACjB,IAAM0B,EAAO,IAAI,IAAI,KAAK,QAAQ,EAC9BO,EAASP,EAAK,IAAIH,CAAE,EACnBG,EAAK,OAAOH,CAAE,EACnB,KAAK,SAAWG,EAChB,KAAK,WAAW,EAAGH,GAAKU,EAAU5B,EAAgB,EAAG,CAAC,CACxD,MAAW4B,IACT,KAAK,SAAW,IAAI,IAAI,CAACV,CAAE,CAAC,EAC5B,KAAK,WAAW,EAAG,KAAK,IAAKA,CAAG,CAAC,EACnC,CACF,CACF,EAEaoB,EAAqC,CAChD,SAAUlC,EACV,QAASW,EACT,SAAUJ,CACZ,E"}
1
+ {"version":3,"file":"choice-BSpB6LHl.js","names":["en","pl","LitElement","repeat","ifDefined","live","nothing","b","i$1","A","verdictIcon","FLAG_SELECTED","AstlElement","i","en_default","choiceManifest","pl_default","l","blockStyles","c","optionStyles","namespace","choiceUiMessages","pictureName","el","img","ChoiceElement","options","option","id","picked","known","next","value","answers","multiple","ui","#renderOption","index","checked","verdict","solution","correct","mark","describedBy","ref","name","#pick","event","choiceElement"],"sources":["../../../../components/src/choice/ui-messages.ts","../../../../components/src/choice/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.choice';\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 `choiceMessages` would put the authoring strings into the element's chunk.\n */\nexport const choiceUiMessages: readonly MessageCatalog[] = [\n { namespace, locale: 'en', messages: en },\n { namespace, locale: 'pl', messages: pl },\n];\n","import {\n type Answers,\n type ComponentManifest,\n FLAG_SELECTED,\n type MessageCatalog,\n type Units,\n} from '@astl/core';\nimport { AstlElement, type ElementRegistration, verdictIcon } from '@astl/player';\nimport {\n type CSSResultGroup,\n css,\n html,\n LitElement,\n nothing,\n type PropertyDeclarations,\n type TemplateResult,\n} from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { blockStyles } from '../block-styles.js';\nimport { optionStyles } from '../option-styles.js';\nimport { choiceManifest } from './manifest.js';\nimport { choiceUiMessages } from './ui-messages.js';\n\n/** The alt texts of an element's pictures. */\nconst pictureName = (el: Element): string =>\n [...el.querySelectorAll('img')]\n .map((img) => img.alt)\n .join(' ')\n .trim();\n\n/**\n * `<astl-choice>`: native radios (single) or checkboxes (`multiple`) in one shadow root, so the browser provides\n * the keyboard behaviour. The light-DOM `<astl-prompt>` and `<astl-option>` children are slotted manually and\n * never moved or changed. Variants (`list`, `cards`) change the layout only, in CSS.\n * Slots: single = the element id (answer: the picked option id); multiple = one flag per option id (`'true'`).\n */\nexport class ChoiceElement extends AstlElement {\n static override manifest: ComponentManifest = choiceManifest;\n static override messages: readonly MessageCatalog[] = choiceUiMessages;\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n slotAssignment: 'manual',\n };\n\n static override properties: PropertyDeclarations = {\n selected: { 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 // The indent is where the option text starts (label padding, control, gap): the solution mark lines up with it.\n css`\n :host {\n --astl-choice-indent: calc(2 * var(--astl-space-3) + 1.25rem);\n }\n .options {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-2);\n }\n `,\n // Row 1: the label (control + text) and the option's verdict icon, on the first line of the text. Row 2: the\n // solution line (block-styles.ts), under the text. Nothing wraps against the border.\n css`\n .option {\n position: relative;\n box-sizing: border-box;\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n grid-template-areas: 'label verdict' 'mark mark';\n align-items: start;\n column-gap: var(--astl-space-2);\n padding-inline-end: var(--astl-space-3);\n border: var(--astl-outline-width) solid var(--astl-outline);\n border-radius: var(--astl-radius-m);\n background: var(--astl-surface);\n overflow: clip;\n }\n `,\n // Cards: the same options as a grid of cards, as many columns as fit, equal heights per row. Same controls,\n // keyboard and verdict cues as the list. Tall tiles only where two or more fit side by side: in one column (a\n // phone) they keep the list's height, so a question does not grow to several screens. A picture takes a line of\n // its own, above the label written after it (the player's --astl-picture-display).\n css`\n :host([variant='cards']) .options {\n container-type: inline-size;\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));\n gap: var(--astl-space-3);\n }\n :host([variant='cards']) ::slotted(astl-option) {\n --astl-picture-display: block;\n }\n :host([variant='cards']) .option {\n grid-template-rows: 1fr auto;\n border-radius: var(--astl-radius-l);\n }\n :host([variant='cards']) label {\n align-self: stretch;\n padding-block: var(--astl-space-3);\n }\n :host([variant='cards']) .option > .astl-verdict {\n margin-block-start: var(--astl-space-3);\n }\n @container (inline-size >= 26.75rem) {\n :host([variant='cards']) label {\n min-block-size: calc(2 * var(--astl-target-min));\n }\n }\n `,\n // Selected: the fill and the bar of optionStyles; in hc also bold text (selected-weight).\n css`\n .option[data-selected] .text {\n font-weight: var(--astl-selected-weight);\n }\n label {\n grid-area: label;\n box-sizing: border-box;\n display: flex;\n align-items: flex-start;\n gap: var(--astl-space-3);\n min-block-size: var(--astl-target-min);\n padding-block: var(--astl-space-2);\n padding-inline-start: var(--astl-space-3);\n cursor: pointer;\n }\n `,\n // The painted controls of optionStyles, centred on the first line of the option text, not on the whole text, and\n // checkboxes. Their radius is capped: however round a theme or template makes corners, a checkbox never turns into\n // a radio's circle.\n css`\n .option input {\n margin-block-start: calc((1lh - 1.25rem) / 2);\n }\n input[type='checkbox'] {\n border-radius: min(var(--astl-radius-s), 0.375rem);\n }\n input[type='checkbox']:checked::before {\n content: '';\n inline-size: 0.8rem;\n block-size: 0.8rem;\n background: currentColor;\n clip-path: polygon(12% 50%, 0 63%, 38% 100%, 100% 22%, 86% 9%, 38% 72%);\n }\n input:disabled,\n input:disabled + .text {\n cursor: default;\n }\n .text {\n flex: 1;\n min-inline-size: 0;\n }\n .option > .astl-verdict {\n grid-area: verdict;\n block-size: 1lh;\n margin-block-start: var(--astl-space-2);\n }\n .mark-row {\n grid-area: mark;\n padding-block-end: var(--astl-space-2);\n padding-inline-start: var(--astl-choice-indent);\n }\n .group-verdict {\n margin-block: var(--astl-space-3) 0;\n }\n `,\n optionStyles,\n blockStyles,\n ];\n\n /** Picked option ids. */\n declare protected selected: ReadonlySet<string>;\n\n constructor() {\n super();\n this.selected = new Set();\n }\n\n get multiple(): boolean {\n return this.booleanAttribute('multiple');\n }\n\n /** `<astl-option>` children in rendered order: view order, or per attempt with `shuffle` and a seed. */\n get options(): readonly HTMLElement[] {\n const options = this.childElements('astl-option');\n return this.booleanAttribute('shuffle') ? this.shuffled(options) : options;\n }\n\n get slotIds(): readonly string[] {\n if (this.id === '') return [];\n return this.multiple ? this.options.map((option) => option.id) : [this.id];\n }\n\n getAnswers(): Answers {\n if (this.id === '') return {};\n if (this.multiple) return Object.fromEntries([...this.selected].map((id) => [id, FLAG_SELECTED]));\n const [picked] = this.selected;\n return picked === undefined ? {} : { [this.id]: picked };\n }\n\n setAnswers(answers: Answers): void {\n const known = new Set(this.options.map((option) => option.id));\n const next = new Set(this.selected);\n if (this.multiple) {\n for (const [id, value] of Object.entries(answers)) {\n if (!known.has(id)) continue;\n if (value === FLAG_SELECTED) next.add(id);\n else next.delete(id);\n }\n } else {\n const value = answers[this.id];\n if (value === undefined) return;\n next.clear();\n if (known.has(value)) next.add(value);\n }\n this.selected = next;\n }\n\n units(): Units {\n return { answered: this.selected.size > 0 ? 1 : 0, total: 1 };\n }\n\n protected override render(): TemplateResult {\n const multiple = this.multiple;\n const ui = this.uiLanguage;\n return html`<fieldset part=\"choice\">\n <legend part=\"prompt\">\n <slot data-tag=\"astl-prompt\"></slot>\n <span class=\"hint\" lang=${ui.lang}><bdi>${this.t(multiple ? 'ui.multiple' : 'ui.single')}</bdi></span>\n </legend>\n <div class=\"options\">\n ${repeat(\n this.options,\n (option) => option.id,\n (option, index) => this.#renderOption(option, index, multiple),\n )}\n </div>\n ${this.renderGroupVerdict()}\n </fieldset>`;\n }\n\n #renderOption(option: HTMLElement, index: number, multiple: boolean): TemplateResult {\n const id = option.id;\n const checked = this.selected.has(id);\n const verdict = checked ? this.slotVerdict(multiple ? id : this.id) : null;\n const solution = this.solution;\n const correct =\n solution !== null && (multiple ? solution[id] === FLAG_SELECTED : solution[this.id] === id);\n // One clear indicator: a correct pick already shows its \"correct\" verdict, so it needs no solution mark.\n const mark = correct && verdict !== 'correct';\n const ui = this.uiLanguage;\n const describedBy = [verdict === null ? '' : `verdict-${index}`, mark ? `solution-${index}` : '']\n .filter((ref) => ref !== '')\n .join(' ');\n // An option that shows only a picture is named by its alt text, as its label names it for screen readers:\n // checks that count only visible text in a label (axe's label-title-only) would miss it.\n const name = (option.textContent ?? '').trim() === '' ? pictureName(option) : '';\n return html`<div\n class=\"option astl-box astl-ring\"\n part=\"option\"\n data-verdict=${ifDefined(verdict ?? undefined)}\n ?data-selected=${checked}\n ?data-solution=${correct}\n >\n <label>\n <input\n part=\"control\"\n type=${multiple ? 'checkbox' : 'radio'}\n name=\"choice\"\n value=${id}\n .checked=${live(checked)}\n ?disabled=${this.disabled}\n aria-label=${name === '' ? nothing : name}\n aria-describedby=${describedBy === '' ? nothing : describedBy}\n @change=${(event: Event) => this.#pick(id, (event.target as HTMLInputElement).checked)}\n />\n <span class=\"text\"><slot data-option=${id}></slot></span>\n </label>\n ${this.renderVerdict(verdict, { hiddenWord: true, id: `verdict-${index}` })}\n ${\n mark\n ? html`<p class=\"mark-row astl-solution\" part=\"solution\" id=\"solution-${index}\" lang=${ui.lang} dir=${ui.dir}>\n ${verdictIcon('correct')}<span class=\"astl-solution-label\">${this.t('ui.solutionMark')}</span>\n </p>`\n : nothing\n }\n </div>`;\n }\n\n #pick(id: string, checked: boolean): void {\n if (this.disabled) return;\n if (this.multiple) {\n const next = new Set(this.selected);\n if (checked) next.add(id);\n else next.delete(id);\n this.selected = next;\n this.emitChange({ [id]: checked ? FLAG_SELECTED : '' });\n } else if (checked) {\n this.selected = new Set([id]);\n this.emitChange({ [this.id]: id });\n }\n }\n}\n\nexport const choiceElement: ElementRegistration = {\n manifest: choiceManifest,\n element: ChoiceElement,\n messages: choiceUiMessages,\n};\n"],"mappings":"A,2UAIA,IAAMqB,EAAY,cAMLC,EAA8C,CACzD,CAAE,YAAW,OAAQ,KAAM,SAAUtB,CAAG,EACxC,CAAE,YAAW,OAAQ,KAAM,SAAUC,CAAG,CAC1C,ECaMsB,EAAe,GACnB,CAAC,GAAGC,EAAG,iBAAiB,KAAK,CAAC,CAAC,CAC5B,IAAK,GAAQC,EAAI,GAAG,CAAC,CACrB,KAAK,GAAG,CAAC,CACT,KAAK,EAQGC,EAAb,cAAmCd,CAAY,CAC7C,OAAgB,SAA8BG,EAC9C,OAAgB,SAAsCO,EACtD,OAAgB,kBAAoC,CAClD,GAAGpB,EAAW,kBACd,eAAgB,GAChB,eAAgB,QAClB,EAEA,OAAgB,WAAmC,CACjD,SAAU,CAAE,MAAO,EAAK,CAC1B,EAGA,OAAgB,OAAyB,CAEvC,CAAG;;;;;;;;;EAYH,CAAG;;;;;;;;;;;;;;;EAoBH,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BH,CAAG;;;;;;;;;;;;;;;EAmBH,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCHkB,EACAF,CACF,EAKA,aAAc,CACZ,MAAM,EACN,KAAK,SAAW,IAAI,GACtB,CAEA,IAAI,UAAoB,CACtB,OAAO,KAAK,iBAAiB,UAAU,CACzC,CAGA,IAAI,SAAkC,CACpC,IAAMS,EAAU,KAAK,cAAc,aAAa,EAChD,OAAO,KAAK,iBAAiB,SAAS,EAAI,KAAK,SAASA,CAAO,EAAIA,CACrE,CAEA,IAAI,SAA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I,KAAK,QAAQ,EAC9BO,EAASP,EAAK,IAAIH,CAAE,EACnBG,EAAK,OAAOH,CAAE,EACnB,KAAK,SAAWG,EAChB,KAAK,WAAW,EAAGH,GAAKU,EAAU5B,EAAgB,EAAG,CAAC,CACxD,MAAW4B,IACT,KAAK,SAAW,IAAI,IAAI,CAACV,CAAE,CAAC,EAC5B,KAAK,WAAW,EAAG,KAAK,IAAKA,CAAG,CAAC,EACnC,CACF,CACF,EAEaoB,EAAqC,CAChD,SAAUlC,EACV,QAASW,EACT,SAAUJ,CACZ,E"}
@@ -1,4 +1,4 @@
1
- import{C as e,D as t,E as n,b as r}from"./runtime-DxAbpr3S.js";import{u as i}from"./declarations-BhqOz1ap.js";var a=Array.from({length:8},(e,t)=>t+1),o=n`
1
+ import{C as e,D as t,E as n,b as r}from"./runtime-C25QK5B0.js";import{u as i}from"./declarations-BhqOz1ap.js";var a=Array.from({length:8},(e,t)=>t+1),o=n`
2
2
  .swatches {
3
3
  display: grid;
4
4
  grid-template-columns: repeat(4, minmax(var(--astl-target-min), 1fr));
@@ -88,4 +88,4 @@ import{C as e,D as t,E as n,b as r}from"./runtime-DxAbpr3S.js";import{u as i}fro
88
88
  <button type="button" class="color-none" aria-disabled=${i===null?`true`:r} @click=${()=>{i!==null&&t.pick(null)}}>
89
89
  ${o(`style.color.none`)}
90
90
  </button>`}export{o as n,l as t};
91
- //# sourceMappingURL=color-control-Cl5cuMSO.js.map
91
+ //# sourceMappingURL=color-control-1kkdM8ns.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"color-control-Cl5cuMSO.js","names":["unsafeCSS","nothing","b","r","i","A","parseStyleColor","PALETTE","colorStyles","n","hexOf","parsed","value","channel","typedColor","match","text","colorControl","control","hex","swatch","ground","t","id","event","invalid","typed"],"sources":["../../../../editor/src/elements/color-control.ts"],"sourcesContent":["import { parseStyleColor } from '@astl/core/declarations';\nimport { type CSSResult, css, html, nothing, type TemplateResult, unsafeCSS } from 'lit';\nimport { PALETTE_SIZE } from '../style-model.js';\n\nconst PALETTE = Array.from({ length: PALETTE_SIZE }, (_, i) => i + 1);\n\n/** The theme's colours first, each its own token: an author's colour that follows the theme by itself. */\nexport const colorStyles: CSSResult = css`\n .swatches {\n display: grid;\n grid-template-columns: repeat(4, minmax(var(--astl-target-min), 1fr));\n gap: var(--astl-space-1);\n max-inline-size: 16rem;\n }\n button.swatch {\n position: relative;\n justify-content: center;\n padding: 0;\n border-color: var(--astl-outline);\n forced-color-adjust: none;\n }\n button.swatch[aria-pressed='true'] {\n outline: var(--astl-focus-width) solid var(--astl-ink);\n outline-offset: calc(-1 * var(--astl-focus-width));\n }\n button.swatch[aria-pressed='true']::after {\n content: '';\n inline-size: 0.5rem;\n block-size: 0.5rem;\n border-radius: 50%;\n border: var(--astl-outline-width) solid var(--astl-ink);\n background: var(--astl-surface);\n }\n .custom {\n display: grid;\n grid-template-columns: var(--astl-target-min) minmax(0, 1fr);\n gap: var(--astl-space-2);\n align-items: end;\n margin-block-start: var(--astl-space-2);\n }\n .custom label {\n display: block;\n grid-column: 1 / -1;\n font-weight: 600;\n }\n .custom input[type='color'] {\n padding: var(--astl-outline-width);\n }\n .color-none {\n margin-block-start: var(--astl-space-2);\n }\n .color-error {\n margin: var(--astl-space-2) 0 0;\n padding: var(--astl-space-2);\n border-inline-start: var(--astl-space-1) solid var(--astl-danger);\n background: var(--astl-danger-soft);\n }\n ${unsafeCSS(\n PALETTE.flatMap((n) => [\n `button.swatch[data-n='${n}'] { background: var(--astl-palette-${n}); }`,\n `button.swatch[data-n='${n}'][data-soft] { background: var(--astl-palette-${n}-soft); }`,\n ]).join('\\n'),\n )}\n`;\n\n/** A colour as `#rrggbb`, or null for what has no such form (a theme's colour); alpha left out. */\nfunction hexOf(value: string | null | undefined): string | null {\n const parsed = value === null || value === undefined ? null : parseStyleColor(value);\n if (parsed === null) return null;\n const channel = (n: number) => Math.round(n).toString(16).padStart(2, '0');\n return `#${channel(parsed[0])}${channel(parsed[1])}${channel(parsed[2])}`;\n}\n\n/** What a typed colour comes to: `#rrggbb` or `#rgb`, the `#` optional; null: not a colour. */\nconst typedColor = (text: string): string | null => {\n const match = /^#?([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(text.trim());\n return match === null ? null : `#${(match[1] as string).toLowerCase()}`;\n};\n\nexport interface ColorControl {\n /** Prefix of the control's ids, unique in its root. */\n readonly id: string;\n /** The colour now, as a style holds it, or null. */\n readonly value: string | null;\n /** A message of the kit. */\n readonly t: (key: string, params?: Record<string, string | number>) => string;\n /** Set when the last typed colour was refused. */\n readonly invalid: boolean;\n /** A colour text goes on (a background, a highlight): the palette's soft forms, which it stays legible on. */\n readonly ground?: boolean;\n /** A colour was picked (`value`), or removed (null). */\n pick(value: string | null): void;\n /** The typed colour was refused: say so on the next render. */\n refuse(): void;\n}\n\n/**\n * Picks a colour: the theme's palette, then a custom one with the native picker and a hex field, then none. Colours\n * apply when committed (`change`): a picker's drag would otherwise be an undo step per move.\n */\nexport function colorControl(control: ColorControl): TemplateResult {\n const { id, value, t, invalid, ground = false } = control;\n const hex = hexOf(value);\n const swatch = (n: number) => `var(--astl-palette-${n}${ground ? '-soft' : ''})`;\n return html`<div class=\"swatches\" role=\"group\" aria-label=${t('style.color.theme')}>\n ${PALETTE.map(\n (n) => html`<button\n type=\"button\"\n class=\"swatch\"\n data-n=${n}\n ?data-soft=${ground}\n data-color=${swatch(n)}\n title=${t('style.color.swatch', { n })}\n aria-label=${t('style.color.swatch', { n })}\n aria-pressed=${String(value === swatch(n))}\n @click=${() => control.pick(swatch(n))}\n ></button>`,\n )}\n </div>\n <div class=\"custom\">\n <label for=\"${id}-hex\">${t('style.color.custom')}</label>\n <input\n type=\"color\"\n aria-label=${t('style.color.picker')}\n .value=${hex ?? '#000000'}\n @change=${(event: Event) => control.pick((event.target as HTMLInputElement).value)}\n />\n <input\n id=\"${id}-hex\"\n type=\"text\"\n spellcheck=\"false\"\n autocomplete=\"off\"\n placeholder=\"#rrggbb\"\n .value=${hex ?? ''}\n aria-invalid=${invalid ? 'true' : nothing}\n aria-describedby=${invalid ? `${id}-error` : nothing}\n @change=${(event: Event) => {\n const text = (event.target as HTMLInputElement).value;\n const typed = typedColor(text);\n if (typed !== null) control.pick(typed);\n else if (text.trim() === '') control.pick(null);\n else control.refuse();\n }}\n @keydown=${(event: KeyboardEvent) => {\n // In a popup, Enter must commit like a change, not leave a half-typed colour behind.\n if (event.key === 'Enter') {\n event.preventDefault();\n (event.target as HTMLInputElement).dispatchEvent(new Event('change', { bubbles: true }));\n }\n }}\n />\n </div>\n <div role=\"alert\">${invalid ? html`<p class=\"color-error\" id=\"${id}-error\">${t('style.color.invalid')}</p>` : nothing}</div>\n <button type=\"button\" class=\"color-none\" aria-disabled=${value === null ? 'true' : nothing} @click=${() => {\n if (value !== null) control.pick(null);\n }}>\n ${t('style.color.none')}\n </button>`;\n}\n"],"mappings":"A,8GAIA,IAAMO,EAAU,MAAM,KAAK,CAAE,OAAA,CAAqB,GAAI,EAAG,IAAMH,EAAI,CAAC,EAGvDI,EAAyB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkDrCR,EACAO,EAAQ,QAAS,GAAM,CACrB,yBAAyBE,EAAE,sCAAsCA,EAAE,MACnE,yBAAyBA,EAAE,iDAAiDA,EAAE,UAChF,CAAC,CAAC,CAAC,KAAK;CAAI,CACd,EAAE;EAIJ,SAASC,EAAM,EAAiD,CAC9D,IAAMC,EAASC,GAAU,KAA8B,KAAON,EAAgBM,CAAK,EACnF,GAAID,IAAW,KAAM,OAAO,KAC5B,IAAME,EAAW,GAAc,KAAK,MAAMJ,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,EAAG,GAAG,EACzE,MAAO,IAAII,EAAQF,EAAO,EAAE,IAAIE,EAAQF,EAAO,EAAE,IAAIE,EAAQF,EAAO,EAAE,GACxE,CAGA,IAAMG,EAAc,GAAgC,CAClD,IAAMC,EA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AE;;;wBAGcC,EAAU,CAAI,8BAA8BF,EAAG,UAAUD,EAAE,qBAAqB,EAAE,MAAQrB,EAAQ;6DAC7DW,IAAU,KAAO,OAASX,EAAQ,cAAgB,CACrGW,IAAU,MAAMM,EAAQ,KAAK,IAAI,CACvC,EAAE;QACEI,EAAE,kBAAkB,EAAE;cAE9B,C"}
1
+ {"version":3,"file":"color-control-1kkdM8ns.js","names":["unsafeCSS","nothing","b","r","i","A","parseStyleColor","PALETTE","colorStyles","n","hexOf","parsed","value","channel","typedColor","match","text","colorControl","control","hex","swatch","ground","t","id","event","invalid","typed"],"sources":["../../../../editor/src/elements/color-control.ts"],"sourcesContent":["import { parseStyleColor } from '@astl/core/declarations';\nimport { type CSSResult, css, html, nothing, type TemplateResult, unsafeCSS } from 'lit';\nimport { PALETTE_SIZE } from '../style-model.js';\n\nconst PALETTE = Array.from({ length: PALETTE_SIZE }, (_, i) => i + 1);\n\n/** The theme's colours first, each its own token: an author's colour that follows the theme by itself. */\nexport const colorStyles: CSSResult = css`\n .swatches {\n display: grid;\n grid-template-columns: repeat(4, minmax(var(--astl-target-min), 1fr));\n gap: var(--astl-space-1);\n max-inline-size: 16rem;\n }\n button.swatch {\n position: relative;\n justify-content: center;\n padding: 0;\n border-color: var(--astl-outline);\n forced-color-adjust: none;\n }\n button.swatch[aria-pressed='true'] {\n outline: var(--astl-focus-width) solid var(--astl-ink);\n outline-offset: calc(-1 * var(--astl-focus-width));\n }\n button.swatch[aria-pressed='true']::after {\n content: '';\n inline-size: 0.5rem;\n block-size: 0.5rem;\n border-radius: 50%;\n border: var(--astl-outline-width) solid var(--astl-ink);\n background: var(--astl-surface);\n }\n .custom {\n display: grid;\n grid-template-columns: var(--astl-target-min) minmax(0, 1fr);\n gap: var(--astl-space-2);\n align-items: end;\n margin-block-start: var(--astl-space-2);\n }\n .custom label {\n display: block;\n grid-column: 1 / -1;\n font-weight: 600;\n }\n .custom input[type='color'] {\n padding: var(--astl-outline-width);\n }\n .color-none {\n margin-block-start: var(--astl-space-2);\n }\n .color-error {\n margin: var(--astl-space-2) 0 0;\n padding: var(--astl-space-2);\n border-inline-start: var(--astl-space-1) solid var(--astl-danger);\n background: var(--astl-danger-soft);\n }\n ${unsafeCSS(\n PALETTE.flatMap((n) => [\n `button.swatch[data-n='${n}'] { background: var(--astl-palette-${n}); }`,\n `button.swatch[data-n='${n}'][data-soft] { background: var(--astl-palette-${n}-soft); }`,\n ]).join('\\n'),\n )}\n`;\n\n/** A colour as `#rrggbb`, or null for what has no such form (a theme's colour); alpha left out. */\nfunction hexOf(value: string | null | undefined): string | null {\n const parsed = value === null || value === undefined ? null : parseStyleColor(value);\n if (parsed === null) return null;\n const channel = (n: number) => Math.round(n).toString(16).padStart(2, '0');\n return `#${channel(parsed[0])}${channel(parsed[1])}${channel(parsed[2])}`;\n}\n\n/** What a typed colour comes to: `#rrggbb` or `#rgb`, the `#` optional; null: not a colour. */\nconst typedColor = (text: string): string | null => {\n const match = /^#?([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(text.trim());\n return match === null ? null : `#${(match[1] as string).toLowerCase()}`;\n};\n\nexport interface ColorControl {\n /** Prefix of the control's ids, unique in its root. */\n readonly id: string;\n /** The colour now, as a style holds it, or null. */\n readonly value: string | null;\n /** A message of the kit. */\n readonly t: (key: string, params?: Record<string, string | number>) => string;\n /** Set when the last typed colour was refused. */\n readonly invalid: boolean;\n /** A colour text goes on (a background, a highlight): the palette's soft forms, which it stays legible on. */\n readonly ground?: boolean;\n /** A colour was picked (`value`), or removed (null). */\n pick(value: string | null): void;\n /** The typed colour was refused: say so on the next render. */\n refuse(): void;\n}\n\n/**\n * Picks a colour: the theme's palette, then a custom one with the native picker and a hex field, then none. Colours\n * apply when committed (`change`): a picker's drag would otherwise be an undo step per move.\n */\nexport function colorControl(control: ColorControl): TemplateResult {\n const { id, value, t, invalid, ground = false } = control;\n const hex = hexOf(value);\n const swatch = (n: number) => `var(--astl-palette-${n}${ground ? '-soft' : ''})`;\n return html`<div class=\"swatches\" role=\"group\" aria-label=${t('style.color.theme')}>\n ${PALETTE.map(\n (n) => html`<button\n type=\"button\"\n class=\"swatch\"\n data-n=${n}\n ?data-soft=${ground}\n data-color=${swatch(n)}\n title=${t('style.color.swatch', { n })}\n aria-label=${t('style.color.swatch', { n })}\n aria-pressed=${String(value === swatch(n))}\n @click=${() => control.pick(swatch(n))}\n ></button>`,\n )}\n </div>\n <div class=\"custom\">\n <label for=\"${id}-hex\">${t('style.color.custom')}</label>\n <input\n type=\"color\"\n aria-label=${t('style.color.picker')}\n .value=${hex ?? '#000000'}\n @change=${(event: Event) => control.pick((event.target as HTMLInputElement).value)}\n />\n <input\n id=\"${id}-hex\"\n type=\"text\"\n spellcheck=\"false\"\n autocomplete=\"off\"\n placeholder=\"#rrggbb\"\n .value=${hex ?? ''}\n aria-invalid=${invalid ? 'true' : nothing}\n aria-describedby=${invalid ? `${id}-error` : nothing}\n @change=${(event: Event) => {\n const text = (event.target as HTMLInputElement).value;\n const typed = typedColor(text);\n if (typed !== null) control.pick(typed);\n else if (text.trim() === '') control.pick(null);\n else control.refuse();\n }}\n @keydown=${(event: KeyboardEvent) => {\n // In a popup, Enter must commit like a change, not leave a half-typed colour behind.\n if (event.key === 'Enter') {\n event.preventDefault();\n (event.target as HTMLInputElement).dispatchEvent(new Event('change', { bubbles: true }));\n }\n }}\n />\n </div>\n <div role=\"alert\">${invalid ? html`<p class=\"color-error\" id=\"${id}-error\">${t('style.color.invalid')}</p>` : nothing}</div>\n <button type=\"button\" class=\"color-none\" aria-disabled=${value === null ? 'true' : nothing} @click=${() => {\n if (value !== null) control.pick(null);\n }}>\n ${t('style.color.none')}\n </button>`;\n}\n"],"mappings":"A,8GAIA,IAAMO,EAAU,MAAM,KAAK,CAAE,OAAA,CAAqB,GAAI,EAAG,IAAMH,EAAI,CAAC,EAGvDI,EAAyB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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BD,EAAQ,KAAMM,EAAM,OAA4B,KAAK,EAAE;;;cAG7ED,EAAG;;;;;iBAKAJ,GAAO,GAAG;uBACJM,EAAU,OAASxB,EAAQ;2BACvBwB,EAAU,GAAGF,EAAG,QAAUtB,EAAQ;kBAC1C,GAAiB,CAC1B,IAAMe,EAAQQ,EAAM,OAA4B,MAC1CE,EAAQZ,EAAWE,CAAI,EACzBU,IAAU,KACLV,EAAK,KAAK,IAAM,GAAIE,EAAQ,KAAK,IAAI,EACzCA,EAAQ,OAAO,EAFAA,EAAQ,KAAKQ,CAAK,CAGxC,EAAE;mBACU,GAAyB,CAE/BF,EAAM,MAAQ,UAChBA,EAAM,eAAe,EACrBA,EAAO,OAA4B,cAAc,IAAI,MAAM,SAAU,CAAE,QAAS,EAAK,CAAC,CAAC,EAE3F,EAAE;;;wBAGcC,EAAU,CAAI,8BAA8BF,EAAG,UAAUD,EAAE,qBAAqB,EAAE,MAAQrB,EAAQ;6DAC7DW,IAAU,KAAO,OAASX,EAAQ,cAAgB,CACrGW,IAAU,MAAMM,EAAQ,KAAK,IAAI,CACvC,EAAE;QACEI,EAAE,kBAAkB,EAAE;cAE9B,C"}
@@ -1,4 +1,4 @@
1
- import{C as e,E as t,b as n,h as r,n as i,v as a,y as o}from"./runtime-DxAbpr3S.js";import{a as s,n as c,r as l,t as u}from"./crossword-manifest-2qlu7AYd.js";import{t as d}from"./live-jdiyYln2.js";import{t as f}from"./keys-DU-Qknmz.js";import{t as p}from"./roving-focus-BxGgi2DD.js";import{t as m}from"./block-styles-CKo9x7Vt.js";var h=`astl.crossword`,g=[{namespace:h,locale:`en`,messages:c},{namespace:h,locale:`pl`,messages:u}],_=/^\p{L}$/u,v=e=>e===`across`?`down`:`across`,y=e=>[e.textContent??``,...[...e.querySelectorAll(`img`)].map(e=>e.alt)].join(` `).replace(/\s+/g,` `).trim(),b=class extends i{static manifest=l;static messages=g;static shadowRootOptions={...o.shadowRootOptions,slotAssignment:`manual`};static properties={letters:{state:!0},direction:{state:!0}};static styles=[t`
1
+ import{C as e,E as t,b as n,h as r,n as i,v as a,y as o}from"./runtime-C25QK5B0.js";import{a as s,n as c,r as l,t as u}from"./crossword-manifest-2qlu7AYd.js";import{t as d}from"./live-qnReIRtj.js";import{t as f}from"./keys-DU-Qknmz.js";import{t as p}from"./roving-focus-BxGgi2DD.js";import{t as m}from"./block-styles-CCtSFM4j.js";var h=`astl.crossword`,g=[{namespace:h,locale:`en`,messages:c},{namespace:h,locale:`pl`,messages:u}],_=/^\p{L}$/u,v=e=>e===`across`?`down`:`across`,y=e=>[e.textContent??``,...[...e.querySelectorAll(`img`)].map(e=>e.alt)].join(` `).replace(/\s+/g,` `).trim(),b=class extends i{static manifest=l;static messages=g;static shadowRootOptions={...o.shadowRootOptions,slotAssignment:`manual`};static properties={letters:{state:!0},direction:{state:!0}};static styles=[t`
2
2
  .board {
3
3
  --astl-cw-edge: calc(var(--astl-focus-width) + var(--astl-focus-offset) + var(--astl-outline-width));
4
4
  display: flex;
@@ -267,4 +267,4 @@ margin-block: var(--astl-space-3) 0;
267
267
  <bdi lang=${a(this.contentLang||void 0)}>${u}</bdi>
268
268
  </p>`}
269
269
  </li>`}get#s(){return this.numberAttribute(`rows`)??0}get#c(){return this.numberAttribute(`columns`)??0}get#l(){return this.#u.words}get#u(){if(this.#e!==null)return this.#e;let e=this.#s,t=this.#c,n=this.childElements(`astl-crossword-word`).map(n=>{let r={row:Number(n.getAttribute(`row`)),column:Number(n.getAttribute(`column`)),direction:n.getAttribute(`direction`)===`down`?`down`:`across`,length:Number(n.getAttribute(`length`))},i=s(r).filter(([n,r])=>n>=0&&n<e&&r>=0&&r<t).map(([e,n])=>e*t+n);return{id:n.id,el:n,number:Number(n.getAttribute(`number`)),direction:r.direction,squares:i}}),r=new Map;for(let e of n)for(let t of e.squares)r.set(t,{...r.get(t),[e.direction]:e});let i=(this.getAttribute(`cells`)??``).split(` `).filter(Boolean),a=[...r.keys()].sort((e,t)=>e-t),o=new Map(a.flatMap((e,t)=>i[t]===void 0?[]:[[e,i[t]]]));return this.#e={rows:e,columns:t,words:n,slots:o,through:r},this.#e}#d(e){return this.#u.slots.get(e)??``}get#f(){let e=this.#u.through.get(this.#r.active)??{};return e[this.direction]??e[v(this.direction)]??null}get#p(){let e=this.#u.through.get(this.#r.active)??{},t=this.#f;return t===null?null:e[v(t.direction)]??null}#m(e){let{number:t,direction:n}=e;return this.t(`ui.current`,{number:t,direction:n,length:e.squares.length,clue:y(e.el)})}#h(e,t){let{number:n,direction:r,squares:i}=e;return this.t(`ui.cell`,{number:n,direction:r,position:i.indexOf(t)+1,length:i.length})}#g(e){try{return e.toLocaleUpperCase(this.contentLang||void 0)}catch{return e.toUpperCase()}}#_(e){let t=this.feedback;if(t===null)return null;let n=t.groups?.[e.id];return n===void 0?t.group===null?null:e.squares.every(e=>!this.letters.has(this.#d(e)))?`empty`:Object.keys(t.slots).length===0?null:e.squares.every(e=>t.slots[this.#d(e)]===`correct`)?`correct`:`incorrect`:n}#v(e){let t=this.#d(e);return this.letters.has(t)?this.slotVerdict(t):null}#y(e){let t=this.solution;if(t===null)return null;let n=e.squares.map(e=>t[this.#d(e)]??``);return n.every((t,n)=>t===this.letters.get(this.#d(e.squares[n]??-1)))?null:n.join(``)}#b(e,t=this.direction){let n=this.#u.through.get(e)??{};this.direction=n[t]===void 0?v(t):t,this.#r.focus(e);let r=this.#f;r!==null&&r.id!==this.#t&&(this.#t=r.id,this.announce(this.#m(r)))}#x(e){let t=e.squares.find(e=>!this.letters.has(this.#d(e)));this.#b(t??e.squares[0]??0,e.direction)}#S(e){let t=this.#f?.squares??[];return t[t.indexOf(this.#r.active)+e]??null}#C(e,t){let n=this.#d(e);if((this.letters.get(n)??``)===t)return;let r=new Map(this.letters);t===``?r.delete(n):r.set(n,t),this.letters=r,this.emitChange({[n]:t})}#w(e){let t=e.target.dataset.cell;return t===void 0?null:Number(t)}#T(e){let t=this.#w(e);t!==null&&(e.target.select(),(t!==this.#r.active||this.#f?.id!==this.#t)&&this.#b(t))}#E(e){let t=this.#w(e);this.#n=t===this.#r.active&&this.shadowRoot?.activeElement===e.target}#D(e){let t=this.#w(e);t!==null&&this.#n&&(this.#n=!1,this.#b(t,v(this.direction)))}#O(e){let t=this.#w(e);if(t===null||this.disabled)return;let n=e.target;if(e.inputType.startsWith(`delete`)){this.#C(t,``);return}let r=[...(e.data??n.value).normalize(`NFC`)].reverse().find(e=>_.test(e));r!==void 0&&this.#C(t,this.#g(r)),n.value=this.letters.get(this.#d(t))??``;let i=r===void 0?null:this.#S(1);i!==null&&this.#b(i,this.#f?.direction)}#k(e){let t=this.#w(e);if(t===null||e.altKey||e.ctrlKey||e.metaKey)return;let n=e.key;if(n===`Tab`||n===`Enter`){let t=this.#f,r=this.#l[(t===null?-1:this.#l.indexOf(t))+(e.shiftKey?-1:1)];if(r===void 0&&n===`Tab`)return;e.preventDefault(),r!==void 0&&this.#x(r)}else if(n===` `)e.preventDefault(),this.#b(t,v(this.direction));else if(n===`Backspace`){if(e.preventDefault(),this.disabled)return;let n=this.#S(-1);this.letters.has(this.#d(t))||n===null?this.#C(t,``):(this.#C(n,``),this.#b(n,this.#f?.direction))}else this.#A(e,t)}#A(e,t){let n=f(e,`inline`,this),r=f(e,`block`,this);if(n===0&&r===0)return;e.preventDefault();let i=n===0?`down`:`across`,a=this.#u.through.get(t)??{};if(i!==this.direction&&a[i]!==void 0){this.#b(t,i);return}let{rows:o,columns:s,slots:c}=this.#u,[l,u]=[Math.floor(t/s),t%s];for(;;){if(l+=r,u+=n,l<0||l>=o||u<0||u>=s)return;if(c.has(l*s+u))break}this.#b(l*s+u,i)}},x={manifest:l,element:b,messages:g};export{x as crosswordElement};
270
- //# sourceMappingURL=crossword-Cb-a3Tjj.js.map
270
+ //# sourceMappingURL=crossword-BdOAEPcL.js.map