@astl/astrolabe 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +119 -0
- package/LICENSE +202 -0
- package/README.md +64 -2
- package/dist/cdn/astrolabe-editor.js +1441 -0
- package/dist/cdn/astrolabe-editor.js.map +1 -0
- package/dist/cdn/astrolabe-player.js +2 -0
- package/dist/cdn/astrolabe-player.js.map +1 -0
- package/dist/cdn/astrolabe.css +238 -0
- package/dist/cdn/astrolabe.js +3 -0
- package/dist/cdn/astrolabe.js.map +1 -0
- package/dist/cdn/astrolabe.standalone.js +8007 -0
- package/dist/cdn/chunks/audio-B0LSIn5N.js +48 -0
- package/dist/cdn/chunks/audio-B0LSIn5N.js.map +1 -0
- package/dist/cdn/chunks/audio-manifest-B9FWQzRy.js +2 -0
- package/dist/cdn/chunks/audio-manifest-B9FWQzRy.js.map +1 -0
- package/dist/cdn/chunks/block-styles-CKo9x7Vt.js +68 -0
- package/dist/cdn/chunks/block-styles-CKo9x7Vt.js.map +1 -0
- package/dist/cdn/chunks/book-CHzDDaim.js +15 -0
- package/dist/cdn/chunks/book-CHzDDaim.js.map +1 -0
- package/dist/cdn/chunks/callout-QFLFLPc5.js +49 -0
- package/dist/cdn/chunks/callout-QFLFLPc5.js.map +1 -0
- package/dist/cdn/chunks/callout-manifest-Cb12O4jl.js +2 -0
- package/dist/cdn/chunks/callout-manifest-Cb12O4jl.js.map +1 -0
- package/dist/cdn/chunks/categorise-BO2tNVJ3.js +203 -0
- package/dist/cdn/chunks/categorise-BO2tNVJ3.js.map +1 -0
- package/dist/cdn/chunks/categorise-manifest-C_hEDVYQ.js +2 -0
- package/dist/cdn/chunks/categorise-manifest-C_hEDVYQ.js.map +1 -0
- package/dist/cdn/chunks/chip-styles-Dme5daTO.js +77 -0
- package/dist/cdn/chunks/chip-styles-Dme5daTO.js.map +1 -0
- package/dist/cdn/chunks/choice-CExBvqKj.js +136 -0
- package/dist/cdn/chunks/choice-CExBvqKj.js.map +1 -0
- package/dist/cdn/chunks/choice-manifest-C-XahD7m.js +2 -0
- package/dist/cdn/chunks/choice-manifest-C-XahD7m.js.map +1 -0
- package/dist/cdn/chunks/color-control-Cl5cuMSO.js +91 -0
- package/dist/cdn/chunks/color-control-Cl5cuMSO.js.map +1 -0
- package/dist/cdn/chunks/crossword-Cb-a3Tjj.js +270 -0
- package/dist/cdn/chunks/crossword-Cb-a3Tjj.js.map +1 -0
- package/dist/cdn/chunks/crossword-manifest-2qlu7AYd.js +2 -0
- package/dist/cdn/chunks/crossword-manifest-2qlu7AYd.js.map +1 -0
- package/dist/cdn/chunks/declarations-BhqOz1ap.js +2 -0
- package/dist/cdn/chunks/declarations-BhqOz1ap.js.map +1 -0
- package/dist/cdn/chunks/definitions-CNX90WtL.js +6 -0
- package/dist/cdn/chunks/definitions-CNX90WtL.js.map +1 -0
- package/dist/cdn/chunks/directive-helpers-D7lOZKnB.js +14 -0
- package/dist/cdn/chunks/directive-helpers-D7lOZKnB.js.map +1 -0
- package/dist/cdn/chunks/drop-manifest-bzNOa5ks.js +2 -0
- package/dist/cdn/chunks/drop-manifest-bzNOa5ks.js.map +1 -0
- package/dist/cdn/chunks/drop-vRXndjHu.js +86 -0
- package/dist/cdn/chunks/drop-vRXndjHu.js.map +1 -0
- package/dist/cdn/chunks/flash-cards-0NrrKdrx.js +87 -0
- package/dist/cdn/chunks/flash-cards-0NrrKdrx.js.map +1 -0
- package/dist/cdn/chunks/flash-cards-manifest-B8nWXbRy.js +2 -0
- package/dist/cdn/chunks/flash-cards-manifest-B8nWXbRy.js.map +1 -0
- package/dist/cdn/chunks/gap-lor-khst.js +78 -0
- package/dist/cdn/chunks/gap-lor-khst.js.map +1 -0
- package/dist/cdn/chunks/gap-manifest-RSydA41N.js +2 -0
- package/dist/cdn/chunks/gap-manifest-RSydA41N.js.map +1 -0
- package/dist/cdn/chunks/help-C-woafz5.js +138 -0
- package/dist/cdn/chunks/help-C-woafz5.js.map +1 -0
- package/dist/cdn/chunks/help-form-DaC6KaFG.js +160 -0
- package/dist/cdn/chunks/help-form-DaC6KaFG.js.map +1 -0
- package/dist/cdn/chunks/hotspot-manifest-CNs1oiZ_.js +2 -0
- package/dist/cdn/chunks/hotspot-manifest-CNs1oiZ_.js.map +1 -0
- package/dist/cdn/chunks/hotspot-oel1Eelo.js +154 -0
- package/dist/cdn/chunks/hotspot-oel1Eelo.js.map +1 -0
- package/dist/cdn/chunks/image-drop-Dkprw0Kn.js +295 -0
- package/dist/cdn/chunks/image-drop-Dkprw0Kn.js.map +1 -0
- package/dist/cdn/chunks/image-drop-manifest-BZ6hCoAd.js +2 -0
- package/dist/cdn/chunks/image-drop-manifest-BZ6hCoAd.js.map +1 -0
- package/dist/cdn/chunks/image-label-Dm5shQSh.js +177 -0
- package/dist/cdn/chunks/image-label-Dm5shQSh.js.map +1 -0
- package/dist/cdn/chunks/image-label-manifest--1CLRJzd.js +2 -0
- package/dist/cdn/chunks/image-label-manifest--1CLRJzd.js.map +1 -0
- package/dist/cdn/chunks/inline-styles-CTgXWnHb.js +80 -0
- package/dist/cdn/chunks/inline-styles-CTgXWnHb.js.map +1 -0
- package/dist/cdn/chunks/insert-menu-LgrifBYT.js +80 -0
- package/dist/cdn/chunks/insert-menu-LgrifBYT.js.map +1 -0
- package/dist/cdn/chunks/issue-list-BgnXzXRM.js +51 -0
- package/dist/cdn/chunks/issue-list-BgnXzXRM.js.map +1 -0
- package/dist/cdn/chunks/keys-DU-Qknmz.js +2 -0
- package/dist/cdn/chunks/keys-DU-Qknmz.js.map +1 -0
- package/dist/cdn/chunks/live-jdiyYln2.js +7 -0
- package/dist/cdn/chunks/live-jdiyYln2.js.map +1 -0
- package/dist/cdn/chunks/long-answer-CtzClLAx.js +71 -0
- package/dist/cdn/chunks/long-answer-CtzClLAx.js.map +1 -0
- package/dist/cdn/chunks/long-answer-manifest-BYJpZRtB.js +2 -0
- package/dist/cdn/chunks/long-answer-manifest-BYJpZRtB.js.map +1 -0
- package/dist/cdn/chunks/mark-words-CpH3gTcX.js +131 -0
- package/dist/cdn/chunks/mark-words-CpH3gTcX.js.map +1 -0
- package/dist/cdn/chunks/mark-words-manifest-Cs2pXCEx.js +2 -0
- package/dist/cdn/chunks/mark-words-manifest-Cs2pXCEx.js.map +1 -0
- package/dist/cdn/chunks/match-DKE_4o-x.js +352 -0
- package/dist/cdn/chunks/match-DKE_4o-x.js.map +1 -0
- package/dist/cdn/chunks/match-manifest-D0UfoajU.js +2 -0
- package/dist/cdn/chunks/match-manifest-D0UfoajU.js.map +1 -0
- package/dist/cdn/chunks/memory-B6hSyHyz.js +187 -0
- package/dist/cdn/chunks/memory-B6hSyHyz.js.map +1 -0
- package/dist/cdn/chunks/memory-manifest-D1589iR0.js +2 -0
- package/dist/cdn/chunks/memory-manifest-D1589iR0.js.map +1 -0
- package/dist/cdn/chunks/menu-messages-Dx3jYUEp.js +2 -0
- package/dist/cdn/chunks/menu-messages-Dx3jYUEp.js.map +1 -0
- package/dist/cdn/chunks/messages-9xiYDvRT.js +2 -0
- package/dist/cdn/chunks/messages-9xiYDvRT.js.map +1 -0
- package/dist/cdn/chunks/option-styles-WKzjKmCH.js +50 -0
- package/dist/cdn/chunks/option-styles-WKzjKmCH.js.map +1 -0
- package/dist/cdn/chunks/order-BhG_6IC-.js +225 -0
- package/dist/cdn/chunks/order-BhG_6IC-.js.map +1 -0
- package/dist/cdn/chunks/order-manifest-J5IXN0he.js +2 -0
- package/dist/cdn/chunks/order-manifest-J5IXN0he.js.map +1 -0
- package/dist/cdn/chunks/pick-and-place-DVQIPYuL.js +2 -0
- package/dist/cdn/chunks/pick-and-place-DVQIPYuL.js.map +1 -0
- package/dist/cdn/chunks/picture-D10YRMYH.js +2 -0
- package/dist/cdn/chunks/picture-D10YRMYH.js.map +1 -0
- package/dist/cdn/chunks/picture-view-BKnAyScQ.js +92 -0
- package/dist/cdn/chunks/picture-view-BKnAyScQ.js.map +1 -0
- package/dist/cdn/chunks/repeat-CY2W2URZ.js +8 -0
- package/dist/cdn/chunks/repeat-CY2W2URZ.js.map +1 -0
- package/dist/cdn/chunks/roving-focus-BxGgi2DD.js +2 -0
- package/dist/cdn/chunks/roving-focus-BxGgi2DD.js.map +1 -0
- package/dist/cdn/chunks/runtime-DxAbpr3S.js +526 -0
- package/dist/cdn/chunks/runtime-DxAbpr3S.js.map +1 -0
- package/dist/cdn/chunks/scan-jWgPnVxA.js +2 -0
- package/dist/cdn/chunks/scan-jWgPnVxA.js.map +1 -0
- package/dist/cdn/chunks/select-DTA3dJzr.js +345 -0
- package/dist/cdn/chunks/select-DTA3dJzr.js.map +1 -0
- package/dist/cdn/chunks/select-manifest-BBMbvdkH.js +2 -0
- package/dist/cdn/chunks/select-manifest-BBMbvdkH.js.map +1 -0
- package/dist/cdn/chunks/source-view-DXKPFCl9.js +29 -0
- package/dist/cdn/chunks/source-view-DXKPFCl9.js.map +1 -0
- package/dist/cdn/chunks/style-form-D5haJtWM.js +240 -0
- package/dist/cdn/chunks/style-form-D5haJtWM.js.map +1 -0
- package/dist/cdn/chunks/style-messages-BbZpeD2a.js +2 -0
- package/dist/cdn/chunks/style-messages-BbZpeD2a.js.map +1 -0
- package/dist/cdn/chunks/style-model-ZXNe_c8R.js +2 -0
- package/dist/cdn/chunks/style-model-ZXNe_c8R.js.map +1 -0
- package/dist/cdn/chunks/style-placing-DPw1zyrz.js +2 -0
- package/dist/cdn/chunks/style-placing-DPw1zyrz.js.map +1 -0
- package/dist/cdn/chunks/style-popups-BobgX1WK.js +74 -0
- package/dist/cdn/chunks/style-popups-BobgX1WK.js.map +1 -0
- package/dist/cdn/chunks/style-rules-D45PZLCv.js +136 -0
- package/dist/cdn/chunks/style-rules-D45PZLCv.js.map +1 -0
- package/dist/cdn/chunks/styled-Dmx5Yjv7.js +57 -0
- package/dist/cdn/chunks/styled-Dmx5Yjv7.js.map +1 -0
- package/dist/cdn/chunks/styles-DxJJxVNH.js +136 -0
- package/dist/cdn/chunks/styles-DxJJxVNH.js.map +1 -0
- package/dist/cdn/chunks/surface-CgxfAwCR.js +1019 -0
- package/dist/cdn/chunks/surface-CgxfAwCR.js.map +1 -0
- package/dist/cdn/chunks/true-false-DP3MO599.js +146 -0
- package/dist/cdn/chunks/true-false-DP3MO599.js.map +1 -0
- package/dist/cdn/chunks/true-false-manifest-B4exv60u.js +2 -0
- package/dist/cdn/chunks/true-false-manifest-B4exv60u.js.map +1 -0
- package/dist/cdn/chunks/video-j9MCH6Kw.js +98 -0
- package/dist/cdn/chunks/video-j9MCH6Kw.js.map +1 -0
- package/dist/cdn/chunks/video-manifest-8OwkhhAI.js +2 -0
- package/dist/cdn/chunks/video-manifest-8OwkhhAI.js.map +1 -0
- package/dist/cdn/chunks/word-bank-ARjwUKZf.js +80 -0
- package/dist/cdn/chunks/word-bank-ARjwUKZf.js.map +1 -0
- package/dist/cdn/chunks/word-bank-manifest-C1FSo1kH.js +2 -0
- package/dist/cdn/chunks/word-bank-manifest-C1FSo1kH.js.map +1 -0
- package/dist/cdn/chunks/word-search-AHvM7yCJ.js +274 -0
- package/dist/cdn/chunks/word-search-AHvM7yCJ.js.map +1 -0
- package/dist/cdn/chunks/word-search-manifest-Fg1a59Z1.js +2 -0
- package/dist/cdn/chunks/word-search-manifest-Fg1a59Z1.js.map +1 -0
- package/dist/editor.d.ts +32 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/editor.js +51 -0
- package/dist/editor.js.map +1 -0
- package/dist/engine.d.ts +33 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +53 -0
- package/dist/engine.js.map +1 -0
- package/dist/player.d.ts +19 -0
- package/dist/player.d.ts.map +1 -0
- package/dist/player.js +22 -0
- package/dist/player.js.map +1 -0
- package/dist/server.d.ts +8 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +8 -0
- package/dist/server.js.map +1 -0
- package/package.json +70 -3
- package/src/bundles/astrolabe-editor.ts +11 -0
- package/src/bundles/astrolabe-player.ts +10 -0
- package/src/bundles/astrolabe-standalone.ts +23 -0
- package/src/bundles/astrolabe.ts +12 -0
- package/src/editor.ts +98 -0
- package/src/engine.ts +59 -0
- package/src/player.ts +23 -0
- package/src/server.ts +7 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{w as e}from"./runtime-DxAbpr3S.js";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2017 Google LLC
|
|
5
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
var t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},n=e=>(...t)=>({_$litDirective$:e,values:t}),r=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}},{I:i}=e,a=e=>e,o=e=>e.strings===void 0,s=()=>document.createComment(``),c=(e,t,n)=>{
|
|
8
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
* Copyright 2020 Google LLC
|
|
11
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
|
+
*/
|
|
13
|
+
let r=e._$AA.parentNode,o=t===void 0?e._$AB:t._$AA;if(n===void 0)n=new i(r.insertBefore(s(),o),r.insertBefore(s(),o),e,e.options);else{let t=n._$AB.nextSibling,i=n._$AM,s=i!==e;if(s){let t;n._$AQ?.(e),n._$AM=e,n._$AP!==void 0&&(t=e._$AU)!==i._$AU&&n._$AP(t)}if(t!==o||s){let e=n._$AA;for(;e!==t;){let t=a(e).nextSibling;a(r).insertBefore(e,o),e=t}}}return n},l=(e,t,n=e)=>(e._$AI(t,n),e),u={},d=(e,t=u)=>e._$AH=t,f=e=>e._$AH,p=e=>{e._$AR(),e._$AA.remove()};export{l as a,r as c,o as i,t as l,p as n,c as o,d as r,n as s,f as t};
|
|
14
|
+
//# sourceMappingURL=directive-helpers-D7lOZKnB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directive-helpers-D7lOZKnB.js","names":["t","e","i","o","j$1","t$1","e$1","e","t","i$1","i","o","r","v","l","d","n","c","u","m","p","M","h"],"sources":["../../../../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directive.js","../../../../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directive-helpers.js"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}export{i as Directive,t as PartType,e as directive};\n//# sourceMappingURL=directive.js.map\n","import{_$LH as o}from\"./lit-html.js\";\n/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const{I:t}=o,i=o=>o,n=o=>null===o||\"object\"!=typeof o&&\"function\"!=typeof o,e={HTML:1,SVG:2,MATHML:3},l=(o,t)=>void 0===t?void 0!==o?._$litType$:o?._$litType$===t,d=o=>null!=o?._$litType$?.h,c=o=>void 0!==o?._$litDirective$,f=o=>o?._$litDirective$,r=o=>void 0===o.strings,s=()=>document.createComment(\"\"),v=(o,n,e)=>{const l=o._$AA.parentNode,d=void 0===n?o._$AB:n._$AA;if(void 0===e){const i=l.insertBefore(s(),d),n=l.insertBefore(s(),d);e=new t(i,n,o,o.options)}else{const t=e._$AB.nextSibling,n=e._$AM,c=n!==o;if(c){let t;e._$AQ?.(o),e._$AM=o,void 0!==e._$AP&&(t=o._$AU)!==n._$AU&&e._$AP(t)}if(t!==d||c){let o=e._$AA;for(;o!==t;){const t=i(o).nextSibling;i(l).insertBefore(o,d),o=t}}}return e},u=(o,t,i=o)=>(o._$AI(t,i),o),m={},p=(o,t=m)=>o._$AH=t,M=o=>o._$AH,h=o=>{o._$AR(),o._$AA.remove()},j=o=>{o._$AR()};export{e as TemplateResultType,j as clearPart,M as getCommittedValue,f as getDirectiveClass,v as insertPart,d as isCompiledTemplateResult,c as isDirectiveResult,n as isPrimitive,r as isSingleExpression,l as isTemplateResult,h as removePart,u as setChildPartValue,p as setCommittedValue};\n//# sourceMappingURL=directive-helpers.js.map\n"],"ignoreList":[0,1],"mappings":";;;;;;AAKA,IAAMA,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAEC,EAAE,IAAI,GAAGM,KAAK,CAAC,gBAAgBC,EAAE,OAAOD,CAAC,GAASL,EAAN,KAAO,CAAC,YAAY,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK,IAAI,CAAC,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,KAAKM,EAAE,KAAK,KAAKD,EAAE,KAAK,KAAKG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,OAAOF,EAAED,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,OAAO,GAAGA,CAAC,CAAC,CAAC,ECAnS,CAAC,EAAEC,GAAGL,EAAEO,EAAE,GAAGC,EAAsOC,EAAE,GAAYD,EAAE,UAAX,IAAK,GAAc,MAAM,SAAS,cAAc,EAAE,EAAEE,GAAG,EAAE,EAAE,IAAI;;;;;;AAAC,IAAMC,EAAEH,EAAE,KAAK,WAAWI,EAAWC,IAAT,IAAK,GAAML,EAAE,KAAKK,EAAE,KAAK,GAAYT,IAAT,IAAK,GAA6D,EAAE,IAAIC,EAApDM,EAAE,aAAa,EAAE,EAAEC,CAAmC,EAA9BD,EAAE,aAAa,EAAE,EAAEC,CAAa,EAAEJ,EAAEA,EAAE,OAAO,MAAM,CAAC,IAAM,EAAEJ,EAAE,KAAK,YAAYS,EAAET,EAAE,KAAKU,EAAED,IAAIL,EAAE,GAAGM,EAAE,CAAC,IAAI,EAAEV,EAAE,OAAOI,CAAC,EAAE,EAAE,KAAKA,EAAWJ,EAAE,OAAX,IAAK,KAAa,EAAEI,EAAE,QAAQK,EAAE,MAAMT,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAIQ,GAAGE,EAAE,CAAC,IAAIN,EAAEJ,EAAE,KAAK,KAAKI,IAAI,GAAG,CAAC,IAAM,EAAED,EAAEC,CAAC,CAAC,CAAC,YAAYD,EAAEI,CAAC,CAAC,CAAC,aAAaH,EAAEI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAOR,CAAC,EAAEW,GAAG,EAAE,EAAE,EAAEP,KAAKA,EAAE,KAAK,EAAED,CAAC,EAAEC,GAAGQ,EAAE,CAAC,EAAEC,GAAG,EAAE,EAAED,IAAI,EAAE,KAAK,EAAEE,EAAE,GAAGV,EAAE,KAAKW,EAAE,GAAG,CAACX,EAAE,KAAK,EAAEA,EAAE,KAAK,OAAO,CAAC,E"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={tag:`astl-drop`,version:1,display:`inline`,graded:!0,attributes:[{name:`answer`,type:`string`,visibility:`private`,required:!0},{name:`bank`,type:`string`,visibility:`public`,required:!0}],children:[],scoring:{default:`all`,modes:{all:`all-correct`}},variants:null,slotKinds:[`choice`],issues:[`DROP_BANK_UNKNOWN`,`DROP_ANSWER_UNKNOWN`,`DROP_ANSWER_DISTRACTOR`],messages:`astl.drop`,a11y:{pattern:`button: Enter or Space puts the picked word here; with no word picked it takes its word out (back in the bank, picked to move it), or, empty, waits for a word: the arrow keys choose one and Enter puts it here; Escape cancels`,keys:[`Tab`,`Enter`,`Space`,`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`Escape`]},cssParts:[`drop`,`word`,`verdict`,`solution`]},t={"ui.name":`Gap {n}`,"ui.namePlain":`Gap`,"ui.label":`{name}: {word}`,"ui.labelEmpty":`{name}, empty`,"ui.solution":`Correct answer: {answer}`},n={"ui.name":`Luka {n}`,"ui.namePlain":`Luka`,"ui.label":`{name}: {word}`,"ui.labelEmpty":`{name}, pusta`,"ui.solution":`Poprawna odpowiedź: {answer}`};export{t as n,e as r,n as t};
|
|
2
|
+
//# sourceMappingURL=drop-manifest-bzNOa5ks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drop-manifest-bzNOa5ks.js","names":["dropManifest","en_default","pl_default"],"sources":["../../../../components/src/drop/manifest.ts","../../../../components/src/drop/messages/ui/en.json","../../../../components/src/drop/messages/ui/pl.json"],"sourcesContent":["import type { ComponentManifest } from '@astl/core';\n\n/**\n * A gap in running text that takes a word from a word bank (`<astl-word-bank>`) on the same page: `answer` (private)\n * is the id of the correct word, `bank` the id of the bank (opaque in the view). One `choice` slot, answered with the\n * opaque id of the word the student put there. Gaps of every kind share one reading-order numbering.\n */\nexport const dropManifest: ComponentManifest = {\n tag: 'astl-drop',\n version: 1,\n display: 'inline',\n graded: true,\n attributes: [\n /** The id of the correct word in the bank. */\n { name: 'answer', type: 'string', visibility: 'private', required: true },\n /** The id of the word bank, on the same page, the gap takes its words from; the view carries its opaque id. */\n { name: 'bank', type: 'string', visibility: 'public', required: true },\n ],\n children: [],\n scoring: { default: 'all', modes: { all: 'all-correct' } },\n variants: null,\n slotKinds: ['choice'],\n issues: ['DROP_BANK_UNKNOWN', 'DROP_ANSWER_UNKNOWN', 'DROP_ANSWER_DISTRACTOR'],\n messages: 'astl.drop',\n a11y: {\n pattern:\n 'button: Enter or Space puts the picked word here; with no word picked it takes its word out (back in the bank, picked to move it), or, empty, waits for a word: the arrow keys choose one and Enter puts it here; Escape cancels',\n keys: [\n 'Tab',\n 'Enter',\n 'Space',\n 'ArrowUp',\n 'ArrowDown',\n 'ArrowLeft',\n 'ArrowRight',\n 'Home',\n 'End',\n 'Escape',\n ],\n },\n cssParts: ['drop', 'word', 'verdict', 'solution'],\n};\n","{\n \"ui.name\": \"Gap {n}\",\n \"ui.namePlain\": \"Gap\",\n \"ui.label\": \"{name}: {word}\",\n \"ui.labelEmpty\": \"{name}, empty\",\n \"ui.solution\": \"Correct answer: {answer}\"\n}\n","{\n \"ui.name\": \"Luka {n}\",\n \"ui.namePlain\": \"Luka\",\n \"ui.label\": \"{name}: {word}\",\n \"ui.labelEmpty\": \"{name}, pusta\",\n \"ui.solution\": \"Poprawna odpowiedź: {answer}\"\n}\n"],"mappings":"AAOA,IAAaA,EAAkC,CAC7C,IAAK,YACL,QAAS,EACT,QAAS,SACT,OAAQ,GACR,WAAY,CAEV,CAAE,KAAM,SAAU,KAAM,SAAU,WAAY,UAAW,SAAU,EAAK,EAExE,CAAE,KAAM,OAAQ,KAAM,SAAU,WAAY,SAAU,SAAU,EAAK,CACvE,EACA,SAAU,CAAC,EACX,QAAS,CAAE,QAAS,MAAO,MAAO,CAAE,IAAK,aAAc,CAAE,EACzD,SAAU,KACV,UAAW,CAAC,QAAQ,EACpB,OAAQ,CAAC,oBAAqB,sBAAuB,wBAAwB,EAC7E,SAAU,YACV,KAAM,CACJ,QACE,mOACF,KAAM,CACJ,MACA,QACA,QACA,UACA,YACA,YACA,aACA,OACA,MACA,QACF,CACF,EACA,SAAU,CAAC,OAAQ,OAAQ,UAAW,UAAU,CAClD,E"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import{C as e,E as t,b as n,h as r,m as i,r as a,v as o}from"./runtime-DxAbpr3S.js";import{n as s,r as c,t as l}from"./drop-manifest-bzNOa5ks.js";import{t as u}from"./inline-styles-CTgXWnHb.js";var d=`astl.drop`,f=[{namespace:d,locale:`en`,messages:s},{namespace:d,locale:`pl`,messages:l}],p=String.fromCodePoint(8288),m=e=>(e?.textContent??``).replace(/\s+/g,` `).trim(),h=class extends a{static manifest=c;static messages=f;static styles=[t`
|
|
2
|
+
.field.verdict {
|
|
3
|
+
--astl-drop-icon: calc(1.1em + var(--astl-space-1));
|
|
4
|
+
}
|
|
5
|
+
.field > .control {
|
|
6
|
+
min-inline-size: max(var(--astl-target-min), 5em);
|
|
7
|
+
max-inline-size: calc(100% - var(--astl-drop-icon, 0px) - 0.2em);
|
|
8
|
+
padding-inline: var(--astl-space-2);
|
|
9
|
+
border-radius: var(--astl-radius-m);
|
|
10
|
+
white-space: normal;
|
|
11
|
+
overflow-wrap: anywhere;
|
|
12
|
+
hyphens: auto;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
touch-action: manipulation;
|
|
15
|
+
user-select: none;
|
|
16
|
+
-webkit-user-select: none;
|
|
17
|
+
-webkit-touch-callout: none;
|
|
18
|
+
transition: translate var(--astl-duration-fast);
|
|
19
|
+
}
|
|
20
|
+
.control:disabled {
|
|
21
|
+
cursor: default;
|
|
22
|
+
}
|
|
23
|
+
.field > .control:empty::before {
|
|
24
|
+
content: '\\200b';
|
|
25
|
+
}
|
|
26
|
+
`,t`
|
|
27
|
+
.field > .control:disabled:not([data-verdict]) {
|
|
28
|
+
border-color: transparent;
|
|
29
|
+
border-block-end-color: var(--astl-outline);
|
|
30
|
+
border-radius: 0;
|
|
31
|
+
background: transparent;
|
|
32
|
+
}
|
|
33
|
+
`,t`
|
|
34
|
+
.control[aria-pressed='true'] {
|
|
35
|
+
border-width: var(--astl-focus-width);
|
|
36
|
+
border-inline-start-width: max(var(--astl-focus-width), var(--astl-selected-bar));
|
|
37
|
+
border-color: var(--astl-selected);
|
|
38
|
+
background: var(--astl-selected-soft);
|
|
39
|
+
font-weight: var(--astl-selected-weight);
|
|
40
|
+
}
|
|
41
|
+
.control[data-target] {
|
|
42
|
+
border-color: var(--astl-accent);
|
|
43
|
+
outline: var(--astl-outline-width) solid var(--astl-accent);
|
|
44
|
+
outline-offset: calc(-2 * var(--astl-outline-width));
|
|
45
|
+
background: var(--astl-accent-soft);
|
|
46
|
+
}
|
|
47
|
+
.control[data-dragging] {
|
|
48
|
+
position: relative;
|
|
49
|
+
z-index: 1;
|
|
50
|
+
box-shadow: 0 var(--astl-space-1) 0 0 var(--astl-outline);
|
|
51
|
+
transition: none;
|
|
52
|
+
pointer-events: none;
|
|
53
|
+
}
|
|
54
|
+
@media (prefers-reduced-motion: reduce) {
|
|
55
|
+
.control {
|
|
56
|
+
transition: none;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
`,u];get bank(){let e=this.getAttribute(`bank`),t=e&&this.isConnected?this.getRootNode().getElementById(e):null;return t?.localName===`astl-word-bank`?t:null}get word(){return this.value}get number(){return this.context.number}place(e){this.updateValue(e),this.bank?.requestUpdate()}setAnswers(e){let t=e[this.id];t!==void 0&&(this.value=this.#e(t)===void 0?``:t,this.bank?.pick.reset())}#e(e){if(e!==``)return[...this.bank?.children??[]].find(t=>t.localName===`astl-word`&&t.id===e)}render(){let t=this.bank,a=t?.pick,s=this.#e(this.value),c=this.verdict,l=c===`correct`?void 0:this.#e(this.solutionValue??``),u=this.uiLanguage,{number:d}=this.context,f=d>0?this.t(`ui.name`,{n:d}):this.t(`ui.namePlain`),h=s?this.t(`ui.label`,{name:f,word:m(s)}):this.t(`ui.labelEmpty`,{name:f}),g=[c===null?``:`verdict`,l===void 0?``:`solution`].filter(e=>e!==``).join(` `),_=a!==void 0&&(a.over??(a.picked===null?null:a.target))===this.id,v=this.contentLang;return e`<span class=${c===null?`field`:`field verdict`}
|
|
60
|
+
><button
|
|
61
|
+
type="button"
|
|
62
|
+
class="control chip"
|
|
63
|
+
part="drop"
|
|
64
|
+
data-word=${this.value}
|
|
65
|
+
data-verdict=${o(c??void 0)}
|
|
66
|
+
?data-target=${_}
|
|
67
|
+
?data-dragging=${a?.dragging===this.id}
|
|
68
|
+
lang=${o(v===``?void 0:v)}
|
|
69
|
+
aria-pressed=${a?.picked===this.id?`true`:`false`}
|
|
70
|
+
aria-label=${h}
|
|
71
|
+
aria-describedby=${g===``?n:g}
|
|
72
|
+
?disabled=${this.disabled}
|
|
73
|
+
@click=${e=>t?.activate(this,e)}
|
|
74
|
+
@keydown=${e=>a?.keydown(e,this.id)}
|
|
75
|
+
@pointerdown=${e=>s&&a?.pointerdown(e,this.id)}
|
|
76
|
+
@touchmove=${a?.touchmove}
|
|
77
|
+
>${s===void 0?n:e`<span part="word" lang=${o(s.closest(`[lang]`)?.getAttribute(`lang`)??void 0)}
|
|
78
|
+
>${[...s.childNodes].map(e=>e.cloneNode(!0))}</span
|
|
79
|
+
>`}</button
|
|
80
|
+
>${c===null?n:i(c,(e,t)=>this.t(e,t),{hiddenWord:!0,id:`verdict`,part:`verdict`,...u})}</span
|
|
81
|
+
>${l===void 0?n:e`<span class="solution" part="solution" id="solution" data-word=${l.id}
|
|
82
|
+
>${r(`correct`)}<span class="astl-vh" lang=${u.lang} dir=${u.dir}
|
|
83
|
+
>${this.t(`ui.solution`,{answer:m(l)})}</span
|
|
84
|
+
><span aria-hidden="true">${m(l)}</span></span
|
|
85
|
+
>`}${p}`}},g={manifest:c,element:h,messages:f};export{g as dropElement};
|
|
86
|
+
//# sourceMappingURL=drop-vRXndjHu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drop-vRXndjHu.js","names":["en","pl","ifDefined","nothing","b","i","A","verdictIcon","renderVerdict","SingleSlotElement","en_default","dropManifest","pl_default","inlineStyles","namespace","dropUiMessages","WORD_JOINER","textOf","el","DropElement","id","found","word","value","answers","#word","child","bank","pick","verdict","solution","ui","name","number","label","describedBy","target","content","event","node","key","params","dropElement"],"sources":["../../../../components/src/drop/ui-messages.ts","../../../../components/src/drop/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.drop';\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 `dropMessages` would put the authoring strings into the element's chunk.\n */\nexport const dropUiMessages: readonly MessageCatalog[] = [\n { namespace, locale: 'en', messages: en },\n { namespace, locale: 'pl', messages: pl },\n];\n","import type { Answers, ComponentManifest, MessageCatalog } from '@astl/core';\nimport { type ElementRegistration, renderVerdict, SingleSlotElement, verdictIcon } from '@astl/player';\nimport { type CSSResultGroup, css, html, nothing, type TemplateResult } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { inlineStyles } from '../inline-styles.js';\nimport { dropManifest } from './manifest.js';\nimport { dropUiMessages } from './ui-messages.js';\n\n/** U+2060: keeps the text right after the drop (a full stop, a comma) on its line. */\nconst WORD_JOINER = String.fromCodePoint(0x2060);\n\n/**\n * What a drop asks of its word bank (`<astl-word-bank>` with that id in the same view; the two folders never import\n * each other): its pick and place state, and what a click on the drop means.\n */\ninterface Bank extends HTMLElement {\n readonly pick: {\n readonly picked: string | null;\n readonly target: string | null;\n readonly over: string | null;\n readonly dragging: string | null;\n keydown(event: KeyboardEvent, item: string): boolean;\n pointerdown(event: PointerEvent, item: string): void;\n reset(): void;\n readonly touchmove: AddEventListenerOptions & EventListenerObject;\n };\n activate(drop: DropElement, event: MouseEvent): void;\n requestUpdate(): void;\n}\n\nconst textOf = (el: Element | undefined): string => (el?.textContent ?? '').replace(/\\s+/g, ' ').trim();\n\n/**\n * `<astl-drop>`: a gap in running text that holds a word of its bank. One slot, the element id, answered with the\n * word's id. The drop is a button; what a press does is its bank's business (put the picked word here, take this one\n * out, or wait for a word), so one pick and place serves the bank and all its drops. A held word can be dragged on.\n */\nexport class DropElement extends SingleSlotElement {\n static override manifest: ComponentManifest = dropManifest;\n static override messages: readonly MessageCatalog[] = dropUiMessages;\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 slot in the line with the metrics of a gap (inline-styles.ts: on the baseline, at least 24 px, the WCAG 2.5.8\n // inline exception), so the sentence keeps its lines, and the corners of the bank's chips, so a placed word looks\n // as it did there. Empty drops are all one width, so the width tells nothing about the answer; an empty one holds\n // a zero-width space (generated; the button holds nothing else, or :empty misses it), so it sits on the baseline\n // as a full one does. Its widest leaves room for the field's hair after it (inline-styles.ts). A word hyphenates inside the slot rather than\n // leave the line, and the icon keeps its room.\n css`\n .field.verdict {\n --astl-drop-icon: calc(1.1em + var(--astl-space-1));\n }\n .field > .control {\n min-inline-size: max(var(--astl-target-min), 5em);\n max-inline-size: calc(100% - var(--astl-drop-icon, 0px) - 0.2em);\n padding-inline: var(--astl-space-2);\n border-radius: var(--astl-radius-m);\n white-space: normal;\n overflow-wrap: anywhere;\n hyphens: auto;\n cursor: pointer;\n touch-action: manipulation;\n user-select: none;\n -webkit-user-select: none;\n -webkit-touch-callout: none;\n transition: translate var(--astl-duration-fast);\n }\n .control:disabled {\n cursor: default;\n }\n .field > .control:empty::before {\n content: '\\\\200b';\n }\n `,\n // Locked without verdicts (review): the word written on a line, as a read-only gap shows its answer (that shared\n // rule keys on readonly, which a button cannot be).\n css`\n .field > .control:disabled:not([data-verdict]) {\n border-color: transparent;\n border-block-end-color: var(--astl-outline);\n border-radius: 0;\n background: transparent;\n }\n `,\n // Waiting for a word: the selection look (border, fill, weight; in hc the selected bar at the inline start), never\n // a verdict border. Where a picked word would go (the arrow keys' target, or under a dragged word): a doubled\n // edge, which forced colours keep. Its word dragged on (the bank moves the `chip` with the pointer): lifted, and\n // no pointer target, so what is under it counts.\n css`\n .control[aria-pressed='true'] {\n border-width: var(--astl-focus-width);\n border-inline-start-width: max(var(--astl-focus-width), var(--astl-selected-bar));\n border-color: var(--astl-selected);\n background: var(--astl-selected-soft);\n font-weight: var(--astl-selected-weight);\n }\n .control[data-target] {\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 .control[data-dragging] {\n position: relative;\n z-index: 1;\n box-shadow: 0 var(--astl-space-1) 0 0 var(--astl-outline);\n transition: none;\n pointer-events: none;\n }\n @media (prefers-reduced-motion: reduce) {\n .control {\n transition: none;\n }\n }\n `,\n inlineStyles,\n ];\n\n /** The word bank it takes words from, or null when the view has none with its `bank` id. */\n get bank(): Bank | null {\n const id = this.getAttribute('bank');\n const found =\n id && this.isConnected ? (this.getRootNode() as Document | ShadowRoot).getElementById(id) : null;\n return found?.localName === 'astl-word-bank' ? (found as Bank) : null;\n }\n\n /** The id of the word it holds; '' when empty. */\n get word(): string {\n return this.value;\n }\n\n /** Its number among the gaps of the text (0 outside a player). */\n get number(): number {\n return this.context.number;\n }\n\n /** Puts a word of its bank in (or '' takes it out), as the student did: reported like any answer. */\n place(word: string): void {\n this.updateValue(word);\n this.bank?.requestUpdate();\n }\n\n /** A word of its own bank, or '' to empty it: anything else cannot be shown, so the drop stays empty. */\n override setAnswers(answers: Answers): void {\n const value = answers[this.id];\n if (value === undefined) return;\n this.value = this.#word(value) === undefined ? '' : value;\n // The player sets answers on the gaps only (the bank has no slots): a pick or a wait of the bank goes with them.\n this.bank?.pick.reset();\n }\n\n #word(id: string): HTMLElement | undefined {\n if (id === '') return undefined;\n return [...(this.bank?.children ?? [])].find(\n (child): child is HTMLElement => child.localName === 'astl-word' && child.id === id,\n );\n }\n\n protected override render(): TemplateResult {\n const bank = this.bank;\n const pick = bank?.pick;\n const word = this.#word(this.value);\n const verdict = this.verdict;\n // A correct answer needs no correction: the solution shows for wrong and empty drops only.\n const solution = verdict === 'correct' ? undefined : this.#word(this.solutionValue ?? '');\n const ui = this.uiLanguage;\n const { number } = this.context;\n const name = number > 0 ? this.t('ui.name', { n: number }) : this.t('ui.namePlain');\n const label = word ? this.t('ui.label', { name, word: textOf(word) }) : this.t('ui.labelEmpty', { name });\n const describedBy = [verdict === null ? '' : 'verdict', solution === undefined ? '' : 'solution']\n .filter((id) => id !== '')\n .join(' ');\n const target =\n pick !== undefined && (pick.over ?? (pick.picked === null ? null : pick.target)) === this.id;\n const content = this.contentLang;\n return html`<span class=${verdict === null ? 'field' : 'field verdict'}\n ><button\n type=\"button\"\n class=\"control chip\"\n part=\"drop\"\n data-word=${this.value}\n data-verdict=${ifDefined(verdict ?? undefined)}\n ?data-target=${target}\n ?data-dragging=${pick?.dragging === this.id}\n lang=${ifDefined(content === '' ? undefined : content)}\n aria-pressed=${pick?.picked === this.id ? 'true' : 'false'}\n aria-label=${label}\n aria-describedby=${describedBy === '' ? nothing : describedBy}\n ?disabled=${this.disabled}\n @click=${(event: MouseEvent) => bank?.activate(this, event)}\n @keydown=${(event: KeyboardEvent) => pick?.keydown(event, this.id)}\n @pointerdown=${(event: PointerEvent) => word && pick?.pointerdown(event, this.id)}\n @touchmove=${pick?.touchmove}\n >${\n word === undefined\n ? nothing\n : html`<span part=\"word\" lang=${ifDefined(word.closest('[lang]')?.getAttribute('lang') ?? undefined)}\n >${[...word.childNodes].map((node) => node.cloneNode(true))}</span\n >`\n }</button\n >${\n verdict === null\n ? nothing\n : renderVerdict(verdict, (key, params) => this.t(key, params), {\n hiddenWord: true,\n id: 'verdict',\n part: 'verdict',\n ...ui,\n })\n }</span\n >${\n solution === undefined\n ? nothing\n : html`<span class=\"solution\" part=\"solution\" id=\"solution\" data-word=${solution.id}\n >${verdictIcon('correct')}<span class=\"astl-vh\" lang=${ui.lang} dir=${ui.dir}\n >${this.t('ui.solution', { answer: textOf(solution) })}</span\n ><span aria-hidden=\"true\">${textOf(solution)}</span></span\n >`\n }${WORD_JOINER}`;\n }\n}\n\nexport const dropElement: ElementRegistration = {\n manifest: dropManifest,\n element: DropElement,\n messages: dropUiMessages,\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import{C as e,E as t,b as n,n as r,y as i}from"./runtime-DxAbpr3S.js";import{n as a,r as o,t as s}from"./flash-cards-manifest-B8nWXbRy.js";import{t as c}from"./keys-DU-Qknmz.js";import{t as l}from"./block-styles-CKo9x7Vt.js";var u=`astl.flash-cards`,d=[{namespace:u,locale:`en`,messages:a},{namespace:u,locale:`pl`,messages:s}],f=e=>e instanceof HTMLImageElement?` ${e.alt} `:e.nodeType===Node.TEXT_NODE?e.textContent??``:[...e.childNodes].map(f).join(``),p=class extends r{static manifest=o;static messages=d;static shadowRootOptions={...i.shadowRootOptions,slotAssignment:`manual`};static properties={current:{state:!0},back:{state:!0}};static styles=[t`
|
|
2
|
+
.deck {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: var(--astl-space-3);
|
|
6
|
+
}
|
|
7
|
+
.hint {
|
|
8
|
+
margin: 0;
|
|
9
|
+
color: var(--astl-ink-muted);
|
|
10
|
+
font-size: var(--astl-size-ui);
|
|
11
|
+
}
|
|
12
|
+
button {
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
min-block-size: var(--astl-target-min);
|
|
15
|
+
min-inline-size: var(--astl-target-min);
|
|
16
|
+
margin: 0;
|
|
17
|
+
padding-block: var(--astl-space-2);
|
|
18
|
+
padding-inline: var(--astl-space-4);
|
|
19
|
+
border: var(--astl-outline-width) solid var(--astl-outline);
|
|
20
|
+
border-radius: var(--astl-radius-m);
|
|
21
|
+
background: var(--astl-surface);
|
|
22
|
+
color: var(--astl-ink);
|
|
23
|
+
font: inherit;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
}
|
|
26
|
+
.nav > button {
|
|
27
|
+
flex: 1 1 auto;
|
|
28
|
+
font-size: var(--astl-size-ui);
|
|
29
|
+
font-weight: 600;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
}
|
|
32
|
+
.nav {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-wrap: wrap;
|
|
35
|
+
justify-content: space-between;
|
|
36
|
+
gap: var(--astl-space-2);
|
|
37
|
+
}
|
|
38
|
+
`,t`
|
|
39
|
+
.card {
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
gap: var(--astl-space-3);
|
|
43
|
+
inline-size: 100%;
|
|
44
|
+
min-block-size: 12rem;
|
|
45
|
+
padding: var(--astl-space-4);
|
|
46
|
+
border-radius: var(--astl-radius-l);
|
|
47
|
+
}
|
|
48
|
+
.card[data-side='back'] {
|
|
49
|
+
border-color: var(--astl-accent);
|
|
50
|
+
background: var(--astl-accent-soft);
|
|
51
|
+
}
|
|
52
|
+
.side {
|
|
53
|
+
align-self: flex-start;
|
|
54
|
+
color: var(--astl-ink-muted);
|
|
55
|
+
font-size: var(--astl-size-ui);
|
|
56
|
+
font-weight: 600;
|
|
57
|
+
text-align: start;
|
|
58
|
+
}
|
|
59
|
+
.face {
|
|
60
|
+
flex: 1;
|
|
61
|
+
display: grid;
|
|
62
|
+
place-items: center;
|
|
63
|
+
font-size: 1.5rem;
|
|
64
|
+
overflow-wrap: anywhere;
|
|
65
|
+
hyphens: auto;
|
|
66
|
+
}
|
|
67
|
+
`,l];constructor(){super(),this.current=0,this.back=!1}get slotIds(){return[]}getAnswers(){return{}}setAnswers(){}units(){return{answered:0,total:0}}#e(e){let t=e?`astl-back`:`astl-front`;return Array.from(this.children).filter(e=>e.localName===t)}#t(){let e=this.#e(!1).length,t=this.#e(this.back)[this.current],n=this.t(`ui.card`,{n:this.current+1,total:e,side:this.back?`back`:`front`}),r=t===void 0?``:f(t).replace(/\s+/g,` `).trim();return{total:e,element:t,caption:n,name:this.t(`ui.name`,{card:n,text:r})}}render(){let{total:t,caption:r,name:i}=this.#t(),a=this.uiLanguage;return e`<div class="deck" part="flash-cards" @keydown=${this.#i}>
|
|
68
|
+
<p class="hint" id="hint" lang=${a.lang} dir=${a.dir}>${this.t(`ui.hint`,{total:t})}</p>
|
|
69
|
+
<button
|
|
70
|
+
type="button"
|
|
71
|
+
class="card"
|
|
72
|
+
part="card"
|
|
73
|
+
data-side=${this.back?`back`:`front`}
|
|
74
|
+
lang=${a.lang}
|
|
75
|
+
aria-label=${i}
|
|
76
|
+
aria-describedby="hint"
|
|
77
|
+
@click=${this.#n}
|
|
78
|
+
>
|
|
79
|
+
<span class="side" part="side" dir=${a.dir}>${r}</span>
|
|
80
|
+
<span class="face" lang=${this.contentLang||n}><slot></slot></span>
|
|
81
|
+
</button>
|
|
82
|
+
${t>1?e`<div class="nav" part="nav" lang=${a.lang} dir=${a.dir}>
|
|
83
|
+
<button type="button" part="previous" @click=${()=>this.#r(-1)}>${this.t(`ui.previous`)}</button>
|
|
84
|
+
<button type="button" part="next" @click=${()=>this.#r(1)}>${this.t(`ui.next`)}</button>
|
|
85
|
+
</div>`:n}
|
|
86
|
+
</div>`}updated(){let{element:e}=this.#t();this.renderRoot.querySelector(`slot`)?.assign(...e===void 0?[]:[e])}#n(){this.back=!this.back;let e=Number.parseFloat(getComputedStyle(this).getPropertyValue(`--astl-duration-normal`));e>0&&this.renderRoot.querySelector(`.card`)?.animate({transform:[`perspective(60rem) rotateY(90deg)`,`none`]},{duration:e,easing:`ease-out`}),this.announce(this.#t().name)}#r(e){let t=this.#e(!1).length;this.current=(this.current+e+t)%t,this.back=!1,this.announce(this.#t().name)}#i(e){let t=c(e,`inline`,this);t===0||this.#e(!1).length<2||(e.preventDefault(),this.#r(t))}},m={manifest:o,element:p,messages:d};export{m as flashCardsElement};
|
|
87
|
+
//# sourceMappingURL=flash-cards-0NrrKdrx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flash-cards-0NrrKdrx.js","names":["en","pl","LitElement","nothing","b","i$1","A","AstlElement","en_default","flashCardsManifest","pl_default","arrowDelta","blockStyles","namespace","flashCardsUiMessages","spoken","node","FlashCardsElement","tag","back","child","total","#sides","element","caption","text","#shown","ui","#arrows","name","#turn","#move","duration","delta","event","flashCardsElement"],"sources":["../../../../components/src/flash-cards/ui-messages.ts","../../../../components/src/flash-cards/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.flash-cards';\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 `flashCardsMessages` would put the authoring strings into the element's chunk.\n */\nexport const flashCardsUiMessages: 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 { arrowDelta } from '@astl/player/interaction';\nimport {\n type CSSResultGroup,\n css,\n html,\n LitElement,\n nothing,\n type PropertyDeclarations,\n type TemplateResult,\n} from 'lit';\nimport { blockStyles } from '../block-styles.js';\nimport { flashCardsManifest } from './manifest.js';\nimport { flashCardsUiMessages } from './ui-messages.js';\n\n/** What a screen reader reads for light-DOM content: its text, pictures by their alt text. */\nconst spoken = (node: Node): string =>\n node instanceof HTMLImageElement\n ? ` ${node.alt} `\n : node.nodeType === Node.TEXT_NODE\n ? (node.textContent ?? '')\n : [...node.childNodes].map(spoken).join('');\n\n/**\n * `<astl-flash-cards>`: one card at a time, a button that turns it over; previous and next (or the arrow keys) move\n * between cards, round the deck. The n-th `<astl-front>` and the n-th `<astl-back>` of the view make card n, slotted\n * manually and never changed. Nothing is answered or stored: no slots, and the current card is not part of the attempt.\n */\nexport class FlashCardsElement extends AstlElement {\n static override manifest: ComponentManifest = flashCardsManifest;\n static override messages: readonly MessageCatalog[] = flashCardsUiMessages;\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n slotAssignment: 'manual',\n };\n\n static override properties: PropertyDeclarations = {\n current: { state: true },\n back: { state: true },\n };\n\n static override styles: CSSResultGroup = [\n css`\n .deck {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-3);\n }\n .hint {\n margin: 0;\n color: var(--astl-ink-muted);\n font-size: var(--astl-size-ui);\n }\n button {\n box-sizing: border-box;\n min-block-size: var(--astl-target-min);\n min-inline-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-outline);\n border-radius: var(--astl-radius-m);\n background: var(--astl-surface);\n color: var(--astl-ink);\n font: inherit;\n cursor: pointer;\n }\n .nav > button {\n flex: 1 1 auto;\n font-size: var(--astl-size-ui);\n font-weight: 600;\n white-space: nowrap;\n }\n .nav {\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n gap: var(--astl-space-2);\n }\n `,\n // The card: its position and side in a corner, the side's content in the middle, larger, as running text (its\n // formatting and pictures flow inline, centred); a word too long for the card hyphenates in the content's\n // language. The back is told apart by the words and the accent border, and by its fill where the theme has one.\n css`\n .card {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-3);\n inline-size: 100%;\n min-block-size: 12rem;\n padding: var(--astl-space-4);\n border-radius: var(--astl-radius-l);\n }\n .card[data-side='back'] {\n border-color: var(--astl-accent);\n background: var(--astl-accent-soft);\n }\n .side {\n align-self: flex-start;\n color: var(--astl-ink-muted);\n font-size: var(--astl-size-ui);\n font-weight: 600;\n text-align: start;\n }\n .face {\n flex: 1;\n display: grid;\n place-items: center;\n font-size: 1.5rem;\n overflow-wrap: anywhere;\n hyphens: auto;\n }\n `,\n blockStyles,\n ];\n\n /** Index of the card shown. */\n declare protected current: number;\n /** Whether its back is shown. */\n declare protected back: boolean;\n\n constructor() {\n super();\n this.current = 0;\n this.back = false;\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 /** The fronts, or the backs, of the view in order: the n-th of each make card n. */\n #sides(back: boolean): Element[] {\n const tag = back ? 'astl-back' : 'astl-front';\n return Array.from(this.children).filter((child) => child.localName === tag);\n }\n\n /** The number of cards, the side shown, its caption (position and side), and the card's name: caption and text. */\n #shown(): {\n readonly total: number;\n readonly element: Element | undefined;\n readonly caption: string;\n readonly name: string;\n } {\n const total = this.#sides(false).length;\n const element = this.#sides(this.back)[this.current];\n const caption = this.t('ui.card', { n: this.current + 1, total, side: this.back ? 'back' : 'front' });\n const text = element === undefined ? '' : spoken(element).replace(/\\s+/g, ' ').trim();\n return { total, element, caption, name: this.t('ui.name', { card: caption, text }) };\n }\n\n protected override render(): TemplateResult {\n const { total, caption, name } = this.#shown();\n const ui = this.uiLanguage;\n // UI text in the UI language; the card's content keeps its own (children of a button are not read one by one:\n // its name says position, side and text). The face restates it: Chromium lays slotted content out in the language\n // of the shadow tree around the slot (the button's), so it would hyphenate English in a Polish UI as Polish.\n return html`<div class=\"deck\" part=\"flash-cards\" @keydown=${this.#arrows}>\n <p class=\"hint\" id=\"hint\" lang=${ui.lang} dir=${ui.dir}>${this.t('ui.hint', { total })}</p>\n <button\n type=\"button\"\n class=\"card\"\n part=\"card\"\n data-side=${this.back ? 'back' : 'front'}\n lang=${ui.lang}\n aria-label=${name}\n aria-describedby=\"hint\"\n @click=${this.#turn}\n >\n <span class=\"side\" part=\"side\" dir=${ui.dir}>${caption}</span>\n <span class=\"face\" lang=${this.contentLang || nothing}><slot></slot></span>\n </button>\n ${\n total > 1\n ? html`<div class=\"nav\" part=\"nav\" lang=${ui.lang} dir=${ui.dir}>\n <button type=\"button\" part=\"previous\" @click=${() => this.#move(-1)}>${this.t('ui.previous')}</button>\n <button type=\"button\" part=\"next\" @click=${() => this.#move(1)}>${this.t('ui.next')}</button>\n </div>`\n : nothing\n }\n </div>`;\n }\n\n protected override updated(): void {\n const { element } = this.#shown();\n this.renderRoot.querySelector('slot')?.assign(...(element === undefined ? [] : [element]));\n }\n\n #turn(): void {\n this.back = !this.back;\n // A quarter turn in, as long as the theme's normal duration (0 under reduced motion).\n const duration = Number.parseFloat(getComputedStyle(this).getPropertyValue('--astl-duration-normal'));\n if (duration > 0) {\n this.renderRoot\n .querySelector('.card')\n ?.animate(\n { transform: ['perspective(60rem) rotateY(90deg)', 'none'] },\n { duration, easing: 'ease-out' },\n );\n }\n this.announce(this.#shown().name);\n }\n\n #move(delta: number): void {\n const total = this.#sides(false).length;\n this.current = (this.current + delta + total) % total;\n this.back = false;\n this.announce(this.#shown().name);\n }\n\n #arrows(event: KeyboardEvent): void {\n const delta = arrowDelta(event, 'inline', this);\n if (delta === 0 || this.#sides(false).length < 2) return;\n event.preventDefault();\n this.#move(delta);\n }\n}\n\nexport const flashCardsElement: ElementRegistration = {\n manifest: flashCardsManifest,\n element: FlashCardsElement,\n messages: flashCardsUiMessages,\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={tag:`astl-flash-cards`,version:1,display:`block`,graded:!1,attributes:[],children:[{tag:`astl-front`,visibility:`public`,content:`inline`,min:1,max:50,attributes:[]},{tag:`astl-back`,visibility:`public`,content:`text`,min:1,max:50,attributes:[]}],scoring:null,variants:null,slotKinds:[],issues:[`FLASH_CARDS_UNPAIRED`,`FLASH_CARDS_FRONT_EMPTY`,`FLASH_CARDS_FRONT_LINK`,`FLASH_CARDS_BACK_EMPTY`],messages:`astl.flash-cards`,a11y:{pattern:`one card at a time: a button named by its position, side and text turns it over; previous and next buttons, or the arrow keys, move between cards`,keys:[`Tab`,`Enter`,`Space`,`ArrowLeft`,`ArrowRight`]},cssParts:[`flash-cards`,`card`,`side`,`nav`,`previous`,`next`]},t={"ui.card":`Card {n} of {total}, {side, select, back {back} other {front}}`,"ui.name":`{card}: {text}`,"ui.hint":`{total, plural, one {Press the card to turn it over.} other {Press the card to turn it over. The arrow keys move to the next or previous card.}}`,"ui.previous":`Previous card`,"ui.next":`Next card`},n={"ui.card":`Karta {n} z {total}, {side, select, back {tył} other {przód}}`,"ui.name":`{card}: {text}`,"ui.hint":`{total, plural, one {Naciśnij kartę, aby ją odwrócić.} few {Naciśnij kartę, aby ją odwrócić. Strzałki przechodzą do następnej lub poprzedniej karty.} many {Naciśnij kartę, aby ją odwrócić. Strzałki przechodzą do następnej lub poprzedniej karty.} other {Naciśnij kartę, aby ją odwrócić. Strzałki przechodzą do następnej lub poprzedniej karty.}}`,"ui.previous":`Poprzednia karta`,"ui.next":`Następna karta`};export{t as n,e as r,n as t};
|
|
2
|
+
//# sourceMappingURL=flash-cards-manifest-B8nWXbRy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flash-cards-manifest-B8nWXbRy.js","names":["flashCardsManifest","en_default","pl_default"],"sources":["../../../../components/src/flash-cards/manifest.ts","../../../../components/src/flash-cards/messages/ui/en.json","../../../../components/src/flash-cards/messages/ui/pl.json"],"sourcesContent":["import type { ComponentManifest } from '@astl/core';\n\n/**\n * Cards to learn from, one at a time: the student turns a card over to see its back and moves between cards. Nothing\n * is graded and nothing is stored: no slots, nothing added to the maximum score.\n */\nexport const flashCardsManifest: ComponentManifest = {\n tag: 'astl-flash-cards',\n version: 1,\n display: 'block',\n graded: false,\n attributes: [],\n children: [\n /** The front of a card: text, a picture, or both. The n-th front and the n-th back make card n. */\n { tag: 'astl-front', visibility: 'public', content: 'inline', min: 1, max: 50, attributes: [] },\n /** The back of a card: text. Usually written right after its front. */\n { tag: 'astl-back', visibility: 'public', content: 'text', min: 1, max: 50, attributes: [] },\n ],\n scoring: null,\n variants: null,\n slotKinds: [],\n issues: [\n 'FLASH_CARDS_UNPAIRED',\n 'FLASH_CARDS_FRONT_EMPTY',\n 'FLASH_CARDS_FRONT_LINK',\n 'FLASH_CARDS_BACK_EMPTY',\n ],\n messages: 'astl.flash-cards',\n a11y: {\n pattern:\n 'one card at a time: a button named by its position, side and text turns it over; previous and next buttons, or the arrow keys, move between cards',\n keys: ['Tab', 'Enter', 'Space', 'ArrowLeft', 'ArrowRight'],\n },\n cssParts: ['flash-cards', 'card', 'side', 'nav', 'previous', 'next'],\n};\n","{\n \"ui.card\": \"Card {n} of {total}, {side, select, back {back} other {front}}\",\n \"ui.name\": \"{card}: {text}\",\n \"ui.hint\": \"{total, plural, one {Press the card to turn it over.} other {Press the card to turn it over. The arrow keys move to the next or previous card.}}\",\n \"ui.previous\": \"Previous card\",\n \"ui.next\": \"Next card\"\n}\n","{\n \"ui.card\": \"Karta {n} z {total}, {side, select, back {tył} other {przód}}\",\n \"ui.name\": \"{card}: {text}\",\n \"ui.hint\": \"{total, plural, one {Naciśnij kartę, aby ją odwrócić.} few {Naciśnij kartę, aby ją odwrócić. Strzałki przechodzą do następnej lub poprzedniej karty.} many {Naciśnij kartę, aby ją odwrócić. Strzałki przechodzą do następnej lub poprzedniej karty.} other {Naciśnij kartę, aby ją odwrócić. Strzałki przechodzą do następnej lub poprzedniej karty.}}\",\n \"ui.previous\": \"Poprzednia karta\",\n \"ui.next\": \"Następna karta\"\n}\n"],"mappings":"AAMA,IAAaA,EAAwC,CACnD,IAAK,mBACL,QAAS,EACT,QAAS,QACT,OAAQ,GACR,WAAY,CAAC,EACb,SAAU,CAER,CAAE,IAAK,aAAc,WAAY,SAAU,QAAS,SAAU,IAAK,EAAG,IAAK,GAAI,WAAY,CAAC,CAAE,EAE9F,CAAE,IAAK,YAAa,WAAY,SAAU,QAAS,OAAQ,IAAK,EAAG,IAAK,GAAI,WAAY,CAAC,CAAE,CAC7F,EACA,QAAS,KACT,SAAU,KACV,UAAW,CAAC,EACZ,OAAQ,CACN,uBACA,0BACA,yBACA,wBACF,EACA,SAAU,mBACV,KAAM,CACJ,QACE,oJACF,KAAM,CAAC,MAAO,QAAS,QAAS,YAAa,YAAY,CAC3D,EACA,SAAU,CAAC,cAAe,OAAQ,OAAQ,MAAO,WAAY,MAAM,CACrE,E"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import{C as e,D as t,E as n,b as r,h as i,r as a,v as o,y as s}from"./runtime-DxAbpr3S.js";import{n as c,r as l,t as u}from"./gap-manifest-RSydA41N.js";import{t as d}from"./live-jdiyYln2.js";import{t as f}from"./inline-styles-CTgXWnHb.js";var p=`astl.gap`,m=[{namespace:p,locale:`en`,messages:c},{namespace:p,locale:`pl`,messages:u}],h=40,g=500,_=8,v=t(Array.from({length:h},(e,t)=>`:host([size="${t+1}"]) { --astl-gap-chars: ${t+1}; }`).join(`
|
|
2
|
+
`)),y=``,b=class extends a{static manifest=l;static messages=m;static shadowRootOptions={...s.shadowRootOptions,delegatesFocus:!0};static styles=[n`
|
|
3
|
+
:host {
|
|
4
|
+
--astl-gap-chars: ${_};
|
|
5
|
+
--astl-gap-edges: calc(2 * var(--astl-space-2, 0px) + 2 * var(--astl-outline-width, 0px));
|
|
6
|
+
--astl-gap-icon: 0px;
|
|
7
|
+
--astl-gap-tail: 1ch;
|
|
8
|
+
}
|
|
9
|
+
.field.verdict {
|
|
10
|
+
--astl-gap-icon: calc(1.1em + var(--astl-space-1));
|
|
11
|
+
}
|
|
12
|
+
`,n`
|
|
13
|
+
.control {
|
|
14
|
+
min-inline-size: min(
|
|
15
|
+
calc(var(--astl-gap-chars) * 1ch + var(--astl-gap-edges)),
|
|
16
|
+
calc(100% - var(--astl-gap-icon) - var(--astl-gap-tail))
|
|
17
|
+
);
|
|
18
|
+
max-inline-size: min(
|
|
19
|
+
calc(${h}ch + var(--astl-gap-edges)),
|
|
20
|
+
calc(100% - var(--astl-gap-icon) - var(--astl-gap-tail))
|
|
21
|
+
);
|
|
22
|
+
padding-inline: var(--astl-space-2);
|
|
23
|
+
field-sizing: content;
|
|
24
|
+
}
|
|
25
|
+
`,n`
|
|
26
|
+
:host([variant='resizable']) .control {
|
|
27
|
+
max-inline-size: calc(100% - var(--astl-gap-icon) - var(--astl-gap-tail));
|
|
28
|
+
}
|
|
29
|
+
`,n`
|
|
30
|
+
textarea.control {
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
vertical-align: bottom;
|
|
33
|
+
}
|
|
34
|
+
.control[data-verdict='partial'] {
|
|
35
|
+
border-width: var(--astl-focus-width);
|
|
36
|
+
}
|
|
37
|
+
`,v,f];render(){let t=this.verdict,n=t===`correct`?null:this.solutionValue,{number:a}=this.context,s=this.uiLanguage,c=a>0?this.t(`ui.label`,{n:a}):this.t(`ui.labelPlain`),l=[t===null?``:`verdict`,n===null?``:`solution`].filter(e=>e!==``).join(` `),u={lang:this.contentLang||void 0,describedBy:l||void 0},f=this.numberAttribute(`size`)??_,p=this.disabled?e`<textarea
|
|
38
|
+
part="input"
|
|
39
|
+
class="control"
|
|
40
|
+
data-verdict=${o(t??void 0)}
|
|
41
|
+
rows="1"
|
|
42
|
+
cols=${f}
|
|
43
|
+
maxlength=${g}
|
|
44
|
+
lang=${o(u.lang)}
|
|
45
|
+
spellcheck="false"
|
|
46
|
+
readonly
|
|
47
|
+
aria-label=${c}
|
|
48
|
+
aria-invalid=${t===`incorrect`?`true`:r}
|
|
49
|
+
aria-describedby=${o(u.describedBy)}
|
|
50
|
+
.value=${d(this.value)}
|
|
51
|
+
></textarea>`:e`<input
|
|
52
|
+
part="input"
|
|
53
|
+
class="control"
|
|
54
|
+
data-verdict=${o(t??void 0)}
|
|
55
|
+
type="text"
|
|
56
|
+
inputmode=${o(this.stringAttribute(`type`)===`number`?`decimal`:void 0)}
|
|
57
|
+
size=${f}
|
|
58
|
+
maxlength=${g}
|
|
59
|
+
lang=${o(u.lang)}
|
|
60
|
+
spellcheck="false"
|
|
61
|
+
autocomplete="off"
|
|
62
|
+
autocapitalize="off"
|
|
63
|
+
autocorrect="off"
|
|
64
|
+
aria-label=${c}
|
|
65
|
+
aria-invalid=${t===`incorrect`?`true`:r}
|
|
66
|
+
aria-describedby=${o(u.describedBy)}
|
|
67
|
+
.value=${d(this.value)}
|
|
68
|
+
@input=${e=>this.updateValue(e.target.value)}
|
|
69
|
+
/>`;return e`<span class="gap" part="gap"
|
|
70
|
+
><span class=${t===null?`field`:`field verdict`}
|
|
71
|
+
>${p}${this.renderVerdict(t,{hiddenWord:!0,id:`verdict`})}</span
|
|
72
|
+
>${n===null?r:e`<span class="solution" part="solution" id="solution"
|
|
73
|
+
>${i(`correct`)}<span class="astl-vh" lang=${s.lang} dir=${s.dir}
|
|
74
|
+
>${this.t(`ui.solution`,{answer:n})}</span
|
|
75
|
+
><span aria-hidden="true">${n}</span></span
|
|
76
|
+
>`}</span
|
|
77
|
+
>${y}`}},x={manifest:l,element:b,messages:m};export{x as gapElement};
|
|
78
|
+
//# sourceMappingURL=gap-lor-khst.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gap-lor-khst.js","names":["en","pl","unsafeCSS","LitElement","ifDefined","nothing","live","b","r","i$1","A","verdictIcon","SingleSlotElement","i","en_default","gapManifest","pl_default","l","inlineStyles","namespace","gapUiMessages","MAX_CHARS","MAX_LENGTH","DEFAULT_CHARS","SIZE_RULES","WORD_JOINER","GapElement","verdict","solution","ui","label","number","describedBy","id","common","chars","control","event","gapElement"],"sources":["../../../../components/src/gap/ui-messages.ts","../../../../components/src/gap/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.gap';\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 `gapMessages` would put the authoring strings into the element's chunk.\n */\nexport const gapUiMessages: readonly MessageCatalog[] = [\n { namespace, locale: 'en', messages: en },\n { namespace, locale: 'pl', messages: pl },\n];\n","import type { ComponentManifest, MessageCatalog } from '@astl/core';\nimport { type ElementRegistration, SingleSlotElement, verdictIcon } from '@astl/player';\nimport { type CSSResultGroup, css, html, LitElement, nothing, type TemplateResult, unsafeCSS } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { inlineStyles } from '../inline-styles.js';\nimport { gapManifest } from './manifest.js';\nimport { gapUiMessages } from './ui-messages.js';\n\n/** Widest `inline` gap, in characters: the field grows with the answer up to this, and never past the line. */\nconst MAX_CHARS = 40;\n\n/** Longest answer the field takes. */\nconst MAX_LENGTH = 500;\n\n/** Default width when a view has no `size` (views always write it). */\nconst DEFAULT_CHARS = 8;\n\n/** `:host([size=\"n\"])` rules: the rest width comes from the view's attribute, so the host is never written to. */\nconst SIZE_RULES = unsafeCSS(\n Array.from(\n { length: MAX_CHARS },\n (_, i) => `:host([size=\"${i + 1}\"]) { --astl-gap-chars: ${i + 1}; }`,\n ).join('\\n'),\n);\n\n/** U+2060: keeps the text right after the gap (a full stop, a comma) on the gap's line. */\nconst WORD_JOINER = '';\n\n/**\n * `<astl-gap>`: a text field inside running text. One slot, the element id. Editable it is an `<input>`; read-only\n * (review, handed in) it is a `<textarea readonly>` so a long answer wraps and shows in full. Variants: `inline` grows\n * with the answer up to 40 characters, `resizable` up to the whole line; neither gets narrower than `size`.\n */\nexport class GapElement extends SingleSlotElement {\n static override manifest: ComponentManifest = gapManifest;\n static override messages: readonly MessageCatalog[] = gapUiMessages;\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: 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 tail is room for the punctuation after the gap, so a full-line gap keeps its full stop; the icon is the room\n // the verdict icon takes in the field.\n css`\n :host {\n --astl-gap-chars: ${DEFAULT_CHARS};\n --astl-gap-edges: calc(2 * var(--astl-space-2, 0px) + 2 * var(--astl-outline-width, 0px));\n --astl-gap-icon: 0px;\n --astl-gap-tail: 1ch;\n }\n .field.verdict {\n --astl-gap-icon: calc(1.1em + var(--astl-space-1));\n }\n `,\n // At rest: size characters, also next to a solution. Grows with the answer (field-sizing) up to 40, never past the\n // line; browsers without field-sizing keep the width of the size and cols attributes.\n css`\n .control {\n min-inline-size: min(\n calc(var(--astl-gap-chars) * 1ch + var(--astl-gap-edges)),\n calc(100% - var(--astl-gap-icon) - var(--astl-gap-tail))\n );\n max-inline-size: min(\n calc(${MAX_CHARS}ch + var(--astl-gap-edges)),\n calc(100% - var(--astl-gap-icon) - var(--astl-gap-tail))\n );\n padding-inline: var(--astl-space-2);\n field-sizing: content;\n }\n `,\n // Resizable: no 40-character cap, the line is the limit.\n css`\n :host([variant='resizable']) .control {\n max-inline-size: calc(100% - var(--astl-gap-icon) - var(--astl-gap-tail));\n }\n `,\n // The text after the gap (a full stop) follows the answer's last line. Partial (a double border) takes the focus\n // width, so both of its lines show.\n css`\n textarea.control {\n overflow: hidden;\n vertical-align: bottom;\n }\n .control[data-verdict='partial'] {\n border-width: var(--astl-focus-width);\n }\n `,\n SIZE_RULES,\n inlineStyles,\n ];\n\n protected override render(): TemplateResult {\n const verdict = this.verdict;\n // A correct answer needs no correction: the solution shows for wrong and empty slots only.\n const solution = verdict === 'correct' ? null : this.solutionValue;\n const { number } = this.context;\n const ui = this.uiLanguage;\n const label = number > 0 ? this.t('ui.label', { n: number }) : this.t('ui.labelPlain');\n const describedBy = [verdict === null ? '' : 'verdict', solution === null ? '' : 'solution']\n .filter((id) => id !== '')\n .join(' ');\n // What both controls carry (no attribute for an empty value).\n const common = { lang: this.contentLang || undefined, describedBy: describedBy || undefined };\n const chars = this.numberAttribute('size') ?? DEFAULT_CHARS;\n const control = this.disabled\n ? html`<textarea\n part=\"input\"\n class=\"control\"\n data-verdict=${ifDefined(verdict ?? undefined)}\n rows=\"1\"\n cols=${chars}\n maxlength=${MAX_LENGTH}\n lang=${ifDefined(common.lang)}\n spellcheck=\"false\"\n readonly\n aria-label=${label}\n aria-invalid=${verdict === 'incorrect' ? 'true' : nothing}\n aria-describedby=${ifDefined(common.describedBy)}\n .value=${live(this.value)}\n ></textarea>`\n : html`<input\n part=\"input\"\n class=\"control\"\n data-verdict=${ifDefined(verdict ?? undefined)}\n type=\"text\"\n inputmode=${ifDefined(this.stringAttribute('type') === 'number' ? 'decimal' : undefined)}\n size=${chars}\n maxlength=${MAX_LENGTH}\n lang=${ifDefined(common.lang)}\n spellcheck=\"false\"\n autocomplete=\"off\"\n autocapitalize=\"off\"\n autocorrect=\"off\"\n aria-label=${label}\n aria-invalid=${verdict === 'incorrect' ? 'true' : nothing}\n aria-describedby=${ifDefined(common.describedBy)}\n .value=${live(this.value)}\n @input=${(event: Event) => this.updateValue((event.target as HTMLInputElement).value)}\n />`;\n return html`<span class=\"gap\" part=\"gap\"\n ><span class=${verdict === null ? 'field' : 'field verdict'}\n >${control}${this.renderVerdict(verdict, { hiddenWord: true, id: 'verdict' })}</span\n >${\n solution === null\n ? nothing\n : html`<span class=\"solution\" part=\"solution\" id=\"solution\"\n >${verdictIcon('correct')}<span class=\"astl-vh\" lang=${ui.lang} dir=${ui.dir}\n >${this.t('ui.solution', { answer: solution })}</span\n ><span aria-hidden=\"true\">${solution}</span></span\n >`\n }</span\n >${WORD_JOINER}`;\n }\n}\n\nexport const gapElement: ElementRegistration = {\n manifest: gapManifest,\n element: GapElement,\n messages: gapUiMessages,\n};\n"],"mappings":"A,+OAIA,IAAMmB,EAAY,WAMLC,EAA2C,CACtD,CAAE,YAAW,OAAQ,KAAM,SAAUpB,CAAG,EACxC,CAAE,YAAW,OAAQ,KAAM,SAAUC,CAAG,CAC1C,ECHMoB,EAAY,GAGZC,EAAa,IAGbC,EAAgB,EAGhBC,EAAatB,EACjB,MAAM,KACJ,CAAE,OAAQmB,CAAU,GACnB,EAAG,IAAM,gBAAgBR,EAAI,EAAE,0BAA0BA,EAAI,EAAE,IAClE,CAAC,CAAC,KAAK;CAAI,CACb,EAGMY,EAAc,IAOPC,EAAb,cAAgCd,CAAkB,CAChD,OAAgB,SAA8BG,EAC9C,OAAgB,SAAsCK,EACtD,OAAgB,kBAAoC,CAClD,GAAGjB,EAAW,kBACd,eAAgB,EAClB,EAGA,OAAgB,OAAyB,CAGvC,CAAG;;4BAEqBoB,EAAc;;;;;;;;MAWtC,CAAG;;;;;;;iBAOUF,EAAU;;;;;;MAQvB,CAAG;;;;EAOH,CAAG;;;;;;;;EASHG,EACAN,CACF,EAEA,QAA4C,CAC1C,IAAMS,EAAU,KAAK,QAEfC,EAAWD,IAAY,UAAY,KAAO,KAAK,cAC/C,CAAE,UAAW,KAAK,QAClBE,EAAK,KAAK,WACVC,EAAQC,EAAS,EAAI,KAAK,EAAE,WAAY,CAAE,EAAGA,CAAO,CAAC,EAAI,KAAK,EAAE,eAAe,EAC/EC,EAAc,CAACL,IAAY,KAAO,GAAK,UAAWC,IAAa,KAAO,GAAK,UAAU,CAAC,CACzF,OAAQ,GAAOK,IAAO,EAAE,CAAC,CACzB,KAAK,GAAG,EAELC,EAAS,CAAE,KAAM,KAAK,aAAe,IAAA,GAAW,YAAaF,GAAe,IAAA,EAAU,EACtFG,EAAQ,KAAK,gBAAgB,MAAM,GAAKZ,EACxCa,EAAU,KAAK,SACjB,CAAI;;;yBAGahC,EAAUuB,GAAW,IAAA,EAAS,EAAE;;iBAExCQ,EAAM;sBACDb,EAAW;iBAChBlB,EAAU8B,EAAO,IAAI,EAAE;;;uBAGjBJ,EAAM;yBACJH,IAAY,YAAc,OAAStB,EAAQ;6BACvCD,EAAU8B,EAAO,WAAW,EAAE;mBACxC5B,EAAK,KAAK,KAAK,EAAE;sBAE5B,CAAI;;;yBAGaF,EAAUuB,GAAW,IAAA,EAAS,EAAE;;sBAEnCvB,EAAU,KAAK,gBAAgB,MAAM,IAAM,SAAW,UAAY,IAAA,EAAS,EAAE;iBAClF+B,EAAM;sBACDb,EAAW;iBAChBlB,EAAU8B,EAAO,IAAI,EAAE;;;;;uBAKjBJ,EAAM;yBACJH,IAAY,YAAc,OAAStB,EAAQ;6BACvCD,EAAU8B,EAAO,WAAW,EAAE;mBACxC5B,EAAK,KAAK,KAAK,EAAE;mBAChB,GAAiB,KAAK,YAAa+B,EAAM,OAA4B,KAAK,EAAE;YAE5F,MAAO,EAAI;uBACQV,IAAY,KAAO,QAAU,gBAAgB;aACvDS,IAAU,KAAK,cAAcT,EAAS,CAAE,WAAY,GAAM,GAAI,SAAU,CAAC,EAAE;WAE9EC,IAAa,KACTvB,EACA,CAAI;mBACCM,EAAY,SAAS,EAAE,6BAA6BkB,EAAG,KAAK,OAAOA,EAAG,IAAI;qBACxE,KAAK,EAAE,cAAe,CAAE,OAAQD,CAAS,CAAC,EAAE;4CACrBA,EAAS;iBAE5C;SACAH,GACP,CACF,EAEaa,EAAkC,CAC7C,SAAUvB,EACV,QAASW,EACT,SAAUN,CACZ,E"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={tag:`astl-gap`,version:1,display:`inline`,graded:!0,attributes:[{name:`answer`,type:`string`,visibility:`private`,required:!0},{name:`type`,type:`enum`,values:[`text`,`number`],default:`text`,visibility:`public`},{name:`case`,type:`enum`,values:[`insensitive`,`sensitive`],default:`insensitive`,visibility:`private`},{name:`marks`,type:`enum`,values:[`strict`,`fold`],default:`strict`,visibility:`private`},{name:`tolerance`,type:`number`,min:0,visibility:`private`},{name:`width`,type:`integer`,min:1,max:40,visibility:`private`},{name:`size`,type:`integer`,min:1,max:40,visibility:`derived`}],children:[{tag:`astl-alt`,visibility:`private`,content:`text`,min:0,max:20,attributes:[]}],scoring:{default:`all`,modes:{all:`all-correct`}},variants:{default:`inline`,values:[`inline`,`resizable`]},slotKinds:[`text`,`number`],issues:[`GAP_ANSWER_MISSING`,`GAP_ANSWER_TOO_LONG`,`GAP_NUMBER_INVALID`,`GAP_ALT_EMPTY`,`GAP_ALT_DUPLICATE`,`GAP_TOLERANCE_TEXT`],messages:`astl.gap`,a11y:{pattern:`textbox`,keys:[`Tab`]},cssParts:[`gap`,`input`,`verdict`,`solution`]},t={"ui.label":`Gap {n}`,"ui.labelPlain":`Gap`,"ui.solution":`Correct answer: {answer}`},n={"ui.label":`Luka {n}`,"ui.labelPlain":`Luka`,"ui.solution":`Poprawna odpowiedź: {answer}`};export{t as n,e as r,n as t};
|
|
2
|
+
//# sourceMappingURL=gap-manifest-RSydA41N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gap-manifest-RSydA41N.js","names":["gapManifest","en_default","pl_default"],"sources":["../../../../components/src/gap/manifest.ts","../../../../components/src/gap/messages/ui/en.json","../../../../components/src/gap/messages/ui/pl.json"],"sourcesContent":["import type { ComponentManifest } from '@astl/core';\n\n/** A gap in running text: the student types a word or a number. */\nexport const gapManifest: ComponentManifest = {\n tag: 'astl-gap',\n version: 1,\n display: 'inline',\n graded: true,\n attributes: [\n /** The expected answer, shown as the solution. Numbers use `.` or the content language's decimal comma. */\n { name: 'answer', type: 'string', visibility: 'private', required: true },\n /** `number`: a number in the content language's notation, compared within `tolerance`. */\n { name: 'type', type: 'enum', values: ['text', 'number'], default: 'text', visibility: 'public' },\n /** `sensitive`: capital letters must match. */\n {\n name: 'case',\n type: 'enum',\n values: ['insensitive', 'sensitive'],\n default: 'insensitive',\n visibility: 'private',\n },\n /** `fold`: diacritics do not matter (ą = a, ł = l). */\n { name: 'marks', type: 'enum', values: ['strict', 'fold'], default: 'strict', visibility: 'private' },\n /** Number gaps: accepted distance from `answer`. */\n { name: 'tolerance', type: 'number', min: 0, visibility: 'private' },\n /** Author override of the input width, in characters. */\n { name: 'width', type: 'integer', min: 1, max: 40, visibility: 'private' },\n /** Input width in characters: `width`, else the longest answer rounded up to 4, 8, 12, 20 or 40. */\n { name: 'size', type: 'integer', min: 1, max: 40, visibility: 'derived' },\n ],\n children: [\n /** More accepted answers. */\n { tag: 'astl-alt', visibility: 'private', content: 'text', min: 0, max: 20, attributes: [] },\n ],\n scoring: { default: 'all', modes: { all: 'all-correct' } },\n /** `inline`: grows with the answer up to 40 characters. `resizable`: grows up to the whole line, for long answers. */\n variants: { default: 'inline', values: ['inline', 'resizable'] },\n slotKinds: ['text', 'number'],\n issues: [\n 'GAP_ANSWER_MISSING',\n 'GAP_ANSWER_TOO_LONG',\n 'GAP_NUMBER_INVALID',\n 'GAP_ALT_EMPTY',\n 'GAP_ALT_DUPLICATE',\n 'GAP_TOLERANCE_TEXT',\n ],\n messages: 'astl.gap',\n a11y: { pattern: 'textbox', keys: ['Tab'] },\n cssParts: ['gap', 'input', 'verdict', 'solution'],\n};\n","{\n \"ui.label\": \"Gap {n}\",\n \"ui.labelPlain\": \"Gap\",\n \"ui.solution\": \"Correct answer: {answer}\"\n}\n","{\n \"ui.label\": \"Luka {n}\",\n \"ui.labelPlain\": \"Luka\",\n \"ui.solution\": \"Poprawna odpowiedź: {answer}\"\n}\n"],"mappings":"AAGA,IAAaA,EAAiC,CAC5C,IAAK,WACL,QAAS,EACT,QAAS,SACT,OAAQ,GACR,WAAY,CAEV,CAAE,KAAM,SAAU,KAAM,SAAU,WAAY,UAAW,SAAU,EAAK,EAExE,CAAE,KAAM,OAAQ,KAAM,OAAQ,OAAQ,CAAC,OAAQ,QAAQ,EAAG,QAAS,OAAQ,WAAY,QAAS,EAEhG,CACE,KAAM,OACN,KAAM,OACN,OAAQ,CAAC,cAAe,WAAW,EACnC,QAAS,cACT,WAAY,SACd,EAEA,CAAE,KAAM,QAAS,KAAM,OAAQ,OAAQ,CAAC,SAAU,MAAM,EAAG,QAAS,SAAU,WAAY,SAAU,EAEpG,CAAE,KAAM,YAAa,KAAM,SAAU,IAAK,EAAG,WAAY,SAAU,EAEnE,CAAE,KAAM,QAAS,KAAM,UAAW,IAAK,EAAG,IAAK,GAAI,WAAY,SAAU,EAEzE,CAAE,KAAM,OAAQ,KAAM,UAAW,IAAK,EAAG,IAAK,GAAI,WAAY,SAAU,CAC1E,EACA,SAAU,CAER,CAAE,IAAK,WAAY,WAAY,UAAW,QAAS,OAAQ,IAAK,EAAG,IAAK,GAAI,WAAY,CAAC,CAAE,CAC7F,EACA,QAAS,CAAE,QAAS,MAAO,MAAO,CAAE,IAAK,aAAc,CAAE,EAEzD,SAAU,CAAE,QAAS,SAAU,OAAQ,CAAC,SAAU,WAAW,CAAE,EAC/D,UAAW,CAAC,OAAQ,QAAQ,EAC5B,OAAQ,CACN,qBACA,sBACA,qBACA,gBACA,oBACA,oBACF,EACA,SAAU,WACV,KAAM,CAAE,QAAS,UAAW,KAAM,CAAC,KAAK,CAAE,EAC1C,SAAU,CAAC,MAAO,QAAS,UAAW,UAAU,CAClD,E"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import{C as e,E as t,J as n,b as r,bt as i,c as a,in as o,l as s,ln as c,lt as l,m as u,s as d,u as f,x as p}from"./runtime-DxAbpr3S.js";var m=[{namespace:s,locale:`en`,messages:{"help.label":`Help with this question`,"help.labelField":`Help with field {n}`,"help.labelPage":`Help with this page`,"help.hint":`Hint ({n}/{total})`,"help.hintCost":`Costs {percent}% of the points`,"help.hintItem":`Hint {n}`,"help.hintAnnounce":`Hint {n}: {text}`,"help.check":`this question`,"help.checkField":`field {n}`,"help.why":`Why?`,"error.hints_not_allowed":`Hints are not available in this exercise.`,"error.hints_exhausted":`There are no more hints.`}},{namespace:s,locale:`pl`,messages:{"help.label":`Pomoc do tego pytania`,"help.labelField":`Pomoc do pola {n}`,"help.labelPage":`Pomoc do tej strony`,"help.hint":`Podpowiedź ({n}/{total})`,"help.hintCost":`Kosztuje {percent}% punktów`,"help.hintItem":`Podpowiedź {n}`,"help.hintAnnounce":`Podpowiedź {n}: {text}`,"help.check":`to pytanie`,"help.checkField":`pole {n}`,"help.why":`Dlaczego?`,"error.hints_not_allowed":`W tym zadaniu nie ma podpowiedzi.`,"error.hints_exhausted":`Nie ma już więcej podpowiedzi.`}}],h=/^(?:0|1|0?\.\d{1,6}|1\.0{1,6})$/;function g(e){let t=t=>(e.getAttribute(t)??``).split(` `).filter(Boolean),n=t(`hints`).flatMap(e=>h.test(e)?[Number(e)]:[]),r=new Set(t(`feedback`)),a=i.filter(e=>r.has(e)),o=e.hasAttribute(`explanation`);return n.length===0&&a.length===0&&!o?null:{hints:n,explanation:o,feedback:a}}function _(e,t){let n=document.createElement(`template`);n.innerHTML=o(e);let r=n.content.ownerDocument.createElement(`div`);r.append(n.content),d(r,{manifests:new Map,urlPolicy:t},!1,!1);for(let e of Array.from(r.querySelectorAll(`*`)))e.localName.includes(`-`)&&e.remove();let i=document.importNode(r,!0);return i.className=`help-content`,i}var v=e=>typeof e==`object`&&!!e&&typeof e.html==`string`&&i.includes(e.variant),y=(e,t)=>typeof e==`object`&&e&&Object.hasOwn(e,t)?e[t]:void 0;function b(e){return e.length===0?null:e.every(e=>e===`empty`)?`empty`:e.every(e=>e===`correct`)?`correct`:e.some(e=>e===`correct`||e===`partial`)?`partial`:`incorrect`}var x=e=>Number.isInteger(e)&&e>=0;function S(e){let t=e;for(;t.parentElement!==null&&!/^astl-(page|column|doc)$/.test(t.parentElement.localName);)t=t.parentElement;return t}var C=[`float`,`width`,`inline-size`,`max-width`,`max-inline-size`,`margin`,`margin-inline`,`margin-inline-start`,`margin-inline-end`];function w(e,t){if(!(t instanceof HTMLElement))return;for(let n of C){let r=t.style.getPropertyValue(n);r!==``&&e.style.setProperty(n,r)}let n=t.style.getPropertyValue(`float`);n!==``&&n!==`none`&&e.style.setProperty(`clear`,n)}function T(t){let{controller:i,locale:o}=t,d=i.policy,h=n(d),C=d.mode===`practice`,T=l({catalogs:[...f,...m,...a.catalogs]}).translator(o,s);D(t.root);let E=[],O=new Map,k=(e,t,n)=>{let r=document.createElement(`div`);r.className=`astl-help`,r.setAttribute(`part`,`help`),r.setAttribute(`role`,`group`),r.setAttribute(`aria-label`,n.label),r.lang=o;let i={id:e.id,offer:t,box:r,...n,lang:e.closest(`[lang]`)?.getAttribute(`lang`)??``,dir:e.closest(`[dir]`)?.getAttribute(`dir`)??``,hints:[],used:0,total:t.hints.length,pending:!1,problem:null,verdict:null,feedback:null,explanation:null};return E.push(i),i},A=0;for(let{element:e,manifest:n}of t.mounted){let t=n.display===`inline`;t&&A++;let r=n.graded?g(e):null;if(r===null)continue;let i=A,a=k(e,r,{label:t?T(`help.labelField`,{n:i}):T(`help.label`),check:C&&h.checkScope===`interaction`?t?T(`help.checkField`,{n:i}):T(`help.check`):null,ownVerdict:!t,groups:e.groupIds??[e.id],slots:new Set(e.slotIds)}),o=S(e);(O.get(o)??o).after(a.box),O.set(o,a.box),w(a.box,o)}t.pages.forEach((e,t)=>{let n=e.localName===`astl-page`?g(e):null;if(n===null)return;let r=k(e,n,{label:T(`help.labelPage`),check:null,ownVerdict:!1,groups:[],slots:new Set(i.pages[t]?.slotIds??[])});r.box.dataset.page=``,e.append(r.box)});let j=(e,n)=>{if(typeof e!=`string`)return null;let r=_(e,t.urlPolicy);return n.lang&&(r.lang=n.lang),n.dir&&(r.dir=n.dir),r},M=(e,t)=>{let n=e.result;if(n!==null)for(let r of E){if(t!==null&&r.id!==t)continue;let i=n.groups.filter(e=>r.groups.includes(e.id)).map(e=>e.verdict);if(!(r.groups.length===0?Object.hasOwn(n.pages,r.id):i.length>0))continue;let a=y(e.feedback,r.id);r.verdict=v(a)?a.variant===`omitted`?`empty`:a.variant:b(i),r.feedback=v(a)?j(a.html,r):null,r.explanation=j(y(e.explanations,r.id),r)??r.explanation}},N=()=>{for(let e of E)p(I(e),e.box)},P=async e=>{let n=t.checker();if(!e.pending){e.pending=!0,e.problem=null,N();try{if(n?.hint===void 0)throw n===null?`no_checker`:`hints_not_allowed`;let r=await n.hint({element:e.id}),i=x(r.index)?r.index:e.used,a=j(r.html,e);e.hints=[...e.hints,{n:i+1,content:a}],e.used=i+1,e.total=x(r.left)?e.used+r.left:Math.max(e.total,e.used),t.announce(T(`help.hintAnnounce`,{n:i+1,text:a.textContent?.trim()??``}))}catch(n){let r=n instanceof c?n.problem.code:typeof n==`string`?n:`internal_error`;r===`hints_exhausted`&&(e.total=e.used),e.problem=r,t.announce(F(r))}finally{e.pending=!1;let n=t.root instanceof ShadowRoot?t.root.activeElement:document.activeElement,r=e.box.contains(n);N(),r&&e.used>=e.total&&e.box.querySelector(`.help-hints li:last-child`)?.focus()}}},F=e=>{let t=T(`error.${e}`);return t===`error.${e}`?T(`error.internal_error`):t},I=n=>{let a=!i.readOnly,s=n.used<n.total&&h.hints&&C&&a?n.used:null,c=s===null?0:n.offer.hints[s]??0,l=`astl-help-cost-${E.indexOf(n)}`,d=n.check!==null&&a,f=s!==null||d||n.hints.length>0||n.feedback!==null||n.explanation!==null;return n.box.hidden=!f&&n.problem===null,n.box.hidden?r:e`${s===null&&!d?r:e`<div class="help-actions">
|
|
2
|
+
${s===null?r:e`<span class="help-hint"
|
|
3
|
+
><button
|
|
4
|
+
type="button"
|
|
5
|
+
class="button"
|
|
6
|
+
aria-describedby=${c>0?l:r}
|
|
7
|
+
aria-disabled=${n.pending?`true`:r}
|
|
8
|
+
@click=${()=>void P(n)}
|
|
9
|
+
>
|
|
10
|
+
${T(`help.hint`,{n:s+1,total:n.total})}
|
|
11
|
+
</button>
|
|
12
|
+
${c>0?e`<span class="help-cost" id=${l}
|
|
13
|
+
>${T(`help.hintCost`,{percent:Math.round(c*100)})}</span
|
|
14
|
+
>`:r}</span
|
|
15
|
+
>`}
|
|
16
|
+
${d?e`<button
|
|
17
|
+
type="button"
|
|
18
|
+
class="button"
|
|
19
|
+
aria-disabled=${i.canCheck()?r:`true`}
|
|
20
|
+
@click=${()=>{i.canCheck()&&t.check(n.id)}}
|
|
21
|
+
>
|
|
22
|
+
${T(`action.check`)}<span class="astl-vh"> ${n.check}</span>
|
|
23
|
+
</button>`:r}
|
|
24
|
+
</div>`}
|
|
25
|
+
${n.hints.length===0?r:e`<ol class="help-hints">
|
|
26
|
+
${n.hints.map(t=>e`<li tabindex="-1">
|
|
27
|
+
<span class="help-label">${T(`help.hintItem`,{n:t.n})}</span>${t.content}
|
|
28
|
+
</li>`)}
|
|
29
|
+
</ol>`}
|
|
30
|
+
${n.feedback===null||n.verdict===null?r:e`<div class="help-feedback" data-verdict=${n.verdict} ?data-own=${n.ownVerdict}>
|
|
31
|
+
${u(n.verdict,T,{lang:o,hiddenWord:n.ownVerdict})}${n.feedback}
|
|
32
|
+
</div>`}
|
|
33
|
+
${n.explanation===null?r:e`<details class="help-why">
|
|
34
|
+
<summary>${T(`help.why`)}</summary>
|
|
35
|
+
${n.explanation}
|
|
36
|
+
</details>`}
|
|
37
|
+
${n.problem===null?r:e`<p class="help-problem" role="alert">${F(n.problem)}</p>`}`},L=i.subscribe(e=>{if(e.type===`result`)M(e.response,null);else if(e.type===`element`){M(e.response,e.id);let n=E.find(t=>t.id===e.id);n?.verdict!=null&&t.announce([T(`verdict.${n.verdict}`),n.feedback?.textContent?.trim()].filter(Boolean).join(`. `))}else if(e.type===`answers`){let t=Object.keys(e.answers);for(let e of E)t.some(t=>e.slots.has(t))&&(e.verdict=null,e.feedback=null)}else if(e.type===`reset`)for(let e of E)e.verdict=null,e.feedback=null,e.explanation=null;N()});return N(),{destroy(){L();for(let e of E)e.box.remove()}}}var E=t`
|
|
38
|
+
.canvas .astl-help {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
align-items: flex-start;
|
|
42
|
+
gap: var(--astl-space-2);
|
|
43
|
+
margin-block: 0 var(--astl-space-4);
|
|
44
|
+
font-size: var(--astl-size-ui);
|
|
45
|
+
line-height: 1.4;
|
|
46
|
+
}
|
|
47
|
+
.canvas .astl-help[hidden] {
|
|
48
|
+
display: none;
|
|
49
|
+
}
|
|
50
|
+
.canvas .astl-help[data-page] {
|
|
51
|
+
clear: both;
|
|
52
|
+
padding-block-start: var(--astl-space-3);
|
|
53
|
+
border-block-start: var(--astl-outline-width) solid var(--astl-line);
|
|
54
|
+
}
|
|
55
|
+
.help-actions {
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-wrap: wrap;
|
|
58
|
+
align-items: center;
|
|
59
|
+
gap: var(--astl-space-2) var(--astl-space-5);
|
|
60
|
+
}
|
|
61
|
+
.help-hint {
|
|
62
|
+
display: inline-flex;
|
|
63
|
+
flex-wrap: wrap;
|
|
64
|
+
align-items: center;
|
|
65
|
+
gap: var(--astl-space-1) var(--astl-space-2);
|
|
66
|
+
}
|
|
67
|
+
.help-cost {
|
|
68
|
+
color: var(--astl-ink-muted);
|
|
69
|
+
font-size: var(--astl-size-small);
|
|
70
|
+
}
|
|
71
|
+
.help-hints {
|
|
72
|
+
display: grid;
|
|
73
|
+
gap: var(--astl-space-2);
|
|
74
|
+
margin: 0;
|
|
75
|
+
padding: 0;
|
|
76
|
+
list-style: none;
|
|
77
|
+
}
|
|
78
|
+
.help-hints li,
|
|
79
|
+
.help-feedback,
|
|
80
|
+
.help-why {
|
|
81
|
+
box-sizing: border-box;
|
|
82
|
+
max-inline-size: 100%;
|
|
83
|
+
padding-block: var(--astl-space-2);
|
|
84
|
+
padding-inline: var(--astl-space-3);
|
|
85
|
+
border: var(--astl-outline-width) solid var(--astl-line);
|
|
86
|
+
border-radius: var(--astl-radius-m);
|
|
87
|
+
background: var(--astl-surface-raised);
|
|
88
|
+
color: var(--astl-ink);
|
|
89
|
+
}
|
|
90
|
+
.help-label {
|
|
91
|
+
display: block;
|
|
92
|
+
color: var(--astl-ink-muted);
|
|
93
|
+
font-size: var(--astl-size-small);
|
|
94
|
+
font-weight: 600;
|
|
95
|
+
}
|
|
96
|
+
.help-feedback {
|
|
97
|
+
border-style: var(--astl-verdict-border);
|
|
98
|
+
border-color: var(--astl-verdict-color);
|
|
99
|
+
background: var(--astl-verdict-soft);
|
|
100
|
+
}
|
|
101
|
+
.help-feedback[data-own] {
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: flex-start;
|
|
104
|
+
gap: var(--astl-space-2);
|
|
105
|
+
}
|
|
106
|
+
.help-feedback[data-own] > .astl-verdict {
|
|
107
|
+
block-size: 1lh;
|
|
108
|
+
}
|
|
109
|
+
.help-feedback[data-own] > .help-content {
|
|
110
|
+
flex: 1;
|
|
111
|
+
min-inline-size: 0;
|
|
112
|
+
}
|
|
113
|
+
.help-content > :first-child {
|
|
114
|
+
margin-block-start: 0;
|
|
115
|
+
}
|
|
116
|
+
.help-content > :last-child {
|
|
117
|
+
margin-block-end: 0;
|
|
118
|
+
}
|
|
119
|
+
.help-why {
|
|
120
|
+
padding-block: 0;
|
|
121
|
+
}
|
|
122
|
+
.help-why summary {
|
|
123
|
+
display: flex;
|
|
124
|
+
align-items: center;
|
|
125
|
+
min-block-size: var(--astl-target-min);
|
|
126
|
+
min-inline-size: var(--astl-target-min);
|
|
127
|
+
cursor: pointer;
|
|
128
|
+
font-weight: 600;
|
|
129
|
+
}
|
|
130
|
+
.help-why[open] {
|
|
131
|
+
padding-block-end: var(--astl-space-2);
|
|
132
|
+
}
|
|
133
|
+
.help-problem {
|
|
134
|
+
margin: 0;
|
|
135
|
+
color: var(--astl-ink);
|
|
136
|
+
}
|
|
137
|
+
`.styleSheet;function D(e){E!==void 0&&e instanceof ShadowRoot&&!e.adoptedStyleSheets.includes(E)&&(e.adoptedStyleSheets=[...e.adoptedStyleSheets,E])}export{m as helpMessages,T as mountHelp,_ as readContent,g as readHelp};
|
|
138
|
+
//# sourceMappingURL=help-C-woafz5.js.map
|