@astl/astrolabe 0.0.0 → 0.1.1
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 +134 -0
- package/LICENSE +202 -0
- package/README.md +65 -0
- 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 +82 -4
- 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,146 @@
|
|
|
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{n as s,r as c,t as l}from"./true-false-manifest-B4exv60u.js";import{t as u}from"./live-jdiyYln2.js";import{t as d}from"./block-styles-CKo9x7Vt.js";import{t as f}from"./repeat-CY2W2URZ.js";import{t as p}from"./option-styles-WKzjKmCH.js";var m=`astl.true-false`,h=[{namespace:m,locale:`en`,messages:s},{namespace:m,locale:`pl`,messages:l}],g=[`true`,`false`],_=e=>e===`true`||e===`false`,v=class extends i{static manifest=c;static messages=h;static shadowRootOptions={...o.shadowRootOptions,slotAssignment:`manual`};static properties={picked:{state:!0}};static styles=[t`
|
|
2
|
+
:host {
|
|
3
|
+
container-type: inline-size;
|
|
4
|
+
}
|
|
5
|
+
.statements {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: var(--astl-space-2);
|
|
9
|
+
}
|
|
10
|
+
`,t`
|
|
11
|
+
.statement {
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
display: grid;
|
|
14
|
+
grid-template-columns: minmax(0, 1fr);
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: var(--astl-space-2) var(--astl-space-4);
|
|
17
|
+
padding: var(--astl-space-3);
|
|
18
|
+
border: var(--astl-outline-width) solid var(--astl-line);
|
|
19
|
+
border-radius: var(--astl-radius-m);
|
|
20
|
+
background: var(--astl-surface);
|
|
21
|
+
}
|
|
22
|
+
.text {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: baseline;
|
|
25
|
+
gap: var(--astl-space-2);
|
|
26
|
+
min-inline-size: 0;
|
|
27
|
+
overflow-wrap: break-word;
|
|
28
|
+
}
|
|
29
|
+
.text > :last-child {
|
|
30
|
+
min-inline-size: 0;
|
|
31
|
+
}
|
|
32
|
+
.pair {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-wrap: wrap;
|
|
35
|
+
gap: var(--astl-space-2);
|
|
36
|
+
}
|
|
37
|
+
.pair .option {
|
|
38
|
+
flex: 1 1 0;
|
|
39
|
+
max-inline-size: 100%;
|
|
40
|
+
hyphens: manual;
|
|
41
|
+
overflow-wrap: break-word;
|
|
42
|
+
}
|
|
43
|
+
@container (min-inline-size: 36rem) {
|
|
44
|
+
.statement {
|
|
45
|
+
grid-template-columns: minmax(0, 1fr) fit-content(50%);
|
|
46
|
+
}
|
|
47
|
+
.pair {
|
|
48
|
+
display: grid;
|
|
49
|
+
grid-template-columns: 1fr 1fr;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
`,t`
|
|
53
|
+
.number {
|
|
54
|
+
flex: none;
|
|
55
|
+
min-inline-size: 1.5em;
|
|
56
|
+
color: var(--astl-ink-muted);
|
|
57
|
+
font-weight: 600;
|
|
58
|
+
font-variant-numeric: tabular-nums;
|
|
59
|
+
text-align: end;
|
|
60
|
+
}
|
|
61
|
+
`,t`
|
|
62
|
+
.option {
|
|
63
|
+
position: relative;
|
|
64
|
+
box-sizing: border-box;
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
gap: var(--astl-space-2);
|
|
68
|
+
min-block-size: var(--astl-target-min);
|
|
69
|
+
padding-block: var(--astl-space-1);
|
|
70
|
+
padding-inline: var(--astl-space-3);
|
|
71
|
+
border: var(--astl-outline-width) solid var(--astl-outline);
|
|
72
|
+
border-radius: var(--astl-radius-m);
|
|
73
|
+
background: var(--astl-surface);
|
|
74
|
+
font-size: var(--astl-size-ui);
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
overflow: clip;
|
|
77
|
+
}
|
|
78
|
+
.option[data-selected] {
|
|
79
|
+
font-weight: var(--astl-selected-weight);
|
|
80
|
+
}
|
|
81
|
+
`,t`
|
|
82
|
+
.label {
|
|
83
|
+
display: inline-grid;
|
|
84
|
+
}
|
|
85
|
+
.label > * {
|
|
86
|
+
grid-area: 1 / 1;
|
|
87
|
+
}
|
|
88
|
+
.sizer {
|
|
89
|
+
visibility: hidden;
|
|
90
|
+
font-weight: var(--astl-selected-weight);
|
|
91
|
+
}
|
|
92
|
+
.option:has(input:disabled) {
|
|
93
|
+
cursor: default;
|
|
94
|
+
}
|
|
95
|
+
`,t`
|
|
96
|
+
.note {
|
|
97
|
+
grid-column: 1 / -1;
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-wrap: wrap;
|
|
100
|
+
align-items: center;
|
|
101
|
+
gap: var(--astl-space-1) var(--astl-space-4);
|
|
102
|
+
font-size: var(--astl-size-ui);
|
|
103
|
+
}
|
|
104
|
+
.group-verdict {
|
|
105
|
+
margin-block: var(--astl-space-3) 0;
|
|
106
|
+
}
|
|
107
|
+
`,p,d];constructor(){super(),this.picked=new Map}get statements(){return this.childElements(`astl-statement`)}get slotIds(){return this.statements.map(e=>e.id)}getAnswers(){let e={};for(let t of this.slotIds){let n=this.picked.get(t);n!==void 0&&(e[t]=n)}return e}setAnswers(e){let t=new Map(this.picked);for(let n of this.slotIds){let r=e[n];r!==void 0&&(_(r)?t.set(n,r):t.delete(n))}this.picked=t}units(){let e=this.slotIds;return{answered:e.filter(e=>this.picked.has(e)).length,total:e.length}}get#e(){let[e=``,t=``]=g.map(e=>(this.getAttribute(`${e}-label`)??``).trim());return e!==``&&t!==``?{true:e,false:t}:null}render(){let t=this.statements,[n]=t.length===1?t:[],r=n!==void 0&&this.picked.has(n.id)&&this.slotVerdict(n.id)!==null,i=this.uiLanguage,a=this.#e,o=t.length,s=a===null?this.t(`ui.hint`,{count:o}):this.t(`ui.hintNamed`,{count:o,yes:a.true,no:a.false});return e`<fieldset part="true-false">
|
|
108
|
+
<legend part="prompt">
|
|
109
|
+
<slot data-tag="astl-prompt"></slot>
|
|
110
|
+
<span class="hint" lang=${i.lang}><bdi>${s}</bdi></span>
|
|
111
|
+
</legend>
|
|
112
|
+
<div class="statements">
|
|
113
|
+
${f(t,e=>e.id,(e,t)=>this.#t(e.id,t,a,o>1))}
|
|
114
|
+
</div>
|
|
115
|
+
${this.renderGroupVerdict(r?null:this.groupVerdict)}
|
|
116
|
+
</fieldset>`}#t(t,i,o,s){let c=this.picked.get(t)??null,l=Object.keys(this.feedback?.slots??{}).length>0,d=c===null?l?`empty`:null:this.slotVerdict(t),f=this.solution?.[t],p=_(f)&&d!==`correct`?f:null,m=this.uiLanguage,h=o===null?m:{lang:void 0,dir:void 0},v=e=>o?.[e]??this.t(`ui.${e}`),y=[d===null?``:`verdict-${i}`,p===null?``:`solution-${i}`].filter(e=>e!==``).join(` `);return e`<div class="statement astl-box" part="statement" data-verdict=${a(d??void 0)}>
|
|
117
|
+
<span class="text" id="text-${i}"
|
|
118
|
+
>${s?e`<span class="number">${i+1}</span>`:n}<span
|
|
119
|
+
><slot data-statement=${t}></slot></span
|
|
120
|
+
></span>
|
|
121
|
+
<div class="pair" role="radiogroup" aria-labelledby="text-${i}">
|
|
122
|
+
${g.map(r=>{let i=v(r);return e`<label class="option astl-ring" part="option" ?data-selected=${c===r}>
|
|
123
|
+
<input
|
|
124
|
+
part="control"
|
|
125
|
+
type="radio"
|
|
126
|
+
name=${t}
|
|
127
|
+
value=${r}
|
|
128
|
+
.checked=${u(c===r)}
|
|
129
|
+
?disabled=${this.disabled}
|
|
130
|
+
aria-describedby=${y===``?n:y}
|
|
131
|
+
@change=${()=>this.#n(t,r)}
|
|
132
|
+
/>
|
|
133
|
+
<span class="label" lang=${a(h.lang)} dir=${a(h.dir)}
|
|
134
|
+
><span>${i}</span>${g.map(t=>e`<span class="sizer" aria-hidden="true">${v(t)}</span>`)}</span
|
|
135
|
+
>
|
|
136
|
+
</label>`})}
|
|
137
|
+
</div>
|
|
138
|
+
${d===null&&p===null?n:e`<div class="note">
|
|
139
|
+
${this.renderVerdict(d,{id:`verdict-${i}`})}
|
|
140
|
+
${p===null?n:e`<p class="astl-solution" part="solution" id="solution-${i}" lang=${m.lang} dir=${m.dir}>
|
|
141
|
+
${r(`correct`)}<span class="astl-solution-label">${this.t(`ui.solution`)}</span>
|
|
142
|
+
<bdi lang=${a(o===null?void 0:this.contentLang||void 0)}>${v(p)}</bdi>
|
|
143
|
+
</p>`}
|
|
144
|
+
</div>`}
|
|
145
|
+
</div>`}#n(e,t){if(this.disabled||this.picked.get(e)===t)return;let n=new Map(this.picked);n.set(e,t),this.picked=n,this.emitChange({[e]:t})}},y={manifest:c,element:v,messages:h};export{y as trueFalseElement};
|
|
146
|
+
//# sourceMappingURL=true-false-DP3MO599.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"true-false-DP3MO599.js","names":["en","pl","LitElement","repeat","ifDefined","nothing","live","b","i$1","A","verdictIcon","AstlElement","o","i","en_default","trueFalseManifest","pl_default","l","blockStyles","c","optionStyles","namespace","trueFalseUiMessages","VALUES","isValue","value","TrueFalseElement","statement","answers","id","next","ids","#names","yes","no","statements","only","repeated","ui","names","count","hint","#renderStatement","index","picked","marked","verdict","shown","answer","lang","labelOf","describedBy","ref","numbered","label","#pick","name","trueFalseElement"],"sources":["../../../../components/src/true-false/ui-messages.ts","../../../../components/src/true-false/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.true-false';\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 `trueFalseMessages` would put the authoring strings into the element's chunk.\n */\nexport const trueFalseUiMessages: readonly MessageCatalog[] = [\n { namespace, locale: 'en', messages: en },\n { namespace, locale: 'pl', messages: pl },\n];\n","import type { Answers, ComponentManifest, MessageCatalog, Units } from '@astl/core';\nimport { AstlElement, type ElementRegistration, verdictIcon } from '@astl/player';\nimport {\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 { trueFalseManifest } from './manifest.js';\nimport { trueFalseUiMessages } from './ui-messages.js';\n\n/** The two answers of every statement, in the order each pair shows them. */\nconst VALUES = ['true', 'false'] as const;\ntype Value = (typeof VALUES)[number];\n\nconst isValue = (value: string | undefined): value is Value => value === 'true' || value === 'false';\n\n/**\n * `<astl-true-false>`: one radio group per statement (a native pair \"True\" / \"False\", named by the statement text)\n * in one shadow root, so the browser provides the keyboard: Tab moves between statements, arrow keys within a pair.\n * The light-DOM `<astl-prompt>` and `<astl-statement>` children are slotted manually and never moved or changed.\n * Slots: one per statement (its id), answered `true` or `false`; an unanswered statement has no answer at all.\n * No `delegatesFocus`: a click on a statement's text must not move focus to the first statement.\n */\nexport class TrueFalseElement extends AstlElement {\n static override manifest: ComponentManifest = trueFalseManifest;\n static override messages: readonly MessageCatalog[] = trueFalseUiMessages;\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n slotAssignment: 'manual',\n };\n\n static override properties: PropertyDeclarations = {\n picked: { 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 rows follow the width the block gets, not the viewport (players sit in any layout).\n css`\n :host {\n container-type: inline-size;\n }\n .statements {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-2);\n }\n `,\n // Narrow: the statement, its pair across the full width under it, then its verdict and solution. The two buttons\n // share the row in equal halves while both names fit whole, else one per row (a column of a layout can be narrower\n // than the pair): a name never hyphenates and breaks inside a word only when that word is wider than the row. Wide\n // (see the container query): the pair beside the statement, the same width in every row, at most half of it (long\n // button names wrap between words). A row without a verdict or a solution has no third line, so pristine rows stay\n // compact.\n css`\n .statement {\n box-sizing: border-box;\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n align-items: center;\n gap: var(--astl-space-2) var(--astl-space-4);\n padding: var(--astl-space-3);\n border: var(--astl-outline-width) solid var(--astl-line);\n border-radius: var(--astl-radius-m);\n background: var(--astl-surface);\n }\n .text {\n display: flex;\n align-items: baseline;\n gap: var(--astl-space-2);\n min-inline-size: 0;\n overflow-wrap: break-word;\n }\n .text > :last-child {\n min-inline-size: 0;\n }\n .pair {\n display: flex;\n flex-wrap: wrap;\n gap: var(--astl-space-2);\n }\n .pair .option {\n flex: 1 1 0;\n max-inline-size: 100%;\n hyphens: manual;\n overflow-wrap: break-word;\n }\n @container (min-inline-size: 36rem) {\n .statement {\n grid-template-columns: minmax(0, 1fr) fit-content(50%);\n }\n .pair {\n display: grid;\n grid-template-columns: 1fr 1fr;\n }\n }\n `,\n // The statement's number: a column of its own, so a long statement wraps under its text, not under the number.\n css`\n .number {\n flex: none;\n min-inline-size: 1.5em;\n color: var(--astl-ink-muted);\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n text-align: end;\n }\n `,\n // Selected: the fill and the bar of optionStyles; in hc also bold text (selected-weight).\n css`\n .option {\n position: relative;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: var(--astl-space-2);\n min-block-size: var(--astl-target-min);\n padding-block: var(--astl-space-1);\n padding-inline: 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 font-size: var(--astl-size-ui);\n cursor: pointer;\n overflow: clip;\n }\n .option[data-selected] {\n font-weight: var(--astl-selected-weight);\n }\n `,\n // The label keeps the width of the wider name in its selected form (bold in hc): aria-hidden copies of both names\n // in that weight share its grid cell, so the two buttons are equal halves until they stack, and a pick never\n // widens its pair out of line with the other rows.\n css`\n .label {\n display: inline-grid;\n }\n .label > * {\n grid-area: 1 / 1;\n }\n .sizer {\n visibility: hidden;\n font-weight: var(--astl-selected-weight);\n }\n .option:has(input:disabled) {\n cursor: default;\n }\n `,\n // Under the pair: the verdict and the solution line (block-styles.ts).\n css`\n .note {\n grid-column: 1 / -1;\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--astl-space-1) var(--astl-space-4);\n font-size: var(--astl-size-ui);\n }\n .group-verdict {\n margin-block: var(--astl-space-3) 0;\n }\n `,\n optionStyles,\n blockStyles,\n ];\n\n /** Answers by statement id. */\n declare protected picked: ReadonlyMap<string, Value>;\n\n constructor() {\n super();\n this.picked = new Map();\n }\n\n /** `<astl-statement>` children in view order. */\n get statements(): readonly HTMLElement[] {\n return this.childElements('astl-statement');\n }\n\n get slotIds(): readonly string[] {\n return this.statements.map((statement) => statement.id);\n }\n\n getAnswers(): Answers {\n const answers: Record<string, string> = {};\n for (const id of this.slotIds) {\n const value = this.picked.get(id);\n if (value !== undefined) answers[id] = value;\n }\n return answers;\n }\n\n setAnswers(answers: Answers): void {\n const next = new Map(this.picked);\n for (const id of this.slotIds) {\n const value = answers[id];\n if (value === undefined) continue;\n // `''` clears; anything but `true` or `false` cannot be shown, so it clears too.\n if (isValue(value)) next.set(id, value);\n else next.delete(id);\n }\n this.picked = next;\n }\n\n /** One unit per statement: \"2 empty answers\" means two statements nobody marked. */\n units(): Units {\n const ids = this.slotIds;\n return { answered: ids.filter((id) => this.picked.has(id)).length, total: ids.length };\n }\n\n /** The author's names of the two buttons (content), or null for the UI's \"True\" and \"False\": both or neither. */\n get #names(): Readonly<Record<Value, string>> | null {\n const [yes = '', no = ''] = VALUES.map((value) => (this.getAttribute(`${value}-label`) ?? '').trim());\n return yes !== '' && no !== '' ? { true: yes, false: no } : null;\n }\n\n protected override render(): TemplateResult {\n const statements = this.statements;\n const [only] = statements.length === 1 ? statements : [];\n // A single statement that shows its verdict already says what the block line would repeat.\n const repeated = only !== undefined && this.picked.has(only.id) && this.slotVerdict(only.id) !== null;\n const ui = this.uiLanguage;\n const names = this.#names;\n const count = statements.length;\n const hint =\n names === null\n ? this.t('ui.hint', { count })\n : this.t('ui.hintNamed', { count, yes: names.true, no: names.false });\n return html`<fieldset part=\"true-false\">\n <legend part=\"prompt\">\n <slot data-tag=\"astl-prompt\"></slot>\n <span class=\"hint\" lang=${ui.lang}><bdi>${hint}</bdi></span>\n </legend>\n <div class=\"statements\">\n ${repeat(\n statements,\n (statement) => statement.id,\n (statement, index) => this.#renderStatement(statement.id, index, names, count > 1),\n )}\n </div>\n ${this.renderGroupVerdict(repeated ? null : this.groupVerdict)}\n </fieldset>`;\n }\n\n #renderStatement(\n id: string,\n index: number,\n names: Readonly<Record<Value, string>> | null,\n numbered: boolean,\n ): TemplateResult {\n const picked = this.picked.get(id) ?? null;\n // Where statements are marked one by one, an unanswered one shows \"no answer\" (dotted), as in every type.\n const marked = Object.keys(this.feedback?.slots ?? {}).length > 0;\n const verdict = picked === null ? (marked ? 'empty' : null) : this.slotVerdict(id);\n const shown = this.solution?.[id];\n // One clear indicator: a statement whose answer shows \"correct\" needs no solution line.\n const answer = isValue(shown) && verdict !== 'correct' ? shown : null;\n const ui = this.uiLanguage;\n // The author's names are content and keep its language; the UI's carry the UI language.\n const lang = names === null ? ui : { lang: undefined, dir: undefined };\n const labelOf = (value: Value) => names?.[value] ?? this.t(`ui.${value}`);\n const describedBy = [\n verdict === null ? '' : `verdict-${index}`,\n answer === null ? '' : `solution-${index}`,\n ]\n .filter((ref) => ref !== '')\n .join(' ');\n // The number is part of the text that names the pair: \"2 The Moon is a planet\".\n return html`<div class=\"statement astl-box\" part=\"statement\" data-verdict=${ifDefined(verdict ?? undefined)}>\n <span class=\"text\" id=\"text-${index}\"\n >${numbered ? html`<span class=\"number\">${index + 1}</span>` : nothing}<span\n ><slot data-statement=${id}></slot></span\n ></span>\n <div class=\"pair\" role=\"radiogroup\" aria-labelledby=\"text-${index}\">\n ${VALUES.map((value) => {\n const label = labelOf(value);\n return html`<label class=\"option astl-ring\" part=\"option\" ?data-selected=${picked === value}>\n <input\n part=\"control\"\n type=\"radio\"\n name=${id}\n value=${value}\n .checked=${live(picked === value)}\n ?disabled=${this.disabled}\n aria-describedby=${describedBy === '' ? nothing : describedBy}\n @change=${() => this.#pick(id, value)}\n />\n <span class=\"label\" lang=${ifDefined(lang.lang)} dir=${ifDefined(lang.dir)}\n ><span>${label}</span>${VALUES.map(\n (name) => html`<span class=\"sizer\" aria-hidden=\"true\">${labelOf(name)}</span>`,\n )}</span\n >\n </label>`;\n })}\n </div>\n ${\n verdict === null && answer === null\n ? nothing\n : html`<div class=\"note\">\n ${this.renderVerdict(verdict, { id: `verdict-${index}` })}\n ${\n answer === null\n ? nothing\n : // A UI sentence around the answer's name, which keeps its own language.\n html`<p class=\"astl-solution\" part=\"solution\" id=\"solution-${index}\" lang=${ui.lang} dir=${ui.dir}>\n ${verdictIcon('correct')}<span class=\"astl-solution-label\">${this.t('ui.solution')}</span>\n <bdi lang=${ifDefined(names === null ? undefined : this.contentLang || undefined)}>${labelOf(answer)}</bdi>\n </p>`\n }\n </div>`\n }\n </div>`;\n }\n\n #pick(id: string, value: Value): void {\n if (this.disabled || this.picked.get(id) === value) return;\n const next = new Map(this.picked);\n next.set(id, value);\n this.picked = next;\n this.emitChange({ [id]: value });\n }\n}\n\nexport const trueFalseElement: ElementRegistration = {\n manifest: trueFalseManifest,\n element: TrueFalseElement,\n messages: trueFalseUiMessages,\n};\n"],"mappings":"A,uUAIA,IAAMqB,EAAY,kBAMLC,EAAiD,CAC5D,CAAE,YAAW,OAAQ,KAAM,SAAUtB,CAAG,EACxC,CAAE,YAAW,OAAQ,KAAM,SAAUC,CAAG,CAC1C,ECOMsB,EAAS,CAAC,OAAQ,OAAO,EAGzBC,EAAW,GAA8CC,IAAU,QAAUA,IAAU,QAShFC,EAAb,cAAsCf,CAAY,CAChD,OAAgB,SAA8BI,EAC9C,OAAgB,SAAsCO,EACtD,OAAgB,kBAAoC,CAClD,GAAGpB,EAAW,kBACd,eAAgB,QAClB,EAEA,OAAgB,WAAmC,CACjD,OAAQ,CAAE,MAAO,EAA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AAID,EAAIJ,CAAK,EAClB,KAAK,OAASK,EACd,KAAK,WAAW,EAAGD,GAAKJ,CAAM,CAAC,CACjC,CACF,EAEagC,EAAwC,CACnD,SAAU1C,EACV,QAASW,EACT,SAAUJ,CACZ,E"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={tag:`astl-true-false`,version:1,display:`block`,graded:!0,attributes:[{name:`true-label`,type:`string`,visibility:`public`},{name:`false-label`,type:`string`,visibility:`public`}],children:[{tag:`astl-prompt`,visibility:`public`,content:`inline`,min:0,max:1,attributes:[]},{tag:`astl-statement`,visibility:`public`,content:`inline`,min:1,max:12,attributes:[{name:`id`,type:`id`,visibility:`public`,required:!0},{name:`answer`,type:`enum`,values:[`true`,`false`],visibility:`private`,required:!0}]}],scoring:{default:`all`,modes:{all:`all-correct`,"per-statement":`proportional`}},variants:null,slotKinds:[`choice`],issues:[`TRUE_FALSE_STATEMENT_EMPTY`,`TRUE_FALSE_STATEMENT_DUPLICATE`,`TRUE_FALSE_LABEL_ALONE`,`TRUE_FALSE_LABEL_EMPTY`,`TRUE_FALSE_LABEL_TOO_LONG`,`TRUE_FALSE_LABEL_SAME`],messages:`astl.true-false`,a11y:{pattern:`one radio group per statement, named by its number and the statement`,keys:[`Tab`,`ArrowDown`,`ArrowUp`,`ArrowRight`,`ArrowLeft`,`Space`]},cssParts:[`true-false`,`prompt`,`statement`,`option`,`control`,`verdict`,`solution`]},t={"ui.hint":`{count, plural, one {Is the statement true or false?} other {Decide for each statement: true or false.}}`,"ui.hintNamed":`{count, plural, one {Choose “{yes}” or “{no}”.} other {For each statement, choose “{yes}” or “{no}”.}}`,"ui.true":`True`,"ui.false":`False`,"ui.solution":`Correct answer:`},n={"ui.hint":`{count, plural, one {Oceń zdanie: prawda czy fałsz.} few {Oceń każde zdanie: prawda czy fałsz.} many {Oceń każde zdanie: prawda czy fałsz.} other {Oceń każde zdanie: prawda czy fałsz.}}`,"ui.hintNamed":`{count, plural, one {Wybierz „{yes}” albo „{no}”.} few {Przy każdym zdaniu wybierz „{yes}” albo „{no}”.} many {Przy każdym zdaniu wybierz „{yes}” albo „{no}”.} other {Przy każdym zdaniu wybierz „{yes}” albo „{no}”.}}`,"ui.true":`Prawda`,"ui.false":`Fałsz`,"ui.solution":`Poprawna odpowiedź:`};export{t as n,e as r,n as t};
|
|
2
|
+
//# sourceMappingURL=true-false-manifest-B4exv60u.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"true-false-manifest-B4exv60u.js","names":["trueFalseManifest","en_default","pl_default"],"sources":["../../../../components/src/true-false/manifest.ts","../../../../components/src/true-false/messages/ui/en.json","../../../../components/src/true-false/messages/ui/pl.json"],"sourcesContent":["import type { ComponentManifest } from '@astl/core';\n\n/**\n * Statements the student marks true or false, each with its own pair of radio buttons, numbered when there are several.\n * Every statement grades one `choice` slot answered `true` or `false`, so an unanswered statement stays unanswered,\n * never false. The buttons say \"True\" and \"False\" in the UI language, or what the author names them (\"Tak\" / \"Nie\").\n */\nexport const trueFalseManifest: ComponentManifest = {\n tag: 'astl-true-false',\n version: 1,\n display: 'block',\n graded: true,\n attributes: [\n /** The author's name for the button that answers \"true\" (\"Yes\"), in the content language; both or neither. */\n { name: 'true-label', type: 'string', visibility: 'public' },\n /** The author's name for the button that answers \"false\" (\"No\"). */\n { name: 'false-label', type: 'string', visibility: 'public' },\n ],\n children: [\n /** The instruction above the statements. */\n { tag: 'astl-prompt', visibility: 'public', content: 'inline', min: 0, max: 1, attributes: [] },\n /**\n * One statement: `id` is local to the block, `answer` (private) says whether the statement is true. At most 12, so\n * a block stays readable on a phone; split longer lists into several blocks.\n */\n {\n tag: 'astl-statement',\n visibility: 'public',\n content: 'inline',\n min: 1,\n max: 12,\n attributes: [\n { name: 'id', type: 'id', visibility: 'public', required: true },\n { name: 'answer', type: 'enum', values: ['true', 'false'], visibility: 'private', required: true },\n ],\n },\n ],\n scoring: { default: 'all', modes: { all: 'all-correct', 'per-statement': 'proportional' } },\n variants: null,\n slotKinds: ['choice'],\n issues: [\n 'TRUE_FALSE_STATEMENT_EMPTY',\n 'TRUE_FALSE_STATEMENT_DUPLICATE',\n 'TRUE_FALSE_LABEL_ALONE',\n 'TRUE_FALSE_LABEL_EMPTY',\n 'TRUE_FALSE_LABEL_TOO_LONG',\n 'TRUE_FALSE_LABEL_SAME',\n ],\n messages: 'astl.true-false',\n a11y: {\n pattern: 'one radio group per statement, named by its number and the statement',\n keys: ['Tab', 'ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft', 'Space'],\n },\n cssParts: ['true-false', 'prompt', 'statement', 'option', 'control', 'verdict', 'solution'],\n};\n","{\n \"ui.hint\": \"{count, plural, one {Is the statement true or false?} other {Decide for each statement: true or false.}}\",\n \"ui.hintNamed\": \"{count, plural, one {Choose “{yes}” or “{no}”.} other {For each statement, choose “{yes}” or “{no}”.}}\",\n \"ui.true\": \"True\",\n \"ui.false\": \"False\",\n \"ui.solution\": \"Correct answer:\"\n}\n","{\n \"ui.hint\": \"{count, plural, one {Oceń zdanie: prawda czy fałsz.} few {Oceń każde zdanie: prawda czy fałsz.} many {Oceń każde zdanie: prawda czy fałsz.} other {Oceń każde zdanie: prawda czy fałsz.}}\",\n \"ui.hintNamed\": \"{count, plural, one {Wybierz „{yes}” albo „{no}”.} few {Przy każdym zdaniu wybierz „{yes}” albo „{no}”.} many {Przy każdym zdaniu wybierz „{yes}” albo „{no}”.} other {Przy każdym zdaniu wybierz „{yes}” albo „{no}”.}}\",\n \"ui.true\": \"Prawda\",\n \"ui.false\": \"Fałsz\",\n \"ui.solution\": \"Poprawna odpowiedź:\"\n}\n"],"mappings":"AAOA,IAAaA,EAAuC,CAClD,IAAK,kBACL,QAAS,EACT,QAAS,QACT,OAAQ,GACR,WAAY,CAEV,CAAE,KAAM,aAAc,KAAM,SAAU,WAAY,QAAS,EAE3D,CAAE,KAAM,cAAe,KAAM,SAAU,WAAY,QAAS,CAC9D,EACA,SAAU,CAER,CAAE,IAAK,cAAe,WAAY,SAAU,QAAS,SAAU,IAAK,EAAG,IAAK,EAAG,WAAY,CAAC,CAAE,EAK9F,CACE,IAAK,iBACL,WAAY,SACZ,QAAS,SACT,IAAK,EACL,IAAK,GACL,WAAY,CACV,CAAE,KAAM,KAAM,KAAM,KAAM,WAAY,SAAU,SAAU,EAAK,EAC/D,CAAE,KAAM,SAAU,KAAM,OAAQ,OAAQ,CAAC,OAAQ,OAAO,EAAG,WAAY,UAAW,SAAU,EAAK,CACnG,CACF,CACF,EACA,QAAS,CAAE,QAAS,MAAO,MAAO,CAAE,IAAK,cAAe,gBAAiB,cAAe,CAAE,EAC1F,SAAU,KACV,UAAW,CAAC,QAAQ,EACpB,OAAQ,CACN,6BACA,iCACA,yBACA,yBACA,4BACA,uBACF,EACA,SAAU,kBACV,KAAM,CACJ,QAAS,uEACT,KAAM,CAAC,MAAO,YAAa,UAAW,aAAc,YAAa,OAAO,CAC1E,EACA,SAAU,CAAC,aAAc,SAAU,YAAa,SAAU,UAAW,UAAW,UAAU,CAC5F,E"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import{C as e,E as t,b as n,n as r,v as i}from"./runtime-DxAbpr3S.js";import{n as a,r as o,t as s}from"./video-manifest-8OwkhhAI.js";import{t as c}from"./block-styles-CKo9x7Vt.js";var l=`astl.video`,u=[{namespace:l,locale:`en`,messages:a},{namespace:l,locale:`pl`,messages:s}],d={youtube:e=>`https://www.youtube-nocookie.com/embed/${encodeURIComponent(e)}?autoplay=1`,vimeo:e=>`https://player.vimeo.com/video/${encodeURIComponent(e)}?autoplay=1&dnt=1`};function f(e,t){try{return new Intl.DisplayNames([t],{type:`language`}).of(e)??e}catch{return e}}var p=class extends r{static manifest=o;static messages=u;static properties={playing:{state:!0}};static styles=[t`
|
|
2
|
+
.title {
|
|
3
|
+
margin-block: 0 var(--astl-space-2);
|
|
4
|
+
font-weight: 600;
|
|
5
|
+
}
|
|
6
|
+
.frame {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
display: block;
|
|
9
|
+
inline-size: 100%;
|
|
10
|
+
aspect-ratio: 16 / 9;
|
|
11
|
+
border: 0;
|
|
12
|
+
border-radius: var(--astl-radius-l);
|
|
13
|
+
background: var(--astl-surface-raised);
|
|
14
|
+
}
|
|
15
|
+
`,t`
|
|
16
|
+
.facade {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
gap: var(--astl-space-2);
|
|
22
|
+
margin: 0;
|
|
23
|
+
padding: var(--astl-space-4);
|
|
24
|
+
border: var(--astl-outline-width) solid var(--astl-outline);
|
|
25
|
+
color: var(--astl-ink);
|
|
26
|
+
font: inherit;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
}
|
|
29
|
+
.facade:hover {
|
|
30
|
+
border-color: var(--astl-accent);
|
|
31
|
+
}
|
|
32
|
+
.facade svg {
|
|
33
|
+
inline-size: 4rem;
|
|
34
|
+
block-size: 4rem;
|
|
35
|
+
}
|
|
36
|
+
.facade circle {
|
|
37
|
+
fill: var(--astl-accent);
|
|
38
|
+
}
|
|
39
|
+
.facade path {
|
|
40
|
+
fill: var(--astl-on-accent);
|
|
41
|
+
}
|
|
42
|
+
.play {
|
|
43
|
+
font-size: 1.25rem;
|
|
44
|
+
font-weight: 600;
|
|
45
|
+
}
|
|
46
|
+
.loads {
|
|
47
|
+
margin-block: var(--astl-space-2) 0;
|
|
48
|
+
color: var(--astl-ink-muted);
|
|
49
|
+
font-size: var(--astl-size-ui);
|
|
50
|
+
}
|
|
51
|
+
`,c];constructor(){super(),this.playing=!1}get slotIds(){return[]}getAnswers(){return{}}setAnswers(){}units(){return{answered:0,total:0}}render(){let t=this.stringAttribute(`label`)??``,n=[`youtube`,`vimeo`].find(e=>this.stringAttribute(e));return e`<div part="video">
|
|
52
|
+
<p class="title" part="title" id="title">${t}</p>
|
|
53
|
+
${n===void 0?this.#e():this.#t(n,t)}
|
|
54
|
+
</div>`}#e(){let t=this.stringAttribute(`captions`),r=this.stringAttribute(`captions-lang`)??`en`;return e`<video
|
|
55
|
+
class="frame"
|
|
56
|
+
part="player"
|
|
57
|
+
controls
|
|
58
|
+
preload="metadata"
|
|
59
|
+
src=${i(this.stringAttribute(`src`)??void 0)}
|
|
60
|
+
poster=${i(this.stringAttribute(`poster`)??void 0)}
|
|
61
|
+
crossorigin=${i(t===null?void 0:`anonymous`)}
|
|
62
|
+
aria-labelledby="title"
|
|
63
|
+
>
|
|
64
|
+
${t===null?n:e`<track
|
|
65
|
+
kind="captions"
|
|
66
|
+
src=${t}
|
|
67
|
+
srclang=${r}
|
|
68
|
+
label=${f(r,this.context.locale)}
|
|
69
|
+
default
|
|
70
|
+
/>`}
|
|
71
|
+
</video>`}#t(t,n){if(this.playing)return e`<iframe
|
|
72
|
+
class="frame"
|
|
73
|
+
part="player"
|
|
74
|
+
src=${d[t](this.stringAttribute(t)??``)}
|
|
75
|
+
title=${n}
|
|
76
|
+
sandbox="allow-scripts allow-same-origin"
|
|
77
|
+
allow="autoplay; encrypted-media; fullscreen; picture-in-picture"
|
|
78
|
+
referrerpolicy="strict-origin-when-cross-origin"
|
|
79
|
+
></iframe>`;let r=this.uiLanguage;return e`<button
|
|
80
|
+
type="button"
|
|
81
|
+
class="frame facade"
|
|
82
|
+
part="play"
|
|
83
|
+
lang=${r.lang}
|
|
84
|
+
dir=${r.dir}
|
|
85
|
+
aria-labelledby="play title"
|
|
86
|
+
aria-describedby="loads"
|
|
87
|
+
@click=${()=>{this.playing=!0}}
|
|
88
|
+
>
|
|
89
|
+
<svg viewBox="0 0 64 64" aria-hidden="true" focusable="false">
|
|
90
|
+
<circle cx="32" cy="32" r="32"></circle>
|
|
91
|
+
<path d="M25 19v26l21-13z"></path>
|
|
92
|
+
</svg>
|
|
93
|
+
<span class="play" id="play">${this.t(`ui.play`)}</span>
|
|
94
|
+
</button>
|
|
95
|
+
<p class="loads" id="loads" lang=${r.lang} dir=${r.dir} aria-hidden="true">
|
|
96
|
+
${this.t(`ui.loads`,{provider:t})}
|
|
97
|
+
</p>`}updated(e){e.has(`playing`)&&this.playing&&this.renderRoot.querySelector(`iframe`)?.focus()}},m={manifest:o,element:p,messages:u};export{m as videoElement};
|
|
98
|
+
//# sourceMappingURL=video-j9MCH6Kw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video-j9MCH6Kw.js","names":["en","pl","ifDefined","nothing","b","i","A","AstlElement","o","en_default","videoManifest","pl_default","blockStyles","namespace","videoUiMessages","EMBEDS","id","languageName","locale","tag","VideoElement","label","provider","name","#file","#provider","captions","lang","ui","changed","videoElement"],"sources":["../../../../components/src/video/ui-messages.ts","../../../../components/src/video/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.video';\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 `videoMessages` would put the authoring strings into the element's chunk.\n */\nexport const videoUiMessages: 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 {\n type CSSResultGroup,\n css,\n html,\n nothing,\n type PropertyDeclarations,\n type PropertyValues,\n type TemplateResult,\n} from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { blockStyles } from '../block-styles.js';\nimport { videoManifest } from './manifest.js';\nimport { videoUiMessages } from './ui-messages.js';\n\ntype Provider = 'youtube' | 'vimeo';\n\n/** Where a provider video plays, from its id: YouTube without cookies, Vimeo with do-not-track, both at once. */\nconst EMBEDS: Readonly<Record<Provider, (id: string) => string>> = {\n youtube: (id) => `https://www.youtube-nocookie.com/embed/${encodeURIComponent(id)}?autoplay=1`,\n vimeo: (id) => `https://player.vimeo.com/video/${encodeURIComponent(id)}?autoplay=1&dnt=1`,\n};\n\n/** A language in the UI language (\"English\", \"angielski\"), or its tag when the browser cannot name it. */\nfunction languageName(tag: string, locale: string): string {\n try {\n return new Intl.DisplayNames([locale], { type: 'language' }).of(tag) ?? tag;\n } catch {\n return tag;\n }\n}\n\n/**\n * `<astl-video>`: the title, then a file in the browser's video player (captions on by default), or a YouTube or Vimeo\n * video behind a Play button: nothing loads from the provider until it is pressed, and then only its privacy-friendly\n * player, sandboxed, which takes the focus. Nothing is answered or stored; a handed-in attempt still plays.\n */\nexport class VideoElement extends AstlElement {\n static override manifest: ComponentManifest = videoManifest;\n static override messages: readonly MessageCatalog[] = videoUiMessages;\n\n static override properties: PropertyDeclarations = {\n playing: { state: true },\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 .frame {\n box-sizing: border-box;\n display: block;\n inline-size: 100%;\n aspect-ratio: 16 / 9;\n border: 0;\n border-radius: var(--astl-radius-l);\n background: var(--astl-surface-raised);\n }\n `,\n // The Play button stands where the provider's player will: a frame with a large play sign and the word; what\n // it loads is said under it (its description, outside it: the name of a button holds all its visible text).\n css`\n .facade {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: var(--astl-space-2);\n margin: 0;\n padding: var(--astl-space-4);\n border: var(--astl-outline-width) solid var(--astl-outline);\n color: var(--astl-ink);\n font: inherit;\n cursor: pointer;\n }\n .facade:hover {\n border-color: var(--astl-accent);\n }\n .facade svg {\n inline-size: 4rem;\n block-size: 4rem;\n }\n .facade circle {\n fill: var(--astl-accent);\n }\n .facade path {\n fill: var(--astl-on-accent);\n }\n .play {\n font-size: 1.25rem;\n font-weight: 600;\n }\n .loads {\n margin-block: var(--astl-space-2) 0;\n color: var(--astl-ink-muted);\n font-size: var(--astl-size-ui);\n }\n `,\n blockStyles,\n ];\n\n /** Whether the student pressed Play on a provider video: only then does its player load. */\n declare protected playing: boolean;\n\n constructor() {\n super();\n this.playing = 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 protected override render(): TemplateResult {\n const label = this.stringAttribute('label') ?? '';\n const provider = (['youtube', 'vimeo'] as const).find((name) => this.stringAttribute(name));\n return html`<div part=\"video\">\n <p class=\"title\" part=\"title\" id=\"title\">${label}</p>\n ${provider === undefined ? this.#file() : this.#provider(provider, label)}\n </div>`;\n }\n\n #file(): TemplateResult {\n const captions = this.stringAttribute('captions');\n const lang = this.stringAttribute('captions-lang') ?? 'en';\n // Captions load with CORS (`crossorigin`), the only way a browser shows them from another origin.\n return html`<video\n class=\"frame\"\n part=\"player\"\n controls\n preload=\"metadata\"\n src=${ifDefined(this.stringAttribute('src') ?? undefined)}\n poster=${ifDefined(this.stringAttribute('poster') ?? undefined)}\n crossorigin=${ifDefined(captions === null ? undefined : 'anonymous')}\n aria-labelledby=\"title\"\n >\n ${\n captions === null\n ? nothing\n : html`<track\n kind=\"captions\"\n src=${captions}\n srclang=${lang}\n label=${languageName(lang, this.context.locale)}\n default\n />`\n }\n </video>`;\n }\n\n #provider(provider: Provider, label: string): TemplateResult {\n if (this.playing) {\n return html`<iframe\n class=\"frame\"\n part=\"player\"\n src=${EMBEDS[provider](this.stringAttribute(provider) ?? '')}\n title=${label}\n sandbox=\"allow-scripts allow-same-origin\"\n allow=\"autoplay; encrypted-media; fullscreen; picture-in-picture\"\n referrerpolicy=\"strict-origin-when-cross-origin\"\n ></iframe>`;\n }\n const ui = this.uiLanguage;\n // Named \"Play\" and the title, described by what it loads. UI text in the UI language; the title keeps its own.\n return html`<button\n type=\"button\"\n class=\"frame facade\"\n part=\"play\"\n lang=${ui.lang}\n dir=${ui.dir}\n aria-labelledby=\"play title\"\n aria-describedby=\"loads\"\n @click=${() => {\n this.playing = true;\n }}\n >\n <svg viewBox=\"0 0 64 64\" aria-hidden=\"true\" focusable=\"false\">\n <circle cx=\"32\" cy=\"32\" r=\"32\"></circle>\n <path d=\"M25 19v26l21-13z\"></path>\n </svg>\n <span class=\"play\" id=\"play\">${this.t('ui.play')}</span>\n </button>\n <p class=\"loads\" id=\"loads\" lang=${ui.lang} dir=${ui.dir} aria-hidden=\"true\">\n ${this.t('ui.loads', { provider })}\n </p>`;\n }\n\n protected override updated(changed: PropertyValues): void {\n // The button the student pressed is gone: its player takes the focus.\n if (changed.has('playing') && this.playing) this.renderRoot.querySelector('iframe')?.focus();\n }\n}\n\nexport const videoElement: ElementRegistration = {\n manifest: videoManifest,\n element: VideoElement,\n messages: videoUiMessages,\n};\n"],"mappings":"A,oLAIA,IAAMa,EAAY,aAMLC,EAA6C,CACxD,CAAE,YAAW,OAAQ,KAAM,SAAUd,CAAG,EACxC,CAAE,YAAW,OAAQ,KAAM,SAAUC,CAAG,CAC1C,ECMMc,EAA6D,CACjE,QAAU,GAAO,0CAA0C,mBAAmBC,CAAE,EAAE,aAClF,MAAQ,GAAO,kCAAkC,mBAAmBA,CAAE,EAAE,kBAC1E,EAGA,SAASC,EAAa,EAAa,EAAwB,CACzD,GAAI,CACF,OAAO,IAAI,KAAK,aAAa,CAACC,CAAM,EAAG,CAAE,KAAM,UAAW,CAAC,CAAC,CAAC,GAAGC,CAAG,GAAKA,CAC1E,MAAQ,CACN,OAAOA,CACT,CACF,CAOA,IAAaC,EAAb,cAAkCb,CAAY,CAC5C,OAAgB,SAA8BG,EAC9C,OAAgB,SAAsCI,EAEtD,OAAgB,WAAmC,CACjD,QAAS,CAAE,MAAO,EAAK,CACzB,EAEA,OAAgB,OAAyB,CACvC,CAAG;;;;;;;;;;;;;;EAiBH,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCHF,CACF,EAKA,aAAc,CACZ,MAAM,EACN,KAAK,QAAU,EACjB,CAEA,IAAI,SAA6B,CAC/B,MAAO,CAAC,CACV,CAEA,YAAsB,CACpB,MAAO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GAAK,KAAK,SAAS,KAAK,WAAW,cAAc,QAAQ,CAAC,EAAE,MAAM,CAC7F,CACF,EAEaC,EAAoC,CAC/C,SAAUpB,EACV,QAASU,EACT,SAAUN,CACZ,E"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={tag:`astl-video`,version:1,display:`block`,graded:!1,attributes:[{name:`label`,type:`string`,visibility:`public`,required:!0},{name:`src`,type:`url`,visibility:`public`},{name:`poster`,type:`url`,visibility:`public`},{name:`captions`,type:`url`,visibility:`public`},{name:`captions-lang`,type:`string`,visibility:`public`,default:`en`},{name:`youtube`,type:`string`,visibility:`public`},{name:`vimeo`,type:`string`,visibility:`public`}],children:[],scoring:null,variants:null,slotKinds:[],issues:[`VIDEO_LABEL_MISSING`,`VIDEO_SOURCE_MISSING`,`VIDEO_SOURCE_BOTH`,`VIDEO_FILE_TYPE`,`VIDEO_LINK_INVALID`,`VIDEO_CAPTIONS_LANG_INVALID`,`VIDEO_CAPTIONS_MISSING`],messages:`astl.video`,a11y:{pattern:`a file: the browser's video player, labelled by the title, captions on by default; YouTube or Vimeo: a button named by the title and described as loading the provider's player, which it replaces with a titled frame that takes the focus`,keys:[`Tab`,`Enter`,`Space`]},cssParts:[`video`,`title`,`player`,`play`]},t={"ui.play":`Play`,"ui.loads":`{provider, select, vimeo {Loads the Vimeo player} other {Loads the YouTube player}}`},n={"ui.play":`Odtwórz`,"ui.loads":`{provider, select, vimeo {Wczytuje odtwarzacz Vimeo} other {Wczytuje odtwarzacz YouTube}}`};export{t as n,e as r,n as t};
|
|
2
|
+
//# sourceMappingURL=video-manifest-8OwkhhAI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video-manifest-8OwkhhAI.js","names":["videoManifest","en_default","pl_default"],"sources":["../../../../components/src/video/manifest.ts","../../../../components/src/video/messages/ui/en.json","../../../../components/src/video/messages/ui/pl.json"],"sourcesContent":["import type { ComponentManifest } from '@astl/core';\n\n/**\n * A video between paragraphs, with its title: a file (mp4 or webm, with an optional poster and WebVTT captions) in the\n * browser's own player, or a YouTube or Vimeo video behind a Play button that loads nothing from the provider until\n * the student presses it. Nothing is graded or stored. Under a Content Security Policy, files need `media-src` (and\n * their posters `img-src`) for their host, and provider videos `frame-src https://www.youtube-nocookie.com\n * https://player.vimeo.com`.\n */\nexport const videoManifest: ComponentManifest = {\n tag: 'astl-video',\n version: 1,\n display: 'block',\n graded: false,\n attributes: [\n /** The title, shown above the video: it also names the player and the Play button. */\n { name: 'label', type: 'string', visibility: 'public', required: true },\n /** A video file, mp4 or webm, in the browser's player. Before Play only its metadata loads (its length). */\n { name: 'src', type: 'url', visibility: 'public' },\n /** A picture the file's player shows before it plays. */\n { name: 'poster', type: 'url', visibility: 'public' },\n /**\n * WebVTT captions of the file, shown by default. Their player then loads the file and the captions with CORS\n * (`crossorigin`): from another origin, both need `Access-Control-Allow-Origin`.\n */\n { name: 'captions', type: 'url', visibility: 'public' },\n /** The language of the captions, a BCP 47 tag. */\n { name: 'captions-lang', type: 'string', visibility: 'public', default: 'en' },\n /**\n * A YouTube video: its link (watch, share, shorts, embed or live) or its id. The view keeps only the id; it plays\n * from www.youtube-nocookie.com once the student presses Play.\n */\n { name: 'youtube', type: 'string', visibility: 'public' },\n /**\n * A Vimeo video: its link or its id. The view keeps only the id; it plays from player.vimeo.com with do-not-track\n * once the student presses Play.\n */\n { name: 'vimeo', type: 'string', visibility: 'public' },\n ],\n children: [],\n scoring: null,\n variants: null,\n slotKinds: [],\n issues: [\n 'VIDEO_LABEL_MISSING',\n 'VIDEO_SOURCE_MISSING',\n 'VIDEO_SOURCE_BOTH',\n 'VIDEO_FILE_TYPE',\n 'VIDEO_LINK_INVALID',\n 'VIDEO_CAPTIONS_LANG_INVALID',\n 'VIDEO_CAPTIONS_MISSING',\n ],\n messages: 'astl.video',\n a11y: {\n pattern:\n \"a file: the browser's video player, labelled by the title, captions on by default; YouTube or Vimeo: a button named by the title and described as loading the provider's player, which it replaces with a titled frame that takes the focus\",\n keys: ['Tab', 'Enter', 'Space'],\n },\n cssParts: ['video', 'title', 'player', 'play'],\n};\n","{\n \"ui.play\": \"Play\",\n \"ui.loads\": \"{provider, select, vimeo {Loads the Vimeo player} other {Loads the YouTube player}}\"\n}\n","{\n \"ui.play\": \"Odtwórz\",\n \"ui.loads\": \"{provider, select, vimeo {Wczytuje odtwarzacz Vimeo} other {Wczytuje odtwarzacz YouTube}}\"\n}\n"],"mappings":"AASA,IAAaA,EAAmC,CAC9C,IAAK,aACL,QAAS,EACT,QAAS,QACT,OAAQ,GACR,WAAY,CAEV,CAAE,KAAM,QAAS,KAAM,SAAU,WAAY,SAAU,SAAU,EAAK,EAEtE,CAAE,KAAM,MAAO,KAAM,MAAO,WAAY,QAAS,EAEjD,CAAE,KAAM,SAAU,KAAM,MAAO,WAAY,QAAS,EAKpD,CAAE,KAAM,WAAY,KAAM,MAAO,WAAY,QAAS,EAEtD,CAAE,KAAM,gBAAiB,KAAM,SAAU,WAAY,SAAU,QAAS,IAAK,EAK7E,CAAE,KAAM,UAAW,KAAM,SAAU,WAAY,QAAS,EAKxD,CAAE,KAAM,QAAS,KAAM,SAAU,WAAY,QAAS,CACxD,EACA,SAAU,CAAC,EACX,QAAS,KACT,SAAU,KACV,UAAW,CAAC,EACZ,OAAQ,CACN,sBACA,uBACA,oBACA,kBACA,qBACA,8BACA,wBACF,EACA,SAAU,aACV,KAAM,CACJ,QACE,8OACF,KAAM,CAAC,MAAO,QAAS,OAAO,CAChC,EACA,SAAU,CAAC,QAAS,QAAS,SAAU,MAAM,CAC/C,E"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import{C as e,E as t,T as n,b as r,n as i,y as a}from"./runtime-DxAbpr3S.js";import{n as o,r as s,t as c}from"./word-bank-manifest-C1FSo1kH.js";import{t as l}from"./pick-and-place-DVQIPYuL.js";import{t as u}from"./block-styles-CKo9x7Vt.js";import{t as d}from"./repeat-CY2W2URZ.js";import{t as f}from"./chip-styles-Dme5daTO.js";var p=`astl.word-bank`,m=[{namespace:p,locale:`en`,messages:o},{namespace:p,locale:`pl`,messages:c}],h=``,g=250,_=n`<path 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" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>`,v=e=>(e?.textContent??``).replace(/\s+/g,` `).trim(),y=class extends i{static manifest=s;static messages=m;static shadowRootOptions={...a.shadowRootOptions,slotAssignment:`manual`};static styles=[t`
|
|
2
|
+
.tray {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: var(--astl-space-2);
|
|
6
|
+
padding: var(--astl-space-3);
|
|
7
|
+
border: var(--astl-outline-width) solid var(--astl-line);
|
|
8
|
+
border-radius: var(--astl-radius-l);
|
|
9
|
+
background: var(--astl-canvas);
|
|
10
|
+
}
|
|
11
|
+
legend {
|
|
12
|
+
float: inline-start;
|
|
13
|
+
inline-size: 100%;
|
|
14
|
+
margin: 0;
|
|
15
|
+
font-size: var(--astl-size-ui);
|
|
16
|
+
line-height: 1.4;
|
|
17
|
+
}
|
|
18
|
+
.words {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-wrap: wrap;
|
|
21
|
+
gap: var(--astl-space-2);
|
|
22
|
+
}
|
|
23
|
+
button {
|
|
24
|
+
max-inline-size: 100%;
|
|
25
|
+
overflow-wrap: anywhere;
|
|
26
|
+
}
|
|
27
|
+
.chip:has(button:disabled) {
|
|
28
|
+
border-color: var(--astl-line);
|
|
29
|
+
}
|
|
30
|
+
`,t`
|
|
31
|
+
.chip[data-placed] {
|
|
32
|
+
text-decoration: line-through;
|
|
33
|
+
}
|
|
34
|
+
.chip[data-picked] {
|
|
35
|
+
color: var(--astl-ink);
|
|
36
|
+
font-weight: var(--astl-selected-weight);
|
|
37
|
+
}
|
|
38
|
+
.chip[data-target] {
|
|
39
|
+
border-color: var(--astl-accent);
|
|
40
|
+
outline: var(--astl-outline-width) solid var(--astl-accent);
|
|
41
|
+
outline-offset: calc(-2 * var(--astl-outline-width));
|
|
42
|
+
background: var(--astl-accent-soft);
|
|
43
|
+
}
|
|
44
|
+
.chip[data-dragging] {
|
|
45
|
+
pointer-events: none;
|
|
46
|
+
}
|
|
47
|
+
`,f,u];#e=new l(this,{destinations:e=>this.#i(e)===void 0?[h,...this.drops.map(e=>e.id)]:[e,...this.words.map(e=>e.id)],current:e=>this.#i(e)===void 0?this.#a(e)?.id??h:e,at:(e,t,n)=>{let r=this.getRootNode().elementsFromPoint(e,t);return this.drops.find(e=>e.id!==n&&r.includes(e))?.id??(r.includes(this)?h:null)},commit:(e,t)=>this.#s(e,t),say:(e,t,n)=>this.#c(e,t,n),box:`.chip`,hold:g,wrap:!0,parts:()=>this.drops});#t=null;#n=``;get pick(){return this.#e}get reuse(){return this.booleanAttribute(`reuse`)}get words(){return this.shuffled(Array.from(this.children).filter(e=>e.localName===`astl-word`&&e.id!==``))}get drops(){return this.id===``||!this.isConnected?[]:[...this.getRootNode().querySelectorAll(`astl-drop`)].filter(e=>e.getAttribute(`bank`)===this.id)}get slotIds(){return[]}getAnswers(){return{}}setAnswers(e){this.#e.reset()}units(){return{answered:0,total:0}}activate(e,t){let n=this.#e;if(!n.tap(t)||this.disabled)return;let r=n.picked;if(r!==null&&this.#i(r)===void 0)n.put(e.id);else if(e.word!==``){let t=e.word;e.place(``),this.#t=e,n.pick(t),this.#t=null}else n.click(t,e.id)}render(){let t=this.uiLanguage,n=this.#e.picked,r=n===null?void 0:this.#i(n),i=r===void 0?n===null?this.t(`ui.hint`):this.t(`ui.hintPicked`,{word:this.#o(n)}):this.t(`ui.hintWaiting`,{n:r.number}),a=new Map(this.reuse?[]:[...this.drops].reverse().map(e=>[e.word,e]));return e`<fieldset class="tray" part="word-bank">
|
|
48
|
+
<legend part="label" lang=${t.lang} dir=${t.dir}>
|
|
49
|
+
<bdi>${this.t(`ui.label`)}</bdi><span class="hint" part="hint"><bdi>${i}</bdi></span>
|
|
50
|
+
</legend>
|
|
51
|
+
<div class="words">
|
|
52
|
+
${d(this.words,e=>e.id,e=>this.#r(e.id,r!==void 0,a.get(e.id)))}
|
|
53
|
+
</div>
|
|
54
|
+
</fieldset>`}#r(t,n,i){let a=this.#e,o=this.uiLanguage;return e`<span
|
|
55
|
+
class="chip astl-ring"
|
|
56
|
+
part="word"
|
|
57
|
+
data-word=${t}
|
|
58
|
+
?data-picked=${a.picked===t}
|
|
59
|
+
?data-target=${n&&a.target===t}
|
|
60
|
+
?data-placed=${i!==void 0}
|
|
61
|
+
?data-dragging=${a.dragging===t}
|
|
62
|
+
>
|
|
63
|
+
<button
|
|
64
|
+
type="button"
|
|
65
|
+
data-word=${t}
|
|
66
|
+
aria-pressed=${a.picked===t?`true`:`false`}
|
|
67
|
+
aria-describedby=${i===void 0?r:`placed-${t}`}
|
|
68
|
+
?disabled=${this.disabled}
|
|
69
|
+
@click=${e=>a.click(e,t,n?t:void 0)}
|
|
70
|
+
@keydown=${e=>a.keydown(e,t)}
|
|
71
|
+
@pointerdown=${e=>a.pointerdown(e,t)}
|
|
72
|
+
@touchmove=${a.touchmove}
|
|
73
|
+
>
|
|
74
|
+
${a.picked===t?e`<svg class="move" viewBox="0 0 20 20" aria-hidden="true" focusable="false">${_}</svg>`:r}<slot data-word=${t}></slot>
|
|
75
|
+
</button>
|
|
76
|
+
${i===void 0?r:e`<span class="astl-vh" id="placed-${t}" lang=${o.lang} dir=${o.dir}
|
|
77
|
+
>${this.t(`ui.placed`,{n:i.number})}</span
|
|
78
|
+
>`}
|
|
79
|
+
</span>`}updated(){let e=new Map(this.words.map(e=>[e.id,e]));for(let t of this.renderRoot.querySelectorAll(`slot[data-word]`)){let n=e.get(t.dataset.word??``);t.assign(...n?[n]:[])}for(let e of this.drops)e.requestUpdate()}#i(e){return this.drops.find(t=>t.id===e)}#a(e){return this.reuse?void 0:this.drops.find(t=>t.word===e)}#o(e){return v(this.words.find(t=>t.id===e))}#s(e,t){let n=this.#i(e),r=n!==void 0&&n.word===``,i=r?t:n?.word??e,a=r?n:this.#i(t);if(this.#n=i,r||n?.place(``),a===void 0)n===void 0&&this.#a(i)?.place(``);else{if(!this.reuse)for(let e of this.drops)e!==a&&e.word===i&&e.place(``);a.place(i)}}#c(e,t,n){let r=e=>this.#i(e)?.number??0,i=this.#o(t),a=this.#t;if(a!==null)return this.t(`ui.announce.out`,{word:i,n:a.number});if(e===`put`){let e=this.#o(this.#n);return n===h?this.t(`ui.announce.back`,{word:e}):this.t(`ui.announce.put`,{word:e,n:r(this.#i(n)===void 0?t:n)})}let o=e=>{let t=this.#i(e)?.word??``;return t===``?this.t(`ui.announce.gapEmpty`,{n:r(e)}):this.t(`ui.announce.gap`,{n:r(e),word:this.#o(t)})};if(this.#i(t)!==void 0){if(e===`pick`)return this.t(`ui.announce.wait`,{n:r(t)});if(e===`cancel`)return this.t(`ui.announce.stayEmpty`,{n:r(t)});if(n===t)return o(t);let i=this.#a(n);return i===void 0?this.t(`ui.announce.word`,{word:this.#o(n)}):this.t(`ui.announce.wordPlaced`,{word:this.#o(n),n:i.number})}return e===`pick`?this.t(`ui.announce.pick`,{word:i}):e===`target`?n===h?this.t(`ui.announce.bank`):o(n):n===h?this.t(`ui.announce.stay`,{word:i}):this.t(`ui.announce.stayGap`,{word:i,n:r(n)})}},b={manifest:s,element:y,messages:m};export{b as wordBankElement};
|
|
80
|
+
//# sourceMappingURL=word-bank-ARjwUKZf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"word-bank-ARjwUKZf.js","names":["en","pl","LitElement","repeat","nothing","b","i$1","w","A","AstlElement","i","en_default","wordBankManifest","pl_default","PickAndPlace","blockStyles","c","chipStyles","namespace","wordBankUiMessages","BANK","LONG_PRESS","MOVE_ICON","textOf","el","WordBankElement","#drop","item","drop","word","#holder","hits","x","y","d","#commit","to","#message","moment","#pick","child","pick","event","picked","#out","ui","waiting","hint","#label","holders","#renderWord","id","holder","words","slot","source","target","#moved","other","n","out","moved","gap","held","wordBankElement"],"sources":["../../../../components/src/word-bank/ui-messages.ts","../../../../components/src/word-bank/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.word-bank';\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 `wordBankMessages` would put the authoring strings into the element's chunk.\n */\nexport const wordBankUiMessages: 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 { PickAndPlace, type PickMoment } from '@astl/player/interaction';\nimport { type CSSResultGroup, css, html, LitElement, nothing, svg, type TemplateResult } from 'lit';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { blockStyles } from '../block-styles.js';\nimport { chipStyles } from '../chip-styles.js';\nimport { wordBankManifest } from './manifest.js';\nimport { wordBankUiMessages } from './ui-messages.js';\n\n/** Where a word is when no gap holds it, as a destination: back in the bank. */\nconst BANK = '';\n\n/** A touch held this long (ms) without moving starts a drag; a touch that moves sooner scrolls, a short one taps. */\nconst LONG_PRESS = 250;\n\n/**\n * Marks the picked word next to its other cues (lift, fill, `aria-pressed`), also where forced colours drop fills and\n * shadows: four arrows, \"this word moves\", as on a picked card of `astl-categorise`.\n */\nconst MOVE_ICON = svg`<path 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\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>`;\n\n/** What the bank asks of its gaps (`<astl-drop>` with its id as `bank`; the two folders never import each other). */\ninterface Drop extends HTMLElement {\n /** The word id it holds; '' when empty. */\n readonly word: string;\n readonly number: number;\n place(word: string): void;\n requestUpdate(): void;\n}\n\nconst textOf = (el: Element | undefined): string => (el?.textContent ?? '').replace(/\\s+/g, ' ').trim();\n\n/**\n * `<astl-word-bank>`: the words its gaps (`<astl-drop bank>`) take. No slots: the gaps hold the answers, the bank holds\n * the one pick and place of them all (its gaps are its parts), as native toggle buttons in the tab order:\n * - a word, then a gap: Space or Enter on the word, then Enter on the gap (or the arrow keys from the word to choose\n * one, and Enter); a tap on the word, then on the gap; or a drag onto the gap;\n * - a gap holding a word: a press takes the word out, back in the bank and picked, so the next gap moves it; a drag\n * moves it to another gap (or the bank);\n * - an empty gap with nothing picked waits for a word: the arrow keys on it choose one and Enter puts it there, or a\n * tap on a word.\n * Without `reuse`, a word fills one gap: a gap that takes it from another empties that one, and the bank shows placed\n * words as placed, still pickable to move them. The light-DOM words are slotted manually and never moved or changed.\n */\nexport class WordBankElement extends AstlElement {\n static override manifest: ComponentManifest = wordBankManifest;\n static override messages: readonly MessageCatalog[] = wordBankUiMessages;\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n slotAssignment: 'manual',\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 tinted tray (solid edges: dashed, dotted and double borders are the verdict language) with its title and hint\n // at the top, as the cards to sort of astl-categorise (the legend floats, so it sits inside the tray), then the\n // words in a wrapping row, each a chip (chipStyles: its box, button, pick and drag); a long press starts a drag\n // (see LONG_PRESS). A long word hyphenates in its chip. Locked (review, handed in): a quieter edge, the text at full\n // contrast.\n css`\n .tray {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-2);\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 }\n legend {\n float: inline-start;\n inline-size: 100%;\n margin: 0;\n font-size: var(--astl-size-ui);\n line-height: 1.4;\n }\n .words {\n display: flex;\n flex-wrap: wrap;\n gap: var(--astl-space-2);\n }\n button {\n max-inline-size: 100%;\n overflow-wrap: anywhere;\n }\n .chip:has(button:disabled) {\n border-color: var(--astl-line);\n }\n `,\n // Placed (a bank without reuse): crossed out, as students cross out the words they used on paper (a tick would read\n // as a verdict), on a chip that still looks pressable: a placed word can be picked to move it. Picked: in hc also\n // bold text (selected-weight). The word a gap waiting for one would take (the arrow keys' target): a doubled edge,\n // which forced colours keep. Dragged: no pointer target, so what is under it counts.\n css`\n .chip[data-placed] {\n text-decoration: line-through;\n }\n .chip[data-picked] {\n color: var(--astl-ink);\n font-weight: var(--astl-selected-weight);\n }\n .chip[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 .chip[data-dragging] {\n pointer-events: none;\n }\n `,\n chipStyles,\n blockStyles,\n ];\n\n /** Picking and putting words: items are words and gaps (a gap's word, or a gap waiting for one), see below. */\n readonly #pick: PickAndPlace<string> = new PickAndPlace<string>(this, {\n // A word goes back to the bank or into a gap; a waiting gap takes one of the words.\n destinations: (item) =>\n this.#drop(item) === undefined\n ? [BANK, ...this.drops.map((drop) => drop.id)]\n : [item, ...this.words.map((word) => word.id)],\n current: (item) => (this.#drop(item) === undefined ? (this.#holder(item)?.id ?? BANK) : item),\n // Hit testing, not boxes: a gap in a line is taller than its inline host's box. A dragged word takes no pointer\n // events (see the styles), so what is under it counts, and never the gap it is dragged from.\n at: (x, y, item) => {\n const hits = (this.getRootNode() as Document | ShadowRoot).elementsFromPoint(x, y);\n const drop = this.drops.find((d) => d.id !== item && hits.includes(d));\n return drop?.id ?? (hits.includes(this) ? BANK : null);\n },\n commit: (item, to) => this.#commit(item, to),\n say: (moment, item, to) => this.#message(moment, item, to),\n box: '.chip',\n hold: LONG_PRESS,\n wrap: true,\n parts: () => this.drops,\n });\n /** The gap a press just took a word out of: the pick that follows is announced as that. */\n #out: Drop | null = null;\n /** The word the last commit moved, for its announcement (a gap that gave it up no longer holds it). */\n #moved = '';\n\n /** The pick and place of the bank and its gaps, which they read and forward their keys and presses to. */\n get pick(): PickAndPlace<string> {\n return this.#pick;\n }\n\n get reuse(): boolean {\n return this.booleanAttribute('reuse');\n }\n\n /** `<astl-word>` children in rendered order: view order, or shuffled per attempt with a seed. */\n get words(): readonly HTMLElement[] {\n return this.shuffled(\n Array.from(this.children).filter(\n (child): child is HTMLElement => child.localName === 'astl-word' && child.id !== '',\n ),\n );\n }\n\n /** Its gaps, in reading order: the view's `<astl-drop>` elements naming this bank. */\n get drops(): readonly Drop[] {\n if (this.id === '' || !this.isConnected) return [];\n const root = this.getRootNode() as Document | ShadowRoot;\n return [...root.querySelectorAll<Drop>('astl-drop')].filter(\n (drop) => drop.getAttribute('bank') === this.id,\n );\n }\n\n get slotIds(): readonly string[] {\n return [];\n }\n\n getAnswers(): Answers {\n return {};\n }\n\n /** The gaps hold the answers; the player clears them all (start over), so a pick goes too. */\n setAnswers(_answers: Answers): void {\n this.#pick.reset();\n }\n\n units(): Units {\n return { answered: 0, total: 0 };\n }\n\n /** A press on one of its gaps (a tap, or Enter or Space on it); see the class comment. */\n activate(drop: Drop, event: MouseEvent): void {\n const pick = this.#pick;\n if (!pick.tap(event) || this.disabled) return;\n const picked = pick.picked;\n if (picked !== null && this.#drop(picked) === undefined) pick.put(drop.id);\n else if (drop.word !== '') {\n const word = drop.word;\n drop.place('');\n this.#out = drop;\n pick.pick(word);\n this.#out = null;\n } else pick.click(event, drop.id);\n }\n\n protected override render(): TemplateResult {\n const ui = this.uiLanguage;\n const pick = this.#pick;\n const picked = pick.picked;\n const waiting = picked === null ? undefined : this.#drop(picked);\n const hint =\n waiting !== undefined\n ? this.t('ui.hintWaiting', { n: waiting.number })\n : picked === null\n ? this.t('ui.hint')\n : this.t('ui.hintPicked', { word: this.#label(picked) });\n // The first gap that holds a word wins, as in #holder (reversed: a Map keeps the last of equal keys).\n const holders = new Map(\n this.reuse ? [] : [...this.drops].reverse().map((drop) => [drop.word, drop] as const),\n );\n return html`<fieldset class=\"tray\" part=\"word-bank\">\n <legend part=\"label\" lang=${ui.lang} dir=${ui.dir}>\n <bdi>${this.t('ui.label')}</bdi><span class=\"hint\" part=\"hint\"><bdi>${hint}</bdi></span>\n </legend>\n <div class=\"words\">\n ${repeat(\n this.words,\n (word) => word.id,\n (word) => this.#renderWord(word.id, waiting !== undefined, holders.get(word.id)),\n )}\n </div>\n </fieldset>`;\n }\n\n #renderWord(id: string, waiting: boolean, holder: Drop | undefined): TemplateResult {\n const pick = this.#pick;\n const ui = this.uiLanguage;\n return html`<span\n class=\"chip astl-ring\"\n part=\"word\"\n data-word=${id}\n ?data-picked=${pick.picked === id}\n ?data-target=${waiting && pick.target === id}\n ?data-placed=${holder !== undefined}\n ?data-dragging=${pick.dragging === id}\n >\n <button\n type=\"button\"\n data-word=${id}\n aria-pressed=${pick.picked === id ? 'true' : 'false'}\n aria-describedby=${holder === undefined ? nothing : `placed-${id}`}\n ?disabled=${this.disabled}\n @click=${(event: MouseEvent) => pick.click(event, id, waiting ? id : undefined)}\n @keydown=${(event: KeyboardEvent) => pick.keydown(event, id)}\n @pointerdown=${(event: PointerEvent) => pick.pointerdown(event, id)}\n @touchmove=${pick.touchmove}\n >\n ${\n pick.picked === id\n ? html`<svg class=\"move\" viewBox=\"0 0 20 20\" aria-hidden=\"true\" focusable=\"false\">${MOVE_ICON}</svg>`\n : nothing\n }<slot data-word=${id}></slot>\n </button>\n ${\n holder === undefined\n ? nothing\n : html`<span class=\"astl-vh\" id=\"placed-${id}\" lang=${ui.lang} dir=${ui.dir}\n >${this.t('ui.placed', { n: holder.number })}</span\n >`\n }\n </span>`;\n }\n\n protected override updated(): void {\n // Manual slot assignment: the view's light DOM is projected as is, never moved or rewritten.\n const words = new Map(this.words.map((word) => [word.id, word]));\n for (const slot of (this.renderRoot as ShadowRoot).querySelectorAll<HTMLSlotElement>('slot[data-word]')) {\n const word = words.get(slot.dataset.word ?? '');\n slot.assign(...(word ? [word] : []));\n }\n // The gaps show the pick (waiting, target, dragged), and the words they hold may have moved.\n for (const drop of this.drops) drop.requestUpdate();\n }\n\n // Moving words\n\n #drop(id: string): Drop | undefined {\n return this.drops.find((drop) => drop.id === id);\n }\n\n /** The gap that holds word `id`; none with reuse, where words stay in the bank. */\n #holder(id: string): Drop | undefined {\n return this.reuse ? undefined : this.drops.find((drop) => drop.word === id);\n }\n\n #label(word: string): string {\n return textOf(this.words.find((w) => w.id === word));\n }\n\n /**\n * Puts `item` at `to`: a word into a gap (or, placed, back to the bank); a gap's word into another gap or back; a\n * waiting gap takes word `to`. Without reuse, a gap that takes a word empties the one that held it.\n */\n #commit(item: string, to: string): void {\n const source = this.#drop(item);\n const waiting = source !== undefined && source.word === '';\n const word = waiting ? to : (source?.word ?? item);\n const target = waiting ? source : this.#drop(to);\n this.#moved = word;\n if (!waiting) source?.place('');\n if (target === undefined) {\n // Back to the bank: a placed word picked in the bank leaves its gap.\n if (source === undefined) this.#holder(word)?.place('');\n return;\n }\n if (!this.reuse)\n for (const other of this.drops) if (other !== target && other.word === word) other.place('');\n target.place(word);\n }\n\n /** The announcement of a moment: of a word, of a waiting gap, or of a gap's word taken out. */\n #message(moment: PickMoment, item: string, to: string): string {\n const n = (id: string) => this.#drop(id)?.number ?? 0;\n const word = this.#label(item);\n const out = this.#out;\n if (out !== null) return this.t('ui.announce.out', { word, n: out.number });\n if (moment === 'put') {\n const moved = this.#label(this.#moved);\n if (to === BANK) return this.t('ui.announce.back', { word: moved });\n return this.t('ui.announce.put', { word: moved, n: n(this.#drop(to) === undefined ? item : to) });\n }\n const gap = (id: string): string => {\n const held = this.#drop(id)?.word ?? '';\n return held === ''\n ? this.t('ui.announce.gapEmpty', { n: n(id) })\n : this.t('ui.announce.gap', { n: n(id), word: this.#label(held) });\n };\n if (this.#drop(item) !== undefined) {\n if (moment === 'pick') return this.t('ui.announce.wait', { n: n(item) });\n if (moment === 'cancel') return this.t('ui.announce.stayEmpty', { n: n(item) });\n if (to === item) return gap(item);\n const holder = this.#holder(to);\n return holder === undefined\n ? this.t('ui.announce.word', { word: this.#label(to) })\n : this.t('ui.announce.wordPlaced', { word: this.#label(to), n: holder.number });\n }\n if (moment === 'pick') return this.t('ui.announce.pick', { word });\n if (moment === 'target') return to === BANK ? this.t('ui.announce.bank') : gap(to);\n return to === BANK\n ? this.t('ui.announce.stay', { word })\n : this.t('ui.announce.stayGap', { word, n: n(to) });\n }\n}\n\nexport const wordBankElement: ElementRegistration = {\n manifest: wordBankManifest,\n element: WordBankElement,\n messages: wordBankUiMessages,\n};\n"],"mappings":"A,uUAIA,IAAMkB,EAAY,iBAMLC,EAAgD,CAC3D,CAAE,YAAW,OAAQ,KAAM,SAAUnB,CAAG,EACxC,CAAE,YAAW,OAAQ,KAAM,SAAUC,CAAG,CAC1C,ECFMmB,EAAO,GAGPC,EAAa,IAMbC,EAAY,CAAG,yPAWfC,EAAU,IAAqCC,GAAI,aAAe,GAAA,CAAI,QAAQ,OAAQ,GAAG,CAAC,CAAC,KAAK,EAczFC,EAAb,cAAqChB,CAAY,CAC/C,OAAgB,SAA8BG,EAC9C,OAAgB,SAAsCO,EACtD,OAAgB,kBAAoC,CAClD,GAAGjB,EAAW,kBACd,eAAgB,QAClB,EAGA,OAAgB,OAAyB,CAMvC,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCH,CAAG;;;;;;;;;;;;;;;;;EAkBHe,EACAF,CACF,EAGA,GAAuC,IAAID,EAAqB,KAAM,CAEpE,aAAe,GACb,KAAKY,GAAMC,CAAI,IAAM,IAAA,GACjB,CAACP,EAAM,GAAG,KAAK,MAAM,IAAK,GAASQ,EAAK,EAAE,CAAC,EAC3C,CAACD,EAAM,GAAG,KAAK,MAAM,IAAK,GAASE,EAAK,EAAE,CAAC,E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`,visibility:`public`,content:`inline`,min:1,max:30,attributes:[{name:`id`,type:`id`,visibility:`public`,required:!0},{name:`distractor`,type:`boolean`,visibility:`private`,default:!1}]}],scoring:null,variants:null,slotKinds:[],issues:[`WORD_BANK_WORD_EMPTY`,`WORD_BANK_WORD_DUPLICATE`,`WORD_BANK_WORD_LINK`],messages:`astl.word-bank`,a11y:{pattern:`group of toggle buttons with pick and place: Space or Enter picks a word; then Tab to a gap and press Enter, or choose a gap with the arrow keys and press Enter; Escape cancels; or drag the word onto a gap, or tap it and then the gap`,keys:[`Tab`,`Space`,`Enter`,`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`Escape`]},cssParts:[`word-bank`,`label`,`hint`,`word`]},t={"ui.label":`Word bank`,"ui.hint":`Pick a word, then the gap it goes in.`,"ui.hintPicked":`Now pick the gap for “{word}”.`,"ui.hintWaiting":`Now pick the word for gap {n}.`,"ui.placed":`in gap {n}`,"ui.announce.pick":`Picked “{word}”. Choose its gap with the arrow keys and press Enter, or go to the gap and press Enter.`,"ui.announce.wait":`Gap {n}: choose a word with the arrow keys and press Enter.`,"ui.announce.out":`Took “{word}” out of gap {n}. Pick another gap for it, or press Escape.`,"ui.announce.bank":`Word bank`,"ui.announce.gap":`Gap {n}: “{word}”`,"ui.announce.gapEmpty":`Gap {n}, empty`,"ui.announce.word":`“{word}”`,"ui.announce.wordPlaced":`“{word}”, in gap {n}`,"ui.announce.put":`“{word}” is in gap {n}.`,"ui.announce.back":`“{word}” is back in the word bank.`,"ui.announce.stay":`“{word}” stays in the word bank.`,"ui.announce.stayGap":`“{word}” stays in gap {n}.`,"ui.announce.stayEmpty":`Gap {n} stays empty.`},n={"ui.label":`Bank słów`,"ui.hint":`Wybierz słowo, a potem lukę, do której pasuje.`,"ui.hintPicked":`Teraz wybierz lukę dla słowa „{word}”.`,"ui.hintWaiting":`Teraz wybierz słowo do luki {n}.`,"ui.placed":`w luce {n}`,"ui.announce.pick":`Wybrano „{word}”. Wybierz lukę strzałkami i naciśnij Enter albo przejdź do luki i naciśnij Enter.`,"ui.announce.wait":`Luka {n}: wybierz słowo strzałkami i naciśnij Enter.`,"ui.announce.out":`Wyjęto „{word}” z luki {n}. Wybierz dla tego słowa inną lukę albo naciśnij Escape.`,"ui.announce.bank":`Bank słów`,"ui.announce.gap":`Luka {n}: „{word}”`,"ui.announce.gapEmpty":`Luka {n}, pusta`,"ui.announce.word":`„{word}”`,"ui.announce.wordPlaced":`„{word}”, w luce {n}`,"ui.announce.put":`„{word}” jest w luce {n}.`,"ui.announce.back":`Słowo „{word}” wróciło do banku słów.`,"ui.announce.stay":`„{word}” zostaje w banku słów.`,"ui.announce.stayGap":`„{word}” zostaje w luce {n}.`,"ui.announce.stayEmpty":`Luka {n} zostaje pusta.`};export{t as n,e as r,n as t};
|
|
2
|
+
//# sourceMappingURL=word-bank-manifest-C1FSo1kH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"word-bank-manifest-C1FSo1kH.js","names":["wordBankManifest","en_default","pl_default"],"sources":["../../../../components/src/word-bank/manifest.ts","../../../../components/src/word-bank/messages/ui/en.json","../../../../components/src/word-bank/messages/ui/pl.json"],"sourcesContent":["import type { ComponentManifest } from '@astl/core';\n\n/**\n * The words that gaps in the text take (`<astl-drop bank>`), distractors included. Ungraded: no slots, locked with the\n * exercise; a bank alone is \"no interactions\". The view shows the words in a keyed order that is never the source\n * order (authors often write them in the order of the gaps). Without `reuse`, a word fills one gap at a time: placing\n * it again moves it. Several banks may share a document; each gap takes words from its own.\n */\nexport const wordBankManifest: ComponentManifest = {\n tag: 'astl-word-bank',\n version: 1,\n display: 'block',\n graded: false,\n attributes: [\n /** One word can fill several gaps. */\n { name: 'reuse', type: 'boolean', visibility: 'public', default: false },\n ],\n children: [\n /**\n * One word: `id` is local to the bank (gaps name it), `distractor` (private) tags a word no gap expects, for\n * authors only. At most 30, so the bank stays easy to scan.\n */\n {\n tag: 'astl-word',\n visibility: 'public',\n content: 'inline',\n min: 1,\n max: 30,\n attributes: [\n { name: 'id', type: 'id', visibility: 'public', required: true },\n { name: 'distractor', type: 'boolean', visibility: 'private', default: false },\n ],\n },\n ],\n scoring: null,\n variants: null,\n slotKinds: [],\n issues: ['WORD_BANK_WORD_EMPTY', 'WORD_BANK_WORD_DUPLICATE', 'WORD_BANK_WORD_LINK'],\n messages: 'astl.word-bank',\n a11y: {\n pattern:\n 'group of toggle buttons with pick and place: Space or Enter picks a word; then Tab to a gap and press Enter, or choose a gap with the arrow keys and press Enter; Escape cancels; or drag the word onto a gap, or tap it and then the gap',\n keys: [\n 'Tab',\n 'Space',\n 'Enter',\n 'ArrowUp',\n 'ArrowDown',\n 'ArrowLeft',\n 'ArrowRight',\n 'Home',\n 'End',\n 'Escape',\n ],\n },\n cssParts: ['word-bank', 'label', 'hint', 'word'],\n};\n","{\n \"ui.label\": \"Word bank\",\n \"ui.hint\": \"Pick a word, then the gap it goes in.\",\n \"ui.hintPicked\": \"Now pick the gap for “{word}”.\",\n \"ui.hintWaiting\": \"Now pick the word for gap {n}.\",\n \"ui.placed\": \"in gap {n}\",\n \"ui.announce.pick\": \"Picked “{word}”. Choose its gap with the arrow keys and press Enter, or go to the gap and press Enter.\",\n \"ui.announce.wait\": \"Gap {n}: choose a word with the arrow keys and press Enter.\",\n \"ui.announce.out\": \"Took “{word}” out of gap {n}. Pick another gap for it, or press Escape.\",\n \"ui.announce.bank\": \"Word bank\",\n \"ui.announce.gap\": \"Gap {n}: “{word}”\",\n \"ui.announce.gapEmpty\": \"Gap {n}, empty\",\n \"ui.announce.word\": \"“{word}”\",\n \"ui.announce.wordPlaced\": \"“{word}”, in gap {n}\",\n \"ui.announce.put\": \"“{word}” is in gap {n}.\",\n \"ui.announce.back\": \"“{word}” is back in the word bank.\",\n \"ui.announce.stay\": \"“{word}” stays in the word bank.\",\n \"ui.announce.stayGap\": \"“{word}” stays in gap {n}.\",\n \"ui.announce.stayEmpty\": \"Gap {n} stays empty.\"\n}\n","{\n \"ui.label\": \"Bank słów\",\n \"ui.hint\": \"Wybierz słowo, a potem lukę, do której pasuje.\",\n \"ui.hintPicked\": \"Teraz wybierz lukę dla słowa „{word}”.\",\n \"ui.hintWaiting\": \"Teraz wybierz słowo do luki {n}.\",\n \"ui.placed\": \"w luce {n}\",\n \"ui.announce.pick\": \"Wybrano „{word}”. Wybierz lukę strzałkami i naciśnij Enter albo przejdź do luki i naciśnij Enter.\",\n \"ui.announce.wait\": \"Luka {n}: wybierz słowo strzałkami i naciśnij Enter.\",\n \"ui.announce.out\": \"Wyjęto „{word}” z luki {n}. Wybierz dla tego słowa inną lukę albo naciśnij Escape.\",\n \"ui.announce.bank\": \"Bank słów\",\n \"ui.announce.gap\": \"Luka {n}: „{word}”\",\n \"ui.announce.gapEmpty\": \"Luka {n}, pusta\",\n \"ui.announce.word\": \"„{word}”\",\n \"ui.announce.wordPlaced\": \"„{word}”, w luce {n}\",\n \"ui.announce.put\": \"„{word}” jest w luce {n}.\",\n \"ui.announce.back\": \"Słowo „{word}” wróciło do banku słów.\",\n \"ui.announce.stay\": \"„{word}” zostaje w banku słów.\",\n \"ui.announce.stayGap\": \"„{word}” zostaje w luce {n}.\",\n \"ui.announce.stayEmpty\": \"Luka {n} zostaje pusta.\"\n}\n"],"mappings":"AAQA,IAAaA,EAAsC,CACjD,IAAK,iBACL,QAAS,EACT,QAAS,QACT,OAAQ,GACR,WAAY,CAEV,CAAE,KAAM,QAAS,KAAM,UAAW,WAAY,SAAU,QAAS,EAAM,CACzE,EACA,SAAU,CAKR,CACE,IAAK,YACL,WAAY,SACZ,QAAS,SACT,IAAK,EACL,IAAK,GACL,WAAY,CACV,CAAE,KAAM,KAAM,KAAM,KAAM,WAAY,SAAU,SAAU,EAAK,EAC/D,CAAE,KAAM,aAAc,KAAM,UAAW,WAAY,UAAW,QAAS,EAAM,CAC/E,CACF,CACF,EACA,QAAS,KACT,SAAU,KACV,UAAW,CAAC,EACZ,OAAQ,CAAC,uBAAwB,2BAA4B,qBAAqB,EAClF,SAAU,iBACV,KAAM,CACJ,QACE,4OACF,KAAM,CACJ,MACA,QACA,QACA,UACA,YACA,YACA,aACA,OACA,MACA,QACF,CACF,EACA,SAAU,CAAC,YAAa,QAAS,OAAQ,MAAM,CACjD,E"}
|